From 79d3090766a1cb87d0d619cd59efb5c3048d1c68 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 23 May 2024 15:03:45 -0400 Subject: kernel/amd64: isa: Add i8042 IRQ stat Signed-off-by: Ian Moffett --- sys/arch/amd64/isa/i8042.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sys/arch') diff --git a/sys/arch/amd64/isa/i8042.c b/sys/arch/amd64/isa/i8042.c index 41b74ef..8c790ec 100644 --- a/sys/arch/amd64/isa/i8042.c +++ b/sys/arch/amd64/isa/i8042.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,7 @@ static struct spinlock data_lock; static bool shift_key = false; static bool capslock = false; static bool capslock_released = true; +static struct intr_info *irq_info; static int dev_send(bool aux, uint8_t data); @@ -230,6 +232,10 @@ kb_isr(void *sf) uint8_t data; char c; + spinlock_acquire(&irq_info->lock); + ++irq_info->count; + spinlock_release(&irq_info->lock); + spinlock_acquire(&data_lock); while (__TEST(inb(I8042_STATUS), I8042_OBUF_FULL)) { data = inb(I8042_DATA); @@ -264,6 +270,11 @@ i8042_init(void) ioapic_set_vec(1, SYSVEC_PCKBD); ioapic_irq_unmask(1); + /* Register the interrupt */ + irq_info = intr_info_alloc("IOAPIC", "i8042"); + irq_info->affinity = 0; + intr_register(irq_info); + /* Setup config bits */ conf = i8042_read_conf(); conf |= I8042_PORT0_INTR; -- cgit v1.2.3