From 6aaaa53128926b42f63d4ef4861a16082d1c93db Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 28 Apr 2024 23:28:54 -0400 Subject: kernel/amd64: ioapic: Add ioapic_set_vec() Add helper to set vector in a redirection table entry Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/ioapic.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sys/arch') diff --git a/sys/arch/amd64/amd64/ioapic.c b/sys/arch/amd64/amd64/ioapic.c index b4d5f51..ffc732d 100644 --- a/sys/arch/amd64/amd64/ioapic.c +++ b/sys/arch/amd64/amd64/ioapic.c @@ -167,6 +167,17 @@ ioapic_set_base(void *mmio_base) ioapic_base = mmio_base; } +void +ioapic_set_vec(uint8_t irq, uint8_t vector) +{ + union ioapic_redentry redentry; + uint8_t gsi = irq_to_gsi(irq); + + ioapic_read_redentry(&redentry, gsi); + redentry.vector = vector; + ioapic_write_redentry(&redentry, gsi); +} + void ioapic_init(void) { -- cgit v1.2.3