From 7ea190331e5ee9055b0acf03013e7f9df478cd1a Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Fri, 30 Mar 2018 16:27:13 +0800 Subject: Revert "EmbeddedPkg/AndroidFastboot: add delay before reboot" This reverts commit af60f944df3f405235f1bcdc8a6682628429c753. Since the similar function is merged into ARM Trusted Firmware, we don't need to implement it in edk2 common code any more. Signed-off-by: Haojian Zhuang --- EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c | 2 -- EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf | 1 - 2 files changed, 3 deletions(-) diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c index fb3178314..9074c6c77 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -440,7 +439,6 @@ 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 dd17aa824..b62c41d21 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf @@ -35,7 +35,6 @@ MemoryAllocationLib PcdLib PrintLib - TimerLib UefiApplicationEntryPoint UefiBootServicesTableLib UefiLib -- cgit v1.2.3 From da058e815271df4d3b520fadb5300ad7c66c86f3 Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Mon, 16 Apr 2018 14:42:27 +0800 Subject: MdeModulePkg/UfsPassThruDxe: avoid ufs hang by adding delay When UEFI is built in release mode, it's always hang on HiKey960 platform without this patch. Signed-off-by: Haojian Zhuang --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c index e71be6afc..335bd99c8 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c @@ -1195,6 +1195,7 @@ UfsRwFlags ( ASSERT (QueryResp != NULL); CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32); + MicroSecondDelay (100000); // // Start to execute the transfer request. // @@ -1362,6 +1363,7 @@ UfsExecNopCmds ( ASSERT (NopInUpiu != NULL); CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32); + MicroSecondDelay (100000); // // Start to execute the transfer request. // -- cgit v1.2.3 From 76f0d9ab5b9b162d91a69bcd143a7f3f476b058f Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Wed, 18 Apr 2018 11:36:13 +0800 Subject: MdeModulePkg/UfsPassThruDxe: use loop to polling UTRLRSR In Hi3660 SoC, need to poll UTRLRSR by loop. Signed-off-by: Haojian Zhuang --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c index 335bd99c8..fbb31edf6 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c @@ -811,12 +811,14 @@ UfsStartExecCmd ( UINT32 Data; EFI_STATUS Status; - Status = UfsMmioRead32 (Private, UFS_HC_UTRLRSR_OFFSET, &Data); - if (EFI_ERROR (Status)) { - return Status; - } - - if ((Data & UFS_HC_UTRLRSR) != UFS_HC_UTRLRSR) { + for (;;) { + Status = UfsMmioRead32 (Private, UFS_HC_UTRLRSR_OFFSET, &Data); + if (EFI_ERROR (Status)) { + return Status; + } + if ((Data & UFS_HC_UTRLRSR) == UFS_HC_UTRLRSR) { + break; + } Status = UfsMmioWrite32 (Private, UFS_HC_UTRLRSR_OFFSET, UFS_HC_UTRLRSR); if (EFI_ERROR (Status)) { return Status; @@ -1195,7 +1197,6 @@ UfsRwFlags ( ASSERT (QueryResp != NULL); CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32); - MicroSecondDelay (100000); // // Start to execute the transfer request. // @@ -1363,7 +1364,6 @@ UfsExecNopCmds ( ASSERT (NopInUpiu != NULL); CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32); - MicroSecondDelay (100000); // // Start to execute the transfer request. // -- cgit v1.2.3 From 534df93ade3d02d9fcb19329b3de9a350d62d49f Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 18 May 2018 19:20:32 +0200 Subject: BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS The ElfConvert routines in GenFw don't handle the ".eh_frame" ELF section emitted by gcc. For this reason, Leif disabled the generation of that section for AARCH64 with "-fno-asynchronous-unwind-tables" in commit 28e80befa4fe [1], and Ard did the same for IA32 and X64 in commit 26ecc55c027d [2]. (The CLANG38 toolchain received the same flag at its inception, in commit 6f756db5ea05 [3].) However, ".eh_frame" is back now; in upstream gcc commit 9cbee213b579 [4] (part of tag "gcc-8_1_0-release"), both "-fasynchronous-unwind-tables" and "-funwind-tables" were made the default for AARCH64. (The patch author described the effects on the gcc mailing list [5].) We have to counter the latter flag with "-fno-unwind-tables", otherwise GenFw chokes on ".eh_frame" again (triggered for example on Fedora 28). "-f[no-]unwind-tables" goes back to at least gcc-4.4 [6], so it's safe to add to GCC_AARCH64_CC_FLAGS. [1] https://github.com/tianocore/edk2/commit/28e80befa4fe [2] https://github.com/tianocore/edk2/commit/26ecc55c027d [3] https://github.com/tianocore/edk2/commit/6f756db5ea05 [4] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9cbee213b579 [5] http://mid.mail-archive.com/7b28c03a-c032-6cec-c127-1c12cbe98eeb@foss.arm.com [6] https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Code-Gen-Options.html Cc: "Danilo C. L. de Paula" Cc: Ard Biesheuvel Cc: Cole Robinson Cc: Gerd Hoffmann Cc: Leif Lindholm Cc: Liming Gao Cc: Paolo Bonzini Cc: Yonghong Zhu Reported-by: "Danilo C. L. de Paula" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Reviewed-by: Liming Gao --- 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 79d19e9d8..7736cfb5c 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4344,7 +4344,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 -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-pic -fno-pie -ffixed-x18 +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-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 ce3fe5ea2186566f2a5b8f255a7bb7ea7820cf3e Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Tue, 14 Aug 2018 14:13:29 +0800 Subject: EmbeddedPkg/AbootimgLib: make initrd kernel parameter flexible Create "initrd=" kenrel parameter only when ramdisk exists in boot image. Signed-off-by: Haojian Zhuang --- EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c | 36 ++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c b/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c index a8db3ac1a..7b81d079c 100644 --- a/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c +++ b/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c @@ -268,23 +268,25 @@ AllocateRamdisk ( ASSERT (IS_POWER_OF_2 (Header->PageSize)); - Address = (EFI_PHYSICAL_ADDRESS)(UINTN)Header->RamdiskAddress; - Status = gBS->AllocatePages ( - AllocateAddress, EfiBootServicesData, - EFI_SIZE_TO_PAGES (Header->RamdiskSize), &Address); - if (EFI_ERROR (Status)) { - return Status; - } - Source = (VOID *) (BootImgBytePtr + Header->PageSize + - ALIGN_VALUE (Header->KernelSize, Header->PageSize)); - CopyMem ((VOID *)(UINTN)Address, Source, Header->RamdiskSize); - // Set the ramdisk in command line arguments - if (KernelArgs != NULL) { - UnicodeSPrint ( - (CHAR16 *)KernelArgs + StrLen (KernelArgs), BOOTIMG_KERNEL_ARGS_SIZE, - L" initrd=0x%x,0x%x", - (UINTN)Address, Header->RamdiskSize - ); + if (Header->RamdiskAddress && Header->RamdiskSize) { + Address = (EFI_PHYSICAL_ADDRESS)(UINTN)Header->RamdiskAddress; + Status = gBS->AllocatePages ( + AllocateAddress, EfiBootServicesData, + EFI_SIZE_TO_PAGES (Header->RamdiskSize), &Address); + if (EFI_ERROR (Status)) { + return Status; + } + Source = (VOID *) (BootImgBytePtr + Header->PageSize + + ALIGN_VALUE (Header->KernelSize, Header->PageSize)); + CopyMem ((VOID *)(UINTN)Address, Source, Header->RamdiskSize); + // Set the ramdisk in command line arguments + if (KernelArgs != NULL) { + UnicodeSPrint ( + (CHAR16 *)KernelArgs + StrLen (KernelArgs), BOOTIMG_KERNEL_ARGS_SIZE, + L" initrd=0x%x,0x%x", + (UINTN)Address, Header->RamdiskSize + ); + } } return Status; } -- cgit v1.2.3 From b1429dae6d20810a64a771d32bbfa5d20bf9a3de Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Tue, 14 Aug 2018 15:33:03 +0800 Subject: EmbeddedPkg/AbootimgLib: fix unused Status variable Signed-off-by: Haojian Zhuang --- EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c b/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c index 7b81d079c..b4cd1e4d2 100644 --- a/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c +++ b/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c @@ -268,6 +268,7 @@ AllocateRamdisk ( ASSERT (IS_POWER_OF_2 (Header->PageSize)); + Status = EFI_SUCCESS; if (Header->RamdiskAddress && Header->RamdiskSize) { Address = (EFI_PHYSICAL_ADDRESS)(UINTN)Header->RamdiskAddress; Status = gBS->AllocatePages ( -- cgit v1.2.3