2 BDS Lib functions which contain all the code to connect console device
4 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "InternalBdsLib.h"
19 Check if we need to save the EFI variable with "ConVarName" as name
22 @param ConVarName The name of the EFI variable.
24 @retval TRUE Set the EFI variable as NV type.
25 @retval FALSE EFI variable as NV type can be set NonNV.
37 // If the variable includes "Dev" at last, we consider
38 // it does not support NV attribute.
40 while (*Ptr
!= L
'\0') {
44 if ((*(Ptr
- 3) == 'D') && (*(Ptr
- 2) == 'e') && (*(Ptr
- 1) == 'v')) {
52 Fill console handle in System Table if there are no valid console handle in.
54 Firstly, check the validation of console handle in System Table. If it is invalid,
55 update it by the first console device handle from EFI console variable.
57 @param VarName The name of the EFI console variable.
58 @param ConsoleGuid Specified Console protocol GUID.
59 @param ConsoleHandle On IN, console handle in System Table to be checked.
60 On OUT, new console hanlde in system table.
61 @param ProtocolInterface On IN, console protocol on console handle in System Table to be checked.
62 On OUT, new console protocol on new console hanlde in system table.
65 UpdateSystemTableConsole (
67 IN EFI_GUID
*ConsoleGuid
,
68 IN OUT EFI_HANDLE
*ConsoleHandle
,
69 IN OUT VOID
**ProtocolInterface
74 EFI_DEVICE_PATH_PROTOCOL
*FullDevicePath
;
75 EFI_DEVICE_PATH_PROTOCOL
*VarConsole
;
76 EFI_DEVICE_PATH_PROTOCOL
*Instance
;
80 ASSERT (VarName
!= NULL
);
81 ASSERT (ConsoleHandle
!= NULL
);
82 ASSERT (ConsoleGuid
!= NULL
);
83 ASSERT (ProtocolInterface
!= NULL
);
85 if (*ConsoleHandle
!= NULL
) {
86 Status
= gBS
->HandleProtocol (
91 if (Status
== EFI_SUCCESS
&& Interface
== *ProtocolInterface
) {
93 // If ConsoleHandle is valid and console protocol on this handle also
94 // also matched, just return.
101 // Get all possible consoles device path from EFI variable
103 VarConsole
= BdsLibGetVariableAndSize (
105 &gEfiGlobalVariableGuid
,
108 if (VarConsole
== NULL
) {
110 // If there is no any console device, just return.
115 FullDevicePath
= VarConsole
;
119 // Check every instance of the console variable
121 Instance
= GetNextDevicePathInstance (&VarConsole
, &DevicePathSize
);
122 if (Instance
== NULL
) {
123 FreePool (FullDevicePath
);
128 // Find console device handle by device path instance
130 Status
= gBS
->LocateDevicePath (
135 if (!EFI_ERROR (Status
)) {
137 // Get the console protocol on this console device handle
139 Status
= gBS
->HandleProtocol (
144 if (!EFI_ERROR (Status
)) {
146 // Update new console handle in System Table.
148 *ConsoleHandle
= NewHandle
;
149 *ProtocolInterface
= Interface
;
154 } while (Instance
!= NULL
);
157 // No any available console devcie found.
163 This function update console variable based on ConVarName, it can
164 add or remove one specific console device path from the variable
166 @param ConVarName Console related variable name, ConIn, ConOut,
168 @param CustomizedConDevicePath The console device path which will be added to
169 the console variable ConVarName, this parameter
170 can not be multi-instance.
171 @param ExclusiveDevicePath The console device path which will be removed
172 from the console variable ConVarName, this
173 parameter can not be multi-instance.
175 @retval EFI_UNSUPPORTED The added device path is same to the removed one.
176 @retval EFI_SUCCESS Success add or remove the device path from the
182 BdsLibUpdateConsoleVariable (
183 IN CHAR16
*ConVarName
,
184 IN EFI_DEVICE_PATH_PROTOCOL
*CustomizedConDevicePath
,
185 IN EFI_DEVICE_PATH_PROTOCOL
*ExclusiveDevicePath
188 EFI_DEVICE_PATH_PROTOCOL
*VarConsole
;
189 UINTN DevicePathSize
;
190 EFI_DEVICE_PATH_PROTOCOL
*NewDevicePath
;
191 EFI_DEVICE_PATH_PROTOCOL
*TempNewDevicePath
;
198 // Notes: check the device path point, here should check
199 // with compare memory
201 if (CustomizedConDevicePath
== ExclusiveDevicePath
) {
202 return EFI_UNSUPPORTED
;
205 // Delete the ExclusiveDevicePath from current default console
207 VarConsole
= BdsLibGetVariableAndSize (
209 &gEfiGlobalVariableGuid
,
214 // Initialize NewDevicePath
216 NewDevicePath
= VarConsole
;
219 // If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.
220 // In the end, NewDevicePath is the final device path.
222 if (ExclusiveDevicePath
!= NULL
&& VarConsole
!= NULL
) {
223 NewDevicePath
= BdsLibDelPartMatchInstance (VarConsole
, ExclusiveDevicePath
);
226 // Try to append customized device path to NewDevicePath.
228 if (CustomizedConDevicePath
!= NULL
) {
229 if (!BdsLibMatchDevicePaths (NewDevicePath
, CustomizedConDevicePath
)) {
231 // Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.
233 NewDevicePath
= BdsLibDelPartMatchInstance (NewDevicePath
, CustomizedConDevicePath
);
235 // In the first check, the default console variable will be _ModuleEntryPoint,
236 // just append current customized device path
238 TempNewDevicePath
= NewDevicePath
;
239 NewDevicePath
= AppendDevicePathInstance (NewDevicePath
, CustomizedConDevicePath
);
240 if (TempNewDevicePath
!= NULL
) {
241 FreePool(TempNewDevicePath
);
247 // The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.
249 if (IsNvNeed(ConVarName
)) {
251 // ConVarName has NV attribute.
253 Attributes
= EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_NON_VOLATILE
;
256 // ConVarName does not have NV attribute.
258 Attributes
= EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
;
262 // Finally, Update the variable of the default console by NewDevicePath
266 &gEfiGlobalVariableGuid
,
268 GetDevicePathSize (NewDevicePath
),
272 if (VarConsole
== NewDevicePath
) {
273 if (VarConsole
!= NULL
) {
274 FreePool(VarConsole
);
277 if (VarConsole
!= NULL
) {
278 FreePool(VarConsole
);
280 if (NewDevicePath
!= NULL
) {
281 FreePool(NewDevicePath
);
291 Connect the console device base on the variable ConVarName, if
292 device path of the ConVarName is multi-instance device path, if
293 anyone of the instances is connected success, then this function
296 @param ConVarName Console related variable name, ConIn, ConOut,
299 @retval EFI_NOT_FOUND There is not any console devices connected
301 @retval EFI_SUCCESS Success connect any one instance of the console
302 device path base on the variable ConVarName.
307 BdsLibConnectConsoleVariable (
308 IN CHAR16
*ConVarName
312 EFI_DEVICE_PATH_PROTOCOL
*StartDevicePath
;
314 EFI_DEVICE_PATH_PROTOCOL
*Instance
;
315 EFI_DEVICE_PATH_PROTOCOL
*Next
;
316 EFI_DEVICE_PATH_PROTOCOL
*CopyOfDevicePath
;
320 Status
= EFI_SUCCESS
;
324 // Check if the console variable exist
326 StartDevicePath
= BdsLibGetVariableAndSize (
328 &gEfiGlobalVariableGuid
,
331 if (StartDevicePath
== NULL
) {
332 return EFI_UNSUPPORTED
;
335 CopyOfDevicePath
= StartDevicePath
;
338 // Check every instance of the console variable
340 Instance
= GetNextDevicePathInstance (&CopyOfDevicePath
, &Size
);
341 if (Instance
== NULL
) {
342 FreePool (StartDevicePath
);
343 return EFI_UNSUPPORTED
;
347 while (!IsDevicePathEndType (Next
)) {
348 Next
= NextDevicePathNode (Next
);
351 SetDevicePathEndNode (Next
);
353 // Check USB1.1 console
355 if ((DevicePathType (Instance
) == MESSAGING_DEVICE_PATH
) &&
356 ((DevicePathSubType (Instance
) == MSG_USB_CLASS_DP
)
357 || (DevicePathSubType (Instance
) == MSG_USB_WWID_DP
)
360 // Check the Usb console in Usb2.0 bus firstly, then Usb1.1 bus
362 Status
= BdsLibConnectUsbDevByShortFormDP (PCI_CLASSC_PI_EHCI
, Instance
);
363 if (!EFI_ERROR (Status
)) {
367 Status
= BdsLibConnectUsbDevByShortFormDP (PCI_CLASSC_PI_UHCI
, Instance
);
368 if (!EFI_ERROR (Status
)) {
373 // Connect the instance device path
375 Status
= BdsLibConnectDevicePath (Instance
);
376 if (EFI_ERROR (Status
)) {
378 // Delete the instance from the console varialbe
380 BdsLibUpdateConsoleVariable (ConVarName
, NULL
, Instance
);
386 } while (CopyOfDevicePath
!= NULL
);
388 FreePool (StartDevicePath
);
391 return EFI_NOT_FOUND
;
399 This function will search every simpletext device in current system,
400 and make every simpletext device as pertantial console device.
405 BdsLibConnectAllConsoles (
410 EFI_DEVICE_PATH_PROTOCOL
*ConDevicePath
;
412 EFI_HANDLE
*HandleBuffer
;
417 ConDevicePath
= NULL
;
420 // Update all the console variables
422 gBS
->LocateHandleBuffer (
424 &gEfiSimpleTextInProtocolGuid
,
430 for (Index
= 0; Index
< HandleCount
; Index
++) {
431 gBS
->HandleProtocol (
433 &gEfiDevicePathProtocolGuid
,
434 (VOID
**) &ConDevicePath
436 BdsLibUpdateConsoleVariable (L
"ConIn", ConDevicePath
, NULL
);
439 if (HandleBuffer
!= NULL
) {
440 FreePool(HandleBuffer
);
444 gBS
->LocateHandleBuffer (
446 &gEfiSimpleTextOutProtocolGuid
,
451 for (Index
= 0; Index
< HandleCount
; Index
++) {
452 gBS
->HandleProtocol (
454 &gEfiDevicePathProtocolGuid
,
455 (VOID
**) &ConDevicePath
457 BdsLibUpdateConsoleVariable (L
"ConOut", ConDevicePath
, NULL
);
458 BdsLibUpdateConsoleVariable (L
"ErrOut", ConDevicePath
, NULL
);
461 if (HandleBuffer
!= NULL
) {
462 FreePool(HandleBuffer
);
466 // Connect all console variables
468 BdsLibConnectAllDefaultConsoles ();
473 This function will connect console device base on the console
474 device variable ConIn, ConOut and ErrOut.
476 @retval EFI_SUCCESS At least one of the ConIn and ConOut device have
477 been connected success.
478 @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().
483 BdsLibConnectAllDefaultConsoles (
490 // Connect all default console variables
494 // It seems impossible not to have any ConOut device on platform,
495 // so we check the status here.
497 Status
= BdsLibConnectConsoleVariable (L
"ConOut");
498 if (EFI_ERROR (Status
)) {
503 // Insert the performance probe for Console Out
505 PERF_START (NULL
, "ConOut", "BDS", 1);
506 PERF_END (NULL
, "ConOut", "BDS", 0);
509 // Because possibly the platform is legacy free, in such case,
510 // ConIn devices (Serial Port and PS2 Keyboard ) does not exist,
511 // so we need not check the status.
513 BdsLibConnectConsoleVariable (L
"ConIn");
516 // The _ModuleEntryPoint err out var is legal.
518 BdsLibConnectConsoleVariable (L
"ErrOut");
521 // Fill console handles in System Table if no console device assignd.
523 UpdateSystemTableConsole (L
"ConIn", &gEfiSimpleTextInProtocolGuid
, &gST
->ConsoleInHandle
, (VOID
**) &gST
->ConIn
);
524 UpdateSystemTableConsole (L
"ConOut", &gEfiSimpleTextOutProtocolGuid
, &gST
->ConsoleOutHandle
, (VOID
**) &gST
->ConOut
);
525 UpdateSystemTableConsole (L
"ErrOut", &gEfiSimpleTextOutProtocolGuid
, &gST
->StandardErrorHandle
, (VOID
**) &gST
->StdErr
);
532 Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
533 is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
534 buffer is passed in it will be used if it is big enough.
536 @param BmpImage Pointer to BMP file
537 @param BmpImageSize Number of bytes in BmpImage
538 @param GopBlt Buffer containing GOP version of BmpImage.
539 @param GopBltSize Size of GopBlt in bytes.
540 @param PixelHeight Height of GopBlt/BmpImage in pixels
541 @param PixelWidth Width of GopBlt/BmpImage in pixels
543 @retval EFI_SUCCESS GopBlt and GopBltSize are returned.
544 @retval EFI_UNSUPPORTED BmpImage is not a valid *.BMP image
545 @retval EFI_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big enough.
546 GopBltSize will contain the required size.
547 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate.
553 IN UINTN BmpImageSize
,
554 IN OUT VOID
**GopBlt
,
555 IN OUT UINTN
*GopBltSize
,
556 OUT UINTN
*PixelHeight
,
557 OUT UINTN
*PixelWidth
562 BMP_IMAGE_HEADER
*BmpHeader
;
563 BMP_COLOR_MAP
*BmpColorMap
;
564 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BltBuffer
;
565 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
573 BmpHeader
= (BMP_IMAGE_HEADER
*) BmpImage
;
575 if (BmpHeader
->CharB
!= 'B' || BmpHeader
->CharM
!= 'M') {
576 return EFI_UNSUPPORTED
;
580 // Doesn't support compress.
582 if (BmpHeader
->CompressionType
!= 0) {
583 return EFI_UNSUPPORTED
;
587 // Calculate Color Map offset in the image.
590 BmpColorMap
= (BMP_COLOR_MAP
*) (Image
+ sizeof (BMP_IMAGE_HEADER
));
593 // Calculate graphics image data address in the image
595 Image
= ((UINT8
*) BmpImage
) + BmpHeader
->ImageOffset
;
599 // Calculate the BltBuffer needed size.
601 BltBufferSize
= BmpHeader
->PixelWidth
* BmpHeader
->PixelHeight
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
);
603 if (*GopBlt
== NULL
) {
605 // GopBlt is not allocated by caller.
607 *GopBltSize
= BltBufferSize
;
608 *GopBlt
= AllocatePool (*GopBltSize
);
610 if (*GopBlt
== NULL
) {
611 return EFI_OUT_OF_RESOURCES
;
615 // GopBlt has been allocated by caller.
617 if (*GopBltSize
< BltBufferSize
) {
618 *GopBltSize
= BltBufferSize
;
619 return EFI_BUFFER_TOO_SMALL
;
623 *PixelWidth
= BmpHeader
->PixelWidth
;
624 *PixelHeight
= BmpHeader
->PixelHeight
;
627 // Convert image from BMP to Blt buffer format
630 for (Height
= 0; Height
< BmpHeader
->PixelHeight
; Height
++) {
631 Blt
= &BltBuffer
[(BmpHeader
->PixelHeight
- Height
- 1) * BmpHeader
->PixelWidth
];
632 for (Width
= 0; Width
< BmpHeader
->PixelWidth
; Width
++, Image
++, Blt
++) {
633 switch (BmpHeader
->BitPerPixel
) {
636 // Convert 1-bit (2 colors) BMP to 24-bit color
638 for (Index
= 0; Index
< 8 && Width
< BmpHeader
->PixelWidth
; Index
++) {
639 Blt
->Red
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Red
;
640 Blt
->Green
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Green
;
641 Blt
->Blue
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Blue
;
652 // Convert 4-bit (16 colors) BMP Palette to 24-bit color
654 Index
= (*Image
) >> 4;
655 Blt
->Red
= BmpColorMap
[Index
].Red
;
656 Blt
->Green
= BmpColorMap
[Index
].Green
;
657 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
658 if (Width
< (BmpHeader
->PixelWidth
- 1)) {
661 Index
= (*Image
) & 0x0f;
662 Blt
->Red
= BmpColorMap
[Index
].Red
;
663 Blt
->Green
= BmpColorMap
[Index
].Green
;
664 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
670 // Convert 8-bit (256 colors) BMP Palette to 24-bit color
672 Blt
->Red
= BmpColorMap
[*Image
].Red
;
673 Blt
->Green
= BmpColorMap
[*Image
].Green
;
674 Blt
->Blue
= BmpColorMap
[*Image
].Blue
;
681 Blt
->Blue
= *Image
++;
682 Blt
->Green
= *Image
++;
688 // Other bit format BMP is not supported.
694 return EFI_UNSUPPORTED
;
700 ImageIndex
= (UINTN
) (Image
- ImageHeader
);
701 if ((ImageIndex
% 4) != 0) {
703 // Bmp Image starts each row on a 32-bit boundary!
705 Image
= Image
+ (4 - (ImageIndex
% 4));
714 Use Console Control Protocol to lock the Console In Spliter virtual handle.
715 This is the ConInHandle and ConIn handle in the EFI system table. All key
716 presses will be ignored until the Password is typed in. The only way to
717 disable the password is to type it in to a ConIn device.
719 @param Password Password used to lock ConIn device.
721 @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
722 @retval EFI_UNSUPPORTED Password not found
732 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
734 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
735 if (EFI_ERROR (Status
)) {
736 return EFI_UNSUPPORTED
;
739 Status
= ConsoleControl
->LockStdIn (ConsoleControl
, Password
);
745 Use Console Control to turn off UGA based Simple Text Out consoles from going
746 to the UGA device. Put up LogoFile on every UGA device that is a console
748 @param[in] LogoFile File name of logo to display on the center of the screen.
750 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
751 @retval EFI_UNSUPPORTED Logo not found
757 IN EFI_GUID
*LogoFile
761 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
762 EFI_OEM_BADGING_PROTOCOL
*Badging
;
771 EFI_BADGING_FORMAT Format
;
772 EFI_BADGING_DISPLAY_ATTRIBUTE Attribute
;
777 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
778 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
781 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
783 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
784 if (EFI_ERROR (Status
)) {
785 return EFI_UNSUPPORTED
;
790 // Try to open GOP first
792 Status
= gBS
->HandleProtocol (gST
->ConsoleOutHandle
, &gEfiGraphicsOutputProtocolGuid
, (VOID
**) &GraphicsOutput
);
793 if (EFI_ERROR (Status
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
794 GraphicsOutput
= NULL
;
796 // Open GOP failed, try to open UGA
798 Status
= gBS
->HandleProtocol (gST
->ConsoleOutHandle
, &gEfiUgaDrawProtocolGuid
, (VOID
**) &UgaDraw
);
800 if (EFI_ERROR (Status
)) {
801 return EFI_UNSUPPORTED
;
805 Status
= gBS
->LocateProtocol (&gEfiOEMBadgingProtocolGuid
, NULL
, (VOID
**) &Badging
);
808 // Set console control to graphics mode.
810 Status
= ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenGraphics
);
811 if (EFI_ERROR (Status
)) {
812 return EFI_UNSUPPORTED
;
815 if (GraphicsOutput
!= NULL
) {
816 SizeOfX
= GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
817 SizeOfY
= GraphicsOutput
->Mode
->Info
->VerticalResolution
;
819 } else if (UgaDraw
!= NULL
&& FeaturePcdGet (PcdUgaConsumeSupport
)) {
820 Status
= UgaDraw
->GetMode (UgaDraw
, &SizeOfX
, &SizeOfY
, &ColorDepth
, &RefreshRate
);
821 if (EFI_ERROR (Status
)) {
822 return EFI_UNSUPPORTED
;
825 return EFI_UNSUPPORTED
;
833 if (Badging
!= NULL
) {
835 // Get image from OEMBadging protocol.
837 Status
= Badging
->GetImage (
847 if (EFI_ERROR (Status
)) {
852 // Currently only support BMP format.
854 if (Format
!= EfiBadgingFormatBMP
) {
855 if (ImageData
!= NULL
) {
856 FreePool (ImageData
);
862 // Get the specified image from FV.
864 Status
= GetSectionFromAnyFv (LogoFile
, EFI_SECTION_RAW
, 0, (VOID
**) &ImageData
, &ImageSize
);
865 if (EFI_ERROR (Status
)) {
866 return EFI_UNSUPPORTED
;
871 Attribute
= EfiBadgingDisplayAttributeCenter
;
875 Status
= ConvertBmpToGopBlt (
883 if (EFI_ERROR (Status
)) {
884 FreePool (ImageData
);
886 if (Badging
== NULL
) {
894 // Calculate the display position according to Attribute.
897 case EfiBadgingDisplayAttributeLeftTop
:
902 case EfiBadgingDisplayAttributeCenterTop
:
903 DestX
= (SizeOfX
- Width
) / 2;
907 case EfiBadgingDisplayAttributeRightTop
:
908 DestX
= (SizeOfX
- Width
- CoordinateX
);
909 DestY
= CoordinateY
;;
912 case EfiBadgingDisplayAttributeCenterRight
:
913 DestX
= (SizeOfX
- Width
- CoordinateX
);
914 DestY
= (SizeOfY
- Height
) / 2;
917 case EfiBadgingDisplayAttributeRightBottom
:
918 DestX
= (SizeOfX
- Width
- CoordinateX
);
919 DestY
= (SizeOfY
- Height
- CoordinateY
);
922 case EfiBadgingDisplayAttributeCenterBottom
:
923 DestX
= (SizeOfX
- Width
) / 2;
924 DestY
= (SizeOfY
- Height
- CoordinateY
);
927 case EfiBadgingDisplayAttributeLeftBottom
:
929 DestY
= (SizeOfY
- Height
- CoordinateY
);
932 case EfiBadgingDisplayAttributeCenterLeft
:
934 DestY
= (SizeOfY
- Height
) / 2;
937 case EfiBadgingDisplayAttributeCenter
:
938 DestX
= (SizeOfX
- Width
) / 2;
939 DestY
= (SizeOfY
- Height
) / 2;
948 if ((DestX
>= 0) && (DestY
>= 0)) {
949 if (GraphicsOutput
!= NULL
) {
950 Status
= GraphicsOutput
->Blt (
960 Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
962 } else if (UgaDraw
!= NULL
&& FeaturePcdGet (PcdUgaConsumeSupport
)) {
963 Status
= UgaDraw
->Blt (
965 (EFI_UGA_PIXEL
*) Blt
,
966 EfiUgaBltBufferToVideo
,
973 Width
* sizeof (EFI_UGA_PIXEL
)
976 Status
= EFI_UNSUPPORTED
;
980 FreePool (ImageData
);
986 if (Badging
== NULL
) {
995 Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
996 Simple Text Out screens will now be synced up with all non UGA output devices
998 @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
1008 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
1010 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
1011 if (EFI_ERROR (Status
)) {
1012 return EFI_UNSUPPORTED
;
1016 // Set console control to text mode.
1018 return ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenText
);