2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Boot video dumb frambuffer shim
26 #include "IOBootFramebuffer.h"
28 enum { kTheDisplayMode
= 10 };
30 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
33 #define super IOFramebuffer
35 OSDefineMetaClassAndStructors(IOBootFramebuffer
, IOFramebuffer
)
37 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
39 IOService
* IOBootFramebuffer::probe( IOService
* provider
,
48 if( !provider
->getProperty("AAPL,boot-display"))
51 err
= getPlatform()->getConsoleInfo( &bootDisplay
);
52 if( err
|| (bootDisplay
.v_baseAddr
== 0))
55 if (false == super::probe( provider
, score
))
59 ret
= this; // Success
67 const char * IOBootFramebuffer::getPixelFormats( void )
72 getPlatform()->getConsoleInfo( &bootDisplay
);
74 switch( bootDisplay
.v_depth
) {
77 ret
= IO8BitIndexedPixels
;
81 ret
= IO16BitDirectPixels
;
85 ret
= IO32BitDirectPixels
;
92 IOItemCount
IOBootFramebuffer::getDisplayModeCount( void )
97 IOReturn
IOBootFramebuffer::getDisplayModes(
98 IODisplayModeID
* allDisplayModes
)
101 *allDisplayModes
= kTheDisplayMode
;
102 return( kIOReturnSuccess
);
105 IOReturn
IOBootFramebuffer::getInformationForDisplayMode(
106 IODisplayModeID
/* displayMode */,
107 IODisplayModeInformation
* info
)
109 PE_Video bootDisplay
;
111 getPlatform()->getConsoleInfo( &bootDisplay
);
113 bzero( info
, sizeof( *info
));
115 info
->maxDepthIndex
= 0;
116 info
->nominalWidth
= bootDisplay
.v_width
;
117 info
->nominalHeight
= bootDisplay
.v_height
;
118 info
->refreshRate
= 75 << 16;
120 return( kIOReturnSuccess
);
123 UInt64
IOBootFramebuffer::getPixelFormatsForDisplayMode(
124 IODisplayModeID
/* displayMode */, IOIndex
/* depth */ )
129 IOReturn
IOBootFramebuffer::getPixelInformation(
130 IODisplayModeID displayMode
, IOIndex depth
,
131 IOPixelAperture aperture
, IOPixelInformation
* info
)
133 PE_Video bootDisplay
;
135 if( aperture
|| depth
|| (displayMode
!= kTheDisplayMode
) )
136 return( kIOReturnUnsupportedMode
);
138 getPlatform()->getConsoleInfo( &bootDisplay
);
140 bzero( info
, sizeof( *info
));
142 info
->activeWidth
= bootDisplay
.v_width
;
143 info
->activeHeight
= bootDisplay
.v_height
;
144 info
->bytesPerRow
= bootDisplay
.v_rowBytes
& 0x7fff;
145 info
->bytesPerPlane
= 0;
147 switch( bootDisplay
.v_depth
) {
150 strcpy(info
->pixelFormat
, IO8BitIndexedPixels
);
151 info
->pixelType
= kIOCLUTPixels
;
152 info
->componentMasks
[0] = 0xff;
153 info
->bitsPerPixel
= 8;
154 info
->componentCount
= 1;
155 info
->bitsPerComponent
= 8;
159 strcpy(info
->pixelFormat
, IO16BitDirectPixels
);
160 info
->pixelType
= kIORGBDirectPixels
;
161 info
->componentMasks
[0] = 0x7c00;
162 info
->componentMasks
[1] = 0x03e0;
163 info
->componentMasks
[2] = 0x001f;
164 info
->bitsPerPixel
= 16;
165 info
->componentCount
= 3;
166 info
->bitsPerComponent
= 5;
170 strcpy(info
->pixelFormat
, IO32BitDirectPixels
);
171 info
->pixelType
= kIORGBDirectPixels
;
172 info
->componentMasks
[0] = 0x00ff0000;
173 info
->componentMasks
[1] = 0x0000ff00;
174 info
->componentMasks
[2] = 0x000000ff;
175 info
->bitsPerPixel
= 32;
176 info
->componentCount
= 3;
177 info
->bitsPerComponent
= 8;
181 return( kIOReturnSuccess
);
184 IOReturn
IOBootFramebuffer::getCurrentDisplayMode(
185 IODisplayModeID
* displayMode
, IOIndex
* depth
)
188 *displayMode
= kTheDisplayMode
;
192 return( kIOReturnSuccess
);
195 IODeviceMemory
* IOBootFramebuffer::getApertureRange( IOPixelAperture aper
)
198 IOPixelInformation info
;
200 PE_Video bootDisplay
;
202 getPlatform()->getConsoleInfo( &bootDisplay
);
204 err
= getPixelInformation( kTheDisplayMode
, 0, aper
,
209 bytes
= (info
.bytesPerRow
* info
.activeHeight
) + 128;
211 return( IODeviceMemory::withRange( bootDisplay
.v_baseAddr
, bytes
));
214 bool IOBootFramebuffer::isConsoleDevice( void )
216 return( (0 != getProvider()->getProperty("AAPL,boot-display")) );
219 IOReturn
IOBootFramebuffer::setGammaTable( UInt32 channelCount
,
220 UInt32 dataCount
, UInt32 dataWidth
, void * data
)
222 return( kIOReturnSuccess
);
225 IOReturn
IOBootFramebuffer::setCLUTWithEntries(
226 IOColorEntry
* colors
, UInt32 index
, UInt32 numEntries
,
227 IOOptionBits options
)
229 return( kIOReturnSuccess
);