2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
38 #ifndef _IOKIT_IOPLATFORMEXPERT_H
39 #define _IOKIT_IOPLATFORMEXPERT_H
42 #include <IOKit/IOLib.h>
43 #include <IOKit/IOService.h>
44 #include <IOKit/IOInterrupts.h>
45 #include <IOKit/IOInterruptController.h>
50 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
51 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
52 extern int PEGetPlatformEpoch( void );
60 extern int (*PE_halt_restart
)(unsigned int type
);
61 extern int PEHaltRestart(unsigned int type
);
63 // Save the Panic Info. Returns the number of bytes saved.
64 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
66 extern long PEGetGMTTimeOfDay( void );
67 extern void PESetGMTTimeOfDay( long secs
);
72 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
74 extern OSSymbol
* gPlatformInterruptControllerName
;
76 class IORangeAllocator
;
77 class IONVRAMController
;
80 class IOPlatformExpert
: public IOService
82 OSDeclareDefaultStructors(IOPlatformExpert
);
90 IOPMrootDomain
* root
;
92 int _pePrivPMFeatures
;
93 int _peNumBatteriesSupported
;
94 OSArray
* thePowerTree
;
96 bool searchingForAdditionalParents
;
97 OSNumber
* multipleParentKeyValue
;
98 int numInstancesRegistered
;
100 struct ExpansionData
{ };
101 ExpansionData
*reserved
;
103 virtual void setBootROMType(long peBootROMType
);
104 virtual void setChipSetType(long peChipSetType
);
105 virtual void setMachineType(long peMachineType
);
107 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
108 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
110 virtual void PMInstantiatePowerDomains ( void );
113 virtual bool attach( IOService
* provider
);
114 virtual bool start( IOService
* provider
);
115 virtual bool configure( IOService
* provider
);
116 virtual IOService
* createNub( OSDictionary
* from
);
118 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
119 OSString
** matched
= 0 ) const;
120 virtual IOReturn
getNubResources( IOService
* nub
);
122 virtual long getBootROMType(void);
123 virtual long getChipSetType(void);
124 virtual long getMachineType(void);
126 virtual bool getModelName( char * name
, int maxLength
);
127 virtual bool getMachineName( char * name
, int maxLength
);
129 virtual int haltRestart(unsigned int type
);
130 virtual void sleepKernel(void);
132 virtual long getGMTTimeOfDay( void );
133 virtual void setGMTTimeOfDay( long secs
);
135 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
136 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
138 virtual void registerNVRAMController( IONVRAMController
* nvram
);
140 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
141 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
142 virtual void setCPUInterruptProperties(IOService
*service
);
143 virtual bool atInterruptLevel(void);
145 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
146 bool waitForFunction
,
147 void *param1
, void *param2
,
148 void *param3
, void *param4
);
150 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
152 virtual bool platformAdjustService(IOService
*service
);
154 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
155 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
157 virtual bool hasPMFeature (unsigned long featureMask
);
158 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
159 virtual int numBatteriesSupported (void);
161 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
163 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
165 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
166 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
168 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
169 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
170 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
171 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
172 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
173 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
174 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
175 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
176 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
179 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
183 class IODTPlatformExpert
: public IOPlatformExpert
185 OSDeclareAbstractStructors(IODTPlatformExpert
);
190 struct ExpansionData
{ };
191 ExpansionData
*reserved
;
194 virtual IOService
* probe( IOService
* provider
,
196 virtual bool configure( IOService
* provider
);
198 virtual void processTopLevel( IORegistryEntry
* root
);
199 virtual const char * deleteList( void ) = 0;
200 virtual const char * excludeList( void ) = 0;
201 virtual IOService
* createNub( IORegistryEntry
* from
);
202 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
204 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
205 OSString
** matched
= 0 ) const;
207 virtual IOReturn
getNubResources( IOService
* nub
);
209 virtual bool getModelName( char * name
, int maxLength
);
210 virtual bool getMachineName( char * name
, int maxLength
);
212 virtual void registerNVRAMController( IONVRAMController
* nvram
);
214 virtual int haltRestart(unsigned int type
);
216 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
219 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
222 virtual IOReturn
readNVRAMProperty(
223 IORegistryEntry
* entry
,
224 const OSSymbol
** name
, OSData
** value
);
226 virtual IOReturn
writeNVRAMProperty(
227 IORegistryEntry
* entry
,
228 const OSSymbol
* name
, OSData
* value
);
230 // This returns a dictionary describing all the NVRAM partitions.
231 // The keys will be the partitionIDs of the form "0x52,nvram".
232 // The values will be OSNumbers of the partition's byte count.
233 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
235 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
236 IOByteCount offset
, UInt8
* buffer
,
239 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
240 IOByteCount offset
, UInt8
* buffer
,
243 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
244 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
246 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
247 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
248 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
249 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
250 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
251 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
252 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
253 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
256 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
258 /* generic root nub of service tree */
260 class IOPlatformExpertDevice
: public IOService
262 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
265 IOWorkLoop
*workLoop
;
267 struct ExpansionData
{ };
268 ExpansionData
*reserved
;
271 virtual bool initWithArgs( void * p1
, void * p2
,
272 void * p3
, void *p4
);
273 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
275 virtual IOWorkLoop
*getWorkLoop() const;
279 virtual bool attachToChild( IORegistryEntry
* child
,
280 const IORegistryPlane
* plane
);
282 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
283 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
284 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
285 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
288 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
290 /* generic nub for motherboard devices */
292 class IOPlatformDevice
: public IOService
294 OSDeclareDefaultStructors(IOPlatformDevice
)
296 struct ExpansionData
{ };
297 ExpansionData
*reserved
;
300 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
301 virtual IOService
* matchLocation( IOService
* client
);
302 virtual IOReturn
getResources( void );
304 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
305 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
306 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
307 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
310 #endif /* __cplusplus */
312 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */