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
This commit is contained in:
oliviermartin 2013-04-14 09:33:35 +00:00
parent 72647f1901
commit 3809e6e071
1 changed files with 11 additions and 3 deletions

View File

@ -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.