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 extern OSSymbol
* gPlatformInterruptControllerName
;
68 class IORangeAllocator
;
69 class IONVRAMController
;
72 class IOPlatformExpert
: public IOService
74 OSDeclareDefaultStructors(IOPlatformExpert
);
82 IOPMrootDomain
* root
;
84 int _pePrivPMFeatures
;
85 int _peNumBatteriesSupported
;
86 OSArray
* thePowerTree
;
88 bool searchingForAdditionalParents
;
89 OSNumber
* multipleParentKeyValue
;
90 int numInstancesRegistered
;
92 struct ExpansionData
{ };
93 ExpansionData
*reserved
;
95 virtual void setBootROMType(long peBootROMType
);
96 virtual void setChipSetType(long peChipSetType
);
97 virtual void setMachineType(long peMachineType
);
99 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
100 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
102 virtual void PMInstantiatePowerDomains ( void );
105 virtual bool attach( IOService
* provider
);
106 virtual bool start( IOService
* provider
);
107 virtual bool configure( IOService
* provider
);
108 virtual IOService
* createNub( OSDictionary
* from
);
110 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
111 OSString
** matched
= 0 ) const;
112 virtual IOReturn
getNubResources( IOService
* nub
);
114 virtual long getBootROMType(void);
115 virtual long getChipSetType(void);
116 virtual long getMachineType(void);
118 virtual bool getModelName( char * name
, int maxLength
);
119 virtual bool getMachineName( char * name
, int maxLength
);
121 virtual int haltRestart(unsigned int type
);
122 virtual void sleepKernel(void);
124 virtual long getGMTTimeOfDay( void );
125 virtual void setGMTTimeOfDay( long secs
);
127 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
128 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
130 virtual void registerNVRAMController( IONVRAMController
* nvram
);
132 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
133 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
134 virtual void setCPUInterruptProperties(IOService
*service
);
135 virtual bool atInterruptLevel(void);
137 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
138 bool waitForFunction
,
139 void *param1
, void *param2
,
140 void *param3
, void *param4
);
142 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
144 virtual bool platformAdjustService(IOService
*service
);
146 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
147 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
149 virtual bool hasPMFeature (unsigned long featureMask
);
150 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
151 virtual int numBatteriesSupported (void);
153 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
155 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
157 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 1);
158 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
159 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
160 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
161 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
162 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
163 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
164 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
165 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
166 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
170 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
174 class IODTPlatformExpert
: public IOPlatformExpert
176 OSDeclareAbstractStructors(IODTPlatformExpert
);
181 struct ExpansionData
{ };
182 ExpansionData
*reserved
;
185 virtual IOService
* probe( IOService
* provider
,
187 virtual bool configure( IOService
* provider
);
189 virtual void processTopLevel( IORegistryEntry
* root
);
190 virtual const char * deleteList( void ) = 0;
191 virtual const char * excludeList( void ) = 0;
192 virtual IOService
* createNub( IORegistryEntry
* from
);
193 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
195 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
196 OSString
** matched
= 0 ) const;
198 virtual IOReturn
getNubResources( IOService
* nub
);
200 virtual bool getModelName( char * name
, int maxLength
);
201 virtual bool getMachineName( char * name
, int maxLength
);
203 virtual void registerNVRAMController( IONVRAMController
* nvram
);
205 virtual int haltRestart(unsigned int type
);
207 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
210 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
213 virtual IOReturn
readNVRAMProperty(
214 IORegistryEntry
* entry
,
215 const OSSymbol
** name
, OSData
** value
);
217 virtual IOReturn
writeNVRAMProperty(
218 IORegistryEntry
* entry
,
219 const OSSymbol
* name
, OSData
* value
);
221 // This returns a dictionary describing all the NVRAM partitions.
222 // The keys will be the partitionIDs of the form "0x52,nvram".
223 // The values will be OSNumbers of the partition's byte count.
224 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
226 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
227 IOByteCount offset
, UInt8
* buffer
,
230 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
231 IOByteCount offset
, UInt8
* buffer
,
234 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
236 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
237 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
238 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
239 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
240 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
241 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
242 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
243 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
246 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
248 /* generic root nub of service tree */
250 class IOPlatformExpertDevice
: public IOService
252 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
255 IOWorkLoop
*workLoop
;
257 struct ExpansionData
{ };
258 ExpansionData
*reserved
;
261 virtual bool initWithArgs( void * p1
, void * p2
,
262 void * p3
, void *p4
);
263 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
265 virtual IOWorkLoop
*getWorkLoop() const;
269 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
270 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
271 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
272 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
275 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
277 /* generic nub for motherboard devices */
279 class IOPlatformDevice
: public IOService
281 OSDeclareDefaultStructors(IOPlatformDevice
)
283 struct ExpansionData
{ };
284 ExpansionData
*reserved
;
287 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
288 virtual IOService
* matchLocation( IOService
* client
);
289 virtual IOReturn
getResources( void );
291 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
292 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
293 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
294 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
297 #endif /* __cplusplus */
299 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */