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) 1998 Apple Computer, Inc. All rights reserved.
36 #ifndef _IOKIT_IOPLATFORMEXPERT_H
37 #define _IOKIT_IOPLATFORMEXPERT_H
40 #include <IOKit/IOLib.h>
41 #include <IOKit/IOService.h>
42 #include <IOKit/IOInterrupts.h>
43 #include <IOKit/IOInterruptController.h>
48 #include <libkern/OSTypes.h>
50 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
51 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
52 extern int PEGetPlatformEpoch( void );
65 extern int (*PE_halt_restart
)(unsigned int type
);
66 extern int PEHaltRestart(unsigned int type
);
68 // Save the Panic Info. Returns the number of bytes saved.
69 extern UInt32
PESavePanicInfo(UInt8
*buffer
, UInt32 length
);
70 extern void PESavePanicInfoAction(void *buffer
, size_t length
);
72 extern long PEGetGMTTimeOfDay( void );
73 extern void PESetGMTTimeOfDay( long secs
);
74 extern void PEGetUTCTimeOfDay( clock_sec_t
* secs
, clock_usec_t
* usecs
);
75 extern void PESetUTCTimeOfDay( clock_sec_t secs
, clock_usec_t usecs
);
77 /* unless it's a "well-known" property, these will read/write out the value as raw data */
79 extern boolean_t
PEWriteNVRAMBooleanProperty(const char *symbol
, boolean_t value
);
80 extern boolean_t
PEWriteNVRAMProperty(const char *symbol
, const void *value
, const unsigned int len
);
82 extern boolean_t
PEReadNVRAMProperty(const char *symbol
, void *value
, unsigned int *len
);
84 extern boolean_t
PERemoveNVRAMProperty(const char *symbol
);
89 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
92 extern OSSymbol
* gPlatformInterruptControllerName
;
94 extern const OSSymbol
* gIOPlatformSleepActionKey
;
95 extern const OSSymbol
* gIOPlatformWakeActionKey
;
96 extern const OSSymbol
* gIOPlatformQuiesceActionKey
;
97 extern const OSSymbol
* gIOPlatformActiveActionKey
;
98 extern const OSSymbol
* gIOPlatformHaltRestartActionKey
;
99 extern const OSSymbol
* gIOPlatformPanicActionKey
;
101 class IORangeAllocator
;
102 class IONVRAMController
;
103 class IOPMrootDomain
;
105 class IOPlatformExpert
: public IOService
107 OSDeclareDefaultStructors(IOPlatformExpert
);
115 IOPMrootDomain
* root
;
117 int _pePrivPMFeatures
;
118 int _peNumBatteriesSupported
;
119 OSArray
* thePowerTree
;
121 bool searchingForAdditionalParents
;
122 OSNumber
* multipleParentKeyValue
;
123 int numInstancesRegistered
;
125 struct ExpansionData
{ };
126 ExpansionData
*reserved
;
128 virtual void setBootROMType(long peBootROMType
);
129 virtual void setChipSetType(long peChipSetType
);
130 virtual void setMachineType(long peMachineType
);
132 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
133 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
135 virtual void PMInstantiatePowerDomains ( void );
138 virtual bool attach( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
139 virtual bool start( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
140 virtual bool configure( IOService
* provider
);
141 virtual IOService
* createNub( OSDictionary
* from
);
143 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
144 OSString
** matched
= 0 ) const;
145 virtual IOReturn
getNubResources( IOService
* nub
);
147 virtual long getBootROMType(void);
148 virtual long getChipSetType(void);
149 virtual long getMachineType(void);
151 virtual bool getModelName( char * name
, int maxLength
);
152 virtual bool getMachineName( char * name
, int maxLength
);
154 virtual int haltRestart(unsigned int type
);
155 virtual void sleepKernel(void);
157 virtual long getGMTTimeOfDay( void );
158 virtual void setGMTTimeOfDay( long secs
);
160 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
161 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
163 virtual void registerNVRAMController( IONVRAMController
* nvram
);
165 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
166 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
167 virtual void setCPUInterruptProperties(IOService
*service
);
168 virtual bool atInterruptLevel(void);
170 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
171 bool waitForFunction
,
172 void *param1
, void *param2
,
173 void *param3
, void *param4
) APPLE_KEXT_OVERRIDE
;
175 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
177 virtual bool platformAdjustService(IOService
*service
);
179 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
180 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
182 virtual bool hasPMFeature (unsigned long featureMask
);
183 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
184 virtual int numBatteriesSupported (void);
186 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
188 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
190 virtual IOReturn
deregisterInterruptController(OSSymbol
*name
);
192 virtual void getUTCTimeOfDay( clock_sec_t
* secs
, clock_nsec_t
* nsecs
);
193 virtual void setUTCTimeOfDay( clock_sec_t secs
, clock_nsec_t nsecs
);
195 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
196 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
197 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 2);
198 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 3);
199 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 4);
200 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
201 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
202 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
203 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
204 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
205 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
206 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
209 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
213 class IODTPlatformExpert
: public IOPlatformExpert
215 OSDeclareAbstractStructors(IODTPlatformExpert
);
220 struct ExpansionData
{ };
221 ExpansionData
*reserved
;
224 virtual IOService
* probe( IOService
* provider
,
225 SInt32
* score
) APPLE_KEXT_OVERRIDE
;
226 virtual bool configure( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
228 virtual void processTopLevel( IORegistryEntry
* root
);
229 virtual const char * deleteList( void ) = 0;
230 virtual const char * excludeList( void ) = 0;
231 virtual IOService
* createNub( IORegistryEntry
* from
);
232 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
234 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
235 OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
237 virtual IOReturn
getNubResources( IOService
* nub
) APPLE_KEXT_OVERRIDE
;
239 virtual bool getModelName( char * name
, int maxLength
) APPLE_KEXT_OVERRIDE
;
240 virtual bool getMachineName( char * name
, int maxLength
) APPLE_KEXT_OVERRIDE
;
242 virtual void registerNVRAMController( IONVRAMController
* nvram
) APPLE_KEXT_OVERRIDE
;
244 virtual int haltRestart(unsigned int type
) APPLE_KEXT_OVERRIDE
;
246 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
249 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
252 virtual IOReturn
readNVRAMProperty(
253 IORegistryEntry
* entry
,
254 const OSSymbol
** name
, OSData
** value
);
256 virtual IOReturn
writeNVRAMProperty(
257 IORegistryEntry
* entry
,
258 const OSSymbol
* name
, OSData
* value
);
260 // This returns a dictionary describing all the NVRAM partitions.
261 // The keys will be the partitionIDs of the form "0x52,nvram".
262 // The values will be OSNumbers of the partition's byte count.
263 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
265 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
266 IOByteCount offset
, UInt8
* buffer
,
269 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
270 IOByteCount offset
, UInt8
* buffer
,
273 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
) APPLE_KEXT_OVERRIDE
;
274 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
) APPLE_KEXT_OVERRIDE
;
276 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
277 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
278 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
279 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
280 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
281 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
282 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
283 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
286 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
288 /* generic root nub of service tree */
290 class IOPlatformExpertDevice
: public IOService
292 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
295 IOWorkLoop
*workLoop
;
297 struct ExpansionData
{ };
298 ExpansionData
*reserved
;
301 virtual bool initWithArgs( void * p1
, void * p2
,
302 void * p3
, void *p4
);
303 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
305 virtual IOWorkLoop
*getWorkLoop() const APPLE_KEXT_OVERRIDE
;
306 virtual IOReturn
setProperties( OSObject
* properties
) APPLE_KEXT_OVERRIDE
;
308 virtual void free() APPLE_KEXT_OVERRIDE
;
310 virtual IOReturn
newUserClient( task_t owningTask
, void * securityID
,
311 UInt32 type
, OSDictionary
* properties
,
312 IOUserClient
** handler
) APPLE_KEXT_OVERRIDE
;
315 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
316 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
317 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
318 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
321 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
323 /* generic nub for motherboard devices */
325 class IOPlatformDevice
: public IOService
327 OSDeclareDefaultStructors(IOPlatformDevice
)
329 struct ExpansionData
{ };
330 ExpansionData
*reserved
;
333 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
334 virtual IOService
* matchLocation( IOService
* client
) APPLE_KEXT_OVERRIDE
;
335 virtual IOReturn
getResources( void ) APPLE_KEXT_OVERRIDE
;
337 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
338 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
339 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
340 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
343 #endif /* __cplusplus */
345 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */