Author: ion
Date: Thu Jan 7 04:28:13 2016
New Revision: 70514
URL:
http://svn.reactos.org/svn/reactos?rev=70514&view=rev
Log:
[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.
Modified:
trunk/reactos/boot/environ/include/bl.h
trunk/reactos/boot/environ/lib/firmware/efi/firmware.c
trunk/reactos/boot/environ/lib/io/display/display.c
trunk/reactos/boot/environ/lib/io/display/efi/guicons.c
trunk/reactos/boot/environ/lib/io/display/efi/textcons.c
trunk/reactos/boot/environ/lib/io/display/guicons.c
trunk/reactos/boot/environ/lib/io/display/textcons.c
trunk/reactos/boot/environ/lib/misc/font.c
trunk/reactos/boot/environ/lib/misc/resource.c
trunk/reactos/boot/environ/lib/mm/descriptor.c
Modified: trunk/reactos/boot/environ/include/bl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
==============================================================================
--- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Thu Jan 7 04:28:13 2016
@@ -394,8 +394,12 @@
struct _BL_TEXT_CONSOLE;
struct _BL_DISPLAY_STATE;
-typedef
-NTSTATUS
+struct _BL_DISPLAY_MODE;
+struct _BL_INPUT_CONSOLE;
+struct _BL_REMOTE_CONSOLE;
+struct _BL_GRAPHICS_CONSOLE;
+typedef
+VOID
(*PCONSOLE_DESTRUCT) (
_In_ struct _BL_TEXT_CONSOLE* Console
);
@@ -442,6 +446,33 @@
_In_ struct _BL_TEXT_CONSOLE* Console,
_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
@@ -875,6 +906,12 @@
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;
@@ -888,6 +925,25 @@
ULONG Mode;
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
{
@@ -1186,6 +1242,16 @@
);
NTSTATUS
+EfiConInExReset (
+ VOID
+ );
+
+NTSTATUS
+EfiConInReset (
+ VOID
+ );
+
+NTSTATUS
EfiConOutQueryMode (
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
_In_ ULONG Mode,
@@ -1871,9 +1937,59 @@
_Out_ PULONG FileId
);
+/* 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 *****************************************************/
-NTSTATUS
+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 @@
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
);
+VOID
+ConsoleFirmwareGraphicalDisable (
+ _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
+ );
+
NTSTATUS
ConsoleFirmwareGraphicalEnable (
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
@@ -2008,6 +2129,17 @@
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole,
_In_ PBL_DISPLAY_MODE DisplayMode,
_In_ ULONG DisplayModeCount
+ );
+
+NTSTATUS
+ConsoleCreateLocalInputConsole (
+ VOID
+ );
+
+NTSTATUS
+ConsoleInputLocalEraseBuffer (
+ _In_ PBL_INPUT_CONSOLE Console,
+ _In_opt_ PULONG ValueToFill
);
extern ULONG MmDescriptorCallTreeCount;
@@ -2017,7 +2149,8 @@
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 ConsoleTextResolutionList[];
extern ULONG ConsoleGraphicalResolutionListSize;
extern PVOID DspRemoteInputConsole;
+extern PVOID DspLocalInputConsole;
extern WCHAR BlScratchBuffer[8192];
extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedAllocated;
#endif
Modified: trunk/reactos/boot/environ/lib/firmware/efi/firmware.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/firmware/…
==============================================================================
--- trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] Thu Jan 7
04:28:13 2016
@@ -256,6 +256,64 @@
/* All done */
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
Modified: trunk/reactos/boot/environ/lib/io/display/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/displa…
==============================================================================
--- trunk/reactos/boot/environ/lib/io/display/display.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/io/display/display.c [iso-8859-1] Thu Jan 7 04:28:13
2016
@@ -35,6 +35,7 @@
PVOID DspRemoteInputConsole;
PVOID DspTextConsole;
PVOID DspGraphicalConsole;
+PVOID DspLocalInputConsole;
/* FUNCTIONS *****************************************************************/
@@ -43,8 +44,14 @@
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
@@ -409,6 +416,167 @@
}
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 @@
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 @@
)
{
NTSTATUS Status;
+ PBL_GRAPHICS_CONSOLE GraphicsConsole;
/* If the caller doesn't want anything, bail out */
if (!(TextWidth) || !(TextHeight))
@@ -458,11 +624,17 @@
if (DspTextConsole)
{
/* Do we have a graphics console? */
- if (DspGraphicalConsole)
- {
- /* Yep -- query it */
- EfiPrintf(L"Not supported\r\n");
- Status = STATUS_NOT_IMPLEMENTED;
+ GraphicsConsole = DspGraphicalConsole;
+ if (GraphicsConsole)
+ {
+ /* Is it currently active? */
+ if
(((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole))
+ {
+ /* Yep -- query it */
+ 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 @@
Console = DspGraphicalConsole;
if (Console)
{
-#if 0
- /* Is it active? If not, activate it */
- if
(((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->IsActive())
- {
- return
((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->Activate(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? */
+ /* Is it currently active? */
+ if
(((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->IsEnabled(Console))
+ {
+ /* If so, disable it */
+ return
((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->Enable(Console,
FALSE);
+ }
+ }
+
+ /* We should've now fallen back to text mode */
if (!DspTextConsole)
{
/* Then fail, as no display appears active */
@@ -517,11 +684,12 @@
NTSTATUS
BlDisplayGetScreenResolution (
_Out_ PULONG HRes,
- _Out_ PULONG Vres
- )
-{
- NTSTATUS Status;
-// PULONG Resolution;
+ _Out_ PULONG VRes
+ )
+{
+ NTSTATUS Status;
+ BL_DISPLAY_MODE Resolution;
+ PBL_GRAPHICS_CONSOLE GraphicsConsole;
/* Assume failure if no consoles are active */
Status = STATUS_UNSUCCESSFUL;
@@ -530,33 +698,24 @@
if (DspTextConsole)
{
/* Do we have an active graphics console? */
- if ((DspGraphicalConsole)
-#if 0
- &&
(((PBL_GRAPHICS_CONSOLE_VTABLE)DspGraphicalConsole->TextConsole.Callbacks)->IsActive())
-#endif
- )
- {
-#if 0
+ GraphicsConsole = DspGraphicalConsole;
+ if ((GraphicsConsole) &&
+
(((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole)))
+ {
/* 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;
}
}
Modified: trunk/reactos/boot/environ/lib/io/display/efi/guicons.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/displa…
==============================================================================
--- trunk/reactos/boot/environ/lib/io/display/efi/guicons.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/io/display/efi/guicons.c [iso-8859-1] Thu Jan 7
04:28:13 2016
@@ -111,3 +111,20 @@
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);
+ }
+ }
+}
Modified: trunk/reactos/boot/environ/lib/io/display/efi/textcons.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/displa…
==============================================================================
--- trunk/reactos/boot/environ/lib/io/display/efi/textcons.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/io/display/efi/textcons.c [iso-8859-1] Thu Jan 7
04:28:13 2016
@@ -489,3 +489,66 @@
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;
+}
Modified: trunk/reactos/boot/environ/lib/io/display/guicons.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/displa…
==============================================================================
--- trunk/reactos/boot/environ/lib/io/display/guicons.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/io/display/guicons.c [iso-8859-1] Thu Jan 7 04:28:13
2016
@@ -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 @@
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;
+}
Modified: trunk/reactos/boot/environ/lib/io/display/textcons.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/displa…
==============================================================================
--- trunk/reactos/boot/environ/lib/io/display/textcons.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/io/display/textcons.c [iso-8859-1] Thu Jan 7 04:28:13
2016
@@ -26,12 +26,12 @@
/* FUNCTIONS *****************************************************************/
-NTSTATUS
+VOID
ConsoleTextLocalDestruct (
_In_ struct _BL_TEXT_CONSOLE* Console
)
{
- return STATUS_NOT_IMPLEMENTED;
+
}
NTSTATUS
@@ -39,6 +39,7 @@
_In_ struct _BL_TEXT_CONSOLE* Console
)
{
+ EfiPrintf(L"Not active yet!\r\n");
return STATUS_NOT_IMPLEMENTED;
}
@@ -182,3 +183,88 @@
/* 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;
+}
Modified: trunk/reactos/boot/environ/lib/misc/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/font…
==============================================================================
--- trunk/reactos/boot/environ/lib/misc/font.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/misc/font.c [iso-8859-1] Thu Jan 7 04:28:13 2016
@@ -22,7 +22,7 @@
_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 @@
{
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 @@
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))
Modified: trunk/reactos/boot/environ/lib/misc/resource.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/reso…
==============================================================================
--- trunk/reactos/boot/environ/lib/misc/resource.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/misc/resource.c [iso-8859-1] Thu Jan 7 04:28:13 2016
@@ -68,6 +68,7 @@
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 @@
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))
{
Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/descri…
==============================================================================
--- trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] Thu Jan 7 04:28:13 2016
@@ -149,7 +149,7 @@
_In_ ULONG Count
)
{
- EfiPrintf(L"NOT SUPPORTED!!!\r\n");
+ EfiPrintf(L"dynamic switch NOT SUPPORTED!!!\r\n");
while (1);
}