From 1ded89e78bca4c43db8e46841c589366202cb2b0 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 25 Jul 2023 09:50:08 +0300 Subject: cmd: Fix an error code in cmd_mux_find() This returns the wrong variable. It ends up returning NULL when it was suppose to return an error pointer. Signed-off-by: Dan Carpenter --- cmd/mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/mux.c b/cmd/mux.c index 833266f08b1..c75907af772 100644 --- a/cmd/mux.c +++ b/cmd/mux.c @@ -49,7 +49,7 @@ static struct mux_control *cmd_mux_find(char *const argv[]) chip = dev_get_uclass_priv(dev); if (!chip) - return ERR_PTR(ret); + return ERR_PTR(-EINVAL); if (id >= chip->controllers) return ERR_PTR(-EINVAL); -- cgit v1.2.3 From 57175285774751ca751d3d5e9f045d6af95ea43b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 25 Jul 2023 09:50:26 +0300 Subject: cmd: Fix a size parameter in test_readonly() The parentheses are in the wrong place so this passes the number of bytes to write as "sizeof(index_0) != TPM_SUCCESS" when just "sizeof(index_0)" was intended. (1 byte vs 4 bytes). Signed-off-by: Dan Carpenter --- cmd/tpm_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c index c4ed8e59012..9bdc9c660fd 100644 --- a/cmd/tpm_test.c +++ b/cmd/tpm_test.c @@ -294,8 +294,8 @@ static int test_readonly(struct udevice *dev) */ index_0 += 1; if (tpm_nv_write_value(dev, INDEX0, (uint8_t *)&index_0, - sizeof(index_0) != - TPM_SUCCESS)) { + sizeof(index_0)) != + TPM_SUCCESS) { pr_err("\tcould not write index 0\n"); } tpm_nv_write_value_lock(dev, INDEX0); -- cgit v1.2.3 From 0c0d471e2be018342fd191892e1cccc2231db90b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 31 Jul 2023 17:03:59 +0300 Subject: cmd: improve string matching for hex Match the "=0x" instead of just "=0". Signed-off-by: Dan Carpenter Reviewed-by: Heinrich.Schuchardt Reviewed-by: Simon Glass Reviewed-by: Ilias Apalodimas --- cmd/nvedit_efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c index 24944ab81e2..7a30b5cc8f8 100644 --- a/cmd/nvedit_efi.c +++ b/cmd/nvedit_efi.c @@ -262,7 +262,7 @@ static int append_value(char **bufp, size_t *sizep, char *data) char *tmp_buf = NULL, *new_buf = NULL, *value; unsigned long len = 0; - if (!strncmp(data, "=0x", 2)) { /* hexadecimal number */ + if (!strncmp(data, "=0x", 3)) { /* hexadecimal number */ union { u8 u8; u16 u16; -- cgit v1.2.3 From a077ac13d03c8cde646ddab30b03ec0f8b753e1e Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 2 Aug 2023 11:09:43 -0400 Subject: Kconfigs: Correct default of "0" on hex type entries It is not a parse error to have a default value of "0" for a "hex" type entry, instead of "0x0". However, "0" and "0x0" are not treated the same even by the tools themselves. Correct this by changing the default value from "0" to "0x0" for all hex type questions that had the incorrect default. Fix one instance (in two configs) of a default of "0" being used on a hex question to be "0x0". Remove the cases where a defconfig had set a value of "0x0" to be used as the default had been "0". Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- arch/arm/cpu/armv7/ls102xa/Kconfig | 1 - arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 2 +- arch/arm/mach-imx/Kconfig | 2 +- arch/arm/mach-imx/imx8/Kconfig | 4 ++-- arch/arm/mach-rockchip/Kconfig | 2 +- arch/arm/mach-sunxi/Kconfig | 4 ++-- arch/powerpc/cpu/mpc8xx/Kconfig | 2 +- boot/Kconfig | 2 +- cmd/Kconfig | 8 ++++---- common/Kconfig | 2 +- common/spl/Kconfig | 2 +- common/spl/Kconfig.tpl | 2 +- configs/am335x_guardian_defconfig | 1 - configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- configs/evb-rk3229_defconfig | 1 - configs/evb-rk3308_defconfig | 1 - configs/imx6q_logic_defconfig | 1 - configs/imx8mm_data_modul_edm_sbc_defconfig | 1 - configs/imx8mn_beacon_2g_defconfig | 1 - configs/imx8mn_beacon_defconfig | 1 - configs/imx8mn_beacon_fspi_defconfig | 1 - configs/imx8mp_beacon_defconfig | 1 - configs/imx8mp_data_modul_edm_sbc_defconfig | 1 - configs/imx8mp_dhcom_pdk2_defconfig | 1 - configs/imx8mp_dhcom_pdk3_defconfig | 1 - configs/kontron_sl28_defconfig | 2 -- configs/lion-rk3368_defconfig | 1 - configs/roc-cc-rk3308_defconfig | 1 - configs/rock-pi-s-rk3308_defconfig | 1 - configs/sandbox64_defconfig | 1 - configs/sandbox_defconfig | 1 - configs/sandbox_flattree_defconfig | 1 - configs/sandbox_noinst_defconfig | 1 - configs/sandbox_spl_defconfig | 1 - configs/sandbox_vpl_defconfig | 1 - configs/xilinx_versal_net_virt_defconfig | 1 - configs/xilinx_zynqmp_virt_defconfig | 1 - drivers/block/Kconfig | 2 +- drivers/fastboot/Kconfig | 2 +- drivers/i2c/Kconfig | 16 ++++++++-------- drivers/misc/Kconfig | 2 +- drivers/serial/Kconfig | 6 +++--- drivers/usb/gadget/Kconfig | 2 +- drivers/video/Kconfig | 4 ++-- env/Kconfig | 4 ++-- lib/Kconfig | 2 +- 47 files changed, 38 insertions(+), 64 deletions(-) (limited to 'cmd') diff --git a/arch/arm/cpu/armv7/ls102xa/Kconfig b/arch/arm/cpu/armv7/ls102xa/Kconfig index 3e292bf70e1..46ace7e5fd6 100644 --- a/arch/arm/cpu/armv7/ls102xa/Kconfig +++ b/arch/arm/cpu/armv7/ls102xa/Kconfig @@ -98,7 +98,6 @@ config SYS_FSL_ERRATUM_A008407 config SYS_FSL_QSPI_SKIP_CLKSEL bool "Skip setting QSPI clock during SoC init" - default 0 help To improve startup times when booting from QSPI flash, the QSPI frequency can be set very early in the boot process. If this option diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index a8b493e2f87..d46934c2dcf 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -739,7 +739,7 @@ config HAS_FSL_XHCI_USB config SYS_FSL_BOOTROM_BASE hex depends on FSL_LSCH2 - default 0 + default 0x0 config SYS_FSL_BOOTROM_SIZE hex diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index d94b5828d0d..2136ab7e9eb 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -181,7 +181,7 @@ config IMX8_ROMAPI config SPL_IMX_ROMAPI_LOADADDR hex "Default load address to load image through ROM API" depends on IMX8_ROMAPI || SPL_BOOTROM_SUPPORT - default 0 + default 0x0 config IMX_DCD_ADDR hex "DCD Blocks location on the image" diff --git a/arch/arm/mach-imx/imx8/Kconfig b/arch/arm/mach-imx/imx8/Kconfig index 15f844f5030..59d11b3179e 100644 --- a/arch/arm/mach-imx/imx8/Kconfig +++ b/arch/arm/mach-imx/imx8/Kconfig @@ -34,11 +34,11 @@ config SYS_SOC config BOOTAUX_RESERVED_MEM_BASE hex "i.MX auxiliary core dram memory base" - default 0 + default 0x0 config BOOTAUX_RESERVED_MEM_SIZE hex "i.MX auxiliary core dram memory size" - default 0 + default 0x0 choice prompt "i.MX8 board select" diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index 49da93d54b4..4569a9ce283 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -469,7 +469,7 @@ config ROCKCHIP_STIMER_BASE config ROCKCHIP_SPL_RESERVE_IRAM hex "Size of IRAM reserved in SPL" - default 0 + default 0x0 help SPL may need reserve memory for firmware loaded by SPL, whose load address is in IRAM and may overlay with SPL text area if not diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index e20c3a3ee92..9d5df2c1027 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -568,7 +568,7 @@ config DRAM_EMR1 config DRAM_TPR3 hex "sunxi dram tpr3 value" - default 0 + default 0x0 ---help--- Set the dram controller tpr3 parameter. This parameter configures the delay on the command lane and also phase shifts, which are @@ -579,7 +579,7 @@ config DRAM_TPR3 config DRAM_DQS_GATING_DELAY hex "sunxi dram dqs_gating_delay value" - default 0 + default 0x0 ---help--- Set the dram controller dqs_gating_delay parmeter. Each byte encodes the DQS gating delay for each byte lane. The delay diff --git a/arch/powerpc/cpu/mpc8xx/Kconfig b/arch/powerpc/cpu/mpc8xx/Kconfig index bd2af8dc10e..1731c965ad9 100644 --- a/arch/powerpc/cpu/mpc8xx/Kconfig +++ b/arch/powerpc/cpu/mpc8xx/Kconfig @@ -94,7 +94,7 @@ config SYS_SIUMCR config SYS_SYPCR hex "SYPCR register" if !WDT_MPC8xxx - default 0 + default 0x0 help System Protection Control (11-9) diff --git a/boot/Kconfig b/boot/Kconfig index e8fb03b8016..b00d7a8d11e 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -1007,7 +1007,7 @@ config BOOTSTAGE_STASH config BOOTSTAGE_STASH_ADDR hex "Address to stash boot timing information" - default 0 + default 0x0 help Provide an address which will not be overwritten by the OS when it starts, so that it can read this information when ready. diff --git a/cmd/Kconfig b/cmd/Kconfig index 7f65e3187a6..8ab47b333c2 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -517,7 +517,7 @@ config CMD_SPL config CMD_SPL_NAND_OFS hex "Offset of OS args or dtb for Falcon-mode NAND boot" depends on CMD_SPL && (TPL_NAND_SUPPORT || SPL_NAND_SUPPORT) - default 0 + default 0x0 help This provides the offset of the command line arguments for Linux when booting from NAND in Falcon mode. See doc/README.falcon @@ -527,7 +527,7 @@ config CMD_SPL_NAND_OFS config CMD_SPL_NOR_OFS hex "Offset of OS args or dtb for Falcon-mode NOR boot" depends on CMD_SPL && SPL_NOR_SUPPORT - default 0 + default 0x0 help This provides the offset of the command line arguments or dtb for Linux when booting from NOR in Falcon mode. @@ -1514,7 +1514,7 @@ config DEFAULT_SPI_BUS config DEFAULT_SPI_MODE hex "default spi mode used by sspi command (see include/spi.h)" depends on CMD_SPI - default 0 + default 0x0 config CMD_TEMPERATURE bool "temperature - display the temperature from thermal sensors" @@ -1805,7 +1805,7 @@ config BOOTP_PXE_CLIENTARCH depends on BOOTP_PXE default 0x16 if ARM64 default 0x15 if ARM - default 0 if X86 + default 0x0 if X86 config BOOTP_VCI_STRING string diff --git a/common/Kconfig b/common/Kconfig index cdb77a6a7da..0b09bd68bd1 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1031,7 +1031,7 @@ config BLOBLIST_SIZE config BLOBLIST_SIZE_RELOC hex "Size of bloblist after relocation" default BLOBLIST_SIZE if BLOBLIST_FIXED || BLOBLIST_ALLOC - default 0 if BLOBLIST_PASSAGE + default 0x0 if BLOBLIST_PASSAGE help Sets the size of the bloblist in bytes after relocation. Since U-Boot has a lot more memory available then, it is possible to use a larger diff --git a/common/spl/Kconfig b/common/spl/Kconfig index c5dd476db58..1c2fe78e3e0 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -67,7 +67,7 @@ config SPL_SIZE_LIMIT_SUBTRACT_MALLOC config SPL_SIZE_LIMIT_PROVIDE_STACK hex "SPL image size check: provide stack space before relocation" depends on SPL_SIZE_LIMIT > 0 - default 0 + default 0x0 help If set, this size is reserved in SPL_SIZE_LIMIT check to ensure such an image does not overflow SRAM if SPL_SIZE_LIMIT describes the size diff --git a/common/spl/Kconfig.tpl b/common/spl/Kconfig.tpl index 3d6cf1e59f3..cc71578f646 100644 --- a/common/spl/Kconfig.tpl +++ b/common/spl/Kconfig.tpl @@ -126,7 +126,7 @@ config TPL_POWER config TPL_TEXT_BASE hex "Base address for the .text section of the TPL stage" - default 0 + default 0x0 help The base address for the .text section of the TPL stage. diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index a485cc65eaf..7c4085d0849 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -17,7 +17,6 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_BOOTCOUNT_BOOTLIMIT=3 CONFIG_SPL=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_ENV_OFFSET_REDUND=0x540000 CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SYS_MEMTEST_START=0x80000000 diff --git a/configs/efi-x86_app32_defconfig b/configs/efi-x86_app32_defconfig index 50975dbfaaf..1bfc01f060d 100644 --- a/configs/efi-x86_app32_defconfig +++ b/configs/efi-x86_app32_defconfig @@ -2,7 +2,7 @@ CONFIG_X86=y CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="efi-x86_app" -CONFIG_DEBUG_UART_BASE=0 +CONFIG_DEBUG_UART_BASE=0x0 CONFIG_DEBUG_UART_CLOCK=0 CONFIG_VENDOR_EFI=y CONFIG_TARGET_EFI_APP32=y diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index 0fc358ddcdf..46a1900c704 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -2,7 +2,7 @@ CONFIG_X86=y CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="efi-x86_app" -CONFIG_DEBUG_UART_BASE=0 +CONFIG_DEBUG_UART_BASE=0x0 CONFIG_DEBUG_UART_CLOCK=0 CONFIG_X86_RUN_64BIT=y CONFIG_VENDOR_EFI=y diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index c1e7f390ad5..7469f3fbe0a 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -12,7 +12,6 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rk3229-evb" CONFIG_SPL_TEXT_BASE=0x60000000 CONFIG_ROCKCHIP_RK322X=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_TARGET_EVB_RK3229=y CONFIG_SPL_STACK_R_ADDR=0x60600000 CONFIG_DEBUG_UART_BASE=0x11030000 diff --git a/configs/evb-rk3308_defconfig b/configs/evb-rk3308_defconfig index a13a809c1ef..d1e78582a3a 100644 --- a/configs/evb-rk3308_defconfig +++ b/configs/evb-rk3308_defconfig @@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000 CONFIG_DEFAULT_DEVICE_TREE="rk3308-evb" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3308=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3308=y CONFIG_SPL_STACK_R_ADDR=0xc00000 diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig index 2814e2c8147..74733c4de32 100644 --- a/configs/imx6q_logic_defconfig +++ b/configs/imx6q_logic_defconfig @@ -86,7 +86,6 @@ CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_MISC=y CONFIG_I2C_EEPROM=y -CONFIG_SYS_I2C_EEPROM_ADDR=0x0 CONFIG_FSL_USDHC=y CONFIG_MTD=y CONFIG_DM_MTD=y diff --git a/configs/imx8mm_data_modul_edm_sbc_defconfig b/configs/imx8mm_data_modul_edm_sbc_defconfig index f63eb4fd64c..e2bca406113 100644 --- a/configs/imx8mm_data_modul_edm_sbc_defconfig +++ b/configs/imx8mm_data_modul_edm_sbc_defconfig @@ -233,6 +233,5 @@ CONFIG_USB_GADGET_MANUFACTURER="Data Modul" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_IMX_WATCHDOG=y diff --git a/configs/imx8mn_beacon_2g_defconfig b/configs/imx8mn_beacon_2g_defconfig index fab3ab154b5..975fcc2481a 100644 --- a/configs/imx8mn_beacon_2g_defconfig +++ b/configs/imx8mn_beacon_2g_defconfig @@ -142,4 +142,3 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_SDP_LOADADDR=0x0 diff --git a/configs/imx8mn_beacon_defconfig b/configs/imx8mn_beacon_defconfig index f810d4be610..f4ecdc88f39 100644 --- a/configs/imx8mn_beacon_defconfig +++ b/configs/imx8mn_beacon_defconfig @@ -149,5 +149,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_SDP_LOADADDR=0x0 CONFIG_IMX_WATCHDOG=y diff --git a/configs/imx8mn_beacon_fspi_defconfig b/configs/imx8mn_beacon_fspi_defconfig index 8705d9bccc4..f5e57fb50bc 100644 --- a/configs/imx8mn_beacon_fspi_defconfig +++ b/configs/imx8mn_beacon_fspi_defconfig @@ -149,7 +149,6 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_SDP_LOADADDR=0x0 CONFIG_IMX_WATCHDOG=y CONFIG_FSPI_CONF_HEADER=y CONFIG_FSPI_CONF_FILE="fspi_header.bin" diff --git a/configs/imx8mp_beacon_defconfig b/configs/imx8mp_beacon_defconfig index 2570eb6a885..c6a3e35e73a 100644 --- a/configs/imx8mp_beacon_defconfig +++ b/configs/imx8mp_beacon_defconfig @@ -172,7 +172,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x1fc9 CONFIG_USB_GADGET_PRODUCT_NUM=0x0152 -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y diff --git a/configs/imx8mp_data_modul_edm_sbc_defconfig b/configs/imx8mp_data_modul_edm_sbc_defconfig index 2ff577f2d8a..d3b629caf5c 100644 --- a/configs/imx8mp_data_modul_edm_sbc_defconfig +++ b/configs/imx8mp_data_modul_edm_sbc_defconfig @@ -257,7 +257,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Data Modul" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y diff --git a/configs/imx8mp_dhcom_pdk2_defconfig b/configs/imx8mp_dhcom_pdk2_defconfig index 14ac499e587..24c87aae781 100644 --- a/configs/imx8mp_dhcom_pdk2_defconfig +++ b/configs/imx8mp_dhcom_pdk2_defconfig @@ -255,7 +255,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="DH electronics" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y diff --git a/configs/imx8mp_dhcom_pdk3_defconfig b/configs/imx8mp_dhcom_pdk3_defconfig index 3b26f315bba..3e89e0f8293 100644 --- a/configs/imx8mp_dhcom_pdk3_defconfig +++ b/configs/imx8mp_dhcom_pdk3_defconfig @@ -258,7 +258,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="DH electronics" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 -CONFIG_SDP_LOADADDR=0x0 CONFIG_USB_FUNCTION_ACM=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig index 8fe2798c3cc..21a397933e7 100644 --- a/configs/kontron_sl28_defconfig +++ b/configs/kontron_sl28_defconfig @@ -20,7 +20,6 @@ CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y CONFIG_SPL_STACK=0x18009ff0 CONFIG_SPL_SIZE_LIMIT=0x20000 -CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x0 CONFIG_SPL=y CONFIG_ENV_OFFSET_REDUND=0x3f0000 CONFIG_SPL_SPI_FLASH_SUPPORT=y @@ -130,7 +129,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_WDT=y CONFIG_WDT_SL28CPLD=y CONFIG_WDT_SP805=y -CONFIG_OF_LIBFDT_ASSUME_MASK=0x0 CONFIG_EFI_SET_TIME=y CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y diff --git a/configs/lion-rk3368_defconfig b/configs/lion-rk3368_defconfig index 7c55b3be0d2..9c29eb6fed3 100644 --- a/configs/lion-rk3368_defconfig +++ b/configs/lion-rk3368_defconfig @@ -10,7 +10,6 @@ CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rk3368-lion-haikou" CONFIG_SPL_TEXT_BASE=0x00000000 CONFIG_ROCKCHIP_RK3368=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_TPL_LIBCOMMON_SUPPORT=y CONFIG_TPL_LIBGENERIC_SUPPORT=y CONFIG_SPL_DRIVERS_MISC=y diff --git a/configs/roc-cc-rk3308_defconfig b/configs/roc-cc-rk3308_defconfig index 9a789b212f1..3f3c223fa1d 100644 --- a/configs/roc-cc-rk3308_defconfig +++ b/configs/roc-cc-rk3308_defconfig @@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000 CONFIG_DEFAULT_DEVICE_TREE="rk3308-roc-cc" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3308=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_ROC_RK3308_CC=y CONFIG_SPL_STACK_R_ADDR=0xc00000 diff --git a/configs/rock-pi-s-rk3308_defconfig b/configs/rock-pi-s-rk3308_defconfig index cc3274a98b3..8c13f7f9c3b 100644 --- a/configs/rock-pi-s-rk3308_defconfig +++ b/configs/rock-pi-s-rk3308_defconfig @@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000 CONFIG_DEFAULT_DEVICE_TREE="rk3308-rock-pi-s" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3308=y -CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_EVB_RK3308=y CONFIG_SPL_STACK_R_ADDR=0xc00000 diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index bf3ef0c4007..0e079d7bb4d 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -4,7 +4,6 @@ CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox64" CONFIG_DM_RESET=y CONFIG_PRE_CON_BUF_ADDR=0x100000 -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_SANDBOX64=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index ea2b2566aa1..f031b509105 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -4,7 +4,6 @@ CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_DM_RESET=y CONFIG_PRE_CON_BUF_ADDR=0xf0000 -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_DEBUG_UART=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 8aa295686dc..c20015db47b 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -3,7 +3,6 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_DM_RESET=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_DEBUG_UART=y diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 2c6aab6c859..f6e351961e9 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -10,7 +10,6 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_SANDBOX_SPL=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 8d50162b274..7e6ee936769 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -10,7 +10,6 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_SANDBOX_SPL=y diff --git a/configs/sandbox_vpl_defconfig b/configs/sandbox_vpl_defconfig index f3a0fd19a96..9ac800a93c0 100644 --- a/configs/sandbox_vpl_defconfig +++ b/configs/sandbox_vpl_defconfig @@ -15,7 +15,6 @@ CONFIG_TPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL=y -CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y CONFIG_SANDBOX_SPL=y diff --git a/configs/xilinx_versal_net_virt_defconfig b/configs/xilinx_versal_net_virt_defconfig index 97904bdec0a..54ba0b7c4f2 100644 --- a/configs/xilinx_versal_net_virt_defconfig +++ b/configs/xilinx_versal_net_virt_defconfig @@ -77,7 +77,6 @@ CONFIG_DM_MAILBOX=y CONFIG_ZYNQMP_IPI=y CONFIG_MISC=y CONFIG_I2C_EEPROM=y -CONFIG_SYS_I2C_EEPROM_ADDR=0x0 CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_IO_VOLTAGE=y CONFIG_MMC_UHS_SUPPORT=y diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index acab38fefee..26260841c59 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -11,7 +11,6 @@ CONFIG_DM_RESET=y CONFIG_SPL_STACK_R_ADDR=0x18000000 CONFIG_SPL_STACK=0xfffffffc CONFIG_SPL_SIZE_LIMIT=0x2a000 -CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x0 CONFIG_SPL=y CONFIG_ENV_OFFSET_REDUND=0x1E80000 CONFIG_SPL_SPI_FLASH_SUPPORT=y diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 6baaa6f0711..1abea3f10db 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -167,7 +167,7 @@ config SYS_IDE_MAXDEVICE config SYS_ATA_BASE_ADDR hex "Base address of IDE controller" - default 0 + default 0x0 help This is the address of the IDE controller, from which other addresses are calculated. Each bus is at a fixed offset from this address, diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index a3df9aa3d0f..837c6f1180d 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -56,7 +56,7 @@ config FASTBOOT_BUF_ADDR ROCKCHIP_RK3399 default 0x280000 if ROCKCHIP_RK3368 default 0x100000 if ARCH_ZYNQMP - default 0 if SANDBOX + default 0x0 if SANDBOX help The fastboot protocol requires a large memory buffer for downloads. Define this to the starting RAM address to use for diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 4c76fd7e415..4f42200f392 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -372,7 +372,7 @@ config SYS_MXC_I2C1_SPEED config SYS_MXC_I2C1_SLAVE hex "I2C1 Slave" - default 0 + default 0x0 help MXC I2C1 Slave endif @@ -387,7 +387,7 @@ config SYS_MXC_I2C2_SPEED config SYS_MXC_I2C2_SLAVE hex "I2C2 Slave" - default 0 + default 0x0 help MXC I2C2 Slave endif @@ -401,7 +401,7 @@ config SYS_MXC_I2C3_SPEED config SYS_MXC_I2C3_SLAVE hex "I2C3 Slave" - default 0 + default 0x0 help MXC I2C3 Slave endif @@ -415,7 +415,7 @@ config SYS_MXC_I2C4_SPEED config SYS_MXC_I2C4_SLAVE hex "I2C4 Slave" - default 0 + default 0x0 help MXC I2C4 Slave endif @@ -429,7 +429,7 @@ config SYS_MXC_I2C5_SPEED config SYS_MXC_I2C5_SLAVE hex "I2C5 Slave" - default 0 + default 0x0 help MXC I2C5 Slave endif @@ -443,7 +443,7 @@ config SYS_MXC_I2C6_SPEED config SYS_MXC_I2C6_SLAVE hex "I2C6 Slave" - default 0 + default 0x0 help MXC I2C6 Slave endif @@ -457,7 +457,7 @@ config SYS_MXC_I2C7_SPEED config SYS_MXC_I2C7_SLAVE hex "I2C7 Slave" - default 0 + default 0x0 help MXC I2C7 Slave endif @@ -471,7 +471,7 @@ config SYS_MXC_I2C8_SPEED config SYS_MXC_I2C8_SLAVE hex "I2C8 Slave" - default 0 + default 0x0 help MXC I2C8 Slave endif diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index b9f5c7a37ae..a6e3f62ecb0 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -555,7 +555,7 @@ config SPL_I2C_EEPROM config SYS_I2C_EEPROM_ADDR hex "Chip address of the EEPROM device" depends on ID_EEPROM || I2C_EEPROM || SPL_I2C_EEPROM || CMD_EEPROM || ENV_IS_IN_EEPROM - default 0 + default 0x0 if I2C_EEPROM diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index a1e089962a9..7ca42df6a7e 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -482,8 +482,8 @@ endchoice config DEBUG_UART_BASE hex "Base address of UART" depends on DEBUG_UART - default 0 if DEBUG_SBI_CONSOLE - default 0 if DEBUG_UART_SANDBOX + default 0x0 if DEBUG_SBI_CONSOLE + default 0x0 if DEBUG_UART_SANDBOX default 0xff000000 if DEBUG_UART_ZYNQ && ARCH_ZYNQMP default 0xe0000000 if DEBUG_UART_ZYNQ && ARCH_ZYNQ help @@ -1139,6 +1139,6 @@ config SYS_SDSR config SYS_SDMR hex "SDMR Value" depends on MPC8XX_CONS - default 0 + default 0x0 endif diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 1cfe6022842..4eccc5e3370 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -160,7 +160,7 @@ config USB_GADGET_VBUS_DRAW config SDP_LOADADDR hex "Default load address at SDP_WRITE and SDP_JUMP" - default 0 + default 0x0 # Selected by UDC drivers that support high-speed operation. config USB_GADGET_DUALSPEED diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e32ce13fb6b..fe43fbd7004 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -66,7 +66,7 @@ config VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it" default 0x1000000 if X86 default 0x800000 if !X86 && VIDEO_BOCHS - default 0 if !X86 && !VIDEO_BOCHS + default 0x0 if !X86 && !VIDEO_BOCHS help Generally, video drivers request the amount of memory they need for the frame buffer when they are bound, by setting the size field in @@ -1039,7 +1039,7 @@ config SPL_VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it at SPL" default 0x1000000 if X86 default 0x800000 if !X86 && VIDEO_BOCHS - default 0 if !X86 && !VIDEO_BOCHS + default 0x0 if !X86 && !VIDEO_BOCHS help Generally, video drivers request the amount of memory they need for the frame buffer when they are bound, by setting the size field in diff --git a/env/Kconfig b/env/Kconfig index 13e32104b4c..54203faa89e 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -571,7 +571,7 @@ config ENV_OFFSET default 0xE0000 if ARCH_ZYNQ default 0x1E00000 if ARCH_ZYNQMP default 0x7F40000 if ARCH_VERSAL || ARCH_VERSAL_NET - default 0 if ARC + default 0x0 if ARC default 0x140000 if ARCH_AT91 default 0x260000 if ARCH_OMAP2PLUS default 0x1080000 if MICROBLAZE && ENV_IS_IN_SPI_FLASH @@ -583,7 +583,7 @@ config ENV_OFFSET_REDUND depends on (ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \ ENV_IS_IN_SPI_FLASH) && SYS_REDUNDAND_ENVIRONMENT default 0x10C0000 if MICROBLAZE - default 0 + default 0x0 help Offset from the start of the device (or partition) of the redundant environment location. diff --git a/lib/Kconfig b/lib/Kconfig index 07e61de5b64..42e559ad0b5 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -862,7 +862,7 @@ config OF_LIBFDT config OF_LIBFDT_ASSUME_MASK hex "Mask of conditions to assume for libfdt" depends on OF_LIBFDT || FIT - default 0 + default 0x0 help Use this to change the assumptions made by libfdt about the device tree it is working with. A value of 0 means that no assumptions -- cgit v1.2.3 From cbb607d2d9be44a5ded7a652e8e7646925adc1e0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 30 Jul 2023 11:17:00 -0600 Subject: bootstd: Allow display of the x86 setup information Provide an option to dump this information if available. Move the funciion prototype to the common x86 header. Allow the command line to be left out since 'bootflow info' show this itself and it is not in the correct place in memory until the kernel is actually booted. Fix a badly aligned heading while we are here. Signed-off-by: Simon Glass --- arch/x86/include/asm/zimage.h | 10 -------- arch/x86/lib/zimage.c | 8 +++--- cmd/bootflow.c | 14 ++++++++-- doc/usage/cmd/bootflow.rst | 59 ++++++++++++++++++++++++++++++++++++++++++- include/bootflow.h | 2 +- include/bootm.h | 11 ++++++++ 6 files changed, 86 insertions(+), 18 deletions(-) (limited to 'cmd') diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h index 000b38ea899..655675b6661 100644 --- a/arch/x86/include/asm/zimage.h +++ b/arch/x86/include/asm/zimage.h @@ -62,14 +62,4 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size, int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, ulong initrd_addr, ulong initrd_size, ulong cmdline_force); -/** - * zimage_dump() - Dump the metadata of a zimage - * - * This shows all available information in a zimage that has been loaded. - * - * @base_ptr: Pointer to the boot parameters, typically at address - * DEFAULT_SETUP_BASE - */ -void zimage_dump(struct boot_params *base_ptr); - #endif diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 062e3d3e315..a41e1ccf8a6 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -692,7 +692,7 @@ static void show_loader(struct setup_header *hdr) printf("\n"); } -void zimage_dump(struct boot_params *base_ptr) +void zimage_dump(struct boot_params *base_ptr, bool show_cmdline) { struct setup_header *hdr; const char *version; @@ -703,7 +703,7 @@ void zimage_dump(struct boot_params *base_ptr) printf("E820: %d entries\n", base_ptr->e820_entries); if (base_ptr->e820_entries) { - printf("%18s %16s %s\n", "Addr", "Size", "Type"); + printf("%12s %10s %s\n", "Addr", "Size", "Type"); for (i = 0; i < base_ptr->e820_entries; i++) { struct e820_entry *entry = &base_ptr->e820_map[i]; @@ -749,7 +749,7 @@ void zimage_dump(struct boot_params *base_ptr) print_num("Ext loader ver", hdr->ext_loader_ver); print_num("Ext loader type", hdr->ext_loader_type); print_num("Command line ptr", hdr->cmd_line_ptr); - if (hdr->cmd_line_ptr) { + if (show_cmdline && hdr->cmd_line_ptr) { printf(" "); /* Use puts() to avoid limits from CONFIG_SYS_PBSIZE */ puts((char *)(ulong)hdr->cmd_line_ptr); @@ -787,7 +787,7 @@ static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc, printf("No zboot setup_base\n"); return CMD_RET_FAILURE; } - zimage_dump(base_ptr); + zimage_dump(base_ptr, true); return 0; } diff --git a/cmd/bootflow.c b/cmd/bootflow.c index c0aa4f84fe8..9562832ce43 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -303,11 +304,14 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, { struct bootstd_priv *std; struct bootflow *bflow; + bool x86_setup = false; bool dump = false; int ret; - if (argc > 1 && *argv[1] == '-') + if (argc > 1 && *argv[1] == '-') { dump = strchr(argv[1], 'd'); + x86_setup = strchr(argv[1], 's'); + } ret = bootstd_get_priv(&std); if (ret) @@ -319,6 +323,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, } bflow = std->cur_bootflow; + if (IS_ENABLED(CONFIG_X86) && x86_setup) { + zimage_dump(bflow->x86_setup, false); + + return 0; + } + printf("Name: %s\n", bflow->name); printf("Device: %s\n", bflow->dev->name); printf("Block dev: %s\n", bflow->blk ? bflow->blk->name : "(none)"); @@ -508,7 +518,7 @@ static char bootflow_help_text[] = "scan [-abeGl] [bdev] - scan for valid bootflows (-l list, -a all, -e errors, -b boot, -G no global)\n" "bootflow list [-e] - list scanned bootflows (-e errors)\n" "bootflow select [|] - select a bootflow\n" - "bootflow info [-d] - show info on current bootflow (-d dump bootflow)\n" + "bootflow info [-ds] - show info on current bootflow (-d dump bootflow)\n" "bootflow boot - boot current bootflow (or first available if none selected)\n" "bootflow menu [-t] - show a menu of available bootflows\n" "bootflow cmdline [set|get|clear|delete|auto] [] - update cmdline"; diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index a8af1f8f603..d53f8373eff 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -11,7 +11,7 @@ Synopis bootflow scan [-abelGH] [bootdev] bootflow list [-e] bootflow select [] - bootflow info [-d] + bootflow info [-ds] bootflow boot bootflow cmdline [set|get|clear|delete|auto] [] @@ -191,6 +191,8 @@ Error Use the `-d` flag to dump out the contents of the bootfile file. +The `-s` flag shows any x86 setup block, instead of the above. + bootflow boot ~~~~~~~~~~~~~ @@ -522,6 +524,61 @@ the cmdline is word-wrapped here and some parts of the command line are elided:: [ 0.000000] Command line: loglevel=7 ... usb-storage.quirks=13fe:6500:u earlycon=uart8250,mmio32,0xfe03e000,115200n8 [ 0.000000] x86/split lock detection: warning about user-space split_locks +This shows looking at x86 setup information:: + + => bootfl sel 0 + => bootfl i -s + Setup located at 77b56010: + + ACPI RSDP addr : 0 + E820: 2 entries + Addr Size Type + 0 1000 RAM + fffff000 1000 Reserved + Setup sectors : 1e + Root flags : 1 + Sys size : 63420 + RAM size : 0 + Video mode : ffff + Root dev : 0 + Boot flag : 0 + Jump : 66eb + Header : 53726448 + Kernel V2 + Version : 20d + Real mode switch : 0 + Start sys seg : 1000 + Kernel version : 38cc + @00003acc: + Type of loader : ff + unknown + Load flags : 1 + : loaded-high + Setup move size : 8000 + Code32 start : 100000 + Ramdisk image : 0 + Ramdisk size : 0 + Bootsect kludge : 0 + Heap end ptr : 5160 + Ext loader ver : 0 + Ext loader type : 0 + Command line ptr : 735000 + Initrd addr max : 7fffffff + Kernel alignment : 200000 + Relocatable kernel : 1 + Min alignment : 15 + : 200000 + Xload flags : 3 + : 64-bit-entry can-load-above-4gb + Cmdline size : 7ff + Hardware subarch : 0 + HW subarch data : 0 + Payload offset : 26e + Payload length : 612045 + Setup data : 0 + Pref address : 1000000 + Init size : 1383000 + Handover offset : 0 Return value diff --git a/include/bootflow.h b/include/bootflow.h index ff2bddb5151..fdcfeddc1a6 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -108,7 +108,7 @@ struct bootflow { ulong fdt_addr; int flags; char *cmdline; - char *x86_setup; + void *x86_setup; void *bootmeth_priv; }; diff --git a/include/bootm.h b/include/bootm.h index 6fe418e0027..92870ff1a20 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -152,4 +152,15 @@ int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size, const char *zimage_get_kernel_version(struct boot_params *params, void *kernel_base); +/** + * zimage_dump() - Dump the metadata of a zimage + * + * This shows all available information in a zimage that has been loaded. + * + * @base_ptr: Pointer to the boot parameters, typically at address + * DEFAULT_SETUP_BASE + * @show_cmdline: true to show the full command line + */ +void zimage_dump(struct boot_params *base_ptr, bool show_cmdline); + #endif -- cgit v1.2.3 From c279224ea6686a992b258b01e07fcadb7f0c7ecb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 10 Aug 2023 19:33:18 -0600 Subject: bootstd: Add a command to read all files for a bootflow Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until it is needed to boot. This saves time when scanning and avoids needing to allocate memory for something that may never be used. To permit reading of these files, add a new 'bootflow read' command. Signed-off-by: Simon Glass --- boot/bootflow.c | 16 ++++++++++ boot/bootmeth-uclass.c | 12 +++++++ boot/bootmeth_cros.c | 22 ++++++++++++- cmd/bootflow.c | 33 ++++++++++++++++++- doc/usage/cmd/bootflow.rst | 80 +++++++++++++++++++++++++++++++++++++++++++++- include/bootflow.h | 11 +++++++ include/bootmeth.h | 25 ++++++++++++++- 7 files changed, 195 insertions(+), 4 deletions(-) (limited to 'cmd') diff --git a/boot/bootflow.c b/boot/bootflow.c index daf862fac78..6ef62e1d189 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -445,6 +445,22 @@ void bootflow_remove(struct bootflow *bflow) free(bflow); } +#if CONFIG_IS_ENABLED(BOOTSTD_FULL) +int bootflow_read_all(struct bootflow *bflow) +{ + int ret; + + if (bflow->state != BOOTFLOWST_READY) + return log_msg_ret("rd", -EPROTO); + + ret = bootmeth_read_all(bflow->method, bflow); + if (ret) + return log_msg_ret("rd2", ret); + + return 0; +} +#endif /* BOOTSTD_FULL */ + int bootflow_boot(struct bootflow *bflow) { int ret; diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c index 175eb1de5e1..1d157d54dbd 100644 --- a/boot/bootmeth-uclass.c +++ b/boot/bootmeth-uclass.c @@ -61,6 +61,18 @@ int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow, return ops->set_bootflow(dev, bflow, buf, size); } +#if CONFIG_IS_ENABLED(BOOTSTD_FULL) +int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow) +{ + const struct bootmeth_ops *ops = bootmeth_get_ops(dev); + + if (!ops->read_all) + return -ENOSYS; + + return ops->read_all(dev, bflow); +} +#endif /* BOOTSTD_FULL */ + int bootmeth_boot(struct udevice *dev, struct bootflow *bflow) { const struct bootmeth_ops *ops = bootmeth_get_ops(dev); diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c index 06709dd9171..6c28feb34fe 100644 --- a/boot/bootmeth_cros.c +++ b/boot/bootmeth_cros.c @@ -395,13 +395,30 @@ static int cros_read_file(struct udevice *dev, struct bootflow *bflow, return -ENOSYS; } -static int cros_boot(struct udevice *dev, struct bootflow *bflow) +#if CONFIG_IS_ENABLED(BOOSTD_FULL) +static int cros_read_all(struct udevice *dev, struct bootflow *bflow) { int ret; + if (bflow->buf) + return log_msg_ret("ld", -EALREADY); ret = cros_read_kernel(bflow); if (ret) return log_msg_ret("rd", ret); + + return 0; +} +#endif /* BOOSTD_FULL */ + +static int cros_boot(struct udevice *dev, struct bootflow *bflow) +{ + int ret; + + if (!bflow->buf) { + ret = cros_read_kernel(bflow); + if (ret) + return log_msg_ret("rd", ret); + } #ifdef CONFIG_X86 zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0, map_to_sysmem(bflow->x86_setup), @@ -425,6 +442,9 @@ static struct bootmeth_ops cros_bootmeth_ops = { .read_bootflow = cros_read_bootflow, .read_file = cros_read_file, .boot = cros_boot, +#if CONFIG_IS_ENABLED(BOOSTD_FULL) + .read_all = cros_read_all, +#endif /* BOOSTD_FULL */ }; static const struct udevice_id cros_bootmeth_ids[] = { diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 9562832ce43..3c3abaf8a3b 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -379,6 +379,35 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_bootflow_read(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct bootstd_priv *std; + struct bootflow *bflow; + int ret; + + ret = bootstd_get_priv(&std); + if (ret) + return CMD_RET_FAILURE; + + /* + * Require a current bootflow. Users can use 'bootflow scan -b' to + * automatically scan and boot, if needed. + */ + if (!std->cur_bootflow) { + printf("No bootflow selected\n"); + return CMD_RET_FAILURE; + } + bflow = std->cur_bootflow; + ret = bootflow_read_all(bflow); + if (ret) { + printf("Failed: err=%dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + static int do_bootflow_boot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -519,7 +548,8 @@ static char bootflow_help_text[] = "bootflow list [-e] - list scanned bootflows (-e errors)\n" "bootflow select [|] - select a bootflow\n" "bootflow info [-ds] - show info on current bootflow (-d dump bootflow)\n" - "bootflow boot - boot current bootflow (or first available if none selected)\n" + "bootflow read - read all current-bootflow files\n" + "bootflow boot - boot current bootflow\n" "bootflow menu [-t] - show a menu of available bootflows\n" "bootflow cmdline [set|get|clear|delete|auto] [] - update cmdline"; #else @@ -533,6 +563,7 @@ U_BOOT_CMD_WITH_SUBCMDS(bootflow, "Boot flows", bootflow_help_text, U_BOOT_SUBCMD_MKENT(list, 2, 1, do_bootflow_list), U_BOOT_SUBCMD_MKENT(select, 2, 1, do_bootflow_select), U_BOOT_SUBCMD_MKENT(info, 2, 1, do_bootflow_info), + U_BOOT_SUBCMD_MKENT(read, 1, 1, do_bootflow_read), U_BOOT_SUBCMD_MKENT(boot, 1, 1, do_bootflow_boot), U_BOOT_SUBCMD_MKENT(menu, 2, 1, do_bootflow_menu), U_BOOT_SUBCMD_MKENT(cmdline, 4, 1, do_bootflow_cmdline), diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst index d53f8373eff..ead493d0aaf 100644 --- a/doc/usage/cmd/bootflow.rst +++ b/doc/usage/cmd/bootflow.rst @@ -12,6 +12,7 @@ Synopis bootflow list [-e] bootflow select [] bootflow info [-ds] + bootflow read bootflow boot bootflow cmdline [set|get|clear|delete|auto] [] @@ -194,10 +195,26 @@ Use the `-d` flag to dump out the contents of the bootfile file. The `-s` flag shows any x86 setup block, instead of the above. +bootflow read +~~~~~~~~~~~~~ + +This reads any files related to the bootflow. Some bootflows with large files +avoid doing this when the bootflow is scanned, since it uses a lot of memory +and takes extra time. The files are then automatically read when `bootflow boot` +is used. + +This command reads these files immediately. Typically this fills in the bootflow +`buf` property, which can be used to examine the bootflow. + +Note that reading the files does not result in any extra parsing, nor loading of +images in the files. This is purely used to read in the data ready for +booting, or examination. + + bootflow boot ~~~~~~~~~~~~~ -This boots the current bootflow. +This boots the current bootflow, reading any required files first. bootflow cmdline @@ -580,6 +597,67 @@ This shows looking at x86 setup information:: Init size : 1383000 Handover offset : 0 +This shows reading a bootflow to examine the kernel:: + + => bootfl i 0 + Name: + Device: emmc@1c,0.bootdev + Block dev: emmc@1c,0.blk + Method: cros + State: ready + Partition: 2 + Subdir: (none) + Filename: + Buffer: 0 + Size: 63ee00 (6548992 bytes) + OS: ChromeOS + Cmdline: console= loglevel=7 init=/sbin/init cros_secure oops=panic panic=-1 root=PARTUUID=35c775e7-3735-d745-93e5-d9e0238f7ed0/PARTNROFF=1 rootwait rw dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=0 dm="1 vroot none rw 1,0 3788800 verity payload=ROOT_DEV hashtree=HASH_DEV hashstart=3788800 alg=sha1 root_hexdigest=55052b629d3ac889f25a9583ea12cdcd3ea15ff8 salt=a2d4d9e574069f4fed5e3961b99054b7a4905414b60a25d89974a7334021165c" noinitrd vt.global_cursor_default=0 kern_guid=35c775e7-3735-d745-93e5-d9e0238f7ed0 add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapic disablevmx=off + X86 setup: 77b56010 + Logo: (none) + FDT: + Error: 0 + +Note that `Buffer` is 0 so it has not be read yet. Using `bootflow read`:: + + => bootfl read + => bootfl info + Name: + Device: emmc@1c,0.bootdev + Block dev: emmc@1c,0.blk + Method: cros + State: ready + Partition: 2 + Subdir: (none) + Filename: + Buffer: 77b7e400 + Size: 63ee00 (6548992 bytes) + OS: ChromeOS + Cmdline: console= loglevel=7 init=/sbin/init cros_secure oops=panic panic=-1 root=PARTUUID=35c775e7-3735-d745-93e5-d9e0238f7ed0/PARTNROFF=1 rootwait rw dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=0 dm="1 vroot none rw 1,0 3788800 verity payload=ROOT_DEV hashtree=HASH_DEV hashstart=3788800 alg=sha1 root_hexdigest=55052b629d3ac889f25a9583ea12cdcd3ea15ff8 salt=a2d4d9e574069f4fed5e3961b99054b7a4905414b60a25d89974a7334021165c" noinitrd vt.global_cursor_default=0 kern_guid=35c775e7-3735-d745-93e5-d9e0238f7ed0 add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapic disablevmx=off + X86 setup: 781b4400 + Logo: (none) + FDT: + Error: 0 + +Now the buffer can be accessed:: + + => md 77b7e400 + 77b7e400: 1186f6fc 40000002 b8fa0c75 00000018 .......@u....... + 77b7e410: c08ed88e a68dd08e 000001e8 000000e8 ................ + 77b7e420: ed815d00 00000021 62c280b8 89e80100 .]..!......b.... + 77b7e430: 22f7e8c4 c0850061 22ec850f eb890061 ..."a......"a... + 77b7e440: 0230868b 01480000 21d0f7c3 00fb81c3 ..0...H....!.... + 77b7e450: 7d010000 0000bb05 c3810100 00d4f000 ...}............ + 77b7e460: 8130858d 85890061 00618132 3095010f ..0.a...2.a....0 + 77b7e470: 0f006181 c883e020 e0220f20 e000bb8d .a.. ... ."..... + 77b7e480: c0310062 001800b9 8dabf300 62e000bb b.1............b + 77b7e490: 07878d00 89000010 00bb8d07 8d0062f0 .............b.. + 77b7e4a0: 00100787 0004b900 07890000 00100005 ................ + 77b7e4b0: 08c78300 8df37549 630000bb 0183b800 ....Iu.....c.... + 77b7e4c0: 00b90000 89000008 00000507 c7830020 ............ ... + 77b7e4d0: f3754908 e000838d 220f0062 0080b9d8 .Iu.....b..".... + 77b7e4e0: 320fc000 08e8ba0f c031300f b8d0000f ...2.....01..... + 77b7e4f0: 00000020 6ad8000f 00858d10 50000002 ......j.......P + Return value ------------ diff --git a/include/bootflow.h b/include/bootflow.h index fdcfeddc1a6..44d3741eaca 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -352,6 +352,17 @@ void bootflow_free(struct bootflow *bflow); */ int bootflow_boot(struct bootflow *bflow); +/** + * bootflow_read_all() - Read all bootflow files + * + * Some bootmeths delay reading of large files until booting is requested. This + * causes those files to be read. + * + * @bflow: Bootflow to read + * Return: result of trying to read + */ +int bootflow_read_all(struct bootflow *bflow); + /** * bootflow_run_boot() - Try to boot a bootflow * diff --git a/include/bootmeth.h b/include/bootmeth.h index 7cb7da33dea..d3d8d608cd7 100644 --- a/include/bootmeth.h +++ b/include/bootmeth.h @@ -119,7 +119,16 @@ struct bootmeth_ops { */ int (*read_file)(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep); - +#if CONFIG_IS_ENABLED(BOOTSTD_FULL) + /** + * readall() - read all files for a bootflow + * + * @dev: Bootmethod device to boot + * @bflow: Bootflow to read + * Return: 0 if OK, -EIO on I/O error, other -ve on other error + */ + int (*read_all)(struct udevice *dev, struct bootflow *bflow); +#endif /* BOOTSTD_FULL */ /** * boot() - boot a bootflow * @@ -223,6 +232,20 @@ int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow, int bootmeth_read_file(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep); +/** + * bootmeth_read_all() - read all bootflow files + * + * Some bootmeths delay reading of large files until booting is requested. This + * causes those files to be read. + * + * @dev: Bootmethod device to use + * @bflow: Bootflow to read + * Return: does not return on success, since it should boot the + * Operating Systemn. Returns -EFAULT if that fails, other -ve on + * other error + */ +int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow); + /** * bootmeth_boot() - boot a bootflow * -- cgit v1.2.3 From eed99ce360a3e9d26092723ea4b0ffa4e910137e Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Mon, 31 Jul 2023 16:33:23 +0800 Subject: cmd: pxe: Update the command help Currently the "help" displays pxe command help text like this: => help ... printenv - print environment variables pxe - commands to get and boot from pxe files To use IPv6 add -ipv6 parameter qfw - QEMU firmware interface ... This does not read clearly. Remove the IPv6 stuff as it is in the detailed help text so that it fits just a single line. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- cmd/pxe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/pxe.c b/cmd/pxe.c index 677142520bb..7bfb1b9b280 100644 --- a/cmd/pxe.c +++ b/cmd/pxe.c @@ -333,8 +333,7 @@ static int do_pxe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } U_BOOT_CMD(pxe, 4, 1, do_pxe, - "commands to get and boot from pxe files\n" - "To use IPv6 add -ipv6 parameter", + "get and boot from pxe files", "get [" USE_IP6_CMD_PARAM "] - try to retrieve a pxe file using tftp\n" "pxe boot [pxefile_addr_r] [-ipv6] - boot from the pxe file at pxefile_addr_r\n" ); -- cgit v1.2.3 From 040b04685ea4c47a5148c2fcc2ff6dfdd83bc714 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Aug 2023 16:40:25 -0600 Subject: expo: Split out cedit into its own header Before adding more functions to this interface, create a new header for the configuration editor. Fix up the expo header guard while we are here. Signed-off-by: Simon Glass --- boot/cedit.c | 1 + cmd/cedit.c | 1 + include/cedit.h | 33 +++++++++++++++++++++++++++++++++ include/expo.h | 27 +++------------------------ 4 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 include/cedit.h (limited to 'cmd') diff --git a/boot/cedit.c b/boot/cedit.c index ee24658917b..2d16086bad6 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/cmd/cedit.c b/cmd/cedit.c index 0cae304c4ad..5f0e84403f5 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/include/cedit.h b/include/cedit.h new file mode 100644 index 00000000000..21de12dfe7a --- /dev/null +++ b/include/cedit.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2023 Google LLC + * Written by Simon Glass + */ + +#ifndef __CEDIT_H +#define __CEDIT_H + +struct expo; +struct video_priv; + +/** + * cedit_arange() - Arrange objects in a configuration-editor scene + * + * @exp: Expo to update + * @vid_priv: Private info of the video device + * @scene_id: scene ID to arrange + * Returns: 0 if OK, -ve on error + */ +int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id); + +/** + * cedit_run() - Run a configuration editor + * + * This accepts input until the user quits with Escape + * + * @exp: Expo to use + * Returns: 0 if OK, -ve on error + */ +int cedit_run(struct expo *exp); + +#endif /* __CEDIT_H */ diff --git a/include/expo.h b/include/expo.h index 0b1d944a169..da151074d20 100644 --- a/include/expo.h +++ b/include/expo.h @@ -4,14 +4,13 @@ * Written by Simon Glass */ -#ifndef __SCENE_H -#define __SCENE_H +#ifndef __EXPO_H +#define __EXPO_H #include #include struct udevice; -struct video_priv; /** * enum expoact_type - types of actions reported by the expo @@ -676,24 +675,4 @@ int expo_apply_theme(struct expo *exp, ofnode node); */ int expo_build(ofnode root, struct expo **expp); -/** - * cedit_arange() - Arrange objects in a configuration-editor scene - * - * @exp: Expo to update - * @vid_priv: Private info of the video device - * @scene_id: scene ID to arrange - * Returns: 0 if OK, -ve on error - */ -int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id); - -/** - * cedit_run() - Run a configuration editor - * - * This accepts input until the user quits with Escape - * - * @exp: Expo to use - * Returns: 0 if OK, -ve on error - */ -int cedit_run(struct expo *exp); - -#endif /*__SCENE_H */ +#endif /*__EXPO_H */ -- cgit v1.2.3 From 2045ca5c1f51d054579d0886184b6f245b8a134e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Aug 2023 16:40:30 -0600 Subject: expo: Move cedit theme under bootstd This is related to standard boot, so put it under the same node. This may simplify schema upstreaming later. Mention themes in the documentation while we are here. Signed-off-by: Simon Glass --- arch/sandbox/dts/sandbox.dtsi | 12 ++++++------ arch/sandbox/dts/test.dts | 12 ++++++------ cmd/cedit.c | 2 +- doc/develop/cedit.rst | 7 +++++++ 4 files changed, 20 insertions(+), 13 deletions(-) (limited to 'cmd') diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 8aaf911a41a..ff7e5584c55 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -16,12 +16,6 @@ stdout-path = "/serial"; }; - cedit-theme { - font-size = <30>; - menu-inset = <3>; - menuitem-gap-y = <1>; - }; - alarm_wdt: alarm-wdt { compatible = "sandbox,alarm-wdt"; timeout-sec = <5>; @@ -36,6 +30,12 @@ bootstd { compatible = "u-boot,boot-std"; filename-prefixes = "./"; + + cedit-theme { + font-size = <30>; + menu-inset = <3>; + menuitem-gap-y = <1>; + }; }; buttons { diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index f351d5cb84b..084cb88a232 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -100,6 +100,12 @@ menuitem-gap-y = <1>; }; + cedit-theme { + font-size = <30>; + menu-inset = <3>; + menuitem-gap-y = <1>; + }; + /* * This is used for the VBE OS-request tests. A FAT filesystem * created in a partition with the VBE information appearing @@ -144,12 +150,6 @@ cedit: cedit { }; - cedit-theme { - font-size = <30>; - menu-inset = <3>; - menuitem-gap-y = <1>; - }; - fuzzing-engine { compatible = "sandbox,fuzzing-engine"; }; diff --git a/cmd/cedit.c b/cmd/cedit.c index 5f0e84403f5..e98121b067b 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -65,7 +65,7 @@ static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; } - node = ofnode_path("/cedit-theme"); + node = ofnode_path("/bootstd/cedit-theme"); if (ofnode_valid(node)) { ret = expo_apply_theme(cur_exp, node); if (ret) diff --git a/doc/develop/cedit.rst b/doc/develop/cedit.rst index 48262ee535e..8f0a554ae91 100644 --- a/doc/develop/cedit.rst +++ b/doc/develop/cedit.rst @@ -145,3 +145,10 @@ Multiple scenes Expo supports multiple scenes but has no pre-determined way of moving between them. You could use selection of a menu item as a signal to change the scene, but this is not currently implemented in the cedit code (see `cedit_run()`). + + +Themes +------ + +The configuration editor uses simple expo themes. The theme is read from +`/bootstd/cedit-theme` in the devicetree. -- cgit v1.2.3 From 2dee81fe5f4a6427ba48fe17ff017930ddf3b4e4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Aug 2023 16:40:33 -0600 Subject: expo: cedit: Support writing settings to a file Support writing settings from an expo into a file in FDT format. It consists of a single node with a two properties for each sceneitem, one with tag ID chosen by the user and another for its text value. Signed-off-by: Simon Glass --- boot/cedit.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++ cmd/cedit.c | 51 ++++++++++++++++-- doc/usage/cmd/cedit.rst | 19 +++++++ include/cedit.h | 22 ++++++++ test/boot/cedit.c | 45 ++++++++++++++++ 5 files changed, 270 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/boot/cedit.c b/boot/cedit.c index 6c10b211454..4dd79a2263d 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -9,6 +9,7 @@ #define LOG_CATEGORY LOGC_EXPO #include +#include #include #include #include @@ -18,6 +19,15 @@ #include #include "scene_internal.h" +/** + * struct cedit_iter_priv - private data for cedit operations + * + * @buf: Buffer to use when writing settings to the devicetree + */ +struct cedit_iter_priv { + struct abuf *buf; +}; + int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) { struct scene_obj_txt *txt; @@ -182,3 +192,129 @@ int cedit_run(struct expo *exp) return 0; } + +static int check_space(int ret, struct abuf *buf) +{ + if (ret == -FDT_ERR_NOSPACE) { + if (!abuf_realloc_inc(buf, CEDIT_SIZE_INC)) + return log_msg_ret("spc", -ENOMEM); + ret = fdt_resize(abuf_data(buf), abuf_data(buf), + abuf_size(buf)); + if (ret) + return log_msg_ret("res", -EFAULT); + } + + return 0; +} + +static int h_write_settings(struct scene_obj *obj, void *vpriv) +{ + struct cedit_iter_priv *priv = vpriv; + struct abuf *buf = priv->buf; + + switch (obj->type) { + case SCENEOBJT_NONE: + case SCENEOBJT_IMAGE: + case SCENEOBJT_TEXT: + break; + case SCENEOBJT_MENU: { + const struct scene_obj_menu *menu; + const struct scene_obj_txt *txt; + struct scene *scn = obj->scene; + const struct scene_menitem *mi; + const char *str; + char name[80]; + int ret, i; + + menu = (struct scene_obj_menu *)obj; + ret = -EAGAIN; + for (i = 0; ret && i < 2; i++) { + ret = fdt_property_u32(abuf_data(buf), obj->name, + menu->cur_item_id); + if (!i) { + ret = check_space(ret, buf); + if (ret) + return log_msg_ret("res", -ENOMEM); + } + } + /* this should not happen */ + if (ret) + return log_msg_ret("wrt", -EFAULT); + + mi = scene_menuitem_find(menu, menu->cur_item_id); + if (!mi) + return log_msg_ret("mi", -ENOENT); + + txt = scene_obj_find(scn, mi->label_id, SCENEOBJT_TEXT); + if (!txt) + return log_msg_ret("txt", -ENOENT); + + str = expo_get_str(scn->expo, txt->str_id); + if (!str) + return log_msg_ret("str", -ENOENT); + + snprintf(name, sizeof(name), "%s-str", obj->name); + ret = -EAGAIN; + for (i = 0; ret && i < 2; i++) { + ret = fdt_property_string(abuf_data(buf), name, str); + if (!i) { + ret = check_space(ret, buf); + if (ret) + return log_msg_ret("rs2", -ENOMEM); + } + } + + /* this should not happen */ + if (ret) + return log_msg_ret("wr2", -EFAULT); + + break; + } + } + + return 0; +} + +int cedit_write_settings(struct expo *exp, struct abuf *buf) +{ + struct cedit_iter_priv priv; + void *fdt; + int ret; + + abuf_init(buf); + if (!abuf_realloc(buf, CEDIT_SIZE_INC)) + return log_msg_ret("buf", -ENOMEM); + + fdt = abuf_data(buf); + ret = fdt_create(fdt, abuf_size(buf)); + if (!ret) + ret = fdt_finish_reservemap(fdt); + if (!ret) + ret = fdt_begin_node(fdt, ""); + if (!ret) + ret = fdt_begin_node(fdt, CEDIT_NODE_NAME); + if (ret) { + log_debug("Failed to start FDT (err=%d)\n", ret); + return log_msg_ret("sta", -EINVAL); + } + + /* write out the items */ + priv.buf = buf; + ret = expo_iter_scene_objs(exp, h_write_settings, &priv); + if (ret) { + log_debug("Failed to write settings (err=%d)\n", ret); + return log_msg_ret("set", ret); + } + + ret = fdt_end_node(fdt); + if (!ret) + ret = fdt_end_node(fdt); + if (!ret) + ret = fdt_finish(fdt); + if (ret) { + log_debug("Failed to finish FDT (err=%d)\n", ret); + return log_msg_ret("fin", -EINVAL); + } + + return 0; +} diff --git a/cmd/cedit.c b/cmd/cedit.c index e98121b067b..18cc8ba191b 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -7,15 +7,28 @@ */ #include +#include #include #include #include #include +#include +#include #include #include struct expo *cur_exp; +static int check_cur_expo(void) +{ + if (!cur_exp) { + printf("No expo loaded\n"); + return -ENOENT; + } + + return 0; +} + static int do_cedit_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -54,16 +67,46 @@ static int do_cedit_load(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_cedit_write_fdt(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + const char *fname; + struct abuf buf; + loff_t bytes; + int ret; + + if (argc < 4) + return CMD_RET_USAGE; + fname = argv[3]; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + ret = cedit_write_settings(cur_exp, &buf); + if (ret) { + printf("Failed to write settings: %dE\n", ret); + return CMD_RET_FAILURE; + } + + if (fs_set_blk_dev(argv[1], argv[2], FS_TYPE_ANY)) + return CMD_RET_FAILURE; + + ret = fs_write(fname, map_to_sysmem(abuf_data(&buf)), 0, + abuf_size(&buf), &bytes); + if (ret) + return CMD_RET_FAILURE; + + return 0; +} + static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { ofnode node; int ret; - if (!cur_exp) { - printf("No expo loaded\n"); + if (check_cur_expo()) return CMD_RET_FAILURE; - } node = ofnode_path("/bootstd/cedit-theme"); if (ofnode_valid(node)) { @@ -85,10 +128,12 @@ static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, #ifdef CONFIG_SYS_LONGHELP static char cedit_help_text[] = "load - load config editor\n" + "cedit write_fdt - write settings\n" "cedit run - run config editor"; #endif /* CONFIG_SYS_LONGHELP */ U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text, U_BOOT_SUBCMD_MKENT(load, 5, 1, do_cedit_load), + U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt), U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run), ); diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index d34a220797e..0581594831f 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -10,6 +10,7 @@ Synopis cedit load cedit run + cedit write_fdt Description ----------- @@ -38,6 +39,12 @@ Runs the default configuration-editor event loop. This is very simple, just accepting character input and moving through the objects under user control. The implementation is at `cedit_run()`. +cedit write_fdt +~~~~~~~~~~~~~~~ + +Writes the current user settings to a devicetree file. For each menu item the +selected ID and its text string are written. + Example ------- @@ -46,3 +53,15 @@ Example => cedit load hostfs - fred.dtb => cedit run + => cedit write_fdt hostfs - settings.dtb + +That results in:: + + / { + cedit-values { + cpu-speed = <0x00000006>; + cpu-speed-str = "2 GHz"; + power-loss = <0x0000000a>; + power-loss-str = "Always Off"; + }; + } diff --git a/include/cedit.h b/include/cedit.h index 851d8e83564..6086e302006 100644 --- a/include/cedit.h +++ b/include/cedit.h @@ -7,10 +7,21 @@ #ifndef __CEDIT_H #define __CEDIT_H +struct abuf; struct expo; struct scene; struct video_priv; +enum { + /* size increment for writing FDT */ + CEDIT_SIZE_INC = 1024, +}; + +/* Name of the cedit node in the devicetree */ +#define CEDIT_NODE_NAME "cedit-values" + +extern struct expo *cur_exp; + /** * cedit_arange() - Arrange objects in a configuration-editor scene * @@ -45,4 +56,15 @@ int cedit_run(struct expo *exp); int cedit_prepare(struct expo *exp, struct video_priv **vid_privp, struct scene **scnp); +/** + * cedit_write_settings() - Write settings in FDT format + * + * Sets up an FDT with the settings + * + * @exp: Expo to write settings from + * @buf: Returns abuf containing the settings FDT (inited by this function) + * Return: 0 if OK, -ve on error + */ +int cedit_write_settings(struct expo *exp, struct abuf *buf); + #endif /* __CEDIT_H */ diff --git a/test/boot/cedit.c b/test/boot/cedit.c index f3411f734fa..1dd78c64158 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include "bootstd_common.h" #include @@ -51,3 +53,46 @@ static int cedit_base(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(cedit_base, 0); + +/* Check the cedit write_fdt commands */ +static int cedit_fdt(struct unit_test_state *uts) +{ + struct video_priv *vid_priv; + extern struct expo *cur_exp; + ulong addr = 0x1000; + struct ofprop prop; + struct scene *scn; + oftree tree; + ofnode node; + void *fdt; + int i; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0)); + ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr)); + ut_assert_nextlinen("1024 bytes read"); + + fdt = map_sysmem(addr, 1024); + tree = oftree_from_fdt(fdt); + node = ofnode_find_subnode(oftree_root(tree), CEDIT_NODE_NAME); + + ut_asserteq(ID_CPU_SPEED_1, + ofnode_read_u32_default(node, "cpu-speed", 0)); + ut_asserteq_str("2 GHz", ofnode_read_string(node, "cpu-speed-str")); + ut_assert(ofnode_valid(node)); + + /* There should only be 4 properties */ + for (i = 0, ofnode_first_property(node, &prop); ofprop_valid(&prop); + i++, ofnode_next_property(&prop)) + ; + ut_asserteq(4, i); + + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(cedit_fdt, 0); -- cgit v1.2.3 From 472317cb12e534f56b631365987934960dfb0a3f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Aug 2023 16:40:34 -0600 Subject: expo: cedit: Support reading settings from a file Add a command to read cedit settings from a devicetree file. Signed-off-by: Simon Glass --- boot/cedit.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ cmd/cedit.c | 39 +++++++++++++++++++++++++++++++++++++ doc/usage/cmd/cedit.rst | 8 ++++++++ include/cedit.h | 13 +++++++++++++ test/boot/cedit.c | 22 ++++++++++++++++++--- 5 files changed, 131 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/boot/cedit.c b/boot/cedit.c index 4dd79a2263d..6a74a380989 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -23,9 +23,11 @@ * struct cedit_iter_priv - private data for cedit operations * * @buf: Buffer to use when writing settings to the devicetree + * @node: Node to read from when reading settings from devicetree */ struct cedit_iter_priv { struct abuf *buf; + ofnode node; }; int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) @@ -318,3 +320,53 @@ int cedit_write_settings(struct expo *exp, struct abuf *buf) return 0; } + +static int h_read_settings(struct scene_obj *obj, void *vpriv) +{ + struct cedit_iter_priv *priv = vpriv; + ofnode node = priv->node; + + switch (obj->type) { + case SCENEOBJT_NONE: + case SCENEOBJT_IMAGE: + case SCENEOBJT_TEXT: + break; + case SCENEOBJT_MENU: { + struct scene_obj_menu *menu; + uint val; + + if (ofnode_read_u32(node, obj->name, &val)) + return log_msg_ret("rd", -ENOENT); + menu = (struct scene_obj_menu *)obj; + menu->cur_item_id = val; + + break; + } + } + + return 0; +} + +int cedit_read_settings(struct expo *exp, oftree tree) +{ + struct cedit_iter_priv priv; + ofnode root, node; + int ret; + + root = oftree_root(tree); + if (!ofnode_valid(root)) + return log_msg_ret("roo", -ENOENT); + node = ofnode_find_subnode(root, CEDIT_NODE_NAME); + if (!ofnode_valid(node)) + return log_msg_ret("pat", -ENOENT); + + /* read in the items */ + priv.node = node; + ret = expo_iter_scene_objs(exp, h_read_settings, &priv); + if (ret) { + log_debug("Failed to read settings (err=%d)\n", ret); + return log_msg_ret("set", ret); + } + + return 0; +} diff --git a/cmd/cedit.c b/cmd/cedit.c index 18cc8ba191b..a155e080b1f 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -99,6 +99,43 @@ static int do_cedit_write_fdt(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_cedit_read_fdt(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + const char *fname; + void *buf; + oftree tree; + ulong size; + int ret; + + if (argc < 4) + return CMD_RET_USAGE; + fname = argv[3]; + + ret = fs_load_alloc(argv[1], argv[2], argv[3], SZ_1M, 0, &buf, &size); + if (ret) { + printf("File not found\n"); + return CMD_RET_FAILURE; + } + + tree = oftree_from_fdt(buf); + if (!oftree_valid(tree)) { + free(buf); + printf("Cannot create oftree\n"); + return CMD_RET_FAILURE; + } + + ret = cedit_read_settings(cur_exp, tree); + oftree_dispose(tree); + free(buf); + if (ret) { + printf("Failed to read settings: %dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -128,12 +165,14 @@ static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, #ifdef CONFIG_SYS_LONGHELP static char cedit_help_text[] = "load - load config editor\n" + "cedit read_fdt - read settings\n" "cedit write_fdt - write settings\n" "cedit run - run config editor"; #endif /* CONFIG_SYS_LONGHELP */ U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text, U_BOOT_SUBCMD_MKENT(load, 5, 1, do_cedit_load), + U_BOOT_SUBCMD_MKENT(read_fdt, 5, 1, do_cedit_read_fdt), U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt), U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run), ); diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index 0581594831f..0a9f620b59b 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -11,6 +11,7 @@ Synopis cedit load cedit run cedit write_fdt + cedit read_fdt Description ----------- @@ -45,6 +46,11 @@ cedit write_fdt Writes the current user settings to a devicetree file. For each menu item the selected ID and its text string are written. +cedit read_fdt +~~~~~~~~~~~~~~ + +Reads the user settings from a devicetree file and updates the cedit with those +settings. Example ------- @@ -65,3 +71,5 @@ That results in:: power-loss-str = "Always Off"; }; } + + => cedit read_fdt hostfs - settings.dtb diff --git a/include/cedit.h b/include/cedit.h index 6086e302006..bb6e87d4af7 100644 --- a/include/cedit.h +++ b/include/cedit.h @@ -7,6 +7,8 @@ #ifndef __CEDIT_H #define __CEDIT_H +#include + struct abuf; struct expo; struct scene; @@ -67,4 +69,15 @@ int cedit_prepare(struct expo *exp, struct video_priv **vid_privp, */ int cedit_write_settings(struct expo *exp, struct abuf *buf); +/** + * cedit_read_settings() - Read settings in FDT format + * + * Read an FDT with the settings + * + * @exp: Expo to read settings into + * @tree: Tree to read from + * Return: 0 if OK, -ve on error + */ +int cedit_read_settings(struct expo *exp, oftree tree); + #endif /* __CEDIT_H */ diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 1dd78c64158..659c47ed35f 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -54,11 +54,12 @@ static int cedit_base(struct unit_test_state *uts) } BOOTSTD_TEST(cedit_base, 0); -/* Check the cedit write_fdt commands */ +/* Check the cedit write_fdt and read_fdt commands */ static int cedit_fdt(struct unit_test_state *uts) { struct video_priv *vid_priv; extern struct expo *cur_exp; + struct scene_obj_menu *menu; ulong addr = 0x1000; struct ofprop prop; struct scene *scn; @@ -72,6 +73,11 @@ static int cedit_fdt(struct unit_test_state *uts) ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + /* get a menu to fiddle with */ + menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU); + ut_assertnonnull(menu); + menu->cur_item_id = ID_CPU_SPEED_2; + ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0)); ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr)); ut_assert_nextlinen("1024 bytes read"); @@ -80,9 +86,9 @@ static int cedit_fdt(struct unit_test_state *uts) tree = oftree_from_fdt(fdt); node = ofnode_find_subnode(oftree_root(tree), CEDIT_NODE_NAME); - ut_asserteq(ID_CPU_SPEED_1, + ut_asserteq(ID_CPU_SPEED_2, ofnode_read_u32_default(node, "cpu-speed", 0)); - ut_asserteq_str("2 GHz", ofnode_read_string(node, "cpu-speed-str")); + ut_asserteq_str("2.5 GHz", ofnode_read_string(node, "cpu-speed-str")); ut_assert(ofnode_valid(node)); /* There should only be 4 properties */ @@ -93,6 +99,16 @@ static int cedit_fdt(struct unit_test_state *uts) ut_assert_console_end(); + /* reset the expo */ + menu->cur_item_id = ID_CPU_SPEED_1; + + /* load in the settings and make sure they update */ + ut_assertok(run_command("cedit read_fdt hostfs - settings.dtb", 0)); + ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id); + + ut_assertnonnull(menu); + ut_assert_console_end(); + return 0; } BOOTSTD_TEST(cedit_fdt, 0); -- cgit v1.2.3 From fc9c0e0771cad76b24f73bb64c105b6ea39721ca Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Aug 2023 16:40:35 -0600 Subject: expo: cedit: Support writing settings to environment vars Add a command to write cedit settings to environment variables so that they can be stored with 'saveenv'. Signed-off-by: Simon Glass --- boot/cedit.c | 97 ++++++++++++++++++++++++++++++++++++++++++------- cmd/cedit.c | 22 +++++++++++ doc/usage/cmd/cedit.rst | 25 +++++++++++++ include/cedit.h | 9 +++++ test/boot/cedit.c | 33 +++++++++++++++++ 5 files changed, 172 insertions(+), 14 deletions(-) (limited to 'cmd') diff --git a/boot/cedit.c b/boot/cedit.c index 6a74a380989..9399c01cda9 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -24,10 +25,12 @@ * * @buf: Buffer to use when writing settings to the devicetree * @node: Node to read from when reading settings from devicetree + * @verbose: true to show writing to environment variables */ struct cedit_iter_priv { struct abuf *buf; ofnode node; + bool verbose; }; int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) @@ -209,6 +212,30 @@ static int check_space(int ret, struct abuf *buf) return 0; } +static int get_cur_menuitem_text(const struct scene_obj_menu *menu, + const char **strp) +{ + struct scene *scn = menu->obj.scene; + const struct scene_menitem *mi; + const struct scene_obj_txt *txt; + const char *str; + + mi = scene_menuitem_find(menu, menu->cur_item_id); + if (!mi) + return log_msg_ret("mi", -ENOENT); + + txt = scene_obj_find(scn, mi->label_id, SCENEOBJT_TEXT); + if (!txt) + return log_msg_ret("txt", -ENOENT); + + str = expo_get_str(scn->expo, txt->str_id); + if (!str) + return log_msg_ret("str", -ENOENT); + *strp = str; + + return 0; +} + static int h_write_settings(struct scene_obj *obj, void *vpriv) { struct cedit_iter_priv *priv = vpriv; @@ -221,9 +248,6 @@ static int h_write_settings(struct scene_obj *obj, void *vpriv) break; case SCENEOBJT_MENU: { const struct scene_obj_menu *menu; - const struct scene_obj_txt *txt; - struct scene *scn = obj->scene; - const struct scene_menitem *mi; const char *str; char name[80]; int ret, i; @@ -243,17 +267,9 @@ static int h_write_settings(struct scene_obj *obj, void *vpriv) if (ret) return log_msg_ret("wrt", -EFAULT); - mi = scene_menuitem_find(menu, menu->cur_item_id); - if (!mi) - return log_msg_ret("mi", -ENOENT); - - txt = scene_obj_find(scn, mi->label_id, SCENEOBJT_TEXT); - if (!txt) - return log_msg_ret("txt", -ENOENT); - - str = expo_get_str(scn->expo, txt->str_id); - if (!str) - return log_msg_ret("str", -ENOENT); + ret = get_cur_menuitem_text(menu, &str); + if (ret) + return log_msg_ret("mis", ret); snprintf(name, sizeof(name), "%s-str", obj->name); ret = -EAGAIN; @@ -370,3 +386,56 @@ int cedit_read_settings(struct expo *exp, oftree tree) return 0; } + +static int h_write_settings_env(struct scene_obj *obj, void *vpriv) +{ + const struct scene_obj_menu *menu; + struct cedit_iter_priv *priv = vpriv; + char name[80], var[60]; + const char *str; + int val, ret; + + if (obj->type != SCENEOBJT_MENU) + return 0; + + menu = (struct scene_obj_menu *)obj; + val = menu->cur_item_id; + snprintf(var, sizeof(var), "c.%s", obj->name); + + if (priv->verbose) + printf("%s=%d\n", var, val); + + ret = env_set_ulong(var, val); + if (ret) + return log_msg_ret("set", ret); + + ret = get_cur_menuitem_text(menu, &str); + if (ret) + return log_msg_ret("mis", ret); + + snprintf(name, sizeof(name), "c.%s-str", obj->name); + if (priv->verbose) + printf("%s=%s\n", name, str); + + ret = env_set(name, str); + if (ret) + return log_msg_ret("st2", ret); + + return 0; +} + +int cedit_write_settings_env(struct expo *exp, bool verbose) +{ + struct cedit_iter_priv priv; + int ret; + + /* write out the items */ + priv.verbose = verbose; + ret = expo_iter_scene_objs(exp, h_write_settings_env, &priv); + if (ret) { + log_debug("Failed to write settings to env (err=%d)\n", ret); + return log_msg_ret("set", ret); + } + + return 0; +} diff --git a/cmd/cedit.c b/cmd/cedit.c index a155e080b1f..85629f7b83c 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -136,6 +136,26 @@ static int do_cedit_read_fdt(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_cedit_write_env(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + bool verbose; + int ret; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + verbose = argc > 1 && !strcmp(argv[1], "-v"); + + ret = cedit_write_settings_env(cur_exp, verbose); + if (ret) { + printf("Failed to write settings to environment: %dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -167,6 +187,7 @@ static char cedit_help_text[] = "load - load config editor\n" "cedit read_fdt - read settings\n" "cedit write_fdt - write settings\n" + "cedit write_env [-v] - write settings to env vars\n" "cedit run - run config editor"; #endif /* CONFIG_SYS_LONGHELP */ @@ -174,5 +195,6 @@ U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text, U_BOOT_SUBCMD_MKENT(load, 5, 1, do_cedit_load), U_BOOT_SUBCMD_MKENT(read_fdt, 5, 1, do_cedit_read_fdt), U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt), + U_BOOT_SUBCMD_MKENT(write_env, 2, 1, do_cedit_write_env), U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run), ); diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index 0a9f620b59b..426470a82ac 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -12,6 +12,7 @@ Synopis cedit run cedit write_fdt cedit read_fdt + cedit write_env [-v] Description ----------- @@ -52,6 +53,19 @@ cedit read_fdt Reads the user settings from a devicetree file and updates the cedit with those settings. +cedit write_env +~~~~~~~~~~~~~~~ + +Writes the settings to environment variables. For each menu item the selected +ID and its text string are written, similar to: + + setenv c. + setenv c.-str + +The `-v` flag enables verbose mode, where each variable is printed before it is +set. + + Example ------- @@ -73,3 +87,14 @@ That results in:: } => cedit read_fdt hostfs - settings.dtb + +This shows settings being stored in the environment:: + + => cedit write_env -v + => print + ... + c.cpu-speed=6 + c.cpu-speed-str=2 GHz + c.power-loss=10 + c.power-loss-str=Always Off + ... diff --git a/include/cedit.h b/include/cedit.h index bb6e87d4af7..f261207e209 100644 --- a/include/cedit.h +++ b/include/cedit.h @@ -80,4 +80,13 @@ int cedit_write_settings(struct expo *exp, struct abuf *buf); */ int cedit_read_settings(struct expo *exp, oftree tree); +/** + * cedit_write_settings_env() - Write settings to envrionment variables + * + * @exp: Expo to write settings from + * @verbose: true to print each var as it is set + * Return: 0 if OK, -ve on error + */ +int cedit_write_settings_env(struct expo *exp, bool verbose); + #endif /* __CEDIT_H */ diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 659c47ed35f..26a69f0323f 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -112,3 +113,35 @@ static int cedit_fdt(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(cedit_fdt, 0); + +/* Check the cedit write_env command */ +static int cedit_env(struct unit_test_state *uts) +{ + struct video_priv *vid_priv; + extern struct expo *cur_exp; + struct scene_obj_menu *menu; + struct scene *scn; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + /* get a menu to fiddle with */ + menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU); + ut_assertnonnull(menu); + menu->cur_item_id = ID_CPU_SPEED_2; + + ut_assertok(run_command("cedit write_env -v", 0)); + ut_assert_nextlinen("c.cpu-speed=7"); + ut_assert_nextlinen("c.cpu-speed-str=2.5 GHz"); + ut_assert_nextlinen("c.power-loss=10"); + ut_assert_nextlinen("c.power-loss-str=Always Off"); + ut_assert_console_end(); + + ut_asserteq(7, env_get_ulong("c.cpu-speed", 10, 0)); + ut_asserteq_str("2.5 GHz", env_get("c.cpu-speed-str")); + + return 0; +} +BOOTSTD_TEST(cedit_env, 0); -- cgit v1.2.3 From bcf2b7202e960e7fb3df8d5e8ed0d6fa00a5a9fa Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Aug 2023 16:40:36 -0600 Subject: expo: cedit: Support reading settings from environment vars Add a command to read cedit settings from environment variables so that they can be restored as part of the environment. Signed-off-by: Simon Glass --- boot/cedit.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ cmd/cedit.c | 22 ++++++++++++++++++++++ doc/usage/cmd/cedit.rst | 19 +++++++++++++++++++ include/cedit.h | 8 ++++++++ test/boot/cedit.c | 12 +++++++++++- 5 files changed, 105 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/boot/cedit.c b/boot/cedit.c index 9399c01cda9..e3f6dc00399 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -439,3 +439,48 @@ int cedit_write_settings_env(struct expo *exp, bool verbose) return 0; } + +static int h_read_settings_env(struct scene_obj *obj, void *vpriv) +{ + struct cedit_iter_priv *priv = vpriv; + struct scene_obj_menu *menu; + char var[60]; + int val, ret; + + if (obj->type != SCENEOBJT_MENU) + return 0; + + menu = (struct scene_obj_menu *)obj; + val = menu->cur_item_id; + snprintf(var, sizeof(var), "c.%s", obj->name); + + val = env_get_ulong(var, 10, 0); + if (priv->verbose) + printf("%s=%d\n", var, val); + if (!val) + return log_msg_ret("get", -ENOENT); + + /* + * note that no validation is done here, to make sure the ID is valid + * and actually points to a menu item + */ + menu->cur_item_id = val; + + return 0; +} + +int cedit_read_settings_env(struct expo *exp, bool verbose) +{ + struct cedit_iter_priv priv; + int ret; + + /* write out the items */ + priv.verbose = verbose; + ret = expo_iter_scene_objs(exp, h_read_settings_env, &priv); + if (ret) { + log_debug("Failed to read settings from env (err=%d)\n", ret); + return log_msg_ret("set", ret); + } + + return 0; +} diff --git a/cmd/cedit.c b/cmd/cedit.c index 85629f7b83c..b2548f44b57 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -156,6 +156,26 @@ static int do_cedit_write_env(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_cedit_read_env(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + bool verbose; + int ret; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + verbose = argc > 1 && !strcmp(argv[1], "-v"); + + ret = cedit_read_settings_env(cur_exp, verbose); + if (ret) { + printf("Failed to read settings from environment: %dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -187,6 +207,7 @@ static char cedit_help_text[] = "load - load config editor\n" "cedit read_fdt - read settings\n" "cedit write_fdt - write settings\n" + "cedit read_env [-v] - read settings from env vars\n" "cedit write_env [-v] - write settings to env vars\n" "cedit run - run config editor"; #endif /* CONFIG_SYS_LONGHELP */ @@ -195,6 +216,7 @@ U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text, U_BOOT_SUBCMD_MKENT(load, 5, 1, do_cedit_load), U_BOOT_SUBCMD_MKENT(read_fdt, 5, 1, do_cedit_read_fdt), U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt), + U_BOOT_SUBCMD_MKENT(read_env, 2, 1, do_cedit_read_env), U_BOOT_SUBCMD_MKENT(write_env, 2, 1, do_cedit_write_env), U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run), ); diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index 426470a82ac..1f92b7306a7 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -13,6 +13,7 @@ Synopis cedit write_fdt cedit read_fdt cedit write_env [-v] + cedit read_env [-v] Description ----------- @@ -53,6 +54,16 @@ cedit read_fdt Reads the user settings from a devicetree file and updates the cedit with those settings. +cedit read_env +~~~~~~~~~~~~~~ + +Reads the settings from the environment variables. For each menu item ``, +cedit looks for a variable called `c.` with the ID of the selected menu +item. + +The `-v` flag enables verbose mode, where each variable is printed after it is +read. + cedit write_env ~~~~~~~~~~~~~~~ @@ -91,6 +102,10 @@ That results in:: This shows settings being stored in the environment:: => cedit write_env -v + c.cpu-speed=7 + c.cpu-speed-str=2.5 GHz + c.power-loss=12 + c.power-loss-str=Memory => print ... c.cpu-speed=6 @@ -98,3 +113,7 @@ This shows settings being stored in the environment:: c.power-loss=10 c.power-loss-str=Always Off ... + + => cedit read_env -v + c.cpu-speed=7 + c.power-loss=12 diff --git a/include/cedit.h b/include/cedit.h index f261207e209..fe10e6c829c 100644 --- a/include/cedit.h +++ b/include/cedit.h @@ -89,4 +89,12 @@ int cedit_read_settings(struct expo *exp, oftree tree); */ int cedit_write_settings_env(struct expo *exp, bool verbose); +/* + * cedit_read_settings_env() - Read settings from the environment + * + * @exp: Expo to read settings into + * @verbose: true to print each var before it is read + */ +int cedit_read_settings_env(struct expo *exp, bool verbose); + #endif /* __CEDIT_H */ diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 26a69f0323f..7cf0c3e4e93 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -114,7 +114,7 @@ static int cedit_fdt(struct unit_test_state *uts) } BOOTSTD_TEST(cedit_fdt, 0); -/* Check the cedit write_env command */ +/* Check the cedit write_env and read_env commands */ static int cedit_env(struct unit_test_state *uts) { struct video_priv *vid_priv; @@ -142,6 +142,16 @@ static int cedit_env(struct unit_test_state *uts) ut_asserteq(7, env_get_ulong("c.cpu-speed", 10, 0)); ut_asserteq_str("2.5 GHz", env_get("c.cpu-speed-str")); + /* reset the expo */ + menu->cur_item_id = ID_CPU_SPEED_1; + + ut_assertok(run_command("cedit read_env -v", 0)); + ut_assert_nextlinen("c.cpu-speed=7"); + ut_assert_nextlinen("c.power-loss=10"); + ut_assert_console_end(); + + ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id); + return 0; } BOOTSTD_TEST(cedit_env, 0); -- cgit v1.2.3 From eb6c71b56282d3054dbffb83793e7d2c6745578e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Aug 2023 16:40:37 -0600 Subject: expo: cedit: Support writing settings to CMOS RAM Add a command to write cedit settings to CMOS RAM so that it can be preserved across a reboot. This uses a simple bit-encoding, where each field has a 'bit position' and a 'bit length' in the schema. Signed-off-by: Simon Glass --- boot/cedit.c | 137 +++++++++++++++++++++++++++++++++++++++- boot/expo_build.c | 7 +- cmd/cedit.c | 36 +++++++++++ doc/develop/expo.rst | 13 ++++ doc/usage/cmd/cedit.rst | 22 +++++++ include/cedit.h | 13 ++++ include/expo.h | 6 +- test/boot/cedit.c | 30 +++++++++ test/boot/files/expo_layout.dts | 5 ++ 9 files changed, 266 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/boot/cedit.c b/boot/cedit.c index e3f6dc00399..725745aba55 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -15,22 +15,37 @@ #include #include #include +#include #include +#include #include #include #include "scene_internal.h" +enum { + CMOS_MAX_BITS = 2048, + CMOS_MAX_BYTES = CMOS_MAX_BITS / 8, +}; + +#define CMOS_BYTE(bit) ((bit) / 8) +#define CMOS_BIT(bit) ((bit) % 8) + /** * struct cedit_iter_priv - private data for cedit operations * * @buf: Buffer to use when writing settings to the devicetree * @node: Node to read from when reading settings from devicetree * @verbose: true to show writing to environment variables + * @mask: Mask bits for the CMOS RAM. If a bit is set the byte containing it + * will be written + * @value: Value bits for CMOS RAM. This is the actual value written */ struct cedit_iter_priv { struct abuf *buf; ofnode node; bool verbose; + u8 *mask; + u8 *value; }; int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) @@ -445,7 +460,7 @@ static int h_read_settings_env(struct scene_obj *obj, void *vpriv) struct cedit_iter_priv *priv = vpriv; struct scene_obj_menu *menu; char var[60]; - int val, ret; + int val; if (obj->type != SCENEOBJT_MENU) return 0; @@ -484,3 +499,123 @@ int cedit_read_settings_env(struct expo *exp, bool verbose) return 0; } + +/** + * get_cur_menuitem_seq() - Get the sequence number of a menu's current item + * + * Enumerates the items of a menu (0, 1, 2) and returns the sequence number of + * the currently selected item. If the first item is selected, this returns 0; + * if the second, 1; etc. + * + * @menu: Menu to check + * Return: Sequence number on success, else -ve error value + */ +static int get_cur_menuitem_seq(const struct scene_obj_menu *menu) +{ + const struct scene_menitem *mi; + int seq, found; + + seq = 0; + found = -1; + list_for_each_entry(mi, &menu->item_head, sibling) { + if (mi->id == menu->cur_item_id) { + found = seq; + break; + } + seq++; + } + + if (found == -1) + return log_msg_ret("nf", -ENOENT); + + return found; +} + +static int h_write_settings_cmos(struct scene_obj *obj, void *vpriv) +{ + const struct scene_obj_menu *menu; + struct cedit_iter_priv *priv = vpriv; + int val, ret; + uint i, seq; + + if (obj->type != SCENEOBJT_MENU) + return 0; + + menu = (struct scene_obj_menu *)obj; + val = menu->cur_item_id; + + ret = get_cur_menuitem_seq(menu); + if (ret < 0) + return log_msg_ret("cur", ret); + seq = ret; + log_debug("%s: seq=%d\n", menu->obj.name, seq); + + /* figure out where to place this item */ + if (!obj->bit_length) + return log_msg_ret("len", -EINVAL); + if (obj->start_bit + obj->bit_length > CMOS_MAX_BITS) + return log_msg_ret("bit", -E2BIG); + + for (i = 0; i < obj->bit_length; i++, seq >>= 1) { + uint bitnum = obj->start_bit + i; + + priv->mask[CMOS_BYTE(bitnum)] |= 1 << CMOS_BIT(bitnum); + if (seq & 1) + priv->value[CMOS_BYTE(bitnum)] |= BIT(CMOS_BIT(bitnum)); + log_debug("bit %x %x %x\n", bitnum, + priv->mask[CMOS_BYTE(bitnum)], + priv->value[CMOS_BYTE(bitnum)]); + } + + return 0; +} + +int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose) +{ + struct cedit_iter_priv priv; + int ret, i, count, first, last; + + /* write out the items */ + priv.mask = calloc(1, CMOS_MAX_BYTES); + if (!priv.mask) + return log_msg_ret("mas", -ENOMEM); + priv.value = calloc(1, CMOS_MAX_BYTES); + if (!priv.value) { + free(priv.mask); + return log_msg_ret("val", -ENOMEM); + } + + ret = expo_iter_scene_objs(exp, h_write_settings_cmos, &priv); + if (ret) { + log_debug("Failed to write CMOS (err=%d)\n", ret); + ret = log_msg_ret("set", ret); + goto done; + } + + /* write the data to the RTC */ + first = CMOS_MAX_BYTES; + last = -1; + for (i = 0, count = 0; i < CMOS_MAX_BYTES; i++) { + if (priv.mask[i]) { + log_debug("Write byte %x: %x\n", i, priv.value[i]); + ret = rtc_write8(dev, i, priv.value[i]); + if (ret) { + ret = log_msg_ret("wri", ret); + goto done; + } + count++; + first = min(first, i); + last = max(last, i); + } + } + if (verbose) { + printf("Write %d bytes from offset %x to %x\n", count, first, + last); + } + +done: + free(priv.mask); + free(priv.value); + return ret; +} diff --git a/boot/expo_build.c b/boot/expo_build.c index e8c4a40d3f0..bb33cc2a33f 100644 --- a/boot/expo_build.c +++ b/boot/expo_build.c @@ -294,7 +294,7 @@ static int obj_build(struct build_info *info, ofnode node, struct scene *scn) { struct scene_obj *obj; const char *type; - u32 id; + u32 id, val; int ret; log_debug("- object %s\n", ofnode_get_name(node)); @@ -313,6 +313,11 @@ static int obj_build(struct build_info *info, ofnode node, struct scene *scn) if (ret) return log_msg_ret("bld", ret); + if (!ofnode_read_u32(node, "start-bit", &val)) + obj->start_bit = val; + if (!ofnode_read_u32(node, "bit-length", &val)) + obj->bit_length = val; + return 0; } diff --git a/cmd/cedit.c b/cmd/cedit.c index b2548f44b57..95d5c22c2f7 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -176,6 +177,39 @@ static int do_cedit_read_env(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_cedit_write_cmos(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct udevice *dev; + bool verbose = false; + int ret; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + if (argc > 1 && !strcmp(argv[1], "-v")) { + verbose = true; + argc--; + argv++; + } + + if (argc > 1) + ret = uclass_get_device_by_name(UCLASS_RTC, argv[1], &dev); + else + ret = uclass_first_device_err(UCLASS_RTC, &dev); + if (ret) { + printf("Failed to get RTC device: %dE\n", ret); + return CMD_RET_FAILURE; + } + + if (cedit_write_settings_cmos(cur_exp, dev, verbose)) { + printf("Failed to write settings to CMOS\n"); + return CMD_RET_FAILURE; + } + + return 0; +} + static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -209,6 +243,7 @@ static char cedit_help_text[] = "cedit write_fdt - write settings\n" "cedit read_env [-v] - read settings from env vars\n" "cedit write_env [-v] - write settings to env vars\n" + "cedit write_cmos [-v] [dev] - write settings to CMOS RAM\n" "cedit run - run config editor"; #endif /* CONFIG_SYS_LONGHELP */ @@ -218,5 +253,6 @@ U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text, U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt), U_BOOT_SUBCMD_MKENT(read_env, 2, 1, do_cedit_read_env), U_BOOT_SUBCMD_MKENT(write_env, 2, 1, do_cedit_write_env), + U_BOOT_SUBCMD_MKENT(write_cmos, 2, 1, do_cedit_write_cmos), U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run), ); diff --git a/doc/develop/expo.rst b/doc/develop/expo.rst index fde91494799..61b6855c72f 100644 --- a/doc/develop/expo.rst +++ b/doc/develop/expo.rst @@ -317,6 +317,18 @@ id Specifies the ID of the object. This is used when referring to the object. +Where CMOS RAM is used for reading and writing settings, the following +additional properties are required: + +start-bit + Specifies the first bit in the CMOS RAM to use for this setting. For a RAM + with 0x100 bytes, there are 0x800 bit locations. For example, register 0x80 + holds bits 0x400 to 0x407. + +bit-length + Specifies the number of CMOS RAM bits to use for this setting. The bits + extend from `start-bit` to `start-bit + bit-length - 1`. Note that the bits + must be contiguous. Menu nodes have the following additional properties: @@ -474,6 +486,7 @@ Some ideas for future work: - Support curses for proper serial-terminal menus - Add support for large menus which need to scroll - Add support for reading and writing configuration settings with cedit +- Update expo.py tool to check for overlapping names and CMOS locations .. Simon Glass .. 7-Oct-22 diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index 1f92b7306a7..3d6f26e631d 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -14,6 +14,7 @@ Synopis cedit read_fdt cedit write_env [-v] cedit read_env [-v] + cedit write_cmos [-v] [dev] Description ----------- @@ -76,6 +77,18 @@ ID and its text string are written, similar to: The `-v` flag enables verbose mode, where each variable is printed before it is set. +cedit write_cmos +~~~~~~~~~~~~~~~~ + +Writes the settings to locations in the CMOS RAM. The locations used are +specified by the schema. See `expo_format_`. + +The `-v` flag enables verbose mode, which shows which CMOS locations were +updated. + +Normally the first RTC device is used to hold the data. You can specify a +different device by name using the `dev` parameter. + Example ------- @@ -117,3 +130,12 @@ This shows settings being stored in the environment:: => cedit read_env -v c.cpu-speed=7 c.power-loss=12 + +This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change:: + + => rtc read 80 8 + 00000080: 00 00 00 00 00 2f 2a 08 ...../*. + => cedit write_cmos + Write 2 bytes from offset 80 to 84 + => rtc read 80 8 + 00000080: 01 00 00 00 08 2f 2a 08 ...../*. diff --git a/include/cedit.h b/include/cedit.h index fe10e6c829c..2970965b5f6 100644 --- a/include/cedit.h +++ b/include/cedit.h @@ -97,4 +97,17 @@ int cedit_write_settings_env(struct expo *exp, bool verbose); */ int cedit_read_settings_env(struct expo *exp, bool verbose); +/** + * cedit_write_settings_cmos() - Write settings to CMOS RAM + * + * Write settings to the defined places in CMOS RAM + * + * @exp: Expo to write settings from + * @dev: UCLASS_RTC device containing space for this information + * Returns 0 if OK, -ve on error + * @verbose: true to print a summary at the end + */ +int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose); + #endif /* __CEDIT_H */ diff --git a/include/expo.h b/include/expo.h index da151074d20..a2b3a71c159 100644 --- a/include/expo.h +++ b/include/expo.h @@ -187,6 +187,8 @@ enum scene_obj_flags_t { * @type: Type of this object * @dim: Dimensions for this object * @flags: Flags for this object + * @bit_length: Number of bits used for this object in CMOS RAM + * @start_bit: Start bit to use for this object in CMOS RAM * @sibling: Node to link this object to its siblings */ struct scene_obj { @@ -195,7 +197,9 @@ struct scene_obj { uint id; enum scene_obj_t type; struct scene_dim dim; - int flags; + u8 flags; + u8 bit_length; + u16 start_bit; struct list_head sibling; }; diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 7cf0c3e4e93..010aae615b9 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -155,3 +155,33 @@ static int cedit_env(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(cedit_env, 0); + +/* Check the cedit write_cmos and read_cmos commands */ +static int cedit_cmos(struct unit_test_state *uts) +{ + struct scene_obj_menu *menu, *menu2; + struct video_priv *vid_priv; + extern struct expo *cur_exp; + struct scene *scn; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + /* get the menus to fiddle with */ + menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU); + ut_assertnonnull(menu); + menu->cur_item_id = ID_CPU_SPEED_2; + + menu2 = scene_obj_find(scn, ID_POWER_LOSS, SCENEOBJT_MENU); + ut_assertnonnull(menu2); + menu2->cur_item_id = ID_AC_MEMORY; + + ut_assertok(run_command("cedit write_cmos -v", 0)); + ut_assert_nextlinen("Write 2 bytes from offset 80 to 84"); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(cedit_cmos, 0); diff --git a/test/boot/files/expo_layout.dts b/test/boot/files/expo_layout.dts index 913140bace9..cb2a674d9d5 100644 --- a/test/boot/files/expo_layout.dts +++ b/test/boot/files/expo_layout.dts @@ -38,6 +38,9 @@ /* IDs for the menu items */ item-id = ; + + start-bit = <0x400>; + bit-length = <2>; }; power-loss { @@ -49,6 +52,8 @@ "Memory"; item-id = ; + start-bit = <0x422>; + bit-length = <2>; }; }; }; -- cgit v1.2.3 From cfc402db3954d7c852c322b232ad6d8842af6bf1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Aug 2023 16:40:38 -0600 Subject: expo: cedit: Support reading settings from CMOS RAM Add a command to read edit settings from CMOS RAM, using the cedit definition to indicate which registers and bits are used. Signed-off-by: Simon Glass --- boot/cedit.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ boot/scene_internal.h | 12 ++++++ boot/scene_menu.c | 16 ++++++++ cmd/cedit.c | 36 ++++++++++++++++++ doc/usage/cmd/cedit.rst | 9 ++++- include/cedit.h | 12 ++++++ test/boot/cedit.c | 11 ++++++ 7 files changed, 194 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/boot/cedit.c b/boot/cedit.c index 725745aba55..73645f70b6c 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -39,6 +39,7 @@ enum { * @mask: Mask bits for the CMOS RAM. If a bit is set the byte containing it * will be written * @value: Value bits for CMOS RAM. This is the actual value written + * @dev: RTC device to write to */ struct cedit_iter_priv { struct abuf *buf; @@ -46,6 +47,7 @@ struct cedit_iter_priv { bool verbose; u8 *mask; u8 *value; + struct udevice *dev; }; int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) @@ -619,3 +621,100 @@ done: free(priv.value); return ret; } + +static int h_read_settings_cmos(struct scene_obj *obj, void *vpriv) +{ + struct cedit_iter_priv *priv = vpriv; + const struct scene_menitem *mi; + struct scene_obj_menu *menu; + int val, ret; + uint i; + + if (obj->type != SCENEOBJT_MENU) + return 0; + + menu = (struct scene_obj_menu *)obj; + + /* figure out where to place this item */ + if (!obj->bit_length) + return log_msg_ret("len", -EINVAL); + if (obj->start_bit + obj->bit_length > CMOS_MAX_BITS) + return log_msg_ret("bit", -E2BIG); + + val = 0; + for (i = 0; i < obj->bit_length; i++) { + uint bitnum = obj->start_bit + i; + uint offset = CMOS_BYTE(bitnum); + + /* read the byte if not already read */ + if (!priv->mask[offset]) { + ret = rtc_read8(priv->dev, offset); + if (ret < 0) + return log_msg_ret("rea", ret); + priv->value[offset] = ret; + + /* mark it as read */ + priv->mask[offset] = 0xff; + } + + if (priv->value[offset] & BIT(CMOS_BIT(bitnum))) + val |= BIT(i); + log_debug("bit %x %x\n", bitnum, val); + } + + /* update the current item */ + mi = scene_menuitem_find_seq(menu, val); + if (!mi) + return log_msg_ret("seq", -ENOENT); + + menu->cur_item_id = mi->id; + log_debug("Update menu %d cur_item_id %d\n", menu->obj.id, mi->id); + + return 0; +} + +int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose) +{ + struct cedit_iter_priv priv; + int ret, i, count, first, last; + + /* read in the items */ + priv.mask = calloc(1, CMOS_MAX_BYTES); + if (!priv.mask) + return log_msg_ret("mas", -ENOMEM); + priv.value = calloc(1, CMOS_MAX_BYTES); + if (!priv.value) { + free(priv.mask); + return log_msg_ret("val", -ENOMEM); + } + priv.dev = dev; + + ret = expo_iter_scene_objs(exp, h_read_settings_cmos, &priv); + if (ret) { + log_debug("Failed to read CMOS (err=%d)\n", ret); + ret = log_msg_ret("set", ret); + goto done; + } + + /* read the data to the RTC */ + first = CMOS_MAX_BYTES; + last = -1; + for (i = 0, count = 0; i < CMOS_MAX_BYTES; i++) { + if (priv.mask[i]) { + log_debug("Read byte %x: %x\n", i, priv.value[i]); + count++; + first = min(first, i); + last = max(last, i); + } + } + if (verbose) { + printf("Read %d bytes from offset %x to %x\n", count, first, + last); + } + +done: + free(priv.mask); + free(priv.value); + return ret; +} diff --git a/boot/scene_internal.h b/boot/scene_internal.h index 23e29cb349b..695a907dc6a 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -234,4 +234,16 @@ int expo_iter_scene_objs(struct expo *exp, expo_scene_obj_iterator iter, struct scene_menitem *scene_menuitem_find(const struct scene_obj_menu *menu, int id); +/** + * scene_menuitem_find_seq() - Find the menu item at a sequential position + * + * This numbers the items from 0 and returns the seq'th one + * + * @menu: Menu to check + * @seq: Sequence number to look for + * Return: menu item if found, else NULL + */ +struct scene_menitem *scene_menuitem_find_seq(const struct scene_obj_menu *menu, + uint seq); + #endif /* __SCENE_INTERNAL_H */ diff --git a/boot/scene_menu.c b/boot/scene_menu.c index 602fe24580a..e0dcd0a4e04 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -46,6 +46,22 @@ struct scene_menitem *scene_menuitem_find(const struct scene_obj_menu *menu, return NULL; } +struct scene_menitem *scene_menuitem_find_seq(const struct scene_obj_menu *menu, + uint seq) +{ + struct scene_menitem *item; + uint i; + + i = 0; + list_for_each_entry(item, &menu->item_head, sibling) { + if (i == seq) + return item; + i++; + } + + return NULL; +} + /** * update_pointers() - Update the pointer object and handle highlights * diff --git a/cmd/cedit.c b/cmd/cedit.c index 95d5c22c2f7..2ff284f4cde 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -210,6 +210,40 @@ static int do_cedit_write_cmos(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_cedit_read_cmos(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct udevice *dev; + bool verbose = false; + int ret; + + if (check_cur_expo()) + return CMD_RET_FAILURE; + + if (argc > 1 && !strcmp(argv[1], "-v")) { + verbose = true; + argc--; + argv++; + } + + if (argc > 1) + ret = uclass_get_device_by_name(UCLASS_RTC, argv[1], &dev); + else + ret = uclass_first_device_err(UCLASS_RTC, &dev); + if (ret) { + printf("Failed to get RTC device: %dE\n", ret); + return CMD_RET_FAILURE; + } + + ret = cedit_read_settings_cmos(cur_exp, dev, verbose); + if (ret) { + printf("Failed to read settings from CMOS: %dE\n", ret); + return CMD_RET_FAILURE; + } + + return 0; +} + static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -243,6 +277,7 @@ static char cedit_help_text[] = "cedit write_fdt - write settings\n" "cedit read_env [-v] - read settings from env vars\n" "cedit write_env [-v] - write settings to env vars\n" + "cedit read_cmos [-v] [dev] - read settings from CMOS RAM\n" "cedit write_cmos [-v] [dev] - write settings to CMOS RAM\n" "cedit run - run config editor"; #endif /* CONFIG_SYS_LONGHELP */ @@ -253,6 +288,7 @@ U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text, U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt), U_BOOT_SUBCMD_MKENT(read_env, 2, 1, do_cedit_read_env), U_BOOT_SUBCMD_MKENT(write_env, 2, 1, do_cedit_write_env), + U_BOOT_SUBCMD_MKENT(read_cmos, 2, 1, do_cedit_read_cmos), U_BOOT_SUBCMD_MKENT(write_cmos, 2, 1, do_cedit_write_cmos), U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run), ); diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index 3d6f26e631d..f415b48699e 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -135,7 +135,14 @@ This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change:: => rtc read 80 8 00000080: 00 00 00 00 00 2f 2a 08 ...../*. - => cedit write_cmos + => cedit write_cmos -v Write 2 bytes from offset 80 to 84 => rtc read 80 8 00000080: 01 00 00 00 08 2f 2a 08 ...../*. + => cedit read_cmos -v + Read 2 bytes from offset 80 to 84 + +Here is an example with the device specified:: + + => cedit write_cmos rtc@43 + => diff --git a/include/cedit.h b/include/cedit.h index 2970965b5f6..f43cafa5aa2 100644 --- a/include/cedit.h +++ b/include/cedit.h @@ -110,4 +110,16 @@ int cedit_read_settings_env(struct expo *exp, bool verbose); int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev, bool verbose); +/** + * cedit_read_settings_cmos() - Read settings from CMOS RAM + * + * Read settings from the defined places in CMO RAM + * + * @exp: Expo to read settings into + * @dev: RTC device to read settings from + * @verbose: true to print a summary at the end + */ +int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose); + #endif /* __CEDIT_H */ diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 010aae615b9..ab2b8a1f9ff 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -182,6 +182,17 @@ static int cedit_cmos(struct unit_test_state *uts) ut_assert_nextlinen("Write 2 bytes from offset 80 to 84"); ut_assert_console_end(); + /* reset the expo */ + menu->cur_item_id = ID_CPU_SPEED_1; + menu2->cur_item_id = ID_AC_OFF; + + ut_assertok(run_command("cedit read_cmos -v", 0)); + ut_assert_nextlinen("Read 2 bytes from offset 80 to 84"); + ut_assert_console_end(); + + ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id); + ut_asserteq(ID_AC_MEMORY, menu2->cur_item_id); + return 0; } BOOTSTD_TEST(cedit_cmos, 0); -- cgit v1.2.3 From c5f1d005f51783a5b34d6164ab66289eb1f4a45b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 24 Aug 2023 13:55:31 -0600 Subject: part: Add accessors for struct disk_partition uuid This field is only present when a CONFIG is set. To avoid annoying #ifdefs in the source code, add accessors. Update all code to use it. Note that the accessor is optional. It can be omitted if it is known that the option is enabled. Signed-off-by: Simon Glass --- cmd/gpt.c | 10 ++++------ disk/part.c | 8 ++------ disk/part_dos.c | 17 ++++++++--------- disk/part_efi.c | 31 ++++++++++++++++--------------- fs/fat/fat.c | 4 +--- include/part.h | 27 +++++++++++++++++++++++++++ 6 files changed, 58 insertions(+), 39 deletions(-) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index 007a68eaa72..8969efba8c8 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -211,12 +211,10 @@ static struct disk_part *allocate_disk_part(struct disk_partition *info, PART_TYPE_LEN); newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0'; newpart->gpt_part_info.bootable = info->bootable; -#ifdef CONFIG_PARTITION_UUIDS - strncpy(newpart->gpt_part_info.uuid, (const char *)info->uuid, - UUID_STR_LEN); - /* UUID_STR_LEN is correct, as uuid[]'s length is UUID_STR_LEN+1 chars */ - newpart->gpt_part_info.uuid[UUID_STR_LEN] = '\0'; -#endif + if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) { + strlcpy(newpart->gpt_part_info.uuid, disk_partition_uuid(info), + UUID_STR_LEN + 1); + } newpart->partnum = partnum; return newpart; diff --git a/disk/part.c b/disk/part.c index 9190e880618..91c6ac42cc8 100644 --- a/disk/part.c +++ b/disk/part.c @@ -368,10 +368,8 @@ int part_get_info_by_type(struct blk_desc *desc, int part, int part_type, struct part_driver *drv; if (blk_enabled()) { -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) /* The common case is no UUID support */ - info->uuid[0] = 0; -#endif + disk_partition_clr_uuid(info); #ifdef CONFIG_PARTITION_TYPE_GUID info->type_guid[0] = 0; #endif @@ -416,9 +414,7 @@ int part_get_info_whole_disk(struct blk_desc *desc, info->bootable = 0; strcpy((char *)info->type, BOOT_PART_TYPE); strcpy((char *)info->name, "Whole Disk"); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info->uuid[0] = 0; -#endif + disk_partition_clr_uuid(info); #ifdef CONFIG_PARTITION_TYPE_GUID info->type_guid[0] = 0; #endif diff --git a/disk/part_dos.c b/disk/part_dos.c index cc050ca8c49..33374384373 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -231,10 +231,8 @@ static int part_get_info_extended(struct blk_desc *desc, return -1; } -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - if (!ext_part_sector) + if (CONFIG_IS_ENABLED(PARTITION_UUIDS) && !ext_part_sector) disksig = get_unaligned_le32(&buffer[DOS_PART_DISKSIG_OFFSET]); -#endif ret = part_get_info_whole_disk(desc, &wdinfo); if (ret) @@ -263,9 +261,12 @@ static int part_get_info_extended(struct blk_desc *desc, /* sprintf(info->type, "%d, pt->sys_ind); */ strcpy((char *)info->type, "U-Boot"); info->bootable = get_bootable(pt); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - sprintf(info->uuid, "%08x-%02x", disksig, part_num); -#endif + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + char str[12]; + + sprintf(str, "%08x-%02x", disksig, part_num); + disk_partition_set_uuid(info, str); + } info->sys_ind = pt->sys_ind; return 0; } @@ -302,9 +303,7 @@ static int part_get_info_extended(struct blk_desc *desc, info->blksz = DOS_PART_DEFAULT_SECTOR; info->bootable = 0; strcpy((char *)info->type, "U-Boot"); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info->uuid[0] = 0; -#endif + disk_partition_clr_uuid(info); return 0; } diff --git a/disk/part_efi.c b/disk/part_efi.c index 4ac21868d08..a6f7375cd38 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -289,10 +289,11 @@ int part_get_info_efi(struct blk_desc *desc, int part, print_efiname(&gpt_pte[part - 1])); strcpy((char *)info->type, "U-Boot"); info->bootable = get_bootable(&gpt_pte[part - 1]); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, info->uuid, - UUID_STR_FORMAT_GUID); -#endif + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, + (char *)disk_partition_uuid(info), + UUID_STR_FORMAT_GUID); + } #ifdef CONFIG_PARTITION_TYPE_GUID uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b, info->type_guid, UUID_STR_FORMAT_GUID); @@ -415,10 +416,7 @@ int gpt_fill_pte(struct blk_desc *desc, le64_to_cpu(gpt_h->last_usable_lba); int i, k; size_t efiname_len, dosname_len; -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - char *str_uuid; unsigned char *bin_uuid; -#endif #ifdef CONFIG_PARTITION_TYPE_GUID char *str_type_guid; unsigned char *bin_type_guid; @@ -487,16 +485,19 @@ int gpt_fill_pte(struct blk_desc *desc, &partition_basic_data_guid, 16); #endif -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - str_uuid = partitions[i].uuid; - bin_uuid = gpt_e[i].unique_partition_guid.b; + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + const char *str_uuid; + + str_uuid = disk_partition_uuid(&partitions[i]); + bin_uuid = gpt_e[i].unique_partition_guid.b; - if (uuid_str_to_bin(str_uuid, bin_uuid, UUID_STR_FORMAT_GUID)) { - log_debug("Partition no. %d: invalid guid: %s\n", - i, str_uuid); - return -EINVAL; + if (uuid_str_to_bin(str_uuid, bin_uuid, + UUID_STR_FORMAT_GUID)) { + log_debug("Partition no. %d: invalid guid: %s\n", + i, str_uuid); + return -EINVAL; + } } -#endif /* partition attributes */ memset(&gpt_e[i].attributes, 0, diff --git a/fs/fat/fat.c b/fs/fat/fat.c index d1476aa433d..8ff1fd0ec83 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -110,9 +110,7 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no) info.name[0] = 0; info.type[0] = 0; info.bootable = 0; -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info.uuid[0] = 0; -#endif + disk_partition_clr_uuid(&info); } return fat_set_blk_dev(dev_desc, &info); diff --git a/include/part.h b/include/part.h index 3a6be75421d..8e5e543c56e 100644 --- a/include/part.h +++ b/include/part.h @@ -80,6 +80,33 @@ struct disk_partition { #endif }; +/* Accessors for struct disk_partition field ->uuid */ +extern char *__invalid_use_of_disk_partition_uuid; + +static inline const char *disk_partition_uuid(const struct disk_partition *info) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + return info->uuid; +#else + return __invalid_use_of_disk_partition_uuid; +#endif +} + +static inline void disk_partition_set_uuid(struct disk_partition *info, + const char *val) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + strlcpy(info->uuid, val, UUID_STR_LEN + 1); +#endif +} + +static inline void disk_partition_clr_uuid(struct disk_partition *info) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + *info->uuid = '\0'; +#endif +} + struct disk_part { int partnum; struct disk_partition gpt_part_info; -- cgit v1.2.3 From c3867e2e98165106fc5f378eeaf3354cd18e87bd Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 24 Aug 2023 13:55:39 -0600 Subject: bootflow: Show an empty filename when there is none At present 'bootflow list' shows for the filename when it is not present. Show an empty string instead, since that is more user-friendly. Signed-off-by: Simon Glass --- cmd/bootflow.c | 2 +- test/boot/bootflow.c | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'cmd') diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 3c3abaf8a3b..300ad3aaa76 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -71,7 +71,7 @@ static void show_bootflow(int index, struct bootflow *bflow, bool errors) printf("%3x %-11s %-6s %-9.9s %4x %-25.25s %s\n", index, bflow->method->name, bootflow_state_get_name(bflow->state), bflow->dev ? dev_get_uclass_name(dev_get_parent(bflow->dev)) : - "(none)", bflow->part, bflow->name, bflow->fname); + "(none)", bflow->part, bflow->name, bflow->fname ?: ""); if (errors) report_bootflow_err(bflow, bflow->err); } diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 8a4e090e9bc..649237a9e22 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -167,21 +167,22 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) ut_assert_nextline("Seq Method State Uclass Part Name Filename"); ut_assert_nextlinen("---"); ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); - ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole "); + ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported"); - ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole "); + ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported"); ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':"); - ut_assert_nextline(" 2 extlinux media mmc 0 mmc1.bootdev.whole "); + ut_assert_nextline(" 2 extlinux media mmc 0 mmc1.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-2: No such file or directory"); - ut_assert_nextline(" 3 efi media mmc 0 mmc1.bootdev.whole "); + ut_assert_nextline(" 3 efi media mmc 0 mmc1.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-2: No such file or directory"); ut_assert_nextline(" 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); ut_assert_nextline(" 5 efi fs mmc 1 mmc1.bootdev.part_1 efi/boot/bootsbox.efi"); ut_assert_skip_to_line("Scanning bootdev 'mmc0.bootdev':"); - ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole "); + ut_assert_skip_to_line( + " 3f efi media mmc 0 mmc0.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported"); ut_assert_nextline("No more bootdevs"); ut_assert_nextlinen("---"); @@ -192,10 +193,11 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) ut_assert_nextline("Showing all bootflows"); ut_assert_nextline("Seq Method State Uclass Part Name Filename"); ut_assert_nextlinen("---"); - ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole "); - ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole "); - ut_assert_skip_to_line(" 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); - ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole "); + ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole "); + ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole "); + ut_assert_skip_to_line( + " 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); + ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole "); ut_assert_nextlinen("---"); ut_assert_nextline("(64 bootflows, 1 valid)"); ut_assert_console_end(); @@ -384,7 +386,7 @@ static int bootflow_system(struct unit_test_state *uts) console_record_reset_enable(); ut_assertok(run_command("bootflow scan -lH", 0)); ut_assert_skip_to_line( - " 0 efi_mgr ready (none) 0 "); + " 0 efi_mgr ready (none) 0 "); ut_assert_skip_to_line("No more bootdevs"); ut_assert_skip_to_line("(2 bootflows, 2 valid)"); ut_assert_console_end(); -- cgit v1.2.3 From 36b900e8bd57fec7b4c200a368883e1e59e4f27f Mon Sep 17 00:00:00 2001 From: Łukasz Stelmach Date: Thu, 24 Aug 2023 08:10:25 +0200 Subject: setexpr: Silence some diagnostic messages Neither successful match nor lack thereof should be considered an extraordinary situation. Thus, neither require printing a message. Signed-off-by: Łukasz Stelmach Reviewed-by: Simon Glass --- cmd/setexpr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/setexpr.c b/cmd/setexpr.c index 4d671e7ef12..233471f6cb7 100644 --- a/cmd/setexpr.c +++ b/cmd/setexpr.c @@ -215,7 +215,7 @@ int setexpr_regex_sub(char *data, uint data_size, char *nbuf, uint nbuf_size, if (res == 0) { if (loop == 0) { - printf("%s: No match\n", data); + debug("%s: No match\n", data); return 1; } else { break; @@ -359,7 +359,7 @@ static int regex_sub_var(const char *name, const char *r, const char *s, if (ret) return 1; - printf("%s=%s\n", name, data); + debug("%s=%s\n", name, data); return env_set(name, data); } -- cgit v1.2.3 From b1433affd9a9de10150c31929564f68ca338911a Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Thu, 31 Aug 2023 10:51:37 -0600 Subject: cmd: gpt: Add gpt_partition_bootable variable Adds an additional variable called gpt_partition_bootable that indicates if the given partition is bootable or not. Signed-off-by: Joshua Watt --- cmd/gpt.c | 9 +++++++-- doc/usage/cmd/gpt.rst | 5 +++++ test/py/tests/test_gpt.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index 3cc6436b28b..ce85632377e 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -723,7 +723,7 @@ static int gpt_enumerate(struct blk_desc *desc) * gpt_setenv_part_variables() - setup partition environmental variables * * Setup the gpt_partition_name, gpt_partition_entry, gpt_partition_addr - * and gpt_partition_size environment variables. + * and gpt_partition_size, gpt_partition_bootable environment variables. * * @pinfo: pointer to disk partition * @i: partition entry @@ -750,6 +750,10 @@ static int gpt_setenv_part_variables(struct disk_partition *pinfo, int i) if (ret) goto fail; + ret = env_set_ulong("gpt_partition_bootable", !!(pinfo->bootable & PART_BOOTABLE)); + if (ret) + goto fail; + return 0; fail: @@ -1055,7 +1059,8 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, " gpt setenv mmc 0 $name\n" " - setup environment variables for partition $name:\n" " gpt_partition_addr, gpt_partition_size,\n" - " gpt_partition_name, gpt_partition_entry\n" + " gpt_partition_name, gpt_partition_entry,\n" + " gpt_partition_bootable\n" " gpt enumerate mmc 0\n" " - store list of partitions to gpt_partition_list environment variable\n" " gpt guid \n" diff --git a/doc/usage/cmd/gpt.rst b/doc/usage/cmd/gpt.rst index 6387c8116fe..b505b159d0a 100644 --- a/doc/usage/cmd/gpt.rst +++ b/doc/usage/cmd/gpt.rst @@ -108,6 +108,9 @@ gpt_partition_name gpt_partition_entry the partition number in the table, e.g. 1, 2, 3, etc. +gpt_partition_bootable + 1 if the partition is marked as bootable, 0 if not + gpt swap ~~~~~~~~ @@ -167,6 +170,8 @@ Get the information about the partition named 'rootfs':: rootfs => echo ${gpt_partition_entry} 2 + => echo ${gpt_partition_bootable} + 0 Get the list of partition names on the disk:: diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index 339468bc127..946858800d6 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -49,6 +49,7 @@ class GptTestDiskImage(object): u_boot_utils.run_and_log(u_boot_console, cmd) # part1 offset 1MB size 1MB cmd = ('sgdisk', '--new=1:2048:4095', '--change-name=1:part1', + '-A 1:set:2', persistent) # part2 offset 2MB size 1.5MB u_boot_utils.run_and_log(u_boot_console, cmd) @@ -117,6 +118,38 @@ def test_gpt_guid(state_disk_image, u_boot_console): output = u_boot_console.run_command('gpt guid host 0') assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.requiredtool('sgdisk') +def test_gpt_setenv(state_disk_image, u_boot_console): + """Test the gpt setenv command.""" + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + output = u_boot_console.run_command('gpt setenv host 0 part1') + assert 'success!' in output + output = u_boot_console.run_command('echo ${gpt_partition_addr}') + assert output.rstrip() == '800' + output = u_boot_console.run_command('echo ${gpt_partition_size}') + assert output.rstrip() == '800' + output = u_boot_console.run_command('echo ${gpt_partition_name}') + assert output.rstrip() == 'part1' + output = u_boot_console.run_command('echo ${gpt_partition_entry}') + assert output.rstrip() == '1' + output = u_boot_console.run_command('echo ${gpt_partition_bootable}') + assert output.rstrip() == '1' + + output = u_boot_console.run_command('gpt setenv host 0 part2') + assert 'success!' in output + output = u_boot_console.run_command('echo ${gpt_partition_addr}') + assert output.rstrip() == '1000' + output = u_boot_console.run_command('echo ${gpt_partition_size}') + assert output.rstrip() == 'c00' + output = u_boot_console.run_command('echo ${gpt_partition_name}') + assert output.rstrip() == 'part2' + output = u_boot_console.run_command('echo ${gpt_partition_entry}') + assert output.rstrip() == '2' + output = u_boot_console.run_command('echo ${gpt_partition_bootable}') + assert output.rstrip() == '0' + @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @pytest.mark.requiredtool('sgdisk') -- cgit v1.2.3 From a1e793add5dd21c2a1b08bc57ac99e43183913b6 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Thu, 31 Aug 2023 10:51:38 -0600 Subject: cmd: gpt: Add command to set bootable flags Adds a command that can be used to modify the GPT partition table to indicate which partitions should have the bootable flag set Signed-off-by: Joshua Watt --- cmd/gpt.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++ doc/usage/cmd/gpt.rst | 12 +++++++ test/py/tests/test_gpt.py | 22 +++++++++++++ 3 files changed, 114 insertions(+) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index ce85632377e..42e289c8724 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -970,6 +970,81 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm, free(partitions_list); return ret; } + +/** + * gpt_set_bootable() - Set bootable flags for partitions + * + * Sets the bootable flag for any partition names in the comma separated list of + * partition names. Any partitions not in the list have their bootable flag + * cleared + * + * @desc: block device descriptor + * @name: Comma separated list of partition names + * + * @Return: '0' on success and -ve error on failure + */ +static int gpt_set_bootable(struct blk_desc *blk_dev_desc, char *const part_list) +{ + char *name; + char disk_guid[UUID_STR_LEN + 1]; + struct list_head *pos; + struct disk_part *curr; + struct disk_partition *partitions = NULL; + int part_count = 0; + int ret = get_disk_guid(blk_dev_desc, disk_guid); + + if (ret < 0) + return ret; + + ret = get_gpt_info(blk_dev_desc); + if (ret <= 0) + goto out; + + part_count = ret; + partitions = malloc(sizeof(*partitions) * part_count); + if (!partitions) { + ret = -ENOMEM; + goto out; + } + + /* Copy partitions and clear bootable flag */ + part_count = 0; + list_for_each(pos, &disk_partitions) { + curr = list_entry(pos, struct disk_part, list); + partitions[part_count] = curr->gpt_part_info; + partitions[part_count].bootable &= ~PART_BOOTABLE; + part_count++; + } + + name = strtok(part_list, ","); + while (name) { + bool found = false; + + for (int i = 0; i < part_count; i++) { + if (strcmp((char *)partitions[i].name, name) == 0) { + partitions[i].bootable |= PART_BOOTABLE; + found = true; + } + } + + if (!found) { + printf("Warning: No partition matching '%s' found\n", + name); + } + + name = strtok(NULL, ","); + } + + ret = gpt_restore(blk_dev_desc, disk_guid, partitions, part_count); + +out: + del_gpt_info(); + + if (partitions) + free(partitions); + + return ret; +} #endif /** @@ -1029,6 +1104,8 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } else if ((strcmp(argv[1], "swap") == 0) || (strcmp(argv[1], "rename") == 0)) { ret = do_rename_gpt_parts(blk_dev_desc, argv[1], argv[4], argv[5]); + } else if ((strcmp(argv[1], "set-bootable") == 0)) { + ret = gpt_set_bootable(blk_dev_desc, argv[4]); #endif } else { return CMD_RET_USAGE; @@ -1080,8 +1157,11 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, " and vice-versa\n" " gpt rename \n" " - rename the specified partition\n" + " gpt set-bootable \n" + " - make partition names in list bootable\n" " Example usage:\n" " gpt swap mmc 0 foo bar\n" " gpt rename mmc 0 3 foo\n" + " gpt set-bootable mmc 0 boot_a,boot_b\n" #endif ); diff --git a/doc/usage/cmd/gpt.rst b/doc/usage/cmd/gpt.rst index b505b159d0a..288dd365c00 100644 --- a/doc/usage/cmd/gpt.rst +++ b/doc/usage/cmd/gpt.rst @@ -13,6 +13,7 @@ Synopsis gpt read [] gpt rename gpt repair + gpt set-bootable gpt setenv gpt swap gpt verify [] @@ -90,6 +91,13 @@ gpt repair Repairs the GPT partition tables if it they become corrupted. +gpt set-bootable +~~~~~~~~~~~~~~~~ + +Sets the bootable flag for all partitions in the table. If the partition name +is in 'partition list' (separated by ','), the bootable flag is set, otherwise +it is cleared. CONFIG_CMD_GPT_RENAME=y is required. + gpt setenv ~~~~~~~~~~ @@ -187,3 +195,7 @@ Get the GUID for a disk:: => gpt guid mmc gpt_disk_uuid => echo ${gpt_disk_uuid} bec9fc2a-86c1-483d-8a0e-0109732277d7 + +Set the bootable flag for the 'boot' partition and clear it for all others:: + + => gpt set-bootable mmc 0 boot diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index 946858800d6..5d23f9b2925 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -222,6 +222,28 @@ def test_gpt_swap_partitions(state_disk_image, u_boot_console): assert '0x00000800 0x00000fff "part2"' in output assert '0x00001000 0x00001bff "part1"' in output +@pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.buildconfigspec('cmd_gpt_rename') +@pytest.mark.buildconfigspec('cmd_part') +@pytest.mark.requiredtool('sgdisk') +def test_gpt_set_bootable(state_disk_image, u_boot_console): + """Test the gpt set-bootable command.""" + + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + parts = ('part2', 'part1') + for bootable in parts: + output = u_boot_console.run_command(f'gpt set-bootable host 0 {bootable}') + assert 'success!' in output + + for p in parts: + output = u_boot_console.run_command(f'gpt setenv host 0 {p}') + assert 'success!' in output + output = u_boot_console.run_command('echo ${gpt_partition_bootable}') + if p == bootable: + assert output.rstrip() == '1' + else: + assert output.rstrip() == '0' + @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @pytest.mark.buildconfigspec('cmd_part') -- cgit v1.2.3 From 368beaf7bb609b1daede46e3b31f5788d52e44e5 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Thu, 31 Aug 2023 10:51:39 -0600 Subject: cmd: gpt: Preserve type GUID if enabled If CONFIG_PARTITION_TYPE_GUID is enabled, the type GUID will be preserved when writing out the partition string. It was already respected when writing out partitions; this ensures that if you capture the current partition layout and write it back (such as when renaming), the type GUIDs are preserved. Signed-off-by: Joshua Watt --- cmd/gpt.c | 16 ++++++++++++ test/py/tests/test_gpt.py | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index 42e289c8724..9cc72934388 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -173,6 +173,9 @@ static int calc_parts_list_len(int numparts) /* see part.h for definition of struct disk_partition */ partlistlen += numparts * (strlen("start=MiB,") + sizeof(lbaint_t) + 1); partlistlen += numparts * (strlen("size=MiB,") + sizeof(lbaint_t) + 1); +#ifdef CONFIG_PARTITION_TYPE_GUID + partlistlen += numparts * (strlen("type=,") + UUID_STR_LEN + 1); +#endif partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1); /* for the terminating null */ partlistlen++; @@ -211,6 +214,11 @@ static struct disk_part *allocate_disk_part(struct disk_partition *info, PART_TYPE_LEN); newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0'; newpart->gpt_part_info.bootable = info->bootable; +#ifdef CONFIG_PARTITION_TYPE_GUID + strncpy(newpart->gpt_part_info.type_guid, (const char *)info->type_guid, + UUID_STR_LEN); + newpart->gpt_part_info.type_guid[UUID_STR_LEN] = '\0'; +#endif if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) { strlcpy(newpart->gpt_part_info.uuid, disk_partition_uuid(info), UUID_STR_LEN + 1); @@ -250,6 +258,9 @@ static void print_gpt_info(void) curr->gpt_part_info.name); printf("Type %s, bootable %d\n", curr->gpt_part_info.type, curr->gpt_part_info.bootable & PART_BOOTABLE); +#ifdef CONFIG_PARTITION_TYPE_GUID + printf("Type GUID %s\n", curr->gpt_part_info.type_guid); +#endif #ifdef CONFIG_PARTITION_UUIDS printf("UUID %s\n", curr->gpt_part_info.uuid); #endif @@ -297,6 +308,11 @@ static int create_gpt_partitions_list(int numparts, const char *guid, curr->gpt_part_info.blksz); strncat(partitions_list, partstr, PART_NAME_LEN + 1); +#ifdef CONFIG_PARTITION_TYPE_GUID + strcat(partitions_list, ",type="); + strncat(partitions_list, curr->gpt_part_info.type_guid, + UUID_STR_LEN + 1); +#endif strcat(partitions_list, ",uuid="); strncat(partitions_list, curr->gpt_part_info.uuid, UUID_STR_LEN + 1); diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index 5d23f9b2925..93007dee9a1 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -16,6 +16,35 @@ the test. # Mark all tests here as slow pytestmark = pytest.mark.slow +def parse_gpt_parts(disk_str): + """Parser a partition string into a list of partitions. + + Args: + disk_str: The disk description string, as returned by `gpt read` + + Returns: + A list of parsed partitions. Each partition is a dictionary with the + string value from each specified key in the partition description, or a + key with with the value True for a boolean flag + """ + parts = [] + for part_str in disk_str.split(';'): + part = {} + for option in part_str.split(","): + if not option: + continue + + if "=" in option: + key, value = option.split("=") + part[key] = value + else: + part[option] = True + + if part: + parts.append(part) + + return parts + class GptTestDiskImage(object): """Disk Image used by the GPT tests.""" @@ -49,11 +78,13 @@ class GptTestDiskImage(object): u_boot_utils.run_and_log(u_boot_console, cmd) # part1 offset 1MB size 1MB cmd = ('sgdisk', '--new=1:2048:4095', '--change-name=1:part1', + '--partition-guid=1:33194895-67f6-4561-8457-6fdeed4f50a3', '-A 1:set:2', persistent) # part2 offset 2MB size 1.5MB u_boot_utils.run_and_log(u_boot_console, cmd) cmd = ('sgdisk', '--new=2:4096:7167', '--change-name=2:part2', + '--partition-guid=2:cc9c6e4a-6551-4cb5-87be-3210f96c86fb', persistent) u_boot_utils.run_and_log(u_boot_console, cmd) cmd = ('sgdisk', '--load-backup=' + persistent) @@ -88,6 +119,40 @@ def test_gpt_read(state_disk_image, u_boot_console): assert '0x00000800 0x00000fff "part1"' in output assert '0x00001000 0x00001bff "part2"' in output +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.buildconfigspec('partition_type_guid') +@pytest.mark.requiredtool('sgdisk') +def test_gpt_read_var(state_disk_image, u_boot_console): + """Test the gpt read command.""" + + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + output = u_boot_console.run_command('gpt read host 0 gpt_parts') + assert 'success!' in output + + output = u_boot_console.run_command('echo ${gpt_parts}') + parts = parse_gpt_parts(output.rstrip()) + + assert parts == [ + { + "uuid_disk": "375a56f7-d6c9-4e81-b5f0-09d41ca89efe", + }, + { + "name": "part1", + "start": "0x100000", + "size": "0x100000", + "type": "0fc63daf-8483-4772-8e79-3d69d8477de4", + "uuid": "33194895-67f6-4561-8457-6fdeed4f50a3", + }, + { + "name": "part2", + "start": "0x200000", + "size": "0x180000", + "type": "0fc63daf-8483-4772-8e79-3d69d8477de4", + "uuid": "cc9c6e4a-6551-4cb5-87be-3210f96c86fb", + }, + ] + @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @pytest.mark.requiredtool('sgdisk') -- cgit v1.2.3 From 648140f77aff55d3bab072166a88ef179c474524 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Thu, 31 Aug 2023 10:51:40 -0600 Subject: cmd: gpt: Preserve bootable flag Sets the bootable flag when constructing the partition string from the current partition configuration. This ensures that when the partitions are written back (for example, when renaming a partition), the flag is preserved. Signed-off-by: Joshua Watt --- cmd/gpt.c | 3 +++ test/py/tests/test_gpt.py | 1 + 2 files changed, 4 insertions(+) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index 9cc72934388..d5256035c3a 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -176,6 +176,7 @@ static int calc_parts_list_len(int numparts) #ifdef CONFIG_PARTITION_TYPE_GUID partlistlen += numparts * (strlen("type=,") + UUID_STR_LEN + 1); #endif + partlistlen += numparts * strlen("bootable,"); partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1); /* for the terminating null */ partlistlen++; @@ -316,6 +317,8 @@ static int create_gpt_partitions_list(int numparts, const char *guid, strcat(partitions_list, ",uuid="); strncat(partitions_list, curr->gpt_part_info.uuid, UUID_STR_LEN + 1); + if (curr->gpt_part_info.bootable & PART_BOOTABLE) + strcat(partitions_list, ",bootable"); strcat(partitions_list, ";"); } return 0; diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index 93007dee9a1..b4c03bc3a2d 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -143,6 +143,7 @@ def test_gpt_read_var(state_disk_image, u_boot_console): "size": "0x100000", "type": "0fc63daf-8483-4772-8e79-3d69d8477de4", "uuid": "33194895-67f6-4561-8457-6fdeed4f50a3", + "bootable": True, }, { "name": "part2", -- cgit v1.2.3 From 7cc1d87d7e1e64d7bb280ead94c55a51c4f3ee63 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Thu, 31 Aug 2023 10:51:41 -0600 Subject: cmd: gpt: Add command to swap partition order Adds a command called "gpt transpose" which will swap the order two partition table entries in the GPT partition table (but leaves them pointing to the same locations on disk). This can be useful for swapping bootloaders in systems that use an A/B partitioning scheme where the bootrom is hard coded to look for the bootloader in a specific index in the GPT partition table. Signed-off-by: Joshua Watt --- cmd/gpt.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- doc/usage/cmd/gpt.rst | 25 +++++++++++++++++++++++++ test/py/tests/test_gpt.py | 19 +++++++++++++++++++ 3 files changed, 87 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index d5256035c3a..d4068ee63d1 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -856,8 +856,9 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm, u8 part_count = 0; int partlistlen, ret, numparts = 0, partnum, i = 1, ctr1 = 0, ctr2 = 0; - if ((subcomm == NULL) || (name1 == NULL) || (name2 == NULL) || - (strcmp(subcomm, "swap") && (strcmp(subcomm, "rename")))) + if (!subcomm || !name1 || !name2 || + (strcmp(subcomm, "swap") && strcmp(subcomm, "rename") && + strcmp(subcomm, "transpose"))) return -EINVAL; ret = get_disk_guid(dev_desc, disk_guid); @@ -918,6 +919,41 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm, ret = -EINVAL; goto out; } + } else if (!strcmp(subcomm, "transpose")) { + int idx1, idx2; + struct disk_partition* first = NULL; + struct disk_partition* second= NULL; + struct disk_partition tmp_part; + + idx1 = simple_strtoul(name1, NULL, 10); + idx2 = simple_strtoul(name2, NULL, 10); + if (idx1 == idx2) { + printf("Cannot swap partition with itself\n"); + ret = -EINVAL; + goto out; + } + + list_for_each(pos, &disk_partitions) { + curr = list_entry(pos, struct disk_part, list); + if (curr->partnum == idx1) + first = &curr->gpt_part_info; + else if (curr->partnum == idx2) + second = &curr->gpt_part_info; + } + if (!first) { + printf("Illegal partition number %s\n", name1); + ret = -EINVAL; + goto out; + } + if (!second) { + printf("Illegal partition number %s\n", name2); + ret = -EINVAL; + goto out; + } + + tmp_part = *first; + *first = *second; + *second = tmp_part; } else { /* rename */ if (strlen(name2) > PART_NAME_LEN) { printf("Names longer than %d characters are truncated.\n", PART_NAME_LEN); @@ -1121,7 +1157,8 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } else if (strcmp(argv[1], "read") == 0) { ret = do_get_gpt_info(blk_dev_desc, (argc == 5) ? argv[4] : NULL); } else if ((strcmp(argv[1], "swap") == 0) || - (strcmp(argv[1], "rename") == 0)) { + (strcmp(argv[1], "rename") == 0) || + (strcmp(argv[1], "transpose") == 0)) { ret = do_rename_gpt_parts(blk_dev_desc, argv[1], argv[4], argv[5]); } else if ((strcmp(argv[1], "set-bootable") == 0)) { ret = gpt_set_bootable(blk_dev_desc, argv[4]); @@ -1174,6 +1211,8 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, " gpt swap \n" " - change all partitions named name1 to name2\n" " and vice-versa\n" + " gpt transpose \n" + " - Swap the order of the entries for part1 and part2 in the partition table\n" " gpt rename \n" " - rename the specified partition\n" " gpt set-bootable \n" @@ -1182,5 +1221,6 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, " gpt swap mmc 0 foo bar\n" " gpt rename mmc 0 3 foo\n" " gpt set-bootable mmc 0 boot_a,boot_b\n" + " gpt transpose mmc 0 1 2\n" #endif ); diff --git a/doc/usage/cmd/gpt.rst b/doc/usage/cmd/gpt.rst index 288dd365c00..f6115ecb0ee 100644 --- a/doc/usage/cmd/gpt.rst +++ b/doc/usage/cmd/gpt.rst @@ -16,6 +16,7 @@ Synopsis gpt set-bootable gpt setenv gpt swap + gpt transpose gpt verify [] gpt write @@ -126,6 +127,13 @@ Changes the names of all partitions that are named 'name1' to be 'name2', and all partitions named 'name2' to be 'name1'. CONFIG_CMD_GPT_RENAME=y is required. +gpt transpose +~~~~~~~~~~~~~ + +Swaps the order of two partition table entries with indexes 'part1' and 'part2' +in the partition table, but otherwise leaves the actual partition data +untouched. + gpt verify ~~~~~~~~~~ @@ -199,3 +207,20 @@ Get the GUID for a disk:: Set the bootable flag for the 'boot' partition and clear it for all others:: => gpt set-bootable mmc 0 boot + +Swap the order of the 'boot' and 'rootfs' partition table entries:: + => gpt setenv mmc 0 rootfs + => echo ${gpt_partition_entry} + 2 + => gpt setenv mmc 0 boot + => echo ${gpt_partition_entry} + 1 + + => gpt transpose mmc 0 1 2 + + => gpt setenv mmc 0 rootfs + => echo ${gpt_partition_entry} + 1 + => gpt setenv mmc 0 boot + => echo ${gpt_partition_entry} + 2 diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index b4c03bc3a2d..6e135b663e8 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -329,3 +329,22 @@ def test_gpt_write(state_disk_image, u_boot_console): assert '0x00001000 0x00001bff "second"' in output output = u_boot_console.run_command('gpt guid host 0') assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output + +@pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.buildconfigspec('cmd_gpt_rename') +@pytest.mark.buildconfigspec('cmd_part') +@pytest.mark.requiredtool('sgdisk') +def test_gpt_transpose(state_disk_image, u_boot_console): + """Test the gpt transpose command.""" + + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + output = u_boot_console.run_command('part list host 0') + assert '1\t0x00000800\t0x00000fff\t"part1"' in output + assert '2\t0x00001000\t0x00001bff\t"part2"' in output + + output = u_boot_console.run_command('gpt transpose host 0 1 2') + assert 'success!' in output + + output = u_boot_console.run_command('part list host 0') + assert '2\t0x00000800\t0x00000fff\t"part1"' in output + assert '1\t0x00001000\t0x00001bff\t"part2"' in output -- cgit v1.2.3 From 396f315520bcbcc2b710ab696326b239577c1ad2 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 2 Sep 2023 09:35:22 +0200 Subject: cmd: gpt: use UUID accessor more consistently disk_partition_uuid() and disk_partition_set_uuid() were introduced to let us avoid the usage of #ifdef when dealing with the field uuid of struct disk_partition. In allocate_disk_part() commit c5f1d005f517 ("part: Add accessors for struct disk_partition uuid") missed to use the setter. print_gpt_info() and create_gpt_partitions_list() are further functions where we should use the getter. Fixes: c5f1d005f517 ("part: Add accessors for struct disk_partition uuid") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- cmd/gpt.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index d4068ee63d1..96cd8efaafb 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -220,10 +220,9 @@ static struct disk_part *allocate_disk_part(struct disk_partition *info, UUID_STR_LEN); newpart->gpt_part_info.type_guid[UUID_STR_LEN] = '\0'; #endif - if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) { - strlcpy(newpart->gpt_part_info.uuid, disk_partition_uuid(info), - UUID_STR_LEN + 1); - } + if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) + disk_partition_set_uuid(&newpart->gpt_part_info, + disk_partition_uuid(info)); newpart->partnum = partnum; return newpart; @@ -262,9 +261,9 @@ static void print_gpt_info(void) #ifdef CONFIG_PARTITION_TYPE_GUID printf("Type GUID %s\n", curr->gpt_part_info.type_guid); #endif -#ifdef CONFIG_PARTITION_UUIDS - printf("UUID %s\n", curr->gpt_part_info.uuid); -#endif + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) + printf("UUID %s\n", + disk_partition_uuid(&curr->gpt_part_info)); printf("\n"); } } @@ -314,9 +313,12 @@ static int create_gpt_partitions_list(int numparts, const char *guid, strncat(partitions_list, curr->gpt_part_info.type_guid, UUID_STR_LEN + 1); #endif - strcat(partitions_list, ",uuid="); - strncat(partitions_list, curr->gpt_part_info.uuid, - UUID_STR_LEN + 1); + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + strcat(partitions_list, ",uuid="); + strncat(partitions_list, + disk_partition_uuid(&curr->gpt_part_info), + UUID_STR_LEN + 1); + } if (curr->gpt_part_info.bootable & PART_BOOTABLE) strcat(partitions_list, ",bootable"); strcat(partitions_list, ";"); -- cgit v1.2.3 From 69f4d37302583c3a2c8445ff69826c52c6fce7e3 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 2 Sep 2023 09:35:23 +0200 Subject: cmd: gpt: fix calc_parts_list_len() * Avoid incrementing by moving comma into strlen("uuid_disk=,") and considering NUL byte. * Appending a UUID only adds UUID_STR_LEN bytes. Don't count the terminating NUL. * The length of the hexadecimal representation of lba_int is 2 * sizeof(lba_int). * We don't use a 'MiB' postfix but a '0x' prefix. * The uuid field is only needed if configured. Fixes: 2fcaa413b3f6 ("gpt: harden set_gpt_info() against non NULL-terminated strings") Signed-off-by: Heinrich Schuchardt --- cmd/gpt.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index 96cd8efaafb..c404785c1d1 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -162,26 +162,32 @@ static bool found_key(const char *str, const char *key) return result; } +/** + * calc_parts_list_len() - get size of partition table description + * + * @numparts: number of partitions + * Return: string size including terminating NUL + */ static int calc_parts_list_len(int numparts) { - int partlistlen = UUID_STR_LEN + 1 + strlen("uuid_disk="); - /* for the comma */ - partlistlen++; - - /* per-partition additions; numparts starts at 1, so this should be correct */ - partlistlen += numparts * (strlen("name=,") + PART_NAME_LEN + 1); + /* number of hexadecimal digits of the lbaint_t representation */ + const int lbaint_size = 2 * sizeof(lbaint_t); + int partlistlen; + + /* media description including terminating NUL */ + partlistlen = strlen("uuid_disk=;") + UUID_STR_LEN + 1; + /* per-partition descriptions; numparts */ + partlistlen += numparts * (strlen("name=,") + PART_NAME_LEN); /* see part.h for definition of struct disk_partition */ - partlistlen += numparts * (strlen("start=MiB,") + sizeof(lbaint_t) + 1); - partlistlen += numparts * (strlen("size=MiB,") + sizeof(lbaint_t) + 1); + partlistlen += numparts * (strlen("start=0x,") + lbaint_size); + partlistlen += numparts * (strlen("size=0x,") + lbaint_size); #ifdef CONFIG_PARTITION_TYPE_GUID partlistlen += numparts * (strlen("type=,") + UUID_STR_LEN + 1); #endif - partlistlen += numparts * strlen("bootable,"); - partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1); - /* for the terminating null */ - partlistlen++; - debug("Length of partitions_list is %d for %d partitions\n", partlistlen, - numparts); + if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) + partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN); + debug("Length of partitions_list is %d for %d partitions\n", + partlistlen, numparts); return partlistlen; } -- cgit v1.2.3 From f5e4b056c47215cdbe8d8e30a12b036b7a6afa8d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 2 Sep 2023 09:35:24 +0200 Subject: cmd: gpt: fix gpt read To partition a block device the partition type GUIDs are needed but 'gpt read' does not provide these. Add the missing parts. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- cmd/gpt.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'cmd') diff --git a/cmd/gpt.c b/cmd/gpt.c index c404785c1d1..d7e96529a69 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -181,11 +181,10 @@ static int calc_parts_list_len(int numparts) /* see part.h for definition of struct disk_partition */ partlistlen += numparts * (strlen("start=0x,") + lbaint_size); partlistlen += numparts * (strlen("size=0x,") + lbaint_size); -#ifdef CONFIG_PARTITION_TYPE_GUID - partlistlen += numparts * (strlen("type=,") + UUID_STR_LEN + 1); -#endif if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) - partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN); + partlistlen += numparts * (strlen("uuid=,") + UUID_STR_LEN); + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) + partlistlen += numparts * (strlen("type=;") + UUID_STR_LEN); debug("Length of partitions_list is %d for %d partitions\n", partlistlen, numparts); return partlistlen; @@ -221,14 +220,12 @@ static struct disk_part *allocate_disk_part(struct disk_partition *info, PART_TYPE_LEN); newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0'; newpart->gpt_part_info.bootable = info->bootable; -#ifdef CONFIG_PARTITION_TYPE_GUID - strncpy(newpart->gpt_part_info.type_guid, (const char *)info->type_guid, - UUID_STR_LEN); - newpart->gpt_part_info.type_guid[UUID_STR_LEN] = '\0'; -#endif if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) disk_partition_set_uuid(&newpart->gpt_part_info, disk_partition_uuid(info)); + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) + disk_partition_set_type_guid(&newpart->gpt_part_info, + disk_partition_type_guid(info)); newpart->partnum = partnum; return newpart; @@ -264,12 +261,12 @@ static void print_gpt_info(void) curr->gpt_part_info.name); printf("Type %s, bootable %d\n", curr->gpt_part_info.type, curr->gpt_part_info.bootable & PART_BOOTABLE); -#ifdef CONFIG_PARTITION_TYPE_GUID - printf("Type GUID %s\n", curr->gpt_part_info.type_guid); -#endif if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) printf("UUID %s\n", disk_partition_uuid(&curr->gpt_part_info)); + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) + printf("Type GUID %s\n", + disk_partition_type_guid(&curr->gpt_part_info)); printf("\n"); } } @@ -314,11 +311,12 @@ static int create_gpt_partitions_list(int numparts, const char *guid, curr->gpt_part_info.blksz); strncat(partitions_list, partstr, PART_NAME_LEN + 1); -#ifdef CONFIG_PARTITION_TYPE_GUID - strcat(partitions_list, ",type="); - strncat(partitions_list, curr->gpt_part_info.type_guid, - UUID_STR_LEN + 1); -#endif + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) { + strcat(partitions_list, ",type="); + strncat(partitions_list, + disk_partition_type_guid(&curr->gpt_part_info), + UUID_STR_LEN + 1); + } if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { strcat(partitions_list, ",uuid="); strncat(partitions_list, -- cgit v1.2.3 From 446d6643033edffd4b832de71ef190533398bd91 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Sep 2023 23:29:41 +0200 Subject: boot: Remove unused NEEDS_MANUAL_RELOC code bits The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut --- boot/bootm_os.c | 14 -------------- boot/image-sig.c | 28 ---------------------------- cmd/bootm.c | 14 -------------- 3 files changed, 56 deletions(-) (limited to 'cmd') diff --git a/boot/bootm_os.c b/boot/bootm_os.c index 99ff0e6c02d..9c035b5be88 100644 --- a/boot/bootm_os.c +++ b/boot/bootm_os.c @@ -609,19 +609,5 @@ int boot_selected_os(int argc, char *const argv[], int state, boot_os_fn *bootm_os_get_boot_func(int os) { -#ifdef CONFIG_NEEDS_MANUAL_RELOC - static bool relocated; - - if (!relocated) { - int i; - - /* relocate boot function table */ - for (i = 0; i < ARRAY_SIZE(boot_os); i++) - if (boot_os[i] != NULL) - boot_os[i] += gd->reloc_off; - - relocated = true; - } -#endif return boot_os[os]; } diff --git a/boot/image-sig.c b/boot/image-sig.c index 1aa0b586450..b5692d58b24 100644 --- a/boot/image-sig.c +++ b/boot/image-sig.c @@ -57,20 +57,6 @@ struct checksum_algo *image_get_checksum_algo(const char *full_name) int i; const char *name; - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) { - static bool done; - - if (!done) { - done = true; - for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) { - struct checksum_algo *algo = &checksum_algos[i]; - - MANUAL_RELOC(algo->name); - MANUAL_RELOC(algo->calculate); - } - } - } - for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) { name = checksum_algos[i].name; /* Make sure names match and next char is a comma */ @@ -87,20 +73,6 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name) struct crypto_algo *crypto, *end; const char *name; - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) { - static bool done; - - if (!done) { - done = true; - crypto = ll_entry_start(struct crypto_algo, cryptos); - end = ll_entry_end(struct crypto_algo, cryptos); - for (; crypto < end; crypto++) { - MANUAL_RELOC(crypto->name); - MANUAL_RELOC(crypto->verify); - } - } - } - /* Move name to after the comma */ name = strchr(full_name, ','); if (!name) diff --git a/cmd/bootm.c b/cmd/bootm.c index 37c2af96e08..7968415b6d1 100644 --- a/cmd/bootm.c +++ b/cmd/bootm.c @@ -123,20 +123,6 @@ int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int states; int ret; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - static int relocated = 0; - - if (!relocated) { - int i; - - /* relocate names of sub-command table */ - for (i = 0; i < ARRAY_SIZE(cmd_bootm_sub); i++) - cmd_bootm_sub[i].name += gd->reloc_off; - - relocated = 1; - } -#endif - /* determine if we have a sub command */ argc--; argv++; if (argc > 0) { -- cgit v1.2.3 From 4fa6511e8c05f2b1bd2d4b969b5c9d6cc49228ff Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Sep 2023 23:29:42 +0200 Subject: blkcache: Remove unused NEEDS_MANUAL_RELOC code bits The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut --- cmd/blkcache.c | 13 ------------- common/board_r.c | 3 --- drivers/block/blkcache.c | 16 ---------------- include/blk.h | 6 ------ 4 files changed, 38 deletions(-) (limited to 'cmd') diff --git a/cmd/blkcache.c b/cmd/blkcache.c index 47ea1ec0b93..1456654df6f 100644 --- a/cmd/blkcache.c +++ b/cmd/blkcache.c @@ -46,24 +46,11 @@ static struct cmd_tbl cmd_blkc_sub[] = { U_BOOT_CMD_MKENT(configure, 3, 0, blkc_configure, "", ""), }; -static __maybe_unused void blkc_reloc(void) -{ - static int relocated; - - if (!relocated) { - fixup_cmdtable(cmd_blkc_sub, ARRAY_SIZE(cmd_blkc_sub)); - relocated = 1; - }; -} - static int do_blkcache(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *c; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - blkc_reloc(); -#endif if (argc < 2) return CMD_RET_USAGE; diff --git a/common/board_r.c b/common/board_r.c index ad9a3cf6336..697d4a5bd3d 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -657,9 +657,6 @@ static init_fnc_t init_sequence_r[] = { initr_watchdog, #endif INIT_FUNC_WATCHDOG_RESET -#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE) - blkcache_init, -#endif #ifdef CONFIG_NEEDS_MANUAL_RELOC initr_manual_reloc_cmdtable, #endif diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c index f99465aa479..26bcbea4353 100644 --- a/drivers/block/blkcache.c +++ b/drivers/block/blkcache.c @@ -13,10 +13,6 @@ #include #include -#ifdef CONFIG_NEEDS_MANUAL_RELOC -DECLARE_GLOBAL_DATA_PTR; -#endif - struct block_cache_node { struct list_head lh; int iftype; @@ -34,18 +30,6 @@ static struct block_cache_stats _stats = { .max_entries = 32 }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -int blkcache_init(void) -{ - struct list_head *head = &block_cache; - - head->next = (uintptr_t)head->next + gd->reloc_off; - head->prev = (uintptr_t)head->prev + gd->reloc_off; - - return 0; -} -#endif - static struct block_cache_node *cache_find(int iftype, int devnum, lbaint_t start, lbaint_t blkcnt, unsigned long blksz) diff --git a/include/blk.h b/include/blk.h index b819f97c2f1..95e86e2d5d1 100644 --- a/include/blk.h +++ b/include/blk.h @@ -105,12 +105,6 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz)) #if CONFIG_IS_ENABLED(BLOCK_CACHE) - -/** - * blkcache_init() - initialize the block cache list pointers - */ -int blkcache_init(void); - /** * blkcache_read() - attempt to read a set of blocks from cache * -- cgit v1.2.3 From 8658370a92f197aea9f854b2f94a3cd702d2713a Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Sep 2023 23:29:51 +0200 Subject: cmd: date: Remove unused NEEDS_MANUAL_RELOC code bits The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut --- cmd/date.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/date.c b/cmd/date.c index fe9c8c6534e..4f98b470ca2 100644 --- a/cmd/date.c +++ b/cmd/date.c @@ -20,12 +20,6 @@ static const char * const weekdays[] = { "Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -#define RELOC(a) ((typeof(a))((unsigned long)(a) + gd->reloc_off)) -#else -#define RELOC(a) a -#endif - int mk_date (const char *, struct rtc_time *); static struct rtc_time default_tm = { 0, 0, 0, 1, 1, 2000, 6, 0, 0 }; @@ -113,7 +107,7 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc, printf ("Date: %4d-%02d-%02d (%sday) Time: %2d:%02d:%02d\n", tm.tm_year, tm.tm_mon, tm.tm_mday, (tm.tm_wday<0 || tm.tm_wday>6) ? - "unknown " : RELOC(weekdays[tm.tm_wday]), + "unknown " : weekdays[tm.tm_wday], tm.tm_hour, tm.tm_min, tm.tm_sec); break; -- cgit v1.2.3 From 05f84bd2acc698b22395f14b1e78825a6c085d6a Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Sep 2023 23:29:52 +0200 Subject: cmd: i2c: Remove unused NEEDS_MANUAL_RELOC code bits The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut --- cmd/i2c.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'cmd') diff --git a/cmd/i2c.c b/cmd/i2c.c index dd803ee2271..f0a5fa2e741 100644 --- a/cmd/i2c.c +++ b/cmd/i2c.c @@ -1939,16 +1939,6 @@ static struct cmd_tbl cmd_i2c_sub[] = { U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""), }; -static __maybe_unused void i2c_reloc(void) -{ - static int relocated; - - if (!relocated) { - fixup_cmdtable(cmd_i2c_sub, ARRAY_SIZE(cmd_i2c_sub)); - relocated = 1; - }; -} - /** * do_i2c() - Handle the "i2c" command-line command * @cmdtp: Command data struct pointer @@ -1963,10 +1953,6 @@ static int do_i2c(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *c; -#ifdef CONFIG_NEEDS_MANUAL_RELOC - i2c_reloc(); -#endif - if (argc < 2) return CMD_RET_USAGE; -- cgit v1.2.3 From a28cc807fa3abbd3602982c88f1c419c80a7e8b8 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Sep 2023 23:29:53 +0200 Subject: cmd: nvedit: Remove unused NEEDS_MANUAL_RELOC code bits The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut --- cmd/nvedit.c | 11 ----------- env/common.c | 1 - include/env.h | 8 -------- 3 files changed, 20 deletions(-) (limited to 'cmd') diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 9e4ee4b0177..fe99157fd17 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -407,11 +407,7 @@ static int print_active_callback(struct env_entry *entry) for (i = 0, clbkp = ll_entry_start(struct env_clbk_tbl, env_clbk); i < num_callbacks; i++, clbkp++) { -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - if (entry->callback == clbkp->callback + gd->reloc_off) -#else if (entry->callback == clbkp->callback) -#endif break; } @@ -1222,13 +1218,6 @@ static struct cmd_tbl cmd_env_sub[] = { #endif }; -#if defined(CONFIG_NEEDS_MANUAL_RELOC) -void env_reloc(void) -{ - fixup_cmdtable(cmd_env_sub, ARRAY_SIZE(cmd_env_sub)); -} -#endif - static int do_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *cp; diff --git a/env/common.c b/env/common.c index 0ecdb248a08..4cf2dadc694 100644 --- a/env/common.c +++ b/env/common.c @@ -429,7 +429,6 @@ int env_export(env_t *env_out) void env_relocate(void) { #if defined(CONFIG_NEEDS_MANUAL_RELOC) - env_reloc(); env_fix_drivers(); env_htab.change_ok += gd->reloc_off; #endif diff --git a/include/env.h b/include/env.h index 1480efa59e3..b28886d80b9 100644 --- a/include/env.h +++ b/include/env.h @@ -356,14 +356,6 @@ char *env_get_default(const char *name); /* [re]set to the default environment */ void env_set_default(const char *s, int flags); -/** - * env_reloc() - Relocate the 'env' sub-commands - * - * This is used for those unfortunate archs with crappy toolchains - */ -void env_reloc(void); - - /** * env_import_fdt() - Import environment values from device tree blob * -- cgit v1.2.3 From d1e57979884c4cfca24fb4b9ad8298654ecf2e23 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Sep 2023 23:29:54 +0200 Subject: cmd: onenand: Remove unused NEEDS_MANUAL_RELOC code bits The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut --- cmd/onenand.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'cmd') diff --git a/cmd/onenand.c b/cmd/onenand.c index d633f19d3bb..3ec11246f6f 100644 --- a/cmd/onenand.c +++ b/cmd/onenand.c @@ -560,12 +560,6 @@ static struct cmd_tbl cmd_onenand_sub[] = { U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0, do_onenand_markbad, "", ""), }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -void onenand_reloc(void) { - fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub)); -} -#endif - static int do_onenand(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { -- cgit v1.2.3 From 0d67e25bd28e132cead6cc4d387e341588d284cc Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Sep 2023 23:29:55 +0200 Subject: cmd: pxe: Remove unused NEEDS_MANUAL_RELOC code bits The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut --- cmd/pxe.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'cmd') diff --git a/cmd/pxe.c b/cmd/pxe.c index 7bfb1b9b280..704589702f2 100644 --- a/cmd/pxe.c +++ b/cmd/pxe.c @@ -299,24 +299,10 @@ static struct cmd_tbl cmd_pxe_sub[] = { U_BOOT_CMD_MKENT(boot, 3, 1, do_pxe_boot, "", "") }; -static void __maybe_unused pxe_reloc(void) -{ - static int relocated_pxe; - - if (!relocated_pxe) { - fixup_cmdtable(cmd_pxe_sub, ARRAY_SIZE(cmd_pxe_sub)); - relocated_pxe = 1; - } -} - static int do_pxe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *cp; -#if defined(CONFIG_NEEDS_MANUAL_RELOC) - pxe_reloc(); -#endif - if (argc < 2) return CMD_RET_USAGE; -- cgit v1.2.3 From bac356c3082cc0b6b8da60ce3366c09229181ac0 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 1 Sep 2023 11:49:50 +0200 Subject: cmd: fastboot: Use plain udevice for UDC controller interaction Convert to plain udevice interaction with UDC controller device, avoid the use of UDC uclass dev_array . Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek # on khadas vim3 Signed-off-by: Marek Vasut --- cmd/fastboot.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/fastboot.c b/cmd/fastboot.c index 3d5ff951eb6..17fb0a0aa7b 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -61,6 +61,7 @@ static int do_fastboot_usb(int argc, char *const argv[], { int controller_index; char *usb_controller; + struct udevice *udc; char *endp; int ret; @@ -79,7 +80,7 @@ static int do_fastboot_usb(int argc, char *const argv[], return CMD_RET_FAILURE; } - ret = usb_gadget_initialize(controller_index); + ret = udc_device_get_by_index(controller_index, &udc); if (ret) { pr_err("USB init failed: %d\n", ret); return CMD_RET_FAILURE; @@ -103,13 +104,13 @@ static int do_fastboot_usb(int argc, char *const argv[], if (ctrlc()) break; schedule(); - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); } ret = CMD_RET_SUCCESS; exit: - usb_gadget_release(controller_index); + udc_device_put(udc); g_dnl_unregister(); g_dnl_clear_detach(); -- cgit v1.2.3 From 0669a929b87d4ef5d8f1617e096e6b248ed61108 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 1 Sep 2023 11:49:51 +0200 Subject: cmd: rockusb: Use plain udevice for UDC controller interaction Convert to plain udevice interaction with UDC controller device, avoid the use of UDC uclass dev_array . Signed-off-by: Marek Vasut Reviewed-by: Mattijs Korpershoek --- cmd/rockusb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/rockusb.c b/cmd/rockusb.c index f181ec61119..07088564a10 100644 --- a/cmd/rockusb.c +++ b/cmd/rockusb.c @@ -15,6 +15,7 @@ static int do_rockusb(struct cmd_tbl *cmdtp, int flag, int argc, { int controller_index, dev_index; char *usb_controller; + struct udevice *udc; char *devtype; char *devnum; int ret; @@ -34,7 +35,7 @@ static int do_rockusb(struct cmd_tbl *cmdtp, int flag, int argc, dev_index = simple_strtoul(devnum, NULL, 0); rockusb_dev_init(devtype, dev_index); - ret = usb_gadget_initialize(controller_index); + ret = udc_device_get_by_index(controller_index, &udc); if (ret) { printf("USB init failed: %d\n", ret); return CMD_RET_FAILURE; @@ -56,14 +57,14 @@ static int do_rockusb(struct cmd_tbl *cmdtp, int flag, int argc, break; if (ctrlc()) break; - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); } ret = CMD_RET_SUCCESS; exit: g_dnl_unregister(); g_dnl_clear_detach(); - usb_gadget_release(controller_index); + udc_device_put(udc); return ret; } -- cgit v1.2.3 From 37fb7cb7f815a99266e8b5beb55f99e33396dcf5 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 1 Sep 2023 11:49:52 +0200 Subject: cmd: sdp: Reorder variable declaration Move the variable declaration around to improve code readability. No functional change. Reviewed-by: Mattijs Korpershoek Signed-off-by: Marek Vasut --- cmd/usb_gadget_sdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c index 1af82e11366..784d1b49768 100644 --- a/cmd/usb_gadget_sdp.c +++ b/cmd/usb_gadget_sdp.c @@ -14,13 +14,13 @@ static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + int controller_index; int ret; if (argc < 2) return CMD_RET_USAGE; - char *usb_controller = argv[1]; - int controller_index = simple_strtoul(usb_controller, NULL, 0); + controller_index = simple_strtoul(argv[1], NULL, 0); usb_gadget_initialize(controller_index); g_dnl_clear_detach(); -- cgit v1.2.3 From 76dd459487444fab1aabee848053df9d993efa1d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 1 Sep 2023 11:49:53 +0200 Subject: cmd: thordown: Reorder variable declaration Move the variable declaration around to improve code readability. No functional change. Signed-off-by: Marek Vasut Reviewed-by: Mattijs Korpershoek --- cmd/thordown.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/thordown.c b/cmd/thordown.c index 838764ccef7..0d8dcee5314 100644 --- a/cmd/thordown.c +++ b/cmd/thordown.c @@ -15,22 +15,23 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + char *interface, *devstring; + int controller_index; + int ret; + if (argc < 4) return CMD_RET_USAGE; - char *usb_controller = argv[1]; - char *interface = argv[2]; - char *devstring = argv[3]; - - int ret; - puts("TIZEN \"THOR\" Downloader\n"); + interface = argv[2]; + devstring = argv[3]; + ret = dfu_init_env_entities(interface, devstring); if (ret) goto done; - int controller_index = simple_strtoul(usb_controller, NULL, 0); + controller_index = simple_strtoul(argv[1], NULL, 0); ret = usb_gadget_initialize(controller_index); if (ret) { pr_err("USB init failed: %d\n", ret); -- cgit v1.2.3 From f032260c7c336cf88c1914286fd42a1588080db3 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 1 Sep 2023 11:49:54 +0200 Subject: cmd: ums: Use plain udevice for UDC controller interaction Convert to plain udevice interaction with UDC controller device, avoid the use of UDC uclass dev_array . Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek # on khadas vim3 Signed-off-by: Marek Vasut --- cmd/usb_mass_storage.c | 10 ++++++---- drivers/usb/gadget/f_mass_storage.c | 8 ++++---- include/usb_mass_storage.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'cmd') diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index c3cc1975f9d..9c51ae0967f 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -143,6 +143,7 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, const char *devtype; const char *devnum; unsigned int controller_index; + struct udevice *udc; int rc; int cable_ready_timeout __maybe_unused; @@ -164,13 +165,14 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, controller_index = (unsigned int)(simple_strtoul( usb_controller, NULL, 0)); - if (usb_gadget_initialize(controller_index)) { + rc = udc_device_get_by_index(controller_index, &udc); + if (rc) { pr_err("Couldn't init USB controller.\n"); rc = CMD_RET_FAILURE; goto cleanup_ums_init; } - rc = fsg_init(ums, ums_count, controller_index); + rc = fsg_init(ums, ums_count, udc); if (rc) { pr_err("fsg_init failed\n"); rc = CMD_RET_FAILURE; @@ -215,7 +217,7 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, } while (1) { - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); rc = fsg_main_thread(NULL); if (rc) { @@ -247,7 +249,7 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, cleanup_register: g_dnl_unregister(); cleanup_board: - usb_gadget_release(controller_index); + udc_device_put(udc); cleanup_ums_init: ums_fini(); diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index f46829eb7ad..1d17331cb03 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -435,7 +435,7 @@ static void set_bulk_out_req_length(struct fsg_common *common, static struct ums *ums; static int ums_count; static struct fsg_common *the_fsg_common; -static unsigned int controller_index; +static struct udevice *udcdev; static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) { @@ -680,7 +680,7 @@ static int sleep_thread(struct fsg_common *common) k = 0; } - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udcdev); } common->thread_wakeup_needed = 0; return rc; @@ -2764,11 +2764,11 @@ int fsg_add(struct usb_configuration *c) return fsg_bind_config(c->cdev, c, fsg_common); } -int fsg_init(struct ums *ums_devs, int count, unsigned int controller_idx) +int fsg_init(struct ums *ums_devs, int count, struct udevice *udc) { ums = ums_devs; ums_count = count; - controller_index = controller_idx; + udcdev = udc; return 0; } diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index 08ccc97cf22..83ab93b530d 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -25,7 +25,7 @@ struct ums { struct blk_desc block_dev; }; -int fsg_init(struct ums *ums_devs, int count, unsigned int controller_idx); +int fsg_init(struct ums *ums_devs, int count, struct udevice *udc); void fsg_cleanup(void); int fsg_main_thread(void *); int fsg_add(struct usb_configuration *c); -- cgit v1.2.3 From 6b84acc978d39d2e46ddceab292ae67174c66b40 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 1 Sep 2023 11:49:58 +0200 Subject: sdp: Use plain udevice for UDC controller interaction Convert to plain udevice interaction with UDC controller device, avoid the use of UDC uclass dev_array . Reviewed-by: Mattijs Korpershoek Signed-off-by: Marek Vasut --- cmd/usb_gadget_sdp.c | 11 +++++++---- common/spl/spl_sdp.c | 13 ++++++++----- drivers/usb/gadget/f_sdp.c | 10 +++++----- include/sdp.h | 6 +++--- 4 files changed, 23 insertions(+), 17 deletions(-) (limited to 'cmd') diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c index 784d1b49768..748aa0a7488 100644 --- a/cmd/usb_gadget_sdp.c +++ b/cmd/usb_gadget_sdp.c @@ -15,13 +15,16 @@ static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { int controller_index; + struct udevice *udc; int ret; if (argc < 2) return CMD_RET_USAGE; controller_index = simple_strtoul(argv[1], NULL, 0); - usb_gadget_initialize(controller_index); + ret = udc_device_get_by_index(controller_index, &udc); + if (ret) + return ret; g_dnl_clear_detach(); ret = g_dnl_register("usb_dnl_sdp"); @@ -30,20 +33,20 @@ static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) goto exit_register; } - ret = sdp_init(controller_index); + ret = sdp_init(udc); if (ret) { pr_err("SDP init failed: %d\n", ret); goto exit; } /* This command typically does not return but jumps to an image */ - sdp_handle(controller_index); + sdp_handle(udc); pr_err("SDP ended\n"); exit: g_dnl_unregister(); exit_register: - usb_gadget_release(controller_index); + udc_device_put(udc); return CMD_RET_FAILURE; } diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index aae886d2e57..5a5ccd0676c 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -14,10 +14,13 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { - int ret; const int controller_index = CONFIG_SPL_SDP_USB_DEV; + struct udevice *udc; + int ret; - usb_gadget_initialize(controller_index); + ret = udc_device_get_by_index(controller_index, &udc); + if (ret) + return ret; board_usb_init(controller_index, USB_INIT_DEVICE); @@ -28,7 +31,7 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, goto err_detach; } - ret = sdp_init(controller_index); + ret = sdp_init(udc); if (ret) { pr_err("SDP init failed: %d\n", ret); goto err_unregister; @@ -39,13 +42,13 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, * or it loads a FIT image and returns it to be handled by the SPL * code. */ - ret = spl_sdp_handle(controller_index, spl_image, bootdev); + ret = spl_sdp_handle(udc, spl_image, bootdev); debug("SDP ended\n"); err_unregister: g_dnl_unregister(); err_detach: - usb_gadget_release(controller_index); + udc_device_put(udc); return ret; } SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image); diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index 4da5a160a09..37f6281abfb 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -702,7 +702,7 @@ static int sdp_bind_config(struct usb_configuration *c) return status; } -int sdp_init(int controller_index) +int sdp_init(struct udevice *udc) { printf("SDP: initialize...\n"); while (!sdp_func->configuration_done) { @@ -712,7 +712,7 @@ int sdp_init(int controller_index) } schedule(); - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); } return 0; @@ -911,9 +911,9 @@ static void sdp_handle_out_ep(void) } #ifndef CONFIG_SPL_BUILD -int sdp_handle(int controller_index) +int sdp_handle(struct udevice *udc) #else -int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, +int spl_sdp_handle(struct udevice *udc, struct spl_image_info *spl_image, struct spl_boot_device *bootdev) #endif { @@ -929,7 +929,7 @@ int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, return 0; schedule(); - usb_gadget_handle_interrupts(controller_index); + dm_usb_gadget_handle_interrupts(udc); #ifdef CONFIG_SPL_BUILD flag = sdp_handle_in_ep(spl_image, bootdev); diff --git a/include/sdp.h b/include/sdp.h index 6d89baa04ec..5492f9c47d2 100644 --- a/include/sdp.h +++ b/include/sdp.h @@ -9,15 +9,15 @@ #ifndef __SDP_H_ #define __SDP_H_ -int sdp_init(int controller_index); +int sdp_init(struct udevice *udc); #ifdef CONFIG_SPL_BUILD #include -int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, +int spl_sdp_handle(struct udevice *udc, struct spl_image_info *spl_image, struct spl_boot_device *bootdev); #else -int sdp_handle(int controller_index); +int sdp_handle(struct udevice *udc); #endif #endif /* __SDP_H_ */ -- cgit v1.2.3 From 5b8c9d1b5838faa441477062dbb2889c1e33592a Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 1 Sep 2023 11:49:59 +0200 Subject: thordown: Use plain udevice for UDC controller interaction Convert to plain udevice interaction with UDC controller device, avoid the use of UDC uclass dev_array . Signed-off-by: Marek Vasut Reviewed-by: Mattijs Korpershoek --- cmd/thordown.c | 9 +++--- drivers/usb/gadget/f_thor.c | 74 +++++++++++++++++++++++---------------------- include/thor.h | 4 +-- 3 files changed, 45 insertions(+), 42 deletions(-) (limited to 'cmd') diff --git a/cmd/thordown.c b/cmd/thordown.c index 0d8dcee5314..fcfd38f523c 100644 --- a/cmd/thordown.c +++ b/cmd/thordown.c @@ -17,6 +17,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { char *interface, *devstring; int controller_index; + struct udevice *udc; int ret; if (argc < 4) @@ -32,7 +33,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) goto done; controller_index = simple_strtoul(argv[1], NULL, 0); - ret = usb_gadget_initialize(controller_index); + ret = udc_device_get_by_index(controller_index, &udc); if (ret) { pr_err("USB init failed: %d\n", ret); ret = CMD_RET_FAILURE; @@ -46,7 +47,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) goto exit; } - ret = thor_init(); + ret = thor_init(udc); if (ret) { pr_err("THOR DOWNLOAD failed: %d\n", ret); ret = CMD_RET_FAILURE; @@ -54,7 +55,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } do { - ret = thor_handle(); + ret = thor_handle(udc); if (ret == THOR_DFU_REINIT_NEEDED) { dfu_free_entities(); ret = dfu_init_env_entities(interface, devstring); @@ -67,7 +68,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } while (ret == 0); exit: g_dnl_unregister(); - usb_gadget_release(controller_index); + udc_device_put(udc); done: dfu_free_entities(); diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 47ef55b2fd3..3caa4c36387 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -15,9 +15,10 @@ */ #include -#include #include #include +#include +#include #include #include #include @@ -34,9 +35,9 @@ #include "f_thor.h" -static void thor_tx_data(unsigned char *data, int len); +static void thor_tx_data(struct udevice *udc, unsigned char *data, int len); static void thor_set_dma(void *addr, int len); -static int thor_rx_data(void); +static int thor_rx_data(struct udevice *udc); static struct f_thor *thor_func; static inline struct f_thor *func_to_thor(struct usb_function *f) @@ -56,15 +57,15 @@ DEFINE_CACHE_ALIGN_BUFFER(char, f_name, F_NAME_BUF_SIZE + 1); static unsigned long long int thor_file_size; static int alt_setting_num; -static void send_rsp(const struct rsp_box *rsp) +static void send_rsp(struct udevice *udc, const struct rsp_box *rsp) { memcpy(thor_tx_data_buf, rsp, sizeof(struct rsp_box)); - thor_tx_data(thor_tx_data_buf, sizeof(struct rsp_box)); + thor_tx_data(udc, thor_tx_data_buf, sizeof(struct rsp_box)); debug("-RSP: %d, %d\n", rsp->rsp, rsp->rsp_data); } -static void send_data_rsp(s32 ack, s32 count) +static void send_data_rsp(struct udevice *udc, s32 ack, s32 count) { ALLOC_CACHE_ALIGN_BUFFER(struct data_rsp_box, rsp, sizeof(struct data_rsp_box)); @@ -73,12 +74,12 @@ static void send_data_rsp(s32 ack, s32 count) rsp->count = count; memcpy(thor_tx_data_buf, rsp, sizeof(struct data_rsp_box)); - thor_tx_data(thor_tx_data_buf, sizeof(struct data_rsp_box)); + thor_tx_data(udc, thor_tx_data_buf, sizeof(struct data_rsp_box)); debug("-DATA RSP: %d, %d\n", ack, count); } -static int process_rqt_info(const struct rqt_box *rqt) +static int process_rqt_info(struct udevice *udc, const struct rqt_box *rqt) { ALLOC_CACHE_ALIGN_BUFFER(struct rsp_box, rsp, sizeof(struct rsp_box)); memset(rsp, 0, sizeof(struct rsp_box)); @@ -111,11 +112,11 @@ static int process_rqt_info(const struct rqt_box *rqt) return -EINVAL; } - send_rsp(rsp); + send_rsp(udc, rsp); return true; } -static int process_rqt_cmd(const struct rqt_box *rqt) +static int process_rqt_cmd(struct udevice *udc, const struct rqt_box *rqt) { ALLOC_CACHE_ALIGN_BUFFER(struct rsp_box, rsp, sizeof(struct rsp_box)); memset(rsp, 0, sizeof(struct rsp_box)); @@ -126,7 +127,7 @@ static int process_rqt_cmd(const struct rqt_box *rqt) switch (rqt->rqt_data) { case RQT_CMD_REBOOT: debug("TARGET RESET\n"); - send_rsp(rsp); + send_rsp(udc, rsp); g_dnl_unregister(); dfu_free_entities(); #ifdef CONFIG_THOR_RESET_OFF @@ -136,7 +137,7 @@ static int process_rqt_cmd(const struct rqt_box *rqt) break; case RQT_CMD_POWEROFF: case RQT_CMD_EFSCLEAR: - send_rsp(rsp); + send_rsp(udc, rsp); default: printf("Command not supported -> cmd: %d\n", rqt->rqt_data); return -EINVAL; @@ -145,7 +146,8 @@ static int process_rqt_cmd(const struct rqt_box *rqt) return true; } -static long long int download_head(unsigned long long total, +static long long int download_head(struct udevice *udc, + unsigned long long total, unsigned int packet_size, long long int *left, int *cnt) @@ -166,7 +168,7 @@ static long long int download_head(unsigned long long total, while (total - rcv_cnt >= packet_size) { thor_set_dma(buf, packet_size); buf += packet_size; - ret_rcv = thor_rx_data(); + ret_rcv = thor_rx_data(udc); if (ret_rcv < 0) return ret_rcv; rcv_cnt += ret_rcv; @@ -184,7 +186,7 @@ static long long int download_head(unsigned long long total, } buf = transfer_buffer; } - send_data_rsp(0, ++usb_pkt_cnt); + send_data_rsp(udc, 0, ++usb_pkt_cnt); } /* Calculate the amount of data to arrive from PC (in bytes) */ @@ -200,11 +202,11 @@ static long long int download_head(unsigned long long total, if (left_to_rcv) { thor_set_dma(buf, packet_size); - ret_rcv = thor_rx_data(); + ret_rcv = thor_rx_data(udc); if (ret_rcv < 0) return ret_rcv; rcv_cnt += ret_rcv; - send_data_rsp(0, ++usb_pkt_cnt); + send_data_rsp(udc, 0, ++usb_pkt_cnt); } debug("%s: %llu total: %llu cnt: %d\n", __func__, rcv_cnt, total, *cnt); @@ -254,7 +256,7 @@ static int download_tail(long long int left, int cnt) return ret; } -static long long int process_rqt_download(const struct rqt_box *rqt) +static long long int process_rqt_download(struct udevice *udc, const struct rqt_box *rqt) { ALLOC_CACHE_ALIGN_BUFFER(struct rsp_box, rsp, sizeof(struct rsp_box)); static long long int left, ret_head; @@ -301,8 +303,8 @@ static long long int process_rqt_download(const struct rqt_box *rqt) } break; case RQT_DL_FILE_START: - send_rsp(rsp); - ret_head = download_head(thor_file_size, THOR_PACKET_SIZE, + send_rsp(udc, rsp); + ret_head = download_head(udc, thor_file_size, THOR_PACKET_SIZE, &left, &cnt); if (ret_head < 0) { left = 0; @@ -324,11 +326,11 @@ static long long int process_rqt_download(const struct rqt_box *rqt) ret = -ENOTSUPP; } - send_rsp(rsp); + send_rsp(udc, rsp); return ret; } -static int process_data(void) +static int process_data(struct udevice *udc) { ALLOC_CACHE_ALIGN_BUFFER(struct rqt_box, rqt, sizeof(struct rqt_box)); int ret = -EINVAL; @@ -339,13 +341,13 @@ static int process_data(void) switch (rqt->rqt) { case RQT_INFO: - ret = process_rqt_info(rqt); + ret = process_rqt_info(udc, rqt); break; case RQT_CMD: - ret = process_rqt_cmd(rqt); + ret = process_rqt_cmd(udc, rqt); break; case RQT_DL: - ret = (int) process_rqt_download(rqt); + ret = (int) process_rqt_download(udc, rqt); break; case RQT_UL: puts("RQT: UPLOAD not supported!\n"); @@ -536,7 +538,7 @@ static struct usb_request *alloc_ep_req(struct usb_ep *ep, unsigned length) return req; } -static int thor_rx_data(void) +static int thor_rx_data(struct udevice *udc) { struct thor_dev *dev = thor_func->dev; int data_to_rx, tmp, status; @@ -557,7 +559,7 @@ static int thor_rx_data(void) } while (!dev->rxdata) { - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udc); if (ctrlc()) return -1; } @@ -568,7 +570,7 @@ static int thor_rx_data(void) return tmp; } -static void thor_tx_data(unsigned char *data, int len) +static void thor_tx_data(struct udevice *udc, unsigned char *data, int len) { struct thor_dev *dev = thor_func->dev; unsigned char *ptr = dev->in_req->buf; @@ -591,7 +593,7 @@ static void thor_tx_data(unsigned char *data, int len) /* Wait until tx interrupt received */ while (!dev->txdata) - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udc); dev->txdata = 0; } @@ -685,18 +687,18 @@ static void thor_set_dma(void *addr, int len) dev->out_req->length = len; } -int thor_init(void) +int thor_init(struct udevice *udc) { struct thor_dev *dev = thor_func->dev; /* Wait for a device enumeration and configuration settings */ debug("THOR enumeration/configuration setting....\n"); while (!dev->configuration_done) - usb_gadget_handle_interrupts(0); + dm_usb_gadget_handle_interrupts(udc); thor_set_dma(thor_rx_data_buf, strlen("THOR")); /* detect the download request from Host PC */ - if (thor_rx_data() < 0) { + if (thor_rx_data(udc) < 0) { printf("%s: Data not received!\n", __func__); return -1; } @@ -706,7 +708,7 @@ int thor_init(void) udelay(30 * 1000); /* 30 ms */ strcpy((char *)thor_tx_data_buf, "ROHT"); - thor_tx_data(thor_tx_data_buf, strlen("ROHT")); + thor_tx_data(udc, thor_tx_data_buf, strlen("ROHT")); } else { puts("Wrong reply information\n"); return -1; @@ -715,17 +717,17 @@ int thor_init(void) return 0; } -int thor_handle(void) +int thor_handle(struct udevice *udc) { int ret; /* receive the data from Host PC */ while (1) { thor_set_dma(thor_rx_data_buf, sizeof(struct rqt_box)); - ret = thor_rx_data(); + ret = thor_rx_data(udc); if (ret > 0) { - ret = process_data(); + ret = process_data(udc); #ifdef CONFIG_THOR_RESET_OFF if (ret == RESET_DONE) break; diff --git a/include/thor.h b/include/thor.h index ee67ab0a270..3cb56b654ae 100644 --- a/include/thor.h +++ b/include/thor.h @@ -14,7 +14,7 @@ #define THOR_DFU_REINIT_NEEDED 0xFFFFFFFE -int thor_handle(void); -int thor_init(void); +int thor_handle(struct udevice *udc); +int thor_init(struct udevice *udc); int thor_add(struct usb_configuration *c); #endif /* __THOR_H_ */ -- cgit v1.2.3 From 16794d3008fe61245c4938f4dab6843af71d388b Mon Sep 17 00:00:00 2001 From: Venkatesh Yadav Abbarapu Date: Mon, 4 Sep 2023 08:45:27 +0530 Subject: cmd: thordown: Add proper dependency for CMD_THOR_DOWNLOAD When CONFIG_CMD_USB and CONFIG_USB are disabled some compilation errors are seen as below. cmd/thordown.o: in function `usb_gadget_initialize': include/linux/usb/gadget.h:981: undefined reference to `board_usb_init' cmd/thordown.o: in function `do_thor_down': cmd/thordown.c:68: undefined reference to `g_dnl_unregister' cmd/thordown.o: in function `usb_gadget_release': include/linux/usb/gadget.h:986: undefined reference to `board_usb_cleanup' cmd/thordown.o: in function `do_thor_down': cmd/thordown.c:41: undefined reference to `g_dnl_register' cmd/thordown.c:48: undefined reference to `thor_init' cmd/thordown.c:56: undefined reference to `thor_handle' gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld.bfd: line 4: 8485 Segmentation fault (core dumped) $CC --sysroot=$LIBC --no-warn-rwx-segment "$@" Makefile:1779: recipe for target 'u-boot' failed make: *** [u-boot] Error 139 make: *** Deleting file 'u-boot' Add dependency of USB_GADGET_DOWNLOAD for CONFIG_CMD_THOR_DOWNLOAD to fix the errors. Signed-off-by: Ashok Reddy Soma Signed-off-by: Venkatesh Yadav Abbarapu Reviewed-by: Tom Rini Link: https://lore.kernel.org/r/20230904031528.11817-2-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek --- cmd/Kconfig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index 3f14923b5ef..64d723bd483 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -544,6 +544,8 @@ config CMD_SPL_WRITE_SIZE config CMD_THOR_DOWNLOAD bool "thor - TIZEN 'thor' download" select DFU + select USB_FUNCTION_THOR + depends on USB_GADGET_DOWNLOAD help Implements the 'thor' download protocol. This is a way of downloading a software update over USB from an attached host. -- cgit v1.2.3 From 1290262292473bd89b6beacf2e4e43b27c3c3617 Mon Sep 17 00:00:00 2001 From: Venkatesh Yadav Abbarapu Date: Wed, 20 Sep 2023 08:24:50 +0530 Subject: cmd: sf: Fix the flash_is_unlocked api size parameter When flash erase is called with size parameter, code is checking if sectors are locked or not. But for checking, the whole device length minus offset is used instead of actual size which should be erased. That's why when only some sectors are locked it is not possible to erase unlocked sectors. The length is calculated as "length = max_chipsize - offset", flash_is_unlocked() api is getting updated with length which is incorrect. Fix this flash_is_unlocked() api by passing the size parameter. ZynqMP> sf erase 0 100000 len=0x8000000 which is flash size size=0x100000 We need to update the size in the flash_is_unlocked() api and not the length. Signed-off-by: Venkatesh Yadav Abbarapu Reviewed-by: Simon Glass Link: https://lore.kernel.org/r/20230920025450.6281-1-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek --- cmd/sf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/sf.c b/cmd/sf.c index 55bef2f7699..977ffcb63c1 100644 --- a/cmd/sf.c +++ b/cmd/sf.c @@ -366,7 +366,7 @@ static int do_spi_flash_erase(int argc, char *const argv[]) } if (flash->flash_is_unlocked && - !flash->flash_is_unlocked(flash, offset, len)) { + !flash->flash_is_unlocked(flash, offset, size)) { printf("ERROR: flash area is locked\n"); return CMD_RET_FAILURE; } -- cgit v1.2.3 From 36e45f69c4c6a626fd12de7b3b25135162758654 Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Wed, 23 Aug 2023 10:49:47 +0900 Subject: cmd: dm: allow for selecting uclass and device The output from "dm tree" or "dm uclass" is a bit annoying if the number of devices available on the system is huge. (This is especially true on sandbox when I debug some DM code.) With this patch, we can specify the uclass name or the device name that we are interested in in order to limit the output. For instance, => dm uclass usb uclass 121: usb 0 usb@1 @ 0bcff8b0, seq 1 uclass 124: usb => dm tree usb:usb@1 Class Index Probed Driver Name ----------------------------------------------------------- usb 0 [ ] usb_sandbox usb@1 usb_hub 0 [ ] usb_hub `-- hub usb_emul 0 [ ] usb_sandbox_hub `-- hub-emul usb_emul 1 [ ] usb_sandbox_flash |-- flash-stick@0 usb_emul 2 [ ] usb_sandbox_flash |-- flash-stick@1 usb_emul 3 [ ] usb_sandbox_flash |-- flash-stick@2 usb_emul 4 [ ] usb_sandbox_keyb `-- keyb@3 If you want forward-matching against a uclass or udevice name, you can specify "-e" option. => dm uclass -e usb uclass 15: usb_emul 0 hub-emul @ 0bcffb00, seq 0 1 flash-stick@0 @ 0bcffc30, seq 1 2 flash-stick@1 @ 0bcffdc0, seq 2 3 flash-stick@2 @ 0bcfff50, seq 3 4 keyb@3 @ 0bd000e0, seq 4 uclass 64: usb_mass_storage uclass 121: usb 0 usb@1 @ 0bcff8b0, seq 1 uclass 122: usb_dev_generic uclass 123: usb_hub 0 hub @ 0bcff9b0, seq 0 uclass 124: usb => dm tree -e usb Class Index Probed Driver Name ----------------------------------------------------------- usb 0 [ ] usb_sandbox usb@1 usb_hub 0 [ ] usb_hub `-- hub usb_emul 0 [ ] usb_sandbox_hub `-- hub-emul usb_emul 1 [ ] usb_sandbox_flash |-- flash-stick@0 usb_emul 2 [ ] usb_sandbox_flash |-- flash-stick@1 usb_emul 3 [ ] usb_sandbox_flash |-- flash-stick@2 usb_emul 4 [ ] usb_sandbox_keyb `-- keyb@3 Signed-off-by: AKASHI Takahiro Reviewed-by: Simon Glass --- cmd/dm.c | 48 ++++++++++++++++----- doc/usage/cmd/dm.rst | 30 ++++++++++++- drivers/core/dump.c | 116 ++++++++++++++++++++++++++++++++++++++------------- include/dm/util.h | 15 +++++-- 4 files changed, 165 insertions(+), 44 deletions(-) (limited to 'cmd') diff --git a/cmd/dm.c b/cmd/dm.c index 3263547cbec..1aa86aab9c1 100644 --- a/cmd/dm.c +++ b/cmd/dm.c @@ -59,11 +59,26 @@ static int do_dm_dump_static_driver_info(struct cmd_tbl *cmdtp, int flag, static int do_dm_dump_tree(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - bool sort; - - sort = argc > 1 && !strcmp(argv[1], "-s"); - - dm_dump_tree(sort); + bool extended = false, sort = false; + char *device = NULL; + + for (; argc > 1; argc--, argv++) { + if (argv[1][0] != '-') + break; + + if (!strcmp(argv[1], "-e")) { + extended = true; + } else if (!strcmp(argv[1], "-s")) { + sort = true; + } else { + printf("Unknown parameter: %s\n", argv[1]); + return 0; + } + } + if (argc > 1) + device = argv[1]; + + dm_dump_tree(device, extended, sort); return 0; } @@ -71,7 +86,20 @@ static int do_dm_dump_tree(struct cmd_tbl *cmdtp, int flag, int argc, static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - dm_dump_uclass(); + bool extended = false; + char *uclass = NULL; + + if (argc > 1) { + if (!strcmp(argv[1], "-e")) { + extended = true; + argc--; + argv++; + } + if (argc > 1) + uclass = argv[1]; + } + + dm_dump_uclass(uclass, extended); return 0; } @@ -91,8 +119,8 @@ static char dm_help_text[] = "dm drivers Dump list of drivers with uclass and instances\n" DM_MEM_HELP "dm static Dump list of drivers with static platform data\n" - "dm tree [-s] Dump tree of driver model devices (-s=sort)\n" - "dm uclass Dump list of instances for each uclass" + "dm tree [-s][-e][name] Dump tree of driver model devices (-s=sort)\n" + "dm uclass [-e][name] Dump list of instances for each uclass" ; #endif @@ -102,5 +130,5 @@ U_BOOT_CMD_WITH_SUBCMDS(dm, "Driver model low level access", dm_help_text, U_BOOT_SUBCMD_MKENT(drivers, 1, 1, do_dm_dump_drivers), DM_MEM U_BOOT_SUBCMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info), - U_BOOT_SUBCMD_MKENT(tree, 2, 1, do_dm_dump_tree), - U_BOOT_SUBCMD_MKENT(uclass, 1, 1, do_dm_dump_uclass)); + U_BOOT_SUBCMD_MKENT(tree, 4, 1, do_dm_dump_tree), + U_BOOT_SUBCMD_MKENT(uclass, 3, 1, do_dm_dump_uclass)); diff --git a/doc/usage/cmd/dm.rst b/doc/usage/cmd/dm.rst index 74c6b01e361..12b7edeed68 100644 --- a/doc/usage/cmd/dm.rst +++ b/doc/usage/cmd/dm.rst @@ -12,8 +12,8 @@ Synopis dm devres dm drivers dm static - dm tree [-s] - dm uclass + dm tree [-s][-e] [uclass name] + dm uclass [-e] [udevice name] Description ----------- @@ -127,6 +127,12 @@ If -s is given, the top-level devices (those which are children of the root device) are shown sorted in order of uclass ID, so it is easier to find a particular device type. +If -e is given, forward-matching against existing devices is +made and only the matched devices are shown. + +If a device name is given, forward-matching against existing devices is +made and only the matched devices are shown. + dm uclass ~~~~~~~~~ @@ -140,6 +146,11 @@ For each device, the format is:: where `n` is the index within the uclass, `a` is the address of the device in memory and `s` is the sequence number of the device. +If -e is given, forward-matching against existing uclasses is +made and only the matched uclasses are shown. + +If no uclass name is given, all the uclasses are shown. + Examples -------- @@ -409,6 +420,15 @@ This example shows the abridged sandbox output:: nop 8 [ ] scmi_voltage_domain `-- regulators regulator 5 [ ] scmi_regulator |-- reg@0 regulator 6 [ ] scmi_regulator `-- reg@1 + => dm tree pinc + pinctrl 0 [ + ] sandbox_pinctrl_gpio pinctrl-gpio + gpio 1 [ + ] sandbox_gpio |-- base-gpios + nop 0 [ + ] gpio_hog | |-- hog_input_active_low + nop 1 [ + ] gpio_hog | |-- hog_input_active_high + nop 2 [ + ] gpio_hog | |-- hog_output_low + nop 3 [ + ] gpio_hog | `-- hog_output_high + gpio 2 [ ] sandbox_gpio |-- extra-gpios + gpio 3 [ ] sandbox_gpio `-- pinmux-gpios => @@ -487,4 +507,10 @@ This example shows the abridged sandbox output:: 0 * gpio-wdt @ 0301c070, seq 0 1 * wdt@0 @ 03021710, seq 1 + => dm uclass blk + uclass 22: blk + 0 mmc2.blk @ 0301ca00, seq 0 + 1 mmc1.blk @ 0301cee0, seq 1 + 2 mmc0.blk @ 0301d380, seq 2 + => diff --git a/drivers/core/dump.c b/drivers/core/dump.c index 3e77832a3a0..4023b390f54 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -85,29 +85,65 @@ static void show_devices(struct udevice *dev, int depth, int last_flag, } } -void dm_dump_tree(bool sort) +static void dm_dump_tree_single(struct udevice *dev, bool sort) { - struct udevice *root; + int dev_count, uclasses; + struct udevice **devs = NULL; - root = dm_root(); - if (root) { - int dev_count, uclasses; - struct udevice **devs = NULL; - - dm_get_stats(&dev_count, &uclasses); - - printf(" Class Index Probed Driver Name\n"); - printf("-----------------------------------------------------------\n"); - if (sort) { - devs = calloc(dev_count, sizeof(struct udevice *)); - if (!devs) { - printf("(out of memory)\n"); - return; + dm_get_stats(&dev_count, &uclasses); + + if (sort) { + devs = calloc(dev_count, sizeof(struct udevice *)); + if (!devs) { + printf("(out of memory)\n"); + return; + } + } + show_devices(dev, -1, 0, devs); + free(devs); +} + +static void dm_dump_tree_recursive(struct udevice *dev, char *dev_name, + bool extended, bool sort) +{ + struct udevice *child; + size_t len; + + len = strlen(dev_name); + + device_foreach_child(child, dev) { + if (extended) { + if (!strncmp(child->name, dev_name, len)) { + dm_dump_tree_single(child, sort); + continue; + } + } else { + if (!strcmp(child->name, dev_name)) { + dm_dump_tree_single(child, sort); + continue; } } - show_devices(root, -1, 0, devs); - free(devs); + dm_dump_tree_recursive(child, dev_name, extended, sort); + } +} + +void dm_dump_tree(char *dev_name, bool extended, bool sort) +{ + struct udevice *root; + + printf(" Class Index Probed Driver Name\n"); + printf("-----------------------------------------------------------\n"); + + root = dm_root(); + if (!root) + return; + + if (!dev_name || !strcmp(dev_name, "root")) { + dm_dump_tree_single(root, sort); + return; } + + dm_dump_tree_recursive(root, dev_name, extended, sort); } /** @@ -127,26 +163,50 @@ static void dm_display_line(struct udevice *dev, int index) puts("\n"); } -void dm_dump_uclass(void) +static void dm_dump_uclass_single(enum uclass_id id) { struct uclass *uc; + struct udevice *dev; + int i = 0, ret; + + ret = uclass_get(id, &uc); + if (ret) + return; + + printf("uclass %d: %s\n", id, uc->uc_drv->name); + uclass_foreach_dev(dev, uc) { + dm_display_line(dev, i); + i++; + } + puts("\n"); +} + +void dm_dump_uclass(char *uclass, bool extended) +{ + struct uclass *uc; + enum uclass_id id; + bool matching; int ret; - int id; - for (id = 0; id < UCLASS_COUNT; id++) { - struct udevice *dev; - int i = 0; + matching = !!(uclass && strcmp(uclass, "root")); + for (id = 0; id < UCLASS_COUNT; id++) { ret = uclass_get(id, &uc); if (ret) continue; - printf("uclass %d: %s\n", id, uc->uc_drv->name); - uclass_foreach_dev(dev, uc) { - dm_display_line(dev, i); - i++; + if (matching) { + if (extended) { + if (!strncmp(uc->uc_drv->name, uclass, + strlen(uclass))) + dm_dump_uclass_single(id); + } else { + if (!strcmp(uc->uc_drv->name, uclass)) + dm_dump_uclass_single(id); + } + } else { + dm_dump_uclass_single(id); } - puts("\n"); } } diff --git a/include/dm/util.h b/include/dm/util.h index 4bb49e9e8c0..89206cc4966 100644 --- a/include/dm/util.h +++ b/include/dm/util.h @@ -27,14 +27,21 @@ struct list_head; int list_count_items(struct list_head *head); /** - * Dump out a tree of all devices + * Dump out a tree of all devices starting @uclass * + * @dev_name: udevice name + * @extended: true if forword-matching expected * @sort: Sort by uclass name */ -void dm_dump_tree(bool sort); +void dm_dump_tree(char *dev_name, bool extended, bool sort); -/* Dump out a list of uclasses and their devices */ -void dm_dump_uclass(void); +/* + * Dump out a list of uclasses and their devices + * + * @uclass: uclass name + * @extended: true if forword-matching expected + */ +void dm_dump_uclass(char *uclass, bool extended); #ifdef CONFIG_DEBUG_DEVRES /* Dump out a list of device resources */ -- cgit v1.2.3 From 1e94b46f73cedcebbff73799203f3266c5b28d90 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 14 Sep 2023 18:21:46 -0600 Subject: common: Drop linux/printk.h from common header This old patch was marked as deferred. Bring it back to life, to continue towards the removal of common.h Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass --- arch/arm/lib/gic-v3-its.c | 1 + arch/arm/mach-imx/imx8/fdt.c | 1 + arch/arm/mach-k3/common.c | 1 + arch/arm/mach-meson/board-gx.c | 1 + arch/arm/mach-omap2/am33xx/board.c | 1 + arch/arm/mach-omap2/utils.c | 1 + arch/arm/mach-rockchip/boot_mode.c | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 1 + arch/arm/mach-rockchip/rk3399/rk3399.c | 1 + arch/arm/mach-socfpga/misc.c | 1 + arch/arm/mach-stm32mp/bsec.c | 1 + arch/arm/mach-stm32mp/cmd_stm32key.c | 1 + arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 1 + arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 1 + arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 2 ++ arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c | 1 + arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c | 1 + arch/arm/mach-stm32mp/cpu.c | 3 ++- arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h | 1 + arch/arm/mach-tegra/cboot.c | 1 + arch/arm/mach-tegra/ivc.c | 1 + arch/arm/mach-tegra/tegra124/xusb-padctl.c | 1 + arch/arm/mach-tegra/tegra20/clock.c | 1 + arch/arm/mach-tegra/tegra210/xusb-padctl.c | 1 + arch/arm/mach-tegra/tegra30/clock.c | 1 + arch/arm/mach-tegra/xusb-padctl-common.c | 1 + arch/arm/mach-uniphier/boot-device/boot-device.c | 1 + arch/arm/mach-uniphier/clk/dpll-ld4.c | 1 + arch/arm/mach-uniphier/clk/dpll-pro4.c | 1 + arch/arm/mach-uniphier/dram/umc-ld4.c | 1 + arch/arm/mach-uniphier/dram/umc-pro4.c | 1 + arch/arm/mach-uniphier/dram/umc-sld8.c | 1 + arch/arm/mach-uniphier/memconf.c | 1 + arch/arm/mach-uniphier/spl_board_init.c | 1 + arch/riscv/lib/smp.c | 1 + arch/x86/cpu/tangier/pinmux.c | 1 + arch/x86/cpu/tangier/sdram.c | 1 + board/dhelectronics/dh_stm32mp1/board.c | 1 + board/mediatek/mt8518/mt8518_ap1.c | 1 + board/mscc/ocelot/ocelot.c | 1 + board/nvidia/jetson-tk1/jetson-tk1.c | 1 + board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c | 1 + board/samsung/common/exynos5-dt.c | 1 + board/samsung/common/misc.c | 1 + board/samsung/goni/goni.c | 1 + board/samsung/odroid/odroid.c | 1 + board/st/common/stm32mp_dfu.c | 1 + board/st/stm32mp1/stm32mp1.c | 1 + board/sunxi/board.c | 1 + board/synopsys/hsdk/clk-lib.c | 1 + board/synopsys/hsdk/env-lib.c | 1 + board/ti/am65x/evm.c | 1 + board/ti/common/board_detect.c | 1 + board/ti/j721e/evm.c | 1 + board/toradex/apalis-tk1/apalis-tk1.c | 1 + cmd/adc.c | 1 + cmd/fastboot.c | 1 + cmd/nvedit.c | 1 + cmd/onenand.c | 1 + cmd/regulator.c | 1 + cmd/thordown.c | 1 + cmd/tpm_test.c | 1 + cmd/usb_gadget_sdp.c | 1 + cmd/usb_mass_storage.c | 1 + common/dfu.c | 1 + common/spl/spl_dfu.c | 1 + common/spl/spl_fit.c | 1 + common/spl/spl_opensbi.c | 1 + common/spl/spl_sdp.c | 1 + common/update.c | 1 + disk/part_efi.c | 1 + drivers/adc/adc-uclass.c | 1 + drivers/adc/exynos-adc.c | 1 + drivers/adc/meson-saradc.c | 1 + drivers/adc/rockchip-saradc.c | 1 + drivers/adc/sandbox.c | 1 + drivers/ata/dwc_ahci.c | 1 + drivers/bios_emulator/include/x86emu/debug.h | 1 + drivers/bios_emulator/include/x86emu/regs.h | 1 + drivers/bios_emulator/x86emu/debug.c | 1 + drivers/bios_emulator/x86emu/decode.c | 1 + drivers/bios_emulator/x86emu/ops.c | 1 + drivers/bios_emulator/x86emu/ops2.c | 1 + drivers/bios_emulator/x86emu/sys.c | 1 + drivers/bootcount/bootcount-uclass.c | 1 + drivers/clk/analogbits/wrpll-cln28hpc.c | 1 + drivers/clk/clk-divider.c | 1 + drivers/clk/clk-gate.c | 1 + drivers/clk/clk-hsdk-cgu.c | 1 + drivers/clk/clk-mux.c | 1 + drivers/clk/clk_boston.c | 1 + drivers/clk/imx/clk-pll14xx.c | 1 + drivers/clk/rockchip/clk_rk3368.c | 1 + drivers/clk/rockchip/clk_rk3399.c | 1 + drivers/core/device.c | 1 + drivers/core/of_addr.c | 1 + drivers/core/root.c | 1 + drivers/dfu/dfu.c | 1 + drivers/dfu/dfu_mmc.c | 1 + drivers/dfu/dfu_ram.c | 1 + drivers/dma/bcm6348-iudma.c | 1 + drivers/dma/dma-uclass.c | 1 + drivers/dma/lpc32xx_dma.c | 1 + drivers/dma/sandbox-dma-test.c | 1 + drivers/dma/ti-edma3.c | 1 + drivers/dma/ti/k3-udma.c | 1 + drivers/fastboot/fb_command.c | 1 + drivers/fastboot/fb_getvar.c | 1 + drivers/fastboot/fb_nand.c | 1 + drivers/i2c/i2c-gpio.c | 1 + drivers/i2c/iproc_i2c.c | 1 + drivers/i2c/omap24xx_i2c.c | 1 + drivers/i2c/stm32f7_i2c.c | 1 + drivers/i2c/tegra_i2c.c | 1 + drivers/misc/sifive-otp.c | 1 + drivers/misc/tegra186_bpmp.c | 1 + drivers/mmc/exynos_dw_mmc.c | 1 + drivers/mmc/fsl_esdhc_imx.c | 1 + drivers/mmc/mmc.c | 1 + drivers/mmc/mtk-sd.c | 1 + drivers/mmc/sdhci.c | 1 + drivers/mmc/sti_sdhci.c | 1 + drivers/mmc/stm32_sdmmc2.c | 1 + drivers/mmc/xenon_sdhci.c | 1 + drivers/mtd/mtdconcat.c | 1 + drivers/mtd/nand/bbt.c | 1 + drivers/mtd/nand/core.c | 1 + drivers/mtd/nand/raw/arasan_nfc.c | 1 + drivers/mtd/nand/raw/atmel_nand.c | 1 + drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c | 1 + drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c | 1 + drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c | 1 + drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c | 1 + drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c | 1 + drivers/mtd/nand/raw/davinci_nand.c | 1 + drivers/mtd/nand/raw/lpc32xx_nand_mlc.c | 1 + drivers/mtd/nand/raw/lpc32xx_nand_slc.c | 1 + drivers/mtd/nand/raw/mxc_nand.c | 1 + drivers/mtd/nand/raw/nand_bch.c | 1 + drivers/mtd/nand/raw/pxa3xx_nand.c | 1 + drivers/mtd/nand/raw/stm32_fmc2_nand.c | 1 + drivers/mtd/nand/raw/sunxi_nand.c | 1 + drivers/mtd/nand/raw/tegra_nand.c | 1 + drivers/mtd/nand/raw/vf610_nfc.c | 1 + drivers/mtd/nand/raw/zynq_nand.c | 1 + drivers/mtd/nand/spi/core.c | 1 + drivers/mtd/onenand/onenand_base.c | 1 + drivers/mtd/onenand/onenand_bbt.c | 1 + drivers/mtd/onenand/samsung.c | 1 + drivers/mtd/spi/spi-nor-core.c | 1 + drivers/mtd/spi/spi-nor-tiny.c | 1 + drivers/mtd/ubi/attach.c | 1 + drivers/mtd/ubi/build.c | 1 + drivers/mtd/ubi/debug.c | 1 + drivers/mtd/ubi/debug.h | 1 + drivers/mtd/ubi/ubi.h | 1 + drivers/net/bcm-sf2-eth-gmac.c | 1 + drivers/net/bcm-sf2-eth.c | 1 + drivers/net/bcm6348-eth.c | 1 + drivers/net/bcm6368-eth.c | 1 + drivers/net/designware.c | 1 + drivers/net/dwc_eth_qos.c | 1 + drivers/net/fsl-mc/dpio/qbman_sys.h | 1 + drivers/net/ftgmac100.c | 1 + drivers/net/mscc_eswitch/jr2_switch.c | 1 + drivers/net/mscc_eswitch/ocelot_switch.c | 1 + drivers/net/mscc_eswitch/serval_switch.c | 1 + drivers/net/mscc_eswitch/servalt_switch.c | 1 + drivers/net/mt7628-eth.c | 1 + drivers/net/mtk_eth.c | 1 + drivers/net/mvmdio.c | 1 + drivers/net/phy/dp83867.c | 1 + drivers/net/phy/mscc.c | 1 + drivers/net/rtl8169.c | 1 + drivers/net/sni_ave.c | 1 + drivers/net/ti/am65-cpsw-nuss.c | 1 + drivers/net/ti/cpsw-common.c | 1 + drivers/net/ti/cpsw.c | 1 + drivers/net/ti/keystone_net.c | 1 + drivers/pci/pci-uclass.c | 1 + drivers/pci/pci_mvebu.c | 1 + drivers/pci/pci_tegra.c | 1 + drivers/pci/pcie_ecam_generic.c | 1 + drivers/pci/pcie_fsl.c | 1 + drivers/pci/pcie_mediatek.c | 1 + drivers/pci/pcie_phytium.c | 1 + drivers/pci/pcie_xilinx.c | 1 + drivers/phy/keystone-usb-phy.c | 1 + drivers/phy/marvell/comphy_cp110.c | 1 + drivers/phy/meson-g12a-usb2.c | 1 + drivers/phy/meson-g12a-usb3-pcie.c | 1 + drivers/phy/meson-gxbb-usb2.c | 1 + drivers/phy/meson-gxl-usb2.c | 3 ++- drivers/phy/phy-rcar-gen3.c | 1 + drivers/phy/phy-stm32-usbphyc.c | 1 + drivers/phy/phy-uclass.c | 1 + drivers/phy/sti_usb_phy.c | 1 + drivers/phy/ti-pipe3-phy.c | 1 + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 1 + drivers/pinctrl/pinctrl-sti.c | 1 + drivers/pinctrl/pinctrl_stm32.c | 1 + drivers/power/palmas.c | 1 + drivers/power/pmic/as3722.c | 1 + drivers/power/pmic/as3722_gpio.c | 1 + drivers/power/pmic/bd71837.c | 1 + drivers/power/pmic/da9063.c | 1 + drivers/power/pmic/fan53555.c | 1 + drivers/power/pmic/i2c_pmic_emul.c | 1 + drivers/power/pmic/lp873x.c | 1 + drivers/power/pmic/lp87565.c | 1 + drivers/power/pmic/max77686.c | 1 + drivers/power/pmic/max8997.c | 1 + drivers/power/pmic/max8998.c | 1 + drivers/power/pmic/palmas.c | 1 + drivers/power/pmic/pca9450.c | 1 + drivers/power/pmic/pfuze100.c | 1 + drivers/power/pmic/pmic_tps65910_dm.c | 1 + drivers/power/pmic/s2mps11.c | 1 + drivers/power/pmic/s5m8767.c | 1 + drivers/power/pmic/sandbox.c | 1 + drivers/power/pmic/tps65090.c | 1 + drivers/power/pmic/tps65941.c | 1 + drivers/power/regulator/bd71837.c | 1 + drivers/power/regulator/fan53555.c | 1 + drivers/power/regulator/fixed.c | 2 ++ drivers/power/regulator/gpio-regulator.c | 2 ++ drivers/power/regulator/max77686.c | 1 + drivers/power/regulator/pbias_regulator.c | 1 + drivers/power/regulator/regulator_common.c | 2 ++ drivers/power/regulator/s2mps11_regulator.c | 1 + drivers/power/regulator/sandbox.c | 1 + drivers/power/regulator/tps65910_regulator.c | 1 + drivers/power/twl4030.c | 1 + drivers/power/twl6030.c | 1 + drivers/ram/imxrt_sdram.c | 1 + drivers/ram/rockchip/dmc-rk3368.c | 1 + drivers/ram/stm32_sdram.c | 1 + drivers/ram/stm32mp1/stm32mp1_ddr.c | 1 + drivers/ram/stm32mp1/stm32mp1_ram.c | 1 + drivers/remoteproc/rproc-elf-loader.c | 1 + drivers/remoteproc/rproc-uclass.c | 1 + drivers/remoteproc/sandbox_testproc.c | 1 + drivers/remoteproc/stm32_copro.c | 1 + drivers/remoteproc/ti_power_proc.c | 1 + drivers/remoteproc/ti_sci_proc.h | 1 + drivers/reset/sti-reset.c | 1 + drivers/serial/serial_mtk.c | 1 + drivers/soc/ti/k3-navss-ringacc.c | 1 + drivers/spi/atmel_spi.c | 1 + drivers/spi/fsl_dspi.c | 1 + drivers/spi/mt7621_spi.c | 1 + drivers/spi/mxc_spi.c | 1 + drivers/spi/pl022_spi.c | 1 + drivers/spi/stm32_qspi.c | 1 + drivers/spi/stm32_spi.c | 1 + drivers/spi/uniphier_spi.c | 1 + drivers/sysreset/sysreset_sti.c | 1 + drivers/sysreset/sysreset_syscon.c | 1 + drivers/sysreset/sysreset_watchdog.c | 1 + drivers/tpm/tpm_tis_infineon.c | 1 + drivers/usb/cdns3/gadget.c | 1 + drivers/usb/common/common.c | 1 + drivers/usb/dwc3/dwc3-generic.c | 1 + drivers/usb/dwc3/dwc3-meson-g12a.c | 1 + drivers/usb/dwc3/gadget.c | 1 + drivers/usb/eth/mcs7830.c | 1 + drivers/usb/gadget/at91_udc.c | 1 + drivers/usb/gadget/atmel_usba_udc.c | 1 + drivers/usb/gadget/dwc2_udc_otg.c | 1 + drivers/usb/gadget/ether.c | 1 + drivers/usb/gadget/f_fastboot.c | 1 + drivers/usb/gadget/f_sdp.c | 1 + drivers/usb/gadget/f_thor.c | 1 + drivers/usb/gadget/udc/udc-uclass.c | 1 + drivers/usb/host/dwc3-sti-glue.c | 1 + drivers/usb/musb-new/mt85xx.c | 1 + drivers/usb/musb-new/musb_core.c | 1 + drivers/usb/musb-new/musb_debug.h | 1 + drivers/usb/musb-new/musb_dsps.c | 1 + drivers/usb/musb-new/musb_gadget.c | 1 + drivers/usb/musb-new/musb_gadget_ep0.c | 1 + drivers/usb/musb-new/omap2430.c | 1 + drivers/usb/musb-new/sunxi.c | 1 + drivers/usb/musb-new/ti-musb.c | 1 + drivers/video/meson/meson_dw_hdmi.c | 1 + drivers/video/meson/meson_vclk.c | 1 + drivers/video/stm32/stm32_dsi.c | 1 + drivers/video/stm32/stm32_ltdc.c | 1 + drivers/video/tegra124/sor.c | 1 + drivers/watchdog/stm32mp_wdt.c | 1 + env/common.c | 1 + fs/ubifs/debug.c | 1 + fs/ubifs/debug.h | 1 + fs/ubifs/lpt_commit.c | 1 + fs/ubifs/super.c | 1 + fs/ubifs/ubifs.h | 1 + fs/yaffs2/yaffs_uboot_glue.c | 1 + include/common.h | 1 - include/crypto/pkcs7_parser.h | 1 + include/dm/device_compat.h | 1 + include/linux/soc/ti/cppi5.h | 1 + lib/asn1_decoder.c | 1 + lib/bch.c | 1 + lib/crypto/asymmetric_type.c | 1 + lib/crypto/pkcs7_parser.c | 1 + lib/crypto/pkcs7_verify.c | 1 + lib/crypto/public_key.c | 1 + lib/crypto/rsa_helper.c | 1 + lib/crypto/x509_cert_parser.c | 1 + lib/crypto/x509_public_key.c | 1 + lib/list_sort.c | 1 + net/fastboot_udp.c | 1 + 312 files changed, 317 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/arch/arm/lib/gic-v3-its.c b/arch/arm/lib/gic-v3-its.c index f6211a2d92c..f4bbd21da91 100644 --- a/arch/arm/lib/gic-v3-its.c +++ b/arch/arm/lib/gic-v3-its.c @@ -9,6 +9,7 @@ #include #include #include +#include #include static u32 lpi_id_bits; diff --git a/arch/arm/mach-imx/imx8/fdt.c b/arch/arm/mach-imx/imx8/fdt.c index 491c8bb8c75..c2bed3e0c1f 100644 --- a/arch/arm/mach-imx/imx8/fdt.c +++ b/arch/arm/mach-imx/imx8/fdt.c @@ -11,6 +11,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index a35110429b2..cc755dd1bf6 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "common.h" #include #include diff --git a/arch/arm/mach-meson/board-gx.c b/arch/arm/mach-meson/board-gx.c index f28f84d86f6..c3fbdfffeae 100644 --- a/arch/arm/mach-meson/board-gx.c +++ b/arch/arm/mach-meson/board-gx.c @@ -15,6 +15,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c index 9d9b4d7f293..06b41297730 100644 --- a/arch/arm/mach-omap2/am33xx/board.c +++ b/arch/arm/mach-omap2/am33xx/board.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c index 7d938724f84..0623281a3c7 100644 --- a/arch/arm/mach-omap2/utils.c +++ b/arch/arm/mach-omap2/utils.c @@ -9,6 +9,7 @@ #include #include #include +#include static void do_cancel_out(u32 *num, u32 *den, u32 factor) { diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c index 1a1a887fc2c..eb8f65ae4e9 100644 --- a/arch/arm/mach-rockchip/boot_mode.c +++ b/arch/arm/mach-rockchip/boot_mode.c @@ -12,6 +12,7 @@ #include #include #include +#include #if (CONFIG_ROCKCHIP_BOOT_MODE_REG == 0) diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c index df8fa1566f0..c807221f33f 100644 --- a/arch/arm/mach-rockchip/rk3188/rk3188.c +++ b/arch/arm/mach-rockchip/rk3188/rk3188.c @@ -17,6 +17,7 @@ #include #include #include +#include #define GRF_BASE 0x20008000 diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index cbd2ea047dc..14565d2ed9f 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -20,6 +20,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c index 5b5a81a255d..80ad0870341 100644 --- a/arch/arm/mach-socfpga/misc.c +++ b/arch/arm/mach-socfpga/misc.c @@ -25,6 +25,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 0dc1e5c3fdc..599e63a93dd 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -18,6 +18,7 @@ #include #include #include +#include #define BSEC_OTP_MAX_VALUE 95 #define BSEC_OTP_UPPER_START 32 diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c index 85be8e23bdb..e16fcf4424d 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32key.c +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c @@ -11,6 +11,7 @@ #include #include #include +#include /* * Closed device: OTP0 diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index c695cc11232..2411bcf06d8 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "stm32prog.h" struct stm32prog_data *stm32prog_data; diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index 9ba94be804e..393f9a1b411 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "stm32prog.h" diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h index feba29501d8..ae4bd8842f5 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h @@ -6,6 +6,8 @@ #ifndef _STM32PROG_H_ #define _STM32PROG_H_ +#include + /* - phase defines ------------------------------------------------*/ #define PHASE_FLASHLAYOUT 0x00 #define PHASE_FIRST_USER 0x10 diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c index f1bed7d1a33..35bed319942 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "stm32prog.h" diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c index be38ff239b2..d18455bf36f 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "stm32prog.h" static int stm32prog_set_phase(struct stm32prog_data *data, u8 phase, diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index e2f67fc4233..e07abbe21c1 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -22,7 +23,7 @@ #include #include #include -#include +#include /* * early TLB into the .data section so that it not get cleared diff --git a/arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h b/arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h index 4ad14f963b4..1b2bba3d34c 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h @@ -7,6 +7,7 @@ #define __STM32MP1_SMC_H__ #include +#include /* * SMC function IDs for STM32 Service queries diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c index 55eb8198604..8f5bb2f261a 100644 --- a/arch/arm/mach-tegra/cboot.c +++ b/arch/arm/mach-tegra/cboot.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include diff --git a/arch/arm/mach-tegra/ivc.c b/arch/arm/mach-tegra/ivc.c index b69a458fdf0..66c1276f4b8 100644 --- a/arch/arm/mach-tegra/ivc.c +++ b/arch/arm/mach-tegra/ivc.c @@ -8,6 +8,7 @@ #include #include #include +#include #define TEGRA_IVC_ALIGN 64 diff --git a/arch/arm/mach-tegra/tegra124/xusb-padctl.c b/arch/arm/mach-tegra/tegra124/xusb-padctl.c index d3c7719c3dd..69736aa3925 100644 --- a/arch/arm/mach-tegra/tegra124/xusb-padctl.c +++ b/arch/arm/mach-tegra/tegra124/xusb-padctl.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "../xusb-padctl-common.h" diff --git a/arch/arm/mach-tegra/tegra20/clock.c b/arch/arm/mach-tegra/tegra20/clock.c index 067a9f1a2f1..abd6e3917ac 100644 --- a/arch/arm/mach-tegra/tegra20/clock.c +++ b/arch/arm/mach-tegra/tegra20/clock.c @@ -19,6 +19,7 @@ #include #include #include +#include #include diff --git a/arch/arm/mach-tegra/tegra210/xusb-padctl.c b/arch/arm/mach-tegra/tegra210/xusb-padctl.c index c414dfd3b86..30d0395bb0e 100644 --- a/arch/arm/mach-tegra/tegra210/xusb-padctl.c +++ b/arch/arm/mach-tegra/tegra210/xusb-padctl.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "../xusb-padctl-common.h" diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c index 1dc9d09dba8..698c7ab9560 100644 --- a/arch/arm/mach-tegra/tegra30/clock.c +++ b/arch/arm/mach-tegra/tegra30/clock.c @@ -18,6 +18,7 @@ #include #include #include +#include #include diff --git a/arch/arm/mach-tegra/xusb-padctl-common.c b/arch/arm/mach-tegra/xusb-padctl-common.c index 388ec499688..28fdebe50a3 100644 --- a/arch/arm/mach-tegra/xusb-padctl-common.c +++ b/arch/arm/mach-tegra/xusb-padctl-common.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "xusb-padctl-common.h" diff --git a/arch/arm/mach-uniphier/boot-device/boot-device.c b/arch/arm/mach-uniphier/boot-device/boot-device.c index 98ff34cfa71..1e6bc8433f7 100644 --- a/arch/arm/mach-uniphier/boot-device/boot-device.c +++ b/arch/arm/mach-uniphier/boot-device/boot-device.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "../init.h" #include "../sg-regs.h" diff --git a/arch/arm/mach-uniphier/clk/dpll-ld4.c b/arch/arm/mach-uniphier/clk/dpll-ld4.c index 3ccaf02242c..f24a0eb0b82 100644 --- a/arch/arm/mach-uniphier/clk/dpll-ld4.c +++ b/arch/arm/mach-uniphier/clk/dpll-ld4.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "../init.h" #include "../sc-regs.h" diff --git a/arch/arm/mach-uniphier/clk/dpll-pro4.c b/arch/arm/mach-uniphier/clk/dpll-pro4.c index 44006ae6dc4..204aee1a62c 100644 --- a/arch/arm/mach-uniphier/clk/dpll-pro4.c +++ b/arch/arm/mach-uniphier/clk/dpll-pro4.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "../init.h" #include "../sc-regs.h" diff --git a/arch/arm/mach-uniphier/dram/umc-ld4.c b/arch/arm/mach-uniphier/dram/umc-ld4.c index 96acca2562f..1eb15b611fd 100644 --- a/arch/arm/mach-uniphier/dram/umc-ld4.c +++ b/arch/arm/mach-uniphier/dram/umc-ld4.c @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-uniphier/dram/umc-pro4.c b/arch/arm/mach-uniphier/dram/umc-pro4.c index cde39b499bf..0114df782b4 100644 --- a/arch/arm/mach-uniphier/dram/umc-pro4.c +++ b/arch/arm/mach-uniphier/dram/umc-pro4.c @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-uniphier/dram/umc-sld8.c b/arch/arm/mach-uniphier/dram/umc-sld8.c index a11586952d8..583a1bad8b7 100644 --- a/arch/arm/mach-uniphier/dram/umc-sld8.c +++ b/arch/arm/mach-uniphier/dram/umc-sld8.c @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-uniphier/memconf.c b/arch/arm/mach-uniphier/memconf.c index 57192f0154a..ab0d187a1fa 100644 --- a/arch/arm/mach-uniphier/memconf.c +++ b/arch/arm/mach-uniphier/memconf.c @@ -7,6 +7,7 @@ #include #include +#include #include #include "sg-regs.h" diff --git a/arch/arm/mach-uniphier/spl_board_init.c b/arch/arm/mach-uniphier/spl_board_init.c index a93b8cdc04d..0f2e3504c81 100644 --- a/arch/arm/mach-uniphier/spl_board_init.c +++ b/arch/arm/mach-uniphier/spl_board_init.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "init.h" #include "micro-support-card.h" diff --git a/arch/riscv/lib/smp.c b/arch/riscv/lib/smp.c index 4f073a016ff..f3cd8b9044a 100644 --- a/arch/riscv/lib/smp.c +++ b/arch/riscv/lib/smp.c @@ -10,6 +10,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c index 7b2c35fbf79..23bfa7c18d2 100644 --- a/arch/x86/cpu/tangier/pinmux.c +++ b/arch/x86/cpu/tangier/pinmux.c @@ -13,6 +13,7 @@ #include #include #include +#include #define BUFCFG_OFFSET 0x100 diff --git a/arch/x86/cpu/tangier/sdram.c b/arch/x86/cpu/tangier/sdram.c index ee74a1f0433..374b262b134 100644 --- a/arch/x86/cpu/tangier/sdram.c +++ b/arch/x86/cpu/tangier/sdram.c @@ -9,6 +9,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c index f9cfabe2420..341d095d689 100644 --- a/board/dhelectronics/dh_stm32mp1/board.c +++ b/board/dhelectronics/dh_stm32mp1/board.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/board/mediatek/mt8518/mt8518_ap1.c b/board/mediatek/mt8518/mt8518_ap1.c index 2490b15ec78..e03da63b1d9 100644 --- a/board/mediatek/mt8518/mt8518_ap1.c +++ b/board/mediatek/mt8518/mt8518_ap1.c @@ -8,6 +8,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/mscc/ocelot/ocelot.c b/board/mscc/ocelot/ocelot.c index f261346b358..d69db04de66 100644 --- a/board/mscc/ocelot/ocelot.c +++ b/board/mscc/ocelot/ocelot.c @@ -16,6 +16,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/nvidia/jetson-tk1/jetson-tk1.c b/board/nvidia/jetson-tk1/jetson-tk1.c index d349531261e..7f3cdd70fe7 100644 --- a/board/nvidia/jetson-tk1/jetson-tk1.c +++ b/board/nvidia/jetson-tk1/jetson-tk1.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c index 516292aaa59..4ad780767ea 100644 --- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #define GRF_IO_VSEL_BT565_SHIFT 0 diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c index 726b7f0667a..1e88a82980e 100644 --- a/board/samsung/common/exynos5-dt.c +++ b/board/samsung/common/exynos5-dt.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 5ffa216e2e5..cc114aaaa6d 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c index 535f8e1e012..c8f5a153bb4 100644 --- a/board/samsung/goni/goni.c +++ b/board/samsung/goni/goni.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c index 39a60e4ad29..d237828364c 100644 --- a/board/samsung/odroid/odroid.c +++ b/board/samsung/odroid/odroid.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c index 1cf4a3d5fa1..faee953cd4b 100644 --- a/board/st/common/stm32mp_dfu.c +++ b/board/st/common/stm32mp_dfu.c @@ -14,6 +14,7 @@ #include #include #include +#include #define DFU_ALT_BUF_LEN SZ_1K diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 3205a31c6d0..8f5719c28b3 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include diff --git a/board/sunxi/board.c b/board/sunxi/board.c index de0f3505e52..ebaa9431984 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -33,6 +33,7 @@ #include #include #include +#include #ifndef CONFIG_ARM64 #include #endif diff --git a/board/synopsys/hsdk/clk-lib.c b/board/synopsys/hsdk/clk-lib.c index bd43179fc79..be76d6c8f47 100644 --- a/board/synopsys/hsdk/clk-lib.c +++ b/board/synopsys/hsdk/clk-lib.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "clk-lib.h" diff --git a/board/synopsys/hsdk/env-lib.c b/board/synopsys/hsdk/env-lib.c index fd54ac75f20..d85e8167332 100644 --- a/board/synopsys/hsdk/env-lib.c +++ b/board/synopsys/hsdk/env-lib.c @@ -7,6 +7,7 @@ #include "env-lib.h" #include #include +#include #define MAX_CMD_LEN 25 diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c index d52ac332f81..8bb13ef5b2b 100644 --- a/board/ti/am65x/evm.c +++ b/board/ti/am65x/evm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "../common/board_detect.h" diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index 9a53884c98e..ac39b25cd42 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "board_detect.h" diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index 38fe447d8fa..d4f7c1d9f93 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "../common/board_detect.h" diff --git a/board/toradex/apalis-tk1/apalis-tk1.c b/board/toradex/apalis-tk1/apalis-tk1.c index 86b10400ffa..85134315918 100644 --- a/board/toradex/apalis-tk1/apalis-tk1.c +++ b/board/toradex/apalis-tk1/apalis-tk1.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/cmd/adc.c b/cmd/adc.c index a739d9e4641..4cb18b66d4a 100644 --- a/cmd/adc.c +++ b/cmd/adc.c @@ -7,6 +7,7 @@ #include #include #include +#include static int do_adc_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/fastboot.c b/cmd/fastboot.c index 17fb0a0aa7b..c3c19231c98 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -14,6 +14,7 @@ #include #include #include +#include #include static int do_fastboot_udp(int argc, char *const argv[], diff --git a/cmd/nvedit.c b/cmd/nvedit.c index fe99157fd17..eaa000bd355 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/cmd/onenand.c b/cmd/onenand.c index 3ec11246f6f..fad781583a3 100644 --- a/cmd/onenand.c +++ b/cmd/onenand.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/cmd/regulator.c b/cmd/regulator.c index 8988c901087..635a9add585 100644 --- a/cmd/regulator.c +++ b/cmd/regulator.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #define LIMIT_DEVNAME 20 diff --git a/cmd/thordown.c b/cmd/thordown.c index fcfd38f523c..48e22b31d02 100644 --- a/cmd/thordown.c +++ b/cmd/thordown.c @@ -12,6 +12,7 @@ #include #include #include +#include int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c index 9bdc9c660fd..c7fa6e775f5 100644 --- a/cmd/tpm_test.c +++ b/cmd/tpm_test.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "tpm-user-utils.h" #include diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c index 748aa0a7488..cbdda733533 100644 --- a/cmd/usb_gadget_sdp.c +++ b/cmd/usb_gadget_sdp.c @@ -11,6 +11,7 @@ #include #include #include +#include static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index 9c51ae0967f..a8ddeb49462 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -18,6 +18,7 @@ #include #include #include +#include static int ums_read_sector(struct ums *ums_dev, ulong start, lbaint_t blkcnt, void *buf) diff --git a/common/dfu.c b/common/dfu.c index 45206b9e225..0d154e8d4c4 100644 --- a/common/dfu.c +++ b/common/dfu.c @@ -19,6 +19,7 @@ #include #include #include +#include int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) { diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c index 5728d43ad3f..8a779da8fa1 100644 --- a/common/spl/spl_dfu.c +++ b/common/spl/spl_dfu.c @@ -15,6 +15,7 @@ #include #include #include +#include static int run_dfu(int usb_index, char *interface, char *devstring) { diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 730639f7562..cd73b256565 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -17,6 +17,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c index b0f40076c34..9e98a566f89 100644 --- a/common/spl/spl_opensbi.c +++ b/common/spl/spl_opensbi.c @@ -15,6 +15,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index 5a5ccd0676c..9143c27bbf1 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -10,6 +10,7 @@ #include #include #include +#include static int spl_sdp_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) diff --git a/common/update.c b/common/update.c index 3502713d7d8..ec302ca68fb 100644 --- a/common/update.c +++ b/common/update.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/disk/part_efi.c b/disk/part_efi.c index b7aef3731b5..4ce9243ef25 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -29,6 +29,7 @@ #include #include #include +#include #include /* GUID for basic data partitons */ diff --git a/drivers/adc/adc-uclass.c b/drivers/adc/adc-uclass.c index 6074eccbf09..1b35bf22014 100644 --- a/drivers/adc/adc-uclass.c +++ b/drivers/adc/adc-uclass.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #define ADC_UCLASS_PLATDATA_SIZE sizeof(struct adc_uclass_plat) diff --git a/drivers/adc/exynos-adc.c b/drivers/adc/exynos-adc.c index 65898170858..2bda733af90 100644 --- a/drivers/adc/exynos-adc.c +++ b/drivers/adc/exynos-adc.c @@ -8,6 +8,7 @@ #include #include #include +#include struct exynos_adc_priv { int active_channel; diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c index 37023512f0d..c15c7fea47f 100644 --- a/drivers/adc/meson-saradc.c +++ b/drivers/adc/meson-saradc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #define MESON_SAR_ADC_REG0 0x00 diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c index 809486eba27..03caca78b5f 100644 --- a/drivers/adc/rockchip-saradc.c +++ b/drivers/adc/rockchip-saradc.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #define SARADC_CTRL_CHN_MASK GENMASK(2, 0) diff --git a/drivers/adc/sandbox.c b/drivers/adc/sandbox.c index 6e435462ab8..43cad34ffeb 100644 --- a/drivers/adc/sandbox.c +++ b/drivers/adc/sandbox.c @@ -8,6 +8,7 @@ #include #include #include +#include /** * struct sandbox_adc_priv - sandbox ADC device's operation status and data diff --git a/drivers/ata/dwc_ahci.c b/drivers/ata/dwc_ahci.c index 1dc91e7fce7..15fd3e365b2 100644 --- a/drivers/ata/dwc_ahci.c +++ b/drivers/ata/dwc_ahci.c @@ -18,6 +18,7 @@ #endif #include #include +#include struct dwc_ahci_priv { void *base; diff --git a/drivers/bios_emulator/include/x86emu/debug.h b/drivers/bios_emulator/include/x86emu/debug.h index 4962a2acaf1..859b54d8600 100644 --- a/drivers/bios_emulator/include/x86emu/debug.h +++ b/drivers/bios_emulator/include/x86emu/debug.h @@ -43,6 +43,7 @@ /* checks to be enabled for "runtime" */ +#include #define CHECK_IP_FETCH_F 0x1 #define CHECK_SP_ACCESS_F 0x2 #define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */ diff --git a/drivers/bios_emulator/include/x86emu/regs.h b/drivers/bios_emulator/include/x86emu/regs.h index 29341297d96..4b4c5908923 100644 --- a/drivers/bios_emulator/include/x86emu/regs.h +++ b/drivers/bios_emulator/include/x86emu/regs.h @@ -41,6 +41,7 @@ /*---------------------- Macros and type definitions ----------------------*/ +#include #pragma pack(1) /* diff --git a/drivers/bios_emulator/x86emu/debug.c b/drivers/bios_emulator/x86emu/debug.c index 27e90e441aa..95f3cc09aad 100644 --- a/drivers/bios_emulator/x86emu/debug.c +++ b/drivers/bios_emulator/x86emu/debug.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/drivers/bios_emulator/x86emu/decode.c b/drivers/bios_emulator/x86emu/decode.c index a9a01b52d6c..e2028eaf083 100644 --- a/drivers/bios_emulator/x86emu/decode.c +++ b/drivers/bios_emulator/x86emu/decode.c @@ -37,6 +37,7 @@ * ****************************************************************************/ #include +#include #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/drivers/bios_emulator/x86emu/ops.c b/drivers/bios_emulator/x86emu/ops.c index ba18135fe13..8c1a146165c 100644 --- a/drivers/bios_emulator/x86emu/ops.c +++ b/drivers/bios_emulator/x86emu/ops.c @@ -73,6 +73,7 @@ ****************************************************************************/ #include +#include #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/drivers/bios_emulator/x86emu/ops2.c b/drivers/bios_emulator/x86emu/ops2.c index be4ef364432..6cd1ac39825 100644 --- a/drivers/bios_emulator/x86emu/ops2.c +++ b/drivers/bios_emulator/x86emu/ops2.c @@ -43,6 +43,7 @@ #include #include +#include #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/drivers/bios_emulator/x86emu/sys.c b/drivers/bios_emulator/x86emu/sys.c index 882a8a34cc3..f96652415cd 100644 --- a/drivers/bios_emulator/x86emu/sys.c +++ b/drivers/bios_emulator/x86emu/sys.c @@ -40,6 +40,7 @@ ****************************************************************************/ #include +#include #include "x86emu/x86emui.h" /*------------------------- Global Variables ------------------------------*/ diff --git a/drivers/bootcount/bootcount-uclass.c b/drivers/bootcount/bootcount-uclass.c index c747c9ab276..5a369c82f1c 100644 --- a/drivers/bootcount/bootcount-uclass.c +++ b/drivers/bootcount/bootcount-uclass.c @@ -10,6 +10,7 @@ #include #include #include +#include int dm_bootcount_get(struct udevice *dev, u32 *bootcount) { diff --git a/drivers/clk/analogbits/wrpll-cln28hpc.c b/drivers/clk/analogbits/wrpll-cln28hpc.c index 776ead319ae..a3cb109d357 100644 --- a/drivers/clk/analogbits/wrpll-cln28hpc.c +++ b/drivers/clk/analogbits/wrpll-cln28hpc.c @@ -26,6 +26,7 @@ #include #include #include +#include /* MIN_INPUT_FREQ: minimum input clock frequency, in Hz (Fref_min) */ #define MIN_INPUT_FREQ 7000000 diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 6ab137a72be..2ad682b8fe2 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "clk.h" #define UBOOT_DM_CLK_CCF_DIVIDER "ccf_clk_divider" diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index a8775c77dc2..cfd90b717e7 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "clk.h" diff --git a/drivers/clk/clk-hsdk-cgu.c b/drivers/clk/clk-hsdk-cgu.c index e28543ef78b..85074f1b86e 100644 --- a/drivers/clk/clk-hsdk-cgu.c +++ b/drivers/clk/clk-hsdk-cgu.c @@ -19,6 +19,7 @@ #include #include #include +#include #include diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 017f25f7a5a..f410518461e 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "clk.h" diff --git a/drivers/clk/clk_boston.c b/drivers/clk/clk_boston.c index 2e81777b703..4bcf9117551 100644 --- a/drivers/clk/clk_boston.c +++ b/drivers/clk/clk_boston.c @@ -10,6 +10,7 @@ #include #include #include +#include struct clk_boston { struct regmap *regmap; diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c index b93c0bc64e7..1cb685ee9ab 100644 --- a/drivers/clk/imx/clk-pll14xx.c +++ b/drivers/clk/imx/clk-pll14xx.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "clk.h" diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index a47c431cf5f..3406ff592e1 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #if CONFIG_IS_ENABLED(OF_PLATDATA) diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index f748fb5189e..c37e8a53a26 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -24,6 +24,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/core/device.c b/drivers/core/device.c index 60f8d6700ad..bf7f261cbce 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -33,6 +33,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c index 431dd4e565d..b3b3d7ccdd5 100644 --- a/drivers/core/of_addr.c +++ b/drivers/core/of_addr.c @@ -14,6 +14,7 @@ #include #include #include +#include /* Max address size we deal with */ #define OF_MAX_ADDR_CELLS 4 diff --git a/drivers/core/root.c b/drivers/core/root.c index 47b1320a441..126b3140666 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -29,6 +29,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index b2ee5f1ede6..2adf26e2fe2 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -17,6 +17,7 @@ #include #include #include +#include LIST_HEAD(dfu_list); static int dfu_alt_num; diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index f5832083ba1..cdb3c18b01d 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -17,6 +17,7 @@ #include #include #include +#include static unsigned char *dfu_file_buf; static u64 dfu_file_buf_len; diff --git a/drivers/dfu/dfu_ram.c b/drivers/dfu/dfu_ram.c index 9d10303164e..c4f4bd2e482 100644 --- a/drivers/dfu/dfu_ram.c +++ b/drivers/dfu/dfu_ram.c @@ -13,6 +13,7 @@ #include #include #include +#include static int dfu_transfer_medium_ram(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void *buf, long *len) diff --git a/drivers/dma/bcm6348-iudma.c b/drivers/dma/bcm6348-iudma.c index 4fc650272d9..d4cfe0c1868 100644 --- a/drivers/dma/bcm6348-iudma.c +++ b/drivers/dma/bcm6348-iudma.c @@ -28,6 +28,7 @@ #include #include #include +#include #define DMA_RX_DESC 6 #define DMA_TX_DESC 1 diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c index 34f72fa5dc8..0c1d88e10c6 100644 --- a/drivers/dma/dma-uclass.c +++ b/drivers/dma/dma-uclass.c @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef CONFIG_DMA_CHANNELS static inline struct dma_ops *dma_dev_ops(struct udevice *dev) diff --git a/drivers/dma/lpc32xx_dma.c b/drivers/dma/lpc32xx_dma.c index ab58e97bfe2..0efdfd028cf 100644 --- a/drivers/dma/lpc32xx_dma.c +++ b/drivers/dma/lpc32xx_dma.c @@ -17,6 +17,7 @@ #include #include #include +#include /* DMA controller channel register structure */ struct dmac_chan_reg { diff --git a/drivers/dma/sandbox-dma-test.c b/drivers/dma/sandbox-dma-test.c index 2b8259a35b4..a19e5e37fb9 100644 --- a/drivers/dma/sandbox-dma-test.c +++ b/drivers/dma/sandbox-dma-test.c @@ -15,6 +15,7 @@ #include #include #include +#include #define SANDBOX_DMA_CH_CNT 3 #define SANDBOX_DMA_BUF_SIZE 1024 diff --git a/drivers/dma/ti-edma3.c b/drivers/dma/ti-edma3.c index 1ad3b92dbf4..31ffff07f5b 100644 --- a/drivers/dma/ti-edma3.c +++ b/drivers/dma/ti-edma3.c @@ -16,6 +16,7 @@ #include #include #include +#include #define EDMA3_SL_BASE(slot) (0x4000 + ((slot) << 5)) #define EDMA3_SL_MAX_NUM 512 diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 05c3a4311ce..4f2effd39a8 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c index 71cfaec6e9d..5fcadcdf503 100644 --- a/drivers/fastboot/fb_command.c +++ b/drivers/fastboot/fb_command.c @@ -12,6 +12,7 @@ #include #include #include +#include /** * image_size - final fastboot image size diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c index d9f0f07b2bc..8cb8ffa2c6c 100644 --- a/drivers/fastboot/fb_getvar.c +++ b/drivers/fastboot/fb_getvar.c @@ -12,6 +12,7 @@ #include #include #include +#include static void getvar_version(char *var_parameter, char *response); static void getvar_version_bootloader(char *var_parameter, char *response); diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c index 6d3a900c772..bbe26ddcc9b 100644 --- a/drivers/fastboot/fb_nand.c +++ b/drivers/fastboot/fb_nand.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index c1fc290bd25..5fc3cfe42ef 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -12,6 +12,7 @@ #include #include #include +#include #define DEFAULT_UDELAY 5 #define RETRIES 0 diff --git a/drivers/i2c/iproc_i2c.c b/drivers/i2c/iproc_i2c.c index d975e782649..39af49c4ec5 100644 --- a/drivers/i2c/iproc_i2c.c +++ b/drivers/i2c/iproc_i2c.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "errno.h" #include #include "iproc_i2c.h" diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index c656cf8b7a1..6fc9d1eba9d 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 836148e4c1a..b6c71789eec 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -19,6 +19,7 @@ #include #include #include +#include /* STM32 I2C registers */ struct stm32_i2c_regs { diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c index 5864a1ad5bc..57d77d56ea5 100644 --- a/drivers/i2c/tegra_i2c.c +++ b/drivers/i2c/tegra_i2c.c @@ -21,6 +21,7 @@ #include #include #include +#include enum i2c_type { TYPE_114, diff --git a/drivers/misc/sifive-otp.c b/drivers/misc/sifive-otp.c index 3e658b35662..a624a358802 100644 --- a/drivers/misc/sifive-otp.c +++ b/drivers/misc/sifive-otp.c @@ -24,6 +24,7 @@ #include #include #include +#include #define BYTES_PER_FUSE 4 diff --git a/drivers/misc/tegra186_bpmp.c b/drivers/misc/tegra186_bpmp.c index dbee7f77db3..fecac9c4d90 100644 --- a/drivers/misc/tegra186_bpmp.c +++ b/drivers/misc/tegra186_bpmp.c @@ -17,6 +17,7 @@ #include #include #include +#include #define BPMP_IVC_FRAME_COUNT 1 #define BPMP_IVC_FRAME_SIZE 128 diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 544798bb71d..2f849c43b12 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -16,6 +16,7 @@ #include #include #include +#include #define DWMMC_MAX_CH_NUM 4 #define DWMMC_MAX_FREQ 52000000 diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 66caf683f74..7c39c86c5e9 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 089a0442568..d96db7a0f83 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c index b206b0a0858..d21a30c9543 100644 --- a/drivers/mmc/mtk-sd.c +++ b/drivers/mmc/mtk-sd.c @@ -20,6 +20,7 @@ #include #include #include +#include /* MSDC_CFG */ #define MSDC_CFG_HS400_CK_MODE_EXT BIT(22) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 9cbe126106c..fc9c6c37996 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/drivers/mmc/sti_sdhci.c b/drivers/mmc/sti_sdhci.c index 6194768fd72..23a1dd43c9b 100644 --- a/drivers/mmc/sti_sdhci.c +++ b/drivers/mmc/sti_sdhci.c @@ -12,6 +12,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index b68594de373..5ff5e1a4d8b 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -27,6 +27,7 @@ #include #include #include +#include struct stm32_sdmmc2_plat { struct mmc_config cfg; diff --git a/drivers/mmc/xenon_sdhci.c b/drivers/mmc/xenon_sdhci.c index 16ac84a24a6..27dbe0404e0 100644 --- a/drivers/mmc/xenon_sdhci.c +++ b/drivers/mmc/xenon_sdhci.c @@ -23,6 +23,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index af3c4765c4d..51232581d96 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -23,6 +23,7 @@ #include #include #include +#include #endif #include diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c index 294daee7b22..972aec6e266 100644 --- a/drivers/mtd/nand/bbt.c +++ b/drivers/mtd/nand/bbt.c @@ -16,6 +16,7 @@ #ifndef __UBOOT__ #include #endif +#include /** * nanddev_bbt_init() - Initialize the BBT (Bad Block Table) diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index 4b9dd6a9269..f6d9c584f78 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c @@ -17,6 +17,7 @@ #endif #include #include +#include /** * nanddev_isbad() - Check if a block is bad diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c index 587941290dc..14766401bf6 100644 --- a/drivers/mtd/nand/raw/arasan_nfc.c +++ b/drivers/mtd/nand/raw/arasan_nfc.c @@ -18,6 +18,7 @@ #include #include #include +#include struct nand_config { u32 page; diff --git a/drivers/mtd/nand/raw/atmel_nand.c b/drivers/mtd/nand/raw/atmel_nand.c index b7e473c598d..6b17e744a69 100644 --- a/drivers/mtd/nand/raw/atmel_nand.c +++ b/drivers/mtd/nand/raw/atmel_nand.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c index aa095c439ba..4e6d99fd3ca 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c index e4bf1936810..6164989b937 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c index 586ea3d8fbb..dbd85af7079 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c index 85f318bd779..ef3649688c6 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c index a5e159ad521..027fdd37da3 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "brcmnand.h" diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c index e4e144bd7c8..71bbb8231bf 100644 --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -35,6 +35,7 @@ #include #include #include +#include /* Definitions for 4-bit hardware ECC */ #define NAND_TIMEOUT 10240 diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c index 28541177609..ac2e669d46b 100644 --- a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c +++ b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c @@ -28,6 +28,7 @@ #include #include #include +#include /* * MLC NAND controller registers. diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c index 356f8d9440b..b21a0b9d293 100644 --- a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c +++ b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c @@ -23,6 +23,7 @@ #include #include #include +#include struct lpc32xx_nand_slc_regs { u32 data; diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c index 051ded6a240..dbdc5b0bca1 100644 --- a/drivers/mtd/nand/raw/mxc_nand.c +++ b/drivers/mtd/nand/raw/mxc_nand.c @@ -15,6 +15,7 @@ #if defined(CONFIG_MX51) || defined(CONFIG_MX53) #include #endif +#include #include "mxc_nand.h" #define DRIVER_NAME "mxc_nand" diff --git a/drivers/mtd/nand/raw/nand_bch.c b/drivers/mtd/nand/raw/nand_bch.c index 734d1c6204e..bb48ebbb96c 100644 --- a/drivers/mtd/nand/raw/nand_bch.c +++ b/drivers/mtd/nand/raw/nand_bch.c @@ -10,6 +10,7 @@ #include #include #include +#include /*#include */ #include diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c b/drivers/mtd/nand/raw/pxa3xx_nand.c index d502e967f92..1d9a6d107b1 100644 --- a/drivers/mtd/nand/raw/pxa3xx_nand.c +++ b/drivers/mtd/nand/raw/pxa3xx_nand.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index 69dbb629e93..64be6486b4e 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -21,6 +21,7 @@ #include #include #include +#include /* Bad block marker length */ #define FMC2_BBM_LEN 2 diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index c0fa1e310c6..0b5b74dc242 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c index 139d978a49b..6086ecdfa3d 100644 --- a/drivers/mtd/nand/raw/tegra_nand.c +++ b/drivers/mtd/nand/raw/tegra_nand.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "tegra_nand.h" DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c index d4b40e810f0..d2363a0662e 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c index 545fdd7b697..bacaf13c570 100644 --- a/drivers/mtd/nand/raw/zynq_nand.c +++ b/drivers/mtd/nand/raw/zynq_nand.c @@ -21,6 +21,7 @@ #include #include #include +#include /* The NAND flash driver defines */ #define ZYNQ_NAND_CMD_PHASE 1 diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 70d8ae531ee..4ee11e812d8 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -30,6 +30,7 @@ #include #include #include +#include #endif /* SPI NAND index visible in MTD names */ diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 08fe7d427ac..762b01c1b0f 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "linux/mtd/flashchip.h" #include diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c index eca9edff603..cc1e449f4a7 100644 --- a/drivers/mtd/onenand/onenand_bbt.c +++ b/drivers/mtd/onenand/onenand_bbt.c @@ -20,6 +20,7 @@ #include #include #include +#include #include diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c index 657abaab8f4..c415e5149a0 100644 --- a/drivers/mtd/onenand/samsung.c +++ b/drivers/mtd/onenand/samsung.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 6093277f171..db20feb4dae 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c index 7aa24e129f9..0719fe845ca 100644 --- a/drivers/mtd/spi/spi-nor-tiny.c +++ b/drivers/mtd/spi/spi-nor-tiny.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index e488caa5547..2ef8fde3d32 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c @@ -81,6 +81,7 @@ #include #include #include +#include #endif #include diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 3ac0b194028..a1941b8eb88 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -33,6 +33,7 @@ #else #include #include +#include #endif #include #include diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index d2b7ca5e33f..b119cb6e9c0 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "ubi.h" #ifndef __UBOOT__ #include diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 9c8ce51636b..2e13ebb2fb7 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h @@ -17,6 +17,7 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); #endif #include +#include #ifndef __UBOOT__ #define ubi_assert(expr) do { \ diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index f44960186bb..175988899c3 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -28,6 +28,7 @@ #include #else #include +#include #endif #include #include diff --git a/drivers/net/bcm-sf2-eth-gmac.c b/drivers/net/bcm-sf2-eth-gmac.c index 3caf0f33109..cbe1e85222f 100644 --- a/drivers/net/bcm-sf2-eth-gmac.c +++ b/drivers/net/bcm-sf2-eth-gmac.c @@ -6,6 +6,7 @@ #ifdef BCM_GMAC_DEBUG #ifndef DEBUG #define DEBUG +#include #endif #endif diff --git a/drivers/net/bcm-sf2-eth.c b/drivers/net/bcm-sf2-eth.c index 88dc3ab3846..1524f5c9989 100644 --- a/drivers/net/bcm-sf2-eth.c +++ b/drivers/net/bcm-sf2-eth.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/drivers/net/bcm6348-eth.c b/drivers/net/bcm6348-eth.c index 53171736117..72dcd07d30d 100644 --- a/drivers/net/bcm6348-eth.c +++ b/drivers/net/bcm6348-eth.c @@ -18,6 +18,7 @@ #include #include #include +#include #define ETH_RX_DESC PKTBUFSRX #define ETH_MAX_MTU_SIZE 1518 diff --git a/drivers/net/bcm6368-eth.c b/drivers/net/bcm6368-eth.c index c2a8b9f0576..fdd938ce0dd 100644 --- a/drivers/net/bcm6368-eth.c +++ b/drivers/net/bcm6368-eth.c @@ -19,6 +19,7 @@ #include #include #include +#include #define ETH_PORT_STR "brcm,enetsw-port" diff --git a/drivers/net/designware.c b/drivers/net/designware.c index e09ca3313dd..20b86e74cec 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "designware.h" diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 1e92bd9ca9c..9b1a9e69bf8 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -52,6 +52,7 @@ #include #endif #include +#include #include "dwc_eth_qos.h" diff --git a/drivers/net/fsl-mc/dpio/qbman_sys.h b/drivers/net/fsl-mc/dpio/qbman_sys.h index ff998d49dc4..1c6e4891302 100644 --- a/drivers/net/fsl-mc/dpio/qbman_sys.h +++ b/drivers/net/fsl-mc/dpio/qbman_sys.h @@ -21,6 +21,7 @@ /* Trace the 3 different classes of read/write access to QBMan. #undef as * required. */ #include +#include #undef QBMAN_CCSR_TRACE #undef QBMAN_CINH_TRACE #undef QBMAN_CENA_TRACE diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c index a50cde338a2..587d3658fa9 100644 --- a/drivers/net/ftgmac100.c +++ b/drivers/net/ftgmac100.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "ftgmac100.h" diff --git a/drivers/net/mscc_eswitch/jr2_switch.c b/drivers/net/mscc_eswitch/jr2_switch.c index 1462b8f3bc8..7157428a685 100644 --- a/drivers/net/mscc_eswitch/jr2_switch.c +++ b/drivers/net/mscc_eswitch/jr2_switch.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "mscc_xfer.h" diff --git a/drivers/net/mscc_eswitch/ocelot_switch.c b/drivers/net/mscc_eswitch/ocelot_switch.c index 1bf6c42c0fc..7ea1f551a11 100644 --- a/drivers/net/mscc_eswitch/ocelot_switch.c +++ b/drivers/net/mscc_eswitch/ocelot_switch.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "mscc_xfer.h" #include "mscc_mac_table.h" diff --git a/drivers/net/mscc_eswitch/serval_switch.c b/drivers/net/mscc_eswitch/serval_switch.c index 38ddba12b66..be06e483373 100644 --- a/drivers/net/mscc_eswitch/serval_switch.c +++ b/drivers/net/mscc_eswitch/serval_switch.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "mscc_xfer.h" #include "mscc_mac_table.h" diff --git a/drivers/net/mscc_eswitch/servalt_switch.c b/drivers/net/mscc_eswitch/servalt_switch.c index db863c2a9ff..2d2329c204a 100644 --- a/drivers/net/mscc_eswitch/servalt_switch.c +++ b/drivers/net/mscc_eswitch/servalt_switch.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "mscc_xfer.h" #include "mscc_miim.h" diff --git a/drivers/net/mt7628-eth.c b/drivers/net/mt7628-eth.c index 0a9bdb3ddbd..b95de474fb0 100644 --- a/drivers/net/mt7628-eth.c +++ b/drivers/net/mt7628-eth.c @@ -28,6 +28,7 @@ #include #include #include +#include /* Ethernet frame engine register */ #define PDMA_RELATED 0x0800 diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c index d4111e73df1..3cfce058451 100644 --- a/drivers/net/mtk_eth.c +++ b/drivers/net/mtk_eth.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "mtk_eth.h" diff --git a/drivers/net/mvmdio.c b/drivers/net/mvmdio.c index c0ebcdb1f68..5ebcfe14b7f 100644 --- a/drivers/net/mvmdio.c +++ b/drivers/net/mvmdio.c @@ -13,6 +13,7 @@ #include #include #include +#include #define MVMDIO_SMI_DATA_SHIFT 0 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 7111e36aa0d..b6726031ebb 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c index ef1761a8bda..bd9cd952975 100644 --- a/drivers/net/phy/mscc.c +++ b/drivers/net/phy/mscc.c @@ -15,6 +15,7 @@ #include #include #include +#include /* Microsemi PHY ID's */ #define PHY_ID_VSC8530 0x00070560 diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 963702777c2..93e83661cec 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -51,6 +51,7 @@ #include #include #include +#include #undef DEBUG_RTL8169 #undef DEBUG_RTL8169_TX diff --git a/drivers/net/sni_ave.c b/drivers/net/sni_ave.c index f5a0d80af7a..8eeecbc4cf3 100644 --- a/drivers/net/sni_ave.c +++ b/drivers/net/sni_ave.c @@ -23,6 +23,7 @@ #include #include #include +#include #define AVE_GRST_DELAY_MSEC 40 #define AVE_MIN_XMITSIZE 60 diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c index f4e58093805..18a33c4c0e3 100644 --- a/drivers/net/ti/am65-cpsw-nuss.c +++ b/drivers/net/ti/am65-cpsw-nuss.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "cpsw_mdio.h" diff --git a/drivers/net/ti/cpsw-common.c b/drivers/net/ti/cpsw-common.c index 3140f2515fb..d5428274d19 100644 --- a/drivers/net/ti/cpsw-common.c +++ b/drivers/net/ti/cpsw-common.c @@ -12,6 +12,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c index 3a8cc9c52a5..877be7fca52 100644 --- a/drivers/net/ti/cpsw.c +++ b/drivers/net/ti/cpsw.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "cpsw_mdio.h" diff --git a/drivers/net/ti/keystone_net.c b/drivers/net/ti/keystone_net.c index 89b04b6fbda..43dbf3f1067 100644 --- a/drivers/net/ti/keystone_net.c +++ b/drivers/net/ti/keystone_net.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 0adcdceb1d3..ae7350aaff9 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -24,6 +24,7 @@ #endif #include #include +#include #include "pci_internal.h" DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c index 93a7508d8a2..3697cd8d652 100644 --- a/drivers/pci/pci_mvebu.c +++ b/drivers/pci/pci_mvebu.c @@ -28,6 +28,7 @@ #include #include #include +#include #include /* PCIe unit register offsets */ diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c index 29d54117e93..131c21b7684 100644 --- a/drivers/pci/pci_tegra.c +++ b/drivers/pci/pci_tegra.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/drivers/pci/pcie_ecam_generic.c b/drivers/pci/pcie_ecam_generic.c index 1a9f9aec2ee..2e089b0e033 100644 --- a/drivers/pci/pcie_ecam_generic.c +++ b/drivers/pci/pcie_ecam_generic.c @@ -11,6 +11,7 @@ #include #include #include +#include #include diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c index 8d89a1e5919..ec917ee7d5b 100644 --- a/drivers/pci/pcie_fsl.c +++ b/drivers/pci/pcie_fsl.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "pcie_fsl.h" #include diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c index c6e30e24622..ed25a10bcf0 100644 --- a/drivers/pci/pcie_mediatek.c +++ b/drivers/pci/pcie_mediatek.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "pci_internal.h" /* PCIe shared registers */ diff --git a/drivers/pci/pcie_phytium.c b/drivers/pci/pcie_phytium.c index a8072762542..3bd1f5cd6d9 100644 --- a/drivers/pci/pcie_phytium.c +++ b/drivers/pci/pcie_phytium.c @@ -12,6 +12,7 @@ #include #include #include +#include /** * struct phytium_pcie - phytium PCIe controller state diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c index eb9ec97b74f..53fd121e905 100644 --- a/drivers/pci/pcie_xilinx.c +++ b/drivers/pci/pcie_xilinx.c @@ -10,6 +10,7 @@ #include #include #include +#include #include diff --git a/drivers/phy/keystone-usb-phy.c b/drivers/phy/keystone-usb-phy.c index 12f8a265f77..6799e232370 100644 --- a/drivers/phy/keystone-usb-phy.c +++ b/drivers/phy/keystone-usb-phy.c @@ -13,6 +13,7 @@ #include #include #include +#include /* USB PHY control register offsets */ #define USB_PHY_CTL_UTMI 0x0000 diff --git a/drivers/phy/marvell/comphy_cp110.c b/drivers/phy/marvell/comphy_cp110.c index a7e0099045f..bb15fbaf347 100644 --- a/drivers/phy/marvell/comphy_cp110.c +++ b/drivers/phy/marvell/comphy_cp110.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "comphy_core.h" #include "sata.h" diff --git a/drivers/phy/meson-g12a-usb2.c b/drivers/phy/meson-g12a-usb2.c index 650b88bd180..8b243225156 100644 --- a/drivers/phy/meson-g12a-usb2.c +++ b/drivers/phy/meson-g12a-usb2.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/phy/meson-g12a-usb3-pcie.c b/drivers/phy/meson-g12a-usb3-pcie.c index 8f72b5a6a74..40a5da948dc 100644 --- a/drivers/phy/meson-g12a-usb3-pcie.c +++ b/drivers/phy/meson-g12a-usb3-pcie.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include diff --git a/drivers/phy/meson-gxbb-usb2.c b/drivers/phy/meson-gxbb-usb2.c index 70a80b86381..725b056a71a 100644 --- a/drivers/phy/meson-gxbb-usb2.c +++ b/drivers/phy/meson-gxbb-usb2.c @@ -15,6 +15,7 @@ #include #include #include +#include #define REG_CONFIG 0x00 #define REG_CONFIG_CLK_EN BIT(0) diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c index 4c631310efa..8f5e4a43661 100644 --- a/drivers/phy/meson-gxl-usb2.c +++ b/drivers/phy/meson-gxl-usb2.c @@ -11,12 +11,13 @@ #include #include #include +#include #include #include #include #include #include -#include +#include #include #include diff --git a/drivers/phy/phy-rcar-gen3.c b/drivers/phy/phy-rcar-gen3.c index 8c59631428b..7159e7e8716 100644 --- a/drivers/phy/phy-rcar-gen3.c +++ b/drivers/phy/phy-rcar-gen3.c @@ -17,6 +17,7 @@ #include #include #include +#include #include /* USB2.0 Host registers (original offset is +0x200) */ diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c index 15bd60ca8c5..000e495dbd4 100644 --- a/drivers/phy/phy-stm32-usbphyc.c +++ b/drivers/phy/phy-stm32-usbphyc.c @@ -23,6 +23,7 @@ #include #include #include +#include #include /* USBPHYC registers */ diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index 190108e04c7..22f2fe91487 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -12,6 +12,7 @@ #include #include #include +#include #include /** diff --git a/drivers/phy/sti_usb_phy.c b/drivers/phy/sti_usb_phy.c index ce4caafce7e..9e5ac9bfde6 100644 --- a/drivers/phy/sti_usb_phy.c +++ b/drivers/phy/sti_usb_phy.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include diff --git a/drivers/phy/ti-pipe3-phy.c b/drivers/phy/ti-pipe3-phy.c index b5b3c3f1522..313735844ab 100644 --- a/drivers/phy/ti-pipe3-phy.c +++ b/drivers/phy/ti-pipe3-phy.c @@ -16,6 +16,7 @@ #include #include #include +#include /* PLLCTRL Registers */ #define PLL_STATUS 0x00000004 diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 1be6252227d..e834dddfd13 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -35,6 +35,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/pinctrl/pinctrl-sti.c b/drivers/pinctrl/pinctrl-sti.c index 20cdbb0702e..1ff7ea00555 100644 --- a/drivers/pinctrl/pinctrl-sti.c +++ b/drivers/pinctrl/pinctrl-sti.c @@ -17,6 +17,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index b06da50b2cd..8bb7588714a 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "../gpio/stm32_gpio_priv.h" diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c index 0959445364e..3ac97123401 100644 --- a/drivers/power/palmas.c +++ b/drivers/power/palmas.c @@ -5,6 +5,7 @@ */ #include #include +#include void palmas_init_settings(void) { diff --git a/drivers/power/pmic/as3722.c b/drivers/power/pmic/as3722.c index 3aa3cce945e..c7dd9705d18 100644 --- a/drivers/power/pmic/as3722.c +++ b/drivers/power/pmic/as3722.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/drivers/power/pmic/as3722_gpio.c b/drivers/power/pmic/as3722_gpio.c index 96943bc1ad5..987fbdf9bc0 100644 --- a/drivers/power/pmic/as3722_gpio.c +++ b/drivers/power/pmic/as3722_gpio.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/drivers/power/pmic/bd71837.c b/drivers/power/pmic/bd71837.c index fdbbd6f5593..ee6ae78e5c4 100644 --- a/drivers/power/pmic/bd71837.c +++ b/drivers/power/pmic/bd71837.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/da9063.c b/drivers/power/pmic/da9063.c index 25101d18f74..ca95b82e6d0 100644 --- a/drivers/power/pmic/da9063.c +++ b/drivers/power/pmic/da9063.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/fan53555.c b/drivers/power/pmic/fan53555.c index 0d91628f572..d556b9a5878 100644 --- a/drivers/power/pmic/fan53555.c +++ b/drivers/power/pmic/fan53555.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/i2c_pmic_emul.c b/drivers/power/pmic/i2c_pmic_emul.c index abe3a1051f1..f0a03742f87 100644 --- a/drivers/power/pmic/i2c_pmic_emul.c +++ b/drivers/power/pmic/i2c_pmic_emul.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/drivers/power/pmic/lp873x.c b/drivers/power/pmic/lp873x.c index 2b1260ec6b1..fda5bc15164 100644 --- a/drivers/power/pmic/lp873x.c +++ b/drivers/power/pmic/lp873x.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/lp87565.c b/drivers/power/pmic/lp87565.c index f4a4bd03d70..904e02c4d81 100644 --- a/drivers/power/pmic/lp87565.c +++ b/drivers/power/pmic/lp87565.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/max77686.c b/drivers/power/pmic/max77686.c index 9f02c0b6f6f..7e6f7d1966f 100644 --- a/drivers/power/pmic/max77686.c +++ b/drivers/power/pmic/max77686.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/max8997.c b/drivers/power/pmic/max8997.c index dbae155fb34..504a63bf743 100644 --- a/drivers/power/pmic/max8997.c +++ b/drivers/power/pmic/max8997.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/max8998.c b/drivers/power/pmic/max8998.c index f58d9f2d74c..d155474447f 100644 --- a/drivers/power/pmic/max8998.c +++ b/drivers/power/pmic/max8998.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c index 6080cbff0be..eb83c88d564 100644 --- a/drivers/power/pmic/palmas.c +++ b/drivers/power/pmic/palmas.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c index e99ece8fb08..0bbe98cd8a2 100644 --- a/drivers/power/pmic/pca9450.c +++ b/drivers/power/pmic/pca9450.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/pfuze100.c b/drivers/power/pmic/pfuze100.c index 65c4456977c..15420acb472 100644 --- a/drivers/power/pmic/pfuze100.c +++ b/drivers/power/pmic/pfuze100.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/pmic_tps65910_dm.c b/drivers/power/pmic/pmic_tps65910_dm.c index e03ddc98d73..8ead1db802a 100644 --- a/drivers/power/pmic/pmic_tps65910_dm.c +++ b/drivers/power/pmic/pmic_tps65910_dm.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/s2mps11.c b/drivers/power/pmic/s2mps11.c index 1ba1640a8df..5ff4f205211 100644 --- a/drivers/power/pmic/s2mps11.c +++ b/drivers/power/pmic/s2mps11.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/drivers/power/pmic/s5m8767.c b/drivers/power/pmic/s5m8767.c index db6d0357ee4..eea072ae824 100644 --- a/drivers/power/pmic/s5m8767.c +++ b/drivers/power/pmic/s5m8767.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/sandbox.c b/drivers/power/pmic/sandbox.c index acfeae2df97..14b82455f5f 100644 --- a/drivers/power/pmic/sandbox.c +++ b/drivers/power/pmic/sandbox.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/pmic/tps65090.c b/drivers/power/pmic/tps65090.c index b81df0dff1a..2a04d5948a5 100644 --- a/drivers/power/pmic/tps65090.c +++ b/drivers/power/pmic/tps65090.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/drivers/power/pmic/tps65941.c b/drivers/power/pmic/tps65941.c index 83d0f83c64a..727b42747ab 100644 --- a/drivers/power/pmic/tps65941.c +++ b/drivers/power/pmic/tps65941.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/regulator/bd71837.c b/drivers/power/regulator/bd71837.c index d4f8da80ad7..913ed88d45f 100644 --- a/drivers/power/regulator/bd71837.c +++ b/drivers/power/regulator/bd71837.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/regulator/fan53555.c b/drivers/power/regulator/fan53555.c index 815f96beef6..fa8d88f2e0d 100644 --- a/drivers/power/regulator/fan53555.c +++ b/drivers/power/regulator/fan53555.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c index f7ddba8b45e..590c288d657 100644 --- a/drivers/power/regulator/fixed.c +++ b/drivers/power/regulator/fixed.c @@ -11,8 +11,10 @@ #include #include #include +#include #include #include +#include "regulator_common.h" #include "regulator_common.h" diff --git a/drivers/power/regulator/gpio-regulator.c b/drivers/power/regulator/gpio-regulator.c index ded7be059bb..74137b7b876 100644 --- a/drivers/power/regulator/gpio-regulator.c +++ b/drivers/power/regulator/gpio-regulator.c @@ -10,8 +10,10 @@ #include #include #include +#include #include #include +#include "regulator_common.h" #include "regulator_common.h" diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c index cef20e11897..3a208039934 100644 --- a/drivers/power/regulator/max77686.c +++ b/drivers/power/regulator/max77686.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c index 5bf186e4d4c..cf4e2858443 100644 --- a/drivers/power/regulator/pbias_regulator.c +++ b/drivers/power/regulator/pbias_regulator.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c index e26f5ebec34..0116fa01bbf 100644 --- a/drivers/power/regulator/regulator_common.c +++ b/drivers/power/regulator/regulator_common.c @@ -7,8 +7,10 @@ #include #include #include +#include #include #include +#include "regulator_common.h" #include "regulator_common.h" diff --git a/drivers/power/regulator/s2mps11_regulator.c b/drivers/power/regulator/s2mps11_regulator.c index 93fb580407a..987a1f9d863 100644 --- a/drivers/power/regulator/s2mps11_regulator.c +++ b/drivers/power/regulator/s2mps11_regulator.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/regulator/sandbox.c b/drivers/power/regulator/sandbox.c index e8b66bf2b14..71ef0c5441a 100644 --- a/drivers/power/regulator/sandbox.c +++ b/drivers/power/regulator/sandbox.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/regulator/tps65910_regulator.c b/drivers/power/regulator/tps65910_regulator.c index 0ed4952a1e0..a4b9d449274 100644 --- a/drivers/power/regulator/tps65910_regulator.c +++ b/drivers/power/regulator/tps65910_regulator.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c index d3e8949af99..0c7c3960904 100644 --- a/drivers/power/twl4030.c +++ b/drivers/power/twl4030.c @@ -25,6 +25,7 @@ #include #include #include +#include /* * Power Reset diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c index 2b50a56faf8..39c05f9b7d3 100644 --- a/drivers/power/twl6030.c +++ b/drivers/power/twl6030.c @@ -5,6 +5,7 @@ */ #include #include +#include #include diff --git a/drivers/ram/imxrt_sdram.c b/drivers/ram/imxrt_sdram.c index d0a88845cf9..6a15242c20c 100644 --- a/drivers/ram/imxrt_sdram.c +++ b/drivers/ram/imxrt_sdram.c @@ -15,6 +15,7 @@ #include #include #include +#include /* SDRAM Command Code */ #define SD_CC_ARD 0x0 /* Master Bus (AXI) command - Read */ diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index dd5b1917445..f36be941a38 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -23,6 +23,7 @@ #include #include #include +#include struct dram_info { struct ram_info info; diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c index 47a930ee954..891f4137813 100644 --- a/drivers/ram/stm32_sdram.c +++ b/drivers/ram/stm32_sdram.c @@ -16,6 +16,7 @@ #include #include #include +#include #define MEM_MODE_MASK GENMASK(2, 0) #define SWP_FMC_OFFSET 10 diff --git a/drivers/ram/stm32mp1/stm32mp1_ddr.c b/drivers/ram/stm32mp1/stm32mp1_ddr.c index ab913a68761..8ee4e24f39d 100644 --- a/drivers/ram/stm32mp1/stm32mp1_ddr.c +++ b/drivers/ram/stm32mp1/stm32mp1_ddr.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "stm32mp1_ddr.h" #include "stm32mp1_ddr_regs.h" diff --git a/drivers/ram/stm32mp1/stm32mp1_ram.c b/drivers/ram/stm32mp1/stm32mp1_ram.c index a6c19af9722..61bc002d979 100644 --- a/drivers/ram/stm32mp1/stm32mp1_ram.c +++ b/drivers/ram/stm32mp1/stm32mp1_ram.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "stm32mp1_ddr.h" #include "stm32mp1_ddr_regs.h" diff --git a/drivers/remoteproc/rproc-elf-loader.c b/drivers/remoteproc/rproc-elf-loader.c index b185a6cafb8..5e070e5076e 100644 --- a/drivers/remoteproc/rproc-elf-loader.c +++ b/drivers/remoteproc/rproc-elf-loader.c @@ -11,6 +11,7 @@ #include #include #include +#include /** * struct resource_table - firmware resource table header diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c index 19fe4053be8..ece534c3c0e 100644 --- a/drivers/remoteproc/rproc-uclass.c +++ b/drivers/remoteproc/rproc-uclass.c @@ -20,6 +20,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/remoteproc/sandbox_testproc.c b/drivers/remoteproc/sandbox_testproc.c index 78b108184bb..d360cf3169f 100644 --- a/drivers/remoteproc/sandbox_testproc.c +++ b/drivers/remoteproc/sandbox_testproc.c @@ -10,6 +10,7 @@ #include #include #include +#include /** * enum sandbox_state - different device states diff --git a/drivers/remoteproc/stm32_copro.c b/drivers/remoteproc/stm32_copro.c index 5271f83bc0b..3e322c4d719 100644 --- a/drivers/remoteproc/stm32_copro.c +++ b/drivers/remoteproc/stm32_copro.c @@ -14,6 +14,7 @@ #include #include #include +#include /** * struct stm32_copro_privdata - power processor private data diff --git a/drivers/remoteproc/ti_power_proc.c b/drivers/remoteproc/ti_power_proc.c index 86d544cc854..6887a3c8541 100644 --- a/drivers/remoteproc/ti_power_proc.c +++ b/drivers/remoteproc/ti_power_proc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/remoteproc/ti_sci_proc.h b/drivers/remoteproc/ti_sci_proc.h index f8299d1aff9..36351da63fc 100644 --- a/drivers/remoteproc/ti_sci_proc.h +++ b/drivers/remoteproc/ti_sci_proc.h @@ -10,6 +10,7 @@ #ifndef REMOTEPROC_TI_SCI_PROC_H #define REMOTEPROC_TI_SCI_PROC_H +#include #define TISCI_INVALID_HOST 0xff /** diff --git a/drivers/reset/sti-reset.c b/drivers/reset/sti-reset.c index ea449bbaaf0..5305270fbf2 100644 --- a/drivers/reset/sti-reset.c +++ b/drivers/reset/sti-reset.c @@ -16,6 +16,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c index 2dffa14ea75..f146f2b006e 100644 --- a/drivers/serial/serial_mtk.c +++ b/drivers/serial/serial_mtk.c @@ -19,6 +19,7 @@ #include #include #include +#include struct mtk_serial_regs { u32 rbr; diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c index f110d78ce10..9881bffc8e1 100644 --- a/drivers/soc/ti/k3-navss-ringacc.c +++ b/drivers/soc/ti/k3-navss-ringacc.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 702e2253581..aec6f4eca9a 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c @@ -17,6 +17,7 @@ #include #endif #include +#include /* * Register definitions for the Atmel AT32/AT91 SPI Controller diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c index 8e5cc5552f0..f8ec268812c 100644 --- a/drivers/spi/fsl_dspi.c +++ b/drivers/spi/fsl_dspi.c @@ -26,6 +26,7 @@ #include #include #include +#include /* linux/include/time.h */ #define NSEC_PER_SEC 1000000000L diff --git a/drivers/spi/mt7621_spi.c b/drivers/spi/mt7621_spi.c index eb0931747b7..3d008099862 100644 --- a/drivers/spi/mt7621_spi.c +++ b/drivers/spi/mt7621_spi.c @@ -16,6 +16,7 @@ #include #include #include +#include #define MT7621_RX_FIFO_LEN 32 #define MT7621_TX_FIFO_LEN 36 diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index 840660ffe9a..33360a18329 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -19,6 +19,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c index fc7388b379d..e2b49ebd149 100644 --- a/drivers/spi/pl022_spi.c +++ b/drivers/spi/pl022_spi.c @@ -18,6 +18,7 @@ #include #include #include +#include #define SSP_CR0 0x000 #define SSP_CR1 0x004 diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index eb52ff73b23..2ffa201a66e 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -22,6 +22,7 @@ #include #include #include +#include #include struct stm32_qspi_regs { diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c index fe5419e8518..82f6ed783f9 100644 --- a/drivers/spi/stm32_spi.c +++ b/drivers/spi/stm32_spi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c index fcc1bfe64b6..6402acbf14a 100644 --- a/drivers/spi/uniphier_spi.c +++ b/drivers/spi/uniphier_spi.c @@ -17,6 +17,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/sysreset/sysreset_sti.c b/drivers/sysreset/sysreset_sti.c index f0f445f22ed..edd90aab061 100644 --- a/drivers/sysreset/sysreset_sti.c +++ b/drivers/sysreset/sysreset_sti.c @@ -12,6 +12,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/sysreset/sysreset_syscon.c b/drivers/sysreset/sysreset_syscon.c index 525faf2f89e..e468dac0e90 100644 --- a/drivers/sysreset/sysreset_syscon.c +++ b/drivers/sysreset/sysreset_syscon.c @@ -14,6 +14,7 @@ #include #include #include +#include struct syscon_reboot_priv { struct regmap *regmap; diff --git a/drivers/sysreset/sysreset_watchdog.c b/drivers/sysreset/sysreset_watchdog.c index 8a659ee9b97..ceada2e47b5 100644 --- a/drivers/sysreset/sysreset_watchdog.c +++ b/drivers/sysreset/sysreset_watchdog.c @@ -10,6 +10,7 @@ #include #include #include +#include struct wdt_reboot_plat { struct udevice *wdt; diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c index 525ad72f4c9..16f4af0e331 100644 --- a/drivers/tpm/tpm_tis_infineon.c +++ b/drivers/tpm/tpm_tis_infineon.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index cae570cf598..7aa0c6b2bee 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index cff86a51ae0..7137a569d97 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 3997b9dbff4..744fde80694 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index c62e42de73f..dc5a976f71a 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index eb416b832aa..68cf32cd189 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c index 8a256b3e346..d94204f22d5 100644 --- a/drivers/usb/eth/mcs7830.c +++ b/drivers/usb/eth/mcs7830.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "usb_ether.h" diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index c9dbec937b2..e573a03477b 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 3bd7b3c075a..f16731c8ebd 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index 589db8c972b..27082f5152c 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 11b1a6221b3..36618f0bdf3 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 6d97b4bbdc3..741775a7bcf 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index 37f6281abfb..2b3a9c5fd4c 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 3caa4c36387..0e7529dcdbb 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c index 9dfae08313b..3e433129ace 100644 --- a/drivers/usb/gadget/udc/udc-uclass.c +++ b/drivers/usb/gadget/udc/udc-uclass.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #if CONFIG_IS_ENABLED(DM_USB_GADGET) diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c index 239b671ac38..4a3ab611127 100644 --- a/drivers/usb/host/dwc3-sti-glue.c +++ b/drivers/usb/host/dwc3-sti-glue.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/drivers/usb/musb-new/mt85xx.c b/drivers/usb/musb-new/mt85xx.c index 730045cf9a7..1e632dca046 100644 --- a/drivers/usb/musb-new/mt85xx.c +++ b/drivers/usb/musb-new/mt85xx.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include "linux-compat.h" diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c index a42d98ece9b..00da554982f 100644 --- a/drivers/usb/musb-new/musb_core.c +++ b/drivers/usb/musb-new/musb_core.c @@ -86,6 +86,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/musb-new/musb_debug.h b/drivers/usb/musb-new/musb_debug.h index c468bda9ff2..94375b72c70 100644 --- a/drivers/usb/musb-new/musb_debug.h +++ b/drivers/usb/musb-new/musb_debug.h @@ -10,6 +10,7 @@ #ifndef __MUSB_LINUX_DEBUG_H__ #define __MUSB_LINUX_DEBUG_H__ +#include #define yprintk(facility, format, args...) \ do { printk(facility "%s %d: " format , \ __func__, __LINE__ , ## args); } while (0) diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c index d55a920ae59..a8ff7434c9f 100644 --- a/drivers/usb/musb-new/musb_dsps.c +++ b/drivers/usb/musb-new/musb_dsps.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "linux-compat.h" #endif diff --git a/drivers/usb/musb-new/musb_gadget.c b/drivers/usb/musb-new/musb_gadget.c index 05bd9487857..c6083963ede 100644 --- a/drivers/usb/musb-new/musb_gadget.c +++ b/drivers/usb/musb-new/musb_gadget.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "linux-compat.h" #endif diff --git a/drivers/usb/musb-new/musb_gadget_ep0.c b/drivers/usb/musb-new/musb_gadget_ep0.c index 7fdd24005e7..55ce8de99bb 100644 --- a/drivers/usb/musb-new/musb_gadget_ep0.c +++ b/drivers/usb/musb-new/musb_gadget_ep0.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "linux-compat.h" #endif diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c index 482dfdc6be6..308eff832c9 100644 --- a/drivers/usb/musb-new/omap2430.c +++ b/drivers/usb/musb-new/omap2430.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 485b9dce156..91f082fe05e 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "linux-compat.h" #include "musb_core.h" diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93dd85..ed5e5194d8c 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/video/meson/meson_dw_hdmi.c b/drivers/video/meson/meson_dw_hdmi.c index e5f28132053..5db01904b53 100644 --- a/drivers/video/meson/meson_dw_hdmi.c +++ b/drivers/video/meson/meson_dw_hdmi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/video/meson/meson_vclk.c b/drivers/video/meson/meson_vclk.c index cd1e69040f7..e718a0074ed 100644 --- a/drivers/video/meson/meson_vclk.c +++ b/drivers/video/meson/meson_vclk.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "meson_vpu.h" #include #include diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c index a7420fb2ee7..a18c1e027a8 100644 --- a/drivers/video/stm32/stm32_dsi.c +++ b/drivers/video/stm32/stm32_dsi.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #define HWVER_130 0x31333000 /* IP version 1.30 */ diff --git a/drivers/video/stm32/stm32_ltdc.c b/drivers/video/stm32/stm32_ltdc.c index f48badc517a..6fd90e33919 100644 --- a/drivers/video/stm32/stm32_ltdc.c +++ b/drivers/video/stm32/stm32_ltdc.c @@ -20,6 +20,7 @@ #include #include #include +#include struct stm32_ltdc_priv { void __iomem *regs; diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c index f291db3dc76..258685182c7 100644 --- a/drivers/video/tegra124/sor.c +++ b/drivers/video/tegra124/sor.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "displayport.h" #include "sor.h" #include diff --git a/drivers/watchdog/stm32mp_wdt.c b/drivers/watchdog/stm32mp_wdt.c index 4be616c1b6b..7ebcd255266 100644 --- a/drivers/watchdog/stm32mp_wdt.c +++ b/drivers/watchdog/stm32mp_wdt.c @@ -15,6 +15,7 @@ #include #include #include +#include /* IWDG registers */ #define IWDG_KR 0x00 /* Key register */ diff --git a/env/common.c b/env/common.c index 21045a7eb33..eb1a9137953 100644 --- a/env/common.c +++ b/env/common.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index bede7d01cab..ff2a5719c3e 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c @@ -18,6 +18,7 @@ #include #include #include +#include #ifndef __UBOOT__ #include diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 0ecc2e0c8e9..d8324aea5f7 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h @@ -12,6 +12,7 @@ #define __UBIFS_DEBUG_H__ /* Checking helper functions */ +#include typedef int (*dbg_leaf_callback)(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *priv); typedef int (*dbg_znode_callback)(struct ubifs_info *c, diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index ba0b19a1f2b..2e50c08f4df 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c @@ -24,6 +24,7 @@ #include #include #include +#include #endif #include "ubifs.h" diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 034c41a7035..3e7160352e6 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include "ubifs.h" diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 46dfbd0b5ab..67b13c83b56 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include diff --git a/fs/yaffs2/yaffs_uboot_glue.c b/fs/yaffs2/yaffs_uboot_glue.c index ec8d028316a..0a920561149 100644 --- a/fs/yaffs2/yaffs_uboot_glue.c +++ b/fs/yaffs2/yaffs_uboot_glue.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "nand.h" diff --git a/include/common.h b/include/common.h index 25c317f4439..a79c2bb4993 100644 --- a/include/common.h +++ b/include/common.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/include/crypto/pkcs7_parser.h b/include/crypto/pkcs7_parser.h index 906033a90eb..2c45cce5234 100644 --- a/include/crypto/pkcs7_parser.h +++ b/include/crypto/pkcs7_parser.h @@ -11,6 +11,7 @@ #include #include #include +#include #define kenter(FMT, ...) \ pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__) diff --git a/include/dm/device_compat.h b/include/dm/device_compat.h index 82d7a7d4924..aa9a6fbb5e3 100644 --- a/include/dm/device_compat.h +++ b/include/dm/device_compat.h @@ -14,6 +14,7 @@ #include #include #include +#include /* * Define a new identifier which can be tested on by C code. A similar diff --git a/include/linux/soc/ti/cppi5.h b/include/linux/soc/ti/cppi5.h index cfdf7ea29fc..3a55c3ec46f 100644 --- a/include/linux/soc/ti/cppi5.h +++ b/include/linux/soc/ti/cppi5.h @@ -11,6 +11,7 @@ #include #include #include +#include /** * Descriptor header, present in all types of descriptors diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c index bcb0390eb41..1191fc36487 100644 --- a/lib/asn1_decoder.c +++ b/lib/asn1_decoder.c @@ -8,6 +8,7 @@ #ifdef __UBOOT__ #include #include +#include #else #include #endif diff --git a/lib/bch.c b/lib/bch.c index de66b1acba5..72b4fdcc9c4 100644 --- a/lib/bch.c +++ b/lib/bch.c @@ -61,6 +61,7 @@ #include #include +#include #else #include #if defined(__FreeBSD__) diff --git a/lib/crypto/asymmetric_type.c b/lib/crypto/asymmetric_type.c index 1d0532d0f2e..24c2d15ef97 100644 --- a/lib/crypto/asymmetric_type.c +++ b/lib/crypto/asymmetric_type.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #else #include diff --git a/lib/crypto/pkcs7_parser.c b/lib/crypto/pkcs7_parser.c index 0b85fe8286c..d5efa828d6a 100644 --- a/lib/crypto/pkcs7_parser.c +++ b/lib/crypto/pkcs7_parser.c @@ -11,6 +11,7 @@ #include #include #include +#include #endif #include #ifndef __UBOOT__ diff --git a/lib/crypto/pkcs7_verify.c b/lib/crypto/pkcs7_verify.c index b832f013566..9d7b9f6bce8 100644 --- a/lib/crypto/pkcs7_verify.c +++ b/lib/crypto/pkcs7_verify.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/crypto/public_key.c b/lib/crypto/public_key.c index 3671ed13855..6efe951c057 100644 --- a/lib/crypto/public_key.c +++ b/lib/crypto/public_key.c @@ -13,6 +13,7 @@ #include #include #include +#include #else #include #include diff --git a/lib/crypto/rsa_helper.c b/lib/crypto/rsa_helper.c index cc0c0d6637b..c941d40fd7a 100644 --- a/lib/crypto/rsa_helper.c +++ b/lib/crypto/rsa_helper.c @@ -15,6 +15,7 @@ #include #endif #include +#include #include "rsapubkey.asn1.h" #ifndef __UBOOT__ #include "rsaprivkey.asn1.h" diff --git a/lib/crypto/x509_cert_parser.c b/lib/crypto/x509_cert_parser.c index eb24349460c..a0f0689118f 100644 --- a/lib/crypto/x509_cert_parser.c +++ b/lib/crypto/x509_cert_parser.c @@ -16,6 +16,7 @@ #include #include #ifdef __UBOOT__ +#include #include #endif #include diff --git a/lib/crypto/x509_public_key.c b/lib/crypto/x509_public_key.c index 5c0e2b622db..30071233ee7 100644 --- a/lib/crypto/x509_public_key.c +++ b/lib/crypto/x509_public_key.c @@ -13,6 +13,7 @@ #include #include #include +#include #else #include #endif diff --git a/lib/list_sort.c b/lib/list_sort.c index 58e1e1614a5..1c9e0617327 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -8,6 +8,7 @@ #include #include #include +#include #endif #include #include diff --git a/net/fastboot_udp.c b/net/fastboot_udp.c index d706928d168..d6907874787 100644 --- a/net/fastboot_udp.c +++ b/net/fastboot_udp.c @@ -8,6 +8,7 @@ #include #include #include +#include enum { FASTBOOT_ERROR = 0, -- cgit v1.2.3 From c3b27a826f276b67021a31369c760f1b416e4917 Mon Sep 17 00:00:00 2001 From: Roger Knecht Date: Thu, 7 Sep 2023 14:51:43 +0000 Subject: cmd: xxd: move xxd into shell commands Move xxd into shell command section. Signed-off-by: Roger Knecht Reviewed-by: Simon Glass --- cmd/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index 64d723bd483..6470b138d2f 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -500,11 +500,6 @@ config CMD_XIMG help Extract a part of a multi-image. -config CMD_XXD - bool "xxd" - help - Print file as hexdump to standard output - config CMD_SPL bool "spl export - Export boot information for Falcon boot" depends on SPL @@ -1668,6 +1663,11 @@ config CMD_SETEXPR_FMT Evaluate format string expression and store result in an environment variable. +config CMD_XXD + bool "xxd" + help + Print file as hexdump to standard output + endmenu menu "Android support commands" -- cgit v1.2.3