Skip to content

Commit 64fc19a

Browse files
qianyu-qcomHangtian Zhu
authored andcommitted
UPSTREAM: 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
1 parent 190dcc1 commit 64fc19a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/bus/mhi/host/boot.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,16 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
584584
* device transitioning into MHI READY state
585585
*/
586586
if (fw_load_type == MHI_FW_LOAD_FBC) {
587+
/*
588+
* Some FW combine two separate ELF images (SBL + WLAN FW) in a single
589+
* file. Hence, check for the existence of the second ELF header after
590+
* SBL. If present, load the second image separately.
591+
*/
592+
if (!memcmp(fw_data + mhi_cntrl->sbl_size, ELFMAG, SELFMAG)) {
593+
fw_data += mhi_cntrl->sbl_size;
594+
fw_sz -= mhi_cntrl->sbl_size;
595+
}
596+
587597
ret = mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image, fw_sz);
588598
if (ret) {
589599
release_firmware(firmware);

0 commit comments

Comments
 (0)