Browse Source

ShellPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the ShellPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Michael Kubacki 2 years ago
parent
commit
47d20b54f9
100 changed files with 9081 additions and 8076 deletions
  1. 1 1
      ShellPkg/Application/AcpiViewApp/AcpiViewApp.c
  2. 359 329
      ShellPkg/Application/Shell/ConsoleLogger.c
  3. 49 50
      ShellPkg/Application/Shell/ConsoleLogger.h
  4. 124 110
      ShellPkg/Application/Shell/ConsoleWrappers.c
  5. 9 10
      ShellPkg/Application/Shell/ConsoleWrappers.h
  6. 10 11
      ShellPkg/Application/Shell/FileHandleInternal.h
  7. 355 336
      ShellPkg/Application/Shell/FileHandleWrappers.c
  8. 16 17
      ShellPkg/Application/Shell/FileHandleWrappers.h
  9. 359 292
      ShellPkg/Application/Shell/Shell.c
  10. 85 89
      ShellPkg/Application/Shell/Shell.h
  11. 193 164
      ShellPkg/Application/Shell/ShellEnvVar.c
  12. 28 30
      ShellPkg/Application/Shell/ShellEnvVar.h
  13. 257 230
      ShellPkg/Application/Shell/ShellManParser.c
  14. 7 8
      ShellPkg/Application/Shell/ShellManParser.h
  15. 406 351
      ShellPkg/Application/Shell/ShellParametersProtocol.c
  16. 15 16
      ShellPkg/Application/Shell/ShellParametersProtocol.h
  17. 349 306
      ShellPkg/Application/Shell/ShellProtocol.c
  18. 113 113
      ShellPkg/Application/Shell/ShellProtocol.h
  19. 5 3
      ShellPkg/Application/ShellCTestApp/ShellCTestApp.c
  20. 1 1
      ShellPkg/Application/ShellExecTestApp/SA.c
  21. 16 11
      ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c
  22. 361 326
      ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c
  23. 41 41
      ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h
  24. 5 4
      ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c
  25. 16 13
      ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c
  26. 39 40
      ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h
  27. 359 233
      ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c
  28. 77 72
      ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c
  29. 12 12
      ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c
  30. 16 15
      ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h
  31. 239 240
      ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c
  32. 19 18
      ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h
  33. 5 5
      ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c
  34. 13 13
      ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c
  35. 274 155
      ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
  36. 6 5
      ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h
  37. 5 4
      ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c
  38. 16 13
      ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c
  39. 1 1
      ShellPkg/Include/Guid/ShellAliasGuid.h
  40. 1 1
      ShellPkg/Include/Guid/ShellEnvironment2Ext.h
  41. 12 12
      ShellPkg/Include/Guid/ShellLibHiiGuid.h
  42. 1 1
      ShellPkg/Include/Guid/ShellMapGuid.h
  43. 1 1
      ShellPkg/Include/Guid/ShellPkgTokenSpace.h
  44. 1 1
      ShellPkg/Include/Guid/ShellVariableGuid.h
  45. 2 2
      ShellPkg/Include/Library/AcpiViewCommandLib.h
  46. 0 1
      ShellPkg/Include/Library/BcfgCommandLib.h
  47. 62 64
      ShellPkg/Include/Library/HandleParsingLib.h
  48. 2 3
      ShellPkg/Include/Library/ShellCEntryLib.h
  49. 93 96
      ShellPkg/Include/Library/ShellCommandLib.h
  50. 149 150
      ShellPkg/Include/Library/ShellLib.h
  51. 127 128
      ShellPkg/Include/Protocol/EfiShellEnvironment2.h
  52. 13 13
      ShellPkg/Include/Protocol/EfiShellInterface.h
  53. 329 275
      ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
  54. 35 37
      ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
  55. 102 88
      ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
  56. 134 135
      ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
  57. 28 26
      ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
  58. 12 12
      ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
  59. 63 47
      ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
  60. 5 5
      ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
  61. 26 24
      ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c
  62. 10 10
      ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h
  63. 28 27
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.c
  64. 10 10
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.h
  65. 133 128
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c
  66. 12 12
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c
  67. 83 74
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
  68. 4 4
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c
  69. 21 21
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c
  70. 122 115
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
  71. 102 96
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
  72. 118 102
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c
  73. 167 157
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
  74. 154 141
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
  75. 16 16
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h
  76. 17 17
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c
  77. 158 152
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
  78. 3 3
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h
  79. 98 91
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c
  80. 6 6
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h
  81. 32 30
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
  82. 28 24
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
  83. 41 38
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
  84. 123 121
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
  85. 4 4
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c
  86. 28 26
      ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
  87. 86 75
      ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
  88. 309 277
      ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
  89. 27 24
      ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c
  90. 245 218
      ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
  91. 297 251
      ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
  92. 14 15
      ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
  93. 147 126
      ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c
  94. 261 252
      ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c
  95. 0 1
      ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h
  96. 59 56
      ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c
  97. 86 75
      ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
  98. 293 223
      ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
  99. 48 43
      ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c
  100. 232 205
      ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c

+ 1 - 1
ShellPkg/Application/AcpiViewApp/AcpiViewApp.c

@@ -21,7 +21,7 @@
 // the resource section. Thus the application can use '-?' option to show help message in
 // the resource section. Thus the application can use '-?' option to show help message in
 // Shell.
 // Shell.
 //
 //
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_ACPIVIEW);
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID  mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_ACPIVIEW);
 
 
 /**
 /**
   Application Entry Point wrapper around the shell command
   Application Entry Point wrapper around the shell command

File diff suppressed because it is too large
+ 359 - 329
ShellPkg/Application/Shell/ConsoleLogger.c


+ 49 - 50
ShellPkg/Application/Shell/ConsoleLogger.h

@@ -12,31 +12,31 @@
 
 
 #define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('c', 'o', 'P', 'D')
 #define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('c', 'o', 'P', 'D')
 
 
-typedef struct _CONSOLE_LOGGER_PRIVATE_DATA{
-  UINTN                             Signature;
-  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   OurConOut;        ///< the protocol we installed onto the system table
-  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *OldConOut;       ///< old protocol to reinstall upon exiting
-  EFI_HANDLE                        OldConHandle;     ///< old protocol handle
-  UINTN                             ScreenCount;      ///< How many screens worth of data to save
-  CHAR16                            *Buffer;          ///< Buffer to save data
-  UINTN                             BufferSize;       ///< size of buffer in bytes
-
-                                                      //  start row is the top of the screen
-  UINTN                             OriginalStartRow; ///< What the originally visible start row was
-  UINTN                             CurrentStartRow;  ///< what the currently visible start row is
-
-  UINTN                             RowsPerScreen;    ///< how many rows the screen can display
-  UINTN                             ColsPerScreen;    ///< how many columns the screen can display
-
-  INT32                             *Attributes;      ///< Buffer for Attribute to be saved for each character
-  UINTN                             AttribSize;       ///< Size of Attributes in bytes
-
-  EFI_SIMPLE_TEXT_OUTPUT_MODE       HistoryMode;      ///< mode of the history log
-  BOOLEAN                           Enabled;          ///< Set to FALSE when a break is requested.
-  UINTN                             RowCounter;       ///< Initial row of each print job.
+typedef struct _CONSOLE_LOGGER_PRIVATE_DATA {
+  UINTN                              Signature;
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    OurConOut;       ///< the protocol we installed onto the system table
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *OldConOut;      ///< old protocol to reinstall upon exiting
+  EFI_HANDLE                         OldConHandle;    ///< old protocol handle
+  UINTN                              ScreenCount;     ///< How many screens worth of data to save
+  CHAR16                             *Buffer;         ///< Buffer to save data
+  UINTN                              BufferSize;      ///< size of buffer in bytes
+
+  //  start row is the top of the screen
+  UINTN                              OriginalStartRow; ///< What the originally visible start row was
+  UINTN                              CurrentStartRow;  ///< what the currently visible start row is
+
+  UINTN                              RowsPerScreen;   ///< how many rows the screen can display
+  UINTN                              ColsPerScreen;   ///< how many columns the screen can display
+
+  INT32                              *Attributes;     ///< Buffer for Attribute to be saved for each character
+  UINTN                              AttribSize;      ///< Size of Attributes in bytes
+
+  EFI_SIMPLE_TEXT_OUTPUT_MODE        HistoryMode;     ///< mode of the history log
+  BOOLEAN                            Enabled;         ///< Set to FALSE when a break is requested.
+  UINTN                              RowCounter;      ///< Initial row of each print job.
 } CONSOLE_LOGGER_PRIVATE_DATA;
 } CONSOLE_LOGGER_PRIVATE_DATA;
 
 
-#define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a) CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE)
+#define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a)  CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE)
 
 
 /**
 /**
   Install our intermediate ConOut into the system table to
   Install our intermediate ConOut into the system table to
@@ -52,9 +52,9 @@ typedef struct _CONSOLE_LOGGER_PRIVATE_DATA{
   @sa InstallProtocolInterface
   @sa InstallProtocolInterface
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ConsoleLoggerInstall(
-  IN CONST UINTN ScreensToSave,
-  OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo
+ConsoleLoggerInstall (
+  IN CONST UINTN                   ScreensToSave,
+  OUT CONSOLE_LOGGER_PRIVATE_DATA  **ConsoleInfo
   );
   );
 
 
 /**
 /**
@@ -67,8 +67,8 @@ ConsoleLoggerInstall(
   @return other           The operation failed.  This was from UninstallProtocolInterface.
   @return other           The operation failed.  This was from UninstallProtocolInterface.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ConsoleLoggerUninstall(
-  IN OUT CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerUninstall (
+  IN OUT CONSOLE_LOGGER_PRIVATE_DATA  *ConsoleInfo
   );
   );
 
 
 /**
 /**
@@ -84,10 +84,10 @@ ConsoleLoggerUninstall(
   @param[in] ConsoleInfo  The pointer to the instance of the console logger information.
   @param[in] ConsoleInfo  The pointer to the instance of the console logger information.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ConsoleLoggerDisplayHistory(
-  IN CONST BOOLEAN  Forward,
-  IN CONST UINTN    Rows,
-  IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerDisplayHistory (
+  IN CONST BOOLEAN                Forward,
+  IN CONST UINTN                  Rows,
+  IN CONSOLE_LOGGER_PRIVATE_DATA  *ConsoleInfo
   );
   );
 
 
 /**
 /**
@@ -100,8 +100,8 @@ ConsoleLoggerDisplayHistory(
   @sa UpdateDisplayFromHistory
   @sa UpdateDisplayFromHistory
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ConsoleLoggerStopHistory(
-  IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerStopHistory (
+  IN CONSOLE_LOGGER_PRIVATE_DATA  *ConsoleInfo
   );
   );
 
 
 /**
 /**
@@ -112,8 +112,8 @@ ConsoleLoggerStopHistory(
   @return other           The operation failed.
   @return other           The operation failed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-UpdateDisplayFromHistory(
-  IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+UpdateDisplayFromHistory (
+  IN CONSOLE_LOGGER_PRIVATE_DATA  *ConsoleInfo
   );
   );
 
 
 /**
 /**
@@ -129,8 +129,8 @@ UpdateDisplayFromHistory(
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ConsoleLoggerReset (
 ConsoleLoggerReset (
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  BOOLEAN                         ExtendedVerification
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  BOOLEAN                          ExtendedVerification
   );
   );
 
 
 /**
 /**
@@ -151,9 +151,9 @@ ConsoleLoggerReset (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ConsoleLoggerOutputString(
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  CHAR16                          *WString
+ConsoleLoggerOutputString (
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  CHAR16                           *WString
   );
   );
 
 
 /**
 /**
@@ -173,8 +173,8 @@ ConsoleLoggerOutputString(
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ConsoleLoggerTestString (
 ConsoleLoggerTestString (
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  CHAR16                          *WString
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  CHAR16                           *WString
   );
   );
 
 
 /**
 /**
@@ -237,8 +237,8 @@ ConsoleLoggerSetMode (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ConsoleLoggerSetAttribute (
 ConsoleLoggerSetAttribute (
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  UINTN                           Attribute
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  UINTN                            Attribute
   );
   );
 
 
 /**
 /**
@@ -275,8 +275,8 @@ EFI_STATUS
 EFIAPI
 EFIAPI
 ConsoleLoggerSetCursorPosition (
 ConsoleLoggerSetCursorPosition (
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
-  IN  UINTN                         Column,
-  IN  UINTN                         Row
+  IN  UINTN                            Column,
+  IN  UINTN                            Row
   );
   );
 
 
 /**
 /**
@@ -309,9 +309,8 @@ ConsoleLoggerEnableCursor (
   history buffers.
   history buffers.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ConsoleLoggerResetBuffers(
-  IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerResetBuffers (
+  IN CONSOLE_LOGGER_PRIVATE_DATA  *ConsoleInfo
   );
   );
 
 
 #endif //_CONSOLE_LOGGER_HEADER_
 #endif //_CONSOLE_LOGGER_HEADER_
-

+ 124 - 110
ShellPkg/Application/Shell/ConsoleWrappers.c

@@ -9,20 +9,20 @@
 
 
 #include "Shell.h"
 #include "Shell.h"
 
 
-extern BOOLEAN AsciiRedirection;
+extern BOOLEAN  AsciiRedirection;
 
 
 typedef struct {
 typedef struct {
-  EFI_SIMPLE_TEXT_INPUT_PROTOCOL  SimpleTextIn;
-  SHELL_FILE_HANDLE               FileHandle;
-  EFI_HANDLE                      TheHandle;
-  UINT64                          RemainingBytesOfInputFile;
+  EFI_SIMPLE_TEXT_INPUT_PROTOCOL    SimpleTextIn;
+  SHELL_FILE_HANDLE                 FileHandle;
+  EFI_HANDLE                        TheHandle;
+  UINT64                            RemainingBytesOfInputFile;
 } SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
 } SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
 
 
 typedef struct {
 typedef struct {
-  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut;
-  SHELL_FILE_HANDLE               FileHandle;
-  EFI_HANDLE                      TheHandle;
-  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalSimpleTextOut;
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    SimpleTextOut;
+  SHELL_FILE_HANDLE                  FileHandle;
+  EFI_HANDLE                         TheHandle;
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *OriginalSimpleTextOut;
 } SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
 } SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
 
 
 /**
 /**
@@ -36,8 +36,8 @@ typedef struct {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ConInWaitForKey (
 ConInWaitForKey (
-  IN  EFI_EVENT       Event,
-  IN  VOID            *Context
+  IN  EFI_EVENT  Event,
+  IN  VOID       *Context
   )
   )
 {
 {
   gBS->SignalEvent (Event);
   gBS->SignalEvent (Event);
@@ -53,9 +53,9 @@ ConInWaitForKey (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-FileBasedSimpleTextInReset(
-  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
-  IN BOOLEAN                        ExtendedVerification
+FileBasedSimpleTextInReset (
+  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *This,
+  IN BOOLEAN                         ExtendedVerification
   )
   )
 {
 {
   return (EFI_SUCCESS);
   return (EFI_SUCCESS);
@@ -71,18 +71,18 @@ FileBasedSimpleTextInReset(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-FileBasedSimpleTextInReadKeyStroke(
-  IN      EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
-  IN OUT  EFI_INPUT_KEY                  *Key
+FileBasedSimpleTextInReadKeyStroke (
+  IN      EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *This,
+  IN OUT  EFI_INPUT_KEY                   *Key
   )
   )
 {
 {
-  UINTN Size;
-  UINTN CharSize;
+  UINTN  Size;
+  UINTN  CharSize;
 
 
   //
   //
   // Verify the parameters
   // Verify the parameters
   //
   //
-  if (Key == NULL || This == NULL) {
+  if ((Key == NULL) || (This == NULL)) {
     return (EFI_INVALID_PARAMETER);
     return (EFI_INVALID_PARAMETER);
   }
   }
 
 
@@ -93,13 +93,14 @@ FileBasedSimpleTextInReadKeyStroke(
     return (EFI_NOT_READY);
     return (EFI_NOT_READY);
   }
   }
 
 
-  Size = sizeof(CHAR16);
+  Size = sizeof (CHAR16);
 
 
-  if(!AsciiRedirection) {
-    CharSize = sizeof(CHAR16);
+  if (!AsciiRedirection) {
+    CharSize = sizeof (CHAR16);
   } else {
   } else {
-    CharSize = sizeof(CHAR8);
+    CharSize = sizeof (CHAR8);
   }
   }
+
   //
   //
   // Decrement the amount of free space by Size or set to zero (for odd length files)
   // Decrement the amount of free space by Size or set to zero (for odd length files)
   //
   //
@@ -110,10 +111,11 @@ FileBasedSimpleTextInReadKeyStroke(
   }
   }
 
 
   Key->ScanCode = 0;
   Key->ScanCode = 0;
-  return (ShellInfoObject.NewEfiShellProtocol->ReadFile(
-    ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle,
-    &Size,
-    &Key->UnicodeChar));
+  return (ShellInfoObject.NewEfiShellProtocol->ReadFile (
+                                                 ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle,
+                                                 &Size,
+                                                 &Key->UnicodeChar
+                                                 ));
 }
 }
 
 
 /**
 /**
@@ -126,8 +128,8 @@ FileBasedSimpleTextInReadKeyStroke(
   @retval NULL                There was insufficient memory available.
   @retval NULL                There was insufficient memory available.
   @return                     A pointer to the allocated protocol structure;
   @return                     A pointer to the allocated protocol structure;
 **/
 **/
-EFI_SIMPLE_TEXT_INPUT_PROTOCOL*
-CreateSimpleTextInOnFile(
+EFI_SIMPLE_TEXT_INPUT_PROTOCOL *
+CreateSimpleTextInOnFile (
   IN SHELL_FILE_HANDLE  FileHandleToUse,
   IN SHELL_FILE_HANDLE  FileHandleToUse,
   IN EFI_HANDLE         *HandleLocation
   IN EFI_HANDLE         *HandleLocation
   )
   )
@@ -137,17 +139,17 @@ CreateSimpleTextInOnFile(
   UINT64                                CurrentPosition;
   UINT64                                CurrentPosition;
   UINT64                                FileSize;
   UINT64                                FileSize;
 
 
-  if (HandleLocation == NULL || FileHandleToUse == NULL) {
+  if ((HandleLocation == NULL) || (FileHandleToUse == NULL)) {
     return (NULL);
     return (NULL);
   }
   }
 
 
-  ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL));
+  ProtocolToReturn = AllocateZeroPool (sizeof (SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL));
   if (ProtocolToReturn == NULL) {
   if (ProtocolToReturn == NULL) {
     return (NULL);
     return (NULL);
   }
   }
 
 
-  ShellGetFileSize    (FileHandleToUse, &FileSize);
-  ShellGetFilePosition(FileHandleToUse, &CurrentPosition);
+  ShellGetFileSize (FileHandleToUse, &FileSize);
+  ShellGetFilePosition (FileHandleToUse, &CurrentPosition);
 
 
   //
   //
   // Initialize the protocol members
   // Initialize the protocol members
@@ -165,21 +167,23 @@ CreateSimpleTextInOnFile(
                   &ProtocolToReturn->SimpleTextIn.WaitForKey
                   &ProtocolToReturn->SimpleTextIn.WaitForKey
                   );
                   );
 
 
-  if (EFI_ERROR(Status)) {
-    FreePool(ProtocolToReturn);
+  if (EFI_ERROR (Status)) {
+    FreePool (ProtocolToReturn);
     return (NULL);
     return (NULL);
   }
   }
-  ///@todo possibly also install SimpleTextInputEx on the handle at this point.
-  Status = gBS->InstallProtocolInterface(
-    &(ProtocolToReturn->TheHandle),
-    &gEfiSimpleTextInProtocolGuid,
-    EFI_NATIVE_INTERFACE,
-    &(ProtocolToReturn->SimpleTextIn));
-  if (!EFI_ERROR(Status)) {
+
+  /// @todo possibly also install SimpleTextInputEx on the handle at this point.
+  Status = gBS->InstallProtocolInterface (
+                  &(ProtocolToReturn->TheHandle),
+                  &gEfiSimpleTextInProtocolGuid,
+                  EFI_NATIVE_INTERFACE,
+                  &(ProtocolToReturn->SimpleTextIn)
+                  );
+  if (!EFI_ERROR (Status)) {
     *HandleLocation = ProtocolToReturn->TheHandle;
     *HandleLocation = ProtocolToReturn->TheHandle;
-    return ((EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)ProtocolToReturn);
+    return ((EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)ProtocolToReturn);
   } else {
   } else {
-    FreePool(ProtocolToReturn);
+    FreePool (ProtocolToReturn);
     return (NULL);
     return (NULL);
   }
   }
 }
 }
@@ -193,26 +197,27 @@ CreateSimpleTextInOnFile(
   @retval EFI_SUCCESS         The object was closed.
   @retval EFI_SUCCESS         The object was closed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-CloseSimpleTextInOnFile(
+CloseSimpleTextInOnFile (
   IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *SimpleTextIn
   IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *SimpleTextIn
   )
   )
 {
 {
-  EFI_STATUS Status;
-  EFI_STATUS Status1;
+  EFI_STATUS  Status;
+  EFI_STATUS  Status1;
 
 
   if (SimpleTextIn == NULL) {
   if (SimpleTextIn == NULL) {
     return (EFI_INVALID_PARAMETER);
     return (EFI_INVALID_PARAMETER);
   }
   }
 
 
-  Status = gBS->CloseEvent(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn.WaitForKey);
+  Status = gBS->CloseEvent (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn.WaitForKey);
 
 
-  Status1 = gBS->UninstallProtocolInterface(
-    ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->TheHandle,
-    &gEfiSimpleTextInProtocolGuid,
-    &(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->SimpleTextIn));
+  Status1 = gBS->UninstallProtocolInterface (
+                   ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->TheHandle,
+                   &gEfiSimpleTextInProtocolGuid,
+                   &(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn)
+                   );
 
 
-  FreePool(SimpleTextIn);
-  if (!EFI_ERROR(Status)) {
+  FreePool (SimpleTextIn);
+  if (!EFI_ERROR (Status)) {
     return (Status1);
     return (Status1);
   } else {
   } else {
     return (Status);
     return (Status);
@@ -230,8 +235,8 @@ CloseSimpleTextInOnFile(
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 FileBasedSimpleTextOutReset (
 FileBasedSimpleTextOutReset (
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  BOOLEAN                         ExtendedVerification
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  BOOLEAN                          ExtendedVerification
   )
   )
 {
 {
   return (EFI_SUCCESS);
   return (EFI_SUCCESS);
@@ -249,8 +254,8 @@ FileBasedSimpleTextOutReset (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 FileBasedSimpleTextOutTestString (
 FileBasedSimpleTextOutTestString (
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  CHAR16                          *WString
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  CHAR16                           *WString
   )
   )
 {
 {
   return (EFI_SUCCESS);
   return (EFI_SUCCESS);
@@ -270,22 +275,23 @@ FileBasedSimpleTextOutTestString (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 FileBasedSimpleTextOutQueryMode (
 FileBasedSimpleTextOutQueryMode (
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  UINTN                           ModeNumber,
-  OUT UINTN                           *Columns,
-  OUT UINTN                           *Rows
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  UINTN                            ModeNumber,
+  OUT UINTN                            *Columns,
+  OUT UINTN                            *Rows
   )
   )
 {
 {
-  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *PassThruProtocol;
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *PassThruProtocol;
 
 
   PassThruProtocol = ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->OriginalSimpleTextOut;
   PassThruProtocol = ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->OriginalSimpleTextOut;
 
 
   // Pass the QueryMode call thru to the original SimpleTextOutProtocol
   // Pass the QueryMode call thru to the original SimpleTextOutProtocol
-  return (PassThruProtocol->QueryMode(
-    PassThruProtocol,
-    ModeNumber,
-    Columns,
-    Rows));
+  return (PassThruProtocol->QueryMode (
+                              PassThruProtocol,
+                              ModeNumber,
+                              Columns,
+                              Rows
+                              ));
 }
 }
 
 
 /**
 /**
@@ -300,7 +306,7 @@ EFI_STATUS
 EFIAPI
 EFIAPI
 FileBasedSimpleTextOutSetMode (
 FileBasedSimpleTextOutSetMode (
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
-  IN  UINTN                         ModeNumber
+  IN  UINTN                            ModeNumber
   )
   )
 {
 {
   return (EFI_UNSUPPORTED);
   return (EFI_UNSUPPORTED);
@@ -320,8 +326,8 @@ FileBasedSimpleTextOutSetMode (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 FileBasedSimpleTextOutSetAttribute (
 FileBasedSimpleTextOutSetAttribute (
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  UINTN                           Attribute
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  UINTN                            Attribute
   )
   )
 {
 {
   return (EFI_SUCCESS);
   return (EFI_SUCCESS);
@@ -357,8 +363,8 @@ EFI_STATUS
 EFIAPI
 EFIAPI
 FileBasedSimpleTextOutSetCursorPosition (
 FileBasedSimpleTextOutSetCursorPosition (
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
-  IN  UINTN                         Column,
-  IN  UINTN                         Row
+  IN  UINTN                            Column,
+  IN  UINTN                            Row
   )
   )
 {
 {
   return (EFI_SUCCESS);
   return (EFI_SUCCESS);
@@ -377,7 +383,7 @@ EFI_STATUS
 EFIAPI
 EFIAPI
 FileBasedSimpleTextOutEnableCursor (
 FileBasedSimpleTextOutEnableCursor (
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
-  IN  BOOLEAN                       Visible
+  IN  BOOLEAN                          Visible
   )
   )
 {
 {
   return (EFI_SUCCESS);
   return (EFI_SUCCESS);
@@ -402,16 +408,18 @@ FileBasedSimpleTextOutEnableCursor (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 FileBasedSimpleTextOutOutputString (
 FileBasedSimpleTextOutOutputString (
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
-  IN  CHAR16                          *WString
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *This,
+  IN  CHAR16                           *WString
   )
   )
 {
 {
-  UINTN Size;
-  Size = StrLen(WString) * sizeof(CHAR16);
-  return (ShellInfoObject.NewEfiShellProtocol->WriteFile(
-    ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle,
-    &Size,
-    WString));
+  UINTN  Size;
+
+  Size = StrLen (WString) * sizeof (CHAR16);
+  return (ShellInfoObject.NewEfiShellProtocol->WriteFile (
+                                                 ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle,
+                                                 &Size,
+                                                 WString
+                                                 ));
 }
 }
 
 
 /**
 /**
@@ -425,24 +433,25 @@ FileBasedSimpleTextOutOutputString (
   @retval NULL                There was insufficient memory available.
   @retval NULL                There was insufficient memory available.
   @return                     A pointer to the allocated protocol structure;
   @return                     A pointer to the allocated protocol structure;
 **/
 **/
-EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*
-CreateSimpleTextOutOnFile(
-  IN SHELL_FILE_HANDLE               FileHandleToUse,
-  IN EFI_HANDLE                      *HandleLocation,
-  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol
+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *
+CreateSimpleTextOutOnFile (
+  IN SHELL_FILE_HANDLE                FileHandleToUse,
+  IN EFI_HANDLE                       *HandleLocation,
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *OriginalProtocol
   )
   )
 {
 {
-  SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ProtocolToReturn;
-  EFI_STATUS                            Status;
+  SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *ProtocolToReturn;
+  EFI_STATUS                             Status;
 
 
-  if (HandleLocation == NULL || FileHandleToUse == NULL) {
+  if ((HandleLocation == NULL) || (FileHandleToUse == NULL)) {
     return (NULL);
     return (NULL);
   }
   }
 
 
-  ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL));
+  ProtocolToReturn = AllocateZeroPool (sizeof (SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL));
   if (ProtocolToReturn == NULL) {
   if (ProtocolToReturn == NULL) {
     return (NULL);
     return (NULL);
   }
   }
+
   ProtocolToReturn->FileHandle                      = FileHandleToUse;
   ProtocolToReturn->FileHandle                      = FileHandleToUse;
   ProtocolToReturn->OriginalSimpleTextOut           = OriginalProtocol;
   ProtocolToReturn->OriginalSimpleTextOut           = OriginalProtocol;
   ProtocolToReturn->SimpleTextOut.Reset             = FileBasedSimpleTextOutReset;
   ProtocolToReturn->SimpleTextOut.Reset             = FileBasedSimpleTextOutReset;
@@ -454,11 +463,12 @@ CreateSimpleTextOutOnFile(
   ProtocolToReturn->SimpleTextOut.SetCursorPosition = FileBasedSimpleTextOutSetCursorPosition;
   ProtocolToReturn->SimpleTextOut.SetCursorPosition = FileBasedSimpleTextOutSetCursorPosition;
   ProtocolToReturn->SimpleTextOut.EnableCursor      = FileBasedSimpleTextOutEnableCursor;
   ProtocolToReturn->SimpleTextOut.EnableCursor      = FileBasedSimpleTextOutEnableCursor;
   ProtocolToReturn->SimpleTextOut.OutputString      = FileBasedSimpleTextOutOutputString;
   ProtocolToReturn->SimpleTextOut.OutputString      = FileBasedSimpleTextOutOutputString;
-  ProtocolToReturn->SimpleTextOut.Mode              = AllocateZeroPool(sizeof(EFI_SIMPLE_TEXT_OUTPUT_MODE));
+  ProtocolToReturn->SimpleTextOut.Mode              = AllocateZeroPool (sizeof (EFI_SIMPLE_TEXT_OUTPUT_MODE));
   if (ProtocolToReturn->SimpleTextOut.Mode == NULL) {
   if (ProtocolToReturn->SimpleTextOut.Mode == NULL) {
-    FreePool(ProtocolToReturn);
+    FreePool (ProtocolToReturn);
     return (NULL);
     return (NULL);
   }
   }
+
   ProtocolToReturn->SimpleTextOut.Mode->MaxMode       = OriginalProtocol->Mode->MaxMode;
   ProtocolToReturn->SimpleTextOut.Mode->MaxMode       = OriginalProtocol->Mode->MaxMode;
   ProtocolToReturn->SimpleTextOut.Mode->Mode          = OriginalProtocol->Mode->Mode;
   ProtocolToReturn->SimpleTextOut.Mode->Mode          = OriginalProtocol->Mode->Mode;
   ProtocolToReturn->SimpleTextOut.Mode->Attribute     = OriginalProtocol->Mode->Attribute;
   ProtocolToReturn->SimpleTextOut.Mode->Attribute     = OriginalProtocol->Mode->Attribute;
@@ -466,17 +476,18 @@ CreateSimpleTextOutOnFile(
   ProtocolToReturn->SimpleTextOut.Mode->CursorRow     = OriginalProtocol->Mode->CursorRow;
   ProtocolToReturn->SimpleTextOut.Mode->CursorRow     = OriginalProtocol->Mode->CursorRow;
   ProtocolToReturn->SimpleTextOut.Mode->CursorVisible = OriginalProtocol->Mode->CursorVisible;
   ProtocolToReturn->SimpleTextOut.Mode->CursorVisible = OriginalProtocol->Mode->CursorVisible;
 
 
-  Status = gBS->InstallProtocolInterface(
-    &(ProtocolToReturn->TheHandle),
-    &gEfiSimpleTextOutProtocolGuid,
-    EFI_NATIVE_INTERFACE,
-    &(ProtocolToReturn->SimpleTextOut));
-  if (!EFI_ERROR(Status)) {
+  Status = gBS->InstallProtocolInterface (
+                  &(ProtocolToReturn->TheHandle),
+                  &gEfiSimpleTextOutProtocolGuid,
+                  EFI_NATIVE_INTERFACE,
+                  &(ProtocolToReturn->SimpleTextOut)
+                  );
+  if (!EFI_ERROR (Status)) {
     *HandleLocation = ProtocolToReturn->TheHandle;
     *HandleLocation = ProtocolToReturn->TheHandle;
-    return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)ProtocolToReturn);
+    return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)ProtocolToReturn);
   } else {
   } else {
-    SHELL_FREE_NON_NULL(ProtocolToReturn->SimpleTextOut.Mode);
-    SHELL_FREE_NON_NULL(ProtocolToReturn);
+    SHELL_FREE_NON_NULL (ProtocolToReturn->SimpleTextOut.Mode);
+    SHELL_FREE_NON_NULL (ProtocolToReturn);
     return (NULL);
     return (NULL);
   }
   }
 }
 }
@@ -490,19 +501,22 @@ CreateSimpleTextOutOnFile(
   @retval EFI_SUCCESS         The object was closed.
   @retval EFI_SUCCESS         The object was closed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-CloseSimpleTextOutOnFile(
+CloseSimpleTextOutOnFile (
   IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *SimpleTextOut
   IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *SimpleTextOut
   )
   )
 {
 {
   EFI_STATUS  Status;
   EFI_STATUS  Status;
+
   if (SimpleTextOut == NULL) {
   if (SimpleTextOut == NULL) {
     return (EFI_INVALID_PARAMETER);
     return (EFI_INVALID_PARAMETER);
   }
   }
-  Status = gBS->UninstallProtocolInterface(
-    ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->TheHandle,
-    &gEfiSimpleTextOutProtocolGuid,
-    &(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut));
-  FreePool(SimpleTextOut->Mode);
-  FreePool(SimpleTextOut);
+
+  Status = gBS->UninstallProtocolInterface (
+                  ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->TheHandle,
+                  &gEfiSimpleTextOutProtocolGuid,
+                  &(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->SimpleTextOut)
+                  );
+  FreePool (SimpleTextOut->Mode);
+  FreePool (SimpleTextOut);
   return (Status);
   return (Status);
 }
 }

+ 9 - 10
ShellPkg/Application/Shell/ConsoleWrappers.h

@@ -20,8 +20,8 @@
   @retval NULL                There was insufficient memory available.
   @retval NULL                There was insufficient memory available.
   @return                     A pointer to the allocated protocol structure;
   @return                     A pointer to the allocated protocol structure;
 **/
 **/
-EFI_SIMPLE_TEXT_INPUT_PROTOCOL*
-CreateSimpleTextInOnFile(
+EFI_SIMPLE_TEXT_INPUT_PROTOCOL *
+CreateSimpleTextInOnFile (
   IN SHELL_FILE_HANDLE  FileHandleToUse,
   IN SHELL_FILE_HANDLE  FileHandleToUse,
   IN EFI_HANDLE         *HandleLocation
   IN EFI_HANDLE         *HandleLocation
   );
   );
@@ -35,7 +35,7 @@ CreateSimpleTextInOnFile(
   @retval EFI_SUCCESS         The object was closed.
   @retval EFI_SUCCESS         The object was closed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-CloseSimpleTextInOnFile(
+CloseSimpleTextInOnFile (
   IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *SimpleTextIn
   IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *SimpleTextIn
   );
   );
 
 
@@ -50,11 +50,11 @@ CloseSimpleTextInOnFile(
   @retval NULL                There was insufficient memory available.
   @retval NULL                There was insufficient memory available.
   @return                     A pointer to the allocated protocol structure;
   @return                     A pointer to the allocated protocol structure;
 **/
 **/
-EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*
-CreateSimpleTextOutOnFile(
-  IN SHELL_FILE_HANDLE               FileHandleToUse,
-  IN EFI_HANDLE                      *HandleLocation,
-  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol
+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *
+CreateSimpleTextOutOnFile (
+  IN SHELL_FILE_HANDLE                FileHandleToUse,
+  IN EFI_HANDLE                       *HandleLocation,
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *OriginalProtocol
   );
   );
 
 
 /**
 /**
@@ -66,9 +66,8 @@ CreateSimpleTextOutOnFile(
   @retval EFI_SUCCESS         The object was closed.
   @retval EFI_SUCCESS         The object was closed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-CloseSimpleTextOutOnFile(
+CloseSimpleTextOutOnFile (
   IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *SimpleTextOut
   IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *SimpleTextOut
   );
   );
 
 
 #endif //_SHELL_CONSOLE_WRAPPERS_HEADER_
 #endif //_SHELL_CONSOLE_WRAPPERS_HEADER_
-

+ 10 - 11
ShellPkg/Application/Shell/FileHandleInternal.h

@@ -18,9 +18,9 @@
 **/
 **/
 VOID
 VOID
 MoveCursorBackward (
 MoveCursorBackward (
-  IN     UINTN                   LineLength,
-  IN OUT UINTN                   *Column,
-  IN OUT UINTN                   *Row
+  IN     UINTN  LineLength,
+  IN OUT UINTN  *Column,
+  IN OUT UINTN  *Row
   );
   );
 
 
 /**
 /**
@@ -33,10 +33,10 @@ MoveCursorBackward (
 **/
 **/
 VOID
 VOID
 MoveCursorForward (
 MoveCursorForward (
-  IN     UINTN                   LineLength,
-  IN     UINTN                   TotalRow,
-  IN OUT UINTN                   *Column,
-  IN OUT UINTN                   *Row
+  IN     UINTN  LineLength,
+  IN     UINTN  TotalRow,
+  IN OUT UINTN  *Column,
+  IN OUT UINTN  *Row
   );
   );
 
 
 /**
 /**
@@ -50,10 +50,9 @@ MoveCursorForward (
 **/
 **/
 VOID
 VOID
 PrintCommandHistory (
 PrintCommandHistory (
-  IN CONST UINTN TotalCols,
-  IN CONST UINTN TotalRows,
-  IN CONST UINTN StartColumn
+  IN CONST UINTN  TotalCols,
+  IN CONST UINTN  TotalRows,
+  IN CONST UINTN  StartColumn
   );
   );
 
 
 #endif //_FILE_HANDLE_INTERNAL_HEADER_
 #endif //_FILE_HANDLE_INTERNAL_HEADER_
-

File diff suppressed because it is too large
+ 355 - 336
ShellPkg/Application/Shell/FileHandleWrappers.c


+ 16 - 17
ShellPkg/Application/Shell/FileHandleWrappers.h

@@ -10,34 +10,34 @@
 #define _SHELL_FILE_HANDLE_WRAPPERS_HEADER_
 #define _SHELL_FILE_HANDLE_WRAPPERS_HEADER_
 
 
 typedef struct {
 typedef struct {
-  LIST_ENTRY        Link;
-  CHAR16*           Buffer;
+  LIST_ENTRY    Link;
+  CHAR16        *Buffer;
 } SHELL_LINE_LIST;
 } SHELL_LINE_LIST;
 
 
 typedef struct {
 typedef struct {
-  UINTN             LogCount;
-  SHELL_LINE_LIST   *Log;
+  UINTN              LogCount;
+  SHELL_LINE_LIST    *Log;
 } SHELL_LINE_LOG;
 } SHELL_LINE_LOG;
 
 
 ///
 ///
 /// FILE styte interfaces for StdIn.
 /// FILE styte interfaces for StdIn.
 ///
 ///
-extern EFI_FILE_PROTOCOL FileInterfaceStdIn;
+extern EFI_FILE_PROTOCOL  FileInterfaceStdIn;
 
 
 ///
 ///
 /// FILE styte interfaces for StdOut.
 /// FILE styte interfaces for StdOut.
 ///
 ///
-extern EFI_FILE_PROTOCOL FileInterfaceStdOut;
+extern EFI_FILE_PROTOCOL  FileInterfaceStdOut;
 
 
 ///
 ///
 /// FILE styte interfaces for StdErr.
 /// FILE styte interfaces for StdErr.
 ///
 ///
-extern EFI_FILE_PROTOCOL FileInterfaceStdErr;
+extern EFI_FILE_PROTOCOL  FileInterfaceStdErr;
 
 
 ///
 ///
 /// FILE style interface for NUL file.
 /// FILE style interface for NUL file.
 ///
 ///
-extern EFI_FILE_PROTOCOL FileInterfaceNulFile;
+extern EFI_FILE_PROTOCOL  FileInterfaceNulFile;
 
 
 /**
 /**
   Creates a EFI_FILE_PROTOCOL (almost) object for using to access
   Creates a EFI_FILE_PROTOCOL (almost) object for using to access
@@ -48,9 +48,9 @@ extern EFI_FILE_PROTOCOL FileInterfaceNulFile;
   @retval NULL      Memory could not be allocated.
   @retval NULL      Memory could not be allocated.
   @return other     a pointer to an EFI_FILE_PROTOCOL structure
   @return other     a pointer to an EFI_FILE_PROTOCOL structure
 **/
 **/
-EFI_FILE_PROTOCOL*
-CreateFileInterfaceEnv(
-  CONST CHAR16 *EnvName
+EFI_FILE_PROTOCOL *
+CreateFileInterfaceEnv (
+  CONST CHAR16  *EnvName
   );
   );
 
 
 /**
 /**
@@ -62,9 +62,9 @@ CreateFileInterfaceEnv(
   @retval NULL      Memory could not be allocated.
   @retval NULL      Memory could not be allocated.
   @return other     a pointer to an EFI_FILE_PROTOCOL structure
   @return other     a pointer to an EFI_FILE_PROTOCOL structure
 **/
 **/
-EFI_FILE_PROTOCOL*
-CreateFileInterfaceMem(
-  IN CONST BOOLEAN Unicode
+EFI_FILE_PROTOCOL *
+CreateFileInterfaceMem (
+  IN CONST BOOLEAN  Unicode
   );
   );
 
 
 /**
 /**
@@ -77,11 +77,10 @@ CreateFileInterfaceMem(
   @retval NULL      Memory could not be allocated.
   @retval NULL      Memory could not be allocated.
   @return other     a pointer to an EFI_FILE_PROTOCOL structure
   @return other     a pointer to an EFI_FILE_PROTOCOL structure
 **/
 **/
-EFI_FILE_PROTOCOL*
-CreateFileInterfaceFile(
+EFI_FILE_PROTOCOL *
+CreateFileInterfaceFile (
   IN CONST EFI_FILE_PROTOCOL  *Template,
   IN CONST EFI_FILE_PROTOCOL  *Template,
   IN CONST BOOLEAN            Unicode
   IN CONST BOOLEAN            Unicode
   );
   );
 
 
 #endif //_SHELL_FILE_HANDLE_WRAPPERS_HEADER_
 #endif //_SHELL_FILE_HANDLE_WRAPPERS_HEADER_
-

File diff suppressed because it is too large
+ 359 - 292
ShellPkg/Application/Shell/Shell.c


+ 85 - 89
ShellPkg/Application/Shell/Shell.h

@@ -51,75 +51,75 @@
 #include "ConsoleWrappers.h"
 #include "ConsoleWrappers.h"
 #include "FileHandleWrappers.h"
 #include "FileHandleWrappers.h"
 
 
-extern CONST CHAR16 mNoNestingEnvVarName[];
-extern CONST CHAR16 mNoNestingTrue[];
-extern CONST CHAR16 mNoNestingFalse[];
+extern CONST CHAR16  mNoNestingEnvVarName[];
+extern CONST CHAR16  mNoNestingTrue[];
+extern CONST CHAR16  mNoNestingFalse[];
 
 
 typedef struct {
 typedef struct {
-  LIST_ENTRY        Link;           ///< Standard linked list handler.
-  SHELL_FILE_HANDLE SplitStdOut;    ///< ConsoleOut for use in the split.
-  SHELL_FILE_HANDLE SplitStdIn;     ///< ConsoleIn for use in the split.
+  LIST_ENTRY           Link;        ///< Standard linked list handler.
+  SHELL_FILE_HANDLE    SplitStdOut; ///< ConsoleOut for use in the split.
+  SHELL_FILE_HANDLE    SplitStdIn;  ///< ConsoleIn for use in the split.
 } SPLIT_LIST;
 } SPLIT_LIST;
 
 
 typedef struct {
 typedef struct {
-  UINT32  Startup:1;      ///< Was "-startup"       found on command line.
-  UINT32  NoStartup:1;    ///< Was "-nostartup"     found on command line.
-  UINT32  NoConsoleOut:1; ///< Was "-noconsoleout"  found on command line.
-  UINT32  NoConsoleIn:1;  ///< Was "-noconsolein"   found on command line.
-  UINT32  NoInterrupt:1;  ///< Was "-nointerrupt"   found on command line.
-  UINT32  NoMap:1;        ///< Was "-nomap"         found on command line.
-  UINT32  NoVersion:1;    ///< Was "-noversion"     found on command line.
-  UINT32  Delay:1;        ///< Was "-delay[:n]      found on command line
-  UINT32  Exit:1;         ///< Was "-_exit"         found on command line
-  UINT32  NoNest:1;       ///< Was "-nonest"        found on command line
-  UINT32  Reserved:7;     ///< Extra bits
+  UINT32    Startup      : 1; ///< Was "-startup"       found on command line.
+  UINT32    NoStartup    : 1; ///< Was "-nostartup"     found on command line.
+  UINT32    NoConsoleOut : 1; ///< Was "-noconsoleout"  found on command line.
+  UINT32    NoConsoleIn  : 1; ///< Was "-noconsolein"   found on command line.
+  UINT32    NoInterrupt  : 1; ///< Was "-nointerrupt"   found on command line.
+  UINT32    NoMap        : 1; ///< Was "-nomap"         found on command line.
+  UINT32    NoVersion    : 1; ///< Was "-noversion"     found on command line.
+  UINT32    Delay        : 1; ///< Was "-delay[:n]      found on command line
+  UINT32    Exit         : 1; ///< Was "-_exit"         found on command line
+  UINT32    NoNest       : 1; ///< Was "-nonest"        found on command line
+  UINT32    Reserved     : 7; ///< Extra bits
 } SHELL_BITS;
 } SHELL_BITS;
 
 
 typedef union {
 typedef union {
-  SHELL_BITS  Bits;
-  UINT16      AllBits;
+  SHELL_BITS    Bits;
+  UINT16        AllBits;
 } SHELL_BIT_UNION;
 } SHELL_BIT_UNION;
 
 
 typedef struct {
 typedef struct {
-  SHELL_BIT_UNION BitUnion;
-  UINTN           Delay;          ///< Seconds of delay default:5.
-  CHAR16          *FileName;      ///< Filename to run upon successful initialization.
-  CHAR16          *FileOptions;   ///< Options to pass to FileName.
+  SHELL_BIT_UNION    BitUnion;
+  UINTN              Delay;        ///< Seconds of delay default:5.
+  CHAR16             *FileName;    ///< Filename to run upon successful initialization.
+  CHAR16             *FileOptions; ///< Options to pass to FileName.
 } SHELL_INIT_SETTINGS;
 } SHELL_INIT_SETTINGS;
 
 
 typedef struct {
 typedef struct {
-  BUFFER_LIST                 CommandHistory;
-  UINTN                       VisibleRowNumber;
-  UINTN                       OriginalVisibleRowNumber;
-  BOOLEAN                     InsertMode;           ///< Is the current typing mode insert (FALSE = overwrite).
+  BUFFER_LIST    CommandHistory;
+  UINTN          VisibleRowNumber;
+  UINTN          OriginalVisibleRowNumber;
+  BOOLEAN        InsertMode;                        ///< Is the current typing mode insert (FALSE = overwrite).
 } SHELL_VIEWING_SETTINGS;
 } SHELL_VIEWING_SETTINGS;
 
 
 typedef struct {
 typedef struct {
-  EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParametersProtocol;
-  EFI_SHELL_PROTOCOL            *NewEfiShellProtocol;
-  BOOLEAN                       PageBreakEnabled;
-  BOOLEAN                       RootShellInstance;
-  SHELL_INIT_SETTINGS           ShellInitSettings;
-  BUFFER_LIST                   BufferToFreeList;     ///< List of buffers that were returned to the user to free.
-  SHELL_VIEWING_SETTINGS        ViewingSettings;
-  EFI_HII_HANDLE                HiiHandle;            ///< Handle from HiiLib.
-  UINTN                         LogScreenCount;       ///< How many screens of log information to save.
-  EFI_EVENT                     UserBreakTimer;       ///< Timer event for polling for CTRL-C.
-  EFI_DEVICE_PATH_PROTOCOL      *ImageDevPath;        ///< DevicePath for ourselves.
-  EFI_DEVICE_PATH_PROTOCOL      *FileDevPath;         ///< DevicePath for ourselves.
-  CONSOLE_LOGGER_PRIVATE_DATA   *ConsoleInfo;         ///< Pointer for ConsoleInformation.
-  EFI_SHELL_PARAMETERS_PROTOCOL *OldShellParameters;  ///< old shell parameters to reinstall upon exiting.
-  SHELL_PROTOCOL_HANDLE_LIST    OldShellList;         ///< List of other instances to reinstall when closing.
-  SPLIT_LIST                    SplitList;            ///< List of Splits in FILO stack.
-  VOID                          *CtrlCNotifyHandle1;  ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
-  VOID                          *CtrlCNotifyHandle2;  ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
-  VOID                          *CtrlCNotifyHandle3;  ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
-  VOID                          *CtrlCNotifyHandle4;  ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
-  VOID                          *CtrlSNotifyHandle1;  ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
-  VOID                          *CtrlSNotifyHandle2;  ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
-  VOID                          *CtrlSNotifyHandle3;  ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
-  VOID                          *CtrlSNotifyHandle4;  ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
-  BOOLEAN                       HaltOutput;           ///< TRUE to start a CTRL-S halt.
+  EFI_SHELL_PARAMETERS_PROTOCOL    *NewShellParametersProtocol;
+  EFI_SHELL_PROTOCOL               *NewEfiShellProtocol;
+  BOOLEAN                          PageBreakEnabled;
+  BOOLEAN                          RootShellInstance;
+  SHELL_INIT_SETTINGS              ShellInitSettings;
+  BUFFER_LIST                      BufferToFreeList;  ///< List of buffers that were returned to the user to free.
+  SHELL_VIEWING_SETTINGS           ViewingSettings;
+  EFI_HII_HANDLE                   HiiHandle;           ///< Handle from HiiLib.
+  UINTN                            LogScreenCount;      ///< How many screens of log information to save.
+  EFI_EVENT                        UserBreakTimer;      ///< Timer event for polling for CTRL-C.
+  EFI_DEVICE_PATH_PROTOCOL         *ImageDevPath;       ///< DevicePath for ourselves.
+  EFI_DEVICE_PATH_PROTOCOL         *FileDevPath;        ///< DevicePath for ourselves.
+  CONSOLE_LOGGER_PRIVATE_DATA      *ConsoleInfo;        ///< Pointer for ConsoleInformation.
+  EFI_SHELL_PARAMETERS_PROTOCOL    *OldShellParameters; ///< old shell parameters to reinstall upon exiting.
+  SHELL_PROTOCOL_HANDLE_LIST       OldShellList;        ///< List of other instances to reinstall when closing.
+  SPLIT_LIST                       SplitList;           ///< List of Splits in FILO stack.
+  VOID                             *CtrlCNotifyHandle1; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+  VOID                             *CtrlCNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+  VOID                             *CtrlCNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+  VOID                             *CtrlCNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+  VOID                             *CtrlSNotifyHandle1; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+  VOID                             *CtrlSNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+  VOID                             *CtrlSNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+  VOID                             *CtrlSNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+  BOOLEAN                          HaltOutput;          ///< TRUE to start a CTRL-S halt.
 } SHELL_INFO;
 } SHELL_INFO;
 
 
 #pragma pack(1)
 #pragma pack(1)
@@ -127,12 +127,12 @@ typedef struct {
 /// HII specific Vendor Device Path definition.
 /// HII specific Vendor Device Path definition.
 ///
 ///
 typedef struct {
 typedef struct {
-  VENDOR_DEVICE_PATH             VendorDevicePath;
-  EFI_DEVICE_PATH_PROTOCOL       End;
+  VENDOR_DEVICE_PATH          VendorDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL    End;
 } SHELL_MAN_HII_VENDOR_DEVICE_PATH;
 } SHELL_MAN_HII_VENDOR_DEVICE_PATH;
 #pragma pack()
 #pragma pack()
 
 
-extern SHELL_INFO ShellInfoObject;
+extern SHELL_INFO  ShellInfoObject;
 
 
 /**
 /**
   Converts the command line to its post-processed form.  this replaces variables and alias' per UEFI Shell spec.
   Converts the command line to its post-processed form.  this replaces variables and alias' per UEFI Shell spec.
@@ -144,8 +144,8 @@ extern SHELL_INFO ShellInfoObject;
   @return                       some other error occurred
   @return                       some other error occurred
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ProcessCommandLineToFinal(
-  IN OUT CHAR16 **CmdLine
+ProcessCommandLineToFinal (
+  IN OUT CHAR16  **CmdLine
   );
   );
 
 
 /**
 /**
@@ -154,8 +154,8 @@ ProcessCommandLineToFinal(
   @param[in] ErrorCode      the error code to put into lasterror
   @param[in] ErrorCode      the error code to put into lasterror
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-SetLastError(
-  IN CONST SHELL_STATUS   ErrorCode
+SetLastError (
+  IN CONST SHELL_STATUS  ErrorCode
   );
   );
 
 
 /**
 /**
@@ -164,7 +164,7 @@ SetLastError(
   @retval EFI_SUCCESS           all init commands were run successfully.
   @retval EFI_SUCCESS           all init commands were run successfully.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-SetBuiltInAlias(
+SetBuiltInAlias (
   VOID
   VOID
   );
   );
 
 
@@ -184,8 +184,8 @@ SetBuiltInAlias(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 GetDevicePathsForImageAndFile (
 GetDevicePathsForImageAndFile (
-  IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath,
-  IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  **DevPath,
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  **FilePath
   );
   );
 
 
 /**
 /**
@@ -216,7 +216,7 @@ GetDevicePathsForImageAndFile (
   @retval EFI_SUCCESS           the variable is initialized.
   @retval EFI_SUCCESS           the variable is initialized.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ProcessCommandLine(
+ProcessCommandLine (
   VOID
   VOID
   );
   );
 
 
@@ -231,9 +231,9 @@ ProcessCommandLine(
   @retval EFI_SUCCESS           The variable is initialized.
   @retval EFI_SUCCESS           The variable is initialized.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-DoStartupScript(
-  IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
-  IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+DoStartupScript (
+  IN EFI_DEVICE_PATH_PROTOCOL  *ImagePath,
+  IN EFI_DEVICE_PATH_PROTOCOL  *FilePath
   );
   );
 
 
 /**
 /**
@@ -255,9 +255,9 @@ DoShellPrompt (
 
 
   @param Buffer   Something to pass to FreePool when the shell is exiting.
   @param Buffer   Something to pass to FreePool when the shell is exiting.
 **/
 **/
-VOID*
-AddBufferToFreeList(
-  VOID *Buffer
+VOID *
+AddBufferToFreeList (
+  VOID  *Buffer
   );
   );
 
 
 /**
 /**
@@ -266,8 +266,8 @@ AddBufferToFreeList(
   @param Buffer[in]     The line buffer to add.
   @param Buffer[in]     The line buffer to add.
 **/
 **/
 VOID
 VOID
-AddLineToCommandHistory(
-  IN CONST CHAR16 *Buffer
+AddLineToCommandHistory (
+  IN CONST CHAR16  *Buffer
   );
   );
 
 
 /**
 /**
@@ -281,8 +281,8 @@ AddLineToCommandHistory(
   @retval EFI_ABORTED     the command's operation was aborted
   @retval EFI_ABORTED     the command's operation was aborted
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-RunCommand(
-  IN CONST CHAR16   *CmdLine
+RunCommand (
+  IN CONST CHAR16  *CmdLine
   );
   );
 
 
 /**
 /**
@@ -298,12 +298,11 @@ RunCommand(
   @retval EFI_ABORTED     The command's operation was aborted.
   @retval EFI_ABORTED     The command's operation was aborted.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-RunShellCommand(
-  IN CONST CHAR16   *CmdLine,
-  OUT EFI_STATUS    *CommandStatus
+RunShellCommand (
+  IN CONST CHAR16  *CmdLine,
+  OUT EFI_STATUS   *CommandStatus
   );
   );
 
 
-
 /**
 /**
   Function to process a NSH script file via SHELL_FILE_HANDLE.
   Function to process a NSH script file via SHELL_FILE_HANDLE.
 
 
@@ -346,11 +345,11 @@ RunScriptFile (
   @return the location of the first character in the string
   @return the location of the first character in the string
   @retval CHAR_NULL no instance of any character in CharacterList was found in String
   @retval CHAR_NULL no instance of any character in CharacterList was found in String
 **/
 **/
-CONST CHAR16*
-FindFirstCharacter(
-  IN CONST CHAR16 *String,
-  IN CONST CHAR16 *CharacterList,
-  IN CONST CHAR16 EscapeCharacter
+CONST CHAR16 *
+FindFirstCharacter (
+  IN CONST CHAR16  *String,
+  IN CONST CHAR16  *CharacterList,
+  IN CONST CHAR16  EscapeCharacter
   );
   );
 
 
 /**
 /**
@@ -359,8 +358,8 @@ FindFirstCharacter(
   @param[in] String pointer to the string to trim them off.
   @param[in] String pointer to the string to trim them off.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-TrimSpaces(
-  IN CHAR16 **String
+TrimSpaces (
+  IN CHAR16  **String
   );
   );
 
 
 /**
 /**
@@ -371,7 +370,7 @@ TrimSpaces(
 **/
 **/
 VOID
 VOID
 SaveBufferList (
 SaveBufferList (
-  OUT LIST_ENTRY     *OldBufferList
+  OUT LIST_ENTRY  *OldBufferList
   );
   );
 
 
 /**
 /**
@@ -381,10 +380,7 @@ SaveBufferList (
 **/
 **/
 VOID
 VOID
 RestoreBufferList (
 RestoreBufferList (
-  IN OUT LIST_ENTRY     *OldBufferList
+  IN OUT LIST_ENTRY  *OldBufferList
   );
   );
 
 
-
-
 #endif //_SHELL_INTERNAL_HEADER_
 #endif //_SHELL_INTERNAL_HEADER_
-

+ 193 - 164
ShellPkg/Application/Shell/ShellEnvVar.c

@@ -14,7 +14,7 @@
 //
 //
 // The list is used to cache the environment variables.
 // The list is used to cache the environment variables.
 //
 //
-ENV_VAR_LIST                   gShellEnvVarList;
+ENV_VAR_LIST  gShellEnvVarList;
 
 
 /**
 /**
   Reports whether an environment variable is Volatile or Non-Volatile.
   Reports whether an environment variable is Volatile or Non-Volatile.
@@ -27,8 +27,8 @@ ENV_VAR_LIST                   gShellEnvVarList;
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 IsVolatileEnv (
 IsVolatileEnv (
-  IN CONST CHAR16 *EnvVarName,
-  OUT BOOLEAN     *Volatile
+  IN CONST CHAR16  *EnvVarName,
+  OUT BOOLEAN      *Volatile
   )
   )
 {
 {
   EFI_STATUS  Status;
   EFI_STATUS  Status;
@@ -38,29 +38,35 @@ IsVolatileEnv (
 
 
   ASSERT (Volatile != NULL);
   ASSERT (Volatile != NULL);
 
 
-  Size = 0;
+  Size   = 0;
   Buffer = NULL;
   Buffer = NULL;
 
 
   //
   //
   // get the variable
   // get the variable
   //
   //
-  Status = gRT->GetVariable((CHAR16*)EnvVarName,
-                            &gShellVariableGuid,
-                            &Attribs,
-                            &Size,
-                            Buffer);
+  Status = gRT->GetVariable (
+                  (CHAR16 *)EnvVarName,
+                  &gShellVariableGuid,
+                  &Attribs,
+                  &Size,
+                  Buffer
+                  );
   if (Status == EFI_BUFFER_TOO_SMALL) {
   if (Status == EFI_BUFFER_TOO_SMALL) {
-    Buffer = AllocateZeroPool(Size);
+    Buffer = AllocateZeroPool (Size);
     if (Buffer == NULL) {
     if (Buffer == NULL) {
       return EFI_OUT_OF_RESOURCES;
       return EFI_OUT_OF_RESOURCES;
     }
     }
-    Status = gRT->GetVariable((CHAR16*)EnvVarName,
-                              &gShellVariableGuid,
-                              &Attribs,
-                              &Size,
-                              Buffer);
-    FreePool(Buffer);
+
+    Status = gRT->GetVariable (
+                    (CHAR16 *)EnvVarName,
+                    &gShellVariableGuid,
+                    &Attribs,
+                    &Size,
+                    Buffer
+                    );
+    FreePool (Buffer);
   }
   }
+
   //
   //
   // not found means volatile
   // not found means volatile
   //
   //
@@ -68,6 +74,7 @@ IsVolatileEnv (
     *Volatile = TRUE;
     *Volatile = TRUE;
     return EFI_SUCCESS;
     return EFI_SUCCESS;
   }
   }
+
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     return Status;
     return Status;
   }
   }
@@ -75,7 +82,7 @@ IsVolatileEnv (
   //
   //
   // check for the Non Volatile bit
   // check for the Non Volatile bit
   //
   //
-  *Volatile = !(BOOLEAN) ((Attribs & EFI_VARIABLE_NON_VOLATILE) == EFI_VARIABLE_NON_VOLATILE);
+  *Volatile = !(BOOLEAN)((Attribs & EFI_VARIABLE_NON_VOLATILE) == EFI_VARIABLE_NON_VOLATILE);
   return EFI_SUCCESS;
   return EFI_SUCCESS;
 }
 }
 
 
@@ -85,30 +92,33 @@ IsVolatileEnv (
   @param[in] List               The pointer to pointer to list.
   @param[in] List               The pointer to pointer to list.
 **/
 **/
 VOID
 VOID
-FreeEnvironmentVariableList(
-  IN LIST_ENTRY *List
+FreeEnvironmentVariableList (
+  IN LIST_ENTRY  *List
   )
   )
 {
 {
-  ENV_VAR_LIST *Node;
+  ENV_VAR_LIST  *Node;
 
 
   ASSERT (List != NULL);
   ASSERT (List != NULL);
   if (List == NULL) {
   if (List == NULL) {
     return;
     return;
   }
   }
 
 
-  for ( Node = (ENV_VAR_LIST*)GetFirstNode(List)
-      ; !IsListEmpty(List)
-      ; Node = (ENV_VAR_LIST*)GetFirstNode(List)
-     ){
-    ASSERT(Node != NULL);
-    RemoveEntryList(&Node->Link);
+  for ( Node = (ENV_VAR_LIST *)GetFirstNode (List)
+        ; !IsListEmpty (List)
+        ; Node = (ENV_VAR_LIST *)GetFirstNode (List)
+        )
+  {
+    ASSERT (Node != NULL);
+    RemoveEntryList (&Node->Link);
     if (Node->Key != NULL) {
     if (Node->Key != NULL) {
-      FreePool(Node->Key);
+      FreePool (Node->Key);
     }
     }
+
     if (Node->Val != NULL) {
     if (Node->Val != NULL) {
-      FreePool(Node->Val);
+      FreePool (Node->Val);
     }
     }
-    FreePool(Node);
+
+    FreePool (Node);
   }
   }
 }
 }
 
 
@@ -121,18 +131,18 @@ FreeEnvironmentVariableList(
   @retval EFI_SUCCESS           the list was created successfully.
   @retval EFI_SUCCESS           the list was created successfully.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-GetEnvironmentVariableList(
-  IN OUT LIST_ENTRY *ListHead
+GetEnvironmentVariableList (
+  IN OUT LIST_ENTRY  *ListHead
   )
   )
 {
 {
-  CHAR16            *VariableName;
-  UINTN             NameSize;
-  UINTN             NameBufferSize;
-  EFI_STATUS        Status;
-  EFI_GUID          Guid;
-  UINTN             ValSize;
-  UINTN             ValBufferSize;
-  ENV_VAR_LIST      *VarList;
+  CHAR16        *VariableName;
+  UINTN         NameSize;
+  UINTN         NameBufferSize;
+  EFI_STATUS    Status;
+  EFI_GUID      Guid;
+  UINTN         ValSize;
+  UINTN         ValBufferSize;
+  ENV_VAR_LIST  *VarList;
 
 
   if (ListHead == NULL) {
   if (ListHead == NULL) {
     return (EFI_INVALID_PARAMETER);
     return (EFI_INVALID_PARAMETER);
@@ -140,34 +150,36 @@ GetEnvironmentVariableList(
 
 
   Status = EFI_SUCCESS;
   Status = EFI_SUCCESS;
 
 
-  ValBufferSize = INIT_DATA_BUFFER_SIZE;
+  ValBufferSize  = INIT_DATA_BUFFER_SIZE;
   NameBufferSize = INIT_NAME_BUFFER_SIZE;
   NameBufferSize = INIT_NAME_BUFFER_SIZE;
-  VariableName = AllocateZeroPool(NameBufferSize);
+  VariableName   = AllocateZeroPool (NameBufferSize);
   if (VariableName == NULL) {
   if (VariableName == NULL) {
     return (EFI_OUT_OF_RESOURCES);
     return (EFI_OUT_OF_RESOURCES);
   }
   }
+
   *VariableName = CHAR_NULL;
   *VariableName = CHAR_NULL;
 
 
-  while (!EFI_ERROR(Status)) {
+  while (!EFI_ERROR (Status)) {
     NameSize = NameBufferSize;
     NameSize = NameBufferSize;
-    Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid);
-    if (Status == EFI_NOT_FOUND){
+    Status   = gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
+    if (Status == EFI_NOT_FOUND) {
       Status = EFI_SUCCESS;
       Status = EFI_SUCCESS;
       break;
       break;
     } else if (Status == EFI_BUFFER_TOO_SMALL) {
     } else if (Status == EFI_BUFFER_TOO_SMALL) {
       NameBufferSize = NameSize > NameBufferSize * 2 ? NameSize : NameBufferSize * 2;
       NameBufferSize = NameSize > NameBufferSize * 2 ? NameSize : NameBufferSize * 2;
-      SHELL_FREE_NON_NULL(VariableName);
-      VariableName = AllocateZeroPool(NameBufferSize);
+      SHELL_FREE_NON_NULL (VariableName);
+      VariableName = AllocateZeroPool (NameBufferSize);
       if (VariableName == NULL) {
       if (VariableName == NULL) {
         Status = EFI_OUT_OF_RESOURCES;
         Status = EFI_OUT_OF_RESOURCES;
         break;
         break;
       }
       }
+
       NameSize = NameBufferSize;
       NameSize = NameBufferSize;
-      Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid);
+      Status   = gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
     }
     }
 
 
-    if (!EFI_ERROR(Status) && CompareGuid(&Guid, &gShellVariableGuid)){
-      VarList = AllocateZeroPool(sizeof(ENV_VAR_LIST));
+    if (!EFI_ERROR (Status) && CompareGuid (&Guid, &gShellVariableGuid)) {
+      VarList = AllocateZeroPool (sizeof (ENV_VAR_LIST));
       if (VarList == NULL) {
       if (VarList == NULL) {
         Status = EFI_OUT_OF_RESOURCES;
         Status = EFI_OUT_OF_RESOURCES;
       } else {
       } else {
@@ -177,12 +189,13 @@ GetEnvironmentVariableList(
         //
         //
         VarList->Val = AllocateZeroPool (ValSize + sizeof (CHAR16));
         VarList->Val = AllocateZeroPool (ValSize + sizeof (CHAR16));
         if (VarList->Val == NULL) {
         if (VarList->Val == NULL) {
-            SHELL_FREE_NON_NULL(VarList);
-            Status = EFI_OUT_OF_RESOURCES;
-            break;
+          SHELL_FREE_NON_NULL (VarList);
+          Status = EFI_OUT_OF_RESOURCES;
+          break;
         }
         }
-        Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(VariableName, &VarList->Atts, &ValSize, VarList->Val);
-        if (Status == EFI_BUFFER_TOO_SMALL){
+
+        Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (VariableName, &VarList->Atts, &ValSize, VarList->Val);
+        if (Status == EFI_BUFFER_TOO_SMALL) {
           ValBufferSize = ValSize > ValBufferSize * 2 ? ValSize : ValBufferSize * 2;
           ValBufferSize = ValSize > ValBufferSize * 2 ? ValSize : ValBufferSize * 2;
           SHELL_FREE_NON_NULL (VarList->Val);
           SHELL_FREE_NON_NULL (VarList->Val);
           //
           //
@@ -190,34 +203,36 @@ GetEnvironmentVariableList(
           //
           //
           VarList->Val = AllocateZeroPool (ValBufferSize + sizeof (CHAR16));
           VarList->Val = AllocateZeroPool (ValBufferSize + sizeof (CHAR16));
           if (VarList->Val == NULL) {
           if (VarList->Val == NULL) {
-            SHELL_FREE_NON_NULL(VarList);
+            SHELL_FREE_NON_NULL (VarList);
             Status = EFI_OUT_OF_RESOURCES;
             Status = EFI_OUT_OF_RESOURCES;
             break;
             break;
           }
           }
 
 
           ValSize = ValBufferSize;
           ValSize = ValBufferSize;
-          Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(VariableName, &VarList->Atts, &ValSize, VarList->Val);
+          Status  = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (VariableName, &VarList->Atts, &ValSize, VarList->Val);
         }
         }
-        if (!EFI_ERROR(Status)) {
-          VarList->Key = AllocateCopyPool(StrSize(VariableName), VariableName);
+
+        if (!EFI_ERROR (Status)) {
+          VarList->Key = AllocateCopyPool (StrSize (VariableName), VariableName);
           if (VarList->Key == NULL) {
           if (VarList->Key == NULL) {
-            SHELL_FREE_NON_NULL(VarList->Val);
-            SHELL_FREE_NON_NULL(VarList);
+            SHELL_FREE_NON_NULL (VarList->Val);
+            SHELL_FREE_NON_NULL (VarList);
             Status = EFI_OUT_OF_RESOURCES;
             Status = EFI_OUT_OF_RESOURCES;
           } else {
           } else {
-            InsertTailList(ListHead, &VarList->Link);
+            InsertTailList (ListHead, &VarList->Link);
           }
           }
         } else {
         } else {
-          SHELL_FREE_NON_NULL(VarList->Val);
-          SHELL_FREE_NON_NULL(VarList);
+          SHELL_FREE_NON_NULL (VarList->Val);
+          SHELL_FREE_NON_NULL (VarList);
         }
         }
       } // if (VarList == NULL) ... else ...
       } // if (VarList == NULL) ... else ...
     } // compare guid
     } // compare guid
   } // while
   } // while
+
   SHELL_FREE_NON_NULL (VariableName);
   SHELL_FREE_NON_NULL (VariableName);
 
 
-  if (EFI_ERROR(Status)) {
-    FreeEnvironmentVariableList(ListHead);
+  if (EFI_ERROR (Status)) {
+    FreeEnvironmentVariableList (ListHead);
   }
   }
 
 
   return (Status);
   return (Status);
@@ -236,51 +251,56 @@ GetEnvironmentVariableList(
   @retval EFI_SUCCESS           the list was Set successfully.
   @retval EFI_SUCCESS           the list was Set successfully.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-SetEnvironmentVariableList(
-  IN LIST_ENTRY *ListHead
+SetEnvironmentVariableList (
+  IN LIST_ENTRY  *ListHead
   )
   )
 {
 {
-  ENV_VAR_LIST      VarList;
-  ENV_VAR_LIST      *Node;
-  EFI_STATUS        Status;
-  UINTN             Size;
+  ENV_VAR_LIST  VarList;
+  ENV_VAR_LIST  *Node;
+  EFI_STATUS    Status;
+  UINTN         Size;
 
 
-  InitializeListHead(&VarList.Link);
+  InitializeListHead (&VarList.Link);
 
 
   //
   //
   // Delete all the current environment variables
   // Delete all the current environment variables
   //
   //
-  Status = GetEnvironmentVariableList(&VarList.Link);
-  ASSERT_EFI_ERROR(Status);
-
-  for ( Node = (ENV_VAR_LIST*)GetFirstNode(&VarList.Link)
-      ; !IsNull(&VarList.Link, &Node->Link)
-      ; Node = (ENV_VAR_LIST*)GetNextNode(&VarList.Link, &Node->Link)
-     ){
+  Status = GetEnvironmentVariableList (&VarList.Link);
+  ASSERT_EFI_ERROR (Status);
+
+  for ( Node = (ENV_VAR_LIST *)GetFirstNode (&VarList.Link)
+        ; !IsNull (&VarList.Link, &Node->Link)
+        ; Node = (ENV_VAR_LIST *)GetNextNode (&VarList.Link, &Node->Link)
+        )
+  {
     if (Node->Key != NULL) {
     if (Node->Key != NULL) {
-      Status = SHELL_DELETE_ENVIRONMENT_VARIABLE(Node->Key);
+      Status = SHELL_DELETE_ENVIRONMENT_VARIABLE (Node->Key);
     }
     }
-    ASSERT_EFI_ERROR(Status);
+
+    ASSERT_EFI_ERROR (Status);
   }
   }
 
 
-  FreeEnvironmentVariableList(&VarList.Link);
+  FreeEnvironmentVariableList (&VarList.Link);
 
 
   //
   //
   // set all the variables from the list
   // set all the variables from the list
   //
   //
-  for ( Node = (ENV_VAR_LIST*)GetFirstNode(ListHead)
-      ; !IsNull(ListHead, &Node->Link)
-      ; Node = (ENV_VAR_LIST*)GetNextNode(ListHead, &Node->Link)
-     ){
+  for ( Node = (ENV_VAR_LIST *)GetFirstNode (ListHead)
+        ; !IsNull (ListHead, &Node->Link)
+        ; Node = (ENV_VAR_LIST *)GetNextNode (ListHead, &Node->Link)
+        )
+  {
     Size = StrSize (Node->Val) - sizeof (CHAR16);
     Size = StrSize (Node->Val) - sizeof (CHAR16);
     if (Node->Atts & EFI_VARIABLE_NON_VOLATILE) {
     if (Node->Atts & EFI_VARIABLE_NON_VOLATILE) {
-      Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV(Node->Key, Size, Node->Val);
+      Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV (Node->Key, Size, Node->Val);
     } else {
     } else {
       Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (Node->Key, Size, Node->Val);
       Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (Node->Key, Size, Node->Val);
     }
     }
-    ASSERT_EFI_ERROR(Status);
+
+    ASSERT_EFI_ERROR (Status);
   }
   }
-  FreeEnvironmentVariableList(ListHead);
+
+  FreeEnvironmentVariableList (ListHead);
 
 
   return (Status);
   return (Status);
 }
 }
@@ -299,8 +319,8 @@ SetEnvironmentVariableList(
   @sa SetEnvironmentVariableList
   @sa SetEnvironmentVariableList
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-SetEnvironmentVariables(
-  IN CONST CHAR16 **Environment
+SetEnvironmentVariables (
+  IN CONST CHAR16  **Environment
   )
   )
 {
 {
   CONST CHAR16  *CurrentString;
   CONST CHAR16  *CurrentString;
@@ -318,61 +338,65 @@ SetEnvironmentVariables(
   // Build a list identical to the ones used for get/set list functions above
   // Build a list identical to the ones used for get/set list functions above
   //
   //
   for ( CurrentCount = 0
   for ( CurrentCount = 0
-      ;
-      ; CurrentCount++
-     ){
+        ;
+        ; CurrentCount++
+        )
+  {
     CurrentString = Environment[CurrentCount];
     CurrentString = Environment[CurrentCount];
     if (CurrentString == NULL) {
     if (CurrentString == NULL) {
       break;
       break;
     }
     }
-    ASSERT(StrStr(CurrentString, L"=") != NULL);
-    Node = AllocateZeroPool(sizeof(ENV_VAR_LIST));
+
+    ASSERT (StrStr (CurrentString, L"=") != NULL);
+    Node = AllocateZeroPool (sizeof (ENV_VAR_LIST));
     if (Node == NULL) {
     if (Node == NULL) {
-      SetEnvironmentVariableList(&VarList->Link);
+      SetEnvironmentVariableList (&VarList->Link);
       return (EFI_OUT_OF_RESOURCES);
       return (EFI_OUT_OF_RESOURCES);
     }
     }
 
 
-    Node->Key = AllocateZeroPool((StrStr(CurrentString, L"=") - CurrentString + 1) * sizeof(CHAR16));
+    Node->Key = AllocateZeroPool ((StrStr (CurrentString, L"=") - CurrentString + 1) * sizeof (CHAR16));
     if (Node->Key == NULL) {
     if (Node->Key == NULL) {
-      SHELL_FREE_NON_NULL(Node);
-      SetEnvironmentVariableList(&VarList->Link);
+      SHELL_FREE_NON_NULL (Node);
+      SetEnvironmentVariableList (&VarList->Link);
       return (EFI_OUT_OF_RESOURCES);
       return (EFI_OUT_OF_RESOURCES);
     }
     }
 
 
     //
     //
     // Copy the string into the Key, leaving the last character allocated as NULL to terminate
     // Copy the string into the Key, leaving the last character allocated as NULL to terminate
     //
     //
-    StrnCpyS( Node->Key,
-              StrStr(CurrentString, L"=") - CurrentString + 1,
-              CurrentString,
-              StrStr(CurrentString, L"=") - CurrentString
-              );
+    StrnCpyS (
+      Node->Key,
+      StrStr (CurrentString, L"=") - CurrentString + 1,
+      CurrentString,
+      StrStr (CurrentString, L"=") - CurrentString
+      );
 
 
     //
     //
     // ValueSize = TotalSize - already removed size - size for '=' + size for terminator (the last 2 items cancel each other)
     // ValueSize = TotalSize - already removed size - size for '=' + size for terminator (the last 2 items cancel each other)
     //
     //
-    Node->Val = AllocateCopyPool(StrSize(CurrentString) - StrSize(Node->Key), CurrentString + StrLen(Node->Key) + 1);
+    Node->Val = AllocateCopyPool (StrSize (CurrentString) - StrSize (Node->Key), CurrentString + StrLen (Node->Key) + 1);
     if (Node->Val == NULL) {
     if (Node->Val == NULL) {
-      SHELL_FREE_NON_NULL(Node->Key);
-      SHELL_FREE_NON_NULL(Node);
-      SetEnvironmentVariableList(&VarList->Link);
+      SHELL_FREE_NON_NULL (Node->Key);
+      SHELL_FREE_NON_NULL (Node);
+      SetEnvironmentVariableList (&VarList->Link);
       return (EFI_OUT_OF_RESOURCES);
       return (EFI_OUT_OF_RESOURCES);
     }
     }
 
 
     Node->Atts = EFI_VARIABLE_BOOTSERVICE_ACCESS;
     Node->Atts = EFI_VARIABLE_BOOTSERVICE_ACCESS;
 
 
     if (VarList == NULL) {
     if (VarList == NULL) {
-      VarList = AllocateZeroPool(sizeof(ENV_VAR_LIST));
+      VarList = AllocateZeroPool (sizeof (ENV_VAR_LIST));
       if (VarList == NULL) {
       if (VarList == NULL) {
-        SHELL_FREE_NON_NULL(Node->Key);
-        SHELL_FREE_NON_NULL(Node->Val);
-        SHELL_FREE_NON_NULL(Node);
+        SHELL_FREE_NON_NULL (Node->Key);
+        SHELL_FREE_NON_NULL (Node->Val);
+        SHELL_FREE_NON_NULL (Node);
         return (EFI_OUT_OF_RESOURCES);
         return (EFI_OUT_OF_RESOURCES);
       }
       }
-      InitializeListHead(&VarList->Link);
+
+      InitializeListHead (&VarList->Link);
     }
     }
-    InsertTailList(&VarList->Link, &Node->Link);
 
 
+    InsertTailList (&VarList->Link, &Node->Link);
   } // for loop
   } // for loop
 
 
   //
   //
@@ -380,7 +404,7 @@ SetEnvironmentVariables(
   // this function also frees the memory and deletes all pre-existing
   // this function also frees the memory and deletes all pre-existing
   // shell-guid based environment variables.
   // shell-guid based environment variables.
   //
   //
-  return (SetEnvironmentVariableList(&VarList->Link));
+  return (SetEnvironmentVariableList (&VarList->Link));
 }
 }
 
 
 /**
 /**
@@ -400,28 +424,30 @@ SetEnvironmentVariables(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 ShellFindEnvVarInList (
 ShellFindEnvVarInList (
-  IN  CONST CHAR16    *Key,
-  OUT CHAR16          **Value,
-  OUT UINTN           *ValueSize,
-  OUT UINT32          *Atts OPTIONAL
+  IN  CONST CHAR16  *Key,
+  OUT CHAR16        **Value,
+  OUT UINTN         *ValueSize,
+  OUT UINT32        *Atts OPTIONAL
   )
   )
 {
 {
-  ENV_VAR_LIST      *Node;
+  ENV_VAR_LIST  *Node;
 
 
-  if (Key == NULL || Value == NULL || ValueSize == NULL) {
+  if ((Key == NULL) || (Value == NULL) || (ValueSize == NULL)) {
     return SHELL_INVALID_PARAMETER;
     return SHELL_INVALID_PARAMETER;
   }
   }
 
 
-  for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link)
-      ; !IsNull(&gShellEnvVarList.Link, &Node->Link)
-      ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link)
-     ){
-    if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
-      *Value      = AllocateCopyPool(StrSize(Node->Val), Node->Val);
-      *ValueSize  = StrSize(Node->Val);
+  for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
+        ; !IsNull (&gShellEnvVarList.Link, &Node->Link)
+        ; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
+        )
+  {
+    if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
+      *Value     = AllocateCopyPool (StrSize (Node->Val), Node->Val);
+      *ValueSize = StrSize (Node->Val);
       if (Atts != NULL) {
       if (Atts != NULL) {
         *Atts = Node->Atts;
         *Atts = Node->Atts;
       }
       }
+
       return EFI_SUCCESS;
       return EFI_SUCCESS;
     }
     }
   }
   }
@@ -444,17 +470,17 @@ ShellFindEnvVarInList (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 ShellAddEnvVarToList (
 ShellAddEnvVarToList (
-  IN CONST CHAR16     *Key,
-  IN CONST CHAR16     *Value,
-  IN UINTN            ValueSize,
-  IN UINT32           Atts
+  IN CONST CHAR16  *Key,
+  IN CONST CHAR16  *Value,
+  IN UINTN         ValueSize,
+  IN UINT32        Atts
   )
   )
 {
 {
-  ENV_VAR_LIST      *Node;
-  CHAR16            *LocalKey;
-  CHAR16            *LocalValue;
+  ENV_VAR_LIST  *Node;
+  CHAR16        *LocalKey;
+  CHAR16        *LocalValue;
 
 
-  if (Key == NULL || Value == NULL || ValueSize == 0) {
+  if ((Key == NULL) || (Value == NULL) || (ValueSize == 0)) {
     return EFI_INVALID_PARAMETER;
     return EFI_INVALID_PARAMETER;
   }
   }
 
 
@@ -466,14 +492,15 @@ ShellAddEnvVarToList (
   //
   //
   // Update the variable value if it exists in gShellEnvVarList.
   // Update the variable value if it exists in gShellEnvVarList.
   //
   //
-  for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link)
-      ; !IsNull(&gShellEnvVarList.Link, &Node->Link)
-      ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link)
-     ){
-    if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
+  for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
+        ; !IsNull (&gShellEnvVarList.Link, &Node->Link)
+        ; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
+        )
+  {
+    if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
       Node->Atts = Atts;
       Node->Atts = Atts;
-      SHELL_FREE_NON_NULL(Node->Val);
-      Node->Val  = LocalValue;
+      SHELL_FREE_NON_NULL (Node->Val);
+      Node->Val = LocalValue;
       return EFI_SUCCESS;
       return EFI_SUCCESS;
     }
     }
   }
   }
@@ -482,21 +509,23 @@ ShellAddEnvVarToList (
   // If the environment variable key doesn't exist in list just insert
   // If the environment variable key doesn't exist in list just insert
   // a new node.
   // a new node.
   //
   //
-  LocalKey = AllocateCopyPool (StrSize(Key), Key);
+  LocalKey = AllocateCopyPool (StrSize (Key), Key);
   if (LocalKey == NULL) {
   if (LocalKey == NULL) {
     FreePool (LocalValue);
     FreePool (LocalValue);
     return EFI_OUT_OF_RESOURCES;
     return EFI_OUT_OF_RESOURCES;
   }
   }
-  Node = (ENV_VAR_LIST*)AllocateZeroPool (sizeof(ENV_VAR_LIST));
+
+  Node = (ENV_VAR_LIST *)AllocateZeroPool (sizeof (ENV_VAR_LIST));
   if (Node == NULL) {
   if (Node == NULL) {
     FreePool (LocalKey);
     FreePool (LocalKey);
     FreePool (LocalValue);
     FreePool (LocalValue);
     return EFI_OUT_OF_RESOURCES;
     return EFI_OUT_OF_RESOURCES;
   }
   }
-  Node->Key = LocalKey;
-  Node->Val = LocalValue;
+
+  Node->Key  = LocalKey;
+  Node->Val  = LocalValue;
   Node->Atts = Atts;
   Node->Atts = Atts;
-  InsertTailList(&gShellEnvVarList.Link, &Node->Link);
+  InsertTailList (&gShellEnvVarList.Link, &Node->Link);
 
 
   return EFI_SUCCESS;
   return EFI_SUCCESS;
 }
 }
@@ -512,24 +541,25 @@ ShellAddEnvVarToList (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 ShellRemvoeEnvVarFromList (
 ShellRemvoeEnvVarFromList (
-  IN CONST CHAR16           *Key
+  IN CONST CHAR16  *Key
   )
   )
 {
 {
-  ENV_VAR_LIST      *Node;
+  ENV_VAR_LIST  *Node;
 
 
   if (Key == NULL) {
   if (Key == NULL) {
     return EFI_INVALID_PARAMETER;
     return EFI_INVALID_PARAMETER;
   }
   }
 
 
-  for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link)
-      ; !IsNull(&gShellEnvVarList.Link, &Node->Link)
-      ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link)
-     ){
-    if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
-      SHELL_FREE_NON_NULL(Node->Key);
-      SHELL_FREE_NON_NULL(Node->Val);
-      RemoveEntryList(&Node->Link);
-      SHELL_FREE_NON_NULL(Node);
+  for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
+        ; !IsNull (&gShellEnvVarList.Link, &Node->Link)
+        ; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
+        )
+  {
+    if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
+      SHELL_FREE_NON_NULL (Node->Key);
+      SHELL_FREE_NON_NULL (Node->Val);
+      RemoveEntryList (&Node->Link);
+      SHELL_FREE_NON_NULL (Node);
       return EFI_SUCCESS;
       return EFI_SUCCESS;
     }
     }
   }
   }
@@ -547,9 +577,9 @@ ShellInitEnvVarList (
   VOID
   VOID
   )
   )
 {
 {
-  EFI_STATUS    Status;
+  EFI_STATUS  Status;
 
 
-  InitializeListHead(&gShellEnvVarList.Link);
+  InitializeListHead (&gShellEnvVarList.Link);
   Status = GetEnvironmentVariableList (&gShellEnvVarList.Link);
   Status = GetEnvironmentVariableList (&gShellEnvVarList.Link);
 
 
   return Status;
   return Status;
@@ -565,8 +595,7 @@ ShellFreeEnvVarList (
   )
   )
 {
 {
   FreeEnvironmentVariableList (&gShellEnvVarList.Link);
   FreeEnvironmentVariableList (&gShellEnvVarList.Link);
-  InitializeListHead(&gShellEnvVarList.Link);
+  InitializeListHead (&gShellEnvVarList.Link);
 
 
   return;
   return;
 }
 }
-

+ 28 - 30
ShellPkg/Application/Shell/ShellEnvVar.h

@@ -15,17 +15,16 @@
 #define _SHELL_ENVIRONMENT_VARIABLE_HEADER_
 #define _SHELL_ENVIRONMENT_VARIABLE_HEADER_
 
 
 typedef struct {
 typedef struct {
-  LIST_ENTRY  Link;
-  CHAR16      *Key;
-  CHAR16      *Val;
-  UINT32      Atts;
+  LIST_ENTRY    Link;
+  CHAR16        *Key;
+  CHAR16        *Val;
+  UINT32        Atts;
 } ENV_VAR_LIST;
 } ENV_VAR_LIST;
 
 
 //
 //
 // The list is used to cache the environment variables.
 // The list is used to cache the environment variables.
 //
 //
-extern ENV_VAR_LIST    gShellEnvVarList;
-
+extern ENV_VAR_LIST  gShellEnvVarList;
 
 
 /**
 /**
   Reports whether an environment variable is Volatile or Non-Volatile.
   Reports whether an environment variable is Volatile or Non-Volatile.
@@ -38,8 +37,8 @@ extern ENV_VAR_LIST    gShellEnvVarList;
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 IsVolatileEnv (
 IsVolatileEnv (
-  IN CONST CHAR16 *EnvVarName,
-  OUT BOOLEAN     *Volatile
+  IN CONST CHAR16  *EnvVarName,
+  OUT BOOLEAN      *Volatile
   );
   );
 
 
 /**
 /**
@@ -73,7 +72,7 @@ IsVolatileEnv (
   @retval other                 An error occurred
   @retval other                 An error occurred
   @sa SetVariable
   @sa SetVariable
 **/
 **/
-#define SHELL_SET_ENVIRONMENT_VARIABLE_NV(EnvVarName,BufferSize,Buffer)  \
+#define SHELL_SET_ENVIRONMENT_VARIABLE_NV(EnvVarName, BufferSize, Buffer)  \
   (gRT->SetVariable((CHAR16*)EnvVarName,                          \
   (gRT->SetVariable((CHAR16*)EnvVarName,                          \
   &gShellVariableGuid,                                            \
   &gShellVariableGuid,                                            \
   EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS,      \
   EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS,      \
@@ -93,7 +92,7 @@ IsVolatileEnv (
   @retval other                 An error occurred
   @retval other                 An error occurred
   @sa SetVariable
   @sa SetVariable
 **/
 **/
-#define SHELL_GET_ENVIRONMENT_VARIABLE(EnvVarName,BufferSize,Buffer)    \
+#define SHELL_GET_ENVIRONMENT_VARIABLE(EnvVarName, BufferSize, Buffer)    \
   (gRT->GetVariable((CHAR16*)EnvVarName,                        \
   (gRT->GetVariable((CHAR16*)EnvVarName,                        \
   &gShellVariableGuid,                                          \
   &gShellVariableGuid,                                          \
   0,                                                            \
   0,                                                            \
@@ -114,7 +113,7 @@ IsVolatileEnv (
   @retval other                 An error occurred
   @retval other                 An error occurred
   @sa SetVariable
   @sa SetVariable
 **/
 **/
-#define SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(EnvVarName,Atts,BufferSize,Buffer)    \
+#define SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(EnvVarName, Atts, BufferSize, Buffer)    \
   (gRT->GetVariable((CHAR16*)EnvVarName,                        \
   (gRT->GetVariable((CHAR16*)EnvVarName,                        \
   &gShellVariableGuid,                                          \
   &gShellVariableGuid,                                          \
   Atts,                                                            \
   Atts,                                                            \
@@ -134,7 +133,7 @@ IsVolatileEnv (
   @retval other                 An error occurred
   @retval other                 An error occurred
   @sa SetVariable
   @sa SetVariable
 **/
 **/
-#define SHELL_SET_ENVIRONMENT_VARIABLE_V(EnvVarName,BufferSize,Buffer) \
+#define SHELL_SET_ENVIRONMENT_VARIABLE_V(EnvVarName, BufferSize, Buffer) \
   (gRT->SetVariable((CHAR16*)EnvVarName,                      \
   (gRT->SetVariable((CHAR16*)EnvVarName,                      \
   &gShellVariableGuid,                                        \
   &gShellVariableGuid,                                        \
   EFI_VARIABLE_BOOTSERVICE_ACCESS,                            \
   EFI_VARIABLE_BOOTSERVICE_ACCESS,                            \
@@ -150,8 +149,8 @@ IsVolatileEnv (
   @retval EFI_SUCCESS           the list was created successfully.
   @retval EFI_SUCCESS           the list was created successfully.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-GetEnvironmentVariableList(
-  IN OUT LIST_ENTRY *List
+GetEnvironmentVariableList (
+  IN OUT LIST_ENTRY  *List
   );
   );
 
 
 /**
 /**
@@ -167,8 +166,8 @@ GetEnvironmentVariableList(
   @retval EFI_SUCCESS           The list was Set successfully.
   @retval EFI_SUCCESS           The list was Set successfully.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-SetEnvironmentVariableList(
-  IN LIST_ENTRY *List
+SetEnvironmentVariableList (
+  IN LIST_ENTRY  *List
   );
   );
 
 
 /**
 /**
@@ -187,8 +186,8 @@ SetEnvironmentVariableList(
   @sa SetEnvironmentVariableList
   @sa SetEnvironmentVariableList
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-SetEnvironmentVariables(
-  IN CONST CHAR16 **Environment
+SetEnvironmentVariables (
+  IN CONST CHAR16  **Environment
   );
   );
 
 
 /**
 /**
@@ -197,8 +196,8 @@ SetEnvironmentVariables(
   @param[in] List               The pointer to pointer to list.
   @param[in] List               The pointer to pointer to list.
 **/
 **/
 VOID
 VOID
-FreeEnvironmentVariableList(
-  IN LIST_ENTRY *List
+FreeEnvironmentVariableList (
+  IN LIST_ENTRY  *List
   );
   );
 
 
 /**
 /**
@@ -218,10 +217,10 @@ FreeEnvironmentVariableList(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 ShellFindEnvVarInList (
 ShellFindEnvVarInList (
-  IN  CONST CHAR16    *Key,
-  OUT CHAR16          **Value,
-  OUT UINTN           *ValueSize,
-  OUT UINT32          *Atts OPTIONAL
+  IN  CONST CHAR16  *Key,
+  OUT CHAR16        **Value,
+  OUT UINTN         *ValueSize,
+  OUT UINT32        *Atts OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -239,10 +238,10 @@ ShellFindEnvVarInList (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 ShellAddEnvVarToList (
 ShellAddEnvVarToList (
-  IN CONST CHAR16     *Key,
-  IN CONST CHAR16     *Value,
-  IN UINTN            ValueSize,
-  IN UINT32           Atts
+  IN CONST CHAR16  *Key,
+  IN CONST CHAR16  *Value,
+  IN UINTN         ValueSize,
+  IN UINT32        Atts
   );
   );
 
 
 /**
 /**
@@ -256,7 +255,7 @@ ShellAddEnvVarToList (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 ShellRemvoeEnvVarFromList (
 ShellRemvoeEnvVarFromList (
-  IN CONST CHAR16           *Key
+  IN CONST CHAR16  *Key
   );
   );
 
 
 /**
 /**
@@ -279,4 +278,3 @@ ShellFreeEnvVarList (
   );
   );
 
 
 #endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_
 #endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_
-

+ 257 - 230
ShellPkg/Application/Shell/ShellManParser.c

@@ -17,15 +17,14 @@
 EFI_HII_HANDLE  mShellManHiiHandle    = NULL;
 EFI_HII_HANDLE  mShellManHiiHandle    = NULL;
 EFI_HANDLE      mShellManDriverHandle = NULL;
 EFI_HANDLE      mShellManDriverHandle = NULL;
 
 
-
 SHELL_MAN_HII_VENDOR_DEVICE_PATH  mShellManHiiDevicePath = {
 SHELL_MAN_HII_VENDOR_DEVICE_PATH  mShellManHiiDevicePath = {
   {
   {
     {
     {
       HARDWARE_DEVICE_PATH,
       HARDWARE_DEVICE_PATH,
       HW_VENDOR_DP,
       HW_VENDOR_DP,
       {
       {
-        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
-        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+        (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+        (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
       }
       }
     },
     },
     SHELL_MAN_HII_GUID
     SHELL_MAN_HII_GUID
@@ -34,8 +33,8 @@ SHELL_MAN_HII_VENDOR_DEVICE_PATH  mShellManHiiDevicePath = {
     END_DEVICE_PATH_TYPE,
     END_DEVICE_PATH_TYPE,
     END_ENTIRE_DEVICE_PATH_SUBTYPE,
     END_ENTIRE_DEVICE_PATH_SUBTYPE,
     {
     {
-      (UINT8) (END_DEVICE_PATH_LENGTH),
-      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+      (UINT8)(END_DEVICE_PATH_LENGTH),
+      (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
     }
     }
   }
   }
 };
 };
@@ -52,11 +51,12 @@ SHELL_MAN_HII_VENDOR_DEVICE_PATH  mShellManHiiDevicePath = {
 **/
 **/
 CHAR16 *
 CHAR16 *
 GetExecuatableFileName (
 GetExecuatableFileName (
-  IN CONST CHAR16    *NameString
+  IN CONST CHAR16  *NameString
   )
   )
 {
 {
   CHAR16  *Buffer;
   CHAR16  *Buffer;
   CHAR16  *SuffixStr;
   CHAR16  *SuffixStr;
+
   if (NameString == NULL) {
   if (NameString == NULL) {
     return (NULL);
     return (NULL);
   }
   }
@@ -64,31 +64,33 @@ GetExecuatableFileName (
   //
   //
   // Fix the file name
   // Fix the file name
   //
   //
-  if (StrnCmp(NameString+StrLen(NameString)-StrLen(L".efi"), L".efi", StrLen(L".efi"))==0) {
-    Buffer = AllocateCopyPool(StrSize(NameString), NameString);
-  } else if (StrnCmp(NameString+StrLen(NameString)-StrLen(L".man"), L".man", StrLen(L".man"))==0) {
-    Buffer = AllocateCopyPool(StrSize(NameString), NameString);
+  if (StrnCmp (NameString+StrLen (NameString)-StrLen (L".efi"), L".efi", StrLen (L".efi")) == 0) {
+    Buffer = AllocateCopyPool (StrSize (NameString), NameString);
+  } else if (StrnCmp (NameString+StrLen (NameString)-StrLen (L".man"), L".man", StrLen (L".man")) == 0) {
+    Buffer = AllocateCopyPool (StrSize (NameString), NameString);
     if (Buffer != NULL) {
     if (Buffer != NULL) {
-      SuffixStr = Buffer+StrLen(Buffer)-StrLen(L".man");
-      StrnCpyS (SuffixStr, StrSize(L".man")/sizeof(CHAR16), L".efi", StrLen(L".efi"));
+      SuffixStr = Buffer+StrLen (Buffer)-StrLen (L".man");
+      StrnCpyS (SuffixStr, StrSize (L".man")/sizeof (CHAR16), L".efi", StrLen (L".efi"));
     }
     }
   } else {
   } else {
-    Buffer = AllocateZeroPool(StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16));
+    Buffer = AllocateZeroPool (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16));
     if (Buffer != NULL) {
     if (Buffer != NULL) {
-      StrnCpyS( Buffer,
-                (StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16),
-                NameString,
-                StrLen(NameString)
-                );
-      StrnCatS( Buffer,
-                (StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16),
-                L".efi",
-                StrLen(L".efi")
-                );
+      StrnCpyS (
+        Buffer,
+        (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
+        NameString,
+        StrLen (NameString)
+        );
+      StrnCatS (
+        Buffer,
+        (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
+        L".efi",
+        StrLen (L".efi")
+        );
     }
     }
   }
   }
-  return (Buffer);
 
 
+  return (Buffer);
 }
 }
 
 
 /**
 /**
@@ -103,34 +105,39 @@ GetExecuatableFileName (
   @return the new filename with .man as the extension.
   @return the new filename with .man as the extension.
 **/
 **/
 CHAR16 *
 CHAR16 *
-GetManFileName(
-  IN CONST CHAR16 *ManFileName
+GetManFileName (
+  IN CONST CHAR16  *ManFileName
   )
   )
 {
 {
-  CHAR16 *Buffer;
+  CHAR16  *Buffer;
+
   if (ManFileName == NULL) {
   if (ManFileName == NULL) {
     return (NULL);
     return (NULL);
   }
   }
+
   //
   //
   // Fix the file name
   // Fix the file name
   //
   //
-  if (StrnCmp(ManFileName+StrLen(ManFileName)-4, L".man", 4)==0) {
-    Buffer = AllocateCopyPool(StrSize(ManFileName), ManFileName);
+  if (StrnCmp (ManFileName+StrLen (ManFileName)-4, L".man", 4) == 0) {
+    Buffer = AllocateCopyPool (StrSize (ManFileName), ManFileName);
   } else {
   } else {
-    Buffer = AllocateZeroPool(StrSize(ManFileName) + 4*sizeof(CHAR16));
+    Buffer = AllocateZeroPool (StrSize (ManFileName) + 4*sizeof (CHAR16));
     if (Buffer != NULL) {
     if (Buffer != NULL) {
-      StrnCpyS( Buffer,
-                (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16),
-                ManFileName,
-                StrLen(ManFileName)
-                );
-      StrnCatS( Buffer,
-                (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16),
-                L".man",
-                4
-                );
+      StrnCpyS (
+        Buffer,
+        (StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
+        ManFileName,
+        StrLen (ManFileName)
+        );
+      StrnCatS (
+        Buffer,
+        (StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
+        L".man",
+        4
+        );
     }
     }
   }
   }
+
   return (Buffer);
   return (Buffer);
 }
 }
 
 
@@ -149,22 +156,23 @@ GetManFileName(
   @retval EFI_NOT_FOUND         The file was not found.
   @retval EFI_NOT_FOUND         The file was not found.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-SearchPathForFile(
-  IN CONST CHAR16             *FileName,
-  OUT SHELL_FILE_HANDLE       *Handle
+SearchPathForFile (
+  IN CONST CHAR16        *FileName,
+  OUT SHELL_FILE_HANDLE  *Handle
   )
   )
 {
 {
-  CHAR16          *FullFileName;
-  EFI_STATUS      Status;
+  CHAR16      *FullFileName;
+  EFI_STATUS  Status;
 
 
-  if ( FileName     == NULL
-    || Handle       == NULL
-    || StrLen(FileName) == 0
-   ){
+  if (  (FileName     == NULL)
+     || (Handle       == NULL)
+     || (StrLen (FileName) == 0)
+        )
+  {
     return (EFI_INVALID_PARAMETER);
     return (EFI_INVALID_PARAMETER);
   }
   }
 
 
-  FullFileName = ShellFindFilePath(FileName);
+  FullFileName = ShellFindFilePath (FileName);
   if (FullFileName == NULL) {
   if (FullFileName == NULL) {
     return (EFI_NOT_FOUND);
     return (EFI_NOT_FOUND);
   }
   }
@@ -172,8 +180,8 @@ SearchPathForFile(
   //
   //
   // now open that file
   // now open that file
   //
   //
-  Status = EfiShellOpenFileByName(FullFileName, Handle, EFI_FILE_MODE_READ);
-  FreePool(FullFileName);
+  Status = EfiShellOpenFileByName (FullFileName, Handle, EFI_FILE_MODE_READ);
+  FreePool (FullFileName);
 
 
   return (Status);
   return (Status);
 }
 }
@@ -197,7 +205,7 @@ SearchPathForFile(
                                 an allocated buffer.
                                 an allocated buffer.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ManFileFindSections(
+ManFileFindSections (
   IN SHELL_FILE_HANDLE  Handle,
   IN SHELL_FILE_HANDLE  Handle,
   IN CONST CHAR16       *Sections,
   IN CONST CHAR16       *Sections,
   OUT CHAR16            **HelpText,
   OUT CHAR16            **HelpText,
@@ -205,75 +213,84 @@ ManFileFindSections(
   IN BOOLEAN            Ascii
   IN BOOLEAN            Ascii
   )
   )
 {
 {
-  EFI_STATUS          Status;
-  CHAR16              *ReadLine;
-  UINTN               Size;
-  BOOLEAN             CurrentlyReading;
-  CHAR16              *SectionName;
-  UINTN               SectionLen;
-  BOOLEAN             Found;
-
-  if ( Handle     == NULL
-    || HelpText   == NULL
-    || HelpSize   == NULL
-   ){
+  EFI_STATUS  Status;
+  CHAR16      *ReadLine;
+  UINTN       Size;
+  BOOLEAN     CurrentlyReading;
+  CHAR16      *SectionName;
+  UINTN       SectionLen;
+  BOOLEAN     Found;
+
+  if (  (Handle     == NULL)
+     || (HelpText   == NULL)
+     || (HelpSize   == NULL)
+        )
+  {
     return (EFI_INVALID_PARAMETER);
     return (EFI_INVALID_PARAMETER);
   }
   }
 
 
-  Status            = EFI_SUCCESS;
-  CurrentlyReading  = FALSE;
-  Size              = 1024;
-  Found             = FALSE;
+  Status           = EFI_SUCCESS;
+  CurrentlyReading = FALSE;
+  Size             = 1024;
+  Found            = FALSE;
 
 
-  ReadLine          = AllocateZeroPool(Size);
+  ReadLine = AllocateZeroPool (Size);
   if (ReadLine == NULL) {
   if (ReadLine == NULL) {
     return (EFI_OUT_OF_RESOURCES);
     return (EFI_OUT_OF_RESOURCES);
   }
   }
 
 
-  for (;!ShellFileHandleEof(Handle);Size = 1024) {
-    Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, &Ascii);
+  for ( ; !ShellFileHandleEof (Handle); Size = 1024) {
+    Status = ShellFileHandleReadLine (Handle, ReadLine, &Size, TRUE, &Ascii);
     if (ReadLine[0] == L'#') {
     if (ReadLine[0] == L'#') {
       //
       //
       // Skip comment lines
       // Skip comment lines
       //
       //
       continue;
       continue;
     }
     }
+
     //
     //
     // ignore too small of buffer...
     // ignore too small of buffer...
     //
     //
     if (Status == EFI_BUFFER_TOO_SMALL) {
     if (Status == EFI_BUFFER_TOO_SMALL) {
       Status = EFI_SUCCESS;
       Status = EFI_SUCCESS;
     }
     }
-    if (EFI_ERROR(Status)) {
+
+    if (EFI_ERROR (Status)) {
       break;
       break;
-    } else if (StrnCmp(ReadLine, L".TH", 3) == 0) {
+    } else if (StrnCmp (ReadLine, L".TH", 3) == 0) {
       //
       //
       // we hit the end of this commands section so stop.
       // we hit the end of this commands section so stop.
       //
       //
       break;
       break;
-    } else if (StrnCmp(ReadLine, L".SH", 3) == 0) {
+    } else if (StrnCmp (ReadLine, L".SH", 3) == 0) {
       if (Sections == NULL) {
       if (Sections == NULL) {
         CurrentlyReading = TRUE;
         CurrentlyReading = TRUE;
         continue;
         continue;
       }
       }
+
       //
       //
       // we found a section
       // we found a section
       //
       //
       if (CurrentlyReading) {
       if (CurrentlyReading) {
         CurrentlyReading = FALSE;
         CurrentlyReading = FALSE;
       }
       }
+
       //
       //
       // is this a section we want to read in?
       // is this a section we want to read in?
       //
       //
       for ( SectionName = ReadLine + 3
       for ( SectionName = ReadLine + 3
-          ; *SectionName == L' '
-          ; SectionName++);
-      SectionLen = StrLen(SectionName);
-      SectionName = StrStr(Sections, SectionName);
+            ; *SectionName == L' '
+            ; SectionName++)
+      {
+      }
+
+      SectionLen  = StrLen (SectionName);
+      SectionName = StrStr (Sections, SectionName);
       if (SectionName == NULL) {
       if (SectionName == NULL) {
         continue;
         continue;
       }
       }
-      if (*(SectionName + SectionLen) == CHAR_NULL || *(SectionName + SectionLen) == L',') {
+
+      if ((*(SectionName + SectionLen) == CHAR_NULL) || (*(SectionName + SectionLen) == L',')) {
         CurrentlyReading = TRUE;
         CurrentlyReading = TRUE;
       }
       }
     } else if (CurrentlyReading) {
     } else if (CurrentlyReading) {
@@ -281,15 +298,17 @@ ManFileFindSections(
       //
       //
       // copy and save the current line.
       // copy and save the current line.
       //
       //
-      ASSERT((*HelpText == NULL && *HelpSize == 0) || (*HelpText != NULL));
+      ASSERT ((*HelpText == NULL && *HelpSize == 0) || (*HelpText != NULL));
       StrnCatGrow (HelpText, HelpSize, ReadLine, 0);
       StrnCatGrow (HelpText, HelpSize, ReadLine, 0);
       StrnCatGrow (HelpText, HelpSize, L"\r\n", 0);
       StrnCatGrow (HelpText, HelpSize, L"\r\n", 0);
     }
     }
   }
   }
-  FreePool(ReadLine);
-  if (!Found && !EFI_ERROR(Status)) {
+
+  FreePool (ReadLine);
+  if (!Found && !EFI_ERROR (Status)) {
     return (EFI_NOT_FOUND);
     return (EFI_NOT_FOUND);
   }
   }
+
   return (Status);
   return (Status);
 }
 }
 
 
@@ -315,12 +334,12 @@ ManFileFindSections(
   @retval FALSE  Line did not contain the Title Header
   @retval FALSE  Line did not contain the Title Header
 **/
 **/
 BOOLEAN
 BOOLEAN
-IsTitleHeader(
-  IN CONST CHAR16       *Command,
-  IN CHAR16             *Line,
-  OUT CHAR16            **BriefDesc OPTIONAL,
-  OUT UINTN             *BriefSize OPTIONAL,
-  OUT BOOLEAN           *Found
+IsTitleHeader (
+  IN CONST CHAR16  *Command,
+  IN CHAR16        *Line,
+  OUT CHAR16       **BriefDesc OPTIONAL,
+  OUT UINTN        *BriefSize OPTIONAL,
+  OUT BOOLEAN      *Found
   )
   )
 {
 {
   // The states of a simple state machine used to recognize a title header line
   // The states of a simple state machine used to recognize a title header line
@@ -334,86 +353,84 @@ IsTitleHeader(
   BOOLEAN      ReturnValue;  // TRUE if this the Title Header line of *some* MAN file.
   BOOLEAN      ReturnValue;  // TRUE if this the Title Header line of *some* MAN file.
   BOOLEAN      ReturnFound;  // TRUE if this the Title Header line of *the desired* MAN file.
   BOOLEAN      ReturnFound;  // TRUE if this the Title Header line of *the desired* MAN file.
 
 
-  ReturnValue = FALSE;
-  ReturnFound = FALSE;
+  ReturnValue  = FALSE;
+  ReturnFound  = FALSE;
   CommandIndex = 0;
   CommandIndex = 0;
-  State = LookForThMacro;
+  State        = LookForThMacro;
 
 
   do {
   do {
-
     if (*Line == L'\0') {
     if (*Line == L'\0') {
       break;
       break;
     }
     }
 
 
     switch (State) {
     switch (State) {
-
       // Handle "^\s*.TH\s"
       // Handle "^\s*.TH\s"
       // Go to state LookForCommandName if the title header macro is present; otherwise,
       // Go to state LookForCommandName if the title header macro is present; otherwise,
       // eat white space. If we see something other than white space, this is not a
       // eat white space. If we see something other than white space, this is not a
       // title header line.
       // title header line.
       case LookForThMacro:
       case LookForThMacro:
-        if (StrnCmp (L".TH ", Line, 4) == 0 || StrnCmp (L".TH\t", Line, 4) == 0) {
+        if ((StrnCmp (L".TH ", Line, 4) == 0) || (StrnCmp (L".TH\t", Line, 4) == 0)) {
           Line += 4;
           Line += 4;
           State = LookForCommandName;
           State = LookForCommandName;
-        }
-        else if (*Line == L' ' || *Line == L'\t') {
+        } else if ((*Line == L' ') || (*Line == L'\t')) {
           Line++;
           Line++;
-        }
-        else {
+        } else {
           State = Final;
           State = Final;
         }
         }
-      break;
+
+        break;
 
 
       // Handle "\s*"
       // Handle "\s*"
       // Eat any "extra" whitespace after the title header macro (we have already seen
       // Eat any "extra" whitespace after the title header macro (we have already seen
       // at least one white space character). Go to state CompareCommands when a
       // at least one white space character). Go to state CompareCommands when a
       // non-white space is seen.
       // non-white space is seen.
       case LookForCommandName:
       case LookForCommandName:
-        if (*Line == L' ' || *Line == L'\t') {
+        if ((*Line == L' ') || (*Line == L'\t')) {
           Line++;
           Line++;
-        }
-        else {
+        } else {
           ReturnValue = TRUE;  // This is *some* command's title header line.
           ReturnValue = TRUE;  // This is *some* command's title header line.
-          State = CompareCommands;
+          State       = CompareCommands;
           // Do not increment Line; it points to the first character of the command
           // Do not increment Line; it points to the first character of the command
           // name on the title header line.
           // name on the title header line.
         }
         }
-      break;
+
+        break;
 
 
       // Handle "(\S)\s"
       // Handle "(\S)\s"
       // Compare Command to the title header command name, ignoring case. When we
       // Compare Command to the title header command name, ignoring case. When we
       // reach the end of the command (i.e. we see white space), the next state
       // reach the end of the command (i.e. we see white space), the next state
       // depends on whether the caller wants a copy of the Brief Description.
       // depends on whether the caller wants a copy of the Brief Description.
       case CompareCommands:
       case CompareCommands:
-        if (*Line == L' ' || *Line == L'\t') {
+        if ((*Line == L' ') || (*Line == L'\t')) {
           ReturnFound = TRUE;  // This is the desired command's title header line.
           ReturnFound = TRUE;  // This is the desired command's title header line.
-          State = (BriefDesc == NULL) ? Final : GetBriefDescription;
-        }
-        else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {
+          State       = (BriefDesc == NULL) ? Final : GetBriefDescription;
+        } else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {
           State = Final;
           State = Final;
         }
         }
+
         Line++;
         Line++;
-      break;
+        break;
 
 
       // Handle "[\s01]*(.*)$"
       // Handle "[\s01]*(.*)$"
       // Skip whitespace, '0', and '1' characters, if any, prior to the brief description.
       // Skip whitespace, '0', and '1' characters, if any, prior to the brief description.
       // Return the description to the caller.
       // Return the description to the caller.
       case GetBriefDescription:
       case GetBriefDescription:
-        if (*Line != L' ' && *Line != L'\t' && *Line != L'0' && *Line != L'1') {
-          *BriefSize = StrSize(Line);
-          *BriefDesc = AllocateZeroPool(*BriefSize);
+        if ((*Line != L' ') && (*Line != L'\t') && (*Line != L'0') && (*Line != L'1')) {
+          *BriefSize = StrSize (Line);
+          *BriefDesc = AllocateZeroPool (*BriefSize);
           if (*BriefDesc != NULL) {
           if (*BriefDesc != NULL) {
-            StrCpyS(*BriefDesc, (*BriefSize)/sizeof(CHAR16), Line);
+            StrCpyS (*BriefDesc, (*BriefSize)/sizeof (CHAR16), Line);
           }
           }
+
           State = Final;
           State = Final;
         }
         }
+
         Line++;
         Line++;
-      break;
+        break;
 
 
       default:
       default:
-       break;
+        break;
     }
     }
-
   } while (State < Final);
   } while (State < Final);
 
 
   *Found = ReturnFound;
   *Found = ReturnFound;
@@ -441,7 +458,7 @@ IsTitleHeader(
                                 an allocated buffer if requested.
                                 an allocated buffer if requested.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ManFileFindTitleSection(
+ManFileFindTitleSection (
   IN SHELL_FILE_HANDLE  Handle,
   IN SHELL_FILE_HANDLE  Handle,
   IN CONST CHAR16       *Command,
   IN CONST CHAR16       *Command,
   OUT CHAR16            **BriefDesc OPTIONAL,
   OUT CHAR16            **BriefDesc OPTIONAL,
@@ -455,18 +472,19 @@ ManFileFindTitleSection(
   BOOLEAN     Found;
   BOOLEAN     Found;
   UINTN       Start;
   UINTN       Start;
 
 
-  if ( Handle     == NULL
-    || Command    == NULL
-    || (BriefDesc != NULL && BriefSize == NULL)
-   ){
+  if (  (Handle     == NULL)
+     || (Command    == NULL)
+     || ((BriefDesc != NULL) && (BriefSize == NULL))
+        )
+  {
     return (EFI_INVALID_PARAMETER);
     return (EFI_INVALID_PARAMETER);
   }
   }
 
 
-  Status    = EFI_SUCCESS;
-  Size      = 1024;
-  Found     = FALSE;
+  Status = EFI_SUCCESS;
+  Size   = 1024;
+  Found  = FALSE;
 
 
-  ReadLine  = AllocateZeroPool(Size);
+  ReadLine = AllocateZeroPool (Size);
   if (ReadLine == NULL) {
   if (ReadLine == NULL) {
     return (EFI_OUT_OF_RESOURCES);
     return (EFI_OUT_OF_RESOURCES);
   }
   }
@@ -474,20 +492,21 @@ ManFileFindTitleSection(
   //
   //
   // Do not pass any leading path information that may be present to IsTitleHeader().
   // Do not pass any leading path information that may be present to IsTitleHeader().
   //
   //
-  Start = StrLen(Command);
-  while ((Start != 0)
-         && (*(Command + Start - 1) != L'\\')
-         && (*(Command + Start - 1) != L'/')
-         && (*(Command + Start - 1) != L':')) {
+  Start = StrLen (Command);
+  while (  (Start != 0)
+        && (*(Command + Start - 1) != L'\\')
+        && (*(Command + Start - 1) != L'/')
+        && (*(Command + Start - 1) != L':'))
+  {
     --Start;
     --Start;
   }
   }
 
 
-  for (;!ShellFileHandleEof(Handle);Size = 1024) {
-   Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, Ascii);
+  for ( ; !ShellFileHandleEof (Handle); Size = 1024) {
+    Status = ShellFileHandleReadLine (Handle, ReadLine, &Size, TRUE, Ascii);
     //
     //
     // ignore too small of buffer...
     // ignore too small of buffer...
     //
     //
-    if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {
+    if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
       break;
       break;
     }
     }
 
 
@@ -498,7 +517,7 @@ ManFileFindTitleSection(
     }
     }
   }
   }
 
 
-  FreePool(ReadLine);
+  FreePool (ReadLine);
   return (Status);
   return (Status);
 }
 }
 
 
@@ -533,32 +552,33 @@ ManFileFindTitleSection(
   @retval EFI_NOT_FOUND         There is no help text available for Command.
   @retval EFI_NOT_FOUND         There is no help text available for Command.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ProcessManFile(
-  IN CONST CHAR16 *ManFileName,
-  IN CONST CHAR16 *Command,
-  IN CONST CHAR16 *Sections OPTIONAL,
-  OUT CHAR16      **BriefDesc OPTIONAL,
-  OUT CHAR16      **HelpText
+ProcessManFile (
+  IN CONST CHAR16  *ManFileName,
+  IN CONST CHAR16  *Command,
+  IN CONST CHAR16  *Sections OPTIONAL,
+  OUT CHAR16       **BriefDesc OPTIONAL,
+  OUT CHAR16       **HelpText
   )
   )
 {
 {
-  CHAR16            *TempString;
-  SHELL_FILE_HANDLE FileHandle;
-  EFI_HANDLE        CmdFileImgHandle;
-  EFI_STATUS        Status;
-  UINTN             HelpSize;
-  UINTN             BriefSize;
-  UINTN             StringIdWalker;
-  BOOLEAN           Ascii;
-  CHAR16            *CmdFileName;
-  CHAR16            *CmdFilePathName;
-  EFI_DEVICE_PATH_PROTOCOL      *FileDevPath;
-  EFI_DEVICE_PATH_PROTOCOL      *DevPath;
-  EFI_HII_PACKAGE_LIST_HEADER   *PackageListHeader;
-
-  if ( ManFileName == NULL
-    || Command     == NULL
-    || HelpText    == NULL
-   ){
+  CHAR16                       *TempString;
+  SHELL_FILE_HANDLE            FileHandle;
+  EFI_HANDLE                   CmdFileImgHandle;
+  EFI_STATUS                   Status;
+  UINTN                        HelpSize;
+  UINTN                        BriefSize;
+  UINTN                        StringIdWalker;
+  BOOLEAN                      Ascii;
+  CHAR16                       *CmdFileName;
+  CHAR16                       *CmdFilePathName;
+  EFI_DEVICE_PATH_PROTOCOL     *FileDevPath;
+  EFI_DEVICE_PATH_PROTOCOL     *DevPath;
+  EFI_HII_PACKAGE_LIST_HEADER  *PackageListHeader;
+
+  if (  (ManFileName == NULL)
+     || (Command     == NULL)
+     || (HelpText    == NULL)
+        )
+  {
     return (EFI_INVALID_PARAMETER);
     return (EFI_INVALID_PARAMETER);
   }
   }
 
 
@@ -577,47 +597,49 @@ ProcessManFile(
   //
   //
   // See if it's in HII first
   // See if it's in HII first
   //
   //
-  TempString = ShellCommandGetCommandHelp(Command);
+  TempString = ShellCommandGetCommandHelp (Command);
   if (TempString != NULL) {
   if (TempString != NULL) {
     FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);
     FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);
-    HelpSize = StrLen (TempString) * sizeof (CHAR16);
+    HelpSize   = StrLen (TempString) * sizeof (CHAR16);
     ShellWriteFile (FileHandle, &HelpSize, TempString);
     ShellWriteFile (FileHandle, &HelpSize, TempString);
     ShellSetFilePosition (FileHandle, 0);
     ShellSetFilePosition (FileHandle, 0);
     HelpSize  = 0;
     HelpSize  = 0;
     BriefSize = 0;
     BriefSize = 0;
-    Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
-    if (!EFI_ERROR(Status) && HelpText != NULL){
-      Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);
+    Status    = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
+    if (!EFI_ERROR (Status) && (HelpText != NULL)) {
+      Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
     }
     }
+
     ShellCloseFile (&FileHandle);
     ShellCloseFile (&FileHandle);
   } else {
   } else {
     //
     //
     // If the image is a external app, check .MAN file first.
     // If the image is a external app, check .MAN file first.
     //
     //
-    FileHandle    = NULL;
-    TempString  = GetManFileName(ManFileName);
+    FileHandle = NULL;
+    TempString = GetManFileName (ManFileName);
     if (TempString == NULL) {
     if (TempString == NULL) {
       return (EFI_INVALID_PARAMETER);
       return (EFI_INVALID_PARAMETER);
     }
     }
 
 
-    Status = SearchPathForFile(TempString, &FileHandle);
-    if (EFI_ERROR(Status)) {
-      FileDevPath = FileDevicePath(NULL, TempString);
-      DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, FileDevPath);
-      Status = InternalOpenFileDevicePath(DevPath, &FileHandle, EFI_FILE_MODE_READ, 0);
-      SHELL_FREE_NON_NULL(FileDevPath);
-      SHELL_FREE_NON_NULL(DevPath);
+    Status = SearchPathForFile (TempString, &FileHandle);
+    if (EFI_ERROR (Status)) {
+      FileDevPath = FileDevicePath (NULL, TempString);
+      DevPath     = AppendDevicePath (ShellInfoObject.ImageDevPath, FileDevPath);
+      Status      = InternalOpenFileDevicePath (DevPath, &FileHandle, EFI_FILE_MODE_READ, 0);
+      SHELL_FREE_NON_NULL (FileDevPath);
+      SHELL_FREE_NON_NULL (DevPath);
     }
     }
 
 
-    if (!EFI_ERROR(Status)) {
+    if (!EFI_ERROR (Status)) {
       HelpSize  = 0;
       HelpSize  = 0;
       BriefSize = 0;
       BriefSize = 0;
-      Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
-      if (!EFI_ERROR(Status) && HelpText != NULL){
-        Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);
+      Status    = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
+      if (!EFI_ERROR (Status) && (HelpText != NULL)) {
+        Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
       }
       }
-      ShellInfoObject.NewEfiShellProtocol->CloseFile(FileHandle);
-      if (!EFI_ERROR(Status)) {
+
+      ShellInfoObject.NewEfiShellProtocol->CloseFile (FileHandle);
+      if (!EFI_ERROR (Status)) {
         //
         //
         // Get help text from .MAN file success.
         // Get help text from .MAN file success.
         //
         //
@@ -628,23 +650,25 @@ ProcessManFile(
     //
     //
     // Load the app image to check  EFI_HII_PACKAGE_LIST_PROTOCOL.
     // Load the app image to check  EFI_HII_PACKAGE_LIST_PROTOCOL.
     //
     //
-    CmdFileName     = GetExecuatableFileName(TempString);
+    CmdFileName = GetExecuatableFileName (TempString);
     if (CmdFileName == NULL) {
     if (CmdFileName == NULL) {
       Status = EFI_OUT_OF_RESOURCES;
       Status = EFI_OUT_OF_RESOURCES;
       goto Done;
       goto Done;
     }
     }
+
     //
     //
     // If the file in CWD then use the file name, else use the full
     // If the file in CWD then use the file name, else use the full
     // path name.
     // path name.
     //
     //
-    CmdFilePathName = ShellFindFilePath(CmdFileName);
+    CmdFilePathName = ShellFindFilePath (CmdFileName);
     if (CmdFilePathName == NULL) {
     if (CmdFilePathName == NULL) {
       Status = EFI_NOT_FOUND;
       Status = EFI_NOT_FOUND;
       goto Done;
       goto Done;
     }
     }
-    DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath(CmdFilePathName);
-    Status      = gBS->LoadImage(FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);
-    if(EFI_ERROR(Status)) {
+
+    DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath (CmdFilePathName);
+    Status  = gBS->LoadImage (FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);
+    if (EFI_ERROR (Status)) {
       //
       //
       // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created
       // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created
       // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
       // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
@@ -654,18 +678,20 @@ ProcessManFile(
       if (Status == EFI_SECURITY_VIOLATION) {
       if (Status == EFI_SECURITY_VIOLATION) {
         gBS->UnloadImage (CmdFileImgHandle);
         gBS->UnloadImage (CmdFileImgHandle);
       }
       }
+
       *HelpText = NULL;
       *HelpText = NULL;
       goto Done;
       goto Done;
     }
     }
-    Status = gBS->OpenProtocol(
+
+    Status = gBS->OpenProtocol (
                     CmdFileImgHandle,
                     CmdFileImgHandle,
                     &gEfiHiiPackageListProtocolGuid,
                     &gEfiHiiPackageListProtocolGuid,
-                    (VOID**)&PackageListHeader,
+                    (VOID **)&PackageListHeader,
                     gImageHandle,
                     gImageHandle,
                     NULL,
                     NULL,
                     EFI_OPEN_PROTOCOL_GET_PROTOCOL
                     EFI_OPEN_PROTOCOL_GET_PROTOCOL
                     );
                     );
-    if(EFI_ERROR(Status)) {
+    if (EFI_ERROR (Status)) {
       *HelpText = NULL;
       *HelpText = NULL;
       goto Done;
       goto Done;
     }
     }
@@ -679,60 +705,62 @@ ProcessManFile(
                     EFI_NATIVE_INTERFACE,
                     EFI_NATIVE_INTERFACE,
                     &mShellManHiiDevicePath
                     &mShellManHiiDevicePath
                     );
                     );
-    if (EFI_ERROR(Status)) {
+    if (EFI_ERROR (Status)) {
       goto Done;
       goto Done;
     }
     }
 
 
     Status = gHiiDatabase->NewPackageList (
     Status = gHiiDatabase->NewPackageList (
-                            gHiiDatabase,
-                            PackageListHeader,
-                            mShellManDriverHandle,
-                            &mShellManHiiHandle
-                            );
+                             gHiiDatabase,
+                             PackageListHeader,
+                             mShellManDriverHandle,
+                             &mShellManHiiHandle
+                             );
     if (EFI_ERROR (Status)) {
     if (EFI_ERROR (Status)) {
       goto Done;
       goto Done;
     }
     }
 
 
     StringIdWalker = 1;
     StringIdWalker = 1;
     do {
     do {
-        SHELL_FREE_NON_NULL(TempString);
-        if (BriefDesc != NULL) {
-          SHELL_FREE_NON_NULL(*BriefDesc);
-        }
-        TempString = HiiGetString (mShellManHiiHandle, (EFI_STRING_ID)StringIdWalker, NULL);
-        if (TempString == NULL) {
-          Status = EFI_NOT_FOUND;
-          goto Done;
-        }
-        FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);
-        HelpSize = StrLen (TempString) * sizeof (CHAR16);
-        ShellWriteFile (FileHandle, &HelpSize, TempString);
-        ShellSetFilePosition (FileHandle, 0);
-        HelpSize  = 0;
-        BriefSize = 0;
-        Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
-        if (!EFI_ERROR(Status) && HelpText != NULL){
-          Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);
-        }
-        ShellCloseFile (&FileHandle);
-        if (!EFI_ERROR(Status)){
-          //
-          // Found what we need and return
-          //
-          goto Done;
-        }
+      SHELL_FREE_NON_NULL (TempString);
+      if (BriefDesc != NULL) {
+        SHELL_FREE_NON_NULL (*BriefDesc);
+      }
 
 
-        StringIdWalker += 1;
-    } while (StringIdWalker < 0xFFFF && TempString != NULL);
+      TempString = HiiGetString (mShellManHiiHandle, (EFI_STRING_ID)StringIdWalker, NULL);
+      if (TempString == NULL) {
+        Status = EFI_NOT_FOUND;
+        goto Done;
+      }
 
 
+      FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);
+      HelpSize   = StrLen (TempString) * sizeof (CHAR16);
+      ShellWriteFile (FileHandle, &HelpSize, TempString);
+      ShellSetFilePosition (FileHandle, 0);
+      HelpSize  = 0;
+      BriefSize = 0;
+      Status    = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
+      if (!EFI_ERROR (Status) && (HelpText != NULL)) {
+        Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
+      }
+
+      ShellCloseFile (&FileHandle);
+      if (!EFI_ERROR (Status)) {
+        //
+        // Found what we need and return
+        //
+        goto Done;
+      }
+
+      StringIdWalker += 1;
+    } while (StringIdWalker < 0xFFFF && TempString != NULL);
   }
   }
 
 
 Done:
 Done:
   if (mShellManDriverHandle != NULL) {
   if (mShellManDriverHandle != NULL) {
     gBS->UninstallProtocolInterface (
     gBS->UninstallProtocolInterface (
-            mShellManDriverHandle,
-            &gEfiDevicePathProtocolGuid,
-            &mShellManHiiDevicePath
+           mShellManDriverHandle,
+           &gEfiDevicePathProtocolGuid,
+           &mShellManHiiDevicePath
            );
            );
     mShellManDriverHandle = NULL;
     mShellManDriverHandle = NULL;
   }
   }
@@ -746,12 +774,11 @@ Done:
     Status = gBS->UnloadImage (CmdFileImgHandle);
     Status = gBS->UnloadImage (CmdFileImgHandle);
   }
   }
 
 
-  SHELL_FREE_NON_NULL(TempString);
-  SHELL_FREE_NON_NULL(CmdFileName);
-  SHELL_FREE_NON_NULL(CmdFilePathName);
-  SHELL_FREE_NON_NULL(FileDevPath);
-  SHELL_FREE_NON_NULL(DevPath);
+  SHELL_FREE_NON_NULL (TempString);
+  SHELL_FREE_NON_NULL (CmdFileName);
+  SHELL_FREE_NON_NULL (CmdFilePathName);
+  SHELL_FREE_NON_NULL (FileDevPath);
+  SHELL_FREE_NON_NULL (DevPath);
 
 
   return (Status);
   return (Status);
 }
 }
-

+ 7 - 8
ShellPkg/Application/Shell/ShellManParser.h

@@ -39,12 +39,12 @@
   @retval EFI_NOT_FOUND         There is no help text available for Command.
   @retval EFI_NOT_FOUND         There is no help text available for Command.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ProcessManFile(
-  IN CONST CHAR16 *ManFileName,
-  IN CONST CHAR16 *Command,
-  IN CONST CHAR16 *Sections OPTIONAL,
-  OUT CHAR16      **BriefDesc,
-  OUT CHAR16      **HelpText
+ProcessManFile (
+  IN CONST CHAR16  *ManFileName,
+  IN CONST CHAR16  *Command,
+  IN CONST CHAR16  *Sections OPTIONAL,
+  OUT CHAR16       **BriefDesc,
+  OUT CHAR16       **HelpText
   );
   );
 
 
 /**
 /**
@@ -66,7 +66,7 @@ ProcessManFile(
                                 an allocated buffer.
                                 an allocated buffer.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ManFileFindSections(
+ManFileFindSections (
   IN SHELL_FILE_HANDLE  Handle,
   IN SHELL_FILE_HANDLE  Handle,
   IN CONST CHAR16       *Sections,
   IN CONST CHAR16       *Sections,
   OUT CHAR16            **HelpText,
   OUT CHAR16            **HelpText,
@@ -75,4 +75,3 @@ ManFileFindSections(
   );
   );
 
 
 #endif //_SHELL_MAN_FILE_PARSER_HEADER_
 #endif //_SHELL_MAN_FILE_PARSER_HEADER_
-

File diff suppressed because it is too large
+ 406 - 351
ShellPkg/Application/Shell/ShellParametersProtocol.c


+ 15 - 16
ShellPkg/Application/Shell/ShellParametersProtocol.h

@@ -75,7 +75,7 @@ CleanUpShellParametersProtocol (
   @retval   EFI_OUT_OF_RESOURCES        a memory allocation failed.
   @retval   EFI_OUT_OF_RESOURCES        a memory allocation failed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-UpdateArgcArgv(
+UpdateArgcArgv (
   IN OUT EFI_SHELL_PARAMETERS_PROTOCOL  *ShellParameters,
   IN OUT EFI_SHELL_PARAMETERS_PROTOCOL  *ShellParameters,
   IN CONST CHAR16                       *NewCommandLine,
   IN CONST CHAR16                       *NewCommandLine,
   IN SHELL_OPERATION_TYPES              Type,
   IN SHELL_OPERATION_TYPES              Type,
@@ -93,19 +93,19 @@ UpdateArgcArgv(
   @param[in] OldArgc                    pointer to old number of items in Argv list
   @param[in] OldArgc                    pointer to old number of items in Argv list
 **/
 **/
 VOID
 VOID
-RestoreArgcArgv(
+RestoreArgcArgv (
   IN OUT EFI_SHELL_PARAMETERS_PROTOCOL  *ShellParameters,
   IN OUT EFI_SHELL_PARAMETERS_PROTOCOL  *ShellParameters,
   IN CHAR16                             ***OldArgv,
   IN CHAR16                             ***OldArgv,
   IN UINTN                              *OldArgc
   IN UINTN                              *OldArgc
   );
   );
 
 
 typedef struct {
 typedef struct {
-  EFI_SIMPLE_TEXT_INPUT_PROTOCOL        *ConIn;
-  EFI_HANDLE                            ConInHandle;
-  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL       *ConOut;
-  EFI_HANDLE                            ConOutHandle;
-  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL       *ErrOut;
-  EFI_HANDLE                            ErrOutHandle;
+  EFI_SIMPLE_TEXT_INPUT_PROTOCOL     *ConIn;
+  EFI_HANDLE                         ConInHandle;
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *ConOut;
+  EFI_HANDLE                         ConOutHandle;
+  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *ErrOut;
+  EFI_HANDLE                         ErrOutHandle;
 } SYSTEM_TABLE_INFO;
 } SYSTEM_TABLE_INFO;
 
 
 /**
 /**
@@ -126,7 +126,7 @@ typedef struct {
   @retval   EFI_OUT_OF_RESOURCES        A memory allocation failed.
   @retval   EFI_OUT_OF_RESOURCES        A memory allocation failed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-UpdateStdInStdOutStdErr(
+UpdateStdInStdOutStdErr (
   IN OUT EFI_SHELL_PARAMETERS_PROTOCOL  *ShellParameters,
   IN OUT EFI_SHELL_PARAMETERS_PROTOCOL  *ShellParameters,
   IN CHAR16                             *NewCommandLine,
   IN CHAR16                             *NewCommandLine,
   OUT SHELL_FILE_HANDLE                 *OldStdIn,
   OUT SHELL_FILE_HANDLE                 *OldStdIn,
@@ -172,11 +172,11 @@ RestoreStdInStdOutStdErr (
   @return EFI_OUT_OF_RESOURCES  a memory allocation failed.
   @return EFI_OUT_OF_RESOURCES  a memory allocation failed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ParseCommandLineToArgs(
-  IN CONST CHAR16 *CommandLine,
-  IN BOOLEAN      StripQuotation,
-  IN OUT CHAR16   ***Argv,
-  IN OUT UINTN    *Argc
+ParseCommandLineToArgs (
+  IN CONST CHAR16  *CommandLine,
+  IN BOOLEAN       StripQuotation,
+  IN OUT CHAR16    ***Argv,
+  IN OUT UINTN     *Argc
   );
   );
 
 
 /**
 /**
@@ -200,7 +200,7 @@ ParseCommandLineToArgs(
   @return   EFI_NOT_FOUND         A closing " could not be found on the specified string
   @return   EFI_NOT_FOUND         A closing " could not be found on the specified string
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-GetNextParameter(
+GetNextParameter (
   IN OUT CHAR16   **Walker,
   IN OUT CHAR16   **Walker,
   IN OUT CHAR16   **TempParameter,
   IN OUT CHAR16   **TempParameter,
   IN CONST UINTN  Length,
   IN CONST UINTN  Length,
@@ -208,4 +208,3 @@ GetNextParameter(
   );
   );
 
 
 #endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_
 #endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_
-

File diff suppressed because it is too large
+ 349 - 306
ShellPkg/Application/Shell/ShellProtocol.c


+ 113 - 113
ShellPkg/Application/Shell/ShellProtocol.h

@@ -14,13 +14,13 @@
 #include "Shell.h"
 #include "Shell.h"
 
 
 typedef struct {
 typedef struct {
-  LIST_ENTRY                Link;
-  EFI_SHELL_PROTOCOL        *Interface;
-  EFI_HANDLE                Handle;
+  LIST_ENTRY            Link;
+  EFI_SHELL_PROTOCOL    *Interface;
+  EFI_HANDLE            Handle;
 } SHELL_PROTOCOL_HANDLE_LIST;
 } SHELL_PROTOCOL_HANDLE_LIST;
 
 
 // flags values...
 // flags values...
-#define SHELL_MAP_FLAGS_CONSIST BIT1
+#define SHELL_MAP_FLAGS_CONSIST  BIT1
 
 
 /**
 /**
   Function to create and install on the current handle.
   Function to create and install on the current handle.
@@ -87,9 +87,9 @@ CleanUpShellEnvironment (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellSetMap(
-  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL,
-  IN CONST CHAR16 *Mapping
+EfiShellSetMap (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath OPTIONAL,
+  IN CONST CHAR16                    *Mapping
   );
   );
 
 
 /**
 /**
@@ -107,8 +107,8 @@ EfiShellSetMap(
 **/
 **/
 CONST EFI_DEVICE_PATH_PROTOCOL *
 CONST EFI_DEVICE_PATH_PROTOCOL *
 EFIAPI
 EFIAPI
-EfiShellGetDevicePathFromMap(
-  IN CONST CHAR16 *Mapping
+EfiShellGetDevicePathFromMap (
+  IN CONST CHAR16  *Mapping
   );
   );
 
 
 /**
 /**
@@ -130,8 +130,8 @@ EfiShellGetDevicePathFromMap(
 **/
 **/
 CONST CHAR16 *
 CONST CHAR16 *
 EFIAPI
 EFIAPI
-EfiShellGetMapFromDevicePath(
-  IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+EfiShellGetMapFromDevicePath (
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePath
   );
   );
 
 
 /**
 /**
@@ -149,8 +149,8 @@ EfiShellGetMapFromDevicePath(
 **/
 **/
 CHAR16 *
 CHAR16 *
 EFIAPI
 EFIAPI
-EfiShellGetFilePathFromDevicePath(
-  IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
+EfiShellGetFilePathFromDevicePath (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *Path
   );
   );
 
 
 /**
 /**
@@ -166,8 +166,8 @@ EfiShellGetFilePathFromDevicePath(
 **/
 **/
 EFI_DEVICE_PATH_PROTOCOL *
 EFI_DEVICE_PATH_PROTOCOL *
 EFIAPI
 EFIAPI
-EfiShellGetDevicePathFromFilePath(
-  IN CONST CHAR16 *Path
+EfiShellGetDevicePathFromFilePath (
+  IN CONST CHAR16  *Path
   );
   );
 
 
 /**
 /**
@@ -208,11 +208,11 @@ EfiShellGetDevicePathFromFilePath(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellGetDeviceName(
-  IN EFI_HANDLE DeviceHandle,
-  IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
-  IN CHAR8 *Language,
-  OUT CHAR16 **BestDeviceName
+EfiShellGetDeviceName (
+  IN EFI_HANDLE                   DeviceHandle,
+  IN EFI_SHELL_DEVICE_NAME_FLAGS  Flags,
+  IN CHAR8                        *Language,
+  OUT CHAR16                      **BestDeviceName
   );
   );
 
 
 /**
 /**
@@ -232,9 +232,9 @@ EfiShellGetDeviceName(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellOpenRootByHandle(
-  IN EFI_HANDLE DeviceHandle,
-  OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellOpenRootByHandle (
+  IN EFI_HANDLE          DeviceHandle,
+  OUT SHELL_FILE_HANDLE  *FileHandle
   );
   );
 
 
 /**
 /**
@@ -255,9 +255,9 @@ EfiShellOpenRootByHandle(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellOpenRoot(
-  IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
-  OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellOpenRoot (
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
+  OUT SHELL_FILE_HANDLE        *FileHandle
   );
   );
 
 
 /**
 /**
@@ -287,11 +287,11 @@ EfiShellBatchIsActive (
   @retval other                   an error occurred.
   @retval other                   an error occurred.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-InternalOpenFileDevicePath(
-  IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath2,
-  OUT SHELL_FILE_HANDLE             *FileHandle,
-  IN UINT64                       OpenMode,
-  IN UINT64                       Attributes OPTIONAL
+InternalOpenFileDevicePath (
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath2,
+  OUT SHELL_FILE_HANDLE            *FileHandle,
+  IN UINT64                        OpenMode,
+  IN UINT64                        Attributes OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -332,10 +332,10 @@ InternalOpenFileDevicePath(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellCreateFile(
-  IN CONST CHAR16     *FileName,
-  IN UINT64           FileAttribs,
-  OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellCreateFile (
+  IN CONST CHAR16        *FileName,
+  IN UINT64              FileAttribs,
+  OUT SHELL_FILE_HANDLE  *FileHandle
   );
   );
 
 
 /**
 /**
@@ -392,10 +392,10 @@ EfiShellCreateFile(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellOpenFileByName(
-  IN CONST CHAR16 *FileName,
-  OUT SHELL_FILE_HANDLE *FileHandle,
-  IN UINT64 OpenMode
+EfiShellOpenFileByName (
+  IN CONST CHAR16        *FileName,
+  OUT SHELL_FILE_HANDLE  *FileHandle,
+  IN UINT64              OpenMode
   );
   );
 
 
 /**
 /**
@@ -412,8 +412,8 @@ EfiShellOpenFileByName(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellDeleteFileByName(
-  IN CONST CHAR16 *FileName
+EfiShellDeleteFileByName (
+  IN CONST CHAR16  *FileName
   );
   );
 
 
 /**
 /**
@@ -456,12 +456,12 @@ EfiShellEnablePageBreak (
   @retval EFI_UNSUPPORTED   Nested shell invocations are not allowed.
   @retval EFI_UNSUPPORTED   Nested shell invocations are not allowed.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-InternalShellExecuteDevicePath(
-  IN CONST EFI_HANDLE               *ParentImageHandle,
-  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
-  IN CONST CHAR16                   *CommandLine OPTIONAL,
-  IN CONST CHAR16                   **Environment OPTIONAL,
-  OUT EFI_STATUS                    *StartImageStatus OPTIONAL
+InternalShellExecuteDevicePath (
+  IN CONST EFI_HANDLE                *ParentImageHandle,
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
+  IN CONST CHAR16                    *CommandLine OPTIONAL,
+  IN CONST CHAR16                    **Environment OPTIONAL,
+  OUT EFI_STATUS                     *StartImageStatus OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -497,11 +497,11 @@ InternalShellExecuteDevicePath(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellExecute(
-  IN EFI_HANDLE *ParentImageHandle,
-  IN CHAR16 *CommandLine OPTIONAL,
-  IN CHAR16 **Environment OPTIONAL,
-  OUT EFI_STATUS *StatusCode OPTIONAL
+EfiShellExecute (
+  IN EFI_HANDLE   *ParentImageHandle,
+  IN CHAR16       *CommandLine OPTIONAL,
+  IN CHAR16       **Environment OPTIONAL,
+  OUT EFI_STATUS  *StatusCode OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -513,8 +513,8 @@ EfiShellExecute(
   @param FileListNode     pointer to the list node to free
   @param FileListNode     pointer to the list node to free
 **/
 **/
 VOID
 VOID
-FreeShellFileInfoNode(
-  IN EFI_SHELL_FILE_INFO *FileListNode
+FreeShellFileInfoNode (
+  IN EFI_SHELL_FILE_INFO  *FileListNode
   );
   );
 
 
 /**
 /**
@@ -531,8 +531,8 @@ FreeShellFileInfoNode(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellFreeFileList(
-  IN EFI_SHELL_FILE_INFO **FileList
+EfiShellFreeFileList (
+  IN EFI_SHELL_FILE_INFO  **FileList
   );
   );
 
 
 /**
 /**
@@ -547,8 +547,8 @@ EfiShellFreeFileList(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellRemoveDupInFileList(
-  IN EFI_SHELL_FILE_INFO **FileList
+EfiShellRemoveDupInFileList (
+  IN EFI_SHELL_FILE_INFO  **FileList
   );
   );
 
 
 /**
 /**
@@ -563,12 +563,12 @@ EfiShellRemoveDupInFileList(
 
 
 **/
 **/
 EFI_SHELL_FILE_INFO *
 EFI_SHELL_FILE_INFO *
-CreateAndPopulateShellFileInfo(
-  IN CONST CHAR16 *BasePath,
-  IN CONST EFI_STATUS Status,
-  IN CONST CHAR16 *FileName,
-  IN CONST SHELL_FILE_HANDLE Handle,
-  IN CONST EFI_FILE_INFO *Info
+CreateAndPopulateShellFileInfo (
+  IN CONST CHAR16             *BasePath,
+  IN CONST EFI_STATUS         Status,
+  IN CONST CHAR16             *FileName,
+  IN CONST SHELL_FILE_HANDLE  Handle,
+  IN CONST EFI_FILE_INFO      *Info
   );
   );
 
 
 /**
 /**
@@ -586,9 +586,9 @@ CreateAndPopulateShellFileInfo(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellFindFilesInDir(
-  IN SHELL_FILE_HANDLE FileDirHandle,
-  OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellFindFilesInDir (
+  IN SHELL_FILE_HANDLE     FileDirHandle,
+  OUT EFI_SHELL_FILE_INFO  **FileList
   );
   );
 
 
 /**
 /**
@@ -619,9 +619,9 @@ EfiShellFindFilesInDir(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellFindFiles(
-  IN CONST CHAR16 *FilePattern,
-  OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellFindFiles (
+  IN CONST CHAR16          *FilePattern,
+  OUT EFI_SHELL_FILE_INFO  **FileList
   );
   );
 
 
 /**
 /**
@@ -641,10 +641,10 @@ EfiShellFindFiles(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellOpenFileList(
-  IN CHAR16 *Path,
-  IN UINT64 OpenMode,
-  IN OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellOpenFileList (
+  IN CHAR16                   *Path,
+  IN UINT64                   OpenMode,
+  IN OUT EFI_SHELL_FILE_INFO  **FileList
   );
   );
 
 
 /**
 /**
@@ -660,8 +660,8 @@ EfiShellOpenFileList(
 **/
 **/
 CONST CHAR16 *
 CONST CHAR16 *
 EFIAPI
 EFIAPI
-EfiShellGetEnv(
-  IN CONST CHAR16 *Name
+EfiShellGetEnv (
+  IN CONST CHAR16  *Name
   );
   );
 
 
 /**
 /**
@@ -687,10 +687,10 @@ EfiShellGetEnv(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellSetEnv(
-  IN CONST CHAR16 *Name,
-  IN CONST CHAR16 *Value,
-  IN BOOLEAN Volatile
+EfiShellSetEnv (
+  IN CONST CHAR16  *Name,
+  IN CONST CHAR16  *Value,
+  IN BOOLEAN       Volatile
   );
   );
 
 
 /**
 /**
@@ -709,8 +709,8 @@ EfiShellSetEnv(
 **/
 **/
 CONST CHAR16 *
 CONST CHAR16 *
 EFIAPI
 EFIAPI
-EfiShellGetCurDir(
-  IN CONST CHAR16 *FileSystemMapping OPTIONAL
+EfiShellGetCurDir (
+  IN CONST CHAR16  *FileSystemMapping OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -738,9 +738,9 @@ EfiShellGetCurDir(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellSetCurDir(
-  IN CONST CHAR16 *FileSystem OPTIONAL,
-  IN CONST CHAR16 *Dir
+EfiShellSetCurDir (
+  IN CONST CHAR16  *FileSystem OPTIONAL,
+  IN CONST CHAR16  *Dir
   );
   );
 
 
 /**
 /**
@@ -770,10 +770,10 @@ EfiShellSetCurDir(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellGetHelpText(
-  IN CONST CHAR16 *Command,
-  IN CONST CHAR16 *Sections OPTIONAL,
-  OUT CHAR16 **HelpText
+EfiShellGetHelpText (
+  IN CONST CHAR16  *Command,
+  IN CONST CHAR16  *Sections OPTIONAL,
+  OUT CHAR16       **HelpText
   );
   );
 
 
 /**
 /**
@@ -786,7 +786,7 @@ EfiShellGetHelpText(
 **/
 **/
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
-EfiShellGetPageBreak(
+EfiShellGetPageBreak (
   VOID
   VOID
   );
   );
 
 
@@ -800,7 +800,7 @@ EfiShellGetPageBreak(
 **/
 **/
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
-EfiShellIsRootShell(
+EfiShellIsRootShell (
   VOID
   VOID
   );
   );
 
 
@@ -823,9 +823,9 @@ EfiShellIsRootShell(
 **/
 **/
 CONST CHAR16 *
 CONST CHAR16 *
 EFIAPI
 EFIAPI
-EfiShellGetAlias(
-  IN  CONST CHAR16 *Command,
-  OUT BOOLEAN      *Volatile OPTIONAL
+EfiShellGetAlias (
+  IN  CONST CHAR16  *Command,
+  OUT BOOLEAN       *Volatile OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -845,10 +845,10 @@ EfiShellGetAlias(
   @retval EFI_NOT_FOUND         the Alias intended to be deleted was not found
   @retval EFI_NOT_FOUND         the Alias intended to be deleted was not found
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-InternalSetAlias(
-  IN CONST CHAR16 *Command,
-  IN CONST CHAR16 *Alias OPTIONAL,
-  IN BOOLEAN Volatile
+InternalSetAlias (
+  IN CONST CHAR16  *Command,
+  IN CONST CHAR16  *Alias OPTIONAL,
+  IN BOOLEAN       Volatile
   );
   );
 
 
 /**
 /**
@@ -873,11 +873,11 @@ InternalSetAlias(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-EfiShellSetAlias(
-  IN CONST CHAR16 *Command,
-  IN CONST CHAR16 *Alias OPTIONAL,
-  IN BOOLEAN Replace,
-  IN BOOLEAN Volatile
+EfiShellSetAlias (
+  IN CONST CHAR16  *Command,
+  IN CONST CHAR16  *Alias OPTIONAL,
+  IN BOOLEAN       Replace,
+  IN BOOLEAN       Volatile
   );
   );
 
 
 /**
 /**
@@ -889,8 +889,8 @@ EfiShellSetAlias(
   @param FileListNode     pointer to the list node to free
   @param FileListNode     pointer to the list node to free
 **/
 **/
 VOID
 VOID
-InternalFreeShellFileInfoNode(
-  IN EFI_SHELL_FILE_INFO *FileListNode
+InternalFreeShellFileInfoNode (
+  IN EFI_SHELL_FILE_INFO  *FileListNode
   );
   );
 
 
 /**
 /**
@@ -904,10 +904,10 @@ InternalFreeShellFileInfoNode(
   @retval EFI_SUCCESS           The environment variable was successfully updated.
   @retval EFI_SUCCESS           The environment variable was successfully updated.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-InternalEfiShellSetEnv(
-  IN CONST CHAR16 *Name,
-  IN CONST CHAR16 *Value,
-  IN BOOLEAN Volatile
+InternalEfiShellSetEnv (
+  IN CONST CHAR16  *Name,
+  IN CONST CHAR16  *Value,
+  IN BOOLEAN       Volatile
   );
   );
 
 
 /**
 /**
@@ -918,7 +918,7 @@ InternalEfiShellSetEnv(
   @retval EFI_OUT_OF_RESOURCES  There is not enough memory available.
   @retval EFI_OUT_OF_RESOURCES  There is not enough memory available.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-InernalEfiShellStartMonitor(
+InernalEfiShellStartMonitor (
   VOID
   VOID
   );
   );
 
 
@@ -931,8 +931,8 @@ InernalEfiShellStartMonitor(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-NotificationFunction(
-  IN EFI_KEY_DATA *KeyData
+NotificationFunction (
+  IN EFI_KEY_DATA  *KeyData
   );
   );
-#endif //_SHELL_PROTOCOL_HEADER_
 
 
+#endif //_SHELL_PROTOCOL_HEADER_

+ 5 - 3
ShellPkg/Application/ShellCTestApp/ShellCTestApp.c

@@ -29,16 +29,18 @@
 INTN
 INTN
 EFIAPI
 EFIAPI
 ShellAppMain (
 ShellAppMain (
-  IN UINTN Argc,
-  IN CHAR16 **Argv
+  IN UINTN   Argc,
+  IN CHAR16  **Argv
   )
   )
 {
 {
   UINTN  Index;
   UINTN  Index;
+
   if (Argc == 1) {
   if (Argc == 1) {
     Print (L"Argv[1] = NULL\n");
     Print (L"Argv[1] = NULL\n");
   }
   }
+
   for (Index = 1; Index < Argc; Index++) {
   for (Index = 1; Index < Argc; Index++) {
-    Print(L"Argv[%d]: \"%s\"\n", Index, Argv[Index]);
+    Print (L"Argv[%d]: \"%s\"\n", Index, Argv[Index]);
   }
   }
 
 
   return 0;
   return 0;

+ 1 - 1
ShellPkg/Application/ShellExecTestApp/SA.c

@@ -27,6 +27,6 @@ UefiMain (
   IN EFI_SYSTEM_TABLE  *SystemTable
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  Print(L"ShellExecute - Pass");
+  Print (L"ShellExecute - Pass");
   return EFI_SUCCESS;
   return EFI_SUCCESS;
 }
 }

+ 16 - 11
ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c

@@ -24,14 +24,19 @@
 **/
 **/
 INTN
 INTN
 EFIAPI
 EFIAPI
-Test(CONST VOID *b1, CONST VOID *b2)
+Test (
+  CONST VOID  *b1,
+  CONST VOID  *b2
+  )
 {
 {
-  if (*(INTN*)b1 == *(INTN*)b2) {
+  if (*(INTN *)b1 == *(INTN *)b2) {
     return (0);
     return (0);
   }
   }
-  if (*(INTN*)b1 < *(INTN*)b2) {
-    return(-1);
+
+  if (*(INTN *)b1 < *(INTN *)b2) {
+    return (-1);
   }
   }
+
   return (1);
   return (1);
 }
 }
 
 
@@ -52,11 +57,11 @@ Test(CONST VOID *b1, CONST VOID *b2)
 INTN
 INTN
 EFIAPI
 EFIAPI
 ShellAppMain (
 ShellAppMain (
-  IN UINTN Argc,
-  IN CHAR16 **Argv
+  IN UINTN   Argc,
+  IN CHAR16  **Argv
   )
   )
 {
 {
-  INTN Array[10];
+  INTN  Array[10];
 
 
   Array[0] = 2;
   Array[0] = 2;
   Array[1] = 3;
   Array[1] = 3;
@@ -69,9 +74,9 @@ ShellAppMain (
   Array[8] = 1;
   Array[8] = 1;
   Array[9] = 5;
   Array[9] = 5;
 
 
-  Print(L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0],Array[1],Array[2],Array[3],Array[4],Array[5],Array[6],Array[7],Array[8],Array[9]);
-  PerformQuickSort(Array, 10, sizeof(INTN), Test);
-  Print(L"POST-SORT\r\n");
-  Print(L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0],Array[1],Array[2],Array[3],Array[4],Array[5],Array[6],Array[7],Array[8],Array[9]);
+  Print (L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0], Array[1], Array[2], Array[3], Array[4], Array[5], Array[6], Array[7], Array[8], Array[9]);
+  PerformQuickSort (Array, 10, sizeof (INTN), Test);
+  Print (L"POST-SORT\r\n");
+  Print (L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0], Array[1], Array[2], Array[3], Array[4], Array[5], Array[6], Array[7], Array[8], Array[9]);
   return 0;
   return 0;
 }
 }

File diff suppressed because it is too large
+ 361 - 326
ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c


+ 41 - 41
ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h

@@ -9,7 +9,6 @@
 #ifndef _DP_H_
 #ifndef _DP_H_
 #define _DP_H_
 #define _DP_H_
 
 
-
 #include <Uefi.h>
 #include <Uefi.h>
 
 
 #include <Guid/Performance.h>
 #include <Guid/Performance.h>
@@ -36,32 +35,32 @@
 #include <Library/UefiHiiServicesLib.h>
 #include <Library/UefiHiiServicesLib.h>
 #include <Library/PerformanceLib.h>
 #include <Library/PerformanceLib.h>
 
 
-extern EFI_HII_HANDLE mDpHiiHandle;
+extern EFI_HII_HANDLE  mDpHiiHandle;
 
 
-#define DP_MAJOR_VERSION        2
-#define DP_MINOR_VERSION        5
+#define DP_MAJOR_VERSION  2
+#define DP_MINOR_VERSION  5
 
 
 /**
 /**
   * The value assigned to DP_DEBUG controls which debug output
   * The value assigned to DP_DEBUG controls which debug output
   * is generated.  Set it to ZERO to disable.
   * is generated.  Set it to ZERO to disable.
 **/
 **/
-#define DP_DEBUG                0
+#define DP_DEBUG  0
 
 
-#define DEFAULT_THRESHOLD       1000    ///< One millisecond.
-#define DEFAULT_DISPLAYCOUNT    50
-#define MAXIMUM_DISPLAYCOUNT    999999  ///< Arbitrary maximum reasonable number.
+#define DEFAULT_THRESHOLD     1000      ///< One millisecond.
+#define DEFAULT_DISPLAYCOUNT  50
+#define MAXIMUM_DISPLAYCOUNT  999999    ///< Arbitrary maximum reasonable number.
 
 
-#define PERF_MAXDUR             0xFFFFFFFFFFFFFFFFULL
+#define PERF_MAXDUR  0xFFFFFFFFFFFFFFFFULL
 
 
 /// Determine whether  0 <= C < L.  If L == 0, return true regardless of C.
 /// Determine whether  0 <= C < L.  If L == 0, return true regardless of C.
-#define WITHIN_LIMIT( C, L)   ( ((L) == 0) || ((C) < (L)) )
+#define WITHIN_LIMIT(C, L)  ( ((L) == 0) || ((C) < (L)) )
 
 
 /// Structure for storing Timer specific information.
 /// Structure for storing Timer specific information.
 typedef struct {
 typedef struct {
-  UINT64    StartCount;   ///< Value timer is initialized with.
-  UINT64    EndCount;     ///< Value timer has just before it wraps.
-  UINT32    Frequency;    ///< Timer count frequency in KHz.
-  BOOLEAN   CountUp;      ///< TRUE if the counter counts up.
+  UINT64     StartCount;  ///< Value timer is initialized with.
+  UINT64     EndCount;    ///< Value timer has just before it wraps.
+  UINT32     Frequency;   ///< Timer count frequency in KHz.
+  BOOLEAN    CountUp;     ///< TRUE if the counter counts up.
 } TIMER_INFO;
 } TIMER_INFO;
 
 
 /** Initialize one PERF_CUM_DATA structure instance for token t.
 /** Initialize one PERF_CUM_DATA structure instance for token t.
@@ -73,40 +72,40 @@ typedef struct {
   *   - PERF_INIT_CUM_DATA(pointer)         A pointer -- CHAR8 *pointer;
   *   - PERF_INIT_CUM_DATA(pointer)         A pointer -- CHAR8 *pointer;
   *   - PERF_INIT_CUM_DATA(array)           Address of an array -- CHAR8 array[N];
   *   - PERF_INIT_CUM_DATA(array)           Address of an array -- CHAR8 array[N];
 **/
 **/
-#define PERF_INIT_CUM_DATA(t)   { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
+#define PERF_INIT_CUM_DATA(t)  { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
 
 
 typedef struct {
 typedef struct {
-  UINT64  Duration;     ///< Cumulative duration for this item.
-  UINT64  MinDur;       ///< Smallest duration encountered.
-  UINT64  MaxDur;       ///< Largest duration encountered.
-  CHAR8   *Name;        ///< ASCII name of this item.
-  UINT32  Count;        ///< Total number of measurements accumulated.
+  UINT64    Duration;   ///< Cumulative duration for this item.
+  UINT64    MinDur;     ///< Smallest duration encountered.
+  UINT64    MaxDur;     ///< Largest duration encountered.
+  CHAR8     *Name;      ///< ASCII name of this item.
+  UINT32    Count;      ///< Total number of measurements accumulated.
 } PERF_CUM_DATA;
 } PERF_CUM_DATA;
 
 
 typedef struct {
 typedef struct {
-  UINT32                NumTrace;         ///< Number of recorded TRACE performance measurements.
-  UINT32                NumIncomplete;    ///< Number of measurements with no END value.
-  UINT32                NumSummary;       ///< Number of summary section measurements.
-  UINT32                NumHandles;       ///< Number of measurements with handles.
-  UINT32                NumPEIMs;         ///< Number of measurements of PEIMs.
-  UINT32                NumGlobal;        ///< Number of measurements with END value and NULL handle.
+  UINT32    NumTrace;                     ///< Number of recorded TRACE performance measurements.
+  UINT32    NumIncomplete;                ///< Number of measurements with no END value.
+  UINT32    NumSummary;                   ///< Number of summary section measurements.
+  UINT32    NumHandles;                   ///< Number of measurements with handles.
+  UINT32    NumPEIMs;                     ///< Number of measurements of PEIMs.
+  UINT32    NumGlobal;                    ///< Number of measurements with END value and NULL handle.
 } PERF_SUMMARY_DATA;
 } PERF_SUMMARY_DATA;
 
 
 typedef struct {
 typedef struct {
-  CONST VOID            *Handle;
-  CONST CHAR8           *Token;           ///< Measured token string name.
-  CONST CHAR8           *Module;          ///< Module string name.
-  UINT64                StartTimeStamp;   ///< Start time point.
-  UINT64                EndTimeStamp;     ///< End time point.
-  UINT32                Identifier;       ///< Identifier.
+  CONST VOID     *Handle;
+  CONST CHAR8    *Token;                  ///< Measured token string name.
+  CONST CHAR8    *Module;                 ///< Module string name.
+  UINT64         StartTimeStamp;          ///< Start time point.
+  UINT64         EndTimeStamp;            ///< End time point.
+  UINT32         Identifier;              ///< Identifier.
 } MEASUREMENT_RECORD;
 } MEASUREMENT_RECORD;
 
 
 typedef struct {
 typedef struct {
-  CHAR8                 *Name;            ///< Measured token string name.
-  UINT64                CumulativeTime;   ///< Accumulated Elapsed Time.
-  UINT64                MinTime;          ///< Minimum Elapsed Time.
-  UINT64                MaxTime;          ///< Maximum Elapsed Time.
-  UINT32                Count;            ///< Number of measurements accumulated.
+  CHAR8     *Name;                        ///< Measured token string name.
+  UINT64    CumulativeTime;               ///< Accumulated Elapsed Time.
+  UINT64    MinTime;                      ///< Minimum Elapsed Time.
+  UINT64    MaxTime;                      ///< Maximum Elapsed Time.
+  UINT32    Count;                        ///< Number of measurements accumulated.
 } PROFILE_RECORD;
 } PROFILE_RECORD;
 
 
 /**
 /**
@@ -122,8 +121,8 @@ typedef struct {
 **/
 **/
 SHELL_STATUS
 SHELL_STATUS
 RunDp (
 RunDp (
-  IN EFI_HANDLE               ImageHandle,
-  IN EFI_SYSTEM_TABLE         *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   );
   );
 
 
 /**
 /**
@@ -135,6 +134,7 @@ RunDp (
 **/
 **/
 EFI_HII_HANDLE
 EFI_HII_HANDLE
 InitializeHiiPackage (
 InitializeHiiPackage (
-  EFI_HANDLE                  ImageHandle
+  EFI_HANDLE  ImageHandle
   );
   );
-#endif  // _DP_H_
+
+#endif // _DP_H_

+ 5 - 4
ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c

@@ -16,7 +16,7 @@
 // the resource section. Thus the application can use '-?' option to show help message in
 // the resource section. Thus the application can use '-?' option to show help message in
 // Shell.
 // Shell.
 //
 //
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_DP);
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID  mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_DP);
 
 
 /**
 /**
   Entry point of Tftp standalone application.
   Entry point of Tftp standalone application.
@@ -31,11 +31,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (S
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 DpAppInitialize (
 DpAppInitialize (
-  IN EFI_HANDLE               ImageHandle,
-  IN EFI_SYSTEM_TABLE         *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
+
   mDpHiiHandle = InitializeHiiPackage (ImageHandle);
   mDpHiiHandle = InitializeHiiPackage (ImageHandle);
   if (mDpHiiHandle == NULL) {
   if (mDpHiiHandle == NULL) {
     return EFI_ABORTED;
     return EFI_ABORTED;

+ 16 - 13
ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c

@@ -25,10 +25,10 @@
 SHELL_STATUS
 SHELL_STATUS
 EFIAPI
 EFIAPI
 DpCommandHandler (
 DpCommandHandler (
-  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL    *This,
-  IN EFI_SYSTEM_TABLE                      *SystemTable,
-  IN EFI_SHELL_PARAMETERS_PROTOCOL         *ShellParameters,
-  IN EFI_SHELL_PROTOCOL                    *Shell
+  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  *This,
+  IN EFI_SYSTEM_TABLE                    *SystemTable,
+  IN EFI_SHELL_PARAMETERS_PROTOCOL       *ShellParameters,
+  IN EFI_SHELL_PROTOCOL                  *Shell
   )
   )
 {
 {
   gEfiShellParametersProtocol = ShellParameters;
   gEfiShellParametersProtocol = ShellParameters;
@@ -49,14 +49,14 @@ DpCommandHandler (
 CHAR16 *
 CHAR16 *
 EFIAPI
 EFIAPI
 DpCommandGetHelp (
 DpCommandGetHelp (
-  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL    *This,
-  IN CONST CHAR8                           *Language
+  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  *This,
+  IN CONST CHAR8                         *Language
   )
   )
 {
 {
   return HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_GET_HELP_DP), Language);
   return HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_GET_HELP_DP), Language);
 }
 }
 
 
-EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mDpDynamicCommand = {
+EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  mDpDynamicCommand = {
   L"dp",
   L"dp",
   DpCommandHandler,
   DpCommandHandler,
   DpCommandGetHelp
   DpCommandGetHelp
@@ -77,11 +77,12 @@ EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mDpDynamicCommand = {
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 DpCommandInitialize (
 DpCommandInitialize (
-  IN EFI_HANDLE               ImageHandle,
-  IN EFI_SYSTEM_TABLE         *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
+
   mDpHiiHandle = InitializeHiiPackage (ImageHandle);
   mDpHiiHandle = InitializeHiiPackage (ImageHandle);
   if (mDpHiiHandle == NULL) {
   if (mDpHiiHandle == NULL) {
     return EFI_ABORTED;
     return EFI_ABORTED;
@@ -108,10 +109,11 @@ DpCommandInitialize (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 DpUnload (
 DpUnload (
-  IN EFI_HANDLE               ImageHandle
-)
+  IN EFI_HANDLE  ImageHandle
+  )
 {
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
+
   Status = gBS->UninstallProtocolInterface (
   Status = gBS->UninstallProtocolInterface (
                   ImageHandle,
                   ImageHandle,
                   &gEfiShellDynamicCommandProtocolGuid,
                   &gEfiShellDynamicCommandProtocolGuid,
@@ -120,6 +122,7 @@ DpUnload (
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     return Status;
     return Status;
   }
   }
+
   HiiRemovePackages (mDpHiiHandle);
   HiiRemovePackages (mDpHiiHandle);
   return EFI_SUCCESS;
   return EFI_SUCCESS;
 }
 }

+ 39 - 40
ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h

@@ -10,31 +10,32 @@
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 **/
+
 #ifndef _DP_INTELNAL_H_
 #ifndef _DP_INTELNAL_H_
 #define _DP_INTELNAL_H_
 #define _DP_INTELNAL_H_
 
 
-#define DP_GAUGE_STRING_LENGTH   36
+#define DP_GAUGE_STRING_LENGTH  36
 
 
 //
 //
 /// Module-Global Variables
 /// Module-Global Variables
 ///@{
 ///@{
-extern EFI_HII_HANDLE     mDpHiiHandle;
-extern CHAR16             mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
-extern CHAR16             mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
-extern UINT64             mInterestThreshold;
-extern BOOLEAN            mShowId;
-extern UINT8              *mBootPerformanceTable;
-extern UINTN              mBootPerformanceTableLength;
-extern MEASUREMENT_RECORD *mMeasurementList;
-extern UINTN              mMeasurementNum;
+extern EFI_HII_HANDLE      mDpHiiHandle;
+extern CHAR16              mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
+extern CHAR16              mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
+extern UINT64              mInterestThreshold;
+extern BOOLEAN             mShowId;
+extern UINT8               *mBootPerformanceTable;
+extern UINTN               mBootPerformanceTableLength;
+extern MEASUREMENT_RECORD  *mMeasurementList;
+extern UINTN               mMeasurementNum;
 
 
 extern PERF_SUMMARY_DATA  SummaryData;    ///< Create the SummaryData structure and init. to ZERO.
 extern PERF_SUMMARY_DATA  SummaryData;    ///< Create the SummaryData structure and init. to ZERO.
 
 
 /// Items for which to gather cumulative statistics.
 /// Items for which to gather cumulative statistics.
-extern PERF_CUM_DATA      CumData[];
+extern PERF_CUM_DATA  CumData[];
 
 
 /// Number of items for which we are gathering cumulative statistics.
 /// Number of items for which we are gathering cumulative statistics.
-extern UINT32 const       NumCum;
+extern UINT32 const  NumCum;
 
 
 ///@}
 ///@}
 
 
@@ -60,7 +61,7 @@ extern UINT32 const       NumCum;
 **/
 **/
 UINT64
 UINT64
 GetDuration (
 GetDuration (
-  IN OUT MEASUREMENT_RECORD *Measurement
+  IN OUT MEASUREMENT_RECORD  *Measurement
   );
   );
 
 
 /**
 /**
@@ -75,8 +76,8 @@ GetDuration (
   @retval     FALSE       The measurement record is NOT for an EFI Phase.
   @retval     FALSE       The measurement record is NOT for an EFI Phase.
 **/
 **/
 BOOLEAN
 BOOLEAN
-IsPhase(
-  IN MEASUREMENT_RECORD *Measurement
+IsPhase (
+  IN MEASUREMENT_RECORD  *Measurement
   );
   );
 
 
 /**
 /**
@@ -89,8 +90,8 @@ IsPhase(
 
 
 **/
 **/
 BOOLEAN
 BOOLEAN
-IsCorePerf(
-  IN MEASUREMENT_RECORD        *Measurement
+IsCorePerf (
+  IN MEASUREMENT_RECORD  *Measurement
   );
   );
 
 
 /**
 /**
@@ -107,8 +108,8 @@ IsCorePerf(
 **/
 **/
 VOID
 VOID
 DpGetShortPdbFileName (
 DpGetShortPdbFileName (
-  IN  CHAR8     *PdbFileName,
-  OUT CHAR16    *UnicodeBuffer
+  IN  CHAR8   *PdbFileName,
+  OUT CHAR16  *UnicodeBuffer
   );
   );
 
 
 /**
 /**
@@ -129,7 +130,7 @@ DpGetShortPdbFileName (
 **/
 **/
 VOID
 VOID
 DpGetNameFromHandle (
 DpGetNameFromHandle (
-  IN EFI_HANDLE Handle
+  IN EFI_HANDLE  Handle
   );
   );
 
 
 /**
 /**
@@ -147,7 +148,7 @@ DpGetNameFromHandle (
 **/
 **/
 UINT64
 UINT64
 DurationInMicroSeconds (
 DurationInMicroSeconds (
-  IN UINT64 Duration
+  IN UINT64  Duration
   );
   );
 
 
 /**
 /**
@@ -164,8 +165,8 @@ DurationInMicroSeconds (
   @retval     >=0   Return value is the index into CumData where Token is found.
   @retval     >=0   Return value is the index into CumData where Token is found.
 **/
 **/
 INTN
 INTN
-GetCumulativeItem(
-  IN MEASUREMENT_RECORD *Measurement
+GetCumulativeItem (
+  IN MEASUREMENT_RECORD  *Measurement
   );
   );
 
 
 /**
 /**
@@ -186,8 +187,8 @@ GetCumulativeItem(
 
 
 **/
 **/
 VOID
 VOID
-GatherStatistics(
-  IN OUT PERF_CUM_DATA              *CustomCumulativeData OPTIONAL
+GatherStatistics (
+  IN OUT PERF_CUM_DATA  *CustomCumulativeData OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -212,9 +213,9 @@ GatherStatistics(
   @return Others                from a call to gBS->LocateHandleBuffer().
   @return Others                from a call to gBS->LocateHandleBuffer().
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-DumpAllTrace(
-  IN UINTN             Limit,
-  IN BOOLEAN           ExcludeFlag
+DumpAllTrace (
+  IN UINTN    Limit,
+  IN BOOLEAN  ExcludeFlag
   );
   );
 
 
 /**
 /**
@@ -237,9 +238,9 @@ DumpAllTrace(
   @retval EFI_ABORTED           The user aborts the operation.
   @retval EFI_ABORTED           The user aborts the operation.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-DumpRawTrace(
-  IN UINTN          Limit,
-  IN BOOLEAN        ExcludeFlag
+DumpRawTrace (
+  IN UINTN    Limit,
+  IN BOOLEAN  ExcludeFlag
   );
   );
 
 
 /**
 /**
@@ -247,11 +248,10 @@ DumpRawTrace(
 
 
 **/
 **/
 VOID
 VOID
-ProcessPhases(
+ProcessPhases (
   VOID
   VOID
   );
   );
 
 
-
 /**
 /**
   Gather and print Handle data.
   Gather and print Handle data.
 
 
@@ -262,11 +262,10 @@ ProcessPhases(
   @return Others                  from a call to gBS->LocateHandleBuffer().
   @return Others                  from a call to gBS->LocateHandleBuffer().
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ProcessHandles(
-  IN BOOLEAN ExcludeFlag
+ProcessHandles (
+  IN BOOLEAN  ExcludeFlag
   );
   );
 
 
-
 /**
 /**
   Gather and print PEIM data.
   Gather and print PEIM data.
 
 
@@ -276,7 +275,7 @@ ProcessHandles(
   @retval EFI_ABORTED           The user aborts the operation.
   @retval EFI_ABORTED           The user aborts the operation.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ProcessPeims(
+ProcessPeims (
   VOID
   VOID
   );
   );
 
 
@@ -292,7 +291,7 @@ ProcessPeims(
   @retval EFI_ABORTED           The user aborts the operation.
   @retval EFI_ABORTED           The user aborts the operation.
 **/
 **/
 EFI_STATUS
 EFI_STATUS
-ProcessGlobal(
+ProcessGlobal (
   VOID
   VOID
   );
   );
 
 
@@ -308,8 +307,8 @@ ProcessGlobal(
 
 
 **/
 **/
 VOID
 VOID
-ProcessCumulative(
-  IN PERF_CUM_DATA                  *CustomCumulativeData OPTIONAL
+ProcessCumulative (
+  IN PERF_CUM_DATA  *CustomCumulativeData OPTIONAL
   );
   );
 
 
 #endif
 #endif

File diff suppressed because it is too large
+ 359 - 233
ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c


+ 77 - 72
ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c

@@ -55,23 +55,24 @@
 **/
 **/
 UINT64
 UINT64
 GetDuration (
 GetDuration (
-  IN OUT MEASUREMENT_RECORD   *Measurement
+  IN OUT MEASUREMENT_RECORD  *Measurement
   )
   )
 {
 {
-  UINT64    Duration;
-  BOOLEAN   Error;
+  UINT64   Duration;
+  BOOLEAN  Error;
 
 
   if (Measurement->EndTimeStamp == 0) {
   if (Measurement->EndTimeStamp == 0) {
     return 0;
     return 0;
   }
   }
 
 
   Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp;
   Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp;
-  Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp);
+  Error    = (BOOLEAN)(Duration > Measurement->EndTimeStamp);
 
 
   if (Error) {
   if (Error) {
     DEBUG ((DEBUG_ERROR, ALit_TimerLibError));
     DEBUG ((DEBUG_ERROR, ALit_TimerLibError));
     Duration = 0;
     Duration = 0;
   }
   }
+
   return Duration;
   return Duration;
 }
 }
 
 
@@ -87,18 +88,18 @@ GetDuration (
   @retval     FALSE       The measurement record is NOT for an EFI Phase.
   @retval     FALSE       The measurement record is NOT for an EFI Phase.
 **/
 **/
 BOOLEAN
 BOOLEAN
-IsPhase(
-  IN MEASUREMENT_RECORD        *Measurement
+IsPhase (
+  IN MEASUREMENT_RECORD  *Measurement
   )
   )
 {
 {
-  BOOLEAN   RetVal;
+  BOOLEAN  RetVal;
 
 
   RetVal = (BOOLEAN)(
   RetVal = (BOOLEAN)(
-            ((AsciiStrCmp (Measurement->Token, ALit_SEC) == 0)    ||
-             (AsciiStrCmp (Measurement->Token, ALit_PEI) == 0)    ||
-             (AsciiStrCmp (Measurement->Token, ALit_DXE) == 0)    ||
-             (AsciiStrCmp (Measurement->Token, ALit_BDS) == 0))
-            );
+                     ((AsciiStrCmp (Measurement->Token, ALit_SEC) == 0)    ||
+                      (AsciiStrCmp (Measurement->Token, ALit_PEI) == 0)    ||
+                      (AsciiStrCmp (Measurement->Token, ALit_DXE) == 0)    ||
+                      (AsciiStrCmp (Measurement->Token, ALit_BDS) == 0))
+                     );
   return RetVal;
   return RetVal;
 }
 }
 
 
@@ -112,24 +113,24 @@ IsPhase(
 
 
 **/
 **/
 BOOLEAN
 BOOLEAN
-IsCorePerf(
-  IN MEASUREMENT_RECORD        *Measurement
+IsCorePerf (
+  IN MEASUREMENT_RECORD  *Measurement
   )
   )
 {
 {
-  BOOLEAN   RetVal;
+  BOOLEAN  RetVal;
 
 
   RetVal = (BOOLEAN)(
   RetVal = (BOOLEAN)(
-            ((Measurement->Identifier == MODULE_START_ID)            ||
-             (Measurement->Identifier == MODULE_END_ID)              ||
-             (Measurement->Identifier == MODULE_LOADIMAGE_START_ID)  ||
-             (Measurement->Identifier == MODULE_LOADIMAGE_END_ID)    ||
-             (Measurement->Identifier == MODULE_DB_START_ID)         ||
-             (Measurement->Identifier == MODULE_DB_END_ID)           ||
-             (Measurement->Identifier == MODULE_DB_SUPPORT_START_ID) ||
-             (Measurement->Identifier == MODULE_DB_SUPPORT_END_ID)   ||
-             (Measurement->Identifier == MODULE_DB_STOP_START_ID)    ||
-             (Measurement->Identifier == MODULE_DB_STOP_START_ID))
-            );
+                     ((Measurement->Identifier == MODULE_START_ID)            ||
+                      (Measurement->Identifier == MODULE_END_ID)              ||
+                      (Measurement->Identifier == MODULE_LOADIMAGE_START_ID)  ||
+                      (Measurement->Identifier == MODULE_LOADIMAGE_END_ID)    ||
+                      (Measurement->Identifier == MODULE_DB_START_ID)         ||
+                      (Measurement->Identifier == MODULE_DB_END_ID)           ||
+                      (Measurement->Identifier == MODULE_DB_SUPPORT_START_ID) ||
+                      (Measurement->Identifier == MODULE_DB_SUPPORT_END_ID)   ||
+                      (Measurement->Identifier == MODULE_DB_STOP_START_ID)    ||
+                      (Measurement->Identifier == MODULE_DB_STOP_START_ID))
+                     );
   return RetVal;
   return RetVal;
 }
 }
 
 
@@ -147,14 +148,14 @@ IsCorePerf(
 **/
 **/
 VOID
 VOID
 DpGetShortPdbFileName (
 DpGetShortPdbFileName (
-  IN  CHAR8     *PdbFileName,
-  OUT CHAR16    *UnicodeBuffer
+  IN  CHAR8   *PdbFileName,
+  OUT CHAR16  *UnicodeBuffer
   )
   )
 {
 {
-  UINTN IndexA;     // Current work location within an ASCII string.
-  UINTN IndexU;     // Current work location within a Unicode string.
-  UINTN StartIndex;
-  UINTN EndIndex;
+  UINTN  IndexA;    // Current work location within an ASCII string.
+  UINTN  IndexU;    // Current work location within a Unicode string.
+  UINTN  StartIndex;
+  UINTN  EndIndex;
 
 
   ZeroMem (UnicodeBuffer, (DP_GAUGE_STRING_LENGTH + 1) * sizeof (CHAR16));
   ZeroMem (UnicodeBuffer, (DP_GAUGE_STRING_LENGTH + 1) * sizeof (CHAR16));
 
 
@@ -162,8 +163,9 @@ DpGetShortPdbFileName (
     StrnCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ", 1);
     StrnCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ", 1);
   } else {
   } else {
     StartIndex = 0;
     StartIndex = 0;
-    for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
-      ;
+    for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++) {
+    }
+
     for (IndexA = 0; PdbFileName[IndexA] != 0; IndexA++) {
     for (IndexA = 0; PdbFileName[IndexA] != 0; IndexA++) {
       if ((PdbFileName[IndexA] == '\\') || (PdbFileName[IndexA] == '/')) {
       if ((PdbFileName[IndexA] == '\\') || (PdbFileName[IndexA] == '/')) {
         StartIndex = IndexA + 1;
         StartIndex = IndexA + 1;
@@ -176,7 +178,7 @@ DpGetShortPdbFileName (
 
 
     IndexU = 0;
     IndexU = 0;
     for (IndexA = StartIndex; IndexA < EndIndex; IndexA++) {
     for (IndexA = StartIndex; IndexA < EndIndex; IndexA++) {
-      UnicodeBuffer[IndexU] = (CHAR16) PdbFileName[IndexA];
+      UnicodeBuffer[IndexU] = (CHAR16)PdbFileName[IndexA];
       IndexU++;
       IndexU++;
       if (IndexU >= DP_GAUGE_STRING_LENGTH) {
       if (IndexU >= DP_GAUGE_STRING_LENGTH) {
         UnicodeBuffer[DP_GAUGE_STRING_LENGTH] = 0;
         UnicodeBuffer[DP_GAUGE_STRING_LENGTH] = 0;
@@ -204,26 +206,26 @@ DpGetShortPdbFileName (
 **/
 **/
 VOID
 VOID
 DpGetNameFromHandle (
 DpGetNameFromHandle (
-  IN EFI_HANDLE   Handle
+  IN EFI_HANDLE  Handle
   )
   )
 {
 {
-  EFI_STATUS                   Status;
-  EFI_LOADED_IMAGE_PROTOCOL    *Image;
-  CHAR8                        *PdbFileName;
-  EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding;
-  EFI_STRING                   StringPtr;
-  EFI_DEVICE_PATH_PROTOCOL     *LoadedImageDevicePath;
-  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;
-  EFI_GUID                     *NameGuid;
-  CHAR16                       *NameString;
-  UINTN                        StringSize;
-  CHAR8                        *PlatformLanguage;
-  CHAR8                        *BestLanguage;
-  EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
-
-  Image = NULL;
+  EFI_STATUS                    Status;
+  EFI_LOADED_IMAGE_PROTOCOL     *Image;
+  CHAR8                         *PdbFileName;
+  EFI_DRIVER_BINDING_PROTOCOL   *DriverBinding;
+  EFI_STRING                    StringPtr;
+  EFI_DEVICE_PATH_PROTOCOL      *LoadedImageDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL      *DevicePath;
+  EFI_GUID                      *NameGuid;
+  CHAR16                        *NameString;
+  UINTN                         StringSize;
+  CHAR8                         *PlatformLanguage;
+  CHAR8                         *BestLanguage;
+  EFI_COMPONENT_NAME2_PROTOCOL  *ComponentName2;
+
+  Image                 = NULL;
   LoadedImageDevicePath = NULL;
   LoadedImageDevicePath = NULL;
-  DevicePath = NULL;
+  DevicePath            = NULL;
 
 
   //
   //
   // Method 1: Get the name string from image PDB
   // Method 1: Get the name string from image PDB
@@ -231,14 +233,14 @@ DpGetNameFromHandle (
   Status = gBS->HandleProtocol (
   Status = gBS->HandleProtocol (
                   Handle,
                   Handle,
                   &gEfiLoadedImageProtocolGuid,
                   &gEfiLoadedImageProtocolGuid,
-                  (VOID **) &Image
+                  (VOID **)&Image
                   );
                   );
 
 
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     Status = gBS->OpenProtocol (
     Status = gBS->OpenProtocol (
                     Handle,
                     Handle,
                     &gEfiDriverBindingProtocolGuid,
                     &gEfiDriverBindingProtocolGuid,
-                    (VOID **) &DriverBinding,
+                    (VOID **)&DriverBinding,
                     NULL,
                     NULL,
                     NULL,
                     NULL,
                     EFI_OPEN_PROTOCOL_GET_PROTOCOL
                     EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -247,7 +249,7 @@ DpGetNameFromHandle (
       Status = gBS->HandleProtocol (
       Status = gBS->HandleProtocol (
                       DriverBinding->ImageHandle,
                       DriverBinding->ImageHandle,
                       &gEfiLoadedImageProtocolGuid,
                       &gEfiLoadedImageProtocolGuid,
-                      (VOID **) &Image
+                      (VOID **)&Image
                       );
                       );
     }
     }
   }
   }
@@ -267,14 +269,14 @@ DpGetNameFromHandle (
   Status = gBS->HandleProtocol (
   Status = gBS->HandleProtocol (
                   Handle,
                   Handle,
                   &gEfiComponentName2ProtocolGuid,
                   &gEfiComponentName2ProtocolGuid,
-                  (VOID **) &ComponentName2
+                  (VOID **)&ComponentName2
                   );
                   );
   if (!EFI_ERROR (Status)) {
   if (!EFI_ERROR (Status)) {
     //
     //
     // Firstly use platform language setting, secondly use driver's first supported language.
     // Firstly use platform language setting, secondly use driver's first supported language.
     //
     //
-    GetVariable2 (L"PlatformLang", &gEfiGlobalVariableGuid, (VOID**)&PlatformLanguage, NULL);
-    BestLanguage = GetBestLanguage(
+    GetVariable2 (L"PlatformLang", &gEfiGlobalVariableGuid, (VOID **)&PlatformLanguage, NULL);
+    BestLanguage = GetBestLanguage (
                      ComponentName2->SupportedLanguages,
                      ComponentName2->SupportedLanguages,
                      FALSE,
                      FALSE,
                      (PlatformLanguage != NULL) ? PlatformLanguage : "",
                      (PlatformLanguage != NULL) ? PlatformLanguage : "",
@@ -299,7 +301,7 @@ DpGetNameFromHandle (
   Status = gBS->HandleProtocol (
   Status = gBS->HandleProtocol (
                   Handle,
                   Handle,
                   &gEfiLoadedImageDevicePathProtocolGuid,
                   &gEfiLoadedImageDevicePathProtocolGuid,
-                  (VOID **) &LoadedImageDevicePath
+                  (VOID **)&LoadedImageDevicePath
                   );
                   );
   if (!EFI_ERROR (Status) && (LoadedImageDevicePath != NULL)) {
   if (!EFI_ERROR (Status) && (LoadedImageDevicePath != NULL)) {
     DevicePath = LoadedImageDevicePath;
     DevicePath = LoadedImageDevicePath;
@@ -313,10 +315,11 @@ DpGetNameFromHandle (
     //
     //
     NameGuid = NULL;
     NameGuid = NULL;
     while (!IsDevicePathEndType (DevicePath)) {
     while (!IsDevicePathEndType (DevicePath)) {
-      NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);
+      NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevicePath);
       if (NameGuid != NULL) {
       if (NameGuid != NULL) {
         break;
         break;
       }
       }
+
       DevicePath = NextDevicePathNode (DevicePath);
       DevicePath = NextDevicePathNode (DevicePath);
     }
     }
 
 
@@ -326,13 +329,13 @@ DpGetNameFromHandle (
       //
       //
       NameString = NULL;
       NameString = NULL;
       StringSize = 0;
       StringSize = 0;
-      Status = GetSectionFromAnyFv (
-                NameGuid,
-                EFI_SECTION_USER_INTERFACE,
-                0,
-                (VOID **) &NameString,
-                &StringSize
-                );
+      Status     = GetSectionFromAnyFv (
+                     NameGuid,
+                     EFI_SECTION_USER_INTERFACE,
+                     0,
+                     (VOID **)&NameString,
+                     &StringSize
+                     );
 
 
       if (!EFI_ERROR (Status)) {
       if (!EFI_ERROR (Status)) {
         //
         //
@@ -347,6 +350,7 @@ DpGetNameFromHandle (
         //
         //
         UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);
         UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);
       }
       }
+
       return;
       return;
     } else {
     } else {
       //
       //
@@ -386,7 +390,7 @@ DpGetNameFromHandle (
 **/
 **/
 UINT64
 UINT64
 DurationInMicroSeconds (
 DurationInMicroSeconds (
-  IN UINT64 Duration
+  IN UINT64  Duration
   )
   )
 {
 {
   return DivU64x32 (Duration, 1000);
   return DivU64x32 (Duration, 1000);
@@ -406,17 +410,18 @@ DurationInMicroSeconds (
   @retval     >=0   Return value is the index into CumData where Token is found.
   @retval     >=0   Return value is the index into CumData where Token is found.
 **/
 **/
 INTN
 INTN
-GetCumulativeItem(
-  IN MEASUREMENT_RECORD   *Measurement
+GetCumulativeItem (
+  IN MEASUREMENT_RECORD  *Measurement
   )
   )
 {
 {
-  INTN    Index;
+  INTN  Index;
 
 
-  for( Index = 0; Index < (INTN)NumCum; ++Index) {
+  for ( Index = 0; Index < (INTN)NumCum; ++Index) {
     if (AsciiStrCmp (Measurement->Token, CumData[Index].Name) == 0) {
     if (AsciiStrCmp (Measurement->Token, CumData[Index].Name) == 0) {
       return Index;  // Exit, we found a match
       return Index;  // Exit, we found a match
     }
     }
   }
   }
+
   // If the for loop exits, Token was not found.
   // If the for loop exits, Token was not found.
   return -1;   // Indicate failure
   return -1;   // Indicate failure
 }
 }

+ 12 - 12
ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c

@@ -7,16 +7,16 @@
 #include <Guid/ExtendedFirmwarePerformance.h>
 #include <Guid/ExtendedFirmwarePerformance.h>
 
 
 // ASCII String literals which probably don't need translation
 // ASCII String literals which probably don't need translation
-CHAR8 const ALit_TimerLibError[]  = "Timer library instance error!\n";
-CHAR8 const ALit_SEC[]            = SEC_TOK;
-CHAR8 const ALit_DXE[]            = DXE_TOK;
-CHAR8 const ALit_PEI[]            = PEI_TOK;
-CHAR8 const ALit_BDS[]            = BDS_TOK;
-CHAR8 const ALit_START_IMAGE[]    = START_IMAGE_TOK;
-CHAR8 const ALit_LOAD_IMAGE[]     = LOAD_IMAGE_TOK;
-CHAR8 const ALit_DB_START[]       = DRIVERBINDING_START_TOK;
-CHAR8 const ALit_DB_SUPPORT[]     = DRIVERBINDING_SUPPORT_TOK;
-CHAR8 const ALit_DB_STOP[]        = DRIVERBINDING_STOP_TOK;
+CHAR8 const  ALit_TimerLibError[] = "Timer library instance error!\n";
+CHAR8 const  ALit_SEC[]           = SEC_TOK;
+CHAR8 const  ALit_DXE[]           = DXE_TOK;
+CHAR8 const  ALit_PEI[]           = PEI_TOK;
+CHAR8 const  ALit_BDS[]           = BDS_TOK;
+CHAR8 const  ALit_START_IMAGE[]   = START_IMAGE_TOK;
+CHAR8 const  ALit_LOAD_IMAGE[]    = LOAD_IMAGE_TOK;
+CHAR8 const  ALit_DB_START[]      = DRIVERBINDING_START_TOK;
+CHAR8 const  ALit_DB_SUPPORT[]    = DRIVERBINDING_SUPPORT_TOK;
+CHAR8 const  ALit_DB_STOP[]       = DRIVERBINDING_STOP_TOK;
 
 
-CHAR8 const ALit_BdsTO[]      = "BdsTimeOut";
-CHAR8 const ALit_PEIM[]       = "PEIM";
+CHAR8 const  ALit_BdsTO[] = "BdsTimeOut";
+CHAR8 const  ALit_PEIM[]  = "PEIM";

+ 16 - 15
ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h

@@ -4,23 +4,24 @@
   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 **/
+
 #ifndef _LITERALS_H_
 #ifndef _LITERALS_H_
 #define _LITERALS_H_
 #define _LITERALS_H_
 
 
 // ASCII String literals which probably don't need translation
 // ASCII String literals which probably don't need translation
-extern CHAR8 const ALit_TimerLibError[];
-extern CHAR8 const ALit_SEC[];
-extern CHAR8 const ALit_DXE[];
-extern CHAR8 const ALit_SHELL[];
-extern CHAR8 const ALit_PEI[];
-extern CHAR8 const ALit_BDS[];
-extern CHAR8 const ALit_PEIM[];
-extern CHAR8 const ALit_START_IMAGE[];
-extern CHAR8 const ALit_LOAD_IMAGE[];
-extern CHAR8 const ALit_DB_START[];
-extern CHAR8 const ALit_DB_SUPPORT[];
-extern CHAR8 const ALit_DB_STOP[];
-extern CHAR8 const ALit_BdsTO[];
-extern CHAR8 const ALit_PEIM[];
+extern CHAR8 const  ALit_TimerLibError[];
+extern CHAR8 const  ALit_SEC[];
+extern CHAR8 const  ALit_DXE[];
+extern CHAR8 const  ALit_SHELL[];
+extern CHAR8 const  ALit_PEI[];
+extern CHAR8 const  ALit_BDS[];
+extern CHAR8 const  ALit_PEIM[];
+extern CHAR8 const  ALit_START_IMAGE[];
+extern CHAR8 const  ALit_LOAD_IMAGE[];
+extern CHAR8 const  ALit_DB_START[];
+extern CHAR8 const  ALit_DB_SUPPORT[];
+extern CHAR8 const  ALit_DB_STOP[];
+extern CHAR8 const  ALit_BdsTO[];
+extern CHAR8 const  ALit_PEIM[];
 
 
-#endif  // _LITERALS_H_
+#endif // _LITERALS_H_

+ 239 - 240
ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c

@@ -11,7 +11,7 @@
 
 
 #include "Http.h"
 #include "Http.h"
 
 
-#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32
+#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH  32
 
 
 //
 //
 // Constant strings and definitions related to the message
 // Constant strings and definitions related to the message
@@ -37,17 +37,17 @@
 //
 //
 // Buffer size. Note that larger buffer does not mean better speed.
 // Buffer size. Note that larger buffer does not mean better speed.
 //
 //
-#define DEFAULT_BUF_SIZE      SIZE_32KB
-#define MAX_BUF_SIZE          SIZE_4MB
+#define DEFAULT_BUF_SIZE  SIZE_32KB
+#define MAX_BUF_SIZE      SIZE_4MB
 
 
-#define MIN_PARAM_COUNT       2
-#define MAX_PARAM_COUNT       4
+#define MIN_PARAM_COUNT  2
+#define MAX_PARAM_COUNT  4
 #define NEED_REDIRECTION(Code) \
 #define NEED_REDIRECTION(Code) \
   (((Code >= HTTP_STATUS_300_MULTIPLE_CHOICES) \
   (((Code >= HTTP_STATUS_300_MULTIPLE_CHOICES) \
   && (Code <= HTTP_STATUS_307_TEMPORARY_REDIRECT)) \
   && (Code <= HTTP_STATUS_307_TEMPORARY_REDIRECT)) \
   || (Code == HTTP_STATUS_308_PERMANENT_REDIRECT))
   || (Code == HTTP_STATUS_308_PERMANENT_REDIRECT))
 
 
-#define CLOSE_HTTP_HANDLE(ControllerHandle,HttpChildHandle) \
+#define CLOSE_HTTP_HANDLE(ControllerHandle, HttpChildHandle) \
   do { \
   do { \
     if (HttpChildHandle) { \
     if (HttpChildHandle) { \
       CloseProtocolAndDestroyServiceChild ( \
       CloseProtocolAndDestroyServiceChild ( \
@@ -69,13 +69,13 @@ typedef enum {
 
 
 #define USER_AGENT_HDR  "Mozilla/5.0 (EDK2; Linux) Gecko/20100101 Firefox/79.0"
 #define USER_AGENT_HDR  "Mozilla/5.0 (EDK2; Linux) Gecko/20100101 Firefox/79.0"
 
 
-#define TIMER_MAX_TIMEOUT_S   10
+#define TIMER_MAX_TIMEOUT_S  10
 
 
 //
 //
 // File name to use when Uri ends with "/".
 // File name to use when Uri ends with "/".
 //
 //
-#define DEFAULT_HTML_FILE     L"index.html"
-#define DEFAULT_HTTP_PROTO    L"http"
+#define DEFAULT_HTML_FILE   L"index.html"
+#define DEFAULT_HTTP_PROTO  L"http"
 
 
 //
 //
 // String to delete the HTTP progress message to be able to update it :
 // String to delete the HTTP progress message to be able to update it :
@@ -85,20 +85,20 @@ typedef enum {
   L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\
   L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\
 \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
 \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
 
 
-#define HTTP_KB              L"\b\b\b\b\b\b\b\b\b\b"
+#define HTTP_KB  L"\b\b\b\b\b\b\b\b\b\b"
 //
 //
 // Frame for the progression slider.
 // Frame for the progression slider.
 //
 //
-#define HTTP_PROGR_FRAME     L"[                                        ]"
+#define HTTP_PROGR_FRAME  L"[                                        ]"
 
 
 //
 //
 // Improve readability by using these macros.
 // Improve readability by using these macros.
 //
 //
-#define PRINT_HII(token,...) \
+#define PRINT_HII(token, ...) \
   ShellPrintHiiEx (\
   ShellPrintHiiEx (\
       -1, -1, NULL, token, mHttpHiiHandle, __VA_ARGS__)
       -1, -1, NULL, token, mHttpHiiHandle, __VA_ARGS__)
 
 
-#define PRINT_HII_APP(token,value) \
+#define PRINT_HII_APP(token, value) \
   PRINT_HII (token, HTTP_APP_NAME, value)
   PRINT_HII (token, HTTP_APP_NAME, value)
 
 
 //
 //
@@ -109,19 +109,19 @@ typedef enum {
 //
 //
 // Define EPOCH (1970-JANUARY-01) in the Julian Date representation.
 // Define EPOCH (1970-JANUARY-01) in the Julian Date representation.
 //
 //
-#define EPOCH_JULIAN_DATE                               2440588
+#define EPOCH_JULIAN_DATE  2440588
 
 
 //
 //
 // Seconds per unit.
 // Seconds per unit.
 //
 //
-#define SEC_PER_MIN                                     ((UINTN)    60)
-#define SEC_PER_HOUR                                    ((UINTN)  3600)
-#define SEC_PER_DAY                                     ((UINTN) 86400)
+#define SEC_PER_MIN   ((UINTN)    60)
+#define SEC_PER_HOUR  ((UINTN)  3600)
+#define SEC_PER_DAY   ((UINTN) 86400)
 
 
 //
 //
 // String descriptions for server errors.
 // String descriptions for server errors.
 //
 //
-STATIC CONST CHAR16 *ErrStatusDesc[] =
+STATIC CONST CHAR16  *ErrStatusDesc[] =
 {
 {
   L"400 Bad Request",
   L"400 Bad Request",
   L"401 Unauthorized",
   L"401 Unauthorized",
@@ -149,32 +149,32 @@ STATIC CONST CHAR16 *ErrStatusDesc[] =
   L"505 HTTP version not supported"
   L"505 HTTP version not supported"
 };
 };
 
 
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
-  {L"-i", TypeValue},
-  {L"-k", TypeFlag},
-  {L"-l", TypeValue},
-  {L"-m", TypeFlag},
-  {L"-s", TypeValue},
-  {L"-t", TypeValue},
-  {NULL , TypeMax}
+STATIC CONST SHELL_PARAM_ITEM  ParamList[] = {
+  { L"-i", TypeValue },
+  { L"-k", TypeFlag  },
+  { L"-l", TypeValue },
+  { L"-m", TypeFlag  },
+  { L"-s", TypeValue },
+  { L"-t", TypeValue },
+  { NULL,  TypeMax   }
 };
 };
 
 
 //
 //
 // Local File Handle.
 // Local File Handle.
 //
 //
-STATIC SHELL_FILE_HANDLE   mFileHandle = NULL;
+STATIC SHELL_FILE_HANDLE  mFileHandle = NULL;
 
 
 //
 //
 // Path of the local file, Unicode encoded.
 // Path of the local file, Unicode encoded.
 //
 //
-STATIC CONST CHAR16        *mLocalFilePath;
+STATIC CONST CHAR16  *mLocalFilePath;
 
 
-STATIC BOOLEAN             gRequestCallbackComplete = FALSE;
-STATIC BOOLEAN             gResponseCallbackComplete = FALSE;
+STATIC BOOLEAN  gRequestCallbackComplete  = FALSE;
+STATIC BOOLEAN  gResponseCallbackComplete = FALSE;
 
 
-STATIC BOOLEAN             gHttpError;
+STATIC BOOLEAN  gHttpError;
 
 
-EFI_HII_HANDLE             mHttpHiiHandle;
+EFI_HII_HANDLE  mHttpHiiHandle;
 
 
 //
 //
 // Functions declarations.
 // Functions declarations.
@@ -286,9 +286,9 @@ CloseProtocolAndDestroyServiceChild (
 STATIC
 STATIC
 EFI_STATUS
 EFI_STATUS
 DownloadFile (
 DownloadFile (
-  IN   HTTP_DOWNLOAD_CONTEXT   *Context,
-  IN   EFI_HANDLE              ControllerHandle,
-  IN   CHAR16                  *NicName
+  IN   HTTP_DOWNLOAD_CONTEXT  *Context,
+  IN   EFI_HANDLE             ControllerHandle,
+  IN   CHAR16                 *NicName
   );
   );
 
 
 /**
 /**
@@ -302,11 +302,11 @@ DownloadFile (
 STATIC
 STATIC
 EFI_STATUS
 EFI_STATUS
 TrimSpaces (
 TrimSpaces (
-  IN CHAR16 *String
+  IN CHAR16  *String
   )
   )
 {
 {
-  CHAR16 *Str;
-  UINTN  Len;
+  CHAR16  *Str;
+  UINTN   Len;
 
 
   ASSERT (String != NULL);
   ASSERT (String != NULL);
 
 
@@ -328,7 +328,7 @@ TrimSpaces (
   //
   //
   do {
   do {
     Len = StrLen (Str);
     Len = StrLen (Str);
-    if (!Len || (Str[Len - 1] != L' ' && Str[Len - 1] != '\t')) {
+    if (!Len || ((Str[Len - 1] != L' ') && (Str[Len - 1] != '\t'))) {
       break;
       break;
     }
     }
 
 
@@ -355,8 +355,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 RequestCallback (
 RequestCallback (
-  IN EFI_EVENT Event,
-  IN VOID      *Context
+  IN EFI_EVENT  Event,
+  IN VOID       *Context
   )
   )
 {
 {
   gRequestCallbackComplete = TRUE;
   gRequestCallbackComplete = TRUE;
@@ -371,8 +371,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ResponseCallback (
 ResponseCallback (
-  IN EFI_EVENT Event,
-  IN VOID      *Context
+  IN EFI_EVENT  Event,
+  IN VOID       *Context
   )
   )
 {
 {
   gResponseCallbackComplete = TRUE;
   gResponseCallbackComplete = TRUE;
@@ -396,19 +396,19 @@ EfiGetEpochDays (
   IN  EFI_TIME  *Time
   IN  EFI_TIME  *Time
   )
   )
 {
 {
-  UINTN a;
-  UINTN y;
-  UINTN m;
+  UINTN  a;
+  UINTN  y;
+  UINTN  m;
   //
   //
   // Absolute Julian Date representation of the supplied Time.
   // Absolute Julian Date representation of the supplied Time.
   //
   //
-  UINTN JulianDate;
+  UINTN  JulianDate;
   //
   //
   // Number of days elapsed since EPOCH_JULIAN_DAY.
   // Number of days elapsed since EPOCH_JULIAN_DAY.
   //
   //
-  UINTN EpochDays;
+  UINTN  EpochDays;
 
 
-  a = (14 - Time->Month) / 12 ;
+  a = (14 - Time->Month) / 12;
   y = Time->Year + 4800 - a;
   y = Time->Year + 4800 - a;
   m = Time->Month + (12 * a) - 3;
   m = Time->Month + (12 * a) - 3;
 
 
@@ -437,8 +437,8 @@ EfiTimeToEpoch (
   //
   //
   // Number of days elapsed since EPOCH_JULIAN_DAY.
   // Number of days elapsed since EPOCH_JULIAN_DAY.
   //
   //
-  UINTN EpochDays;
-  UINTN EpochSeconds;
+  UINTN  EpochDays;
+  UINTN  EpochSeconds;
 
 
   EpochDays = EfiGetEpochDays (Time);
   EpochDays = EfiGetEpochDays (Time);
 
 
@@ -471,32 +471,32 @@ RunHttp (
   IN EFI_SYSTEM_TABLE  *SystemTable
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS              Status;
-  LIST_ENTRY              *CheckPackage;
-  UINTN                   ParamCount;
-  UINTN                   HandleCount;
-  UINTN                   NicNumber;
-  UINTN                   InitialSize;
-  UINTN                   ParamOffset;
-  UINTN                   StartSize;
-  CHAR16                  *ProblemParam;
-  CHAR16                  NicName[IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH];
-  CHAR16                  *Walker1;
-  CHAR16                  *VStr;
-  CONST CHAR16            *UserNicName;
-  CONST CHAR16            *ValueStr;
-  CONST CHAR16            *RemoteFilePath;
-  CONST CHAR16            *Walker;
-  EFI_HTTPv4_ACCESS_POINT IPv4Node;
-  EFI_HANDLE              *Handles;
-  EFI_HANDLE              ControllerHandle;
-  HTTP_DOWNLOAD_CONTEXT   Context;
-  BOOLEAN                 NicFound;
-
-  ProblemParam        = NULL;
-  RemoteFilePath      = NULL;
-  NicFound            = FALSE;
-  Handles             = NULL;
+  EFI_STATUS               Status;
+  LIST_ENTRY               *CheckPackage;
+  UINTN                    ParamCount;
+  UINTN                    HandleCount;
+  UINTN                    NicNumber;
+  UINTN                    InitialSize;
+  UINTN                    ParamOffset;
+  UINTN                    StartSize;
+  CHAR16                   *ProblemParam;
+  CHAR16                   NicName[IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH];
+  CHAR16                   *Walker1;
+  CHAR16                   *VStr;
+  CONST CHAR16             *UserNicName;
+  CONST CHAR16             *ValueStr;
+  CONST CHAR16             *RemoteFilePath;
+  CONST CHAR16             *Walker;
+  EFI_HTTPv4_ACCESS_POINT  IPv4Node;
+  EFI_HANDLE               *Handles;
+  EFI_HANDLE               ControllerHandle;
+  HTTP_DOWNLOAD_CONTEXT    Context;
+  BOOLEAN                  NicFound;
+
+  ProblemParam   = NULL;
+  RemoteFilePath = NULL;
+  NicFound       = FALSE;
+  Handles        = NULL;
 
 
   //
   //
   // Initialize the Shell library (we must be in non-auto-init...).
   // Initialize the Shell library (we must be in non-auto-init...).
@@ -522,8 +522,8 @@ RunHttp (
              TRUE
              TRUE
              );
              );
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
-    if ((Status == EFI_VOLUME_CORRUPTED)
-     && (ProblemParam != NULL))
+    if (  (Status == EFI_VOLUME_CORRUPTED)
+       && (ProblemParam != NULL))
     {
     {
       PRINT_HII_APP (STRING_TOKEN (STR_GEN_PROBLEM), ProblemParam);
       PRINT_HII_APP (STRING_TOKEN (STR_GEN_PROBLEM), ProblemParam);
       SHELL_FREE_NON_NULL (ProblemParam);
       SHELL_FREE_NON_NULL (ProblemParam);
@@ -554,7 +554,7 @@ RunHttp (
   ZeroMem (&IPv4Node, sizeof (IPv4Node));
   ZeroMem (&IPv4Node, sizeof (IPv4Node));
   IPv4Node.UseDefaultAddress = TRUE;
   IPv4Node.UseDefaultAddress = TRUE;
 
 
-  Context.HttpConfigData.HttpVersion = HttpVersion11;
+  Context.HttpConfigData.HttpVersion          = HttpVersion11;
   Context.HttpConfigData.AccessPoint.IPv4Node = &IPv4Node;
   Context.HttpConfigData.AccessPoint.IPv4Node = &IPv4Node;
 
 
   //
   //
@@ -592,7 +592,7 @@ RunHttp (
     }
     }
 
 
     if (*Walker1 == L'/') {
     if (*Walker1 == L'/') {
-      ParamOffset = 1;
+      ParamOffset    = 1;
       RemoteFilePath = Walker1;
       RemoteFilePath = Walker1;
     }
     }
 
 
@@ -629,7 +629,8 @@ RunHttp (
     Walker = RemoteFilePath + StrLen (RemoteFilePath);
     Walker = RemoteFilePath + StrLen (RemoteFilePath);
     while ((--Walker) >= RemoteFilePath) {
     while ((--Walker) >= RemoteFilePath) {
       if ((*Walker == L'\\') ||
       if ((*Walker == L'\\') ||
-          (*Walker == L'/' )    ) {
+          (*Walker == L'/'))
+      {
         break;
         break;
       }
       }
     }
     }
@@ -659,12 +660,12 @@ RunHttp (
   UserNicName = ShellCommandLineGetValue (CheckPackage, L"-i");
   UserNicName = ShellCommandLineGetValue (CheckPackage, L"-i");
 
 
   ValueStr = ShellCommandLineGetValue (CheckPackage, L"-l");
   ValueStr = ShellCommandLineGetValue (CheckPackage, L"-l");
-  if ((ValueStr != NULL)
-   && (!StringToUint16 (
-          ValueStr,
-          &Context.HttpConfigData.AccessPoint.IPv4Node->LocalPort
-          )
-      ))
+  if (  (ValueStr != NULL)
+     && (!StringToUint16 (
+            ValueStr,
+            &Context.HttpConfigData.AccessPoint.IPv4Node->LocalPort
+            )
+         ))
   {
   {
     goto Error;
     goto Error;
   }
   }
@@ -674,7 +675,7 @@ RunHttp (
   ValueStr = ShellCommandLineGetValue (CheckPackage, L"-s");
   ValueStr = ShellCommandLineGetValue (CheckPackage, L"-s");
   if (ValueStr != NULL) {
   if (ValueStr != NULL) {
     Context.BufferSize = ShellStrToUintn (ValueStr);
     Context.BufferSize = ShellStrToUintn (ValueStr);
-    if (!Context.BufferSize || Context.BufferSize > MAX_BUF_SIZE) {
+    if (!Context.BufferSize || (Context.BufferSize > MAX_BUF_SIZE)) {
       PRINT_HII_APP (STRING_TOKEN (STR_GEN_PARAM_INV), ValueStr);
       PRINT_HII_APP (STRING_TOKEN (STR_GEN_PARAM_INV), ValueStr);
       goto Error;
       goto Error;
     }
     }
@@ -756,10 +757,10 @@ RunHttp (
     }
     }
 
 
     if (gHttpError) {
     if (gHttpError) {
-     //
-     // This is not related to connection, so no need to repeat with
-     // another interface.
-     //
+      //
+      // This is not related to connection, so no need to repeat with
+      // another interface.
+      //
       break;
       break;
     }
     }
   }
   }
@@ -841,7 +842,7 @@ GetNicName (
              &gEfiManagedNetworkServiceBindingProtocolGuid,
              &gEfiManagedNetworkServiceBindingProtocolGuid,
              &gEfiManagedNetworkProtocolGuid,
              &gEfiManagedNetworkProtocolGuid,
              &MnpHandle,
              &MnpHandle,
-             (VOID**)&Mnp
+             (VOID **)&Mnp
              );
              );
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     goto Error;
     goto Error;
@@ -907,12 +908,12 @@ CreateServiceChildAndOpenProtocol (
   EFI_STATUS  Status;
   EFI_STATUS  Status;
 
 
   *ChildHandle = NULL;
   *ChildHandle = NULL;
-  Status = NetLibCreateServiceChild (
-             ControllerHandle,
-             gImageHandle,
-             ServiceBindingProtocolGuid,
-             ChildHandle
-             );
+  Status       = NetLibCreateServiceChild (
+                   ControllerHandle,
+                   gImageHandle,
+                   ServiceBindingProtocolGuid,
+                   ChildHandle
+                   );
   if (!EFI_ERROR (Status)) {
   if (!EFI_ERROR (Status)) {
     Status = gBS->OpenProtocol (
     Status = gBS->OpenProtocol (
                     *ChildHandle,
                     *ChildHandle,
@@ -990,8 +991,8 @@ WaitForCompletion (
   IN OUT BOOLEAN            *CallBackComplete
   IN OUT BOOLEAN            *CallBackComplete
   )
   )
 {
 {
-  EFI_STATUS                Status;
-  EFI_EVENT                 WaitEvt;
+  EFI_STATUS  Status;
+  EFI_EVENT   WaitEvt;
 
 
   Status = EFI_SUCCESS;
   Status = EFI_SUCCESS;
 
 
@@ -1005,25 +1006,25 @@ WaitForCompletion (
                   NULL,
                   NULL,
                   &WaitEvt
                   &WaitEvt
                   );
                   );
-   ASSERT_EFI_ERROR (Status);
+  ASSERT_EFI_ERROR (Status);
 
 
-   if (!EFI_ERROR (Status)) {
-     Status = gBS->SetTimer (
-                     WaitEvt,
-                     TimerRelative,
-                     EFI_TIMER_PERIOD_SECONDS (TIMER_MAX_TIMEOUT_S)
-                     );
+  if (!EFI_ERROR (Status)) {
+    Status = gBS->SetTimer (
+                    WaitEvt,
+                    TimerRelative,
+                    EFI_TIMER_PERIOD_SECONDS (TIMER_MAX_TIMEOUT_S)
+                    );
 
 
-     ASSERT_EFI_ERROR (Status);
-   }
+    ASSERT_EFI_ERROR (Status);
+  }
 
 
-  while (! *CallBackComplete
-      && (!EFI_ERROR (Status))
-      && EFI_ERROR (gBS->CheckEvent (WaitEvt)))
+  while (  !*CallBackComplete
+        && (!EFI_ERROR (Status))
+        && EFI_ERROR (gBS->CheckEvent (WaitEvt)))
   {
   {
     Status = Context->Http->Poll (Context->Http);
     Status = Context->Http->Poll (Context->Http);
-    if (!Context->ContentDownloaded
-     && CallBackComplete == &gResponseCallbackComplete)
+    if (  !Context->ContentDownloaded
+       && (CallBackComplete == &gResponseCallbackComplete))
     {
     {
       //
       //
       // An HTTP server may just send a response redirection header.
       // An HTTP server may just send a response redirection header.
@@ -1032,12 +1033,12 @@ WaitForCompletion (
       // Note that at this point Response may not has been populated,
       // Note that at this point Response may not has been populated,
       // so it needs to be checked first.
       // so it needs to be checked first.
       //
       //
-      if (Context->ResponseToken.Message
-       && Context->ResponseToken.Message->Data.Response
-       && (NEED_REDIRECTION (
-            Context->ResponseToken.Message->Data.Response->StatusCode
-            )
-         ))
+      if (  Context->ResponseToken.Message
+         && Context->ResponseToken.Message->Data.Response
+         && (NEED_REDIRECTION (
+               Context->ResponseToken.Message->Data.Response->StatusCode
+               )
+             ))
       {
       {
         break;
         break;
       }
       }
@@ -1079,20 +1080,20 @@ SendRequest (
   IN CHAR16                 *DownloadUrl
   IN CHAR16                 *DownloadUrl
   )
   )
 {
 {
-  EFI_HTTP_REQUEST_DATA       RequestData;
-  EFI_HTTP_HEADER             RequestHeader[HdrMax];
-  EFI_HTTP_MESSAGE            RequestMessage;
-  EFI_STATUS                  Status;
-  CHAR16                      *Host;
-  UINTN                       StringSize;
+  EFI_HTTP_REQUEST_DATA  RequestData;
+  EFI_HTTP_HEADER        RequestHeader[HdrMax];
+  EFI_HTTP_MESSAGE       RequestMessage;
+  EFI_STATUS             Status;
+  CHAR16                 *Host;
+  UINTN                  StringSize;
 
 
   ZeroMem (&RequestData, sizeof (RequestData));
   ZeroMem (&RequestData, sizeof (RequestData));
   ZeroMem (&RequestHeader, sizeof (RequestHeader));
   ZeroMem (&RequestHeader, sizeof (RequestHeader));
   ZeroMem (&RequestMessage, sizeof (RequestMessage));
   ZeroMem (&RequestMessage, sizeof (RequestMessage));
   ZeroMem (&Context->RequestToken, sizeof (Context->RequestToken));
   ZeroMem (&Context->RequestToken, sizeof (Context->RequestToken));
 
 
-  RequestHeader[HdrHost].FieldName = "Host";
-  RequestHeader[HdrConn].FieldName = "Connection";
+  RequestHeader[HdrHost].FieldName  = "Host";
+  RequestHeader[HdrConn].FieldName  = "Connection";
   RequestHeader[HdrAgent].FieldName = "User-Agent";
   RequestHeader[HdrAgent].FieldName = "User-Agent";
 
 
   Host = (CHAR16 *)Context->ServerAddrAndProto;
   Host = (CHAR16 *)Context->ServerAddrAndProto;
@@ -1113,7 +1114,7 @@ SendRequest (
   //
   //
   Host++;
   Host++;
 
 
-  StringSize = StrLen (Host) + 1;
+  StringSize                        = StrLen (Host) + 1;
   RequestHeader[HdrHost].FieldValue = AllocatePool (StringSize);
   RequestHeader[HdrHost].FieldValue = AllocatePool (StringSize);
   if (!RequestHeader[HdrHost].FieldValue) {
   if (!RequestHeader[HdrHost].FieldValue) {
     return EFI_OUT_OF_RESOURCES;
     return EFI_OUT_OF_RESOURCES;
@@ -1125,17 +1126,17 @@ SendRequest (
     StringSize
     StringSize
     );
     );
 
 
-  RequestHeader[HdrConn].FieldValue = "close";
+  RequestHeader[HdrConn].FieldValue  = "close";
   RequestHeader[HdrAgent].FieldValue = USER_AGENT_HDR;
   RequestHeader[HdrAgent].FieldValue = USER_AGENT_HDR;
-  RequestMessage.HeaderCount = HdrMax;
+  RequestMessage.HeaderCount         = HdrMax;
 
 
   RequestData.Method = HttpMethodGet;
   RequestData.Method = HttpMethodGet;
-  RequestData.Url = DownloadUrl;
+  RequestData.Url    = DownloadUrl;
 
 
   RequestMessage.Data.Request = &RequestData;
   RequestMessage.Data.Request = &RequestData;
-  RequestMessage.Headers = RequestHeader;
-  RequestMessage.BodyLength = 0;
-  RequestMessage.Body = NULL;
+  RequestMessage.Headers      = RequestHeader;
+  RequestMessage.BodyLength   = 0;
+  RequestMessage.Body         = NULL;
   Context->RequestToken.Event = NULL;
   Context->RequestToken.Event = NULL;
 
 
   //
   //
@@ -1150,10 +1151,10 @@ SendRequest (
                   );
                   );
   ASSERT_EFI_ERROR (Status);
   ASSERT_EFI_ERROR (Status);
 
 
-  Context->RequestToken.Status = EFI_SUCCESS;
+  Context->RequestToken.Status  = EFI_SUCCESS;
   Context->RequestToken.Message = &RequestMessage;
   Context->RequestToken.Message = &RequestMessage;
-  gRequestCallbackComplete = FALSE;
-  Status = Context->Http->Request (Context->Http, &Context->RequestToken);
+  gRequestCallbackComplete      = FALSE;
+  Status                        = Context->Http->Request (Context->Http, &Context->RequestToken);
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     goto Error;
     goto Error;
   }
   }
@@ -1193,15 +1194,15 @@ SavePortion (
   IN CHAR8                  *Buffer
   IN CHAR8                  *Buffer
   )
   )
 {
 {
-  CHAR16            Progress[HTTP_PROGRESS_MESSAGE_SIZE];
-  UINTN             NbOfKb;
-  UINTN             Index;
-  UINTN             LastStep;
-  UINTN             Step;
-  EFI_STATUS        Status;
+  CHAR16      Progress[HTTP_PROGRESS_MESSAGE_SIZE];
+  UINTN       NbOfKb;
+  UINTN       Index;
+  UINTN       LastStep;
+  UINTN       Step;
+  EFI_STATUS  Status;
 
 
   LastStep = 0;
   LastStep = 0;
-  Step = 0;
+  Step     = 0;
 
 
   ShellSetFilePosition (mFileHandle, Context->LastReportedNbOfBytes);
   ShellSetFilePosition (mFileHandle, Context->LastReportedNbOfBytes);
   Status = ShellWriteFile (mFileHandle, &DownloadLen, Buffer);
   Status = ShellWriteFile (mFileHandle, &DownloadLen, Buffer);
@@ -1219,14 +1220,14 @@ SavePortion (
   }
   }
 
 
   Context->ContentDownloaded += DownloadLen;
   Context->ContentDownloaded += DownloadLen;
-  NbOfKb = Context->ContentDownloaded >> 10;
+  NbOfKb                      = Context->ContentDownloaded >> 10;
 
 
   Progress[0] = L'\0';
   Progress[0] = L'\0';
   if (Context->ContentLength) {
   if (Context->ContentLength) {
-    LastStep  = (Context->LastReportedNbOfBytes * HTTP_PROGRESS_SLIDER_STEPS) /
-                 Context->ContentLength;
-    Step      = (Context->ContentDownloaded * HTTP_PROGRESS_SLIDER_STEPS) /
-                 Context->ContentLength;
+    LastStep = (Context->LastReportedNbOfBytes * HTTP_PROGRESS_SLIDER_STEPS) /
+               Context->ContentLength;
+    Step = (Context->ContentDownloaded * HTTP_PROGRESS_SLIDER_STEPS) /
+           Context->ContentLength;
   }
   }
 
 
   Context->LastReportedNbOfBytes = Context->ContentDownloaded;
   Context->LastReportedNbOfBytes = Context->ContentDownloaded;
@@ -1265,7 +1266,6 @@ SavePortion (
     NbOfKb
     NbOfKb
     );
     );
 
 
-
   ShellPrintEx (-1, -1, L"%s", Progress);
   ShellPrintEx (-1, -1, L"%s", Progress);
 
 
   return EFI_SUCCESS;
   return EFI_SUCCESS;
@@ -1286,29 +1286,29 @@ SavePortion (
 STATIC
 STATIC
 EFI_STATUS
 EFI_STATUS
 SetHostURI (
 SetHostURI (
-  IN CHAR8                 *Location,
-  IN HTTP_DOWNLOAD_CONTEXT *Context,
-  IN CHAR16                *DownloadUrl
+  IN CHAR8                  *Location,
+  IN HTTP_DOWNLOAD_CONTEXT  *Context,
+  IN CHAR16                 *DownloadUrl
   )
   )
 {
 {
-  EFI_STATUS    Status;
-  UINTN         StringSize;
-  UINTN         FirstStep;
-  UINTN         Idx;
-  UINTN         Step;
-  CHAR8         *Walker;
-  CHAR16        *Temp;
-  CHAR8         *Tmp;
-  CHAR16        *Url;
-  BOOLEAN       IsAbEmptyUrl;
-
-  Tmp = NULL;
-  Url = NULL;
+  EFI_STATUS  Status;
+  UINTN       StringSize;
+  UINTN       FirstStep;
+  UINTN       Idx;
+  UINTN       Step;
+  CHAR8       *Walker;
+  CHAR16      *Temp;
+  CHAR8       *Tmp;
+  CHAR16      *Url;
+  BOOLEAN     IsAbEmptyUrl;
+
+  Tmp          = NULL;
+  Url          = NULL;
   IsAbEmptyUrl = FALSE;
   IsAbEmptyUrl = FALSE;
-  FirstStep = 0;
+  FirstStep    = 0;
 
 
   StringSize = (AsciiStrSize (Location) * sizeof (CHAR16));
   StringSize = (AsciiStrSize (Location) * sizeof (CHAR16));
-  Url = AllocateZeroPool (StringSize);
+  Url        = AllocateZeroPool (StringSize);
   if (!Url) {
   if (!Url) {
     return EFI_OUT_OF_RESOURCES;
     return EFI_OUT_OF_RESOURCES;
   }
   }
@@ -1320,7 +1320,7 @@ SetHostURI (
              );
              );
 
 
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
-        goto Error;
+    goto Error;
   }
   }
 
 
   //
   //
@@ -1347,11 +1347,11 @@ SetHostURI (
   }
   }
 
 
   if (AsciiStrStr (Location, "://") || IsAbEmptyUrl) {
   if (AsciiStrStr (Location, "://") || IsAbEmptyUrl) {
-    Idx = 0;
+    Idx    = 0;
     Walker = Location;
     Walker = Location;
 
 
     for (Step = FirstStep; Step < 2; Step++) {
     for (Step = FirstStep; Step < 2; Step++) {
-      for (; *Walker != '/' && *Walker != '\0'; Walker++) {
+      for ( ; *Walker != '/' && *Walker != '\0'; Walker++) {
         Idx++;
         Idx++;
       }
       }
 
 
@@ -1359,7 +1359,7 @@ SetHostURI (
         //
         //
         // Skip "//"
         // Skip "//"
         //
         //
-        Idx += 2;
+        Idx    += 2;
         Walker += 2;
         Walker += 2;
       }
       }
     }
     }
@@ -1375,7 +1375,7 @@ SetHostURI (
     //
     //
     // Location now points to Uri
     // Location now points to Uri
     //
     //
-    Location += Idx;
+    Location  += Idx;
     StringSize = (Idx + 1) * sizeof (CHAR16);
     StringSize = (Idx + 1) * sizeof (CHAR16);
 
 
     SHELL_FREE_NON_NULL (Context->ServerAddrAndProto);
     SHELL_FREE_NON_NULL (Context->ServerAddrAndProto);
@@ -1421,7 +1421,7 @@ SetHostURI (
 
 
   SHELL_FREE_NON_NULL (Context->Uri);
   SHELL_FREE_NON_NULL (Context->Uri);
 
 
-  StringSize = AsciiStrSize (Location) * sizeof (CHAR16);
+  StringSize   = AsciiStrSize (Location) * sizeof (CHAR16);
   Context->Uri = AllocateZeroPool (StringSize);
   Context->Uri = AllocateZeroPool (StringSize);
   if (!Context->Uri) {
   if (!Context->Uri) {
     Status = EFI_OUT_OF_RESOURCES;
     Status = EFI_OUT_OF_RESOURCES;
@@ -1460,15 +1460,15 @@ STATIC
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ParseMsg (
 ParseMsg (
-  IN HTTP_BODY_PARSE_EVENT      EventType,
-  IN CHAR8                      *Data,
-  IN UINTN                      Length,
-  IN VOID                       *Context
+  IN HTTP_BODY_PARSE_EVENT  EventType,
+  IN CHAR8                  *Data,
+  IN UINTN                  Length,
+  IN VOID                   *Context
   )
   )
 {
 {
-  if ((Data == NULL)
-   || (EventType == BodyParseEventOnComplete)
-   || (Context == NULL))
+  if (  (Data == NULL)
+     || (EventType == BodyParseEventOnComplete)
+     || (Context == NULL))
   {
   {
     return EFI_SUCCESS;
     return EFI_SUCCESS;
   }
   }
@@ -1476,7 +1476,6 @@ ParseMsg (
   return SavePortion (Context, Length, Data);
   return SavePortion (Context, Length, Data);
 }
 }
 
 
-
 /**
 /**
   Get HTTP server response and collect the whole body as a file.
   Get HTTP server response and collect the whole body as a file.
   Set appropriate status in Context (REQ_OK, REQ_REPEAT, REQ_ERROR).
   Set appropriate status in Context (REQ_OK, REQ_REPEAT, REQ_ERROR).
@@ -1498,38 +1497,38 @@ ParseMsg (
 STATIC
 STATIC
 EFI_STATUS
 EFI_STATUS
 GetResponse (
 GetResponse (
-  IN HTTP_DOWNLOAD_CONTEXT    *Context,
-  IN CHAR16                   *DownloadUrl
+  IN HTTP_DOWNLOAD_CONTEXT  *Context,
+  IN CHAR16                 *DownloadUrl
   )
   )
 {
 {
-  EFI_HTTP_RESPONSE_DATA      ResponseData;
-  EFI_HTTP_MESSAGE            ResponseMessage;
-  EFI_HTTP_HEADER             *Header;
-  EFI_STATUS                  Status;
-  VOID                        *MsgParser;
-  EFI_TIME                    StartTime;
-  EFI_TIME                    EndTime;
-  CONST CHAR16                *Desc;
-  UINTN                       ElapsedSeconds;
-  BOOLEAN                     IsTrunked;
-  BOOLEAN                     CanMeasureTime;
+  EFI_HTTP_RESPONSE_DATA  ResponseData;
+  EFI_HTTP_MESSAGE        ResponseMessage;
+  EFI_HTTP_HEADER         *Header;
+  EFI_STATUS              Status;
+  VOID                    *MsgParser;
+  EFI_TIME                StartTime;
+  EFI_TIME                EndTime;
+  CONST CHAR16            *Desc;
+  UINTN                   ElapsedSeconds;
+  BOOLEAN                 IsTrunked;
+  BOOLEAN                 CanMeasureTime;
 
 
   ZeroMem (&ResponseData, sizeof (ResponseData));
   ZeroMem (&ResponseData, sizeof (ResponseData));
   ZeroMem (&ResponseMessage, sizeof (ResponseMessage));
   ZeroMem (&ResponseMessage, sizeof (ResponseMessage));
   ZeroMem (&Context->ResponseToken, sizeof (Context->ResponseToken));
   ZeroMem (&Context->ResponseToken, sizeof (Context->ResponseToken));
   IsTrunked = FALSE;
   IsTrunked = FALSE;
 
 
-  ResponseMessage.Body = Context->Buffer;
-  Context->ResponseToken.Status = EFI_SUCCESS;
+  ResponseMessage.Body           = Context->Buffer;
+  Context->ResponseToken.Status  = EFI_SUCCESS;
   Context->ResponseToken.Message = &ResponseMessage;
   Context->ResponseToken.Message = &ResponseMessage;
-  Context->ContentLength = 0;
-  Context->Status = REQ_OK;
-  Status = EFI_SUCCESS;
-  MsgParser = NULL;
-  ResponseData.StatusCode = HTTP_STATUS_UNSUPPORTED_STATUS;
-  ResponseMessage.Data.Response = &ResponseData;
-  Context->ResponseToken.Event = NULL;
-  CanMeasureTime = FALSE;
+  Context->ContentLength         = 0;
+  Context->Status                = REQ_OK;
+  Status                         = EFI_SUCCESS;
+  MsgParser                      = NULL;
+  ResponseData.StatusCode        = HTTP_STATUS_UNSUPPORTED_STATUS;
+  ResponseMessage.Data.Response  = &ResponseData;
+  Context->ResponseToken.Event   = NULL;
+  CanMeasureTime                 = FALSE;
   if (Context->Flags & DL_FLAG_TIME) {
   if (Context->Flags & DL_FLAG_TIME) {
     ZeroMem (&StartTime, sizeof (StartTime));
     ZeroMem (&StartTime, sizeof (StartTime));
     CanMeasureTime = !EFI_ERROR (gRT->GetTime (&StartTime, NULL));
     CanMeasureTime = !EFI_ERROR (gRT->GetTime (&StartTime, NULL));
@@ -1538,8 +1537,8 @@ GetResponse (
   do {
   do {
     SHELL_FREE_NON_NULL (ResponseMessage.Headers);
     SHELL_FREE_NON_NULL (ResponseMessage.Headers);
     ResponseMessage.HeaderCount = 0;
     ResponseMessage.HeaderCount = 0;
-    gResponseCallbackComplete = FALSE;
-    ResponseMessage.BodyLength = Context->BufferSize;
+    gResponseCallbackComplete   = FALSE;
+    ResponseMessage.BodyLength  = Context->BufferSize;
 
 
     if (ShellGetExecutionBreakFlag ()) {
     if (ShellGetExecutionBreakFlag ()) {
       Status = EFI_ABORTED;
       Status = EFI_ABORTED;
@@ -1642,8 +1641,8 @@ GetResponse (
 
 
       HttpGetEntityLength (MsgParser, &Context->ContentLength);
       HttpGetEntityLength (MsgParser, &Context->ContentLength);
 
 
-      if (ResponseData.StatusCode >= HTTP_STATUS_400_BAD_REQUEST
-       && (ResponseData.StatusCode != HTTP_STATUS_308_PERMANENT_REDIRECT))
+      if (  (ResponseData.StatusCode >= HTTP_STATUS_400_BAD_REQUEST)
+         && (ResponseData.StatusCode != HTTP_STATUS_308_PERMANENT_REDIRECT))
       {
       {
         //
         //
         // Server reported an error via Response code.
         // Server reported an error via Response code.
@@ -1665,7 +1664,7 @@ GetResponse (
           // This gives an RFC HTTP error.
           // This gives an RFC HTTP error.
           //
           //
           Context->Status = ShellStrToUintn (Desc);
           Context->Status = ShellStrToUintn (Desc);
-          Status = ENCODE_ERROR (Context->Status);
+          Status          = ENCODE_ERROR (Context->Status);
         }
         }
       }
       }
     }
     }
@@ -1680,13 +1679,13 @@ GetResponse (
                  ResponseMessage.Body
                  ResponseMessage.Body
                  );
                  );
     }
     }
-  } while (!HttpIsMessageComplete (MsgParser)
-        && !EFI_ERROR (Status)
-        && ResponseMessage.BodyLength);
+  } while (  !HttpIsMessageComplete (MsgParser)
+          && !EFI_ERROR (Status)
+          && ResponseMessage.BodyLength);
 
 
-  if (Context->Status != REQ_NEED_REPEAT
-   && Status == EFI_SUCCESS
-   && CanMeasureTime)
+  if (  (Context->Status != REQ_NEED_REPEAT)
+     && (Status == EFI_SUCCESS)
+     && CanMeasureTime)
   {
   {
     if (!EFI_ERROR (gRT->GetTime (&EndTime, NULL))) {
     if (!EFI_ERROR (gRT->GetTime (&EndTime, NULL))) {
       ElapsedSeconds = EfiTimeToEpoch (&EndTime) - EfiTimeToEpoch (&StartTime);
       ElapsedSeconds = EfiTimeToEpoch (&EndTime) - EfiTimeToEpoch (&StartTime);
@@ -1726,22 +1725,22 @@ GetResponse (
 STATIC
 STATIC
 EFI_STATUS
 EFI_STATUS
 DownloadFile (
 DownloadFile (
-  IN HTTP_DOWNLOAD_CONTEXT   *Context,
-  IN EFI_HANDLE              ControllerHandle,
-  IN CHAR16                  *NicName
+  IN HTTP_DOWNLOAD_CONTEXT  *Context,
+  IN EFI_HANDLE             ControllerHandle,
+  IN CHAR16                 *NicName
   )
   )
 {
 {
-  EFI_STATUS                 Status;
-  CHAR16                     *DownloadUrl;
-  UINTN                      UrlSize;
-  EFI_HANDLE                 HttpChildHandle;
+  EFI_STATUS  Status;
+  CHAR16      *DownloadUrl;
+  UINTN       UrlSize;
+  EFI_HANDLE  HttpChildHandle;
 
 
   ASSERT (Context);
   ASSERT (Context);
   if (Context == NULL) {
   if (Context == NULL) {
     return EFI_INVALID_PARAMETER;
     return EFI_INVALID_PARAMETER;
   }
   }
 
 
-  DownloadUrl = NULL;
+  DownloadUrl     = NULL;
   HttpChildHandle = NULL;
   HttpChildHandle = NULL;
 
 
   Context->Buffer = AllocatePool (Context->BufferSize);
   Context->Buffer = AllocatePool (Context->BufferSize);
@@ -1780,7 +1779,7 @@ DownloadFile (
                &gEfiHttpServiceBindingProtocolGuid,
                &gEfiHttpServiceBindingProtocolGuid,
                &gEfiHttpProtocolGuid,
                &gEfiHttpProtocolGuid,
                &HttpChildHandle,
                &HttpChildHandle,
-               (VOID**)&Context->Http
+               (VOID **)&Context->Http
                );
                );
 
 
     if (EFI_ERROR (Status)) {
     if (EFI_ERROR (Status)) {
@@ -1794,7 +1793,7 @@ DownloadFile (
       goto ON_EXIT;
       goto ON_EXIT;
     }
     }
 
 
-    UrlSize = 0;
+    UrlSize     = 0;
     DownloadUrl = StrnCatGrow (
     DownloadUrl = StrnCatGrow (
                     &DownloadUrl,
                     &DownloadUrl,
                     &UrlSize,
                     &UrlSize,
@@ -1814,7 +1813,8 @@ DownloadFile (
                     &DownloadUrl,
                     &DownloadUrl,
                     &UrlSize,
                     &UrlSize,
                     Context->Uri,
                     Context->Uri,
-                    StrLen (Context->Uri));
+                    StrLen (Context->Uri)
+                    );
 
 
     PRINT_HII (STRING_TOKEN (STR_HTTP_DOWNLOADING), DownloadUrl);
     PRINT_HII (STRING_TOKEN (STR_HTTP_DOWNLOADING), DownloadUrl);
 
 
@@ -1828,7 +1828,6 @@ DownloadFile (
     if (Status) {
     if (Status) {
       goto ON_EXIT;
       goto ON_EXIT;
     }
     }
-
   } while (Context->Status == REQ_NEED_REPEAT);
   } while (Context->Status == REQ_NEED_REPEAT);
 
 
   if (Context->Status) {
   if (Context->Status) {
@@ -1864,12 +1863,12 @@ ON_EXIT:
 **/
 **/
 EFI_HII_HANDLE
 EFI_HII_HANDLE
 InitializeHiiPackage (
 InitializeHiiPackage (
-  IN EFI_HANDLE                  ImageHandle
+  IN EFI_HANDLE  ImageHandle
   )
   )
 {
 {
-  EFI_STATUS                  Status;
-  EFI_HII_PACKAGE_LIST_HEADER *PackageList;
-  EFI_HII_HANDLE              HiiHandle;
+  EFI_STATUS                   Status;
+  EFI_HII_PACKAGE_LIST_HEADER  *PackageList;
+  EFI_HII_HANDLE               HiiHandle;
 
 
   //
   //
   // Retrieve HII package list from ImageHandle.
   // Retrieve HII package list from ImageHandle.
@@ -1891,11 +1890,11 @@ InitializeHiiPackage (
   // Publish HII package list to HII Database.
   // Publish HII package list to HII Database.
   //
   //
   Status = gHiiDatabase->NewPackageList (
   Status = gHiiDatabase->NewPackageList (
-             gHiiDatabase,
-             PackageList,
-             NULL,
-             &HiiHandle
-             );
+                           gHiiDatabase,
+                           PackageList,
+                           NULL,
+                           &HiiHandle
+                           );
   ASSERT_EFI_ERROR (Status);
   ASSERT_EFI_ERROR (Status);
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     return NULL;
     return NULL;

+ 19 - 18
ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h

@@ -32,7 +32,7 @@
 #include <Protocol/HttpUtilities.h>
 #include <Protocol/HttpUtilities.h>
 #include <Protocol/ServiceBinding.h>
 #include <Protocol/ServiceBinding.h>
 
 
-#define HTTP_APP_NAME L"http"
+#define HTTP_APP_NAME  L"http"
 
 
 #define REQ_OK           0
 #define REQ_OK           0
 #define REQ_NEED_REPEAT  1
 #define REQ_NEED_REPEAT  1
@@ -40,25 +40,25 @@
 //
 //
 // Download Flags.
 // Download Flags.
 //
 //
-#define DL_FLAG_TIME     BIT0 // Show elapsed time.
-#define DL_FLAG_KEEP_BAD BIT1 // Keep files even if download failed.
+#define DL_FLAG_TIME      BIT0 // Show elapsed time.
+#define DL_FLAG_KEEP_BAD  BIT1 // Keep files even if download failed.
 
 
-extern EFI_HII_HANDLE mHttpHiiHandle;
+extern EFI_HII_HANDLE  mHttpHiiHandle;
 
 
 typedef struct {
 typedef struct {
-  UINTN                 ContentDownloaded;
-  UINTN                 ContentLength;
-  UINTN                 LastReportedNbOfBytes;
-  UINTN                 BufferSize;
-  UINTN                 Status;
-  UINTN                 Flags;
-  UINT8                 *Buffer;
-  CHAR16                *ServerAddrAndProto;
-  CHAR16                *Uri;
-  EFI_HTTP_TOKEN        ResponseToken;
-  EFI_HTTP_TOKEN        RequestToken;
-  EFI_HTTP_PROTOCOL     *Http;
-  EFI_HTTP_CONFIG_DATA  HttpConfigData;
+  UINTN                   ContentDownloaded;
+  UINTN                   ContentLength;
+  UINTN                   LastReportedNbOfBytes;
+  UINTN                   BufferSize;
+  UINTN                   Status;
+  UINTN                   Flags;
+  UINT8                   *Buffer;
+  CHAR16                  *ServerAddrAndProto;
+  CHAR16                  *Uri;
+  EFI_HTTP_TOKEN          ResponseToken;
+  EFI_HTTP_TOKEN          RequestToken;
+  EFI_HTTP_PROTOCOL       *Http;
+  EFI_HTTP_CONFIG_DATA    HttpConfigData;
 } HTTP_DOWNLOAD_CONTEXT;
 } HTTP_DOWNLOAD_CONTEXT;
 
 
 /**
 /**
@@ -87,6 +87,7 @@ RunHttp (
 **/
 **/
 EFI_HII_HANDLE
 EFI_HII_HANDLE
 InitializeHiiPackage (
 InitializeHiiPackage (
-  IN EFI_HANDLE                  ImageHandle
+  IN EFI_HANDLE  ImageHandle
   );
   );
+
 #endif // _HTTP_H_
 #endif // _HTTP_H_

+ 5 - 5
ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c

@@ -20,7 +20,7 @@
  * Thus the application can use '-?' option to show help message in Shell.
  * Thus the application can use '-?' option to show help message in Shell.
  */
  */
 GLOBAL_REMOVE_IF_UNREFERENCED
 GLOBAL_REMOVE_IF_UNREFERENCED
-EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_HTTP);
+EFI_STRING_ID  mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_HTTP);
 
 
 /**
 /**
   Entry point of Http standalone application.
   Entry point of Http standalone application.
@@ -35,12 +35,12 @@ EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_HTTP);
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 HttpAppInitialize (
 HttpAppInitialize (
-  IN EFI_HANDLE               ImageHandle,
-  IN EFI_SYSTEM_TABLE         *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS                  Status;
-  SHELL_STATUS                ShellStatus;
+  EFI_STATUS    Status;
+  SHELL_STATUS  ShellStatus;
 
 
   mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
   mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
   if (mHttpHiiHandle == NULL) {
   if (mHttpHiiHandle == NULL) {

+ 13 - 13
ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c

@@ -28,10 +28,10 @@
 SHELL_STATUS
 SHELL_STATUS
 EFIAPI
 EFIAPI
 HttpCommandHandler (
 HttpCommandHandler (
-  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL    *This,
-  IN EFI_SYSTEM_TABLE                      *SystemTable,
-  IN EFI_SHELL_PARAMETERS_PROTOCOL         *ShellParameters,
-  IN EFI_SHELL_PROTOCOL                    *Shell
+  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  *This,
+  IN EFI_SYSTEM_TABLE                    *SystemTable,
+  IN EFI_SHELL_PARAMETERS_PROTOCOL       *ShellParameters,
+  IN EFI_SHELL_PROTOCOL                  *Shell
   )
   )
 {
 {
   gEfiShellParametersProtocol = ShellParameters;
   gEfiShellParametersProtocol = ShellParameters;
@@ -53,8 +53,8 @@ HttpCommandHandler (
 CHAR16 *
 CHAR16 *
 EFIAPI
 EFIAPI
 HttpCommandGetHelp (
 HttpCommandGetHelp (
-  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL    *This,
-  IN CONST CHAR8                           *Language
+  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  *This,
+  IN CONST CHAR8                         *Language
   )
   )
 {
 {
   return HiiGetString (
   return HiiGetString (
@@ -64,7 +64,7 @@ HttpCommandGetHelp (
            );
            );
 }
 }
 
 
-EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mHttpDynamicCommand = {
+EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  mHttpDynamicCommand = {
   HTTP_APP_NAME,
   HTTP_APP_NAME,
   HttpCommandHandler,
   HttpCommandHandler,
   HttpCommandGetHelp
   HttpCommandGetHelp
@@ -85,11 +85,11 @@ EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mHttpDynamicCommand = {
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 HttpCommandInitialize (
 HttpCommandInitialize (
-  IN EFI_HANDLE               ImageHandle,
-  IN EFI_SYSTEM_TABLE         *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
 
 
   mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
   mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
   if (mHttpHiiHandle == NULL) {
   if (mHttpHiiHandle == NULL) {
@@ -117,10 +117,10 @@ HttpCommandInitialize (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 HttpUnload (
 HttpUnload (
-  IN EFI_HANDLE               ImageHandle
-)
+  IN EFI_HANDLE  ImageHandle
+  )
 {
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
 
 
   Status = gBS->UninstallProtocolInterface (
   Status = gBS->UninstallProtocolInterface (
                   ImageHandle,
                   ImageHandle,

+ 274 - 155
ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c

@@ -10,8 +10,8 @@
 
 
 #include "Tftp.h"
 #include "Tftp.h"
 
 
-#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32
-EFI_HII_HANDLE   mTftpHiiHandle;
+#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH  32
+EFI_HII_HANDLE  mTftpHiiHandle;
 
 
 /*
 /*
    Constant strings and definitions related to the message indicating the amount of
    Constant strings and definitions related to the message indicating the amount of
@@ -19,7 +19,7 @@ EFI_HII_HANDLE   mTftpHiiHandle;
 */
 */
 
 
 // Frame for the progression slider
 // Frame for the progression slider
-STATIC CONST CHAR16 mTftpProgressFrame[] = L"[                                        ]";
+STATIC CONST CHAR16  mTftpProgressFrame[] = L"[                                        ]";
 
 
 // Number of steps in the progression slider
 // Number of steps in the progression slider
 #define TFTP_PROGRESS_SLIDER_STEPS  ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) - 3)
 #define TFTP_PROGRESS_SLIDER_STEPS  ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) - 3)
@@ -33,13 +33,13 @@ STATIC CONST CHAR16 mTftpProgressFrame[] = L"[
 
 
 // String to delete the TFTP progress message to be able to update it :
 // String to delete the TFTP progress message to be able to update it :
 // (TFTP_PROGRESS_MESSAGE_SIZE-1) '\b'
 // (TFTP_PROGRESS_MESSAGE_SIZE-1) '\b'
-STATIC CONST CHAR16 mTftpProgressDelete[] = L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
+STATIC CONST CHAR16  mTftpProgressDelete[] = L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
 
 
 // Local File Handle
 // Local File Handle
-SHELL_FILE_HANDLE     mFileHandle;
+SHELL_FILE_HANDLE  mFileHandle;
 
 
 // Path of the local file, Unicode encoded
 // Path of the local file, Unicode encoded
-CONST CHAR16         *mLocalFilePath;
+CONST CHAR16  *mLocalFilePath;
 
 
 /**
 /**
   Check and convert the UINT16 option values of the 'tftp' command
   Check and convert the UINT16 option values of the 'tftp' command
@@ -206,49 +206,57 @@ CheckPacket (
   IN EFI_MTFTP4_PACKET    *Packet
   IN EFI_MTFTP4_PACKET    *Packet
   );
   );
 
 
-EFI_MTFTP4_CONFIG_DATA DefaultMtftp4ConfigData = {
+EFI_MTFTP4_CONFIG_DATA  DefaultMtftp4ConfigData = {
   TRUE,                             // Use default setting
   TRUE,                             // Use default setting
-  { { 0, 0, 0, 0 } },               // StationIp         - Not relevant as UseDefaultSetting=TRUE
-  { { 0, 0, 0, 0 } },               // SubnetMask        - Not relevant as UseDefaultSetting=TRUE
+  {
+    { 0, 0, 0, 0 }
+  },                                // StationIp         - Not relevant as UseDefaultSetting=TRUE
+  {
+    { 0, 0, 0, 0 }
+  },                                // SubnetMask        - Not relevant as UseDefaultSetting=TRUE
   0,                                // LocalPort         - Automatically assigned port number.
   0,                                // LocalPort         - Automatically assigned port number.
-  { { 0, 0, 0, 0 } },               // GatewayIp         - Not relevant as UseDefaultSetting=TRUE
-  { { 0, 0, 0, 0 } },               // ServerIp          - Not known yet
+  {
+    { 0, 0, 0, 0 }
+  },                                // GatewayIp         - Not relevant as UseDefaultSetting=TRUE
+  {
+    { 0, 0, 0, 0 }
+  },                                // ServerIp          - Not known yet
   69,                               // InitialServerPort - Standard TFTP server port
   69,                               // InitialServerPort - Standard TFTP server port
   6,                                // TryCount          - The number of times to transmit request packets and wait for a response.
   6,                                // TryCount          - The number of times to transmit request packets and wait for a response.
   4                                 // TimeoutValue      - Retransmission timeout in seconds.
   4                                 // TimeoutValue      - Retransmission timeout in seconds.
 };
 };
 
 
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
-  {L"-i", TypeValue},
-  {L"-l", TypeValue},
-  {L"-r", TypeValue},
-  {L"-c", TypeValue},
-  {L"-t", TypeValue},
-  {L"-s", TypeValue},
-  {L"-w", TypeValue},
-  {NULL , TypeMax}
-  };
+STATIC CONST SHELL_PARAM_ITEM  ParamList[] = {
+  { L"-i", TypeValue },
+  { L"-l", TypeValue },
+  { L"-r", TypeValue },
+  { L"-c", TypeValue },
+  { L"-t", TypeValue },
+  { L"-s", TypeValue },
+  { L"-w", TypeValue },
+  { NULL,  TypeMax   }
+};
 
 
 ///
 ///
 /// The default block size (512) of tftp is defined in the RFC1350.
 /// The default block size (512) of tftp is defined in the RFC1350.
 ///
 ///
-#define MTFTP_DEFAULT_BLKSIZE      512
+#define MTFTP_DEFAULT_BLKSIZE  512
 ///
 ///
 /// The valid range of block size option is defined in the RFC2348.
 /// The valid range of block size option is defined in the RFC2348.
 ///
 ///
-#define MTFTP_MIN_BLKSIZE          8
-#define MTFTP_MAX_BLKSIZE          65464
+#define MTFTP_MIN_BLKSIZE  8
+#define MTFTP_MAX_BLKSIZE  65464
 ///
 ///
 /// The default windowsize (1) of tftp.
 /// The default windowsize (1) of tftp.
 ///
 ///
-#define MTFTP_DEFAULT_WINDOWSIZE   1
+#define MTFTP_DEFAULT_WINDOWSIZE  1
 ///
 ///
 /// The valid range of window size option.
 /// The valid range of window size option.
 /// Note that: RFC 7440 does not mention max window size value, but for the
 /// Note that: RFC 7440 does not mention max window size value, but for the
 /// stability reason, the value is limited to 64.
 /// stability reason, the value is limited to 64.
 ///
 ///
-#define MTFTP_MIN_WINDOWSIZE       1
-#define MTFTP_MAX_WINDOWSIZE       64
+#define MTFTP_MIN_WINDOWSIZE  1
+#define MTFTP_MAX_WINDOWSIZE  64
 
 
 /**
 /**
   Function for 'tftp' command.
   Function for 'tftp' command.
@@ -319,15 +327,22 @@ RunTftp (
   Status = ShellCommandLineParse (ParamList, &CheckPackage, &ProblemParam, TRUE);
   Status = ShellCommandLineParse (ParamList, &CheckPackage, &ProblemParam, TRUE);
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     if ((Status == EFI_VOLUME_CORRUPTED) &&
     if ((Status == EFI_VOLUME_CORRUPTED) &&
-        (ProblemParam != NULL) ) {
+        (ProblemParam != NULL))
+    {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), mTftpHiiHandle,
-        L"tftp", ProblemParam
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_GEN_PROBLEM),
+        mTftpHiiHandle,
+        L"tftp",
+        ProblemParam
         );
         );
       FreePool (ProblemParam);
       FreePool (ProblemParam);
     } else {
     } else {
       ASSERT (FALSE);
       ASSERT (FALSE);
     }
     }
+
     goto Error;
     goto Error;
   }
   }
 
 
@@ -337,15 +352,24 @@ RunTftp (
   ParamCount = ShellCommandLineGetCount (CheckPackage);
   ParamCount = ShellCommandLineGetCount (CheckPackage);
   if (ParamCount > 4) {
   if (ParamCount > 4) {
     ShellPrintHiiEx (
     ShellPrintHiiEx (
-      -1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY),
-      mTftpHiiHandle, L"tftp"
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_GEN_TOO_MANY),
+      mTftpHiiHandle,
+      L"tftp"
       );
       );
     goto Error;
     goto Error;
   }
   }
+
   if (ParamCount < 3) {
   if (ParamCount < 3) {
     ShellPrintHiiEx (
     ShellPrintHiiEx (
-      -1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW),
-      mTftpHiiHandle, L"tftp"
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_GEN_TOO_FEW),
+      mTftpHiiHandle,
+      L"tftp"
       );
       );
     goto Error;
     goto Error;
   }
   }
@@ -356,23 +380,29 @@ RunTftp (
   // Check the host IPv4 address
   // Check the host IPv4 address
   //
   //
   ValueStr = ShellCommandLineGetRawValue (CheckPackage, 1);
   ValueStr = ShellCommandLineGetRawValue (CheckPackage, 1);
-  Status = NetLibStrToIp4 (ValueStr, &Mtftp4ConfigData.ServerIp);
+  Status   = NetLibStrToIp4 (ValueStr, &Mtftp4ConfigData.ServerIp);
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     ShellPrintHiiEx (
     ShellPrintHiiEx (
-      -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
-      mTftpHiiHandle, L"tftp", ValueStr
-    );
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_GEN_PARAM_INV),
+      mTftpHiiHandle,
+      L"tftp",
+      ValueStr
+      );
     goto Error;
     goto Error;
   }
   }
 
 
   RemoteFilePath = ShellCommandLineGetRawValue (CheckPackage, 2);
   RemoteFilePath = ShellCommandLineGetRawValue (CheckPackage, 2);
-  ASSERT(RemoteFilePath != NULL);
-  FilePathSize = StrLen (RemoteFilePath) + 1;
+  ASSERT (RemoteFilePath != NULL);
+  FilePathSize        = StrLen (RemoteFilePath) + 1;
   AsciiRemoteFilePath = AllocatePool (FilePathSize);
   AsciiRemoteFilePath = AllocatePool (FilePathSize);
   if (AsciiRemoteFilePath == NULL) {
   if (AsciiRemoteFilePath == NULL) {
     ShellStatus = SHELL_OUT_OF_RESOURCES;
     ShellStatus = SHELL_OUT_OF_RESOURCES;
     goto Error;
     goto Error;
   }
   }
+
   UnicodeStrToAsciiStrS (RemoteFilePath, AsciiRemoteFilePath, FilePathSize);
   UnicodeStrToAsciiStrS (RemoteFilePath, AsciiRemoteFilePath, FilePathSize);
 
 
   if (ParamCount == 4) {
   if (ParamCount == 4) {
@@ -381,10 +411,12 @@ RunTftp (
     Walker = RemoteFilePath + StrLen (RemoteFilePath);
     Walker = RemoteFilePath + StrLen (RemoteFilePath);
     while ((--Walker) >= RemoteFilePath) {
     while ((--Walker) >= RemoteFilePath) {
       if ((*Walker == L'\\') ||
       if ((*Walker == L'\\') ||
-          (*Walker == L'/' )    ) {
+          (*Walker == L'/'))
+      {
         break;
         break;
       }
       }
     }
     }
+
     mLocalFilePath = Walker + 1;
     mLocalFilePath = Walker + 1;
   }
   }
 
 
@@ -423,11 +455,17 @@ RunTftp (
     if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TimeoutValue)) {
     if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TimeoutValue)) {
       goto Error;
       goto Error;
     }
     }
+
     if (Mtftp4ConfigData.TimeoutValue == 0) {
     if (Mtftp4ConfigData.TimeoutValue == 0) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
-        mTftpHiiHandle, L"tftp", ValueStr
-      );
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_GEN_PARAM_INV),
+        mTftpHiiHandle,
+        L"tftp",
+        ValueStr
+        );
       goto Error;
       goto Error;
     }
     }
   }
   }
@@ -437,11 +475,17 @@ RunTftp (
     if (!StringToUint16 (ValueStr, &BlockSize)) {
     if (!StringToUint16 (ValueStr, &BlockSize)) {
       goto Error;
       goto Error;
     }
     }
-    if (BlockSize < MTFTP_MIN_BLKSIZE || BlockSize > MTFTP_MAX_BLKSIZE) {
+
+    if ((BlockSize < MTFTP_MIN_BLKSIZE) || (BlockSize > MTFTP_MAX_BLKSIZE)) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
-        mTftpHiiHandle, L"tftp", ValueStr
-      );
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_GEN_PARAM_INV),
+        mTftpHiiHandle,
+        L"tftp",
+        ValueStr
+        );
       goto Error;
       goto Error;
     }
     }
   }
   }
@@ -451,11 +495,17 @@ RunTftp (
     if (!StringToUint16 (ValueStr, &WindowSize)) {
     if (!StringToUint16 (ValueStr, &WindowSize)) {
       goto Error;
       goto Error;
     }
     }
-    if (WindowSize < MTFTP_MIN_WINDOWSIZE || WindowSize > MTFTP_MAX_WINDOWSIZE) {
+
+    if ((WindowSize < MTFTP_MIN_WINDOWSIZE) || (WindowSize > MTFTP_MAX_WINDOWSIZE)) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
-        mTftpHiiHandle, L"tftp", ValueStr
-      );
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_GEN_PARAM_INV),
+        mTftpHiiHandle,
+        L"tftp",
+        ValueStr
+        );
       goto Error;
       goto Error;
     }
     }
   }
   }
@@ -464,32 +514,41 @@ RunTftp (
   // Locate all MTFTP4 Service Binding protocols
   // Locate all MTFTP4 Service Binding protocols
   //
   //
   ShellStatus = SHELL_NOT_FOUND;
   ShellStatus = SHELL_NOT_FOUND;
-  Status = gBS->LocateHandleBuffer (
-                 ByProtocol,
-                 &gEfiManagedNetworkServiceBindingProtocolGuid,
-                 NULL,
-                 &HandleCount,
-                 &Handles
-                 );
+  Status      = gBS->LocateHandleBuffer (
+                       ByProtocol,
+                       &gEfiManagedNetworkServiceBindingProtocolGuid,
+                       NULL,
+                       &HandleCount,
+                       &Handles
+                       );
   if (EFI_ERROR (Status) || (HandleCount == 0)) {
   if (EFI_ERROR (Status) || (HandleCount == 0)) {
     ShellPrintHiiEx (
     ShellPrintHiiEx (
-      -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NO_NIC),
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_TFTP_ERR_NO_NIC),
       mTftpHiiHandle
       mTftpHiiHandle
-    );
+      );
     goto Error;
     goto Error;
   }
   }
 
 
   for (NicNumber = 0;
   for (NicNumber = 0;
        (NicNumber < HandleCount) && (ShellStatus != SHELL_SUCCESS);
        (NicNumber < HandleCount) && (ShellStatus != SHELL_SUCCESS);
-       NicNumber++) {
+       NicNumber++)
+  {
     ControllerHandle = Handles[NicNumber];
     ControllerHandle = Handles[NicNumber];
 
 
     Status = GetNicName (ControllerHandle, NicNumber, NicName);
     Status = GetNicName (ControllerHandle, NicNumber, NicName);
     if (EFI_ERROR (Status)) {
     if (EFI_ERROR (Status)) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NAME),
-        mTftpHiiHandle, NicNumber, Status
-      );
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_TFTP_ERR_NIC_NAME),
+        mTftpHiiHandle,
+        NicNumber,
+        Status
+        );
       continue;
       continue;
     }
     }
 
 
@@ -497,6 +556,7 @@ RunTftp (
       if (StrCmp (NicName, UserNicName) != 0) {
       if (StrCmp (NicName, UserNicName) != 0) {
         continue;
         continue;
       }
       }
+
       NicFound = TRUE;
       NicFound = TRUE;
     }
     }
 
 
@@ -505,46 +565,68 @@ RunTftp (
                &gEfiMtftp4ServiceBindingProtocolGuid,
                &gEfiMtftp4ServiceBindingProtocolGuid,
                &gEfiMtftp4ProtocolGuid,
                &gEfiMtftp4ProtocolGuid,
                &Mtftp4ChildHandle,
                &Mtftp4ChildHandle,
-               (VOID**)&Mtftp4
+               (VOID **)&Mtftp4
                );
                );
     if (EFI_ERROR (Status)) {
     if (EFI_ERROR (Status)) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_OPEN_PROTOCOL),
-        mTftpHiiHandle, NicName, Status
-      );
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_TFTP_ERR_OPEN_PROTOCOL),
+        mTftpHiiHandle,
+        NicName,
+        Status
+        );
       continue;
       continue;
     }
     }
 
 
     Status = Mtftp4->Configure (Mtftp4, &Mtftp4ConfigData);
     Status = Mtftp4->Configure (Mtftp4, &Mtftp4ConfigData);
     if (EFI_ERROR (Status)) {
     if (EFI_ERROR (Status)) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_CONFIGURE),
-        mTftpHiiHandle, NicName, Status
-      );
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_TFTP_ERR_CONFIGURE),
+        mTftpHiiHandle,
+        NicName,
+        Status
+        );
       goto NextHandle;
       goto NextHandle;
     }
     }
 
 
     Status = GetFileSize (Mtftp4, AsciiRemoteFilePath, &FileSize);
     Status = GetFileSize (Mtftp4, AsciiRemoteFilePath, &FileSize);
     if (EFI_ERROR (Status)) {
     if (EFI_ERROR (Status)) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_FILE_SIZE),
-        mTftpHiiHandle, RemoteFilePath, NicName, Status
-      );
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_TFTP_ERR_FILE_SIZE),
+        mTftpHiiHandle,
+        RemoteFilePath,
+        NicName,
+        Status
+        );
       goto NextHandle;
       goto NextHandle;
     }
     }
 
 
     Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, FileSize, BlockSize, WindowSize);
     Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, FileSize, BlockSize, WindowSize);
     if (EFI_ERROR (Status)) {
     if (EFI_ERROR (Status)) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD),
-        mTftpHiiHandle, RemoteFilePath, NicName, Status
-      );
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD),
+        mTftpHiiHandle,
+        RemoteFilePath,
+        NicName,
+        Status
+        );
       goto NextHandle;
       goto NextHandle;
     }
     }
 
 
     ShellStatus = SHELL_SUCCESS;
     ShellStatus = SHELL_SUCCESS;
 
 
-    NextHandle:
+NextHandle:
 
 
     CloseProtocolAndDestroyServiceChild (
     CloseProtocolAndDestroyServiceChild (
       ControllerHandle,
       ControllerHandle,
@@ -556,22 +638,27 @@ RunTftp (
 
 
   if ((UserNicName != NULL) && (!NicFound)) {
   if ((UserNicName != NULL) && (!NicFound)) {
     ShellPrintHiiEx (
     ShellPrintHiiEx (
-      -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND),
-      mTftpHiiHandle, UserNicName
-    );
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND),
+      mTftpHiiHandle,
+      UserNicName
+      );
   }
   }
 
 
-  Error:
+Error:
 
 
   ShellCommandLineFreeVarList (CheckPackage);
   ShellCommandLineFreeVarList (CheckPackage);
   if (AsciiRemoteFilePath != NULL) {
   if (AsciiRemoteFilePath != NULL) {
     FreePool (AsciiRemoteFilePath);
     FreePool (AsciiRemoteFilePath);
   }
   }
+
   if (Handles != NULL) {
   if (Handles != NULL) {
     FreePool (Handles);
     FreePool (Handles);
   }
   }
 
 
-  if ((ShellStatus != SHELL_SUCCESS) && (EFI_ERROR(Status))) {
+  if ((ShellStatus != SHELL_SUCCESS) && (EFI_ERROR (Status))) {
     ShellStatus = Status & ~MAX_BIT;
     ShellStatus = Status & ~MAX_BIT;
   }
   }
 
 
@@ -599,9 +686,14 @@ StringToUint16 (
   Val = ShellStrToUintn (ValueStr);
   Val = ShellStrToUintn (ValueStr);
   if (Val > MAX_UINT16) {
   if (Val > MAX_UINT16) {
     ShellPrintHiiEx (
     ShellPrintHiiEx (
-      -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
-      mTftpHiiHandle, L"tftp", ValueStr
-    );
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_GEN_PARAM_INV),
+      mTftpHiiHandle,
+      L"tftp",
+      ValueStr
+      );
     return FALSE;
     return FALSE;
   }
   }
 
 
@@ -645,7 +737,7 @@ GetNicName (
              &gEfiManagedNetworkServiceBindingProtocolGuid,
              &gEfiManagedNetworkServiceBindingProtocolGuid,
              &gEfiManagedNetworkProtocolGuid,
              &gEfiManagedNetworkProtocolGuid,
              &MnpHandle,
              &MnpHandle,
-             (VOID**)&Mnp
+             (VOID **)&Mnp
              );
              );
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     goto Error;
     goto Error;
@@ -661,7 +753,7 @@ GetNicName (
     IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH,
     IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH,
     SnpMode.IfType == NET_IFTYPE_ETHERNET ?
     SnpMode.IfType == NET_IFTYPE_ETHERNET ?
     L"eth%d" :
     L"eth%d" :
-    L"unk%d" ,
+    L"unk%d",
     NicNumber
     NicNumber
     );
     );
 
 
@@ -713,12 +805,12 @@ CreateServiceChildAndOpenProtocol (
   EFI_STATUS  Status;
   EFI_STATUS  Status;
 
 
   *ChildHandle = NULL;
   *ChildHandle = NULL;
-  Status = NetLibCreateServiceChild (
-             ControllerHandle,
-             gImageHandle,
-             ServiceBindingProtocolGuid,
-             ChildHandle
-             );
+  Status       = NetLibCreateServiceChild (
+                   ControllerHandle,
+                   gImageHandle,
+                   ServiceBindingProtocolGuid,
+                   ChildHandle
+                   );
   if (!EFI_ERROR (Status)) {
   if (!EFI_ERROR (Status)) {
     Status = gBS->OpenProtocol (
     Status = gBS->OpenProtocol (
                     *ChildHandle,
                     *ChildHandle,
@@ -810,21 +902,21 @@ GetFileSize (
   UINT32             OptCnt;
   UINT32             OptCnt;
   UINT8              OptBuf[128];
   UINT8              OptBuf[128];
 
 
-  ReqOpt[0].OptionStr = (UINT8*)"tsize";
-  OptBuf[0] = '0';
-  OptBuf[1] = 0;
-  ReqOpt[0].ValueStr = OptBuf;
+  ReqOpt[0].OptionStr = (UINT8 *)"tsize";
+  OptBuf[0]           = '0';
+  OptBuf[1]           = 0;
+  ReqOpt[0].ValueStr  = OptBuf;
 
 
   Status = Mtftp4->GetInfo (
   Status = Mtftp4->GetInfo (
-             Mtftp4,
-             NULL,
-             (UINT8*)FilePath,
-             NULL,
-             1,
-             ReqOpt,
-             &PktLen,
-             &Packet
-             );
+                     Mtftp4,
+                     NULL,
+                     (UINT8 *)FilePath,
+                     NULL,
+                     1,
+                     ReqOpt,
+                     &PktLen,
+                     &Packet
+                     );
 
 
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     goto Error;
     goto Error;
@@ -834,7 +926,7 @@ GetFileSize (
                      Mtftp4,
                      Mtftp4,
                      PktLen,
                      PktLen,
                      Packet,
                      Packet,
-                     (UINT32 *) &OptCnt,
+                     (UINT32 *)&OptCnt,
                      &TableOfOptions
                      &TableOfOptions
                      );
                      );
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
@@ -847,16 +939,18 @@ GetFileSize (
       *FileSize = AsciiStrDecimalToUintn ((CHAR8 *)Option->ValueStr);
       *FileSize = AsciiStrDecimalToUintn ((CHAR8 *)Option->ValueStr);
       break;
       break;
     }
     }
+
     OptCnt--;
     OptCnt--;
     Option++;
     Option++;
   }
   }
+
   FreePool (TableOfOptions);
   FreePool (TableOfOptions);
 
 
   if (OptCnt == 0) {
   if (OptCnt == 0) {
     Status = EFI_UNSUPPORTED;
     Status = EFI_UNSUPPORTED;
   }
   }
 
 
-Error :
+Error:
 
 
   return Status;
   return Status;
 }
 }
@@ -889,11 +983,11 @@ DownloadFile (
   IN   UINT16               WindowSize
   IN   UINT16               WindowSize
   )
   )
 {
 {
-  EFI_STATUS            Status;
-  DOWNLOAD_CONTEXT      *TftpContext;
-  EFI_MTFTP4_TOKEN      Mtftp4Token;
-  UINT8                 BlksizeBuf[10];
-  UINT8                 WindowsizeBuf[10];
+  EFI_STATUS        Status;
+  DOWNLOAD_CONTEXT  *TftpContext;
+  EFI_MTFTP4_TOKEN  Mtftp4Token;
+  UINT8             BlksizeBuf[10];
+  UINT8             WindowsizeBuf[10];
 
 
   ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN));
   ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN));
 
 
@@ -902,13 +996,14 @@ DownloadFile (
     Status = EFI_OUT_OF_RESOURCES;
     Status = EFI_OUT_OF_RESOURCES;
     goto Error;
     goto Error;
   }
   }
-  TftpContext->FileSize = FileSize;
+
+  TftpContext->FileSize              = FileSize;
   TftpContext->DownloadedNbOfBytes   = 0;
   TftpContext->DownloadedNbOfBytes   = 0;
   TftpContext->LastReportedNbOfBytes = 0;
   TftpContext->LastReportedNbOfBytes = 0;
 
 
-  Mtftp4Token.Filename    = (UINT8*)AsciiFilePath;
+  Mtftp4Token.Filename    = (UINT8 *)AsciiFilePath;
   Mtftp4Token.CheckPacket = CheckPacket;
   Mtftp4Token.CheckPacket = CheckPacket;
-  Mtftp4Token.Context     = (VOID*)TftpContext;
+  Mtftp4Token.Context     = (VOID *)TftpContext;
   Mtftp4Token.OptionCount = 0;
   Mtftp4Token.OptionCount = 0;
   Mtftp4Token.OptionList  = AllocatePool (sizeof (EFI_MTFTP4_OPTION) * 2);
   Mtftp4Token.OptionList  = AllocatePool (sizeof (EFI_MTFTP4_OPTION) * 2);
   if (Mtftp4Token.OptionList == NULL) {
   if (Mtftp4Token.OptionList == NULL) {
@@ -917,22 +1012,26 @@ DownloadFile (
   }
   }
 
 
   if (BlockSize != MTFTP_DEFAULT_BLKSIZE) {
   if (BlockSize != MTFTP_DEFAULT_BLKSIZE) {
-    Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *) "blksize";
-    AsciiSPrint ((CHAR8 *) BlksizeBuf, sizeof (BlksizeBuf), "%d", BlockSize);
-    Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr  = BlksizeBuf;
-    Mtftp4Token.OptionCount ++;
+    Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *)"blksize";
+    AsciiSPrint ((CHAR8 *)BlksizeBuf, sizeof (BlksizeBuf), "%d", BlockSize);
+    Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr = BlksizeBuf;
+    Mtftp4Token.OptionCount++;
   }
   }
 
 
   if (WindowSize != MTFTP_DEFAULT_WINDOWSIZE) {
   if (WindowSize != MTFTP_DEFAULT_WINDOWSIZE) {
-    Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *) "windowsize";
-    AsciiSPrint ((CHAR8 *) WindowsizeBuf, sizeof (WindowsizeBuf), "%d", WindowSize);
-    Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr  = WindowsizeBuf;
-    Mtftp4Token.OptionCount ++;
+    Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *)"windowsize";
+    AsciiSPrint ((CHAR8 *)WindowsizeBuf, sizeof (WindowsizeBuf), "%d", WindowSize);
+    Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr = WindowsizeBuf;
+    Mtftp4Token.OptionCount++;
   }
   }
 
 
   ShellPrintHiiEx (
   ShellPrintHiiEx (
-    -1, -1, NULL, STRING_TOKEN (STR_TFTP_DOWNLOADING),
-    mTftpHiiHandle, FilePath
+    -1,
+    -1,
+    NULL,
+    STRING_TOKEN (STR_TFTP_DOWNLOADING),
+    mTftpHiiHandle,
+    FilePath
     );
     );
 
 
   //
   //
@@ -943,24 +1042,32 @@ DownloadFile (
   }
   }
 
 
   Status = ShellOpenFileByName (
   Status = ShellOpenFileByName (
-              mLocalFilePath,
-              &mFileHandle,
-              EFI_FILE_MODE_CREATE |
-              EFI_FILE_MODE_WRITE  |
-              EFI_FILE_MODE_READ,
-              0
-              );
+             mLocalFilePath,
+             &mFileHandle,
+             EFI_FILE_MODE_CREATE |
+             EFI_FILE_MODE_WRITE  |
+             EFI_FILE_MODE_READ,
+             0
+             );
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     ShellPrintHiiEx (
     ShellPrintHiiEx (
-      -1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL),
-      mTftpHiiHandle, L"tftp", mLocalFilePath
-    );
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL),
+      mTftpHiiHandle,
+      L"tftp",
+      mLocalFilePath
+      );
     goto Error;
     goto Error;
   }
   }
 
 
   Status = Mtftp4->ReadFile (Mtftp4, &Mtftp4Token);
   Status = Mtftp4->ReadFile (Mtftp4, &Mtftp4Token);
   ShellPrintHiiEx (
   ShellPrintHiiEx (
-    -1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF),
+    -1,
+    -1,
+    NULL,
+    STRING_TOKEN (STR_GEN_CRLF),
     mTftpHiiHandle
     mTftpHiiHandle
     );
     );
 
 
@@ -969,7 +1076,7 @@ DownloadFile (
   //
   //
   ShellCloseFile (&mFileHandle);
   ShellCloseFile (&mFileHandle);
 
 
-Error :
+Error:
   if (TftpContext != NULL) {
   if (TftpContext != NULL) {
     FreePool (TftpContext);
     FreePool (TftpContext);
   }
   }
@@ -1016,7 +1123,7 @@ CheckPacket (
     return EFI_SUCCESS;
     return EFI_SUCCESS;
   }
   }
 
 
-  Context = (DOWNLOAD_CONTEXT*)Token->Context;
+  Context = (DOWNLOAD_CONTEXT *)Token->Context;
 
 
   //
   //
   // The data in the packet are prepended with two UINT16 :
   // The data in the packet are prepended with two UINT16 :
@@ -1025,19 +1132,28 @@ CheckPacket (
   //
   //
   DownloadLen = (UINTN)PacketLen - sizeof (Packet->OpCode) - sizeof (Packet->Data.Block);
   DownloadLen = (UINTN)PacketLen - sizeof (Packet->OpCode) - sizeof (Packet->Data.Block);
 
 
-  ShellSetFilePosition(mFileHandle, Context->DownloadedNbOfBytes);
+  ShellSetFilePosition (mFileHandle, Context->DownloadedNbOfBytes);
   Status = ShellWriteFile (mFileHandle, &DownloadLen, Packet->Data.Data);
   Status = ShellWriteFile (mFileHandle, &DownloadLen, Packet->Data.Data);
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     if (Context->DownloadedNbOfBytes > 0) {
     if (Context->DownloadedNbOfBytes > 0) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF),
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_GEN_CRLF),
         mTftpHiiHandle
         mTftpHiiHandle
-      );
+        );
     }
     }
+
     ShellPrintHiiEx (
     ShellPrintHiiEx (
-      -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_WRITE),
-      mTftpHiiHandle, mLocalFilePath, Status
-    );
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_TFTP_ERR_WRITE),
+      mTftpHiiHandle,
+      mLocalFilePath,
+      Status
+      );
     return Status;
     return Status;
   }
   }
 
 
@@ -1046,11 +1162,11 @@ CheckPacket (
   }
   }
 
 
   Context->DownloadedNbOfBytes += DownloadLen;
   Context->DownloadedNbOfBytes += DownloadLen;
-  NbOfKb = Context->DownloadedNbOfBytes / 1024;
+  NbOfKb                        = Context->DownloadedNbOfBytes / 1024;
 
 
   Progress[0] = L'\0';
   Progress[0] = L'\0';
-  LastStep  = (Context->LastReportedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;
-  Step      = (Context->DownloadedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;
+  LastStep    = (Context->LastReportedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;
+  Step        = (Context->DownloadedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;
 
 
   if (Step <= LastStep) {
   if (Step <= LastStep) {
     return EFI_SUCCESS;
     return EFI_SUCCESS;
@@ -1059,12 +1175,14 @@ CheckPacket (
   ShellPrintEx (-1, -1, L"%s", mTftpProgressDelete);
   ShellPrintEx (-1, -1, L"%s", mTftpProgressDelete);
 
 
   Status = StrCpyS (Progress, TFTP_PROGRESS_MESSAGE_SIZE, mTftpProgressFrame);
   Status = StrCpyS (Progress, TFTP_PROGRESS_MESSAGE_SIZE, mTftpProgressFrame);
-  if (EFI_ERROR(Status)) {
+  if (EFI_ERROR (Status)) {
     return Status;
     return Status;
   }
   }
+
   for (Index = 1; Index < Step; Index++) {
   for (Index = 1; Index < Step; Index++) {
     Progress[Index] = L'=';
     Progress[Index] = L'=';
   }
   }
+
   Progress[Step] = L'>';
   Progress[Step] = L'>';
 
 
   UnicodeSPrint (
   UnicodeSPrint (
@@ -1089,12 +1207,12 @@ CheckPacket (
 **/
 **/
 EFI_HII_HANDLE
 EFI_HII_HANDLE
 InitializeHiiPackage (
 InitializeHiiPackage (
-  EFI_HANDLE                  ImageHandle
+  EFI_HANDLE  ImageHandle
   )
   )
 {
 {
-  EFI_STATUS                  Status;
-  EFI_HII_PACKAGE_LIST_HEADER *PackageList;
-  EFI_HII_HANDLE              HiiHandle;
+  EFI_STATUS                   Status;
+  EFI_HII_PACKAGE_LIST_HEADER  *PackageList;
+  EFI_HII_HANDLE               HiiHandle;
 
 
   //
   //
   // Retrieve HII package list from ImageHandle
   // Retrieve HII package list from ImageHandle
@@ -1125,5 +1243,6 @@ InitializeHiiPackage (
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     return NULL;
     return NULL;
   }
   }
+
   return HiiHandle;
   return HiiHandle;
 }
 }

+ 6 - 5
ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h

@@ -30,12 +30,12 @@
 #include <Library/PrintLib.h>
 #include <Library/PrintLib.h>
 #include <Library/UefiHiiServicesLib.h>
 #include <Library/UefiHiiServicesLib.h>
 
 
-extern EFI_HII_HANDLE mTftpHiiHandle;
+extern EFI_HII_HANDLE  mTftpHiiHandle;
 
 
 typedef struct {
 typedef struct {
-  UINTN  FileSize;
-  UINTN  DownloadedNbOfBytes;
-  UINTN  LastReportedNbOfBytes;
+  UINTN    FileSize;
+  UINTN    DownloadedNbOfBytes;
+  UINTN    LastReportedNbOfBytes;
 } DOWNLOAD_CONTEXT;
 } DOWNLOAD_CONTEXT;
 
 
 /**
 /**
@@ -64,6 +64,7 @@ RunTftp (
 **/
 **/
 EFI_HII_HANDLE
 EFI_HII_HANDLE
 InitializeHiiPackage (
 InitializeHiiPackage (
-  EFI_HANDLE                  ImageHandle
+  EFI_HANDLE  ImageHandle
   );
   );
+
 #endif // _TFTP_H_
 #endif // _TFTP_H_

+ 5 - 4
ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c

@@ -17,7 +17,7 @@
 // the resource section. Thus the application can use '-?' option to show help message in
 // the resource section. Thus the application can use '-?' option to show help message in
 // Shell.
 // Shell.
 //
 //
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_TFTP);
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID  mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_TFTP);
 
 
 /**
 /**
   Entry point of Tftp standalone application.
   Entry point of Tftp standalone application.
@@ -32,11 +32,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (S
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 TftpAppInitialize (
 TftpAppInitialize (
-  IN EFI_HANDLE               ImageHandle,
-  IN EFI_SYSTEM_TABLE         *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
+
   mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
   mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
   if (mTftpHiiHandle == NULL) {
   if (mTftpHiiHandle == NULL) {
     return EFI_ABORTED;
     return EFI_ABORTED;

+ 16 - 13
ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c

@@ -26,10 +26,10 @@
 SHELL_STATUS
 SHELL_STATUS
 EFIAPI
 EFIAPI
 TftpCommandHandler (
 TftpCommandHandler (
-  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL    *This,
-  IN EFI_SYSTEM_TABLE                      *SystemTable,
-  IN EFI_SHELL_PARAMETERS_PROTOCOL         *ShellParameters,
-  IN EFI_SHELL_PROTOCOL                    *Shell
+  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  *This,
+  IN EFI_SYSTEM_TABLE                    *SystemTable,
+  IN EFI_SHELL_PARAMETERS_PROTOCOL       *ShellParameters,
+  IN EFI_SHELL_PROTOCOL                  *Shell
   )
   )
 {
 {
   gEfiShellParametersProtocol = ShellParameters;
   gEfiShellParametersProtocol = ShellParameters;
@@ -50,14 +50,14 @@ TftpCommandHandler (
 CHAR16 *
 CHAR16 *
 EFIAPI
 EFIAPI
 TftpCommandGetHelp (
 TftpCommandGetHelp (
-  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL    *This,
-  IN CONST CHAR8                           *Language
+  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  *This,
+  IN CONST CHAR8                         *Language
   )
   )
 {
 {
   return HiiGetString (mTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP), Language);
   return HiiGetString (mTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP), Language);
 }
 }
 
 
-EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand = {
+EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  mTftpDynamicCommand = {
   L"tftp",
   L"tftp",
   TftpCommandHandler,
   TftpCommandHandler,
   TftpCommandGetHelp
   TftpCommandGetHelp
@@ -78,11 +78,12 @@ EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand = {
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 TftpCommandInitialize (
 TftpCommandInitialize (
-  IN EFI_HANDLE               ImageHandle,
-  IN EFI_SYSTEM_TABLE         *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
+
   mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
   mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
   if (mTftpHiiHandle == NULL) {
   if (mTftpHiiHandle == NULL) {
     return EFI_ABORTED;
     return EFI_ABORTED;
@@ -109,10 +110,11 @@ TftpCommandInitialize (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 TftpUnload (
 TftpUnload (
-  IN EFI_HANDLE               ImageHandle
-)
+  IN EFI_HANDLE  ImageHandle
+  )
 {
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
+
   Status = gBS->UninstallProtocolInterface (
   Status = gBS->UninstallProtocolInterface (
                   ImageHandle,
                   ImageHandle,
                   &gEfiShellDynamicCommandProtocolGuid,
                   &gEfiShellDynamicCommandProtocolGuid,
@@ -121,6 +123,7 @@ TftpUnload (
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     return Status;
     return Status;
   }
   }
+
   HiiRemovePackages (mTftpHiiHandle);
   HiiRemovePackages (mTftpHiiHandle);
   return EFI_SUCCESS;
   return EFI_SUCCESS;
 }
 }

+ 1 - 1
ShellPkg/Include/Guid/ShellAliasGuid.h

@@ -14,6 +14,6 @@
   0x0053d9d6, 0x2659, 0x4599, { 0xa2, 0x6b, 0xef, 0x45, 0x36, 0xe6, 0x31, 0xa9 } \
   0x0053d9d6, 0x2659, 0x4599, { 0xa2, 0x6b, 0xef, 0x45, 0x36, 0xe6, 0x31, 0xa9 } \
 }
 }
 
 
-extern EFI_GUID gShellAliasGuid;
+extern EFI_GUID  gShellAliasGuid;
 
 
 #endif
 #endif

+ 1 - 1
ShellPkg/Include/Guid/ShellEnvironment2Ext.h

@@ -14,6 +14,6 @@
   0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
   0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
 }
 }
 
 
-extern EFI_GUID gEfiShellEnvironment2ExtGuid;
+extern EFI_GUID  gEfiShellEnvironment2ExtGuid;
 
 
 #endif
 #endif

+ 12 - 12
ShellPkg/Include/Guid/ShellLibHiiGuid.h

@@ -69,17 +69,17 @@
     0x5f5f605d, 0x1583, 0x4a2d, {0xa6, 0xb2, 0xeb, 0x12, 0xda, 0xb4, 0xa2, 0xb6 } \
     0x5f5f605d, 0x1583, 0x4a2d, {0xa6, 0xb2, 0xeb, 0x12, 0xda, 0xb4, 0xa2, 0xb6 } \
   }
   }
 
 
-extern EFI_GUID gHandleParsingHiiGuid;
-extern EFI_GUID gShellDebug1HiiGuid;
-extern EFI_GUID gShellDriver1HiiGuid;
-extern EFI_GUID gShellInstall1HiiGuid;
-extern EFI_GUID gShellLevel1HiiGuid;
-extern EFI_GUID gShellLevel2HiiGuid;
-extern EFI_GUID gShellLevel3HiiGuid;
-extern EFI_GUID gShellNetwork1HiiGuid;
-extern EFI_GUID gShellNetwork2HiiGuid;
-extern EFI_GUID gShellTftpHiiGuid;
-extern EFI_GUID gShellHttpHiiGuid;
-extern EFI_GUID gShellBcfgHiiGuid;
+extern EFI_GUID  gHandleParsingHiiGuid;
+extern EFI_GUID  gShellDebug1HiiGuid;
+extern EFI_GUID  gShellDriver1HiiGuid;
+extern EFI_GUID  gShellInstall1HiiGuid;
+extern EFI_GUID  gShellLevel1HiiGuid;
+extern EFI_GUID  gShellLevel2HiiGuid;
+extern EFI_GUID  gShellLevel3HiiGuid;
+extern EFI_GUID  gShellNetwork1HiiGuid;
+extern EFI_GUID  gShellNetwork2HiiGuid;
+extern EFI_GUID  gShellTftpHiiGuid;
+extern EFI_GUID  gShellHttpHiiGuid;
+extern EFI_GUID  gShellBcfgHiiGuid;
 
 
 #endif
 #endif

+ 1 - 1
ShellPkg/Include/Guid/ShellMapGuid.h

@@ -14,6 +14,6 @@
   0x51271e13, 0x7de3, 0x43af, { 0x8b, 0xc2, 0x71, 0xad, 0x3b, 0x82, 0x43, 0x25 } \
   0x51271e13, 0x7de3, 0x43af, { 0x8b, 0xc2, 0x71, 0xad, 0x3b, 0x82, 0x43, 0x25 } \
 }
 }
 
 
-extern EFI_GUID gShellMapGuid;
+extern EFI_GUID  gShellMapGuid;
 
 
 #endif
 #endif

+ 1 - 1
ShellPkg/Include/Guid/ShellPkgTokenSpace.h

@@ -14,6 +14,6 @@
   0x171e9188, 0x31d3, 0x40f5, { 0xb1, 0xc, 0x53, 0x9b, 0x2d, 0xb9, 0x40, 0xcd } \
   0x171e9188, 0x31d3, 0x40f5, { 0xb1, 0xc, 0x53, 0x9b, 0x2d, 0xb9, 0x40, 0xcd } \
 }
 }
 
 
-extern EFI_GUID gEfiShellPkgTokenSpaceGuid;
+extern EFI_GUID  gEfiShellPkgTokenSpaceGuid;
 
 
 #endif
 #endif

+ 1 - 1
ShellPkg/Include/Guid/ShellVariableGuid.h

@@ -14,6 +14,6 @@
   0x158def5a, 0xf656, 0x419c, { 0xb0, 0x27, 0x7a, 0x31, 0x92, 0xc0, 0x79, 0xd2 } \
   0x158def5a, 0xf656, 0x419c, { 0xb0, 0x27, 0x7a, 0x31, 0x92, 0xc0, 0x79, 0xd2 } \
 }
 }
 
 
-extern EFI_GUID gShellVariableGuid;
+extern EFI_GUID  gShellVariableGuid;
 
 
 #endif
 #endif

+ 2 - 2
ShellPkg/Include/Library/AcpiViewCommandLib.h

@@ -21,8 +21,8 @@
 UINTN
 UINTN
 EFIAPI
 EFIAPI
 ShellDumpBufferToFile (
 ShellDumpBufferToFile (
-  IN CONST CHAR16* FileNameBuffer,
-  IN CONST VOID*   Buffer,
+  IN CONST CHAR16  *FileNameBuffer,
+  IN CONST VOID    *Buffer,
   IN CONST UINTN   BufferSize
   IN CONST UINTN   BufferSize
   );
   );
 
 

+ 0 - 1
ShellPkg/Include/Library/BcfgCommandLib.h

@@ -43,4 +43,3 @@ BcfgLibraryUnregisterBcfgCommand (
   );
   );
 
 
 #endif
 #endif
-

+ 62 - 64
ShellPkg/Include/Library/HandleParsingLib.h

@@ -26,10 +26,10 @@
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-AddNewGuidNameMapping(
-  IN CONST EFI_GUID *Guid,
-  IN CONST CHAR16   *TheName,
-  IN CONST CHAR8    *Lang OPTIONAL
+AddNewGuidNameMapping (
+  IN CONST EFI_GUID  *Guid,
+  IN CONST CHAR16    *TheName,
+  IN CONST CHAR8     *Lang OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -43,11 +43,11 @@ AddNewGuidNameMapping(
   @return                       The pointer to a string of the name.  The caller
   @return                       The pointer to a string of the name.  The caller
                                 is responsible to free this memory.
                                 is responsible to free this memory.
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
-GetStringNameFromGuid(
-  IN CONST EFI_GUID *Guid,
-  IN CONST CHAR8    *Lang OPTIONAL
+GetStringNameFromGuid (
+  IN CONST EFI_GUID  *Guid,
+  IN CONST CHAR8     *Lang OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -63,10 +63,10 @@ GetStringNameFromGuid(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-GetGuidFromStringName(
-  IN CONST CHAR16 *Name,
-  IN CONST CHAR8  *Lang OPTIONAL,
-  OUT EFI_GUID    **Guid
+GetGuidFromStringName (
+  IN CONST CHAR16  *Name,
+  IN CONST CHAR8   *Lang OPTIONAL,
+  OUT EFI_GUID     **Guid
   );
   );
 
 
 /**
 /**
@@ -85,12 +85,12 @@ GetGuidFromStringName(
   @return                   The pointer to string.
   @return                   The pointer to string.
   @retval NULL              An error was encountered.
   @retval NULL              An error was encountered.
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
-GetProtocolInformationDump(
-  IN CONST EFI_HANDLE TheHandle,
-  IN CONST EFI_GUID   *Guid,
-  IN CONST BOOLEAN    Verbose
+GetProtocolInformationDump (
+  IN CONST EFI_HANDLE  TheHandle,
+  IN CONST EFI_GUID    *Guid,
+  IN CONST BOOLEAN     Verbose
   );
   );
 
 
 /**
 /**
@@ -105,11 +105,11 @@ GetProtocolInformationDump(
   @retval NULL              The name could not be found.
   @retval NULL              The name could not be found.
   @return                   A pointer to the string name.  Do not de-allocate the memory.
   @return                   A pointer to the string name.  Do not de-allocate the memory.
 **/
 **/
-CONST CHAR16*
+CONST CHAR16 *
 EFIAPI
 EFIAPI
-GetStringNameFromHandle(
-  IN CONST EFI_HANDLE TheHandle,
-  IN CONST CHAR8      *Language
+GetStringNameFromHandle (
+  IN CONST EFI_HANDLE  TheHandle,
+  IN CONST CHAR8       *Language
   );
   );
 
 
 /**
 /**
@@ -133,19 +133,19 @@ GetBestLanguageForDriver (
   IN BOOLEAN      Iso639Language
   IN BOOLEAN      Iso639Language
   );
   );
 
 
-#define HR_UNKNOWN                     0
-#define HR_IMAGE_HANDLE                BIT1
-#define HR_DRIVER_BINDING_HANDLE       BIT2 // has driver binding
-#define HR_DEVICE_DRIVER               BIT3 // device driver (hybrid?)
-#define HR_BUS_DRIVER                  BIT4 // a bus driver  (hybrid?)
-#define HR_DRIVER_CONFIGURATION_HANDLE BIT5
-#define HR_DRIVER_DIAGNOSTICS_HANDLE   BIT6
-#define HR_COMPONENT_NAME_HANDLE       BIT7
-#define HR_DEVICE_HANDLE               BIT8
-#define HR_PARENT_HANDLE               BIT9
-#define HR_CONTROLLER_HANDLE           BIT10
-#define HR_CHILD_HANDLE                BIT11
-#define HR_VALID_MASK                  (BIT1|BIT2|BIT3|BIT4|BIT5|BIT6|BIT7|BIT8|BIT9|BIT10|BIT11)
+#define HR_UNKNOWN                      0
+#define HR_IMAGE_HANDLE                 BIT1
+#define HR_DRIVER_BINDING_HANDLE        BIT2 // has driver binding
+#define HR_DEVICE_DRIVER                BIT3 // device driver (hybrid?)
+#define HR_BUS_DRIVER                   BIT4 // a bus driver  (hybrid?)
+#define HR_DRIVER_CONFIGURATION_HANDLE  BIT5
+#define HR_DRIVER_DIAGNOSTICS_HANDLE    BIT6
+#define HR_COMPONENT_NAME_HANDLE        BIT7
+#define HR_DEVICE_HANDLE                BIT8
+#define HR_PARENT_HANDLE                BIT9
+#define HR_CONTROLLER_HANDLE            BIT10
+#define HR_CHILD_HANDLE                 BIT11
+#define HR_VALID_MASK                   (BIT1|BIT2|BIT3|BIT4|BIT5|BIT6|BIT7|BIT8|BIT9|BIT10|BIT11)
 
 
 /**
 /**
   Gets all the related EFI_HANDLEs based on the mask supplied.
   Gets all the related EFI_HANDLEs based on the mask supplied.
@@ -177,11 +177,11 @@ GetBestLanguageForDriver (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ParseHandleDatabaseByRelationship (
 ParseHandleDatabaseByRelationship (
-  IN CONST EFI_HANDLE       DriverBindingHandle OPTIONAL,
-  IN CONST EFI_HANDLE       ControllerHandle OPTIONAL,
-  IN CONST UINTN            Mask,
-  IN UINTN                  *MatchingHandleCount,
-  OUT EFI_HANDLE            **MatchingHandleBuffer OPTIONAL
+  IN CONST EFI_HANDLE  DriverBindingHandle OPTIONAL,
+  IN CONST EFI_HANDLE  ControllerHandle OPTIONAL,
+  IN CONST UINTN       Mask,
+  IN UINTN             *MatchingHandleCount,
+  OUT EFI_HANDLE       **MatchingHandleBuffer OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -213,11 +213,11 @@ ParseHandleDatabaseByRelationship (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ParseHandleDatabaseByRelationshipWithType (
 ParseHandleDatabaseByRelationshipWithType (
-  IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
-  IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
-  IN UINTN            *HandleCount,
-  OUT EFI_HANDLE      **HandleBuffer,
-  OUT UINTN           **HandleType
+  IN CONST EFI_HANDLE  DriverBindingHandle OPTIONAL,
+  IN CONST EFI_HANDLE  ControllerHandle OPTIONAL,
+  IN UINTN             *HandleCount,
+  OUT EFI_HANDLE       **HandleBuffer,
+  OUT UINTN            **HandleType
   );
   );
 
 
 /**
 /**
@@ -290,10 +290,10 @@ ParseHandleDatabaseByRelationshipWithType (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ParseHandleDatabaseForChildDevices(
-  IN CONST EFI_HANDLE       DriverHandle,
-  IN UINTN                  *MatchingHandleCount,
-  OUT EFI_HANDLE            **MatchingHandleBuffer OPTIONAL
+ParseHandleDatabaseForChildDevices (
+  IN CONST EFI_HANDLE  DriverHandle,
+  IN UINTN             *MatchingHandleCount,
+  OUT EFI_HANDLE       **MatchingHandleBuffer OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -309,13 +309,12 @@ ParseHandleDatabaseForChildDevices(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ParseHandleDatabaseForChildControllers(
-  IN CONST EFI_HANDLE       ControllerHandle,
-  OUT UINTN                 *MatchingHandleCount,
-  OUT EFI_HANDLE            **MatchingHandleBuffer OPTIONAL
+ParseHandleDatabaseForChildControllers (
+  IN CONST EFI_HANDLE  ControllerHandle,
+  OUT UINTN            *MatchingHandleCount,
+  OUT EFI_HANDLE       **MatchingHandleBuffer OPTIONAL
   );
   );
 
 
-
 /**
 /**
   Function to retrieve the human-friendly index of a given handle.  If the handle
   Function to retrieve the human-friendly index of a given handle.  If the handle
   does not have a index one will be automatically assigned.  The index value is valid
   does not have a index one will be automatically assigned.  The index value is valid
@@ -329,8 +328,8 @@ ParseHandleDatabaseForChildControllers(
 **/
 **/
 UINTN
 UINTN
 EFIAPI
 EFIAPI
-ConvertHandleToHandleIndex(
-  IN CONST EFI_HANDLE TheHandle
+ConvertHandleToHandleIndex (
+  IN CONST EFI_HANDLE  TheHandle
   );
   );
 
 
 /**
 /**
@@ -344,8 +343,8 @@ ConvertHandleToHandleIndex(
 **/
 **/
 EFI_HANDLE
 EFI_HANDLE
 EFIAPI
 EFIAPI
-ConvertHandleIndexToHandle(
-  IN CONST UINTN TheIndex
+ConvertHandleIndexToHandle (
+  IN CONST UINTN  TheIndex
   );
   );
 
 
 /**
 /**
@@ -359,10 +358,10 @@ ConvertHandleIndexToHandle(
   @retval NULL            A memory allocation failed.
   @retval NULL            A memory allocation failed.
   @return                 A NULL terminated list of handles.
   @return                 A NULL terminated list of handles.
 **/
 **/
-EFI_HANDLE*
+EFI_HANDLE *
 EFIAPI
 EFIAPI
 GetHandleListByProtocol (
 GetHandleListByProtocol (
-  IN CONST EFI_GUID *ProtocolGuid OPTIONAL
+  IN CONST EFI_GUID  *ProtocolGuid OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -376,13 +375,12 @@ GetHandleListByProtocol (
   @retval NULL              ProtocolGuids was NULL.
   @retval NULL              ProtocolGuids was NULL.
   @return                   A NULL terminated list of EFI_HANDLEs.
   @return                   A NULL terminated list of EFI_HANDLEs.
 **/
 **/
-EFI_HANDLE*
+EFI_HANDLE *
 EFIAPI
 EFIAPI
 GetHandleListByProtocolList (
 GetHandleListByProtocolList (
-  IN CONST EFI_GUID **ProtocolGuids
+  IN CONST EFI_GUID  **ProtocolGuids
   );
   );
 
 
-
 /**
 /**
   Return all supported GUIDs.
   Return all supported GUIDs.
 
 
@@ -397,8 +395,8 @@ GetHandleListByProtocolList (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 GetAllMappingGuids (
 GetAllMappingGuids (
-  OUT EFI_GUID *Guids,
-  IN OUT UINTN *Count
+  OUT EFI_GUID  *Guids,
+  IN OUT UINTN  *Count
   );
   );
 
 
 #endif // __HANDLE_PARSING_LIB__
 #endif // __HANDLE_PARSING_LIB__

+ 2 - 3
ShellPkg/Include/Library/ShellCEntryLib.h

@@ -26,9 +26,8 @@
 INTN
 INTN
 EFIAPI
 EFIAPI
 ShellAppMain (
 ShellAppMain (
-  IN UINTN Argc,
-  IN CHAR16 **Argv
+  IN UINTN   Argc,
+  IN CHAR16  **Argv
   );
   );
 
 
 #endif
 #endif
-

+ 93 - 96
ShellPkg/Include/Library/ShellCommandLib.h

@@ -26,23 +26,23 @@
 //
 //
 // The extern global protocol poionters.
 // The extern global protocol poionters.
 //
 //
-extern        EFI_UNICODE_COLLATION_PROTOCOL    *gUnicodeCollation;
-extern        CONST CHAR16*                     SupportLevel[];
+extern        EFI_UNICODE_COLLATION_PROTOCOL  *gUnicodeCollation;
+extern        CONST CHAR16                    *SupportLevel[];
 
 
 //
 //
 // The map list objects.
 // The map list objects.
 //
 //
 typedef struct {
 typedef struct {
-  LIST_ENTRY                    Link;
-  EFI_DEVICE_PATH_PROTOCOL      *DevicePath;
-  CHAR16                        *MapName;
-  CHAR16                        *CurrentDirectoryPath;
-  UINT64                         Flags;
+  LIST_ENTRY                  Link;
+  EFI_DEVICE_PATH_PROTOCOL    *DevicePath;
+  CHAR16                      *MapName;
+  CHAR16                      *CurrentDirectoryPath;
+  UINT64                      Flags;
 } SHELL_MAP_LIST;
 } SHELL_MAP_LIST;
 /// List of Mappings - DeviceName and Drive Letter(ism).
 /// List of Mappings - DeviceName and Drive Letter(ism).
-extern        SHELL_MAP_LIST                      gShellMapList;
+extern        SHELL_MAP_LIST  gShellMapList;
 /// Pointer to node of current directory in the mMapList.
 /// Pointer to node of current directory in the mMapList.
-extern        SHELL_MAP_LIST                      *gShellCurMapping;
+extern        SHELL_MAP_LIST  *gShellCurMapping;
 
 
 /**
 /**
   Returns the help MAN fileName for a given shell command.
   Returns the help MAN fileName for a given shell command.
@@ -130,14 +130,14 @@ SHELL_STATUS
 RETURN_STATUS
 RETURN_STATUS
 EFIAPI
 EFIAPI
 ShellCommandRegisterCommandName (
 ShellCommandRegisterCommandName (
-  IN CONST  CHAR16                      *CommandString,
-  IN        SHELL_RUN_COMMAND           CommandHandler,
-  IN        SHELL_GET_MAN_FILENAME      GetManFileName,
-  IN        UINT32                      ShellMinSupportLevel,
-  IN CONST  CHAR16                      *ProfileName,
-  IN CONST  BOOLEAN                     CanAffectLE,
-  IN CONST  EFI_HII_HANDLE              HiiHandle,
-  IN CONST  EFI_STRING_ID               ManFormatHelp
+  IN CONST  CHAR16                  *CommandString,
+  IN        SHELL_RUN_COMMAND       CommandHandler,
+  IN        SHELL_GET_MAN_FILENAME  GetManFileName,
+  IN        UINT32                  ShellMinSupportLevel,
+  IN CONST  CHAR16                  *ProfileName,
+  IN CONST  BOOLEAN                 CanAffectLE,
+  IN CONST  EFI_HII_HANDLE          HiiHandle,
+  IN CONST  EFI_STRING_ID           ManFormatHelp
   );
   );
 
 
 /**
 /**
@@ -167,9 +167,9 @@ ShellCommandRegisterCommandName (
 RETURN_STATUS
 RETURN_STATUS
 EFIAPI
 EFIAPI
 ShellCommandRunCommandHandler (
 ShellCommandRunCommandHandler (
-  IN CONST CHAR16               *CommandString,
-  IN OUT SHELL_STATUS           *RetVal,
-  IN OUT BOOLEAN                *CanAffectLE OPTIONAL
+  IN CONST CHAR16      *CommandString,
+  IN OUT SHELL_STATUS  *RetVal,
+  IN OUT BOOLEAN       *CanAffectLE OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -185,16 +185,15 @@ ShellCommandRunCommandHandler (
   @retval other                     The name of the MAN file.
   @retval other                     The name of the MAN file.
   @sa SHELL_GET_MAN_FILENAME
   @sa SHELL_GET_MAN_FILENAME
 **/
 **/
-CONST CHAR16*
+CONST CHAR16 *
 EFIAPI
 EFIAPI
 ShellCommandGetManFileNameHandler (
 ShellCommandGetManFileNameHandler (
-  IN CONST CHAR16               *CommandString
+  IN CONST CHAR16  *CommandString
   );
   );
 
 
-
 typedef struct {
 typedef struct {
-  LIST_ENTRY  Link;
-  CHAR16      *CommandString;
+  LIST_ENTRY    Link;
+  CHAR16        *CommandString;
 } COMMAND_LIST;
 } COMMAND_LIST;
 
 
 /**
 /**
@@ -206,16 +205,16 @@ typedef struct {
 
 
   @return A linked list of all available shell commands.
   @return A linked list of all available shell commands.
 **/
 **/
-CONST COMMAND_LIST*
+CONST COMMAND_LIST *
 EFIAPI
 EFIAPI
 ShellCommandGetCommandList (
 ShellCommandGetCommandList (
-  IN CONST BOOLEAN Sort
+  IN CONST BOOLEAN  Sort
   );
   );
 
 
 typedef struct {
 typedef struct {
-  LIST_ENTRY  Link;
-  CHAR16      *CommandString;
-  CHAR16      *Alias;
+  LIST_ENTRY    Link;
+  CHAR16        *CommandString;
+  CHAR16        *Alias;
 } ALIAS_LIST;
 } ALIAS_LIST;
 
 
 /**
 /**
@@ -234,8 +233,8 @@ typedef struct {
 RETURN_STATUS
 RETURN_STATUS
 EFIAPI
 EFIAPI
 ShellCommandRegisterAlias (
 ShellCommandRegisterAlias (
-  IN CONST CHAR16                       *Command,
-  IN CONST CHAR16                       *Alias
+  IN CONST CHAR16  *Command,
+  IN CONST CHAR16  *Alias
   );
   );
 
 
 /**
 /**
@@ -245,7 +244,7 @@ ShellCommandRegisterAlias (
 
 
   @return A linked list of all requested shell aliases.
   @return A linked list of all requested shell aliases.
 **/
 **/
-CONST ALIAS_LIST*
+CONST ALIAS_LIST *
 EFIAPI
 EFIAPI
 ShellCommandGetInitAliasList (
 ShellCommandGetInitAliasList (
   VOID
   VOID
@@ -262,7 +261,7 @@ ShellCommandGetInitAliasList (
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 ShellCommandIsOnAliasList (
 ShellCommandIsOnAliasList (
-  IN CONST CHAR16 *Alias
+  IN CONST CHAR16  *Alias
   );
   );
 
 
 /**
 /**
@@ -276,7 +275,7 @@ ShellCommandIsOnAliasList (
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 ShellCommandIsCommandOnList (
 ShellCommandIsCommandOnList (
-  IN CONST  CHAR16                      *CommandString
+  IN CONST  CHAR16  *CommandString
   );
   );
 
 
 /**
 /**
@@ -287,10 +286,10 @@ ShellCommandIsCommandOnList (
   @retval NULL  No help text was found.
   @retval NULL  No help text was found.
   @return       The string of the help text.  The caller required to free.
   @return       The string of the help text.  The caller required to free.
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
 ShellCommandGetCommandHelp (
 ShellCommandGetCommandHelp (
-  IN CONST  CHAR16                      *CommandString
+  IN CONST  CHAR16  *CommandString
   );
   );
 
 
 /**
 /**
@@ -324,11 +323,9 @@ ShellCommandGetEchoState (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ShellCommandSetEchoState (
 ShellCommandSetEchoState (
-  IN BOOLEAN State
+  IN BOOLEAN  State
   );
   );
 
 
-
-
 /**
 /**
   Indicate that the current shell or script should exit.
   Indicate that the current shell or script should exit.
 
 
@@ -338,8 +335,8 @@ ShellCommandSetEchoState (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ShellCommandRegisterExit (
 ShellCommandRegisterExit (
-  IN BOOLEAN      ScriptOnly,
-  IN CONST UINT64 ErrorCode
+  IN BOOLEAN       ScriptOnly,
+  IN CONST UINT64  ErrorCode
   );
   );
 
 
 /**
 /**
@@ -380,20 +377,20 @@ ShellCommandGetScriptExit (
   );
   );
 
 
 typedef struct {
 typedef struct {
-  LIST_ENTRY      Link;     ///< List enumerator items.
-  UINTN           Line;     ///< What line of the script file this was on.
-  CHAR16          *Cl;      ///< The original command line.
-  VOID            *Data;    ///< The data structure format dependant upon Command. (not always used)
-  BOOLEAN         Reset;    ///< Reset the command (it must be treated like a initial run (but it may have data already))
+  LIST_ENTRY    Link;       ///< List enumerator items.
+  UINTN         Line;       ///< What line of the script file this was on.
+  CHAR16        *Cl;        ///< The original command line.
+  VOID          *Data;      ///< The data structure format dependant upon Command. (not always used)
+  BOOLEAN       Reset;      ///< Reset the command (it must be treated like a initial run (but it may have data already))
 } SCRIPT_COMMAND_LIST;
 } SCRIPT_COMMAND_LIST;
 
 
 typedef struct {
 typedef struct {
-  CHAR16              *ScriptName;        ///< The filename of this script.
-  CHAR16              **Argv;             ///< The parmameters to the script file.
-  UINTN               Argc;               ///< The count of parameters.
-  LIST_ENTRY          CommandList;        ///< The script converted to a list of commands (SCRIPT_COMMAND_LIST objects).
-  SCRIPT_COMMAND_LIST *CurrentCommand;    ///< The command currently being operated.  If !=NULL must be a member of CommandList.
-  LIST_ENTRY          SubstList;          ///< A list of current script loop alias' (ALIAS_LIST objects) (Used for the for %-based replacement).
+  CHAR16                 *ScriptName;     ///< The filename of this script.
+  CHAR16                 **Argv;          ///< The parmameters to the script file.
+  UINTN                  Argc;            ///< The count of parameters.
+  LIST_ENTRY             CommandList;     ///< The script converted to a list of commands (SCRIPT_COMMAND_LIST objects).
+  SCRIPT_COMMAND_LIST    *CurrentCommand; ///< The command currently being operated.  If !=NULL must be a member of CommandList.
+  LIST_ENTRY             SubstList;       ///< A list of current script loop alias' (ALIAS_LIST objects) (Used for the for %-based replacement).
 } SCRIPT_FILE;
 } SCRIPT_FILE;
 
 
 /**
 /**
@@ -402,7 +399,7 @@ typedef struct {
   @retval NULL        A script file is not currently running.
   @retval NULL        A script file is not currently running.
   @return             A pointer to the current script file object.
   @return             A pointer to the current script file object.
 **/
 **/
-SCRIPT_FILE*
+SCRIPT_FILE *
 EFIAPI
 EFIAPI
 ShellCommandGetCurrentScriptFile (
 ShellCommandGetCurrentScriptFile (
   VOID
   VOID
@@ -419,10 +416,10 @@ ShellCommandGetCurrentScriptFile (
   @return             A pointer to the current running script file after this
   @return             A pointer to the current running script file after this
                       change.  It is NULL if removing the final script.
                       change.  It is NULL if removing the final script.
 **/
 **/
-SCRIPT_FILE*
+SCRIPT_FILE *
 EFIAPI
 EFIAPI
 ShellCommandSetNewScript (
 ShellCommandSetNewScript (
-  IN SCRIPT_FILE *Script OPTIONAL
+  IN SCRIPT_FILE  *Script OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -433,7 +430,7 @@ ShellCommandSetNewScript (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DeleteScriptFileStruct (
 DeleteScriptFileStruct (
-  IN SCRIPT_FILE *Script
+  IN SCRIPT_FILE  *Script
   );
   );
 
 
 /**
 /**
@@ -466,10 +463,10 @@ typedef enum {
   @retval NULL                  a memory allocation failed.
   @retval NULL                  a memory allocation failed.
   @return a new map name string
   @return a new map name string
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
-ShellCommandCreateNewMappingName(
-  IN CONST SHELL_MAPPING_TYPE Type
+ShellCommandCreateNewMappingName (
+  IN CONST SHELL_MAPPING_TYPE  Type
   );
   );
 
 
 /**
 /**
@@ -482,7 +479,7 @@ ShellCommandCreateNewMappingName(
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellCommandConsistMappingInitialize (
 ShellCommandConsistMappingInitialize (
-  EFI_DEVICE_PATH_PROTOCOL           ***Table
+  EFI_DEVICE_PATH_PROTOCOL  ***Table
   );
   );
 
 
 /**
 /**
@@ -497,7 +494,7 @@ ShellCommandConsistMappingInitialize (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellCommandConsistMappingUnInitialize (
 ShellCommandConsistMappingUnInitialize (
-  EFI_DEVICE_PATH_PROTOCOL      **Table
+  EFI_DEVICE_PATH_PROTOCOL  **Table
   );
   );
 
 
 /**
 /**
@@ -513,11 +510,11 @@ ShellCommandConsistMappingUnInitialize (
   @retval NULL            A consistent mapped name could not be created.
   @retval NULL            A consistent mapped name could not be created.
   @return                 A pointer to a string allocated from pool with the device name.
   @return                 A pointer to a string allocated from pool with the device name.
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
 ShellCommandConsistMappingGenMappingName (
 ShellCommandConsistMappingGenMappingName (
-  IN EFI_DEVICE_PATH_PROTOCOL      *DevicePath,
-  IN EFI_DEVICE_PATH_PROTOCOL      **Table
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
+  IN EFI_DEVICE_PATH_PROTOCOL  **Table
   );
   );
 
 
 /**
 /**
@@ -528,10 +525,10 @@ ShellCommandConsistMappingGenMappingName (
 
 
   @return the node on the list.
   @return the node on the list.
 **/
 **/
-SHELL_MAP_LIST*
+SHELL_MAP_LIST *
 EFIAPI
 EFIAPI
 ShellCommandFindMapItem (
 ShellCommandFindMapItem (
-  IN CONST CHAR16               *MapKey
+  IN CONST CHAR16  *MapKey
   );
   );
 
 
 /**
 /**
@@ -553,11 +550,11 @@ ShellCommandFindMapItem (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellCommandAddMapItemAndUpdatePath(
-  IN CONST CHAR16                   *Name,
-  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
-  IN CONST UINT64                   Flags,
-  IN CONST BOOLEAN                  Path
+ShellCommandAddMapItemAndUpdatePath (
+  IN CONST CHAR16                    *Name,
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
+  IN CONST UINT64                    Flags,
+  IN CONST BOOLEAN                   Path
   );
   );
 
 
 /**
 /**
@@ -574,7 +571,7 @@ ShellCommandAddMapItemAndUpdatePath(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellCommandCreateInitialMappingsAndPaths(
+ShellCommandCreateInitialMappingsAndPaths (
   VOID
   VOID
   );
   );
 
 
@@ -596,10 +593,10 @@ ShellCommandUpdateMapping (
 
 
   @return a EFI_FILE_PROTOCOL* representing the same file.
   @return a EFI_FILE_PROTOCOL* representing the same file.
 **/
 **/
-EFI_FILE_PROTOCOL*
+EFI_FILE_PROTOCOL *
 EFIAPI
 EFIAPI
-ConvertShellHandleToEfiFileProtocol(
-  IN CONST SHELL_FILE_HANDLE Handle
+ConvertShellHandleToEfiFileProtocol (
+  IN CONST SHELL_FILE_HANDLE  Handle
   );
   );
 
 
 /**
 /**
@@ -612,8 +609,8 @@ ConvertShellHandleToEfiFileProtocol(
 **/
 **/
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
-ShellFileHandleRemove(
-  IN CONST SHELL_FILE_HANDLE Handle
+ShellFileHandleRemove (
+  IN CONST SHELL_FILE_HANDLE  Handle
   );
   );
 
 
 /**
 /**
@@ -626,9 +623,9 @@ ShellFileHandleRemove(
 **/
 **/
 SHELL_FILE_HANDLE
 SHELL_FILE_HANDLE
 EFIAPI
 EFIAPI
-ConvertEfiFileProtocolToShellHandle(
-  IN CONST EFI_FILE_PROTOCOL *Handle,
-  IN CONST CHAR16            *Path
+ConvertEfiFileProtocolToShellHandle (
+  IN CONST EFI_FILE_PROTOCOL  *Handle,
+  IN CONST CHAR16             *Path
   );
   );
 
 
 /**
 /**
@@ -638,13 +635,12 @@ ConvertEfiFileProtocolToShellHandle(
 
 
   @return A pointer to the path for the file.
   @return A pointer to the path for the file.
 **/
 **/
-CONST CHAR16*
+CONST CHAR16 *
 EFIAPI
 EFIAPI
-ShellFileHandleGetPath(
-  IN CONST SHELL_FILE_HANDLE Handle
+ShellFileHandleGetPath (
+  IN CONST SHELL_FILE_HANDLE  Handle
   );
   );
 
 
-
 /**
 /**
   Function to determine if a SHELL_FILE_HANDLE is at the end of the file.
   Function to determine if a SHELL_FILE_HANDLE is at the end of the file.
 
 
@@ -659,8 +655,8 @@ ShellFileHandleGetPath(
 **/
 **/
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
-ShellFileHandleEof(
-  IN SHELL_FILE_HANDLE Handle
+ShellFileHandleEof (
+  IN SHELL_FILE_HANDLE  Handle
   );
   );
 
 
 typedef struct {
 typedef struct {
@@ -676,7 +672,7 @@ typedef struct {
 VOID
 VOID
 EFIAPI
 EFIAPI
 FreeBufferList (
 FreeBufferList (
-  IN BUFFER_LIST *List
+  IN BUFFER_LIST  *List
   );
   );
 
 
 /**
 /**
@@ -690,10 +686,10 @@ FreeBufferList (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpHex (
 DumpHex (
-  IN UINTN        Indent,
-  IN UINTN        Offset,
-  IN UINTN        DataSize,
-  IN VOID         *UserData
+  IN UINTN  Indent,
+  IN UINTN  Offset,
+  IN UINTN  DataSize,
+  IN VOID   *UserData
   );
   );
 
 
 /**
 /**
@@ -705,7 +701,7 @@ DumpHex (
   @param[in] DataSize   The size in bytes of UserData.
   @param[in] DataSize   The size in bytes of UserData.
   @param[in] UserData   The data to print out.
   @param[in] UserData   The data to print out.
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
 CatSDumpHex (
 CatSDumpHex (
   IN CHAR16  *Buffer,
   IN CHAR16  *Buffer,
@@ -791,8 +787,9 @@ typedef enum {
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellSortFileList (
 ShellSortFileList (
-  IN OUT EFI_SHELL_FILE_INFO  **FileList,
-     OUT EFI_SHELL_FILE_INFO  **Duplicates OPTIONAL,
-  IN     SHELL_SORT_FILE_LIST Order
+  IN OUT EFI_SHELL_FILE_INFO   **FileList,
+  OUT EFI_SHELL_FILE_INFO      **Duplicates OPTIONAL,
+  IN     SHELL_SORT_FILE_LIST  Order
   );
   );
+
 #endif //_SHELL_COMMAND_LIB_
 #endif //_SHELL_COMMAND_LIB_

+ 149 - 150
ShellPkg/Include/Library/ShellLib.h

@@ -27,8 +27,8 @@
     }                                 \
     }                                 \
   } while(FALSE)
   } while(FALSE)
 
 
-extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
-extern EFI_SHELL_PROTOCOL            *gEfiShellProtocol;
+extern EFI_SHELL_PARAMETERS_PROTOCOL  *gEfiShellParametersProtocol;
+extern EFI_SHELL_PROTOCOL             *gEfiShellProtocol;
 
 
 /**
 /**
   Return a clean, fully-qualified version of an input path.  If the return value
   Return a clean, fully-qualified version of an input path.  If the return value
@@ -58,10 +58,10 @@ extern EFI_SHELL_PROTOCOL            *gEfiShellProtocol;
                         Path.  The caller must free this memory when it is no
                         Path.  The caller must free this memory when it is no
                         longer needed.
                         longer needed.
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
-FullyQualifyPath(
-  IN     CONST CHAR16     *Path
+FullyQualifyPath (
+  IN     CONST CHAR16  *Path
   );
   );
 
 
 /**
 /**
@@ -78,10 +78,10 @@ FullyQualifyPath(
 
 
   @return                       The information about the file.
   @return                       The information about the file.
 **/
 **/
-EFI_FILE_INFO*
+EFI_FILE_INFO *
 EFIAPI
 EFIAPI
 ShellGetFileInfo (
 ShellGetFileInfo (
-  IN SHELL_FILE_HANDLE          FileHandle
+  IN SHELL_FILE_HANDLE  FileHandle
   );
   );
 
 
 /**
 /**
@@ -106,8 +106,8 @@ ShellGetFileInfo (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellSetFileInfo (
 ShellSetFileInfo (
-  IN SHELL_FILE_HANDLE          FileHandle,
-  IN EFI_FILE_INFO              *FileInfo
+  IN SHELL_FILE_HANDLE  FileHandle,
+  IN EFI_FILE_INFO      *FileInfo
   );
   );
 
 
 /**
 /**
@@ -141,11 +141,11 @@ ShellSetFileInfo (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellOpenFileByDevicePath(
-  IN OUT EFI_DEVICE_PATH_PROTOCOL     **FilePath,
-  OUT SHELL_FILE_HANDLE               *FileHandle,
-  IN UINT64                           OpenMode,
-  IN UINT64                           Attributes
+ShellOpenFileByDevicePath (
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  **FilePath,
+  OUT SHELL_FILE_HANDLE            *FileHandle,
+  IN UINT64                        OpenMode,
+  IN UINT64                        Attributes
   );
   );
 
 
 /**
 /**
@@ -179,11 +179,11 @@ ShellOpenFileByDevicePath(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellOpenFileByName(
-  IN CONST CHAR16               *FileName,
-  OUT SHELL_FILE_HANDLE         *FileHandle,
-  IN UINT64                     OpenMode,
-  IN UINT64                     Attributes
+ShellOpenFileByName (
+  IN CONST CHAR16        *FileName,
+  OUT SHELL_FILE_HANDLE  *FileHandle,
+  IN UINT64              OpenMode,
+  IN UINT64              Attributes
   );
   );
 
 
 /**
 /**
@@ -215,9 +215,9 @@ ShellOpenFileByName(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellCreateDirectory(
-  IN CONST CHAR16             *DirectoryName,
-  OUT SHELL_FILE_HANDLE       *FileHandle
+ShellCreateDirectory (
+  IN CONST CHAR16        *DirectoryName,
+  OUT SHELL_FILE_HANDLE  *FileHandle
   );
   );
 
 
 /**
 /**
@@ -251,10 +251,10 @@ ShellCreateDirectory(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellReadFile(
-  IN SHELL_FILE_HANDLE          FileHandle,
-  IN OUT UINTN                  *ReadSize,
-  OUT VOID                      *Buffer
+ShellReadFile (
+  IN SHELL_FILE_HANDLE  FileHandle,
+  IN OUT UINTN          *ReadSize,
+  OUT VOID              *Buffer
   );
   );
 
 
 /**
 /**
@@ -285,10 +285,10 @@ ShellReadFile(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellWriteFile(
-  IN SHELL_FILE_HANDLE          FileHandle,
-  IN OUT UINTN                  *BufferSize,
-  IN VOID                       *Buffer
+ShellWriteFile (
+  IN SHELL_FILE_HANDLE  FileHandle,
+  IN OUT UINTN          *BufferSize,
+  IN VOID               *Buffer
   );
   );
 
 
 /**
 /**
@@ -306,7 +306,7 @@ ShellWriteFile(
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellCloseFile (
 ShellCloseFile (
-  IN SHELL_FILE_HANDLE          *FileHandle
+  IN SHELL_FILE_HANDLE  *FileHandle
   );
   );
 
 
 /**
 /**
@@ -326,7 +326,7 @@ ShellCloseFile (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellDeleteFile (
 ShellDeleteFile (
-  IN SHELL_FILE_HANDLE          *FileHandle
+  IN SHELL_FILE_HANDLE  *FileHandle
   );
   );
 
 
 /**
 /**
@@ -374,8 +374,8 @@ ShellSetFilePosition (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellGetFilePosition (
 ShellGetFilePosition (
-  IN SHELL_FILE_HANDLE          FileHandle,
-  OUT UINT64                    *Position
+  IN SHELL_FILE_HANDLE  FileHandle,
+  OUT UINT64            *Position
   );
   );
 
 
 /**
 /**
@@ -395,7 +395,7 @@ ShellGetFilePosition (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellFlushFile (
 ShellFlushFile (
-  IN SHELL_FILE_HANDLE          FileHandle
+  IN SHELL_FILE_HANDLE  FileHandle
   );
   );
 
 
 /** Retrieve first entry from a directory.
 /** Retrieve first entry from a directory.
@@ -425,8 +425,8 @@ ShellFlushFile (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellFindFirstFile (
 ShellFindFirstFile (
-  IN      SHELL_FILE_HANDLE       DirHandle,
-     OUT  EFI_FILE_INFO         **Buffer
+  IN      SHELL_FILE_HANDLE  DirHandle,
+  OUT  EFI_FILE_INFO         **Buffer
   );
   );
 
 
 /** Retrieve next entries from a directory.
 /** Retrieve next entries from a directory.
@@ -451,10 +451,10 @@ ShellFindFirstFile (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellFindNextFile(
-  IN      SHELL_FILE_HANDLE       DirHandle,
-  IN OUT  EFI_FILE_INFO          *Buffer,
-  IN OUT  BOOLEAN                *NoFile
+ShellFindNextFile (
+  IN      SHELL_FILE_HANDLE  DirHandle,
+  IN OUT  EFI_FILE_INFO      *Buffer,
+  IN OUT  BOOLEAN            *NoFile
   );
   );
 
 
 /**
 /**
@@ -472,8 +472,8 @@ ShellFindNextFile(
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellGetFileSize (
 ShellGetFileSize (
-  IN SHELL_FILE_HANDLE          FileHandle,
-  OUT UINT64                    *Size
+  IN SHELL_FILE_HANDLE  FileHandle,
+  OUT UINT64            *Size
   );
   );
 
 
 /**
 /**
@@ -486,7 +486,7 @@ ShellGetFileSize (
 **/
 **/
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
-ShellGetExecutionBreakFlag(
+ShellGetExecutionBreakFlag (
   VOID
   VOID
   );
   );
 
 
@@ -501,10 +501,10 @@ ShellGetExecutionBreakFlag(
   @retval NULL                  The named environment variable does not exist.
   @retval NULL                  The named environment variable does not exist.
   @return != NULL               The pointer to the value of the environment variable.
   @return != NULL               The pointer to the value of the environment variable.
 **/
 **/
-CONST CHAR16*
+CONST CHAR16 *
 EFIAPI
 EFIAPI
 ShellGetEnvironmentVariable (
 ShellGetEnvironmentVariable (
-  IN CONST CHAR16                *EnvKey
+  IN CONST CHAR16  *EnvKey
   );
   );
 
 
 /**
 /**
@@ -530,9 +530,9 @@ ShellGetEnvironmentVariable (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellSetEnvironmentVariable (
 ShellSetEnvironmentVariable (
-  IN CONST CHAR16               *EnvKey,
-  IN CONST CHAR16               *EnvVal,
-  IN BOOLEAN                    Volatile
+  IN CONST CHAR16  *EnvKey,
+  IN CONST CHAR16  *EnvVal,
+  IN BOOLEAN       Volatile
   );
   );
 
 
 /**
 /**
@@ -568,11 +568,11 @@ ShellSetEnvironmentVariable (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellExecute (
 ShellExecute (
-  IN EFI_HANDLE                 *ParentHandle,
-  IN CHAR16                     *CommandLine,
-  IN BOOLEAN                    Output,
-  IN CHAR16                     **EnvironmentVariables,
-  OUT EFI_STATUS                *Status
+  IN EFI_HANDLE   *ParentHandle,
+  IN CHAR16       *CommandLine,
+  IN BOOLEAN      Output,
+  IN CHAR16       **EnvironmentVariables,
+  OUT EFI_STATUS  *Status
   );
   );
 
 
 /**
 /**
@@ -589,10 +589,10 @@ ShellExecute (
   @retval NULL                  The directory does not exist.
   @retval NULL                  The directory does not exist.
   @retval != NULL               The directory.
   @retval != NULL               The directory.
 **/
 **/
-CONST CHAR16*
+CONST CHAR16 *
 EFIAPI
 EFIAPI
 ShellGetCurrentDir (
 ShellGetCurrentDir (
-  IN CHAR16                     * CONST DeviceName OPTIONAL
+  IN CHAR16                     *CONST  DeviceName OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -606,7 +606,7 @@ ShellGetCurrentDir (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ShellSetPageBreakMode (
 ShellSetPageBreakMode (
-  IN BOOLEAN                    CurrentState
+  IN BOOLEAN  CurrentState
   );
   );
 
 
 /**
 /**
@@ -635,9 +635,9 @@ ShellSetPageBreakMode (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellOpenFileMetaArg (
 ShellOpenFileMetaArg (
-  IN CHAR16                     *Arg,
-  IN UINT64                     OpenMode,
-  IN OUT EFI_SHELL_FILE_INFO    **ListHead
+  IN CHAR16                   *Arg,
+  IN UINT64                   OpenMode,
+  IN OUT EFI_SHELL_FILE_INFO  **ListHead
   );
   );
 
 
 /**
 /**
@@ -651,7 +651,7 @@ ShellOpenFileMetaArg (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellCloseFileMetaArg (
 ShellCloseFileMetaArg (
-  IN OUT EFI_SHELL_FILE_INFO    **ListHead
+  IN OUT EFI_SHELL_FILE_INFO  **ListHead
   );
   );
 
 
 /**
 /**
@@ -669,7 +669,7 @@ ShellCloseFileMetaArg (
 CHAR16 *
 CHAR16 *
 EFIAPI
 EFIAPI
 ShellFindFilePath (
 ShellFindFilePath (
-  IN CONST CHAR16 *FileName
+  IN CONST CHAR16  *FileName
   );
   );
 
 
 /**
 /**
@@ -691,12 +691,12 @@ ShellFindFilePath (
 CHAR16 *
 CHAR16 *
 EFIAPI
 EFIAPI
 ShellFindFilePathEx (
 ShellFindFilePathEx (
-  IN CONST CHAR16 *FileName,
-  IN CONST CHAR16 *FileExtension
+  IN CONST CHAR16  *FileName,
+  IN CONST CHAR16  *FileExtension
   );
   );
 
 
 typedef enum {
 typedef enum {
-  TypeFlag  = 0,    ///< A flag that is present or not present only (IE "-a").
+  TypeFlag = 0,     ///< A flag that is present or not present only (IE "-a").
   TypeValue,        ///< A flag that has some data following it with a space (IE "-a 1").
   TypeValue,        ///< A flag that has some data following it with a space (IE "-a 1").
   TypePosition,     ///< Some data that did not follow a parameter (IE "filename.txt").
   TypePosition,     ///< Some data that did not follow a parameter (IE "filename.txt").
   TypeStart,        ///< A flag that has variable value appended to the end (IE "-ad", "-afd", "-adf", etc...).
   TypeStart,        ///< A flag that has variable value appended to the end (IE "-ad", "-afd", "-adf", etc...).
@@ -707,16 +707,15 @@ typedef enum {
 } SHELL_PARAM_TYPE;
 } SHELL_PARAM_TYPE;
 
 
 typedef struct {
 typedef struct {
-  CHAR16             *Name;
-  SHELL_PARAM_TYPE   Type;
+  CHAR16              *Name;
+  SHELL_PARAM_TYPE    Type;
 } SHELL_PARAM_ITEM;
 } SHELL_PARAM_ITEM;
 
 
-
 /// Helper structure for no parameters (besides -? and -b)
 /// Helper structure for no parameters (besides -? and -b)
-extern SHELL_PARAM_ITEM EmptyParamList[];
+extern SHELL_PARAM_ITEM  EmptyParamList[];
 
 
 /// Helper structure for -sfo only (besides -? and -b)
 /// Helper structure for -sfo only (besides -? and -b)
-extern SHELL_PARAM_ITEM SfoParamList[];
+extern SHELL_PARAM_ITEM  SfoParamList[];
 
 
 /**
 /**
   Checks the command line arguments passed against the list of valid ones.
   Checks the command line arguments passed against the list of valid ones.
@@ -745,15 +744,15 @@ extern SHELL_PARAM_ITEM SfoParamList[];
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellCommandLineParseEx (
 ShellCommandLineParseEx (
-  IN CONST SHELL_PARAM_ITEM     *CheckList,
-  OUT LIST_ENTRY                **CheckPackage,
-  OUT CHAR16                    **ProblemParam OPTIONAL,
-  IN BOOLEAN                    AutoPageBreak,
-  IN BOOLEAN                    AlwaysAllowNumbers
+  IN CONST SHELL_PARAM_ITEM  *CheckList,
+  OUT LIST_ENTRY             **CheckPackage,
+  OUT CHAR16                 **ProblemParam OPTIONAL,
+  IN BOOLEAN                 AutoPageBreak,
+  IN BOOLEAN                 AlwaysAllowNumbers
   );
   );
 
 
 /// Make it easy to upgrade from older versions of the shell library.
 /// Make it easy to upgrade from older versions of the shell library.
-#define ShellCommandLineParse(CheckList,CheckPackage,ProblemParam,AutoPageBreak) ShellCommandLineParseEx(CheckList,CheckPackage,ProblemParam,AutoPageBreak,FALSE)
+#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)  ShellCommandLineParseEx(CheckList,CheckPackage,ProblemParam,AutoPageBreak,FALSE)
 
 
 /**
 /**
   Frees shell variable list that was returned from ShellCommandLineParse.
   Frees shell variable list that was returned from ShellCommandLineParse.
@@ -768,7 +767,7 @@ ShellCommandLineParseEx (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ShellCommandLineFreeVarList (
 ShellCommandLineFreeVarList (
-  IN LIST_ENTRY                 *CheckPackage
+  IN LIST_ENTRY  *CheckPackage
   );
   );
 
 
 /**
 /**
@@ -788,8 +787,8 @@ ShellCommandLineFreeVarList (
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 ShellCommandLineGetFlag (
 ShellCommandLineGetFlag (
-  IN CONST LIST_ENTRY         * CONST CheckPackage,
-  IN CONST CHAR16             * CONST KeyString
+  IN CONST LIST_ENTRY         *CONST  CheckPackage,
+  IN CONST CHAR16             *CONST  KeyString
   );
   );
 
 
 /**
 /**
@@ -805,11 +804,11 @@ ShellCommandLineGetFlag (
   @retval NULL                  The flag is not on the command line.
   @retval NULL                  The flag is not on the command line.
   @retval !=NULL                The pointer to unicode string of the value.
   @retval !=NULL                The pointer to unicode string of the value.
 **/
 **/
-CONST CHAR16*
+CONST CHAR16 *
 EFIAPI
 EFIAPI
 ShellCommandLineGetValue (
 ShellCommandLineGetValue (
-  IN CONST LIST_ENTRY              *CheckPackage,
-  IN CHAR16                        *KeyString
+  IN CONST LIST_ENTRY  *CheckPackage,
+  IN CHAR16            *KeyString
   );
   );
 
 
 /**
 /**
@@ -825,11 +824,11 @@ ShellCommandLineGetValue (
   @retval NULL                  The flag is not on the command line.
   @retval NULL                  The flag is not on the command line.
   @retval !=NULL                The pointer to unicode string of the value.
   @retval !=NULL                The pointer to unicode string of the value.
 **/
 **/
-CONST CHAR16*
+CONST CHAR16 *
 EFIAPI
 EFIAPI
 ShellCommandLineGetRawValue (
 ShellCommandLineGetRawValue (
-  IN CONST LIST_ENTRY              * CONST CheckPackage,
-  IN UINTN                         Position
+  IN CONST LIST_ENTRY              *CONST  CheckPackage,
+  IN UINTN                                 Position
   );
   );
 
 
 /**
 /**
@@ -844,8 +843,8 @@ ShellCommandLineGetRawValue (
 **/
 **/
 UINTN
 UINTN
 EFIAPI
 EFIAPI
-ShellCommandLineGetCount(
-  IN CONST LIST_ENTRY              *CheckPackage
+ShellCommandLineGetCount (
+  IN CONST LIST_ENTRY  *CheckPackage
   );
   );
 
 
 /**
 /**
@@ -865,8 +864,8 @@ ShellCommandLineGetCount(
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellCommandLineCheckDuplicate (
 ShellCommandLineCheckDuplicate (
-  IN CONST LIST_ENTRY              *CheckPackage,
-  OUT CHAR16                       **Param
+  IN CONST LIST_ENTRY  *CheckPackage,
+  OUT CHAR16           **Param
   );
   );
 
 
 /**
 /**
@@ -919,10 +918,10 @@ ShellInitialize (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellPrintEx(
-  IN INT32                Col OPTIONAL,
-  IN INT32                Row OPTIONAL,
-  IN CONST CHAR16         *Format,
+ShellPrintEx (
+  IN INT32         Col OPTIONAL,
+  IN INT32         Row OPTIONAL,
+  IN CONST CHAR16  *Format,
   ...
   ...
   );
   );
 
 
@@ -960,12 +959,12 @@ ShellPrintEx(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellPrintHiiEx(
-  IN INT32                Col OPTIONAL,
-  IN INT32                Row OPTIONAL,
-  IN CONST CHAR8          *Language OPTIONAL,
-  IN CONST EFI_STRING_ID  HiiFormatStringId,
-  IN CONST EFI_HII_HANDLE HiiFormatHandle,
+ShellPrintHiiEx (
+  IN INT32                 Col OPTIONAL,
+  IN INT32                 Row OPTIONAL,
+  IN CONST CHAR8           *Language OPTIONAL,
+  IN CONST EFI_STRING_ID   HiiFormatStringId,
+  IN CONST EFI_HII_HANDLE  HiiFormatHandle,
   ...
   ...
   );
   );
 
 
@@ -982,8 +981,8 @@ ShellPrintHiiEx(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellIsDirectory(
-  IN CONST CHAR16 *DirName
+ShellIsDirectory (
+  IN CONST CHAR16  *DirName
   );
   );
 
 
 /**
 /**
@@ -1001,8 +1000,8 @@ ShellIsDirectory(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellIsFile(
-  IN CONST CHAR16 *Name
+ShellIsFile (
+  IN CONST CHAR16  *Name
   );
   );
 
 
 /**
 /**
@@ -1020,8 +1019,8 @@ ShellIsFile(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellIsFileInPath(
-  IN CONST CHAR16 *Name
+ShellIsFileInPath (
+  IN CONST CHAR16  *Name
   );
   );
 
 
 /**
 /**
@@ -1038,8 +1037,8 @@ ShellIsFileInPath(
 **/
 **/
 UINTN
 UINTN
 EFIAPI
 EFIAPI
-ShellStrToUintn(
-  IN CONST CHAR16 *String
+ShellStrToUintn (
+  IN CONST CHAR16  *String
   );
   );
 
 
 /**
 /**
@@ -1055,8 +1054,8 @@ ShellStrToUintn(
 **/
 **/
 UINTN
 UINTN
 EFIAPI
 EFIAPI
-ShellHexStrToUintn(
-  IN CONST CHAR16 *String
+ShellHexStrToUintn (
+  IN CONST CHAR16  *String
   );
   );
 
 
 /**
 /**
@@ -1091,13 +1090,13 @@ ShellHexStrToUintn(
 
 
   @return                       The Destination after appending the Source.
   @return                       The Destination after appending the Source.
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
 StrnCatGrow (
 StrnCatGrow (
-  IN OUT CHAR16           **Destination,
-  IN OUT UINTN            *CurrentSize,
-  IN     CONST CHAR16     *Source,
-  IN     UINTN            Count
+  IN OUT CHAR16        **Destination,
+  IN OUT UINTN         *CurrentSize,
+  IN     CONST CHAR16  *Source,
+  IN     UINTN         Count
   );
   );
 
 
 /**
 /**
@@ -1129,14 +1128,14 @@ StrnCatGrow (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellCopySearchAndReplace(
-  IN CHAR16 CONST                     *SourceString,
-  IN OUT CHAR16                       *NewString,
-  IN UINTN                            NewSize,
-  IN CONST CHAR16                     *FindTarget,
-  IN CONST CHAR16                     *ReplaceWith,
-  IN CONST BOOLEAN                    SkipPreCarrot,
-  IN CONST BOOLEAN                    ParameterReplacing
+ShellCopySearchAndReplace (
+  IN CHAR16 CONST   *SourceString,
+  IN OUT CHAR16     *NewString,
+  IN UINTN          NewSize,
+  IN CONST CHAR16   *FindTarget,
+  IN CONST CHAR16   *ReplaceWith,
+  IN CONST BOOLEAN  SkipPreCarrot,
+  IN CONST BOOLEAN  ParameterReplacing
   );
   );
 
 
 /**
 /**
@@ -1156,7 +1155,7 @@ ShellCopySearchAndReplace(
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 ShellIsHexaDecimalDigitCharacter (
 ShellIsHexaDecimalDigitCharacter (
-  IN      CHAR16                    Char
+  IN      CHAR16  Char
   );
   );
 
 
 /**
 /**
@@ -1176,7 +1175,7 @@ ShellIsHexaDecimalDigitCharacter (
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 ShellIsDecimalDigitCharacter (
 ShellIsDecimalDigitCharacter (
-  IN      CHAR16                    Char
+  IN      CHAR16  Char
   );
   );
 
 
 ///
 ///
@@ -1233,9 +1232,9 @@ typedef enum {
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellPromptForResponse (
 ShellPromptForResponse (
-  IN SHELL_PROMPT_REQUEST_TYPE   Type,
-  IN CHAR16         *Prompt OPTIONAL,
-  IN OUT VOID       **Response OPTIONAL
+  IN SHELL_PROMPT_REQUEST_TYPE  Type,
+  IN CHAR16                     *Prompt OPTIONAL,
+  IN OUT VOID                   **Response OPTIONAL
   );
   );
 
 
 /**
 /**
@@ -1258,10 +1257,10 @@ ShellPromptForResponse (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellPromptForResponseHii (
 ShellPromptForResponseHii (
-  IN SHELL_PROMPT_REQUEST_TYPE         Type,
-  IN CONST EFI_STRING_ID  HiiFormatStringId,
-  IN CONST EFI_HII_HANDLE HiiFormatHandle,
-  IN OUT VOID             **Response
+  IN SHELL_PROMPT_REQUEST_TYPE  Type,
+  IN CONST EFI_STRING_ID        HiiFormatStringId,
+  IN CONST EFI_HII_HANDLE       HiiFormatHandle,
+  IN OUT VOID                   **Response
   );
   );
 
 
 /**
 /**
@@ -1301,9 +1300,9 @@ ShellIsHexOrDecimalNumber (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellConvertStringToUint64(
+ShellConvertStringToUint64 (
   IN CONST CHAR16   *String,
   IN CONST CHAR16   *String,
-     OUT   UINT64   *Value,
+  OUT   UINT64      *Value,
   IN CONST BOOLEAN  ForceHex,
   IN CONST BOOLEAN  ForceHex,
   IN CONST BOOLEAN  StopAtSpace
   IN CONST BOOLEAN  StopAtSpace
   );
   );
@@ -1319,8 +1318,8 @@ ShellConvertStringToUint64(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellFileExists(
-  IN CONST CHAR16 *Name
+ShellFileExists (
+  IN CONST CHAR16  *Name
   );
   );
 
 
 /**
 /**
@@ -1338,11 +1337,11 @@ ShellFileExists(
 
 
   @sa ShellFileHandleReadLine
   @sa ShellFileHandleReadLine
 **/
 **/
-CHAR16*
+CHAR16 *
 EFIAPI
 EFIAPI
-ShellFileHandleReturnLine(
-  IN SHELL_FILE_HANDLE            Handle,
-  IN OUT BOOLEAN                *Ascii
+ShellFileHandleReturnLine (
+  IN SHELL_FILE_HANDLE  Handle,
+  IN OUT BOOLEAN        *Ascii
   );
   );
 
 
 /**
 /**
@@ -1373,12 +1372,12 @@ ShellFileHandleReturnLine(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellFileHandleReadLine(
-  IN SHELL_FILE_HANDLE          Handle,
-  IN OUT CHAR16                 *Buffer,
-  IN OUT UINTN                  *Size,
-  IN BOOLEAN                    Truncate,
-  IN OUT BOOLEAN                *Ascii
+ShellFileHandleReadLine (
+  IN SHELL_FILE_HANDLE  Handle,
+  IN OUT CHAR16         *Buffer,
+  IN OUT UINTN          *Size,
+  IN BOOLEAN            Truncate,
+  IN OUT BOOLEAN        *Ascii
   );
   );
 
 
 /**
 /**
@@ -1406,8 +1405,8 @@ ShellFileHandleReadLine(
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
-ShellDeleteFileByName(
-  IN CONST CHAR16               *FileName
+ShellDeleteFileByName (
+  IN CONST CHAR16  *FileName
   );
   );
 
 
 /**
 /**
@@ -1424,9 +1423,9 @@ ShellDeleteFileByName(
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ShellPrintHelp (
 ShellPrintHelp (
-  IN CONST CHAR16     *CommandToGetHelpOn,
-  IN CONST CHAR16     *SectionToGetHelpOn,
-  IN BOOLEAN          PrintCommandText
+  IN CONST CHAR16  *CommandToGetHelpOn,
+  IN CONST CHAR16  *SectionToGetHelpOn,
+  IN BOOLEAN       PrintCommandText
   );
   );
 
 
 #endif // __SHELL_LIB__
 #endif // __SHELL_LIB__

+ 127 - 128
ShellPkg/Include/Protocol/EfiShellEnvironment2.h

@@ -6,12 +6,11 @@
 
 
 **/
 **/
 
 
-
 #ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_
 #ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_
 #define _SHELL_ENVIRONMENT_2_PROTOCOL_H_
 #define _SHELL_ENVIRONMENT_2_PROTOCOL_H_
 
 
-#define DEFAULT_INIT_ROW    1
-#define DEFAULT_AUTO_LF     FALSE
+#define DEFAULT_INIT_ROW  1
+#define DEFAULT_AUTO_LF   FALSE
 
 
 /**
 /**
   This function is a prototype for a function that dumps information on a protocol
   This function is a prototype for a function that dumps information on a protocol
@@ -24,7 +23,7 @@
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_DUMP_PROTOCOL_INFO) (
+(EFIAPI *SHELLENV_DUMP_PROTOCOL_INFO)(
   IN EFI_HANDLE                   Handle,
   IN EFI_HANDLE                   Handle,
   IN VOID                         *Interface
   IN VOID                         *Interface
   );
   );
@@ -45,7 +44,7 @@ VOID
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_INTERNAL_COMMAND) (
+(EFIAPI *SHELLENV_INTERNAL_COMMAND)(
   IN EFI_HANDLE                   ImageHandle,
   IN EFI_HANDLE                   ImageHandle,
   IN EFI_SYSTEM_TABLE             *SystemTable
   IN EFI_SYSTEM_TABLE             *SystemTable
   );
   );
@@ -62,7 +61,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLCMD_GET_LINE_HELP) (
+(EFIAPI *SHELLCMD_GET_LINE_HELP)(
   IN OUT CHAR16                 **Str
   IN OUT CHAR16                 **Str
   );
   );
 
 
@@ -70,20 +69,20 @@ EFI_STATUS
 Structure returned from functions that open multiple files.
 Structure returned from functions that open multiple files.
 **/
 **/
 typedef struct {
 typedef struct {
-  UINT32                    Signature;            ///< SHELL_FILE_ARG_SIGNATURE.
-  LIST_ENTRY                Link;                 ///< Linked list helper.
-  EFI_STATUS                Status;               ///< File's status.
+  UINT32                      Signature;          ///< SHELL_FILE_ARG_SIGNATURE.
+  LIST_ENTRY                  Link;               ///< Linked list helper.
+  EFI_STATUS                  Status;             ///< File's status.
 
 
-  EFI_FILE_HANDLE           Parent;               ///< What is the Parent file of this file.
-  UINT64                    OpenMode;             ///< How was the file opened.
-  CHAR16                    *ParentName;          ///< String representation of parent.
-  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;    ///< DevicePath for Parent.
+  EFI_FILE_HANDLE             Parent;             ///< What is the Parent file of this file.
+  UINT64                      OpenMode;           ///< How was the file opened.
+  CHAR16                      *ParentName;        ///< String representation of parent.
+  EFI_DEVICE_PATH_PROTOCOL    *ParentDevicePath;  ///< DevicePath for Parent.
 
 
-  CHAR16                    *FullName;            ///< Path and file name for this file.
-  CHAR16                    *FileName;            ///< File name for this file.
+  CHAR16                      *FullName;          ///< Path and file name for this file.
+  CHAR16                      *FileName;          ///< File name for this file.
 
 
-  EFI_FILE_HANDLE           Handle;               ///< Handle to this file.
-  EFI_FILE_INFO             *Info;                ///< Pointer to file info for this file.
+  EFI_FILE_HANDLE             Handle;             ///< Handle to this file.
+  EFI_FILE_INFO               *Info;              ///< Pointer to file info for this file.
 } SHELL_FILE_ARG;
 } SHELL_FILE_ARG;
 
 
 /// Signature for SHELL_FILE_ARG.
 /// Signature for SHELL_FILE_ARG.
@@ -105,8 +104,8 @@ GUID for the shell environment2 extension (main GUID above).
     0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
     0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
   }
   }
 
 
-#define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2.
-#define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2.
+#define EFI_SHELL_MAJOR_VER  0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2.
+#define EFI_SHELL_MINOR_VER  0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2.
 
 
 /**
 /**
   Execute a command line.
   Execute a command line.
@@ -129,7 +128,7 @@ GUID for the shell environment2 extension (main GUID above).
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_EXECUTE) (
+(EFIAPI *SHELLENV_EXECUTE)(
   IN EFI_HANDLE   *ParentImageHandle,
   IN EFI_HANDLE   *ParentImageHandle,
   IN CHAR16       *CommandLine,
   IN CHAR16       *CommandLine,
   IN BOOLEAN      DebugOutput
   IN BOOLEAN      DebugOutput
@@ -147,7 +146,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 CHAR16 *
 CHAR16 *
-(EFIAPI *SHELLENV_GET_ENV) (
+(EFIAPI *SHELLENV_GET_ENV)(
   IN CHAR16 *Name
   IN CHAR16 *Name
   );
   );
 
 
@@ -163,7 +162,7 @@ CHAR16 *
 **/
 **/
 typedef
 typedef
 CHAR16 *
 CHAR16 *
-(EFIAPI *SHELLENV_GET_MAP) (
+(EFIAPI *SHELLENV_GET_MAP)(
   IN CHAR16 *Name
   IN CHAR16 *Name
   );
   );
 
 
@@ -184,7 +183,7 @@ CHAR16 *
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_ADD_CMD) (
+(EFIAPI *SHELLENV_ADD_CMD)(
   IN SHELLENV_INTERNAL_COMMAND    Handler,
   IN SHELLENV_INTERNAL_COMMAND    Handler,
   IN CHAR16                       *Cmd,
   IN CHAR16                       *Cmd,
   IN SHELLCMD_GET_LINE_HELP       GetLineHelp
   IN SHELLCMD_GET_LINE_HELP       GetLineHelp
@@ -206,7 +205,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_ADD_PROT) (
+(EFIAPI *SHELLENV_ADD_PROT)(
   IN EFI_GUID                     *Protocol,
   IN EFI_GUID                     *Protocol,
   IN SHELLENV_DUMP_PROTOCOL_INFO  DumpToken OPTIONAL,
   IN SHELLENV_DUMP_PROTOCOL_INFO  DumpToken OPTIONAL,
   IN SHELLENV_DUMP_PROTOCOL_INFO  DumpInfo OPTIONAL,
   IN SHELLENV_DUMP_PROTOCOL_INFO  DumpInfo OPTIONAL,
@@ -227,8 +226,8 @@ VOID
   @retval NULL                 The Name was not found, and GenId was not TRUE.
   @retval NULL                 The Name was not found, and GenId was not TRUE.
 **/
 **/
 typedef
 typedef
-CHAR16*
-(EFIAPI *SHELLENV_GET_PROT) (
+CHAR16 *
+(EFIAPI *SHELLENV_GET_PROT)(
   IN EFI_GUID *Protocol,
   IN EFI_GUID *Protocol,
   IN BOOLEAN GenId
   IN BOOLEAN GenId
   );
   );
@@ -249,8 +248,8 @@ CHAR16*
 
 
 **/
 **/
 typedef
 typedef
-CHAR16*
-(EFIAPI *SHELLENV_CUR_DIR) (
+CHAR16 *
+(EFIAPI *SHELLENV_CUR_DIR)(
   IN CHAR16 *DeviceName OPTIONAL
   IN CHAR16 *DeviceName OPTIONAL
   );
   );
 
 
@@ -275,7 +274,7 @@ CHAR16*
   @sa SHELLENV_FREE_FILE_LIST
   @sa SHELLENV_FREE_FILE_LIST
 **/typedef
 **/typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_FILE_META_ARG) (
+(EFIAPI *SHELLENV_FILE_META_ARG)(
   IN CHAR16               *Arg,
   IN CHAR16               *Arg,
   IN OUT LIST_ENTRY       *ListHead
   IN OUT LIST_ENTRY       *ListHead
   );
   );
@@ -289,7 +288,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_FREE_FILE_LIST) (
+(EFIAPI *SHELLENV_FREE_FILE_LIST)(
   IN OUT LIST_ENTRY       *ListHead
   IN OUT LIST_ENTRY       *ListHead
   );
   );
 
 
@@ -308,8 +307,8 @@ EFI_STATUS
 
 
 **/
 **/
 typedef
 typedef
-EFI_SHELL_INTERFACE*
-(EFIAPI *SHELLENV_NEW_SHELL) (
+EFI_SHELL_INTERFACE *
+(EFIAPI *SHELLENV_NEW_SHELL)(
   IN EFI_HANDLE ImageHandle
   IN EFI_HANDLE ImageHandle
   );
   );
 
 
@@ -325,7 +324,7 @@ EFI_SHELL_INTERFACE*
 **/
 **/
 typedef
 typedef
 BOOLEAN
 BOOLEAN
-(EFIAPI *SHELLENV_BATCH_IS_ACTIVE) (
+(EFIAPI *SHELLENV_BATCH_IS_ACTIVE)(
   VOID
   VOID
   );
   );
 
 
@@ -335,7 +334,7 @@ BOOLEAN
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_FREE_RESOURCES) (
+(EFIAPI *SHELLENV_FREE_RESOURCES)(
   VOID
   VOID
   );
   );
 
 
@@ -352,7 +351,7 @@ VOID
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_ENABLE_PAGE_BREAK) (
+(EFIAPI *SHELLENV_ENABLE_PAGE_BREAK)(
   IN INT32      StartRow,
   IN INT32      StartRow,
   IN BOOLEAN    AutoWrap
   IN BOOLEAN    AutoWrap
   );
   );
@@ -365,7 +364,7 @@ VOID
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_DISABLE_PAGE_BREAK) (
+(EFIAPI *SHELLENV_DISABLE_PAGE_BREAK)(
   VOID
   VOID
   );
   );
 
 
@@ -377,7 +376,7 @@ VOID
 **/
 **/
 typedef
 typedef
 BOOLEAN
 BOOLEAN
-(EFIAPI *SHELLENV_GET_PAGE_BREAK) (
+(EFIAPI *SHELLENV_GET_PAGE_BREAK)(
   VOID
   VOID
   );
   );
 
 
@@ -393,7 +392,7 @@ BOOLEAN
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_SET_KEY_FILTER) (
+(EFIAPI *SHELLENV_SET_KEY_FILTER)(
   IN UINT32      KeyFilter
   IN UINT32      KeyFilter
   );
   );
 
 
@@ -409,7 +408,7 @@ VOID
 **/
 **/
 typedef
 typedef
 UINT32
 UINT32
-(EFIAPI *SHELLENV_GET_KEY_FILTER) (
+(EFIAPI *SHELLENV_GET_KEY_FILTER)(
   VOID
   VOID
   );
   );
 
 
@@ -425,7 +424,7 @@ UINT32
 **/
 **/
 typedef
 typedef
 BOOLEAN
 BOOLEAN
-(EFIAPI *SHELLENV_GET_EXECUTION_BREAK) (
+(EFIAPI *SHELLENV_GET_EXECUTION_BREAK)(
   VOID
   VOID
   );
   );
 
 
@@ -435,7 +434,7 @@ BOOLEAN
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_INCREMENT_SHELL_NESTING_LEVEL) (
+(EFIAPI *SHELLENV_INCREMENT_SHELL_NESTING_LEVEL)(
   VOID
   VOID
   );
   );
 
 
@@ -444,7 +443,7 @@ VOID
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_DECREMENT_SHELL_NESTING_LEVEL) (
+(EFIAPI *SHELLENV_DECREMENT_SHELL_NESTING_LEVEL)(
   VOID
   VOID
   );
   );
 
 
@@ -457,7 +456,7 @@ VOID
 **/
 **/
 typedef
 typedef
 BOOLEAN
 BOOLEAN
-(EFIAPI *SHELLENV_IS_ROOT_SHELL) (
+(EFIAPI *SHELLENV_IS_ROOT_SHELL)(
   VOID
   VOID
   );
   );
 
 
@@ -476,7 +475,7 @@ BOOLEAN
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *SHELLENV_CLOSE_CONSOLE_PROXY) (
+(EFIAPI *SHELLENV_CLOSE_CONSOLE_PROXY)(
   IN     EFI_HANDLE                       ConInHandle,
   IN     EFI_HANDLE                       ConInHandle,
   IN OUT EFI_SIMPLE_TEXT_INPUT_PROTOCOL   **ConIn,
   IN OUT EFI_SIMPLE_TEXT_INPUT_PROTOCOL   **ConIn,
   IN     EFI_HANDLE                       ConOutHandle,
   IN     EFI_HANDLE                       ConOutHandle,
@@ -486,6 +485,7 @@ VOID
 //
 //
 // declarations of handle enumerator
 // declarations of handle enumerator
 //
 //
+
 /**
 /**
   For ease of use the shell maps handle #'s to short numbers.
   For ease of use the shell maps handle #'s to short numbers.
   This is only done on request for various internal commands and the references
   This is only done on request for various internal commands and the references
@@ -493,7 +493,7 @@ VOID
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *INIT_HANDLE_ENUMERATOR) (
+(EFIAPI *INIT_HANDLE_ENUMERATOR)(
   VOID
   VOID
   );
   );
 
 
@@ -514,7 +514,7 @@ VOID
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *NEXT_HANDLE) (
+(EFIAPI *NEXT_HANDLE)(
   IN OUT EFI_HANDLE             **Handle
   IN OUT EFI_HANDLE             **Handle
   );
   );
 
 
@@ -534,7 +534,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SKIP_HANDLE) (
+(EFIAPI *SKIP_HANDLE)(
   IN UINTN                   SkipNum
   IN UINTN                   SkipNum
   );
   );
 
 
@@ -552,7 +552,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 UINTN
 UINTN
-(EFIAPI *RESET_HANDLE_ENUMERATOR) (
+(EFIAPI *RESET_HANDLE_ENUMERATOR)(
   IN UINTN                  EnumIndex
   IN UINTN                  EnumIndex
   );
   );
 
 
@@ -567,7 +567,7 @@ UINTN
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *CLOSE_HANDLE_ENUMERATOR) (
+(EFIAPI *CLOSE_HANDLE_ENUMERATOR)(
   VOID
   VOID
   );
   );
 
 
@@ -582,7 +582,7 @@ VOID
 **/
 **/
 typedef
 typedef
 UINTN
 UINTN
-(EFIAPI *GET_NUM) (
+(EFIAPI *GET_NUM)(
   VOID
   VOID
   );
   );
 
 
@@ -590,43 +590,43 @@ UINTN
 Handle Enumerator structure.
 Handle Enumerator structure.
 **/
 **/
 typedef struct {
 typedef struct {
-  INIT_HANDLE_ENUMERATOR  Init;   ///< The pointer to INIT_HANDLE_ENUMERATOR function.
-  NEXT_HANDLE             Next;   ///< The pointer to NEXT_HANDLE function.
-  SKIP_HANDLE             Skip;   ///< The pointer to SKIP_HANDLE function.
-  RESET_HANDLE_ENUMERATOR Reset;  ///< The pointer to RESET_HANDLE_ENUMERATOR function.
-  CLOSE_HANDLE_ENUMERATOR Close;  ///< The pointer to CLOSE_HANDLE_ENUMERATOR function.
-  GET_NUM                 GetNum; ///< The pointer to GET_NUM function.
+  INIT_HANDLE_ENUMERATOR     Init;   ///< The pointer to INIT_HANDLE_ENUMERATOR function.
+  NEXT_HANDLE                Next;   ///< The pointer to NEXT_HANDLE function.
+  SKIP_HANDLE                Skip;   ///< The pointer to SKIP_HANDLE function.
+  RESET_HANDLE_ENUMERATOR    Reset;  ///< The pointer to RESET_HANDLE_ENUMERATOR function.
+  CLOSE_HANDLE_ENUMERATOR    Close;  ///< The pointer to CLOSE_HANDLE_ENUMERATOR function.
+  GET_NUM                    GetNum; ///< The pointer to GET_NUM function.
 } HANDLE_ENUMERATOR;
 } HANDLE_ENUMERATOR;
 
 
 /**
 /**
   Signature for the PROTOCOL_INFO structure.
   Signature for the PROTOCOL_INFO structure.
 **/
 **/
-#define PROTOCOL_INFO_SIGNATURE SIGNATURE_32 ('s', 'p', 'i', 'n')
+#define PROTOCOL_INFO_SIGNATURE  SIGNATURE_32 ('s', 'p', 'i', 'n')
 
 
 /**
 /**
   PROTOCOL_INFO structure for protocol enumerator functions.
   PROTOCOL_INFO structure for protocol enumerator functions.
 **/
 **/
 typedef struct {
 typedef struct {
-  UINTN                       Signature;   ///< PROTOCOL_INFO_SIGNATURE.
-  LIST_ENTRY                  Link;        ///< Standard linked list helper member.
+  UINTN                          Signature; ///< PROTOCOL_INFO_SIGNATURE.
+  LIST_ENTRY                     Link;      ///< Standard linked list helper member.
   //
   //
   // The parsing info for the protocol.
   // The parsing info for the protocol.
   //
   //
-  EFI_GUID                    ProtocolId;  ///< The GUID for the protocol.
-  CHAR16                      *IdString;   ///< The name of the protocol.
-  SHELLENV_DUMP_PROTOCOL_INFO DumpToken;   ///< The pointer to DumpToken function for the protocol.
-  SHELLENV_DUMP_PROTOCOL_INFO DumpInfo;    ///< The pointer to DumpInfo function for the protocol.
+  EFI_GUID                       ProtocolId; ///< The GUID for the protocol.
+  CHAR16                         *IdString;  ///< The name of the protocol.
+  SHELLENV_DUMP_PROTOCOL_INFO    DumpToken;  ///< The pointer to DumpToken function for the protocol.
+  SHELLENV_DUMP_PROTOCOL_INFO    DumpInfo;   ///< The pointer to DumpInfo function for the protocol.
   //
   //
   // Patabase info on which handles are supporting this protocol.
   // Patabase info on which handles are supporting this protocol.
   //
   //
-  UINTN                       NoHandles;   ///< The number of handles producing this protocol.
-  EFI_HANDLE                  *Handles;    ///< The array of handles.
-
+  UINTN                          NoHandles; ///< The number of handles producing this protocol.
+  EFI_HANDLE                     *Handles;  ///< The array of handles.
 } PROTOCOL_INFO;
 } PROTOCOL_INFO;
 
 
 //
 //
 // Declarations of protocol info enumerator.
 // Declarations of protocol info enumerator.
 //
 //
+
 /**
 /**
   This is an internal shell function to initialize the protocol enumerator.
   This is an internal shell function to initialize the protocol enumerator.
 
 
@@ -636,7 +636,7 @@ typedef struct {
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *INIT_PROTOCOL_INFO_ENUMERATOR) (
+(EFIAPI *INIT_PROTOCOL_INFO_ENUMERATOR)(
   VOID
   VOID
   );
   );
 
 
@@ -657,7 +657,7 @@ VOID
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *NEXT_PROTOCOL_INFO) (
+(EFIAPI *NEXT_PROTOCOL_INFO)(
   IN OUT PROTOCOL_INFO            **ProtocolInfo
   IN OUT PROTOCOL_INFO            **ProtocolInfo
   );
   );
 
 
@@ -673,7 +673,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SKIP_PROTOCOL_INFO) (
+(EFIAPI *SKIP_PROTOCOL_INFO)(
   IN UINTN                         SkipNum
   IN UINTN                         SkipNum
   );
   );
 
 
@@ -688,11 +688,10 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *RESET_PROTOCOL_INFO_ENUMERATOR) (
+(EFIAPI *RESET_PROTOCOL_INFO_ENUMERATOR)(
   VOID
   VOID
   );
   );
 
 
-
 /**
 /**
   This function is an internal shell function for enumeration of protocols.
   This function is an internal shell function for enumeration of protocols.
 
 
@@ -704,7 +703,7 @@ VOID
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI *CLOSE_PROTOCOL_INFO_ENUMERATOR) (
+(EFIAPI *CLOSE_PROTOCOL_INFO_ENUMERATOR)(
   VOID
   VOID
   );
   );
 
 
@@ -712,11 +711,11 @@ VOID
   Protocol enumerator structure of function pointers.
   Protocol enumerator structure of function pointers.
 **/
 **/
 typedef struct {
 typedef struct {
-  INIT_PROTOCOL_INFO_ENUMERATOR   Init;   ///< The pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.
-  NEXT_PROTOCOL_INFO              Next;   ///< The pointer to NEXT_PROTOCOL_INFO function.
-  SKIP_PROTOCOL_INFO              Skip;   ///< The pointer to SKIP_PROTOCOL_INFO function.
-  RESET_PROTOCOL_INFO_ENUMERATOR  Reset;  ///< The pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.
-  CLOSE_PROTOCOL_INFO_ENUMERATOR  Close;  ///< The pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.
+  INIT_PROTOCOL_INFO_ENUMERATOR     Init;  ///< The pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.
+  NEXT_PROTOCOL_INFO                Next;  ///< The pointer to NEXT_PROTOCOL_INFO function.
+  SKIP_PROTOCOL_INFO                Skip;  ///< The pointer to SKIP_PROTOCOL_INFO function.
+  RESET_PROTOCOL_INFO_ENUMERATOR    Reset; ///< The pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.
+  CLOSE_PROTOCOL_INFO_ENUMERATOR    Close; ///< The pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.
 } PROTOCOL_INFO_ENUMERATOR;
 } PROTOCOL_INFO_ENUMERATOR;
 
 
 /**
 /**
@@ -752,7 +751,7 @@ typedef struct {
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *GET_DEVICE_NAME) (
+(EFIAPI *GET_DEVICE_NAME)(
   IN EFI_HANDLE  DeviceHandle,
   IN EFI_HANDLE  DeviceHandle,
   IN BOOLEAN     UseComponentName,
   IN BOOLEAN     UseComponentName,
   IN BOOLEAN     UseDevicePath,
   IN BOOLEAN     UseDevicePath,
@@ -764,8 +763,8 @@ EFI_STATUS
   IN UINTN       Indent
   IN UINTN       Indent
   );
   );
 
 
-#define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< The string for lowest version this shell supports.
-#define EFI_SHELL_ENHANCED_MODE_VER   L"1.1.2" ///< The string for highest version this shell supports.
+#define EFI_SHELL_COMPATIBLE_MODE_VER  L"1.1.1" ///< The string for lowest version this shell supports.
+#define EFI_SHELL_ENHANCED_MODE_VER    L"1.1.2" ///< The string for highest version this shell supports.
 
 
 /**
 /**
   This function gets the shell mode as stored in the shell environment
   This function gets the shell mode as stored in the shell environment
@@ -778,7 +777,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *GET_SHELL_MODE) (
+(EFIAPI *GET_SHELL_MODE)(
   OUT CHAR16     **Mode
   OUT CHAR16     **Mode
   );
   );
 
 
@@ -798,8 +797,8 @@ EFI_STATUS
   @retval NULL                  The operation could not be completed.
   @retval NULL                  The operation could not be completed.
 **/
 **/
 typedef
 typedef
-EFI_DEVICE_PATH_PROTOCOL*
-(EFIAPI *SHELLENV_NAME_TO_PATH) (
+EFI_DEVICE_PATH_PROTOCOL *
+(EFIAPI *SHELLENV_NAME_TO_PATH)(
   IN CHAR16 *Path
   IN CHAR16 *Path
   );
   );
 
 
@@ -827,8 +826,8 @@ EFI_DEVICE_PATH_PROTOCOL*
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_GET_FS_NAME) (
-  IN EFI_DEVICE_PATH_PROTOCOL     * DevPath,
+(EFIAPI *SHELLENV_GET_FS_NAME)(
+  IN EFI_DEVICE_PATH_PROTOCOL     *DevPath,
   IN BOOLEAN                      ConsistMapping,
   IN BOOLEAN                      ConsistMapping,
   OUT CHAR16                      **Name
   OUT CHAR16                      **Name
   );
   );
@@ -855,7 +854,7 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_FILE_META_ARG_NO_WILDCARD) (
+(EFIAPI *SHELLENV_FILE_META_ARG_NO_WILDCARD)(
   IN CHAR16               *Arg,
   IN CHAR16               *Arg,
   IN OUT LIST_ENTRY       *ListHead
   IN OUT LIST_ENTRY       *ListHead
   );
   );
@@ -877,8 +876,8 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_DEL_DUP_FILE) (
-  IN LIST_ENTRY   * ListHead
+(EFIAPI *SHELLENV_DEL_DUP_FILE)(
+  IN LIST_ENTRY   *ListHead
   );
   );
 
 
 /**
 /**
@@ -905,65 +904,65 @@ EFI_STATUS
 **/
 **/
 typedef
 typedef
 EFI_STATUS
 EFI_STATUS
-(EFIAPI *SHELLENV_GET_FS_DEVICE_PATH) (
+(EFIAPI *SHELLENV_GET_FS_DEVICE_PATH)(
   IN CHAR16                        *Name,
   IN CHAR16                        *Name,
   OUT EFI_DEVICE_PATH_PROTOCOL     **DevPath
   OUT EFI_DEVICE_PATH_PROTOCOL     **DevPath
   );
   );
 
 
 /// EFI_SHELL_ENVIRONMENT2 protocol structure.
 /// EFI_SHELL_ENVIRONMENT2 protocol structure.
 typedef struct {
 typedef struct {
-  SHELLENV_EXECUTE                        Execute;
-  SHELLENV_GET_ENV                        GetEnv;
-  SHELLENV_GET_MAP                        GetMap;
-  SHELLENV_ADD_CMD                        AddCmd;
-  SHELLENV_ADD_PROT                       AddProt;
-  SHELLENV_GET_PROT                       GetProt;
-  SHELLENV_CUR_DIR                        CurDir;
-  SHELLENV_FILE_META_ARG                  FileMetaArg;
-  SHELLENV_FREE_FILE_LIST                 FreeFileList;
+  SHELLENV_EXECUTE                          Execute;
+  SHELLENV_GET_ENV                          GetEnv;
+  SHELLENV_GET_MAP                          GetMap;
+  SHELLENV_ADD_CMD                          AddCmd;
+  SHELLENV_ADD_PROT                         AddProt;
+  SHELLENV_GET_PROT                         GetProt;
+  SHELLENV_CUR_DIR                          CurDir;
+  SHELLENV_FILE_META_ARG                    FileMetaArg;
+  SHELLENV_FREE_FILE_LIST                   FreeFileList;
 
 
   //
   //
   // The following services are only used by the shell itself.
   // The following services are only used by the shell itself.
   //
   //
-  SHELLENV_NEW_SHELL                      NewShell;
-  SHELLENV_BATCH_IS_ACTIVE                BatchIsActive;
+  SHELLENV_NEW_SHELL                        NewShell;
+  SHELLENV_BATCH_IS_ACTIVE                  BatchIsActive;
 
 
-  SHELLENV_FREE_RESOURCES                 FreeResources;
+  SHELLENV_FREE_RESOURCES                   FreeResources;
 
 
   //
   //
   // GUID to differentiate ShellEnvironment2 from ShellEnvironment.
   // GUID to differentiate ShellEnvironment2 from ShellEnvironment.
   //
   //
-  EFI_GUID                                SESGuid;
+  EFI_GUID                                  SESGuid;
   //
   //
   // Major Version grows if shell environment interface has been changes.
   // Major Version grows if shell environment interface has been changes.
   //
   //
-  UINT32                                  MajorVersion;
-  UINT32                                  MinorVersion;
-  SHELLENV_ENABLE_PAGE_BREAK              EnablePageBreak;
-  SHELLENV_DISABLE_PAGE_BREAK             DisablePageBreak;
-  SHELLENV_GET_PAGE_BREAK                 GetPageBreak;
-
-  SHELLENV_SET_KEY_FILTER                 SetKeyFilter;
-  SHELLENV_GET_KEY_FILTER                 GetKeyFilter;
-
-  SHELLENV_GET_EXECUTION_BREAK            GetExecutionBreak;
-  SHELLENV_INCREMENT_SHELL_NESTING_LEVEL  IncrementShellNestingLevel;
-  SHELLENV_DECREMENT_SHELL_NESTING_LEVEL  DecrementShellNestingLevel;
-  SHELLENV_IS_ROOT_SHELL                  IsRootShell;
-
-  SHELLENV_CLOSE_CONSOLE_PROXY            CloseConsoleProxy;
-  HANDLE_ENUMERATOR                       HandleEnumerator;
-  PROTOCOL_INFO_ENUMERATOR                ProtocolInfoEnumerator;
-  GET_DEVICE_NAME                         GetDeviceName;
-  GET_SHELL_MODE                          GetShellMode;
-  SHELLENV_NAME_TO_PATH                   NameToPath;
-  SHELLENV_GET_FS_NAME                    GetFsName;
-  SHELLENV_FILE_META_ARG_NO_WILDCARD      FileMetaArgNoWildCard;
-  SHELLENV_DEL_DUP_FILE                   DelDupFileArg;
-  SHELLENV_GET_FS_DEVICE_PATH             GetFsDevicePath;
+  UINT32                                    MajorVersion;
+  UINT32                                    MinorVersion;
+  SHELLENV_ENABLE_PAGE_BREAK                EnablePageBreak;
+  SHELLENV_DISABLE_PAGE_BREAK               DisablePageBreak;
+  SHELLENV_GET_PAGE_BREAK                   GetPageBreak;
+
+  SHELLENV_SET_KEY_FILTER                   SetKeyFilter;
+  SHELLENV_GET_KEY_FILTER                   GetKeyFilter;
+
+  SHELLENV_GET_EXECUTION_BREAK              GetExecutionBreak;
+  SHELLENV_INCREMENT_SHELL_NESTING_LEVEL    IncrementShellNestingLevel;
+  SHELLENV_DECREMENT_SHELL_NESTING_LEVEL    DecrementShellNestingLevel;
+  SHELLENV_IS_ROOT_SHELL                    IsRootShell;
+
+  SHELLENV_CLOSE_CONSOLE_PROXY              CloseConsoleProxy;
+  HANDLE_ENUMERATOR                         HandleEnumerator;
+  PROTOCOL_INFO_ENUMERATOR                  ProtocolInfoEnumerator;
+  GET_DEVICE_NAME                           GetDeviceName;
+  GET_SHELL_MODE                            GetShellMode;
+  SHELLENV_NAME_TO_PATH                     NameToPath;
+  SHELLENV_GET_FS_NAME                      GetFsName;
+  SHELLENV_FILE_META_ARG_NO_WILDCARD        FileMetaArgNoWildCard;
+  SHELLENV_DEL_DUP_FILE                     DelDupFileArg;
+  SHELLENV_GET_FS_DEVICE_PATH               GetFsDevicePath;
 } EFI_SHELL_ENVIRONMENT2;
 } EFI_SHELL_ENVIRONMENT2;
 
 
-extern EFI_GUID gEfiShellEnvironment2Guid;
-extern EFI_GUID gEfiShellEnvironment2ExtGuid;
+extern EFI_GUID  gEfiShellEnvironment2Guid;
+extern EFI_GUID  gEfiShellEnvironment2ExtGuid;
 
 
 #endif // _SHELL_ENVIRONMENT_2_PROTOCOL_H_
 #endif // _SHELL_ENVIRONMENT_2_PROTOCOL_H_

+ 13 - 13
ShellPkg/Include/Protocol/EfiShellInterface.h

@@ -40,7 +40,7 @@ typedef enum {
 /// Attributes for an argument.
 /// Attributes for an argument.
 ///
 ///
 typedef struct _EFI_SHELL_ARG_INFO {
 typedef struct _EFI_SHELL_ARG_INFO {
-  UINT32  Attributes;
+  UINT32    Attributes;
 } EFI_SHELL_ARG_INFO;
 } EFI_SHELL_ARG_INFO;
 
 
 ///
 ///
@@ -50,39 +50,39 @@ typedef struct {
   ///
   ///
   /// Handle back to original image handle & image information.
   /// Handle back to original image handle & image information.
   ///
   ///
-  EFI_HANDLE                ImageHandle;
-  EFI_LOADED_IMAGE_PROTOCOL *Info;
+  EFI_HANDLE                   ImageHandle;
+  EFI_LOADED_IMAGE_PROTOCOL    *Info;
 
 
   ///
   ///
   /// Parsed arg list converted more C-like format.
   /// Parsed arg list converted more C-like format.
   ///
   ///
-  CHAR16                    **Argv;
-  UINTN                     Argc;
+  CHAR16                       **Argv;
+  UINTN                        Argc;
 
 
   ///
   ///
   /// Storage for file redirection args after parsing.
   /// Storage for file redirection args after parsing.
   ///
   ///
-  CHAR16                    **RedirArgv;
-  UINTN                     RedirArgc;
+  CHAR16                       **RedirArgv;
+  UINTN                        RedirArgc;
 
 
   ///
   ///
   /// A file style handle for console io.
   /// A file style handle for console io.
   ///
   ///
-  EFI_FILE_PROTOCOL         *StdIn;
-  EFI_FILE_PROTOCOL         *StdOut;
-  EFI_FILE_PROTOCOL         *StdErr;
+  EFI_FILE_PROTOCOL            *StdIn;
+  EFI_FILE_PROTOCOL            *StdOut;
+  EFI_FILE_PROTOCOL            *StdErr;
 
 
   ///
   ///
   /// List of attributes for each argument.
   /// List of attributes for each argument.
   ///
   ///
-  EFI_SHELL_ARG_INFO        *ArgInfo;
+  EFI_SHELL_ARG_INFO           *ArgInfo;
 
 
   ///
   ///
   /// Whether we are echoing.
   /// Whether we are echoing.
   ///
   ///
-  BOOLEAN                   EchoOn;
+  BOOLEAN                      EchoOn;
 } EFI_SHELL_INTERFACE;
 } EFI_SHELL_INTERFACE;
 
 
-extern EFI_GUID gEfiShellInterfaceGuid;
+extern EFI_GUID  gEfiShellInterfaceGuid;
 
 
 #endif
 #endif

File diff suppressed because it is too large
+ 329 - 275
ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c


+ 35 - 37
ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h

@@ -99,8 +99,8 @@
 #include <Protocol/DriverConfiguration.h>
 #include <Protocol/DriverConfiguration.h>
 #include <Protocol/DriverConfiguration2.h>
 #include <Protocol/DriverConfiguration2.h>
 #include <Protocol/DevicePathUtilities.h>
 #include <Protocol/DevicePathUtilities.h>
-//#include <Protocol/FirmwareVolume.h>
-//#include <Protocol/FirmwareVolume2.h>
+// #include <Protocol/FirmwareVolume.h>
+// #include <Protocol/FirmwareVolume2.h>
 #include <Protocol/DriverFamilyOverride.h>
 #include <Protocol/DriverFamilyOverride.h>
 #include <Protocol/Pcd.h>
 #include <Protocol/Pcd.h>
 #include <Protocol/TcgService.h>
 #include <Protocol/TcgService.h>
@@ -150,8 +150,8 @@
 #include <Library/ShellCommandLib.h>
 #include <Library/ShellCommandLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 
 
-#define   EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1   1
-#define   EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2   2
+#define   EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1  1
+#define   EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2  2
 
 
 ///
 ///
 /// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec < 2.4a
 /// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec < 2.4a
@@ -161,32 +161,32 @@ typedef struct {
   /// A unique number identifying the firmware image within the device.  The number is
   /// A unique number identifying the firmware image within the device.  The number is
   /// between 1 and DescriptorCount.
   /// between 1 and DescriptorCount.
   ///
   ///
-  UINT8                            ImageIndex;
+  UINT8       ImageIndex;
   ///
   ///
   /// A unique number identifying the firmware image type.
   /// A unique number identifying the firmware image type.
   ///
   ///
-  EFI_GUID                         ImageTypeId;
+  EFI_GUID    ImageTypeId;
   ///
   ///
   /// A unique number identifying the firmware image.
   /// A unique number identifying the firmware image.
   ///
   ///
-  UINT64                           ImageId;
+  UINT64      ImageId;
   ///
   ///
   /// A pointer to a null-terminated string representing the firmware image name.
   /// A pointer to a null-terminated string representing the firmware image name.
   ///
   ///
-  CHAR16                           *ImageIdName;
+  CHAR16      *ImageIdName;
   ///
   ///
   /// Identifies the version of the device firmware. The format is vendor specific and new
   /// Identifies the version of the device firmware. The format is vendor specific and new
   /// version must have a greater value than an old version.
   /// version must have a greater value than an old version.
   ///
   ///
-  UINT32                           Version;
+  UINT32      Version;
   ///
   ///
   /// A pointer to a null-terminated string representing the firmware image version name.
   /// A pointer to a null-terminated string representing the firmware image version name.
   ///
   ///
-  CHAR16                           *VersionName;
+  CHAR16      *VersionName;
   ///
   ///
   /// Size of the image in bytes.  If size=0, then only ImageIndex and ImageTypeId are valid.
   /// Size of the image in bytes.  If size=0, then only ImageIndex and ImageTypeId are valid.
   ///
   ///
-  UINTN                            Size;
+  UINTN       Size;
   ///
   ///
   /// Image attributes that are supported by this device.  See 'Image Attribute Definitions'
   /// Image attributes that are supported by this device.  See 'Image Attribute Definitions'
   /// for possible returned values of this parameter.  A value of 1 indicates the attribute is
   /// for possible returned values of this parameter.  A value of 1 indicates the attribute is
@@ -194,20 +194,19 @@ typedef struct {
   /// value of 0 indicates the attribute is not supported and the current setting value in
   /// value of 0 indicates the attribute is not supported and the current setting value in
   /// AttributesSetting is meaningless.
   /// AttributesSetting is meaningless.
   ///
   ///
-  UINT64                           AttributesSupported;
+  UINT64      AttributesSupported;
   ///
   ///
   /// Image attributes.  See 'Image Attribute Definitions' for possible returned values of
   /// Image attributes.  See 'Image Attribute Definitions' for possible returned values of
   /// this parameter.
   /// this parameter.
   ///
   ///
-  UINT64                           AttributesSetting;
+  UINT64      AttributesSetting;
   ///
   ///
   /// Image compatibilities.  See 'Image Compatibility Definitions' for possible returned
   /// Image compatibilities.  See 'Image Compatibility Definitions' for possible returned
   /// values of this parameter.
   /// values of this parameter.
   ///
   ///
-  UINT64                           Compatibilities;
+  UINT64      Compatibilities;
 } EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1;
 } EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1;
 
 
-
 ///
 ///
 /// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec > 2.4a and < 2.5
 /// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec > 2.4a and < 2.5
 ///
 ///
@@ -216,32 +215,32 @@ typedef struct {
   /// A unique number identifying the firmware image within the device.  The number is
   /// A unique number identifying the firmware image within the device.  The number is
   /// between 1 and DescriptorCount.
   /// between 1 and DescriptorCount.
   ///
   ///
-  UINT8                            ImageIndex;
+  UINT8       ImageIndex;
   ///
   ///
   /// A unique number identifying the firmware image type.
   /// A unique number identifying the firmware image type.
   ///
   ///
-  EFI_GUID                         ImageTypeId;
+  EFI_GUID    ImageTypeId;
   ///
   ///
   /// A unique number identifying the firmware image.
   /// A unique number identifying the firmware image.
   ///
   ///
-  UINT64                           ImageId;
+  UINT64      ImageId;
   ///
   ///
   /// A pointer to a null-terminated string representing the firmware image name.
   /// A pointer to a null-terminated string representing the firmware image name.
   ///
   ///
-  CHAR16                           *ImageIdName;
+  CHAR16      *ImageIdName;
   ///
   ///
   /// Identifies the version of the device firmware. The format is vendor specific and new
   /// Identifies the version of the device firmware. The format is vendor specific and new
   /// version must have a greater value than an old version.
   /// version must have a greater value than an old version.
   ///
   ///
-  UINT32                           Version;
+  UINT32      Version;
   ///
   ///
   /// A pointer to a null-terminated string representing the firmware image version name.
   /// A pointer to a null-terminated string representing the firmware image version name.
   ///
   ///
-  CHAR16                           *VersionName;
+  CHAR16      *VersionName;
   ///
   ///
   /// Size of the image in bytes.  If size=0, then only ImageIndex and ImageTypeId are valid.
   /// Size of the image in bytes.  If size=0, then only ImageIndex and ImageTypeId are valid.
   ///
   ///
-  UINTN                            Size;
+  UINTN       Size;
   ///
   ///
   /// Image attributes that are supported by this device.  See 'Image Attribute Definitions'
   /// Image attributes that are supported by this device.  See 'Image Attribute Definitions'
   /// for possible returned values of this parameter.  A value of 1 indicates the attribute is
   /// for possible returned values of this parameter.  A value of 1 indicates the attribute is
@@ -249,32 +248,32 @@ typedef struct {
   /// value of 0 indicates the attribute is not supported and the current setting value in
   /// value of 0 indicates the attribute is not supported and the current setting value in
   /// AttributesSetting is meaningless.
   /// AttributesSetting is meaningless.
   ///
   ///
-  UINT64                           AttributesSupported;
+  UINT64      AttributesSupported;
   ///
   ///
   /// Image attributes.  See 'Image Attribute Definitions' for possible returned values of
   /// Image attributes.  See 'Image Attribute Definitions' for possible returned values of
   /// this parameter.
   /// this parameter.
   ///
   ///
-  UINT64                           AttributesSetting;
+  UINT64      AttributesSetting;
   ///
   ///
   /// Image compatibilities.  See 'Image Compatibility Definitions' for possible returned
   /// Image compatibilities.  See 'Image Compatibility Definitions' for possible returned
   /// values of this parameter.
   /// values of this parameter.
   ///
   ///
-  UINT64                           Compatibilities;
+  UINT64      Compatibilities;
   ///
   ///
   /// Describes the lowest ImageDescriptor version that the device will accept. Only
   /// Describes the lowest ImageDescriptor version that the device will accept. Only
   /// present in version 2 or higher.
   /// present in version 2 or higher.
-  UINT32                           LowestSupportedImageVersion;
+  UINT32      LowestSupportedImageVersion;
 } EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2;
 } EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2;
 
 
 typedef struct {
 typedef struct {
-  LIST_ENTRY  Link;
-  EFI_HANDLE  TheHandle;
-  UINTN       TheIndex;
-}HANDLE_LIST;
+  LIST_ENTRY    Link;
+  EFI_HANDLE    TheHandle;
+  UINTN         TheIndex;
+} HANDLE_LIST;
 
 
 typedef struct {
 typedef struct {
-  HANDLE_LIST   List;
-  UINTN         NextIndex;
+  HANDLE_LIST    List;
+  UINTN          NextIndex;
 } HANDLE_INDEX_LIST;
 } HANDLE_INDEX_LIST;
 
 
 typedef
 typedef
@@ -284,11 +283,10 @@ CHAR16 *
   IN CONST BOOLEAN    Verbose
   IN CONST BOOLEAN    Verbose
   );
   );
 
 
-typedef struct _GUID_INFO_BLOCK{
-  EFI_STRING_ID                 StringId;
-  EFI_GUID                      *GuidId;
-  DUMP_PROTOCOL_INFO            DumpInfo;
+typedef struct _GUID_INFO_BLOCK {
+  EFI_STRING_ID         StringId;
+  EFI_GUID              *GuidId;
+  DUMP_PROTOCOL_INFO    DumpInfo;
 } GUID_INFO_BLOCK;
 } GUID_INFO_BLOCK;
 
 
 #endif
 #endif
-

+ 102 - 88
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c

@@ -12,16 +12,16 @@
 #include "AcpiView.h"
 #include "AcpiView.h"
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
-STATIC UINT32   gIndent;
-STATIC UINT32   mTableErrorCount;
-STATIC UINT32   mTableWarningCount;
+STATIC UINT32  gIndent;
+STATIC UINT32  mTableErrorCount;
+STATIC UINT32  mTableWarningCount;
 
 
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   An ACPI_PARSER array describing the ACPI header.
   An ACPI_PARSER array describing the ACPI header.
 **/
 **/
-STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {
+STATIC CONST ACPI_PARSER  AcpiHeaderParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
 };
 };
 
 
@@ -113,21 +113,21 @@ IncrementWarningCount (
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 VerifyChecksum (
 VerifyChecksum (
-  IN BOOLEAN Log,
-  IN UINT8*  Ptr,
-  IN UINT32  Length
+  IN BOOLEAN  Log,
+  IN UINT8    *Ptr,
+  IN UINT32   Length
   )
   )
 {
 {
-  UINTN ByteCount;
-  UINT8 Checksum;
-  UINTN OriginalAttribute;
+  UINTN  ByteCount;
+  UINT8  Checksum;
+  UINTN  OriginalAttribute;
 
 
   //
   //
   // set local variables to suppress incorrect compiler/analyzer warnings
   // set local variables to suppress incorrect compiler/analyzer warnings
   //
   //
   OriginalAttribute = 0;
   OriginalAttribute = 0;
-  ByteCount = 0;
-  Checksum = 0;
+  ByteCount         = 0;
+  Checksum          = 0;
 
 
   while (ByteCount < Length) {
   while (ByteCount < Length) {
     Checksum += *(Ptr++);
     Checksum += *(Ptr++);
@@ -140,22 +140,29 @@ VerifyChecksum (
       if (GetColourHighlighting ()) {
       if (GetColourHighlighting ()) {
         gST->ConOut->SetAttribute (
         gST->ConOut->SetAttribute (
                        gST->ConOut,
                        gST->ConOut,
-                       EFI_TEXT_ATTR (EFI_GREEN,
-                         ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
+                       EFI_TEXT_ATTR (
+                         EFI_GREEN,
+                         ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+                         )
                        );
                        );
       }
       }
+
       Print (L"Table Checksum : OK\n\n");
       Print (L"Table Checksum : OK\n\n");
     } else {
     } else {
       IncrementErrorCount ();
       IncrementErrorCount ();
       if (GetColourHighlighting ()) {
       if (GetColourHighlighting ()) {
         gST->ConOut->SetAttribute (
         gST->ConOut->SetAttribute (
                        gST->ConOut,
                        gST->ConOut,
-                       EFI_TEXT_ATTR (EFI_RED,
-                         ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
+                       EFI_TEXT_ATTR (
+                         EFI_RED,
+                         ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+                         )
                        );
                        );
       }
       }
+
       Print (L"Table Checksum : FAILED (0x%X)\n\n", Checksum);
       Print (L"Table Checksum : FAILED (0x%X)\n\n", Checksum);
     }
     }
+
     if (GetColourHighlighting ()) {
     if (GetColourHighlighting ()) {
       gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
       gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
     }
     }
@@ -173,16 +180,16 @@ VerifyChecksum (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpRaw (
 DumpRaw (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
-  UINTN ByteCount;
-  UINTN PartLineChars;
-  UINTN AsciiBufferIndex;
-  CHAR8 AsciiBuffer[17];
+  UINTN  ByteCount;
+  UINTN  PartLineChars;
+  UINTN  AsciiBufferIndex;
+  CHAR8  AsciiBuffer[17];
 
 
-  ByteCount = 0;
+  ByteCount        = 0;
   AsciiBufferIndex = 0;
   AsciiBufferIndex = 0;
 
 
   Print (L"Address  : 0x%p\n", Ptr);
   Print (L"Address  : 0x%p\n", Ptr);
@@ -216,6 +223,7 @@ DumpRaw (
     if ((Length & 0x0F) <= 8) {
     if ((Length & 0x0F) <= 8) {
       PartLineChars += 2;
       PartLineChars += 2;
     }
     }
+
     while (PartLineChars > 0) {
     while (PartLineChars > 0) {
       Print (L" ");
       Print (L" ");
       PartLineChars--;
       PartLineChars--;
@@ -236,8 +244,8 @@ DumpRaw (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpUint8 (
 DumpUint8 (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   )
   )
 {
 {
   Print (Format, *Ptr);
   Print (Format, *Ptr);
@@ -252,11 +260,11 @@ DumpUint8 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpUint16 (
 DumpUint16 (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   )
   )
 {
 {
-  Print (Format, *(UINT16*)Ptr);
+  Print (Format, *(UINT16 *)Ptr);
 }
 }
 
 
 /**
 /**
@@ -268,11 +276,11 @@ DumpUint16 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpUint32 (
 DumpUint32 (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   )
   )
 {
 {
-  Print (Format, *(UINT32*)Ptr);
+  Print (Format, *(UINT32 *)Ptr);
 }
 }
 
 
 /**
 /**
@@ -284,19 +292,19 @@ DumpUint32 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpUint64 (
 DumpUint64 (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   )
   )
 {
 {
   // Some fields are not aligned and this causes alignment faults
   // Some fields are not aligned and this causes alignment faults
   // on ARM platforms if the compiler generates LDRD instructions.
   // on ARM platforms if the compiler generates LDRD instructions.
   // Perform word access so that LDRD instructions are not generated.
   // Perform word access so that LDRD instructions are not generated.
-  UINT64 Val;
+  UINT64  Val;
 
 
-  Val = *(UINT32*)(Ptr + sizeof (UINT32));
+  Val = *(UINT32 *)(Ptr + sizeof (UINT32));
 
 
-  Val = LShiftU64(Val,32);
-  Val |= (UINT64)*(UINT32*)Ptr;
+  Val  = LShiftU64 (Val, 32);
+  Val |= (UINT64)*(UINT32 *)Ptr;
 
 
   Print (Format, Val);
   Print (Format, Val);
 }
 }
@@ -313,8 +321,8 @@ DumpUint64 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump3Chars (
 Dump3Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   )
   )
 {
 {
   Print (
   Print (
@@ -337,8 +345,8 @@ Dump3Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump4Chars (
 Dump4Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   )
   )
 {
 {
   Print (
   Print (
@@ -362,8 +370,8 @@ Dump4Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump6Chars (
 Dump6Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   )
   )
 {
 {
   Print (
   Print (
@@ -389,8 +397,8 @@ Dump6Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump8Chars (
 Dump8Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   )
   )
 {
 {
   Print (
   Print (
@@ -418,8 +426,8 @@ Dump8Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump12Chars (
 Dump12Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN       UINT8*  Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN       UINT8   *Ptr
   )
   )
 {
 {
   Print (
   Print (
@@ -454,9 +462,9 @@ Dump12Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 PrintFieldName (
 PrintFieldName (
-  IN UINT32         Indent,
-  IN CONST CHAR16*  FieldName
-)
+  IN UINT32        Indent,
+  IN CONST CHAR16  *FieldName
+  )
 {
 {
   Print (
   Print (
     L"%*a%-*s : ",
     L"%*a%-*s : ",
@@ -498,38 +506,41 @@ EFIAPI
 ParseAcpi (
 ParseAcpi (
   IN BOOLEAN            Trace,
   IN BOOLEAN            Trace,
   IN UINT32             Indent,
   IN UINT32             Indent,
-  IN CONST CHAR8*       AsciiName OPTIONAL,
-  IN UINT8*             Ptr,
+  IN CONST CHAR8        *AsciiName OPTIONAL,
+  IN UINT8              *Ptr,
   IN UINT32             Length,
   IN UINT32             Length,
-  IN CONST ACPI_PARSER* Parser,
+  IN CONST ACPI_PARSER  *Parser,
   IN UINT32             ParserItems
   IN UINT32             ParserItems
-)
+  )
 {
 {
-  UINT32  Index;
-  UINT32  Offset;
-  BOOLEAN HighLight;
-  UINTN   OriginalAttribute;
+  UINT32   Index;
+  UINT32   Offset;
+  BOOLEAN  HighLight;
+  UINTN    OriginalAttribute;
 
 
   //
   //
   // set local variables to suppress incorrect compiler/analyzer warnings
   // set local variables to suppress incorrect compiler/analyzer warnings
   //
   //
   OriginalAttribute = 0;
   OriginalAttribute = 0;
-  Offset = 0;
+  Offset            = 0;
 
 
   // Increment the Indent
   // Increment the Indent
   gIndent += Indent;
   gIndent += Indent;
 
 
-  if (Trace && (AsciiName != NULL)){
+  if (Trace && (AsciiName != NULL)) {
     HighLight = GetColourHighlighting ();
     HighLight = GetColourHighlighting ();
 
 
     if (HighLight) {
     if (HighLight) {
       OriginalAttribute = gST->ConOut->Mode->Attribute;
       OriginalAttribute = gST->ConOut->Mode->Attribute;
       gST->ConOut->SetAttribute (
       gST->ConOut->SetAttribute (
                      gST->ConOut,
                      gST->ConOut,
-                     EFI_TEXT_ATTR(EFI_YELLOW,
-                       ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
+                     EFI_TEXT_ATTR (
+                       EFI_YELLOW,
+                       ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+                       )
                      );
                      );
     }
     }
+
     Print (
     Print (
       L"%*a%-*a :\n",
       L"%*a%-*a :\n",
       gIndent,
       gIndent,
@@ -544,7 +555,6 @@ ParseAcpi (
 
 
   for (Index = 0; Index < ParserItems; Index++) {
   for (Index = 0; Index < ParserItems; Index++) {
     if ((Offset + Parser[Index].Length) > Length) {
     if ((Offset + Parser[Index].Length) > Length) {
-
       // For fields outside the buffer length provided, reset any pointers
       // For fields outside the buffer length provided, reset any pointers
       // which were supposed to be updated by this function call
       // which were supposed to be updated by this function call
       if (Parser[Index].ItemPtr != NULL) {
       if (Parser[Index].ItemPtr != NULL) {
@@ -556,11 +566,12 @@ ParseAcpi (
     }
     }
 
 
     if (GetConsistencyChecking () &&
     if (GetConsistencyChecking () &&
-        (Offset != Parser[Index].Offset)) {
+        (Offset != Parser[Index].Offset))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"\nERROR: %a: Offset Mismatch for %s\n"
         L"\nERROR: %a: Offset Mismatch for %s\n"
-          L"CurrentOffset = %d FieldOffset = %d\n",
+        L"CurrentOffset = %d FieldOffset = %d\n",
         AsciiName,
         AsciiName,
         Parser[Index].NameStr,
         Parser[Index].NameStr,
         Offset,
         Offset,
@@ -597,20 +608,23 @@ ParseAcpi (
               );
               );
         } // switch
         } // switch
       }
       }
+
       // Validating only makes sense if we are tracing
       // Validating only makes sense if we are tracing
       // the parsed table entries, to report by table name.
       // the parsed table entries, to report by table name.
       if (GetConsistencyChecking () &&
       if (GetConsistencyChecking () &&
-          (Parser[Index].FieldValidator != NULL)) {
+          (Parser[Index].FieldValidator != NULL))
+      {
         Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
         Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
       }
       }
+
       Print (L"\n");
       Print (L"\n");
     } // if (Trace)
     } // if (Trace)
 
 
     if (Parser[Index].ItemPtr != NULL) {
     if (Parser[Index].ItemPtr != NULL) {
-      *Parser[Index].ItemPtr = (VOID*)Ptr;
+      *Parser[Index].ItemPtr = (VOID *)Ptr;
     }
     }
 
 
-    Ptr += Parser[Index].Length;
+    Ptr    += Parser[Index].Length;
     Offset += Parser[Index].Length;
     Offset += Parser[Index].Length;
   } // for
   } // for
 
 
@@ -624,12 +638,12 @@ ParseAcpi (
   The GasParser array is used by the ParseAcpi function to parse and/or trace
   The GasParser array is used by the ParseAcpi function to parse and/or trace
   the GAS structure.
   the GAS structure.
 **/
 **/
-STATIC CONST ACPI_PARSER GasParser[] = {
-  {L"Address Space ID", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Register Bit Width", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Register Bit Offset", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Access Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  GasParser[] = {
+  { L"Address Space ID",    1, 0, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Register Bit Width",  1, 1, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Register Bit Offset", 1, 2, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Access Size",         1, 3, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Address",             8, 4, L"0x%lx", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -644,9 +658,9 @@ STATIC CONST ACPI_PARSER GasParser[] = {
 UINT32
 UINT32
 EFIAPI
 EFIAPI
 DumpGasStruct (
 DumpGasStruct (
-  IN UINT8*        Ptr,
-  IN UINT32        Indent,
-  IN UINT32        Length
+  IN UINT8   *Ptr,
+  IN UINT32  Indent,
+  IN UINT32  Length
   )
   )
 {
 {
   Print (L"\n");
   Print (L"\n");
@@ -669,8 +683,8 @@ DumpGasStruct (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpGas (
 DumpGas (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   )
   )
 {
 {
   DumpGasStruct (Ptr, 2, sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE));
   DumpGasStruct (Ptr, 2, sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE));
@@ -686,7 +700,7 @@ DumpGas (
 UINT32
 UINT32
 EFIAPI
 EFIAPI
 DumpAcpiHeader (
 DumpAcpiHeader (
-  IN UINT8* Ptr
+  IN UINT8  *Ptr
   )
   )
 {
 {
   return ParseAcpi (
   return ParseAcpi (
@@ -715,13 +729,13 @@ DumpAcpiHeader (
 UINT32
 UINT32
 EFIAPI
 EFIAPI
 ParseAcpiHeader (
 ParseAcpiHeader (
-  IN  UINT8*         Ptr,
-  OUT CONST UINT32** Signature,
-  OUT CONST UINT32** Length,
-  OUT CONST UINT8**  Revision
+  IN  UINT8         *Ptr,
+  OUT CONST UINT32  **Signature,
+  OUT CONST UINT32  **Length,
+  OUT CONST UINT8   **Revision
   )
   )
 {
 {
-  UINT32                        BytesParsed;
+  UINT32  BytesParsed;
 
 
   BytesParsed = ParseAcpi (
   BytesParsed = ParseAcpi (
                   FALSE,
                   FALSE,
@@ -733,8 +747,8 @@ ParseAcpiHeader (
                   );
                   );
 
 
   *Signature = AcpiHdrInfo.Signature;
   *Signature = AcpiHdrInfo.Signature;
-  *Length = AcpiHdrInfo.Length;
-  *Revision = AcpiHdrInfo.Revision;
+  *Length    = AcpiHdrInfo.Length;
+  *Revision  = AcpiHdrInfo.Revision;
 
 
   return BytesParsed;
   return BytesParsed;
 }
 }

+ 134 - 135
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h

@@ -50,9 +50,9 @@ IncrementWarningCount (
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 VerifyChecksum (
 VerifyChecksum (
-  IN BOOLEAN Log,
-  IN UINT8*  Ptr,
-  IN UINT32  Length
+  IN BOOLEAN  Log,
+  IN UINT8    *Ptr,
+  IN UINT32   Length
   );
   );
 
 
 /**
 /**
@@ -64,8 +64,8 @@ VerifyChecksum (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpRaw (
 DumpRaw (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   );
   );
 
 
 /**
 /**
@@ -77,8 +77,8 @@ DumpRaw (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpUint8 (
 DumpUint8 (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -90,8 +90,8 @@ DumpUint8 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpUint16 (
 DumpUint16 (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -103,8 +103,8 @@ DumpUint16 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpUint32 (
 DumpUint32 (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -116,8 +116,8 @@ DumpUint32 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpUint64 (
 DumpUint64 (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -132,8 +132,8 @@ DumpUint64 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump3Chars (
 Dump3Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -148,8 +148,8 @@ Dump3Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump4Chars (
 Dump4Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -164,8 +164,8 @@ Dump4Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump6Chars (
 Dump6Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -180,8 +180,8 @@ Dump6Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump8Chars (
 Dump8Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -196,8 +196,8 @@ Dump8Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 Dump12Chars (
 Dump12Chars (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN       UINT8*  Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN       UINT8   *Ptr
   );
   );
 
 
 /**
 /**
@@ -215,8 +215,8 @@ Dump12Chars (
 VOID
 VOID
 EFIAPI
 EFIAPI
 PrintFieldName (
 PrintFieldName (
-  IN UINT32         Indent,
-  IN CONST CHAR16*  FieldName
+  IN UINT32        Indent,
+  IN CONST CHAR16  *FieldName
   );
   );
 
 
 /**
 /**
@@ -226,7 +226,7 @@ PrintFieldName (
                       the 'Format' member of ACPI_PARSER.
                       the 'Format' member of ACPI_PARSER.
   @param [in] Ptr     Pointer to the start of the buffer.
   @param [in] Ptr     Pointer to the start of the buffer.
 **/
 **/
-typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16* Format, UINT8* Ptr);
+typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16 *Format, UINT8 *Ptr);
 
 
 /**
 /**
   This function pointer is the template for validating an ACPI table field.
   This function pointer is the template for validating an ACPI table field.
@@ -236,7 +236,7 @@ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16* Format, UINT8* Ptr);
                       the 'Context' member of the ACPI_PARSER.
                       the 'Context' member of the ACPI_PARSER.
                       e.g. this could be a pointer to the ACPI table header.
                       e.g. this could be a pointer to the ACPI table header.
 **/
 **/
-typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context);
+typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, VOID *Context);
 
 
 /**
 /**
   The ACPI_PARSER structure describes the fields of an ACPI table and
   The ACPI_PARSER structure describes the fields of an ACPI table and
@@ -258,48 +258,47 @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context);
   representing the field data.
   representing the field data.
 **/
 **/
 typedef struct AcpiParser {
 typedef struct AcpiParser {
-
   /// String describing the ACPI table field
   /// String describing the ACPI table field
   /// (Field column from ACPI table spec)
   /// (Field column from ACPI table spec)
-  CONST CHAR16*         NameStr;
+  CONST CHAR16             *NameStr;
 
 
   /// The length of the field.
   /// The length of the field.
   /// (Byte Length column from ACPI table spec)
   /// (Byte Length column from ACPI table spec)
-  UINT32                Length;
+  UINT32                   Length;
 
 
   /// The offset of the field from the start of the table.
   /// The offset of the field from the start of the table.
   /// (Byte Offset column from ACPI table spec)
   /// (Byte Offset column from ACPI table spec)
-  UINT32                Offset;
+  UINT32                   Offset;
 
 
   /// Optional Print() style format string for tracing the data. If not
   /// Optional Print() style format string for tracing the data. If not
   /// used this must be set to NULL.
   /// used this must be set to NULL.
-  CONST CHAR16*         Format;
+  CONST CHAR16             *Format;
 
 
   /// Optional pointer to a print formatter function which
   /// Optional pointer to a print formatter function which
   /// is typically used to trace complex field information.
   /// is typically used to trace complex field information.
   /// If not used this must be set to NULL.
   /// If not used this must be set to NULL.
   /// The Format string is passed to the PrintFormatter function
   /// The Format string is passed to the PrintFormatter function
   /// but may be ignored by the implementation code.
   /// but may be ignored by the implementation code.
-  FNPTR_PRINT_FORMATTER PrintFormatter;
+  FNPTR_PRINT_FORMATTER    PrintFormatter;
 
 
   /// Optional pointer which may be set to request the parser to update
   /// Optional pointer which may be set to request the parser to update
   /// a pointer to the field data. This value is set after the FieldValidator
   /// a pointer to the field data. This value is set after the FieldValidator
   /// has been called and therefore should not be used by the FieldValidator.
   /// has been called and therefore should not be used by the FieldValidator.
   /// If unused this must be set to NULL.
   /// If unused this must be set to NULL.
-  VOID**                ItemPtr;
+  VOID                     **ItemPtr;
 
 
   /// Optional pointer to a field validator function.
   /// Optional pointer to a field validator function.
   /// The function should directly report any appropriate error or warning
   /// The function should directly report any appropriate error or warning
   /// and invoke the appropriate counter update function.
   /// and invoke the appropriate counter update function.
   /// If not used this parameter must be set to NULL.
   /// If not used this parameter must be set to NULL.
-  FNPTR_FIELD_VALIDATOR FieldValidator;
+  FNPTR_FIELD_VALIDATOR    FieldValidator;
 
 
   /// Optional pointer to context specific information,
   /// Optional pointer to context specific information,
   /// which the Field Validator function can use to determine
   /// which the Field Validator function can use to determine
   /// additional information about the ACPI table and make
   /// additional information about the ACPI table and make
   /// decisions about the field being validated.
   /// decisions about the field being validated.
   /// e.g. this could be a pointer to the ACPI table header
   /// e.g. this could be a pointer to the ACPI table header
-  VOID*                 Context;
+  VOID                     *Context;
 } ACPI_PARSER;
 } ACPI_PARSER;
 
 
 /**
 /**
@@ -308,23 +307,23 @@ typedef struct AcpiParser {
 **/
 **/
 typedef struct AcpiDescriptionHeaderInfo {
 typedef struct AcpiDescriptionHeaderInfo {
   /// ACPI table signature
   /// ACPI table signature
-  UINT32* Signature;
+  UINT32    *Signature;
   /// Length of the ACPI table
   /// Length of the ACPI table
-  UINT32* Length;
+  UINT32    *Length;
   /// Revision
   /// Revision
-  UINT8*  Revision;
+  UINT8     *Revision;
   /// Checksum
   /// Checksum
-  UINT8*  Checksum;
+  UINT8     *Checksum;
   /// OEM Id - length is 6 bytes
   /// OEM Id - length is 6 bytes
-  UINT8*  OemId;
+  UINT8     *OemId;
   /// OEM table Id
   /// OEM table Id
-  UINT64* OemTableId;
+  UINT64    *OemTableId;
   /// OEM revision Id
   /// OEM revision Id
-  UINT32* OemRevision;
+  UINT32    *OemRevision;
   /// Creator Id
   /// Creator Id
-  UINT32* CreatorId;
+  UINT32    *CreatorId;
   /// Creator revision
   /// Creator revision
-  UINT32* CreatorRevision;
+  UINT32    *CreatorRevision;
 } ACPI_DESCRIPTION_HEADER_INFO;
 } ACPI_DESCRIPTION_HEADER_INFO;
 
 
 /**
 /**
@@ -358,10 +357,10 @@ EFIAPI
 ParseAcpi (
 ParseAcpi (
   IN BOOLEAN            Trace,
   IN BOOLEAN            Trace,
   IN UINT32             Indent,
   IN UINT32             Indent,
-  IN CONST CHAR8*       AsciiName OPTIONAL,
-  IN UINT8*             Ptr,
+  IN CONST CHAR8        *AsciiName OPTIONAL,
+  IN UINT8              *Ptr,
   IN UINT32             Length,
   IN UINT32             Length,
-  IN CONST ACPI_PARSER* Parser,
+  IN CONST ACPI_PARSER  *Parser,
   IN UINT32             ParserItems
   IN UINT32             ParserItems
   );
   );
 
 
@@ -371,7 +370,7 @@ ParseAcpi (
   @param [in] Parser The name of the ACPI_PARSER array describing the
   @param [in] Parser The name of the ACPI_PARSER array describing the
               ACPI table fields.
               ACPI table fields.
 **/
 **/
-#define PARSER_PARAMS(Parser) Parser, sizeof (Parser) / sizeof (Parser[0])
+#define PARSER_PARAMS(Parser)  Parser, sizeof (Parser) / sizeof (Parser[0])
 
 
 /**
 /**
   This is a helper macro for describing the ACPI header fields.
   This is a helper macro for describing the ACPI header fields.
@@ -410,9 +409,9 @@ ParseAcpi (
 UINT32
 UINT32
 EFIAPI
 EFIAPI
 DumpGasStruct (
 DumpGasStruct (
-  IN UINT8*        Ptr,
-  IN UINT32        Indent,
-  IN UINT32        Length
+  IN UINT8   *Ptr,
+  IN UINT32  Indent,
+  IN UINT32  Length
   );
   );
 
 
 /**
 /**
@@ -424,8 +423,8 @@ DumpGasStruct (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpGas (
 DumpGas (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   );
   );
 
 
 /**
 /**
@@ -438,7 +437,7 @@ DumpGas (
 UINT32
 UINT32
 EFIAPI
 EFIAPI
 DumpAcpiHeader (
 DumpAcpiHeader (
-  IN UINT8* Ptr
+  IN UINT8  *Ptr
   );
   );
 
 
 /**
 /**
@@ -457,10 +456,10 @@ DumpAcpiHeader (
 UINT32
 UINT32
 EFIAPI
 EFIAPI
 ParseAcpiHeader (
 ParseAcpiHeader (
-  IN  UINT8*         Ptr,
-  OUT CONST UINT32** Signature,
-  OUT CONST UINT32** Length,
-  OUT CONST UINT8**  Revision
+  IN  UINT8         *Ptr,
+  OUT CONST UINT32  **Signature,
+  OUT CONST UINT32  **Length,
+  OUT CONST UINT8   **Revision
   );
   );
 
 
 /**
 /**
@@ -478,10 +477,10 @@ ParseAcpiHeader (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiAest (
 ParseAcpiAest (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -499,10 +498,10 @@ ParseAcpiAest (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiBgrt (
 ParseAcpiBgrt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -520,10 +519,10 @@ ParseAcpiBgrt (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiDbg2 (
 ParseAcpiDbg2 (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -541,10 +540,10 @@ ParseAcpiDbg2 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiDsdt (
 ParseAcpiDsdt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -562,10 +561,10 @@ ParseAcpiDsdt (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiFacs (
 ParseAcpiFacs (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -583,10 +582,10 @@ ParseAcpiFacs (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiFadt (
 ParseAcpiFadt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -608,10 +607,10 @@ ParseAcpiFadt (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiGtdt (
 ParseAcpiGtdt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -634,10 +633,10 @@ ParseAcpiGtdt (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiHmat (
 ParseAcpiHmat (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -663,10 +662,10 @@ ParseAcpiHmat (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiIort (
 ParseAcpiIort (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -692,10 +691,10 @@ ParseAcpiIort (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiMadt (
 ParseAcpiMadt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -713,10 +712,10 @@ ParseAcpiMadt (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiMcfg (
 ParseAcpiMcfg (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -735,10 +734,10 @@ ParseAcpiMcfg (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiPcct (
 ParseAcpiPcct (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -756,10 +755,10 @@ ParseAcpiPcct (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiPptt (
 ParseAcpiPptt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -779,10 +778,10 @@ ParseAcpiPptt (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiRsdp (
 ParseAcpiRsdp (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -803,10 +802,10 @@ ParseAcpiRsdp (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiSlit (
 ParseAcpiSlit (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -824,10 +823,10 @@ ParseAcpiSlit (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiSpcr (
 ParseAcpiSpcr (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -851,10 +850,10 @@ ParseAcpiSpcr (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiSrat (
 ParseAcpiSrat (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -872,10 +871,10 @@ ParseAcpiSrat (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiSsdt (
 ParseAcpiSsdt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 /**
 /**
@@ -892,10 +891,10 @@ ParseAcpiSsdt (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiXsdt (
 ParseAcpiXsdt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   );
   );
 
 
 #endif // ACPIPARSER_H_
 #endif // ACPIPARSER_H_

+ 28 - 26
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c

@@ -19,14 +19,14 @@
 #include "AcpiView.h"
 #include "AcpiView.h"
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-#include "Arm/SbbrValidator.h"
+#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+  #include "Arm/SbbrValidator.h"
 #endif
 #endif
 
 
 /**
 /**
   A list of registered ACPI table parsers.
   A list of registered ACPI table parsers.
 **/
 **/
-STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS];
+STATIC ACPI_TABLE_PARSER  mTableParserList[MAX_ACPI_TABLE_PARSERS];
 
 
 /**
 /**
   Register the ACPI table Parser
   Register the ACPI table Parser
@@ -46,11 +46,11 @@ STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS];
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 RegisterParser (
 RegisterParser (
-  IN  UINT32                  Signature,
-  IN  PARSE_ACPI_TABLE_PROC   ParserProc
+  IN  UINT32                 Signature,
+  IN  PARSE_ACPI_TABLE_PROC  ParserProc
   )
   )
 {
 {
-  UINT32 Index;
+  UINT32  Index;
 
 
   if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
   if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
     return EFI_INVALID_PARAMETER;
     return EFI_INVALID_PARAMETER;
@@ -70,12 +70,12 @@ RegisterParser (
 
 
   // Find the first free slot and register the parser
   // Find the first free slot and register the parser
   for (Index = 0;
   for (Index = 0;
-      Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
-      Index++)
+       Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
+       Index++)
   {
   {
     if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) {
     if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) {
       mTableParserList[Index].Signature = Signature;
       mTableParserList[Index].Signature = Signature;
-      mTableParserList[Index].Parser = ParserProc;
+      mTableParserList[Index].Parser    = ParserProc;
       return EFI_SUCCESS;
       return EFI_SUCCESS;
     }
     }
   }
   }
@@ -98,10 +98,10 @@ RegisterParser (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 DeregisterParser (
 DeregisterParser (
-  IN  UINT32                  Signature
+  IN  UINT32  Signature
   )
   )
 {
 {
-  UINT32 Index;
+  UINT32  Index;
 
 
   if (Signature == ACPI_PARSER_SIGNATURE_NULL) {
   if (Signature == ACPI_PARSER_SIGNATURE_NULL) {
     return EFI_INVALID_PARAMETER;
     return EFI_INVALID_PARAMETER;
@@ -113,7 +113,7 @@ DeregisterParser (
   {
   {
     if (Signature == mTableParserList[Index].Signature) {
     if (Signature == mTableParserList[Index].Signature) {
       mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL;
       mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL;
-      mTableParserList[Index].Parser = NULL;
+      mTableParserList[Index].Parser    = NULL;
       return EFI_SUCCESS;
       return EFI_SUCCESS;
     }
     }
   }
   }
@@ -138,11 +138,11 @@ DeregisterParser (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 GetParser (
 GetParser (
-  IN  UINT32                   Signature,
-  OUT PARSE_ACPI_TABLE_PROC *  ParserProc
+  IN  UINT32                 Signature,
+  OUT PARSE_ACPI_TABLE_PROC  *ParserProc
   )
   )
 {
 {
-  UINT32 Index;
+  UINT32  Index;
 
 
   if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
   if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
     return EFI_INVALID_PARAMETER;
     return EFI_INVALID_PARAMETER;
@@ -179,16 +179,16 @@ GetParser (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ProcessAcpiTable (
 ProcessAcpiTable (
-  IN UINT8* Ptr
+  IN UINT8  *Ptr
   )
   )
 {
 {
-  EFI_STATUS    Status;
-  BOOLEAN       Trace;
-  CONST UINT32* AcpiTableSignature;
-  CONST UINT32* AcpiTableLength;
-  CONST UINT8*  AcpiTableRevision;
-  CONST UINT8*  SignaturePtr;
-  PARSE_ACPI_TABLE_PROC ParserProc;
+  EFI_STATUS             Status;
+  BOOLEAN                Trace;
+  CONST UINT32           *AcpiTableSignature;
+  CONST UINT32           *AcpiTableLength;
+  CONST UINT8            *AcpiTableRevision;
+  CONST UINT8            *SignaturePtr;
+  PARSE_ACPI_TABLE_PROC  ParserProc;
 
 
   ParseAcpiHeader (
   ParseAcpiHeader (
     Ptr,
     Ptr,
@@ -209,7 +209,7 @@ ProcessAcpiTable (
     // Do not process the ACPI table any further if the table length read
     // Do not process the ACPI table any further if the table length read
     // is invalid. The ACPI table should at least contain the table header.
     // is invalid. The ACPI table should at least contain the table header.
     if (*AcpiTableLength < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
     if (*AcpiTableLength < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
-      SignaturePtr = (CONST UINT8*)AcpiTableSignature;
+      SignaturePtr = (CONST UINT8 *)AcpiTableSignature;
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid %c%c%c%c table length. Length = %d\n",
         L"ERROR: Invalid %c%c%c%c table length. Length = %d\n",
@@ -227,11 +227,12 @@ ProcessAcpiTable (
     }
     }
   }
   }
 
 
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
   if (GetMandatoryTableValidate ()) {
   if (GetMandatoryTableValidate ()) {
     ArmSbbrIncrementTableCount (*AcpiTableSignature);
     ArmSbbrIncrementTableCount (*AcpiTableSignature);
   }
   }
-#endif
+
+ #endif
 
 
   Status = GetParser (*AcpiTableSignature, &ParserProc);
   Status = GetParser (*AcpiTableSignature, &ParserProc);
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
@@ -239,6 +240,7 @@ ProcessAcpiTable (
     if (Trace) {
     if (Trace) {
       DumpAcpiHeader (Ptr);
       DumpAcpiHeader (Ptr);
     }
     }
+
     return;
     return;
   }
   }
 
 

+ 12 - 12
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h

@@ -11,11 +11,11 @@
 /**
 /**
   The maximum number of ACPI table parsers.
   The maximum number of ACPI table parsers.
 */
 */
-#define MAX_ACPI_TABLE_PARSERS          32
+#define MAX_ACPI_TABLE_PARSERS  32
 
 
 /** An invalid/NULL signature value.
 /** An invalid/NULL signature value.
 */
 */
-#define ACPI_PARSER_SIGNATURE_NULL      0
+#define ACPI_PARSER_SIGNATURE_NULL  0
 
 
 /**
 /**
   A function that parses the ACPI table.
   A function that parses the ACPI table.
@@ -27,9 +27,9 @@
 **/
 **/
 typedef
 typedef
 VOID
 VOID
-(EFIAPI * PARSE_ACPI_TABLE_PROC) (
+(EFIAPI *PARSE_ACPI_TABLE_PROC)(
   IN BOOLEAN Trace,
   IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
+  IN UINT8 *Ptr,
   IN UINT32  AcpiTableLength,
   IN UINT32  AcpiTableLength,
   IN UINT8   AcpiTableRevision
   IN UINT8   AcpiTableRevision
   );
   );
@@ -39,10 +39,10 @@ VOID
 **/
 **/
 typedef struct AcpiTableParser {
 typedef struct AcpiTableParser {
   /// ACPI table signature
   /// ACPI table signature
-  UINT32                  Signature;
+  UINT32                   Signature;
 
 
   /// The ACPI table parser function.
   /// The ACPI table parser function.
-  PARSE_ACPI_TABLE_PROC   Parser;
+  PARSE_ACPI_TABLE_PROC    Parser;
 } ACPI_TABLE_PARSER;
 } ACPI_TABLE_PARSER;
 
 
 /**
 /**
@@ -63,8 +63,8 @@ typedef struct AcpiTableParser {
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 RegisterParser (
 RegisterParser (
-  IN  UINT32                  Signature,
-  IN  PARSE_ACPI_TABLE_PROC   ParserProc
+  IN  UINT32                 Signature,
+  IN  PARSE_ACPI_TABLE_PROC  ParserProc
   );
   );
 
 
 /**
 /**
@@ -81,7 +81,7 @@ RegisterParser (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 DeregisterParser (
 DeregisterParser (
-  IN  UINT32                  Signature
+  IN  UINT32  Signature
   );
   );
 
 
 /**
 /**
@@ -101,7 +101,7 @@ DeregisterParser (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ProcessAcpiTable (
 ProcessAcpiTable (
-  IN UINT8* Ptr
+  IN UINT8  *Ptr
   );
   );
 
 
 /**
 /**
@@ -120,8 +120,8 @@ ProcessAcpiTable (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 GetParser (
 GetParser (
-  IN  UINT32                   Signature,
-  OUT PARSE_ACPI_TABLE_PROC *  ParserProc
+  IN  UINT32                 Signature,
+  OUT PARSE_ACPI_TABLE_PROC  *ParserProc
   );
   );
 
 
 #endif // ACPITABLEPARSER_H_
 #endif // ACPITABLEPARSER_H_

+ 63 - 47
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c

@@ -23,12 +23,12 @@
 #include "AcpiView.h"
 #include "AcpiView.h"
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-#include "Arm/SbbrValidator.h"
+#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+  #include "Arm/SbbrValidator.h"
 #endif
 #endif
 
 
-STATIC UINT32             mTableCount;
-STATIC UINT32             mBinTableCount;
+STATIC UINT32  mTableCount;
+STATIC UINT32  mBinTableCount;
 
 
 /**
 /**
   This function dumps the ACPI table to a file.
   This function dumps the ACPI table to a file.
@@ -42,13 +42,13 @@ STATIC UINT32             mBinTableCount;
 STATIC
 STATIC
 BOOLEAN
 BOOLEAN
 DumpAcpiTableToFile (
 DumpAcpiTableToFile (
-  IN CONST UINT8*  Ptr,
-  IN CONST UINTN   Length
+  IN CONST UINT8  *Ptr,
+  IN CONST UINTN  Length
   )
   )
 {
 {
-  CHAR16              FileNameBuffer[MAX_FILE_NAME_LEN];
-  UINTN               TransferBytes;
-  SELECTED_ACPI_TABLE *SelectedTable;
+  CHAR16               FileNameBuffer[MAX_FILE_NAME_LEN];
+  UINTN                TransferBytes;
+  SELECTED_ACPI_TABLE  *SelectedTable;
 
 
   GetSelectedAcpiTable (&SelectedTable);
   GetSelectedAcpiTable (&SelectedTable);
 
 
@@ -78,7 +78,7 @@ DumpAcpiTableToFile (
 BOOLEAN
 BOOLEAN
 ProcessTableReportOptions (
 ProcessTableReportOptions (
   IN CONST UINT32  Signature,
   IN CONST UINT32  Signature,
-  IN CONST UINT8*  TablePtr,
+  IN CONST UINT8   *TablePtr,
   IN CONST UINT32  Length
   IN CONST UINT32  Length
   )
   )
 {
 {
@@ -92,9 +92,9 @@ ProcessTableReportOptions (
   // set local variables to suppress incorrect compiler/analyzer warnings
   // set local variables to suppress incorrect compiler/analyzer warnings
   //
   //
   OriginalAttribute = 0;
   OriginalAttribute = 0;
-  SignaturePtr = (UINT8*)(UINTN)&Signature;
-  Log = FALSE;
-  HighLight = GetColourHighlighting ();
+  SignaturePtr      = (UINT8 *)(UINTN)&Signature;
+  Log               = FALSE;
+  HighLight         = GetColourHighlighting ();
   GetSelectedAcpiTable (&SelectedTable);
   GetSelectedAcpiTable (&SelectedTable);
 
 
   switch (GetReportOption ()) {
   switch (GetReportOption ()) {
@@ -103,9 +103,10 @@ ProcessTableReportOptions (
       break;
       break;
     case ReportSelected:
     case ReportSelected:
       if (Signature == SelectedTable->Type) {
       if (Signature == SelectedTable->Type) {
-        Log = TRUE;
+        Log                  = TRUE;
         SelectedTable->Found = TRUE;
         SelectedTable->Found = TRUE;
       }
       }
+
       break;
       break;
     case ReportTableList:
     case ReportTableList:
       if (mTableCount == 0) {
       if (mTableCount == 0) {
@@ -113,15 +114,19 @@ ProcessTableReportOptions (
           OriginalAttribute = gST->ConOut->Mode->Attribute;
           OriginalAttribute = gST->ConOut->Mode->Attribute;
           gST->ConOut->SetAttribute (
           gST->ConOut->SetAttribute (
                          gST->ConOut,
                          gST->ConOut,
-                         EFI_TEXT_ATTR(EFI_CYAN,
-                           ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
+                         EFI_TEXT_ATTR (
+                           EFI_CYAN,
+                           ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+                           )
                          );
                          );
         }
         }
+
         Print (L"\nInstalled Table(s):\n");
         Print (L"\nInstalled Table(s):\n");
         if (HighLight) {
         if (HighLight) {
           gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
           gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
         }
         }
       }
       }
+
       Print (
       Print (
         L"\t%4d. %c%c%c%c\n",
         L"\t%4d. %c%c%c%c\n",
         ++mTableCount,
         ++mTableCount,
@@ -136,6 +141,7 @@ ProcessTableReportOptions (
         SelectedTable->Found = TRUE;
         SelectedTable->Found = TRUE;
         DumpAcpiTableToFile (TablePtr, Length);
         DumpAcpiTableToFile (TablePtr, Length);
       }
       }
+
       break;
       break;
     case ReportMax:
     case ReportMax:
       // We should never be here.
       // We should never be here.
@@ -148,10 +154,13 @@ ProcessTableReportOptions (
       OriginalAttribute = gST->ConOut->Mode->Attribute;
       OriginalAttribute = gST->ConOut->Mode->Attribute;
       gST->ConOut->SetAttribute (
       gST->ConOut->SetAttribute (
                      gST->ConOut,
                      gST->ConOut,
-                     EFI_TEXT_ATTR(EFI_LIGHTBLUE,
-                       ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
+                     EFI_TEXT_ATTR (
+                       EFI_LIGHTBLUE,
+                       ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+                       )
                      );
                      );
     }
     }
+
     Print (
     Print (
       L"\n\n --------------- %c%c%c%c Table --------------- \n\n",
       L"\n\n --------------- %c%c%c%c Table --------------- \n\n",
       SignaturePtr[0],
       SignaturePtr[0],
@@ -167,8 +176,6 @@ ProcessTableReportOptions (
   return Log;
   return Log;
 }
 }
 
 
-
-
 /**
 /**
   This function iterates the configuration table entries in the
   This function iterates the configuration table entries in the
   system table, retrieves the RSDP pointer and starts parsing the ACPI tables.
   system table, retrieves the RSDP pointer and starts parsing the ACPI tables.
@@ -182,17 +189,17 @@ ProcessTableReportOptions (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 AcpiView (
 AcpiView (
-  IN EFI_SYSTEM_TABLE* SystemTable
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
   EFI_STATUS               Status;
   EFI_STATUS               Status;
   UINTN                    Index;
   UINTN                    Index;
-  EFI_CONFIGURATION_TABLE* EfiConfigurationTable;
+  EFI_CONFIGURATION_TABLE  *EfiConfigurationTable;
   BOOLEAN                  FoundAcpiTable;
   BOOLEAN                  FoundAcpiTable;
   UINTN                    OriginalAttribute;
   UINTN                    OriginalAttribute;
   UINTN                    PrintAttribute;
   UINTN                    PrintAttribute;
   EREPORT_OPTION           ReportOption;
   EREPORT_OPTION           ReportOption;
-  UINT8*                   RsdpPtr;
+  UINT8                    *RsdpPtr;
   UINT32                   RsdpLength;
   UINT32                   RsdpLength;
   UINT8                    RsdpRevision;
   UINT8                    RsdpRevision;
   PARSE_ACPI_TABLE_PROC    RsdpParserProc;
   PARSE_ACPI_TABLE_PROC    RsdpParserProc;
@@ -203,10 +210,10 @@ AcpiView (
   // set local variables to suppress incorrect compiler/analyzer warnings
   // set local variables to suppress incorrect compiler/analyzer warnings
   //
   //
   EfiConfigurationTable = NULL;
   EfiConfigurationTable = NULL;
-  OriginalAttribute = 0;
+  OriginalAttribute     = 0;
 
 
   // Reset Table counts
   // Reset Table counts
-  mTableCount = 0;
+  mTableCount    = 0;
   mBinTableCount = 0;
   mBinTableCount = 0;
 
 
   // Reset The error/warning counters
   // Reset The error/warning counters
@@ -219,16 +226,19 @@ AcpiView (
   // Search the table for an entry that matches the ACPI Table Guid
   // Search the table for an entry that matches the ACPI Table Guid
   FoundAcpiTable = FALSE;
   FoundAcpiTable = FALSE;
   for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
   for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
-    if (CompareGuid (&gEfiAcpiTableGuid,
-          &(SystemTable->ConfigurationTable[Index].VendorGuid))) {
+    if (CompareGuid (
+          &gEfiAcpiTableGuid,
+          &(SystemTable->ConfigurationTable[Index].VendorGuid)
+          ))
+    {
       EfiConfigurationTable = &SystemTable->ConfigurationTable[Index];
       EfiConfigurationTable = &SystemTable->ConfigurationTable[Index];
-      FoundAcpiTable = TRUE;
+      FoundAcpiTable        = TRUE;
       break;
       break;
     }
     }
   }
   }
 
 
   if (FoundAcpiTable) {
   if (FoundAcpiTable) {
-    RsdpPtr = (UINT8*)EfiConfigurationTable->VendorTable;
+    RsdpPtr = (UINT8 *)EfiConfigurationTable->VendorTable;
 
 
     // The RSDP revision is 1 byte starting at offset 15
     // The RSDP revision is 1 byte starting at offset 15
     RsdpRevision = *(RsdpPtr + RSDP_REVISION_OFFSET);
     RsdpRevision = *(RsdpPtr + RSDP_REVISION_OFFSET);
@@ -240,14 +250,15 @@ AcpiView (
       return EFI_UNSUPPORTED;
       return EFI_UNSUPPORTED;
     }
     }
 
 
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
     if (GetMandatoryTableValidate ()) {
     if (GetMandatoryTableValidate ()) {
       ArmSbbrResetTableCounts ();
       ArmSbbrResetTableCounts ();
     }
     }
-#endif
+
+ #endif
 
 
     // The RSDP length is 4 bytes starting at offset 20
     // The RSDP length is 4 bytes starting at offset 20
-    RsdpLength = *(UINT32*)(RsdpPtr + RSDP_LENGTH_OFFSET);
+    RsdpLength = *(UINT32 *)(RsdpPtr + RSDP_LENGTH_OFFSET);
 
 
     Trace = ProcessTableReportOptions (RSDP_TABLE_INFO, RsdpPtr, RsdpLength);
     Trace = ProcessTableReportOptions (RSDP_TABLE_INFO, RsdpPtr, RsdpLength);
 
 
@@ -265,7 +276,6 @@ AcpiView (
       RsdpLength,
       RsdpLength,
       RsdpRevision
       RsdpRevision
       );
       );
-
   } else {
   } else {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
@@ -274,45 +284,50 @@ AcpiView (
     return EFI_NOT_FOUND;
     return EFI_NOT_FOUND;
   }
   }
 
 
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
   if (GetMandatoryTableValidate ()) {
   if (GetMandatoryTableValidate ()) {
     ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ());
     ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ());
   }
   }
-#endif
+
+ #endif
 
 
   ReportOption = GetReportOption ();
   ReportOption = GetReportOption ();
   if (ReportTableList != ReportOption) {
   if (ReportTableList != ReportOption) {
     if (((ReportSelected == ReportOption)  ||
     if (((ReportSelected == ReportOption)  ||
          (ReportDumpBinFile == ReportOption)) &&
          (ReportDumpBinFile == ReportOption)) &&
-        (!SelectedTable->Found)) {
+        (!SelectedTable->Found))
+    {
       Print (L"\nRequested ACPI Table not found.\n");
       Print (L"\nRequested ACPI Table not found.\n");
     } else if (GetConsistencyChecking () &&
     } else if (GetConsistencyChecking () &&
-               (ReportDumpBinFile != ReportOption)) {
+               (ReportDumpBinFile != ReportOption))
+    {
       OriginalAttribute = gST->ConOut->Mode->Attribute;
       OriginalAttribute = gST->ConOut->Mode->Attribute;
 
 
       Print (L"\nTable Statistics:\n");
       Print (L"\nTable Statistics:\n");
 
 
       if (GetColourHighlighting ()) {
       if (GetColourHighlighting ()) {
         PrintAttribute = (GetErrorCount () > 0) ?
         PrintAttribute = (GetErrorCount () > 0) ?
-                            EFI_TEXT_ATTR (
-                              EFI_RED,
-                              ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
-                              ) :
-                            OriginalAttribute;
+                         EFI_TEXT_ATTR (
+                           EFI_RED,
+                           ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+                           ) :
+                         OriginalAttribute;
         gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
         gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
       }
       }
+
       Print (L"\t%d Error(s)\n", GetErrorCount ());
       Print (L"\t%d Error(s)\n", GetErrorCount ());
 
 
       if (GetColourHighlighting ()) {
       if (GetColourHighlighting ()) {
         PrintAttribute = (GetWarningCount () > 0) ?
         PrintAttribute = (GetWarningCount () > 0) ?
-                            EFI_TEXT_ATTR (
-                              EFI_RED,
-                              ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
-                              ) :
-                            OriginalAttribute;
+                         EFI_TEXT_ATTR (
+                           EFI_RED,
+                           ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+                           ) :
+                         OriginalAttribute;
 
 
         gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
         gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
       }
       }
+
       Print (L"\t%d Warning(s)\n", GetWarningCount ());
       Print (L"\t%d Warning(s)\n", GetWarningCount ());
 
 
       if (GetColourHighlighting ()) {
       if (GetColourHighlighting ()) {
@@ -320,5 +335,6 @@ AcpiView (
       }
       }
     }
     }
   }
   }
+
   return EFI_SUCCESS;
   return EFI_SUCCESS;
 }
 }

+ 5 - 5
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h

@@ -11,17 +11,17 @@
 /**
 /**
   A macro to define the max file name length
   A macro to define the max file name length
 **/
 **/
-#define MAX_FILE_NAME_LEN    128
+#define MAX_FILE_NAME_LEN  128
 
 
 /**
 /**
   Offset to the RSDP revision from the start of the RSDP
   Offset to the RSDP revision from the start of the RSDP
 **/
 **/
-#define RSDP_REVISION_OFFSET 15
+#define RSDP_REVISION_OFFSET  15
 
 
 /**
 /**
   Offset to the RSDP length from the start of the RSDP
   Offset to the RSDP length from the start of the RSDP
 **/
 **/
-#define RSDP_LENGTH_OFFSET   20
+#define RSDP_LENGTH_OFFSET  20
 
 
 /**
 /**
   This function resets the ACPI table error counter to Zero.
   This function resets the ACPI table error counter to Zero.
@@ -71,7 +71,7 @@ GetWarningCount (
 BOOLEAN
 BOOLEAN
 ProcessTableReportOptions (
 ProcessTableReportOptions (
   IN CONST UINT32  Signature,
   IN CONST UINT32  Signature,
-  IN CONST UINT8*  TablePtr,
+  IN CONST UINT8   *TablePtr,
   IN CONST UINT32  Length
   IN CONST UINT32  Length
   );
   );
 
 
@@ -88,7 +88,7 @@ ProcessTableReportOptions (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 AcpiView (
 AcpiView (
-  IN EFI_SYSTEM_TABLE* SystemTable
+  IN EFI_SYSTEM_TABLE  *SystemTable
   );
   );
 
 
 #endif // ACPIVIEW_H_
 #endif // ACPIVIEW_H_

+ 26 - 24
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c

@@ -11,14 +11,14 @@
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
 // Report variables
 // Report variables
-STATIC BOOLEAN        mConsistencyCheck;
-STATIC BOOLEAN        mColourHighlighting;
-STATIC EREPORT_OPTION mReportType;
-STATIC BOOLEAN        mMandatoryTableValidate;
-STATIC UINTN          mMandatoryTableSpec;
+STATIC BOOLEAN         mConsistencyCheck;
+STATIC BOOLEAN         mColourHighlighting;
+STATIC EREPORT_OPTION  mReportType;
+STATIC BOOLEAN         mMandatoryTableValidate;
+STATIC UINTN           mMandatoryTableSpec;
 
 
 // User selection of which ACPI table should be checked
 // User selection of which ACPI table should be checked
-SELECTED_ACPI_TABLE mSelectedAcpiTable;
+SELECTED_ACPI_TABLE  mSelectedAcpiTable;
 
 
 /**
 /**
  Reset the AcpiView user configuration to defaults
  Reset the AcpiView user configuration to defaults
@@ -29,13 +29,13 @@ AcpiConfigSetDefaults (
   VOID
   VOID
   )
   )
 {
 {
-  mReportType = ReportAll;
-  mSelectedAcpiTable.Type = 0;
-  mSelectedAcpiTable.Name = NULL;
+  mReportType              = ReportAll;
+  mSelectedAcpiTable.Type  = 0;
+  mSelectedAcpiTable.Name  = NULL;
   mSelectedAcpiTable.Found = FALSE;
   mSelectedAcpiTable.Found = FALSE;
-  mConsistencyCheck = TRUE;
-  mMandatoryTableValidate = FALSE;
-  mMandatoryTableSpec = 0;
+  mConsistencyCheck        = TRUE;
+  mMandatoryTableValidate  = FALSE;
+  mMandatoryTableSpec      = 0;
 }
 }
 
 
 /**
 /**
@@ -49,25 +49,27 @@ AcpiConfigSetDefaults (
 STATIC
 STATIC
 UINT32
 UINT32
 ConvertStrToAcpiSignature (
 ConvertStrToAcpiSignature (
-  IN CONST CHAR16 *Str
+  IN CONST CHAR16  *Str
   )
   )
 {
 {
-  UINT8 Index;
-  CHAR8 Ptr[4];
+  UINT8  Index;
+  CHAR8  Ptr[4];
 
 
   ZeroMem (Ptr, sizeof (Ptr));
   ZeroMem (Ptr, sizeof (Ptr));
   Index = 0;
   Index = 0;
 
 
   // Convert to Upper case and convert to ASCII
   // Convert to Upper case and convert to ASCII
   while ((Index < 4) && (Str[Index] != 0)) {
   while ((Index < 4) && (Str[Index] != 0)) {
-    if (Str[Index] >= L'a' && Str[Index] <= L'z') {
+    if ((Str[Index] >= L'a') && (Str[Index] <= L'z')) {
       Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A'));
       Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A'));
     } else {
     } else {
       Ptr[Index] = (CHAR8)Str[Index];
       Ptr[Index] = (CHAR8)Str[Index];
     }
     }
+
     Index++;
     Index++;
   }
   }
-  return *(UINT32 *) Ptr;
+
+  return *(UINT32 *)Ptr;
 }
 }
 
 
 /**
 /**
@@ -80,7 +82,7 @@ ConvertStrToAcpiSignature (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SelectAcpiTable (
 SelectAcpiTable (
-  IN CONST CHAR16 *TableName
+  IN CONST CHAR16  *TableName
   )
   )
 {
 {
   ASSERT (TableName != NULL);
   ASSERT (TableName != NULL);
@@ -97,7 +99,7 @@ SelectAcpiTable (
 VOID
 VOID
 EFIAPI
 EFIAPI
 GetSelectedAcpiTable (
 GetSelectedAcpiTable (
-  OUT SELECTED_ACPI_TABLE **SelectedAcpiTable
+  OUT SELECTED_ACPI_TABLE  **SelectedAcpiTable
   )
   )
 {
 {
   *SelectedAcpiTable = &mSelectedAcpiTable;
   *SelectedAcpiTable = &mSelectedAcpiTable;
@@ -125,7 +127,7 @@ GetColourHighlighting (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetColourHighlighting (
 SetColourHighlighting (
-  BOOLEAN Highlight
+  BOOLEAN  Highlight
   )
   )
 {
 {
   mColourHighlighting = Highlight;
   mColourHighlighting = Highlight;
@@ -153,7 +155,7 @@ GetConsistencyChecking (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetConsistencyChecking (
 SetConsistencyChecking (
-  BOOLEAN ConsistencyChecking
+  BOOLEAN  ConsistencyChecking
   )
   )
 {
 {
   mConsistencyCheck = ConsistencyChecking;
   mConsistencyCheck = ConsistencyChecking;
@@ -181,7 +183,7 @@ GetReportOption (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetReportOption (
 SetReportOption (
-  EREPORT_OPTION ReportType
+  EREPORT_OPTION  ReportType
   )
   )
 {
 {
   mReportType = ReportType;
   mReportType = ReportType;
@@ -209,7 +211,7 @@ GetMandatoryTableValidate (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetMandatoryTableValidate (
 SetMandatoryTableValidate (
-  BOOLEAN Validate
+  BOOLEAN  Validate
   )
   )
 {
 {
   mMandatoryTableValidate = Validate;
   mMandatoryTableValidate = Validate;
@@ -239,7 +241,7 @@ GetMandatoryTableSpec (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetMandatoryTableSpec (
 SetMandatoryTableSpec (
-  UINTN Spec
+  UINTN  Spec
   )
   )
 {
 {
   mMandatoryTableSpec = Spec;
   mMandatoryTableSpec = Spec;

+ 10 - 10
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h

@@ -27,7 +27,7 @@ GetColourHighlighting (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetColourHighlighting (
 SetColourHighlighting (
-  BOOLEAN Highlight
+  BOOLEAN  Highlight
   );
   );
 
 
 /**
 /**
@@ -49,7 +49,7 @@ GetConsistencyChecking (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetConsistencyChecking (
 SetConsistencyChecking (
-  BOOLEAN ConsistencyChecking
+  BOOLEAN  ConsistencyChecking
   );
   );
 
 
 /**
 /**
@@ -71,7 +71,7 @@ GetMandatoryTableValidate (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetMandatoryTableValidate (
 SetMandatoryTableValidate (
-  BOOLEAN Validate
+  BOOLEAN  Validate
   );
   );
 
 
 /**
 /**
@@ -95,7 +95,7 @@ GetMandatoryTableSpec (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetMandatoryTableSpec (
 SetMandatoryTableSpec (
-  UINTN Spec
+  UINTN  Spec
   );
   );
 
 
 /**
 /**
@@ -128,7 +128,7 @@ GetReportOption (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SetReportOption (
 SetReportOption (
-  EREPORT_OPTION ReportType
+  EREPORT_OPTION  ReportType
   );
   );
 
 
 /**
 /**
@@ -136,9 +136,9 @@ SetReportOption (
   ACPI table is to be examined by the AcpiView code.
   ACPI table is to be examined by the AcpiView code.
 **/
 **/
 typedef struct {
 typedef struct {
-  UINT32              Type;    ///< 32bit signature of the selected ACPI table.
-  CONST CHAR16*       Name;    ///< User friendly name of the selected ACPI table.
-  BOOLEAN             Found;   ///< The selected table has been found in the system.
+  UINT32          Type;        ///< 32bit signature of the selected ACPI table.
+  CONST CHAR16    *Name;       ///< User friendly name of the selected ACPI table.
+  BOOLEAN         Found;       ///< The selected table has been found in the system.
 } SELECTED_ACPI_TABLE;
 } SELECTED_ACPI_TABLE;
 
 
 /**
 /**
@@ -149,7 +149,7 @@ typedef struct {
 VOID
 VOID
 EFIAPI
 EFIAPI
 GetSelectedAcpiTable (
 GetSelectedAcpiTable (
-  OUT SELECTED_ACPI_TABLE** SelectedAcpiTable
+  OUT SELECTED_ACPI_TABLE  **SelectedAcpiTable
   );
   );
 
 
 /**
 /**
@@ -162,7 +162,7 @@ GetSelectedAcpiTable (
 VOID
 VOID
 EFIAPI
 EFIAPI
 SelectAcpiTable (
 SelectAcpiTable (
-  CONST CHAR16* TableName
+  CONST CHAR16  *TableName
   );
   );
 
 
 /**
 /**

+ 28 - 27
ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.c

@@ -23,7 +23,7 @@
 /**
 /**
   SBBR specification version strings
   SBBR specification version strings
 **/
 **/
-STATIC CONST CHAR8* ArmSbbrVersions[ArmSbbrVersionMax] = {
+STATIC CONST CHAR8  *ArmSbbrVersions[ArmSbbrVersionMax] = {
   "1.0",     // ArmSbbrVersion_1_0
   "1.0",     // ArmSbbrVersion_1_0
   "1.1",     // ArmSbbrVersion_1_1
   "1.1",     // ArmSbbrVersion_1_1
   "1.2"      // ArmSbbrVersion_1_2
   "1.2"      // ArmSbbrVersion_1_2
@@ -32,7 +32,7 @@ STATIC CONST CHAR8* ArmSbbrVersions[ArmSbbrVersionMax] = {
 /**
 /**
   SBBR 1.0 mandatory ACPI tables
   SBBR 1.0 mandatory ACPI tables
 **/
 **/
-STATIC CONST UINT32 ArmSbbr10Mandatory[] = {
+STATIC CONST UINT32  ArmSbbr10Mandatory[] = {
   EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@@ -45,7 +45,7 @@ STATIC CONST UINT32 ArmSbbr10Mandatory[] = {
 /**
 /**
   SBBR 1.1 mandatory ACPI tables
   SBBR 1.1 mandatory ACPI tables
 **/
 **/
-STATIC CONST UINT32 ArmSbbr11Mandatory[] = {
+STATIC CONST UINT32  ArmSbbr11Mandatory[] = {
   EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@@ -59,7 +59,7 @@ STATIC CONST UINT32 ArmSbbr11Mandatory[] = {
 /**
 /**
   SBBR 1.2 mandatory ACPI tables
   SBBR 1.2 mandatory ACPI tables
 **/
 **/
-STATIC CONST UINT32 ArmSbbr12Mandatory[] = {
+STATIC CONST UINT32  ArmSbbr12Mandatory[] = {
   EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
   EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@@ -74,7 +74,7 @@ STATIC CONST UINT32 ArmSbbr12Mandatory[] = {
 /**
 /**
   Mandatory ACPI tables for every SBBR specification version.
   Mandatory ACPI tables for every SBBR specification version.
 **/
 **/
-STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
+STATIC CONST ACPI_SBBR_REQ  ArmSbbrReqs[ArmSbbrVersionMax] = {
   { ArmSbbr10Mandatory, ARRAY_SIZE (ArmSbbr10Mandatory) },    // SBBR v1.0
   { ArmSbbr10Mandatory, ARRAY_SIZE (ArmSbbr10Mandatory) },    // SBBR v1.0
   { ArmSbbr11Mandatory, ARRAY_SIZE (ArmSbbr11Mandatory) },    // SBBR v1.1
   { ArmSbbr11Mandatory, ARRAY_SIZE (ArmSbbr11Mandatory) },    // SBBR v1.1
   { ArmSbbr12Mandatory, ARRAY_SIZE (ArmSbbr12Mandatory) }     // SBBR v1.2
   { ArmSbbr12Mandatory, ARRAY_SIZE (ArmSbbr12Mandatory) }     // SBBR v1.2
@@ -84,16 +84,16 @@ STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
   Data structure to track instance counts for all ACPI tables which are
   Data structure to track instance counts for all ACPI tables which are
   defined as 'mandatory' in any SBBR version.
   defined as 'mandatory' in any SBBR version.
 **/
 **/
-STATIC ACPI_TABLE_COUNTER ArmSbbrTableCounts[] = {
-  {EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0},
-  {EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, 0},
-  {EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0},
-  {EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, 0},
-  {EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, 0},
-  {EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, 0},
-  {EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, 0},
-  {EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, 0},
-  {EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE, 0}
+STATIC ACPI_TABLE_COUNTER  ArmSbbrTableCounts[] = {
+  { EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,                                            0 },
+  { EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,                                                 0 },
+  { EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,                                      0 },
+  { EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,                                              0 },
+  { EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,                                              0 },
+  { EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE,                                                           0 },
+  { EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,                                        0 },
+  { EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, 0 },
+  { EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,                                0 }
 };
 };
 
 
 /**
 /**
@@ -105,7 +105,7 @@ ArmSbbrResetTableCounts (
   VOID
   VOID
   )
   )
 {
 {
-  UINT32 Table;
+  UINT32  Table;
 
 
   for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
   for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
     ArmSbbrTableCounts[Table].Count = 0;
     ArmSbbrTableCounts[Table].Count = 0;
@@ -124,10 +124,10 @@ ArmSbbrResetTableCounts (
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 ArmSbbrIncrementTableCount (
 ArmSbbrIncrementTableCount (
-  UINT32 Signature
+  UINT32  Signature
   )
   )
 {
 {
-  UINT32 Table;
+  UINT32  Table;
 
 
   for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
   for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
     if (Signature == ArmSbbrTableCounts[Table].Signature) {
     if (Signature == ArmSbbrTableCounts[Table].Signature) {
@@ -154,14 +154,14 @@ ArmSbbrIncrementTableCount (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ArmSbbrReqsValidate (
 ArmSbbrReqsValidate (
-  ARM_SBBR_VERSION Version
+  ARM_SBBR_VERSION  Version
   )
   )
 {
 {
-  UINT32        Table;
-  UINT32        Index;
-  UINT32        MandatoryTable;
-  CONST UINT8*  SignaturePtr;
-  BOOLEAN       IsArmSbbrViolated;
+  UINT32       Table;
+  UINT32       Index;
+  UINT32       MandatoryTable;
+  CONST UINT8  *SignaturePtr;
+  BOOLEAN      IsArmSbbrViolated;
 
 
   if (Version >= ArmSbbrVersionMax) {
   if (Version >= ArmSbbrVersionMax) {
     return EFI_INVALID_PARAMETER;
     return EFI_INVALID_PARAMETER;
@@ -172,12 +172,13 @@ ArmSbbrReqsValidate (
   // Go through the list of mandatory tables for the input SBBR version
   // Go through the list of mandatory tables for the input SBBR version
   for (Table = 0; Table < ArmSbbrReqs[Version].TableCount; Table++) {
   for (Table = 0; Table < ArmSbbrReqs[Version].TableCount; Table++) {
     MandatoryTable = ArmSbbrReqs[Version].Tables[Table];
     MandatoryTable = ArmSbbrReqs[Version].Tables[Table];
-    SignaturePtr = (CONST UINT8*)(UINTN)&MandatoryTable;
+    SignaturePtr   = (CONST UINT8 *)(UINTN)&MandatoryTable;
 
 
     // Locate the instance count for the table with the given signature
     // Locate the instance count for the table with the given signature
     Index = 0;
     Index = 0;
     while ((Index < ARRAY_SIZE (ArmSbbrTableCounts)) &&
     while ((Index < ARRAY_SIZE (ArmSbbrTableCounts)) &&
-           (ArmSbbrTableCounts[Index].Signature != MandatoryTable)) {
+           (ArmSbbrTableCounts[Index].Signature != MandatoryTable))
+    {
       Index++;
       Index++;
     }
     }
 
 
@@ -185,7 +186,7 @@ ArmSbbrReqsValidate (
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"\nERROR: SBBR v%a: Mandatory %c%c%c%c table's instance count not " \
         L"\nERROR: SBBR v%a: Mandatory %c%c%c%c table's instance count not " \
-          L"found\n",
+        L"found\n",
         ArmSbbrVersions[Version],
         ArmSbbrVersions[Version],
         SignaturePtr[0],
         SignaturePtr[0],
         SignaturePtr[1],
         SignaturePtr[1],

+ 10 - 10
ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.h

@@ -24,26 +24,26 @@
   Arm SBBR specification versions.
   Arm SBBR specification versions.
 **/
 **/
 typedef enum {
 typedef enum {
-  ArmSbbrVersion_1_0    = 0,
-  ArmSbbrVersion_1_1    = 1,
-  ArmSbbrVersion_1_2    = 2,
-  ArmSbbrVersionMax     = 3
+  ArmSbbrVersion_1_0 = 0,
+  ArmSbbrVersion_1_1 = 1,
+  ArmSbbrVersion_1_2 = 2,
+  ArmSbbrVersionMax  = 3
 } ARM_SBBR_VERSION;
 } ARM_SBBR_VERSION;
 
 
 /**
 /**
   The ACPI table instance counter.
   The ACPI table instance counter.
 **/
 **/
 typedef struct AcpiTableCounter {
 typedef struct AcpiTableCounter {
-  CONST UINT32  Signature;        /// ACPI table signature
-  UINT32        Count;            /// Instance count
+  CONST UINT32    Signature;      /// ACPI table signature
+  UINT32          Count;          /// Instance count
 } ACPI_TABLE_COUNTER;
 } ACPI_TABLE_COUNTER;
 
 
 /**
 /**
   ACPI table SBBR requirements.
   ACPI table SBBR requirements.
 **/
 **/
 typedef struct AcpiSbbrReq {
 typedef struct AcpiSbbrReq {
-  CONST UINT32* Tables;          /// List of required tables
-  CONST UINT32  TableCount;      /// Number of elements in Tables
+  CONST UINT32    *Tables;       /// List of required tables
+  CONST UINT32    TableCount;    /// Number of elements in Tables
 } ACPI_SBBR_REQ;
 } ACPI_SBBR_REQ;
 
 
 /**
 /**
@@ -67,7 +67,7 @@ ArmSbbrResetTableCounts (
 BOOLEAN
 BOOLEAN
 EFIAPI
 EFIAPI
 ArmSbbrIncrementTableCount (
 ArmSbbrIncrementTableCount (
-  UINT32 Signature
+  UINT32  Signature
   );
   );
 
 
 /**
 /**
@@ -85,7 +85,7 @@ ArmSbbrIncrementTableCount (
 EFI_STATUS
 EFI_STATUS
 EFIAPI
 EFIAPI
 ArmSbbrReqsValidate (
 ArmSbbrReqsValidate (
-  ARM_SBBR_VERSION Version
+  ARM_SBBR_VERSION  Version
   );
   );
 
 
 #endif // SBBR_VALIDATOR_H_
 #endif // SBBR_VALIDATOR_H_

+ 133 - 128
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c

@@ -18,16 +18,16 @@
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
 // Local variables
 // Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
-STATIC UINT8*                       AestNodeType;
-STATIC UINT16*                      AestNodeLength;
-STATIC UINT32*                      NodeDataOffset;
-STATIC UINT32*                      NodeInterfaceOffset;
-STATIC UINT32*                      NodeInterruptArrayOffset;
-STATIC UINT32*                      NodeInterruptCount;
-STATIC UINT32*                      ProcessorId;
-STATIC UINT8*                       ProcessorFlags;
-STATIC UINT8*                       ProcessorResourceType;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
+STATIC UINT8                         *AestNodeType;
+STATIC UINT16                        *AestNodeLength;
+STATIC UINT32                        *NodeDataOffset;
+STATIC UINT32                        *NodeInterfaceOffset;
+STATIC UINT32                        *NodeInterruptArrayOffset;
+STATIC UINT32                        *NodeInterruptCount;
+STATIC UINT32                        *ProcessorId;
+STATIC UINT8                         *ProcessorFlags;
+STATIC UINT8                         *ProcessorResourceType;
 
 
 /**
 /**
   Validate Processor Flags.
   Validate Processor Flags.
@@ -40,16 +40,18 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateProcessorFlags (
 ValidateProcessorFlags (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   // If the global or shared node flag is set then the ACPI Processor ID
   // If the global or shared node flag is set then the ACPI Processor ID
   // field must be set to 0 and ignored.
   // field must be set to 0 and ignored.
   if (((*Ptr & 0x3) != 0) && (*ProcessorId != 0)) {
   if (((*Ptr & 0x3) != 0) && (*ProcessorId != 0)) {
     IncrementErrorCount ();
     IncrementErrorCount ();
-    Print (L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global"
-           L" or shared nodes.");
+    Print (
+      L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global"
+      L" or shared nodes."
+      );
   }
   }
 }
 }
 
 
@@ -64,13 +66,13 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateGicInterfaceType (
 ValidateGicInterfaceType (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  UINT32 GicInterfaceType;
+  UINT32  GicInterfaceType;
 
 
-  GicInterfaceType = *(UINT32*)Ptr;
+  GicInterfaceType = *(UINT32 *)Ptr;
   if (GicInterfaceType > 3) {
   if (GicInterfaceType > 3) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (L"\nError: Invalid GIC Interface type %d", GicInterfaceType);
     Print (L"\nError: Invalid GIC Interface type %d", GicInterfaceType);
@@ -88,8 +90,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateInterfaceType (
 ValidateInterfaceType (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   if (*Ptr > 1) {
   if (*Ptr > 1) {
@@ -109,8 +111,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateInterruptType (
 ValidateInterruptType (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   if (*Ptr > 1) {
   if (*Ptr > 1) {
@@ -130,8 +132,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateInterruptFlags (
 ValidateInterruptFlags (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   if ((*Ptr & 0xfe) != 0) {
   if ((*Ptr & 0xfe) != 0) {
@@ -149,8 +151,8 @@ ValidateInterruptFlags (
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpVendorSpecificData (
 DumpVendorSpecificData (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   )
   )
 {
 {
   Print (
   Print (
@@ -183,27 +185,27 @@ DumpVendorSpecificData (
 /**
 /**
   An ACPI_PARSER array describing the ACPI AEST Table.
   An ACPI_PARSER array describing the ACPI AEST Table.
 **/
 **/
-STATIC CONST ACPI_PARSER AestParser[] = {
+STATIC CONST ACPI_PARSER  AestParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the AEST Node Header.
   An ACPI_PARSER array describing the AEST Node Header.
 **/
 **/
-STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = {
-  {L"Type", 1, 0, L"%d", NULL, (VOID**)&AestNodeType, NULL, NULL},
-  {L"Length", 2, 1, L"%d", NULL, (VOID**)&AestNodeLength, NULL, NULL},
-  {L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Node Data Offset", 4, 4, L"%d", NULL, (VOID**)&NodeDataOffset, NULL, NULL},
-  {L"Node Interface Offset", 4, 8, L"%d", NULL,
-    (VOID**)&NodeInterfaceOffset, NULL, NULL},
-  {L"Node Interrupt Array Offset", 4, 12, L"%d", NULL,
-    (VOID**)&NodeInterruptArrayOffset, NULL, NULL},
-  {L"Node Interrupt Count", 4, 16, L"%d", NULL,
-    (VOID**)&NodeInterruptCount, NULL, NULL},
-  {L"Timestamp Rate", 8, 20, L"%ld", NULL, NULL, NULL, NULL},
-  {L"Reserved1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Error Injection Countdown Rate", 8, 36, L"%ld", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestNodeHeaderParser[] = {
+  { L"Type",                           1, 0,  L"%d",    NULL, (VOID **)&AestNodeType,   NULL, NULL },
+  { L"Length",                         2, 1,  L"%d",    NULL, (VOID **)&AestNodeLength, NULL, NULL },
+  { L"Reserved",                       1, 3,  L"0x%x",  NULL, NULL,                     NULL, NULL },
+  { L"Node Data Offset",               4, 4,  L"%d",    NULL, (VOID **)&NodeDataOffset, NULL, NULL },
+  { L"Node Interface Offset",          4, 8,  L"%d",    NULL,
+    (VOID **)&NodeInterfaceOffset, NULL, NULL },
+  { L"Node Interrupt Array Offset",    4, 12, L"%d",    NULL,
+    (VOID **)&NodeInterruptArrayOffset, NULL, NULL },
+  { L"Node Interrupt Count",           4, 16, L"%d",    NULL,
+    (VOID **)&NodeInterruptCount, NULL, NULL },
+  { L"Timestamp Rate",                 8, 20, L"%ld",   NULL, NULL,                     NULL, NULL },
+  { L"Reserved1",                      8, 28, L"0x%lx", NULL, NULL,                     NULL, NULL },
+  { L"Error Injection Countdown Rate", 8, 36, L"%ld",   NULL, NULL,                     NULL, NULL }
   // Node specific data...
   // Node specific data...
   // Node interface...
   // Node interface...
   // Node interrupt array...
   // Node interrupt array...
@@ -212,100 +214,100 @@ STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = {
 /**
 /**
   An ACPI_PARSER array describing the Processor error node specific data.
   An ACPI_PARSER array describing the Processor error node specific data.
 **/
 **/
-STATIC CONST ACPI_PARSER AestProcessorStructure[] = {
-  {L"ACPI Processor ID", 4, 0, L"0x%x", NULL, (VOID**)&ProcessorId, NULL, NULL},
-  {L"Resource Type", 1, 4, L"%d", NULL, (VOID**)&ProcessorResourceType, NULL,
-    NULL},
-  {L"Reserved", 1, 5, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 1, 6, L"0x%x", NULL, (VOID**)&ProcessorFlags,
-    ValidateProcessorFlags, NULL},
-  {L"Revision", 1, 7, L"%d", NULL, NULL, NULL, NULL},
-  {L"Processor Affinity Level Indicator", 8, 8, L"0x%lx", NULL, NULL, NULL,
-    NULL},
+STATIC CONST ACPI_PARSER  AestProcessorStructure[] = {
+  { L"ACPI Processor ID",                  4, 0, L"0x%x",  NULL, (VOID **)&ProcessorId,           NULL, NULL },
+  { L"Resource Type",                      1, 4, L"%d",    NULL, (VOID **)&ProcessorResourceType, NULL,
+    NULL },
+  { L"Reserved",                           1, 5, L"0x%x",  NULL, NULL,                            NULL, NULL },
+  { L"Flags",                              1, 6, L"0x%x",  NULL, (VOID **)&ProcessorFlags,
+    ValidateProcessorFlags, NULL },
+  { L"Revision",                           1, 7, L"%d",    NULL, NULL,                            NULL, NULL },
+  { L"Processor Affinity Level Indicator", 8, 8, L"0x%lx", NULL, NULL,                            NULL,
+    NULL },
   // Resource specific data...
   // Resource specific data...
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the processor cache resource substructure.
   An ACPI_PARSER array describing the processor cache resource substructure.
 **/
 **/
-STATIC CONST ACPI_PARSER AestProcessorCacheResourceSubstructure[] = {
-  {L"Cache reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestProcessorCacheResourceSubstructure[] = {
+  { L"Cache reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Reserved",           4, 4, L"%d",   NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the processor TLB resource substructure.
   An ACPI_PARSER array describing the processor TLB resource substructure.
 **/
 **/
-STATIC CONST ACPI_PARSER AestProcessorTlbResourceSubstructure[] = {
-  {L"TLB reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestProcessorTlbResourceSubstructure[] = {
+  { L"TLB reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Reserved",         4, 4, L"%d",   NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the processor generic resource substructure.
   An ACPI_PARSER array describing the processor generic resource substructure.
 **/
 **/
-STATIC CONST ACPI_PARSER AestProcessorGenericResourceSubstructure[] = {
-  {L"Vendor-defined data", 4, 0, L"%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestProcessorGenericResourceSubstructure[] = {
+  { L"Vendor-defined data", 4, 0, L"%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the memory controller structure.
   An ACPI_PARSER array describing the memory controller structure.
 **/
 **/
-STATIC CONST ACPI_PARSER AestMemoryControllerStructure[] = {
-  {L"Proximity Domain", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestMemoryControllerStructure[] = {
+  { L"Proximity Domain", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the SMMU structure.
   An ACPI_PARSER array describing the SMMU structure.
 **/
 **/
-STATIC CONST ACPI_PARSER AestSmmuStructure[] = {
-  {L"IORT Node reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SubComponent reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestSmmuStructure[] = {
+  { L"IORT Node reference ID",    4, 0, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"SubComponent reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the vendor-defined structure.
   An ACPI_PARSER array describing the vendor-defined structure.
 **/
 **/
-STATIC CONST ACPI_PARSER AestVendorDefinedStructure[] = {
-  {L"Hardware ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Unique ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Vendor-specific data", 16, 8, NULL, DumpVendorSpecificData, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestVendorDefinedStructure[] = {
+  { L"Hardware ID",          4,  0, L"0x%x", NULL,                   NULL, NULL, NULL },
+  { L"Unique ID",            4,  4, L"0x%x", NULL,                   NULL, NULL, NULL },
+  { L"Vendor-specific data", 16, 8, NULL,    DumpVendorSpecificData, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the GIC structure.
   An ACPI_PARSER array describing the GIC structure.
 **/
 **/
-STATIC CONST ACPI_PARSER AestGicStructure[] = {
-  {L"GIC Interface Type", 4, 0, L"0x%x", NULL, NULL, ValidateGicInterfaceType,
-    NULL},
-  {L"GIC Interface reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestGicStructure[] = {
+  { L"GIC Interface Type",         4, 0, L"0x%x", NULL, NULL, ValidateGicInterfaceType,
+    NULL },
+  { L"GIC Interface reference ID", 4, 4, L"0x%x", NULL, NULL, NULL,                    NULL}
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the node interface.
   An ACPI_PARSER array describing the node interface.
 **/
 **/
-STATIC CONST ACPI_PARSER AestNodeInterface[] = {
-  {L"Interface Type", 1, 0, L"%d", NULL, NULL, ValidateInterfaceType, NULL},
-  {L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
-  {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Start Error Record Index", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Number of Error Records", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Error Records Implemented", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Error Records Support", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Addressing mode", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestNodeInterface[] = {
+  { L"Interface Type",            1, 0,  L"%d",       NULL,       NULL, ValidateInterfaceType, NULL },
+  { L"Reserved",                  3, 1,  L"%x %x %x", Dump3Chars, NULL, NULL,                  NULL },
+  { L"Flags",                     4, 4,  L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Base Address",              8, 8,  L"0x%lx",    NULL,       NULL, NULL,                  NULL },
+  { L"Start Error Record Index",  4, 16, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Number of Error Records",   4, 20, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Error Records Implemented", 8, 24, L"0x%lx",    NULL,       NULL, NULL,                  NULL },
+  { L"Error Records Support",     8, 32, L"0x%lx",    NULL,       NULL, NULL,                  NULL },
+  { L"Addressing mode",           8, 40, L"0x%lx",    NULL,       NULL, NULL,                  NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the node interrupts.
   An ACPI_PARSER array describing the node interrupts.
 **/
 **/
-STATIC CONST ACPI_PARSER AestNodeInterrupt[] = {
-  {L"Interrupt Type", 1, 0, L"%d", NULL, NULL, ValidateInterruptType, NULL},
-  {L"Reserved", 2, 1, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Interrupt Flags", 1, 3, L"0x%x", NULL, NULL, ValidateInterruptFlags, NULL},
-  {L"Interrupt GSIV", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved1", 3, 9, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  AestNodeInterrupt[] = {
+  { L"Interrupt Type",  1, 0, L"%d",       NULL,       NULL, ValidateInterruptType,  NULL },
+  { L"Reserved",        2, 1, L"0x%x",     NULL,       NULL, NULL,                   NULL },
+  { L"Interrupt Flags", 1, 3, L"0x%x",     NULL,       NULL, ValidateInterruptFlags, NULL },
+  { L"Interrupt GSIV",  4, 4, L"0x%x",     NULL,       NULL, NULL,                   NULL },
+  { L"ID",              1, 8, L"0x%x",     NULL,       NULL, NULL,                   NULL },
+  { L"Reserved1",       3, 9, L"%x %x %x", Dump3Chars, NULL, NULL,                   NULL }
 };
 };
 
 
 /**
 /**
@@ -318,11 +320,11 @@ STATIC CONST ACPI_PARSER AestNodeInterrupt[] = {
 STATIC
 STATIC
 VOID
 VOID
 DumpProcessorNode (
 DumpProcessorNode (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
-  UINT32 Offset;
+  UINT32  Offset;
 
 
   Offset = ParseAcpi (
   Offset = ParseAcpi (
              TRUE,
              TRUE,
@@ -337,7 +339,8 @@ DumpProcessorNode (
   // successfully read.
   // successfully read.
   if ((ProcessorId == NULL)           ||
   if ((ProcessorId == NULL)           ||
       (ProcessorResourceType == NULL) ||
       (ProcessorResourceType == NULL) ||
-      (ProcessorFlags == NULL)) {
+      (ProcessorFlags == NULL))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient Processor Error Node length. Length = %d.\n",
       L"ERROR: Insufficient Processor Error Node length. Length = %d.\n",
@@ -393,8 +396,8 @@ DumpProcessorNode (
 STATIC
 STATIC
 VOID
 VOID
 DumpMemoryControllerNode (
 DumpMemoryControllerNode (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -416,8 +419,8 @@ DumpMemoryControllerNode (
 STATIC
 STATIC
 VOID
 VOID
 DumpSmmuNode (
 DumpSmmuNode (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -439,8 +442,8 @@ DumpSmmuNode (
 STATIC
 STATIC
 VOID
 VOID
 DumpVendorDefinedNode (
 DumpVendorDefinedNode (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -462,8 +465,8 @@ DumpVendorDefinedNode (
 STATIC
 STATIC
 VOID
 VOID
 DumpGicNode (
 DumpGicNode (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -485,8 +488,8 @@ DumpGicNode (
 STATIC
 STATIC
 VOID
 VOID
 DumpNodeInterface (
 DumpNodeInterface (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -509,19 +512,19 @@ DumpNodeInterface (
 STATIC
 STATIC
 VOID
 VOID
 DumpNodeInterrupts (
 DumpNodeInterrupts (
-  IN UINT8* Ptr,
-  IN UINT32 Length,
-  IN UINT32 InterruptCount
+  IN UINT8   *Ptr,
+  IN UINT32  Length,
+  IN UINT32  InterruptCount
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT32 Index;
-  CHAR8  Buffer[64];
+  UINT32  Offset;
+  UINT32  Index;
+  CHAR8   Buffer[64];
 
 
   if (Length < (InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT))) {
   if (Length < (InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT))) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
-      L"ERROR: Node not long enough for Interrupt Array.\n"\
+      L"ERROR: Node not long enough for Interrupt Array.\n" \
       L"       Length left = %d, Required = %d, Interrupt Count = %d\n",
       L"       Length left = %d, Required = %d, Interrupt Count = %d\n",
       Length,
       Length,
       (InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT)),
       (InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT)),
@@ -547,7 +550,7 @@ DumpNodeInterrupts (
                 Length - Offset,
                 Length - Offset,
                 PARSER_PARAMS (AestNodeInterrupt)
                 PARSER_PARAMS (AestNodeInterrupt)
                 );
                 );
-  } //for
+  } // for
 }
 }
 
 
 /**
 /**
@@ -564,7 +567,7 @@ DumpNodeInterrupts (
 STATIC
 STATIC
 VOID
 VOID
 DumpAestNodeStructure (
 DumpAestNodeStructure (
-  IN UINT8*  Ptr,
+  IN UINT8   *Ptr,
   IN UINT32  Length,
   IN UINT32  Length,
   IN UINT8   NodeType,
   IN UINT8   NodeType,
   IN UINT32  DataOffset,
   IN UINT32  DataOffset,
@@ -573,9 +576,9 @@ DumpAestNodeStructure (
   IN UINT32  InterruptCount
   IN UINT32  InterruptCount
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT32 RemainingLength;
-  UINT8* NodeDataPtr;
+  UINT32  Offset;
+  UINT32  RemainingLength;
+  UINT8   *NodeDataPtr;
 
 
   Offset = ParseAcpi (
   Offset = ParseAcpi (
              TRUE,
              TRUE,
@@ -589,7 +592,7 @@ DumpAestNodeStructure (
   if ((Offset > DataOffset) || (DataOffset > Length)) {
   if ((Offset > DataOffset) || (DataOffset > Length)) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
-      L"ERROR: Invalid Node Data Offset: %d.\n"\
+      L"ERROR: Invalid Node Data Offset: %d.\n" \
       L"       It should be between %d and %d.\n",
       L"       It should be between %d and %d.\n",
       DataOffset,
       DataOffset,
       Offset,
       Offset,
@@ -600,7 +603,7 @@ DumpAestNodeStructure (
   if ((Offset > InterfaceOffset) || (InterfaceOffset > Length)) {
   if ((Offset > InterfaceOffset) || (InterfaceOffset > Length)) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
-      L"ERROR: Invalid Node Interface Offset: %d.\n"\
+      L"ERROR: Invalid Node Interface Offset: %d.\n" \
       L"       It should be between %d and %d.\n",
       L"       It should be between %d and %d.\n",
       InterfaceOffset,
       InterfaceOffset,
       Offset,
       Offset,
@@ -611,7 +614,7 @@ DumpAestNodeStructure (
   if ((Offset > InterruptArrayOffset) || (InterruptArrayOffset > Length)) {
   if ((Offset > InterruptArrayOffset) || (InterruptArrayOffset > Length)) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
-      L"ERROR: Invalid Node Interrupt Array Offset: %d.\n"\
+      L"ERROR: Invalid Node Interrupt Array Offset: %d.\n" \
       L"       It should be between %d and %d.\n",
       L"       It should be between %d and %d.\n",
       InterruptArrayOffset,
       InterruptArrayOffset,
       Offset,
       Offset,
@@ -620,7 +623,7 @@ DumpAestNodeStructure (
   }
   }
 
 
   // Parse Node Data Field.
   // Parse Node Data Field.
-  NodeDataPtr = Ptr + DataOffset;
+  NodeDataPtr     = Ptr + DataOffset;
   RemainingLength = Length - DataOffset;
   RemainingLength = Length - DataOffset;
   switch (NodeType) {
   switch (NodeType) {
     case EFI_ACPI_AEST_NODE_TYPE_PROCESSOR:
     case EFI_ACPI_AEST_NODE_TYPE_PROCESSOR:
@@ -675,14 +678,14 @@ DumpAestNodeStructure (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiAest (
 ParseAcpiAest (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
   UINT32  Offset;
   UINT32  Offset;
-  UINT8*  NodePtr;
+  UINT8   *NodePtr;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -716,10 +719,11 @@ ParseAcpiAest (
         (NodeDataOffset == NULL)           ||
         (NodeDataOffset == NULL)           ||
         (NodeInterfaceOffset == NULL)      ||
         (NodeInterfaceOffset == NULL)      ||
         (NodeInterruptArrayOffset == NULL) ||
         (NodeInterruptArrayOffset == NULL) ||
-        (NodeInterruptCount == NULL)) {
+        (NodeInterruptCount == NULL))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
-        L"ERROR: Insufficient length left for Node Structure.\n"\
+        L"ERROR: Insufficient length left for Node Structure.\n" \
         L"       Length left = %d.\n",
         L"       Length left = %d.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
@@ -728,11 +732,12 @@ ParseAcpiAest (
 
 
     // Validate AEST Node length
     // Validate AEST Node length
     if ((*AestNodeLength == 0) ||
     if ((*AestNodeLength == 0) ||
-        ((Offset + (*AestNodeLength)) > AcpiTableLength)) {
+        ((Offset + (*AestNodeLength)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid AEST Node length. " \
         L"ERROR: Invalid AEST Node length. " \
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
         *AestNodeLength,
         *AestNodeLength,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength

+ 12 - 12
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c

@@ -14,19 +14,19 @@
 #include "AcpiTableParser.h"
 #include "AcpiTableParser.h"
 
 
 // Local variables
 // Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   An ACPI_PARSER array describing the ACPI BDRT Table.
   An ACPI_PARSER array describing the ACPI BDRT Table.
 **/
 **/
-STATIC CONST ACPI_PARSER BgrtParser[] = {
+STATIC CONST ACPI_PARSER  BgrtParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Version", 2, 36, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Status", 1, 38, L"0x%x", NULL,  NULL, NULL, NULL},
-  {L"Image Type", 1, 39, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Image Address", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Image Offset X", 4, 48, L"%d", NULL, NULL, NULL, NULL},
-  {L"Image Offset Y", 4, 52, L"%d", NULL, NULL, NULL, NULL}
+  { L"Version",                    2,  36, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Status",                     1,  38, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Image Type",                 1,  39, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Image Address",              8,  40, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Image Offset X",             4,  48, L"%d",    NULL, NULL, NULL, NULL },
+  { L"Image Offset Y",             4,  52, L"%d",    NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -44,10 +44,10 @@ STATIC CONST ACPI_PARSER BgrtParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiBgrt (
 ParseAcpiBgrt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
   if (!Trace) {
   if (!Trace) {

+ 83 - 74
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c

@@ -14,17 +14,17 @@
 #include "AcpiTableParser.h"
 #include "AcpiTableParser.h"
 
 
 // Local variables pointing to the table fields
 // Local variables pointing to the table fields
-STATIC CONST UINT32* OffsetDbgDeviceInfo;
-STATIC CONST UINT32* NumberDbgDeviceInfo;
-STATIC CONST UINT16* DbgDevInfoLen;
-STATIC CONST UINT8*  GasCount;
-STATIC CONST UINT16* NameSpaceStringLength;
-STATIC CONST UINT16* NameSpaceStringOffset;
-STATIC CONST UINT16* OEMDataLength;
-STATIC CONST UINT16* OEMDataOffset;
-STATIC CONST UINT16* BaseAddrRegOffset;
-STATIC CONST UINT16* AddrSizeOffset;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT32                  *OffsetDbgDeviceInfo;
+STATIC CONST UINT32                  *NumberDbgDeviceInfo;
+STATIC CONST UINT16                  *DbgDevInfoLen;
+STATIC CONST UINT8                   *GasCount;
+STATIC CONST UINT16                  *NameSpaceStringLength;
+STATIC CONST UINT16                  *NameSpaceStringOffset;
+STATIC CONST UINT16                  *OEMDataLength;
+STATIC CONST UINT16                  *OEMDataOffset;
+STATIC CONST UINT16                  *BaseAddrRegOffset;
+STATIC CONST UINT16                  *AddrSizeOffset;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   This function validates the NameSpace string length.
   This function validates the NameSpace string length.
@@ -37,64 +37,64 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateNameSpaceStrLen (
 ValidateNameSpaceStrLen (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  UINT16 NameSpaceStrLen;
+  UINT16  NameSpaceStrLen;
 
 
-  NameSpaceStrLen = *(UINT16*)Ptr;
+  NameSpaceStrLen = *(UINT16 *)Ptr;
 
 
   if (NameSpaceStrLen < 2) {
   if (NameSpaceStrLen < 2) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: NamespaceString Length = %d. If no Namespace device exists, " \
       L"\nERROR: NamespaceString Length = %d. If no Namespace device exists, " \
-        L"NamespaceString[] must contain a period '.'",
+      L"NamespaceString[] must contain a period '.'",
       NameSpaceStrLen
       NameSpaceStrLen
       );
       );
   }
   }
 }
 }
 
 
 /// An ACPI_PARSER array describing the ACPI DBG2 table.
 /// An ACPI_PARSER array describing the ACPI DBG2 table.
-STATIC CONST ACPI_PARSER Dbg2Parser[] = {
+STATIC CONST ACPI_PARSER  Dbg2Parser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"OffsetDbgDeviceInfo", 4, 36, L"0x%x", NULL,
-   (VOID**)&OffsetDbgDeviceInfo, NULL, NULL},
-  {L"NumberDbgDeviceInfo", 4, 40, L"%d", NULL,
-   (VOID**)&NumberDbgDeviceInfo, NULL, NULL}
+  { L"OffsetDbgDeviceInfo",        4,     36, L"0x%x", NULL,
+    (VOID **)&OffsetDbgDeviceInfo, NULL,  NULL },
+  { L"NumberDbgDeviceInfo",        4,     40, L"%d",   NULL,
+    (VOID **)&NumberDbgDeviceInfo, NULL,  NULL }
 };
 };
 
 
 /// An ACPI_PARSER array describing the debug device information structure
 /// An ACPI_PARSER array describing the debug device information structure
 /// header.
 /// header.
-STATIC CONST ACPI_PARSER DbgDevInfoHeaderParser[] = {
-  {L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 2, 1, L"%d", NULL, (VOID**)&DbgDevInfoLen, NULL, NULL}
+STATIC CONST ACPI_PARSER  DbgDevInfoHeaderParser[] = {
+  { L"Revision", 1, 0, L"0x%x", NULL, NULL,                    NULL, NULL },
+  { L"Length",   2, 1, L"%d",   NULL, (VOID **)&DbgDevInfoLen, NULL, NULL }
 };
 };
 
 
 /// An ACPI_PARSER array describing the debug device information.
 /// An ACPI_PARSER array describing the debug device information.
-STATIC CONST ACPI_PARSER DbgDevInfoParser[] = {
-  {L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},
-
-  {L"Generic Address Registers Count", 1, 3, L"0x%x", NULL,
-   (VOID**)&GasCount, NULL, NULL},
-  {L"NameSpace String Length", 2, 4, L"%d", NULL,
-   (VOID**)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL},
-  {L"NameSpace String Offset", 2, 6, L"0x%x", NULL,
-   (VOID**)&NameSpaceStringOffset, NULL, NULL},
-  {L"OEM Data Length", 2, 8, L"%d", NULL, (VOID**)&OEMDataLength,
-   NULL, NULL},
-  {L"OEM Data Offset", 2, 10, L"0x%x", NULL, (VOID**)&OEMDataOffset,
-   NULL, NULL},
-
-  {L"Port Type", 2, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Port SubType", 2, 14, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 16, L"%x", NULL, NULL, NULL, NULL},
-
-  {L"Base Address Register Offset", 2, 18, L"0x%x", NULL,
-   (VOID**)&BaseAddrRegOffset, NULL, NULL},
-  {L"Address Size Offset", 2, 20, L"0x%x", NULL,
-   (VOID**)&AddrSizeOffset, NULL, NULL}
+STATIC CONST ACPI_PARSER  DbgDevInfoParser[] = {
+  { L"Revision",                        1, 0,  L"0x%x", NULL, NULL,                    NULL, NULL },
+  { L"Length",                          2, 1,  L"%d",   NULL, NULL,                    NULL, NULL },
+
+  { L"Generic Address Registers Count", 1, 3,  L"0x%x", NULL,
+    (VOID **)&GasCount, NULL, NULL },
+  { L"NameSpace String Length",         2, 4,  L"%d",   NULL,
+    (VOID **)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL },
+  { L"NameSpace String Offset",         2, 6,  L"0x%x", NULL,
+    (VOID **)&NameSpaceStringOffset, NULL, NULL },
+  { L"OEM Data Length",                 2, 8,  L"%d",   NULL, (VOID **)&OEMDataLength,
+    NULL, NULL },
+  { L"OEM Data Offset",                 2, 10, L"0x%x", NULL, (VOID **)&OEMDataOffset,
+    NULL, NULL },
+
+  { L"Port Type",                       2, 12, L"0x%x", NULL, NULL,                    NULL, NULL },
+  { L"Port SubType",                    2, 14, L"0x%x", NULL, NULL,                    NULL, NULL },
+  { L"Reserved",                        2, 16, L"%x",   NULL, NULL,                    NULL, NULL },
+
+  { L"Base Address Register Offset",    2, 18, L"0x%x", NULL,
+    (VOID **)&BaseAddrRegOffset, NULL, NULL },
+  { L"Address Size Offset",             2, 20, L"0x%x", NULL,
+    (VOID **)&AddrSizeOffset, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -107,8 +107,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpDbgDeviceInfo (
 DumpDbgDeviceInfo (
-  IN UINT8* Ptr,
-  IN UINT16 Length
+  IN UINT8   *Ptr,
+  IN UINT16  Length
   )
   )
 {
 {
   UINT16  Index;
   UINT16  Index;
@@ -131,21 +131,23 @@ DumpDbgDeviceInfo (
       (OEMDataLength == NULL)         ||
       (OEMDataLength == NULL)         ||
       (OEMDataOffset == NULL)         ||
       (OEMDataOffset == NULL)         ||
       (BaseAddrRegOffset == NULL)     ||
       (BaseAddrRegOffset == NULL)     ||
-      (AddrSizeOffset == NULL)) {
+      (AddrSizeOffset == NULL))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient Debug Device Information Structure length. " \
       L"ERROR: Insufficient Debug Device Information Structure length. " \
-        L"Length = %d.\n",
+      L"Length = %d.\n",
       Length
       Length
       );
       );
     return;
     return;
   }
   }
 
 
   // GAS
   // GAS
-  Index = 0;
+  Index  = 0;
   Offset = *BaseAddrRegOffset;
   Offset = *BaseAddrRegOffset;
   while ((Index++ < *GasCount) &&
   while ((Index++ < *GasCount) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     PrintFieldName (4, L"BaseAddressRegister");
     PrintFieldName (4, L"BaseAddressRegister");
     Offset += (UINT16)DumpGasStruct (
     Offset += (UINT16)DumpGasStruct (
                         Ptr + Offset,
                         Ptr + Offset,
@@ -160,7 +162,7 @@ DumpDbgDeviceInfo (
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Invalid GAS count. GasCount = %d. RemainingBufferLength = %d. " \
       L"ERROR: Invalid GAS count. GasCount = %d. RemainingBufferLength = %d. " \
-        L"Parsing of the Debug Device Information structure aborted.\n",
+      L"Parsing of the Debug Device Information structure aborted.\n",
       *GasCount,
       *GasCount,
       Length - *AddrSizeOffset
       Length - *AddrSizeOffset
       );
       );
@@ -168,39 +170,45 @@ DumpDbgDeviceInfo (
   }
   }
 
 
   // Address Size
   // Address Size
-  Index = 0;
+  Index  = 0;
   Offset = *AddrSizeOffset;
   Offset = *AddrSizeOffset;
   while ((Index++ < *GasCount) &&
   while ((Index++ < *GasCount) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     PrintFieldName (4, L"Address Size");
     PrintFieldName (4, L"Address Size");
-    Print (L"0x%x\n", *((UINT32*)(Ptr + Offset)));
+    Print (L"0x%x\n", *((UINT32 *)(Ptr + Offset)));
     Offset += sizeof (UINT32);
     Offset += sizeof (UINT32);
   }
   }
 
 
   // NameSpace String
   // NameSpace String
-  Index = 0;
+  Index  = 0;
   Offset = *NameSpaceStringOffset;
   Offset = *NameSpaceStringOffset;
   PrintFieldName (4, L"NameSpace String");
   PrintFieldName (4, L"NameSpace String");
   while ((Index++ < *NameSpaceStringLength) &&
   while ((Index++ < *NameSpaceStringLength) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     Print (L"%c", *(Ptr + Offset));
     Print (L"%c", *(Ptr + Offset));
     Offset++;
     Offset++;
   }
   }
+
   Print (L"\n");
   Print (L"\n");
 
 
   // OEM Data
   // OEM Data
   if (*OEMDataOffset != 0) {
   if (*OEMDataOffset != 0) {
-    Index = 0;
+    Index  = 0;
     Offset = *OEMDataOffset;
     Offset = *OEMDataOffset;
     PrintFieldName (4, L"OEM Data");
     PrintFieldName (4, L"OEM Data");
     while ((Index++ < *OEMDataLength) &&
     while ((Index++ < *OEMDataLength) &&
-           (Offset < Length)) {
+           (Offset < Length))
+    {
       Print (L"%x ", *(Ptr + Offset));
       Print (L"%x ", *(Ptr + Offset));
       if ((Index & 7) == 0) {
       if ((Index & 7) == 0) {
         Print (L"\n%-*s   ", OUTPUT_FIELD_COLUMN_WIDTH, L"");
         Print (L"\n%-*s   ", OUTPUT_FIELD_COLUMN_WIDTH, L"");
       }
       }
+
       Offset++;
       Offset++;
     }
     }
+
     Print (L"\n");
     Print (L"\n");
   }
   }
 }
 }
@@ -220,14 +228,14 @@ DumpDbgDeviceInfo (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiDbg2 (
 ParseAcpiDbg2 (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT32 Index;
+  UINT32  Offset;
+  UINT32  Index;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -245,7 +253,8 @@ ParseAcpiDbg2 (
   // Check if the values used to control the parsing logic have been
   // Check if the values used to control the parsing logic have been
   // successfully read.
   // successfully read.
   if ((OffsetDbgDeviceInfo == NULL) ||
   if ((OffsetDbgDeviceInfo == NULL) ||
-      (NumberDbgDeviceInfo == NULL)) {
+      (NumberDbgDeviceInfo == NULL))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient table length. AcpiTableLength = %d\n",
       L"ERROR: Insufficient table length. AcpiTableLength = %d\n",
@@ -255,10 +264,9 @@ ParseAcpiDbg2 (
   }
   }
 
 
   Offset = *OffsetDbgDeviceInfo;
   Offset = *OffsetDbgDeviceInfo;
-  Index = 0;
+  Index  = 0;
 
 
   while (Index++ < *NumberDbgDeviceInfo) {
   while (Index++ < *NumberDbgDeviceInfo) {
-
     // Parse the Debug Device Information Structure header to obtain Length
     // Parse the Debug Device Information Structure header to obtain Length
     ParseAcpi (
     ParseAcpi (
       FALSE,
       FALSE,
@@ -275,8 +283,8 @@ ParseAcpiDbg2 (
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Insufficient remaining table buffer length to read the " \
         L"ERROR: Insufficient remaining table buffer length to read the " \
-          L"Debug Device Information structure's 'Length' field. " \
-          L"RemainingTableBufferLength = %d.\n",
+        L"Debug Device Information structure's 'Length' field. " \
+        L"RemainingTableBufferLength = %d.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
       return;
       return;
@@ -284,11 +292,12 @@ ParseAcpiDbg2 (
 
 
     // Validate Debug Device Information Structure length
     // Validate Debug Device Information Structure length
     if ((*DbgDevInfoLen == 0) ||
     if ((*DbgDevInfoLen == 0) ||
-        ((Offset + (*DbgDevInfoLen)) > AcpiTableLength)) {
+        ((Offset + (*DbgDevInfoLen)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid Debug Device Information Structure length. " \
         L"ERROR: Invalid Debug Device Information Structure length. " \
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
         *DbgDevInfoLen,
         *DbgDevInfoLen,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength

+ 4 - 4
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c

@@ -28,10 +28,10 @@
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiDsdt (
 ParseAcpiDsdt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
   if (!Trace) {
   if (!Trace) {

+ 21 - 21
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c

@@ -16,23 +16,23 @@
 /**
 /**
   An ACPI_PARSER array describing the ACPI FACS Table.
   An ACPI_PARSER array describing the ACPI FACS Table.
 **/
 **/
-STATIC CONST ACPI_PARSER FacsParser[] = {
-  {L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL},
-  {L"Length", 4, 4, L"%d", NULL,  NULL, NULL, NULL},
-  {L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
-  {L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
-    NULL},
-  {L"Reserved", 8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
-    NULL},
-  {L"Reserved", 8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
-    NULL}
+STATIC CONST ACPI_PARSER  FacsParser[] = {
+  { L"Signature",                 4, 0,  L"%c%c%c%c",                Dump4Chars, NULL, NULL, NULL },
+  { L"Length",                    4, 4,  L"%d",                      NULL,       NULL, NULL, NULL },
+  { L"Hardware Signature",        4, 8,  L"0x%x",                    NULL,       NULL, NULL, NULL },
+  { L"Firmware Waking Vector",    4, 12, L"0x%x",                    NULL,       NULL, NULL, NULL },
+  { L"Global Lock",               4, 16, L"0x%x",                    NULL,       NULL, NULL, NULL },
+  { L"Flags",                     4, 20, L"0x%x",                    NULL,       NULL, NULL, NULL },
+  { L"X Firmware Walking Vector", 8, 24, L"0x%lx",                   NULL,       NULL, NULL, NULL },
+  { L"Version",                   1, 32, L"%d",                      NULL,       NULL, NULL, NULL },
+  { L"Reserved",                  3, 33, L"%x %x %x",                Dump3Chars, NULL, NULL, NULL },
+  { L"OSPM Flags",                4, 36, L"0x%x",                    NULL,       NULL, NULL, NULL },
+  { L"Reserved",                  8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
+    NULL },
+  { L"Reserved",                  8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
+    NULL },
+  { L"Reserved",                  8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
+    NULL }
 };
 };
 
 
 /**
 /**
@@ -50,10 +50,10 @@ STATIC CONST ACPI_PARSER FacsParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiFacs (
 ParseAcpiFacs (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
   if (!Trace) {
   if (!Trace) {

+ 122 - 115
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c

@@ -15,33 +15,33 @@
 #include "AcpiView.h"
 #include "AcpiView.h"
 
 
 // Local variables
 // Local variables
-STATIC CONST UINT32* DsdtAddress;
-STATIC CONST UINT64* X_DsdtAddress;
-STATIC CONST UINT32* Flags;
-STATIC CONST UINT32* FirmwareCtrl;
-STATIC CONST UINT64* X_FirmwareCtrl;
-STATIC CONST UINT8*  FadtMinorRevision;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT32                  *DsdtAddress;
+STATIC CONST UINT64                  *X_DsdtAddress;
+STATIC CONST UINT32                  *Flags;
+STATIC CONST UINT32                  *FirmwareCtrl;
+STATIC CONST UINT64                  *X_FirmwareCtrl;
+STATIC CONST UINT8                   *FadtMinorRevision;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   A macro defining the Hardware reduced ACPI flag
   A macro defining the Hardware reduced ACPI flag
 **/
 **/
-#define HW_REDUCED_ACPI   BIT20
+#define HW_REDUCED_ACPI  BIT20
 
 
 /**
 /**
   Offset to the FACS signature from the start of the FACS.
   Offset to the FACS signature from the start of the FACS.
 **/
 **/
-#define FACS_SIGNATURE_OFFSET   0
+#define FACS_SIGNATURE_OFFSET  0
 
 
 /**
 /**
   Offset to the FACS revision from the start of the FACS.
   Offset to the FACS revision from the start of the FACS.
 **/
 **/
-#define FACS_VERSION_OFFSET     32
+#define FACS_VERSION_OFFSET  32
 
 
 /**
 /**
   Offset to the FACS length from the start of the FACS.
   Offset to the FACS length from the start of the FACS.
 **/
 **/
-#define FACS_LENGTH_OFFSET      4
+#define FACS_LENGTH_OFFSET  4
 
 
 /**
 /**
   Get the ACPI XSDT header info.
   Get the ACPI XSDT header info.
@@ -63,18 +63,19 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateFirmwareCtrl (
 ValidateFirmwareCtrl (
-  IN UINT8* Ptr,
-  IN VOID*  Context
-)
+  IN UINT8  *Ptr,
+  IN VOID   *Context
+  )
 {
 {
-#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-  if (*(UINT32*)Ptr != 0) {
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+  if (*(UINT32 *)Ptr != 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: Firmware Control must be zero for ARM platforms."
       L"\nERROR: Firmware Control must be zero for ARM platforms."
-    );
+      );
   }
   }
-#endif
+
+ #endif
 }
 }
 
 
 /**
 /**
@@ -88,18 +89,19 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateXFirmwareCtrl (
 ValidateXFirmwareCtrl (
-  IN UINT8* Ptr,
-  IN VOID*  Context
-)
+  IN UINT8  *Ptr,
+  IN VOID   *Context
+  )
 {
 {
-#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-  if (*(UINT64*)Ptr != 0) {
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+  if (*(UINT64 *)Ptr != 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: X Firmware Control must be zero for ARM platforms."
       L"\nERROR: X Firmware Control must be zero for ARM platforms."
-    );
+      );
   }
   }
-#endif
+
+ #endif
 }
 }
 
 
 /**
 /**
@@ -113,83 +115,84 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateFlags (
 ValidateFlags (
-  IN UINT8* Ptr,
-  IN VOID*  Context
-)
+  IN UINT8  *Ptr,
+  IN VOID   *Context
+  )
 {
 {
-#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-  if (((*(UINT32*)Ptr) & HW_REDUCED_ACPI) == 0) {
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+  if (((*(UINT32 *)Ptr) & HW_REDUCED_ACPI) == 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms."
       L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms."
-    );
+      );
   }
   }
-#endif
+
+ #endif
 }
 }
 
 
 /**
 /**
   An ACPI_PARSER array describing the ACPI FADT Table.
   An ACPI_PARSER array describing the ACPI FADT Table.
 **/
 **/
-STATIC CONST ACPI_PARSER FadtParser[] = {
+STATIC CONST ACPI_PARSER  FadtParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID**)&FirmwareCtrl,
-    ValidateFirmwareCtrl, NULL},
-  {L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL},
-  {L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL},
-  {L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SCI_INT", 2, 46, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SMI_CMD", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ACPI_ENABLE", 1, 52, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ACPI_DISABLE", 1, 53, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"S4BIOS_REQ", 1, 54, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PSTATE_CNT", 1, 55, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM1a_EVT_BLK", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM1b_EVT_BLK", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM1a_CNT_BLK", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM1b_CNT_BLK", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM2_CNT_BLK", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM_TMR_BLK", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"GPE0_BLK", 4, 80, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"GPE1_BLK", 4, 84, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM1_EVT_LEN", 1, 88, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM1_CNT_LEN", 1, 89, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM2_CNT_LEN", 1, 90, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PM_TMR_LEN", 1, 91, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"GPE0_BLK_LEN", 1, 92, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"GPE1_BLK_LEN", 1, 93, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"GPE1_BASE", 1, 94, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"CST_CNT", 1, 95, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"P_LVL2_LAT", 2, 96, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"P_LVL3_LAT", 2, 98, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"FLUSH_SIZE", 2, 100, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"FLUSH_STRIDE", 2, 102, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"DUTY_OFFSET", 1, 104, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"DUTY_WIDTH", 1, 105, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"DAY_ALRM", 1, 106, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"MON_ALRM", 1, 107, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 112, L"0x%x", NULL, (VOID**)&Flags, ValidateFlags, NULL},
-  {L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL},
-  {L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID**)&FadtMinorRevision,
-    NULL, NULL},
-  {L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID**)&X_FirmwareCtrl,
-    ValidateXFirmwareCtrl, NULL},
-  {L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID**)&X_DsdtAddress, NULL, NULL},
-  {L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL},
-  {L"X_PM1b_EVT_BLK", 12, 160, NULL, DumpGas, NULL, NULL, NULL},
-  {L"X_PM1a_CNT_BLK", 12, 172, NULL, DumpGas, NULL, NULL, NULL},
-  {L"X_PM1b_CNT_BLK", 12, 184, NULL, DumpGas, NULL, NULL, NULL},
-  {L"X_PM2_CNT_BLK", 12, 196, NULL, DumpGas, NULL, NULL, NULL},
-  {L"X_PM_TMR_BLK", 12, 208, NULL, DumpGas, NULL, NULL, NULL},
-  {L"X_GPE0_BLK", 12, 220, NULL, DumpGas, NULL, NULL, NULL},
-  {L"X_GPE1_BLK", 12, 232, NULL, DumpGas, NULL, NULL, NULL},
-  {L"SLEEP_CONTROL_REG", 12, 244, NULL, DumpGas, NULL, NULL, NULL},
-  {L"SLEEP_STATUS_REG", 12, 256, NULL, DumpGas, NULL, NULL, NULL},
-  {L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL}
+  { L"FIRMWARE_CTRL",              4,   36,  L"0x%x",  NULL,    (VOID **)&FirmwareCtrl,
+    ValidateFirmwareCtrl,          NULL },
+  { L"DSDT",                       4,   40,  L"0x%x",  NULL,    (VOID **)&DsdtAddress,      NULL,           NULL },
+  { L"Reserved",                   1,   44,  L"%x",    NULL,    NULL,                       NULL,           NULL },
+  { L"Preferred_PM_Profile",       1,   45,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"SCI_INT",                    2,   46,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"SMI_CMD",                    4,   48,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"ACPI_ENABLE",                1,   52,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"ACPI_DISABLE",               1,   53,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"S4BIOS_REQ",                 1,   54,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PSTATE_CNT",                 1,   55,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM1a_EVT_BLK",               4,   56,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM1b_EVT_BLK",               4,   60,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM1a_CNT_BLK",               4,   64,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM1b_CNT_BLK",               4,   68,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM2_CNT_BLK",                4,   72,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM_TMR_BLK",                 4,   76,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"GPE0_BLK",                   4,   80,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"GPE1_BLK",                   4,   84,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM1_EVT_LEN",                1,   88,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM1_CNT_LEN",                1,   89,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM2_CNT_LEN",                1,   90,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"PM_TMR_LEN",                 1,   91,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"GPE0_BLK_LEN",               1,   92,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"GPE1_BLK_LEN",               1,   93,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"GPE1_BASE",                  1,   94,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"CST_CNT",                    1,   95,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"P_LVL2_LAT",                 2,   96,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"P_LVL3_LAT",                 2,   98,  L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"FLUSH_SIZE",                 2,   100, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"FLUSH_STRIDE",               2,   102, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"DUTY_OFFSET",                1,   104, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"DUTY_WIDTH",                 1,   105, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"DAY_ALRM",                   1,   106, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"MON_ALRM",                   1,   107, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"CENTURY",                    1,   108, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"IAPC_BOOT_ARCH",             2,   109, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"Reserved",                   1,   111, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"Flags",                      4,   112, L"0x%x",  NULL,    (VOID **)&Flags,            ValidateFlags,  NULL },
+  { L"RESET_REG",                  12,  116, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"RESET_VALUE",                1,   128, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"ARM_BOOT_ARCH",              2,   129, L"0x%x",  NULL,    NULL,                       NULL,           NULL },
+  { L"FADT Minor Version",         1,   131, L"0x%x",  NULL,    (VOID **)&FadtMinorRevision,
+    NULL,                          NULL },
+  { L"X_FIRMWARE_CTRL",            8,   132, L"0x%lx", NULL,    (VOID **)&X_FirmwareCtrl,
+    ValidateXFirmwareCtrl,         NULL },
+  { L"X_DSDT",                     8,   140, L"0x%lx", NULL,    (VOID **)&X_DsdtAddress,    NULL,           NULL },
+  { L"X_PM1a_EVT_BLK",             12,  148, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"X_PM1b_EVT_BLK",             12,  160, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"X_PM1a_CNT_BLK",             12,  172, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"X_PM1b_CNT_BLK",             12,  184, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"X_PM2_CNT_BLK",              12,  196, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"X_PM_TMR_BLK",               12,  208, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"X_GPE0_BLK",                 12,  220, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"X_GPE1_BLK",                 12,  232, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"SLEEP_CONTROL_REG",          12,  244, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"SLEEP_STATUS_REG",           12,  256, NULL,     DumpGas, NULL,                       NULL,           NULL },
+  { L"Hypervisor VendorIdentity",  8,   268, L"%lx",   NULL,    NULL,                       NULL,           NULL }
 };
 };
 
 
 /**
 /**
@@ -206,19 +209,19 @@ STATIC CONST ACPI_PARSER FadtParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiFadt (
 ParseAcpiFadt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  EFI_STATUS              Status;
-  UINT8*                  DsdtPtr;
-  UINT8*                  FirmwareCtrlPtr;
-  UINT32                  FacsSignature;
-  UINT32                  FacsLength;
-  UINT8                   FacsRevision;
-  PARSE_ACPI_TABLE_PROC   FacsParserProc;
+  EFI_STATUS             Status;
+  UINT8                  *DsdtPtr;
+  UINT8                  *FirmwareCtrlPtr;
+  UINT32                 FacsSignature;
+  UINT32                 FacsLength;
+  UINT8                  FacsRevision;
+  PARSE_ACPI_TABLE_PROC  FacsParserProc;
 
 
   ParseAcpi (
   ParseAcpi (
     Trace,
     Trace,
@@ -233,7 +236,7 @@ ParseAcpiFadt (
     if (FadtMinorRevision != NULL) {
     if (FadtMinorRevision != NULL) {
       Print (L"\nSummary:\n");
       Print (L"\nSummary:\n");
       PrintFieldName (2, L"FADT Version");
       PrintFieldName (2, L"FADT Version");
-      Print (L"%d.%d\n",  *AcpiHdrInfo.Revision, *FadtMinorRevision);
+      Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision);
     }
     }
 
 
     if (*GetAcpiXsdtHeaderInfo ()->OemTableId != *AcpiHdrInfo.OemTableId) {
     if (*GetAcpiXsdtHeaderInfo ()->OemTableId != *AcpiHdrInfo.OemTableId) {
@@ -245,9 +248,9 @@ ParseAcpiFadt (
   // If X_FIRMWARE_CTRL is not zero then use X_FIRMWARE_CTRL and ignore
   // If X_FIRMWARE_CTRL is not zero then use X_FIRMWARE_CTRL and ignore
   // FIRMWARE_CTRL, else use FIRMWARE_CTRL.
   // FIRMWARE_CTRL, else use FIRMWARE_CTRL.
   if ((X_FirmwareCtrl != NULL) && (*X_FirmwareCtrl != 0)) {
   if ((X_FirmwareCtrl != NULL) && (*X_FirmwareCtrl != 0)) {
-    FirmwareCtrlPtr = (UINT8*)(UINTN)(*X_FirmwareCtrl);
+    FirmwareCtrlPtr = (UINT8 *)(UINTN)(*X_FirmwareCtrl);
   } else if ((FirmwareCtrl != NULL) && (*FirmwareCtrl != 0)) {
   } else if ((FirmwareCtrl != NULL) && (*FirmwareCtrl != 0)) {
-    FirmwareCtrlPtr = (UINT8*)(UINTN)(*FirmwareCtrl);
+    FirmwareCtrlPtr = (UINT8 *)(UINTN)(*FirmwareCtrl);
   } else {
   } else {
     FirmwareCtrlPtr = NULL;
     FirmwareCtrlPtr = NULL;
     // if HW_REDUCED_ACPI flag is not set, both FIRMWARE_CTRL and
     // if HW_REDUCED_ACPI flag is not set, both FIRMWARE_CTRL and
@@ -255,10 +258,13 @@ ParseAcpiFadt (
     // present.
     // present.
     if ((Trace) &&
     if ((Trace) &&
         (Flags != NULL) &&
         (Flags != NULL) &&
-        ((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI)) {
+        ((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
-      Print (L"ERROR: No FACS table found, "
-               L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n");
+      Print (
+        L"ERROR: No FACS table found, "
+        L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n"
+        );
     }
     }
   }
   }
 
 
@@ -266,13 +272,13 @@ ParseAcpiFadt (
     // The FACS table does not have a standard ACPI table header. Therefore,
     // The FACS table does not have a standard ACPI table header. Therefore,
     // the signature, length and version needs to be initially parsed.
     // the signature, length and version needs to be initially parsed.
     // The FACS signature is 4 bytes starting at offset 0.
     // The FACS signature is 4 bytes starting at offset 0.
-    FacsSignature = *(UINT32*)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET);
+    FacsSignature = *(UINT32 *)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET);
 
 
     // The FACS length is 4 bytes starting at offset 4.
     // The FACS length is 4 bytes starting at offset 4.
-    FacsLength = *(UINT32*)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET);
+    FacsLength = *(UINT32 *)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET);
 
 
     // The FACS version is 1 byte starting at offset 32.
     // The FACS version is 1 byte starting at offset 32.
-    FacsRevision = *(UINT8*)(FirmwareCtrlPtr + FACS_VERSION_OFFSET);
+    FacsRevision = *(UINT8 *)(FirmwareCtrlPtr + FACS_VERSION_OFFSET);
 
 
     Trace = ProcessTableReportOptions (
     Trace = ProcessTableReportOptions (
               FacsSignature,
               FacsSignature,
@@ -298,12 +304,12 @@ ParseAcpiFadt (
 
 
   // If X_DSDT is valid then use X_DSDT and ignore DSDT, else use DSDT.
   // If X_DSDT is valid then use X_DSDT and ignore DSDT, else use DSDT.
   if ((X_DsdtAddress != NULL) && (*X_DsdtAddress != 0)) {
   if ((X_DsdtAddress != NULL) && (*X_DsdtAddress != 0)) {
-    DsdtPtr = (UINT8*)(UINTN)(*X_DsdtAddress);
+    DsdtPtr = (UINT8 *)(UINTN)(*X_DsdtAddress);
   } else if ((DsdtAddress != NULL) && (*DsdtAddress != 0)) {
   } else if ((DsdtAddress != NULL) && (*DsdtAddress != 0)) {
-    DsdtPtr = (UINT8*)(UINTN)(*DsdtAddress);
+    DsdtPtr = (UINT8 *)(UINTN)(*DsdtAddress);
   } else {
   } else {
     // Both DSDT and X_DSDT cannot be invalid.
     // Both DSDT and X_DSDT cannot be invalid.
-#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
     if (Trace) {
     if (Trace) {
       // The DSDT Table is mandatory for ARM systems
       // The DSDT Table is mandatory for ARM systems
       // as the CPU information MUST be presented in
       // as the CPU information MUST be presented in
@@ -311,7 +317,8 @@ ParseAcpiFadt (
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n");
       Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n");
     }
     }
-#endif
+
+ #endif
     return;
     return;
   }
   }
 
 

+ 102 - 96
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c

@@ -15,16 +15,16 @@
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
 // "The number of GT Block Timers must be less than or equal to 8"
 // "The number of GT Block Timers must be less than or equal to 8"
-#define GT_BLOCK_TIMER_COUNT_MAX 8
+#define GT_BLOCK_TIMER_COUNT_MAX  8
 
 
 // Local variables
 // Local variables
-STATIC CONST UINT32* GtdtPlatformTimerCount;
-STATIC CONST UINT32* GtdtPlatformTimerOffset;
-STATIC CONST UINT8*  PlatformTimerType;
-STATIC CONST UINT16* PlatformTimerLength;
-STATIC CONST UINT32* GtBlockTimerCount;
-STATIC CONST UINT32* GtBlockTimerOffset;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT32                  *GtdtPlatformTimerCount;
+STATIC CONST UINT32                  *GtdtPlatformTimerOffset;
+STATIC CONST UINT8                   *PlatformTimerType;
+STATIC CONST UINT16                  *PlatformTimerLength;
+STATIC CONST UINT32                  *GtBlockTimerCount;
+STATIC CONST UINT32                  *GtBlockTimerOffset;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   This function validates the GT Block timer count.
   This function validates the GT Block timer count.
@@ -37,13 +37,13 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateGtBlockTimerCount (
 ValidateGtBlockTimerCount (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  UINT32 BlockTimerCount;
+  UINT32  BlockTimerCount;
 
 
-  BlockTimerCount = *(UINT32*)Ptr;
+  BlockTimerCount = *(UINT32 *)Ptr;
 
 
   if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) {
   if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -66,13 +66,13 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateGtFrameNumber (
 ValidateGtFrameNumber (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  UINT8 FrameNumber;
+  UINT8  FrameNumber;
 
 
-  FrameNumber = *(UINT8*)Ptr;
+  FrameNumber = *(UINT8 *)Ptr;
 
 
   if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) {
   if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -87,82 +87,82 @@ ValidateGtFrameNumber (
 /**
 /**
   An ACPI_PARSER array describing the ACPI GTDT Table.
   An ACPI_PARSER array describing the ACPI GTDT Table.
 **/
 **/
-STATIC CONST ACPI_PARSER GtdtParser[] = {
+STATIC CONST ACPI_PARSER  GtdtParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"CntControlBase Physical Address", 8, 36, L"0x%lx", NULL, NULL,
-   NULL, NULL},
-  {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Platform Timer Count", 4, 88, L"%d", NULL,
-   (VOID**)&GtdtPlatformTimerCount, NULL, NULL},
-  {L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
-   (VOID**)&GtdtPlatformTimerOffset, NULL, NULL},
-  {L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL, NULL, NULL}
+  { L"CntControlBase Physical Address",8,      36,  L"0x%lx", NULL, NULL,
+    NULL,                             NULL },
+  { L"Reserved",                      4,      44,  L"0x%x",  NULL, NULL,NULL,  NULL },
+  { L"Secure EL1 timer GSIV",         4,      48,  L"0x%x",  NULL, NULL,NULL,  NULL },
+  { L"Secure EL1 timer FLAGS",        4,      52,  L"0x%x",  NULL, NULL,NULL,  NULL },
+
+  { L"Non-Secure EL1 timer GSIV",     4,      56,  L"0x%x",  NULL, NULL,NULL,  NULL },
+  { L"Non-Secure EL1 timer FLAGS",    4,      60,  L"0x%x",  NULL, NULL,NULL,  NULL },
+
+  { L"Virtual timer GSIV",            4,      64,  L"0x%x",  NULL, NULL,NULL,  NULL },
+  { L"Virtual timer FLAGS",           4,      68,  L"0x%x",  NULL, NULL,NULL,  NULL },
+
+  { L"Non-Secure EL2 timer GSIV",     4,      72,  L"0x%x",  NULL, NULL,NULL,  NULL },
+  { L"Non-Secure EL2 timer FLAGS",    4,      76,  L"0x%x",  NULL, NULL,NULL,  NULL },
+
+  { L"CntReadBase Physical address",  8,      80,  L"0x%lx", NULL, NULL,NULL,  NULL },
+  { L"Platform Timer Count",          4,      88,  L"%d",    NULL,
+    (VOID **)&GtdtPlatformTimerCount, NULL,   NULL },
+  { L"Platform Timer Offset",         4,      92,  L"0x%x",  NULL,
+    (VOID **)&GtdtPlatformTimerOffset,NULL,   NULL },
+  { L"Virtual EL2 Timer GSIV",        4,      96,  L"0x%x",  NULL, NULL,NULL,  NULL },
+  { L"Virtual EL2 Timer Flags",       4,      100, L"0x%x",  NULL, NULL,NULL,  NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Platform timer header.
   An ACPI_PARSER array describing the Platform timer header.
 **/
 **/
-STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = {
-  {L"Type", 1, 0, NULL, NULL, (VOID**)&PlatformTimerType, NULL, NULL},
-  {L"Length", 2, 1, NULL, NULL, (VOID**)&PlatformTimerLength, NULL, NULL},
-  {L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  GtPlatformTimerHeaderParser[] = {
+  { L"Type",     1, 0, NULL, NULL, (VOID **)&PlatformTimerType,   NULL, NULL },
+  { L"Length",   2, 1, NULL, NULL, (VOID **)&PlatformTimerLength, NULL, NULL },
+  { L"Reserved", 1, 3, NULL, NULL, NULL,                          NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Platform GT Block.
   An ACPI_PARSER array describing the Platform GT Block.
 **/
 **/
-STATIC CONST ACPI_PARSER GtBlockParser[] = {
-  {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL},
-  {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL},
-  {L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Timer Count", 4, 12, L"%d", NULL, (VOID**)&GtBlockTimerCount,
-   ValidateGtBlockTimerCount, NULL},
-  {L"Timer Offset", 4, 16, L"%d", NULL, (VOID**)&GtBlockTimerOffset, NULL,
-    NULL}
+STATIC CONST ACPI_PARSER  GtBlockParser[] = {
+  { L"Type",                          1, 0,  L"%d",    NULL, NULL,                         NULL, NULL },
+  { L"Length",                        2, 1,  L"%d",    NULL, NULL,                         NULL, NULL },
+  { L"Reserved",                      1, 3,  L"%x",    NULL, NULL,                         NULL, NULL },
+  { L"Physical address (CntCtlBase)", 8, 4,  L"0x%lx", NULL, NULL,                         NULL, NULL },
+  { L"Timer Count",                   4, 12, L"%d",    NULL, (VOID **)&GtBlockTimerCount,
+    ValidateGtBlockTimerCount, NULL },
+  { L"Timer Offset",                  4, 16, L"%d",    NULL, (VOID **)&GtBlockTimerOffset, NULL,
+    NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the GT Block timer.
   An ACPI_PARSER array describing the GT Block timer.
 **/
 **/
-STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {
-  {L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, NULL},
-  {L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
-  {L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL,
-    NULL},
-  {L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  GtBlockTimerParser[] = {
+  { L"Frame Number",                   1, 0,  L"%d",       NULL,       NULL, ValidateGtFrameNumber, NULL },
+  { L"Reserved",                       3, 1,  L"%x %x %x", Dump3Chars, NULL, NULL,                  NULL },
+  { L"Physical address (CntBaseX)",    8, 4,  L"0x%lx",    NULL,       NULL, NULL,                  NULL },
+  { L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx",    NULL,       NULL, NULL,
+    NULL },
+  { L"Physical Timer GSIV",            4, 20, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Physical Timer Flags",           4, 24, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Virtual Timer GSIV",             4, 28, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Virtual Timer Flags",            4, 32, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Common Flags",                   4, 36, L"0x%x",     NULL,       NULL, NULL,                  NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Platform Watchdog.
   An ACPI_PARSER array describing the Platform Watchdog.
 **/
 **/
-STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {
-  {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL},
-  {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL},
-  {L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  ArmGenericWatchdogParser[] = {
+  { L"Type",                          1, 0,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Length",                        2, 1,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Reserved",                      1, 3,  L"%x",    NULL, NULL, NULL, NULL },
+  { L"RefreshFrame Physical address", 8, 4,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Watchdog Timer GSIV",           4, 20, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Watchdog Timer Flags",          4, 24, L"0x%x",  NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -174,12 +174,12 @@ STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {
 STATIC
 STATIC
 VOID
 VOID
 DumpGTBlock (
 DumpGTBlock (
-  IN UINT8* Ptr,
-  IN UINT16 Length
+  IN UINT8   *Ptr,
+  IN UINT16  Length
   )
   )
 {
 {
-  UINT32 Index;
-  UINT32 Offset;
+  UINT32  Index;
+  UINT32  Offset;
 
 
   ParseAcpi (
   ParseAcpi (
     TRUE,
     TRUE,
@@ -193,7 +193,8 @@ DumpGTBlock (
   // Check if the values used to control the parsing logic have been
   // Check if the values used to control the parsing logic have been
   // successfully read.
   // successfully read.
   if ((GtBlockTimerCount == NULL) ||
   if ((GtBlockTimerCount == NULL) ||
-      (GtBlockTimerOffset == NULL)) {
+      (GtBlockTimerOffset == NULL))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient GT Block Structure length. Length = %d.\n",
       L"ERROR: Insufficient GT Block Structure length. Length = %d.\n",
@@ -203,12 +204,13 @@ DumpGTBlock (
   }
   }
 
 
   Offset = *GtBlockTimerOffset;
   Offset = *GtBlockTimerOffset;
-  Index = 0;
+  Index  = 0;
 
 
   // Parse the specified number of GT Block Timer Structures or the GT Block
   // Parse the specified number of GT Block Timer Structures or the GT Block
   // Structure buffer length. Whichever is minimum.
   // Structure buffer length. Whichever is minimum.
   while ((Index++ < *GtBlockTimerCount) &&
   while ((Index++ < *GtBlockTimerCount) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     Offset += ParseAcpi (
     Offset += ParseAcpi (
                 TRUE,
                 TRUE,
                 2,
                 2,
@@ -229,8 +231,8 @@ DumpGTBlock (
 STATIC
 STATIC
 VOID
 VOID
 DumpWatchdogTimer (
 DumpWatchdogTimer (
-  IN UINT8* Ptr,
-  IN UINT16 Length
+  IN UINT8   *Ptr,
+  IN UINT16  Length
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -262,15 +264,15 @@ DumpWatchdogTimer (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiGtdt (
 ParseAcpiGtdt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Index;
-  UINT32 Offset;
-  UINT8* TimerPtr;
+  UINT32  Index;
+  UINT32  Offset;
+  UINT8   *TimerPtr;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -288,7 +290,8 @@ ParseAcpiGtdt (
   // Check if the values used to control the parsing logic have been
   // Check if the values used to control the parsing logic have been
   // successfully read.
   // successfully read.
   if ((GtdtPlatformTimerCount == NULL) ||
   if ((GtdtPlatformTimerCount == NULL) ||
-      (GtdtPlatformTimerOffset == NULL)) {
+      (GtdtPlatformTimerOffset == NULL))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
       L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
@@ -298,13 +301,14 @@ ParseAcpiGtdt (
   }
   }
 
 
   TimerPtr = Ptr + *GtdtPlatformTimerOffset;
   TimerPtr = Ptr + *GtdtPlatformTimerOffset;
-  Offset = *GtdtPlatformTimerOffset;
-  Index = 0;
+  Offset   = *GtdtPlatformTimerOffset;
+  Index    = 0;
 
 
   // Parse the specified number of Platform Timer Structures or the GTDT
   // Parse the specified number of Platform Timer Structures or the GTDT
   // buffer length. Whichever is minimum.
   // buffer length. Whichever is minimum.
   while ((Index++ < *GtdtPlatformTimerCount) &&
   while ((Index++ < *GtdtPlatformTimerCount) &&
-         (Offset < AcpiTableLength)) {
+         (Offset < AcpiTableLength))
+  {
     // Parse the Platform Timer Header to obtain Length and Type
     // Parse the Platform Timer Header to obtain Length and Type
     ParseAcpi (
     ParseAcpi (
       FALSE,
       FALSE,
@@ -318,11 +322,12 @@ ParseAcpiGtdt (
     // Check if the values used to control the parsing logic have been
     // Check if the values used to control the parsing logic have been
     // successfully read.
     // successfully read.
     if ((PlatformTimerType == NULL) ||
     if ((PlatformTimerType == NULL) ||
-        (PlatformTimerLength == NULL)) {
+        (PlatformTimerLength == NULL))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Insufficient remaining table buffer length to read the " \
         L"ERROR: Insufficient remaining table buffer length to read the " \
-          L"Platform Timer Structure header. Length = %d.\n",
+        L"Platform Timer Structure header. Length = %d.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
       return;
       return;
@@ -330,11 +335,12 @@ ParseAcpiGtdt (
 
 
     // Validate Platform Timer Structure length
     // Validate Platform Timer Structure length
     if ((*PlatformTimerLength == 0) ||
     if ((*PlatformTimerLength == 0) ||
-        ((Offset + (*PlatformTimerLength)) > AcpiTableLength)) {
+        ((Offset + (*PlatformTimerLength)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid Platform Timer Structure length. " \
         L"ERROR: Invalid Platform Timer Structure length. " \
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
         *PlatformTimerLength,
         *PlatformTimerLength,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength
@@ -359,6 +365,6 @@ ParseAcpiGtdt (
     } // switch
     } // switch
 
 
     TimerPtr += *PlatformTimerLength;
     TimerPtr += *PlatformTimerLength;
-    Offset += *PlatformTimerLength;
+    Offset   += *PlatformTimerLength;
   } // while
   } // while
 }
 }

+ 118 - 102
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c

@@ -21,27 +21,27 @@
 #include "AcpiView.h"
 #include "AcpiView.h"
 
 
 // Maximum Memory Domain matrix print size.
 // Maximum Memory Domain matrix print size.
-#define MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX    10
+#define MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX  10
 
 
 // Local variables
 // Local variables
-STATIC CONST UINT16*  HmatStructureType;
-STATIC CONST UINT32*  HmatStructureLength;
+STATIC CONST UINT16  *HmatStructureType;
+STATIC CONST UINT32  *HmatStructureLength;
 
 
-STATIC CONST UINT32*  NumberInitiatorProximityDomain;
-STATIC CONST UINT32*  NumberTargetProximityDomain;
+STATIC CONST UINT32  *NumberInitiatorProximityDomain;
+STATIC CONST UINT32  *NumberTargetProximityDomain;
 STATIC CONST
 STATIC CONST
-EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_FLAGS*
-SllbiFlags;
+EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_FLAGS *
+  SllbiFlags;
 
 
-STATIC CONST UINT8*   SllbiDataType;
-STATIC CONST UINT16*  NumberSMBIOSHandles;
+STATIC CONST UINT8   *SllbiDataType;
+STATIC CONST UINT16  *NumberSMBIOSHandles;
 
 
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   Names of System Locality Latency Bandwidth Information (SLLBI) data types
   Names of System Locality Latency Bandwidth Information (SLLBI) data types
 **/
 **/
-STATIC CONST CHAR16* SllbiNames[] = {
+STATIC CONST CHAR16  *SllbiNames[] = {
   L"Access %sLatency%s",
   L"Access %sLatency%s",
   L"Read %sLatency%s",
   L"Read %sLatency%s",
   L"Write %sLatency%s",
   L"Write %sLatency%s",
@@ -61,15 +61,15 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateCacheAttributes (
 ValidateCacheAttributes (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*
-  Attributes;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
+    Attributes;
 
 
   Attributes =
   Attributes =
-    (EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*)Ptr;
+    (EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *)Ptr;
 
 
   if (Attributes->TotalCacheLevels > 0x3) {
   if (Attributes->TotalCacheLevels > 0x3) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -78,6 +78,7 @@ ValidateCacheAttributes (
       Attributes->TotalCacheLevels
       Attributes->TotalCacheLevels
       );
       );
   }
   }
+
   if (Attributes->CacheLevel > 0x3) {
   if (Attributes->CacheLevel > 0x3) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
@@ -85,6 +86,7 @@ ValidateCacheAttributes (
       Attributes->CacheLevel
       Attributes->CacheLevel
       );
       );
   }
   }
+
   if (Attributes->CacheAssociativity > 0x2) {
   if (Attributes->CacheAssociativity > 0x2) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
@@ -92,6 +94,7 @@ ValidateCacheAttributes (
       Attributes->CacheAssociativity
       Attributes->CacheAssociativity
       );
       );
   }
   }
+
   if (Attributes->WritePolicy > 0x2) {
   if (Attributes->WritePolicy > 0x2) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
@@ -111,15 +114,15 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpCacheAttributes (
 DumpCacheAttributes (
-  IN CONST CHAR16* Format OPTIONAL,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
   )
   )
 {
 {
-  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*
-  Attributes;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
+    Attributes;
 
 
   Attributes =
   Attributes =
-    (EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*)Ptr;
+    (EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *)Ptr;
 
 
   Print (L"\n");
   Print (L"\n");
   PrintFieldName (4, L"Total Cache Levels");
   PrintFieldName (4, L"Total Cache Levels");
@@ -137,55 +140,55 @@ DumpCacheAttributes (
 /**
 /**
   An ACPI_PARSER array describing the ACPI HMAT Table.
   An ACPI_PARSER array describing the ACPI HMAT Table.
 */
 */
-STATIC CONST ACPI_PARSER HmatParser[] = {
+STATIC CONST ACPI_PARSER  HmatParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Reserved", 4, 36, NULL, NULL, NULL, NULL, NULL}
+  { L"Reserved",                   4,36, NULL, NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the HMAT structure header.
   An ACPI_PARSER array describing the HMAT structure header.
 */
 */
-STATIC CONST ACPI_PARSER HmatStructureHeaderParser[] = {
-  {L"Type", 2, 0, NULL, NULL, (VOID**)&HmatStructureType, NULL, NULL},
-  {L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL},
-  {L"Length", 4, 4, NULL, NULL, (VOID**)&HmatStructureLength, NULL, NULL}
+STATIC CONST ACPI_PARSER  HmatStructureHeaderParser[] = {
+  { L"Type",     2, 0, NULL, NULL, (VOID **)&HmatStructureType,   NULL, NULL },
+  { L"Reserved", 2, 2, NULL, NULL, NULL,                          NULL, NULL },
+  { L"Length",   4, 4, NULL, NULL, (VOID **)&HmatStructureLength, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI PARSER array describing the Memory Proximity Domain Attributes
   An ACPI PARSER array describing the Memory Proximity Domain Attributes
   Structure - Type 0.
   Structure - Type 0.
 */
 */
-STATIC CONST ACPI_PARSER MemProximityDomainAttributeParser[] = {
-  {L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
-  {L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 10, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Proximity Dom for initiator", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Proximity Dom for memory", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  MemProximityDomainAttributeParser[] = {
+  { L"Type",                        2, 0,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",                    2, 2,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Length",                      4, 4,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Flags",                       2, 8,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",                    2, 10, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Proximity Dom for initiator", 4, 12, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Proximity Dom for memory",    4, 16, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",                    4, 20, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",                    8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Reserved",                    8, 32, L"0x%lx", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI PARSER array describing the System Locality Latency and Bandwidth
   An ACPI PARSER array describing the System Locality Latency and Bandwidth
   Information Structure - Type 1.
   Information Structure - Type 1.
 */
 */
-STATIC CONST ACPI_PARSER SllbiParser[] = {
-  {L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
-  {L"Flags", 1, 8, L"0x%x", NULL, (VOID**)&SllbiFlags, NULL, NULL},
-  {L"Data type", 1, 9, L"0x%x", NULL, (VOID**)&SllbiDataType, NULL, NULL},
-  {L"Min Transfer Size", 1, 10, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 1, 11, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Initiator Proximity Dom Count", 4, 12, L"%d", NULL,
-    (VOID**)&NumberInitiatorProximityDomain, NULL, NULL},
-  {L"Target Proximity Dom Count", 4, 16, L"%d", NULL,
-    (VOID**)&NumberTargetProximityDomain, NULL, NULL},
-  {L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Entry Base Unit", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  SllbiParser[] = {
+  { L"Type",                          2, 0,  L"0x%x",  NULL, NULL,                    NULL, NULL },
+  { L"Reserved",                      2, 2,  L"0x%x",  NULL, NULL,                    NULL, NULL },
+  { L"Length",                        4, 4,  L"%d",    NULL, NULL,                    NULL, NULL },
+  { L"Flags",                         1, 8,  L"0x%x",  NULL, (VOID **)&SllbiFlags,    NULL, NULL },
+  { L"Data type",                     1, 9,  L"0x%x",  NULL, (VOID **)&SllbiDataType, NULL, NULL },
+  { L"Min Transfer Size",             1, 10, L"%d",    NULL, NULL,                    NULL, NULL },
+  { L"Reserved",                      1, 11, L"0x%x",  NULL, NULL,                    NULL, NULL },
+  { L"Initiator Proximity Dom Count", 4, 12, L"%d",    NULL,
+    (VOID **)&NumberInitiatorProximityDomain, NULL, NULL },
+  { L"Target Proximity Dom Count",    4, 16, L"%d",    NULL,
+    (VOID **)&NumberTargetProximityDomain, NULL, NULL },
+  { L"Reserved",                      4, 20, L"0x%x",  NULL, NULL,                    NULL, NULL },
+  { L"Entry Base Unit",               8, 24, L"0x%lx", NULL, NULL,                    NULL, NULL }
   // initiator Proximity Domain list ...
   // initiator Proximity Domain list ...
   // target Proximity Domain list ...
   // target Proximity Domain list ...
   // Latency/Bandwidth matrix ...
   // Latency/Bandwidth matrix ...
@@ -195,18 +198,18 @@ STATIC CONST ACPI_PARSER SllbiParser[] = {
   An ACPI PARSER array describing the Memory Side Cache Information
   An ACPI PARSER array describing the Memory Side Cache Information
   Structure - Type 2.
   Structure - Type 2.
 */
 */
-STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = {
-  {L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
-  {L"Proximity Dom for memory", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Memory Side Cache Size", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Cache Attributes", 4, 24, NULL, DumpCacheAttributes, NULL,
-    ValidateCacheAttributes, NULL},
-  {L"Reserved", 2, 28, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SMBIOS Handle Count", 2, 30, L"%d", NULL,
-    (VOID**)&NumberSMBIOSHandles, NULL, NULL}
+STATIC CONST ACPI_PARSER  MemSideCacheInfoParser[] = {
+  { L"Type",                     2, 0,  L"0x%x",  NULL,                NULL, NULL, NULL },
+  { L"Reserved",                 2, 2,  L"0x%x",  NULL,                NULL, NULL, NULL },
+  { L"Length",                   4, 4,  L"%d",    NULL,                NULL, NULL, NULL },
+  { L"Proximity Dom for memory", 4, 8,  L"0x%x",  NULL,                NULL, NULL, NULL },
+  { L"Reserved",                 4, 12, L"0x%x",  NULL,                NULL, NULL, NULL },
+  { L"Memory Side Cache Size",   8, 16, L"0x%lx", NULL,                NULL, NULL, NULL },
+  { L"Cache Attributes",         4, 24, NULL,     DumpCacheAttributes, NULL,
+    ValidateCacheAttributes, NULL },
+  { L"Reserved",                 2, 28, L"0x%x",  NULL,                NULL, NULL, NULL },
+  { L"SMBIOS Handle Count",      2, 30, L"%d",    NULL,
+    (VOID **)&NumberSMBIOSHandles, NULL, NULL }
   // SMBIOS handles List ...
   // SMBIOS handles List ...
 };
 };
 
 
@@ -222,8 +225,8 @@ STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = {
 STATIC
 STATIC
 VOID
 VOID
 DumpMpda (
 DumpMpda (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -248,13 +251,13 @@ DumpMpda (
 STATIC
 STATIC
 VOID
 VOID
 DumpSllbi (
 DumpSllbi (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
-  CONST UINT32* InitiatorProximityDomainList;
-  CONST UINT32* TargetProximityDomainList;
-  CONST UINT16* LatencyBandwidthMatrix;
+  CONST UINT32  *InitiatorProximityDomainList;
+  CONST UINT32  *TargetProximityDomainList;
+  CONST UINT16  *LatencyBandwidthMatrix;
   UINT32        Offset;
   UINT32        Offset;
   CHAR16        Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
   CHAR16        Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
   CHAR16        SecondBuffer[OUTPUT_FIELD_COLUMN_WIDTH];
   CHAR16        SecondBuffer[OUTPUT_FIELD_COLUMN_WIDTH];
@@ -278,11 +281,12 @@ DumpSllbi (
   if ((SllbiFlags == NULL)                     ||
   if ((SllbiFlags == NULL)                     ||
       (SllbiDataType == NULL)                  ||
       (SllbiDataType == NULL)                  ||
       (NumberInitiatorProximityDomain == NULL) ||
       (NumberInitiatorProximityDomain == NULL) ||
-      (NumberTargetProximityDomain == NULL)) {
+      (NumberTargetProximityDomain == NULL))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient remaining table buffer length to read the " \
       L"ERROR: Insufficient remaining table buffer length to read the " \
-        L"SLLBI structure header. Length = %d.\n",
+      L"SLLBI structure header. Length = %d.\n",
       Length
       Length
       );
       );
     return;
     return;
@@ -306,10 +310,10 @@ DumpSllbi (
     return;
     return;
   }
   }
 
 
-  InitiatorProximityDomainList = (UINT32*) (Ptr + Offset);
-  TargetProximityDomainList = InitiatorProximityDomainList +
-                              *NumberInitiatorProximityDomain;
-  LatencyBandwidthMatrix = (UINT16*) (TargetProximityDomainList +
+  InitiatorProximityDomainList = (UINT32 *)(Ptr + Offset);
+  TargetProximityDomainList    = InitiatorProximityDomainList +
+                                 *NumberInitiatorProximityDomain;
+  LatencyBandwidthMatrix = (UINT16 *)(TargetProximityDomainList +
                                       *NumberTargetProximityDomain);
                                       *NumberTargetProximityDomain);
 
 
   // Display each element of the Initiator Proximity Domain list
   // Display each element of the Initiator Proximity Domain list
@@ -350,6 +354,7 @@ DumpSllbi (
     Print (L"Error: Unkown Data Type. DataType = 0x%x.\n", *SllbiDataType);
     Print (L"Error: Unkown Data Type. DataType = 0x%x.\n", *SllbiDataType);
     return;
     return;
   }
   }
+
   StrCpyS (Buffer, sizeof (Buffer), SllbiNames[*SllbiDataType]);
   StrCpyS (Buffer, sizeof (Buffer), SllbiNames[*SllbiDataType]);
 
 
   // Adjust base name depending on Memory Hierarchy in this Structure
   // Adjust base name depending on Memory Hierarchy in this Structure
@@ -381,7 +386,6 @@ DumpSllbi (
         SllbiFlags->MemoryHierarchy
         SllbiFlags->MemoryHierarchy
         );
         );
       return;
       return;
-
   } // switch
   } // switch
 
 
   if (*NumberTargetProximityDomain <= MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX) {
   if (*NumberTargetProximityDomain <= MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX) {
@@ -400,34 +404,41 @@ DumpSllbi (
 
 
     for (IndexTarget = 0;
     for (IndexTarget = 0;
          IndexTarget < *NumberTargetProximityDomain;
          IndexTarget < *NumberTargetProximityDomain;
-         IndexTarget++) {
+         IndexTarget++)
+    {
       Print (L"    %2d", IndexTarget);
       Print (L"    %2d", IndexTarget);
     }
     }
 
 
     Print (L"\n      ---+");
     Print (L"\n      ---+");
     for (IndexTarget = 0;
     for (IndexTarget = 0;
          IndexTarget < *NumberTargetProximityDomain;
          IndexTarget < *NumberTargetProximityDomain;
-         IndexTarget++) {
+         IndexTarget++)
+    {
       Print (L"------");
       Print (L"------");
     }
     }
+
     Print (L"\n");
     Print (L"\n");
 
 
     TargetStartOffset = 0;
     TargetStartOffset = 0;
     for (IndexInitiator = 0;
     for (IndexInitiator = 0;
          IndexInitiator < *NumberInitiatorProximityDomain;
          IndexInitiator < *NumberInitiatorProximityDomain;
-         IndexInitiator++) {
+         IndexInitiator++)
+    {
       Print (L"      %2d |", IndexInitiator);
       Print (L"      %2d |", IndexInitiator);
       for (IndexTarget = 0;
       for (IndexTarget = 0;
            IndexTarget < *NumberTargetProximityDomain;
            IndexTarget < *NumberTargetProximityDomain;
-           IndexTarget++) {
+           IndexTarget++)
+      {
         Print (
         Print (
           L" %5d",
           L" %5d",
           LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
           LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
           );
           );
       } // for Target
       } // for Target
+
       Print (L"\n");
       Print (L"\n");
       TargetStartOffset += (*NumberTargetProximityDomain);
       TargetStartOffset += (*NumberTargetProximityDomain);
     } // for Initiator
     } // for Initiator
+
     Print (L"\n");
     Print (L"\n");
   } else {
   } else {
     // Display the latency/bandwidth matrix as a list
     // Display the latency/bandwidth matrix as a list
@@ -441,10 +452,12 @@ DumpSllbi (
     TargetStartOffset = 0;
     TargetStartOffset = 0;
     for (IndexInitiator = 0;
     for (IndexInitiator = 0;
          IndexInitiator < *NumberInitiatorProximityDomain;
          IndexInitiator < *NumberInitiatorProximityDomain;
-         IndexInitiator++) {
+         IndexInitiator++)
+    {
       for (IndexTarget = 0;
       for (IndexTarget = 0;
            IndexTarget < *NumberTargetProximityDomain;
            IndexTarget < *NumberTargetProximityDomain;
-           IndexTarget++) {
+           IndexTarget++)
+      {
         UnicodeSPrint (
         UnicodeSPrint (
           SecondBuffer,
           SecondBuffer,
           sizeof (SecondBuffer),
           sizeof (SecondBuffer),
@@ -459,6 +472,7 @@ DumpSllbi (
           LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
           LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
           );
           );
       } // for Target
       } // for Target
+
       TargetStartOffset += (*NumberTargetProximityDomain);
       TargetStartOffset += (*NumberTargetProximityDomain);
     } // for Initiator
     } // for Initiator
   }
   }
@@ -474,11 +488,11 @@ DumpSllbi (
 STATIC
 STATIC
 VOID
 VOID
 DumpMsci (
 DumpMsci (
-  IN UINT8* Ptr,
-  IN UINT32 Length
+  IN UINT8   *Ptr,
+  IN UINT32  Length
   )
   )
 {
 {
-  CONST UINT16* SMBIOSHandlesList;
+  CONST UINT16  *SMBIOSHandlesList;
   CHAR16        Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
   CHAR16        Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
   UINT32        Offset;
   UINT32        Offset;
   UINT16        Index;
   UINT16        Index;
@@ -498,7 +512,7 @@ DumpMsci (
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient remaining table buffer length to read the " \
       L"ERROR: Insufficient remaining table buffer length to read the " \
-        L"MSCI structure header. Length = %d.\n",
+      L"MSCI structure header. Length = %d.\n",
       Length
       Length
       );
       );
     return;
     return;
@@ -515,7 +529,7 @@ DumpMsci (
     return;
     return;
   }
   }
 
 
-  SMBIOSHandlesList = (UINT16*) (Ptr + Offset);
+  SMBIOSHandlesList = (UINT16 *)(Ptr + Offset);
 
 
   for (Index = 0; Index < *NumberSMBIOSHandles; Index++) {
   for (Index = 0; Index < *NumberSMBIOSHandles; Index++) {
     UnicodeSPrint (
     UnicodeSPrint (
@@ -553,14 +567,14 @@ DumpMsci (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiHmat (
 ParseAcpiHmat (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT8* HmatStructurePtr;
+  UINT32  Offset;
+  UINT8   *HmatStructurePtr;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -591,11 +605,12 @@ ParseAcpiHmat (
     // Check if the values used to control the parsing logic have been
     // Check if the values used to control the parsing logic have been
     // successfully read.
     // successfully read.
     if ((HmatStructureType == NULL) ||
     if ((HmatStructureType == NULL) ||
-        (HmatStructureLength == NULL)) {
+        (HmatStructureLength == NULL))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Insufficient remaining table buffer length to read the " \
         L"ERROR: Insufficient remaining table buffer length to read the " \
-          L"HMAT structure header. Length = %d.\n",
+        L"HMAT structure header. Length = %d.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
       return;
       return;
@@ -603,11 +618,12 @@ ParseAcpiHmat (
 
 
     // Validate HMAT Structure length.
     // Validate HMAT Structure length.
     if ((*HmatStructureLength == 0) ||
     if ((*HmatStructureLength == 0) ||
-        ((Offset + (*HmatStructureLength)) > AcpiTableLength)) {
+        ((Offset + (*HmatStructureLength)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid HMAT Structure length. " \
         L"ERROR: Invalid HMAT Structure length. " \
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
         *HmatStructureLength,
         *HmatStructureLength,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength
@@ -629,7 +645,7 @@ ParseAcpiHmat (
           );
           );
         break;
         break;
       case EFI_ACPI_6_4_HMAT_TYPE_MEMORY_SIDE_CACHE_INFO:
       case EFI_ACPI_6_4_HMAT_TYPE_MEMORY_SIDE_CACHE_INFO:
-         DumpMsci (
+        DumpMsci (
           HmatStructurePtr,
           HmatStructurePtr,
           *HmatStructureLength
           *HmatStructureLength
           );
           );
@@ -638,7 +654,7 @@ ParseAcpiHmat (
         IncrementErrorCount ();
         IncrementErrorCount ();
         Print (
         Print (
           L"ERROR: Unknown HMAT structure:"
           L"ERROR: Unknown HMAT structure:"
-            L" Type = %d, Length = %d\n",
+          L" Type = %d, Length = %d\n",
           *HmatStructureType,
           *HmatStructureType,
           *HmatStructureLength
           *HmatStructureLength
           );
           );
@@ -646,6 +662,6 @@ ParseAcpiHmat (
     } // switch
     } // switch
 
 
     HmatStructurePtr += *HmatStructureLength;
     HmatStructurePtr += *HmatStructureLength;
-    Offset += *HmatStructureLength;
+    Offset           += *HmatStructureLength;
   } // while
   } // while
 }
 }

+ 167 - 157
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c

@@ -16,22 +16,22 @@
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
 // Local variables
 // Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
-STATIC CONST UINT32* IortNodeCount;
-STATIC CONST UINT32* IortNodeOffset;
+STATIC CONST UINT32  *IortNodeCount;
+STATIC CONST UINT32  *IortNodeOffset;
 
 
-STATIC CONST UINT8*  IortNodeType;
-STATIC CONST UINT16* IortNodeLength;
-STATIC CONST UINT32* IortIdMappingCount;
-STATIC CONST UINT32* IortIdMappingOffset;
+STATIC CONST UINT8   *IortNodeType;
+STATIC CONST UINT16  *IortNodeLength;
+STATIC CONST UINT32  *IortIdMappingCount;
+STATIC CONST UINT32  *IortIdMappingOffset;
 
 
-STATIC CONST UINT32* InterruptContextCount;
-STATIC CONST UINT32* InterruptContextOffset;
-STATIC CONST UINT32* PmuInterruptCount;
-STATIC CONST UINT32* PmuInterruptOffset;
+STATIC CONST UINT32  *InterruptContextCount;
+STATIC CONST UINT32  *InterruptContextOffset;
+STATIC CONST UINT32  *PmuInterruptCount;
+STATIC CONST UINT32  *PmuInterruptOffset;
 
 
-STATIC CONST UINT32* ItsCount;
+STATIC CONST UINT32  *ItsCount;
 
 
 /**
 /**
   This function validates the ID Mapping array count for the ITS node.
   This function validates the ID Mapping array count for the ITS node.
@@ -44,11 +44,11 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateItsIdMappingCount (
 ValidateItsIdMappingCount (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  if (*(UINT32*)Ptr != 0) {
+  if (*(UINT32 *)Ptr != 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (L"\nERROR: IORT ID Mapping count must be zero.");
     Print (L"\nERROR: IORT ID Mapping count must be zero.");
   }
   }
@@ -66,11 +66,11 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidatePmcgIdMappingCount (
 ValidatePmcgIdMappingCount (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  if (*(UINT32*)Ptr > 1) {
+  if (*(UINT32 *)Ptr > 1) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (L"\nERROR: IORT ID Mapping count must not be greater than 1.");
     Print (L"\nERROR: IORT ID Mapping count must not be greater than 1.");
   }
   }
@@ -87,11 +87,11 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateItsIdArrayReference (
 ValidateItsIdArrayReference (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  if (*(UINT32*)Ptr != 0) {
+  if (*(UINT32 *)Ptr != 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (L"\nERROR: IORT ID Mapping offset must be zero.");
     Print (L"\nERROR: IORT ID Mapping offset must be zero.");
   }
   }
@@ -119,135 +119,135 @@ ValidateItsIdArrayReference (
 /**
 /**
   An ACPI_PARSER array describing the ACPI IORT Table
   An ACPI_PARSER array describing the ACPI IORT Table
 **/
 **/
-STATIC CONST ACPI_PARSER IortParser[] = {
+STATIC CONST ACPI_PARSER  IortParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Number of IORT Nodes", 4, 36, L"%d", NULL,
-   (VOID**)&IortNodeCount, NULL, NULL},
-  {L"Offset to Array of IORT Nodes", 4, 40, L"0x%x", NULL,
-   (VOID**)&IortNodeOffset, NULL, NULL},
-  {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL}
+  { L"Number of IORT Nodes",       4,     36, L"%d",   NULL,
+    (VOID **)&IortNodeCount,       NULL,  NULL },
+  { L"Offset to Array of IORT Nodes",4,     40, L"0x%x", NULL,
+    (VOID **)&IortNodeOffset,      NULL,  NULL },
+  { L"Reserved",                   4,     44, L"0x%x", NULL,NULL,NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IORT node header structure.
   An ACPI_PARSER array describing the IORT node header structure.
 **/
 **/
-STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = {
+STATIC CONST ACPI_PARSER  IortNodeHeaderParser[] = {
   PARSE_IORT_NODE_HEADER (NULL, NULL)
   PARSE_IORT_NODE_HEADER (NULL, NULL)
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IORT SMMUv1/2 node.
   An ACPI_PARSER array describing the IORT SMMUv1/2 node.
 **/
 **/
-STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = {
-  PARSE_IORT_NODE_HEADER (NULL, NULL),
-  {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Span", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Model", 4, 32, L"%d", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reference to Global Interrupt Array", 4, 40, L"0x%x", NULL, NULL, NULL,
-   NULL},
-  {L"Number of context interrupts", 4, 44, L"%d", NULL,
-   (VOID**)&InterruptContextCount, NULL, NULL},
-  {L"Reference to Context Interrupt Array", 4, 48, L"0x%x", NULL,
-   (VOID**)&InterruptContextOffset, NULL, NULL},
-  {L"Number of PMU Interrupts", 4, 52, L"%d", NULL,
-   (VOID**)&PmuInterruptCount, NULL, NULL},
-  {L"Reference to PMU Interrupt Array", 4, 56, L"0x%x", NULL,
-   (VOID**)&PmuInterruptOffset, NULL, NULL},
+STATIC CONST ACPI_PARSER  IortNodeSmmuV1V2Parser[] = {
+  PARSE_IORT_NODE_HEADER (NULL,       NULL),
+  { L"Base Address",                  8,    16,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Span",                          8,    24,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Model",                         4,    32,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Flags",                         4,    36,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reference to Global Interrupt Array",4,    40,  L"0x%x",  NULL, NULL, NULL,
+    NULL },
+  { L"Number of context interrupts",  4,    44,  L"%d",    NULL,
+    (VOID **)&InterruptContextCount,  NULL, NULL },
+  { L"Reference to Context Interrupt Array",4,    48,  L"0x%x",  NULL,
+    (VOID **)&InterruptContextOffset, NULL, NULL },
+  { L"Number of PMU Interrupts",      4,    52,  L"%d",    NULL,
+    (VOID **)&PmuInterruptCount,      NULL, NULL },
+  { L"Reference to PMU Interrupt Array",4,    56,  L"0x%x",  NULL,
+    (VOID **)&PmuInterruptOffset,     NULL, NULL },
 
 
   // Interrupt Array
   // Interrupt Array
-  {L"SMMU_NSgIrpt", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SMMU_NSgIrpt interrupt flags", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SMMU_NSgCfgIrpt", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SMMU_NSgCfgIrpt interrupt flags", 4, 72, L"0x%x", NULL, NULL, NULL, NULL}
+  { L"SMMU_NSgIrpt",                  4,    60,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"SMMU_NSgIrpt interrupt flags",  4,    64,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"SMMU_NSgCfgIrpt",               4,    68,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"SMMU_NSgCfgIrpt interrupt flags",4,    72,  L"0x%x",  NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array.
   An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array.
 **/
 **/
-STATIC CONST ACPI_PARSER InterruptArrayParser[] = {
-  {L"Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  InterruptArrayParser[] = {
+  { L"Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Flags",          4, 4, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IORT ID Mapping.
   An ACPI_PARSER array describing the IORT ID Mapping.
 **/
 **/
-STATIC CONST ACPI_PARSER IortNodeIdMappingParser[] = {
-  {L"Input base", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Number of IDs", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Output base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  IortNodeIdMappingParser[] = {
+  { L"Input base",       4, 0,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Number of IDs",    4, 4,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Output base",      4, 8,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Flags",            4, 16, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IORT SMMUv3 node.
   An ACPI_PARSER array describing the IORT SMMUv3 node.
 **/
 **/
-STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = {
+STATIC CONST ACPI_PARSER  IortNodeSmmuV3Parser[] = {
   PARSE_IORT_NODE_HEADER (NULL, NULL),
   PARSE_IORT_NODE_HEADER (NULL, NULL),
-  {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"VATOS Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Model", 4, 40, L"%d", NULL, NULL, NULL, NULL},
-  {L"Event", 4, 44, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Proximity domain", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Device ID mapping index", 4, 64, L"%d", NULL, NULL, NULL, NULL}
+  { L"Base Address",            8,    16,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Flags",                   4,    24,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",                4,    28,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"VATOS Address",           8,    32,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Model",                   4,    40,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Event",                   4,    44,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"PRI",                     4,    48,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"GERR",                    4,    52,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Sync",                    4,    56,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Proximity domain",        4,    60,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Device ID mapping index", 4,    64,  L"%d",    NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IORT ITS node.
   An ACPI_PARSER array describing the IORT ITS node.
 **/
 **/
-STATIC CONST ACPI_PARSER IortNodeItsParser[] = {
+STATIC CONST ACPI_PARSER  IortNodeItsParser[] = {
   PARSE_IORT_NODE_HEADER (
   PARSE_IORT_NODE_HEADER (
     ValidateItsIdMappingCount,
     ValidateItsIdMappingCount,
     ValidateItsIdArrayReference
     ValidateItsIdArrayReference
     ),
     ),
-  {L"Number of ITSs", 4, 16, L"%d", NULL, (VOID**)&ItsCount, NULL}
+  { L"Number of ITSs",        4,16, L"%d", NULL, (VOID **)&ItsCount, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the ITS ID.
   An ACPI_PARSER array describing the ITS ID.
 **/
 **/
-STATIC CONST ACPI_PARSER ItsIdParser[] = {
+STATIC CONST ACPI_PARSER  ItsIdParser[] = {
   { L"GIC ITS Identifier", 4, 0, L"%d", NULL, NULL, NULL }
   { L"GIC ITS Identifier", 4, 0, L"%d", NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IORT Names Component node.
   An ACPI_PARSER array describing the IORT Names Component node.
 **/
 **/
-STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = {
+STATIC CONST ACPI_PARSER  IortNodeNamedComponentParser[] = {
   PARSE_IORT_NODE_HEADER (NULL, NULL),
   PARSE_IORT_NODE_HEADER (NULL, NULL),
-  {L"Node Flags", 4, 16, L"%d", NULL, NULL, NULL, NULL},
-  {L"Memory access properties", 8, 20, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Device memory address size limit", 1, 28, L"%d", NULL, NULL, NULL, NULL}
+  { L"Node Flags",              4,    16,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Memory access properties",8,    20,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Device memory address size limit",1,    28,  L"%d",    NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IORT Root Complex node.
   An ACPI_PARSER array describing the IORT Root Complex node.
 **/
 **/
-STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = {
+STATIC CONST ACPI_PARSER  IortNodeRootComplexParser[] = {
   PARSE_IORT_NODE_HEADER (NULL, NULL),
   PARSE_IORT_NODE_HEADER (NULL, NULL),
-  {L"Memory access properties", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Memory access size limit", 1, 32, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
+  { L"Memory access properties",8,    16,  L"0x%lx",    NULL,       NULL, NULL, NULL },
+  { L"ATS Attribute",           4,    24,  L"0x%x",     NULL,       NULL, NULL, NULL },
+  { L"PCI Segment number",      4,    28,  L"0x%x",     NULL,       NULL, NULL, NULL },
+  { L"Memory access size limit",1,    32,  L"0x%x",     NULL,       NULL, NULL, NULL },
+  { L"Reserved",                3,    33,  L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IORT PMCG node.
   An ACPI_PARSER array describing the IORT PMCG node.
 **/
 **/
-STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
+STATIC CONST ACPI_PARSER  IortNodePmcgParser[] = {
   PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL),
   PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL),
-  {L"Page 0 Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
+  { L"Page 0 Base Address",                           8,    16,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Overflow interrupt GSIV",                       4,    24,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Node reference",                                4,    28,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Page 1 Base Address",                           8,    32,  L"0x%lx", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -260,20 +260,21 @@ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
 STATIC
 STATIC
 VOID
 VOID
 DumpIortNodeIdMappings (
 DumpIortNodeIdMappings (
-  IN UINT8* Ptr,
-  IN UINT32 Length,
-  IN UINT32 MappingCount
+  IN UINT8   *Ptr,
+  IN UINT32  Length,
+  IN UINT32  MappingCount
   )
   )
 {
 {
-  UINT32 Index;
-  UINT32 Offset;
-  CHAR8  Buffer[40];  // Used for AsciiName param of ParseAcpi
+  UINT32  Index;
+  UINT32  Offset;
+  CHAR8   Buffer[40]; // Used for AsciiName param of ParseAcpi
 
 
-  Index = 0;
+  Index  = 0;
   Offset = 0;
   Offset = 0;
 
 
   while ((Index < MappingCount) &&
   while ((Index < MappingCount) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     AsciiSPrint (
     AsciiSPrint (
       Buffer,
       Buffer,
       sizeof (Buffer),
       sizeof (Buffer),
@@ -304,15 +305,15 @@ DumpIortNodeIdMappings (
 STATIC
 STATIC
 VOID
 VOID
 DumpIortNodeSmmuV1V2 (
 DumpIortNodeSmmuV1V2 (
-  IN UINT8* Ptr,
-  IN UINT16 Length,
-  IN UINT32 MappingCount,
-  IN UINT32 MappingOffset
+  IN UINT8   *Ptr,
+  IN UINT16  Length,
+  IN UINT32  MappingCount,
+  IN UINT32  MappingOffset
   )
   )
 {
 {
-  UINT32 Index;
-  UINT32 Offset;
-  CHAR8  Buffer[50];  // Used for AsciiName param of ParseAcpi
+  UINT32  Index;
+  UINT32  Offset;
+  CHAR8   Buffer[50]; // Used for AsciiName param of ParseAcpi
 
 
   ParseAcpi (
   ParseAcpi (
     TRUE,
     TRUE,
@@ -328,7 +329,8 @@ DumpIortNodeSmmuV1V2 (
   if ((InterruptContextCount == NULL)   ||
   if ((InterruptContextCount == NULL)   ||
       (InterruptContextOffset == NULL)  ||
       (InterruptContextOffset == NULL)  ||
       (PmuInterruptCount == NULL)       ||
       (PmuInterruptCount == NULL)       ||
-      (PmuInterruptOffset == NULL)) {
+      (PmuInterruptOffset == NULL))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient SMMUv1/2 node length. Length = %d\n",
       L"ERROR: Insufficient SMMUv1/2 node length. Length = %d\n",
@@ -338,10 +340,11 @@ DumpIortNodeSmmuV1V2 (
   }
   }
 
 
   Offset = *InterruptContextOffset;
   Offset = *InterruptContextOffset;
-  Index = 0;
+  Index  = 0;
 
 
   while ((Index < *InterruptContextCount) &&
   while ((Index < *InterruptContextCount) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     AsciiSPrint (
     AsciiSPrint (
       Buffer,
       Buffer,
       sizeof (Buffer),
       sizeof (Buffer),
@@ -360,10 +363,11 @@ DumpIortNodeSmmuV1V2 (
   }
   }
 
 
   Offset = *PmuInterruptOffset;
   Offset = *PmuInterruptOffset;
-  Index = 0;
+  Index  = 0;
 
 
   while ((Index < *PmuInterruptCount) &&
   while ((Index < *PmuInterruptCount) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     AsciiSPrint (
     AsciiSPrint (
       Buffer,
       Buffer,
       sizeof (Buffer),
       sizeof (Buffer),
@@ -400,10 +404,10 @@ DumpIortNodeSmmuV1V2 (
 STATIC
 STATIC
 VOID
 VOID
 DumpIortNodeSmmuV3 (
 DumpIortNodeSmmuV3 (
-  IN UINT8* Ptr,
-  IN UINT16 Length,
-  IN UINT32 MappingCount,
-  IN UINT32 MappingOffset
+  IN UINT8   *Ptr,
+  IN UINT16  Length,
+  IN UINT32  MappingCount,
+  IN UINT32  MappingOffset
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -431,22 +435,22 @@ DumpIortNodeSmmuV3 (
 STATIC
 STATIC
 VOID
 VOID
 DumpIortNodeIts (
 DumpIortNodeIts (
-  IN UINT8* Ptr,
-  IN UINT16 Length
+  IN UINT8   *Ptr,
+  IN UINT16  Length
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT32 Index;
-  CHAR8  Buffer[80];  // Used for AsciiName param of ParseAcpi
+  UINT32  Offset;
+  UINT32  Index;
+  CHAR8   Buffer[80]; // Used for AsciiName param of ParseAcpi
 
 
   Offset = ParseAcpi (
   Offset = ParseAcpi (
-            TRUE,
-            2,
-            "ITS Node",
-            Ptr,
-            Length,
-            PARSER_PARAMS (IortNodeItsParser)
-            );
+             TRUE,
+             2,
+             "ITS Node",
+             Ptr,
+             Length,
+             PARSER_PARAMS (IortNodeItsParser)
+             );
 
 
   // Check if the values used to control the parsing logic have been
   // Check if the values used to control the parsing logic have been
   // successfully read.
   // successfully read.
@@ -462,7 +466,8 @@ DumpIortNodeIts (
   Index = 0;
   Index = 0;
 
 
   while ((Index < *ItsCount) &&
   while ((Index < *ItsCount) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     AsciiSPrint (
     AsciiSPrint (
       Buffer,
       Buffer,
       sizeof (Buffer),
       sizeof (Buffer),
@@ -481,7 +486,6 @@ DumpIortNodeIts (
   }
   }
 
 
   // Note: ITS does not have the ID Mappings Array
   // Note: ITS does not have the ID Mappings Array
-
 }
 }
 
 
 /**
 /**
@@ -496,13 +500,13 @@ DumpIortNodeIts (
 STATIC
 STATIC
 VOID
 VOID
 DumpIortNodeNamedComponent (
 DumpIortNodeNamedComponent (
-  IN UINT8* Ptr,
-  IN UINT16 Length,
-  IN UINT32 MappingCount,
-  IN UINT32 MappingOffset
+  IN UINT8   *Ptr,
+  IN UINT16  Length,
+  IN UINT32  MappingCount,
+  IN UINT32  MappingOffset
   )
   )
 {
 {
-  UINT32 Offset;
+  UINT32  Offset;
 
 
   Offset = ParseAcpi (
   Offset = ParseAcpi (
              TRUE,
              TRUE,
@@ -517,10 +521,12 @@ DumpIortNodeNamedComponent (
   PrintFieldName (2, L"Device Object Name");
   PrintFieldName (2, L"Device Object Name");
 
 
   while ((*(Ptr + Offset) != 0) &&
   while ((*(Ptr + Offset) != 0) &&
-         (Offset < Length)) {
+         (Offset < Length))
+  {
     Print (L"%c", *(Ptr + Offset));
     Print (L"%c", *(Ptr + Offset));
     Offset++;
     Offset++;
   }
   }
+
   Print (L"\n");
   Print (L"\n");
 
 
   DumpIortNodeIdMappings (
   DumpIortNodeIdMappings (
@@ -542,10 +548,10 @@ DumpIortNodeNamedComponent (
 STATIC
 STATIC
 VOID
 VOID
 DumpIortNodeRootComplex (
 DumpIortNodeRootComplex (
-  IN UINT8* Ptr,
-  IN UINT16 Length,
-  IN UINT32 MappingCount,
-  IN UINT32 MappingOffset
+  IN UINT8   *Ptr,
+  IN UINT16  Length,
+  IN UINT32  MappingCount,
+  IN UINT32  MappingOffset
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -576,11 +582,11 @@ DumpIortNodeRootComplex (
 STATIC
 STATIC
 VOID
 VOID
 DumpIortNodePmcg (
 DumpIortNodePmcg (
-  IN UINT8* Ptr,
-  IN UINT16 Length,
-  IN UINT32 MappingCount,
-  IN UINT32 MappingOffset
-)
+  IN UINT8   *Ptr,
+  IN UINT16  Length,
+  IN UINT32  MappingCount,
+  IN UINT32  MappingOffset
+  )
 {
 {
   ParseAcpi (
   ParseAcpi (
     TRUE,
     TRUE,
@@ -620,15 +626,15 @@ DumpIortNodePmcg (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiIort (
 ParseAcpiIort (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT32 Index;
-  UINT8* NodePtr;
+  UINT32  Offset;
+  UINT32  Index;
+  UINT8   *NodePtr;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -646,7 +652,8 @@ ParseAcpiIort (
   // Check if the values used to control the parsing logic have been
   // Check if the values used to control the parsing logic have been
   // successfully read.
   // successfully read.
   if ((IortNodeCount == NULL) ||
   if ((IortNodeCount == NULL) ||
-      (IortNodeOffset == NULL)) {
+      (IortNodeOffset == NULL))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
       L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
@@ -655,14 +662,15 @@ ParseAcpiIort (
     return;
     return;
   }
   }
 
 
-  Offset = *IortNodeOffset;
+  Offset  = *IortNodeOffset;
   NodePtr = Ptr + Offset;
   NodePtr = Ptr + Offset;
-  Index = 0;
+  Index   = 0;
 
 
   // Parse the specified number of IORT nodes or the IORT table buffer length.
   // Parse the specified number of IORT nodes or the IORT table buffer length.
   // Whichever is minimum.
   // Whichever is minimum.
   while ((Index++ < *IortNodeCount) &&
   while ((Index++ < *IortNodeCount) &&
-         (Offset < AcpiTableLength)) {
+         (Offset < AcpiTableLength))
+  {
     // Parse the IORT Node Header
     // Parse the IORT Node Header
     ParseAcpi (
     ParseAcpi (
       FALSE,
       FALSE,
@@ -678,11 +686,12 @@ ParseAcpiIort (
     if ((IortNodeType == NULL)        ||
     if ((IortNodeType == NULL)        ||
         (IortNodeLength == NULL)      ||
         (IortNodeLength == NULL)      ||
         (IortIdMappingCount == NULL)  ||
         (IortIdMappingCount == NULL)  ||
-        (IortIdMappingOffset == NULL)) {
+        (IortIdMappingOffset == NULL))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Insufficient remaining table buffer length to read the " \
         L"ERROR: Insufficient remaining table buffer length to read the " \
-          L"IORT node header. Length = %d.\n",
+        L"IORT node header. Length = %d.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
       return;
       return;
@@ -690,11 +699,12 @@ ParseAcpiIort (
 
 
     // Validate IORT Node length
     // Validate IORT Node length
     if ((*IortNodeLength == 0) ||
     if ((*IortNodeLength == 0) ||
-        ((Offset + (*IortNodeLength)) > AcpiTableLength)) {
+        ((Offset + (*IortNodeLength)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid IORT Node length. " \
         L"ERROR: Invalid IORT Node length. " \
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
         *IortNodeLength,
         *IortNodeLength,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength
@@ -750,7 +760,7 @@ ParseAcpiIort (
           *IortNodeLength,
           *IortNodeLength,
           *IortIdMappingCount,
           *IortIdMappingCount,
           *IortIdMappingOffset
           *IortIdMappingOffset
-        );
+          );
         break;
         break;
 
 
       default:
       default:
@@ -759,6 +769,6 @@ ParseAcpiIort (
     } // switch
     } // switch
 
 
     NodePtr += (*IortNodeLength);
     NodePtr += (*IortNodeLength);
-    Offset += (*IortNodeLength);
+    Offset  += (*IortNodeLength);
   } // while
   } // while
 }
 }

+ 154 - 141
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c

@@ -19,9 +19,9 @@
 #include "MadtParser.h"
 #include "MadtParser.h"
 
 
 // Local Variables
 // Local Variables
-STATIC CONST UINT8* MadtInterruptControllerType;
-STATIC CONST UINT8* MadtInterruptControllerLength;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT8                   *MadtInterruptControllerType;
+STATIC CONST UINT8                   *MadtInterruptControllerLength;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   This function validates the System Vector Base in the GICD.
   This function validates the System Vector Base in the GICD.
@@ -34,15 +34,15 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateGICDSystemVectorBase (
 ValidateGICDSystemVectorBase (
-  IN UINT8* Ptr,
-  IN VOID*  Context
-)
+  IN UINT8  *Ptr,
+  IN VOID   *Context
+  )
 {
 {
-  if (*(UINT32*)Ptr != 0) {
+  if (*(UINT32 *)Ptr != 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: System Vector Base must be zero."
       L"\nERROR: System Vector Base must be zero."
-    );
+      );
   }
   }
 }
 }
 
 
@@ -57,13 +57,13 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateSpeOverflowInterrupt (
 ValidateSpeOverflowInterrupt (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  UINT16 SpeOverflowInterrupt;
+  UINT16  SpeOverflowInterrupt;
 
 
-  SpeOverflowInterrupt = *(UINT16*)Ptr;
+  SpeOverflowInterrupt = *(UINT16 *)Ptr;
 
 
   // SPE not supported by this processor
   // SPE not supported by this processor
   if (SpeOverflowInterrupt == 0) {
   if (SpeOverflowInterrupt == 0) {
@@ -73,183 +73,183 @@ ValidateSpeOverflowInterrupt (
   if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) ||
   if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) ||
       ((SpeOverflowInterrupt > ARM_PPI_ID_MAX) &&
       ((SpeOverflowInterrupt > ARM_PPI_ID_MAX) &&
        (SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) ||
        (SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) ||
-      (SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) {
+      (SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID "
       L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID "
-        L"ranges of %d-%d or %d-%d (for GICv3.1 or later).",
+      L"ranges of %d-%d or %d-%d (for GICv3.1 or later).",
       SpeOverflowInterrupt,
       SpeOverflowInterrupt,
       ARM_PPI_ID_MIN,
       ARM_PPI_ID_MIN,
       ARM_PPI_ID_MAX,
       ARM_PPI_ID_MAX,
       ARM_PPI_ID_EXTENDED_MIN,
       ARM_PPI_ID_EXTENDED_MIN,
       ARM_PPI_ID_EXTENDED_MAX
       ARM_PPI_ID_EXTENDED_MAX
-    );
+      );
   } else if (SpeOverflowInterrupt != ARM_PPI_ID_PMBIRQ) {
   } else if (SpeOverflowInterrupt != ARM_PPI_ID_PMBIRQ) {
-    IncrementWarningCount();
+    IncrementWarningCount ();
     Print (
     Print (
       L"\nWARNING: SPE Overflow Interrupt ID of %d is not compliant with SBSA "
       L"\nWARNING: SPE Overflow Interrupt ID of %d is not compliant with SBSA "
-        L"Level 3 PPI ID assignment: %d.",
+      L"Level 3 PPI ID assignment: %d.",
       SpeOverflowInterrupt,
       SpeOverflowInterrupt,
       ARM_PPI_ID_PMBIRQ
       ARM_PPI_ID_PMBIRQ
-    );
+      );
   }
   }
 }
 }
 
 
 /**
 /**
   An ACPI_PARSER array describing the GICC Interrupt Controller Structure.
   An ACPI_PARSER array describing the GICC Interrupt Controller Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER GicCParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"CPU Interface Number", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ACPI Processor UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Parking Protocol Version", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Performance Interrupt GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Parked Address", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Physical Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"GICV", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"GICH", 8, 48, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"VGIC Maintenance interrupt", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"GICR Base Address", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL,
-   NULL},
-  {L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SPE overflow Interrupt", 2, 78, L"0x%x", NULL, NULL,
-    ValidateSpeOverflowInterrupt, NULL}
+STATIC CONST ACPI_PARSER  GicCParser[] = {
+  { L"Type",                             1, 0,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Length",                           1, 1,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Reserved",                         2, 2,  L"0x%x",  NULL, NULL, NULL, NULL },
+
+  { L"CPU Interface Number",             4, 4,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"ACPI Processor UID",               4, 8,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Flags",                            4, 12, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Parking Protocol Version",         4, 16, L"0x%x",  NULL, NULL, NULL, NULL },
+
+  { L"Performance Interrupt GSIV",       4, 20, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Parked Address",                   8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Physical Base Address",            8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"GICV",                             8, 40, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"GICH",                             8, 48, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"VGIC Maintenance interrupt",       4, 56, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"GICR Base Address",                8, 60, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"MPIDR",                            8, 68, L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Processor Power Efficiency Class", 1, 76, L"0x%x",  NULL, NULL, NULL,
+    NULL },
+  { L"Reserved",                         1, 77, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"SPE overflow Interrupt",           2, 78, L"0x%x",  NULL, NULL,
+    ValidateSpeOverflowInterrupt, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the GICD Interrupt Controller Structure.
   An ACPI_PARSER array describing the GICD Interrupt Controller Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER GicDParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"GIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"System Vector Base", 4, 16, L"0x%x", NULL, NULL,
-    ValidateGICDSystemVectorBase, NULL},
-  {L"GIC Version", 1, 20, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  GicDParser[] = {
+  { L"Type",                  1, 0,  L"0x%x",     NULL,       NULL, NULL, NULL },
+  { L"Length",                1, 1,  L"%d",       NULL,       NULL, NULL, NULL },
+  { L"Reserved",              2, 2,  L"0x%x",     NULL,       NULL, NULL, NULL },
+
+  { L"GIC ID",                4, 4,  L"0x%x",     NULL,       NULL, NULL, NULL },
+  { L"Physical Base Address", 8, 8,  L"0x%lx",    NULL,       NULL, NULL, NULL },
+  { L"System Vector Base",    4, 16, L"0x%x",     NULL,       NULL,
+    ValidateGICDSystemVectorBase, NULL },
+  { L"GIC Version",           1, 20, L"%d",       NULL,       NULL, NULL, NULL },
+  { L"Reserved",              3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the MSI Frame Interrupt Controller Structure.
   An ACPI_PARSER array describing the MSI Frame Interrupt Controller Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER GicMSIFrameParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
+STATIC CONST ACPI_PARSER  GicMSIFrameParser[] = {
+  { L"Type",                  1, 0,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Length",                1, 1,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Reserved",              2, 2,  L"0x%x",  NULL, NULL, NULL, NULL },
 
 
-  {L"MSI Frame ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
+  { L"MSI Frame ID",          4, 4,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Physical Base Address", 8, 8,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Flags",                 4, 16, L"0x%x",  NULL, NULL, NULL, NULL },
 
 
-  {L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL},
-  {L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL}
+  { L"SPI Count",             2, 20, L"%d",    NULL, NULL, NULL, NULL },
+  { L"SPI Base",              2, 22, L"0x%x",  NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the GICR Interrupt Controller Structure.
   An ACPI_PARSER array describing the GICR Interrupt Controller Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER GicRParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Discovery Range Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL,
-   NULL},
-  {L"Discovery Range Length", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  GicRParser[] = {
+  { L"Type",                         1, 0,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Length",                       1, 1,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Reserved",                     2, 2,  L"0x%x",  NULL, NULL, NULL, NULL },
+
+  { L"Discovery Range Base Address", 8, 4,  L"0x%lx", NULL, NULL, NULL,
+    NULL },
+  { L"Discovery Range Length",       4, 12, L"0x%x",  NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the GIC ITS Interrupt Controller Structure.
   An ACPI_PARSER array describing the GIC ITS Interrupt Controller Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER GicITSParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"GIC ITS ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  GicITSParser[] = {
+  { L"Type",                  1, 0,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Length",                1, 1,  L"%d",    NULL, NULL, NULL, NULL },
+  { L"Reserved",              2, 2,  L"0x%x",  NULL, NULL, NULL, NULL },
+
+  { L"GIC ITS ID",            4, 4,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Physical Base Address", 8, 8,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"Reserved",              4, 16, L"0x%x",  NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the IO APIC Structure.
   An ACPI_PARSER array describing the IO APIC Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER IoApic[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"I/O APIC ID", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"I/O APIC Address", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Global System Interrupt Base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  IoApic[] = {
+  { L"Type",                         1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Length",                       1, 1, L"%d",   NULL, NULL, NULL, NULL },
+  { L"I/O APIC ID",                  1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Reserved",                     1, 3, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"I/O APIC Address",             4, 4, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Global System Interrupt Base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Interrupt Source Override Structure.
   An ACPI_PARSER array describing the Interrupt Source Override Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER InterruptSourceOverride[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Bus", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Source", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Global System Interrupt", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  InterruptSourceOverride[] = {
+  { L"Type",                    1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Length",                  1, 1, L"%d",   NULL, NULL, NULL, NULL },
+  { L"Bus",                     1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Source",                  1, 3, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Global System Interrupt", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Flags",                   2, 8, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
-
 /**
 /**
   An ACPI_PARSER array describing the Processor Local x2APIC Structure.
   An ACPI_PARSER array describing the Processor Local x2APIC Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER ProcessorLocalX2Apic[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"X2APIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  ProcessorLocalX2Apic[] = {
+  { L"Type",               1, 0,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Length",             1, 1,  L"%d",   NULL, NULL, NULL, NULL },
+  { L"Reserved",           2, 2,  L"0x%x", NULL, NULL, NULL, NULL },
+
+  { L"X2APIC ID",          4, 4,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Flags",              4, 8,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Local x2APIC NMI Structure.
   An ACPI_PARSER array describing the Local x2APIC NMI Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER LocalX2ApicNmi[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Flags", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"ACPI Processor UID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Local x2APIC LINT#", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 3, 9, L"0x%x%x%x", Dump3Chars, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  LocalX2ApicNmi[] = {
+  { L"Type",               1, 0, L"0x%x",     NULL,       NULL, NULL, NULL },
+  { L"Length",             1, 1, L"%d",       NULL,       NULL, NULL, NULL },
+  { L"Flags",              2, 2, L"0x%x",     NULL,       NULL, NULL, NULL },
+
+  { L"ACPI Processor UID", 4, 4, L"0x%x",     NULL,       NULL, NULL, NULL },
+  { L"Local x2APIC LINT#", 1, 8, L"0x%x",     NULL,       NULL, NULL, NULL },
+  { L"Reserved",           3, 9, L"0x%x%x%x", Dump3Chars, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the ACPI MADT Table.
   An ACPI_PARSER array describing the ACPI MADT Table.
 **/
 **/
-STATIC CONST ACPI_PARSER MadtParser[] = {
+STATIC CONST ACPI_PARSER  MadtParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Local Interrupt Controller Address", 4, 36, L"0x%x", NULL, NULL, NULL,
-   NULL},
-  {L"Flags", 4, 40, L"0x%x", NULL, NULL, NULL, NULL}
+  { L"Local Interrupt Controller Address",4,         36, L"0x%x", NULL, NULL, NULL,
+    NULL },
+  { L"Flags",                      4,         40, L"0x%x", NULL, NULL, NULL,NULL}
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the MADT Interrupt Controller Structure Header Structure.
   An ACPI_PARSER array describing the MADT Interrupt Controller Structure Header Structure.
 **/
 **/
-STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = {
-  {NULL, 1, 0, NULL, NULL, (VOID**)&MadtInterruptControllerType, NULL, NULL},
-  {L"Length", 1, 1, NULL, NULL, (VOID**)&MadtInterruptControllerLength, NULL,
-   NULL},
-  {L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  MadtInterruptControllerHeaderParser[] = {
+  { NULL,        1, 0, NULL, NULL, (VOID **)&MadtInterruptControllerType,   NULL, NULL },
+  { L"Length",   1, 1, NULL, NULL, (VOID **)&MadtInterruptControllerLength, NULL,
+    NULL },
+  { L"Reserved", 2, 2, NULL, NULL, NULL,                                    NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -275,15 +275,15 @@ STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiMadt (
 ParseAcpiMadt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT8* InterruptContollerPtr;
-  UINT32 GICDCount;
+  UINT32  Offset;
+  UINT8   *InterruptContollerPtr;
+  UINT32  GICDCount;
 
 
   GICDCount = 0;
   GICDCount = 0;
 
 
@@ -315,11 +315,12 @@ ParseAcpiMadt (
     // Check if the values used to control the parsing logic have been
     // Check if the values used to control the parsing logic have been
     // successfully read.
     // successfully read.
     if ((MadtInterruptControllerType == NULL) ||
     if ((MadtInterruptControllerType == NULL) ||
-        (MadtInterruptControllerLength == NULL)) {
+        (MadtInterruptControllerLength == NULL))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Insufficient remaining table buffer length to read the " \
         L"ERROR: Insufficient remaining table buffer length to read the " \
-          L"Interrupt Controller Structure header. Length = %d.\n",
+        L"Interrupt Controller Structure header. Length = %d.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
       return;
       return;
@@ -327,11 +328,12 @@ ParseAcpiMadt (
 
 
     // Validate Interrupt Controller Structure length
     // Validate Interrupt Controller Structure length
     if ((*MadtInterruptControllerLength == 0) ||
     if ((*MadtInterruptControllerLength == 0) ||
-        ((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength)) {
+        ((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid Interrupt Controller Structure length. " \
         L"ERROR: Invalid Interrupt Controller Structure length. " \
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
         *MadtInterruptControllerLength,
         *MadtInterruptControllerLength,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength
@@ -340,7 +342,8 @@ ParseAcpiMadt (
     }
     }
 
 
     switch (*MadtInterruptControllerType) {
     switch (*MadtInterruptControllerType) {
-      case EFI_ACPI_6_3_GIC: {
+      case EFI_ACPI_6_3_GIC:
+      {
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -352,15 +355,17 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      case EFI_ACPI_6_3_GICD: {
+      case EFI_ACPI_6_3_GICD:
+      {
         if (++GICDCount > 1) {
         if (++GICDCount > 1) {
           IncrementErrorCount ();
           IncrementErrorCount ();
           Print (
           Print (
             L"ERROR: Only one GICD must be present,"
             L"ERROR: Only one GICD must be present,"
-              L" GICDCount = %d\n",
+            L" GICDCount = %d\n",
             GICDCount
             GICDCount
             );
             );
         }
         }
+
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -372,7 +377,8 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      case EFI_ACPI_6_3_GIC_MSI_FRAME: {
+      case EFI_ACPI_6_3_GIC_MSI_FRAME:
+      {
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -384,7 +390,8 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      case EFI_ACPI_6_3_GICR: {
+      case EFI_ACPI_6_3_GICR:
+      {
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -396,7 +403,8 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      case EFI_ACPI_6_3_GIC_ITS: {
+      case EFI_ACPI_6_3_GIC_ITS:
+      {
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -408,7 +416,8 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      case EFI_ACPI_6_3_IO_APIC: {
+      case EFI_ACPI_6_3_IO_APIC:
+      {
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -420,7 +429,8 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE: {
+      case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE:
+      {
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -432,7 +442,8 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC: {
+      case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
+      {
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -444,7 +455,8 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      case EFI_ACPI_6_3_LOCAL_X2APIC_NMI: {
+      case EFI_ACPI_6_3_LOCAL_X2APIC_NMI:
+      {
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -456,11 +468,12 @@ ParseAcpiMadt (
         break;
         break;
       }
       }
 
 
-      default: {
+      default:
+      {
         IncrementErrorCount ();
         IncrementErrorCount ();
         Print (
         Print (
           L"ERROR: Unknown Interrupt Controller Structure,"
           L"ERROR: Unknown Interrupt Controller Structure,"
-            L" Type = %d, Length = %d\n",
+          L" Type = %d, Length = %d\n",
           *MadtInterruptControllerType,
           *MadtInterruptControllerType,
           *MadtInterruptControllerLength
           *MadtInterruptControllerLength
           );
           );
@@ -468,6 +481,6 @@ ParseAcpiMadt (
     } // switch
     } // switch
 
 
     InterruptContollerPtr += *MadtInterruptControllerLength;
     InterruptContollerPtr += *MadtInterruptControllerLength;
-    Offset += *MadtInterruptControllerLength;
+    Offset                += *MadtInterruptControllerLength;
   } // while
   } // while
 }
 }

+ 16 - 16
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h

@@ -16,25 +16,25 @@
 ///
 ///
 /// Level 3 base server system Private Peripheral Inerrupt (PPI) ID assignments
 /// Level 3 base server system Private Peripheral Inerrupt (PPI) ID assignments
 ///
 ///
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP       30
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS      29
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV      28
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV       27
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP      26
-#define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT          25
-#define ARM_PPI_ID_CTIIRQ                             24
-#define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT     23
-#define ARM_PPI_ID_COMMIRQ                            22
-#define ARM_PPI_ID_PMBIRQ                             21
-#define ARM_PPI_ID_CNTHPS                             20
-#define ARM_PPI_ID_CNTHVS                             19
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP    30
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS   29
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV   28
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV    27
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP   26
+#define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT       25
+#define ARM_PPI_ID_CTIIRQ                          24
+#define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT  23
+#define ARM_PPI_ID_COMMIRQ                         22
+#define ARM_PPI_ID_PMBIRQ                          21
+#define ARM_PPI_ID_CNTHPS                          20
+#define ARM_PPI_ID_CNTHVS                          19
 
 
 ///
 ///
 /// PPI ID allowed ranges
 /// PPI ID allowed ranges
 ///
 ///
-#define ARM_PPI_ID_MAX              31
-#define ARM_PPI_ID_MIN              16
-#define ARM_PPI_ID_EXTENDED_MAX     1119
-#define ARM_PPI_ID_EXTENDED_MIN     1056
+#define ARM_PPI_ID_MAX           31
+#define ARM_PPI_ID_MIN           16
+#define ARM_PPI_ID_EXTENDED_MAX  1119
+#define ARM_PPI_ID_EXTENDED_MIN  1056
 
 
 #endif // MADT_PARSER_H_
 #endif // MADT_PARSER_H_

+ 17 - 17
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c

@@ -14,25 +14,25 @@
 #include "AcpiTableParser.h"
 #include "AcpiTableParser.h"
 
 
 // Local variables
 // Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   An ACPI_PARSER array describing the ACPI MCFG Table.
   An ACPI_PARSER array describing the ACPI MCFG Table.
 **/
 **/
-STATIC CONST ACPI_PARSER McfgParser[] = {
+STATIC CONST ACPI_PARSER  McfgParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Reserved", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
+  { L"Reserved",                   8,36, L"0x%lx", NULL, NULL, NULL, NULL },
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the PCI configuration Space Base Address structure.
   An ACPI_PARSER array describing the PCI configuration Space Base Address structure.
 **/
 **/
-STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = {
-  {L"Base Address", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"PCI Segment Group No.", 2, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Start Bus No.", 1, 10, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"End Bus No.", 1, 11, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  PciCfgSpaceBaseAddrParser[] = {
+  { L"Base Address",          8, 0,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"PCI Segment Group No.", 2, 8,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Start Bus No.",         1, 10, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"End Bus No.",           1, 11, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",              4, 12, L"0x%x",  NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -50,15 +50,15 @@ STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiMcfg (
 ParseAcpiMcfg (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT32 PciCfgOffset;
-  UINT8* PciCfgSpacePtr;
+  UINT32  Offset;
+  UINT32  PciCfgOffset;
+  UINT8   *PciCfgSpacePtr;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -85,6 +85,6 @@ ParseAcpiMcfg (
                      PARSER_PARAMS (PciCfgSpaceBaseAddrParser)
                      PARSER_PARAMS (PciCfgSpaceBaseAddrParser)
                      );
                      );
     PciCfgSpacePtr += PciCfgOffset;
     PciCfgSpacePtr += PciCfgOffset;
-    Offset += PciCfgOffset;
+    Offset         += PciCfgOffset;
   }
   }
 }
 }

+ 158 - 152
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c

@@ -17,12 +17,12 @@
 #include "PcctParser.h"
 #include "PcctParser.h"
 
 
 // Local variables
 // Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
-STATIC UINT32* PccGlobalFlags;
-STATIC UINT8*  PccSubspaceLength;
-STATIC UINT8*  PccSubspaceType;
-STATIC UINT8*  ExtendedPccSubspaceInterruptFlags;
+STATIC UINT32  *PccGlobalFlags;
+STATIC UINT8   *PccSubspaceLength;
+STATIC UINT8   *PccSubspaceType;
+STATIC UINT8   *ExtendedPccSubspaceInterruptFlags;
 
 
 /**
 /**
   This function validates the length coded on 4 bytes of a shared memory range
   This function validates the length coded on 4 bytes of a shared memory range
@@ -35,16 +35,16 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateRangeLength4 (
 ValidateRangeLength4 (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  if (*(UINT32*)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) {
+  if (*(UINT32 *)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nError: Shared memory range length is too short.\n"
       L"\nError: Shared memory range length is too short.\n"
       L"Length is %u when it should be greater than or equal to %u",
       L"Length is %u when it should be greater than or equal to %u",
-      *(UINT32*)Ptr,
+      *(UINT32 *)Ptr,
       MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN
       MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN
       );
       );
   }
   }
@@ -61,16 +61,16 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateRangeLength8 (
 ValidateRangeLength8 (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  if (*(UINT64*)Ptr <= MIN_MEMORY_RANGE_LENGTH) {
+  if (*(UINT64 *)Ptr <= MIN_MEMORY_RANGE_LENGTH) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nError: Shared memory range length is too short.\n"
       L"\nError: Shared memory range length is too short.\n"
       L"Length is %u when it should be greater than %u",
       L"Length is %u when it should be greater than %u",
-      *(UINT64*)Ptr,
+      *(UINT64 *)Ptr,
       MIN_MEMORY_RANGE_LENGTH
       MIN_MEMORY_RANGE_LENGTH
       );
       );
   }
   }
@@ -87,14 +87,14 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidatePccMemoryIoGas (
 ValidatePccMemoryIoGas (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  switch (*(UINT8*)Ptr) {
-#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
+  switch (*(UINT8 *)Ptr) {
+ #if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
     case EFI_ACPI_6_4_SYSTEM_IO:
     case EFI_ACPI_6_4_SYSTEM_IO:
-#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
+ #endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
     case EFI_ACPI_6_4_SYSTEM_MEMORY:
     case EFI_ACPI_6_4_SYSTEM_MEMORY:
       return;
       return;
     default:
     default:
@@ -114,14 +114,14 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidatePccGas (
 ValidatePccGas (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  switch (*(UINT8*)Ptr) {
-#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
+  switch (*(UINT8 *)Ptr) {
+ #if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
     case EFI_ACPI_6_4_SYSTEM_IO:
     case EFI_ACPI_6_4_SYSTEM_IO:
-#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
+ #endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
     case EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE:
     case EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE:
     case EFI_ACPI_6_4_SYSTEM_MEMORY:
     case EFI_ACPI_6_4_SYSTEM_MEMORY:
       return;
       return;
@@ -142,8 +142,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidatePccDoorbellGas (
 ValidatePccDoorbellGas (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   // For slave subspaces this field is optional, if not present the field
   // For slave subspaces this field is optional, if not present the field
@@ -152,7 +152,8 @@ ValidatePccDoorbellGas (
     if (IsZeroBuffer (
     if (IsZeroBuffer (
           Ptr,
           Ptr,
           sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
           sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
-          )) {
+          ))
+    {
       return;
       return;
     }
     }
   }
   }
@@ -172,8 +173,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidatePccIntAckGas (
 ValidatePccIntAckGas (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   // If the subspace does not support interrupts or the interrupt is
   // If the subspace does not support interrupts or the interrupt is
@@ -183,12 +184,14 @@ ValidatePccIntAckGas (
   if (((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
   if (((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
        EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) ||
        EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) ||
       ((*ExtendedPccSubspaceInterruptFlags &
       ((*ExtendedPccSubspaceInterruptFlags &
-       EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) ==
-       EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) {
+        EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) ==
+       EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE))
+  {
     if (IsZeroBuffer (
     if (IsZeroBuffer (
           Ptr,
           Ptr,
           sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
           sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
-          )) {
+          ))
+    {
       return;
       return;
     }
     }
   }
   }
@@ -207,8 +210,8 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidatePccErrStatusGas (
 ValidatePccErrStatusGas (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   // This field is ignored by the OSPM on slave channels.
   // This field is ignored by the OSPM on slave channels.
@@ -230,19 +233,20 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidatePlatInterrupt (
 ValidatePlatInterrupt (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   // If a slave subspace is present in the PCCT, then the global Platform
   // If a slave subspace is present in the PCCT, then the global Platform
   // Interrupt flag must be set to 1.
   // Interrupt flag must be set to 1.
   if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
   if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
       ((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
       ((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
-        EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT)) {
+       EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nError: Global Platform interrupt flag must be set to 1" \
       L"\nError: Global Platform interrupt flag must be set to 1" \
-        L" if a PCC type 4 structure is present in PCCT."
+      L" if a PCC type 4 structure is present in PCCT."
       );
       );
   }
   }
 }
 }
@@ -250,17 +254,17 @@ ValidatePlatInterrupt (
 /**
 /**
   An ACPI_PARSER array describing the ACPI PCCT Table.
   An ACPI_PARSER array describing the ACPI PCCT Table.
 */
 */
-STATIC CONST ACPI_PARSER PcctParser[] = {
+STATIC CONST ACPI_PARSER  PcctParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Flags", 4, 36, NULL, NULL, (VOID**)&PccGlobalFlags, NULL, NULL},
-  {L"Reserved", 8, 40, NULL, NULL, NULL, NULL, NULL}
+  { L"Flags",                      4,  36, NULL, NULL, (VOID **)&PccGlobalFlags, NULL, NULL },
+  { L"Reserved",                   8,  40, NULL, NULL, NULL,                     NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the platform communications channel subspace
   An ACPI_PARSER array describing the platform communications channel subspace
   structure header.
   structure header.
 */
 */
-STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {
+STATIC CONST ACPI_PARSER  PccSubspaceHeaderParser[] = {
   PCC_SUBSPACE_HEADER ()
   PCC_SUBSPACE_HEADER ()
   // ... Type Specific Fields ...
   // ... Type Specific Fields ...
 };
 };
@@ -268,126 +272,126 @@ STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {
 /**
 /**
   An ACPI_PARSER array describing the Generic Communications Subspace - Type 0
   An ACPI_PARSER array describing the Generic Communications Subspace - Type 0
 */
 */
-STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {
+STATIC CONST ACPI_PARSER  PccSubspaceType0Parser[] = {
   PCC_SUBSPACE_HEADER (),
   PCC_SUBSPACE_HEADER (),
-  {L"Reserved", 6, 2, L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL, NULL},
-  {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
-    NULL},
-  {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccMemoryIoGas,
-    NULL},
-  {L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
-  {L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
-  {L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL}
+  { L"Reserved",         6,   2,  L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL,                   NULL },
+  { L"Base Address",     8,   8,  L"0x%lx",             NULL,       NULL, NULL,                   NULL },
+  { L"Memory Range Length",8,   16, L"0x%lx",             NULL,       NULL, ValidateRangeLength8,
+    NULL },
+  { L"Doorbell Register",12,  24, NULL,                 DumpGas,    NULL, ValidatePccMemoryIoGas,
+    NULL },
+  { L"Doorbell Preserve",8,   36, L"0x%lx",             NULL,       NULL, NULL,                   NULL },
+  { L"Doorbell Write",   8,   44, L"0x%lx",             NULL,       NULL, NULL,                   NULL },
+  { L"Nominal Latency",  4,   52, L"%u",                NULL,       NULL, NULL,                   NULL },
+  { L"Maximum Periodic Access Rate",4,   56, L"%u",                NULL,       NULL, NULL,                   NULL },
+  { L"Minimum Request Turnaround Time",2,   60, L"%u",                NULL,       NULL, NULL,                   NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the HW-Reduced Communications Subspace
   An ACPI_PARSER array describing the HW-Reduced Communications Subspace
   - Type 1
   - Type 1
 */
 */
-STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] = {
+STATIC CONST ACPI_PARSER  PccSubspaceType1Parser[] = {
   PCC_SUBSPACE_HEADER (),
   PCC_SUBSPACE_HEADER (),
-  {L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
-    NULL},
-  {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL,
-    ValidatePccGas, NULL},
-  {L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
-  {L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
-  {L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL}
+  { L"Platform Interrupt",4,   2,  L"0x%x",  NULL,    NULL, NULL,                 NULL },
+  { L"Platform Interrupt Flags",1,   6,  L"0x%x",  NULL,    NULL, NULL,                 NULL },
+  { L"Reserved",         1,   7,  L"0x%x",  NULL,    NULL, NULL,                 NULL },
+  { L"Base Address",     8,   8,  L"0x%lx", NULL,    NULL, NULL,                 NULL },
+  { L"Memory Range Length",8,   16, L"0x%lx", NULL,    NULL, ValidateRangeLength8,
+    NULL },
+  { L"Doorbell Register",12,  24, NULL,     DumpGas, NULL,
+    ValidatePccGas,      NULL },
+  { L"Doorbell Preserve",8,   36, L"0x%lx", NULL,    NULL, NULL,                 NULL },
+  { L"Doorbell Write",   8,   44, L"0x%lx", NULL,    NULL, NULL,                 NULL },
+  { L"Nominal Latency",  4,   52, L"%u",    NULL,    NULL, NULL,                 NULL },
+  { L"Maximum Periodic Access Rate",4,   56, L"%u",    NULL,    NULL, NULL,                 NULL },
+  { L"Minimum Request Turnaround Time",2,   60, L"%u",    NULL,    NULL, NULL,                 NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the HW-Reduced Communications Subspace
   An ACPI_PARSER array describing the HW-Reduced Communications Subspace
   - Type 2
   - Type 2
 */
 */
-STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] = {
+STATIC CONST ACPI_PARSER  PccSubspaceType2Parser[] = {
   PCC_SUBSPACE_HEADER (),
   PCC_SUBSPACE_HEADER (),
-  {L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
-    NULL},
-  {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL,
-    ValidatePccGas, NULL},
-  {L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
-  {L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
-  {L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL},
-  {L"Platform Interrupt Ack Register", 12, 62, NULL, DumpGas, NULL,
-    ValidatePccGas, NULL},
-  {L"Platform Interrupt Ack Preserve", 8, 74, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Platform Interrupt Ack Write", 8, 82, L"0x%lx", NULL, NULL,
-    NULL, NULL},
+  { L"Platform Interrupt",4,   2,  L"0x%x",  NULL,    NULL, NULL,                 NULL },
+  { L"Platform Interrupt Flags",1,   6,  L"0x%x",  NULL,    NULL, NULL,                 NULL },
+  { L"Reserved",         1,   7,  L"0x%x",  NULL,    NULL, NULL,                 NULL },
+  { L"Base Address",     8,   8,  L"0x%lx", NULL,    NULL, NULL,                 NULL },
+  { L"Memory Range Length",8,   16, L"0x%lx", NULL,    NULL, ValidateRangeLength8,
+    NULL },
+  { L"Doorbell Register",12,  24, NULL,     DumpGas, NULL,
+    ValidatePccGas,      NULL },
+  { L"Doorbell Preserve",8,   36, L"0x%lx", NULL,    NULL, NULL,                 NULL },
+  { L"Doorbell Write",   8,   44, L"0x%lx", NULL,    NULL, NULL,                 NULL },
+  { L"Nominal Latency",  4,   52, L"%u",    NULL,    NULL, NULL,                 NULL },
+  { L"Maximum Periodic Access Rate",4,   56, L"%u",    NULL,    NULL, NULL,                 NULL },
+  { L"Minimum Request Turnaround Time",2,   60, L"%u",    NULL,    NULL, NULL,                 NULL },
+  { L"Platform Interrupt Ack Register",12,  62, NULL,     DumpGas, NULL,
+    ValidatePccGas,      NULL },
+  { L"Platform Interrupt Ack Preserve",8,   74, L"0x%lx", NULL,    NULL, NULL,                 NULL },
+  { L"Platform Interrupt Ack Write",8,   82, L"0x%lx", NULL,    NULL,
+    NULL,                NULL },
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Extended PCC Subspaces - Type 3/4
   An ACPI_PARSER array describing the Extended PCC Subspaces - Type 3/4
 */
 */
-STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {
+STATIC CONST ACPI_PARSER  PccSubspaceType3Parser[] = {
   PCC_SUBSPACE_HEADER (),
   PCC_SUBSPACE_HEADER (),
-  {L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL,
-    ValidatePlatInterrupt, NULL},
-  {L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL,
-    (VOID**)&ExtendedPccSubspaceInterruptFlags, NULL, NULL},
-  {L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Memory Range Length", 4, 16, L"0x%x", NULL, NULL, ValidateRangeLength4,
-    NULL},
-  {L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
-    ValidatePccDoorbellGas, NULL},
-  {L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Nominal Latency", 4, 48, L"%u", NULL, NULL, NULL, NULL},
-  {L"Maximum Periodic Access Rate", 4, 52, L"%u", NULL, NULL, NULL, NULL},
-  {L"Minimum Request Turnaround Time", 4, 56, L"%u", NULL, NULL, NULL, NULL},
-  {L"Platform Interrupt Ack Register", 12, 60, NULL, DumpGas, NULL,
-    ValidatePccIntAckGas, NULL},
-  {L"Platform Interrupt Ack Preserve", 8, 72, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Platform Interrupt Ack Set", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Reserved", 8, 88, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Cmd Complete Check Reg Addr", 12, 96, NULL, DumpGas, NULL,
-    ValidatePccGas, NULL},
-  {L"Cmd Complete Check Mask", 8, 108, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Cmd Update Reg Addr", 12, 116, NULL, DumpGas, NULL,
-    ValidatePccGas, NULL},
-  {L"Cmd Update Preserve mask", 8, 128, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Cmd Update Set mask", 8, 136, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Error Status Register", 12, 144, NULL, DumpGas, NULL,
-    ValidatePccErrStatusGas, NULL},
-  {L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL, NULL, NULL},
+  { L"Platform Interrupt",                      4,     2,   L"0x%x",  NULL,    NULL,
+    ValidatePlatInterrupt,                      NULL },
+  { L"Platform Interrupt Flags",                1,     6,   L"0x%x",  NULL,
+    (VOID **)&ExtendedPccSubspaceInterruptFlags,NULL,  NULL },
+  { L"Reserved",                                1,     7,   L"0x%x",  NULL,    NULL,NULL,                  NULL },
+  { L"Base Address",                            8,     8,   L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Memory Range Length",                     4,     16,  L"0x%x",  NULL,    NULL,ValidateRangeLength4,
+    NULL },
+  { L"Doorbell Register",                       12,    20,  NULL,     DumpGas, NULL,
+    ValidatePccDoorbellGas,                     NULL },
+  { L"Doorbell Preserve",                       8,     32,  L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Doorbell Write",                          8,     40,  L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Nominal Latency",                         4,     48,  L"%u",    NULL,    NULL,NULL,                  NULL },
+  { L"Maximum Periodic Access Rate",            4,     52,  L"%u",    NULL,    NULL,NULL,                  NULL },
+  { L"Minimum Request Turnaround Time",         4,     56,  L"%u",    NULL,    NULL,NULL,                  NULL },
+  { L"Platform Interrupt Ack Register",         12,    60,  NULL,     DumpGas, NULL,
+    ValidatePccIntAckGas,                       NULL },
+  { L"Platform Interrupt Ack Preserve",         8,     72,  L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Platform Interrupt Ack Set",              8,     80,  L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Reserved",                                8,     88,  L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Cmd Complete Check Reg Addr",             12,    96,  NULL,     DumpGas, NULL,
+    ValidatePccGas,                             NULL },
+  { L"Cmd Complete Check Mask",                 8,     108, L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Cmd Update Reg Addr",                     12,    116, NULL,     DumpGas, NULL,
+    ValidatePccGas,                             NULL },
+  { L"Cmd Update Preserve mask",                8,     128, L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Cmd Update Set mask",                     8,     136, L"0x%lx", NULL,    NULL,NULL,                  NULL },
+  { L"Error Status Register",                   12,    144, NULL,     DumpGas, NULL,
+    ValidatePccErrStatusGas,                    NULL },
+  { L"Error Status Mask",                       8,     156, L"0x%lx", NULL,    NULL,NULL,                  NULL },
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the HW Registers based Communications
   An ACPI_PARSER array describing the HW Registers based Communications
   Subspace Structure - Type 5
   Subspace Structure - Type 5
 */
 */
-STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
+STATIC CONST ACPI_PARSER  PccSubspaceType5Parser[] = {
   PCC_SUBSPACE_HEADER (),
   PCC_SUBSPACE_HEADER (),
-  {L"Version", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Shared Memory Range Length", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
-    ValidatePccMemoryIoGas, NULL},
-  {L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Command Complete Check Register", 12, 48, NULL, DumpGas, NULL,
-    ValidatePccMemoryIoGas, NULL},
-  {L"Command Complete Check Mask", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Error Status Register", 12, 68, NULL, DumpGas, NULL,
-    ValidatePccMemoryIoGas, NULL},
-  {L"Error Status Mask", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"Nominal Latency", 4, 88, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Minimum Request Turnaround Time", 4, 92, L"0x%x", NULL, NULL, NULL, NULL}
+  { L"Version",            2,   2,  L"0x%x",  NULL,    NULL, NULL, NULL },
+  { L"Base Address",       8,   4,  L"0x%lx", NULL,    NULL, NULL, NULL },
+  { L"Shared Memory Range Length",8,   12, L"0x%lx", NULL,    NULL, NULL, NULL },
+  { L"Doorbell Register",  12,  20, NULL,     DumpGas, NULL,
+    ValidatePccMemoryIoGas,NULL },
+  { L"Doorbell Preserve",  8,   32, L"0x%lx", NULL,    NULL, NULL, NULL },
+  { L"Doorbell Write",     8,   40, L"0x%lx", NULL,    NULL, NULL, NULL },
+  { L"Command Complete Check Register",12,  48, NULL,     DumpGas, NULL,
+    ValidatePccMemoryIoGas,NULL },
+  { L"Command Complete Check Mask",8,   60, L"0x%lx", NULL,    NULL, NULL, NULL },
+  { L"Error Status Register",12,  68, NULL,     DumpGas, NULL,
+    ValidatePccMemoryIoGas,NULL },
+  { L"Error Status Mask",  8,   80, L"0x%lx", NULL,    NULL, NULL, NULL },
+  { L"Nominal Latency",    4,   88, L"0x%x",  NULL,    NULL, NULL, NULL },
+  { L"Minimum Request Turnaround Time",4,   92, L"0x%x",  NULL,    NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -399,7 +403,7 @@ STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
 STATIC
 STATIC
 VOID
 VOID
 DumpPccSubspaceType0 (
 DumpPccSubspaceType0 (
-  IN UINT8* Ptr,
+  IN UINT8  *Ptr,
   IN UINT8  Length
   IN UINT8  Length
   )
   )
 {
 {
@@ -422,7 +426,7 @@ DumpPccSubspaceType0 (
 STATIC
 STATIC
 VOID
 VOID
 DumpPccSubspaceType1 (
 DumpPccSubspaceType1 (
-  IN UINT8* Ptr,
+  IN UINT8  *Ptr,
   IN UINT8  Length
   IN UINT8  Length
   )
   )
 {
 {
@@ -445,7 +449,7 @@ DumpPccSubspaceType1 (
 STATIC
 STATIC
 VOID
 VOID
 DumpPccSubspaceType2 (
 DumpPccSubspaceType2 (
-  IN UINT8* Ptr,
+  IN UINT8  *Ptr,
   IN UINT8  Length
   IN UINT8  Length
   )
   )
 {
 {
@@ -468,7 +472,7 @@ DumpPccSubspaceType2 (
 STATIC
 STATIC
 VOID
 VOID
 DumpPccSubspaceType3 (
 DumpPccSubspaceType3 (
-  IN UINT8* Ptr,
+  IN UINT8  *Ptr,
   IN UINT8  Length
   IN UINT8  Length
   )
   )
 {
 {
@@ -491,7 +495,7 @@ DumpPccSubspaceType3 (
 STATIC
 STATIC
 VOID
 VOID
 DumpPccSubspaceType4 (
 DumpPccSubspaceType4 (
-  IN UINT8* Ptr,
+  IN UINT8  *Ptr,
   IN UINT8  Length
   IN UINT8  Length
   )
   )
 {
 {
@@ -514,7 +518,7 @@ DumpPccSubspaceType4 (
 STATIC
 STATIC
 VOID
 VOID
 DumpPccSubspaceType5 (
 DumpPccSubspaceType5 (
-  IN UINT8* Ptr,
+  IN UINT8  *Ptr,
   IN UINT8  Length
   IN UINT8  Length
   )
   )
 {
 {
@@ -544,15 +548,15 @@ DumpPccSubspaceType5 (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiPcct (
 ParseAcpiPcct (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT8* PccSubspacePtr;
-  UINTN  SubspaceCount;
+  UINT32  Offset;
+  UINT8   *PccSubspacePtr;
+  UINTN   SubspaceCount;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -584,11 +588,12 @@ ParseAcpiPcct (
     // Check if the values used to control the parsing logic have been
     // Check if the values used to control the parsing logic have been
     // successfully read.
     // successfully read.
     if ((PccSubspaceType == NULL) ||
     if ((PccSubspaceType == NULL) ||
-        (PccSubspaceLength == NULL)) {
+        (PccSubspaceLength == NULL))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Insufficient remaining table buffer length to read the " \
         L"ERROR: Insufficient remaining table buffer length to read the " \
-          L"structure header. Length = %u.\n",
+        L"structure header. Length = %u.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
       return;
       return;
@@ -596,11 +601,12 @@ ParseAcpiPcct (
 
 
     // Validate Structure length
     // Validate Structure length
     if ((*PccSubspaceLength == 0) ||
     if ((*PccSubspaceLength == 0) ||
-        ((Offset + (*PccSubspaceLength)) > AcpiTableLength)) {
+        ((Offset + (*PccSubspaceLength)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid Structure length. " \
         L"ERROR: Invalid Structure length. " \
-          L"Length = %u. Offset = %u. AcpiTableLength = %u.\n",
+        L"Length = %u. Offset = %u. AcpiTableLength = %u.\n",
         *PccSubspaceLength,
         *PccSubspaceLength,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength
@@ -649,14 +655,14 @@ ParseAcpiPcct (
         IncrementErrorCount ();
         IncrementErrorCount ();
         Print (
         Print (
           L"ERROR: Unknown PCC subspace structure:"
           L"ERROR: Unknown PCC subspace structure:"
-            L" Type = %u, Length = %u\n",
+          L" Type = %u, Length = %u\n",
           PccSubspaceType,
           PccSubspaceType,
           *PccSubspaceLength
           *PccSubspaceLength
           );
           );
     }
     }
 
 
     PccSubspacePtr += *PccSubspaceLength;
     PccSubspacePtr += *PccSubspaceLength;
-    Offset += *PccSubspaceLength;
+    Offset         += *PccSubspaceLength;
     SubspaceCount++;
     SubspaceCount++;
   } // while
   } // while
 
 

+ 3 - 3
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h

@@ -11,17 +11,17 @@
 /**
 /**
   Minimum value for the 'length' field in subspaces of types 0, 1 and 2.
   Minimum value for the 'length' field in subspaces of types 0, 1 and 2.
 */
 */
-#define MIN_MEMORY_RANGE_LENGTH                 8
+#define MIN_MEMORY_RANGE_LENGTH  8
 
 
 /**
 /**
   Minimum value for the 'length' field in subspaces of types 3 and 4.
   Minimum value for the 'length' field in subspaces of types 3 and 4.
 */
 */
-#define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN      16
+#define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN  16
 
 
 /**
 /**
   Maximum number of PCC subspaces.
   Maximum number of PCC subspaces.
 */
 */
-#define MAX_PCC_SUBSPACES                       256
+#define MAX_PCC_SUBSPACES  256
 
 
 /**
 /**
   Parser for the header of any type of PCC subspace.
   Parser for the header of any type of PCC subspace.

+ 98 - 91
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c

@@ -17,10 +17,10 @@
 #include "PpttParser.h"
 #include "PpttParser.h"
 
 
 // Local variables
 // Local variables
-STATIC CONST UINT8*  ProcessorTopologyStructureType;
-STATIC CONST UINT8*  ProcessorTopologyStructureLength;
-STATIC CONST UINT32* NumberOfPrivateResources;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT8                   *ProcessorTopologyStructureType;
+STATIC CONST UINT8                   *ProcessorTopologyStructureLength;
+STATIC CONST UINT32                  *NumberOfPrivateResources;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   This function validates the Cache Type Structure (Type 1) 'Number of sets'
   This function validates the Cache Type Structure (Type 1) 'Number of sets'
@@ -34,12 +34,13 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateCacheNumberOfSets (
 ValidateCacheNumberOfSets (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  UINT32 NumberOfSets;
-  NumberOfSets = *(UINT32*)Ptr;
+  UINT32  NumberOfSets;
+
+  NumberOfSets = *(UINT32 *)Ptr;
 
 
   if (NumberOfSets == 0) {
   if (NumberOfSets == 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -47,12 +48,12 @@ ValidateCacheNumberOfSets (
     return;
     return;
   }
   }
 
 
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
   if (NumberOfSets > PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX) {
   if (NumberOfSets > PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: When ARMv8.3-CCIDX is implemented the maximum cache number of "
       L"\nERROR: When ARMv8.3-CCIDX is implemented the maximum cache number of "
-        L"sets must be less than or equal to %d",
+      L"sets must be less than or equal to %d",
       PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX
       PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX
       );
       );
     return;
     return;
@@ -62,14 +63,14 @@ ValidateCacheNumberOfSets (
     IncrementWarningCount ();
     IncrementWarningCount ();
     Print (
     Print (
       L"\nWARNING: Without ARMv8.3-CCIDX, the maximum cache number of sets "
       L"\nWARNING: Without ARMv8.3-CCIDX, the maximum cache number of sets "
-        L"must be less than or equal to %d. Ignore this message if "
-        L"ARMv8.3-CCIDX is implemented",
+      L"must be less than or equal to %d. Ignore this message if "
+      L"ARMv8.3-CCIDX is implemented",
       PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX
       PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX
       );
       );
     return;
     return;
   }
   }
-#endif
 
 
+ #endif
 }
 }
 
 
 /**
 /**
@@ -84,12 +85,13 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateCacheAssociativity (
 ValidateCacheAssociativity (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  UINT8 Associativity;
-  Associativity = *(UINT8*)Ptr;
+  UINT8  Associativity;
+
+  Associativity = *(UINT8 *)Ptr;
 
 
   if (Associativity == 0) {
   if (Associativity == 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -109,25 +111,26 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateCacheLineSize (
 ValidateCacheLineSize (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
   // Reference: ARM Architecture Reference Manual ARMv8 (D.a)
   // Reference: ARM Architecture Reference Manual ARMv8 (D.a)
   // Section D12.2.25: CCSIDR_EL1, Current Cache Size ID Register
   // Section D12.2.25: CCSIDR_EL1, Current Cache Size ID Register
   //   LineSize, bits [2:0]
   //   LineSize, bits [2:0]
   //     (Log2(Number of bytes in cache line)) - 4.
   //     (Log2(Number of bytes in cache line)) - 4.
 
 
-  UINT16 LineSize;
-  LineSize = *(UINT16*)Ptr;
+  UINT16  LineSize;
+  LineSize = *(UINT16 *)Ptr;
 
 
   if ((LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) ||
   if ((LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) ||
-      (LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX)) {
+      (LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX))
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: The cache line size must be between %d and %d bytes"
       L"\nERROR: The cache line size must be between %d and %d bytes"
-        L" on ARM Platforms.",
+      L" on ARM Platforms.",
       PPTT_ARM_CACHE_LINE_SIZE_MIN,
       PPTT_ARM_CACHE_LINE_SIZE_MIN,
       PPTT_ARM_CACHE_LINE_SIZE_MAX
       PPTT_ARM_CACHE_LINE_SIZE_MAX
       );
       );
@@ -138,7 +141,8 @@ ValidateCacheLineSize (
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (L"\nERROR: The cache line size is not a power of 2.");
     Print (L"\nERROR: The cache line size is not a power of 2.");
   }
   }
-#endif
+
+ #endif
 }
 }
 
 
 /**
 /**
@@ -152,15 +156,16 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateCacheAttributes (
 ValidateCacheAttributes (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
   // Reference: Advanced Configuration and Power Interface (ACPI) Specification
   // Reference: Advanced Configuration and Power Interface (ACPI) Specification
   //            Version 6.2 Errata A, September 2017
   //            Version 6.2 Errata A, September 2017
   // Table 5-153: Cache Type Structure
   // Table 5-153: Cache Type Structure
-  UINT8 Attributes;
-  Attributes = *(UINT8*)Ptr;
+  UINT8  Attributes;
+
+  Attributes = *(UINT8 *)Ptr;
 
 
   if ((Attributes & 0xE0) != 0) {
   if ((Attributes & 0xE0) != 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -175,67 +180,67 @@ ValidateCacheAttributes (
 /**
 /**
   An ACPI_PARSER array describing the ACPI PPTT Table.
   An ACPI_PARSER array describing the ACPI PPTT Table.
 **/
 **/
-STATIC CONST ACPI_PARSER PpttParser[] = {
+STATIC CONST ACPI_PARSER  PpttParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the processor topology structure header.
   An ACPI_PARSER array describing the processor topology structure header.
 **/
 **/
-STATIC CONST ACPI_PARSER ProcessorTopologyStructureHeaderParser[] = {
-  {L"Type", 1, 0, NULL, NULL, (VOID**)&ProcessorTopologyStructureType,
-   NULL, NULL},
-  {L"Length", 1, 1, NULL, NULL, (VOID**)&ProcessorTopologyStructureLength,
-   NULL, NULL},
-  {L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  ProcessorTopologyStructureHeaderParser[] = {
+  { L"Type",     1, 0, NULL, NULL, (VOID **)&ProcessorTopologyStructureType,
+    NULL, NULL },
+  { L"Length",   1, 1, NULL, NULL, (VOID **)&ProcessorTopologyStructureLength,
+    NULL, NULL },
+  { L"Reserved", 2, 2, NULL, NULL, NULL,                                      NULL,NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Processor Hierarchy Node Structure - Type 0.
   An ACPI_PARSER array describing the Processor Hierarchy Node Structure - Type 0.
 **/
 **/
-STATIC CONST ACPI_PARSER ProcessorHierarchyNodeStructureParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Number of private resources", 4, 16, L"%d", NULL,
-   (VOID**)&NumberOfPrivateResources, NULL, NULL}
+STATIC CONST ACPI_PARSER  ProcessorHierarchyNodeStructureParser[] = {
+  { L"Type",                        1, 0,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Length",                      1, 1,  L"%d",   NULL, NULL, NULL, NULL },
+  { L"Reserved",                    2, 2,  L"0x%x", NULL, NULL, NULL, NULL },
+
+  { L"Flags",                       4, 4,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Parent",                      4, 8,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"ACPI Processor ID",           4, 12, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Number of private resources", 4, 16, L"%d",   NULL,
+    (VOID **)&NumberOfPrivateResources, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Cache Type Structure - Type 1.
   An ACPI_PARSER array describing the Cache Type Structure - Type 1.
 **/
 **/
-STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets, NULL},
-  {L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity, NULL},
-  {L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL},
-  {L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL}
+STATIC CONST ACPI_PARSER  CacheTypeStructureParser[] = {
+  { L"Type",                1, 0,  L"0x%x", NULL, NULL, NULL,                       NULL },
+  { L"Length",              1, 1,  L"%d",   NULL, NULL, NULL,                       NULL },
+  { L"Reserved",            2, 2,  L"0x%x", NULL, NULL, NULL,                       NULL },
+
+  { L"Flags",               4, 4,  L"0x%x", NULL, NULL, NULL,                       NULL },
+  { L"Next Level of Cache", 4, 8,  L"0x%x", NULL, NULL, NULL,                       NULL },
+  { L"Size",                4, 12, L"0x%x", NULL, NULL, NULL,                       NULL },
+  { L"Number of sets",      4, 16, L"%d",   NULL, NULL, ValidateCacheNumberOfSets,  NULL },
+  { L"Associativity",       1, 20, L"%d",   NULL, NULL, ValidateCacheAssociativity, NULL },
+  { L"Attributes",          1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes,    NULL },
+  { L"Line size",           2, 22, L"%d",   NULL, NULL, ValidateCacheLineSize,      NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the ID Type Structure - Type 2.
   An ACPI_PARSER array describing the ID Type Structure - Type 2.
 **/
 **/
-STATIC CONST ACPI_PARSER IdStructureParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"VENDOR_ID", 4, 4, NULL, Dump4Chars, NULL, NULL, NULL},
-  {L"LEVEL_1_ID", 8, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"LEVEL_2_ID", 8, 16, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"MAJOR_REV", 2, 24, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"MINOR_REV", 2, 26, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"SPIN_REV", 2, 28, L"0x%x", NULL, NULL, NULL, NULL},
+STATIC CONST ACPI_PARSER  IdStructureParser[] = {
+  { L"Type",       1, 0,  L"0x%x", NULL,       NULL, NULL, NULL },
+  { L"Length",     1, 1,  L"%d",   NULL,       NULL, NULL, NULL },
+  { L"Reserved",   2, 2,  L"0x%x", NULL,       NULL, NULL, NULL },
+
+  { L"VENDOR_ID",  4, 4,  NULL,    Dump4Chars, NULL, NULL, NULL },
+  { L"LEVEL_1_ID", 8, 8,  L"0x%x", NULL,       NULL, NULL, NULL },
+  { L"LEVEL_2_ID", 8, 16, L"0x%x", NULL,       NULL, NULL, NULL },
+  { L"MAJOR_REV",  2, 24, L"0x%x", NULL,       NULL, NULL, NULL },
+  { L"MINOR_REV",  2, 26, L"0x%x", NULL,       NULL, NULL, NULL },
+  { L"SPIN_REV",   2, 28, L"0x%x", NULL,       NULL, NULL, NULL },
 };
 };
 
 
 /**
 /**
@@ -248,13 +253,13 @@ STATIC CONST ACPI_PARSER IdStructureParser[] = {
 STATIC
 STATIC
 VOID
 VOID
 DumpProcessorHierarchyNodeStructure (
 DumpProcessorHierarchyNodeStructure (
-  IN UINT8* Ptr,
+  IN UINT8  *Ptr,
   IN UINT8  Length
   IN UINT8  Length
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT32 Index;
-  CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
+  UINT32  Offset;
+  UINT32  Index;
+  CHAR16  Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
 
 
   Offset = ParseAcpi (
   Offset = ParseAcpi (
              TRUE,
              TRUE,
@@ -281,8 +286,8 @@ DumpProcessorHierarchyNodeStructure (
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Invalid Number of Private Resources. " \
       L"ERROR: Invalid Number of Private Resources. " \
-        L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \
-        L"Parsing of this structure aborted.\n",
+      L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \
+      L"Parsing of this structure aborted.\n",
       *NumberOfPrivateResources,
       *NumberOfPrivateResources,
       Length - Offset
       Length - Offset
       );
       );
@@ -304,7 +309,7 @@ DumpProcessorHierarchyNodeStructure (
     PrintFieldName (4, Buffer);
     PrintFieldName (4, Buffer);
     Print (
     Print (
       L"0x%x\n",
       L"0x%x\n",
-      *((UINT32*)(Ptr + Offset))
+      *((UINT32 *)(Ptr + Offset))
       );
       );
 
 
     Offset += sizeof (UINT32);
     Offset += sizeof (UINT32);
@@ -321,7 +326,7 @@ DumpProcessorHierarchyNodeStructure (
 STATIC
 STATIC
 VOID
 VOID
 DumpCacheTypeStructure (
 DumpCacheTypeStructure (
-  IN UINT8* Ptr,
+  IN UINT8  *Ptr,
   IN UINT8  Length
   IN UINT8  Length
   )
   )
 {
 {
@@ -344,8 +349,8 @@ DumpCacheTypeStructure (
 STATIC
 STATIC
 VOID
 VOID
 DumpIDStructure (
 DumpIDStructure (
-  IN UINT8* Ptr,
-  IN UINT8 Length
+  IN UINT8  *Ptr,
+  IN UINT8  Length
   )
   )
 {
 {
   ParseAcpi (
   ParseAcpi (
@@ -378,14 +383,14 @@ DumpIDStructure (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiPptt (
 ParseAcpiPptt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT8* ProcessorTopologyStructurePtr;
+  UINT32  Offset;
+  UINT8   *ProcessorTopologyStructurePtr;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -416,11 +421,12 @@ ParseAcpiPptt (
     // Check if the values used to control the parsing logic have been
     // Check if the values used to control the parsing logic have been
     // successfully read.
     // successfully read.
     if ((ProcessorTopologyStructureType == NULL) ||
     if ((ProcessorTopologyStructureType == NULL) ||
-        (ProcessorTopologyStructureLength == NULL)) {
+        (ProcessorTopologyStructureLength == NULL))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Insufficient remaining table buffer length to read the " \
         L"ERROR: Insufficient remaining table buffer length to read the " \
-          L"processor topology structure header. Length = %d.\n",
+        L"processor topology structure header. Length = %d.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
       return;
       return;
@@ -428,11 +434,12 @@ ParseAcpiPptt (
 
 
     // Validate Processor Topology Structure length
     // Validate Processor Topology Structure length
     if ((*ProcessorTopologyStructureLength == 0) ||
     if ((*ProcessorTopologyStructureLength == 0) ||
-        ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) {
+        ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid Processor Topology Structure length. " \
         L"ERROR: Invalid Processor Topology Structure length. " \
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
         *ProcessorTopologyStructureLength,
         *ProcessorTopologyStructureLength,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength
@@ -466,13 +473,13 @@ ParseAcpiPptt (
         IncrementErrorCount ();
         IncrementErrorCount ();
         Print (
         Print (
           L"ERROR: Unknown processor topology structure:"
           L"ERROR: Unknown processor topology structure:"
-            L" Type = %d, Length = %d\n",
+          L" Type = %d, Length = %d\n",
           *ProcessorTopologyStructureType,
           *ProcessorTopologyStructureType,
           *ProcessorTopologyStructureLength
           *ProcessorTopologyStructureLength
           );
           );
     }
     }
 
 
     ProcessorTopologyStructurePtr += *ProcessorTopologyStructureLength;
     ProcessorTopologyStructurePtr += *ProcessorTopologyStructureLength;
-    Offset += *ProcessorTopologyStructureLength;
+    Offset                        += *ProcessorTopologyStructureLength;
   } // while
   } // while
 }
 }

+ 6 - 6
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h

@@ -16,22 +16,22 @@
 /// Cache parameters allowed by the architecture with
 /// Cache parameters allowed by the architecture with
 /// ARMv8.3-CCIDX (Cache extended number of sets)
 /// ARMv8.3-CCIDX (Cache extended number of sets)
 /// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0001
 /// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0001
-#define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX       (1 << 24)
-#define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX        (1 << 21)
+#define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX  (1 << 24)
+#define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX   (1 << 21)
 
 
 /// Cache parameters allowed by the architecture without
 /// Cache parameters allowed by the architecture without
 /// ARMv8.3-CCIDX (Cache extended number of sets)
 /// ARMv8.3-CCIDX (Cache extended number of sets)
 /// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0000
 /// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0000
-#define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX             (1 << 15)
-#define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX              (1 << 10)
+#define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX  (1 << 15)
+#define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX   (1 << 10)
 
 
 /// Common cache parameters
 /// Common cache parameters
 /// Derived from CCSIDR_EL1
 /// Derived from CCSIDR_EL1
 /// The LineSize is represented by bits 2:0
 /// The LineSize is represented by bits 2:0
 /// (Log2(Number of bytes in cache line)) - 4 is used to represent
 /// (Log2(Number of bytes in cache line)) - 4 is used to represent
 /// the LineSize bits.
 /// the LineSize bits.
-#define PPTT_ARM_CACHE_LINE_SIZE_MAX                  (1 << 11)
-#define PPTT_ARM_CACHE_LINE_SIZE_MIN                  (1 << 4)
+#define PPTT_ARM_CACHE_LINE_SIZE_MAX  (1 << 11)
+#define PPTT_ARM_CACHE_LINE_SIZE_MIN  (1 << 4)
 
 
 #endif // if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
 #endif // if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
 
 

+ 32 - 30
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c

@@ -13,7 +13,7 @@
 #include "AcpiTableParser.h"
 #include "AcpiTableParser.h"
 
 
 // Local Variables
 // Local Variables
-STATIC CONST UINT64* XsdtAddress;
+STATIC CONST UINT64  *XsdtAddress;
 
 
 /**
 /**
   This function validates the RSDT Address.
   This function validates the RSDT Address.
@@ -26,19 +26,19 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateRsdtAddress (
 ValidateRsdtAddress (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
   // Reference: Server Base Boot Requirements System Software on ARM Platforms
   // Reference: Server Base Boot Requirements System Software on ARM Platforms
   // Section: 4.2.1.1 RSDP
   // Section: 4.2.1.1 RSDP
   // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
   // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
   //   - Within the RSDP, the RsdtAddress field must be null (zero) and the
   //   - Within the RSDP, the RsdtAddress field must be null (zero) and the
   //     XsdtAddresss MUST be a valid, non-null, 64-bit value.
   //     XsdtAddresss MUST be a valid, non-null, 64-bit value.
-  UINT32 RsdtAddr;
+  UINT32  RsdtAddr;
 
 
-  RsdtAddr = *(UINT32*)Ptr;
+  RsdtAddr = *(UINT32 *)Ptr;
 
 
   if (RsdtAddr != 0) {
   if (RsdtAddr != 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -47,7 +47,8 @@ ValidateRsdtAddress (
       RsdtAddr
       RsdtAddr
       );
       );
   }
   }
-#endif
+
+ #endif
 }
 }
 
 
 /**
 /**
@@ -61,19 +62,19 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateXsdtAddress (
 ValidateXsdtAddress (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
   // Reference: Server Base Boot Requirements System Software on ARM Platforms
   // Reference: Server Base Boot Requirements System Software on ARM Platforms
   // Section: 4.2.1.1 RSDP
   // Section: 4.2.1.1 RSDP
   // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
   // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
   //   - Within the RSDP, the RsdtAddress field must be null (zero) and the
   //   - Within the RSDP, the RsdtAddress field must be null (zero) and the
   //     XsdtAddresss MUST be a valid, non-null, 64-bit value.
   //     XsdtAddresss MUST be a valid, non-null, 64-bit value.
-  UINT64 XsdtAddr;
+  UINT64  XsdtAddr;
 
 
-  XsdtAddr = *(UINT64*)Ptr;
+  XsdtAddr = *(UINT64 *)Ptr;
 
 
   if (XsdtAddr == 0) {
   if (XsdtAddr == 0) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -82,23 +83,24 @@ ValidateXsdtAddress (
       XsdtAddr
       XsdtAddr
       );
       );
   }
   }
-#endif
+
+ #endif
 }
 }
 
 
 /**
 /**
   An array describing the ACPI RSDP Table.
   An array describing the ACPI RSDP Table.
 **/
 **/
-STATIC CONST ACPI_PARSER RsdpParser[] = {
-  {L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL},
-  {L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL},
-  {L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL},
-  {L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL},
-  {L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL},
-  {L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID**)&XsdtAddress,
-   ValidateXsdtAddress, NULL},
-  {L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  RsdpParser[] = {
+  { L"Signature",         8, 0,  NULL,        Dump8Chars, NULL,                  NULL,                NULL },
+  { L"Checksum",          1, 8,  L"0x%x",     NULL,       NULL,                  NULL,                NULL },
+  { L"Oem ID",            6, 9,  NULL,        Dump6Chars, NULL,                  NULL,                NULL },
+  { L"Revision",          1, 15, L"%d",       NULL,       NULL,                  NULL,                NULL },
+  { L"RSDT Address",      4, 16, L"0x%x",     NULL,       NULL,                  ValidateRsdtAddress, NULL },
+  { L"Length",            4, 20, L"%d",       NULL,       NULL,                  NULL,                NULL },
+  { L"XSDT Address",      8, 24, L"0x%lx",    NULL,       (VOID **)&XsdtAddress,
+    ValidateXsdtAddress, NULL },
+  { L"Extended Checksum", 1, 32, L"0x%x",     NULL,       NULL,                  NULL,                NULL },
+  { L"Reserved",          3, 33, L"%x %x %x", Dump3Chars, NULL,                  NULL,                NULL }
 };
 };
 
 
 /**
 /**
@@ -118,10 +120,10 @@ STATIC CONST ACPI_PARSER RsdpParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiRsdp (
 ParseAcpiRsdp (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
   if (Trace) {
   if (Trace) {
@@ -144,7 +146,7 @@ ParseAcpiRsdp (
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Insufficient table length. AcpiTableLength = %d." \
       L"ERROR: Insufficient table length. AcpiTableLength = %d." \
-        L"RSDP parsing aborted.\n",
+      L"RSDP parsing aborted.\n",
       AcpiTableLength
       AcpiTableLength
       );
       );
     return;
     return;
@@ -160,5 +162,5 @@ ParseAcpiRsdp (
     return;
     return;
   }
   }
 
 
-  ProcessAcpiTable ((UINT8*)(UINTN)(*XsdtAddress));
+  ProcessAcpiTable ((UINT8 *)(UINTN)(*XsdtAddress));
 }
 }

+ 28 - 24
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c

@@ -15,22 +15,22 @@
 #include "AcpiTableParser.h"
 #include "AcpiTableParser.h"
 
 
 // Local Variables
 // Local Variables
-STATIC CONST UINT64* SlitSystemLocalityCount;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT64                  *SlitSystemLocalityCount;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   An ACPI_PARSER array describing the ACPI SLIT table.
   An ACPI_PARSER array describing the ACPI SLIT table.
 **/
 **/
-STATIC CONST ACPI_PARSER SlitParser[] = {
+STATIC CONST ACPI_PARSER  SlitParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Number of System Localities", 8, 36, L"0x%lx", NULL,
-   (VOID**)&SlitSystemLocalityCount, NULL, NULL}
+  { L"Number of System Localities",   8,     36, L"0x%lx", NULL,
+    (VOID **)&SlitSystemLocalityCount,NULL,  NULL }
 };
 };
 
 
 /**
 /**
   Macro to get the value of a System Locality
   Macro to get the value of a System Locality
 **/
 **/
-#define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)
+#define SLIT_ELEMENT(Ptr, i, j)  *(Ptr + (i * LocalityCount) + j)
 
 
 /**
 /**
   This function parses the ACPI SLIT table.
   This function parses the ACPI SLIT table.
@@ -50,18 +50,18 @@ STATIC CONST ACPI_PARSER SlitParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiSlit (
 ParseAcpiSlit (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT32 Count;
-  UINT32 Index;
-  UINT32 LocalityCount;
-  UINT8* LocalityPtr;
-  CHAR16 Buffer[80];  // Used for AsciiName param of ParseAcpi
+  UINT32  Offset;
+  UINT32  Count;
+  UINT32  Index;
+  UINT32  LocalityCount;
+  UINT8   *LocalityPtr;
+  CHAR16  Buffer[80]; // Used for AsciiName param of ParseAcpi
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -103,8 +103,8 @@ ParseAcpiSlit (
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: The Number of System Localities provided can't be represented " \
       L"ERROR: The Number of System Localities provided can't be represented " \
-        L"in the SLIT table. SlitSystemLocalityCount = %ld. " \
-        L"MaxLocalityCountAllowed = %d.\n",
+      L"in the SLIT table. SlitSystemLocalityCount = %ld. " \
+      L"MaxLocalityCountAllowed = %d.\n",
       *SlitSystemLocalityCount,
       *SlitSystemLocalityCount,
       MAX_UINT16
       MAX_UINT16
       );
       );
@@ -118,7 +118,7 @@ ParseAcpiSlit (
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"ERROR: Invalid Number of System Localities. " \
       L"ERROR: Invalid Number of System Localities. " \
-        L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n",
+      L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n",
       *SlitSystemLocalityCount,
       *SlitSystemLocalityCount,
       AcpiTableLength
       AcpiTableLength
       );
       );
@@ -144,12 +144,14 @@ ParseAcpiSlit (
     for (Index = 0; Index < LocalityCount; Index++) {
     for (Index = 0; Index < LocalityCount; Index++) {
       Print (L" (%3d) ", Index);
       Print (L" (%3d) ", Index);
     }
     }
+
     Print (L"\n");
     Print (L"\n");
-    for (Count = 0; Count< LocalityCount; Count++) {
+    for (Count = 0; Count < LocalityCount; Count++) {
       Print (L" (%3d) ", Count);
       Print (L" (%3d) ", Count);
       for (Index = 0; Index < LocalityCount; Index++) {
       for (Index = 0; Index < LocalityCount; Index++) {
         Print (L"  %3d  ", SLIT_ELEMENT (LocalityPtr, Count, Index));
         Print (L"  %3d  ", SLIT_ELEMENT (LocalityPtr, Count, Index));
       }
       }
+
       Print (L"\n");
       Print (L"\n");
     }
     }
   }
   }
@@ -158,23 +160,25 @@ ParseAcpiSlit (
   for (Count = 0; Count < LocalityCount; Count++) {
   for (Count = 0; Count < LocalityCount; Count++) {
     for (Index = 0; Index < LocalityCount; Index++) {
     for (Index = 0; Index < LocalityCount; Index++) {
       // Element[x][x] must be equal to 10
       // Element[x][x] must be equal to 10
-      if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index) != 10)) {
+      if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count, Index) != 10)) {
         IncrementErrorCount ();
         IncrementErrorCount ();
         Print (
         Print (
           L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
           L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
-            L" Normalized Value is not 10\n",
+          L" Normalized Value is not 10\n",
           Count,
           Count,
           Index,
           Index,
           SLIT_ELEMENT (LocalityPtr, Count, Index)
           SLIT_ELEMENT (LocalityPtr, Count, Index)
           );
           );
       }
       }
+
       // Element[i][j] must be equal to Element[j][i]
       // Element[i][j] must be equal to Element[j][i]
       if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=
       if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=
-          SLIT_ELEMENT (LocalityPtr, Index, Count)) {
+          SLIT_ELEMENT (LocalityPtr, Index, Count))
+      {
         IncrementErrorCount ();
         IncrementErrorCount ();
         Print (
         Print (
           L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
           L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
-           L"Element[0x%lx][0x%lx] (%3d) do not match.\n",
+          L"Element[0x%lx][0x%lx] (%3d) do not match.\n",
           Count,
           Count,
           Index,
           Index,
           SLIT_ELEMENT (LocalityPtr, Count, Index),
           SLIT_ELEMENT (LocalityPtr, Count, Index),

+ 41 - 38
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c

@@ -16,7 +16,7 @@
 #include "AcpiTableParser.h"
 #include "AcpiTableParser.h"
 
 
 // Local variables
 // Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   This function validates the Interrupt Type.
   This function validates the Interrupt Type.
@@ -29,24 +29,26 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateInterruptType (
 ValidateInterruptType (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-  UINT8 InterruptType;
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+  UINT8  InterruptType;
 
 
   InterruptType = *Ptr;
   InterruptType = *Ptr;
 
 
   if (InterruptType !=
   if (InterruptType !=
-        EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) {
+      EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC)
+  {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (
     Print (
       L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms",
       L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms",
       InterruptType
       InterruptType
       );
       );
   }
   }
-#endif
+
+ #endif
 }
 }
 
 
 /**
 /**
@@ -60,12 +62,12 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateIrq (
 ValidateIrq (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-  UINT8 Irq;
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+  UINT8  Irq;
 
 
   Irq = *Ptr;
   Irq = *Ptr;
 
 
@@ -76,35 +78,36 @@ ValidateIrq (
       Irq
       Irq
       );
       );
   }
   }
-#endif
+
+ #endif
 }
 }
 
 
 /**
 /**
   An ACPI_PARSER array describing the ACPI SPCR Table.
   An ACPI_PARSER array describing the ACPI SPCR Table.
 **/
 **/
-STATIC CONST ACPI_PARSER SpcrParser[] = {
+STATIC CONST ACPI_PARSER  SpcrParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Interface Type", 1, 36, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 3, 37, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
-  {L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL},
-  {L"Interrupt Type", 1, 52, L"%d", NULL, NULL, ValidateInterruptType, NULL},
-  {L"IRQ", 1, 53, L"%d", NULL, NULL, ValidateIrq, NULL},
-  {L"Global System Interrupt", 4, 54, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Baud Rate", 1, 58, L"%d", NULL, NULL, NULL, NULL},
-  {L"Parity", 1, 59, L"%d", NULL, NULL, NULL, NULL},
-  {L"Stop Bits", 1, 60, L"%d", NULL, NULL, NULL, NULL},
-  {L"Flow Control", 1, 61, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Terminal Type", 1, 62, L"%d", NULL, NULL, NULL, NULL},
-  {L"Reserved", 1, 63, L"%x", NULL, NULL, NULL, NULL},
-
-  {L"PCI Device ID", 2, 64, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PCI Vendor ID", 2, 66, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PCI Bus Number", 1, 68, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PCI Device Number", 1, 69, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PCI Function Number", 1, 70, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PCI Flags", 4, 71, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PCI Segment", 1, 75, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL}
+  { L"Interface Type",             1,   36, L"%d",       NULL,       NULL, NULL,                  NULL },
+  { L"Reserved",                   3,   37, L"%x %x %x", Dump3Chars, NULL, NULL,                  NULL },
+  { L"Base Address",               12,  40, NULL,        DumpGas,    NULL, NULL,                  NULL },
+  { L"Interrupt Type",             1,   52, L"%d",       NULL,       NULL, ValidateInterruptType, NULL },
+  { L"IRQ",                        1,   53, L"%d",       NULL,       NULL, ValidateIrq,           NULL },
+  { L"Global System Interrupt",    4,   54, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Baud Rate",                  1,   58, L"%d",       NULL,       NULL, NULL,                  NULL },
+  { L"Parity",                     1,   59, L"%d",       NULL,       NULL, NULL,                  NULL },
+  { L"Stop Bits",                  1,   60, L"%d",       NULL,       NULL, NULL,                  NULL },
+  { L"Flow Control",               1,   61, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Terminal Type",              1,   62, L"%d",       NULL,       NULL, NULL,                  NULL },
+  { L"Reserved",                   1,   63, L"%x",       NULL,       NULL, NULL,                  NULL },
+
+  { L"PCI Device ID",              2,   64, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"PCI Vendor ID",              2,   66, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"PCI Bus Number",             1,   68, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"PCI Device Number",          1,   69, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"PCI Function Number",        1,   70, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"PCI Flags",                  4,   71, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"PCI Segment",                1,   75, L"0x%x",     NULL,       NULL, NULL,                  NULL },
+  { L"Reserved",                   4,   76, L"%x",       NULL,       NULL, NULL,                  NULL }
 };
 };
 
 
 /**
 /**
@@ -122,10 +125,10 @@ STATIC CONST ACPI_PARSER SpcrParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiSpcr (
 ParseAcpiSpcr (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
   if (!Trace) {
   if (!Trace) {

+ 123 - 121
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c

@@ -16,10 +16,10 @@
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
 // Local Variables
 // Local Variables
-STATIC CONST UINT8* SratRAType;
-STATIC CONST UINT8* SratRALength;
-STATIC CONST UINT8* SratDeviceHandleType;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT8                   *SratRAType;
+STATIC CONST UINT8                   *SratRALength;
+STATIC CONST UINT8                   *SratDeviceHandleType;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /**
 /**
   This function validates the Reserved field in the SRAT table header.
   This function validates the Reserved field in the SRAT table header.
@@ -32,11 +32,11 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateSratReserved (
 ValidateSratReserved (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  if (*(UINT32*)Ptr != 1) {
+  if (*(UINT32 *)Ptr != 1) {
     IncrementErrorCount ();
     IncrementErrorCount ();
     Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n");
     Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n");
   }
   }
@@ -54,11 +54,11 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 ValidateSratDeviceHandleType (
 ValidateSratDeviceHandleType (
-  IN UINT8* Ptr,
-  IN VOID*  Context
+  IN UINT8  *Ptr,
+  IN VOID   *Context
   )
   )
 {
 {
-  UINT8   DeviceHandleType;
+  UINT8  DeviceHandleType;
 
 
   DeviceHandleType = *Ptr;
   DeviceHandleType = *Ptr;
 
 
@@ -82,11 +82,11 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpSratPciBdfNumber (
 DumpSratPciBdfNumber (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
   )
   )
 {
 {
-  CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
+  CHAR16  Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
 
 
   Print (L"\n");
   Print (L"\n");
 
 
@@ -143,20 +143,20 @@ DumpSratPciBdfNumber (
 /**
 /**
   An ACPI_PARSER array describing the Device Handle - ACPI
   An ACPI_PARSER array describing the Device Handle - ACPI
 **/
 **/
-STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = {
-  {L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},
-  {L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  SratDeviceHandleAcpiParser[] = {
+  { L"ACPI_HID", 8, 0,  L"0x%lx", NULL, NULL, NULL, NULL },
+  { L"ACPI_UID", 4, 8,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved", 4, 12, L"0x%x",  NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Device Handle - PCI
   An ACPI_PARSER array describing the Device Handle - PCI
 **/
 **/
-STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = {
-  {L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL},
-  {L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,
-   NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  SratDeviceHandlePciParser[] = {
+  { L"PCI Segment",    2,  0, L"0x%x",                                    NULL,                 NULL, NULL, NULL },
+  { L"PCI BDF Number", 2,  2, NULL,                                       DumpSratPciBdfNumber, NULL, NULL, NULL },
+  { L"Reserved",       12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,
+    NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -170,9 +170,9 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpSratDeviceHandle (
 DumpSratDeviceHandle (
-  IN CONST CHAR16* Format,
-  IN UINT8*        Ptr
- )
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
+  )
 {
 {
   if (SratDeviceHandleType == NULL) {
   if (SratDeviceHandleType == NULL) {
     IncrementErrorCount ();
     IncrementErrorCount ();
@@ -213,11 +213,11 @@ STATIC
 VOID
 VOID
 EFIAPI
 EFIAPI
 DumpSratApicProximity (
 DumpSratApicProximity (
- IN CONST CHAR16* Format,
- IN UINT8*        Ptr
- )
+  IN CONST CHAR16  *Format,
+  IN UINT8         *Ptr
+  )
 {
 {
-  UINT32 ProximityDomain;
+  UINT32  ProximityDomain;
 
 
   ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16);
   ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16);
 
 
@@ -227,108 +227,108 @@ DumpSratApicProximity (
 /**
 /**
   An ACPI_PARSER array describing the SRAT Table.
   An ACPI_PARSER array describing the SRAT Table.
 **/
 **/
-STATIC CONST ACPI_PARSER SratParser[] = {
+STATIC CONST ACPI_PARSER  SratParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
   PARSE_ACPI_HEADER (&AcpiHdrInfo),
-  {L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL},
-  {L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}
+  { L"Reserved",                   4,  36, L"0x%x",  NULL, NULL, ValidateSratReserved, NULL },
+  { L"Reserved",                   8,  40, L"0x%lx", NULL, NULL, NULL,                 NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Resource Allocation structure header.
   An ACPI_PARSER array describing the Resource Allocation structure header.
 **/
 **/
-STATIC CONST ACPI_PARSER SratResourceAllocationParser[] = {
-  {L"Type", 1, 0, NULL, NULL, (VOID**)&SratRAType, NULL, NULL},
-  {L"Length", 1, 1, NULL, NULL, (VOID**)&SratRALength, NULL, NULL}
+STATIC CONST ACPI_PARSER  SratResourceAllocationParser[] = {
+  { L"Type",   1, 0, NULL, NULL, (VOID **)&SratRAType,   NULL, NULL },
+  { L"Length", 1, 1, NULL, NULL, (VOID **)&SratRALength, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the GICC Affinity structure.
   An ACPI_PARSER array describing the GICC Affinity structure.
 **/
 **/
-STATIC CONST ACPI_PARSER SratGicCAffinityParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  SratGicCAffinityParser[] = {
+  { L"Type",               1, 0,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Length",             1, 1,  L"0x%x", NULL, NULL, NULL, NULL },
+
+  { L"Proximity Domain",   4, 2,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"ACPI Processor UID", 4, 6,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Flags",              4, 10, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Clock Domain",       4, 14, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the GIC ITS Affinity structure.
   An ACPI_PARSER array describing the GIC ITS Affinity structure.
 **/
 **/
-STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
+STATIC CONST ACPI_PARSER  SratGicITSAffinityParser[] = {
+  { L"Type",             1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Length",           1, 1, L"0x%x", NULL, NULL, NULL, NULL },
 
 
-  {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
+  { L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Reserved",         2, 6, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"ITS Id",           4, 8, L"0x%x", NULL, NULL, NULL, NULL },
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Generic Initiator Affinity Structure
   An ACPI_PARSER array describing the Generic Initiator Affinity Structure
 **/
 **/
-STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Device Handle Type", 1, 3, L"%d", NULL, (VOID**)&SratDeviceHandleType,
-   ValidateSratDeviceHandleType, NULL},
-  {L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, NULL, NULL, NULL},
-  {L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  SratGenericInitiatorAffinityParser[] = {
+  { L"Type",               1,  0,  L"0x%x", NULL,                 NULL,                           NULL, NULL },
+  { L"Length",             1,  1,  L"0x%x", NULL,                 NULL,                           NULL, NULL },
+
+  { L"Reserved",           1,  2,  L"0x%x", NULL,                 NULL,                           NULL, NULL },
+  { L"Device Handle Type", 1,  3,  L"%d",   NULL,                 (VOID **)&SratDeviceHandleType,
+    ValidateSratDeviceHandleType, NULL },
+  { L"Proximity Domain",   4,  4,  L"0x%x", NULL,                 NULL,                           NULL, NULL },
+  { L"Device Handle",      16, 8,  L"%s",   DumpSratDeviceHandle, NULL,                           NULL, NULL },
+  { L"Flags",              4,  24, L"0x%x", NULL,                 NULL,                           NULL, NULL },
+  { L"Reserved",           4,  28, L"0x%x", NULL,                 NULL,                           NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Memory Affinity structure.
   An ACPI_PARSER array describing the Memory Affinity structure.
 **/
 **/
-STATIC CONST ACPI_PARSER SratMemAffinityParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  SratMemAffinityParser[] = {
+  { L"Type",              1, 0,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Length",            1, 1,  L"0x%x",  NULL, NULL, NULL, NULL },
+
+  { L"Proximity Domain",  4, 2,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",          2, 6,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Base Address Low",  4, 8,  L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Base Address High", 4, 12, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Length Low",        4, 16, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Length High",       4, 20, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",          4, 24, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Flags",             4, 28, L"0x%x",  NULL, NULL, NULL, NULL },
+  { L"Reserved",          8, 32, L"0x%lx", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the APIC/SAPIC Affinity structure.
   An ACPI_PARSER array describing the APIC/SAPIC Affinity structure.
 **/
 **/
-STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity,
-   NULL, NULL, NULL},
-  {L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  SratApciSapicAffinityParser[] = {
+  { L"Type",                    1, 0,  L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Length",                  1, 1,  L"0x%x", NULL,                  NULL, NULL, NULL },
+
+  { L"Proximity Domain [7:0]",  1, 2,  L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"APIC ID",                 1, 3,  L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Flags",                   4, 4,  L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Local SAPIC EID",         1, 8,  L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Proximity Domain [31:8]", 3, 9,  L"0x%x", DumpSratApicProximity,
+    NULL, NULL, NULL },
+  { L"Clock Domain",            4, 12, L"0x%x", NULL,                  NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
   An ACPI_PARSER array describing the Processor Local x2APIC Affinity structure.
   An ACPI_PARSER array describing the Processor Local x2APIC Affinity structure.
 **/
 **/
-STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = {
-  {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
-
-  {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}
+STATIC CONST ACPI_PARSER  SratX2ApciAffinityParser[] = {
+  { L"Type",             1, 0,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Length",           1, 1,  L"0x%x", NULL, NULL, NULL, NULL },
+
+  { L"Reserved",         2, 2,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Proximity Domain", 4, 4,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"X2APIC ID",        4, 8,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Flags",            4, 12, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Clock Domain",     4, 16, L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Reserved",         4, 20, L"0x%x", NULL, NULL, NULL, NULL }
 };
 };
 
 
 /**
 /**
@@ -352,28 +352,28 @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = {
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiSrat (
 ParseAcpiSrat (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32 Offset;
-  UINT8* ResourcePtr;
-  UINT32 GicCAffinityIndex;
-  UINT32 GicITSAffinityIndex;
-  UINT32 GenericInitiatorAffinityIndex;
-  UINT32 MemoryAffinityIndex;
-  UINT32 ApicSapicAffinityIndex;
-  UINT32 X2ApicAffinityIndex;
-  CHAR8  Buffer[80];  // Used for AsciiName param of ParseAcpi
-
-  GicCAffinityIndex = 0;
-  GicITSAffinityIndex = 0;
+  UINT32  Offset;
+  UINT8   *ResourcePtr;
+  UINT32  GicCAffinityIndex;
+  UINT32  GicITSAffinityIndex;
+  UINT32  GenericInitiatorAffinityIndex;
+  UINT32  MemoryAffinityIndex;
+  UINT32  ApicSapicAffinityIndex;
+  UINT32  X2ApicAffinityIndex;
+  CHAR8   Buffer[80]; // Used for AsciiName param of ParseAcpi
+
+  GicCAffinityIndex             = 0;
+  GicITSAffinityIndex           = 0;
   GenericInitiatorAffinityIndex = 0;
   GenericInitiatorAffinityIndex = 0;
-  MemoryAffinityIndex = 0;
-  ApicSapicAffinityIndex = 0;
-  X2ApicAffinityIndex = 0;
+  MemoryAffinityIndex           = 0;
+  ApicSapicAffinityIndex        = 0;
+  X2ApicAffinityIndex           = 0;
 
 
   if (!Trace) {
   if (!Trace) {
     return;
     return;
@@ -403,11 +403,12 @@ ParseAcpiSrat (
     // Check if the values used to control the parsing logic have been
     // Check if the values used to control the parsing logic have been
     // successfully read.
     // successfully read.
     if ((SratRAType == NULL) ||
     if ((SratRAType == NULL) ||
-        (SratRALength == NULL)) {
+        (SratRALength == NULL))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Insufficient remaining table buffer length to read the " \
         L"ERROR: Insufficient remaining table buffer length to read the " \
-          L"Static Resource Allocation structure header. Length = %d.\n",
+        L"Static Resource Allocation structure header. Length = %d.\n",
         AcpiTableLength - Offset
         AcpiTableLength - Offset
         );
         );
       return;
       return;
@@ -415,11 +416,12 @@ ParseAcpiSrat (
 
 
     // Validate Static Resource Allocation Structure length
     // Validate Static Resource Allocation Structure length
     if ((*SratRALength == 0) ||
     if ((*SratRALength == 0) ||
-        ((Offset + (*SratRALength)) > AcpiTableLength)) {
+        ((Offset + (*SratRALength)) > AcpiTableLength))
+    {
       IncrementErrorCount ();
       IncrementErrorCount ();
       Print (
       Print (
         L"ERROR: Invalid Static Resource Allocation Structure length. " \
         L"ERROR: Invalid Static Resource Allocation Structure length. " \
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
         *SratRALength,
         *SratRALength,
         Offset,
         Offset,
         AcpiTableLength
         AcpiTableLength
@@ -451,7 +453,7 @@ ParseAcpiSrat (
           sizeof (Buffer),
           sizeof (Buffer),
           "GIC ITS Affinity Structure [%d]",
           "GIC ITS Affinity Structure [%d]",
           GicITSAffinityIndex++
           GicITSAffinityIndex++
-        );
+          );
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -468,7 +470,7 @@ ParseAcpiSrat (
           sizeof (Buffer),
           sizeof (Buffer),
           "Generic Initiator Affinity Structure [%d]",
           "Generic Initiator Affinity Structure [%d]",
           GenericInitiatorAffinityIndex++
           GenericInitiatorAffinityIndex++
-        );
+          );
         ParseAcpi (
         ParseAcpi (
           TRUE,
           TRUE,
           2,
           2,
@@ -476,7 +478,7 @@ ParseAcpiSrat (
           ResourcePtr,
           ResourcePtr,
           *SratRALength,
           *SratRALength,
           PARSER_PARAMS (SratGenericInitiatorAffinityParser)
           PARSER_PARAMS (SratGenericInitiatorAffinityParser)
-        );
+          );
         break;
         break;
 
 
       case EFI_ACPI_6_3_MEMORY_AFFINITY:
       case EFI_ACPI_6_3_MEMORY_AFFINITY:
@@ -537,6 +539,6 @@ ParseAcpiSrat (
     }
     }
 
 
     ResourcePtr += (*SratRALength);
     ResourcePtr += (*SratRALength);
-    Offset += (*SratRALength);
+    Offset      += (*SratRALength);
   }
   }
 }
 }

+ 4 - 4
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c

@@ -28,10 +28,10 @@
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiSsdt (
 ParseAcpiSsdt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
   if (!Trace) {
   if (!Trace) {

+ 28 - 26
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c

@@ -15,11 +15,11 @@
 #include "AcpiTableParser.h"
 #include "AcpiTableParser.h"
 
 
 // Local variables
 // Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
 
 
 /** An ACPI_PARSER array describing the ACPI XSDT table.
 /** An ACPI_PARSER array describing the ACPI XSDT table.
 */
 */
-STATIC CONST ACPI_PARSER XsdtParser[] = {
+STATIC CONST ACPI_PARSER  XsdtParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
 };
 };
 
 
@@ -30,7 +30,7 @@ CONST ACPI_DESCRIPTION_HEADER_INFO *
 EFIAPI
 EFIAPI
 GetAcpiXsdtHeaderInfo (
 GetAcpiXsdtHeaderInfo (
   VOID
   VOID
-)
+  )
 {
 {
   return &AcpiHdrInfo;
   return &AcpiHdrInfo;
 }
 }
@@ -48,17 +48,17 @@ GetAcpiXsdtHeaderInfo (
 VOID
 VOID
 EFIAPI
 EFIAPI
 ParseAcpiXsdt (
 ParseAcpiXsdt (
-  IN BOOLEAN Trace,
-  IN UINT8*  Ptr,
-  IN UINT32  AcpiTableLength,
-  IN UINT8   AcpiTableRevision
+  IN BOOLEAN  Trace,
+  IN UINT8    *Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8    AcpiTableRevision
   )
   )
 {
 {
-  UINT32        Offset;
-  UINT32        TableOffset;
-  UINT64*       TablePointer;
-  UINTN         EntryIndex;
-  CHAR16        Buffer[32];
+  UINT32  Offset;
+  UINT32  TableOffset;
+  UINT64  *TablePointer;
+  UINTN   EntryIndex;
+  CHAR16  Buffer[32];
 
 
   Offset = ParseAcpi (
   Offset = ParseAcpi (
              Trace,
              Trace,
@@ -72,24 +72,24 @@ ParseAcpiXsdt (
   TableOffset = Offset;
   TableOffset = Offset;
 
 
   if (Trace) {
   if (Trace) {
-    EntryIndex = 0;
-    TablePointer = (UINT64*)(Ptr + TableOffset);
+    EntryIndex   = 0;
+    TablePointer = (UINT64 *)(Ptr + TableOffset);
     while (Offset < AcpiTableLength) {
     while (Offset < AcpiTableLength) {
-      CONST UINT32* Signature;
-      CONST UINT32* Length;
-      CONST UINT8*  Revision;
+      CONST UINT32  *Signature;
+      CONST UINT32  *Length;
+      CONST UINT8   *Revision;
 
 
-      if ((UINT64*)(UINTN)(*TablePointer) != NULL) {
-        UINT8*      SignaturePtr;
+      if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
+        UINT8  *SignaturePtr;
 
 
         ParseAcpiHeader (
         ParseAcpiHeader (
-          (UINT8*)(UINTN)(*TablePointer),
+          (UINT8 *)(UINTN)(*TablePointer),
           &Signature,
           &Signature,
           &Length,
           &Length,
           &Revision
           &Revision
           );
           );
 
 
-        SignaturePtr = (UINT8*)Signature;
+        SignaturePtr = (UINT8 *)Signature;
 
 
         UnicodeSPrint (
         UnicodeSPrint (
           Buffer,
           Buffer,
@@ -114,7 +114,7 @@ ParseAcpiXsdt (
       Print (L"0x%lx\n", *TablePointer);
       Print (L"0x%lx\n", *TablePointer);
 
 
       // Validate the table pointers are not NULL
       // Validate the table pointers are not NULL
-      if ((UINT64*)(UINTN)(*TablePointer) == NULL) {
+      if ((UINT64 *)(UINTN)(*TablePointer) == NULL) {
         IncrementErrorCount ();
         IncrementErrorCount ();
         Print (
         Print (
           L"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n",
           L"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n",
@@ -122,18 +122,20 @@ ParseAcpiXsdt (
           *TablePointer
           *TablePointer
           );
           );
       }
       }
+
       Offset += sizeof (UINT64);
       Offset += sizeof (UINT64);
       TablePointer++;
       TablePointer++;
     } // while
     } // while
   }
   }
 
 
   // Process the tables
   // Process the tables
-  Offset = TableOffset;
-  TablePointer = (UINT64*)(Ptr + TableOffset);
+  Offset       = TableOffset;
+  TablePointer = (UINT64 *)(Ptr + TableOffset);
   while (Offset < AcpiTableLength) {
   while (Offset < AcpiTableLength) {
-    if ((UINT64*)(UINTN)(*TablePointer) != NULL) {
-      ProcessAcpiTable ((UINT8*)(UINTN)(*TablePointer));
+    if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
+      ProcessAcpiTable ((UINT8 *)(UINTN)(*TablePointer));
     }
     }
+
     Offset += sizeof (UINT64);
     Offset += sizeof (UINT64);
     TablePointer++;
     TablePointer++;
   } // while
   } // while

+ 86 - 75
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c

@@ -25,20 +25,20 @@
 #include "AcpiView.h"
 #include "AcpiView.h"
 #include "AcpiViewConfig.h"
 #include "AcpiViewConfig.h"
 
 
-CONST CHAR16 gShellAcpiViewFileName[] = L"ShellCommand";
-EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;
+CONST CHAR16    gShellAcpiViewFileName[] = L"ShellCommand";
+EFI_HII_HANDLE  gShellAcpiViewHiiHandle  = NULL;
 
 
 /**
 /**
   An array of acpiview command line parameters.
   An array of acpiview command line parameters.
 **/
 **/
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
-  {L"-q", TypeFlag},
-  {L"-d", TypeFlag},
-  {L"-h", TypeFlag},
-  {L"-l", TypeFlag},
-  {L"-s", TypeValue},
-  {L"-r", TypeValue},
-  {NULL, TypeMax}
+STATIC CONST SHELL_PARAM_ITEM  ParamList[] = {
+  { L"-q", TypeFlag  },
+  { L"-d", TypeFlag  },
+  { L"-h", TypeFlag  },
+  { L"-l", TypeFlag  },
+  { L"-s", TypeValue },
+  { L"-r", TypeValue },
+  { NULL,  TypeMax   }
 };
 };
 
 
 /**
 /**
@@ -46,30 +46,30 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
 */
 */
 STATIC
 STATIC
 CONST
 CONST
-ACPI_TABLE_PARSER ParserList[] = {
-  {EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE, ParseAcpiAest},
-  {EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, ParseAcpiBgrt},
-  {EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2},
-  {EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
-   ParseAcpiDsdt},
-  {EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, ParseAcpiFacs},
-  {EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt},
-  {EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt},
-  {EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE, ParseAcpiHmat},
-  {EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE, ParseAcpiIort},
-  {EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt},
-  {EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
-   ParseAcpiMcfg},
-  {EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
-   ParseAcpiPcct},
-  {EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
-   ParseAcpiPptt},
-  {RSDP_TABLE_INFO, ParseAcpiRsdp},
-  {EFI_ACPI_6_2_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE, ParseAcpiSlit},
-  {EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, ParseAcpiSpcr},
-  {EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE, ParseAcpiSrat},
-  {EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiSsdt},
-  {EFI_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiXsdt}
+ACPI_TABLE_PARSER  ParserList[] = {
+  { EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE,                                                       ParseAcpiAest },
+  { EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE,                                                 ParseAcpiBgrt },
+  { EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,                                                           ParseAcpiDbg2 },
+  { EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+    ParseAcpiDsdt },
+  { EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE,                                              ParseAcpiFacs },
+  { EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,                                                 ParseAcpiFadt },
+  { EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,                                              ParseAcpiGtdt },
+  { EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE,                                         ParseAcpiHmat },
+  { EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE,                                                           ParseAcpiIort },
+  { EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,                                              ParseAcpiMadt },
+  { EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
+    ParseAcpiMcfg },
+  { EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
+    ParseAcpiPcct },
+  { EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
+    ParseAcpiPptt },
+  { RSDP_TABLE_INFO,                                                                                     ParseAcpiRsdp },
+  { EFI_ACPI_6_2_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE,                                            ParseAcpiSlit },
+  { EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,                                        ParseAcpiSpcr },
+  { EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE,                                               ParseAcpiSrat },
+  { EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,                                           ParseAcpiSsdt },
+  { EFI_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,                                            ParseAcpiXsdt }
 };
 };
 
 
 /**
 /**
@@ -86,11 +86,11 @@ EFI_STATUS
 RegisterAllParsers (
 RegisterAllParsers (
   )
   )
 {
 {
-  EFI_STATUS Status;
-  UINTN Count;
+  EFI_STATUS  Status;
+  UINTN       Count;
 
 
   Status = EFI_SUCCESS;
   Status = EFI_SUCCESS;
-  Count = sizeof (ParserList) / sizeof (ParserList[0]);
+  Count  = sizeof (ParserList) / sizeof (ParserList[0]);
 
 
   while (Count-- != 0) {
   while (Count-- != 0) {
     Status = RegisterParser (
     Status = RegisterParser (
@@ -101,6 +101,7 @@ RegisterAllParsers (
       return Status;
       return Status;
     }
     }
   }
   }
+
   return Status;
   return Status;
 }
 }
 
 
@@ -116,14 +117,14 @@ RegisterAllParsers (
 UINTN
 UINTN
 EFIAPI
 EFIAPI
 ShellDumpBufferToFile (
 ShellDumpBufferToFile (
-  IN CONST CHAR16* FileNameBuffer,
-  IN CONST VOID*   Buffer,
+  IN CONST CHAR16  *FileNameBuffer,
+  IN CONST VOID    *Buffer,
   IN CONST UINTN   BufferSize
   IN CONST UINTN   BufferSize
   )
   )
 {
 {
-  EFI_STATUS          Status;
-  SHELL_FILE_HANDLE   DumpFileHandle;
-  UINTN               TransferBytes;
+  EFI_STATUS         Status;
+  SHELL_FILE_HANDLE  DumpFileHandle;
+  UINTN              TransferBytes;
 
 
   Status = ShellOpenFileByName (
   Status = ShellOpenFileByName (
              FileNameBuffer,
              FileNameBuffer,
@@ -145,11 +146,11 @@ ShellDumpBufferToFile (
   }
   }
 
 
   TransferBytes = BufferSize;
   TransferBytes = BufferSize;
-  Status = ShellWriteFile (
-             DumpFileHandle,
-             &TransferBytes,
-             (VOID *) Buffer
-             );
+  Status        = ShellWriteFile (
+                    DumpFileHandle,
+                    &TransferBytes,
+                    (VOID *)Buffer
+                    );
 
 
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
     Print (L"ERROR: Failed to write binary file.\n");
     Print (L"ERROR: Failed to write binary file.\n");
@@ -167,7 +168,7 @@ ShellDumpBufferToFile (
 
 
   @return The string pointer to the file name.
   @return The string pointer to the file name.
 **/
 **/
-CONST CHAR16*
+CONST CHAR16 *
 EFIAPI
 EFIAPI
 ShellCommandGetManFileNameAcpiView (
 ShellCommandGetManFileNameAcpiView (
   VOID
   VOID
@@ -190,27 +191,27 @@ SHELL_STATUS
 EFIAPI
 EFIAPI
 ShellCommandRunAcpiView (
 ShellCommandRunAcpiView (
   IN EFI_HANDLE        ImageHandle,
   IN EFI_HANDLE        ImageHandle,
-  IN EFI_SYSTEM_TABLE* SystemTable
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
   EFI_STATUS         Status;
   EFI_STATUS         Status;
   SHELL_STATUS       ShellStatus;
   SHELL_STATUS       ShellStatus;
-  LIST_ENTRY*        Package;
-  CHAR16*            ProblemParam;
+  LIST_ENTRY         *Package;
+  CHAR16             *ProblemParam;
   SHELL_FILE_HANDLE  TmpDumpFileHandle;
   SHELL_FILE_HANDLE  TmpDumpFileHandle;
-  CONST CHAR16*      MandatoryTableSpecStr;
-  CONST CHAR16*      SelectedTableName;
+  CONST CHAR16       *MandatoryTableSpecStr;
+  CONST CHAR16       *SelectedTableName;
 
 
   // Set configuration defaults
   // Set configuration defaults
   AcpiConfigSetDefaults ();
   AcpiConfigSetDefaults ();
 
 
-  ShellStatus = SHELL_SUCCESS;
-  Package = NULL;
+  ShellStatus       = SHELL_SUCCESS;
+  Package           = NULL;
   TmpDumpFileHandle = NULL;
   TmpDumpFileHandle = NULL;
 
 
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
-    if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
+    if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
         -1,
         -1,
         -1,
         -1,
@@ -224,6 +225,7 @@ ShellCommandRunAcpiView (
     } else {
     } else {
       Print (L"acpiview: Error processing input parameter(s)\n");
       Print (L"acpiview: Error processing input parameter(s)\n");
     }
     }
+
     ShellStatus = SHELL_INVALID_PARAMETER;
     ShellStatus = SHELL_INVALID_PARAMETER;
   } else {
   } else {
     if (ShellCommandLineGetCount (Package) > 1) {
     if (ShellCommandLineGetCount (Package) > 1) {
@@ -246,7 +248,8 @@ ShellCommandRunAcpiView (
         L"acpiview"
         L"acpiview"
         );
         );
     } else if (ShellCommandLineGetFlag (Package, L"-s") &&
     } else if (ShellCommandLineGetFlag (Package, L"-s") &&
-               ShellCommandLineGetValue (Package, L"-s") == NULL) {
+               (ShellCommandLineGetValue (Package, L"-s") == NULL))
+    {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
         -1,
         -1,
         -1,
         -1,
@@ -258,7 +261,8 @@ ShellCommandRunAcpiView (
         );
         );
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else if (ShellCommandLineGetFlag (Package, L"-r") &&
     } else if (ShellCommandLineGetFlag (Package, L"-r") &&
-               ShellCommandLineGetValue (Package, L"-r") == NULL) {
+               (ShellCommandLineGetValue (Package, L"-r") == NULL))
+    {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
         -1,
         -1,
         -1,
         -1,
@@ -270,7 +274,8 @@ ShellCommandRunAcpiView (
         );
         );
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else if ((ShellCommandLineGetFlag (Package, L"-s") &&
     } else if ((ShellCommandLineGetFlag (Package, L"-s") &&
-                ShellCommandLineGetFlag (Package, L"-l"))) {
+                ShellCommandLineGetFlag (Package, L"-l")))
+    {
       ShellPrintHiiEx (
       ShellPrintHiiEx (
         -1,
         -1,
         -1,
         -1,
@@ -281,18 +286,19 @@ ShellCommandRunAcpiView (
         );
         );
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else if (ShellCommandLineGetFlag (Package, L"-d") &&
     } else if (ShellCommandLineGetFlag (Package, L"-d") &&
-               !ShellCommandLineGetFlag (Package, L"-s")) {
-        ShellPrintHiiEx (
-          -1,
-          -1,
-          NULL,
-          STRING_TOKEN (STR_GEN_MISSING_OPTION),
-          gShellAcpiViewHiiHandle,
-          L"acpiview",
-          L"-s",
-          L"-d"
-          );
-        ShellStatus = SHELL_INVALID_PARAMETER;
+               !ShellCommandLineGetFlag (Package, L"-s"))
+    {
+      ShellPrintHiiEx (
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_GEN_MISSING_OPTION),
+        gShellAcpiViewHiiHandle,
+        L"acpiview",
+        L"-s",
+        L"-d"
+        );
+      ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
       // Turn on colour highlighting if requested
       // Turn on colour highlighting if requested
       SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h"));
       SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h"));
@@ -316,9 +322,9 @@ ShellCommandRunAcpiView (
           SelectAcpiTable (SelectedTableName);
           SelectAcpiTable (SelectedTableName);
           SetReportOption (ReportSelected);
           SetReportOption (ReportSelected);
 
 
-          if (ShellCommandLineGetFlag (Package, L"-d"))  {
+          if (ShellCommandLineGetFlag (Package, L"-d")) {
             // Create a temporary file to check if the media is writable.
             // Create a temporary file to check if the media is writable.
-            CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
+            CHAR16  FileNameBuffer[MAX_FILE_NAME_LEN];
             SetReportOption (ReportDumpBinFile);
             SetReportOption (ReportDumpBinFile);
 
 
             UnicodeSPrint (
             UnicodeSPrint (
@@ -337,7 +343,7 @@ ShellCommandRunAcpiView (
                        );
                        );
 
 
             if (EFI_ERROR (Status)) {
             if (EFI_ERROR (Status)) {
-              ShellStatus = SHELL_INVALID_PARAMETER;
+              ShellStatus       = SHELL_INVALID_PARAMETER;
               TmpDumpFileHandle = NULL;
               TmpDumpFileHandle = NULL;
               ShellPrintHiiEx (
               ShellPrintHiiEx (
                 -1,
                 -1,
@@ -349,6 +355,7 @@ ShellCommandRunAcpiView (
                 );
                 );
               goto Done;
               goto Done;
             }
             }
+
             // Delete Temporary file.
             // Delete Temporary file.
             ShellDeleteFile (&TmpDumpFileHandle);
             ShellDeleteFile (&TmpDumpFileHandle);
           } // -d
           } // -d
@@ -367,6 +374,7 @@ Done:
   if (Package != NULL) {
   if (Package != NULL) {
     ShellCommandLineFreeVarList (Package);
     ShellCommandLineFreeVarList (Package);
   }
   }
+
   return ShellStatus;
   return ShellStatus;
 }
 }
 
 
@@ -389,7 +397,8 @@ UefiShellAcpiViewCommandLibConstructor (
   IN EFI_SYSTEM_TABLE  *SystemTable
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS Status;
+  EFI_STATUS  Status;
+
   gShellAcpiViewHiiHandle = NULL;
   gShellAcpiViewHiiHandle = NULL;
 
 
   // Check Shell Profile Debug1 bit of the profiles mask
   // Check Shell Profile Debug1 bit of the profiles mask
@@ -412,6 +421,7 @@ UefiShellAcpiViewCommandLibConstructor (
   if (gShellAcpiViewHiiHandle == NULL) {
   if (gShellAcpiViewHiiHandle == NULL) {
     return EFI_DEVICE_ERROR;
     return EFI_DEVICE_ERROR;
   }
   }
+
   // Install our Shell command handler
   // Install our Shell command handler
   ShellCommandRegisterCommandName (
   ShellCommandRegisterCommandName (
     L"acpiview",
     L"acpiview",
@@ -443,5 +453,6 @@ UefiShellAcpiViewCommandLibDestructor (
   if (gShellAcpiViewHiiHandle != NULL) {
   if (gShellAcpiViewHiiHandle != NULL) {
     HiiRemovePackages (gShellAcpiViewHiiHandle);
     HiiRemovePackages (gShellAcpiViewHiiHandle);
   }
   }
+
   return EFI_SUCCESS;
   return EFI_SUCCESS;
 }
 }

File diff suppressed because it is too large
+ 309 - 277
ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c


+ 27 - 24
ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c

@@ -43,51 +43,54 @@ ShellCEntryLib (
   )
   )
 {
 {
   INTN                           ReturnFromMain;
   INTN                           ReturnFromMain;
-  EFI_SHELL_PARAMETERS_PROTOCOL *EfiShellParametersProtocol;
-  EFI_SHELL_INTERFACE           *EfiShellInterface;
-  EFI_STATUS                    Status;
+  EFI_SHELL_PARAMETERS_PROTOCOL  *EfiShellParametersProtocol;
+  EFI_SHELL_INTERFACE            *EfiShellInterface;
+  EFI_STATUS                     Status;
 
 
-  ReturnFromMain = -1;
+  ReturnFromMain             = -1;
   EfiShellParametersProtocol = NULL;
   EfiShellParametersProtocol = NULL;
-  EfiShellInterface = NULL;
+  EfiShellInterface          = NULL;
 
 
-  Status = SystemTable->BootServices->OpenProtocol(ImageHandle,
-                             &gEfiShellParametersProtocolGuid,
-                             (VOID **)&EfiShellParametersProtocol,
-                             ImageHandle,
-                             NULL,
-                             EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                            );
-  if (!EFI_ERROR(Status)) {
+  Status = SystemTable->BootServices->OpenProtocol (
+                                        ImageHandle,
+                                        &gEfiShellParametersProtocolGuid,
+                                        (VOID **)&EfiShellParametersProtocol,
+                                        ImageHandle,
+                                        NULL,
+                                        EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                                        );
+  if (!EFI_ERROR (Status)) {
     //
     //
     // use shell 2.0 interface
     // use shell 2.0 interface
     //
     //
     ReturnFromMain = ShellAppMain (
     ReturnFromMain = ShellAppMain (
                        EfiShellParametersProtocol->Argc,
                        EfiShellParametersProtocol->Argc,
                        EfiShellParametersProtocol->Argv
                        EfiShellParametersProtocol->Argv
-                      );
+                       );
   } else {
   } else {
     //
     //
     // try to get shell 1.0 interface instead.
     // try to get shell 1.0 interface instead.
     //
     //
-    Status = SystemTable->BootServices->OpenProtocol(ImageHandle,
-                               &gEfiShellInterfaceGuid,
-                               (VOID **)&EfiShellInterface,
-                               ImageHandle,
-                               NULL,
-                               EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                              );
-    if (!EFI_ERROR(Status)) {
+    Status = SystemTable->BootServices->OpenProtocol (
+                                          ImageHandle,
+                                          &gEfiShellInterfaceGuid,
+                                          (VOID **)&EfiShellInterface,
+                                          ImageHandle,
+                                          NULL,
+                                          EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                                          );
+    if (!EFI_ERROR (Status)) {
       //
       //
       // use shell 1.0 interface
       // use shell 1.0 interface
       //
       //
       ReturnFromMain = ShellAppMain (
       ReturnFromMain = ShellAppMain (
                          EfiShellInterface->Argc,
                          EfiShellInterface->Argc,
                          EfiShellInterface->Argv
                          EfiShellInterface->Argv
-                        );
+                         );
     } else {
     } else {
-      ASSERT(FALSE);
+      ASSERT (FALSE);
     }
     }
   }
   }
+
   return ReturnFromMain;
   return ReturnFromMain;
 }
 }

File diff suppressed because it is too large
+ 245 - 218
ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c


File diff suppressed because it is too large
+ 297 - 251
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c


+ 14 - 15
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h

@@ -41,24 +41,24 @@
 #include <Library/UefiLib.h>
 #include <Library/UefiLib.h>
 #include <Library/OrderedCollectionLib.h>
 #include <Library/OrderedCollectionLib.h>
 
 
-typedef struct{
-  LIST_ENTRY                  Link;
-  CHAR16                      *CommandString;
-  SHELL_GET_MAN_FILENAME      GetManFileName;
-  SHELL_RUN_COMMAND           CommandHandler;
-  BOOLEAN                     LastError;
-  EFI_HII_HANDLE              HiiHandle;
-  EFI_STRING_ID               ManFormatHelp;
+typedef struct {
+  LIST_ENTRY                Link;
+  CHAR16                    *CommandString;
+  SHELL_GET_MAN_FILENAME    GetManFileName;
+  SHELL_RUN_COMMAND         CommandHandler;
+  BOOLEAN                   LastError;
+  EFI_HII_HANDLE            HiiHandle;
+  EFI_STRING_ID             ManFormatHelp;
 } SHELL_COMMAND_INTERNAL_LIST_ENTRY;
 } SHELL_COMMAND_INTERNAL_LIST_ENTRY;
 
 
 typedef struct {
 typedef struct {
-  LIST_ENTRY Link;
-  SCRIPT_FILE *Data;
+  LIST_ENTRY     Link;
+  SCRIPT_FILE    *Data;
 } SCRIPT_FILE_LIST;
 } SCRIPT_FILE_LIST;
 
 
 typedef struct {
 typedef struct {
-  EFI_FILE_PROTOCOL *FileHandle;
-  CHAR16            *Path;
+  EFI_FILE_PROTOCOL    *FileHandle;
+  CHAR16               *Path;
 } SHELL_COMMAND_FILE_HANDLE;
 } SHELL_COMMAND_FILE_HANDLE;
 
 
 //
 //
@@ -72,13 +72,12 @@ typedef struct {
   // instead, it *aliases* the FileName or FullName field of the
   // instead, it *aliases* the FileName or FullName field of the
   // EFI_SHELL_FILE_INFO object that was first encountered with this name.
   // EFI_SHELL_FILE_INFO object that was first encountered with this name.
   //
   //
-  CONST CHAR16 *Alias;
+  CONST CHAR16    *Alias;
   //
   //
   // A list of EFI_SHELL_FILE_INFO objects whose FileName or FullName fields
   // A list of EFI_SHELL_FILE_INFO objects whose FileName or FullName fields
   // compare equal to Alias, according to gUnicodeCollation->StriColl().
   // compare equal to Alias, according to gUnicodeCollation->StriColl().
   //
   //
-  LIST_ENTRY SameNameList;
+  LIST_ENTRY      SameNameList;
 } SHELL_SORT_UNIQUE_NAME;
 } SHELL_SORT_UNIQUE_NAME;
 
 
 #endif //_UEFI_COMMAND_LIB_INTERNAL_HEADER_
 #endif //_UEFI_COMMAND_LIB_INTERNAL_HEADER_
-

+ 147 - 126
ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c

@@ -9,11 +9,11 @@
 
 
 #include "UefiShellDebug1CommandsLib.h"
 #include "UefiShellDebug1CommandsLib.h"
 
 
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
-  {L"-n", TypeValue},
-  {L"-s", TypeValue},
-  {NULL,  TypeMax}
-  };
+STATIC CONST SHELL_PARAM_ITEM  ParamList[] = {
+  { L"-n", TypeValue },
+  { L"-s", TypeValue },
+  { NULL,  TypeMax   }
+};
 
 
 typedef enum {
 typedef enum {
   OutOfDiffPoint,
   OutOfDiffPoint,
@@ -25,10 +25,10 @@ typedef enum {
 // Buffer type, for reading both file operands in chunks.
 // Buffer type, for reading both file operands in chunks.
 //
 //
 typedef struct {
 typedef struct {
-  UINT8 *Data;     // dynamically allocated buffer
-  UINTN Allocated; // the allocated size of Data
-  UINTN Next;      // next position in Data to fetch a byte at
-  UINTN Left;      // number of bytes left in Data for fetching at Next
+  UINT8    *Data;     // dynamically allocated buffer
+  UINTN    Allocated; // the allocated size of Data
+  UINTN    Next;      // next position in Data to fetch a byte at
+  UINTN    Left;      // number of bytes left in Data for fetching at Next
 } FILE_BUFFER;
 } FILE_BUFFER;
 
 
 /**
 /**
@@ -43,7 +43,7 @@ typedef struct {
 
 
 **/
 **/
 VOID
 VOID
-PrintDifferentPoint(
+PrintDifferentPoint (
   CONST CHAR16  *FileName,
   CONST CHAR16  *FileName,
   CHAR16        *FileTag,
   CHAR16        *FileTag,
   UINT8         *Buffer,
   UINT8         *Buffer,
@@ -52,7 +52,7 @@ PrintDifferentPoint(
   UINT64        DifferentBytes
   UINT64        DifferentBytes
   )
   )
 {
 {
-  UINTN Index;
+  UINTN  Index;
 
 
   ShellPrintEx (-1, -1, L"%s: %s\r\n  %08x:", FileTag, FileName, Address);
   ShellPrintEx (-1, -1, L"%s: %s\r\n  %08x:", FileTag, FileName, Address);
 
 
@@ -73,7 +73,7 @@ PrintDifferentPoint(
   // Print data in char-format.
   // Print data in char-format.
   //
   //
   for (Index = 0; Index < BufferSize; Index++) {
   for (Index = 0; Index < BufferSize; Index++) {
-    if (Buffer[Index] >= 0x20 && Buffer[Index] <= 0x7E) {
+    if ((Buffer[Index] >= 0x20) && (Buffer[Index] <= 0x7E)) {
       ShellPrintEx (-1, -1, L"%c", Buffer[Index]);
       ShellPrintEx (-1, -1, L"%c", Buffer[Index]);
     } else {
     } else {
       //
       //
@@ -97,7 +97,7 @@ PrintDifferentPoint(
 STATIC
 STATIC
 VOID
 VOID
 FileBufferInit (
 FileBufferInit (
-  OUT FILE_BUFFER *FileBuffer
+  OUT FILE_BUFFER  *FileBuffer
   )
   )
 {
 {
   FileBuffer->Allocated = PcdGet32 (PcdShellFileOperationSize);
   FileBuffer->Allocated = PcdGet32 (PcdShellFileOperationSize);
@@ -116,7 +116,7 @@ FileBufferInit (
 STATIC
 STATIC
 VOID
 VOID
 FileBufferUninit (
 FileBufferUninit (
-  IN OUT FILE_BUFFER *FileBuffer
+  IN OUT FILE_BUFFER  *FileBuffer
   )
   )
 {
 {
   SHELL_FREE_NON_NULL (FileBuffer->Data);
   SHELL_FREE_NON_NULL (FileBuffer->Data);
@@ -154,26 +154,31 @@ FileBufferUninit (
 STATIC
 STATIC
 EFI_STATUS
 EFI_STATUS
 FileBufferReadByte (
 FileBufferReadByte (
-  IN     SHELL_FILE_HANDLE FileHandle,
-  IN OUT FILE_BUFFER       *FileBuffer,
-     OUT UINTN             *BytesRead,
-     OUT UINT8             *Byte
+  IN     SHELL_FILE_HANDLE  FileHandle,
+  IN OUT FILE_BUFFER        *FileBuffer,
+  OUT UINTN                 *BytesRead,
+  OUT UINT8                 *Byte
   )
   )
 {
 {
-  UINTN      ReadSize;
-  EFI_STATUS Status;
+  UINTN       ReadSize;
+  EFI_STATUS  Status;
 
 
   if (FileBuffer->Left == 0) {
   if (FileBuffer->Left == 0) {
     ReadSize = FileBuffer->Allocated;
     ReadSize = FileBuffer->Allocated;
-    Status = gEfiShellProtocol->ReadFile (FileHandle, &ReadSize,
-                                  FileBuffer->Data);
+    Status   = gEfiShellProtocol->ReadFile (
+                                    FileHandle,
+                                    &ReadSize,
+                                    FileBuffer->Data
+                                    );
     if (EFI_ERROR (Status)) {
     if (EFI_ERROR (Status)) {
       return Status;
       return Status;
     }
     }
+
     if (ReadSize == 0) {
     if (ReadSize == 0) {
       *BytesRead = 0;
       *BytesRead = 0;
       return EFI_SUCCESS;
       return EFI_SUCCESS;
     }
     }
+
     FileBuffer->Next = 0;
     FileBuffer->Next = 0;
     FileBuffer->Left = ReadSize;
     FileBuffer->Left = ReadSize;
   }
   }
@@ -199,112 +204,114 @@ ShellCommandRunComp (
   IN EFI_SYSTEM_TABLE  *SystemTable
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS          Status;
-  LIST_ENTRY          *Package;
-  CHAR16              *ProblemParam;
-  CHAR16              *FileName1;
-  CHAR16              *FileName2;
-  CONST CHAR16        *TempParam;
-  SHELL_STATUS        ShellStatus;
-  SHELL_FILE_HANDLE   FileHandle1;
-  SHELL_FILE_HANDLE   FileHandle2;
-  UINT64              Size1;
-  UINT64              Size2;
-  UINT64              DifferentBytes;
-  UINT64              DifferentCount;
-  UINT8               DiffPointNumber;
-  UINT8               OneByteFromFile1;
-  UINT8               OneByteFromFile2;
-  UINT8               *DataFromFile1;
-  UINT8               *DataFromFile2;
-  FILE_BUFFER         FileBuffer1;
-  FILE_BUFFER         FileBuffer2;
-  UINTN               InsertPosition1;
-  UINTN               InsertPosition2;
-  UINTN               DataSizeFromFile1;
-  UINTN               DataSizeFromFile2;
-  UINTN               TempAddress;
-  UINTN               Index;
-  UINTN               DiffPointAddress;
-  READ_STATUS         ReadStatus;
-
-  ShellStatus         = SHELL_SUCCESS;
-  Status              = EFI_SUCCESS;
-  FileName1           = NULL;
-  FileName2           = NULL;
-  FileHandle1         = NULL;
-  FileHandle2         = NULL;
-  DataFromFile1       = NULL;
-  DataFromFile2       = NULL;
-  ReadStatus          = OutOfDiffPoint;
-  DifferentCount      = 10;
-  DifferentBytes      = 4;
-  DiffPointNumber     = 0;
-  InsertPosition1     = 0;
-  InsertPosition2     = 0;
-  TempAddress         = 0;
-  DiffPointAddress    = 0;
+  EFI_STATUS         Status;
+  LIST_ENTRY         *Package;
+  CHAR16             *ProblemParam;
+  CHAR16             *FileName1;
+  CHAR16             *FileName2;
+  CONST CHAR16       *TempParam;
+  SHELL_STATUS       ShellStatus;
+  SHELL_FILE_HANDLE  FileHandle1;
+  SHELL_FILE_HANDLE  FileHandle2;
+  UINT64             Size1;
+  UINT64             Size2;
+  UINT64             DifferentBytes;
+  UINT64             DifferentCount;
+  UINT8              DiffPointNumber;
+  UINT8              OneByteFromFile1;
+  UINT8              OneByteFromFile2;
+  UINT8              *DataFromFile1;
+  UINT8              *DataFromFile2;
+  FILE_BUFFER        FileBuffer1;
+  FILE_BUFFER        FileBuffer2;
+  UINTN              InsertPosition1;
+  UINTN              InsertPosition2;
+  UINTN              DataSizeFromFile1;
+  UINTN              DataSizeFromFile2;
+  UINTN              TempAddress;
+  UINTN              Index;
+  UINTN              DiffPointAddress;
+  READ_STATUS        ReadStatus;
+
+  ShellStatus      = SHELL_SUCCESS;
+  Status           = EFI_SUCCESS;
+  FileName1        = NULL;
+  FileName2        = NULL;
+  FileHandle1      = NULL;
+  FileHandle2      = NULL;
+  DataFromFile1    = NULL;
+  DataFromFile2    = NULL;
+  ReadStatus       = OutOfDiffPoint;
+  DifferentCount   = 10;
+  DifferentBytes   = 4;
+  DiffPointNumber  = 0;
+  InsertPosition1  = 0;
+  InsertPosition2  = 0;
+  TempAddress      = 0;
+  DiffPointAddress = 0;
 
 
   //
   //
   // initialize the shell lib (we must be in non-auto-init...)
   // initialize the shell lib (we must be in non-auto-init...)
   //
   //
-  Status = ShellInitialize();
-  ASSERT_EFI_ERROR(Status);
+  Status = ShellInitialize ();
+  ASSERT_EFI_ERROR (Status);
 
 
-  Status = CommandInit();
-  ASSERT_EFI_ERROR(Status);
+  Status = CommandInit ();
+  ASSERT_EFI_ERROR (Status);
 
 
   //
   //
   // parse the command line
   // parse the command line
   //
   //
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
-  if (EFI_ERROR(Status)) {
-    if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"comp", ProblemParam);
-      FreePool(ProblemParam);
+  if (EFI_ERROR (Status)) {
+    if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"comp", ProblemParam);
+      FreePool (ProblemParam);
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
-      ASSERT(FALSE);
+      ASSERT (FALSE);
     }
     }
   } else {
   } else {
-    if (ShellCommandLineGetCount(Package) > 3) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"comp");
+    if (ShellCommandLineGetCount (Package) > 3) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"comp");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
-    } else if (ShellCommandLineGetCount(Package) < 3) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"comp");
+    } else if (ShellCommandLineGetCount (Package) < 3) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"comp");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
-      TempParam = ShellCommandLineGetRawValue(Package, 1);
-      ASSERT(TempParam != NULL);
-      FileName1 = ShellFindFilePath(TempParam);
+      TempParam = ShellCommandLineGetRawValue (Package, 1);
+      ASSERT (TempParam != NULL);
+      FileName1 = ShellFindFilePath (TempParam);
       if (FileName1 == NULL) {
       if (FileName1 == NULL) {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
+        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
         ShellStatus = SHELL_NOT_FOUND;
         ShellStatus = SHELL_NOT_FOUND;
       } else {
       } else {
-        Status = ShellOpenFileByName(FileName1, &FileHandle1, EFI_FILE_MODE_READ, 0);
-        if (EFI_ERROR(Status)) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
+        Status = ShellOpenFileByName (FileName1, &FileHandle1, EFI_FILE_MODE_READ, 0);
+        if (EFI_ERROR (Status)) {
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
           ShellStatus = SHELL_NOT_FOUND;
           ShellStatus = SHELL_NOT_FOUND;
         }
         }
       }
       }
-      TempParam = ShellCommandLineGetRawValue(Package, 2);
-      ASSERT(TempParam != NULL);
-      FileName2 = ShellFindFilePath(TempParam);
+
+      TempParam = ShellCommandLineGetRawValue (Package, 2);
+      ASSERT (TempParam != NULL);
+      FileName2 = ShellFindFilePath (TempParam);
       if (FileName2 == NULL) {
       if (FileName2 == NULL) {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
+        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
         ShellStatus = SHELL_NOT_FOUND;
         ShellStatus = SHELL_NOT_FOUND;
       } else {
       } else {
-        Status = ShellOpenFileByName(FileName2, &FileHandle2, EFI_FILE_MODE_READ, 0);
-        if (EFI_ERROR(Status)) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
+        Status = ShellOpenFileByName (FileName2, &FileHandle2, EFI_FILE_MODE_READ, 0);
+        if (EFI_ERROR (Status)) {
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
           ShellStatus = SHELL_NOT_FOUND;
           ShellStatus = SHELL_NOT_FOUND;
         }
         }
       }
       }
+
       if (ShellStatus == SHELL_SUCCESS) {
       if (ShellStatus == SHELL_SUCCESS) {
-        Status = gEfiShellProtocol->GetFileSize(FileHandle1, &Size1);
-        ASSERT_EFI_ERROR(Status);
-        Status = gEfiShellProtocol->GetFileSize(FileHandle2, &Size2);
-        ASSERT_EFI_ERROR(Status);
+        Status = gEfiShellProtocol->GetFileSize (FileHandle1, &Size1);
+        ASSERT_EFI_ERROR (Status);
+        Status = gEfiShellProtocol->GetFileSize (FileHandle2, &Size2);
+        ASSERT_EFI_ERROR (Status);
 
 
         if (ShellCommandLineGetFlag (Package, L"-n")) {
         if (ShellCommandLineGetFlag (Package, L"-n")) {
           TempParam = ShellCommandLineGetValue (Package, L"-n");
           TempParam = ShellCommandLineGetValue (Package, L"-n");
@@ -316,7 +323,7 @@ ShellCommandRunComp (
               DifferentCount = MAX_UINTN;
               DifferentCount = MAX_UINTN;
             } else {
             } else {
               Status = ShellConvertStringToUint64 (TempParam, &DifferentCount, FALSE, TRUE);
               Status = ShellConvertStringToUint64 (TempParam, &DifferentCount, FALSE, TRUE);
-              if (EFI_ERROR(Status) || DifferentCount == 0) {
+              if (EFI_ERROR (Status) || (DifferentCount == 0)) {
                 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-n");
                 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-n");
                 ShellStatus = SHELL_INVALID_PARAMETER;
                 ShellStatus = SHELL_INVALID_PARAMETER;
               }
               }
@@ -331,7 +338,7 @@ ShellCommandRunComp (
             ShellStatus = SHELL_INVALID_PARAMETER;
             ShellStatus = SHELL_INVALID_PARAMETER;
           } else {
           } else {
             Status = ShellConvertStringToUint64 (TempParam, &DifferentBytes, FALSE, TRUE);
             Status = ShellConvertStringToUint64 (TempParam, &DifferentBytes, FALSE, TRUE);
-            if (EFI_ERROR(Status) || DifferentBytes == 0) {
+            if (EFI_ERROR (Status) || (DifferentBytes == 0)) {
               ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-s");
               ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-s");
               ShellStatus = SHELL_INVALID_PARAMETER;
               ShellStatus = SHELL_INVALID_PARAMETER;
             } else {
             } else {
@@ -348,8 +355,9 @@ ShellCommandRunComp (
         DataFromFile2 = AllocateZeroPool ((UINTN)DifferentBytes);
         DataFromFile2 = AllocateZeroPool ((UINTN)DifferentBytes);
         FileBufferInit (&FileBuffer1);
         FileBufferInit (&FileBuffer1);
         FileBufferInit (&FileBuffer2);
         FileBufferInit (&FileBuffer2);
-        if (DataFromFile1 == NULL || DataFromFile2 == NULL ||
-            FileBuffer1.Data == NULL || FileBuffer2.Data == NULL) {
+        if ((DataFromFile1 == NULL) || (DataFromFile2 == NULL) ||
+            (FileBuffer1.Data == NULL) || (FileBuffer2.Data == NULL))
+        {
           ShellStatus = SHELL_OUT_OF_RESOURCES;
           ShellStatus = SHELL_OUT_OF_RESOURCES;
           SHELL_FREE_NON_NULL (DataFromFile1);
           SHELL_FREE_NON_NULL (DataFromFile1);
           SHELL_FREE_NON_NULL (DataFromFile2);
           SHELL_FREE_NON_NULL (DataFromFile2);
@@ -362,13 +370,21 @@ ShellCommandRunComp (
         while (DiffPointNumber < DifferentCount) {
         while (DiffPointNumber < DifferentCount) {
           DataSizeFromFile1 = 1;
           DataSizeFromFile1 = 1;
           DataSizeFromFile2 = 1;
           DataSizeFromFile2 = 1;
-          OneByteFromFile1 = 0;
-          OneByteFromFile2 = 0;
-          Status = FileBufferReadByte (FileHandle1, &FileBuffer1,
-                     &DataSizeFromFile1, &OneByteFromFile1);
+          OneByteFromFile1  = 0;
+          OneByteFromFile2  = 0;
+          Status            = FileBufferReadByte (
+                                FileHandle1,
+                                &FileBuffer1,
+                                &DataSizeFromFile1,
+                                &OneByteFromFile1
+                                );
           ASSERT_EFI_ERROR (Status);
           ASSERT_EFI_ERROR (Status);
-          Status = FileBufferReadByte (FileHandle2, &FileBuffer2,
-                     &DataSizeFromFile2, &OneByteFromFile2);
+          Status = FileBufferReadByte (
+                     FileHandle2,
+                     &FileBuffer2,
+                     &DataSizeFromFile2,
+                     &OneByteFromFile2
+                     );
           ASSERT_EFI_ERROR (Status);
           ASSERT_EFI_ERROR (Status);
 
 
           TempAddress++;
           TempAddress++;
@@ -378,19 +394,21 @@ ShellCommandRunComp (
           // 2.If no more char in File1 or File2, The ReadStatus is InPrevDiffPoint forever.
           // 2.If no more char in File1 or File2, The ReadStatus is InPrevDiffPoint forever.
           //   So the previous different point is the last one, then break the while block.
           //   So the previous different point is the last one, then break the while block.
           //
           //
-          if ( (DataSizeFromFile1 == 0 && InsertPosition1 == 0 && DataSizeFromFile2 == 0 && InsertPosition2 == 0) ||
-               (ReadStatus == InPrevDiffPoint && (DataSizeFromFile1 == 0 || DataSizeFromFile2 == 0))
-             ) {
+          if (((DataSizeFromFile1 == 0) && (InsertPosition1 == 0) && (DataSizeFromFile2 == 0) && (InsertPosition2 == 0)) ||
+              ((ReadStatus == InPrevDiffPoint) && ((DataSizeFromFile1 == 0) || (DataSizeFromFile2 == 0)))
+              )
+          {
             break;
             break;
           }
           }
 
 
           if (ReadStatus == OutOfDiffPoint) {
           if (ReadStatus == OutOfDiffPoint) {
             if (OneByteFromFile1 != OneByteFromFile2) {
             if (OneByteFromFile1 != OneByteFromFile2) {
-              ReadStatus = InDiffPoint;
+              ReadStatus       = InDiffPoint;
               DiffPointAddress = TempAddress;
               DiffPointAddress = TempAddress;
               if (DataSizeFromFile1 == 1) {
               if (DataSizeFromFile1 == 1) {
                 DataFromFile1[InsertPosition1++] = OneByteFromFile1;
                 DataFromFile1[InsertPosition1++] = OneByteFromFile1;
               }
               }
+
               if (DataSizeFromFile2 == 1) {
               if (DataSizeFromFile2 == 1) {
                 DataFromFile2[InsertPosition2++] = OneByteFromFile2;
                 DataFromFile2[InsertPosition2++] = OneByteFromFile2;
               }
               }
@@ -399,6 +417,7 @@ ShellCommandRunComp (
             if (DataSizeFromFile1 == 1) {
             if (DataSizeFromFile1 == 1) {
               DataFromFile1[InsertPosition1++] = OneByteFromFile1;
               DataFromFile1[InsertPosition1++] = OneByteFromFile1;
             }
             }
+
             if (DataSizeFromFile2 == 1) {
             if (DataSizeFromFile2 == 1) {
               DataFromFile2[InsertPosition2++] = OneByteFromFile2;
               DataFromFile2[InsertPosition2++] = OneByteFromFile2;
             }
             }
@@ -411,11 +430,11 @@ ShellCommandRunComp (
           //
           //
           // ReadStatus should be always equal InDiffPoint.
           // ReadStatus should be always equal InDiffPoint.
           //
           //
-          if ( InsertPosition1 == DifferentBytes ||
-               InsertPosition2 == DifferentBytes ||
-               (DataSizeFromFile1 == 0 && DataSizeFromFile2 == 0)
-             ) {
-
+          if ((InsertPosition1 == DifferentBytes) ||
+              (InsertPosition2 == DifferentBytes) ||
+              ((DataSizeFromFile1 == 0) && (DataSizeFromFile2 == 0))
+              )
+          {
             ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_DIFFERENCE_POINT), gShellDebug1HiiHandle, ++DiffPointNumber);
             ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_DIFFERENCE_POINT), gShellDebug1HiiHandle, ++DiffPointNumber);
             PrintDifferentPoint (FileName1, L"File1", DataFromFile1, InsertPosition1, DiffPointAddress, DifferentBytes);
             PrintDifferentPoint (FileName1, L"File1", DataFromFile1, InsertPosition1, DiffPointAddress, DifferentBytes);
             PrintDifferentPoint (FileName2, L"File2", DataFromFile2, InsertPosition2, DiffPointAddress, DifferentBytes);
             PrintDifferentPoint (FileName2, L"File2", DataFromFile2, InsertPosition2, DiffPointAddress, DifferentBytes);
@@ -423,7 +442,7 @@ ShellCommandRunComp (
             //
             //
             // One of two buffuers is empty, it means this is the last different point.
             // One of two buffuers is empty, it means this is the last different point.
             //
             //
-            if (InsertPosition1 == 0 || InsertPosition2 == 0) {
+            if ((InsertPosition1 == 0) || (InsertPosition2 == 0)) {
               break;
               break;
             }
             }
 
 
@@ -438,9 +457,9 @@ ShellCommandRunComp (
               //
               //
               // Try to find a new different point in the rest of DataFromFile.
               // Try to find a new different point in the rest of DataFromFile.
               //
               //
-              for (; Index < MAX (InsertPosition1,InsertPosition2); Index++) {
+              for ( ; Index < MAX (InsertPosition1, InsertPosition2); Index++) {
                 if (DataFromFile1[Index] != DataFromFile2[Index]) {
                 if (DataFromFile1[Index] != DataFromFile2[Index]) {
-                  ReadStatus = InDiffPoint;
+                  ReadStatus        = InDiffPoint;
                   DiffPointAddress += Index;
                   DiffPointAddress += Index;
                   break;
                   break;
                 }
                 }
@@ -469,24 +488,26 @@ ShellCommandRunComp (
         FileBufferUninit (&FileBuffer2);
         FileBufferUninit (&FileBuffer2);
 
 
         if (DiffPointNumber == 0) {
         if (DiffPointNumber == 0) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_PASS), gShellDebug1HiiHandle);
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_PASS), gShellDebug1HiiHandle);
         } else {
         } else {
           ShellStatus = SHELL_NOT_EQUAL;
           ShellStatus = SHELL_NOT_EQUAL;
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_FAIL), gShellDebug1HiiHandle);
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_FAIL), gShellDebug1HiiHandle);
         }
         }
       }
       }
     }
     }
 
 
     ShellCommandLineFreeVarList (Package);
     ShellCommandLineFreeVarList (Package);
   }
   }
-  SHELL_FREE_NON_NULL(FileName1);
-  SHELL_FREE_NON_NULL(FileName2);
+
+  SHELL_FREE_NON_NULL (FileName1);
+  SHELL_FREE_NON_NULL (FileName2);
 
 
   if (FileHandle1 != NULL) {
   if (FileHandle1 != NULL) {
-    gEfiShellProtocol->CloseFile(FileHandle1);
+    gEfiShellProtocol->CloseFile (FileHandle1);
   }
   }
+
   if (FileHandle2 != NULL) {
   if (FileHandle2 != NULL) {
-    gEfiShellProtocol->CloseFile(FileHandle2);
+    gEfiShellProtocol->CloseFile (FileHandle2);
   }
   }
 
 
   return (ShellStatus);
   return (ShellStatus);

File diff suppressed because it is too large
+ 261 - 252
ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c


+ 0 - 1
ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h

@@ -30,4 +30,3 @@ Compress (
   );
   );
 
 
 #endif
 #endif
-

+ 59 - 56
ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c

@@ -20,49 +20,49 @@
   @retval SHELL_SUCCESS   The display was successful.
   @retval SHELL_SUCCESS   The display was successful.
 **/
 **/
 SHELL_STATUS
 SHELL_STATUS
-DisplayTheBlocks(
-  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath,
-  IN CONST UINT64                   Lba,
-  IN CONST UINT8                    BlockCount
+DisplayTheBlocks (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevPath,
+  IN CONST UINT64                    Lba,
+  IN CONST UINT8                     BlockCount
   )
   )
 {
 {
-  EFI_BLOCK_IO_PROTOCOL     *BlockIo;
-  EFI_HANDLE                BlockIoHandle;
-  EFI_STATUS                Status;
-  SHELL_STATUS              ShellStatus;
-  UINT8                     *Buffer;
-  UINT8                     *OriginalBuffer;
-  UINTN                     BufferSize;
+  EFI_BLOCK_IO_PROTOCOL  *BlockIo;
+  EFI_HANDLE             BlockIoHandle;
+  EFI_STATUS             Status;
+  SHELL_STATUS           ShellStatus;
+  UINT8                  *Buffer;
+  UINT8                  *OriginalBuffer;
+  UINTN                  BufferSize;
 
 
   ShellStatus = SHELL_SUCCESS;
   ShellStatus = SHELL_SUCCESS;
 
 
-  Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, (EFI_DEVICE_PATH_PROTOCOL **)&DevPath, &BlockIoHandle);
-  if (EFI_ERROR(Status)) {
+  Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, (EFI_DEVICE_PATH_PROTOCOL **)&DevPath, &BlockIoHandle);
+  if (EFI_ERROR (Status)) {
     return (SHELL_NOT_FOUND);
     return (SHELL_NOT_FOUND);
   }
   }
 
 
-  Status = gBS->OpenProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, (VOID**)&BlockIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-  if (EFI_ERROR(Status)) {
+  Status = gBS->OpenProtocol (BlockIoHandle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+  if (EFI_ERROR (Status)) {
     return (SHELL_NOT_FOUND);
     return (SHELL_NOT_FOUND);
   }
   }
 
 
   BufferSize = BlockIo->Media->BlockSize * BlockCount;
   BufferSize = BlockIo->Media->BlockSize * BlockCount;
-  if(BlockIo->Media->IoAlign == 0) {
+  if (BlockIo->Media->IoAlign == 0) {
     BlockIo->Media->IoAlign = 1;
     BlockIo->Media->IoAlign = 1;
   }
   }
 
 
   if (BufferSize > 0) {
   if (BufferSize > 0) {
-    OriginalBuffer = AllocateZeroPool(BufferSize + BlockIo->Media->IoAlign);
-    Buffer         = ALIGN_POINTER (OriginalBuffer,BlockIo->Media->IoAlign);
+    OriginalBuffer = AllocateZeroPool (BufferSize + BlockIo->Media->IoAlign);
+    Buffer         = ALIGN_POINTER (OriginalBuffer, BlockIo->Media->IoAlign);
   } else {
   } else {
-    ShellPrintEx(-1,-1,L"  BlockSize: 0x%08x, BlockCount: 0x%08x\r\n", BlockIo->Media->BlockSize, BlockCount);
+    ShellPrintEx (-1, -1, L"  BlockSize: 0x%08x, BlockCount: 0x%08x\r\n", BlockIo->Media->BlockSize, BlockCount);
     OriginalBuffer = NULL;
     OriginalBuffer = NULL;
     Buffer         = NULL;
     Buffer         = NULL;
   }
   }
 
 
-  Status = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);
-  if (!EFI_ERROR(Status) && Buffer != NULL) {
-    ShellPrintHiiEx(
+  Status = BlockIo->ReadBlocks (BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);
+  if (!EFI_ERROR (Status) && (Buffer != NULL)) {
+    ShellPrintHiiEx (
       -1,
       -1,
       -1,
       -1,
       NULL,
       NULL,
@@ -73,9 +73,9 @@ DisplayTheBlocks(
       BlockIo
       BlockIo
       );
       );
 
 
-    DumpHex(2,0,BufferSize,Buffer);
+    DumpHex (2, 0, BufferSize, Buffer);
   } else {
   } else {
-    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"dblk", L"BlockIo");
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"dblk", L"BlockIo");
     ShellStatus = SHELL_DEVICE_ERROR;
     ShellStatus = SHELL_DEVICE_ERROR;
   }
   }
 
 
@@ -83,7 +83,7 @@ DisplayTheBlocks(
     FreePool (OriginalBuffer);
     FreePool (OriginalBuffer);
   }
   }
 
 
-  gBS->CloseProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, gImageHandle, NULL);
+  gBS->CloseProtocol (BlockIoHandle, &gEfiBlockIoProtocolGuid, gImageHandle, NULL);
   return (ShellStatus);
   return (ShellStatus);
 }
 }
 
 
@@ -111,67 +111,69 @@ ShellCommandRunDblk (
   UINT64                    BlockCount;
   UINT64                    BlockCount;
   EFI_DEVICE_PATH_PROTOCOL  *DevPath;
   EFI_DEVICE_PATH_PROTOCOL  *DevPath;
 
 
-  ShellStatus         = SHELL_SUCCESS;
-  Status              = EFI_SUCCESS;
+  ShellStatus = SHELL_SUCCESS;
+  Status      = EFI_SUCCESS;
 
 
   //
   //
   // initialize the shell lib (we must be in non-auto-init...)
   // initialize the shell lib (we must be in non-auto-init...)
   //
   //
-  Status = ShellInitialize();
-  ASSERT_EFI_ERROR(Status);
+  Status = ShellInitialize ();
+  ASSERT_EFI_ERROR (Status);
 
 
-  Status = CommandInit();
-  ASSERT_EFI_ERROR(Status);
+  Status = CommandInit ();
+  ASSERT_EFI_ERROR (Status);
 
 
   //
   //
   // parse the command line
   // parse the command line
   //
   //
   Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
   Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
-  if (EFI_ERROR(Status)) {
-    if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dblk", ProblemParam);
-      FreePool(ProblemParam);
+  if (EFI_ERROR (Status)) {
+    if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dblk", ProblemParam);
+      FreePool (ProblemParam);
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
-      ASSERT(FALSE);
+      ASSERT (FALSE);
     }
     }
   } else {
   } else {
-    if (ShellCommandLineGetCount(Package) > 4) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dblk");
+    if (ShellCommandLineGetCount (Package) > 4) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dblk");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
-    } else if (ShellCommandLineGetCount(Package) < 2) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"dblk");
+    } else if (ShellCommandLineGetCount (Package) < 2) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"dblk");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
       //
       //
       // Parse the params
       // Parse the params
       //
       //
-      BlockName         = ShellCommandLineGetRawValue(Package, 1);
-      LbaString         = ShellCommandLineGetRawValue(Package, 2);
-      BlockCountString  = ShellCommandLineGetRawValue(Package, 3);
+      BlockName        = ShellCommandLineGetRawValue (Package, 1);
+      LbaString        = ShellCommandLineGetRawValue (Package, 2);
+      BlockCountString = ShellCommandLineGetRawValue (Package, 3);
 
 
       if (LbaString == NULL) {
       if (LbaString == NULL) {
         Lba = 0;
         Lba = 0;
       } else {
       } else {
-        if (!ShellIsHexOrDecimalNumber(LbaString, TRUE, FALSE)) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", LbaString);
+        if (!ShellIsHexOrDecimalNumber (LbaString, TRUE, FALSE)) {
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", LbaString);
           ShellStatus = SHELL_INVALID_PARAMETER;
           ShellStatus = SHELL_INVALID_PARAMETER;
         }
         }
-        ShellConvertStringToUint64(LbaString, &Lba, TRUE, FALSE);
+
+        ShellConvertStringToUint64 (LbaString, &Lba, TRUE, FALSE);
       }
       }
 
 
       if (BlockCountString == NULL) {
       if (BlockCountString == NULL) {
         BlockCount = 1;
         BlockCount = 1;
       } else {
       } else {
-        if (!ShellIsHexOrDecimalNumber(BlockCountString, TRUE, FALSE)) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString);
+        if (!ShellIsHexOrDecimalNumber (BlockCountString, TRUE, FALSE)) {
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString);
           ShellStatus = SHELL_INVALID_PARAMETER;
           ShellStatus = SHELL_INVALID_PARAMETER;
         }
         }
-        ShellConvertStringToUint64(BlockCountString, &BlockCount, TRUE, FALSE);
+
+        ShellConvertStringToUint64 (BlockCountString, &BlockCount, TRUE, FALSE);
         if (BlockCount > 0x10) {
         if (BlockCount > 0x10) {
           BlockCount = 0x10;
           BlockCount = 0x10;
         } else if (BlockCount == 0) {
         } else if (BlockCount == 0) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString);
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString);
           ShellStatus = SHELL_INVALID_PARAMETER;
           ShellStatus = SHELL_INVALID_PARAMETER;
         }
         }
       }
       }
@@ -180,16 +182,16 @@ ShellCommandRunDblk (
         //
         //
         // do the work if we have a valid block identifier
         // do the work if we have a valid block identifier
         //
         //
-        if (gEfiShellProtocol->GetDevicePathFromMap(BlockName) == NULL) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockName);
+        if (gEfiShellProtocol->GetDevicePathFromMap (BlockName) == NULL) {
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockName);
           ShellStatus = SHELL_INVALID_PARAMETER;
           ShellStatus = SHELL_INVALID_PARAMETER;
         } else {
         } else {
-          DevPath = (EFI_DEVICE_PATH_PROTOCOL*)gEfiShellProtocol->GetDevicePathFromMap(BlockName);
-          if (gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &DevPath, NULL) == EFI_NOT_FOUND) {
-            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MAP_PROTOCOL), gShellDebug1HiiHandle, L"dblk", BlockName, L"BlockIo");
+          DevPath = (EFI_DEVICE_PATH_PROTOCOL *)gEfiShellProtocol->GetDevicePathFromMap (BlockName);
+          if (gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DevPath, NULL) == EFI_NOT_FOUND) {
+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_MAP_PROTOCOL), gShellDebug1HiiHandle, L"dblk", BlockName, L"BlockIo");
             ShellStatus = SHELL_INVALID_PARAMETER;
             ShellStatus = SHELL_INVALID_PARAMETER;
           } else {
           } else {
-            ShellStatus = DisplayTheBlocks(gEfiShellProtocol->GetDevicePathFromMap(BlockName), Lba, (UINT8)BlockCount);
+            ShellStatus = DisplayTheBlocks (gEfiShellProtocol->GetDevicePathFromMap (BlockName), Lba, (UINT8)BlockCount);
           }
           }
         }
         }
       }
       }
@@ -197,5 +199,6 @@ ShellCommandRunDblk (
 
 
     ShellCommandLineFreeVarList (Package);
     ShellCommandLineFreeVarList (Package);
   }
   }
+
   return (ShellStatus);
   return (ShellStatus);
 }
 }

+ 86 - 75
ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c

@@ -24,13 +24,14 @@
   @return A printable character representing Char.
   @return A printable character representing Char.
 **/
 **/
 CHAR16
 CHAR16
-MakePrintable(
-  IN CONST CHAR16 Char
+MakePrintable (
+  IN CONST CHAR16  Char
   )
   )
 {
 {
-  if ((Char < 0x20 && Char > 0)||(Char > 126)) {
+  if (((Char < 0x20) && (Char > 0)) || (Char > 126)) {
     return (L'?');
     return (L'?');
   }
   }
+
   return (Char);
   return (Char);
 }
 }
 
 
@@ -41,45 +42,46 @@ MakePrintable(
   @param[in] Size       The length of memory to display.
   @param[in] Size       The length of memory to display.
 **/
 **/
 SHELL_STATUS
 SHELL_STATUS
-DisplayMmioMemory(
+DisplayMmioMemory (
   IN CONST VOID   *Address,
   IN CONST VOID   *Address,
   IN CONST UINTN  Size
   IN CONST UINTN  Size
   )
   )
 {
 {
-  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRbIo;
-  EFI_STATUS                      Status;
-  VOID                            *Buffer;
-  SHELL_STATUS                    ShellStatus;
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  *PciRbIo;
+  EFI_STATUS                       Status;
+  VOID                             *Buffer;
+  SHELL_STATUS                     ShellStatus;
 
 
   ShellStatus = SHELL_SUCCESS;
   ShellStatus = SHELL_SUCCESS;
 
 
-  Status = gBS->LocateProtocol(&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID**)&PciRbIo);
-  if (EFI_ERROR(Status)) {
-    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"dmem");
+  Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID **)&PciRbIo);
+  if (EFI_ERROR (Status)) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"dmem");
     return (SHELL_NOT_FOUND);
     return (SHELL_NOT_FOUND);
   }
   }
-  Buffer = AllocateZeroPool(Size);
+
+  Buffer = AllocateZeroPool (Size);
   if (Buffer == NULL) {
   if (Buffer == NULL) {
     return SHELL_OUT_OF_RESOURCES;
     return SHELL_OUT_OF_RESOURCES;
   }
   }
 
 
-  Status = PciRbIo->Mem.Read(PciRbIo, EfiPciWidthUint8, (UINT64)(UINTN)Address, Size, Buffer);
-  if (EFI_ERROR(Status)) {
-    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_ER), gShellDebug1HiiHandle, L"dmem");
+  Status = PciRbIo->Mem.Read (PciRbIo, EfiPciWidthUint8, (UINT64)(UINTN)Address, Size, Buffer);
+  if (EFI_ERROR (Status)) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_ER), gShellDebug1HiiHandle, L"dmem");
     ShellStatus = SHELL_NOT_FOUND;
     ShellStatus = SHELL_NOT_FOUND;
   } else {
   } else {
-    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_MMIO_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
-    DumpHex(2, (UINTN)Address, Size, Buffer);
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_MMIO_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
+    DumpHex (2, (UINTN)Address, Size, Buffer);
   }
   }
 
 
-  FreePool(Buffer);
+  FreePool (Buffer);
   return (ShellStatus);
   return (ShellStatus);
 }
 }
 
 
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
-  {L"-mmio", TypeFlag},
-  {NULL, TypeMax}
-  };
+STATIC CONST SHELL_PARAM_ITEM  ParamList[] = {
+  { L"-mmio", TypeFlag },
+  { NULL,     TypeMax  }
+};
 
 
 /**
 /**
   Function for 'dmem' command.
   Function for 'dmem' command.
@@ -94,66 +96,67 @@ ShellCommandRunDmem (
   IN EFI_SYSTEM_TABLE  *SystemTable
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS          Status;
-  LIST_ENTRY          *Package;
-  CHAR16              *ProblemParam;
-  SHELL_STATUS        ShellStatus;
-  VOID                *Address;
-  UINT64              Size;
-  CONST CHAR16        *Temp1;
-  UINT64              AcpiTableAddress;
-  UINT64              Acpi20TableAddress;
-  UINT64              SalTableAddress;
-  UINT64              SmbiosTableAddress;
-  UINT64              MpsTableAddress;
-  UINTN               TableWalker;
-
-  ShellStatus         = SHELL_SUCCESS;
-  Status              = EFI_SUCCESS;
-  Address             = NULL;
-  Size                = 0;
+  EFI_STATUS    Status;
+  LIST_ENTRY    *Package;
+  CHAR16        *ProblemParam;
+  SHELL_STATUS  ShellStatus;
+  VOID          *Address;
+  UINT64        Size;
+  CONST CHAR16  *Temp1;
+  UINT64        AcpiTableAddress;
+  UINT64        Acpi20TableAddress;
+  UINT64        SalTableAddress;
+  UINT64        SmbiosTableAddress;
+  UINT64        MpsTableAddress;
+  UINTN         TableWalker;
+
+  ShellStatus = SHELL_SUCCESS;
+  Status      = EFI_SUCCESS;
+  Address     = NULL;
+  Size        = 0;
 
 
   //
   //
   // initialize the shell lib (we must be in non-auto-init...)
   // initialize the shell lib (we must be in non-auto-init...)
   //
   //
-  Status = ShellInitialize();
-  ASSERT_EFI_ERROR(Status);
+  Status = ShellInitialize ();
+  ASSERT_EFI_ERROR (Status);
 
 
-  Status = CommandInit();
-  ASSERT_EFI_ERROR(Status);
+  Status = CommandInit ();
+  ASSERT_EFI_ERROR (Status);
 
 
   //
   //
   // parse the command line
   // parse the command line
   //
   //
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
-  if (EFI_ERROR(Status)) {
-    if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmem", ProblemParam);
-      FreePool(ProblemParam);
+  if (EFI_ERROR (Status)) {
+    if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmem", ProblemParam);
+      FreePool (ProblemParam);
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
-      ASSERT(FALSE);
+      ASSERT (FALSE);
     }
     }
   } else {
   } else {
-    if (ShellCommandLineGetCount(Package) > 3) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmem");
+    if (ShellCommandLineGetCount (Package) > 3) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmem");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
-      Temp1 = ShellCommandLineGetRawValue(Package, 1);
+      Temp1 = ShellCommandLineGetRawValue (Package, 1);
       if (Temp1 == NULL) {
       if (Temp1 == NULL) {
         Address = gST;
         Address = gST;
         Size    = sizeof (*gST);
         Size    = sizeof (*gST);
       } else {
       } else {
-        if (!ShellIsHexOrDecimalNumber(Temp1, TRUE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp1, (UINT64*)&Address, TRUE, FALSE))) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
+        if (!ShellIsHexOrDecimalNumber (Temp1, TRUE, FALSE) || EFI_ERROR (ShellConvertStringToUint64 (Temp1, (UINT64 *)&Address, TRUE, FALSE))) {
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
           ShellStatus = SHELL_INVALID_PARAMETER;
           ShellStatus = SHELL_INVALID_PARAMETER;
         }
         }
-        Temp1 = ShellCommandLineGetRawValue(Package, 2);
+
+        Temp1 = ShellCommandLineGetRawValue (Package, 2);
         if (Temp1 == NULL) {
         if (Temp1 == NULL) {
           Size = 512;
           Size = 512;
         } else {
         } else {
-          if (!ShellIsHexOrDecimalNumber(Temp1, FALSE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp1, &Size, TRUE, FALSE))) {
-            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
+          if (!ShellIsHexOrDecimalNumber (Temp1, FALSE, FALSE) || EFI_ERROR (ShellConvertStringToUint64 (Temp1, &Size, TRUE, FALSE))) {
+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
             ShellStatus = SHELL_INVALID_PARAMETER;
             ShellStatus = SHELL_INVALID_PARAMETER;
           }
           }
         }
         }
@@ -161,39 +164,48 @@ ShellCommandRunDmem (
     }
     }
 
 
     if (ShellStatus == SHELL_SUCCESS) {
     if (ShellStatus == SHELL_SUCCESS) {
-      if (!ShellCommandLineGetFlag(Package, L"-mmio")) {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
-        DumpHex(2, (UINTN)Address, (UINTN)Size, Address);
-        if (Address == (VOID*)gST) {
-          Acpi20TableAddress  = 0;
-          AcpiTableAddress    = 0;
-          SalTableAddress     = 0;
-          SmbiosTableAddress  = 0;
-          MpsTableAddress     = 0;
-          for (TableWalker = 0 ; TableWalker < gST->NumberOfTableEntries ; TableWalker++) {
-            if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi20TableGuid)) {
+      if (!ShellCommandLineGetFlag (Package, L"-mmio")) {
+        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
+        DumpHex (2, (UINTN)Address, (UINTN)Size, Address);
+        if (Address == (VOID *)gST) {
+          Acpi20TableAddress = 0;
+          AcpiTableAddress   = 0;
+          SalTableAddress    = 0;
+          SmbiosTableAddress = 0;
+          MpsTableAddress    = 0;
+          for (TableWalker = 0; TableWalker < gST->NumberOfTableEntries; TableWalker++) {
+            if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi20TableGuid)) {
               Acpi20TableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               Acpi20TableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               continue;
               continue;
             }
             }
-            if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi10TableGuid)) {
+
+            if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi10TableGuid)) {
               AcpiTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               AcpiTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               continue;
               continue;
             }
             }
-            if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbiosTableGuid)) {
+
+            if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbiosTableGuid)) {
               SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               continue;
               continue;
             }
             }
+
             if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbios3TableGuid)) {
             if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbios3TableGuid)) {
-              SmbiosTableAddress = (UINT64) (UINTN) gST->ConfigurationTable[TableWalker].VendorTable;
+              SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               continue;
               continue;
             }
             }
-            if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMpsTableGuid)) {
+
+            if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMpsTableGuid)) {
               MpsTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               MpsTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
               continue;
               continue;
             }
             }
           }
           }
 
 
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_SYSTEM_TABLE), gShellDebug1HiiHandle,
+          ShellPrintHiiEx (
+            -1,
+            -1,
+            NULL,
+            STRING_TOKEN (STR_DMEM_SYSTEM_TABLE),
+            gShellDebug1HiiHandle,
             (UINT64)(UINTN)Address,
             (UINT64)(UINTN)Address,
             gST->Hdr.HeaderSize,
             gST->Hdr.HeaderSize,
             gST->Hdr.Revision,
             gST->Hdr.Revision,
@@ -210,11 +222,10 @@ ShellCommandRunDmem (
             );
             );
         }
         }
       } else {
       } else {
-        ShellStatus = DisplayMmioMemory(Address, (UINTN)Size);
+        ShellStatus = DisplayMmioMemory (Address, (UINTN)Size);
       }
       }
     }
     }
 
 
-
     ShellCommandLineFreeVarList (Package);
     ShellCommandLineFreeVarList (Package);
   }
   }
 
 

+ 293 - 223
ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c

@@ -17,13 +17,13 @@ typedef enum {
 } DMP_STORE_TYPE;
 } DMP_STORE_TYPE;
 
 
 typedef struct {
 typedef struct {
-  UINT32     Signature;
-  CHAR16     *Name;
-  EFI_GUID   Guid;
-  UINT32     Attributes;
-  UINT32     DataSize;
-  UINT8      *Data;
-  LIST_ENTRY Link;
+  UINT32        Signature;
+  CHAR16        *Name;
+  EFI_GUID      Guid;
+  UINT32        Attributes;
+  UINT32        DataSize;
+  UINT8         *Data;
+  LIST_ENTRY    Link;
 } DMP_STORE_VARIABLE;
 } DMP_STORE_VARIABLE;
 
 
 #define DMP_STORE_VARIABLE_SIGNATURE  SIGNATURE_32 ('_', 'd', 's', 's')
 #define DMP_STORE_VARIABLE_SIGNATURE  SIGNATURE_32 ('_', 'd', 's', 's')
@@ -37,39 +37,43 @@ typedef struct {
 **/
 **/
 CHAR16 *
 CHAR16 *
 GetAttrType (
 GetAttrType (
-  IN CONST UINT32 Atts
+  IN CONST UINT32  Atts
   )
   )
 {
 {
-  UINTN  BufLen;
-  CHAR16 *RetString;
+  UINTN   BufLen;
+  CHAR16  *RetString;
 
 
-  BufLen      = 0;
-  RetString   = NULL;
+  BufLen    = 0;
+  RetString = NULL;
 
 
   if ((Atts & EFI_VARIABLE_NON_VOLATILE) != 0) {
   if ((Atts & EFI_VARIABLE_NON_VOLATILE) != 0) {
     StrnCatGrow (&RetString, &BufLen, L"+NV", 0);
     StrnCatGrow (&RetString, &BufLen, L"+NV", 0);
   }
   }
+
   if ((Atts & EFI_VARIABLE_RUNTIME_ACCESS) != 0) {
   if ((Atts & EFI_VARIABLE_RUNTIME_ACCESS) != 0) {
     StrnCatGrow (&RetString, &BufLen, L"+RT+BS", 0);
     StrnCatGrow (&RetString, &BufLen, L"+RT+BS", 0);
   } else if ((Atts & EFI_VARIABLE_BOOTSERVICE_ACCESS) != 0) {
   } else if ((Atts & EFI_VARIABLE_BOOTSERVICE_ACCESS) != 0) {
     StrnCatGrow (&RetString, &BufLen, L"+BS", 0);
     StrnCatGrow (&RetString, &BufLen, L"+BS", 0);
   }
   }
+
   if ((Atts & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) {
   if ((Atts & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) {
     StrnCatGrow (&RetString, &BufLen, L"+HR", 0);
     StrnCatGrow (&RetString, &BufLen, L"+HR", 0);
   }
   }
+
   if ((Atts & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
   if ((Atts & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
     StrnCatGrow (&RetString, &BufLen, L"+AW", 0);
     StrnCatGrow (&RetString, &BufLen, L"+AW", 0);
   }
   }
+
   if ((Atts & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) {
   if ((Atts & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) {
     StrnCatGrow (&RetString, &BufLen, L"+AT", 0);
     StrnCatGrow (&RetString, &BufLen, L"+AT", 0);
   }
   }
 
 
   if (RetString == NULL) {
   if (RetString == NULL) {
-    RetString = StrnCatGrow(&RetString, &BufLen, L"Invalid", 0);
+    RetString = StrnCatGrow (&RetString, &BufLen, L"Invalid", 0);
   }
   }
 
 
   if ((RetString != NULL) && (RetString[0] == L'+')) {
   if ((RetString != NULL) && (RetString[0] == L'+')) {
-    CopyMem(RetString, RetString + 1, StrSize(RetString + 1));
+    CopyMem (RetString, RetString + 1, StrSize (RetString + 1));
   }
   }
 
 
   return RetString;
   return RetString;
@@ -85,7 +89,7 @@ GetAttrType (
 
 
   @return The hex format string.
   @return The hex format string.
 **/
 **/
-CHAR16*
+CHAR16 *
 BinaryToHexString (
 BinaryToHexString (
   IN     VOID    *Buffer,
   IN     VOID    *Buffer,
   IN     UINTN   BufferSize,
   IN     UINTN   BufferSize,
@@ -93,8 +97,8 @@ BinaryToHexString (
   IN     UINTN   HexStringSize
   IN     UINTN   HexStringSize
   )
   )
 {
 {
-  UINTN Index;
-  UINTN StringIndex;
+  UINTN  Index;
+  UINTN  StringIndex;
 
 
   ASSERT (Buffer != NULL);
   ASSERT (Buffer != NULL);
   ASSERT ((BufferSize * 2 + 1) * sizeof (CHAR16) <= HexStringSize);
   ASSERT ((BufferSize * 2 + 1) * sizeof (CHAR16) <= HexStringSize);
@@ -105,9 +109,10 @@ BinaryToHexString (
         &HexString[StringIndex],
         &HexString[StringIndex],
         HexStringSize - StringIndex * sizeof (CHAR16),
         HexStringSize - StringIndex * sizeof (CHAR16),
         L"%02x",
         L"%02x",
-        ((UINT8 *) Buffer)[Index]
+        ((UINT8 *)Buffer)[Index]
         );
         );
   }
   }
+
   return HexString;
   return HexString;
 }
 }
 
 
@@ -126,26 +131,26 @@ BinaryToHexString (
 **/
 **/
 SHELL_STATUS
 SHELL_STATUS
 LoadVariablesFromFile (
 LoadVariablesFromFile (
-  IN SHELL_FILE_HANDLE FileHandle,
-  IN CONST CHAR16      *Name,
-  IN CONST EFI_GUID    *Guid,
-  OUT BOOLEAN          *Found
+  IN SHELL_FILE_HANDLE  FileHandle,
+  IN CONST CHAR16       *Name,
+  IN CONST EFI_GUID     *Guid,
+  OUT BOOLEAN           *Found
   )
   )
 {
 {
-  EFI_STATUS           Status;
-  SHELL_STATUS         ShellStatus;
-  UINT32               NameSize;
-  UINT32               DataSize;
-  UINTN                BufferSize;
-  UINTN                RemainingSize;
-  UINT64               Position;
-  UINT64               FileSize;
-  LIST_ENTRY           List;
-  DMP_STORE_VARIABLE   *Variable;
-  LIST_ENTRY           *Link;
-  CHAR16               *Attributes;
-  UINT8                *Buffer;
-  UINT32               Crc32;
+  EFI_STATUS          Status;
+  SHELL_STATUS        ShellStatus;
+  UINT32              NameSize;
+  UINT32              DataSize;
+  UINTN               BufferSize;
+  UINTN               RemainingSize;
+  UINT64              Position;
+  UINT64              FileSize;
+  LIST_ENTRY          List;
+  DMP_STORE_VARIABLE  *Variable;
+  LIST_ENTRY          *Link;
+  CHAR16              *Attributes;
+  UINT8               *Buffer;
+  UINT32              Crc32;
 
 
   Status = ShellGetFileSize (FileHandle, &FileSize);
   Status = ShellGetFileSize (FileHandle, &FileSize);
   if (EFI_ERROR (Status)) {
   if (EFI_ERROR (Status)) {
@@ -162,7 +167,7 @@ LoadVariablesFromFile (
     // NameSize
     // NameSize
     //
     //
     BufferSize = sizeof (NameSize);
     BufferSize = sizeof (NameSize);
-    Status = ShellReadFile (FileHandle, &BufferSize, &NameSize);
+    Status     = ShellReadFile (FileHandle, &BufferSize, &NameSize);
     if (EFI_ERROR (Status) || (BufferSize != sizeof (NameSize))) {
     if (EFI_ERROR (Status) || (BufferSize != sizeof (NameSize))) {
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       break;
       break;
@@ -172,7 +177,7 @@ LoadVariablesFromFile (
     // DataSize
     // DataSize
     //
     //
     BufferSize = sizeof (DataSize);
     BufferSize = sizeof (DataSize);
-    Status = ShellReadFile (FileHandle, &BufferSize, &DataSize);
+    Status     = ShellReadFile (FileHandle, &BufferSize, &DataSize);
     if (EFI_ERROR (Status) || (BufferSize != sizeof (DataSize))) {
     if (EFI_ERROR (Status) || (BufferSize != sizeof (DataSize))) {
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       break;
       break;
@@ -188,8 +193,9 @@ LoadVariablesFromFile (
       ShellStatus = SHELL_OUT_OF_RESOURCES;
       ShellStatus = SHELL_OUT_OF_RESOURCES;
       break;
       break;
     }
     }
-    BufferSize    = RemainingSize;
-    Status = ShellReadFile (FileHandle, &BufferSize, (UINT32 *) Buffer + 2);
+
+    BufferSize = RemainingSize;
+    Status     = ShellReadFile (FileHandle, &BufferSize, (UINT32 *)Buffer + 2);
     if (EFI_ERROR (Status) || (BufferSize != RemainingSize)) {
     if (EFI_ERROR (Status) || (BufferSize != RemainingSize)) {
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       FreePool (Buffer);
       FreePool (Buffer);
@@ -199,15 +205,15 @@ LoadVariablesFromFile (
     //
     //
     // Check Crc32
     // Check Crc32
     //
     //
-    * (UINT32 *) Buffer       = NameSize;
-    * ((UINT32 *) Buffer + 1) = DataSize;
-    BufferSize = RemainingSize + sizeof (NameSize) + sizeof (DataSize) - sizeof (Crc32);
+    *(UINT32 *)Buffer       = NameSize;
+    *((UINT32 *)Buffer + 1) = DataSize;
+    BufferSize              = RemainingSize + sizeof (NameSize) + sizeof (DataSize) - sizeof (Crc32);
     gBS->CalculateCrc32 (
     gBS->CalculateCrc32 (
            Buffer,
            Buffer,
            BufferSize,
            BufferSize,
            &Crc32
            &Crc32
            );
            );
-    if (Crc32 != * (UINT32 *) (Buffer + BufferSize)) {
+    if (Crc32 != *(UINT32 *)(Buffer + BufferSize)) {
       FreePool (Buffer);
       FreePool (Buffer);
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       break;
       break;
@@ -221,41 +227,51 @@ LoadVariablesFromFile (
       ShellStatus = SHELL_OUT_OF_RESOURCES;
       ShellStatus = SHELL_OUT_OF_RESOURCES;
       break;
       break;
     }
     }
+
     Variable->Signature = DMP_STORE_VARIABLE_SIGNATURE;
     Variable->Signature = DMP_STORE_VARIABLE_SIGNATURE;
-    Variable->Name      = (CHAR16 *) (Variable + 1);
+    Variable->Name      = (CHAR16 *)(Variable + 1);
     Variable->DataSize  = DataSize;
     Variable->DataSize  = DataSize;
-    Variable->Data      = (UINT8 *) Variable->Name + NameSize;
-    CopyMem (Variable->Name,        Buffer + sizeof (NameSize) + sizeof (DataSize),                                                  NameSize);
-    CopyMem (&Variable->Guid,       Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize,                                       sizeof (EFI_GUID));
-    CopyMem (&Variable->Attributes, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID),                   sizeof (UINT32));
-    CopyMem (Variable->Data,        Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID) + sizeof (UINT32), DataSize);
+    Variable->Data      = (UINT8 *)Variable->Name + NameSize;
+    CopyMem (Variable->Name, Buffer + sizeof (NameSize) + sizeof (DataSize), NameSize);
+    CopyMem (&Variable->Guid, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize, sizeof (EFI_GUID));
+    CopyMem (&Variable->Attributes, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID), sizeof (UINT32));
+    CopyMem (Variable->Data, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID) + sizeof (UINT32), DataSize);
 
 
     InsertTailList (&List, &Variable->Link);
     InsertTailList (&List, &Variable->Link);
     FreePool (Buffer);
     FreePool (Buffer);
   }
   }
 
 
   if ((Position != FileSize) || (ShellStatus != SHELL_SUCCESS)) {
   if ((Position != FileSize) || (ShellStatus != SHELL_SUCCESS)) {
-    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_BAD_FILE), gShellDebug1HiiHandle, L"dmpstore");
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_BAD_FILE), gShellDebug1HiiHandle, L"dmpstore");
     if (Position != FileSize) {
     if (Position != FileSize) {
       ShellStatus = SHELL_VOLUME_CORRUPTED;
       ShellStatus = SHELL_VOLUME_CORRUPTED;
     }
     }
   }
   }
 
 
   for ( Link = GetFirstNode (&List)
   for ( Link = GetFirstNode (&List)
-      ; !IsNull (&List, Link) && (ShellStatus == SHELL_SUCCESS)
-      ; Link = GetNextNode (&List, Link)
-      ) {
+        ; !IsNull (&List, Link) && (ShellStatus == SHELL_SUCCESS)
+        ; Link = GetNextNode (&List, Link)
+        )
+  {
     Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE);
     Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE);
 
 
-    if (((Name == NULL) || gUnicodeCollation->MetaiMatch (gUnicodeCollation, Variable->Name, (CHAR16 *) Name)) &&
+    if (((Name == NULL) || gUnicodeCollation->MetaiMatch (gUnicodeCollation, Variable->Name, (CHAR16 *)Name)) &&
         ((Guid == NULL) || CompareGuid (&Variable->Guid, Guid))
         ((Guid == NULL) || CompareGuid (&Variable->Guid, Guid))
-       ) {
+        )
+    {
       Attributes = GetAttrType (Variable->Attributes);
       Attributes = GetAttrType (Variable->Attributes);
       ShellPrintHiiEx (
       ShellPrintHiiEx (
-        -1, -1, NULL, STRING_TOKEN(STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
-        Attributes, &Variable->Guid, Variable->Name, Variable->DataSize
+        -1,
+        -1,
+        NULL,
+        STRING_TOKEN (STR_DMPSTORE_HEADER_LINE),
+        gShellDebug1HiiHandle,
+        Attributes,
+        &Variable->Guid,
+        Variable->Name,
+        Variable->DataSize
         );
         );
-      SHELL_FREE_NON_NULL(Attributes);
+      SHELL_FREE_NON_NULL (Attributes);
 
 
       *Found = TRUE;
       *Found = TRUE;
       Status = gRT->SetVariable (
       Status = gRT->SetVariable (
@@ -266,14 +282,14 @@ LoadVariablesFromFile (
                       Variable->Data
                       Variable->Data
                       );
                       );
       if (EFI_ERROR (Status)) {
       if (EFI_ERROR (Status)) {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_GEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", Variable->Name, Status);
+        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_GEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", Variable->Name, Status);
       }
       }
     }
     }
   }
   }
 
 
   for (Link = GetFirstNode (&List); !IsNull (&List, Link); ) {
   for (Link = GetFirstNode (&List); !IsNull (&List, Link); ) {
     Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE);
     Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE);
-    Link = RemoveEntryList (&Variable->Link);
+    Link     = RemoveEntryList (&Variable->Link);
     FreePool (Variable);
     FreePool (Variable);
   }
   }
 
 
@@ -296,26 +312,26 @@ LoadVariablesFromFile (
 **/
 **/
 EFI_STATUS
 EFI_STATUS
 AppendSingleVariableToFile (
 AppendSingleVariableToFile (
-  IN SHELL_FILE_HANDLE FileHandle,
-  IN CONST CHAR16      *Name,
-  IN CONST EFI_GUID    *Guid,
-  IN UINT32            Attributes,
-  IN UINT32            DataSize,
-  IN CONST UINT8       *Data
+  IN SHELL_FILE_HANDLE  FileHandle,
+  IN CONST CHAR16       *Name,
+  IN CONST EFI_GUID     *Guid,
+  IN UINT32             Attributes,
+  IN UINT32             DataSize,
+  IN CONST UINT8        *Data
   )
   )
 {
 {
-  UINT32              NameSize;
-  UINT8               *Buffer;
-  UINT8               *Ptr;
-  UINTN               BufferSize;
-  EFI_STATUS          Status;
+  UINT32      NameSize;
+  UINT8       *Buffer;
+  UINT8       *Ptr;
+  UINTN       BufferSize;
+  EFI_STATUS  Status;
 
 
-  NameSize   = (UINT32) StrSize (Name);
+  NameSize   = (UINT32)StrSize (Name);
   BufferSize = sizeof (NameSize) + sizeof (DataSize)
   BufferSize = sizeof (NameSize) + sizeof (DataSize)
-             + sizeof (*Guid)
-             + sizeof (Attributes)
-             + NameSize + DataSize
-             + sizeof (UINT32);
+               + sizeof (*Guid)
+               + sizeof (Attributes)
+               + NameSize + DataSize
+               + sizeof (UINT32);
 
 
   Buffer = AllocatePool (BufferSize);
   Buffer = AllocatePool (BufferSize);
   if (Buffer == NULL) {
   if (Buffer == NULL) {
@@ -326,10 +342,10 @@ AppendSingleVariableToFile (
   //
   //
   // NameSize and DataSize
   // NameSize and DataSize
   //
   //
-  * (UINT32 *) Ptr = NameSize;
-  Ptr += sizeof (NameSize);
-  *(UINT32 *) Ptr = DataSize;
-  Ptr += sizeof (DataSize);
+  *(UINT32 *)Ptr = NameSize;
+  Ptr           += sizeof (NameSize);
+  *(UINT32 *)Ptr = DataSize;
+  Ptr           += sizeof (DataSize);
 
 
   //
   //
   // Name
   // Name
@@ -346,8 +362,8 @@ AppendSingleVariableToFile (
   //
   //
   // Attributes
   // Attributes
   //
   //
-  * (UINT32 *) Ptr = Attributes;
-  Ptr += sizeof (Attributes);
+  *(UINT32 *)Ptr = Attributes;
+  Ptr           += sizeof (Attributes);
 
 
   //
   //
   // Data
   // Data
@@ -358,14 +374,15 @@ AppendSingleVariableToFile (
   //
   //
   // Crc32
   // Crc32
   //
   //
-  gBS->CalculateCrc32 (Buffer, (UINTN) Ptr - (UINTN) Buffer, (UINT32 *) Ptr);
+  gBS->CalculateCrc32 (Buffer, (UINTN)Ptr - (UINTN)Buffer, (UINT32 *)Ptr);
 
 
   Status = ShellWriteFile (FileHandle, &BufferSize, Buffer);
   Status = ShellWriteFile (FileHandle, &BufferSize, Buffer);
   FreePool (Buffer);
   FreePool (Buffer);
 
 
   if (!EFI_ERROR (Status) &&
   if (!EFI_ERROR (Status) &&
       (BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize + sizeof (UINT32))
       (BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize + sizeof (UINT32))
-    ) {
+      )
+  {
     Status = EFI_DEVICE_ERROR;
     Status = EFI_DEVICE_ERROR;
   }
   }
 
 
@@ -398,49 +415,49 @@ AppendSingleVariableToFile (
 **/
 **/
 SHELL_STATUS
 SHELL_STATUS
 CascadeProcessVariables (
 CascadeProcessVariables (
-  IN CONST CHAR16      *Name        OPTIONAL,
-  IN CONST EFI_GUID    *Guid        OPTIONAL,
-  IN DMP_STORE_TYPE    Type,
-  IN EFI_FILE_PROTOCOL *FileHandle  OPTIONAL,
-  IN CONST CHAR16      * CONST PrevName,
-  IN EFI_GUID          FoundVarGuid,
-  IN BOOLEAN           *FoundOne,
-  IN BOOLEAN           StandardFormatOutput
+  IN CONST CHAR16              *Name        OPTIONAL,
+  IN CONST EFI_GUID            *Guid        OPTIONAL,
+  IN DMP_STORE_TYPE            Type,
+  IN EFI_FILE_PROTOCOL         *FileHandle  OPTIONAL,
+  IN CONST CHAR16      *CONST  PrevName,
+  IN EFI_GUID                  FoundVarGuid,
+  IN BOOLEAN                   *FoundOne,
+  IN BOOLEAN                   StandardFormatOutput
   )
   )
 {
 {
-  EFI_STATUS                Status;
-  CHAR16                    *FoundVarName;
-  UINT8                     *DataBuffer;
-  UINTN                     DataSize;
-  UINT32                    Atts;
-  SHELL_STATUS              ShellStatus;
-  UINTN                     NameSize;
-  CHAR16                    *AttrString;
-  CHAR16                    *HexString;
-  EFI_STATUS                SetStatus;
-  CONST CHAR16              *GuidName;
-
-  if (ShellGetExecutionBreakFlag()) {
+  EFI_STATUS    Status;
+  CHAR16        *FoundVarName;
+  UINT8         *DataBuffer;
+  UINTN         DataSize;
+  UINT32        Atts;
+  SHELL_STATUS  ShellStatus;
+  UINTN         NameSize;
+  CHAR16        *AttrString;
+  CHAR16        *HexString;
+  EFI_STATUS    SetStatus;
+  CONST CHAR16  *GuidName;
+
+  if (ShellGetExecutionBreakFlag ()) {
     return (SHELL_ABORTED);
     return (SHELL_ABORTED);
   }
   }
 
 
-  NameSize      = 0;
-  FoundVarName  = NULL;
+  NameSize     = 0;
+  FoundVarName = NULL;
 
 
-  if (PrevName!=NULL) {
-    StrnCatGrow(&FoundVarName, &NameSize, PrevName, 0);
+  if (PrevName != NULL) {
+    StrnCatGrow (&FoundVarName, &NameSize, PrevName, 0);
   } else {
   } else {
-    FoundVarName = AllocateZeroPool(sizeof(CHAR16));
-    NameSize = sizeof(CHAR16);
+    FoundVarName = AllocateZeroPool (sizeof (CHAR16));
+    NameSize     = sizeof (CHAR16);
   }
   }
 
 
   Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
   Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
   if (Status == EFI_BUFFER_TOO_SMALL) {
   if (Status == EFI_BUFFER_TOO_SMALL) {
-    SHELL_FREE_NON_NULL(FoundVarName);
+    SHELL_FREE_NON_NULL (FoundVarName);
     FoundVarName = AllocateZeroPool (NameSize);
     FoundVarName = AllocateZeroPool (NameSize);
     if (FoundVarName != NULL) {
     if (FoundVarName != NULL) {
       if (PrevName != NULL) {
       if (PrevName != NULL) {
-        StrnCpyS(FoundVarName, NameSize/sizeof(CHAR16), PrevName, NameSize/sizeof(CHAR16) - 1);
+        StrnCpyS (FoundVarName, NameSize/sizeof (CHAR16), PrevName, NameSize/sizeof (CHAR16) - 1);
       }
       }
 
 
       Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
       Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
@@ -453,10 +470,10 @@ CascadeProcessVariables (
   // No more is fine.
   // No more is fine.
   //
   //
   if (Status == EFI_NOT_FOUND) {
   if (Status == EFI_NOT_FOUND) {
-    SHELL_FREE_NON_NULL(FoundVarName);
+    SHELL_FREE_NON_NULL (FoundVarName);
     return (SHELL_SUCCESS);
     return (SHELL_SUCCESS);
-  } else if (EFI_ERROR(Status)) {
-    SHELL_FREE_NON_NULL(FoundVarName);
+  } else if (EFI_ERROR (Status)) {
+    SHELL_FREE_NON_NULL (FoundVarName);
     return (SHELL_DEVICE_ERROR);
     return (SHELL_DEVICE_ERROR);
   }
   }
 
 
@@ -465,8 +482,8 @@ CascadeProcessVariables (
   //
   //
   ShellStatus = CascadeProcessVariables (Name, Guid, Type, FileHandle, FoundVarName, FoundVarGuid, FoundOne, StandardFormatOutput);
   ShellStatus = CascadeProcessVariables (Name, Guid, Type, FileHandle, FoundVarName, FoundVarGuid, FoundOne, StandardFormatOutput);
 
 
-  if (ShellGetExecutionBreakFlag() || (ShellStatus == SHELL_ABORTED)) {
-    SHELL_FREE_NON_NULL(FoundVarName);
+  if (ShellGetExecutionBreakFlag () || (ShellStatus == SHELL_ABORTED)) {
+    SHELL_FREE_NON_NULL (FoundVarName);
     return (SHELL_ABORTED);
     return (SHELL_ABORTED);
   }
   }
 
 
@@ -474,18 +491,19 @@ CascadeProcessVariables (
   // No matter what happened we process our own variable
   // No matter what happened we process our own variable
   // Only continue if Guid and VariableName are each either NULL or a match
   // Only continue if Guid and VariableName are each either NULL or a match
   //
   //
-  if ( ( Name == NULL
-      || gUnicodeCollation->MetaiMatch(gUnicodeCollation, FoundVarName, (CHAR16*) Name) )
-     && ( Guid == NULL
-      || CompareGuid(&FoundVarGuid, Guid) )
-      ) {
-    DataSize      = 0;
-    DataBuffer    = NULL;
+  if (  (  (Name == NULL)
+        || gUnicodeCollation->MetaiMatch (gUnicodeCollation, FoundVarName, (CHAR16 *)Name))
+     && (  (Guid == NULL)
+        || CompareGuid (&FoundVarGuid, Guid))
+        )
+  {
+    DataSize   = 0;
+    DataBuffer = NULL;
     //
     //
     // do the print or delete
     // do the print or delete
     //
     //
     *FoundOne = TRUE;
     *FoundOne = TRUE;
-    Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
+    Status    = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
     if (Status == EFI_BUFFER_TOO_SMALL) {
     if (Status == EFI_BUFFER_TOO_SMALL) {
       SHELL_FREE_NON_NULL (DataBuffer);
       SHELL_FREE_NON_NULL (DataBuffer);
       DataBuffer = AllocatePool (DataSize);
       DataBuffer = AllocatePool (DataSize);
@@ -495,20 +513,31 @@ CascadeProcessVariables (
         Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
         Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
       }
       }
     }
     }
-      //
-      // Last error check then print this variable out.
-      //
+
+    //
+    // Last error check then print this variable out.
+    //
     if (Type == DmpStoreDisplay) {
     if (Type == DmpStoreDisplay) {
-      if (!EFI_ERROR(Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
-        AttrString = GetAttrType(Atts);
+      if (!EFI_ERROR (Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
+        AttrString = GetAttrType (Atts);
         if (StandardFormatOutput) {
         if (StandardFormatOutput) {
           HexString = AllocatePool ((DataSize * 2 + 1) * sizeof (CHAR16));
           HexString = AllocatePool ((DataSize * 2 + 1) * sizeof (CHAR16));
           if (HexString != NULL) {
           if (HexString != NULL) {
             ShellPrintHiiEx (
             ShellPrintHiiEx (
-              -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_VAR_SFO), gShellDebug1HiiHandle,
-              FoundVarName, &FoundVarGuid, Atts, DataSize,
+              -1,
+              -1,
+              NULL,
+              STRING_TOKEN (STR_DMPSTORE_VAR_SFO),
+              gShellDebug1HiiHandle,
+              FoundVarName,
+              &FoundVarGuid,
+              Atts,
+              DataSize,
               BinaryToHexString (
               BinaryToHexString (
-                DataBuffer, DataSize, HexString, (DataSize * 2 + 1) * sizeof (CHAR16)
+                DataBuffer,
+                DataSize,
+                HexString,
+                (DataSize * 2 + 1) * sizeof (CHAR16)
                 )
                 )
               );
               );
             FreePool (HexString);
             FreePool (HexString);
@@ -516,35 +545,58 @@ CascadeProcessVariables (
             Status = EFI_OUT_OF_RESOURCES;
             Status = EFI_OUT_OF_RESOURCES;
           }
           }
         } else {
         } else {
-          Status = gEfiShellProtocol->GetGuidName(&FoundVarGuid, &GuidName);
+          Status = gEfiShellProtocol->GetGuidName (&FoundVarGuid, &GuidName);
           if (EFI_ERROR (Status)) {
           if (EFI_ERROR (Status)) {
             ShellPrintHiiEx (
             ShellPrintHiiEx (
-              -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
-              AttrString, &FoundVarGuid, FoundVarName, DataSize
+              -1,
+              -1,
+              NULL,
+              STRING_TOKEN (STR_DMPSTORE_HEADER_LINE),
+              gShellDebug1HiiHandle,
+              AttrString,
+              &FoundVarGuid,
+              FoundVarName,
+              DataSize
               );
               );
           } else {
           } else {
             ShellPrintHiiEx (
             ShellPrintHiiEx (
-              -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE2), gShellDebug1HiiHandle,
-              AttrString, GuidName, FoundVarName, DataSize
+              -1,
+              -1,
+              NULL,
+              STRING_TOKEN (STR_DMPSTORE_HEADER_LINE2),
+              gShellDebug1HiiHandle,
+              AttrString,
+              GuidName,
+              FoundVarName,
+              DataSize
               );
               );
           }
           }
+
           DumpHex (2, 0, DataSize, DataBuffer);
           DumpHex (2, 0, DataSize, DataBuffer);
         }
         }
+
         SHELL_FREE_NON_NULL (AttrString);
         SHELL_FREE_NON_NULL (AttrString);
       }
       }
     } else if (Type == DmpStoreSave) {
     } else if (Type == DmpStoreSave) {
-      if (!EFI_ERROR(Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
+      if (!EFI_ERROR (Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
         AttrString = GetAttrType (Atts);
         AttrString = GetAttrType (Atts);
         ShellPrintHiiEx (
         ShellPrintHiiEx (
-          -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
-          AttrString, &FoundVarGuid, FoundVarName, DataSize
+          -1,
+          -1,
+          NULL,
+          STRING_TOKEN (STR_DMPSTORE_HEADER_LINE),
+          gShellDebug1HiiHandle,
+          AttrString,
+          &FoundVarGuid,
+          FoundVarName,
+          DataSize
           );
           );
         Status = AppendSingleVariableToFile (
         Status = AppendSingleVariableToFile (
                    FileHandle,
                    FileHandle,
                    FoundVarName,
                    FoundVarName,
                    &FoundVarGuid,
                    &FoundVarGuid,
                    Atts,
                    Atts,
-                   (UINT32) DataSize,
+                   (UINT32)DataSize,
                    DataBuffer
                    DataBuffer
                    );
                    );
         SHELL_FREE_NON_NULL (AttrString);
         SHELL_FREE_NON_NULL (AttrString);
@@ -557,27 +609,39 @@ CascadeProcessVariables (
       if (StandardFormatOutput) {
       if (StandardFormatOutput) {
         if (SetStatus == EFI_SUCCESS) {
         if (SetStatus == EFI_SUCCESS) {
           ShellPrintHiiEx (
           ShellPrintHiiEx (
-            -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_NG_SFO), gShellDebug1HiiHandle,
-            FoundVarName, &FoundVarGuid
+            -1,
+            -1,
+            NULL,
+            STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_NG_SFO),
+            gShellDebug1HiiHandle,
+            FoundVarName,
+            &FoundVarGuid
             );
             );
         }
         }
       } else {
       } else {
         ShellPrintHiiEx (
         ShellPrintHiiEx (
-          -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_DELETE_LINE), gShellDebug1HiiHandle,
-          &FoundVarGuid, FoundVarName, SetStatus
+          -1,
+          -1,
+          NULL,
+          STRING_TOKEN (STR_DMPSTORE_DELETE_LINE),
+          gShellDebug1HiiHandle,
+          &FoundVarGuid,
+          FoundVarName,
+          SetStatus
           );
           );
       }
       }
     }
     }
-    SHELL_FREE_NON_NULL(DataBuffer);
+
+    SHELL_FREE_NON_NULL (DataBuffer);
   }
   }
 
 
-  SHELL_FREE_NON_NULL(FoundVarName);
+  SHELL_FREE_NON_NULL (FoundVarName);
 
 
   if (Status == EFI_DEVICE_ERROR) {
   if (Status == EFI_DEVICE_ERROR) {
     ShellStatus = SHELL_DEVICE_ERROR;
     ShellStatus = SHELL_DEVICE_ERROR;
   } else if (Status == EFI_SECURITY_VIOLATION) {
   } else if (Status == EFI_SECURITY_VIOLATION) {
     ShellStatus = SHELL_SECURITY_VIOLATION;
     ShellStatus = SHELL_SECURITY_VIOLATION;
-  } else if (EFI_ERROR(Status)) {
+  } else if (EFI_ERROR (Status)) {
     ShellStatus = SHELL_NOT_READY;
     ShellStatus = SHELL_NOT_READY;
   }
   }
 
 
@@ -601,23 +665,23 @@ CascadeProcessVariables (
 **/
 **/
 SHELL_STATUS
 SHELL_STATUS
 ProcessVariables (
 ProcessVariables (
-  IN CONST CHAR16      *Name      OPTIONAL,
-  IN CONST EFI_GUID    *Guid      OPTIONAL,
-  IN DMP_STORE_TYPE    Type,
-  IN SHELL_FILE_HANDLE FileHandle OPTIONAL,
-  IN BOOLEAN           StandardFormatOutput
+  IN CONST CHAR16       *Name      OPTIONAL,
+  IN CONST EFI_GUID     *Guid      OPTIONAL,
+  IN DMP_STORE_TYPE     Type,
+  IN SHELL_FILE_HANDLE  FileHandle OPTIONAL,
+  IN BOOLEAN            StandardFormatOutput
   )
   )
 {
 {
-  SHELL_STATUS              ShellStatus;
-  BOOLEAN                   Found;
-  EFI_GUID                  FoundVarGuid;
+  SHELL_STATUS  ShellStatus;
+  BOOLEAN       Found;
+  EFI_GUID      FoundVarGuid;
 
 
-  Found         = FALSE;
-  ShellStatus   = SHELL_SUCCESS;
-  ZeroMem (&FoundVarGuid, sizeof(EFI_GUID));
+  Found       = FALSE;
+  ShellStatus = SHELL_SUCCESS;
+  ZeroMem (&FoundVarGuid, sizeof (EFI_GUID));
 
 
   if (StandardFormatOutput) {
   if (StandardFormatOutput) {
-    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"dmpstore");
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"dmpstore");
   }
   }
 
 
   if (Type == DmpStoreLoad) {
   if (Type == DmpStoreLoad) {
@@ -628,43 +692,45 @@ ProcessVariables (
 
 
   if (!Found) {
   if (!Found) {
     if (ShellStatus == SHELL_OUT_OF_RESOURCES) {
     if (ShellStatus == SHELL_OUT_OF_RESOURCES) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"dmpstore");
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"dmpstore");
       return (ShellStatus);
       return (ShellStatus);
-    } else if (Name != NULL && Guid == NULL) {
+    } else if ((Name != NULL) && (Guid == NULL)) {
       if (StandardFormatOutput) {
       if (StandardFormatOutput) {
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N_SFO), gShellDebug1HiiHandle, Name);
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N_SFO), gShellDebug1HiiHandle, Name);
       } else {
       } else {
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N), gShellDebug1HiiHandle, L"dmpstore", Name);
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N), gShellDebug1HiiHandle, L"dmpstore", Name);
       }
       }
-    } else if (Name != NULL && Guid != NULL) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_GN), gShellDebug1HiiHandle, L"dmpstore", Guid, Name);
-    } else if (Name == NULL && Guid == NULL) {
+    } else if ((Name != NULL) && (Guid != NULL)) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_GN), gShellDebug1HiiHandle, L"dmpstore", Guid, Name);
+    } else if ((Name == NULL) && (Guid == NULL)) {
       if (StandardFormatOutput) {
       if (StandardFormatOutput) {
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_SFO), gShellDebug1HiiHandle);
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_SFO), gShellDebug1HiiHandle);
       } else {
       } else {
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND), gShellDebug1HiiHandle, L"dmpstore");
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND), gShellDebug1HiiHandle, L"dmpstore");
       }
       }
-    } else if (Name == NULL && Guid != NULL) {
+    } else if ((Name == NULL) && (Guid != NULL)) {
       if (StandardFormatOutput) {
       if (StandardFormatOutput) {
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G_SFO), gShellDebug1HiiHandle, Guid);
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G_SFO), gShellDebug1HiiHandle, Guid);
       } else {
       } else {
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G), gShellDebug1HiiHandle, L"dmpstore", Guid);
         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G), gShellDebug1HiiHandle, L"dmpstore", Guid);
       }
       }
     }
     }
+
     return (SHELL_NOT_FOUND);
     return (SHELL_NOT_FOUND);
   }
   }
+
   return (ShellStatus);
   return (ShellStatus);
 }
 }
 
 
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
-  {L"-d", TypeFlag},
-  {L"-l", TypeValue},
-  {L"-s", TypeValue},
-  {L"-all", TypeFlag},
-  {L"-guid", TypeValue},
-  {L"-sfo", TypeFlag},
-  {NULL, TypeMax}
-  };
+STATIC CONST SHELL_PARAM_ITEM  ParamList[] = {
+  { L"-d",    TypeFlag  },
+  { L"-l",    TypeValue },
+  { L"-s",    TypeValue },
+  { L"-all",  TypeFlag  },
+  { L"-guid", TypeValue },
+  { L"-sfo",  TypeFlag  },
+  { NULL,     TypeMax   }
+};
 
 
 /**
 /**
   Function for 'dmpstore' command.
   Function for 'dmpstore' command.
@@ -679,20 +745,20 @@ ShellCommandRunDmpStore (
   IN EFI_SYSTEM_TABLE  *SystemTable
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS        Status;
-  RETURN_STATUS     RStatus;
-  LIST_ENTRY        *Package;
-  CHAR16            *ProblemParam;
-  SHELL_STATUS      ShellStatus;
-  CONST CHAR16      *GuidStr;
-  CONST CHAR16      *File;
-  EFI_GUID          *Guid;
-  EFI_GUID          GuidData;
-  CONST CHAR16      *Name;
-  DMP_STORE_TYPE    Type;
-  SHELL_FILE_HANDLE FileHandle;
-  EFI_FILE_INFO     *FileInfo;
-  BOOLEAN           StandardFormatOutput;
+  EFI_STATUS         Status;
+  RETURN_STATUS      RStatus;
+  LIST_ENTRY         *Package;
+  CHAR16             *ProblemParam;
+  SHELL_STATUS       ShellStatus;
+  CONST CHAR16       *GuidStr;
+  CONST CHAR16       *File;
+  EFI_GUID           *Guid;
+  EFI_GUID           GuidData;
+  CONST CHAR16       *Name;
+  DMP_STORE_TYPE     Type;
+  SHELL_FILE_HANDLE  FileHandle;
+  EFI_FILE_INFO      *FileInfo;
+  BOOLEAN            StandardFormatOutput;
 
 
   ShellStatus          = SHELL_SUCCESS;
   ShellStatus          = SHELL_SUCCESS;
   Package              = NULL;
   Package              = NULL;
@@ -702,61 +768,62 @@ ShellCommandRunDmpStore (
   StandardFormatOutput = FALSE;
   StandardFormatOutput = FALSE;
 
 
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
-  if (EFI_ERROR(Status)) {
-    if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmpstore", ProblemParam);
-      FreePool(ProblemParam);
+  if (EFI_ERROR (Status)) {
+    if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmpstore", ProblemParam);
+      FreePool (ProblemParam);
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
-      ASSERT(FALSE);
+      ASSERT (FALSE);
     }
     }
   } else {
   } else {
-    if (ShellCommandLineGetCount(Package) > 2) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmpstore");
+    if (ShellCommandLineGetCount (Package) > 2) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmpstore");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
-    } else if (ShellCommandLineGetFlag(Package, L"-all") && ShellCommandLineGetFlag(Package, L"-guid")) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-all", L"-guid");
+    } else if (ShellCommandLineGetFlag (Package, L"-all") && ShellCommandLineGetFlag (Package, L"-guid")) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-all", L"-guid");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
-    } else if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-l")) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle,  L"dmpstore", L"-l", L"-s");
+    } else if (ShellCommandLineGetFlag (Package, L"-s") && ShellCommandLineGetFlag (Package, L"-l")) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l", L"-s");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
-    } else if ((ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) && ShellCommandLineGetFlag(Package, L"-d")) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-d");
+    } else if ((ShellCommandLineGetFlag (Package, L"-s") || ShellCommandLineGetFlag (Package, L"-l")) && ShellCommandLineGetFlag (Package, L"-d")) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-d");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
-    } else if ((ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) && ShellCommandLineGetFlag(Package, L"-sfo")) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-sfo");
+    } else if ((ShellCommandLineGetFlag (Package, L"-s") || ShellCommandLineGetFlag (Package, L"-l")) && ShellCommandLineGetFlag (Package, L"-sfo")) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-sfo");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
       //
       //
       // Determine the GUID to search for based on -all and -guid parameters
       // Determine the GUID to search for based on -all and -guid parameters
       //
       //
-      if (!ShellCommandLineGetFlag(Package, L"-all")) {
-        GuidStr = ShellCommandLineGetValue(Package, L"-guid");
+      if (!ShellCommandLineGetFlag (Package, L"-all")) {
+        GuidStr = ShellCommandLineGetValue (Package, L"-guid");
         if (GuidStr != NULL) {
         if (GuidStr != NULL) {
           RStatus = StrToGuid (GuidStr, &GuidData);
           RStatus = StrToGuid (GuidStr, &GuidData);
           if (RETURN_ERROR (RStatus) || (GuidStr[GUID_STRING_LENGTH] != L'\0')) {
           if (RETURN_ERROR (RStatus) || (GuidStr[GUID_STRING_LENGTH] != L'\0')) {
-            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmpstore", GuidStr);
+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmpstore", GuidStr);
             ShellStatus = SHELL_INVALID_PARAMETER;
             ShellStatus = SHELL_INVALID_PARAMETER;
           }
           }
+
           Guid = &GuidData;
           Guid = &GuidData;
-        } else  {
+        } else {
           Guid = &gEfiGlobalVariableGuid;
           Guid = &gEfiGlobalVariableGuid;
         }
         }
       } else {
       } else {
-        Guid  = NULL;
+        Guid = NULL;
       }
       }
 
 
       //
       //
       // Get the Name of the variable to find
       // Get the Name of the variable to find
       //
       //
-      Name = ShellCommandLineGetRawValue(Package, 1);
+      Name = ShellCommandLineGetRawValue (Package, 1);
 
 
       if (ShellStatus == SHELL_SUCCESS) {
       if (ShellStatus == SHELL_SUCCESS) {
-        if (ShellCommandLineGetFlag(Package, L"-s")) {
+        if (ShellCommandLineGetFlag (Package, L"-s")) {
           Type = DmpStoreSave;
           Type = DmpStoreSave;
-          File = ShellCommandLineGetValue(Package, L"-s");
+          File = ShellCommandLineGetValue (Package, L"-s");
           if (File == NULL) {
           if (File == NULL) {
-            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-s");
+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-s");
             ShellStatus = SHELL_INVALID_PARAMETER;
             ShellStatus = SHELL_INVALID_PARAMETER;
           } else {
           } else {
             Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_WRITE | EFI_FILE_MODE_READ, 0);
             Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_WRITE | EFI_FILE_MODE_READ, 0);
@@ -778,6 +845,7 @@ ShellCommandRunDmpStore (
                     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_DELETE_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
                     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_DELETE_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
                   }
                   }
                 }
                 }
+
                 FreePool (FileInfo);
                 FreePool (FileInfo);
               }
               }
             } else if (Status == EFI_NOT_FOUND) {
             } else if (Status == EFI_NOT_FOUND) {
@@ -803,16 +871,16 @@ ShellCommandRunDmpStore (
               ShellStatus = SHELL_INVALID_PARAMETER;
               ShellStatus = SHELL_INVALID_PARAMETER;
             }
             }
           }
           }
-        } else if (ShellCommandLineGetFlag(Package, L"-l")) {
+        } else if (ShellCommandLineGetFlag (Package, L"-l")) {
           Type = DmpStoreLoad;
           Type = DmpStoreLoad;
-          File = ShellCommandLineGetValue(Package, L"-l");
+          File = ShellCommandLineGetValue (Package, L"-l");
           if (File == NULL) {
           if (File == NULL) {
-            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-l");
+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-l");
             ShellStatus = SHELL_INVALID_PARAMETER;
             ShellStatus = SHELL_INVALID_PARAMETER;
           } else {
           } else {
             Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_READ, 0);
             Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_READ, 0);
             if (EFI_ERROR (Status)) {
             if (EFI_ERROR (Status)) {
-              ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
+              ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
               ShellStatus = SHELL_INVALID_PARAMETER;
               ShellStatus = SHELL_INVALID_PARAMETER;
             } else {
             } else {
               FileInfo = ShellGetFileInfo (FileHandle);
               FileInfo = ShellGetFileInfo (FileHandle);
@@ -824,15 +892,16 @@ ShellCommandRunDmpStore (
                   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, L"dmpstore", File);
                   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, L"dmpstore", File);
                   ShellStatus = SHELL_INVALID_PARAMETER;
                   ShellStatus = SHELL_INVALID_PARAMETER;
                 }
                 }
+
                 FreePool (FileInfo);
                 FreePool (FileInfo);
               }
               }
             }
             }
           }
           }
-        } else if (ShellCommandLineGetFlag(Package, L"-d")) {
+        } else if (ShellCommandLineGetFlag (Package, L"-d")) {
           Type = DmpStoreDelete;
           Type = DmpStoreDelete;
         }
         }
 
 
-        if (ShellCommandLineGetFlag (Package,L"-sfo")) {
+        if (ShellCommandLineGetFlag (Package, L"-sfo")) {
           StandardFormatOutput = TRUE;
           StandardFormatOutput = TRUE;
         }
         }
       }
       }
@@ -843,6 +912,7 @@ ShellCommandRunDmpStore (
         } else if (Type == DmpStoreLoad) {
         } else if (Type == DmpStoreLoad) {
           ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD), gShellDebug1HiiHandle, File);
           ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD), gShellDebug1HiiHandle, File);
         }
         }
+
         ShellStatus = ProcessVariables (Name, Guid, Type, FileHandle, StandardFormatOutput);
         ShellStatus = ProcessVariables (Name, Guid, Type, FileHandle, StandardFormatOutput);
         if ((Type == DmpStoreLoad) || (Type == DmpStoreSave)) {
         if ((Type == DmpStoreLoad) || (Type == DmpStoreSave)) {
           ShellCloseFile (&FileHandle);
           ShellCloseFile (&FileHandle);
@@ -854,6 +924,6 @@ ShellCommandRunDmpStore (
   if (Package != NULL) {
   if (Package != NULL) {
     ShellCommandLineFreeVarList (Package);
     ShellCommandLineFreeVarList (Package);
   }
   }
+
   return ShellStatus;
   return ShellStatus;
 }
 }
-

+ 48 - 43
ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c

@@ -23,16 +23,17 @@ ShellCommandRunEdit (
   IN EFI_SYSTEM_TABLE  *SystemTable
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
   )
 {
 {
-  EFI_STATUS          Status;
-  CHAR16              *Buffer;
-  CHAR16              *ProblemParam;
-  SHELL_STATUS        ShellStatus;
-  LIST_ENTRY          *Package;
-  CONST CHAR16        *Cwd;
-  CHAR16              *Nfs;
-  CHAR16              *Spot;
-  CONST CHAR16        *TempParam;
-//  SHELL_FILE_HANDLE   TempHandle;
+  EFI_STATUS    Status;
+  CHAR16        *Buffer;
+  CHAR16        *ProblemParam;
+  SHELL_STATUS  ShellStatus;
+  LIST_ENTRY    *Package;
+  CONST CHAR16  *Cwd;
+  CHAR16        *Nfs;
+  CHAR16        *Spot;
+  CONST CHAR16  *TempParam;
+
+  //  SHELL_FILE_HANDLE   TempHandle;
 
 
   Buffer      = NULL;
   Buffer      = NULL;
   ShellStatus = SHELL_SUCCESS;
   ShellStatus = SHELL_SUCCESS;
@@ -41,45 +42,47 @@ ShellCommandRunEdit (
   //
   //
   // initialize the shell lib (we must be in non-auto-init...)
   // initialize the shell lib (we must be in non-auto-init...)
   //
   //
-  Status = ShellInitialize();
-  ASSERT_EFI_ERROR(Status);
+  Status = ShellInitialize ();
+  ASSERT_EFI_ERROR (Status);
 
 
-  Status = CommandInit();
-  ASSERT_EFI_ERROR(Status);
+  Status = CommandInit ();
+  ASSERT_EFI_ERROR (Status);
 
 
   //
   //
   // parse the command line
   // parse the command line
   //
   //
   Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
   Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
-  if (EFI_ERROR(Status)) {
-    if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam);
-      FreePool(ProblemParam);
+  if (EFI_ERROR (Status)) {
+    if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam);
+      FreePool (ProblemParam);
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
-      ASSERT(FALSE);
+      ASSERT (FALSE);
     }
     }
   } else {
   } else {
-    if (ShellCommandLineGetCount(Package) > 2) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"edit");
+    if (ShellCommandLineGetCount (Package) > 2) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"edit");
       ShellStatus = SHELL_INVALID_PARAMETER;
       ShellStatus = SHELL_INVALID_PARAMETER;
     } else {
     } else {
-      Cwd = gEfiShellProtocol->GetCurDir(NULL);
+      Cwd = gEfiShellProtocol->GetCurDir (NULL);
       if (Cwd == NULL) {
       if (Cwd == NULL) {
-        Cwd = ShellGetEnvironmentVariable(L"path");
+        Cwd = ShellGetEnvironmentVariable (L"path");
         if (Cwd != NULL) {
         if (Cwd != NULL) {
-          Nfs = StrnCatGrow(&Nfs, NULL, Cwd+3, 0);
+          Nfs = StrnCatGrow (&Nfs, NULL, Cwd+3, 0);
           if (Nfs != NULL) {
           if (Nfs != NULL) {
-            Spot = StrStr(Nfs, L";");
+            Spot = StrStr (Nfs, L";");
             if (Spot != NULL) {
             if (Spot != NULL) {
               *Spot = CHAR_NULL;
               *Spot = CHAR_NULL;
             }
             }
-            Spot = StrStr(Nfs, L"\\");
+
+            Spot = StrStr (Nfs, L"\\");
             if (Spot != NULL) {
             if (Spot != NULL) {
               Spot[1] = CHAR_NULL;
               Spot[1] = CHAR_NULL;
             }
             }
-            gEfiShellProtocol->SetCurDir(NULL, Nfs);
-            FreePool(Nfs);
+
+            gEfiShellProtocol->SetCurDir (NULL, Nfs);
+            FreePool (Nfs);
           }
           }
         }
         }
       }
       }
@@ -89,23 +92,23 @@ ShellCommandRunEdit (
       if (EFI_ERROR (Status)) {
       if (EFI_ERROR (Status)) {
         gST->ConOut->ClearScreen (gST->ConOut);
         gST->ConOut->ClearScreen (gST->ConOut);
         gST->ConOut->EnableCursor (gST->ConOut, TRUE);
         gST->ConOut->EnableCursor (gST->ConOut, TRUE);
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_INIT_FAILED), gShellDebug1HiiHandle);
+        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_MAIN_INIT_FAILED), gShellDebug1HiiHandle);
       } else {
       } else {
         MainEditorBackup ();
         MainEditorBackup ();
 
 
         //
         //
         // if editor launched with file named
         // if editor launched with file named
         //
         //
-        if (ShellCommandLineGetCount(Package) == 2) {
-          TempParam = ShellCommandLineGetRawValue(Package, 1);
-          ASSERT(TempParam != NULL);
+        if (ShellCommandLineGetCount (Package) == 2) {
+          TempParam = ShellCommandLineGetRawValue (Package, 1);
+          ASSERT (TempParam != NULL);
           FileBufferSetFileName (TempParam);
           FileBufferSetFileName (TempParam);
-//          if (EFI_ERROR(ShellFileExists(MainEditor.FileBuffer->FileName))) {
-//            Status = ShellOpenFileByName(MainEditor.FileBuffer->FileName, &TempHandle, EFI_FILE_MODE_CREATE|EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
-//            if (!EFI_ERROR(Status)) {
-//              ShellCloseFile(&TempHandle);
-//            }
-//          }
+          //          if (EFI_ERROR(ShellFileExists(MainEditor.FileBuffer->FileName))) {
+          //            Status = ShellOpenFileByName(MainEditor.FileBuffer->FileName, &TempHandle, EFI_FILE_MODE_CREATE|EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
+          //            if (!EFI_ERROR(Status)) {
+          //              ShellCloseFile(&TempHandle);
+          //            }
+          //          }
         }
         }
 
 
         Status = FileBufferRead (MainEditor.FileBuffer->FileName, FALSE);
         Status = FileBufferRead (MainEditor.FileBuffer->FileName, FALSE);
@@ -119,7 +122,7 @@ ShellCommandRunEdit (
           //
           //
           // back up the status string
           // back up the status string
           //
           //
-          Buffer = CatSPrint (NULL, L"%s", StatusBarGetString());
+          Buffer = CatSPrint (NULL, L"%s", StatusBarGetString ());
         }
         }
 
 
         MainEditorCleanup ();
         MainEditorCleanup ();
@@ -129,19 +132,19 @@ ShellCommandRunEdit (
         //
         //
         if (Status == EFI_SUCCESS) {
         if (Status == EFI_SUCCESS) {
         } else if (Status == EFI_OUT_OF_RESOURCES) {
         } else if (Status == EFI_OUT_OF_RESOURCES) {
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"edit");
+          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"edit");
         } else {
         } else {
           if (Buffer != NULL) {
           if (Buffer != NULL) {
             if (StrCmp (Buffer, L"") != 0) {
             if (StrCmp (Buffer, L"") != 0) {
               //
               //
               // print out the status string
               // print out the status string
               //
               //
-              ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_BUFFER), gShellDebug1HiiHandle, Buffer);
+              ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_MAIN_BUFFER), gShellDebug1HiiHandle, Buffer);
             } else {
             } else {
-              ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle);
+              ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle);
             }
             }
           } else {
           } else {
-            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle);
+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle);
           }
           }
         }
         }
 
 
@@ -150,7 +153,9 @@ ShellCommandRunEdit (
         }
         }
       }
       }
     }
     }
+
     ShellCommandLineFreeVarList (Package);
     ShellCommandLineFreeVarList (Package);
   }
   }
+
   return ShellStatus;
   return ShellStatus;
 }
 }

File diff suppressed because it is too large
+ 232 - 205
ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c


Some files were not shown because too many files changed in this diff