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