* [edk2-platforms Patch v2 0/3] Remove all UGA support @ 2022-07-13 7:31 Guomin Jiang 2022-07-13 7:31 ` [edk2-platforms Patch v2 1/3] PurleyOpenBoardPkg: Remove All " Guomin Jiang ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: Guomin Jiang @ 2022-07-13 7:31 UTC (permalink / raw) To: devel REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368 Remove all UGA support Guomin Jiang (3): PurleyOpenBoardPkg: Remove All UGA support BoardModulePkg: Remove all UGA support OptionRomPkg: Remove all UGA support .../CirrusLogic5430Dxe/CirrusLogic5430.c | 91 +--- .../CirrusLogic5430Dxe/CirrusLogic5430.h | 21 +- .../CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf | 9 +- .../CirrusLogic5430UgaDraw.c | 412 ------------------ Drivers/OptionRomPkg/OptionRomPkg.dec | 3 - .../Library/BoardBdsHookLib/BoardBdsHook.h | 3 +- .../Library/BoardBdsHookLib/BoardBdsHook.h | 3 +- 7 files changed, 5 insertions(+), 537 deletions(-) delete mode 100644 Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c -- 2.26.2.windows.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [edk2-platforms Patch v2 1/3] PurleyOpenBoardPkg: Remove All UGA support 2022-07-13 7:31 [edk2-platforms Patch v2 0/3] Remove all UGA support Guomin Jiang @ 2022-07-13 7:31 ` Guomin Jiang 2022-07-13 7:31 ` [edk2-platforms Patch v2 2/3] BoardModulePkg: Remove all " Guomin Jiang ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Guomin Jiang @ 2022-07-13 7:31 UTC (permalink / raw) To: devel; +Cc: Nate DeSimone, Chasel Chiu REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368 Remove all UGA support in PurleyOpenBoardPkg Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> --- .../BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h b/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h index fd943b3ca793..292d02a4ef4d 100644 --- a/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h +++ b/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h @@ -1,7 +1,7 @@ /** @file Header file for BDS Hook Library -Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Protocol/LoadedImage.h> #include <Protocol/DiskInfo.h> #include <Protocol/GraphicsOutput.h> -#include <Protocol/UgaDraw.h> #include <Protocol/GenericMemoryTest.h> #include <Protocol/DevicePathToText.h> #include <Protocol/FirmwareVolume2.h> -- 2.26.2.windows.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [edk2-platforms Patch v2 2/3] BoardModulePkg: Remove all UGA support 2022-07-13 7:31 [edk2-platforms Patch v2 0/3] Remove all UGA support Guomin Jiang 2022-07-13 7:31 ` [edk2-platforms Patch v2 1/3] PurleyOpenBoardPkg: Remove All " Guomin Jiang @ 2022-07-13 7:31 ` Guomin Jiang 2022-07-13 7:32 ` [edk2-platforms Patch v2 3/3] OptionRomPkg: " Guomin Jiang 2022-07-13 15:06 ` [edk2-devel] [edk2-platforms Patch v2 0/3] " Michael D Kinney 3 siblings, 0 replies; 6+ messages in thread From: Guomin Jiang @ 2022-07-13 7:31 UTC (permalink / raw) To: devel; +Cc: Eric Dong, Liming Gao REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368 Remove all UGA support Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> --- .../BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h index fd943b3ca793..292d02a4ef4d 100644 --- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h +++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h @@ -1,7 +1,7 @@ /** @file Header file for BDS Hook Library -Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Protocol/LoadedImage.h> #include <Protocol/DiskInfo.h> #include <Protocol/GraphicsOutput.h> -#include <Protocol/UgaDraw.h> #include <Protocol/GenericMemoryTest.h> #include <Protocol/DevicePathToText.h> #include <Protocol/FirmwareVolume2.h> -- 2.26.2.windows.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [edk2-platforms Patch v2 3/3] OptionRomPkg: Remove all UGA support 2022-07-13 7:31 [edk2-platforms Patch v2 0/3] Remove all UGA support Guomin Jiang 2022-07-13 7:31 ` [edk2-platforms Patch v2 1/3] PurleyOpenBoardPkg: Remove All " Guomin Jiang 2022-07-13 7:31 ` [edk2-platforms Patch v2 2/3] BoardModulePkg: Remove all " Guomin Jiang @ 2022-07-13 7:32 ` Guomin Jiang 2022-07-13 7:49 ` Ni, Ray 2022-07-13 15:06 ` [edk2-devel] [edk2-platforms Patch v2 0/3] " Michael D Kinney 3 siblings, 1 reply; 6+ messages in thread From: Guomin Jiang @ 2022-07-13 7:32 UTC (permalink / raw) To: devel; +Cc: Ray Ni REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368 Remove all UGA support Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> --- .../CirrusLogic5430Dxe/CirrusLogic5430.c | 91 +--- .../CirrusLogic5430Dxe/CirrusLogic5430.h | 21 +- .../CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf | 9 +- .../CirrusLogic5430UgaDraw.c | 412 ------------------ Drivers/OptionRomPkg/OptionRomPkg.dec | 3 - 5 files changed, 3 insertions(+), 533 deletions(-) delete mode 100644 Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c index 4e7830ea94b3..48e0c012957a 100644 --- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c +++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c @@ -11,7 +11,7 @@ documentation on UGA for details on how to write a UGA driver that is able to function both in the EFI pre-boot environment and from the OS runtime. - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -316,7 +316,6 @@ CirrusLogic5430ControllerDriverStart ( goto Error; } - if (FeaturePcdGet (PcdSupportGop)) { // // Set Gop Device Path // @@ -357,7 +356,6 @@ CirrusLogic5430ControllerDriverStart ( NULL ); } - } // // Construct video mode buffer @@ -367,24 +365,6 @@ CirrusLogic5430ControllerDriverStart ( goto Error; } - if (FeaturePcdGet (PcdSupportUga)) { - // - // Start the UGA Draw software stack. - // - Status = CirrusLogic5430UgaDrawConstructor (Private); - ASSERT_EFI_ERROR (Status); - - Private->UgaDevicePath = ParentDevicePath; - Status = gBS->InstallMultipleProtocolInterfaces ( - &Controller, - &gEfiUgaDrawProtocolGuid, - &Private->UgaDraw, - &gEfiDevicePathProtocolGuid, - Private->UgaDevicePath, - NULL - ); - - } else if (FeaturePcdGet (PcdSupportGop)) { if (Private->GopDevicePath == NULL) { // // If RemainingDevicePath is the End of Device Path Node, @@ -410,14 +390,6 @@ CirrusLogic5430ControllerDriverStart ( NULL ); } - } else { - // - // This driver must support eithor GOP or UGA or both. - // - ASSERT (FALSE); - Status = EFI_UNSUPPORTED; - } - Error: if (EFI_ERROR (Status)) { @@ -470,55 +442,11 @@ CirrusLogic5430ControllerDriverStop ( IN EFI_HANDLE *ChildHandleBuffer ) { - EFI_UGA_DRAW_PROTOCOL *UgaDraw; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; EFI_STATUS Status; CIRRUS_LOGIC_5430_PRIVATE_DATA *Private; - if (FeaturePcdGet (PcdSupportUga)) { - Status = gBS->OpenProtocol ( - Controller, - &gEfiUgaDrawProtocolGuid, - (VOID **) &UgaDraw, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return Status; - } - // - // Get our private context information - // - Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw); - CirrusLogic5430UgaDrawDestructor (Private); - - if (FeaturePcdGet (PcdSupportGop)) { - CirrusLogic5430GraphicsOutputDestructor (Private); - // - // Remove the UGA and GOP protocol interface from the system - // - Status = gBS->UninstallMultipleProtocolInterfaces ( - Private->Handle, - &gEfiUgaDrawProtocolGuid, - &Private->UgaDraw, - &gEfiGraphicsOutputProtocolGuid, - &Private->GraphicsOutput, - NULL - ); - } else { - // - // Remove the UGA Draw interface from the system - // - Status = gBS->UninstallMultipleProtocolInterfaces ( - Private->Handle, - &gEfiUgaDrawProtocolGuid, - &Private->UgaDraw, - NULL - ); - } - } else { Status = gBS->OpenProtocol ( Controller, &gEfiGraphicsOutputProtocolGuid, @@ -542,13 +470,10 @@ CirrusLogic5430ControllerDriverStop ( // Status = gBS->UninstallMultipleProtocolInterfaces ( Private->Handle, - &gEfiUgaDrawProtocolGuid, - &Private->UgaDraw, &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput, NULL ); - } if (EFI_ERROR (Status)) { return Status; @@ -582,20 +507,6 @@ CirrusLogic5430ControllerDriverStop ( return EFI_SUCCESS; } -/** - CirrusLogic5430UgaDrawDestructor - - TODO: Private - add argument and description to function comment - TODO: EFI_SUCCESS - add return value to function comment -**/ -EFI_STATUS -CirrusLogic5430UgaDrawDestructor ( - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private - ) -{ - return EFI_SUCCESS; -} - /** TODO: Add function description diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h index 355f0418b3b5..5ec6bcf0d27b 100644 --- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h +++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h @@ -1,7 +1,7 @@ /** @file Cirrus Logic 5430 Controller Driver - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -15,7 +15,6 @@ #include <Uefi.h> -#include <Protocol/UgaDraw.h> #include <Protocol/GraphicsOutput.h> #include <Protocol/PciIo.h> #include <Protocol/DriverSupportedEfiVersion.h> @@ -86,12 +85,10 @@ typedef struct { EFI_HANDLE Handle; EFI_PCI_IO_PROTOCOL *PciIo; UINT64 OriginalPciAttributes; - EFI_UGA_DRAW_PROTOCOL UgaDraw; EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput; EFI_EDID_DISCOVERED_PROTOCOL EdidDiscovered; EFI_EDID_ACTIVE_PROTOCOL EdidActive; EFI_DEVICE_PATH_PROTOCOL *GopDevicePath; - EFI_DEVICE_PATH_PROTOCOL *UgaDevicePath; UINTN CurrentMode; UINTN MaxMode; CIRRUS_LOGIC_5430_MODE_DATA ModeData[CIRRUS_LOGIC_5430_MODE_COUNT]; @@ -112,9 +109,6 @@ typedef struct { UINT8 MiscSetting; } CIRRUS_LOGIC_5430_VIDEO_MODES; -#define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS(a) \ - CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, UgaDraw, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE) - #define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS(a) \ CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, GraphicsOutput, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE) @@ -152,19 +146,6 @@ extern EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL gCirrusLogic5430DriverSupporte #define PALETTE_INDEX_REGISTER 0x3c8 #define PALETTE_DATA_REGISTER 0x3c9 -// -// UGA Draw Hardware abstraction internal worker functions -// -EFI_STATUS -CirrusLogic5430UgaDrawConstructor ( - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private - ); - -EFI_STATUS -CirrusLogic5430UgaDrawDestructor ( - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private - ); - // // Graphics Output Hardware abstraction internal worker functions // diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf index 3e8b7b087f11..359ce486e5ba 100644 --- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf +++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf @@ -9,7 +9,7 @@ # requires both the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's # documentation on UGA for details on how to write a UGA driver that is able # to function both in the EFI pre-boot environment and from the OS runtime. -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -43,7 +43,6 @@ [Sources] ComponentName.c DriverSupportedEfiVersion.c - CirrusLogic5430UgaDraw.c CirrusLogic5430GraphicsOutput.c CirrusLogic5430.c CirrusLogic5430.h @@ -67,7 +66,6 @@ [Protocols] gEfiDriverSupportedEfiVersionProtocolGuid # PROTOCOL ALWAYS_PRODUCED - gEfiUgaDrawProtocolGuid # PROTOCOL BY_START gEfiGraphicsOutputProtocolGuid # PROTOCOL BY_START gEfiEdidDiscoveredProtocolGuid # PROTOCOL BY_START gEfiEdidActiveProtocolGuid # PROTOCOL BY_START @@ -75,10 +73,5 @@ gEfiPciIoProtocolGuid # PROTOCOL TO_START gEfiEdidOverrideProtocolGuid # PROTOCOL TO_START - -[FeaturePcd] - gOptionRomPkgTokenSpaceGuid.PcdSupportGop - gOptionRomPkgTokenSpaceGuid.PcdSupportUga - [Pcd] gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c deleted file mode 100644 index bdcbd3450c5f..000000000000 --- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c +++ /dev/null @@ -1,412 +0,0 @@ -/** @file - This file produces the graphics abstration of UGA Draw. It is called by - CirrusLogic5430.c file which deals with the EFI 1.1 driver model. - This file just does graphics. - - Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "CirrusLogic5430.h" - -// -// UGA Draw Protocol Member Functions -// -EFI_STATUS -EFIAPI -CirrusLogic5430UgaDrawGetMode ( - IN EFI_UGA_DRAW_PROTOCOL *This, - OUT UINT32 *HorizontalResolution, - OUT UINT32 *VerticalResolution, - OUT UINT32 *ColorDepth, - OUT UINT32 *RefreshRate - ) -{ - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private; - - Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); - - if (Private->HardwareNeedsStarting) { - return EFI_NOT_STARTED; - } - - if ((HorizontalResolution == NULL) || - (VerticalResolution == NULL) || - (ColorDepth == NULL) || - (RefreshRate == NULL)) { - return EFI_INVALID_PARAMETER; - } - - *HorizontalResolution = Private->ModeData[Private->CurrentMode].HorizontalResolution; - *VerticalResolution = Private->ModeData[Private->CurrentMode].VerticalResolution; - *ColorDepth = Private->ModeData[Private->CurrentMode].ColorDepth; - *RefreshRate = Private->ModeData[Private->CurrentMode].RefreshRate; - - return EFI_SUCCESS; -} - -EFI_STATUS -EFIAPI -CirrusLogic5430UgaDrawSetMode ( - IN EFI_UGA_DRAW_PROTOCOL *This, - IN UINT32 HorizontalResolution, - IN UINT32 VerticalResolution, - IN UINT32 ColorDepth, - IN UINT32 RefreshRate - ) -{ - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private; - UINTN Index; - - Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); - - for (Index = 0; Index < Private->MaxMode; Index++) { - - if (HorizontalResolution != Private->ModeData[Index].HorizontalResolution) { - continue; - } - - if (VerticalResolution != Private->ModeData[Index].VerticalResolution) { - continue; - } - - if (ColorDepth != Private->ModeData[Index].ColorDepth) { - continue; - } - - if (RefreshRate != Private->ModeData[Index].RefreshRate) { - continue; - } - - if (Private->LineBuffer) { - gBS->FreePool (Private->LineBuffer); - } - - Private->LineBuffer = NULL; - Private->LineBuffer = AllocatePool (HorizontalResolution); - if (Private->LineBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - InitializeGraphicsMode (Private, &CirrusLogic5430VideoModes[Private->ModeData[Index].ModeNumber]); - - Private->CurrentMode = Index; - - Private->HardwareNeedsStarting = FALSE; - - return EFI_SUCCESS; - } - - return EFI_NOT_FOUND; -} - -EFI_STATUS -EFIAPI -CirrusLogic5430UgaDrawBlt ( - IN EFI_UGA_DRAW_PROTOCOL *This, - IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL - IN EFI_UGA_BLT_OPERATION BltOperation, - IN UINTN SourceX, - IN UINTN SourceY, - IN UINTN DestinationX, - IN UINTN DestinationY, - IN UINTN Width, - IN UINTN Height, - IN UINTN Delta - ) -{ - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private; - EFI_TPL OriginalTPL; - UINTN DstY; - UINTN SrcY; - EFI_UGA_PIXEL *Blt; - UINTN X; - UINT8 Pixel; - UINT32 WidePixel; - UINTN ScreenWidth; - UINTN Offset; - UINTN SourceOffset; - - Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); - - if ((UINT32)BltOperation >= EfiUgaBltMax) { - return EFI_INVALID_PARAMETER; - } - - if (Width == 0 || Height == 0) { - return EFI_INVALID_PARAMETER; - } - - // - // If Delta is zero, then the entire BltBuffer is being used, so Delta - // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size, - // the number of bytes in each row can be computed. - // - if (Delta == 0) { - Delta = Width * sizeof (EFI_UGA_PIXEL); - } - - // - // We need to fill the Virtual Screen buffer with the blt data. - // The virtual screen is upside down, as the first row is the bootom row of - // the image. - // - - // - // Make sure the SourceX, SourceY, DestinationX, DestinationY, Width, and Height parameters - // are valid for the operation and the current screen geometry. - // - if (BltOperation == EfiUgaVideoToBltBuffer) { - // - // Video to BltBuffer: Source is Video, destination is BltBuffer - // - if (SourceY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) { - return EFI_INVALID_PARAMETER; - } - - if (SourceX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) { - return EFI_INVALID_PARAMETER; - } - } else { - // - // BltBuffer to Video: Source is BltBuffer, destination is Video - // - if (DestinationY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) { - return EFI_INVALID_PARAMETER; - } - - if (DestinationX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) { - return EFI_INVALID_PARAMETER; - } - } - // - // We have to raise to TPL Notify, so we make an atomic write the frame buffer. - // We would not want a timer based event (Cursor, ...) to come in while we are - // doing this operation. - // - OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY); - - switch (BltOperation) { - case EfiUgaVideoToBltBuffer: - // - // Video to BltBuffer: Source is Video, destination is BltBuffer - // - for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) { - - Offset = (SrcY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + SourceX; - if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) { - Private->PciIo->Mem.Read ( - Private->PciIo, - EfiPciIoWidthUint32, - 0, - Offset, - Width >> 2, - Private->LineBuffer - ); - } else { - Private->PciIo->Mem.Read ( - Private->PciIo, - EfiPciIoWidthUint8, - 0, - Offset, - Width, - Private->LineBuffer - ); - } - - for (X = 0; X < Width; X++) { - Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + (DestinationX + X) * sizeof (EFI_UGA_PIXEL)); - - Blt->Red = (UINT8) (Private->LineBuffer[X] & 0xe0); - Blt->Green = (UINT8) ((Private->LineBuffer[X] & 0x1c) << 3); - Blt->Blue = (UINT8) ((Private->LineBuffer[X] & 0x03) << 6); - } - } - break; - - case EfiUgaVideoToVideo: - // - // Perform hardware acceleration for Video to Video operations - // - ScreenWidth = Private->ModeData[Private->CurrentMode].HorizontalResolution; - SourceOffset = (SourceY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (SourceX); - Offset = (DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (DestinationX); - - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0000); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0010); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0012); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0014); - - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0001); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0011); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0013); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0015); - - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Width << 8) & 0xff00) | 0x20)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Width & 0xff00) | 0x21)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Height << 8) & 0xff00) | 0x22)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Height & 0xff00) | 0x23)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x24)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x25)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x26)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x27)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) << 8) & 0xff00) | 0x28)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 0) & 0xff00) | 0x29)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 8) & 0xff00) | 0x2a)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) << 8) & 0xff00) | 0x2c)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 0) & 0xff00) | 0x2d)); - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 8) & 0xff00) | 0x2e)); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x002f); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0030); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0d32); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0033); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0034); - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0035); - - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0231); - - outb (Private, GRAPH_ADDRESS_REGISTER, 0x31); - while ((inb (Private, GRAPH_DATA_REGISTER) & 0x01) == 0x01) - ; - break; - - case EfiUgaVideoFill: - Blt = BltBuffer; - Pixel = (UINT8) ((Blt->Red & 0xe0) | ((Blt->Green >> 3) & 0x1c) | ((Blt->Blue >> 6) & 0x03)); - WidePixel = (Pixel << 8) | Pixel; - WidePixel = (WidePixel << 16) | WidePixel; - - if (DestinationX == 0 && Width == Private->ModeData[Private->CurrentMode].HorizontalResolution) { - Offset = DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution; - if (((Offset & 0x03) == 0) && (((Width * Height) & 0x03) == 0)) { - Private->PciIo->Mem.Write ( - Private->PciIo, - EfiPciIoWidthFillUint32, - 0, - Offset, - (Width * Height) >> 2, - &WidePixel - ); - } else { - Private->PciIo->Mem.Write ( - Private->PciIo, - EfiPciIoWidthFillUint8, - 0, - Offset, - Width * Height, - &Pixel - ); - } - } else { - for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { - Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX; - if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) { - Private->PciIo->Mem.Write ( - Private->PciIo, - EfiPciIoWidthFillUint32, - 0, - Offset, - Width >> 2, - &WidePixel - ); - } else { - Private->PciIo->Mem.Write ( - Private->PciIo, - EfiPciIoWidthFillUint8, - 0, - Offset, - Width, - &Pixel - ); - } - } - } - break; - - case EfiUgaBltBufferToVideo: - for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { - - for (X = 0; X < Width; X++) { - Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + (SourceX + X) * sizeof (EFI_UGA_PIXEL)); - Private->LineBuffer[X] = (UINT8) ((Blt->Red & 0xe0) | ((Blt->Green >> 3) & 0x1c) | ((Blt->Blue >> 6) & 0x03)); - } - - Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX; - - if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) { - Private->PciIo->Mem.Write ( - Private->PciIo, - EfiPciIoWidthUint32, - 0, - Offset, - Width >> 2, - Private->LineBuffer - ); - } else { - Private->PciIo->Mem.Write ( - Private->PciIo, - EfiPciIoWidthUint8, - 0, - Offset, - Width, - Private->LineBuffer - ); - } - } - break; - - default: - break; - } - - gBS->RestoreTPL (OriginalTPL); - - return EFI_SUCCESS; -} - -// -// Construction and Destruction functions -// -EFI_STATUS -CirrusLogic5430UgaDrawConstructor ( - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private - ) -{ - EFI_UGA_DRAW_PROTOCOL *UgaDraw; - - // - // Fill in Private->UgaDraw protocol - // - UgaDraw = &Private->UgaDraw; - - UgaDraw->GetMode = CirrusLogic5430UgaDrawGetMode; - UgaDraw->SetMode = CirrusLogic5430UgaDrawSetMode; - UgaDraw->Blt = CirrusLogic5430UgaDrawBlt; - - // - // Initialize the private data - // - Private->CurrentMode = 0; - Private->HardwareNeedsStarting = TRUE; - Private->LineBuffer = NULL; - - // - // Initialize the hardware - // - UgaDraw->SetMode ( - UgaDraw, - Private->ModeData[Private->CurrentMode].HorizontalResolution, - Private->ModeData[Private->CurrentMode].VerticalResolution, - Private->ModeData[Private->CurrentMode].ColorDepth, - Private->ModeData[Private->CurrentMode].RefreshRate - ); - DrawLogo ( - Private, - Private->ModeData[Private->CurrentMode].HorizontalResolution, - Private->ModeData[Private->CurrentMode].VerticalResolution - ); - - return EFI_SUCCESS; -} - diff --git a/Drivers/OptionRomPkg/OptionRomPkg.dec b/Drivers/OptionRomPkg/OptionRomPkg.dec index 6881f3648ede..14957349aab7 100644 --- a/Drivers/OptionRomPkg/OptionRomPkg.dec +++ b/Drivers/OptionRomPkg/OptionRomPkg.dec @@ -33,9 +33,6 @@ [PcdsFeatureFlag] gOptionRomPkgTokenSpaceGuid.PcdSupportScsiPassThru|TRUE|BOOLEAN|0x00010001 gOptionRomPkgTokenSpaceGuid.PcdSupportExtScsiPassThru|TRUE|BOOLEAN|0x00010002 - gOptionRomPkgTokenSpaceGuid.PcdSupportGop|TRUE|BOOLEAN|0x00010004 - gOptionRomPkgTokenSpaceGuid.PcdSupportUga|TRUE|BOOLEAN|0x00010005 [PcdsFixedAtBuild, PcdsPatchableInModule] gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion|0x0002000a|UINT32|0x00010003 - -- 2.26.2.windows.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [edk2-platforms Patch v2 3/3] OptionRomPkg: Remove all UGA support 2022-07-13 7:32 ` [edk2-platforms Patch v2 3/3] OptionRomPkg: " Guomin Jiang @ 2022-07-13 7:49 ` Ni, Ray 0 siblings, 0 replies; 6+ messages in thread From: Ni, Ray @ 2022-07-13 7:49 UTC (permalink / raw) To: Jiang, Guomin, devel@edk2.groups.io Reviewed-by: Ray Ni <ray.ni@intel.com> > -----Original Message----- > From: Jiang, Guomin <guomin.jiang@intel.com> > Sent: Wednesday, July 13, 2022 3:32 PM > To: devel@edk2.groups.io > Cc: Ni, Ray <ray.ni@intel.com> > Subject: [edk2-platforms Patch v2 3/3] OptionRomPkg: Remove all UGA support > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368 > > Remove all UGA support > > Cc: Ray Ni <ray.ni@intel.com> > Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> > --- > .../CirrusLogic5430Dxe/CirrusLogic5430.c | 91 +--- > .../CirrusLogic5430Dxe/CirrusLogic5430.h | 21 +- > .../CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf | 9 +- > .../CirrusLogic5430UgaDraw.c | 412 ------------------ > Drivers/OptionRomPkg/OptionRomPkg.dec | 3 - > 5 files changed, 3 insertions(+), 533 deletions(-) > delete mode 100644 Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c > > diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c > b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c > index 4e7830ea94b3..48e0c012957a 100644 > --- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c > +++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c > @@ -11,7 +11,7 @@ > documentation on UGA for details on how to write a UGA driver that is able > to function both in the EFI pre-boot environment and from the OS runtime. > > - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> > + Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR> > SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -316,7 +316,6 @@ CirrusLogic5430ControllerDriverStart ( > goto Error; > } > > - if (FeaturePcdGet (PcdSupportGop)) { > // > // Set Gop Device Path > // > @@ -357,7 +356,6 @@ CirrusLogic5430ControllerDriverStart ( > NULL > ); > } > - } > > // > // Construct video mode buffer > @@ -367,24 +365,6 @@ CirrusLogic5430ControllerDriverStart ( > goto Error; > } > > - if (FeaturePcdGet (PcdSupportUga)) { > - // > - // Start the UGA Draw software stack. > - // > - Status = CirrusLogic5430UgaDrawConstructor (Private); > - ASSERT_EFI_ERROR (Status); > - > - Private->UgaDevicePath = ParentDevicePath; > - Status = gBS->InstallMultipleProtocolInterfaces ( > - &Controller, > - &gEfiUgaDrawProtocolGuid, > - &Private->UgaDraw, > - &gEfiDevicePathProtocolGuid, > - Private->UgaDevicePath, > - NULL > - ); > - > - } else if (FeaturePcdGet (PcdSupportGop)) { > if (Private->GopDevicePath == NULL) { > // > // If RemainingDevicePath is the End of Device Path Node, > @@ -410,14 +390,6 @@ CirrusLogic5430ControllerDriverStart ( > NULL > ); > } > - } else { > - // > - // This driver must support eithor GOP or UGA or both. > - // > - ASSERT (FALSE); > - Status = EFI_UNSUPPORTED; > - } > - > > Error: > if (EFI_ERROR (Status)) { > @@ -470,55 +442,11 @@ CirrusLogic5430ControllerDriverStop ( > IN EFI_HANDLE *ChildHandleBuffer > ) > { > - EFI_UGA_DRAW_PROTOCOL *UgaDraw; > EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; > > EFI_STATUS Status; > CIRRUS_LOGIC_5430_PRIVATE_DATA *Private; > > - if (FeaturePcdGet (PcdSupportUga)) { > - Status = gBS->OpenProtocol ( > - Controller, > - &gEfiUgaDrawProtocolGuid, > - (VOID **) &UgaDraw, > - This->DriverBindingHandle, > - Controller, > - EFI_OPEN_PROTOCOL_GET_PROTOCOL > - ); > - if (EFI_ERROR (Status)) { > - return Status; > - } > - // > - // Get our private context information > - // > - Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw); > - CirrusLogic5430UgaDrawDestructor (Private); > - > - if (FeaturePcdGet (PcdSupportGop)) { > - CirrusLogic5430GraphicsOutputDestructor (Private); > - // > - // Remove the UGA and GOP protocol interface from the system > - // > - Status = gBS->UninstallMultipleProtocolInterfaces ( > - Private->Handle, > - &gEfiUgaDrawProtocolGuid, > - &Private->UgaDraw, > - &gEfiGraphicsOutputProtocolGuid, > - &Private->GraphicsOutput, > - NULL > - ); > - } else { > - // > - // Remove the UGA Draw interface from the system > - // > - Status = gBS->UninstallMultipleProtocolInterfaces ( > - Private->Handle, > - &gEfiUgaDrawProtocolGuid, > - &Private->UgaDraw, > - NULL > - ); > - } > - } else { > Status = gBS->OpenProtocol ( > Controller, > &gEfiGraphicsOutputProtocolGuid, > @@ -542,13 +470,10 @@ CirrusLogic5430ControllerDriverStop ( > // > Status = gBS->UninstallMultipleProtocolInterfaces ( > Private->Handle, > - &gEfiUgaDrawProtocolGuid, > - &Private->UgaDraw, > &gEfiGraphicsOutputProtocolGuid, > &Private->GraphicsOutput, > NULL > ); > - } > > if (EFI_ERROR (Status)) { > return Status; > @@ -582,20 +507,6 @@ CirrusLogic5430ControllerDriverStop ( > return EFI_SUCCESS; > } > > -/** > - CirrusLogic5430UgaDrawDestructor > - > - TODO: Private - add argument and description to function comment > - TODO: EFI_SUCCESS - add return value to function comment > -**/ > -EFI_STATUS > -CirrusLogic5430UgaDrawDestructor ( > - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private > - ) > -{ > - return EFI_SUCCESS; > -} > - > /** > TODO: Add function description > > diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h > b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h > index 355f0418b3b5..5ec6bcf0d27b 100644 > --- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h > +++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.h > @@ -1,7 +1,7 @@ > /** @file > Cirrus Logic 5430 Controller Driver > > - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> > + Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR> > SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -15,7 +15,6 @@ > > > #include <Uefi.h> > -#include <Protocol/UgaDraw.h> > #include <Protocol/GraphicsOutput.h> > #include <Protocol/PciIo.h> > #include <Protocol/DriverSupportedEfiVersion.h> > @@ -86,12 +85,10 @@ typedef struct { > EFI_HANDLE Handle; > EFI_PCI_IO_PROTOCOL *PciIo; > UINT64 OriginalPciAttributes; > - EFI_UGA_DRAW_PROTOCOL UgaDraw; > EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput; > EFI_EDID_DISCOVERED_PROTOCOL EdidDiscovered; > EFI_EDID_ACTIVE_PROTOCOL EdidActive; > EFI_DEVICE_PATH_PROTOCOL *GopDevicePath; > - EFI_DEVICE_PATH_PROTOCOL *UgaDevicePath; > UINTN CurrentMode; > UINTN MaxMode; > CIRRUS_LOGIC_5430_MODE_DATA ModeData[CIRRUS_LOGIC_5430_MODE_COUNT]; > @@ -112,9 +109,6 @@ typedef struct { > UINT8 MiscSetting; > } CIRRUS_LOGIC_5430_VIDEO_MODES; > > -#define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS(a) \ > - CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, UgaDraw, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE) > - > #define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS(a) \ > CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, GraphicsOutput, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE) > > @@ -152,19 +146,6 @@ extern EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL gCirrusLogic5430DriverSupporte > #define PALETTE_INDEX_REGISTER 0x3c8 > #define PALETTE_DATA_REGISTER 0x3c9 > > -// > -// UGA Draw Hardware abstraction internal worker functions > -// > -EFI_STATUS > -CirrusLogic5430UgaDrawConstructor ( > - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private > - ); > - > -EFI_STATUS > -CirrusLogic5430UgaDrawDestructor ( > - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private > - ); > - > // > // Graphics Output Hardware abstraction internal worker functions > // > diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf > b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf > index 3e8b7b087f11..359ce486e5ba 100644 > --- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf > +++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf > @@ -9,7 +9,7 @@ > # requires both the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's > # documentation on UGA for details on how to write a UGA driver that is able > # to function both in the EFI pre-boot environment and from the OS runtime. > -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR> > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -43,7 +43,6 @@ > [Sources] > ComponentName.c > DriverSupportedEfiVersion.c > - CirrusLogic5430UgaDraw.c > CirrusLogic5430GraphicsOutput.c > CirrusLogic5430.c > CirrusLogic5430.h > @@ -67,7 +66,6 @@ > > [Protocols] > gEfiDriverSupportedEfiVersionProtocolGuid # PROTOCOL ALWAYS_PRODUCED > - gEfiUgaDrawProtocolGuid # PROTOCOL BY_START > gEfiGraphicsOutputProtocolGuid # PROTOCOL BY_START > gEfiEdidDiscoveredProtocolGuid # PROTOCOL BY_START > gEfiEdidActiveProtocolGuid # PROTOCOL BY_START > @@ -75,10 +73,5 @@ > gEfiPciIoProtocolGuid # PROTOCOL TO_START > gEfiEdidOverrideProtocolGuid # PROTOCOL TO_START > > - > -[FeaturePcd] > - gOptionRomPkgTokenSpaceGuid.PcdSupportGop > - gOptionRomPkgTokenSpaceGuid.PcdSupportUga > - > [Pcd] > gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion > diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c > b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c > deleted file mode 100644 > index bdcbd3450c5f..000000000000 > --- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c > +++ /dev/null > @@ -1,412 +0,0 @@ > -/** @file > - This file produces the graphics abstration of UGA Draw. It is called by > - CirrusLogic5430.c file which deals with the EFI 1.1 driver model. > - This file just does graphics. > - > - Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#include "CirrusLogic5430.h" > - > -// > -// UGA Draw Protocol Member Functions > -// > -EFI_STATUS > -EFIAPI > -CirrusLogic5430UgaDrawGetMode ( > - IN EFI_UGA_DRAW_PROTOCOL *This, > - OUT UINT32 *HorizontalResolution, > - OUT UINT32 *VerticalResolution, > - OUT UINT32 *ColorDepth, > - OUT UINT32 *RefreshRate > - ) > -{ > - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private; > - > - Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); > - > - if (Private->HardwareNeedsStarting) { > - return EFI_NOT_STARTED; > - } > - > - if ((HorizontalResolution == NULL) || > - (VerticalResolution == NULL) || > - (ColorDepth == NULL) || > - (RefreshRate == NULL)) { > - return EFI_INVALID_PARAMETER; > - } > - > - *HorizontalResolution = Private->ModeData[Private->CurrentMode].HorizontalResolution; > - *VerticalResolution = Private->ModeData[Private->CurrentMode].VerticalResolution; > - *ColorDepth = Private->ModeData[Private->CurrentMode].ColorDepth; > - *RefreshRate = Private->ModeData[Private->CurrentMode].RefreshRate; > - > - return EFI_SUCCESS; > -} > - > -EFI_STATUS > -EFIAPI > -CirrusLogic5430UgaDrawSetMode ( > - IN EFI_UGA_DRAW_PROTOCOL *This, > - IN UINT32 HorizontalResolution, > - IN UINT32 VerticalResolution, > - IN UINT32 ColorDepth, > - IN UINT32 RefreshRate > - ) > -{ > - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private; > - UINTN Index; > - > - Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); > - > - for (Index = 0; Index < Private->MaxMode; Index++) { > - > - if (HorizontalResolution != Private->ModeData[Index].HorizontalResolution) { > - continue; > - } > - > - if (VerticalResolution != Private->ModeData[Index].VerticalResolution) { > - continue; > - } > - > - if (ColorDepth != Private->ModeData[Index].ColorDepth) { > - continue; > - } > - > - if (RefreshRate != Private->ModeData[Index].RefreshRate) { > - continue; > - } > - > - if (Private->LineBuffer) { > - gBS->FreePool (Private->LineBuffer); > - } > - > - Private->LineBuffer = NULL; > - Private->LineBuffer = AllocatePool (HorizontalResolution); > - if (Private->LineBuffer == NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - InitializeGraphicsMode (Private, &CirrusLogic5430VideoModes[Private->ModeData[Index].ModeNumber]); > - > - Private->CurrentMode = Index; > - > - Private->HardwareNeedsStarting = FALSE; > - > - return EFI_SUCCESS; > - } > - > - return EFI_NOT_FOUND; > -} > - > -EFI_STATUS > -EFIAPI > -CirrusLogic5430UgaDrawBlt ( > - IN EFI_UGA_DRAW_PROTOCOL *This, > - IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL > - IN EFI_UGA_BLT_OPERATION BltOperation, > - IN UINTN SourceX, > - IN UINTN SourceY, > - IN UINTN DestinationX, > - IN UINTN DestinationY, > - IN UINTN Width, > - IN UINTN Height, > - IN UINTN Delta > - ) > -{ > - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private; > - EFI_TPL OriginalTPL; > - UINTN DstY; > - UINTN SrcY; > - EFI_UGA_PIXEL *Blt; > - UINTN X; > - UINT8 Pixel; > - UINT32 WidePixel; > - UINTN ScreenWidth; > - UINTN Offset; > - UINTN SourceOffset; > - > - Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); > - > - if ((UINT32)BltOperation >= EfiUgaBltMax) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (Width == 0 || Height == 0) { > - return EFI_INVALID_PARAMETER; > - } > - > - // > - // If Delta is zero, then the entire BltBuffer is being used, so Delta > - // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size, > - // the number of bytes in each row can be computed. > - // > - if (Delta == 0) { > - Delta = Width * sizeof (EFI_UGA_PIXEL); > - } > - > - // > - // We need to fill the Virtual Screen buffer with the blt data. > - // The virtual screen is upside down, as the first row is the bootom row of > - // the image. > - // > - > - // > - // Make sure the SourceX, SourceY, DestinationX, DestinationY, Width, and Height parameters > - // are valid for the operation and the current screen geometry. > - // > - if (BltOperation == EfiUgaVideoToBltBuffer) { > - // > - // Video to BltBuffer: Source is Video, destination is BltBuffer > - // > - if (SourceY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (SourceX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) { > - return EFI_INVALID_PARAMETER; > - } > - } else { > - // > - // BltBuffer to Video: Source is BltBuffer, destination is Video > - // > - if (DestinationY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) { > - return EFI_INVALID_PARAMETER; > - } > - > - if (DestinationX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) { > - return EFI_INVALID_PARAMETER; > - } > - } > - // > - // We have to raise to TPL Notify, so we make an atomic write the frame buffer. > - // We would not want a timer based event (Cursor, ...) to come in while we are > - // doing this operation. > - // > - OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY); > - > - switch (BltOperation) { > - case EfiUgaVideoToBltBuffer: > - // > - // Video to BltBuffer: Source is Video, destination is BltBuffer > - // > - for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) { > - > - Offset = (SrcY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + SourceX; > - if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) { > - Private->PciIo->Mem.Read ( > - Private->PciIo, > - EfiPciIoWidthUint32, > - 0, > - Offset, > - Width >> 2, > - Private->LineBuffer > - ); > - } else { > - Private->PciIo->Mem.Read ( > - Private->PciIo, > - EfiPciIoWidthUint8, > - 0, > - Offset, > - Width, > - Private->LineBuffer > - ); > - } > - > - for (X = 0; X < Width; X++) { > - Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + (DestinationX + X) * sizeof (EFI_UGA_PIXEL)); > - > - Blt->Red = (UINT8) (Private->LineBuffer[X] & 0xe0); > - Blt->Green = (UINT8) ((Private->LineBuffer[X] & 0x1c) << 3); > - Blt->Blue = (UINT8) ((Private->LineBuffer[X] & 0x03) << 6); > - } > - } > - break; > - > - case EfiUgaVideoToVideo: > - // > - // Perform hardware acceleration for Video to Video operations > - // > - ScreenWidth = Private->ModeData[Private->CurrentMode].HorizontalResolution; > - SourceOffset = (SourceY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (SourceX); > - Offset = (DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (DestinationX); > - > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0000); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0010); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0012); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0014); > - > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0001); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0011); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0013); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0015); > - > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Width << 8) & 0xff00) | 0x20)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Width & 0xff00) | 0x21)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Height << 8) & 0xff00) | 0x22)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Height & 0xff00) | 0x23)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x24)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x25)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x26)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x27)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) << 8) & 0xff00) | 0x28)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 0) & 0xff00) | 0x29)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 8) & 0xff00) | 0x2a)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) << 8) & 0xff00) | 0x2c)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 0) & 0xff00) | 0x2d)); > - outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 8) & 0xff00) | 0x2e)); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x002f); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0030); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0d32); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0033); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0034); > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0035); > - > - outw (Private, GRAPH_ADDRESS_REGISTER, 0x0231); > - > - outb (Private, GRAPH_ADDRESS_REGISTER, 0x31); > - while ((inb (Private, GRAPH_DATA_REGISTER) & 0x01) == 0x01) > - ; > - break; > - > - case EfiUgaVideoFill: > - Blt = BltBuffer; > - Pixel = (UINT8) ((Blt->Red & 0xe0) | ((Blt->Green >> 3) & 0x1c) | ((Blt->Blue >> 6) & 0x03)); > - WidePixel = (Pixel << 8) | Pixel; > - WidePixel = (WidePixel << 16) | WidePixel; > - > - if (DestinationX == 0 && Width == Private->ModeData[Private->CurrentMode].HorizontalResolution) { > - Offset = DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution; > - if (((Offset & 0x03) == 0) && (((Width * Height) & 0x03) == 0)) { > - Private->PciIo->Mem.Write ( > - Private->PciIo, > - EfiPciIoWidthFillUint32, > - 0, > - Offset, > - (Width * Height) >> 2, > - &WidePixel > - ); > - } else { > - Private->PciIo->Mem.Write ( > - Private->PciIo, > - EfiPciIoWidthFillUint8, > - 0, > - Offset, > - Width * Height, > - &Pixel > - ); > - } > - } else { > - for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { > - Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX; > - if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) { > - Private->PciIo->Mem.Write ( > - Private->PciIo, > - EfiPciIoWidthFillUint32, > - 0, > - Offset, > - Width >> 2, > - &WidePixel > - ); > - } else { > - Private->PciIo->Mem.Write ( > - Private->PciIo, > - EfiPciIoWidthFillUint8, > - 0, > - Offset, > - Width, > - &Pixel > - ); > - } > - } > - } > - break; > - > - case EfiUgaBltBufferToVideo: > - for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { > - > - for (X = 0; X < Width; X++) { > - Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + (SourceX + X) * sizeof (EFI_UGA_PIXEL)); > - Private->LineBuffer[X] = (UINT8) ((Blt->Red & 0xe0) | ((Blt->Green >> 3) & 0x1c) | ((Blt->Blue >> 6) & 0x03)); > - } > - > - Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX; > - > - if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) { > - Private->PciIo->Mem.Write ( > - Private->PciIo, > - EfiPciIoWidthUint32, > - 0, > - Offset, > - Width >> 2, > - Private->LineBuffer > - ); > - } else { > - Private->PciIo->Mem.Write ( > - Private->PciIo, > - EfiPciIoWidthUint8, > - 0, > - Offset, > - Width, > - Private->LineBuffer > - ); > - } > - } > - break; > - > - default: > - break; > - } > - > - gBS->RestoreTPL (OriginalTPL); > - > - return EFI_SUCCESS; > -} > - > -// > -// Construction and Destruction functions > -// > -EFI_STATUS > -CirrusLogic5430UgaDrawConstructor ( > - CIRRUS_LOGIC_5430_PRIVATE_DATA *Private > - ) > -{ > - EFI_UGA_DRAW_PROTOCOL *UgaDraw; > - > - // > - // Fill in Private->UgaDraw protocol > - // > - UgaDraw = &Private->UgaDraw; > - > - UgaDraw->GetMode = CirrusLogic5430UgaDrawGetMode; > - UgaDraw->SetMode = CirrusLogic5430UgaDrawSetMode; > - UgaDraw->Blt = CirrusLogic5430UgaDrawBlt; > - > - // > - // Initialize the private data > - // > - Private->CurrentMode = 0; > - Private->HardwareNeedsStarting = TRUE; > - Private->LineBuffer = NULL; > - > - // > - // Initialize the hardware > - // > - UgaDraw->SetMode ( > - UgaDraw, > - Private->ModeData[Private->CurrentMode].HorizontalResolution, > - Private->ModeData[Private->CurrentMode].VerticalResolution, > - Private->ModeData[Private->CurrentMode].ColorDepth, > - Private->ModeData[Private->CurrentMode].RefreshRate > - ); > - DrawLogo ( > - Private, > - Private->ModeData[Private->CurrentMode].HorizontalResolution, > - Private->ModeData[Private->CurrentMode].VerticalResolution > - ); > - > - return EFI_SUCCESS; > -} > - > diff --git a/Drivers/OptionRomPkg/OptionRomPkg.dec b/Drivers/OptionRomPkg/OptionRomPkg.dec > index 6881f3648ede..14957349aab7 100644 > --- a/Drivers/OptionRomPkg/OptionRomPkg.dec > +++ b/Drivers/OptionRomPkg/OptionRomPkg.dec > @@ -33,9 +33,6 @@ > [PcdsFeatureFlag] > gOptionRomPkgTokenSpaceGuid.PcdSupportScsiPassThru|TRUE|BOOLEAN|0x00010001 > gOptionRomPkgTokenSpaceGuid.PcdSupportExtScsiPassThru|TRUE|BOOLEAN|0x00010002 > - gOptionRomPkgTokenSpaceGuid.PcdSupportGop|TRUE|BOOLEAN|0x00010004 > - gOptionRomPkgTokenSpaceGuid.PcdSupportUga|TRUE|BOOLEAN|0x00010005 > > [PcdsFixedAtBuild, PcdsPatchableInModule] > gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion|0x0002000a|UINT32|0x00010003 > - > -- > 2.26.2.windows.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [edk2-platforms Patch v2 0/3] Remove all UGA support 2022-07-13 7:31 [edk2-platforms Patch v2 0/3] Remove all UGA support Guomin Jiang ` (2 preceding siblings ...) 2022-07-13 7:32 ` [edk2-platforms Patch v2 3/3] OptionRomPkg: " Guomin Jiang @ 2022-07-13 15:06 ` Michael D Kinney 3 siblings, 0 replies; 6+ messages in thread From: Michael D Kinney @ 2022-07-13 15:06 UTC (permalink / raw) To: devel@edk2.groups.io, Jiang, Guomin, Kinney, Michael D Series Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Mike > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Guomin Jiang > Sent: Wednesday, July 13, 2022 12:32 AM > To: devel@edk2.groups.io > Subject: [edk2-devel] [edk2-platforms Patch v2 0/3] Remove all UGA support > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368 > > Remove all UGA support > > Guomin Jiang (3): > PurleyOpenBoardPkg: Remove All UGA support > BoardModulePkg: Remove all UGA support > OptionRomPkg: Remove all UGA support > > .../CirrusLogic5430Dxe/CirrusLogic5430.c | 91 +--- > .../CirrusLogic5430Dxe/CirrusLogic5430.h | 21 +- > .../CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf | 9 +- > .../CirrusLogic5430UgaDraw.c | 412 ------------------ > Drivers/OptionRomPkg/OptionRomPkg.dec | 3 - > .../Library/BoardBdsHookLib/BoardBdsHook.h | 3 +- > .../Library/BoardBdsHookLib/BoardBdsHook.h | 3 +- > 7 files changed, 5 insertions(+), 537 deletions(-) > delete mode 100644 Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c > > -- > 2.26.2.windows.1 > > > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-13 15:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-07-13 7:31 [edk2-platforms Patch v2 0/3] Remove all UGA support Guomin Jiang 2022-07-13 7:31 ` [edk2-platforms Patch v2 1/3] PurleyOpenBoardPkg: Remove All " Guomin Jiang 2022-07-13 7:31 ` [edk2-platforms Patch v2 2/3] BoardModulePkg: Remove all " Guomin Jiang 2022-07-13 7:32 ` [edk2-platforms Patch v2 3/3] OptionRomPkg: " Guomin Jiang 2022-07-13 7:49 ` Ni, Ray 2022-07-13 15:06 ` [edk2-devel] [edk2-platforms Patch v2 0/3] " Michael D Kinney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox