diff options
author | Mukesh Ojha <mojha@codeaurora.org> | 2018-04-10 17:37:56 +0530 |
---|---|---|
committer | Mukesh Ojha <mojha@codeaurora.org> | 2018-04-25 11:01:50 +0530 |
commit | d29676ad558ed2698e3fae09bc2424d561637315 (patch) | |
tree | ad58a09e478441791c7d6d2ae5b4c7be9f11dc8d | |
parent | 363c7d2e0823a8b0616bdaec4c65c1221e5550ee (diff) |
QcomModulePkg: Compile time flag to enable/disable parallel download flash feature
Parallel download and flash feature is enabled by default. However,
we can have a compile time flag to disable/enable it.
Change-Id: I48d378dd08aa653c92d9d6e2ab3c14fd7475e9f5
-rw-r--r-- | AndroidBoot.mk | 2 | ||||
-rw-r--r-- | QcomModulePkg/Library/FastbootLib/FastbootCmds.c | 59 | ||||
-rw-r--r-- | QcomModulePkg/QcomModulePkg.dsc | 3 | ||||
-rw-r--r-- | makefile | 1 |
4 files changed, 44 insertions, 21 deletions
diff --git a/AndroidBoot.mk b/AndroidBoot.mk index ba448dff6f..f3f28f6605 100644 --- a/AndroidBoot.mk +++ b/AndroidBoot.mk @@ -12,6 +12,7 @@ ifneq ($(wildcard $(SDCLANG_PATH)),) ABL_USE_SDLLVM := true endif +DISABLE_PARALLEL_DOWNLOAD_FLASH := DISABLE_PARALLEL_DOWNLOAD_FLASH=0 ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true) VERIFIED_BOOT := VERIFIED_BOOT=1 else @@ -81,6 +82,7 @@ $(TARGET_ABL): abl_clean | $(ABL_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET) $(VERIFIED_BOOT_2) \ $(VERIFIED_BOOT_LE) \ $(USER_BUILD_VARIANT) \ + $(DISABLE_PARALLEL_DOWNLOAD_FLASH) \ CLANG_BIN=$(CLANG_BIN) \ CLANG_PREFIX=$(CLANG35_PREFIX)\ ABL_USE_SDLLVM=$(ABL_USE_SDLLVM) \ diff --git a/QcomModulePkg/Library/FastbootLib/FastbootCmds.c b/QcomModulePkg/Library/FastbootLib/FastbootCmds.c index a86c7767d7..8adcac6db7 100644 --- a/QcomModulePkg/Library/FastbootLib/FastbootCmds.c +++ b/QcomModulePkg/Library/FastbootLib/FastbootCmds.c @@ -181,6 +181,18 @@ typedef struct { VOID *Data; } CmdInfo; +#ifdef DISABLE_PARALLEL_DOWNLOAD_FLASH +BOOLEAN IsDisableParallelDownloadFlash (VOID) +{ + return TRUE; +} +#else +BOOLEAN IsDisableParallelDownloadFlash (VOID) +{ + return FALSE; +} +#endif + /* Clean up memory for the getvar variables during exit */ STATIC EFI_STATUS FastbootUnInit (VOID) { @@ -1640,7 +1652,8 @@ CmdFlash (IN CONST CHAR8 *arg, IN VOID *data, IN UINT32 sz) PartitionSize = (BlockIo->Media->LastBlock + 1) * (BlockIo->Media->BlockSize); - if (PartitionSize > MAX_DOWNLOAD_SIZE) { + if ((PartitionSize > MAX_DOWNLOAD_SIZE) && + !IsDisableParallelDownloadFlash ()) { Status = HandleUsbEventsInTimer (); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Failed to handle usb event: %r\n", Status)); @@ -1679,7 +1692,8 @@ CmdFlash (IN CONST CHAR8 *arg, IN VOID *data, IN UINT32 sz) if ((sparse_header->magic != SPARSE_HEADER_MAGIC) || (PartitionSize < MAX_DOWNLOAD_SIZE) || ((PartitionSize > MAX_DOWNLOAD_SIZE) && - (Status != EFI_SUCCESS))) { + (IsDisableParallelDownloadFlash () || + (Status != EFI_SUCCESS)))) { if (EFI_ERROR (FlashResult)) { if (FlashResult == EFI_NOT_FOUND) { AsciiSPrint (FlashResultStr, MAX_RSP_SIZE, "(%s) No such partition", @@ -2602,29 +2616,32 @@ AcceptCmd (IN UINT64 Size, IN CHAR8 *Data) Size = MAX_FASTBOOT_COMMAND_SIZE; Data[Size] = '\0'; - /* Wait for flash finished before next command */ - if (AsciiStrnCmp (Data, "download", AsciiStrLen ("download"))) { - StopUsbTimer (); - if (!IsFlashComplete) { - Status = AcceptCmdTimerInit (Size, Data); - if (Status == EFI_SUCCESS) - return; - } - } - DEBUG ((EFI_D_INFO, "Handling Cmd: %a\n", Data)); - /* Check last flash result */ - if (FlashResult != EFI_SUCCESS) { - AsciiSPrint (FlashResultStr, MAX_RSP_SIZE, "%a : %r", + if (!IsDisableParallelDownloadFlash ()) { + /* Wait for flash finished before next command */ + if (AsciiStrnCmp (Data, "download", AsciiStrLen ("download"))) { + StopUsbTimer (); + if (!IsFlashComplete) { + Status = AcceptCmdTimerInit (Size, Data); + if (Status == EFI_SUCCESS) { + return; + } + } + } + + /* Check last flash result */ + if (FlashResult != EFI_SUCCESS) { + AsciiSPrint (FlashResultStr, MAX_RSP_SIZE, "%a : %r", "Error: Last flash failed", FlashResult); - DEBUG ((EFI_D_ERROR, "%a\n", FlashResultStr)); - if (!AsciiStrnCmp (Data, "flash", AsciiStrLen ("flash")) || - !AsciiStrnCmp (Data, "download", AsciiStrLen ("download"))) { - FastbootFail (FlashResultStr); - FlashResult = EFI_SUCCESS; - return; + DEBUG ((EFI_D_ERROR, "%a\n", FlashResultStr)); + if (!AsciiStrnCmp (Data, "flash", AsciiStrLen ("flash")) || + !AsciiStrnCmp (Data, "download", AsciiStrLen ("download"))) { + FastbootFail (FlashResultStr); + FlashResult = EFI_SUCCESS; + return; + } } } diff --git a/QcomModulePkg/QcomModulePkg.dsc b/QcomModulePkg/QcomModulePkg.dsc index 134d38ee9f..9ed72092ea 100644 --- a/QcomModulePkg/QcomModulePkg.dsc +++ b/QcomModulePkg/QcomModulePkg.dsc @@ -116,6 +116,9 @@ !if $(BUILD_SYSTEM_ROOT_IMAGE) GCC:*_*_*_CC_FLAGS = -DBUILD_SYSTEM_ROOT_IMAGE !endif + !if $(DISABLE_PARALLEL_DOWNLOAD_FLASH) == 1 + GCC:*_*_*_CC_FLAGS = -DDISABLE_PARALLEL_DOWNLOAD_FLASH + !endif [PcdsFixedAtBuild.common] @@ -90,6 +90,7 @@ ABL_FV_IMG: EDK_TOOLS_BIN -D VERIFIED_BOOT_2=$(VERIFIED_BOOT_2) \ -D VERIFIED_BOOT_LE=$(VERIFIED_BOOT_LE) \ -D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) \ + -D DISABLE_PARALLEL_DOWNLOAD_FLASH=$(DISABLE_PARALLEL_DOWNLOAD_FLASH) \ -D ENABLE_LE_VARIANT=$(ENABLE_LE_VARIANT) \ -D UBSAN_UEFI_GCC_FLAG_UNDEFINED=$(UBSAN_GCC_FLAG_UNDEFINED) \ -D UBSAN_UEFI_GCC_FLAG_ALIGNMENT=$(UBSAN_GCC_FLAG_ALIGNMENT) \ |