arch/x86/mptable: Add smp_write_ioapic_from_hw()

Add variant that reads I/O APIC ID and version from
hardware registers.

Change-Id: I01bec5f40c6ea60446a28767c7a1725dc25d0ae3
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55283
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Kyösti Mälkki 2021-06-07 23:00:00 +03:00
parent 401ec98e06
commit 06b2049ab6
2 changed files with 13 additions and 0 deletions

View File

@ -235,6 +235,10 @@ void smp_write_processor(struct mp_config_table *mc,
void smp_write_processors(struct mp_config_table *mc);
void smp_write_ioapic(struct mp_config_table *mc,
u8 id, u8 ver, void *apicaddr);
/* Call smp_write_ioapic() and return IOAPIC ID field. */
u8 smp_write_ioapic_from_hw(struct mp_config_table *mc, void *apicaddr);
void smp_write_intsrc(struct mp_config_table *mc,
u8 irqtype, u16 irqflag, u8 srcbus, u8 srcbusirq,
u8 dstapic, u8 dstirq);

View File

@ -3,6 +3,7 @@
#include <console/console.h>
#include <device/path.h>
#include <device/pci_ids.h>
#include <arch/ioapic.h>
#include <arch/smp/mpspec.h>
#include <string.h>
#include <arch/cpu.h>
@ -221,6 +222,14 @@ void smp_write_ioapic(struct mp_config_table *mc,
smp_add_mpc_entry(mc, sizeof(*mpc));
}
u8 smp_write_ioapic_from_hw(struct mp_config_table *mc, void *apicaddr)
{
u8 id = get_ioapic_id(apicaddr);
u8 ver = get_ioapic_version(apicaddr);
smp_write_ioapic(mc, id, ver, apicaddr);
return id;
}
/*
* Type 3: I/O Interrupt Table Entries:
* Entry Type, Int Type, Int Polarity, Int Level,