From 5944068bc71cc7356bdb5f6eaa27b16dc1915f87 Mon Sep 17 00:00:00 2001 From: Li Wei Date: Thu, 25 Jan 2018 20:46:01 +0800 Subject: hynix ufs have some bugs for fixed --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 19 +++++++++++++++++++ MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 3 +++ MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 6 ------ MdeModulePkg/Include/Protocol/UfsHostController.h | 3 ++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c index 761dc8ee1..8c9aad903 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c @@ -778,11 +778,14 @@ UfsPassThruDriverBindingStart ( UINTN UfsHcBase; UINT32 Index; UFS_CONFIG_DESC Config; + UFS_DEV_DESC Dev; + UINT32 DevQuirks; Status = EFI_SUCCESS; UfsHc = NULL; Private = NULL; UfsHcBase = 0; + DevQuirks = 0; DEBUG ((EFI_D_INFO, "==UfsPassThru Start== Controller = %x\n", Controller)); @@ -855,6 +858,22 @@ UfsPassThruDriverBindingStart ( MicroSecondDelay (100000); + Status = UfsRwDeviceDesc (Private, TRUE, UfsDeviceDesc, 0, 0, &Dev, sizeof (UFS_DEV_DESC)); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Ufs Get Dev Descriptor Error, Status = %r\n", Status)); + goto Error; + } + + if (SwapBytes16(Dev.ManufacturerId) == UFS_VENDOR_SKHYNIX) { + DevQuirks |= UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME; + } + + Status = UfsHc->PhySetPowerMode (UfsHc, DevQuirks); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Phy Set Power Mode Fails, Status = %r\n", Status)); + goto Error; + } + // // Get Ufs Device's Lun Info by reading Configuration Descriptor. // diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h index af13757c1..ed1249b98 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h @@ -45,6 +45,9 @@ #define UFS_MAX_LUNS 12 #define UFS_WLUN_PREFIX 0xC1 +#define UFS_VENDOR_SKHYNIX 0x1AD +#define UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME (1 << 0) + typedef struct { UINT8 Lun[UFS_MAX_LUNS]; UINT16 BitMask:12; // Bit 0~7 is 1/1 mapping to common luns. Bit 8~11 is 1/1 mapping to well-known luns. diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c index e53347d3a..e71be6afc 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c @@ -2113,12 +2113,6 @@ UfsControllerInit ( return Status; } - Status = UfsHc->PhySetPowerMode (UfsHc); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "UfsControllerInit: Phy Set Power Mode Fails, Status = %r\n", Status)); - return Status; - } - Status = UfsInitTaskManagementRequestList (Private); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "UfsControllerInit: Task management list initialization Fails, Status = %r\n", Status)); diff --git a/MdeModulePkg/Include/Protocol/UfsHostController.h b/MdeModulePkg/Include/Protocol/UfsHostController.h index 66cd629dc..f98be7072 100644 --- a/MdeModulePkg/Include/Protocol/UfsHostController.h +++ b/MdeModulePkg/Include/Protocol/UfsHostController.h @@ -230,7 +230,8 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *EDKII_UFS_HC_PHY_SET_POWER_MODE)( - IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, + IN UINT32 DevQuirks ); /// -- cgit v1.2.3 From a42aa1fafaee81a354c89776dffbc0d0c1701282 Mon Sep 17 00:00:00 2001 From: Riku Voipio Date: Tue, 23 Jan 2018 14:39:01 +0200 Subject: Fix build on newer gcc Backported from upstream Signed-off-by: Riku Voipio Signed-off-by: Haojian Zhuang --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 37feb8cba..879be50e8 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4341,7 +4341,7 @@ DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-ad DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access -DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-pic -fno-pie +DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-pic -fno-pie -ffixed-x18 DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds -- cgit v1.2.3 From 58efdaee68aa86b83675578ef19d2498a5ce0e88 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 17 Mar 2017 13:47:35 +0100 Subject: EmbeddedPkg: introduce EDKII Platform Has ACPI GUID The presence of this GUID in the PPI database, and/or in the DXE protocol database (as dictated by the platform's needs in these firmware phases) implies that the platform provides the operating system with an ACPI-based hardware description. This is not necessarily exclusive with other types of hardware description (for example, a Device Tree-based one). A platform PEIM and/or DXE driver is supposed to produce a single instance of the PPI and/or protocol (with NULL contents), if appropriate. The decision to produce the PPI and/or protocol is platform specific; for example, in the DXE phase, it could depend on an HII checkbox / underlying non-volatile UEFI variable. In the DXE phase, the protocol is meant to be depended-upon by "MdeModulePkg/Universal/Acpi/AcpiTableDxe", indirectly: * In the long term, interested platforms will establish this dependency by hooking an (upcoming) NULL-class DepexLib instance into AcpiTableDxe in their DSC files, pointing DepexLib's DEPEX through a FixedAtBuild PCD to the GUID introduced here. (For the prerequisite BaseTools feature, refer to ). * In the short term, an interested platform may hook a private NULL-class library instance (called e.g. "PlatformHasAcpiLib") into AcpiTableDxe. Such a library instance would be a specialization of the above described generic DepexLib, with the DEPEX open-coded on the GUID introduced here. Either way, the platform makes EFI_ACPI_TABLE_PROTOCOL and (if enabled) EFI_ACPI_SDT_PROTOCOL dependent on the platform's dynamic decision to produce or not to produce a NULL protocol instance with this GUID. In turn, other (platform and universal) DXE drivers that produce ACPI tables will wait for EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL, via DEPEX, protocol notify, or a simple gBS->LocateProtocol() in a "late enough" callback (such as Ready To Boot). Because this GUID is not standard, it is prefixed with EDKII / Edkii, as seen elsewhere in MdeModulePkg and SecurityPkg. In addition, an effort is made to avoid the phrase "AcpiPlatform", as that belongs to drivers / libraries that produce platform specific ACPI content (as opposed to deciding whether the entire firmware will have access to EFI_ACPI_TABLE_PROTOCOL, or any similar facilities in the PEI phase). Cc: Ard Biesheuvel Cc: Leif Lindholm Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel --- EmbeddedPkg/EmbeddedPkg.dec | 3 +++ EmbeddedPkg/Include/Guid/PlatformHasAcpi.h | 35 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 EmbeddedPkg/Include/Guid/PlatformHasAcpi.h diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index e41415ece..c7756ea99 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -56,6 +56,9 @@ gFdtHobGuid = { 0x16958446, 0x19B7, 0x480B, { 0xB0, 0x47, 0x74, 0x85, 0xAD, 0x3F, 0x71, 0x6D } } gFdtVariableGuid = { 0x25a4fd4a, 0x9703, 0x4ba9, { 0xa1, 0x90, 0xb7, 0xc8, 0x4e, 0xfb, 0x3e, 0x57 } } + ## Include/Guid/PlatformHasAcpi.h + gEdkiiPlatformHasAcpiGuid = { 0xf0966b41, 0xc23f, 0x41b9, { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } } + [Protocols.common] gHardwareInterruptProtocolGuid = { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } } gEfiDebugSupportPeriodicCallbackProtocolGuid = { 0x9546e07c, 0x2cbb, 0x4c88, { 0x98, 0x6c, 0xcd, 0x34, 0x10, 0x86, 0xf0, 0x44 } } diff --git a/EmbeddedPkg/Include/Guid/PlatformHasAcpi.h b/EmbeddedPkg/Include/Guid/PlatformHasAcpi.h new file mode 100644 index 000000000..ad5178213 --- /dev/null +++ b/EmbeddedPkg/Include/Guid/PlatformHasAcpi.h @@ -0,0 +1,35 @@ +/** @file + EDKII Platform Has ACPI GUID + + A NULL protocol instance with this GUID in the DXE protocol database, and/or + a NULL PPI with this GUID in the PPI database, implies that the platform + provides the operating system with an ACPI-based hardware description. Note + that this is not necessarily exclusive with different kinds of hardware + description (for example, a Device Tree-based one). A platform driver and/or + PEIM is supposed to produce a single instance of the protocol and/or PPI + (with NULL contents), if appropriate. + + Copyright (C) 2017, Red Hat, Inc. + + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License that 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 __EDKII_PLATFORM_HAS_ACPI_H__ +#define __EDKII_PLATFORM_HAS_ACPI_H__ + +#define EDKII_PLATFORM_HAS_ACPI_GUID \ + { \ + 0xf0966b41, 0xc23f, 0x41b9, \ + { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } \ + } + +extern EFI_GUID gEdkiiPlatformHasAcpiGuid; + +#endif -- cgit v1.2.3 From 6ddc4979dd44833a8bd3b91cc508d0c17fcb827f Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 17 Mar 2017 13:47:35 +0100 Subject: EmbeddedPkg: introduce PlatformHasAcpiLib Add the shorter-term library instance outlined in the previous patch to EmbeddedPkg, so that we can imbue AcpiTableDxe with a protocol dependency on EDKII_PLATFORM_HAS_ACPI_GUID. Cc: Ard Biesheuvel Cc: Leif Lindholm Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel --- .../PlatformHasAcpiLib/PlatformHasAcpiLib.c | 36 +++++++++++++++++++ .../PlatformHasAcpiLib/PlatformHasAcpiLib.inf | 40 ++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c create mode 100644 EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf diff --git a/EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c b/EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c new file mode 100644 index 000000000..2c73e7176 --- /dev/null +++ b/EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c @@ -0,0 +1,36 @@ +/** @file + A hook-in library for MdeModulePkg/Universal/Acpi/AcpiTableDxe. + + Plugging this library instance into AcpiTableDxe makes + EFI_ACPI_TABLE_PROTOCOL and (if enabled) EFI_ACPI_SDT_PROTOCOL depend on the + platform's dynamic decision whether to expose an ACPI-based hardware + description to the operating system. + + Universal and platform specific DXE drivers that produce ACPI tables depend + on EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL in turn. + + Copyright (C) 2017, Red Hat, Inc. + + 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. +**/ + +#include + +RETURN_STATUS +EFIAPI +PlatformHasAcpiInitialize ( + VOID + ) +{ + // + // Do nothing, just imbue AcpiTableDxe with a protocol dependency on + // EDKII_PLATFORM_HAS_ACPI_GUID. + // + return RETURN_SUCCESS; +} diff --git a/EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf b/EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf new file mode 100644 index 000000000..6268293ca --- /dev/null +++ b/EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf @@ -0,0 +1,40 @@ +## @file +# A hook-in library for MdeModulePkg/Universal/Acpi/AcpiTableDxe. +# +# Plugging this library instance into AcpiTableDxe makes +# EFI_ACPI_TABLE_PROTOCOL and (if enabled) EFI_ACPI_SDT_PROTOCOL depend on the +# platform's dynamic decision whether to expose an ACPI-based hardware +# description to the operating system. +# +# Universal and platform specific DXE drivers that produce ACPI tables depend +# on EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL in turn. +# +# Copyright (C) 2017, Red Hat, Inc. +# +# 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. +## + +[Defines] + INF_VERSION = 1.25 + BASE_NAME = PlatformHasAcpiLib + FILE_GUID = 29beb028-0958-447b-be0a-12229235d77d + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PlatformHasAcpiLib|DXE_DRIVER + CONSTRUCTOR = PlatformHasAcpiInitialize + +[Sources] + PlatformHasAcpiLib.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + +[Depex] + gEdkiiPlatformHasAcpiGuid -- cgit v1.2.3 From b62849430b897257b8a6a21c738f5b7c5cf6e567 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 17 Mar 2017 13:47:35 +0100 Subject: EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID The presence of this GUID in the PPI database, and/or in the DXE protocol database (as dictated by the platform's needs in these firmware phases) implies that the platform provides the operating system with a Device Tree-based hardware description. This is not necessarily exclusive with other types of hardware description (for example, an ACPI-based one). A platform PEIM and/or DXE driver is supposed to produce a single instance of the PPI and/or protocol (with NULL contents), if appropriate. The decision to produce the PPI and/or protocol is platform specific; for example, in the DXE phase, it could depend on an HII checkbox / underlying non-volatile UEFI variable. In the DXE phase, the protocol is meant to be consumed by the platform driver that - owns the Device Tree description of the hardware, and - is responsible for installing it as a system configuration table. Said FDT-owner driver can wait for the protocol via DEPEX or protocol notify. Because this GUID is not standard, it is prefixed with EDKII / Edkii, as seen elsewhere (for example in MdeModulePkg and SecurityPkg). Cc: Ard Biesheuvel Cc: Leif Lindholm Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel --- EmbeddedPkg/EmbeddedPkg.dec | 3 ++ EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h | 35 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index c7756ea99..9ace8a5cc 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -59,6 +59,9 @@ ## Include/Guid/PlatformHasAcpi.h gEdkiiPlatformHasAcpiGuid = { 0xf0966b41, 0xc23f, 0x41b9, { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } } + ## Include/Guid/PlatformHasDeviceTree.h + gEdkiiPlatformHasDeviceTreeGuid = { 0x7ebb920d, 0x1aaf, 0x46d9, { 0xb2, 0xaf, 0x54, 0x1e, 0x1d, 0xce, 0x14, 0x8b } } + [Protocols.common] gHardwareInterruptProtocolGuid = { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } } gEfiDebugSupportPeriodicCallbackProtocolGuid = { 0x9546e07c, 0x2cbb, 0x4c88, { 0x98, 0x6c, 0xcd, 0x34, 0x10, 0x86, 0xf0, 0x44 } } diff --git a/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h b/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h new file mode 100644 index 000000000..a9bc51270 --- /dev/null +++ b/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h @@ -0,0 +1,35 @@ +/** @file + EDKII Platform Has Device Tree GUID + + A NULL protocol instance with this GUID in the DXE protocol database, and/or + a NULL PPI with this GUID in the PPI database, implies that the platform + provides the operating system with a Device Tree-based hardware description. + Note that this is not necessarily exclusive with different kinds of hardware + description (for example, an ACPI-based one). A platform driver and/or PEIM + is supposed to produce a single instance of the protocol and/or PPI (with + NULL contents), if appropriate. + + Copyright (C) 2017, Red Hat, Inc. + + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License that 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 __EDKII_PLATFORM_HAS_DEVICE_TREE_H__ +#define __EDKII_PLATFORM_HAS_DEVICE_TREE_H__ + +#define EDKII_PLATFORM_HAS_DEVICE_TREE_GUID \ + { \ + 0x7ebb920d, 0x1aaf, 0x46d9, \ + { 0xb2, 0xaf, 0x54, 0x1e, 0x1d, 0xce, 0x14, 0x8b } \ + } + +extern EFI_GUID gEdkiiPlatformHasDeviceTreeGuid; + +#endif -- cgit v1.2.3 From ebaaefb22499625b8eed8e1617c7e47ad4f5599d Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Mon, 27 Mar 2017 10:57:31 +0100 Subject: EmbeddedPkg: add DT platform driver to select between DT and ACPI As a follow up to the changes proposed by Laszlo to make ACPI and DT mutually exclusive on ArmVirtQemu, this patch proposes a DT platform DXE driver that either installs the NULL protocol PlatformHasAcpiGuid, or installs the FV embedded DTB binary as a configuration table under the appropriate GUID, depending on a preference setting recorded as a UEFI variable, and configurable via a HII screen. The DTB binary can be embedded in the firmware image by adding the following to the platform .fdf file: FILE FREEFORM = 25462CDA-221F-47DF-AC1D-259CFAA4E326 { SECTION RAW = SomePkg/path/to/foo.dtb } Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c | 213 +++++++++++++++++++++ EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h | 31 +++ .../Drivers/DtPlatformDxe/DtPlatformDxe.inf | 58 ++++++ .../Drivers/DtPlatformDxe/DtPlatformHii.uni | 27 +++ .../Drivers/DtPlatformDxe/DtPlatformHii.vfr | 51 +++++ EmbeddedPkg/EmbeddedPkg.dec | 6 + .../Include/Guid/DtPlatformDefaultDtbFile.h | 23 +++ EmbeddedPkg/Include/Guid/DtPlatformFormSet.h | 23 +++ 8 files changed, 432 insertions(+) create mode 100644 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c create mode 100644 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h create mode 100644 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf create mode 100644 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformHii.uni create mode 100644 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformHii.vfr create mode 100644 EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h create mode 100644 EmbeddedPkg/Include/Guid/DtPlatformFormSet.h diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c new file mode 100644 index 000000000..5778633b4 --- /dev/null +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c @@ -0,0 +1,213 @@ +/** @file +* +* Copyright (c) 2017, Linaro, 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. +* +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "DtPlatformDxe.h" + +extern UINT8 DtPlatformHiiBin[]; +extern UINT8 DtPlatformDxeStrings[]; + +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +STATIC HII_VENDOR_DEVICE_PATH mDtPlatformDxeVendorDevicePath = { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + DT_PLATFORM_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8) (END_DEVICE_PATH_LENGTH), + (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +STATIC +EFI_STATUS +InstallHiiPages ( + VOID + ) +{ + EFI_STATUS Status; + EFI_HII_HANDLE HiiHandle; + EFI_HANDLE DriverHandle; + + DriverHandle = NULL; + Status = gBS->InstallMultipleProtocolInterfaces (&DriverHandle, + &gEfiDevicePathProtocolGuid, + &mDtPlatformDxeVendorDevicePath, + NULL); + if (EFI_ERROR (Status)) { + return Status; + } + + HiiHandle = HiiAddPackages (&gDtPlatformFormSetGuid, + DriverHandle, + DtPlatformDxeStrings, + DtPlatformHiiBin, + NULL); + + if (HiiHandle == NULL) { + gBS->UninstallMultipleProtocolInterfaces (DriverHandle, + &gEfiDevicePathProtocolGuid, + &mDtPlatformDxeVendorDevicePath, + NULL); + return EFI_OUT_OF_RESOURCES; + } + return EFI_SUCCESS; +} + +/** + The entry point for DtPlatformDxe driver. + + @param[in] ImageHandle The image handle of the driver. + @param[in] SystemTable The system table. + + @retval EFI_ALREADY_STARTED The driver already exists in system. + @retval EFI_OUT_OF_RESOURCES Fail to execute entry point due to lack of + resources. + @retval EFI_SUCCES All the related protocols are installed on + the driver. + +**/ +EFI_STATUS +EFIAPI +DtPlatformDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + DT_ACPI_VARSTORE_DATA DtAcpiPref; + UINTN BufferSize; + VOID *Dtb; + UINTN DtbSize; + VOID *DtbCopy; + + // + // Check whether a DTB blob is included in the firmware image. + // + Dtb = NULL; + Status = GetSectionFromAnyFv (&gDtPlatformDefaultDtbFileGuid, + EFI_SECTION_RAW, 0, &Dtb, &DtbSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "%a: no DTB blob found, defaulting to ACPI\n", + __FUNCTION__)); + DtAcpiPref.Pref = DT_ACPI_SELECT_ACPI; + } else { + // + // Get the current DT/ACPI preference from the DtAcpiPref variable. + // + BufferSize = sizeof (DtAcpiPref); + Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid, + NULL, &BufferSize, &DtAcpiPref); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to DT\n", + __FUNCTION__)); + DtAcpiPref.Pref = DT_ACPI_SELECT_DT; + } + } + + if (!EFI_ERROR (Status) && + DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI && + DtAcpiPref.Pref != DT_ACPI_SELECT_DT) { + DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to DT\n", + __FUNCTION__, DT_ACPI_VARIABLE_NAME)); + DtAcpiPref.Pref = DT_ACPI_SELECT_DT; + Status = EFI_INVALID_PARAMETER; // trigger setvar below + } + + // + // Write the newly selected default value back to the variable store. + // + if (EFI_ERROR (Status)) { + Status = gRT->SetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS, + sizeof (DtAcpiPref), &DtAcpiPref); + if (EFI_ERROR (Status)) { + return Status; + } + } + + if (DtAcpiPref.Pref == DT_ACPI_SELECT_ACPI) { + // + // ACPI was selected: install the gEdkiiPlatformHasAcpiGuid GUID as a + // NULL protocol to unlock dispatch of ACPI related drivers. + // + Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle, + &gEdkiiPlatformHasAcpiGuid, NULL, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, + "%a: failed to install gEdkiiPlatformHasAcpiGuid as a protocol\n", + __FUNCTION__)); + return Status; + } + } else if (DtAcpiPref.Pref == DT_ACPI_SELECT_DT) { + // + // DT was selected: copy the blob into newly allocated memory and install + // a reference to it as the FDT configuration table. + // + DtbCopy = AllocateCopyPool (DtbSize, Dtb); + if (DtbCopy == NULL) { + return EFI_OUT_OF_RESOURCES; + } + Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DtbCopy); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to install FDT configuration table\n", + __FUNCTION__)); + FreePool (DtbCopy); + return Status; + } + } else { + ASSERT (FALSE); + } + + // + // No point in installing the HII pages if ACPI is the only description + // we have + // + if (Dtb == NULL) { + return EFI_SUCCESS; + } + + // + // Note that we don't uninstall the gEdkiiPlatformHasAcpiGuid protocol nor + // the FDT configuration table if the following call fails. While that will + // cause loading of this driver to fail, proceeding with ACPI and DT both + // disabled will guarantee a failed boot, and so it is better to leave them + // installed in that case. + // + return InstallHiiPages (); +} diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h new file mode 100644 index 000000000..236936727 --- /dev/null +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h @@ -0,0 +1,31 @@ +/** @file +* +* Copyright (c) 2017, Linaro Limited. 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 __DT_PLATFORM_DXE_H__ +#define __DT_PLATFORM_DXE_H__ + +#include +#include + +#define DT_ACPI_SELECT_DT 0x0 +#define DT_ACPI_SELECT_ACPI 0x1 + +#define DT_ACPI_VARIABLE_NAME L"DtAcpiPref" + +typedef struct { + UINT8 Pref; + UINT8 Reserved[3]; +} DT_ACPI_VARSTORE_DATA; + +#endif diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf new file mode 100644 index 000000000..b73877a60 --- /dev/null +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf @@ -0,0 +1,58 @@ +## @file +# +# Copyright (c) 2017, Linaro, 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. +# +## + +[Defines] + INF_VERSION = 0x00010019 + BASE_NAME = DtPlatformDxe + FILE_GUID = FC097B3C-2EBD-4A75-A3DA-121DCAB365CC + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = DtPlatformDxeEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 +# + +[Sources] + DtPlatformDxe.c + DtPlatformHii.vfr + DtPlatformHii.uni + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesLib + HiiLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + +[Guids] + gDtPlatformFormSetGuid + gDtPlatformDefaultDtbFileGuid + gEdkiiPlatformHasAcpiGuid + gFdtTableGuid + +[Depex] + gEfiVariableArchProtocolGuid AND + gEfiVariableWriteArchProtocolGuid diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformHii.uni b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformHii.uni new file mode 100644 index 000000000..bc995c1d0 --- /dev/null +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformHii.uni @@ -0,0 +1,27 @@ +/** @file +* +* Copyright (c) 2017, Linaro, 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. +* +**/ + +#langdef en-US "English" + +#string STR_FORM_SET_TITLE #language en-US "O/S Hardware Description Selection" +#string STR_FORM_SET_TITLE_HELP #language en-US "Press to choose between ACPI and DT hardware descriptions." + +#string STR_MAIN_FORM_TITLE #language en-US "O/S Hardware Description Selection" +#string STR_NULL_STRING #language en-US "" + +#string STR_DT_ACPI_SELECT_PROMPT #language en-US "O/S Hardware Description" +#string STR_DT_ACPI_SELECT_HELP #language en-US "Select the hardware description that will be exposed to the O/S." + +#string STR_DT_ACPI_SELECT_DT #language en-US "Device Tree" +#string STR_DT_ACPI_SELECT_ACPI #language en-US "ACPI" diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformHii.vfr b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformHii.vfr new file mode 100644 index 000000000..3516746c4 --- /dev/null +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformHii.vfr @@ -0,0 +1,51 @@ +/** @file +* +* Copyright (c) 2017, Linaro, 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. +* +**/ + +#include "DtPlatformDxe.h" + +// +// EFI Variable attributes +// +#define EFI_VARIABLE_NON_VOLATILE 0x00000001 +#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 +#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 +#define EFI_VARIABLE_READ_ONLY 0x00000008 + +formset + guid = DT_PLATFORM_FORMSET_GUID, + title = STRING_TOKEN(STR_FORM_SET_TITLE), + help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP), + classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID, + + efivarstore DT_ACPI_VARSTORE_DATA, + attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attributes + name = DtAcpiPref, + guid = DT_PLATFORM_FORMSET_GUID; + + form formid = 0x1000, + title = STRING_TOKEN(STR_MAIN_FORM_TITLE); + + oneof varid = DtAcpiPref.Pref, + prompt = STRING_TOKEN(STR_DT_ACPI_SELECT_PROMPT), + help = STRING_TOKEN(STR_DT_ACPI_SELECT_HELP), + flags = NUMERIC_SIZE_1 | INTERACTIVE | RESET_REQUIRED, + option text = STRING_TOKEN(STR_DT_ACPI_SELECT_DT), value = DT_ACPI_SELECT_DT, flags = DEFAULT; + option text = STRING_TOKEN(STR_DT_ACPI_SELECT_ACPI), value = DT_ACPI_SELECT_ACPI, flags = 0; + endoneof; + + subtitle text = STRING_TOKEN(STR_NULL_STRING); + + endform; + +endformset; diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 9ace8a5cc..fa6ff2177 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -62,6 +62,12 @@ ## Include/Guid/PlatformHasDeviceTree.h gEdkiiPlatformHasDeviceTreeGuid = { 0x7ebb920d, 0x1aaf, 0x46d9, { 0xb2, 0xaf, 0x54, 0x1e, 0x1d, 0xce, 0x14, 0x8b } } + # HII form set GUID for DtPlatformDxe driver + gDtPlatformFormSetGuid = { 0x2b7a240d, 0xd5ad, 0x4fd6, { 0xbe, 0x1c, 0xdf, 0xa4, 0x41, 0x5f, 0x55, 0x26 } } + + # File GUID for default DTB image embedded in the firmware volume + gDtPlatformDefaultDtbFileGuid = { 0x25462cda, 0x221f, 0x47df, { 0xac, 0x1d, 0x25, 0x9c, 0xfa, 0xa4, 0xe3, 0x26 } } + [Protocols.common] gHardwareInterruptProtocolGuid = { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } } gEfiDebugSupportPeriodicCallbackProtocolGuid = { 0x9546e07c, 0x2cbb, 0x4c88, { 0x98, 0x6c, 0xcd, 0x34, 0x10, 0x86, 0xf0, 0x44 } } diff --git a/EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h b/EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h new file mode 100644 index 000000000..c44b4d952 --- /dev/null +++ b/EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h @@ -0,0 +1,23 @@ +/** @file +* +* Copyright (c) 2017, Linaro Limited. 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 __DT_PLATFORM_DEFAULT_DTB_FILE_H__ +#define __DT_PLATFORM_DEFAULT_DTB_FILE_H__ + +#define DT_PLATFORM_DEFAULT_DTB_FILE_GUID \ + { 0x25462cda, 0x221f, 0x47df, { 0xac, 0x1d, 0x25, 0x9c, 0xfa, 0xa4, 0xe3, 0x26 } } + +extern EFI_GUID gDtPlatformDefaultDtbFileGuid; + +#endif diff --git a/EmbeddedPkg/Include/Guid/DtPlatformFormSet.h b/EmbeddedPkg/Include/Guid/DtPlatformFormSet.h new file mode 100644 index 000000000..71e3e7ebf --- /dev/null +++ b/EmbeddedPkg/Include/Guid/DtPlatformFormSet.h @@ -0,0 +1,23 @@ +/** @file +* +* Copyright (c) 2017, Linaro Limited. 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 __DT_PLATFORM_FORMSET_H__ +#define __DT_PLATFORM_FORMSET_H__ + +#define DT_PLATFORM_FORMSET_GUID \ + { 0x2b7a240d, 0xd5ad, 0x4fd6, { 0xbe, 0x1c, 0xdf, 0xa4, 0x41, 0x5f, 0x55, 0x26 } } + +extern EFI_GUID gDtPlatformFormSetGuid; + +#endif -- cgit v1.2.3 From 278ba928bf4aaefedff2ed54d0862ac77c69339e Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 31 Mar 2017 13:16:40 +0100 Subject: EmbeddedPkg: add DtPlatformDxe to .dsc file Add the new DtPlatformDxe driver to EmbeddedPkg's .dsc file so that we can build it outside the context of a platform. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- EmbeddedPkg/EmbeddedPkg.dsc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc index ba4f1ea0f..1453cbf4a 100644 --- a/EmbeddedPkg/EmbeddedPkg.dsc +++ b/EmbeddedPkg/EmbeddedPkg.dsc @@ -290,5 +290,7 @@ EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf + EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf + [Components.IA32, Components.X64, Components.IPF, Components.ARM] EmbeddedPkg/GdbStub/GdbStub.inf -- cgit v1.2.3 From 915489d127626207cd8d4d5140af7b5fed46c5ad Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 31 Mar 2017 11:32:36 +0100 Subject: EmbeddedPkg: add DtPlatformDtbLoaderLib library class To abstract the way a platform reasons about which DTB is appropriate, and the way it ultimately supplies the DTB image, introduce a new library class to encapsulate this functionality. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- EmbeddedPkg/EmbeddedPkg.dec | 1 + .../Include/Library/DtPlatformDtbLoaderLib.h | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index fa6ff2177..c4798b977 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -45,6 +45,7 @@ GdbSerialLib|Include/Library/GdbSerialLib.h DebugAgentTimerLib|Include/Library/DebugAgentTimerLib.h + DtPlatformDtbLoaderLib|Include/Library/DtPlatformDtbLoaderLib.h [Guids.common] gEmbeddedTokenSpaceGuid = { 0xe0d8ca17, 0x4276, 0x4386, { 0xbb, 0x79, 0x48, 0xcb, 0x81, 0x3d, 0x3c, 0x4f }} diff --git a/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h b/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h new file mode 100644 index 000000000..b2fbf4acb --- /dev/null +++ b/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h @@ -0,0 +1,39 @@ +/** @file +* +* Copyright (c) 2017, Linaro, 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 __DT_PLATFORM_DTB_LOADER_LIB_H__ +#define __DT_PLATFORM_DTB_LOADER_LIB_H__ + +#include + +/** + Return a pool allocated copy of the DTB image that is appropriate for + booting the current platform via DT. + + @param[out] Dtb Pointer to the DTB copy + @param[out] DtbSize Size of the DTB copy + + @retval EFI_SUCCESS Operation completed successfully + @retval EFI_NOT_FOUND No suitable DTB image could be located + @retval EFI_OUT_OF_RESOURCES No pool memory available + +**/ +EFI_STATUS +EFIAPI +DtPlatformLoadDtb ( + OUT VOID **Dtb, + OUT UINTN *DtbSize + ); + +#endif -- cgit v1.2.3 From 340b0e0fdcc1cdb92e919b1acb79a4f0083ab795 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 31 Mar 2017 11:35:13 +0100 Subject: EmbeddedPkg: add base DtPlatformDtbLoaderLib implementation Introduce an implementation of the new DtPlatformDtbLoaderLib library class that simply retrieves the first raw section of an FV file named 'gDtPlatformDefaultDtbFileGuid'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- EmbeddedPkg/EmbeddedPkg.dsc | 4 ++ .../DxeDtPlatformDtbLoaderLibDefault.c | 60 ++++++++++++++++++++++ .../DxeDtPlatformDtbLoaderLibDefault.inf | 36 +++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.c create mode 100644 EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc index 1453cbf4a..16b368e3c 100644 --- a/EmbeddedPkg/EmbeddedPkg.dsc +++ b/EmbeddedPkg/EmbeddedPkg.dsc @@ -109,6 +109,9 @@ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + DtPlatformDtbLoaderLib|EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf + [LibraryClasses.common.DXE_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf @@ -247,6 +250,7 @@ EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf EmbeddedPkg/Library/NullDmaLib/NullDmaLib.inf + EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf EmbeddedPkg/Ebl/Ebl.inf #### EmbeddedPkg/EblExternCmd/EblExternCmd.inf diff --git a/EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.c b/EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.c new file mode 100644 index 000000000..313d0b104 --- /dev/null +++ b/EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.c @@ -0,0 +1,60 @@ +/** @file +* +* Copyright (c) 2017, Linaro, 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. +* +**/ + +#include + +#include +#include +#include + +/** + Return a pool allocated copy of the DTB image that is appropriate for + booting the current platform via DT. + + @param[out] Dtb Pointer to the DTB copy + @param[out] DtbSize Size of the DTB copy + + @retval EFI_SUCCESS Operation completed successfully + @retval EFI_NOT_FOUND No suitable DTB image could be located + @retval EFI_OUT_OF_RESOURCES No pool memory available + +**/ +EFI_STATUS +EFIAPI +DtPlatformLoadDtb ( + OUT VOID **Dtb, + OUT UINTN *DtbSize + ) +{ + EFI_STATUS Status; + VOID *OrigDtb; + VOID *CopyDtb; + UINTN OrigDtbSize; + + Status = GetSectionFromAnyFv (&gDtPlatformDefaultDtbFileGuid, + EFI_SECTION_RAW, 0, &OrigDtb, &OrigDtbSize); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + CopyDtb = AllocateCopyPool (OrigDtbSize, OrigDtb); + if (CopyDtb == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + *Dtb = CopyDtb; + *DtbSize = OrigDtbSize; + + return EFI_SUCCESS; +} diff --git a/EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf b/EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf new file mode 100644 index 000000000..9d49fc579 --- /dev/null +++ b/EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf @@ -0,0 +1,36 @@ +/** @file +* +* Copyright (c) 2017, Linaro, 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. +* +**/ + +[Defines] + INF_VERSION = 0x00010019 + BASE_NAME = DxeDtPlatformDtbLoaderLibDefault + FILE_GUID = 419a1910-70da-4c99-8696-ba81a57be508 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DtPlatformDtbLoaderLib|DXE_DRIVER + +[Sources] + DxeDtPlatformDtbLoaderLibDefault.c + +[Packages] + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + +[LibraryClasses] + BaseLib + DxeServicesLib + MemoryAllocationLib + +[Guids] + gDtPlatformDefaultDtbFileGuid -- cgit v1.2.3 From 927509de13539f0cfffa87693ec9d03ea398a43e Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 29 Mar 2017 12:05:01 +0100 Subject: EmbeddedPkg/DtPlatformDxe: load platform DTB via new library To give platforms some room to decide which DTB is suitable and where to load it from, load the DTB image indirectly via the new DtPlatformDtbLoaderLib library class. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c | 34 ++++++++++------------ .../Drivers/DtPlatformDxe/DtPlatformDxe.inf | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c index 5778633b4..1014be228 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -114,17 +114,13 @@ DtPlatformDxeEntryPoint ( UINTN BufferSize; VOID *Dtb; UINTN DtbSize; - VOID *DtbCopy; - // - // Check whether a DTB blob is included in the firmware image. - // Dtb = NULL; - Status = GetSectionFromAnyFv (&gDtPlatformDefaultDtbFileGuid, - EFI_SECTION_RAW, 0, &Dtb, &DtbSize); + Status = DtPlatformLoadDtb (&Dtb, &DtbSize); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "%a: no DTB blob found, defaulting to ACPI\n", - __FUNCTION__)); + DEBUG ((DEBUG_WARN, + "%a: no DTB blob could be loaded, defaulting to ACPI (Status == %r)\n", + __FUNCTION__, Status)); DtAcpiPref.Pref = DT_ACPI_SELECT_ACPI; } else { // @@ -157,7 +153,7 @@ DtPlatformDxeEntryPoint ( EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS, sizeof (DtAcpiPref), &DtAcpiPref); if (EFI_ERROR (Status)) { - return Status; + goto FreeDtb; } } @@ -172,23 +168,18 @@ DtPlatformDxeEntryPoint ( DEBUG ((DEBUG_ERROR, "%a: failed to install gEdkiiPlatformHasAcpiGuid as a protocol\n", __FUNCTION__)); - return Status; + goto FreeDtb; } } else if (DtAcpiPref.Pref == DT_ACPI_SELECT_DT) { // // DT was selected: copy the blob into newly allocated memory and install // a reference to it as the FDT configuration table. // - DtbCopy = AllocateCopyPool (DtbSize, Dtb); - if (DtbCopy == NULL) { - return EFI_OUT_OF_RESOURCES; - } - Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DtbCopy); + Status = gBS->InstallConfigurationTable (&gFdtTableGuid, Dtb); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: failed to install FDT configuration table\n", __FUNCTION__)); - FreePool (DtbCopy); - return Status; + goto FreeDtb; } } else { ASSERT (FALSE); @@ -210,4 +201,11 @@ DtPlatformDxeEntryPoint ( // installed in that case. // return InstallHiiPages (); + +FreeDtb: + if (Dtb != NULL) { + FreePool (Dtb); + } + + return Status; } diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf index b73877a60..45dfd9088 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf @@ -40,7 +40,7 @@ [LibraryClasses] BaseLib DebugLib - DxeServicesLib + DtPlatformDtbLoaderLib HiiLib MemoryAllocationLib UefiBootServicesTableLib -- cgit v1.2.3 From 425a1820ddc910193b1feb35e4a2acaea5054c31 Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Sun, 11 Feb 2018 18:42:12 +0800 Subject: EmbeddedPkg/AndroidFastbootApp: fix overflow on fill buf Fix overflow on fill buffer. Signed-off-by: Haojian Zhuang --- .../Application/AndroidFastboot/AndroidFastbootApp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c index 849553630..564965685 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c @@ -180,7 +180,7 @@ FlashSparseImage ( ) { EFI_STATUS Status = EFI_SUCCESS; - UINTN Chunk, Offset = 0, Index; + UINTN Chunk, Offset = 0, Left, Count; VOID *Image; CHUNK_HEADER *ChunkHeader; UINT32 FillBuf[FILL_BUF_SIZE]; @@ -209,20 +209,27 @@ FlashSparseImage ( Offset += ChunkHeader->ChunkSize * SparseHeader->BlockSize; break; case CHUNK_TYPE_FILL: - SetMem32 (FillBuf, FILL_BUF_SIZE * sizeof (UINT32), *(UINT32 *)Image); - Image += sizeof (UINT32); - for (Index = 0; Index < ChunkHeader->ChunkSize; Index++) { + Left = ChunkHeader->ChunkSize * SparseHeader->BlockSize; + while (Left > 0) { + if (Left > FILL_BUF_SIZE * sizeof (UINT32)) { + Count = FILL_BUF_SIZE * sizeof (UINT32); + } else { + Count = Left; + } + SetMem32 (FillBuf, Count, *(UINT32 *)Image); Status = mPlatform->FlashPartitionEx ( PartitionName, Offset, - SparseHeader->BlockSize, + Count, FillBuf ); if (EFI_ERROR (Status)) { return Status; } - Offset += SparseHeader->BlockSize; + Offset += Count; + Left = Left - Count; } + Image += sizeof (UINT32); break; case CHUNK_TYPE_DONT_CARE: Offset += ChunkHeader->ChunkSize * SparseHeader->BlockSize; -- cgit v1.2.3 From 9ab6505992708182b862e3e4dda3ae5ba6d337b7 Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Sun, 11 Feb 2018 19:10:45 +0800 Subject: EmbeddedPkg/AndroidFastbootApp: increase fill buf Increase the fill buffer that could increase the performance. Signed-off-by: Haojian Zhuang --- .../AndroidFastboot/AndroidFastbootApp.c | 33 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c index 564965685..9074c6c77 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c @@ -33,7 +33,8 @@ #define CHUNK_TYPE_DONT_CARE 0xCAC3 #define CHUNK_TYPE_CRC32 0xCAC4 -#define FILL_BUF_SIZE 1024 +#define FILL_BUF_SIZE (16 * 1024 * 1024) +#define SPARSE_BLOCK_SIZE 4096 #define IS_DEVICE_PATH_NODE(node,type,subtype) (((node)->Type == (type)) && ((node)->SubType == (subtype))) @@ -180,14 +181,35 @@ FlashSparseImage ( ) { EFI_STATUS Status = EFI_SUCCESS; - UINTN Chunk, Offset = 0, Left, Count; + UINTN Chunk, Offset = 0, Left, Count, FillBufSize; VOID *Image; CHUNK_HEADER *ChunkHeader; - UINT32 FillBuf[FILL_BUF_SIZE]; + VOID *FillBuf; CHAR16 OutputString[FASTBOOT_STRING_MAX_LENGTH]; Image = (VOID *)SparseHeader; Image += SparseHeader->FileHeaderSize; + + // allocate the fill buf with dynamic size + FillBufSize = FILL_BUF_SIZE; + while (FillBufSize >= SPARSE_BLOCK_SIZE) { + FillBuf = AllocatePool (FillBufSize); + if (FillBuf == NULL) { + FillBufSize = FillBufSize >> 1; + } else { + break; + } + }; + if (FillBufSize < SPARSE_BLOCK_SIZE) { + UnicodeSPrint ( + OutputString, + sizeof (OutputString), + L"Fail to allocate the fill buffer\n" + ); + mTextOut->OutputString (mTextOut, OutputString); + return EFI_BUFFER_TOO_SMALL; + } + for (Chunk = 0; Chunk < SparseHeader->TotalChunks; Chunk++) { ChunkHeader = (CHUNK_HEADER *)Image; DEBUG ((DEBUG_INFO, "Chunk #%d - Type: 0x%x Size: %d TotalSize: %d Offset %d\n", @@ -211,8 +233,8 @@ FlashSparseImage ( case CHUNK_TYPE_FILL: Left = ChunkHeader->ChunkSize * SparseHeader->BlockSize; while (Left > 0) { - if (Left > FILL_BUF_SIZE * sizeof (UINT32)) { - Count = FILL_BUF_SIZE * sizeof (UINT32); + if (Left > FILL_BUF_SIZE) { + Count = FILL_BUF_SIZE; } else { Count = Left; } @@ -245,6 +267,7 @@ FlashSparseImage ( break; } } + FreePool ((VOID *)FillBuf); return Status; } -- cgit v1.2.3 From cc8f41a14ff6764e17ecb25249669d2f4373992f Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Thu, 9 Feb 2017 14:09:02 +0800 Subject: BaseTools: Add NOOPT target in CLANG38 tool chain https://bugzilla.tianocore.org/show_bug.cgi?id=310 Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao Reviewed-by: Yonghong Zhu --- BaseTools/Conf/tools_def.template | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 879be50e8..efaf91e19 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -1,5 +1,5 @@ # -# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
# Copyright (c) 2015, Hewlett-Packard Development Company, L.P.
@@ -5532,10 +5532,6 @@ DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -f *_CLANG38_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG38_IA32_TARGET) *_CLANG38_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 *_CLANG38_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET) -DEBUG_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -*_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386 -*_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O3 *_CLANG38_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_CLANG38_IA32_OBJCOPY_FLAGS = *_CLANG38_IA32_NASM_FLAGS = -f elf32 @@ -5543,6 +5539,18 @@ RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto - *_CLANG38_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET) *_CLANG38_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET) +DEBUG_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g +DEBUG_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386 +DEBUG_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O3 + +RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) +RELEASE_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386 +RELEASE_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O3 + +NOOPT_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g +NOOPT_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat=elf32-i386 +NOOPT_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O0 + ########################## # CLANG38 X64 definitions ########################## @@ -5561,10 +5569,6 @@ RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto - *_CLANG38_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto DEF(CLANG38_X64_TARGET) *_CLANG38_X64_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64 *_CLANG38_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 DEF(CLANG38_X64_TARGET) -DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g -RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -*_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small -*_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3 *_CLANG38_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_CLANG38_X64_OBJCOPY_FLAGS = *_CLANG38_X64_NASM_FLAGS = -f elf64 @@ -5572,6 +5576,18 @@ RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__ *_CLANG38_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_X64_TARGET) *_CLANG38_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_X64_TARGET) +DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g +DEBUG_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small +DEBUG_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3 + +RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) +RELEASE_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small +RELEASE_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3 + +NOOPT_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -O0 DEF(CLANG38_X64_TARGET) -g +NOOPT_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small +NOOPT_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O0 + #################################################################################### # # Cygwin GCC And Intel ACPI Compiler -- cgit v1.2.3 From 6654c256fd2332b2adb5b92d7b7bfbdd2cc7ee42 Mon Sep 17 00:00:00 2001 From: Marvin Haeuser Date: Sun, 5 Mar 2017 09:58:54 +0800 Subject: BaseTools/tools_def: Use armv7-a for CLANG35 ARM compilations. Define "-march=armv7-a" - which is used by the GCC toolchains - for ARM CLAMNG35 builds to fix compilation of the MemoryFence ASM. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marvin Haeuser Reviewed-by: Ard Biesheuvel --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index efaf91e19..519f1a541 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -5459,7 +5459,7 @@ DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64 *_CLANG35_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments *_CLANG35_ARM_DLINK_FLAGS = DEF(CLANG35_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS) *_CLANG35_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 -*_CLANG35_ARM_PLATFORM_FLAGS = +*_CLANG35_ARM_PLATFORM_FLAGS = -march=armv7-a *_CLANG35_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) *_CLANG35_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) *_CLANG35_ARM_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -- cgit v1.2.3 From 8ad2698d290c03632cbe71423837d9cfc4657828 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Tue, 11 Apr 2017 14:21:34 +0800 Subject: BaseTools: Add option in CLANG38 to disable warning unknown-warning-option https://bugzilla.tianocore.org/show_bug.cgi?id=466 Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao Reviewed-by: Yonghong Zhu --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 519f1a541..ec2725a72 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -5512,7 +5512,7 @@ DEFINE CLANG38_X64_PREFIX = ENV(CLANG38_BIN) DEFINE CLANG38_IA32_TARGET = -target i686-pc-linux-gnu DEFINE CLANG38_X64_TARGET = -target x86_64-pc-linux-gnu -DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare +DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare -Wno-unknown-warning-option ########################### # CLANG38 IA32 definitions -- cgit v1.2.3 From b568bc84c782f42bbb832b9a3ab5a51667c810ea Mon Sep 17 00:00:00 2001 From: "Shi, Steven" Date: Wed, 23 Aug 2017 15:01:07 +0800 Subject: BaseTools/Conf: Support LLVM39 and LLVM40 in CLANG38 toolchain https://bugzilla.tianocore.org/show_bug.cgi?id=676 Add LLVM39 and LLVM40 support in CLANG38 toolchain Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Steven Shi Reviewed-by: Liming Gao --- BaseTools/Conf/tools_def.template | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index ec2725a72..f7f7a515a 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -380,7 +380,8 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G # Intel(r) ACPI Compiler from # https://acpica.org/downloads # CLANG38 -Linux- Requires: -# Clang v3.8 or later, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu +# Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu +# Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu # Optional: # Required to build platforms or ACPI tables: # Intel(r) ACPI Compiler from @@ -5512,7 +5513,7 @@ DEFINE CLANG38_X64_PREFIX = ENV(CLANG38_BIN) DEFINE CLANG38_IA32_TARGET = -target i686-pc-linux-gnu DEFINE CLANG38_X64_TARGET = -target x86_64-pc-linux-gnu -DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare -Wno-unknown-warning-option +DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare -Wno-unknown-warning-option -Wno-varargs ########################### # CLANG38 IA32 definitions -- cgit v1.2.3 From cc980a2d4ff56f3691b355c2e707c29f6136b0a2 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Tue, 29 Aug 2017 14:21:02 +0100 Subject: BaseTools/Gcc ARM AARCH64: add support for building device tree binaries While modern AARCH64 server systems use ACPI for describing the platform topology to the OS, ARM systems and AARCH64 outside of the server space mostly use device tree binaries, which are compiled from device tree source files using the device tree compiler. Currently, such source files and binaries may be kept in the EDK2 platform trees, but are not integrated with the build, which means they need to be kept in sync and recompiled manually, which is cumbersome. So let's wire up BaseTools support for them: add tool definitions for the DTC compiler and preprocessor flags that allow these source files to use FixedPcd expressions and other macros defined by AutoGen.h This way, a device tree binary can be built from source and emitted into a FFS file automatically using something like: DeviceTree.inf: [Defines] INF_VERSION = 0x00010019 BASE_NAME = SomePlatformDeviceTree FILE_GUID = 25462CDA-221F-47DF-AC1D-259CFAA4E326 # gDtPlatformDefaultDtbFileGuid MODULE_TYPE = USER_DEFINED VERSION_STRING = 1.0 [Sources] SomePlatform.dts [Packages] MdePkg/MdePkg.dec SomePlatform.fdf: INF RuleOverride = DTB xxx/yyy/DeviceTree.inf [Rule.Common.USER_DEFINED.DTB] FILE FREEFORM = $(NAMED_GUID) { RAW BIN |.dtb } where it can be picked at runtime by the DTB loader that may refer to it using gDtPlatformDefaultDtbFileGuid. Note that this is very similar to how ACPI tables may be emitted into a FFS file with a known GUID and picked up by AcpiTableDxe at runtime. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Acked-by: Laszlo Ersek Reviewed-by: Leif Lindholm Reviewed-by: Liming Gao --- BaseTools/Conf/build_rule.template | 14 ++++++++++++++ BaseTools/Conf/tools_def.template | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index 1db94b696..2684c8c99 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -238,6 +238,20 @@ # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues "$(ASM)" $(ASM_FLAGS) -o ${dst} ${d_path}(+)${s_base}.iii +[Device-Tree-Source-File] + + ?.dts + + + $(MAKE_FILE) + + + $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dtb + + + "$(PP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + "$(DTC)" -I dts -O dtb -o ${dst} ${d_path}(+)${s_base}.i + [Visual-Form-Representation-File] ?.vfr diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index f7f7a515a..88e51dd39 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -227,6 +227,8 @@ DEFINE IPHONE_TOOLS = /Developer/Platforms/iPhoneOS.platform/Develope DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin +DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc + #################################################################################### # # format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = @@ -4363,6 +4365,7 @@ DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(DEST_DI DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h DEFINE GCC_ASLCC_FLAGS = -x c DEFINE GCC_WINDRES_FLAGS = -J rc -O coff +DEFINE GCC_DTCPP_FLAGS = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc DEFINE GCC_IA32_RC_FLAGS = -I binary -O elf32-i386 -B i386 --rename-section .data=.hii DEFINE GCC_X64_RC_FLAGS = -I binary -O elf64-x86-64 -B i386 --rename-section .data=.hii DEFINE GCC_IPF_RC_FLAGS = -I binary -O elf64-ia64-little -B ia64 --rename-section .data=.hii @@ -4746,6 +4749,7 @@ RELEASE_GCC45_X64_CC_FLAGS = DEF(GCC45_X64_CC_FLAGS) -Os *_GCC46_*_MAKE_PATH = DEF(GCC46_IA32_PREFIX)make *_GCC46_*_*_DLL = ENV(GCC46_DLL) *_GCC46_*_ASL_PATH = DEF(UNIX_IASL_BIN) +*_GCC46_*_DTC_PATH = DEF(DTC_BIN) *_GCC46_*_PP_FLAGS = DEF(GCC_PP_FLAGS) *_GCC46_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) @@ -4834,6 +4838,7 @@ RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Os -Wno-unused-but-s *_GCC46_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS) *_GCC46_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS) *_GCC46_ARM_DLINK2_FLAGS = DEF(GCC46_ARM_DLINK2_FLAGS) +*_GCC46_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC46_ARM_PLATFORM_FLAGS = -march=armv7-a *_GCC46_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC46_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) @@ -4855,6 +4860,7 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v *_GCC47_*_MAKE_PATH = DEF(GCC47_IA32_PREFIX)make *_GCC47_*_*_DLL = ENV(GCC47_DLL) *_GCC47_*_ASL_PATH = DEF(UNIX_IASL_BIN) +*_GCC47_*_DTC_PATH = DEF(DTC_BIN) *_GCC47_*_PP_FLAGS = DEF(GCC_PP_FLAGS) *_GCC47_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) @@ -4942,6 +4948,7 @@ RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Os -Wno-unused-but-s *_GCC47_ARM_ASM_FLAGS = DEF(GCC47_ARM_ASM_FLAGS) *_GCC47_ARM_DLINK_FLAGS = DEF(GCC47_ARM_DLINK_FLAGS) *_GCC47_ARM_DLINK2_FLAGS = DEF(GCC47_ARM_DLINK2_FLAGS) +*_GCC47_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC47_ARM_PLATFORM_FLAGS = -march=armv7-a *_GCC47_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC47_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) @@ -4971,6 +4978,7 @@ RELEASE_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v *_GCC47_AARCH64_ASM_FLAGS = DEF(GCC47_AARCH64_ASM_FLAGS) *_GCC47_AARCH64_DLINK_FLAGS = DEF(GCC47_AARCH64_DLINK_FLAGS) *_GCC47_AARCH64_DLINK2_FLAGS = DEF(GCC47_AARCH64_DLINK2_FLAGS) +*_GCC47_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC47_AARCH64_PLATFORM_FLAGS = *_GCC47_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC47_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS) @@ -4992,6 +5000,7 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC48_*_MAKE_PATH = DEF(GCC48_IA32_PREFIX)make *_GCC48_*_*_DLL = ENV(GCC48_DLL) *_GCC48_*_ASL_PATH = DEF(UNIX_IASL_BIN) +*_GCC48_*_DTC_PATH = DEF(DTC_BIN) *_GCC48_*_PP_FLAGS = DEF(GCC_PP_FLAGS) *_GCC48_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) @@ -5079,6 +5088,7 @@ RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os -Wno-unused-but-s *_GCC48_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS) *_GCC48_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS) *_GCC48_ARM_DLINK2_FLAGS = DEF(GCC48_ARM_DLINK2_FLAGS) +*_GCC48_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC48_ARM_PLATFORM_FLAGS = -march=armv7-a *_GCC48_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC48_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) @@ -5108,6 +5118,7 @@ RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v *_GCC48_AARCH64_ASM_FLAGS = DEF(GCC48_AARCH64_ASM_FLAGS) *_GCC48_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS) *_GCC48_AARCH64_DLINK2_FLAGS = DEF(GCC48_AARCH64_DLINK2_FLAGS) +*_GCC48_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC48_AARCH64_PLATFORM_FLAGS = *_GCC48_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC48_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS) @@ -5129,6 +5140,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC49_*_MAKE_PATH = DEF(GCC49_IA32_PREFIX)make *_GCC49_*_*_DLL = ENV(GCC49_DLL) *_GCC49_*_ASL_PATH = DEF(UNIX_IASL_BIN) +*_GCC49_*_DTC_PATH = DEF(DTC_BIN) *_GCC49_*_PP_FLAGS = DEF(GCC_PP_FLAGS) *_GCC49_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) @@ -5216,6 +5228,7 @@ RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os -Wno-unused-but-s *_GCC49_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS) *_GCC49_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS) *_GCC49_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS) +*_GCC49_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC49_ARM_PLATFORM_FLAGS = -march=armv7-a *_GCC49_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC49_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) @@ -5244,6 +5257,7 @@ RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v *_GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS) *_GCC49_AARCH64_ASM_FLAGS = DEF(GCC49_AARCH64_ASM_FLAGS) *_GCC49_AARCH64_DLINK2_FLAGS = DEF(GCC49_AARCH64_DLINK2_FLAGS) +*_GCC49_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC49_AARCH64_PLATFORM_FLAGS = *_GCC49_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC49_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS) @@ -5272,6 +5286,7 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) *_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)make *_GCC5_*_*_DLL = ENV(GCC5_DLL) *_GCC5_*_ASL_PATH = DEF(UNIX_IASL_BIN) +*_GCC5_*_DTC_PATH = DEF(DTC_BIN) *_GCC5_*_PP_FLAGS = DEF(GCC_PP_FLAGS) *_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) @@ -5364,6 +5379,7 @@ RELEASE_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os *_GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC5_ARM_ASLDLINK_FLAGS) *_GCC5_ARM_ASM_FLAGS = DEF(GCC5_ARM_ASM_FLAGS) *_GCC5_ARM_DLINK2_FLAGS = DEF(GCC5_ARM_DLINK2_FLAGS) +*_GCC5_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC5_ARM_PLATFORM_FLAGS = -march=armv7-a *_GCC5_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC5_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) @@ -5397,6 +5413,7 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS *_GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC5_AARCH64_ASLDLINK_FLAGS) *_GCC5_AARCH64_ASM_FLAGS = DEF(GCC5_AARCH64_ASM_FLAGS) *_GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC5_AARCH64_DLINK2_FLAGS) +*_GCC5_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_GCC5_AARCH64_PLATFORM_FLAGS = *_GCC5_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) *_GCC5_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS) @@ -5426,12 +5443,14 @@ RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(W *_CLANG35_*_MAKE_PATH = make *_CLANG35_*_*_DLL = ENV(CLANG35_DLL) *_CLANG35_*_ASL_PATH = DEF(UNIX_IASL_BIN) +*_CLANG35_*_DTC_PATH = DEF(DTC_BIN) *_CLANG35_*_PP_FLAGS = DEF(GCC_PP_FLAGS) *_CLANG35_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) *_CLANG35_*_APP_FLAGS = *_CLANG35_*_ASL_FLAGS = DEF(IASL_FLAGS) *_CLANG35_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS) +*_CLANG35_*_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) *_CLANG35_*_CC_PATH = ENV(CLANG35_BIN)clang *_CLANG35_*_ASM_PATH = ENV(CLANG35_BIN)clang -- cgit v1.2.3 From 7a097546339509e1901763872a4f4d1d9fc3c5a3 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 6 Dec 2017 11:30:05 +0000 Subject: BaseTools/tools_def: add CLANG38 LTO versions for AARCH64 and ARM Extend the CLANG38 toolchain definition so it can be used for ARM and AARCH64 as well. Note that this requires llvm-ar and the LLVMgold.so linker plugin. In preparation of doing the same for GCC5, this toolchain version also departs from the custom of using -O0 for DEBUG builds, which makes them needlessly slow. Instead, let's add a NOOPT flavor as well, and enable optimization for DEBUG like the other architectures do. (Note that this will require some trivial changes to the platform description files) Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Acked-by: Laszlo Ersek Tested-by: Leif Lindholm Reviewed-by: Leif Lindholm Reviewed-by: Liming Gao --- BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 3 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 88e51dd39..79d19e9d8 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -382,8 +382,8 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc # Intel(r) ACPI Compiler from # https://acpica.org/downloads # CLANG38 -Linux- Requires: -# Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu -# Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu +# Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi +# Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi # Optional: # Required to build platforms or ACPI tables: # Intel(r) ACPI Compiler from @@ -5521,6 +5521,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) *_CLANG38_*_MAKE_PATH = make *_CLANG38_*_*_DLL = ENV(CLANG38_DLL) *_CLANG38_*_ASL_PATH = DEF(UNIX_IASL_BIN) +*_CLANG38_*_DTC_PATH = DEF(DTC_BIN) *_CLANG38_*_APP_FLAGS = *_CLANG38_*_ASL_FLAGS = DEF(IASL_FLAGS) @@ -5532,7 +5533,8 @@ DEFINE CLANG38_X64_PREFIX = ENV(CLANG38_BIN) DEFINE CLANG38_IA32_TARGET = -target i686-pc-linux-gnu DEFINE CLANG38_X64_TARGET = -target x86_64-pc-linux-gnu -DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare -Wno-unknown-warning-option -Wno-varargs +DEFINE CLANG38_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-varargs +DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-unknown-warning-option ########################### # CLANG38 IA32 definitions @@ -5608,6 +5610,96 @@ NOOPT_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__ NOOPT_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small NOOPT_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O0 +################## +# CLANG38 ARM definitions +################## +DEFINE CLANG38_ARM_TARGET = -target arm-linux-gnueabihf +DEFINE CLANG38_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt +DEFINE CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS) + +*_CLANG38_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) +*_CLANG38_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) +*_CLANG38_ARM_APP_FLAGS = +*_CLANG38_ARM_ASL_FLAGS = DEF(IASL_FLAGS) +*_CLANG38_ARM_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS) +*_CLANG38_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) + +*_CLANG38_ARM_CC_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_ARM_ASM_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_ARM_PP_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_ARM_VFRPP_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_ARM_ASLCC_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_ARM_ASLPP_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_ARM_DLINK_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_ARM_ASLDLINK_PATH = ENV(CLANG38_BIN)clang + +*_CLANG38_ARM_SLINK_PATH = ENV(CLANG38_BIN)llvm-ar +*_CLANG38_ARM_RC_PATH = ENV(CLANG38_ARM_PREFIX)objcopy + +*_CLANG38_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto +*_CLANG38_ARM_ASLDLINK_FLAGS = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_ASLDLINK_FLAGS) +*_CLANG38_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments +*_CLANG38_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 +*_CLANG38_ARM_PLATFORM_FLAGS = -march=armv7-a +*_CLANG38_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) +*_CLANG38_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) +*_CLANG38_ARM_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) +*_CLANG38_ARM_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_ARM_TARGET) +*_CLANG38_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS) + + DEBUG_CLANG38_ARM_CC_FLAGS = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O1 + DEBUG_CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O1 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm + NOOPT_CLANG38_ARM_CC_FLAGS = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0 + NOOPT_CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_DLINK_FLAGS) +RELEASE_CLANG38_ARM_CC_FLAGS = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O3 +RELEASE_CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm + +################## +# CLANG38 AARCH64 definitions +################## +DEFINE CLANG38_AARCH64_TARGET = -target aarch64-linux-gnu +DEFINE CLANG38_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES) +DEFINE CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 + +*_CLANG38_AARCH64_PP_FLAGS = DEF(GCC_PP_FLAGS) +*_CLANG38_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) +*_CLANG38_AARCH64_APP_FLAGS = +*_CLANG38_AARCH64_ASL_FLAGS = DEF(IASL_FLAGS) +*_CLANG38_AARCH64_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS) +*_CLANG38_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS) + +*_CLANG38_AARCH64_CC_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_AARCH64_ASM_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_AARCH64_PP_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_AARCH64_VFRPP_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_AARCH64_ASLCC_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_AARCH64_ASLPP_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_AARCH64_DLINK_PATH = ENV(CLANG38_BIN)clang +*_CLANG38_AARCH64_ASLDLINK_PATH = ENV(CLANG38_BIN)clang + +*_CLANG38_AARCH64_SLINK_PATH = ENV(CLANG38_BIN)llvm-ar +*_CLANG38_AARCH64_RC_PATH = ENV(CLANG38_AARCH64_PREFIX)objcopy + +*_CLANG38_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto +*_CLANG38_AARCH64_ASLDLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS) +*_CLANG38_AARCH64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments +*_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 +*_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 +*_CLANG38_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 +*_CLANG38_AARCH64_PLATFORM_FLAGS = +*_CLANG38_AARCH64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) +*_CLANG38_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS) +*_CLANG38_AARCH64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) +*_CLANG38_AARCH64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_AARCH64_TARGET) +*_CLANG38_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS) + + DEBUG_CLANG38_AARCH64_CC_FLAGS = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O1 + DEBUG_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O1 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 + NOOPT_CLANG38_AARCH64_CC_FLAGS = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0 + NOOPT_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) +RELEASE_CLANG38_AARCH64_CC_FLAGS = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O3 +RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 + #################################################################################### # # Cygwin GCC And Intel ACPI Compiler -- cgit v1.2.3 From 90598505dd85acd96d89446d13c023a8a784dbe8 Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Tue, 6 Mar 2018 17:30:55 +0800 Subject: EmbeddedPkg/Abootimg.h: fix definition error on function Fix definition error on function. Signed-off-by: Haojian Zhuang --- EmbeddedPkg/Include/Protocol/Abootimg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EmbeddedPkg/Include/Protocol/Abootimg.h b/EmbeddedPkg/Include/Protocol/Abootimg.h index c85dad2d1..7452df698 100644 --- a/EmbeddedPkg/Include/Protocol/Abootimg.h +++ b/EmbeddedPkg/Include/Protocol/Abootimg.h @@ -33,8 +33,8 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *ABOOTIMG_UPDATE_DTB) ( - IN EFI_PHYSICAL_ADDRESS OrigDtbBase; - OUT EFI_PHYSICAL_ADDRESS *NewDtbBase; + IN EFI_PHYSICAL_ADDRESS OrigDtbBase, + OUT EFI_PHYSICAL_ADDRESS *NewDtbBase ); struct _ABOOTIMG_PROTOCOL { -- cgit v1.2.3 From b82f857de1754b3ecb982b362e99e35a8ff5b0da Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Mon, 26 Mar 2018 12:55:24 +0800 Subject: EmbeddedPkg/AndroidFastboot: add delay before reboot Add delay since some data may not be synced into storage device. Signed-off-by: Haojian Zhuang --- EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c | 2 ++ EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf | 1 + 2 files changed, 3 insertions(+) diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c index 9074c6c77..fb3178314 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -439,6 +440,7 @@ AcceptCmd ( } } SEND_LITERAL ("OKAY"); + MicroSecondDelay (3000000); gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); // Shouldn't get here diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf index b62c41d21..dd17aa824 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf @@ -35,6 +35,7 @@ MemoryAllocationLib PcdLib PrintLib + TimerLib UefiApplicationEntryPoint UefiBootServicesTableLib UefiLib -- cgit v1.2.3