]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add PcdConOutGopSupport and PcdConOutUgaSupport in MdeModulePkg.dec
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 Oct 2007 05:30:18 +0000 (05:30 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 Oct 2007 05:30:18 +0000 (05:30 +0000)
2. ConSplitterDxe module could produce GOP and/or UGA according to thest 2 PCDs.
3. Add PcdConOutGopSupport and PcdConOutUgaSupport reference in DSC file.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4121 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/MdeModulePkg.dsc
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c
MdePkg/Include/Uefi/UefiSpec.h

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