diff --git a/ShellPkg/Include/Library/ShellCommandLib.h b/ShellPkg/Include/Library/ShellCommandLib.h
index 0dd66c2fbc..e3bb6e0164 100644
--- a/ShellPkg/Include/Library/ShellCommandLib.h
+++ b/ShellPkg/Include/Library/ShellCommandLib.h
@@ -4,8 +4,9 @@
This library is for use ONLY by shell commands linked into the shell application.
This library will not funciton if it is used for UEFI Shell 2.0 Applications.
- (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+ (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -701,4 +702,21 @@ DumpHex (
IN VOID *UserData
);
+/**
+ Dump HEX data into buffer.
+
+ @param[in] Buffer HEX data to be dumped in Buffer.
+ @param[in] Indent How many spaces to indent the output.
+ @param[in] Offset The offset of the printing.
+ @param[in] DataSize The size in bytes of UserData.
+ @param[in] UserData The data to print out.
+**/
+CHAR16*
+CatSDumpHex (
+ IN CHAR16 *Buffer,
+ IN UINTN Indent,
+ IN UINTN Offset,
+ IN UINTN DataSize,
+ IN VOID *UserData
+ );
#endif //_SHELL_COMMAND_LIB_
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index 14e7a9fa45..efafe6f535 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -244,11 +244,15 @@ GraphicsOutputProtocolDumpInformation(
IN CONST BOOLEAN Verbose
)
{
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_STATUS Status;
- CHAR16 *RetVal;
- CHAR16 *Temp;
- CHAR16 *Fmt;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
+ CHAR16 *Temp;
+ CHAR16 *Fmt;
+ CHAR16 *TempRetVal;
+ UINTN GopInfoSize;
+ UINT32 Mode;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GopInfo;
if (!Verbose) {
return (CatSPrint(NULL, L"GraphicsOutput"));
@@ -295,6 +299,41 @@ GraphicsOutputProtocolDumpInformation(
GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.BlueMask
);
+ SHELL_FREE_NON_NULL (Temp);
+
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_MAIN), NULL);
+
+ TempRetVal = CatSPrint (RetVal, Temp);
+ SHELL_FREE_NON_NULL (RetVal);
+ RetVal = TempRetVal;
+ SHELL_FREE_NON_NULL (Temp);
+
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_ENTRY), NULL);
+
+ for (Mode = 0; Mode < GraphicsOutput->Mode->MaxMode; Mode++) {
+ Status = GraphicsOutput->QueryMode (
+ GraphicsOutput,
+ Mode,
+ &GopInfoSize,
+ &GopInfo
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ TempRetVal = CatSPrint (
+ RetVal,
+ Temp,
+ Mode,
+ GopInfo->HorizontalResolution,
+ GopInfo->VerticalResolution
+ );
+
+ SHELL_FREE_NON_NULL (GopInfo);
+ SHELL_FREE_NON_NULL (RetVal);
+ RetVal = TempRetVal;
+ }
+
SHELL_FREE_NON_NULL(Temp);
SHELL_FREE_NON_NULL(Fmt);
@@ -302,6 +341,134 @@ GraphicsOutputProtocolDumpInformation(
}
/**
+ Function to dump information about EDID Discovered Protocol.
+
+ 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
+EdidDiscoveredProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
+ )
+{
+ EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
+ CHAR16 *Temp;
+ CHAR16 *TempRetVal;
+
+ if (!Verbose) {
+ return (CatSPrint(NULL, L"EDIDDiscovered"));
+ }
+
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiEdidDiscoveredProtocolGuid,
+ (VOID**)&EdidDiscovered,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_EDID_DISCOVERED_MAIN), NULL);
+ if (Temp == NULL) {
+ return NULL;
+ }
+
+ RetVal = CatSPrint (NULL, Temp, EdidDiscovered->SizeOfEdid);
+ SHELL_FREE_NON_NULL (Temp);
+
+ if(EdidDiscovered->SizeOfEdid != 0) {
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_EDID_DISCOVERED_DATA), NULL);
+ if (Temp == NULL) {
+ SHELL_FREE_NON_NULL (RetVal);
+ return NULL;
+ }
+ TempRetVal = CatSPrint (RetVal, Temp);
+ SHELL_FREE_NON_NULL (RetVal);
+ RetVal = TempRetVal;
+
+ TempRetVal = CatSDumpHex (RetVal, 7, 0, EdidDiscovered->SizeOfEdid, EdidDiscovered->Edid);
+ RetVal = TempRetVal;
+ }
+ return RetVal;
+}
+
+/**
+ Function to dump information about EDID Active Protocol.
+
+ 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
+EdidActiveProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
+ )
+{
+ EFI_EDID_ACTIVE_PROTOCOL *EdidActive;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
+ CHAR16 *Temp;
+ CHAR16 *TempRetVal;
+
+ if (!Verbose) {
+ return (CatSPrint(NULL, L"EDIDActive"));
+ }
+
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiEdidActiveProtocolGuid,
+ (VOID**)&EdidActive,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_EDID_ACTIVE_MAIN), NULL);
+ if (Temp == NULL) {
+ return NULL;
+ }
+
+ RetVal = CatSPrint (NULL, Temp, EdidActive->SizeOfEdid);
+ SHELL_FREE_NON_NULL (Temp);
+
+ if(EdidActive->SizeOfEdid != 0) {
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_EDID_ACTIVE_DATA), NULL);
+ if (Temp == NULL) {
+ SHELL_FREE_NON_NULL (RetVal);
+ return NULL;
+ }
+ TempRetVal = CatSPrint (RetVal, Temp);
+ SHELL_FREE_NON_NULL (RetVal);
+ RetVal = TempRetVal;
+
+ TempRetVal = CatSDumpHex (RetVal, 7, 0, EdidActive->SizeOfEdid, EdidActive->Edid);
+ RetVal = TempRetVal;
+ }
+ return RetVal;
+}
+
+/**
Function to dump information about PciRootBridgeIo.
This will allocate the return buffer from boot services pool.
@@ -1294,8 +1461,8 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
{STRING_TOKEN(STR_ABS_POINTER), &gEfiAbsolutePointerProtocolGuid, NULL},
{STRING_TOKEN(STR_SERIAL_IO), &gEfiSerialIoProtocolGuid, 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_DISCOVERED), &gEfiEdidDiscoveredProtocolGuid, EdidDiscoveredProtocolDumpInformation},
+ {STRING_TOKEN(STR_EDID_ACTIVE), &gEfiEdidActiveProtocolGuid, EdidActiveProtocolDumpInformation},
{STRING_TOKEN(STR_EDID_OVERRIDE), &gEfiEdidOverrideProtocolGuid, NULL},
{STRING_TOKEN(STR_CON_IN), &gEfiConsoleInDeviceGuid, NULL},
{STRING_TOKEN(STR_CON_OUT), &gEfiConsoleOutDeviceGuid, NULL},
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
index 6f2ca50922..f53cfb9108 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
@@ -1,8 +1,9 @@
/** @file
Provides interface to advanced shell functionality for parsing both handle and protocol database.
- (C) Copyright 2013-2016 Hewlett-Packard Development Company, L.P.
Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+ (C) Copyright 2013-2016 Hewlett-Packard Development Company, L.P.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -151,6 +152,7 @@
#include
#include
#include
+#include
#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1 1
#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2 2
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
index 0cb2fa8746..c5ea60d656 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
@@ -379,6 +379,15 @@
" GreenMask.......: %%H0x%08x%%N\r\n"
" BlueMask........: %%H0x%08x%%N\r\n"
+#string STR_GOP_RES_LIST_MAIN #language en-US " Supported Resolution List\r\n"
+#string STR_GOP_RES_LIST_ENTRY #language en-US " Resolution[%%H%d%%N]:\r\n"
+ " Res Hor.........: %%H0x%08x%%N\r\n"
+ " Res Ver.........: %%H0x%08x%%N\r\n"
+
+#string STR_EDID_DISCOVERED_MAIN #language en-US " EDID Discovered Size : %%H0x%08x%%N\r\n"
+#string STR_EDID_DISCOVERED_DATA #language en-US " EDID Discovered Data :\r\n"
+#string STR_EDID_ACTIVE_MAIN #language en-US " EDID Active Size : %%H0x%08x%%N\r\n"
+#string STR_EDID_ACTIVE_DATA #language en-US " EDID Active Data :\r\n"
#string STR_GET_SUPP_TYPES_FAILED #language en-US "Unable to get supported types - %%H%r%%N\r\n"
#string STR_SUPP_TYPE_HEADER #language en-US " Supported Information Types: \r\n"
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index 92a88d18a0..48e4d4af0d 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -1,8 +1,10 @@
/** @file
Provides interface to shell internal functions for shell commands.
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1742,3 +1744,60 @@ DumpHex (
DataSize -= Size;
}
}
+
+/**
+ Dump HEX data into buffer.
+
+ @param[in] Buffer HEX data to be dumped in Buffer.
+ @param[in] Indent How many spaces to indent the output.
+ @param[in] Offset The offset of the printing.
+ @param[in] DataSize The size in bytes of UserData.
+ @param[in] UserData The data to print out.
+**/
+CHAR16*
+CatSDumpHex (
+ IN CHAR16 *Buffer,
+ IN UINTN Indent,
+ IN UINTN Offset,
+ IN UINTN DataSize,
+ IN VOID *UserData
+ )
+{
+ UINT8 *Data;
+ UINT8 TempByte;
+ UINTN Size;
+ UINTN Index;
+ CHAR8 Val[50];
+ CHAR8 Str[20];
+ CHAR16 *RetVal;
+ CHAR16 *TempRetVal;
+
+ Data = UserData;
+ RetVal = Buffer;
+ while (DataSize != 0) {
+ Size = 16;
+ if (Size > DataSize) {
+ Size = DataSize;
+ }
+
+ for (Index = 0; Index < Size; Index += 1) {
+ TempByte = Data[Index];
+ Val[Index * 3 + 0] = Hex[TempByte >> 4];
+ Val[Index * 3 + 1] = Hex[TempByte & 0xF];
+ Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' ');
+ Str[Index] = (CHAR8) ((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte);
+ }
+
+ Val[Index * 3] = 0;
+ Str[Index] = 0;
+ TempRetVal = CatSPrint (RetVal, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str);
+ SHELL_FREE_NON_NULL (RetVal);
+ RetVal = TempRetVal;
+
+ Data += Size;
+ Offset += Size;
+ DataSize -= Size;
+ }
+
+ return RetVal;
+}
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
index 1cfda2cf2d..a096a12098 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
@@ -2,6 +2,7 @@
Provides interface to shell internal functions for shell commands.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -43,6 +44,7 @@
#include
#include
#include
+#include
typedef struct{
LIST_ENTRY Link;