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 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
49 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
50 extern int PEGetPlatformEpoch( void );
58 extern int (*PE_halt_restart
)(unsigned int type
);
59 extern int PEHaltRestart(unsigned int type
);
61 // Save the Panic Info. Returns the number of bytes saved.
62 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
64 extern long PEGetGMTTimeOfDay( void );
65 extern void PESetGMTTimeOfDay( long secs
);
70 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
72 extern OSSymbol
* gPlatformInterruptControllerName
;
74 class IORangeAllocator
;
75 class IONVRAMController
;
78 class IOPlatformExpert
: public IOService
80 OSDeclareDefaultStructors(IOPlatformExpert
);
88 IOPMrootDomain
* root
;
90 int _pePrivPMFeatures
;
91 int _peNumBatteriesSupported
;
92 OSArray
* thePowerTree
;
94 bool searchingForAdditionalParents
;
95 OSNumber
* multipleParentKeyValue
;
96 int numInstancesRegistered
;
98 struct ExpansionData
{ };
99 ExpansionData
*reserved
;
101 virtual void setBootROMType(long peBootROMType
);
102 virtual void setChipSetType(long peChipSetType
);
103 virtual void setMachineType(long peMachineType
);
105 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
106 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
108 virtual void PMInstantiatePowerDomains ( void );
111 virtual bool attach( IOService
* provider
);
112 virtual bool start( IOService
* provider
);
113 virtual bool configure( IOService
* provider
);
114 virtual IOService
* createNub( OSDictionary
* from
);
116 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
117 OSString
** matched
= 0 ) const;
118 virtual IOReturn
getNubResources( IOService
* nub
);
120 virtual long getBootROMType(void);
121 virtual long getChipSetType(void);
122 virtual long getMachineType(void);
124 virtual bool getModelName( char * name
, int maxLength
);
125 virtual bool getMachineName( char * name
, int maxLength
);
127 virtual int haltRestart(unsigned int type
);
128 virtual void sleepKernel(void);
130 virtual long getGMTTimeOfDay( void );
131 virtual void setGMTTimeOfDay( long secs
);
133 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
134 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
136 virtual void registerNVRAMController( IONVRAMController
* nvram
);
138 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
139 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
140 virtual void setCPUInterruptProperties(IOService
*service
);
141 virtual bool atInterruptLevel(void);
143 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
144 bool waitForFunction
,
145 void *param1
, void *param2
,
146 void *param3
, void *param4
);
148 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
150 virtual bool platformAdjustService(IOService
*service
);
152 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
153 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
155 virtual bool hasPMFeature (unsigned long featureMask
);
156 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
157 virtual int numBatteriesSupported (void);
159 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
161 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
163 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
164 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
165 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
166 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
168 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
169 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
170 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
171 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
172 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
173 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
174 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
177 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
181 class IODTPlatformExpert
: public IOPlatformExpert
183 OSDeclareAbstractStructors(IODTPlatformExpert
);
188 struct ExpansionData
{ };
189 ExpansionData
*reserved
;
192 virtual IOService
* probe( IOService
* provider
,
194 virtual bool configure( IOService
* provider
);
196 virtual void processTopLevel( IORegistryEntry
* root
);
197 virtual const char * deleteList( void ) = 0;
198 virtual const char * excludeList( void ) = 0;
199 virtual IOService
* createNub( IORegistryEntry
* from
);
200 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
202 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
203 OSString
** matched
= 0 ) const;
205 virtual IOReturn
getNubResources( IOService
* nub
);
207 virtual bool getModelName( char * name
, int maxLength
);
208 virtual bool getMachineName( char * name
, int maxLength
);
210 virtual void registerNVRAMController( IONVRAMController
* nvram
);
212 virtual int haltRestart(unsigned int type
);
214 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
217 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
220 virtual IOReturn
readNVRAMProperty(
221 IORegistryEntry
* entry
,
222 const OSSymbol
** name
, OSData
** value
);
224 virtual IOReturn
writeNVRAMProperty(
225 IORegistryEntry
* entry
,
226 const OSSymbol
* name
, OSData
* value
);
228 // This returns a dictionary describing all the NVRAM partitions.
229 // The keys will be the partitionIDs of the form "0x52,nvram".
230 // The values will be OSNumbers of the partition's byte count.
231 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
233 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
234 IOByteCount offset
, UInt8
* buffer
,
237 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
238 IOByteCount offset
, UInt8
* buffer
,
241 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
242 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
244 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
245 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
246 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
247 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
248 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
249 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
250 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
251 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
254 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
256 /* generic root nub of service tree */
258 class IOPlatformExpertDevice
: public IOService
260 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
263 IOWorkLoop
*workLoop
;
265 struct ExpansionData
{ };
266 ExpansionData
*reserved
;
269 virtual bool initWithArgs( void * p1
, void * p2
,
270 void * p3
, void *p4
);
271 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
273 virtual IOWorkLoop
*getWorkLoop() const;
277 virtual bool attachToChild( IORegistryEntry
* child
,
278 const IORegistryPlane
* plane
);
280 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
281 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
282 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
283 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
286 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
288 /* generic nub for motherboard devices */
290 class IOPlatformDevice
: public IOService
292 OSDeclareDefaultStructors(IOPlatformDevice
)
294 struct ExpansionData
{ };
295 ExpansionData
*reserved
;
298 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
299 virtual IOService
* matchLocation( IOService
* client
);
300 virtual IOReturn
getResources( void );
302 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
303 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
304 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
305 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
308 #endif /* __cplusplus */
310 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */