]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
Rename PcdPlatformBusSpeed to PcdFSBClock and update help text.
[mirror_edk2.git] / EdkModulePkg / Library / EdkGraphicsLib / Graphics.c
1 /*++
2
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
8
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.
11
12 Module Name:
13
14 Graphics.c
15
16 Abstract:
17
18 Support for Basic Graphics operations.
19
20 BugBug: Currently *.BMP files are supported. This will be replaced
21 when Tiano graphics format is supported.
22
23 --*/
24
25 EFI_STATUS
26 GetGraphicsBitMapFromFV (
27 IN EFI_GUID *FileNameGuid,
28 OUT VOID **Image,
29 OUT UINTN *ImageSize
30 )
31 /*++
32
33 Routine Description:
34
35 Return the graphics image file named FileNameGuid into Image and return it's
36 size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
37 file name.
38
39 Arguments:
40
41 FileNameGuid - File Name of graphics file in the FV(s).
42
43 Image - Pointer to pointer to return graphics image. If NULL, a
44 buffer will be allocated.
45
46 ImageSize - Size of the graphics Image in bytes. Zero if no image found.
47
48
49 Returns:
50
51 EFI_SUCCESS - Image and ImageSize are valid.
52 EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size
53 EFI_NOT_FOUND - FileNameGuid not found
54
55 --*/
56 {
57 EFI_STATUS Status;
58 UINTN FvProtocolCount;
59 EFI_HANDLE *FvHandles;
60 EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
61 UINTN Index;
62 UINT32 AuthenticationStatus;
63
64
65 Status = gBS->LocateHandleBuffer (
66 ByProtocol,
67 &gEfiFirmwareVolumeProtocolGuid,
68 NULL,
69 &FvProtocolCount,
70 &FvHandles
71 );
72 if (EFI_ERROR (Status)) {
73 return EFI_NOT_FOUND;
74 }
75
76 for (Index = 0; Index < FvProtocolCount; Index++) {
77 Status = gBS->HandleProtocol (
78 FvHandles[Index],
79 &gEfiFirmwareVolumeProtocolGuid,
80 (VOID **) &Fv
81 );
82
83 //
84 // Assuming Image and ImageSize are correct on input.
85 //
86 Status = Fv->ReadSection (
87 Fv,
88 &gEfiDefaultBmpLogoGuid,
89 EFI_SECTION_RAW,
90 0,
91 Image,
92 ImageSize,
93 &AuthenticationStatus
94 );
95 if (!EFI_ERROR (Status)) {
96 return EFI_SUCCESS;
97 } else if (Status == EFI_BUFFER_TOO_SMALL) {
98 //
99 // ImageSize updated to needed size so return
100 //
101 return EFI_BUFFER_TOO_SMALL;
102 }
103 }
104
105 return EFI_NOT_FOUND;
106 }
107
108
109 EFI_STATUS
110 ConvertBmpToUgaBlt (
111 IN VOID *BmpImage,
112 IN UINTN BmpImageSize,
113 IN OUT VOID **UgaBlt,
114 IN OUT UINTN *UgaBltSize,
115 OUT UINTN *PixelHeight,
116 OUT UINTN *PixelWidth
117 )
118 /*++
119
120 Routine Description:
121
122 Convert a *.BMP graphics image to a UGA blt buffer. If a NULL UgaBlt buffer
123 is passed in a UgaBlt buffer will be allocated by this routine. If a UgaBlt
124 buffer is passed in it will be used if it is big enough.
125
126 Arguments:
127
128 BmpImage - Pointer to BMP file
129
130 BmpImageSize - Number of bytes in BmpImage
131
132 UgaBlt - Buffer containing UGA version of BmpImage.
133
134 UgaBltSize - Size of UgaBlt in bytes.
135
136 PixelHeight - Height of UgaBlt/BmpImage in pixels
137
138 PixelWidth - Width of UgaBlt/BmpImage in pixels
139
140
141 Returns:
142
143 EFI_SUCCESS - UgaBlt and UgaBltSize are returned.
144 EFI_UNSUPPORTED - BmpImage is not a valid *.BMP image
145 EFI_BUFFER_TOO_SMALL - The passed in UgaBlt buffer is not big enough.
146 UgaBltSize will contain the required size.
147 EFI_OUT_OF_RESOURCES - No enough buffer to allocate
148
149 --*/
150 {
151 UINT8 *Image;
152 UINT8 *ImageHeader;
153 BMP_IMAGE_HEADER *BmpHeader;
154 BMP_COLOR_MAP *BmpColorMap;
155 EFI_UGA_PIXEL *BltBuffer;
156 EFI_UGA_PIXEL *Blt;
157 UINTN BltBufferSize;
158 UINTN Index;
159 UINTN Height;
160 UINTN Width;
161 UINTN ImageIndex;
162 BOOLEAN IsAllocated;
163
164 BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;
165 if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
166 return EFI_UNSUPPORTED;
167 }
168
169 if (BmpHeader->CompressionType != 0) {
170 return EFI_UNSUPPORTED;
171 }
172
173 //
174 // Calculate Color Map offset in the image.
175 //
176 Image = BmpImage;
177 BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));
178
179 //
180 // Calculate graphics image data address in the image
181 //
182 Image = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;
183 ImageHeader = Image;
184
185 BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_UGA_PIXEL);
186 IsAllocated = FALSE;
187 if (*UgaBlt == NULL) {
188 *UgaBltSize = BltBufferSize;
189 *UgaBlt = AllocatePool (*UgaBltSize);
190 if (*UgaBlt == NULL) {
191 return EFI_OUT_OF_RESOURCES;
192 }
193 IsAllocated = TRUE;
194 } else {
195 if (*UgaBltSize < BltBufferSize) {
196 *UgaBltSize = BltBufferSize;
197 return EFI_BUFFER_TOO_SMALL;
198 }
199 }
200
201 *PixelWidth = BmpHeader->PixelWidth;
202 *PixelHeight = BmpHeader->PixelHeight;
203
204 //
205 // Convert image from BMP to Blt buffer format
206 //
207 BltBuffer = *UgaBlt;
208 for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
209 Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
210 for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
211 switch (BmpHeader->BitPerPixel) {
212 case 1:
213 //
214 // Convert 1bit BMP to 24-bit color
215 //
216 for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
217 Blt->Red = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red;
218 Blt->Green = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Green;
219 Blt->Blue = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Blue;
220 Blt++;
221 Width++;
222 }
223
224 Blt --;
225 Width --;
226 break;
227
228 case 4:
229 //
230 // Convert BMP Palette to 24-bit color
231 //
232 Index = (*Image) >> 4;
233 Blt->Red = BmpColorMap[Index].Red;
234 Blt->Green = BmpColorMap[Index].Green;
235 Blt->Blue = BmpColorMap[Index].Blue;
236 if (Width < (BmpHeader->PixelWidth - 1)) {
237 Blt++;
238 Width++;
239 Index = (*Image) & 0x0f;
240 Blt->Red = BmpColorMap[Index].Red;
241 Blt->Green = BmpColorMap[Index].Green;
242 Blt->Blue = BmpColorMap[Index].Blue;
243 }
244 break;
245
246 case 8:
247 //
248 // Convert BMP Palette to 24-bit color
249 //
250 Blt->Red = BmpColorMap[*Image].Red;
251 Blt->Green = BmpColorMap[*Image].Green;
252 Blt->Blue = BmpColorMap[*Image].Blue;
253 break;
254
255 case 24:
256 Blt->Blue = *Image++;
257 Blt->Green = *Image++;
258 Blt->Red = *Image;
259 break;
260
261 default:
262 if (IsAllocated) {
263 gBS->FreePool (*UgaBlt);
264 *UgaBlt = NULL;
265 }
266 return EFI_UNSUPPORTED;
267 break;
268 };
269
270 }
271
272 ImageIndex = (UINTN) (Image - ImageHeader);
273 if ((ImageIndex % 4) != 0) {
274 //
275 // Bmp Image starts each row on a 32-bit boundary!
276 //
277 Image = Image + (4 - (ImageIndex % 4));
278 }
279 }
280
281 return EFI_SUCCESS;
282 }
283
284
285 EFI_STATUS
286 LockKeyboards (
287 IN CHAR16 *Password
288 )
289 /*++
290
291 Routine Description:
292 Use Console Control Protocol to lock the Console In Spliter virtual handle.
293 This is the ConInHandle and ConIn handle in the EFI system table. All key
294 presses will be ignored until the Password is typed in. The only way to
295 disable the password is to type it in to a ConIn device.
296
297 Arguments:
298 Password - Password used to lock ConIn device
299
300
301 Returns:
302
303 EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
304 displayed.
305 EFI_UNSUPPORTED - Logo not found
306
307 --*/
308 {
309 EFI_STATUS Status;
310 EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
311
312 Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
313 if (EFI_ERROR (Status)) {
314 return EFI_UNSUPPORTED;
315 }
316
317 Status = ConsoleControl->LockStdIn (ConsoleControl, Password);
318 return Status;
319 }
320
321
322 EFI_STATUS
323 EnableQuietBoot (
324 IN EFI_GUID *LogoFile
325 )
326 /*++
327
328 Routine Description:
329
330 Use Console Control to turn off UGA based Simple Text Out consoles from going
331 to the UGA device. Put up LogoFile on every UGA device that is a console
332
333 Arguments:
334
335 LogoFile - File name of logo to display on the center of the screen.
336
337
338 Returns:
339
340 EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
341 displayed.
342 EFI_UNSUPPORTED - Logo not found
343
344 --*/
345 {
346 EFI_STATUS Status;
347 EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
348 EFI_UGA_DRAW_PROTOCOL *UgaDraw;
349 EFI_OEM_BADGING_PROTOCOL *Badging;
350 UINT32 SizeOfX;
351 UINT32 SizeOfY;
352 UINT32 ColorDepth;
353 UINT32 RefreshRate;
354 INTN DestX;
355 INTN DestY;
356
357 UINT8 *ImageData;
358 UINTN ImageSize;
359 EFI_UGA_PIXEL *UgaBlt;
360 UINTN UgaBltSize;
361
362 UINT32 Instance;
363 EFI_BADGING_FORMAT Format;
364 EFI_BADGING_DISPLAY_ATTRIBUTE Attribute;
365 UINTN CoordinateX;
366 UINTN CoordinateY;
367 UINTN Height;
368 UINTN Width;
369
370 Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
371 if (EFI_ERROR (Status)) {
372 return EFI_UNSUPPORTED;
373 }
374
375 Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);
376 if (EFI_ERROR (Status)) {
377 return EFI_UNSUPPORTED;
378 }
379
380 Badging = NULL;
381 Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);
382
383 ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);
384
385 Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
386 if (EFI_ERROR (Status)) {
387 return EFI_UNSUPPORTED;
388 }
389
390 Instance = 0;
391 while (1) {
392 ImageData = NULL;
393 ImageSize = 0;
394
395 if (Badging != NULL) {
396 Status = Badging->GetImage (
397 Badging,
398 &Instance,
399 &Format,
400 &ImageData,
401 &ImageSize,
402 &Attribute,
403 &CoordinateX,
404 &CoordinateY
405 );
406 if (EFI_ERROR (Status)) {
407 return Status;
408 }
409
410 //
411 // Currently only support BMP format
412 //
413 if (Format != EfiBadgingFormatBMP) {
414 gBS->FreePool (ImageData);
415 continue;
416 }
417 } else {
418 Status = GetGraphicsBitMapFromFV (LogoFile, (VOID **) &ImageData, &ImageSize);
419 if (EFI_ERROR (Status)) {
420 return EFI_UNSUPPORTED;
421 }
422
423 CoordinateX = 0;
424 CoordinateY = 0;
425 Attribute = EfiBadgingDisplayAttributeCenter;
426 }
427
428 UgaBlt = NULL;
429 Status = ConvertBmpToUgaBlt (
430 ImageData,
431 ImageSize,
432 (VOID **) &UgaBlt,
433 &UgaBltSize,
434 &Height,
435 &Width
436 );
437 if (EFI_ERROR (Status)) {
438 gBS->FreePool (ImageData);
439 continue;
440 }
441
442 switch (Attribute) {
443 case EfiBadgingDisplayAttributeLeftTop:
444 DestX = CoordinateX;
445 DestY = CoordinateY;
446 break;
447
448 case EfiBadgingDisplayAttributeCenterTop:
449 DestX = (SizeOfX - Width) / 2;
450 DestY = CoordinateY;
451 break;
452
453 case EfiBadgingDisplayAttributeRightTop:
454 DestX = (SizeOfX - Width - CoordinateX);
455 DestY = CoordinateY;;
456 break;
457
458 case EfiBadgingDisplayAttributeCenterRight:
459 DestX = (SizeOfX - Width - CoordinateX);
460 DestY = (SizeOfY - Height) / 2;
461 break;
462
463 case EfiBadgingDisplayAttributeRightBottom:
464 DestX = (SizeOfX - Width - CoordinateX);
465 DestY = (SizeOfY - Height - CoordinateY);
466 break;
467
468 case EfiBadgingDisplayAttributeCenterBottom:
469 DestX = (SizeOfX - Width) / 2;
470 DestY = (SizeOfY - Height - CoordinateY);
471 break;
472
473 case EfiBadgingDisplayAttributeLeftBottom:
474 DestX = CoordinateX;
475 DestY = (SizeOfY - Height - CoordinateY);
476 break;
477
478 case EfiBadgingDisplayAttributeCenterLeft:
479 DestX = CoordinateX;
480 DestY = (SizeOfY - Height) / 2;
481 break;
482
483 case EfiBadgingDisplayAttributeCenter:
484 DestX = (SizeOfX - Width) / 2;
485 DestY = (SizeOfY - Height) / 2;
486 break;
487
488 default:
489 DestX = CoordinateX;
490 DestY = CoordinateY;
491 break;
492 }
493
494 if ((DestX >= 0) && (DestY >= 0)) {
495 Status = UgaDraw->Blt (
496 UgaDraw,
497 UgaBlt,
498 EfiUgaBltBufferToVideo,
499 0,
500 0,
501 (UINTN) DestX,
502 (UINTN) DestY,
503 Width,
504 Height,
505 Width * sizeof (EFI_UGA_PIXEL)
506 );
507 }
508
509 gBS->FreePool (ImageData);
510 gBS->FreePool (UgaBlt);
511
512 if (Badging == NULL) {
513 break;
514 }
515 }
516
517 return Status;
518 }
519
520
521 EFI_STATUS
522 DisableQuietBoot (
523 VOID
524 )
525 /*++
526
527 Routine Description:
528
529 Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
530 Simple Text Out screens will now be synced up with all non UGA output devices
531
532 Arguments:
533
534 NONE
535
536 Returns:
537
538 EFI_SUCCESS - UGA devices are back in text mode and synced up.
539 EFI_UNSUPPORTED - Logo not found
540
541 --*/
542 {
543 EFI_STATUS Status;
544 EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
545
546 Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
547 if (EFI_ERROR (Status)) {
548 return EFI_UNSUPPORTED;
549 }
550
551 return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
552 }
553
554 static EFI_UGA_PIXEL mEfiColors[16] = {
555 { 0x00, 0x00, 0x00, 0x00 },
556 { 0x98, 0x00, 0x00, 0x00 },
557 { 0x00, 0x98, 0x00, 0x00 },
558 { 0x98, 0x98, 0x00, 0x00 },
559 { 0x00, 0x00, 0x98, 0x00 },
560 { 0x98, 0x00, 0x98, 0x00 },
561 { 0x00, 0x98, 0x98, 0x00 },
562 { 0x98, 0x98, 0x98, 0x00 },
563 { 0x10, 0x10, 0x10, 0x00 },
564 { 0xff, 0x10, 0x10, 0x00 },
565 { 0x10, 0xff, 0x10, 0x00 },
566 { 0xff, 0xff, 0x10, 0x00 },
567 { 0x10, 0x10, 0xff, 0x00 },
568 { 0xf0, 0x10, 0xff, 0x00 },
569 { 0x10, 0xff, 0xff, 0x00 },
570 { 0xff, 0xff, 0xff, 0x00 }
571 };
572
573 STATIC
574 UINTN
575 _IPrint (
576 IN EFI_UGA_DRAW_PROTOCOL *UgaDraw,
577 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto,
578 IN UINTN X,
579 IN UINTN Y,
580 IN EFI_UGA_PIXEL *Foreground,
581 IN EFI_UGA_PIXEL *Background,
582 IN CHAR16 *fmt,
583 IN VA_LIST args
584 )
585 /*++
586
587 Routine Description:
588
589 Display string worker for: Print, PrintAt, IPrint, IPrintAt
590
591 Arguments:
592
593 UgaDraw - UGA draw protocol interface
594
595 Sto - Simple text out protocol interface
596
597 X - X coordinate to start printing
598
599 Y - Y coordinate to start printing
600
601 Foreground - Foreground color
602
603 Background - Background color
604
605 fmt - Format string
606
607 args - Print arguments
608
609 Returns:
610
611 EFI_SUCCESS - success
612 EFI_OUT_OF_RESOURCES - out of resources
613
614 --*/
615 {
616 VOID *Buffer;
617 EFI_STATUS Status;
618 UINT16 GlyphWidth;
619 UINT32 GlyphStatus;
620 UINT16 StringIndex;
621 UINTN Index;
622 CHAR16 *UnicodeWeight;
623 EFI_NARROW_GLYPH *Glyph;
624 EFI_HII_PROTOCOL *Hii;
625 EFI_UGA_PIXEL *LineBuffer;
626 UINT32 HorizontalResolution;
627 UINT32 VerticalResolution;
628 UINT32 ColorDepth;
629 UINT32 RefreshRate;
630
631 GlyphStatus = 0;
632
633 //
634 // For now, allocate an arbitrarily long buffer
635 //
636 Buffer = AllocateZeroPool (0x10000);
637 if (Buffer == NULL) {
638 return EFI_OUT_OF_RESOURCES;
639 }
640
641 UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
642
643 LineBuffer = AllocatePool (sizeof (EFI_UGA_PIXEL) * HorizontalResolution * GLYPH_WIDTH * GLYPH_HEIGHT);
644 if (LineBuffer == NULL) {
645 gBS->FreePool (Buffer);
646 return EFI_OUT_OF_RESOURCES;
647 }
648
649 Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, (VOID **) &Hii);
650 if (EFI_ERROR (Status)) {
651 goto Error;
652 }
653
654 UnicodeVSPrint (Buffer, 0x10000, fmt, args);
655
656 UnicodeWeight = (CHAR16 *) Buffer;
657
658 for (Index = 0; UnicodeWeight[Index] != 0; Index++) {
659 if (UnicodeWeight[Index] == CHAR_BACKSPACE ||
660 UnicodeWeight[Index] == CHAR_LINEFEED ||
661 UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {
662 UnicodeWeight[Index] = 0;
663 }
664 }
665
666 for (Index = 0; Index < StrLen (Buffer); Index++) {
667 StringIndex = (UINT16) Index;
668 Status = Hii->GetGlyph (Hii, UnicodeWeight, &StringIndex, (UINT8 **) &Glyph, &GlyphWidth, &GlyphStatus);
669 if (EFI_ERROR (Status)) {
670 goto Error;
671 }
672
673 if (Foreground == NULL || Background == NULL) {
674 Status = Hii->GlyphToBlt (
675 Hii,
676 (UINT8 *) Glyph,
677 mEfiColors[Sto->Mode->Attribute & 0x0f],
678 mEfiColors[Sto->Mode->Attribute >> 4],
679 StrLen (Buffer),
680 GlyphWidth,
681 GLYPH_HEIGHT,
682 &LineBuffer[Index * GLYPH_WIDTH]
683 );
684 } else {
685 Status = Hii->GlyphToBlt (
686 Hii,
687 (UINT8 *) Glyph,
688 *Foreground,
689 *Background,
690 StrLen (Buffer),
691 GlyphWidth,
692 GLYPH_HEIGHT,
693 &LineBuffer[Index * GLYPH_WIDTH]
694 );
695 }
696 }
697
698 //
699 // Blt a character to the screen
700 //
701 Status = UgaDraw->Blt (
702 UgaDraw,
703 LineBuffer,
704 EfiUgaBltBufferToVideo,
705 0,
706 0,
707 X,
708 Y,
709 GLYPH_WIDTH * StrLen (Buffer),
710 GLYPH_HEIGHT,
711 GLYPH_WIDTH * StrLen (Buffer) * sizeof (EFI_UGA_PIXEL)
712 );
713
714 Error:
715 gBS->FreePool (LineBuffer);
716 gBS->FreePool (Buffer);
717 return Status;
718 }
719
720
721 UINTN
722 PrintXY (
723 IN UINTN X,
724 IN UINTN Y,
725 IN EFI_UGA_PIXEL *ForeGround, OPTIONAL
726 IN EFI_UGA_PIXEL *BackGround, OPTIONAL
727 IN CHAR16 *Fmt,
728 ...
729 )
730 /*++
731
732 Routine Description:
733
734 Prints a formatted unicode string to the default console
735
736 Arguments:
737
738 X - X coordinate to start printing
739
740 Y - Y coordinate to start printing
741
742 ForeGround - Foreground color
743
744 BackGround - Background color
745
746 Fmt - Format string
747
748 ... - Print arguments
749
750 Returns:
751
752 Length of string printed to the console
753
754 --*/
755 {
756 EFI_HANDLE Handle;
757 EFI_UGA_DRAW_PROTOCOL *UgaDraw;
758 EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto;
759 EFI_STATUS Status;
760 VA_LIST Args;
761
762 VA_START (Args, Fmt);
763
764 Handle = gST->ConsoleOutHandle;
765
766 Status = gBS->HandleProtocol (
767 Handle,
768 &gEfiUgaDrawProtocolGuid,
769 (VOID **) &UgaDraw
770 );
771
772 if (EFI_ERROR (Status)) {
773 return Status;
774 }
775
776 Status = gBS->HandleProtocol (
777 Handle,
778 &gEfiSimpleTextOutProtocolGuid,
779 (VOID **) &Sto
780 );
781
782 if (EFI_ERROR (Status)) {
783 return Status;
784 }
785
786 return _IPrint (UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args);
787 }