board: samsung: e850-96: Fix MMC devices in EFI
cover board: samsung: e850-96: Fix MMC devices in EFI
Avoid using MMC in board_init() to make sure disk objects are created in EFI subsystem later.
If it's still possible, please take this series for 2025.07, as it makes EFI functional on E850-96 board.
Sam Protsenko (2):
configs: e850-96: Enable BOARD_LATE_INIT
board: samsung: e850-96: Load LDFW in board_late_init()
board/samsung/e850-96/e850-96.c | 9 +++++++++ configs/e850-96_defconfig | 1 + 2 files changed, 10 insertions(+)
Signature · 1 line
2.39.5
PATCH 1/2 configs: e850-96: Enable BOARD_LATE_INIT
LDFW firmware should be loaded in board_late_init() when MMC driver is already probed and initialized. Doing so in board_init() causes MMC driver to be probed earlier, which leads to EFI disk objects not being created. Enable CONFIG_BOARD_LATE_INIT to make that possible.
--- configs/e850-96_defconfig | 1 + 1 file changed, 1 insertion(+)
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
PATCH 2/2 board: samsung: e850-96: Load LDFW in board_late_init()
In reply to Sam ProtsenkoAs 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()--- board/samsung/e850-96/e850-96.c | 9 +++++++++ 1 file changed, 9 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);
Signature · 1 line
2.39.5
Quoted 6 lines · Sam Protsenko
Avoid using MMC in
board_init()to make sure disk objects are created in EFI subsystem later.If it's still possible, please take this series for 2025.07, as it makes EFI functional on E850-96 board.
Quoted 7 lines
Sam Protsenko (2):
configs: e850-96: EnableBOARD_LATE_INIT
board: samsung: e850-96: Load LDFW inboard_late_init()board/samsung/e850-96/e850-96.c | 9 +++++++++ configs/e850-96_defconfig | 1 + 2 files changed, 10 insertions(+)
These should be one patch and also I think you want to disable CONFIG_BOARD_INIT ?
Signature · 1 line
Tom
Quoted 13 lines · Tom Rini
Quoted 10 lines · Sam Protsenko
Avoid using MMC in
board_init()to make sure disk objects are created in EFI subsystem later.If it's still possible, please take this series for 2025.07, as it makes EFI functional on E850-96 board.
Sam Protsenko (2):
configs: e850-96: EnableBOARD_LATE_INIT
board: samsung: e850-96: Load LDFW inboard_late_init()
Quoted 7 lines
Quoted 3 lines
board/samsung/e850-96/e850-96.c | 9 +++++++++ configs/e850-96_defconfig | 1 + 2 files changed, 10 insertions(+)These should be one patch and also I think you want to disable
CONFIG_BOARD_INIT?
Thanks for the review! I'll send v2 in an hour. But I wasn't able to find CONFIG_BOARD_INIT option:
$ find . -name Kconfig* -exec grep -Hn "\bBOARD_INIT" {} \;initcall_run_r() seems to always call board_init() for ARM and other architectures:
#if CONFIG_IS_ENABLED(ARM) || CONFIG_IS_ENABLED(RISCV) || \
CONFIG_IS_ENABLED(SANDBOX)
INITCALL(board_init); /* Setup chipselects */
#endifInteresting thought though. I did a brief analysis, and it looks like there are 79 boards which have empty board_init() because it's not possible to disable it at the moment:
$ grep -Pzrl "\bboard_init\(void\)\n{\n.*return 0;\n}\n" board/ | wc -l
79Do you think U-Boot could benefit from having such an option?
Thanks!
Quoted 2 lines
--
Tom
Quoted 35 lines · Sam Protsenko
Quoted 13 lines · Tom Rini
Quoted 10 lines · Sam Protsenko
Avoid using MMC in
board_init()to make sure disk objects are created in EFI subsystem later.If it's still possible, please take this series for 2025.07, as it makes EFI functional on E850-96 board.
Sam Protsenko (2):
configs: e850-96: EnableBOARD_LATE_INIT
board: samsung: e850-96: Load LDFW inboard_late_init()Quoted 7 lines
Quoted 3 lines
board/samsung/e850-96/e850-96.c | 9 +++++++++ configs/e850-96_defconfig | 1 + 2 files changed, 10 insertions(+)These should be one patch and also I think you want to disable
CONFIG_BOARD_INIT?Thanks for the review! I'll send v2 in an hour. But I wasn't able to find
CONFIG_BOARD_INIToption:$ find . -name Kconfig* -exec grep -Hn "\bBOARD_INIT" {} \;
initcall_run_r()seems to always callboard_init()for ARM and other architectures:#if CONFIG_IS_ENABLED(ARM) || CONFIG_IS_ENABLED(RISCV) || \ CONFIG_IS_ENABLED(SANDBOX) INITCALL(board_init); /* Setup chipselects */ #endif
Quoted 8 lines
Interesting thought though. I did a brief analysis, and it looks like there are 79 boards which have empty
board_init()because it's not possible to disable it at the moment:$ grep -Pzrl "\bboard_init\(void\)\n{\n.*return 0;\n}\n" board/ | wc -l 79Do you think U-Boot could benefit from having such an option?
Yes, it looks like we need to clean the code up to match what we have in Kconfig now, thanks!
Signature · 1 line
Tom
Quoted 41 lines · Tom Rini
Quoted 39 lines · Sam Protsenko
Quoted 13 lines · Tom Rini
Quoted 10 lines · Sam Protsenko
Avoid using MMC in
board_init()to make sure disk objects are created in EFI subsystem later.If it's still possible, please take this series for 2025.07, as it makes EFI functional on E850-96 board.
Sam Protsenko (2):
configs: e850-96: EnableBOARD_LATE_INIT
board: samsung: e850-96: Load LDFW inboard_late_init()Quoted 7 lines
Quoted 3 lines
board/samsung/e850-96/e850-96.c | 9 +++++++++ configs/e850-96_defconfig | 1 + 2 files changed, 10 insertions(+)These should be one patch and also I think you want to disable
CONFIG_BOARD_INIT?Thanks for the review! I'll send v2 in an hour. But I wasn't able to find
CONFIG_BOARD_INIToption:$ find . -name Kconfig* -exec grep -Hn "\bBOARD_INIT" {} \;
initcall_run_r()seems to always callboard_init()for ARM and other architectures:#if CONFIG_IS_ENABLED(ARM) || CONFIG_IS_ENABLED(RISCV) || \ CONFIG_IS_ENABLED(SANDBOX) INITCALL(board_init); /* Setup chipselects */ #endifInteresting thought though. I did a brief analysis, and it looks like there are 79 boards which have empty
board_init()because it's not possible to disable it at the moment:
Quoted 8 lines
Quoted 4 lines
$ grep -Pzrl "\bboard_init\(void\)\n{\n.*return 0;\n}\n" board/ | wc -l 79Do you think U-Boot could benefit from having such an option?
Yes, it looks like we need to clean the code up to match what we have in
Kconfignow, thanks!
On it. Would appreciate it if you can take v2 as is for v2025.07, it fixes EFI on E850-96.
Quoted 2 lines
--
Tom