arch/x86: Add register_new_ioapic()

Using this I/O APIC IDs will be assigned incrementally
in the order of calling. I/O APIC ID #0 is reserved for
the I/O APIC delivering GSI #0.

Change-Id: I6493dc3b4fa542e81f80bb0355eac6dad30b93ec
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55313
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Kyösti Mälkki 2021-06-08 11:28:25 +03:00
parent c7da027e75
commit 0ea8f89e40
2 changed files with 15 additions and 0 deletions

View File

@ -37,6 +37,8 @@ void ioapic_set_max_vectors(void *ioapic_base, int mre_count);
void ioapic_lock_max_vectors(void *ioapic_base);
void setup_ioapic(void *ioapic_base, u8 ioapic_id);
void register_new_ioapic(void *ioapic_base);
void register_new_ioapic_gsi0(void *ioapic_base);
void ioapic_set_boot_config(void *ioapic_base, bool irq_on_fsb);
#endif

View File

@ -163,3 +163,16 @@ void setup_ioapic(void *ioapic_base, u8 ioapic_id)
clear_vectors(ioapic_base, 0, ioapic_get_max_vectors(ioapic_base) - 1);
route_i8259_irq0(ioapic_base);
}
void register_new_ioapic_gsi0(void *ioapic_base)
{
setup_ioapic(ioapic_base, 0);
}
void register_new_ioapic(void *ioapic_base)
{
static u8 ioapic_id;
ioapic_id++;
set_ioapic_id(ioapic_base, ioapic_id);
clear_vectors(ioapic_base, 0, ioapic_get_max_vectors(ioapic_base) - 1);
}