soc/intel/xeon_sp: Tidy up adding MADT ioapic entries

Add a helper function to print out debug info and add the MADT entry.

Change-Id: I1a00f87c6edef530c5352929ee9279782be4b112
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47299
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Marc Jones <marc@marcjonesconsulting.com>
This commit is contained in:
Arthur Heymans 2020-11-06 12:25:28 +01:00 committed by Philipp Deppenwiese
parent 88c16f6ee7
commit c7eebacbeb
1 changed files with 14 additions and 13 deletions

View File

@ -73,6 +73,16 @@ static unsigned long acpi_madt_irq_overrides(unsigned long current)
return current;
}
static unsigned long add_madt_ioapic(unsigned long current, int stack, int ioapic_id,
uint32_t ioapic_base, int gsi_base)
{
printk(BIOS_DEBUG, "Adding MADT IOAPIC for stack: %d, ioapic_id: 0x%x, "
"ioapic_base: 0x%x, gsi_base: 0x%x\n",
stack, ioapic_id, ioapic_base, gsi_base);
return acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, ioapic_id,
ioapic_base, gsi_base);
}
unsigned long acpi_fill_madt(unsigned long current)
{
int cur_index;
@ -100,12 +110,8 @@ unsigned long acpi_fill_madt(unsigned long current)
assert(cur_index < ARRAY_SIZE(gsi_bases));
int ioapic_id = ioapic_ids[cur_index];
int gsi_base = gsi_bases[cur_index];
printk(BIOS_DEBUG, "Adding MADT IOAPIC for stack: %d, ioapic_id: 0x%x, "
"ioapic_base: 0x%x, gsi_base: 0x%x\n",
stack, ioapic_id, ri->IoApicBase, gsi_base);
current += acpi_create_madt_ioapic(
(acpi_madt_ioapic_t *)current,
ioapic_id, ri->IoApicBase, gsi_base);
current += add_madt_ioapic(current, stack, ioapic_id, ri->IoApicBase,
gsi_base);
++cur_index;
/*
@ -117,13 +123,8 @@ unsigned long acpi_fill_madt(unsigned long current)
assert(cur_index < ARRAY_SIZE(gsi_bases));
ioapic_id = ioapic_ids[cur_index];
gsi_base = gsi_bases[cur_index];
printk(BIOS_DEBUG, "Adding MADT IOAPIC for stack: %d, ioapic_id: 0x%x, "
"ioapic_base: 0x%x, gsi_base: 0x%x\n",
stack, ioapic_id,
current += add_madt_ioapic(current, stack, ioapic_id,
ri->IoApicBase + 0x1000, gsi_base);
current += acpi_create_madt_ioapic(
(acpi_madt_ioapic_t *)current,
ioapic_id, ri->IoApicBase + 0x1000, gsi_base);
++cur_index;
}
}