Changeset 545 for GPL/trunk/drv32


Ignore:
Timestamp:
Mar 3, 2011, 8:43:04 PM (15 years ago)
Author:
David Azarewicz
Message:

Interrupt fixes

Location:
GPL/trunk/drv32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk/drv32/irq.cpp

    r518 r545  
    4747
    4848//******************************************************************************
    49 #ifdef ACPI
    50 //PS+++ fix description
    51 // Problem is in open high IRQ (acpi.psd /SMP /APIC) at boot time.
    52 // In my case - this IRQ use SATA and we have flood IRQ. This flood do
    53 // MASK this IRQ from kernel. Next danis506.add has very slow read from
    54 // disk.
    55 // How to fix.
    56 // At boot time (from DevInit to DevInitComplete) we use low IRQ. In
    57 // DevInitComplete we close low IRQ and open high IRQ. All values for
    58 // IRQ we are getting from ACPI call.
    59 
    60 //PS+++ Array with saving IRQ number
    61 #ifdef __cplusplus
    62 extern "C" {
    63 #endif
    64 struct SaveIRQForSlot
    65 {
    66     ULONG  ulSlotNo;
    67     BYTE   LowIRQ;
    68     BYTE   HighIRQ;
    69     BYTE   Pin;
    70 } sISRHigh[8];     //FIX me to MAX_DEVICES or same
    71 
    72 int  SaveIRQCounter = 0;       //PS+++ current position in array
    73 extern ULONG InitCompleteWas;  //PS+++ Indication of InitComplete call
    74 #ifdef __cplusplus
    75 }
    76 #endif
    77 
    78 #endif //ACPI
    79 //******************************************************************************
    8049BOOL ALSA_SetIrq(ULONG ulIrq, ULONG ulSlotNo, BOOL fShared)
    8150{
     
    10675        return FALSE;
    10776    }
    108 
    109 //PS+++ Begin
    110 #ifdef ACPI
    111     if (InitCompleteWas == 0)
    112     {
    113         dprintf(("RMSetIrq saved %d %d %x was %d", (ULONG)ulIrq, ulSlotNo,(ULONG)sISRHigh[SaveIRQCounter].LowIRQ));
    114         sISRHigh[SaveIRQCounter].ulSlotNo = ulSlotNo;
    115         ulIrq = sISRHigh[SaveIRQCounter].LowIRQ;
    116         SaveIRQCounter++;
    117     }
    118 
    119 #endif
    120 //PS End
    12177
    12278    return TRUE;
  • GPL/trunk/drv32/rmhelp.cpp

    r518 r545  
    149149//******************************************************************************
    150150//******************************************************************************
    151 //PS+++ see to irq.cpp
    152 #ifdef ACPI
    153 #ifdef __cplusplus
    154 extern "C" {
    155 #endif
    156 struct SaveIRQForSlot
    157 {
    158     ULONG  ulSlotNo;
    159     BYTE   LowIRQ;
    160     BYTE   HighIRQ;
    161     BYTE   Pin;
    162 };
    163 extern struct SaveIRQForSlot sISRHigh[];
    164 extern int  SaveIRQCounter;
    165 #ifdef __cplusplus
    166 }
    167 #endif
    168 #endif
    169 BOOL RMRequestIRQ(ULONG ulIrq, BOOL fShared)
    170 {
    171   RESOURCESTRUCT        Resource;
    172   HRESOURCE             hres;
    173   APIRET                rc;
    174 
    175   Resource.ResourceType          = RS_TYPE_IRQ;
    176 #ifdef ACPI  //PS+++
    177   Resource.IRQResource.PCIIrqPin = (USHORT)(sISRHigh[SaveIRQCounter].Pin & 0xf);
    178   if (sISRHigh[SaveIRQCounter].HighIRQ)
    179       Resource.IRQResource.IRQLevel  = (USHORT)sISRHigh[SaveIRQCounter].HighIRQ & 0xff;
    180   else
    181       Resource.IRQResource.IRQLevel  = (USHORT)ulIrq & 0xff;
    182 #else
    183   Resource.IRQResource.IRQLevel  = (USHORT)ulIrq & 0xff;
    184   Resource.IRQResource.PCIIrqPin = 0;
    185 #endif
    186   Resource.IRQResource.IRQFlags  = ( fShared ) ? RS_IRQ_SHARED : RS_IRQ_EXCLUSIVE;
    187 
    188   rc = RMAllocResource(DriverHandle,                    // Handle to driver.
    189                        FlatToSel((ULONG)&hres),         // OUT:  "allocated" resource node handle
     151BOOL RMRequestIRQ(ULONG ulIrq, BOOL fShared, PHRESOURCE phRes)
     152{
     153        RESOURCESTRUCT  Resource;
     154        HRESOURCE               hres;
     155        APIRET          rc;
     156
     157        Resource.ResourceType          = RS_TYPE_IRQ;
     158        Resource.IRQResource.IRQLevel  = (USHORT)ulIrq & 0xff;
     159        Resource.IRQResource.PCIIrqPin = 0;
     160        Resource.IRQResource.IRQFlags  = ( fShared ) ? RS_IRQ_SHARED : RS_IRQ_EXCLUSIVE;
     161
     162        rc = RMAllocResource(DriverHandle,                      // Handle to driver.
     163                       FlatToSel((ULONG)&hres),                 // OUT:  "allocated" resource node handle
    190164                       FlatToSel((ULONG)&Resource));    // Resource to allocate.
    191165
    192   if( rc == 0 && ctResHandles < MAX_RESHANDLES )
    193   {
    194     arResHandles[ctResHandles++] = hres;        return TRUE;
    195   }
    196 
    197   dprintf(("RMAllocResource[%d] IRQ rc = %d\n", ctResHandles, rc));
    198 
    199   return rc == 0;
     166        if (rc == 0) {
     167                if (ctResHandles < MAX_RESHANDLES ) arResHandles[ctResHandles++] = hres;
     168                *phRes = hres;
     169        }
     170
     171        dprintf(("RMAllocResource[%d] IRQ rc = %d\n", ctResHandles, rc));
     172
     173        return rc == 0;
     174}
     175
     176//******************************************************************************
     177//******************************************************************************
     178BOOL RMDeallocateIRQ(HRESOURCE hRes)
     179{
     180        ULONG ulI;
     181
     182        RMDeallocResource(DriverHandle, hRes);
     183
     184        for (ulI=0; ulI<ctResHandles; ulI++) {
     185                if (arResHandles[ulI] == hRes) {
     186                        arResHandles[ulI] = 0;
     187                        break;
     188                }               
     189        }
     190
     191        return 0;
    200192}
    201193
  • GPL/trunk/drv32/strategy.c

    r521 r545  
    3939
    4040ULONG DiscardableInit(RPInit __far*);
    41 
    4241ULONG deviceOwner = DEV_NO_OWNER;
    4342ULONG numOS2Opens = 0;
     
    7675// External initialization complete entry-point
    7776#ifdef ACPI
    78 // See desription in irq.cpp
    79 #include "irqos2.h"                             //PS+++
    80 #ifdef __cplusplus
    81 extern "C" {
    82 #endif
    83 ULONG InitCompleteWas = 0;                      //PS+++ Indication of InitComplete call
    84 struct SaveIRQForSlot
    85 {
    86         ULONG  ulSlotNo;
    87         BYTE   LowIRQ;
    88         BYTE   HighIRQ;
    89         BYTE   Pin;
    90 };
    91 extern struct SaveIRQForSlot sISRHigh[];
    92 extern int      SaveIRQCounter;
    93 #ifdef __cplusplus
    94 }
    95 #endif
     77#include "irqos2.h"
    9678#endif //ACPI
    9779//******************************************************************************
     
    10183{
    10284#ifdef ACPI
    103 //PS+++ Begin
    104         ULONG  i, rc = 0;
    105 
    106         InitCompleteWas = 1;
    107         for (i = 0; i < SaveIRQCounter; i++)
    108         {
    109                  dprintf(("Close IRQ%d - Open IRQ%d",(ULONG)sISRHigh[i].LowIRQ,(ULONG)sISRHigh[i].HighIRQ));
    110                  if (sISRHigh[i].HighIRQ)
    111                  {
    112                          ALSA_FreeIrq(sISRHigh[i].LowIRQ);
    113                          if (!ALSA_SetIrq(sISRHigh[i].HighIRQ, sISRHigh[i].ulSlotNo, 1))
    114                          {
    115                                  return (RPERR_COMMAND | RPDONE);
    116                          }
    117                  }
    118         }
     85        PciAdjustInterrupts();
    11986#endif
    120 //PS++ End
    12187        //dprintf(("StratInitComplete"));
    12288        return(RPDONE);
Note: See TracChangeset for help on using the changeset viewer.