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>
51 kCoprocessorVersionNone
= 0x00000000,
52 kCoprocessorVersion1
= 0x00010000,
53 kCoprocessorVersion2
= 0x00020000,
57 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
58 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
59 extern int PEGetPlatformEpoch( void );
73 extern int (*PE_halt_restart
)(unsigned int type
);
74 extern int PEHaltRestart(unsigned int type
);
76 #ifdef XNU_KERNEL_PRIVATE
78 kIOSystemShutdownNotificationStageProcessExit
= 0,
79 kIOSystemShutdownNotificationStageRootUnmount
= 1,
81 extern void IOSystemShutdownNotification(int stage
);
82 #endif /* XNU_KERNEL_PRIVATE */
84 // Save the Panic Info. Returns the number of bytes saved.
85 extern UInt32
PESavePanicInfo(UInt8
*buffer
, UInt32 length
);
86 extern void PESavePanicInfoAction(void *buffer
, UInt32 offset
, UInt32 length
);
89 * SMC requires that all data is flushed in multiples of 16 bytes at 16 byte
92 #define PANIC_FLUSH_BOUNDARY 16
94 extern long PEGetGMTTimeOfDay( void );
95 extern void PESetGMTTimeOfDay( long secs
);
96 extern void PEGetUTCTimeOfDay( clock_sec_t
* secs
, clock_usec_t
* usecs
);
97 extern void PESetUTCTimeOfDay( clock_sec_t secs
, clock_usec_t usecs
);
99 /* unless it's a "well-known" property, these will read/write out the value as raw data */
101 extern boolean_t
PEWriteNVRAMBooleanProperty(const char *symbol
, boolean_t value
);
102 extern boolean_t
PEWriteNVRAMProperty(const char *symbol
, const void *value
, const unsigned int len
);
104 extern boolean_t
PEReadNVRAMProperty(const char *symbol
, void *value
, unsigned int *len
);
106 extern boolean_t
PERemoveNVRAMProperty(const char *symbol
);
108 extern coprocessor_type_t
PEGetCoprocessorVersion( void );
113 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
118 extern OSSymbol
* gPlatformInterruptControllerName
;
120 extern const OSSymbol
* gIOPlatformSleepActionKey
;
121 extern const OSSymbol
* gIOPlatformWakeActionKey
;
122 extern const OSSymbol
* gIOPlatformQuiesceActionKey
;
123 extern const OSSymbol
* gIOPlatformActiveActionKey
;
124 extern const OSSymbol
* gIOPlatformHaltRestartActionKey
;
125 extern const OSSymbol
* gIOPlatformPanicActionKey
;
127 class IORangeAllocator
;
128 class IONVRAMController
;
129 class IOPMrootDomain
;
131 class IOPlatformExpert
: public IOService
133 OSDeclareDefaultStructors(IOPlatformExpert
);
141 IOPMrootDomain
* root
;
143 int _pePrivPMFeatures
;
144 int _peNumBatteriesSupported
;
145 OSArray
* thePowerTree
;
147 bool searchingForAdditionalParents
;
148 OSNumber
* multipleParentKeyValue
;
149 int numInstancesRegistered
;
151 struct ExpansionData
{ };
152 ExpansionData
*iope_reserved __unused
;
154 virtual void setBootROMType(long peBootROMType
);
155 virtual void setChipSetType(long peChipSetType
);
156 virtual void setMachineType(long peMachineType
);
158 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
159 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
161 virtual void PMInstantiatePowerDomains ( void );
164 virtual bool attach( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
165 virtual bool start( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
166 virtual bool configure( IOService
* provider
);
167 virtual IOService
* createNub( OSDictionary
* from
);
169 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
170 OSString
** matched
= 0 ) const;
171 virtual IOReturn
getNubResources( IOService
* nub
);
173 virtual long getBootROMType(void);
174 virtual long getChipSetType(void);
175 virtual long getMachineType(void);
177 virtual bool getModelName( char * name
, int maxLength
);
178 virtual bool getMachineName( char * name
, int maxLength
);
180 virtual int haltRestart(unsigned int type
);
181 virtual void sleepKernel(void);
183 virtual long getGMTTimeOfDay( void );
184 virtual void setGMTTimeOfDay( long secs
);
186 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
187 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
189 virtual void registerNVRAMController( IONVRAMController
* nvram
);
191 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
192 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
193 virtual void setCPUInterruptProperties(IOService
*service
);
194 virtual bool atInterruptLevel(void);
196 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
197 bool waitForFunction
,
198 void *param1
, void *param2
,
199 void *param3
, void *param4
) APPLE_KEXT_OVERRIDE
;
201 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
203 virtual bool platformAdjustService(IOService
*service
);
205 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
206 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
208 virtual bool hasPMFeature (unsigned long featureMask
);
209 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
210 virtual int numBatteriesSupported (void);
212 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
214 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
216 virtual IOReturn
deregisterInterruptController(OSSymbol
*name
);
218 virtual void getUTCTimeOfDay( clock_sec_t
* secs
, clock_nsec_t
* nsecs
);
219 virtual void setUTCTimeOfDay( clock_sec_t secs
, clock_nsec_t nsecs
);
221 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
222 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
223 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 2);
224 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 3);
225 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 4);
226 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
227 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
228 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
229 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
230 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
231 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
232 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
235 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
239 class IODTPlatformExpert
: public IOPlatformExpert
241 OSDeclareAbstractStructors(IODTPlatformExpert
);
246 struct ExpansionData
{ };
247 ExpansionData
*iodtpe_reserved
;
250 virtual IOService
* probe( IOService
* provider
,
251 SInt32
* score
) APPLE_KEXT_OVERRIDE
;
252 virtual bool configure( IOService
* provider
) APPLE_KEXT_OVERRIDE
;
254 virtual void processTopLevel( IORegistryEntry
* root
);
255 virtual const char * deleteList( void ) = 0;
256 virtual const char * excludeList( void ) = 0;
257 virtual IOService
* createNub( IORegistryEntry
* from
);
258 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
260 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
261 OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
263 virtual IOReturn
getNubResources( IOService
* nub
) APPLE_KEXT_OVERRIDE
;
265 virtual bool getModelName( char * name
, int maxLength
) APPLE_KEXT_OVERRIDE
;
266 virtual bool getMachineName( char * name
, int maxLength
) APPLE_KEXT_OVERRIDE
;
268 virtual void registerNVRAMController( IONVRAMController
* nvram
) APPLE_KEXT_OVERRIDE
;
270 virtual int haltRestart(unsigned int type
) APPLE_KEXT_OVERRIDE
;
272 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
275 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
278 virtual IOReturn
readNVRAMProperty(
279 IORegistryEntry
* entry
,
280 const OSSymbol
** name
, OSData
** value
);
282 virtual IOReturn
writeNVRAMProperty(
283 IORegistryEntry
* entry
,
284 const OSSymbol
* name
, OSData
* value
);
286 // This returns a dictionary describing all the NVRAM partitions.
287 // The keys will be the partitionIDs of the form "0x52,nvram".
288 // The values will be OSNumbers of the partition's byte count.
289 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
291 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
292 IOByteCount offset
, UInt8
* buffer
,
295 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
296 IOByteCount offset
, UInt8
* buffer
,
299 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
) APPLE_KEXT_OVERRIDE
;
300 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
) APPLE_KEXT_OVERRIDE
;
302 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
303 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
304 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
305 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
306 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
307 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
308 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
309 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
312 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
314 /* generic root nub of service tree */
316 class IOPlatformExpertDevice
: public IOService
318 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
321 IOWorkLoop
*workLoop
;
323 struct ExpansionData
{ };
324 ExpansionData
*ioped_reserved __unused
;
327 virtual bool initWithArgs( void * p1
, void * p2
,
328 void * p3
, void *p4
);
329 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
331 virtual IOWorkLoop
*getWorkLoop() const APPLE_KEXT_OVERRIDE
;
332 virtual IOReturn
setProperties( OSObject
* properties
) APPLE_KEXT_OVERRIDE
;
334 virtual void free() APPLE_KEXT_OVERRIDE
;
336 virtual IOReturn
newUserClient( task_t owningTask
, void * securityID
,
337 UInt32 type
, OSDictionary
* properties
,
338 IOUserClient
** handler
) APPLE_KEXT_OVERRIDE
;
341 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
342 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
343 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
344 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
347 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
349 /* generic nub for motherboard devices */
351 class IOPlatformDevice
: public IOService
353 OSDeclareDefaultStructors(IOPlatformDevice
)
355 struct ExpansionData
{ };
356 ExpansionData
*iopd_reserved
;
359 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const APPLE_KEXT_OVERRIDE
;
360 virtual IOService
* matchLocation( IOService
* client
) APPLE_KEXT_OVERRIDE
;
361 virtual IOReturn
getResources( void ) APPLE_KEXT_OVERRIDE
;
363 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
364 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
365 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
366 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
369 #endif /* __cplusplus */
371 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */