Browse Source

DynamicTablesPkg: Apply uncrustify changes

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

Apply uncrustify changes to .c/.h files in the DynamicTablesPkg 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: Sami Mujawar <sami.mujawar@arm.com>
Michael Kubacki 2 years ago
parent
commit
731c67e1d7
85 changed files with 5244 additions and 4732 deletions
  1. 20 9
      DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/AcpiTableFactory/AcpiTableFactory.c
  2. 20 9
      DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DeviceTreeTableFactory/DeviceTreeTableFactory.c
  3. 18 18
      DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory.h
  4. 7 6
      DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
  5. 20 9
      DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/SmbiosTableFactory/SmbiosTableFactory.c
  6. 93 80
      DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
  7. 32 33
      DynamicTablesPkg/Include/AcpiTableGenerator.h
  8. 188 187
      DynamicTablesPkg/Include/ArmNameSpaceObjects.h
  9. 9 9
      DynamicTablesPkg/Include/ConfigurationManagerObject.h
  10. 14 15
      DynamicTablesPkg/Include/DeviceTreeTableGenerator.h
  11. 9 9
      DynamicTablesPkg/Include/Library/AcpiHelperLib.h
  12. 73 73
      DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
  13. 8 8
      DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h
  14. 17 17
      DynamicTablesPkg/Include/Library/TableHelperLib.h
  15. 13 13
      DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h
  16. 35 35
      DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h
  17. 16 16
      DynamicTablesPkg/Include/SmbiosTableGenerator.h
  18. 8 8
      DynamicTablesPkg/Include/StandardNameSpaceObjects.h
  19. 7 8
      DynamicTablesPkg/Include/TableGenerator.h
  20. 85 79
      DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
  21. 35 30
      DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
  22. 112 104
      DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
  23. 262 249
      DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
  24. 4 4
      DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.h
  25. 104 100
      DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
  26. 42 37
      DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
  27. 195 189
      DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
  28. 23 23
      DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h
  29. 12 10
      DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
  30. 38 33
      DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
  31. 126 119
      DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c
  32. 99 90
      DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.c
  33. 6 6
      DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.h
  34. 109 102
      DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
  35. 12 12
      DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h
  36. 37 33
      DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortGenerator.c
  37. 18 17
      DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelper.c
  38. 57 57
      DynamicTablesPkg/Library/Common/AmlLib/AmlCoreInterface.h
  39. 70 54
      DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c
  40. 13 13
      DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h
  41. 6 6
      DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h
  42. 237 221
      DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c
  43. 41 40
      DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.h
  44. 12 12
      DynamicTablesPkg/Library/Common/AmlLib/AmlNodeDefines.h
  45. 49 34
      DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
  46. 28 25
      DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.c
  47. 9 9
      DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.h
  48. 49 36
      DynamicTablesPkg/Library/Common/AmlLib/Api/AmlResourceDataApi.c
  49. 243 210
      DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
  50. 48 43
      DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
  51. 3 3
      DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.h
  52. 256 229
      DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c
  53. 5 5
      DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.h
  54. 44 39
      DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c
  55. 3 3
      DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.h
  56. 237 208
      DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c
  57. 19 19
      DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.h
  58. 231 206
      DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c
  59. 6 6
      DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.h
  60. 58 39
      DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c
  61. 3 4
      DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h
  62. 15 13
      DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.c
  63. 9 9
      DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.h
  64. 59 52
      DynamicTablesPkg/Library/Common/AmlLib/Serialize/AmlSerialize.c
  65. 85 69
      DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.c
  66. 41 41
      DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.h
  67. 119 104
      DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.c
  68. 43 43
      DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.h
  69. 38 36
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c
  70. 88 71
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c
  71. 21 21
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.h
  72. 77 53
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNodeInterface.c
  73. 163 129
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.c
  74. 11 12
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.h
  75. 14 12
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeEnumerator.c
  76. 63 51
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.c
  77. 16 17
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.h
  78. 66 55
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.c
  79. 6 7
      DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.h
  80. 178 148
      DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.c
  81. 14 15
      DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h
  82. 54 49
      DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
  83. 358 354
      DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
  84. 11 13
      DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h
  85. 42 38
      DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c

+ 20 - 9
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/AcpiTableFactory/AcpiTableFactory.c

@@ -22,7 +22,7 @@
 
 #include "DynamicTableFactory.h"
 
-extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
+extern EDKII_DYNAMIC_TABLE_FACTORY_INFO  TableFactoryInfo;
 
 /** Return a pointer to the ACPI table generator.
 
@@ -40,13 +40,13 @@ extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
 EFI_STATUS
 EFIAPI
 GetAcpiTableGenerator (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  This,
   IN  CONST ACPI_TABLE_GENERATOR_ID                       GeneratorId,
-  OUT CONST ACPI_TABLE_GENERATOR                 ** CONST Generator
+  OUT CONST ACPI_TABLE_GENERATOR                 **CONST  Generator
   )
 {
-  UINT16                           TableId;
-  EDKII_DYNAMIC_TABLE_FACTORY_INFO * FactoryInfo;
+  UINT16                            TableId;
+  EDKII_DYNAMIC_TABLE_FACTORY_INFO  *FactoryInfo;
 
   ASSERT (This != NULL);
 
@@ -63,12 +63,13 @@ GetAcpiTableGenerator (
   }
 
   *Generator = NULL;
-  TableId = GET_TABLE_ID (GeneratorId);
+  TableId    = GET_TABLE_ID (GeneratorId);
   if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) {
     if (TableId >= EStdAcpiTableIdMax) {
       ASSERT (TableId < EStdAcpiTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (FactoryInfo->StdAcpiTableGeneratorList[TableId] != NULL) {
       *Generator = FactoryInfo->StdAcpiTableGeneratorList[TableId];
     } else {
@@ -79,12 +80,14 @@ GetAcpiTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (FactoryInfo->CustomAcpiTableGeneratorList[TableId] != NULL) {
       *Generator = FactoryInfo->CustomAcpiTableGeneratorList[TableId];
     } else {
       return EFI_NOT_FOUND;
     }
   }
+
   return EFI_SUCCESS;
 }
 
@@ -105,7 +108,7 @@ GetAcpiTableGenerator (
 EFI_STATUS
 EFIAPI
 RegisterAcpiTableGenerator (
-  IN  CONST ACPI_TABLE_GENERATOR                * CONST Generator
+  IN  CONST ACPI_TABLE_GENERATOR                *CONST  Generator
   )
 {
   UINT16  TableId;
@@ -132,6 +135,7 @@ RegisterAcpiTableGenerator (
       ASSERT (TableId < EStdAcpiTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.StdAcpiTableGeneratorList[TableId] == NULL) {
       TableFactoryInfo.StdAcpiTableGeneratorList[TableId] = Generator;
     } else {
@@ -142,12 +146,14 @@ RegisterAcpiTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] == NULL) {
       TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] = Generator;
     } else {
       return EFI_ALREADY_STARTED;
     }
   }
+
   return EFI_SUCCESS;
 }
 
@@ -166,7 +172,7 @@ RegisterAcpiTableGenerator (
 EFI_STATUS
 EFIAPI
 DeregisterAcpiTableGenerator (
-  IN  CONST ACPI_TABLE_GENERATOR                * CONST Generator
+  IN  CONST ACPI_TABLE_GENERATOR                *CONST  Generator
   )
 {
   UINT16  TableId;
@@ -191,10 +197,12 @@ DeregisterAcpiTableGenerator (
       ASSERT (TableId < EStdAcpiTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.StdAcpiTableGeneratorList[TableId] != NULL) {
       if (Generator != TableFactoryInfo.StdAcpiTableGeneratorList[TableId]) {
         return EFI_INVALID_PARAMETER;
       }
+
       TableFactoryInfo.StdAcpiTableGeneratorList[TableId] = NULL;
     } else {
       return EFI_NOT_FOUND;
@@ -204,11 +212,14 @@ DeregisterAcpiTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomACPIGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] != NULL) {
       if (Generator !=
-          TableFactoryInfo.CustomAcpiTableGeneratorList[TableId]) {
+          TableFactoryInfo.CustomAcpiTableGeneratorList[TableId])
+      {
         return EFI_INVALID_PARAMETER;
       }
+
       TableFactoryInfo.CustomAcpiTableGeneratorList[TableId] = NULL;
     } else {
       return EFI_NOT_FOUND;

+ 20 - 9
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DeviceTreeTableFactory/DeviceTreeTableFactory.c

@@ -21,7 +21,7 @@
 
 #include "DynamicTableFactory.h"
 
-extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
+extern EDKII_DYNAMIC_TABLE_FACTORY_INFO  TableFactoryInfo;
 
 /** Return a pointer to the DT table generator.
 
@@ -39,13 +39,13 @@ extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
 EFI_STATUS
 EFIAPI
 GetDtTableGenerator (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  This,
   IN  CONST DT_TABLE_GENERATOR_ID                         GeneratorId,
-  OUT CONST DT_TABLE_GENERATOR                   ** CONST Generator
+  OUT CONST DT_TABLE_GENERATOR                   **CONST  Generator
   )
 {
-  UINT16                             TableId;
-  EDKII_DYNAMIC_TABLE_FACTORY_INFO * FactoryInfo;
+  UINT16                            TableId;
+  EDKII_DYNAMIC_TABLE_FACTORY_INFO  *FactoryInfo;
 
   ASSERT (This != NULL);
 
@@ -62,12 +62,13 @@ GetDtTableGenerator (
   }
 
   *Generator = NULL;
-  TableId = GET_TABLE_ID (GeneratorId);
+  TableId    = GET_TABLE_ID (GeneratorId);
   if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) {
     if (TableId >= EStdDtTableIdMax) {
       ASSERT (TableId < EStdDtTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (FactoryInfo->StdDtTableGeneratorList[TableId] != NULL) {
       *Generator = FactoryInfo->StdDtTableGeneratorList[TableId];
     } else {
@@ -78,12 +79,14 @@ GetDtTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (FactoryInfo->CustomDtTableGeneratorList[TableId] != NULL) {
       *Generator = FactoryInfo->CustomDtTableGeneratorList[TableId];
     } else {
       return EFI_NOT_FOUND;
     }
   }
+
   return EFI_SUCCESS;
 }
 
@@ -104,7 +107,7 @@ GetDtTableGenerator (
 EFI_STATUS
 EFIAPI
 RegisterDtTableGenerator (
-  IN  CONST DT_TABLE_GENERATOR                * CONST Generator
+  IN  CONST DT_TABLE_GENERATOR                *CONST  Generator
   )
 {
   UINT16  TableId;
@@ -131,6 +134,7 @@ RegisterDtTableGenerator (
       ASSERT (TableId < EStdDtTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.StdDtTableGeneratorList[TableId] == NULL) {
       TableFactoryInfo.StdDtTableGeneratorList[TableId] = Generator;
     } else {
@@ -141,12 +145,14 @@ RegisterDtTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.CustomDtTableGeneratorList[TableId] == NULL) {
       TableFactoryInfo.CustomDtTableGeneratorList[TableId] = Generator;
     } else {
       return EFI_ALREADY_STARTED;
     }
   }
+
   return EFI_SUCCESS;
 }
 
@@ -165,7 +171,7 @@ RegisterDtTableGenerator (
 EFI_STATUS
 EFIAPI
 DeregisterDtTableGenerator (
-  IN  CONST DT_TABLE_GENERATOR                * CONST Generator
+  IN  CONST DT_TABLE_GENERATOR                *CONST  Generator
   )
 {
   UINT16  TableId;
@@ -190,10 +196,12 @@ DeregisterDtTableGenerator (
       ASSERT (TableId < EStdDtTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.StdDtTableGeneratorList[TableId] != NULL) {
       if (Generator != TableFactoryInfo.StdDtTableGeneratorList[TableId]) {
         return EFI_INVALID_PARAMETER;
       }
+
       TableFactoryInfo.StdDtTableGeneratorList[TableId] = NULL;
     } else {
       return EFI_NOT_FOUND;
@@ -203,11 +211,14 @@ DeregisterDtTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomDTGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.CustomDtTableGeneratorList[TableId] != NULL) {
       if (Generator !=
-          TableFactoryInfo.CustomDtTableGeneratorList[TableId]) {
+          TableFactoryInfo.CustomDtTableGeneratorList[TableId])
+      {
         return EFI_INVALID_PARAMETER;
       }
+
       TableFactoryInfo.CustomDtTableGeneratorList[TableId] = NULL;
     } else {
       return EFI_NOT_FOUND;

+ 18 - 18
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory.h

@@ -22,33 +22,33 @@
 typedef struct DynamicTableFactoryInfo {
   /// An array for holding the list of Standard ACPI Table  Generators.
   CONST ACPI_TABLE_GENERATOR *
-          StdAcpiTableGeneratorList[EStdAcpiTableIdMax];
+        StdAcpiTableGeneratorList[EStdAcpiTableIdMax];
 
   /// An array for holding the list of Custom ACPI Table Generators.
   CONST ACPI_TABLE_GENERATOR *
-          CustomAcpiTableGeneratorList[FixedPcdGet16 (
-                                         PcdMaxCustomACPIGenerators
-                                         )];
+        CustomAcpiTableGeneratorList[FixedPcdGet16 (
+                                   PcdMaxCustomACPIGenerators
+                                   )];
 
   /// An array for holding the list of Standard SMBIOS Table Generators.
   CONST SMBIOS_TABLE_GENERATOR *
-          StdSmbiosTableGeneratorList[EStdSmbiosTableIdMax];
+        StdSmbiosTableGeneratorList[EStdSmbiosTableIdMax];
 
   /// An array for holding the list of Custom SMBIOS Table Generators.
   CONST SMBIOS_TABLE_GENERATOR *
-          CustomSmbiosTableGeneratorList[FixedPcdGet16 (
-                                           PcdMaxCustomSMBIOSGenerators
-                                           )];
+        CustomSmbiosTableGeneratorList[FixedPcdGet16 (
+                                     PcdMaxCustomSMBIOSGenerators
+                                     )];
 
   /// An array for holding the list of Standard DT Table Generators.
   CONST DT_TABLE_GENERATOR *
-          StdDtTableGeneratorList[EStdDtTableIdMax];
+        StdDtTableGeneratorList[EStdDtTableIdMax];
 
   /// An array for holding the list of Custom DT Table Generators.
   CONST DT_TABLE_GENERATOR *
-          CustomDtTableGeneratorList[FixedPcdGet16 (
-                                       PcdMaxCustomDTGenerators
-                                       )];
+        CustomDtTableGeneratorList[FixedPcdGet16 (
+                                 PcdMaxCustomDTGenerators
+                                 )];
 } EDKII_DYNAMIC_TABLE_FACTORY_INFO;
 
 /** Return a pointer to the ACPI table generator.
@@ -67,9 +67,9 @@ typedef struct DynamicTableFactoryInfo {
 EFI_STATUS
 EFIAPI
 GetAcpiTableGenerator (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  This,
   IN  CONST ACPI_TABLE_GENERATOR_ID                       GeneratorId,
-  OUT CONST ACPI_TABLE_GENERATOR                 ** CONST Generator
+  OUT CONST ACPI_TABLE_GENERATOR                 **CONST  Generator
   );
 
 /** Return a pointer to the SMBIOS table generator.
@@ -88,9 +88,9 @@ GetAcpiTableGenerator (
 EFI_STATUS
 EFIAPI
 GetSmbiosTableGenerator (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  This,
   IN  CONST SMBIOS_TABLE_GENERATOR_ID                     GeneratorId,
-  OUT CONST SMBIOS_TABLE_GENERATOR               ** CONST Generator
+  OUT CONST SMBIOS_TABLE_GENERATOR               **CONST  Generator
   );
 
 /** Return a pointer to the DT table generator.
@@ -109,9 +109,9 @@ GetSmbiosTableGenerator (
 EFI_STATUS
 EFIAPI
 GetDtTableGenerator (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  This,
   IN  CONST DT_TABLE_GENERATOR_ID                         GeneratorId,
-  OUT CONST DT_TABLE_GENERATOR                   ** CONST Generator
+  OUT CONST DT_TABLE_GENERATOR                   **CONST  Generator
   );
 
 #pragma pack()

+ 7 - 6
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c

@@ -27,14 +27,14 @@
 /** The Dynamic Table Factory protocol structure that holds the
     list of registered ACPI and SMBIOS table generators.
 */
-EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
+EDKII_DYNAMIC_TABLE_FACTORY_INFO  TableFactoryInfo;
 
 /** A structure describing the Dynamic Table Factory protocol.
 */
 STATIC
 CONST
-EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
-  CREATE_REVISION (1, 0),
+EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  DynamicTableFactoryProtocol = {
+  CREATE_REVISION (1,             0),
   GetAcpiTableGenerator,
   RegisterAcpiTableGenerator,
   DeregisterAcpiTableGenerator,
@@ -60,8 +60,8 @@ EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
 EFI_STATUS
 EFIAPI
 DynamicTableFactoryDxeInitialize (
-  IN  EFI_HANDLE            ImageHandle,
-  IN  EFI_SYSTEM_TABLE   *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
@@ -70,7 +70,7 @@ DynamicTableFactoryDxeInitialize (
                   &ImageHandle,
                   &gEdkiiDynamicTableFactoryProtocolGuid,
                   EFI_NATIVE_INTERFACE,
-                  (VOID*)&DynamicTableFactoryProtocol
+                  (VOID *)&DynamicTableFactoryProtocol
                   );
   if (EFI_ERROR (Status)) {
     DEBUG ((
@@ -80,5 +80,6 @@ DynamicTableFactoryDxeInitialize (
       Status
       ));
   }
+
   return Status;
 }

+ 20 - 9
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/SmbiosTableFactory/SmbiosTableFactory.c

@@ -22,7 +22,7 @@
 
 #include "DynamicTableFactory.h"
 
-extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
+extern EDKII_DYNAMIC_TABLE_FACTORY_INFO  TableFactoryInfo;
 
 /** Return a pointer to the SMBIOS table generator.
 
@@ -40,13 +40,13 @@ extern EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
 EFI_STATUS
 EFIAPI
 GetSmbiosTableGenerator (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  This,
   IN  CONST SMBIOS_TABLE_GENERATOR_ID                     GeneratorId,
-  OUT CONST SMBIOS_TABLE_GENERATOR               ** CONST Generator
+  OUT CONST SMBIOS_TABLE_GENERATOR               **CONST  Generator
   )
 {
-  UINT16                             TableId;
-  EDKII_DYNAMIC_TABLE_FACTORY_INFO * FactoryInfo;
+  UINT16                            TableId;
+  EDKII_DYNAMIC_TABLE_FACTORY_INFO  *FactoryInfo;
 
   ASSERT (This != NULL);
 
@@ -63,12 +63,13 @@ GetSmbiosTableGenerator (
   }
 
   *Generator = NULL;
-  TableId = GET_TABLE_ID (GeneratorId);
+  TableId    = GET_TABLE_ID (GeneratorId);
   if (IS_GENERATOR_NAMESPACE_STD (GeneratorId)) {
     if (TableId >= EStdSmbiosTableIdMax) {
       ASSERT (TableId < EStdSmbiosTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (FactoryInfo->StdSmbiosTableGeneratorList[TableId] != NULL) {
       *Generator = FactoryInfo->StdSmbiosTableGeneratorList[TableId];
     } else {
@@ -79,12 +80,14 @@ GetSmbiosTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (FactoryInfo->CustomSmbiosTableGeneratorList[TableId] != NULL) {
       *Generator = FactoryInfo->CustomSmbiosTableGeneratorList[TableId];
     } else {
       return EFI_NOT_FOUND;
     }
   }
+
   return EFI_SUCCESS;
 }
 
@@ -105,7 +108,7 @@ GetSmbiosTableGenerator (
 EFI_STATUS
 EFIAPI
 RegisterSmbiosTableGenerator (
-  IN  CONST SMBIOS_TABLE_GENERATOR              * CONST Generator
+  IN  CONST SMBIOS_TABLE_GENERATOR              *CONST  Generator
   )
 {
   UINT16  TableId;
@@ -132,6 +135,7 @@ RegisterSmbiosTableGenerator (
       ASSERT (TableId < EStdSmbiosTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] == NULL) {
       TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] = Generator;
     } else {
@@ -142,12 +146,14 @@ RegisterSmbiosTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] == NULL) {
       TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] = Generator;
     } else {
       return EFI_ALREADY_STARTED;
     }
   }
+
   return EFI_SUCCESS;
 }
 
@@ -166,7 +172,7 @@ RegisterSmbiosTableGenerator (
 EFI_STATUS
 EFIAPI
 DeregisterSmbiosTableGenerator (
-  IN  CONST SMBIOS_TABLE_GENERATOR              * CONST Generator
+  IN  CONST SMBIOS_TABLE_GENERATOR              *CONST  Generator
   )
 {
   UINT16  TableId;
@@ -191,10 +197,12 @@ DeregisterSmbiosTableGenerator (
       ASSERT (TableId < EStdSmbiosTableIdMax);
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] != NULL) {
       if (Generator != TableFactoryInfo.StdSmbiosTableGeneratorList[TableId]) {
         return EFI_INVALID_PARAMETER;
       }
+
       TableFactoryInfo.StdSmbiosTableGeneratorList[TableId] = NULL;
     } else {
       return EFI_NOT_FOUND;
@@ -204,11 +212,14 @@ DeregisterSmbiosTableGenerator (
       ASSERT (TableId <= FixedPcdGet16 (PcdMaxCustomSMBIOSGenerators));
       return EFI_INVALID_PARAMETER;
     }
+
     if (TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] != NULL) {
       if (Generator !=
-          TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId]) {
+          TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId])
+      {
         return EFI_INVALID_PARAMETER;
       }
+
       TableFactoryInfo.CustomSmbiosTableGeneratorList[TableId] = NULL;
     } else {
       return EFI_NOT_FOUND;

+ 93 - 80
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c

@@ -56,25 +56,25 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildAndInstallSingleAcpiTable (
-  IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST TableFactoryProtocol,
-  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN CONST ACPI_TABLE_GENERATOR                  * CONST Generator,
-  IN       EFI_ACPI_TABLE_PROTOCOL               *       AcpiTableProtocol,
-  IN CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo
+  IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  TableFactoryProtocol,
+  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN CONST ACPI_TABLE_GENERATOR                  *CONST  Generator,
+  IN       EFI_ACPI_TABLE_PROTOCOL                       *AcpiTableProtocol,
+  IN CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo
   )
 {
-  EFI_STATUS                    Status;
-  EFI_STATUS                    Status1;
-  EFI_ACPI_DESCRIPTION_HEADER * AcpiTable;
-  UINTN                         TableHandle;
+  EFI_STATUS                   Status;
+  EFI_STATUS                   Status1;
+  EFI_ACPI_DESCRIPTION_HEADER  *AcpiTable;
+  UINTN                        TableHandle;
 
   AcpiTable = NULL;
-  Status = Generator->BuildAcpiTable (
-                        Generator,
-                        AcpiTableInfo,
-                        CfgMgrProtocol,
-                        &AcpiTable
-                        );
+  Status    = Generator->BuildAcpiTable (
+                           Generator,
+                           AcpiTableInfo,
+                           CfgMgrProtocol,
+                           &AcpiTable
+                           );
   if (EFI_ERROR (Status)) {
     DEBUG ((
       DEBUG_ERROR,
@@ -122,11 +122,11 @@ exit_handler:
   // Free any resources allocated for generating the tables.
   if (Generator->FreeTableResources != NULL) {
     Status1 = Generator->FreeTableResources (
-                          Generator,
-                          AcpiTableInfo,
-                          CfgMgrProtocol,
-                          &AcpiTable
-                          );
+                           Generator,
+                           AcpiTableInfo,
+                           CfgMgrProtocol,
+                           &AcpiTable
+                           );
     if (EFI_ERROR (Status1)) {
       DEBUG ((
         DEBUG_ERROR,
@@ -142,6 +142,7 @@ exit_handler:
       Status = Status1;
     }
   }
+
   return Status;
 }
 
@@ -170,29 +171,29 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildAndInstallMultipleAcpiTable (
-  IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST TableFactoryProtocol,
-  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN CONST ACPI_TABLE_GENERATOR                  * CONST Generator,
-  IN       EFI_ACPI_TABLE_PROTOCOL               *       AcpiTableProtocol,
-  IN CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo
+  IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  TableFactoryProtocol,
+  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN CONST ACPI_TABLE_GENERATOR                  *CONST  Generator,
+  IN       EFI_ACPI_TABLE_PROTOCOL                       *AcpiTableProtocol,
+  IN CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo
   )
 {
-  EFI_STATUS                     Status;
-  EFI_STATUS                     Status1;
-  EFI_ACPI_DESCRIPTION_HEADER ** AcpiTable;
-  UINTN                          TableCount;
-  UINTN                          TableHandle;
-  UINTN                          Index;
-
-  AcpiTable = NULL;
+  EFI_STATUS                   Status;
+  EFI_STATUS                   Status1;
+  EFI_ACPI_DESCRIPTION_HEADER  **AcpiTable;
+  UINTN                        TableCount;
+  UINTN                        TableHandle;
+  UINTN                        Index;
+
+  AcpiTable  = NULL;
   TableCount = 0;
-  Status = Generator->BuildAcpiTableEx (
-                        Generator,
-                        AcpiTableInfo,
-                        CfgMgrProtocol,
-                        &AcpiTable,
-                        &TableCount
-                        );
+  Status     = Generator->BuildAcpiTableEx (
+                            Generator,
+                            AcpiTableInfo,
+                            CfgMgrProtocol,
+                            &AcpiTable,
+                            &TableCount
+                            );
   if (EFI_ERROR (Status)) {
     DEBUG ((
       DEBUG_ERROR,
@@ -241,12 +242,12 @@ exit_handler:
   // Free any resources allocated for generating the tables.
   if (Generator->FreeTableResourcesEx != NULL) {
     Status1 = Generator->FreeTableResourcesEx (
-                          Generator,
-                          AcpiTableInfo,
-                          CfgMgrProtocol,
-                          &AcpiTable,
-                          TableCount
-                          );
+                           Generator,
+                           AcpiTableInfo,
+                           CfgMgrProtocol,
+                           &AcpiTable,
+                           TableCount
+                           );
     if (EFI_ERROR (Status1)) {
       DEBUG ((
         DEBUG_ERROR,
@@ -262,6 +263,7 @@ exit_handler:
       Status = Status1;
     }
   }
+
   return Status;
 }
 
@@ -289,14 +291,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildAndInstallAcpiTable (
-  IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST TableFactoryProtocol,
-  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN       EFI_ACPI_TABLE_PROTOCOL               *       AcpiTableProtocol,
-  IN CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo
+  IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  TableFactoryProtocol,
+  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN       EFI_ACPI_TABLE_PROTOCOL                       *AcpiTableProtocol,
+  IN CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo
   )
 {
-  EFI_STATUS                    Status;
-  CONST ACPI_TABLE_GENERATOR  * Generator;
+  EFI_STATUS                  Status;
+  CONST ACPI_TABLE_GENERATOR  *Generator;
 
   ASSERT (TableFactoryProtocol != NULL);
   ASSERT (CfgMgrProtocol != NULL);
@@ -312,11 +314,11 @@ BuildAndInstallAcpiTable (
     ));
 
   Generator = NULL;
-  Status = TableFactoryProtocol->GetAcpiTableGenerator (
-                                   TableFactoryProtocol,
-                                   AcpiTableInfo->TableGeneratorId,
-                                   &Generator
-                                   );
+  Status    = TableFactoryProtocol->GetAcpiTableGenerator (
+                                      TableFactoryProtocol,
+                                      AcpiTableInfo->TableGeneratorId,
+                                      &Generator
+                                      );
   if (EFI_ERROR (Status)) {
     DEBUG ((
       DEBUG_ERROR,
@@ -398,7 +400,7 @@ STATIC
 EFI_STATUS
 EFIAPI
 VerifyMandatoryTablesArePresent (
-  IN CONST CM_STD_OBJ_ACPI_TABLE_INFO  * CONST AcpiTableInfo,
+  IN CONST CM_STD_OBJ_ACPI_TABLE_INFO  *CONST  AcpiTableInfo,
   IN       UINT32                              AcpiTableCount
   )
 {
@@ -410,7 +412,7 @@ VerifyMandatoryTablesArePresent (
   BOOLEAN     Dbg2Found;
   BOOLEAN     SpcrFound;
 
-  Status = EFI_SUCCESS;
+  Status    = EFI_SUCCESS;
   FadtFound = FALSE;
   MadtFound = FALSE;
   GtdtFound = FALSE;
@@ -446,27 +448,33 @@ VerifyMandatoryTablesArePresent (
 
   // We need at least the FADT, MADT, GTDT and the DSDT tables to boot
   if (!FadtFound) {
-    DEBUG ((DEBUG_ERROR,"ERROR: FADT Table not found\n"));
+    DEBUG ((DEBUG_ERROR, "ERROR: FADT Table not found\n"));
     Status = EFI_NOT_FOUND;
   }
+
   if (!MadtFound) {
     DEBUG ((DEBUG_ERROR, "ERROR: MADT Table not found.\n"));
     Status = EFI_NOT_FOUND;
   }
+
   if (!GtdtFound) {
     DEBUG ((DEBUG_ERROR, "ERROR: GTDT Table not found.\n"));
     Status = EFI_NOT_FOUND;
   }
+
   if (!DsdtFound) {
     DEBUG ((DEBUG_ERROR, "ERROR: DSDT Table not found.\n"));
     Status = EFI_NOT_FOUND;
   }
+
   if (!Dbg2Found) {
     DEBUG ((DEBUG_WARN, "WARNING: DBG2 Table not found.\n"));
   }
+
   if (!SpcrFound) {
     DEBUG ((DEBUG_WARN, "WARNING: SPCR Table not found.\n"));
   }
+
   return Status;
 }
 
@@ -488,15 +496,15 @@ STATIC
 EFI_STATUS
 EFIAPI
 ProcessAcpiTables (
-  IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST TableFactoryProtocol,
-  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol
+  IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST  TableFactoryProtocol,
+  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol
   )
 {
-  EFI_STATUS                    Status;
-  EFI_ACPI_TABLE_PROTOCOL     * AcpiTableProtocol;
-  CM_STD_OBJ_ACPI_TABLE_INFO  * AcpiTableInfo;
-  UINT32                        AcpiTableCount;
-  UINT32                        Idx;
+  EFI_STATUS                  Status;
+  EFI_ACPI_TABLE_PROTOCOL     *AcpiTableProtocol;
+  CM_STD_OBJ_ACPI_TABLE_INFO  *AcpiTableInfo;
+  UINT32                      AcpiTableCount;
+  UINT32                      Idx;
 
   ASSERT (TableFactoryProtocol != NULL);
   ASSERT (CfgMgrProtocol != NULL);
@@ -505,7 +513,7 @@ ProcessAcpiTables (
   Status = gBS->LocateProtocol (
                   &gEfiAcpiTableProtocolGuid,
                   NULL,
-                  (VOID**)&AcpiTableProtocol
+                  (VOID **)&AcpiTableProtocol
                   );
   if (EFI_ERROR (Status)) {
     DEBUG ((
@@ -564,7 +572,8 @@ ProcessAcpiTables (
   // Add the FADT Table first.
   for (Idx = 0; Idx < AcpiTableCount; Idx++) {
     if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
-        AcpiTableInfo[Idx].TableGeneratorId) {
+        AcpiTableInfo[Idx].TableGeneratorId)
+    {
       Status = BuildAndInstallAcpiTable (
                  TableFactoryProtocol,
                  CfgMgrProtocol,
@@ -580,6 +589,7 @@ ProcessAcpiTables (
           ));
         return Status;
       }
+
       break;
     }
   } // for
@@ -595,16 +605,18 @@ ProcessAcpiTables (
 
     // Skip FADT Table since we have already added
     if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
-        AcpiTableInfo[Idx].TableGeneratorId) {
+        AcpiTableInfo[Idx].TableGeneratorId)
+    {
       continue;
     }
 
     // Skip the Reserved table Generator ID for standard generators
     if ((IS_GENERATOR_NAMESPACE_STD (AcpiTableInfo[Idx].TableGeneratorId)) &&
         ((CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdReserved)           >=
-            AcpiTableInfo[Idx].TableGeneratorId)                           ||
+          AcpiTableInfo[Idx].TableGeneratorId)                           ||
          (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMax)                <=
-            AcpiTableInfo[Idx].TableGeneratorId))) {
+          AcpiTableInfo[Idx].TableGeneratorId)))
+    {
       DEBUG ((
         DEBUG_WARN,
         "WARNING: Invalid ACPI Generator table ID = 0x%x, Skipping...\n",
@@ -655,20 +667,20 @@ ProcessAcpiTables (
 EFI_STATUS
 EFIAPI
 DynamicTableManagerDxeInitialize (
-  IN  EFI_HANDLE            ImageHandle,
-  IN  EFI_SYSTEM_TABLE   *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
-  EFI_STATUS                                 Status;
-  EDKII_CONFIGURATION_MANAGER_PROTOCOL     * CfgMgrProtocol;
-  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO    * CfgMfrInfo;
-  EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL     * TableFactoryProtocol;
+  EFI_STATUS                             Status;
+  EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CfgMgrProtocol;
+  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO  *CfgMfrInfo;
+  EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL   *TableFactoryProtocol;
 
   // Locate the Dynamic Table Factory
   Status = gBS->LocateProtocol (
                   &gEdkiiDynamicTableFactoryProtocolGuid,
                   NULL,
-                  (VOID**)&TableFactoryProtocol
+                  (VOID **)&TableFactoryProtocol
                   );
   if (EFI_ERROR (Status)) {
     DEBUG ((
@@ -684,7 +696,7 @@ DynamicTableManagerDxeInitialize (
   Status = gBS->LocateProtocol (
                   &gEdkiiConfigurationManagerProtocolGuid,
                   NULL,
-                  (VOID**)&CfgMgrProtocol
+                  (VOID **)&CfgMgrProtocol
                   );
   if (EFI_ERROR (Status)) {
     DEBUG ((
@@ -725,5 +737,6 @@ DynamicTableManagerDxeInitialize (
       Status
       ));
   }
+
   return Status;
 }

+ 32 - 33
DynamicTablesPkg/Include/AcpiTableGenerator.h

@@ -160,7 +160,7 @@ typedef enum StdAcpiTableId {
   @param [in] Type      The ACPI table structure.
   @param [in] Revision  The ACPI table revision.
 **/
-#define ACPI_HEADER(Signature, Type, Revision) {              \
+#define ACPI_HEADER(Signature, Type, Revision)  {             \
           Signature,             /* UINT32  Signature */      \
           sizeof (Type),         /* UINT32  Length */         \
           Revision,              /* UINT8   Revision */       \
@@ -169,7 +169,7 @@ typedef enum StdAcpiTableId {
           0,                     /* UINT64  OemTableId */     \
           0,                     /* UINT32  OemRevision */    \
           0,                     /* UINT32  CreatorId */      \
-          0                      /* UINT32  CreatorRevision */\
+          0                      /* UINT32  CreatorRevision */ \
           }
 
 /** A macro to dump the common header part of EFI ACPI tables as
@@ -209,10 +209,10 @@ typedef struct AcpiTableGenerator           ACPI_TABLE_GENERATOR;
                         failure codes as returned by the generator.
 **/
 typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLE) (
-  IN  CONST ACPI_TABLE_GENERATOR                   *       This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER           **       Table
+  IN  CONST ACPI_TABLE_GENERATOR                           *This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER                    **Table
   );
 
 /** This function pointer describes the interface used by the
@@ -229,10 +229,10 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLE) (
                         as returned by the generator.
 **/
 typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLE) (
-  IN      CONST ACPI_TABLE_GENERATOR                   * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER           ** CONST Table
+  IN      CONST ACPI_TABLE_GENERATOR                   *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER           **CONST  Table
   );
 
 /** This function pointer describes an extended interface to build
@@ -252,11 +252,11 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLE) (
                         failure codes as returned by the generator.
 **/
 typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLEEX) (
-  IN  CONST ACPI_TABLE_GENERATOR                   *       This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ***       Table,
-  OUT       UINTN                                  * CONST TableCount
+  IN  CONST ACPI_TABLE_GENERATOR                           *This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER                    ***Table,
+  OUT       UINTN                                  *CONST  TableCount
   );
 
 /** This function pointer describes an extended interface used by the
@@ -275,10 +275,10 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLEEX) (
                         as returned by the generator.
 **/
 typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLEEX) (
-  IN      CONST ACPI_TABLE_GENERATOR                   * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          *** CONST Table,
+  IN      CONST ACPI_TABLE_GENERATOR                   *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ***CONST  Table,
   IN      CONST UINTN                                          TableCount
   );
 
@@ -293,42 +293,42 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLEEX) (
 **/
 typedef struct AcpiTableGenerator {
   /// The ACPI table generator ID.
-  ACPI_TABLE_GENERATOR_ID                GeneratorID;
+  ACPI_TABLE_GENERATOR_ID               GeneratorID;
 
   /// String describing the ACPI table generator.
-  CONST CHAR16                         * Description;
+  CONST CHAR16                          *Description;
 
   /// The ACPI table signature.
-  UINT32                                 AcpiTableSignature;
+  UINT32                                AcpiTableSignature;
 
   /// The ACPI table revision.
-  UINT8                                  AcpiTableRevision;
+  UINT8                                 AcpiTableRevision;
 
   /// The minimum supported ACPI table revision.
-  UINT8                                  MinAcpiTableRevision;
+  UINT8                                 MinAcpiTableRevision;
 
   /// The ACPI table creator ID.
-  UINT32                                 CreatorId;
+  UINT32                                CreatorId;
 
   /// The ACPI table creator revision.
-  UINT32                                 CreatorRevision;
+  UINT32                                CreatorRevision;
 
   /// ACPI table build function pointer.
-  ACPI_TABLE_GENERATOR_BUILD_TABLE       BuildAcpiTable;
+  ACPI_TABLE_GENERATOR_BUILD_TABLE      BuildAcpiTable;
 
   /** The function to free any resources
       allocated for building the ACPI table.
   */
-  ACPI_TABLE_GENERATOR_FREE_TABLE        FreeTableResources;
+  ACPI_TABLE_GENERATOR_FREE_TABLE       FreeTableResources;
 
   /// ACPI table extended build function pointer.
-  ACPI_TABLE_GENERATOR_BUILD_TABLEEX     BuildAcpiTableEx;
+  ACPI_TABLE_GENERATOR_BUILD_TABLEEX    BuildAcpiTableEx;
 
   /** The function to free any resources
       allocated for building the ACPI table
       using the extended interface.
   */
-  ACPI_TABLE_GENERATOR_FREE_TABLEEX      FreeTableResourcesEx;
+  ACPI_TABLE_GENERATOR_FREE_TABLEEX     FreeTableResourcesEx;
 } ACPI_TABLE_GENERATOR;
 
 /** Register ACPI table factory generator.
@@ -348,7 +348,7 @@ typedef struct AcpiTableGenerator {
 EFI_STATUS
 EFIAPI
 RegisterAcpiTableGenerator (
-  IN CONST ACPI_TABLE_GENERATOR                 * CONST Generator
+  IN CONST ACPI_TABLE_GENERATOR                 *CONST  Generator
   );
 
 /** Deregister ACPI generator.
@@ -366,10 +366,9 @@ RegisterAcpiTableGenerator (
 EFI_STATUS
 EFIAPI
 DeregisterAcpiTableGenerator (
-  IN CONST ACPI_TABLE_GENERATOR                 * CONST Generator
+  IN CONST ACPI_TABLE_GENERATOR                 *CONST  Generator
   );
 
 #pragma pack()
 
 #endif // ACPI_TABLE_GENERATOR_H_
-

+ 188 - 187
DynamicTablesPkg/Include/ArmNameSpaceObjects.h

@@ -71,7 +71,7 @@ typedef struct CmArmBootArchInfo {
   /** This is the ARM_BOOT_ARCH flags field of the FADT Table
       described in the ACPI Table Specification.
   */
-  UINT16  BootArchFlags;
+  UINT16    BootArchFlags;
 } CM_ARM_BOOT_ARCH_INFO;
 
 /** A structure that describes the
@@ -83,7 +83,7 @@ typedef struct CmArmPowerManagementProfileInfo {
   /** This is the Preferred_PM_Profile field of the FADT Table
       described in the ACPI Specification
   */
-  UINT8  PowerManagementProfile;
+  UINT8    PowerManagementProfile;
 } CM_ARM_POWER_MANAGEMENT_PROFILE_INFO;
 
 /** A structure that describes the
@@ -93,99 +93,99 @@ typedef struct CmArmPowerManagementProfileInfo {
 */
 typedef struct CmArmGicCInfo {
   /// The GIC CPU Interface number.
-  UINT32  CPUInterfaceNumber;
+  UINT32    CPUInterfaceNumber;
 
   /** The ACPI Processor UID. This must match the
       _UID of the CPU Device object information described
       in the DSDT/SSDT for the CPU.
   */
-  UINT32  AcpiProcessorUid;
+  UINT32    AcpiProcessorUid;
 
   /** The flags field as described by the GICC structure
       in the ACPI Specification.
   */
-  UINT32  Flags;
+  UINT32    Flags;
 
   /** The parking protocol version field as described by
     the GICC structure in the ACPI Specification.
   */
-  UINT32  ParkingProtocolVersion;
+  UINT32    ParkingProtocolVersion;
 
   /** The Performance Interrupt field as described by
       the GICC structure in the ACPI Specification.
   */
-  UINT32  PerformanceInterruptGsiv;
+  UINT32    PerformanceInterruptGsiv;
 
   /** The CPU Parked address field as described by
       the GICC structure in the ACPI Specification.
   */
-  UINT64  ParkedAddress;
+  UINT64    ParkedAddress;
 
   /** The base address for the GIC CPU Interface
       as described by the GICC structure in the
       ACPI Specification.
   */
-  UINT64  PhysicalBaseAddress;
+  UINT64    PhysicalBaseAddress;
 
   /** The base address for GICV interface
       as described by the GICC structure in the
       ACPI Specification.
   */
-  UINT64  GICV;
+  UINT64    GICV;
 
   /** The base address for GICH interface
       as described by the GICC structure in the
       ACPI Specification.
   */
-  UINT64  GICH;
+  UINT64    GICH;
 
   /** The GICV maintenance interrupt
       as described by the GICC structure in the
       ACPI Specification.
   */
-  UINT32  VGICMaintenanceInterrupt;
+  UINT32    VGICMaintenanceInterrupt;
 
   /** The base address for GICR interface
       as described by the GICC structure in the
       ACPI Specification.
   */
-  UINT64  GICRBaseAddress;
+  UINT64    GICRBaseAddress;
 
   /** The MPIDR for the CPU
       as described by the GICC structure in the
       ACPI Specification.
   */
-  UINT64  MPIDR;
+  UINT64    MPIDR;
 
   /** The Processor Power Efficiency class
       as described by the GICC structure in the
       ACPI Specification.
   */
-  UINT8   ProcessorPowerEfficiencyClass;
+  UINT8     ProcessorPowerEfficiencyClass;
 
   /** Statistical Profiling Extension buffer overflow GSIV. Zero if
       unsupported by this processor. This field was introduced in
       ACPI 6.3 (MADT revision 5) and is therefore ignored when
       generating MADT revision 4 or lower.
   */
-  UINT16  SpeOverflowInterrupt;
+  UINT16    SpeOverflowInterrupt;
 
   /** The proximity domain to which the logical processor belongs.
       This field is used to populate the GICC affinity structure
       in the SRAT table.
   */
-  UINT32  ProximityDomain;
+  UINT32    ProximityDomain;
 
   /** The clock domain to which the logical processor belongs.
       This field is used to populate the GICC affinity structure
       in the SRAT table.
   */
-  UINT32  ClockDomain;
+  UINT32    ClockDomain;
 
   /** The GICC Affinity flags field as described by the GICC Affinity structure
       in the SRAT table.
   */
-  UINT32  AffinityFlags;
+  UINT32    AffinityFlags;
 } CM_ARM_GICC_INFO;
 
 /** A structure that describes the
@@ -195,19 +195,19 @@ typedef struct CmArmGicCInfo {
 */
 typedef struct CmArmGicDInfo {
   /// The Physical Base address for the GIC Distributor.
-  UINT64  PhysicalBaseAddress;
+  UINT64    PhysicalBaseAddress;
 
   /** The global system interrupt
       number where this GIC Distributor's
       interrupt inputs start.
   */
-  UINT32  SystemVectorBase;
+  UINT32    SystemVectorBase;
 
   /** The GIC version as described
       by the GICD structure in the
       ACPI Specification.
   */
-  UINT8   GicVersion;
+  UINT8     GicVersion;
 } CM_ARM_GICD_INFO;
 
 /** A structure that describes the
@@ -217,22 +217,22 @@ typedef struct CmArmGicDInfo {
 */
 typedef struct CmArmGicMsiFrameInfo {
   /// The GIC MSI Frame ID
-  UINT32  GicMsiFrameId;
+  UINT32    GicMsiFrameId;
 
   /// The Physical base address for the MSI Frame
-  UINT64  PhysicalBaseAddress;
+  UINT64    PhysicalBaseAddress;
 
   /** The GIC MSI Frame flags
       as described by the GIC MSI frame
       structure in the ACPI Specification.
   */
-  UINT32  Flags;
+  UINT32    Flags;
 
   /// SPI Count used by this frame
-  UINT16  SPICount;
+  UINT16    SPICount;
 
   /// SPI Base used by this frame
-  UINT16  SPIBase;
+  UINT16    SPIBase;
 } CM_ARM_GIC_MSI_FRAME_INFO;
 
 /** A structure that describes the
@@ -244,10 +244,10 @@ typedef struct CmArmGicRedistInfo {
   /** The physical address of a page range
       containing all GIC Redistributors.
   */
-  UINT64  DiscoveryRangeBaseAddress;
+  UINT64    DiscoveryRangeBaseAddress;
 
   /// Length of the GIC Redistributor Discovery page range
-  UINT32  DiscoveryRangeLength;
+  UINT32    DiscoveryRangeLength;
 } CM_ARM_GIC_REDIST_INFO;
 
 /** A structure that describes the
@@ -257,16 +257,16 @@ typedef struct CmArmGicRedistInfo {
 */
 typedef struct CmArmGicItsInfo {
   /// The GIC ITS ID
-  UINT32  GicItsId;
+  UINT32    GicItsId;
 
   /// The physical address for the Interrupt Translation Service
-  UINT64  PhysicalBaseAddress;
+  UINT64    PhysicalBaseAddress;
 
   /** The proximity domain to which the logical processor belongs.
       This field is used to populate the GIC ITS affinity structure
       in the SRAT table.
   */
-  UINT32  ProximityDomain;
+  UINT32    ProximityDomain;
 } CM_ARM_GIC_ITS_INFO;
 
 /** A structure that describes the
@@ -278,25 +278,25 @@ typedef struct CmArmGicItsInfo {
 */
 typedef struct CmArmSerialPortInfo {
   /// The physical base address for the serial port
-  UINT64  BaseAddress;
+  UINT64    BaseAddress;
 
   /// The serial port interrupt
-  UINT32  Interrupt;
+  UINT32    Interrupt;
 
   /// The serial port baud rate
-  UINT64  BaudRate;
+  UINT64    BaudRate;
 
   /// The serial port clock
-  UINT32  Clock;
+  UINT32    Clock;
 
   /// Serial Port subtype
-  UINT16  PortSubtype;
+  UINT16    PortSubtype;
 
   /// The Base address length
-  UINT64  BaseAddressLength;
+  UINT64    BaseAddressLength;
 
   /// The access size
-  UINT8   AccessSize;
+  UINT8     AccessSize;
 } CM_ARM_SERIAL_PORT_INFO;
 
 /** A structure that describes the
@@ -306,40 +306,40 @@ typedef struct CmArmSerialPortInfo {
 */
 typedef struct CmArmGenericTimerInfo {
   /// The physical base address for the counter control frame
-  UINT64  CounterControlBaseAddress;
+  UINT64    CounterControlBaseAddress;
 
   /// The physical base address for the counter read frame
-  UINT64  CounterReadBaseAddress;
+  UINT64    CounterReadBaseAddress;
 
   /// The secure PL1 timer interrupt
-  UINT32  SecurePL1TimerGSIV;
+  UINT32    SecurePL1TimerGSIV;
 
   /// The secure PL1 timer flags
-  UINT32  SecurePL1TimerFlags;
+  UINT32    SecurePL1TimerFlags;
 
   /// The non-secure PL1 timer interrupt
-  UINT32  NonSecurePL1TimerGSIV;
+  UINT32    NonSecurePL1TimerGSIV;
 
   /// The non-secure PL1 timer flags
-  UINT32  NonSecurePL1TimerFlags;
+  UINT32    NonSecurePL1TimerFlags;
 
   /// The virtual timer interrupt
-  UINT32  VirtualTimerGSIV;
+  UINT32    VirtualTimerGSIV;
 
   /// The virtual timer flags
-  UINT32  VirtualTimerFlags;
+  UINT32    VirtualTimerFlags;
 
   /// The non-secure PL2 timer interrupt
-  UINT32  NonSecurePL2TimerGSIV;
+  UINT32    NonSecurePL2TimerGSIV;
 
   /// The non-secure PL2 timer flags
-  UINT32  NonSecurePL2TimerFlags;
+  UINT32    NonSecurePL2TimerFlags;
 
   /// GSIV for the virtual EL2 timer
-  UINT32  VirtualPL2TimerGSIV;
+  UINT32    VirtualPL2TimerGSIV;
 
   /// Flags for the virtual EL2 timer
-  UINT32  VirtualPL2TimerFlags;
+  UINT32    VirtualPL2TimerFlags;
 } CM_ARM_GENERIC_TIMER_INFO;
 
 /** A structure that describes the
@@ -349,34 +349,34 @@ typedef struct CmArmGenericTimerInfo {
 */
 typedef struct CmArmGTBlockTimerFrameInfo {
   /// The Generic Timer frame number
-  UINT8   FrameNumber;
+  UINT8     FrameNumber;
 
   /// The physical base address for the CntBase block
-  UINT64  PhysicalAddressCntBase;
+  UINT64    PhysicalAddressCntBase;
 
   /// The physical base address for the CntEL0Base block
-  UINT64  PhysicalAddressCntEL0Base;
+  UINT64    PhysicalAddressCntEL0Base;
 
   /// The physical timer interrupt
-  UINT32  PhysicalTimerGSIV;
+  UINT32    PhysicalTimerGSIV;
 
   /** The physical timer flags as described by the GT Block
       Timer frame Structure in the ACPI Specification.
   */
-  UINT32  PhysicalTimerFlags;
+  UINT32    PhysicalTimerFlags;
 
   /// The virtual timer interrupt
-  UINT32  VirtualTimerGSIV;
+  UINT32    VirtualTimerGSIV;
 
   /** The virtual timer flags as described by the GT Block
       Timer frame Structure in the ACPI Specification.
   */
-  UINT32  VirtualTimerFlags;
+  UINT32    VirtualTimerFlags;
 
   /** The common timer flags as described by the GT Block
       Timer frame Structure in the ACPI Specification.
   */
-  UINT32  CommonFlags;
+  UINT32    CommonFlags;
 } CM_ARM_GTBLOCK_TIMER_FRAME_INFO;
 
 /** A structure that describes the
@@ -386,13 +386,13 @@ typedef struct CmArmGTBlockTimerFrameInfo {
 */
 typedef struct CmArmGTBlockInfo {
   /// The physical base address for the GT Block Timer structure
-  UINT64            GTBlockPhysicalAddress;
+  UINT64             GTBlockPhysicalAddress;
 
   /// The number of timer frames implemented in the GT Block
-  UINT32            GTBlockTimerFrameCount;
+  UINT32             GTBlockTimerFrameCount;
 
   /// Reference token for the GT Block timer frame list
-  CM_OBJECT_TOKEN   GTBlockTimerFrameToken;
+  CM_OBJECT_TOKEN    GTBlockTimerFrameToken;
 } CM_ARM_GTBLOCK_INFO;
 
 /** A structure that describes the
@@ -402,18 +402,18 @@ typedef struct CmArmGTBlockInfo {
 */
 typedef struct CmArmGenericWatchdogInfo {
   /// The physical base address of the Arm Watchdog control frame
-  UINT64  ControlFrameAddress;
+  UINT64    ControlFrameAddress;
 
   /// The physical base address of the Arm Watchdog refresh frame
-  UINT64  RefreshFrameAddress;
+  UINT64    RefreshFrameAddress;
 
   /// The watchdog interrupt
-  UINT32  TimerGSIV;
+  UINT32    TimerGSIV;
 
   /** The flags for the watchdog as described by the Arm watchdog
       structure in the ACPI specification.
   */
-  UINT32  Flags;
+  UINT32    Flags;
 } CM_ARM_GENERIC_WATCHDOG_INFO;
 
 /** A structure that describes the
@@ -423,16 +423,16 @@ typedef struct CmArmGenericWatchdogInfo {
 */
 typedef struct CmArmPciConfigSpaceInfo {
   /// The physical base address for the PCI segment
-  UINT64  BaseAddress;
+  UINT64    BaseAddress;
 
   /// The PCI segment group number
-  UINT16  PciSegmentGroupNumber;
+  UINT16    PciSegmentGroupNumber;
 
   /// The start bus number
-  UINT8   StartBusNumber;
+  UINT8     StartBusNumber;
 
   /// The end bus number
-  UINT8   EndBusNumber;
+  UINT8     EndBusNumber;
 } CM_ARM_PCI_CONFIG_SPACE_INFO;
 
 /** A structure that describes the
@@ -442,7 +442,7 @@ typedef struct CmArmPciConfigSpaceInfo {
 */
 typedef struct CmArmHypervisorVendorId {
   /// The hypervisor Vendor ID
-  UINT64  HypervisorVendorId;
+  UINT64    HypervisorVendorId;
 } CM_ARM_HYPERVISOR_VENDOR_ID;
 
 /** A structure that describes the
@@ -452,7 +452,7 @@ typedef struct CmArmHypervisorVendorId {
 */
 typedef struct CmArmFixedFeatureFlags {
   /// The Fixed feature flags
-  UINT32  Flags;
+  UINT32    Flags;
 } CM_ARM_FIXED_FEATURE_FLAGS;
 
 /** A structure that describes the
@@ -462,11 +462,11 @@ typedef struct CmArmFixedFeatureFlags {
 */
 typedef struct CmArmItsGroupNode {
   /// An unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   /// The number of ITS identifiers in the ITS node
-  UINT32            ItsIdCount;
+  UINT32             ItsIdCount;
   /// Reference token for the ITS identifier array
-  CM_OBJECT_TOKEN   ItsIdToken;
+  CM_OBJECT_TOKEN    ItsIdToken;
 } CM_ARM_ITS_GROUP_NODE;
 
 /** A structure that describes the
@@ -476,28 +476,29 @@ typedef struct CmArmItsGroupNode {
 */
 typedef struct CmArmNamedComponentNode {
   /// An unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   /// Number of ID mappings
-  UINT32            IdMappingCount;
+  UINT32             IdMappingCount;
   /// Reference token for the ID mapping array
-  CM_OBJECT_TOKEN   IdMappingToken;
+  CM_OBJECT_TOKEN    IdMappingToken;
 
   /// Flags for the named component
-  UINT32            Flags;
+  UINT32             Flags;
 
   /// Memory access properties : Cache coherent attributes
-  UINT32            CacheCoherent;
+  UINT32             CacheCoherent;
   /// Memory access properties : Allocation hints
-  UINT8             AllocationHints;
+  UINT8              AllocationHints;
   /// Memory access properties : Memory access flags
-  UINT8             MemoryAccessFlags;
+  UINT8              MemoryAccessFlags;
 
   /// Memory access properties : Address size limit
-  UINT8             AddressSizeLimit;
+  UINT8              AddressSizeLimit;
+
   /** ASCII Null terminated string with the full path to
       the entry in the namespace for this object.
   */
-  CHAR8*            ObjectName;
+  CHAR8              *ObjectName;
 } CM_ARM_NAMED_COMPONENT_NODE;
 
 /** A structure that describes the
@@ -507,25 +508,25 @@ typedef struct CmArmNamedComponentNode {
 */
 typedef struct CmArmRootComplexNode {
   /// An unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   /// Number of ID mappings
-  UINT32            IdMappingCount;
+  UINT32             IdMappingCount;
   /// Reference token for the ID mapping array
-  CM_OBJECT_TOKEN   IdMappingToken;
+  CM_OBJECT_TOKEN    IdMappingToken;
 
   /// Memory access properties : Cache coherent attributes
-  UINT32            CacheCoherent;
+  UINT32             CacheCoherent;
   /// Memory access properties : Allocation hints
-  UINT8             AllocationHints;
+  UINT8              AllocationHints;
   /// Memory access properties : Memory access flags
-  UINT8             MemoryAccessFlags;
+  UINT8              MemoryAccessFlags;
 
   /// ATS attributes
-  UINT32            AtsAttribute;
+  UINT32             AtsAttribute;
   /// PCI segment number
-  UINT32            PciSegmentNumber;
+  UINT32             PciSegmentNumber;
   /// Memory address size limit
-  UINT8             MemoryAddressSize;
+  UINT8              MemoryAddressSize;
 } CM_ARM_ROOT_COMPLEX_NODE;
 
 /** A structure that describes the
@@ -535,39 +536,39 @@ typedef struct CmArmRootComplexNode {
 */
 typedef struct CmArmSmmuV1SmmuV2Node {
   /// An unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   /// Number of ID mappings
-  UINT32            IdMappingCount;
+  UINT32             IdMappingCount;
   /// Reference token for the ID mapping array
-  CM_OBJECT_TOKEN   IdMappingToken;
+  CM_OBJECT_TOKEN    IdMappingToken;
 
   /// SMMU Base Address
-  UINT64            BaseAddress;
+  UINT64             BaseAddress;
   /// Length of the memory range covered by the SMMU
-  UINT64            Span;
+  UINT64             Span;
   /// SMMU Model
-  UINT32            Model;
+  UINT32             Model;
   /// SMMU flags
-  UINT32            Flags;
+  UINT32             Flags;
 
   /// Number of context interrupts
-  UINT32            ContextInterruptCount;
+  UINT32             ContextInterruptCount;
   /// Reference token for the context interrupt array
-  CM_OBJECT_TOKEN   ContextInterruptToken;
+  CM_OBJECT_TOKEN    ContextInterruptToken;
 
   /// Number of PMU interrupts
-  UINT32            PmuInterruptCount;
+  UINT32             PmuInterruptCount;
   /// Reference token for the PMU interrupt array
-  CM_OBJECT_TOKEN   PmuInterruptToken;
+  CM_OBJECT_TOKEN    PmuInterruptToken;
 
   /// GSIV of the SMMU_NSgIrpt interrupt
-  UINT32            SMMU_NSgIrpt;
+  UINT32             SMMU_NSgIrpt;
   /// SMMU_NSgIrpt interrupt flags
-  UINT32            SMMU_NSgIrptFlags;
+  UINT32             SMMU_NSgIrptFlags;
   /// GSIV of the SMMU_NSgCfgIrpt interrupt
-  UINT32            SMMU_NSgCfgIrpt;
+  UINT32             SMMU_NSgCfgIrpt;
   /// SMMU_NSgCfgIrpt interrupt flags
-  UINT32            SMMU_NSgCfgIrptFlags;
+  UINT32             SMMU_NSgCfgIrptFlags;
 } CM_ARM_SMMUV1_SMMUV2_NODE;
 
 /** A structure that describes the
@@ -577,33 +578,33 @@ typedef struct CmArmSmmuV1SmmuV2Node {
 */
 typedef struct CmArmSmmuV3Node {
   /// An unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   /// Number of ID mappings
-  UINT32            IdMappingCount;
+  UINT32             IdMappingCount;
   /// Reference token for the ID mapping array
-  CM_OBJECT_TOKEN   IdMappingToken;
+  CM_OBJECT_TOKEN    IdMappingToken;
 
   /// SMMU Base Address
-  UINT64    BaseAddress;
+  UINT64             BaseAddress;
   /// SMMU flags
-  UINT32            Flags;
+  UINT32             Flags;
   /// VATOS address
-  UINT64            VatosAddress;
+  UINT64             VatosAddress;
   /// Model
-  UINT32            Model;
+  UINT32             Model;
   /// GSIV of the Event interrupt if SPI based
-  UINT32            EventInterrupt;
+  UINT32             EventInterrupt;
   /// PRI Interrupt if SPI based
-  UINT32            PriInterrupt;
+  UINT32             PriInterrupt;
   /// GERR interrupt if GSIV based
-  UINT32            GerrInterrupt;
+  UINT32             GerrInterrupt;
   /// Sync interrupt if GSIV based
-  UINT32            SyncInterrupt;
+  UINT32             SyncInterrupt;
 
   /// Proximity domain flag
-  UINT32            ProximityDomain;
+  UINT32             ProximityDomain;
   /// Index into the array of ID mapping
-  UINT32            DeviceIdMappingIndex;
+  UINT32             DeviceIdMappingIndex;
 } CM_ARM_SMMUV3_NODE;
 
 /** A structure that describes the
@@ -613,21 +614,21 @@ typedef struct CmArmSmmuV3Node {
 */
 typedef struct CmArmPmcgNode {
   /// An unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   /// Number of ID mappings
-  UINT32            IdMappingCount;
+  UINT32             IdMappingCount;
   /// Reference token for the ID mapping array
-  CM_OBJECT_TOKEN   IdMappingToken;
+  CM_OBJECT_TOKEN    IdMappingToken;
 
   /// Base Address for performance monitor counter group
-  UINT64            BaseAddress;
+  UINT64             BaseAddress;
   /// GSIV for the Overflow interrupt
-  UINT32            OverflowInterrupt;
+  UINT32             OverflowInterrupt;
   /// Page 1 Base address
-  UINT64            Page1BaseAddress;
+  UINT64             Page1BaseAddress;
 
   /// Reference token for the IORT node associated with this node
-  CM_OBJECT_TOKEN   ReferenceToken;
+  CM_OBJECT_TOKEN    ReferenceToken;
 } CM_ARM_PMCG_NODE;
 
 /** A structure that describes the
@@ -637,7 +638,7 @@ typedef struct CmArmPmcgNode {
 */
 typedef struct CmArmGicItsIdentifier {
   /// The ITS Identifier
-  UINT32  ItsId;
+  UINT32    ItsId;
 } CM_ARM_ITS_IDENTIFIER;
 
 /** A structure that describes the
@@ -647,15 +648,15 @@ typedef struct CmArmGicItsIdentifier {
 */
 typedef struct CmArmIdMapping {
   /// Input base
-  UINT32           InputBase;
+  UINT32             InputBase;
   /// Number of input IDs
-  UINT32           NumIds;
+  UINT32             NumIds;
   /// Output Base
-  UINT32           OutputBase;
+  UINT32             OutputBase;
   /// Reference token for the output node
-  CM_OBJECT_TOKEN  OutputReferenceToken;
+  CM_OBJECT_TOKEN    OutputReferenceToken;
   /// Flags
-  UINT32    Flags;
+  UINT32             Flags;
 } CM_ARM_ID_MAPPING;
 
 /** A structure that describes the Arm
@@ -694,28 +695,28 @@ typedef CM_ARM_GENERIC_INTERRUPT CM_ARM_EXTENDED_INTERRUPT;
 */
 typedef struct CmArmProcHierarchyInfo {
   /// A unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   /// Processor structure flags (ACPI 6.3 - January 2019, PPTT, Table 5-155)
-  UINT32            Flags;
+  UINT32             Flags;
   /// Token for the parent CM_ARM_PROC_HIERARCHY_INFO object in the processor
   /// topology. A value of CM_NULL_TOKEN means this node has no parent.
-  CM_OBJECT_TOKEN   ParentToken;
+  CM_OBJECT_TOKEN    ParentToken;
   /// Token of the associated CM_ARM_GICC_INFO object which has the
   /// corresponding ACPI Processor ID. A value of CM_NULL_TOKEN means this
   /// node represents a group of associated processors and it does not have an
   /// associated GIC CPU interface.
-  CM_OBJECT_TOKEN   GicCToken;
+  CM_OBJECT_TOKEN    GicCToken;
   /// Number of resources private to this Node
-  UINT32            NoOfPrivateResources;
+  UINT32             NoOfPrivateResources;
   /// Token of the array which contains references to the resources private to
   /// this CM_ARM_PROC_HIERARCHY_INFO instance. This field is ignored if
   /// the NoOfPrivateResources is 0, in which case it is recommended to set
   /// this field to CM_NULL_TOKEN.
-  CM_OBJECT_TOKEN   PrivateResourcesArrayToken;
+  CM_OBJECT_TOKEN    PrivateResourcesArrayToken;
   /// Optional field: Reference Token for the Lpi state of this processor.
   /// Token identifying a CM_ARM_OBJ_REF structure, itself referencing
   /// CM_ARM_LPI_INFO objects.
-  CM_OBJECT_TOKEN   LpiToken;
+  CM_OBJECT_TOKEN    LpiToken;
 } CM_ARM_PROC_HIERARCHY_INFO;
 
 /** A structure that describes the Cache Type Structure (Type 1) in PPTT
@@ -724,26 +725,26 @@ typedef struct CmArmProcHierarchyInfo {
 */
 typedef struct CmArmCacheInfo {
   /// A unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   /// Reference token for the next level of cache that is private to the same
   /// CM_ARM_PROC_HIERARCHY_INFO instance. A value of CM_NULL_TOKEN means this
   /// entry represents the last cache level appropriate to the processor
   /// hierarchy node structures using this entry.
-  CM_OBJECT_TOKEN   NextLevelOfCacheToken;
+  CM_OBJECT_TOKEN    NextLevelOfCacheToken;
   /// Size of the cache in bytes
-  UINT32            Size;
+  UINT32             Size;
   /// Number of sets in the cache
-  UINT32            NumberOfSets;
+  UINT32             NumberOfSets;
   /// Integer number of ways. The maximum associativity supported by
   /// ACPI Cache type structure is limited to MAX_UINT8. However,
   /// the maximum number of ways supported by the architecture is
   /// PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX. Therfore this field
   /// is 32-bit wide.
-  UINT32            Associativity;
+  UINT32             Associativity;
   /// Cache attributes (ACPI 6.3 - January 2019, PPTT, Table 5-156)
-  UINT8             Attributes;
+  UINT8              Attributes;
   /// Line size in bytes
-  UINT16            LineSize;
+  UINT16             LineSize;
 } CM_ARM_CACHE_INFO;
 
 /** A structure that describes the ID Structure (Type 2) in PPTT
@@ -752,19 +753,19 @@ typedef struct CmArmCacheInfo {
 */
 typedef struct CmArmProcNodeIdInfo {
   /// A unique token used to identify this object
-  CM_OBJECT_TOKEN   Token;
+  CM_OBJECT_TOKEN    Token;
   // Vendor ID (as described in ACPI ID registry)
-  UINT32            VendorId;
+  UINT32             VendorId;
   /// First level unique node ID
-  UINT64            Level1Id;
+  UINT64             Level1Id;
   /// Second level unique node ID
-  UINT64            Level2Id;
+  UINT64             Level2Id;
   /// Major revision of the node
-  UINT16            MajorRev;
+  UINT16             MajorRev;
   /// Minor revision of the node
-  UINT16            MinorRev;
+  UINT16             MinorRev;
   /// Spin revision of the node
-  UINT16            SpinRev;
+  UINT16             SpinRev;
 } CM_ARM_PROC_NODE_ID_INFO;
 
 /** A structure that describes a reference to another Configuration Manager
@@ -780,7 +781,7 @@ typedef struct CmArmProcNodeIdInfo {
 */
 typedef struct CmArmObjRef {
   /// Token of the CM object being referenced
-  CM_OBJECT_TOKEN   ReferenceToken;
+  CM_OBJECT_TOKEN    ReferenceToken;
 } CM_ARM_OBJ_REF;
 
 /** A structure that describes the Memory Affinity Structure (Type 1) in SRAT
@@ -789,16 +790,16 @@ typedef struct CmArmObjRef {
 */
 typedef struct CmArmMemoryAffinityInfo {
   /// The proximity domain to which the "range of memory" belongs.
-  UINT32            ProximityDomain;
+  UINT32    ProximityDomain;
 
   /// Base Address
-  UINT64            BaseAddress;
+  UINT64    BaseAddress;
 
   /// Length
-  UINT64            Length;
+  UINT64    Length;
 
   /// Flags
-  UINT32            Flags;
+  UINT32    Flags;
 } CM_ARM_MEMORY_AFFINITY_INFO;
 
 /** A structure that describes the ACPI Device Handle (Type 0) in the
@@ -808,10 +809,10 @@ typedef struct CmArmMemoryAffinityInfo {
 */
 typedef struct CmArmDeviceHandleAcpi {
   /// Hardware ID
-  UINT64  Hid;
+  UINT64    Hid;
 
   /// Unique Id
-  UINT32  Uid;
+  UINT32    Uid;
 } CM_ARM_DEVICE_HANDLE_ACPI;
 
 /** A structure that describes the PCI Device Handle (Type 1) in the
@@ -821,16 +822,16 @@ typedef struct CmArmDeviceHandleAcpi {
 */
 typedef struct CmArmDeviceHandlePci {
   /// PCI Segment Number
-  UINT16  SegmentNumber;
+  UINT16    SegmentNumber;
 
   /// PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
-  UINT8  BusNumber;
+  UINT8     BusNumber;
 
   /// PCI Device Number - Max 32 devices (Bits 7:3 of BDF)
-  UINT8   DeviceNumber;
+  UINT8     DeviceNumber;
 
   /// PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
-  UINT8   FunctionNumber;
+  UINT8     FunctionNumber;
 } CM_ARM_DEVICE_HANDLE_PCI;
 
 /** A structure that describes the Generic Initiator Affinity structure in SRAT
@@ -839,16 +840,16 @@ typedef struct CmArmDeviceHandlePci {
 */
 typedef struct CmArmGenericInitiatorAffinityInfo {
   /// The proximity domain to which the generic initiator belongs.
-  UINT32            ProximityDomain;
+  UINT32             ProximityDomain;
 
   /// Flags
-  UINT32            Flags;
+  UINT32             Flags;
 
   /// Device Handle Type
-  UINT8             DeviceHandleType;
+  UINT8              DeviceHandleType;
 
   /// Reference Token for the Device Handle
-  CM_OBJECT_TOKEN   DeviceHandleToken;
+  CM_OBJECT_TOKEN    DeviceHandleToken;
 } CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO;
 
 /** A structure that describes the CMN-600 hardware.
@@ -858,19 +859,19 @@ typedef struct CmArmGenericInitiatorAffinityInfo {
 typedef struct CmArmCmn600Info {
   /// The PERIPHBASE address.
   /// Corresponds to the Configuration Node Region (CFGR) base address.
-  UINT64                     PeriphBaseAddress;
+  UINT64    PeriphBaseAddress;
 
   /// The PERIPHBASE address length.
   /// Corresponds to the CFGR base address length.
-  UINT64                     PeriphBaseAddressLength;
+  UINT64    PeriphBaseAddressLength;
 
   /// The ROOTNODEBASE address.
   /// Corresponds to the Root node (ROOT) base address.
-  UINT64                     RootNodeBaseAddress;
+  UINT64    RootNodeBaseAddress;
 
   /// The Debug and Trace Logic Controller (DTC) count.
   /// CMN-600 can have maximum 4 DTCs.
-  UINT8                      DtcCount;
+  UINT8     DtcCount;
 
   /// DTC Interrupt list.
   /// The first interrupt resource descriptor pertains to
@@ -880,7 +881,7 @@ typedef struct CmArmCmn600Info {
   /// and DtcInterrupt[3] are ignored.
   /// Note: The size of CM_ARM_CMN_600_INFO structure remains
   /// constant and does not vary with the DTC count.
-  CM_ARM_EXTENDED_INTERRUPT  DtcInterrupt[4];
+  CM_ARM_EXTENDED_INTERRUPT    DtcInterrupt[4];
 } CM_ARM_CMN_600_INFO;
 
 /** A structure that describes the Lpi information.
@@ -894,28 +895,28 @@ typedef struct CmArmLpiInfo {
   /** Minimum Residency. Time in microseconds after which a
       state becomes more energy efficient than any shallower state.
   */
-  UINT32                                  MinResidency;
+  UINT32                                    MinResidency;
 
   /** Worst case time in microseconds from a wake interrupt
       being asserted to the return to a running state
   */
-  UINT32                                  WorstCaseWakeLatency;
+  UINT32                                    WorstCaseWakeLatency;
 
   /** Flags.
   */
-  UINT32                                  Flags;
+  UINT32                                    Flags;
 
   /** Architecture specific context loss flags.
   */
-  UINT32                                  ArchFlags;
+  UINT32                                    ArchFlags;
 
   /** Residency counter frequency in cycles-per-second (Hz).
   */
-  UINT32                                  ResCntFreq;
+  UINT32                                    ResCntFreq;
 
   /** Every shallower power state in the parent is also enabled.
   */
-  UINT32                                  EnableParentState;
+  UINT32                                    EnableParentState;
 
   /** The EntryMethod _LPI field can be described as an integer
       or in a Register resource data descriptor.
@@ -923,27 +924,27 @@ typedef struct CmArmLpiInfo {
   If IsInteger is TRUE, the IntegerEntryMethod field is used.
   If IsInteger is FALSE, the RegisterEntryMethod field is used.
   */
-  BOOLEAN                                 IsInteger;
+  BOOLEAN                                   IsInteger;
 
   /** EntryMethod described as an Integer.
   */
-  UINT64                                  IntegerEntryMethod;
+  UINT64                                    IntegerEntryMethod;
 
   /** EntryMethod described as a EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR.
   */
-  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  RegisterEntryMethod;
+  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE    RegisterEntryMethod;
 
   /** Residency counter register.
   */
-  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  ResidencyCounterRegister;
+  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE    ResidencyCounterRegister;
 
   /** Usage counter register.
   */
-  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  UsageCounterRegister;
+  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE    UsageCounterRegister;
 
   /** String representing the Lpi state
   */
-  CHAR8                                   StateName[16];
+  CHAR8                                     StateName[16];
 } CM_ARM_LPI_INFO;
 
 #pragma pack()

+ 9 - 9
DynamicTablesPkg/Include/ConfigurationManagerObject.h

@@ -82,19 +82,19 @@ Object ID's in the ARM Namespace:
   29 - Processor Hierarchy Node ID Info
   30 - CM Object Reference
 */
-typedef UINT32  CM_OBJECT_ID;
+typedef UINT32 CM_OBJECT_ID;
 
 /** A mask for Object ID
 */
-#define OBJECT_ID_MASK            0xFF
+#define OBJECT_ID_MASK  0xFF
 
 /** A mask for Namespace ID
 */
-#define NAMESPACE_ID_MASK         0xF
+#define NAMESPACE_ID_MASK  0xF
 
 /** Starting bit position for Namespace ID
 */
-#define NAMESPACE_ID_BIT_SHIFT    28
+#define NAMESPACE_ID_BIT_SHIFT  28
 
 /** The EOBJECT_NAMESPACE_ID enum describes the defined namespaces
     for the Configuration Manager Objects.
@@ -113,16 +113,16 @@ typedef enum ObjectNameSpaceID {
 */
 typedef struct CmObjDescriptor {
   /// Object Id
-  CM_OBJECT_ID  ObjectId;
+  CM_OBJECT_ID    ObjectId;
 
   /// Size of the described Object or Object List
-  UINT32        Size;
+  UINT32          Size;
 
   /// Pointer to the described Object or Object List
-  VOID        * Data;
+  VOID            *Data;
 
   /// Count of objects in the list
-  UINT32        Count;
+  UINT32          Count;
 } CM_OBJ_DESCRIPTOR;
 
 #pragma pack()
@@ -143,7 +143,7 @@ typedef struct CmObjDescriptor {
 
   @retval Returns the Object ID corresponding to the CmObjectID.
 **/
-#define GET_CM_OBJECT_ID(CmObjectId)    ((CmObjectId) & OBJECT_ID_MASK)
+#define GET_CM_OBJECT_ID(CmObjectId)  ((CmObjectId) & OBJECT_ID_MASK)
 
 /** This macro returns a Configuration Manager Object ID
     from the NameSpace ID and the ObjectID.

+ 14 - 15
DynamicTablesPkg/Include/DeviceTreeTableGenerator.h

@@ -89,10 +89,10 @@ typedef struct DtTableGenerator             DT_TABLE_GENERATOR;
                         failure codes as returned by the generator.
 **/
 typedef EFI_STATUS (*DT_TABLE_GENERATOR_BUILD_TABLE) (
-  IN  CONST DT_TABLE_GENERATOR                    *       Generator,
-  IN  CONST CM_STD_OBJ_DT_TABLE_INFO              * CONST DtTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       VOID                                 **       Table
+  IN  CONST DT_TABLE_GENERATOR                            *Generator,
+  IN  CONST CM_STD_OBJ_DT_TABLE_INFO              *CONST  DtTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       VOID                                          **Table
   );
 
 /** This function pointer describes the interface to used by the
@@ -109,10 +109,10 @@ typedef EFI_STATUS (*DT_TABLE_GENERATOR_BUILD_TABLE) (
                         as returned by the generator.
 **/
 typedef EFI_STATUS (*DT_TABLE_GENERATOR_FREE_TABLE) (
-  IN  CONST DT_TABLE_GENERATOR                    *       Generator,
-  IN  CONST CM_STD_OBJ_DT_TABLE_INFO              * CONST DtTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN        VOID                                 **       Table
+  IN  CONST DT_TABLE_GENERATOR                            *Generator,
+  IN  CONST CM_STD_OBJ_DT_TABLE_INFO              *CONST  DtTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN        VOID                                          **Table
   );
 
 /** The DT_TABLE_GENERATOR structure provides an interface that the
@@ -120,16 +120,16 @@ typedef EFI_STATUS (*DT_TABLE_GENERATOR_FREE_TABLE) (
 */
 typedef struct DtTableGenerator {
   /// The DT table generator ID.
-  DT_TABLE_GENERATOR_ID                  GeneratorID;
+  DT_TABLE_GENERATOR_ID             GeneratorID;
 
   /// String describing the DT table generator.
-  CONST CHAR16                         * Description;
+  CONST CHAR16                      *Description;
 
   /// DT table build function pointer.
-  DT_TABLE_GENERATOR_BUILD_TABLE         BuildDtTable;
+  DT_TABLE_GENERATOR_BUILD_TABLE    BuildDtTable;
 
   /// The function to free any resources allocated for building the DT table.
-  DT_TABLE_GENERATOR_FREE_TABLE          FreeTableResources;
+  DT_TABLE_GENERATOR_FREE_TABLE     FreeTableResources;
 } DT_TABLE_GENERATOR;
 
 /** Register DT table factory generator.
@@ -149,7 +149,7 @@ typedef struct DtTableGenerator {
 EFI_STATUS
 EFIAPI
 RegisterDtTableGenerator (
-  IN CONST DT_TABLE_GENERATOR                   * CONST Generator
+  IN CONST DT_TABLE_GENERATOR                   *CONST  Generator
   );
 
 /** Deregister DT generator.
@@ -167,10 +167,9 @@ RegisterDtTableGenerator (
 EFI_STATUS
 EFIAPI
 DeregisterDtTableGenerator (
-  IN CONST DT_TABLE_GENERATOR                   * CONST Generator
+  IN CONST DT_TABLE_GENERATOR                   *CONST  Generator
   );
 
 #pragma pack()
 
 #endif // DEVICETREE_TABLE_GENERATOR_H_
-

+ 9 - 9
DynamicTablesPkg/Include/Library/AcpiHelperLib.h

@@ -10,15 +10,15 @@
 
 /** Is a character upper case
 */
-#define IS_UPPER_CHAR(x) ((x >= 'A') && (x <= 'Z'))
+#define IS_UPPER_CHAR(x)  ((x >= 'A') && (x <= 'Z'))
 
 /** Is a character a decimal digit
 */
-#define IS_DIGIT(x) ((x >= '0') && (x <= '9'))
+#define IS_DIGIT(x)  ((x >= '0') && (x <= '9'))
 
 /** Is a character an upper case hexadecimal digit
 */
-#define IS_UPPER_HEX(x) (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x))
+#define IS_UPPER_HEX(x)  (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x))
 
 /** Convert a hex number to its ASCII code.
 
@@ -31,7 +31,7 @@
 UINT8
 EFIAPI
 AsciiFromHex (
-  IN  UINT8   Hex
+  IN  UINT8  Hex
   );
 
 /** Convert an ASCII char representing an hexadecimal number
@@ -46,7 +46,7 @@ AsciiFromHex (
 UINT8
 EFIAPI
 HexFromAscii (
-  IN  CHAR8   Char
+  IN  CHAR8  Char
   );
 
 /** Check if a HID is a valid PNP ID.
@@ -58,7 +58,7 @@ HexFromAscii (
 **/
 BOOLEAN
 IsValidPnpId (
-  IN  CONST CHAR8  * Hid
+  IN  CONST CHAR8  *Hid
   );
 
 /** Check if a HID is a valid ACPI ID.
@@ -70,7 +70,7 @@ IsValidPnpId (
 **/
 BOOLEAN
 IsValidAcpiId (
-  IN  CONST CHAR8  * Hid
+  IN  CONST CHAR8  *Hid
   );
 
 /** Convert a EisaId string to its compressed UINT32 equivalent.
@@ -86,8 +86,8 @@ IsValidAcpiId (
 EFI_STATUS
 EFIAPI
 AmlGetEisaIdFromString (
-  IN  CONST CHAR8   * EisaIdStr,
-  OUT       UINT32  * EisaIdInt
+  IN  CONST CHAR8   *EisaIdStr,
+  OUT       UINT32  *EisaIdInt
   );
 
 #endif // ACPI_HELPER_LIB_H_

+ 73 - 73
DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

@@ -42,19 +42,19 @@
 
 /** Node handle.
 */
-typedef void* AML_NODE_HANDLE;
+typedef void *AML_NODE_HANDLE;
 
 /** Root Node handle.
 */
-typedef void* AML_ROOT_NODE_HANDLE;
+typedef void *AML_ROOT_NODE_HANDLE;
 
 /** Object Node handle.
 */
-typedef void* AML_OBJECT_NODE_HANDLE;
+typedef void *AML_OBJECT_NODE_HANDLE;
 
 /** Data Node handle.
 */
-typedef void* AML_DATA_NODE_HANDLE;
+typedef void *AML_DATA_NODE_HANDLE;
 
 #endif // AML_HANDLE
 
@@ -78,8 +78,8 @@ typedef void* AML_DATA_NODE_HANDLE;
 EFI_STATUS
 EFIAPI
 AmlParseDefinitionBlock (
-  IN  CONST EFI_ACPI_DESCRIPTION_HEADER   * DefinitionBlock,
-  OUT       AML_ROOT_NODE_HANDLE          * RootPtr
+  IN  CONST EFI_ACPI_DESCRIPTION_HEADER  *DefinitionBlock,
+  OUT       AML_ROOT_NODE_HANDLE         *RootPtr
   );
 
 /** Serialize an AML definition block.
@@ -101,8 +101,8 @@ AmlParseDefinitionBlock (
 EFI_STATUS
 EFIAPI
 AmlSerializeDefinitionBlock (
-  IN  AML_ROOT_NODE_HANDLE              RootNode,
-  OUT EFI_ACPI_DESCRIPTION_HEADER    ** Table
+  IN  AML_ROOT_NODE_HANDLE         RootNode,
+  OUT EFI_ACPI_DESCRIPTION_HEADER  **Table
   );
 
 /** Clone a node and its children (clone a tree branch).
@@ -123,8 +123,8 @@ AmlSerializeDefinitionBlock (
 EFI_STATUS
 EFIAPI
 AmlCloneTree (
-  IN  AML_NODE_HANDLE   Node,
-  OUT AML_NODE_HANDLE * ClonedNode
+  IN  AML_NODE_HANDLE  Node,
+  OUT AML_NODE_HANDLE  *ClonedNode
   );
 
 /** Delete a Node and its children.
@@ -142,7 +142,7 @@ AmlCloneTree (
 EFI_STATUS
 EFIAPI
 AmlDeleteTree (
-  IN  AML_NODE_HANDLE   Node
+  IN  AML_NODE_HANDLE  Node
   );
 
 /** Detach the Node from the tree.
@@ -163,7 +163,7 @@ AmlDeleteTree (
 EFI_STATUS
 EFIAPI
 AmlDetachNode (
-  IN  AML_NODE_HANDLE   Node
+  IN  AML_NODE_HANDLE  Node
   );
 
 /** Find a node in the AML namespace, given an ASL path and a reference Node.
@@ -212,9 +212,9 @@ AmlDetachNode (
 EFI_STATUS
 EFIAPI
 AmlFindNode (
-  IN  AML_NODE_HANDLE       ReferenceNode,
-  IN  CHAR8               * AslPath,
-  OUT AML_NODE_HANDLE     * OutNode
+  IN  AML_NODE_HANDLE  ReferenceNode,
+  IN  CHAR8            *AslPath,
+  OUT AML_NODE_HANDLE  *OutNode
   );
 
 /**
@@ -247,8 +247,8 @@ AmlFindNode (
 EFI_STATUS
 EFIAPI
 AmlDeviceOpUpdateName (
-  IN  AML_OBJECT_NODE_HANDLE    DeviceOpNode,
-  IN  CHAR8                   * NewNameString
+  IN  AML_OBJECT_NODE_HANDLE  DeviceOpNode,
+  IN  CHAR8                   *NewNameString
   );
 
 /** Update an integer value defined by a NameOp object node.
@@ -297,8 +297,8 @@ AmlNameOpUpdateInteger (
 EFI_STATUS
 EFIAPI
 AmlNameOpUpdateString (
-  IN        AML_OBJECT_NODE_HANDLE    NameOpNode,
-  IN  CONST CHAR8                   * NewName
+  IN        AML_OBJECT_NODE_HANDLE  NameOpNode,
+  IN  CONST CHAR8                   *NewName
   );
 
 /** Get the first Resource Data element contained in a named object.
@@ -331,8 +331,8 @@ AmlNameOpUpdateString (
 EFI_STATUS
 EFIAPI
 AmlNameOpGetFirstRdNode (
-  IN  AML_OBJECT_NODE_HANDLE   NameOpNode,
-  OUT AML_DATA_NODE_HANDLE   * OutRdNode
+  IN  AML_OBJECT_NODE_HANDLE  NameOpNode,
+  OUT AML_DATA_NODE_HANDLE    *OutRdNode
   );
 
 /** Get the Resource Data element following the CurrRdNode Resource Data.
@@ -367,8 +367,8 @@ AmlNameOpGetFirstRdNode (
 EFI_STATUS
 EFIAPI
 AmlNameOpGetNextRdNode (
-  IN  AML_DATA_NODE_HANDLE    CurrRdNode,
-  OUT AML_DATA_NODE_HANDLE  * OutRdNode
+  IN  AML_DATA_NODE_HANDLE  CurrRdNode,
+  OUT AML_DATA_NODE_HANDLE  *OutRdNode
   );
 
 /** Update the first interrupt of an Interrupt resource data node.
@@ -393,8 +393,8 @@ AmlNameOpGetNextRdNode (
 EFI_STATUS
 EFIAPI
 AmlUpdateRdInterrupt (
-  IN  AML_DATA_NODE_HANDLE    InterruptRdNode,
-  IN  UINT32                  Irq
+  IN  AML_DATA_NODE_HANDLE  InterruptRdNode,
+  IN  UINT32                Irq
   );
 
 /** Update the base address and length of a QWord resource data node.
@@ -495,11 +495,11 @@ AmlCodeGenRdInterrupt (
 EFI_STATUS
 EFIAPI
 AmlCodeGenDefinitionBlock (
-  IN  CONST CHAR8                 * TableSignature,
-  IN  CONST CHAR8                 * OemId,
-  IN  CONST CHAR8                 * OemTableId,
-  IN        UINT32                  OemRevision,
-  OUT       AML_ROOT_NODE_HANDLE  * NewRootNode
+  IN  CONST CHAR8                 *TableSignature,
+  IN  CONST CHAR8                 *OemId,
+  IN  CONST CHAR8                 *OemTableId,
+  IN        UINT32                OemRevision,
+  OUT       AML_ROOT_NODE_HANDLE  *NewRootNode
   );
 
 /** AML code generation for a Name object node, containing a String.
@@ -527,10 +527,10 @@ AmlCodeGenDefinitionBlock (
 EFI_STATUS
 EFIAPI
 AmlCodeGenNameString (
-  IN  CONST CHAR8                   * NameString,
-  IN        CHAR8                   * String,
-  IN        AML_NODE_HANDLE           ParentNode      OPTIONAL,
-  OUT       AML_OBJECT_NODE_HANDLE  * NewObjectNode   OPTIONAL
+  IN  CONST CHAR8                   *NameString,
+  IN        CHAR8                   *String,
+  IN        AML_NODE_HANDLE         ParentNode      OPTIONAL,
+  OUT       AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
   );
 
 /** AML code generation for a Name object node, containing an Integer.
@@ -557,10 +557,10 @@ AmlCodeGenNameString (
 EFI_STATUS
 EFIAPI
 AmlCodeGenNameInteger (
-  IN  CONST CHAR8                   * NameString,
-  IN        UINT64                    Integer,
-  IN        AML_NODE_HANDLE           ParentNode      OPTIONAL,
-  OUT       AML_OBJECT_NODE_HANDLE  * NewObjectNode   OPTIONAL
+  IN  CONST CHAR8                   *NameString,
+  IN        UINT64                  Integer,
+  IN        AML_NODE_HANDLE         ParentNode      OPTIONAL,
+  OUT       AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
   );
 
 /** AML code generation for a Device object node.
@@ -586,9 +586,9 @@ AmlCodeGenNameInteger (
 EFI_STATUS
 EFIAPI
 AmlCodeGenDevice (
-  IN  CONST CHAR8                   * NameString,
-  IN        AML_NODE_HANDLE           ParentNode      OPTIONAL,
-  OUT       AML_OBJECT_NODE_HANDLE  * NewObjectNode   OPTIONAL
+  IN  CONST CHAR8                   *NameString,
+  IN        AML_NODE_HANDLE         ParentNode      OPTIONAL,
+  OUT       AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
   );
 
 /** AML code generation for a Scope object node.
@@ -614,9 +614,9 @@ AmlCodeGenDevice (
 EFI_STATUS
 EFIAPI
 AmlCodeGenScope (
-  IN  CONST CHAR8                   * NameString,
-  IN        AML_NODE_HANDLE           ParentNode      OPTIONAL,
-  OUT       AML_OBJECT_NODE_HANDLE  * NewObjectNode   OPTIONAL
+  IN  CONST CHAR8                   *NameString,
+  IN        AML_NODE_HANDLE         ParentNode      OPTIONAL,
+  OUT       AML_OBJECT_NODE_HANDLE  *NewObjectNode   OPTIONAL
   );
 
 /** AML code generation for a method returning a NameString.
@@ -663,13 +663,13 @@ AmlCodeGenScope (
 EFI_STATUS
 EFIAPI
 AmlCodeGenMethodRetNameString (
-  IN  CONST CHAR8                   * MethodNameString,
-  IN  CONST CHAR8                   * ReturnedNameString   OPTIONAL,
-  IN        UINT8                     NumArgs,
-  IN        BOOLEAN                   IsSerialized,
-  IN        UINT8                     SyncLevel,
-  IN        AML_NODE_HANDLE           ParentNode           OPTIONAL,
-  OUT       AML_OBJECT_NODE_HANDLE  * NewObjectNode        OPTIONAL
+  IN  CONST CHAR8                   *MethodNameString,
+  IN  CONST CHAR8                   *ReturnedNameString   OPTIONAL,
+  IN        UINT8                   NumArgs,
+  IN        BOOLEAN                 IsSerialized,
+  IN        UINT8                   SyncLevel,
+  IN        AML_NODE_HANDLE         ParentNode           OPTIONAL,
+  OUT       AML_OBJECT_NODE_HANDLE  *NewObjectNode        OPTIONAL
   );
 
 /** Create a _LPI name.
@@ -709,11 +709,11 @@ AmlCodeGenMethodRetNameString (
 EFI_STATUS
 EFIAPI
 AmlCreateLpiNode (
-  IN  CONST CHAR8                   * LpiNameString,
-  IN        UINT16                    Revision,
-  IN        UINT64                    LevelId,
-  IN        AML_NODE_HANDLE           ParentNode   OPTIONAL,
-  OUT       AML_OBJECT_NODE_HANDLE  * NewLpiNode   OPTIONAL
+  IN  CONST CHAR8                   *LpiNameString,
+  IN        UINT16                  Revision,
+  IN        UINT64                  LevelId,
+  IN        AML_NODE_HANDLE         ParentNode   OPTIONAL,
+  OUT       AML_OBJECT_NODE_HANDLE  *NewLpiNode   OPTIONAL
   );
 
 /** Add an _LPI state to a LPI node created using AmlCreateLpiNode ().
@@ -773,18 +773,18 @@ AmlCreateLpiNode (
 EFI_STATUS
 EFIAPI
 AmlAddLpiState (
-  IN  UINT32                                    MinResidency,
-  IN  UINT32                                    WorstCaseWakeLatency,
-  IN  UINT32                                    Flags,
-  IN  UINT32                                    ArchFlags,
-  IN  UINT32                                    ResCntFreq,
-  IN  UINT32                                    EnableParentState,
-  IN  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  * GenericRegisterDescriptor   OPTIONAL,
-  IN  UINT64                                    Integer                     OPTIONAL,
-  IN  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  * ResidencyCounterRegister    OPTIONAL,
-  IN  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  * UsageCounterRegister        OPTIONAL,
-  IN  CHAR8                                   * StateName                   OPTIONAL,
-  IN  AML_OBJECT_NODE_HANDLE                    LpiNode
+  IN  UINT32                                  MinResidency,
+  IN  UINT32                                  WorstCaseWakeLatency,
+  IN  UINT32                                  Flags,
+  IN  UINT32                                  ArchFlags,
+  IN  UINT32                                  ResCntFreq,
+  IN  UINT32                                  EnableParentState,
+  IN  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  *GenericRegisterDescriptor   OPTIONAL,
+  IN  UINT64                                  Integer                     OPTIONAL,
+  IN  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  *ResidencyCounterRegister    OPTIONAL,
+  IN  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE  *UsageCounterRegister        OPTIONAL,
+  IN  CHAR8                                   *StateName                   OPTIONAL,
+  IN  AML_OBJECT_NODE_HANDLE                  LpiNode
   );
 
 // DEPRECATED APIS
@@ -823,8 +823,8 @@ AmlAddLpiState (
 EFI_STATUS
 EFIAPI
 AmlNameOpCrsGetFirstRdNode (
-  IN  AML_OBJECT_NODE_HANDLE   NameOpCrsNode,
-  OUT AML_DATA_NODE_HANDLE   * OutRdNode
+  IN  AML_OBJECT_NODE_HANDLE  NameOpCrsNode,
+  OUT AML_DATA_NODE_HANDLE    *OutRdNode
   );
 
 /** DEPRECATED API
@@ -860,8 +860,8 @@ AmlNameOpCrsGetFirstRdNode (
 EFI_STATUS
 EFIAPI
 AmlNameOpCrsGetNextRdNode (
-  IN  AML_DATA_NODE_HANDLE    CurrRdNode,
-  OUT AML_DATA_NODE_HANDLE  * OutRdNode
+  IN  AML_DATA_NODE_HANDLE  CurrRdNode,
+  OUT AML_DATA_NODE_HANDLE  *OutRdNode
   );
 
 /** DEPRECATED API
@@ -919,7 +919,7 @@ AmlCodeGenCrsAddRdInterrupt (
   IN  BOOLEAN                 EdgeTriggered,
   IN  BOOLEAN                 ActiveLow,
   IN  BOOLEAN                 Shared,
-  IN  UINT32                * IrqList,
+  IN  UINT32                  *IrqList,
   IN  UINT8                   IrqCount
   );
 

+ 8 - 8
DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h

@@ -29,11 +29,11 @@
 EFI_STATUS
 EFIAPI
 BuildSsdtSerialPortTable (
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO    *  AcpiTableInfo,
-  IN  CONST CM_ARM_SERIAL_PORT_INFO       *  SerialPortInfo,
-  IN  CONST CHAR8                         *  Name,
-  IN  CONST UINT64                           Uid,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER  **  Table
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO   *AcpiTableInfo,
+  IN  CONST CM_ARM_SERIAL_PORT_INFO      *SerialPortInfo,
+  IN  CONST CHAR8                        *Name,
+  IN  CONST UINT64                       Uid,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER  **Table
   );
 
 /** Free an SSDT table previously created by
@@ -47,7 +47,7 @@ BuildSsdtSerialPortTable (
 EFI_STATUS
 EFIAPI
 FreeSsdtSerialPortTable (
-  IN EFI_ACPI_DESCRIPTION_HEADER  * Table
+  IN EFI_ACPI_DESCRIPTION_HEADER  *Table
   );
 
 /** Validate the Serial Port Information.
@@ -61,8 +61,8 @@ FreeSsdtSerialPortTable (
 EFI_STATUS
 EFIAPI
 ValidateSerialPortInfo (
-  IN  CONST CM_ARM_SERIAL_PORT_INFO  * SerialPortInfoTable,
-  IN        UINT32                     SerialPortCount
+  IN  CONST CM_ARM_SERIAL_PORT_INFO  *SerialPortInfoTable,
+  IN        UINT32                   SerialPortCount
   );
 
 #endif // SSDT_SERIAL_PORT_LIB_H_

+ 17 - 17
DynamicTablesPkg/Include/Library/TableHelperLib.h

@@ -31,8 +31,8 @@
 EFI_STATUS
 EFIAPI
 GetCgfMgrInfo (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL      * CONST  CfgMgrProtocol,
-  OUT       CM_STD_OBJ_CONFIGURATION_MANAGER_INFO    **        CfgMfrInfo
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL      *CONST  CfgMgrProtocol,
+  OUT       CM_STD_OBJ_CONFIGURATION_MANAGER_INFO             **CfgMfrInfo
   );
 
 /** The AddAcpiHeader function updates the ACPI header structure. It uses the
@@ -57,10 +57,10 @@ GetCgfMgrInfo (
 EFI_STATUS
 EFIAPI
 AddAcpiHeader (
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST Generator,
-  IN OUT  EFI_ACPI_DESCRIPTION_HEADER                 * CONST AcpiHeader,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  Generator,
+  IN OUT  EFI_ACPI_DESCRIPTION_HEADER                 *CONST  AcpiHeader,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
   IN      CONST UINT32                                        Length
   );
 
@@ -91,10 +91,10 @@ AddAcpiHeader (
 EFI_STATUS
 EFIAPI
 AddSsdtAcpiHeader (
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST Generator,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-      OUT       AML_ROOT_NODE_HANDLE                  *       RootNode
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  Generator,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  OUT       AML_ROOT_NODE_HANDLE                              *RootNode
   );
 
 /**
@@ -113,8 +113,8 @@ AddSsdtAcpiHeader (
 typedef
 BOOLEAN
 (EFIAPI *PFN_IS_EQUAL)(
-  IN CONST  VOID            * Object1,
-  IN CONST  VOID            * Object2,
+  IN CONST  VOID            *Object1,
+  IN CONST  VOID            *Object2,
   IN        UINTN             Index1 OPTIONAL,
   IN        UINTN             Index2 OPTIONAL
   );
@@ -136,10 +136,10 @@ BOOLEAN
 BOOLEAN
 EFIAPI
 FindDuplicateValue (
-  IN  CONST VOID          * Array,
-  IN  CONST UINTN           Count,
-  IN  CONST UINTN           ElementSize,
-  IN        PFN_IS_EQUAL    EqualTestFunction
+  IN  CONST VOID          *Array,
+  IN  CONST UINTN         Count,
+  IN  CONST UINTN         ElementSize,
+  IN        PFN_IS_EQUAL  EqualTestFunction
   );
 
 /** Parse and print a CmObjDesc.
@@ -149,7 +149,7 @@ FindDuplicateValue (
 VOID
 EFIAPI
 ParseCmObjDesc (
-  IN  CONST CM_OBJ_DESCRIPTOR * CmObjDesc
+  IN  CONST CM_OBJ_DESCRIPTOR  *CmObjDesc
   );
 
 #endif // TABLE_HELPER_LIB_H_

+ 13 - 13
DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h

@@ -32,8 +32,8 @@
 /**
   Forward declarations:
 */
-typedef struct ConfigurationManagerProtocol EDKII_CONFIGURATION_MANAGER_PROTOCOL;
-typedef struct PlatformRepositoryInfo       EDKII_PLATFORM_REPOSITORY_INFO;
+typedef struct ConfigurationManagerProtocol  EDKII_CONFIGURATION_MANAGER_PROTOCOL;
+typedef struct PlatformRepositoryInfo        EDKII_PLATFORM_REPOSITORY_INFO;
 
 /** The GetObject function defines the interface implemented by the
     Configuration Manager Protocol for returning the Configuration
@@ -55,11 +55,11 @@ typedef struct PlatformRepositoryInfo       EDKII_PLATFORM_REPOSITORY_INFO;
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_CONFIGURATION_MANAGER_GET_OBJECT) (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+(EFIAPI *EDKII_CONFIGURATION_MANAGER_GET_OBJECT)(
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST This,
   IN  CONST CM_OBJECT_ID                                  CmObjectId,
   IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
-  IN  OUT   CM_OBJ_DESCRIPTOR                     * CONST CmObject
+  IN  OUT   CM_OBJ_DESCRIPTOR                     *CONST CmObject
   );
 
 /** The SetObject function defines the interface implemented by the
@@ -83,11 +83,11 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_CONFIGURATION_MANAGER_SET_OBJECT) (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST This,
+(EFIAPI *EDKII_CONFIGURATION_MANAGER_SET_OBJECT)(
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST This,
   IN  CONST CM_OBJECT_ID                                  CmObjectId,
   IN  CONST CM_OBJECT_TOKEN                               Token OPTIONAL,
-  IN        CM_OBJ_DESCRIPTOR                     * CONST CmObject
+  IN        CM_OBJ_DESCRIPTOR                     *CONST CmObject
   );
 
 /** The EDKII_CONFIGURATION_MANAGER_PROTOCOL structure describes the
@@ -95,27 +95,27 @@ EFI_STATUS
 */
 typedef struct ConfigurationManagerProtocol {
   /// The Configuration Manager Protocol revision.
-  UINT32                                  Revision;
+  UINT32                                    Revision;
 
   /** The interface used to request information about
       the Configuration Manager Objects.
   */
-  EDKII_CONFIGURATION_MANAGER_GET_OBJECT  GetObject;
+  EDKII_CONFIGURATION_MANAGER_GET_OBJECT    GetObject;
 
   /** The interface used to update the information stored
       in the Configuration Manager repository.
   */
-  EDKII_CONFIGURATION_MANAGER_SET_OBJECT  SetObject;
+  EDKII_CONFIGURATION_MANAGER_SET_OBJECT    SetObject;
 
   /** Pointer to an implementation defined abstract repository
       provisioned by the Configuration Manager.
   */
-  EDKII_PLATFORM_REPOSITORY_INFO        * PlatRepoInfo;
+  EDKII_PLATFORM_REPOSITORY_INFO            *PlatRepoInfo;
 } EDKII_CONFIGURATION_MANAGER_PROTOCOL;
 
 /** The Configuration Manager Protocol GUID.
 */
-extern EFI_GUID gEdkiiConfigurationManagerProtocolGuid;
+extern EFI_GUID  gEdkiiConfigurationManagerProtocolGuid;
 
 #pragma pack()
 

+ 35 - 35
DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h

@@ -35,8 +35,8 @@
 /**
   Forward declarations:
 */
-typedef struct DynamicTableFactoryProtocol EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL;
-typedef struct DynamicTableFactoryInfo EDKII_DYNAMIC_TABLE_FACTORY_INFO;
+typedef struct DynamicTableFactoryProtocol  EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL;
+typedef struct DynamicTableFactoryInfo      EDKII_DYNAMIC_TABLE_FACTORY_INFO;
 
 /** Return a pointer to the ACPI table generator.
 
@@ -53,10 +53,10 @@ typedef struct DynamicTableFactoryInfo EDKII_DYNAMIC_TABLE_FACTORY_INFO;
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR) (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR)(
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST This,
   IN  CONST ACPI_TABLE_GENERATOR_ID                       GeneratorId,
-  OUT CONST ACPI_TABLE_GENERATOR                 ** CONST Generator
+  OUT CONST ACPI_TABLE_GENERATOR                 **CONST Generator
   );
 
 /** Registers an ACPI table generator.
@@ -72,8 +72,8 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR) (
-  IN  CONST ACPI_TABLE_GENERATOR                * CONST Generator
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR)(
+  IN  CONST ACPI_TABLE_GENERATOR                *CONST Generator
   );
 
 /** Deregister an ACPI table generator.
@@ -87,8 +87,8 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR) (
-  IN  CONST ACPI_TABLE_GENERATOR                * CONST Generator
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR)(
+  IN  CONST ACPI_TABLE_GENERATOR                *CONST Generator
   );
 
 /** Return a pointer to the SMBIOS table generator.
@@ -106,10 +106,10 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR) (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR)(
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST This,
   IN  CONST SMBIOS_TABLE_GENERATOR_ID                     GeneratorId,
-  OUT CONST SMBIOS_TABLE_GENERATOR               ** CONST Generator
+  OUT CONST SMBIOS_TABLE_GENERATOR               **CONST Generator
   );
 
 /** Register a SMBIOS table generator.
@@ -125,8 +125,8 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR) (
-  IN  CONST SMBIOS_TABLE_GENERATOR              * CONST Generator
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR)(
+  IN  CONST SMBIOS_TABLE_GENERATOR              *CONST Generator
   );
 
 /** Deregister a SMBIOS table generator.
@@ -140,8 +140,8 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_SMBIOS_TABLE_GENERATOR) (
-  IN  CONST SMBIOS_TABLE_GENERATOR              * CONST Generator
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_SMBIOS_TABLE_GENERATOR)(
+  IN  CONST SMBIOS_TABLE_GENERATOR              *CONST Generator
   );
 
 /** Return a pointer to the Device Tree table generator.
@@ -159,10 +159,10 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR) (
-  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  * CONST This,
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR)(
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST This,
   IN  CONST DT_TABLE_GENERATOR_ID                         GeneratorId,
-  OUT CONST DT_TABLE_GENERATOR                   ** CONST Generator
+  OUT CONST DT_TABLE_GENERATOR                   **CONST Generator
   );
 
 /** Register a DT table generator.
@@ -178,8 +178,8 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR) (
-  IN  CONST DT_TABLE_GENERATOR                * CONST Generator
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR)(
+  IN  CONST DT_TABLE_GENERATOR                *CONST Generator
   );
 
 /** Deregister a DT table generator.
@@ -196,58 +196,58 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR) (
-  IN  CONST DT_TABLE_GENERATOR                * CONST Generator
+(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR)(
+  IN  CONST DT_TABLE_GENERATOR                *CONST Generator
   );
 
 /** A structure describing the Dynamic Table Factory Protocol interface.
 */
 typedef struct DynamicTableFactoryProtocol {
   /// The Dynamic Table Factory Protocol revision.
-  UINT32                                                 Revision;
+  UINT32                                                    Revision;
 
   /// The interface used to request an ACPI Table Generator.
-  EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR   GetAcpiTableGenerator;
+  EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR      GetAcpiTableGenerator;
 
   /// Register an ACPI table Generator
   EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR
-    RegisterAcpiTableGenerator;
+                                                            RegisterAcpiTableGenerator;
 
   /// Deregister an ACPI table Generator
   EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR
-    DeregisterAcpiTableGenerator;
+                                                            DeregisterAcpiTableGenerator;
 
   /// The interface used to request a SMBIOS Table Generator.
-  EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR GetSmbiosTableGenerator;
+  EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR    GetSmbiosTableGenerator;
 
   /// Register an SMBIOS table Generator
   EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR
-    RegisterSmbiosTableGenerator;
+                                                            RegisterSmbiosTableGenerator;
 
   /// Deregister an SMBIOS table Generator
   EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR
-    DeregisterSmbiosTableGenerator;
+                                                            DeregisterSmbiosTableGenerator;
 
   /// The interface used to request a Device Tree Table Generator.
-  EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR     GetDtTableGenerator;
+  EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR        GetDtTableGenerator;
 
   /// Register a DT generator
   EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR
-    RegisterDtTableGenerator;
+                                                            RegisterDtTableGenerator;
 
   /// Deregister a DT generator
   EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR
-    DeregisterDtTableGenerator;
+                                                            DeregisterDtTableGenerator;
 
   /** Pointer to the data structure that holds the
       list of registered table generators
   */
-  EDKII_DYNAMIC_TABLE_FACTORY_INFO          * TableFactoryInfo;
+  EDKII_DYNAMIC_TABLE_FACTORY_INFO                          *TableFactoryInfo;
 } EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL;
 
 /** The Dynamic Table Factory Protocol GUID.
 */
-extern EFI_GUID gEdkiiDynamicTableFactoryProtocolGuid;
+extern EFI_GUID  gEdkiiDynamicTableFactoryProtocolGuid;
 
 #pragma pack()
 

+ 16 - 16
DynamicTablesPkg/Include/SmbiosTableGenerator.h

@@ -142,10 +142,10 @@ typedef struct SmbiosTableGenerator         SMBIOS_TABLE_GENERATOR;
                         failure codes as returned by the generator.
 **/
 typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLE) (
-  IN  CONST SMBIOS_TABLE_GENERATOR                *       Generator,
-  IN        CM_STD_OBJ_SMBIOS_TABLE_INFO          * CONST SmbiosTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       SMBIOS_STRUCTURE                     **       Table
+  IN  CONST SMBIOS_TABLE_GENERATOR                        *Generator,
+  IN        CM_STD_OBJ_SMBIOS_TABLE_INFO          *CONST  SmbiosTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       SMBIOS_STRUCTURE                              **Table
   );
 
 /** This function pointer describes the interface to used by the
@@ -162,10 +162,10 @@ typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLE) (
                         as returned by the generator.
 **/
 typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLE) (
-  IN  CONST SMBIOS_TABLE_GENERATOR                *       Generator,
-  IN  CONST CM_STD_OBJ_SMBIOS_TABLE_INFO          * CONST SmbiosTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN        SMBIOS_STRUCTURE                     **       Table
+  IN  CONST SMBIOS_TABLE_GENERATOR                        *Generator,
+  IN  CONST CM_STD_OBJ_SMBIOS_TABLE_INFO          *CONST  SmbiosTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN        SMBIOS_STRUCTURE                              **Table
   );
 
 /** The SMBIOS_TABLE_GENERATOR structure provides an interface that the
@@ -173,22 +173,22 @@ typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLE) (
 */
 typedef struct SmbiosTableGenerator {
   /// The SMBIOS table generator ID.
-  SMBIOS_TABLE_GENERATOR_ID                GeneratorID;
+  SMBIOS_TABLE_GENERATOR_ID             GeneratorID;
 
   /// String describing the DT table
   /// generator.
-  CONST CHAR16*                            Description;
+  CONST CHAR16                          *Description;
 
   /// The SMBIOS table type.
-  SMBIOS_TYPE                              Type;
+  SMBIOS_TYPE                           Type;
 
   /// SMBIOS table build function pointer.
-  SMBIOS_TABLE_GENERATOR_BUILD_TABLE       BuildSmbiosTable;
+  SMBIOS_TABLE_GENERATOR_BUILD_TABLE    BuildSmbiosTable;
 
   /** The function to free any resources
       allocated for building the SMBIOS table.
   */
-  SMBIOS_TABLE_GENERATOR_FREE_TABLE        FreeTableResources;
+  SMBIOS_TABLE_GENERATOR_FREE_TABLE     FreeTableResources;
 } SMBIOS_TABLE_GENERATOR;
 
 /** Register SMBIOS table factory generator.
@@ -208,7 +208,7 @@ typedef struct SmbiosTableGenerator {
 EFI_STATUS
 EFIAPI
 RegisterSmbiosTableGenerator (
-  IN CONST SMBIOS_TABLE_GENERATOR                 * CONST Generator
+  IN CONST SMBIOS_TABLE_GENERATOR                 *CONST  Generator
   );
 
 /** Deregister SMBIOS generator.
@@ -226,9 +226,9 @@ RegisterSmbiosTableGenerator (
 EFI_STATUS
 EFIAPI
 DeregisterSmbiosTableGenerator (
-  IN CONST SMBIOS_TABLE_GENERATOR                 * CONST Generator
+  IN CONST SMBIOS_TABLE_GENERATOR                 *CONST  Generator
   );
+
 #pragma pack()
 
 #endif // SMBIOS_TABLE_GENERATOR_H_
-

+ 8 - 8
DynamicTablesPkg/Include/StandardNameSpaceObjects.h

@@ -38,7 +38,7 @@
   Note: The token value 0 is reserved for a NULL token and does
         not identify any object.
 **/
-typedef UINTN   CM_OBJECT_TOKEN;
+typedef UINTN CM_OBJECT_TOKEN;
 
 /** The ESTD_OBJECT_ID enum describes the Object IDs
     in the Standard Namespace.
@@ -54,12 +54,12 @@ typedef enum StdObjectID {
 */
 typedef struct CmStdObjConfigurationManagerInfo {
   /// The Configuration Manager Revision.
-  UINT32  Revision;
+  UINT32    Revision;
 
   /** The OEM ID. This information is used to
       populate the ACPI table header information.
   */
-  UINT8   OemId[6];
+  UINT8     OemId[6];
 } CM_STD_OBJ_CONFIGURATION_MANAGER_INFO;
 
 /** A structure used to describe the ACPI table generators to be invoked.
@@ -85,7 +85,7 @@ typedef struct CmAStdObjAcpiTableInfo {
   ACPI_TABLE_GENERATOR_ID        TableGeneratorId;
 
   /// Optional pointer to the ACPI table data
-  EFI_ACPI_DESCRIPTION_HEADER  * AcpiTableData;
+  EFI_ACPI_DESCRIPTION_HEADER    *AcpiTableData;
 
   /// An OEM-supplied string that the OEM uses to identify the particular
   /// data table. This field is particularly useful when defining a definition
@@ -97,14 +97,14 @@ typedef struct CmAStdObjAcpiTableInfo {
   /// Generators shall populate this information using part of the
   /// CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.OemId field and the
   /// ACPI table signature.
-  UINT64                         OemTableId;
+  UINT64    OemTableId;
 
   /// An OEM-supplied revision number. Larger numbers are assumed to be
   /// newer revisions.
   /// Note: If this field is not populated (has value of Zero), then the
   /// Generators shall populate this information using the revision of the
   /// Configuration Manager (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.Revision).
-  UINT32                         OemRevision;
+  UINT32    OemRevision;
 } CM_STD_OBJ_ACPI_TABLE_INFO;
 
 /** A structure used to describe the SMBIOS table generators to be invoked.
@@ -120,10 +120,10 @@ typedef struct CmAStdObjAcpiTableInfo {
 */
 typedef struct CmStdObjSmbiosTableInfo {
   /// The SMBIOS Table Generator ID
-  SMBIOS_TABLE_GENERATOR_ID   TableGeneratorId;
+  SMBIOS_TABLE_GENERATOR_ID    TableGeneratorId;
 
   /// Optional pointer to the SMBIOS table data
-  SMBIOS_STRUCTURE           * SmbiosTableData;
+  SMBIOS_STRUCTURE             *SmbiosTableData;
 } CM_STD_OBJ_SMBIOS_TABLE_INFO;
 
 #pragma pack()

+ 7 - 8
DynamicTablesPkg/Include/TableGenerator.h

@@ -107,7 +107,7 @@ _______________________________________________________________________________
      128 - Table Type126
      129 - Table Type127
 **/
-typedef UINT32  TABLE_GENERATOR_ID;
+typedef UINT32 TABLE_GENERATOR_ID;
 
 /** This enum lists the Table Generator Types.
 */
@@ -127,19 +127,19 @@ typedef enum TableGeneratorNameSpace {
 
 /** A mask for the Table ID bits of TABLE_GENERATOR_ID.
 */
-#define TABLE_ID_MASK                 0xFF
+#define TABLE_ID_MASK  0xFF
 
 /** A mask for the Namespace ID bits of TABLE_GENERATOR_ID.
 */
-#define TABLE_NAMESPACEID_MASK        (BIT31)
+#define TABLE_NAMESPACEID_MASK  (BIT31)
 
 /** A mask for the Table Type bits of TABLE_GENERATOR_ID.
 */
-#define TABLE_TYPE_MASK               (BIT29 | BIT28)
+#define TABLE_TYPE_MASK  (BIT29 | BIT28)
 
 /** Starting bit position for the Table Type bits
 */
-#define TABLE_TYPE_BIT_SHIFT          28
+#define TABLE_TYPE_BIT_SHIFT  28
 
 /** Starting bit position for the Table Namespace ID bit
 */
@@ -204,11 +204,11 @@ typedef enum TableGeneratorNameSpace {
 
 /** A mask for Major revision.
 */
-#define MAJOR_REVISION_MASK       0xFFFF
+#define MAJOR_REVISION_MASK  0xFFFF
 
 /** A mask for Minor revision.
 */
-#define MINOR_REVISION_MASK       0xFFFF
+#define MINOR_REVISION_MASK  0xFFFF
 
 /** This macro generates a Major.Minor version
     where the Major and Minor fields are 16 bit.
@@ -244,4 +244,3 @@ typedef enum TableGeneratorNameSpace {
 #define GET_MINOR_REVISION(Revision)  ((Revision) & MINOR_REVISION_MASK)
 
 #endif // TABLE_GENERATOR_H_
-

+ 85 - 79
DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c

@@ -40,48 +40,48 @@ Requirements:
 
 /** The number of debug ports represented by the Table.
 */
-#define DBG2_NUM_DEBUG_PORTS                       1
+#define DBG2_NUM_DEBUG_PORTS  1
 
 /** The number of Generic Address Registers
     presented in the debug device information.
 */
-#define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS   1
+#define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS  1
 
 /** The index for the debug port 0 in the Debug port information list.
 */
-#define INDEX_DBG_PORT0                            0
+#define INDEX_DBG_PORT0  0
 
 /** A string representing the name of the debug port 0.
 */
-#define NAME_STR_DBG_PORT0                         "COM0"
+#define NAME_STR_DBG_PORT0  "COM0"
 
 /** An UID representing the debug port 0.
 */
-#define UID_DBG_PORT0                              0
+#define UID_DBG_PORT0  0
 
 /** The length of the namespace string.
 */
-#define DBG2_NAMESPACESTRING_FIELD_SIZE            sizeof (NAME_STR_DBG_PORT0)
+#define DBG2_NAMESPACESTRING_FIELD_SIZE  sizeof (NAME_STR_DBG_PORT0)
 
 /** The PL011 UART address range length.
 */
-#define PL011_UART_LENGTH                          0x1000
+#define PL011_UART_LENGTH  0x1000
 
 /** A structure that provides the OS with the required information
     for initializing a debugger connection.
 */
 typedef struct {
   /// The debug device information for the platform
-  EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device;
+  EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT    Dbg2Device;
 
   /// The base address register for the serial port
-  EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE        BaseAddressRegister;
+  EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE           BaseAddressRegister;
 
   /// The address size
-  UINT32 AddressSize;
+  UINT32                                           AddressSize;
 
   /// The debug port name string
-  UINT8  NameSpaceString[DBG2_NAMESPACESTRING_FIELD_SIZE];
+  UINT8                                            NameSpaceString[DBG2_NAMESPACESTRING_FIELD_SIZE];
 } DBG2_DEBUG_DEVICE_INFORMATION;
 
 /** A structure representing the information about the debug port(s)
@@ -89,10 +89,10 @@ typedef struct {
 */
 typedef struct {
   /// The DBG2 table header
-  EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Description;
+  EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE    Description;
 
   /// Debug port information list
-  DBG2_DEBUG_DEVICE_INFORMATION       Dbg2DeviceInfo[DBG2_NUM_DEBUG_PORTS];
+  DBG2_DEBUG_DEVICE_INFORMATION              Dbg2DeviceInfo[DBG2_NUM_DEBUG_PORTS];
 } DBG2_TABLE;
 
 /** A helper macro used for initializing the debug port device
@@ -104,42 +104,42 @@ typedef struct {
   @param [in]  UartNameStr  The UART port name string.
 **/
 #define DBG2_DEBUG_PORT_DDI(                                          \
-          SubType,                                                    \
-          UartBase,                                                   \
-          UartAddrLen,                                                \
-          UartNameStr                                                 \
-          ) {                                                         \
+                                                                      SubType,                                                    \
+                                                                      UartBase,                                                   \
+                                                                      UartAddrLen,                                                \
+                                                                      UartNameStr                                                 \
+                                                                      )  {\
     {                                                                 \
-      /* UINT8     Revision */                                        \
+  /* UINT8     Revision */                                        \
       EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,         \
-      /* UINT16    Length */                                          \
+  /* UINT16    Length */                                          \
       sizeof (DBG2_DEBUG_DEVICE_INFORMATION),                         \
-      /* UINT8     NumberofGenericAddressRegisters */                 \
+  /* UINT8     NumberofGenericAddressRegisters */                 \
       DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS,                       \
-      /* UINT16    NameSpaceStringLength */                           \
+  /* UINT16    NameSpaceStringLength */                           \
       DBG2_NAMESPACESTRING_FIELD_SIZE,                                \
-      /* UINT16    NameSpaceStringOffset */                           \
+  /* UINT16    NameSpaceStringOffset */                           \
       OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString),     \
-      /* UINT16    OemDataLength */                                   \
+  /* UINT16    OemDataLength */                                   \
       0,                                                              \
-      /* UINT16    OemDataOffset */                                   \
+  /* UINT16    OemDataOffset */                                   \
       0,                                                              \
-      /* UINT16    Port Type */                                       \
+  /* UINT16    Port Type */                                       \
       EFI_ACPI_DBG2_PORT_TYPE_SERIAL,                                 \
-      /* UINT16    Port Subtype */                                    \
+  /* UINT16    Port Subtype */                                    \
       SubType,                                                        \
-      /* UINT8     Reserved[2] */                                     \
+  /* UINT8     Reserved[2] */                                     \
       {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE},               \
-      /* UINT16    BaseAddressRegister Offset */                      \
+  /* UINT16    BaseAddressRegister Offset */                      \
       OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), \
-      /* UINT16    AddressSize Offset */                              \
+  /* UINT16    AddressSize Offset */                              \
       OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize)          \
     },                                                                \
-    /* EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */  \
+  /* EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */  \
     ARM_GAS32 (UartBase),                                             \
-    /* UINT32  AddressSize */                                         \
+  /* UINT32  AddressSize */                                         \
     UartAddrLen,                                                      \
-    /* UINT8   NameSpaceString[MAX_DBG2_NAME_LEN] */                  \
+  /* UINT8   NameSpaceString[MAX_DBG2_NAME_LEN] */                  \
     UartNameStr                                                       \
   }
 
@@ -148,7 +148,7 @@ typedef struct {
   Note: fields marked with "{Template}" will be set dynamically
 */
 STATIC
-DBG2_TABLE AcpiDbg2 = {
+DBG2_TABLE  AcpiDbg2 = {
   {
     ACPI_HEADER (
       EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
@@ -194,7 +194,7 @@ GET_OBJECT_LIST (
 STATIC
 EFI_STATUS
 SetupDebugUart (
-  IN  CONST CM_ARM_SERIAL_PORT_INFO  * CONST SerialPortInfo
+  IN  CONST CM_ARM_SERIAL_PORT_INFO  *CONST  SerialPortInfo
   )
 {
   EFI_STATUS          Status;
@@ -209,20 +209,20 @@ SetupDebugUart (
   // Initialize the Serial Debug UART
   DEBUG ((DEBUG_INFO, "Initializing Serial Debug UART...\n"));
   ReceiveFifoDepth = 0; // Use the default value for FIFO depth
-  Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity);
-  DataBits = FixedPcdGet8 (PcdUartDefaultDataBits);
-  StopBits = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits);
+  Parity           = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity);
+  DataBits         = FixedPcdGet8 (PcdUartDefaultDataBits);
+  StopBits         = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits);
 
   BaudRate = SerialPortInfo->BaudRate;
-  Status = PL011UartInitializePort (
-             (UINTN)SerialPortInfo->BaseAddress,
-             SerialPortInfo->Clock,
-             &BaudRate,
-             &ReceiveFifoDepth,
-             &Parity,
-             &DataBits,
-             &StopBits
-             );
+  Status   = PL011UartInitializePort (
+               (UINTN)SerialPortInfo->BaseAddress,
+               SerialPortInfo->Clock,
+               &BaudRate,
+               &ReceiveFifoDepth,
+               &Parity,
+               &DataBits,
+               &StopBits
+               );
 
   ASSERT_EFI_ERROR (Status);
   return Status;
@@ -245,15 +245,15 @@ STATIC
 EFI_STATUS
 EFIAPI
 FreeDbg2TableEx (
-  IN      CONST ACPI_TABLE_GENERATOR                   * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          *** CONST Table,
+  IN      CONST ACPI_TABLE_GENERATOR                   *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ***CONST  Table,
   IN      CONST UINTN                                          TableCount
   )
 {
-  EFI_STATUS                        Status;
-  EFI_ACPI_DESCRIPTION_HEADER    ** TableList;
+  EFI_STATUS                   Status;
+  EFI_ACPI_DESCRIPTION_HEADER  **TableList;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -263,7 +263,8 @@ FreeDbg2TableEx (
 
   if ((Table == NULL)   ||
       (*Table == NULL)  ||
-      (TableCount != 2)) {
+      (TableCount != 2))
+  {
     DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid Table Pointer\n"));
     return EFI_INVALID_PARAMETER;
   }
@@ -272,7 +273,8 @@ FreeDbg2TableEx (
 
   if ((TableList[1] == NULL) ||
       (TableList[1]->Signature !=
-       EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
+       EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
+  {
     DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid SSDT table pointer.\n"));
     return EFI_INVALID_PARAMETER;
   }
@@ -316,17 +318,17 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildDbg2TableEx (
-  IN  CONST ACPI_TABLE_GENERATOR                   *       This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ***       Table,
-  OUT       UINTN                                  * CONST TableCount
+  IN  CONST ACPI_TABLE_GENERATOR                           *This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER                    ***Table,
+  OUT       UINTN                                  *CONST  TableCount
   )
 {
-  EFI_STATUS                      Status;
-  CM_ARM_SERIAL_PORT_INFO       * SerialPortInfo;
-  UINT32                          SerialPortCount;
-  EFI_ACPI_DESCRIPTION_HEADER  ** TableList;
+  EFI_STATUS                   Status;
+  CM_ARM_SERIAL_PORT_INFO      *SerialPortInfo;
+  UINT32                       SerialPortCount;
+  EFI_ACPI_DESCRIPTION_HEADER  **TableList;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -337,7 +339,8 @@ BuildDbg2TableEx (
   ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
 
   if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
-      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: DBG2: Requested table revision = %d, is not supported."
@@ -387,8 +390,8 @@ BuildDbg2TableEx (
   }
 
   // Allocate a table to store pointers to the DBG2 and SSDT tables.
-  TableList = (EFI_ACPI_DESCRIPTION_HEADER**)
-              AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * 2);
+  TableList = (EFI_ACPI_DESCRIPTION_HEADER **)
+              AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER *) * 2);
   if (TableList == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     DEBUG ((
@@ -403,7 +406,7 @@ BuildDbg2TableEx (
   Status = AddAcpiHeader (
              CfgMgrProtocol,
              This,
-             (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2,
+             (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiDbg2,
              AcpiTableInfo,
              sizeof (DBG2_TABLE)
              );
@@ -447,11 +450,12 @@ BuildDbg2TableEx (
     SerialPortInfo->PortSubtype;
 
   if ((SerialPortInfo->PortSubtype ==
-      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART)           ||
+       EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART)           ||
       (SerialPortInfo->PortSubtype ==
-      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) ||
+       EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) ||
       (SerialPortInfo->PortSubtype ==
-      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART)) {
+       EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART))
+  {
     // Initialize the serial port
     Status = SetupDebugUart (SerialPortInfo);
     if (EFI_ERROR (Status)) {
@@ -464,7 +468,7 @@ BuildDbg2TableEx (
     }
   }
 
-  TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2;
+  TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiDbg2;
 
   // Build a SSDT table describing the serial port.
   Status = BuildSsdtSerialPortTable (
@@ -484,7 +488,7 @@ BuildDbg2TableEx (
   }
 
   *TableCount = 2;
-  *Table = TableList;
+  *Table      = TableList;
 
   return Status;
 
@@ -498,13 +502,13 @@ error_handler:
 
 /** This macro defines the DBG2 Table Generator revision.
 */
-#define DBG2_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define DBG2_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the DBG2 Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR Dbg2Generator = {
+ACPI_TABLE_GENERATOR  Dbg2Generator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2),
   // Generator Description
@@ -542,11 +546,12 @@ ACPI_TABLE_GENERATOR Dbg2Generator = {
 EFI_STATUS
 EFIAPI
 AcpiDbg2LibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&Dbg2Generator);
   DEBUG ((DEBUG_INFO, "DBG2: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -565,11 +570,12 @@ AcpiDbg2LibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiDbg2LibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&Dbg2Generator);
   DEBUG ((DEBUG_INFO, "DBG2: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

+ 35 - 30
DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c

@@ -78,7 +78,7 @@ Requirements:
   Note: fields marked with "{Template}" will be updated dynamically.
 */
 STATIC
-EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
+EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE  AcpiFadt = {
   ACPI_HEADER (
     EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
     EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE,
@@ -250,11 +250,11 @@ STATIC
 EFI_STATUS
 EFIAPI
 FadtAddPmProfileInfo (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol
-)
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol
+  )
 {
-  EFI_STATUS                              Status;
-  CM_ARM_POWER_MANAGEMENT_PROFILE_INFO  * PmProfile;
+  EFI_STATUS                            Status;
+  CM_ARM_POWER_MANAGEMENT_PROFILE_INFO  *PmProfile;
 
   ASSERT (CfgMgrProtocol != NULL);
 
@@ -303,11 +303,11 @@ STATIC
 EFI_STATUS
 EFIAPI
 FadtAddBootArchInfo (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol
-)
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol
+  )
 {
-  EFI_STATUS               Status;
-  CM_ARM_BOOT_ARCH_INFO  * BootArchInfo;
+  EFI_STATUS             Status;
+  CM_ARM_BOOT_ARCH_INFO  *BootArchInfo;
 
   ASSERT (CfgMgrProtocol != NULL);
 
@@ -355,11 +355,11 @@ STATIC
 EFI_STATUS
 EFIAPI
 FadtAddHypervisorVendorId (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol
-)
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol
+  )
 {
-  EFI_STATUS                     Status;
-  CM_ARM_HYPERVISOR_VENDOR_ID  * HypervisorVendorInfo;
+  EFI_STATUS                   Status;
+  CM_ARM_HYPERVISOR_VENDOR_ID  *HypervisorVendorInfo;
 
   ASSERT (CfgMgrProtocol != NULL);
 
@@ -385,6 +385,7 @@ FadtAddHypervisorVendorId (
         Status
         ));
     }
+
     goto error_handler;
   }
 
@@ -416,11 +417,11 @@ STATIC
 EFI_STATUS
 EFIAPI
 FadtAddFixedFeatureFlags (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol
-)
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol
+  )
 {
-  EFI_STATUS                    Status;
-  CM_ARM_FIXED_FEATURE_FLAGS  * FixedFeatureFlags;
+  EFI_STATUS                  Status;
+  CM_ARM_FIXED_FEATURE_FLAGS  *FixedFeatureFlags;
 
   ASSERT (CfgMgrProtocol != NULL);
 
@@ -446,6 +447,7 @@ FadtAddFixedFeatureFlags (
         Status
         ));
     }
+
     goto error_handler;
   }
 
@@ -497,10 +499,10 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildFadtTable (
-  IN  CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
   EFI_STATUS  Status;
@@ -513,7 +515,8 @@ BuildFadtTable (
   ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
 
   if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
-      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: FADT: Requested table revision = %d, is not supported."
@@ -530,7 +533,7 @@ BuildFadtTable (
   Status = AddAcpiHeader (
              CfgMgrProtocol,
              This,
-             (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt,
+             (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt,
              AcpiTableInfo,
              sizeof (EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE)
              );
@@ -595,20 +598,20 @@ BuildFadtTable (
     }
   }
 
-  *Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt;
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt;
 error_handler:
   return Status;
 }
 
 /** This macro defines the FADT Table Generator revision.
 */
-#define FADT_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define FADT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the FADT Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR FadtGenerator = {
+ACPI_TABLE_GENERATOR  FadtGenerator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
   // Generator Description
@@ -648,11 +651,12 @@ ACPI_TABLE_GENERATOR FadtGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiFadtLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&FadtGenerator);
   DEBUG ((DEBUG_INFO, "FADT: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -671,11 +675,12 @@ AcpiFadtLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiFadtLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&FadtGenerator);
   DEBUG ((DEBUG_INFO, "FADT: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

+ 112 - 104
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c

@@ -90,14 +90,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 AddGenericTimerInfo (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         * CONST CfgMgrProtocol,
-  IN        EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         *CONST  CfgMgrProtocol,
+  IN        EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *CONST  Gtdt,
   IN  CONST UINT32                                               PlatformTimerCount,
   IN  CONST UINT32                                               AcpiTableRevision
-)
+  )
 {
-  EFI_STATUS                   Status;
-  CM_ARM_GENERIC_TIMER_INFO  * GenericTimerInfo;
+  EFI_STATUS                 Status;
+  CM_ARM_GENERIC_TIMER_INFO  *GenericTimerInfo;
 
   ASSERT (CfgMgrProtocol != NULL);
   ASSERT (Gtdt != NULL);
@@ -120,23 +120,23 @@ AddGenericTimerInfo (
 
   Gtdt->CntControlBasePhysicalAddress =
     GenericTimerInfo->CounterControlBaseAddress;
-  Gtdt->Reserved = EFI_ACPI_RESERVED_DWORD;
-  Gtdt->SecurePL1TimerGSIV = GenericTimerInfo->SecurePL1TimerGSIV;
-  Gtdt->SecurePL1TimerFlags = GenericTimerInfo->SecurePL1TimerFlags;
-  Gtdt->NonSecurePL1TimerGSIV = GenericTimerInfo->NonSecurePL1TimerGSIV;
-  Gtdt->NonSecurePL1TimerFlags = GenericTimerInfo->NonSecurePL1TimerFlags;
-  Gtdt->VirtualTimerGSIV = GenericTimerInfo->VirtualTimerGSIV;
-  Gtdt->VirtualTimerFlags = GenericTimerInfo->VirtualTimerFlags;
-  Gtdt->NonSecurePL2TimerGSIV = GenericTimerInfo->NonSecurePL2TimerGSIV;
-  Gtdt->NonSecurePL2TimerFlags = GenericTimerInfo->NonSecurePL2TimerFlags;
+  Gtdt->Reserved                   = EFI_ACPI_RESERVED_DWORD;
+  Gtdt->SecurePL1TimerGSIV         = GenericTimerInfo->SecurePL1TimerGSIV;
+  Gtdt->SecurePL1TimerFlags        = GenericTimerInfo->SecurePL1TimerFlags;
+  Gtdt->NonSecurePL1TimerGSIV      = GenericTimerInfo->NonSecurePL1TimerGSIV;
+  Gtdt->NonSecurePL1TimerFlags     = GenericTimerInfo->NonSecurePL1TimerFlags;
+  Gtdt->VirtualTimerGSIV           = GenericTimerInfo->VirtualTimerGSIV;
+  Gtdt->VirtualTimerFlags          = GenericTimerInfo->VirtualTimerFlags;
+  Gtdt->NonSecurePL2TimerGSIV      = GenericTimerInfo->NonSecurePL2TimerGSIV;
+  Gtdt->NonSecurePL2TimerFlags     = GenericTimerInfo->NonSecurePL2TimerFlags;
   Gtdt->CntReadBasePhysicalAddress =
     GenericTimerInfo->CounterReadBaseAddress;
-  Gtdt->PlatformTimerCount = PlatformTimerCount;
+  Gtdt->PlatformTimerCount  = PlatformTimerCount;
   Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 :
-    sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
+                              sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
 
   if (AcpiTableRevision > EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION) {
-    Gtdt->VirtualPL2TimerGSIV = GenericTimerInfo->VirtualPL2TimerGSIV;
+    Gtdt->VirtualPL2TimerGSIV  = GenericTimerInfo->VirtualPL2TimerGSIV;
     Gtdt->VirtualPL2TimerFlags = GenericTimerInfo->VirtualPL2TimerFlags;
   }
 
@@ -154,32 +154,32 @@ AddGenericTimerInfo (
 STATIC
 VOID
 AddGenericWatchdogList (
-  IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE  * CONST Gtdt,
+  IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE  *CONST  Gtdt,
   IN CONST UINT32                                          WatchdogOffset,
-  IN CONST CM_ARM_GENERIC_WATCHDOG_INFO            *       WatchdogInfoList,
+  IN CONST CM_ARM_GENERIC_WATCHDOG_INFO                    *WatchdogInfoList,
   IN       UINT32                                          WatchdogCount
   )
 {
-  EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE  * Watchdog;
+  EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE  *Watchdog;
 
   ASSERT (Gtdt != NULL);
   ASSERT (WatchdogInfoList != NULL);
 
   Watchdog = (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE *)
-             ((UINT8*)Gtdt + WatchdogOffset);
+             ((UINT8 *)Gtdt + WatchdogOffset);
 
   while (WatchdogCount-- != 0) {
     // Add watchdog entry
     DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog));
-    Watchdog->Type = EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG;
+    Watchdog->Type   = EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG;
     Watchdog->Length =
       sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE);
-    Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE;
+    Watchdog->Reserved                    = EFI_ACPI_RESERVED_BYTE;
     Watchdog->RefreshFramePhysicalAddress =
       WatchdogInfoList->RefreshFrameAddress;
     Watchdog->WatchdogControlFramePhysicalAddress =
       WatchdogInfoList->ControlFrameAddress;
-    Watchdog->WatchdogTimerGSIV = WatchdogInfoList->TimerGSIV;
+    Watchdog->WatchdogTimerGSIV  = WatchdogInfoList->TimerGSIV;
     Watchdog->WatchdogTimerFlags = WatchdogInfoList->Flags;
     Watchdog++;
     WatchdogInfoList++;
@@ -206,19 +206,19 @@ AddGenericWatchdogList (
 BOOLEAN
 EFIAPI
 IsGtFrameNumberEqual (
-  IN  CONST VOID          * Frame1,
-  IN  CONST VOID          * Frame2,
-  IN        UINTN           Index1,
-  IN        UINTN           Index2
+  IN  CONST VOID   *Frame1,
+  IN  CONST VOID   *Frame2,
+  IN        UINTN  Index1,
+  IN        UINTN  Index2
   )
 {
-  UINT8     FrameNumber1;
-  UINT8     FrameNumber2;
+  UINT8  FrameNumber1;
+  UINT8  FrameNumber2;
 
   ASSERT ((Frame1 != NULL) && (Frame2 != NULL));
 
-  FrameNumber1 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO*)Frame1)->FrameNumber;
-  FrameNumber2 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO*)Frame2)->FrameNumber;
+  FrameNumber1 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO *)Frame1)->FrameNumber;
+  FrameNumber2 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO *)Frame2)->FrameNumber;
 
   if (FrameNumber1 == FrameNumber2) {
     DEBUG ((
@@ -249,12 +249,12 @@ IsGtFrameNumberEqual (
 STATIC
 EFI_STATUS
 AddGTBlockTimerFrames (
-  IN       EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE *       GtBlockFrame,
-  IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO            *       GTBlockTimerFrameList,
-  IN       UINT32                                             GTBlockFrameCount
-)
+  IN       EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE  *GtBlockFrame,
+  IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO             *GTBlockTimerFrameList,
+  IN       UINT32                                      GTBlockFrameCount
+  )
 {
-  BOOLEAN    IsFrameNumberDuplicated;
+  BOOLEAN  IsFrameNumberDuplicated;
 
   ASSERT (GtBlockFrame != NULL);
   ASSERT (GTBlockTimerFrameList != NULL);
@@ -282,16 +282,16 @@ AddGTBlockTimerFrames (
         DEBUG_ERROR,
         "ERROR: GTDT: Frame number %d is not in the range 0-7\n",
         GTBlockTimerFrameList->FrameNumber
-      ));
+        ));
       return EFI_INVALID_PARAMETER;
     }
 
     GtBlockFrame->GTFrameNumber = GTBlockTimerFrameList->FrameNumber;
-    GtBlockFrame->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
-    GtBlockFrame->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
-    GtBlockFrame->Reserved[2] = EFI_ACPI_RESERVED_BYTE;
+    GtBlockFrame->Reserved[0]   = EFI_ACPI_RESERVED_BYTE;
+    GtBlockFrame->Reserved[1]   = EFI_ACPI_RESERVED_BYTE;
+    GtBlockFrame->Reserved[2]   = EFI_ACPI_RESERVED_BYTE;
 
-    GtBlockFrame->CntBaseX = GTBlockTimerFrameList->PhysicalAddressCntBase;
+    GtBlockFrame->CntBaseX    = GTBlockTimerFrameList->PhysicalAddressCntBase;
     GtBlockFrame->CntEL0BaseX =
       GTBlockTimerFrameList->PhysicalAddressCntEL0Base;
 
@@ -300,7 +300,7 @@ AddGTBlockTimerFrames (
     GtBlockFrame->GTxPhysicalTimerFlags =
       GTBlockTimerFrameList->PhysicalTimerFlags;
 
-    GtBlockFrame->GTxVirtualTimerGSIV = GTBlockTimerFrameList->VirtualTimerGSIV;
+    GtBlockFrame->GTxVirtualTimerGSIV  = GTBlockTimerFrameList->VirtualTimerGSIV;
     GtBlockFrame->GTxVirtualTimerFlags =
       GTBlockTimerFrameList->VirtualTimerFlags;
 
@@ -308,6 +308,7 @@ AddGTBlockTimerFrames (
     GtBlockFrame++;
     GTBlockTimerFrameList++;
   } // for
+
   return EFI_SUCCESS;
 }
 
@@ -328,25 +329,25 @@ AddGTBlockTimerFrames (
 STATIC
 EFI_STATUS
 AddGTBlockList (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL     * CONST CfgMgrProtocol,
-  IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE    * CONST Gtdt,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL     *CONST  CfgMgrProtocol,
+  IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE    *CONST  Gtdt,
   IN CONST UINT32                                            GTBlockOffset,
-  IN CONST CM_ARM_GTBLOCK_INFO                       *       GTBlockInfo,
+  IN CONST CM_ARM_GTBLOCK_INFO                               *GTBlockInfo,
   IN       UINT32                                            BlockTimerCount
-)
+  )
 {
-  EFI_STATUS                                    Status;
-  EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE        * GTBlock;
-  EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE  * GtBlockFrame;
-  CM_ARM_GTBLOCK_TIMER_FRAME_INFO             * GTBlockTimerFrameList;
-  UINT32                                        GTBlockTimerFrameCount;
-  UINTN                                         Length;
+  EFI_STATUS                                  Status;
+  EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE        *GTBlock;
+  EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE  *GtBlockFrame;
+  CM_ARM_GTBLOCK_TIMER_FRAME_INFO             *GTBlockTimerFrameList;
+  UINT32                                      GTBlockTimerFrameCount;
+  UINTN                                       Length;
 
   ASSERT (Gtdt != NULL);
   ASSERT (GTBlockInfo != NULL);
 
-  GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt +
-              GTBlockOffset);
+  GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8 *)Gtdt +
+                                                     GTBlockOffset);
 
   while (BlockTimerCount-- != 0) {
     DEBUG ((DEBUG_INFO, "GTDT: GTBlock = 0x%p\n", GTBlock));
@@ -358,7 +359,8 @@ AddGTBlockList (
                &GTBlockTimerFrameCount
                );
     if (EFI_ERROR (Status) ||
-        (GTBlockTimerFrameCount != GTBlockInfo->GTBlockTimerFrameCount)) {
+        (GTBlockTimerFrameCount != GTBlockInfo->GTBlockTimerFrameCount))
+    {
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: GTDT: Failed to get Generic Timer Frames. Status = %r\n",
@@ -368,8 +370,8 @@ AddGTBlockList (
     }
 
     Length = sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) +
-               (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
-                GTBlockInfo->GTBlockTimerFrameCount);
+             (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
+              GTBlockInfo->GTBlockTimerFrameCount);
 
     // Check that the length of the GT block does not
     // exceed MAX_UINT16
@@ -386,16 +388,16 @@ AddGTBlockList (
       return Status;
     }
 
-    GTBlock->Type = EFI_ACPI_6_4_GTDT_GT_BLOCK;
-    GTBlock->Length = (UINT16)Length;
-    GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE;
-    GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress;
-    GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount;
+    GTBlock->Type               = EFI_ACPI_6_4_GTDT_GT_BLOCK;
+    GTBlock->Length             = (UINT16)Length;
+    GTBlock->Reserved           = EFI_ACPI_RESERVED_BYTE;
+    GTBlock->CntCtlBase         = GTBlockInfo->GTBlockPhysicalAddress;
+    GTBlock->GTBlockTimerCount  = GTBlockInfo->GTBlockTimerFrameCount;
     GTBlock->GTBlockTimerOffset =
       sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE);
 
-    GtBlockFrame = (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE*)
-      ((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset);
+    GtBlockFrame = (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE *)
+                   ((UINT8 *)GTBlock + GTBlock->GTBlockTimerOffset);
 
     // Add GT Block Timer frames
     Status = AddGTBlockTimerFrames (
@@ -413,10 +415,11 @@ AddGTBlockList (
     }
 
     // Next GTBlock
-    GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock +
-               GTBlock->Length);
+    GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8 *)GTBlock +
+                                                       GTBlock->Length);
     GTBlockInfo++;
   }// for
+
   return EFI_SUCCESS;
 }
 
@@ -447,23 +450,23 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildGtdtTable (
-  IN  CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
-  EFI_STATUS                                      Status;
-  UINT32                                          TableSize;
-  UINT32                                          PlatformTimerCount;
-  UINT32                                          WatchdogCount;
-  UINT32                                          BlockTimerCount;
-  CM_ARM_GENERIC_WATCHDOG_INFO                  * WatchdogInfoList;
-  CM_ARM_GTBLOCK_INFO                           * GTBlockInfo;
-  EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE  * Gtdt;
-  UINT32                                          Idx;
-  UINT32                                          GTBlockOffset;
-  UINT32                                          WatchdogOffset;
+  EFI_STATUS                                    Status;
+  UINT32                                        TableSize;
+  UINT32                                        PlatformTimerCount;
+  UINT32                                        WatchdogCount;
+  UINT32                                        BlockTimerCount;
+  CM_ARM_GENERIC_WATCHDOG_INFO                  *WatchdogInfoList;
+  CM_ARM_GTBLOCK_INFO                           *GTBlockInfo;
+  EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE  *Gtdt;
+  UINT32                                        Idx;
+  UINT32                                        GTBlockOffset;
+  UINT32                                        WatchdogOffset;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -473,7 +476,8 @@ BuildGtdtTable (
   ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
 
   if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
-      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: GTDT: Requested table revision = %d, is not supported."
@@ -527,12 +531,12 @@ BuildGtdtTable (
 
   // Calculate the GTDT Table Size
   PlatformTimerCount = 0;
-  TableSize = sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
+  TableSize          = sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
   if (BlockTimerCount != 0) {
-    GTBlockOffset = TableSize;
+    GTBlockOffset       = TableSize;
     PlatformTimerCount += BlockTimerCount;
-    TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) *
-                  BlockTimerCount);
+    TableSize          += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) *
+                           BlockTimerCount);
 
     for (Idx = 0; Idx < BlockTimerCount; Idx++) {
       if (GTBlockInfo[Idx].GTBlockTimerFrameCount > 8) {
@@ -546,8 +550,9 @@ BuildGtdtTable (
           ));
         goto error_handler;
       }
+
       TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
-        GTBlockInfo[Idx].GTBlockTimerFrameCount);
+                    GTBlockInfo[Idx].GTBlockTimerFrameCount);
     }
 
     DEBUG ((
@@ -560,10 +565,10 @@ BuildGtdtTable (
 
   WatchdogOffset = 0;
   if (WatchdogCount != 0) {
-    WatchdogOffset = TableSize;
+    WatchdogOffset      = TableSize;
     PlatformTimerCount += WatchdogCount;
-    TableSize += (sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE) *
-                  WatchdogCount);
+    TableSize          += (sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE) *
+                           WatchdogCount);
     DEBUG ((
       DEBUG_INFO,
       "GTDT: WatchdogOffset = 0x%x, PLATFORM_TIMER_COUNT = %d\n",
@@ -572,7 +577,7 @@ BuildGtdtTable (
       ));
   }
 
-  *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
   if (*Table == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     DEBUG ((
@@ -585,7 +590,7 @@ BuildGtdtTable (
     goto error_handler;
   }
 
-  Gtdt = (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table;
+  Gtdt = (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *)*Table;
   DEBUG ((
     DEBUG_INFO,
     "GTDT: Gtdt = 0x%p TableSize = 0x%x\n",
@@ -658,6 +663,7 @@ error_handler:
     FreePool (*Table);
     *Table = NULL;
   }
+
   return Status;
 }
 
@@ -675,11 +681,11 @@ error_handler:
 STATIC
 EFI_STATUS
 FreeGtdtTableResources (
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
-)
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
+  )
 {
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -700,13 +706,13 @@ FreeGtdtTableResources (
 
 /** This macro defines the GTDT Table Generator revision.
 */
-#define GTDT_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define GTDT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the GTDT Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR GtdtGenerator = {
+ACPI_TABLE_GENERATOR  GtdtGenerator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt),
   // Generator Description
@@ -745,11 +751,12 @@ ACPI_TABLE_GENERATOR GtdtGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiGtdtLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&GtdtGenerator);
   DEBUG ((DEBUG_INFO, "GTDT: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -768,11 +775,12 @@ AcpiGtdtLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiGtdtLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&GtdtGenerator);
   DEBUG ((DEBUG_INFO, "GTDT: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

File diff suppressed because it is too large
+ 262 - 249
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c


+ 4 - 4
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.h

@@ -22,21 +22,21 @@ typedef struct IortNodeIndexer {
   /// Index token for the Node
   CM_OBJECT_TOKEN    Token;
   /// Pointer to the node
-  VOID             * Object;
+  VOID               *Object;
   /// Node offset from the start of the IORT table
   UINT32             Offset;
 } IORT_NODE_INDEXER;
 
 typedef struct AcpiIortGenerator {
   /// ACPI Table generator header
-  ACPI_TABLE_GENERATOR  Header;
+  ACPI_TABLE_GENERATOR    Header;
 
   // IORT Generator private data
 
   /// IORT node count
-  UINT32                IortNodeCount;
+  UINT32                  IortNodeCount;
   /// Pointer to the node indexer array
-  IORT_NODE_INDEXER   * NodeIndexer;
+  IORT_NODE_INDEXER       *NodeIndexer;
 } ACPI_IORT_GENERATOR;
 
 #pragma pack()

+ 104 - 100
DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c

@@ -91,8 +91,8 @@ GET_OBJECT_LIST (
 STATIC
 VOID
 AddGICC (
-  IN        EFI_ACPI_6_3_GIC_STRUCTURE  * CONST Gicc,
-  IN  CONST CM_ARM_GICC_INFO            * CONST GicCInfo,
+  IN        EFI_ACPI_6_3_GIC_STRUCTURE  *CONST  Gicc,
+  IN  CONST CM_ARM_GICC_INFO            *CONST  GicCInfo,
   IN  CONST UINT8                               MadtRev
   )
 {
@@ -167,19 +167,19 @@ AddGICC (
 BOOLEAN
 EFIAPI
 IsAcpiUidEqual (
-  IN  CONST VOID          * GicCInfo1,
-  IN  CONST VOID          * GicCInfo2,
-  IN        UINTN           Index1,
-  IN        UINTN           Index2
+  IN  CONST VOID   *GicCInfo1,
+  IN  CONST VOID   *GicCInfo2,
+  IN        UINTN  Index1,
+  IN        UINTN  Index2
   )
 {
-  UINT32      Uid1;
-  UINT32      Uid2;
+  UINT32  Uid1;
+  UINT32  Uid2;
 
   ASSERT ((GicCInfo1 != NULL) && (GicCInfo2 != NULL));
 
-  Uid1 = ((CM_ARM_GICC_INFO*)GicCInfo1)->AcpiProcessorUid;
-  Uid2 = ((CM_ARM_GICC_INFO*)GicCInfo2)->AcpiProcessorUid;
+  Uid1 = ((CM_ARM_GICC_INFO *)GicCInfo1)->AcpiProcessorUid;
+  Uid2 = ((CM_ARM_GICC_INFO *)GicCInfo2)->AcpiProcessorUid;
 
   if (Uid1 == Uid2) {
     DEBUG ((
@@ -214,13 +214,13 @@ IsAcpiUidEqual (
 STATIC
 EFI_STATUS
 AddGICCList (
-  IN  EFI_ACPI_6_3_GIC_STRUCTURE  * Gicc,
-  IN  CONST CM_ARM_GICC_INFO      * GicCInfo,
-  IN        UINT32                  GicCCount,
-  IN  CONST UINT8                   MadtRev
+  IN  EFI_ACPI_6_3_GIC_STRUCTURE  *Gicc,
+  IN  CONST CM_ARM_GICC_INFO      *GicCInfo,
+  IN        UINT32                GicCCount,
+  IN  CONST UINT8                 MadtRev
   )
 {
-  BOOLEAN   IsAcpiProcUidDuplicated;
+  BOOLEAN  IsAcpiProcUidDuplicated;
 
   ASSERT (Gicc != NULL);
   ASSERT (GicCInfo != NULL);
@@ -252,9 +252,9 @@ AddGICCList (
 STATIC
 VOID
 AddGICD (
-  EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE  * CONST Gicd,
-  CONST CM_ARM_GICD_INFO                  * CONST GicDInfo
-)
+  EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE  *CONST  Gicd,
+  CONST CM_ARM_GICD_INFO                  *CONST  GicDInfo
+  )
 {
   ASSERT (Gicd != NULL);
   ASSERT (GicDInfo != NULL);
@@ -289,22 +289,22 @@ AddGICD (
 STATIC
 VOID
 AddGICMsiFrame (
-  IN  EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE  * CONST GicMsiFrame,
-  IN  CONST CM_ARM_GIC_MSI_FRAME_INFO       * CONST GicMsiFrameInfo
-)
+  IN  EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE  *CONST  GicMsiFrame,
+  IN  CONST CM_ARM_GIC_MSI_FRAME_INFO       *CONST  GicMsiFrameInfo
+  )
 {
   ASSERT (GicMsiFrame != NULL);
   ASSERT (GicMsiFrameInfo != NULL);
 
-  GicMsiFrame->Type = EFI_ACPI_6_3_GIC_MSI_FRAME;
-  GicMsiFrame->Length = sizeof (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE);
-  GicMsiFrame->Reserved1 = EFI_ACPI_RESERVED_WORD;
-  GicMsiFrame->GicMsiFrameId = GicMsiFrameInfo->GicMsiFrameId;
+  GicMsiFrame->Type                = EFI_ACPI_6_3_GIC_MSI_FRAME;
+  GicMsiFrame->Length              = sizeof (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE);
+  GicMsiFrame->Reserved1           = EFI_ACPI_RESERVED_WORD;
+  GicMsiFrame->GicMsiFrameId       = GicMsiFrameInfo->GicMsiFrameId;
   GicMsiFrame->PhysicalBaseAddress = GicMsiFrameInfo->PhysicalBaseAddress;
 
-  GicMsiFrame->Flags = GicMsiFrameInfo->Flags;
+  GicMsiFrame->Flags    = GicMsiFrameInfo->Flags;
   GicMsiFrame->SPICount = GicMsiFrameInfo->SPICount;
-  GicMsiFrame->SPIBase = GicMsiFrameInfo->SPIBase;
+  GicMsiFrame->SPIBase  = GicMsiFrameInfo->SPIBase;
 }
 
 /** Add the GIC MSI Frame Information to the MADT Table.
@@ -316,10 +316,10 @@ AddGICMsiFrame (
 STATIC
 VOID
 AddGICMsiFrameInfoList (
-  IN  EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE  * GicMsiFrame,
-  IN  CONST CM_ARM_GIC_MSI_FRAME_INFO       * GicMsiFrameInfo,
-  IN        UINT32                            GicMsiFrameCount
-)
+  IN  EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE  *GicMsiFrame,
+  IN  CONST CM_ARM_GIC_MSI_FRAME_INFO       *GicMsiFrameInfo,
+  IN        UINT32                          GicMsiFrameCount
+  )
 {
   ASSERT (GicMsiFrame != NULL);
   ASSERT (GicMsiFrameInfo != NULL);
@@ -337,16 +337,16 @@ AddGICMsiFrameInfoList (
 STATIC
 VOID
 AddGICRedistributor (
-  IN  EFI_ACPI_6_3_GICR_STRUCTURE   * CONST Gicr,
-  IN  CONST CM_ARM_GIC_REDIST_INFO  * CONST GicRedistributorInfo
+  IN  EFI_ACPI_6_3_GICR_STRUCTURE   *CONST  Gicr,
+  IN  CONST CM_ARM_GIC_REDIST_INFO  *CONST  GicRedistributorInfo
   )
 {
   ASSERT (Gicr != NULL);
   ASSERT (GicRedistributorInfo != NULL);
 
-  Gicr->Type = EFI_ACPI_6_3_GICR;
-  Gicr->Length = sizeof (EFI_ACPI_6_3_GICR_STRUCTURE);
-  Gicr->Reserved = EFI_ACPI_RESERVED_WORD;
+  Gicr->Type                      = EFI_ACPI_6_3_GICR;
+  Gicr->Length                    = sizeof (EFI_ACPI_6_3_GICR_STRUCTURE);
+  Gicr->Reserved                  = EFI_ACPI_RESERVED_WORD;
   Gicr->DiscoveryRangeBaseAddress =
     GicRedistributorInfo->DiscoveryRangeBaseAddress;
   Gicr->DiscoveryRangeLength = GicRedistributorInfo->DiscoveryRangeLength;
@@ -361,10 +361,10 @@ AddGICRedistributor (
 STATIC
 VOID
 AddGICRedistributorList (
-  IN  EFI_ACPI_6_3_GICR_STRUCTURE   * Gicr,
-  IN  CONST CM_ARM_GIC_REDIST_INFO  * GicRInfo,
-  IN        UINT32                    GicRCount
-)
+  IN  EFI_ACPI_6_3_GICR_STRUCTURE   *Gicr,
+  IN  CONST CM_ARM_GIC_REDIST_INFO  *GicRInfo,
+  IN        UINT32                  GicRCount
+  )
 {
   ASSERT (Gicr != NULL);
   ASSERT (GicRInfo != NULL);
@@ -382,19 +382,19 @@ AddGICRedistributorList (
 STATIC
 VOID
 AddGICInterruptTranslationService (
-  IN  EFI_ACPI_6_3_GIC_ITS_STRUCTURE  * CONST GicIts,
-  IN  CONST CM_ARM_GIC_ITS_INFO       * CONST GicItsInfo
-)
+  IN  EFI_ACPI_6_3_GIC_ITS_STRUCTURE  *CONST  GicIts,
+  IN  CONST CM_ARM_GIC_ITS_INFO       *CONST  GicItsInfo
+  )
 {
   ASSERT (GicIts != NULL);
   ASSERT (GicItsInfo != NULL);
 
-  GicIts->Type = EFI_ACPI_6_3_GIC_ITS;
-  GicIts->Length = sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE);
-  GicIts->Reserved = EFI_ACPI_RESERVED_WORD;
-  GicIts->GicItsId = GicItsInfo->GicItsId;
+  GicIts->Type                = EFI_ACPI_6_3_GIC_ITS;
+  GicIts->Length              = sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE);
+  GicIts->Reserved            = EFI_ACPI_RESERVED_WORD;
+  GicIts->GicItsId            = GicItsInfo->GicItsId;
   GicIts->PhysicalBaseAddress = GicItsInfo->PhysicalBaseAddress;
-  GicIts->Reserved2 = EFI_ACPI_RESERVED_DWORD;
+  GicIts->Reserved2           = EFI_ACPI_RESERVED_DWORD;
 }
 
 /** Add the GIC Interrupt Translation Service Information
@@ -407,10 +407,10 @@ AddGICInterruptTranslationService (
 STATIC
 VOID
 AddGICItsList (
-  IN  EFI_ACPI_6_3_GIC_ITS_STRUCTURE  * GicIts,
-  IN  CONST CM_ARM_GIC_ITS_INFO       * GicItsInfo,
-  IN        UINT32                      GicItsCount
-)
+  IN  EFI_ACPI_6_3_GIC_ITS_STRUCTURE  *GicIts,
+  IN  CONST CM_ARM_GIC_ITS_INFO       *GicItsInfo,
+  IN        UINT32                    GicItsCount
+  )
 {
   ASSERT (GicIts != NULL);
   ASSERT (GicItsInfo != NULL);
@@ -446,31 +446,31 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildMadtTable (
-  IN  CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
-  EFI_STATUS                   Status;
-  UINT32                       TableSize;
-  UINT32                       GicCCount;
-  UINT32                       GicDCount;
-  UINT32                       GicMSICount;
-  UINT32                       GicRedistCount;
-  UINT32                       GicItsCount;
-  CM_ARM_GICC_INFO           * GicCInfo;
-  CM_ARM_GICD_INFO           * GicDInfo;
-  CM_ARM_GIC_MSI_FRAME_INFO  * GicMSIInfo;
-  CM_ARM_GIC_REDIST_INFO     * GicRedistInfo;
-  CM_ARM_GIC_ITS_INFO        * GicItsInfo;
-  UINT32                       GicCOffset;
-  UINT32                       GicDOffset;
-  UINT32                       GicMSIOffset;
-  UINT32                       GicRedistOffset;
-  UINT32                       GicItsOffset;
-
-  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER  * Madt;
+  EFI_STATUS                 Status;
+  UINT32                     TableSize;
+  UINT32                     GicCCount;
+  UINT32                     GicDCount;
+  UINT32                     GicMSICount;
+  UINT32                     GicRedistCount;
+  UINT32                     GicItsCount;
+  CM_ARM_GICC_INFO           *GicCInfo;
+  CM_ARM_GICD_INFO           *GicDInfo;
+  CM_ARM_GIC_MSI_FRAME_INFO  *GicMSIInfo;
+  CM_ARM_GIC_REDIST_INFO     *GicRedistInfo;
+  CM_ARM_GIC_ITS_INFO        *GicItsInfo;
+  UINT32                     GicCOffset;
+  UINT32                     GicDOffset;
+  UINT32                     GicMSIOffset;
+  UINT32                     GicRedistOffset;
+  UINT32                     GicItsOffset;
+
+  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER  *Madt;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -480,7 +480,8 @@ BuildMadtTable (
   ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
 
   if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
-      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: MADT: Requested table revision = %d, is not supported."
@@ -610,16 +611,16 @@ BuildMadtTable (
   TableSize += (sizeof (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE) * GicDCount);
 
   GicMSIOffset = TableSize;
-  TableSize += (sizeof (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE) * GicMSICount);
+  TableSize   += (sizeof (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE) * GicMSICount);
 
   GicRedistOffset = TableSize;
-  TableSize += (sizeof (EFI_ACPI_6_3_GICR_STRUCTURE) * GicRedistCount);
+  TableSize      += (sizeof (EFI_ACPI_6_3_GICR_STRUCTURE) * GicRedistCount);
 
   GicItsOffset = TableSize;
-  TableSize += (sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE) * GicItsCount);
+  TableSize   += (sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE) * GicItsCount);
 
   // Allocate the Buffer for MADT table
-  *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
   if (*Table == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     DEBUG ((
@@ -632,7 +633,7 @@ BuildMadtTable (
     goto error_handler;
   }
 
-  Madt = (EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER*)*Table;
+  Madt = (EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *)*Table;
 
   DEBUG ((
     DEBUG_INFO,
@@ -658,11 +659,11 @@ BuildMadtTable (
   }
 
   Status = AddGICCList (
-    (EFI_ACPI_6_3_GIC_STRUCTURE*)((UINT8*)Madt + GicCOffset),
-    GicCInfo,
-    GicCCount,
-    Madt->Header.Revision
-    );
+             (EFI_ACPI_6_3_GIC_STRUCTURE *)((UINT8 *)Madt + GicCOffset),
+             GicCInfo,
+             GicCCount,
+             Madt->Header.Revision
+             );
   if (EFI_ERROR (Status)) {
     DEBUG ((
       DEBUG_ERROR,
@@ -673,13 +674,13 @@ BuildMadtTable (
   }
 
   AddGICD (
-    (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE*)((UINT8*)Madt + GicDOffset),
+    (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE *)((UINT8 *)Madt + GicDOffset),
     GicDInfo
     );
 
   if (GicMSICount != 0) {
     AddGICMsiFrameInfoList (
-      (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE*)((UINT8*)Madt + GicMSIOffset),
+      (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE *)((UINT8 *)Madt + GicMSIOffset),
       GicMSIInfo,
       GicMSICount
       );
@@ -687,7 +688,7 @@ BuildMadtTable (
 
   if (GicRedistCount != 0) {
     AddGICRedistributorList (
-      (EFI_ACPI_6_3_GICR_STRUCTURE*)((UINT8*)Madt + GicRedistOffset),
+      (EFI_ACPI_6_3_GICR_STRUCTURE *)((UINT8 *)Madt + GicRedistOffset),
       GicRedistInfo,
       GicRedistCount
       );
@@ -695,7 +696,7 @@ BuildMadtTable (
 
   if (GicItsCount != 0) {
     AddGICItsList (
-      (EFI_ACPI_6_3_GIC_ITS_STRUCTURE*)((UINT8*)Madt + GicItsOffset),
+      (EFI_ACPI_6_3_GIC_ITS_STRUCTURE *)((UINT8 *)Madt + GicItsOffset),
       GicItsInfo,
       GicItsCount
       );
@@ -708,6 +709,7 @@ error_handler:
     FreePool (*Table);
     *Table = NULL;
   }
+
   return Status;
 }
 
@@ -725,10 +727,10 @@ error_handler:
 STATIC
 EFI_STATUS
 FreeMadtTableResources (
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
   ASSERT (This != NULL);
@@ -750,13 +752,13 @@ FreeMadtTableResources (
 
 /** The MADT Table Generator revision.
 */
-#define MADT_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define MADT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the MADT Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR MadtGenerator = {
+ACPI_TABLE_GENERATOR  MadtGenerator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
   // Generator Description
@@ -795,11 +797,12 @@ ACPI_TABLE_GENERATOR MadtGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiMadtLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&MadtGenerator);
   DEBUG ((DEBUG_INFO, "MADT: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -818,11 +821,12 @@ AcpiMadtLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiMadtLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&MadtGenerator);
   DEBUG ((DEBUG_INFO, "MADT: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

+ 42 - 37
DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c

@@ -68,27 +68,27 @@ GET_OBJECT_LIST (
 STATIC
 VOID
 AddPciConfigurationSpaceList (
-  IN       MCFG_TABLE                   * CONST Mcfg,
+  IN       MCFG_TABLE                   *CONST  Mcfg,
   IN CONST UINT32                               PciCfgSpaceOffset,
-  IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *       PciCfgSpaceInfoList,
+  IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO         *PciCfgSpaceInfoList,
   IN       UINT32                               PciCfgSpaceCount
-)
+  )
 {
-  MCFG_CFG_SPACE_ADDR  * PciCfgSpace;
+  MCFG_CFG_SPACE_ADDR  *PciCfgSpace;
 
   ASSERT (Mcfg != NULL);
   ASSERT (PciCfgSpaceInfoList != NULL);
 
-  PciCfgSpace = (MCFG_CFG_SPACE_ADDR *)((UINT8*)Mcfg + PciCfgSpaceOffset);
+  PciCfgSpace = (MCFG_CFG_SPACE_ADDR *)((UINT8 *)Mcfg + PciCfgSpaceOffset);
 
   while (PciCfgSpaceCount-- != 0) {
     // Add PCI Configuration Space entry
-    PciCfgSpace->BaseAddress = PciCfgSpaceInfoList->BaseAddress;
+    PciCfgSpace->BaseAddress           = PciCfgSpaceInfoList->BaseAddress;
     PciCfgSpace->PciSegmentGroupNumber =
       PciCfgSpaceInfoList->PciSegmentGroupNumber;
     PciCfgSpace->StartBusNumber = PciCfgSpaceInfoList->StartBusNumber;
-    PciCfgSpace->EndBusNumber = PciCfgSpaceInfoList->EndBusNumber;
-    PciCfgSpace->Reserved = EFI_ACPI_RESERVED_DWORD;
+    PciCfgSpace->EndBusNumber   = PciCfgSpaceInfoList->EndBusNumber;
+    PciCfgSpace->Reserved       = EFI_ACPI_RESERVED_DWORD;
     PciCfgSpace++;
     PciCfgSpaceInfoList++;
   }
@@ -120,17 +120,17 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildMcfgTable (
-  IN  CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
-  EFI_STATUS                      Status;
-  UINT32                          TableSize;
-  UINT32                          ConfigurationSpaceCount;
-  CM_ARM_PCI_CONFIG_SPACE_INFO  * PciConfigSpaceInfoList;
-  MCFG_TABLE                    * Mcfg;
+  EFI_STATUS                    Status;
+  UINT32                        TableSize;
+  UINT32                        ConfigurationSpaceCount;
+  CM_ARM_PCI_CONFIG_SPACE_INFO  *PciConfigSpaceInfoList;
+  MCFG_TABLE                    *Mcfg;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -140,7 +140,8 @@ BuildMcfgTable (
   ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
 
   if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
-      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: MCFG: Requested table revision = %d, is not supported."
@@ -154,13 +155,14 @@ BuildMcfgTable (
 
   *Table = NULL;
   Status = GetEArmObjPciConfigSpaceInfo (
-              CfgMgrProtocol,
-              CM_NULL_TOKEN,
-              &PciConfigSpaceInfoList,
-              &ConfigurationSpaceCount
-              );
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &PciConfigSpaceInfoList,
+             &ConfigurationSpaceCount
+             );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR,
+    DEBUG ((
+      DEBUG_ERROR,
       "ERROR: MCFG: Failed to get PCI Configuration Space Information." \
       " Status = %r\n",
       Status
@@ -187,9 +189,9 @@ BuildMcfgTable (
 
   // Calculate the MCFG Table Size
   TableSize = sizeof (MCFG_TABLE) +
-    ((sizeof (MCFG_CFG_SPACE_ADDR) * ConfigurationSpaceCount));
+              ((sizeof (MCFG_CFG_SPACE_ADDR) * ConfigurationSpaceCount));
 
-  *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
   if (*Table == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     DEBUG ((
@@ -202,7 +204,7 @@ BuildMcfgTable (
     goto error_handler;
   }
 
-  Mcfg = (MCFG_TABLE*)*Table;
+  Mcfg = (MCFG_TABLE *)*Table;
   DEBUG ((
     DEBUG_INFO,
     "MCFG: Mcfg = 0x%p TableSize = 0x%x\n",
@@ -242,6 +244,7 @@ error_handler:
     FreePool (*Table);
     *Table = NULL;
   }
+
   return Status;
 }
 
@@ -259,10 +262,10 @@ error_handler:
 STATIC
 EFI_STATUS
 FreeMcfgTableResources (
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
   ASSERT (This != NULL);
@@ -284,13 +287,13 @@ FreeMcfgTableResources (
 
 /** This macro defines the MCFG Table Generator revision.
 */
-#define MCFG_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define MCFG_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the MCFG Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR McfgGenerator = {
+ACPI_TABLE_GENERATOR  McfgGenerator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg),
   // Generator Description
@@ -329,11 +332,12 @@ ACPI_TABLE_GENERATOR McfgGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiMcfgLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&McfgGenerator);
   DEBUG ((DEBUG_INFO, "MCFG: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -352,11 +356,12 @@ AcpiMcfgLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiMcfgLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&McfgGenerator);
   DEBUG ((DEBUG_INFO, "MCFG: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

+ 195 - 189
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c

@@ -101,14 +101,14 @@ GET_OBJECT_LIST (
 STATIC
 UINT32
 GetProcHierarchyNodeSize (
-  IN  CONST CM_ARM_PROC_HIERARCHY_INFO * Node
+  IN  CONST CM_ARM_PROC_HIERARCHY_INFO  *Node
   )
 {
   ASSERT (Node != NULL);
 
   // <size of Processor Hierarchy Node> + <size of Private Resources array>
   return sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) +
-                 (Node->NoOfPrivateResources * sizeof (UINT32));
+         (Node->NoOfPrivateResources * sizeof (UINT32));
 }
 
 /**
@@ -157,10 +157,10 @@ GET_SIZE_OF_PPTT_STRUCTS (
 STATIC
 EFI_STATUS
 GetPpttNodeReferencedByToken (
-  IN          PPTT_NODE_INDEXER    * NodeIndexer,
-  IN  UINT32                         NodeCount,
-  IN  CONST   CM_OBJECT_TOKEN        SearchToken,
-  OUT         PPTT_NODE_INDEXER   ** IndexedNodeFound
+  IN          PPTT_NODE_INDEXER  *NodeIndexer,
+  IN  UINT32                     NodeCount,
+  IN  CONST   CM_OBJECT_TOKEN    SearchToken,
+  OUT         PPTT_NODE_INDEXER  **IndexedNodeFound
   )
 {
   EFI_STATUS  Status;
@@ -183,7 +183,7 @@ GetPpttNodeReferencedByToken (
 
     if (NodeIndexer->Token == SearchToken) {
       *IndexedNodeFound = NodeIndexer;
-      Status = EFI_SUCCESS;
+      Status            = EFI_SUCCESS;
       DEBUG ((
         DEBUG_INFO,
         "PPTT: Node Indexer: Token = %p. Found, Status = %r\n",
@@ -192,6 +192,7 @@ GetPpttNodeReferencedByToken (
         ));
       return Status;
     }
+
     NodeIndexer++;
   }
 
@@ -218,17 +219,17 @@ GetPpttNodeReferencedByToken (
 STATIC
 EFI_STATUS
 DetectCyclesInTopology (
-  IN  CONST ACPI_PPTT_GENERATOR         * CONST Generator
+  IN  CONST ACPI_PPTT_GENERATOR         *CONST  Generator
   )
 {
-  EFI_STATUS            Status;
-  PPTT_NODE_INDEXER   * Iterator;
-  PPTT_NODE_INDEXER   * CycleDetector;
-  UINT32                NodesRemaining;
+  EFI_STATUS         Status;
+  PPTT_NODE_INDEXER  *Iterator;
+  PPTT_NODE_INDEXER  *CycleDetector;
+  UINT32             NodesRemaining;
 
   ASSERT (Generator != NULL);
 
-  Iterator = Generator->NodeIndexer;
+  Iterator       = Generator->NodeIndexer;
   NodesRemaining = Generator->ProcTopologyStructCount;
 
   while (NodesRemaining != 0) {
@@ -265,7 +266,7 @@ DetectCyclesInTopology (
 
       // Stamp the visited node
       CycleDetector->CycleDetectionStamp = NodesRemaining;
-      CycleDetector = CycleDetector->TopologyParent;
+      CycleDetector                      = CycleDetector->TopologyParent;
     } // Continue topology tree walk
 
     Iterator++;
@@ -293,17 +294,17 @@ DetectCyclesInTopology (
 STATIC
 EFI_STATUS
 AddPrivateResources (
-  IN  CONST ACPI_PPTT_GENERATOR                    * CONST Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  IN        UINT32                                 *       PrivResArray,
+  IN  CONST ACPI_PPTT_GENERATOR                    *CONST  Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  IN        UINT32                                         *PrivResArray,
   IN        UINT32                                         PrivResCount,
   IN  CONST CM_OBJECT_TOKEN                                PrivResArrayToken
   )
 {
-  EFI_STATUS            Status;
-  CM_ARM_OBJ_REF      * CmObjRefs;
-  UINT32                CmObjRefCount;
-  PPTT_NODE_INDEXER   * PpttNodeFound;
+  EFI_STATUS         Status;
+  CM_ARM_OBJ_REF     *CmObjRefs;
+  UINT32             CmObjRefCount;
+  PPTT_NODE_INDEXER  *PpttNodeFound;
 
   ASSERT (
     (Generator != NULL) &&
@@ -422,32 +423,33 @@ AddPrivateResources (
 BOOLEAN
 EFIAPI
 IsGicCTokenEqual (
-  IN  CONST VOID          * Object1,
-  IN  CONST VOID          * Object2,
-  IN        UINTN           Index1,
-  IN        UINTN           Index2
+  IN  CONST VOID   *Object1,
+  IN  CONST VOID   *Object2,
+  IN        UINTN  Index1,
+  IN        UINTN  Index2
   )
 {
-  PPTT_NODE_INDEXER           * IndexedObject1;
-  PPTT_NODE_INDEXER           * IndexedObject2;
-  CM_ARM_PROC_HIERARCHY_INFO  * ProcNode1;
-  CM_ARM_PROC_HIERARCHY_INFO  * ProcNode2;
+  PPTT_NODE_INDEXER           *IndexedObject1;
+  PPTT_NODE_INDEXER           *IndexedObject2;
+  CM_ARM_PROC_HIERARCHY_INFO  *ProcNode1;
+  CM_ARM_PROC_HIERARCHY_INFO  *ProcNode2;
 
   ASSERT (
     (Object1 != NULL) &&
     (Object2 != NULL)
     );
 
-  IndexedObject1 = (PPTT_NODE_INDEXER*)Object1;
-  IndexedObject2 = (PPTT_NODE_INDEXER*)Object2;
-  ProcNode1 = (CM_ARM_PROC_HIERARCHY_INFO*)IndexedObject1->Object;
-  ProcNode2 = (CM_ARM_PROC_HIERARCHY_INFO*)IndexedObject2->Object;
+  IndexedObject1 = (PPTT_NODE_INDEXER *)Object1;
+  IndexedObject2 = (PPTT_NODE_INDEXER *)Object2;
+  ProcNode1      = (CM_ARM_PROC_HIERARCHY_INFO *)IndexedObject1->Object;
+  ProcNode2      = (CM_ARM_PROC_HIERARCHY_INFO *)IndexedObject2->Object;
 
   if (IS_ACPI_PROC_ID_VALID (ProcNode1) &&
       IS_ACPI_PROC_ID_VALID (ProcNode2) &&
       (ProcNode1->GicCToken != CM_NULL_TOKEN) &&
       (ProcNode2->GicCToken != CM_NULL_TOKEN) &&
-      (ProcNode1->GicCToken == ProcNode2->GicCToken)) {
+      (ProcNode1->GicCToken == ProcNode2->GicCToken))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: PPTT: Two Processor Hierarchy Info objects (%d and %d) map to " \
@@ -484,27 +486,27 @@ IsGicCTokenEqual (
 STATIC
 EFI_STATUS
 AddProcHierarchyNodes (
-  IN  CONST ACPI_PPTT_GENERATOR                   * CONST Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN  CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt,
-  IN  CONST UINT32                                        NodesStartOffset
+  IN  CONST ACPI_PPTT_GENERATOR                   *CONST             Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST             CfgMgrProtocol,
+  IN  CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER  *Pptt,
+  IN  CONST UINT32                                                   NodesStartOffset
   )
 {
-  EFI_STATUS                              Status;
-  EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR * ProcStruct;
-  UINT32                                * PrivateResources;
-  BOOLEAN                                 IsGicCTokenDuplicated;
+  EFI_STATUS                             Status;
+  EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR  *ProcStruct;
+  UINT32                                 *PrivateResources;
+  BOOLEAN                                IsGicCTokenDuplicated;
 
-  CM_ARM_GICC_INFO                      * GicCInfoList;
-  UINT32                                  GicCInfoCount;
-  UINT32                                  UniqueGicCRefCount;
+  CM_ARM_GICC_INFO  *GicCInfoList;
+  UINT32            GicCInfoCount;
+  UINT32            UniqueGicCRefCount;
 
-  PPTT_NODE_INDEXER                     * PpttNodeFound;
-  CM_ARM_PROC_HIERARCHY_INFO            * ProcInfoNode;
+  PPTT_NODE_INDEXER           *PpttNodeFound;
+  CM_ARM_PROC_HIERARCHY_INFO  *ProcInfoNode;
 
-  PPTT_NODE_INDEXER                     * ProcNodeIterator;
-  UINT32                                  NodeCount;
-  UINT32                                  Length;
+  PPTT_NODE_INDEXER  *ProcNodeIterator;
+  UINT32             NodeCount;
+  UINT32             Length;
 
   ASSERT (
     (Generator != NULL) &&
@@ -512,11 +514,11 @@ AddProcHierarchyNodes (
     (Pptt != NULL)
     );
 
-  ProcStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR*)((UINT8*)Pptt +
-               NodesStartOffset);
+  ProcStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *)((UINT8 *)Pptt +
+                                                         NodesStartOffset);
 
   ProcNodeIterator = Generator->ProcHierarchyNodeIndexedList;
-  NodeCount = Generator->ProcHierarchyNodeCount;
+  NodeCount        = Generator->ProcHierarchyNodeCount;
 
   // Check if every GICC Object is referenced by onlu one Proc Node
   IsGicCTokenDuplicated = FindDuplicateValue (
@@ -534,7 +536,7 @@ AddProcHierarchyNodes (
   UniqueGicCRefCount = 0;
 
   while (NodeCount-- != 0) {
-    ProcInfoNode = (CM_ARM_PROC_HIERARCHY_INFO*)ProcNodeIterator->Object;
+    ProcInfoNode = (CM_ARM_PROC_HIERARCHY_INFO *)ProcNodeIterator->Object;
 
     // Check if the private resource count is within the size limit
     // imposed on the Processor Hierarchy node by the specification.
@@ -556,16 +558,16 @@ AddProcHierarchyNodes (
     }
 
     // Populate the node header
-    ProcStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR;
-    ProcStruct->Length = (UINT8)Length;
+    ProcStruct->Type        = EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR;
+    ProcStruct->Length      = (UINT8)Length;
     ProcStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
     ProcStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
 
     // Populate the flags
-    ProcStruct->Flags.PhysicalPackage = ProcInfoNode->Flags & BIT0;
-    ProcStruct->Flags.AcpiProcessorIdValid = (ProcInfoNode->Flags & BIT1) >> 1;
-    ProcStruct->Flags.ProcessorIsAThread = (ProcInfoNode->Flags & BIT2) >> 2;
-    ProcStruct->Flags.NodeIsALeaf = (ProcInfoNode->Flags & BIT3) >> 3;
+    ProcStruct->Flags.PhysicalPackage         = ProcInfoNode->Flags & BIT0;
+    ProcStruct->Flags.AcpiProcessorIdValid    = (ProcInfoNode->Flags & BIT1) >> 1;
+    ProcStruct->Flags.ProcessorIsAThread      = (ProcInfoNode->Flags & BIT2) >> 2;
+    ProcStruct->Flags.NodeIsALeaf             = (ProcInfoNode->Flags & BIT3) >> 3;
     ProcStruct->Flags.IdenticalImplementation =
       (ProcInfoNode->Flags & BIT4) >> 4;
     ProcStruct->Flags.Reserved = 0;
@@ -594,7 +596,9 @@ AddProcHierarchyNodes (
 
       // Test if the reference is to a 'leaf' node
       if (IS_PROC_NODE_LEAF (
-            ((CM_ARM_PROC_HIERARCHY_INFO*)PpttNodeFound->Object))) {
+            ((CM_ARM_PROC_HIERARCHY_INFO *)PpttNodeFound->Object)
+            ))
+      {
         Status = EFI_INVALID_PARAMETER;
         DEBUG ((
           DEBUG_ERROR,
@@ -676,18 +680,18 @@ AddProcHierarchyNodes (
     }
 
     ProcStruct->NumberOfPrivateResources = ProcInfoNode->NoOfPrivateResources;
-    PrivateResources = (UINT32*)((UINT8*)ProcStruct +
-                        sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR));
+    PrivateResources                     = (UINT32 *)((UINT8 *)ProcStruct +
+                                                      sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR));
 
     if (ProcStruct->NumberOfPrivateResources != 0) {
       // Populate the private resources array
       Status = AddPrivateResources (
-                  Generator,
-                  CfgMgrProtocol,
-                  PrivateResources,
-                  ProcStruct->NumberOfPrivateResources,
-                  ProcInfoNode->PrivateResourcesArrayToken
-                  );
+                 Generator,
+                 CfgMgrProtocol,
+                 PrivateResources,
+                 ProcStruct->NumberOfPrivateResources,
+                 ProcInfoNode->PrivateResourcesArrayToken
+                 );
       if (EFI_ERROR (Status)) {
         DEBUG ((
           DEBUG_ERROR,
@@ -700,8 +704,8 @@ AddProcHierarchyNodes (
     }
 
     // Next Processor Hierarchy Node
-    ProcStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR*)((UINT8*)ProcStruct +
-                ProcStruct->Length);
+    ProcStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *)((UINT8 *)ProcStruct +
+                                                           ProcStruct->Length);
     ProcNodeIterator++;
   } // Processor Hierarchy Node
 
@@ -762,18 +766,18 @@ AddProcHierarchyNodes (
 STATIC
 EFI_STATUS
 AddCacheTypeStructures (
-  IN  CONST ACPI_PPTT_GENERATOR                   * CONST Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN  CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt,
-  IN  CONST UINT32                                        NodesStartOffset
+  IN  CONST ACPI_PPTT_GENERATOR                   *CONST             Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST             CfgMgrProtocol,
+  IN  CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER  *Pptt,
+  IN  CONST UINT32                                                   NodesStartOffset
   )
 {
-  EFI_STATUS                            Status;
-  EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE   * CacheStruct;
-  PPTT_NODE_INDEXER                   * PpttNodeFound;
-  CM_ARM_CACHE_INFO                   * CacheInfoNode;
-  PPTT_NODE_INDEXER                   * CacheNodeIterator;
-  UINT32                                NodeCount;
+  EFI_STATUS                         Status;
+  EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE  *CacheStruct;
+  PPTT_NODE_INDEXER                  *PpttNodeFound;
+  CM_ARM_CACHE_INFO                  *CacheInfoNode;
+  PPTT_NODE_INDEXER                  *CacheNodeIterator;
+  UINT32                             NodeCount;
 
   ASSERT (
     (Generator != NULL) &&
@@ -781,31 +785,31 @@ AddCacheTypeStructures (
     (Pptt != NULL)
     );
 
-  CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE*)((UINT8*)Pptt +
-                 NodesStartOffset);
+  CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *)((UINT8 *)Pptt +
+                                                      NodesStartOffset);
 
   CacheNodeIterator = Generator->CacheStructIndexedList;
-  NodeCount = Generator->CacheStructCount;
+  NodeCount         = Generator->CacheStructCount;
 
   while (NodeCount-- != 0) {
-    CacheInfoNode = (CM_ARM_CACHE_INFO*)CacheNodeIterator->Object;
+    CacheInfoNode = (CM_ARM_CACHE_INFO *)CacheNodeIterator->Object;
 
     // Populate the node header
-    CacheStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_CACHE;
-    CacheStruct->Length = sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE);
+    CacheStruct->Type        = EFI_ACPI_6_3_PPTT_TYPE_CACHE;
+    CacheStruct->Length      = sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE);
     CacheStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
     CacheStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
 
     // "On Arm-based systems, all cache properties must be provided in the
     // table." (ACPI 6.3, Section 5.2.29.2)
-    CacheStruct->Flags.SizePropertyValid = 1;
-    CacheStruct->Flags.NumberOfSetsValid = 1;
-    CacheStruct->Flags.AssociativityValid = 1;
+    CacheStruct->Flags.SizePropertyValid   = 1;
+    CacheStruct->Flags.NumberOfSetsValid   = 1;
+    CacheStruct->Flags.AssociativityValid  = 1;
     CacheStruct->Flags.AllocationTypeValid = 1;
-    CacheStruct->Flags.CacheTypeValid = 1;
-    CacheStruct->Flags.WritePolicyValid = 1;
-    CacheStruct->Flags.LineSizeValid = 1;
-    CacheStruct->Flags.Reserved = 0;
+    CacheStruct->Flags.CacheTypeValid      = 1;
+    CacheStruct->Flags.WritePolicyValid    = 1;
+    CacheStruct->Flags.LineSizeValid       = 1;
+    CacheStruct->Flags.Reserved            = 0;
 
     // Populate the reference to the next level of cache
     if (CacheInfoNode->NextLevelOfCacheToken == CM_NULL_TOKEN) {
@@ -886,7 +890,7 @@ AddCacheTypeStructures (
     // current ACPI specification.
     // These checks will be needed in the future when the ACPI specification
     // is extended. Disabling this code for now.
-#if 0
+ #if 0
     if (CacheInfoNode->Associativity > PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX) {
       Status = EFI_INVALID_PARAMETER;
       DEBUG ((
@@ -909,7 +913,8 @@ AddCacheTypeStructures (
         CacheInfoNode->Associativity
         ));
     }
-#endif
+
+ #endif
 
     // Note a typecast is needed as the maximum associativity
     // supported by ACPI Cache type structure is MAX_UINT8.
@@ -926,13 +931,13 @@ AddCacheTypeStructures (
 
     // Validate and populate cache line size
     if ((CacheInfoNode->LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) ||
-        (CacheInfoNode->LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX)) {
-
+        (CacheInfoNode->LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX))
+    {
       Status = EFI_INVALID_PARAMETER;
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: PPTT: The cache line size must be between %d and %d bytes " \
-        "on ARM Platforms. LineSize = %d. Status = %r\n" ,
+        "on ARM Platforms. LineSize = %d. Status = %r\n",
         PPTT_ARM_CACHE_LINE_SIZE_MIN,
         PPTT_ARM_CACHE_LINE_SIZE_MAX,
         CacheInfoNode->LineSize,
@@ -946,7 +951,7 @@ AddCacheTypeStructures (
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: PPTT: The cache line size is not a power of 2. " \
-        "LineSize = %d. Status = %r\n" ,
+        "LineSize = %d. Status = %r\n",
         CacheInfoNode->LineSize,
         Status
         ));
@@ -956,8 +961,8 @@ AddCacheTypeStructures (
     CacheStruct->LineSize = CacheInfoNode->LineSize;
 
     // Next Cache Type Structure
-    CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE*)((UINT8*)CacheStruct +
-                   CacheStruct->Length);
+    CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *)((UINT8 *)CacheStruct +
+                                                        CacheStruct->Length);
     CacheNodeIterator++;
   } // Cache Type Structure
 
@@ -984,17 +989,16 @@ AddCacheTypeStructures (
 STATIC
 EFI_STATUS
 AddIdTypeStructures (
-  IN  CONST ACPI_PPTT_GENERATOR                   * CONST Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN  CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt,
-  IN  CONST UINT32                                        NodesStartOffset
+  IN  CONST ACPI_PPTT_GENERATOR                   *CONST             Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST             CfgMgrProtocol,
+  IN  CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER  *Pptt,
+  IN  CONST UINT32                                                   NodesStartOffset
   )
 {
-  EFI_ACPI_6_3_PPTT_STRUCTURE_ID    * IdStruct;
-  CM_ARM_PROC_NODE_ID_INFO          * ProcIdInfoNode;
-  PPTT_NODE_INDEXER                 * IdStructIterator;
-  UINT32                              NodeCount;
-
+  EFI_ACPI_6_3_PPTT_STRUCTURE_ID  *IdStruct;
+  CM_ARM_PROC_NODE_ID_INFO        *ProcIdInfoNode;
+  PPTT_NODE_INDEXER               *IdStructIterator;
+  UINT32                          NodeCount;
 
   ASSERT (
     (Generator != NULL) &&
@@ -1002,28 +1006,28 @@ AddIdTypeStructures (
     (Pptt != NULL)
     );
 
-  IdStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_ID*)((UINT8*)Pptt + NodesStartOffset);
+  IdStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_ID *)((UINT8 *)Pptt + NodesStartOffset);
 
   IdStructIterator = Generator->IdStructIndexedList;
-  NodeCount = Generator->IdStructCount;
+  NodeCount        = Generator->IdStructCount;
   while (NodeCount-- != 0) {
-    ProcIdInfoNode = (CM_ARM_PROC_NODE_ID_INFO*)IdStructIterator->Object;
+    ProcIdInfoNode = (CM_ARM_PROC_NODE_ID_INFO *)IdStructIterator->Object;
 
     // Populate the node
-    IdStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_ID;
-    IdStruct->Length = sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_ID);
+    IdStruct->Type        = EFI_ACPI_6_3_PPTT_TYPE_ID;
+    IdStruct->Length      = sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_ID);
     IdStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
     IdStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
-    IdStruct->VendorId = ProcIdInfoNode->VendorId;
-    IdStruct->Level1Id = ProcIdInfoNode->Level1Id;
-    IdStruct->Level2Id = ProcIdInfoNode->Level2Id;
-    IdStruct->MajorRev = ProcIdInfoNode->MajorRev;
-    IdStruct->MinorRev = ProcIdInfoNode->MinorRev;
-    IdStruct->SpinRev = ProcIdInfoNode->SpinRev;
+    IdStruct->VendorId    = ProcIdInfoNode->VendorId;
+    IdStruct->Level1Id    = ProcIdInfoNode->Level1Id;
+    IdStruct->Level2Id    = ProcIdInfoNode->Level2Id;
+    IdStruct->MajorRev    = ProcIdInfoNode->MajorRev;
+    IdStruct->MinorRev    = ProcIdInfoNode->MinorRev;
+    IdStruct->SpinRev     = ProcIdInfoNode->SpinRev;
 
     // Next ID Type Structure
-    IdStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_ID*)((UINT8*)IdStruct +
-                IdStruct->Length);
+    IdStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_ID *)((UINT8 *)IdStruct +
+                                                  IdStruct->Length);
     IdStructIterator++;
   } // ID Type Structure
 
@@ -1057,33 +1061,33 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildPpttTable (
-  IN  CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
-  EFI_STATUS                      Status;
-  UINT32                          TableSize;
-  UINT32                          ProcTopologyStructCount;
-  UINT32                          ProcHierarchyNodeCount;
-  UINT32                          CacheStructCount;
-  UINT32                          IdStructCount;
+  EFI_STATUS  Status;
+  UINT32      TableSize;
+  UINT32      ProcTopologyStructCount;
+  UINT32      ProcHierarchyNodeCount;
+  UINT32      CacheStructCount;
+  UINT32      IdStructCount;
 
-  UINT32                          ProcHierarchyNodeOffset;
-  UINT32                          CacheStructOffset;
-  UINT32                          IdStructOffset;
+  UINT32  ProcHierarchyNodeOffset;
+  UINT32  CacheStructOffset;
+  UINT32  IdStructOffset;
 
-  CM_ARM_PROC_HIERARCHY_INFO    * ProcHierarchyNodeList;
-  CM_ARM_CACHE_INFO             * CacheStructList;
-  CM_ARM_PROC_NODE_ID_INFO      * IdStructList;
+  CM_ARM_PROC_HIERARCHY_INFO  *ProcHierarchyNodeList;
+  CM_ARM_CACHE_INFO           *CacheStructList;
+  CM_ARM_PROC_NODE_ID_INFO    *IdStructList;
 
-  ACPI_PPTT_GENERATOR           * Generator;
+  ACPI_PPTT_GENERATOR  *Generator;
 
   // Pointer to the Node Indexer array
-  PPTT_NODE_INDEXER             * NodeIndexer;
+  PPTT_NODE_INDEXER  *NodeIndexer;
 
-  EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt;
+  EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER  *Pptt;
 
   ASSERT (
     (This != NULL) &&
@@ -1095,7 +1099,8 @@ BuildPpttTable (
     );
 
   if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
-      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: PPTT: Requested table revision = %d is not supported. "
@@ -1107,8 +1112,8 @@ BuildPpttTable (
     return EFI_INVALID_PARAMETER;
   }
 
-  Generator = (ACPI_PPTT_GENERATOR*)This;
-  *Table = NULL;
+  Generator = (ACPI_PPTT_GENERATOR *)This;
+  *Table    = NULL;
 
   // Get the processor hierarchy info and update the processor topology
   // structure count with Processor Hierarchy Nodes (Type 0)
@@ -1127,7 +1132,7 @@ BuildPpttTable (
     goto error_handler;
   }
 
-  ProcTopologyStructCount = ProcHierarchyNodeCount;
+  ProcTopologyStructCount           = ProcHierarchyNodeCount;
   Generator->ProcHierarchyNodeCount = ProcHierarchyNodeCount;
 
   // Get the cache info and update the processor topology structure count with
@@ -1147,7 +1152,7 @@ BuildPpttTable (
     goto error_handler;
   }
 
-  ProcTopologyStructCount += CacheStructCount;
+  ProcTopologyStructCount    += CacheStructCount;
   Generator->CacheStructCount = CacheStructCount;
 
   // Get the processor hierarchy node ID info and update the processor topology
@@ -1172,10 +1177,10 @@ BuildPpttTable (
   Generator->IdStructCount = IdStructCount;
 
   // Allocate Node Indexer array
-  NodeIndexer = (PPTT_NODE_INDEXER*)AllocateZeroPool (
-                                      sizeof (PPTT_NODE_INDEXER) *
-                                      ProcTopologyStructCount
-                                      );
+  NodeIndexer = (PPTT_NODE_INDEXER *)AllocateZeroPool (
+                                       sizeof (PPTT_NODE_INDEXER) *
+                                       ProcTopologyStructCount
+                                       );
   if (NodeIndexer == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     DEBUG ((
@@ -1188,21 +1193,21 @@ BuildPpttTable (
 
   DEBUG ((DEBUG_INFO, "INFO: NodeIndexer = %p\n", NodeIndexer));
   Generator->ProcTopologyStructCount = ProcTopologyStructCount;
-  Generator->NodeIndexer = NodeIndexer;
+  Generator->NodeIndexer             = NodeIndexer;
 
   // Calculate the size of the PPTT table
   TableSize = sizeof (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER);
 
   // Include the size of Processor Hierarchy Nodes and index them
   if (Generator->ProcHierarchyNodeCount != 0) {
-    ProcHierarchyNodeOffset = TableSize;
+    ProcHierarchyNodeOffset                 = TableSize;
     Generator->ProcHierarchyNodeIndexedList = NodeIndexer;
-    TableSize += GetSizeofProcHierarchyNodes (
-                   ProcHierarchyNodeOffset,
-                   ProcHierarchyNodeList,
-                   Generator->ProcHierarchyNodeCount,
-                   &NodeIndexer
-                   );
+    TableSize                              += GetSizeofProcHierarchyNodes (
+                                                ProcHierarchyNodeOffset,
+                                                ProcHierarchyNodeList,
+                                                Generator->ProcHierarchyNodeCount,
+                                                &NodeIndexer
+                                                );
 
     DEBUG ((
       DEBUG_INFO,
@@ -1213,19 +1218,18 @@ BuildPpttTable (
       ProcHierarchyNodeOffset,
       Generator->ProcHierarchyNodeIndexedList
       ));
-
   }
 
   // Include the size of Cache Type Structures and index them
   if (Generator->CacheStructCount != 0) {
-    CacheStructOffset = TableSize;
+    CacheStructOffset                 = TableSize;
     Generator->CacheStructIndexedList = NodeIndexer;
-    TableSize += GetSizeofCacheTypeStructs (
-                   CacheStructOffset,
-                   CacheStructList,
-                   Generator->CacheStructCount,
-                   &NodeIndexer
-                   );
+    TableSize                        += GetSizeofCacheTypeStructs (
+                                          CacheStructOffset,
+                                          CacheStructList,
+                                          Generator->CacheStructCount,
+                                          &NodeIndexer
+                                          );
     DEBUG ((
       DEBUG_INFO,
       " CacheStructCount = %d\n" \
@@ -1239,14 +1243,14 @@ BuildPpttTable (
 
   // Include the size of ID Type Structures and index them
   if (Generator->IdStructCount != 0) {
-    IdStructOffset = TableSize;
+    IdStructOffset                 = TableSize;
     Generator->IdStructIndexedList = NodeIndexer;
-    TableSize += GetSizeofIdStructs (
-                   IdStructOffset,
-                   IdStructList,
-                   Generator->IdStructCount,
-                   &NodeIndexer
-                   );
+    TableSize                     += GetSizeofIdStructs (
+                                       IdStructOffset,
+                                       IdStructList,
+                                       Generator->IdStructCount,
+                                       &NodeIndexer
+                                       );
     DEBUG ((
       DEBUG_INFO,
       " IdStructCount = %d\n" \
@@ -1268,7 +1272,7 @@ BuildPpttTable (
     ));
 
   // Allocate the Buffer for the PPTT table
-  *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
   if (*Table == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     DEBUG ((
@@ -1281,7 +1285,7 @@ BuildPpttTable (
     goto error_handler;
   }
 
-  Pptt = (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER*)*Table;
+  Pptt = (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *)*Table;
 
   DEBUG ((
     DEBUG_INFO,
@@ -1403,13 +1407,13 @@ error_handler:
 STATIC
 EFI_STATUS
 FreePpttTableResources (
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
-  ACPI_PPTT_GENERATOR * Generator;
+  ACPI_PPTT_GENERATOR  *Generator;
 
   ASSERT (
     (This != NULL) &&
@@ -1419,7 +1423,7 @@ FreePpttTableResources (
     (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
     );
 
-  Generator = (ACPI_PPTT_GENERATOR*)This;
+  Generator = (ACPI_PPTT_GENERATOR *)This;
 
   // Free any memory allocated by the generator
   if (Generator->NodeIndexer != NULL) {
@@ -1443,12 +1447,12 @@ FreePpttTableResources (
 
 /** The PPTT Table Generator revision.
 */
-#define PPTT_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define PPTT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the PPTT Table Generator.
 */
 STATIC
-ACPI_PPTT_GENERATOR PpttGenerator = {
+ACPI_PPTT_GENERATOR  PpttGenerator = {
   // ACPI table generator header
   {
     // Generator ID
@@ -1504,11 +1508,12 @@ ACPI_PPTT_GENERATOR PpttGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiPpttLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&PpttGenerator.Header);
   DEBUG ((DEBUG_INFO, "PPTT: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -1528,11 +1533,12 @@ AcpiPpttLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiPpttLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&PpttGenerator.Header);
   DEBUG ((DEBUG_INFO, "PPTT: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

+ 23 - 23
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h

@@ -21,30 +21,30 @@
 /// Cache parameters allowed by the architecture with
 /// ARMv8.3-CCIDX (Cache extended number of sets)
 /// 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
 /// ARMv8.3-CCIDX (Cache extended number of sets)
 /// 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
 /// Derived from CCSIDR_EL1
 /// The LineSize is represented by bits 2:0
 /// (Log2(Number of bytes in cache line)) - 4 is used to represent
 /// 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)
 
 /// Test if the given Processor Hierarchy Info object has the 'Node is a Leaf'
 /// flag set
-#define IS_PROC_NODE_LEAF(Node) ((Node->Flags & BIT3) != 0)
+#define IS_PROC_NODE_LEAF(Node)  ((Node->Flags & BIT3) != 0)
 
 /// Test if the given Processor Hierarchy Info object has the 'ACPI Processor
 /// ID valid' flag set
-#define IS_ACPI_PROC_ID_VALID(Node) ((Node->Flags & BIT1) != 0)
+#define IS_ACPI_PROC_ID_VALID(Node)  ((Node->Flags & BIT1) != 0)
 
 /**
   The GET_SIZE_OF_PPTT_STRUCTS macro expands to a function that is used to
@@ -90,10 +90,10 @@
   @param [in]       CmObjectType    Data type of the CM nodes in NodesToIndex.
 **/
 #define GET_SIZE_OF_PPTT_STRUCTS(                                             \
-  PpttObjName,                                                                \
-  PpttObjSize,                                                                \
-  CmObjectType                                                                \
-)                                                                             \
+                                                                              PpttObjName,                                                                \
+                                                                              PpttObjSize,                                                                \
+                                                                              CmObjectType                                                                \
+                                                                              )                                                                             \
 STATIC                                                                        \
 UINT32                                                                        \
 GetSizeof##PpttObjName (                                                      \
@@ -148,7 +148,7 @@ typedef struct PpttNodeIndexer {
   /// Unique identifier for the node
   CM_OBJECT_TOKEN           Token;
   /// Pointer to the CM object being indexed
-  VOID                    * Object;
+  VOID                      *Object;
   /// Offset from the start of the PPTT table to the PPTT structure which is
   /// represented by Object
   UINT32                    Offset;
@@ -159,29 +159,29 @@ typedef struct PpttNodeIndexer {
   /// Indexer element in the processor and cache topology
   /// e.g For a hardware thread the TopologyParent would point to a CPU node
   ///     For a L1 cache the TopologyParent would point to a L2 cache
-  struct PpttNodeIndexer  * TopologyParent;
+  struct PpttNodeIndexer    *TopologyParent;
 } PPTT_NODE_INDEXER;
 
 typedef struct AcpiPpttGenerator {
   /// ACPI Table generator header
-  ACPI_TABLE_GENERATOR  Header;
+  ACPI_TABLE_GENERATOR    Header;
   /// PPTT structure count
-  UINT32                ProcTopologyStructCount;
+  UINT32                  ProcTopologyStructCount;
   /// Count of Processor Hierarchy Nodes
-  UINT32                ProcHierarchyNodeCount;
+  UINT32                  ProcHierarchyNodeCount;
   /// Count of Cache Structures
-  UINT32                CacheStructCount;
+  UINT32                  CacheStructCount;
   /// Count of Id Structures
-  UINT32                IdStructCount;
+  UINT32                  IdStructCount;
   /// List of indexed CM objects for PPTT generation
-  PPTT_NODE_INDEXER   * NodeIndexer;
+  PPTT_NODE_INDEXER       *NodeIndexer;
   /// Pointer to the start of Processor Hierarchy nodes in
   /// the Node Indexer array
-  PPTT_NODE_INDEXER   * ProcHierarchyNodeIndexedList;
+  PPTT_NODE_INDEXER       *ProcHierarchyNodeIndexedList;
   /// Pointer to the start of Cache Structures in the Node Indexer array
-  PPTT_NODE_INDEXER   * CacheStructIndexedList;
+  PPTT_NODE_INDEXER       *CacheStructIndexedList;
   /// Pointer to the start of Id Structures in the Node Indexer array
-  PPTT_NODE_INDEXER   * IdStructIndexedList;
+  PPTT_NODE_INDEXER       *IdStructIndexedList;
 } ACPI_PPTT_GENERATOR;
 
 #pragma pack()

+ 12 - 10
DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c

@@ -38,10 +38,10 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildRawTable (
-  IN  CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
   ASSERT (This != NULL);
@@ -63,13 +63,13 @@ BuildRawTable (
 
 /** This macro defines the Raw Generator revision.
 */
-#define RAW_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define RAW_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the Raw Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR RawGenerator = {
+ACPI_TABLE_GENERATOR  RawGenerator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdRaw),
   // Generator Description
@@ -109,11 +109,12 @@ ACPI_TABLE_GENERATOR RawGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiRawLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&RawGenerator);
   DEBUG ((DEBUG_INFO, "RAW: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -132,11 +133,12 @@ AcpiRawLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiRawLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&RawGenerator);
   DEBUG ((DEBUG_INFO, "RAW: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

+ 38 - 33
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c

@@ -45,22 +45,22 @@ NOTE: This implementation ignores the possibility that the Serial settings may
 
 /** A string representing the name of the SPCR port.
 */
-#define NAME_STR_SPCR_PORT               "COM1"
+#define NAME_STR_SPCR_PORT  "COM1"
 
 /** An UID representing the SPCR port.
 */
-#define UID_SPCR_PORT                    1
+#define UID_SPCR_PORT  1
 
 /** This macro defines the no flow control option.
 */
-#define SPCR_FLOW_CONTROL_NONE           0
+#define SPCR_FLOW_CONTROL_NONE  0
 
 /**A template for generating the SPCR Table.
 
   Note: fields marked "{Template}" will be updated dynamically.
 */
 STATIC
-EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE AcpiSpcr = {
+EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE  AcpiSpcr = {
   ACPI_HEADER (
     EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
     EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE,
@@ -120,15 +120,15 @@ STATIC
 EFI_STATUS
 EFIAPI
 FreeSpcrTableEx (
-  IN      CONST ACPI_TABLE_GENERATOR                   * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          *** CONST Table,
+  IN      CONST ACPI_TABLE_GENERATOR                   *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ***CONST  Table,
   IN      CONST UINTN                                          TableCount
   )
 {
-  EFI_STATUS                        Status;
-  EFI_ACPI_DESCRIPTION_HEADER    ** TableList;
+  EFI_STATUS                   Status;
+  EFI_ACPI_DESCRIPTION_HEADER  **TableList;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -138,7 +138,8 @@ FreeSpcrTableEx (
 
   if ((Table == NULL)   ||
       (*Table == NULL)  ||
-      (TableCount != 2)) {
+      (TableCount != 2))
+  {
     DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid Table Pointer\n"));
     return EFI_INVALID_PARAMETER;
   }
@@ -147,7 +148,8 @@ FreeSpcrTableEx (
 
   if ((TableList[1] == NULL) ||
       (TableList[1]->Signature !=
-       EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
+       EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
+  {
     DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid SSDT table pointer.\n"));
     return EFI_INVALID_PARAMETER;
   }
@@ -191,17 +193,17 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildSpcrTableEx (
-  IN  CONST ACPI_TABLE_GENERATOR                   *       This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ***       Table,
-  OUT       UINTN                                  * CONST TableCount
+  IN  CONST ACPI_TABLE_GENERATOR                           *This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER                    ***Table,
+  OUT       UINTN                                  *CONST  TableCount
   )
 {
-  EFI_STATUS                      Status;
-  CM_ARM_SERIAL_PORT_INFO       * SerialPortInfo;
-  UINT32                          SerialPortCount;
-  EFI_ACPI_DESCRIPTION_HEADER  ** TableList;
+  EFI_STATUS                   Status;
+  CM_ARM_SERIAL_PORT_INFO      *SerialPortInfo;
+  UINT32                       SerialPortCount;
+  EFI_ACPI_DESCRIPTION_HEADER  **TableList;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -212,7 +214,8 @@ BuildSpcrTableEx (
   ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
 
   if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
-      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: SPCR: Requested table revision = %d, is not supported."
@@ -264,8 +267,8 @@ BuildSpcrTableEx (
   }
 
   // Allocate a table to store pointers to the SPCR and SSDT tables.
-  TableList = (EFI_ACPI_DESCRIPTION_HEADER**)
-              AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * 2);
+  TableList = (EFI_ACPI_DESCRIPTION_HEADER **)
+              AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER *) * 2);
   if (TableList == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     DEBUG ((
@@ -281,7 +284,7 @@ BuildSpcrTableEx (
   Status = AddAcpiHeader (
              CfgMgrProtocol,
              This,
-             (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr,
+             (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiSpcr,
              AcpiTableInfo,
              sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE)
              );
@@ -364,7 +367,7 @@ BuildSpcrTableEx (
       goto error_handler;
   } // switch
 
-  TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr;
+  TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiSpcr;
 
   // Build a SSDT table describing the serial port.
   Status = BuildSsdtSerialPortTable (
@@ -384,7 +387,7 @@ BuildSpcrTableEx (
   }
 
   *TableCount = 2;
-  *Table = TableList;
+  *Table      = TableList;
 
   return Status;
 
@@ -398,13 +401,13 @@ error_handler:
 
 /** This macro defines the SPCR Table Generator revision.
 */
-#define SPCR_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define SPCR_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the SPCR Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR SpcrGenerator = {
+ACPI_TABLE_GENERATOR  SpcrGenerator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr),
   // Generator Description
@@ -442,11 +445,12 @@ ACPI_TABLE_GENERATOR SpcrGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiSpcrLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&SpcrGenerator);
   DEBUG ((DEBUG_INFO, "SPCR: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -465,11 +469,12 @@ AcpiSpcrLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiSpcrLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&SpcrGenerator);
   DEBUG ((DEBUG_INFO, "SPCR: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

+ 126 - 119
DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c

@@ -97,7 +97,6 @@ GET_OBJECT_LIST (
   CM_ARM_DEVICE_HANDLE_PCI
   );
 
-
 /** Return the PCI Device information in BDF format
 
     PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
@@ -111,11 +110,12 @@ GET_OBJECT_LIST (
 STATIC
 UINT16
 GetBdf (
-  IN CONST CM_ARM_DEVICE_HANDLE_PCI  * DeviceHandlePci
+  IN CONST CM_ARM_DEVICE_HANDLE_PCI  *DeviceHandlePci
   )
 {
-  UINT16 Bdf;
-  Bdf = (UINT16)DeviceHandlePci->BusNumber << 8;
+  UINT16  Bdf;
+
+  Bdf  = (UINT16)DeviceHandlePci->BusNumber << 8;
   Bdf |= (DeviceHandlePci->DeviceNumber & 0x1F) << 3;
   Bdf |= DeviceHandlePci->FunctionNumber & 0x7;
   return Bdf;
@@ -136,35 +136,36 @@ GetBdf (
 STATIC
 EFI_STATUS
 AddGICCAffinity (
-  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         * CONST CfgMgrProtocol,
-  IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat,
+  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         *CONST  CfgMgrProtocol,
+  IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST  Srat,
   IN CONST UINT32                                               GicCAffOffset,
-  IN CONST CM_ARM_GICC_INFO                             *       GicCInfo,
+  IN CONST CM_ARM_GICC_INFO                                     *GicCInfo,
   IN       UINT32                                               GicCCount
   )
 {
-  EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE        * GicCAff;
+  EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE  *GicCAff;
 
   ASSERT (Srat != NULL);
   ASSERT (GicCInfo != NULL);
 
-  GicCAff = (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *)((UINT8*)Srat +
-                    GicCAffOffset);
+  GicCAff = (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
+                                                     GicCAffOffset);
 
   while (GicCCount-- != 0) {
     DEBUG ((DEBUG_INFO, "SRAT: GicCAff = 0x%p\n", GicCAff));
 
-    GicCAff->Type = EFI_ACPI_6_3_GICC_AFFINITY;
-    GicCAff->Length = sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE);
-    GicCAff->ProximityDomain = GicCInfo->ProximityDomain;
+    GicCAff->Type             = EFI_ACPI_6_3_GICC_AFFINITY;
+    GicCAff->Length           = sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE);
+    GicCAff->ProximityDomain  = GicCInfo->ProximityDomain;
     GicCAff->AcpiProcessorUid = GicCInfo->AcpiProcessorUid;
-    GicCAff->Flags = GicCInfo->AffinityFlags;
-    GicCAff->ClockDomain = GicCInfo->ClockDomain;
+    GicCAff->Flags            = GicCInfo->AffinityFlags;
+    GicCAff->ClockDomain      = GicCInfo->ClockDomain;
 
     // Next
     GicCAff++;
     GicCInfo++;
   }// while
+
   return EFI_SUCCESS;
 }
 
@@ -183,35 +184,36 @@ AddGICCAffinity (
 STATIC
 EFI_STATUS
 AddGICItsAffinity (
-  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         * CONST CfgMgrProtocol,
-  IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat,
+  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         *CONST  CfgMgrProtocol,
+  IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST  Srat,
   IN CONST UINT32                                               GicItsAffOffset,
-  IN CONST CM_ARM_GIC_ITS_INFO                          *       GicItsInfo,
+  IN CONST CM_ARM_GIC_ITS_INFO                                  *GicItsInfo,
   IN       UINT32                                               GicItsCount
   )
 {
-  EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE     * GicItsAff;
+  EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE  *GicItsAff;
 
   ASSERT (Srat != NULL);
   ASSERT (GicItsInfo != NULL);
 
-  GicItsAff = (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *)((UINT8*)Srat +
-                    GicItsAffOffset);
+  GicItsAff = (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
+                                                          GicItsAffOffset);
 
   while (GicItsCount-- != 0) {
     DEBUG ((DEBUG_INFO, "SRAT: GicItsAff = 0x%p\n", GicItsAff));
 
-    GicItsAff->Type = EFI_ACPI_6_3_GIC_ITS_AFFINITY;
-    GicItsAff->Length = sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE);
+    GicItsAff->Type            = EFI_ACPI_6_3_GIC_ITS_AFFINITY;
+    GicItsAff->Length          = sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE);
     GicItsAff->ProximityDomain = GicItsInfo->ProximityDomain;
-    GicItsAff->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
-    GicItsAff->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
-    GicItsAff->ItsId = GicItsInfo->GicItsId;
+    GicItsAff->Reserved[0]     = EFI_ACPI_RESERVED_BYTE;
+    GicItsAff->Reserved[1]     = EFI_ACPI_RESERVED_BYTE;
+    GicItsAff->ItsId           = GicItsInfo->GicItsId;
 
     // Next
     GicItsAff++;
     GicItsInfo++;
   }// while
+
   return EFI_SUCCESS;
 }
 
@@ -230,44 +232,44 @@ AddGICItsAffinity (
 STATIC
 EFI_STATUS
 AddMemoryAffinity (
-  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         * CONST CfgMgrProtocol,
-  IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat,
+  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         *CONST  CfgMgrProtocol,
+  IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST  Srat,
   IN CONST UINT32                                               MemAffOffset,
-  IN CONST CM_ARM_MEMORY_AFFINITY_INFO                  *       MemAffInfo,
+  IN CONST CM_ARM_MEMORY_AFFINITY_INFO                          *MemAffInfo,
   IN       UINT32                                               MemAffCount
   )
 {
-  EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE      * MemAff;
+  EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE  *MemAff;
 
   ASSERT (Srat != NULL);
   ASSERT (MemAffInfo != NULL);
 
-  MemAff = (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *)((UINT8*)Srat +
-              MemAffOffset);
+  MemAff = (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
+                                                      MemAffOffset);
 
   while (MemAffCount-- != 0) {
     DEBUG ((DEBUG_INFO, "SRAT: MemAff = 0x%p\n", MemAff));
 
-    MemAff->Type = EFI_ACPI_6_3_MEMORY_AFFINITY;
-    MemAff->Length = sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE);
+    MemAff->Type            = EFI_ACPI_6_3_MEMORY_AFFINITY;
+    MemAff->Length          = sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE);
     MemAff->ProximityDomain = MemAffInfo->ProximityDomain;
-    MemAff->Reserved1 = EFI_ACPI_RESERVED_WORD;
-    MemAff->AddressBaseLow = (UINT32)(MemAffInfo->BaseAddress & MAX_UINT32);
+    MemAff->Reserved1       = EFI_ACPI_RESERVED_WORD;
+    MemAff->AddressBaseLow  = (UINT32)(MemAffInfo->BaseAddress & MAX_UINT32);
     MemAff->AddressBaseHigh = (UINT32)(MemAffInfo->BaseAddress >> 32);
-    MemAff->LengthLow = (UINT32)(MemAffInfo->Length & MAX_UINT32);
-    MemAff->LengthHigh = (UINT32)(MemAffInfo->Length >> 32);
-    MemAff->Reserved2 = EFI_ACPI_RESERVED_DWORD;
-    MemAff->Flags = MemAffInfo->Flags;
-    MemAff->Reserved3 = EFI_ACPI_RESERVED_QWORD;
+    MemAff->LengthLow       = (UINT32)(MemAffInfo->Length & MAX_UINT32);
+    MemAff->LengthHigh      = (UINT32)(MemAffInfo->Length >> 32);
+    MemAff->Reserved2       = EFI_ACPI_RESERVED_DWORD;
+    MemAff->Flags           = MemAffInfo->Flags;
+    MemAff->Reserved3       = EFI_ACPI_RESERVED_QWORD;
 
     // Next
     MemAff++;
     MemAffInfo++;
   }// while
+
   return EFI_SUCCESS;
 }
 
-
 /** Add the Generic Initiator Affinity Structures in the SRAT Table.
 
   @param [in]  CfgMgrProtocol   Pointer to the Configuration Manager
@@ -290,34 +292,34 @@ AddMemoryAffinity (
 STATIC
 EFI_STATUS
 AddGenericInitiatorAffinity (
-  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         * CONST CfgMgrProtocol,
-  IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat,
+  IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL         *CONST  CfgMgrProtocol,
+  IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST  Srat,
   IN CONST UINT32                                               GenInitAffOff,
-  IN CONST CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO       *       GenInitAffInfo,
+  IN CONST CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO               *GenInitAffInfo,
   IN       UINT32                                               GenInitAffCount
   )
 {
-  EFI_STATUS                                               Status;
-  EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE      * GenInitAff;
-  CM_ARM_DEVICE_HANDLE_ACPI                              * DeviceHandleAcpi;
-  CM_ARM_DEVICE_HANDLE_PCI                               * DeviceHandlePci;
-  UINT32                                                   DeviceHandleCount;
+  EFI_STATUS                                         Status;
+  EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE  *GenInitAff;
+  CM_ARM_DEVICE_HANDLE_ACPI                          *DeviceHandleAcpi;
+  CM_ARM_DEVICE_HANDLE_PCI                           *DeviceHandlePci;
+  UINT32                                             DeviceHandleCount;
 
   ASSERT (Srat != NULL);
   ASSERT (GenInitAffInfo != NULL);
 
   GenInitAff = (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE *)(
-                  (UINT8*)Srat + GenInitAffOff);
+                                                                     (UINT8 *)Srat + GenInitAffOff);
 
   while (GenInitAffCount-- != 0) {
     DEBUG ((DEBUG_INFO, "SRAT: GenInitAff = 0x%p\n", GenInitAff));
 
-    GenInitAff->Type = EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY;
+    GenInitAff->Type   = EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY;
     GenInitAff->Length =
       sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE);
-    GenInitAff->Reserved1 = EFI_ACPI_RESERVED_WORD;
+    GenInitAff->Reserved1        = EFI_ACPI_RESERVED_WORD;
     GenInitAff->DeviceHandleType = GenInitAffInfo->DeviceHandleType;
-    GenInitAff->ProximityDomain = GenInitAffInfo->ProximityDomain;
+    GenInitAff->ProximityDomain  = GenInitAffInfo->ProximityDomain;
 
     if (GenInitAffInfo->DeviceHandleToken == CM_NULL_TOKEN) {
       DEBUG ((
@@ -351,14 +353,15 @@ AddGenericInitiatorAffinity (
       ASSERT (DeviceHandleCount == 1);
 
       // Populate the ACPI device handle information.
-      GenInitAff->DeviceHandle.Acpi.AcpiHid = DeviceHandleAcpi->Hid;
-      GenInitAff->DeviceHandle.Acpi.AcpiUid = DeviceHandleAcpi->Uid;
+      GenInitAff->DeviceHandle.Acpi.AcpiHid     = DeviceHandleAcpi->Hid;
+      GenInitAff->DeviceHandle.Acpi.AcpiUid     = DeviceHandleAcpi->Uid;
       GenInitAff->DeviceHandle.Acpi.Reserved[0] = EFI_ACPI_RESERVED_BYTE;
       GenInitAff->DeviceHandle.Acpi.Reserved[1] = EFI_ACPI_RESERVED_BYTE;
       GenInitAff->DeviceHandle.Acpi.Reserved[2] = EFI_ACPI_RESERVED_BYTE;
       GenInitAff->DeviceHandle.Acpi.Reserved[3] = EFI_ACPI_RESERVED_BYTE;
     } else if (GenInitAffInfo->DeviceHandleType ==
-               EFI_ACPI_6_3_PCI_DEVICE_HANDLE) {
+               EFI_ACPI_6_3_PCI_DEVICE_HANDLE)
+    {
       Status = GetEArmObjDeviceHandlePci (
                  CfgMgrProtocol,
                  GenInitAffInfo->DeviceHandleToken,
@@ -381,19 +384,19 @@ AddGenericInitiatorAffinity (
       ASSERT (DeviceHandleCount == 1);
 
       // Populate the ACPI device handle information.
-      GenInitAff->DeviceHandle.Pci.PciSegment = DeviceHandlePci->SegmentNumber;
+      GenInitAff->DeviceHandle.Pci.PciSegment   = DeviceHandlePci->SegmentNumber;
       GenInitAff->DeviceHandle.Pci.PciBdfNumber = GetBdf (DeviceHandlePci);
 
-      GenInitAff->DeviceHandle.Pci.Reserved[0] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[1] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[2] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[3] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[4] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[5] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[6] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[7] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[8] = EFI_ACPI_RESERVED_BYTE;
-      GenInitAff->DeviceHandle.Pci.Reserved[9] = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[0]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[1]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[2]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[3]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[4]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[5]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[6]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[7]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[8]  = EFI_ACPI_RESERVED_BYTE;
+      GenInitAff->DeviceHandle.Pci.Reserved[9]  = EFI_ACPI_RESERVED_BYTE;
       GenInitAff->DeviceHandle.Pci.Reserved[10] = EFI_ACPI_RESERVED_BYTE;
       GenInitAff->DeviceHandle.Pci.Reserved[11] = EFI_ACPI_RESERVED_BYTE;
     } else {
@@ -405,7 +408,7 @@ AddGenericInitiatorAffinity (
       return EFI_INVALID_PARAMETER;
     }
 
-    GenInitAff->Flags = GenInitAffInfo->Flags;
+    GenInitAff->Flags        = GenInitAffInfo->Flags;
     GenInitAff->Reserved2[0] = EFI_ACPI_RESERVED_BYTE;
     GenInitAff->Reserved2[1] = EFI_ACPI_RESERVED_BYTE;
 
@@ -413,6 +416,7 @@ AddGenericInitiatorAffinity (
     GenInitAff++;
     GenInitAffInfo++;
   }// while
+
   return EFI_SUCCESS;
 }
 
@@ -443,10 +447,10 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildSratTable (
-  IN  CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
   EFI_STATUS  Status;
@@ -456,17 +460,17 @@ BuildSratTable (
   UINT32      MemAffCount;
   UINT32      GenInitiatorAffCount;
 
-  UINT32      GicCAffOffset;
-  UINT32      GicItsAffOffset;
-  UINT32      MemAffOffset;
-  UINT32      GenInitiatorAffOffset;
+  UINT32  GicCAffOffset;
+  UINT32  GicItsAffOffset;
+  UINT32  MemAffOffset;
+  UINT32  GenInitiatorAffOffset;
 
-  CM_ARM_GICC_INFO                        * GicCInfo;
-  CM_ARM_GIC_ITS_INFO                     * GicItsInfo;
-  CM_ARM_MEMORY_AFFINITY_INFO             * MemAffInfo;
-  CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO  * GenInitiatorAffInfo;
+  CM_ARM_GICC_INFO                        *GicCInfo;
+  CM_ARM_GIC_ITS_INFO                     *GicItsInfo;
+  CM_ARM_MEMORY_AFFINITY_INFO             *MemAffInfo;
+  CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO  *GenInitiatorAffInfo;
 
-  EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * Srat;
+  EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER  *Srat;
 
   ASSERT (
     (This != NULL) &&
@@ -478,7 +482,8 @@ BuildSratTable (
     );
 
   if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
-      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: SRAT: Requested table revision = %d is not supported. "
@@ -567,28 +572,28 @@ BuildSratTable (
   TableSize = sizeof (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER);
 
   GicCAffOffset = TableSize;
-  TableSize += (sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE) * GicCCount);
+  TableSize    += (sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE) * GicCCount);
 
   if (GicItsCount != 0) {
     GicItsAffOffset = TableSize;
-    TableSize += (sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE) *
-                    GicItsCount);
+    TableSize      += (sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE) *
+                       GicItsCount);
   }
 
   if (MemAffCount != 0) {
     MemAffOffset = TableSize;
-    TableSize += (sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE) *
+    TableSize   += (sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE) *
                     MemAffCount);
   }
 
   if (GenInitiatorAffCount != 0) {
     GenInitiatorAffOffset = TableSize;
-    TableSize += (sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE) *
-                    GenInitiatorAffCount);
+    TableSize            += (sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE) *
+                             GenInitiatorAffCount);
   }
 
   // Allocate the Buffer for SRAT table
-  *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
   if (*Table == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     DEBUG ((
@@ -601,7 +606,7 @@ BuildSratTable (
     goto error_handler;
   }
 
-  Srat = (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER*)*Table;
+  Srat = (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *)*Table;
 
   DEBUG ((
     DEBUG_INFO,
@@ -649,12 +654,12 @@ BuildSratTable (
 
   if (GicItsCount != 0) {
     Status = AddGICItsAffinity (
-              CfgMgrProtocol,
-              Srat,
-              GicItsAffOffset,
-              GicItsInfo,
-              GicItsCount
-              );
+               CfgMgrProtocol,
+               Srat,
+               GicItsAffOffset,
+               GicItsInfo,
+               GicItsCount
+               );
     if (EFI_ERROR (Status)) {
       DEBUG ((
         DEBUG_ERROR,
@@ -667,12 +672,12 @@ BuildSratTable (
 
   if (MemAffCount != 0) {
     Status = AddMemoryAffinity (
-              CfgMgrProtocol,
-              Srat,
-              MemAffOffset,
-              MemAffInfo,
-              MemAffCount
-              );
+               CfgMgrProtocol,
+               Srat,
+               MemAffOffset,
+               MemAffInfo,
+               MemAffCount
+               );
     if (EFI_ERROR (Status)) {
       DEBUG ((
         DEBUG_ERROR,
@@ -685,12 +690,12 @@ BuildSratTable (
 
   if (GenInitiatorAffCount != 0) {
     Status = AddGenericInitiatorAffinity (
-              CfgMgrProtocol,
-              Srat,
-              GenInitiatorAffOffset,
-              GenInitiatorAffInfo,
-              GenInitiatorAffCount
-              );
+               CfgMgrProtocol,
+               Srat,
+               GenInitiatorAffOffset,
+               GenInitiatorAffInfo,
+               GenInitiatorAffCount
+               );
     if (EFI_ERROR (Status)) {
       DEBUG ((
         DEBUG_ERROR,
@@ -728,10 +733,10 @@ error_handler:
 STATIC
 EFI_STATUS
 FreeSratTableResources (
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
   ASSERT (
@@ -755,13 +760,13 @@ FreeSratTableResources (
 
 /** The SRAT Table Generator revision.
 */
-#define SRAT_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define SRAT_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the SRAT Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR SratGenerator = {
+ACPI_TABLE_GENERATOR  SratGenerator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSrat),
   // Generator Description
@@ -800,11 +805,12 @@ ACPI_TABLE_GENERATOR SratGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiSratLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&SratGenerator);
   DEBUG ((DEBUG_INFO, "SRAT: Register Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);
@@ -823,11 +829,12 @@ AcpiSratLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiSratLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&SratGenerator);
   DEBUG ((DEBUG_INFO, "SRAT: Deregister Generator. Status = %r\n", Status));
   ASSERT_EFI_ERROR (Status);

+ 99 - 90
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.c

@@ -61,17 +61,18 @@ STATIC
 EFI_STATUS
 EFIAPI
 ValidateCmn600Info (
-  IN  CONST CM_ARM_CMN_600_INFO       * Cmn600InfoList,
-  IN  CONST UINT32                      Cmn600Count
+  IN  CONST CM_ARM_CMN_600_INFO  *Cmn600InfoList,
+  IN  CONST UINT32               Cmn600Count
   )
 {
-  UINT32                            Index;
-  UINT32                            DtcIndex;
-  CONST CM_ARM_CMN_600_INFO       * Cmn600Info;
-  CONST CM_ARM_GENERIC_INTERRUPT  * DtcInterrupt;
+  UINT32                          Index;
+  UINT32                          DtcIndex;
+  CONST CM_ARM_CMN_600_INFO       *Cmn600Info;
+  CONST CM_ARM_GENERIC_INTERRUPT  *DtcInterrupt;
 
   if ((Cmn600InfoList == NULL) ||
-      (Cmn600Count == 0)) {
+      (Cmn600Count == 0))
+  {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -81,7 +82,8 @@ ValidateCmn600Info (
 
     // At least one DTC is required.
     if ((Cmn600Info->DtcCount == 0) ||
-        (Cmn600Info->DtcCount > MAX_DTC_COUNT)) {
+        (Cmn600Info->DtcCount > MAX_DTC_COUNT))
+    {
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: SSDT-CMN-600: Invalid DTC configuration:\n"
@@ -91,7 +93,8 @@ ValidateCmn600Info (
 
     // Check PERIPHBASE and ROOTNODEBASE address spaces are initialized.
     if ((Cmn600Info->PeriphBaseAddress == 0)    ||
-        (Cmn600Info->RootNodeBaseAddress == 0)) {
+        (Cmn600Info->RootNodeBaseAddress == 0))
+    {
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: SSDT-CMN-600: Invalid PERIPHBASE or ROOTNODEBASE.\n"
@@ -103,7 +106,8 @@ ValidateCmn600Info (
     // dimension mesh, and 256MB aligned otherwise.
     // Check it is a least 64MB aligned.
     if ((Cmn600Info->PeriphBaseAddress &
-        (PERIPHBASE_MIN_ADDRESS_LENGTH - 1)) != 0) {
+         (PERIPHBASE_MIN_ADDRESS_LENGTH - 1)) != 0)
+    {
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: SSDT-CMN-600: PERIPHBASE address must be 64MB aligned.\n"
@@ -123,7 +127,8 @@ ValidateCmn600Info (
 
     // Check the 16 KB alignment of the ROOTNODEBASE address.
     if ((Cmn600Info->PeriphBaseAddress &
-        (ROOTNODEBASE_ADDRESS_LENGTH - 1)) != 0) {
+         (ROOTNODEBASE_ADDRESS_LENGTH - 1)) != 0)
+    {
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: SSDT-CMN-600: Root base address must be 16KB aligned.\n"
@@ -135,7 +140,8 @@ ValidateCmn600Info (
     // address space.
     if ((Cmn600Info->PeriphBaseAddress > Cmn600Info->RootNodeBaseAddress)  ||
         ((Cmn600Info->PeriphBaseAddress + Cmn600Info->PeriphBaseAddressLength) <
-         (Cmn600Info->RootNodeBaseAddress + ROOTNODEBASE_ADDRESS_LENGTH))) {
+         (Cmn600Info->RootNodeBaseAddress + ROOTNODEBASE_ADDRESS_LENGTH)))
+    {
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: SSDT-CMN-600:"
@@ -147,16 +153,16 @@ ValidateCmn600Info (
     for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) {
       DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex];
       if (((DtcInterrupt->Flags &
-            EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) == 0)) {
+            EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) == 0))
+      {
         DEBUG ((
-        DEBUG_ERROR,
-        "ERROR: SSDT-CMN-600: DTC Interrupt must be consumer.\n"
-        ));
+          DEBUG_ERROR,
+          "ERROR: SSDT-CMN-600: DTC Interrupt must be consumer.\n"
+          ));
         goto error_handler;
       }
     } // for DTC Interrupt
-
-  } //for Cmn600InfoList
+  } // for Cmn600InfoList
 
   return EFI_SUCCESS;
 
@@ -174,26 +180,27 @@ error_handler:
     Cmn600Info->DtcCount
     ));
 
-    DEBUG_CODE_BEGIN ();
-    for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) {
-      DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex];
-      DEBUG ((
-        DEBUG_ERROR,
-        "  DTC[%d]:\n",
-        DtcIndex
-        ));
-      DEBUG ((
-        DEBUG_ERROR,
-        "    Interrupt = 0x%lx\n",
-        DtcInterrupt->Interrupt
-        ));
-      DEBUG ((
-        DEBUG_ERROR,
-        "    Flags = 0x%lx\n",
-        DtcInterrupt->Flags
-        ));
-    } // for
-    DEBUG_CODE_END ();
+  DEBUG_CODE_BEGIN ();
+  for (DtcIndex = 0; DtcIndex < Cmn600Info->DtcCount; DtcIndex++) {
+    DtcInterrupt = &Cmn600Info->DtcInterrupt[DtcIndex];
+    DEBUG ((
+      DEBUG_ERROR,
+      "  DTC[%d]:\n",
+      DtcIndex
+      ));
+    DEBUG ((
+      DEBUG_ERROR,
+      "    Interrupt = 0x%lx\n",
+      DtcInterrupt->Interrupt
+      ));
+    DEBUG ((
+      DEBUG_ERROR,
+      "    Flags = 0x%lx\n",
+      DtcInterrupt->Flags
+      ));
+  }   // for
+
+  DEBUG_CODE_END ();
 
   return EFI_INVALID_PARAMETER;
 }
@@ -218,34 +225,34 @@ STATIC
 EFI_STATUS
 EFIAPI
 FixupCmn600Info (
-  IN  CONST CM_ARM_CMN_600_INFO           * Cmn600Info,
-  IN  CONST CHAR8                         * Name,
-  IN  CONST UINT64                          Uid,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER  ** Table
+  IN  CONST CM_ARM_CMN_600_INFO          *Cmn600Info,
+  IN  CONST CHAR8                        *Name,
+  IN  CONST UINT64                       Uid,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER  **Table
   )
 {
-  EFI_STATUS                        Status;
-  EFI_STATUS                        Status1;
-  UINT8                             Index;
-  CONST CM_ARM_GENERIC_INTERRUPT  * DtcInt;
-
-  EFI_ACPI_DESCRIPTION_HEADER     * SsdtCmn600Template;
-  AML_ROOT_NODE_HANDLE              RootNodeHandle;
-  AML_OBJECT_NODE_HANDLE            NameOpIdNode;
-  AML_OBJECT_NODE_HANDLE            NameOpCrsNode;
-  AML_DATA_NODE_HANDLE              CmnPeriphBaseRdNode;
-  AML_DATA_NODE_HANDLE              CmnRootNodeBaseRdNode;
-  AML_OBJECT_NODE_HANDLE            DeviceNode;
+  EFI_STATUS                      Status;
+  EFI_STATUS                      Status1;
+  UINT8                           Index;
+  CONST CM_ARM_GENERIC_INTERRUPT  *DtcInt;
+
+  EFI_ACPI_DESCRIPTION_HEADER  *SsdtCmn600Template;
+  AML_ROOT_NODE_HANDLE         RootNodeHandle;
+  AML_OBJECT_NODE_HANDLE       NameOpIdNode;
+  AML_OBJECT_NODE_HANDLE       NameOpCrsNode;
+  AML_DATA_NODE_HANDLE         CmnPeriphBaseRdNode;
+  AML_DATA_NODE_HANDLE         CmnRootNodeBaseRdNode;
+  AML_OBJECT_NODE_HANDLE       DeviceNode;
 
   // Parse the Ssdt CMN-600 Template.
-  SsdtCmn600Template = (EFI_ACPI_DESCRIPTION_HEADER*)
-                          ssdtcmn600template_aml_code;
+  SsdtCmn600Template = (EFI_ACPI_DESCRIPTION_HEADER *)
+                       ssdtcmn600template_aml_code;
 
   RootNodeHandle = NULL;
-  Status = AmlParseDefinitionBlock (
-             SsdtCmn600Template,
-             &RootNodeHandle
-             );
+  Status         = AmlParseDefinitionBlock (
+                     SsdtCmn600Template,
+                     &RootNodeHandle
+                     );
   if (EFI_ERROR (Status)) {
     DEBUG ((
       DEBUG_ERROR,
@@ -346,7 +353,7 @@ FixupCmn600Info (
                  EFI_ACPI_EXTENDED_INTERRUPT_FLAG_POLARITY_MASK) != 0),
                ((DtcInt->Flags &
                  EFI_ACPI_EXTENDED_INTERRUPT_FLAG_SHARABLE_MASK) != 0),
-               (UINT32*)&DtcInt->Interrupt,
+               (UINT32 *)&DtcInt->Interrupt,
                1,
                NameOpCrsNode,
                NULL
@@ -365,7 +372,7 @@ FixupCmn600Info (
   }
 
   // Update the CMN600 Device's name.
-  Status = AmlDeviceOpUpdateName (DeviceNode, (CHAR8*)Name);
+  Status = AmlDeviceOpUpdateName (DeviceNode, (CHAR8 *)Name);
   if (EFI_ERROR (Status)) {
     goto error_handler;
   }
@@ -423,15 +430,15 @@ STATIC
 EFI_STATUS
 EFIAPI
 FreeSsdtCmn600TableResourcesEx (
-  IN      CONST ACPI_TABLE_GENERATOR                   * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          *** CONST Table,
+  IN      CONST ACPI_TABLE_GENERATOR                   *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ***CONST  Table,
   IN      CONST UINTN                                          TableCount
   )
 {
-  EFI_ACPI_DESCRIPTION_HEADER    ** TableList;
-  UINTN                             Index;
+  EFI_ACPI_DESCRIPTION_HEADER  **TableList;
+  UINTN                        Index;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -441,7 +448,8 @@ FreeSsdtCmn600TableResourcesEx (
 
   if ((Table == NULL)   ||
       (*Table == NULL)  ||
-      (TableCount == 0)) {
+      (TableCount == 0))
+  {
     DEBUG ((DEBUG_ERROR, "ERROR: SSDT-CMN-600: Invalid Table Pointer\n"));
     return EFI_INVALID_PARAMETER;
   }
@@ -451,7 +459,8 @@ FreeSsdtCmn600TableResourcesEx (
   for (Index = 0; Index < TableCount; Index++) {
     if ((TableList[Index] != NULL) &&
         (TableList[Index]->Signature ==
-         EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
+         EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
+    {
       FreePool (TableList[Index]);
     } else {
       DEBUG ((
@@ -463,7 +472,7 @@ FreeSsdtCmn600TableResourcesEx (
         ));
       return EFI_INVALID_PARAMETER;
     }
-  } //for
+  } // for
 
   // Free the table list.
   FreePool (*Table);
@@ -500,19 +509,19 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildSsdtCmn600TableEx (
-  IN  CONST ACPI_TABLE_GENERATOR                   *       This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ***       Table,
-  OUT       UINTN                                  * CONST TableCount
+  IN  CONST ACPI_TABLE_GENERATOR                           *This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER                    ***Table,
+  OUT       UINTN                                  *CONST  TableCount
   )
 {
-  EFI_STATUS                        Status;
-  UINT64                            Index;
-  CM_ARM_CMN_600_INFO             * Cmn600Info;
-  UINT32                            Cmn600Count;
-  CHAR8                             NewName[AML_NAME_SEG_SIZE + 1];
-  EFI_ACPI_DESCRIPTION_HEADER    ** TableList;
+  EFI_STATUS                   Status;
+  UINT64                       Index;
+  CM_ARM_CMN_600_INFO          *Cmn600Info;
+  UINT32                       Cmn600Count;
+  CHAR8                        NewName[AML_NAME_SEG_SIZE + 1];
+  EFI_ACPI_DESCRIPTION_HEADER  **TableList;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -563,9 +572,9 @@ BuildSsdtCmn600TableEx (
   }
 
   // Allocate a table to store pointers to the SSDT tables.
-  TableList = (EFI_ACPI_DESCRIPTION_HEADER**)
+  TableList = (EFI_ACPI_DESCRIPTION_HEADER **)
               AllocateZeroPool (
-                (sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * Cmn600Count)
+                (sizeof (EFI_ACPI_DESCRIPTION_HEADER *) * Cmn600Count)
                 );
   if (TableList == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
@@ -619,13 +628,13 @@ BuildSsdtCmn600TableEx (
 
 /** This macro defines the Raw Generator revision.
 */
-#define SSDT_CMN_600_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define SSDT_CMN_600_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the Raw Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR SsdtCmn600Generator = {
+ACPI_TABLE_GENERATOR  SsdtCmn600Generator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCmn600),
   // Generator Description
@@ -663,8 +672,8 @@ ACPI_TABLE_GENERATOR SsdtCmn600Generator = {
 EFI_STATUS
 EFIAPI
 AcpiSsdtCmn600LibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
@@ -691,8 +700,8 @@ AcpiSsdtCmn600LibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiSsdtCmn600LibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;

+ 6 - 6
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.h

@@ -20,24 +20,24 @@
 /** PeriphBase maximum address length is 256MB (0x10000000)
     for a (X >= 4) || (Y >= 4) dimensions mesh.
 */
-#define PERIPHBASE_MAX_ADDRESS_LENGTH   SIZE_256MB
+#define PERIPHBASE_MAX_ADDRESS_LENGTH  SIZE_256MB
 
 /** PeriphBase minimum address length is 64MB (0x04000000)
     for a (X < 4) && (Y < 4) dimensions mesh.
 */
-#define PERIPHBASE_MIN_ADDRESS_LENGTH   SIZE_64MB
+#define PERIPHBASE_MIN_ADDRESS_LENGTH  SIZE_64MB
 
 /** RootNodeBase address length is 16KB (0x00004000).
 */
-#define ROOTNODEBASE_ADDRESS_LENGTH     SIZE_16KB
+#define ROOTNODEBASE_ADDRESS_LENGTH  SIZE_16KB
 
 /** Maximum number of CMN-600 Debug and Trace Logic Controllers (DTC).
 */
-#define MAX_DTC_COUNT                   4
+#define MAX_DTC_COUNT  4
 
 /** Starting value for the UID to represent the CMN600 devices.
 */
-#define CMN600_DEVICE_START_UID         0
+#define CMN600_DEVICE_START_UID  0
 
 /** Maximum CMN-600 devices supported by this generator.
     This generator supports a maximum of 16 CMN-600 devices.
@@ -46,6 +46,6 @@
           UID fields describing the serial port.
 
 */
-#define MAX_CMN600_DEVICES_SUPPORTED    16
+#define MAX_CMN600_DEVICES_SUPPORTED  16
 
 #endif // SSDT_CMN600_GENERATOR_H_

+ 109 - 102
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c

@@ -96,15 +96,16 @@ STATIC
 EFI_STATUS
 EFIAPI
 TokenTableInitialize (
-  IN  ACPI_CPU_TOPOLOGY_GENERATOR   * Generator,
-  IN  UINT32                          Count
+  IN  ACPI_CPU_TOPOLOGY_GENERATOR  *Generator,
+  IN  UINT32                       Count
   )
 {
-  CM_OBJECT_TOKEN   * Table;
+  CM_OBJECT_TOKEN  *Table;
 
   if ((Generator == NULL) ||
       (Count == 0)        ||
-      (Count >= MAX_NODE_COUNT)) {
+      (Count >= MAX_NODE_COUNT))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -128,7 +129,7 @@ STATIC
 VOID
 EFIAPI
 TokenTableFree (
-  IN  ACPI_CPU_TOPOLOGY_GENERATOR   * Generator
+  IN  ACPI_CPU_TOPOLOGY_GENERATOR  *Generator
   )
 {
   ASSERT (Generator != NULL);
@@ -153,18 +154,18 @@ STATIC
 UINT32
 EFIAPI
 TokenTableAdd (
-  IN  ACPI_CPU_TOPOLOGY_GENERATOR   * Generator,
-  IN  CM_OBJECT_TOKEN                 Token
+  IN  ACPI_CPU_TOPOLOGY_GENERATOR  *Generator,
+  IN  CM_OBJECT_TOKEN              Token
   )
 {
-  CM_OBJECT_TOKEN   * Table;
-  UINT32              Index;
-  UINT32              LastIndex;
+  CM_OBJECT_TOKEN  *Table;
+  UINT32           Index;
+  UINT32           LastIndex;
 
   ASSERT (Generator != NULL);
   ASSERT (Generator->TokenTable.Table != NULL);
 
-  Table = Generator->TokenTable.Table;
+  Table     = Generator->TokenTable.Table;
   LastIndex = Generator->TokenTable.LastIndex;
 
   // Search if there is already an entry with this Token.
@@ -203,20 +204,21 @@ STATIC
 EFI_STATUS
 EFIAPI
 WriteAslName (
-  IN      CHAR8     LeadChar,
-  IN      UINT32    Value,
-  IN OUT  CHAR8   * AslName
+  IN      CHAR8   LeadChar,
+  IN      UINT32  Value,
+  IN OUT  CHAR8   *AslName
   )
 {
-  UINT8   Index;
+  UINT8  Index;
 
   if ((Value >= MAX_NODE_COUNT)  ||
-      (AslName == NULL)) {
+      (AslName == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  AslName[0] = LeadChar;
+  AslName[0]                 = LeadChar;
   AslName[AML_NAME_SEG_SIZE] = '\0';
 
   for (Index = 0; Index < AML_NAME_SEG_SIZE - 1; Index++) {
@@ -262,14 +264,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 CreateAmlLpiMethod (
-  IN  ACPI_CPU_TOPOLOGY_GENERATOR   * Generator,
-  IN  CM_ARM_PROC_HIERARCHY_INFO    * ProcHierarchyNodeInfo,
-  IN  AML_OBJECT_NODE_HANDLE        * Node
+  IN  ACPI_CPU_TOPOLOGY_GENERATOR  *Generator,
+  IN  CM_ARM_PROC_HIERARCHY_INFO   *ProcHierarchyNodeInfo,
+  IN  AML_OBJECT_NODE_HANDLE       *Node
   )
 {
-  EFI_STATUS    Status;
-  UINT32        TokenIndex;
-  CHAR8         AslName[SB_SCOPE_PREFIX_SIZE + AML_NAME_SEG_SIZE];
+  EFI_STATUS  Status;
+  UINT32      TokenIndex;
+  CHAR8       AslName[SB_SCOPE_PREFIX_SIZE + AML_NAME_SEG_SIZE];
 
   ASSERT (Generator != NULL);
   ASSERT (ProcHierarchyNodeInfo != NULL);
@@ -349,22 +351,22 @@ STATIC
 EFI_STATUS
 EFIAPI
 GenerateLpiStates (
-  IN        ACPI_CPU_TOPOLOGY_GENERATOR           *       Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
+  IN        ACPI_CPU_TOPOLOGY_GENERATOR                   *Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
   IN        AML_OBJECT_NODE_HANDLE                        ScopeNode
   )
 {
-  EFI_STATUS                Status;
+  EFI_STATUS  Status;
 
-  UINT32                    Index;
-  UINT32                    LastIndex;
+  UINT32  Index;
+  UINT32  LastIndex;
 
-  AML_OBJECT_NODE_HANDLE    LpiNode;
-  CM_ARM_OBJ_REF          * LpiRefInfo;
-  UINT32                    LpiRefInfoCount;
-  UINT32                    LpiRefIndex;
-  CM_ARM_LPI_INFO         * LpiInfo;
-  CHAR8                     AslName[AML_NAME_SEG_SIZE + 1];
+  AML_OBJECT_NODE_HANDLE  LpiNode;
+  CM_ARM_OBJ_REF          *LpiRefInfo;
+  UINT32                  LpiRefInfoCount;
+  UINT32                  LpiRefIndex;
+  CM_ARM_LPI_INFO         *LpiInfo;
+  CHAR8                   AslName[AML_NAME_SEG_SIZE + 1];
 
   ASSERT (Generator != NULL);
   ASSERT (Generator->TokenTable.Table != NULL);
@@ -422,11 +424,11 @@ GenerateLpiStates (
                  LpiInfo->ResCntFreq,
                  LpiInfo->EnableParentState,
                  LpiInfo->IsInteger ?
-                   NULL :
-                   &LpiInfo->RegisterEntryMethod,
+                 NULL :
+                 &LpiInfo->RegisterEntryMethod,
                  LpiInfo->IsInteger ?
-                   LpiInfo->IntegerEntryMethod :
-                   0,
+                 LpiInfo->IntegerEntryMethod :
+                 0,
                  &LpiInfo->ResidencyCounterRegister,
                  &LpiInfo->UsageCounterRegister,
                  LpiInfo->StateName,
@@ -465,16 +467,16 @@ STATIC
 EFI_STATUS
 EFIAPI
 CreateAmlCpu (
-  IN   ACPI_CPU_TOPOLOGY_GENERATOR   * Generator,
-  IN   AML_NODE_HANDLE                 ParentNode,
-  IN   CM_ARM_GICC_INFO              * GicCInfo,
-  IN   UINT32                          CpuIndex,
-  OUT  AML_OBJECT_NODE_HANDLE        * CpuNodePtr OPTIONAL
+  IN   ACPI_CPU_TOPOLOGY_GENERATOR  *Generator,
+  IN   AML_NODE_HANDLE              ParentNode,
+  IN   CM_ARM_GICC_INFO             *GicCInfo,
+  IN   UINT32                       CpuIndex,
+  OUT  AML_OBJECT_NODE_HANDLE       *CpuNodePtr OPTIONAL
   )
 {
-  EFI_STATUS                Status;
-  AML_OBJECT_NODE_HANDLE    CpuNode;
-  CHAR8                     AslName[AML_NAME_SEG_SIZE + 1];
+  EFI_STATUS              Status;
+  AML_OBJECT_NODE_HANDLE  CpuNode;
+  CHAR8                   AslName[AML_NAME_SEG_SIZE + 1];
 
   ASSERT (Generator != NULL);
   ASSERT (ParentNode != NULL);
@@ -541,16 +543,16 @@ STATIC
 EFI_STATUS
 EFIAPI
 CreateAmlCpuFromProcHierarchy (
-  IN        ACPI_CPU_TOPOLOGY_GENERATOR           *       Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
+  IN        ACPI_CPU_TOPOLOGY_GENERATOR                   *Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
   IN        AML_NODE_HANDLE                               ParentNode,
   IN        UINT32                                        CpuIndex,
-  IN        CM_ARM_PROC_HIERARCHY_INFO            *       ProcHierarchyNodeInfo
+  IN        CM_ARM_PROC_HIERARCHY_INFO                    *ProcHierarchyNodeInfo
   )
 {
-  EFI_STATUS                Status;
-  CM_ARM_GICC_INFO        * GicCInfo;
-  AML_OBJECT_NODE_HANDLE    CpuNode;
+  EFI_STATUS              Status;
+  CM_ARM_GICC_INFO        *GicCInfo;
+  AML_OBJECT_NODE_HANDLE  CpuNode;
 
   ASSERT (Generator != NULL);
   ASSERT (CfgMgrProtocol != NULL);
@@ -619,17 +621,17 @@ STATIC
 EFI_STATUS
 EFIAPI
 CreateAmlCluster (
-  IN        ACPI_CPU_TOPOLOGY_GENERATOR           *       Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
+  IN        ACPI_CPU_TOPOLOGY_GENERATOR                   *Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
   IN        AML_NODE_HANDLE                               ParentNode,
-  IN        CM_ARM_PROC_HIERARCHY_INFO            *       ProcHierarchyNodeInfo,
+  IN        CM_ARM_PROC_HIERARCHY_INFO                    *ProcHierarchyNodeInfo,
   IN        UINT32                                        ClusterIndex,
-  OUT       AML_OBJECT_NODE_HANDLE                *       ClusterNodePtr
+  OUT       AML_OBJECT_NODE_HANDLE                        *ClusterNodePtr
   )
 {
-  EFI_STATUS                Status;
-  AML_OBJECT_NODE_HANDLE    ClusterNode;
-  CHAR8                     AslNameCluster[AML_NAME_SEG_SIZE + 1];
+  EFI_STATUS              Status;
+  AML_OBJECT_NODE_HANDLE  ClusterNode;
+  CHAR8                   AslNameCluster[AML_NAME_SEG_SIZE + 1];
 
   ASSERT (Generator != NULL);
   ASSERT (CfgMgrProtocol != NULL);
@@ -713,8 +715,8 @@ STATIC
 EFI_STATUS
 EFIAPI
 CreateAmlCpuTopologyTree (
-  IN        ACPI_CPU_TOPOLOGY_GENERATOR           *       Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
+  IN        ACPI_CPU_TOPOLOGY_GENERATOR                   *Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
   IN        CM_OBJECT_TOKEN                               NodeToken,
   IN        AML_NODE_HANDLE                               ParentNode
   )
@@ -732,19 +734,19 @@ CreateAmlCpuTopologyTree (
   ASSERT (NodeToken != CM_NULL_TOKEN);
   ASSERT (ParentNode != NULL);
 
-  CpuIndex = 0;
+  CpuIndex     = 0;
   ClusterIndex = 0;
 
   for (Index = 0; Index < Generator->ProcNodeCount; Index++) {
     // Find the children of the CM_ARM_PROC_HIERARCHY_INFO
     // currently being handled (i.e. ParentToken == NodeToken).
     if (Generator->ProcNodeList[Index].ParentToken == NodeToken) {
-
       // Only Cpus (leaf nodes in this tree) have a GicCToken.
       // Create a Cpu node.
       if (Generator->ProcNodeList[Index].GicCToken != CM_NULL_TOKEN) {
         if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) !=
-             PPTT_CPU_PROCESSOR_MASK) {
+            PPTT_CPU_PROCESSOR_MASK)
+        {
           DEBUG ((
             DEBUG_ERROR,
             "ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for cpu: 0x%x.\n",
@@ -767,13 +769,13 @@ CreateAmlCpuTopologyTree (
         }
 
         CpuIndex++;
-
       } else {
         // If this is not a Cpu, then this is a cluster.
 
         // Acpi processor Id for clusters is not handled.
         if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) !=
-             PPTT_CLUSTER_PROCESSOR_MASK) {
+            PPTT_CLUSTER_PROCESSOR_MASK)
+        {
           DEBUG ((
             DEBUG_ERROR,
             "ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for cluster: 0x%x.\n",
@@ -835,8 +837,8 @@ STATIC
 EFI_STATUS
 EFIAPI
 CreateTopologyFromProcHierarchy (
-  IN        ACPI_CPU_TOPOLOGY_GENERATOR           *       Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
+  IN        ACPI_CPU_TOPOLOGY_GENERATOR                   *Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
   IN        AML_OBJECT_NODE_HANDLE                        ScopeNode
   )
 {
@@ -865,7 +867,8 @@ CreateTopologyFromProcHierarchy (
   for (Index = 0; Index < Generator->ProcNodeCount; Index++) {
     if ((Generator->ProcNodeList[Index].ParentToken == CM_NULL_TOKEN) &&
         (Generator->ProcNodeList[Index].Flags &
-          EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL)) {
+         EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL))
+    {
       if (TopLevelProcNodeIndex != MAX_UINT32) {
         DEBUG ((
           DEBUG_ERROR,
@@ -875,6 +878,7 @@ CreateTopologyFromProcHierarchy (
         ASSERT (0);
         goto exit_handler;
       }
+
       TopLevelProcNodeIndex = Index;
     }
   } // for
@@ -919,15 +923,15 @@ STATIC
 EFI_STATUS
 EFIAPI
 CreateTopologyFromGicC (
-  IN        ACPI_CPU_TOPOLOGY_GENERATOR           *       Generator,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
+  IN        ACPI_CPU_TOPOLOGY_GENERATOR                   *Generator,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
   IN        AML_OBJECT_NODE_HANDLE                        ScopeNode
   )
 {
-  EFI_STATUS            Status;
-  CM_ARM_GICC_INFO    * GicCInfo;
-  UINT32                GicCInfoCount;
-  UINT32                Index;
+  EFI_STATUS        Status;
+  CM_ARM_GICC_INFO  *GicCInfo;
+  UINT32            GicCInfoCount;
+  UINT32            Index;
 
   ASSERT (Generator != NULL);
   ASSERT (CfgMgrProtocol != NULL);
@@ -988,18 +992,18 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildSsdtCpuTopologyTable (
-  IN  CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
-  EFI_STATUS                      Status;
-  AML_ROOT_NODE_HANDLE            RootNode;
-  AML_OBJECT_NODE_HANDLE          ScopeNode;
-  CM_ARM_PROC_HIERARCHY_INFO    * ProcHierarchyNodeList;
-  UINT32                          ProcHierarchyNodeCount;
-  ACPI_CPU_TOPOLOGY_GENERATOR   * Generator;
+  EFI_STATUS                   Status;
+  AML_ROOT_NODE_HANDLE         RootNode;
+  AML_OBJECT_NODE_HANDLE       ScopeNode;
+  CM_ARM_PROC_HIERARCHY_INFO   *ProcHierarchyNodeList;
+  UINT32                       ProcHierarchyNodeCount;
+  ACPI_CPU_TOPOLOGY_GENERATOR  *Generator;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -1008,7 +1012,7 @@ BuildSsdtCpuTopologyTable (
   ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
   ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
 
-  Generator = (ACPI_CPU_TOPOLOGY_GENERATOR*)This;
+  Generator = (ACPI_CPU_TOPOLOGY_GENERATOR *)This;
 
   Status = AddSsdtAcpiHeader (
              CfgMgrProtocol,
@@ -1034,7 +1038,8 @@ BuildSsdtCpuTopologyTable (
              &ProcHierarchyNodeCount
              );
   if (EFI_ERROR (Status) &&
-      (Status != EFI_NOT_FOUND)) {
+      (Status != EFI_NOT_FOUND))
+  {
     goto exit_handler;
   }
 
@@ -1051,7 +1056,7 @@ BuildSsdtCpuTopologyTable (
     }
   } else {
     // Generate the topology from CM_ARM_PROC_HIERARCHY_INFO objects.
-    Generator->ProcNodeList = ProcHierarchyNodeList;
+    Generator->ProcNodeList  = ProcHierarchyNodeList;
     Generator->ProcNodeCount = ProcHierarchyNodeCount;
 
     Status = CreateTopologyFromProcHierarchy (
@@ -1098,10 +1103,10 @@ exit_handler:
 STATIC
 EFI_STATUS
 FreeSsdtCpuTopologyTableResources (
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ** CONST Table
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
   )
 {
   ASSERT (This != NULL);
@@ -1123,12 +1128,12 @@ FreeSsdtCpuTopologyTableResources (
 
 /** This macro defines the SSDT Cpu Topology Table Generator revision.
 */
-#define SSDT_CPU_TOPOLOGY_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define SSDT_CPU_TOPOLOGY_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the SSDT Cpu Topology Table Generator.
 */
 STATIC
-ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator = {
+ACPI_CPU_TOPOLOGY_GENERATOR  SsdtCpuTopologyGenerator = {
   // ACPI table generator header
   {
     // Generator ID
@@ -1160,10 +1165,10 @@ ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator = {
 
   // TokenTable
   {
-      // Table
-      NULL,
-      // LastIndex
-      0
+    // Table
+    NULL,
+    // LastIndex
+    0
   },
   // ProcNodeList
   NULL,
@@ -1184,11 +1189,12 @@ ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiSsdtCpuTopologyLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&SsdtCpuTopologyGenerator.Header);
   DEBUG ((
     DEBUG_INFO,
@@ -1212,11 +1218,12 @@ AcpiSsdtCpuTopologyLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiSsdtCpuTopologyLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&SsdtCpuTopologyGenerator.Header);
   DEBUG ((
     DEBUG_INFO,

+ 12 - 12
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h

@@ -14,13 +14,13 @@
 #pragma pack(1)
 
 // Mask for the flags that need to be checked.
-#define PPTT_PROCESSOR_MASK   (                                               \
+#define PPTT_PROCESSOR_MASK  (                                                \
           (EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL)          |                     \
           (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1)   |                     \
           (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
 
 // Mask for the cpu flags.
-#define PPTT_CPU_PROCESSOR_MASK   (                                           \
+#define PPTT_CPU_PROCESSOR_MASK  (                                            \
           (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL)      |                     \
           (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1)   |                     \
           (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
@@ -29,7 +29,7 @@
 // Even though a _UID is generated for clusters, it is simpler to use
 // EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID and to not match the cluster id of
 // the PPTT table (not sure the PPTT table is generated).
-#define PPTT_CLUSTER_PROCESSOR_MASK   (                                       \
+#define PPTT_CLUSTER_PROCESSOR_MASK  (                                        \
           (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL)      |                     \
           (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) |                     \
           (EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3))
@@ -37,22 +37,22 @@
 /** LPI states are stored in the ASL namespace at '\_SB_.Lxxx',
     with xxx being the node index of the LPI state.
 */
-#define SB_SCOPE                            "\\_SB_"
-#define SB_SCOPE_PREFIX                     SB_SCOPE "."
+#define SB_SCOPE         "\\_SB_"
+#define SB_SCOPE_PREFIX  SB_SCOPE "."
 /// Size of the SB_SCOPE_PREFIX string.
-#define SB_SCOPE_PREFIX_SIZE                sizeof (SB_SCOPE_PREFIX)
+#define SB_SCOPE_PREFIX_SIZE  sizeof (SB_SCOPE_PREFIX)
 
 /// HID for a processor device.
-#define ACPI_HID_PROCESSOR_DEVICE           "ACPI0007"
+#define ACPI_HID_PROCESSOR_DEVICE  "ACPI0007"
 
 /// HID for a processor container device.
-#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010"
+#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE  "ACPI0010"
 
 /** Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states.
     The 'xxx' is an index on 12 bits is given to node name,
     thus the limitation in the number of nodes.
 */
-#define MAX_NODE_COUNT                      (1 << 12)
+#define MAX_NODE_COUNT  (1 << 12)
 
 /** A structure used to handle the Lpi structures referencing.
 
@@ -106,11 +106,11 @@
 typedef struct TokenTable {
   /// TokenTable, a table allowing to map:
   /// Index <-> CM_OBJECT_TOKEN (to CM_ARM_LPI_INFO structures).
-  CM_OBJECT_TOKEN             * Table;
+  CM_OBJECT_TOKEN    *Table;
 
   /// Last used index of the TokenTable.
   /// LastIndex is bound by ProcNodeCount.
-  UINT32                        LastIndex;
+  UINT32             LastIndex;
 } TOKEN_TABLE;
 
 /** A structure holding the Cpu topology generator and additional private data.
@@ -124,7 +124,7 @@ typedef struct AcpiCpuTopologyGenerator {
   /// Private object used to handle token referencing.
   TOKEN_TABLE                   TokenTable;
   /// List of CM_ARM_PROC_HIERARCHY_INFO CM objects.
-  CM_ARM_PROC_HIERARCHY_INFO  * ProcNodeList;
+  CM_ARM_PROC_HIERARCHY_INFO    *ProcNodeList;
   /// Count of CM_ARM_PROC_HIERARCHY_INFO CM objects.
   UINT32                        ProcNodeCount;
 } ACPI_CPU_TOPOLOGY_GENERATOR;

+ 37 - 33
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortGenerator.c

@@ -46,7 +46,7 @@ GET_OBJECT_LIST (
           respectively. So, the UIDs for serial ports for general use
           start at 2.
 */
-#define SERIAL_PORT_START_UID                      2
+#define SERIAL_PORT_START_UID  2
 
 /** Maximum serial ports supported by this generator.
     This generator supports a maximum of 14 (16 - 2) serial ports.
@@ -57,7 +57,7 @@ GET_OBJECT_LIST (
           UID fields describing the serial port.
 
 */
-#define MAX_SERIAL_PORTS_SUPPORTED                 14
+#define MAX_SERIAL_PORTS_SUPPORTED  14
 
 /** Free any resources allocated for constructing the tables.
 
@@ -76,16 +76,16 @@ STATIC
 EFI_STATUS
 EFIAPI
 FreeSsdtSerialPortTableEx (
-  IN      CONST ACPI_TABLE_GENERATOR                   * CONST This,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          *** CONST Table,
+  IN      CONST ACPI_TABLE_GENERATOR                   *CONST  This,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  IN OUT        EFI_ACPI_DESCRIPTION_HEADER          ***CONST  Table,
   IN      CONST UINTN                                          TableCount
   )
 {
-  EFI_STATUS                        Status;
-  EFI_ACPI_DESCRIPTION_HEADER    ** TableList;
-  UINTN                             Index;
+  EFI_STATUS                   Status;
+  EFI_ACPI_DESCRIPTION_HEADER  **TableList;
+  UINTN                        Index;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -95,7 +95,8 @@ FreeSsdtSerialPortTableEx (
 
   if ((Table == NULL)   ||
       (*Table == NULL)  ||
-      (TableCount == 0)) {
+      (TableCount == 0))
+  {
     DEBUG ((DEBUG_ERROR, "ERROR: SSDT-SERIAL-PORT: Invalid Table Pointer\n"));
     return EFI_INVALID_PARAMETER;
   }
@@ -105,7 +106,8 @@ FreeSsdtSerialPortTableEx (
   for (Index = 0; Index < TableCount; Index++) {
     if ((TableList[Index] != NULL) &&
         (TableList[Index]->Signature ==
-         EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
+         EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))
+    {
       Status = FreeSsdtSerialPortTable (TableList[Index]);
     } else {
       Status = EFI_INVALID_PARAMETER;
@@ -121,7 +123,7 @@ FreeSsdtSerialPortTableEx (
         ));
       return Status;
     }
-  } //for
+  } // for
 
   // Free the table list.
   FreePool (*Table);
@@ -158,20 +160,20 @@ STATIC
 EFI_STATUS
 EFIAPI
 BuildSsdtSerialPortTableEx (
-  IN  CONST ACPI_TABLE_GENERATOR                   *       This,
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             * CONST AcpiTableInfo,
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   * CONST CfgMgrProtocol,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER          ***       Table,
-  OUT       UINTN                                  * CONST TableCount
+  IN  CONST ACPI_TABLE_GENERATOR                           *This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO             *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER                    ***Table,
+  OUT       UINTN                                  *CONST  TableCount
   )
 {
-  EFI_STATUS                      Status;
-  CM_ARM_SERIAL_PORT_INFO       * SerialPortInfo;
-  UINT32                          SerialPortCount;
-  UINTN                           Index;
-  CHAR8                           NewName[AML_NAME_SEG_SIZE + 1];
-  UINT64                          Uid;
-  EFI_ACPI_DESCRIPTION_HEADER  ** TableList;
+  EFI_STATUS                   Status;
+  CM_ARM_SERIAL_PORT_INFO      *SerialPortInfo;
+  UINT32                       SerialPortCount;
+  UINTN                        Index;
+  CHAR8                        NewName[AML_NAME_SEG_SIZE + 1];
+  UINT64                       Uid;
+  EFI_ACPI_DESCRIPTION_HEADER  **TableList;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -222,9 +224,9 @@ BuildSsdtSerialPortTableEx (
   }
 
   // Allocate a table to store pointers to the SSDT tables.
-  TableList = (EFI_ACPI_DESCRIPTION_HEADER**)
+  TableList = (EFI_ACPI_DESCRIPTION_HEADER **)
               AllocateZeroPool (
-                (sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * SerialPortCount)
+                (sizeof (EFI_ACPI_DESCRIPTION_HEADER *) * SerialPortCount)
                 );
   if (TableList == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
@@ -246,7 +248,7 @@ BuildSsdtSerialPortTableEx (
   NewName[2] = 'M';
   NewName[4] = '\0';
   for (Index = 0; Index < SerialPortCount; Index++) {
-    Uid = SERIAL_PORT_START_UID + Index;
+    Uid        = SERIAL_PORT_START_UID + Index;
     NewName[3] = AsciiFromHex ((UINT8)(Uid));
 
     // Build a SSDT table describing the serial port.
@@ -281,13 +283,13 @@ error_handler:
 
 /** This macro defines the SSDT Serial Port Table Generator revision.
 */
-#define SSDT_SERIAL_GENERATOR_REVISION CREATE_REVISION (1, 0)
+#define SSDT_SERIAL_GENERATOR_REVISION  CREATE_REVISION (1, 0)
 
 /** The interface for the SSDT Serial Port Table Generator.
 */
 STATIC
 CONST
-ACPI_TABLE_GENERATOR SsdtSerialPortGenerator = {
+ACPI_TABLE_GENERATOR  SsdtSerialPortGenerator = {
   // Generator ID
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtSerialPort),
   // Generator Description
@@ -325,11 +327,12 @@ ACPI_TABLE_GENERATOR SsdtSerialPortGenerator = {
 EFI_STATUS
 EFIAPI
 AcpiSsdtSerialPortLibConstructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = RegisterAcpiTableGenerator (&SsdtSerialPortGenerator);
   DEBUG ((
     DEBUG_INFO,
@@ -353,11 +356,12 @@ AcpiSsdtSerialPortLibConstructor (
 EFI_STATUS
 EFIAPI
 AcpiSsdtSerialPortLibDestructor (
-  IN  EFI_HANDLE           ImageHandle,
-  IN  EFI_SYSTEM_TABLE  *  SystemTable
+  IN  EFI_HANDLE        ImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
+
   Status = DeregisterAcpiTableGenerator (&SsdtSerialPortGenerator);
   DEBUG ((
     DEBUG_INFO,

+ 18 - 17
DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelper.c

@@ -23,7 +23,7 @@
 UINT8
 EFIAPI
 AsciiFromHex (
-  IN  UINT8   Hex
+  IN  UINT8  Hex
   )
 {
   if (Hex < 10) {
@@ -50,7 +50,7 @@ AsciiFromHex (
 UINT8
 EFIAPI
 HexFromAscii (
-  IN  CHAR8   Char
+  IN  CHAR8  Char
   )
 {
   if ((Char >= '0') && (Char <= '9')) {
@@ -78,10 +78,10 @@ HexFromAscii (
 **/
 BOOLEAN
 IsValidPnpId (
-  IN  CONST CHAR8  * Hid
+  IN  CONST CHAR8  *Hid
   )
 {
-  UINTN Index;
+  UINTN  Index;
 
   if (AsciiStrLen (Hid) != 7) {
     return FALSE;
@@ -113,10 +113,10 @@ IsValidPnpId (
 **/
 BOOLEAN
 IsValidAcpiId (
-  IN  CONST CHAR8  * Hid
+  IN  CONST CHAR8  *Hid
   )
 {
-  UINTN Index;
+  UINTN  Index;
 
   if (AsciiStrLen (Hid) != 8) {
     return FALSE;
@@ -153,13 +153,14 @@ IsValidAcpiId (
 EFI_STATUS
 EFIAPI
 AmlGetEisaIdFromString (
-  IN  CONST CHAR8   * EisaIdStr,
-  OUT       UINT32  * EisaIdInt
+  IN  CONST CHAR8   *EisaIdStr,
+  OUT       UINT32  *EisaIdInt
   )
 {
   if ((EisaIdStr == NULL)         ||
       (!IsValidPnpId (EisaIdStr)) ||
-      (EisaIdInt == NULL)) {
+      (EisaIdInt == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -197,14 +198,14 @@ AmlGetEisaIdFromString (
         Bit 3-0: 4th hex digit of product number "3"
   */
   *EisaIdInt = SwapBytes32 (
-    ((EisaIdStr[0] - 0x40) << 26)       |
-    ((EisaIdStr[1] - 0x40) << 21)       |
-    ((EisaIdStr[2] - 0x40) << 16)       |
-    (HexFromAscii (EisaIdStr[3]) << 12) |
-    (HexFromAscii (EisaIdStr[4]) << 8)  |
-    (HexFromAscii (EisaIdStr[5]) << 4)  |
-    (HexFromAscii (EisaIdStr[6]))
-    );
+                 ((EisaIdStr[0] - 0x40) << 26)       |
+                 ((EisaIdStr[1] - 0x40) << 21)       |
+                 ((EisaIdStr[2] - 0x40) << 16)       |
+                 (HexFromAscii (EisaIdStr[3]) << 12) |
+                 (HexFromAscii (EisaIdStr[4]) << 8)  |
+                 (HexFromAscii (EisaIdStr[5]) << 4)  |
+                 (HexFromAscii (EisaIdStr[6]))
+                 );
 
   return EFI_SUCCESS;
 }

+ 57 - 57
DynamicTablesPkg/Library/Common/AmlLib/AmlCoreInterface.h

@@ -67,9 +67,9 @@
 EFI_STATUS
 EFIAPI
 AmlSerializeTree (
-  IN      AML_ROOT_NODE_HANDLE    RootNode,
-  IN      UINT8                 * Buffer      OPTIONAL,
-  IN  OUT UINT32                * BufferSize
+  IN      AML_ROOT_NODE_HANDLE  RootNode,
+  IN      UINT8                 *Buffer      OPTIONAL,
+  IN  OUT UINT32                *BufferSize
   );
 
 /** Clone a node.
@@ -89,8 +89,8 @@ AmlSerializeTree (
 EFI_STATUS
 EFIAPI
 AmlCloneNode (
-  IN  AML_NODE_HANDLE   Node,
-  OUT AML_NODE_HANDLE * ClonedNode
+  IN  AML_NODE_HANDLE  Node,
+  OUT AML_NODE_HANDLE  *ClonedNode
   );
 
 /**
@@ -127,7 +127,7 @@ AmlCloneNode (
 EFI_STATUS
 EFIAPI
 AmlRemoveNodeFromVarArgList (
-  IN  AML_NODE_HANDLE   Node
+  IN  AML_NODE_HANDLE  Node
   );
 
 /** Add the NewNode to the head of the variable list of arguments
@@ -145,8 +145,8 @@ AmlRemoveNodeFromVarArgList (
 EFI_STATUS
 EFIAPI
 AmlVarListAddHead (
-  IN  AML_NODE_HANDLE   ParentNode,
-  IN  AML_NODE_HANDLE   NewNode
+  IN  AML_NODE_HANDLE  ParentNode,
+  IN  AML_NODE_HANDLE  NewNode
   );
 
 /** Add the NewNode to the tail of the variable list of arguments
@@ -164,8 +164,8 @@ AmlVarListAddHead (
 EFI_STATUS
 EFIAPI
 AmlVarListAddTail (
-  IN  AML_NODE_HANDLE   ParentNode,
-  IN  AML_NODE_HANDLE   NewNode
+  IN  AML_NODE_HANDLE  ParentNode,
+  IN  AML_NODE_HANDLE  NewNode
   );
 
 /** Add the NewNode before the Node in the list of variable
@@ -183,8 +183,8 @@ AmlVarListAddTail (
 EFI_STATUS
 EFIAPI
 AmlVarListAddBefore (
-  IN  AML_NODE_HANDLE   Node,
-  IN  AML_NODE_HANDLE   NewNode
+  IN  AML_NODE_HANDLE  Node,
+  IN  AML_NODE_HANDLE  NewNode
   );
 
 /** Add the NewNode after the Node in the variable list of arguments
@@ -202,8 +202,8 @@ AmlVarListAddBefore (
 EFI_STATUS
 EFIAPI
 AmlVarListAddAfter (
-  IN  AML_NODE_HANDLE   Node,
-  IN  AML_NODE_HANDLE   NewNode
+  IN  AML_NODE_HANDLE  Node,
+  IN  AML_NODE_HANDLE  NewNode
   );
 
 /** Append a Resource Data node to the BufferOpNode.
@@ -221,8 +221,8 @@ AmlVarListAddAfter (
 EFI_STATUS
 EFIAPI
 AmlAppendRdNode (
-  IN  AML_OBJECT_NODE_HANDLE   BufferOpNode,
-  IN  AML_DATA_NODE_HANDLE     NewRdNode
+  IN  AML_OBJECT_NODE_HANDLE  BufferOpNode,
+  IN  AML_DATA_NODE_HANDLE    NewRdNode
   );
 
 /** Replace the OldNode, which is in a variable list of arguments,
@@ -244,8 +244,8 @@ AmlAppendRdNode (
 EFI_STATUS
 EFIAPI
 AmlReplaceVariableArgument (
-  IN  AML_NODE_HANDLE   OldNode,
-  IN  AML_NODE_HANDLE   NewNode
+  IN  AML_NODE_HANDLE  OldNode,
+  IN  AML_NODE_HANDLE  NewNode
   );
 
 /**
@@ -285,7 +285,7 @@ AmlReplaceVariableArgument (
 EAML_NODE_TYPE
 EFIAPI
 AmlGetNodeType (
-  IN  AML_NODE_HANDLE   Node
+  IN  AML_NODE_HANDLE  Node
   );
 
 /** Get the RootNode information.
@@ -302,8 +302,8 @@ AmlGetNodeType (
 EFI_STATUS
 EFIAPI
 AmlGetRootNodeInfo (
-  IN  AML_ROOT_NODE_HANDLE            RootNode,
-  OUT EFI_ACPI_DESCRIPTION_HEADER   * SdtHeaderBuffer
+  IN  AML_ROOT_NODE_HANDLE         RootNode,
+  OUT EFI_ACPI_DESCRIPTION_HEADER  *SdtHeaderBuffer
   );
 
 /** Get the ObjectNode information.
@@ -333,11 +333,11 @@ AmlGetRootNodeInfo (
 EFI_STATUS
 EFIAPI
 AmlGetObjectNodeInfo (
-  IN  AML_OBJECT_NODE_HANDLE    ObjectNode,
-  OUT UINT8                   * OpCode            OPTIONAL,
-  OUT UINT8                   * SubOpCode         OPTIONAL,
-  OUT UINT32                  * PkgLen            OPTIONAL,
-  OUT BOOLEAN                 * IsNameSpaceNode   OPTIONAL
+  IN  AML_OBJECT_NODE_HANDLE  ObjectNode,
+  OUT UINT8                   *OpCode            OPTIONAL,
+  OUT UINT8                   *SubOpCode         OPTIONAL,
+  OUT UINT32                  *PkgLen            OPTIONAL,
+  OUT BOOLEAN                 *IsNameSpaceNode   OPTIONAL
   );
 
 /** Returns the count of the fixed arguments for the input Node.
@@ -368,8 +368,8 @@ AmlGetFixedArgumentCount (
 EFI_STATUS
 EFIAPI
 AmlGetNodeDataType (
-  IN  AML_DATA_NODE_HANDLE    DataNode,
-  OUT EAML_NODE_DATA_TYPE   * DataType
+  IN  AML_DATA_NODE_HANDLE  DataNode,
+  OUT EAML_NODE_DATA_TYPE   *DataType
   );
 
 /** Get the descriptor Id of the resource data element
@@ -392,8 +392,8 @@ AmlGetNodeDataType (
 EFI_STATUS
 EFIAPI
 AmlGetResourceDataType (
-  IN  AML_DATA_NODE_HANDLE    DataNode,
-  OUT AML_RD_HEADER         * ResourceDataType
+  IN  AML_DATA_NODE_HANDLE  DataNode,
+  OUT AML_RD_HEADER         *ResourceDataType
   );
 
 /** Get the data buffer and size of the DataNode.
@@ -422,9 +422,9 @@ AmlGetResourceDataType (
 EFI_STATUS
 EFIAPI
 AmlGetDataNodeBuffer (
-  IN      AML_DATA_NODE_HANDLE    DataNode,
-      OUT UINT8                 * Buffer      OPTIONAL,
-  IN  OUT UINT32                * BufferSize
+  IN      AML_DATA_NODE_HANDLE  DataNode,
+  OUT UINT8                     *Buffer      OPTIONAL,
+  IN  OUT UINT32                *BufferSize
   );
 
 /** Update the ACPI DSDT/SSDT table header.
@@ -444,8 +444,8 @@ AmlGetDataNodeBuffer (
 EFI_STATUS
 EFIAPI
 AmlUpdateRootNode (
-  IN        AML_ROOT_NODE_HANDLE            RootNode,
-  IN  CONST EFI_ACPI_DESCRIPTION_HEADER   * SdtHeader
+  IN        AML_ROOT_NODE_HANDLE         RootNode,
+  IN  CONST EFI_ACPI_DESCRIPTION_HEADER  *SdtHeader
   );
 
 /** Update an object node representing an integer with a new value.
@@ -472,8 +472,8 @@ AmlUpdateRootNode (
 EFI_STATUS
 EFIAPI
 AmlUpdateInteger (
-  IN  AML_OBJECT_NODE_HANDLE    IntegerOpNode,
-  IN  UINT64                    NewInteger
+  IN  AML_OBJECT_NODE_HANDLE  IntegerOpNode,
+  IN  UINT64                  NewInteger
   );
 
 /** Update the buffer of a data node.
@@ -496,10 +496,10 @@ AmlUpdateInteger (
 EFI_STATUS
 EFIAPI
 AmlUpdateDataNode (
-  IN  AML_DATA_NODE_HANDLE    DataNode,
-  IN  EAML_NODE_DATA_TYPE     DataType,
-  IN  UINT8                 * Buffer,
-  IN  UINT32                  Size
+  IN  AML_DATA_NODE_HANDLE  DataNode,
+  IN  EAML_NODE_DATA_TYPE   DataType,
+  IN  UINT8                 *Buffer,
+  IN  UINT32                Size
   );
 
 /**
@@ -541,7 +541,7 @@ AmlUpdateDataNode (
 AML_NODE_HANDLE
 EFIAPI
 AmlGetParent (
-  IN  AML_NODE_HANDLE   Node
+  IN  AML_NODE_HANDLE  Node
   );
 
 /** Get the node at the input Index in the fixed argument list of the input
@@ -590,7 +590,7 @@ AmlGetFixedArgument (
 AML_NODE_HANDLE
 EFIAPI
 AmlGetSiblingVariableArgument (
-  IN  AML_NODE_HANDLE   VarArgNode
+  IN  AML_NODE_HANDLE  VarArgNode
   );
 
 /** Get the next variable argument.
@@ -619,8 +619,8 @@ AmlGetSiblingVariableArgument (
 AML_NODE_HANDLE
 EFIAPI
 AmlGetNextVariableArgument (
-  IN  AML_NODE_HANDLE   Node,
-  IN  AML_NODE_HANDLE   CurrVarArg
+  IN  AML_NODE_HANDLE  Node,
+  IN  AML_NODE_HANDLE  CurrVarArg
   );
 
 /** Get the previous variable argument.
@@ -650,8 +650,8 @@ AmlGetNextVariableArgument (
 AML_NODE_HANDLE
 EFIAPI
 AmlGetPreviousVariableArgument (
-  IN  AML_NODE_HANDLE   Node,
-  IN  AML_NODE_HANDLE   CurrVarArg
+  IN  AML_NODE_HANDLE  Node,
+  IN  AML_NODE_HANDLE  CurrVarArg
   );
 
 /**
@@ -682,10 +682,10 @@ AmlGetPreviousVariableArgument (
 **/
 typedef
 BOOLEAN
-(EFIAPI * EDKII_AML_TREE_ENUM_CALLBACK) (
+(EFIAPI *EDKII_AML_TREE_ENUM_CALLBACK)(
   IN       AML_NODE_HANDLE     Node,
-  IN  OUT  VOID              * Context     OPTIONAL,
-  IN  OUT  EFI_STATUS        * Status      OPTIONAL
+  IN  OUT  VOID              *Context     OPTIONAL,
+  IN  OUT  EFI_STATUS        *Status      OPTIONAL
   );
 
 /** Enumerate all nodes of the subtree under the input Node in the AML
@@ -712,10 +712,10 @@ BOOLEAN
 BOOLEAN
 EFIAPI
 AmlEnumTree (
-  IN      AML_NODE_HANDLE                 Node,
-  IN      EDKII_AML_TREE_ENUM_CALLBACK    CallBack,
-  IN  OUT VOID                          * Context   OPTIONAL,
-      OUT EFI_STATUS                    * Status    OPTIONAL
+  IN      AML_NODE_HANDLE               Node,
+  IN      EDKII_AML_TREE_ENUM_CALLBACK  CallBack,
+  IN  OUT VOID                          *Context   OPTIONAL,
+  OUT EFI_STATUS                        *Status    OPTIONAL
   );
 
 /**
@@ -759,9 +759,9 @@ AmlEnumTree (
 EFI_STATUS
 EFIAPI
 AmlGetAslPathName (
-  IN      AML_NODE_HANDLE     Node,
-      OUT CHAR8             * Buffer,
-  IN  OUT UINT32            * BufferSize
+  IN      AML_NODE_HANDLE  Node,
+  OUT CHAR8                *Buffer,
+  IN  OUT UINT32           *BufferSize
   );
 
 #endif // AML_CORE_INTERFACE_H_

+ 70 - 54
DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c

@@ -19,7 +19,7 @@
 
 /** String table representing AML Data types as defined by EAML_NODE_DATA_TYPE.
 */
-CONST CHAR8 * NodeDataTypeStrTbl[] = {
+CONST CHAR8  *NodeDataTypeStrTbl[] = {
   "EAmlNodeDataTypeNone",
   "EAmlNodeDataTypeReserved1",
   "EAmlNodeDataTypeReserved2",
@@ -37,7 +37,7 @@ CONST CHAR8 * NodeDataTypeStrTbl[] = {
 
 /** String table representing AML Node types as defined by EAML_NODE_TYPE.
 */
-CONST CHAR8 * NodeTypeStrTbl[] = {
+CONST CHAR8  *NodeTypeStrTbl[] = {
   "EAmlNodeUnknown",
   "EAmlNodeRoot",
   "EAmlNodeObject",
@@ -54,9 +54,9 @@ CONST CHAR8 * NodeTypeStrTbl[] = {
 VOID
 EFIAPI
 AmlDbgPrintChars (
-  IN        UINT32      ErrorLevel,
-  IN  CONST CHAR8     * Buffer,
-  IN        UINT32      Size
+  IN        UINT32  ErrorLevel,
+  IN  CONST CHAR8   *Buffer,
+  IN        UINT32  Size
   )
 {
   UINT32  i;
@@ -79,7 +79,7 @@ AmlDbgPrintChars (
 VOID
 EFIAPI
 AmlDbgPrintNameSeg (
-  IN  CONST CHAR8   * Buffer
+  IN  CONST CHAR8  *Buffer
   )
 {
   if (Buffer == NULL) {
@@ -90,18 +90,23 @@ AmlDbgPrintNameSeg (
   DEBUG ((DEBUG_INFO, "%c", Buffer[0]));
   if ((Buffer[1] == AML_NAME_CHAR__)  &&
       (Buffer[2] == AML_NAME_CHAR__)  &&
-      (Buffer[3] == AML_NAME_CHAR__)) {
+      (Buffer[3] == AML_NAME_CHAR__))
+  {
     return;
   }
+
   DEBUG ((DEBUG_INFO, "%c", Buffer[1]));
   if ((Buffer[2] == AML_NAME_CHAR__)  &&
-      (Buffer[3] == AML_NAME_CHAR__)) {
+      (Buffer[3] == AML_NAME_CHAR__))
+  {
     return;
   }
+
   DEBUG ((DEBUG_INFO, "%c", Buffer[2]));
   if (Buffer[3] == AML_NAME_CHAR__) {
     return;
   }
+
   DEBUG ((DEBUG_INFO, "%c", Buffer[3]));
   return;
 }
@@ -114,12 +119,12 @@ AmlDbgPrintNameSeg (
 VOID
 EFIAPI
 AmlDbgPrintNameString (
-  IN  CONST CHAR8   * Buffer,
-  IN        BOOLEAN   NewLine
+  IN  CONST CHAR8    *Buffer,
+  IN        BOOLEAN  NewLine
   )
 {
-  UINT8     SegCount;
-  UINT8     Index;
+  UINT8  SegCount;
+  UINT8  Index;
 
   if (Buffer == NULL) {
     ASSERT (0);
@@ -153,6 +158,7 @@ AmlDbgPrintNameString (
       ASSERT (0);
       return;
     }
+
     SegCount = 1;
   } else if (*Buffer == AML_ZERO_OP) {
     SegCount = 0;
@@ -188,8 +194,8 @@ STATIC
 VOID
 EFIAPI
 AmlDbgPrintNodeHeader (
-  IN  AML_NODE_HEADER  * Node,
-  IN  UINT8              Level
+  IN  AML_NODE_HEADER  *Node,
+  IN  UINT8            Level
   )
 {
   if (!IS_AML_NODE_VALID (Node)) {
@@ -214,8 +220,8 @@ STATIC
 VOID
 EFIAPI
 AmlDbgPrintDataNode (
-  IN  AML_DATA_NODE   * DataNode,
-  IN  UINT8             Level
+  IN  AML_DATA_NODE  *DataNode,
+  IN  UINT8          Level
   )
 {
   UINT32  Idx;
@@ -225,38 +231,39 @@ AmlDbgPrintDataNode (
     return;
   }
 
-  AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)DataNode, Level);
+  AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)DataNode, Level);
 
   DEBUG ((DEBUG_INFO, "%-36a | ", NodeDataTypeStrTbl[DataNode->DataType]));
   DEBUG ((DEBUG_INFO, "0x%04x | ", DataNode->Size));
 
   if ((DataNode->DataType == EAmlNodeDataTypeNameString) ||
-      (DataNode->DataType == EAmlNodeDataTypeString)) {
+      (DataNode->DataType == EAmlNodeDataTypeString))
+  {
     AMLDBG_PRINT_CHARS (
       DEBUG_INFO,
-      (CONST CHAR8*)DataNode->Buffer,
+      (CONST CHAR8 *)DataNode->Buffer,
       DataNode->Size
       );
   } else if (DataNode->DataType == EAmlNodeDataTypeUInt) {
     switch (DataNode->Size) {
       case 1:
       {
-        DEBUG ((DEBUG_INFO, "0x%0x", *((UINT8*)DataNode->Buffer)));
+        DEBUG ((DEBUG_INFO, "0x%0x", *((UINT8 *)DataNode->Buffer)));
         break;
       }
       case 2:
       {
-        DEBUG ((DEBUG_INFO, "0x%0x", *((UINT16*)DataNode->Buffer)));
+        DEBUG ((DEBUG_INFO, "0x%0x", *((UINT16 *)DataNode->Buffer)));
         break;
       }
       case 4:
       {
-        DEBUG ((DEBUG_INFO, "0x%0lx", *((UINT32*)DataNode->Buffer)));
+        DEBUG ((DEBUG_INFO, "0x%0lx", *((UINT32 *)DataNode->Buffer)));
         break;
       }
       case 8:
       {
-        DEBUG ((DEBUG_INFO, "0x%0llx", *((UINT64*)DataNode->Buffer)));
+        DEBUG ((DEBUG_INFO, "0x%0llx", *((UINT64 *)DataNode->Buffer)));
         break;
       }
       default:
@@ -284,8 +291,8 @@ STATIC
 VOID
 EFIAPI
 AmlDbgPrintObjectNode (
-  IN  AML_OBJECT_NODE  * ObjectNode,
-  IN  UINT8              Level
+  IN  AML_OBJECT_NODE  *ObjectNode,
+  IN  UINT8            Level
   )
 {
   if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@@ -293,23 +300,31 @@ AmlDbgPrintObjectNode (
     return;
   }
 
-  AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)ObjectNode, Level);
+  AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)ObjectNode, Level);
 
   DEBUG ((DEBUG_INFO, "0x%02x | ", ObjectNode->AmlByteEncoding->OpCode));
   DEBUG ((DEBUG_INFO, "0x%02x | ", ObjectNode->AmlByteEncoding->SubOpCode));
 
   // Print a string corresponding to the field object OpCode/SubOpCode.
   if (AmlNodeHasAttribute (ObjectNode, AML_IS_FIELD_ELEMENT)) {
-    DEBUG ((DEBUG_INFO, "%-15a ", AmlGetFieldOpCodeStr (
-                                    ObjectNode->AmlByteEncoding->OpCode,
-                                    0
-                                    )));
+    DEBUG ((
+      DEBUG_INFO,
+      "%-15a ",
+      AmlGetFieldOpCodeStr (
+        ObjectNode->AmlByteEncoding->OpCode,
+        0
+        )
+      ));
   } else {
     // Print a string corresponding to the object OpCode/SubOpCode.
-    DEBUG ((DEBUG_INFO, "%-15a | ", AmlGetOpCodeStr (
-                                      ObjectNode->AmlByteEncoding->OpCode,
-                                      ObjectNode->AmlByteEncoding->SubOpCode)
-                                      ));
+    DEBUG ((
+      DEBUG_INFO,
+      "%-15a | ",
+      AmlGetOpCodeStr (
+        ObjectNode->AmlByteEncoding->OpCode,
+        ObjectNode->AmlByteEncoding->SubOpCode
+        )
+      ));
   }
 
   DEBUG ((DEBUG_INFO, "%3d | ", ObjectNode->AmlByteEncoding->MaxIndex));
@@ -317,7 +332,7 @@ AmlDbgPrintObjectNode (
   DEBUG ((DEBUG_INFO, "0x%04x | ", ObjectNode->PkgLen));
   if (AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) {
     AMLDBG_PRINT_NAMESTR (
-      AmlNodeGetName ((CONST AML_OBJECT_NODE*)ObjectNode),
+      AmlNodeGetName ((CONST AML_OBJECT_NODE *)ObjectNode),
       FALSE
       );
   }
@@ -334,8 +349,8 @@ STATIC
 VOID
 EFIAPI
 AmlDbgPrintRootNode (
-  IN  AML_ROOT_NODE  * RootNode,
-  IN  UINT8            Level
+  IN  AML_ROOT_NODE  *RootNode,
+  IN  UINT8          Level
   )
 {
   if (!IS_AML_ROOT_NODE (RootNode)) {
@@ -343,7 +358,7 @@ AmlDbgPrintRootNode (
     return;
   }
 
-  AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)RootNode, Level);
+  AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)RootNode, Level);
 
   DEBUG ((DEBUG_INFO, "%8x | ", RootNode->SdtHeader->Signature));
   DEBUG ((DEBUG_INFO, "0x%08x | ", RootNode->SdtHeader->Length));
@@ -379,25 +394,25 @@ AmlDbgPrintTableHeader (
   DEBUG ((
     DEBUG_INFO,
     "    | %-15a | Signature| Length     | Rev | CSum | OemId  | "
-      "OemTableId       | OemRev   | CreatorId| CreatorRev\n",
+    "OemTableId       | OemRev   | CreatorId| CreatorRev\n",
     NodeTypeStrTbl[EAmlNodeRoot]
     ));
   DEBUG ((
     DEBUG_INFO,
     "    | %-15a | Op   | SubOp| OpName          | MaxI| Attribute  | "
-      "PkgLen | NodeName (opt)\n",
+    "PkgLen | NodeName (opt)\n",
     NodeTypeStrTbl[EAmlNodeObject]
     ));
   DEBUG ((
     DEBUG_INFO,
     "    | %-15a | Data Type                            | Size   | "
-      "Buffer\n",
+    "Buffer\n",
     NodeTypeStrTbl[EAmlNodeData]
     ));
   DEBUG ((
     DEBUG_INFO,
     "---------------------------------------"
-      "---------------------------------------\n"
+    "---------------------------------------\n"
     ));
 }
 
@@ -413,12 +428,12 @@ STATIC
 VOID
 EFIAPI
 AmlDbgPrintTreeInternal (
-  IN  AML_NODE_HEADER   * Node,
-  IN  BOOLEAN             Recurse,
-  IN  UINT8               Level
+  IN  AML_NODE_HEADER  *Node,
+  IN  BOOLEAN          Recurse,
+  IN  UINT8            Level
   )
 {
-  AML_NODE_HEADER   * ChildNode;
+  AML_NODE_HEADER  *ChildNode;
 
   if (!IS_AML_NODE_VALID (Node)) {
     ASSERT (0);
@@ -426,12 +441,12 @@ AmlDbgPrintTreeInternal (
   }
 
   if (IS_AML_DATA_NODE (Node)) {
-    AmlDbgPrintDataNode ((AML_DATA_NODE*)Node, Level);
+    AmlDbgPrintDataNode ((AML_DATA_NODE *)Node, Level);
     return;
   } else if (IS_AML_OBJECT_NODE (Node)) {
-    AmlDbgPrintObjectNode ((AML_OBJECT_NODE*)Node, Level);
+    AmlDbgPrintObjectNode ((AML_OBJECT_NODE *)Node, Level);
   } else if (IS_AML_ROOT_NODE (Node)) {
-    AmlDbgPrintRootNode ((AML_ROOT_NODE*)Node, Level);
+    AmlDbgPrintRootNode ((AML_ROOT_NODE *)Node, Level);
   } else {
     // Should not be possible.
     ASSERT (0);
@@ -459,7 +474,7 @@ AmlDbgPrintTreeInternal (
 VOID
 EFIAPI
 AmlDbgPrintNode (
-  IN  AML_NODE_HEADER   * Node
+  IN  AML_NODE_HEADER  *Node
   )
 {
   AmlDbgPrintTableHeader ();
@@ -474,7 +489,7 @@ AmlDbgPrintNode (
 VOID
 EFIAPI
 AmlDbgPrintTree (
-  IN  AML_NODE_HEADER   * Node
+  IN  AML_NODE_HEADER  *Node
   )
 {
   AmlDbgPrintTableHeader ();
@@ -489,8 +504,8 @@ AmlDbgPrintTree (
 VOID
 EFIAPI
 AmlDbgDumpRaw (
-  IN  CONST UINT8   * Ptr,
-  IN        UINT32    Length
+  IN  CONST UINT8   *Ptr,
+  IN        UINT32  Length
   )
 {
   UINT32  ByteCount;
@@ -498,7 +513,7 @@ AmlDbgDumpRaw (
   UINT32  AsciiBufferIndex;
   CHAR8   AsciiBuffer[17];
 
-  ByteCount = 0;
+  ByteCount        = 0;
   AsciiBufferIndex = 0;
 
   DEBUG ((DEBUG_VERBOSE, "Address  : 0x%p\n", Ptr));
@@ -532,6 +547,7 @@ AmlDbgDumpRaw (
     if ((Length & 0x0F) <= 8) {
       PartLineChars += 2;
     }
+
     while (PartLineChars > 0) {
       DEBUG ((DEBUG_VERBOSE, " "));
       PartLineChars--;

+ 13 - 13
DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h

@@ -24,7 +24,7 @@
 
 #if !defined (MDEPKG_NDEBUG)
 
-#include <AmlInclude.h>
+  #include <AmlInclude.h>
 
 /**
   @defgroup DbgPrintApis Print APIs for debugging.
@@ -46,8 +46,8 @@
 VOID
 EFIAPI
 AmlDbgDumpRaw (
-  IN  CONST UINT8   * Ptr,
-  IN        UINT32    Length
+  IN  CONST UINT8   *Ptr,
+  IN        UINT32  Length
   );
 
 /** Print Size chars at Buffer address.
@@ -61,9 +61,9 @@ AmlDbgDumpRaw (
 VOID
 EFIAPI
 AmlDbgPrintChars (
-  IN        UINT32      ErrorLevel,
-  IN  CONST CHAR8     * Buffer,
-  IN        UINT32      Size
+  IN        UINT32  ErrorLevel,
+  IN  CONST CHAR8   *Buffer,
+  IN        UINT32  Size
   );
 
 /** Print an AML NameSeg.
@@ -74,7 +74,7 @@ AmlDbgPrintChars (
 VOID
 EFIAPI
 AmlDbgPrintNameSeg (
-  IN  CONST CHAR8   * Buffer
+  IN  CONST CHAR8  *Buffer
   );
 
 /** Print an AML NameString.
@@ -85,8 +85,8 @@ AmlDbgPrintNameSeg (
 VOID
 EFIAPI
 AmlDbgPrintNameString (
-  IN  CONST CHAR8   * Buffer,
-  IN        BOOLEAN   NewLine
+  IN  CONST CHAR8    *Buffer,
+  IN        BOOLEAN  NewLine
   );
 
 /** Print Node information.
@@ -99,7 +99,7 @@ AmlDbgPrintNameString (
 VOID
 EFIAPI
 AmlDbgPrintNode (
-  IN  AML_NODE_HANDLE   Node
+  IN  AML_NODE_HANDLE  Node
   );
 
 /** Recursively print the subtree under the Node.
@@ -112,7 +112,7 @@ AmlDbgPrintNode (
 VOID
 EFIAPI
 AmlDbgPrintTree (
-  IN  AML_NODE_HANDLE   Node
+  IN  AML_NODE_HANDLE  Node
   );
 
 /** Print the absolute pathnames in the AML namespace of
@@ -145,7 +145,7 @@ AmlDbgPrintNameSpace (
 #define AMLDBG_PRINT_NAMESEG(Buffer)                  \
           AmlDbgPrintNameSeg (Buffer)
 
-#define AMLDBG_PRINT_NAMESTR(Buffer,NewLine)          \
+#define AMLDBG_PRINT_NAMESTR(Buffer, NewLine)          \
           AmlDbgPrintNameString (Buffer,NewLine)
 
 #define AMLDBG_PRINT_NODE(Node)                       \
@@ -165,7 +165,7 @@ AmlDbgPrintNameSpace (
 
 #define AMLDBG_PRINT_NAMESEG(Buffer)
 
-#define AMLDBG_PRINT_NAMESTR(Buffer,NewLine)
+#define AMLDBG_PRINT_NAMESTR(Buffer, NewLine)
 
 #define AMLDBG_PRINT_NODE(Node)
 

+ 6 - 6
DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h

@@ -62,7 +62,7 @@ typedef enum EAmlNodeDataType {
   @ingroup TreeStructures
 */
 typedef enum EAmlParseIndex {
-  EAmlParseIndexTerm0  = 0,     ///< First fixed argument index.
+  EAmlParseIndexTerm0 = 0,      ///< First fixed argument index.
   EAmlParseIndexTerm1,          ///< Second fixed argument index.
   EAmlParseIndexTerm2,          ///< Third fixed argument index.
   EAmlParseIndexTerm3,          ///< Fourth fixed argument index.
@@ -84,7 +84,7 @@ typedef enum EAmlParseIndex {
 
   @ingroup TreeStructures
 */
-#define MAX_AML_NAMESTRING_SIZE       1277U
+#define MAX_AML_NAMESTRING_SIZE  1277U
 
 /** Maximum size of an ASL NameString.
 
@@ -98,7 +98,7 @@ typedef enum EAmlParseIndex {
 
   @ingroup TreeStructures
 */
-#define MAX_ASL_NAMESTRING_SIZE       1529U
+#define MAX_ASL_NAMESTRING_SIZE  1529U
 
 /** Pseudo OpCode for method invocations.
 
@@ -117,7 +117,7 @@ typedef enum EAmlParseIndex {
 
   @ingroup TreeStructures
 */
-#define AML_METHOD_INVOC_OP           0xD0
+#define AML_METHOD_INVOC_OP  0xD0
 
 /** Pseudo OpCode for NamedField field elements.
 
@@ -136,7 +136,7 @@ typedef enum EAmlParseIndex {
 
   @ingroup TreeStructures
 */
-#define AML_FIELD_NAMED_OP            0x04
+#define AML_FIELD_NAMED_OP  0x04
 
 /** AML object types.
 
@@ -146,7 +146,7 @@ typedef enum EAmlParseIndex {
   @ingroup TreeStructures
 */
 typedef enum EAmlObjType {
-  EAmlObjTypeUnknown        = 0x0,
+  EAmlObjTypeUnknown = 0x0,
   EAmlObjTypeInt,
   EAmlObjTypeStrObj,
   EAmlObjTypeBuffObj,

+ 237 - 221
DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c

@@ -81,153 +81,153 @@
 GLOBAL_REMOVE_IF_UNREFERENCED
 STATIC
 CONST
-AML_BYTE_ENCODING mAmlByteEncoding[] = {
+AML_BYTE_ENCODING  mAmlByteEncoding[] = {
   // Comment                       Str                    OpCode                     SubOpCode               MaxIndex  NameIndex   0                 1                 2                 3                 4                 5                 Attribute
-  /* 0x00 */      {AML_OPCODE_DEF ("ZeroOp",              AML_ZERO_OP),              0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x01 */      {AML_OPCODE_DEF ("OneOp",               AML_ONE_OP),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x06 */      {AML_OPCODE_DEF ("AliasOp",             AML_ALIAS_OP),             0,                      2,        1,         {EAmlName,         EAmlName,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x08 */      {AML_OPCODE_DEF ("NameOp",              AML_NAME_OP),              0,                      2,        0,         {EAmlName,         EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x0A */      {AML_OPCODE_DEF ("BytePrefix",          AML_BYTE_PREFIX),          0,                      1,        0,         {EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x0B */      {AML_OPCODE_DEF ("WordPrefix",          AML_WORD_PREFIX),          0,                      1,        0,         {EAmlUInt16,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x0C */      {AML_OPCODE_DEF ("DWordPrefix",         AML_DWORD_PREFIX),         0,                      1,        0,         {EAmlUInt32,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x0D */      {AML_OPCODE_DEF ("StringPrefix",        AML_STRING_PREFIX),        0,                      1,        0,         {EAmlString,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x0E */      {AML_OPCODE_DEF ("QWordPrefix",         AML_QWORD_PREFIX),         0,                      1,        0,         {EAmlUInt64,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x10 */      {AML_OPCODE_DEF ("ScopeOp",             AML_SCOPE_OP),             0,                      1,        0,         {EAmlName,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
-  /* 0x11 */      {AML_OPCODE_DEF ("BufferOp",            AML_BUFFER_OP),            0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_BYTE_LIST},
-  /* 0x12 */      {AML_OPCODE_DEF ("PackageOp",           AML_PACKAGE_OP),           0,                      1,        0,         {EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
-  /* 0x13 */      {AML_OPCODE_DEF ("VarPackageOp",        AML_VAR_PACKAGE_OP),       0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
-  /* 0x14 */      {AML_OPCODE_DEF ("MethodOp",            AML_METHOD_OP),            0,                      2,        0,         {EAmlName,         EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
-  /* 0x15 */      {AML_OPCODE_DEF ("ExternalOp",          AML_EXTERNAL_OP),          0,                      3,        0,         {EAmlName,         EAmlUInt8,        EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x2E */      {AML_OPCODE_DEF ("DualNamePrefix",      AML_DUAL_NAME_PREFIX),     0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x2F */      {AML_OPCODE_DEF ("MultiNamePrefix",     AML_MULTI_NAME_PREFIX),    0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x41 */      {AML_OPCODE_DEF ("NameChar_A",          'A'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x42 */      {AML_OPCODE_DEF ("NameChar_B",          'B'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x43 */      {AML_OPCODE_DEF ("NameChar_C",          'C'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x44 */      {AML_OPCODE_DEF ("NameChar_D",          'D'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x45 */      {AML_OPCODE_DEF ("NameChar_E",          'E'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x46 */      {AML_OPCODE_DEF ("NameChar_F",          'F'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x47 */      {AML_OPCODE_DEF ("NameChar_G",          'G'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x48 */      {AML_OPCODE_DEF ("NameChar_H",          'H'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x49 */      {AML_OPCODE_DEF ("NameChar_I",          'I'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x4A */      {AML_OPCODE_DEF ("NameChar_J",          'J'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x4B */      {AML_OPCODE_DEF ("NameChar_K",          'K'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x4C */      {AML_OPCODE_DEF ("NameChar_L",          'L'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x4D */      {AML_OPCODE_DEF ("NameChar_M",          'M'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x4E */      {AML_OPCODE_DEF ("NameChar_N",          'N'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x4F */      {AML_OPCODE_DEF ("NameChar_O",          'O'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x50 */      {AML_OPCODE_DEF ("NameChar_P",          'P'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x51 */      {AML_OPCODE_DEF ("NameChar_Q",          'Q'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x52 */      {AML_OPCODE_DEF ("NameChar_R",          'R'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x53 */      {AML_OPCODE_DEF ("NameChar_S",          'S'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x54 */      {AML_OPCODE_DEF ("NameChar_T",          'T'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x55 */      {AML_OPCODE_DEF ("NameChar_U",          'U'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x56 */      {AML_OPCODE_DEF ("NameChar_V",          'V'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x57 */      {AML_OPCODE_DEF ("NameChar_W",          'W'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x58 */      {AML_OPCODE_DEF ("NameChar_X",          'X'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x59 */      {AML_OPCODE_DEF ("NameChar_Y",          'Y'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x5A */      {AML_OPCODE_DEF ("NameChar_Z",          'Z'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x5B 0x01 */ {AML_OPCODE_DEF ("MutexOp",             AML_EXT_OP),               AML_EXT_MUTEX_OP,       2,        0,         {EAmlName,         EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x5B 0x02 */ {AML_OPCODE_DEF ("EventOp",             AML_EXT_OP),               AML_EXT_EVENT_OP,       1,        0,         {EAmlName,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x5B 0x12 */ {AML_OPCODE_DEF ("CondRefOfOp",         AML_EXT_OP),               AML_EXT_COND_REF_OF_OP, 2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x13 */ {AML_OPCODE_DEF ("CreateFieldOp",       AML_EXT_OP),               AML_EXT_CREATE_FIELD_OP,4,        3,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlName,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x5B 0x1F */ {AML_OPCODE_DEF ("LoadTableOp",         AML_EXT_OP),               AML_EXT_LOAD_TABLE_OP,  6,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlObject,       EAmlObject,       EAmlObject},      0},
-  /* 0x5B 0x20 */ {AML_OPCODE_DEF ("LoadOp",              AML_EXT_OP),               AML_EXT_LOAD_OP,        2,        0,         {EAmlName,         EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x21 */ {AML_OPCODE_DEF ("StallOp",             AML_EXT_OP),               AML_EXT_STALL_OP,       1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x22 */ {AML_OPCODE_DEF ("SleepOp",             AML_EXT_OP),               AML_EXT_SLEEP_OP,       1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x23 */ {AML_OPCODE_DEF ("AcquireOp",           AML_EXT_OP),               AML_EXT_ACQUIRE_OP,     2,        0,         {EAmlObject,       EAmlUInt16,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x24 */ {AML_OPCODE_DEF ("SignalOp",            AML_EXT_OP),               AML_EXT_SIGNAL_OP,      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x25 */ {AML_OPCODE_DEF ("WaitOp",              AML_EXT_OP),               AML_EXT_WAIT_OP,        2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x26 */ {AML_OPCODE_DEF ("ResetOp",             AML_EXT_OP),               AML_EXT_RESET_OP,       1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x27 */ {AML_OPCODE_DEF ("ReleaseOp",           AML_EXT_OP),               AML_EXT_RELEASE_OP,     1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x28 */ {AML_OPCODE_DEF ("FromBCDOp",           AML_EXT_OP),               AML_EXT_FROM_BCD_OP,    2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x29 */ {AML_OPCODE_DEF ("ToBCDOp",             AML_EXT_OP),               AML_EXT_TO_BCD_OP,      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x2A */ {AML_OPCODE_DEF ("UnloadOp",            AML_EXT_OP),               AML_EXT_UNLOAD_OP,      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x30 */ {AML_OPCODE_DEF ("RevisionOp",          AML_EXT_OP),               AML_EXT_REVISION_OP,    0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x31 */ {AML_OPCODE_DEF ("DebugOp",             AML_EXT_OP),               AML_EXT_DEBUG_OP,       0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x32 */ {AML_OPCODE_DEF ("FatalOp",             AML_EXT_OP),               AML_EXT_FATAL_OP,       3,        0,         {EAmlUInt8,        EAmlUInt32,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x33 */ {AML_OPCODE_DEF ("TimerOp",             AML_EXT_OP),               AML_EXT_TIMER_OP,       0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x5B 0x80 */ {AML_OPCODE_DEF ("OpRegionOp",          AML_EXT_OP),               AML_EXT_REGION_OP,      4,        0,         {EAmlName,         EAmlUInt8,        EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x5B 0x81 */ {AML_OPCODE_DEF ("FieldOp",             AML_EXT_OP),               AML_EXT_FIELD_OP,       2,        0,         {EAmlName,         EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST},
-  /* 0x5B 0x82 */ {AML_OPCODE_DEF ("DeviceOp",            AML_EXT_OP),               AML_EXT_DEVICE_OP,      1,        0,         {EAmlName,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
-  /* 0x5B 0x83 */ {AML_OPCODE_DEF ("ProcessorOp",         AML_EXT_OP),               AML_EXT_PROCESSOR_OP,   4,        0,         {EAmlName,         EAmlUInt8,        EAmlUInt32,       EAmlUInt8,        EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
-  /* 0x5B 0x84 */ {AML_OPCODE_DEF ("PowerResOp",          AML_EXT_OP),               AML_EXT_POWER_RES_OP,   3,        0,         {EAmlName,         EAmlUInt8,        EAmlUInt16,       EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
-  /* 0x5B 0x85 */ {AML_OPCODE_DEF ("ThermalZoneOp",       AML_EXT_OP),               AML_EXT_THERMAL_ZONE_OP,1,        0,         {EAmlName,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
-  /* 0x5B 0x86 */ {AML_OPCODE_DEF ("IndexFieldOp",        AML_EXT_OP),               AML_EXT_INDEX_FIELD_OP, 3,        0,         {EAmlName,         EAmlName,         EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST},
-  /* 0x5B 0x87 */ {AML_OPCODE_DEF ("BankFieldOp",         AML_EXT_OP),               AML_EXT_BANK_FIELD_OP,  4,        0,         {EAmlName,         EAmlName,         EAmlObject,       EAmlUInt8,        EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST},
-  /* 0x5B 0x88 */ {AML_OPCODE_DEF ("DataRegionOp",        AML_EXT_OP),               AML_EXT_DATA_REGION_OP, 4,        0,         {EAmlName,         EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x5C */      {AML_OPCODE_DEF ("RootChar",            AML_ROOT_CHAR),            0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x5E */      {AML_OPCODE_DEF ("ParentPrefixChar",    AML_PARENT_PREFIX_CHAR),   0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x5F */      {AML_OPCODE_DEF ("NameChar",            '_'),                      0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_NAME_CHAR},
-  /* 0x60 */      {AML_OPCODE_DEF ("Local0Op",            AML_LOCAL0),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x61 */      {AML_OPCODE_DEF ("Local1Op",            AML_LOCAL1),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x62 */      {AML_OPCODE_DEF ("Local2Op",            AML_LOCAL2),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x63 */      {AML_OPCODE_DEF ("Local3Op",            AML_LOCAL3),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x64 */      {AML_OPCODE_DEF ("Local4Op",            AML_LOCAL4),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x65 */      {AML_OPCODE_DEF ("Local5Op",            AML_LOCAL5),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x66 */      {AML_OPCODE_DEF ("Local6Op",            AML_LOCAL6),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x67 */      {AML_OPCODE_DEF ("Local7Op",            AML_LOCAL7),               0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x68 */      {AML_OPCODE_DEF ("Arg0Op",              AML_ARG0),                 0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x69 */      {AML_OPCODE_DEF ("Arg1Op",              AML_ARG1),                 0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x6A */      {AML_OPCODE_DEF ("Arg2Op",              AML_ARG2),                 0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x6B */      {AML_OPCODE_DEF ("Arg3Op",              AML_ARG3),                 0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x6C */      {AML_OPCODE_DEF ("Arg4Op",              AML_ARG4),                 0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x6D */      {AML_OPCODE_DEF ("Arg5Op",              AML_ARG5),                 0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x6E */      {AML_OPCODE_DEF ("Arg6Op",              AML_ARG6),                 0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x70 */      {AML_OPCODE_DEF ("StoreOp",             AML_STORE_OP),             0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x71 */      {AML_OPCODE_DEF ("RefOfOp",             AML_REF_OF_OP),            0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x72 */      {AML_OPCODE_DEF ("AddOp",               AML_ADD_OP),               0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x73 */      {AML_OPCODE_DEF ("ConcatOp",            AML_CONCAT_OP),            0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x74 */      {AML_OPCODE_DEF ("SubtractOp",          AML_SUBTRACT_OP),          0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x75 */      {AML_OPCODE_DEF ("IncrementOp",         AML_INCREMENT_OP),         0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x76 */      {AML_OPCODE_DEF ("DecrementOp",         AML_DECREMENT_OP),         0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x77 */      {AML_OPCODE_DEF ("MultiplyOp",          AML_MULTIPLY_OP),          0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x78 */      {AML_OPCODE_DEF ("DivideOp",            AML_DIVIDE_OP),            0,                      4,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone},        0},
-  /* 0x79 */      {AML_OPCODE_DEF ("ShiftLeftOp",         AML_SHIFT_LEFT_OP),        0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x7A */      {AML_OPCODE_DEF ("ShiftRightOp",        AML_SHIFT_RIGHT_OP),       0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x7B */      {AML_OPCODE_DEF ("AndOp",               AML_AND_OP),               0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x7C */      {AML_OPCODE_DEF ("NAndOp",              AML_NAND_OP),              0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x7D */      {AML_OPCODE_DEF ("OrOp",                AML_OR_OP),                0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x7E */      {AML_OPCODE_DEF ("NorOp",               AML_NOR_OP),               0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x7F */      {AML_OPCODE_DEF ("XOrOp",               AML_XOR_OP),               0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x80 */      {AML_OPCODE_DEF ("NotOp",               AML_NOT_OP),               0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x81 */      {AML_OPCODE_DEF ("FindSetLeftBitOp",    AML_FIND_SET_LEFT_BIT_OP), 0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x82 */      {AML_OPCODE_DEF ("FindSetRightBitOp",   AML_FIND_SET_RIGHT_BIT_OP),0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x83 */      {AML_OPCODE_DEF ("DerefOfOp",           AML_DEREF_OF_OP),          0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x84 */      {AML_OPCODE_DEF ("ConcatResOp",         AML_CONCAT_RES_OP),        0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x85 */      {AML_OPCODE_DEF ("ModOp",               AML_MOD_OP),               0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x86 */      {AML_OPCODE_DEF ("NotifyOp",            AML_NOTIFY_OP),            0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x87 */      {AML_OPCODE_DEF ("SizeOfOp",            AML_SIZE_OF_OP),           0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x88 */      {AML_OPCODE_DEF ("IndexOp",             AML_INDEX_OP),             0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x89 */      {AML_OPCODE_DEF ("MatchOp",             AML_MATCH_OP),             0,                      6,        0,         {EAmlObject,       EAmlUInt8,        EAmlObject,       EAmlUInt8,        EAmlObject,       EAmlObject},      0},
-  /* 0x8A */      {AML_OPCODE_DEF ("CreateDWordFieldOp",  AML_CREATE_DWORD_FIELD_OP),0,                      3,        2,         {EAmlObject,       EAmlObject,       EAmlName,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x8B */      {AML_OPCODE_DEF ("CreateWordFieldOp",   AML_CREATE_WORD_FIELD_OP), 0,                      3,        2,         {EAmlObject,       EAmlObject,       EAmlName,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x8C */      {AML_OPCODE_DEF ("CreateByteFieldOp",   AML_CREATE_BYTE_FIELD_OP), 0,                      3,        2,         {EAmlObject,       EAmlObject,       EAmlName,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x8D */      {AML_OPCODE_DEF ("CreateBitFieldOp",    AML_CREATE_BIT_FIELD_OP),  0,                      3,        2,         {EAmlObject,       EAmlObject,       EAmlName,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x8E */      {AML_OPCODE_DEF ("ObjectTypeOp",        AML_OBJECT_TYPE_OP),       0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x8F */      {AML_OPCODE_DEF ("CreateQWordFieldOp",  AML_CREATE_QWORD_FIELD_OP),0,                      3,        2,         {EAmlObject,       EAmlObject,       EAmlName,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IN_NAMESPACE},
-  /* 0x90 */      {AML_OPCODE_DEF ("LAndOp",              AML_LAND_OP),              0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x91 */      {AML_OPCODE_DEF ("LOrOp",               AML_LOR_OP),               0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x92 */      {AML_OPCODE_DEF ("LNotOp",              AML_LNOT_OP),              0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x93 */      {AML_OPCODE_DEF ("LEqualOp",            AML_LEQUAL_OP),            0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x94 */      {AML_OPCODE_DEF ("LGreaterOp",          AML_LGREATER_OP),          0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x95 */      {AML_OPCODE_DEF ("LLessOp",             AML_LLESS_OP),             0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x96 */      {AML_OPCODE_DEF ("ToBufferOp",          AML_TO_BUFFER_OP),         0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x97 */      {AML_OPCODE_DEF ("ToDecimalStringOp",   AML_TO_DEC_STRING_OP),     0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x98 */      {AML_OPCODE_DEF ("ToHexStringOp",       AML_TO_HEX_STRING_OP),     0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x99 */      {AML_OPCODE_DEF ("ToIntegerOp",         AML_TO_INTEGER_OP),        0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x9C */      {AML_OPCODE_DEF ("ToStringOp",          AML_TO_STRING_OP),         0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x9D */      {AML_OPCODE_DEF ("CopyObjectOp",        AML_COPY_OBJECT_OP),       0,                      2,        0,         {EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x9E */      {AML_OPCODE_DEF ("MidOp",               AML_MID_OP),               0,                      3,        0,         {EAmlObject,       EAmlObject,       EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0x9F */      {AML_OPCODE_DEF ("ContinueOp",          AML_CONTINUE_OP),          0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0xA0 */      {AML_OPCODE_DEF ("IfOp",                AML_IF_OP),                0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
-  /* 0xA1 */      {AML_OPCODE_DEF ("ElseOp",              AML_ELSE_OP),              0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
-  /* 0xA2 */      {AML_OPCODE_DEF ("WhileOp",             AML_WHILE_OP),             0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
-  /* 0xA3 */      {AML_OPCODE_DEF ("NoopOp",              AML_NOOP_OP),              0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0xA4 */      {AML_OPCODE_DEF ("ReturnOp",            AML_RETURN_OP),            0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0xA5 */      {AML_OPCODE_DEF ("BreakOp",             AML_BREAK_OP),             0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0xCC */      {AML_OPCODE_DEF ("BreakPointOp",        AML_BREAK_POINT_OP),       0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
-  /* 0xD0 */      {AML_OPCODE_DEF ("MethodInvocOp",       AML_METHOD_INVOC_OP),      0,                      2,        0,         {EAmlName,         EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_PSEUDO_OPCODE | AML_HAS_CHILD_OBJ},
-  /* 0xFF */      {AML_OPCODE_DEF ("OnesOp",              AML_ONES_OP),              0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        0},
+  /* 0x00 */      { AML_OPCODE_DEF ("ZeroOp",             AML_ZERO_OP),               0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x01 */      { AML_OPCODE_DEF ("OneOp",              AML_ONE_OP),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x06 */      { AML_OPCODE_DEF ("AliasOp",            AML_ALIAS_OP),              0,                       2, 1, { EAmlName,   EAmlName,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x08 */      { AML_OPCODE_DEF ("NameOp",             AML_NAME_OP),               0,                       2, 0, { EAmlName,   EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x0A */      { AML_OPCODE_DEF ("BytePrefix",         AML_BYTE_PREFIX),           0,                       1, 0, { EAmlUInt8,  EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x0B */      { AML_OPCODE_DEF ("WordPrefix",         AML_WORD_PREFIX),           0,                       1, 0, { EAmlUInt16, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x0C */      { AML_OPCODE_DEF ("DWordPrefix",        AML_DWORD_PREFIX),          0,                       1, 0, { EAmlUInt32, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x0D */      { AML_OPCODE_DEF ("StringPrefix",       AML_STRING_PREFIX),         0,                       1, 0, { EAmlString, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x0E */      { AML_OPCODE_DEF ("QWordPrefix",        AML_QWORD_PREFIX),          0,                       1, 0, { EAmlUInt64, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x10 */      { AML_OPCODE_DEF ("ScopeOp",            AML_SCOPE_OP),              0,                       1, 0, { EAmlName,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+  /* 0x11 */      { AML_OPCODE_DEF ("BufferOp",           AML_BUFFER_OP),             0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_BYTE_LIST                    },
+  /* 0x12 */      { AML_OPCODE_DEF ("PackageOp",          AML_PACKAGE_OP),            0,                       1, 0, { EAmlUInt8,  EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ                    },
+  /* 0x13 */      { AML_OPCODE_DEF ("VarPackageOp",       AML_VAR_PACKAGE_OP),        0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ                    },
+  /* 0x14 */      { AML_OPCODE_DEF ("MethodOp",           AML_METHOD_OP),             0,                       2, 0, { EAmlName,   EAmlUInt8,  EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+  /* 0x15 */      { AML_OPCODE_DEF ("ExternalOp",         AML_EXTERNAL_OP),           0,                       3, 0, { EAmlName,   EAmlUInt8,  EAmlUInt8,  EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x2E */      { AML_OPCODE_DEF ("DualNamePrefix",     AML_DUAL_NAME_PREFIX),      0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x2F */      { AML_OPCODE_DEF ("MultiNamePrefix",    AML_MULTI_NAME_PREFIX),     0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x41 */      { AML_OPCODE_DEF ("NameChar_A",         'A'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x42 */      { AML_OPCODE_DEF ("NameChar_B",         'B'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x43 */      { AML_OPCODE_DEF ("NameChar_C",         'C'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x44 */      { AML_OPCODE_DEF ("NameChar_D",         'D'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x45 */      { AML_OPCODE_DEF ("NameChar_E",         'E'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x46 */      { AML_OPCODE_DEF ("NameChar_F",         'F'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x47 */      { AML_OPCODE_DEF ("NameChar_G",         'G'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x48 */      { AML_OPCODE_DEF ("NameChar_H",         'H'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x49 */      { AML_OPCODE_DEF ("NameChar_I",         'I'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x4A */      { AML_OPCODE_DEF ("NameChar_J",         'J'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x4B */      { AML_OPCODE_DEF ("NameChar_K",         'K'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x4C */      { AML_OPCODE_DEF ("NameChar_L",         'L'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x4D */      { AML_OPCODE_DEF ("NameChar_M",         'M'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x4E */      { AML_OPCODE_DEF ("NameChar_N",         'N'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x4F */      { AML_OPCODE_DEF ("NameChar_O",         'O'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x50 */      { AML_OPCODE_DEF ("NameChar_P",         'P'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x51 */      { AML_OPCODE_DEF ("NameChar_Q",         'Q'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x52 */      { AML_OPCODE_DEF ("NameChar_R",         'R'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x53 */      { AML_OPCODE_DEF ("NameChar_S",         'S'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x54 */      { AML_OPCODE_DEF ("NameChar_T",         'T'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x55 */      { AML_OPCODE_DEF ("NameChar_U",         'U'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x56 */      { AML_OPCODE_DEF ("NameChar_V",         'V'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x57 */      { AML_OPCODE_DEF ("NameChar_W",         'W'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x58 */      { AML_OPCODE_DEF ("NameChar_X",         'X'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x59 */      { AML_OPCODE_DEF ("NameChar_Y",         'Y'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x5A */      { AML_OPCODE_DEF ("NameChar_Z",         'Z'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x5B 0x01 */ { AML_OPCODE_DEF ("MutexOp",            AML_EXT_OP),                AML_EXT_MUTEX_OP,        2, 0, { EAmlName,   EAmlUInt8,  EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x5B 0x02 */ { AML_OPCODE_DEF ("EventOp",            AML_EXT_OP),                AML_EXT_EVENT_OP,        1, 0, { EAmlName,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x5B 0x12 */ { AML_OPCODE_DEF ("CondRefOfOp",        AML_EXT_OP),                AML_EXT_COND_REF_OF_OP,  2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x13 */ { AML_OPCODE_DEF ("CreateFieldOp",      AML_EXT_OP),                AML_EXT_CREATE_FIELD_OP, 4, 3, { EAmlObject, EAmlObject, EAmlObject, EAmlName,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x5B 0x1F */ { AML_OPCODE_DEF ("LoadTableOp",        AML_EXT_OP),                AML_EXT_LOAD_TABLE_OP,   6, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject }, 0                                                         },
+  /* 0x5B 0x20 */ { AML_OPCODE_DEF ("LoadOp",             AML_EXT_OP),                AML_EXT_LOAD_OP,         2, 0, { EAmlName,   EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x21 */ { AML_OPCODE_DEF ("StallOp",            AML_EXT_OP),                AML_EXT_STALL_OP,        1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x22 */ { AML_OPCODE_DEF ("SleepOp",            AML_EXT_OP),                AML_EXT_SLEEP_OP,        1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x23 */ { AML_OPCODE_DEF ("AcquireOp",          AML_EXT_OP),                AML_EXT_ACQUIRE_OP,      2, 0, { EAmlObject, EAmlUInt16, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x24 */ { AML_OPCODE_DEF ("SignalOp",           AML_EXT_OP),                AML_EXT_SIGNAL_OP,       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x25 */ { AML_OPCODE_DEF ("WaitOp",             AML_EXT_OP),                AML_EXT_WAIT_OP,         2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x26 */ { AML_OPCODE_DEF ("ResetOp",            AML_EXT_OP),                AML_EXT_RESET_OP,        1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x27 */ { AML_OPCODE_DEF ("ReleaseOp",          AML_EXT_OP),                AML_EXT_RELEASE_OP,      1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x28 */ { AML_OPCODE_DEF ("FromBCDOp",          AML_EXT_OP),                AML_EXT_FROM_BCD_OP,     2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x29 */ { AML_OPCODE_DEF ("ToBCDOp",            AML_EXT_OP),                AML_EXT_TO_BCD_OP,       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x2A */ { AML_OPCODE_DEF ("UnloadOp",           AML_EXT_OP),                AML_EXT_UNLOAD_OP,       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x30 */ { AML_OPCODE_DEF ("RevisionOp",         AML_EXT_OP),                AML_EXT_REVISION_OP,     0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x31 */ { AML_OPCODE_DEF ("DebugOp",            AML_EXT_OP),                AML_EXT_DEBUG_OP,        0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x32 */ { AML_OPCODE_DEF ("FatalOp",            AML_EXT_OP),                AML_EXT_FATAL_OP,        3, 0, { EAmlUInt8,  EAmlUInt32, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x33 */ { AML_OPCODE_DEF ("TimerOp",            AML_EXT_OP),                AML_EXT_TIMER_OP,        0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x5B 0x80 */ { AML_OPCODE_DEF ("OpRegionOp",         AML_EXT_OP),                AML_EXT_REGION_OP,       4, 0, { EAmlName,   EAmlUInt8,  EAmlObject, EAmlObject, EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x5B 0x81 */ { AML_OPCODE_DEF ("FieldOp",            AML_EXT_OP),                AML_EXT_FIELD_OP,        2, 0, { EAmlName,   EAmlUInt8,  EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST                   },
+  /* 0x5B 0x82 */ { AML_OPCODE_DEF ("DeviceOp",           AML_EXT_OP),                AML_EXT_DEVICE_OP,       1, 0, { EAmlName,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+  /* 0x5B 0x83 */ { AML_OPCODE_DEF ("ProcessorOp",        AML_EXT_OP),                AML_EXT_PROCESSOR_OP,    4, 0, { EAmlName,   EAmlUInt8,  EAmlUInt32, EAmlUInt8,  EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+  /* 0x5B 0x84 */ { AML_OPCODE_DEF ("PowerResOp",         AML_EXT_OP),                AML_EXT_POWER_RES_OP,    3, 0, { EAmlName,   EAmlUInt8,  EAmlUInt16, EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+  /* 0x5B 0x85 */ { AML_OPCODE_DEF ("ThermalZoneOp",      AML_EXT_OP),                AML_EXT_THERMAL_ZONE_OP, 1, 0, { EAmlName,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+  /* 0x5B 0x86 */ { AML_OPCODE_DEF ("IndexFieldOp",       AML_EXT_OP),                AML_EXT_INDEX_FIELD_OP,  3, 0, { EAmlName,   EAmlName,   EAmlUInt8,  EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST                   },
+  /* 0x5B 0x87 */ { AML_OPCODE_DEF ("BankFieldOp",        AML_EXT_OP),                AML_EXT_BANK_FIELD_OP,   4, 0, { EAmlName,   EAmlName,   EAmlObject, EAmlUInt8,  EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST                   },
+  /* 0x5B 0x88 */ { AML_OPCODE_DEF ("DataRegionOp",       AML_EXT_OP),                AML_EXT_DATA_REGION_OP,  4, 0, { EAmlName,   EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x5C */      { AML_OPCODE_DEF ("RootChar",           AML_ROOT_CHAR),             0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x5E */      { AML_OPCODE_DEF ("ParentPrefixChar",   AML_PARENT_PREFIX_CHAR),    0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x5F */      { AML_OPCODE_DEF ("NameChar",           '_'),                       0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_NAME_CHAR                                          },
+  /* 0x60 */      { AML_OPCODE_DEF ("Local0Op",           AML_LOCAL0),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x61 */      { AML_OPCODE_DEF ("Local1Op",           AML_LOCAL1),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x62 */      { AML_OPCODE_DEF ("Local2Op",           AML_LOCAL2),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x63 */      { AML_OPCODE_DEF ("Local3Op",           AML_LOCAL3),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x64 */      { AML_OPCODE_DEF ("Local4Op",           AML_LOCAL4),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x65 */      { AML_OPCODE_DEF ("Local5Op",           AML_LOCAL5),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x66 */      { AML_OPCODE_DEF ("Local6Op",           AML_LOCAL6),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x67 */      { AML_OPCODE_DEF ("Local7Op",           AML_LOCAL7),                0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x68 */      { AML_OPCODE_DEF ("Arg0Op",             AML_ARG0),                  0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x69 */      { AML_OPCODE_DEF ("Arg1Op",             AML_ARG1),                  0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x6A */      { AML_OPCODE_DEF ("Arg2Op",             AML_ARG2),                  0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x6B */      { AML_OPCODE_DEF ("Arg3Op",             AML_ARG3),                  0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x6C */      { AML_OPCODE_DEF ("Arg4Op",             AML_ARG4),                  0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x6D */      { AML_OPCODE_DEF ("Arg5Op",             AML_ARG5),                  0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x6E */      { AML_OPCODE_DEF ("Arg6Op",             AML_ARG6),                  0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x70 */      { AML_OPCODE_DEF ("StoreOp",            AML_STORE_OP),              0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x71 */      { AML_OPCODE_DEF ("RefOfOp",            AML_REF_OF_OP),             0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x72 */      { AML_OPCODE_DEF ("AddOp",              AML_ADD_OP),                0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x73 */      { AML_OPCODE_DEF ("ConcatOp",           AML_CONCAT_OP),             0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x74 */      { AML_OPCODE_DEF ("SubtractOp",         AML_SUBTRACT_OP),           0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x75 */      { AML_OPCODE_DEF ("IncrementOp",        AML_INCREMENT_OP),          0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x76 */      { AML_OPCODE_DEF ("DecrementOp",        AML_DECREMENT_OP),          0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x77 */      { AML_OPCODE_DEF ("MultiplyOp",         AML_MULTIPLY_OP),           0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x78 */      { AML_OPCODE_DEF ("DivideOp",           AML_DIVIDE_OP),             0,                       4, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x79 */      { AML_OPCODE_DEF ("ShiftLeftOp",        AML_SHIFT_LEFT_OP),         0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x7A */      { AML_OPCODE_DEF ("ShiftRightOp",       AML_SHIFT_RIGHT_OP),        0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x7B */      { AML_OPCODE_DEF ("AndOp",              AML_AND_OP),                0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x7C */      { AML_OPCODE_DEF ("NAndOp",             AML_NAND_OP),               0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x7D */      { AML_OPCODE_DEF ("OrOp",               AML_OR_OP),                 0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x7E */      { AML_OPCODE_DEF ("NorOp",              AML_NOR_OP),                0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x7F */      { AML_OPCODE_DEF ("XOrOp",              AML_XOR_OP),                0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x80 */      { AML_OPCODE_DEF ("NotOp",              AML_NOT_OP),                0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x81 */      { AML_OPCODE_DEF ("FindSetLeftBitOp",   AML_FIND_SET_LEFT_BIT_OP),  0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x82 */      { AML_OPCODE_DEF ("FindSetRightBitOp",  AML_FIND_SET_RIGHT_BIT_OP), 0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x83 */      { AML_OPCODE_DEF ("DerefOfOp",          AML_DEREF_OF_OP),           0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x84 */      { AML_OPCODE_DEF ("ConcatResOp",        AML_CONCAT_RES_OP),         0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x85 */      { AML_OPCODE_DEF ("ModOp",              AML_MOD_OP),                0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x86 */      { AML_OPCODE_DEF ("NotifyOp",           AML_NOTIFY_OP),             0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x87 */      { AML_OPCODE_DEF ("SizeOfOp",           AML_SIZE_OF_OP),            0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x88 */      { AML_OPCODE_DEF ("IndexOp",            AML_INDEX_OP),              0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x89 */      { AML_OPCODE_DEF ("MatchOp",            AML_MATCH_OP),              0,                       6, 0, { EAmlObject, EAmlUInt8,  EAmlObject, EAmlUInt8,  EAmlObject, EAmlObject }, 0                                                         },
+  /* 0x8A */      { AML_OPCODE_DEF ("CreateDWordFieldOp", AML_CREATE_DWORD_FIELD_OP), 0,                       3, 2, { EAmlObject, EAmlObject, EAmlName,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x8B */      { AML_OPCODE_DEF ("CreateWordFieldOp",  AML_CREATE_WORD_FIELD_OP),  0,                       3, 2, { EAmlObject, EAmlObject, EAmlName,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x8C */      { AML_OPCODE_DEF ("CreateByteFieldOp",  AML_CREATE_BYTE_FIELD_OP),  0,                       3, 2, { EAmlObject, EAmlObject, EAmlName,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x8D */      { AML_OPCODE_DEF ("CreateBitFieldOp",   AML_CREATE_BIT_FIELD_OP),   0,                       3, 2, { EAmlObject, EAmlObject, EAmlName,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x8E */      { AML_OPCODE_DEF ("ObjectTypeOp",       AML_OBJECT_TYPE_OP),        0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x8F */      { AML_OPCODE_DEF ("CreateQWordFieldOp", AML_CREATE_QWORD_FIELD_OP), 0,                       3, 2, { EAmlObject, EAmlObject, EAmlName,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IN_NAMESPACE                                          },
+  /* 0x90 */      { AML_OPCODE_DEF ("LAndOp",             AML_LAND_OP),               0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x91 */      { AML_OPCODE_DEF ("LOrOp",              AML_LOR_OP),                0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x92 */      { AML_OPCODE_DEF ("LNotOp",             AML_LNOT_OP),               0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x93 */      { AML_OPCODE_DEF ("LEqualOp",           AML_LEQUAL_OP),             0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x94 */      { AML_OPCODE_DEF ("LGreaterOp",         AML_LGREATER_OP),           0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x95 */      { AML_OPCODE_DEF ("LLessOp",            AML_LLESS_OP),              0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x96 */      { AML_OPCODE_DEF ("ToBufferOp",         AML_TO_BUFFER_OP),          0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x97 */      { AML_OPCODE_DEF ("ToDecimalStringOp",  AML_TO_DEC_STRING_OP),      0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x98 */      { AML_OPCODE_DEF ("ToHexStringOp",      AML_TO_HEX_STRING_OP),      0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x99 */      { AML_OPCODE_DEF ("ToIntegerOp",        AML_TO_INTEGER_OP),         0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x9C */      { AML_OPCODE_DEF ("ToStringOp",         AML_TO_STRING_OP),          0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x9D */      { AML_OPCODE_DEF ("CopyObjectOp",       AML_COPY_OBJECT_OP),        0,                       2, 0, { EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x9E */      { AML_OPCODE_DEF ("MidOp",              AML_MID_OP),                0,                       3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0x9F */      { AML_OPCODE_DEF ("ContinueOp",         AML_CONTINUE_OP),           0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0xA0 */      { AML_OPCODE_DEF ("IfOp",               AML_IF_OP),                 0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ                    },
+  /* 0xA1 */      { AML_OPCODE_DEF ("ElseOp",             AML_ELSE_OP),               0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ                    },
+  /* 0xA2 */      { AML_OPCODE_DEF ("WhileOp",            AML_WHILE_OP),              0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ                    },
+  /* 0xA3 */      { AML_OPCODE_DEF ("NoopOp",             AML_NOOP_OP),               0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0xA4 */      { AML_OPCODE_DEF ("ReturnOp",           AML_RETURN_OP),             0,                       1, 0, { EAmlObject, EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0xA5 */      { AML_OPCODE_DEF ("BreakOp",            AML_BREAK_OP),              0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0xCC */      { AML_OPCODE_DEF ("BreakPointOp",       AML_BREAK_POINT_OP),        0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
+  /* 0xD0 */      { AML_OPCODE_DEF ("MethodInvocOp",      AML_METHOD_INVOC_OP),       0,                       2, 0, { EAmlName,   EAmlUInt8,  EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, AML_IS_PSEUDO_OPCODE | AML_HAS_CHILD_OBJ                  },
+  /* 0xFF */      { AML_OPCODE_DEF ("OnesOp",             AML_ONES_OP),               0,                       0, 0, { EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone,   EAmlNone   }, 0                                                         },
 };
 
 /** AML grammar encoding for field elements.
@@ -264,13 +264,13 @@ AML_BYTE_ENCODING mAmlByteEncoding[] = {
 GLOBAL_REMOVE_IF_UNREFERENCED
 STATIC
 CONST
-AML_BYTE_ENCODING mAmlFieldEncoding[] = {
+AML_BYTE_ENCODING  mAmlFieldEncoding[] = {
   // Comment                       Str                    OpCode                     SubOpCode               MaxIndex  NameIndex   0                 1                 2                 3                 4                 5                 Attribute
-  /* 0x00 */      {AML_OPCODE_DEF ("FieldReservedOp",     AML_FIELD_RESERVED_OP),    0,                      0,        0,         {EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_FIELD_ELEMENT | AML_HAS_PKG_LENGTH},
-  /* 0x01 */      {AML_OPCODE_DEF ("FieldAccessOp",       AML_FIELD_ACCESS_OP),      0,                      2,        0,         {EAmlUInt8,        EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_FIELD_ELEMENT},
-  /* 0x02 */      {AML_OPCODE_DEF ("FieldConnectionOp",   AML_FIELD_CONNECTION_OP),  0,                      1,        0,         {EAmlObject,       EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_FIELD_ELEMENT},
-  /* 0x03 */      {AML_OPCODE_DEF ("FieldExtAccessOp",    AML_FIELD_EXT_ACCESS_OP),  0,                      3,        0,         {EAmlUInt8,        EAmlUInt8,        EAmlUInt8,        EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_FIELD_ELEMENT},
-  /* 0x04 */      {AML_OPCODE_DEF ("FieldNamed",          AML_FIELD_NAMED_OP),       0,                      2,        0,         {EAmlName,         EAmlFieldPkgLen,  EAmlNone,         EAmlNone,         EAmlNone,         EAmlNone},        AML_IS_FIELD_ELEMENT | AML_IS_PSEUDO_OPCODE | AML_IN_NAMESPACE}
+  /* 0x00 */ { AML_OPCODE_DEF ("FieldReservedOp",   AML_FIELD_RESERVED_OP),   0, 0, 0, { EAmlNone,   EAmlNone,        EAmlNone,  EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT | AML_HAS_PKG_LENGTH                      },
+  /* 0x01 */ { AML_OPCODE_DEF ("FieldAccessOp",     AML_FIELD_ACCESS_OP),     0, 2, 0, { EAmlUInt8,  EAmlUInt8,       EAmlNone,  EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT                                           },
+  /* 0x02 */ { AML_OPCODE_DEF ("FieldConnectionOp", AML_FIELD_CONNECTION_OP), 0, 1, 0, { EAmlObject, EAmlNone,        EAmlNone,  EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT                                           },
+  /* 0x03 */ { AML_OPCODE_DEF ("FieldExtAccessOp",  AML_FIELD_EXT_ACCESS_OP), 0, 3, 0, { EAmlUInt8,  EAmlUInt8,       EAmlUInt8, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT                                           },
+  /* 0x04 */ { AML_OPCODE_DEF ("FieldNamed",        AML_FIELD_NAMED_OP),      0, 2, 0, { EAmlName,   EAmlFieldPkgLen, EAmlNone,  EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT | AML_IS_PSEUDO_OPCODE | AML_IN_NAMESPACE }
 };
 
 /** Get the AML_BYTE_ENCODING entry in the AML encoding table.
@@ -288,12 +288,12 @@ CONST
 AML_BYTE_ENCODING *
 EFIAPI
 AmlGetByteEncoding (
-  IN  CONST UINT8   * Buffer
+  IN  CONST UINT8  *Buffer
   )
 {
-  UINT8     OpCode;
-  UINT8     SubOpCode;
-  UINT32    Index;
+  UINT8   OpCode;
+  UINT8   SubOpCode;
+  UINT32  Index;
 
   if (Buffer == NULL) {
     ASSERT (0);
@@ -311,16 +311,20 @@ AmlGetByteEncoding (
   // Search the table.
   for (Index = 0;
        Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
-       Index++) {
+       Index++)
+  {
     if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
-        (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
-       if ((mAmlByteEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) ==
-            AML_IS_PSEUDO_OPCODE) {
+        (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
+    {
+      if ((mAmlByteEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) ==
+          AML_IS_PSEUDO_OPCODE)
+      {
         // A pseudo OpCode cannot be parsed as it is internal to this library.
         // The MethodInvocation encoding can be detected by NameSpace lookup.
         ASSERT (0);
         return NULL;
       }
+
       return &mAmlByteEncoding[Index];
     }
   }
@@ -341,21 +345,24 @@ CONST
 AML_BYTE_ENCODING *
 EFIAPI
 AmlGetByteEncodingByOpCode (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   )
 {
-  UINT32    Index;
+  UINT32  Index;
 
   // Search the table.
   for (Index = 0;
        Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
-       Index++) {
+       Index++)
+  {
     if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
-        (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
+        (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
+    {
       return &mAmlByteEncoding[Index];
     }
   }
+
   return NULL;
 }
 
@@ -374,11 +381,11 @@ CONST
 AML_BYTE_ENCODING *
 EFIAPI
 AmlGetFieldEncoding (
-  IN  CONST UINT8   * Buffer
+  IN  CONST UINT8  *Buffer
   )
 {
-  UINT8     OpCode;
-  UINT32    Index;
+  UINT8   OpCode;
+  UINT32  Index;
 
   if (Buffer == NULL) {
     ASSERT (0);
@@ -391,16 +398,19 @@ AmlGetFieldEncoding (
   // Search in the table.
   for (Index = 0;
        Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
-       Index++) {
+       Index++)
+  {
     if (mAmlFieldEncoding[Index].OpCode == OpCode) {
       if ((mAmlFieldEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) ==
-             AML_IS_PSEUDO_OPCODE) {
+          AML_IS_PSEUDO_OPCODE)
+      {
         // A pseudo OpCode cannot be parsed as it is internal to this library.
         // The NamedField encoding can be detected because it begins with a
         // char.
         ASSERT (0);
         return NULL;
       }
+
       return &mAmlFieldEncoding[Index];
     }
   }
@@ -422,26 +432,30 @@ CONST
 AML_BYTE_ENCODING *
 EFIAPI
 AmlGetFieldEncodingByOpCode (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   )
 {
-  UINT32    Index;
+  UINT32  Index;
 
   // Search the table.
   for (Index = 0;
        Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
-       Index++) {
+       Index++)
+  {
     if ((mAmlFieldEncoding[Index].OpCode == OpCode) &&
-        (mAmlFieldEncoding[Index].SubOpCode == SubOpCode)) {
+        (mAmlFieldEncoding[Index].SubOpCode == SubOpCode))
+    {
       return &mAmlFieldEncoding[Index];
     }
   }
+
   return NULL;
 }
 
 // Enable this function for debug.
 #if !defined (MDEPKG_NDEBUG)
+
 /** Look for an OpCode/SubOpCode couple in the AML grammar,
     and return a corresponding string.
 
@@ -454,8 +468,8 @@ AmlGetFieldEncodingByOpCode (
 CONST
 CHAR8 *
 AmlGetOpCodeStr (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   )
 {
   EAML_PARSE_INDEX  Index;
@@ -463,9 +477,11 @@ AmlGetOpCodeStr (
   // Search the table.
   for (Index = 0;
        Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
-       Index++) {
+       Index++)
+  {
     if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
-        (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
+        (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
+    {
       return mAmlByteEncoding[Index].Str;
     }
   }
@@ -486,8 +502,8 @@ AmlGetOpCodeStr (
 CONST
 CHAR8 *
 AmlGetFieldOpCodeStr (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   )
 {
   EAML_PARSE_INDEX  Index;
@@ -500,7 +516,8 @@ AmlGetFieldOpCodeStr (
   // Search the table.
   for (Index = 0;
        Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
-       Index++) {
+       Index++)
+  {
     if ((mAmlFieldEncoding[Index].OpCode == OpCode)) {
       return mAmlFieldEncoding[Index].Str;
     }
@@ -509,6 +526,7 @@ AmlGetFieldOpCodeStr (
   ASSERT (0);
   return NULL;
 }
+
 #endif // MDEPKG_NDEBUG
 
 /** Check whether the OpCode/SubOpcode couple is a valid entry
@@ -523,8 +541,8 @@ AmlGetFieldOpCodeStr (
 BOOLEAN
 EFIAPI
 AmlIsOpCodeValid (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   )
 {
   EAML_PARSE_INDEX  Index;
@@ -532,12 +550,15 @@ AmlIsOpCodeValid (
   // Search the table.
   for (Index = 0;
        Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
-       Index++) {
+       Index++)
+  {
     if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
-        (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
+        (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
+    {
       return TRUE;
     }
   }
+
   return FALSE;
 }
 
@@ -551,7 +572,7 @@ AmlIsOpCodeValid (
 GLOBAL_REMOVE_IF_UNREFERENCED
 STATIC
 CONST
-EAML_NODE_DATA_TYPE mAmlTypeToNodeDataType[] = {
+EAML_NODE_DATA_TYPE  mAmlTypeToNodeDataType[] = {
   EAmlNodeDataTypeNone,         // EAmlNone
   EAmlNodeDataTypeUInt,         // EAmlUInt8
   EAmlNodeDataTypeUInt,         // EAmlUInt16
@@ -577,7 +598,8 @@ AmlTypeToNodeDataType (
   )
 {
   if (AmlType >=
-      (sizeof (mAmlTypeToNodeDataType) / sizeof (mAmlTypeToNodeDataType[0]))) {
+      (sizeof (mAmlTypeToNodeDataType) / sizeof (mAmlTypeToNodeDataType[0])))
+  {
     ASSERT (0);
     return EAmlNodeDataTypeNone;
   }
@@ -597,17 +619,18 @@ AmlTypeToNodeDataType (
 UINT32
 EFIAPI
 AmlGetPkgLength (
-  IN  CONST UINT8   * Buffer,
-  OUT       UINT32  * PkgLength
+  IN  CONST UINT8   *Buffer,
+  OUT       UINT32  *PkgLength
   )
 {
-  UINT8     LeadByte;
-  UINT8     ByteCount;
-  UINT32    RealLength;
-  UINT32    Offset;
+  UINT8   LeadByte;
+  UINT8   ByteCount;
+  UINT32  RealLength;
+  UINT32  Offset;
 
   if ((Buffer == NULL)  ||
-      (PkgLength == NULL)) {
+      (PkgLength == NULL))
+  {
     ASSERT (0);
     return 0;
   }
@@ -641,9 +664,9 @@ AmlGetPkgLength (
     package length is 2**28.
   */
 
-  LeadByte = *Buffer;
-  ByteCount = (LeadByte >> 6) & 0x03U;
-  Offset = ByteCount + 1U;
+  LeadByte   = *Buffer;
+  ByteCount  = (LeadByte >> 6) & 0x03U;
+  Offset     = ByteCount + 1U;
   RealLength = 0;
 
   // Switch on the number of bytes used to store the PkgLen.
@@ -661,17 +684,17 @@ AmlGetPkgLength (
     }
     case 2:
     {
-      RealLength = *(Buffer + 1);
+      RealLength  = *(Buffer + 1);
       RealLength |= ((UINT32)(*(Buffer + 2))) << 8;
-      RealLength = (RealLength << 4) | (LeadByte & 0xF);
+      RealLength  = (RealLength << 4) | (LeadByte & 0xF);
       break;
     }
     case 3:
     {
-      RealLength = *(Buffer + 1);
+      RealLength  = *(Buffer + 1);
       RealLength |= ((UINT32)(*(Buffer + 2))) << 8;
       RealLength |= ((UINT32)(*(Buffer + 3))) << 16;
-      RealLength = (RealLength << 4) | (LeadByte & 0xF);
+      RealLength  = (RealLength << 4) | (LeadByte & 0xF);
       break;
     }
     default:
@@ -699,8 +722,8 @@ AmlGetPkgLength (
 UINT8
 EFIAPI
 AmlSetPkgLength (
-  IN  UINT32    Length,
-  OUT UINT8   * Buffer
+  IN  UINT32  Length,
+  OUT UINT8   *Buffer
   )
 {
   UINT8   LeadByte;
@@ -715,12 +738,11 @@ AmlSetPkgLength (
   }
 
   LeadByte = 0;
-  Offset = 0;
+  Offset   = 0;
 
   if ((Length < (1 << 6))) {
     // Length < 2^6, only need one byte to encode it.
     LeadByte = (UINT8)Length;
-
   } else {
     // Need more than one byte to encode it.
     // Test Length to find how many bytes are needed.
@@ -729,19 +751,15 @@ AmlSetPkgLength (
       // Length >= 2^28, should not be possible.
       ASSERT (0);
       return 0;
-
     } else if (Length >= (1 << 20)) {
       // Length >= 2^20
       Offset = 3;
-
     } else if (Length >= (1 << 12)) {
       // Length >= 2^12
       Offset = 2;
-
     } else if (Length >= (1 << 6)) {
       // Length >= 2^6
       Offset = 1;
-
     } else {
       // Should not be possible.
       ASSERT (0);
@@ -754,13 +772,13 @@ AmlSetPkgLength (
   }
 
   // Write to the Buffer.
-  *Buffer = LeadByte;
+  *Buffer       = LeadByte;
   CurrentOffset = 1;
   while (CurrentOffset < (Offset + 1)) {
-    CurrentShift = (UINT8)((CurrentOffset - 1) * 8);
-    ComputedLength = Length & (UINT32)(0x00000FF0 << CurrentShift);
-    ComputedLength = (ComputedLength) >> (4 + CurrentShift);
-    LeadByte = (UINT8)(ComputedLength & 0xFF);
+    CurrentShift              = (UINT8)((CurrentOffset - 1) * 8);
+    ComputedLength            = Length & (UINT32)(0x00000FF0 << CurrentShift);
+    ComputedLength            = (ComputedLength) >> (4 + CurrentShift);
+    LeadByte                  = (UINT8)(ComputedLength & 0xFF);
     *(Buffer + CurrentOffset) = LeadByte;
     CurrentOffset++;
   }
@@ -786,15 +804,12 @@ AmlComputePkgLengthWidth (
   if (Length >= (1 << 28)) {
     ASSERT (0);
     return 0;
-
   } else if (Length >= (1 << 20)) {
     // Length >= 2^20
     return 4;
-
   } else if (Length >= (1 << 12)) {
     // Length >= 2^12
     return 3;
-
   } else if (Length >= (1 << 6)) {
     // Length >= 2^6
     return 2;
@@ -845,8 +860,8 @@ AmlComputePkgLengthWidth (
 EFI_STATUS
 EFIAPI
 AmlComputePkgLength (
-  IN  UINT32    Length,
-  OUT UINT32  * PkgLen
+  IN  UINT32  Length,
+  OUT UINT32  *PkgLen
   )
 {
   UINT32  PkgLenWidth;
@@ -874,7 +889,8 @@ AmlComputePkgLength (
   ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length);
   if (ReComputedPkgLenWidth != PkgLenWidth) {
     if ((ReComputedPkgLenWidth != 0)   &&
-        (ReComputedPkgLenWidth < 4)) {
+        (ReComputedPkgLenWidth < 4))
+    {
       // No need to recompute the PkgLen since a new threshold cannot
       // be reached by incrementing the value by one.
       Length += 1;

+ 41 - 40
DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.h

@@ -15,9 +15,9 @@
 #include <IndustryStandard/AcpiAml.h>
 
 #if !defined (MDEPKG_NDEBUG)
-#define AML_OPCODE_DEF(str, OpCode) str, OpCode
+#define AML_OPCODE_DEF(str, OpCode)  str, OpCode
 #else
-#define AML_OPCODE_DEF(str, OpCode) OpCode
+#define AML_OPCODE_DEF(str, OpCode)  OpCode
 #endif // MDEPKG_NDEBUG
 
 /** AML types.
@@ -31,7 +31,7 @@
   These are internal types.
 */
 typedef enum EAmlParseFormat {
-  EAmlNone   = 0,     ///< No data expected.
+  EAmlNone = 0,       ///< No data expected.
   EAmlUInt8,          ///< One byte value evaluated as a UINT8.
   EAmlUInt16,         ///< Two byte value evaluated as a UINT16.
   EAmlUInt32,         ///< Four byte value evaluated as a UINT32.
@@ -61,46 +61,46 @@ typedef UINT32 AML_OP_ATTRIBUTE;
 /** A PkgLength is expected between the OpCode/SubOpCode couple and the first
     fixed argument of the object.
 */
-#define AML_HAS_PKG_LENGTH      0x00001U
+#define AML_HAS_PKG_LENGTH  0x00001U
 
 /** The object's OpCode is actually a character. Encodings with this attribute
     don't describe objects. The dual/multi name prefix have this attribute,
     indicating the start of a longer NameString.
 */
-#define AML_IS_NAME_CHAR        0x00002U
+#define AML_IS_NAME_CHAR  0x00002U
 
 /** A variable list of arguments is following the last fixed argument. Each
     argument is evaluated as an EAmlObject.
 */
-#define AML_HAS_CHILD_OBJ       0x00004U
+#define AML_HAS_CHILD_OBJ  0x00004U
 
 /** This is a sub-type of a variable list of arguments. It can only be
     found in buffer objects. A ByteList is either a list of
     bytes or a list of resource data elements. Resource data elements
     have specific opcodes.
 */
-#define AML_HAS_BYTE_LIST       0x00008U
+#define AML_HAS_BYTE_LIST  0x00008U
 
 /** This is a sub-type of a variable list of arguments. It can only be
     found in Fields, IndexFields and BankFields.
     A FieldList is made of FieldElements. FieldElements have specific opcodes.
 */
-#define AML_HAS_FIELD_LIST      0x00010U
+#define AML_HAS_FIELD_LIST  0x00010U
 
 /** This object node is a field element. Its opcode is to be fetched from
     the field encoding table.
 */
-#define AML_IS_FIELD_ELEMENT    0x00020U
+#define AML_IS_FIELD_ELEMENT  0x00020U
 
 /** The object has a name and which is part of the AML namespace. The name
     can be found in the fixed argument list at the NameIndex.
 */
-#define AML_IN_NAMESPACE        0x10000U
+#define AML_IN_NAMESPACE  0x10000U
 
 /** Some OpCodes have been created in this library. They are called
     pseudo opcodes and must stay internal to this library.
 */
-#define AML_IS_PSEUDO_OPCODE    0x20000U
+#define AML_IS_PSEUDO_OPCODE  0x20000U
 
 /** Encoding of an AML object.
 
@@ -112,37 +112,37 @@ typedef UINT32 AML_OP_ATTRIBUTE;
   Cf. ACPI 6.3 specification, s20.2.
 */
 typedef struct _AML_BYTE_ENCODING {
-// Enable this field for debug.
-#if !defined (MDEPKG_NDEBUG)
+  // Enable this field for debug.
+ #if !defined (MDEPKG_NDEBUG)
   /// String field allowing to print the AML object.
-  CONST CHAR8         * Str;
-#endif // MDEPKG_NDEBUG
+  CONST CHAR8         *Str;
+ #endif // MDEPKG_NDEBUG
 
   /// OpCode of the AML object.
-  UINT8                 OpCode;
+  UINT8               OpCode;
 
   /// SubOpCode of the AML object.
   /// The SubOpcode field has a valid value when the OpCode is 0x5B,
   /// otherwise this field must be zero.
   /// For field objects, the SubOpCode is not used.
-  UINT8                 SubOpCode;
+  UINT8               SubOpCode;
 
   /// Number of fixed arguments for the AML statement represented
   /// by the OpCode & SubOpcode.
   /// Maximum is 6 for AML objects.
   /// Maximum is 3 for field objects.
-  EAML_PARSE_INDEX      MaxIndex;
+  EAML_PARSE_INDEX    MaxIndex;
 
   /// If the encoding has the AML_IN_NAMESPACE attribute (cf Attribute
   /// field below), indicate where to find the name in the fixed list
   /// of arguments.
-  EAML_PARSE_INDEX      NameIndex;
+  EAML_PARSE_INDEX    NameIndex;
 
   /// Type of each fixed argument.
-  AML_PARSE_FORMAT      Format[EAmlParseIndexMax];
+  AML_PARSE_FORMAT    Format[EAmlParseIndexMax];
 
   /// Additional information on the AML object.
-  AML_OP_ATTRIBUTE      Attribute;
+  AML_OP_ATTRIBUTE    Attribute;
 } AML_BYTE_ENCODING;
 
 /** Get the AML_BYTE_ENCODING entry in the AML encoding table.
@@ -160,7 +160,7 @@ CONST
 AML_BYTE_ENCODING *
 EFIAPI
 AmlGetByteEncoding (
-  IN  CONST UINT8   * Buffer
+  IN  CONST UINT8  *Buffer
   );
 
 /** Get the AML_BYTE_ENCODING entry in the AML encoding table
@@ -176,8 +176,8 @@ CONST
 AML_BYTE_ENCODING *
 EFIAPI
 AmlGetByteEncodingByOpCode (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   );
 
 /** Get the AML_BYTE_ENCODING entry in the field encoding table.
@@ -195,7 +195,7 @@ CONST
 AML_BYTE_ENCODING *
 EFIAPI
 AmlGetFieldEncoding (
-  IN  CONST UINT8   * Buffer
+  IN  CONST UINT8  *Buffer
   );
 
 /** Get the AML_BYTE_ENCODING entry in the field encoding table
@@ -212,12 +212,13 @@ CONST
 AML_BYTE_ENCODING *
 EFIAPI
 AmlGetFieldEncodingByOpCode (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   );
 
 // Enable this function for debug.
 #if !defined (MDEPKG_NDEBUG)
+
 /** Look for an OpCode/SubOpCode couple in the AML grammar,
     and return a corresponding string.
 
@@ -230,8 +231,8 @@ AmlGetFieldEncodingByOpCode (
 CONST
 CHAR8 *
 AmlGetOpCodeStr (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   );
 
 /** Look for an OpCode/SubOpCode couple in the AML field element grammar,
@@ -246,9 +247,10 @@ AmlGetOpCodeStr (
 CONST
 CHAR8 *
 AmlGetFieldOpCodeStr (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   );
+
 #endif // MDEPKG_NDEBUG
 
 /** Check whether the OpCode/SubOpcode couple is a valid entry
@@ -263,8 +265,8 @@ AmlGetFieldOpCodeStr (
 BOOLEAN
 EFIAPI
 AmlIsOpCodeValid (
-  IN  UINT8   OpCode,
-  IN  UINT8   SubOpCode
+  IN  UINT8  OpCode,
+  IN  UINT8  SubOpCode
   );
 
 /** Convert an AML_PARSE_FORMAT to its corresponding EAML_NODE_DATA_TYPE.
@@ -292,8 +294,8 @@ AmlTypeToNodeDataType (
 UINT32
 EFIAPI
 AmlGetPkgLength (
-  IN  CONST UINT8   * Buffer,
-  OUT       UINT32  * PkgLength
+  IN  CONST UINT8   *Buffer,
+  OUT       UINT32  *PkgLength
   );
 
 /** Convert the Length to the AML PkgLen encoding,
@@ -308,8 +310,8 @@ AmlGetPkgLength (
 UINT8
 EFIAPI
 AmlSetPkgLength (
-  IN  UINT32    Length,
-  OUT UINT8   * Buffer
+  IN  UINT32  Length,
+  OUT UINT8   *Buffer
   );
 
 /** Compute the number of bytes required to write a package length.
@@ -367,9 +369,8 @@ AmlComputePkgLengthWidth (
 EFI_STATUS
 EFIAPI
 AmlComputePkgLength (
-  IN  UINT32    Length,
-  OUT UINT32  * PkgLen
+  IN  UINT32  Length,
+  OUT UINT32  *PkgLen
   );
 
 #endif // AML_H_
-

+ 12 - 12
DynamicTablesPkg/Library/Common/AmlLib/AmlNodeDefines.h

@@ -22,7 +22,7 @@ typedef struct AmlNodeHeader {
   LIST_ENTRY              Link;
 
   /// Parent of this node. NULL for the root node.
-  struct AmlNodeHeader  * Parent;
+  struct AmlNodeHeader    *Parent;
 
   /// Node type allowing to identify a root/object/data node.
   EAML_NODE_TYPE          NodeType;
@@ -30,7 +30,7 @@ typedef struct AmlNodeHeader {
 
 /** Node handle.
 */
-typedef AML_NODE_HEADER* AML_NODE_HANDLE;
+typedef AML_NODE_HEADER *AML_NODE_HANDLE;
 
 /** AML root node.
 
@@ -47,12 +47,12 @@ typedef struct AmlRootNode {
   LIST_ENTRY                     VariableArgs;
 
   /// ACPI DSDT/SSDT header.
-  EFI_ACPI_DESCRIPTION_HEADER  * SdtHeader;
+  EFI_ACPI_DESCRIPTION_HEADER    *SdtHeader;
 } AML_ROOT_NODE;
 
 /** Root Node handle.
 */
-typedef AML_ROOT_NODE* AML_ROOT_NODE_HANDLE;
+typedef AML_ROOT_NODE *AML_ROOT_NODE_HANDLE;
 
 /** AML object node.
 
@@ -71,11 +71,11 @@ typedef struct AmlObjectNode {
   /// Fixed arguments of this object node.
   /// These are children and can be object/data nodes.
   /// Cf ACPI specification, s20.3.
-  AML_NODE_HEADER          * FixedArgs[EAmlParseIndexMax];
+  AML_NODE_HEADER            *FixedArgs[EAmlParseIndexMax];
 
   /// AML byte encoding. Stores the encoding information:
   /// (OpCode/SubOpCode/number of fixed arguments/ attributes).
-  CONST AML_BYTE_ENCODING  * AmlByteEncoding;
+  CONST AML_BYTE_ENCODING    *AmlByteEncoding;
 
   /// Some nodes have a PkgLen following their OpCode/SubOpCode in the
   /// AML bytestream. This field stores the decoded value of the PkgLen.
@@ -84,7 +84,7 @@ typedef struct AmlObjectNode {
 
 /** Object Node handle.
 */
-typedef AML_OBJECT_NODE* AML_OBJECT_NODE_HANDLE;
+typedef AML_OBJECT_NODE *AML_OBJECT_NODE_HANDLE;
 
 /** AML data node.
 
@@ -94,22 +94,22 @@ typedef AML_OBJECT_NODE* AML_OBJECT_NODE_HANDLE;
 */
 typedef struct AmlDataNode {
   /// Header information. Must be the first field of the struct.
-  AML_NODE_HEADER       NodeHeader;
+  AML_NODE_HEADER        NodeHeader;
 
   /// Tag identifying what data is stored in this node.
   /// E.g. UINT, NULL terminated string, resource data element, etc.
-  EAML_NODE_DATA_TYPE   DataType;
+  EAML_NODE_DATA_TYPE    DataType;
 
   /// Buffer containing the data stored by this node.
-  UINT8               * Buffer;
+  UINT8                  *Buffer;
 
   /// Size of the Buffer.
-  UINT32                Size;
+  UINT32                 Size;
 } AML_DATA_NODE;
 
 /** Data Node handle.
 */
-typedef AML_DATA_NODE* AML_DATA_NODE_HANDLE;
+typedef AML_DATA_NODE *AML_DATA_NODE_HANDLE;
 
 /** Check whether a Node has a valid NodeType.
 

+ 49 - 34
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c

@@ -39,21 +39,22 @@
 EFI_STATUS
 EFIAPI
 AmlDeviceOpUpdateName (
-  IN  AML_OBJECT_NODE_HANDLE    DeviceOpNode,
-  IN  CHAR8                   * NewNameString
+  IN  AML_OBJECT_NODE_HANDLE  DeviceOpNode,
+  IN  CHAR8                   *NewNameString
   )
 {
-  EFI_STATUS              Status;
+  EFI_STATUS  Status;
 
-  AML_DATA_NODE_HANDLE    DeviceNameDataNode;
-  CHAR8                 * NewAmlNameString;
-  UINT32                  NewAmlNameStringSize;
+  AML_DATA_NODE_HANDLE  DeviceNameDataNode;
+  CHAR8                 *NewAmlNameString;
+  UINT32                NewAmlNameStringSize;
 
   // Check the input node is an object node.
   if ((DeviceOpNode == NULL)                                              ||
       (AmlGetNodeType ((AML_NODE_HANDLE)DeviceOpNode) != EAmlNodeObject)  ||
       (!AmlNodeHasOpCode (DeviceOpNode, AML_EXT_OP, AML_EXT_DEVICE_OP))   ||
-      (NewNameString == NULL)) {
+      (NewNameString == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -66,7 +67,8 @@ AmlDeviceOpUpdateName (
                                                );
   if ((DeviceNameDataNode == NULL)                                            ||
       (AmlGetNodeType ((AML_NODE_HANDLE)DeviceNameDataNode) != EAmlNodeData)  ||
-      (!AmlNodeHasDataType (DeviceNameDataNode, EAmlNodeDataTypeNameString))) {
+      (!AmlNodeHasDataType (DeviceNameDataNode, EAmlNodeDataTypeNameString)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -87,7 +89,7 @@ AmlDeviceOpUpdateName (
   Status = AmlUpdateDataNode (
              DeviceNameDataNode,
              EAmlNodeDataTypeNameString,
-             (UINT8*)NewAmlNameString,
+             (UINT8 *)NewAmlNameString,
              NewAmlNameStringSize
              );
   ASSERT_EFI_ERROR (Status);
@@ -124,7 +126,8 @@ AmlNameOpUpdateInteger (
 
   if ((NameOpNode == NULL)                                             ||
       (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
-      (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
+      (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -138,7 +141,8 @@ AmlNameOpUpdateInteger (
                                             EAmlParseIndexTerm1
                                             );
   if ((IntegerOpNode == NULL)  ||
-      (AmlGetNodeType ((AML_NODE_HANDLE)IntegerOpNode) != EAmlNodeObject)) {
+      (AmlGetNodeType ((AML_NODE_HANDLE)IntegerOpNode) != EAmlNodeObject))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -170,8 +174,8 @@ AmlNameOpUpdateInteger (
 EFI_STATUS
 EFIAPI
 AmlNameOpUpdateString (
-  IN        AML_OBJECT_NODE_HANDLE    NameOpNode,
-  IN  CONST CHAR8                   * NewName
+  IN        AML_OBJECT_NODE_HANDLE  NameOpNode,
+  IN  CONST CHAR8                   *NewName
   )
 {
   EFI_STATUS              Status;
@@ -180,7 +184,8 @@ AmlNameOpUpdateString (
 
   if ((NameOpNode == NULL)                                             ||
       (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
-      (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
+      (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -193,7 +198,8 @@ AmlNameOpUpdateString (
                                            EAmlParseIndexTerm1
                                            );
   if ((StringOpNode == NULL)  ||
-      (AmlGetNodeType ((AML_NODE_HANDLE)StringOpNode) != EAmlNodeObject)) {
+      (AmlGetNodeType ((AML_NODE_HANDLE)StringOpNode) != EAmlNodeObject))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -205,7 +211,8 @@ AmlNameOpUpdateString (
                                            EAmlParseIndexTerm0
                                            );
   if ((StringDataNode == NULL)  ||
-      (AmlGetNodeType ((AML_NODE_HANDLE)StringDataNode) != EAmlNodeData)) {
+      (AmlGetNodeType ((AML_NODE_HANDLE)StringDataNode) != EAmlNodeData))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -214,7 +221,7 @@ AmlNameOpUpdateString (
   Status = AmlUpdateDataNode (
              StringDataNode,
              EAmlNodeDataTypeString,
-             (UINT8*)NewName,
+             (UINT8 *)NewName,
              (UINT32)AsciiStrLen (NewName) + 1
              );
   ASSERT_EFI_ERROR (Status);
@@ -250,8 +257,8 @@ AmlNameOpUpdateString (
 EFI_STATUS
 EFIAPI
 AmlNameOpGetFirstRdNode (
-  IN  AML_OBJECT_NODE_HANDLE   NameOpNode,
-  OUT AML_DATA_NODE_HANDLE   * OutRdNode
+  IN  AML_OBJECT_NODE_HANDLE  NameOpNode,
+  OUT AML_DATA_NODE_HANDLE    *OutRdNode
   )
 {
   AML_OBJECT_NODE_HANDLE  BufferOpNode;
@@ -260,7 +267,8 @@ AmlNameOpGetFirstRdNode (
   if ((NameOpNode == NULL)                                              ||
       (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject)  ||
       (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))                  ||
-      (OutRdNode == NULL)) {
+      (OutRdNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -275,7 +283,8 @@ AmlNameOpGetFirstRdNode (
                                            );
   if ((BufferOpNode == NULL)                                             ||
       (AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
-      (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
+      (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -288,7 +297,8 @@ AmlNameOpGetFirstRdNode (
                                         );
   if ((FirstRdNode == NULL)                                            ||
       (AmlGetNodeType ((AML_NODE_HANDLE)FirstRdNode) != EAmlNodeData)  ||
-      (!AmlNodeHasDataType (FirstRdNode, EAmlNodeDataTypeResourceData))) {
+      (!AmlNodeHasDataType (FirstRdNode, EAmlNodeDataTypeResourceData)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -327,17 +337,18 @@ AmlNameOpGetFirstRdNode (
 EFI_STATUS
 EFIAPI
 AmlNameOpGetNextRdNode (
-  IN  AML_DATA_NODE_HANDLE    CurrRdNode,
-  OUT AML_DATA_NODE_HANDLE  * OutRdNode
+  IN  AML_DATA_NODE_HANDLE  CurrRdNode,
+  OUT AML_DATA_NODE_HANDLE  *OutRdNode
   )
 {
-  AML_OBJECT_NODE_HANDLE     NameOpNode;
-  AML_OBJECT_NODE_HANDLE     BufferOpNode;
+  AML_OBJECT_NODE_HANDLE  NameOpNode;
+  AML_OBJECT_NODE_HANDLE  BufferOpNode;
 
   if ((CurrRdNode == NULL)                                              ||
       (AmlGetNodeType ((AML_NODE_HANDLE)CurrRdNode) != EAmlNodeData)    ||
       (!AmlNodeHasDataType (CurrRdNode, EAmlNodeDataTypeResourceData))  ||
-      (OutRdNode == NULL)) {
+      (OutRdNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -349,7 +360,8 @@ AmlNameOpGetNextRdNode (
                                            (AML_NODE_HANDLE)CurrRdNode
                                            );
   if ((BufferOpNode == NULL)  ||
-      (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
+      (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -359,7 +371,8 @@ AmlNameOpGetNextRdNode (
                                          (AML_NODE_HANDLE)BufferOpNode
                                          );
   if ((NameOpNode == NULL)  ||
-      (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
+      (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -372,7 +385,9 @@ AmlNameOpGetNextRdNode (
   // If the Resource Data is an End Tag, return NULL.
   if (AmlNodeHasRdDataType (
         *OutRdNode,
-        AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+        AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+        ))
+  {
     *OutRdNode = NULL;
   }
 
@@ -415,8 +430,8 @@ AmlNameOpGetNextRdNode (
 EFI_STATUS
 EFIAPI
 AmlNameOpCrsGetFirstRdNode (
-  IN  AML_OBJECT_NODE_HANDLE   NameOpCrsNode,
-  OUT AML_DATA_NODE_HANDLE   * OutRdNode
+  IN  AML_OBJECT_NODE_HANDLE  NameOpCrsNode,
+  OUT AML_DATA_NODE_HANDLE    *OutRdNode
   )
 {
   return AmlNameOpGetFirstRdNode (NameOpCrsNode, OutRdNode);
@@ -455,8 +470,8 @@ AmlNameOpCrsGetFirstRdNode (
 EFI_STATUS
 EFIAPI
 AmlNameOpCrsGetNextRdNode (
-  IN  AML_DATA_NODE_HANDLE    CurrRdNode,
-  OUT AML_DATA_NODE_HANDLE  * OutRdNode
+  IN  AML_DATA_NODE_HANDLE  CurrRdNode,
+  OUT AML_DATA_NODE_HANDLE  *OutRdNode
   )
 {
   return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode);

+ 28 - 25
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.c

@@ -44,22 +44,23 @@
 BOOLEAN
 EFIAPI
 AmlNameOpCompareName (
-  IN  AML_OBJECT_NODE_HANDLE    NameOpNode,
-  IN  CHAR8                   * AslName
+  IN  AML_OBJECT_NODE_HANDLE  NameOpNode,
+  IN  CHAR8                   *AslName
   )
 {
-  EFI_STATUS              Status;
-  AML_DATA_NODE_HANDLE    NameDataNode;
+  EFI_STATUS            Status;
+  AML_DATA_NODE_HANDLE  NameDataNode;
 
-  CHAR8                 * AmlName;
-  UINT32                  AmlNameSize;
+  CHAR8   *AmlName;
+  UINT32  AmlNameSize;
 
-  BOOLEAN                 RetVal;
+  BOOLEAN  RetVal;
 
   if ((NameOpNode == NULL)                                                ||
       (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject)    ||
       (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))                    ||
-      (AslName == NULL)) {
+      (AslName == NULL))
+  {
     ASSERT (0);
     return FALSE;
   }
@@ -72,7 +73,8 @@ AmlNameOpCompareName (
                                          );
   if ((NameDataNode == NULL)                                            ||
       (AmlGetNodeType ((AML_NODE_HANDLE)NameDataNode) != EAmlNodeData)  ||
-      (!AmlNodeHasDataType (NameDataNode, EAmlNodeDataTypeNameString))) {
+      (!AmlNodeHasDataType (NameDataNode, EAmlNodeDataTypeNameString)))
+  {
     ASSERT (0);
     return FALSE;
   }
@@ -92,7 +94,7 @@ AmlNameOpCompareName (
   }
 
   // Fetch the name.
-  Status = AmlGetDataNodeBuffer (NameDataNode, (UINT8*)AmlName, &AmlNameSize);
+  Status = AmlGetDataNodeBuffer (NameDataNode, (UINT8 *)AmlName, &AmlNameSize);
   if (EFI_ERROR (Status)) {
     FreePool (AmlName);
     ASSERT (0);
@@ -120,14 +122,14 @@ AmlNameOpCompareName (
 BOOLEAN
 EFIAPI
 AmlNodeHasOpCode (
-  IN  AML_OBJECT_NODE_HANDLE    ObjectNode,
-  IN  UINT8                     OpCode,
-  IN  UINT8                     SubOpCode
+  IN  AML_OBJECT_NODE_HANDLE  ObjectNode,
+  IN  UINT8                   OpCode,
+  IN  UINT8                   SubOpCode
   )
 {
-  EFI_STATUS    Status;
-  UINT8         NodeOpCode;
-  UINT8         NodeSubOpCode;
+  EFI_STATUS  Status;
+  UINT8       NodeOpCode;
+  UINT8       NodeSubOpCode;
 
   // Get the Node information.
   Status = AmlGetObjectNodeInfo (
@@ -144,7 +146,8 @@ AmlNodeHasOpCode (
 
   // Check the OpCode and SubOpCode.
   if ((OpCode != NodeOpCode)  ||
-      (SubOpCode != NodeSubOpCode)) {
+      (SubOpCode != NodeSubOpCode))
+  {
     return FALSE;
   }
 
@@ -163,12 +166,12 @@ AmlNodeHasOpCode (
 BOOLEAN
 EFIAPI
 AmlNodeHasDataType (
-  IN  AML_DATA_NODE_HANDLE    DataNode,
-  IN  EAML_NODE_DATA_TYPE     DataType
+  IN  AML_DATA_NODE_HANDLE  DataNode,
+  IN  EAML_NODE_DATA_TYPE   DataType
   )
 {
-  EFI_STATUS            Status;
-  EAML_NODE_DATA_TYPE   NodeDataType;
+  EFI_STATUS           Status;
+  EAML_NODE_DATA_TYPE  NodeDataType;
 
   // Get the data type.
   Status = AmlGetNodeDataType (DataNode, &NodeDataType);
@@ -197,12 +200,12 @@ AmlNodeHasDataType (
 BOOLEAN
 EFIAPI
 AmlNodeHasRdDataType (
-  IN  AML_DATA_NODE_HANDLE    RdNode,
-  IN  AML_RD_HEADER           RdDataType
+  IN  AML_DATA_NODE_HANDLE  RdNode,
+  IN  AML_RD_HEADER         RdDataType
   )
 {
-  EFI_STATUS      Status;
-  AML_RD_HEADER   NodeRdDataType;
+  EFI_STATUS     Status;
+  AML_RD_HEADER  NodeRdDataType;
 
   // Get the resource data type.
   Status = AmlGetResourceDataType (

+ 9 - 9
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.h

@@ -36,8 +36,8 @@
 BOOLEAN
 EFIAPI
 AmlNameOpCompareName (
-  IN  AML_OBJECT_NODE_HANDLE    NameOpNode,
-  IN  CHAR8                   * AslName
+  IN  AML_OBJECT_NODE_HANDLE  NameOpNode,
+  IN  CHAR8                   *AslName
   );
 
 /** Check whether ObjectNode has the input OpCode/SubOpcode couple.
@@ -53,9 +53,9 @@ AmlNameOpCompareName (
 BOOLEAN
 EFIAPI
 AmlNodeHasOpCode (
-  IN  AML_OBJECT_NODE_HANDLE    ObjectNode,
-  IN  UINT8                     OpCode,
-  IN  UINT8                     SubOpCode
+  IN  AML_OBJECT_NODE_HANDLE  ObjectNode,
+  IN  UINT8                   OpCode,
+  IN  UINT8                   SubOpCode
   );
 
 /** Check whether DataNode has the input DataType.
@@ -70,8 +70,8 @@ AmlNodeHasOpCode (
 BOOLEAN
 EFIAPI
 AmlNodeHasDataType (
-  IN  AML_DATA_NODE_HANDLE    DataNode,
-  IN  EAML_NODE_DATA_TYPE     DataType
+  IN  AML_DATA_NODE_HANDLE  DataNode,
+  IN  EAML_NODE_DATA_TYPE   DataType
   );
 
 /** Check whether RdNode has the input RdDataType.
@@ -86,8 +86,8 @@ AmlNodeHasDataType (
 BOOLEAN
 EFIAPI
 AmlNodeHasRdDataType (
-  IN  AML_DATA_NODE_HANDLE    RdNode,
-  IN  AML_RD_HEADER           RdDataType
+  IN  AML_DATA_NODE_HANDLE  RdNode,
+  IN  AML_RD_HEADER         RdDataType
   );
 
 #endif // AML_HELPER_H_

+ 49 - 36
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlResourceDataApi.c

@@ -41,24 +41,28 @@
 EFI_STATUS
 EFIAPI
 AmlUpdateRdInterrupt (
-  IN  AML_DATA_NODE_HANDLE    InterruptRdNode,
-  IN  UINT32                  Irq
+  IN  AML_DATA_NODE_HANDLE  InterruptRdNode,
+  IN  UINT32                Irq
   )
 {
-  EFI_STATUS                    Status;
-  UINT32                      * FirstInterrupt;
-  UINT8                       * QueryBuffer;
-  UINT32                        QueryBufferSize;
+  EFI_STATUS  Status;
+  UINT32      *FirstInterrupt;
+  UINT8       *QueryBuffer;
+  UINT32      QueryBufferSize;
 
   if ((InterruptRdNode == NULL)                                           ||
       (AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) ||
       (!AmlNodeHasDataType (
           InterruptRdNode,
-          EAmlNodeDataTypeResourceData))                                  ||
+          EAmlNodeDataTypeResourceData
+          ))                                  ||
       (!AmlNodeHasRdDataType (
           InterruptRdNode,
           AML_RD_BUILD_LARGE_DESC_ID (
-            ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME)))) {
+            ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME
+            )
+          )))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -102,7 +106,7 @@ AmlUpdateRdInterrupt (
 
   // Get the address of the first interrupt field.
   FirstInterrupt =
-    ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)QueryBuffer)->InterruptNumber;
+    ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)QueryBuffer)->InterruptNumber;
 
   *FirstInterrupt = Irq;
 
@@ -121,6 +125,7 @@ error_handler:
   if (QueryBuffer != NULL) {
     FreePool (QueryBuffer);
   }
+
   return Status;
 }
 
@@ -151,40 +156,44 @@ error_handler:
 EFI_STATUS
 EFIAPI
 AmlUpdateRdInterruptEx (
-  IN  AML_DATA_NODE_HANDLE    InterruptRdNode,
-  IN  BOOLEAN                 ResourceConsumer,
-  IN  BOOLEAN                 EdgeTriggered,
-  IN  BOOLEAN                 ActiveLow,
-  IN  BOOLEAN                 Shared,
-  IN  UINT32                * IrqList,
-  IN  UINT8                   IrqCount
+  IN  AML_DATA_NODE_HANDLE  InterruptRdNode,
+  IN  BOOLEAN               ResourceConsumer,
+  IN  BOOLEAN               EdgeTriggered,
+  IN  BOOLEAN               ActiveLow,
+  IN  BOOLEAN               Shared,
+  IN  UINT32                *IrqList,
+  IN  UINT8                 IrqCount
   )
 {
-  EFI_STATUS                                 Status;
+  EFI_STATUS  Status;
 
-  EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR   * RdInterrupt;
-  UINT32                                   * FirstInterrupt;
-  UINT8                                    * UpdateBuffer;
-  UINT16                                     UpdateBufferSize;
+  EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR  *RdInterrupt;
+  UINT32                                  *FirstInterrupt;
+  UINT8                                   *UpdateBuffer;
+  UINT16                                  UpdateBufferSize;
 
   if ((InterruptRdNode == NULL)                                              ||
       (AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData)    ||
       (!AmlNodeHasDataType (
           InterruptRdNode,
-          EAmlNodeDataTypeResourceData))                                     ||
+          EAmlNodeDataTypeResourceData
+          ))                                     ||
       (!AmlNodeHasRdDataType (
           InterruptRdNode,
           AML_RD_BUILD_LARGE_DESC_ID (
-            ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME)))                       ||
+            ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME
+            )
+          ))                       ||
       (IrqList == NULL)                                                      ||
-      (IrqCount == 0)) {
+      (IrqCount == 0))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  UpdateBuffer = NULL;
+  UpdateBuffer     = NULL;
   UpdateBufferSize = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) +
-                       ((IrqCount - 1) * sizeof (UINT32));
+                     ((IrqCount - 1) * sizeof (UINT32));
 
   // Allocate a buffer to update the data.
   UpdateBuffer = AllocatePool (UpdateBufferSize);
@@ -194,9 +203,9 @@ AmlUpdateRdInterruptEx (
   }
 
   // Update the Resource Data information (structure size, interrupt count).
-  RdInterrupt = (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)UpdateBuffer;
+  RdInterrupt                     = (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)UpdateBuffer;
   RdInterrupt->Header.Header.Byte =
-     AML_RD_BUILD_LARGE_DESC_ID (ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME);
+    AML_RD_BUILD_LARGE_DESC_ID (ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME);
   RdInterrupt->Header.Length =
     UpdateBufferSize - sizeof (ACPI_LARGE_RESOURCE_HEADER);
   RdInterrupt->InterruptTableLength = IrqCount;
@@ -207,7 +216,7 @@ AmlUpdateRdInterruptEx (
 
   // Get the address of the first interrupt field.
   FirstInterrupt =
-    ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)UpdateBuffer)->InterruptNumber;
+    ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)UpdateBuffer)->InterruptNumber;
 
   // Copy the input list of interrupts.
   CopyMem (FirstInterrupt, IrqList, (sizeof (UINT32) * IrqCount));
@@ -248,11 +257,11 @@ AmlUpdateRdQWord (
   IN  UINT64                BaseAddressLength
   )
 {
-  EFI_STATUS                                 Status;
-  EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR  * RdQWord;
+  EFI_STATUS                               Status;
+  EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR  *RdQWord;
 
-  UINT8                                    * QueryBuffer;
-  UINT32                                     QueryBufferSize;
+  UINT8   *QueryBuffer;
+  UINT32  QueryBufferSize;
 
   if ((QWordRdNode == NULL)                                             ||
       (AmlGetNodeType ((AML_NODE_HANDLE)QWordRdNode) != EAmlNodeData)   ||
@@ -260,7 +269,10 @@ AmlUpdateRdQWord (
       (!AmlNodeHasRdDataType (
           QWordRdNode,
           AML_RD_BUILD_LARGE_DESC_ID (
-            ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME)))) {
+            ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME
+            )
+          )))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -294,12 +306,12 @@ AmlUpdateRdQWord (
     goto error_handler;
   }
 
-  RdQWord = (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR*)QueryBuffer;
+  RdQWord = (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR *)QueryBuffer;
 
   // Update the Base Address and Length.
   RdQWord->AddrRangeMin = BaseAddress;
   RdQWord->AddrRangeMax = BaseAddress + BaseAddressLength - 1;
-  RdQWord->AddrLen = BaseAddressLength;
+  RdQWord->AddrLen      = BaseAddressLength;
 
   // Update Base Address Resource Data node.
   Status = AmlUpdateDataNode (
@@ -316,5 +328,6 @@ error_handler:
   if (QueryBuffer != NULL) {
     FreePool (QueryBuffer);
   }
+
   return Status;
 }

File diff suppressed because it is too large
+ 243 - 210
DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c


+ 48 - 43
DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c

@@ -44,14 +44,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 LinkRdNode (
-  IN  AML_DATA_NODE      * RdNode,
-  IN  AML_OBJECT_NODE    * ParentNode,
-  OUT AML_DATA_NODE     ** NewRdNode
+  IN  AML_DATA_NODE    *RdNode,
+  IN  AML_OBJECT_NODE  *ParentNode,
+  OUT AML_DATA_NODE    **NewRdNode
   )
 {
-  EFI_STATUS        Status;
-  EFI_STATUS        Status1;
-  AML_OBJECT_NODE   *BufferOpNode;
+  EFI_STATUS       Status;
+  EFI_STATUS       Status1;
+  AML_OBJECT_NODE  *BufferOpNode;
 
   if (NewRdNode != NULL) {
     *NewRdNode = NULL;
@@ -73,7 +73,8 @@ LinkRdNode (
                                              );
     if ((BufferOpNode == NULL)                                             ||
         (AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
-        (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
+        (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
+    {
       ASSERT (0);
       Status = EFI_INVALID_PARAMETER;
       goto error_handler;
@@ -94,7 +95,7 @@ LinkRdNode (
   return EFI_SUCCESS;
 
 error_handler:
-  Status1 = AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
+  Status1 = AmlDeleteTree ((AML_NODE_HEADER *)RdNode);
   ASSERT_EFI_ERROR (Status1);
   // Return original error.
   return Status;
@@ -146,15 +147,16 @@ AmlCodeGenRdInterrupt (
   OUT AML_DATA_NODE_HANDLE    *NewRdNode  OPTIONAL
   )
 {
-  EFI_STATUS                               Status;
+  EFI_STATUS  Status;
 
-  AML_DATA_NODE                          * RdNode;
-  EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR   RdInterrupt;
-  UINT32                                 * FirstInterrupt;
+  AML_DATA_NODE                           *RdNode;
+  EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR  RdInterrupt;
+  UINT32                                  *FirstInterrupt;
 
   if ((IrqList == NULL) ||
       (IrqCount == 0)   ||
-      ((NameOpNode == NULL) && (NewRdNode == NULL))) {
+      ((NameOpNode == NULL) && (NewRdNode == NULL)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -163,8 +165,8 @@ AmlCodeGenRdInterrupt (
   RdInterrupt.Header.Header.Bits.Name =
     ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME;
   RdInterrupt.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
-  RdInterrupt.Header.Length = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) -
-                                sizeof (ACPI_LARGE_RESOURCE_HEADER);
+  RdInterrupt.Header.Length           = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) -
+                                        sizeof (ACPI_LARGE_RESOURCE_HEADER);
 
   // Body
   RdInterrupt.InterruptVectorFlags = (ResourceConsumer ? BIT0 : 0) |
@@ -181,7 +183,7 @@ AmlCodeGenRdInterrupt (
 
   Status = AmlCreateDataNode (
              EAmlNodeDataTypeResourceData,
-             (UINT8*)&RdInterrupt,
+             (UINT8 *)&RdInterrupt,
              sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR),
              &RdNode
              );
@@ -242,12 +244,13 @@ AmlCodeGenRdRegister (
   OUT AML_DATA_NODE_HANDLE    *NewRdNode  OPTIONAL
   )
 {
-  EFI_STATUS                             Status;
-  AML_DATA_NODE                        * RdNode;
-  EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR   RdRegister;
+  EFI_STATUS                            Status;
+  AML_DATA_NODE                         *RdNode;
+  EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR  RdRegister;
 
   if ((AccessSize > EFI_ACPI_6_4_QWORD)  ||
-      ((NameOpNode == NULL) && (NewRdNode == NULL))) {
+      ((NameOpNode == NULL) && (NewRdNode == NULL)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -256,19 +259,19 @@ AmlCodeGenRdRegister (
   RdRegister.Header.Header.Bits.Name =
     ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME;
   RdRegister.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
-  RdRegister.Header.Length = sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) -
-                               sizeof (ACPI_LARGE_RESOURCE_HEADER);
+  RdRegister.Header.Length           = sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) -
+                                       sizeof (ACPI_LARGE_RESOURCE_HEADER);
 
   // Body
-  RdRegister.AddressSpaceId = AddressSpace;
-  RdRegister.RegisterBitWidth = BitWidth;
+  RdRegister.AddressSpaceId    = AddressSpace;
+  RdRegister.RegisterBitWidth  = BitWidth;
   RdRegister.RegisterBitOffset = BitOffset;
-  RdRegister.AddressSize = AccessSize;
-  RdRegister.RegisterAddress = Address;
+  RdRegister.AddressSize       = AccessSize;
+  RdRegister.RegisterAddress   = Address;
 
   Status = AmlCreateDataNode (
              EAmlNodeDataTypeResourceData,
-             (UINT8*)&RdRegister,
+             (UINT8 *)&RdRegister,
              sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR),
              &RdNode
              );
@@ -318,15 +321,15 @@ AmlCodeGenRdRegister (
 EFI_STATUS
 EFIAPI
 AmlCodeGenEndTag (
-  IN  UINT8               CheckSum    OPTIONAL,
-  IN  AML_OBJECT_NODE   * ParentNode  OPTIONAL,
-  OUT AML_DATA_NODE    ** NewRdNode   OPTIONAL
+  IN  UINT8            CheckSum    OPTIONAL,
+  IN  AML_OBJECT_NODE  *ParentNode  OPTIONAL,
+  OUT AML_DATA_NODE    **NewRdNode   OPTIONAL
   )
 {
-  EFI_STATUS                      Status;
-  AML_DATA_NODE                 * RdNode;
-  EFI_ACPI_END_TAG_DESCRIPTOR     EndTag;
-  ACPI_SMALL_RESOURCE_HEADER      SmallResHdr;
+  EFI_STATUS                   Status;
+  AML_DATA_NODE                *RdNode;
+  EFI_ACPI_END_TAG_DESCRIPTOR  EndTag;
+  ACPI_SMALL_RESOURCE_HEADER   SmallResHdr;
 
   if ((ParentNode == NULL) && (NewRdNode == NULL)) {
     ASSERT (0);
@@ -337,17 +340,17 @@ AmlCodeGenEndTag (
 
   // Header
   SmallResHdr.Bits.Length = sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) -
-                              sizeof (ACPI_SMALL_RESOURCE_HEADER);
+                            sizeof (ACPI_SMALL_RESOURCE_HEADER);
   SmallResHdr.Bits.Name = ACPI_SMALL_END_TAG_DESCRIPTOR_NAME;
   SmallResHdr.Bits.Type = ACPI_SMALL_ITEM_FLAG;
 
   // Body
-  EndTag.Desc = SmallResHdr.Byte;
+  EndTag.Desc     = SmallResHdr.Byte;
   EndTag.Checksum = CheckSum;
 
   Status = AmlCreateDataNode (
              EAmlNodeDataTypeResourceData,
-             (UINT8*)&EndTag,
+             (UINT8 *)&EndTag,
              sizeof (EFI_ACPI_END_TAG_DESCRIPTOR),
              &RdNode
              );
@@ -365,8 +368,9 @@ AmlCodeGenEndTag (
     // This is a hard check: do not allow to add an EndTag if the BufferNode
     // already has resource data elements attached. Indeed, the EndTag should
     // have already been added.
-    if (AmlGetNextVariableArgument ((AML_NODE_HEADER*)ParentNode, NULL) !=
-          NULL) {
+    if (AmlGetNextVariableArgument ((AML_NODE_HEADER *)ParentNode, NULL) !=
+        NULL)
+    {
       ASSERT (0);
       Status = EFI_INVALID_PARAMETER;
       goto error_handler;
@@ -375,8 +379,8 @@ AmlCodeGenEndTag (
     // Add the EndTag RdNode. Indeed, the AmlAppendRdNode function
     // is looking for an EndTag, which we are adding here.
     Status = AmlVarListAddTail (
-               (AML_NODE_HEADER*)ParentNode,
-               (AML_NODE_HEADER*)RdNode
+               (AML_NODE_HEADER *)ParentNode,
+               (AML_NODE_HEADER *)RdNode
                );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
@@ -388,8 +392,9 @@ AmlCodeGenEndTag (
 
 error_handler:
   if (RdNode != NULL) {
-    AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
+    AmlDeleteTree ((AML_NODE_HEADER *)RdNode);
   }
+
   return Status;
 }
 
@@ -451,7 +456,7 @@ AmlCodeGenCrsAddRdInterrupt (
   IN  BOOLEAN                 EdgeTriggered,
   IN  BOOLEAN                 ActiveLow,
   IN  BOOLEAN                 Shared,
-  IN  UINT32                * IrqList,
+  IN  UINT32                  *IrqList,
   IN  UINT8                   IrqCount
   )
 {

+ 3 - 3
DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.h

@@ -142,9 +142,9 @@ AmlCodeGenRdRegister (
 EFI_STATUS
 EFIAPI
 AmlCodeGenEndTag (
-  IN  UINT8               CheckSum    OPTIONAL,
-  IN  AML_OBJECT_NODE   * ParentNode  OPTIONAL,
-  OUT AML_DATA_NODE    ** NewRdNode   OPTIONAL
+  IN  UINT8            CheckSum    OPTIONAL,
+  IN  AML_OBJECT_NODE  *ParentNode  OPTIONAL,
+  OUT AML_DATA_NODE    **NewRdNode   OPTIONAL
   );
 
 #endif // AML_RESOURCE_DATA_CODE_GEN_H_

File diff suppressed because it is too large
+ 256 - 229
DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c


+ 5 - 5
DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.h

@@ -28,8 +28,8 @@
 EFI_STATUS
 EFIAPI
 AmlGetFirstAncestorNameSpaceNode (
-  IN  CONST AML_NODE_HEADER   * Node,
-  OUT       AML_NODE_HEADER  ** OutNode
+  IN  CONST AML_NODE_HEADER  *Node,
+  OUT       AML_NODE_HEADER  **OutNode
   );
 
 /** Build the raw absolute AML pathname to Node and write it to a stream.
@@ -66,9 +66,9 @@ AmlGetFirstAncestorNameSpaceNode (
 EFI_STATUS
 EFIAPI
 AmlGetRawNameSpacePath (
-  IN  CONST AML_NODE_HEADER   * Node,
-  IN        UINT32              InputParent,
-  OUT       AML_STREAM        * RawAbsPathBStream
+  IN  CONST AML_NODE_HEADER  *Node,
+  IN        UINT32           InputParent,
+  OUT       AML_STREAM       *RawAbsPathBStream
   );
 
 #endif // AML_NAMESPACE_H_

+ 44 - 39
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c

@@ -46,31 +46,32 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseFieldElement (
-  IN      CONST AML_BYTE_ENCODING   * FieldByteEncoding,
-  IN  OUT       AML_OBJECT_NODE     * FieldNode,
-  IN  OUT       AML_STREAM          * FStream,
-  IN  OUT       LIST_ENTRY          * NameSpaceRefList
+  IN      CONST AML_BYTE_ENCODING  *FieldByteEncoding,
+  IN  OUT       AML_OBJECT_NODE    *FieldNode,
+  IN  OUT       AML_STREAM         *FStream,
+  IN  OUT       LIST_ENTRY         *NameSpaceRefList
   )
 {
-  EFI_STATUS          Status;
+  EFI_STATUS  Status;
 
-  UINT8             * CurrPos;
-  AML_OBJECT_NODE   * NewNode;
+  UINT8            *CurrPos;
+  AML_OBJECT_NODE  *NewNode;
 
-  UINT32              PkgLenOffset;
-  UINT32              PkgLenSize;
+  UINT32  PkgLenOffset;
+  UINT32  PkgLenSize;
 
   // Check whether the node is an Object Node and has a field list.
   // The byte encoding must be a field element.
   if ((FieldByteEncoding == NULL)                                   ||
       ((FieldByteEncoding->Attribute & AML_IS_FIELD_ELEMENT) == 0)  ||
       ((FieldByteEncoding->Attribute & AML_IS_PSEUDO_OPCODE) ==
-          AML_IS_PSEUDO_OPCODE)                                     ||
+       AML_IS_PSEUDO_OPCODE)                                     ||
       !AmlNodeHasAttribute (FieldNode, AML_HAS_FIELD_LIST)          ||
       !IS_STREAM (FStream)                                          ||
       IS_END_OF_STREAM (FStream)                                    ||
       !IS_STREAM_FORWARD (FStream)                                  ||
-      (NameSpaceRefList == NULL)) {
+      (NameSpaceRefList == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -98,7 +99,8 @@ AmlParseFieldElement (
   // Parse the PkgLen if available.
   PkgLenSize = 0;
   if ((FieldByteEncoding->Attribute & AML_HAS_PKG_LENGTH) ==
-        AML_HAS_PKG_LENGTH) {
+      AML_HAS_PKG_LENGTH)
+  {
     PkgLenOffset = AmlGetPkgLength (CurrPos, &PkgLenSize);
     if (PkgLenOffset == 0) {
       ASSERT (0);
@@ -129,14 +131,14 @@ AmlParseFieldElement (
 
   // Add the FieldElement to the Variable Argument List.
   Status = AmlVarListAddTailInternal (
-             (AML_NODE_HEADER*)FieldNode,
-             (AML_NODE_HEADER*)NewNode
+             (AML_NODE_HEADER *)FieldNode,
+             (AML_NODE_HEADER *)NewNode
              );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     // Delete the sub-tree if the insertion failed.
     // Otherwise its reference will be lost.
-    AmlDeleteTree ((AML_NODE_HEADER*)NewNode);
+    AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
     return Status;
   }
 
@@ -144,10 +146,10 @@ AmlParseFieldElement (
   if (!IS_END_OF_STREAM (FStream)) {
     // Parse the fixed arguments of the field element.
     Status = AmlParseFixedArguments (
-              NewNode,
-              FStream,
-              NameSpaceRefList
-              );
+               NewNode,
+               FStream,
+               NameSpaceRefList
+               );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
     }
@@ -182,14 +184,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseNamedFieldElement (
-  IN      CONST AML_BYTE_ENCODING   * NamedFieldByteEncoding,
-  IN  OUT       AML_OBJECT_NODE     * FieldNode,
-  IN  OUT       AML_STREAM          * FStream,
-  IN  OUT       LIST_ENTRY          * NameSpaceRefList
-)
+  IN      CONST AML_BYTE_ENCODING  *NamedFieldByteEncoding,
+  IN  OUT       AML_OBJECT_NODE    *FieldNode,
+  IN  OUT       AML_STREAM         *FStream,
+  IN  OUT       LIST_ENTRY         *NameSpaceRefList
+  )
 {
-  EFI_STATUS          Status;
-  AML_OBJECT_NODE   * NewNode;
+  EFI_STATUS       Status;
+  AML_OBJECT_NODE  *NewNode;
 
   // Check whether the node is an Object Node and has a field list.
   // The byte encoding must be a char.
@@ -199,7 +201,8 @@ AmlParseNamedFieldElement (
       !IS_STREAM (FStream)                                          ||
       IS_END_OF_STREAM (FStream)                                    ||
       !IS_STREAM_FORWARD (FStream)                                  ||
-      (NameSpaceRefList == NULL)) {
+      (NameSpaceRefList == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -217,14 +220,14 @@ AmlParseNamedFieldElement (
 
   // Add the NamedField node to the variable argument list.
   Status = AmlVarListAddTailInternal (
-             (AML_NODE_HEADER*)FieldNode,
-             (AML_NODE_HEADER*)NewNode
+             (AML_NODE_HEADER *)FieldNode,
+             (AML_NODE_HEADER *)NewNode
              );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     // Delete the sub-tree if the insertion failed.
     // Otherwise its reference will be lost.
-    AmlDeleteTree ((AML_NODE_HEADER*)NewNode);
+    AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
     return Status;
   }
 
@@ -306,23 +309,24 @@ AmlParseNamedFieldElement (
 EFI_STATUS
 EFIAPI
 AmlParseFieldList (
-  IN  AML_OBJECT_NODE   * FieldNode,
-  IN  AML_STREAM        * FStream,
-  IN  LIST_ENTRY        * NameSpaceRefList
+  IN  AML_OBJECT_NODE  *FieldNode,
+  IN  AML_STREAM       *FStream,
+  IN  LIST_ENTRY       *NameSpaceRefList
   )
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
 
-  UINT8                     * CurrPos;
-  CONST AML_BYTE_ENCODING   * FieldByteEncoding;
-  CONST AML_BYTE_ENCODING   * NamedFieldByteEncoding;
+  UINT8                    *CurrPos;
+  CONST AML_BYTE_ENCODING  *FieldByteEncoding;
+  CONST AML_BYTE_ENCODING  *NamedFieldByteEncoding;
 
   // Check whether the node is an Object Node and has a field list.
   if (!AmlNodeHasAttribute (FieldNode, AML_HAS_FIELD_LIST)  ||
       !IS_STREAM (FStream)                                  ||
       IS_END_OF_STREAM (FStream)                            ||
       !IS_STREAM_FORWARD (FStream)                          ||
-      (NameSpaceRefList == NULL)) {
+      (NameSpaceRefList == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -351,7 +355,8 @@ AmlParseFieldList (
       // call AmlGetByteEncoding() to check that the encoding is NameChar.
       NamedFieldByteEncoding = AmlGetByteEncoding (CurrPos);
       if ((NamedFieldByteEncoding != NULL) &&
-          (NamedFieldByteEncoding->Attribute & AML_IS_NAME_CHAR)) {
+          (NamedFieldByteEncoding->Attribute & AML_IS_NAME_CHAR))
+      {
         // This is a NamedField field element since it is starting with a char.
         Status = AmlParseNamedFieldElement (
                    NamedFieldByteEncoding,

+ 3 - 3
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.h

@@ -69,9 +69,9 @@
 EFI_STATUS
 EFIAPI
 AmlParseFieldList (
-  IN  AML_OBJECT_NODE   * FieldNode,
-  IN  AML_STREAM        * FStream,
-  IN  LIST_ENTRY        * NameSpaceRefList
+  IN  AML_OBJECT_NODE  *FieldNode,
+  IN  AML_STREAM       *FStream,
+  IN  LIST_ENTRY       *NameSpaceRefList
   );
 
 #endif // AML_FIELD_LIST_PARSER_H_

+ 237 - 208
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c

@@ -30,7 +30,7 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlDeleteNameSpaceRefNode (
-  IN  AML_NAMESPACE_REF_NODE    * NameSpaceRefNode
+  IN  AML_NAMESPACE_REF_NODE  *NameSpaceRefNode
   )
 {
   if (NameSpaceRefNode == NULL) {
@@ -39,7 +39,7 @@ AmlDeleteNameSpaceRefNode (
   }
 
   if (NameSpaceRefNode->RawAbsolutePath != NULL) {
-    FreePool ((CHAR8*)NameSpaceRefNode->RawAbsolutePath);
+    FreePool ((CHAR8 *)NameSpaceRefNode->RawAbsolutePath);
   } else {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
@@ -59,11 +59,11 @@ AmlDeleteNameSpaceRefNode (
 EFI_STATUS
 EFIAPI
 AmlDeleteNameSpaceRefList (
-  IN  LIST_ENTRY      * NameSpaceRefList
+  IN  LIST_ENTRY  *NameSpaceRefList
   )
 {
-  EFI_STATUS        Status;
-  LIST_ENTRY      * CurrentLink;
+  EFI_STATUS  Status;
+  LIST_ENTRY  *CurrentLink;
 
   if (NameSpaceRefList == NULL) {
     ASSERT (0);
@@ -74,7 +74,7 @@ AmlDeleteNameSpaceRefList (
     CurrentLink = NameSpaceRefList->ForwardLink;
     RemoveEntryList (CurrentLink);
     Status = AmlDeleteNameSpaceRefNode (
-               (AML_NAMESPACE_REF_NODE*)CurrentLink
+               (AML_NAMESPACE_REF_NODE *)CurrentLink
                );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
@@ -106,18 +106,19 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlCreateMethodRefNode (
-  IN  CONST AML_OBJECT_NODE         * ObjectNode,
-  IN  CONST CHAR8                   * RawAbsolutePath,
-  IN        UINT32                    RawAbsolutePathSize,
-  OUT       AML_NAMESPACE_REF_NODE ** NameSpaceRefNodePtr
+  IN  CONST AML_OBJECT_NODE         *ObjectNode,
+  IN  CONST CHAR8                   *RawAbsolutePath,
+  IN        UINT32                  RawAbsolutePathSize,
+  OUT       AML_NAMESPACE_REF_NODE  **NameSpaceRefNodePtr
   )
 {
-  AML_NAMESPACE_REF_NODE     * NameSpaceRefNode;
+  AML_NAMESPACE_REF_NODE  *NameSpaceRefNode;
 
   if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) ||
       (RawAbsolutePath == NULL)                           ||
       (RawAbsolutePathSize == 0)                          ||
-      (NameSpaceRefNodePtr == NULL)) {
+      (NameSpaceRefNodePtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -129,10 +130,10 @@ AmlCreateMethodRefNode (
   }
 
   NameSpaceRefNode->RawAbsolutePathSize = RawAbsolutePathSize;
-  NameSpaceRefNode->RawAbsolutePath = AllocateCopyPool (
-                                        RawAbsolutePathSize,
-                                        RawAbsolutePath
-                                        );
+  NameSpaceRefNode->RawAbsolutePath     = AllocateCopyPool (
+                                            RawAbsolutePathSize,
+                                            RawAbsolutePath
+                                            );
   if (NameSpaceRefNode->RawAbsolutePath == NULL) {
     FreePool (NameSpaceRefNode);
     ASSERT (0);
@@ -142,7 +143,7 @@ AmlCreateMethodRefNode (
   InitializeListHead (&NameSpaceRefNode->Link);
 
   NameSpaceRefNode->NodeRef = ObjectNode;
-  *NameSpaceRefNodePtr = NameSpaceRefNode;
+  *NameSpaceRefNodePtr      = NameSpaceRefNode;
 
   return EFI_SUCCESS;
 }
@@ -156,11 +157,11 @@ AmlCreateMethodRefNode (
 VOID
 EFIAPI
 AmlDbgPrintNameSpaceRefList (
-  IN  CONST LIST_ENTRY    * NameSpaceRefList
+  IN  CONST LIST_ENTRY  *NameSpaceRefList
   )
 {
-  LIST_ENTRY              * CurrLink;
-  AML_NAMESPACE_REF_NODE  * CurrNameSpaceNode;
+  LIST_ENTRY              *CurrLink;
+  AML_NAMESPACE_REF_NODE  *CurrNameSpaceNode;
 
   if (NameSpaceRefList == NULL) {
     ASSERT (0);
@@ -171,7 +172,7 @@ AmlDbgPrintNameSpaceRefList (
 
   CurrLink = NameSpaceRefList->ForwardLink;
   while (CurrLink != NameSpaceRefList) {
-    CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE*)CurrLink;
+    CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE *)CurrLink;
 
     AMLDBG_PRINT_CHARS (
       DEBUG_INFO,
@@ -215,28 +216,29 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlInitRawPathBStream (
-  IN  CONST AML_STREAM    * FStream,
-  OUT       AML_STREAM    * RawPathNameBStream
+  IN  CONST AML_STREAM  *FStream,
+  OUT       AML_STREAM  *RawPathNameBStream
   )
 {
-  EFI_STATUS    Status;
+  EFI_STATUS  Status;
 
-  UINT8       * RawPathBuffer;
-  CONST CHAR8 * Buffer;
+  UINT8        *RawPathBuffer;
+  CONST CHAR8  *Buffer;
 
-  UINT32        Root;
-  UINT32        ParentPrefix;
-  UINT32        SegCount;
+  UINT32  Root;
+  UINT32  ParentPrefix;
+  UINT32  SegCount;
 
   if (!IS_STREAM (FStream)          ||
       IS_END_OF_STREAM (FStream)    ||
-      !IS_STREAM_FORWARD  (FStream) ||
-      (RawPathNameBStream == NULL)) {
+      !IS_STREAM_FORWARD (FStream) ||
+      (RawPathNameBStream == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  Buffer = (CONST CHAR8*)AmlStreamGetCurrPos (FStream);
+  Buffer = (CONST CHAR8 *)AmlStreamGetCurrPos (FStream);
   if (Buffer == NULL) {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
@@ -255,11 +257,11 @@ AmlInitRawPathBStream (
   }
 
   // Get the beginning of the raw NameString.
-  RawPathBuffer = (UINT8*)AmlGetFirstNameSeg (
-                            Buffer,
-                            Root,
-                            ParentPrefix
-                            );
+  RawPathBuffer = (UINT8 *)AmlGetFirstNameSeg (
+                             Buffer,
+                             Root,
+                             ParentPrefix
+                             );
   if (RawPathBuffer == NULL) {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
@@ -313,16 +315,17 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlGetFirstNamedAncestorNode (
-  IN  CONST AML_NODE_HEADER   * Node,
-  OUT       AML_NODE_HEADER  ** OutNamedNode
+  IN  CONST AML_NODE_HEADER  *Node,
+  OUT       AML_NODE_HEADER  **OutNamedNode
   )
 {
-  EFI_STATUS                Status;
-  CONST AML_NODE_HEADER   * NameSpaceNode;
+  EFI_STATUS             Status;
+  CONST AML_NODE_HEADER  *NameSpaceNode;
 
   if ((!IS_AML_OBJECT_NODE (Node)   &&
        !IS_AML_ROOT_NODE (Node))    ||
-      (OutNamedNode == NULL)) {
+      (OutNamedNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -331,23 +334,26 @@ AmlGetFirstNamedAncestorNode (
   // get the ancestor NameSpace node.
   while (!IS_AML_ROOT_NODE (Node)             &&
          !(AmlNodeHasAttribute (
-             (CONST AML_OBJECT_NODE*)Node,
-              AML_IN_NAMESPACE)               &&
-           AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node) != NULL)) {
+             (CONST AML_OBJECT_NODE *)Node,
+             AML_IN_NAMESPACE
+             )               &&
+           AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node) != NULL))
+  {
     Status = AmlGetFirstAncestorNameSpaceNode (
-                Node,
-                (AML_NODE_HEADER**)&NameSpaceNode
-                );
+               Node,
+               (AML_NODE_HEADER **)&NameSpaceNode
+               );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
       return Status;
     }
+
     // The NameSpaceNode may not have its name defined as yet. In this
     // case get the next ancestor node.
     Node = NameSpaceNode;
   }
 
-  *OutNamedNode = (AML_NODE_HEADER*)Node;
+  *OutNamedNode = (AML_NODE_HEADER *)Node;
 
   return EFI_SUCCESS;
 }
@@ -380,20 +386,20 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlBuildRawMethodAbsolutePath (
-  IN      CONST AML_NODE_HEADER   * ParentNode,
-  IN      CONST AML_STREAM        * PathnameFStream,
-  IN  OUT       AML_STREAM        * AbsolutePathBStream
+  IN      CONST AML_NODE_HEADER  *ParentNode,
+  IN      CONST AML_STREAM       *PathnameFStream,
+  IN  OUT       AML_STREAM       *AbsolutePathBStream
   )
 {
-  EFI_STATUS          Status;
+  EFI_STATUS  Status;
 
-  AML_NODE_HEADER   * NamedParentNode;
-  UINT8             * RawPathBuffer;
-  CONST CHAR8       * CurrPos;
+  AML_NODE_HEADER  *NamedParentNode;
+  UINT8            *RawPathBuffer;
+  CONST CHAR8      *CurrPos;
 
-  UINT32              Root;
-  UINT32              ParentPrefix;
-  UINT32              SegCount;
+  UINT32  Root;
+  UINT32  ParentPrefix;
+  UINT32  SegCount;
 
   if ((!IS_AML_OBJECT_NODE (ParentNode)         &&
        !IS_AML_ROOT_NODE (ParentNode))          ||
@@ -402,12 +408,13 @@ AmlBuildRawMethodAbsolutePath (
       !IS_STREAM_FORWARD (PathnameFStream)      ||
       !IS_STREAM (AbsolutePathBStream)          ||
       IS_END_OF_STREAM (AbsolutePathBStream)    ||
-      !IS_STREAM_BACKWARD (AbsolutePathBStream)) {
+      !IS_STREAM_BACKWARD (AbsolutePathBStream))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  CurrPos = (CONST CHAR8*)AmlStreamGetCurrPos (PathnameFStream);
+  CurrPos = (CONST CHAR8 *)AmlStreamGetCurrPos (PathnameFStream);
   if (CurrPos == NULL) {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
@@ -428,11 +435,11 @@ AmlBuildRawMethodAbsolutePath (
   // Copy the method invocation raw relative path at the end of the Stream.
   if (SegCount != 0) {
     // Get the beginning of the raw NameString.
-    RawPathBuffer = (UINT8*)AmlGetFirstNameSeg (
-                              CurrPos,
-                              Root,
-                              ParentPrefix
-                              );
+    RawPathBuffer = (UINT8 *)AmlGetFirstNameSeg (
+                               CurrPos,
+                               Root,
+                               ParentPrefix
+                               );
 
     Status = AmlStreamWrite (
                AbsolutePathBStream,
@@ -487,19 +494,19 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlCompareRawNameString (
-  IN  CONST AML_STREAM    * RawFStream1,
-  IN  CONST AML_STREAM    * RawFStream2,
-  OUT       UINT32        * CompareCount
+  IN  CONST AML_STREAM  *RawFStream1,
+  IN  CONST AML_STREAM  *RawFStream2,
+  OUT       UINT32      *CompareCount
   )
 {
-  EFI_STATUS    Status;
-  UINT32        Index;
+  EFI_STATUS  Status;
+  UINT32      Index;
 
-  AML_STREAM    RawFStream1Clone;
-  AML_STREAM    RawFStream2Clone;
-  UINT32        Stream1Size;
-  UINT32        Stream2Size;
-  UINT32        CompareLen;
+  AML_STREAM  RawFStream1Clone;
+  AML_STREAM  RawFStream2Clone;
+  UINT32      Stream1Size;
+  UINT32      Stream2Size;
+  UINT32      CompareLen;
 
   // Raw NameStrings have a size that is a multiple of the size of NameSegs.
   if (!IS_STREAM (RawFStream1)          ||
@@ -507,7 +514,8 @@ AmlCompareRawNameString (
       !IS_STREAM_FORWARD (RawFStream1)  ||
       !IS_STREAM (RawFStream2)          ||
       IS_END_OF_STREAM (RawFStream2)    ||
-      (CompareCount == NULL)) {
+      (CompareCount == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -537,14 +545,16 @@ AmlCompareRawNameString (
   }
 
   CompareLen = MIN (Stream1Size, Stream2Size);
-  Index = 0;
+  Index      = 0;
   // Check there is enough space for a NameSeg in both Stream1 and Stream2.
   while (Index < CompareLen) {
     if (!AmlStreamCmp (
            &RawFStream1Clone,
            &RawFStream2Clone,
-           AML_NAME_SEG_SIZE)
-           ) {
+           AML_NAME_SEG_SIZE
+           )
+        )
+    {
       // NameSegs are different. Break.
       break;
     }
@@ -554,6 +564,7 @@ AmlCompareRawNameString (
       ASSERT (0);
       return Status;
     }
+
     Status = AmlStreamProgress (&RawFStream2Clone, AML_NAME_SEG_SIZE);
     if (EFI_ERROR (Status)) {
       ASSERT (0);
@@ -599,28 +610,29 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlResolveAliasMethod (
-  IN  CONST AML_OBJECT_NODE           * AliasNode,
-  IN  CONST LIST_ENTRY                * NameSpaceRefList,
-  OUT       AML_NAMESPACE_REF_NODE   ** OutNameSpaceRefNode
+  IN  CONST AML_OBJECT_NODE         *AliasNode,
+  IN  CONST LIST_ENTRY              *NameSpaceRefList,
+  OUT       AML_NAMESPACE_REF_NODE  **OutNameSpaceRefNode
   )
 {
-  EFI_STATUS              Status;
-  AML_STREAM              SourceAliasFStream;
-  CONST AML_DATA_NODE   * DataNode;
+  EFI_STATUS           Status;
+  AML_STREAM           SourceAliasFStream;
+  CONST AML_DATA_NODE  *DataNode;
 
   if (!AmlNodeCompareOpCode (AliasNode, AML_ALIAS_OP, 0)  ||
       (NameSpaceRefList == NULL)                          ||
-      (OutNameSpaceRefNode == NULL)) {
+      (OutNameSpaceRefNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   // The aliased NameString (the source name) is the first fixed argument,
   // cf. ACPI6.3 spec, s19.6.4: Alias (SourceObject, AliasObject)
-  DataNode = (CONST AML_DATA_NODE*)AmlGetFixedArgument (
-                                     (AML_OBJECT_NODE*)AliasNode,
-                                     EAmlParseIndexTerm0
-                                     );
+  DataNode = (CONST AML_DATA_NODE *)AmlGetFixedArgument (
+                                      (AML_OBJECT_NODE *)AliasNode,
+                                      EAmlParseIndexTerm0
+                                      );
   if (DataNode == NULL) {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
@@ -641,7 +653,7 @@ AmlResolveAliasMethod (
   // Recursively check whether the source alias NameString
   // is a method invocation.
   Status = AmlIsMethodInvocation (
-             AmlGetParent ((AML_NODE_HEADER*)AliasNode),
+             AmlGetParent ((AML_NODE_HEADER *)AliasNode),
              &SourceAliasFStream,
              NameSpaceRefList,
              OutNameSpaceRefNode
@@ -710,27 +722,27 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlFindMethodDefinition (
-  IN  CONST AML_STREAM                * RawAbsolutePathFStream,
-  IN  CONST AML_STREAM                * RawPathNameBStream,
-  IN  CONST LIST_ENTRY                * NameSpaceRefList,
-  OUT       AML_NAMESPACE_REF_NODE   ** OutNameSpaceRefNode
+  IN  CONST AML_STREAM              *RawAbsolutePathFStream,
+  IN  CONST AML_STREAM              *RawPathNameBStream,
+  IN  CONST LIST_ENTRY              *NameSpaceRefList,
+  OUT       AML_NAMESPACE_REF_NODE  **OutNameSpaceRefNode
   )
 {
-  EFI_STATUS                Status;
+  EFI_STATUS  Status;
 
-  LIST_ENTRY              * NextLink;
+  LIST_ENTRY  *NextLink;
 
   // To resolve a pathname, scope levels need to be compared.
-  UINT32                    NameSegScopeCount;
-  UINT32                    PathNameSegScopeCount;
-  UINT32                    ProbedScopeCount;
-  UINT32                    BestScopeCount;
+  UINT32  NameSegScopeCount;
+  UINT32  PathNameSegScopeCount;
+  UINT32  ProbedScopeCount;
+  UINT32  BestScopeCount;
 
-  AML_STREAM                ProbedRawAbsoluteFStream;
-  AML_STREAM                ProbedRawAbsoluteBStream;
+  AML_STREAM  ProbedRawAbsoluteFStream;
+  AML_STREAM  ProbedRawAbsoluteBStream;
 
-  AML_NAMESPACE_REF_NODE  * ProbedNameSpaceRefNode;
-  AML_NAMESPACE_REF_NODE  * BestNameSpaceRefNode;
+  AML_NAMESPACE_REF_NODE  *ProbedNameSpaceRefNode;
+  AML_NAMESPACE_REF_NODE  *BestNameSpaceRefNode;
 
   if (!IS_STREAM (RawAbsolutePathFStream)                               ||
       IS_END_OF_STREAM (RawAbsolutePathFStream)                         ||
@@ -743,7 +755,8 @@ AmlFindMethodDefinition (
       ((AmlStreamGetIndex (RawPathNameBStream) &
         (AML_NAME_SEG_SIZE - 1)) != 0)                                  ||
       (NameSpaceRefList == NULL)                                        ||
-      (OutNameSpaceRefNode == NULL)) {
+      (OutNameSpaceRefNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -751,21 +764,21 @@ AmlFindMethodDefinition (
   DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Checking absolute name: "));
   AMLDBG_PRINT_CHARS (
     DEBUG_VERBOSE,
-    (CONST CHAR8*)AmlStreamGetCurrPos (RawAbsolutePathFStream),
+    (CONST CHAR8 *)AmlStreamGetCurrPos (RawAbsolutePathFStream),
     AmlStreamGetMaxBufferSize (RawAbsolutePathFStream)
     );
   DEBUG ((DEBUG_VERBOSE, ".\n"));
 
-  BestNameSpaceRefNode = NULL;
-  BestScopeCount = 0;
-  NameSegScopeCount = AmlStreamGetMaxBufferSize (RawAbsolutePathFStream);
+  BestNameSpaceRefNode  = NULL;
+  BestScopeCount        = 0;
+  NameSegScopeCount     = AmlStreamGetMaxBufferSize (RawAbsolutePathFStream);
   PathNameSegScopeCount = AmlStreamGetMaxBufferSize (RawPathNameBStream);
 
   // Iterate through the raw AML absolute path to find the best match.
   DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Comparing with: "));
   NextLink = NameSpaceRefList->ForwardLink;
   while (NextLink != NameSpaceRefList) {
-    ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE*)NextLink;
+    ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE *)NextLink;
 
     // Print the raw absolute path of the probed node.
     AMLDBG_PRINT_CHARS (
@@ -790,7 +803,7 @@ AmlFindMethodDefinition (
     //      "MET0" should be skipped.
     Status = AmlStreamInit (
                &ProbedRawAbsoluteBStream,
-               (UINT8*)ProbedNameSpaceRefNode->RawAbsolutePath,
+               (UINT8 *)ProbedNameSpaceRefNode->RawAbsolutePath,
                ProbedNameSpaceRefNode->RawAbsolutePathSize,
                EAmlStreamDirectionBackward
                );
@@ -803,7 +816,9 @@ AmlFindMethodDefinition (
     if (!AmlStreamCmp (
            RawPathNameBStream,
            &ProbedRawAbsoluteBStream,
-           AmlStreamGetMaxBufferSize (RawPathNameBStream))) {
+           AmlStreamGetMaxBufferSize (RawPathNameBStream)
+           ))
+    {
       NextLink = NextLink->ForwardLink;
       continue;
     }
@@ -820,7 +835,7 @@ AmlFindMethodDefinition (
     //       Thus, the best match is \AAAA.MET0.
     Status = AmlStreamInit (
                &ProbedRawAbsoluteFStream,
-               (UINT8*)ProbedNameSpaceRefNode->RawAbsolutePath,
+               (UINT8 *)ProbedNameSpaceRefNode->RawAbsolutePath,
                ProbedNameSpaceRefNode->RawAbsolutePathSize,
                EAmlStreamDirectionForward
                );
@@ -847,7 +862,7 @@ AmlFindMethodDefinition (
     } else if (ProbedScopeCount > BestScopeCount) {
       // The probed node has more scope levels in common than the
       // last best match. Update the best match.
-      BestScopeCount = ProbedScopeCount;
+      BestScopeCount       = ProbedScopeCount;
       BestNameSpaceRefNode = ProbedNameSpaceRefNode;
     } else if (ProbedScopeCount == BestScopeCount) {
       // The probed node has the same number of scope levels in
@@ -871,11 +886,13 @@ AmlFindMethodDefinition (
         //       didn't because it is out of scope.
         //       Thus, the best match is \AAAA.MET0.
         if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) <
-              BestNameSpaceRefNode->RawAbsolutePathSize) {
-          BestScopeCount = ProbedScopeCount;
+            BestNameSpaceRefNode->RawAbsolutePathSize)
+        {
+          BestScopeCount       = ProbedScopeCount;
           BestNameSpaceRefNode = ProbedNameSpaceRefNode;
         } else if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) ==
-                     BestNameSpaceRefNode->RawAbsolutePathSize) {
+                   BestNameSpaceRefNode->RawAbsolutePathSize)
+        {
           ASSERT (0);
           return EFI_INVALID_PARAMETER;
         }
@@ -893,7 +910,10 @@ AmlFindMethodDefinition (
       *OutNameSpaceRefNode = BestNameSpaceRefNode;
     } else if (AmlNodeCompareOpCode (
                  BestNameSpaceRefNode->NodeRef,
-                 AML_ALIAS_OP, 0)) {
+                 AML_ALIAS_OP,
+                 0
+                 ))
+    {
       // The path matches an alias. Resolve the alias and check whether
       // this is a method defintion.
       Status = AmlResolveAliasMethod (
@@ -943,22 +963,22 @@ AmlFindMethodDefinition (
 EFI_STATUS
 EFIAPI
 AmlIsMethodInvocation (
-  IN  CONST AML_NODE_HEADER     * ParentNode,
-  IN  CONST AML_STREAM          * FStream,
-  IN  CONST LIST_ENTRY          * NameSpaceRefList,
-  OUT AML_NAMESPACE_REF_NODE   ** OutNameSpaceRefNode
+  IN  CONST AML_NODE_HEADER   *ParentNode,
+  IN  CONST AML_STREAM        *FStream,
+  IN  CONST LIST_ENTRY        *NameSpaceRefList,
+  OUT AML_NAMESPACE_REF_NODE  **OutNameSpaceRefNode
   )
 {
-  EFI_STATUS                Status;
+  EFI_STATUS  Status;
 
-  AML_STREAM                RawPathNameBStream;
-  AML_STREAM                RawAbsolutePathFStream;
+  AML_STREAM  RawPathNameBStream;
+  AML_STREAM  RawAbsolutePathFStream;
 
-  AML_STREAM                RawAbsolutePathBStream;
-  UINT8                   * RawAbsolutePathBuffer;
-  UINT32                    RawAbsolutePathBufferSize;
+  AML_STREAM  RawAbsolutePathBStream;
+  UINT8       *RawAbsolutePathBuffer;
+  UINT32      RawAbsolutePathBufferSize;
 
-  AML_NAMESPACE_REF_NODE  * NameSpaceRefNode;
+  AML_NAMESPACE_REF_NODE  *NameSpaceRefNode;
 
   if ((!IS_AML_OBJECT_NODE (ParentNode) &&
        !IS_AML_ROOT_NODE (ParentNode))  ||
@@ -966,22 +986,25 @@ AmlIsMethodInvocation (
       IS_END_OF_STREAM (FStream)        ||
       !IS_STREAM_FORWARD (FStream)      ||
       (NameSpaceRefList == NULL)        ||
-      (OutNameSpaceRefNode == NULL)) {
+      (OutNameSpaceRefNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   // There cannot be a method invocation in a field list. Return.
   if (AmlNodeHasAttribute (
-        (CONST AML_OBJECT_NODE*)ParentNode,
-        AML_HAS_FIELD_LIST)) {
+        (CONST AML_OBJECT_NODE *)ParentNode,
+        AML_HAS_FIELD_LIST
+        ))
+  {
     *OutNameSpaceRefNode = NULL;
     return EFI_SUCCESS;
   }
 
   // Allocate memory for the raw absolute path.
   RawAbsolutePathBufferSize = MAX_AML_NAMESTRING_SIZE;
-  RawAbsolutePathBuffer = AllocateZeroPool (RawAbsolutePathBufferSize);
+  RawAbsolutePathBuffer     = AllocateZeroPool (RawAbsolutePathBufferSize);
   if (RawAbsolutePathBuffer == NULL) {
     ASSERT (0);
     return EFI_OUT_OF_RESOURCES;
@@ -1018,7 +1041,7 @@ AmlIsMethodInvocation (
       "Root node cannot be a method invocation\n"
       ));
     *OutNameSpaceRefNode = NULL;
-    Status = EFI_SUCCESS;
+    Status               = EFI_SUCCESS;
     goto exit_handler;
   }
 
@@ -1049,18 +1072,18 @@ AmlIsMethodInvocation (
   // Go through the NameSpaceRefList elements to check for
   // a corresponding method definition.
   NameSpaceRefNode = NULL;
-  Status = AmlFindMethodDefinition (
-             &RawAbsolutePathFStream,
-             &RawPathNameBStream,
-             NameSpaceRefList,
-             &NameSpaceRefNode
-             );
+  Status           = AmlFindMethodDefinition (
+                       &RawAbsolutePathFStream,
+                       &RawPathNameBStream,
+                       NameSpaceRefList,
+                       &NameSpaceRefNode
+                       );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     goto exit_handler;
   }
 
-#if !defined(MDEPKG_NDEBUG)
+ #if !defined (MDEPKG_NDEBUG)
   // Print whether a method definition has been found.
   if (NameSpaceRefNode != NULL) {
     DEBUG ((
@@ -1073,11 +1096,11 @@ AmlIsMethodInvocation (
       NameSpaceRefNode->RawAbsolutePathSize
       );
     DEBUG ((DEBUG_VERBOSE, ".\n"));
-
   } else {
     DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: No method definition found.\n"));
   }
-#endif // MDEPKG_NDEBUG
+
+ #endif // MDEPKG_NDEBUG
 
   *OutNameSpaceRefNode = NameSpaceRefNode;
 
@@ -1105,27 +1128,28 @@ exit_handler:
 EFI_STATUS
 EFIAPI
 AmlAddNameSpaceReference (
-  IN      CONST AML_OBJECT_NODE   * Node,
-  IN  OUT       LIST_ENTRY        * NameSpaceRefList
+  IN      CONST AML_OBJECT_NODE  *Node,
+  IN  OUT       LIST_ENTRY       *NameSpaceRefList
   )
 {
-  EFI_STATUS                Status;
-  AML_NAMESPACE_REF_NODE  * NameSpaceRefNode;
+  EFI_STATUS              Status;
+  AML_NAMESPACE_REF_NODE  *NameSpaceRefNode;
 
-  AML_STREAM                NodeNameFStream;
-  EAML_PARSE_INDEX          NameIndex;
-  CONST AML_DATA_NODE     * NameNode;
+  AML_STREAM           NodeNameFStream;
+  EAML_PARSE_INDEX     NameIndex;
+  CONST AML_DATA_NODE  *NameNode;
 
-  AML_STREAM                RawAbsolutePathBStream;
-  UINT32                    RawAbsolutePathBStreamSize;
+  AML_STREAM  RawAbsolutePathBStream;
+  UINT32      RawAbsolutePathBStreamSize;
 
-  CHAR8                   * AbsolutePathBuffer;
-  UINT32                    AbsolutePathBufferSize;
+  CHAR8   *AbsolutePathBuffer;
+  UINT32  AbsolutePathBufferSize;
 
-  CONST AML_NODE_HEADER   * ParentNode;
+  CONST AML_NODE_HEADER  *ParentNode;
 
   if (!AmlNodeHasAttribute (Node, AML_IN_NAMESPACE)   ||
-      (NameSpaceRefList == NULL)) {
+      (NameSpaceRefList == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -1133,7 +1157,7 @@ AmlAddNameSpaceReference (
   // Allocate a buffer to get the raw AML absolute pathname of the
   // namespace node.
   AbsolutePathBufferSize = MAX_AML_NAMESTRING_SIZE;
-  AbsolutePathBuffer = AllocateZeroPool (AbsolutePathBufferSize);
+  AbsolutePathBuffer     = AllocateZeroPool (AbsolutePathBufferSize);
   if (AbsolutePathBuffer == NULL) {
     ASSERT (0);
     return EFI_OUT_OF_RESOURCES;
@@ -1141,7 +1165,7 @@ AmlAddNameSpaceReference (
 
   Status = AmlStreamInit (
              &RawAbsolutePathBStream,
-             (UINT8*)AbsolutePathBuffer,
+             (UINT8 *)AbsolutePathBuffer,
              AbsolutePathBufferSize,
              EAmlStreamDirectionBackward
              );
@@ -1161,12 +1185,13 @@ AmlAddNameSpaceReference (
   }
 
   // Get the Node name.
-  NameNode = (CONST AML_DATA_NODE*)AmlGetFixedArgument (
-                                     (AML_OBJECT_NODE*)Node,
-                                     NameIndex
-                                     );
+  NameNode = (CONST AML_DATA_NODE *)AmlGetFixedArgument (
+                                      (AML_OBJECT_NODE *)Node,
+                                      NameIndex
+                                      );
   if (!IS_AML_DATA_NODE (NameNode)    ||
-      (NameNode->DataType != EAmlNodeDataTypeNameString)) {
+      (NameNode->DataType != EAmlNodeDataTypeNameString))
+  {
     ASSERT (0);
     Status = EFI_INVALID_PARAMETER;
     goto exit_handler;
@@ -1186,7 +1211,7 @@ AmlAddNameSpaceReference (
     goto exit_handler;
   }
 
-  ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+  ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
   if (ParentNode == NULL) {
     ASSERT (0);
     Status = EFI_INVALID_PARAMETER;
@@ -1214,7 +1239,7 @@ AmlAddNameSpaceReference (
   // Create a NameSpace reference node.
   Status = AmlCreateMethodRefNode (
              Node,
-             (CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
+             (CONST CHAR8 *)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
              RawAbsolutePathBStreamSize,
              &NameSpaceRefNode
              );
@@ -1232,7 +1257,7 @@ AmlAddNameSpaceReference (
     ));
   AMLDBG_PRINT_CHARS (
     DEBUG_VERBOSE,
-    (CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
+    (CONST CHAR8 *)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
     AmlStreamGetIndex (&RawAbsolutePathBStream)
     );
   DEBUG ((DEBUG_VERBOSE, "\n"));
@@ -1275,31 +1300,32 @@ exit_handler:
 EFI_STATUS
 EFIAPI
 AmlCreateMethodInvocationNode (
-  IN  CONST AML_NAMESPACE_REF_NODE   * NameSpaceRefNode,
-  IN        AML_DATA_NODE            * MethodInvocationName,
-  OUT       AML_OBJECT_NODE         ** MethodInvocationNodePtr
+  IN  CONST AML_NAMESPACE_REF_NODE  *NameSpaceRefNode,
+  IN        AML_DATA_NODE           *MethodInvocationName,
+  OUT       AML_OBJECT_NODE         **MethodInvocationNodePtr
   )
 {
-  EFI_STATUS            Status;
+  EFI_STATUS  Status;
 
-  UINT8                 ArgCount;
-  AML_DATA_NODE       * ArgCountNode;
-  AML_NODE_HEADER    ** FixedArgs;
-  AML_OBJECT_NODE     * MethodDefinitionNode;
-  AML_OBJECT_NODE     * MethodInvocationNode;
+  UINT8            ArgCount;
+  AML_DATA_NODE    *ArgCountNode;
+  AML_NODE_HEADER  **FixedArgs;
+  AML_OBJECT_NODE  *MethodDefinitionNode;
+  AML_OBJECT_NODE  *MethodInvocationNode;
 
   if ((NameSpaceRefNode == NULL)                                      ||
       !AmlIsMethodDefinitionNode (NameSpaceRefNode->NodeRef)          ||
       !IS_AML_DATA_NODE (MethodInvocationName)                        ||
       (MethodInvocationName->DataType != EAmlNodeDataTypeNameString)  ||
-      (MethodInvocationNodePtr == NULL)) {
+      (MethodInvocationNodePtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   // Get the number of arguments of the method.
-  MethodDefinitionNode = (AML_OBJECT_NODE*)NameSpaceRefNode->NodeRef;
-  FixedArgs = MethodDefinitionNode->FixedArgs;
+  MethodDefinitionNode = (AML_OBJECT_NODE *)NameSpaceRefNode->NodeRef;
+  FixedArgs            = MethodDefinitionNode->FixedArgs;
   // The method definition is an actual method definition.
   if (AmlNodeCompareOpCode (MethodDefinitionNode, AML_METHOD_OP, 0)) {
     // Cf ACPI 6.3 specification:
@@ -1312,8 +1338,8 @@ AmlCreateMethodInvocationNode (
     //                           bit 4-7: SyncLevel (0x00-0x0f)
 
     // Read the MethodFlags to decode the ArgCount.
-    ArgCountNode = (AML_DATA_NODE*)FixedArgs[EAmlParseIndexTerm1];
-    ArgCount = *((UINT8*)ArgCountNode->Buffer) & 0x7;
+    ArgCountNode = (AML_DATA_NODE *)FixedArgs[EAmlParseIndexTerm1];
+    ArgCount     = *((UINT8 *)ArgCountNode->Buffer) & 0x7;
   } else if (AmlNodeCompareOpCode (MethodDefinitionNode, AML_EXTERNAL_OP, 0)) {
     // The method definition is an external statement.
     // Cf ACPI 6.3 specification:
@@ -1323,8 +1349,8 @@ AmlCreateMethodInvocationNode (
     //  ArgumentCount := ByteData (0 - 7)
 
     // Read the ArgumentCount.
-    ArgCountNode = (AML_DATA_NODE*)FixedArgs[EAmlParseIndexTerm2];
-    ArgCount = *((UINT8*)ArgCountNode->Buffer);
+    ArgCountNode = (AML_DATA_NODE *)FixedArgs[EAmlParseIndexTerm2];
+    ArgCount     = *((UINT8 *)ArgCountNode->Buffer);
   } else {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
@@ -1349,7 +1375,7 @@ AmlCreateMethodInvocationNode (
   Status = AmlSetFixedArgument (
              MethodInvocationNode,
              EAmlParseIndexTerm0,
-             (AML_NODE_HEADER*)MethodInvocationName
+             (AML_NODE_HEADER *)MethodInvocationName
              );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
@@ -1359,12 +1385,12 @@ AmlCreateMethodInvocationNode (
   // Create a data node holding the number of arguments
   // of the method invocation.
   ArgCountNode = NULL;
-  Status = AmlCreateDataNode (
-             EAmlNodeDataTypeUInt,
-             &ArgCount,
-             sizeof (UINT8),
-             &ArgCountNode
-             );
+  Status       = AmlCreateDataNode (
+                   EAmlNodeDataTypeUInt,
+                   &ArgCount,
+                   sizeof (UINT8),
+                   &ArgCountNode
+                   );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     goto error_handler;
@@ -1372,10 +1398,10 @@ AmlCreateMethodInvocationNode (
 
   // The second fixed argument is the number of arguments.
   Status = AmlSetFixedArgument (
-              MethodInvocationNode,
-              EAmlParseIndexTerm1,
-              (AML_NODE_HEADER*)ArgCountNode
-              );
+             MethodInvocationNode,
+             EAmlParseIndexTerm1,
+             (AML_NODE_HEADER *)ArgCountNode
+             );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     goto error_handler;
@@ -1386,9 +1412,9 @@ AmlCreateMethodInvocationNode (
 
 error_handler:
   // Delete the sub-tree: the method invocation name is already attached.
-  AmlDeleteTree ((AML_NODE_HEADER*)MethodInvocationNode);
+  AmlDeleteTree ((AML_NODE_HEADER *)MethodInvocationNode);
   if (ArgCountNode != NULL) {
-    AmlDeleteNode ((AML_NODE_HEADER*)ArgCountNode);
+    AmlDeleteNode ((AML_NODE_HEADER *)ArgCountNode);
   }
 
   return Status;
@@ -1415,16 +1441,17 @@ error_handler:
 EFI_STATUS
 EFIAPI
 AmlGetMethodInvocationArgCount (
-  IN  CONST AML_OBJECT_NODE   * MethodInvocationNode,
-  OUT       BOOLEAN           * IsMethodInvocation,
-  OUT       UINT8             * ArgCount
+  IN  CONST AML_OBJECT_NODE  *MethodInvocationNode,
+  OUT       BOOLEAN          *IsMethodInvocation,
+  OUT       UINT8            *ArgCount
   )
 {
-  AML_DATA_NODE   * NumArgsNode;
+  AML_DATA_NODE  *NumArgsNode;
 
   if (!IS_AML_NODE_VALID (MethodInvocationNode) ||
       (IsMethodInvocation == NULL)              ||
-      (ArgCount == NULL)) {
+      (ArgCount == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -1432,7 +1459,7 @@ AmlGetMethodInvocationArgCount (
   // Check whether MethodInvocationNode is a method invocation.
   if (!AmlNodeCompareOpCode (MethodInvocationNode, AML_METHOD_INVOC_OP, 0)) {
     *IsMethodInvocation = FALSE;
-    *ArgCount = 0;
+    *ArgCount           = 0;
     return EFI_SUCCESS;
   }
 
@@ -1440,17 +1467,19 @@ AmlGetMethodInvocationArgCount (
   // MethodInvocationOp := Pseudo Opcode for Method Invocation
   // NameString := Method Name
   // ArgumentCount := ByteData (0 - 7)
-  NumArgsNode = (AML_DATA_NODE*)AmlGetFixedArgument (
-                                  (AML_OBJECT_NODE*)MethodInvocationNode,
-                                  EAmlParseIndexTerm1
-                                  );
+  NumArgsNode = (AML_DATA_NODE *)AmlGetFixedArgument (
+                                   (AML_OBJECT_NODE *)MethodInvocationNode,
+                                   EAmlParseIndexTerm1
+                                   );
   if (!IS_AML_NODE_VALID (NumArgsNode)                ||
       (NumArgsNode->Buffer == NULL)                   ||
       (NumArgsNode->DataType != EAmlNodeDataTypeUInt) ||
-      (NumArgsNode->Size != 1)) {
+      (NumArgsNode->Size != 1))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
+
   *ArgCount = *NumArgsNode->Buffer;
 
   *IsMethodInvocation = TRUE;

+ 19 - 19
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.h

@@ -23,20 +23,20 @@
 typedef struct AmlNameSpaceRefNode {
   /// Double linked list.
   /// This must be the first field in this structure.
-  LIST_ENTRY                Link;
+  LIST_ENTRY               Link;
 
   /// Node part of the AML namespace. It must have the AML_IN_NAMESPACE
   /// attribute.
-  CONST AML_OBJECT_NODE   * NodeRef;
+  CONST AML_OBJECT_NODE    *NodeRef;
 
   /// Raw AML absolute pathname of the NodeRef.
   /// This is a raw AML NameString (cf AmlNameSpace.c: A concatenated list
   /// of 4 chars long names. The dual/multi NameString prefix have been
   /// stripped.).
-  CONST CHAR8             * RawAbsolutePath;
+  CONST CHAR8              *RawAbsolutePath;
 
   /// Size of the raw AML absolute pathname buffer.
-  UINT32                    RawAbsolutePathSize;
+  UINT32                   RawAbsolutePathSize;
 } AML_NAMESPACE_REF_NODE;
 
 /** Delete a list of namespace reference nodes.
@@ -49,11 +49,11 @@ typedef struct AmlNameSpaceRefNode {
 EFI_STATUS
 EFIAPI
 AmlDeleteNameSpaceRefList (
-  IN  LIST_ENTRY      * NameSpaceRefList
+  IN  LIST_ENTRY  *NameSpaceRefList
   );
 
-
 #if !defined (MDEPKG_NDEBUG)
+
 /** Print the list of raw absolute paths of the NameSpace reference list.
 
   @param  [in]    NameSpaceRefList    List of NameSpace reference nodes.
@@ -61,7 +61,7 @@ AmlDeleteNameSpaceRefList (
 VOID
 EFIAPI
 AmlDbgPrintNameSpaceRefList (
-  IN  CONST LIST_ENTRY    * NameSpaceRefList
+  IN  CONST LIST_ENTRY  *NameSpaceRefList
   );
 
 #endif // MDEPKG_NDEBUG
@@ -95,10 +95,10 @@ AmlDbgPrintNameSpaceRefList (
 EFI_STATUS
 EFIAPI
 AmlIsMethodInvocation (
-  IN  CONST AML_NODE_HEADER     * ParentNode,
-  IN  CONST AML_STREAM          * FStream,
-  IN  CONST LIST_ENTRY          * NameSpaceRefList,
-  OUT AML_NAMESPACE_REF_NODE   ** OutNameSpaceRefNode
+  IN  CONST AML_NODE_HEADER   *ParentNode,
+  IN  CONST AML_STREAM        *FStream,
+  IN  CONST LIST_ENTRY        *NameSpaceRefList,
+  OUT AML_NAMESPACE_REF_NODE  **OutNameSpaceRefNode
   );
 
 /** Create a namespace reference node and add it to the NameSpaceRefList.
@@ -119,8 +119,8 @@ AmlIsMethodInvocation (
 EFI_STATUS
 EFIAPI
 AmlAddNameSpaceReference (
-  IN      CONST AML_OBJECT_NODE   * Node,
-  IN  OUT       LIST_ENTRY        * NameSpaceRefList
+  IN      CONST AML_OBJECT_NODE  *Node,
+  IN  OUT       LIST_ENTRY       *NameSpaceRefList
   );
 
 /** Create a method invocation node.
@@ -154,9 +154,9 @@ AmlAddNameSpaceReference (
 EFI_STATUS
 EFIAPI
 AmlCreateMethodInvocationNode (
-  IN  CONST AML_NAMESPACE_REF_NODE   * NameSpaceRefNode,
-  IN        AML_DATA_NODE            * MethodInvocationName,
-  OUT       AML_OBJECT_NODE         ** MethodInvocationNodePtr
+  IN  CONST AML_NAMESPACE_REF_NODE  *NameSpaceRefNode,
+  IN        AML_DATA_NODE           *MethodInvocationName,
+  OUT       AML_OBJECT_NODE         **MethodInvocationNodePtr
   );
 
 /** Get the number of arguments of a method invocation node.
@@ -180,9 +180,9 @@ AmlCreateMethodInvocationNode (
 EFI_STATUS
 EFIAPI
 AmlGetMethodInvocationArgCount (
-  IN  CONST AML_OBJECT_NODE   * MethodInvocationNode,
-  OUT       BOOLEAN           * IsMethodInvocation,
-  OUT       UINT8             * ArgCount
+  IN  CONST AML_OBJECT_NODE  *MethodInvocationNode,
+  OUT       BOOLEAN          *IsMethodInvocation,
+  OUT       UINT8            *ArgCount
   );
 
 #endif // AML_METHOD_PARSER_H_

+ 231 - 206
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c

@@ -69,9 +69,9 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseStream (
-  IN      AML_NODE_HEADER   * Node,
-  IN  OUT AML_STREAM        * FStream,
-  IN  OUT LIST_ENTRY        * NameSpaceRefList
+  IN      AML_NODE_HEADER  *Node,
+  IN  OUT AML_STREAM       *FStream,
+  IN  OUT LIST_ENTRY       *NameSpaceRefList
   );
 
 /** Function pointer to parse an AML construct.
@@ -102,10 +102,10 @@ typedef
 EFI_STATUS
 EFIAPI
 (*AML_PARSE_FUNCTION) (
-  IN      CONST AML_NODE_HEADER     * Node,
-  IN            AML_PARSE_FORMAT      ExpectedFormat,
-  IN  OUT       AML_STREAM          * FStream,
-      OUT       AML_NODE_HEADER    ** OutNode
+  IN      CONST AML_NODE_HEADER   *Node,
+  IN            AML_PARSE_FORMAT  ExpectedFormat,
+  IN  OUT       AML_STREAM        *FStream,
+  OUT       AML_NODE_HEADER       **OutNode
   );
 
 /** Parse a UInt<X> (where X=8, 16, 32 or 64).
@@ -130,14 +130,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseUIntX (
-  IN      CONST AML_NODE_HEADER     * ParentNode,
-  IN            AML_PARSE_FORMAT      ExpectedFormat,
-  IN  OUT       AML_STREAM          * FStream,
-      OUT       AML_NODE_HEADER    ** OutNode
+  IN      CONST AML_NODE_HEADER   *ParentNode,
+  IN            AML_PARSE_FORMAT  ExpectedFormat,
+  IN  OUT       AML_STREAM        *FStream,
+  OUT       AML_NODE_HEADER       **OutNode
   )
 {
-  EFI_STATUS    Status;
-  UINT32        UIntXSize;
+  EFI_STATUS  Status;
+  UINT32      UIntXSize;
 
   if ((!IS_AML_ROOT_NODE (ParentNode)       &&
        !IS_AML_OBJECT_NODE (ParentNode))    ||
@@ -148,34 +148,35 @@ AmlParseUIntX (
       !IS_STREAM (FStream)                  ||
       IS_END_OF_STREAM (FStream)            ||
       !IS_STREAM_FORWARD (FStream)          ||
-      (OutNode == NULL)) {
+      (OutNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   switch (ExpectedFormat) {
-  case EAmlUInt8:
-    UIntXSize = 1;
-    break;
-  case EAmlUInt16:
-    UIntXSize = 2;
-    break;
-  case EAmlUInt32:
-    UIntXSize = 4;
-    break;
-  case EAmlUInt64:
-    UIntXSize = 8;
-    break;
-  default:
-    ASSERT (0);
-    return EFI_INVALID_PARAMETER;
+    case EAmlUInt8:
+      UIntXSize = 1;
+      break;
+    case EAmlUInt16:
+      UIntXSize = 2;
+      break;
+    case EAmlUInt32:
+      UIntXSize = 4;
+      break;
+    case EAmlUInt64:
+      UIntXSize = 8;
+      break;
+    default:
+      ASSERT (0);
+      return EFI_INVALID_PARAMETER;
   }
 
   Status = AmlCreateDataNode (
              AmlTypeToNodeDataType (ExpectedFormat),
              AmlStreamGetCurrPos (FStream),
              UIntXSize,
-             (AML_DATA_NODE**)OutNode
+             (AML_DATA_NODE **)OutNode
              );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
@@ -216,17 +217,17 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseNameString (
-  IN      CONST AML_NODE_HEADER     * ParentNode,
-  IN            AML_PARSE_FORMAT      ExpectedFormat,
-  IN  OUT       AML_STREAM          * FStream,
-      OUT       AML_NODE_HEADER    ** OutNode
+  IN      CONST AML_NODE_HEADER   *ParentNode,
+  IN            AML_PARSE_FORMAT  ExpectedFormat,
+  IN  OUT       AML_STREAM        *FStream,
+  OUT       AML_NODE_HEADER       **OutNode
   )
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
 
-  CONST UINT8               * Buffer;
-  CONST AML_BYTE_ENCODING   * ByteEncoding;
-  UINT32                      StrSize;
+  CONST UINT8              *Buffer;
+  CONST AML_BYTE_ENCODING  *ByteEncoding;
+  UINT32                   StrSize;
 
   if ((!IS_AML_ROOT_NODE (ParentNode)     &&
        !IS_AML_OBJECT_NODE (ParentNode))  ||
@@ -234,23 +235,26 @@ AmlParseNameString (
       !IS_STREAM (FStream)                ||
       IS_END_OF_STREAM (FStream)          ||
       !IS_STREAM_FORWARD (FStream)        ||
-      (OutNode == NULL)) {
+      (OutNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+  Buffer       = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
   ByteEncoding = AmlGetByteEncoding (Buffer);
   if ((ByteEncoding == NULL)    ||
-      ((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0)) {
+      ((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   // Parse the NameString.
-  Status = AmlGetNameStringSize ((CONST CHAR8*)Buffer, &StrSize);
+  Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &StrSize);
   if ((EFI_ERROR (Status))  ||
-      (StrSize > AmlStreamGetFreeSpace (FStream))) {
+      (StrSize > AmlStreamGetFreeSpace (FStream)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -259,7 +263,7 @@ AmlParseNameString (
              EAmlNodeDataTypeNameString,
              Buffer,
              StrSize,
-             (AML_DATA_NODE**)OutNode
+             (AML_DATA_NODE **)OutNode
              );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
@@ -300,16 +304,16 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseString (
-  IN      CONST AML_NODE_HEADER     * ParentNode,
-  IN            AML_PARSE_FORMAT      ExpectedFormat,
-  IN  OUT       AML_STREAM          * FStream,
-      OUT       AML_NODE_HEADER    ** OutNode
+  IN      CONST AML_NODE_HEADER   *ParentNode,
+  IN            AML_PARSE_FORMAT  ExpectedFormat,
+  IN  OUT       AML_STREAM        *FStream,
+  OUT       AML_NODE_HEADER       **OutNode
   )
 {
-  EFI_STATUS      Status;
-  UINT32          StrSize;
-  UINT8           Byte;
-  CONST UINT8   * Buffer;
+  EFI_STATUS   Status;
+  UINT32       StrSize;
+  UINT8        Byte;
+  CONST UINT8  *Buffer;
 
   if ((!IS_AML_ROOT_NODE (ParentNode)     &&
        !IS_AML_OBJECT_NODE (ParentNode))  ||
@@ -317,12 +321,13 @@ AmlParseString (
       !IS_STREAM (FStream)                ||
       IS_END_OF_STREAM (FStream)          ||
       !IS_STREAM_FORWARD (FStream)        ||
-      (OutNode == NULL)) {
+      (OutNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+  Buffer  = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
   StrSize = 0;
   // AML String is NULL terminated.
   do {
@@ -332,6 +337,7 @@ AmlParseString (
       ASSERT (0);
       return Status;
     }
+
     StrSize++;
   } while (Byte != '\0');
 
@@ -341,7 +347,7 @@ AmlParseString (
              AmlTypeToNodeDataType (ExpectedFormat),
              Buffer,
              StrSize,
-             (AML_DATA_NODE**)OutNode
+             (AML_DATA_NODE **)OutNode
              );
   ASSERT_EFI_ERROR (Status);
 
@@ -372,21 +378,21 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseObject (
-  IN      CONST AML_NODE_HEADER     * ParentNode,
-  IN            AML_PARSE_FORMAT      ExpectedFormat,
-  IN  OUT       AML_STREAM          * FStream,
-      OUT       AML_NODE_HEADER    ** OutNode
+  IN      CONST AML_NODE_HEADER   *ParentNode,
+  IN            AML_PARSE_FORMAT  ExpectedFormat,
+  IN  OUT       AML_STREAM        *FStream,
+  OUT       AML_NODE_HEADER       **OutNode
   )
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
 
-  UINT8                       OpCodeSize;
-  UINT32                      PkgLength;
-  UINT32                      PkgOffset;
-  UINT32                      FreeSpace;
+  UINT8   OpCodeSize;
+  UINT32  PkgLength;
+  UINT32  PkgOffset;
+  UINT32  FreeSpace;
 
-  CONST AML_BYTE_ENCODING   * AmlByteEncoding;
-  CONST UINT8               * Buffer;
+  CONST AML_BYTE_ENCODING  *AmlByteEncoding;
+  CONST UINT8              *Buffer;
 
   if ((!IS_AML_ROOT_NODE (ParentNode)     &&
        !IS_AML_OBJECT_NODE (ParentNode))  ||
@@ -394,7 +400,8 @@ AmlParseObject (
       !IS_STREAM (FStream)                ||
       IS_END_OF_STREAM (FStream)          ||
       !IS_STREAM_FORWARD (FStream)        ||
-      (OutNode == NULL)) {
+      (OutNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -424,16 +431,18 @@ AmlParseObject (
     if (EFI_ERROR (Status)) {
       ASSERT (0);
     }
+
     return Status;
   }
 
   // 2. Determine the OpCode size to move the stream forward.
-  Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+  Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
   if (*Buffer == AML_EXT_OP) {
     OpCodeSize = 2;
   } else {
     OpCodeSize = 1;
   }
+
   Status = AmlStreamProgress (FStream, OpCodeSize);
   if (EFI_ERROR (Status)) {
     ASSERT (0);
@@ -446,7 +455,7 @@ AmlParseObject (
   if (!IS_END_OF_STREAM (FStream)) {
     // 3. Parse the PkgLength field, if present.
     if ((AmlByteEncoding->Attribute & AML_HAS_PKG_LENGTH) != 0) {
-      Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+      Buffer    = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
       PkgOffset = AmlGetPkgLength (Buffer, &PkgLength);
       if (PkgOffset == 0) {
         ASSERT (0);
@@ -482,7 +491,7 @@ AmlParseObject (
   Status = AmlCreateObjectNode (
              AmlByteEncoding,
              PkgLength,
-             (AML_OBJECT_NODE**)OutNode
+             (AML_OBJECT_NODE **)OutNode
              );
   ASSERT_EFI_ERROR (Status);
 
@@ -513,32 +522,33 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseFieldPkgLen (
-  IN      CONST AML_NODE_HEADER     * ParentNode,
-  IN            AML_PARSE_FORMAT      ExpectedFormat,
-  IN  OUT       AML_STREAM          * FStream,
-      OUT       AML_NODE_HEADER    ** OutNode
+  IN      CONST AML_NODE_HEADER   *ParentNode,
+  IN            AML_PARSE_FORMAT  ExpectedFormat,
+  IN  OUT       AML_STREAM        *FStream,
+  OUT       AML_NODE_HEADER       **OutNode
   )
 {
-  EFI_STATUS      Status;
-  EFI_STATUS      Status1;
-  CONST UINT8   * Buffer;
-  UINT32          PkgOffset;
-  UINT32          PkgLength;
+  EFI_STATUS   Status;
+  EFI_STATUS   Status1;
+  CONST UINT8  *Buffer;
+  UINT32       PkgOffset;
+  UINT32       PkgLength;
 
   if (!AmlNodeHasAttribute (
-         (CONST AML_OBJECT_NODE*)ParentNode,
+         (CONST AML_OBJECT_NODE *)ParentNode,
          AML_IS_FIELD_ELEMENT
          )                                ||
       (ExpectedFormat != EAmlFieldPkgLen) ||
       !IS_STREAM (FStream)                ||
       IS_END_OF_STREAM (FStream)          ||
       !IS_STREAM_FORWARD (FStream)        ||
-      (OutNode == NULL)) {
+      (OutNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+  Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
 
   PkgOffset = AmlGetPkgLength (Buffer, &PkgLength);
   if (PkgOffset == 0) {
@@ -552,7 +562,7 @@ AmlParseFieldPkgLen (
              AmlTypeToNodeDataType (ExpectedFormat),
              Buffer,
              PkgOffset,
-             (AML_DATA_NODE**)OutNode
+             (AML_DATA_NODE **)OutNode
              );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
@@ -577,7 +587,7 @@ AmlParseFieldPkgLen (
   statements. The AML_PARSE_FORMAT enum definition lists these constructs
   and the corresponding parsing functions.
 */
-AML_PARSE_FUNCTION mParseType[EAmlParseFormatMax] = {
+AML_PARSE_FUNCTION  mParseType[EAmlParseFormatMax] = {
   NULL,                    // EAmlNone
   AmlParseUIntX,           // EAmlUInt8
   AmlParseUIntX,           // EAmlUInt16
@@ -611,23 +621,24 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlCheckAndParseMethodInvoc (
-  IN  CONST AML_NODE_HEADER     * ParentNode,
-  IN        AML_DATA_NODE       * DataNode,
-  IN  OUT   LIST_ENTRY          * NameSpaceRefList,
-      OUT   AML_OBJECT_NODE    ** OutNode
+  IN  CONST AML_NODE_HEADER  *ParentNode,
+  IN        AML_DATA_NODE    *DataNode,
+  IN  OUT   LIST_ENTRY       *NameSpaceRefList,
+  OUT   AML_OBJECT_NODE      **OutNode
   )
 {
-  EFI_STATUS                Status;
-  AML_NAMESPACE_REF_NODE  * NameSpaceRefNode;
-  AML_OBJECT_NODE         * MethodInvocationNode;
-  AML_STREAM                FStream;
+  EFI_STATUS              Status;
+  AML_NAMESPACE_REF_NODE  *NameSpaceRefNode;
+  AML_OBJECT_NODE         *MethodInvocationNode;
+  AML_STREAM              FStream;
 
   if ((!IS_AML_ROOT_NODE (ParentNode)                     &&
        !IS_AML_OBJECT_NODE (ParentNode))                  ||
       !IS_AML_DATA_NODE (DataNode)                        ||
       (DataNode->DataType != EAmlNodeDataTypeNameString)  ||
       (NameSpaceRefList == NULL)                          ||
-      (OutNode == NULL)) {
+      (OutNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -646,12 +657,12 @@ AmlCheckAndParseMethodInvoc (
 
   // Check whether the NameString is a method invocation.
   NameSpaceRefNode = NULL;
-  Status = AmlIsMethodInvocation (
-              ParentNode,
-              &FStream,
-              NameSpaceRefList,
-              &NameSpaceRefNode
-              );
+  Status           = AmlIsMethodInvocation (
+                       ParentNode,
+                       &FStream,
+                       NameSpaceRefList,
+                       &NameSpaceRefNode
+                       );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     return Status;
@@ -663,7 +674,7 @@ AmlCheckAndParseMethodInvoc (
     // Create a method invocation node.
     Status = AmlCreateMethodInvocationNode (
                NameSpaceRefNode,
-               (AML_DATA_NODE*)DataNode,
+               (AML_DATA_NODE *)DataNode,
                &MethodInvocationNode
                );
     if (EFI_ERROR (Status)) {
@@ -701,17 +712,17 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseArgument (
-  IN      CONST AML_NODE_HEADER     * ParentNode,
-  IN            AML_PARSE_FORMAT      ExpectedFormat,
-  IN  OUT       AML_STREAM          * FStream,
-  IN  OUT       LIST_ENTRY          * NameSpaceRefList,
-      OUT       AML_NODE_HEADER    ** OutNode
+  IN      CONST AML_NODE_HEADER   *ParentNode,
+  IN            AML_PARSE_FORMAT  ExpectedFormat,
+  IN  OUT       AML_STREAM        *FStream,
+  IN  OUT       LIST_ENTRY        *NameSpaceRefList,
+  OUT       AML_NODE_HEADER       **OutNode
   )
 {
-  EFI_STATUS                Status;
-  AML_PARSE_FUNCTION        ParsingFunction;
-  AML_DATA_NODE           * DataNode;
-  AML_OBJECT_NODE         * MethodInvocationNode;
+  EFI_STATUS          Status;
+  AML_PARSE_FUNCTION  ParsingFunction;
+  AML_DATA_NODE       *DataNode;
+  AML_OBJECT_NODE     *MethodInvocationNode;
 
   if ((!IS_AML_ROOT_NODE (ParentNode)         &&
        !IS_AML_OBJECT_NODE (ParentNode))      ||
@@ -720,7 +731,8 @@ AmlParseArgument (
       IS_END_OF_STREAM (FStream)              ||
       !IS_STREAM_FORWARD (FStream)            ||
       (NameSpaceRefList == NULL)              ||
-      (OutNode == NULL)) {
+      (OutNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -746,15 +758,17 @@ AmlParseArgument (
 
   // Check whether the parsed argument is a NameString when an object
   // is expected. In such case, it could be a method invocation.
-  DataNode = (AML_DATA_NODE*)*OutNode;
+  DataNode = (AML_DATA_NODE *)*OutNode;
   if (IS_AML_DATA_NODE (DataNode)                         &&
       (DataNode->DataType == EAmlNodeDataTypeNameString)  &&
-      (ExpectedFormat == EAmlObject)) {
+      (ExpectedFormat == EAmlObject))
+  {
     Status = AmlCheckAndParseMethodInvoc (
                ParentNode,
-               (AML_DATA_NODE*)*OutNode,
+               (AML_DATA_NODE *)*OutNode,
                NameSpaceRefList,
-               &MethodInvocationNode);
+               &MethodInvocationNode
+               );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
       return Status;
@@ -764,7 +778,7 @@ AmlParseArgument (
     // the NameString has been attached to the MethodInvocationNode.
     // Replace the OutNode with the MethodInvocationNode.
     if (MethodInvocationNode != NULL) {
-      *OutNode = (AML_NODE_HEADER*)MethodInvocationNode;
+      *OutNode = (AML_NODE_HEADER *)MethodInvocationNode;
     }
   }
 
@@ -789,20 +803,21 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseByteList (
-  IN      AML_OBJECT_NODE   * BufferNode,
-  IN  OUT AML_STREAM        * FStream
+  IN      AML_OBJECT_NODE  *BufferNode,
+  IN  OUT AML_STREAM       *FStream
   )
 {
-  EFI_STATUS          Status;
-  AML_NODE_HEADER   * NewNode;
-  CONST UINT8       * Buffer;
-  UINT32              BufferSize;
+  EFI_STATUS       Status;
+  AML_NODE_HEADER  *NewNode;
+  CONST UINT8      *Buffer;
+  UINT32           BufferSize;
 
   // Check whether the node is an Object Node and has byte list.
   if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST)  ||
       !IS_STREAM (FStream)                                  ||
       IS_END_OF_STREAM (FStream)                            ||
-      !IS_STREAM_FORWARD (FStream)) {
+      !IS_STREAM_FORWARD (FStream))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -820,14 +835,14 @@ AmlParseByteList (
     // Create a single node holding the whole buffer data.
 
     // CreateDataNode checks the Buffer and BufferSize values.
-    Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+    Buffer     = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
     BufferSize = AmlStreamGetFreeSpace (FStream);
 
     Status = AmlCreateDataNode (
                EAmlNodeDataTypeRaw,
                Buffer,
                BufferSize,
-               (AML_DATA_NODE**)&NewNode
+               (AML_DATA_NODE **)&NewNode
                );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
@@ -835,9 +850,9 @@ AmlParseByteList (
     }
 
     Status = AmlVarListAddTailInternal (
-                (AML_NODE_HEADER*)BufferNode,
-                NewNode
-                );
+               (AML_NODE_HEADER *)BufferNode,
+               NewNode
+               );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
       AmlDeleteTree (NewNode);
@@ -877,19 +892,19 @@ AmlParseByteList (
 EFI_STATUS
 EFIAPI
 AmlParseFixedArguments (
-  IN  AML_OBJECT_NODE   * ObjectNode,
-  IN  AML_STREAM        * FStream,
-  IN  LIST_ENTRY        * NameSpaceRefList
+  IN  AML_OBJECT_NODE  *ObjectNode,
+  IN  AML_STREAM       *FStream,
+  IN  LIST_ENTRY       *NameSpaceRefList
   )
 {
-  EFI_STATUS                Status;
+  EFI_STATUS  Status;
 
-  AML_NODE_HEADER         * FixedArgNode;
-  AML_STREAM                FixedArgFStream;
+  AML_NODE_HEADER  *FixedArgNode;
+  AML_STREAM       FixedArgFStream;
 
-  EAML_PARSE_INDEX          TermIndex;
-  EAML_PARSE_INDEX          MaxIndex;
-  CONST AML_PARSE_FORMAT  * Format;
+  EAML_PARSE_INDEX        TermIndex;
+  EAML_PARSE_INDEX        MaxIndex;
+  CONST AML_PARSE_FORMAT  *Format;
 
   // Fixed arguments of method invocations node are handled differently.
   if (!IS_AML_OBJECT_NODE (ObjectNode)                              ||
@@ -897,17 +912,19 @@ AmlParseFixedArguments (
       !IS_STREAM (FStream)                                          ||
       IS_END_OF_STREAM (FStream)                                    ||
       !IS_STREAM_FORWARD (FStream)                                  ||
-      (NameSpaceRefList == NULL)) {
+      (NameSpaceRefList == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   TermIndex = EAmlParseIndexTerm0;
-  MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
-                                 (AML_OBJECT_NODE*)ObjectNode
-                                 );
+  MaxIndex  = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
+                                  (AML_OBJECT_NODE *)ObjectNode
+                                  );
   if ((ObjectNode->AmlByteEncoding != NULL)   &&
-      (ObjectNode->AmlByteEncoding->Format != NULL)) {
+      (ObjectNode->AmlByteEncoding->Format != NULL))
+  {
     Format = ObjectNode->AmlByteEncoding->Format;
   } else {
     ASSERT (0);
@@ -917,7 +934,8 @@ AmlParseFixedArguments (
   // Parse all the FixedArgs.
   while ((TermIndex < MaxIndex)       &&
          !IS_END_OF_STREAM (FStream)  &&
-         (Format[TermIndex] != EAmlNone)) {
+         (Format[TermIndex] != EAmlNone))
+  {
     // Initialize a FixedArgStream to parse the current fixed argument.
     Status = AmlStreamInitSubStream (FStream, &FixedArgFStream);
     if (EFI_ERROR (Status)) {
@@ -927,7 +945,7 @@ AmlParseFixedArguments (
 
     // Parse the current fixed argument.
     Status = AmlParseArgument (
-               (CONST AML_NODE_HEADER*)ObjectNode,
+               (CONST AML_NODE_HEADER *)ObjectNode,
                Format[TermIndex],
                &FixedArgFStream,
                NameSpaceRefList,
@@ -941,7 +959,7 @@ AmlParseFixedArguments (
     // Add the fixed argument to the parent node's fixed argument list.
     // FixedArgNode can be an object or data node.
     Status = AmlSetFixedArgument (
-               (AML_OBJECT_NODE*)ObjectNode,
+               (AML_OBJECT_NODE *)ObjectNode,
                TermIndex,
                FixedArgNode
                );
@@ -957,7 +975,8 @@ AmlParseFixedArguments (
 
     // Parse the AML bytecode of the FixedArgNode if this is an object node.
     if (IS_AML_OBJECT_NODE (FixedArgNode) &&
-        !IS_END_OF_STREAM (&FixedArgFStream)) {
+        !IS_END_OF_STREAM (&FixedArgFStream))
+    {
       Status = AmlParseStream (
                  FixedArgNode,
                  &FixedArgFStream,
@@ -1011,34 +1030,35 @@ AmlParseFixedArguments (
 EFI_STATUS
 EFIAPI
 AmlParseVariableArguments (
-  IN  AML_NODE_HEADER   * Node,
-  IN  AML_STREAM        * FStream,
-  IN  LIST_ENTRY        * NameSpaceRefList
+  IN  AML_NODE_HEADER  *Node,
+  IN  AML_STREAM       *FStream,
+  IN  LIST_ENTRY       *NameSpaceRefList
   )
 {
-  EFI_STATUS                Status;
+  EFI_STATUS  Status;
 
-  BOOLEAN                   IsMethodInvocation;
-  UINT8                     MethodInvocationArgCount;
+  BOOLEAN  IsMethodInvocation;
+  UINT8    MethodInvocationArgCount;
 
-  AML_NODE_HEADER         * VarArgNode;
-  AML_STREAM                VarArgFStream;
+  AML_NODE_HEADER  *VarArgNode;
+  AML_STREAM       VarArgFStream;
 
   if ((!AmlNodeHasAttribute (
-          (CONST AML_OBJECT_NODE*)Node,
+          (CONST AML_OBJECT_NODE *)Node,
           AML_HAS_CHILD_OBJ
           ) &&
        !IS_AML_ROOT_NODE (Node))        ||
       !IS_STREAM (FStream)              ||
       IS_END_OF_STREAM (FStream)        ||
       !IS_STREAM_FORWARD (FStream)      ||
-      (NameSpaceRefList == NULL)) {
+      (NameSpaceRefList == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   Status = AmlGetMethodInvocationArgCount (
-             (CONST AML_OBJECT_NODE*)Node,
+             (CONST AML_OBJECT_NODE *)Node,
              &IsMethodInvocation,
              &MethodInvocationArgCount
              );
@@ -1077,7 +1097,7 @@ AmlParseVariableArguments (
     // Add the variable argument to its parent variable list of arguments.
     // VarArgNode can be an object or data node.
     Status = AmlVarListAddTailInternal (
-               (AML_NODE_HEADER*)Node,
+               (AML_NODE_HEADER *)Node,
                VarArgNode
                );
     if (EFI_ERROR (Status)) {
@@ -1092,7 +1112,8 @@ AmlParseVariableArguments (
 
     // Parse the AML bytecode of the VarArgNode if this is an object node.
     if (IS_AML_OBJECT_NODE (VarArgNode)       &&
-        (!IS_END_OF_STREAM (&VarArgFStream))) {
+        (!IS_END_OF_STREAM (&VarArgFStream)))
+    {
       Status = AmlParseStream (VarArgNode, &VarArgFStream, NameSpaceRefList);
       if (EFI_ERROR (Status)) {
         ASSERT (0);
@@ -1139,25 +1160,26 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlPopulateRootNode (
-  IN      AML_ROOT_NODE     * RootNode,
-  IN  OUT AML_STREAM        * FStream,
-  IN  OUT LIST_ENTRY        * NameSpaceRefList
+  IN      AML_ROOT_NODE  *RootNode,
+  IN  OUT AML_STREAM     *FStream,
+  IN  OUT LIST_ENTRY     *NameSpaceRefList
   )
 {
-  EFI_STATUS      Status;
+  EFI_STATUS  Status;
 
   if (!IS_AML_ROOT_NODE (RootNode)  ||
       !IS_STREAM (FStream)          ||
       IS_END_OF_STREAM (FStream)    ||
       !IS_STREAM_FORWARD (FStream)  ||
-      (NameSpaceRefList == NULL)) {
+      (NameSpaceRefList == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   // A Root Node only has variable arguments.
   Status = AmlParseVariableArguments (
-             (AML_NODE_HEADER*)RootNode,
+             (AML_NODE_HEADER *)RootNode,
              FStream,
              NameSpaceRefList
              );
@@ -1184,18 +1206,19 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlPopulateObjectNode (
-  IN      AML_OBJECT_NODE   * ObjectNode,
-  IN  OUT AML_STREAM        * FStream,
-  IN  OUT LIST_ENTRY        * NameSpaceRefList
+  IN      AML_OBJECT_NODE  *ObjectNode,
+  IN  OUT AML_STREAM       *FStream,
+  IN  OUT LIST_ENTRY       *NameSpaceRefList
   )
 {
-  EFI_STATUS      Status;
+  EFI_STATUS  Status;
 
   if (!IS_AML_OBJECT_NODE (ObjectNode)  ||
       !IS_STREAM (FStream)              ||
       IS_END_OF_STREAM (FStream)        ||
       !IS_STREAM_FORWARD (FStream)      ||
-      (NameSpaceRefList == NULL)) {
+      (NameSpaceRefList == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -1230,10 +1253,12 @@ AmlPopulateObjectNode (
   // This allows to identify method invocations from other namespace
   // paths. Method invocation need to be parsed differently.
   if (AmlNodeHasAttribute (
-         (CONST AML_OBJECT_NODE*)ObjectNode,
-         AML_IN_NAMESPACE)) {
+        (CONST AML_OBJECT_NODE *)ObjectNode,
+        AML_IN_NAMESPACE
+        ))
+  {
     Status = AmlAddNameSpaceReference (
-               (CONST AML_OBJECT_NODE*)ObjectNode,
+               (CONST AML_OBJECT_NODE *)ObjectNode,
                NameSpaceRefList
                );
     if (EFI_ERROR (Status)) {
@@ -1246,23 +1271,23 @@ AmlPopulateObjectNode (
     // Parse the variable list of arguments if present.
     if (AmlNodeHasAttribute (ObjectNode, AML_HAS_CHILD_OBJ)) {
       Status = AmlParseVariableArguments (
-                (AML_NODE_HEADER*)ObjectNode,
-                FStream,
-                NameSpaceRefList
-                );
+                 (AML_NODE_HEADER *)ObjectNode,
+                 FStream,
+                 NameSpaceRefList
+                 );
     } else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_BYTE_LIST)) {
       // Parse the byte list if present.
       Status = AmlParseByteList (
-                ObjectNode,
-                FStream
-                );
+                 ObjectNode,
+                 FStream
+                 );
     } else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_FIELD_LIST)) {
       // Parse the field list if present.
       Status = AmlParseFieldList (
-                ObjectNode,
-                FStream,
-                NameSpaceRefList
-                );
+                 ObjectNode,
+                 FStream,
+                 NameSpaceRefList
+                 );
     }
 
     // Check status and assert
@@ -1292,33 +1317,31 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlParseStream (
-  IN  AML_NODE_HEADER   * Node,
-  IN  AML_STREAM        * FStream,
-  IN  LIST_ENTRY        * NameSpaceRefList
+  IN  AML_NODE_HEADER  *Node,
+  IN  AML_STREAM       *FStream,
+  IN  LIST_ENTRY       *NameSpaceRefList
   )
 {
-  EFI_STATUS    Status;
+  EFI_STATUS  Status;
 
   if (IS_AML_ROOT_NODE (Node)) {
     Status = AmlPopulateRootNode (
-               (AML_ROOT_NODE*)Node,
+               (AML_ROOT_NODE *)Node,
                FStream,
                NameSpaceRefList
                );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
     }
-
   } else if (IS_AML_OBJECT_NODE (Node)) {
     Status = AmlPopulateObjectNode (
-               (AML_OBJECT_NODE*)Node,
+               (AML_OBJECT_NODE *)Node,
                FStream,
                NameSpaceRefList
                );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
     }
-
   } else {
     // Data node or other.
     ASSERT (0);
@@ -1346,37 +1369,39 @@ AmlParseStream (
 EFI_STATUS
 EFIAPI
 AmlParseDefinitionBlock (
-  IN  CONST EFI_ACPI_DESCRIPTION_HEADER   * DefinitionBlock,
-  OUT       AML_ROOT_NODE                ** RootPtr
+  IN  CONST EFI_ACPI_DESCRIPTION_HEADER  *DefinitionBlock,
+  OUT       AML_ROOT_NODE                **RootPtr
   )
 {
-  EFI_STATUS              Status;
-  EFI_STATUS              Status1;
-  AML_STREAM              Stream;
-  AML_ROOT_NODE         * Root;
+  EFI_STATUS     Status;
+  EFI_STATUS     Status1;
+  AML_STREAM     Stream;
+  AML_ROOT_NODE  *Root;
 
-  LIST_ENTRY              NameSpaceRefList;
+  LIST_ENTRY  NameSpaceRefList;
 
-  UINT8                 * Buffer;
-  UINT32                  MaxBufferSize;
+  UINT8   *Buffer;
+  UINT32  MaxBufferSize;
 
   if ((DefinitionBlock == NULL)   ||
-      (RootPtr == NULL)) {
+      (RootPtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  Buffer = (UINT8*)DefinitionBlock + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+  Buffer = (UINT8 *)DefinitionBlock + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
   if (DefinitionBlock->Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
+
   MaxBufferSize = DefinitionBlock->Length -
-                    (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+                  (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
 
   // Create a root node.
   Status = AmlCreateRootNode (
-             (EFI_ACPI_DESCRIPTION_HEADER*)DefinitionBlock,
+             (EFI_ACPI_DESCRIPTION_HEADER *)DefinitionBlock,
              &Root
              );
   if (EFI_ERROR (Status)) {
@@ -1408,7 +1433,7 @@ AmlParseDefinitionBlock (
 
   // Parse the whole AML blob.
   Status = AmlParseStream (
-             (AML_NODE_HEADER*)Root,
+             (AML_NODE_HEADER *)Root,
              &Stream,
              &NameSpaceRefList
              );
@@ -1432,7 +1457,7 @@ AmlParseDefinitionBlock (
 
 error_handler:
   if (Root != NULL) {
-    AmlDeleteTree ((AML_NODE_HEADER*)Root);
+    AmlDeleteTree ((AML_NODE_HEADER *)Root);
   }
 
 exit_handler:

+ 6 - 6
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.h

@@ -33,9 +33,9 @@
 EFI_STATUS
 EFIAPI
 AmlParseFixedArguments (
-  IN  AML_OBJECT_NODE   * ObjectNode,
-  IN  AML_STREAM        * FStream,
-  IN  LIST_ENTRY        * NameSpaceRefList
+  IN  AML_OBJECT_NODE  *ObjectNode,
+  IN  AML_STREAM       *FStream,
+  IN  LIST_ENTRY       *NameSpaceRefList
   );
 
 /** Parse the variable list of arguments of the input ObjectNode.
@@ -64,9 +64,9 @@ AmlParseFixedArguments (
 EFI_STATUS
 EFIAPI
 AmlParseVariableArguments (
-  IN  AML_NODE_HEADER   * Node,
-  IN  AML_STREAM        * FStream,
-  IN  LIST_ENTRY        * NameSpaceRefList
+  IN  AML_NODE_HEADER  *Node,
+  IN  AML_STREAM       *FStream,
+  IN  LIST_ENTRY       *NameSpaceRefList
   );
 
 #endif // AML_PARSER_H_

+ 58 - 39
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c

@@ -36,19 +36,20 @@
 UINT32
 EFIAPI
 AmlRdStreamGetRdSize (
-  IN  CONST AML_STREAM    * FStream
+  IN  CONST AML_STREAM  *FStream
   )
 {
-  CONST AML_RD_HEADER   * CurrRdElement;
+  CONST AML_RD_HEADER  *CurrRdElement;
 
   if (!IS_STREAM (FStream)        ||
       IS_END_OF_STREAM (FStream)  ||
-      !IS_STREAM_FORWARD (FStream)) {
+      !IS_STREAM_FORWARD (FStream))
+  {
     ASSERT (0);
     return 0;
   }
 
-  CurrRdElement = (CONST AML_RD_HEADER*)AmlStreamGetCurrPos (FStream);
+  CurrRdElement = (CONST AML_RD_HEADER *)AmlStreamGetCurrPos (FStream);
   if (CurrRdElement == NULL) {
     ASSERT (0);
     return 0;
@@ -57,7 +58,8 @@ AmlRdStreamGetRdSize (
   // If the resource data element is of the large type, check for overflow.
   if (AML_RD_IS_LARGE (CurrRdElement) &&
       (AmlStreamGetFreeSpace (FStream) <
-         sizeof (ACPI_LARGE_RESOURCE_HEADER))) {
+       sizeof (ACPI_LARGE_RESOURCE_HEADER)))
+  {
     return 0;
   }
 
@@ -86,15 +88,16 @@ STATIC
 BOOLEAN
 EFIAPI
 AmlRdCheckFunctionDescNesting (
-  IN      CONST AML_STREAM    * FStream,
-  IN  OUT       BOOLEAN       * InFunctionDesc
+  IN      CONST AML_STREAM  *FStream,
+  IN  OUT       BOOLEAN     *InFunctionDesc
   )
 {
-  CONST AML_RD_HEADER   * CurrRdElement;
+  CONST AML_RD_HEADER  *CurrRdElement;
 
   if (!IS_STREAM (FStream)        ||
       IS_END_OF_STREAM (FStream)  ||
-      (InFunctionDesc == NULL)) {
+      (InFunctionDesc == NULL))
+  {
     ASSERT (0);
     return FALSE;
   }
@@ -110,7 +113,10 @@ AmlRdCheckFunctionDescNesting (
   if (AmlRdCompareDescId (
         CurrRdElement,
         AML_RD_BUILD_SMALL_DESC_ID (
-          ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME))) {
+          ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME
+          )
+        ))
+  {
     *InFunctionDesc = TRUE;
     return TRUE;
   }
@@ -119,7 +125,10 @@ AmlRdCheckFunctionDescNesting (
   if (AmlRdCompareDescId (
         CurrRdElement,
         AML_RD_BUILD_SMALL_DESC_ID (
-          ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME))) {
+          ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME
+          )
+        ))
+  {
     if (*InFunctionDesc) {
       *InFunctionDesc = FALSE;
       return TRUE;
@@ -155,19 +164,20 @@ AmlRdCheckFunctionDescNesting (
 BOOLEAN
 EFIAPI
 AmlRdIsResourceDataBuffer (
-  IN  CONST AML_STREAM    * FStream
+  IN  CONST AML_STREAM  *FStream
   )
 {
-  EFI_STATUS              Status;
-  UINT32                  FreeSpace;
-  AML_STREAM              SubStream;
-  CONST AML_RD_HEADER   * CurrRdElement;
-  UINT32                  CurrRdElementSize;
-  BOOLEAN                 InFunctionDesc;
+  EFI_STATUS           Status;
+  UINT32               FreeSpace;
+  AML_STREAM           SubStream;
+  CONST AML_RD_HEADER  *CurrRdElement;
+  UINT32               CurrRdElementSize;
+  BOOLEAN              InFunctionDesc;
 
   if (!IS_STREAM (FStream)        ||
       IS_END_OF_STREAM (FStream)  ||
-      !IS_STREAM_FORWARD (FStream)) {
+      !IS_STREAM_FORWARD (FStream))
+  {
     ASSERT (0);
     return FALSE;
   }
@@ -187,19 +197,22 @@ AmlRdIsResourceDataBuffer (
 
   // The first element cannot be an end tag.
   if (AmlRdCompareDescId (
-       CurrRdElement,
-       AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+        CurrRdElement,
+        AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+        ))
+  {
     return FALSE;
   }
 
   InFunctionDesc = FALSE;
   while (TRUE) {
-    FreeSpace = AmlStreamGetFreeSpace (&SubStream);
-    CurrRdElement = AmlStreamGetCurrPos (&SubStream);
+    FreeSpace         = AmlStreamGetFreeSpace (&SubStream);
+    CurrRdElement     = AmlStreamGetCurrPos (&SubStream);
     CurrRdElementSize = AmlRdStreamGetRdSize (&SubStream);
     if ((FreeSpace == 0)          ||
         (CurrRdElement == NULL)   ||
-        (CurrRdElementSize == 0)) {
+        (CurrRdElementSize == 0))
+    {
       return FALSE;
     }
 
@@ -218,7 +231,9 @@ AmlRdIsResourceDataBuffer (
     // Thus the function should have already returned.
     if (AmlRdCompareDescId (
           CurrRdElement,
-          AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+          AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+          ))
+    {
       return FALSE;
     }
 
@@ -252,21 +267,22 @@ AmlRdIsResourceDataBuffer (
 EFI_STATUS
 EFIAPI
 AmlParseResourceData (
-  IN  AML_OBJECT_NODE   * BufferNode,
-  IN  AML_STREAM        * FStream
+  IN  AML_OBJECT_NODE  *BufferNode,
+  IN  AML_STREAM       *FStream
   )
 {
-  EFI_STATUS              Status;
-  AML_DATA_NODE         * NewNode;
-  UINT32                  FreeSpace;
-  CONST AML_RD_HEADER   * CurrRdElement;
-  UINT32                  CurrRdElementSize;
+  EFI_STATUS           Status;
+  AML_DATA_NODE        *NewNode;
+  UINT32               FreeSpace;
+  CONST AML_RD_HEADER  *CurrRdElement;
+  UINT32               CurrRdElementSize;
 
   // Check that BufferNode is an ObjectNode and has a ByteList.
   if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST)  ||
       !IS_STREAM (FStream)                                  ||
       IS_END_OF_STREAM (FStream)                            ||
-      !IS_STREAM_FORWARD (FStream)) {
+      !IS_STREAM_FORWARD (FStream))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -280,12 +296,12 @@ AmlParseResourceData (
       break;
     }
 
-    CurrRdElement = (CONST AML_RD_HEADER*)AmlStreamGetCurrPos (FStream);
+    CurrRdElement     = (CONST AML_RD_HEADER *)AmlStreamGetCurrPos (FStream);
     CurrRdElementSize = AmlRdStreamGetRdSize (FStream);
 
     Status = AmlCreateDataNode (
                EAmlNodeDataTypeResourceData,
-               (CONST UINT8*)CurrRdElement,
+               (CONST UINT8 *)CurrRdElement,
                CurrRdElementSize,
                &NewNode
                );
@@ -295,12 +311,12 @@ AmlParseResourceData (
     }
 
     Status = AmlVarListAddTailInternal (
-               (AML_NODE_HEADER*)BufferNode,
-               (AML_NODE_HEADER*)NewNode
+               (AML_NODE_HEADER *)BufferNode,
+               (AML_NODE_HEADER *)NewNode
                );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
-      AmlDeleteTree ((AML_NODE_HEADER*)NewNode);
+      AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
       return Status;
     }
 
@@ -315,11 +331,14 @@ AmlParseResourceData (
     // Exit the loop when finding the resource data end tag.
     if (AmlRdCompareDescId (
           CurrRdElement,
-          AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+          AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+          ))
+    {
       if (FreeSpace != CurrRdElementSize) {
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
+
       break;
     }
   } // while

+ 3 - 4
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h

@@ -40,7 +40,7 @@
 BOOLEAN
 EFIAPI
 AmlRdIsResourceDataBuffer (
-  IN  CONST AML_STREAM    * FStream
+  IN  CONST AML_STREAM  *FStream
   );
 
 /** Parse a ResourceDataBuffer.
@@ -63,9 +63,8 @@ AmlRdIsResourceDataBuffer (
 EFI_STATUS
 EFIAPI
 AmlParseResourceData (
-  IN  AML_OBJECT_NODE   * BufferNode,
-  IN  AML_STREAM        * FStream
+  IN  AML_OBJECT_NODE  *BufferNode,
+  IN  AML_STREAM       *FStream
   );
 
 #endif // AML_RESOURCE_DATA_PARSER_H_
-

+ 15 - 13
DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.c

@@ -28,8 +28,8 @@
 BOOLEAN
 EFIAPI
 AmlRdCompareDescId (
-  IN  CONST AML_RD_HEADER   * Header,
-  IN        AML_RD_HEADER     DescriptorId
+  IN  CONST AML_RD_HEADER  *Header,
+  IN        AML_RD_HEADER  DescriptorId
   )
 {
   if (Header == NULL) {
@@ -56,7 +56,7 @@ AmlRdCompareDescId (
 AML_RD_HEADER
 EFIAPI
 AmlRdGetDescId (
-  IN  CONST AML_RD_HEADER   * Header
+  IN  CONST AML_RD_HEADER  *Header
   )
 {
   if (Header == NULL) {
@@ -84,7 +84,7 @@ AmlRdGetDescId (
 UINT32
 EFIAPI
 AmlRdGetSize (
-  IN  CONST AML_RD_HEADER   * Header
+  IN  CONST AML_RD_HEADER  *Header
   )
 {
   if (Header == NULL) {
@@ -93,13 +93,13 @@ AmlRdGetSize (
   }
 
   if (AML_RD_IS_LARGE (Header)) {
-    return ((ACPI_LARGE_RESOURCE_HEADER*)Header)->Length +
-             sizeof (ACPI_LARGE_RESOURCE_HEADER);
+    return ((ACPI_LARGE_RESOURCE_HEADER *)Header)->Length +
+           sizeof (ACPI_LARGE_RESOURCE_HEADER);
   }
 
   // Header is a small resource data element.
-  return ((ACPI_SMALL_RESOURCE_HEADER*)Header)->Bits.Length +
-           sizeof (ACPI_SMALL_RESOURCE_HEADER);
+  return ((ACPI_SMALL_RESOURCE_HEADER *)Header)->Bits.Length +
+         sizeof (ACPI_SMALL_RESOURCE_HEADER);
 }
 
 /** Set the Checksum of an EndTag resource data.
@@ -119,18 +119,20 @@ AmlRdGetSize (
 EFI_STATUS
 EFIAPI
 AmlRdSetEndTagChecksum (
-  IN  CONST AML_RD_HEADER   * Header,
-  IN        UINT8             CheckSum
+  IN  CONST AML_RD_HEADER  *Header,
+  IN        UINT8          CheckSum
   )
 {
   if ((Header == NULL)  ||
       !AmlRdCompareDescId (
-        Header,
-        AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+         Header,
+         AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+         ))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  ((EFI_ACPI_END_TAG_DESCRIPTOR*)Header)->Checksum = CheckSum;
+  ((EFI_ACPI_END_TAG_DESCRIPTOR *)Header)->Checksum = CheckSum;
   return EFI_SUCCESS;
 }

+ 9 - 9
DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.h

@@ -58,19 +58,19 @@ typedef UINT8 AML_RD_HEADER;
 
   @ingroup ResourceDataStructures
 */
-#define AML_RD_SMALL_SIZE_MASK    (0x7U)
+#define AML_RD_SMALL_SIZE_MASK  (0x7U)
 
 /** Mask for the small resource data ID.
 
   @ingroup ResourceDataStructures
 */
-#define AML_RD_SMALL_ID_MASK      (0xFU << 3)
+#define AML_RD_SMALL_ID_MASK  (0xFU << 3)
 
 /** Mask for the large resource data ID.
 
   @ingroup ResourceDataStructures
 */
-#define AML_RD_LARGE_ID_MASK      (0x7FU)
+#define AML_RD_LARGE_ID_MASK  (0x7FU)
 
 /**
   @defgroup ResourceDataApis Resource data APIs
@@ -133,8 +133,8 @@ typedef UINT8 AML_RD_HEADER;
 BOOLEAN
 EFIAPI
 AmlRdCompareDescId (
-  IN  CONST AML_RD_HEADER   * Header,
-  IN        AML_RD_HEADER     DescriptorId
+  IN  CONST AML_RD_HEADER  *Header,
+  IN        AML_RD_HEADER  DescriptorId
   );
 
 /** Get the descriptor Id of the resource data.
@@ -151,7 +151,7 @@ AmlRdCompareDescId (
 AML_RD_HEADER
 EFIAPI
 AmlRdGetDescId (
-  IN  CONST AML_RD_HEADER   * Header
+  IN  CONST AML_RD_HEADER  *Header
   );
 
 /** Get the size of a resource data element.
@@ -168,7 +168,7 @@ AmlRdGetDescId (
 UINT32
 EFIAPI
 AmlRdGetSize (
-  IN  CONST AML_RD_HEADER   * Header
+  IN  CONST AML_RD_HEADER  *Header
   );
 
 /** Set the Checksum of an EndTag resource data.
@@ -188,8 +188,8 @@ AmlRdGetSize (
 EFI_STATUS
 EFIAPI
 AmlRdSetEndTagChecksum (
-  IN  CONST AML_RD_HEADER   * Header,
-  IN        UINT8             CheckSum
+  IN  CONST AML_RD_HEADER  *Header,
+  IN        UINT8          CheckSum
   );
 
 #endif // AML_RESOURCE_DATA_H_

+ 59 - 52
DynamicTablesPkg/Library/Common/AmlLib/Serialize/AmlSerialize.c

@@ -38,29 +38,30 @@ STATIC
 BOOLEAN
 EFIAPI
 AmlSerializeNodeCallback (
-  IN       AML_NODE_HEADER   * Node,
-  IN  OUT  VOID              * Context     OPTIONAL,
-  IN  OUT  EFI_STATUS        * Status      OPTIONAL
+  IN       AML_NODE_HEADER  *Node,
+  IN  OUT  VOID             *Context     OPTIONAL,
+  IN  OUT  EFI_STATUS       *Status      OPTIONAL
   )
 {
-  EFI_STATUS                Status1;
+  EFI_STATUS  Status1;
 
-  CONST AML_DATA_NODE     * DataNode;
-  CONST AML_OBJECT_NODE   * ObjectNode;
-  AML_STREAM              * FStream;
+  CONST AML_DATA_NODE    *DataNode;
+  CONST AML_OBJECT_NODE  *ObjectNode;
+  AML_STREAM             *FStream;
 
   // Bytes needed to store OpCode[1] + SubOpcode[1] + MaxPkgLen[4] = 6 bytes.
-  UINT8                     ObjectNodeInfoArray[6];
-  UINT32                    Index;
-  BOOLEAN                   ContinueEnum;
+  UINT8    ObjectNodeInfoArray[6];
+  UINT32   Index;
+  BOOLEAN  ContinueEnum;
 
-  CONST AML_OBJECT_NODE   * ParentNode;
-  EAML_PARSE_INDEX          IndexPtr;
+  CONST AML_OBJECT_NODE  *ParentNode;
+  EAML_PARSE_INDEX       IndexPtr;
 
   if (!IS_AML_NODE_VALID (Node)   ||
-      (Context == NULL)) {
+      (Context == NULL))
+  {
     ASSERT (0);
-    Status1 = EFI_INVALID_PARAMETER;
+    Status1      = EFI_INVALID_PARAMETER;
     ContinueEnum = FALSE;
     goto error_handler;
   }
@@ -68,44 +69,47 @@ AmlSerializeNodeCallback (
   // Ignore the second fixed argument of method invocation nodes
   // as the information stored there (the argument count) is not in the
   // ACPI specification.
-  ParentNode = (CONST AML_OBJECT_NODE*)AmlGetParent ((AML_NODE_HEADER*)Node);
+  ParentNode = (CONST AML_OBJECT_NODE *)AmlGetParent ((AML_NODE_HEADER *)Node);
   if (IS_AML_OBJECT_NODE (ParentNode)                             &&
       AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0)   &&
-      AmlIsNodeFixedArgument (Node, &IndexPtr)) {
+      AmlIsNodeFixedArgument (Node, &IndexPtr))
+  {
     if (IndexPtr == EAmlParseIndexTerm1) {
       if (Status != NULL) {
         *Status = EFI_SUCCESS;
       }
+
       return TRUE;
     }
   }
 
-  Status1 = EFI_SUCCESS;
+  Status1      = EFI_SUCCESS;
   ContinueEnum = TRUE;
-  FStream = (AML_STREAM*)Context;
+  FStream      = (AML_STREAM *)Context;
 
   if (IS_AML_DATA_NODE (Node)) {
     // Copy the content of the Buffer for a DataNode.
-    DataNode = (AML_DATA_NODE*)Node;
-    Status1 = AmlStreamWrite (
-                FStream,
-                DataNode->Buffer,
-                DataNode->Size
-                );
+    DataNode = (AML_DATA_NODE *)Node;
+    Status1  = AmlStreamWrite (
+                 FStream,
+                 DataNode->Buffer,
+                 DataNode->Size
+                 );
     if (EFI_ERROR (Status1)) {
       ASSERT (0);
       ContinueEnum = FALSE;
       goto error_handler;
     }
-
   } else if (IS_AML_OBJECT_NODE (Node)  &&
              !AmlNodeHasAttribute (
-                (CONST AML_OBJECT_NODE*)Node,
-                AML_IS_PSEUDO_OPCODE)) {
+                (CONST AML_OBJECT_NODE *)Node,
+                AML_IS_PSEUDO_OPCODE
+                ))
+  {
     // Ignore pseudo-opcodes as they are not part of the
     // ACPI specification.
 
-    ObjectNode = (AML_OBJECT_NODE*)Node;
+    ObjectNode = (AML_OBJECT_NODE *)Node;
 
     Index = 0;
     // Copy the opcode(s).
@@ -138,6 +142,7 @@ error_handler:
   if (Status != NULL) {
     *Status = Status1;
   }
+
   return ContinueEnum;
 }
 
@@ -169,26 +174,27 @@ error_handler:
 EFI_STATUS
 EFIAPI
 AmlSerializeTree (
-  IN      AML_ROOT_NODE   * RootNode,
-  IN      UINT8           * Buffer      OPTIONAL,
-  IN  OUT UINT32          * BufferSize
+  IN      AML_ROOT_NODE  *RootNode,
+  IN      UINT8          *Buffer      OPTIONAL,
+  IN  OUT UINT32         *BufferSize
   )
 {
-  EFI_STATUS    Status;
-  AML_STREAM    FStream;
-  UINT32        TableSize;
+  EFI_STATUS  Status;
+  AML_STREAM  FStream;
+  UINT32      TableSize;
 
   if (!IS_AML_ROOT_NODE (RootNode) ||
-      (BufferSize == NULL)) {
+      (BufferSize == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   // Compute the total size of the AML blob.
   Status = AmlComputeSize (
-              (CONST AML_NODE_HEADER*)RootNode,
-              &TableSize
-              );
+             (CONST AML_NODE_HEADER *)RootNode,
+             &TableSize
+             );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     return Status;
@@ -226,7 +232,7 @@ AmlSerializeTree (
   // Serialize the header.
   Status = AmlStreamWrite (
              &FStream,
-             (UINT8*)RootNode->SdtHeader,
+             (UINT8 *)RootNode->SdtHeader,
              sizeof (EFI_ACPI_DESCRIPTION_HEADER)
              );
   if (EFI_ERROR (Status)) {
@@ -236,9 +242,9 @@ AmlSerializeTree (
 
   Status = EFI_SUCCESS;
   AmlEnumTree (
-    (AML_NODE_HEADER*)RootNode,
+    (AML_NODE_HEADER *)RootNode,
     AmlSerializeNodeCallback,
-    (VOID*)&FStream,
+    (VOID *)&FStream,
     &Status
     );
   if (EFI_ERROR (Status)) {
@@ -247,7 +253,7 @@ AmlSerializeTree (
   }
 
   // Update the checksum.
-  return AcpiPlatformChecksum ((EFI_ACPI_DESCRIPTION_HEADER*)Buffer);
+  return AcpiPlatformChecksum ((EFI_ACPI_DESCRIPTION_HEADER *)Buffer);
 }
 
 /** Serialize an AML definition block.
@@ -267,23 +273,24 @@ AmlSerializeTree (
 EFI_STATUS
 EFIAPI
 AmlSerializeDefinitionBlock (
-  IN  AML_ROOT_NODE                   * RootNode,
-  OUT EFI_ACPI_DESCRIPTION_HEADER    ** Table
+  IN  AML_ROOT_NODE                *RootNode,
+  OUT EFI_ACPI_DESCRIPTION_HEADER  **Table
   )
 {
-  EFI_STATUS    Status;
-  UINT8       * TableBuffer;
-  UINT32        TableSize;
+  EFI_STATUS  Status;
+  UINT8       *TableBuffer;
+  UINT32      TableSize;
 
   if (!IS_AML_ROOT_NODE (RootNode) ||
-      (Table == NULL)) {
+      (Table == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  *Table = NULL;
+  *Table      = NULL;
   TableBuffer = NULL;
-  TableSize = 0;
+  TableSize   = 0;
 
   // Get the size of the SSDT table.
   Status = AmlSerializeTree (
@@ -296,7 +303,7 @@ AmlSerializeDefinitionBlock (
     return Status;
   }
 
-  TableBuffer = (UINT8*)AllocateZeroPool (TableSize);
+  TableBuffer = (UINT8 *)AllocateZeroPool (TableSize);
   if (TableBuffer == NULL) {
     DEBUG ((
       DEBUG_ERROR,
@@ -317,7 +324,7 @@ AmlSerializeDefinitionBlock (
     ASSERT (0);
   } else {
     // Save the allocated Table buffer in the table list
-    *Table = (EFI_ACPI_DESCRIPTION_HEADER*)TableBuffer;
+    *Table = (EFI_ACPI_DESCRIPTION_HEADER *)TableBuffer;
   }
 
   return Status;

+ 85 - 69
DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.c

@@ -23,25 +23,26 @@
 EFI_STATUS
 EFIAPI
 AmlStreamInit (
-  IN  OUT AML_STREAM              * Stream,
-  IN      UINT8                   * Buffer,
-  IN      UINT32                    MaxBufferSize,
-  IN      EAML_STREAM_DIRECTION     Direction
+  IN  OUT AML_STREAM             *Stream,
+  IN      UINT8                  *Buffer,
+  IN      UINT32                 MaxBufferSize,
+  IN      EAML_STREAM_DIRECTION  Direction
   )
 {
   if ((Stream == NULL)                            ||
       (Buffer == NULL)                            ||
       (MaxBufferSize == 0)                        ||
       ((Direction != EAmlStreamDirectionForward)  &&
-       (Direction != EAmlStreamDirectionBackward))) {
+       (Direction != EAmlStreamDirectionBackward)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  Stream->Buffer = Buffer;
+  Stream->Buffer        = Buffer;
   Stream->MaxBufferSize = MaxBufferSize;
-  Stream->Index = 0;
-  Stream->Direction = Direction;
+  Stream->Index         = 0;
+  Stream->Direction     = Direction;
 
   return EFI_SUCCESS;
 }
@@ -60,20 +61,21 @@ AmlStreamInit (
 EFI_STATUS
 EFIAPI
 AmlStreamClone (
-  IN  CONST AML_STREAM    * Stream,
-  OUT        AML_STREAM   * ClonedStream
+  IN  CONST AML_STREAM   *Stream,
+  OUT        AML_STREAM  *ClonedStream
   )
 {
   if (!IS_STREAM (Stream)   ||
-      (ClonedStream == NULL)) {
+      (ClonedStream == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  ClonedStream->Buffer = Stream->Buffer;
+  ClonedStream->Buffer        = Stream->Buffer;
   ClonedStream->MaxBufferSize = Stream->MaxBufferSize;
-  ClonedStream->Index = Stream->Index;
-  ClonedStream->Direction = Stream->Direction;
+  ClonedStream->Index         = Stream->Index;
+  ClonedStream->Direction     = Stream->Direction;
 
   return EFI_SUCCESS;
 }
@@ -105,12 +107,13 @@ AmlStreamClone (
 EFI_STATUS
 EFIAPI
 AmlStreamInitSubStream (
-  IN  CONST AML_STREAM  * Stream,
-  OUT       AML_STREAM  * SubStream
+  IN  CONST AML_STREAM  *Stream,
+  OUT       AML_STREAM  *SubStream
   )
 {
   if (!IS_STREAM (Stream) ||
-      (SubStream == NULL)) {
+      (SubStream == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -125,8 +128,8 @@ AmlStreamInitSubStream (
   }
 
   SubStream->MaxBufferSize = AmlStreamGetFreeSpace (Stream);
-  SubStream->Index = 0;
-  SubStream->Direction = Stream->Direction;
+  SubStream->Index         = 0;
+  SubStream->Direction     = Stream->Direction;
 
   return EFI_SUCCESS;
 }
@@ -141,13 +144,14 @@ AmlStreamInitSubStream (
 UINT8 *
 EFIAPI
 AmlStreamGetBuffer (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   )
 {
   if (!IS_STREAM (Stream)) {
     ASSERT (0);
     return NULL;
   }
+
   return Stream->Buffer;
 }
 
@@ -161,13 +165,14 @@ AmlStreamGetBuffer (
 UINT32
 EFIAPI
 AmlStreamGetMaxBufferSize (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   )
 {
   if (!IS_STREAM (Stream)) {
     ASSERT (0);
     return 0;
   }
+
   return Stream->MaxBufferSize;
 }
 
@@ -183,13 +188,14 @@ AmlStreamGetMaxBufferSize (
 EFI_STATUS
 EFIAPI
 AmlStreamReduceMaxBufferSize (
-  IN  AML_STREAM  * Stream,
-  IN  UINT32        Diff
+  IN  AML_STREAM  *Stream,
+  IN  UINT32      Diff
   )
 {
   if (!IS_STREAM (Stream)       ||
       (Diff == 0)               ||
-      ((Stream->MaxBufferSize - Diff) <= Stream->Index)) {
+      ((Stream->MaxBufferSize - Diff) <= Stream->Index))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -214,13 +220,14 @@ AmlStreamReduceMaxBufferSize (
 UINT32
 EFIAPI
 AmlStreamGetIndex (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   )
 {
   if (!IS_STREAM (Stream)) {
     ASSERT (0);
     return 0;
   }
+
   return Stream->Index;
 }
 
@@ -234,13 +241,14 @@ AmlStreamGetIndex (
 EAML_STREAM_DIRECTION
 EFIAPI
 AmlStreamGetDirection (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   )
 {
   if (!IS_STREAM (Stream)) {
     ASSERT (0);
     return EAmlStreamDirectionInvalid;
   }
+
   return Stream->Direction;
 }
 
@@ -254,7 +262,7 @@ AmlStreamGetDirection (
 UINT8 *
 EFIAPI
 AmlStreamGetCurrPos (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   )
 {
   if (!IS_STREAM (Stream)) {
@@ -282,7 +290,7 @@ AmlStreamGetCurrPos (
 UINT32
 EFIAPI
 AmlStreamGetFreeSpace (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   )
 {
   if (!IS_STREAM (Stream)) {
@@ -314,13 +322,14 @@ AmlStreamGetFreeSpace (
 EFI_STATUS
 EFIAPI
 AmlStreamProgress (
-  IN  AML_STREAM  * Stream,
-  IN  UINT32        Offset
+  IN  AML_STREAM  *Stream,
+  IN  UINT32      Offset
   )
 {
   if (!IS_STREAM (Stream)         ||
-      IS_END_OF_STREAM  (Stream)  ||
-      (Offset == 0)) {
+      IS_END_OF_STREAM (Stream)  ||
+      (Offset == 0))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -350,12 +359,13 @@ AmlStreamProgress (
 EFI_STATUS
 EFIAPI
 AmlStreamRewind (
-  IN  AML_STREAM  * Stream,
-  IN  UINT32        Offset
+  IN  AML_STREAM  *Stream,
+  IN  UINT32      Offset
   )
 {
   if (!IS_STREAM (Stream) ||
-      (Offset == 0)) {
+      (Offset == 0))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -380,7 +390,7 @@ AmlStreamRewind (
 EFI_STATUS
 EFIAPI
 AmlStreamReset (
-  IN  AML_STREAM  * Stream
+  IN  AML_STREAM  *Stream
   )
 {
   if (!IS_STREAM (Stream)) {
@@ -409,15 +419,16 @@ AmlStreamReset (
 EFI_STATUS
 EFIAPI
 AmlStreamPeekByte (
-  IN  AML_STREAM  * Stream,
-  OUT UINT8       * OutByte
+  IN  AML_STREAM  *Stream,
+  OUT UINT8       *OutByte
   )
 {
-  UINT8   * CurPos;
+  UINT8  *CurPos;
 
   if (!IS_STREAM (Stream)       ||
       IS_END_OF_STREAM (Stream) ||
-      (OutByte == NULL)) {
+      (OutByte == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -448,15 +459,16 @@ AmlStreamPeekByte (
 EFI_STATUS
 EFIAPI
 AmlStreamReadByte (
-  IN  AML_STREAM  * Stream,
-  OUT UINT8       * OutByte
+  IN  AML_STREAM  *Stream,
+  OUT UINT8       *OutByte
   )
 {
-  EFI_STATUS    Status;
+  EFI_STATUS  Status;
 
   if (!IS_STREAM (Stream)       ||
       IS_END_OF_STREAM (Stream) ||
-      (OutByte == NULL)) {
+      (OutByte == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -498,17 +510,18 @@ AmlStreamReadByte (
 EFI_STATUS
 EFIAPI
 AmlStreamWrite (
-  IN        AML_STREAM  * Stream,
-  IN  CONST UINT8       * Buffer,
-  IN        UINT32        Size
+  IN        AML_STREAM  *Stream,
+  IN  CONST UINT8       *Buffer,
+  IN        UINT32      Size
   )
 {
-  UINT8   * CurrPos;
+  UINT8  *CurrPos;
 
   if (!IS_STREAM (Stream)       ||
       IS_END_OF_STREAM (Stream) ||
       (Buffer == NULL)          ||
-      (Size == 0)) {
+      (Size == 0))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -554,21 +567,22 @@ AmlStreamWrite (
 BOOLEAN
 EFIAPI
 AmlStreamCmp (
-  IN  CONST AML_STREAM    * Stream1,
-  IN  CONST AML_STREAM    * Stream2,
-  IN        UINT32          Size
+  IN  CONST AML_STREAM  *Stream1,
+  IN  CONST AML_STREAM  *Stream2,
+  IN        UINT32      Size
   )
 {
-  UINT32          MinSize;
-  UINT8         * CurrPosStream1;
-  UINT8         * CurrPosStream2;
+  UINT32  MinSize;
+  UINT8   *CurrPosStream1;
+  UINT8   *CurrPosStream2;
 
   if (!IS_STREAM (Stream1)                        ||
       IS_END_OF_STREAM (Stream1)                  ||
       !IS_STREAM (Stream2)                        ||
       IS_END_OF_STREAM (Stream2)                  ||
       (Stream1->Direction != Stream2->Direction)  ||
-      (Size == 0)) {
+      (Size == 0))
+  {
     ASSERT (0);
     return FALSE;
   }
@@ -589,6 +603,7 @@ AmlStreamCmp (
     ASSERT (0);
     return FALSE;
   }
+
   CurrPosStream2 = AmlStreamGetCurrPos (Stream2);
   if (CurrPosStream2 == NULL) {
     ASSERT (0);
@@ -606,10 +621,10 @@ AmlStreamCmp (
   //                               ^
   //                             CurrPos
   return (0 == CompareMem (
-                  CurrPosStream1 - (MinSize - 1),
-                  CurrPosStream2 - (MinSize - 1),
-                  MinSize
-                  ));
+                 CurrPosStream1 - (MinSize - 1),
+                 CurrPosStream2 - (MinSize - 1),
+                 MinSize
+                 ));
 }
 
 /** Copy Size bytes of the stream's data to DstBuffer.
@@ -633,19 +648,20 @@ AmlStreamCmp (
 EFI_STATUS
 EFIAPI
 AmlStreamCpyS (
-  OUT CHAR8         * DstBuffer,
-  IN  UINT32          MaxDstBufferSize,
-  IN  AML_STREAM    * Stream,
-  IN  UINT32          Size
+  OUT CHAR8       *DstBuffer,
+  IN  UINT32      MaxDstBufferSize,
+  IN  AML_STREAM  *Stream,
+  IN  UINT32      Size
   )
 {
-  CHAR8   * StreamBufferStart;
+  CHAR8  *StreamBufferStart;
 
   // Stream is checked in the function call.
   if ((DstBuffer == NULL)       ||
       (MaxDstBufferSize == 0)   ||
       (Size > MaxDstBufferSize) ||
-      (Size > AmlStreamGetMaxBufferSize (Stream))) {
+      (Size > AmlStreamGetMaxBufferSize (Stream)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -655,9 +671,9 @@ AmlStreamCpyS (
   }
 
   // Find the address at which the data is starting.
-  StreamBufferStart = (CHAR8*)(IS_STREAM_FORWARD (Stream) ?
-                                 Stream->Buffer :
-                                 AmlStreamGetCurrPos (Stream));
+  StreamBufferStart = (CHAR8 *)(IS_STREAM_FORWARD (Stream) ?
+                                Stream->Buffer :
+                                AmlStreamGetCurrPos (Stream));
 
   CopyMem (DstBuffer, StreamBufferStart, Size);
 

+ 41 - 41
DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.h

@@ -31,17 +31,17 @@ typedef enum EAmlStreamDirection {
 */
 typedef struct AmlStream {
   /// Pointer to a buffer.
-  UINT8                 * Buffer;
+  UINT8     *Buffer;
 
   /// Size of Buffer.
-  UINT32                  MaxBufferSize;
+  UINT32    MaxBufferSize;
 
   /// Index in the Buffer.
   /// The Index field allows to keep track of how many bytes have been
   /// read/written in the Buffer, and to retrieve the current stream position.
   /// 0 <= Index <= MaxBufferSize.
   /// If Index == MaxBufferSize, no more action is allowed on the stream.
-  UINT32                  Index;
+  UINT32    Index;
 
   /// The direction the stream is progressing.
   /// If the stream goes backward (toward lower addresses), the bytes written
@@ -56,7 +56,7 @@ typedef struct AmlStream {
   ///    +---------------+-----+-----+-----+-----+-----+-----+---- +------+
   ///                       ^
   ///                Current position.
-  EAML_STREAM_DIRECTION   Direction;
+  EAML_STREAM_DIRECTION    Direction;
 } AML_STREAM;
 
 /** Check whether a StreamPtr is a valid Stream.
@@ -88,7 +88,7 @@ typedef struct AmlStream {
   @retval TRUE  Stream goes forward.
   @retval FALSE Otherwise.
 */
-#define IS_STREAM_FORWARD(Stream)   (                                         \
+#define IS_STREAM_FORWARD(Stream)  (                                          \
     ((AML_STREAM*)Stream)->Direction == EAmlStreamDirectionForward)
 
 /** Check Stream goes backward.
@@ -98,7 +98,7 @@ typedef struct AmlStream {
   @retval TRUE  Stream goes backward.
   @retval FALSE Otherwise.
 */
-#define IS_STREAM_BACKWARD(Stream)   (                                        \
+#define IS_STREAM_BACKWARD(Stream)  (                                         \
     ((AML_STREAM*)Stream)->Direction == EAmlStreamDirectionBackward)
 
 /** Initialize a stream.
@@ -116,10 +116,10 @@ typedef struct AmlStream {
 EFI_STATUS
 EFIAPI
 AmlStreamInit (
-  IN  OUT AML_STREAM              * Stream,
-  IN      UINT8                   * Buffer,
-  IN      UINT32                    MaxBufferSize,
-  IN      EAML_STREAM_DIRECTION     Direction
+  IN  OUT AML_STREAM             *Stream,
+  IN      UINT8                  *Buffer,
+  IN      UINT32                 MaxBufferSize,
+  IN      EAML_STREAM_DIRECTION  Direction
   );
 
 /** Clone a stream.
@@ -136,8 +136,8 @@ AmlStreamInit (
 EFI_STATUS
 EFIAPI
 AmlStreamClone (
-  IN  CONST AML_STREAM    * Stream,
-  OUT        AML_STREAM   * ClonedStream
+  IN  CONST AML_STREAM   *Stream,
+  OUT        AML_STREAM  *ClonedStream
   );
 
 /** Initialize a sub-stream from a stream.
@@ -167,8 +167,8 @@ AmlStreamClone (
 EFI_STATUS
 EFIAPI
 AmlStreamInitSubStream (
-  IN  CONST AML_STREAM  * Stream,
-  OUT       AML_STREAM  * SubStream
+  IN  CONST AML_STREAM  *Stream,
+  OUT       AML_STREAM  *SubStream
   );
 
 /** Get the buffer of a stream.
@@ -181,7 +181,7 @@ AmlStreamInitSubStream (
 UINT8 *
 EFIAPI
 AmlStreamGetBuffer (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   );
 
 /** Get the size of Stream's Buffer.
@@ -194,7 +194,7 @@ AmlStreamGetBuffer (
 UINT32
 EFIAPI
 AmlStreamGetMaxBufferSize (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   );
 
 /** Reduce the maximal size of Stream's Buffer (MaxBufferSize field).
@@ -209,8 +209,8 @@ AmlStreamGetMaxBufferSize (
 EFI_STATUS
 EFIAPI
 AmlStreamReduceMaxBufferSize (
-  IN  AML_STREAM  * Stream,
-  IN  UINT32        Diff
+  IN  AML_STREAM  *Stream,
+  IN  UINT32      Diff
   );
 
 /** Get Stream's Index.
@@ -229,7 +229,7 @@ AmlStreamReduceMaxBufferSize (
 UINT32
 EFIAPI
 AmlStreamGetIndex (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   );
 
 /** Get Stream's Direction.
@@ -242,7 +242,7 @@ AmlStreamGetIndex (
 EAML_STREAM_DIRECTION
 EFIAPI
 AmlStreamGetDirection (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   );
 
 /** Return a pointer to the current position in the stream.
@@ -255,7 +255,7 @@ AmlStreamGetDirection (
 UINT8 *
 EFIAPI
 AmlStreamGetCurrPos (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   );
 
 /** Get the space available in the stream.
@@ -268,7 +268,7 @@ AmlStreamGetCurrPos (
 UINT32
 EFIAPI
 AmlStreamGetFreeSpace (
-  IN  CONST AML_STREAM  * Stream
+  IN  CONST AML_STREAM  *Stream
   );
 
 /** Move Stream by Offset bytes.
@@ -287,8 +287,8 @@ AmlStreamGetFreeSpace (
 EFI_STATUS
 EFIAPI
 AmlStreamProgress (
-  IN  AML_STREAM  * Stream,
-  IN  UINT32        Offset
+  IN  AML_STREAM  *Stream,
+  IN  UINT32      Offset
   );
 
 /** Rewind Stream of Offset bytes.
@@ -306,8 +306,8 @@ AmlStreamProgress (
 EFI_STATUS
 EFIAPI
 AmlStreamRewind (
-  IN  AML_STREAM  * Stream,
-  IN  UINT32        Offset
+  IN  AML_STREAM  *Stream,
+  IN  UINT32      Offset
   );
 
 /** Reset the Stream (move the current position to the initial position).
@@ -320,7 +320,7 @@ AmlStreamRewind (
 EFI_STATUS
 EFIAPI
 AmlStreamReset (
-  IN  AML_STREAM  * Stream
+  IN  AML_STREAM  *Stream
   );
 
 /** Peek one byte at Stream's current position.
@@ -339,8 +339,8 @@ AmlStreamReset (
 EFI_STATUS
 EFIAPI
 AmlStreamPeekByte (
-  IN  AML_STREAM  * Stream,
-  OUT UINT8       * OutByte
+  IN  AML_STREAM  *Stream,
+  OUT UINT8       *OutByte
   );
 
 /** Read one byte at Stream's current position.
@@ -359,8 +359,8 @@ AmlStreamPeekByte (
 EFI_STATUS
 EFIAPI
 AmlStreamReadByte (
-  IN  AML_STREAM  * Stream,
-  OUT UINT8       * OutByte
+  IN  AML_STREAM  *Stream,
+  OUT UINT8       *OutByte
   );
 
 /** Write Size bytes in the stream.
@@ -388,9 +388,9 @@ AmlStreamReadByte (
 EFI_STATUS
 EFIAPI
 AmlStreamWrite (
-  IN        AML_STREAM  * Stream,
-  IN  CONST UINT8       * Buffer,
-  IN        UINT32        Size
+  IN        AML_STREAM  *Stream,
+  IN  CONST UINT8       *Buffer,
+  IN        UINT32      Size
   );
 
 /** Compare Size bytes between Stream1 and Stream2 from their
@@ -416,9 +416,9 @@ AmlStreamWrite (
 BOOLEAN
 EFIAPI
 AmlStreamCmp (
-  IN  CONST AML_STREAM    * Stream1,
-  IN  CONST AML_STREAM    * Stream2,
-  IN        UINT32          Size
+  IN  CONST AML_STREAM  *Stream1,
+  IN  CONST AML_STREAM  *Stream2,
+  IN        UINT32      Size
   );
 
 /** Copy Size bytes of the stream's data to DstBuffer.
@@ -442,10 +442,10 @@ AmlStreamCmp (
 EFI_STATUS
 EFIAPI
 AmlStreamCpyS (
-  OUT CHAR8         * DstBuffer,
-  IN  UINT32          MaxDstBufferSize,
-  IN  AML_STREAM    * Stream,
-  IN  UINT32          Size
+  OUT CHAR8       *DstBuffer,
+  IN  UINT32      MaxDstBufferSize,
+  IN  AML_STREAM  *Stream,
+  IN  UINT32      Size
   );
 
 #endif // AML_STREAM_H_

+ 119 - 104
DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.c

@@ -30,18 +30,20 @@
 BOOLEAN
 EFIAPI
 AmlIsNameString (
-  IN  UINT32    Root,
-  IN  UINT32    ParentPrefix,
-  IN  UINT32    SegCount
+  IN  UINT32  Root,
+  IN  UINT32  ParentPrefix,
+  IN  UINT32  SegCount
   )
 {
   if (((Root == 0) || (Root == 1))            &&
       (ParentPrefix <= MAX_UINT8)             &&
       (!((ParentPrefix != 0) && (Root != 0))) &&
       (SegCount <= MAX_UINT8)                 &&
-      ((SegCount + Root + ParentPrefix) != 0)) {
+      ((SegCount + Root + ParentPrefix) != 0))
+  {
     return TRUE;
   }
+
   return FALSE;
 }
 
@@ -61,16 +63,17 @@ AmlIsNameString (
 EFI_STATUS
 EFIAPI
 AmlUpperCaseMemCpyS (
-  OUT       CHAR8   * DstBuffer,
-  IN        UINT32    MaxDstBufferSize,
-  IN  CONST CHAR8   * SrcBuffer,
-  IN        UINT32    Count
+  OUT       CHAR8   *DstBuffer,
+  IN        UINT32  MaxDstBufferSize,
+  IN  CONST CHAR8   *SrcBuffer,
+  IN        UINT32  Count
   )
 {
-  UINT32 Index;
+  UINT32  Index;
 
   if ((DstBuffer == NULL) ||
-      (SrcBuffer == NULL)) {
+      (SrcBuffer == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -107,7 +110,7 @@ AmlUpperCaseMemCpyS (
 BOOLEAN
 EFIAPI
 AmlIsRootPath (
-  IN  CONST  CHAR8  * Buffer
+  IN  CONST  CHAR8  *Buffer
   )
 {
   if (Buffer == NULL) {
@@ -139,10 +142,10 @@ AmlIsRootPath (
 BOOLEAN
 EFIAPI
 AmlIsLeadNameChar (
-  IN  CHAR8   Ch
+  IN  CHAR8  Ch
   )
 {
-  if ((Ch == '_') || (Ch >= 'A' && Ch <= 'Z') || (Ch >= 'a' && Ch <= 'z')) {
+  if ((Ch == '_') || ((Ch >= 'A') && (Ch <= 'Z')) || ((Ch >= 'a') && (Ch <= 'z'))) {
     return TRUE;
   } else {
     return FALSE;
@@ -174,7 +177,7 @@ AmlIsNameChar (
   IN  CHAR8  Ch
   )
 {
-  if (AmlIsLeadNameChar (Ch) || (Ch >= '0' && Ch <= '9')) {
+  if (AmlIsLeadNameChar (Ch) || ((Ch >= '0') && (Ch <= '9'))) {
     return TRUE;
   } else {
     return FALSE;
@@ -195,14 +198,15 @@ AmlIsNameChar (
 BOOLEAN
 EFIAPI
 AslIsNameSeg (
-  IN  CONST  CHAR8    * AslBuffer,
-  OUT        UINT32   * Size
+  IN  CONST  CHAR8   *AslBuffer,
+  OUT        UINT32  *Size
   )
 {
-  UINT32    Index;
+  UINT32  Index;
 
   if ((AslBuffer == NULL) ||
-      (Size == NULL)) {
+      (Size == NULL))
+  {
     return FALSE;
   }
 
@@ -212,7 +216,8 @@ AslIsNameSeg (
 
   for (Index = 1; Index < AML_NAME_SEG_SIZE; Index++) {
     if ((AslBuffer[Index] == '.')   ||
-        (AslBuffer[Index] == '\0')) {
+        (AslBuffer[Index] == '\0'))
+    {
       *Size = Index;
       return TRUE;
     } else if (!AmlIsNameChar (AslBuffer[Index])) {
@@ -237,10 +242,10 @@ AslIsNameSeg (
 BOOLEAN
 EFIAPI
 AmlIsNameSeg (
-  IN  CONST  CHAR8    * AmlBuffer
+  IN  CONST  CHAR8  *AmlBuffer
   )
 {
-  UINT32    Index;
+  UINT32  Index;
 
   if (AmlBuffer == NULL) {
     return FALSE;
@@ -279,25 +284,26 @@ AmlIsNameSeg (
 EFI_STATUS
 EFIAPI
 AslParseNameStringInfo (
-  IN  CONST CHAR8     * Buffer,
-  OUT       UINT32    * Root,
-  OUT       UINT32    * ParentPrefix,
-  OUT       UINT32    * SegCount
+  IN  CONST CHAR8   *Buffer,
+  OUT       UINT32  *Root,
+  OUT       UINT32  *ParentPrefix,
+  OUT       UINT32  *SegCount
   )
 {
-  UINT32      NameSegSize;
+  UINT32  NameSegSize;
 
   if ((Buffer == NULL)        ||
       (Root == NULL)          ||
       (ParentPrefix == NULL)  ||
-      (SegCount == NULL)) {
+      (SegCount == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  *Root = 0;
+  *Root         = 0;
   *ParentPrefix = 0;
-  *SegCount = 0;
+  *SegCount     = 0;
 
   // Handle Root and ParentPrefix(s).
   if (*Buffer == AML_ROOT_CHAR) {
@@ -363,23 +369,24 @@ AslParseNameStringInfo (
 EFI_STATUS
 EFIAPI
 AmlParseNameStringInfo (
-  IN  CONST CHAR8   * Buffer,
-  OUT       UINT32  * Root,
-  OUT       UINT32  * ParentPrefix,
-  OUT       UINT32  * SegCount
+  IN  CONST CHAR8   *Buffer,
+  OUT       UINT32  *Root,
+  OUT       UINT32  *ParentPrefix,
+  OUT       UINT32  *SegCount
   )
 {
   if ((Buffer == NULL) ||
       (Root == NULL)   ||
       (ParentPrefix == NULL) ||
-      (SegCount == NULL)) {
+      (SegCount == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  *Root = 0;
+  *Root         = 0;
   *ParentPrefix = 0;
-  *SegCount = 0;
+  *SegCount     = 0;
 
   // Handle Root and ParentPrefix(s).
   if (*Buffer == AML_ROOT_CHAR) {
@@ -396,7 +403,7 @@ AmlParseNameStringInfo (
   if (*Buffer == AML_DUAL_NAME_PREFIX) {
     *SegCount = 2;
   } else if (*Buffer == AML_MULTI_NAME_PREFIX) {
-    *SegCount = *((UINT8*)(Buffer + 1));
+    *SegCount = *((UINT8 *)(Buffer + 1));
   } else if (AmlIsNameSeg (Buffer)) {
     *SegCount = 1;
   } else if (*Buffer == AML_ZERO_OP) {
@@ -430,12 +437,12 @@ AmlParseNameStringInfo (
 UINT32
 EFIAPI
 AslComputeNameStringSize (
-  IN  UINT32    Root,
-  IN  UINT32    ParentPrefix,
-  IN  UINT32    SegCount
+  IN  UINT32  Root,
+  IN  UINT32  ParentPrefix,
+  IN  UINT32  SegCount
   )
 {
-  UINT32    TotalSize;
+  UINT32  TotalSize;
 
   if (!AmlIsNameString (Root, ParentPrefix, SegCount)) {
     ASSERT (0);
@@ -472,12 +479,12 @@ AslComputeNameStringSize (
 UINT32
 EFIAPI
 AmlComputeNameStringSize (
-  IN  UINT32    Root,
-  IN  UINT32    ParentPrefix,
-  IN  UINT32    SegCount
+  IN  UINT32  Root,
+  IN  UINT32  ParentPrefix,
+  IN  UINT32  SegCount
   )
 {
-  UINT32    TotalSize;
+  UINT32  TotalSize;
 
   if (!AmlIsNameString (Root, ParentPrefix, SegCount)) {
     ASSERT (0);
@@ -507,12 +514,13 @@ AmlComputeNameStringSize (
 EFI_STATUS
 EFIAPI
 AslGetNameStringSize (
-  IN  CONST CHAR8   * AslPath,
-  OUT       UINT32  * AslPathSizePtr
+  IN  CONST CHAR8   *AslPath,
+  OUT       UINT32  *AslPathSizePtr
   )
 {
   if ((AslPath == NULL) ||
-      (AslPathSizePtr == NULL)) {
+      (AslPathSizePtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -537,18 +545,19 @@ AslGetNameStringSize (
 EFI_STATUS
 EFIAPI
 AmlGetNameStringSize (
-  IN   CONST  CHAR8   * AmlPath,
-  OUT         UINT32  * AmlPathSizePtr
+  IN   CONST  CHAR8   *AmlPath,
+  OUT         UINT32  *AmlPathSizePtr
   )
 {
-  EFI_STATUS    Status;
+  EFI_STATUS  Status;
 
-  UINT32        Root;
-  UINT32        ParentPrefix;
-  UINT32        SegCount;
+  UINT32  Root;
+  UINT32  ParentPrefix;
+  UINT32  SegCount;
 
   if ((AmlPath == NULL) ||
-      (AmlPathSizePtr == NULL)) {
+      (AmlPathSizePtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -587,24 +596,25 @@ AmlGetNameStringSize (
 EFI_STATUS
 EFIAPI
 ConvertAslNameToAmlName (
-  IN  CONST  CHAR8   * AslPath,
-  OUT        CHAR8  ** OutAmlPath
+  IN  CONST  CHAR8  *AslPath,
+  OUT        CHAR8  **OutAmlPath
   )
 {
-  EFI_STATUS      Status;
+  EFI_STATUS  Status;
 
-  UINT32          Root;
-  UINT32          ParentPrefix;
-  UINT32          SegCount;
-  UINT32          TotalSize;
-  UINT32          NameSegSize;
+  UINT32  Root;
+  UINT32  ParentPrefix;
+  UINT32  SegCount;
+  UINT32  TotalSize;
+  UINT32  NameSegSize;
 
-  CONST CHAR8   * AslBuffer;
-  CHAR8         * AmlBuffer;
-  CHAR8         * AmlPath;
+  CONST CHAR8  *AslBuffer;
+  CHAR8        *AmlBuffer;
+  CHAR8        *AmlPath;
 
   if ((AslPath == NULL) ||
-      (OutAmlPath == NULL)) {
+      (OutAmlPath == NULL))
+  {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -709,7 +719,6 @@ ConvertAslNameToAmlName (
         }
       }
     } // while
-
   } else {
     // (SegCount == 0)
     // '\0' needs to end the AML NameString/path.
@@ -721,10 +730,11 @@ ConvertAslNameToAmlName (
   // Check that AmlPath has been filled with TotalSize bytes.
   if ((SegCount != 0)               ||
       (*AslBuffer != AML_ZERO_OP)   ||
-      (((UINT32)(AmlBuffer - AmlPath)) != TotalSize)) {
-      ASSERT (0);
-      Status = EFI_INVALID_PARAMETER;
-      goto error_handler;
+      (((UINT32)(AmlBuffer - AmlPath)) != TotalSize))
+  {
+    ASSERT (0);
+    Status = EFI_INVALID_PARAMETER;
+    goto error_handler;
   }
 
   *OutAmlPath = AmlPath;
@@ -749,23 +759,24 @@ error_handler:
 EFI_STATUS
 EFIAPI
 ConvertAmlNameToAslName (
-  IN  CONST CHAR8     * AmlPath,
-  OUT       CHAR8    ** OutAslPath
+  IN  CONST CHAR8  *AmlPath,
+  OUT       CHAR8  **OutAslPath
   )
 {
-  EFI_STATUS      Status;
+  EFI_STATUS  Status;
 
-  UINT32          Root;
-  UINT32          ParentPrefix;
-  UINT32          SegCount;
-  UINT32          TotalSize;
+  UINT32  Root;
+  UINT32  ParentPrefix;
+  UINT32  SegCount;
+  UINT32  TotalSize;
 
-  CONST CHAR8   * AmlBuffer;
-  CHAR8         * AslBuffer;
-  CHAR8         * AslPath;
+  CONST CHAR8  *AmlBuffer;
+  CHAR8        *AslBuffer;
+  CHAR8        *AslPath;
 
   if ((AmlPath == NULL)   ||
-      (OutAslPath == NULL)) {
+      (OutAslPath == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -860,16 +871,17 @@ error_handler:
 BOOLEAN
 EFIAPI
 AslCompareNameString (
-  IN  CONST CHAR8 *   AslName1,
-  IN  CONST CHAR8 *   AslName2
+  IN  CONST CHAR8  *AslName1,
+  IN  CONST CHAR8  *AslName2
   )
 {
-  EFI_STATUS    Status;
-  UINT32        AslName1Len;
-  UINT32        AslName2Len;
+  EFI_STATUS  Status;
+  UINT32      AslName1Len;
+  UINT32      AslName2Len;
 
   if ((AslName1 == NULL) ||
-      (AslName2 == NULL)) {
+      (AslName2 == NULL))
+  {
     ASSERT (0);
     return FALSE;
   }
@@ -905,16 +917,17 @@ AslCompareNameString (
 BOOLEAN
 EFIAPI
 AmlCompareNameString (
-  IN  CONST CHAR8 *   AmlName1,
-  IN  CONST CHAR8 *   AmlName2
+  IN  CONST CHAR8  *AmlName1,
+  IN  CONST CHAR8  *AmlName2
   )
 {
-  EFI_STATUS    Status;
-  UINT32        AmlName1Len;
-  UINT32        AmlName2Len;
+  EFI_STATUS  Status;
+  UINT32      AmlName1Len;
+  UINT32      AmlName2Len;
 
   if ((AmlName1 == NULL) ||
-      (AmlName2 == NULL)) {
+      (AmlName2 == NULL))
+  {
     ASSERT (0);
     return FALSE;
   }
@@ -956,17 +969,18 @@ AmlCompareNameString (
 BOOLEAN
 EFIAPI
 CompareAmlWithAslNameString (
-  IN  CONST CHAR8 *   AmlName1,
-  IN  CONST CHAR8 *   AslName2
+  IN  CONST CHAR8  *AmlName1,
+  IN  CONST CHAR8  *AslName2
   )
 {
-  EFI_STATUS    Status;
+  EFI_STATUS  Status;
 
-  CHAR8       * AmlName2;
-  BOOLEAN       RetVal;
+  CHAR8    *AmlName2;
+  BOOLEAN  RetVal;
 
   if ((AmlName1 == NULL) ||
-      (AslName2 == NULL)) {
+      (AslName2 == NULL))
+  {
     ASSERT (0);
     return FALSE;
   }
@@ -986,6 +1000,7 @@ CompareAmlWithAslNameString (
 
   return RetVal;
 }
+
 /** Given an AmlPath, return the address of the first NameSeg.
 
   It is possible to determine the size of an AML NameString/path just
@@ -1004,9 +1019,9 @@ CONST
 CHAR8 *
 EFIAPI
 AmlGetFirstNameSeg (
-  IN  CONST  CHAR8    * AmlPath,
-  IN         UINT32     Root,
-  IN         UINT32     ParentPrefix
+  IN  CONST  CHAR8   *AmlPath,
+  IN         UINT32  Root,
+  IN         UINT32  ParentPrefix
   )
 {
   if (AmlPath == NULL) {

+ 43 - 43
DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.h

@@ -42,9 +42,9 @@
 BOOLEAN
 EFIAPI
 AmlIsNameString (
-  IN  UINT32    Root,
-  IN  UINT32    ParentPrefix,
-  IN  UINT32    SegCount
+  IN  UINT32  Root,
+  IN  UINT32  ParentPrefix,
+  IN  UINT32  SegCount
   );
 
 /** Copy bytes from SrcBuffer to DstBuffer and convert to upper case.
@@ -63,10 +63,10 @@ AmlIsNameString (
 EFI_STATUS
 EFIAPI
 AmlUpperCaseMemCpyS (
-  OUT       CHAR8   * DstBuffer,
-  IN        UINT32    MaxDstBufferSize,
-  IN  CONST CHAR8   * SrcBuffer,
-  IN        UINT32    Count
+  OUT       CHAR8   *DstBuffer,
+  IN        UINT32  MaxDstBufferSize,
+  IN  CONST CHAR8   *SrcBuffer,
+  IN        UINT32  Count
   );
 
 /** Check whether Buffer is a root path ('\').
@@ -82,7 +82,7 @@ AmlUpperCaseMemCpyS (
 BOOLEAN
 EFIAPI
 AmlIsRootPath (
-  IN  CONST  CHAR8  * Buffer
+  IN  CONST  CHAR8  *Buffer
   );
 
 /** Check whether Ch is an ASL/AML LeadName.
@@ -103,7 +103,7 @@ AmlIsRootPath (
 BOOLEAN
 EFIAPI
 AmlIsLeadNameChar (
-  IN  CHAR8   Ch
+  IN  CHAR8  Ch
   );
 
 /** Check whether Ch is an ASL/AML NameChar.
@@ -145,8 +145,8 @@ AmlIsNameChar (
 BOOLEAN
 EFIAPI
 AslIsNameSeg (
-  IN  CONST  CHAR8    * AslBuffer,
-  OUT        UINT32   * Size
+  IN  CONST  CHAR8   *AslBuffer,
+  OUT        UINT32  *Size
   );
 
 /** Check whether AmlBuffer is an AML NameSeg.
@@ -162,7 +162,7 @@ AslIsNameSeg (
 BOOLEAN
 EFIAPI
 AmlIsNameSeg (
-  IN  CONST  CHAR8    * AmlBuffer
+  IN  CONST  CHAR8  *AmlBuffer
   );
 
 /** Parse an ASL NameString/path.
@@ -185,10 +185,10 @@ AmlIsNameSeg (
 EFI_STATUS
 EFIAPI
 AslParseNameStringInfo (
-  IN  CONST CHAR8     * Buffer,
-  OUT       UINT32    * Root,
-  OUT       UINT32    * ParentPrefix,
-  OUT       UINT32    * SegCount
+  IN  CONST CHAR8   *Buffer,
+  OUT       UINT32  *Root,
+  OUT       UINT32  *ParentPrefix,
+  OUT       UINT32  *SegCount
   );
 
 /** Parse an AML NameString/path.
@@ -212,10 +212,10 @@ AslParseNameStringInfo (
 EFI_STATUS
 EFIAPI
 AmlParseNameStringInfo (
-  IN  CONST CHAR8   * Buffer,
-  OUT       UINT32  * Root,
-  OUT       UINT32  * ParentPrefix,
-  OUT       UINT32  * SegCount
+  IN  CONST CHAR8   *Buffer,
+  OUT       UINT32  *Root,
+  OUT       UINT32  *ParentPrefix,
+  OUT       UINT32  *SegCount
   );
 
 /** Compute the ASL NameString/path size from NameString
@@ -233,9 +233,9 @@ AmlParseNameStringInfo (
 UINT32
 EFIAPI
 AslComputeNameStringSize (
-  IN  UINT32    Root,
-  IN  UINT32    ParentPrefix,
-  IN  UINT32    SegCount
+  IN  UINT32  Root,
+  IN  UINT32  ParentPrefix,
+  IN  UINT32  SegCount
   );
 
 /** Compute the AML NameString/path size from NameString
@@ -253,9 +253,9 @@ AslComputeNameStringSize (
 UINT32
 EFIAPI
 AmlComputeNameStringSize (
-  IN  UINT32    Root,
-  IN  UINT32    ParentPrefix,
-  IN  UINT32    SegCount
+  IN  UINT32  Root,
+  IN  UINT32  ParentPrefix,
+  IN  UINT32  SegCount
   );
 
 /** Get the ASL NameString/path size.
@@ -269,8 +269,8 @@ AmlComputeNameStringSize (
 EFI_STATUS
 EFIAPI
 AslGetNameStringSize (
-  IN  CONST CHAR8   * AslPath,
-  OUT       UINT32  * AslPathSizePtr
+  IN  CONST CHAR8   *AslPath,
+  OUT       UINT32  *AslPathSizePtr
   );
 
 /** Get the AML NameString/path size.
@@ -284,8 +284,8 @@ AslGetNameStringSize (
 EFI_STATUS
 EFIAPI
 AmlGetNameStringSize (
-  IN   CONST  CHAR8   * AmlPath,
-  OUT         UINT32  * AmlPathSizePtr
+  IN   CONST  CHAR8   *AmlPath,
+  OUT         UINT32  *AmlPathSizePtr
   );
 
 /** Convert an ASL NameString/path to an AML NameString/path.
@@ -302,8 +302,8 @@ AmlGetNameStringSize (
 EFI_STATUS
 EFIAPI
 ConvertAslNameToAmlName (
-  IN  CONST  CHAR8   * AslPath,
-  OUT        CHAR8  ** OutAmlPath
+  IN  CONST  CHAR8  *AslPath,
+  OUT        CHAR8  **OutAmlPath
   );
 
 /** Convert an AML NameString/path to an ASL NameString/path.
@@ -320,8 +320,8 @@ ConvertAslNameToAmlName (
 EFI_STATUS
 EFIAPI
 ConvertAmlNameToAslName (
-  IN  CONST CHAR8     * AmlPath,
-  OUT       CHAR8    ** OutAslPath
+  IN  CONST CHAR8  *AmlPath,
+  OUT       CHAR8  **OutAslPath
   );
 
 /** Compare two ASL NameStrings.
@@ -335,8 +335,8 @@ ConvertAmlNameToAslName (
 BOOLEAN
 EFIAPI
 AslCompareNameString (
-  IN  CONST CHAR8 *   AslName1,
-  IN  CONST CHAR8 *   AslName2
+  IN  CONST CHAR8  *AslName1,
+  IN  CONST CHAR8  *AslName2
   );
 
 /** Compare two AML NameStrings.
@@ -350,8 +350,8 @@ AslCompareNameString (
 BOOLEAN
 EFIAPI
 AmlCompareNameString (
-  IN  CONST CHAR8 *   AmlName1,
-  IN  CONST CHAR8 *   AmlName2
+  IN  CONST CHAR8  *AmlName1,
+  IN  CONST CHAR8  *AmlName2
   );
 
 /** Compare an AML NameString and an ASL NameString.
@@ -371,8 +371,8 @@ AmlCompareNameString (
 BOOLEAN
 EFIAPI
 CompareAmlWithAslNameString (
-  IN  CONST CHAR8 *   AmlName1,
-  IN  CONST CHAR8 *   AslName2
+  IN  CONST CHAR8  *AmlName1,
+  IN  CONST CHAR8  *AslName2
   );
 
 /** Given an AmlPath, return the address of the first NameSeg.
@@ -393,9 +393,9 @@ CONST
 CHAR8 *
 EFIAPI
 AmlGetFirstNameSeg (
-  IN  CONST  CHAR8    * AmlPath,
-  IN         UINT32     Root,
-  IN         UINT32     ParentPrefix
+  IN  CONST  CHAR8   *AmlPath,
+  IN         UINT32  Root,
+  IN         UINT32  ParentPrefix
   );
 
 #endif // AML_STRING_H_

+ 38 - 36
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c

@@ -27,50 +27,51 @@
 EFI_STATUS
 EFIAPI
 AmlCloneNode (
-  IN  AML_NODE_HEADER   * Node,
-  OUT AML_NODE_HEADER  ** ClonedNode
+  IN  AML_NODE_HEADER  *Node,
+  OUT AML_NODE_HEADER  **ClonedNode
   )
 {
-  EFI_STATUS              Status;
+  EFI_STATUS  Status;
 
-  AML_OBJECT_NODE       * ObjectNode;
-  AML_DATA_NODE         * DataNode;
-  AML_ROOT_NODE         * RootNode;
+  AML_OBJECT_NODE  *ObjectNode;
+  AML_DATA_NODE    *DataNode;
+  AML_ROOT_NODE    *RootNode;
 
   if (!IS_AML_NODE_VALID (Node) ||
-      (ClonedNode == NULL)) {
+      (ClonedNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   if (IS_AML_DATA_NODE (Node)) {
-    DataNode = (AML_DATA_NODE*)Node;
-    Status = AmlCreateDataNode (
-                DataNode->DataType,
-                DataNode->Buffer,
-                DataNode->Size,
-                (AML_DATA_NODE**)ClonedNode
-                );
+    DataNode = (AML_DATA_NODE *)Node;
+    Status   = AmlCreateDataNode (
+                 DataNode->DataType,
+                 DataNode->Buffer,
+                 DataNode->Size,
+                 (AML_DATA_NODE **)ClonedNode
+                 );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
     }
   } else if (IS_AML_OBJECT_NODE (Node)) {
-    ObjectNode = (AML_OBJECT_NODE*)Node;
+    ObjectNode = (AML_OBJECT_NODE *)Node;
 
     Status = AmlCreateObjectNode (
-                ObjectNode->AmlByteEncoding,
-                ObjectNode->PkgLen,
-                (AML_OBJECT_NODE**)ClonedNode
-                );
+               ObjectNode->AmlByteEncoding,
+               ObjectNode->PkgLen,
+               (AML_OBJECT_NODE **)ClonedNode
+               );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
     }
   } else if (IS_AML_ROOT_NODE (Node)) {
-    RootNode = (AML_ROOT_NODE*)Node;
+    RootNode = (AML_ROOT_NODE *)Node;
 
     Status = AmlCreateRootNode (
                RootNode->SdtHeader,
-               (AML_ROOT_NODE**)ClonedNode
+               (AML_ROOT_NODE **)ClonedNode
                );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
@@ -99,24 +100,25 @@ AmlCloneNode (
 EFI_STATUS
 EFIAPI
 AmlCloneTree (
-  IN  AML_NODE_HEADER   * Node,
-  OUT AML_NODE_HEADER  ** ClonedNode
+  IN  AML_NODE_HEADER  *Node,
+  OUT AML_NODE_HEADER  **ClonedNode
   )
 {
-  EFI_STATUS              Status;
+  EFI_STATUS  Status;
 
-  AML_NODE_HEADER       * HeadNode;
-  AML_NODE_HEADER       * ClonedChildNode;
-  AML_NODE_HEADER       * FixedArgNode;
+  AML_NODE_HEADER  *HeadNode;
+  AML_NODE_HEADER  *ClonedChildNode;
+  AML_NODE_HEADER  *FixedArgNode;
 
-  EAML_PARSE_INDEX        Index;
-  EAML_PARSE_INDEX        MaxIndex;
+  EAML_PARSE_INDEX  Index;
+  EAML_PARSE_INDEX  MaxIndex;
 
-  LIST_ENTRY            * StartLink;
-  LIST_ENTRY            * CurrentLink;
+  LIST_ENTRY  *StartLink;
+  LIST_ENTRY  *CurrentLink;
 
   if (!IS_AML_NODE_VALID (Node) ||
-      (ClonedNode == NULL)) {
+      (ClonedNode == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -129,10 +131,10 @@ AmlCloneTree (
 
   // Clone the fixed arguments and bind them to their parent.
   MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
-                                 (AML_OBJECT_NODE*)Node
+                                 (AML_OBJECT_NODE *)Node
                                  );
   for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
-    FixedArgNode = AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index);
+    FixedArgNode = AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
     if (FixedArgNode == NULL) {
       Status = EFI_INVALID_PARAMETER;
       ASSERT (0);
@@ -151,7 +153,7 @@ AmlCloneTree (
 
     // Bind child.
     Status = AmlSetFixedArgument (
-               (AML_OBJECT_NODE*)HeadNode,
+               (AML_OBJECT_NODE *)HeadNode,
                Index,
                ClonedChildNode
                );
@@ -168,7 +170,7 @@ AmlCloneTree (
     CurrentLink = StartLink->ForwardLink;
     while (CurrentLink != StartLink) {
       // Clone child.
-      Status = AmlCloneTree ((AML_NODE_HEADER*)CurrentLink, &ClonedChildNode);
+      Status = AmlCloneTree ((AML_NODE_HEADER *)CurrentLink, &ClonedChildNode);
       if (EFI_ERROR (Status)) {
         ASSERT (0);
         goto error_handler;

+ 88 - 71
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c

@@ -24,8 +24,8 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlInitializeNodeHeader (
-  IN  AML_NODE_HEADER   * Node,
-  IN  EAML_NODE_TYPE      NodeType
+  IN  AML_NODE_HEADER  *Node,
+  IN  EAML_NODE_TYPE   NodeType
   )
 {
   if (Node == NULL) {
@@ -35,7 +35,7 @@ AmlInitializeNodeHeader (
 
   InitializeListHead (&Node->Link);
 
-  Node->Parent = NULL;
+  Node->Parent   = NULL;
   Node->NodeType = NodeType;
 
   return EFI_SUCCESS;
@@ -55,7 +55,7 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlDeleteRootNode (
-  IN  AML_ROOT_NODE  * RootNode
+  IN  AML_ROOT_NODE  *RootNode
   )
 {
   if (!IS_AML_ROOT_NODE (RootNode)) {
@@ -90,15 +90,16 @@ AmlDeleteRootNode (
 EFI_STATUS
 EFIAPI
 AmlCreateRootNode (
-  IN  CONST EFI_ACPI_DESCRIPTION_HEADER   * SdtHeader,
-  OUT       AML_ROOT_NODE                ** NewRootNodePtr
+  IN  CONST EFI_ACPI_DESCRIPTION_HEADER  *SdtHeader,
+  OUT       AML_ROOT_NODE                **NewRootNodePtr
   )
 {
-  EFI_STATUS        Status;
-  AML_ROOT_NODE   * RootNode;
+  EFI_STATUS     Status;
+  AML_ROOT_NODE  *RootNode;
 
   if ((SdtHeader == NULL) ||
-      (NewRootNodePtr == NULL)) {
+      (NewRootNodePtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -149,7 +150,7 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlDeleteObjectNode (
-  IN  AML_OBJECT_NODE   * ObjectNode
+  IN  AML_OBJECT_NODE  *ObjectNode
   )
 {
   if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@@ -178,16 +179,17 @@ AmlDeleteObjectNode (
 EFI_STATUS
 EFIAPI
 AmlCreateObjectNode (
-  IN  CONST  AML_BYTE_ENCODING   * AmlByteEncoding,
-  IN         UINT32                PkgLength,
-  OUT        AML_OBJECT_NODE    ** NewObjectNodePtr
+  IN  CONST  AML_BYTE_ENCODING  *AmlByteEncoding,
+  IN         UINT32             PkgLength,
+  OUT        AML_OBJECT_NODE    **NewObjectNodePtr
   )
 {
-  EFI_STATUS            Status;
-  AML_OBJECT_NODE     * ObjectNode;
+  EFI_STATUS       Status;
+  AML_OBJECT_NODE  *ObjectNode;
 
   if ((AmlByteEncoding == NULL)  ||
-      (NewObjectNodePtr == NULL)) {
+      (NewObjectNodePtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -212,7 +214,7 @@ AmlCreateObjectNode (
   // ObjectNode->FixedArgs[...] is already initialised to NULL as the
   // ObjectNode is Zero allocated.
   ObjectNode->AmlByteEncoding = AmlByteEncoding;
-  ObjectNode->PkgLen = PkgLength;
+  ObjectNode->PkgLen          = PkgLength;
 
   *NewObjectNodePtr = ObjectNode;
 
@@ -234,7 +236,7 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlDeleteDataNode (
-  IN  AML_DATA_NODE   * DataNode
+  IN  AML_DATA_NODE  *DataNode
   )
 {
   if (!IS_AML_DATA_NODE (DataNode)) {
@@ -271,14 +273,14 @@ AmlDeleteDataNode (
 EFI_STATUS
 EFIAPI
 AmlCreateDataNode (
-  IN        EAML_NODE_DATA_TYPE     DataType,
-  IN  CONST UINT8                 * Data,
-  IN        UINT32                  DataSize,
-  OUT       AML_DATA_NODE        ** NewDataNodePtr
+  IN        EAML_NODE_DATA_TYPE  DataType,
+  IN  CONST UINT8                *Data,
+  IN        UINT32               DataSize,
+  OUT       AML_DATA_NODE        **NewDataNodePtr
   )
 {
-  EFI_STATUS        Status;
-  AML_DATA_NODE   * DataNode;
+  EFI_STATUS     Status;
+  AML_DATA_NODE  *DataNode;
 
   // A data node must not be created for certain data types.
   if ((DataType == EAmlNodeDataTypeNone)       ||
@@ -289,7 +291,8 @@ AmlCreateDataNode (
       (DataType == EAmlNodeDataTypeReserved5)  ||
       (Data == NULL)                           ||
       (DataSize == 0)                          ||
-      (NewDataNodePtr == NULL)) {
+      (NewDataNodePtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -317,7 +320,7 @@ AmlCreateDataNode (
   }
 
   DataNode->DataType = DataType;
-  DataNode->Size = DataSize;
+  DataNode->Size     = DataSize;
 
   *NewDataNodePtr = DataNode;
 
@@ -334,17 +337,18 @@ AmlCreateDataNode (
 EFI_STATUS
 EFIAPI
 AmlDeleteNode (
-  IN  AML_NODE_HEADER   * Node
+  IN  AML_NODE_HEADER  *Node
   )
 {
-  EFI_STATUS          Status;
-  EAML_PARSE_INDEX    Index;
+  EFI_STATUS        Status;
+  EAML_PARSE_INDEX  Index;
 
   // Check that the node being deleted is unlinked.
   // When removing the node, its parent and list are reset
   // with InitializeListHead. Thus it must be empty.
   if (!IS_AML_NODE_VALID (Node) ||
-      !AML_NODE_IS_DETACHED (Node)) {
+      !AML_NODE_IS_DETACHED (Node))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -358,10 +362,11 @@ AmlDeleteNode (
         return EFI_INVALID_PARAMETER;
       }
 
-      Status = AmlDeleteRootNode ((AML_ROOT_NODE*)Node);
+      Status = AmlDeleteRootNode ((AML_ROOT_NODE *)Node);
       if (EFI_ERROR (Status)) {
         ASSERT (0);
       }
+
       break;
     }
 
@@ -375,25 +380,27 @@ AmlDeleteNode (
 
       // Check the fixed argument list has been cleaned.
       for (Index = EAmlParseIndexTerm0; Index < EAmlParseIndexMax; Index++) {
-        if (((AML_OBJECT_NODE*)Node)->FixedArgs[Index] != NULL) {
+        if (((AML_OBJECT_NODE *)Node)->FixedArgs[Index] != NULL) {
           ASSERT (0);
           return EFI_INVALID_PARAMETER;
         }
       }
 
-      Status = AmlDeleteObjectNode ((AML_OBJECT_NODE*)Node);
+      Status = AmlDeleteObjectNode ((AML_OBJECT_NODE *)Node);
       if (EFI_ERROR (Status)) {
         ASSERT (0);
       }
+
       break;
     }
 
     case EAmlNodeData:
     {
-      Status = AmlDeleteDataNode ((AML_DATA_NODE*)Node);
+      Status = AmlDeleteDataNode ((AML_DATA_NODE *)Node);
       if (EFI_ERROR (Status)) {
         ASSERT (0);
       }
+
       break;
     }
 
@@ -421,12 +428,13 @@ AmlDeleteNode (
 BOOLEAN
 EFIAPI
 AmlNodeHasAttribute (
-  IN  CONST AML_OBJECT_NODE   * ObjectNode,
-  IN        AML_OP_ATTRIBUTE    Attribute
+  IN  CONST AML_OBJECT_NODE   *ObjectNode,
+  IN        AML_OP_ATTRIBUTE  Attribute
   )
 {
   if (!IS_AML_OBJECT_NODE (ObjectNode) ||
-      (ObjectNode->AmlByteEncoding == NULL)) {
+      (ObjectNode->AmlByteEncoding == NULL))
+  {
     return FALSE;
   }
 
@@ -447,21 +455,22 @@ AmlNodeHasAttribute (
 BOOLEAN
 EFIAPI
 AmlNodeCompareOpCode (
-  IN  CONST  AML_OBJECT_NODE  * ObjectNode,
-  IN         UINT8              OpCode,
-  IN         UINT8              SubOpCode
+  IN  CONST  AML_OBJECT_NODE  *ObjectNode,
+  IN         UINT8            OpCode,
+  IN         UINT8            SubOpCode
   )
 {
   if (!IS_AML_OBJECT_NODE (ObjectNode) ||
-      (ObjectNode->AmlByteEncoding == NULL)) {
+      (ObjectNode->AmlByteEncoding == NULL))
+  {
     return FALSE;
   }
 
   ASSERT (AmlIsOpCodeValid (OpCode, SubOpCode));
 
   return ((ObjectNode->AmlByteEncoding->OpCode == OpCode) &&
-           (ObjectNode->AmlByteEncoding->SubOpCode == SubOpCode)) ?
-           TRUE : FALSE;
+          (ObjectNode->AmlByteEncoding->SubOpCode == SubOpCode)) ?
+         TRUE : FALSE;
 }
 
 /** Check whether a Node is an integer node.
@@ -480,13 +489,14 @@ AmlNodeCompareOpCode (
 BOOLEAN
 EFIAPI
 IsIntegerNode (
-  IN  AML_OBJECT_NODE   * Node
+  IN  AML_OBJECT_NODE  *Node
   )
 {
-  UINT8   OpCode;
+  UINT8  OpCode;
 
   if (!IS_AML_OBJECT_NODE (Node)  ||
-      (Node->AmlByteEncoding == NULL)) {
+      (Node->AmlByteEncoding == NULL))
+  {
     return FALSE;
   }
 
@@ -495,7 +505,8 @@ IsIntegerNode (
   if ((OpCode != AML_BYTE_PREFIX)   &&
       (OpCode != AML_WORD_PREFIX)   &&
       (OpCode != AML_DWORD_PREFIX)  &&
-      (OpCode != AML_QWORD_PREFIX)) {
+      (OpCode != AML_QWORD_PREFIX))
+  {
     return FALSE;
   }
 
@@ -515,13 +526,14 @@ IsIntegerNode (
 BOOLEAN
 EFIAPI
 IsSpecialIntegerNode (
-  IN  AML_OBJECT_NODE   * Node
+  IN  AML_OBJECT_NODE  *Node
   )
 {
-  UINT8   OpCode;
+  UINT8  OpCode;
 
   if (!IS_AML_OBJECT_NODE (Node)  ||
-      (Node->AmlByteEncoding == NULL)) {
+      (Node->AmlByteEncoding == NULL))
+  {
     return FALSE;
   }
 
@@ -529,7 +541,8 @@ IsSpecialIntegerNode (
 
   if ((OpCode != AML_ZERO_OP) &&
       (OpCode != AML_ONE_OP)  &&
-      (OpCode != AML_ONES_OP)) {
+      (OpCode != AML_ONES_OP))
+  {
     return FALSE;
   }
 
@@ -555,10 +568,10 @@ IsSpecialIntegerNode (
 BOOLEAN
 EFIAPI
 AmlIsMethodDefinitionNode (
-  IN  CONST AML_OBJECT_NODE   * Node
+  IN  CONST AML_OBJECT_NODE  *Node
   )
 {
-  AML_DATA_NODE   * ObjectType;
+  AML_DATA_NODE  *ObjectType;
 
   // Node is checked to be an object node aswell.
   if (AmlNodeCompareOpCode (Node, AML_METHOD_OP, 0)) {
@@ -569,14 +582,15 @@ AmlIsMethodDefinitionNode (
     // ExternalOp := 0x15
     // ObjectType := ByteData
     // ArgumentCount := ByteData (0 - 7)
-    ObjectType = (AML_DATA_NODE*)AmlGetFixedArgument (
-                                   (AML_OBJECT_NODE*)Node,
-                                   EAmlParseIndexTerm1
-                                   );
+    ObjectType = (AML_DATA_NODE *)AmlGetFixedArgument (
+                                    (AML_OBJECT_NODE *)Node,
+                                    EAmlParseIndexTerm1
+                                    );
     if (IS_AML_DATA_NODE (ObjectType)                   &&
         (ObjectType->DataType == EAmlNodeDataTypeUInt)  &&
-        ((ObjectType->Size == 1))) {
-      if (*((UINT8*)ObjectType->Buffer) == (UINT8)EAmlObjTypeMethodObj) {
+        ((ObjectType->Size == 1)))
+    {
+      if (*((UINT8 *)ObjectType->Buffer) == (UINT8)EAmlObjTypeMethodObj) {
         // The external definition is a method.
         return TRUE;
       } else {
@@ -605,15 +619,16 @@ AmlIsMethodDefinitionNode (
 **/
 EFI_STATUS
 AmlNodeGetNameIndex (
-  IN  CONST AML_OBJECT_NODE     * ObjectNode,
-  OUT       EAML_PARSE_INDEX    * Index
+  IN  CONST AML_OBJECT_NODE   *ObjectNode,
+  OUT       EAML_PARSE_INDEX  *Index
   )
 {
-  EAML_PARSE_INDEX    NameIndex;
+  EAML_PARSE_INDEX  NameIndex;
 
   if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)   ||
       (ObjectNode->AmlByteEncoding == NULL)                 ||
-      (Index == NULL)) {
+      (Index == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -621,7 +636,8 @@ AmlNodeGetNameIndex (
   NameIndex = ObjectNode->AmlByteEncoding->NameIndex;
 
   if ((NameIndex > ObjectNode->AmlByteEncoding->MaxIndex)   ||
-      (ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName)) {
+      (ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -645,12 +661,12 @@ AmlNodeGetNameIndex (
 CHAR8 *
 EFIAPI
 AmlNodeGetName (
-  IN  CONST AML_OBJECT_NODE   * ObjectNode
+  IN  CONST AML_OBJECT_NODE  *ObjectNode
   )
 {
-  EFI_STATUS          Status;
-  EAML_PARSE_INDEX    NameIndex;
-  AML_DATA_NODE     * DataNode;
+  EFI_STATUS        Status;
+  EAML_PARSE_INDEX  NameIndex;
+  AML_DATA_NODE     *DataNode;
 
   if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) {
     ASSERT (0);
@@ -665,10 +681,11 @@ AmlNodeGetName (
   }
 
   // The name is stored in a Data node.
-  DataNode = (AML_DATA_NODE*)ObjectNode->FixedArgs[NameIndex];
+  DataNode = (AML_DATA_NODE *)ObjectNode->FixedArgs[NameIndex];
   if (IS_AML_DATA_NODE (DataNode) &&
-      (DataNode->DataType == EAmlNodeDataTypeNameString)) {
-    return (CHAR8*)DataNode->Buffer;
+      (DataNode->DataType == EAmlNodeDataTypeNameString))
+  {
+    return (CHAR8 *)DataNode->Buffer;
   }
 
   /* Return NULL if no name is found.

+ 21 - 21
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.h

@@ -28,8 +28,8 @@
 EFI_STATUS
 EFIAPI
 AmlCreateRootNode (
-  IN  CONST EFI_ACPI_DESCRIPTION_HEADER   * SdtHeader,
-  OUT       AML_ROOT_NODE                ** NewRootNodePtr
+  IN  CONST EFI_ACPI_DESCRIPTION_HEADER  *SdtHeader,
+  OUT       AML_ROOT_NODE                **NewRootNodePtr
   );
 
 /** Create an AML_OBJECT_NODE.
@@ -49,9 +49,9 @@ AmlCreateRootNode (
 EFI_STATUS
 EFIAPI
 AmlCreateObjectNode (
-  IN  CONST  AML_BYTE_ENCODING   * AmlByteEncoding,
-  IN         UINT32                PkgLength,
-  OUT        AML_OBJECT_NODE    ** NewObjectNodePtr
+  IN  CONST  AML_BYTE_ENCODING  *AmlByteEncoding,
+  IN         UINT32             PkgLength,
+  OUT        AML_OBJECT_NODE    **NewObjectNodePtr
   );
 
 /** Create an AML_DATA_NODE.
@@ -72,10 +72,10 @@ AmlCreateObjectNode (
 EFI_STATUS
 EFIAPI
 AmlCreateDataNode (
-  IN        EAML_NODE_DATA_TYPE     DataType,
-  IN  CONST UINT8                 * Data,
-  IN        UINT32                  DataSize,
-  OUT       AML_DATA_NODE        ** NewDataNodePtr
+  IN        EAML_NODE_DATA_TYPE  DataType,
+  IN  CONST UINT8                *Data,
+  IN        UINT32               DataSize,
+  OUT       AML_DATA_NODE        **NewDataNodePtr
   );
 
 /** Delete a Node.
@@ -88,7 +88,7 @@ AmlCreateDataNode (
 EFI_STATUS
 EFIAPI
 AmlDeleteNode (
-  IN  AML_NODE_HEADER   * Node
+  IN  AML_NODE_HEADER  *Node
   );
 
 /** Check whether ObjectNode has the input attribute.
@@ -104,8 +104,8 @@ AmlDeleteNode (
 BOOLEAN
 EFIAPI
 AmlNodeHasAttribute (
-  IN  CONST AML_OBJECT_NODE   * ObjectNode,
-  IN        AML_OP_ATTRIBUTE    Attribute
+  IN  CONST AML_OBJECT_NODE   *ObjectNode,
+  IN        AML_OP_ATTRIBUTE  Attribute
   );
 
 /** Check whether ObjectNode has the input OpCode/SubOpcode couple.
@@ -121,9 +121,9 @@ AmlNodeHasAttribute (
 BOOLEAN
 EFIAPI
 AmlNodeCompareOpCode (
-  IN  CONST  AML_OBJECT_NODE  * ObjectNode,
-  IN         UINT8              OpCode,
-  IN         UINT8              SubOpCode
+  IN  CONST  AML_OBJECT_NODE  *ObjectNode,
+  IN         UINT8            OpCode,
+  IN         UINT8            SubOpCode
   );
 
 /** Check whether a Node is an integer node.
@@ -142,7 +142,7 @@ AmlNodeCompareOpCode (
 BOOLEAN
 EFIAPI
 IsIntegerNode (
-  IN  AML_OBJECT_NODE   * Node
+  IN  AML_OBJECT_NODE  *Node
   );
 
 /** Check whether a Node is a ZeroOp, a OneOp or a OnesOp.
@@ -158,7 +158,7 @@ IsIntegerNode (
 BOOLEAN
 EFIAPI
 IsSpecialIntegerNode (
-  IN  AML_OBJECT_NODE   * Node
+  IN  AML_OBJECT_NODE  *Node
   );
 
 /** Check whether Node corresponds to a method definition.
@@ -180,7 +180,7 @@ IsSpecialIntegerNode (
 BOOLEAN
 EFIAPI
 AmlIsMethodDefinitionNode (
-  IN  CONST AML_OBJECT_NODE   * Node
+  IN  CONST AML_OBJECT_NODE  *Node
   );
 
 /** Get the index at which the name of the node is stored.
@@ -194,8 +194,8 @@ AmlIsMethodDefinitionNode (
 **/
 EFI_STATUS
 AmlNodeGetNameIndex (
-  IN  CONST AML_OBJECT_NODE     * ObjectNode,
-  OUT       EAML_PARSE_INDEX    * Index
+  IN  CONST AML_OBJECT_NODE   *ObjectNode,
+  OUT       EAML_PARSE_INDEX  *Index
   );
 
 /** Get the name of the Node.
@@ -212,7 +212,7 @@ AmlNodeGetNameIndex (
 CHAR8 *
 EFIAPI
 AmlNodeGetName (
-  IN  CONST AML_OBJECT_NODE   * ObjectNode
+  IN  CONST AML_OBJECT_NODE  *ObjectNode
   );
 
 #endif // AML_NODE_H_

+ 77 - 53
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNodeInterface.c

@@ -25,7 +25,7 @@
 EAML_NODE_TYPE
 EFIAPI
 AmlGetNodeType (
-  IN  AML_NODE_HEADER   * Node
+  IN  AML_NODE_HEADER  *Node
   )
 {
   if (!IS_AML_NODE_VALID (Node)) {
@@ -48,12 +48,13 @@ AmlGetNodeType (
 EFI_STATUS
 EFIAPI
 AmlGetRootNodeInfo (
-  IN  AML_ROOT_NODE                 * RootNode,
-  OUT EFI_ACPI_DESCRIPTION_HEADER   * SdtHeaderBuffer
+  IN  AML_ROOT_NODE                *RootNode,
+  OUT EFI_ACPI_DESCRIPTION_HEADER  *SdtHeaderBuffer
   )
 {
   if (!IS_AML_ROOT_NODE (RootNode)  ||
-      (SdtHeaderBuffer == NULL)) {
+      (SdtHeaderBuffer == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -94,11 +95,11 @@ AmlGetRootNodeInfo (
 EFI_STATUS
 EFIAPI
 AmlGetObjectNodeInfo (
-  IN  AML_OBJECT_NODE   * ObjectNode,
-  OUT UINT8             * OpCode            OPTIONAL,
-  OUT UINT8             * SubOpCode         OPTIONAL,
-  OUT UINT32            * PkgLen            OPTIONAL,
-  OUT BOOLEAN           * IsNameSpaceNode   OPTIONAL
+  IN  AML_OBJECT_NODE  *ObjectNode,
+  OUT UINT8            *OpCode            OPTIONAL,
+  OUT UINT8            *SubOpCode         OPTIONAL,
+  OUT UINT32           *PkgLen            OPTIONAL,
+  OUT BOOLEAN          *IsNameSpaceNode   OPTIONAL
   )
 {
   if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@@ -109,12 +110,15 @@ AmlGetObjectNodeInfo (
   if (OpCode != NULL) {
     *OpCode = ObjectNode->AmlByteEncoding->OpCode;
   }
+
   if (SubOpCode != NULL) {
     *SubOpCode = ObjectNode->AmlByteEncoding->SubOpCode;
   }
+
   if (PkgLen != NULL) {
     *PkgLen = ObjectNode->PkgLen;
   }
+
   if (IsNameSpaceNode != NULL) {
     *IsNameSpaceNode = AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE);
   }
@@ -131,11 +135,12 @@ AmlGetObjectNodeInfo (
 **/
 UINT8
 AmlGetFixedArgumentCount (
-  IN  AML_OBJECT_NODE   * Node
+  IN  AML_OBJECT_NODE  *Node
   )
 {
   if (IS_AML_OBJECT_NODE (Node) &&
-      (Node->AmlByteEncoding != NULL)) {
+      (Node->AmlByteEncoding != NULL))
+  {
     return (UINT8)Node->AmlByteEncoding->MaxIndex;
   }
 
@@ -154,12 +159,13 @@ AmlGetFixedArgumentCount (
 EFI_STATUS
 EFIAPI
 AmlGetNodeDataType (
-  IN  AML_DATA_NODE       * DataNode,
-  OUT EAML_NODE_DATA_TYPE * DataType
+  IN  AML_DATA_NODE        *DataNode,
+  OUT EAML_NODE_DATA_TYPE  *DataType
   )
 {
   if (!IS_AML_DATA_NODE (DataNode)  ||
-      (DataType == NULL)) {
+      (DataType == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -187,13 +193,14 @@ AmlGetNodeDataType (
 EFI_STATUS
 EFIAPI
 AmlGetResourceDataType (
-  IN  AML_DATA_NODE   * DataNode,
-  OUT AML_RD_HEADER   * ResourceDataType
+  IN  AML_DATA_NODE  *DataNode,
+  OUT AML_RD_HEADER  *ResourceDataType
   )
 {
   if (!IS_AML_DATA_NODE (DataNode)  ||
       (ResourceDataType == NULL)    ||
-      (DataNode->DataType != EAmlNodeDataTypeResourceData)) {
+      (DataNode->DataType != EAmlNodeDataTypeResourceData))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -227,19 +234,21 @@ AmlGetResourceDataType (
 EFI_STATUS
 EFIAPI
 AmlGetDataNodeBuffer (
-  IN      AML_DATA_NODE   * DataNode,
-      OUT UINT8           * Buffer        OPTIONAL,
-  IN  OUT UINT32          * BufferSize
+  IN      AML_DATA_NODE  *DataNode,
+  OUT UINT8              *Buffer        OPTIONAL,
+  IN  OUT UINT32         *BufferSize
   )
 {
   if (!IS_AML_DATA_NODE (DataNode) ||
-      (BufferSize == NULL)) {
+      (BufferSize == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   if ((*BufferSize >= DataNode->Size)  &&
-      (Buffer != NULL)) {
+      (Buffer != NULL))
+  {
     CopyMem (Buffer, DataNode->Buffer, DataNode->Size);
   }
 
@@ -263,8 +272,8 @@ AmlGetDataNodeBuffer (
 EFI_STATUS
 EFIAPI
 AmlUpdateRootNode (
-  IN        AML_ROOT_NODE                 * RootNode,
-  IN  CONST EFI_ACPI_DESCRIPTION_HEADER   * SdtHeader
+  IN        AML_ROOT_NODE                *RootNode,
+  IN  CONST EFI_ACPI_DESCRIPTION_HEADER  *SdtHeader
   )
 {
   EFI_STATUS  Status;
@@ -275,7 +284,8 @@ AmlUpdateRootNode (
       ((SdtHeader->Signature !=
         EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) &&
        (SdtHeader->Signature !=
-        EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))) {
+        EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -287,14 +297,14 @@ AmlUpdateRootNode (
     );
 
   // Update the Length field.
-  Status = AmlComputeSize ((AML_NODE_HEADER*)RootNode, &Length);
+  Status = AmlComputeSize ((AML_NODE_HEADER *)RootNode, &Length);
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     return Status;
   }
 
   RootNode->SdtHeader->Length = Length +
-                                  (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+                                (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
 
   return Status;
 }
@@ -323,18 +333,19 @@ AmlUpdateRootNode (
 EFI_STATUS
 EFIAPI
 AmlUpdateInteger (
-  IN  AML_OBJECT_NODE   * IntegerOpNode,
-  IN  UINT64              NewInteger
+  IN  AML_OBJECT_NODE  *IntegerOpNode,
+  IN  UINT64           NewInteger
   )
 {
-  EFI_STATUS   Status;
+  EFI_STATUS  Status;
 
-  INT8         ValueWidthDiff;
+  INT8  ValueWidthDiff;
 
   if (!IS_AML_OBJECT_NODE (IntegerOpNode)     ||
       (!IsIntegerNode (IntegerOpNode)         &&
        !IsSpecialIntegerNode (IntegerOpNode)) ||
-      AmlNodeCompareOpCode (IntegerOpNode, AML_ONES_OP, 0)) {
+      AmlNodeCompareOpCode (IntegerOpNode, AML_ONES_OP, 0))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -349,7 +360,7 @@ AmlUpdateInteger (
   if (ValueWidthDiff != 0) {
     // Propagate the information.
     Status = AmlPropagateInformation (
-               (AML_NODE_HEADER*)IntegerOpNode,
+               (AML_NODE_HEADER *)IntegerOpNode,
                (ValueWidthDiff > 0) ? TRUE : FALSE,
                ABS (ValueWidthDiff),
                0
@@ -380,28 +391,29 @@ AmlUpdateInteger (
 EFI_STATUS
 EFIAPI
 AmlUpdateDataNode (
-  IN  AML_DATA_NODE         * DataNode,
-  IN  EAML_NODE_DATA_TYPE     DataType,
-  IN  UINT8                 * Buffer,
-  IN  UINT32                  Size
+  IN  AML_DATA_NODE        *DataNode,
+  IN  EAML_NODE_DATA_TYPE  DataType,
+  IN  UINT8                *Buffer,
+  IN  UINT32               Size
   )
 {
-  EFI_STATUS              Status;
+  EFI_STATUS  Status;
 
-  UINT32                  ExpectedSize;
-  AML_OBJECT_NODE       * ParentNode;
-  EAML_NODE_DATA_TYPE     ExpectedArgType;
-  EAML_PARSE_INDEX        Index;
+  UINT32               ExpectedSize;
+  AML_OBJECT_NODE      *ParentNode;
+  EAML_NODE_DATA_TYPE  ExpectedArgType;
+  EAML_PARSE_INDEX     Index;
 
   if (!IS_AML_DATA_NODE (DataNode)      ||
       (DataType > EAmlNodeDataTypeMax)  ||
       (Buffer == NULL)                  ||
-      (Size == 0)) {
+      (Size == 0))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  ParentNode = (AML_OBJECT_NODE*)AmlGetParent ((AML_NODE_HEADER*)DataNode);
+  ParentNode = (AML_OBJECT_NODE *)AmlGetParent ((AML_NODE_HEADER *)DataNode);
   if (!IS_AML_OBJECT_NODE (ParentNode)) {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
@@ -419,7 +431,8 @@ AmlUpdateDataNode (
       (((ExpectedArgType != EAmlNodeDataTypeRaw)            &&
         (ExpectedArgType != EAmlNodeDataTypeResourceData))  ||
        ((DataType != EAmlNodeDataTypeRaw)                   &&
-        (DataType != EAmlNodeDataTypeResourceData)))) {
+        (DataType != EAmlNodeDataTypeResourceData))))
+  {
     ASSERT (0);
     return EFI_UNSUPPORTED;
   }
@@ -430,12 +443,14 @@ AmlUpdateDataNode (
     {
       // Check the name contained in the Buffer is an AML name
       // with the right size.
-      Status = AmlGetNameStringSize ((CONST CHAR8*)Buffer, &ExpectedSize);
+      Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &ExpectedSize);
       if (EFI_ERROR (Status)  ||
-          (Size != ExpectedSize)) {
+          (Size != ExpectedSize))
+      {
         ASSERT (0);
         return Status;
       }
+
       break;
     }
     case EAmlNodeDataTypeString:
@@ -450,6 +465,7 @@ AmlUpdateDataNode (
           ASSERT (0);
           return EFI_INVALID_PARAMETER;
         }
+
         ExpectedSize++;
       }
 
@@ -457,13 +473,15 @@ AmlUpdateDataNode (
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
+
       break;
     }
     case EAmlNodeDataTypeUInt:
     {
-      if (AmlIsNodeFixedArgument ((CONST AML_NODE_HEADER*)DataNode, &Index)) {
+      if (AmlIsNodeFixedArgument ((CONST AML_NODE_HEADER *)DataNode, &Index)) {
         if ((ParentNode->AmlByteEncoding == NULL) ||
-            (ParentNode->AmlByteEncoding->Format == NULL)) {
+            (ParentNode->AmlByteEncoding->Format == NULL))
+        {
           ASSERT (0);
           return EFI_INVALID_PARAMETER;
         }
@@ -472,11 +490,13 @@ AmlUpdateDataNode (
         // E.g. for PackageOp the first fixed argument is of type EAmlUInt8
         // and represents the count of elements. This type cannot be changed.
         if ((ParentNode->AmlByteEncoding->Format[Index] != EAmlObject) &&
-            (DataNode->Size != Size)) {
+            (DataNode->Size != Size))
+        {
           ASSERT (0);
           return EFI_UNSUPPORTED;
         }
       }
+
       break;
     }
     case EAmlNodeDataTypeRaw:
@@ -486,6 +506,7 @@ AmlUpdateDataNode (
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
+
       break;
     }
     case EAmlNodeDataTypeResourceData:
@@ -495,7 +516,8 @@ AmlUpdateDataNode (
       // Large resource data must be at least as long as the header
       // of a large resource data.
       if (AML_RD_IS_LARGE (Buffer)  &&
-          (Size < sizeof (ACPI_LARGE_RESOURCE_HEADER))) {
+          (Size < sizeof (ACPI_LARGE_RESOURCE_HEADER)))
+      {
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
@@ -529,6 +551,7 @@ AmlUpdateDataNode (
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
+
       break;
     }
     // None and reserved types.
@@ -547,8 +570,8 @@ AmlUpdateDataNode (
                DataNode->NodeHeader.Parent,
                (Size > DataNode->Size) ? TRUE : FALSE,
                (Size > DataNode->Size) ?
-                (Size - DataNode->Size) :
-                (DataNode->Size - Size),
+               (Size - DataNode->Size) :
+               (DataNode->Size - Size),
                0
                );
     if (EFI_ERROR (Status)) {
@@ -564,6 +587,7 @@ AmlUpdateDataNode (
       ASSERT (0);
       return EFI_OUT_OF_RESOURCES;
     }
+
     DataNode->Size = Size;
   }
 

+ 163 - 129
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.c

@@ -23,11 +23,12 @@
 AML_NODE_HEADER *
 EFIAPI
 AmlGetParent (
-  IN  AML_NODE_HEADER   * Node
+  IN  AML_NODE_HEADER  *Node
   )
 {
   if (IS_AML_DATA_NODE (Node) ||
-      IS_AML_OBJECT_NODE (Node)) {
+      IS_AML_OBJECT_NODE (Node))
+  {
     return Node->Parent;
   }
 
@@ -45,7 +46,7 @@ AmlGetParent (
 AML_ROOT_NODE *
 EFIAPI
 AmlGetRootNode (
-  IN  CONST AML_NODE_HEADER   * Node
+  IN  CONST AML_NODE_HEADER  *Node
   )
 {
   if (!IS_AML_NODE_VALID (Node)) {
@@ -60,7 +61,8 @@ AmlGetRootNode (
       return NULL;
     }
   }
-  return (AML_ROOT_NODE*)Node;
+
+  return (AML_ROOT_NODE *)Node;
 }
 
 /** Get the node at the input Index in the fixed argument list of the input
@@ -77,8 +79,8 @@ AmlGetRootNode (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetFixedArgument (
-  IN  AML_OBJECT_NODE     * ObjectNode,
-  IN  EAML_PARSE_INDEX      Index
+  IN  AML_OBJECT_NODE   *ObjectNode,
+  IN  EAML_PARSE_INDEX  Index
   )
 {
   if (IS_AML_OBJECT_NODE (ObjectNode)) {
@@ -106,23 +108,24 @@ AmlGetFixedArgument (
 BOOLEAN
 EFIAPI
 AmlIsNodeFixedArgument (
-  IN  CONST  AML_NODE_HEADER     * Node,
-  OUT        EAML_PARSE_INDEX    * IndexPtr
+  IN  CONST  AML_NODE_HEADER   *Node,
+  OUT        EAML_PARSE_INDEX  *IndexPtr
   )
 {
-  AML_NODE_HEADER         * ParentNode;
+  AML_NODE_HEADER  *ParentNode;
 
-  EAML_PARSE_INDEX        Index;
-  EAML_PARSE_INDEX        MaxIndex;
+  EAML_PARSE_INDEX  Index;
+  EAML_PARSE_INDEX  MaxIndex;
 
   if ((IndexPtr == NULL)               ||
       (!IS_AML_DATA_NODE (Node)        &&
-       !IS_AML_OBJECT_NODE (Node))) {
+       !IS_AML_OBJECT_NODE (Node)))
+  {
     ASSERT (0);
     return FALSE;
   }
 
-  ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+  ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
   if (IS_AML_ROOT_NODE (ParentNode)) {
     return FALSE;
   } else if (IS_AML_DATA_NODE (ParentNode)) {
@@ -133,10 +136,10 @@ AmlIsNodeFixedArgument (
 
   // Check whether the Node is in the fixed argument list.
   MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
-                                 (AML_OBJECT_NODE*)ParentNode
+                                 (AML_OBJECT_NODE *)ParentNode
                                  );
   for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
-    if (AmlGetFixedArgument ((AML_OBJECT_NODE*)ParentNode, Index) == Node) {
+    if (AmlGetFixedArgument ((AML_OBJECT_NODE *)ParentNode, Index) == Node) {
       *IndexPtr = Index;
       return TRUE;
     }
@@ -163,21 +166,22 @@ AmlIsNodeFixedArgument (
 EFI_STATUS
 EFIAPI
 AmlSetFixedArgument (
-  IN  AML_OBJECT_NODE   * ObjectNode,
-  IN  EAML_PARSE_INDEX    Index,
-  IN  AML_NODE_HEADER   * NewNode
+  IN  AML_OBJECT_NODE   *ObjectNode,
+  IN  EAML_PARSE_INDEX  Index,
+  IN  AML_NODE_HEADER   *NewNode
   )
 {
   if (IS_AML_OBJECT_NODE (ObjectNode)                                     &&
       (Index <= (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (ObjectNode))  &&
       ((NewNode == NULL)                                                  ||
        IS_AML_OBJECT_NODE (NewNode)                                       ||
-       IS_AML_DATA_NODE (NewNode))) {
+       IS_AML_DATA_NODE (NewNode)))
+  {
     ObjectNode->FixedArgs[Index] = NewNode;
 
     // If NewNode is a data node or an object node, set its parent.
     if (NewNode != NULL) {
-      NewNode->Parent = (AML_NODE_HEADER*)ObjectNode;
+      NewNode->Parent = (AML_NODE_HEADER *)ObjectNode;
     }
 
     return EFI_SUCCESS;
@@ -199,14 +203,15 @@ AmlSetFixedArgument (
 LIST_ENTRY *
 EFIAPI
 AmlNodeGetVariableArgList (
-  IN  CONST AML_NODE_HEADER   * Node
+  IN  CONST AML_NODE_HEADER  *Node
   )
 {
   if (IS_AML_ROOT_NODE (Node)) {
-    return &(((AML_ROOT_NODE*)Node)->VariableArgs);
+    return &(((AML_ROOT_NODE *)Node)->VariableArgs);
   } else if (IS_AML_OBJECT_NODE (Node)) {
-    return &(((AML_OBJECT_NODE*)Node)->VariableArgs);
+    return &(((AML_OBJECT_NODE *)Node)->VariableArgs);
   }
+
   return NULL;
 }
 
@@ -226,22 +231,24 @@ AmlNodeGetVariableArgList (
 EFI_STATUS
 EFIAPI
 AmlRemoveNodeFromVarArgList (
-  IN  AML_NODE_HEADER   * Node
+  IN  AML_NODE_HEADER  *Node
   )
 {
-  EFI_STATUS          Status;
-  AML_NODE_HEADER   * ParentNode;
-  UINT32              Size;
+  EFI_STATUS       Status;
+  AML_NODE_HEADER  *ParentNode;
+  UINT32           Size;
 
   if ((!IS_AML_DATA_NODE (Node) &&
-       !IS_AML_OBJECT_NODE (Node))) {
+       !IS_AML_OBJECT_NODE (Node)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   ParentNode = AmlGetParent (Node);
   if (!IS_AML_ROOT_NODE (ParentNode)  &&
-      !IS_AML_OBJECT_NODE (ParentNode)) {
+      !IS_AML_OBJECT_NODE (ParentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -249,7 +256,9 @@ AmlRemoveNodeFromVarArgList (
   // Check the node is in its parent variable list of arguments.
   if (!IsNodeInList (
          AmlNodeGetVariableArgList (ParentNode),
-         &Node->Link)) {
+         &Node->Link
+         ))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -289,7 +298,7 @@ AmlRemoveNodeFromVarArgList (
 EFI_STATUS
 EFIAPI
 AmlDetachNode (
-  IN  AML_NODE_HEADER   * Node
+  IN  AML_NODE_HEADER  *Node
   )
 {
   return AmlRemoveNodeFromVarArgList (Node);
@@ -308,13 +317,13 @@ AmlDetachNode (
 EFI_STATUS
 EFIAPI
 AmlVarListAddHead (
-  IN  AML_NODE_HEADER  * ParentNode,
-  IN  AML_NODE_HEADER  * NewNode
+  IN  AML_NODE_HEADER  *ParentNode,
+  IN  AML_NODE_HEADER  *NewNode
   )
 {
-  EFI_STATUS    Status;
-  UINT32        NewSize;
-  LIST_ENTRY  * ChildrenList;
+  EFI_STATUS  Status;
+  UINT32      NewSize;
+  LIST_ENTRY  *ChildrenList;
 
   // Check arguments and that NewNode is not already attached to a tree.
   // ParentNode != Data Node AND NewNode != Root Node AND NewNode != attached.
@@ -322,7 +331,8 @@ AmlVarListAddHead (
        !IS_AML_OBJECT_NODE (ParentNode))  ||
       (!IS_AML_DATA_NODE (NewNode)        &&
        !IS_AML_OBJECT_NODE (NewNode))     ||
-      !AML_NODE_IS_DETACHED (NewNode)) {
+      !AML_NODE_IS_DETACHED (NewNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -367,11 +377,11 @@ AmlVarListAddHead (
 EFI_STATUS
 EFIAPI
 AmlVarListAddTailInternal (
-  IN  AML_NODE_HEADER  * ParentNode,
-  IN  AML_NODE_HEADER  * NewNode
+  IN  AML_NODE_HEADER  *ParentNode,
+  IN  AML_NODE_HEADER  *NewNode
   )
 {
-  LIST_ENTRY  * ChildrenList;
+  LIST_ENTRY  *ChildrenList;
 
   // Check arguments and that NewNode is not already attached to a tree.
   // ParentNode != Data Node AND NewNode != Root Node AND NewNode != attached.
@@ -379,7 +389,8 @@ AmlVarListAddTailInternal (
        !IS_AML_OBJECT_NODE (ParentNode))  ||
       (!IS_AML_DATA_NODE (NewNode)        &&
        !IS_AML_OBJECT_NODE (NewNode))     ||
-      !AML_NODE_IS_DETACHED (NewNode)) {
+      !AML_NODE_IS_DETACHED (NewNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -410,8 +421,8 @@ AmlVarListAddTailInternal (
 EFI_STATUS
 EFIAPI
 AmlVarListAddTail (
-  IN  AML_NODE_HEADER   * ParentNode,
-  IN  AML_NODE_HEADER   * NewNode
+  IN  AML_NODE_HEADER  *ParentNode,
+  IN  AML_NODE_HEADER  *NewNode
   )
 {
   EFI_STATUS  Status;
@@ -451,25 +462,27 @@ AmlVarListAddTail (
 EFI_STATUS
 EFIAPI
 AmlVarListAddBefore (
-  IN  AML_NODE_HEADER  * Node,
-  IN  AML_NODE_HEADER  * NewNode
+  IN  AML_NODE_HEADER  *Node,
+  IN  AML_NODE_HEADER  *NewNode
   )
 {
-  EFI_STATUS         Status;
-  AML_NODE_HEADER  * ParentNode;
-  UINT32             NewSize;
+  EFI_STATUS       Status;
+  AML_NODE_HEADER  *ParentNode;
+  UINT32           NewSize;
 
   // Check arguments and that NewNode is not already attached to a tree.
   if ((!IS_AML_DATA_NODE (NewNode)        &&
        !IS_AML_OBJECT_NODE (NewNode))     ||
-      !AML_NODE_IS_DETACHED (NewNode)) {
+      !AML_NODE_IS_DETACHED (NewNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   ParentNode = AmlGetParent (Node);
   if (!IS_AML_ROOT_NODE (ParentNode)    &&
-      !IS_AML_OBJECT_NODE (ParentNode)) {
+      !IS_AML_OBJECT_NODE (ParentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -505,25 +518,27 @@ AmlVarListAddBefore (
 EFI_STATUS
 EFIAPI
 AmlVarListAddAfter (
-  IN  AML_NODE_HEADER   * Node,
-  IN  AML_NODE_HEADER   * NewNode
+  IN  AML_NODE_HEADER  *Node,
+  IN  AML_NODE_HEADER  *NewNode
   )
 {
-  EFI_STATUS          Status;
-  AML_NODE_HEADER   * ParentNode;
-  UINT32              NewSize;
+  EFI_STATUS       Status;
+  AML_NODE_HEADER  *ParentNode;
+  UINT32           NewSize;
 
   // Check arguments and that NewNode is not already attached to a tree.
   if ((!IS_AML_DATA_NODE (NewNode)        &&
        !IS_AML_OBJECT_NODE (NewNode))     ||
-      !AML_NODE_IS_DETACHED (NewNode)) {
+      !AML_NODE_IS_DETACHED (NewNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   ParentNode = AmlGetParent (Node);
   if (!IS_AML_ROOT_NODE (ParentNode)    &&
-      !IS_AML_OBJECT_NODE (ParentNode)) {
+      !IS_AML_OBJECT_NODE (ParentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -561,16 +576,17 @@ AmlVarListAddAfter (
 EFI_STATUS
 EFIAPI
 AmlAppendRdNode (
-  IN  AML_OBJECT_NODE   * BufferOpNode,
-  IN  AML_DATA_NODE     * NewRdNode
+  IN  AML_OBJECT_NODE  *BufferOpNode,
+  IN  AML_DATA_NODE    *NewRdNode
   )
 {
-  EFI_STATUS        Status;
-  AML_DATA_NODE   * LastRdNode;
+  EFI_STATUS     Status;
+  AML_DATA_NODE  *LastRdNode;
 
   if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0)  ||
       !IS_AML_DATA_NODE (NewRdNode)                           ||
-      (NewRdNode->DataType != EAmlNodeDataTypeResourceData)) {
+      (NewRdNode->DataType != EAmlNodeDataTypeResourceData))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -590,22 +606,24 @@ AmlAppendRdNode (
   // Get the last Resource data node in the variable list of argument of the
   // BufferOp node. This must be an EndTag, otherwise setting the checksum
   // would have failed.
-  LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument (
-                                 (AML_NODE_HEADER*)BufferOpNode,
-                                 NULL
-                                 );
+  LastRdNode = (AML_DATA_NODE *)AmlGetPreviousVariableArgument (
+                                  (AML_NODE_HEADER *)BufferOpNode,
+                                  NULL
+                                  );
   if ((LastRdNode == NULL)             ||
       !IS_AML_DATA_NODE (LastRdNode)   ||
-      (LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
+      (LastRdNode->DataType != EAmlNodeDataTypeResourceData))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   // Add NewRdNode before the EndTag.
   Status = AmlVarListAddBefore (
-             (AML_NODE_HEADER*)LastRdNode,
-             (AML_NODE_HEADER*)NewRdNode)
-             ;
+             (AML_NODE_HEADER *)LastRdNode,
+             (AML_NODE_HEADER *)NewRdNode
+             )
+  ;
   ASSERT_EFI_ERROR (Status);
   return Status;
 }
@@ -628,23 +646,24 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlReplaceFixedArgument (
-  IN  AML_OBJECT_NODE      * ParentNode,
-  IN  EAML_PARSE_INDEX       Index,
-  IN  AML_NODE_HEADER      * NewNode
+  IN  AML_OBJECT_NODE   *ParentNode,
+  IN  EAML_PARSE_INDEX  Index,
+  IN  AML_NODE_HEADER   *NewNode
   )
 {
-  EFI_STATUS              Status;
+  EFI_STATUS  Status;
 
-  AML_NODE_HEADER       * OldNode;
-  UINT32                  NewSize;
-  UINT32                  OldSize;
-  AML_PARSE_FORMAT        FixedArgType;
+  AML_NODE_HEADER   *OldNode;
+  UINT32            NewSize;
+  UINT32            OldSize;
+  AML_PARSE_FORMAT  FixedArgType;
 
   // Check arguments and that NewNode is not already attached to a tree.
   if (!IS_AML_OBJECT_NODE (ParentNode)  ||
       (!IS_AML_DATA_NODE (NewNode)      &&
        !IS_AML_OBJECT_NODE (NewNode))   ||
-      !AML_NODE_IS_DETACHED (NewNode)) {
+      !AML_NODE_IS_DETACHED (NewNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -657,11 +676,14 @@ AmlReplaceFixedArgument (
       // A FieldPkgLen can only have a parent node with the
       // AML_IS_FIELD_ELEMENT flag.
       if (!AmlNodeHasAttribute (
-             (AML_OBJECT_NODE*)ParentNode,
-             AML_HAS_FIELD_LIST)) {
+             (AML_OBJECT_NODE *)ParentNode,
+             AML_HAS_FIELD_LIST
+             ))
+      {
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
+
       // Fall through.
     }
 
@@ -676,11 +698,13 @@ AmlReplaceFixedArgument (
       // data node of the same type.
       // Note: This condition might be too strict, but safer.
       if (!IS_AML_DATA_NODE (NewNode) ||
-          (((AML_DATA_NODE*)NewNode)->DataType !=
-            AmlTypeToNodeDataType (FixedArgType))) {
+          (((AML_DATA_NODE *)NewNode)->DataType !=
+           AmlTypeToNodeDataType (FixedArgType)))
+      {
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
+
       break;
     }
 
@@ -733,11 +757,11 @@ AmlReplaceFixedArgument (
 
   // Propagate the new information.
   Status = AmlPropagateInformation (
-            (AML_NODE_HEADER*)ParentNode,
-            (NewSize > OldSize) ? TRUE : FALSE,
-            (NewSize > OldSize) ? (NewSize - OldSize) : (OldSize - NewSize),
-            0
-            );
+             (AML_NODE_HEADER *)ParentNode,
+             (NewSize > OldSize) ? TRUE : FALSE,
+             (NewSize > OldSize) ? (NewSize - OldSize) : (OldSize - NewSize),
+             0
+             );
   ASSERT_EFI_ERROR (Status);
 
   return Status;
@@ -760,18 +784,18 @@ AmlReplaceFixedArgument (
 EFI_STATUS
 EFIAPI
 AmlReplaceVariableArgument (
-  IN  AML_NODE_HEADER   * OldNode,
-  IN  AML_NODE_HEADER   * NewNode
+  IN  AML_NODE_HEADER  *OldNode,
+  IN  AML_NODE_HEADER  *NewNode
   )
 {
-  EFI_STATUS          Status;
-  UINT32              NewSize;
-  UINT32              OldSize;
-  EAML_PARSE_INDEX    Index;
+  EFI_STATUS        Status;
+  UINT32            NewSize;
+  UINT32            OldSize;
+  EAML_PARSE_INDEX  Index;
 
-  AML_DATA_NODE     * NewDataNode;
-  AML_NODE_HEADER   * ParentNode;
-  LIST_ENTRY        * NextLink;
+  AML_DATA_NODE    *NewDataNode;
+  AML_NODE_HEADER  *ParentNode;
+  LIST_ENTRY       *NextLink;
 
   // Check arguments, that NewNode is not already attached to a tree,
   // and that OldNode is attached and not in a fixed list of arguments.
@@ -781,19 +805,21 @@ AmlReplaceVariableArgument (
        !IS_AML_OBJECT_NODE (NewNode))   ||
       !AML_NODE_IS_DETACHED (NewNode)   ||
       AML_NODE_IS_DETACHED (OldNode)    ||
-      AmlIsNodeFixedArgument (OldNode, &Index)) {
+      AmlIsNodeFixedArgument (OldNode, &Index))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   ParentNode = AmlGetParent (OldNode);
-    if (!IS_AML_ROOT_NODE (ParentNode)    &&
-        !IS_AML_OBJECT_NODE (ParentNode)) {
+  if (!IS_AML_ROOT_NODE (ParentNode)    &&
+      !IS_AML_OBJECT_NODE (ParentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  NewDataNode = (AML_DATA_NODE*)NewNode;
+  NewDataNode = (AML_DATA_NODE *)NewNode;
 
   // Check attributes if the parent node is an object node.
   if (IS_AML_OBJECT_NODE (ParentNode)) {
@@ -801,21 +827,26 @@ AmlReplaceVariableArgument (
     // data node or an object node. This has already been checked. So,
     // check for other cases.
 
-    if (AmlNodeHasAttribute ((AML_OBJECT_NODE*)ParentNode, AML_HAS_BYTE_LIST)) {
+    if (AmlNodeHasAttribute ((AML_OBJECT_NODE *)ParentNode, AML_HAS_BYTE_LIST)) {
       if (!IS_AML_DATA_NODE (NewNode)                       ||
           ((NewDataNode->DataType != EAmlNodeDataTypeRaw)   &&
-           (NewDataNode->DataType != EAmlNodeDataTypeResourceData))) {
+           (NewDataNode->DataType != EAmlNodeDataTypeResourceData)))
+      {
         // A child node of a node with the BYTE_LIST flag must be a data node,
         // containing raw data or a resource data.
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
     } else if (AmlNodeHasAttribute (
-                (AML_OBJECT_NODE*)ParentNode,
-                AML_HAS_FIELD_LIST)) {
+                 (AML_OBJECT_NODE *)ParentNode,
+                 AML_HAS_FIELD_LIST
+                 ))
+    {
       if (!AmlNodeHasAttribute (
-             (CONST AML_OBJECT_NODE*)NewNode,
-              AML_IS_FIELD_ELEMENT)) {
+             (CONST AML_OBJECT_NODE *)NewNode,
+             AML_IS_FIELD_ELEMENT
+             ))
+      {
         // A child node of a node with the FIELD_LIST flag must be an object
         // node with AML_IS_FIELD_ELEMENT flag.
         ASSERT (0);
@@ -882,20 +913,21 @@ AmlReplaceVariableArgument (
 EFI_STATUS
 EFIAPI
 AmlReplaceArgument (
-  IN  AML_NODE_HEADER   * OldNode,
-  IN  AML_NODE_HEADER   * NewNode
+  IN  AML_NODE_HEADER  *OldNode,
+  IN  AML_NODE_HEADER  *NewNode
   )
 {
-  EFI_STATUS            Status;
-  AML_NODE_HEADER     * ParentNode;
-  EAML_PARSE_INDEX      Index;
+  EFI_STATUS        Status;
+  AML_NODE_HEADER   *ParentNode;
+  EAML_PARSE_INDEX  Index;
 
   // Check arguments and that NewNode is not already attached to a tree.
   if ((!IS_AML_DATA_NODE (OldNode)      &&
        !IS_AML_OBJECT_NODE (OldNode))   ||
       (!IS_AML_DATA_NODE (NewNode)      &&
        !IS_AML_OBJECT_NODE (NewNode))   ||
-      !AML_NODE_IS_DETACHED (NewNode)) {
+      !AML_NODE_IS_DETACHED (NewNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -903,7 +935,8 @@ AmlReplaceArgument (
   // ParentNode can be a root node or an object node.
   ParentNode = AmlGetParent (OldNode);
   if (!IS_AML_ROOT_NODE (ParentNode)  &&
-      !IS_AML_OBJECT_NODE (ParentNode)) {
+      !IS_AML_OBJECT_NODE (ParentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -911,7 +944,7 @@ AmlReplaceArgument (
   if (AmlIsNodeFixedArgument (OldNode, &Index)) {
     // OldNode is in its parent's fixed argument list at the Index.
     Status = AmlReplaceFixedArgument (
-               (AML_OBJECT_NODE*)ParentNode,
+               (AML_OBJECT_NODE *)ParentNode,
                Index,
                NewNode
                );
@@ -942,18 +975,18 @@ AmlReplaceArgument (
 EFI_STATUS
 EFIAPI
 AmlDeleteTree (
-  IN  AML_NODE_HEADER  * Node
+  IN  AML_NODE_HEADER  *Node
   )
 {
-  EFI_STATUS            Status;
+  EFI_STATUS  Status;
 
-  EAML_PARSE_INDEX      Index;
-  EAML_PARSE_INDEX      MaxIndex;
+  EAML_PARSE_INDEX  Index;
+  EAML_PARSE_INDEX  MaxIndex;
 
-  AML_NODE_HEADER     * Arg;
-  LIST_ENTRY          * StartLink;
-  LIST_ENTRY          * CurrentLink;
-  LIST_ENTRY          * NextLink;
+  AML_NODE_HEADER  *Arg;
+  LIST_ENTRY       *StartLink;
+  LIST_ENTRY       *CurrentLink;
+  LIST_ENTRY       *NextLink;
 
   // Check that the node being deleted is unlinked.
   // When removing the node, its parent pointer and
@@ -961,7 +994,8 @@ AmlDeleteTree (
   // InitializeListHead. Thus it must be detached
   // from the tree to avoid memory leaks.
   if (!IS_AML_NODE_VALID (Node)  ||
-      !AML_NODE_IS_DETACHED (Node)) {
+      !AML_NODE_IS_DETACHED (Node))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -970,10 +1004,10 @@ AmlDeleteTree (
   //    Iterate through the fixed list of arguments.
   if (IS_AML_OBJECT_NODE (Node)) {
     MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
-                                   (AML_OBJECT_NODE*)Node
+                                   (AML_OBJECT_NODE *)Node
                                    );
     for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
-      Arg = AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index);
+      Arg = AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
       if (Arg == NULL) {
         // A fixed argument is missing. The tree is inconsistent.
         // Note: During CodeGeneration, the fixed arguments should be set
@@ -986,7 +1020,7 @@ AmlDeleteTree (
 
       // Remove the node from the fixed argument list.
       Arg->Parent = NULL;
-      Status = AmlSetFixedArgument ((AML_OBJECT_NODE*)Node, Index, NULL);
+      Status      = AmlSetFixedArgument ((AML_OBJECT_NODE *)Node, Index, NULL);
       if (EFI_ERROR (Status)) {
         ASSERT (0);
         return Status;
@@ -1011,9 +1045,9 @@ AmlDeleteTree (
       // Unlink the node from the tree.
       NextLink = RemoveEntryList (CurrentLink);
       InitializeListHead (CurrentLink);
-      ((AML_NODE_HEADER*)CurrentLink)->Parent = NULL;
+      ((AML_NODE_HEADER *)CurrentLink)->Parent = NULL;
 
-      Status = AmlDeleteTree ((AML_NODE_HEADER*)CurrentLink);
+      Status = AmlDeleteTree ((AML_NODE_HEADER *)CurrentLink);
       if (EFI_ERROR (Status)) {
         ASSERT (0);
         return Status;

+ 11 - 12
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.h

@@ -22,7 +22,7 @@
 AML_ROOT_NODE *
 EFIAPI
 AmlGetRootNode (
-  IN  CONST AML_NODE_HEADER   * Node
+  IN  CONST AML_NODE_HEADER  *Node
   );
 
 /** Check whether the input Node is in the fixed argument list of its parent
@@ -41,8 +41,8 @@ AmlGetRootNode (
 BOOLEAN
 EFIAPI
 AmlIsNodeFixedArgument (
-  IN  CONST  AML_NODE_HEADER     * Node,
-  OUT        EAML_PARSE_INDEX    * IndexPtr
+  IN  CONST  AML_NODE_HEADER   *Node,
+  OUT        EAML_PARSE_INDEX  *IndexPtr
   );
 
 /** Set the fixed argument of the ObjectNode at the Index to the NewNode.
@@ -63,9 +63,9 @@ AmlIsNodeFixedArgument (
 EFI_STATUS
 EFIAPI
 AmlSetFixedArgument (
-  IN  AML_OBJECT_NODE   * ObjectNode,
-  IN  EAML_PARSE_INDEX    Index,
-  IN  AML_NODE_HEADER   * NewNode
+  IN  AML_OBJECT_NODE   *ObjectNode,
+  IN  EAML_PARSE_INDEX  Index,
+  IN  AML_NODE_HEADER   *NewNode
   );
 
 /** If the given AML_NODE_HEADER has a variable list of arguments,
@@ -80,7 +80,7 @@ AmlSetFixedArgument (
 LIST_ENTRY *
 EFIAPI
 AmlNodeGetVariableArgList (
-  IN  CONST AML_NODE_HEADER   * Node
+  IN  CONST AML_NODE_HEADER  *Node
   );
 
 /** Add the NewNode to the tail of the variable list of arguments
@@ -99,8 +99,8 @@ AmlNodeGetVariableArgList (
 EFI_STATUS
 EFIAPI
 AmlVarListAddTailInternal (
-  IN  AML_NODE_HEADER  * ParentNode,
-  IN  AML_NODE_HEADER  * NewNode
+  IN  AML_NODE_HEADER  *ParentNode,
+  IN  AML_NODE_HEADER  *NewNode
   );
 
 /** Replace the OldNode by the NewNode.
@@ -119,9 +119,8 @@ AmlVarListAddTailInternal (
 EFI_STATUS
 EFIAPI
 AmlReplaceArgument (
-  IN  AML_NODE_HEADER   * OldNode,
-  IN  AML_NODE_HEADER   * NewNode
+  IN  AML_NODE_HEADER  *OldNode,
+  IN  AML_NODE_HEADER  *NewNode
   );
 
 #endif // AML_TREE_H_
-

+ 14 - 12
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeEnumerator.c

@@ -33,25 +33,26 @@
 BOOLEAN
 EFIAPI
 AmlEnumTree (
-  IN      AML_NODE_HEADER               * Node,
-  IN      EDKII_AML_TREE_ENUM_CALLBACK    CallBack,
-  IN  OUT VOID                          * Context   OPTIONAL,
-      OUT EFI_STATUS                    * Status    OPTIONAL
+  IN      AML_NODE_HEADER               *Node,
+  IN      EDKII_AML_TREE_ENUM_CALLBACK  CallBack,
+  IN  OUT VOID                          *Context   OPTIONAL,
+  OUT EFI_STATUS                        *Status    OPTIONAL
   )
 {
-  BOOLEAN               ContinueEnum;
+  BOOLEAN  ContinueEnum;
 
-  EAML_PARSE_INDEX      Index;
-  EAML_PARSE_INDEX      MaxIndex;
+  EAML_PARSE_INDEX  Index;
+  EAML_PARSE_INDEX  MaxIndex;
 
-  LIST_ENTRY          * StartLink;
-  LIST_ENTRY          * CurrentLink;
+  LIST_ENTRY  *StartLink;
+  LIST_ENTRY  *CurrentLink;
 
   if (!IS_AML_NODE_VALID (Node) || (CallBack == NULL)) {
     ASSERT (0);
     if (Status != NULL) {
       *Status = EFI_INVALID_PARAMETER;
     }
+
     return FALSE;
   }
 
@@ -62,11 +63,11 @@ AmlEnumTree (
 
   // Iterate through the fixed list of arguments.
   MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
-                                 (AML_OBJECT_NODE*)Node
+                                 (AML_OBJECT_NODE *)Node
                                  );
   for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
     ContinueEnum = AmlEnumTree (
-                     AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index),
+                     AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index),
                      CallBack,
                      Context,
                      Status
@@ -82,7 +83,7 @@ AmlEnumTree (
     CurrentLink = StartLink->ForwardLink;
     while (CurrentLink != StartLink) {
       ContinueEnum = AmlEnumTree (
-                       (AML_NODE_HEADER*)CurrentLink,
+                       (AML_NODE_HEADER *)CurrentLink,
                        CallBack,
                        Context,
                        Status
@@ -90,6 +91,7 @@ AmlEnumTree (
       if (ContinueEnum == FALSE) {
         return ContinueEnum;
       }
+
       CurrentLink = CurrentLink->ForwardLink;
     } // while
   }

+ 63 - 51
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.c

@@ -25,10 +25,10 @@ typedef struct AmlTreeInternalIterator {
   //       of the Tree iterator APIs.
 
   /// Pointer to the node on which the iterator has been initialized.
-  CONST  AML_NODE_HEADER  * InitialNode;
+  CONST  AML_NODE_HEADER    *InitialNode;
 
   /// Pointer to the current node.
-  CONST  AML_NODE_HEADER  * CurrentNode;
+  CONST  AML_NODE_HEADER    *CurrentNode;
 
   /// Iteration mode.
   /// Allow to choose how to traverse the tree/choose which node is next.
@@ -47,13 +47,13 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlIteratorGetNode (
-  IN  AML_TREE_ITERATOR   * Iterator,
-  OUT AML_NODE_HEADER    ** OutNode
+  IN  AML_TREE_ITERATOR  *Iterator,
+  OUT AML_NODE_HEADER    **OutNode
   )
 {
-  AML_TREE_ITERATOR_INTERNAL  * InternalIterator;
+  AML_TREE_ITERATOR_INTERNAL  *InternalIterator;
 
-  InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+  InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
 
   // CurrentNode can be NULL, but InitialNode cannot.
   if ((OutNode == NULL)                                       ||
@@ -62,12 +62,13 @@ AmlIteratorGetNode (
       (InternalIterator->Mode >= EAmlIteratorModeMax)         ||
       !IS_AML_NODE_VALID (InternalIterator->InitialNode)      ||
       ((InternalIterator->CurrentNode != NULL)                &&
-        !IS_AML_NODE_VALID (InternalIterator->CurrentNode))) {
+       !IS_AML_NODE_VALID (InternalIterator->CurrentNode)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  *OutNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode;
+  *OutNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
 
   return EFI_SUCCESS;
 }
@@ -87,19 +88,20 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlIteratorGetNextLinear (
-  IN  AML_TREE_ITERATOR  * Iterator,
-  OUT AML_NODE_HEADER   ** NextNode
+  IN  AML_TREE_ITERATOR  *Iterator,
+  OUT AML_NODE_HEADER    **NextNode
   )
 {
-  AML_TREE_ITERATOR_INTERNAL  * InternalIterator;
+  AML_TREE_ITERATOR_INTERNAL  *InternalIterator;
 
-  InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+  InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
 
   // CurrentNode can be NULL, but InitialNode cannot.
   if ((InternalIterator == NULL)                              ||
       (InternalIterator->Mode != EAmlIteratorLinear)          ||
       !IS_AML_NODE_VALID (InternalIterator->InitialNode)      ||
-      !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
+      !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -110,8 +112,9 @@ AmlIteratorGetNextLinear (
                                     );
 
   if (NextNode != NULL) {
-    *NextNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode;
+    *NextNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
   }
+
   return EFI_SUCCESS;
 }
 
@@ -130,19 +133,20 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlIteratorGetPreviousLinear (
-  IN  AML_TREE_ITERATOR  * Iterator,
-  OUT AML_NODE_HEADER   ** PrevNode
+  IN  AML_TREE_ITERATOR  *Iterator,
+  OUT AML_NODE_HEADER    **PrevNode
   )
 {
-  AML_TREE_ITERATOR_INTERNAL  * InternalIterator;
+  AML_TREE_ITERATOR_INTERNAL  *InternalIterator;
 
-  InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+  InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
 
   // CurrentNode can be NULL, but InitialNode cannot.
   if ((InternalIterator == NULL)                              ||
       (InternalIterator->Mode != EAmlIteratorLinear)          ||
       !IS_AML_NODE_VALID (InternalIterator->InitialNode)      ||
-      !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
+      !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -152,8 +156,9 @@ AmlIteratorGetPreviousLinear (
                                     InternalIterator->CurrentNode
                                     );
   if (PrevNode != NULL) {
-    *PrevNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode;
+    *PrevNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
   }
+
   return EFI_SUCCESS;
 }
 
@@ -172,20 +177,21 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlIteratorGetNextBranch (
-  IN  AML_TREE_ITERATOR  * Iterator,
-  OUT AML_NODE_HEADER   ** NextNode
+  IN  AML_TREE_ITERATOR  *Iterator,
+  OUT AML_NODE_HEADER    **NextNode
   )
 {
-  AML_TREE_ITERATOR_INTERNAL  * InternalIterator;
-  AML_NODE_HEADER             * Node;
+  AML_TREE_ITERATOR_INTERNAL  *InternalIterator;
+  AML_NODE_HEADER             *Node;
 
-  InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+  InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
 
   // CurrentNode can be NULL, but InitialNode cannot.
   if ((InternalIterator == NULL)                              ||
       (InternalIterator->Mode != EAmlIteratorBranch)          ||
       !IS_AML_NODE_VALID (InternalIterator->InitialNode)      ||
-      !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
+      !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -193,7 +199,8 @@ AmlIteratorGetNextBranch (
   Node = AmlGetNextNode (InternalIterator->CurrentNode);
   // Check whether NextNode is a sibling of InitialNode.
   if (AmlGetParent (Node) ==
-        AmlGetParent ((AML_NODE_HEADER*)InternalIterator->InitialNode)) {
+      AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode))
+  {
     Node = NULL;
   }
 
@@ -202,6 +209,7 @@ AmlIteratorGetNextBranch (
   if (NextNode != NULL) {
     *NextNode = Node;
   }
+
   return EFI_SUCCESS;
 }
 
@@ -220,20 +228,21 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlIteratorGetPreviousBranch (
-  IN  AML_TREE_ITERATOR  * Iterator,
-  OUT AML_NODE_HEADER   ** PrevNode
+  IN  AML_TREE_ITERATOR  *Iterator,
+  OUT AML_NODE_HEADER    **PrevNode
   )
 {
-  AML_TREE_ITERATOR_INTERNAL  * InternalIterator;
-  AML_NODE_HEADER             * Node;
+  AML_TREE_ITERATOR_INTERNAL  *InternalIterator;
+  AML_NODE_HEADER             *Node;
 
-  InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+  InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
 
   // CurrentNode can be NULL, but InitialNode cannot.
   if ((InternalIterator == NULL)                              ||
       (InternalIterator->Mode != EAmlIteratorBranch)          ||
       !IS_AML_NODE_VALID (InternalIterator->InitialNode)      ||
-      !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
+      !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -241,7 +250,8 @@ AmlIteratorGetPreviousBranch (
   Node = AmlGetPreviousNode (InternalIterator->CurrentNode);
   // Check whether PreviousNode is a sibling of InitialNode.
   if (AmlGetParent (Node) ==
-        AmlGetParent ((AML_NODE_HEADER*)InternalIterator->InitialNode)) {
+      AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode))
+  {
     Node = NULL;
   }
 
@@ -250,6 +260,7 @@ AmlIteratorGetPreviousBranch (
   if (PrevNode != NULL) {
     *PrevNode = Node;
   }
+
   return EFI_SUCCESS;
 }
 
@@ -269,47 +280,48 @@ AmlIteratorGetPreviousBranch (
 EFI_STATUS
 EFIAPI
 AmlInitializeIterator (
-  IN   AML_NODE_HEADER      * Node,
-  IN   EAML_ITERATOR_MODE     IteratorMode,
-  OUT  AML_TREE_ITERATOR   ** IteratorPtr
+  IN   AML_NODE_HEADER     *Node,
+  IN   EAML_ITERATOR_MODE  IteratorMode,
+  OUT  AML_TREE_ITERATOR   **IteratorPtr
   )
 {
-  AML_TREE_ITERATOR_INTERNAL * InternalIterator;
+  AML_TREE_ITERATOR_INTERNAL  *InternalIterator;
 
   if (!IS_AML_NODE_VALID (Node)             ||
       (IteratorMode <= EAmlIteratorUnknown) ||
       (IteratorMode >= EAmlIteratorModeMax) ||
-      (IteratorPtr == NULL)) {
+      (IteratorPtr == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  *IteratorPtr = NULL;
-  InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)AllocateZeroPool (
-                                                    sizeof (
-                                                      AML_TREE_ITERATOR_INTERNAL
-                                                      )
-                                                    );
+  *IteratorPtr     = NULL;
+  InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)AllocateZeroPool (
+                                                     sizeof (
+                                                             AML_TREE_ITERATOR_INTERNAL
+                                                             )
+                                                     );
   if (InternalIterator == NULL) {
     ASSERT (0);
     return EFI_OUT_OF_RESOURCES;
   }
 
-  InternalIterator->InitialNode = Node;
-  InternalIterator->CurrentNode = Node;
-  InternalIterator->Mode = IteratorMode;
+  InternalIterator->InitialNode      = Node;
+  InternalIterator->CurrentNode      = Node;
+  InternalIterator->Mode             = IteratorMode;
   InternalIterator->Iterator.GetNode = AmlIteratorGetNode;
 
   switch (InternalIterator->Mode) {
     case EAmlIteratorLinear:
     {
-      InternalIterator->Iterator.GetNext = AmlIteratorGetNextLinear;
+      InternalIterator->Iterator.GetNext     = AmlIteratorGetNextLinear;
       InternalIterator->Iterator.GetPrevious = AmlIteratorGetPreviousLinear;
       break;
     }
     case EAmlIteratorBranch:
     {
-      InternalIterator->Iterator.GetNext = AmlIteratorGetNextBranch;
+      InternalIterator->Iterator.GetNext     = AmlIteratorGetNextBranch;
       InternalIterator->Iterator.GetPrevious = AmlIteratorGetPreviousBranch;
       break;
     }
@@ -339,7 +351,7 @@ AmlInitializeIterator (
 EFI_STATUS
 EFIAPI
 AmlDeleteIterator (
-  IN  AML_TREE_ITERATOR   * Iterator
+  IN  AML_TREE_ITERATOR  *Iterator
   )
 {
   if (Iterator == NULL) {

+ 16 - 17
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.h

@@ -115,9 +115,9 @@ typedef struct AmlTreeIterator AML_TREE_ITERATOR;
 */
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_NODE) (
-  IN  AML_TREE_ITERATOR  * Iterator,
-  OUT AML_NODE_HANDLE    * OutNode
+(EFIAPI *EDKII_AML_TREE_ITERATOR_GET_NODE)(
+  IN  AML_TREE_ITERATOR  *Iterator,
+  OUT AML_NODE_HANDLE    *OutNode
   );
 
 /** Function pointer to move the current node of the iterator to the
@@ -135,9 +135,9 @@ EFI_STATUS
 */
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_NEXT) (
-  IN  AML_TREE_ITERATOR  * Iterator,
-  OUT AML_NODE_HANDLE    * NextNode
+(EFIAPI *EDKII_AML_TREE_ITERATOR_GET_NEXT)(
+  IN  AML_TREE_ITERATOR  *Iterator,
+  OUT AML_NODE_HANDLE    *NextNode
   );
 
 /** Function pointer to move the current node of the iterator to the
@@ -155,9 +155,9 @@ EFI_STATUS
 */
 typedef
 EFI_STATUS
-(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_PREVIOUS) (
-  IN  AML_TREE_ITERATOR  * Iterator,
-  OUT AML_NODE_HANDLE    * PrevNode
+(EFIAPI *EDKII_AML_TREE_ITERATOR_GET_PREVIOUS)(
+  IN  AML_TREE_ITERATOR  *Iterator,
+  OUT AML_NODE_HANDLE    *PrevNode
   );
 
 /**  Iterator structure to traverse the tree.
@@ -166,16 +166,15 @@ EFI_STATUS
 */
 typedef struct AmlTreeIterator {
   /// Get the current node of the iterator.
-  EDKII_AML_TREE_ITERATOR_GET_NODE      GetNode;
+  EDKII_AML_TREE_ITERATOR_GET_NODE        GetNode;
 
   /// Update the current node of the iterator with the next node.
-  EDKII_AML_TREE_ITERATOR_GET_NEXT      GetNext;
+  EDKII_AML_TREE_ITERATOR_GET_NEXT        GetNext;
 
   /// Update the current node of the iterator with the previous node.
-  EDKII_AML_TREE_ITERATOR_GET_PREVIOUS  GetPrevious;
+  EDKII_AML_TREE_ITERATOR_GET_PREVIOUS    GetPrevious;
 } AML_TREE_ITERATOR;
 
-
 /** Initialize an iterator.
 
   Note: The caller must call AmlDeleteIterator () to free the memory
@@ -194,9 +193,9 @@ typedef struct AmlTreeIterator {
 EFI_STATUS
 EFIAPI
 AmlInitializeIterator (
-  IN   AML_NODE_HANDLE        Node,
-  IN   EAML_ITERATOR_MODE     IteratorMode,
-  OUT  AML_TREE_ITERATOR   ** IteratorPtr
+  IN   AML_NODE_HANDLE     Node,
+  IN   EAML_ITERATOR_MODE  IteratorMode,
+  OUT  AML_TREE_ITERATOR   **IteratorPtr
   );
 
 /** Delete an iterator.
@@ -214,7 +213,7 @@ AmlInitializeIterator (
 EFI_STATUS
 EFIAPI
 AmlDeleteIterator (
-  IN  AML_TREE_ITERATOR   * Iterator
+  IN  AML_TREE_ITERATOR  *Iterator
   );
 
 #endif // AML_ITERATOR_H_

+ 66 - 55
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.c

@@ -37,17 +37,18 @@
 AML_NODE_HEADER *
 EFIAPI
 AmlGetSiblingVariableArgument (
-  IN  AML_NODE_HEADER   * VarArgNode
+  IN  AML_NODE_HEADER  *VarArgNode
   )
 {
-  EAML_PARSE_INDEX    Index;
-  AML_NODE_HEADER   * ParentNode;
+  EAML_PARSE_INDEX  Index;
+  AML_NODE_HEADER   *ParentNode;
 
   // VarArgNode must be an object node or a data node,
   // and be in a variable list of arguments.
   if ((!IS_AML_OBJECT_NODE (VarArgNode) &&
        !IS_AML_DATA_NODE (VarArgNode))  ||
-      AmlIsNodeFixedArgument (VarArgNode, &Index)) {
+      AmlIsNodeFixedArgument (VarArgNode, &Index))
+  {
     ASSERT (0);
     return NULL;
   }
@@ -85,12 +86,12 @@ AmlGetSiblingVariableArgument (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetNextVariableArgument (
-  IN  AML_NODE_HEADER  * Node,
-  IN  AML_NODE_HEADER  * CurrVarArg
+  IN  AML_NODE_HEADER  *Node,
+  IN  AML_NODE_HEADER  *CurrVarArg
   )
 {
-  CONST LIST_ENTRY       * StartLink;
-  CONST LIST_ENTRY       * NextLink;
+  CONST LIST_ENTRY  *StartLink;
+  CONST LIST_ENTRY  *NextLink;
 
   // Node must be a RootNode or an Object Node
   // and the CurrVarArg must not be a Root Node.
@@ -98,7 +99,8 @@ AmlGetNextVariableArgument (
        !IS_AML_OBJECT_NODE (Node))        ||
       ((CurrVarArg != NULL)               &&
        (!IS_AML_OBJECT_NODE (CurrVarArg)  &&
-        !IS_AML_DATA_NODE (CurrVarArg)))) {
+        !IS_AML_DATA_NODE (CurrVarArg))))
+  {
     ASSERT (0);
     return NULL;
   }
@@ -112,8 +114,9 @@ AmlGetNextVariableArgument (
   if (CurrVarArg == NULL) {
     NextLink = StartLink->ForwardLink;
     if (NextLink != StartLink) {
-      return (AML_NODE_HEADER*)NextLink;
+      return (AML_NODE_HEADER *)NextLink;
     }
+
     // List is empty.
     return NULL;
   }
@@ -127,7 +130,7 @@ AmlGetNextVariableArgument (
   // Get the node following the CurrVarArg.
   NextLink = CurrVarArg->Link.ForwardLink;
   if (NextLink != StartLink) {
-    return (AML_NODE_HEADER*)NextLink;
+    return (AML_NODE_HEADER *)NextLink;
   }
 
   // End of the list has been reached.
@@ -159,12 +162,12 @@ AmlGetNextVariableArgument (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetPreviousVariableArgument (
-  IN  AML_NODE_HEADER  * Node,
-  IN  AML_NODE_HEADER  * CurrVarArg
+  IN  AML_NODE_HEADER  *Node,
+  IN  AML_NODE_HEADER  *CurrVarArg
   )
 {
-  CONST LIST_ENTRY       * StartLink;
-  CONST LIST_ENTRY       * PreviousLink;
+  CONST LIST_ENTRY  *StartLink;
+  CONST LIST_ENTRY  *PreviousLink;
 
   // Node must be a RootNode or an Object Node
   // and the CurrVarArg must not be a Root Node.
@@ -172,7 +175,8 @@ AmlGetPreviousVariableArgument (
        !IS_AML_OBJECT_NODE (Node))        ||
       ((CurrVarArg != NULL)               &&
        (!IS_AML_OBJECT_NODE (CurrVarArg)  &&
-        !IS_AML_DATA_NODE (CurrVarArg)))) {
+        !IS_AML_DATA_NODE (CurrVarArg))))
+  {
     ASSERT (0);
     return NULL;
   }
@@ -186,8 +190,9 @@ AmlGetPreviousVariableArgument (
   if (CurrVarArg == NULL) {
     PreviousLink = StartLink->BackLink;
     if (PreviousLink != StartLink) {
-      return (AML_NODE_HEADER*)PreviousLink;
+      return (AML_NODE_HEADER *)PreviousLink;
     }
+
     // List is empty.
     return NULL;
   }
@@ -201,7 +206,7 @@ AmlGetPreviousVariableArgument (
   // Get the node before the CurrVarArg.
   PreviousLink = CurrVarArg->Link.BackLink;
   if (PreviousLink != StartLink) {
-    return (AML_NODE_HEADER*)PreviousLink;
+    return (AML_NODE_HEADER *)PreviousLink;
   }
 
   // We have reached the beginning of the list.
@@ -240,12 +245,12 @@ AmlGetPreviousVariableArgument (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetNextSibling (
-  IN  CONST AML_NODE_HEADER   * Node,
-  IN  CONST AML_NODE_HEADER   * ChildNode
+  IN  CONST AML_NODE_HEADER  *Node,
+  IN  CONST AML_NODE_HEADER  *ChildNode
   )
 {
-  EAML_PARSE_INDEX    Index;
-  AML_NODE_HEADER   * CandidateNode;
+  EAML_PARSE_INDEX  Index;
+  AML_NODE_HEADER   *CandidateNode;
 
   // Node must be a RootNode or an Object Node
   // and the CurrVarArg must not be a Root Node.
@@ -253,7 +258,8 @@ AmlGetNextSibling (
        !IS_AML_OBJECT_NODE (Node))        ||
       ((ChildNode != NULL)                &&
        (!IS_AML_OBJECT_NODE (ChildNode)   &&
-        !IS_AML_DATA_NODE (ChildNode)))) {
+        !IS_AML_DATA_NODE (ChildNode))))
+  {
     ASSERT (0);
     return NULL;
   }
@@ -262,7 +268,7 @@ AmlGetNextSibling (
     if (ChildNode == NULL) {
       // Get the fixed argument at index 0 of the ChildNode.
       CandidateNode = AmlGetFixedArgument (
-                        (AML_OBJECT_NODE*)Node,
+                        (AML_OBJECT_NODE *)Node,
                         EAmlParseIndexTerm0
                         );
       if (CandidateNode != NULL) {
@@ -275,14 +281,16 @@ AmlGetNextSibling (
         Index++;
         // The node is part of the list of fixed arguments.
         if (Index == (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
-                                         (AML_OBJECT_NODE*)Node)
-                                         ) {
-        // It is at the last argument of the fixed argument list.
-        // Get the first argument of the variable list of arguments.
+                                         (AML_OBJECT_NODE *)Node
+                                         )
+            )
+        {
+          // It is at the last argument of the fixed argument list.
+          // Get the first argument of the variable list of arguments.
           ChildNode = NULL;
         } else {
           // Else return the next node in the list of fixed arguments.
-          return AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index);
+          return AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
         }
       }
     }
@@ -290,8 +298,8 @@ AmlGetNextSibling (
 
   // Else, get the next node in the variable list of arguments.
   return AmlGetNextVariableArgument (
-           (AML_NODE_HEADER*)Node,
-           (AML_NODE_HEADER*)ChildNode
+           (AML_NODE_HEADER *)Node,
+           (AML_NODE_HEADER *)ChildNode
            );
 }
 
@@ -325,14 +333,14 @@ AmlGetNextSibling (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetPreviousSibling (
-  IN  CONST  AML_NODE_HEADER  * Node,
-  IN  CONST  AML_NODE_HEADER  * ChildNode
+  IN  CONST  AML_NODE_HEADER  *Node,
+  IN  CONST  AML_NODE_HEADER  *ChildNode
   )
 {
-  EAML_PARSE_INDEX    Index;
-  EAML_PARSE_INDEX    MaxIndex;
+  EAML_PARSE_INDEX  Index;
+  EAML_PARSE_INDEX  MaxIndex;
 
-  AML_NODE_HEADER   * CandidateNode;
+  AML_NODE_HEADER  *CandidateNode;
 
   // Node must be a Root Node or an Object Node
   // and the ChildNode must not be a Root Node.
@@ -340,20 +348,22 @@ AmlGetPreviousSibling (
        !IS_AML_OBJECT_NODE (Node))        ||
       ((ChildNode != NULL)                &&
        (!IS_AML_OBJECT_NODE (ChildNode)   &&
-        !IS_AML_DATA_NODE (ChildNode)))) {
+        !IS_AML_DATA_NODE (ChildNode))))
+  {
     ASSERT (0);
     return NULL;
   }
 
   MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
-                                 (AML_OBJECT_NODE*)Node
+                                 (AML_OBJECT_NODE *)Node
                                  );
 
   // Get the last variable argument if no ChildNode.
   // Otherwise the fixed argument list is checked first.
   if ((ChildNode != NULL)         &&
       IS_AML_OBJECT_NODE (Node)   &&
-      (MaxIndex != EAmlParseIndexTerm0)) {
+      (MaxIndex != EAmlParseIndexTerm0))
+  {
     if (AmlIsNodeFixedArgument (ChildNode, &Index)) {
       // The node is part of the list of fixed arguments.
       if (Index == EAmlParseIndexTerm0) {
@@ -362,7 +372,7 @@ AmlGetPreviousSibling (
       } else {
         // Return the previous node in the fixed argument list.
         return AmlGetFixedArgument (
-                 (AML_OBJECT_NODE*)Node,
+                 (AML_OBJECT_NODE *)Node,
                  (EAML_PARSE_INDEX)(Index - 1)
                  );
       }
@@ -371,20 +381,21 @@ AmlGetPreviousSibling (
 
   // ChildNode is in the variable list of arguments.
   CandidateNode = AmlGetPreviousVariableArgument (
-                    (AML_NODE_HEADER*)Node,
-                    (AML_NODE_HEADER*)ChildNode
+                    (AML_NODE_HEADER *)Node,
+                    (AML_NODE_HEADER *)ChildNode
                     );
   if (CandidateNode != NULL) {
     if (!IS_AML_NODE_VALID (CandidateNode)) {
       ASSERT (0);
       return NULL;
     }
+
     // A Node has been found
     return CandidateNode;
   } else if (MaxIndex != EAmlParseIndexTerm0) {
     // ChildNode was the first node of the variable list of arguments.
     return AmlGetFixedArgument (
-             (AML_OBJECT_NODE*)Node,
+             (AML_OBJECT_NODE *)Node,
              (EAML_PARSE_INDEX)(MaxIndex - 1)
              );
   } else {
@@ -416,11 +427,11 @@ AmlGetPreviousSibling (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetNextNode (
-  IN  CONST AML_NODE_HEADER   * Node
+  IN  CONST AML_NODE_HEADER  *Node
   )
 {
-  AML_NODE_HEADER   * ParentNode;
-  AML_NODE_HEADER   * CandidateNode;
+  AML_NODE_HEADER  *ParentNode;
+  AML_NODE_HEADER  *CandidateNode;
 
   if (!IS_AML_NODE_VALID (Node)) {
     ASSERT (0);
@@ -435,6 +446,7 @@ AmlGetNextNode (
         ASSERT (0);
         return NULL;
       }
+
       // A Node has been found
       return CandidateNode;
     } else if (IS_AML_ROOT_NODE (Node)) {
@@ -452,7 +464,7 @@ AmlGetNextNode (
       return NULL;
     }
 
-    ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+    ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
     if (!IS_AML_NODE_VALID (ParentNode)) {
       ASSERT (0);
       return NULL;
@@ -464,6 +476,7 @@ AmlGetNextNode (
         ASSERT (0);
         return NULL;
       }
+
       // A Node has been found
       return CandidateNode;
     }
@@ -498,12 +511,12 @@ AmlGetNextNode (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetPreviousNode (
-  IN  CONST  AML_NODE_HEADER * Node
+  IN  CONST  AML_NODE_HEADER  *Node
   )
 {
-  AML_NODE_HEADER  * ParentNode;
-  AML_NODE_HEADER  * CandidateNode;
-  AML_NODE_HEADER  * PreviousNode;
+  AML_NODE_HEADER  *ParentNode;
+  AML_NODE_HEADER  *CandidateNode;
+  AML_NODE_HEADER  *PreviousNode;
 
   if (!IS_AML_NODE_VALID (Node)) {
     ASSERT (0);
@@ -511,13 +524,12 @@ AmlGetPreviousNode (
   }
 
   while (1) {
-
     if (IS_AML_ROOT_NODE (Node)) {
       // This is the root node.
       return NULL;
     }
 
-    ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+    ParentNode    = AmlGetParent ((AML_NODE_HEADER *)Node);
     CandidateNode = AmlGetPreviousSibling (ParentNode, Node);
 
     if (CandidateNode == NULL) {
@@ -531,7 +543,7 @@ AmlGetPreviousNode (
       // then get the last child of this node.
       // If this node has children, get its last child, etc.
       while (1) {
-        PreviousNode = CandidateNode;
+        PreviousNode  = CandidateNode;
         CandidateNode = AmlGetPreviousSibling (PreviousNode, NULL);
         if (CandidateNode == NULL) {
           return PreviousNode;
@@ -539,7 +551,6 @@ AmlGetPreviousNode (
           return CandidateNode;
         }
       } // while
-
     } else {
       ASSERT (0);
       return NULL;

+ 6 - 7
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.h

@@ -43,8 +43,8 @@
 AML_NODE_HEADER *
 EFIAPI
 AmlGetNextSibling (
-  IN  CONST AML_NODE_HEADER   * Node,
-  IN  CONST AML_NODE_HEADER   * ChildNode
+  IN  CONST AML_NODE_HEADER  *Node,
+  IN  CONST AML_NODE_HEADER  *ChildNode
   );
 
 /** Get the previous sibling node among the children of the input Node.
@@ -77,8 +77,8 @@ AmlGetNextSibling (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetPreviousSibling (
-  IN  CONST  AML_NODE_HEADER  * Node,
-  IN  CONST  AML_NODE_HEADER  * ChildNode
+  IN  CONST  AML_NODE_HEADER  *Node,
+  IN  CONST  AML_NODE_HEADER  *ChildNode
   );
 
 /** Iterate through the nodes in the same order as the AML bytestream.
@@ -104,7 +104,7 @@ AmlGetPreviousSibling (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetNextNode (
-  IN  CONST AML_NODE_HEADER   * Node
+  IN  CONST AML_NODE_HEADER  *Node
   );
 
 /** Iterate through the nodes in the reverse order of the AML bytestream.
@@ -131,8 +131,7 @@ AmlGetNextNode (
 AML_NODE_HEADER *
 EFIAPI
 AmlGetPreviousNode (
-  IN  CONST  AML_NODE_HEADER * Node
+  IN  CONST  AML_NODE_HEADER  *Node
   );
 
 #endif // AML_TREE_TRAVERSAL_H_
-

+ 178 - 148
DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.c

@@ -22,21 +22,21 @@
 EFI_STATUS
 EFIAPI
 AcpiPlatformChecksum (
-  IN  EFI_ACPI_DESCRIPTION_HEADER  * AcpiTable
+  IN  EFI_ACPI_DESCRIPTION_HEADER  *AcpiTable
   )
 {
-  UINT8   * Ptr;
-  UINT8     Sum;
-  UINT32    Size;
+  UINT8   *Ptr;
+  UINT8   Sum;
+  UINT32  Size;
 
   if (AcpiTable == NULL) {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
-  Ptr = (UINT8*)AcpiTable;
+  Ptr  = (UINT8 *)AcpiTable;
   Size = AcpiTable->Length;
-  Sum = 0;
+  Sum  = 0;
 
   // Set the checksum field to 0 first.
   AcpiTable->Checksum = 0;
@@ -76,70 +76,78 @@ STATIC
 BOOLEAN
 EFIAPI
 AmlComputeSizeCallback (
-  IN      AML_NODE_HEADER  * Node,
-  IN  OUT VOID             * Context,
-  IN  OUT EFI_STATUS       * Status   OPTIONAL
+  IN      AML_NODE_HEADER  *Node,
+  IN  OUT VOID             *Context,
+  IN  OUT EFI_STATUS       *Status   OPTIONAL
   )
 {
-  UINT32                    Size;
-  EAML_PARSE_INDEX          IndexPtr;
-  CONST AML_OBJECT_NODE   * ParentNode;
+  UINT32                 Size;
+  EAML_PARSE_INDEX       IndexPtr;
+  CONST AML_OBJECT_NODE  *ParentNode;
 
   if (!IS_AML_NODE_VALID (Node) ||
-      (Context == NULL)) {
+      (Context == NULL))
+  {
     ASSERT (0);
     if (Status != NULL) {
       *Status = EFI_INVALID_PARAMETER;
     }
+
     return FALSE;
   }
 
   // Ignore the second fixed argument of method invocation nodes
   // as the information stored there (the argument count) is not in the
   // ACPI specification.
-  ParentNode = (CONST AML_OBJECT_NODE*)AmlGetParent (Node);
+  ParentNode = (CONST AML_OBJECT_NODE *)AmlGetParent (Node);
   if (IS_AML_OBJECT_NODE (ParentNode)                             &&
       AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0)   &&
-      AmlIsNodeFixedArgument (Node, &IndexPtr)) {
+      AmlIsNodeFixedArgument (Node, &IndexPtr))
+  {
     if (IndexPtr == EAmlParseIndexTerm1) {
       if (Status != NULL) {
         *Status = EFI_SUCCESS;
       }
+
       return TRUE;
     }
   }
 
-  Size = *((UINT32*)Context);
+  Size = *((UINT32 *)Context);
 
   if (IS_AML_DATA_NODE (Node)) {
-    Size += ((AML_DATA_NODE*)Node)->Size;
+    Size += ((AML_DATA_NODE *)Node)->Size;
   } else if (IS_AML_OBJECT_NODE (Node)  &&
              !AmlNodeHasAttribute (
-                (CONST AML_OBJECT_NODE*)Node,
-                AML_IS_PSEUDO_OPCODE)) {
+                (CONST AML_OBJECT_NODE *)Node,
+                AML_IS_PSEUDO_OPCODE
+                ))
+  {
     // Ignore pseudo-opcodes as they are not part of the
     // ACPI specification.
 
-    Size += (((AML_OBJECT_NODE*)Node)->AmlByteEncoding->OpCode ==
-               AML_EXT_OP) ? 2 : 1;
+    Size += (((AML_OBJECT_NODE *)Node)->AmlByteEncoding->OpCode ==
+             AML_EXT_OP) ? 2 : 1;
 
     // Add the size of the PkgLen.
     if (AmlNodeHasAttribute (
-          (AML_OBJECT_NODE*)Node,
-          AML_HAS_PKG_LENGTH)) {
-      Size += AmlComputePkgLengthWidth (((AML_OBJECT_NODE*)Node)->PkgLen);
+          (AML_OBJECT_NODE *)Node,
+          AML_HAS_PKG_LENGTH
+          ))
+    {
+      Size += AmlComputePkgLengthWidth (((AML_OBJECT_NODE *)Node)->PkgLen);
     }
   }
 
   // Check for overflow.
   // The root node has a null size, thus the strict comparison.
-  if (*((UINT32*)Context) > Size) {
+  if (*((UINT32 *)Context) > Size) {
     ASSERT (0);
     *Status = EFI_INVALID_PARAMETER;
     return FALSE;
   }
 
-  *((UINT32*)Context) = Size;
+  *((UINT32 *)Context) = Size;
 
   if (Status != NULL) {
     *Status = EFI_SUCCESS;
@@ -159,14 +167,15 @@ AmlComputeSizeCallback (
 EFI_STATUS
 EFIAPI
 AmlComputeSize (
-  IN      CONST AML_NODE_HEADER   * Node,
-  IN  OUT       UINT32            * Size
+  IN      CONST AML_NODE_HEADER  *Node,
+  IN  OUT       UINT32           *Size
   )
 {
   EFI_STATUS  Status;
 
   if (!IS_AML_NODE_VALID (Node) ||
-      (Size == NULL)) {
+      (Size == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -174,9 +183,9 @@ AmlComputeSize (
   *Size = 0;
 
   AmlEnumTree (
-    (AML_NODE_HEADER*)Node,
+    (AML_NODE_HEADER *)Node,
     AmlComputeSizeCallback,
-    (VOID*)Size,
+    (VOID *)Size,
     &Status
     );
 
@@ -195,15 +204,16 @@ AmlComputeSize (
 EFI_STATUS
 EFIAPI
 AmlNodeGetIntegerValue (
-  IN  AML_OBJECT_NODE   * Node,
-  OUT UINT64            * Value
+  IN  AML_OBJECT_NODE  *Node,
+  OUT UINT64           *Value
   )
 {
-  AML_DATA_NODE  * DataNode;
+  AML_DATA_NODE  *DataNode;
 
   if ((!IsIntegerNode (Node)            &&
        !IsSpecialIntegerNode (Node))    ||
-      (Value == NULL)) {
+      (Value == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -219,13 +229,15 @@ AmlNodeGetIntegerValue (
       ASSERT (0);
       return EFI_INVALID_PARAMETER;
     }
+
     return EFI_SUCCESS;
   }
 
   // For integer nodes, the value is in the first fixed argument.
-  DataNode = (AML_DATA_NODE*)Node->FixedArgs[EAmlParseIndexTerm0];
+  DataNode = (AML_DATA_NODE *)Node->FixedArgs[EAmlParseIndexTerm0];
   if (!IS_AML_DATA_NODE (DataNode) ||
-      (DataNode->DataType != EAmlNodeDataTypeUInt)) {
+      (DataNode->DataType != EAmlNodeDataTypeUInt))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -233,22 +245,22 @@ AmlNodeGetIntegerValue (
   switch (DataNode->Size) {
     case 1:
     {
-      *Value = *((UINT8*)(DataNode->Buffer));
+      *Value = *((UINT8 *)(DataNode->Buffer));
       break;
     }
     case 2:
     {
-      *Value = *((UINT16*)(DataNode->Buffer));
+      *Value = *((UINT16 *)(DataNode->Buffer));
       break;
     }
     case 4:
     {
-      *Value = *((UINT32*)(DataNode->Buffer));
+      *Value = *((UINT32 *)(DataNode->Buffer));
       break;
     }
     case 8:
     {
-      *Value = *((UINT64*)(DataNode->Buffer));
+      *Value = *((UINT64 *)(DataNode->Buffer));
       break;
     }
     default:
@@ -274,14 +286,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlUnwindSpecialInteger (
-  IN  AML_OBJECT_NODE   * Node
+  IN  AML_OBJECT_NODE  *Node
   )
 {
-  EFI_STATUS                  Status;
+  EFI_STATUS  Status;
 
-  AML_DATA_NODE             * NewDataNode;
-  UINT8                       Value;
-  CONST AML_BYTE_ENCODING   * ByteEncoding;
+  AML_DATA_NODE            *NewDataNode;
+  UINT8                    Value;
+  CONST AML_BYTE_ENCODING  *ByteEncoding;
 
   if (!IsSpecialIntegerNode (Node)) {
     ASSERT (0);
@@ -300,11 +312,11 @@ AmlUnwindSpecialInteger (
   }
 
   Status = AmlCreateDataNode (
-              EAmlNodeDataTypeUInt,
-              &Value,
-              sizeof (UINT8),
-              (AML_DATA_NODE**)&NewDataNode
-              );
+             EAmlNodeDataTypeUInt,
+             &Value,
+             sizeof (UINT8),
+             (AML_DATA_NODE **)&NewDataNode
+             );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     return Status;
@@ -323,10 +335,10 @@ AmlUnwindSpecialInteger (
 
   // Add the data node as the first fixed argument of the ByteOp object.
   Status = AmlSetFixedArgument (
-              (AML_OBJECT_NODE*)Node,
-              EAmlParseIndexTerm0,
-              (AML_NODE_HEADER*)NewDataNode
-              );
+             (AML_OBJECT_NODE *)Node,
+             EAmlParseIndexTerm0,
+             (AML_NODE_HEADER *)NewDataNode
+             );
   if (EFI_ERROR (Status)) {
     ASSERT (0);
     goto error_handler;
@@ -335,7 +347,7 @@ AmlUnwindSpecialInteger (
   return Status;
 
 error_handler:
-  AmlDeleteTree ((AML_NODE_HEADER*)NewDataNode);
+  AmlDeleteTree ((AML_NODE_HEADER *)NewDataNode);
   return Status;
 }
 
@@ -360,20 +372,21 @@ error_handler:
 EFI_STATUS
 EFIAPI
 AmlNodeSetIntegerValue (
-  IN  AML_OBJECT_NODE   * Node,
-  IN  UINT64              NewValue,
-  OUT INT8              * ValueWidthDiff
+  IN  AML_OBJECT_NODE  *Node,
+  IN  UINT64           NewValue,
+  OUT INT8             *ValueWidthDiff
   )
 {
-  EFI_STATUS        Status;
-  AML_DATA_NODE   * DataNode;
+  EFI_STATUS     Status;
+  AML_DATA_NODE  *DataNode;
 
-  UINT8             NewOpCode;
-  UINT8             NumberOfBytes;
+  UINT8  NewOpCode;
+  UINT8  NumberOfBytes;
 
   if ((!IsIntegerNode (Node)            &&
        !IsSpecialIntegerNode (Node))    ||
-      (ValueWidthDiff == NULL)) {
+      (ValueWidthDiff == NULL))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -396,6 +409,7 @@ AmlNodeSetIntegerValue (
           ASSERT (0);
           return Status;
         }
+
         // The AmlUnwindSpecialInteger functions converts a special integer
         // node to a UInt8/Byte data node. Thus, the size increments by one:
         // special integer are encoded as one byte (the opcode only) while byte
@@ -406,9 +420,10 @@ AmlNodeSetIntegerValue (
   } // IsSpecialIntegerNode (Node)
 
   // For integer nodes, the value is in the first fixed argument.
-  DataNode = (AML_DATA_NODE*)Node->FixedArgs[EAmlParseIndexTerm0];
+  DataNode = (AML_DATA_NODE *)Node->FixedArgs[EAmlParseIndexTerm0];
   if (!IS_AML_DATA_NODE (DataNode) ||
-      (DataNode->DataType != EAmlNodeDataTypeUInt)) {
+      (DataNode->DataType != EAmlNodeDataTypeUInt))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -416,7 +431,7 @@ AmlNodeSetIntegerValue (
   // The value can be encoded with a special 0 or 1 OpCode.
   // The AML_ONES_OP is not handled.
   if (NewValue <= 1) {
-    NewOpCode = (NewValue == 0) ? AML_ZERO_OP : AML_ONE_OP;
+    NewOpCode             = (NewValue == 0) ? AML_ZERO_OP : AML_ONE_OP;
     Node->AmlByteEncoding = AmlGetByteEncodingByOpCode (NewOpCode, 0);
 
     // The value is encoded with a AML_ZERO_OP or AML_ONE_OP.
@@ -425,9 +440,9 @@ AmlNodeSetIntegerValue (
     *ValueWidthDiff = -((INT8)DataNode->Size);
 
     // Detach and free the DataNode containing the integer value.
-    DataNode->NodeHeader.Parent = NULL;
+    DataNode->NodeHeader.Parent          = NULL;
     Node->FixedArgs[EAmlParseIndexTerm0] = NULL;
-    Status = AmlDeleteNode ((AML_NODE_HEADER*)DataNode);
+    Status                               = AmlDeleteNode ((AML_NODE_HEADER *)DataNode);
     if (EFI_ERROR (Status)) {
       ASSERT (0);
       return Status;
@@ -439,19 +454,19 @@ AmlNodeSetIntegerValue (
   // Check the number of bits needed to represent the value.
   if (NewValue > MAX_UINT32) {
     // Value is 64 bits.
-    NewOpCode = AML_QWORD_PREFIX;
+    NewOpCode     = AML_QWORD_PREFIX;
     NumberOfBytes = 8;
   } else if (NewValue > MAX_UINT16) {
     // Value is 32 bits.
-    NewOpCode = AML_DWORD_PREFIX;
+    NewOpCode     = AML_DWORD_PREFIX;
     NumberOfBytes = 4;
   } else if (NewValue > MAX_UINT8) {
     // Value is 16 bits.
-    NewOpCode = AML_WORD_PREFIX;
+    NewOpCode     = AML_WORD_PREFIX;
     NumberOfBytes = 2;
   } else {
     // Value is 8 bits.
-    NewOpCode = AML_BYTE_PREFIX;
+    NewOpCode     = AML_BYTE_PREFIX;
     NumberOfBytes = 1;
   }
 
@@ -473,6 +488,7 @@ AmlNodeSetIntegerValue (
       ASSERT (0);
       return EFI_OUT_OF_RESOURCES;
     }
+
     DataNode->Size = NumberOfBytes;
   }
 
@@ -504,14 +520,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlNodeUpdateIntegerValue (
-  IN  AML_OBJECT_NODE       * IntegerNode,
-  IN  BOOLEAN                 IsIncrement,
-  IN  UINT64                  Diff,
-  OUT INT8                  * ValueWidthDiff
+  IN  AML_OBJECT_NODE  *IntegerNode,
+  IN  BOOLEAN          IsIncrement,
+  IN  UINT64           Diff,
+  OUT INT8             *ValueWidthDiff
   )
 {
-  EFI_STATUS       Status;
-  UINT64           Value;
+  EFI_STATUS  Status;
+  UINT64      Value;
 
   if (ValueWidthDiff == NULL) {
     ASSERT (0);
@@ -528,7 +544,8 @@ AmlNodeUpdateIntegerValue (
 
   // Check for UINT64 over/underflow.
   if ((IsIncrement && (Value > (MAX_UINT64 - Diff))) ||
-      (!IsIncrement && (Value < Diff))) {
+      (!IsIncrement && (Value < Diff)))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -570,29 +587,30 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlPropagateSize (
-  IN  AML_NODE_HEADER   * Node,
-  IN  BOOLEAN             IsIncrement,
-  IN  UINT32            * Diff
+  IN  AML_NODE_HEADER  *Node,
+  IN  BOOLEAN          IsIncrement,
+  IN  UINT32           *Diff
   )
 {
-  EFI_STATUS         Status;
-  AML_OBJECT_NODE  * ObjectNode;
-  AML_NODE_HEADER  * ParentNode;
+  EFI_STATUS       Status;
+  AML_OBJECT_NODE  *ObjectNode;
+  AML_NODE_HEADER  *ParentNode;
 
-  UINT32             Value;
-  UINT32             InitialPkgLenWidth;
-  UINT32             NewPkgLenWidth;
-  UINT32             ReComputedPkgLenWidth;
-  INT8               FieldWidthChange;
+  UINT32  Value;
+  UINT32  InitialPkgLenWidth;
+  UINT32  NewPkgLenWidth;
+  UINT32  ReComputedPkgLenWidth;
+  INT8    FieldWidthChange;
 
   if (!IS_AML_OBJECT_NODE (Node) &&
-      !IS_AML_ROOT_NODE (Node)) {
+      !IS_AML_ROOT_NODE (Node))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
 
   if (IS_AML_OBJECT_NODE (Node)) {
-    ObjectNode = (AML_OBJECT_NODE*)Node;
+    ObjectNode = (AML_OBJECT_NODE *)Node;
 
     // For BufferOp, the buffer size is stored in BufferSize. Therefore,
     // BufferOp needs special handling to update the BufferSize.
@@ -606,10 +624,10 @@ AmlPropagateSize (
       // (can be a BYTE, WORD, DWORD or QWORD).
       // BufferSize is an object node.
       Status = AmlNodeUpdateIntegerValue (
-                 (AML_OBJECT_NODE*)AmlGetFixedArgument (
-                                     ObjectNode,
-                                     EAmlParseIndexTerm0
-                                     ),
+                 (AML_OBJECT_NODE *)AmlGetFixedArgument (
+                                      ObjectNode,
+                                      EAmlParseIndexTerm0
+                                      ),
                  IsIncrement,
                  (UINT64)(*Diff),
                  &FieldWidthChange
@@ -624,7 +642,8 @@ AmlPropagateSize (
       if ((IsIncrement              &&
            (FieldWidthChange < 0))  ||
           (!IsIncrement             &&
-           (FieldWidthChange > 0))) {
+           (FieldWidthChange > 0)))
+      {
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
@@ -647,13 +666,14 @@ AmlPropagateSize (
       // Subtract the size of the PkgLen encoding. The size of the PkgLen
       // encoding must be computed after having updated Value.
       InitialPkgLenWidth = AmlComputePkgLengthWidth (Value);
-      Value -= InitialPkgLenWidth;
+      Value             -= InitialPkgLenWidth;
 
       // Check for an over/underflows.
       // PkgLen is a 28 bit value, cf 20.2.4 Package Length Encoding
       // i.e. the maximum value is (2^28 - 1) = ((BIT0 << 28) - 1).
       if ((IsIncrement && ((((BIT0 << 28) - 1) - Value) < *Diff))   ||
-          (!IsIncrement && (Value < *Diff))) {
+          (!IsIncrement && (Value < *Diff)))
+      {
         ASSERT (0);
         return EFI_INVALID_PARAMETER;
       }
@@ -682,7 +702,8 @@ AmlPropagateSize (
       ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Value);
       if (ReComputedPkgLenWidth != NewPkgLenWidth) {
         if ((ReComputedPkgLenWidth != 0)   &&
-            (ReComputedPkgLenWidth < 4)) {
+            (ReComputedPkgLenWidth < 4))
+        {
           // No need to recompute the PkgLen since a new threshold cannot
           // be reached by incrementing the value by one.
           Value += 1;
@@ -693,8 +714,8 @@ AmlPropagateSize (
       }
 
       *Diff += (InitialPkgLenWidth > ReComputedPkgLenWidth) ?
-                 (InitialPkgLenWidth - ReComputedPkgLenWidth) :
-                 (ReComputedPkgLenWidth - InitialPkgLenWidth);
+               (InitialPkgLenWidth - ReComputedPkgLenWidth) :
+               (ReComputedPkgLenWidth - InitialPkgLenWidth);
       ObjectNode->PkgLen = Value;
     } // PkgLen update.
 
@@ -702,7 +723,7 @@ AmlPropagateSize (
     // there is no root node at the top of the tree. Stop
     // propagating the new size when finding a root node
     // OR when a NULL parent is found.
-    ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+    ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
     if (ParentNode != NULL) {
       // Propagate the size up the tree.
       Status = AmlPropagateSize (
@@ -715,14 +736,14 @@ AmlPropagateSize (
         return Status;
       }
     }
-
   } else if (IS_AML_ROOT_NODE (Node)) {
     // Update the length field in the SDT header.
-    Value = ((AML_ROOT_NODE*)Node)->SdtHeader->Length;
+    Value = ((AML_ROOT_NODE *)Node)->SdtHeader->Length;
 
     // Check for an over/underflows.
     if ((IsIncrement && (Value > (MAX_UINT32 - *Diff))) ||
-        (!IsIncrement && (Value < *Diff))) {
+        (!IsIncrement && (Value < *Diff)))
+    {
       ASSERT (0);
       return EFI_INVALID_PARAMETER;
     }
@@ -734,7 +755,7 @@ AmlPropagateSize (
       Value -= *Diff;
     }
 
-    ((AML_ROOT_NODE*)Node)->SdtHeader->Length = Value;
+    ((AML_ROOT_NODE *)Node)->SdtHeader->Length = Value;
   }
 
   return EFI_SUCCESS;
@@ -762,21 +783,22 @@ STATIC
 EFI_STATUS
 EFIAPI
 AmlPropagateNodeCount (
-  IN  AML_OBJECT_NODE   * ObjectNode,
-  IN  BOOLEAN             IsIncrement,
-  IN  UINT8               NodeCount,
-  OUT INT8              * FieldWidthChange
+  IN  AML_OBJECT_NODE  *ObjectNode,
+  IN  BOOLEAN          IsIncrement,
+  IN  UINT8            NodeCount,
+  OUT INT8             *FieldWidthChange
   )
 {
-  EFI_STATUS         Status;
+  EFI_STATUS  Status;
 
-  AML_NODE_HEADER  * NodeCountArg;
-  UINT8              CurrNodeCount;
+  AML_NODE_HEADER  *NodeCountArg;
+  UINT8            CurrNodeCount;
 
   // Currently there is no use case where (NodeCount > 1).
   if (!IS_AML_OBJECT_NODE (ObjectNode)  ||
       (FieldWidthChange == NULL)        ||
-      (NodeCount > 1)) {
+      (NodeCount > 1))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -797,25 +819,26 @@ AmlPropagateNodeCount (
     // in the package. It is an UINT8.
 
     // Check for over/underflow.
-    CurrNodeCount = *(((AML_DATA_NODE*)NodeCountArg)->Buffer);
+    CurrNodeCount = *(((AML_DATA_NODE *)NodeCountArg)->Buffer);
     if ((IsIncrement && (CurrNodeCount == MAX_UINT8)) ||
-        (!IsIncrement && (CurrNodeCount == 0))) {
+        (!IsIncrement && (CurrNodeCount == 0)))
+    {
       ASSERT (0);
       return EFI_INVALID_PARAMETER;
     }
 
     // Update the node count in the DataNode.
-    CurrNodeCount = IsIncrement ? (CurrNodeCount + 1) : (CurrNodeCount - 1);
-    *(((AML_DATA_NODE*)NodeCountArg)->Buffer) =  CurrNodeCount;
+    CurrNodeCount                              = IsIncrement ? (CurrNodeCount + 1) : (CurrNodeCount - 1);
+    *(((AML_DATA_NODE *)NodeCountArg)->Buffer) =  CurrNodeCount;
   } else if (AmlNodeCompareOpCode (ObjectNode, AML_VAR_PACKAGE_OP, 0)) {
     // First fixed argument of PackageOp stores the number of elements
     // in the package. It is an integer (can be a BYTE, WORD, DWORD, QWORD).
     Status = AmlNodeUpdateIntegerValue (
-                (AML_OBJECT_NODE*)NodeCountArg,
-                IsIncrement,
-                NodeCount,
-                FieldWidthChange
-                );
+               (AML_OBJECT_NODE *)NodeCountArg,
+               IsIncrement,
+               NodeCount,
+               FieldWidthChange
+               );
     if (EFI_ERROR (Status)) {
       ASSERT (0);
       return Status;
@@ -845,10 +868,10 @@ AmlPropagateNodeCount (
 EFI_STATUS
 EFIAPI
 AmlPropagateInformation (
-  IN  AML_NODE_HEADER   * Node,
-  IN  BOOLEAN             IsIncrement,
-  IN  UINT32              Diff,
-  IN  UINT8               NodeCount
+  IN  AML_NODE_HEADER  *Node,
+  IN  BOOLEAN          IsIncrement,
+  IN  UINT32           Diff,
+  IN  UINT8            NodeCount
   )
 {
   EFI_STATUS  Status;
@@ -857,7 +880,8 @@ AmlPropagateInformation (
   // Currently there is no use case where (NodeCount > 1).
   if ((!IS_AML_ROOT_NODE (Node)     &&
        !IS_AML_OBJECT_NODE (Node))  ||
-      (NodeCount > 1)) {
+      (NodeCount > 1))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -865,9 +889,10 @@ AmlPropagateInformation (
   // Propagate the node count first as it may change the number of bytes
   // needed to store the node count, and then impact FieldWidthChange.
   if ((NodeCount != 0) &&
-      IS_AML_OBJECT_NODE (Node)) {
+      IS_AML_OBJECT_NODE (Node))
+  {
     Status = AmlPropagateNodeCount (
-               (AML_OBJECT_NODE*)Node,
+               (AML_OBJECT_NODE *)Node,
                IsIncrement,
                NodeCount,
                &FieldWidthChange
@@ -881,14 +906,16 @@ AmlPropagateInformation (
     // Maximum change is between UINT8/UINT64: 8 bytes.
     if ((ABS (FieldWidthChange) > 8)                          ||
         (IsIncrement                                          &&
-          ((FieldWidthChange < 0)                             ||
-           ((Diff + (UINT8)FieldWidthChange) > MAX_UINT32)))  ||
+         ((FieldWidthChange < 0)                             ||
+          ((Diff + (UINT8)FieldWidthChange) > MAX_UINT32)))  ||
         (!IsIncrement                                         &&
-          ((FieldWidthChange > 0)                             ||
-           (Diff < (UINT32)ABS (FieldWidthChange))))) {
+         ((FieldWidthChange > 0)                             ||
+          (Diff < (UINT32)ABS (FieldWidthChange)))))
+    {
       ASSERT (0);
       return EFI_INVALID_PARAMETER;
     }
+
     Diff = (UINT32)(Diff + (UINT8)ABS (FieldWidthChange));
   }
 
@@ -932,13 +959,13 @@ AmlPropagateInformation (
 EFI_STATUS
 EFIAPI
 AmlSetRdListCheckSum (
-  IN  AML_OBJECT_NODE   * BufferOpNode,
-  IN  UINT8               CheckSum
+  IN  AML_OBJECT_NODE  *BufferOpNode,
+  IN  UINT8            CheckSum
   )
 {
-  EFI_STATUS        Status;
-  AML_DATA_NODE   * LastRdNode;
-  AML_RD_HEADER     RdDataType;
+  EFI_STATUS     Status;
+  AML_DATA_NODE  *LastRdNode;
+  AML_RD_HEADER  RdDataType;
 
   if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0)) {
     ASSERT (0);
@@ -947,13 +974,14 @@ AmlSetRdListCheckSum (
 
   // Get the last Resource data node in the variable list of
   // argument of the BufferOp node.
-  LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument (
-                                 (AML_NODE_HEADER*)BufferOpNode,
-                                 NULL
-                                 );
+  LastRdNode = (AML_DATA_NODE *)AmlGetPreviousVariableArgument (
+                                  (AML_NODE_HEADER *)BufferOpNode,
+                                  NULL
+                                  );
   if ((LastRdNode == NULL)             ||
       !IS_AML_DATA_NODE (LastRdNode)   ||
-      (LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
+      (LastRdNode->DataType != EAmlNodeDataTypeResourceData))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -968,8 +996,10 @@ AmlSetRdListCheckSum (
   // It is possible to have only one Resource Data in a BufferOp with
   // no EndTag. Return EFI_NOT_FOUND is such case.
   if (!AmlRdCompareDescId (
-        &RdDataType,
-        AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+         &RdDataType,
+         AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+         ))
+  {
     ASSERT (0);
     return EFI_NOT_FOUND;
   }

+ 14 - 15
DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h

@@ -21,7 +21,7 @@
 EFI_STATUS
 EFIAPI
 AcpiPlatformChecksum (
-  IN  EFI_ACPI_DESCRIPTION_HEADER  * AcpiTable
+  IN  EFI_ACPI_DESCRIPTION_HEADER  *AcpiTable
   );
 
 /** Compute the size of a tree/sub-tree.
@@ -35,8 +35,8 @@ AcpiPlatformChecksum (
 EFI_STATUS
 EFIAPI
 AmlComputeSize (
-  IN      CONST AML_NODE_HEADER   * Node,
-  IN  OUT       UINT32            * Size
+  IN      CONST AML_NODE_HEADER  *Node,
+  IN  OUT       UINT32           *Size
   );
 
 /** Get the value contained in an integer node.
@@ -51,8 +51,8 @@ AmlComputeSize (
 EFI_STATUS
 EFIAPI
 AmlNodeGetIntegerValue (
-  IN  AML_OBJECT_NODE   * Node,
-  OUT UINT64            * Value
+  IN  AML_OBJECT_NODE  *Node,
+  OUT UINT64           *Value
   );
 
 /** Set the value contained in an integer node.
@@ -76,9 +76,9 @@ AmlNodeGetIntegerValue (
 EFI_STATUS
 EFIAPI
 AmlNodeSetIntegerValue (
-  IN  AML_OBJECT_NODE   * Node,
-  IN  UINT64              NewValue,
-  OUT INT8              * ValueWidthDiff
+  IN  AML_OBJECT_NODE  *Node,
+  IN  UINT64           NewValue,
+  OUT INT8             *ValueWidthDiff
   );
 
 /** Propagate information up the tree.
@@ -101,10 +101,10 @@ AmlNodeSetIntegerValue (
 EFI_STATUS
 EFIAPI
 AmlPropagateInformation (
-  IN  AML_NODE_HEADER   * Node,
-  IN  BOOLEAN             IsIncrement,
-  IN  UINT32              Diff,
-  IN  UINT8               NodeCount
+  IN  AML_NODE_HEADER  *Node,
+  IN  BOOLEAN          IsIncrement,
+  IN  UINT32           Diff,
+  IN  UINT8            NodeCount
   );
 
 /** Find and set the EndTag's Checksum of a list of Resource Data elements.
@@ -135,9 +135,8 @@ AmlPropagateInformation (
 EFI_STATUS
 EFIAPI
 AmlSetRdListCheckSum (
-  IN  AML_OBJECT_NODE   * BufferOpNode,
-  IN  UINT8               CheckSum
+  IN  AML_OBJECT_NODE  *BufferOpNode,
+  IN  UINT8            CheckSum
   );
 
 #endif // AML_UTILITY_H_
-

+ 54 - 49
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c

@@ -34,7 +34,7 @@ extern CHAR8  ssdtserialporttemplate_aml_code[];
 
 /** UART address range length.
 */
-#define MIN_UART_ADDRESS_LENGTH         0x1000U
+#define MIN_UART_ADDRESS_LENGTH  0x1000U
 
 /** Validate the Serial Port Information.
 
@@ -47,15 +47,16 @@ extern CHAR8  ssdtserialporttemplate_aml_code[];
 EFI_STATUS
 EFIAPI
 ValidateSerialPortInfo (
-  IN  CONST CM_ARM_SERIAL_PORT_INFO  * SerialPortInfoTable,
-  IN        UINT32                     SerialPortCount
+  IN  CONST CM_ARM_SERIAL_PORT_INFO  *SerialPortInfoTable,
+  IN        UINT32                   SerialPortCount
   )
 {
-  UINT32                            Index;
-  CONST CM_ARM_SERIAL_PORT_INFO   * SerialPortInfo;
+  UINT32                         Index;
+  CONST CM_ARM_SERIAL_PORT_INFO  *SerialPortInfo;
 
-  if  ((SerialPortInfoTable == NULL)  ||
-       (SerialPortCount == 0)) {
+  if ((SerialPortInfoTable == NULL)  ||
+      (SerialPortCount == 0))
+  {
     ASSERT (0);
     return EFI_INVALID_PARAMETER;
   }
@@ -64,8 +65,9 @@ ValidateSerialPortInfo (
     SerialPortInfo = &SerialPortInfoTable[Index];
     ASSERT (SerialPortInfo != NULL);
 
-    if ((SerialPortInfo == NULL ) ||
-        (SerialPortInfo->BaseAddress == 0)) {
+    if ((SerialPortInfo == NULL) ||
+        (SerialPortInfo->BaseAddress == 0))
+    {
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: UART port base address is invalid. BaseAddress = 0x%llx\n",
@@ -83,7 +85,8 @@ ValidateSerialPortInfo (
         (SerialPortInfo->PortSubtype !=
          EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_DCC) &&
         (SerialPortInfo->PortSubtype !=
-         EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550)) {
+         EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550))
+    {
       DEBUG ((
         DEBUG_ERROR,
         "ERROR: UART port subtype is invalid."
@@ -97,7 +100,8 @@ ValidateSerialPortInfo (
     DEBUG ((DEBUG_INFO, "UART Configuration:\n"));
     DEBUG ((
       DEBUG_INFO,
-      "  UART Base  = 0x%llx\n", SerialPortInfo->BaseAddress
+      "  UART Base  = 0x%llx\n",
+      SerialPortInfo->BaseAddress
       ));
     DEBUG ((
       DEBUG_INFO,
@@ -129,23 +133,23 @@ STATIC
 EFI_STATUS
 EFIAPI
 FixupIds (
-  IN        AML_ROOT_NODE_HANDLE        RootNodeHandle,
-  IN  CONST UINT64                      Uid,
-  IN  CONST CM_ARM_SERIAL_PORT_INFO   * SerialPortInfo
+  IN        AML_ROOT_NODE_HANDLE     RootNodeHandle,
+  IN  CONST UINT64                   Uid,
+  IN  CONST CM_ARM_SERIAL_PORT_INFO  *SerialPortInfo
   )
 {
-  EFI_STATUS                Status;
-  AML_OBJECT_NODE_HANDLE    NameOpIdNode;
-  CONST CHAR8             * HidString;
-  CONST CHAR8             * CidString;
-  CONST CHAR8             * NonBsaHid;
+  EFI_STATUS              Status;
+  AML_OBJECT_NODE_HANDLE  NameOpIdNode;
+  CONST CHAR8             *HidString;
+  CONST CHAR8             *CidString;
+  CONST CHAR8             *NonBsaHid;
 
   // Get the _CID and _HID value to write.
   switch (SerialPortInfo->PortSubtype) {
     case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550:
     {
       // If there is a non-BSA compliant HID, use that.
-      NonBsaHid = (CONST CHAR8*)PcdGetPtr (PcdNonBsaCompliant16550SerialHid);
+      NonBsaHid = (CONST CHAR8 *)PcdGetPtr (PcdNonBsaCompliant16550SerialHid);
       if ((NonBsaHid != NULL) && (AsciiStrLen (NonBsaHid) != 0)) {
         if (!(IsValidPnpId (NonBsaHid) || IsValidAcpiId (NonBsaHid))) {
           return EFI_INVALID_PARAMETER;
@@ -157,6 +161,7 @@ FixupIds (
         HidString = "PNP0501";
         CidString = "PNP0500";
       }
+
       break;
     }
     case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART:
@@ -254,14 +259,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 FixupCrs (
-  IN        AML_ROOT_NODE_HANDLE        RootNodeHandle,
-  IN  CONST CM_ARM_SERIAL_PORT_INFO   * SerialPortInfo
+  IN        AML_ROOT_NODE_HANDLE     RootNodeHandle,
+  IN  CONST CM_ARM_SERIAL_PORT_INFO  *SerialPortInfo
   )
 {
-  EFI_STATUS                Status;
-  AML_OBJECT_NODE_HANDLE    NameOpCrsNode;
-  AML_DATA_NODE_HANDLE      QWordRdNode;
-  AML_DATA_NODE_HANDLE      InterruptRdNode;
+  EFI_STATUS              Status;
+  AML_OBJECT_NODE_HANDLE  NameOpCrsNode;
+  AML_DATA_NODE_HANDLE    QWordRdNode;
+  AML_DATA_NODE_HANDLE    InterruptRdNode;
 
   // Get the "_CRS" object defined by the "Name ()" statement.
   Status = AmlFindNode (
@@ -288,7 +293,7 @@ FixupCrs (
              QWordRdNode,
              SerialPortInfo->BaseAddress,
              ((SerialPortInfo->BaseAddressLength < MIN_UART_ADDRESS_LENGTH) ?
-                 MIN_UART_ADDRESS_LENGTH: SerialPortInfo->BaseAddressLength)
+              MIN_UART_ADDRESS_LENGTH : SerialPortInfo->BaseAddressLength)
              );
   if (EFI_ERROR (Status)) {
     return Status;
@@ -329,13 +334,13 @@ STATIC
 EFI_STATUS
 EFIAPI
 FixupName (
-  IN        AML_ROOT_NODE_HANDLE        RootNodeHandle,
-  IN  CONST CM_ARM_SERIAL_PORT_INFO   * SerialPortInfo,
-  IN  CONST CHAR8                     * Name
+  IN        AML_ROOT_NODE_HANDLE     RootNodeHandle,
+  IN  CONST CM_ARM_SERIAL_PORT_INFO  *SerialPortInfo,
+  IN  CONST CHAR8                    *Name
   )
 {
-  EFI_STATUS                Status;
-  AML_OBJECT_NODE_HANDLE    DeviceNode;
+  EFI_STATUS              Status;
+  AML_OBJECT_NODE_HANDLE  DeviceNode;
 
   // Get the COM0 variable defined by the "Device ()" statement.
   Status = AmlFindNode (RootNodeHandle, "\\_SB_.COM0", &DeviceNode);
@@ -344,7 +349,7 @@ FixupName (
   }
 
   // Update the Device's name.
-  return AmlDeviceOpUpdateName (DeviceNode, (CHAR8*)Name);
+  return AmlDeviceOpUpdateName (DeviceNode, (CHAR8 *)Name);
 }
 
 /** Fixup the Serial Port Information in the AML tree.
@@ -373,14 +378,14 @@ STATIC
 EFI_STATUS
 EFIAPI
 FixupSerialPortInfo (
-  IN            AML_ROOT_NODE_HANDLE              RootNodeHandle,
-  IN      CONST CM_ARM_SERIAL_PORT_INFO         * SerialPortInfo,
-  IN      CONST CHAR8                           * Name,
-  IN      CONST UINT64                            Uid,
-      OUT       EFI_ACPI_DESCRIPTION_HEADER    ** Table
+  IN            AML_ROOT_NODE_HANDLE     RootNodeHandle,
+  IN      CONST CM_ARM_SERIAL_PORT_INFO  *SerialPortInfo,
+  IN      CONST CHAR8                    *Name,
+  IN      CONST UINT64                   Uid,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER  **Table
   )
 {
-  EFI_STATUS                Status;
+  EFI_STATUS  Status;
 
   ASSERT (RootNodeHandle != NULL);
   ASSERT (SerialPortInfo != NULL);
@@ -415,7 +420,7 @@ FixupSerialPortInfo (
 EFI_STATUS
 EFIAPI
 FreeSsdtSerialPortTable (
-  IN EFI_ACPI_DESCRIPTION_HEADER  * Table
+  IN EFI_ACPI_DESCRIPTION_HEADER  *Table
   )
 {
   ASSERT (Table != NULL);
@@ -443,16 +448,16 @@ FreeSsdtSerialPortTable (
 EFI_STATUS
 EFIAPI
 BuildSsdtSerialPortTable (
-  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO    *  AcpiTableInfo,
-  IN  CONST CM_ARM_SERIAL_PORT_INFO       *  SerialPortInfo,
-  IN  CONST CHAR8                         *  Name,
-  IN  CONST UINT64                           Uid,
-  OUT       EFI_ACPI_DESCRIPTION_HEADER  **  Table
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO   *AcpiTableInfo,
+  IN  CONST CM_ARM_SERIAL_PORT_INFO      *SerialPortInfo,
+  IN  CONST CHAR8                        *Name,
+  IN  CONST UINT64                       Uid,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER  **Table
   )
 {
-  EFI_STATUS              Status;
-  EFI_STATUS              Status1;
-  AML_ROOT_NODE_HANDLE    RootNodeHandle;
+  EFI_STATUS            Status;
+  EFI_STATUS            Status1;
+  AML_ROOT_NODE_HANDLE  RootNodeHandle;
 
   ASSERT (AcpiTableInfo != NULL);
   ASSERT (SerialPortInfo != NULL);
@@ -467,7 +472,7 @@ BuildSsdtSerialPortTable (
 
   // Parse the SSDT Serial Port Template.
   Status = AmlParseDefinitionBlock (
-             (EFI_ACPI_DESCRIPTION_HEADER*)ssdtserialporttemplate_aml_code,
+             (EFI_ACPI_DESCRIPTION_HEADER *)ssdtserialporttemplate_aml_code,
              &RootNodeHandle
              );
   if (EFI_ERROR (Status)) {

+ 358 - 354
DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c

@@ -15,503 +15,503 @@ STATIC
 VOID
 EFIAPI
 PrintOemId (
-  CONST CHAR8* Format,
-  UINT8* Ptr
+  CONST CHAR8  *Format,
+  UINT8        *Ptr
   );
 
 /** A parser for EArmObjBootArchInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmBootArchInfoParser[] = {
-  {"BootArchFlags", 2, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmBootArchInfoParser[] = {
+  { "BootArchFlags", 2, "0x%x", NULL }
 };
 
 /** A parser for EArmObjPowerManagementProfileInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmPowerManagementProfileInfoParser[] = {
-  {"PowerManagementProfile", 1, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmPowerManagementProfileInfoParser[] = {
+  { "PowerManagementProfile", 1, "0x%x", NULL }
 };
 
 /** A parser for EArmObjGicCInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGicCInfoParser[] = {
-  {"CPUInterfaceNumber", 4, "0x%x", NULL},
-  {"AcpiProcessorUid", 4, "0x%x", NULL},
-  {"Flags", 4, "0x%x", NULL},
-  {"ParkingProtocolVersion", 4, "0x%x", NULL},
-  {"PerformanceInterruptGsiv", 4, "0x%x", NULL},
-  {"ParkedAddress", 8, "0x%llx", NULL},
-  {"PhysicalBaseAddress", 8, "0x%llx", NULL},
-  {"GICV", 8, "0x%llx", NULL},
-  {"GICH", 8, "0x%llx", NULL},
-  {"VGICMaintenanceInterrupt", 4, "0x%x", NULL},
-  {"GICRBaseAddress", 8, "0x%llx", NULL},
-  {"MPIDR", 8, "0x%llx", NULL},
-  {"ProcessorPowerEfficiencyClass", 1, "0x%x", NULL},
-  {"SpeOverflowInterrupt", 2, "0x%x", NULL},
-  {"ProximityDomain", 4, "0x%x", NULL},
-  {"ClockDomain", 4, "0x%x", NULL},
-  {"AffinityFlags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGicCInfoParser[] = {
+  { "CPUInterfaceNumber",            4, "0x%x",   NULL },
+  { "AcpiProcessorUid",              4, "0x%x",   NULL },
+  { "Flags",                         4, "0x%x",   NULL },
+  { "ParkingProtocolVersion",        4, "0x%x",   NULL },
+  { "PerformanceInterruptGsiv",      4, "0x%x",   NULL },
+  { "ParkedAddress",                 8, "0x%llx", NULL },
+  { "PhysicalBaseAddress",           8, "0x%llx", NULL },
+  { "GICV",                          8, "0x%llx", NULL },
+  { "GICH",                          8, "0x%llx", NULL },
+  { "VGICMaintenanceInterrupt",      4, "0x%x",   NULL },
+  { "GICRBaseAddress",               8, "0x%llx", NULL },
+  { "MPIDR",                         8, "0x%llx", NULL },
+  { "ProcessorPowerEfficiencyClass", 1, "0x%x",   NULL },
+  { "SpeOverflowInterrupt",          2, "0x%x",   NULL },
+  { "ProximityDomain",               4, "0x%x",   NULL },
+  { "ClockDomain",                   4, "0x%x",   NULL },
+  { "AffinityFlags",                 4, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjGicDInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGicDInfoParser[] = {
-  {"PhysicalBaseAddress", 8, "0x%llx", NULL},
-  {"SystemVectorBase", 4, "0x%x", NULL},
-  {"GicVersion", 1, "0x%x", NULL},
+STATIC CONST CM_OBJ_PARSER  CmArmGicDInfoParser[] = {
+  { "PhysicalBaseAddress", 8, "0x%llx", NULL },
+  { "SystemVectorBase",    4, "0x%x",   NULL },
+  { "GicVersion",          1, "0x%x",   NULL },
 };
 
 /** A parser for EArmObjGicMsiFrameInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGicMsiFrameInfoParser[] = {
-  {"GicMsiFrameId", 4, "0x%x", NULL},
-  {"PhysicalBaseAddress", 8, "0x%llx", NULL},
-  {"Flags", 4, "0x%x", NULL},
-  {"SPICount", 2, "0x%x", NULL},
-  {"SPIBase", 2, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGicMsiFrameInfoParser[] = {
+  { "GicMsiFrameId",       4, "0x%x",   NULL },
+  { "PhysicalBaseAddress", 8, "0x%llx", NULL },
+  { "Flags",               4, "0x%x",   NULL },
+  { "SPICount",            2, "0x%x",   NULL },
+  { "SPIBase",             2, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjGicRedistributorInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGicRedistInfoParser[] = {
-  {"DiscoveryRangeBaseAddress", 8, "0x%llx", NULL},
-  {"DiscoveryRangeLength", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGicRedistInfoParser[] = {
+  { "DiscoveryRangeBaseAddress", 8, "0x%llx", NULL },
+  { "DiscoveryRangeLength",      4, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjGicItsInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGicItsInfoParser[] = {
-  {"GicItsId", 4, "0x%x", NULL},
-  {"PhysicalBaseAddress", 8, "0x%llx", NULL},
-  {"ProximityDomain", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGicItsInfoParser[] = {
+  { "GicItsId",            4, "0x%x",   NULL },
+  { "PhysicalBaseAddress", 8, "0x%llx", NULL },
+  { "ProximityDomain",     4, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjSerialConsolePortInfo,
     EArmObjSerialDebugPortInfo and EArmObjSerialPortInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmSerialPortInfoParser[] = {
-  {"BaseAddress", 8, "0x%llx", NULL},
-  {"Interrupt", 4, "0x%x", NULL},
-  {"BaudRate", 8, "0x%llx", NULL},
-  {"Clock", 4, "0x%x", NULL},
-  {"PortSubtype", 2, "0x%x", NULL},
-  {"BaseAddressLength", 8, "0x%llx", NULL},
-  {"AccessSize", 1, "0x%d", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmSerialPortInfoParser[] = {
+  { "BaseAddress",       8, "0x%llx", NULL },
+  { "Interrupt",         4, "0x%x",   NULL },
+  { "BaudRate",          8, "0x%llx", NULL },
+  { "Clock",             4, "0x%x",   NULL },
+  { "PortSubtype",       2, "0x%x",   NULL },
+  { "BaseAddressLength", 8, "0x%llx", NULL },
+  { "AccessSize",        1, "0x%d",   NULL }
 };
 
 /** A parser for EArmObjGenericTimerInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGenericTimerInfoParser[] = {
-  {"CounterControlBaseAddress", 8, "0x%llx", NULL},
-  {"CounterReadBaseAddress", 8, "0x%llx", NULL},
-  {"SecurePL1TimerGSIV", 4, "0x%x", NULL},
-  {"SecurePL1TimerFlags", 4, "0x%x", NULL},
-  {"NonSecurePL1TimerGSIV", 4, "0x%x", NULL},
-  {"NonSecurePL1TimerFlags", 4, "0x%x", NULL},
-  {"VirtualTimerGSIV", 4, "0x%x", NULL},
-  {"VirtualTimerFlags", 4, "0x%x", NULL},
-  {"NonSecurePL2TimerGSIV", 4, "0x%x", NULL},
-  {"NonSecurePL2TimerFlags", 4, "0x%x", NULL},
-  {"VirtualPL2TimerGSIV", 4, "0x%x", NULL},
-  {"VirtualPL2TimerFlags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGenericTimerInfoParser[] = {
+  { "CounterControlBaseAddress", 8, "0x%llx", NULL },
+  { "CounterReadBaseAddress",    8, "0x%llx", NULL },
+  { "SecurePL1TimerGSIV",        4, "0x%x",   NULL },
+  { "SecurePL1TimerFlags",       4, "0x%x",   NULL },
+  { "NonSecurePL1TimerGSIV",     4, "0x%x",   NULL },
+  { "NonSecurePL1TimerFlags",    4, "0x%x",   NULL },
+  { "VirtualTimerGSIV",          4, "0x%x",   NULL },
+  { "VirtualTimerFlags",         4, "0x%x",   NULL },
+  { "NonSecurePL2TimerGSIV",     4, "0x%x",   NULL },
+  { "NonSecurePL2TimerFlags",    4, "0x%x",   NULL },
+  { "VirtualPL2TimerGSIV",       4, "0x%x",   NULL },
+  { "VirtualPL2TimerFlags",      4, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjPlatformGTBlockInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGTBlockTimerFrameInfoParser[] = {
-  {"FrameNumber", 1, "0x%x", NULL},
-  {"PhysicalAddressCntBase", 8, "0x%llx", NULL},
-  {"PhysicalAddressCntEL0Base", 8, "0x%llx", NULL},
-  {"PhysicalTimerGSIV", 4, "0x%x", NULL},
-  {"PhysicalTimerFlags", 4, "0x%x", NULL},
-  {"VirtualTimerGSIV", 4, "0x%x", NULL},
-  {"VirtualTimerFlags", 4, "0x%x", NULL},
-  {"CommonFlags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGTBlockTimerFrameInfoParser[] = {
+  { "FrameNumber",               1, "0x%x",   NULL },
+  { "PhysicalAddressCntBase",    8, "0x%llx", NULL },
+  { "PhysicalAddressCntEL0Base", 8, "0x%llx", NULL },
+  { "PhysicalTimerGSIV",         4, "0x%x",   NULL },
+  { "PhysicalTimerFlags",        4, "0x%x",   NULL },
+  { "VirtualTimerGSIV",          4, "0x%x",   NULL },
+  { "VirtualTimerFlags",         4, "0x%x",   NULL },
+  { "CommonFlags",               4, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjGTBlockTimerFrameInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGTBlockInfoParser[] = {
-  {"GTBlockPhysicalAddress", 8, "0x%llx", NULL},
-  {"GTBlockTimerFrameCount", 4, "0x%x", NULL},
-  {"GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGTBlockInfoParser[] = {
+  { "GTBlockPhysicalAddress", 8,                        "0x%llx", NULL },
+  { "GTBlockTimerFrameCount", 4,                        "0x%x",   NULL },
+  { "GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL }
 };
 
 /** A parser for EArmObjPlatformGenericWatchdogInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] = {
-  {"ControlFrameAddress", 8, "0x%llx", NULL},
-  {"RefreshFrameAddress", 8, "0x%llx", NULL},
-  {"TimerGSIV", 4, "0x%x", NULL},
-  {"Flags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGenericWatchdogInfoParser[] = {
+  { "ControlFrameAddress", 8, "0x%llx", NULL },
+  { "RefreshFrameAddress", 8, "0x%llx", NULL },
+  { "TimerGSIV",           4, "0x%x",   NULL },
+  { "Flags",               4, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjPciConfigSpaceInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = {
-  {"BaseAddress", 8, "0x%llx", NULL},
-  {"PciSegmentGroupNumber", 2, "0x%x", NULL},
-  {"StartBusNumber", 1, "0x%x", NULL},
-  {"EndBusNumber", 1, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmPciConfigSpaceInfoParser[] = {
+  { "BaseAddress",           8, "0x%llx", NULL },
+  { "PciSegmentGroupNumber", 2, "0x%x",   NULL },
+  { "StartBusNumber",        1, "0x%x",   NULL },
+  { "EndBusNumber",          1, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjHypervisorVendorIdentity.
 */
-STATIC CONST CM_OBJ_PARSER CmArmHypervisorVendorIdParser[] = {
-  {"HypervisorVendorId", 8, "0x%llx", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmHypervisorVendorIdParser[] = {
+  { "HypervisorVendorId", 8, "0x%llx", NULL }
 };
 
 /** A parser for EArmObjFixedFeatureFlags.
 */
-STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = {
-  {"Flags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmFixedFeatureFlagsParser[] = {
+  { "Flags", 4, "0x%x", NULL }
 };
 
 /** A parser for EArmObjItsGroup.
 */
-STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"ItsIdCount", 4, "0x%x", NULL},
-  {"ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmItsGroupNodeParser[] = {
+  { "Token",      sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "ItsIdCount", 4,                        "0x%x", NULL },
+  { "ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
 };
 
 /** A parser for EArmObjNamedComponent.
 */
-STATIC CONST CM_OBJ_PARSER CmArmNamedComponentNodeParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"IdMappingCount", 4, "0x%x", NULL},
-  {"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"Flags", 4, "0x%x", NULL},
-  {"CacheCoherent", 4, "0x%x", NULL},
-  {"AllocationHints", 1, "0x%x", NULL},
-  {"MemoryAccessFlags", 1, "0x%x", NULL},
-  {"AddressSizeLimit", 1, "0x%x", NULL},
-  {"ObjectName", sizeof (CHAR8*), "%a", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmNamedComponentNodeParser[] = {
+  { "Token",             sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "IdMappingCount",    4,                        "0x%x", NULL },
+  { "IdMappingToken",    sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "Flags",             4,                        "0x%x", NULL },
+  { "CacheCoherent",     4,                        "0x%x", NULL },
+  { "AllocationHints",   1,                        "0x%x", NULL },
+  { "MemoryAccessFlags", 1,                        "0x%x", NULL },
+  { "AddressSizeLimit",  1,                        "0x%x", NULL },
+  { "ObjectName",        sizeof (CHAR8 *),         "%a",   NULL }
 };
 
 /** A parser for EArmObjRootComplex.
 */
-STATIC CONST CM_OBJ_PARSER CmArmRootComplexNodeParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"IdMappingCount", 4, "0x%x", NULL},
-  {"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"CacheCoherent", 4, "0x%x", NULL},
-  {"AllocationHints", 1, "0x%x", NULL},
-  {"MemoryAccessFlags", 1, "0x%x", NULL},
-  {"AtsAttribute", 4, "0x%x", NULL},
-  {"PciSegmentNumber", 4, "0x%x", NULL},
-  {"MemoryAddressSize", 1, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmRootComplexNodeParser[] = {
+  { "Token",             sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "IdMappingCount",    4,                        "0x%x", NULL },
+  { "IdMappingToken",    sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "CacheCoherent",     4,                        "0x%x", NULL },
+  { "AllocationHints",   1,                        "0x%x", NULL },
+  { "MemoryAccessFlags", 1,                        "0x%x", NULL },
+  { "AtsAttribute",      4,                        "0x%x", NULL },
+  { "PciSegmentNumber",  4,                        "0x%x", NULL },
+  { "MemoryAddressSize", 1,                        "0x%x", NULL }
 };
 
 /** A parser for EArmObjSmmuV1SmmuV2.
 */
-STATIC CONST CM_OBJ_PARSER CmArmSmmuV1SmmuV2NodeParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"IdMappingCount", 4, "0x%x", NULL},
-  {"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"BaseAddress", 8, "0x%llx", NULL},
-  {"Span", 8, "0x%llx", NULL},
-  {"Model", 4, "0x%x", NULL},
-  {"Flags", 4, "0x%x", NULL},
-  {"ContextInterruptCount", 4, "0x%x", NULL},
-  {"ContextInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"PmuInterruptCount", 4, "0x%x", NULL},
-  {"PmuInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"SMMU_NSgIrpt", 4, "0x%x", NULL},
-  {"SMMU_NSgIrptFlags", 4, "0x%x", NULL},
-  {"SMMU_NSgCfgIrpt", 4, "0x%x", NULL},
-  {"SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmSmmuV1SmmuV2NodeParser[] = {
+  { "Token",                 sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL },
+  { "IdMappingCount",        4,                        "0x%x",   NULL },
+  { "IdMappingToken",        sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL },
+  { "BaseAddress",           8,                        "0x%llx", NULL },
+  { "Span",                  8,                        "0x%llx", NULL },
+  { "Model",                 4,                        "0x%x",   NULL },
+  { "Flags",                 4,                        "0x%x",   NULL },
+  { "ContextInterruptCount", 4,                        "0x%x",   NULL },
+  { "ContextInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL },
+  { "PmuInterruptCount",     4,                        "0x%x",   NULL },
+  { "PmuInterruptToken",     sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL },
+  { "SMMU_NSgIrpt",          4,                        "0x%x",   NULL },
+  { "SMMU_NSgIrptFlags",     4,                        "0x%x",   NULL },
+  { "SMMU_NSgCfgIrpt",       4,                        "0x%x",   NULL },
+  { "SMMU_NSgCfgIrptFlags",  4,                        "0x%x",   NULL }
 };
 
 /** A parser for EArmObjSmmuV3.
 */
-STATIC CONST CM_OBJ_PARSER CmArmSmmuV3NodeParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"IdMappingCount", 4, "0x%x", NULL},
-  {"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"BaseAddress", 8, "0x%llx", NULL},
-  {"Flags", 4, "0x%x", NULL},
-  {"VatosAddress", 8, "0x%llx", NULL},
-  {"Model", 4, "0x%x", NULL},
-  {"EventInterrupt", 4, "0x%x", NULL},
-  {"PriInterrupt", 4, "0x%x", NULL},
-  {"GerrInterrupt", 4, "0x%x", NULL},
-  {"SyncInterrupt", 4, "0x%x", NULL},
-  {"ProximityDomain", 4, "0x%x", NULL},
-  {"DeviceIdMappingIndex", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmSmmuV3NodeParser[] = {
+  { "Token",                sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL },
+  { "IdMappingCount",       4,                        "0x%x",   NULL },
+  { "IdMappingToken",       sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL },
+  { "BaseAddress",          8,                        "0x%llx", NULL },
+  { "Flags",                4,                        "0x%x",   NULL },
+  { "VatosAddress",         8,                        "0x%llx", NULL },
+  { "Model",                4,                        "0x%x",   NULL },
+  { "EventInterrupt",       4,                        "0x%x",   NULL },
+  { "PriInterrupt",         4,                        "0x%x",   NULL },
+  { "GerrInterrupt",        4,                        "0x%x",   NULL },
+  { "SyncInterrupt",        4,                        "0x%x",   NULL },
+  { "ProximityDomain",      4,                        "0x%x",   NULL },
+  { "DeviceIdMappingIndex", 4,                        "0x%x",   NULL }
 };
 
 /** A parser for EArmObjPmcg.
 */
-STATIC CONST CM_OBJ_PARSER CmArmPmcgNodeParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"IdMappingCount", 4, "0x%x", NULL},
-  {"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"BaseAddress", 8, "0x%llx", NULL},
-  {"OverflowInterrupt", 4, "0x%x", NULL},
-  {"Page1BaseAddress", 8, "0x%llx", NULL},
-  {"ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmPmcgNodeParser[] = {
+  { "Token",             sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL },
+  { "IdMappingCount",    4,                        "0x%x",   NULL },
+  { "IdMappingToken",    sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL },
+  { "BaseAddress",       8,                        "0x%llx", NULL },
+  { "OverflowInterrupt", 4,                        "0x%x",   NULL },
+  { "Page1BaseAddress",  8,                        "0x%llx", NULL },
+  { "ReferenceToken",    sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL }
 };
 
 /** A parser for EArmObjGicItsIdentifierArray.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGicItsIdentifierParser[] = {
-  {"ItsId", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGicItsIdentifierParser[] = {
+  { "ItsId", 4, "0x%x", NULL }
 };
 
 /** A parser for EArmObjIdMappingArray.
 */
-STATIC CONST CM_OBJ_PARSER CmArmIdMappingParser[] = {
-  {"InputBase", 4, "0x%x", NULL},
-  {"NumIds", 4, "0x%x", NULL},
-  {"OutputBase", 4, "0x%x", NULL},
-  {"OutputReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"Flags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmIdMappingParser[] = {
+  { "InputBase",            4,                        "0x%x", NULL },
+  { "NumIds",               4,                        "0x%x", NULL },
+  { "OutputBase",           4,                        "0x%x", NULL },
+  { "OutputReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "Flags",                4,                        "0x%x", NULL }
 };
 
 /** A parser for EArmObjSmmuInterruptArray.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGenericInterruptParser[] = {
-  {"Interrupt", 4, "0x%x", NULL},
-  {"Flags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGenericInterruptParser[] = {
+  { "Interrupt", 4, "0x%x", NULL },
+  { "Flags",     4, "0x%x", NULL }
 };
 
 /** A parser for EArmObjProcHierarchyInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"Flags", 4, "0x%x", NULL},
-  {"ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"NoOfPrivateResources", 4, "0x%x", NULL},
-  {"PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmProcHierarchyInfoParser[] = {
+  { "Token",                      sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "Flags",                      4,                        "0x%x", NULL },
+  { "ParentToken",                sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "GicCToken",                  sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "NoOfPrivateResources",       4,                        "0x%x", NULL },
+  { "PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
 };
 
 /** A parser for EArmObjCacheInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"Size", 4, "0x%x", NULL},
-  {"NumberOfSets", 4, "0x%x", NULL},
-  {"Associativity", 4, "0x%x", NULL},
-  {"Attributes", 1, "0x%x", NULL},
-  {"LineSize", 2, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmCacheInfoParser[] = {
+  { "Token",                 sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "Size",                  4,                        "0x%x", NULL },
+  { "NumberOfSets",          4,                        "0x%x", NULL },
+  { "Associativity",         4,                        "0x%x", NULL },
+  { "Attributes",            1,                        "0x%x", NULL },
+  { "LineSize",              2,                        "0x%x", NULL }
 };
 
 /** A parser for EArmObjProcNodeIdInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmProcNodeIdInfoParser[] = {
-  {"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
-  {"VendorId", 4, "0x%p", NULL},
-  {"Level1Id", 8, "0x%x", NULL},
-  {"Level2Id", 8, "0x%x", NULL},
-  {"MajorRev", 2, "0x%x", NULL},
-  {"MinorRev", 2, "0x%x", NULL},
-  {"SpinRev", 2, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmProcNodeIdInfoParser[] = {
+  { "Token",    sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+  { "VendorId", 4,                        "0x%p", NULL },
+  { "Level1Id", 8,                        "0x%x", NULL },
+  { "Level2Id", 8,                        "0x%x", NULL },
+  { "MajorRev", 2,                        "0x%x", NULL },
+  { "MinorRev", 2,                        "0x%x", NULL },
+  { "SpinRev",  2,                        "0x%x", NULL }
 };
 
 /** A parser for EArmObjCmRef.
 */
-STATIC CONST CM_OBJ_PARSER CmArmObjRefParser[] = {
-  {"ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmObjRefParser[] = {
+  { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
 };
 
 /** A parser for EArmObjMemoryAffinityInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmMemoryAffinityInfoParser[] = {
-  {"ProximityDomain", 4, "0x%x", NULL},
-  {"BaseAddress", 8, "0x%llx", NULL},
-  {"Length", 8, "0x%llx", NULL},
-  {"Flags", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmMemoryAffinityInfoParser[] = {
+  { "ProximityDomain", 4, "0x%x",   NULL },
+  { "BaseAddress",     8, "0x%llx", NULL },
+  { "Length",          8, "0x%llx", NULL },
+  { "Flags",           4, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjDeviceHandleAcpi.
 */
-STATIC CONST CM_OBJ_PARSER CmArmDeviceHandleAcpiParser[] = {
-  {"Hid", 8, "0x%llx", NULL},
-  {"Uid", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmDeviceHandleAcpiParser[] = {
+  { "Hid", 8, "0x%llx", NULL },
+  { "Uid", 4, "0x%x",   NULL }
 };
 
 /** A parser for EArmObjDeviceHandlePci.
 */
-STATIC CONST CM_OBJ_PARSER CmArmDeviceHandlePciParser[] = {
-  {"SegmentNumber", 2, "0x%x", NULL},
-  {"BusNumber", 1, "0x%x", NULL},
-  {"DeviceNumber", 1, "0x%x", NULL},
-  {"FunctionNumber", 1, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmDeviceHandlePciParser[] = {
+  { "SegmentNumber",  2, "0x%x", NULL },
+  { "BusNumber",      1, "0x%x", NULL },
+  { "DeviceNumber",   1, "0x%x", NULL },
+  { "FunctionNumber", 1, "0x%x", NULL }
 };
 
 /** A parser for EArmObjGenericInitiatorAffinityInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmGenericInitiatorAffinityInfoParser[] = {
-  {"ProximityDomain", 4, "0x%x", NULL},
-  {"Flags", 4, "0x%x", NULL},
-  {"DeviceHandleType", 1, "0x%x", NULL},
-  {"DeviceHandleToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmGenericInitiatorAffinityInfoParser[] = {
+  { "ProximityDomain",   4,                        "0x%x", NULL },
+  { "Flags",             4,                        "0x%x", NULL },
+  { "DeviceHandleType",  1,                        "0x%x", NULL },
+  { "DeviceHandleToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
 };
 
 /** A parser for EArmObjCmn600Info.
 */
-STATIC CONST CM_OBJ_PARSER CmArmCmn600InfoParser[] = {
-  {"PeriphBaseAddress", 8, "0x%llx", NULL},
-  {"PeriphBaseAddressLength", 8, "0x%llx", NULL},
-  {"RootNodeBaseAddress", 8, "0x%llx", NULL},
-  {"DtcCount", 1, "0x%x", NULL},
-  {"DtcInterrupt[0]", 4, "0x%x", NULL},
-  {"DtcFlags[0]", 4, "0x%x", NULL},
-  {"DtcInterrupt[1]", 4, "0x%x", NULL},
-  {"DtcFlags[1]", 4, "0x%x", NULL},
-  {"DtcInterrupt[2]", 4, "0x%x", NULL},
-  {"DtcFlags[2]", 4, "0x%x", NULL},
-  {"DtcInterrupt[3]", 4, "0x%x", NULL},
-  {"DtcFlags[3]", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  CmArmCmn600InfoParser[] = {
+  { "PeriphBaseAddress",       8, "0x%llx", NULL },
+  { "PeriphBaseAddressLength", 8, "0x%llx", NULL },
+  { "RootNodeBaseAddress",     8, "0x%llx", NULL },
+  { "DtcCount",                1, "0x%x",   NULL },
+  { "DtcInterrupt[0]",         4, "0x%x",   NULL },
+  { "DtcFlags[0]",             4, "0x%x",   NULL },
+  { "DtcInterrupt[1]",         4, "0x%x",   NULL },
+  { "DtcFlags[1]",             4, "0x%x",   NULL },
+  { "DtcInterrupt[2]",         4, "0x%x",   NULL },
+  { "DtcFlags[2]",             4, "0x%x",   NULL },
+  { "DtcInterrupt[3]",         4, "0x%x",   NULL },
+  { "DtcFlags[3]",             4, "0x%x",   NULL }
 };
 
 /** A parser for the EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE structure.
 */
-STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParser[] = {
-  {"AddressSpaceId", 1, "%d", NULL},
-  {"RegisterBitWidth", 1, "%d", NULL},
-  {"RegisterBitOffset", 1, "%d", NULL},
-  {"AccessSize", 1, "%d", NULL},
-  {"Address", 8, "0x%llx", NULL},
+STATIC CONST CM_OBJ_PARSER  AcpiGenericAddressParser[] = {
+  { "AddressSpaceId",    1, "%d",     NULL },
+  { "RegisterBitWidth",  1, "%d",     NULL },
+  { "RegisterBitOffset", 1, "%d",     NULL },
+  { "AccessSize",        1, "%d",     NULL },
+  { "Address",           8, "0x%llx", NULL },
 };
 
 /** A parser for EArmObjLpiInfo.
 */
-STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = {
-  {"MinResidency", 4, "0x%llx", NULL},
-  {"WorstCaseWakeLatency", 4, "0x%llx", NULL},
-  {"Flags", 4, "0x%llx", NULL},
-  {"ArchFlags", 4, "0x%llx", NULL},
-  {"ResCntFreq", 4, "0x%llx", NULL},
-  {"EnableParentState", 4, "0x%llx", NULL},
-  {"IsInteger", 1, "%d", NULL},
-  {"IntegerEntryMethod", 8, "0x%llx", NULL},
-  {"RegisterEntryMethod", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
+STATIC CONST CM_OBJ_PARSER  CmArmLpiInfoParser[] = {
+  { "MinResidency",             4,                                               "0x%llx", NULL },
+  { "WorstCaseWakeLatency",     4,                                               "0x%llx", NULL },
+  { "Flags",                    4,                                               "0x%llx", NULL },
+  { "ArchFlags",                4,                                               "0x%llx", NULL },
+  { "ResCntFreq",               4,                                               "0x%llx", NULL },
+  { "EnableParentState",        4,                                               "0x%llx", NULL },
+  { "IsInteger",                1,                                               "%d",     NULL },
+  { "IntegerEntryMethod",       8,                                               "0x%llx", NULL },
+  { "RegisterEntryMethod",      sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
     NULL, NULL, AcpiGenericAddressParser,
-    ARRAY_SIZE (AcpiGenericAddressParser)},
-  {"ResidencyCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
+    ARRAY_SIZE (AcpiGenericAddressParser) },
+  { "ResidencyCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
     NULL, NULL, AcpiGenericAddressParser,
-    ARRAY_SIZE (AcpiGenericAddressParser)},
-  {"UsageCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
+    ARRAY_SIZE (AcpiGenericAddressParser) },
+  { "UsageCounterRegister",     sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
     NULL, NULL, AcpiGenericAddressParser,
-    ARRAY_SIZE (AcpiGenericAddressParser)},
-  {"StateName", 16, "0x%a", NULL},
+    ARRAY_SIZE (AcpiGenericAddressParser) },
+  { "StateName",                16,                                              "0x%a",   NULL },
 };
 
 /** A parser for Arm namespace objects.
 */
-STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = {
-  {"EArmObjReserved", NULL, 0},
-  {"EArmObjBootArchInfo", CmArmBootArchInfoParser,
-    ARRAY_SIZE (CmArmBootArchInfoParser)},
-  {"EArmObjCpuInfo", NULL, 0},
-  {"EArmObjPowerManagementProfileInfo", CmArmPowerManagementProfileInfoParser,
-    ARRAY_SIZE (CmArmPowerManagementProfileInfoParser)},
-  {"EArmObjGicCInfo", CmArmGicCInfoParser, ARRAY_SIZE (CmArmGicCInfoParser)},
-  {"EArmObjGicDInfo", CmArmGicDInfoParser, ARRAY_SIZE (CmArmGicDInfoParser)},
-  {"EArmObjGicMsiFrameInfo", CmArmGicMsiFrameInfoParser,
-    ARRAY_SIZE (CmArmGicMsiFrameInfoParser)},
-  {"EArmObjGicRedistributorInfo", CmArmGicRedistInfoParser,
-    ARRAY_SIZE (CmArmGicRedistInfoParser)},
-  {"EArmObjGicItsInfo", CmArmGicItsInfoParser,
-    ARRAY_SIZE (CmArmGicItsInfoParser)},
-  {"EArmObjSerialConsolePortInfo", CmArmSerialPortInfoParser,
-    ARRAY_SIZE (CmArmSerialPortInfoParser)},
-  {"EArmObjSerialDebugPortInfo", CmArmSerialPortInfoParser,
-    ARRAY_SIZE (CmArmSerialPortInfoParser)},
-  {"EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser,
-    ARRAY_SIZE (CmArmGenericTimerInfoParser)},
-  {"EArmObjPlatformGTBlockInfo", CmArmGTBlockTimerFrameInfoParser,
-    ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser)},
-  {"EArmObjGTBlockTimerFrameInfo", CmArmGTBlockInfoParser,
-    ARRAY_SIZE (CmArmGTBlockInfoParser)},
-  {"EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParser,
-    ARRAY_SIZE (CmArmGenericWatchdogInfoParser)},
-  {"EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser,
-    ARRAY_SIZE (CmArmPciConfigSpaceInfoParser)},
-  {"EArmObjHypervisorVendorIdentity", CmArmHypervisorVendorIdParser,
-    ARRAY_SIZE (CmArmHypervisorVendorIdParser)},
-  {"EArmObjFixedFeatureFlags", CmArmFixedFeatureFlagsParser,
-    ARRAY_SIZE (CmArmFixedFeatureFlagsParser)},
-  {"EArmObjItsGroup", CmArmItsGroupNodeParser,
-    ARRAY_SIZE (CmArmItsGroupNodeParser)},
-  {"EArmObjNamedComponent", CmArmNamedComponentNodeParser,
-    ARRAY_SIZE (CmArmNamedComponentNodeParser)},
-  {"EArmObjRootComplex", CmArmRootComplexNodeParser,
-    ARRAY_SIZE (CmArmRootComplexNodeParser)},
-  {"EArmObjSmmuV1SmmuV2", CmArmSmmuV1SmmuV2NodeParser,
-    ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser)},
-  {"EArmObjSmmuV3", CmArmSmmuV3NodeParser,
-    ARRAY_SIZE (CmArmSmmuV3NodeParser)},
-  {"EArmObjPmcg", CmArmPmcgNodeParser, ARRAY_SIZE (CmArmPmcgNodeParser)},
-  {"EArmObjGicItsIdentifierArray", CmArmGicItsIdentifierParser,
-    ARRAY_SIZE (CmArmGicItsIdentifierParser)},
-  {"EArmObjIdMappingArray", CmArmIdMappingParser,
-    ARRAY_SIZE (CmArmIdMappingParser)},
-  {"EArmObjSmmuInterruptArray", CmArmGenericInterruptParser,
-    ARRAY_SIZE (CmArmGenericInterruptParser)},
-  {"EArmObjProcHierarchyInfo", CmArmProcHierarchyInfoParser,
-    ARRAY_SIZE (CmArmProcHierarchyInfoParser)},
-  {"EArmObjCacheInfo", CmArmCacheInfoParser,
-    ARRAY_SIZE (CmArmCacheInfoParser)},
-  {"EArmObjProcNodeIdInfo", CmArmProcNodeIdInfoParser,
-    ARRAY_SIZE (CmArmProcNodeIdInfoParser)},
-  {"EArmObjCmRef", CmArmObjRefParser, ARRAY_SIZE (CmArmObjRefParser)},
-  {"EArmObjMemoryAffinityInfo", CmArmMemoryAffinityInfoParser,
-    ARRAY_SIZE (CmArmMemoryAffinityInfoParser)},
-  {"EArmObjDeviceHandleAcpi", CmArmDeviceHandleAcpiParser,
-    ARRAY_SIZE (CmArmDeviceHandleAcpiParser)},
-  {"EArmObjDeviceHandlePci", CmArmDeviceHandlePciParser,
-    ARRAY_SIZE (CmArmDeviceHandlePciParser)},
-  {"EArmObjGenericInitiatorAffinityInfo",
+STATIC CONST CM_OBJ_PARSER_ARRAY  ArmNamespaceObjectParser[] = {
+  { "EArmObjReserved",                     NULL,                                  0                                },
+  { "EArmObjBootArchInfo",                 CmArmBootArchInfoParser,
+    ARRAY_SIZE (CmArmBootArchInfoParser) },
+  { "EArmObjCpuInfo",                      NULL,                                  0                                },
+  { "EArmObjPowerManagementProfileInfo",   CmArmPowerManagementProfileInfoParser,
+    ARRAY_SIZE (CmArmPowerManagementProfileInfoParser) },
+  { "EArmObjGicCInfo",                     CmArmGicCInfoParser,                   ARRAY_SIZE (CmArmGicCInfoParser) },
+  { "EArmObjGicDInfo",                     CmArmGicDInfoParser,                   ARRAY_SIZE (CmArmGicDInfoParser) },
+  { "EArmObjGicMsiFrameInfo",              CmArmGicMsiFrameInfoParser,
+    ARRAY_SIZE (CmArmGicMsiFrameInfoParser) },
+  { "EArmObjGicRedistributorInfo",         CmArmGicRedistInfoParser,
+    ARRAY_SIZE (CmArmGicRedistInfoParser) },
+  { "EArmObjGicItsInfo",                   CmArmGicItsInfoParser,
+    ARRAY_SIZE (CmArmGicItsInfoParser) },
+  { "EArmObjSerialConsolePortInfo",        CmArmSerialPortInfoParser,
+    ARRAY_SIZE (CmArmSerialPortInfoParser) },
+  { "EArmObjSerialDebugPortInfo",          CmArmSerialPortInfoParser,
+    ARRAY_SIZE (CmArmSerialPortInfoParser) },
+  { "EArmObjGenericTimerInfo",             CmArmGenericTimerInfoParser,
+    ARRAY_SIZE (CmArmGenericTimerInfoParser) },
+  { "EArmObjPlatformGTBlockInfo",          CmArmGTBlockTimerFrameInfoParser,
+    ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser) },
+  { "EArmObjGTBlockTimerFrameInfo",        CmArmGTBlockInfoParser,
+    ARRAY_SIZE (CmArmGTBlockInfoParser) },
+  { "EArmObjPlatformGenericWatchdogInfo",  CmArmGenericWatchdogInfoParser,
+    ARRAY_SIZE (CmArmGenericWatchdogInfoParser) },
+  { "EArmObjPciConfigSpaceInfo",           CmArmPciConfigSpaceInfoParser,
+    ARRAY_SIZE (CmArmPciConfigSpaceInfoParser) },
+  { "EArmObjHypervisorVendorIdentity",     CmArmHypervisorVendorIdParser,
+    ARRAY_SIZE (CmArmHypervisorVendorIdParser) },
+  { "EArmObjFixedFeatureFlags",            CmArmFixedFeatureFlagsParser,
+    ARRAY_SIZE (CmArmFixedFeatureFlagsParser) },
+  { "EArmObjItsGroup",                     CmArmItsGroupNodeParser,
+    ARRAY_SIZE (CmArmItsGroupNodeParser) },
+  { "EArmObjNamedComponent",               CmArmNamedComponentNodeParser,
+    ARRAY_SIZE (CmArmNamedComponentNodeParser) },
+  { "EArmObjRootComplex",                  CmArmRootComplexNodeParser,
+    ARRAY_SIZE (CmArmRootComplexNodeParser) },
+  { "EArmObjSmmuV1SmmuV2",                 CmArmSmmuV1SmmuV2NodeParser,
+    ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser) },
+  { "EArmObjSmmuV3",                       CmArmSmmuV3NodeParser,
+    ARRAY_SIZE (CmArmSmmuV3NodeParser) },
+  { "EArmObjPmcg",                         CmArmPmcgNodeParser,                   ARRAY_SIZE (CmArmPmcgNodeParser) },
+  { "EArmObjGicItsIdentifierArray",        CmArmGicItsIdentifierParser,
+    ARRAY_SIZE (CmArmGicItsIdentifierParser) },
+  { "EArmObjIdMappingArray",               CmArmIdMappingParser,
+    ARRAY_SIZE (CmArmIdMappingParser) },
+  { "EArmObjSmmuInterruptArray",           CmArmGenericInterruptParser,
+    ARRAY_SIZE (CmArmGenericInterruptParser) },
+  { "EArmObjProcHierarchyInfo",            CmArmProcHierarchyInfoParser,
+    ARRAY_SIZE (CmArmProcHierarchyInfoParser) },
+  { "EArmObjCacheInfo",                    CmArmCacheInfoParser,
+    ARRAY_SIZE (CmArmCacheInfoParser) },
+  { "EArmObjProcNodeIdInfo",               CmArmProcNodeIdInfoParser,
+    ARRAY_SIZE (CmArmProcNodeIdInfoParser) },
+  { "EArmObjCmRef",                        CmArmObjRefParser,                     ARRAY_SIZE (CmArmObjRefParser)   },
+  { "EArmObjMemoryAffinityInfo",           CmArmMemoryAffinityInfoParser,
+    ARRAY_SIZE (CmArmMemoryAffinityInfoParser) },
+  { "EArmObjDeviceHandleAcpi",             CmArmDeviceHandleAcpiParser,
+    ARRAY_SIZE (CmArmDeviceHandleAcpiParser) },
+  { "EArmObjDeviceHandlePci",              CmArmDeviceHandlePciParser,
+    ARRAY_SIZE (CmArmDeviceHandlePciParser) },
+  { "EArmObjGenericInitiatorAffinityInfo",
     CmArmGenericInitiatorAffinityInfoParser,
-    ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser)},
-  {"EArmObjSerialPortInfo", CmArmSerialPortInfoParser,
-    ARRAY_SIZE (CmArmSerialPortInfoParser)},
-  {"EArmObjCmn600Info", CmArmCmn600InfoParser,
-    ARRAY_SIZE (CmArmCmn600InfoParser)},
-  {"EArmObjLpiInfo", CmArmLpiInfoParser,
-      ARRAY_SIZE (CmArmLpiInfoParser)},
-  {"EArmObjMax", NULL, 0},
+    ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser) },
+  { "EArmObjSerialPortInfo",               CmArmSerialPortInfoParser,
+    ARRAY_SIZE (CmArmSerialPortInfoParser) },
+  { "EArmObjCmn600Info",                   CmArmCmn600InfoParser,
+    ARRAY_SIZE (CmArmCmn600InfoParser) },
+  { "EArmObjLpiInfo",                      CmArmLpiInfoParser,
+    ARRAY_SIZE (CmArmLpiInfoParser) },
+  { "EArmObjMax",                          NULL,                                  0                                },
 };
 
 /** A parser for EStdObjCfgMgrInfo.
 */
-STATIC CONST CM_OBJ_PARSER StdObjCfgMgrInfoParser[] = {
-  {"Revision", 4, "0x%x", NULL},
-  {"OemId[6]", 6, "%C%C%C%C%C%C", PrintOemId}
+STATIC CONST CM_OBJ_PARSER  StdObjCfgMgrInfoParser[] = {
+  { "Revision", 4, "0x%x",         NULL       },
+  { "OemId[6]", 6, "%C%C%C%C%C%C", PrintOemId }
 };
 
 /** A parser for EStdObjAcpiTableList.
 */
-STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser[] = {
-  {"AcpiTableSignature", 4, "0x%x", NULL},
-  {"AcpiTableRevision", 1, "%d", NULL},
-  {"TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL},
-  {"AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER*), "0x%p", NULL},
-  {"OemTableId", 8, "0x%LLX", NULL},
-  {"OemRevision", 4, "0x%x", NULL}
+STATIC CONST CM_OBJ_PARSER  StdObjAcpiTableInfoParser[] = {
+  { "AcpiTableSignature", 4,                                      "0x%x",   NULL },
+  { "AcpiTableRevision",  1,                                      "%d",     NULL },
+  { "TableGeneratorId",   sizeof (ACPI_TABLE_GENERATOR_ID),       "0x%x",   NULL },
+  { "AcpiTableData",      sizeof (EFI_ACPI_DESCRIPTION_HEADER *), "0x%p",   NULL },
+  { "OemTableId",         8,                                      "0x%LLX", NULL },
+  { "OemRevision",        4,                                      "0x%x",   NULL }
 };
 
 /** A parser for EStdObjSmbiosTableList.
 */
-STATIC CONST CM_OBJ_PARSER StdObjSmbiosTableInfoParser[] = {
-  {"TableGeneratorId", sizeof (SMBIOS_TABLE_GENERATOR_ID), "0x%x", NULL},
-  {"SmbiosTableData", sizeof (SMBIOS_STRUCTURE*), "0x%p", NULL}
+STATIC CONST CM_OBJ_PARSER  StdObjSmbiosTableInfoParser[] = {
+  { "TableGeneratorId", sizeof (SMBIOS_TABLE_GENERATOR_ID), "0x%x", NULL },
+  { "SmbiosTableData",  sizeof (SMBIOS_STRUCTURE *),        "0x%p", NULL }
 };
 
 /** A parser for Standard namespace objects.
 */
-STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = {
-  {"EStdObjCfgMgrInfo", StdObjCfgMgrInfoParser,
-    ARRAY_SIZE (StdObjCfgMgrInfoParser)},
-  {"EStdObjAcpiTableList", StdObjAcpiTableInfoParser,
-    ARRAY_SIZE (StdObjAcpiTableInfoParser)},
-  {"EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser,
-    ARRAY_SIZE (StdObjSmbiosTableInfoParser)},
+STATIC CONST CM_OBJ_PARSER_ARRAY  StdNamespaceObjectParser[] = {
+  { "EStdObjCfgMgrInfo",      StdObjCfgMgrInfoParser,
+    ARRAY_SIZE (StdObjCfgMgrInfoParser) },
+  { "EStdObjAcpiTableList",   StdObjAcpiTableInfoParser,
+    ARRAY_SIZE (StdObjAcpiTableInfoParser) },
+  { "EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser,
+    ARRAY_SIZE (StdObjSmbiosTableInfoParser) },
 };
 
 /** Print OEM Id.
@@ -523,8 +523,8 @@ STATIC
 VOID
 EFIAPI
 PrintOemId (
-  IN  CONST CHAR8  * Format,
-  IN  UINT8        * Ptr
+  IN  CONST CHAR8  *Format,
+  IN  UINT8        *Ptr
   )
 {
   DEBUG ((
@@ -552,11 +552,11 @@ PrintOemId (
 STATIC
 VOID
 PrintCmObjDesc (
-  IN        VOID            *Data,
-  IN  CONST CM_OBJ_PARSER   *Parser,
-  IN        UINTN           ItemCount,
-  IN        INTN            *RemainingSize,
-  IN        UINT32          IndentLevel
+  IN        VOID           *Data,
+  IN  CONST CM_OBJ_PARSER  *Parser,
+  IN        UINTN          ItemCount,
+  IN        INTN           *RemainingSize,
+  IN        UINT32         IndentLevel
   )
 {
   UINT32  Index;
@@ -566,7 +566,8 @@ PrintCmObjDesc (
   if ((Data == NULL)    ||
       (Parser == NULL)  ||
       (ItemCount == 0)  ||
-      (RemainingSize == NULL)) {
+      (RemainingSize == NULL))
+  {
     ASSERT (0);
     return;
   }
@@ -601,16 +602,16 @@ PrintCmObjDesc (
     } else if (Parser[Index].Format != NULL) {
       switch (Parser[Index].Length) {
         case 1:
-          DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT8*)Data));
+          DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT8 *)Data));
           break;
         case 2:
-          DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT16*)Data));
+          DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT16 *)Data));
           break;
         case 4:
-          DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT32*)Data));
+          DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT32 *)Data));
           break;
         case 8:
-          DEBUG ((DEBUG_ERROR, Parser[Index].Format, ReadUnaligned64(Data)));
+          DEBUG ((DEBUG_ERROR, Parser[Index].Format, ReadUnaligned64 (Data)));
           break;
         default:
           DEBUG ((
@@ -640,8 +641,9 @@ PrintCmObjDesc (
         Parser[Index].Length
         ));
     }
+
     DEBUG ((DEBUG_ERROR, "\n"));
-    Data = (UINT8*)Data + Parser[Index].Length;
+    Data = (UINT8 *)Data + Parser[Index].Length;
   } // for
 }
 
@@ -652,22 +654,22 @@ PrintCmObjDesc (
 VOID
 EFIAPI
 ParseCmObjDesc (
-  IN  CONST CM_OBJ_DESCRIPTOR * CmObjDesc
+  IN  CONST CM_OBJ_DESCRIPTOR  *CmObjDesc
   )
 {
-  UINTN   ObjId;
-  UINTN   NameSpaceId;
-  UINT32  ObjIndex;
-  UINT32  ObjectCount;
-  INTN    RemainingSize;
-  CONST  CM_OBJ_PARSER_ARRAY * ParserArray;
+  UINTN                       ObjId;
+  UINTN                       NameSpaceId;
+  UINT32                      ObjIndex;
+  UINT32                      ObjectCount;
+  INTN                        RemainingSize;
+  CONST  CM_OBJ_PARSER_ARRAY  *ParserArray;
 
   if ((CmObjDesc == NULL) || (CmObjDesc->Data == NULL)) {
     return;
   }
 
   NameSpaceId = GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId);
-  ObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);
+  ObjId       = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);
 
   switch (NameSpaceId) {
     case EObjNameSpaceStandard:
@@ -675,6 +677,7 @@ ParseCmObjDesc (
         ASSERT (0);
         return;
       }
+
       ParserArray = &StdNamespaceObjectParser[ObjId];
       break;
     case EObjNameSpaceArm:
@@ -682,6 +685,7 @@ ParseCmObjDesc (
         ASSERT (0);
         return;
       }
+
       ParserArray = &ArmNamespaceObjectParser[ObjId];
       break;
     default:
@@ -690,7 +694,7 @@ ParseCmObjDesc (
       return;
   } // switch
 
-  ObjectCount = CmObjDesc->Count;
+  ObjectCount   = CmObjDesc->Count;
   RemainingSize = CmObjDesc->Size;
 
   for (ObjIndex = 0; ObjIndex < ObjectCount; ObjIndex++) {

+ 11 - 13
DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h

@@ -9,7 +9,7 @@
 #ifndef CONFIGURATION_MANAGER_OBJECT_PARSER_H_
 #define CONFIGURATION_MANAGER_OBJECT_PARSER_H_
 
-#define OUTPUT_FIELD_COLUMN_WIDTH   32
+#define OUTPUT_FIELD_COLUMN_WIDTH  32
 
 /** Function prototype to format a field print.
 
@@ -17,7 +17,7 @@
                       the 'Format' member of ACPI_PARSER.
   @param [in] Ptr     Pointer to the start of the buffer.
 **/
-typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8* Format, UINT8* Ptr);
+typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8 *Format, UINT8 *Ptr);
 
 /**
   The CM_OBJ_PARSER structure describes the fields of an CmObject and
@@ -28,30 +28,29 @@ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8* Format, UINT8* Ptr);
 */
 typedef struct CmObjParser CM_OBJ_PARSER;
 struct CmObjParser {
-
   /// String describing the Cm Object
-  CONST CHAR8*            NameStr;
+  CONST CHAR8              *NameStr;
 
   /// The length of the field.
-  UINT32                  Length;
+  UINT32                   Length;
 
   /// Optional Print() style format string for tracing the data. If not
   /// used this must be set to NULL.
-  CONST CHAR8*            Format;
+  CONST CHAR8              *Format;
 
   /// Optional pointer to a print formatter function which
   /// is typically used to trace complex field information.
   /// If not used this must be set to NULL.
   /// The Format string is passed to the PrintFormatter function
   /// but may be ignored by the implementation code.
-  FNPTR_PRINT_FORMATTER   PrintFormatter;
+  FNPTR_PRINT_FORMATTER    PrintFormatter;
 
   /// Optional pointer to print the fields of another CM_OBJ_PARSER
   /// structure. This is useful to print sub-structures.
-  CONST CM_OBJ_PARSER     *SubObjParser;
+  CONST CM_OBJ_PARSER      *SubObjParser;
 
   /// Count of items in the SubObj.
-  UINTN                   SubObjItemCount;
+  UINTN                    SubObjItemCount;
 };
 
 /**
@@ -59,15 +58,14 @@ struct CmObjParser {
   with their object names.
 */
 typedef struct CmObjParserArray {
-
   /// Object name
-  CONST CHAR8         * ObjectName;
+  CONST CHAR8            *ObjectName;
 
   /// Function pointer to the parser
-  CONST CM_OBJ_PARSER * Parser;
+  CONST CM_OBJ_PARSER    *Parser;
 
   /// Count of items
-  UINTN                 ItemCount;
+  UINTN                  ItemCount;
 } CM_OBJ_PARSER_ARRAY;
 
 #endif // CONFIGURATION_MANAGER_OBJECT_PARSER_H_

+ 42 - 38
DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c

@@ -34,8 +34,8 @@
 EFI_STATUS
 EFIAPI
 GetCgfMgrInfo (
-  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL      * CONST  CfgMgrProtocol,
-  OUT       CM_STD_OBJ_CONFIGURATION_MANAGER_INFO    **        CfgMfrInfo
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL      *CONST  CfgMgrProtocol,
+  OUT       CM_STD_OBJ_CONFIGURATION_MANAGER_INFO             **CfgMfrInfo
   )
 {
   EFI_STATUS         Status;
@@ -45,12 +45,12 @@ GetCgfMgrInfo (
   ASSERT (CfgMfrInfo != NULL);
 
   *CfgMfrInfo = NULL;
-  Status = CfgMgrProtocol->GetObject (
-                             CfgMgrProtocol,
-                             CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo),
-                             CM_NULL_TOKEN,
-                             &CmObjectDesc
-                             );
+  Status      = CfgMgrProtocol->GetObject (
+                                  CfgMgrProtocol,
+                                  CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo),
+                                  CM_NULL_TOKEN,
+                                  &CmObjectDesc
+                                  );
   if (EFI_ERROR (Status)) {
     DEBUG ((
       DEBUG_ERROR,
@@ -72,7 +72,8 @@ GetCgfMgrInfo (
   }
 
   if (CmObjectDesc.Size <
-      (sizeof (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO) * CmObjectDesc.Count)) {
+      (sizeof (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO) * CmObjectDesc.Count))
+  {
     DEBUG ((
       DEBUG_ERROR,
       "ERROR: EStdObjCfgMgrInfo: Buffer too small, size  = 0x%x\n",
@@ -82,7 +83,7 @@ GetCgfMgrInfo (
     return EFI_BAD_BUFFER_SIZE;
   }
 
-  *CfgMfrInfo = (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO*)CmObjectDesc.Data;
+  *CfgMfrInfo = (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO *)CmObjectDesc.Data;
   return Status;
 }
 
@@ -109,15 +110,15 @@ GetCgfMgrInfo (
 EFI_STATUS
 EFIAPI
 AddAcpiHeader (
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST Generator,
-  IN OUT  EFI_ACPI_DESCRIPTION_HEADER                 * CONST AcpiHeader,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  Generator,
+  IN OUT  EFI_ACPI_DESCRIPTION_HEADER                 *CONST  AcpiHeader,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
   IN      CONST UINT32                                        Length
   )
 {
-  EFI_STATUS                               Status;
-  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO  * CfgMfrInfo;
+  EFI_STATUS                             Status;
+  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO  *CfgMfrInfo;
 
   ASSERT (CfgMgrProtocol != NULL);
   ASSERT (Generator != NULL);
@@ -130,7 +131,8 @@ AddAcpiHeader (
       (AcpiHeader == NULL) ||
       (AcpiTableInfo == NULL) ||
       (Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER))
-    ) {
+      )
+  {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -212,16 +214,16 @@ error_handler:
 EFI_STATUS
 EFIAPI
 AddSsdtAcpiHeader (
-  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
-  IN      CONST ACPI_TABLE_GENERATOR                  * CONST Generator,
-  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
-      OUT       AML_ROOT_NODE_HANDLE                  *       RootNode
+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  IN      CONST ACPI_TABLE_GENERATOR                  *CONST  Generator,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  OUT       AML_ROOT_NODE_HANDLE                              *RootNode
   )
 {
-  EFI_STATUS                               Status;
-  UINT64                                   OemTableId;
-  UINT32                                   OemRevision;
-  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO  * CfgMfrInfo;
+  EFI_STATUS                             Status;
+  UINT64                                 OemTableId;
+  UINT32                                 OemRevision;
+  CM_STD_OBJ_CONFIGURATION_MANAGER_INFO  *CfgMfrInfo;
 
   ASSERT (CfgMgrProtocol != NULL);
   ASSERT (Generator != NULL);
@@ -229,7 +231,8 @@ AddSsdtAcpiHeader (
 
   if ((CfgMgrProtocol == NULL)  ||
       (Generator == NULL)       ||
-      (AcpiTableInfo == NULL)) {
+      (AcpiTableInfo == NULL))
+  {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -263,8 +266,8 @@ AddSsdtAcpiHeader (
 
   Status = AmlCodeGenDefinitionBlock (
              "SSDT",
-             (CONST CHAR8*)&CfgMfrInfo->OemId,
-             (CONST CHAR8*)&OemTableId,
+             (CONST CHAR8 *)&CfgMfrInfo->OemId,
+             (CONST CHAR8 *)&OemTableId,
              OemRevision,
              RootNode
              );
@@ -289,16 +292,16 @@ AddSsdtAcpiHeader (
 BOOLEAN
 EFIAPI
 FindDuplicateValue (
-  IN  CONST VOID          * Array,
-  IN  CONST UINTN           Count,
-  IN  CONST UINTN           ElementSize,
-  IN        PFN_IS_EQUAL    EqualTestFunction
+  IN  CONST VOID          *Array,
+  IN  CONST UINTN         Count,
+  IN  CONST UINTN         ElementSize,
+  IN        PFN_IS_EQUAL  EqualTestFunction
   )
 {
-  UINTN         Index1;
-  UINTN         Index2;
-  UINT8       * Element1;
-  UINT8       * Element2;
+  UINTN  Index1;
+  UINTN  Index2;
+  UINT8  *Element1;
+  UINT8  *Element2;
 
   if (Array == NULL) {
     DEBUG ((DEBUG_ERROR, "ERROR: FindDuplicateValues: Array is NULL.\n"));
@@ -324,13 +327,14 @@ FindDuplicateValue (
 
   for (Index1 = 0; Index1 < Count - 1; Index1++) {
     for (Index2 = Index1 + 1; Index2 < Count; Index2++) {
-      Element1 = (UINT8*)Array + (Index1 * ElementSize);
-      Element2 = (UINT8*)Array + (Index2 * ElementSize);
+      Element1 = (UINT8 *)Array + (Index1 * ElementSize);
+      Element2 = (UINT8 *)Array + (Index2 * ElementSize);
 
       if (EqualTestFunction (Element1, Element2, Index1, Index2)) {
         return TRUE;
       }
     }
   }
+
   return FALSE;
 }

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