Index: kernel/generic/include/ddi/irq.h
===================================================================
--- kernel/generic/include/ddi/irq.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/ddi/irq.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -37,8 +37,7 @@
 
 #include <arch/types.h>
+#include <typedefs.h>
 #include <adt/list.h>
-#include <ipc/ipc.h>
 #include <ipc/irq.h>
-#include <atomic.h>
 #include <synch/spinlock.h>
 
@@ -52,6 +51,4 @@
 	IRQ_TRIGGER_EDGE
 } irq_trigger_t;
-
-typedef struct irq irq_t;
 
 typedef void (* irq_handler_t)(irq_t *irq, void *arg, ...);
@@ -88,13 +85,6 @@
 	void *arg;
 
-	/** Answerbox of the task that wanted to be notified. */
-	answerbox_t *notif_answerbox;
-	/** Pseudo-code to be performed by the top-half
-	 *  before a notification is sent. */
-	irq_code_t *code;
-	/** Method of the notification. */
-	unative_t method;
-	/** Counter of IRQ notifications. */
-	atomic_t counter;
+	/** Notification configuration structure. */
+	ipc_notif_cfg_t notif_cfg; 
 };
 
Index: kernel/generic/include/ipc/ipc.h
===================================================================
--- kernel/generic/include/ipc/ipc.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/ipc/ipc.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -156,6 +156,5 @@
 #ifdef KERNEL
 
-#include <synch/mutex.h>
-#include <synch/condvar.h>
+#include <synch/waitq.h>
 #include <adt/list.h>
 
Index: kernel/generic/include/ipc/irq.h
===================================================================
--- kernel/generic/include/ipc/irq.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/ipc/irq.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -39,9 +39,6 @@
 #define IRQ_MAX_PROG_SIZE 10
 
-/** Reserved 'virtual' messages for kernel notifications */
-#define IPC_IRQ_RESERVED_VIRTUAL 10
-
-#define IPC_IRQ_KLOG       (-1)
-#define IPC_IRQ_KBDRESTART (-2)
+#define VIRT_INR_KLOG		-2
+#define VIRT_INR_KBDRESTART	-3
 
 typedef enum {
@@ -76,11 +73,24 @@
 
 #include <ipc/ipc.h>
+#include <typedefs.h>
+#include <arch/types.h>
 
-extern void ipc_irq_make_table(int irqcount);
-extern int ipc_irq_register(answerbox_t *box, int irq, irq_code_t *ucode);
-extern void ipc_irq_send_notif(int irq);
-extern void ipc_irq_send_msg(int irq, unative_t a1, unative_t a2, unative_t a3);
-extern void ipc_irq_unregister(answerbox_t *box, int irq);
-extern void irq_ipc_bind_arch(unative_t irq);
+/** IPC notification config structure.
+ *
+ * Primarily, this structure is encapsulated in the irq_t structure.
+ * It is protected by irq_t::lock.
+ */
+struct ipc_notif_cfg {
+	answerbox_t *answerbox;		/**< Answerbox for notifications. */
+	unative_t method;		/**< Method to be used for the notification. */
+	irq_code_t *code;		/**< Top-half pseudocode. */
+	count_t counter;		/**< Counter. */
+};
+
+extern int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method,
+	irq_code_t *ucode);
+extern void ipc_irq_send_notif(irq_t *irq);
+extern void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3);
+extern void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno);
 extern void ipc_irq_cleanup(answerbox_t *box);
 
Index: kernel/generic/include/ipc/sysipc.h
===================================================================
--- kernel/generic/include/ipc/sysipc.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/ipc/sysipc.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -39,4 +39,5 @@
 #include <ipc/irq.h>
 #include <arch/types.h>
+#include <typedefs.h>
 
 unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, 
@@ -54,6 +55,6 @@
 			      unative_t method, unative_t arg1);
 unative_t sys_ipc_hangup(int phoneid);
-unative_t sys_ipc_register_irq(int irq, irq_code_t *ucode);
-unative_t sys_ipc_unregister_irq(int irq);
+unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode);
+unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno);
 
 #endif
Index: kernel/generic/include/typedefs.h
===================================================================
--- kernel/generic/include/typedefs.h	(revision e3890b3fce4ad7f968cc0c569c3565b3df89e8c8)
+++ kernel/generic/include/typedefs.h	(revision 2b017ba3f7b12c023121e41aca02b7d6bf2bdade)
@@ -98,4 +98,6 @@
 typedef signed int inr_t;
 typedef signed int devno_t;
+typedef struct irq irq_t;
+typedef struct ipc_notif_cfg ipc_notif_cfg_t;
 
 #endif
