From 609e0c581568c81aeb1d8cedab5e131629c1fd9c Mon Sep 17 00:00:00 2001 From: Jaben Carsey Date: Wed, 30 Apr 2014 15:32:27 +0000 Subject: ShellPkg: Patch to enhance the output around GOP protocol 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 Reviewed-by: Ruiyu Ni git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15493 6f19259b-4bc3-4df7-8a09-765794883524 --- .../UefiHandleParsingLib/UefiHandleParsingLib.c | 104 ++++++++++++++++++++- .../UefiHandleParsingLib/UefiHandleParsingLib.uni | Bin 26552 -> 29372 bytes 2 files changed, 103 insertions(+), 1 deletion(-) (limited to 'ShellPkg') diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index 6f4dd91cca..468365e400 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -56,6 +56,33 @@ ConvertMemoryType ( return (RetVal); } +/** + Function to translate the EFI_GRAPHICS_PIXEL_FORMAT into a string. + + @param[in] Memory The format type. + + @retval A string representation of the type allocated from BS Pool. +**/ +CHAR16* +EFIAPI +ConvertPixelFormat ( + IN CONST EFI_GRAPHICS_PIXEL_FORMAT Fmt + ) +{ + CHAR16 *RetVal; + RetVal = NULL; + + switch (Fmt) { + case PixelRedGreenBlueReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelRedGreenBlueReserved8BitPerColor", 0); break; + case PixelBlueGreenRedReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelBlueGreenRedReserved8BitPerColor", 0); break; + case PixelBitMask: StrnCatGrow(&RetVal, NULL, L"PixelBitMask", 0); break; + case PixelBltOnly: StrnCatGrow(&RetVal, NULL, L"PixelBltOnly", 0); break; + case PixelFormatMax: StrnCatGrow(&RetVal, NULL, L"PixelFormatMax", 0); break; + default: ASSERT(FALSE); + } + return (RetVal); +} + /** Constructor for the library. @@ -177,6 +204,81 @@ LoadedImageProtocolDumpInformation( return RetVal; } +/** + Function to dump information about GOP. + + This will allocate the return buffer from boot services pool. + + @param[in] TheHandle The handle that has LoadedImage installed. + @param[in] Verbose TRUE for additional information, FALSE otherwise. + + @retval A poitner to a string containing the information. +**/ +CHAR16* +EFIAPI +GraphicsOutputProtocolDumpInformation( + IN CONST EFI_HANDLE TheHandle, + IN CONST BOOLEAN Verbose + ) +{ + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; + EFI_STATUS Status; + CHAR16 *RetVal; + CHAR16 *Temp; + CHAR16 *Fmt; + + if (!Verbose) { + return (CatSPrint(NULL, L"GraphicsOutput")); + } + + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_GOP_DUMP_MAIN), NULL); + RetVal = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize)); + if (Temp == NULL || RetVal == NULL) { + SHELL_FREE_NON_NULL(Temp); + SHELL_FREE_NON_NULL(RetVal); + return NULL; + } + + Status = gBS->OpenProtocol ( + TheHandle, + &gEfiGraphicsOutputProtocolGuid, + (VOID**)&GraphicsOutput, + gImageHandle, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + + if (EFI_ERROR (Status)) { + SHELL_FREE_NON_NULL (Temp); + SHELL_FREE_NON_NULL (RetVal); + return NULL; + } + + Fmt = ConvertPixelFormat(GraphicsOutput->Mode->Info->PixelFormat); + + RetVal = CatSPrint(RetVal, + Temp, + GraphicsOutput->Mode->MaxMode, + GraphicsOutput->Mode->Mode, + GraphicsOutput->Mode->FrameBufferBase, + (UINT64)GraphicsOutput->Mode->FrameBufferSize, + (UINT64)GraphicsOutput->Mode->SizeOfInfo, + GraphicsOutput->Mode->Info->Version, + GraphicsOutput->Mode->Info->HorizontalResolution, + GraphicsOutput->Mode->Info->VerticalResolution, + Fmt, + GraphicsOutput->Mode->Info->PixelsPerScanLine, + GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.RedMask, + GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.GreenMask, + GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.BlueMask + ); + + SHELL_FREE_NON_NULL(Temp); + SHELL_FREE_NON_NULL(Fmt); + + return RetVal; +} + /** Function to dump information about PciRootBridgeIo. @@ -503,7 +605,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = { {STRING_TOKEN(STR_SIM_POINTER), &gEfiSimplePointerProtocolGuid, NULL}, {STRING_TOKEN(STR_ABS_POINTER), &gEfiAbsolutePointerProtocolGuid, NULL}, {STRING_TOKEN(STR_SERIAL_IO), &gEfiSerialIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_GRAPHICS_OUTPUT), &gEfiGraphicsOutputProtocolGuid, NULL}, + {STRING_TOKEN(STR_GRAPHICS_OUTPUT), &gEfiGraphicsOutputProtocolGuid, GraphicsOutputProtocolDumpInformation}, {STRING_TOKEN(STR_EDID_DISCOVERED), &gEfiEdidDiscoveredProtocolGuid, NULL}, {STRING_TOKEN(STR_EDID_ACTIVE), &gEfiEdidActiveProtocolGuid, NULL}, {STRING_TOKEN(STR_EDID_OVERRIDE), &gEfiEdidOverrideProtocolGuid, NULL}, diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni index 6f7c383b4a..5c5308d8a4 100644 Binary files a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni and b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni differ -- cgit v1.2.3