mirror of
https://github.com/reactos/reactos.git
synced 2024-09-06 10:52:52 +00:00
[BOOTLIB]: Add support for initializing the input console object.
[BOOTLIB]: Add a bunch more graphical console support functions. [BOOTLIB]: Cleanup some older graphics-related code. [BOOTLIB]: Support graphics re-initialization. We now correctly fallback to text mode since font loading is not implemented. svn path=/trunk/; revision=70514
This commit is contained in:
parent
fc458c3371
commit
69dbd65521
|
@ -394,8 +394,12 @@ NTSTATUS
|
|||
|
||||
struct _BL_TEXT_CONSOLE;
|
||||
struct _BL_DISPLAY_STATE;
|
||||
struct _BL_DISPLAY_MODE;
|
||||
struct _BL_INPUT_CONSOLE;
|
||||
struct _BL_REMOTE_CONSOLE;
|
||||
struct _BL_GRAPHICS_CONSOLE;
|
||||
typedef
|
||||
NTSTATUS
|
||||
VOID
|
||||
(*PCONSOLE_DESTRUCT) (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console
|
||||
);
|
||||
|
@ -443,6 +447,33 @@ NTSTATUS
|
|||
_In_ ULONG Attribute
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(*PCONSOLE_IS_ENABLED) (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console
|
||||
);
|
||||
|
||||
typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_GET_GRAPHICAL_RESOLUTION) (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_Out_ struct _BL_DISPLAY_MODE* DisplayMode
|
||||
);
|
||||
|
||||
typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_SET_GRAPHICAL_RESOLUTION) (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ struct _BL_DISPLAY_MODE DisplayMode
|
||||
);
|
||||
|
||||
typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_ENABLE) (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ BOOLEAN Enable
|
||||
);
|
||||
|
||||
typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_WRITE_TEXT) (
|
||||
|
@ -875,6 +906,12 @@ typedef struct _BL_TEXT_CONSOLE_VTABLE
|
|||
typedef struct _BL_GRAPHICS_CONSOLE_VTABLE
|
||||
{
|
||||
BL_TEXT_CONSOLE_VTABLE Text;
|
||||
PCONSOLE_IS_ENABLED IsEnabled;
|
||||
PCONSOLE_ENABLE Enable;
|
||||
PVOID GetConsoleResolution;
|
||||
PCONSOLE_GET_GRAPHICAL_RESOLUTION GetGraphicalResolution;
|
||||
PCONSOLE_GET_GRAPHICAL_RESOLUTION GetOriginalResolution;
|
||||
PCONSOLE_SET_GRAPHICAL_RESOLUTION SetOriginalResolution;
|
||||
/// more for graphics ///
|
||||
} BL_GRAPHICS_CONSOLE_VTABLE, *PBL_GRAPHICS_CONSOLE_VTABLE;
|
||||
|
||||
|
@ -889,6 +926,25 @@ typedef struct _BL_TEXT_CONSOLE
|
|||
EFI_SIMPLE_TEXT_OUTPUT_MODE OldMode;
|
||||
} BL_TEXT_CONSOLE, *PBL_TEXT_CONSOLE;
|
||||
|
||||
typedef struct _BL_INPUT_CONSOLE_VTABLE
|
||||
{
|
||||
PCONSOLE_DESTRUCT Destruct;
|
||||
PCONSOLE_REINITIALIZE Reinitialize;
|
||||
//PCONSOLE_IS_KEY_PENDING IsKeyPending;
|
||||
//PCONSOLE_READ_INPUT ReadInput;
|
||||
//PCONSOLE_ERASE_BUFFER EraseBuffer;
|
||||
//PCONSOLE_FILL_BUFFER FillBuffer;
|
||||
} BL_INPUT_CONSOLE_VTABLE, *PBL_INPUT_CONSOLE_VTABLE;
|
||||
|
||||
typedef struct _BL_INPUT_CONSOLE
|
||||
{
|
||||
PBL_INPUT_CONSOLE_VTABLE Callbacks;
|
||||
PULONG Buffer;
|
||||
PULONG DataStart;
|
||||
PULONG DataEnd;
|
||||
PULONG EndBuffer;
|
||||
} BL_INPUT_CONSOLE, *PBL_INPUT_CONSOLE;
|
||||
|
||||
typedef enum _BL_GRAPHICS_CONSOLE_TYPE
|
||||
{
|
||||
BlGopConsole,
|
||||
|
@ -1185,6 +1241,16 @@ EfiStall (
|
|||
_In_ ULONG StallTime
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConInExReset (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConInReset (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutQueryMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
|
@ -1871,9 +1937,59 @@ BlFileOpen (
|
|||
_Out_ PULONG FileId
|
||||
);
|
||||
|
||||
/* TEXT CONSOLE ROUTINES *****************************************************/
|
||||
/* INPUT CONSOLE ROUTINES ****************************************************/
|
||||
|
||||
VOID
|
||||
ConsoleInputLocalDestruct (
|
||||
_In_ struct _BL_INPUT_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputBaseReinitialize (
|
||||
_In_ struct _BL_INPUT_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleCreateLocalInputCnsole (
|
||||
VOID
|
||||
);
|
||||
|
||||
/* TEXT CONSOLE ROUTINES *****************************************************/
|
||||
|
||||
VOID
|
||||
ConsoleGraphicalDestruct (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalReinitialize (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
ConsoleGraphicalIsEnabled (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalGetGraphicalResolution (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ PBL_DISPLAY_MODE DisplayMode
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalGetOriginalResolution (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ PBL_DISPLAY_MODE DisplayMode
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalEnable (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ BOOLEAN Enable
|
||||
);
|
||||
|
||||
VOID
|
||||
ConsoleTextLocalDestruct (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console
|
||||
);
|
||||
|
@ -1973,6 +2089,11 @@ ConsoleFirmwareGraphicalClose (
|
|||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
);
|
||||
|
||||
VOID
|
||||
ConsoleFirmwareGraphicalDisable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleFirmwareGraphicalEnable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
|
@ -2010,6 +2131,17 @@ ConsoleEfiUgaSetResolution (
|
|||
_In_ ULONG DisplayModeCount
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleCreateLocalInputConsole (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputLocalEraseBuffer (
|
||||
_In_ PBL_INPUT_CONSOLE Console,
|
||||
_In_opt_ PULONG ValueToFill
|
||||
);
|
||||
|
||||
extern ULONG MmDescriptorCallTreeCount;
|
||||
extern ULONG BlpApplicationFlags;
|
||||
extern BL_LIBRARY_PARAMETERS BlpLibraryParameters;
|
||||
|
@ -2017,7 +2149,8 @@ extern BL_TRANSLATION_TYPE MmTranslationType;
|
|||
extern PBL_ARCH_CONTEXT CurrentExecutionContext;
|
||||
extern PBL_DEVICE_DESCRIPTOR BlpBootDevice;
|
||||
extern BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry;
|
||||
extern SIMPLE_TEXT_OUTPUT_INTERFACE *EfiConOut;
|
||||
extern EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *EfiConOut;
|
||||
extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *EfiConInEx;
|
||||
extern EFI_GUID EfiGraphicsOutputProtocol;
|
||||
extern EFI_GUID EfiUgaDrawProtocol;
|
||||
extern EFI_GUID EfiLoadedImageProtocol;
|
||||
|
@ -2029,6 +2162,7 @@ extern BL_DISPLAY_MODE ConsoleGraphicalResolutionList[];
|
|||
extern BL_DISPLAY_MODE ConsoleTextResolutionList[];
|
||||
extern ULONG ConsoleGraphicalResolutionListSize;
|
||||
extern PVOID DspRemoteInputConsole;
|
||||
extern PVOID DspLocalInputConsole;
|
||||
extern WCHAR BlScratchBuffer[8192];
|
||||
extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedAllocated;
|
||||
#endif
|
||||
|
|
|
@ -258,6 +258,64 @@ EfiCloseProtocol (
|
|||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConInReset (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = EfiConIn->Reset(EfiConIn, FALSE);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConInExReset (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = EfiConInEx->Reset(EfiConInEx, FALSE);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConInExSetState (
|
||||
_In_ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *ConInEx,
|
||||
|
|
|
@ -35,6 +35,7 @@ BL_DISPLAY_MODE ConsoleTextResolutionList[1] =
|
|||
PVOID DspRemoteInputConsole;
|
||||
PVOID DspTextConsole;
|
||||
PVOID DspGraphicalConsole;
|
||||
PVOID DspLocalInputConsole;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -43,8 +44,14 @@ DsppGraphicsDisabledByBcd (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"Disabling graphics\r\n");
|
||||
return FALSE;
|
||||
BOOLEAN Disabled;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Get the boot option, and if present, return the result */
|
||||
Status = BlGetBootOptionBoolean(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_GraphicsModeDisabled,
|
||||
&Disabled);
|
||||
return (NT_SUCCESS(Status) && (Disabled));
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
@ -408,6 +415,167 @@ DsppInitialize (
|
|||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
DsppReinitialize (
|
||||
_In_ ULONG Flags
|
||||
)
|
||||
{
|
||||
PBL_TEXT_CONSOLE TextConsole;
|
||||
PBL_GRAPHICS_CONSOLE GraphicsConsole;
|
||||
NTSTATUS Status;
|
||||
ULONGLONG GraphicsResolution;
|
||||
BOOLEAN HighestMode;
|
||||
BL_DISPLAY_MODE CurrentResolution;
|
||||
|
||||
/* Do we have local input yet? */
|
||||
if (!DspLocalInputConsole)
|
||||
{
|
||||
/* Create it now */
|
||||
ConsoleCreateLocalInputConsole();
|
||||
}
|
||||
|
||||
/* If a graphics console is present without a remote console... */
|
||||
TextConsole = NULL;
|
||||
if (!(DspRemoteInputConsole) && (DspGraphicalConsole))
|
||||
{
|
||||
/* Try to create a remote console */
|
||||
ConsoleCreateRemoteConsole(&TextConsole);
|
||||
}
|
||||
|
||||
/* All good for now */
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
/* Now check if we were able to create the remote console */
|
||||
if (TextConsole)
|
||||
{
|
||||
EfiPrintf(L"EMS not supported\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Set a local for the right cast */
|
||||
GraphicsConsole = DspGraphicalConsole;
|
||||
|
||||
/* Nothing to do without a graphics console being reinitialized */
|
||||
if (!(Flags & BL_LIBRARY_FLAG_REINITIALIZE_ALL) ||
|
||||
!(GraphicsConsole) ||
|
||||
!(((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole)))
|
||||
{
|
||||
EfiPrintf(L"Nothing to do for re-init\r\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check if graphics are disabled in the BCD */
|
||||
if (DsppGraphicsDisabledByBcd())
|
||||
{
|
||||
/* Turn off the graphics console, switching back to text mode */
|
||||
Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->Enable(GraphicsConsole, FALSE);
|
||||
}
|
||||
|
||||
/* Check if a custom graphics resolution is set */
|
||||
if (MiscGetBootOption(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryInteger_GraphicsResolution))
|
||||
{
|
||||
/* Check what it's set to */
|
||||
Status = BlGetBootOptionInteger(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryInteger_GraphicsResolution,
|
||||
&GraphicsResolution);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Now check our current graphical resolution */
|
||||
Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetGraphicalResolution(GraphicsConsole,
|
||||
&CurrentResolution);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Remember that we're forcing a video mode */
|
||||
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG;
|
||||
|
||||
/* Check which resolution to set */
|
||||
if (!GraphicsResolution)
|
||||
{
|
||||
/* 1024x768 */
|
||||
EfiPrintf(L"Display selection not yet handled\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
else if (GraphicsResolution == 1)
|
||||
{
|
||||
/* 800x600 */
|
||||
EfiPrintf(L"Display selection not yet handled\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
else if (GraphicsResolution == 2)
|
||||
{
|
||||
/* 1024x600 */
|
||||
EfiPrintf(L"Display selection not yet handled\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the force highest mode setting is present */
|
||||
if (MiscGetBootOption(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_GraphicsForceHighestMode))
|
||||
{
|
||||
/* Check what it's set to */
|
||||
Status = BlGetBootOptionBoolean(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_GraphicsForceHighestMode,
|
||||
&HighestMode);
|
||||
if ((NT_SUCCESS(Status)) && (HighestMode))
|
||||
{
|
||||
/* Remember that high rest mode is being forced */
|
||||
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG;
|
||||
|
||||
/* Turn it on */
|
||||
//((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->SetGraphicalResolution(GraphicsConsole, 0, 0);
|
||||
|
||||
/* All done now */
|
||||
ConsoleGraphicalResolutionListFlags |= ~BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG;
|
||||
EfiPrintf(L"High res mode not yet handled\r\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return back to the caller */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlpDisplayReinitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_TEXT_CONSOLE TextConsole;
|
||||
PBL_INPUT_CONSOLE InputConsole;
|
||||
|
||||
/* Do we have a local console? */
|
||||
InputConsole = DspLocalInputConsole;
|
||||
if (InputConsole)
|
||||
{
|
||||
/* Reinitialize it */
|
||||
Status = InputConsole->Callbacks->Reinitialize((PBL_TEXT_CONSOLE)InputConsole);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Do we have a text console? */
|
||||
TextConsole = DspTextConsole;
|
||||
if (TextConsole)
|
||||
{
|
||||
/* Reinitialize it */
|
||||
Status = TextConsole->Callbacks->Reinitialize(TextConsole);
|
||||
}
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlpDisplayInitialize (
|
||||
_In_ ULONG Flags
|
||||
|
@ -419,15 +587,12 @@ BlpDisplayInitialize (
|
|||
if (Flags & BL_LIBRARY_FLAG_REINITIALIZE)
|
||||
{
|
||||
/* This is a reset */
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
EfiPrintf(L"Display reset not yet implemented\r\n");
|
||||
#if 0
|
||||
Status = DsppReinitialize(Flags);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Re-initialize the class as well */
|
||||
Status = BlpDisplayReinitialize();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -446,6 +611,7 @@ BlDisplayGetTextCellResolution (
|
|||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_GRAPHICS_CONSOLE GraphicsConsole;
|
||||
|
||||
/* If the caller doesn't want anything, bail out */
|
||||
if (!(TextWidth) || !(TextHeight))
|
||||
|
@ -458,11 +624,17 @@ BlDisplayGetTextCellResolution (
|
|||
if (DspTextConsole)
|
||||
{
|
||||
/* Do we have a graphics console? */
|
||||
if (DspGraphicalConsole)
|
||||
GraphicsConsole = DspGraphicalConsole;
|
||||
if (GraphicsConsole)
|
||||
{
|
||||
/* Is it currently active? */
|
||||
if (((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole))
|
||||
{
|
||||
/* Yep -- query it */
|
||||
EfiPrintf(L"Not supported\r\n");
|
||||
EfiPrintf(L"GFX active, not supported query\r\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
//Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetTextCellResolution(GraphicsConsole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,20 +662,15 @@ BlDisplaySetScreenResolution (
|
|||
Console = DspGraphicalConsole;
|
||||
if (Console)
|
||||
{
|
||||
#if 0
|
||||
/* Is it active? If not, activate it */
|
||||
if (((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->IsActive())
|
||||
/* Is it currently active? */
|
||||
if (((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->IsEnabled(Console))
|
||||
{
|
||||
return ((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->Activate(Console, FALSE);
|
||||
/* If so, disable it */
|
||||
return ((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->Enable(Console, FALSE);
|
||||
}
|
||||
#else
|
||||
/* Not yet supported */
|
||||
EfiPrintf(L"Graphics not yet supported\r\n");
|
||||
//Status = STATUS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Do we have a text console? */
|
||||
/* We should've now fallen back to text mode */
|
||||
if (!DspTextConsole)
|
||||
{
|
||||
/* Then fail, as no display appears active */
|
||||
|
@ -517,11 +684,12 @@ BlDisplaySetScreenResolution (
|
|||
NTSTATUS
|
||||
BlDisplayGetScreenResolution (
|
||||
_Out_ PULONG HRes,
|
||||
_Out_ PULONG Vres
|
||||
_Out_ PULONG VRes
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
// PULONG Resolution;
|
||||
BL_DISPLAY_MODE Resolution;
|
||||
PBL_GRAPHICS_CONSOLE GraphicsConsole;
|
||||
|
||||
/* Assume failure if no consoles are active */
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
|
@ -530,33 +698,24 @@ BlDisplayGetScreenResolution (
|
|||
if (DspTextConsole)
|
||||
{
|
||||
/* Do we have an active graphics console? */
|
||||
if ((DspGraphicalConsole)
|
||||
#if 0
|
||||
&& (((PBL_GRAPHICS_CONSOLE_VTABLE)DspGraphicalConsole->TextConsole.Callbacks)->IsActive())
|
||||
#endif
|
||||
)
|
||||
GraphicsConsole = DspGraphicalConsole;
|
||||
if ((GraphicsConsole) &&
|
||||
(((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole)))
|
||||
{
|
||||
#if 0
|
||||
/* Get the resolution */
|
||||
Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)DspGraphicalConsole->TextConsole.Callbacks)->GetResolution(DspGraphicalConsole, &Resolution);
|
||||
Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetGraphicalResolution(GraphicsConsole, &Resolution);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Return it back to the caller */
|
||||
*HRes = Resolution[0];
|
||||
*Vres = Resolution[1];
|
||||
*HRes = Resolution.HRes;
|
||||
*VRes = Resolution.VRes;
|
||||
}
|
||||
#else
|
||||
/* Not yet supported */
|
||||
EfiPrintf(L"Graphics not yet supported\r\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
/* Return defaults */
|
||||
*HRes = 640;
|
||||
*Vres = 200;
|
||||
*VRes = 200;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,3 +111,20 @@ ConsoleFirmwareGraphicalEnable (
|
|||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
ConsoleFirmwareGraphicalDisable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
)
|
||||
{
|
||||
/* Is this a GOP console? */
|
||||
if (GraphicsConsole->Type == BlGopConsole)
|
||||
{
|
||||
/* Did we map a framebuffer? */
|
||||
if (GraphicsConsole->FrameBuffer)
|
||||
{
|
||||
/* Unmap it */
|
||||
BlMmUnmapVirtualAddressEx(GraphicsConsole->FrameBuffer,
|
||||
GraphicsConsole->FrameBufferSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -489,3 +489,66 @@ ConsoleFirmwareTextOpen (
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputBaseEraseBuffer (
|
||||
_In_ PBL_INPUT_CONSOLE Console,
|
||||
_In_opt_ PULONG FillValue
|
||||
)
|
||||
{
|
||||
ULONG ValueToFill;
|
||||
PULONG i;
|
||||
|
||||
/* Check if we should fill with a particular value */
|
||||
if (FillValue)
|
||||
{
|
||||
/* Use it */
|
||||
ValueToFill = *FillValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, use default */
|
||||
ValueToFill = 0x10020;
|
||||
}
|
||||
|
||||
/* Set the input buffer to its last location */
|
||||
Console->DataStart = Console->DataEnd;
|
||||
|
||||
/* Fill the buffer with the value */
|
||||
for (i = Console->Buffer; i < Console->EndBuffer; i++)
|
||||
{
|
||||
*i = ValueToFill;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputLocalEraseBuffer (
|
||||
_In_ PBL_INPUT_CONSOLE Console,
|
||||
_In_opt_ PULONG FillValue
|
||||
)
|
||||
{
|
||||
NTSTATUS Status, EfiStatus;
|
||||
|
||||
/* Erase the software buffer */
|
||||
Status = ConsoleInputBaseEraseBuffer(Console, FillValue);
|
||||
|
||||
/* Reset the hardware console */
|
||||
EfiStatus = EfiConInEx ? EfiConInExReset() : EfiConInReset();
|
||||
if (!NT_SUCCESS(EfiStatus))
|
||||
{
|
||||
/* Normalize the failure code */
|
||||
EfiStatus = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Check if software reset worked */
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Then return the firmware code */
|
||||
Status = EfiStatus;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return Status;
|
||||
}
|
|
@ -14,7 +14,16 @@
|
|||
|
||||
BL_GRAPHICS_CONSOLE_VTABLE ConsoleGraphicalVtbl =
|
||||
{
|
||||
{ NULL },
|
||||
{
|
||||
(PCONSOLE_DESTRUCT)ConsoleGraphicalDestruct,
|
||||
(PCONSOLE_REINITIALIZE)ConsoleGraphicalReinitialize
|
||||
},
|
||||
ConsoleGraphicalIsEnabled,
|
||||
ConsoleGraphicalEnable,
|
||||
NULL,
|
||||
ConsoleGraphicalGetGraphicalResolution,
|
||||
ConsoleGraphicalGetOriginalResolution,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
@ -69,3 +78,146 @@ ConsoleGraphicalConstruct (
|
|||
GraphicsConsole->BgColor = GraphicsConsole->TextConsole.State.BgColor;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
ConsoleGraphicalIsEnabled (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* Is the text console active? If so, the graphics console isn't */
|
||||
return !Console->TextConsole.Active;
|
||||
}
|
||||
|
||||
VOID
|
||||
ConsoleGraphicalDestruct (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* Disable it */
|
||||
ConsoleFirmwareGraphicalDisable(Console);
|
||||
}
|
||||
|
||||
/* Close the firmware protocols */
|
||||
ConsoleFirmwareGraphicalClose(Console);
|
||||
|
||||
/* Destroy the console object */
|
||||
ConsoleTextLocalDestruct(&Console->TextConsole);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalReinitialize (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* Reinitialize it */
|
||||
ConsoleTextLocalReinitialize(&Console->TextConsole);
|
||||
}
|
||||
|
||||
/* Disable the graphics console */
|
||||
ConsoleFirmwareGraphicalDisable(Console);
|
||||
|
||||
/* Then bring it back again */
|
||||
return ConsoleFirmwareGraphicalEnable(Console);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalEnable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ BOOLEAN Enable
|
||||
)
|
||||
{
|
||||
BOOLEAN Active;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* The text mode console state should be the opposite of what we want to do */
|
||||
Active = Console->TextConsole.Active;
|
||||
if (Active == Enable)
|
||||
{
|
||||
/* Are we trying to enable graphics? */
|
||||
if (Enable)
|
||||
{
|
||||
/* Enable the console */
|
||||
Status = ConsoleFirmwareGraphicalEnable(Console);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* Turn it off */
|
||||
ConsoleFirmwareTextClose(&Console->TextConsole);
|
||||
Console->TextConsole.Active = FALSE;
|
||||
}
|
||||
|
||||
/* Preserve the text colors */
|
||||
Console->FgColor = Console->TextConsole.State.FgColor;
|
||||
Console->BgColor = Console->TextConsole.State.BgColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We are turning off graphics -- is the text console active? */
|
||||
if (Active != TRUE)
|
||||
{
|
||||
/* It isn't, so let's turn it on */
|
||||
Status = ConsoleFirmwareTextOpen(&Console->TextConsole);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Remember that it's on */
|
||||
Console->TextConsole.Active = TRUE;
|
||||
}
|
||||
|
||||
/* Disable the graphics console */
|
||||
ConsoleFirmwareGraphicalDisable(Console);
|
||||
}
|
||||
}
|
||||
|
||||
/* All good */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalGetGraphicalResolution (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ PBL_DISPLAY_MODE DisplayMode
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* There's no graphics resolution then */
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Return the current display mode */
|
||||
*DisplayMode = Console->DisplayMode;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalGetOriginalResolution (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ PBL_DISPLAY_MODE DisplayMode
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* There's no graphics resolution then */
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Return the current display mode */
|
||||
*DisplayMode = Console->OldDisplayMode;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -26,12 +26,12 @@ BL_TEXT_CONSOLE_VTABLE ConsoleTextLocalVtbl =
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
VOID
|
||||
ConsoleTextLocalDestruct (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console
|
||||
)
|
||||
{
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
@ -39,6 +39,7 @@ ConsoleTextLocalReinitialize (
|
|||
_In_ struct _BL_TEXT_CONSOLE* Console
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"Not active yet!\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -182,3 +183,88 @@ ConsolepFindResolution (
|
|||
/* No matches were found */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BL_INPUT_CONSOLE_VTABLE ConsoleInputLocalVtbl =
|
||||
{
|
||||
(PCONSOLE_DESTRUCT)ConsoleInputLocalDestruct,
|
||||
(PCONSOLE_REINITIALIZE)ConsoleInputBaseReinitialize,
|
||||
};
|
||||
|
||||
VOID
|
||||
ConsoleInputLocalDestruct (
|
||||
_In_ PBL_INPUT_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* Erase the current input buffer, and tear down the console */
|
||||
ConsoleInputLocalEraseBuffer(Console, NULL);
|
||||
BlMmFreeHeap(Console->Buffer);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputBaseConstruct (
|
||||
_In_ PBL_INPUT_CONSOLE Console
|
||||
)
|
||||
{
|
||||
PULONG Buffer;
|
||||
|
||||
/* Allocate a new 512 byte buffer */
|
||||
Buffer = BlMmAllocateHeap(512);
|
||||
Console->Buffer = Buffer;
|
||||
if (!Buffer)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Set the current buffer pointers to it */
|
||||
Console->DataStart = Buffer;
|
||||
Console->DataEnd = Buffer;
|
||||
|
||||
/* Set the end 128 data entries into the buffer */
|
||||
Console->EndBuffer = Buffer + 128;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputBaseReinitialize (
|
||||
_In_ PBL_INPUT_CONSOLE Console
|
||||
)
|
||||
{
|
||||
PULONG Buffer;
|
||||
|
||||
/* Reset all the buffer pointers to the current buffer */
|
||||
Buffer = Console->Buffer;
|
||||
Console->DataStart = Buffer;
|
||||
Console->DataEnd = Buffer;
|
||||
Console->EndBuffer = Buffer + 128;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleCreateLocalInputConsole (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PBL_INPUT_CONSOLE InputConsole;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Allocate the input console */
|
||||
InputConsole = BlMmAllocateHeap(sizeof(*InputConsole));
|
||||
if (!InputConsole)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Construct it */
|
||||
Status = ConsoleInputBaseConstruct(InputConsole);
|
||||
if (!NT_SUCCESS(Status));
|
||||
{
|
||||
/* Tear down on failure */
|
||||
BlMmFreeHeap(InputConsole);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Set the callback table, and set us as the local input console */
|
||||
InputConsole->Callbacks = &ConsoleInputLocalVtbl;
|
||||
DspLocalInputConsole = InputConsole;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
|
@ -22,7 +22,7 @@ BfiLoadFontFile (
|
|||
_In_ PWCHAR FontPath
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"rotfl font loading\r\n");
|
||||
EfiPrintf(L"Cannot load fond %s, no font loader exists\r\n", FontPath);
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,6 @@ BfLoadFontFile (
|
|||
{
|
||||
PBL_DEFERRED_FONT_FILE DeferredFont;
|
||||
ULONG FontPathSize;
|
||||
EfiPrintf(L"Adding deferred font: %s\r\n", FontPath);
|
||||
|
||||
/* Allocate the deferred font structure */
|
||||
DeferredFont = (PBL_DEFERRED_FONT_FILE)BlMmAllocateHeap(sizeof(*DeferredFont));
|
||||
|
@ -120,7 +119,6 @@ BfLoadDeferredFontFiles (
|
|||
RemoveEntryList(&DeferredFont->ListEntry);
|
||||
|
||||
/* Load the font */
|
||||
EfiPrintf(L"Found deferred font: %s\r\n", DeferredFont->FontPath);
|
||||
LoadStatus = BfiLoadFontFile(DeferredFont->Device,
|
||||
DeferredFont->FontPath);
|
||||
if (!NT_SUCCESS(LoadStatus))
|
||||
|
|
|
@ -68,6 +68,7 @@ ResSelectLocale (
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Fallback to text mode (yes, this is the API...) */
|
||||
EfiPrintf(L"Locale failed, falling back to text mode\r\n");
|
||||
return BlDisplaySetScreenResolution();
|
||||
}
|
||||
}
|
||||
|
@ -383,6 +384,7 @@ BlResourceFindMessage (
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Still didn't work -- fallback to text mode */
|
||||
EfiPrintf(L"Font loading failed, falling back to text mode\r\n");
|
||||
Status = BlDisplaySetScreenResolution();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -149,7 +149,7 @@ MmMdpSwitchToDynamicDescriptors (
|
|||
_In_ ULONG Count
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"NOT SUPPORTED!!!\r\n");
|
||||
EfiPrintf(L"dynamic switch NOT SUPPORTED!!!\r\n");
|
||||
while (1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue