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