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>
diff --git a/src/arch/x86/ioapic.c b/src/arch/x86/ioapic.c
index c148534..dc88de1 100644
--- a/src/arch/x86/ioapic.c
+++ b/src/arch/x86/ioapic.c
@@ -109,6 +109,16 @@
 
 }
 
+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)
 {