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