]> git.saurik.com Git - apple/xnu.git/blame_incremental - iokit/IOKit/IOPlatformExpert.h
xnu-344.49.tar.gz
[apple/xnu.git] / iokit / IOKit / IOPlatformExpert.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
13 * file.
14 *
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.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*
26 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
27 *
28 * HISTORY
29 *
30 */
31
32
33#ifndef _IOKIT_IOPLATFORMEXPERT_H
34#define _IOKIT_IOPLATFORMEXPERT_H
35
36#ifdef __cplusplus
37#include <IOKit/IOLib.h>
38#include <IOKit/IOService.h>
39#include <IOKit/IOInterrupts.h>
40#include <IOKit/IOInterruptController.h>
41
42extern "C" {
43#endif
44
45extern boolean_t PEGetMachineName( char * name, int maxLength );
46extern boolean_t PEGetModelName( char * name, int maxLength );
47extern int PEGetPlatformEpoch( void );
48
49enum {
50 kPEHaltCPU,
51 kPERestartCPU,
52 kPEHangCPU
53};
54extern int (*PE_halt_restart)(unsigned int type);
55extern int PEHaltRestart(unsigned int type);
56
57// Save the Panic Info. Returns the number of bytes saved.
58extern unsigned long PESavePanicInfo(unsigned char *buffer, unsigned long length);
59
60extern long PEGetGMTTimeOfDay( void );
61extern void PESetGMTTimeOfDay( long secs );
62
63#ifdef __cplusplus
64} /* extern "C" */
65
66extern OSSymbol * gPlatformInterruptControllerName;
67
68class IORangeAllocator;
69class IONVRAMController;
70class IOPMrootDomain;
71
72class IOPlatformExpert : public IOService
73{
74 OSDeclareDefaultStructors(IOPlatformExpert);
75
76private:
77 long _peBootROMType;
78 long _peChipSetType;
79 long _peMachineType;
80
81protected:
82 IOPMrootDomain * root;
83 int _pePMFeatures;
84 int _pePrivPMFeatures;
85 int _peNumBatteriesSupported;
86 OSArray * thePowerTree;
87
88 bool searchingForAdditionalParents;
89 OSNumber * multipleParentKeyValue;
90 int numInstancesRegistered;
91
92 struct ExpansionData { };
93 ExpansionData *reserved;
94
95 virtual void setBootROMType(long peBootROMType);
96 virtual void setChipSetType(long peChipSetType);
97 virtual void setMachineType(long peMachineType);
98
99 virtual bool CheckSubTree (OSArray * inSubTree, IOService * theNub, IOService * theDevice, OSDictionary * theParent);
100 virtual bool RegisterServiceInTree (IOService * theService, OSDictionary * theTreeNode, OSDictionary * theTreeParentNode, IOService * theProvider);
101
102 virtual void PMInstantiatePowerDomains ( void );
103
104public:
105 virtual bool attach( IOService * provider );
106 virtual bool start( IOService * provider );
107 virtual bool configure( IOService * provider );
108 virtual IOService * createNub( OSDictionary * from );
109
110 virtual bool compareNubName( const IOService * nub, OSString * name,
111 OSString ** matched = 0 ) const;
112 virtual IOReturn getNubResources( IOService * nub );
113
114 virtual long getBootROMType(void);
115 virtual long getChipSetType(void);
116 virtual long getMachineType(void);
117
118 virtual bool getModelName( char * name, int maxLength );
119 virtual bool getMachineName( char * name, int maxLength );
120
121 virtual int haltRestart(unsigned int type);
122 virtual void sleepKernel(void);
123
124 virtual long getGMTTimeOfDay( void );
125 virtual void setGMTTimeOfDay( long secs );
126
127 virtual IOReturn getConsoleInfo( PE_Video * consoleInfo );
128 virtual IOReturn setConsoleInfo( PE_Video * consoleInfo, unsigned int op );
129
130 virtual void registerNVRAMController( IONVRAMController * nvram );
131
132 virtual IOReturn registerInterruptController(OSSymbol *name, IOInterruptController *interruptController);
133 virtual IOInterruptController *lookUpInterruptController(OSSymbol *name);
134 virtual void setCPUInterruptProperties(IOService *service);
135 virtual bool atInterruptLevel(void);
136
137 virtual IOReturn callPlatformFunction(const OSSymbol *functionName,
138 bool waitForFunction,
139 void *param1, void *param2,
140 void *param3, void *param4);
141
142 virtual IORangeAllocator * getPhysicalRangeAllocator(void);
143
144 virtual bool platformAdjustService(IOService *service);
145
146 virtual void PMRegisterDevice(IOService * theNub, IOService * theDevice);
147 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
148
149 virtual bool hasPMFeature (unsigned long featureMask);
150 virtual bool hasPrivPMFeature (unsigned long privFeatureMask);
151 virtual int numBatteriesSupported (void);
152
153 virtual IOByteCount savePanicInfo(UInt8 *buffer, IOByteCount length);
154
155 OSMetaClassDeclareReservedUsed(IOPlatformExpert, 0);
156
157 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 1);
158 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 2);
159 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 3);
160 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 4);
161 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 5);
162 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 6);
163 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 7);
164 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 8);
165 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 9);
166 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 10);
167 OSMetaClassDeclareReservedUnused(IOPlatformExpert, 11);
168};
169
170/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
171
172class IODTNVRAM;
173
174class IODTPlatformExpert : public IOPlatformExpert
175{
176 OSDeclareAbstractStructors(IODTPlatformExpert);
177
178private:
179 IODTNVRAM *dtNVRAM;
180
181 struct ExpansionData { };
182 ExpansionData *reserved;
183
184public:
185 virtual IOService * probe( IOService * provider,
186 SInt32 * score );
187 virtual bool configure( IOService * provider );
188
189 virtual void processTopLevel( IORegistryEntry * root );
190 virtual const char * deleteList( void ) = 0;
191 virtual const char * excludeList( void ) = 0;
192 virtual IOService * createNub( IORegistryEntry * from );
193 virtual bool createNubs( IOService * parent, OSIterator * iter );
194
195 virtual bool compareNubName( const IOService * nub, OSString * name,
196 OSString ** matched = 0 ) const;
197
198 virtual IOReturn getNubResources( IOService * nub );
199
200 virtual bool getModelName( char * name, int maxLength );
201 virtual bool getMachineName( char * name, int maxLength );
202
203 virtual void registerNVRAMController( IONVRAMController * nvram );
204
205 virtual int haltRestart(unsigned int type);
206
207 /* virtual */ IOReturn readXPRAM(IOByteCount offset, UInt8 * buffer,
208 IOByteCount length);
209
210 /* virtual */ IOReturn writeXPRAM(IOByteCount offset, UInt8 * buffer,
211 IOByteCount length);
212
213 virtual IOReturn readNVRAMProperty(
214 IORegistryEntry * entry,
215 const OSSymbol ** name, OSData ** value );
216
217 virtual IOReturn writeNVRAMProperty(
218 IORegistryEntry * entry,
219 const OSSymbol * name, OSData * value );
220
221 // This returns a dictionary describing all the NVRAM partitions.
222 // The keys will be the partitionIDs of the form "0x52,nvram".
223 // The values will be OSNumbers of the partition's byte count.
224 /* virtual */ OSDictionary *getNVRAMPartitions(void);
225
226 /* virtual */ IOReturn readNVRAMPartition(const OSSymbol * partitionID,
227 IOByteCount offset, UInt8 * buffer,
228 IOByteCount length);
229
230 /* virtual */ IOReturn writeNVRAMPartition(const OSSymbol * partitionID,
231 IOByteCount offset, UInt8 * buffer,
232 IOByteCount length);
233
234 virtual IOByteCount savePanicInfo(UInt8 *buffer, IOByteCount length);
235
236 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 0);
237 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 1);
238 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 2);
239 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 3);
240 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 4);
241 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 5);
242 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 6);
243 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 7);
244};
245
246/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
247
248/* generic root nub of service tree */
249
250class IOPlatformExpertDevice : public IOService
251{
252 OSDeclareDefaultStructors(IOPlatformExpertDevice)
253
254private:
255 IOWorkLoop *workLoop;
256
257 struct ExpansionData { };
258 ExpansionData *reserved;
259
260public:
261 virtual bool initWithArgs( void * p1, void * p2,
262 void * p3, void *p4 );
263 virtual bool compareName( OSString * name, OSString ** matched = 0 ) const;
264
265 virtual IOWorkLoop *getWorkLoop() const;
266
267 virtual void free();
268
269 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice, 0);
270 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice, 1);
271 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice, 2);
272 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice, 3);
273};
274
275/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
276
277/* generic nub for motherboard devices */
278
279class IOPlatformDevice : public IOService
280{
281 OSDeclareDefaultStructors(IOPlatformDevice)
282
283 struct ExpansionData { };
284 ExpansionData *reserved;
285
286public:
287 virtual bool compareName( OSString * name, OSString ** matched = 0 ) const;
288 virtual IOService * matchLocation( IOService * client );
289 virtual IOReturn getResources( void );
290
291 OSMetaClassDeclareReservedUnused(IOPlatformDevice, 0);
292 OSMetaClassDeclareReservedUnused(IOPlatformDevice, 1);
293 OSMetaClassDeclareReservedUnused(IOPlatformDevice, 2);
294 OSMetaClassDeclareReservedUnused(IOPlatformDevice, 3);
295};
296
297#endif /* __cplusplus */
298
299#endif /* ! _IOKIT_IOPLATFORMEXPERT_H */