3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 CirrusLogic5430UgaDraw.c
18 This file produces the graphics abstration of UGA Draw. It is called by
19 CirrusLogic5430.c file which deals with the EFI 1.1 driver model.
20 This file just does graphics.
24 #include "CirrusLogic5430.h"
27 // Video Mode structure
37 } CIRRUS_LOGIC_5430_VIDEO_MODES
;
40 // Generic Attribute Controller Register Settings
42 static UINT8 AttributeController
[21] = {
43 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
44 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
45 0x41, 0x00, 0x0F, 0x00, 0x00
49 // Generic Graphics Controller Register Settings
51 static UINT8 GraphicsController
[9] = {
52 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, 0xFF
56 // 640 x 480 x 256 color @ 60 Hertz
58 static UINT8 Crtc_640_480_256_60
[28] = {
59 0x5d, 0x4f, 0x50, 0x82, 0x53, 0x9f, 0x00, 0x3e,
60 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0xe1, 0x83, 0xdf, 0x50, 0x00, 0xe7, 0x04, 0xe3,
62 0xff, 0x00, 0x00, 0x22
65 static UINT16 Seq_640_480_256_60
[15] = {
66 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
67 0x5b0c, 0x450d, 0x7e0e, 0x2b1b, 0x2f1c, 0x301d, 0x331e
71 // 800 x 600 x 256 color @ 60 Hertz
73 static UINT8 Crtc_800_600_256_60
[28] = {
74 0x7F, 0x63, 0x64, 0x80, 0x6B, 0x1B, 0x72, 0xF0,
75 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76 0x58, 0x8C, 0x57, 0x64, 0x00, 0x5F, 0x91, 0xE3,
77 0xFF, 0x00, 0x00, 0x22
80 static UINT16 Seq_800_600_256_60
[15] = {
81 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
82 0x5b0c, 0x450d, 0x510e, 0x2b1b, 0x2f1c, 0x301d, 0x3a1e
86 // 1024 x 768 x 256 color @ 60 Hertz
88 static UINT8 Crtc_1024_768_256_60
[28] = {
89 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xFD,
90 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
91 0x02, 0x88, 0xFF, 0x80, 0x00, 0x00, 0x24, 0xE3,
92 0xFF, 0x4A, 0x00, 0x22
95 static UINT16 Seq_1024_768_256_60
[15] = {
96 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
97 0x5b0c, 0x450d, 0x760e, 0x2b1b, 0x2f1c, 0x301d, 0x341e
101 // Table of supported video modes
103 static CIRRUS_LOGIC_5430_VIDEO_MODES CirrusLogic5430VideoModes
[] = {
104 { 640, 480, 8, 60, Crtc_640_480_256_60
, Seq_640_480_256_60
, 0xe3 },
105 { 800, 600, 8, 60, Crtc_800_600_256_60
, Seq_800_600_256_60
, 0xef },
106 { 1024, 768, 8, 60, Crtc_1024_768_256_60
, Seq_1024_768_256_60
, 0xef }
110 // Local Function Prototypes
113 InitializeGraphicsMode (
114 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
115 CIRRUS_LOGIC_5430_VIDEO_MODES
*ModeData
120 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
129 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
135 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
140 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
145 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
152 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
159 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
165 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
170 // UGA Draw Protocol Member Functions
174 CirrusLogic5430UgaDrawGetMode (
175 IN EFI_UGA_DRAW_PROTOCOL
*This
,
176 OUT UINT32
*HorizontalResolution
,
177 OUT UINT32
*VerticalResolution
,
178 OUT UINT32
*ColorDepth
,
179 OUT UINT32
*RefreshRate
185 TODO: Add function description
189 This - TODO: add argument description
190 HorizontalResolution - TODO: add argument description
191 VerticalResolution - TODO: add argument description
192 ColorDepth - TODO: add argument description
193 RefreshRate - TODO: add argument description
197 EFI_NOT_STARTED - TODO: Add description for return value
198 EFI_INVALID_PARAMETER - TODO: Add description for return value
199 EFI_SUCCESS - TODO: Add description for return value
203 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
;
205 Private
= CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This
);
207 if (Private
->HardwareNeedsStarting
) {
208 return EFI_NOT_STARTED
;
211 if ((HorizontalResolution
== NULL
) ||
212 (VerticalResolution
== NULL
) ||
213 (ColorDepth
== NULL
) ||
214 (RefreshRate
== NULL
)) {
215 return EFI_INVALID_PARAMETER
;
218 *HorizontalResolution
= Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
;
219 *VerticalResolution
= Private
->ModeData
[Private
->CurrentMode
].VerticalResolution
;
220 *ColorDepth
= Private
->ModeData
[Private
->CurrentMode
].ColorDepth
;
221 *RefreshRate
= Private
->ModeData
[Private
->CurrentMode
].RefreshRate
;
228 CirrusLogic5430UgaDrawSetMode (
229 IN EFI_UGA_DRAW_PROTOCOL
*This
,
230 IN UINT32 HorizontalResolution
,
231 IN UINT32 VerticalResolution
,
232 IN UINT32 ColorDepth
,
233 IN UINT32 RefreshRate
239 TODO: Add function description
243 This - TODO: add argument description
244 HorizontalResolution - TODO: add argument description
245 VerticalResolution - TODO: add argument description
246 ColorDepth - TODO: add argument description
247 RefreshRate - TODO: add argument description
251 EFI_OUT_OF_RESOURCES - TODO: Add description for return value
252 EFI_SUCCESS - TODO: Add description for return value
253 EFI_NOT_FOUND - TODO: Add description for return value
257 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
;
260 Private
= CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This
);
262 for (Index
= 0; Index
< Private
->MaxMode
; Index
++) {
264 if (HorizontalResolution
!= Private
->ModeData
[Index
].HorizontalResolution
) {
268 if (VerticalResolution
!= Private
->ModeData
[Index
].VerticalResolution
) {
272 if (ColorDepth
!= Private
->ModeData
[Index
].ColorDepth
) {
276 if (RefreshRate
!= Private
->ModeData
[Index
].RefreshRate
) {
280 if (Private
->LineBuffer
) {
281 gBS
->FreePool (Private
->LineBuffer
);
284 Private
->LineBuffer
= NULL
;
285 Private
->LineBuffer
= AllocatePool (HorizontalResolution
);
286 if (Private
->LineBuffer
== NULL
) {
287 return EFI_OUT_OF_RESOURCES
;
290 InitializeGraphicsMode (Private
, &CirrusLogic5430VideoModes
[Index
]);
292 Private
->CurrentMode
= Index
;
294 Private
->HardwareNeedsStarting
= FALSE
;
299 return EFI_NOT_FOUND
;
304 CirrusLogic5430UgaDrawBlt (
305 IN EFI_UGA_DRAW_PROTOCOL
*This
,
306 IN EFI_UGA_PIXEL
*BltBuffer
, OPTIONAL
307 IN EFI_UGA_BLT_OPERATION BltOperation
,
310 IN UINTN DestinationX
,
311 IN UINTN DestinationY
,
320 TODO: Add function description
324 This - TODO: add argument description
325 BltBuffer - TODO: add argument description
326 BltOperation - TODO: add argument description
327 SourceX - TODO: add argument description
328 SourceY - TODO: add argument description
329 DestinationX - TODO: add argument description
330 DestinationY - TODO: add argument description
331 Width - TODO: add argument description
332 Height - TODO: add argument description
333 Delta - TODO: add argument description
337 EFI_INVALID_PARAMETER - TODO: Add description for return value
338 EFI_INVALID_PARAMETER - TODO: Add description for return value
339 EFI_INVALID_PARAMETER - TODO: Add description for return value
340 EFI_INVALID_PARAMETER - TODO: Add description for return value
341 EFI_INVALID_PARAMETER - TODO: Add description for return value
342 EFI_INVALID_PARAMETER - TODO: Add description for return value
343 EFI_SUCCESS - TODO: Add description for return value
347 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
;
359 Private
= CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This
);
361 if ((BltOperation
< 0) || (BltOperation
>= EfiUgaBltMax
)) {
362 return EFI_INVALID_PARAMETER
;
365 if (Width
== 0 || Height
== 0) {
366 return EFI_INVALID_PARAMETER
;
370 // If Delta is zero, then the entire BltBuffer is being used, so Delta
371 // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
372 // the number of bytes in each row can be computed.
375 Delta
= Width
* sizeof (EFI_UGA_PIXEL
);
379 // We need to fill the Virtual Screen buffer with the blt data.
380 // The virtual screen is upside down, as the first row is the bootom row of
385 // Make sure the SourceX, SourceY, DestinationX, DestinationY, Width, and Height parameters
386 // are valid for the operation and the current screen geometry.
388 if (BltOperation
== EfiUgaVideoToBltBuffer
) {
390 // Video to BltBuffer: Source is Video, destination is BltBuffer
392 if (SourceY
+ Height
> Private
->ModeData
[Private
->CurrentMode
].VerticalResolution
) {
393 return EFI_INVALID_PARAMETER
;
396 if (SourceX
+ Width
> Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
) {
397 return EFI_INVALID_PARAMETER
;
401 // BltBuffer to Video: Source is BltBuffer, destination is Video
403 if (DestinationY
+ Height
> Private
->ModeData
[Private
->CurrentMode
].VerticalResolution
) {
404 return EFI_INVALID_PARAMETER
;
407 if (DestinationX
+ Width
> Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
) {
408 return EFI_INVALID_PARAMETER
;
412 // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
413 // We would not want a timer based event (Cursor, ...) to come in while we are
414 // doing this operation.
416 OriginalTPL
= gBS
->RaiseTPL (EFI_TPL_NOTIFY
);
418 switch (BltOperation
) {
419 case EfiUgaVideoToBltBuffer
:
421 // Video to BltBuffer: Source is Video, destination is BltBuffer
423 for (SrcY
= SourceY
, DstY
= DestinationY
; DstY
< (Height
+ DestinationY
); SrcY
++, DstY
++) {
425 Offset
= (SrcY
* Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
) + SourceX
;
426 if (((Offset
& 0x03) == 0) && ((Width
& 0x03) == 0)) {
427 Private
->PciIo
->Mem
.Read (
436 Private
->PciIo
->Mem
.Read (
446 for (X
= 0; X
< Width
; X
++) {
447 Blt
= (EFI_UGA_PIXEL
*) ((UINT8
*) BltBuffer
+ (DstY
* Delta
) + (DestinationX
+ X
) * sizeof (EFI_UGA_PIXEL
));
449 Blt
->Red
= (UINT8
) (Private
->LineBuffer
[X
] & 0xe0);
450 Blt
->Green
= (UINT8
) ((Private
->LineBuffer
[X
] & 0x1c) << 3);
451 Blt
->Blue
= (UINT8
) ((Private
->LineBuffer
[X
] & 0x03) << 6);
456 case EfiUgaVideoToVideo
:
458 // Perform hardware acceleration for Video to Video operations
460 ScreenWidth
= Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
;
461 SourceOffset
= (SourceY
* Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
) + (SourceX
);
462 Offset
= (DestinationY
* Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
) + (DestinationX
);
464 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0000);
465 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0010);
466 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0012);
467 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0014);
469 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0001);
470 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0011);
471 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0013);
472 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0015);
474 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) (((Width
<< 8) & 0xff00) | 0x20));
475 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((Width
& 0xff00) | 0x21));
476 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) (((Height
<< 8) & 0xff00) | 0x22));
477 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((Height
& 0xff00) | 0x23));
478 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) (((ScreenWidth
<< 8) & 0xff00) | 0x24));
479 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((ScreenWidth
& 0xff00) | 0x25));
480 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) (((ScreenWidth
<< 8) & 0xff00) | 0x26));
481 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((ScreenWidth
& 0xff00) | 0x27));
482 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((((Offset
) << 8) & 0xff00) | 0x28));
483 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((((Offset
) >> 0) & 0xff00) | 0x29));
484 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((((Offset
) >> 8) & 0xff00) | 0x2a));
485 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((((SourceOffset
) << 8) & 0xff00) | 0x2c));
486 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((((SourceOffset
) >> 0) & 0xff00) | 0x2d));
487 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((((SourceOffset
) >> 8) & 0xff00) | 0x2e));
488 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x002f);
489 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0030);
490 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0d32);
491 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0033);
492 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0034);
493 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0035);
495 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0231);
497 outb (Private
, GRAPH_ADDRESS_REGISTER
, 0x31);
498 while ((inb (Private
, GRAPH_DATA_REGISTER
) & 0x01) == 0x01)
502 case EfiUgaVideoFill
:
504 Pixel
= (UINT8
) ((Blt
->Red
& 0xe0) | ((Blt
->Green
>> 3) & 0x1c) | ((Blt
->Blue
>> 6) & 0x03));
505 WidePixel
= (Pixel
<< 8) | Pixel
;
506 WidePixel
= (WidePixel
<< 16) | WidePixel
;
508 if (DestinationX
== 0 && Width
== Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
) {
509 Offset
= DestinationY
* Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
;
510 if (((Offset
& 0x03) == 0) && (((Width
* Height
) & 0x03) == 0)) {
511 Private
->PciIo
->Mem
.Write (
513 EfiPciIoWidthFillUint32
,
516 (Width
* Height
) >> 2,
520 Private
->PciIo
->Mem
.Write (
522 EfiPciIoWidthFillUint8
,
530 for (SrcY
= SourceY
, DstY
= DestinationY
; SrcY
< (Height
+ SourceY
); SrcY
++, DstY
++) {
531 Offset
= (DstY
* Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
) + DestinationX
;
532 if (((Offset
& 0x03) == 0) && ((Width
& 0x03) == 0)) {
533 Private
->PciIo
->Mem
.Write (
535 EfiPciIoWidthFillUint32
,
542 Private
->PciIo
->Mem
.Write (
544 EfiPciIoWidthFillUint8
,
555 case EfiUgaBltBufferToVideo
:
556 for (SrcY
= SourceY
, DstY
= DestinationY
; SrcY
< (Height
+ SourceY
); SrcY
++, DstY
++) {
558 for (X
= 0; X
< Width
; X
++) {
559 Blt
= (EFI_UGA_PIXEL
*) ((UINT8
*) BltBuffer
+ (SrcY
* Delta
) + (SourceX
+ X
) * sizeof (EFI_UGA_PIXEL
));
560 Private
->LineBuffer
[X
] = (UINT8
) ((Blt
->Red
& 0xe0) | ((Blt
->Green
>> 3) & 0x1c) | ((Blt
->Blue
>> 6) & 0x03));
563 Offset
= (DstY
* Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
) + DestinationX
;
565 if (((Offset
& 0x03) == 0) && ((Width
& 0x03) == 0)) {
566 Private
->PciIo
->Mem
.Write (
575 Private
->PciIo
->Mem
.Write (
591 gBS
->RestoreTPL (OriginalTPL
);
597 // Construction and Destruction functions
601 CirrusLogic5430UgaDrawConstructor (
602 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
615 // TODO: Private - add argument and description to function comment
616 // TODO: EFI_SUCCESS - add return value to function comment
618 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
622 // Fill in Private->UgaDraw protocol
624 UgaDraw
= &Private
->UgaDraw
;
626 UgaDraw
->GetMode
= CirrusLogic5430UgaDrawGetMode
;
627 UgaDraw
->SetMode
= CirrusLogic5430UgaDrawSetMode
;
628 UgaDraw
->Blt
= CirrusLogic5430UgaDrawBlt
;
631 // Initialize the private data
633 Private
->MaxMode
= CIRRUS_LOGIC_5430_UGA_DRAW_MODE_COUNT
;
634 Private
->CurrentMode
= 0;
635 for (Index
= 0; Index
< Private
->MaxMode
; Index
++) {
636 Private
->ModeData
[Index
].HorizontalResolution
= CirrusLogic5430VideoModes
[Index
].Width
;
637 Private
->ModeData
[Index
].VerticalResolution
= CirrusLogic5430VideoModes
[Index
].Height
;
638 Private
->ModeData
[Index
].ColorDepth
= 32;
639 Private
->ModeData
[Index
].RefreshRate
= CirrusLogic5430VideoModes
[Index
].RefreshRate
;
642 Private
->HardwareNeedsStarting
= TRUE
;
643 Private
->LineBuffer
= NULL
;
646 // Initialize the hardware
650 Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
,
651 Private
->ModeData
[Private
->CurrentMode
].VerticalResolution
,
652 Private
->ModeData
[Private
->CurrentMode
].ColorDepth
,
653 Private
->ModeData
[Private
->CurrentMode
].RefreshRate
661 CirrusLogic5430UgaDrawDestructor (
662 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
675 // TODO: Private - add argument and description to function comment
676 // TODO: EFI_SUCCESS - add return value to function comment
683 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
691 TODO: Add function description
695 Private - TODO: add argument description
696 Address - TODO: add argument description
697 Data - TODO: add argument description
701 TODO: add return values
705 Private
->PciIo
->Io
.Write (
708 EFI_PCI_IO_PASS_THROUGH_BAR
,
717 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
725 TODO: Add function description
729 Private - TODO: add argument description
730 Address - TODO: add argument description
731 Data - TODO: add argument description
735 TODO: add return values
739 Private
->PciIo
->Io
.Write (
742 EFI_PCI_IO_PASS_THROUGH_BAR
,
751 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
758 TODO: Add function description
762 Private - TODO: add argument description
763 Address - TODO: add argument description
767 TODO: add return values
773 Private
->PciIo
->Io
.Read (
776 EFI_PCI_IO_PASS_THROUGH_BAR
,
786 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
793 TODO: Add function description
797 Private - TODO: add argument description
798 Address - TODO: add argument description
802 TODO: add return values
808 Private
->PciIo
->Io
.Read (
811 EFI_PCI_IO_PASS_THROUGH_BAR
,
821 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
831 TODO: Add function description
835 Private - TODO: add argument description
836 Index - TODO: add argument description
837 Red - TODO: add argument description
838 Green - TODO: add argument description
839 Blue - TODO: add argument description
843 TODO: add return values
847 outb (Private
, PALETTE_INDEX_REGISTER
, (UINT8
) Index
);
848 outb (Private
, PALETTE_DATA_REGISTER
, (UINT8
) (Red
>> 2));
849 outb (Private
, PALETTE_DATA_REGISTER
, (UINT8
) (Green
>> 2));
850 outb (Private
, PALETTE_DATA_REGISTER
, (UINT8
) (Blue
>> 2));
855 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
861 TODO: Add function description
865 Private - TODO: add argument description
869 TODO: add return values
879 for (RedIndex
= 0; RedIndex
< 8; RedIndex
++) {
880 for (GreenIndex
= 0; GreenIndex
< 8; GreenIndex
++) {
881 for (BlueIndex
= 0; BlueIndex
< 4; BlueIndex
++) {
882 SetPaletteColor (Private
, Index
, (UINT8
) (RedIndex
<< 5), (UINT8
) (GreenIndex
<< 5), (UINT8
) (BlueIndex
<< 6));
892 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
898 TODO: Add function description
902 Private - TODO: add argument description
906 TODO: add return values
913 Private
->PciIo
->Mem
.Write (
915 EfiPciIoWidthFillUint32
,
925 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
931 TODO: Add function description
935 Private - TODO: add argument description
939 TODO: add return values
950 ScreenWidth
= Private
->ModeData
[Private
->CurrentMode
].HorizontalResolution
;
951 ScreenHeight
= Private
->ModeData
[Private
->CurrentMode
].VerticalResolution
;
954 for (Y
= 0; Y
< ScreenHeight
; Y
++) {
955 for (X
= 0; X
< ScreenWidth
; X
++) {
956 Color
= (UINT8
) (256 * (X
+ Y
) / (ScreenWidth
+ ScreenHeight
));
957 Private
->LineBuffer
[X
] = Color
;
960 Private
->PciIo
->Mem
.Write (
964 Offset
+ (Y
* ScreenWidth
),
972 InitializeGraphicsMode (
973 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
,
974 CIRRUS_LOGIC_5430_VIDEO_MODES
*ModeData
980 TODO: Add function description
984 Private - TODO: add argument description
985 ModeData - TODO: add argument description
989 TODO: add return values
996 outw (Private
, SEQ_ADDRESS_REGISTER
, 0x1206);
997 outw (Private
, SEQ_ADDRESS_REGISTER
, 0x0012);
999 for (Index
= 0; Index
< 15; Index
++) {
1000 outw (Private
, SEQ_ADDRESS_REGISTER
, ModeData
->SeqSettings
[Index
]);
1003 outb (Private
, SEQ_ADDRESS_REGISTER
, 0x0f);
1004 Byte
= (UINT8
) ((inb (Private
, SEQ_DATA_REGISTER
) & 0xc7) ^ 0x30);
1005 outb (Private
, SEQ_DATA_REGISTER
, Byte
);
1007 outb (Private
, MISC_OUTPUT_REGISTER
, ModeData
->MiscSetting
);
1008 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0506);
1009 outw (Private
, SEQ_ADDRESS_REGISTER
, 0x0300);
1010 outw (Private
, CRTC_ADDRESS_REGISTER
, 0x2011);
1012 for (Index
= 0; Index
< 28; Index
++) {
1013 outw (Private
, CRTC_ADDRESS_REGISTER
, (UINT16
) ((ModeData
->CrtcSettings
[Index
] << 8) | Index
));
1016 for (Index
= 0; Index
< 9; Index
++) {
1017 outw (Private
, GRAPH_ADDRESS_REGISTER
, (UINT16
) ((GraphicsController
[Index
] << 8) | Index
));
1020 inb (Private
, INPUT_STATUS_1_REGISTER
);
1022 for (Index
= 0; Index
< 21; Index
++) {
1023 outb (Private
, ATT_ADDRESS_REGISTER
, (UINT8
) Index
);
1024 outb (Private
, ATT_ADDRESS_REGISTER
, AttributeController
[Index
]);
1027 outb (Private
, ATT_ADDRESS_REGISTER
, 0x20);
1029 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x0009);
1030 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x000a);
1031 outw (Private
, GRAPH_ADDRESS_REGISTER
, 0x000b);
1032 outb (Private
, DAC_PIXEL_MASK_REGISTER
, 0xff);
1034 SetDefaultPalette (Private
);
1035 ClearScreen (Private
);