2 BDS Lib functions which contain all the code to connect console device
4 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
5 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
21 If ConVarName is NULL, then ASSERT().
23 @param ConVarName The name of the EFI variable.
25 @retval TRUE Set the EFI variable as NV type.
26 @retval FALSE EFI variable as NV type can be set NonNV.
35 ASSERT (ConVarName
!= NULL
);
40 // If the variable includes "Dev" at last, we consider
41 // it does not support NV attribute.
43 while (*Ptr
!= L
'\0') {
47 if (((INTN
)((UINTN
)Ptr
- (UINTN
)ConVarName
) / sizeof (CHAR16
)) <= 3) {
51 if ((*(Ptr
- 3) == 'D') && (*(Ptr
- 2) == 'e') && (*(Ptr
- 1) == 'v')) {
59 Fill console handle in System Table if there are no valid console handle in.
61 Firstly, check the validation of console handle in System Table. If it is invalid,
62 update it by the first console device handle from EFI console variable.
64 @param VarName The name of the EFI console variable.
65 @param ConsoleGuid Specified Console protocol GUID.
66 @param ConsoleHandle On IN, console handle in System Table to be checked.
67 On OUT, new console hanlde in system table.
68 @param ProtocolInterface On IN, console protocol on console handle in System Table to be checked.
69 On OUT, new console protocol on new console hanlde in system table.
71 @retval TRUE System Table has been updated.
72 @retval FALSE System Table hasn't been updated.
76 UpdateSystemTableConsole (
78 IN EFI_GUID
*ConsoleGuid
,
79 IN OUT EFI_HANDLE
*ConsoleHandle
,
80 IN OUT VOID
**ProtocolInterface
85 EFI_DEVICE_PATH_PROTOCOL
*FullDevicePath
;
86 EFI_DEVICE_PATH_PROTOCOL
*VarConsole
;
87 EFI_DEVICE_PATH_PROTOCOL
*Instance
;
91 ASSERT (VarName
!= NULL
);
92 ASSERT (ConsoleHandle
!= NULL
);
93 ASSERT (ConsoleGuid
!= NULL
);
94 ASSERT (ProtocolInterface
!= NULL
);
96 if (*ConsoleHandle
!= NULL
) {
97 Status
= gBS
->HandleProtocol (
102 if (Status
== EFI_SUCCESS
&& Interface
== *ProtocolInterface
) {
104 // If ConsoleHandle is valid and console protocol on this handle also
105 // also matched, just return.
112 // Get all possible consoles device path from EFI variable
114 VarConsole
= BdsLibGetVariableAndSize (
116 &gEfiGlobalVariableGuid
,
119 if (VarConsole
== NULL
) {
121 // If there is no any console device, just return.
126 FullDevicePath
= VarConsole
;
130 // Check every instance of the console variable
132 Instance
= GetNextDevicePathInstance (&VarConsole
, &DevicePathSize
);
133 if (Instance
== NULL
) {
134 FreePool (FullDevicePath
);
139 // Find console device handle by device path instance
141 Status
= gBS
->LocateDevicePath (
146 if (!EFI_ERROR (Status
)) {
148 // Get the console protocol on this console device handle
150 Status
= gBS
->HandleProtocol (
155 if (!EFI_ERROR (Status
)) {
157 // Update new console handle in System Table.
159 *ConsoleHandle
= NewHandle
;
160 *ProtocolInterface
= Interface
;
165 } while (Instance
!= NULL
);
168 // No any available console devcie found.
174 This function update console variable based on ConVarName, it can
175 add or remove one specific console device path from the variable
177 @param ConVarName Console related variable name, ConIn, ConOut,
179 @param CustomizedConDevicePath The console device path which will be added to
180 the console variable ConVarName, this parameter
181 can not be multi-instance.
182 @param ExclusiveDevicePath The console device path which will be removed
183 from the console variable ConVarName, this
184 parameter can not be multi-instance.
186 @retval EFI_UNSUPPORTED The added device path is same to the removed one.
187 @retval EFI_SUCCESS Success add or remove the device path from the
193 BdsLibUpdateConsoleVariable (
194 IN CHAR16
*ConVarName
,
195 IN EFI_DEVICE_PATH_PROTOCOL
*CustomizedConDevicePath
,
196 IN EFI_DEVICE_PATH_PROTOCOL
*ExclusiveDevicePath
200 EFI_DEVICE_PATH_PROTOCOL
*VarConsole
;
201 UINTN DevicePathSize
;
202 EFI_DEVICE_PATH_PROTOCOL
*NewDevicePath
;
203 EFI_DEVICE_PATH_PROTOCOL
*TempNewDevicePath
;
210 // Notes: check the device path point, here should check
211 // with compare memory
213 if (CustomizedConDevicePath
== ExclusiveDevicePath
) {
214 return EFI_UNSUPPORTED
;
217 // Delete the ExclusiveDevicePath from current default console
219 VarConsole
= BdsLibGetVariableAndSize (
221 &gEfiGlobalVariableGuid
,
226 // Initialize NewDevicePath
228 NewDevicePath
= VarConsole
;
231 // If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.
232 // In the end, NewDevicePath is the final device path.
234 if (ExclusiveDevicePath
!= NULL
&& VarConsole
!= NULL
) {
235 NewDevicePath
= BdsLibDelPartMatchInstance (VarConsole
, ExclusiveDevicePath
);
238 // Try to append customized device path to NewDevicePath.
240 if (CustomizedConDevicePath
!= NULL
) {
241 if (!BdsLibMatchDevicePaths (NewDevicePath
, CustomizedConDevicePath
)) {
243 // Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.
245 NewDevicePath
= BdsLibDelPartMatchInstance (NewDevicePath
, CustomizedConDevicePath
);
247 // In the first check, the default console variable will be _ModuleEntryPoint,
248 // just append current customized device path
250 TempNewDevicePath
= NewDevicePath
;
251 NewDevicePath
= AppendDevicePathInstance (NewDevicePath
, CustomizedConDevicePath
);
252 if (TempNewDevicePath
!= NULL
) {
253 FreePool(TempNewDevicePath
);
259 // The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.
261 if (IsNvNeed(ConVarName
)) {
263 // ConVarName has NV attribute.
265 Attributes
= EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_NON_VOLATILE
;
268 // ConVarName does not have NV attribute.
270 Attributes
= EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
;
274 // Finally, Update the variable of the default console by NewDevicePath
276 Status
= gRT
->SetVariable (
278 &gEfiGlobalVariableGuid
,
280 GetDevicePathSize (NewDevicePath
),
283 ASSERT_EFI_ERROR (Status
);
285 if (VarConsole
== NewDevicePath
) {
286 if (VarConsole
!= NULL
) {
287 FreePool(VarConsole
);
290 if (VarConsole
!= NULL
) {
291 FreePool(VarConsole
);
293 if (NewDevicePath
!= NULL
) {
294 FreePool(NewDevicePath
);
304 Connect the console device base on the variable ConVarName, if
305 device path of the ConVarName is multi-instance device path, if
306 anyone of the instances is connected success, then this function
309 @param ConVarName Console related variable name, ConIn, ConOut,
312 @retval EFI_NOT_FOUND There is not any console devices connected
314 @retval EFI_SUCCESS Success connect any one instance of the console
315 device path base on the variable ConVarName.
320 BdsLibConnectConsoleVariable (
321 IN CHAR16
*ConVarName
325 EFI_DEVICE_PATH_PROTOCOL
*StartDevicePath
;
327 EFI_DEVICE_PATH_PROTOCOL
*Instance
;
328 EFI_DEVICE_PATH_PROTOCOL
*Next
;
329 EFI_DEVICE_PATH_PROTOCOL
*CopyOfDevicePath
;
333 Status
= EFI_SUCCESS
;
337 // Check if the console variable exist
339 StartDevicePath
= BdsLibGetVariableAndSize (
341 &gEfiGlobalVariableGuid
,
344 if (StartDevicePath
== NULL
) {
345 return EFI_UNSUPPORTED
;
348 CopyOfDevicePath
= StartDevicePath
;
351 // Check every instance of the console variable
353 Instance
= GetNextDevicePathInstance (&CopyOfDevicePath
, &Size
);
354 if (Instance
== NULL
) {
355 FreePool (StartDevicePath
);
356 return EFI_UNSUPPORTED
;
360 while (!IsDevicePathEndType (Next
)) {
361 Next
= NextDevicePathNode (Next
);
364 SetDevicePathEndNode (Next
);
366 // Connect the USB console
367 // USB console device path is a short-form device path that
368 // starts with the first element being a USB WWID
369 // or a USB Class device path
371 if ((DevicePathType (Instance
) == MESSAGING_DEVICE_PATH
) &&
372 ((DevicePathSubType (Instance
) == MSG_USB_CLASS_DP
)
373 || (DevicePathSubType (Instance
) == MSG_USB_WWID_DP
)
375 Status
= BdsLibConnectUsbDevByShortFormDP (0xFF, Instance
);
376 if (!EFI_ERROR (Status
)) {
381 // Connect the instance device path
383 Status
= BdsLibConnectDevicePath (Instance
);
384 if (EFI_ERROR (Status
)) {
386 // Delete the instance from the console varialbe
388 BdsLibUpdateConsoleVariable (ConVarName
, NULL
, Instance
);
394 } while (CopyOfDevicePath
!= NULL
);
396 FreePool (StartDevicePath
);
399 return EFI_NOT_FOUND
;
407 This function will search every simpletext device in current system,
408 and make every simpletext device as pertantial console device.
413 BdsLibConnectAllConsoles (
418 EFI_DEVICE_PATH_PROTOCOL
*ConDevicePath
;
420 EFI_HANDLE
*HandleBuffer
;
425 ConDevicePath
= NULL
;
428 // Update all the console variables
430 gBS
->LocateHandleBuffer (
432 &gEfiSimpleTextInProtocolGuid
,
438 for (Index
= 0; Index
< HandleCount
; Index
++) {
439 gBS
->HandleProtocol (
441 &gEfiDevicePathProtocolGuid
,
442 (VOID
**) &ConDevicePath
444 BdsLibUpdateConsoleVariable (L
"ConIn", ConDevicePath
, NULL
);
447 if (HandleBuffer
!= NULL
) {
448 FreePool(HandleBuffer
);
452 gBS
->LocateHandleBuffer (
454 &gEfiSimpleTextOutProtocolGuid
,
459 for (Index
= 0; Index
< HandleCount
; Index
++) {
460 gBS
->HandleProtocol (
462 &gEfiDevicePathProtocolGuid
,
463 (VOID
**) &ConDevicePath
465 BdsLibUpdateConsoleVariable (L
"ConOut", ConDevicePath
, NULL
);
466 BdsLibUpdateConsoleVariable (L
"ErrOut", ConDevicePath
, NULL
);
469 if (HandleBuffer
!= NULL
) {
470 FreePool(HandleBuffer
);
474 // Connect all console variables
476 BdsLibConnectAllDefaultConsoles ();
481 This function will connect console device base on the console
482 device variable ConIn, ConOut and ErrOut.
484 @retval EFI_SUCCESS At least one of the ConIn and ConOut device have
485 been connected success.
486 @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().
491 BdsLibConnectAllDefaultConsoles (
496 BOOLEAN SystemTableUpdated
;
499 // Connect all default console variables
503 // It seems impossible not to have any ConOut device on platform,
504 // so we check the status here.
506 Status
= BdsLibConnectConsoleVariable (L
"ConOut");
507 if (EFI_ERROR (Status
)) {
512 // Insert the performance probe for Console Out
514 PERF_START (NULL
, "ConOut", "BDS", 1);
515 PERF_END (NULL
, "ConOut", "BDS", 0);
518 // Because possibly the platform is legacy free, in such case,
519 // ConIn devices (Serial Port and PS2 Keyboard ) does not exist,
520 // so we need not check the status.
522 BdsLibConnectConsoleVariable (L
"ConIn");
525 // The _ModuleEntryPoint err out var is legal.
527 BdsLibConnectConsoleVariable (L
"ErrOut");
529 SystemTableUpdated
= FALSE
;
531 // Fill console handles in System Table if no console device assignd.
533 if (UpdateSystemTableConsole (L
"ConIn", &gEfiSimpleTextInProtocolGuid
, &gST
->ConsoleInHandle
, (VOID
**) &gST
->ConIn
)) {
534 SystemTableUpdated
= TRUE
;
536 if (UpdateSystemTableConsole (L
"ConOut", &gEfiSimpleTextOutProtocolGuid
, &gST
->ConsoleOutHandle
, (VOID
**) &gST
->ConOut
)) {
537 SystemTableUpdated
= TRUE
;
539 if (UpdateSystemTableConsole (L
"ErrOut", &gEfiSimpleTextOutProtocolGuid
, &gST
->StandardErrorHandle
, (VOID
**) &gST
->StdErr
)) {
540 SystemTableUpdated
= TRUE
;
543 if (SystemTableUpdated
) {
545 // Update the CRC32 in the EFI System Table header
548 gBS
->CalculateCrc32 (
560 Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
561 is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
562 buffer is passed in it will be used if it is big enough.
564 @param BmpImage Pointer to BMP file
565 @param BmpImageSize Number of bytes in BmpImage
566 @param GopBlt Buffer containing GOP version of BmpImage.
567 @param GopBltSize Size of GopBlt in bytes.
568 @param PixelHeight Height of GopBlt/BmpImage in pixels
569 @param PixelWidth Width of GopBlt/BmpImage in pixels
571 @retval EFI_SUCCESS GopBlt and GopBltSize are returned.
572 @retval EFI_UNSUPPORTED BmpImage is not a valid *.BMP image
573 @retval EFI_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big enough.
574 GopBltSize will contain the required size.
575 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate.
581 IN UINTN BmpImageSize
,
582 IN OUT VOID
**GopBlt
,
583 IN OUT UINTN
*GopBltSize
,
584 OUT UINTN
*PixelHeight
,
585 OUT UINTN
*PixelWidth
590 BMP_IMAGE_HEADER
*BmpHeader
;
591 BMP_COLOR_MAP
*BmpColorMap
;
592 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BltBuffer
;
593 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
594 UINT64 BltBufferSize
;
601 BmpHeader
= (BMP_IMAGE_HEADER
*) BmpImage
;
603 if (BmpHeader
->CharB
!= 'B' || BmpHeader
->CharM
!= 'M') {
604 return EFI_UNSUPPORTED
;
608 // Doesn't support compress.
610 if (BmpHeader
->CompressionType
!= 0) {
611 return EFI_UNSUPPORTED
;
615 // Calculate Color Map offset in the image.
618 BmpColorMap
= (BMP_COLOR_MAP
*) (Image
+ sizeof (BMP_IMAGE_HEADER
));
621 // Calculate graphics image data address in the image
623 Image
= ((UINT8
*) BmpImage
) + BmpHeader
->ImageOffset
;
627 // Calculate the BltBuffer needed size.
629 BltBufferSize
= MultU64x32 ((UINT64
) BmpHeader
->PixelWidth
, BmpHeader
->PixelHeight
);
631 // Ensure the BltBufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow
633 if (BltBufferSize
> DivU64x32 ((UINTN
) ~0, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
))) {
634 return EFI_UNSUPPORTED
;
636 BltBufferSize
= MultU64x32 (BltBufferSize
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
639 if (*GopBlt
== NULL
) {
641 // GopBlt is not allocated by caller.
643 *GopBltSize
= (UINTN
) BltBufferSize
;
644 *GopBlt
= AllocatePool (*GopBltSize
);
646 if (*GopBlt
== NULL
) {
647 return EFI_OUT_OF_RESOURCES
;
651 // GopBlt has been allocated by caller.
653 if (*GopBltSize
< (UINTN
) BltBufferSize
) {
654 *GopBltSize
= (UINTN
) BltBufferSize
;
655 return EFI_BUFFER_TOO_SMALL
;
659 *PixelWidth
= BmpHeader
->PixelWidth
;
660 *PixelHeight
= BmpHeader
->PixelHeight
;
663 // Convert image from BMP to Blt buffer format
666 for (Height
= 0; Height
< BmpHeader
->PixelHeight
; Height
++) {
667 Blt
= &BltBuffer
[(BmpHeader
->PixelHeight
- Height
- 1) * BmpHeader
->PixelWidth
];
668 for (Width
= 0; Width
< BmpHeader
->PixelWidth
; Width
++, Image
++, Blt
++) {
669 switch (BmpHeader
->BitPerPixel
) {
672 // Convert 1-bit (2 colors) BMP to 24-bit color
674 for (Index
= 0; Index
< 8 && Width
< BmpHeader
->PixelWidth
; Index
++) {
675 Blt
->Red
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Red
;
676 Blt
->Green
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Green
;
677 Blt
->Blue
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Blue
;
688 // Convert 4-bit (16 colors) BMP Palette to 24-bit color
690 Index
= (*Image
) >> 4;
691 Blt
->Red
= BmpColorMap
[Index
].Red
;
692 Blt
->Green
= BmpColorMap
[Index
].Green
;
693 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
694 if (Width
< (BmpHeader
->PixelWidth
- 1)) {
697 Index
= (*Image
) & 0x0f;
698 Blt
->Red
= BmpColorMap
[Index
].Red
;
699 Blt
->Green
= BmpColorMap
[Index
].Green
;
700 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
706 // Convert 8-bit (256 colors) BMP Palette to 24-bit color
708 Blt
->Red
= BmpColorMap
[*Image
].Red
;
709 Blt
->Green
= BmpColorMap
[*Image
].Green
;
710 Blt
->Blue
= BmpColorMap
[*Image
].Blue
;
717 Blt
->Blue
= *Image
++;
718 Blt
->Green
= *Image
++;
724 // Other bit format BMP is not supported.
730 return EFI_UNSUPPORTED
;
736 ImageIndex
= (UINTN
) (Image
- ImageHeader
);
737 if ((ImageIndex
% 4) != 0) {
739 // Bmp Image starts each row on a 32-bit boundary!
741 Image
= Image
+ (4 - (ImageIndex
% 4));
749 Use SystemTable Conout to stop video based Simple Text Out consoles from going
750 to the video device. Put up LogoFile on every video device that is a console.
752 @param[in] LogoFile File name of logo to display on the center of the screen.
754 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
755 @retval EFI_UNSUPPORTED Logo not found
761 IN EFI_GUID
*LogoFile
765 EFI_OEM_BADGING_PROTOCOL
*Badging
;
774 EFI_BADGING_FORMAT Format
;
775 EFI_BADGING_DISPLAY_ATTRIBUTE Attribute
;
780 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
781 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
784 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
788 // Try to open GOP first
790 Status
= gBS
->HandleProtocol (gST
->ConsoleOutHandle
, &gEfiGraphicsOutputProtocolGuid
, (VOID
**) &GraphicsOutput
);
791 if (EFI_ERROR (Status
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
792 GraphicsOutput
= NULL
;
794 // Open GOP failed, try to open UGA
796 Status
= gBS
->HandleProtocol (gST
->ConsoleOutHandle
, &gEfiUgaDrawProtocolGuid
, (VOID
**) &UgaDraw
);
798 if (EFI_ERROR (Status
)) {
799 return EFI_UNSUPPORTED
;
803 // Erase Cursor from screen
805 gST
->ConOut
->EnableCursor (gST
->ConOut
, FALSE
);
808 Status
= gBS
->LocateProtocol (&gEfiOEMBadgingProtocolGuid
, NULL
, (VOID
**) &Badging
);
810 if (GraphicsOutput
!= NULL
) {
811 SizeOfX
= GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
812 SizeOfY
= GraphicsOutput
->Mode
->Info
->VerticalResolution
;
814 } else if (UgaDraw
!= NULL
&& FeaturePcdGet (PcdUgaConsumeSupport
)) {
815 Status
= UgaDraw
->GetMode (UgaDraw
, &SizeOfX
, &SizeOfY
, &ColorDepth
, &RefreshRate
);
816 if (EFI_ERROR (Status
)) {
817 return EFI_UNSUPPORTED
;
820 return EFI_UNSUPPORTED
;
828 if (Badging
!= NULL
) {
830 // Get image from OEMBadging protocol.
832 Status
= Badging
->GetImage (
842 if (EFI_ERROR (Status
)) {
847 // Currently only support BMP format.
849 if (Format
!= EfiBadgingFormatBMP
) {
850 if (ImageData
!= NULL
) {
851 FreePool (ImageData
);
857 // Get the specified image from FV.
859 Status
= GetSectionFromAnyFv (LogoFile
, EFI_SECTION_RAW
, 0, (VOID
**) &ImageData
, &ImageSize
);
860 if (EFI_ERROR (Status
)) {
861 return EFI_UNSUPPORTED
;
866 Attribute
= EfiBadgingDisplayAttributeCenter
;
870 Status
= ConvertBmpToGopBlt (
878 if (EFI_ERROR (Status
)) {
879 FreePool (ImageData
);
881 if (Badging
== NULL
) {
889 // Calculate the display position according to Attribute.
892 case EfiBadgingDisplayAttributeLeftTop
:
897 case EfiBadgingDisplayAttributeCenterTop
:
898 DestX
= (SizeOfX
- Width
) / 2;
902 case EfiBadgingDisplayAttributeRightTop
:
903 DestX
= (SizeOfX
- Width
- CoordinateX
);
904 DestY
= CoordinateY
;;
907 case EfiBadgingDisplayAttributeCenterRight
:
908 DestX
= (SizeOfX
- Width
- CoordinateX
);
909 DestY
= (SizeOfY
- Height
) / 2;
912 case EfiBadgingDisplayAttributeRightBottom
:
913 DestX
= (SizeOfX
- Width
- CoordinateX
);
914 DestY
= (SizeOfY
- Height
- CoordinateY
);
917 case EfiBadgingDisplayAttributeCenterBottom
:
918 DestX
= (SizeOfX
- Width
) / 2;
919 DestY
= (SizeOfY
- Height
- CoordinateY
);
922 case EfiBadgingDisplayAttributeLeftBottom
:
924 DestY
= (SizeOfY
- Height
- CoordinateY
);
927 case EfiBadgingDisplayAttributeCenterLeft
:
929 DestY
= (SizeOfY
- Height
) / 2;
932 case EfiBadgingDisplayAttributeCenter
:
933 DestX
= (SizeOfX
- Width
) / 2;
934 DestY
= (SizeOfY
- Height
) / 2;
943 if ((DestX
>= 0) && (DestY
>= 0)) {
944 if (GraphicsOutput
!= NULL
) {
945 Status
= GraphicsOutput
->Blt (
955 Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
957 } else if (UgaDraw
!= NULL
&& FeaturePcdGet (PcdUgaConsumeSupport
)) {
958 Status
= UgaDraw
->Blt (
960 (EFI_UGA_PIXEL
*) Blt
,
961 EfiUgaBltBufferToVideo
,
968 Width
* sizeof (EFI_UGA_PIXEL
)
971 Status
= EFI_UNSUPPORTED
;
975 FreePool (ImageData
);
981 if (Badging
== NULL
) {
990 Use SystemTable Conout to turn on video based Simple Text Out consoles. The
991 Simple Text Out screens will now be synced up with all non video output devices
993 @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
1004 // Enable Cursor on Screen
1006 gST
->ConOut
->EnableCursor (gST
->ConOut
, TRUE
);