]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/IOPlatformExpert.h
xnu-517.9.4.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 * 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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
24 *
25 * HISTORY
26 *
27 */
28
29
30 #ifndef _IOKIT_IOPLATFORMEXPERT_H
31 #define _IOKIT_IOPLATFORMEXPERT_H
32
33 #ifdef __cplusplus
34 #include <IOKit/IOLib.h>
35 #include <IOKit/IOService.h>
36 #include <IOKit/IOInterrupts.h>
37 #include <IOKit/IOInterruptController.h>
38
39 extern "C" {
40 #endif
41
42 extern boolean_t PEGetMachineName( char * name, int maxLength );
43 extern boolean_t PEGetModelName( char * name, int maxLength );
44 extern int PEGetPlatformEpoch( void );
45
46 enum {
47 kPEHaltCPU,
48 kPERestartCPU,
49 kPEHangCPU
50 };
51 extern int (*PE_halt_restart)(unsigned int type);
52 extern int PEHaltRestart(unsigned int type);
53
54 // Save the Panic Info. Returns the number of bytes saved.
55 extern unsigned long PESavePanicInfo(unsigned char *buffer, unsigned long length);
56
57 extern long PEGetGMTTimeOfDay( void );
58 extern void PESetGMTTimeOfDay( long secs );
59
60 #ifdef __cplusplus
61 } /* extern "C" */
62
63 #define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
64
65 extern OSSymbol * gPlatformInterruptControllerName;
66
67 class IORangeAllocator;
68 class IONVRAMController;
69 class IOPMrootDomain;
70
71 class IOPlatformExpert : public IOService
72 {
73 OSDeclareDefaultStructors(IOPlatformExpert);
74
75 private:
76 long _peBootROMType;
77 long _peChipSetType;
78 long _peMachineType;
79
80 protected:
81 IOPMrootDomain * root;
82 int _pePMFeatures;
83 int _pePrivPMFeatures;
84 int _peNumBatteriesSupported;
85 OSArray * thePowerTree;
86
87 bool searchingForAdditionalParents;
88 OSNumber * multipleParentKeyValue;
89 int numInstancesRegistered;
90
91 struct ExpansionData { };
92 ExpansionData *reserved;
93
94 virtual void setBootROMType(long peBootROMType);
95 virtual void setChipSetType(long peChipSetType);
96 virtual void setMachineType(long peMachineType);
97
98 virtual bool CheckSubTree (OSArray * inSubTree, IOService * theNub, IOService * theDevice, OSDictionary * theParent);
99 virtual bool RegisterServiceInTree (IOService * theService, OSDictionary * theTreeNode, OSDictionary * theTreeParentNode, IOService * theProvider);
100
101 virtual void PMInstantiatePowerDomains ( void );
102
103 public:
104 virtual bool attach( IOService * provider );
105 virtual bool start( IOService * provider );
106 virtual bool configure( IOService * provider );
107 virtual IOService * createNub( OSDictionary * from );
108
109 virtual bool compareNubName( const IOService * nub, OSString * name,
110 OSString ** matched = 0 ) const;
111 virtual IOReturn getNubResources( IOService * nub );
112
113 virtual long getBootROMType(void);
114 virtual long getChipSetType(void);
115 virtual long getMachineType(void);
116
117 virtual bool getModelName( char * name, int maxLength );
118 virtual bool getMachineName( char * name, int maxLength );
119
120 virtual int haltRestart(unsigned int type);
121 virtual void sleepKernel(void);
122
123 virtual long getGMTTimeOfDay( void );
124 virtual void setGMTTimeOfDay( long secs );
125
126 virtual IOReturn getConsoleInfo( PE_Video * consoleInfo );
127 virtual IOReturn setConsoleInfo( PE_Video * consoleInfo, unsigned int op );
128
129 virtual void registerNVRAMController( IONVRAMController * nvram );
130
131 virtual IOReturn registerInterruptController(OSSymbol *name, IOInterruptController *interruptController);
132 virtual IOInterruptController *lookUpInterruptController(OSSymbol *name);
133 virtual void setCPUInterruptProperties(IOService *service);
134 virtual bool atInterruptLevel(void);
135
136 virtual IOReturn callPlatformFunction(const OSSymbol *functionName,
137 bool waitForFunction,
138 void *param1, void *param2,
139 void *param3, void *param4);
140
141 virtual IORangeAllocator * getPhysicalRangeAllocator(void);
142
143 virtual bool platformAdjustService(IOService *service);
144
145 virtual void PMRegisterDevice(IOService * theNub, IOService * theDevice);
146 virtual void PMLog ( const char *,unsigned long, unsigned long, unsigned long );
147
148 virtual bool hasPMFeature (unsigned long featureMask);
149 virtual bool hasPrivPMFeature (unsigned long privFeatureMask);
150 virtual int numBatteriesSupported (void);
151
152 virtual IOByteCount savePanicInfo(UInt8 *buffer, IOByteCount length);
153
154 virtual OSString* createSystemSerialNumberString(OSData* myProperty);
155
156 OSMetaClassDeclareReservedUsed(IOPlatformExpert, 0);
157 OSMetaClassDeclareReservedUsed(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
172 class IODTNVRAM;
173
174 class IODTPlatformExpert : public IOPlatformExpert
175 {
176 OSDeclareAbstractStructors(IODTPlatformExpert);
177
178 private:
179 IODTNVRAM *dtNVRAM;
180
181 struct ExpansionData { };
182 ExpansionData *reserved;
183
184 public:
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 virtual OSString* createSystemSerialNumberString(OSData* myProperty);
236
237 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 0);
238 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 1);
239 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 2);
240 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 3);
241 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 4);
242 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 5);
243 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 6);
244 OSMetaClassDeclareReservedUnused(IODTPlatformExpert, 7);
245 };
246
247 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
248
249 /* generic root nub of service tree */
250
251 class IOPlatformExpertDevice : public IOService
252 {
253 OSDeclareDefaultStructors(IOPlatformExpertDevice)
254
255 private:
256 IOWorkLoop *workLoop;
257
258 struct ExpansionData { };
259 ExpansionData *reserved;
260
261 public:
262 virtual bool initWithArgs( void * p1, void * p2,
263 void * p3, void *p4 );
264 virtual bool compareName( OSString * name, OSString ** matched = 0 ) const;
265
266 virtual IOWorkLoop *getWorkLoop() const;
267
268 virtual void free();
269
270 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice, 0);
271 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice, 1);
272 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice, 2);
273 OSMetaClassDeclareReservedUnused(IOPlatformExpertDevice, 3);
274 };
275
276 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
277
278 /* generic nub for motherboard devices */
279
280 class IOPlatformDevice : public IOService
281 {
282 OSDeclareDefaultStructors(IOPlatformDevice)
283
284 struct ExpansionData { };
285 ExpansionData *reserved;
286
287 public:
288 virtual bool compareName( OSString * name, OSString ** matched = 0 ) const;
289 virtual IOService * matchLocation( IOService * client );
290 virtual IOReturn getResources( void );
291
292 OSMetaClassDeclareReservedUnused(IOPlatformDevice, 0);
293 OSMetaClassDeclareReservedUnused(IOPlatformDevice, 1);
294 OSMetaClassDeclareReservedUnused(IOPlatformDevice, 2);
295 OSMetaClassDeclareReservedUnused(IOPlatformDevice, 3);
296 };
297
298 #endif /* __cplusplus */
299
300 #endif /* ! _IOKIT_IOPLATFORMEXPERT_H */