**/\r
\r
#include "UefiShellDebug1CommandsLib.h"\r
+#include <Library/BcfgCommandLib.h>\r
\r
STATIC CONST CHAR16 mFileName[] = L"Debug1Commands";\r
EFI_HANDLE gShellDebug1HiiHandle = NULL;\r
-CONST EFI_GUID gShellDebug1HiiGuid = \\r
- { \\r
- 0x25f200aa, 0xd3cb, 0x470a, { 0xbf, 0x51, 0xe7, 0xd1, 0x62, 0xd2, 0x2e, 0x6f } \\r
- };\r
\r
/**\r
Gets the debug file name. This will be used if HII is not working.\r
// check our bit of the profiles mask\r
//\r
if ((PcdGet8(PcdShellProfileMask) & BIT1) == 0) {\r
- return (EFI_UNSUPPORTED);\r
+ return (EFI_SUCCESS);\r
}\r
\r
//\r
ShellCommandRegisterCommandName(L"edit", ShellCommandRunEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EDIT) );\r
ShellCommandRegisterCommandName(L"hexedit", ShellCommandRunHexEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT) );\r
\r
- //\r
- // check install profile bit of the profiles mask is set\r
- //\r
- if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {\r
- ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfg , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG) );\r
- }\r
-\r
-\r
-\r
-\r
ShellCommandRegisterAlias(L"dmem", L"mem");\r
\r
+ BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Debug1");\r
+\r
return (EFI_SUCCESS);\r
}\r
\r
if (gShellDebug1HiiHandle != NULL) {\r
HiiRemovePackages(gShellDebug1HiiHandle);\r
}\r
- return (EFI_SUCCESS);\r
-}\r
-\r
-STATIC CONST CHAR8 Hex[] = {\r
- '0',\r
- '1',\r
- '2',\r
- '3',\r
- '4',\r
- '5',\r
- '6',\r
- '7',\r
- '8',\r
- '9',\r
- 'A',\r
- 'B',\r
- 'C',\r
- 'D',\r
- 'E',\r
- 'F'\r
-};\r
-\r
-/**\r
- Dump some hexadecimal data to the screen.\r
-\r
- @param[in] Indent How many spaces to indent the output.\r
- @param[in] Offset The offset of the printing.\r
- @param[in] DataSize The size in bytes of UserData.\r
- @param[in] UserData The data to print out.\r
-**/\r
-VOID\r
-EFIAPI\r
-DumpHex (\r
- IN UINTN Indent,\r
- IN UINTN Offset,\r
- IN UINTN DataSize,\r
- IN VOID *UserData\r
- )\r
-{\r
- UINT8 *Data;\r
-\r
- CHAR8 Val[50];\r
-\r
- CHAR8 Str[20];\r
-\r
- UINT8 TempByte;\r
- UINTN Size;\r
- UINTN Index;\r
-\r
- Data = UserData;\r
- while (DataSize != 0) {\r
- Size = 16;\r
- if (Size > DataSize) {\r
- Size = DataSize;\r
- }\r
-\r
- for (Index = 0; Index < Size; Index += 1) {\r
- TempByte = Data[Index];\r
- Val[Index * 3 + 0] = Hex[TempByte >> 4];\r
- Val[Index * 3 + 1] = Hex[TempByte & 0xF];\r
- Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' ');\r
- Str[Index] = (CHAR8) ((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte);\r
- }\r
-\r
- Val[Index * 3] = 0;\r
- Str[Index] = 0;\r
- ShellPrintEx(-1, -1, L"%*a%02X: %-.48a *%a*\r\n", Indent, "", Offset, Val, Str);\r
\r
- Data += Size;\r
- Offset += Size;\r
- DataSize -= Size;\r
- }\r
+ BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable);\r
+ return (EFI_SUCCESS);\r
}\r
\r
/**\r
//Stolen from MdePkg Baselib\r
**/\r
CHAR16\r
-EFIAPI\r
CharToUpper (\r
IN CHAR16 Char\r
)\r
Function returns a system configuration table that is stored in the\r
EFI System Table based on the provided GUID.\r
\r
- @param[in] TableGuid A pointer to the table's GUID type.\r
- @param[in,out] Table On exit, a pointer to a system configuration table.\r
+ @param[in] TableGuid A pointer to the table's GUID type.\r
+ @param[in, out] Table On exit, a pointer to a system configuration table.\r
\r
@retval EFI_SUCCESS A configuration table matching TableGuid was found.\r
@retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.\r
**/\r
EFI_STATUS\r
-EFIAPI\r
GetSystemConfigurationTable (\r
IN EFI_GUID *TableGuid,\r
IN OUT VOID **Table\r
\r
**/\r
UINTN\r
-EFIAPI\r
HexCharToUintn (\r
IN CHAR16 Char\r
)\r
/**\r
Convert a string representation of a guid to a Guid value.\r
\r
- @param[in] StringGuid The pointer to the string of a guid.\r
- @param[in,out] Guid The pointer to the GUID structure to populate.\r
+ @param[in] StringGuid The pointer to the string of a guid.\r
+ @param[in, out] Guid The pointer to the GUID structure to populate.\r
\r
@retval EFI_INVALID_PARAMETER A parameter was invalid.\r
@retval EFI_SUCCESS The conversion was successful.\r
**/\r
EFI_STATUS\r
-EFIAPI\r
ConvertStringToGuid (\r
IN CONST CHAR16 *StringGuid,\r
IN OUT EFI_GUID *Guid\r
} \r
TempCopy = NULL;\r
TempCopy = StrnCatGrow(&TempCopy, NULL, StringGuid, 0);\r
+ if (TempCopy == NULL) {\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
Walker = TempCopy;\r
TempSpot = StrStr(Walker, L"-");\r
- *TempSpot = CHAR_NULL;\r
+ if (TempSpot != NULL) {\r
+ *TempSpot = CHAR_NULL;\r
+ }\r
Status = ShellConvertStringToUint64(Walker, &TempVal, TRUE, FALSE);\r
if (EFI_ERROR(Status)) {\r
FreePool(TempCopy);\r
Guid->Data1 = (UINT32)TempVal;\r
Walker += 9;\r
TempSpot = StrStr(Walker, L"-");\r
- *TempSpot = CHAR_NULL;\r
+ if (TempSpot != NULL) {\r
+ *TempSpot = CHAR_NULL;\r
+ }\r
Status = ShellConvertStringToUint64(Walker, &TempVal, TRUE, FALSE);\r
if (EFI_ERROR(Status)) {\r
FreePool(TempCopy);\r
Guid->Data2 = (UINT16)TempVal;\r
Walker += 5;\r
TempSpot = StrStr(Walker, L"-");\r
- *TempSpot = CHAR_NULL;\r
+ if (TempSpot != NULL) {\r
+ *TempSpot = CHAR_NULL;\r
+ }\r
Status = ShellConvertStringToUint64(Walker, &TempVal, TRUE, FALSE);\r
if (EFI_ERROR(Status)) {\r
FreePool(TempCopy);\r
return (EFI_SUCCESS);\r
}\r
\r
-CHAR16 TempBufferCatSPrint[1000];\r
-/** \r
- Appends a formatted Unicode string to a Null-terminated Unicode string\r
- \r
- This function appends a formatted Unicode string to the Null-terminated \r
- Unicode string specified by String. String is optional and may be NULL.\r
- Storage for the formatted Unicode string returned is allocated using \r
- AllocateZeroPool(). The pointer to the appended string is returned. The caller\r
- is responsible for freeing the returned string.\r
- \r
- If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().\r
- If Format is NULL, then ASSERT().\r
- If Format is not aligned on a 16-bit boundary, then ASSERT().\r
- \r
- @param String A null-terminated Unicode string.\r
- @param FormatString A null-terminated Unicode format string.\r
- @param ... The variable argument list whose contents are accessed based \r
- on the format string specified by Format.\r
-\r
- @retval NULL There was not enough available memory.\r
- @return Null terminated Unicode string is that is the formatted \r
- string appended to String.\r
- @sa CatVSPrint\r
-**/\r
-CHAR16*\r
-EFIAPI\r
-CatSPrint (\r
- IN CONST CHAR16 *String OPTIONAL,\r
- IN CONST CHAR16 *FormatString,\r
- ...\r
- )\r
-{\r
- VA_LIST Marker;\r
- UINTN StringLength;\r
- if (String != NULL) {\r
- StrCpy(TempBufferCatSPrint, String);\r
- } else {\r
- *TempBufferCatSPrint = CHAR_NULL;\r
- }\r
- VA_START (Marker, FormatString);\r
- StringLength = StrLen(TempBufferCatSPrint);\r
-\r
- UnicodeVSPrint(TempBufferCatSPrint+StrLen(TempBufferCatSPrint), 1000-StringLength, FormatString, Marker);\r
- return (AllocateCopyPool(StrSize(TempBufferCatSPrint), TempBufferCatSPrint));\r
-}\r
-\r
/**\r
Clear the line at the specified Row.\r
\r
@param[in] LastRow The last printable row.\r
**/\r
VOID\r
-EFIAPI\r
EditorClearLine (\r
IN UINTN Row,\r
IN UINTN LastCol,\r
@retval FALSE The character is not valid.\r
**/\r
BOOLEAN\r
-EFIAPI\r
IsValidFileNameChar (\r
IN CONST CHAR16 Ch\r
)\r
//\r
// See if there are any illegal characters within the name\r
//\r
- if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|' || Ch == L' ') {\r
+ if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|') {\r
return FALSE;\r
}\r
\r
@retval FALSE The filename is not ok.\r
**/\r
BOOLEAN\r
-EFIAPI\r
IsValidFileName (\r
IN CONST CHAR16 *Name\r
)\r
@return the valid filename.\r
**/\r
CHAR16 *\r
-EFIAPI\r
EditGetDefaultFileName (\r
IN CONST CHAR16 *Extension\r
)\r
{\r
EFI_STATUS Status;\r
UINTN Suffix;\r
- BOOLEAN FoundNewFile;\r
CHAR16 *FileNameTmp;\r
\r
Suffix = 0;\r
- FoundNewFile = FALSE;\r
\r
do {\r
FileNameTmp = CatSPrint (NULL, L"NewFile%d.%s", Suffix, Extension);\r
@retval EFI_INVALID_PARAMETER FileName was a directory.\r
**/\r
EFI_STATUS\r
-EFIAPI\r
ReadFileIntoBuffer (\r
IN CONST CHAR16 *FileName,\r
OUT VOID **Buffer,\r