]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
DynamicTablesPkg: Fix unaligned pointers usage
[mirror_edk2.git] / DynamicTablesPkg / Library / Acpi / Arm / AcpiPpttLibArm / PpttGenerator.c
index 40699ce113caa8530c89ac20562cf5abda26b88e..82070403ac8757f54e839fd00eb4acb3292fc60c 100644 (file)
@@ -1066,6 +1066,9 @@ BuildPpttTable (
   EFI_STATUS                      Status;\r
   UINT32                          TableSize;\r
   UINT32                          ProcTopologyStructCount;\r
+  UINT32                          ProcHierarchyNodeCount;\r
+  UINT32                          CacheStructCount;\r
+  UINT32                          IdStructCount;\r
 \r
   UINT32                          ProcHierarchyNodeOffset;\r
   UINT32                          CacheStructOffset;\r
@@ -1113,7 +1116,7 @@ BuildPpttTable (
              CfgMgrProtocol,\r
              CM_NULL_TOKEN,\r
              &ProcHierarchyNodeList,\r
-             &Generator->ProcHierarchyNodeCount\r
+             &ProcHierarchyNodeCount\r
              );\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((\r
@@ -1124,7 +1127,8 @@ BuildPpttTable (
     goto error_handler;\r
   }\r
 \r
-  ProcTopologyStructCount = Generator->ProcHierarchyNodeCount;\r
+  ProcTopologyStructCount = ProcHierarchyNodeCount;\r
+  Generator->ProcHierarchyNodeCount = ProcHierarchyNodeCount;\r
 \r
   // Get the cache info and update the processor topology structure count with\r
   // Cache Type Structures (Type 1)\r
@@ -1132,7 +1136,7 @@ BuildPpttTable (
              CfgMgrProtocol,\r
              CM_NULL_TOKEN,\r
              &CacheStructList,\r
-             &Generator->CacheStructCount\r
+             &CacheStructCount\r
              );\r
   if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {\r
     DEBUG ((\r
@@ -1143,7 +1147,8 @@ BuildPpttTable (
     goto error_handler;\r
   }\r
 \r
-  ProcTopologyStructCount += Generator->CacheStructCount;\r
+  ProcTopologyStructCount += CacheStructCount;\r
+  Generator->CacheStructCount = CacheStructCount;\r
 \r
   // Get the processor hierarchy node ID info and update the processor topology\r
   // structure count with ID Structures (Type 2)\r
@@ -1151,7 +1156,7 @@ BuildPpttTable (
              CfgMgrProtocol,\r
              CM_NULL_TOKEN,\r
              &IdStructList,\r
-             &Generator->IdStructCount\r
+             &IdStructCount\r
              );\r
   if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {\r
     DEBUG ((\r
@@ -1163,7 +1168,8 @@ BuildPpttTable (
     goto error_handler;\r
   }\r
 \r
-  ProcTopologyStructCount += Generator->IdStructCount;\r
+  ProcTopologyStructCount += IdStructCount;\r
+  Generator->IdStructCount = IdStructCount;\r
 \r
   // Allocate Node Indexer array\r
   NodeIndexer = (PPTT_NODE_INDEXER*)AllocateZeroPool (\r
@@ -1475,6 +1481,12 @@ ACPI_PPTT_GENERATOR PpttGenerator = {
 \r
   // Processor topology node count\r
   0,\r
+  // Count of Processor Hierarchy Nodes\r
+  0,\r
+  // Count of Cache Structures\r
+  0,\r
+  // Count of Id Structures\r
+  0,\r
   // Pointer to PPTT Node Indexer\r
   NULL\r
 };\r