]> git.proxmox.com Git - mirror_edk2.git/commitdiff
add PCD PcdUgaConsumeSupport to switch on/off EFI UGA Draw Protocol's consuming,...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 19 Mar 2008 05:22:06 +0000 (05:22 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 19 Mar 2008 05:22:06 +0000 (05:22 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4911 6f19259b-4bc3-4df7-8a09-765794883524

13 files changed:
IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c
IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf
MdeModulePkg/Library/GraphicsLib/Graphics.c
MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf
MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
MdeModulePkg/Universal/BdsDxe/MemoryTest.c
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf

index 5ab779a6a3295d5e1f20a9202bddc6ef6d7f8fba..283d9be358da6ce386b9b2eba41dde0fa77183c2 100644 (file)
@@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
 \r
 EFI_STATUS\r
 GetGraphicsBitMapFromFV (\r
@@ -390,15 +391,15 @@ Returns:
   // Try to open GOP first\r
   //\r
   Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR(Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\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
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
   }\r
 \r
   Badging = NULL;\r
@@ -409,7 +410,7 @@ Returns:
   if (GraphicsOutput != NULL) {\r
     SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;\r
     SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);\r
     if (EFI_ERROR (Status)) {\r
       return EFI_UNSUPPORTED;\r
@@ -539,7 +540,7 @@ Returns:
                             Height,\r
                             Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
                             );\r
-      } else {\r
+      } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
         Status = UgaDraw->Blt (\r
                             UgaDraw,\r
                             (EFI_UGA_PIXEL *) Blt,\r
@@ -552,6 +553,8 @@ Returns:
                             Height,\r
                             Width * sizeof (EFI_UGA_PIXEL)\r
                             );\r
+      } else {\r
+        Status = EFI_UNSUPPORTED;\r
       }\r
     }\r
 \r
@@ -696,7 +699,7 @@ Returns:
   if (GraphicsOutput != NULL) {\r
     HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;\r
     VerticalResolution   = GraphicsOutput->Mode->Info->VerticalResolution;\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport))  {\r
     //\r
     // Get the current mode information from the UGA Draw Protocol\r
     //\r
@@ -784,7 +787,7 @@ Returns:
                         GLYPH_HEIGHT,\r
                         BufferGlyphWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
                         );\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     Status = UgaDraw->Blt (\r
                         UgaDraw,\r
                         (EFI_UGA_PIXEL *) (UINTN) LineBuffer,\r
@@ -797,6 +800,8 @@ Returns:
                         GLYPH_HEIGHT,\r
                         BufferGlyphWidth * sizeof (EFI_UGA_PIXEL)\r
                         );\r
+  } else {\r
+    Status = EFI_UNSUPPORTED;\r
   }\r
 \r
 Error:\r
@@ -861,7 +866,7 @@ Returns:
                   (VOID **) &GraphicsOutput\r
                   );\r
 \r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     GraphicsOutput = NULL;\r
 \r
     Status = gBS->HandleProtocol (\r
@@ -869,10 +874,10 @@ Returns:
                     &gEfiUgaDrawProtocolGuid,\r
                     (VOID **) &UgaDraw\r
                     );\r
+  }\r
 \r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
   }\r
 \r
   Status = gBS->HandleProtocol (\r
index a25ed94bf8bf7b151778350a96cb33b6db223de4..39eee4b711eee9080ae630012929fcd5e94dd87c 100644 (file)
@@ -56,3 +56,5 @@
   gEfiFirmwareVolume2ProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
   gEfiOEMBadgingProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
 \r
+[FeaturePcd.common]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport\r
index e86b493db1f9462ef2ecd7a77abe50b777cdb902..e944217028dda72f8f6307c27450f8c3fd8256ce 100644 (file)
@@ -38,6 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DxePiLib.h>\r
+#include <Library/PcdLib.h>\r
 \r
 STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {\r
   { 0x00, 0x00, 0x00, 0x00 },\r
@@ -113,19 +114,19 @@ Arguments:
 \r
   ImageHandle   - The driver image handle of the caller. The parameter is used to\r
                   optimize the loading of the image file so that the FV from which\r
-                  the driver image is loaded will be tried first. \r
+                  the driver image is loaded will be tried first.\r
 \r
   FileNameGuid  - File Name of graphics file in the FV(s).\r
 \r
-  Image         - Pointer to pointer to return graphics image.  If NULL, a \r
+  Image         - Pointer to pointer to return graphics image.  If NULL, a\r
                   buffer will be allocated.\r
 \r
   ImageSize     - Size of the graphics Image in bytes. Zero if no image found.\r
 \r
 \r
-Returns: \r
+Returns:\r
 \r
-  EFI_SUCCESS          - Image and ImageSize are valid. \r
+  EFI_SUCCESS          - Image and ImageSize are valid.\r
   EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size\r
   EFI_NOT_FOUND        - FileNameGuid not found\r
 \r
@@ -370,7 +371,7 @@ Arguments:
   LogoFile - File name of logo to display on the center of the screen.\r
 \r
 \r
-Returns: \r
+Returns:\r
 \r
   EFI_SUCCESS           - ConsoleControl has been flipped to graphics and logo\r
                           displayed.\r
@@ -401,7 +402,7 @@ Arguments:
                 the driver image is loaded will be tried first.\r
 \r
 \r
-Returns: \r
+Returns:\r
 \r
   EFI_SUCCESS           - ConsoleControl has been flipped to graphics and logo\r
                           displayed.\r
@@ -442,15 +443,15 @@ Returns:
   // Try to open GOP first\r
   //\r
   Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID**)&GraphicsOutput);\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     GraphicsOutput = NULL;\r
     //\r
-    // Open GOP failed, try to open UGA\r
+    // Open GOP failed, try to open UGwhA\r
     //\r
     Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID**)&UgaDraw);\r
-    if (EFI_ERROR (Status)) {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
+  }\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
   }\r
 \r
   Badging = NULL;\r
@@ -464,7 +465,7 @@ Returns:
   if (GraphicsOutput != NULL) {\r
     SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;\r
     SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);\r
     if (EFI_ERROR (Status)) {\r
       return EFI_UNSUPPORTED;\r
@@ -593,7 +594,7 @@ Returns:
                             Height,\r
                             Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
                             );\r
