2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
33 #ifndef _IOKIT_IOPLATFORMEXPERT_H
34 #define _IOKIT_IOPLATFORMEXPERT_H
37 #include <IOKit/IOLib.h>
38 #include <IOKit/IOService.h>
39 #include <IOKit/IOInterrupts.h>
40 #include <IOKit/IOInterruptController.h>
45 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
46 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
47 extern int PEGetPlatformEpoch( void );
54 extern int (*PE_halt_restart
)(unsigned int type
);
55 extern int PEHaltRestart(unsigned int type
);
57 // Save the Panic Info. Returns the number of bytes saved.
58 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
60 extern long PEGetGMTTimeOfDay( void );
61 extern void PESetGMTTimeOfDay( long secs
);
66 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
68 extern OSSymbol
* gPlatformInterruptControllerName
;
70 class IORangeAllocator
;
71 class IONVRAMController
;
74 class IOPlatformExpert
: public IOService
76 OSDeclareDefaultStructors(IOPlatformExpert
);
84 IOPMrootDomain
* root
;
86 int _pePrivPMFeatures
;
87 int _peNumBatteriesSupported
;
88 OSArray
* thePowerTree
;
90 bool searchingForAdditionalParents
;
91 OSNumber
* multipleParentKeyValue
;
92 int numInstancesRegistered
;
94 struct ExpansionData
{ };
95 ExpansionData
*reserved
;
97 virtual void setBootROMType(long peBootROMType
);
98 virtual void setChipSetType(long peChipSetType
);
99 virtual void setMachineType(long peMachineType
);
101 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
102 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
104 virtual void PMInstantiatePowerDomains ( void );
107 virtual bool attach( IOService
* provider
);
108 virtual bool start( IOService
* provider
);
109 virtual bool configure( IOService
* provider
);
110 virtual IOService
* createNub( OSDictionary
* from
);
112 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
113 OSString
** matched
= 0 ) const;
114 virtual IOReturn
getNubResources( IOService
* nub
);
116 virtual long getBootROMType(void);
117 virtual long getChipSetType(void);
118 virtual long getMachineType(void);
120 virtual bool getModelName( char * name
, int maxLength
);
121 virtual bool getMachineName( char * name
, int maxLength
);
123 virtual int haltRestart(unsigned int type
);
124 virtual void sleepKernel(void);
126 virtual long getGMTTimeOfDay( void );
127 virtual void setGMTTimeOfDay( long secs
);
129 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
130 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
132 virtual void registerNVRAMController( IONVRAMController
* nvram
);
134 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
135 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
136 virtual void setCPUInterruptProperties(IOService
*service
);
137 virtual bool atInterruptLevel(void);
139 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
140 bool waitForFunction
,
141 void *param1
, void *param2
,
142 void *param3
, void *param4
);
144 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
146 virtual bool platformAdjustService(IOService
*service
);
148 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
149 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
151 virtual bool hasPMFeature (unsigned long featureMask
);
152 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
153 virtual int numBatteriesSupported (void);
155 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
157 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
159 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 1);
160 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
161 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
162 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
163 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
164 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
165 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
166 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
168 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
169 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
172 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
176 class IODTPlatformExpert
: public IOPlatformExpert
178 OSDeclareAbstractStructors(IODTPlatformExpert
);
183 struct ExpansionData
{ };
184 ExpansionData
*reserved
;
187 virtual IOService
* probe( IOService
* provider
,
189 virtual bool configure( IOService
* provider
);
191 virtual void processTopLevel( IORegistryEntry
* root
);
192 virtual const char * deleteList( void ) = 0;
193 virtual const char * excludeList( void ) = 0;
194 virtual IOService
* createNub( IORegistryEntry
* from
);
195 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
197 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
198 OSString
** matched
= 0 ) const;
200 virtual IOReturn
getNubResources( IOService
* nub
);
202 virtual bool getModelName( char * name
, int maxLength
);
203 virtual bool getMachineName( char * name
, int maxLength
);
205 virtual void registerNVRAMController( IONVRAMController
* nvram
);
207 virtual int haltRestart(unsigned int type
);
209 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
212 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
215 virtual IOReturn
readNVRAMProperty(
216 IORegistryEntry
* entry
,
217 const OSSymbol
** name
, OSData
** value
);
219 virtual IOReturn
writeNVRAMProperty(
220 IORegistryEntry
* entry
,
221 const OSSymbol
* name
, OSData
* value
);
223 // This returns a dictionary describing all the NVRAM partitions.
224 // The keys will be the partitionIDs of the form "0x52,nvram".
225 // The values will be OSNumbers of the partition's byte count.
226 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
228 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
229 IOByteCount offset
, UInt8
* buffer
,
232 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
233 IOByteCount offset
, UInt8
* buffer
,
236 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
238 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
239 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
240 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
241 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
242 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
243 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
244 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
245 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
248 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
250 /* generic root nub of service tree */
252 class IOPlatformExpertDevice
: public IOService
254 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
257 IOWorkLoop
*workLoop
;
259 struct ExpansionData
{ };
260 ExpansionData
*reserved
;
263 virtual bool initWithArgs( void * p1
, void * p2
,
264 void * p3
, void *p4
);
265 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
267 virtual IOWorkLoop
*getWorkLoop() const;
271 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
272 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
273 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
274 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
277 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
279 /* generic nub for motherboard devices */
281 class IOPlatformDevice
: public IOService
283 OSDeclareDefaultStructors(IOPlatformDevice
)
285 struct ExpansionData
{ };
286 ExpansionData
*reserved
;
289 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
290 virtual IOService
* matchLocation( IOService
* client
);
291 virtual IOReturn
getResources( void );
293 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
294 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
295 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
296 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
299 #endif /* __cplusplus */
301 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */