summaryrefslogtreecommitdiff
path: root/ArmPkg
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2013-04-14 09:33:35 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2013-04-14 09:33:35 +0000
commit3809e6e071ff3cfee9553c5153d14603ccd8e8a5 (patch)
treef54dcd271c6c8681435d57694d66943bed9a082d /ArmPkg
parent72647f190167a6f7830dc4cd8991aa6c1859d672 (diff)
downloadedk2-platforms-3809e6e071ff3cfee9553c5153d14603ccd8e8a5.tar.xz
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.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14271 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/BdsLib/BdsLinuxFdt.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsLinuxFdt.c b/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
index 7bfb2cd628..b6d08944ab 100644
--- a/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
+++ b/ArmPkg/Library/BdsLib/BdsLinuxFdt.c
@@ -244,6 +244,7 @@ PrepareFdt (
BOOLEAN PsciSmcSupported;
UINTN Rx;
UINTN OriginalFdtSize;
+ BOOLEAN CpusNodeExist;
//
// Ensure the Power State Coordination Interface (PSCI) SMCs are there if supported
@@ -448,6 +449,9 @@ PrepareFdt (
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 @@ PrepareFdt (
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.