]> git.proxmox.com Git - mirror_edk2.git/blame - OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430GraphicsOutput.c
Add dual FSP binaries support.
[mirror_edk2.git] / OptionRomPkg / CirrusLogic5430Dxe / CirrusLogic5430GraphicsOutput.c
CommitLineData
4e768df6 1/** @file\r
3d78c020 2Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
ac1ca104 3This program and the accompanying materials\r
31f9e631 4are licensed and made available under the terms and conditions of the BSD License\r
5which accompanies this distribution. The full text of the license may be found at\r
6http://opensource.org/licenses/bsd-license.php\r
7\r
8THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
9WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
87f8ccbe 10\r
11Module Name:\r
12\r
13 UefiCirrusLogic5430GraphicsOutput.c\r
14\r
15Abstract:\r
16\r
31f9e631 17 This file produces the graphics abstration of Graphics Output Protocol. It is called by\r
18 CirrusLogic5430.c file which deals with the EFI 1.1 driver model.\r
87f8ccbe 19 This file just does graphics.\r
20\r
4e768df6 21**/\r
87f8ccbe 22#include "CirrusLogic5430.h"\r
110d3a9a 23#include <IndustryStandard/Acpi.h>\r
24\r
25\r
26STATIC\r
27VOID\r
28CirrusLogic5430CompleteModeInfo (\r
29 OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info\r
30 )\r
31{\r
32 Info->Version = 0;\r
33 Info->PixelFormat = PixelBitMask;\r
34 Info->PixelInformation.RedMask = PIXEL_RED_MASK;\r
35 Info->PixelInformation.GreenMask = PIXEL_GREEN_MASK;\r
36 Info->PixelInformation.BlueMask = PIXEL_BLUE_MASK;\r
37 Info->PixelInformation.ReservedMask = 0;\r
38 Info->PixelsPerScanLine = Info->HorizontalResolution;\r
39}\r
40\r
41\r
42STATIC\r
43EFI_STATUS\r
44CirrusLogic5430CompleteModeData (\r
45 IN CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,\r
46 OUT EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode\r
47 )\r
48{\r
49 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
50 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *FrameBufDesc;\r
51\r
52 Info = Mode->Info;\r
53 CirrusLogic5430CompleteModeInfo (Info);\r
54\r
55 Private->PciIo->GetBarAttributes (\r
56 Private->PciIo,\r
57 0,\r
58 NULL,\r
59 (VOID**) &FrameBufDesc\r
60 );\r
61\r
62 Mode->FrameBufferBase = FrameBufDesc->AddrRangeMin;\r
63 Mode->FrameBufferSize = Info->HorizontalResolution * Info->VerticalResolution;\r
64\r
65 return EFI_SUCCESS;\r
66}\r
67\r
87f8ccbe 68\r
69//\r
70// Graphics Output Protocol Member Functions\r
71//\r
72EFI_STATUS\r
73EFIAPI\r
74CirrusLogic5430GraphicsOutputQueryMode (\r
75 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
76 IN UINT32 ModeNumber,\r
77 OUT UINTN *SizeOfInfo,\r
78 OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r
79 )\r
80/*++\r
81\r
82Routine Description:\r
83\r
84 Graphics Output protocol interface to query video mode\r
85\r
86 Arguments:\r
87 This - Protocol instance pointer.\r
88 ModeNumber - The mode number to return information on.\r
89 Info - Caller allocated buffer that returns information about ModeNumber.\r
90 SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.\r
91\r
92 Returns:\r
93 EFI_SUCCESS - Mode information returned.\r
94 EFI_BUFFER_TOO_SMALL - The Info buffer was too small.\r
95 EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.\r
96 EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r
97 EFI_INVALID_PARAMETER - One of the input args was NULL.\r
98\r
99--*/\r
100{\r
101 CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;\r
102\r
103 Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);\r
104\r
105 if (Private->HardwareNeedsStarting) {\r
106 return EFI_NOT_STARTED;\r
107 }\r
108\r
109 if (Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {\r
110 return EFI_INVALID_PARAMETER;\r
111 }\r
112\r
113 *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
114 if (*Info == NULL) {\r
115 return EFI_OUT_OF_RESOURCES;\r
116 }\r
117\r
118 *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
119\r
87f8ccbe 120 (*Info)->HorizontalResolution = Private->ModeData[ModeNumber].HorizontalResolution;\r
121 (*Info)->VerticalResolution = Private->ModeData[ModeNumber].VerticalResolution;\r
110d3a9a 122 CirrusLogic5430CompleteModeInfo (*Info);\r
87f8ccbe 123\r
124 return EFI_SUCCESS;\r
125}\r
126\r
127EFI_STATUS\r
128EFIAPI\r
129CirrusLogic5430GraphicsOutputSetMode (\r
130 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
131 IN UINT32 ModeNumber\r
132 )\r
133/*++\r
134\r
135Routine Description:\r
136\r
137 Graphics Output protocol interface to set video mode\r
138\r
139 Arguments:\r
140 This - Protocol instance pointer.\r
141 ModeNumber - The mode number to be set.\r
142\r
143 Returns:\r
144 EFI_SUCCESS - Graphics mode was changed.\r
145 EFI_DEVICE_ERROR - The device had an error and could not complete the request.\r
146 EFI_UNSUPPORTED - ModeNumber is not supported by this device.\r
147\r
148--*/\r
149{\r
110d3a9a 150 CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;\r
151 CIRRUS_LOGIC_5430_MODE_DATA *ModeData;\r
87f8ccbe 152\r
153 Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);\r
154\r
155 if (ModeNumber >= This->Mode->MaxMode) {\r
156 return EFI_UNSUPPORTED;\r
157 }\r
158\r
159 ModeData = &Private->ModeData[ModeNumber];\r
160\r
161 if (Private->LineBuffer) {\r
162 gBS->FreePool (Private->LineBuffer);\r
163 }\r
164\r
165 Private->LineBuffer = NULL;\r
166 Private->LineBuffer = AllocatePool (ModeData->HorizontalResolution);\r
167 if (Private->LineBuffer == NULL) {\r
168 return EFI_OUT_OF_RESOURCES;\r
169 }\r
170\r
31f9e631 171 InitializeGraphicsMode (Private, &CirrusLogic5430VideoModes[ModeData->ModeNumber]);\r
87f8ccbe 172\r
173 This->Mode->Mode = ModeNumber;\r
174 This->Mode->Info->HorizontalResolution = ModeData->HorizontalResolution;\r
175 This->Mode->Info->VerticalResolution = ModeData->VerticalResolution;\r
87f8ccbe 176 This->Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
177\r
110d3a9a 178 CirrusLogic5430CompleteModeData (Private, This->Mode);\r
87f8ccbe 179\r
180 Private->HardwareNeedsStarting = FALSE;\r
181\r
182 return EFI_SUCCESS;\r
183}\r
184\r
185EFI_STATUS\r
186EFIAPI\r
187CirrusLogic5430GraphicsOutputBlt (\r
188 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
189 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r
190 IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r
191 IN UINTN SourceX,\r
192 IN UINTN SourceY,\r
193 IN UINTN DestinationX,\r
194 IN UINTN DestinationY,\r
195 IN UINTN Width,\r
196 IN UINTN Height,\r
197 IN UINTN Delta\r
198 )\r
199/*++\r
200\r
201Routine Description:\r
202\r
203 Graphics Output protocol instance to block transfer for CirrusLogic device\r
204\r
205Arguments:\r
206\r
207 This - Pointer to Graphics Output protocol instance\r
208 BltBuffer - The data to transfer to screen\r
209 BltOperation - The operation to perform\r
210 SourceX - The X coordinate of the source for BltOperation\r
211 SourceY - The Y coordinate of the source for BltOperation\r
212 DestinationX - The X coordinate of the destination for BltOperation\r
213 DestinationY - The Y coordinate of the destination for BltOperation\r
214 Width - The width of a rectangle in the blt rectangle in pixels\r
215 Height - The height of a rectangle in the blt rectangle in pixels\r
216 Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
217 If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
218 If a subrectangle of the BltBuffer is used, then Delta represents\r
219 the number of bytes in a row of the BltBuffer.\r
220\r
221Returns:\r
222\r
223 EFI_INVALID_PARAMETER - Invalid parameter passed in\r
224 EFI_SUCCESS - Blt operation success\r
225\r
226--*/\r
227{\r
228 CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;\r
229 EFI_TPL OriginalTPL;\r
230 UINTN DstY;\r
231 UINTN SrcY;\r
232 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;\r
233 UINTN X;\r
234 UINT8 Pixel;\r
235 UINT32 WidePixel;\r
236 UINTN ScreenWidth;\r
237 UINTN Offset;\r
238 UINTN SourceOffset;\r
239 UINT32 CurrentMode;\r
240\r
241 Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);\r
242\r
3d78c020 243 if ((UINT32)BltOperation >= EfiGraphicsOutputBltOperationMax) {\r
87f8ccbe 244 return EFI_INVALID_PARAMETER;\r
245 }\r
246\r
247 if (Width == 0 || Height == 0) {\r
248 return EFI_INVALID_PARAMETER;\r
249 }\r
250\r
251 //\r
252 // If Delta is zero, then the entire BltBuffer is being used, so Delta\r
253 // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,\r
254 // the number of bytes in each row can be computed.\r
255 //\r
256 if (Delta == 0) {\r
257 Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);\r
258 }\r
259\r
260 //\r
261 // We need to fill the Virtual Screen buffer with the blt data.\r
262 // The virtual screen is upside down, as the first row is the bootom row of\r
263 // the image.\r
264 //\r
265\r
266 CurrentMode = This->Mode->Mode;\r
267 //\r
268 // Make sure the SourceX, SourceY, DestinationX, DestinationY, Width, and Height parameters\r
269 // are valid for the operation and the current screen geometry.\r
270 //\r
271 if (BltOperation == EfiBltVideoToBltBuffer) {\r
272 //\r
273 // Video to BltBuffer: Source is Video, destination is BltBuffer\r
274 //\r
275 if (SourceY + Height > Private->ModeData[CurrentMode].VerticalResolution) {\r
276 return EFI_INVALID_PARAMETER;\r
277 }\r
278\r
279 if (SourceX + Width > Private->ModeData[CurrentMode].HorizontalResolution) {\r
280 return EFI_INVALID_PARAMETER;\r
281 }\r
282 } else {\r
283 //\r
284 // BltBuffer to Video: Source is BltBuffer, destination is Video\r
285 //\r
286 if (DestinationY + Height > Private->ModeData[CurrentMode].VerticalResolution) {\r
287 return EFI_INVALID_PARAMETER;\r
288 }\r
289\r
290 if (DestinationX + Width > Private->ModeData[CurrentMode].HorizontalResolution) {\r
291 return EFI_INVALID_PARAMETER;\r
292 }\r
293 }\r
294 //\r
295 // We have to raise to TPL Notify, so we make an atomic write the frame buffer.\r
296 // We would not want a timer based event (Cursor, ...) to come in while we are\r
297 // doing this operation.\r
298 //\r
299 OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);\r
300\r
301 switch (BltOperation) {\r
302 case EfiBltVideoToBltBuffer:\r
303 //\r
304 // Video to BltBuffer: Source is Video, destination is BltBuffer\r
305 //\r
306 for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {\r
307\r
308 Offset = (SrcY * Private->ModeData[CurrentMode].HorizontalResolution) + SourceX;\r
309 if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {\r
310 Private->PciIo->Mem.Read (\r
311 Private->PciIo,\r
312 EfiPciIoWidthUint32,\r
313 0,\r
314 Offset,\r
315 Width >> 2,\r
316 Private->LineBuffer\r
317 );\r
318 } else {\r
319 Private->PciIo->Mem.Read (\r
320 Private->PciIo,\r
321 EfiPciIoWidthUint8,\r
322 0,\r
323 Offset,\r
324 Width,\r
325 Private->LineBuffer\r
326 );\r
327 }\r
328\r
329 for (X = 0; X < Width; X++) {\r
330 Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + (DestinationX + X) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
331\r
110d3a9a 332 Blt->Red = PIXEL_TO_RED_BYTE (Private->LineBuffer[X]);\r
333 Blt->Green = PIXEL_TO_GREEN_BYTE (Private->LineBuffer[X]);\r
334 Blt->Blue = PIXEL_TO_BLUE_BYTE (Private->LineBuffer[X]);\r
87f8ccbe 335 }\r
336 }\r
337 break;\r
338\r
339 case EfiBltVideoToVideo:\r
340 //\r
341 // Perform hardware acceleration for Video to Video operations\r
342 //\r
343 ScreenWidth = Private->ModeData[CurrentMode].HorizontalResolution;\r
344 SourceOffset = (SourceY * Private->ModeData[CurrentMode].HorizontalResolution) + (SourceX);\r
345 Offset = (DestinationY * Private->ModeData[CurrentMode].HorizontalResolution) + (DestinationX);\r
346\r
347 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0000);\r
348 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0010);\r
349 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0012);\r
350 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0014);\r
351\r
352 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0001);\r
353 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0011);\r
354 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0013);\r
355 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0015);\r
356\r
357 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Width << 8) & 0xff00) | 0x20));\r
358 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Width & 0xff00) | 0x21));\r
359 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Height << 8) & 0xff00) | 0x22));\r
360 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Height & 0xff00) | 0x23));\r
361 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x24));\r
362 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x25));\r
363 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x26));\r
364 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x27));\r
365 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) << 8) & 0xff00) | 0x28));\r
366 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 0) & 0xff00) | 0x29));\r
367 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 8) & 0xff00) | 0x2a));\r
368 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) << 8) & 0xff00) | 0x2c));\r
369 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 0) & 0xff00) | 0x2d));\r
370 outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 8) & 0xff00) | 0x2e));\r
371 outw (Private, GRAPH_ADDRESS_REGISTER, 0x002f);\r
372 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0030);\r
373 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0d32);\r
374 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0033);\r
375 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0034);\r
376 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0035);\r
377\r
378 outw (Private, GRAPH_ADDRESS_REGISTER, 0x0231);\r
379\r
380 outb (Private, GRAPH_ADDRESS_REGISTER, 0x31);\r
381 while ((inb (Private, GRAPH_DATA_REGISTER) & 0x01) == 0x01)\r
382 ;\r
383 break;\r
384\r
385 case EfiBltVideoFill:\r
386 Blt = BltBuffer;\r
110d3a9a 387 Pixel = RGB_BYTES_TO_PIXEL (Blt->Red, Blt->Green, Blt->Blue);\r
87f8ccbe 388 WidePixel = (Pixel << 8) | Pixel;\r
389 WidePixel = (WidePixel << 16) | WidePixel;\r
390\r
391 if (DestinationX == 0 && Width == Private->ModeData[CurrentMode].HorizontalResolution) {\r
392 Offset = DestinationY * Private->ModeData[CurrentMode].HorizontalResolution;\r
393 if (((Offset & 0x03) == 0) && (((Width * Height) & 0x03) == 0)) {\r
394 Private->PciIo->Mem.Write (\r
395 Private->PciIo,\r
396 EfiPciIoWidthFillUint32,\r
397 0,\r
398 Offset,\r
399 (Width * Height) >> 2,\r
400 &WidePixel\r
401 );\r
402 } else {\r
403 Private->PciIo->Mem.Write (\r
404 Private->PciIo,\r
405 EfiPciIoWidthFillUint8,\r
406 0,\r
407 Offset,\r
408 Width * Height,\r
409 &Pixel\r
410 );\r
411 }\r
412 } else {\r
413 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {\r
414 Offset = (DstY * Private->ModeData[CurrentMode].HorizontalResolution) + DestinationX;\r
415 if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {\r
416 Private->PciIo->Mem.Write (\r
417 Private->PciIo,\r
418 EfiPciIoWidthFillUint32,\r
419 0,\r
420 Offset,\r
421 Width >> 2,\r
422 &WidePixel\r
423 );\r
424 } else {\r
425 Private->PciIo->Mem.Write (\r
426 Private->PciIo,\r
427 EfiPciIoWidthFillUint8,\r
428 0,\r
429 Offset,\r
430 Width,\r
431 &Pixel\r
432 );\r
433 }\r
434 }\r
435 }\r
436 break;\r
437\r
438 case EfiBltBufferToVideo:\r
439 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {\r
440\r
441 for (X = 0; X < Width; X++) {\r
110d3a9a 442 Blt =\r
443 (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) (\r
444 (UINT8 *) BltBuffer +\r
445 (SrcY * Delta) +\r
446 ((SourceX + X) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))\r
447 );\r
448 Private->LineBuffer[X] =\r
449 RGB_BYTES_TO_PIXEL (Blt->Red, Blt->Green, Blt->Blue);\r
87f8ccbe 450 }\r
451\r
452 Offset = (DstY * Private->ModeData[CurrentMode].HorizontalResolution) + DestinationX;\r
453\r
454 if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {\r
455 Private->PciIo->Mem.Write (\r
456 Private->PciIo,\r
457 EfiPciIoWidthUint32,\r
458 0,\r
459 Offset,\r
460 Width >> 2,\r
461 Private->LineBuffer\r
462 );\r
463 } else {\r
464 Private->PciIo->Mem.Write (\r
465 Private->PciIo,\r
466 EfiPciIoWidthUint8,\r
467 0,\r
468 Offset,\r
469 Width,\r
470 Private->LineBuffer\r
471 );\r
472 }\r
473 }\r
474 break;\r
475 default:\r
476 ASSERT (FALSE);\r
477 }\r
478\r
479 gBS->RestoreTPL (OriginalTPL);\r
480\r
481 return EFI_SUCCESS;\r
482}\r
483\r
484EFI_STATUS\r
485CirrusLogic5430GraphicsOutputConstructor (\r
486 CIRRUS_LOGIC_5430_PRIVATE_DATA *Private\r
487 )\r
488{\r
489 EFI_STATUS Status;\r
490 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
87f8ccbe 491\r
492\r
493 GraphicsOutput = &Private->GraphicsOutput;\r
494 GraphicsOutput->QueryMode = CirrusLogic5430GraphicsOutputQueryMode;\r
495 GraphicsOutput->SetMode = CirrusLogic5430GraphicsOutputSetMode;\r
496 GraphicsOutput->Blt = CirrusLogic5430GraphicsOutputBlt;\r
497\r
498 //\r
499 // Initialize the private data\r
500 //\r
501 Status = gBS->AllocatePool (\r
502 EfiBootServicesData,\r
503 sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE),\r
504 (VOID **) &Private->GraphicsOutput.Mode\r
505 );\r
506 if (EFI_ERROR (Status)) {\r
507 return Status;\r
508 }\r
509 Status = gBS->AllocatePool (\r
510 EfiBootServicesData,\r
511 sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),\r
512 (VOID **) &Private->GraphicsOutput.Mode->Info\r
513 );\r
514 if (EFI_ERROR (Status)) {\r
515 return Status;\r
516 }\r
31f9e631 517 Private->GraphicsOutput.Mode->MaxMode = (UINT32) Private->MaxMode;\r
518 Private->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;\r
519 Private->HardwareNeedsStarting = TRUE;\r
520 Private->LineBuffer = NULL;\r
87f8ccbe 521\r
522 //\r
523 // Initialize the hardware\r
524 //\r
525 GraphicsOutput->SetMode (GraphicsOutput, 0);\r
80448f6c 526 ASSERT (Private->GraphicsOutput.Mode->Mode < CIRRUS_LOGIC_5430_MODE_COUNT);\r
87f8ccbe 527 DrawLogo (\r
528 Private,\r
529 Private->ModeData[Private->GraphicsOutput.Mode->Mode].HorizontalResolution,\r
530 Private->ModeData[Private->GraphicsOutput.Mode->Mode].VerticalResolution\r
531 );\r
532\r
533 return EFI_SUCCESS;\r
534}\r
535\r
536EFI_STATUS\r
537CirrusLogic5430GraphicsOutputDestructor (\r
538 CIRRUS_LOGIC_5430_PRIVATE_DATA *Private\r
539 )\r
540/*++\r
541\r
542Routine Description:\r
543\r
544Arguments:\r
545\r
546Returns:\r
547\r
548 None\r
549\r
550--*/\r
551{\r
552 if (Private->GraphicsOutput.Mode != NULL) {\r
553 if (Private->GraphicsOutput.Mode->Info != NULL) {\r
554 gBS->FreePool (Private->GraphicsOutput.Mode->Info);\r
555 }\r
556 gBS->FreePool (Private->GraphicsOutput.Mode);\r
557 }\r
558\r
559 return EFI_SUCCESS;\r
560}\r
561\r
562\r