-      } else {\r
+      } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
         Status = UgaDraw->Blt (\r
                             UgaDraw,\r
                             (EFI_UGA_PIXEL *) Blt,\r
@@ -658,7 +659,7 @@ UINTN
 _IPrint (\r
   IN EFI_GRAPHICS_OUTPUT_PROTOCOL     *GraphicsOutput,\r
   IN EFI_UGA_DRAW_PROTOCOL            *UgaDraw,\r
-  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL     *Sto,\r
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *Sto,\r
   IN UINTN                            X,\r
   IN UINTN                            Y,\r
   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *Foreground,\r
@@ -677,22 +678,22 @@ Arguments:
   GraphicsOutput  - Graphics output protocol interface\r
 \r
   UgaDraw         - UGA draw protocol interface\r
-  \r
+\r
   Sto             - Simple text out protocol interface\r
-  \r
+\r
   X               - X coordinate to start printing\r
-  \r
+\r
   Y               - Y coordinate to start printing\r
-  \r
+\r
   Foreground      - Foreground color\r
-  \r
+\r
   Background      - Background color\r
-  \r
+\r
   fmt             - Format string\r
-  \r
+\r
   args            - Print arguments\r
 \r
-Returns: \r
+Returns:\r
 \r
   EFI_SUCCESS             -  success\r
   EFI_OUT_OF_RESOURCES    -  out of resources\r
@@ -711,7 +712,7 @@ Returns:
   UINTN                          LineBufferLen;\r
   EFI_HII_FONT_PROTOCOL          *HiiFont;\r
   EFI_IMAGE_OUTPUT               *Blt;\r
-  EFI_FONT_DISPLAY_INFO          *FontInfo;  \r
+  EFI_FONT_DISPLAY_INFO          *FontInfo;\r
 \r
   //\r
   // For now, allocate an arbitrarily long buffer\r
@@ -721,24 +722,31 @@ Returns:
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
+  HorizontalResolution  = 0;\r
+  VerticalResolution    = 0;\r
+  Blt                   = NULL;\r
+  FontInfo              = NULL;\r
+\r
   if (GraphicsOutput != NULL) {\r
     HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;\r
     VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);\r
+  } else {\r
+    Status = EFI_UNSUPPORTED;\r
+    goto Error;\r
   }\r
-  ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0)); \r
 \r
-  Blt      = NULL;\r
-  FontInfo = NULL;\r
+  ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));\r
+\r
   ASSERT (GraphicsOutput != NULL);\r
   Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);\r
   if (EFI_ERROR (Status)) {\r
     goto Error;\r
-  }  \r
+  }\r
 \r
   UnicodeVSPrint (Buffer, 0x10000, fmt, args);\r
-  \r
+\r
   UnicodeWeight = (CHAR16 *) Buffer;\r
 \r
   for (Index = 0; UnicodeWeight[Index] != 0; Index++) {\r
@@ -750,7 +758,7 @@ Returns:
   }\r
 \r
   BufferLen = StrLen (Buffer);\r
\r
+\r
 \r
   LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;\r
   if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {\r
@@ -767,7 +775,7 @@ Returns:
   Blt->Width        = (UINT16) (HorizontalResolution);\r
   Blt->Height       = (UINT16) (VerticalResolution);\r
   Blt->Image.Screen = GraphicsOutput;\r
-   \r
+\r
   FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));\r
   if (FontInfo == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
@@ -777,8 +785,8 @@ Returns:
     CopyMem (&FontInfo->ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
   } else {\r
     CopyMem (\r
-      &FontInfo->ForegroundColor, \r
-      &mEfiColors[Sto->Mode->Attribute & 0x0f], \r
+      &FontInfo->ForegroundColor,\r
+      &mEfiColors[Sto->Mode->Attribute & 0x0f],\r
       sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
       );\r
   }\r
@@ -786,8 +794,8 @@ Returns:
     CopyMem (&FontInfo->BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
   } else {\r
     CopyMem (\r
-      &FontInfo->BackgroundColor, \r
-      &mEfiColors[Sto->Mode->Attribute >> 4], \r
+      &FontInfo->BackgroundColor,\r
+      &mEfiColors[Sto->Mode->Attribute >> 4],\r
       sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
       );\r
   }\r
@@ -804,7 +812,7 @@ Returns:
                        NULL,\r
                        NULL\r
                        );\r
-  \r
+\r
 \r
 Error:\r
   SafeFreePool (Blt);\r
@@ -831,11 +839,11 @@ Routine Description:
 Arguments:\r
 \r
     X           - X coordinate to start printing\r
-    \r
+\r
     Y           - Y coordinate to start printing\r
-    \r
+\r
     ForeGround  - Foreground color\r
-    \r
+\r
     BackGround  - Background color\r
 \r
     Fmt         - Format string\r
@@ -866,7 +874,7 @@ Returns:
                   );\r
 \r
   UgaDraw = NULL;\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     GraphicsOutput = NULL;\r
 \r
     Status = gBS->HandleProtocol (\r
@@ -874,10 +882,9 @@ Returns:
                     &gEfiUgaDrawProtocolGuid,\r
                     (VOID**)&UgaDraw\r
                     );\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
+  }\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
   }\r
 \r
   Status = gBS->HandleProtocol (\r
index c7cb0afb72f7a4d23c7bb95e457a9aa20a76b6dc..57722d896284b2db176cfff0577cebedb2ae004f 100644 (file)
@@ -52,6 +52,9 @@
   gEfiGraphicsOutputProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
   gEfiUgaDrawProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
   gEfiConsoleControlProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiFirmwareVolume2ProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiFirmwareVolume2ProtocolGuid               # PROTOCOL ALWAYS_CONSUMED\r
   gEfiOEMBadgingProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiHiiFontProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED   
\ No newline at end of file
+  gEfiHiiFontProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
+\r
+[FeaturePcd.common]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
\ No newline at end of file
index 22ce7d5ecad60f5ee807a546d92dfc76f3b134ee..33866c4a9ef750eabc3555418b2bd577f5e8162b 100644 (file)
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE|BOOLEAN|0x00010042\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|TRUE|BOOLEAN|0x00010043\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|TRUE|BOOLEAN|0x00010044\r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010044\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010045\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00010046\r
 \r
 [PcdsFixedAtBuild.common]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry|0x08|UINT32|0x0001000f\r
index 9b25c024476fd0a71183d71780a70e9b36a962f0..42f1e1c2be6c7895586000be73f03cd209e064be 100644 (file)
@@ -4,12 +4,12 @@
 # N/A\r
 # Copyright (c) 2008, Intel Corporation\r
 #\r
-#  All rights reserved. This program and the accompanying materials       \r
-#  are licensed and made available under the terms and conditions of the BSD License   \r
-#  which accompanies this distribution. The full text of the license may be found at  \r
-#  http://opensource.org/licenses/bsd-license.php           \r
-#  \r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,      \r
+#  All rights reserved. This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 #\r
 #\r
   gEfiMemorySubClassGuid\r
   gEfiProcessorSubClassGuid\r
   gEfiCapsuleVendorGuid\r
-  \r
+\r
 [Protocols]\r
   gEfiHiiStringProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED\r
   gEfiSimpleFileSystemProtocolGuid              # PROTOCOL ALWAYS_CONSUMED\r
   gEfiSerialIoProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
   gEfiAcpiS3SaveProtocolGuid\r
-  \r
+\r
 [FeaturePcd.common]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDepricate\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport\r
 \r
 [Pcd.common]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes\r
index 51b49abc4accfdec0d01adce5f63568cbf7003b5..002b8302c3067439c6f7c271b902ef2c16bce500 100644 (file)
@@ -79,7 +79,7 @@ Returns:
                   &gEfiGraphicsOutputProtocolGuid,\r
                   (VOID **) &GraphicsOutput\r
                   );\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     GraphicsOutput = NULL;\r
 \r
     Status = gBS->HandleProtocol (\r
@@ -87,15 +87,17 @@ Returns:
                     &gEfiUgaDrawProtocolGuid,\r
                     (VOID **) &UgaDraw\r
                     );\r
-    if (EFI_ERROR (Status)) {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
+  }\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
   }\r
 \r
+  SizeOfX = 0;\r
+  SizeOfY = 0;\r
   if (GraphicsOutput != NULL) {\r
     SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;\r
     SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     Status = UgaDraw->GetMode (\r
                         UgaDraw,\r
                         &SizeOfX,\r
@@ -106,6 +108,8 @@ Returns:
     if (EFI_ERROR (Status)) {\r
       return EFI_UNSUPPORTED;\r
     }\r
+  } else {\r
+    return EFI_UNSUPPORTED;\r
   }\r
 \r
   BlockWidth  = SizeOfX / 100;\r
@@ -135,7 +139,7 @@ Returns:
                           SizeOfY - (PosY - GLYPH_HEIGHT - 1),\r
                           SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
                           );\r
-    } else {\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       Status = UgaDraw->Blt (\r
                           UgaDraw,\r
                           (EFI_UGA_PIXEL *) &Color,\r
@@ -168,7 +172,7 @@ Returns:
                           BlockHeight,\r
                           (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
                           );\r
-    } else {\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       Status = UgaDraw->Blt (\r
                           UgaDraw,\r
                           (EFI_UGA_PIXEL *) &ProgressColor,\r
index 5053251e333cdb5a13d24d50731ef94835db22ad..00c809b6aae4d1cc9afef026ec8bd8f2328469be 100644 (file)
@@ -686,7 +686,7 @@ ConSplitterTextOutConstructor (
   //\r
   // When new console device is added, the new mode will be set later,\r
   // so put current mode back to init state.\r
-  //  \r
+  //\r
   ConOutPrivate->TextOutMode.Mode = 0xFF;\r
 \r
   Status = ConSplitterGrowBuffer (\r
@@ -1236,6 +1236,9 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
+  GraphicsOutput = NULL;\r
+  UgaDraw        = NULL;\r
   //\r
   // Try to Open Graphics Output protocol\r
   //\r
@@ -1247,22 +1250,19 @@ Returns:
                   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
-                  ControllerHandle,\r
-                  &gEfiUgaDrawProtocolGuid,\r
-                  (VOID **) &UgaDraw,\r
-                  This->DriverBindingHandle,\r
-                  mConOut.VirtualHandle,\r
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    UgaDraw = NULL;\r
+\r
+  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+    //\r
+    // Open UGA_DRAW protocol\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
   //\r
@@ -1270,7 +1270,7 @@ Returns:
   // so put current mode back to init state.\r
   //\r
   mConOut.TextOutMode.Mode = 0xFF;\r
-  \r
+\r
   //\r
   // If both ConOut and StdErr incorporate the same Text Out device,\r
   // their MaxMode and QueryData should be the intersection of both.\r
@@ -1278,7 +1278,7 @@ Returns:
   Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw);\r
   ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
 \r
-  if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
+  if (FeaturePcdGet (PcdConOutUgaSupport) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     //\r
     // Match the UGA mode data of ConOut with the current mode\r
     //\r
@@ -1332,13 +1332,13 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // When new console device is added, the new mode will be set later,\r
   // so put current mode back to init state.\r
   //\r
   mStdErr.TextOutMode.Mode = 0xFF;\r
-  \r
+\r
   //\r
   // If both ConOut and StdErr incorporate the same Text Out device,\r
   // their MaxMode and QueryData should be the intersection of both.\r
@@ -2711,7 +2711,7 @@ Returns:
       }\r
     }\r
   }\r
-  if (UgaDraw != NULL) {\r
+  if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     //\r
     // Graphics console driver can ensure the same mode for all GOP devices\r
     // so we can get the current mode from this video device\r
@@ -2751,7 +2751,7 @@ Done:
   if (GraphicsOutput != NULL) {\r
     Private->CurrentNumberOfGraphicsOutput++;\r
   }\r
-  if (UgaDraw != NULL) {\r
+  if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     Private->CurrentNumberOfUgaDraw++;\r
   }\r
 \r
@@ -2801,7 +2801,7 @@ Returns:
 \r
   None\r
 \r
---*/  \r
+--*/\r
 {\r
   UINTN                         Col;\r
   UINTN                         Row;\r
@@ -2813,7 +2813,7 @@ Returns:
   EFI_STATUS                    Status;\r
   CONSOLE_OUT_MODE              *ModeInfo;\r
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *TextOut;\r
-  \r
+\r
   PreferMode   = 0xFF;\r
   BaseMode     = 0xFF;\r
   TextOut      = &Private->TextOut;\r
@@ -2832,9 +2832,9 @@ Returns:
                    );\r
 \r
   //\r
-  // Set to the default mode 80 x 25 required by EFI/UEFI spec; \r
+  // Set to the default mode 80 x 25 required by EFI/UEFI spec;\r
   // user can also define other valid default console mode here.\r
-  //            \r
+  //\r
   if (EFI_ERROR(Status)) {\r
     ModeInfo->Column = 80;\r
     ModeInfo->Row    = 25;\r
@@ -2844,9 +2844,9 @@ Returns:
                     EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
                     sizeof (CONSOLE_OUT_MODE),\r
                     ModeInfo\r
-                    );    \r
+                    );\r
   }\r
-  \r
+\r
   for (Mode = 0; Mode < MaxMode; Mode++) {\r
     Status = TextOut->QueryMode (TextOut, Mode, &Col, &Row);\r
     if (!EFI_ERROR(Status)) {\r
@@ -2858,19 +2858,19 @@ Returns:
       }\r
     }\r
   }\r
