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
);
72 /* unless it's a "well-known" property, these will read/write out the value as raw data */
74 extern boolean_t
PEWriteNVRAMProperty(const char *symbol
, const void *value
, const unsigned int len
);
76 extern boolean_t
PEReadNVRAMProperty(const char *symbol
, void *value
, unsigned int *len
);
81 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
84 extern OSSymbol
* gPlatformInterruptControllerName
;
86 extern const OSSymbol
* gIOPlatformSleepActionKey
;
87 extern const OSSymbol
* gIOPlatformWakeActionKey
;
88 extern const OSSymbol
* gIOPlatformQuiesceActionKey
;
89 extern const OSSymbol
* gIOPlatformActiveActionKey
;
91 class IORangeAllocator
;
92 class IONVRAMController
;
95 class IOPlatformExpert
: public IOService
97 OSDeclareDefaultStructors(IOPlatformExpert
);
105 IOPMrootDomain
* root
;
107 int _pePrivPMFeatures
;
108 int _peNumBatteriesSupported
;
109 OSArray
* thePowerTree
;
111 bool searchingForAdditionalParents
;
112 OSNumber
* multipleParentKeyValue
;
113 int numInstancesRegistered
;
115 struct ExpansionData
{ };
116 ExpansionData
*reserved
;
118 virtual void setBootROMType(long peBootROMType
);
119 virtual void setChipSetType(long peChipSetType
);
120 virtual void setMachineType(long peMachineType
);
122 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
123 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
125 virtual void PMInstantiatePowerDomains ( void );
128 virtual bool attach( IOService
* provider
);
129 virtual bool start( IOService
* provider
);
130 virtual bool configure( IOService
* provider
);
131 virtual IOService
* createNub( OSDictionary
* from
);
133 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
134 OSString
** matched
= 0 ) const;
135 virtual IOReturn
getNubResources( IOService
* nub
);
137 virtual long getBootROMType(void);
138 virtual long getChipSetType(void);
139 virtual long getMachineType(void);
141 virtual bool getModelName( char * name
, int maxLength
);
142 virtual bool getMachineName( char * name
, int maxLength
);
144 virtual int haltRestart(unsigned int type
);
145 virtual void sleepKernel(void);
147 virtual long getGMTTimeOfDay( void );
148 virtual void setGMTTimeOfDay( long secs
);
150 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
151 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
153 virtual void registerNVRAMController( IONVRAMController
* nvram
);
155 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
156 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
157 virtual void setCPUInterruptProperties(IOService
*service
);
158 virtual bool atInterruptLevel(void);
160 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
161 bool waitForFunction
,
162 void *param1
, void *param2
,
163 void *param3
, void *param4
);
165 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
167 virtual bool platformAdjustService(IOService
*service
);
169 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
170 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
172 virtual bool hasPMFeature (unsigned long featureMask
);
173 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
174 virtual int numBatteriesSupported (void);
176 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
178 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
180 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
181 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
182 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
183 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
184 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
185 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
186 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
187 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
188 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
189 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
190 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
191 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
194 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
198 class IODTPlatformExpert
: public IOPlatformExpert
200 OSDeclareAbstractStructors(IODTPlatformExpert
);
205 struct ExpansionData
{ };
206 ExpansionData
*reserved
;
209 virtual IOService
* probe( IOService
* provider
,
211 virtual bool configure( IOService
* provider
);
213 virtual void processTopLevel( IORegistryEntry
* root
);
214 virtual const char * deleteList( void ) = 0;
215 virtual const char * excludeList( void ) = 0;
216 virtual IOService
* createNub( IORegistryEntry
* from
);
217 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
219 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
220 OSString
** matched
= 0 ) const;
222 virtual IOReturn
getNubResources( IOService
* nub
);
224 virtual bool getModelName( char * name
, int maxLength
);
225 virtual bool getMachineName( char * name
, int maxLength
);
227 virtual void registerNVRAMController( IONVRAMController
* nvram
);
229 virtual int haltRestart(unsigned int type
);
231 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
234 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
237 virtual IOReturn
readNVRAMProperty(
238 IORegistryEntry
* entry
,
239 const OSSymbol
** name
, OSData
** value
);
241 virtual IOReturn
writeNVRAMProperty(
242 IORegistryEntry
* entry
,
243 const OSSymbol
* name
, OSData
* value
);
245 // This returns a dictionary describing all the NVRAM partitions.
246 // The keys will be the partitionIDs of the form "0x52,nvram".
247 // The values will be OSNumbers of the partition's byte count.
248 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
250 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
251 IOByteCount offset
, UInt8
* buffer
,
254 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
255 IOByteCount offset
, UInt8
* buffer
,
258 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
259 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
261 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
262 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
263 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
264 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
265 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
266 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
267 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
268 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
271 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
273 /* generic root nub of service tree */
275 class IOPlatformExpertDevice
: public IOService
277 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
280 IOWorkLoop
*workLoop
;
282 struct ExpansionData
{ };
283 ExpansionData
*reserved
;
286 virtual bool initWithArgs( void * p1
, void * p2
,
287 void * p3
, void *p4
);
288 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
290 virtual IOWorkLoop
*getWorkLoop() const;
291 virtual IOReturn
setProperties( OSObject
* properties
);
295 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
296 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
297 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
298 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
301 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
303 /* generic nub for motherboard devices */
305 class IOPlatformDevice
: public IOService
307 OSDeclareDefaultStructors(IOPlatformDevice
)
309 struct ExpansionData
{ };
310 ExpansionData
*reserved
;
313 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
314 virtual IOService
* matchLocation( IOService
* client
);
315 virtual IOReturn
getResources( void );
317 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
318 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
319 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
320 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
323 #endif /* __cplusplus */
325 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */