2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
31 #ifndef _IOKIT_IOPLATFORMEXPERT_H
32 #define _IOKIT_IOPLATFORMEXPERT_H
35 #include <IOKit/IOLib.h>
36 #include <IOKit/IOService.h>
37 #include <IOKit/IOInterrupts.h>
38 #include <IOKit/IOInterruptController.h>
43 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
44 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
45 extern int PEGetPlatformEpoch( void );
52 extern int (*PE_halt_restart
)(unsigned int type
);
53 extern int PEHaltRestart(unsigned int type
);
55 // Save the Panic Info. Returns the number of bytes saved.
56 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
58 extern long PEGetGMTTimeOfDay( void );
59 extern void PESetGMTTimeOfDay( long secs
);
64 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
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 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
157 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
158 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
159 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
160 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
161 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
162 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
163 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
164 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
165 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
166 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
168 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
171 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
175 class IODTPlatformExpert
: public IOPlatformExpert
177 OSDeclareAbstractStructors(IODTPlatformExpert
);
182 struct ExpansionData
{ };
183 ExpansionData
*reserved
;
186 virtual IOService
* probe( IOService
* provider
,
188 virtual bool configure( IOService
* provider
);
190 virtual void processTopLevel( IORegistryEntry
* root
);
191 virtual const char * deleteList( void ) = 0;
192 virtual const char * excludeList( void ) = 0;
193 virtual IOService
* createNub( IORegistryEntry
* from
);
194 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
196 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
197 OSString
** matched
= 0 ) const;
199 virtual IOReturn
getNubResources( IOService
* nub
);
201 virtual bool getModelName( char * name
, int maxLength
);
202 virtual bool getMachineName( char * name
, int maxLength
);
204 virtual void registerNVRAMController( IONVRAMController
* nvram
);
206 virtual int haltRestart(unsigned int type
);
208 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
211 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
214 virtual IOReturn
readNVRAMProperty(
215 IORegistryEntry
* entry
,
216 const OSSymbol
** name
, OSData
** value
);
218 virtual IOReturn
writeNVRAMProperty(
219 IORegistryEntry
* entry
,
220 const OSSymbol
* name
, OSData
* value
);
222 // This returns a dictionary describing all the NVRAM partitions.
223 // The keys will be the partitionIDs of the form "0x52,nvram".
224 // The values will be OSNumbers of the partition's byte count.
225 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
227 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
228 IOByteCount offset
, UInt8
* buffer
,
231 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
232 IOByteCount offset
, UInt8
* buffer
,
235 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
236 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
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 */