]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/ndrvsupport/IONDRVFramebuffer.h
d81e8f29a8801630eb28389fdecc57c45d852727
[apple/xnu.git] / iokit / 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
42 #define kIONDRVDisableKey "AAPL,disable-ndrv"
43
44
45 class IONDRVFramebuffer : public IOFramebuffer
46 {
47 OSDeclareDefaultStructors(IONDRVFramebuffer)
48
49 protected:
50 /*! @struct ExpansionData
51 @discussion This structure will be used to expand the capablilties of this class in the future.
52 */
53 struct ExpansionData { };
54
55 /*! @var reserved
56 Reserved for future use. (Internal use only) */
57 ExpansionData * reserved;
58
59 protected:
60
61 IOService * nub;
62 class IONDRV * ndrv;
63
64 // current configuration
65 IODisplayModeID currentDisplayMode;
66 IOIndex currentDepth;
67 IOIndex currentPage;
68 bool directMode;
69
70 IOPhysicalAddress physicalFramebuffer;
71 IODeviceMemory * vramRange;
72
73 UInt8 startAt8;
74 UInt8 grayMode;
75 UInt8 lastGrayMode;
76 VDClutBehavior lastClutSetting;
77 UInt8 platformDeepSleep;
78
79 bool consoleDevice;
80 UInt32 powerState;
81 UInt32 ndrvState;
82 SInt32 ndrvEnter;
83 OSArray * detailedTimings;
84 UInt32 detailedTimingsSeed;
85 UInt32 * detailedTimingsCurrent;
86
87 IODeviceMemory * vramMemory;
88
89 VDResolutionInfoRec cachedVDResolution;
90
91 struct _VSLService * vslServices;
92
93 UInt32 accessFlags;
94 UInt8 shouldDoI2CPower;
95
96 UInt8 __reservedB[3];
97 UInt32 __reservedA[31];
98
99 private:
100 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 0);
101 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 1);
102 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 2);
103 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 3);
104 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 4);
105 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 5);
106 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 6);
107 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 7);
108 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 8);
109 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 9);
110 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 10);
111 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 11);
112 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 12);
113 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 13);
114 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 14);
115 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 15);
116 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 16);
117 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 17);
118 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 18);
119 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 19);
120 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 20);
121 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 21);
122 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 22);
123 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 23);
124 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 24);
125 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 25);
126 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 26);
127 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 27);
128 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 28);
129 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 29);
130 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 30);
131 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 31);
132
133 private:
134
135 void initForPM ( void );
136 IOReturn setPowerState( unsigned long, IOService* );
137 unsigned long maxCapabilityForDomainState( IOPMPowerFlags );
138 unsigned long initialPowerStateForDomainState( IOPMPowerFlags );
139 unsigned long powerStateForDomainState( IOPMPowerFlags );
140
141 virtual IOReturn checkDriver( void );
142 virtual UInt32 iterateAllModes( IODisplayModeID * displayModeIDs );
143 virtual IOReturn getResInfoForMode( IODisplayModeID modeID,
144 IODisplayModeInformation * theInfo );
145 virtual IOReturn getResInfoForArbMode( IODisplayModeID modeID,
146 IODisplayModeInformation * theInfo );
147 virtual IOReturn validateDisplayMode(
148 IODisplayModeID mode, IOOptionBits flags,
149 VDDetailedTimingRec ** detailed );
150 virtual IOReturn setDetailedTiming(
151 IODisplayModeID mode, IOOptionBits options,
152 void * description, IOByteCount descripSize );
153 virtual void getCurrentConfiguration( void );
154 static const IOTVector * _undefinedSymbolHandler( void * self,
155 const char * libraryName, const char * symbolName );
156 void displayI2CPower( bool enable );
157
158 public:
159 virtual IOReturn doControl( UInt32 code, void * params );
160 virtual IOReturn doStatus( UInt32 code, void * params );
161
162 public:
163
164 virtual IOService * probe( IOService * provider,
165 SInt32 * score );
166
167 virtual bool start( IOService * provider );
168
169 virtual void free( void );
170
171 virtual IOReturn setProperties( OSObject * properties );
172
173 virtual IOReturn enableController( void );
174
175 virtual IODeviceMemory * makeSubRange( IOPhysicalAddress start,
176 IOPhysicalLength length );
177 virtual IODeviceMemory * getApertureRange( IOPixelAperture aperture );
178 virtual IODeviceMemory * getVRAMRange( void );
179
180 virtual IODeviceMemory * findVRAM( void );
181
182 virtual bool isConsoleDevice( void );
183
184 virtual const IOTVector * undefinedSymbolHandler( const char * libraryName,
185 const char * symbolName );
186
187 virtual const char * getPixelFormats( void );
188
189 // Array of supported display modes
190 virtual IOItemCount getDisplayModeCount( void );
191 virtual IOReturn getDisplayModes( IODisplayModeID * allDisplayModes );
192
193 // Info about a display mode
194 virtual IOReturn getInformationForDisplayMode( IODisplayModeID displayMode,
195 IODisplayModeInformation * info );
196
197 // Mask of pixel formats available in mode and depth
198 virtual UInt64 getPixelFormatsForDisplayMode( IODisplayModeID displayMode,
199 IOIndex depth );
200
201 virtual IOReturn getPixelInformation(
202 IODisplayModeID displayMode, IOIndex depth,
203 IOPixelAperture aperture, IOPixelInformation * pixelInfo );
204
205 // Framebuffer info
206
207 // Current display mode and depth
208 virtual IOReturn getCurrentDisplayMode( IODisplayModeID * displayMode,
209 IOIndex * depth );
210
211 // Set display mode and depth
212 virtual IOReturn setDisplayMode( IODisplayModeID displayMode,
213 IOIndex depth );
214
215 // For pages
216 virtual IOReturn setApertureEnable( IOPixelAperture aperture,
217 IOOptionBits enable );
218
219 virtual IOReturn setStartupDisplayMode( IODisplayModeID displayMode,
220 IOIndex depth );
221 virtual IOReturn getStartupDisplayMode( IODisplayModeID * displayMode,
222 IOIndex * depth );
223
224 //// CLUTs
225
226 virtual IOReturn setCLUTWithEntries( IOColorEntry * colors, UInt32 index,
227 UInt32 numEntries, IOOptionBits options );
228
229 //// Gamma
230
231 virtual IOReturn setGammaTable( UInt32 channelCount, UInt32 dataCount,
232 UInt32 dataWidth, void * data );
233
234 //// Display mode timing information
235
236 virtual IOReturn getTimingInfoForDisplayMode( IODisplayModeID displayMode,
237 IOTimingInformation * info );
238
239 //// Detailed timing information
240
241 virtual IOReturn validateDetailedTiming(
242 void * description, IOByteCount descripSize );
243
244 virtual IOReturn setDetailedTimings( OSArray * array );
245
246 //// Controller attributes
247
248 virtual IOReturn getAttribute( IOSelect attribute, UInt32 * value );
249
250 //// Connections
251
252 virtual IOItemCount getConnectionCount( void );
253
254 virtual IOReturn getAttributeForConnection( IOIndex connectIndex,
255 IOSelect attribute, UInt32 * value );
256
257 virtual IOReturn setAttributeForConnection( IOIndex connectIndex,
258 IOSelect attribute, UInt32 info );
259
260 // Apple sensing
261
262 virtual IOReturn getAppleSense( IOIndex connectIndex,
263 UInt32 * senseType,
264 UInt32 * primary,
265 UInt32 * extended,
266 UInt32 * displayType );
267
268 virtual IOReturn connectFlags( IOIndex connectIndex,
269 IODisplayModeID displayMode, IOOptionBits * flags );
270
271 //// IOHighLevelDDCSense
272
273 virtual bool hasDDCConnect( IOIndex connectIndex );
274 virtual IOReturn getDDCBlock( IOIndex connectIndex, UInt32 blockNumber,
275 IOSelect blockType, IOOptionBits options,
276 UInt8 * data, IOByteCount * length );
277
278 //// Interrupts
279
280 virtual IOReturn registerForInterruptType( IOSelect interruptType,
281 IOFBInterruptProc proc, OSObject * target, void * ref,
282 void ** interruptRef );
283 virtual IOReturn unregisterInterrupt( void * interruptRef );
284 virtual IOReturn setInterruptState( void * interruptRef, UInt32 state );
285
286 //// HW Cursors
287
288 virtual IOReturn setCursorImage( void * cursorImage );
289 virtual IOReturn setCursorState( SInt32 x, SInt32 y, bool visible );
290
291 //// VSL calls
292
293 static OSStatus VSLNewInterruptService(
294 void * entryID,
295 UInt32 serviceType,
296 _VSLService ** serviceID );
297 static OSStatus VSLDisposeInterruptService( _VSLService * serviceID );
298 static OSStatus VSLDoInterruptService( _VSLService * serviceID );
299 static Boolean VSLPrepareCursorForHardwareCursor(
300 void * cursorRef,
301 IOHardwareCursorDescriptor * hwDesc,
302 IOHardwareCursorInfo * hwCursorInfo );
303 };
304
305 #endif /* ! _IOKIT_IONDRVFRAMEBUFFER_H */
306
307