From 8541adab27901906118876f1acd3555666677ff9 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Wed, 19 Mar 2008 05:22:06 +0000 Subject: [PATCH] add PCD PcdUgaConsumeSupport to switch on/off EFI UGA Draw Protocol's consuming, it could save size by changing PCD's value to FALSE. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4911 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/GraphicsLib/Graphics.c | 29 +- .../Library/GraphicsLib/GraphicsLib.inf | 2 + MdeModulePkg/Library/GraphicsLib/Graphics.c | 95 ++--- .../Library/GraphicsLib/GraphicsLib.inf | 7 +- MdeModulePkg/MdeModulePkg.dec | 3 +- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 17 +- MdeModulePkg/Universal/BdsDxe/MemoryTest.c | 18 +- .../Console/ConSplitterDxe/ConSplitter.c | 74 ++-- .../Console/ConSplitterDxe/ConSplitterDxe.inf | 1 + .../ConSplitterDxe/ConSplitterGraphics.c | 43 ++- .../GraphicsConsoleDxe/GraphicsConsole.c | 342 +++++++++--------- .../GraphicsConsoleDxe/GraphicsConsole.h | 21 +- .../GraphicsConsoleDxe/GraphicsConsoleDxe.inf | 4 +- 13 files changed, 347 insertions(+), 309 deletions(-) diff --git a/IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c b/IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c index 5ab779a6a3..283d9be358 100644 --- a/IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c +++ b/IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c @@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include EFI_STATUS GetGraphicsBitMapFromFV ( @@ -390,15 +391,15 @@ Returns: // Try to open GOP first // Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput); - if (EFI_ERROR(Status)) { + if (EFI_ERROR(Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { GraphicsOutput = NULL; // // Open GOP failed, try to open UGA // Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw); - if (EFI_ERROR (Status)) { - return EFI_UNSUPPORTED; - } + } + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; } Badging = NULL; @@ -409,7 +410,7 @@ Returns: if (GraphicsOutput != NULL) { SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; @@ -539,7 +540,7 @@ Returns: Height, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) Blt, @@ -552,6 +553,8 @@ Returns: Height, Width * sizeof (EFI_UGA_PIXEL) ); + } else { + Status = EFI_UNSUPPORTED; } } @@ -696,7 +699,7 @@ Returns: if (GraphicsOutput != NULL) { HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution; VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution; - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { // // Get the current mode information from the UGA Draw Protocol // @@ -784,7 +787,7 @@ Returns: GLYPH_HEIGHT, BufferGlyphWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) (UINTN) LineBuffer, @@ -797,6 +800,8 @@ Returns: GLYPH_HEIGHT, BufferGlyphWidth * sizeof (EFI_UGA_PIXEL) ); + } else { + Status = EFI_UNSUPPORTED; } Error: @@ -861,7 +866,7 @@ Returns: (VOID **) &GraphicsOutput ); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { GraphicsOutput = NULL; Status = gBS->HandleProtocol ( @@ -869,10 +874,10 @@ Returns: &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw ); + } - if (EFI_ERROR (Status)) { - return Status; - } + if (EFI_ERROR (Status)) { + return Status; } Status = gBS->HandleProtocol ( diff --git a/IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf b/IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf index a25ed94bf8..39eee4b711 100644 --- a/IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf +++ b/IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf @@ -56,3 +56,5 @@ gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED +[FeaturePcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport diff --git a/MdeModulePkg/Library/GraphicsLib/Graphics.c b/MdeModulePkg/Library/GraphicsLib/Graphics.c index e86b493db1..e944217028 100644 --- a/MdeModulePkg/Library/GraphicsLib/Graphics.c +++ b/MdeModulePkg/Library/GraphicsLib/Graphics.c @@ -38,6 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = { { 0x00, 0x00, 0x00, 0x00 }, @@ -113,19 +114,19 @@ Arguments: ImageHandle - The driver image handle of the caller. The parameter is used to optimize the loading of the image file so that the FV from which - the driver image is loaded will be tried first. + the driver image is loaded will be tried first. FileNameGuid - File Name of graphics file in the FV(s). - Image - Pointer to pointer to return graphics image. If NULL, a + Image - Pointer to pointer to return graphics image. If NULL, a buffer will be allocated. ImageSize - Size of the graphics Image in bytes. Zero if no image found. -Returns: +Returns: - EFI_SUCCESS - Image and ImageSize are valid. + EFI_SUCCESS - Image and ImageSize are valid. EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size EFI_NOT_FOUND - FileNameGuid not found @@ -370,7 +371,7 @@ Arguments: LogoFile - File name of logo to display on the center of the screen. -Returns: +Returns: EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo displayed. @@ -401,7 +402,7 @@ Arguments: the driver image is loaded will be tried first. -Returns: +Returns: EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo displayed. @@ -442,15 +443,15 @@ Returns: // Try to open GOP first // Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID**)&GraphicsOutput); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { GraphicsOutput = NULL; // - // Open GOP failed, try to open UGA + // Open GOP failed, try to open UGwhA // Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID**)&UgaDraw); - if (EFI_ERROR (Status)) { - return EFI_UNSUPPORTED; - } + } + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; } Badging = NULL; @@ -464,7 +465,7 @@ Returns: if (GraphicsOutput != NULL) { SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; @@ -593,7 +594,7 @@ Returns: Height, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) Blt, @@ -658,7 +659,7 @@ UINTN _IPrint ( IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput, IN EFI_UGA_DRAW_PROTOCOL *UgaDraw, - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto, + IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto, IN UINTN X, IN UINTN Y, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground, @@ -677,22 +678,22 @@ Arguments: GraphicsOutput - Graphics output protocol interface UgaDraw - UGA draw protocol interface - + Sto - Simple text out protocol interface - + X - X coordinate to start printing - + Y - Y coordinate to start printing - + Foreground - Foreground color - + Background - Background color - + fmt - Format string - + args - Print arguments -Returns: +Returns: EFI_SUCCESS - success EFI_OUT_OF_RESOURCES - out of resources @@ -711,7 +712,7 @@ Returns: UINTN LineBufferLen; EFI_HII_FONT_PROTOCOL *HiiFont; EFI_IMAGE_OUTPUT *Blt; - EFI_FONT_DISPLAY_INFO *FontInfo; + EFI_FONT_DISPLAY_INFO *FontInfo; // // For now, allocate an arbitrarily long buffer @@ -721,24 +722,31 @@ Returns: return EFI_OUT_OF_RESOURCES; } + HorizontalResolution = 0; + VerticalResolution = 0; + Blt = NULL; + FontInfo = NULL; + if (GraphicsOutput != NULL) { HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution; VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution; - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate); + } else { + Status = EFI_UNSUPPORTED; + goto Error; } - ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0)); - Blt = NULL; - FontInfo = NULL; + ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0)); + ASSERT (GraphicsOutput != NULL); Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont); if (EFI_ERROR (Status)) { goto Error; - } + } UnicodeVSPrint (Buffer, 0x10000, fmt, args); - + UnicodeWeight = (CHAR16 *) Buffer; for (Index = 0; UnicodeWeight[Index] != 0; Index++) { @@ -750,7 +758,7 @@ Returns: } BufferLen = StrLen (Buffer); - + LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT; if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) { @@ -767,7 +775,7 @@ Returns: Blt->Width = (UINT16) (HorizontalResolution); Blt->Height = (UINT16) (VerticalResolution); Blt->Image.Screen = GraphicsOutput; - + FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO)); if (FontInfo == NULL) { Status = EFI_OUT_OF_RESOURCES; @@ -777,8 +785,8 @@ Returns: CopyMem (&FontInfo->ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); } else { CopyMem ( - &FontInfo->ForegroundColor, - &mEfiColors[Sto->Mode->Attribute & 0x0f], + &FontInfo->ForegroundColor, + &mEfiColors[Sto->Mode->Attribute & 0x0f], sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); } @@ -786,8 +794,8 @@ Returns: CopyMem (&FontInfo->BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); } else { CopyMem ( - &FontInfo->BackgroundColor, - &mEfiColors[Sto->Mode->Attribute >> 4], + &FontInfo->BackgroundColor, + &mEfiColors[Sto->Mode->Attribute >> 4], sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); } @@ -804,7 +812,7 @@ Returns: NULL, NULL ); - + Error: SafeFreePool (Blt); @@ -831,11 +839,11 @@ Routine Description: Arguments: X - X coordinate to start printing - + Y - Y coordinate to start printing - + ForeGround - Foreground color - + BackGround - Background color Fmt - Format string @@ -866,7 +874,7 @@ Returns: ); UgaDraw = NULL; - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { GraphicsOutput = NULL; Status = gBS->HandleProtocol ( @@ -874,10 +882,9 @@ Returns: &gEfiUgaDrawProtocolGuid, (VOID**)&UgaDraw ); - - if (EFI_ERROR (Status)) { - return Status; - } + } + if (EFI_ERROR (Status)) { + return Status; } Status = gBS->HandleProtocol ( diff --git a/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf b/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf index c7cb0afb72..57722d8962 100644 --- a/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf +++ b/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf @@ -52,6 +52,9 @@ gEfiGraphicsOutputProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiUgaDrawProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiConsoleControlProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiHiiFontProtocolGuid # PROTOCOL ALWAYS_CONSUMED \ No newline at end of file + gEfiHiiFontProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[FeaturePcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport \ No newline at end of file diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 22ce7d5eca..33866c4a9e 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -126,7 +126,8 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE|BOOLEAN|0x00010042 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|TRUE|BOOLEAN|0x00010043 gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|TRUE|BOOLEAN|0x00010044 - gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010044 + gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010045 + gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00010046 [PcdsFixedAtBuild.common] gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry|0x08|UINT32|0x0001000f diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf index 9b25c02447..42f1e1c2be 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -4,12 +4,12 @@ # N/A # Copyright (c) 2008, Intel Corporation # -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # # @@ -117,7 +117,7 @@ gEfiMemorySubClassGuid gEfiProcessorSubClassGuid gEfiCapsuleVendorGuid - + [Protocols] gEfiHiiStringProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiSimpleFileSystemProtocolGuid # PROTOCOL ALWAYS_CONSUMED @@ -139,10 +139,11 @@ gEfiSerialIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiAcpiS3SaveProtocolGuid - + [FeaturePcd.common] gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDepricate gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord + gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport [Pcd.common] gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes diff --git a/MdeModulePkg/Universal/BdsDxe/MemoryTest.c b/MdeModulePkg/Universal/BdsDxe/MemoryTest.c index 51b49abc4a..002b8302c3 100644 --- a/MdeModulePkg/Universal/BdsDxe/MemoryTest.c +++ b/MdeModulePkg/Universal/BdsDxe/MemoryTest.c @@ -79,7 +79,7 @@ Returns: &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput ); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { GraphicsOutput = NULL; Status = gBS->HandleProtocol ( @@ -87,15 +87,17 @@ Returns: &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw ); - if (EFI_ERROR (Status)) { - return EFI_UNSUPPORTED; - } + } + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; } + SizeOfX = 0; + SizeOfY = 0; if (GraphicsOutput != NULL) { SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->GetMode ( UgaDraw, &SizeOfX, @@ -106,6 +108,8 @@ Returns: if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; } + } else { + return EFI_UNSUPPORTED; } BlockWidth = SizeOfX / 100; @@ -135,7 +139,7 @@ Returns: SizeOfY - (PosY - GLYPH_HEIGHT - 1), SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) &Color, @@ -168,7 +172,7 @@ Returns: BlockHeight, (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) &ProgressColor, diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 5053251e33..00c809b6aa 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -686,7 +686,7 @@ ConSplitterTextOutConstructor ( // // When new console device is added, the new mode will be set later, // so put current mode back to init state. - // + // ConOutPrivate->TextOutMode.Mode = 0xFF; Status = ConSplitterGrowBuffer ( @@ -1236,6 +1236,9 @@ Returns: if (EFI_ERROR (Status)) { return Status; } + + GraphicsOutput = NULL; + UgaDraw = NULL; // // Try to Open Graphics Output protocol // @@ -1247,22 +1250,19 @@ Returns: mConOut.VirtualHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); - if (EFI_ERROR (Status)) { - GraphicsOutput = NULL; - } - // - // Open UGA_DRAW protocol - // - Status = gBS->OpenProtocol ( - ControllerHandle, - &gEfiUgaDrawProtocolGuid, - (VOID **) &UgaDraw, - This->DriverBindingHandle, - mConOut.VirtualHandle, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - UgaDraw = NULL; + + if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { + // + // Open UGA_DRAW protocol + // + Status = gBS->OpenProtocol ( + ControllerHandle, + &gEfiUgaDrawProtocolGuid, + (VOID **) &UgaDraw, + This->DriverBindingHandle, + mConOut.VirtualHandle, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); } // @@ -1270,7 +1270,7 @@ Returns: // so put current mode back to init state. // mConOut.TextOutMode.Mode = 0xFF; - + // // If both ConOut and StdErr incorporate the same Text Out device, // their MaxMode and QueryData should be the intersection of both. @@ -1278,7 +1278,7 @@ Returns: Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw); ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); - if (FeaturePcdGet (PcdConOutUgaSupport)) { + if (FeaturePcdGet (PcdConOutUgaSupport) && FeaturePcdGet (PcdUgaConsumeSupport)) { // // Match the UGA mode data of ConOut with the current mode // @@ -1332,13 +1332,13 @@ Returns: if (EFI_ERROR (Status)) { return Status; } - + // // When new console device is added, the new mode will be set later, // so put current mode back to init state. // mStdErr.TextOutMode.Mode = 0xFF; - + // // If both ConOut and StdErr incorporate the same Text Out device, // their MaxMode and QueryData should be the intersection of both. @@ -2711,7 +2711,7 @@ Returns: } } } - if (UgaDraw != NULL) { + if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { // // Graphics console driver can ensure the same mode for all GOP devices // so we can get the current mode from this video device @@ -2751,7 +2751,7 @@ Done: if (GraphicsOutput != NULL) { Private->CurrentNumberOfGraphicsOutput++; } - if (UgaDraw != NULL) { + if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { Private->CurrentNumberOfUgaDraw++; } @@ -2801,7 +2801,7 @@ Returns: None ---*/ +--*/ { UINTN Col; UINTN Row; @@ -2813,7 +2813,7 @@ Returns: EFI_STATUS Status; CONSOLE_OUT_MODE *ModeInfo; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; - + PreferMode = 0xFF; BaseMode = 0xFF; TextOut = &Private->TextOut; @@ -2832,9 +2832,9 @@ Returns: ); // - // Set to the default mode 80 x 25 required by EFI/UEFI spec; + // Set to the default mode 80 x 25 required by EFI/UEFI spec; // user can also define other valid default console mode here. - // + // if (EFI_ERROR(Status)) { ModeInfo->Column = 80; ModeInfo->Row = 25; @@ -2844,9 +2844,9 @@ Returns: EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, sizeof (CONSOLE_OUT_MODE), ModeInfo - ); + ); } - + for (Mode = 0; Mode < MaxMode; Mode++) { Status = TextOut->QueryMode (TextOut, Mode, &Col, &Row); if (!EFI_ERROR(Status)) { @@ -2858,19 +2858,19 @@ Returns: } } } - + Status = TextOut->SetMode (TextOut, PreferMode); - + // // if current mode setting is failed, default 80x25 mode will be set. // if (EFI_ERROR(Status)) { Status = TextOut->SetMode (TextOut, BaseMode); ASSERT(!EFI_ERROR(Status)); - + ModeInfo->Column = 80; ModeInfo->Row = 25; - + // // Update ConOutMode variable // @@ -2880,7 +2880,7 @@ Returns: EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, sizeof (CONSOLE_OUT_MODE), ModeInfo - ); + ); } gBS->FreePool (ModeInfo); @@ -2989,7 +2989,7 @@ Returns: } } if (FeaturePcdGet (PcdConOutUgaSupport)) { - if (UgaDraw != NULL) { + if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->GetMode ( UgaDraw, &UgaHorizontalResolution, @@ -3043,7 +3043,7 @@ Returns: } // - // After adding new console device, all existing console devices should be + // After adding new console device, all existing console devices should be // synced to the current shared mode. // ConsplitterSetConsoleOutMode (Private); @@ -3084,7 +3084,7 @@ Returns: if (TextOutList->TextOut == TextOut) { CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index); CurrentNumOfConsoles--; - if (TextOutList->UgaDraw != NULL) { + if (TextOutList->UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { Private->CurrentNumberOfUgaDraw--; } if (TextOutList->GraphicsOutput != NULL) { diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf index 3f627b8fb4..213f2bd1a8 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf @@ -84,3 +84,4 @@ [FeaturePcd.common] gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport + gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c index 77c076fc85..20f27a20fb 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c @@ -311,7 +311,7 @@ Routine Description: } } - if (EFI_ERROR (ReturnStatus)) { + if (EFI_ERROR (ReturnStatus) && FeaturePcdGet (PcdUgaConsumeSupport)) { UgaDraw = Private->TextOutList[Index].UgaDraw; if (UgaDraw != NULL) { Status = UgaDraw->SetMode ( @@ -581,7 +581,7 @@ ConSpliterGraphicsOutputBlt ( } UgaDraw = Private->TextOutList[Index].UgaDraw; - if (UgaDraw != NULL) { + if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) BltBuffer, @@ -628,7 +628,7 @@ DevNullGopSync ( Private->GraphicsOutput.Mode->Info->VerticalResolution, 0 ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { return UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) Private->GraphicsOutputBlt, @@ -641,6 +641,8 @@ DevNullGopSync ( Private->GraphicsOutput.Mode->Info->VerticalResolution, 0 ); + } else { + return EFI_UNSUPPORTED; } } @@ -767,17 +769,22 @@ ConSpliterUgaDrawSetMode ( // return the worst status met // for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) { - UgaDraw = Private->TextOutList[Index].UgaDraw; - if (UgaDraw != NULL) { - Status = UgaDraw->SetMode ( - UgaDraw, - HorizontalResolution, - VerticalResolution, - ColorDepth, - RefreshRate - ); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; + + ReturnStatus = EFI_UNSUPPORTED; + + if (FeaturePcdGet (PcdUgaConsumeSupport)) { + UgaDraw = Private->TextOutList[Index].UgaDraw; + if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + Status = UgaDraw->SetMode ( + UgaDraw, + HorizontalResolution, + VerticalResolution, + ColorDepth, + RefreshRate + ); + if (EFI_ERROR (Status)) { + ReturnStatus = Status; + } } } @@ -1043,7 +1050,7 @@ ConSpliterUgaDrawBlt ( } } - if (Private->TextOutList[Index].UgaDraw != NULL) { + if (Private->TextOutList[Index].UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { Status = Private->TextOutList[Index].UgaDraw->Blt ( Private->TextOutList[Index].UgaDraw, BltBuffer, @@ -1077,7 +1084,7 @@ DevNullUgaSync ( IN EFI_UGA_DRAW_PROTOCOL *UgaDraw ) { - if (UgaDraw != NULL) { + if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { return UgaDraw->Blt ( UgaDraw, Private->UgaBlt, @@ -1090,7 +1097,7 @@ DevNullUgaSync ( Private->UgaVerticalResolution, Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL) ); - } else { + } else if (GraphicsOutput != NULL) { return GraphicsOutput->Blt ( GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt, @@ -1103,6 +1110,8 @@ DevNullUgaSync ( Private->UgaVerticalResolution, 0 ); + } else { + return EFI_UNSUPPORTED; } } diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c index 827f6b34db..48c5c1bbed 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c @@ -5,15 +5,15 @@ Remaining Tasks Implement optimal automatic Mode creation algorithm Solve palette issues for mixed graphics and text When does this protocol reset the palette? - + Copyright (c) 2006 - 2007 Intel Corporation.
-All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ @@ -139,12 +139,13 @@ GraphicsConsoleControllerDriverSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { - EFI_STATUS Status; + EFI_STATUS Status; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; - EFI_UGA_DRAW_PROTOCOL *UgaDraw; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_UGA_DRAW_PROTOCOL *UgaDraw; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; - UgaDraw = NULL; + GraphicsOutput = NULL; + UgaDraw = NULL; // // Open the IO Abstraction(s) needed to perform the supported test // @@ -156,9 +157,8 @@ GraphicsConsoleControllerDriverSupported ( Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); - - if (EFI_ERROR (Status)) { - GraphicsOutput = NULL; + + if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { // // Open Graphics Output Protocol failed, try to open UGA Draw Protocol // @@ -170,9 +170,9 @@ GraphicsConsoleControllerDriverSupported ( Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); - if (EFI_ERROR (Status)) { - return Status; - } + } + if (EFI_ERROR (Status)) { + return Status; } // @@ -215,7 +215,7 @@ Error: This->DriverBindingHandle, Controller ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { gBS->CloseProtocol ( Controller, &gEfiUgaDrawProtocolGuid, @@ -292,9 +292,8 @@ GraphicsConsoleControllerDriverStart ( Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); - if (EFI_ERROR(Status)) { - Private->GraphicsOutput = NULL; + if (EFI_ERROR(Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { Status = gBS->OpenProtocol ( Controller, &gEfiUgaDrawProtocolGuid, @@ -303,9 +302,10 @@ GraphicsConsoleControllerDriverStart ( Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); - if (EFI_ERROR (Status)) { - goto Error; - } + } + + if (EFI_ERROR (Status)) { + goto Error; } NarrowFontSize = ReturnNarrowFontSize (); @@ -325,10 +325,10 @@ GraphicsConsoleControllerDriverStart ( SimplifiedFont->Header.Length = (UINT32) (PackageLength - 4); SimplifiedFont->Header.Type = EFI_HII_PACKAGE_SIMPLE_FONTS; SimplifiedFont->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH)); - + Location = (UINT8 *) (&SimplifiedFont->NumberOfWideGlyphs + 1); CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize); - + // // Add this simplified font package to a package list then install it. // @@ -336,7 +336,7 @@ GraphicsConsoleControllerDriverStart ( Status = mHiiDatabase->NewPackageList (mHiiDatabase, PackageList, NULL, &(Private->HiiHandle)); ASSERT_EFI_ERROR (Status); SafeFreePool (PackageList); - SafeFreePool (Package); + SafeFreePool (Package); mFirstAccessFlag = FALSE; } @@ -349,13 +349,13 @@ GraphicsConsoleControllerDriverStart ( if (Private->GraphicsOutput != NULL) { // - // The console is build on top of Graphics Output Protocol, find the mode number + // The console is build on top of Graphics Output Protocol, find the mode number // for the user-defined mode; if there are multiple video devices, // graphic console driver will set all the video devices to the same mode. // Status = CheckModeSupported ( - Private->GraphicsOutput, - CURRENT_HORIZONTAL_RESOLUTION, + Private->GraphicsOutput, + CURRENT_HORIZONTAL_RESOLUTION, CURRENT_VERTICAL_RESOLUTION, &ModeNumber ); @@ -370,9 +370,9 @@ GraphicsConsoleControllerDriverStart ( // if not supporting current mode, try 800x600 which is required by UEFI/EFI spec // Status = CheckModeSupported ( - Private->GraphicsOutput, - 800, - 600, + Private->GraphicsOutput, + 800, + 600, &ModeNumber ); } @@ -385,7 +385,7 @@ GraphicsConsoleControllerDriverStart ( VerticalResolution = Private->GraphicsOutput->Mode->Info->VerticalResolution; ModeNumber = Private->GraphicsOutput->Mode->Mode; } - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { // // At first try to set user-defined resolution // @@ -401,7 +401,7 @@ GraphicsConsoleControllerDriverStart ( if (!EFI_ERROR (Status)) { HorizontalResolution = CURRENT_HORIZONTAL_RESOLUTION; VerticalResolution = CURRENT_VERTICAL_RESOLUTION; - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { // // Try to set 800*600 which is required by UEFI/EFI spec // @@ -475,11 +475,11 @@ GraphicsConsoleControllerDriverStart ( Private->ModeData[MaxMode].DeltaY = 0; MaxMode++; } - + // // Add Mode #2 that must be 100x31 (graphic mode >= 800x600) // - if (Columns >= 100 && Rows >= 31) { + if (Columns >= 100 && Rows >= 31) { Private->ModeData[MaxMode].GopWidth = HorizontalResolution; Private->ModeData[MaxMode].GopHeight = VerticalResolution; Private->ModeData[MaxMode].GopModeNumber = ModeNumber; @@ -493,7 +493,7 @@ GraphicsConsoleControllerDriverStart ( // if (HorizontalResolution > 800 && VerticalResolution > 600) { Private->ModeData[MaxMode].Columns = HorizontalResolution/GLYPH_WIDTH; - Private->ModeData[MaxMode].Rows = VerticalResolution/GLYPH_HEIGHT; + Private->ModeData[MaxMode].Rows = VerticalResolution/GLYPH_HEIGHT; Private->ModeData[MaxMode].GopWidth = HorizontalResolution; Private->ModeData[MaxMode].GopHeight = VerticalResolution; Private->ModeData[MaxMode].GopModeNumber = ModeNumber; @@ -501,7 +501,7 @@ GraphicsConsoleControllerDriverStart ( Private->ModeData[MaxMode].DeltaY = (VerticalResolution % GLYPH_HEIGHT) >> 1; MaxMode++; } - + // // Update the maximum number of modes // @@ -541,7 +541,7 @@ Error: This->DriverBindingHandle, Controller ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { gBS->CloseProtocol ( Controller, &gEfiUgaDrawProtocolGuid, @@ -608,7 +608,7 @@ GraphicsConsoleControllerDriverStop ( This->DriverBindingHandle, Controller ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { gBS->CloseProtocol ( Controller, &gEfiUgaDrawProtocolGuid, @@ -647,11 +647,11 @@ CheckModeSupported ( { UINT32 ModeNumber; EFI_STATUS Status; - UINTN SizeOfInfo; + UINTN SizeOfInfo; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; - + Status = EFI_SUCCESS; - + for (ModeNumber = 0; ModeNumber < GraphicsOutput->Mode->MaxMode; ModeNumber++) { Status = GraphicsOutput->QueryMode ( GraphicsOutput, @@ -671,13 +671,13 @@ CheckModeSupported ( gBS->FreePool (Info); } } - + if (ModeNumber == GraphicsOutput->Mode->MaxMode) { Status = EFI_UNSUPPORTED; } - + *CurrentModeNumber = ModeNumber; - return Status; + return Status; } EFI_STATUS @@ -745,27 +745,27 @@ GraphicsConsoleConOutReset ( ) /*++ Routine Description: - + Implements SIMPLE_TEXT_OUTPUT.Reset(). - If ExtendeVerification is TRUE, then perform dependent Graphics Console + If ExtendeVerification is TRUE, then perform dependent Graphics Console device reset, and set display mode to mode 0. If ExtendedVerification is FALSE, only set display mode to mode 0. - + Arguments: - + This - Indicates the calling context. - + ExtendedVerification - Indicates that the driver may perform a more exhaustive verification operation of the device during reset. - + Returns: - + EFI_SUCCESS - The reset operation succeeds. - + The reset operation succeeds. + EFI_DEVICE_ERROR - The Graphics Console is not functioning correctly - + The Graphics Console is not functioning correctly + --*/ { This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK)); @@ -780,31 +780,31 @@ GraphicsConsoleConOutOutputString ( ) /*++ Routine Description: - + Implements SIMPLE_TEXT_OUTPUT.OutputString(). - The Unicode string will be converted to Glyphs and will be + The Unicode string will be converted to Glyphs and will be sent to the Graphics Console. - - + + Arguments: - + This - Indicates the calling context. - - WString - The Null-terminated Unicode string to be displayed on + + WString - The Null-terminated Unicode string to be displayed on the Graphics Console. - + Returns: - + EFI_SUCCESS - The string is output successfully. - + The string is output successfully. + EFI_DEVICE_ERROR The Graphics Console failed to send the string out. - + EFI_WARN_UNKNOWN_GLYPH - Indicates that some of the characters in the Unicode string could not - be rendered and are skipped. - + Indicates that some of the characters in the Unicode string could not + be rendered and are skipped. + --*/ { GRAPHICS_CONSOLE_DEV *Private; @@ -927,7 +927,7 @@ GraphicsConsoleConOutOutputString ( GLYPH_HEIGHT, Delta ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { // // Scroll Screen Up One Row // @@ -1084,28 +1084,28 @@ GraphicsConsoleConOutTestString ( ) /*++ Routine Description: - + Implements SIMPLE_TEXT_OUTPUT.TestString(). If one of the characters in the *Wstring is neither valid valid Unicode drawing characters, not ASCII code, then this function will return EFI_UNSUPPORTED. - - + + Arguments: - + This - Indicates the calling context. - + WString - The Null-terminated Unicode string to be tested. - + Returns: - + EFI_SUCCESS - The Graphics Console is capable of rendering the output string. - + The Graphics Console is capable of rendering the output string. + EFI_UNSUPPORTED - Some of the characters in the Unicode string cannot be rendered. - + Some of the characters in the Unicode string cannot be rendered. + --*/ { EFI_STATUS Status; @@ -1145,45 +1145,45 @@ GraphicsConsoleConOutQueryMode ( ) /*++ Routine Description: - + Implements SIMPLE_TEXT_OUTPUT.QueryMode(). It returnes information for an available text mode that the Graphics Console supports. In this driver,we only support text mode 80x25, which is defined as mode 0. - - + + Arguments: - + This - Indicates the calling context. - + ModeNumber - The mode number to return information on. - + Columns - The returned columns of the requested mode. - - Rows - The returned rows of the requested mode. - + + Rows - The returned rows of the requested mode. + Returns: - + EFI_SUCCESS - The requested mode information is returned. - + The requested mode information is returned. + EFI_UNSUPPORTED - The mode number is not valid. - + The mode number is not valid. + --*/ { GRAPHICS_CONSOLE_DEV *Private; EFI_STATUS Status; EFI_TPL OldTpl; - + if (ModeNumber >= (UINTN) This->Mode->MaxMode) { return EFI_UNSUPPORTED; } OldTpl = gBS->RaiseTPL (TPL_NOTIFY); Status = EFI_SUCCESS; - + Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This); *Columns = Private->ModeData[ModeNumber].Columns; @@ -1208,28 +1208,28 @@ GraphicsConsoleConOutSetMode ( ) /*++ Routine Description: - + Implements SIMPLE_TEXT_OUTPUT.SetMode(). Set the Graphics Console to a specified mode. - In this driver, we only support mode 0. - + In this driver, we only support mode 0. + Arguments: - + This - Indicates the calling context. - + ModeNumber - The text mode to set. - + Returns: - + EFI_SUCCESS The requested text mode is set. - + EFI_DEVICE_ERROR The requested text mode cannot be set because of Graphics Console device error. - + EFI_UNSUPPORTED - The text mode number is not valid. - + The text mode number is not valid. + --*/ { EFI_STATUS Status; @@ -1340,7 +1340,7 @@ GraphicsConsoleConOutSetMode ( 0 ); } - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { // // Get the current UGA Draw mode information // @@ -1412,31 +1412,31 @@ GraphicsConsoleConOutSetAttribute ( ) /*++ Routine Description: - - Implements SIMPLE_TEXT_OUTPUT.SetAttribute(). - + + Implements SIMPLE_TEXT_OUTPUT.SetAttribute(). + Arguments: - + This - Indicates the calling context. - + Attrubute - The attribute to set. Only bit0..6 are valid, all other bits are undefined and must be zero. - + Returns: - + EFI_SUCCESS - The requested attribute is set. - + The requested attribute is set. + EFI_DEVICE_ERROR The requested attribute cannot be set due to Graphics Console port error. - + EFI_UNSUPPORTED - The attribute requested is not defined by EFI spec. - + The attribute requested is not defined by EFI spec. + --*/ { EFI_TPL OldTpl; - + if ((Attribute | 0xFF) != 0xFF) { return EFI_UNSUPPORTED; } @@ -1465,27 +1465,27 @@ GraphicsConsoleConOutClearScreen ( ) /*++ Routine Description: - + Implements SIMPLE_TEXT_OUTPUT.ClearScreen(). - It clears the Graphics Console's display to the + It clears the Graphics Console's display to the currently selected background color. - - + + Arguments: - + This - Indicates the calling context. Returns: - + EFI_SUCCESS The operation completed successfully. - + EFI_DEVICE_ERROR - The Graphics Console cannot be cleared due to Graphics Console device error. - + The Graphics Console cannot be cleared due to Graphics Console device error. + EFI_UNSUPPORTED - The Graphics Console is not in a valid text mode. - + The Graphics Console is not in a valid text mode. + --*/ { EFI_STATUS Status; @@ -1518,7 +1518,7 @@ GraphicsConsoleConOutClearScreen ( ModeData->GopHeight, 0 ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) (UINTN) &Background, @@ -1531,6 +1531,8 @@ GraphicsConsoleConOutClearScreen ( ModeData->GopHeight, 0 ); + } else { + Status = EFI_UNSUPPORTED; } This->Mode->CursorColumn = 0; @@ -1552,29 +1554,29 @@ GraphicsConsoleConOutSetCursorPosition ( ) /*++ Routine Description: - - Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition(). - + + Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition(). + Arguments: - + This - Indicates the calling context. - + Column - The row to set cursor to. - - Row - The column to set cursor to. + + Row - The column to set cursor to. Returns: - + EFI_SUCCESS The operation completed successfully. - + EFI_DEVICE_ERROR - The request fails due to Graphics Console device error. - + The request fails due to Graphics Console device error. + EFI_UNSUPPORTED The Graphics Console is not in a valid text mode, or the cursor position - is invalid for current mode. - + is invalid for current mode. + --*/ { GRAPHICS_CONSOLE_DEV *Private; @@ -1620,31 +1622,31 @@ GraphicsConsoleConOutEnableCursor ( ) /*++ Routine Description: - + Implements SIMPLE_TEXT_OUTPUT.EnableCursor(). - In this driver, the cursor cannot be hidden. - + In this driver, the cursor cannot be hidden. + Arguments: - + This - Indicates the calling context. - + Visible - If TRUE, the cursor is set to be visible, - If FALSE, the cursor is set to be invisible. + If FALSE, the cursor is set to be invisible. Returns: - + EFI_SUCCESS The request is valid. - + EFI_UNSUPPORTED - The Graphics Console does not support a hidden cursor. - + The Graphics Console does not support a hidden cursor. + --*/ { EFI_TPL OldTpl; - + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); - + EraseCursor (This); This->Mode->CursorVisible = Visible; @@ -1729,7 +1731,7 @@ DrawUnicodeWeightAtCursorN ( NULL ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { ASSERT (Private->UgaDraw!= NULL); UgaDraw = Private->UgaDraw; @@ -1765,7 +1767,7 @@ DrawUnicodeWeightAtCursorN ( // always be 1. ASSERT here to make sure. // ASSERT (RowInfoArraySize == 1); - + Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) Blt->Image.Bitmap, @@ -1782,6 +1784,8 @@ DrawUnicodeWeightAtCursorN ( SafeFreePool (RowInfoArray); SafeFreePool (Blt->Image.Bitmap); + } else { + Status = EFI_UNSUPPORTED; } SafeFreePool (Blt); @@ -1840,7 +1844,7 @@ EraseCursor ( GLYPH_HEIGHT, GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) (UINTN) BltChar, @@ -1881,7 +1885,7 @@ EraseCursor ( GLYPH_HEIGHT, GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) (UINTN) BltChar, @@ -1902,9 +1906,9 @@ EraseCursor ( /** The user Entry Point for module GraphicsConsole. The user code starts with this function. - @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] ImageHandle The firmware allocated handle for the EFI image. @param[in] SystemTable A pointer to the EFI System Table. - + @retval EFI_SUCCESS The entry point is executed successfully. @retval other Some error occurs when executing this entry point. diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h index 1c182f3b90..5bdbf7f4cd 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2006 - 2008, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2008, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -15,7 +15,7 @@ Module Name: Abstract: - + Revision History --*/ @@ -24,7 +24,6 @@ Revision History #define _GRAPHICS_CONSOLE_H #include -//#include #include #include #include @@ -32,12 +31,12 @@ Revision History #include #include #include -//#include #include #include #include #include #include +#include #include diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf index 4a07393df9..8444def66f 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf @@ -61,4 +61,6 @@ gEfiUgaDrawProtocolGuid # PROTOCOL TO_START gEfiHiiFontProtocolGuid gEfiHiiDatabaseProtocolGuid - \ No newline at end of file + +[FeaturePcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport \ No newline at end of file -- 2.39.2