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 );
63 extern int (*PE_halt_restart
)(unsigned int type
);
64 extern int PEHaltRestart(unsigned int type
);
66 // Save the Panic Info. Returns the number of bytes saved.
67 extern UInt32
PESavePanicInfo(UInt8
*buffer
, UInt32 length
);
69 extern long PEGetGMTTimeOfDay( void );
70 extern void PESetGMTTimeOfDay( long secs
);
71 extern void PEGetUTCTimeOfDay( clock_sec_t
* secs
, clock_usec_t
* usecs
);
72 extern void PESetUTCTimeOfDay( clock_sec_t secs
, clock_usec_t usecs
);
74 /* unless it's a "well-known" property, these will read/write out the value as raw data */
76 extern boolean_t
PEWriteNVRAMBooleanProperty(const char *symbol
, boolean_t value
);
77 extern boolean_t
PEWriteNVRAMProperty(const char *symbol
, const void *value
, const unsigned int len
);
79 extern boolean_t
PEReadNVRAMProperty(const char *symbol
, void *value
, unsigned int *len
);
81 extern boolean_t
PERemoveNVRAMProperty(const char *symbol
);
86 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
89 extern OSSymbol
* gPlatformInterruptControllerName
;
91 extern const OSSymbol
* gIOPlatformSleepActionKey
;
92 extern const OSSymbol
* gIOPlatformWakeActionKey
;
93 extern const OSSymbol
* gIOPlatformQuiesceActionKey
;
94 extern const OSSymbol
* gIOPlatformActiveActionKey
;
95 extern const OSSymbol
* gIOPlatformHaltRestartActionKey
;
96 extern const OSSymbol
* gIOPlatformPanicActionKey
;
98 class IORangeAllocator
;
99 class IONVRAMController
;
100 class IOPMrootDomain
;
102 class IOPlatformExpert
: public IOService
104 OSDeclareDefaultStructors(IOPlatformExpert
);
112 IOPMrootDomain
* root
;
114 int _pePrivPMFeatures
;
115 int _peNumBatteriesSupported
;
116 OSArray
* thePowerTree
;
118 bool searchingForAdditionalParents
;
119 OSNumber
* multipleParentKeyValue
;
120 int numInstancesRegistered
;
122 struct ExpansionData
{ };
123 ExpansionData
*reserved
;
125 virtual void setBootROMType(long peBootROMType
);
126 virtual void setChipSetType(long peChipSetType
);
127 virtual void setMachineType(long peMachineType
);
129 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
130 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
132 virtual void PMInstantiatePowerDomains ( void );
135 virtual bool attach( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
136 virtual bool start( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
137 virtual bool configure( IOService
* provider
);
138 virtual IOService
* createNub( OSDictionary
* from
);
140 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
141 OSString
** matched
= 0 ) const;
142 virtual IOReturn
getNubResources( IOService
* nub
);
144 virtual long getBootROMType(void);
145 virtual long getChipSetType(void);
146 virtual long getMachineType(void);
148 virtual bool getModelName( char * name
, int maxLength
);
149 virtual bool getMachineName( char * name
, int maxLength
);
151 virtual int haltRestart(unsigned int type
);
152 virtual void sleepKernel(void);
154 virtual long getGMTTimeOfDay( void );
155 virtual void setGMTTimeOfDay( long secs
);
157 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
158 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
160 virtual void registerNVRAMController( IONVRAMController
* nvram
);
162 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
163 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
164 virtual void setCPUInterruptProperties(IOService
*service
);
165 virtual bool atInterruptLevel(void);
167 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
168 bool waitForFunction
,
169 void *param1
, void *param2
,
170 void *param3
, void *param4
) APPLE_KEXT_OVERRIDE
;
172 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
174 virtual bool platformAdjustService(IOService
*service
);
176 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
177 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
179 virtual bool hasPMFeature (unsigned long featureMask
);
180 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
181 virtual int numBatteriesSupported (void);
183 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
185 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
187 virtual IOReturn
deregisterInterruptController(OSSymbol
*name
);
189 virtual void getUTCTimeOfDay( clock_sec_t
* secs
, clock_nsec_t
* nsecs
);
190 virtual void setUTCTimeOfDay( clock_sec_t secs
, clock_nsec_t nsecs
);
192 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
193 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
194 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 2);
195 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 3);
196 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 4);
197 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
198 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
199 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
200 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
201 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
202 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
203 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
206 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
210 class IODTPlatformExpert
: public IOPlatformExpert
212 OSDeclareAbstractStructors(IODTPlatformExpert
);
217 struct ExpansionData
{ };
218 ExpansionData
*reserved
;
221 virtual IOService
* probe( IOService
* provider
,
222 SInt32
* score
) APPLE_KEXT_OVERRIDE
;
223 virtual bool configure( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
225 virtual void processTopLevel( IORegistryEntry
* root
);
226 virtual const char * deleteList( void ) = 0;
227 virtual const char * excludeList( void ) = 0;
228 virtual IOService
* createNub( IORegistryEntry
* from
);
229 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
231 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
232 OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
234 virtual IOReturn
getNubResources( IOService
* nub
) APPLE_KEXT_OVERRIDE
;
236 virtual bool getModelName( char * name
, int maxLength
) APPLE_KEXT_OVERRIDE
;
237 virtual bool getMachineName( char * name
, int maxLength
) APPLE_KEXT_OVERRIDE
;
239 virtual void registerNVRAMController( IONVRAMController
* nvram
) APPLE_KEXT_OVERRIDE
;
241 virtual int haltRestart(unsigned int type
) APPLE_KEXT_OVERRIDE
;
243 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
246 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
249 virtual IOReturn
readNVRAMProperty(
250 IORegistryEntry
* entry
,
251 const OSSymbol
** name
, OSData
** value
);
253 virtual IOReturn
writeNVRAMProperty(
254 IORegistryEntry
* entry
,
255 const OSSymbol
* name
, OSData
* value
);
257 // This returns a dictionary describing all the NVRAM partitions.
258 // The keys will be the partitionIDs of the form "0x52,nvram".
259 // The values will be OSNumbers of the partition's byte count.
260 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
262 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
263 IOByteCount offset
, UInt8
* buffer
,
266 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
267 IOByteCount offset
, UInt8
* buffer
,
270 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
) APPLE_KEXT_OVERRIDE
;
271 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
) APPLE_KEXT_OVERRIDE
;
273 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
274 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
275 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
276 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
277 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
278 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
279 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
280 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
283 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
285 /* generic root nub of service tree */
287 class IOPlatformExpertDevice
: public IOService
289 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
292 IOWorkLoop
*workLoop
;
294 struct ExpansionData
{ };
295 ExpansionData
*reserved
;
298 virtual bool initWithArgs( void * p1
, void * p2
,
299 void * p3
, void *p4
);
300 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
302 virtual IOWorkLoop
*getWorkLoop() const APPLE_KEXT_OVERRIDE
;
303 virtual IOReturn
setProperties( OSObject
* properties
) APPLE_KEXT_OVERRIDE
;
305 virtual void free() APPLE_KEXT_OVERRIDE
;
307 virtual IOReturn
newUserClient( task_t owningTask
, void * securityID
,
308 UInt32 type
, OSDictionary
* properties
,
309 IOUserClient
** handler
) APPLE_KEXT_OVERRIDE
;
312 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
313 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
314 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
315 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
318 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
320 /* generic nub for motherboard devices */
322 class IOPlatformDevice
: public IOService
324 OSDeclareDefaultStructors(IOPlatformDevice
)
326 struct ExpansionData
{ };
327 ExpansionData
*reserved
;
330 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
331 virtual IOService
* matchLocation( IOService
* client
) APPLE_KEXT_OVERRIDE
;
332 virtual IOReturn
getResources( void ) APPLE_KEXT_OVERRIDE
;
334 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
335 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
336 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
337 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
340 #endif /* __cplusplus */
342 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */