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
PEWriteNVRAMProperty(const char *symbol
, const void *value
, const unsigned int len
);
78 extern boolean_t
PEReadNVRAMProperty(const char *symbol
, void *value
, unsigned int *len
);
80 extern boolean_t
PERemoveNVRAMProperty(const char *symbol
);
85 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
88 extern OSSymbol
* gPlatformInterruptControllerName
;
90 extern const OSSymbol
* gIOPlatformSleepActionKey
;
91 extern const OSSymbol
* gIOPlatformWakeActionKey
;
92 extern const OSSymbol
* gIOPlatformQuiesceActionKey
;
93 extern const OSSymbol
* gIOPlatformActiveActionKey
;
94 extern const OSSymbol
* gIOPlatformHaltRestartActionKey
;
96 class IORangeAllocator
;
97 class IONVRAMController
;
100 class IOPlatformExpert
: public IOService
102 OSDeclareDefaultStructors(IOPlatformExpert
);
110 IOPMrootDomain
* root
;
112 int _pePrivPMFeatures
;
113 int _peNumBatteriesSupported
;
114 OSArray
* thePowerTree
;
116 bool searchingForAdditionalParents
;
117 OSNumber
* multipleParentKeyValue
;
118 int numInstancesRegistered
;
120 struct ExpansionData
{ };
121 ExpansionData
*reserved
;
123 virtual void setBootROMType(long peBootROMType
);
124 virtual void setChipSetType(long peChipSetType
);
125 virtual void setMachineType(long peMachineType
);
127 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
128 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
130 virtual void PMInstantiatePowerDomains ( void );
133 virtual bool attach( IOService
* provider
);
134 virtual bool start( IOService
* provider
);
135 virtual bool configure( IOService
* provider
);
136 virtual IOService
* createNub( OSDictionary
* from
);
138 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
139 OSString
** matched
= 0 ) const;
140 virtual IOReturn
getNubResources( IOService
* nub
);
142 virtual long getBootROMType(void);
143 virtual long getChipSetType(void);
144 virtual long getMachineType(void);
146 virtual bool getModelName( char * name
, int maxLength
);
147 virtual bool getMachineName( char * name
, int maxLength
);
149 virtual int haltRestart(unsigned int type
);
150 virtual void sleepKernel(void);
152 virtual long getGMTTimeOfDay( void );
153 virtual void setGMTTimeOfDay( long secs
);
155 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
156 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
158 virtual void registerNVRAMController( IONVRAMController
* nvram
);
160 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
161 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
162 virtual void setCPUInterruptProperties(IOService
*service
);
163 virtual bool atInterruptLevel(void);
165 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
166 bool waitForFunction
,
167 void *param1
, void *param2
,
168 void *param3
, void *param4
);
170 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
172 virtual bool platformAdjustService(IOService
*service
);
174 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
175 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
177 virtual bool hasPMFeature (unsigned long featureMask
);
178 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
179 virtual int numBatteriesSupported (void);
181 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
183 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
185 virtual IOReturn
deregisterInterruptController(OSSymbol
*name
);
187 virtual void getUTCTimeOfDay( clock_sec_t
* secs
, clock_nsec_t
* nsecs
);
188 virtual void setUTCTimeOfDay( clock_sec_t secs
, clock_nsec_t nsecs
);
190 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
191 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
192 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 2);
193 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 3);
194 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 4);
195 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
196 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
197 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
198 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
199 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
200 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
201 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
204 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
208 class IODTPlatformExpert
: public IOPlatformExpert
210 OSDeclareAbstractStructors(IODTPlatformExpert
);
215 struct ExpansionData
{ };
216 ExpansionData
*reserved
;
219 virtual IOService
* probe( IOService
* provider
,
221 virtual bool configure( IOService
* provider
);
223 virtual void processTopLevel( IORegistryEntry
* root
);
224 virtual const char * deleteList( void ) = 0;
225 virtual const char * excludeList( void ) = 0;
226 virtual IOService
* createNub( IORegistryEntry
* from
);
227 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
229 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
230 OSString
** matched
= 0 ) const;
232 virtual IOReturn
getNubResources( IOService
* nub
);
234 virtual bool getModelName( char * name
, int maxLength
);
235 virtual bool getMachineName( char * name
, int maxLength
);
237 virtual void registerNVRAMController( IONVRAMController
* nvram
);
239 virtual int haltRestart(unsigned int type
);
241 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
244 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
247 virtual IOReturn
readNVRAMProperty(
248 IORegistryEntry
* entry
,
249 const OSSymbol
** name
, OSData
** value
);
251 virtual IOReturn
writeNVRAMProperty(
252 IORegistryEntry
* entry
,
253 const OSSymbol
* name
, OSData
* value
);
255 // This returns a dictionary describing all the NVRAM partitions.
256 // The keys will be the partitionIDs of the form "0x52,nvram".
257 // The values will be OSNumbers of the partition's byte count.
258 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
260 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
261 IOByteCount offset
, UInt8
* buffer
,
264 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
265 IOByteCount offset
, UInt8
* buffer
,
268 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
269 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
271 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
272 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
273 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
274 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
275 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
276 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
277 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
278 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
281 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
283 /* generic root nub of service tree */
285 class IOPlatformExpertDevice
: public IOService
287 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
290 IOWorkLoop
*workLoop
;
292 struct ExpansionData
{ };
293 ExpansionData
*reserved
;
296 virtual bool initWithArgs( void * p1
, void * p2
,
297 void * p3
, void *p4
);
298 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
300 virtual IOWorkLoop
*getWorkLoop() const;
301 virtual IOReturn
setProperties( OSObject
* properties
);
305 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
306 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
307 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
308 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
311 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
313 /* generic nub for motherboard devices */
315 class IOPlatformDevice
: public IOService
317 OSDeclareDefaultStructors(IOPlatformDevice
)
319 struct ExpansionData
{ };
320 ExpansionData
*reserved
;
323 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
324 virtual IOService
* matchLocation( IOService
* client
);
325 virtual IOReturn
getResources( void );
327 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
328 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
329 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
330 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
333 #endif /* __cplusplus */
335 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */