]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/BdsLib: Do not create additional 'cpu' nodes if the 'cpus' node already exist
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 Apr 2013 09:33:35 +0000 (09:33 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 Apr 2013 09:33:35 +0000 (09:33 +0000)
UEFI must not add additional 'cpu' nodes if the 'cpus' node was already present.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14271 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Library/BdsLib/BdsLinuxFdt.c

index 7bfb2cd6289b33d0fceff54c7d5855edd8434697..b6d08944abd08b3b03802ad97a0fbaf4ca3b9f42 100644 (file)
@@ -244,6 +244,7 @@ PrepareFdt (
   BOOLEAN               PsciSmcSupported;\r
   UINTN                 Rx;\r
   UINTN                 OriginalFdtSize;\r
+  BOOLEAN               CpusNodeExist;\r
 \r
   //\r
   // Ensure the Power State Coordination Interface (PSCI) SMCs are there if supported\r
@@ -448,6 +449,9 @@ PrepareFdt (
         fdt_setprop_string(fdt, node, "name", "cpus");\r
         fdt_setprop_cell(fdt, node, "#address-cells", 1);\r
         fdt_setprop_cell(fdt, node, "#size-cells", 0);\r
+        CpusNodeExist = FALSE;\r
+      } else {\r
+        CpusNodeExist = TRUE;\r
       }\r
 \r
       // Get pointer to ARM processor table\r
@@ -456,16 +460,20 @@ PrepareFdt (
 \r
       for (Index = 0; Index < ArmProcessorTable->NumberOfEntries; Index++) {\r
         AsciiSPrint (Name, 10, "cpu@%d", Index);\r
-        cpu_node = fdt_subnode_offset(fdt, node, Name);\r
-        if (cpu_node < 0) {\r
+\r
+        // If the 'cpus' node did not exist then creates the 'cpu' nodes. In case 'cpus' node\r
+        // is provided in the original FDT then we do not add any 'cpu' node.\r
+        if (!CpusNodeExist) {\r
           cpu_node = fdt_add_subnode(fdt, node, Name);\r
           fdt_setprop_string(fdt, cpu_node, "device-type", "cpu");\r
           fdt_setprop(fdt, cpu_node, "reg", &Index, sizeof(Index));\r
+        } else {\r
+          cpu_node = fdt_subnode_offset(fdt, node, Name);\r
         }\r
 \r
         // If Power State Coordination Interface (PSCI) is not supported then it is expected the secondary\r
         // cores are spinning waiting for the Operating System to release them\r
-        if (PsciSmcSupported == FALSE) {\r
+        if ((PsciSmcSupported == FALSE) && (cpu_node >= 0)) {\r
           // We as the bootloader are responsible for either creating or updating\r
           // these entries. Do not trust the entries in the DT. We only know about\r
           // 'spin-table' type. Do not try to update other types if defined.\r