2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1997 Apple Computer, Inc.
28 * sdouglas 22 Oct 97 - first checked in.
29 * sdouglas 21 July 98 - start IOKit
36 #include <IOKit/IORegistryEntry.h>
37 #include <IOKit/IOInterruptEventSource.h>
39 #include <IOKit/ndrvsupport/IOMacOSTypes.h>
40 #include <IOKit/ndrvsupport/IONDRVSupport.h>
42 #pragma options align=mac68k
48 typedef void * RegEntryID
[4];
50 struct DriverInitInfo
{
52 RegEntryID deviceEntry
;
55 #define MAKE_REG_ENTRY(regEntryID,obj) \
56 regEntryID[ 0 ] = (void *) obj; \
57 regEntryID[ 1 ] = (void *) ~(UInt32)obj; \
58 regEntryID[ 2 ] = (void *) 0x53696d65; \
59 regEntryID[ 3 ] = (void *) 0x52756c7a;
61 #define REG_ENTRY_TO_OBJ(regEntryID,obj) \
62 if( (UInt32)((obj = ((IORegistryEntry **)regEntryID)[ 0 ])) \
63 != ~((UInt32 *)regEntryID)[ 1 ] ) \
66 #define REG_ENTRY_TO_OBJ_RET(regEntryID,obj,ret) \
67 if( (UInt32)((obj = ((IORegistryEntry **)regEntryID)[ 0 ])) \
68 != ~((UInt32 *)regEntryID)[ 1 ] ) \
71 #define REG_ENTRY_TO_PT(regEntryID,obj) \
72 IORegistryEntry * obj; \
73 if( (UInt32)((obj = ((IORegistryEntry **)regEntryID)[ 0 ])) \
74 != ~((UInt32 *)regEntryID)[ 1 ] ) \
77 #define REG_ENTRY_TO_SERVICE(regEntryID,type,obj) \
78 IORegistryEntry * regEntry; \
80 if( (UInt32)((regEntry = ((IORegistryEntry **)regEntryID)[ 0 ])) \
81 != ~((UInt32 *)regEntryID)[ 1 ] ) \
83 if( 0 == (obj = OSDynamicCast( type, regEntry))) \
100 typedef struct CntrlParam CntrlParam
, *CntrlParamPtr
;
102 #pragma options align=reset
112 kInitializeCommand
= 7, /* init driver and device*/
113 kFinalizeCommand
= 8, /* shutdown driver and device*/
114 kReplaceCommand
= 9, /* replace an old driver*/
115 kSupersededCommand
= 10 /* prepare to be replaced by a new driver*/
118 kSynchronousIOCommandKind
= 0x00000001,
119 kAsynchronousIOCommandKind
= 0x00000002,
120 kImmediateIOCommandKind
= 0x00000004
124 extern OSStatus
CallTVector(
125 void * p1
, void * p2
, void * p3
, void * p4
, void * p5
, void * p6
,
126 struct IOTVector
* entry
);
132 class IONDRV
: public OSObject
134 OSDeclareDefaultStructors(IONDRV
)
138 struct IOTVector
* fDoDriverIO
;
139 struct DriverDescription
* theDriverDesc
;
142 static IONDRV
* instantiate( IORegistryEntry
* regEntry
,
143 IOLogicalAddress container
,
144 IOByteCount containerSize
,
145 IONDRVUndefinedSymbolHandler handler
,
148 static IONDRV
* fromRegistryEntry( IORegistryEntry
* regEntry
,
149 IONDRVUndefinedSymbolHandler handler
,
152 virtual void free( void );
154 virtual IOReturn
getSymbol( const char * symbolName
,
155 IOLogicalAddress
* address
);
157 virtual const char * driverName( void );
159 virtual IOReturn
doDriverIO( UInt32 commandID
, void * contents
,
160 UInt32 commandCode
, UInt32 commandKind
);
164 struct IONDRVInterruptSource
{
166 struct IOTVector
* handler
;
167 struct IOTVector
* enabler
;
168 struct IOTVector
* disabler
;
173 class IONDRVInterruptSet
: public OSObject
{
175 OSDeclareDefaultStructors(IONDRVInterruptSet
)
178 IOService
* provider
;
179 IOOptionBits options
;
181 IONDRVInterruptSource
* sources
;
182 IONDRVInterruptSet
* child
;
184 static IONDRVInterruptSet
* with(IOService
* provider
,
185 IOOptionBits options
, SInt32 count
);
189 #endif /* __IONDRV__ */