Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch_Modules/i386/include/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
45extern "C" {
46#endif
47
48#include <libkern/OSTypes.h>
49
50extern boolean_t PEGetMachineName( char * name, int maxLength );
51extern boolean_t PEGetModelName( char * name, int maxLength );
52extern int PEGetPlatformEpoch( void );
53
54enum {
55 kPEHaltCPU,
56 kPERestartCPU,
57 kPEHangCPU,
58 kPEUPSDelayHaltCPU,
59 kPEPanicRestartCPU,
60 kPEPanicSync
61};
62extern int (*PE_halt_restart)(unsigned int type);
63extern int PEHaltRestart(unsigned int type);
64
65// Save the Panic Info. Returns the number of bytes saved.
66extern UInt32 PESavePanicInfo(UInt8 *buffer, UInt32 length);
67
68extern long PEGetGMTTimeOfDay( void );
69extern void PESetGMTTimeOfDay( long secs );
70
71#ifdef __cplusplus
72} /* extern "C" */
73
74#define kIOPlatformMapperPresentKey "IOPlatformMapperPresent"
75
76
77extern OSSymbol * gPlatformInterruptControllerName;
78
79extern const OSSymbol *gIOPlatformSleepActionKey;
80extern const OSSymbol *gIOPlatformWakeActionKey;
81extern const OSSymbol *gIOPlatformQuiesceActionKey;
82extern const OSSymbol *gIOPlatformActiveActionKey;
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
169 virtual IOByteCount savePanicInfo(UInt8 *buffer, IOByteCount length);
170
171 virtual OSString* createSystemSerialNumberString(OSData* myProperty);
172
173 OSMetaClassDeclareReservedUsed(IOPlatformExpert, 0);
174 OSMetaClassDeclareReservedUsed(IOPlatformExpert, 1);
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,
203SInt32 *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);
226
227 /* virtual */ IOReturn writeXPRAM(IOByteCount offset, UInt8 * buffer,
228 IOByteCount length);
229
230 virtual IOReturn readNVRAMProperty(
231IORegistryEntry * entry,
232const OSSymbol ** name, OSData ** value );
233
234 virtual IOReturn writeNVRAMProperty(
235IORegistryEntry * entry,
236const OSSymbol * name, OSData * value );
237
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);
250
251 virtual IOByteCount savePanicInfo(UInt8 *buffer, IOByteCount length);
252 virtual OSString* createSystemSerialNumberString(OSData* myProperty);
253
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,
280void * p3, void *p4 );
281 virtual bool compareName( OSString * name, OSString ** matched = 0 ) const;
282
283 virtual IOWorkLoop *getWorkLoop() const;
284 virtual IOReturn setProperties( OSObject * properties );
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 */
319

Archive Download this file

Revision: 2238