X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellDebug1CommandsLib%2FUefiShellDebug1CommandsLib.c;h=6ebf0024c6134c0e8b6408ced465f021deb242f2;hb=26ca6f7e1e2f3ba247d1d3150d6bfb22043a8cda;hp=945002a2ea8734a786d00d94a8bdfbe9ccaec7d5;hpb=532691c8ba90e5022174503ab0781322c6f79cab;p=mirror_edk2.git diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c index 945002a2ea..6ebf0024c6 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c @@ -13,6 +13,7 @@ **/ #include "UefiShellDebug1CommandsLib.h" +#include STATIC CONST CHAR16 mFileName[] = L"Debug1Commands"; EFI_HANDLE gShellDebug1HiiHandle = NULL; @@ -84,18 +85,10 @@ UefiShellDebug1CommandsLibConstructor ( ShellCommandRegisterCommandName(L"edit", ShellCommandRunEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EDIT) ); ShellCommandRegisterCommandName(L"hexedit", ShellCommandRunHexEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT) ); - // - // check install profile bit of the profiles mask is set - // - if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) { - ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfg , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG) ); - } - - - - ShellCommandRegisterAlias(L"dmem", L"mem"); + BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Debug1"); + return (EFI_SUCCESS); } @@ -115,77 +108,9 @@ UefiShellDebug1CommandsLibDestructor ( if (gShellDebug1HiiHandle != NULL) { HiiRemovePackages(gShellDebug1HiiHandle); } - 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%02X: %-.48a *%a*\r\n", Indent, "", Offset, Val, Str); - - Data += Size; - Offset += Size; - DataSize -= Size; - } + BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable); + return (EFI_SUCCESS); } /** @@ -206,7 +131,6 @@ DumpHex ( //Stolen from MdePkg Baselib **/ CHAR16 -EFIAPI CharToUpper ( IN CHAR16 Char ) @@ -229,7 +153,6 @@ CharToUpper ( @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found. **/ EFI_STATUS -EFIAPI GetSystemConfigurationTable ( IN EFI_GUID *TableGuid, IN OUT VOID **Table @@ -262,7 +185,6 @@ GetSystemConfigurationTable ( **/ UINTN -EFIAPI HexCharToUintn ( IN CHAR16 Char ) @@ -284,7 +206,6 @@ HexCharToUintn ( @retval EFI_SUCCESS The conversion was successful. **/ EFI_STATUS -EFIAPI ConvertStringToGuid ( IN CONST CHAR16 *StringGuid, IN OUT EFI_GUID *Guid @@ -375,7 +296,6 @@ ConvertStringToGuid ( @param[in] LastRow The last printable row. **/ VOID -EFIAPI EditorClearLine ( IN UINTN Row, IN UINTN LastCol, @@ -417,7 +337,6 @@ EditorClearLine ( @retval FALSE The character is not valid. **/ BOOLEAN -EFIAPI IsValidFileNameChar ( IN CONST CHAR16 Ch ) @@ -425,7 +344,7 @@ IsValidFileNameChar ( // // See if there are any illegal characters within the name // - if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|' || Ch == L' ') { + if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|') { return FALSE; } @@ -441,7 +360,6 @@ IsValidFileNameChar ( @retval FALSE The filename is not ok. **/ BOOLEAN -EFIAPI IsValidFileName ( IN CONST CHAR16 *Name ) @@ -483,18 +401,15 @@ IsValidFileName ( @return the valid filename. **/ CHAR16 * -EFIAPI EditGetDefaultFileName ( IN CONST CHAR16 *Extension ) { EFI_STATUS Status; UINTN Suffix; - BOOLEAN FoundNewFile; CHAR16 *FileNameTmp; Suffix = 0; - FoundNewFile = FALSE; do { FileNameTmp = CatSPrint (NULL, L"NewFile%d.%s", Suffix, Extension); @@ -539,7 +454,6 @@ EditGetDefaultFileName ( @retval EFI_INVALID_PARAMETER FileName was a directory. **/ EFI_STATUS -EFIAPI ReadFileIntoBuffer ( IN CONST CHAR16 *FileName, OUT VOID **Buffer,