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