2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
36 #ifndef _IOKIT_IOPLATFORMEXPERT_H
37 #define _IOKIT_IOPLATFORMEXPERT_H
40 #include <IOKit/IOLib.h>
41 #include <IOKit/IOService.h>
42 #include <IOKit/IOInterrupts.h>
43 #include <IOKit/IOInterruptController.h>
48 extern boolean_t
PEGetMachineName( char * name
, int maxLength
);
49 extern boolean_t
PEGetModelName( char * name
, int maxLength
);
50 extern int PEGetPlatformEpoch( void );
57 extern int (*PE_halt_restart
)(unsigned int type
);
58 extern int PEHaltRestart(unsigned int type
);
60 // Save the Panic Info. Returns the number of bytes saved.
61 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
63 extern long PEGetGMTTimeOfDay( void );
64 extern void PESetGMTTimeOfDay( long secs
);
69 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
71 extern OSSymbol
* gPlatformInterruptControllerName
;
73 class IORangeAllocator
;
74 class IONVRAMController
;
77 class IOPlatformExpert
: public IOService
79 OSDeclareDefaultStructors(IOPlatformExpert
);
87 IOPMrootDomain
* root
;
89 int _pePrivPMFeatures
;
90 int _peNumBatteriesSupported
;
91 OSArray
* thePowerTree
;
93 bool searchingForAdditionalParents
;
94 OSNumber
* multipleParentKeyValue
;
95 int numInstancesRegistered
;
97 struct ExpansionData
{ };
98 ExpansionData
*reserved
;
100 virtual void setBootROMType(long peBootROMType
);
101 virtual void setChipSetType(long peChipSetType
);
102 virtual void setMachineType(long peMachineType
);
104 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
105 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
107 virtual void PMInstantiatePowerDomains ( void );
110 virtual bool attach( IOService
* provider
);
111 virtual bool start( IOService
* provider
);
112 virtual bool configure( IOService
* provider
);
113 virtual IOService
* createNub( OSDictionary
* from
);
115 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
116 OSString
** matched
= 0 ) const;
117 virtual IOReturn
getNubResources( IOService
* nub
);
119 virtual long getBootROMType(void);
120 virtual long getChipSetType(void);
121 virtual long getMachineType(void);
123 virtual bool getModelName( char * name
, int maxLength
);
124 virtual bool getMachineName( char * name
, int maxLength
);
126 virtual int haltRestart(unsigned int type
);
127 virtual void sleepKernel(void);
129 virtual long getGMTTimeOfDay( void );
130 virtual void setGMTTimeOfDay( long secs
);
132 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
133 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
135 virtual void registerNVRAMController( IONVRAMController
* nvram
);
137 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
138 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
139 virtual void setCPUInterruptProperties(IOService
*service
);
140 virtual bool atInterruptLevel(void);
142 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
143 bool waitForFunction
,
144 void *param1
, void *param2
,
145 void *param3
, void *param4
);
147 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
149 virtual bool platformAdjustService(IOService
*service
);
151 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
152 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
154 virtual bool hasPMFeature (unsigned long featureMask
);
155 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
156 virtual int numBatteriesSupported (void);
158 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
160 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
162 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
163 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
164 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
165 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
166 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
168 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
169 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
170 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
171 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
172 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
173 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
176 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
180 class IODTPlatformExpert
: public IOPlatformExpert
182 OSDeclareAbstractStructors(IODTPlatformExpert
);
187 struct ExpansionData
{ };
188 ExpansionData
*reserved
;
191 virtual IOService
* probe( IOService
* provider
,
193 virtual bool configure( IOService
* provider
);
195 virtual void processTopLevel( IORegistryEntry
* root
);
196 virtual const char * deleteList( void ) = 0;
197 virtual const char * excludeList( void ) = 0;
198 virtual IOService
* createNub( IORegistryEntry
* from
);
199 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
201 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
202 OSString
** matched
= 0 ) const;
204 virtual IOReturn
getNubResources( IOService
* nub
);
206 virtual bool getModelName( char * name
, int maxLength
);
207 virtual bool getMachineName( char * name
, int maxLength
);
209 virtual void registerNVRAMController( IONVRAMController
* nvram
);
211 virtual int haltRestart(unsigned int type
);
213 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
216 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
219 virtual IOReturn
readNVRAMProperty(
220 IORegistryEntry
* entry
,
221 const OSSymbol
** name
, OSData
** value
);
223 virtual IOReturn
writeNVRAMProperty(
224 IORegistryEntry
* entry
,
225 const OSSymbol
* name
, OSData
* value
);
227 // This returns a dictionary describing all the NVRAM partitions.
228 // The keys will be the partitionIDs of the form "0x52,nvram".
229 // The values will be OSNumbers of the partition's byte count.
230 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
232 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
233 IOByteCount offset
, UInt8
* buffer
,
236 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
237 IOByteCount offset
, UInt8
* buffer
,
240 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
241 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
243 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
244 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
245 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
246 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
247 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
248 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
249 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
250 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
253 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
255 /* generic root nub of service tree */
257 class IOPlatformExpertDevice
: public IOService
259 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
262 IOWorkLoop
*workLoop
;
264 struct ExpansionData
{ };
265 ExpansionData
*reserved
;
268 virtual bool initWithArgs( void * p1
, void * p2
,
269 void * p3
, void *p4
);
270 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
272 virtual IOWorkLoop
*getWorkLoop() const;
276 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
277 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
278 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
279 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
282 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
284 /* generic nub for motherboard devices */
286 class IOPlatformDevice
: public IOService
288 OSDeclareDefaultStructors(IOPlatformDevice
)
290 struct ExpansionData
{ };
291 ExpansionData
*reserved
;
294 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
295 virtual IOService
* matchLocation( IOService
* client
);
296 virtual IOReturn
getResources( void );
298 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
299 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
300 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
301 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
304 #endif /* __cplusplus */
306 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */