From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.96.140; helo=cam-smtp0.cambridge.arm.com; envelope-from=evan.lloyd@arm.com; receiver=edk2-devel@lists.01.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5AD9120945BA4 for ; Tue, 26 Sep 2017 13:12:27 -0700 (PDT) Received: from E111747.Emea.Arm.com (e111747.emea.arm.com [10.1.27.40]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v8QKFY5f017392; Tue, 26 Sep 2017 21:15:38 +0100 From: evan.lloyd@arm.com To: edk2-devel@lists.01.org Cc: "ard.biesheuvel@linaro.org"@arm.com, "leif.lindholm@linaro.org"@arm.com, "Matteo.Carlini@arm.com"@arm.com, "nd@arm.com"@arm.com Date: Tue, 26 Sep 2017 21:15:26 +0100 Message-Id: <20170926201529.11644-17-evan.lloyd@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170926201529.11644-1-evan.lloyd@arm.com> References: <20170926201529.11644-1-evan.lloyd@arm.com> Subject: [PATCH 16/19] ArmPlatformPkg: Reorganize Lcd Graphics Output X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 20:12:28 -0000 From: Girish Pathak Currently for ArmPlatformPkg, the UEFI Graphics Output Protocol is implemented using platform specific Libraries ((PL111|Hd)LcdArmVExpressLib) and DXE drivers ((PL111|Hd)LcdGraphicsOutputDxe). The platform library handles variations such as platform supported display modes, memory management of the frame buffer, and clock/mux setting. The DXE driver implements the GOP protocol and manages the respective display controller. Although this implementation works for current platforms, we think the way the current DXE driver sources are linked is sub-optimal and needs to be improved, before additions. This change effectively partitions HdLcd.c and PL111Lcd.c from LcdGraphicsOutputProtocol and creates two libraries of type LcdHwLib which can be selected in the platform specific .dsc file. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak Signed-off-by: Evan Lloyd --- ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 3 +- ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 2 +- ArmPlatformPkg/Drivers/{LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf => HdLcd/HdLcd.inf} | 25 +------- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/{PL111LcdGraphicsOutputDxe.inf => LcdGraphicsOutputDxe.inf} | 15 ++--- ArmPlatformPkg/Drivers/{LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf => PL111Lcd/PL111Lcd.inf} | 28 ++------- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h | 21 ------- ArmPlatformPkg/Include/Drivers/LcdHw.h | 64 ++++++++++++++++++++ ArmPlatformPkg/Include/Library/LcdPlatformLib.h | 1 + ArmPlatformPkg/Drivers/{LcdGraphicsOutputDxe => HdLcd}/HdLcd.c | 3 +- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c | 2 + ArmPlatformPkg/Drivers/{LcdGraphicsOutputDxe => PL111Lcd}/PL111Lcd.c | 5 +- 11 files changed, 85 insertions(+), 84 deletions(-) diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index 37756481596c7e978ed9ed0a932eeb2aa0a3b657..1fe93a53f81c46955c62383a2bad0e19a9662015 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -18,7 +18,7 @@ [Defines] INF_VERSION = 0x00010005 BASE_NAME = HdLcdArmVExpress FILE_GUID = 535a720e-06c0-4bb9-b563-452216abbed4 - MODULE_TYPE = DXE_DRIVER + MODULE_TYPE = BASE VERSION_STRING = 1.0 LIBRARY_CLASS = LcdPlatformLib @@ -40,6 +40,5 @@ [Protocols] gEfiEdidActiveProtocolGuid # Produced [FixedPcd] - gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId gArmPlatformTokenSpaceGuid.PcdGopPixelFormat diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf index 6f1cb3b55ff814d007718b5597f821dd20100477..f6d5bf76dd375d97bac63ca427cc231792b9e52b 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf @@ -18,7 +18,7 @@ [Defines] INF_VERSION = 0x00010005 BASE_NAME = PL111LcdArmVExpressLib FILE_GUID = b7f06f20-496f-11e0-a8e8-0002a5d5c51b - MODULE_TYPE = DXE_DRIVER + MODULE_TYPE = BASE VERSION_STRING = 1.0 LIBRARY_CLASS = LcdPlatformLib diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf b/ArmPlatformPkg/Drivers/HdLcd/HdLcd.inf similarity index 59% rename from ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf rename to ArmPlatformPkg/Drivers/HdLcd/HdLcd.inf index b050add98e3f9cf62ac335883193b9d0928c3dc9..e43c894538cfd7985862997aaa1b8a381cb6423a 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf +++ b/ArmPlatformPkg/Drivers/HdLcd/HdLcd.inf @@ -16,15 +16,13 @@ [Defines] INF_VERSION = 0x00010005 - BASE_NAME = HdLcdGraphicsDxe + BASE_NAME = HdLcd FILE_GUID = ce660500-824d-11e0-ac72-0002a5d5c51b - MODULE_TYPE = DXE_DRIVER + MODULE_TYPE = BASE VERSION_STRING = 1.0 - ENTRY_POINT = LcdGraphicsOutputDxeInitialize + LIBRARY_CLASS = LcdHwLib [Sources.common] - LcdGraphicsOutputDxe.c - LcdGraphicsOutputBlt.c HdLcd.c [Packages] @@ -39,26 +37,9 @@ [LibraryClasses] UefiLib BaseLib DebugLib - TimerLib - UefiDriverEntryPoint - UefiBootServicesTableLib IoLib - BaseMemoryLib - LcdPlatformLib - -[Protocols] - gEfiDevicePathProtocolGuid - gEfiGraphicsOutputProtocolGuid # Produced - gEfiEdidDiscoveredProtocolGuid # Produced - gEfiEdidActiveProtocolGuid # Produced - gEfiEdidOverrideProtocolGuid # Produced [FixedPcd] gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect -[FeaturePcd] - gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices - -[Depex] - gEfiCpuArchProtocolGuid diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf similarity index 78% copy from ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf copy to ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf index ad0348500326c4567f0e1b235c84b694e61306bf..edd03c7eb1c39e397c72a4c22e7d05ab21b53def 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf @@ -2,7 +2,7 @@ # # Component description file for PL111LcdGraphicsOutputDxe module # -# Copyright (c) 2011-2017, ARM Ltd. All rights reserved.
+# Copyright (c) 2017, ARM Ltd. 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 @@ -15,8 +15,8 @@ [Defines] INF_VERSION = 0x00010005 - BASE_NAME = PL111LcdGraphicsDxe - FILE_GUID = 407B4008-BF5B-11DF-9547-CF16E0D72085 + BASE_NAME = LcdGraphicsDxe + FILE_GUID = 89464DAE-8DAA-41FE-A4C8-40D2175AF1E9 MODULE_TYPE = DXE_DRIVER VERSION_STRING = 1.0 ENTRY_POINT = LcdGraphicsOutputDxeInitialize @@ -24,7 +24,6 @@ [Defines] [Sources.common] LcdGraphicsOutputDxe.c LcdGraphicsOutputBlt.c - PL111Lcd.c [Packages] MdePkg/MdePkg.dec @@ -38,22 +37,18 @@ [LibraryClasses] UefiLib BaseLib DebugLib - TimerLib UefiDriverEntryPoint UefiBootServicesTableLib - IoLib BaseMemoryLib LcdPlatformLib + LcdHwLib [Protocols] gEfiDevicePathProtocolGuid gEfiGraphicsOutputProtocolGuid -[FixedPcd] - gArmPlatformTokenSpaceGuid.PcdPL111LcdBase - [FeaturePcd] gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices [Depex] - gEfiCpuArchProtocolGuid + TRUE diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf b/ArmPlatformPkg/Drivers/PL111Lcd/PL111Lcd.inf similarity index 59% rename from ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf rename to ArmPlatformPkg/Drivers/PL111Lcd/PL111Lcd.inf index ad0348500326c4567f0e1b235c84b694e61306bf..8e571a02476142af787db90c0ee240a784b74a63 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf +++ b/ArmPlatformPkg/Drivers/PL111Lcd/PL111Lcd.inf @@ -1,6 +1,6 @@ -#/** @file PL111LcdGraphicsOutputDxe.inf +#/** @file PL111Lcd.inf # -# Component description file for PL111LcdGraphicsOutputDxe module +# Component description file for PL111Lcd module # # Copyright (c) 2011-2017, ARM Ltd. All rights reserved.
# This program and the accompanying materials @@ -15,15 +15,13 @@ [Defines] INF_VERSION = 0x00010005 - BASE_NAME = PL111LcdGraphicsDxe + BASE_NAME = PL111Lcd FILE_GUID = 407B4008-BF5B-11DF-9547-CF16E0D72085 - MODULE_TYPE = DXE_DRIVER + MODULE_TYPE = BASE VERSION_STRING = 1.0 - ENTRY_POINT = LcdGraphicsOutputDxeInitialize + LIBRARY_CLASS = LcdHwLib [Sources.common] - LcdGraphicsOutputDxe.c - LcdGraphicsOutputBlt.c PL111Lcd.c [Packages] @@ -34,26 +32,10 @@ [Packages] ArmPlatformPkg/ArmPlatformPkg.dec [LibraryClasses] - ArmLib UefiLib BaseLib DebugLib - TimerLib - UefiDriverEntryPoint - UefiBootServicesTableLib IoLib - BaseMemoryLib - LcdPlatformLib - -[Protocols] - gEfiDevicePathProtocolGuid - gEfiGraphicsOutputProtocolGuid [FixedPcd] gArmPlatformTokenSpaceGuid.PcdPL111LcdBase - -[FeaturePcd] - gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices - -[Depex] - gEfiCpuArchProtocolGuid diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h index 85e918de66624d61c6d0e05c5a67c516cd7619aa..76a710fda59279a6642dc2408c790afcf49360b8 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -92,7 +91,6 @@ UINTN GetBytesPerPixel ( IN LCD_BPP Bpp ); - EFI_STATUS EFIAPI GraphicsOutputDxeInitialize ( @@ -105,23 +103,4 @@ InitializeDisplay ( IN LCD_INSTANCE* Instance ); -EFI_STATUS -LcdIdentify ( - VOID -); - -EFI_STATUS -LcdInitialize ( - EFI_PHYSICAL_ADDRESS VramBaseAddress -); - -EFI_STATUS -LcdSetMode ( - IN UINT32 ModeNumber -); - -VOID -LcdShutdown ( - VOID -); #endif /* LCD_GRAPHICS_OUTPUT_DXE_H_ */ diff --git a/ArmPlatformPkg/Include/Drivers/LcdHw.h b/ArmPlatformPkg/Include/Drivers/LcdHw.h new file mode 100644 index 0000000000000000000000000000000000000000..1f5b9c0b7e7decbf1136614b5b1b482ccd805604 --- /dev/null +++ b/ArmPlatformPkg/Include/Drivers/LcdHw.h @@ -0,0 +1,64 @@ +/** @file LcdHw.h + + This file contains interface functions for LcdHwLib of ArmPlatformPkg + + Copyright (c) 2017, ARM Ltd. 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. + +**/ + +#ifndef LCD_HW_H_ +#define LCD_HW_H_ + +#include + +/** Check for presence of display + * + * @retval EFI_SUCCESS Platform implements display. + * @retval EFI_NOT_FOUND Display not found on the platform. + */ +EFI_STATUS +LcdIdentify ( + VOID +); + +/** Initialize display. + * + * @param FrameBaseAddress Address of the frame buffer. + * @retval EFI_SUCCESS Display initialization success. + * @retval !(EFI_SUCCESS) Display initialization failure. + * +**/ +EFI_STATUS +LcdInitialize ( + EFI_PHYSICAL_ADDRESS FrameBaseAddress +); + +/** Set requested mode of the display. + * + * @param ModeNumber Display mode number. + * @retval EFI_SUCCESS Display set mode success. + * @retval EFI_DEVICE_ERROR If mode not found/supported. + * +**/ +EFI_STATUS +LcdSetMode ( + IN UINT32 ModeNumber +); + + +/** De-initializes the display. + * +**/ +VOID +LcdShutdown ( + VOID +); + +#endif /* LCD_HW_H_ */ diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h index d357c22c46b62966859793372c447883e12e1e80..78b1780d82b8b698924cc55a292c30728a3e7060 100644 --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h @@ -14,6 +14,7 @@ #ifndef LCD_PLATFORM_LIB_H_ #define LCD_PLATFORM_LIB_H_ +#include #include #define LCD_VRAM_SIZE SIZE_8MB diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c b/ArmPlatformPkg/Drivers/HdLcd/HdLcd.c similarity index 95% rename from ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c rename to ArmPlatformPkg/Drivers/HdLcd/HdLcd.c index 8f83d6ecba290994dbced1c11dfdb6d705323c03..d0f678acc7ac539f4e05a9b35ce28baded6c7244 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c +++ b/ArmPlatformPkg/Drivers/HdLcd/HdLcd.c @@ -19,8 +19,7 @@ #include #include - -#include "LcdGraphicsOutputDxe.h" +#include #define BYTES_PER_PIXEL 4 diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c index c40c8e0fa6f4b5f7798aeb3c8bf3f261f14cb67b..e47142319045783cf98243a1372d933d89718922 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c @@ -20,6 +20,8 @@ #include +#include + #include "LcdGraphicsOutputDxe.h" /********************************************************************** diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c b/ArmPlatformPkg/Drivers/PL111Lcd/PL111Lcd.c similarity index 95% rename from ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c rename to ArmPlatformPkg/Drivers/PL111Lcd/PL111Lcd.c index 4bad2367982e16d5d23c4eab2e6d91bf7db1c031..439f4f9c1fd7c6339cfa75287f3fa3718de34d92 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c +++ b/ArmPlatformPkg/Drivers/PL111Lcd/PL111Lcd.c @@ -11,13 +11,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ - +#include #include #include #include - -#include "LcdGraphicsOutputDxe.h" +#include /********************************************************************** * -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")