diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-06-06 08:27:15 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-06-12 15:48:49 +0000 |
commit | 401ec98e067985431e8e263f7eecef31348d785c (patch) | |
tree | 6a03ac19a3dd34ddfc7d8ecc2e9d55602115a0c3 /src/arch | |
parent | 8997e7b5aec28b00d9ac15922d451d60b6188325 (diff) |
arch/x86/ioapic: Add get_ioapic_id() and get_ioapic_version()
Change-Id: I4ad080653c9af94a4dc73d93ddc4c8c117a682b9
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55282
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/include/arch/ioapic.h | 2 | ||||
-rw-r--r-- | src/arch/x86/ioapic.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/arch/x86/include/arch/ioapic.h b/src/arch/x86/include/arch/ioapic.h index bdbcfbf415..839dba4977 100644 --- a/src/arch/x86/include/arch/ioapic.h +++ b/src/arch/x86/include/arch/ioapic.h @@ -29,6 +29,8 @@ u32 io_apic_read(void *ioapic_base, u32 reg); void io_apic_write(void *ioapic_base, u32 reg, u32 value); void set_ioapic_id(void *ioapic_base, u8 ioapic_id); +u8 get_ioapic_id(void *ioapic_base); +u8 get_ioapic_version(void *ioapic_base); void setup_ioapic(void *ioapic_base, u8 ioapic_id); void clear_ioapic(void *ioapic_base); diff --git a/src/arch/x86/ioapic.c b/src/arch/x86/ioapic.c index c148534351..dc88de1a8e 100644 --- a/src/arch/x86/ioapic.c +++ b/src/arch/x86/ioapic.c @@ -109,6 +109,16 @@ void set_ioapic_id(void *ioapic_base, u8 ioapic_id) } +u8 get_ioapic_id(void *ioapic_base) +{ + return (io_apic_read(ioapic_base, 0x00) >> 24) & 0x0f; +} + +u8 get_ioapic_version(void *ioapic_base) +{ + return io_apic_read(ioapic_base, 0x01) & 0xff; +} + void setup_ioapic_helper(void *ioapic_base, u8 ioapic_id, bool irq_on_fsb, bool enable_virtual_wire) { |