gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics|FALSE|BOOLEAN|0x0001003f\r
gEfiMdeModulePkgTokenSpaceGuid.PcdUnicodeCollationSupport|TRUE|BOOLEAN|0x00010040\r
gEfiMdeModulePkgTokenSpaceGuid.PcdUnicodeCollation2Support|TRUE|BOOLEAN|0x00010041\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE|BOOLEAN|0x00010042\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|TRUE|BOOLEAN|0x00010043\r
\r
[PcdsFixedAtBuild.common]\r
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry|0x08|UINT32|0x0001000f\r
SmBusLib|MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf\r
PeiPiLib|MdePkg/Library/PeiPiLib/PeiPiLib.inf\r
ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf\r
- \r
+\r
[LibraryClasses.common.DXE_CORE]\r
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf\r
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf\r
\r
[LibraryClasses.IPF.DXE_RUNTIME_DRIVER]\r
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf\r
- \r
+\r
[LibraryClasses.EBC.PEI_CORE]\r
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
\r
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics|FALSE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdUnicodeCollationSupport|TRUE\r
gEfiMdeModulePkgTokenSpaceGuid.PcdUnicodeCollation2Support|TRUE\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|TRUE\r
\r
[PcdsFeatureFlag.IA32]\r
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE\r
MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf\r
MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf\r
MdeModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.inf\r
- \r
+\r
MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf\r
MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf\r
MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf\r
0,\r
FALSE,\r
},\r
+ {\r
+ ConSpliterUgaDrawGetMode,\r
+ ConSpliterUgaDrawSetMode,\r
+ ConSpliterUgaDrawBlt\r
+ },\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ (EFI_UGA_PIXEL *) NULL,\r
{\r
ConSpliterGraphicsOutputQueryMode,\r
ConSpliterGraphicsOutputSetMode,\r
0,\r
FALSE,\r
},\r
+ {\r
+ ConSpliterUgaDrawGetMode,\r
+ ConSpliterUgaDrawSetMode,\r
+ ConSpliterUgaDrawBlt\r
+ },\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ (EFI_UGA_PIXEL *) NULL,\r
{\r
ConSpliterGraphicsOutputQueryMode,\r
ConSpliterGraphicsOutputSetMode,\r
/**\r
The user Entry Point for module ConSplitter. The user code starts with this function.\r
\r
- @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
@param[in] SystemTable A pointer to the EFI System Table.\r
- \r
+\r
@retval EFI_SUCCESS The entry point is executed successfully.\r
@retval other Some error occurs when executing this entry point.\r
\r
{\r
EFI_STATUS Status;\r
\r
+ ASSERT (FeaturePcdGet (PcdConOutGopSupport) ||\r
+ FeaturePcdGet (PcdConOutUgaSupport));\r
//\r
// The driver creates virtual handles for ConIn, ConOut, and StdErr.\r
// The virtual handles will always exist even if no console exist in the\r
//\r
Status = ConSplitterTextOutConstructor (&mConOut);\r
if (!EFI_ERROR (Status)) {\r
- //\r
- // In UEFI mode, Graphics Output Protocol is installed on virtual handle.\r
- //\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &mConOut.VirtualHandle,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- &mConOut.TextOut,\r
- &gEfiGraphicsOutputProtocolGuid,\r
- &mConOut.GraphicsOutput,\r
- &gEfiConsoleControlProtocolGuid,\r
- &mConOut.ConsoleControl,\r
- &gEfiPrimaryConsoleOutDeviceGuid,\r
- NULL,\r
- NULL\r
- );\r
+ if (!FeaturePcdGet (PcdConOutGopSupport)) {\r
+ //\r
+ // In EFI mode, UGA Draw protocol is installed\r
+ //\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &mConOut.VirtualHandle,\r
+ &gEfiSimpleTextOutProtocolGuid,\r
+ &mConOut.TextOut,\r
+ &gEfiUgaDrawProtocolGuid,\r
+ &mConOut.UgaDraw,\r
+ &gEfiConsoleControlProtocolGuid,\r
+ &mConOut.ConsoleControl,\r
+ &gEfiPrimaryConsoleOutDeviceGuid,\r
+ NULL,\r
+ NULL\r
+ );\r
+ } else if (!FeaturePcdGet (PcdConOutUgaSupport)) {\r
+ //\r
+ // In UEFI mode, Graphics Output Protocol is installed on virtual handle.\r
+ //\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &mConOut.VirtualHandle,\r
+ &gEfiSimpleTextOutProtocolGuid,\r
+ &mConOut.TextOut,\r
+ &gEfiGraphicsOutputProtocolGuid,\r
+ &mConOut.GraphicsOutput,\r
+ &gEfiConsoleControlProtocolGuid,\r
+ &mConOut.ConsoleControl,\r
+ &gEfiPrimaryConsoleOutDeviceGuid,\r
+ NULL,\r
+ NULL\r
+ );\r
+ } else {\r
+ //\r
+ // In EFI and UEFI comptible mode, Graphics Output Protocol and UGA are\r
+ // installed on virtual handle.\r
+ //\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &mConOut.VirtualHandle,\r
+ &gEfiSimpleTextOutProtocolGuid,\r
+ &mConOut.TextOut,\r
+ &gEfiGraphicsOutputProtocolGuid,\r
+ &mConOut.GraphicsOutput,\r
+ &gEfiUgaDrawProtocolGuid,\r
+ &mConOut.UgaDraw,\r
+ &gEfiConsoleControlProtocolGuid,\r
+ &mConOut.ConsoleControl,\r
+ &gEfiPrimaryConsoleOutDeviceGuid,\r
+ NULL,\r
+ NULL\r
+ );\r
+ }\r
\r
if (!EFI_ERROR (Status)) {\r
//\r
ConOutPrivate->TextOutQueryData[0].Rows = 25;\r
DevNullTextOutSetMode (ConOutPrivate, 0);\r
\r
- //\r
- // Setup resource for mode information in Graphics Output Protocol interface\r
- //\r
- if ((ConOutPrivate->GraphicsOutput.Mode = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE))) == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- if ((ConOutPrivate->GraphicsOutput.Mode->Info = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- //\r
- // Setup the DevNullGraphicsOutput to 800 x 600 x 32 bits per pixel\r
- //\r
- if ((ConOutPrivate->GraphicsOutputModeBuffer = AllocateZeroPool (sizeof (TEXT_OUT_GOP_MODE))) == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
+ if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
+ //\r
+ // Setup the DevNullUgaDraw to 800 x 600 x 32 bits per pixel\r
+ //\r
+ ConSpliterUgaDrawSetMode (&ConOutPrivate->UgaDraw, 800, 600, 32, 60);\r
}\r
- ConOutPrivate->GraphicsOutputModeBuffer[0].HorizontalResolution = 800;\r
- ConOutPrivate->GraphicsOutputModeBuffer[0].VerticalResolution = 600;\r
+ if (FeaturePcdGet (PcdConOutGopSupport)) {\r
+ //\r
+ // Setup resource for mode information in Graphics Output Protocol interface\r
+ //\r
+ if ((ConOutPrivate->GraphicsOutput.Mode = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE))) == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ if ((ConOutPrivate->GraphicsOutput.Mode->Info = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ //\r
+ // Setup the DevNullGraphicsOutput to 800 x 600 x 32 bits per pixel\r
+ //\r
+ if ((ConOutPrivate->GraphicsOutputModeBuffer = AllocateZeroPool (sizeof (TEXT_OUT_GOP_MODE))) == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ ConOutPrivate->GraphicsOutputModeBuffer[0].HorizontalResolution = 800;\r
+ ConOutPrivate->GraphicsOutputModeBuffer[0].VerticalResolution = 600;\r
\r
- //\r
- // Initialize the following items, theset items remain unchanged in GraphicsOutput->SetMode()\r
- // GraphicsOutputMode->Info->Version, GraphicsOutputMode->Info->PixelFormat\r
- // GraphicsOutputMode->SizeOfInfo, GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize\r
- //\r
- ConOutPrivate->GraphicsOutput.Mode->Info->Version = 0;\r
- ConOutPrivate->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;\r
- ConOutPrivate->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
- ConOutPrivate->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;\r
- ConOutPrivate->GraphicsOutput.Mode->FrameBufferSize = 0;\r
+ //\r
+ // Initialize the following items, theset items remain unchanged in GraphicsOutput->SetMode()\r
+ // GraphicsOutputMode->Info->Version, GraphicsOutputMode->Info->PixelFormat\r
+ // GraphicsOutputMode->SizeOfInfo, GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize\r
+ //\r
+ ConOutPrivate->GraphicsOutput.Mode->Info->Version = 0;\r
+ ConOutPrivate->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;\r
+ ConOutPrivate->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
+ ConOutPrivate->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;\r
+ ConOutPrivate->GraphicsOutput.Mode->FrameBufferSize = 0;\r
\r
- ConOutPrivate->GraphicsOutput.Mode->MaxMode = 1;\r
- //\r
- // Initial current mode to unknow state, and then set to mode 0\r
- //\r
- ConOutPrivate->GraphicsOutput.Mode->Mode = 0xffff;\r
- ConOutPrivate->GraphicsOutput.SetMode (&ConOutPrivate->GraphicsOutput, 0);\r
+ ConOutPrivate->GraphicsOutput.Mode->MaxMode = 1;\r
+ //\r
+ // Initial current mode to unknow state, and then set to mode 0\r
+ //\r
+ ConOutPrivate->GraphicsOutput.Mode->Mode = 0xffff;\r
+ ConOutPrivate->GraphicsOutput.SetMode (&ConOutPrivate->GraphicsOutput, 0);\r
+ }\r
\r
return Status;\r
}\r
Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw);\r
ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
\r
+ if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
+ //\r
+ // Match the UGA mode data of ConOut with the current mode\r
+ //\r
+ if (UgaDraw != NULL) {\r
+ UgaDraw->GetMode (\r
+ UgaDraw,\r
+ &mConOut.UgaHorizontalResolution,\r
+ &mConOut.UgaVerticalResolution,\r
+ &mConOut.UgaColorDepth,\r
+ &mConOut.UgaRefreshRate\r
+ );\r
+ }\r
+ }\r
return Status;\r
}\r
\r
MaxMode = Private->TextOutMode.MaxMode;\r
ASSERT (MaxMode >= 1);\r
\r
- if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {\r
- ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);\r
+ if (FeaturePcdGet (PcdConOutGopSupport)) {\r
+ if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {\r
+ ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);\r
+ }\r
}\r
\r
if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) {\r
//\r
// We just added a new UGA device in graphics mode\r
//\r
- DevNullGopSync (Private, GraphicsOutput, UgaDraw);\r
+ if (FeaturePcdGet (PcdConOutGopSupport)) {\r
+ DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);\r
+ } else if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
+ DevNullUgaSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);\r
+ }\r
} else if ((CurrentMode >= 0) && ((GraphicsOutput != NULL) || (UgaDraw != NULL)) && (CurrentMode < Private->TextOutMode.MaxMode)) {\r
//\r
// The new console supports the same mode of the current console so sync up\r
#include <Guid/StandardErrorDevice.h>\r
#include <Guid/ConsoleOutDevice.h>\r
#include <Protocol/UgaDraw.h>\r
+#include <Library/PcdLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/UefiDriverEntryPoint.h>\r
#include <Library/UefiLib.h>\r
// These definitions were in the old Hii protocol, but are not in the new UEFI\r
// version. So they are defined locally.\r
#define UNICODE_NARROW_CHAR 0xFFF0\r
-#define UNICODE_WIDE_CHAR 0xFFF1 \r
+#define UNICODE_WIDE_CHAR 0xFFF1\r
\r
\r
//\r
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL TextOut;\r
EFI_SIMPLE_TEXT_OUTPUT_MODE TextOutMode;\r
\r
+ EFI_UGA_DRAW_PROTOCOL UgaDraw;\r
+ UINT32 UgaHorizontalResolution;\r
+ UINT32 UgaVerticalResolution;\r
+ UINT32 UgaColorDepth;\r
+ UINT32 UgaRefreshRate;\r
+ EFI_UGA_PIXEL *UgaBlt;\r
+\r
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GraphicsOutputBlt;\r
TEXT_OUT_GOP_MODE *GraphicsOutputModeBuffer;\r
UINTN TextOutQueryDataCount;\r
INT32 *TextOutModeMap;\r
\r
- EFI_CONSOLE_CONTROL_SCREEN_MODE ConsoleOutputMode;\r
+ EFI_CONSOLE_CONTROL_SCREEN_MODE ConsoleOutputMode;\r
\r
- UINTN DevNullColumns;\r
- UINTN DevNullRows;\r
- CHAR16 *DevNullScreen;\r
- INT32 *DevNullAttributes;\r
+ UINTN DevNullColumns;\r
+ UINTN DevNullRows;\r
+ CHAR16 *DevNullScreen;\r
+ INT32 *DevNullAttributes;\r
\r
} TEXT_OUT_SPLITTER_PRIVATE_DATA;\r
\r
)\r
;\r
\r
+EFI_STATUS\r
+EFIAPI\r
+ConSpliterUgaDrawGetMode (\r
+ IN EFI_UGA_DRAW_PROTOCOL *This,\r
+ OUT UINT32 *HorizontalResolution,\r
+ OUT UINT32 *VerticalResolution,\r
+ OUT UINT32 *ColorDepth,\r
+ OUT UINT32 *RefreshRate\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+ConSpliterUgaDrawSetMode (\r
+ IN EFI_UGA_DRAW_PROTOCOL *This,\r
+ IN UINT32 HorizontalResolution,\r
+ IN UINT32 VerticalResolution,\r
+ IN UINT32 ColorDepth,\r
+ IN UINT32 RefreshRate\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+ConSpliterUgaDrawBlt (\r
+ IN EFI_UGA_DRAW_PROTOCOL *This,\r
+ IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL\r
+ IN EFI_UGA_BLT_OPERATION BltOperation,\r
+ IN UINTN SourceX,\r
+ IN UINTN SourceY,\r
+ IN UINTN DestinationX,\r
+ IN UINTN DestinationY,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN UINTN Delta OPTIONAL\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+DevNullUgaSync (\r
+ IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,\r
+ IN EFI_UGA_DRAW_PROTOCOL *UgaDraw\r
+ )\r
+;\r
\r
EFI_STATUS\r
DevNullTextOutOutputString (\r
#\r
# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
#\r
-# DRIVER_BINDING = gConSplitterConInDriverBinding \r
-# COMPONENT_NAME = gConSplitterConInComponentName \r
-# DRIVER_BINDING = gConSplitterSimplePointerDriverBinding \r
-# COMPONENT_NAME = gConSplitterSimplePointerComponentName \r
-# DRIVER_BINDING = gConSplitterConOutDriverBinding \r
-# COMPONENT_NAME = gConSplitterConOutComponentName \r
-# DRIVER_BINDING = gConSplitterStdErrDriverBinding \r
-# COMPONENT_NAME = gConSplitterStdErrComponentName \r
+# DRIVER_BINDING = gConSplitterConInDriverBinding\r
+# COMPONENT_NAME = gConSplitterConInComponentName\r
+# DRIVER_BINDING = gConSplitterSimplePointerDriverBinding\r
+# COMPONENT_NAME = gConSplitterSimplePointerComponentName\r
+# DRIVER_BINDING = gConSplitterConOutDriverBinding\r
+# COMPONENT_NAME = gConSplitterConOutComponentName\r
+# DRIVER_BINDING = gConSplitterStdErrDriverBinding\r
+# COMPONENT_NAME = gConSplitterStdErrComponentName\r
#\r
\r
[Sources.common]\r
UefiLib\r
UefiDriverEntryPoint\r
DebugLib\r
+ PcdLib\r
\r
[Guids]\r
gEfiConsoleInDeviceGuid # ALWAYS_CONSUMED\r
gEfiGraphicsOutputProtocolGuid # PROTOCOL ALWAYS_PRODUCED\r
gEfiUgaDrawProtocolGuid # PROTOCOL ALWAYS_PRODUCED\r
\r
+[FeaturePcd.common]\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport\r
//\r
if ((Mode == EfiConsoleControlScreenGraphics) &&((TextAndGop->GraphicsOutput != NULL) || (TextAndGop->UgaDraw != NULL))) {\r
TextAndGop->TextOutEnabled = FALSE;\r
- DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);\r
+ if (FeaturePcdGet (PcdConOutGopSupport)) {\r
+ DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);\r
+ } else if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
+ DevNullUgaSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);\r
+ }\r
}\r
}\r
-\r
if (Mode == EfiConsoleControlScreenText) {\r
DevNullSyncGopStdOut (Private);\r
}\r
-\r
return EFI_SUCCESS;\r
}\r
\r
}\r
}\r
\r
- UgaDraw = Private->TextOutList[Index].UgaDraw;\r
- if (UgaDraw != NULL) {\r
- Status = UgaDraw->SetMode (\r
- UgaDraw,\r
- Mode->HorizontalResolution,\r
- Mode->VerticalResolution,\r
- 32,\r
- 60\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
+ if (EFI_ERROR (ReturnStatus)) {\r
+ UgaDraw = Private->TextOutList[Index].UgaDraw;\r
+ if (UgaDraw != NULL) {\r
+ Status = UgaDraw->SetMode (\r
+ UgaDraw,\r
+ Mode->HorizontalResolution,\r
+ Mode->VerticalResolution,\r
+ 32,\r
+ 60\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ReturnStatus = Status;\r
+ }\r
}\r
}\r
}\r
}\r
}\r
\r
+EFI_STATUS\r
+EFIAPI\r
+ConSpliterUgaDrawGetMode (\r
+ IN EFI_UGA_DRAW_PROTOCOL *This,\r
+ OUT UINT32 *HorizontalResolution,\r
+ OUT UINT32 *VerticalResolution,\r
+ OUT UINT32 *ColorDepth,\r
+ OUT UINT32 *RefreshRate\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Return the current video mode information.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ HorizontalResolution - Current video horizontal resolution in pixels\r
+ VerticalResolution - Current video vertical resolution in pixels\r
+ ColorDepth - Current video color depth in bits per pixel\r
+ RefreshRate - Current video refresh rate in Hz.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - Mode information returned.\r
+ EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r
+ EFI_INVALID_PARAMETER - One of the input args was NULL.\r
+\r
+--*/\r
+{\r
+ TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
+\r
+ if (!(HorizontalResolution && VerticalResolution && RefreshRate && ColorDepth)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // retrieve private data\r
+ //\r
+ Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
+\r
+ *HorizontalResolution = Private->UgaHorizontalResolution;\r
+ *VerticalResolution = Private->UgaVerticalResolution;\r
+ *ColorDepth = Private->UgaColorDepth;\r
+ *RefreshRate = Private->UgaRefreshRate;\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+ConSpliterUgaDrawSetMode (\r
+ IN EFI_UGA_DRAW_PROTOCOL *This,\r
+ IN UINT32 HorizontalResolution,\r
+ IN UINT32 VerticalResolution,\r
+ IN UINT32 ColorDepth,\r
+ IN UINT32 RefreshRate\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Return the current video mode information.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ HorizontalResolution - Current video horizontal resolution in pixels\r
+ VerticalResolution - Current video vertical resolution in pixels\r
+ ColorDepth - Current video color depth in bits per pixel\r
+ RefreshRate - Current video refresh rate in Hz.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - Mode information returned.\r
+ EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r
+ EFI_OUT_OF_RESOURCES - Out of resources.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
+ UINTN Index;\r
+ EFI_STATUS ReturnStatus;\r
+ UINTN Size;\r
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
+ UINTN NumberIndex;\r
+ UINTN SizeOfInfo;\r
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
+\r
+ Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
+\r
+ //\r
+ // UgaDevNullSetMode ()\r
+ //\r
+ ReturnStatus = EFI_SUCCESS;\r
+\r
+ //\r
+ // Free the old version\r
+ //\r
+ if (Private->UgaBlt != NULL) {\r
+ FreePool (Private->UgaBlt);\r
+ }\r
+\r
+ //\r
+ // Allocate the virtual Blt buffer\r
+ //\r
+ Size = HorizontalResolution * VerticalResolution * sizeof (EFI_UGA_PIXEL);\r
+ Private->UgaBlt = AllocateZeroPool (Size);\r
+ if (Private->UgaBlt == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ //\r
+ // Update the Mode data\r
+ //\r
+ Private->UgaHorizontalResolution = HorizontalResolution;\r
+ Private->UgaVerticalResolution = VerticalResolution;\r
+ Private->UgaColorDepth = ColorDepth;\r
+ Private->UgaRefreshRate = RefreshRate;\r
+\r
+ if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) {\r
+ return ReturnStatus;\r
+ }\r
+ //\r
+ // return the worst status met\r
+ //\r
+ for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r
+ UgaDraw = Private->TextOutList[Index].UgaDraw;\r
+ if (UgaDraw != NULL) {\r
+ Status = UgaDraw->SetMode (\r
+ UgaDraw,\r
+ HorizontalResolution,\r
+ VerticalResolution,\r
+ ColorDepth,\r
+ RefreshRate\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ReturnStatus = Status;\r
+ }\r
+ }\r
+\r
+ if (EFI_ERROR (ReturnStatus)) {\r
+ GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r
+ if (GraphicsOutput != NULL) {\r
+ //\r
+ // Find corresponding ModeNumber of this GraphicsOutput instance\r
+ //\r
+ for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {\r
+ Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ if ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution == VerticalResolution)) {\r
+ FreePool (Info);\r
+ break;\r
+ }\r
+ FreePool (Info);\r
+ }\r
+\r
+ Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r
+ if (EFI_ERROR (Status)) {\r
+ ReturnStatus = Status;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return ReturnStatus;\r
+}\r
+\r
+EFI_STATUS\r
+DevNullUgaBlt (\r
+ IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
+ IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL\r
+ IN EFI_UGA_BLT_OPERATION BltOperation,\r
+ IN UINTN SourceX,\r
+ IN UINTN SourceY,\r
+ IN UINTN DestinationX,\r
+ IN UINTN DestinationY,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN UINTN Delta OPTIONAL\r
+ )\r
+{\r
+ UINTN SrcY;\r
+ BOOLEAN Forward;\r
+ UINTN Index;\r
+ EFI_UGA_PIXEL *BltPtr;\r
+ EFI_UGA_PIXEL *ScreenPtr;\r
+ UINT32 HorizontalResolution;\r
+ UINT32 VerticalResolution;\r
+\r
+ if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Width == 0 || Height == 0) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Delta == 0) {\r
+ Delta = Width * sizeof (EFI_UGA_PIXEL);\r
+ }\r
+\r
+ HorizontalResolution = Private->UgaHorizontalResolution;\r
+ VerticalResolution = Private->UgaVerticalResolution;\r
+\r
+ //\r
+ // We need to fill the Virtual Screen buffer with the blt data.\r
+ //\r
+ if (BltOperation == EfiUgaVideoToBltBuffer) {\r
+ //\r
+ // Video to BltBuffer: Source is Video, destination is BltBuffer\r
+ //\r
+ if ((SourceY + Height) > VerticalResolution) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if ((SourceX + Width) > HorizontalResolution) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ BltPtr = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + DestinationY * Delta + DestinationX * sizeof (EFI_UGA_PIXEL));\r
+ ScreenPtr = &Private->UgaBlt[SourceY * HorizontalResolution + SourceX];\r
+ while (Height) {\r
+ CopyMem (BltPtr, ScreenPtr, Width * sizeof (EFI_UGA_PIXEL));\r
+ BltPtr = (EFI_UGA_PIXEL *) ((UINT8 *) BltPtr + Delta);\r
+ ScreenPtr += HorizontalResolution;\r
+ Height--;\r
+ }\r
+ } else {\r
+ //\r
+ // BltBuffer to Video: Source is BltBuffer, destination is Video\r
+ //\r
+ if (DestinationY + Height > VerticalResolution) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (DestinationX + Width > HorizontalResolution) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if ((BltOperation == EfiUgaVideoToVideo) && (DestinationY > SourceY)) {\r
+ //\r
+ // Copy backwards, only care the Video to Video Blt\r
+ //\r
+ ScreenPtr = &Private->UgaBlt[(DestinationY + Height - 1) * HorizontalResolution + DestinationX];\r
+ SrcY = SourceY + Height - 1;\r
+ Forward = FALSE;\r
+ } else {\r
+ //\r
+ // Copy forwards, for other cases\r
+ //\r
+ ScreenPtr = &Private->UgaBlt[DestinationY * HorizontalResolution + DestinationX];\r
+ SrcY = SourceY;\r
+ Forward = TRUE;\r
+ }\r
+\r
+ while (Height != 0) {\r
+ if (BltOperation == EfiUgaVideoFill) {\r
+ for (Index = 0; Index < Width; Index++) {\r
+ ScreenPtr[Index] = *BltBuffer;\r
+ }\r
+ } else {\r
+ if (BltOperation == EfiUgaBltBufferToVideo) {\r
+ BltPtr = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + SrcY * Delta + SourceX * sizeof (EFI_UGA_PIXEL));\r
+ } else {\r
+ BltPtr = &Private->UgaBlt[SrcY * HorizontalResolution + SourceX];\r
+ }\r
+\r
+ CopyMem (ScreenPtr, BltPtr, Width * sizeof (EFI_UGA_PIXEL));\r
+ }\r
+\r
+ if (Forward) {\r
+ ScreenPtr += HorizontalResolution;\r
+ SrcY ++;\r
+ } else {\r
+ ScreenPtr -= HorizontalResolution;\r
+ SrcY --;\r
+ }\r
+ Height--;\r
+ }\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+ConSpliterUgaDrawBlt (\r
+ IN EFI_UGA_DRAW_PROTOCOL *This,\r
+ IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL\r
+ IN EFI_UGA_BLT_OPERATION BltOperation,\r
+ IN UINTN SourceX,\r
+ IN UINTN SourceY,\r
+ IN UINTN DestinationX,\r
+ IN UINTN DestinationY,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN UINTN Delta OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ The following table defines actions for BltOperations:\r
+ EfiUgaVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY)\r
+ directly to every pixel of the video display rectangle\r
+ (DestinationX, DestinationY)\r
+ (DestinationX + Width, DestinationY + Height).\r
+ Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+ EfiUgaVideoToBltBuffer - Read data from the video display rectangle\r
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
+ the BltBuffer rectangle (DestinationX, DestinationY )\r
+ (DestinationX + Width, DestinationY + Height). If DestinationX or\r
+ DestinationY is not zero then Delta must be set to the length in bytes\r
+ of a row in the BltBuffer.\r
+ EfiUgaBltBufferToVideo - Write data from the BltBuffer rectangle\r
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
+ video display rectangle (DestinationX, DestinationY)\r
+ (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
+ not zero then Delta must be set to the length in bytes of a row in the\r
+ BltBuffer.\r
+ EfiUgaVideoToVideo - Copy from the video display rectangle\r
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
+ to the video display rectangle (DestinationX, DestinationY)\r
+ (DestinationX + Width, DestinationY + Height).\r
+ The BltBuffer and Delta are not used in this mode.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ BltBuffer - Buffer containing data to blit into video buffer. This\r
+ buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)\r
+ BltOperation - Operation to perform on BlitBuffer and video memory\r
+ SourceX - X coordinate of source for the BltBuffer.\r
+ SourceY - Y coordinate of source for the BltBuffer.\r
+ DestinationX - X coordinate of destination for the BltBuffer.\r
+ DestinationY - Y coordinate of destination for the BltBuffer.\r
+ Width - Width of rectangle in BltBuffer in pixels.\r
+ Height - Hight of rectangle in BltBuffer in pixels.\r
+ Delta -\r
+\r
+ Returns:\r
+ EFI_SUCCESS - The Blt operation completed.\r
+ EFI_INVALID_PARAMETER - BltOperation is not valid.\r
+ EFI_DEVICE_ERROR - A hardware error occured writting to the video\r
+ buffer.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
+ UINTN Index;\r
+ EFI_STATUS ReturnStatus;\r
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
+\r
+ Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
+\r
+ //\r
+ // Sync up DevNull UGA device\r
+ //\r
+ ReturnStatus = DevNullUgaBlt (\r
+ Private,\r
+ BltBuffer,\r
+ BltOperation,\r
+ SourceX,\r
+ SourceY,\r
+ DestinationX,\r
+ DestinationY,\r
+ Width,\r
+ Height,\r
+ Delta\r
+ );\r
+ if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) {\r
+ return ReturnStatus;\r
+ }\r
+ //\r
+ // return the worst status met\r
+ //\r
+ for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r
+ GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r
+ if (GraphicsOutput != NULL) {\r
+ Status = GraphicsOutput->Blt (\r
+ GraphicsOutput,\r
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltBuffer,\r
+ (EFI_GRAPHICS_OUTPUT_BLT_OPERATION) BltOperation,\r
+ SourceX,\r
+ SourceY,\r
+ DestinationX,\r
+ DestinationY,\r
+ Width,\r
+ Height,\r
+ Delta\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ReturnStatus = Status;\r
+ } else if (BltOperation == EfiBltVideoToBltBuffer) {\r
+ //\r
+ // Only need to read the data into buffer one time\r
+ //\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
+\r
+ if (Private->TextOutList[Index].UgaDraw != NULL) {\r
+ Status = Private->TextOutList[Index].UgaDraw->Blt (\r
+ Private->TextOutList[Index].UgaDraw,\r
+ BltBuffer,\r
+ BltOperation,\r
+ SourceX,\r
+ SourceY,\r
+ DestinationX,\r
+ DestinationY,\r
+ Width,\r
+ Height,\r
+ Delta\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ReturnStatus = Status;\r
+ } else if (BltOperation == EfiUgaVideoToBltBuffer) {\r
+ //\r
+ // Only need to read the data into buffer one time\r
+ //\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
+ }\r
+\r
+ return ReturnStatus;\r
+}\r
+\r
+EFI_STATUS\r
+DevNullUgaSync (\r
+ IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,\r
+ IN EFI_UGA_DRAW_PROTOCOL *UgaDraw\r
+ )\r
+{\r
+ if (UgaDraw != NULL) {\r
+ return UgaDraw->Blt (\r
+ UgaDraw,\r
+ Private->UgaBlt,\r
+ EfiUgaBltBufferToVideo,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ Private->UgaHorizontalResolution,\r
+ Private->UgaVerticalResolution,\r
+ Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL)\r
+ );\r
+ } else {\r
+ return GraphicsOutput->Blt (\r
+ GraphicsOutput,\r
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt,\r
+ EfiBltBufferToVideo,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ Private->UgaHorizontalResolution,\r
+ Private->UgaVerticalResolution,\r
+ 0\r
+ );\r
+ }\r
+}\r
\r
EFI_STATUS\r
DevNullTextOutOutputString (\r
\r
//\r
// Enumeration of memory allocation.\r
-// \r
+//\r
typedef enum {\r
AllocateAnyPages,\r
AllocateMaxAddress,\r
\r
//\r
// Build macros to find next EFI_MEMORY_DESCRIPTOR.\r
-// \r
+//\r
#define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r
#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)\r
\r
\r
//\r
// The event¡¯s NotifyContext pointer points to a runtime memory\r
-// address. \r
+// address.\r
// The event is deprecated in UEFI2.0 and later specifications.\r
-// \r
+//\r
#define EVT_RUNTIME_CONTEXT 0x20000000\r
\r
\r
);\r
\r
\r
-// \r
+//\r
// This provides the capabilities of the\r
// real time clock device as exposed through the EFI interfaces.\r
-// \r
+//\r
typedef struct {\r
UINT32 Resolution;\r
UINT32 Accuracy;\r
\r
//\r
// Enumeration of reset types.\r
-// \r
+//\r
typedef enum {\r
EfiResetCold,\r
EfiResetWarm,\r
\r
typedef struct {\r
EFI_TABLE_HEADER Hdr;\r
- \r
+\r
//\r
// Task Priority Services\r
//\r
} EFI_BOOT_SERVICES;\r
\r
//\r
-// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the \r
+// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the\r
// EFI System Table.\r
-// \r
+//\r
typedef struct{\r
EFI_GUID VendorGuid;\r
VOID *VendorTable;\r