\r
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+ (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
@param chr one Ascii character\r
\r
- @return The uppercase value of Ascii character \r
+ @return The uppercase value of Ascii character\r
\r
**/\r
STATIC\r
\r
\r
/**\r
- Case insensitve comparison of two Null-terminated Unicode strings with maximum\r
+ Case insensitive comparison of two Null-terminated Unicode strings with maximum\r
lengths, and returns the difference between the first mismatched Unicode\r
characters.\r
This function compares the Null-terminated Unicode string FirstString to the\r
FirstString is identical to SecondString, then 0 is returned. Otherwise, the\r
value returned is the first mismatched Unicode character in SecondString\r
subtracted from the first mismatched Unicode character in FirstString.\r
- \r
- @param FirstString Pointer to a Null-terminated ASCII string. \r
+\r
+ @param FirstString Pointer to a Null-terminated ASCII string.\r
@param SecondString Pointer to a Null-terminated ASCII string.\r
@param Length Max length to compare.\r
- \r
+\r
@retval 0 FirstString is identical to SecondString using case insensitive\r
comparisons.\r
@retval !=0 FirstString is not identical to SecondString using case\r
SecondString++;\r
Length--;\r
}\r
- \r
+\r
return AsciiToUpper (*FirstString) - AsciiToUpper (*SecondString);\r
}\r
\r
\r
\r
/**\r
- Add a command to the mCmdTable. If there is no free space in the command \r
- table ASSERT. The mCmdTable is maintained in alphabetical order and the \r
- new entry is inserted into its sorted possition.\r
+ Add a command to the mCmdTable. If there is no free space in the command\r
+ table ASSERT. The mCmdTable is maintained in alphabetical order and the\r
+ new entry is inserted into its sorted position.\r
\r
- @param Entry Commnad Entry to add to the CmdTable\r
+ @param Entry Command Entry to add to the CmdTable\r
\r
**/\r
VOID\r
if (AsciiStriCmp (mCmdTable[Count - 1]->Name, Entry->Name) <= 0) {\r
break;\r
}\r
- \r
+\r
mCmdTable[Count] = mCmdTable[Count - 1];\r
}\r
mCmdTable[Count] = (EBL_COMMAND_TABLE *)Entry;\r
\r
\r
/**\r
- Add an set of commands to the command table. Most commonly used on static \r
+ Add an set of commands to the command table. Most commonly used on static\r
array of commands.\r
\r
@param EntryArray Pointer to array of command entries\r
- @param ArrayCount Number of commnad entries to add\r
+ @param ArrayCount Number of command entries to add\r
\r
**/\r
VOID\r
\r
\r
/**\r
- Return the best matching command for the passed in command name. The match \r
- does not have to be exact, it just needs to be unqiue. This enables commands\r
- to be shortend to the smallest set of starting characters that is unique.\r
+ Return the best matching command for the passed in command name. The match\r
+ does not have to be exact, it just needs to be unique. This enables commands\r
+ to be shortened to the smallest set of starting characters that is unique.\r
\r
@param CommandName Name of command to search for\r
\r
if (Str != NULL) {\r
// If the command includes a trailing . command extension skip it for the match.\r
// Example: hexdump.4\r
- Length = (UINTN)(Str - CommandName); \r
+ Length = (UINTN)(Str - CommandName);\r
}\r
- \r
+\r
for (Index = 0, BestMatchCount = 0, Match = NULL; Index < mCmdTableNextFreeIndex; Index++) {\r
if (AsciiStriCmp (mCmdTable[Index]->Name, CommandName) == 0) {\r
// match a command exactly\r
)\r
{\r
UINTN Count;\r
- \r
+\r
if (Str == NULL) {\r
return 0;\r
}\r
- \r
+\r
for (Count = 0; *Str != '\0'; Str++) {\r
if (Str[Count] == '\n') {\r
Count++;\r
}\r
}\r
- \r
+\r
return Count;\r
}\r
\r
\r
/**\r
- List out help information on all the commands or print extended information \r
+ List out help information on all the commands or print extended information\r
about a specific passed in command.\r
\r
Argv[0] - "help"\r
Argv[1] - Command to display help about\r
\r
@param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line. \r
- Argv[0] is the comamnd name\r
+ @param Argv Array of strings that represent the parsed command line.\r
+ Argv[0] is the command name\r
\r
@return EFI_SUCCESS\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
EblHelpCmd (\r
IN UINTN Argc,\r
IN CHAR8 **Argv\r
}\r
}\r
} else if (Argv[1] != NULL) {\r
- // Print specific help \r
+ // Print specific help\r
for (Index = 0, CurrentRow = 0; Index < mCmdTableNextFreeIndex; Index++) {\r
if (AsciiStriCmp (Argv[1], mCmdTable[Index]->Name) == 0) {\r
Ptr = (mCmdTable[Index]->Help == NULL) ? mCmdTable[Index]->HelpSummary : mCmdTable[Index]->Help;\r
\r
\r
/**\r
- Exit the EBL. If the commnad processor sees EFI_ABORTED return status it will\r
+ Exit the EBL. If the command processor sees EFI_ABORTED return status it will\r
exit the EBL.\r
\r
Argv[0] - "exit"\r
\r
@param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line. \r
- Argv[0] is the comamnd name\r
+ @param Argv Array of strings that represent the parsed command line.\r
+ Argv[0] is the command name\r
\r
@return EFI_ABORTED\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
EblExitCmd (\r
IN UINTN Argc,\r
IN CHAR8 **Argv\r
UINT32 DescriptorVersion;\r
UINTN Pages;\r
\r
- if (Argc > 1) { \r
+ if (Argc > 1) {\r
if (AsciiStriCmp (Argv[1], "efi") != 0) {\r
return EFI_ABORTED;\r
}\r
} else if (Argc == 1) {\r
return EFI_ABORTED;\r
}\r
- \r
+\r
MemoryMap = NULL;\r
MemoryMapSize = 0;\r
do {\r
\r
Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1;\r
MemoryMap = AllocatePages (Pages);\r
- \r
+\r
//\r
// Get System MemoryMap\r
//\r
// At this point it is very dangerous to do things EFI as most of EFI is now gone.\r
// This command is useful if you are working with a debugger as it will shutdown\r
// DMA and other things that could break a soft resets.\r
- // \r
+ //\r
CpuDeadLoop ();\r
- \r
+\r
// Should never get here, but makes the compiler happy\r
return EFI_ABORTED;\r
}\r
\r
/**\r
Update the screen by decrementing the timeout value.\r
- This AsciiPrint has to match the AsciiPrint in \r
- EblPauseCmd. \r
+ This AsciiPrint has to match the AsciiPrint in\r
+ EblPauseCmd.\r
\r
- @param ElaspedTime Current timout value remaining\r
+ @param ElaspedTime Current timeout value remaining\r
\r
**/\r
VOID\r
Argv[1] - timeout value is decimal seconds\r
\r
@param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line. \r
- Argv[0] is the comamnd name\r
+ @param Argv Array of strings that represent the parsed command line.\r
+ Argv[0] is the command name\r
\r
@return EFI_SUCCESS Timeout expired with no input\r
- @return EFI_TIMEOUT Stop procesing other commands on the same command line\r
+ @return EFI_TIMEOUT Stop processing other commands on the same command line\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
EblPauseCmd (\r
IN UINTN Argc,\r
IN CHAR8 **Argv\r
Status = EblGetCharKey (&Key, Delay, EblPauseCallback);\r
AsciiPrint ("\n");\r
\r
- // If we timeout then the pause succeded thus return success\r
- // If we get a key return timout to stop other commnad on this cmd line\r
+ // If we timeout then the pause succeeded thus return success\r
+ // If we get a key return timeout to stop other command on this cmd line\r
return (Status == EFI_SUCCESS) ? EFI_TIMEOUT : EFI_SUCCESS;;\r
}\r
\r
Argv[0] - "break"\r
\r
@param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line. \r
- Argv[0] is the comamnd name\r
+ @param Argv Array of strings that represent the parsed command line.\r
+ Argv[0] is the command name\r
\r
@return EFI_SUCCESS\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
EblBreakPointCmd (\r
IN UINTN Argc,\r
IN CHAR8 **Argv\r
Argv[1] - warm or shutdown reset type\r
\r
@param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line. \r
- Argv[0] is the comamnd name\r
+ @param Argv Array of strings that represent the parsed command line.\r
+ Argv[0] is the command name\r
\r
@return EFI_SUCCESS\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
EblResetCmd (\r
IN UINTN Argc,\r
IN CHAR8 **Argv\r
case 's':\r
ResetType = EfiResetShutdown;\r
}\r
- } \r
+ }\r
\r
gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);\r
return EFI_SUCCESS;\r
Argv[1] - on or off\r
\r
@param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line. \r
- Argv[0] is the comamnd name\r
+ @param Argv Array of strings that represent the parsed command line.\r
+ Argv[0] is the command name\r
\r
@return EFI_SUCCESS\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
EblPageCmd (\r
IN UINTN Argc,\r
IN CHAR8 **Argv\r
)\r
{\r
if (Argc <= 1) {\r
- // toggle setting \r
+ // toggle setting\r
gPageBreak = (gPageBreak) ? FALSE : TRUE;\r
} else {\r
// use argv to set the value\r
}\r
\r
EFI_STATUS\r
+EFIAPI\r
EblSleepCmd (\r
IN UINTN Argc,\r
IN CHAR8 **Argv\r
}\r
if (Bytes >= 2) {\r
Result = (Result << 8) + *Address++;\r
- } \r
+ }\r
if (Bytes >= 3) {\r
Result = (Result << 8) + *Address++;\r
}\r
AsciiPrint ("%08x: ", Offset);\r
for (Line = 0; (Line < 0x10) && (Address < EndAddress);) {\r
Bytes = EndAddress - Address;\r
- \r
+\r
switch (Width) {\r
case 4:\r
if (Bytes >= 4) {\r
TextLine[Line++] = ConvertToTextLine(*Address++);\r
break;\r
\r
- default:\r
- AsciiPrint ("Width must be 1, 2, or 4!\n");\r
- return EFI_INVALID_PARAMETER;\r
+ default:\r
+ AsciiPrint ("Width must be 1, 2, or 4!\n");\r
+ return EFI_INVALID_PARAMETER;\r
}\r
}\r
\r
Blanks[Spaces] = '\0';\r
\r
AsciiPrint(Blanks);\r
- \r
+\r
Blanks[Spaces] = ' ';\r
}\r
\r
if (Length % Width != 0) {\r
AsciiPrint ("%08x\n", Offset);\r
}\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
\r
/**\r
See if command contains .# where # is a number. Return # as the Width\r
- or 1 as the default Width for commands. \r
- \r
+ or 1 as the default Width for commands.\r
+\r
Example hexdump.4 returns a width of 4.\r
\r
- @param Argv Argv[0] is the comamnd name\r
+ @param Argv Argv[0] is the command name\r
\r
@return Width of command\r
\r
{\r
CHAR8 *Str;\r
UINTN Width;\r
- \r
+\r
//Hexdump.2 HexDump.4 mean use a different width\r
Str = AsciiStrStr (Argv, ".");\r
if (Str != NULL) {\r
Toggle page break global. This turns on and off prompting to Quit or hit any\r
key to continue when a command is about to scroll the screen with its output\r
\r
- Argv[0] - "hexdump"[.#] # is optional 1,2, or 4 for width \r
- Argv[1] - Device or File to dump. \r
+ Argv[0] - "hexdump"[.#] # is optional 1,2, or 4 for width\r
+ Argv[1] - Device or File to dump.\r
Argv[2] - Optional offset to start dumping\r
Argv[3] - Optional number of bytes to dump\r
\r
@param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line. \r
- Argv[0] is the comamnd name\r
+ @param Argv Array of strings that represent the parsed command line.\r
+ Argv[0] is the command name\r
\r
@return EFI_SUCCESS\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
EblHexdumpCmd (\r
IN UINTN Argc,\r
IN CHAR8 **Argv\r
if ((Argc < 2) || (Argc > 4)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
Width = WidthFromCommandName (Argv[0], 1);\r
if ((Width != 1) && (Width != 2) && (Width != 4)) {\r
return EFI_INVALID_PARAMETER;\r
// Make sure size includes the part of the file we have skipped\r
Size += Offset;\r
}\r
- } \r
+ }\r
\r
Status = EfiSeek (File, Offset, EfiSeekStart);\r
if (EFI_ERROR (Status)) {\r
goto Exit;\r
}\r
- \r
+\r
for (; Offset + HEXDUMP_CHUNK <= Size; Offset += Chunk) {\r
Chunk = HEXDUMP_CHUNK;\r
Status = EfiRead (File, Location, &Chunk);\r
goto Exit;\r
}\r
}\r
- \r
+\r
// Any left over?\r
if (Offset < Size) {\r
Chunk = Size - Offset;\r
{\r
\r
EblAddCommands (mCmdTemplate, sizeof (mCmdTemplate)/sizeof (EBL_COMMAND_TABLE));\r
- \r
+\r
gBS->InstallProtocolInterface (\r
&gExternalCmdHandle,\r
&gEfiEblAddCommandProtocolGuid,\r