-  \r
+\r
   Status = TextOut->SetMode (TextOut, PreferMode);\r
-  \r
+\r
   //\r
   // if current mode setting is failed, default 80x25 mode will be set.\r
   //\r
   if (EFI_ERROR(Status)) {\r
     Status = TextOut->SetMode (TextOut, BaseMode);\r
     ASSERT(!EFI_ERROR(Status));\r
-    \r
+\r
     ModeInfo->Column = 80;\r
     ModeInfo->Row    = 25;\r
-    \r
+\r
     //\r
     // Update ConOutMode variable\r
     //\r
@@ -2880,7 +2880,7 @@ Returns:
                     EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
                     sizeof (CONSOLE_OUT_MODE),\r
                     ModeInfo\r
-                    );     \r
+                    );\r
   }\r
 \r
   gBS->FreePool (ModeInfo);\r
@@ -2989,7 +2989,7 @@ Returns:
     }\r
   }\r
   if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
-    if (UgaDraw != NULL) {\r
+    if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       Status = UgaDraw->GetMode (\r
                     UgaDraw,\r
                     &UgaHorizontalResolution,\r
@@ -3043,7 +3043,7 @@ Returns:
   }\r
 \r
   //\r
-  // After adding new console device, all existing console devices should be \r
+  // After adding new console device, all existing console devices should be\r
   // synced to the current shared mode.\r
   //\r
   ConsplitterSetConsoleOutMode (Private);\r
@@ -3084,7 +3084,7 @@ Returns:
     if (TextOutList->TextOut == TextOut) {\r
       CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index);\r
       CurrentNumOfConsoles--;\r
-      if (TextOutList->UgaDraw != NULL) {\r
+      if (TextOutList->UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
         Private->CurrentNumberOfUgaDraw--;\r
       }\r
       if (TextOutList->GraphicsOutput != NULL) {\r
index 3f627b8fb432ef682421c8b8f654d3c89baac945..213f2bd1a86da47d6ad5463b4e660a002116c29d 100644 (file)
@@ -84,3 +84,4 @@
 [FeaturePcd.common]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport\r
index 77c076fc8528329c08f13779ad61c9f76ccbda16..20f27a20fbd21f61b4f4d0c11bce32b6abee67c2 100644 (file)
@@ -311,7 +311,7 @@ Routine Description:
       }\r
     }\r
 \r
-    if (EFI_ERROR (ReturnStatus)) {\r
+    if (EFI_ERROR (ReturnStatus) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       UgaDraw = Private->TextOutList[Index].UgaDraw;\r
       if (UgaDraw != NULL) {\r
         Status = UgaDraw->SetMode (\r
@@ -581,7 +581,7 @@ ConSpliterGraphicsOutputBlt (
     }\r
 \r
     UgaDraw = Private->TextOutList[Index].UgaDraw;\r
-    if (UgaDraw != NULL) {\r
+    if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       Status = UgaDraw->Blt (\r
                               UgaDraw,\r
                               (EFI_UGA_PIXEL *) BltBuffer,\r
@@ -628,7 +628,7 @@ DevNullGopSync (
                       Private->GraphicsOutput.Mode->Info->VerticalResolution,\r
                       0\r
                       );\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     return UgaDraw->Blt (\r
                       UgaDraw,\r
                       (EFI_UGA_PIXEL *) Private->GraphicsOutputBlt,\r
@@ -641,6 +641,8 @@ DevNullGopSync (
                       Private->GraphicsOutput.Mode->Info->VerticalResolution,\r
                       0\r
                       );\r
+  } else {\r
+    return EFI_UNSUPPORTED;\r
   }\r
 }\r
 \r
@@ -767,17 +769,22 @@ ConSpliterUgaDrawSetMode (
   // return the worst status met\r
   //\r
   for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r
-    UgaDraw = Private->TextOutList[Index].UgaDraw;\r
-    if (UgaDraw != NULL) {\r
-      Status = UgaDraw->SetMode (\r
-                          UgaDraw,\r
-                          HorizontalResolution,\r
-                          VerticalResolution,\r
-                          ColorDepth,\r
-                          RefreshRate\r
-                          );\r
-      if (EFI_ERROR (Status)) {\r
-        ReturnStatus = Status;\r
+\r
+    ReturnStatus = EFI_UNSUPPORTED;\r
+\r
+    if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+      UgaDraw = Private->TextOutList[Index].UgaDraw;\r
+      if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+        Status = UgaDraw->SetMode (\r
+                            UgaDraw,\r
+                            HorizontalResolution,\r
+                            VerticalResolution,\r
+                            ColorDepth,\r
+                            RefreshRate\r
+                            );\r
+        if (EFI_ERROR (Status)) {\r
+          ReturnStatus = Status;\r
+        }\r
       }\r
     }\r
 \r
@@ -1043,7 +1050,7 @@ ConSpliterUgaDrawBlt (
       }\r
     }\r
 \r
-    if (Private->TextOutList[Index].UgaDraw != NULL) {\r
+    if (Private->TextOutList[Index].UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       Status = Private->TextOutList[Index].UgaDraw->Blt (\r
                                                       Private->TextOutList[Index].UgaDraw,\r
                                                       BltBuffer,\r
@@ -1077,7 +1084,7 @@ DevNullUgaSync (
   IN  EFI_UGA_DRAW_PROTOCOL           *UgaDraw\r
   )\r
 {\r
-  if (UgaDraw != NULL) {\r
+  if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     return UgaDraw->Blt (\r
                       UgaDraw,\r
                       Private->UgaBlt,\r
@@ -1090,7 +1097,7 @@ DevNullUgaSync (
                       Private->UgaVerticalResolution,\r
                       Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL)\r
                       );\r
-  } else {\r
+  } else if (GraphicsOutput != NULL) {\r
     return GraphicsOutput->Blt (\r
                       GraphicsOutput,\r
                       (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt,\r
@@ -1103,6 +1110,8 @@ DevNullUgaSync (
                       Private->UgaVerticalResolution,\r
                       0\r
                       );\r
+  } else {\r
+    return EFI_UNSUPPORTED;\r
   }\r
 }\r
 \r
index 827f6b34db976d98adb3c2e5df65cd1322a47bb7..48c5c1bbed849e620c1ae09227c101829846a25d 100644 (file)
@@ -5,15 +5,15 @@ Remaining Tasks
   Implement optimal automatic Mode creation algorithm\r
   Solve palette issues for mixed graphics and text\r
   When does this protocol reset the palette?\r
-    \r
+\r
 Copyright (c) 2006 - 2007 Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -139,12 +139,13 @@ GraphicsConsoleControllerDriverSupported (
   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
+  EFI_STATUS                   Status;\r
   EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
-  EFI_UGA_DRAW_PROTOCOL     *UgaDraw;\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  EFI_UGA_DRAW_PROTOCOL        *UgaDraw;\r
+  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;\r
 \r
-  UgaDraw = NULL;\r
+  GraphicsOutput = NULL;\r
+  UgaDraw        = NULL;\r
   //\r
   // Open the IO Abstraction(s) needed to perform the supported test\r
   //\r
@@ -156,9 +157,8 @@ GraphicsConsoleControllerDriverSupported (
                   Controller,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
                   );\r
-  \r
-  if (EFI_ERROR (Status)) {\r
-    GraphicsOutput = NULL;\r
+\r
+  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     //\r
     // Open Graphics Output Protocol failed, try to open UGA Draw Protocol\r
     //\r
@@ -170,9 +170,9 @@ GraphicsConsoleControllerDriverSupported (
                     Controller,\r
                     EFI_OPEN_PROTOCOL_BY_DRIVER\r
                     );\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
+  }\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
   }\r
 \r
   //\r
@@ -215,7 +215,7 @@ Error:
           This->DriverBindingHandle,\r
           Controller\r
           );\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     gBS->CloseProtocol (\r
           Controller,\r
           &gEfiUgaDrawProtocolGuid,\r
@@ -292,9 +292,8 @@ GraphicsConsoleControllerDriverStart (
                   Controller,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
                   );\r
-  if (EFI_ERROR(Status)) {\r
-    Private->GraphicsOutput = NULL;\r
 \r
+  if (EFI_ERROR(Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     Status = gBS->OpenProtocol (\r
                     Controller,\r
                     &gEfiUgaDrawProtocolGuid,\r
@@ -303,9 +302,10 @@ GraphicsConsoleControllerDriverStart (
                     Controller,\r
                     EFI_OPEN_PROTOCOL_BY_DRIVER\r
                     );\r
-    if (EFI_ERROR (Status)) {\r
-      goto Error;\r
-    }\r
+  }\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    goto Error;\r
   }\r
 \r
   NarrowFontSize  = ReturnNarrowFontSize ();\r
@@ -325,10 +325,10 @@ GraphicsConsoleControllerDriverStart (
     SimplifiedFont->Header.Length        = (UINT32) (PackageLength - 4);\r
     SimplifiedFont->Header.Type          = EFI_HII_PACKAGE_SIMPLE_FONTS;\r
     SimplifiedFont->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));\r
-    \r
+\r
     Location = (UINT8 *) (&SimplifiedFont->NumberOfWideGlyphs + 1);\r
     CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);\r
-    \r
+\r
     //\r
     // Add this simplified font package to a package list then install it.\r
     //\r
@@ -336,7 +336,7 @@ GraphicsConsoleControllerDriverStart (
     Status = mHiiDatabase->NewPackageList (mHiiDatabase, PackageList, NULL, &(Private->HiiHandle));\r
     ASSERT_EFI_ERROR (Status);\r
     SafeFreePool (PackageList);\r
-    SafeFreePool (Package);    \r
+    SafeFreePool (Package);\r
 \r
     mFirstAccessFlag = FALSE;\r
   }\r
@@ -349,13 +349,13 @@ GraphicsConsoleControllerDriverStart (
 \r
   if (Private->GraphicsOutput != NULL) {\r
     //\r
-    // The console is build on top of Graphics Output Protocol, find the mode number \r
+    // The console is build on top of Graphics Output Protocol, find the mode number\r
     // for the user-defined mode; if there are multiple video devices,\r
     // graphic console driver will set all the video devices to the same mode.\r
     //\r
     Status = CheckModeSupported (\r
-                 Private->GraphicsOutput, \r
-                 CURRENT_HORIZONTAL_RESOLUTION, \r
+                 Private->GraphicsOutput,\r
+                 CURRENT_HORIZONTAL_RESOLUTION,\r
                  CURRENT_VERTICAL_RESOLUTION,\r
                  &ModeNumber\r
                  );\r
@@ -370,9 +370,9 @@ GraphicsConsoleControllerDriverStart (
       // if not supporting current mode, try 800x600 which is required by UEFI/EFI spec\r
       //\r
       Status = CheckModeSupported (\r
-                   Private->GraphicsOutput, \r
-                   800, \r
-                   600, \r
+                   Private->GraphicsOutput,\r
+                   800,\r
+                   600,\r
                    &ModeNumber\r
                    );\r
     }\r
@@ -385,7 +385,7 @@ GraphicsConsoleControllerDriverStart (
       VerticalResolution = Private->GraphicsOutput->Mode->Info->VerticalResolution;\r
       ModeNumber = Private->GraphicsOutput->Mode->Mode;\r
     }\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     //\r
     // At first try to set user-defined resolution\r
     //\r
@@ -401,7 +401,7 @@ GraphicsConsoleControllerDriverStart (
     if (!EFI_ERROR (Status)) {\r
       HorizontalResolution = CURRENT_HORIZONTAL_RESOLUTION;\r
       VerticalResolution   = CURRENT_VERTICAL_RESOLUTION;\r
-    } else {\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       //\r
       // Try to set 800*600 which is required by UEFI/EFI spec\r
       //\r
@@ -475,11 +475,11 @@ GraphicsConsoleControllerDriverStart (
     Private->ModeData[MaxMode].DeltaY     = 0;\r
     MaxMode++;\r
   }\r
-  \r
+\r
   //\r
   // Add Mode #2 that must be 100x31 (graphic mode >= 800x600)\r
   //\r
-  if (Columns >= 100 && Rows >= 31) {  \r
+  if (Columns >= 100 && Rows >= 31) {\r
     Private->ModeData[MaxMode].GopWidth   = HorizontalResolution;\r
     Private->ModeData[MaxMode].GopHeight  = VerticalResolution;\r
     Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
@@ -493,7 +493,7 @@ GraphicsConsoleControllerDriverStart (
   //\r
   if (HorizontalResolution > 800 && VerticalResolution > 600) {\r
     Private->ModeData[MaxMode].Columns    = HorizontalResolution/GLYPH_WIDTH;\r
-    Private->ModeData[MaxMode].Rows       = VerticalResolution/GLYPH_HEIGHT;    \r
+    Private->ModeData[MaxMode].Rows       = VerticalResolution/GLYPH_HEIGHT;\r
     Private->ModeData[MaxMode].GopWidth   = HorizontalResolution;\r
     Private->ModeData[MaxMode].GopHeight  = VerticalResolution;\r
     Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
@@ -501,7 +501,7 @@ GraphicsConsoleControllerDriverStart (
     Private->ModeData[MaxMode].DeltaY     = (VerticalResolution % GLYPH_HEIGHT) >> 1;\r
     MaxMode++;\r
   }\r
-    \r
+\r
   //\r
   // Update the maximum number of modes\r
   //\r
@@ -541,7 +541,7 @@ Error:
             This->DriverBindingHandle,\r
             Controller\r
             );\r
-    } else {\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       gBS->CloseProtocol (\r
             Controller,\r
             &gEfiUgaDrawProtocolGuid,\r
@@ -608,7 +608,7 @@ GraphicsConsoleControllerDriverStop (
             This->DriverBindingHandle,\r
             Controller\r
             );\r
-    } else {\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       gBS->CloseProtocol (\r
             Controller,\r
             &gEfiUgaDrawProtocolGuid,\r
@@ -647,11 +647,11 @@ CheckModeSupported (
 {\r
   UINT32     ModeNumber;\r
   EFI_STATUS Status;\r
-  UINTN      SizeOfInfo;  \r
+  UINTN      SizeOfInfo;\r
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
-    \r
+\r
   Status = EFI_SUCCESS;\r
-  \r
+\r
   for (ModeNumber = 0; ModeNumber < GraphicsOutput->Mode->MaxMode; ModeNumber++) {\r
     Status = GraphicsOutput->QueryMode (\r
                        GraphicsOutput,\r
@@ -671,13 +671,13 @@ CheckModeSupported (
       gBS->FreePool (Info);\r
     }\r
   }\r
-  \r
+\r
   if (ModeNumber == GraphicsOutput->Mode->MaxMode) {\r
     Status = EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   *CurrentModeNumber = ModeNumber;\r
-  return Status; \r
+  return Status;\r
 }\r
 \r
 EFI_STATUS\r
@@ -745,27 +745,27 @@ GraphicsConsoleConOutReset (
   )\r
 /*++\r
   Routine Description:\r
-  \r
+\r
     Implements SIMPLE_TEXT_OUTPUT.Reset().\r
-    If ExtendeVerification is TRUE, then perform dependent Graphics Console \r
+    If ExtendeVerification is TRUE, then perform dependent Graphics Console\r
     device reset, and set display mode to mode 0.\r
     If ExtendedVerification is FALSE, only set display mode to mode 0.\r
-  \r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
-    \r
+\r
     ExtendedVerification - Indicates that the driver may perform a more exhaustive\r
                            verification operation of the device during reset.\r
-        \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
-       The reset operation succeeds.   \r
-    \r
+       The reset operation succeeds.\r
+\r
     EFI_DEVICE_ERROR\r
-      The Graphics Console is not functioning correctly \r
-                \r
+      The Graphics Console is not functioning correctly\r
+\r
 --*/\r
 {\r
   This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));\r
@@ -780,31 +780,31 @@ GraphicsConsoleConOutOutputString (
   )\r
 /*++\r
   Routine Description:\r
-  \r
+\r
     Implements SIMPLE_TEXT_OUTPUT.OutputString().\r
-    The Unicode string will be converted to Glyphs and will be \r
+    The Unicode string will be converted to Glyphs and will be\r
     sent to the Graphics Console.\r
-    \r
-  \r
+\r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
-    \r
-    WString - The Null-terminated Unicode string to be displayed on \r
+\r
+    WString - The Null-terminated Unicode string to be displayed on\r
               the Graphics Console.\r
-        \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
-       The string is output successfully.   \r
-    \r
+       The string is output successfully.\r
+\r
     EFI_DEVICE_ERROR\r
       The Graphics Console failed to send the string out.\r
-      \r
+\r
     EFI_WARN_UNKNOWN_GLYPH\r
-      Indicates that some of the characters in the Unicode string could not \r
-      be rendered and are skipped.          \r
-                \r
+      Indicates that some of the characters in the Unicode string could not\r
+      be rendered and are skipped.\r
+\r
 --*/\r
 {\r
   GRAPHICS_CONSOLE_DEV  *Private;\r
@@ -927,7 +927,7 @@ GraphicsConsoleConOutOutputString (
                     GLYPH_HEIGHT,\r
                     Delta\r
                     );\r
-        } else {\r
+        } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
           //\r
           // Scroll Screen Up One Row\r
           //\r
@@ -1084,28 +1084,28 @@ GraphicsConsoleConOutTestString (
   )\r
 /*++\r
   Routine Description:\r
-  \r
+\r
     Implements SIMPLE_TEXT_OUTPUT.TestString().\r
     If one of the characters in the *Wstring is\r
     neither valid valid Unicode drawing characters,\r
     not ASCII code, then this function will return\r
     EFI_UNSUPPORTED.\r
-        \r
-  \r
+\r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
-    \r
+\r
     WString - The Null-terminated Unicode string to be tested.\r
-        \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
-       The Graphics Console is capable of rendering the output string. \r
-    \r
+       The Graphics Console is capable of rendering the output string.\r
+\r
     EFI_UNSUPPORTED\r
-      Some of the characters in the Unicode string cannot be rendered.      \r
-                \r
+      Some of the characters in the Unicode string cannot be rendered.\r
+\r
 --*/\r
 {\r
   EFI_STATUS            Status;\r
@@ -1145,45 +1145,45 @@ GraphicsConsoleConOutQueryMode (
   )\r
 /*++\r
   Routine Description:\r
-  \r
+\r
     Implements SIMPLE_TEXT_OUTPUT.QueryMode().\r
     It returnes information for an available text mode\r
     that the Graphics Console supports.\r
     In this driver,we only support text mode 80x25, which is\r
     defined as mode 0.\r
-        \r
-  \r
+\r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
-    \r
+\r
     ModeNumber - The mode number to return information on.\r
-        \r
+\r
     Columns - The returned columns of the requested mode.\r
-        \r
-    Rows - The returned rows of the requested mode.                \r
-        \r
+\r
+    Rows - The returned rows of the requested mode.\r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
-      The requested mode information is returned. \r
-    \r
+      The requested mode information is returned.\r
+\r
     EFI_UNSUPPORTED\r
-      The mode number is not valid.   \r
-                \r
+      The mode number is not valid.\r
+\r
 --*/\r
 {\r
   GRAPHICS_CONSOLE_DEV  *Private;\r
   EFI_STATUS            Status;\r
   EFI_TPL               OldTpl;\r
-       \r
+\r
   if (ModeNumber >= (UINTN) This->Mode->MaxMode) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
   Status = EFI_SUCCESS;\r
-  \r
+\r
   Private   = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);\r
 \r
   *Columns  = Private->ModeData[ModeNumber].Columns;\r
@@ -1208,28 +1208,28 @@ GraphicsConsoleConOutSetMode (
   )\r
 /*++\r
   Routine Description:\r
-  \r
+\r
     Implements SIMPLE_TEXT_OUTPUT.SetMode().\r
     Set the Graphics Console to a specified mode.\r
-    In this driver, we only support mode 0.        \r
-  \r
+    In this driver, we only support mode 0.\r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
-    \r
+\r
     ModeNumber - The text mode to set.\r
-        \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
        The requested text mode is set.\r
-       \r
+\r
     EFI_DEVICE_ERROR\r
       The requested text mode cannot be set because of Graphics Console device error.\r
-    \r
+\r
     EFI_UNSUPPORTED\r
-      The text mode number is not valid.       \r
-                \r
+      The text mode number is not valid.\r
+\r
 --*/\r
 {\r
   EFI_STATUS                      Status;\r
@@ -1340,7 +1340,7 @@ GraphicsConsoleConOutSetMode (
                           0\r
                           );\r
     }\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     //\r
     // Get the current UGA Draw mode information\r
     //\r
@@ -1412,31 +1412,31 @@ GraphicsConsoleConOutSetAttribute (
   )\r
 /*++\r
   Routine Description:\r
-  \r
-    Implements SIMPLE_TEXT_OUTPUT.SetAttribute().       \r
-  \r
+\r
+    Implements SIMPLE_TEXT_OUTPUT.SetAttribute().\r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
-    \r
+\r
     Attrubute - The attribute to set. Only bit0..6 are valid, all other bits\r
                 are undefined and must be zero.\r
-        \r
+\r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
-      The requested attribute is set. \r
-       \r
+      The requested attribute is set.\r
+\r
     EFI_DEVICE_ERROR\r
       The requested attribute cannot be set due to Graphics Console port error.\r
-          \r
+\r
     EFI_UNSUPPORTED\r
-      The attribute requested is not defined by EFI spec.   \r
-                \r
+      The attribute requested is not defined by EFI spec.\r
+\r
 --*/\r
 {\r
   EFI_TPL               OldTpl;\r
-  \r
+\r
   if ((Attribute | 0xFF) != 0xFF) {\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -1465,27 +1465,27 @@ GraphicsConsoleConOutClearScreen (
   )\r
 /*++\r
   Routine Description:\r
-  \r
+\r
     Implements SIMPLE_TEXT_OUTPUT.ClearScreen().\r
-    It clears the Graphics Console's display to the \r
+    It clears the Graphics Console's display to the\r
     currently selected background color.\r
-        \r
-  \r
+\r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
 \r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
       The operation completed successfully.\r
-       \r
+\r
     EFI_DEVICE_ERROR\r
-      The Graphics Console cannot be cleared due to Graphics Console device error.        \r
-    \r
+      The Graphics Console cannot be cleared due to Graphics Console device error.\r
+\r
     EFI_UNSUPPORTED\r
-      The Graphics Console is not in a valid text mode.       \r
-                \r
+      The Graphics Console is not in a valid text mode.\r
+\r
 --*/\r
 {\r
   EFI_STATUS                    Status;\r
@@ -1518,7 +1518,7 @@ GraphicsConsoleConOutClearScreen (
                         ModeData->GopHeight,\r
                         0\r
                         );\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     Status = UgaDraw->Blt (\r
                         UgaDraw,\r
                         (EFI_UGA_PIXEL *) (UINTN) &Background,\r
@@ -1531,6 +1531,8 @@ GraphicsConsoleConOutClearScreen (
                         ModeData->GopHeight,\r
                         0\r
                         );\r
+  } else {\r
+    Status = EFI_UNSUPPORTED;\r
   }\r
 \r
   This->Mode->CursorColumn  = 0;\r
@@ -1552,29 +1554,29 @@ GraphicsConsoleConOutSetCursorPosition (
   )\r
 /*++\r
   Routine Description:\r
-  \r
-    Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition().          \r
-  \r
+\r
+    Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition().\r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
-        \r
+\r
     Column - The row to set cursor to.\r
-        \r
-    Row - The column to set cursor to.                \r
+\r
+    Row - The column to set cursor to.\r
 \r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
       The operation completed successfully.\r
-       \r
+\r
     EFI_DEVICE_ERROR\r
-      The request fails due to Graphics Console device error.        \r
-    \r
+      The request fails due to Graphics Console device error.\r
+\r
     EFI_UNSUPPORTED\r
       The Graphics Console is not in a valid text mode, or the cursor position\r
-      is invalid for current mode.     \r
-                \r
+      is invalid for current mode.\r
+\r
 --*/\r
 {\r
   GRAPHICS_CONSOLE_DEV        *Private;\r
@@ -1620,31 +1622,31 @@ GraphicsConsoleConOutEnableCursor (
   )\r
 /*++\r
   Routine Description:\r
-  \r
+\r
     Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
-    In this driver, the cursor cannot be hidden.        \r
-  \r
+    In this driver, the cursor cannot be hidden.\r
+\r
   Arguments:\r
-  \r
+\r
     This - Indicates the calling context.\r
-        \r
+\r
     Visible - If TRUE, the cursor is set to be visible,\r
-              If FALSE, the cursor is set to be invisible.        \r
+              If FALSE, the cursor is set to be invisible.\r
 \r
   Returns:\r
-  \r
+\r
     EFI_SUCCESS\r
       The request is valid.\r
-       \r
+\r
     EFI_UNSUPPORTED\r
-      The Graphics Console does not support a hidden cursor.   \r
-                \r
+      The Graphics Console does not support a hidden cursor.\r
+\r
 --*/\r
 {\r
   EFI_TPL               OldTpl;\r
-  \r
+\r
   OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
-    \r
+\r
   EraseCursor (This);\r
 \r
   This->Mode->CursorVisible = Visible;\r
@@ -1729,7 +1731,7 @@ DrawUnicodeWeightAtCursorN (
                          NULL\r
                          );\r
 \r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     ASSERT (Private->UgaDraw!= NULL);\r
 \r
     UgaDraw = Private->UgaDraw;\r
@@ -1765,7 +1767,7 @@ DrawUnicodeWeightAtCursorN (
       // always be 1. ASSERT here to make sure.\r
       //\r
       ASSERT (RowInfoArraySize == 1);\r
-      \r
+\r
       Status = UgaDraw->Blt (\r
                           UgaDraw,\r
                           (EFI_UGA_PIXEL *) Blt->Image.Bitmap,\r
@@ -1782,6 +1784,8 @@ DrawUnicodeWeightAtCursorN (
 \r
     SafeFreePool (RowInfoArray);\r
     SafeFreePool (Blt->Image.Bitmap);\r
+  } else {\r
+    Status = EFI_UNSUPPORTED;\r
   }\r
 \r
   SafeFreePool (Blt);\r
@@ -1840,7 +1844,7 @@ EraseCursor (
               GLYPH_HEIGHT,\r
               GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
               );\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     UgaDraw->Blt (\r
               UgaDraw,\r
               (EFI_UGA_PIXEL *) (UINTN) BltChar,\r
@@ -1881,7 +1885,7 @@ EraseCursor (
               GLYPH_HEIGHT,\r
               GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
               );\r
-  } else {\r
+  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     UgaDraw->Blt (\r
               UgaDraw,\r
               (EFI_UGA_PIXEL *) (UINTN) BltChar,\r
@@ -1902,9 +1906,9 @@ EraseCursor (
 /**\r
   The user Entry Point for module GraphicsConsole. The user code starts with this function.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
   @param[in] SystemTable    A pointer to the EFI System Table.\r
-  \r
+\r
   @retval EFI_SUCCESS       The entry point is executed successfully.\r
   @retval other             Some error occurs when executing this entry point.\r
 \r
index 1c182f3b9095041a91ac239841347b462a65df0c..5bdbf7f4cd9854feb3a350a3819192c97913e0b7 100644 (file)
@@ -1,13 +1,13 @@
 /*++\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation                                              \r
-All rights reserved. This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006 - 2008, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
@@ -15,7 +15,7 @@ Module Name:
 \r
 Abstract:\r
 \r
-  \r
+\r
 Revision History\r
 \r
 --*/\r
@@ -24,7 +24,6 @@ Revision History
 #define _GRAPHICS_CONSOLE_H\r
 \r
 #include <PiDxe.h>\r
-//#include <Protocol/FrameworkHii.h>\r
 #include <Protocol/SimpleTextOut.h>\r
 #include <Protocol/GraphicsOutput.h>\r
 #include <Protocol/UgaDraw.h>\r
@@ -32,12 +31,12 @@ Revision History
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiLib.h>\r
-//#include <Library/FrameworkHiiLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/HiiLib.h>\r
 #include <Library/BaseLib.h>\r
+#include <Library/PcdLib.h>\r
 \r
 #include <MdeModuleHii.h>\r
 \r
index 4a07393df96a37b5a3a942c04f40070dbd7e4e2a..8444def66f4eb886088c916ce239a1ad91af229f 100644 (file)
@@ -61,4 +61,6 @@
   gEfiUgaDrawProtocolGuid                       # PROTOCOL TO_START\r
   gEfiHiiFontProtocolGuid\r
   gEfiHiiDatabaseProtocolGuid\r
-  
\ No newline at end of file
+\r
+[FeaturePcd.common]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
\ No newline at end of file