Index: trunk/src/os2ahci/Makefile
===================================================================
--- trunk/src/os2ahci/Makefile	(revision 186)
+++ trunk/src/os2ahci/Makefile	(revision 188)
@@ -12,5 +12,5 @@
 # Define default build version if not specified in environment
 BLD_MAJOR=2
-BLD_MINOR=01 # must be 2 digits
+BLD_MINOR=02 # must be 2 digits
 BLD_REV=0 # not used at this time
 
Index: trunk/src/os2ahci/ahci.c
===================================================================
--- trunk/src/os2ahci/ahci.c	(revision 186)
+++ trunk/src/os2ahci/ahci.c	(revision 188)
@@ -79,49 +79,9 @@
 };
 
-/* IRQ levels for stub interrupt handlers. OS/2 calls interrupt handlers
- * without passing the IRQ level, yet it expects the interrupt handler to
- * know the IRQ level for EOI processing. Thus we need multiple interrupt
- * handlers, one for each IRQ, and some mapping from the interrupt handler
- * index to the corresponding IRQ.
- */
-static u16 irq_map[MAX_AD];   /* IRQ level for each stub IRQ func */
-static int irq_map_cnt;       /* number of IRQ stub funcs used */
+#define MAX_IRQ_HANDLERS 8 /* This is the maximum number of handlers that Dev32Help_SetIRQ can register */
+static u16 irq_used[MAX_IRQ_HANDLERS]; /* IRQ level for each used IRQ */
+static int irq_used_cnt; /* number of IRQs used */
 
 /* ----------------------------- start of code ----------------------------- */
-
-/******************************************************************************
- * Interrupt handlers. Those are stubs which call the real interrupt handler
- * with the IRQ level as parameter. This mapping is required because OS/2
- * calls interrupt handlers without any parameters, yet expects them to know
- * which IRQ level to complete when calling DevHelp_EOI().
- *
- * This array of functions needs to be extended when increasing MAX_AD.
- */
-#if MAX_AD > 8
-#error must extend irq_handler_xx and irq_handlers[] when increasing MAX_AD
-#endif
-
-/* Macro to call AHCI interrupt handler and set/clear carry flag accordingly.
- * We need to set the carry flag if the interrupt was not handled. This is
- * done by shifting the return value of ahci_intr() to the right, implying
- * bit 0 will be set when the interrupt was not handled.
- */
-#define call_ahci_intr(i)   return(ahci_intr(irq_map[i]))
-
-static USHORT _cdecl irq_handler_00(void)  { call_ahci_intr(0); }
-static USHORT _cdecl irq_handler_01(void)  { call_ahci_intr(1); }
-static USHORT _cdecl irq_handler_02(void)  { call_ahci_intr(2); }
-static USHORT _cdecl irq_handler_03(void)  { call_ahci_intr(3); }
-static USHORT _cdecl irq_handler_04(void)  { call_ahci_intr(4); }
-static USHORT _cdecl irq_handler_05(void)  { call_ahci_intr(5); }
-static USHORT _cdecl irq_handler_06(void)  { call_ahci_intr(6); }
-static USHORT _cdecl irq_handler_07(void)  { call_ahci_intr(7); }
-
-PFN irq_handlers[] =
-{
-  (PFN) irq_handler_00, (PFN) irq_handler_01, (PFN) irq_handler_02,
-  (PFN) irq_handler_03, (PFN) irq_handler_04, (PFN) irq_handler_05,
-  (PFN) irq_handler_06, (PFN) irq_handler_07
-};
 
 #ifdef DEBUG
@@ -702,21 +662,22 @@
 
   /* register IRQ handlers; each IRQ level is registered only once */
-  for (i = 0; i < irq_map_cnt; i++)
-  {
-    if (irq_map[i] == ai->irq) break; /* we already have this IRQ registered */
-  }
-  if (i >= irq_map_cnt)
-  {
+  for (i = 0; i < irq_used_cnt; i++)
+  {
+    if (irq_used[i] == ai->irq) break; /* we already have this IRQ registered */
+  }
+  if (i >= irq_used_cnt)
+  {
+    if (i >= MAX_IRQ_HANDLERS) return -1; /* no more handlers available */
     DPRINTF(2,"registering interrupt #%d\n", ai->irq);
-    if (Dev32Help_SetIRQ(irq_handlers[irq_map_cnt], ai->irq, 1) != 0)
+    if (Dev32Help_SetIRQ(ahci_intr, ai->irq, 1, ai->irq) != 0)
     {
       DPRINTF(0,"failed to register shared interrupt\n");
-      if (Dev32Help_SetIRQ(irq_handlers[irq_map_cnt], ai->irq, 0) != 0)
+      if (Dev32Help_SetIRQ(ahci_intr, ai->irq, 0, ai->irq) != 0)
       {
-        dprintf(0,"failed to register exclusive interrupt\n");
+        dprintf(0,"failed to register interrupt %d\n", ai->irq);
         return(-1);
       }
     }
-    irq_map[irq_map_cnt++] = ai->irq;
+    irq_used[irq_used_cnt++] = ai->irq;
   }
 
@@ -1434,4 +1395,5 @@
  * queues, ...)
  */
+#pragma aux ahci_intr parm [eax]
 int ahci_intr(u16 irq)
 {
Index: trunk/src/os2ahci/ata.c
===================================================================
--- trunk/src/os2ahci/ata.c	(revision 186)
+++ trunk/src/os2ahci/ata.c	(revision 188)
@@ -286,4 +286,5 @@
   cmd_hdr->options |= n << 16;
 
+  #ifdef DEBUG
   if ((D32g_DbgLevel >= 7) || (atapi_cmd != NULL))
   {
@@ -300,4 +301,5 @@
     }
   }
+  #endif
 
   return(ATA_CMD_SUCCESS);
Index: trunk/src/os2ahci/pci.c
===================================================================
--- trunk/src/os2ahci/pci.c	(revision 186)
+++ trunk/src/os2ahci/pci.c	(revision 188)
@@ -535,4 +535,6 @@
    */
 
+  ciprintf("Adapter %d PCI=%d:%d:%d ID=%04x:%04x\n", ad_info_cnt, PCI_BUS_FROM_BDF(BusDevFunc),
+    PCI_DEV_FROM_BDF(BusDevFunc), PCI_FUNC_FROM_BDF(BusDevFunc), vendor, device);
   DPRINTF(1,"Adapter %d PCI=%d:%d:%d ID=%04x:%04x\n", ad_info_cnt, PCI_BUS_FROM_BDF(BusDevFunc),
     PCI_DEV_FROM_BDF(BusDevFunc), PCI_FUNC_FROM_BDF(BusDevFunc), vendor, device);
