summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-12-12 07:09:03 +0000
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-12-12 07:09:03 +0000
commit406adcd15cafe2f1f6cff0750ef9bfd8c613013a (patch)
treea0f2e98b6ba78d6af198523c0a503fdfe7885c31
parentd02920ead2934c94ad3603bdce18d699af027a9f (diff)
downloadedk2-platforms-406adcd15cafe2f1f6cff0750ef9bfd8c613013a.tar.xz
Merge GOP related code from r8->r9.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2085 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c15
-rw-r--r--EdkModulePkg/Include/Library/EdkGraphicsLib.h4
-rw-r--r--EdkModulePkg/Include/Protocol/UgaSplash.h6
-rw-r--r--EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa3
-rw-r--r--EdkModulePkg/Library/EdkGraphicsLib/Graphics.c218
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c413
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h105
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa3
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c540
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c653
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h8
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa3
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c16
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h16
-rw-r--r--EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h12
-rw-r--r--EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c12
-rw-r--r--EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c142
-rw-r--r--EdkNt32Pkg/Include/Protocol/WinNtIo.h12
-rw-r--r--MdePkg/Include/Protocol/Hii.h17
19 files changed, 1720 insertions, 478 deletions
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
index cd2d585303..70ad48b5ec 100644
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
+++ b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
@@ -139,8 +139,11 @@ Returns:
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_NT_HEADERS *PeHdr;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
PCI_DRIVER_OVERRIDE_LIST *Node;
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader;
EFI_DRIVER_OS_HANDOFF_HEADER *NewDriverOsHandoffHeader;
EFI_DRIVER_OS_HANDOFF *DriverOsHandoff;
@@ -149,6 +152,7 @@ Returns:
UINTN NumberOfEntries;
UINTN Size;
UINTN Index;
+#endif
Status = gBS->HandleProtocol (DriverImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
if (EFI_ERROR (Status)) {
@@ -167,10 +171,18 @@ Returns:
PciIoDevice->BusOverride = TRUE;
- if (PeCoffLoaderGetMachineType ((VOID *)(UINTN)LoadedImage->ImageBase) != EFI_IMAGE_MACHINE_EBC) {
+ DosHdr = (EFI_IMAGE_DOS_HEADER *) LoadedImage->ImageBase;
+ if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
return EFI_SUCCESS;
}
+ PeHdr = (EFI_IMAGE_NT_HEADERS *) ((UINTN) LoadedImage->ImageBase + DosHdr->e_lfanew);
+
+ if (PeHdr->FileHeader.Machine != EFI_IMAGE_MACHINE_EBC) {
+ return EFI_SUCCESS;
+ }
+
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
DriverOsHandoffHeader = NULL;
Status = EfiGetSystemConfigurationTable (&gEfiUgaIoProtocolGuid, (VOID **) &DriverOsHandoffHeader);
if (!EFI_ERROR (Status) && DriverOsHandoffHeader != NULL) {
@@ -276,6 +288,7 @@ Returns:
if (DriverOsHandoffHeader != NULL) {
gBS->FreePool (DriverOsHandoffHeader);
}
+#endif
return EFI_SUCCESS;
}
diff --git a/EdkModulePkg/Include/Library/EdkGraphicsLib.h b/EdkModulePkg/Include/Library/EdkGraphicsLib.h
index 52bedd891a..30b2a7c055 100644
--- a/EdkModulePkg/Include/Library/EdkGraphicsLib.h
+++ b/EdkModulePkg/Include/Library/EdkGraphicsLib.h
@@ -174,8 +174,8 @@ EFIAPI
PrintXY (
IN UINTN X,
IN UINTN Y,
- IN EFI_UGA_PIXEL *Foreground, OPTIONAL
- IN EFI_UGA_PIXEL *Background, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background, OPTIONAL
IN CHAR16 *Fmt,
...
)
diff --git a/EdkModulePkg/Include/Protocol/UgaSplash.h b/EdkModulePkg/Include/Protocol/UgaSplash.h
index 51dcf523d3..c5284aad2c 100644
--- a/EdkModulePkg/Include/Protocol/UgaSplash.h
+++ b/EdkModulePkg/Include/Protocol/UgaSplash.h
@@ -31,11 +31,11 @@ Abstract:
typedef struct _EFI_UGA_SPLASH_PROTOCOL EFI_UGA_SPLASH_PROTOCOL;
-struct _EFI_UGA_SPLASH_PROTOCOL {
+typedef struct _EFI_UGA_SPLASH_PROTOCOL {
UINT32 PixelWidth;
UINT32 PixelHeight;
- EFI_UGA_PIXEL *Image;
-};
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Image;
+} EFI_UGA_SPLASH_PROTOCOL;
extern EFI_GUID gEfiUgaSplashProtocolGuid;
diff --git a/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa b/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa
index 0bb934dace..f47b0ff80a 100644
--- a/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa
+++ b/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa
@@ -62,6 +62,9 @@
<ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
+ <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
</Protocol>
</Protocols>
diff --git a/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c b/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
index 52936e3c40..4f0d37894e 100644
--- a/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
+++ b/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
@@ -107,11 +107,11 @@ Returns:
EFI_STATUS
-ConvertBmpToUgaBlt (
+ConvertBmpToGopBlt (
IN VOID *BmpImage,
IN UINTN BmpImageSize,
- IN OUT VOID **UgaBlt,
- IN OUT UINTN *UgaBltSize,
+ IN OUT VOID **GopBlt,
+ IN OUT UINTN *GopBltSize,
OUT UINTN *PixelHeight,
OUT UINTN *PixelWidth
)
@@ -152,8 +152,8 @@ Returns:
UINT8 *ImageHeader;
BMP_IMAGE_HEADER *BmpHeader;
BMP_COLOR_MAP *BmpColorMap;
- EFI_UGA_PIXEL *BltBuffer;
- EFI_UGA_PIXEL *Blt;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
UINTN BltBufferSize;
UINTN Index;
UINTN Height;
@@ -182,18 +182,18 @@ Returns:
Image = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;
ImageHeader = Image;
- BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_UGA_PIXEL);
+ BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
IsAllocated = FALSE;
- if (*UgaBlt == NULL) {
- *UgaBltSize = BltBufferSize;
- *UgaBlt = AllocatePool (*UgaBltSize);
- if (*UgaBlt == NULL) {
+ if (*GopBlt == NULL) {
+ *GopBltSize = BltBufferSize;
+ *GopBlt = AllocatePool (*GopBltSize);
+ IsAllocated = TRUE;
+ if (*GopBlt == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- IsAllocated = TRUE;
} else {
- if (*UgaBltSize < BltBufferSize) {
- *UgaBltSize = BltBufferSize;
+ if (*GopBltSize < BltBufferSize) {
+ *GopBltSize = BltBufferSize;
return EFI_BUFFER_TOO_SMALL;
}
}
@@ -204,7 +204,7 @@ Returns:
//
// Convert image from BMP to Blt buffer format
//
- BltBuffer = *UgaBlt;
+ BltBuffer = *GopBlt;
for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
@@ -260,8 +260,8 @@ Returns:
default:
if (IsAllocated) {
- gBS->FreePool (*UgaBlt);
- *UgaBlt = NULL;
+ gBS->FreePool (*GopBlt);
+ *GopBlt = NULL;
}
return EFI_UNSUPPORTED;
break;
@@ -345,20 +345,14 @@ Returns:
{
EFI_STATUS Status;
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_OEM_BADGING_PROTOCOL *Badging;
UINT32 SizeOfX;
UINT32 SizeOfY;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
INTN DestX;
INTN DestY;
-
UINT8 *ImageData;
UINTN ImageSize;
- EFI_UGA_PIXEL *UgaBlt;
- UINTN UgaBltSize;
-
+ UINTN BltSize;
UINT32 Instance;
EFI_BADGING_FORMAT Format;
EFI_BADGING_DISPLAY_ATTRIBUTE Attribute;
@@ -366,15 +360,31 @@ Returns:
UINTN CoordinateY;
UINTN Height;
UINTN Width;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ UINT32 ColorDepth;
+ UINT32 RefreshRate;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
- Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
+ UgaDraw = NULL;
+ //
+ // Try to open GOP first
+ //
+ Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
+ if (EFI_ERROR(Status)) {
+ GraphicsOutput = NULL;
+ //
+ // Open GOP failed, try to open UGA
+ //
+ Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
}
Badging = NULL;
@@ -382,9 +392,14 @@ Returns:
ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);
- Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
+ if (GraphicsOutput != NULL) {
+ SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
+ SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
+ } else {
+ Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
}
Instance = 0;
@@ -425,18 +440,22 @@ Returns:
Attribute = EfiBadgingDisplayAttributeCenter;
}
- UgaBlt = NULL;
- Status = ConvertBmpToUgaBlt (
+ Blt = NULL;
+ Status = ConvertBmpToGopBlt (
ImageData,
ImageSize,
- (VOID **) &UgaBlt,
- &UgaBltSize,
+ (VOID**)&Blt,
+ &BltSize,
&Height,
&Width
);
if (EFI_ERROR (Status)) {
gBS->FreePool (ImageData);
- continue;
+ if (Badging == NULL) {
+ return Status;
+ } else {
+ continue;
+ }
}
switch (Attribute) {
@@ -492,22 +511,37 @@ Returns:
}
if ((DestX >= 0) && (DestY >= 0)) {
- Status = UgaDraw->Blt (
- UgaDraw,
- UgaBlt,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- (UINTN) DestX,
- (UINTN) DestY,
- Width,
- Height,
- Width * sizeof (EFI_UGA_PIXEL)
- );
+ if (GraphicsOutput != NULL) {
+ Status = GraphicsOutput->Blt (
+ GraphicsOutput,
+ Blt,
+ EfiBltBufferToVideo,
+ 0,
+ 0,
+ (UINTN) DestX,
+ (UINTN) DestY,
+ Width,
+ Height,
+ Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ } else {
+ Status = UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) Blt,
+ EfiUgaBltBufferToVideo,
+ 0,
+ 0,
+ (UINTN) DestX,
+ (UINTN) DestY,
+ Width,
+ Height,
+ Width * sizeof (EFI_UGA_PIXEL)
+ );
+ }
}
gBS->FreePool (ImageData);
- gBS->FreePool (UgaBlt);
+ gBS->FreePool (Blt);
if (Badging == NULL) {
break;
@@ -551,7 +585,7 @@ Returns:
return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
}
-static EFI_UGA_PIXEL mEfiColors[16] = {
+static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
{ 0x00, 0x00, 0x00, 0x00 },
{ 0x98, 0x00, 0x00, 0x00 },
{ 0x00, 0x98, 0x00, 0x00 },
@@ -573,12 +607,13 @@ static EFI_UGA_PIXEL mEfiColors[16] = {
STATIC
UINTN
_IPrint (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw,
IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto,
IN UINTN X,
IN UINTN Y,
- IN EFI_UGA_PIXEL *Foreground,
- IN EFI_UGA_PIXEL *Background,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
IN CHAR16 *fmt,
IN VA_LIST args
)
@@ -590,6 +625,8 @@ Routine Description:
Arguments:
+ GraphicsOutput - Graphics output protocol interface
+
UgaDraw - UGA draw protocol interface
Sto - Simple text out protocol interface
@@ -622,7 +659,7 @@ Returns:
CHAR16 *UnicodeWeight;
EFI_NARROW_GLYPH *Glyph;
EFI_HII_PROTOCOL *Hii;
- EFI_UGA_PIXEL *LineBuffer;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
UINT32 ColorDepth;
@@ -637,10 +674,18 @@ Returns:
if (Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
+ if (GraphicsOutput != NULL) {
+ HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
+ VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
+ } else {
+ //
+ // Get the current mode information from the UGA Draw Protocol
+ //
+ UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
+ }
- UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
-
- LineBuffer = AllocatePool (sizeof (EFI_UGA_PIXEL) * HorizontalResolution * GLYPH_WIDTH * GLYPH_HEIGHT);
+ LineBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_WIDTH * GLYPH_HEIGHT);
if (LineBuffer == NULL) {
gBS->FreePool (Buffer);
return EFI_OUT_OF_RESOURCES;
@@ -698,18 +743,33 @@ Returns:
//
// Blt a character to the screen
//
- Status = UgaDraw->Blt (
- UgaDraw,
- LineBuffer,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- X,
- Y,
- GLYPH_WIDTH * StrLen (Buffer),
- GLYPH_HEIGHT,
- GLYPH_WIDTH * StrLen (Buffer) * sizeof (EFI_UGA_PIXEL)
- );
+ if (GraphicsOutput != NULL) {
+ Status = GraphicsOutput->Blt (
+ GraphicsOutput,
+ LineBuffer,
+ EfiBltBufferToVideo,
+ 0,
+ 0,
+ X,
+ Y,
+ GLYPH_WIDTH * StrLen (Buffer),
+ GLYPH_HEIGHT,
+ GLYPH_WIDTH * StrLen (Buffer) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ } else {
+ Status = UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) (UINTN) LineBuffer,
+ EfiUgaBltBufferToVideo,
+ 0,
+ 0,
+ X,
+ Y,
+ GLYPH_WIDTH * StrLen (Buffer),
+ GLYPH_HEIGHT,
+ GLYPH_WIDTH * StrLen (Buffer) * sizeof (EFI_UGA_PIXEL)
+ );
+ }
Error:
gBS->FreePool (LineBuffer);
@@ -722,8 +782,8 @@ UINTN
PrintXY (
IN UINTN X,
IN UINTN Y,
- IN EFI_UGA_PIXEL *ForeGround, OPTIONAL
- IN EFI_UGA_PIXEL *BackGround, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
IN CHAR16 *Fmt,
...
)
@@ -754,6 +814,8 @@ Returns:
--*/
{
EFI_HANDLE Handle;
+
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto;
EFI_STATUS Status;
@@ -761,16 +823,28 @@ Returns:
VA_START (Args, Fmt);
+ UgaDraw = NULL;
+
Handle = gST->ConsoleOutHandle;
Status = gBS->HandleProtocol (
Handle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw
+ &gEfiGraphicsOutputProtocolGuid,
+ (VOID **) &GraphicsOutput
);
if (EFI_ERROR (Status)) {
- return Status;
+ GraphicsOutput = NULL;
+
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiUgaDrawProtocolGuid,
+ (VOID **) &UgaDraw
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
Status = gBS->HandleProtocol (
@@ -783,5 +857,5 @@ Returns:
return Status;
}
- return _IPrint (UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args);
+ return _IPrint (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args);
}
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c
index a9d39e945e..fc2903eaa0 100644
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c
+++ b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c
@@ -39,7 +39,7 @@ Abstract:
//
// Global Variables
//
-static TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = {
+STATIC TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = {
TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE,
(EFI_HANDLE) NULL,
{
@@ -88,7 +88,7 @@ static TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = {
FALSE
};
-static TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
+STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE,
(EFI_HANDLE) NULL,
{
@@ -111,6 +111,7 @@ static TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
0,
FALSE,
},
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
{
ConSpliterUgaDrawGetMode,
ConSpliterUgaDrawSetMode,
@@ -121,7 +122,18 @@ static TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
0,
0,
(EFI_UGA_PIXEL *) NULL,
-
+#else
+ {
+ ConSpliterGraphicsOutputQueryMode,
+ ConSpliterGraphicsOutputSetMode,
+ ConSpliterGraphicsOutputBlt,
+ NULL
+ },
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
+ (TEXT_OUT_GOP_MODE *) NULL,
+ 0,
+ TRUE,
+#endif
{
ConSpliterConsoleControlGetMode,
ConSpliterConsoleControlSetMode,
@@ -129,7 +141,7 @@ static TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
},
0,
- (TEXT_OUT_AND_UGA_DATA *) NULL,
+ (TEXT_OUT_AND_GOP_DATA *) NULL,
0,
(TEXT_OUT_SPLITTER_QUERY_DATA *) NULL,
0,
@@ -142,7 +154,7 @@ static TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
(INT32 *) NULL
};
-static TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {
+STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {
TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE,
(EFI_HANDLE) NULL,
{
@@ -165,6 +177,7 @@ static TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {
0,
FALSE,
},
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
{
ConSpliterUgaDrawGetMode,
ConSpliterUgaDrawSetMode,
@@ -175,7 +188,18 @@ static TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {
0,
0,
(EFI_UGA_PIXEL *) NULL,
-
+#else
+ {
+ ConSpliterGraphicsOutputQueryMode,
+ ConSpliterGraphicsOutputSetMode,
+ ConSpliterGraphicsOutputBlt,
+ NULL
+ },
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
+ (TEXT_OUT_GOP_MODE *) NULL,
+ 0,
+ TRUE,
+#endif
{
ConSpliterConsoleControlGetMode,
ConSpliterConsoleControlSetMode,
@@ -183,7 +207,7 @@ static TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {
},
0,
- (TEXT_OUT_AND_UGA_DATA *) NULL,
+ (TEXT_OUT_AND_GOP_DATA *) NULL,
0,
(TEXT_OUT_SPLITTER_QUERY_DATA *) NULL,
0,
@@ -301,6 +325,10 @@ Returns:
//
Status = ConSplitterTextOutConstructor (&mConOut);
if (!EFI_ERROR (Status)) {
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
+ //
+ // In EFI mode, UGA Draw protocol is installed
+ //
Status = gBS->InstallMultipleProtocolInterfaces (
&mConOut.VirtualHandle,
&gEfiSimpleTextOutProtocolGuid,
@@ -313,6 +341,24 @@ Returns:
NULL,
NULL
);
+#else
+ //
+ // In UEFI mode, Graphics Output Protocol is installed on virtual handle.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mConOut.VirtualHandle,
+ &gEfiSimpleTextOutProtocolGuid,
+ &mConOut.TextOut,
+ &gEfiGraphicsOutputProtocolGuid,
+ &mConOut.GraphicsOutput,
+ &gEfiConsoleControlProtocolGuid,
+ &mConOut.ConsoleControl,
+ &gEfiPrimaryConsoleOutDeviceGuid,
+ NULL,
+ NULL
+ );
+#endif
+
if (!EFI_ERROR (Status)) {
//
// Update the EFI System Table with new virtual console
@@ -335,7 +381,7 @@ Returns:
return EFI_SUCCESS;
}
-
+STATIC
EFI_STATUS
ConSplitterTextInConstructor (
TEXT_IN_SPLITTER_PRIVATE_DATA *ConInPrivate
@@ -411,7 +457,7 @@ Returns:
return Status;
}
-
+STATIC
EFI_STATUS
ConSplitterTextOutConstructor (
TEXT_OUT_SPLITTER_PRIVATE_DATA *ConOutPrivate
@@ -425,7 +471,7 @@ ConSplitterTextOutConstructor (
ConOutPrivate->TextOut.Mode = &ConOutPrivate->TextOutMode;
Status = ConSplitterGrowBuffer (
- sizeof (TEXT_OUT_AND_UGA_DATA),
+ sizeof (TEXT_OUT_AND_GOP_DATA),
&ConOutPrivate->TextOutListCount,
(VOID **) &ConOutPrivate->TextOutList
);
@@ -448,15 +494,53 @@ ConSplitterTextOutConstructor (
ConOutPrivate->TextOutQueryData[0].Rows = 25;
DevNullTextOutSetMode (ConOutPrivate, 0);
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
//
// Setup the DevNullUgaDraw to 800 x 600 x 32 bits per pixel
//
ConSpliterUgaDrawSetMode (&ConOutPrivate->UgaDraw, 800, 600, 32, 60);
+#else
+ //
+ // Setup resource for mode information in Graphics Output Protocol interface
+ //
+ if ((ConOutPrivate->GraphicsOutput.Mode = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE))) == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ if ((ConOutPrivate->GraphicsOutput.Mode->Info = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Setup the DevNullGraphicsOutput to 800 x 600 x 32 bits per pixel
+ //
+ if ((ConOutPrivate->GraphicsOutputModeBuffer = AllocateZeroPool (sizeof (TEXT_OUT_GOP_MODE))) == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ConOutPrivate->GraphicsOutputModeBuffer[0].HorizontalResolution = 800;
+ ConOutPrivate->GraphicsOutputModeBuffer[0].VerticalResolution = 600;
+
+ //
+ // Initialize the following items, theset items remain unchanged in GraphicsOutput->SetMode()
+ // GraphicsOutputMode->Info->Version, GraphicsOutputMode->Info->PixelFormat
+ // GraphicsOutputMode->SizeOfInfo, GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize
+ //
+ ConOutPrivate->GraphicsOutput.Mode->Info->Version = 0;
+ ConOutPrivate->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;
+ ConOutPrivate->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+ ConOutPrivate->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;
+ ConOutPrivate->GraphicsOutput.Mode->FrameBufferSize = 0;
+
+ ConOutPrivate->GraphicsOutput.Mode->MaxMode = 1;
+ //
+ // Initial current mode to unknow state, and then set to mode 0
+ //
+ ConOutPrivate->GraphicsOutput.Mode->Mode = 0xffff;
+ ConOutPrivate->GraphicsOutput.SetMode (&ConOutPrivate->GraphicsOutput, 0);
+#endif
return Status;
}
-
+STATIC
EFI_STATUS
ConSplitterSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
@@ -523,7 +607,7 @@ Returns:
return EFI_SUCCESS;
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingSupported (
@@ -554,7 +638,7 @@ Returns:
);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingSupported (
@@ -585,7 +669,7 @@ Returns:
);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingSupported (
@@ -616,7 +700,7 @@ Returns:
);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingSupported (
@@ -647,7 +731,7 @@ Returns:
);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterStart (
@@ -712,7 +796,7 @@ Returns:
);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingStart (
@@ -760,7 +844,7 @@ Returns:
return ConSplitterTextInAddDevice (&mConIn, TextIn);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingStart (
@@ -803,7 +887,7 @@ Returns:
return ConSplitterSimplePointerAddDevice (&mConIn, SimplePointer);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingStart (
@@ -829,6 +913,7 @@ Returns:
{
EFI_STATUS Status;
EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
Status = ConSplitterStart (
@@ -843,6 +928,20 @@ Returns:
return Status;
}
//
+ // Try to Open Graphics Output protocol
+ //
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiGraphicsOutputProtocolGuid,
+ &GraphicsOutput,
+ This->DriverBindingHandle,
+ mConOut.VirtualHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ GraphicsOutput = NULL;
+ }
+ //
// Open UGA_DRAW protocol
//
Status = gBS->OpenProtocol (
@@ -860,12 +959,14 @@ Returns:
// If both ConOut and StdErr incorporate the same Text Out device,
// their MaxMode and QueryData should be the intersection of both.
//
- Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, UgaDraw);
+ Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw);
ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
+
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
//
// Match the UGA mode data of ConOut with the current mode
//
- if (UgaDraw) {
+ if (UgaDraw != NULL) {
UgaDraw->GetMode (
UgaDraw,
&mConOut.UgaHorizontalResolution,
@@ -873,11 +974,13 @@ Returns:
&mConOut.UgaColorDepth,
&mConOut.UgaRefreshRate
);
- }
+ }
+#endif
+
return Status;
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingStart (
@@ -919,7 +1022,7 @@ Returns:
// If both ConOut and StdErr incorporate the same Text Out device,
// their MaxMode and QueryData should be the intersection of both.
//
- Status = ConSplitterTextOutAddDevice (&mStdErr, TextOut, NULL);
+ Status = ConSplitterTextOutAddDevice (&mStdErr, TextOut, NULL, NULL);
ConSplitterTextOutSetAttribute (&mStdErr.TextOut, EFI_TEXT_ATTR (EFI_MAGENTA, EFI_BLACK));
if (EFI_ERROR (Status)) {
return Status;
@@ -942,7 +1045,7 @@ Returns:
return Status;
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterStop (
@@ -998,7 +1101,7 @@ Returns:
return EFI_SUCCESS;
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingStop (
@@ -1044,7 +1147,7 @@ Returns:
return ConSplitterTextInDeleteDevice (&mConIn, TextIn);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingStop (
@@ -1090,7 +1193,7 @@ Returns:
return ConSplitterSimplePointerDeleteDevice (&mConIn, SimplePointer);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingStop (
@@ -1114,7 +1217,6 @@ Returns:
{
EFI_STATUS Status;
EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
@@ -1131,17 +1233,6 @@ Returns:
if (EFI_ERROR (Status)) {
return Status;
}
- //
- // Remove any UGA devices
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw,
- This->DriverBindingHandle,
- mConOut.VirtualHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
//
// Delete this console output device's data structures.
@@ -1149,7 +1240,7 @@ Returns:
return ConSplitterTextOutDeleteDevice (&mConOut, TextOut);
}
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingStop (
@@ -1717,13 +1808,14 @@ Arguments:
Returns:
None
+ EFI_OUT_OF_RESOURCES
--*/
{
UINTN ConOutNumOfConsoles;
UINTN StdErrNumOfConsoles;
- TEXT_OUT_AND_UGA_DATA *ConOutTextOutList;
- TEXT_OUT_AND_UGA_DATA *StdErrTextOutList;
+ TEXT_OUT_AND_GOP_DATA *ConOutTextOutList;
+ TEXT_OUT_AND_GOP_DATA *StdErrTextOutList;
UINTN Indexi;
UINTN Indexj;
UINTN Rows;
@@ -1864,10 +1956,198 @@ Returns:
return EFI_SUCCESS;
}
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+EFI_STATUS
+ConSplitterAddGraphicsOutputMode (
+ IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
+ IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+Returns:
+
+ None
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ TEXT_OUT_GOP_MODE *Mode;
+ UINTN SizeOfInfo;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *CurrentGraphicsOutputMode;
+ TEXT_OUT_GOP_MODE *ModeBuffer;
+ TEXT_OUT_GOP_MODE *MatchedMode;
+ UINTN NumberIndex;
+ BOOLEAN Match;
+
+ if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode;
+
+ if (GraphicsOutput != NULL) {
+ if (Private->CurrentNumberOfGraphicsOutput == 0) {
+ //
+ // This is the first Graphics Output device added
+ //
+ CurrentGraphicsOutputMode->MaxMode = GraphicsOutput->Mode->MaxMode;
+ CurrentGraphicsOutputMode->Mode = GraphicsOutput->Mode->Mode;
+ CopyMem (CurrentGraphicsOutputMode->Info, GraphicsOutput->Mode->Info, GraphicsOutput->Mode->SizeOfInfo);
+ CurrentGraphicsOutputMode->SizeOfInfo = GraphicsOutput->Mode->SizeOfInfo;
+ CurrentGraphicsOutputMode->FrameBufferBase = GraphicsOutput->Mode->FrameBufferBase;
+ CurrentGraphicsOutputMode->FrameBufferSize = GraphicsOutput->Mode->FrameBufferSize;
+
+ //
+ // Allocate resource for the private mode buffer
+ //
+ ModeBuffer = AllocatePool (sizeof (TEXT_OUT_GOP_MODE) * GraphicsOutput->Mode->MaxMode);
+ if (ModeBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ gBS->FreePool (Private->GraphicsOutputModeBuffer);
+ Private->GraphicsOutputModeBuffer = ModeBuffer;
+
+ //
+ // Store all supported display modes to the private mode buffer
+ //
+ Mode = ModeBuffer;
+ for (Index = 0; Index < GraphicsOutput->Mode->MaxMode; Index++) {
+ Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) Index, &SizeOfInfo, &Info);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ Mode->HorizontalResolution = Info->HorizontalResolution;
+ Mode->VerticalResolution = Info->VerticalResolution;
+ Mode++;
+ gBS->FreePool (Info);
+ }
+ } else {
+ //
+ // Check intersection of display mode
+ //
+ ModeBuffer = AllocatePool (sizeof (TEXT_OUT_GOP_MODE) * CurrentGraphicsOutputMode->MaxMode);
+ if (ModeBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ MatchedMode = ModeBuffer;
+ Mode = &Private->GraphicsOutputModeBuffer[0];
+ for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {
+ Match = FALSE;
+
+ for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex++) {
+ Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&
+ (Info->VerticalResolution == Mode->VerticalResolution)){
+ Match = TRUE;
+ gBS->FreePool (Info);
+ break;
+ }
+ gBS->FreePool (Info);
+ }
+
+ if (Match) {
+ CopyMem (MatchedMode, Mode, sizeof (TEXT_OUT_GOP_MODE));
+ MatchedMode++;
+ }
+
+ Mode++;
+ }
+
+ //
+ // Drop the old mode buffer, assign it to a new one
+ //
+ gBS->FreePool (Private->GraphicsOutputModeBuffer);
+ Private->GraphicsOutputModeBuffer = ModeBuffer;
+
+ //
+ // Physical frame buffer is no longer available when there are more than one physical GOP devices
+ //
+ CurrentGraphicsOutputMode->MaxMode = (UINT32) (((UINTN) MatchedMode - (UINTN) ModeBuffer) / sizeof (TEXT_OUT_GOP_MODE));
+ CurrentGraphicsOutputMode->Info->PixelFormat = PixelBltOnly;
+ ZeroMem (&CurrentGraphicsOutputMode->Info->PixelInformation, sizeof (EFI_PIXEL_BITMASK));
+ CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+ CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;
+ CurrentGraphicsOutputMode->FrameBufferSize = 0;
+ }
+
+ //
+ // Select a prefered Display mode 800x600
+ //
+ for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {
+ Mode = &Private->GraphicsOutputModeBuffer[Index];
+ if ((Mode->HorizontalResolution == 800) && (Mode->VerticalResolution == 600)) {
+ break;
+ }
+ }
+ //
+ // Prefered mode is not found, set to mode 0
+ //
+ if (Index >= CurrentGraphicsOutputMode->MaxMode) {
+ Index = 0;
+ }
+
+ //
+ // Current mode number may need update now, so set it to an invalide mode number
+ //
+ CurrentGraphicsOutputMode->Mode = 0xffff;
+ } else {
+ //
+ // For UGA device, it's inconvenient to retrieve all the supported display modes.
+ // To simplify the implementation, only add one resolution(800x600, 32bit color depth) as defined in UEFI spec
+ //
+ CurrentGraphicsOutputMode->MaxMode = 1;
+ CurrentGraphicsOutputMode->Info->Version = 0;
+ CurrentGraphicsOutputMode->Info->HorizontalResolution = 800;
+ CurrentGraphicsOutputMode->Info->VerticalResolution = 600;
+ CurrentGraphicsOutputMode->Info->PixelFormat = PixelBltOnly;
+ CurrentGraphicsOutputMode->Info->PixelsPerScanLine = 800;
+ CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+ CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;
+ CurrentGraphicsOutputMode->FrameBufferSize = 0;
+
+ //
+ // Update the private mode buffer
+ //
+ ModeBuffer = &Private->GraphicsOutputModeBuffer[0];
+ ModeBuffer->HorizontalResolution = 800;
+ ModeBuffer->VerticalResolution = 600;
+
+ //
+ // Current mode is unknow now, set it to an invalid mode number 0xffff
+ //
+ CurrentGraphicsOutputMode->Mode = 0xffff;
+ Index = 0;
+ }
+
+ //
+ // Force GraphicsOutput mode to be set,
+ // regardless whether the console is in EfiConsoleControlScreenGraphics or EfiConsoleControlScreenText mode
+ //
+ Private->HardwareNeedsStarting = TRUE;
+ Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) Index);
+
+ Private->CurrentNumberOfGraphicsOutput++;
+
+ return Status;
+}
+#endif
+
EFI_STATUS
ConSplitterTextOutAddDevice (
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut,
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
)
/*++
@@ -1886,7 +2166,7 @@ Returns:
UINTN CurrentNumOfConsoles;
INT32 CurrentMode;
INT32 MaxMode;
- TEXT_OUT_AND_UGA_DATA *TextAndUga;
+ TEXT_OUT_AND_GOP_DATA *TextAndGop;
Status = EFI_SUCCESS;
CurrentNumOfConsoles = Private->CurrentNumberOfConsoles;
@@ -1896,7 +2176,7 @@ Returns:
//
while (CurrentNumOfConsoles >= Private->TextOutListCount) {
Status = ConSplitterGrowBuffer (
- sizeof (TEXT_OUT_AND_UGA_DATA),
+ sizeof (TEXT_OUT_AND_GOP_DATA),
&Private->TextOutListCount,
(VOID **) &Private->TextOutList
);
@@ -1912,20 +2192,22 @@ Returns:
}
}
- TextAndUga = &Private->TextOutList[CurrentNumOfConsoles];
+ TextAndGop = &Private->TextOutList[CurrentNumOfConsoles];
+
+ TextAndGop->TextOut = TextOut;
+ TextAndGop->GraphicsOutput = GraphicsOutput;
+ TextAndGop->UgaDraw = UgaDraw;
- TextAndUga->TextOut = TextOut;
- TextAndUga->UgaDraw = UgaDraw;
- if (UgaDraw == NULL) {
+ if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
//
// If No UGA device then use the ConOut device
//
- TextAndUga->TextOutEnabled = TRUE;
+ TextAndGop->TextOutEnabled = TRUE;
} else {
//
// If UGA device use ConOut device only used if UGA screen is in Text mode
//
- TextAndUga->TextOutEnabled = (BOOLEAN) (Private->UgaMode == EfiConsoleControlScreenText);
+ TextAndGop->TextOutEnabled = (BOOLEAN) (Private->ConsoleOutputMode == EfiConsoleControlScreenText);
}
if (CurrentNumOfConsoles == 0) {
@@ -1950,17 +2232,26 @@ Returns:
MaxMode = Private->TextOutMode.MaxMode;
ASSERT (MaxMode >= 1);
- if (Private->UgaMode == EfiConsoleControlScreenGraphics && UgaDraw != NULL) {
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+ if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {
+ ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);
+ }
+#endif
+
+ if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) {
//
// We just added a new UGA device in graphics mode
//
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+ DevNullGopSync (Private, GraphicsOutput, UgaDraw);
+#else
DevNullUgaSync (Private, UgaDraw);
-
- } else if ((CurrentMode >= 0) && (UgaDraw != NULL) && (CurrentMode < Private->TextOutMode.MaxMode)) {
+#endif
+ } else if ((CurrentMode >= 0) && ((GraphicsOutput != NULL) || (UgaDraw != NULL)) && (CurrentMode < Private->TextOutMode.MaxMode)) {
//
// The new console supports the same mode of the current console so sync up
//
- DevNullSyncUgaStdOut (Private);
+ DevNullSyncGopStdOut (Private);
} else {
//
// If ConOut, then set the mode to Mode #0 which us 80 x 25
@@ -1990,7 +2281,7 @@ Returns:
{
INT32 Index;
UINTN CurrentNumOfConsoles;
- TEXT_OUT_AND_UGA_DATA *TextOutList;
+ TEXT_OUT_AND_GOP_DATA *TextOutList;
EFI_STATUS Status;
//
@@ -2002,7 +2293,7 @@ Returns:
TextOutList = Private->TextOutList;
while (Index >= 0) {
if (TextOutList->TextOut == TextOut) {
- CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_UGA_DATA) * Index);
+ CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index);
CurrentNumOfConsoles--;
break;
}
@@ -2862,7 +3153,8 @@ ConSplitterTextOutQueryMode (
// Check whether param ModeNumber is valid.
// ModeNumber should be within range 0 ~ MaxMode - 1.
//
- if (ModeNumber > (UINTN)(((UINT32)-1)>>1)) {
+ if ( (ModeNumber < 0) ||
+ (ModeNumber > (UINTN)(((UINT32)-1)>>1)) ) {
return EFI_UNSUPPORTED;
}
@@ -2916,7 +3208,8 @@ ConSplitterTextOutSetMode (
// Check whether param ModeNumber is valid.
// ModeNumber should be within range 0 ~ MaxMode - 1.
//
- if (ModeNumber > (UINTN)(((UINT32)-1)>>1)) {
+ if ( (ModeNumber < 0) ||
+ (ModeNumber > (UINTN)(((UINT32)-1)>>1)) ) {
return EFI_UNSUPPORTED;
}
@@ -2944,7 +3237,7 @@ ConSplitterTextOutSetMode (
// If this console device is based on a UGA device, then sync up the bitmap from
// the UGA splitter and reclear the text portion of the display in the new mode.
//
- if (Private->TextOutList[Index].UgaDraw != NULL) {
+ if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {
Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut);
}
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h
index fc68f049a0..30980225e5 100644
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h
+++ b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h
@@ -84,33 +84,48 @@ typedef struct {
#define TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('T', 'o', 'S', 'p')
typedef struct {
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
BOOLEAN TextOutEnabled;
-} TEXT_OUT_AND_UGA_DATA;
+} TEXT_OUT_AND_GOP_DATA;
+
+typedef struct {
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+} TEXT_OUT_GOP_MODE;
typedef struct {
UINT64 Signature;
EFI_HANDLE VirtualHandle;
EFI_SIMPLE_TEXT_OUT_PROTOCOL TextOut;
EFI_SIMPLE_TEXT_OUTPUT_MODE TextOutMode;
+
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
EFI_UGA_DRAW_PROTOCOL UgaDraw;
UINT32 UgaHorizontalResolution;
UINT32 UgaVerticalResolution;
UINT32 UgaColorDepth;
UINT32 UgaRefreshRate;
EFI_UGA_PIXEL *UgaBlt;
+#else
+ EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GraphicsOutputBlt;
+ TEXT_OUT_GOP_MODE *GraphicsOutputModeBuffer;
+ UINTN CurrentNumberOfGraphicsOutput;
+ BOOLEAN HardwareNeedsStarting;
+#endif
EFI_CONSOLE_CONTROL_PROTOCOL ConsoleControl;
UINTN CurrentNumberOfConsoles;
- TEXT_OUT_AND_UGA_DATA *TextOutList;
+ TEXT_OUT_AND_GOP_DATA *TextOutList;
UINTN TextOutListCount;
TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;
UINTN TextOutQueryDataCount;
INT32 *TextOutModeMap;
- EFI_CONSOLE_CONTROL_SCREEN_MODE UgaMode;
+ EFI_CONSOLE_CONTROL_SCREEN_MODE ConsoleOutputMode;
UINTN DevNullColumns;
UINTN DevNullRows;
@@ -126,6 +141,13 @@ typedef struct {
TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \
)
+#define GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
+ CR (a, \
+ TEXT_OUT_SPLITTER_PRIVATE_DATA, \
+ GraphicsOutput, \
+ TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \
+ )
+
#define UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
CR (a, \
TEXT_OUT_SPLITTER_PRIVATE_DATA, \
@@ -151,14 +173,14 @@ ConSplitterDriverEntry (
)
;
-
+STATIC
EFI_STATUS
ConSplitterTextInConstructor (
TEXT_IN_SPLITTER_PRIVATE_DATA *Private
)
;
-
+STATIC
EFI_STATUS
ConSplitterTextOutConstructor (
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
@@ -168,7 +190,7 @@ ConSplitterTextOutConstructor (
//
// Driver Binding Functions
//
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingSupported (
@@ -178,7 +200,7 @@ ConSplitterConInDriverBindingSupported (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingSupported (
@@ -188,7 +210,7 @@ ConSplitterSimplePointerDriverBindingSupported (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingSupported (
@@ -198,7 +220,7 @@ ConSplitterConOutDriverBindingSupported (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingSupported (
@@ -208,7 +230,7 @@ ConSplitterStdErrDriverBindingSupported (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingStart (
@@ -218,7 +240,7 @@ ConSplitterConInDriverBindingStart (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingStart (
@@ -228,7 +250,7 @@ ConSplitterSimplePointerDriverBindingStart (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingStart (
@@ -238,7 +260,7 @@ ConSplitterConOutDriverBindingStart (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingStart (
@@ -248,7 +270,7 @@ ConSplitterStdErrDriverBindingStart (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingStop (
@@ -259,7 +281,7 @@ ConSplitterConInDriverBindingStop (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingStop (
@@ -270,7 +292,7 @@ ConSplitterSimplePointerDriverBindingStop (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingStop (
@@ -281,7 +303,7 @@ ConSplitterConOutDriverBindingStop (
)
;
-
+STATIC
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingStop (
@@ -333,6 +355,7 @@ EFI_STATUS
ConSplitterTextOutAddDevice (
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut,
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
)
;
@@ -521,7 +544,7 @@ EFIAPI
ConSpliterConsoleControlGetMode (
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
- OUT BOOLEAN *UgaExists,
+ OUT BOOLEAN *GopExists,
OUT BOOLEAN *StdInLocked
)
;
@@ -536,6 +559,49 @@ ConSpliterConsoleControlSetMode (
EFI_STATUS
EFIAPI
+ConSpliterGraphicsOutputQueryMode (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN UINT32 ModeNumber,
+ OUT UINTN *SizeOfInfo,
+ OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
+ )
+;
+
+EFI_STATUS
+EFIAPI
+ConSpliterGraphicsOutputSetMode (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
+ IN UINT32 ModeNumber
+ )
+;
+
+EFI_STATUS
+EFIAPI
+ConSpliterGraphicsOutputBlt (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
+ IN UINTN SourceX,
+ IN UINTN SourceY,
+ IN UINTN DestinationX,
+ IN UINTN DestinationY,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN UINTN Delta OPTIONAL
+ )
+;
+
+EFI_STATUS
+DevNullGopSync (
+ IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
+ IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
+ )
+;
+
+#if (EFI_SPECIFICATION < 0x00020000)
+EFI_STATUS
+EFIAPI
ConSpliterUgaDrawGetMode (
IN EFI_UGA_DRAW_PROTOCOL *This,
OUT UINT32 *HorizontalResolution,
@@ -578,6 +644,7 @@ DevNullUgaSync (
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
)
;
+#endif
EFI_STATUS
DevNullTextOutOutputString (
@@ -615,7 +682,7 @@ DevNullTextOutEnableCursor (
;
EFI_STATUS
-DevNullSyncUgaStdOut (
+DevNullSyncGopStdOut (
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
)
;
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa
index c2232629a2..f688a19458 100644
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa
+++ b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa
@@ -62,6 +62,9 @@
<ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
+ <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c
index 412d695d77..5aa2bae2f0 100644
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c
+++ b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c
@@ -32,7 +32,7 @@ EFIAPI
ConSpliterConsoleControlGetMode (
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
- OUT BOOLEAN *UgaExists,
+ OUT BOOLEAN *GopExists,
OUT BOOLEAN *StdInLocked
)
/*++
@@ -63,13 +63,13 @@ ConSpliterConsoleControlGetMode (
return EFI_INVALID_PARAMETER;
}
- *Mode = Private->UgaMode;
+ *Mode = Private->ConsoleOutputMode;
- if (UgaExists != NULL) {
- *UgaExists = FALSE;
+ if (GopExists != NULL) {
+ *GopExists = FALSE;
for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
- if (Private->TextOutList[Index].UgaDraw != NULL) {
- *UgaExists = TRUE;
+ if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {
+ *GopExists = TRUE;
break;
}
}
@@ -107,7 +107,7 @@ ConSpliterConsoleControlSetMode (
{
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
UINTN Index;
- TEXT_OUT_AND_UGA_DATA *TextAndUga;
+ TEXT_OUT_AND_GOP_DATA *TextAndGop;
BOOLEAN Supported;
Private = CONSOLE_CONTROL_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
@@ -117,9 +117,9 @@ ConSpliterConsoleControlSetMode (
}
Supported = FALSE;
- TextAndUga = &Private->TextOutList[0];
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndUga++) {
- if (TextAndUga->UgaDraw != NULL) {
+ TextAndGop = &Private->TextOutList[0];
+ for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndGop++) {
+ if ((TextAndGop->GraphicsOutput != NULL) || (TextAndGop->UgaDraw != NULL)) {
Supported = TRUE;
break;
}
@@ -129,28 +129,513 @@ ConSpliterConsoleControlSetMode (
return EFI_UNSUPPORTED;
}
- Private->UgaMode = Mode;
+ Private->ConsoleOutputMode = Mode;
- TextAndUga = &Private->TextOutList[0];
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndUga++) {
+ TextAndGop = &Private->TextOutList[0];
+ for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndGop++) {
- TextAndUga->TextOutEnabled = TRUE;
+ TextAndGop->TextOutEnabled = TRUE;
//
// If we are going into Graphics mode disable ConOut to any UGA device
//
- if ((Mode == EfiConsoleControlScreenGraphics) && (TextAndUga->UgaDraw != NULL)) {
- TextAndUga->TextOutEnabled = FALSE;
- DevNullUgaSync (Private, TextAndUga->UgaDraw);
+ if ((Mode == EfiConsoleControlScreenGraphics) &&((TextAndGop->GraphicsOutput != NULL) || (TextAndGop->UgaDraw != NULL))) {
+ TextAndGop->TextOutEnabled = FALSE;
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+ DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);
+#else
+ DevNullUgaSync (Private, TextAndGop->UgaDraw);
+#endif
}
}
if (Mode == EfiConsoleControlScreenText) {
- DevNullSyncUgaStdOut (Private);
+ DevNullSyncGopStdOut (Private);
}
return EFI_SUCCESS;
}
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+EFI_STATUS
+EFIAPI
+ConSpliterGraphicsOutputQueryMode (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN UINT32 ModeNumber,
+ OUT UINTN *SizeOfInfo,
+ OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
+ )
+/*++
+
+ Routine Description:
+ Return the current video mode information.
+
+ Arguments:
+ This - Protocol instance pointer.
+ ModeNumber - The mode number to return information on.
+ Info - Caller allocated buffer that returns information about ModeNumber.
+ SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.
+
+ Returns:
+ EFI_SUCCESS - Mode information returned.
+ EFI_BUFFER_TOO_SMALL - The Info buffer was too small.
+ EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.
+ EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
+ EFI_INVALID_PARAMETER - One of the input args was NULL.
+
+--*/
+{
+ TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
+ EFI_STATUS Status;
+ TEXT_OUT_GOP_MODE *Mode;
+
+ if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // retrieve private data
+ //
+ Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
+
+ if (Private->HardwareNeedsStarting) {
+ return EFI_NOT_STARTED;
+ }
+
+ Status = gBS->AllocatePool (
+ EfiBootServicesData,
+ sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),
+ Info
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+
+ CopyMem (*Info, Private->GraphicsOutput.Mode->Info, *SizeOfInfo);
+ Mode = &Private->GraphicsOutputModeBuffer[ModeNumber];
+ (*Info)->HorizontalResolution = Mode->HorizontalResolution;
+ (*Info)->VerticalResolution = Mode->VerticalResolution;
+ (*Info)->PixelsPerScanLine = Mode->HorizontalResolution;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+ConSpliterGraphicsOutputSetMode (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
+ IN UINT32 ModeNumber
+ )
+/*++
+
+Routine Description:
+
+ Graphics output protocol interface to set video mode
+
+ Arguments:
+ This - Protocol instance pointer.
+ ModeNumber - The mode number to be set.
+
+ Returns:
+ EFI_SUCCESS - Graphics mode was changed.
+ EFI_DEVICE_ERROR - The device had an error and could not complete the request.
+ EFI_UNSUPPORTED - ModeNumber is not supported by this device.
+
+--*/
+{
+ EFI_STATUS Status;
+ TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
+ UINTN Index;
+ EFI_STATUS ReturnStatus;
+ TEXT_OUT_GOP_MODE *Mode;
+ UINTN Size;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ UINTN NumberIndex;
+ UINTN SizeOfInfo;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+
+ if (ModeNumber >= This->Mode->MaxMode) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if (ModeNumber == This->Mode->Mode) {
+ return EFI_SUCCESS;
+ }
+
+ Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
+
+ //
+ // GopDevNullSetMode ()
+ //
+ ReturnStatus = EFI_SUCCESS;
+
+ //
+ // Free the old version
+ //
+ if (Private->GraphicsOutputBlt != NULL) {
+ gBS->FreePool (Private->GraphicsOutputBlt);
+ }
+
+ //
+ // Allocate the virtual Blt buffer
+ //
+ Mode = &Private->GraphicsOutputModeBuffer[ModeNumber];
+ Size = Mode->HorizontalResolution * Mode->VerticalResolution * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
+ Private->GraphicsOutputBlt = AllocateZeroPool (Size);
+
+ if (Private->GraphicsOutputBlt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (!Private->HardwareNeedsStarting) {
+ if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) {
+ return EFI_UNSUPPORTED;
+ }
+ }
+ //
+ // return the worst status met
+ //
+ for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
+ GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;
+ if (GraphicsOutput != NULL) {
+ //
+ // Find corresponding ModeNumber of this GraphicsOutput instance
+ //
+ for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {
+ Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {
+ gBS->FreePool (Info);
+ break;
+ }
+ gBS->FreePool (Info);
+ }
+
+ Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);
+ if (EFI_ERROR (Status)) {
+ ReturnStatus = Status;
+ }
+ }
+
+ UgaDraw = Private->TextOutList[Index].UgaDraw;
+ if (UgaDraw != NULL) {
+ Status = UgaDraw->SetMode (
+ UgaDraw,
+ Mode->HorizontalResolution,
+ Mode->VerticalResolution,
+ 32,
+ 60
+ );
+ if (EFI_ERROR (Status)) {
+ ReturnStatus = Status;
+ }
+ }
+ }
+
+ This->Mode->Mode = ModeNumber;
+
+ Info = This->Mode->Info;
+ Info->HorizontalResolution = Mode->HorizontalResolution;
+ Info->VerticalResolution = Mode->VerticalResolution;
+ Info->PixelsPerScanLine = Mode->HorizontalResolution;
+
+ //
+ // Information is not enough here, so the following items remain unchanged:
+ // GraphicsOutputMode->Info->Version, GraphicsOutputMode->Info->PixelFormat
+ // GraphicsOutputMode->SizeOfInfo, GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize
+ // These items will be initialized/updated when a new GOP device is added into ConsoleSplitter.
+ //
+
+ Private->HardwareNeedsStarting = FALSE;
+
+ return ReturnStatus;
+}
+
+EFI_STATUS
+DevNullGraphicsOutputBlt (
+ IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
+ IN UINTN SourceX,
+ IN UINTN SourceY,
+ IN UINTN DestinationX,
+ IN UINTN DestinationY,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN UINTN Delta OPTIONAL
+ )
+{
+ UINTN SrcY;
+ UINTN Index;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltPtr;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ScreenPtr;
+ UINTN HorizontalResolution;
+ UINTN VerticalResolution;
+
+ if ((BltOperation < EfiBltVideoFill) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width == 0 || Height == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Delta == 0) {
+ Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
+ }
+
+ HorizontalResolution = Private->GraphicsOutput.Mode->Info->HorizontalResolution;
+ VerticalResolution = Private->GraphicsOutput.Mode->Info->VerticalResolution;
+
+ //
+ // We need to fill the Virtual Screen buffer with the blt data.
+ //
+ if (BltOperation == EfiBltVideoToBltBuffer) {
+ //
+ // Video to BltBuffer: Source is Video, destination is BltBuffer
+ //
+ if ((SourceY + Height) > VerticalResolution) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((SourceX + Width) > HorizontalResolution) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + DestinationY * Delta + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ ScreenPtr = &Private->GraphicsOutputBlt[SourceY * HorizontalResolution + SourceX];
+ while (Height) {
+ CopyMem (BltPtr, ScreenPtr, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltPtr + Delta);
+ ScreenPtr += HorizontalResolution;
+ Height--;
+ }
+ } else {
+ //
+ // BltBuffer to Video: Source is BltBuffer, destination is Video
+ //
+ if (DestinationY + Height > VerticalResolution) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (DestinationX + Width > HorizontalResolution) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ScreenPtr = &Private->GraphicsOutputBlt[DestinationY * HorizontalResolution + DestinationX];
+ SrcY = SourceY;
+ while (Height) {
+ if (BltOperation == EfiBltVideoFill) {
+ for (Index = 0; Index < Width; Index++) {
+ ScreenPtr[Index] = *BltBuffer;
+ }
+ } else {
+ if (BltOperation == EfiBltBufferToVideo) {
+ BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + SrcY * Delta + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ } else {
+ BltPtr = &Private->GraphicsOutputBlt[SrcY * HorizontalResolution + SourceX];
+ }
+
+ CopyMem (ScreenPtr, BltPtr, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ }
+
+ ScreenPtr += HorizontalResolution;
+ SrcY++;
+ Height--;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+ConSpliterGraphicsOutputBlt (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
+ IN UINTN SourceX,
+ IN UINTN SourceY,
+ IN UINTN DestinationX,
+ IN UINTN DestinationY,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN UINTN Delta OPTIONAL
+ )
+/*++
+
+ Routine Description:
+ The following table defines actions for BltOperations:
+ EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY)
+ directly to every pixel of the video display rectangle
+ (DestinationX, DestinationY)
+ (DestinationX + Width, DestinationY + Height).
+ Only one pixel will be used from the BltBuffer. Delta is NOT used.
+ EfiBltVideoToBltBuffer - Read data from the video display rectangle
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
+ the BltBuffer rectangle (DestinationX, DestinationY )
+ (DestinationX + Width, DestinationY + Height). If DestinationX or
+ DestinationY is not zero then Delta must be set to the length in bytes
+ of a row in the BltBuffer.
+ EfiBltBufferToVideo - Write data from the BltBuffer rectangle
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
+ video display rectangle (DestinationX, DestinationY)
+ (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
+ not zero then Delta must be set to the length in bytes of a row in the
+ BltBuffer.
+ EfiBltVideoToVideo - Copy from the video display rectangle
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) .
+ to the video display rectangle (DestinationX, DestinationY)
+ (DestinationX + Width, DestinationY + Height).
+ The BltBuffer and Delta are not used in this mode.
+
+ Arguments:
+ This - Protocol instance pointer.
+ BltBuffer - Buffer containing data to blit into video buffer. This
+ buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ BltOperation - Operation to perform on BlitBuffer and video memory
+ SourceX - X coordinate of source for the BltBuffer.
+ SourceY - Y coordinate of source for the BltBuffer.
+ DestinationX - X coordinate of destination for the BltBuffer.
+ DestinationY - Y coordinate of destination for the BltBuffer.
+ Width - Width of rectangle in BltBuffer in pixels.
+ Height - Hight of rectangle in BltBuffer in pixels.
+ Delta -
+
+ Returns:
+ EFI_SUCCESS - The Blt operation completed.
+ EFI_INVALID_PARAMETER - BltOperation is not valid.
+ EFI_DEVICE_ERROR - A hardware error occured writting to the video
+ buffer.
+
+--*/
+{
+ EFI_STATUS Status;
+ TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
+ UINTN Index;
+ EFI_STATUS ReturnStatus;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+
+ Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
+
+ //
+ // Sync up DevNull GOP device
+ //
+ ReturnStatus = DevNullGraphicsOutputBlt (
+ Private,
+ BltBuffer,
+ BltOperation,
+ SourceX,
+ SourceY,
+ DestinationX,
+ DestinationY,
+ Width,
+ Height,
+ Delta
+ );
+
+ if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) {
+ return ReturnStatus;
+ }
+ //
+ // return the worst status met
+ //
+ for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
+ GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;
+ if (GraphicsOutput != NULL) {
+ Status = GraphicsOutput->Blt (
+ GraphicsOutput,
+ BltBuffer,
+ BltOperation,
+ SourceX,
+ SourceY,
+ DestinationX,
+ DestinationY,
+ Width,
+ Height,
+ Delta
+ );
+ if (EFI_ERROR (Status)) {
+ ReturnStatus = Status;
+ } else if (BltOperation == EfiBltVideoToBltBuffer) {
+ //
+ // Only need to read the data into buffer one time
+ //
+ return EFI_SUCCESS;
+ }
+ }
+
+ UgaDraw = Private->TextOutList[Index].UgaDraw;
+ if (UgaDraw != NULL) {
+ Status = UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) BltBuffer,
+ BltOperation,
+ SourceX,
+ SourceY,
+ DestinationX,
+ DestinationY,
+ Width,
+ Height,
+ Delta
+ );
+ if (EFI_ERROR (Status)) {
+ ReturnStatus = Status;
+ } else if (BltOperation == EfiBltVideoToBltBuffer) {
+ //
+ // Only need to read the data into buffer one time
+ //
+ return EFI_SUCCESS;
+ }
+ }
+ }
+
+ return ReturnStatus;
+}
+
+EFI_STATUS
+DevNullGopSync (
+ IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
+ IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
+ )
+{
+ if (GraphicsOutput != NULL) {
+ return GraphicsOutput->Blt (
+ GraphicsOutput,
+ Private->GraphicsOutputBlt,
+ EfiBltBufferToVideo,
+ 0,
+ 0,
+ 0,
+ 0,
+ Private->GraphicsOutput.Mode->Info->HorizontalResolution,
+ Private->GraphicsOutput.Mode->Info->VerticalResolution,
+ 0
+ );
+ } else {
+ return UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) Private->GraphicsOutputBlt,
+ EfiUgaBltBufferToVideo,
+ 0,
+ 0,
+ 0,
+ 0,
+ Private->GraphicsOutput.Mode->Info->HorizontalResolution,
+ Private->GraphicsOutput.Mode->Info->VerticalResolution,
+ 0
+ );
+ }
+}
+
+#else
+
EFI_STATUS
EFIAPI
ConSpliterUgaDrawGetMode (
@@ -260,7 +745,7 @@ ConSpliterUgaDrawSetMode (
Private->UgaColorDepth = ColorDepth;
Private->UgaRefreshRate = RefreshRate;
- if (Private->UgaMode != EfiConsoleControlScreenGraphics) {
+ if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) {
return ReturnStatus;
}
//
@@ -465,7 +950,7 @@ ConSpliterUgaDrawBlt (
Height,
Delta
);
- if (Private->UgaMode != EfiConsoleControlScreenGraphics) {
+ if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) {
return ReturnStatus;
}
//
@@ -518,6 +1003,7 @@ DevNullUgaSync (
Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL)
);
}
+#endif
EFI_STATUS
DevNullTextOutOutputString (
@@ -927,7 +1413,7 @@ DevNullTextOutEnableCursor (
}
EFI_STATUS
-DevNullSyncUgaStdOut (
+DevNullSyncGopStdOut (
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
)
/*++
@@ -977,9 +1463,9 @@ DevNullSyncUgaStdOut (
Sto = Private->TextOutList[List].TextOut;
//
- // Skip non UGA devices
+ // Skip non GOP/UGA devices
//
- if (Private->TextOutList[List].UgaDraw != NULL) {
+ if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) {
Sto->EnableCursor (Sto, FALSE);
Sto->ClearScreen (Sto);
}
@@ -1034,9 +1520,9 @@ DevNullSyncUgaStdOut (
Sto = Private->TextOutList[List].TextOut;
//
- // Skip non UGA devices
+ // Skip non GOP/UGA devices
//
- if (Private->TextOutList[List].UgaDraw != NULL) {
+ if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) {
Sto->SetAttribute (Sto, CurrentAttribute);
Sto->SetCursorPosition (Sto, CurrentColumn, Row);
Status = Sto->OutputString (Sto, Buffer);
@@ -1058,9 +1544,9 @@ DevNullSyncUgaStdOut (
Sto = Private->TextOutList[List].TextOut;
//
- // Skip non UGA devices
+ // Skip non GOP/UGA devices
//
- if (Private->TextOutList[List].UgaDraw != NULL) {
+ if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) {
Sto->SetAttribute (Sto, StartAttribute);
Sto->SetCursorPosition (Sto, StartColumn, StartRow);
Status = Sto->EnableCursor (Sto, StartCursorState);
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
index d70c979b72..6cea2e11b6 100644
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
+++ b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
@@ -60,8 +60,8 @@ GraphicsConsoleControllerDriverStop (
EFI_STATUS
GetTextColors (
IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- OUT EFI_UGA_PIXEL *Foreground,
- OUT EFI_UGA_PIXEL *Background
+ OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
+ OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background
);
EFI_STATUS
@@ -87,6 +87,7 @@ EraseCursor (
//
GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
GRAPHICS_CONSOLE_DEV_SIGNATURE,
+ (EFI_GRAPHICS_OUTPUT_PROTOCOL *) NULL,
(EFI_UGA_DRAW_PROTOCOL *) NULL,
{
GraphicsConsoleConOutReset,
@@ -110,10 +111,10 @@ GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
},
{
{ 80, 25, 0, 0, 0, 0 }, // Mode 0
- { 0, 0, 0, 0, 0, 0 }, // Mode 1
+ { 80, 50, 0, 0, 0, 0 }, // Mode 1
{ 0, 0, 0, 0, 0, 0 } // Mode 2
},
- (EFI_UGA_PIXEL *) NULL,
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
(EFI_HII_HANDLE) 0
};
@@ -121,26 +122,26 @@ EFI_HII_PROTOCOL *mHii;
static CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
-static EFI_UGA_PIXEL mEfiColors[16] = {
+static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
//
// B G R
//
- { 0x00, 0x00, 0x00, 0x00 }, // BLACK
- { 0x98, 0x00, 0x00, 0x00 }, // BLUE
- { 0x00, 0x98, 0x00, 0x00 }, // GREEN
- { 0x98, 0x98, 0x00, 0x00 }, // CYAN
- { 0x00, 0x00, 0x98, 0x00 }, // RED
- { 0x98, 0x00, 0x98, 0x00 }, // MAGENTA
- { 0x00, 0x98, 0x98, 0x00 }, // BROWN
- { 0x98, 0x98, 0x98, 0x00 }, // LIGHTGRAY
- { 0x30, 0x30, 0x30, 0x00 }, // DARKGRAY - BRIGHT BLACK
- { 0xff, 0x00, 0x00, 0x00 }, // LIGHTBLUE - ?
- { 0x00, 0xff, 0x00, 0x00 }, // LIGHTGREEN - ?
- { 0xff, 0xff, 0x00, 0x00 }, // LIGHTCYAN
- { 0x00, 0x00, 0xff, 0x00 }, // LIGHTRED
- { 0xff, 0x00, 0xff, 0x00 }, // LIGHTMAGENTA
- { 0x00, 0xff, 0xff, 0x00 }, // LIGHTBROWN
- { 0xff, 0xff, 0xff, 0x00 } // WHITE
+ 0x00, 0x00, 0x00, 0x00, // BLACK
+ 0x98, 0x00, 0x00, 0x00, // BLUE
+ 0x00, 0x98, 0x00, 0x00, // GREEN
+ 0x98, 0x98, 0x00, 0x00, // CYAN
+ 0x00, 0x00, 0x98, 0x00, // RED
+ 0x98, 0x00, 0x98, 0x00, // MAGENTA
+ 0x00, 0x98, 0x98, 0x00, // BROWN
+ 0x98, 0x98, 0x98, 0x00, // LIGHTGRAY
+ 0x30, 0x30, 0x30, 0x00, // DARKGRAY - BRIGHT BLACK
+ 0xff, 0x00, 0x00, 0x00, // LIGHTBLUE - ?
+ 0x00, 0xff, 0x00, 0x00, // LIGHTGREEN - ?
+ 0xff, 0xff, 0x00, 0x00, // LIGHTCYAN
+ 0x00, 0x00, 0xff, 0x00, // LIGHTRED
+ 0xff, 0x00, 0xff, 0x00, // LIGHTMAGENTA
+ 0x00, 0xff, 0xff, 0x00, // LIGHTBROWN
+ 0xff, 0xff, 0xff, 0x00, // WHITE
};
static EFI_NARROW_GLYPH mCursorGlyph = {
@@ -149,9 +150,6 @@ static EFI_NARROW_GLYPH mCursorGlyph = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF }
};
-static CHAR16 SpaceStr[] = { (CHAR16)NARROW_CHAR, ' ', 0 };
-
-
EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {
GraphicsConsoleControllerDriverSupported,
GraphicsConsoleControllerDriverStart,
@@ -170,23 +168,41 @@ GraphicsConsoleControllerDriverSupported (
)
{
EFI_STATUS Status;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UgaDraw = NULL;
//
// Open the IO Abstraction(s) needed to perform the supported test
//
Status = gBS->OpenProtocol (
Controller,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw,
+ &gEfiGraphicsOutputProtocolGuid,
+ (VOID **) &GraphicsOutput,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
+
if (EFI_ERROR (Status)) {
- return Status;
+ GraphicsOutput = NULL;
+ //
+ // Open Graphics Output Protocol failed, try to open UGA Draw Protocol
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiUgaDrawProtocolGuid,
+ (VOID **) &UgaDraw,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
+
//
// We need to ensure that we do not layer on top of a virtual handle.
// We need to ensure that the handles produced by the conspliter do not
@@ -219,13 +235,21 @@ GraphicsConsoleControllerDriverSupported (
// Close the I/O Abstraction(s) used to perform the supported test
//
Error:
- gBS->CloseProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
+ if (GraphicsOutput != NULL) {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiGraphicsOutputProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ } else {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUgaDrawProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ }
return Status;
}
@@ -268,6 +292,12 @@ GraphicsConsoleControllerDriverStart (
UINTN Columns;
UINTN Rows;
UINT8 *Location;
+ UINT32 ModeNumber;
+ UINTN SizeOfInfo;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+
+ ModeNumber = 0;
+
//
// Initialize the Graphics Console device instance
//
@@ -283,15 +313,28 @@ GraphicsConsoleControllerDriverStart (
Status = gBS->OpenProtocol (
Controller,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &Private->UgaDraw,
+ &gEfiGraphicsOutputProtocolGuid,
+ (VOID **) &Private->GraphicsOutput,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
- if (EFI_ERROR (Status)) {
- goto Error;
+ if (EFI_ERROR(Status)) {
+ Private->GraphicsOutput = NULL;
+
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiUgaDrawProtocolGuid,
+ (VOID **) &Private->UgaDraw,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ goto Error;
+ }
}
+
//
// Get the HII protocol. If Supported() succeeds, do we really
// need to get HII protocol again?
@@ -331,30 +374,71 @@ GraphicsConsoleControllerDriverStart (
//
HorizontalResolution = 800;
VerticalResolution = 600;
- ColorDepth = 32;
- RefreshRate = 60;
- Status = Private->UgaDraw->SetMode (
- Private->UgaDraw,
- HorizontalResolution,
- VerticalResolution,
- ColorDepth,
- RefreshRate
- );
- if (EFI_ERROR (Status)) {
+
+ if (Private->GraphicsOutput != NULL) {
//
- // Get the current mode information from the UGA Draw Protocol
+ // The console is build on top of Graphics Output Protocol, find the mode number for 800x600
//
- Status = Private->UgaDraw->GetMode (
+ for (ModeNumber = 0; ModeNumber < Private->GraphicsOutput->Mode->MaxMode; ModeNumber++) {
+ Status = Private->GraphicsOutput->QueryMode (
+ Private->GraphicsOutput,
+ ModeNumber,
+ &SizeOfInfo,
+ &Info
+ );
+ if (!EFI_ERROR (Status)) {
+ if ((Info->HorizontalResolution == 800) &&
+ (Info->VerticalResolution == 600) &&
+ ((Info->PixelFormat == PixelRedGreenBlueReserved8BitPerColor) ||
+ (Info->PixelFormat == PixelBlueGreenRedReserved8BitPerColor))) {
+ Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);
+ if (!EFI_ERROR (Status)) {
+ gBS->FreePool (Info);
+ break;
+ }
+ }
+ gBS->FreePool (Info);
+ }
+ }
+
+ if (EFI_ERROR (Status) || (ModeNumber == Private->GraphicsOutput->Mode->MaxMode)) {
+ //
+ // Set default mode failed or device don't support default mode, then get the current mode information
+ //
+ HorizontalResolution = Private->GraphicsOutput->Mode->Info->HorizontalResolution;
+ VerticalResolution = Private->GraphicsOutput->Mode->Info->VerticalResolution;
+ ModeNumber = Private->GraphicsOutput->Mode->Mode;
+ }
+ } else {
+ //
+ // The console is build on top of UGA Draw Protocol
+ //
+ ColorDepth = 32;
+ RefreshRate = 60;
+ Status = Private->UgaDraw->SetMode (
Private->UgaDraw,
- &HorizontalResolution,
- &VerticalResolution,
- &ColorDepth,
- &RefreshRate
+ HorizontalResolution,
+ VerticalResolution,
+ ColorDepth,
+ RefreshRate
);
if (EFI_ERROR (Status)) {
- goto Error;
+ //
+ // Get the current mode information from the UGA Draw Protocol
+ //
+ Status = Private->UgaDraw->GetMode (
+ Private->UgaDraw,
+ &HorizontalResolution,
+ &VerticalResolution,
+ &ColorDepth,
+ &RefreshRate
+ );
+ if (EFI_ERROR (Status)) {
+ goto Error;
+ }
}
}
+
//
// Compute the maximum number of text Rows and Columns that this current graphics mode can support
//
@@ -371,8 +455,9 @@ GraphicsConsoleControllerDriverStart (
// Add Mode #0 that must be 80x25
//
MaxMode = 0;
- Private->ModeData[MaxMode].UgaWidth = HorizontalResolution;
- Private->ModeData[MaxMode].UgaHeight = VerticalResolution;
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;
+ Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * GLYPH_WIDTH)) >> 1;
Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (25 * GLYPH_HEIGHT)) >> 1;
MaxMode++;
@@ -381,8 +466,9 @@ GraphicsConsoleControllerDriverStart (
// If it is possible to support Mode #1 - 80x50, than add it as an active mode
//
if (Rows >= 50) {
- Private->ModeData[MaxMode].UgaWidth = HorizontalResolution;
- Private->ModeData[MaxMode].UgaHeight = VerticalResolution;
+ Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
+ Private->ModeData[MaxMode].GopHeight = VerticalResolution;
+ Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * GLYPH_WIDTH)) >> 1;
Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * GLYPH_HEIGHT)) >> 1;
MaxMode++;
@@ -395,8 +481,9 @@ GraphicsConsoleControllerDriverStart (
if (MaxMode < 2) {
Private->ModeData[MaxMode].Columns = 0;
Private->ModeData[MaxMode].Rows = 0;
- Private->ModeData[MaxMode].UgaWidth = 800;
- Private->ModeData[MaxMode].UgaHeight = 600;
+ Private->ModeData[MaxMode].GopWidth = 800;
+ Private->ModeData[MaxMode].GopHeight = 600;
+ Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
Private->ModeData[MaxMode].DeltaX = 0;
Private->ModeData[MaxMode].DeltaY = 0;
MaxMode++;
@@ -404,8 +491,9 @@ GraphicsConsoleControllerDriverStart (
Private->ModeData[MaxMode].Columns = 800 / GLYPH_WIDTH;
Private->ModeData[MaxMode].Rows = 600 / GLYPH_HEIGHT;
- Private->ModeData[MaxMode].UgaWidth = 800;
- Private->ModeData[MaxMode].UgaHeight = 600;
+ Private->ModeData[MaxMode].GopWidth = 800;
+ Private->ModeData[MaxMode].GopHeight = 600;
+ Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
Private->ModeData[MaxMode].DeltaX = (800 % GLYPH_WIDTH) >> 1;
Private->ModeData[MaxMode].DeltaY = (600 % GLYPH_HEIGHT) >> 1;
MaxMode++;
@@ -440,14 +528,23 @@ GraphicsConsoleControllerDriverStart (
Error:
if (EFI_ERROR (Status)) {
//
- // Close the UGA IO Protocol
+ // Close the GOP or UGA IO Protocol
//
- gBS->CloseProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ if (Private->GraphicsOutput != NULL) {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiGraphicsOutputProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ } else {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUgaDrawProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ }
//
// Free private data
@@ -496,14 +593,23 @@ GraphicsConsoleControllerDriverStop (
if (!EFI_ERROR (Status)) {
//
- // Close the UGA IO Protocol
+ // Close the GOP or UGA IO Protocol
//
- gBS->CloseProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ if (Private->GraphicsOutput != NULL) {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiGraphicsOutputProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ } else {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUgaDrawProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ }
//
// Remove the font pack
@@ -640,6 +746,7 @@ GraphicsConsoleConOutOutputString (
--*/
{
GRAPHICS_CONSOLE_DEV *Private;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
INTN Mode;
UINTN MaxColumn;
@@ -649,19 +756,21 @@ GraphicsConsoleConOutOutputString (
UINTN Delta;
EFI_STATUS Status;
BOOLEAN Warning;
- EFI_UGA_PIXEL Foreground;
- EFI_UGA_PIXEL Background;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
UINTN DeltaX;
UINTN DeltaY;
UINTN Count;
UINTN Index;
INT32 OriginAttribute;
+ CHAR16 SpaceStr[] = { NARROW_CHAR, ' ', 0 };
//
// Current mode
//
Mode = This->Mode->Mode;
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ GraphicsOutput = Private->GraphicsOutput;
UgaDraw = Private->UgaDraw;
MaxColumn = Private->ModeData[Mode].Columns;
@@ -670,7 +779,7 @@ GraphicsConsoleConOutOutputString (
DeltaY = Private->ModeData[Mode].DeltaY;
Width = MaxColumn * GLYPH_WIDTH;
Height = (MaxRow - 1) * GLYPH_HEIGHT;
- Delta = Width * sizeof (EFI_UGA_PIXEL);
+ Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
//
// The Attributes won't change when during the time OutputString is called
@@ -720,38 +829,71 @@ GraphicsConsoleConOutOutputString (
// down one row.
//
if (This->Mode->CursorRow == (INT32) (MaxRow - 1)) {
- //
- // Scroll Screen Up One Row
- //
- UgaDraw->Blt (
- UgaDraw,
- NULL,
- EfiUgaVideoToVideo,
- DeltaX,
- DeltaY + GLYPH_HEIGHT,
- DeltaX,
- DeltaY,
- Width,
- Height,
- Delta
- );
+ if (GraphicsOutput != NULL) {
+ //
+ // Scroll Screen Up One Row
+ //
+ GraphicsOutput->Blt (
+ GraphicsOutput,
+ NULL,
+ EfiBltVideoToVideo,
+ DeltaX,
+ DeltaY + GLYPH_HEIGHT,
+ DeltaX,
+ DeltaY,
+ Width,
+ Height,
+ Delta
+ );
- //
- // Print Blank Line at last line
- //
- UgaDraw->Blt (
- UgaDraw,
- &Background,
- EfiUgaVideoFill,
- 0,
- 0,
- DeltaX,
- DeltaY + Height,
- Width,
- GLYPH_HEIGHT,
- Delta
- );
+ //
+ // Print Blank Line at last line
+ //
+ GraphicsOutput->Blt (
+ GraphicsOutput,
+ &Background,
+ EfiBltVideoFill,
+ 0,
+ 0,
+ DeltaX,
+ DeltaY + Height,
+ Width,
+ GLYPH_HEIGHT,
+ Delta
+ );
+ } else {
+ //
+ // Scroll Screen Up One Row
+ //
+ UgaDraw->Blt (
+ UgaDraw,
+ NULL,
+ EfiUgaVideoToVideo,
+ DeltaX,
+ DeltaY + GLYPH_HEIGHT,
+ DeltaX,
+ DeltaY,
+ Width,
+ Height,
+ Delta
+ );
+ //
+ // Print Blank Line at last line
+ //
+ UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) (UINTN) &Background,
+ EfiUgaVideoFill,
+ 0,
+ 0,
+ DeltaX,
+ DeltaY + Height,
+ Width,
+ GLYPH_HEIGHT,
+ Delta
+ );
+ }
} else {
This->Mode->CursorRow++;
}
@@ -1018,15 +1160,17 @@ GraphicsConsoleConOutSetMode (
{
EFI_STATUS Status;
GRAPHICS_CONSOLE_DEV *Private;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
- EFI_UGA_PIXEL *NewLineBuffer;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewLineBuffer;
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
UINT32 ColorDepth;
UINT32 RefreshRate;
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ GraphicsOutput = Private->GraphicsOutput;
UgaDraw = Private->UgaDraw;
ModeData = &(Private->ModeData[ModeNumber]);
@@ -1045,7 +1189,7 @@ GraphicsConsoleConOutSetMode (
//
Status = gBS->AllocatePool (
EfiBootServicesData,
- sizeof (EFI_UGA_PIXEL) * ModeData->Columns * GLYPH_WIDTH * GLYPH_HEIGHT,
+ sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->Columns * GLYPH_WIDTH * GLYPH_HEIGHT,
(VOID **) &NewLineBuffer
);
if (EFI_ERROR (Status)) {
@@ -1084,50 +1228,82 @@ GraphicsConsoleConOutSetMode (
//
Private->LineBuffer = NewLineBuffer;
- //
- // Get the current UGA Draw mode information
- //
- Status = UgaDraw->GetMode (
- UgaDraw,
- &HorizontalResolution,
- &VerticalResolution,
- &ColorDepth,
- &RefreshRate
- );
- if (EFI_ERROR (Status) || HorizontalResolution != ModeData->UgaWidth || VerticalResolution != ModeData->UgaHeight) {
- //
- // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode
- //
- Status = UgaDraw->SetMode (
- UgaDraw,
- ModeData->UgaWidth,
- ModeData->UgaHeight,
- 32,
- 60
- );
- if (EFI_ERROR (Status)) {
+ if (GraphicsOutput != NULL) {
+ if (ModeData->GopModeNumber != GraphicsOutput->Mode->Mode) {
//
- // The mode set operation failed
+ // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode
//
- return Status;
+ Status = GraphicsOutput->SetMode (GraphicsOutput, ModeData->GopModeNumber);
+ if (EFI_ERROR (Status)) {
+ //
+ // The mode set operation failed
+ //
+ return Status;
+ }
+ } else {
+ //
+ // The current graphics mode is correct, so simply clear the entire display
+ //
+ Status = GraphicsOutput->Blt (
+ GraphicsOutput,
+ &mEfiColors[0],
+ EfiBltVideoFill,
+ 0,
+ 0,
+ 0,
+ 0,
+ ModeData->GopWidth,
+ ModeData->GopHeight,
+ 0
+ );
}
} else {
//
- // The current graphics mode is correct, so simply clear the entire display
+ // Get the current UGA Draw mode information
//
- Status = UgaDraw->Blt (
+ Status = UgaDraw->GetMode (
UgaDraw,
- &mEfiColors[0],
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->UgaWidth,
- ModeData->UgaHeight,
- 0
+ &HorizontalResolution,
+ &VerticalResolution,
+ &ColorDepth,
+ &RefreshRate
);
+ if (EFI_ERROR (Status) || HorizontalResolution != ModeData->GopWidth || VerticalResolution != ModeData->GopHeight) {
+ //
+ // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode
+ //
+ Status = UgaDraw->SetMode (
+ UgaDraw,
+ ModeData->GopWidth,
+ ModeData->GopHeight,
+ 32,
+ 60
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // The mode set operation failed
+ //
+ return Status;
+ }
+ } else {
+ //
+ // The current graphics mode is correct, so simply clear the entire display
+ //
+ Status = UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) (UINTN) &mEfiColors[0],
+ EfiUgaVideoFill,
+ 0,
+ 0,
+ 0,
+ 0,
+ ModeData->GopWidth,
+ ModeData->GopHeight,
+ 0
+ );
+ }
}
+
//
// The new mode is valid, so commit the mode change
//
@@ -1223,28 +1399,44 @@ GraphicsConsoleConOutClearScreen (
EFI_STATUS Status;
GRAPHICS_CONSOLE_DEV *Private;
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_UGA_PIXEL Foreground;
- EFI_UGA_PIXEL Background;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ GraphicsOutput = Private->GraphicsOutput;
UgaDraw = Private->UgaDraw;
ModeData = &(Private->ModeData[This->Mode->Mode]);
GetTextColors (This, &Foreground, &Background);
-
- Status = UgaDraw->Blt (
- UgaDraw,
- &Background,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->UgaWidth,
- ModeData->UgaHeight,
- 0
- );
+ if (GraphicsOutput != NULL) {
+ Status = GraphicsOutput->Blt (
+ GraphicsOutput,
+ &Background,
+ EfiBltVideoFill,
+ 0,
+ 0,
+ 0,
+ 0,
+ ModeData->GopWidth,
+ ModeData->GopHeight,
+ 0
+ );
+ } else {
+ Status = UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) (UINTN) &Background,
+ EfiUgaVideoFill,
+ 0,
+ 0,
+ 0,
+ 0,
+ ModeData->GopWidth,
+ ModeData->GopHeight,
+ 0
+ );
+ }
This->Mode->CursorColumn = 0;
This->Mode->CursorRow = 0;
@@ -1353,8 +1545,8 @@ GraphicsConsoleConOutEnableCursor (
EFI_STATUS
GetTextColors (
IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- OUT EFI_UGA_PIXEL *Foreground,
- OUT EFI_UGA_PIXEL *Background
+ OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
+ OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background
)
{
INTN Attribute;
@@ -1381,9 +1573,10 @@ DrawUnicodeWeightAtCursorN (
GLYPH_UNION GlyphData;
INTN GlyphX;
INTN GlyphY;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_UGA_PIXEL Foreground;
- EFI_UGA_PIXEL Background;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
UINTN Index;
UINTN ArrayIndex;
UINTN Counts;
@@ -1473,19 +1666,35 @@ DrawUnicodeWeightAtCursorN (
//
GlyphX = This->Mode->CursorColumn * GLYPH_WIDTH;
GlyphY = This->Mode->CursorRow * GLYPH_HEIGHT;
+ GraphicsOutput = Private->GraphicsOutput;
UgaDraw = Private->UgaDraw;
- UgaDraw->Blt (
- UgaDraw,
- Private->LineBuffer,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- GlyphX + Private->ModeData[This->Mode->Mode].DeltaX,
- GlyphY + Private->ModeData[This->Mode->Mode].DeltaY,
- GLYPH_WIDTH * Count,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * Count * sizeof (EFI_UGA_PIXEL)
- );
+ if (GraphicsOutput != NULL) {
+ GraphicsOutput->Blt (
+ GraphicsOutput,
+ Private->LineBuffer,
+ EfiBltBufferToVideo,
+ 0,
+ 0,
+ GlyphX + Private->ModeData[This->Mode->Mode].DeltaX,
+ GlyphY + Private->ModeData[This->Mode->Mode].DeltaY,
+ GLYPH_WIDTH * Count,
+ GLYPH_HEIGHT,
+ GLYPH_WIDTH * Count * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ } else {
+ UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) (UINTN) Private->LineBuffer,
+ EfiUgaBltBufferToVideo,
+ 0,
+ 0,
+ GlyphX + Private->ModeData[This->Mode->Mode].DeltaX,
+ GlyphY + Private->ModeData[This->Mode->Mode].DeltaY,
+ GLYPH_WIDTH * Count,
+ GLYPH_HEIGHT,
+ GLYPH_WIDTH * Count * sizeof (EFI_UGA_PIXEL)
+ );
+ }
return ReturnStatus;
}
@@ -1499,10 +1708,11 @@ EraseCursor (
EFI_SIMPLE_TEXT_OUTPUT_MODE *CurrentMode;
INTN GlyphX;
INTN GlyphY;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_UGA_PIXEL_UNION Foreground;
- EFI_UGA_PIXEL_UNION Background;
- EFI_UGA_PIXEL_UNION BltChar[GLYPH_HEIGHT][GLYPH_WIDTH];
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Foreground;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Background;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION BltChar[GLYPH_HEIGHT][GLYPH_WIDTH];
UINTN X;
UINTN Y;
@@ -1513,6 +1723,7 @@ EraseCursor (
}
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ GraphicsOutput = Private->GraphicsOutput;
UgaDraw = Private->UgaDraw;
//
@@ -1523,18 +1734,33 @@ EraseCursor (
//
GlyphX = (CurrentMode->CursorColumn * GLYPH_WIDTH) + Private->ModeData[CurrentMode->Mode].DeltaX;
GlyphY = (CurrentMode->CursorRow * GLYPH_HEIGHT) + Private->ModeData[CurrentMode->Mode].DeltaY;
- UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) BltChar,
- EfiUgaVideoToBltBuffer,
- GlyphX,
- GlyphY,
- 0,
- 0,
- GLYPH_WIDTH,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
- );
+ if (GraphicsOutput != NULL) {
+ GraphicsOutput->Blt (
+ GraphicsOutput,
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltChar,
+ EfiBltVideoToBltBuffer,
+ GlyphX,
+ GlyphY,
+ 0,
+ 0,
+ GLYPH_WIDTH,
+ GLYPH_HEIGHT,
+ GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ } else {
+ UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) (UINTN) BltChar,
+ EfiUgaVideoToBltBuffer,
+ GlyphX,
+ GlyphY,
+ 0,
+ 0,
+ GLYPH_WIDTH,
+ GLYPH_HEIGHT,
+ GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
+ );
+ }
GetTextColors (This, &Foreground.Pixel, &Background.Pixel);
@@ -1549,18 +1775,33 @@ EraseCursor (
}
}
- UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) BltChar,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- GlyphX,
- GlyphY,
- GLYPH_WIDTH,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
- );
+ if (GraphicsOutput != NULL) {
+ GraphicsOutput->Blt (
+ GraphicsOutput,
+ (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltChar,
+ EfiBltBufferToVideo,
+ 0,
+ 0,
+ GlyphX,
+ GlyphY,
+ GLYPH_WIDTH,
+ GLYPH_HEIGHT,
+ GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ } else {
+ UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) (UINTN) BltChar,
+ EfiUgaBltBufferToVideo,
+ 0,
+ 0,
+ GlyphX,
+ GlyphY,
+ GLYPH_WIDTH,
+ GLYPH_HEIGHT,
+ GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
+ );
+ }
return EFI_SUCCESS;
}
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h
index cfbbbb2fa2..45a2ec4764 100644
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h
+++ b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h
@@ -50,19 +50,21 @@ typedef struct {
UINTN Rows;
INTN DeltaX;
INTN DeltaY;
- UINT32 UgaWidth;
- UINT32 UgaHeight;
+ UINT32 GopWidth;
+ UINT32 GopHeight;
+ UINT32 GopModeNumber;
} GRAPHICS_CONSOLE_MODE_DATA;
#define GRAPHICS_MAX_MODE 3
typedef struct {
UINTN Signature;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_SIMPLE_TEXT_OUT_PROTOCOL SimpleTextOutput;
EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];
- EFI_UGA_PIXEL *LineBuffer;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
EFI_HII_HANDLE HiiHandle;
} GRAPHICS_CONSOLE_DEV;
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa
index 39bf64a76b..3e9af8001b 100644
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa
+++ b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa
@@ -65,6 +65,9 @@
<ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="TO_START">
+ <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="TO_START">
<ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="BY_START">
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c
index 52dc12e877..d7daa64902 100644
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c
+++ b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c
@@ -233,14 +233,14 @@ Returns:
EFI_STATUS
EFIAPI
HiiGlyphToBlt (
- IN EFI_HII_PROTOCOL *This,
- IN UINT8 *GlyphBuffer,
- IN EFI_UGA_PIXEL Foreground,
- IN EFI_UGA_PIXEL Background,
- IN UINTN Count,
- IN UINTN Width,
- IN UINTN Height,
- IN OUT EFI_UGA_PIXEL *BltBuffer
+ IN EFI_HII_PROTOCOL *This,
+ IN UINT8 *GlyphBuffer,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
+ IN UINTN Count,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
)
{
UINTN X;
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h
index c50cd958a0..9283ef0a48 100644
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h
+++ b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h
@@ -165,14 +165,14 @@ HiiGetGlyph (
EFI_STATUS
EFIAPI
HiiGlyphToBlt (
- IN EFI_HII_PROTOCOL *This,
- IN UINT8 *GlyphBuffer,
- IN EFI_UGA_PIXEL Foreground,
- IN EFI_UGA_PIXEL Background,
- IN UINTN Count,
- IN UINTN Width,
- IN UINTN Height,
- IN OUT EFI_UGA_PIXEL *BltBuffer
+ IN EFI_HII_PROTOCOL *This,
+ IN UINT8 *GlyphBuffer,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
+ IN UINTN Count,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
)
;
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h b/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
index f3679fb88d..9f5d3fa47e 100644
--- a/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
+++ b/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
@@ -89,12 +89,12 @@ BdsMemoryTest (
EFI_STATUS
PlatformBdsShowProgress (
- EFI_UGA_PIXEL TitleForeground,
- EFI_UGA_PIXEL TitleBackground,
- CHAR16 *Title,
- EFI_UGA_PIXEL ProgressColor,
- UINTN Progress,
- UINTN PreviousValue
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
+ CHAR16 *Title,
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
+ UINTN Progress,
+ UINTN PreviousValue
)
;
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
index 45992db02d..a31e8a9570 100644
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
+++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
@@ -74,13 +74,13 @@ Returns:
EFI_STATUS Status;
UINTN Index;
CHAR16 *TmpStr;
- EFI_UGA_PIXEL Foreground;
- EFI_UGA_PIXEL Background;
- EFI_UGA_PIXEL Color;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- SetMem (&Foreground, sizeof (EFI_UGA_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_UGA_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_UGA_PIXEL), 0xff);
+ SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
+ SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
+ SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
Count = 0;
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c
index f1fedf391a..af6c1ab217 100644
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c
+++ b/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c
@@ -28,10 +28,10 @@ Abstract:
//
EFI_STATUS
PlatformBdsShowProgress (
- IN EFI_UGA_PIXEL TitleForeground,
- IN EFI_UGA_PIXEL TitleBackground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
IN CHAR16 *Title,
- IN EFI_UGA_PIXEL ProgressColor,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
IN UINTN Progress,
IN UINTN PreviousValue
)
@@ -56,12 +56,13 @@ Returns:
--*/
{
EFI_STATUS Status;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
UINT32 SizeOfX;
UINT32 SizeOfY;
UINT32 ColorDepth;
UINT32 RefreshRate;
- EFI_UGA_PIXEL Color;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
UINTN BlockHeight;
UINTN BlockWidth;
UINTN BlockNum;
@@ -73,24 +74,39 @@ Returns:
return EFI_INVALID_PARAMETER;
}
+ UgaDraw = NULL;
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
- &gEfiUgaDrawProtocolGuid,
- &UgaDraw
+ &gEfiGraphicsOutputProtocolGuid,
+ &GraphicsOutput
);
if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
+ GraphicsOutput = NULL;
+
+ Status = gBS->HandleProtocol (
+ gST->ConsoleOutHandle,
+ &gEfiUgaDrawProtocolGuid,
+ &UgaDraw
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
}
- Status = UgaDraw->GetMode (
- UgaDraw,
- &SizeOfX,
- &SizeOfY,
- &ColorDepth,
- &RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
+ if (GraphicsOutput != NULL) {
+ SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
+ SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
+ } else {
+ Status = UgaDraw->GetMode (
+ UgaDraw,
+ &SizeOfX,
+ &SizeOfY,
+ &ColorDepth,
+ &RefreshRate
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
}
BlockWidth = SizeOfX / 100;
@@ -105,38 +121,68 @@ Returns:
//
// Clear progress area
//
- SetMem (&Color, sizeof (EFI_UGA_PIXEL), 0x0);
-
- Status = UgaDraw->Blt (
- UgaDraw,
- &Color,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- PosY - GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_UGA_PIXEL)
- );
+ SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
+
+ if (GraphicsOutput != NULL) {
+ Status = GraphicsOutput->Blt (
+ GraphicsOutput,
+ &Color,
+ EfiBltVideoFill,
+ 0,
+ 0,
+ 0,
+ PosY - GLYPH_HEIGHT - 1,
+ SizeOfX,
+ SizeOfY - (PosY - GLYPH_HEIGHT - 1),
+ SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ } else {
+ Status = UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) &Color,
+ EfiUgaVideoFill,
+ 0,
+ 0,
+ 0,
+ PosY - GLYPH_HEIGHT - 1,
+ SizeOfX,
+ SizeOfY - (PosY - GLYPH_HEIGHT - 1),
+ SizeOfX * sizeof (EFI_UGA_PIXEL)
+ );
+ }
}
//
// Show progress by drawing blocks
//
for (Index = PreviousValue; Index < BlockNum; Index++) {
PosX = Index * BlockWidth;
- Status = UgaDraw->Blt (
- UgaDraw,
- &ProgressColor,
- EfiUgaVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_UGA_PIXEL)
- );
+ if (GraphicsOutput != NULL) {
+ Status = GraphicsOutput->Blt (
+ GraphicsOutput,
+ &ProgressColor,
+ EfiBltVideoFill,
+ 0,
+ 0,
+ PosX,
+ PosY,
+ BlockWidth - 1,
+ BlockHeight,
+ (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ );
+ } else {
+ Status = UgaDraw->Blt (
+ UgaDraw,
+ (EFI_UGA_PIXEL *) &ProgressColor,
+ EfiUgaVideoFill,
+ 0,
+ 0,
+ PosX,
+ PosY,
+ BlockWidth - 1,
+ BlockHeight,
+ (BlockWidth) * sizeof (EFI_UGA_PIXEL)
+ );
+ }
}
PrintXY (
@@ -189,9 +235,9 @@ Returns:
CHAR16 *StrTotalMemory;
CHAR16 *Pos;
CHAR16 *TmpStr;
- EFI_UGA_PIXEL Foreground;
- EFI_UGA_PIXEL Background;
- EFI_UGA_PIXEL Color;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
UINT8 Value;
UINTN DataSize;
UINT32 Attributes;
@@ -213,9 +259,9 @@ Returns:
ErrorOut = FALSE;
TestAbort = FALSE;
- SetMem (&Foreground, sizeof (EFI_UGA_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_UGA_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_UGA_PIXEL), 0xff);
+ SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
+ SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
+ SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
RequireSoftECCInit = FALSE;
diff --git a/EdkNt32Pkg/Include/Protocol/WinNtIo.h b/EdkNt32Pkg/Include/Protocol/WinNtIo.h
index 85d99feac9..f019ce1e34 100644
--- a/EdkNt32Pkg/Include/Protocol/WinNtIo.h
+++ b/EdkNt32Pkg/Include/Protocol/WinNtIo.h
@@ -59,6 +59,16 @@ extern EFI_GUID gEfiWinNtVirtualDisksGuid;
extern EFI_GUID gEfiWinNtPhysicalDisksGuid;
//
+// EFI_WIN_NT_GOP_GUID
+//
+#define EFI_WIN_NT_GOP_GUID \
+ { \
+ 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
+ }
+
+extern EFI_GUID gEfiWinNtFileSystemGuid;
+
+//
// EFI_WIN_NT_FILE_SYSTEM
//
#define EFI_WIN_NT_FILE_SYSTEM_GUID \
@@ -66,7 +76,7 @@ extern EFI_GUID gEfiWinNtPhysicalDisksGuid;
0xc95a935, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
-extern EFI_GUID gEfiWinNtFileSystemGuid;
+extern EFI_GUID mEfiWinNtGopGuid;
//
// EFI_WIN_NT_SERIAL_PORT
diff --git a/MdePkg/Include/Protocol/Hii.h b/MdePkg/Include/Protocol/Hii.h
index 04e74a019e..1de8dc3450 100644
--- a/MdePkg/Include/Protocol/Hii.h
+++ b/MdePkg/Include/Protocol/Hii.h
@@ -22,6 +22,7 @@
#ifndef __HII_H__
#define __HII_H__
+#include "GraphicsOutput.h"
#define EFI_HII_PROTOCOL_GUID \
{ \
@@ -597,14 +598,14 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GLYPH_TO_BLT) (
- IN EFI_HII_PROTOCOL *This,
- IN UINT8 *GlyphBuffer,
- IN EFI_UGA_PIXEL Foreground,
- IN EFI_UGA_PIXEL Background,
- IN UINTN Count,
- IN UINTN Width,
- IN UINTN Height,
- IN OUT EFI_UGA_PIXEL *BltBuffer
+ IN EFI_HII_PROTOCOL *This,
+ IN UINT8 *GlyphBuffer,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
+ IN UINTN Count,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
);
/**