Changeset 188 for trunk


Ignore:
Timestamp:
Jun 8, 2017, 3:02:10 AM (8 years ago)
Author:
David Azarewicz
Message:

Fixed interrupt problem.

Location:
trunk/src/os2ahci
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/Makefile

    r186 r188  
    1212# Define default build version if not specified in environment
    1313BLD_MAJOR=2
    14 BLD_MINOR=01 # must be 2 digits
     14BLD_MINOR=02 # must be 2 digits
    1515BLD_REV=0 # not used at this time
    1616
  • trunk/src/os2ahci/ahci.c

    r185 r188  
    7979};
    8080
    81 /* IRQ levels for stub interrupt handlers. OS/2 calls interrupt handlers
    82  * without passing the IRQ level, yet it expects the interrupt handler to
    83  * know the IRQ level for EOI processing. Thus we need multiple interrupt
    84  * handlers, one for each IRQ, and some mapping from the interrupt handler
    85  * index to the corresponding IRQ.
    86  */
    87 static u16 irq_map[MAX_AD];   /* IRQ level for each stub IRQ func */
    88 static int irq_map_cnt;       /* number of IRQ stub funcs used */
     81#define MAX_IRQ_HANDLERS 8 /* This is the maximum number of handlers that Dev32Help_SetIRQ can register */
     82static u16 irq_used[MAX_IRQ_HANDLERS]; /* IRQ level for each used IRQ */
     83static int irq_used_cnt; /* number of IRQs used */
    8984
    9085/* ----------------------------- start of code ----------------------------- */
    91 
    92 /******************************************************************************
    93  * Interrupt handlers. Those are stubs which call the real interrupt handler
    94  * with the IRQ level as parameter. This mapping is required because OS/2
    95  * calls interrupt handlers without any parameters, yet expects them to know
    96  * which IRQ level to complete when calling DevHelp_EOI().
    97  *
    98  * This array of functions needs to be extended when increasing MAX_AD.
    99  */
    100 #if MAX_AD > 8
    101 #error must extend irq_handler_xx and irq_handlers[] when increasing MAX_AD
    102 #endif
    103 
    104 /* Macro to call AHCI interrupt handler and set/clear carry flag accordingly.
    105  * We need to set the carry flag if the interrupt was not handled. This is
    106  * done by shifting the return value of ahci_intr() to the right, implying
    107  * bit 0 will be set when the interrupt was not handled.
    108  */
    109 #define call_ahci_intr(i)   return(ahci_intr(irq_map[i]))
    110 
    111 static USHORT _cdecl irq_handler_00(void)  { call_ahci_intr(0); }
    112 static USHORT _cdecl irq_handler_01(void)  { call_ahci_intr(1); }
    113 static USHORT _cdecl irq_handler_02(void)  { call_ahci_intr(2); }
    114 static USHORT _cdecl irq_handler_03(void)  { call_ahci_intr(3); }
    115 static USHORT _cdecl irq_handler_04(void)  { call_ahci_intr(4); }
    116 static USHORT _cdecl irq_handler_05(void)  { call_ahci_intr(5); }
    117 static USHORT _cdecl irq_handler_06(void)  { call_ahci_intr(6); }
    118 static USHORT _cdecl irq_handler_07(void)  { call_ahci_intr(7); }
    119 
    120 PFN irq_handlers[] =
    121 {
    122   (PFN) irq_handler_00, (PFN) irq_handler_01, (PFN) irq_handler_02,
    123   (PFN) irq_handler_03, (PFN) irq_handler_04, (PFN) irq_handler_05,
    124   (PFN) irq_handler_06, (PFN) irq_handler_07
    125 };
    12686
    12787#ifdef DEBUG
     
    702662
    703663  /* register IRQ handlers; each IRQ level is registered only once */
    704   for (i = 0; i < irq_map_cnt; i++)
    705   {
    706     if (irq_map[i] == ai->irq) break; /* we already have this IRQ registered */
    707   }
    708   if (i >= irq_map_cnt)
    709   {
     664  for (i = 0; i < irq_used_cnt; i++)
     665  {
     666    if (irq_used[i] == ai->irq) break; /* we already have this IRQ registered */
     667  }
     668  if (i >= irq_used_cnt)
     669  {
     670    if (i >= MAX_IRQ_HANDLERS) return -1; /* no more handlers available */
    710671    DPRINTF(2,"registering interrupt #%d\n", ai->irq);
    711     if (Dev32Help_SetIRQ(irq_handlers[irq_map_cnt], ai->irq, 1) != 0)
     672    if (Dev32Help_SetIRQ(ahci_intr, ai->irq, 1, ai->irq) != 0)
    712673    {
    713674      DPRINTF(0,"failed to register shared interrupt\n");
    714       if (Dev32Help_SetIRQ(irq_handlers[irq_map_cnt], ai->irq, 0) != 0)
     675      if (Dev32Help_SetIRQ(ahci_intr, ai->irq, 0, ai->irq) != 0)
    715676      {
    716         dprintf(0,"failed to register exclusive interrupt\n");
     677        dprintf(0,"failed to register interrupt %d\n", ai->irq);
    717678        return(-1);
    718679      }
    719680    }
    720     irq_map[irq_map_cnt++] = ai->irq;
     681    irq_used[irq_used_cnt++] = ai->irq;
    721682  }
    722683
     
    14341395 * queues, ...)
    14351396 */
     1397#pragma aux ahci_intr parm [eax]
    14361398int ahci_intr(u16 irq)
    14371399{
  • trunk/src/os2ahci/ata.c

    r186 r188  
    286286  cmd_hdr->options |= n << 16;
    287287
     288  #ifdef DEBUG
    288289  if ((D32g_DbgLevel >= 7) || (atapi_cmd != NULL))
    289290  {
     
    300301    }
    301302  }
     303  #endif
    302304
    303305  return(ATA_CMD_SUCCESS);
  • trunk/src/os2ahci/pci.c

    r185 r188  
    535535   */
    536536
     537  ciprintf("Adapter %d PCI=%d:%d:%d ID=%04x:%04x\n", ad_info_cnt, PCI_BUS_FROM_BDF(BusDevFunc),
     538    PCI_DEV_FROM_BDF(BusDevFunc), PCI_FUNC_FROM_BDF(BusDevFunc), vendor, device);
    537539  DPRINTF(1,"Adapter %d PCI=%d:%d:%d ID=%04x:%04x\n", ad_info_cnt, PCI_BUS_FROM_BDF(BusDevFunc),
    538540    PCI_DEV_FROM_BDF(BusDevFunc), PCI_FUNC_FROM_BDF(BusDevFunc), vendor, device);
Note: See TracChangeset for help on using the changeset viewer.