2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
36 #ifndef _IOKIT_IOINTERRUPTCONTROLLER_H
37 #define _IOKIT_IOINTERRUPTCONTROLLER_H
39 #include <IOKit/IOLocks.h>
40 #include <IOKit/IOService.h>
41 #include <IOKit/IOInterrupts.h>
44 class IOSharedInterruptController
;
46 struct IOInterruptVector
{
47 volatile char interruptActive
;
48 volatile char interruptDisabledSoft
;
49 volatile char interruptDisabledHard
;
50 volatile char interruptRegistered
;
51 IOLock
* interruptLock
;
55 IOInterruptHandler handler
;
57 IOSharedInterruptController
*sharedController
;
60 typedef struct IOInterruptVector IOInterruptVector
;
63 typedef int32_t IOInterruptVectorNumber
;
65 typedef long IOInterruptVectorNumber
;
68 class IOInterruptController
: public IOService
70 OSDeclareAbstractStructors(IOInterruptController
);
73 IOInterruptVector
*vectors
;
74 IOSimpleLock
*controllerLock
;
76 struct ExpansionData
{ };
77 ExpansionData
*ioic_reserved
;
80 virtual IOReturn
registerInterrupt(IOService
*nub
, int source
,
82 IOInterruptHandler handler
,
84 virtual IOReturn
unregisterInterrupt(IOService
*nub
, int source
);
86 virtual IOReturn
getInterruptType(IOService
*nub
, int source
,
89 virtual IOReturn
enableInterrupt(IOService
*nub
, int source
);
90 virtual IOReturn
disableInterrupt(IOService
*nub
, int source
);
91 virtual IOReturn
causeInterrupt(IOService
*nub
, int source
);
93 virtual IOInterruptAction
getInterruptHandlerAddress(void);
94 virtual IOReturn
handleInterrupt(void *refCon
, IOService
*nub
,
97 // Methods to be overridden for simplifed interrupt controller subclasses.
99 virtual bool vectorCanBeShared(IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
100 virtual void initVector(IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
101 virtual int getVectorType(IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
102 virtual void disableVectorHard(IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
103 virtual void enableVector(IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
104 virtual void causeVector(IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
105 virtual void setCPUInterruptProperties(IOService
*service
);
107 virtual void sendIPI(unsigned int cpu_id
, bool deferred
);
108 virtual void cancelDeferredIPI(unsigned int cpu_id
);
110 OSMetaClassDeclareReservedUsedX86(IOInterruptController
, 0);
111 OSMetaClassDeclareReservedUsedX86(IOInterruptController
, 1);
112 OSMetaClassDeclareReservedUsedX86(IOInterruptController
, 2);
113 OSMetaClassDeclareReservedUnused(IOInterruptController
, 3);
114 OSMetaClassDeclareReservedUnused(IOInterruptController
, 4);
115 OSMetaClassDeclareReservedUnused(IOInterruptController
, 5);
118 // Generic methods (not to be overriden).
120 void timeStampSpuriousInterrupt(void);
121 void timeStampInterruptHandlerStart(IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
122 void timeStampInterruptHandlerEnd(IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
125 void timeStampInterruptHandlerInternal(bool isStart
, IOInterruptVectorNumber vectorNumber
, IOInterruptVector
*vector
);
129 class IOSharedInterruptController
: public IOInterruptController
131 OSDeclareDefaultStructors(IOSharedInterruptController
);
136 int vectorsRegistered
;
138 volatile int controllerDisabled
;
141 struct ExpansionData
{ };
142 ExpansionData
*iosic_reserved __unused
;
145 virtual IOReturn
initInterruptController(IOInterruptController
*parentController
, OSData
*parentSource
);
147 virtual IOReturn
registerInterrupt(IOService
*nub
, int source
,
149 IOInterruptHandler handler
,
150 void *refCon
) APPLE_KEXT_OVERRIDE
;
151 virtual IOReturn
unregisterInterrupt(IOService
*nub
, int source
) APPLE_KEXT_OVERRIDE
;
153 virtual IOReturn
getInterruptType(IOService
*nub
, int source
,
154 int *interruptType
) APPLE_KEXT_OVERRIDE
;
156 virtual IOReturn
enableInterrupt(IOService
*nub
, int source
) APPLE_KEXT_OVERRIDE
;
157 virtual IOReturn
disableInterrupt(IOService
*nub
, int source
) APPLE_KEXT_OVERRIDE
;
159 virtual IOInterruptAction
getInterruptHandlerAddress(void) APPLE_KEXT_OVERRIDE
;
160 virtual IOReturn
handleInterrupt(void *refCon
, IOService
*nub
, int source
) APPLE_KEXT_OVERRIDE
;
162 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 0);
163 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 1);
164 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 2);
165 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 3);
169 #endif /* ! _IOKIT_IOINTERRUPTCONTROLLER_H */