2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
30 #ifndef _IOKIT_IOPLATFORMEXPERT_H
31 #define _IOKIT_IOPLATFORMEXPERT_H
34 #include <IOKit/IOLib.h>
35 #include <IOKit/IOService.h>
36 #include <IOKit/IOInterrupts.h>
37 #include <IOKit/IOInterruptController.h>
42 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
43 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
44 extern int PEGetPlatformEpoch( void );
51 extern int (*PE_halt_restart
)(unsigned int type
);
52 extern int PEHaltRestart(unsigned int type
);
54 // Save the Panic Info. Returns the number of bytes saved.
55 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
57 extern long PEGetGMTTimeOfDay( void );
58 extern void PESetGMTTimeOfDay( long secs
);
63 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
65 extern OSSymbol
* gPlatformInterruptControllerName
;
67 class IORangeAllocator
;
68 class IONVRAMController
;
71 class IOPlatformExpert
: public IOService
73 OSDeclareDefaultStructors(IOPlatformExpert
);
81 IOPMrootDomain
* root
;
83 int _pePrivPMFeatures
;
84 int _peNumBatteriesSupported
;
85 OSArray
* thePowerTree
;
87 bool searchingForAdditionalParents
;
88 OSNumber
* multipleParentKeyValue
;
89 int numInstancesRegistered
;
91 struct ExpansionData
{ };
92 ExpansionData
*reserved
;
94 virtual void setBootROMType(long peBootROMType
);
95 virtual void setChipSetType(long peChipSetType
);
96 virtual void setMachineType(long peMachineType
);
98 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
99 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
101 virtual void PMInstantiatePowerDomains ( void );
104 virtual bool attach( IOService
* provider
);
105 virtual bool start( IOService
* provider
);
106 virtual bool configure( IOService
* provider
);
107 virtual IOService
* createNub( OSDictionary
* from
);
109 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
110 OSString
** matched
= 0 ) const;
111 virtual IOReturn
getNubResources( IOService
* nub
);
113 virtual long getBootROMType(void);
114 virtual long getChipSetType(void);
115 virtual long getMachineType(void);
117 virtual bool getModelName( char * name
, int maxLength
);
118 virtual bool getMachineName( char * name
, int maxLength
);
120 virtual int haltRestart(unsigned int type
);
121 virtual void sleepKernel(void);
123 virtual long getGMTTimeOfDay( void );
124 virtual void setGMTTimeOfDay( long secs
);
126 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
127 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
129 virtual void registerNVRAMController( IONVRAMController
* nvram
);
131 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
132 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
133 virtual void setCPUInterruptProperties(IOService
*service
);
134 virtual bool atInterruptLevel(void);
136 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
137 bool waitForFunction
,
138 void *param1
, void *param2
,
139 void *param3
, void *param4
);
141 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
143 virtual bool platformAdjustService(IOService
*service
);
145 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
146 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
148 virtual bool hasPMFeature (unsigned long featureMask
);
149 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
150 virtual int numBatteriesSupported (void);
152 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
154 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
156 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
157 OSMetaClassDeclareReservedUsed(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
);
235 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
237 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
238 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
239 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
240 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
241 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
242 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
243 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
244 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
247 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
249 /* generic root nub of service tree */
251 class IOPlatformExpertDevice
: public IOService
253 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
256 IOWorkLoop
*workLoop
;
258 struct ExpansionData
{ };
259 ExpansionData
*reserved
;
262 virtual bool initWithArgs( void * p1
, void * p2
,
263 void * p3
, void *p4
);
264 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
266 virtual IOWorkLoop
*getWorkLoop() const;
270 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
271 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
272 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
273 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
276 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
278 /* generic nub for motherboard devices */
280 class IOPlatformDevice
: public IOService
282 OSDeclareDefaultStructors(IOPlatformDevice
)
284 struct ExpansionData
{ };
285 ExpansionData
*reserved
;
288 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
289 virtual IOService
* matchLocation( IOService
* client
);
290 virtual IOReturn
getResources( void );
292 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
293 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
294 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
295 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
298 #endif /* __cplusplus */
300 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */