Convert extension support to UCLASS and adds its support to boot flows
Subsystems (5)
v4 cover Convert extension support to UCLASS and adds its support to boot flows
This series converts the extension board framework to use UCLASS as requested by Simon Glass, then adds extension support to pxe_utils and bootmeth_efi (not tested) to enable extension boards devicetree load in the standard boot process.
I can't test the imx8 extension scan enabled by the imx8mm-cl-iot-gate_defconfig as I don't have this board.
I also can't test the efi bootmeth change as I don't have such board.
Changes in v4:
- Update the bootstd tests, due to the removal of extension hunter.
Changes in v3:
- Reorder the patches inside the series as several config were broken in the middle of the series.
- Use U_BOOT_DRVINFO macro instead of manually bind the drivers.
- Use uclass_first_device_err instead of extension_get_dev function.
- Made few fixes in documentation and Kconfig dependency.
- Made few changes of error value returned.
- Add a patch to document the extension structure.
- Add a patch to fix CAPE_EEPROM_BUS_NUM Kconfig dependency
Changes in v2:
- Fixes few build errors.
- Add patches to move the extension support and board scan out of XPL images build.
---
Kory Maincent (TI.com) (20):
MAINTAINERS: Add maintainer for extension board support
board: ti: Exclude cape detection from XPL builds
board: ti: Fix CAPE_EEPROM_BUS_NUM Kconfig dependency
board: sunxi: Exclude DIP detection from XPL builds
board: compulab: Exclude compulab extension board detection from XPL builds
include: extension_board: Document the extension structure
boot: Move extension board support from cmd/ to boot/
boot: Add UCLASS support for extension boards
board: ti: Refactor cape detection code for readability
board: ti: Convert cape detection to use UCLASS framework
board: sunxi: Refactor CHIP board extension code
board: sunxi: Convert extension support to UCLASS framework
board: sandbox: Improve extension board scan implementation
board: sandbox: Convert extension support to UCLASS framework
board: compulab: Convert imx8mm-cl-iot-gate to UCLASS extension framework
boot: Remove legacy extension board support
boot: extension: Move overlay apply custom logic to command level
boot: pxe_utils: Add extension board devicetree overlay support
boot: bootmeth_efi: Refactor distro_efi_try_bootflow_files return logic
boot: bootmeth_efi: Add extension board devicetree overlay support
MAINTAINERS | 9 + .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 70 ++++---- board/sandbox/sandbox.c | 26 ++- board/sunxi/Makefile | 2 +- board/sunxi/chip.c | 36 ++-- board/ti/common/Kconfig | 2 +- board/ti/common/Makefile | 2 +- board/ti/common/cape_detect.c | 56 ++++--- boot/Kconfig | 4 + boot/Makefile | 1 + boot/bootmeth_efi.c | 79 +++++++-- boot/extension-uclass.c | 93 +++++++++++ boot/pxe_utils.c | 92 +++++++++++ cmd/Kconfig | 3 - cmd/extension_board.c | 183 ++++++++++----------- doc/usage/cmd/extension.rst | 29 ++-- doc/usage/pxe.rst | 4 + include/dm/uclass-id.h | 1 + include/extension_board.h | 86 ++++++++-- test/boot/bootdev.c | 32 ++-- test/boot/bootflow.c | 6 +- test/boot/bootstd_common.h | 4 +- 22 files changed, 563 insertions(+), 257 deletions(-)
---
base-commit: 8e7f8c1248e8adfb525a2a4ea56ebf7e54ff5d7a
change-id: 20250916-feature_sysboot_extension_board-958dd0072565
Best regards,
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v4 1/20 MAINTAINERS: Add maintainer for extension board support
Add myself as maintainer for the extension board support that was originally added to track ongoing development and maintenance.
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -1182,6 +1182,14 @@ F: scripts/event_dump.py F: test/common/event.c F: test/py/tests/test_event_dump.py +EXTENSION +M: Kory Maincent <[email protected]> +S: Maintained +F: board/sunxi/chip.c +F: board/ti/common/cape_detect.c +F: cmd/extension_board.c +F: include/extension_board.h + FASTBOOT M: Mattijs Korpershoek <[email protected]> S: Maintained
Signature · 1 line
2.43.0
PATCH v4 2/20 board: ti: Exclude cape detection from XPL builds
In reply to Kory Maincent (TI.com)Disable cape detection functionality in XPL (eXtended Program Loader) images to reduce size and complexity in the early boot stage.
---
Changes in v2:
- Use PHASE macro instead of XPL check.
- Check SUPPORT_EXTENSION_SCAN instead of CONFIG_CMD_EXTENSION
--- board/ti/common/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/ti/common/Makefile +1 -1
@@ -2,6 +2,6 @@ # Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/ obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o -obj-${CONFIG_CMD_EXTENSION} += cape_detect.o +obj-${CONFIG_$(PHASE_)SUPPORT_EXTENSION_SCAN} += cape_detect.o obj-${CONFIG_OF_LIBFDT} += fdt_ops.o obj-${CONFIG_ARCH_K3} += k3-ddr.o
Signature · 1 line
2.43.0
Re: [PATCH v4 02/20] board: ti: Exclude cape detection from XPL builds
Quoted 2 lines · Kory Maincent (TI.com)
Disable cape detection functionality in XPL (eXtended Program Loader) images to reduce size and complexity in the early boot stage.
If you have to v5, just say "xPL" as it's shorthand for SPL/TPL/VPL. If you don't, I'll try and fix it up when applying (and some for other parts of the series).
Quoted 15 lines
Signed-off-by Kory Maincent (TI.com) <[email protected]>---
Changes in v2:
- Use PHASE macro instead of XPL check.
- CheckSUPPORT_EXTENSION_SCANinstead ofCONFIG_CMD_EXTENSION--- board/ti/common/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/ti/common/Makefile +0
-0
board/ti/common/Makefile line 7
Quoted 7 lines
board/ti/common/Makefile +1
-1@@ -2,6 +2,6 @@ # Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/ obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o -obj-${CONFIG_CMD_EXTENSION} += cape_detect.o +obj-${CONFIG_$(PHASE_)SUPPORT_EXTENSION_SCAN} += cape_detect.o obj-${CONFIG_OF_LIBFDT} += fdt_ops.o obj-${CONFIG_ARCH_K3} += k3-ddr.o
This is correct because if falcon mode requires cape support too, SPL_SUPPORT_EXTENSION_SCAN can be introduced and this will work as expected.
Signature · 1 line
Tom
PATCH v4 3/20 board: ti: Fix CAPE_EEPROM_BUS_NUM Kconfig dependency
In reply to Kory Maincent (TI.com)The CAPE_EEPROM_BUS_NUM configuration option was incorrectly depending on CMD_EXTENSION, which represents the extension board command. However, the cape scan functionality can be built and used independently of the command interface through the SUPPORT_EXTENSION_SCAN option.
Change the dependency from CMD_EXTENSION to SUPPORT_EXTENSION_SCAN to properly reflect that the I2C bus configuration is needed for the cape scan function itself, not specifically for the command.
---
Change in v3:
- New patch
--- board/ti/common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/ti/common/Kconfig +1 -1
@@ -20,7 +20,7 @@ config CAPE_EEPROM_BUS_NUM int "Cape EEPROM's I2C bus address" range 0 8 default 2 - depends on CMD_EXTENSION + depends on SUPPORT_EXTENSION_SCAN config TI_COMMON_CMD_OPTIONS bool "Enable cmd options on TI platforms"
Signature · 1 line
2.43.0
PATCH v4 4/20 board: sunxi: Exclude DIP detection from XPL builds
In reply to Kory Maincent (TI.com)Disable DIP detection functionality in XPL (eXtended Program Loader) images to reduce size and complexity in the early boot stage.
---
Change in v2:
- New patch.
--- board/sunxi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/sunxi/Makefile +1 -1
@@ -11,4 +11,4 @@ obj-$(CONFIG_SUN7I_GMAC) += gmac.o obj-$(CONFIG_MACH_SUN4I) += dram_sun4i_auto.o obj-$(CONFIG_MACH_SUN5I) += dram_sun5i_auto.o obj-$(CONFIG_MACH_SUN7I) += dram_sun5i_auto.o -obj-$(CONFIG_CHIP_DIP_SCAN) += chip.o +obj-$(CONFIG_$(PHASE_)CHIP_DIP_SCAN) += chip.o
Signature · 1 line
2.43.0
PATCH v4 5/20 board: compulab: Exclude compulab extension board detection from XPL builds
In reply to Kory Maincent (TI.com)Disable compulab extension board detection functionality in XPL (eXtended Program Loader) images to reduce size and complexity in the early boot stage.
---
Change in v2:
- New patch.
--- board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 3 +++ 1 file changed, 3 insertions(+)
board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +3 -0
@@ -249,6 +249,8 @@ int board_mmc_get_env_dev(int devno)#define IOT_GATE_IMX8_EXT_I2C_ADDR_GPIO 0x22/* I2C address of the GPIO extender */ +#if !IS_ENABLED (CONFIG_XPL_BUILD ) +static int iot_gate_imx8_ext_id =IOT_GATE_EXT_EMPTY ;/* Extension board ID */ static int iot_gate_imx8_ext_ied_id [3 ] = { IOT_GATE_IMX8_CARD_ID_EMPTY,
@@ -541,6 +543,7 @@ int extension_board_scan(struct list_head *extension_list) return ret; } +#endif static int setup_mac_address (void ) {
Signature · 1 line
2.43.0
PATCH v4 6/20 include: extension_board: Document the extension structure
In reply to Kory Maincent (TI.com)Add documentation to describe the extension structure.
---
Change in v3:
- New patch.
--- include/extension_board.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/extension_board.h +9 -0
@@ -9,6 +9,15 @@#include <linux/list.h> +/** +* extension - Description fields of an extension board +* @list: List head +* @name: Name of the extension +* @owner: Owner of the extension +* @version: Version of the extension +* @overlay: Devicetree overlay name to be loaded for this extension +* @other: Other information of this extension +*/ struct extension {struct list_head list;char name[32 ];
Signature · 1 line
2.43.0
PATCH v4 7/20 boot: Move extension board support from cmd/ to boot/
In reply to Kory Maincent (TI.com)Relocate extension board support from cmd/ to boot/ directory in preparation for converting the extension framework to use UCLASS. Also improve code style by applying reverse xmas tree ordering.
---
Change in v3:
- Move the list head in from cmd/extension_board.c to boot/extension.c
- Add OF_LIBFDT_OVERLAY config dependency.
--- MAINTAINERS | 1 + boot/Kconfig | 4 ++ boot/Makefile | 1 + boot/extension.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++ cmd/Kconfig | 3 -- cmd/extension_board.c | 99 ++--------------------------------------------- include/extension_board.h | 16 ++++++++ 7 files changed, 124 insertions(+), 99 deletions(-)
MAINTAINERS +1 -0
@@ -1187,6 +1187,7 @@ M: Kory Maincent <[email protected]> S: Maintained F: board/sunxi/chip.c F: board/ti/common/cape_detect.c +F: boot/extension.c F: cmd/extension_board.c F: include/extension_board.h
boot/Kconfig +4 -0
@@ -1906,6 +1906,10 @@ endmenu endif # OF_LIBFDT +config SUPPORT_EXTENSION_SCAN + select OF_LIBFDT_OVERLAY + bool + config USE_BOOTARGS bool "Enable boot arguments" help
boot/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_BOOT_RETRY) += bootretry.o obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o +obj-$(CONFIG_SUPPORT_EXTENSION_SCAN) += extension.o obj-$(CONFIG_PXE_UTILS) += pxe_utils.o
boot/extension.c new file +99 -0
99 lines not on this page · raw message
cmd/Kconfig +0 -3
@@ -545,9 +545,6 @@ config CMD_FDT help Do FDT related setup before booting into the Operating System. -config SUPPORT_EXTENSION_SCAN - bool - config CMD_EXTENSION bool "Extension board management command" select CMD_FDT
cmd/extension_board.c +3 -96
128 lines not on this page · raw message
include/extension_board.h +16 -0
@@ -9,6 +9,8 @@#include <linux/list.h> +extern struct list_head extension_list; +/** * extension - Description fields of an extension board * @list: List head
@@ -39,4 +41,18 @@ struct extension {*/ int extension_board_scan (struct list_head *extension_list); +/** +* extension_apply - Apply extension board overlay to the devicetree +* @extension: Extension to be applied +* Return: Zero on success, negative on failure. +*/ +int extension_apply (struct extension *extension); + +/** +* extension_scan - Scan extension boards available. +* @show: Flag to enable verbose log +* Return: Zero on success, negative on failure. +*/ +int extension_scan (bool show); +#endif /* __EXTENSION_SUPPORT_H */
Signature · 1 line
2.43.0
PATCH v4 8/20 boot: Add UCLASS support for extension boards
In reply to Kory Maincent (TI.com)Introduce UCLASS-based extension board support to enable more standardized and automatic loading of extension board device tree overlays in preparation for integration with bootstd and pxe_utils.
Several #if CONFIG_IS_ENABLED are used in cmd/extension_board.c to ease the development but don't worry they are removed later in the series.
---
Change in v3:
- Add OF_LIBFDT_OVERLAY config dependency.
- Update several return errors value following Simon review.
- Use uclass_first_device_err instead of extension_get_dev function.
- Remove the manual bind of extension driver. Use U_BOOT_DRVINFO instead.
- Update documentation.
- Add a helper to get extension ops.
--- MAINTAINERS | 1 + boot/Kconfig | 4 ++ boot/Makefile | 1 + boot/extension-uclass.c | 151 ++++++++++++++++++++++++++++++++++++++++++++ cmd/Kconfig | 2 +- cmd/extension_board.c | 50 ++++++++++++++- doc/usage/cmd/extension.rst | 29 +++++---- include/dm/uclass-id.h | 1 + include/extension_board.h | 71 +++++++++++++++++++++ 9 files changed, 294 insertions(+), 16 deletions(-)
MAINTAINERS +1 -0
@@ -1187,6 +1187,7 @@ M: Kory Maincent <[email protected]> S: Maintained F: board/sunxi/chip.c F: board/ti/common/cape_detect.c +F: boot/extension-uclass.c F: boot/extension.c F: cmd/extension_board.c F: include/extension_board.h
boot/Kconfig +4 -0
@@ -1910,6 +1910,10 @@ config SUPPORT_EXTENSION_SCAN select OF_LIBFDT_OVERLAY bool +config SUPPORT_DM_EXTENSION_SCAN + select OF_LIBFDT_OVERLAY + bool + config USE_BOOTARGS bool "Enable boot arguments" help
boot/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o obj-$(CONFIG_SUPPORT_EXTENSION_SCAN) += extension.o +obj-$(CONFIG_SUPPORT_DM_EXTENSION_SCAN) += extension-uclass.o obj-$(CONFIG_PXE_UTILS) += pxe_utils.o
boot/extension-uclass.c new file +151 -0
151 lines not on this page · raw message
cmd/Kconfig +1 -1
@@ -548,7 +548,7 @@ config CMD_FDT config CMD_EXTENSION bool "Extension board management command" select CMD_FDT - depends on SUPPORT_EXTENSION_SCAN + depends on SUPPORT_EXTENSION_SCAN || SUPPORT_DM_EXTENSION_SCAN help Enables the "extension" command, which allows to detect extension boards connected to the system, and apply
cmd/extension_board.c +47 -3
108 lines not on this page · raw message
doc/usage/cmd/extension.rst +17 -12
@@ -25,9 +25,8 @@ Device Tree overlays depending on the detected extension boards. The "extension" command comes with three sub-commands: - - "extension scan" makes the generic code call the board-specific - extension_board_scan() function to retrieve the list of detected - extension boards. + - "extension scan" makes the generic code call a board-specific extension + function to retrieve the list of detected extension boards. - "extension list" allows to list the detected extension boards.
@@ -98,17 +97,23 @@ Simple extension_board_scan function example .. code-block:: c - int extension_board_scan(struct list_head *extension_list) + static int foo_extension_board_scan(struct alist *extension_list) { - struct extension *extension; + struct extension extension = {0}; - extension = calloc(1, sizeof(struct extension)); - snprintf(extension->overlay, sizeof(extension->overlay), "overlay.dtbo"); - snprintf(extension->name, sizeof(extension->name), "extension board"); - snprintf(extension->owner, sizeof(extension->owner), "sandbox"); - snprintf(extension->version, sizeof(extension->version), "1.1"); - snprintf(extension->other, sizeof(extension->other), "Extension board information"); - list_add_tail(&extension->list, extension_list); + snprintf(extension.overlay, sizeof(extension.overlay), "overlay.dtbo"); + snprintf(extension.name, sizeof(extension.name), "extension board"); + snprintf(extension.owner, sizeof(extension.owner), "sandbox"); + snprintf(extension.version, sizeof(extension.version), "1.1"); + snprintf(extension.other, sizeof(extension.other), "Extension board information"); + if (!alist_add(extension_list, extension)) + return -ENOMEM; return 1; } + + U_BOOT_EXTENSION(foo_extension_name, foo_extension_board_scan); + + U_BOOT_DRVINFO(foo_extension_name) = { + .name = "foo_extension_name", + };
include/dm/uclass-id.h +1 -0
@@ -63,6 +63,7 @@ enum uclass_id {UCLASS_ETH ,/* Ethernet device */ UCLASS_ETH_PHY ,/* Ethernet PHY device */ UCLASS_EXTCON ,/* External Connector Class */ +UCLASS_EXTENSION ,/* Extension board */ UCLASS_FFA ,/* Arm Firmware Framework for Armv8-A */ UCLASS_FFA_EMUL ,/* sandbox FF-A device emulator */ UCLASS_FIRMWARE, /* Firmware */
include/extension_board.h +71 -0
87 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v4 08/20] boot: Add UCLASS support for extension boards
Quoted 8 lines · On Wed, 22 Oct 2025 17:20:19 +0200 "Kory Maincent (TI.com)"…
Introduce UCLASS-based extension board support to enable more standardized and automatic loading of extension board device tree overlays in preparation for integration with bootstd and
pxe_utils.Several #if
CONFIG_IS_ENABLEDare used incmd/extension_board.cto ease the development but don't worry they are removed later in the series.Signed-off-by Kory Maincent (TI.com) <[email protected]>
Forgot to add:
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v4 9/20 board: ti: Refactor cape detection code for readability
In reply to Kory Maincent (TI.com)Clean up and reorganize cape detection code structure for improved maintainability and readability.
--- board/ti/common/cape_detect.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-)
board/ti/common/cape_detect.c +19 -17
@@ -24,19 +24,18 @@ static void sanitize_field(char *text, size_t size)int extension_board_scan (struct list_head *extension_list) { -struct extension *cape; -struct am335x_cape_eeprom_id eeprom_header; - -int num_capes =0 ; -int ret, i; -struct udevice *dev;unsigned char addr; - -char process_cape_part_number[17 ] = {'0' }; -char process_cape_version[5 ] = {'0' }; -uint8_t cursor =0 ; +int num_capes =0 ;for (addr =CAPE_EEPROM_FIRST_ADDR ; addr <=CAPE_EEPROM_LAST_ADDR ; addr++) { +struct am335x_cape_eeprom_id eeprom_header; +char process_cape_part_number[17 ] = {'0' }; +char process_cape_version[5 ] = {'0' }; +struct extension *cape; +struct udevice *dev; +u8 cursor =0 ; +int ret, i; + ret =i2c_get_chip_for_busnum (CONFIG_CAPE_EEPROM_BUS_NUM , addr,1 , &dev);if (ret)continue ;
@@ -59,8 +58,8 @@ int extension_board_scan(struct list_head *extension_list)sanitize_field (eeprom_header.part_number,sizeof (eeprom_header.part_number));/* Process cape part_number */ -memset (process_cape_part_number,0 ,sizeof (process_cape_part_number)); -strncpy (process_cape_part_number, eeprom_header.part_number,16 ); +strlcpy (process_cape_part_number, eeprom_header.part_number, +sizeof (process_cape_part_number));/* Some capes end with '.' */ for (i =15 ; i >=0 ; i--) {if (process_cape_part_number[i] =='.' )
@@ -70,8 +69,8 @@ int extension_board_scan(struct list_head *extension_list) }/* Process cape version */ -memset (process_cape_version,0 ,sizeof (process_cape_version)); -strncpy (process_cape_version, eeprom_header.version,4 ); +strlcpy (process_cape_version, eeprom_header.version, +sizeof (process_cape_version));for (i =0 ; i <4 ; i++) {if (process_cape_version[i] ==0 ) process_cape_version[i] ='0' ;
@@ -87,9 +86,12 @@ int extension_board_scan(struct list_head *extension_list)snprintf (cape->overlay,sizeof (cape->overlay),"%s-%s.dtbo" , process_cape_part_number, process_cape_version); -strncpy (cape->name, eeprom_header.board_name,32 ); -strncpy (cape->version, process_cape_version,4 ); -strncpy (cape->owner, eeprom_header.manufacturer,16 ); +strlcpy (cape->name, eeprom_header.board_name, +sizeof (eeprom_header.board_name)); +strlcpy (cape->version, process_cape_version, +sizeof (process_cape_version)); +strlcpy (cape->owner, eeprom_header.manufacturer, +sizeof (eeprom_header.manufacturer) +1 );list_add_tail (&cape->list, extension_list); num_capes++; }
Signature · 1 line
2.43.0
PATCH v4 10/20 board: ti: Convert cape detection to use UCLASS framework
In reply to Kory Maincent (TI.com)Migrate TI board cape detection from legacy extension support to the new UCLASS-based extension board framework.
---
Change in v3:
- Use U_BOOT_DRVINFO.
--- arch/arm/mach-omap2/am33xx/Kconfig | 2 +- arch/arm/mach-omap2/omap5/Kconfig | 2 +- board/ti/common/Kconfig | 2 +- board/ti/common/Makefile | 2 +- board/ti/common/cape_detect.c | 28 +++++++++++++++------------- 5 files changed, 19 insertions(+), 17 deletions(-)
arch/arm/mach-omap2/am33xx/Kconfig +1 -1
@@ -15,7 +15,7 @@ config TARGET_AM335X_EVM select DM_GPIO select DM_SERIAL select TI_I2C_BOARD_DETECT - select SUPPORT_EXTENSION_SCAN + select SUPPORT_DM_EXTENSION_SCAN imply CMD_DM imply SPL_DM imply SPL_DM_SEQ_ALIAS
arch/arm/mach-omap2/omap5/Kconfig +1 -1
@@ -38,7 +38,7 @@ config TARGET_AM57XX_EVM select CMD_DDR3 select DRA7XX select TI_I2C_BOARD_DETECT - select SUPPORT_EXTENSION_SCAN + select SUPPORT_DM_EXTENSION_SCAN imply DM_THERMAL imply SCSI imply SPL_THERMAL
board/ti/common/Kconfig +1 -1
@@ -20,7 +20,7 @@ config CAPE_EEPROM_BUS_NUM int "Cape EEPROM's I2C bus address" range 0 8 default 2 - depends on SUPPORT_EXTENSION_SCAN + depends on SUPPORT_DM_EXTENSION_SCAN config TI_COMMON_CMD_OPTIONS bool "Enable cmd options on TI platforms"
board/ti/common/Makefile +1 -1
@@ -2,6 +2,6 @@ # Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/ obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o -obj-${CONFIG_$(PHASE_)SUPPORT_EXTENSION_SCAN} += cape_detect.o +obj-${CONFIG_$(PHASE_)SUPPORT_DM_EXTENSION_SCAN} += cape_detect.o obj-${CONFIG_OF_LIBFDT} += fdt_ops.o obj-${CONFIG_ARCH_K3} += k3-ddr.o
board/ti/common/cape_detect.c +15 -13
@@ -22,7 +22,8 @@ static void sanitize_field(char *text, size_t size) } } -int extension_board_scan (struct list_head *extension_list) +static int ti_extension_board_scan (struct udevice *dev, +struct alist *extension_list) {unsigned char addr;int num_capes =0 ;
@@ -31,7 +32,7 @@ int extension_board_scan(struct list_head *extension_list)struct am335x_cape_eeprom_id eeprom_header;char process_cape_part_number[17 ] = {'0' };char process_cape_version[5 ] = {'0' }; -struct extension *cape; +struct extension cape = {0 };struct udevice *dev;u8 cursor =0 ;int ret, i;
@@ -78,22 +79,23 @@ int extension_board_scan(struct list_head *extension_list)printf ("BeagleBone Cape: %s (0x%x)\n" , eeprom_header.board_name, addr); - cape =calloc (1 ,sizeof (struct extension )); -if (!cape) { -printf ("Error in memory allocation\n" ); -return num_capes; - } - -snprintf (cape->overlay,sizeof (cape->overlay),"%s-%s.dtbo" , +snprintf (cape.overlay,sizeof (cape.overlay),"%s-%s.dtbo" , process_cape_part_number, process_cape_version); -strlcpy (cape->name, eeprom_header.board_name, +strlcpy (cape.name, eeprom_header.board_name,sizeof (eeprom_header.board_name)); -strlcpy (cape->version, process_cape_version, +strlcpy (cape.version, process_cape_version,sizeof (process_cape_version)); -strlcpy (cape->owner, eeprom_header.manufacturer, +strlcpy (cape.owner, eeprom_header.manufacturer,sizeof (eeprom_header.manufacturer) +1 ); -list_add_tail (&cape->list, extension_list); +if (!alist_add (extension_list, cape)) +return -ENOMEM ; num_capes++; }return num_capes; } + +U_BOOT_EXTENSION (cape, ti_extension_board_scan); + +U_BOOT_DRVINFO (cape) = { + .name ="cape" , +};
Signature · 1 line
2.43.0
PATCH v4 11/20 board: sunxi: Refactor CHIP board extension code
In reply to Kory Maincent (TI.com)Clean up and improve code structure in the sunxi CHIP board extension detection implementation.
---
Changes in v2:
- Fix a build error.
--- board/sunxi/chip.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
board/sunxi/chip.c +8 -8
@@ -42,14 +42,9 @@ struct dip_w1_header {int extension_board_scan (struct list_head *extension_list) { -struct extension *dip; -struct dip_w1_header w1_header;struct udevice *bus, *dev; -u32 vid; -u16 pid; -int ret; -int num_dip =0 ; +int ret;sunxi_gpio_set_pull (SUNXI_GPD (2 ),SUNXI_GPIO_PULL_UP );
@@ -60,6 +55,11 @@ int extension_board_scan(struct list_head *extension_list) }for_each_w1_device (bus, &dev) { +struct dip_w1_header w1_header; +struct extension *dip; +u32 vid; +u16 pid; +if (w1_get_device_family (dev) !=W1_FAMILY_DS2431 )continue ;
@@ -90,8 +90,8 @@ int extension_board_scan(struct list_head *extension_list)snprintf (dip->overlay,sizeof (dip->overlay),"dip-%x-%x.dtbo" , vid, pid); -strncpy (dip->name, w1_header.product_name,32 ); -strncpy (dip->owner, w1_header.vendor_name,32 ); +strlcpy (dip->name, w1_header.product_name,sizeof (dip->name)); +strlcpy (dip->owner, w1_header.vendor_name,sizeof (dip->owner));list_add_tail (&dip->list, extension_list); num_dip++; }
Signature · 1 line
2.43.0
PATCH v4 12/20 board: sunxi: Convert extension support to UCLASS framework
In reply to Kory Maincent (TI.com)Migrate sunxi board extension detection from legacy implementation to the new UCLASS-based extension board framework.
---
Change in v3:
- Use U_BOOT_DRVINFO.
Changes in v2:
- Fix build error.
--- arch/arm/mach-sunxi/Kconfig | 2 +- board/sunxi/chip.c | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-)
arch/arm/mach-sunxi/Kconfig +1 -1
@@ -1223,7 +1223,7 @@ config BLUETOOTH_DT_DEVICE_FIXUP config CHIP_DIP_SCAN bool "Enable DIPs detection for CHIP board" - select SUPPORT_EXTENSION_SCAN + select SUPPORT_DM_EXTENSION_SCAN select W1 select W1_GPIO select W1_EEPROM
board/sunxi/chip.c +14 -12
@@ -40,7 +40,8 @@ struct dip_w1_header {u8 data[16 ];/* user data, per-dip specific */ } __packed; -int extension_board_scan (struct list_head *extension_list) +static int sunxi_extension_board_scan (struct udevice *udev, +struct alist *extension_list) {struct udevice *bus, *dev;int num_dip =0 ;
@@ -55,8 +56,8 @@ int extension_board_scan(struct list_head *extension_list) }for_each_w1_device (bus, &dev) { +struct extension dip = {0 };struct dip_w1_header w1_header; -struct extension *dip;u32 vid;u16 pid;
@@ -82,18 +83,19 @@ int extension_board_scan(struct list_head *extension_list) w1_header.product_name, pid, w1_header.vendor_name, vid); - dip =calloc (1 ,sizeof (struct extension )); -if (!dip) { -printf ("Error in memory allocation\n" ); -return num_dip; - } - -snprintf (dip->overlay,sizeof (dip->overlay),"dip-%x-%x.dtbo" , +snprintf (dip.overlay,sizeof (dip.overlay),"dip-%x-%x.dtbo" , vid, pid); -strlcpy (dip->name, w1_header.product_name,sizeof (dip->name)); -strlcpy (dip->owner, w1_header.vendor_name,sizeof (dip->owner)); -list_add_tail (&dip->list, extension_list); +strlcpy (dip.name, w1_header.product_name,sizeof (dip.name)); +strlcpy (dip.owner, w1_header.vendor_name,sizeof (dip.owner)); +if (!alist_add (extension_list, dip)) +return -ENOMEM ; num_dip++; }return num_dip; } + +U_BOOT_EXTENSION (dip, sunxi_extension_board_scan); + +U_BOOT_DRVINFO (dip) = { + .name ="dip" , +};
Signature · 1 line
2.43.0
PATCH v4 13/20 board: sandbox: Improve extension board scan implementation
In reply to Kory Maincent (TI.com)Enhance the extension board scanning code in sandbox with better error handling and code organization.
--- board/sandbox/sandbox.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
board/sandbox/sandbox.c +5 -1
@@ -113,11 +113,15 @@ int ft_board_setup(void *fdt, struct bd_info *bd)#ifdef CONFIG_CMD_EXTENSION int extension_board_scan (struct list_head *extension_list) { -struct extension *extension;int i;for (i =0 ; i <2 ; i++) { +struct extension *extension; + extension =calloc (1 ,sizeof (struct extension )); +if (!extension) +return -ENOMEM ; +snprintf (extension->overlay,sizeof (extension->overlay),"overlay%d.dtbo" , i);snprintf (extension->name,sizeof (extension->name),"extension board %d" , i);snprintf (extension->owner,sizeof (extension->owner),"sandbox" );
Signature · 1 line
2.43.0
PATCH v4 14/20 board: sandbox: Convert extension support to UCLASS framework
In reply to Kory Maincent (TI.com)Migrate sandbox extension board detection from legacy implementation to the new UCLASS-based extension board framework.
---
Change in v3:
- Use U_BOOT_DRVINFO.
--- arch/Kconfig | 2 +- board/sandbox/sandbox.c | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-)
arch/Kconfig +1 -1
@@ -215,7 +215,7 @@ config SANDBOX select SYSRESET_CMD_POWEROFF if CMD_POWEROFF select SYS_CACHE_SHIFT_4 select IRQ - select SUPPORT_EXTENSION_SCAN if CMDLINE + select SUPPORT_DM_EXTENSION_SCAN if CMDLINE select SUPPORT_ACPI imply BITREVERSE select BLOBLIST
board/sandbox/sandbox.c +16 -12
@@ -111,27 +111,31 @@ int ft_board_setup(void *fdt, struct bd_info *bd) }#ifdef CONFIG_CMD_EXTENSION -int extension_board_scan (struct list_head *extension_list) +static int sandbox_extension_board_scan (struct udevice *dev, +struct alist *extension_list) {int i;for (i =0 ; i <2 ; i++) { -struct extension *extension; - - extension =calloc (1 ,sizeof (struct extension )); -if (!extension) +struct extension extension = {0 }; + +snprintf (extension.overlay,sizeof (extension.overlay),"overlay%d.dtbo" , i); +snprintf (extension.name,sizeof (extension.name),"extension board %d" , i); +snprintf (extension.owner,sizeof (extension.owner),"sandbox" ); +snprintf (extension.version,sizeof (extension.version),"1.1" ); +snprintf (extension.other,sizeof (extension.other),"Fictional extension board" ); +if (!alist_add (extension_list, extension))return -ENOMEM ; - -snprintf (extension->overlay,sizeof (extension->overlay),"overlay%d.dtbo" , i); -snprintf (extension->name,sizeof (extension->name),"extension board %d" , i); -snprintf (extension->owner,sizeof (extension->owner),"sandbox" ); -snprintf (extension->version,sizeof (extension->version),"1.1" ); -snprintf (extension->other,sizeof (extension->other),"Fictional extension board" ); -list_add_tail (&extension->list, extension_list); }return i; } + +U_BOOT_EXTENSION (sandbox_extension, sandbox_extension_board_scan); + +U_BOOT_DRVINFO (sandbox_extension) = { + .name ="sandbox_extension" , +};#endif #ifdef CONFIG_BOARD_LATE_INIT
Signature · 1 line
2.43.0
Re: [PATCH v4 14/20] board: sandbox: Convert extension support to UCLASS framework
Quoted 4 lines · On Wed, 22 Oct 2025 17:20:25 +0200 "Kory Maincent (TI.com)"…
Migrate sandbox extension board detection from legacy implementation to the new UCLASS-based extension board framework.
Signed-off-by Kory Maincent (TI.com) <[email protected]>
Forgot to add:
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v4 15/20 board: compulab: Convert imx8mm-cl-iot-gate to UCLASS extension framework
In reply to Kory Maincent (TI.com)Migrate CompuLab imx8mm-cl-iot-gate board extension detection from legacy implementation to the new UCLASS-based extension board framework.
---
Change in v3:
- Use U_BOOT_DRVINFO.
Change in v2:
- Fix build errors.
--- arch/arm/mach-imx/imx8m/Kconfig | 4 +- .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 67 +++++++++++----------- 2 files changed, 35 insertions(+), 36 deletions(-)
arch/arm/mach-imx/imx8m/Kconfig +2 -2
@@ -359,14 +359,14 @@ config TARGET_IMX8MM_CL_IOT_GATE select IMX8MM select SUPPORT_SPL select IMX8M_LPDDR4 - select SUPPORT_EXTENSION_SCAN + select SUPPORT_DM_EXTENSION_SCAN config TARGET_IMX8MM_CL_IOT_GATE_OPTEE bool "CompuLab iot-gate-imx8 with optee support" select IMX8MM select SUPPORT_SPL select IMX8M_LPDDR4 - select SUPPORT_EXTENSION_SCAN + select SUPPORT_DM_EXTENSION_SCAN config TARGET_IMX8MP_RSB3720A1_4G bool "Support i.MX8MP RSB3720A1 4G"
board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +33 -34
139 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v4 16/20 boot: Remove legacy extension board support
In reply to Kory Maincent (TI.com)Remove the legacy extension board implementation now that all boards have been converted to use the new UCLASS-based framework. This eliminates lines of legacy code while preserving functionality through the modern driver model approach.
Update the bootstd tests, due to the removal of extension hunter.
---
Changes in v4:
- Remove Simon's reviewed-by tag due to the change
- Remove extension hunter check in tests
Changes in v2:
- Remove a missing DM_EXTENSION_SCAN in cmd/Kconfig
--- MAINTAINERS | 1 - arch/Kconfig | 2 +- arch/arm/mach-imx/imx8m/Kconfig | 4 +- arch/arm/mach-omap2/am33xx/Kconfig | 2 +- arch/arm/mach-omap2/omap5/Kconfig | 2 +- arch/arm/mach-sunxi/Kconfig | 2 +- board/ti/common/Kconfig | 2 +- board/ti/common/Makefile | 2 +- boot/Kconfig | 4 -- boot/Makefile | 3 +- boot/extension-uclass.c | 18 +++---- boot/extension.c | 99 -------------------------------------- cmd/Kconfig | 2 +- cmd/extension_board.c | 72 +++------------------------ include/extension_board.h | 56 ++++++--------------- test/boot/bootdev.c | 32 +++++------- test/boot/bootflow.c | 6 +-- test/boot/bootstd_common.h | 4 +- 18 files changed, 58 insertions(+), 255 deletions(-)
MAINTAINERS +0 -1
@@ -1188,7 +1188,6 @@ S: Maintained F: board/sunxi/chip.c F: board/ti/common/cape_detect.c F: boot/extension-uclass.c -F: boot/extension.c F: cmd/extension_board.c F: include/extension_board.h
arch/Kconfig +1 -1
@@ -215,7 +215,7 @@ config SANDBOX select SYSRESET_CMD_POWEROFF if CMD_POWEROFF select SYS_CACHE_SHIFT_4 select IRQ - select SUPPORT_DM_EXTENSION_SCAN if CMDLINE + select SUPPORT_EXTENSION_SCAN if CMDLINE select SUPPORT_ACPI imply BITREVERSE select BLOBLIST
arch/arm/mach-imx/imx8m/Kconfig +2 -2
@@ -359,14 +359,14 @@ config TARGET_IMX8MM_CL_IOT_GATE select IMX8MM select SUPPORT_SPL select IMX8M_LPDDR4 - select SUPPORT_DM_EXTENSION_SCAN + select SUPPORT_EXTENSION_SCAN config TARGET_IMX8MM_CL_IOT_GATE_OPTEE bool "CompuLab iot-gate-imx8 with optee support" select IMX8MM select SUPPORT_SPL select IMX8M_LPDDR4 - select SUPPORT_DM_EXTENSION_SCAN + select SUPPORT_EXTENSION_SCAN config TARGET_IMX8MP_RSB3720A1_4G bool "Support i.MX8MP RSB3720A1 4G"
arch/arm/mach-omap2/am33xx/Kconfig +1 -1
@@ -15,7 +15,7 @@ config TARGET_AM335X_EVM select DM_GPIO select DM_SERIAL select TI_I2C_BOARD_DETECT - select SUPPORT_DM_EXTENSION_SCAN + select SUPPORT_EXTENSION_SCAN imply CMD_DM imply SPL_DM imply SPL_DM_SEQ_ALIAS
arch/arm/mach-omap2/omap5/Kconfig +1 -1
@@ -38,7 +38,7 @@ config TARGET_AM57XX_EVM select CMD_DDR3 select DRA7XX select TI_I2C_BOARD_DETECT - select SUPPORT_DM_EXTENSION_SCAN + select SUPPORT_EXTENSION_SCAN imply DM_THERMAL imply SCSI imply SPL_THERMAL
arch/arm/mach-sunxi/Kconfig +1 -1
@@ -1223,7 +1223,7 @@ config BLUETOOTH_DT_DEVICE_FIXUP config CHIP_DIP_SCAN bool "Enable DIPs detection for CHIP board" - select SUPPORT_DM_EXTENSION_SCAN + select SUPPORT_EXTENSION_SCAN select W1 select W1_GPIO select W1_EEPROM
board/ti/common/Kconfig +1 -1
@@ -20,7 +20,7 @@ config CAPE_EEPROM_BUS_NUM int "Cape EEPROM's I2C bus address" range 0 8 default 2 - depends on SUPPORT_DM_EXTENSION_SCAN + depends on SUPPORT_EXTENSION_SCAN config TI_COMMON_CMD_OPTIONS bool "Enable cmd options on TI platforms"
board/ti/common/Makefile +1 -1
@@ -2,6 +2,6 @@ # Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/ obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o -obj-${CONFIG_$(PHASE_)SUPPORT_DM_EXTENSION_SCAN} += cape_detect.o +obj-${CONFIG_$(PHASE_)SUPPORT_EXTENSION_SCAN} += cape_detect.o obj-${CONFIG_OF_LIBFDT} += fdt_ops.o obj-${CONFIG_ARCH_K3} += k3-ddr.o
boot/Kconfig +0 -4
@@ -1910,10 +1910,6 @@ config SUPPORT_EXTENSION_SCAN select OF_LIBFDT_OVERLAY bool -config SUPPORT_DM_EXTENSION_SCAN - select OF_LIBFDT_OVERLAY - bool - config USE_BOOTARGS bool "Enable boot arguments" help
boot/Makefile +1 -2
@@ -9,8 +9,7 @@ obj-$(CONFIG_BOOT_RETRY) += bootretry.o obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o -obj-$(CONFIG_SUPPORT_EXTENSION_SCAN) += extension.o -obj-$(CONFIG_SUPPORT_DM_EXTENSION_SCAN) += extension-uclass.o +obj-$(CONFIG_SUPPORT_EXTENSION_SCAN) += extension-uclass.o obj-$(CONFIG_PXE_UTILS) += pxe_utils.o
boot/extension-uclass.c +9 -9
@@ -14,7 +14,7 @@#include <dm/lists.h> #include <dm/uclass.h> -struct alist *dm_extension_get_list (void ) +struct alist *extension_get_list (void ) {struct udevice *dev;
@@ -24,7 +24,7 @@ struct alist *dm_extension_get_list(void)return dev_get_priv (dev); } -int dm_extension_probe (struct udevice *dev) +int extension_probe (struct udevice *dev) {struct alist *extension_list =dev_get_priv (dev);
@@ -32,7 +32,7 @@ int dm_extension_probe(struct udevice *dev)return 0 ; } -int dm_extension_remove (struct udevice *dev) +int extension_remove (struct udevice *dev) {struct alist *extension_list =dev_get_priv (dev);
@@ -40,9 +40,9 @@ int dm_extension_remove(struct udevice *dev)return 0 ; } -int dm_extension_scan (void ) +int extension_scan (void ) { -struct alist *extension_list =dm_extension_get_list (); +struct alist *extension_list =extension_get_list ();const struct extension_ops *ops;struct udevice *dev;int ret;
@@ -109,9 +109,9 @@ static int _extension_apply(const struct extension *extension)return ret; } -int dm_extension_apply (int extension_num) +int extension_apply (int extension_num) { -struct alist *extension_list =dm_extension_get_list (); +struct alist *extension_list =extension_get_list ();const struct extension *extension;if (!extension_list)
@@ -127,9 +127,9 @@ int dm_extension_apply(int extension_num)return _extension_apply (extension); } -int dm_extension_apply_all (void ) +int extension_apply_all (void ) { -struct alist *extension_list =dm_extension_get_list (); +struct alist *extension_list =extension_get_list ();const struct extension *extension;int ret;
boot/extension.c deleted +0 -99
99 lines not on this page · raw message
cmd/Kconfig +1 -1
@@ -548,7 +548,7 @@ config CMD_FDT config CMD_EXTENSION bool "Extension board management command" select CMD_FDT - depends on SUPPORT_EXTENSION_SCAN || SUPPORT_DM_EXTENSION_SCAN + depends on SUPPORT_EXTENSION_SCAN help Enables the "extension" command, which allows to detect extension boards connected to the system, and apply
cmd/extension_board.c +8 -64
118 lines not on this page · raw message
include/extension_board.h +14 -42
109 lines not on this page · raw message
test/boot/bootdev.c +13 -19
@@ -380,7 +380,6 @@ static int bootdev_test_hunter(struct unit_test_state *uts)ut_assert_nextline ("Prio Used Uclass Hunter" );ut_assert_nextlinen ("----" );ut_assert_nextline (" 6 ethernet eth_bootdev" ); -ut_assert_nextline (" 1 simple_bus (none)" );ut_assert_nextline (" 5 ide ide_bootdev" );ut_assert_nextline (" 2 mmc mmc_bootdev" );ut_assert_nextline (" 4 nvme nvme_bootdev" );
@@ -389,15 +388,15 @@ static int bootdev_test_hunter(struct unit_test_state *uts)ut_assert_nextline (" 4 spi_flash sf_bootdev" );ut_assert_nextline (" 5 usb usb_bootdev" );ut_assert_nextline (" 4 virtio virtio_bootdev" ); -ut_assert_nextline ("(total hunters: 10)" ); +ut_assert_nextline ("(total hunters: 9)" );ut_assert_console_end ();ut_assertok (bootdev_hunt ("usb1" , false));ut_assert_skip_to_line ("Bus usb@1: 5 USB Device(s) found" );ut_assert_console_end (); -/* USB is 7th in the list, so bit 8 */ -ut_asserteq (BIT (8 ), std->hunters_used); +/* USB is 8th in the list, so bit 7 */ +ut_asserteq (BIT (7 ), std->hunters_used);return 0 ; }
@@ -418,7 +417,7 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)ut_assert_nextline ("Prio Used Uclass Hunter" );ut_assert_nextlinen ("----" );ut_assert_nextline (" 6 ethernet eth_bootdev" ); -ut_assert_skip_to_line ("(total hunters: 10)" ); +ut_assert_skip_to_line ("(total hunters: 9)" );ut_assert_console_end ();/* Use the MMC hunter and see that it updates */
@@ -426,7 +425,7 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)ut_assertok (run_command ("bootdev hunt -l" ,0 ));ut_assert_skip_to_line (" 5 ide ide_bootdev" );ut_assert_nextline (" 2 * mmc mmc_bootdev" ); -ut_assert_skip_to_line ("(total hunters: 10)" ); +ut_assert_skip_to_line ("(total hunters: 9)" );ut_assert_console_end ();/* Scan all hunters */
@@ -436,8 +435,6 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)ut_assert_nextline ("Hunting with: ethernet" );/* This is the extension feature which has no uclass at present */ -ut_assert_nextline ("Hunting with: simple_bus" ); -ut_assert_nextline ("Found 2 extension board(s)." );ut_assert_nextline ("Hunting with: ide" );/* mmc hunter has already been used so should not run again */
@@ -457,7 +454,6 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)ut_assert_nextlinen ("Prio" );ut_assert_nextlinen ("----" );ut_assert_nextline (" 6 * ethernet eth_bootdev" ); -ut_assert_nextline (" 1 * simple_bus (none)" );ut_assert_nextline (" 5 * ide ide_bootdev" );ut_assert_nextline (" 2 * mmc mmc_bootdev" );ut_assert_nextline (" 4 * nvme nvme_bootdev" );
@@ -466,7 +462,7 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)ut_assert_nextline (" 4 * spi_flash sf_bootdev" );ut_assert_nextline (" 5 * usb usb_bootdev" );ut_assert_nextline (" 4 * virtio virtio_bootdev" ); -ut_assert_nextline ("(total hunters: 10)" ); +ut_assert_nextline ("(total hunters: 9)" );ut_assert_console_end ();ut_asserteq (GENMASK (MAX_HUNTER ,0 ), std->hunters_used);
@@ -490,7 +486,7 @@ static int bootdev_test_hunt_scan(struct unit_test_state *uts)ut_assertok (bootflow_scan_first (NULL ,NULL , &iter,BOOTFLOWIF_SHOW |BOOTFLOWIF_HUNT |BOOTFLOWIF_SKIP_GLOBAL , &bflow)); -ut_asserteq (BIT (MMC_HUNTER ) |BIT (1 ), std->hunters_used); +ut_asserteq (BIT (MMC_HUNTER ), std->hunters_used);return 0 ; }
@@ -650,8 +646,8 @@ static int bootdev_test_next_label(struct unit_test_state *uts)ut_asserteq_str ("scsi.id0lun0.bootdev" , dev->name);ut_asserteq (BOOTFLOW_METHF_SINGLE_UCLASS , mflags); -/* SCSI is 7th in the list, so bit 6 */ -ut_asserteq (BIT (MMC_HUNTER ) |BIT (6 ), std->hunters_used); +/* SCSI is 6th in the list, so bit 5 */ +ut_asserteq (BIT (MMC_HUNTER ) |BIT (5 ), std->hunters_used);ut_assertok (bootdev_next_label (&iter, &dev, &mflags));ut_assert_console_end ();
@@ -661,7 +657,7 @@ static int bootdev_test_next_label(struct unit_test_state *uts) mflags);/* dhcp: Ethernet is first so bit 0 */ -ut_asserteq (BIT (MMC_HUNTER ) |BIT (6 ) |BIT (0 ), std->hunters_used); +ut_asserteq (BIT (MMC_HUNTER ) |BIT (5 ) |BIT (0 ), std->hunters_used);ut_assertok (bootdev_next_label (&iter, &dev, &mflags));ut_assert_console_end ();
@@ -671,7 +667,7 @@ static int bootdev_test_next_label(struct unit_test_state *uts) mflags);/* pxe: Ethernet is first so bit 0 */ -ut_asserteq (BIT (MMC_HUNTER ) |BIT (6 ) |BIT (0 ), std->hunters_used); +ut_asserteq (BIT (MMC_HUNTER ) |BIT (5 ) |BIT (0 ), std->hunters_used); mflags =123 ;ut_asserteq (-ENODEV ,bootdev_next_label (&iter, &dev, &mflags));
@@ -679,7 +675,7 @@ static int bootdev_test_next_label(struct unit_test_state *uts)ut_assert_console_end ();/* no change */ -ut_asserteq (BIT (MMC_HUNTER ) |BIT (6 ) |BIT (0 ), std->hunters_used); +ut_asserteq (BIT (MMC_HUNTER ) |BIT (5 ) |BIT (0 ), std->hunters_used);return 0 ; }
@@ -724,12 +720,10 @@ static int bootdev_test_next_prio(struct unit_test_state *uts)ut_assertok (bootdev_next_prio (&iter, &dev));ut_asserteq_str ("mmc2.bootdev" , dev->name); -ut_assert_nextline ("Hunting with: simple_bus" ); -ut_assert_nextline ("Found 2 extension board(s)." );ut_assert_nextline ("Hunting with: mmc" );ut_assert_console_end (); -ut_asserteq (BIT (MMC_HUNTER ) |BIT (1 ), std->hunters_used); +ut_asserteq (BIT (MMC_HUNTER ), std->hunters_used);ut_assertok (bootdev_next_prio (&iter, &dev));ut_asserteq_str ("mmc1.bootdev" , dev->name);
test/boot/bootflow.c +2 -4
@@ -799,7 +799,7 @@ static int bootflow_cmd_hunt_single(struct unit_test_state *uts)ut_assert_console_end ();/* check that the hunter was used */ -ut_asserteq (BIT (MMC_HUNTER ) |BIT (1 ), std->hunters_used); +ut_asserteq (BIT (MMC_HUNTER ), std->hunters_used);return 0 ; }
@@ -821,14 +821,12 @@ static int bootflow_cmd_hunt_label(struct unit_test_state *uts)ut_assertok (run_command ("bootflow scan -l mmc" ,0 ));/* check that the hunter was used */ -ut_asserteq (BIT (MMC_HUNTER ) |BIT (1 ), std->hunters_used); +ut_asserteq (BIT (MMC_HUNTER ), std->hunters_used);/* check that we got the mmc1 bootflow */ ut_assert_nextline ("Scanning for bootflows with label 'mmc'" );ut_assert_nextlinen ("Seq" );ut_assert_nextlinen ("---" ); -ut_assert_nextline ("Hunting with: simple_bus" ); -ut_assert_nextline ("Found 2 extension board(s)." );ut_assert_nextline ("Hunting with: mmc" );ut_assert_nextline ("Scanning bootdev 'mmc2.bootdev':" );ut_assert_nextline ("Scanning bootdev 'mmc1.bootdev':" );
test/boot/bootstd_common.h +2 -2
@@ -21,8 +21,8 @@#define TEST_VERNUM 0x00010002enum { -MAX_HUNTER =9 , -MMC_HUNTER =3 ,/* ID of MMC hunter */ +MAX_HUNTER =8 , +MMC_HUNTER =2 ,/* ID of MMC hunter */ };struct unit_test_state ;
Signature · 1 line
2.43.0
PATCH v4 17/20 boot: extension: Move overlay apply custom logic to command level
In reply to Kory Maincent (TI.com)The extension_overlay_cmd environment variable approach is specific to the U-Boot extension_board command, while other boot flows (pxe_utils, bootstd) handle overlay loading differently.
Move the extension_overlay_cmd execution out of the core extension framework to the command level. This decouples the framework from command-specific behavior and prepares for future extension support in other boot flows.
--- boot/extension-uclass.c | 68 +++-------------------------------- cmd/extension_board.c | 92 +++++++++++++++++++++++++++++++++++++++++++++-- include/extension_board.h | 12 ++----- 3 files changed, 98 insertions(+), 74 deletions(-)
boot/extension-uclass.c +5 -63
@@ -59,92 +59,34 @@ int extension_scan(void)return ops->scan (dev, extension_list); } -static int _extension_apply (const struct extension *extension) +int extension_apply (struct fdt_header *working_fdt,ulong size) { -ulong extrasize, overlay_addr;struct fdt_header *blob; -char *overlay_cmd; +ulong overlay_addr;int ret; -if (!working_fdt) { -printf ("No FDT memory address configured. Please configure\n" -"the FDT address via \"fdt addr <address>\" command.\n" ); -return -EINVAL ; - } - - overlay_cmd =env_get ("extension_overlay_cmd" ); -if (!overlay_cmd) { -printf ("Environment extension_overlay_cmd is missing\n" ); -return -EINVAL ; - } - overlay_addr =env_get_hex ("extension_overlay_addr" ,0 );if (!overlay_addr) {printf ("Environment extension_overlay_addr is missing\n" );return -EINVAL ; } -env_set ("extension_overlay_name" , extension->overlay); - ret =run_command (overlay_cmd,0 ); -if (ret) -return ret; - - extrasize =env_get_hex ("filesize" ,0 ); -if (!extrasize) -return -EINVAL ; - -fdt_shrink_to_minimum (working_fdt, extrasize); +fdt_shrink_to_minimum (working_fdt, size); blob =map_sysmem (overlay_addr,0 );if (!fdt_valid (&blob)) { -printf ("Invalid overlay devicetree %s\n" , extension->overlay); +printf ("Invalid overlay devicetree\n" );return -EINVAL ; }/* Apply method prints messages on error */ ret =fdt_overlay_apply_verbose (working_fdt, blob);if (ret) -printf ("Failed to apply overlay %s\n" , extension->overlay); +printf ("Failed to apply overlay\n" );return ret; } -int extension_apply (int extension_num) -{ -struct alist *extension_list =extension_get_list (); -const struct extension *extension; - -if (!extension_list) -return -ENOENT ; - - extension =alist_get (extension_list, extension_num, - struct extension); -if (!extension) { -printf ("Wrong extension number\n" ); -return -EINVAL ; - } - -return _extension_apply (extension); -} - -int extension_apply_all (void ) -{ -struct alist *extension_list =extension_get_list (); -const struct extension *extension; -int ret; - -if (!extension_list) -return -ENOENT ; - -alist_for_each (extension, extension_list) { - ret =_extension_apply (extension); -if (ret) -return ret; - } - -return 0 ; -} -UCLASS_DRIVER (extension) = { .name ="extension" , .id =UCLASS_EXTENSION ,
cmd/extension_board.c +90 -2
110 lines not on this page · raw message
include/extension_board.h +3 -9
@@ -44,17 +44,11 @@ int extension_scan(void);/** * extension_apply - Apply extension board overlay to the devicetree -* @extension_num: Extension number to be applied +* @working_fdt: Pointer to working flattened device tree +* @size: Size of the devicetree overlay * Return: Zero on success, negative on failure. */ -int extension_apply (int extension_num); - -/** -* extension_apply_all - Apply all extension board overlays to the -* devicetree -* Return: Zero on success, negative on failure. -*/ -int extension_apply_all (void ); +int extension_apply (struct fdt_header *working_fdt,ulong size);/** * extension - Description fields of an extension board
Signature · 1 line
2.43.0
PATCH v4 18/20 boot: pxe_utils: Add extension board devicetree overlay support
In reply to Kory Maincent (TI.com)Add support for scanning and applying extension board devicetree overlays during PXE boot. After loading the main board devicetree, the system now scans for available extension boards and applies their overlays automatically.
This enables dynamic hardware configuration for systems with extension boards during boot scenarios which are using pxe_utils.
---
Changes in v3:
- Added error log if the overlay does not load or apply.
--- boot/pxe_utils.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/usage/pxe.rst | 4 +++ 2 files changed, 96 insertions(+)
boot/pxe_utils.c +92 -0
@@ -10,6 +10,7 @@#include <command.h> #include <dm.h> #include <env.h> +#include <extension_board.h> #include <image.h> #include <log.h> #include <malloc.h>
@@ -432,6 +433,95 @@ skip_overlay: }#endif +/* +* label_boot_extension - scan extension boards and load overlay associated +*/ + +static void label_boot_extension (struct pxe_context *ctx, +struct pxe_label *label) +{ +#if CONFIG_IS_ENABLED (SUPPORT_EXTENSION_SCAN ) +const struct extension *extension; +struct fdt_header *working_fdt; +struct alist *extension_list; +int ret, dir_len, len; +char *overlay_dir; +const char *slash; +ulong fdt_addr; + + ret =extension_scan (); +if (ret <0 ) +return ; + + extension_list =extension_get_list (); +if (!extension_list) +return ; + +/* Get the main fdt and map it */ + fdt_addr =env_get_hex ("fdt_addr_r" ,0 ); + working_fdt =map_sysmem (fdt_addr,0 ); +if (fdt_check_header (working_fdt)) +return ; + +/* Use fdtdir for now as the overlay devicetree directory */ +if (label->fdtdir) { + len =strlen (label->fdtdir); +if (!len) + slash ="./" ; +else if (label->fdtdir[len -1 ] !='/' ) + slash ="/" ; +else + slash ="" ; + + dir_len =strlen (label->fdtdir) +strlen (slash) +1 ; + overlay_dir =calloc (1 , len); +if (!overlay_dir) +return ; + +snprintf (overlay_dir, dir_len,"%s%s" , label->fdtdir, + slash); + }else { + dir_len =2 ; +snprintf (overlay_dir, dir_len,"/" ); + } + +alist_for_each (extension, extension_list) { +char *overlay_file; +ulong size; + + len = dir_len +strlen (extension->overlay); + overlay_file =calloc (1 , len); +if (!overlay_file) + goto cleanup; + +snprintf (overlay_file, len,"%s%s" , overlay_dir, + extension->overlay); + +/* Load extension overlay file */ + ret =get_relfile_envaddr (ctx, overlay_file, +"extension_overlay_addr" , + (enum bootflow_img_t )IH_TYPE_FLATDT , + &size); +if (ret <0 ) { +printf ("Failed loading overlay %s\n" , overlay_file); +free (overlay_file); +continue ; + } + + ret =extension_apply (working_fdt, size); +if (ret) { +printf ("Failed applying overlay %s\n" , overlay_file); +free (overlay_file); +continue ; + } +free (overlay_file); + } + +cleanup: +free (overlay_dir); +#endif +} +/** * label_boot() - Boot according to the contents of a pxe_label *
@@ -685,6 +775,8 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)if (label->fdtoverlays)label_boot_fdtoverlay (ctx, label);#endif +label_boot_extension (ctx, label); + }else { bootm_argv[3 ] =NULL ; }
doc/usage/pxe.rst +4 -0
@@ -103,6 +103,10 @@ Environment ``fdt_addr_r``. Required to use the ``fdtoverlays`` command in the PXE file. +``extension_overlay_addr`` + Location in RAM to temporarily store extension fdt overlay(s) + before applying them to the fdt blob stored at ``fdt_addr_r``. + ``pxe_label_override`` Override label to be used, if exists, instead of the default label. This will allow consumers to choose a pxe label at
Signature · 1 line
2.43.0
PATCH v4 19/20 boot: bootmeth_efi: Refactor distro_efi_try_bootflow_files return logic
In reply to Kory Maincent (TI.com)Simplify the return path in distro_efi_try_bootflow_files() to prepare for adding extension board support in a subsequent commit.
--- boot/bootmeth_efi.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
boot/bootmeth_efi.c +16 -15
@@ -148,25 +148,26 @@ static int distro_efi_try_bootflow_files(struct udevice *dev,return log_msg_ret ("fil" , -ENOMEM ); } -if (!ret) { - bflow->fdt_size = size; - bflow->fdt_addr = fdt_addr; - -/* -* TODO: Apply extension overlay -* -* Here we need to load and apply the extension overlay. This is -* not implemented. See do_extension_apply(). The extension -* stuff needs an implementation in boot/extension.c so it is -* separate from the command code. Really the extension stuff -* should use the device tree and a uclass / driver interface -* rather than implementing its own list -*/ - }else { +if (ret) {log_debug ("No device tree available\n" ); bflow->flags |=BOOTFLOWF_USE_BUILTIN_FDT ; +return 0 ; } + bflow->fdt_size = size; + bflow->fdt_addr = fdt_addr; + +/* +* TODO: Apply extension overlay +* +* Here we need to load and apply the extension overlay. This is +* not implemented. See do_extension_apply(). The extension +* stuff needs an implementation in boot/extension.c so it is +* separate from the command code. Really the extension stuff +* should use the device tree and a uclass / driver interface +* rather than implementing its own list +*/ +return 0 ; }
Signature · 1 line
2.43.0
PATCH v4 20/20 boot: bootmeth_efi: Add extension board devicetree overlay support
In reply to Kory Maincent (TI.com)Add support for scanning and applying extension board devicetree overlays during EFI boot. After loading the main board devicetree, the system now scans for available extension boards and applies their overlays automatically.
---
Not yet tested, need to find a board with extension boards and supporting EFI boot. Roger Quadros could you test it on your side?
Changes in v3:
- Added error log if the overlay does not load or apply.
--- boot/bootmeth_efi.c | 68 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 11 deletions(-)
boot/bootmeth_efi.c +57 -11
@@ -16,6 +16,7 @@#include <efi.h> #include <efi_loader.h> #include <env.h> +#include <extension_board.h> #include <fs.h> #include <malloc.h> #include <mapmem.h>
@@ -99,8 +100,11 @@ static int distro_efi_check(struct udevice *dev, struct bootflow_iter *iter)static int distro_efi_try_bootflow_files (struct udevice *dev,struct bootflow *bflow) { +ulong fdt_addr, size, overlay_addr; +const struct extension *extension; +struct fdt_header *working_fdt;struct blk_desc *desc =NULL ; -ulong fdt_addr, size; +struct alist *extension_list;char fname[256 ];int ret, seq;
@@ -157,16 +161,58 @@ static int distro_efi_try_bootflow_files(struct udevice *dev, bflow->fdt_size = size; bflow->fdt_addr = fdt_addr; -/* -* TODO: Apply extension overlay -* -* Here we need to load and apply the extension overlay. This is -* not implemented. See do_extension_apply(). The extension -* stuff needs an implementation in boot/extension.c so it is -* separate from the command code. Really the extension stuff -* should use the device tree and a uclass / driver interface -* rather than implementing its own list -*/ +if (!CONFIG_IS_ENABLED (SUPPORT_EXTENSION_SCAN )) +return 0 ; + + ret =extension_scan (); +if (ret <0 ) +return 0 ; + + extension_list =extension_get_list (); +if (!extension_list) +return 0 ; + + working_fdt =map_sysmem (fdt_addr,0 ); +if (fdt_check_header (working_fdt)) +return 0 ; + + overlay_addr =env_get_hex ("extension_overlay_addr" ,0 ); +if (!overlay_addr) { +log_debug ("Environment extension_overlay_addr is missing\n" ); +return 0 ; + } + +alist_for_each (extension, extension_list) { +char *overlay_file; +int len; + + len =sizeof (EFI_DIRNAME ) +strlen (extension->overlay); + overlay_file =calloc (1 , len); +if (!overlay_file) +return -ENOMEM ; + +snprintf (overlay_file, len,"%s%s" ,EFI_DIRNAME , + extension->overlay); + + ret =bootmeth_common_read_file (dev, bflow, overlay_file, + overlay_addr, + (enum bootflow_img_t )IH_TYPE_FLATDT , + &size); +if (ret) { +log_debug ("Failed loading overlay %s\n" , overlay_file); +free (overlay_file); +continue ; + } + + ret =extension_apply (working_fdt, size); +if (ret) { +log_debug ("Failed applying overlay %s\n" , overlay_file); +free (overlay_file); +continue ; + } + bflow->fdt_size += size; +free (overlay_file); + }return 0 ; }
Signature · 1 line
2.43.0
Quoted 8 lines · Kory Maincent (TI.com)
This series converts the extension board framework to use UCLASS as requested by Simon Glass, then adds extension support to
pxe_utilsandbootmeth_efi(not tested) to enable extension boards devicetree load in the standard boot process.I can't test the imx8 extension scan enabled by the imx8mm-cl-iot-gate_defconfig as I don't have this board.
I also can't test the efi bootmeth change as I don't have such board.
This has fail to build problems on:sandbox_spl sandbox_noinst sandbox_vpl
Seems otherwise fine however, size growth on platforms not utilizing this looks good. It's a big big when you need it, but it's main U-Boot and I think in the end, something we can live with.
Signature · 1 line
Tom
Quoted 7 lines · On Wed, 29 Oct 2025 18:31:36 -0600 Tom Rini <[email protected]> wrote:
Quoted 5 lines · Kory Maincent (TI.com)
This series converts the extension board framework to use UCLASS as requested by Simon Glass, then adds extension support to
pxe_utilsandbootmeth_efi(not tested) to enable extension boards devicetree load in the standard boot process.
Quoted 6 lines
Quoted 3 lines
I can't test the imx8 extension scan enabled by the imx8mm-cl-iot-gate_defconfig as I don't have this board.
I also can't test the efi bootmeth change as I don't have such board.This has fail to build problems on:
sandbox_splsandbox_noinstsandbox_vpl
Ok I will take a look at these build errors.
Quoted 3 lines
Seems otherwise fine however, size growth on platforms not utilizing this looks good. It's a big big when you need it, but it's main U-Boot and I think in the end, something we can live with.
Do you see some improvement I could make in v5 to decrease the footprint of this support?
Regards,
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
Quoted 10 lines · Kory Maincent
Quoted 7 lines · On Wed, 29 Oct 2025 18:31:36 -0600 Tom Rini <[email protected]> wrote:
Quoted 5 lines · Kory Maincent (TI.com)
This series converts the extension board framework to use UCLASS as requested by Simon Glass, then adds extension support to
pxe_utilsandbootmeth_efi(not tested) to enable extension boards devicetree load in the standard boot process.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I can't test the imx8 extension scan enabled by the imx8mm-cl-iot-gate_defconfig as I don't have this board.
I also can't test the efi bootmeth change as I don't have such board.This has fail to build problems on:
sandbox_splsandbox_noinstsandbox_vplOk I will take a look at these build errors.
Thanks.
Quoted 6 lines
Quoted 3 lines
Seems otherwise fine however, size growth on platforms not utilizing this looks good. It's a big big when you need it, but it's main U-Boot and I think in the end, something we can live with.
Do you see some improvement I could make in v5 to decrease the footprint of this support?
No, I think it's fine enough, just the general growth for these kind of changes.
Signature · 1 line
Tom