Merge GOP related code from r8->r9.
authorwuyizhong <wuyizhong@de2fecce-e211-0410-80a6-f3fac2684e05>
Tue, 12 Dec 2006 07:09:03 +0000 (07:09 +0000)
committerwuyizhong <wuyizhong@de2fecce-e211-0410-80a6-f3fac2684e05>
Tue, 12 Dec 2006 07:09:03 +0000 (07:09 +0000)
git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@2085 de2fecce-e211-0410-80a6-f3fac2684e05

19 files changed:
edk2/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
edk2/EdkModulePkg/Include/Library/EdkGraphicsLib.h
edk2/EdkModulePkg/Include/Protocol/UgaSplash.h
edk2/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa
edk2/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
edk2/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c
edk2/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h
edk2/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa
edk2/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c
edk2/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
edk2/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h
edk2/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa
edk2/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c
edk2/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h
edk2/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
edk2/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
edk2/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c
edk2/EdkNt32Pkg/Include/Protocol/WinNtIo.h
edk2/MdePkg/Include/Protocol/Hii.h

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