Revision: 19717
http://sourceforge.net/p/edk2/code/19717
Author: lersek
Date: 2016-01-21 18:40:40 +0000 (Thu, 21 Jan 2016)
Log Message:
-----------
ShellPkg: elevate DumpHex() from Debug1-internal to generic-internal
The UEFI Shell specification classifies shell commands into various shell
levels / profiles.
Currently the DumpHex() internal function is only used by commands that
belong to the Debug1 profile exclusively (i.e., they are not required to
be present in other than Debug1 profiles):
- SMBIOSVIEW
- PCI
- DMPSTORE
- DMEM
- DBLK
In the next patch, we'd like to call DumpHex() from BCFG as well. However,
BCFG is not only required to be present in the Debug1 profile; the
Install1 profile contains BCFG as well. For this reason, move DumpHex()
from UefiShellDebug1CommandsLib to the more generic UefiShellCommandLib,
which "Provides interface to shell internal functions for shell commands".
The matching header file is "ShellPkg/Include/Library/ShellCommandLib.h".
Cc: Jaben Carsey <[email protected]>
Cc: Ryan Harkin <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Modified Paths:
--------------
trunk/edk2/ShellPkg/Include/Library/ShellCommandLib.h
trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
Modified: trunk/edk2/ShellPkg/Include/Library/ShellCommandLib.h
===================================================================
--- trunk/edk2/ShellPkg/Include/Library/ShellCommandLib.h 2016-01-21
18:40:35 UTC (rev 19716)
+++ trunk/edk2/ShellPkg/Include/Library/ShellCommandLib.h 2016-01-21
18:40:40 UTC (rev 19717)
@@ -685,4 +685,20 @@
IN BUFFER_LIST *List
);
+/**
+ Function printing hex output to the console.
+
+ @param[in] Indent Number of spaces to indent.
+ @param[in] Offset Offset to start with.
+ @param[in] DataSize Length of data.
+ @param[in] UserData Pointer to some data.
+**/
+VOID
+DumpHex (
+ IN UINTN Indent,
+ IN UINTN Offset,
+ IN UINTN DataSize,
+ IN VOID *UserData
+ );
+
#endif //_SHELL_COMMAND_LIB_
Modified: trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
2016-01-21 18:40:35 UTC (rev 19716)
+++ trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
2016-01-21 18:40:40 UTC (rev 19717)
@@ -29,6 +29,25 @@
STATIC UINTN mBlkMaxCount = 0;
STATIC BUFFER_LIST mFileHandleList;
+STATIC CONST CHAR8 Hex[] = {
+ '0',
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ 'A',
+ 'B',
+ 'C',
+ 'D',
+ 'E',
+ 'F'
+};
+
// global variables required by library class.
EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation = NULL;
SHELL_MAP_LIST gShellMapList;
@@ -1673,3 +1692,53 @@
}
}
+/**
+ Dump some hexadecimal data to the screen.
+
+ @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.
+**/
+VOID
+DumpHex (
+ IN UINTN Indent,
+ IN UINTN Offset,
+ IN UINTN DataSize,
+ IN VOID *UserData
+ )
+{
+ UINT8 *Data;
+
+ CHAR8 Val[50];
+
+ CHAR8 Str[20];
+
+ UINT8 TempByte;
+ UINTN Size;
+ UINTN Index;
+
+ Data = UserData;
+ 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;
+ ShellPrintEx(-1, -1, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val,
Str);
+
+ Data += Size;
+ Offset += Size;
+ DataSize -= Size;
+ }
+}
Modified:
trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
2016-01-21 18:40:35 UTC (rev 19716)
+++ trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
2016-01-21 18:40:40 UTC (rev 19717)
@@ -18,7 +18,7 @@
BASE_NAME = UefiShellCommandLib
FILE_GUID = 5C12F31F-EBAC-466e-A400-FCA8C9EA3A05
MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
+ VERSION_STRING = 1.1
LIBRARY_CLASS = ShellCommandLib|UEFI_APPLICATION
UEFI_DRIVER DXE_RUNTIME_DRIVER
CONSTRUCTOR = ShellCommandLibConstructor
DESTRUCTOR = ShellCommandLibDestructor
Modified:
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
===================================================================
---
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
2016-01-21 18:40:35 UTC (rev 19716)
+++
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
2016-01-21 18:40:40 UTC (rev 19717)
@@ -113,77 +113,7 @@
return (EFI_SUCCESS);
}
-STATIC CONST CHAR8 Hex[] = {
- '0',
- '1',
- '2',
- '3',
- '4',
- '5',
- '6',
- '7',
- '8',
- '9',
- 'A',
- 'B',
- 'C',
- 'D',
- 'E',
- 'F'
-};
-
/**
- Dump some hexadecimal data to the screen.
-
- @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.
-**/
-VOID
-DumpHex (
- IN UINTN Indent,
- IN UINTN Offset,
- IN UINTN DataSize,
- IN VOID *UserData
- )
-{
- UINT8 *Data;
-
- CHAR8 Val[50];
-
- CHAR8 Str[20];
-
- UINT8 TempByte;
- UINTN Size;
- UINTN Index;
-
- Data = UserData;
- 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;
- ShellPrintEx(-1, -1, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val,
Str);
-
- Data += Size;
- Offset += Size;
- DataSize -= Size;
- }
-}
-
-/**
Convert a Unicode character to upper case only if
it maps to a valid small-case ASCII character.
Modified:
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h
===================================================================
---
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h
2016-01-21 18:40:35 UTC (rev 19716)
+++
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h
2016-01-21 18:40:40 UTC (rev 19717)
@@ -62,22 +62,6 @@
extern EFI_HANDLE gShellDebug1HiiHandle;
/**
- Function printing hex output to the console.
-
- @param[in] Indent Number of spaces to indent.
- @param[in] Offset Offset to start with.
- @param[in] DataSize Length of data.
- @param[in] UserData Pointer to some data.
-**/
-VOID
-DumpHex (
- IN UINTN Indent,
- IN UINTN Offset,
- IN UINTN DataSize,
- IN VOID *UserData
- );
-
-/**
Function returns a system configuration table that is stored in the
EFI System Table based on the provided GUID.
Modified:
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
===================================================================
---
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
2016-01-21 18:40:35 UTC (rev 19716)
+++
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
2016-01-21 18:40:40 UTC (rev 19717)
@@ -17,7 +17,7 @@
BASE_NAME = UefiShellDebug1CommandsLib
FILE_GUID = 90330D51-A99B-4cc8-A2EB-AE22542A3F45
MODULE_TYPE = UEFI_APPLICATION
- VERSION_STRING = 1.1
+ VERSION_STRING = 1.2
LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER
CONSTRUCTOR = UefiShellDebug1CommandsLibConstructor
DESTRUCTOR = UefiShellDebug1CommandsLibDestructor
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits