diff --git a/src/arch/x86/include/arch/smp/mpspec.h b/src/arch/x86/include/arch/smp/mpspec.h index 198d7df4aa..a51399347a 100644 --- a/src/arch/x86/include/arch/smp/mpspec.h +++ b/src/arch/x86/include/arch/smp/mpspec.h @@ -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); diff --git a/src/arch/x86/mpspec.c b/src/arch/x86/mpspec.c index fa29e800c3..ba0c4f70ee 100644 --- a/src/arch/x86/mpspec.c +++ b/src/arch/x86/mpspec.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -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,