Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/IOKit/ndrvsupport/IONDRVFramebuffer.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) 1997-1998 Apple Computer, Inc.
24 *
25 *
26 * HISTORY
27 *
28 * sdouglas 22 Oct 97 - first checked in.
29 * sdouglas 24 Jul 98 - start IOKit.
30 * sdouglas 15 Dec 98 - cpp.
31 *
32 */
33
34#ifndef _IOKIT_IONDRVFRAMEBUFFER_H
35#define _IOKIT_IONDRVFRAMEBUFFER_H
36
37#include <IOKit/graphics/IOFramebuffer.h>
38#include <IOKit/ndrvsupport/IOMacOSVideo.h>
39#include <IOKit/ndrvsupport/IONDRVSupport.h>
40
41#define kIONDRVDisableKey "AAPL,disable-ndrv"
42
43class IONDRVFramebuffer : public IOFramebuffer
44{
45 OSDeclareDefaultStructors(IONDRVFramebuffer)
46
47protected:
48/*! @struct ExpansionData
49 @discussion This structure will be used to expand the capablilties of this class in the future.
50 */
51 struct ExpansionData { };
52
53/*! @var reserved
54 Reserved for future use. (Internal use only) */
55 ExpansionData * reserved;
56
57protected:
58
59 IOService * nub;
60 class IONDRV * ndrv;
61
62 // current configuration
63 IODisplayModeID currentDisplayMode;
64 IOIndex currentDepth;
65 IOIndex currentPage;
66 UInt8 __reservedE;
67
68 IOPhysicalAddress physicalFramebuffer;
69 IODeviceMemory * vramRange;
70
71 UInt8 gammaWidth;
72 UInt8 __reservedD;
73 UInt8 lastGrayMode;
74 VDClutBehavior lastClutSetting;
75 UInt8 __reservedC;
76
77 bool consoleDevice;
78 UInt32 powerState;
79 UInt32 ndrvState;
80 SInt32 ndrvEnter;
81 OSArray * detailedTimings;
82 UInt32 detailedTimingsSeed;
83 UInt32 * detailedTimingsCurrent;
84
85 IODeviceMemory * vramMemory;
86
87 VDResolutionInfoRec cachedVDResolution;
88
89 struct _VSLService * vslServices;
90
91 UInt32 accessFlags;
92 unsigned int shouldDoI2CPower:1;
93 unsigned int online:1;
94 unsigned int avJackState:1;
95 unsigned int grayMode:1;
96 unsigned int platformSleep:1;
97 unsigned int forceReadEDID:1;
98 unsigned int supportsProbe:1;
99 unsigned int __reservedB:25;
100
101 IOService * device;
102
103 UInt32 __reservedA[29];
104
105private:
106 struct IONDRVFramebufferPrivate * __private;
107
108public:
109 virtual IOReturn doDriverIO( UInt32 commandID, void * contents,
110 UInt32 commandCode, UInt32 commandKind );
111private:
112 OSMetaClassDeclareReservedUsed(IONDRVFramebuffer, 0);
113
114 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 1);
115 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 2);
116 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 3);
117 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 4);
118 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 5);
119 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 6);
120 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 7);
121 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 8);
122 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 9);
123 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 10);
124 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 11);
125 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 12);
126 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 13);
127 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 14);
128 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 15);
129 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 16);
130 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 17);
131 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 18);
132 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 19);
133 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 20);
134 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 21);
135 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 22);
136 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 23);
137 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 24);
138 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 25);
139 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 26);
140 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 27);
141 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 28);
142 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 29);
143 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 30);
144 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 31);
145
146private:
147
148 void initForPM ( void );
149
150 virtual unsigned long maxCapabilityForDomainState( IOPMPowerFlags domainState );
151 virtual unsigned long initialPowerStateForDomainState( IOPMPowerFlags domainState );
152 virtual unsigned long powerStateForDomainState( IOPMPowerFlags domainState );
153
154 virtual IOReturn checkDriver( void );
155 virtual UInt32 iterateAllModes( IODisplayModeID * displayModeIDs );
156 virtual IOReturn getResInfoForMode( IODisplayModeID modeID,
157 IODisplayModeInformation * theInfo );
158 virtual IOReturn getResInfoForArbMode( IODisplayModeID modeID,
159 IODisplayModeInformation * theInfo );
160 IOReturn getResInfoForDetailed( IODisplayModeID modeID,
161 VDDetailedTimingRec * detailed,
162 IODisplayModeInformation * info );
163 IOIndex mapDepthIndex( IODisplayModeID modeID, IOIndex depth, bool fromDepthMode );
164 virtual IOReturn validateDisplayMode(
165 IODisplayModeID mode, IOOptionBits flags,
166 VDDetailedTimingRec ** detailed );
167 virtual IOReturn setDetailedTiming(
168 IODisplayModeID mode, IOOptionBits options,
169 void * description, IOByteCount descripSize );
170 virtual void getCurrentConfiguration( void );
171 static const IOTVector * _undefinedSymbolHandler( void * self,
172 const char * libraryName, const char * symbolName );
173 static bool _videoJackStateChangeHandler( void * target, void * ref,
174 IOService * newService, IONotifier * notifier );
175 static void _avProbeAction( OSObject * p0, IOTimerEventSource * evtSrc );
176 void displayI2CPower( bool enable );
177 IOReturn ndrvSetPowerState( UInt32 newState );
178 IOReturn ndrvUpdatePowerState( void );
179 IOReturn ndrvSetDisplayPowerState( UInt32 newState );
180 static IOReturn _probeAction( IONDRVFramebuffer * self, IOOptionBits options );
181 bool searchOfflineMode( IODisplayModeID * offlineMode );
182 IOReturn processConnectChange( uintptr_t * value );
183 IOReturn setMirror( IONDRVFramebuffer * other );
184 IOReturn setConnectionFlags( void );
185 bool getOnlineState( void );
186 IOReturn ndrvGetSetFeature( UInt32 feature, uintptr_t newValue, uintptr_t * currentValue );
187 static IOReturn _doControl( IONDRVFramebuffer * self, UInt32 code, void * params );
188 static IOReturn _doStatus( IONDRVFramebuffer * self, UInt32 code, void * params );
189 static IOReturn extControl( OSObject * owner, void * code, void * params );
190 static IOReturn extStatus( OSObject * owner, void * code, void * params );
191 IOReturn createI2C( void );
192 void setInfoProperties( void );
193
194public:
195 virtual IOReturn doControl( UInt32 code, void * params );
196 virtual IOReturn doStatus( UInt32 code, void * params );
197
198public:
199
200 virtual IOService * probe( IOService * provider,
201 SInt32 * score );
202
203 virtual bool start( IOService * provider );
204
205 virtual void stop( IOService * provider );
206
207 virtual void free( void );
208
209 virtual IOReturn setProperties( OSObject * properties );
210
211 virtual IOReturn requestProbe( IOOptionBits options );
212
213 virtual IOReturn enableController( void );
214
215 virtual IODeviceMemory * makeSubRange( IOPhysicalAddress start,
216 IOPhysicalLength length );
217 virtual IODeviceMemory * getApertureRange( IOPixelAperture aperture );
218 virtual IODeviceMemory * getVRAMRange( void );
219
220 virtual IODeviceMemory * findVRAM( void );
221
222 virtual bool isConsoleDevice( void );
223
224 virtual const IOTVector * undefinedSymbolHandler( const char * libraryName,
225 const char * symbolName );
226
227 virtual const char * getPixelFormats( void );
228
229 // Array of supported display modes
230 virtual IOItemCount getDisplayModeCount( void );
231 virtual IOReturn getDisplayModes( IODisplayModeID * allDisplayModes );
232
233 // Info about a display mode
234 virtual IOReturn getInformationForDisplayMode( IODisplayModeID displayMode,
235 IODisplayModeInformation * info );
236
237 // Mask of pixel formats available in mode and depth
238 virtual UInt64 getPixelFormatsForDisplayMode( IODisplayModeID displayMode,
239 IOIndex depth );
240
241 virtual IOReturn getPixelInformation(
242 IODisplayModeID displayMode, IOIndex depth,
243 IOPixelAperture aperture, IOPixelInformation * pixelInfo );
244
245 // Framebuffer info
246
247 // Current display mode and depth
248 virtual IOReturn getCurrentDisplayMode( IODisplayModeID * displayMode,
249 IOIndex * depth );
250
251 // Set display mode and depth
252 virtual IOReturn setDisplayMode( IODisplayModeID displayMode,
253 IOIndex depth );
254
255 // For pages
256 virtual IOReturn setApertureEnable( IOPixelAperture aperture,
257 IOOptionBits enable );
258
259 virtual IOReturn setStartupDisplayMode( IODisplayModeID displayMode,
260 IOIndex depth );
261 virtual IOReturn getStartupDisplayMode( IODisplayModeID * displayMode,
262 IOIndex * depth );
263
264 //// CLUTs
265
266 virtual IOReturn setCLUTWithEntries( IOColorEntry * colors, UInt32 index,
267 UInt32 numEntries, IOOptionBits options );
268
269 //// Gamma
270
271 virtual IOReturn setGammaTable( UInt32 channelCount, UInt32 dataCount,
272 UInt32 dataWidth, void * data );
273
274 //// Display mode timing information
275
276 virtual IOReturn getTimingInfoForDisplayMode( IODisplayModeID displayMode,
277 IOTimingInformation * info );
278
279 //// Detailed timing information
280
281 virtual IOReturn validateDetailedTiming(
282 void * description, IOByteCount descripSize );
283
284 virtual IOReturn setDetailedTimings( OSArray * array );
285
286 //// Controller attributes
287
288 virtual IOReturn setAttribute( IOSelect attribute, uintptr_t value );
289 virtual IOReturn getAttribute( IOSelect attribute, uintptr_t * value );
290
291 //// Connections
292
293 virtual IOItemCount getConnectionCount( void );
294
295 virtual IOReturn getAttributeForConnection( IOIndex connectIndex,
296 IOSelect attribute, uintptr_t * value );
297
298 virtual IOReturn setAttributeForConnection( IOIndex connectIndex,
299 IOSelect attribute, uintptr_t info );
300
301 // Apple sensing
302
303 virtual IOReturn getAppleSense( IOIndex connectIndex,
304 UInt32 * senseType,
305 UInt32 * primary,
306 UInt32 * extended,
307 UInt32 * displayType );
308
309 virtual IOReturn connectFlags( IOIndex connectIndex,
310 IODisplayModeID displayMode, IOOptionBits * flags );
311
312 //// IOHighLevelDDCSense
313
314 virtual bool hasDDCConnect( IOIndex connectIndex );
315 virtual IOReturn getDDCBlock( IOIndex connectIndex, UInt32 blockNumber,
316 IOSelect blockType, IOOptionBits options,
317 UInt8 * data, IOByteCount * length );
318
319 //// Interrupts
320
321 virtual IOReturn registerForInterruptType( IOSelect interruptType,
322 IOFBInterruptProc proc, OSObject * target, void * ref,
323 void ** interruptRef );
324 virtual IOReturn unregisterInterrupt( void * interruptRef );
325 virtual IOReturn setInterruptState( void * interruptRef, UInt32 state );
326
327 //// HW Cursors
328
329 virtual IOReturn setCursorImage( void * cursorImage );
330 virtual IOReturn setCursorState( SInt32 x, SInt32 y, bool visible );
331
332 //// I2C calls
333
334 virtual IOReturn doI2CRequest( UInt32 bus, IOI2CBusTiming * timing, IOI2CRequest * request );
335
336 //// VSL calls
337
338 static OSStatus VSLNewInterruptService(
339 void * entryID,
340 UInt32 serviceType,
341 _VSLService ** serviceID );
342 static OSStatus VSLDisposeInterruptService( _VSLService * serviceID );
343 static OSStatus VSLDoInterruptService( _VSLService * serviceID );
344 static Boolean VSLPrepareCursorForHardwareCursor(
345 void * cursorRef,
346 IOHardwareCursorDescriptor * hwDesc,
347 IOHardwareCursorInfo * hwCursorInfo );
348};
349
350#endif /* ! _IOKIT_IONDRVFRAMEBUFFER_H */
351
352
353

Archive Download this file

Revision: 1340