]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Patch to enhance the output around GOP protocol
authorJaben Carsey <Jaben.carsey@intel.com>
Wed, 30 Apr 2014 15:32:27 +0000 (15:32 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 30 Apr 2014 15:32:27 +0000 (15:32 +0000)
This patch adds detailed information from the GOP protocol for commands (i.e. DH), that display details about the protocol.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15493 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni

index 6f4dd91ccad2d841c96f7dc277b83860473f3dca..468365e400d4d40d007218bf81943b18f61451d9 100644 (file)
@@ -56,6 +56,33 @@ ConvertMemoryType (
   return (RetVal);\r
 }\r
 \r
+/**\r
+  Function to translate the EFI_GRAPHICS_PIXEL_FORMAT into a string.\r
+\r
+  @param[in] Memory     The format type.\r
+\r
+  @retval               A string representation of the type allocated from BS Pool.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+ConvertPixelFormat (\r
+  IN CONST EFI_GRAPHICS_PIXEL_FORMAT Fmt\r
+  )\r
+{\r
+  CHAR16 *RetVal;\r
+  RetVal = NULL;\r
+\r
+  switch (Fmt) {\r
+  case PixelRedGreenBlueReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelRedGreenBlueReserved8BitPerColor", 0);  break;\r
+  case PixelBlueGreenRedReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelBlueGreenRedReserved8BitPerColor", 0);  break;\r
+  case PixelBitMask:                          StrnCatGrow(&RetVal, NULL, L"PixelBitMask", 0);                           break;\r
+  case PixelBltOnly:                          StrnCatGrow(&RetVal, NULL, L"PixelBltOnly", 0);                           break;\r
+  case PixelFormatMax:                        StrnCatGrow(&RetVal, NULL, L"PixelFormatMax", 0);                         break;\r
+  default: ASSERT(FALSE);\r
+  }\r
+  return (RetVal);\r
+}\r
+\r
 /**\r
   Constructor for the library.\r
 \r
@@ -177,6 +204,81 @@ LoadedImageProtocolDumpInformation(
   return RetVal;\r
 }\r
 \r
+/**\r
+  Function to dump information about GOP.\r
+\r
+  This will allocate the return buffer from boot services pool.\r
+\r
+  @param[in] TheHandle      The handle that has LoadedImage installed.\r
+  @param[in] Verbose        TRUE for additional information, FALSE otherwise.\r
+\r
+  @retval A poitner to a string containing the information.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+GraphicsOutputProtocolDumpInformation(\r
+  IN CONST EFI_HANDLE TheHandle,\r
+  IN CONST BOOLEAN    Verbose\r
+  )\r
+{\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL      *GraphicsOutput;\r
+  EFI_STATUS                        Status;\r
+  CHAR16                            *RetVal;\r
+  CHAR16                            *Temp;\r
+  CHAR16                            *Fmt;\r
+\r
+  if (!Verbose) {\r
+    return (CatSPrint(NULL, L"GraphicsOutput"));\r
+  }\r
+\r
+  Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_GOP_DUMP_MAIN), NULL);\r
+  RetVal = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));\r
+  if (Temp == NULL || RetVal == NULL) {\r
+    SHELL_FREE_NON_NULL(Temp);\r
+    SHELL_FREE_NON_NULL(RetVal);\r
+    return NULL;\r
+  }\r
+\r
+  Status = gBS->OpenProtocol (\r
+                TheHandle,\r
+                &gEfiGraphicsOutputProtocolGuid,\r
+                (VOID**)&GraphicsOutput,\r
+                gImageHandle,\r
+                NULL,\r
+                EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+               );\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    SHELL_FREE_NON_NULL (Temp);\r
+    SHELL_FREE_NON_NULL (RetVal);\r
+    return NULL;\r
+  }\r
+\r
+  Fmt = ConvertPixelFormat(GraphicsOutput->Mode->Info->PixelFormat);\r
+\r
+  RetVal = CatSPrint(RetVal,\r
+                      Temp,\r
+                      GraphicsOutput->Mode->MaxMode,\r
+                      GraphicsOutput->Mode->Mode,\r
+                      GraphicsOutput->Mode->FrameBufferBase,\r
+                      (UINT64)GraphicsOutput->Mode->FrameBufferSize,\r
+                      (UINT64)GraphicsOutput->Mode->SizeOfInfo,\r
+                      GraphicsOutput->Mode->Info->Version,\r
+                      GraphicsOutput->Mode->Info->HorizontalResolution,\r
+                      GraphicsOutput->Mode->Info->VerticalResolution,\r
+                      Fmt,\r
+                      GraphicsOutput->Mode->Info->PixelsPerScanLine,\r
+                      GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.RedMask,\r
+                      GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.GreenMask,\r
+                      GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.BlueMask\r
+                      );\r
+  \r
+  SHELL_FREE_NON_NULL(Temp);\r
+  SHELL_FREE_NON_NULL(Fmt);\r
+\r
+  return RetVal;\r
+}\r
+\r
 /**\r
   Function to dump information about PciRootBridgeIo.\r
 \r
@@ -503,7 +605,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
   {STRING_TOKEN(STR_SIM_POINTER),           &gEfiSimplePointerProtocolGuid,                   NULL},\r
   {STRING_TOKEN(STR_ABS_POINTER),           &gEfiAbsolutePointerProtocolGuid,                 NULL},\r
   {STRING_TOKEN(STR_SERIAL_IO),             &gEfiSerialIoProtocolGuid,                        NULL},\r
-  {STRING_TOKEN(STR_GRAPHICS_OUTPUT),       &gEfiGraphicsOutputProtocolGuid,                  NULL},\r
+  {STRING_TOKEN(STR_GRAPHICS_OUTPUT),       &gEfiGraphicsOutputProtocolGuid,                  GraphicsOutputProtocolDumpInformation},\r
   {STRING_TOKEN(STR_EDID_DISCOVERED),       &gEfiEdidDiscoveredProtocolGuid,                  NULL},\r
   {STRING_TOKEN(STR_EDID_ACTIVE),           &gEfiEdidActiveProtocolGuid,                      NULL},\r
   {STRING_TOKEN(STR_EDID_OVERRIDE),         &gEfiEdidOverrideProtocolGuid,                    NULL},\r
index 6f7c383b4a9d323b9abad4dd2767e894d8e96f01..5c5308d8a4c69879598f7bd0b00b1fbacafc58d3 100644 (file)
Binary files a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni and b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni differ