soc/intel/xeon_sp: Read ioapic configuration from hardware

This is more robust than hardcoding whathever FSP has set up and is a
lot less code.

Change-Id: I6423ddc139d742879d791b054ea082768749c0a7
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70265
Reviewed-by: Jonathan Zhang <jonzhang@fb.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans
2022-12-02 12:42:27 +01:00
committed by Felix Held
parent 8a979d92c9
commit 8a3e2b8364
5 changed files with 27 additions and 79 deletions

View File

@@ -73,34 +73,26 @@ static unsigned long acpi_madt_irq_overrides(unsigned long current)
return current;
}
__weak const struct madt_ioapic_info *soc_get_ioapic_info(size_t *entries)
static const uintptr_t default_ioapic_bases[] = { IO_APIC_ADDR };
__weak size_t soc_get_ioapic_info(const uintptr_t *ioapic_bases[])
{
*entries = 0;
return NULL;
*ioapic_bases = default_ioapic_bases;
return ARRAY_SIZE(default_ioapic_bases);
}
unsigned long acpi_fill_madt(unsigned long current)
{
const struct madt_ioapic_info *ioapic_table;
const uintptr_t *ioapic_table;
size_t ioapic_entries;
/* Local APICs */
current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */
ioapic_table = soc_get_ioapic_info(&ioapic_entries);
if (ioapic_entries) {
for (int i = 0; i < ioapic_entries; i++) {
current += acpi_create_madt_ioapic(
(void *)current,
ioapic_table[i].id,
ioapic_table[i].addr,
ioapic_table[i].gsi_base);
}
} else {
/* Default SOC IOAPIC entry */
current += acpi_create_madt_ioapic_from_hw((void *)current, IO_APIC_ADDR);
}
ioapic_entries = soc_get_ioapic_info(&ioapic_table);
for (int i = 0; i < ioapic_entries; i++)
current += acpi_create_madt_ioapic_from_hw((void *)current, ioapic_table[i]);
return acpi_madt_irq_overrides(current);
}

View File

@@ -93,17 +93,11 @@ void soc_power_states_generation(int core_id, int cores_per_package);
*/
int common_calculate_power_ratio(int tdp, int p1_ratio, int ratio);
struct madt_ioapic_info {
u8 id;
u32 addr;
u32 gsi_base;
};
/*
* Returns a table of MADT ioapic_info entries and the number of entries
* If the SOC doesn't implement this hook a default ioapic setting is used.
* Return the number of table entries and takes a pointer to an array of ioapic bases.
*/
const struct madt_ioapic_info *soc_get_ioapic_info(size_t *entries);
size_t soc_get_ioapic_info(const uintptr_t *ioapic_bases[]);
struct soc_pmc_lpm {
unsigned int num_substates;