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 extern OSSymbol
* gPlatformInterruptControllerName
;
65 class IORangeAllocator
;
66 class IONVRAMController
;
69 class IOPlatformExpert
: public IOService
71 OSDeclareDefaultStructors(IOPlatformExpert
);
79 IOPMrootDomain
* root
;
81 int _pePrivPMFeatures
;
82 int _peNumBatteriesSupported
;
83 OSArray
* thePowerTree
;
85 bool searchingForAdditionalParents
;
86 OSNumber
* multipleParentKeyValue
;
87 int numInstancesRegistered
;
89 struct ExpansionData
{ };
90 ExpansionData
*reserved
;
92 virtual void setBootROMType(long peBootROMType
);
93 virtual void setChipSetType(long peChipSetType
);
94 virtual void setMachineType(long peMachineType
);
96 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
97 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
99 virtual void PMInstantiatePowerDomains ( void );
102 virtual bool attach( IOService
* provider
);
103 virtual bool start( IOService
* provider
);
104 virtual bool configure( IOService
* provider
);
105 virtual IOService
* createNub( OSDictionary
* from
);
107 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
108 OSString
** matched
= 0 ) const;
109 virtual IOReturn
getNubResources( IOService
* nub
);
111 virtual long getBootROMType(void);
112 virtual long getChipSetType(void);
113 virtual long getMachineType(void);
115 virtual bool getModelName( char * name
, int maxLength
);
116 virtual bool getMachineName( char * name
, int maxLength
);
118 virtual int haltRestart(unsigned int type
);
119 virtual void sleepKernel(void);
121 virtual long getGMTTimeOfDay( void );
122 virtual void setGMTTimeOfDay( long secs
);
124 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
125 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
127 virtual void registerNVRAMController( IONVRAMController
* nvram
);
129 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
130 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
131 virtual void setCPUInterruptProperties(IOService
*service
);
132 virtual bool atInterruptLevel(void);
134 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
135 bool waitForFunction
,
136 void *param1
, void *param2
,
137 void *param3
, void *param4
);
139 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
141 virtual bool platformAdjustService(IOService
*service
);
143 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
144 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
146 virtual bool hasPMFeature (unsigned long featureMask
);
147 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
148 virtual int numBatteriesSupported (void);
150 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
152 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
154 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 1);
155 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
156 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
157 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
158 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
159 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
160 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
161 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
162 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
163 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
164 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
167 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
171 class IODTPlatformExpert
: public IOPlatformExpert
173 OSDeclareAbstractStructors(IODTPlatformExpert
);
178 struct ExpansionData
{ };
179 ExpansionData
*reserved
;
182 virtual IOService
* probe( IOService
* provider
,
184 virtual bool configure( IOService
* provider
);
186 virtual void processTopLevel( IORegistryEntry
* root
);
187 virtual const char * deleteList( void ) = 0;
188 virtual const char * excludeList( void ) = 0;
189 virtual IOService
* createNub( IORegistryEntry
* from
);
190 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
192 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
193 OSString
** matched
= 0 ) const;
195 virtual IOReturn
getNubResources( IOService
* nub
);
197 virtual bool getModelName( char * name
, int maxLength
);
198 virtual bool getMachineName( char * name
, int maxLength
);
200 virtual void registerNVRAMController( IONVRAMController
* nvram
);
202 virtual int haltRestart(unsigned int type
);
204 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
207 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
210 virtual IOReturn
readNVRAMProperty(
211 IORegistryEntry
* entry
,
212 const OSSymbol
** name
, OSData
** value
);
214 virtual IOReturn
writeNVRAMProperty(
215 IORegistryEntry
* entry
,
216 const OSSymbol
* name
, OSData
* value
);
218 // This returns a dictionary describing all the NVRAM partitions.
219 // The keys will be the partitionIDs of the form "0x52,nvram".
220 // The values will be OSNumbers of the partition's byte count.
221 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
223 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
224 IOByteCount offset
, UInt8
* buffer
,
227 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
228 IOByteCount offset
, UInt8
* buffer
,
231 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
233 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
234 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
235 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
236 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
237 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
238 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
239 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
240 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
243 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
245 /* generic root nub of service tree */
247 class IOPlatformExpertDevice
: public IOService
249 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
252 IOWorkLoop
*workLoop
;
254 struct ExpansionData
{ };
255 ExpansionData
*reserved
;
258 virtual bool initWithArgs( void * p1
, void * p2
,
259 void * p3
, void *p4
);
260 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
262 virtual IOWorkLoop
*getWorkLoop() const;
266 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
267 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
268 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
269 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
272 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
274 /* generic nub for motherboard devices */
276 class IOPlatformDevice
: public IOService
278 OSDeclareDefaultStructors(IOPlatformDevice
)
280 struct ExpansionData
{ };
281 ExpansionData
*reserved
;
284 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
285 virtual IOService
* matchLocation( IOService
* client
);
286 virtual IOReturn
getResources( void );
288 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
289 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
290 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
291 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
294 #endif /* __cplusplus */
296 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */