summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/VarCheckHiiLib
diff options
context:
space:
mode:
authorOliver Smith-Denny <osde@microsoft.com>2026-10-01 22:38:03 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-10-23 06:44:49 +0300
commitbbbb761e370379aed5d548cd5c044377fee4daaa (patch)
tree56d02029be2c2ede0bfb743a9ebf5572d22e6f14 /MdeModulePkg/Library/VarCheckHiiLib
parent2b2c8374f91a9622b0d49ce7d90ce2bab10c9c6e (diff)
downloadedk2-bbbb761e370379aed5d548cd5c044377fee4daaa.tar.xz
MdeModulePkg: Use DUMP_HEX Macro
Several places in MdeModulePkg were implementing their own versions of hex dumping logic; use the DebugLib.h macro instead. Prints change slightly, they are now standardized with uppercase hex, prefixes on every row instead of in the header only, and VarCheckHiiLib no longer indents rows with *ASCII*. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Diffstat (limited to 'MdeModulePkg/Library/VarCheckHiiLib')
-rw-r--r--MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibCommon.c63
1 files changed, 6 insertions, 57 deletions
diff --git a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibCommon.c b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibCommon.c
index 00a37df017..35961a2641 100644
--- a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibCommon.c
+++ b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibCommon.c
@@ -8,58 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "VarCheckHii.h"
#include "VarCheckHiiLibCommon.h"
-EFI_HANDLE mEfiVariableCheckHiiHandle = NULL;
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mVarCheckHiiHex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-
-/**
- Dump some hexadecimal data.
- @param[in] Indent How many spaces to indent the output.
- @param[in] Offset The offset of the dump.
- @param[in] DataSize The size in bytes of UserData.
- @param[in] UserData The data to dump.
-**/
-VOID
-VarCheckHiiInternalDumpHex (
- 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] = mVarCheckHiiHex[TempByte >> 4];
- Val[Index * 3 + 1] = mVarCheckHiiHex[TempByte & 0xF];
- Val[Index * 3 + 2] = (CHAR8)((Index == 7) ? '-' : ' ');
- Str[Index] = (CHAR8)((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte);
- }
-
- Val[Index * 3] = 0;
- Str[Index] = 0;
- DEBUG ((DEBUG_INFO, "%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str));
-
- Data += Size;
- Offset += Size;
- DataSize -= Size;
- }
-}
+EFI_HANDLE mEfiVariableCheckHiiHandle = NULL;
/**
Var Check Hii Question.
@@ -148,7 +97,7 @@ VarCheckHiiQuestion (
//
DEBUG ((DEBUG_INFO, "VarCheckHiiQuestion fail: OneOf mismatch (0x%lx)\n", OneData));
DEBUG_CODE (
- VarCheckHiiInternalDumpHex (2, 0, HiiQuestion->Length, (UINT8 *)HiiQuestion);
+ DUMP_HEX (DEBUG_INFO, 0, HiiQuestion, HiiQuestion->Length, " ");
);
return FALSE;
}
@@ -159,7 +108,7 @@ VarCheckHiiQuestion (
if ((OneData != 0) && (OneData != 1)) {
DEBUG ((DEBUG_INFO, "VarCheckHiiQuestion fail: CheckBox mismatch (0x%lx)\n", OneData));
DEBUG_CODE (
- VarCheckHiiInternalDumpHex (2, 0, HiiQuestion->Length, (UINT8 *)HiiQuestion);
+ DUMP_HEX (DEBUG_INFO, 0, HiiQuestion, HiiQuestion->Length, " ");
);
return FALSE;
}
@@ -191,7 +140,7 @@ VarCheckHiiQuestion (
if ((OneData < Minimum) || (OneData > Maximum)) {
DEBUG ((DEBUG_INFO, "VarCheckHiiQuestion fail: Numeric mismatch (0x%lx)\n", OneData));
DEBUG_CODE (
- VarCheckHiiInternalDumpHex (2, 0, HiiQuestion->Length, (UINT8 *)HiiQuestion);
+ DUMP_HEX (DEBUG_INFO, 0, HiiQuestion, HiiQuestion->Length, " ");
);
return FALSE;
}
@@ -235,10 +184,10 @@ VarCheckHiiQuestion (
//
DEBUG ((DEBUG_INFO, "VarCheckHiiQuestion fail: OrderedList mismatch\n"));
DEBUG_CODE (
- VarCheckHiiInternalDumpHex (2, 0, HiiQuestion->StorageWidth * MaxContainers, (UINT8 *)Data + HiiQuestion->VarOffset);
+ DUMP_HEX (DEBUG_INFO, 0, (UINT8 *)Data + HiiQuestion->VarOffset, HiiQuestion->StorageWidth * MaxContainers, " ");
);
DEBUG_CODE (
- VarCheckHiiInternalDumpHex (2, 0, HiiQuestion->Length, (UINT8 *)HiiQuestion);
+ DUMP_HEX (DEBUG_INFO, 0, HiiQuestion, HiiQuestion->Length, " ");
);
return FALSE;
}