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
);
78 extern boolean_t
PERemoveNVRAMProperty(const char *symbol
);
83 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
86 extern OSSymbol
* gPlatformInterruptControllerName
;
88 extern const OSSymbol
* gIOPlatformSleepActionKey
;
89 extern const OSSymbol
* gIOPlatformWakeActionKey
;
90 extern const OSSymbol
* gIOPlatformQuiesceActionKey
;
91 extern const OSSymbol
* gIOPlatformActiveActionKey
;
93 class IORangeAllocator
;
94 class IONVRAMController
;
97 class IOPlatformExpert
: public IOService
99 OSDeclareDefaultStructors(IOPlatformExpert
);
107 IOPMrootDomain
* root
;
109 int _pePrivPMFeatures
;
110 int _peNumBatteriesSupported
;
111 OSArray
* thePowerTree
;
113 bool searchingForAdditionalParents
;
114 OSNumber
* multipleParentKeyValue
;
115 int numInstancesRegistered
;
117 struct ExpansionData
{ };
118 ExpansionData
*reserved
;
120 virtual void setBootROMType(long peBootROMType
);
121 virtual void setChipSetType(long peChipSetType
);
122 virtual void setMachineType(long peMachineType
);
124 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
125 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
127 virtual void PMInstantiatePowerDomains ( void );
130 virtual bool attach( IOService
* provider
);
131 virtual bool start( IOService
* provider
);
132 virtual bool configure( IOService
* provider
);
133 virtual IOService
* createNub( OSDictionary
* from
);
135 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
136 OSString
** matched
= 0 ) const;
137 virtual IOReturn
getNubResources( IOService
* nub
);
139 virtual long getBootROMType(void);
140 virtual long getChipSetType(void);
141 virtual long getMachineType(void);
143 virtual bool getModelName( char * name
, int maxLength
);
144 virtual bool getMachineName( char * name
, int maxLength
);
146 virtual int haltRestart(unsigned int type
);
147 virtual void sleepKernel(void);
149 virtual long getGMTTimeOfDay( void );
150 virtual void setGMTTimeOfDay( long secs
);
152 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
153 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
155 virtual void registerNVRAMController( IONVRAMController
* nvram
);
157 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
158 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
159 virtual void setCPUInterruptProperties(IOService
*service
);
160 virtual bool atInterruptLevel(void);
162 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
163 bool waitForFunction
,
164 void *param1
, void *param2
,
165 void *param3
, void *param4
);
167 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
169 virtual bool platformAdjustService(IOService
*service
);
171 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
172 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
174 virtual bool hasPMFeature (unsigned long featureMask
);
175 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
176 virtual int numBatteriesSupported (void);
178 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
180 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
182 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
183 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
184 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
185 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
186 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
187 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
188 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
189 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
190 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
191 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
192 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
193 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
196 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
200 class IODTPlatformExpert
: public IOPlatformExpert
202 OSDeclareAbstractStructors(IODTPlatformExpert
);
207 struct ExpansionData
{ };
208 ExpansionData
*reserved
;
211 virtual IOService
* probe( IOService
* provider
,
213 virtual bool configure( IOService
* provider
);
215 virtual void processTopLevel( IORegistryEntry
* root
);
216 virtual const char * deleteList( void ) = 0;
217 virtual const char * excludeList( void ) = 0;
218 virtual IOService
* createNub( IORegistryEntry
* from
);
219 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
221 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
222 OSString
** matched
= 0 ) const;
224 virtual IOReturn
getNubResources( IOService
* nub
);
226 virtual bool getModelName( char * name
, int maxLength
);
227 virtual bool getMachineName( char * name
, int maxLength
);
229 virtual void registerNVRAMController( IONVRAMController
* nvram
);
231 virtual int haltRestart(unsigned int type
);
233 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
236 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
239 virtual IOReturn
readNVRAMProperty(
240 IORegistryEntry
* entry
,
241 const OSSymbol
** name
, OSData
** value
);
243 virtual IOReturn
writeNVRAMProperty(
244 IORegistryEntry
* entry
,
245 const OSSymbol
* name
, OSData
* value
);
247 // This returns a dictionary describing all the NVRAM partitions.
248 // The keys will be the partitionIDs of the form "0x52,nvram".
249 // The values will be OSNumbers of the partition's byte count.
250 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
252 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
253 IOByteCount offset
, UInt8
* buffer
,
256 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
257 IOByteCount offset
, UInt8
* buffer
,
260 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
261 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
263 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
264 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
265 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
266 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
267 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
268 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
269 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
270 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
273 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
275 /* generic root nub of service tree */
277 class IOPlatformExpertDevice
: public IOService
279 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
282 IOWorkLoop
*workLoop
;
284 struct ExpansionData
{ };
285 ExpansionData
*reserved
;
288 virtual bool initWithArgs( void * p1
, void * p2
,
289 void * p3
, void *p4
);
290 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
292 virtual IOWorkLoop
*getWorkLoop() const;
293 virtual IOReturn
setProperties( OSObject
* properties
);
297 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
298 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
299 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
300 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
303 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
305 /* generic nub for motherboard devices */
307 class IOPlatformDevice
: public IOService
309 OSDeclareDefaultStructors(IOPlatformDevice
)
311 struct ExpansionData
{ };
312 ExpansionData
*reserved
;
315 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
316 virtual IOService
* matchLocation( IOService
* client
);
317 virtual IOReturn
getResources( void );
319 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
320 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
321 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
322 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
325 #endif /* __cplusplus */
327 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */