2 This is the main routine for initializing the Graphics Console support routines.
4 Add all standard Glyphs from UEFI 2.0 Specification
5 Implement optimal automatic Mode creation algorithm
6 Solve palette issues for mixed graphics and text
7 When does this protocol reset the palette?
9 Copyright (c) 2006 - 2007 Intel Corporation. <BR>
10 All rights reserved. This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include "GraphicsConsole.h"
25 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
26 OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Foreground
,
27 OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Background
32 DrawUnicodeWeightAtCursorN (
33 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
34 IN CHAR16
*UnicodeWeight
,
41 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
46 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
,
47 IN UINT32 HorizontalResolution
,
48 IN UINT32 VerticalResolution
,
49 OUT UINT32
*CurrentModeNumber
55 GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate
= {
56 GRAPHICS_CONSOLE_DEV_SIGNATURE
,
57 (EFI_GRAPHICS_OUTPUT_PROTOCOL
*) NULL
,
58 (EFI_UGA_DRAW_PROTOCOL
*) NULL
,
60 GraphicsConsoleConOutReset
,
61 GraphicsConsoleConOutOutputString
,
62 GraphicsConsoleConOutTestString
,
63 GraphicsConsoleConOutQueryMode
,
64 GraphicsConsoleConOutSetMode
,
65 GraphicsConsoleConOutSetAttribute
,
66 GraphicsConsoleConOutClearScreen
,
67 GraphicsConsoleConOutSetCursorPosition
,
68 GraphicsConsoleConOutEnableCursor
,
69 (EFI_SIMPLE_TEXT_OUTPUT_MODE
*) NULL
74 EFI_TEXT_ATTR(EFI_LIGHTGRAY
, EFI_BLACK
),
80 { 80, 25, 0, 0, 0, 0 }, // Mode 0
81 { 80, 50, 0, 0, 0, 0 }, // Mode 1
82 { 100,31, 0, 0, 0, 0 }, // Mode 2
83 { 0, 0, 0, 0, 0, 0 } // Mode 3
85 (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*) NULL
,
89 EFI_HII_PROTOCOL
*mHii
;
91 static CHAR16 mCrLfString
[3] = { CHAR_CARRIAGE_RETURN
, CHAR_LINEFEED
, CHAR_NULL
};
93 static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors
[16] = {
97 {0x00, 0x00, 0x00, 0x00}, // BLACK
98 {0x98, 0x00, 0x00, 0x00}, // BLUE
99 {0x00, 0x98, 0x00, 0x00}, // GREEN
100 {0x98, 0x98, 0x00, 0x00}, // CYAN
101 {0x00, 0x00, 0x98, 0x00}, // RED
102 {0x98, 0x00, 0x98, 0x00}, // MAGENTA
103 {0x00, 0x98, 0x98, 0x00}, // BROWN
104 {0x98, 0x98, 0x98, 0x00}, // LIGHTGRAY
105 {0x30, 0x30, 0x30, 0x00}, // DARKGRAY - BRIGHT BLACK
106 {0xff, 0x00, 0x00, 0x00}, // LIGHTBLUE - ?
107 {0x00, 0xff, 0x00, 0x00}, // LIGHTGREEN - ?
108 {0xff, 0xff, 0x00, 0x00}, // LIGHTCYAN
109 {0x00, 0x00, 0xff, 0x00}, // LIGHTRED
110 {0xff, 0x00, 0xff, 0x00}, // LIGHTMAGENTA
111 {0x00, 0xff, 0xff, 0x00}, // LIGHTBROWN
112 {0xff, 0xff, 0xff, 0x00} // WHITE
115 static EFI_NARROW_GLYPH mCursorGlyph
= {
118 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF }
121 EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding
= {
122 GraphicsConsoleControllerDriverSupported
,
123 GraphicsConsoleControllerDriverStart
,
124 GraphicsConsoleControllerDriverStop
,
132 GraphicsConsoleControllerDriverSupported (
133 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
134 IN EFI_HANDLE Controller
,
135 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
139 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
140 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
141 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
145 // Open the IO Abstraction(s) needed to perform the supported test
147 Status
= gBS
->OpenProtocol (
149 &gEfiGraphicsOutputProtocolGuid
,
150 (VOID
**) &GraphicsOutput
,
151 This
->DriverBindingHandle
,
153 EFI_OPEN_PROTOCOL_BY_DRIVER
156 if (EFI_ERROR (Status
)) {
157 GraphicsOutput
= NULL
;
159 // Open Graphics Output Protocol failed, try to open UGA Draw Protocol
161 Status
= gBS
->OpenProtocol (
163 &gEfiUgaDrawProtocolGuid
,
165 This
->DriverBindingHandle
,
167 EFI_OPEN_PROTOCOL_BY_DRIVER
169 if (EFI_ERROR (Status
)) {
175 // We need to ensure that we do not layer on top of a virtual handle.
176 // We need to ensure that the handles produced by the conspliter do not
179 Status
= gBS
->OpenProtocol (
181 &gEfiDevicePathProtocolGuid
,
182 (VOID
**) &DevicePath
,
183 This
->DriverBindingHandle
,
185 EFI_OPEN_PROTOCOL_BY_DRIVER
187 if (!EFI_ERROR (Status
)) {
190 &gEfiDevicePathProtocolGuid
,
191 This
->DriverBindingHandle
,
198 // Does Hii Exist? If not, we aren't ready to run
200 Status
= EfiLocateHiiProtocol ();
203 // Close the I/O Abstraction(s) used to perform the supported test
206 if (GraphicsOutput
!= NULL
) {
209 &gEfiGraphicsOutputProtocolGuid
,
210 This
->DriverBindingHandle
,
216 &gEfiUgaDrawProtocolGuid
,
217 This
->DriverBindingHandle
,
226 GraphicsConsoleControllerDriverStart (
227 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
228 IN EFI_HANDLE Controller
,
229 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
235 Start the controller.
239 This - A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
240 Controller - The handle of the controller to start.
241 RemainingDevicePath - A pointer to the remaining portion of a devcie path.
245 EFI_SUCCESS - Return successfully.
246 EFI_OUT_OF_RESOURCES - Out of resources.
251 GRAPHICS_CONSOLE_DEV
*Private
;
252 EFI_HII_PACKAGES
*Package
;
253 EFI_HII_FONT_PACK
*FontPack
;
254 UINTN NarrowFontSize
;
255 UINT32 HorizontalResolution
;
256 UINT32 VerticalResolution
;
268 // Initialize the Graphics Console device instance
270 Private
= AllocateCopyPool (
271 sizeof (GRAPHICS_CONSOLE_DEV
),
272 &mGraphicsConsoleDevTemplate
274 if (Private
== NULL
) {
275 return EFI_OUT_OF_RESOURCES
;
278 Private
->SimpleTextOutput
.Mode
= &(Private
->SimpleTextOutputMode
);
280 Status
= gBS
->OpenProtocol (
282 &gEfiGraphicsOutputProtocolGuid
,
283 (VOID
**) &Private
->GraphicsOutput
,
284 This
->DriverBindingHandle
,
286 EFI_OPEN_PROTOCOL_BY_DRIVER
288 if (EFI_ERROR(Status
)) {
289 Private
->GraphicsOutput
= NULL
;
291 Status
= gBS
->OpenProtocol (
293 &gEfiUgaDrawProtocolGuid
,
294 (VOID
**) &Private
->UgaDraw
,
295 This
->DriverBindingHandle
,
297 EFI_OPEN_PROTOCOL_BY_DRIVER
299 if (EFI_ERROR (Status
)) {
305 // Get the HII protocol. If Supported() succeeds, do we really
306 // need to get HII protocol again?
308 Status
= EfiLocateHiiProtocol ();
309 if (EFI_ERROR (Status
)) {
313 NarrowFontSize
= ReturnNarrowFontSize ();
315 FontPack
= AllocateZeroPool (sizeof (EFI_HII_FONT_PACK
) + NarrowFontSize
);
318 FontPack
->Header
.Length
= (UINT32
) (sizeof (EFI_HII_FONT_PACK
) + NarrowFontSize
);
319 FontPack
->Header
.Type
= EFI_HII_FONT
;
320 FontPack
->NumberOfNarrowGlyphs
= (UINT16
) (NarrowFontSize
/ sizeof (EFI_NARROW_GLYPH
));
322 Location
= (UINT8
*) (&FontPack
->NumberOfWideGlyphs
+ sizeof (UINT8
));
323 CopyMem (Location
, UsStdNarrowGlyphData
, NarrowFontSize
);
326 // Register our Fonts into the global database
328 Package
= PreparePackages (1, NULL
, FontPack
);
329 mHii
->NewPack (mHii
, Package
, &(Private
->HiiHandle
));
333 // Free the font database
338 // If the current mode information can not be retrieved, then attemp to set the default mode
339 // of 800x600, 32 bit colot, 60 Hz refresh.
341 HorizontalResolution
= 800;
342 VerticalResolution
= 600;
344 if (Private
->GraphicsOutput
!= NULL
) {
346 // The console is build on top of Graphics Output Protocol, find the mode number
347 // for the user-defined mode; if there are multiple video devices,
348 // graphic console driver will set all the video devices to the same mode.
350 Status
= CheckModeSupported (
351 Private
->GraphicsOutput
,
352 CURRENT_HORIZONTAL_RESOLUTION
,
353 CURRENT_VERTICAL_RESOLUTION
,
356 if (!EFI_ERROR(Status
)) {
358 // Update default mode to current mode
360 HorizontalResolution
= CURRENT_HORIZONTAL_RESOLUTION
;
361 VerticalResolution
= CURRENT_VERTICAL_RESOLUTION
;
364 // if not supporting current mode, try 800x600 which is required by UEFI/EFI spec
366 Status
= CheckModeSupported (
367 Private
->GraphicsOutput
,
374 if (EFI_ERROR (Status
) || (ModeNumber
== Private
->GraphicsOutput
->Mode
->MaxMode
)) {
376 // Set default mode failed or device don't support default mode, then get the current mode information
378 HorizontalResolution
= Private
->GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
379 VerticalResolution
= Private
->GraphicsOutput
->Mode
->Info
->VerticalResolution
;
380 ModeNumber
= Private
->GraphicsOutput
->Mode
->Mode
;
384 // At first try to set user-defined resolution
388 Status
= Private
->UgaDraw
->SetMode (
390 CURRENT_HORIZONTAL_RESOLUTION
,
391 CURRENT_VERTICAL_RESOLUTION
,
395 if (!EFI_ERROR (Status
)) {
396 HorizontalResolution
= CURRENT_HORIZONTAL_RESOLUTION
;
397 VerticalResolution
= CURRENT_VERTICAL_RESOLUTION
;
400 // Try to set 800*600 which is required by UEFI/EFI spec
402 Status
= Private
->UgaDraw
->SetMode (
404 HorizontalResolution
,
409 if (EFI_ERROR (Status
)) {
410 Status
= Private
->UgaDraw
->GetMode (
412 &HorizontalResolution
,
417 if (EFI_ERROR (Status
)) {
425 // Compute the maximum number of text Rows and Columns that this current graphics mode can support
427 Columns
= HorizontalResolution
/ GLYPH_WIDTH
;
428 Rows
= VerticalResolution
/ GLYPH_HEIGHT
;
431 // See if the mode is too small to support the required 80x25 text mode
433 if (Columns
< 80 || Rows
< 25) {
437 // Add Mode #0 that must be 80x25
440 Private
->ModeData
[MaxMode
].GopWidth
= HorizontalResolution
;
441 Private
->ModeData
[MaxMode
].GopHeight
= VerticalResolution
;
442 Private
->ModeData
[MaxMode
].GopModeNumber
= ModeNumber
;
443 Private
->ModeData
[MaxMode
].DeltaX
= (HorizontalResolution
- (80 * GLYPH_WIDTH
)) >> 1;
444 Private
->ModeData
[MaxMode
].DeltaY
= (VerticalResolution
- (25 * GLYPH_HEIGHT
)) >> 1;
448 // If it is possible to support Mode #1 - 80x50, than add it as an active mode
451 Private
->ModeData
[MaxMode
].GopWidth
= HorizontalResolution
;
452 Private
->ModeData
[MaxMode
].GopHeight
= VerticalResolution
;
453 Private
->ModeData
[MaxMode
].GopModeNumber
= ModeNumber
;
454 Private
->ModeData
[MaxMode
].DeltaX
= (HorizontalResolution
- (80 * GLYPH_WIDTH
)) >> 1;
455 Private
->ModeData
[MaxMode
].DeltaY
= (VerticalResolution
- (50 * GLYPH_HEIGHT
)) >> 1;
460 // If it is not to support Mode #1 - 80x50, then skip it
463 Private
->ModeData
[MaxMode
].Columns
= 0;
464 Private
->ModeData
[MaxMode
].Rows
= 0;
465 Private
->ModeData
[MaxMode
].GopWidth
= HorizontalResolution
;
466 Private
->ModeData
[MaxMode
].GopHeight
= VerticalResolution
;
467 Private
->ModeData
[MaxMode
].GopModeNumber
= ModeNumber
;
468 Private
->ModeData
[MaxMode
].DeltaX
= 0;
469 Private
->ModeData
[MaxMode
].DeltaY
= 0;
474 // Add Mode #2 that must be 100x31 (graphic mode >= 800x600)
476 if (Columns
>= 100 && Rows
>= 31) {
477 Private
->ModeData
[MaxMode
].GopWidth
= HorizontalResolution
;
478 Private
->ModeData
[MaxMode
].GopHeight
= VerticalResolution
;
479 Private
->ModeData
[MaxMode
].GopModeNumber
= ModeNumber
;
480 Private
->ModeData
[MaxMode
].DeltaX
= (HorizontalResolution
- (100 * GLYPH_WIDTH
)) >> 1;
481 Private
->ModeData
[MaxMode
].DeltaY
= (VerticalResolution
- (31 * GLYPH_HEIGHT
)) >> 1;
486 // Add Mode #3 that uses the entire display for user-defined mode
488 if (HorizontalResolution
> 800 && VerticalResolution
> 600) {
489 Private
->ModeData
[MaxMode
].Columns
= HorizontalResolution
/GLYPH_WIDTH
;
490 Private
->ModeData
[MaxMode
].Rows
= VerticalResolution
/GLYPH_HEIGHT
;
491 Private
->ModeData
[MaxMode
].GopWidth
= HorizontalResolution
;
492 Private
->ModeData
[MaxMode
].GopHeight
= VerticalResolution
;
493 Private
->ModeData
[MaxMode
].GopModeNumber
= ModeNumber
;
494 Private
->ModeData
[MaxMode
].DeltaX
= (HorizontalResolution
% GLYPH_WIDTH
) >> 1;
495 Private
->ModeData
[MaxMode
].DeltaY
= (VerticalResolution
% GLYPH_HEIGHT
) >> 1;
500 // Update the maximum number of modes
502 Private
->SimpleTextOutputMode
.MaxMode
= (INT32
) MaxMode
;
505 // Determine the number of text modes that this protocol can support
507 Status
= GraphicsConsoleConOutSetMode (&Private
->SimpleTextOutput
, 0);
508 if (EFI_ERROR (Status
)) {
513 GraphicsConsoleConOutOutputString (&Private
->SimpleTextOutput
, (CHAR16
*)L
"Graphics Console Started\n\r");
517 // Install protocol interfaces for the Graphics Console device.
519 Status
= gBS
->InstallMultipleProtocolInterfaces (
521 &gEfiSimpleTextOutProtocolGuid
,
522 &Private
->SimpleTextOutput
,
527 if (EFI_ERROR (Status
)) {
529 // Close the GOP or UGA IO Protocol
531 if (Private
->GraphicsOutput
!= NULL
) {
534 &gEfiGraphicsOutputProtocolGuid
,
535 This
->DriverBindingHandle
,
541 &gEfiUgaDrawProtocolGuid
,
542 This
->DriverBindingHandle
,
550 if (Private
!= NULL
) {
551 if (Private
->LineBuffer
!= NULL
) {
552 FreePool (Private
->LineBuffer
);
563 GraphicsConsoleControllerDriverStop (
564 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
565 IN EFI_HANDLE Controller
,
566 IN UINTN NumberOfChildren
,
567 IN EFI_HANDLE
*ChildHandleBuffer
571 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*SimpleTextOutput
;
572 GRAPHICS_CONSOLE_DEV
*Private
;
574 Status
= gBS
->OpenProtocol (
576 &gEfiSimpleTextOutProtocolGuid
,
577 (VOID
**) &SimpleTextOutput
,
578 This
->DriverBindingHandle
,
580 EFI_OPEN_PROTOCOL_GET_PROTOCOL
582 if (EFI_ERROR (Status
)) {
583 return EFI_NOT_STARTED
;
586 Private
= GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (SimpleTextOutput
);
588 Status
= gBS
->UninstallProtocolInterface (
590 &gEfiSimpleTextOutProtocolGuid
,
591 &Private
->SimpleTextOutput
594 if (!EFI_ERROR (Status
)) {
596 // Close the GOP or UGA IO Protocol
598 if (Private
->GraphicsOutput
!= NULL
) {
601 &gEfiGraphicsOutputProtocolGuid
,
602 This
->DriverBindingHandle
,
608 &gEfiUgaDrawProtocolGuid
,
609 This
->DriverBindingHandle
,
615 // Remove the font pack
617 mHii
->RemovePack (mHii
, Private
->HiiHandle
);
620 // Free our instance data
622 if (Private
!= NULL
) {
623 FreePool (Private
->LineBuffer
);
633 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
,
634 IN UINT32 HorizontalResolution
,
635 IN UINT32 VerticalResolution
,
636 OUT UINT32
*CurrentModeNumber
642 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
*Info
;
644 Status
= EFI_SUCCESS
;
646 for (ModeNumber
= 0; ModeNumber
< GraphicsOutput
->Mode
->MaxMode
; ModeNumber
++) {
647 Status
= GraphicsOutput
->QueryMode (
653 if (!EFI_ERROR (Status
)) {
654 if ((Info
->HorizontalResolution
== HorizontalResolution
) &&
655 (Info
->VerticalResolution
== VerticalResolution
)) {
656 Status
= GraphicsOutput
->SetMode (GraphicsOutput
, ModeNumber
);
657 if (!EFI_ERROR (Status
)) {
658 gBS
->FreePool (Info
);
662 gBS
->FreePool (Info
);
666 if (ModeNumber
== GraphicsOutput
->Mode
->MaxMode
) {
667 Status
= EFI_UNSUPPORTED
;
670 *CurrentModeNumber
= ModeNumber
;
675 EfiLocateHiiProtocol (
681 Find if the HII protocol is available. If yes, locate the HII protocol
694 // There should only be one - so buffer size is this
696 Size
= sizeof (EFI_HANDLE
);
698 Status
= gBS
->LocateHandle (
700 &gEfiHiiProtocolGuid
,
706 if (EFI_ERROR (Status
)) {
710 Status
= gBS
->HandleProtocol (
712 &gEfiHiiProtocolGuid
,
719 // Body of the STO functions
723 GraphicsConsoleConOutReset (
724 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
725 IN BOOLEAN ExtendedVerification
730 Implements SIMPLE_TEXT_OUTPUT.Reset().
731 If ExtendeVerification is TRUE, then perform dependent Graphics Console
732 device reset, and set display mode to mode 0.
733 If ExtendedVerification is FALSE, only set display mode to mode 0.
737 This - Indicates the calling context.
739 ExtendedVerification - Indicates that the driver may perform a more exhaustive
740 verification operation of the device during reset.
745 The reset operation succeeds.
748 The Graphics Console is not functioning correctly
752 This
->SetAttribute (This
, EFI_TEXT_ATTR (This
->Mode
->Attribute
& 0x0F, EFI_BACKGROUND_BLACK
));
753 return This
->SetMode (This
, 0);
758 GraphicsConsoleConOutOutputString (
759 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
765 Implements SIMPLE_TEXT_OUTPUT.OutputString().
766 The Unicode string will be converted to Glyphs and will be
767 sent to the Graphics Console.
772 This - Indicates the calling context.
774 WString - The Null-terminated Unicode string to be displayed on
775 the Graphics Console.
780 The string is output successfully.
783 The Graphics Console failed to send the string out.
785 EFI_WARN_UNKNOWN_GLYPH
786 Indicates that some of the characters in the Unicode string could not
787 be rendered and are skipped.
791 GRAPHICS_CONSOLE_DEV
*Private
;
792 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
793 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
802 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground
;
803 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background
;
808 INT32 OriginAttribute
;
810 CHAR16 SpaceStr
[] = { NARROW_CHAR
, ' ', 0 };
812 Status
= EFI_SUCCESS
;
814 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
818 Mode
= This
->Mode
->Mode
;
819 Private
= GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This
);
820 GraphicsOutput
= Private
->GraphicsOutput
;
821 UgaDraw
= Private
->UgaDraw
;
823 MaxColumn
= Private
->ModeData
[Mode
].Columns
;
824 MaxRow
= Private
->ModeData
[Mode
].Rows
;
825 DeltaX
= Private
->ModeData
[Mode
].DeltaX
;
826 DeltaY
= Private
->ModeData
[Mode
].DeltaY
;
827 Width
= MaxColumn
* GLYPH_WIDTH
;
828 Height
= (MaxRow
- 1) * GLYPH_HEIGHT
;
829 Delta
= Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
);
832 // The Attributes won't change when during the time OutputString is called
834 GetTextColors (This
, &Foreground
, &Background
);
843 OriginAttribute
= This
->Mode
->Attribute
;
847 if (*WString
== CHAR_BACKSPACE
) {
849 // If the cursor is at the left edge of the display, then move the cursor
852 if (This
->Mode
->CursorColumn
== 0 && This
->Mode
->CursorRow
> 0) {
853 This
->Mode
->CursorRow
--;
854 This
->Mode
->CursorColumn
= (INT32
) (MaxColumn
- 1);
855 This
->OutputString (This
, SpaceStr
);
857 This
->Mode
->CursorRow
--;
858 This
->Mode
->CursorColumn
= (INT32
) (MaxColumn
- 1);
859 } else if (This
->Mode
->CursorColumn
> 0) {
861 // If the cursor is not at the left edge of the display, then move the cursor
864 This
->Mode
->CursorColumn
--;
865 This
->OutputString (This
, SpaceStr
);
867 This
->Mode
->CursorColumn
--;
872 } else if (*WString
== CHAR_LINEFEED
) {
874 // If the cursor is at the bottom of the display, then scroll the display one
875 // row, and do not update the cursor position. Otherwise, move the cursor
878 if (This
->Mode
->CursorRow
== (INT32
) (MaxRow
- 1)) {
879 if (GraphicsOutput
!= NULL
) {
881 // Scroll Screen Up One Row
883 GraphicsOutput
->Blt (
888 DeltaY
+ GLYPH_HEIGHT
,
897 // Print Blank Line at last line
899 GraphicsOutput
->Blt (
913 // Scroll Screen Up One Row
920 DeltaY
+ GLYPH_HEIGHT
,
929 // Print Blank Line at last line
933 (EFI_UGA_PIXEL
*) (UINTN
) &Background
,
945 This
->Mode
->CursorRow
++;
950 } else if (*WString
== CHAR_CARRIAGE_RETURN
) {
952 // Move the cursor to the beginning of the current row.
954 This
->Mode
->CursorColumn
= 0;
957 } else if (*WString
== WIDE_CHAR
) {
959 This
->Mode
->Attribute
|= EFI_WIDE_ATTRIBUTE
;
962 } else if (*WString
== NARROW_CHAR
) {
964 This
->Mode
->Attribute
&= (~ (UINT32
) EFI_WIDE_ATTRIBUTE
);
969 // Print the character at the current cursor position and move the cursor
970 // right one column. If this moves the cursor past the right edge of the
971 // display, then the line should wrap to the beginning of the next line. This
972 // is equivalent to inserting a CR and an LF. Note that if the cursor is at the
973 // bottom of the display, and the line wraps, then the display will be scrolled
975 // If wide char is going to be displayed, need to display one character at a time
976 // Or, need to know the display length of a certain string.
978 // Index is used to determine how many character width units (wide = 2, narrow = 1)
979 // Count is used to determine how many characters are used regardless of their attributes
981 for (Count
= 0, Index
= 0; (This
->Mode
->CursorColumn
+ Index
) < MaxColumn
; Count
++, Index
++) {
982 if (WString
[Count
] == CHAR_NULL
) {
986 if (WString
[Count
] == CHAR_BACKSPACE
) {
990 if (WString
[Count
] == CHAR_LINEFEED
) {
994 if (WString
[Count
] == CHAR_CARRIAGE_RETURN
) {
998 if (WString
[Count
] == WIDE_CHAR
) {
1002 if (WString
[Count
] == NARROW_CHAR
) {
1006 // Is the wide attribute on?
1008 if (This
->Mode
->Attribute
& EFI_WIDE_ATTRIBUTE
) {
1010 // If wide, add one more width unit than normal since we are going to increment at the end of the for loop
1014 // This is the end-case where if we are at column 79 and about to print a wide character
1015 // We should prevent this from happening because we will wrap inappropriately. We should
1016 // not print this character until the next line.
1018 if ((This
->Mode
->CursorColumn
+ Index
+ 1) > MaxColumn
) {
1025 Status
= DrawUnicodeWeightAtCursorN (This
, WString
, Count
);
1026 if (EFI_ERROR (Status
)) {
1030 // At the end of line, output carriage return and line feed
1033 This
->Mode
->CursorColumn
+= (INT32
) Index
;
1034 if (This
->Mode
->CursorColumn
> (INT32
) MaxColumn
) {
1035 This
->Mode
->CursorColumn
-= 2;
1036 This
->OutputString (This
, SpaceStr
);
1039 if (This
->Mode
->CursorColumn
>= (INT32
) MaxColumn
) {
1041 This
->OutputString (This
, mCrLfString
);
1047 This
->Mode
->Attribute
= OriginAttribute
;
1052 Status
= EFI_WARN_UNKNOWN_GLYPH
;
1055 gBS
->RestoreTPL (OldTpl
);
1062 GraphicsConsoleConOutTestString (
1063 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
1067 Routine Description:
1069 Implements SIMPLE_TEXT_OUTPUT.TestString().
1070 If one of the characters in the *Wstring is
1071 neither valid valid Unicode drawing characters,
1072 not ASCII code, then this function will return
1078 This - Indicates the calling context.
1080 WString - The Null-terminated Unicode string to be tested.
1085 The Graphics Console is capable of rendering the output string.
1088 Some of the characters in the Unicode string cannot be rendered.
1101 while (WString
[Count
]) {
1102 Status
= mHii
->GetGlyph (
1111 if (EFI_ERROR (Status
)) {
1112 return EFI_UNSUPPORTED
;
1121 GraphicsConsoleConOutQueryMode (
1122 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
1123 IN UINTN ModeNumber
,
1128 Routine Description:
1130 Implements SIMPLE_TEXT_OUTPUT.QueryMode().
1131 It returnes information for an available text mode
1132 that the Graphics Console supports.
1133 In this driver,we only support text mode 80x25, which is
1139 This - Indicates the calling context.
1141 ModeNumber - The mode number to return information on.
1143 Columns - The returned columns of the requested mode.
1145 Rows - The returned rows of the requested mode.
1150 The requested mode information is returned.
1153 The mode number is not valid.
1157 GRAPHICS_CONSOLE_DEV
*Private
;
1161 if (ModeNumber
>= (UINTN
) This
->Mode
->MaxMode
) {
1162 return EFI_UNSUPPORTED
;
1165 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
1166 Status
= EFI_SUCCESS
;
1168 Private
= GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This
);
1170 *Columns
= Private
->ModeData
[ModeNumber
].Columns
;
1171 *Rows
= Private
->ModeData
[ModeNumber
].Rows
;
1173 if (*Columns
<= 0 && *Rows
<= 0) {
1174 Status
= EFI_UNSUPPORTED
;
1180 gBS
->RestoreTPL (OldTpl
);
1186 GraphicsConsoleConOutSetMode (
1187 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
1191 Routine Description:
1193 Implements SIMPLE_TEXT_OUTPUT.SetMode().
1194 Set the Graphics Console to a specified mode.
1195 In this driver, we only support mode 0.
1199 This - Indicates the calling context.
1201 ModeNumber - The text mode to set.
1206 The requested text mode is set.
1209 The requested text mode cannot be set because of Graphics Console device error.
1212 The text mode number is not valid.
1217 GRAPHICS_CONSOLE_DEV
*Private
;
1218 GRAPHICS_CONSOLE_MODE_DATA
*ModeData
;
1219 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*NewLineBuffer
;
1220 UINT32 HorizontalResolution
;
1221 UINT32 VerticalResolution
;
1222 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
1223 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
1228 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
1230 Private
= GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This
);
1231 GraphicsOutput
= Private
->GraphicsOutput
;
1232 UgaDraw
= Private
->UgaDraw
;
1233 ModeData
= &(Private
->ModeData
[ModeNumber
]);
1235 if (ModeData
->Columns
<= 0 && ModeData
->Rows
<= 0) {
1236 Status
= EFI_UNSUPPORTED
;
1241 // Make sure the requested mode number is supported
1243 if (ModeNumber
>= (UINTN
) This
->Mode
->MaxMode
) {
1244 Status
= EFI_UNSUPPORTED
;
1248 if (ModeData
->Columns
<= 0 && ModeData
->Rows
<= 0) {
1249 Status
= EFI_UNSUPPORTED
;
1253 // Attempt to allocate a line buffer for the requested mode number
1255 NewLineBuffer
= AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
) * ModeData
->Columns
* GLYPH_WIDTH
* GLYPH_HEIGHT
);
1257 if (NewLineBuffer
== NULL
) {
1259 // The new line buffer could not be allocated, so return an error.
1260 // No changes to the state of the current console have been made, so the current console is still valid
1262 Status
= EFI_OUT_OF_RESOURCES
;
1266 // If the mode has been set at least one other time, then LineBuffer will not be NULL
1268 if (Private
->LineBuffer
!= NULL
) {
1270 // Clear the current text window on the current graphics console
1272 This
->ClearScreen (This
);
1275 // If the new mode is the same as the old mode, then just return EFI_SUCCESS
1277 if ((INT32
) ModeNumber
== This
->Mode
->Mode
) {
1278 FreePool (NewLineBuffer
);
1279 Status
= EFI_SUCCESS
;
1283 // Otherwise, the size of the text console and/or the GOP/UGA mode will be changed,
1284 // so erase the cursor, and free the LineBuffer for the current mode
1288 FreePool (Private
->LineBuffer
);
1291 // Assign the current line buffer to the newly allocated line buffer
1293 Private
->LineBuffer
= NewLineBuffer
;
1295 if (GraphicsOutput
!= NULL
) {
1296 if (ModeData
->GopModeNumber
!= GraphicsOutput
->Mode
->Mode
) {
1298 // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode
1300 Status
= GraphicsOutput
->SetMode (GraphicsOutput
, ModeData
->GopModeNumber
);
1301 if (EFI_ERROR (Status
)) {
1303 // The mode set operation failed
1309 // The current graphics mode is correct, so simply clear the entire display
1311 Status
= GraphicsOutput
->Blt (
1320 ModeData
->GopHeight
,
1326 // Get the current UGA Draw mode information
1328 Status
= UgaDraw
->GetMode (
1330 &HorizontalResolution
,
1331 &VerticalResolution
,
1335 if (EFI_ERROR (Status
) || HorizontalResolution
!= ModeData
->GopWidth
|| VerticalResolution
!= ModeData
->GopHeight
) {
1337 // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode
1339 Status
= UgaDraw
->SetMode (
1342 ModeData
->GopHeight
,
1346 if (EFI_ERROR (Status
)) {
1348 // The mode set operation failed
1354 // The current graphics mode is correct, so simply clear the entire display
1356 Status
= UgaDraw
->Blt (
1358 (EFI_UGA_PIXEL
*) (UINTN
) &mEfiColors
[0],
1365 ModeData
->GopHeight
,
1372 // The new mode is valid, so commit the mode change
1374 This
->Mode
->Mode
= (INT32
) ModeNumber
;
1377 // Move the text cursor to the upper left hand corner of the displat and enable it
1379 This
->SetCursorPosition (This
, 0, 0);
1381 Status
= EFI_SUCCESS
;
1384 gBS
->RestoreTPL (OldTpl
);
1390 GraphicsConsoleConOutSetAttribute (
1391 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
1395 Routine Description:
1397 Implements SIMPLE_TEXT_OUTPUT.SetAttribute().
1401 This - Indicates the calling context.
1403 Attrubute - The attribute to set. Only bit0..6 are valid, all other bits
1404 are undefined and must be zero.
1409 The requested attribute is set.
1412 The requested attribute cannot be set due to Graphics Console port error.
1415 The attribute requested is not defined by EFI spec.
1421 if ((Attribute
| 0xFF) != 0xFF) {
1422 return EFI_UNSUPPORTED
;
1425 if ((INT32
) Attribute
== This
->Mode
->Attribute
) {
1429 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
1433 This
->Mode
->Attribute
= (INT32
) Attribute
;
1437 gBS
->RestoreTPL (OldTpl
);
1444 GraphicsConsoleConOutClearScreen (
1445 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
1448 Routine Description:
1450 Implements SIMPLE_TEXT_OUTPUT.ClearScreen().
1451 It clears the Graphics Console's display to the
1452 currently selected background color.
1457 This - Indicates the calling context.
1462 The operation completed successfully.
1465 The Graphics Console cannot be cleared due to Graphics Console device error.
1468 The Graphics Console is not in a valid text mode.
1473 GRAPHICS_CONSOLE_DEV
*Private
;
1474 GRAPHICS_CONSOLE_MODE_DATA
*ModeData
;
1475 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
1476 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
1477 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground
;
1478 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background
;
1481 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
1483 Private
= GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This
);
1484 GraphicsOutput
= Private
->GraphicsOutput
;
1485 UgaDraw
= Private
->UgaDraw
;
1486 ModeData
= &(Private
->ModeData
[This
->Mode
->Mode
]);
1488 GetTextColors (This
, &Foreground
, &Background
);
1489 if (GraphicsOutput
!= NULL
) {
1490 Status
= GraphicsOutput
->Blt (
1499 ModeData
->GopHeight
,
1503 Status
= UgaDraw
->Blt (
1505 (EFI_UGA_PIXEL
*) (UINTN
) &Background
,
1512 ModeData
->GopHeight
,
1517 This
->Mode
->CursorColumn
= 0;
1518 This
->Mode
->CursorRow
= 0;
1522 gBS
->RestoreTPL (OldTpl
);
1529 GraphicsConsoleConOutSetCursorPosition (
1530 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
1535 Routine Description:
1537 Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition().
1541 This - Indicates the calling context.
1543 Column - The row to set cursor to.
1545 Row - The column to set cursor to.
1550 The operation completed successfully.
1553 The request fails due to Graphics Console device error.
1556 The Graphics Console is not in a valid text mode, or the cursor position
1557 is invalid for current mode.
1561 GRAPHICS_CONSOLE_DEV
*Private
;
1562 GRAPHICS_CONSOLE_MODE_DATA
*ModeData
;
1566 Status
= EFI_SUCCESS
;
1568 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
1570 Private
= GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This
);
1571 ModeData
= &(Private
->ModeData
[This
->Mode
->Mode
]);
1573 if ((Column
>= ModeData
->Columns
) || (Row
>= ModeData
->Rows
)) {
1574 Status
= EFI_UNSUPPORTED
;
1578 if (((INT32
) Column
== This
->Mode
->CursorColumn
) && ((INT32
) Row
== This
->Mode
->CursorRow
)) {
1579 Status
= EFI_SUCCESS
;
1585 This
->Mode
->CursorColumn
= (INT32
) Column
;
1586 This
->Mode
->CursorRow
= (INT32
) Row
;
1591 gBS
->RestoreTPL (OldTpl
);
1598 GraphicsConsoleConOutEnableCursor (
1599 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
1603 Routine Description:
1605 Implements SIMPLE_TEXT_OUTPUT.EnableCursor().
1606 In this driver, the cursor cannot be hidden.
1610 This - Indicates the calling context.
1612 Visible - If TRUE, the cursor is set to be visible,
1613 If FALSE, the cursor is set to be invisible.
1618 The request is valid.
1621 The Graphics Console does not support a hidden cursor.
1627 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
1631 This
->Mode
->CursorVisible
= Visible
;
1635 gBS
->RestoreTPL (OldTpl
);
1642 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
1643 OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Foreground
,
1644 OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Background
1649 Attribute
= This
->Mode
->Attribute
& 0x7F;
1651 *Foreground
= mEfiColors
[Attribute
& 0x0f];
1652 *Background
= mEfiColors
[Attribute
>> 4];
1659 DrawUnicodeWeightAtCursorN (
1660 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
1661 IN CHAR16
*UnicodeWeight
,
1665 GRAPHICS_CONSOLE_DEV
*Private
;
1667 EFI_STATUS ReturnStatus
;
1669 GLYPH_UNION GlyphData
;
1672 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
1673 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
1674 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground
;
1675 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background
;
1682 Private
= GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This
);
1684 ReturnStatus
= EFI_SUCCESS
;
1688 GetTextColors (This
, &Foreground
, &Background
);
1692 while (Index
< Count
) {
1693 if (This
->Mode
->Attribute
& EFI_WIDE_ATTRIBUTE
) {
1694 GlyphStatus
= WIDE_CHAR
;
1696 GlyphStatus
= NARROW_CHAR
;
1699 Status
= mHii
->GetGlyph (
1707 if (EFI_ERROR (Status
)) {
1708 ReturnStatus
= Status
;
1713 CopyMem (&GlyphData
, Glyph
, sizeof (GLYPH_UNION
));
1717 // We are creating the second half of the wide character's BLT buffer
1719 if (GlyphWidth
== 0x10 && Counts
== 1) {
1720 CopyMem (&GlyphData
.NarrowGlyph
.GlyphCol1
, &Glyph
->WideGlyph
.GlyphCol2
, sizeof (Glyph
->WideGlyph
.GlyphCol2
));
1725 if (GlyphWidth
== 0x10) {
1728 (UINT8
*) &GlyphData
,
1734 &Private
->LineBuffer
[ArrayIndex
* GLYPH_WIDTH
]
1739 (UINT8
*) &GlyphData
,
1745 &Private
->LineBuffer
[ArrayIndex
* GLYPH_WIDTH
]
1751 } while (Counts
< 2 && GlyphWidth
== 0x10);
1755 // If we are printing Wide characters, treat the BLT as if it is twice as many characters
1757 if (GlyphWidth
== 0x10) {
1761 // Blt a character to the screen
1763 GlyphX
= This
->Mode
->CursorColumn
* GLYPH_WIDTH
;
1764 GlyphY
= This
->Mode
->CursorRow
* GLYPH_HEIGHT
;
1765 GraphicsOutput
= Private
->GraphicsOutput
;
1766 UgaDraw
= Private
->UgaDraw
;
1767 if (GraphicsOutput
!= NULL
) {
1768 GraphicsOutput
->Blt (
1770 Private
->LineBuffer
,
1771 EfiBltBufferToVideo
,
1774 GlyphX
+ Private
->ModeData
[This
->Mode
->Mode
].DeltaX
,
1775 GlyphY
+ Private
->ModeData
[This
->Mode
->Mode
].DeltaY
,
1776 GLYPH_WIDTH
* Count
,
1778 GLYPH_WIDTH
* Count
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
1783 (EFI_UGA_PIXEL
*) (UINTN
) Private
->LineBuffer
,
1784 EfiUgaBltBufferToVideo
,
1787 GlyphX
+ Private
->ModeData
[This
->Mode
->Mode
].DeltaX
,
1788 GlyphY
+ Private
->ModeData
[This
->Mode
->Mode
].DeltaY
,
1789 GLYPH_WIDTH
* Count
,
1791 GLYPH_WIDTH
* Count
* sizeof (EFI_UGA_PIXEL
)
1795 return ReturnStatus
;
1801 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
1804 GRAPHICS_CONSOLE_DEV
*Private
;
1805 EFI_SIMPLE_TEXT_OUTPUT_MODE
*CurrentMode
;
1808 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
1809 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
1810 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Foreground
;
1811 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Background
;
1812 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION BltChar
[GLYPH_HEIGHT
][GLYPH_WIDTH
];
1816 CurrentMode
= This
->Mode
;
1818 if (!CurrentMode
->CursorVisible
) {
1822 Private
= GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This
);
1823 GraphicsOutput
= Private
->GraphicsOutput
;
1824 UgaDraw
= Private
->UgaDraw
;
1827 // BUGBUG - we need to think about what to do with wide and narrow character deletions.
1830 // Blt a character to the screen
1832 GlyphX
= (CurrentMode
->CursorColumn
* GLYPH_WIDTH
) + Private
->ModeData
[CurrentMode
->Mode
].DeltaX
;
1833 GlyphY
= (CurrentMode
->CursorRow
* GLYPH_HEIGHT
) + Private
->ModeData
[CurrentMode
->Mode
].DeltaY
;
1834 if (GraphicsOutput
!= NULL
) {
1835 GraphicsOutput
->Blt (
1837 (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*) BltChar
,
1838 EfiBltVideoToBltBuffer
,
1845 GLYPH_WIDTH
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
1850 (EFI_UGA_PIXEL
*) (UINTN
) BltChar
,
1851 EfiUgaVideoToBltBuffer
,
1858 GLYPH_WIDTH
* sizeof (EFI_UGA_PIXEL
)
1862 GetTextColors (This
, &Foreground
.Pixel
, &Background
.Pixel
);
1865 // Convert Monochrome bitmap of the Glyph to BltBuffer structure
1867 for (Y
= 0; Y
< GLYPH_HEIGHT
; Y
++) {
1868 for (X
= 0; X
< GLYPH_WIDTH
; X
++) {
1869 if ((mCursorGlyph
.GlyphCol1
[Y
] & (1 << X
)) != 0) {
1870 BltChar
[Y
][GLYPH_WIDTH
- X
- 1].Raw
^= Foreground
.Raw
;
1875 if (GraphicsOutput
!= NULL
) {
1876 GraphicsOutput
->Blt (
1878 (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*) BltChar
,
1879 EfiBltBufferToVideo
,
1886 GLYPH_WIDTH
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
1891 (EFI_UGA_PIXEL
*) (UINTN
) BltChar
,
1892 EfiUgaBltBufferToVideo
,
1899 GLYPH_WIDTH
* sizeof (EFI_UGA_PIXEL
)
1907 The user Entry Point for module GraphicsConsole. The user code starts with this function.
1909 @param[in] ImageHandle The firmware allocated handle for the EFI image.
1910 @param[in] SystemTable A pointer to the EFI System Table.
1912 @retval EFI_SUCCESS The entry point is executed successfully.
1913 @retval other Some error occurs when executing this entry point.
1918 InitializeGraphicsConsole (
1919 IN EFI_HANDLE ImageHandle
,
1920 IN EFI_SYSTEM_TABLE
*SystemTable
1926 // Install driver model protocol(s).
1928 Status
= EfiLibInstallDriverBindingComponentName2 (
1931 &gGraphicsConsoleDriverBinding
,
1933 &gGraphicsConsoleComponentName
,
1934 &gGraphicsConsoleComponentName2
1936 ASSERT_EFI_ERROR (Status
);