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) 1998 Apple Computer, Inc. All rights reserved.
30 #ifndef _IOKIT_IOPLATFORMEXPERT_H
31 #define _IOKIT_IOPLATFORMEXPERT_H
34 #include <IOKit/IOLib.h>
35 #include <IOKit/IOService.h>
36 #include <IOKit/IOInterrupts.h>
37 #include <IOKit/IOInterruptController.h>
42 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
43 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
44 extern int PEGetPlatformEpoch( void );
50 extern int (*PE_halt_restart
)(unsigned int type
);
51 extern int PEHaltRestart(unsigned int type
);
53 extern long PEGetGMTTimeOfDay( void );
54 extern void PESetGMTTimeOfDay( long secs
);
59 extern OSSymbol
* gPlatformInterruptControllerName
;
61 class IORangeAllocator
;
62 class IONVRAMController
;
65 class IOPlatformExpert
: public IOService
67 OSDeclareDefaultStructors(IOPlatformExpert
);
75 IOPMrootDomain
* root
;
77 int _pePrivPMFeatures
;
78 int _peNumBatteriesSupported
;
79 OSArray
* thePowerTree
;
81 bool searchingForAdditionalParents
;
82 OSNumber
* multipleParentKeyValue
;
83 int numInstancesRegistered
;
85 struct ExpansionData
{ };
86 ExpansionData
*reserved
;
88 virtual void setBootROMType(long peBootROMType
);
89 virtual void setChipSetType(long peChipSetType
);
90 virtual void setMachineType(long peMachineType
);
92 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
93 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
95 virtual void PMInstantiatePowerDomains ( void );
98 virtual bool attach( IOService
* provider
);
99 virtual bool start( IOService
* provider
);
100 virtual bool configure( IOService
* provider
);
101 virtual IOService
* createNub( OSDictionary
* from
);
103 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
104 OSString
** matched
= 0 ) const;
105 virtual IOReturn
getNubResources( IOService
* nub
);
107 virtual long getBootROMType(void);
108 virtual long getChipSetType(void);
109 virtual long getMachineType(void);
111 virtual bool getModelName( char * name
, int maxLength
);
112 virtual bool getMachineName( char * name
, int maxLength
);
114 virtual int haltRestart(unsigned int type
);
115 virtual void sleepKernel(void);
117 virtual long getGMTTimeOfDay( void );
118 virtual void setGMTTimeOfDay( long secs
);
120 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
121 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
123 virtual void registerNVRAMController( IONVRAMController
* nvram
);
125 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
126 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
127 virtual void setCPUInterruptProperties(IOService
*service
);
128 virtual bool atInterruptLevel(void);
130 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
131 bool waitForFunction
,
132 void *param1
, void *param2
,
133 void *param3
, void *param4
);
135 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
137 virtual bool platformAdjustService(IOService
*service
);
139 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
140 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
142 virtual bool hasPMFeature (unsigned long featureMask
);
143 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
144 virtual int numBatteriesSupported (void);
146 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 0);
147 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 1);
148 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
149 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
150 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
151 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
152 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
153 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
154 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
155 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
156 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
157 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
160 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
164 class IODTPlatformExpert
: public IOPlatformExpert
166 OSDeclareAbstractStructors(IODTPlatformExpert
);
171 struct ExpansionData
{ };
172 ExpansionData
*reserved
;
175 virtual IOService
* probe( IOService
* provider
,
177 virtual bool configure( IOService
* provider
);
179 virtual void processTopLevel( IORegistryEntry
* root
);
180 virtual const char * deleteList( void ) = 0;
181 virtual const char * excludeList( void ) = 0;
182 virtual IOService
* createNub( IORegistryEntry
* from
);
183 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
185 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
186 OSString
** matched
= 0 ) const;
188 virtual IOReturn
getNubResources( IOService
* nub
);
190 virtual bool getModelName( char * name
, int maxLength
);
191 virtual bool getMachineName( char * name
, int maxLength
);
193 virtual void registerNVRAMController( IONVRAMController
* nvram
);
195 virtual int haltRestart(unsigned int type
);
197 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
199 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
202 virtual IOReturn
readNVRAMProperty(
203 IORegistryEntry
* entry
,
204 const OSSymbol
** name
, OSData
** value
);
206 virtual IOReturn
writeNVRAMProperty(
207 IORegistryEntry
* entry
,
208 const OSSymbol
* name
, OSData
* value
);
211 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
212 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
213 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
214 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
215 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
216 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
217 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
218 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
221 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
223 /* generic root nub of service tree */
225 class IOPlatformExpertDevice
: public IOService
227 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
230 IOWorkLoop
*workLoop
;
232 struct ExpansionData
{ };
233 ExpansionData
*reserved
;
236 virtual bool initWithArgs( void * p1
, void * p2
,
237 void * p3
, void *p4
);
238 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
240 virtual IOWorkLoop
*getWorkLoop() const;
244 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
245 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
246 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
247 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
250 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
252 /* generic nub for motherboard devices */
254 class IOPlatformDevice
: public IOService
256 OSDeclareDefaultStructors(IOPlatformDevice
)
258 struct ExpansionData
{ };
259 ExpansionData
*reserved
;
262 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
263 virtual IOService
* matchLocation( IOService
* client
);
264 virtual IOReturn
getResources( void );
266 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
267 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
268 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
269 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
272 #endif /* __cplusplus */
274 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */