2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33 #ifndef _IOKIT_IOINTERRUPTCONTROLLER_H
34 #define _IOKIT_IOINTERRUPTCONTROLLER_H
36 #include <IOKit/IOLocks.h>
37 #include <IOKit/IOService.h>
38 #include <IOKit/IOInterrupts.h>
41 class IOSharedInterruptController
;
43 struct IOInterruptVector
{
44 volatile char interruptActive
;
45 volatile char interruptDisabledSoft
;
46 volatile char interruptDisabledHard
;
47 volatile char interruptRegistered
;
48 IOLock
* interruptLock
;
52 IOInterruptHandler handler
;
54 IOSharedInterruptController
*sharedController
;
57 typedef struct IOInterruptVector IOInterruptVector
;
60 class IOInterruptController
: public IOService
62 OSDeclareAbstractStructors(IOInterruptController
);
65 IOInterruptVector
*vectors
;
66 IOSimpleLock
*controllerLock
;
68 struct ExpansionData
{ };
69 ExpansionData
*reserved
;
72 virtual IOReturn
registerInterrupt(IOService
*nub
, int source
,
74 IOInterruptHandler handler
,
76 virtual IOReturn
unregisterInterrupt(IOService
*nub
, int source
);
78 virtual IOReturn
getInterruptType(IOService
*nub
, int source
,
81 virtual IOReturn
enableInterrupt(IOService
*nub
, int source
);
82 virtual IOReturn
disableInterrupt(IOService
*nub
, int source
);
83 virtual IOReturn
causeInterrupt(IOService
*nub
, int source
);
85 virtual IOInterruptAction
getInterruptHandlerAddress(void);
86 virtual IOReturn
handleInterrupt(void *refCon
, IOService
*nub
,
89 // Methods to be overridden for simplifed interrupt controller subclasses.
91 virtual bool vectorCanBeShared(long vectorNumber
, IOInterruptVector
*vector
);
92 virtual void initVector(long vectorNumber
, IOInterruptVector
*vector
);
93 virtual int getVectorType(long vectorNumber
, IOInterruptVector
*vector
);
94 virtual void disableVectorHard(long vectorNumber
, IOInterruptVector
*vector
);
95 virtual void enableVector(long vectorNumber
, IOInterruptVector
*vector
);
96 virtual void causeVector(long vectorNumber
, IOInterruptVector
*vector
);
98 OSMetaClassDeclareReservedUnused(IOInterruptController
, 0);
99 OSMetaClassDeclareReservedUnused(IOInterruptController
, 1);
100 OSMetaClassDeclareReservedUnused(IOInterruptController
, 2);
101 OSMetaClassDeclareReservedUnused(IOInterruptController
, 3);
102 OSMetaClassDeclareReservedUnused(IOInterruptController
, 4);
103 OSMetaClassDeclareReservedUnused(IOInterruptController
, 5);
107 class IOSharedInterruptController
: public IOInterruptController
109 OSDeclareDefaultStructors(IOSharedInterruptController
);
114 int vectorsRegistered
;
116 volatile long controllerDisabled
;
119 struct ExpansionData
{ };
120 ExpansionData
*reserved
;
123 virtual IOReturn
initInterruptController(IOInterruptController
*parentController
, OSData
*parentSource
);
125 virtual IOReturn
registerInterrupt(IOService
*nub
, int source
,
127 IOInterruptHandler handler
,
129 virtual IOReturn
unregisterInterrupt(IOService
*nub
, int source
);
131 virtual IOReturn
getInterruptType(IOService
*nub
, int source
,
134 virtual IOReturn
enableInterrupt(IOService
*nub
, int source
);
135 virtual IOReturn
disableInterrupt(IOService
*nub
, int source
);
137 virtual IOInterruptAction
getInterruptHandlerAddress(void);
138 virtual IOReturn
handleInterrupt(void *refCon
, IOService
*nub
, int source
);
140 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 0);
141 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 1);
142 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 2);
143 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 3);
147 #endif /* ! _IOKIT_IOINTERRUPTCONTROLLER_H */