source: GPL/branches/uniaud32-2.1.x/drv32/irq.cpp@ 498

Last change on this file since 498 was 458, checked in by Paul Smedley, 16 years ago

Revert ACPI fixes from changeset 453 due to reported hangs

File size: 5.0 KB
Line 
1/* $Id: irq.cpp,v 1.1.1.1 2003/07/02 13:56:56 eleph Exp $ */
2/*
3 * IRQ handler functions
4 *
5 * (C) 2000-2002 InnoTek Systemberatung GmbH
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public
18 * License along with this program; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
20 * USA.
21 *
22 */
23
24#define INCL_NOPMAPI
25#define INCL_DOSINFOSEG // Need Global info seg in rm.cpp algorithms
26#include <os2.h>
27
28#include <devtype.h>
29#include <devinfo.h>
30#include <devhelp.h>
31#include <include.h> // Defn's for WatCom based drivers.
32#include <irqos2.h>
33#include <dbgos2.h>
34#include "irq.h"
35
36// List of handlers here.
37static FARPTR16 *pISR[MAX_IRQ_SLOTS] = {
38 &ISR00,
39 &ISR01,
40 &ISR02,
41 &ISR03,
42 &ISR04,
43 &ISR05,
44 &ISR06,
45 &ISR07
46};
47
48//******************************************************************************
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
79//******************************************************************************
80BOOL ALSA_SetIrq(ULONG ulIrq, ULONG ulSlotNo, BOOL fShared)
81{
82 USHORT rc = 1;
83
84 if( ulSlotNo >= MAX_IRQ_SLOTS ) {
85 DebugInt3();
86 return FALSE;
87 }
88
89 if(fShared)
90 {
91 rc = DevIRQSet((WORD16) *pISR[ulSlotNo],
92 (WORD16)ulIrq,
93 1 ); // first try shared shared
94 }
95
96 if (rc != 0) { // If error ...
97 dprintf(("ERROR: RMSetIrq %d %d %x - failed to set shared - trying exclusive!!", ulIrq, fShared, ulSlotNo));
98 rc = DevIRQSet((WORD16) *pISR[ulSlotNo],
99 (WORD16)ulIrq,
100 0); // failed, so try exclusive instead
101 }
102
103 if (rc != 0) { // If error ...
104 dprintf(("ERROR: RMSetIrq %d %d %x FAILED shared and exclusive mode!!", ulIrq, fShared, ulSlotNo));
105 DebugInt3();
106 return FALSE;
107 }
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
121
122 return TRUE;
123}
124//******************************************************************************
125//******************************************************************************
126BOOL ALSA_FreeIrq(ULONG ulIrq)
127{
128 return (DevIRQClear((WORD16)ulIrq) == 0);
129}
130//******************************************************************************
131//******************************************************************************
132ULONG ALSA_Interrupt(ULONG ulSlotNo);
133#pragma aux ALSA_Interrupt "ALSA_Interrupt" parm [ebx]
134ULONG ALSA_Interrupt(ULONG ulSlotNo)
135{
136 ULONG ulIrqNo;
137
138 // enable interrupts that have higher priority we should
139 // allow higher priority interrupts
140 sti();
141 if( process_interrupt(ulSlotNo, &ulIrqNo) ) {
142 // We've cleared all service requests.
143 // Clear (disable) Interrupts, Send EOI
144 // and clear the carry flag (tells OS/2 kernel that Int was handled).
145 // Note carry flag is handled in setup.asm
146 cli();
147 DevEOI( (WORD16)ulIrqNo );
148 return TRUE;
149 }
150 // Indicate Interrupt not serviced by setting carry flag before
151 // returning to OS/2 kernel. OS/2 will then shut down the interrupt!
152 // NOTE: Make sure interrupts are not turned on again when this irq isn't ours!
153 return FALSE;
154}
155//******************************************************************************
156//******************************************************************************
Note: See TracBrowser for help on using the repository browser.