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 );
60 extern int (*PE_halt_restart
)(unsigned int type
);
61 extern int PEHaltRestart(unsigned int type
);
63 // Save the Panic Info. Returns the number of bytes saved.
64 extern unsigned long PESavePanicInfo(unsigned char *buffer
, unsigned long length
);
66 extern long PEGetGMTTimeOfDay( void );
67 extern void PESetGMTTimeOfDay( long secs
);
72 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
75 extern OSSymbol
* gPlatformInterruptControllerName
;
77 extern const OSSymbol
* gIOPlatformSleepActionKey
;
78 extern const OSSymbol
* gIOPlatformWakeActionKey
;
79 extern const OSSymbol
* gIOPlatformQuiesceActionKey
;
80 extern const OSSymbol
* gIOPlatformActiveActionKey
;
82 class IORangeAllocator
;
83 class IONVRAMController
;
86 class IOPlatformExpert
: public IOService
88 OSDeclareDefaultStructors(IOPlatformExpert
);
96 IOPMrootDomain
* root
;
98 int _pePrivPMFeatures
;
99 int _peNumBatteriesSupported
;
100 OSArray
* thePowerTree
;
102 bool searchingForAdditionalParents
;
103 OSNumber
* multipleParentKeyValue
;
104 int numInstancesRegistered
;
106 struct ExpansionData
{ };
107 ExpansionData
*reserved
;
109 virtual void setBootROMType(long peBootROMType
);
110 virtual void setChipSetType(long peChipSetType
);
111 virtual void setMachineType(long peMachineType
);
113 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
114 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
116 virtual void PMInstantiatePowerDomains ( void );
119 virtual bool attach( IOService
* provider
);
120 virtual bool start( IOService
* provider
);
121 virtual bool configure( IOService
* provider
);
122 virtual IOService
* createNub( OSDictionary
* from
);
124 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
125 OSString
** matched
= 0 ) const;
126 virtual IOReturn
getNubResources( IOService
* nub
);
128 virtual long getBootROMType(void);
129 virtual long getChipSetType(void);
130 virtual long getMachineType(void);
132 virtual bool getModelName( char * name
, int maxLength
);
133 virtual bool getMachineName( char * name
, int maxLength
);
135 virtual int haltRestart(unsigned int type
);
136 virtual void sleepKernel(void);
138 virtual long getGMTTimeOfDay( void );
139 virtual void setGMTTimeOfDay( long secs
);
141 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
142 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
144 virtual void registerNVRAMController( IONVRAMController
* nvram
);
146 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
147 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
148 virtual void setCPUInterruptProperties(IOService
*service
);
149 virtual bool atInterruptLevel(void);
151 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
152 bool waitForFunction
,
153 void *param1
, void *param2
,
154 void *param3
, void *param4
);
156 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
158 virtual bool platformAdjustService(IOService
*service
);
160 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
161 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
163 virtual bool hasPMFeature (unsigned long featureMask
);
164 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
165 virtual int numBatteriesSupported (void);
167 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
169 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
171 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 0);
172 OSMetaClassDeclareReservedUsed(IOPlatformExpert
, 1);
173 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
174 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
175 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
176 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
177 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
178 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
179 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
180 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
181 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
182 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
185 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
189 class IODTPlatformExpert
: public IOPlatformExpert
191 OSDeclareAbstractStructors(IODTPlatformExpert
);
196 struct ExpansionData
{ };
197 ExpansionData
*reserved
;
200 virtual IOService
* probe( IOService
* provider
,
202 virtual bool configure( IOService
* provider
);
204 virtual void processTopLevel( IORegistryEntry
* root
);
205 virtual const char * deleteList( void ) = 0;
206 virtual const char * excludeList( void ) = 0;
207 virtual IOService
* createNub( IORegistryEntry
* from
);
208 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
210 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
211 OSString
** matched
= 0 ) const;
213 virtual IOReturn
getNubResources( IOService
* nub
);
215 virtual bool getModelName( char * name
, int maxLength
);
216 virtual bool getMachineName( char * name
, int maxLength
);
218 virtual void registerNVRAMController( IONVRAMController
* nvram
);
220 virtual int haltRestart(unsigned int type
);
222 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
225 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
228 virtual IOReturn
readNVRAMProperty(
229 IORegistryEntry
* entry
,
230 const OSSymbol
** name
, OSData
** value
);
232 virtual IOReturn
writeNVRAMProperty(
233 IORegistryEntry
* entry
,
234 const OSSymbol
* name
, OSData
* value
);
236 // This returns a dictionary describing all the NVRAM partitions.
237 // The keys will be the partitionIDs of the form "0x52,nvram".
238 // The values will be OSNumbers of the partition's byte count.
239 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
241 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
242 IOByteCount offset
, UInt8
* buffer
,
245 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
246 IOByteCount offset
, UInt8
* buffer
,
249 virtual IOByteCount
savePanicInfo(UInt8
*buffer
, IOByteCount length
);
250 virtual OSString
* createSystemSerialNumberString(OSData
* myProperty
);
252 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
253 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
254 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
255 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
256 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
257 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
258 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
259 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
262 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
264 /* generic root nub of service tree */
266 class IOPlatformExpertDevice
: public IOService
268 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
271 IOWorkLoop
*workLoop
;
273 struct ExpansionData
{ };
274 ExpansionData
*reserved
;
277 virtual bool initWithArgs( void * p1
, void * p2
,
278 void * p3
, void *p4
);
279 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
281 virtual IOWorkLoop
*getWorkLoop() const;
282 virtual IOReturn
setProperties( OSObject
* properties
);
286 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
287 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
288 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
289 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
292 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
294 /* generic nub for motherboard devices */
296 class IOPlatformDevice
: public IOService
298 OSDeclareDefaultStructors(IOPlatformDevice
)
300 struct ExpansionData
{ };
301 ExpansionData
*reserved
;
304 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
305 virtual IOService
* matchLocation( IOService
* client
);
306 virtual IOReturn
getResources( void );
308 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
309 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
310 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
311 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
314 #endif /* __cplusplus */
316 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */