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