board: samsung: e850-96: Load LDFW in board_late_init()
PATCH v2 1/1 board: samsung: e850-96: Load LDFW in board_late_init()
As stated in 5e847f7729b3 ("efi_loader: call efi_init_early() earlier"):
efi_init_early() creates an event hook for block device probing. It has to be called before any block device is probed.
Indeed, efi_bl_init() registers EVT_DM_POST_PROBE event, which calls efi_disk_probe() whenever any block device is probed. And to make that hook work, the initialization of all block devices was put after efi_init_early() in initcall_run_r():
INITCALL(efi_init_early);
INITCALL(initr_nand);
INITCALL(initr_onenand);
INITCALL(initr_mmc);Because LDFW firmware is being read from MMC, attempt to load LDFW in board_init() causes MMC driver to be probed. And because board_init() is executed before efi_init_early(), the hook mentioned above won't work for MMC devices anymore. So EFI disk objects won't be created, which in turn makes the EFI subsystem non-functional, showing next symptoms:
- 'efidebug dh' output is empty
- attempt to add boot devices in 'eficonfig' shows this message:
"No block device found!"
- 'bootefi selftest $fdtcontroladdr' shows this warning:
"Cannot persist EFI variables without system partition"
- booting GRUB with 'bootefi' runs minimal GRUB shell which doesn't see any block devices as well, probably because EFI vars weren't passed
Load LDFW in board_late_init() instead, as it's called after efi_init_early(). This fixes the described problem and makes it possible to run EFI apps like GRUB correctly, add entries in 'eficonfig', and makes 'efivar --list' command in Linux rootfs actually show EFI variables.
The only user of LDFW at the moment is the TRNG driver, and it's probed later, only when it's going to be used (e.g. on "rng" command). So it's fine to load LDFW in board_late_init(). Now the corresponding call order will look like this:
efi_init_early()
initr_mmc()
mmc_probe()
EVT_DM_POST_PROBE -> efi_disk_probe()
board_late_init()
load_ldfw() -> fs_read(), blk_dread()
exynos_trng_probe()---
NOTE to custodians: If it's still possible, please take this patch for 2025.07, as it makes EFI functional on E850-96 board.
Changes in v2:
- Squashed both patches into one
board/samsung/e850-96/e850-96.c | 9 +++++++++ configs/e850-96_defconfig | 1 + 2 files changed, 10 insertions(+)
board/samsung/e850-96/e850-96.c +9 -0
@@ -18,9 +18,18 @@ int dram_init_banksize(void) }int board_init (void ) +{ +return 0 ; +} + +int board_late_init (void ) {int err; +/* +* Do this in board_late_init() to make sure MMC is not probed before +* efi_init_early(). +*/ err =load_ldfw ();if (err)printf ("ERROR: LDFW loading failed (%d)\n" , err);
configs/e850-96_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_ANDROID_BOOT_IMAGE=y CONFIG_BOOTSTD_FULL=y CONFIG_DEFAULT_FDT_FILE="exynos850-e850-96.dtb" # CONFIG_DISPLAY_CPUINFO is not set +CONFIG_BOARD_LATE_INIT=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_ABOOTIMG=y CONFIG_CMD_NVEDIT_EFI=y
Signature · 1 line
2.39.5
On Fri, Jun 20, 2025 at 1:50 PM Sam Protsenko
<[email protected]> wrote:
[snip]
board/samsung/e850-96/e850-96.c int dram_init_banksize(void) · line 23
Quoted 4 lines
int
board_init(void)board/samsung/e850-96/e850-96.c +3
-0+{ +return 0 ; +}
CONFIG_BOARD_INIT only appears to be present in -next, but I'd like to target this patch for v2025.07. *If* it's possible, and it can be applied to both mainline and -next, I'll then submit a separate cleanup patch for reworking all empty board_init() calls w.r.t. new CONFIG_BOARD_INIT option.
[snip]
Quoted 5 lines · Sam Protsenko
On Fri, Jun 20, 2025 at 1:50 PM Sam Protsenko
<[email protected]> wrote:[snip]
Quoted 10 lines
board/samsung/e850-96/e850-96.c int dram_init_banksize(void) · line 23
Quoted 4 lines
int
board_init(void)board/samsung/e850-96/e850-96.c +3
-0+{ +return 0 ; +}
CONFIG_BOARD_INITonly appears to be present in -next, but I'd like to target this patch for v2025.07. *If* it's possible, and it can be applied to both mainline and -next, I'll then submit a separate cleanup patch for reworking all emptyboard_init()calls w.r.t. newCONFIG_BOARD_INIToption.
Yes, we can do the cleanup in -next once the next -rc is merged, thanks.
Signature · 1 line
Tom
Quoted 11 lines · Sam Protsenko
As stated in
5e847f7729b3("efi_loader: callefi_init_early()earlier"):
efi_init_early()creates an event hook for block device probing. It has to be called before any block device is probed.Indeed,
efi_bl_init()registersEVT_DM_POST_PROBEevent, which callsefi_disk_probe()whenever any block device is probed. And to make that hook work, the initialization of all block devices was put afterefi_init_early()ininitcall_run_r():[...]
Applied to u-boot/master, thanks!
[1/1] board: samsung: e850-96: Load LDFW in board_late_init()
commit: c08cecf2d7632d2c7be9a9d260f74bb585d7a3e3
Signature · 1 line
Tom