Topics

[edk2-platforms PATCH v4 4/4] Silicon/Qemu: Don't re-use NumCores as loop index in AddMadtTable


Rebecca Cran
 

Avoid re-using the NumCores variable as a loop index, in AddMadtTable:
add a new CoreIndex variable for that purpose.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
---
Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
index 037c7cff4c18..84120f1c1b51 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
@@ -88,6 +88,7 @@ AddMadtTable (
EFI_PHYSICAL_ADDRESS PageAddress;
UINT8 *New;
UINT32 NumCores;
+ UINT32 CoreIndex;

// Initialize MADT ACPI Header
EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header = {
@@ -152,13 +153,13 @@ AddMadtTable (
New += sizeof (EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER);

// Add new GICC structures for the Cores
- for (NumCores = 0; NumCores < PcdGet32 (PcdCoreCount); NumCores++) {
+ for (CoreIndex = 0; CoreIndex < PcdGet32 (PcdCoreCount); CoreIndex++) {
EFI_ACPI_6_0_GIC_STRUCTURE *GiccPtr;

CopyMem (New, &Gicc, sizeof (EFI_ACPI_6_0_GIC_STRUCTURE));
GiccPtr = (EFI_ACPI_6_0_GIC_STRUCTURE *) New;
- GiccPtr->AcpiProcessorUid = NumCores;
- GiccPtr->MPIDR = GetMpidr (NumCores);
+ GiccPtr->AcpiProcessorUid = CoreIndex;
+ GiccPtr->MPIDR = GetMpidr (CoreIndex);
New += sizeof (EFI_ACPI_6_0_GIC_STRUCTURE);
}

--
2.26.2