summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiang Yu <qiang.yu@oss.qualcomm.com>2025-12-24 06:05:26 +0300
committerManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>2025-12-24 08:12:36 +0300
commit820c866c42de99e7d65c7bd1f591f067dbbe3cae (patch)
tree0357241496e8a00e322b66576c3335ef0ad4b6a5
parent8f0b4cce4481fb22653697cced8d0d04027cb1e8 (diff)
downloadlinux-820c866c42de99e7d65c7bd1f591f067dbbe3cae.tar.xz
mhi: host: Add support for loading dual ELF image format
Currently, the FBC image contains a single ELF header followed by segments for both SBL and WLAN FW. However, TME-L (Trust Management Engine Lite) supported devices (e.g., QCC2072) require separate ELF headers for SBL and WLAN FW segments due to TME-L image authentication requirements. Current image format contains two sections in a single binary: - First 512KB: ELF header + SBL segments - Remaining: WLAN FW segments (raw data) The TME-L supported image format contains two complete ELF files in a single binary: - First 512KB: Complete SBL ELF file (ELF header + SBL segments) - Remaining: Complete WLAN FW ELF file (ELF header + WLAN FW segments) Download behavior: - Legacy: 1. First 512KB via BHI (ELF header + SBL) 2. Full image via BHIe - TME-L: 1. First 512KB via BHI (SBL ELF file) 2. Remaining via BHIe (WLAN FW ELF file only) Add runtime detection to automatically identify the image format by checking for the presence of a second ELF header at the 512KB boundary. When detected, MHI skips the first 512KB during WLAN FW download over BHIe as it is loaded in BHI phase. Signed-off-by: Qiang Yu <qiang.yu@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20251223-wlan_image_load_skip_512k-v5-1-8d4459d720b5@oss.qualcomm.com
-rw-r--r--drivers/bus/mhi/host/boot.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/bus/mhi/host/boot.c b/drivers/bus/mhi/host/boot.c
index 205d83ac069f..c76db35bc29a 100644
--- a/drivers/bus/mhi/host/boot.c
+++ b/drivers/bus/mhi/host/boot.c
@@ -584,6 +584,16 @@ skip_req_fw:
* device transitioning into MHI READY state
*/
if (fw_load_type == MHI_FW_LOAD_FBC) {
+ /*
+ * Some FW combine two separate ELF images (SBL + WLAN FW) in a single
+ * file. Hence, check for the existence of the second ELF header after
+ * SBL. If present, load the second image separately.
+ */
+ if (!memcmp(fw_data + mhi_cntrl->sbl_size, ELFMAG, SELFMAG)) {
+ fw_data += mhi_cntrl->sbl_size;
+ fw_sz -= mhi_cntrl->sbl_size;
+ }
+
ret = mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image, fw_sz);
if (ret) {
release_firmware(firmware);