]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
Add some definitions for efi event in Uefi/UefiSpec.h to follow spec.
[mirror_edk2.git] / EdkModulePkg / Universal / Console / GraphicsConsole / Dxe / GraphicsConsole.c
CommitLineData
7a2729d4 1/**@file\r
2 This is the main routine for initializing the Graphics Console support routines.\r
3Remaining Tasks\r
4 Add all standard Glyphs from EFI 1.02 Specification\r
5 Implement optimal automatic Mode creation algorithm\r
6 Solve palette issues for mixed graphics and text\r
7 When does this protocol reset the palette?\r
8 \r
0fe0b10e 9Copyright (c) 2006 - 2007 Intel Corporation. <BR>\r
878ddf1f 10All rights reserved. This program and the accompanying materials \r
11are licensed and made available under the terms and conditions of the BSD License \r
12which accompanies this distribution. The full text of the license may be found at \r
13http://opensource.org/licenses/bsd-license.php \r
14 \r
15THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
16WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
17\r
7a2729d4 18**/\r
878ddf1f 19\r
20#include "GraphicsConsole.h"\r
21\r
92dda53e 22STATIC\r
878ddf1f 23EFI_STATUS\r
24GetTextColors (\r
25 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
406adcd1 26 OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,\r
27 OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background\r
878ddf1f 28 );\r
29\r
92dda53e 30STATIC\r
878ddf1f 31EFI_STATUS\r
32DrawUnicodeWeightAtCursorN (\r
33 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
34 IN CHAR16 *UnicodeWeight,\r
35 IN UINTN Count\r
36 );\r
37\r
92dda53e 38STATIC\r
878ddf1f 39EFI_STATUS\r
40EraseCursor (\r
41 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This\r
42 );\r
43\r
44//\r
45// Globals\r
46//\r
47GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {\r
48 GRAPHICS_CONSOLE_DEV_SIGNATURE,\r
406adcd1 49 (EFI_GRAPHICS_OUTPUT_PROTOCOL *) NULL,\r
878ddf1f 50 (EFI_UGA_DRAW_PROTOCOL *) NULL,\r
51 {\r
52 GraphicsConsoleConOutReset,\r
53 GraphicsConsoleConOutOutputString,\r
54 GraphicsConsoleConOutTestString,\r
55 GraphicsConsoleConOutQueryMode,\r
56 GraphicsConsoleConOutSetMode,\r
57 GraphicsConsoleConOutSetAttribute,\r
58 GraphicsConsoleConOutClearScreen,\r
59 GraphicsConsoleConOutSetCursorPosition,\r
60 GraphicsConsoleConOutEnableCursor,\r
61 (EFI_SIMPLE_TEXT_OUTPUT_MODE *) NULL\r
62 },\r
63 {\r
64 0,\r
65 0,\r
66 EFI_TEXT_ATTR(EFI_LIGHTGRAY, EFI_BLACK),\r
67 0,\r
68 0,\r
69 TRUE\r
70 },\r
71 {\r
72 { 80, 25, 0, 0, 0, 0 }, // Mode 0\r
3bc85e36 73 { 80, 50, 0, 0, 0, 0 }, // Mode 1 \r
878ddf1f 74 { 0, 0, 0, 0, 0, 0 } // Mode 2\r
75 },\r
406adcd1 76 (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,\r
878ddf1f 77 (EFI_HII_HANDLE) 0\r
78};\r
79\r
80EFI_HII_PROTOCOL *mHii;\r
81\r
82static CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };\r
83\r
406adcd1 84static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {\r
878ddf1f 85 //\r
86 // B G R\r
87 //\r
7a2729d4 88 {0x00, 0x00, 0x00, 0x00}, // BLACK\r
89 {0x98, 0x00, 0x00, 0x00}, // BLUE\r
90 {0x00, 0x98, 0x00, 0x00}, // GREEN\r
91 {0x98, 0x98, 0x00, 0x00}, // CYAN\r
92 {0x00, 0x00, 0x98, 0x00}, // RED\r
93 {0x98, 0x00, 0x98, 0x00}, // MAGENTA\r
94 {0x00, 0x98, 0x98, 0x00}, // BROWN\r
95 {0x98, 0x98, 0x98, 0x00}, // LIGHTGRAY\r
96 {0x30, 0x30, 0x30, 0x00}, // DARKGRAY - BRIGHT BLACK\r
97 {0xff, 0x00, 0x00, 0x00}, // LIGHTBLUE - ?\r
98 {0x00, 0xff, 0x00, 0x00}, // LIGHTGREEN - ?\r
99 {0xff, 0xff, 0x00, 0x00}, // LIGHTCYAN\r
100 {0x00, 0x00, 0xff, 0x00}, // LIGHTRED\r
101 {0xff, 0x00, 0xff, 0x00}, // LIGHTMAGENTA\r
102 {0x00, 0xff, 0xff, 0x00}, // LIGHTBROWN\r
103 {0xff, 0xff, 0xff, 0x00} // WHITE\r
878ddf1f 104};\r
105\r
106static EFI_NARROW_GLYPH mCursorGlyph = {\r
107 0x0000,\r
108 0x00,\r
109 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF }\r
110};\r
111\r
878ddf1f 112EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {\r
113 GraphicsConsoleControllerDriverSupported,\r
114 GraphicsConsoleControllerDriverStart,\r
115 GraphicsConsoleControllerDriverStop,\r
61fb1657 116 0xa,\r
878ddf1f 117 NULL,\r
118 NULL\r
119};\r
120\r
121EFI_STATUS\r
122EFIAPI\r
123GraphicsConsoleControllerDriverSupported (\r
124 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
125 IN EFI_HANDLE Controller,\r
126 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
127 )\r
128{\r
129 EFI_STATUS Status;\r
406adcd1 130 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
878ddf1f 131 EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
132 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
133\r
406adcd1 134 UgaDraw = NULL;\r
878ddf1f 135 //\r
136 // Open the IO Abstraction(s) needed to perform the supported test\r
137 //\r
138 Status = gBS->OpenProtocol (\r
139 Controller,\r
406adcd1 140 &gEfiGraphicsOutputProtocolGuid,\r
141 (VOID **) &GraphicsOutput,\r
878ddf1f 142 This->DriverBindingHandle,\r
143 Controller,\r
144 EFI_OPEN_PROTOCOL_BY_DRIVER\r
145 );\r
406adcd1 146 \r
878ddf1f 147 if (EFI_ERROR (Status)) {\r
406adcd1 148 GraphicsOutput = NULL;\r
149 //\r
150 // Open Graphics Output Protocol failed, try to open UGA Draw Protocol\r
151 //\r
152 Status = gBS->OpenProtocol (\r
153 Controller,\r
154 &gEfiUgaDrawProtocolGuid,\r
155 (VOID **) &UgaDraw,\r
156 This->DriverBindingHandle,\r
157 Controller,\r
158 EFI_OPEN_PROTOCOL_BY_DRIVER\r
159 );\r
160 if (EFI_ERROR (Status)) {\r
161 return Status;\r
162 }\r
878ddf1f 163 }\r
406adcd1 164\r
878ddf1f 165 //\r
166 // We need to ensure that we do not layer on top of a virtual handle.\r
167 // We need to ensure that the handles produced by the conspliter do not\r
168 // get used.\r
169 //\r
170 Status = gBS->OpenProtocol (\r
171 Controller,\r
172 &gEfiDevicePathProtocolGuid,\r
173 (VOID **) &DevicePath,\r
174 This->DriverBindingHandle,\r
175 Controller,\r
176 EFI_OPEN_PROTOCOL_BY_DRIVER\r
177 );\r
178 if (!EFI_ERROR (Status)) {\r
179 gBS->CloseProtocol (\r
180 Controller,\r
181 &gEfiDevicePathProtocolGuid,\r
182 This->DriverBindingHandle,\r
183 Controller\r
184 );\r
185 } else {\r
186 goto Error;\r
187 }\r
188 //\r
189 // Does Hii Exist? If not, we aren't ready to run\r
190 //\r
191 Status = EfiLocateHiiProtocol ();\r
192\r
193 //\r
194 // Close the I/O Abstraction(s) used to perform the supported test\r
195 //\r
196Error:\r
406adcd1 197 if (GraphicsOutput != NULL) {\r
198 gBS->CloseProtocol (\r
199 Controller,\r
200 &gEfiGraphicsOutputProtocolGuid,\r
201 This->DriverBindingHandle,\r
202 Controller\r
203 );\r
204 } else {\r
205 gBS->CloseProtocol (\r
206 Controller,\r
207 &gEfiUgaDrawProtocolGuid,\r
208 This->DriverBindingHandle,\r
209 Controller\r
210 );\r
211 }\r
878ddf1f 212 return Status;\r
213}\r
214\r
215EFI_STATUS\r
216EFIAPI\r
217GraphicsConsoleControllerDriverStart (\r
218 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
219 IN EFI_HANDLE Controller,\r
220 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
221 )\r
222/*++\r
223\r
224 Routine Description:\r
225\r
226 Start the controller.\r
227\r
228 Arguments:\r
229\r
230 This - A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
231 Controller - The handle of the controller to start.\r
232 RemainingDevicePath - A pointer to the remaining portion of a devcie path.\r
233\r
234 Returns:\r
235\r
236 EFI_SUCCESS - Return successfully.\r
237 EFI_OUT_OF_RESOURCES - Out of resources.\r
238\r
239--*/\r
240{\r
241 EFI_STATUS Status;\r
242 GRAPHICS_CONSOLE_DEV *Private;\r
243 EFI_HII_PACKAGES *Package;\r
244 EFI_HII_FONT_PACK *FontPack;\r
245 UINTN NarrowFontSize;\r
246 UINT32 HorizontalResolution;\r
247 UINT32 VerticalResolution;\r
248 UINT32 ColorDepth;\r
249 UINT32 RefreshRate;\r
250 UINTN MaxMode;\r
251 UINTN Columns;\r
252 UINTN Rows;\r
253 UINT8 *Location;\r
406adcd1 254 UINT32 ModeNumber;\r
255 UINTN SizeOfInfo;\r
256 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
257 \r
258 ModeNumber = 0;\r
259\r
878ddf1f 260 //\r
261 // Initialize the Graphics Console device instance\r
262 //\r
263 Private = AllocateCopyPool (\r
264 sizeof (GRAPHICS_CONSOLE_DEV),\r
265 &mGraphicsConsoleDevTemplate\r
266 );\r
267 if (Private == NULL) {\r
268 return EFI_OUT_OF_RESOURCES;\r
269 }\r
270\r
271 Private->SimpleTextOutput.Mode = &(Private->SimpleTextOutputMode);\r
272\r
273 Status = gBS->OpenProtocol (\r
274 Controller,\r
406adcd1 275 &gEfiGraphicsOutputProtocolGuid,\r
276 (VOID **) &Private->GraphicsOutput,\r
878ddf1f 277 This->DriverBindingHandle,\r
278 Controller,\r
279 EFI_OPEN_PROTOCOL_BY_DRIVER\r
280 );\r
406adcd1 281 if (EFI_ERROR(Status)) {\r
282 Private->GraphicsOutput = NULL;\r
283\r
284 Status = gBS->OpenProtocol (\r
285 Controller,\r
286 &gEfiUgaDrawProtocolGuid,\r
287 (VOID **) &Private->UgaDraw,\r
288 This->DriverBindingHandle,\r
289 Controller,\r
290 EFI_OPEN_PROTOCOL_BY_DRIVER\r
291 );\r
292 if (EFI_ERROR (Status)) {\r
293 goto Error;\r
294 }\r
878ddf1f 295 }\r
406adcd1 296\r
878ddf1f 297 //\r
298 // Get the HII protocol. If Supported() succeeds, do we really\r
299 // need to get HII protocol again?\r
300 //\r
301 Status = EfiLocateHiiProtocol ();\r
302 if (EFI_ERROR (Status)) {\r
303 goto Error;\r
304 }\r
305\r
306 NarrowFontSize = ReturnNarrowFontSize ();\r
307\r
308 FontPack = AllocateZeroPool (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);\r
309 ASSERT (FontPack);\r
310\r
311 FontPack->Header.Length = (UINT32) (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);\r
312 FontPack->Header.Type = EFI_HII_FONT;\r
313 FontPack->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));\r
314\r
315 Location = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8));\r
316 CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);\r
317\r
318 //\r
319 // Register our Fonts into the global database\r
320 //\r
321 Package = PreparePackages (1, NULL, FontPack);\r
322 mHii->NewPack (mHii, Package, &(Private->HiiHandle));\r
2c3b5ec5 323 FreePool (Package);\r
878ddf1f 324\r
325 //\r
326 // Free the font database\r
327 //\r
2c3b5ec5 328 FreePool (FontPack);\r
878ddf1f 329\r
330 //\r
331 // If the current mode information can not be retrieved, then attemp to set the default mode\r
332 // of 800x600, 32 bit colot, 60 Hz refresh.\r
333 //\r
334 HorizontalResolution = 800;\r
335 VerticalResolution = 600;\r
406adcd1 336\r
337 if (Private->GraphicsOutput != NULL) {\r
878ddf1f 338 //\r
406adcd1 339 // The console is build on top of Graphics Output Protocol, find the mode number for 800x600\r
878ddf1f 340 //\r
406adcd1 341 for (ModeNumber = 0; ModeNumber < Private->GraphicsOutput->Mode->MaxMode; ModeNumber++) {\r
342 Status = Private->GraphicsOutput->QueryMode (\r
343 Private->GraphicsOutput,\r
344 ModeNumber,\r
345 &SizeOfInfo,\r
346 &Info\r
347 );\r
348 if (!EFI_ERROR (Status)) {\r
349 if ((Info->HorizontalResolution == 800) &&\r
e313deb9 350 (Info->VerticalResolution == 600)) {\r
406adcd1 351 Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);\r
352 if (!EFI_ERROR (Status)) {\r
2c3b5ec5 353 FreePool (Info);\r
406adcd1 354 break;\r
355 }\r
356 }\r
2c3b5ec5 357 FreePool (Info);\r
406adcd1 358 }\r
359 }\r
360\r
361 if (EFI_ERROR (Status) || (ModeNumber == Private->GraphicsOutput->Mode->MaxMode)) {\r
362 //\r
363 // Set default mode failed or device don't support default mode, then get the current mode information\r
364 //\r
365 HorizontalResolution = Private->GraphicsOutput->Mode->Info->HorizontalResolution;\r
366 VerticalResolution = Private->GraphicsOutput->Mode->Info->VerticalResolution;\r
367 ModeNumber = Private->GraphicsOutput->Mode->Mode;\r
368 }\r
369 } else {\r
370 //\r
371 // The console is build on top of UGA Draw Protocol\r
372 //\r
373 ColorDepth = 32;\r
374 RefreshRate = 60;\r
375 Status = Private->UgaDraw->SetMode (\r
878ddf1f 376 Private->UgaDraw,\r
406adcd1 377 HorizontalResolution,\r
378 VerticalResolution,\r
379 ColorDepth,\r
380 RefreshRate\r
878ddf1f 381 );\r
382 if (EFI_ERROR (Status)) {\r
406adcd1 383 //\r
384 // Get the current mode information from the UGA Draw Protocol\r
385 //\r
386 Status = Private->UgaDraw->GetMode (\r
387 Private->UgaDraw,\r
388 &HorizontalResolution,\r
389 &VerticalResolution,\r
390 &ColorDepth,\r
391 &RefreshRate\r
392 );\r
393 if (EFI_ERROR (Status)) {\r
394 goto Error;\r
395 }\r
878ddf1f 396 }\r
397 }\r
406adcd1 398\r
878ddf1f 399 //\r
400 // Compute the maximum number of text Rows and Columns that this current graphics mode can support\r
401 //\r
402 Columns = HorizontalResolution / GLYPH_WIDTH;\r
403 Rows = VerticalResolution / GLYPH_HEIGHT;\r
404\r
405 //\r
406 // See if the mode is too small to support the required 80x25 text mode\r
407 //\r
408 if (Columns < 80 || Rows < 25) {\r
409 goto Error;\r
410 }\r
411 //\r
412 // Add Mode #0 that must be 80x25\r
413 //\r
414 MaxMode = 0;\r
406adcd1 415 Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
416 Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
417 Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
878ddf1f 418 Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * GLYPH_WIDTH)) >> 1;\r
419 Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (25 * GLYPH_HEIGHT)) >> 1;\r
420 MaxMode++;\r
421\r
422 //\r
423 // If it is possible to support Mode #1 - 80x50, than add it as an active mode\r
424 //\r
425 if (Rows >= 50) {\r
406adcd1 426 Private->ModeData[MaxMode].GopWidth = HorizontalResolution;\r
427 Private->ModeData[MaxMode].GopHeight = VerticalResolution;\r
428 Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
878ddf1f 429 Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * GLYPH_WIDTH)) >> 1;\r
430 Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * GLYPH_HEIGHT)) >> 1;\r
431 MaxMode++;\r
432 }\r
433 //\r
434 // If the graphics mode is 800x600, than add a text mode that uses the entire display\r
435 //\r
436 if (HorizontalResolution == 800 && VerticalResolution == 600) {\r
437\r
438 if (MaxMode < 2) {\r
439 Private->ModeData[MaxMode].Columns = 0;\r
440 Private->ModeData[MaxMode].Rows = 0;\r
406adcd1 441 Private->ModeData[MaxMode].GopWidth = 800;\r
442 Private->ModeData[MaxMode].GopHeight = 600;\r
443 Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
878ddf1f 444 Private->ModeData[MaxMode].DeltaX = 0;\r
445 Private->ModeData[MaxMode].DeltaY = 0;\r
446 MaxMode++;\r
447 }\r
448\r
449 Private->ModeData[MaxMode].Columns = 800 / GLYPH_WIDTH;\r
450 Private->ModeData[MaxMode].Rows = 600 / GLYPH_HEIGHT;\r
406adcd1 451 Private->ModeData[MaxMode].GopWidth = 800;\r
452 Private->ModeData[MaxMode].GopHeight = 600;\r
453 Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
878ddf1f 454 Private->ModeData[MaxMode].DeltaX = (800 % GLYPH_WIDTH) >> 1;\r
455 Private->ModeData[MaxMode].DeltaY = (600 % GLYPH_HEIGHT) >> 1;\r
456 MaxMode++;\r
457 }\r
458 //\r
459 // Update the maximum number of modes\r
460 //\r
461 Private->SimpleTextOutputMode.MaxMode = (INT32) MaxMode;\r
462\r
463 //\r
464 // Determine the number of text modes that this protocol can support\r
465 //\r
466 Status = GraphicsConsoleConOutSetMode (&Private->SimpleTextOutput, 0);\r
467 if (EFI_ERROR (Status)) {\r
468 goto Error;\r
469 }\r
470\r
2ce31132 471 DEBUG_CODE_BEGIN ();\r
878ddf1f 472 GraphicsConsoleConOutOutputString (&Private->SimpleTextOutput, (CHAR16 *)L"Graphics Console Started\n\r");\r
2ce31132 473 DEBUG_CODE_END ();\r
878ddf1f 474\r
475 //\r
476 // Install protocol interfaces for the Graphics Console device.\r
477 //\r
478 Status = gBS->InstallMultipleProtocolInterfaces (\r
479 &Controller,\r
480 &gEfiSimpleTextOutProtocolGuid,\r
481 &Private->SimpleTextOutput,\r
482 NULL\r
483 );\r
484\r
485Error:\r
486 if (EFI_ERROR (Status)) {\r
487 //\r
406adcd1 488 // Close the GOP or UGA IO Protocol\r
878ddf1f 489 //\r
406adcd1 490 if (Private->GraphicsOutput != NULL) {\r
491 gBS->CloseProtocol (\r
492 Controller,\r
493 &gEfiGraphicsOutputProtocolGuid,\r
494 This->DriverBindingHandle,\r
495 Controller\r
496 );\r
497 } else {\r
498 gBS->CloseProtocol (\r
499 Controller,\r
500 &gEfiUgaDrawProtocolGuid,\r
501 This->DriverBindingHandle,\r
502 Controller\r
503 );\r
504 }\r
878ddf1f 505\r
506 //\r
507 // Free private data\r
508 //\r
509 if (Private != NULL) {\r
fdbc81c8 510 if (Private->LineBuffer != NULL) {\r
511 FreePool (Private->LineBuffer);\r
512 }\r
2c3b5ec5 513 FreePool (Private);\r
878ddf1f 514 }\r
515 }\r
516\r
517 return Status;\r
518}\r
519\r
520EFI_STATUS\r
521EFIAPI\r
522GraphicsConsoleControllerDriverStop (\r
523 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
524 IN EFI_HANDLE Controller,\r
525 IN UINTN NumberOfChildren,\r
526 IN EFI_HANDLE *ChildHandleBuffer\r
527 )\r
528{\r
529 EFI_STATUS Status;\r
530 EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleTextOutput;\r
531 GRAPHICS_CONSOLE_DEV *Private;\r
532\r
533 Status = gBS->OpenProtocol (\r
534 Controller,\r
535 &gEfiSimpleTextOutProtocolGuid,\r
536 (VOID **) &SimpleTextOutput,\r
537 This->DriverBindingHandle,\r
538 Controller,\r
539 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
540 );\r
541 if (EFI_ERROR (Status)) {\r
542 return EFI_NOT_STARTED;\r
543 }\r
544\r
545 Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (SimpleTextOutput);\r
546\r
547 Status = gBS->UninstallProtocolInterface (\r
548 Controller,\r
549 &gEfiSimpleTextOutProtocolGuid,\r
550 &Private->SimpleTextOutput\r
551 );\r
552\r
553 if (!EFI_ERROR (Status)) {\r
554 //\r
406adcd1 555 // Close the GOP or UGA IO Protocol\r
878ddf1f 556 //\r
406adcd1 557 if (Private->GraphicsOutput != NULL) {\r
558 gBS->CloseProtocol (\r
559 Controller,\r
560 &gEfiGraphicsOutputProtocolGuid,\r
561 This->DriverBindingHandle,\r
562 Controller\r
563 );\r
564 } else {\r
565 gBS->CloseProtocol (\r
566 Controller,\r
567 &gEfiUgaDrawProtocolGuid,\r
568 This->DriverBindingHandle,\r
569 Controller\r
570 );\r
571 }\r
878ddf1f 572\r
573 //\r
574 // Remove the font pack\r
575 //\r
576 mHii->RemovePack (mHii, Private->HiiHandle);\r
577\r
578 //\r
579 // Free our instance data\r
580 //\r
581 if (Private != NULL) {\r
2c3b5ec5
LG
582 FreePool (Private->LineBuffer);\r
583 FreePool (Private);\r
878ddf1f 584 }\r
585 }\r
586\r
587 return Status;\r
588}\r
589\r
590EFI_STATUS\r
591EfiLocateHiiProtocol (\r
592 VOID\r
593 )\r
594/*++\r
595\r
596 Routine Description:\r
597 Find if the HII protocol is available. If yes, locate the HII protocol\r
598\r
599 Arguments:\r
600\r
601 Returns:\r
602\r
603--*/\r
604{\r
605 EFI_HANDLE Handle;\r
606 UINTN Size;\r
607 EFI_STATUS Status;\r
608\r
609 //\r
610 // There should only be one - so buffer size is this\r
611 //\r
612 Size = sizeof (EFI_HANDLE);\r
613\r
614 Status = gBS->LocateHandle (\r
615 ByProtocol,\r
616 &gEfiHiiProtocolGuid,\r
617 NULL,\r
618 &Size,\r
619 &Handle\r
620 );\r
621\r
622 if (EFI_ERROR (Status)) {\r
623 return Status;\r
624 }\r
625\r
626 Status = gBS->HandleProtocol (\r
627 Handle,\r
628 &gEfiHiiProtocolGuid,\r
629 (VOID **)&mHii\r
630 );\r
631\r
632 return Status;\r
633}\r
634//\r
635// Body of the STO functions\r
636//\r
637EFI_STATUS\r
638EFIAPI\r
639GraphicsConsoleConOutReset (\r
640 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
641 IN BOOLEAN ExtendedVerification\r
642 )\r
643/*++\r
644 Routine Description:\r
645 \r
646 Implements SIMPLE_TEXT_OUTPUT.Reset().\r
647 If ExtendeVerification is TRUE, then perform dependent Graphics Console \r
648 device reset, and set display mode to mode 0.\r
649 If ExtendedVerification is FALSE, only set display mode to mode 0.\r
650 \r
651 Arguments:\r
652 \r
653 This - Indicates the calling context.\r
654 \r
655 ExtendedVerification - Indicates that the driver may perform a more exhaustive\r
656 verification operation of the device during reset.\r
657 \r
658 Returns:\r
659 \r
660 EFI_SUCCESS\r
661 The reset operation succeeds. \r
662 \r
663 EFI_DEVICE_ERROR\r
664 The Graphics Console is not functioning correctly \r
665 \r
666--*/\r
667{\r
668 This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));\r
669 return This->SetMode (This, 0);\r
670}\r
671\r
672EFI_STATUS\r
673EFIAPI\r
674GraphicsConsoleConOutOutputString (\r
675 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
676 IN CHAR16 *WString\r
677 )\r
678/*++\r
679 Routine Description:\r
680 \r
681 Implements SIMPLE_TEXT_OUTPUT.OutputString().\r
682 The Unicode string will be converted to Glyphs and will be \r
683 sent to the Graphics Console.\r
684 \r
685 \r
686 Arguments:\r
687 \r
688 This - Indicates the calling context.\r
689 \r
690 WString - The Null-terminated Unicode string to be displayed on \r
691 the Graphics Console.\r
692 \r
693 Returns:\r
694 \r
695 EFI_SUCCESS\r
696 The string is output successfully. \r
697 \r
698 EFI_DEVICE_ERROR\r
699 The Graphics Console failed to send the string out.\r
700 \r
701 EFI_WARN_UNKNOWN_GLYPH\r
702 Indicates that some of the characters in the Unicode string could not \r
703 be rendered and are skipped. \r
704 \r
705--*/\r
706{\r
707 GRAPHICS_CONSOLE_DEV *Private;\r
406adcd1 708 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
878ddf1f 709 EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
710 INTN Mode;\r
711 UINTN MaxColumn;\r
712 UINTN MaxRow;\r
713 UINTN Width;\r
714 UINTN Height;\r
715 UINTN Delta;\r
716 EFI_STATUS Status;\r
717 BOOLEAN Warning;\r
406adcd1 718 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;\r
719 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;\r
878ddf1f 720 UINTN DeltaX;\r
721 UINTN DeltaY;\r
722 UINTN Count;\r
723 UINTN Index;\r
724 INT32 OriginAttribute;\r
0fe0b10e 725 EFI_TPL OldTpl;\r
406adcd1 726 CHAR16 SpaceStr[] = { NARROW_CHAR, ' ', 0 };\r
878ddf1f 727\r
0fe0b10e 728 Status = EFI_SUCCESS;\r
729\r
93b0fbc8 730 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
878ddf1f 731 //\r
732 // Current mode\r
733 //\r
734 Mode = This->Mode->Mode;\r
735 Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);\r
406adcd1 736 GraphicsOutput = Private->GraphicsOutput;\r
878ddf1f 737 UgaDraw = Private->UgaDraw;\r
738\r
739 MaxColumn = Private->ModeData[Mode].Columns;\r
740 MaxRow = Private->ModeData[Mode].Rows;\r
741 DeltaX = Private->ModeData[Mode].DeltaX;\r
742 DeltaY = Private->ModeData[Mode].DeltaY;\r
743 Width = MaxColumn * GLYPH_WIDTH;\r
744 Height = (MaxRow - 1) * GLYPH_HEIGHT;\r
406adcd1 745 Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);\r
878ddf1f 746\r
747 //\r
748 // The Attributes won't change when during the time OutputString is called\r
749 //\r
750 GetTextColors (This, &Foreground, &Background);\r
751\r
752 EraseCursor (This);\r
753\r
754 Warning = FALSE;\r
755\r
756 //\r
757 // Backup attribute\r
758 //\r
759 OriginAttribute = This->Mode->Attribute;\r
760\r
761 while (*WString) {\r
762\r
763 if (*WString == CHAR_BACKSPACE) {\r
764 //\r
765 // If the cursor is at the left edge of the display, then move the cursor\r
766 // one row up.\r
767 //\r
768 if (This->Mode->CursorColumn == 0 && This->Mode->CursorRow > 0) {\r
769 This->Mode->CursorRow--;\r
770 This->Mode->CursorColumn = (INT32) (MaxColumn - 1);\r
771 This->OutputString (This, SpaceStr);\r
772 EraseCursor (This);\r
773 This->Mode->CursorRow--;\r
774 This->Mode->CursorColumn = (INT32) (MaxColumn - 1);\r
775 } else if (This->Mode->CursorColumn > 0) {\r
776 //\r
777 // If the cursor is not at the left edge of the display, then move the cursor\r
778 // left one column.\r
779 //\r
780 This->Mode->CursorColumn--;\r
781 This->OutputString (This, SpaceStr);\r
782 EraseCursor (This);\r
783 This->Mode->CursorColumn--;\r
784 }\r
785\r
786 WString++;\r
787\r
788 } else if (*WString == CHAR_LINEFEED) {\r
789 //\r
790 // If the cursor is at the bottom of the display, then scroll the display one\r
791 // row, and do not update the cursor position. Otherwise, move the cursor\r
792 // down one row.\r
793 //\r
794 if (This->Mode->CursorRow == (INT32) (MaxRow - 1)) {\r
406adcd1 795 if (GraphicsOutput != NULL) {\r
796 //\r
797 // Scroll Screen Up One Row\r
798 //\r
799 GraphicsOutput->Blt (\r
800 GraphicsOutput,\r
801 NULL,\r
802 EfiBltVideoToVideo,\r
803 DeltaX,\r
804 DeltaY + GLYPH_HEIGHT,\r
805 DeltaX,\r
806 DeltaY,\r
807 Width,\r
808 Height,\r
809 Delta\r
810 );\r
878ddf1f 811\r
406adcd1 812 //\r
813 // Print Blank Line at last line\r
814 //\r
815 GraphicsOutput->Blt (\r
816 GraphicsOutput,\r
817 &Background,\r
818 EfiBltVideoFill,\r
819 0,\r
820 0,\r
821 DeltaX,\r
822 DeltaY + Height,\r
823 Width,\r
824 GLYPH_HEIGHT,\r
825 Delta\r
826 );\r
827 } else {\r
828 //\r
829 // Scroll Screen Up One Row\r
830 //\r
831 UgaDraw->Blt (\r
832 UgaDraw,\r
833 NULL,\r
834 EfiUgaVideoToVideo,\r
835 DeltaX,\r
836 DeltaY + GLYPH_HEIGHT,\r
837 DeltaX,\r
838 DeltaY,\r
839 Width,\r
840 Height,\r
841 Delta\r
842 );\r
878ddf1f 843\r
406adcd1 844 //\r
845 // Print Blank Line at last line\r
846 //\r
847 UgaDraw->Blt (\r
848 UgaDraw,\r
849 (EFI_UGA_PIXEL *) (UINTN) &Background,\r
850 EfiUgaVideoFill,\r
851 0,\r
852 0,\r
853 DeltaX,\r
854 DeltaY + Height,\r
855 Width,\r
856 GLYPH_HEIGHT,\r
857 Delta\r
858 );\r
859 }\r
878ddf1f 860 } else {\r
861 This->Mode->CursorRow++;\r
862 }\r
863\r
864 WString++;\r
865\r
866 } else if (*WString == CHAR_CARRIAGE_RETURN) {\r
867 //\r
868 // Move the cursor to the beginning of the current row.\r
869 //\r
870 This->Mode->CursorColumn = 0;\r
871 WString++;\r
872\r
873 } else if (*WString == WIDE_CHAR) {\r
874\r
875 This->Mode->Attribute |= EFI_WIDE_ATTRIBUTE;\r
876 WString++;\r
877\r
878 } else if (*WString == NARROW_CHAR) {\r
879\r
880 This->Mode->Attribute &= (~ (UINT32) EFI_WIDE_ATTRIBUTE);\r
881 WString++;\r
882\r
883 } else {\r
884 //\r
885 // Print the character at the current cursor position and move the cursor\r
886 // right one column. If this moves the cursor past the right edge of the\r
887 // display, then the line should wrap to the beginning of the next line. This\r
888 // is equivalent to inserting a CR and an LF. Note that if the cursor is at the\r
889 // bottom of the display, and the line wraps, then the display will be scrolled\r
890 // one line.\r
891 // If wide char is going to be displayed, need to display one character at a time\r
892 // Or, need to know the display length of a certain string.\r
893 //\r
894 // Index is used to determine how many character width units (wide = 2, narrow = 1)\r
895 // Count is used to determine how many characters are used regardless of their attributes\r
896 //\r
897 for (Count = 0, Index = 0; (This->Mode->CursorColumn + Index) < MaxColumn; Count++, Index++) {\r
898 if (WString[Count] == CHAR_NULL) {\r
899 break;\r
900 }\r
901\r
902 if (WString[Count] == CHAR_BACKSPACE) {\r
903 break;\r
904 }\r
905\r
906 if (WString[Count] == CHAR_LINEFEED) {\r
907 break;\r
908 }\r
909\r
910 if (WString[Count] == CHAR_CARRIAGE_RETURN) {\r
911 break;\r
912 }\r
913\r
914 if (WString[Count] == WIDE_CHAR) {\r
915 break;\r
916 }\r
917\r
918 if (WString[Count] == NARROW_CHAR) {\r
919 break;\r
920 }\r
921 //\r
922 // Is the wide attribute on?\r
923 //\r
924 if (This->Mode->Attribute & EFI_WIDE_ATTRIBUTE) {\r
925 //\r
926 // If wide, add one more width unit than normal since we are going to increment at the end of the for loop\r
927 //\r
928 Index++;\r
929 //\r
930 // This is the end-case where if we are at column 79 and about to print a wide character\r
931 // We should prevent this from happening because we will wrap inappropriately. We should\r
932 // not print this character until the next line.\r
933 //\r
934 if ((This->Mode->CursorColumn + Index + 1) > MaxColumn) {\r
935 Index++;\r
936 break;\r
937 }\r
938 }\r
939 }\r
940\r
941 Status = DrawUnicodeWeightAtCursorN (This, WString, Count);\r
942 if (EFI_ERROR (Status)) {\r
943 Warning = TRUE;\r
944 }\r
945 //\r
946 // At the end of line, output carriage return and line feed\r
947 //\r
948 WString += Count;\r
949 This->Mode->CursorColumn += (INT32) Index;\r
950 if (This->Mode->CursorColumn > (INT32) MaxColumn) {\r
951 This->Mode->CursorColumn -= 2;\r
952 This->OutputString (This, SpaceStr);\r
953 }\r
954\r
955 if (This->Mode->CursorColumn >= (INT32) MaxColumn) {\r
956 EraseCursor (This);\r
957 This->OutputString (This, mCrLfString);\r
958 EraseCursor (This);\r
959 }\r
960 }\r
961 }\r
962\r
963 This->Mode->Attribute = OriginAttribute;\r
964\r
965 EraseCursor (This);\r
966\r
967 if (Warning) {\r
0fe0b10e 968 Status = EFI_WARN_UNKNOWN_GLYPH;\r
878ddf1f 969 }\r
970\r
0fe0b10e 971 gBS->RestoreTPL (OldTpl);\r
972 return Status;\r
973\r
878ddf1f 974}\r
975\r
976EFI_STATUS\r
977EFIAPI\r
978GraphicsConsoleConOutTestString (\r
979 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
980 IN CHAR16 *WString\r
981 )\r
982/*++\r
983 Routine Description:\r
984 \r
985 Implements SIMPLE_TEXT_OUTPUT.TestString().\r
986 If one of the characters in the *Wstring is\r
987 neither valid valid Unicode drawing characters,\r
988 not ASCII code, then this function will return\r
989 EFI_UNSUPPORTED.\r
990 \r
991 \r
992 Arguments:\r
993 \r
994 This - Indicates the calling context.\r
995 \r
996 WString - The Null-terminated Unicode string to be tested.\r
997 \r
998 Returns:\r
999 \r
1000 EFI_SUCCESS\r
1001 The Graphics Console is capable of rendering the output string. \r
1002 \r
1003 EFI_UNSUPPORTED\r
1004 Some of the characters in the Unicode string cannot be rendered. \r
1005 \r
1006--*/\r
1007{\r
1008 EFI_STATUS Status;\r
1009 UINT16 GlyphWidth;\r
1010 UINT32 GlyphStatus;\r
1011 UINT16 Count;\r
878ddf1f 1012 GLYPH_UNION *Glyph;\r
1013\r
878ddf1f 1014 GlyphStatus = 0;\r
1015 Count = 0;\r
1016\r
1017 while (WString[Count]) {\r
1018 Status = mHii->GetGlyph (\r
1019 mHii,\r
1020 WString,\r
1021 &Count,\r
1022 (UINT8 **) &Glyph,\r
1023 &GlyphWidth,\r
1024 &GlyphStatus\r
1025 );\r
1026\r
1027 if (EFI_ERROR (Status)) {\r
1028 return EFI_UNSUPPORTED;\r
1029 }\r
1030 }\r
1031\r
1032 return EFI_SUCCESS;\r
1033}\r
1034\r
1035EFI_STATUS\r
1036EFIAPI\r
1037GraphicsConsoleConOutQueryMode (\r
1038 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
1039 IN UINTN ModeNumber,\r
1040 OUT UINTN *Columns,\r
1041 OUT UINTN *Rows\r
1042 )\r
1043/*++\r
1044 Routine Description:\r
1045 \r
1046 Implements SIMPLE_TEXT_OUTPUT.QueryMode().\r
1047 It returnes information for an available text mode\r
1048 that the Graphics Console supports.\r
1049 In this driver,we only support text mode 80x25, which is\r
1050 defined as mode 0.\r
1051 \r
1052 \r
1053 Arguments:\r
1054 \r
1055 This - Indicates the calling context.\r
1056 \r
1057 ModeNumber - The mode number to return information on.\r
1058 \r
1059 Columns - The returned columns of the requested mode.\r
1060 \r
1061 Rows - The returned rows of the requested mode. \r
1062 \r
1063 Returns:\r
1064 \r
1065 EFI_SUCCESS\r
1066 The requested mode information is returned. \r
1067 \r
1068 EFI_UNSUPPORTED\r
1069 The mode number is not valid. \r
1070 \r
1071--*/\r
1072{\r
1073 GRAPHICS_CONSOLE_DEV *Private;\r
0fe0b10e 1074 EFI_STATUS Status;\r
1075 EFI_TPL OldTpl;\r
878ddf1f 1076\r
1077 if (ModeNumber >= (UINTN) This->Mode->MaxMode) {\r
1078 return EFI_UNSUPPORTED;\r
1079 }\r
1080\r
93b0fbc8 1081 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
0fe0b10e 1082 Status = EFI_SUCCESS;\r
1083 \r
878ddf1f 1084 Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);\r
1085\r
1086 *Columns = Private->ModeData[ModeNumber].Columns;\r
1087 *Rows = Private->ModeData[ModeNumber].Rows;\r
1088\r
1089 if (*Columns <= 0 && *Rows <= 0) {\r
0fe0b10e 1090 Status = EFI_UNSUPPORTED;\r
1091 goto Done;\r
878ddf1f 1092\r
1093 }\r
1094\r
0fe0b10e 1095Done:\r
1096 gBS->RestoreTPL (OldTpl);\r
1097 return Status;\r
878ddf1f 1098}\r
1099\r
1100EFI_STATUS\r
1101EFIAPI\r
1102GraphicsConsoleConOutSetMode (\r
1103 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
1104 IN UINTN ModeNumber\r
1105 )\r
1106/*++\r
1107 Routine Description:\r
1108 \r
1109 Implements SIMPLE_TEXT_OUTPUT.SetMode().\r
1110 Set the Graphics Console to a specified mode.\r
1111 In this driver, we only support mode 0. \r
1112 \r
1113 Arguments:\r
1114 \r
1115 This - Indicates the calling context.\r
1116 \r
1117 ModeNumber - The text mode to set.\r
1118 \r
1119 Returns:\r
1120 \r
1121 EFI_SUCCESS\r
1122 The requested text mode is set.\r
1123 \r
1124 EFI_DEVICE_ERROR\r
1125 The requested text mode cannot be set because of Graphics Console device error.\r
1126 \r
1127 EFI_UNSUPPORTED\r
1128 The text mode number is not valid. \r
1129 \r
1130--*/\r
1131{\r
0fe0b10e 1132 EFI_STATUS Status;\r
1133 GRAPHICS_CONSOLE_DEV *Private;\r
1134 GRAPHICS_CONSOLE_MODE_DATA *ModeData;\r
1135 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewLineBuffer;\r
1136 UINT32 HorizontalResolution;\r
1137 UINT32 VerticalResolution;\r
1138 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
1139 EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
1140 UINT32 ColorDepth;\r
1141 UINT32 RefreshRate;\r
1142 EFI_TPL OldTpl;\r
1143\r
93b0fbc8 1144 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
878ddf1f 1145\r
1146 Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);\r
406adcd1 1147 GraphicsOutput = Private->GraphicsOutput;\r
878ddf1f 1148 UgaDraw = Private->UgaDraw;\r
1149 ModeData = &(Private->ModeData[ModeNumber]);\r
1150\r
e313deb9 1151 if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {\r
0fe0b10e 1152 Status = EFI_UNSUPPORTED;\r
1153 goto Done;\r
e313deb9 1154 }\r
1155\r
878ddf1f 1156 //\r
1157 // Make sure the requested mode number is supported\r
1158 //\r
1159 if (ModeNumber >= (UINTN) This->Mode->MaxMode) {\r
0fe0b10e 1160 Status = EFI_UNSUPPORTED;\r
1161 goto Done;\r
878ddf1f 1162 }\r
1163\r
1164 if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {\r
0fe0b10e 1165 Status = EFI_UNSUPPORTED;\r
1166 goto Done;\r
878ddf1f 1167 }\r
1168 //\r
1169 // Attempt to allocate a line buffer for the requested mode number\r
1170 //\r
2c3b5ec5
LG
1171 NewLineBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->Columns * GLYPH_WIDTH * GLYPH_HEIGHT);\r
1172\r
1173 if (NewLineBuffer == NULL) {\r
878ddf1f 1174 //\r
1175 // The new line buffer could not be allocated, so return an error.\r
1176 // No changes to the state of the current console have been made, so the current console is still valid\r
1177 //\r
2c3b5ec5 1178 Status = EFI_OUT_OF_RESOURCES;\r
0fe0b10e 1179 goto Done;\r
878ddf1f 1180 }\r
1181 //\r
1182 // If the mode has been set at least one other time, then LineBuffer will not be NULL\r
1183 //\r
1184 if (Private->LineBuffer != NULL) {\r
1185 //\r
1186 // Clear the current text window on the current graphics console\r
1187 //\r
1188 This->ClearScreen (This);\r
1189\r
1190 //\r
1191 // If the new mode is the same as the old mode, then just return EFI_SUCCESS\r
1192 //\r
1193 if ((INT32) ModeNumber == This->Mode->Mode) {\r
2c3b5ec5 1194 FreePool (NewLineBuffer);\r
0fe0b10e 1195 Status = EFI_SUCCESS;\r
1196 goto Done;\r
878ddf1f 1197 }\r
1198 //\r
1199 // Otherwise, the size of the text console and/or the UGA mode will be changed,\r
1200 // so turn off the cursor, and free the LineBuffer for the current mode\r
1201 //\r
1202 This->EnableCursor (This, FALSE);\r
1203\r
2c3b5ec5 1204 FreePool (Private->LineBuffer);\r
878ddf1f 1205 }\r
1206 //\r
1207 // Assign the current line buffer to the newly allocated line buffer\r
1208 //\r
1209 Private->LineBuffer = NewLineBuffer;\r
1210\r
406adcd1 1211 if (GraphicsOutput != NULL) {\r
1212 if (ModeData->GopModeNumber != GraphicsOutput->Mode->Mode) {\r
878ddf1f 1213 //\r
406adcd1 1214 // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode\r
878ddf1f 1215 //\r
406adcd1 1216 Status = GraphicsOutput->SetMode (GraphicsOutput, ModeData->GopModeNumber);\r
1217 if (EFI_ERROR (Status)) {\r
1218 //\r
1219 // The mode set operation failed\r
1220 //\r
0fe0b10e 1221 goto Done;\r
406adcd1 1222 }\r
1223 } else {\r
1224 //\r
1225 // The current graphics mode is correct, so simply clear the entire display\r
1226 //\r
1227 Status = GraphicsOutput->Blt (\r
1228 GraphicsOutput,\r
1229 &mEfiColors[0],\r
1230 EfiBltVideoFill,\r
1231 0,\r
1232 0,\r
1233 0,\r
1234 0,\r
1235 ModeData->GopWidth,\r
1236 ModeData->GopHeight,\r
1237 0\r
1238 );\r
878ddf1f 1239 }\r
1240 } else {\r
1241 //\r
406adcd1 1242 // Get the current UGA Draw mode information\r
878ddf1f 1243 //\r
406adcd1 1244 Status = UgaDraw->GetMode (\r
878ddf1f 1245 UgaDraw,\r
406adcd1 1246 &HorizontalResolution,\r
1247 &VerticalResolution,\r
1248 &ColorDepth,\r
1249 &RefreshRate\r
878ddf1f 1250 );\r
406adcd1 1251 if (EFI_ERROR (Status) || HorizontalResolution != ModeData->GopWidth || VerticalResolution != ModeData->GopHeight) {\r
1252 //\r
1253 // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode\r
1254 //\r
1255 Status = UgaDraw->SetMode (\r
1256 UgaDraw,\r
1257 ModeData->GopWidth,\r
1258 ModeData->GopHeight,\r
1259 32,\r
1260 60\r
1261 );\r
1262 if (EFI_ERROR (Status)) {\r
1263 //\r
1264 // The mode set operation failed\r
1265 //\r
0fe0b10e 1266 goto Done;\r
406adcd1 1267 }\r
1268 } else {\r
1269 //\r
1270 // The current graphics mode is correct, so simply clear the entire display\r
1271 //\r
1272 Status = UgaDraw->Blt (\r
1273 UgaDraw,\r
1274 (EFI_UGA_PIXEL *) (UINTN) &mEfiColors[0],\r
1275 EfiUgaVideoFill,\r
1276 0,\r
1277 0,\r
1278 0,\r
1279 0,\r
1280 ModeData->GopWidth,\r
1281 ModeData->GopHeight,\r
1282 0\r
1283 );\r
1284 }\r
878ddf1f 1285 }\r
406adcd1 1286\r
878ddf1f 1287 //\r
1288 // The new mode is valid, so commit the mode change\r
1289 //\r
1290 This->Mode->Mode = (INT32) ModeNumber;\r
1291\r
1292 //\r
1293 // Move the text cursor to the upper left hand corner of the displat and enable it\r
1294 //\r
1295 This->SetCursorPosition (This, 0, 0);\r
1296 This->EnableCursor (This, TRUE);\r
1297\r
0fe0b10e 1298 Status = EFI_SUCCESS;\r
1299\r
1300Done:\r
1301 gBS->RestoreTPL (OldTpl);\r
1302 return Status;\r
878ddf1f 1303}\r
1304\r
1305EFI_STATUS\r
1306EFIAPI\r
1307GraphicsConsoleConOutSetAttribute (\r
1308 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
1309 IN UINTN Attribute\r
1310 )\r
1311/*++\r
1312 Routine Description:\r
1313 \r
1314 Implements SIMPLE_TEXT_OUTPUT.SetAttribute(). \r
1315 \r
1316 Arguments:\r
1317 \r
1318 This - Indicates the calling context.\r
1319 \r
1320 Attrubute - The attribute to set. Only bit0..6 are valid, all other bits\r
1321 are undefined and must be zero.\r
1322 \r
1323 Returns:\r
1324 \r
1325 EFI_SUCCESS\r
1326 The requested attribute is set. \r
1327 \r
1328 EFI_DEVICE_ERROR\r
1329 The requested attribute cannot be set due to Graphics Console port error.\r
1330 \r
1331 EFI_UNSUPPORTED\r
1332 The attribute requested is not defined by EFI spec. \r
1333 \r
1334--*/\r
1335{\r
0fe0b10e 1336 EFI_TPL OldTpl;\r
1337 \r
878ddf1f 1338 if ((Attribute | 0xFF) != 0xFF) {\r
1339 return EFI_UNSUPPORTED;\r
1340 }\r
1341\r
1342 if ((INT32) Attribute == This->Mode->Attribute) {\r
1343 return EFI_SUCCESS;\r
1344 }\r
1345\r
93b0fbc8 1346 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
0fe0b10e 1347\r
878ddf1f 1348 EraseCursor (This);\r
1349\r
1350 This->Mode->Attribute = (INT32) Attribute;\r
1351\r
1352 EraseCursor (This);\r
1353\r
0fe0b10e 1354 gBS->RestoreTPL (OldTpl);\r
1355\r
878ddf1f 1356 return EFI_SUCCESS;\r
1357}\r
1358\r
1359EFI_STATUS\r
1360EFIAPI\r
1361GraphicsConsoleConOutClearScreen (\r
1362 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This\r
1363 )\r
1364/*++\r
1365 Routine Description:\r
1366 \r
1367 Implements SIMPLE_TEXT_OUTPUT.ClearScreen().\r
1368 It clears the Graphics Console's display to the \r
1369 currently selected background color.\r
1370 \r
1371 \r
1372 Arguments:\r
1373 \r
1374 This - Indicates the calling context.\r
1375\r
1376 Returns:\r
1377 \r
1378 EFI_SUCCESS\r
1379 The operation completed successfully.\r
1380 \r
1381 EFI_DEVICE_ERROR\r
1382 The Graphics Console cannot be cleared due to Graphics Console device error. \r
1383 \r
1384 EFI_UNSUPPORTED\r
1385 The Graphics Console is not in a valid text mode. \r
1386 \r
1387--*/\r
1388{\r
0fe0b10e 1389 EFI_STATUS Status;\r
1390 GRAPHICS_CONSOLE_DEV *Private;\r
1391 GRAPHICS_CONSOLE_MODE_DATA *ModeData;\r
406adcd1 1392 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
0fe0b10e 1393 EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
406adcd1 1394 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;\r
1395 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;\r
0fe0b10e 1396 EFI_TPL OldTpl;\r
1397\r
93b0fbc8 1398 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
878ddf1f 1399\r
1400 Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);\r
406adcd1 1401 GraphicsOutput = Private->GraphicsOutput;\r
878ddf1f 1402 UgaDraw = Private->UgaDraw;\r
1403 ModeData = &(Private->ModeData[This->Mode->Mode]);\r
1404\r
1405 GetTextColors (This, &Foreground, &Background);\r
406adcd1 1406 if (GraphicsOutput != NULL) {\r
1407 Status = GraphicsOutput->Blt (\r
1408 GraphicsOutput,\r
1409 &Background,\r
1410 EfiBltVideoFill,\r
1411 0,\r
1412 0,\r
1413 0,\r
1414 0,\r
1415 ModeData->GopWidth,\r
1416 ModeData->GopHeight,\r
1417 0\r
1418 );\r
1419 } else {\r
1420 Status = UgaDraw->Blt (\r
1421 UgaDraw,\r
1422 (EFI_UGA_PIXEL *) (UINTN) &Background,\r
1423 EfiUgaVideoFill,\r
1424 0,\r
1425 0,\r
1426 0,\r
1427 0,\r
1428 ModeData->GopWidth,\r
1429 ModeData->GopHeight,\r
1430 0\r
1431 );\r
1432 }\r
878ddf1f 1433\r
1434 This->Mode->CursorColumn = 0;\r
1435 This->Mode->CursorRow = 0;\r
1436\r
1437 EraseCursor (This);\r
1438\r
0fe0b10e 1439 gBS->RestoreTPL (OldTpl);\r
1440\r
878ddf1f 1441 return Status;\r
1442}\r
1443\r
1444EFI_STATUS\r
1445EFIAPI\r
1446GraphicsConsoleConOutSetCursorPosition (\r
1447 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
1448 IN UINTN Column,\r
1449 IN UINTN Row\r
1450 )\r
1451/*++\r
1452 Routine Description:\r
1453 \r
1454 Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition(). \r
1455 \r
1456 Arguments:\r
1457 \r
1458 This - Indicates the calling context.\r
1459 \r
1460 Column - The row to set cursor to.\r
1461 \r
1462 Row - The column to set cursor to. \r
1463\r
1464 Returns:\r
1465 \r
1466 EFI_SUCCESS\r
1467 The operation completed successfully.\r
1468 \r
1469 EFI_DEVICE_ERROR\r
1470 The request fails due to Graphics Console device error. \r
1471 \r
1472 EFI_UNSUPPORTED\r
1473 The Graphics Console is not in a valid text mode, or the cursor position\r
1474 is invalid for current mode. \r
1475 \r
1476--*/\r
1477{\r
1478 GRAPHICS_CONSOLE_DEV *Private;\r
1479 GRAPHICS_CONSOLE_MODE_DATA *ModeData;\r
0fe0b10e 1480 EFI_STATUS Status;\r
1481 EFI_TPL OldTpl;\r
1482\r
1483 Status = EFI_SUCCESS;\r
1484\r
93b0fbc8 1485 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
878ddf1f 1486\r
1487 Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);\r
1488 ModeData = &(Private->ModeData[This->Mode->Mode]);\r
1489\r
1490 if ((Column >= ModeData->Columns) || (Row >= ModeData->Rows)) {\r
0fe0b10e 1491 Status = EFI_UNSUPPORTED;\r
1492 goto Done;\r
878ddf1f 1493 }\r
1494\r
1495 if (((INT32) Column == This->Mode->CursorColumn) && ((INT32) Row == This->Mode->CursorRow)) {\r
0fe0b10e 1496 Status = EFI_SUCCESS;\r
1497 goto Done;\r
878ddf1f 1498 }\r
1499\r
1500 EraseCursor (This);\r
1501\r
1502 This->Mode->CursorColumn = (INT32) Column;\r
1503 This->Mode->CursorRow = (INT32) Row;\r
1504\r
1505 EraseCursor (This);\r
1506\r
0fe0b10e 1507Done:\r
1508 gBS->RestoreTPL (OldTpl);\r
1509\r
1510 return Status;\r
878ddf1f 1511}\r
1512\r
1513EFI_STATUS\r
1514EFIAPI\r
1515GraphicsConsoleConOutEnableCursor (\r
1516 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
1517 IN BOOLEAN Visible\r
1518 )\r
1519/*++\r
1520 Routine Description:\r
1521 \r
1522 Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
1523 In this driver, the cursor cannot be hidden. \r
1524 \r
1525 Arguments:\r
1526 \r
1527 This - Indicates the calling context.\r
1528 \r
1529 Visible - If TRUE, the cursor is set to be visible,\r
1530 If FALSE, the cursor is set to be invisible. \r
1531\r
1532 Returns:\r
1533 \r
1534 EFI_SUCCESS\r
1535 The request is valid.\r
1536 \r
1537 EFI_UNSUPPORTED\r
1538 The Graphics Console does not support a hidden cursor. \r
1539 \r
1540--*/\r
1541{\r
0fe0b10e 1542 EFI_TPL OldTpl;\r
1543 \r
93b0fbc8 1544 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
0fe0b10e 1545 \r
878ddf1f 1546 EraseCursor (This);\r
1547\r
1548 This->Mode->CursorVisible = Visible;\r
1549\r
1550 EraseCursor (This);\r
1551\r
0fe0b10e 1552 gBS->RestoreTPL (OldTpl);\r
878ddf1f 1553 return EFI_SUCCESS;\r
1554}\r
1555\r
92dda53e 1556STATIC\r
878ddf1f 1557EFI_STATUS\r
1558GetTextColors (\r
1559 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
406adcd1 1560 OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,\r
1561 OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background\r
878ddf1f 1562 )\r
1563{\r
1564 INTN Attribute;\r
1565\r
1566 Attribute = This->Mode->Attribute & 0x7F;\r
1567\r
1568 *Foreground = mEfiColors[Attribute & 0x0f];\r
1569 *Background = mEfiColors[Attribute >> 4];\r
1570\r
1571 return EFI_SUCCESS;\r
1572}\r
1573\r
92dda53e 1574STATIC\r
878ddf1f 1575EFI_STATUS\r
1576DrawUnicodeWeightAtCursorN (\r
1577 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
1578 IN CHAR16 *UnicodeWeight,\r
1579 IN UINTN Count\r
1580 )\r
1581{\r
1582 GRAPHICS_CONSOLE_DEV *Private;\r
1583 EFI_STATUS Status;\r
1584 EFI_STATUS ReturnStatus;\r
1585 GLYPH_UNION *Glyph;\r
1586 GLYPH_UNION GlyphData;\r
1587 INTN GlyphX;\r
1588 INTN GlyphY;\r
406adcd1 1589 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
878ddf1f 1590 EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
406adcd1 1591 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;\r
1592 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;\r
878ddf1f 1593 UINTN Index;\r
1594 UINTN ArrayIndex;\r
1595 UINTN Counts;\r
1596 UINT16 GlyphWidth;\r
1597 UINT32 GlyphStatus;\r
1598\r
1599 Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);\r
1600\r
1601 ReturnStatus = EFI_SUCCESS;\r
1602 GlyphStatus = 0;\r
1603 GlyphWidth = 0x08;\r
1604\r
1605 GetTextColors (This, &Foreground, &Background);\r
1606\r
1607 Index = 0;\r
1608 ArrayIndex = 0;\r
1609 while (Index < Count) {\r
1610 if (This->Mode->Attribute & EFI_WIDE_ATTRIBUTE) {\r
1611 GlyphStatus = WIDE_CHAR;\r
1612 } else {\r
1613 GlyphStatus = NARROW_CHAR;\r
1614 }\r
1615\r
1616 Status = mHii->GetGlyph (\r
1617 mHii,\r
1618 UnicodeWeight,\r
1619 (UINT16 *) &Index,\r
1620 (UINT8 **) &Glyph,\r
1621 &GlyphWidth,\r
1622 &GlyphStatus\r
1623 );\r
1624 if (EFI_ERROR (Status)) {\r
1625 ReturnStatus = Status;\r
1626 }\r
1627\r
1628 Counts = 0;\r
1629\r
1630 CopyMem (&GlyphData, Glyph, sizeof (GLYPH_UNION));\r
1631\r
1632 do {\r
1633 //\r
1634 // We are creating the second half of the wide character's BLT buffer\r
1635 //\r
1636 if (GlyphWidth == 0x10 && Counts == 1) {\r
1637 CopyMem (&GlyphData.NarrowGlyph.GlyphCol1, &Glyph->WideGlyph.GlyphCol2, sizeof (Glyph->WideGlyph.GlyphCol2));\r
1638 }\r
1639\r
1640 Counts++;\r
1641\r
1642 if (GlyphWidth == 0x10) {\r
1643 mHii->GlyphToBlt (\r
1644 mHii,\r
1645 (UINT8 *) &GlyphData,\r
1646 Foreground,\r
1647 Background,\r
1648 Count * 2,\r
1649 GLYPH_WIDTH,\r
1650 GLYPH_HEIGHT,\r
1651 &Private->LineBuffer[ArrayIndex * GLYPH_WIDTH]\r
1652 );\r
1653 } else {\r
1654 mHii->GlyphToBlt (\r
1655 mHii,\r
1656 (UINT8 *) &GlyphData,\r
1657 Foreground,\r
1658 Background,\r
1659 Count,\r
1660 GLYPH_WIDTH,\r
1661 GLYPH_HEIGHT,\r
1662 &Private->LineBuffer[ArrayIndex * GLYPH_WIDTH]\r
1663 );\r
1664 }\r
1665\r
1666 ArrayIndex++;\r
1667\r
1668 } while (Counts < 2 && GlyphWidth == 0x10);\r
1669\r
1670 }\r
1671 //\r
1672 // If we are printing Wide characters, treat the BLT as if it is twice as many characters\r
1673 //\r
1674 if (GlyphWidth == 0x10) {\r
1675 Count = Count * 2;\r
1676 }\r
1677 //\r
1678 // Blt a character to the screen\r
1679 //\r
1680 GlyphX = This->Mode->CursorColumn * GLYPH_WIDTH;\r
1681 GlyphY = This->Mode->CursorRow * GLYPH_HEIGHT;\r
406adcd1 1682 GraphicsOutput = Private->GraphicsOutput;\r
878ddf1f 1683 UgaDraw = Private->UgaDraw;\r
406adcd1 1684 if (GraphicsOutput != NULL) {\r
1685 GraphicsOutput->Blt (\r
1686 GraphicsOutput,\r
1687 Private->LineBuffer,\r
1688 EfiBltBufferToVideo,\r
1689 0,\r
1690 0,\r
1691 GlyphX + Private->ModeData[This->Mode->Mode].DeltaX,\r
1692 GlyphY + Private->ModeData[This->Mode->Mode].DeltaY,\r
1693 GLYPH_WIDTH * Count,\r
1694 GLYPH_HEIGHT,\r
1695 GLYPH_WIDTH * Count * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
1696 );\r
1697 } else {\r
1698 UgaDraw->Blt (\r
1699 UgaDraw,\r
1700 (EFI_UGA_PIXEL *) (UINTN) Private->LineBuffer,\r
1701 EfiUgaBltBufferToVideo,\r
1702 0,\r
1703 0,\r
1704 GlyphX + Private->ModeData[This->Mode->Mode].DeltaX,\r
1705 GlyphY + Private->ModeData[This->Mode->Mode].DeltaY,\r
1706 GLYPH_WIDTH * Count,\r
1707 GLYPH_HEIGHT,\r
1708 GLYPH_WIDTH * Count * sizeof (EFI_UGA_PIXEL)\r
1709 );\r
1710 }\r
878ddf1f 1711\r
1712 return ReturnStatus;\r
1713}\r
1714\r
92dda53e 1715STATIC\r
878ddf1f 1716EFI_STATUS\r
1717EraseCursor (\r
1718 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This\r
1719 )\r
1720{\r
1721 GRAPHICS_CONSOLE_DEV *Private;\r
1722 EFI_SIMPLE_TEXT_OUTPUT_MODE *CurrentMode;\r
1723 INTN GlyphX;\r
1724 INTN GlyphY;\r
406adcd1 1725 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
878ddf1f 1726 EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
406adcd1 1727 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Foreground;\r
1728 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Background;\r
1729 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION BltChar[GLYPH_HEIGHT][GLYPH_WIDTH];\r
878ddf1f 1730 UINTN X;\r
1731 UINTN Y;\r
1732\r
1733 CurrentMode = This->Mode;\r
1734\r
1735 if (!CurrentMode->CursorVisible) {\r
1736 return EFI_SUCCESS;\r
1737 }\r
1738\r
1739 Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);\r
406adcd1 1740 GraphicsOutput = Private->GraphicsOutput;\r
878ddf1f 1741 UgaDraw = Private->UgaDraw;\r
1742\r
1743 //\r
1744 // BUGBUG - we need to think about what to do with wide and narrow character deletions.\r
1745 //\r
1746 //\r
1747 // Blt a character to the screen\r
1748 //\r
1749 GlyphX = (CurrentMode->CursorColumn * GLYPH_WIDTH) + Private->ModeData[CurrentMode->Mode].DeltaX;\r
1750 GlyphY = (CurrentMode->CursorRow * GLYPH_HEIGHT) + Private->ModeData[CurrentMode->Mode].DeltaY;\r
406adcd1 1751 if (GraphicsOutput != NULL) {\r
1752 GraphicsOutput->Blt (\r
1753 GraphicsOutput,\r
1754 (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltChar,\r
1755 EfiBltVideoToBltBuffer,\r
1756 GlyphX,\r
1757 GlyphY,\r
1758 0,\r
1759 0,\r
1760 GLYPH_WIDTH,\r
1761 GLYPH_HEIGHT,\r
1762 GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
1763 );\r
1764 } else {\r
1765 UgaDraw->Blt (\r
1766 UgaDraw,\r
1767 (EFI_UGA_PIXEL *) (UINTN) BltChar,\r
1768 EfiUgaVideoToBltBuffer,\r
1769 GlyphX,\r
1770 GlyphY,\r
1771 0,\r
1772 0,\r
1773 GLYPH_WIDTH,\r
1774 GLYPH_HEIGHT,\r
1775 GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)\r
1776 );\r
1777 }\r
878ddf1f 1778\r
1779 GetTextColors (This, &Foreground.Pixel, &Background.Pixel);\r
1780\r
1781 //\r
1782 // Convert Monochrome bitmap of the Glyph to BltBuffer structure\r
1783 //\r
1784 for (Y = 0; Y < GLYPH_HEIGHT; Y++) {\r
1785 for (X = 0; X < GLYPH_WIDTH; X++) {\r
1786 if ((mCursorGlyph.GlyphCol1[Y] & (1 << X)) != 0) {\r
1787 BltChar[Y][GLYPH_WIDTH - X - 1].Raw ^= Foreground.Raw;\r
1788 }\r
1789 }\r
1790 }\r
1791\r
406adcd1 1792 if (GraphicsOutput != NULL) {\r
1793 GraphicsOutput->Blt (\r
1794 GraphicsOutput,\r
1795 (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltChar,\r
1796 EfiBltBufferToVideo,\r
1797 0,\r
1798 0,\r
1799 GlyphX,\r
1800 GlyphY,\r
1801 GLYPH_WIDTH,\r
1802 GLYPH_HEIGHT,\r
1803 GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
1804 );\r
1805 } else {\r
1806 UgaDraw->Blt (\r
1807 UgaDraw,\r
1808 (EFI_UGA_PIXEL *) (UINTN) BltChar,\r
1809 EfiUgaBltBufferToVideo,\r
1810 0,\r
1811 0,\r
1812 GlyphX,\r
1813 GlyphY,\r
1814 GLYPH_WIDTH,\r
1815 GLYPH_HEIGHT,\r
1816 GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)\r
1817 );\r
1818 }\r
878ddf1f 1819\r
1820 return EFI_SUCCESS;\r
1821}\r