2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
33 #ifndef _IOKIT_IOPLATFORMEXPERT_H
34 #define _IOKIT_IOPLATFORMEXPERT_H
37 #include <IOKit/IOLib.h>
38 #include <IOKit/IOService.h>
39 #include <IOKit/IOInterrupts.h>
40 #include <IOKit/IOInterruptController.h>
45 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
46 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
47 extern int PEGetPlatformEpoch( void );
54 extern int (*PE_halt_restart
)(unsigned int type
);
55 extern int PEHaltRestart(unsigned int type
);
57 // Save the Panic Info. Returns the number of bytes saved.
58 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
60 extern long PEGetGMTTimeOfDay( void );
61 extern void PESetGMTTimeOfDay( long secs
);
66 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
68 extern OSSymbol
* gPlatformInterruptControllerName
;
70 class IORangeAllocator
;
71 class IONVRAMController
;
74 class IOPlatformExpert
: public IOService
76 OSDeclareDefaultStructors(IOPlatformExpert
);
84 IOPMrootDomain
* root
;
86 int _pePrivPMFeatures
;
87 int _peNumBatteriesSupported
;
88 OSArray
* thePowerTree
;
90 bool searchingForAdditionalParents
;
91 OSNumber
* multipleParentKeyValue
;
92 int numInstancesRegistered
;
94 struct ExpansionData
{ };
95 ExpansionData
*reserved
;
97 virtual void setBootROMType(long peBootROMType
);
98 virtual void setChipSetType(long peChipSetType
);
99 virtual void setMachineType(long peMachineType
);
101 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
102 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
104 virtual void PMInstantiatePowerDomains ( void );
107 virtual bool attach( IOService
* provider
);
108 virtual bool start( IOService
* provider
);
109 virtual bool configure( IOService
* provider
);
110 virtual IOService
* createNub( OSDictionary
* from
);
112 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
113 OSString
** matched
= 0 ) const;
114 virtual IOReturn
getNubResources( IOService
* nub
);
116 virtual long getBootROMType(void);
117 virtual long getChipSetType(void);
118 virtual long getMachineType(void);
120 virtual bool getModelName( char * name
, int maxLength
);
121 virtual bool getMachineName( char * name
, int maxLength
);
123 virtual int haltRestart(unsigned int type
);
124 virtual void sleepKernel(void);
126 virtual long getGMTTimeOfDay( void );
127 virtual void setGMTTimeOfDay( long secs
);
129 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
130 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
132 virtual void registerNVRAMController( IONVRAMController
* nvram
);
134 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
135 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
136 virtual void setCPUInterruptProperties(IOService
*service
);
137 virtual bool atInterruptLevel(void);
139 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
140 bool waitForFunction
,
141 void *param1
, void *param2
,
142 void *param3
, void *param4
);
144 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
146 virtual bool platformAdjustService(IOService
*service
);
148 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
149 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
151 virtual bool hasPMFeature (unsigned long featureMask
);
152 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
153 virtual int numBatteriesSupported (void);
155 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
157 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
159 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
160 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
161 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
162 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
163 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
164 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
165 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
166 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
168 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
169 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
170 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
173 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
177 class IODTPlatformExpert
: public IOPlatformExpert
179 OSDeclareAbstractStructors(IODTPlatformExpert
);
184 struct ExpansionData
{ };
185 ExpansionData
*reserved
;
188 virtual IOService
* probe( IOService
* provider
,
190 virtual bool configure( IOService
* provider
);
192 virtual void processTopLevel( IORegistryEntry
* root
);
193 virtual const char * deleteList( void ) = 0;
194 virtual const char * excludeList( void ) = 0;
195 virtual IOService
* createNub( IORegistryEntry
* from
);
196 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
198 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
199 OSString
** matched
= 0 ) const;
201 virtual IOReturn
getNubResources( IOService
* nub
);
203 virtual bool getModelName( char * name
, int maxLength
);
204 virtual bool getMachineName( char * name
, int maxLength
);
206 virtual void registerNVRAMController( IONVRAMController
* nvram
);
208 virtual int haltRestart(unsigned int type
);
210 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
213 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
216 virtual IOReturn
readNVRAMProperty(
217 IORegistryEntry
* entry
,
218 const OSSymbol
** name
, OSData
** value
);
220 virtual IOReturn
writeNVRAMProperty(
221 IORegistryEntry
* entry
,
222 const OSSymbol
* name
, OSData
* value
);
224 // This returns a dictionary describing all the NVRAM partitions.
225 // The keys will be the partitionIDs of the form "0x52,nvram".
226 // The values will be OSNumbers of the partition's byte count.
227 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
229 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
230 IOByteCount offset
, UInt8
* buffer
,
233 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
234 IOByteCount offset
, UInt8
* buffer
,
237 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
238 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
240 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
241 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
242 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
243 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
244 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
245 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
246 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
247 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
250 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
252 /* generic root nub of service tree */
254 class IOPlatformExpertDevice
: public IOService
256 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
259 IOWorkLoop
*workLoop
;
261 struct ExpansionData
{ };
262 ExpansionData
*reserved
;
265 virtual bool initWithArgs( void * p1
, void * p2
,
266 void * p3
, void *p4
);
267 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
269 virtual IOWorkLoop
*getWorkLoop() const;
273 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
274 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
275 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
276 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
279 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
281 /* generic nub for motherboard devices */
283 class IOPlatformDevice
: public IOService
285 OSDeclareDefaultStructors(IOPlatformDevice
)
287 struct ExpansionData
{ };
288 ExpansionData
*reserved
;
291 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
292 virtual IOService
* matchLocation( IOService
* client
);
293 virtual IOReturn
getResources( void );
295 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
296 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
297 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
298 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
301 #endif /* __cplusplus */
303 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */