]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Ebl/Command.c
ArmPlatformPkg/Bds: Fixed condition on LOAD_OPTION_CATEGORY_BOOT
[mirror_edk2.git] / EmbeddedPkg / Ebl / Command.c
index 73122e68a36f7633d56ad107ead500f1eaefa4fd..7c00bcae85748505b4d02fe8fed0a40858cf2088 100644 (file)
@@ -32,7 +32,7 @@ EBL_COMMAND_TABLE *mCmdTable[EBL_MAX_COMMAND_COUNT];
 \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
@@ -46,7 +46,7 @@ AsciiToUpper (
 \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
@@ -55,11 +55,11 @@ AsciiToUpper (
   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
@@ -85,18 +85,18 @@ AsciiStrniCmp (
     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
@@ -124,7 +124,7 @@ EblAddCommand (
       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
@@ -135,11 +135,11 @@ EblAddCommand (
 \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
@@ -167,9 +167,9 @@ EBL_ADD_COMMAND_PROTOCOL gEblAddCommand = {
 \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
@@ -193,9 +193,9 @@ EblGetCommand (
   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
@@ -226,31 +226,31 @@ CountNewLines (
   )\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
@@ -281,7 +281,7 @@ EblHelpCmd (
       }\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
@@ -300,14 +300,14 @@ EblHelpCmd (
 \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
@@ -326,14 +326,14 @@ EblExitCmd (
   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
@@ -348,7 +348,7 @@ EblExitCmd (
 \r
       Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1;\r
       MemoryMap = AllocatePages (Pages);\r
-    \r
+\r
       //\r
       // Get System MemoryMap\r
       //\r
@@ -375,9 +375,9 @@ EblExitCmd (
   // 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
@@ -385,10 +385,10 @@ EblExitCmd (
 \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
@@ -410,11 +410,11 @@ EblPauseCallback (
   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
@@ -433,8 +433,8 @@ EblPauseCmd (
   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
@@ -445,8 +445,8 @@ EblPauseCmd (
   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
@@ -471,8 +471,8 @@ EblBreakPointCmd (
   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
@@ -496,7 +496,7 @@ EblResetCmd (
     case 's':\r
       ResetType = EfiResetShutdown;\r
     }\r
-  } \r
+  }\r
 \r
   gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);\r
   return EFI_SUCCESS;\r
@@ -511,8 +511,8 @@ EblResetCmd (
   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
@@ -524,7 +524,7 @@ EblPageCmd (
   )\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
@@ -581,7 +581,7 @@ GetBytes (
   }\r
   if (Bytes >= 2) {\r
     Result = (Result << 8) + *Address++;\r
-  }  \r
+  }\r
   if (Bytes >= 3) {\r
     Result = (Result << 8) + *Address++;\r
   }\r
@@ -611,7 +611,7 @@ OutputData (
     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
@@ -667,7 +667,7 @@ OutputData (
       Blanks[Spaces] = '\0';\r
 \r
       AsciiPrint(Blanks);\r
-      \r
+\r
       Blanks[Spaces] = ' ';\r
     }\r
 \r
@@ -682,18 +682,18 @@ OutputData (
   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
@@ -706,7 +706,7 @@ WidthFromCommandName (
 {\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
@@ -728,14 +728,14 @@ WidthFromCommandName (
   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
@@ -757,7 +757,7 @@ EblHexdumpCmd (
   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
@@ -778,13 +778,13 @@ EblHexdumpCmd (
       // 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
@@ -801,7 +801,7 @@ EblHexdumpCmd (
       goto Exit;\r
     }\r
   }\r
-  \r
+\r
   // Any left over?\r
   if (Offset < Size) {\r
     Chunk = Size - Offset;\r
@@ -894,7 +894,7 @@ EblInitializeCmdTable (
 {\r
 \r
   EblAddCommands (mCmdTemplate, sizeof (mCmdTemplate)/sizeof (EBL_COMMAND_TABLE));\r
-  \r
+\r
   gBS->InstallProtocolInterface (\r
         &gExternalCmdHandle,\r
         &gEfiEblAddCommandProtocolGuid,\r