make irq specifier to be provided when assigining irq
[lunaix-os.git] / lunaix-os / arch / x86 / hal / ps2kbd.c
index ee4a67e0f99855acb884cd8fc5b87fe386ddcea6..1df42bdb59ec0af1a1f4e34ebd39216241612227 100644 (file)
@@ -6,12 +6,13 @@
 #include <lunaix/timer.h>
 #include <lunaix/hart_state.h>
 
+#include <hal/irq.h>
+
 #include "asm/x86.h"
 
 #include <klibc/string.h>
 
 #include "asm/x86_cpu.h"
-#include <asm/x86_isrm.h>
 #include <asm/x86_pmio.h>
 
 #define PS2_PORT_ENC_DATA 0x60
@@ -189,7 +190,7 @@ static struct input_device* kbd_idev;
 // #define KBD_DBGLOG
 
 static void
-intr_ps2_kbd_handler(const struct hart_state* hstate);
+intr_ps2_kbd_handler(irq_t irq, const struct hart_state* hstate);
 
 static u8_t
 ps2_issue_cmd_wretry(char cmd, u16_t arg);
@@ -309,7 +310,9 @@ ps2_kbd_create(struct device_def* devdef, morph_t* obj)
      *
      *  所以,保险的方法是:在初始化后才去设置ioapic,这样一来我们就能有一个稳定的IRQ#1以放心使用。
      */
-    isrm_bindirq(PC_AT_IRQ_KBD, intr_ps2_kbd_handler);
+    
+    irq_t irq = irq_declare_line(intr_ps2_kbd_handler, PC_AT_IRQ_KBD);    
+    irq_assign(irq_owning_domain(kbd_idev->dev_if), irq, NULL);
 
     return 0;
 
@@ -401,7 +404,7 @@ kbd_buffer_key_event(kbd_keycode_t key, u8_t scancode, kbd_kstate_t state)
 }
 
 static void
-intr_ps2_kbd_handler(const struct hart_state* hstate)
+intr_ps2_kbd_handler(irq_t irq, const struct hart_state* hstate)
 {
 
     // This is important! Don't believe me? try comment it out and run on Bochs!