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