Revision: 14271
          http://edk2.svn.sourceforge.net/edk2/?rev=14271&view=rev
Author:   oliviermartin
Date:     2013-04-14 09:33:35 +0000 (Sun, 14 Apr 2013)
Log Message:
-----------
ArmPkg/BdsLib: Do not create additional 'cpu' nodes if the 'cpus' node already 
exist

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.mar...@arm.com>

Modified Paths:
--------------
    trunk/edk2/ArmPkg/Library/BdsLib/BdsLinuxFdt.c

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

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to