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 );
50 extern int (*PE_halt_restart
)(unsigned int type
);
51 extern int PEHaltRestart(unsigned int type
);
53 extern long PEGetGMTTimeOfDay( void );
54 extern void PESetGMTTimeOfDay( long secs
);
59 extern OSSymbol
* gPlatformInterruptControllerName
;
61 class IORangeAllocator
;
62 class IONVRAMController
;
65 class IOPlatformExpert
: public IOService
67 OSDeclareDefaultStructors(IOPlatformExpert
);
75 IOPMrootDomain
* root
;
77 int _pePrivPMFeatures
;
78 int _peNumBatteriesSupported
;
79 OSArray
* thePowerTree
;
81 bool searchingForAdditionalParents
;
82 OSNumber
* multipleParentKeyValue
;
83 int numInstancesRegistered
;
85 struct ExpansionData
{ };
86 ExpansionData
*reserved
;
88 virtual void setBootROMType(long peBootROMType
);
89 virtual void setChipSetType(long peChipSetType
);
90 virtual void setMachineType(long peMachineType
);
92 virtual bool CheckSubTree (OSArray
* inSubTree
, IOService
* theNub
, IOService
* theDevice
, OSDictionary
* theParent
);
93 virtual bool RegisterServiceInTree (IOService
* theService
, OSDictionary
* theTreeNode
, OSDictionary
* theTreeParentNode
, IOService
* theProvider
);
95 virtual void PMInstantiatePowerDomains ( void );
98 virtual bool attach( IOService
* provider
);
99 virtual bool start( IOService
* provider
);
100 virtual bool configure( IOService
* provider
);
101 virtual IOService
* createNub( OSDictionary
* from
);
103 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
104 OSString
** matched
= 0 ) const;
105 virtual IOReturn
getNubResources( IOService
* nub
);
107 virtual long getBootROMType(void);
108 virtual long getChipSetType(void);
109 virtual long getMachineType(void);
111 virtual bool getModelName( char * name
, int maxLength
);
112 virtual bool getMachineName( char * name
, int maxLength
);
114 virtual int haltRestart(unsigned int type
);
115 virtual void sleepKernel(void);
117 virtual long getGMTTimeOfDay( void );
118 virtual void setGMTTimeOfDay( long secs
);
120 virtual IOReturn
getConsoleInfo( PE_Video
* consoleInfo
);
121 virtual IOReturn
setConsoleInfo( PE_Video
* consoleInfo
, unsigned int op
);
123 virtual void registerNVRAMController( IONVRAMController
* nvram
);
125 virtual IOReturn
registerInterruptController(OSSymbol
*name
, IOInterruptController
*interruptController
);
126 virtual IOInterruptController
*lookUpInterruptController(OSSymbol
*name
);
127 virtual void setCPUInterruptProperties(IOService
*service
);
128 virtual bool atInterruptLevel(void);
130 virtual IOReturn
callPlatformFunction(const OSSymbol
*functionName
,
131 bool waitForFunction
,
132 void *param1
, void *param2
,
133 void *param3
, void *param4
);
135 virtual IORangeAllocator
* getPhysicalRangeAllocator(void);
137 virtual bool platformAdjustService(IOService
*service
);
139 virtual void PMRegisterDevice(IOService
* theNub
, IOService
* theDevice
);
140 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
142 virtual bool hasPMFeature (unsigned long featureMask
);
143 virtual bool hasPrivPMFeature (unsigned long privFeatureMask
);
144 virtual int numBatteriesSupported (void);
146 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 0);
147 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 1);
148 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 2);
149 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 3);
150 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 4);
151 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 5);
152 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 6);
153 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 7);
154 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 8);
155 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 9);
156 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 10);
157 OSMetaClassDeclareReservedUnused(IOPlatformExpert
, 11);
160 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
164 class IODTPlatformExpert
: public IOPlatformExpert
166 OSDeclareAbstractStructors(IODTPlatformExpert
);
171 struct ExpansionData
{ };
172 ExpansionData
*reserved
;
175 virtual IOService
* probe( IOService
* provider
,
177 virtual bool configure( IOService
* provider
);
179 virtual void processTopLevel( IORegistryEntry
* root
);
180 virtual const char * deleteList( void ) = 0;
181 virtual const char * excludeList( void ) = 0;
182 virtual IOService
* createNub( IORegistryEntry
* from
);
183 virtual bool createNubs( IOService
* parent
, OSIterator
* iter
);
185 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
186 OSString
** matched
= 0 ) const;
188 virtual IOReturn
getNubResources( IOService
* nub
);
190 virtual bool getModelName( char * name
, int maxLength
);
191 virtual bool getMachineName( char * name
, int maxLength
);
193 virtual void registerNVRAMController( IONVRAMController
* nvram
);
195 virtual int haltRestart(unsigned int type
);
197 /* virtual */ IOReturn
readXPRAM(IOByteCount offset
, UInt8
* buffer
,
200 /* virtual */ IOReturn
writeXPRAM(IOByteCount offset
, UInt8
* buffer
,
203 virtual IOReturn
readNVRAMProperty(
204 IORegistryEntry
* entry
,
205 const OSSymbol
** name
, OSData
** value
);
207 virtual IOReturn
writeNVRAMProperty(
208 IORegistryEntry
* entry
,
209 const OSSymbol
* name
, OSData
* value
);
211 // This returns a dictionary describing all the NVRAM partitions.
212 // The keys will be the partitionIDs of the form "0x52,nvram".
213 // The values will be OSNumbers of the partition's byte count.
214 /* virtual */ OSDictionary
*getNVRAMPartitions(void);
216 /* virtual */ IOReturn
readNVRAMPartition(const OSSymbol
* partitionID
,
217 IOByteCount offset
, UInt8
* buffer
,
220 /* virtual */ IOReturn
writeNVRAMPartition(const OSSymbol
* partitionID
,
221 IOByteCount offset
, UInt8
* buffer
,
224 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 0);
225 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 1);
226 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 2);
227 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 3);
228 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 4);
229 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 5);
230 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 6);
231 OSMetaClassDeclareReservedUnused(IODTPlatformExpert
, 7);
234 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
236 /* generic root nub of service tree */
238 class IOPlatformExpertDevice
: public IOService
240 OSDeclareDefaultStructors(IOPlatformExpertDevice
)
243 IOWorkLoop
*workLoop
;
245 struct ExpansionData
{ };
246 ExpansionData
*reserved
;
249 virtual bool initWithArgs( void * p1
, void * p2
,
250 void * p3
, void *p4
);
251 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
253 virtual IOWorkLoop
*getWorkLoop() const;
257 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 0);
258 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 1);
259 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 2);
260 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice
, 3);
263 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
265 /* generic nub for motherboard devices */
267 class IOPlatformDevice
: public IOService
269 OSDeclareDefaultStructors(IOPlatformDevice
)
271 struct ExpansionData
{ };
272 ExpansionData
*reserved
;
275 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
276 virtual IOService
* matchLocation( IOService
* client
);
277 virtual IOReturn
getResources( void );
279 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 0);
280 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 1);
281 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 2);
282 OSMetaClassDeclareReservedUnused(IOPlatformDevice
, 3);
285 #endif /* __cplusplus */
287 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */