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 );
62 extern int (*PE_halt_restart
)(unsigned int type
);
63 extern int PEHaltRestart(unsigned int type
);
65 // Save the Panic Info. Returns the number of bytes saved.
66 extern UInt32
PESavePanicInfo(UInt8
*buffer
, UInt32 length
);
68 extern long PEGetGMTTimeOfDay( void );
69 extern void PESetGMTTimeOfDay( long secs
);
74 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
77 extern OSSymbol
* gPlatformInterruptControllerName
;
79 extern const OSSymbol
* gIOPlatformSleepActionKey
;
80 extern const OSSymbol
* gIOPlatformWakeActionKey
;
81 extern const OSSymbol
* gIOPlatformQuiesceActionKey
;
82 extern const OSSymbol
* gIOPlatformActiveActionKey
;
84 class IORangeAllocator
;
85 class IONVRAMController
;
88 class IOPlatformExpert
: public IOService
90 OSDeclareDefaultStructors(IOPlatformExpert
);
98 IOPMrootDomain
* root
;
100 int _pePrivPMFeatures
;
101 int _peNumBatteriesSupported
;
102 OSArray
* thePowerTree
;
104 bool searchingForAdditionalParents
;
105 OSNumber
* multipleParentKeyValue
;
106 int numInstancesRegistered
;
108 struct ExpansionData
{ };
109 ExpansionData
*reserved
;
111 virtual void setBootROMType(long peBootROMType
);
112 virtual void setChipSetType(long peChipSetType
);
113 virtual void setMachineType(long peMachineType
);
115 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
116 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
118 virtual void PMInstantiatePowerDomains ( void );
121 virtual bool attach( IOService
* provider
);
122 virtual bool start( IOService
* provider
);
123 virtual bool configure( IOService
* provider
);
124 virtual IOService
* createNub( OSDictionary
* from
);
126 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
127 OSString
** matched
= 0 ) const;
128 virtual IOReturn
getNubResources( IOService
* nub
);
130 virtual long getBootROMType(void);
131 virtual long getChipSetType(void);
132 virtual long getMachineType(void);
134 virtual bool getModelName( char * name
, int maxLength
);
135 virtual bool getMachineName( char * name
, int maxLength
);
137 virtual int haltRestart(unsigned int type
);
138 virtual void sleepKernel(void);
140 virtual long getGMTTimeOfDay( void );
141 virtual void setGMTTimeOfDay( long secs
);
143 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
144 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
146 virtual void registerNVRAMController( IONVRAMController
* nvram
);
148 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
149 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
150 virtual void setCPUInterruptProperties(IOService
*service
);
151 virtual bool atInterruptLevel(void);
153 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
154 bool waitForFunction
,
155 void *param1
, void *param2
,
156 void *param3
, void *param4
);
158 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
160 virtual bool platformAdjustService(IOService
*service
);
162 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
163 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
165 virtual bool hasPMFeature (unsigned long featureMask
);
166 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
167 virtual int numBatteriesSupported (void);
169 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
171 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
173 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
174 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
175 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
176 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
177 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
178 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
179 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
180 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
181 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
182 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
183 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
184 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
187 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
191 class IODTPlatformExpert
: public IOPlatformExpert
193 OSDeclareAbstractStructors(IODTPlatformExpert
);
198 struct ExpansionData
{ };
199 ExpansionData
*reserved
;
202 virtual IOService
* probe( IOService
* provider
,
204 virtual bool configure( IOService
* provider
);
206 virtual void processTopLevel( IORegistryEntry
* root
);
207 virtual const char * deleteList( void ) = 0;
208 virtual const char * excludeList( void ) = 0;
209 virtual IOService
* createNub( IORegistryEntry
* from
);
210 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
212 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
213 OSString
** matched
= 0 ) const;
215 virtual IOReturn
getNubResources( IOService
* nub
);
217 virtual bool getModelName( char * name
, int maxLength
);
218 virtual bool getMachineName( char * name
, int maxLength
);
220 virtual void registerNVRAMController( IONVRAMController
* nvram
);
222 virtual int haltRestart(unsigned int type
);
224 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
227 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
230 virtual IOReturn
readNVRAMProperty(
231 IORegistryEntry
* entry
,
232 const OSSymbol
** name
, OSData
** value
);
234 virtual IOReturn
writeNVRAMProperty(
235 IORegistryEntry
* entry
,
236 const OSSymbol
* name
, OSData
* value
);
238 // This returns a dictionary describing all the NVRAM partitions.
239 // The keys will be the partitionIDs of the form "0x52,nvram".
240 // The values will be OSNumbers of the partition's byte count.
241 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
243 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
244 IOByteCount offset
, UInt8
* buffer
,
247 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
248 IOByteCount offset
, UInt8
* buffer
,
251 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
252 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
254 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
255 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
256 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
257 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
258 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
259 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
260 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
261 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
264 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
266 /* generic root nub of service tree */
268 class IOPlatformExpertDevice
: public IOService
270 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
273 IOWorkLoop
*workLoop
;
275 struct ExpansionData
{ };
276 ExpansionData
*reserved
;
279 virtual bool initWithArgs( void * p1
, void * p2
,
280 void * p3
, void *p4
);
281 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
283 virtual IOWorkLoop
*getWorkLoop() const;
284 virtual IOReturn
setProperties( OSObject
* properties
);
288 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
289 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
290 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
291 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
294 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
296 /* generic nub for motherboard devices */
298 class IOPlatformDevice
: public IOService
300 OSDeclareDefaultStructors(IOPlatformDevice
)
302 struct ExpansionData
{ };
303 ExpansionData
*reserved
;
306 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
307 virtual IOService
* matchLocation( IOService
* client
);
308 virtual IOReturn
getResources( void );
310 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
311 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
312 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
313 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
316 #endif /* __cplusplus */
318 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */