Changeset 421


Ignore:
Timestamp:
Mar 23, 2009, 9:13:00 AM (16 years ago)
Author:
Paul Smedley
Message:

Updates from Pasha to improve IRQ handling and resolve long delays at startup in APIC mode when using ACPI

Location:
GPL/branches/uniaud32-2.0
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-2.0/drv32/irq.cpp

    r375 r421  
    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
     62extern "C" {
     63#endif
     64struct 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
     72int  SaveIRQCounter = 0;       //PS+++ current position in array
     73extern ULONG InitCompleteWas;  //PS+++ Indication of InitComplete call
     74#ifdef __cplusplus
     75}
     76#endif
     77
     78#endif //ACPI
    4979//******************************************************************************
    5080BOOL ALSA_SetIrq(ULONG ulIrq, ULONG ulSlotNo, BOOL fShared)
     
    6595
    6696    if (rc != 0) {                    // If error ...
    67         dprintf(("ERROR: RMSetIrq %d %d %x - failed to set shared - trying exclusive!!", ulIrq, fShared, ulSlotNo));
     97       dprintf(("ERROR: RMSetIrq %d %d %x - failed to set shared - trying exclusive!!", ulIrq, fShared, ulSlotNo));
    6898        rc = DevIRQSet((WORD16) *pISR[ulSlotNo],
    6999                       (WORD16)ulIrq,
     
    76106        return FALSE;
    77107    }
     108//PS+++ Begin
     109#ifdef ACPI
     110    if (InitCompleteWas == 0)
     111    {
     112        dprintf(("RMSetIrq saved %d %d %x was %d", (ULONG)ulIrq, ulSlotNo,(ULONG)sISRHigh[SaveIRQCounter].LowIRQ));
     113        sISRHigh[SaveIRQCounter].ulSlotNo = ulSlotNo;
     114        SaveIRQCounter++;
     115        return TRUE;
     116    }
     117#endif
     118//PS End
    78119
    79120    return TRUE;
  • GPL/branches/uniaud32-2.0/drv32/rmhelp.cpp

    r352 r421  
    149149//******************************************************************************
    150150//******************************************************************************
     151//PS+++ see to irq.cpp
     152#ifdef ACPI
     153#ifdef __cplusplus
     154extern "C" {
     155#endif
     156struct SaveIRQForSlot
     157{
     158    ULONG  ulSlotNo;
     159    BYTE   LowIRQ;
     160    BYTE   HighIRQ;
     161    BYTE   Pin;   
     162};
     163extern struct SaveIRQForSlot sISRHigh[];
     164extern int  SaveIRQCounter;
     165#ifdef __cplusplus
     166}
     167#endif
     168#endif
    151169BOOL RMRequestIRQ(ULONG ulIrq, BOOL fShared)
    152170{
     
    156174
    157175  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
    158183  Resource.IRQResource.IRQLevel  = (USHORT)ulIrq & 0xff;
     184  Resource.IRQResource.PCIIrqPin = 0;
     185#endif
    159186  Resource.IRQResource.IRQFlags  = ( fShared ) ? RS_IRQ_SHARED : RS_IRQ_EXCLUSIVE;
    160   Resource.IRQResource.PCIIrqPin = (USHORT)( (ulIrq >> 8) & 0xf);
    161187
    162188  rc = RMAllocResource(DriverHandle,                    // Handle to driver.
  • GPL/branches/uniaud32-2.0/drv32/strategy.c

    r84 r421  
    7777//******************************************************************************
    7878// External initialization complete entry-point
     79#ifdef ACPI
     80// See desription in irq.cpp
     81#include "irqos2.h"                 //PS+++
     82#ifdef __cplusplus
     83extern "C" {
     84#endif
     85ULONG InitCompleteWas = 0;          //PS+++ Indication of InitComplete call
     86struct SaveIRQForSlot
     87{
     88    ULONG  ulSlotNo;
     89    BYTE   LowIRQ;
     90    BYTE   HighIRQ;
     91    BYTE   Pin;   
     92};
     93extern struct SaveIRQForSlot sISRHigh[];
     94extern int  SaveIRQCounter;
     95#ifdef __cplusplus
     96}
     97#endif
     98#endif //ACPI
    7999//******************************************************************************
    80100#pragma off (unreferenced)
     
    82102#pragma on (unreferenced)
    83103{
     104#ifdef ACPI
     105//PS+++ Begin
     106    ULONG  i, rc = 0;
     107
     108    InitCompleteWas = 1;
     109
     110    for (i = 0; i < SaveIRQCounter; i++)
     111    {
     112         dprintf(("Close IRQ%d - Open IRQ%d",(ULONG)sISRHigh[i].LowIRQ,(ULONG)sISRHigh[i].HighIRQ));
     113         if (sISRHigh[i].HighIRQ)
     114         {
     115             ALSA_FreeIrq(sISRHigh[i].LowIRQ);
     116             if (!ALSA_SetIrq(sISRHigh[i].HighIRQ, sISRHigh[i].ulSlotNo, 1))
     117             {
     118                 return (RPERR_COMMAND | RPDONE);
     119             }
     120         }
     121    }
     122#endif
     123//PS++ End
    84124#ifdef DEBUG
    85125    dprintf(("StratInitComplete"));
  • GPL/branches/uniaud32-2.0/lib32/debug.c

    r420 r421  
    4141extern int max_buf_size;
    4242
    43 #ifdef DEBUG
    44 short int MAGIC_COMM_PORT =  0x3f8;           // pulled from word ptr 40:0
    45 
    46 
    47 #define UART_DATA               0x00            // UART Data port
    48 #define UART_INT_ENAB           0x01            // UART Interrupt enable
    49 #define UART_INT_ID             0x02            // interrupt ID
    50 #define UART_LINE_CTRL          0x03            // line control registers
    51 #define UART_MODEM_CTRL         0x04            // modem control register
    52 #define UART_LINE_STAT          0x05            // line status register
    53 #define UART_MODEM_STAT         0x06            // modem status regiser
    54 #define UART_DIVISOR_LO         0x00            // divisor latch least sig
    55 #define UART_DIVISOR_HI         0x01h           // divisor latch most sig
    56 
    57 #define DELAY   nop
    58 #else
    59 short int MAGIC_COMM_PORT =  0x0;           // pulled from word ptr 40:0
    60 #endif
    61 
    6243char hextab[]="0123456789ABCDEF";
    6344
     
    565546    return psz - pszC;
    566547}
     548//PS+++ Changes for right debug output
     549#ifdef DEBUG
     550short int MAGIC_COMM_PORT =  0;           // pulled from word ptr 40:0
     551
     552
     553#define UART_DATA               0x00            // UART Data port
     554#define UART_INT_ENAB           0x01            // UART Interrupt enable
     555#define UART_INT_ID             0x02            // interrupt ID
     556#define UART_LINE_CTRL          0x03            // line control registers
     557#define UART_MODEM_CTRL         0x04            // modem control register
     558#define UART_LINE_STAT          0x05            // line status register
     559#define UART_MODEM_STAT         0x06            // modem status regiser
     560#define UART_DIVISOR_LO         0x00            // divisor latch least sig
     561#define UART_DIVISOR_HI         0x01h           // divisor latch most sig
     562
     563#define DELAY   nop
     564#else
     565short int MAGIC_COMM_PORT =  0x0;           // pulled from word ptr 40:0
     566#endif
    567567
    568568void StringOut(char *DbgStr)
     
    579579      */
    580580#ifdef DEBUG
    581    if (MAGIC_COMM_PORT)
     581   if (MAGIC_COMM_PORT)   //PS+++ If have comport - out to it
    582582   {
    583583       for( i= 0; i < len; i++ )
    584           CharOut( DbgStr[i] );
     584           CharOut( DbgStr[i] );
     585
    585586       if (fLineTerminate)
    586587       {
     
    630631#endif
    631632
     633
    632634#ifdef DEBUG                            //--------------------------- CharOut -
    633635void CharOut(char c)
  • GPL/branches/uniaud32-2.0/lib32/pci.c

    r410 r421  
    135135//******************************************************************************
    136136//******************************************************************************
     137#ifdef ACPI
     138struct SaveIRQForSlot
     139{
     140    ULONG  ulSlotNo;
     141    BYTE   LowIRQ;
     142    BYTE   HighIRQ;
     143    BYTE   Pin;   
     144};
     145extern struct SaveIRQForSlot sISRHigh[];
     146extern int  SaveIRQCounter;
     147#endif
     148
    137149static int pci_query_device(unsigned int vendor, unsigned int device,
    138150                            struct pci_dev near *pcidev, int idx)
     
    230242                        // IRQ and PIN
    231243                        pci_read_config_dword(pcidev, PCI_INTERRUPT_LINE, &temp);
     244                        sISRHigh[SaveIRQCounter].Pin  = (temp >> 8) & 0xf;
    232245#ifdef ACPI
    233246                        temp2 = temp3 = 0;
     
    242255                        {
    243256                        // Check APIC IRQ, if we have /SMP /APIC, must be set
    244                         if (temp3)
    245                            temp = (temp & (~0xff)) | (temp3 & 0xff);
     257                        if (temp1)
     258                           temp = (temp & (~0xff)) | (temp1 & 0xff);
    246259                        // Check PIC IRQ
    247                         else if (temp1)
    248                                  temp = (temp & (~0xff)) | (temp1 & 0xff);
     260                        else if (temp3)
     261                                 temp = (temp & (~0xff)) | (temp3 & 0xff);
    249262                        dprintf(("pci_query_device: IRQs ACPI PIC%d APIC%d", temp1, temp3));
     263                        sISRHigh[SaveIRQCounter].LowIRQ  = temp1;
     264                        sISRHigh[SaveIRQCounter].HighIRQ = temp3;
    250265                        }
    251266#endif /* ACPI */
Note: See TracChangeset for help on using the changeset viewer.