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 );
59 extern int (*PE_halt_restart
)(unsigned int type
);
60 extern int PEHaltRestart(unsigned int type
);
62 // Save the Panic Info. Returns the number of bytes saved.
63 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
65 extern long PEGetGMTTimeOfDay( void );
66 extern void PESetGMTTimeOfDay( long secs
);
71 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
73 extern OSSymbol
* gPlatformInterruptControllerName
;
75 class IORangeAllocator
;
76 class IONVRAMController
;
79 class IOPlatformExpert
: public IOService
81 OSDeclareDefaultStructors(IOPlatformExpert
);
89 IOPMrootDomain
* root
;
91 int _pePrivPMFeatures
;
92 int _peNumBatteriesSupported
;
93 OSArray
* thePowerTree
;
95 bool searchingForAdditionalParents
;
96 OSNumber
* multipleParentKeyValue
;
97 int numInstancesRegistered
;
99 struct ExpansionData
{ };
100 ExpansionData
*reserved
;
102 virtual void setBootROMType(long peBootROMType
);
103 virtual void setChipSetType(long peChipSetType
);
104 virtual void setMachineType(long peMachineType
);
106 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
107 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
109 virtual void PMInstantiatePowerDomains ( void );
112 virtual bool attach( IOService
* provider
);
113 virtual bool start( IOService
* provider
);
114 virtual bool configure( IOService
* provider
);
115 virtual IOService
* createNub( OSDictionary
* from
);
117 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
118 OSString
** matched
= 0 ) const;
119 virtual IOReturn
getNubResources( IOService
* nub
);
121 virtual long getBootROMType(void);
122 virtual long getChipSetType(void);
123 virtual long getMachineType(void);
125 virtual bool getModelName( char * name
, int maxLength
);
126 virtual bool getMachineName( char * name
, int maxLength
);
128 virtual int haltRestart(unsigned int type
);
129 virtual void sleepKernel(void);
131 virtual long getGMTTimeOfDay( void );
132 virtual void setGMTTimeOfDay( long secs
);
134 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
135 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
137 virtual void registerNVRAMController( IONVRAMController
* nvram
);
139 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
140 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
141 virtual void setCPUInterruptProperties(IOService
*service
);
142 virtual bool atInterruptLevel(void);
144 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
145 bool waitForFunction
,
146 void *param1
, void *param2
,
147 void *param3
, void *param4
);
149 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
151 virtual bool platformAdjustService(IOService
*service
);
153 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
154 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
156 virtual bool hasPMFeature (unsigned long featureMask
);
157 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
158 virtual int numBatteriesSupported (void);
160 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
162 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
164 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
165 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
166 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
168 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
169 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
170 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
171 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
172 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
173 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
174 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
175 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
178 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
182 class IODTPlatformExpert
: public IOPlatformExpert
184 OSDeclareAbstractStructors(IODTPlatformExpert
);
189 struct ExpansionData
{ };
190 ExpansionData
*reserved
;
193 virtual IOService
* probe( IOService
* provider
,
195 virtual bool configure( IOService
* provider
);
197 virtual void processTopLevel( IORegistryEntry
* root
);
198 virtual const char * deleteList( void ) = 0;
199 virtual const char * excludeList( void ) = 0;
200 virtual IOService
* createNub( IORegistryEntry
* from
);
201 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
203 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
204 OSString
** matched
= 0 ) const;
206 virtual IOReturn
getNubResources( IOService
* nub
);
208 virtual bool getModelName( char * name
, int maxLength
);
209 virtual bool getMachineName( char * name
, int maxLength
);
211 virtual void registerNVRAMController( IONVRAMController
* nvram
);
213 virtual int haltRestart(unsigned int type
);
215 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
218 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
221 virtual IOReturn
readNVRAMProperty(
222 IORegistryEntry
* entry
,
223 const OSSymbol
** name
, OSData
** value
);
225 virtual IOReturn
writeNVRAMProperty(
226 IORegistryEntry
* entry
,
227 const OSSymbol
* name
, OSData
* value
);
229 // This returns a dictionary describing all the NVRAM partitions.
230 // The keys will be the partitionIDs of the form "0x52,nvram".
231 // The values will be OSNumbers of the partition's byte count.
232 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
234 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
235 IOByteCount offset
, UInt8
* buffer
,
238 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
239 IOByteCount offset
, UInt8
* buffer
,
242 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
243 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
245 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
246 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
247 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
248 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
249 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
250 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
251 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
252 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
255 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
257 /* generic root nub of service tree */
259 class IOPlatformExpertDevice
: public IOService
261 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
264 IOWorkLoop
*workLoop
;
266 struct ExpansionData
{ };
267 ExpansionData
*reserved
;
270 virtual bool initWithArgs( void * p1
, void * p2
,
271 void * p3
, void *p4
);
272 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
274 virtual IOWorkLoop
*getWorkLoop() const;
278 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
279 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
280 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
281 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
284 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
286 /* generic nub for motherboard devices */
288 class IOPlatformDevice
: public IOService
290 OSDeclareDefaultStructors(IOPlatformDevice
)
292 struct ExpansionData
{ };
293 ExpansionData
*reserved
;
296 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
297 virtual IOService
* matchLocation( IOService
* client
);
298 virtual IOReturn
getResources( void );
300 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
301 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
302 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
303 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
306 #endif /* __cplusplus */
308 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */