summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-23 15:03:45 -0400
committerIan Moffett <ian@osmora.org>2024-05-23 15:03:45 -0400
commit79d3090766a1cb87d0d619cd59efb5c3048d1c68 (patch)
treed5e98885734143c0af75e6ed52b93492524a5d24
parentced1752cf7cb45610ccfbecaa3c5fa77aa156f57 (diff)
kernel/amd64: isa: Add i8042 IRQ stat
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/arch/amd64/isa/i8042.c11
1 files changed, 11 insertions, 0 deletions
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 <sys/errno.h>
#include <sys/spinlock.h>
#include <sys/tty.h>
+#include <sys/intr.h>
#include <machine/ioapic.h>
#include <machine/idt.h>
#include <machine/io.h>
@@ -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;