aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-12-21Merge patch series "Complete decoupling of bootm logic from commands"WIP/21Dec2023-nextTom Rini27-202/+444
Simon Glass <sjg@chromium.org> says: This series continues refactoring the bootm code to allow it to be used with CONFIG_COMMAND disabled. The OS-handling code is refactored and a new bootm_run() function is created to run through the bootm stages. This completes the work. A booti_go() function is created also, in case it proves useful, but at last for now standard boot does not use this. This is cmdd (part d of CMDLINE refactoring) It depends on dm/bootstda-working which depends on dm/cmdc-working
2023-12-21bootm: Create a new boot_run() function to handle bootingSimon Glass2-26/+32
Create a common function used by the three existing bootz/i/m_run() functions, to reduce duplicated code. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Tom Rini <trini@konsulko.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Create a function to run through the booti statesSimon Glass2-0/+26
In a few places, the booti command is used to handle a boot. We want these to be done without needing CONFIG_CMDLINE, so add a new booti_run() function to handle this. So far this is not used. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21stm32: Use bootm_run() and bootz_run()Simon Glass1-9/+11
Use the new bootm/z_run() functions to avoid having to create an argument list for the stm32prog code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-12-21bootm: Create a function to run through the bootz statesSimon Glass3-7/+28
In a few places, the bootz command is used to handle a boot. We want these to be done without needing CONFIG_CMDLINE, so add a new bootz_run() function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21stm32: Use local vars in stm32prog for initrd and fdtSimon Glass1-9/+14
Rather than assigning to the bootm_argv[] array multiple times, use local variables for the two things that can change and assign them at the end. This makes it easier to drop the array eventually. Tidu up an overly short line while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-12-21bootm: Create a function to run through the bootm statesSimon Glass3-13/+31
In quite a few places, the bootm command is used to handle a boot. We want these to be done without needing CONFIG_CMDLINE, so add a new bootm_run() function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Tidy up boot_selected_os()Simon Glass3-14/+6
Use struct bootm_info with this function, to avoiding needing to create a new one. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Rename do_bootm_states() to bootm_run_states()Simon Glass6-11/+11
Rename the function to bootm_run_states() to better indicate ts purpose. The 'do_' prefix is used to indicate a command processor, which this is now not. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Drop arguments from do_bootm_states()Simon Glass5-65/+105
Use the bootm_info struct to hold the information required by bootm. Now that none of the functions called from do_bootm_states() needs an argv[] list, change the arguments of do_bootm_states() as well. Take care to use the same value for boot_progress even though it is a little inconsistent. For booti make sure it only uses argv[] and argc at the top of the function, so we can eventually refactor to remove these parameters. With bootm, some OSes need access to the arguments provided to the command, so set these up in the bootm_info struct, for bootm only. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootz: Avoid use of #ifdefSimon Glass1-9/+8
Use the compiler to get the set of states, instead of the preprocessor. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21booti: Avoid use of #ifdefSimon Glass1-13/+11
Use the compiler to get the set of states, instead of the preprocessor. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Move do_bootm_states() comment to header fileSimon Glass2-25/+25
This is an exported function, so move the function comment to the bootm.h header file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Add more fields to bootm_infoSimon Glass2-0/+43
Add fields for the three bootm parameters and other things needed for booting. Also add a helper to set up the struct correctly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Adjust arguments of boot_os_fnSimon Glass15-72/+100
Adjust boot_os_fn to use struct bootm_info instead of the separate argc, argv and image parameters. Update the handlers accordingly. Few of the functions make use of the arguments, so this improves code size slightly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Create a struct for argument informationSimon Glass1-1/+15
Some OS functions require the arguments to the 'bootm' command. This is inconvenient for two reasons. Firstly, there may not be any actual command, if CMDLINE is not enabled and programmatic boot is being used. Secondly, most functions don't require the arguments, so it is inefficient to pass them when not needed. For example it increases code size. Create a new struct which holds the arguments, which can be used if needed. Add the images pointer as well, since this is commonly needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21sandbox: bootm: Enable more bootm OS methodsSimon Glass2-1/+10
It is useful for sandbox to build as much code as possible. Enable support for booting various other operating systems. Add the missing cache functions. These operating systems do not actually boot on sandbox, of course. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-21bootm: Adjust how the board is resetSimon Glass1-3/+5
Use reset_cpu() to reset the board, copying the logic from the 'reset' command. This makes more sense than directly calling the do_reset() function with the arguments passsed to the bootm command. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-12-21riscv: Add a reset_cpu() functionSimon Glass2-5/+15
The current do_reset() is called from a command context. Add a function which can be used from anywhere, as is done on ARM. Adjust do_reset() to call it. Note that reset_cpu() is normally provided by SYSRESET so make this declaration conditional on that being disabled. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Chanho Park <chanho61.park@samsung.com> Tested-by: Chanho Park <chanho61.park@samsung.com>
2023-12-21nios2: Add a reset_cpu() functionSimon Glass1-1/+7
The current do_reset() is called from a command context. Add a function which can be used from anywhere, as is done on ARM. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-21ppc: Add a reset_cpu() functionSimon Glass1-0/+10
The current do_reset() is called from a command context. Add a function which can be used from anywhere, as is done on ARM. This is only needed if CONFIG_SYSRESET is disabled. Since there are lots of reset functions, this one actually just calls do_reset(). Future refactoring could correct this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-21m68k: Add a reset_cpu() functionSimon Glass1-0/+7
The current do_reset() is called from a command context. Add a function which can be used from anywhere, as is done on ARM. Since there are lots of reset functions, this one actually just calls do_reset(). Future refactoring could correct this. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Angelo Dureghello <angelo@kernel-spcece.org>
2023-12-21mips: Add a reset_cpu() functionSimon Glass1-1/+7
The current do_reset() is called from a command context. Add a function which can be used from anywhere, as is done on ARM. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-21Merge branch '2023-12-21-assorted-updates-and-fixes' into nextTom Rini12-10/+471
- A few board fixes along with IOMMU enhancements and general fixes
2023-12-21lib: rsa: Print detailed error info in rsa_engine_init() on engine ↵Csókás Bence1-1/+2
resolution failure Signed-off-by: Csókás Bence <csokas.bence@prolan.hu> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21board/keymile/kmcent2: fix update-nor indentationTomas Alvarez Vanoli1-1/+1
variable was indented as part of the value of the previous variable. Signed-off-by: Tomas Alvarez Vanoli <tomas.alvarez-vanoli@hitachienergy.com> Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
2023-12-21iommu: add qcom-hyp-smmuCaleb Connolly3-0/+413
Add a basic implementation of the ARM SMMU. This driver is intended for use on Qualcomm platforms where the SMMU has been configured by a previous bootloader, cannot be turned off, and doesn't support BYPASS streams. It keeps all existing stream mappings and only creates new ones for stream ids that aren't already configured. This driver is necessary to support peripherals that perform DMA which weren't configured by the previous stage bootloader (for example USB). It works by allocating a context bank using identity mapping (as U-Boot doesn't use virtual addresses). Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2023-12-21iommu: add a connect opCaleb Connolly2-0/+20
Add an optional iommu callback to be invoked before a device probes. This can be used to configure the IOMMU in preparation for the device (e.g. by allocating a context bank) Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2023-12-21iommu: fix compilation when CONFIG_PCI disabledCaleb Connolly1-2/+3
The dev_pci_iommu_enable() function is only available when CONFIG_PCI is enabled, replace the runtime check with a preprocessor one to fix compilation with pci disabled. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2023-12-21configs: verdin-am62: Disable SPL FIT OverlayFrancesco Dolcini1-1/+1
Disable CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY, this is not required nor used on verdin am62, disable it to save precious binary size. Update defconfig using savedefconfig, this adds CONFIG_OF_LIBFDT_OVERLAY explicitly. Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2023-12-21boot: add support for fdt_fixup command in environmentMatthias Schiffer2-3/+26
The "fdt" command is convenient for making small changes to the OS FDT, especially during development. This is easy when the kernel and FDT are loaded separately, but can be cumbersome for FIT images, requiring to unpack the image, manually apply overlays, etc. Add an option to execute a command "fdt_fixup" from the environment at the beginning of image_setup_libfdt() (after overlays are applied, and before the other fixups). Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-12-21include: env: ti: ti_common: Run main_cpsw0_qsgmii_phyinit conditionallyManorit Chawdhry1-1/+4
The main_cpsw0_qsgmii_phyinit command is defined only for certain TI SoCs which have the do_main_cpsw0_qsgmii_phyinit variable set. Add a check to ensure that the main_cpsw0_qsgmii_phyinit command is run only for such SoCs. Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-12-21fs: Fix SPL build if FS_LOADER is enabledMayuresh Chitale1-1/+1
If FS_LOADER is enabled for the SPL then the build fails with the error: fs/fs.o:(.data.rel.fstypes+0x128): undefined reference to `smh_fs_set_blk_dev' fs/fs.o:(.data.rel.fstypes+0x140): undefined reference to `smh_fs_size' fs/fs.o:(.data.rel.fstypes+0x148): undefined reference to `smh_fs_read' fs/fs.o:(.data.rel.fstypes+0x150): undefined reference to `smh_fs_write' Fix the error by populating the semihosting entry in the fs_types array only for non-SPL builds. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2023-12-21Merge branch '2023-12-21-header-inclusion-cleanup' into nextTom Rini253-284/+102
- Merge in changes to clean up various places that used <common.h> or <linux/kconfig.h>
2023-12-21lib: Remove <common.h> inclusion from these filesWIP/2023-12-21-header-inclusion-cleanupTom Rini97-103/+36
After some header file cleanups to add missing include files, remove common.h from all files in the lib directory. This primarily means just dropping the line but in a few cases we need to add in other header files now. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21include: Further cleanup includesTom Rini6-0/+9
Add some missing headers such as <linux/errno.h> or <linux/types.h> or <linux/kernel.h> to header files that make direct usage of things provided by these headers. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21display_options: Clean up headersTom Rini1-1/+2
In include/display_options.h we cannot include ourself, but do need <linux/types.h> directly. Then in lib/display_options.c we further clean the list to remove common.h. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21efi_loader: Remove <common.h>Tom Rini42-42/+1
We largely do not need <common.h> in these files, so drop it. The only exception here is that efi_freestanding.c needs <linux/types.h> and had been getting that via <common.h>. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21rmobile: Add <mach/rmobile.h> to cpu_info-rzg2l.cTom Rini1-0/+1
In order for RMOBILE_CPU_TYPE_R9A07G044L to be defined we need to include <mach/rmobile.h> here. Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21lib/sha*.c: Update header listTom Rini3-15/+5
Cleanup the list of headers we include here. For the tools build we only need to exclude <cyclic.h> as that's used by the target build for the prototype for schedule(), and we don't need to get that via <watchdog.h>. We can also make use of our <string.h> intentionally existing as a redirection to <linux/string.h> to reduce ifdef'd lines. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21global: Rework architecture global_data.h to include <linux/types.h>Tom Rini7-2/+8
In most cases, the architecture global data currently makes use of assorted linux types, but does not include <linux/types.h> to provide them. Add <linux/types.h> instead of relying on indirect inclusion. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21m68k: Rework asm/global_data.h slightlyTom Rini3-3/+4
In the architecture global data, replace the one case of u32 with unsigned long. Now, we can drop config.h here but then do need to add it in two m68k-centric spaces. Acked-by: Angelo Dureghello <angelo@kernel-space.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21sandbox: Add <linux/types.h> to asm/global_data.h and asm/io.hTom Rini1-0/+2
We need <linux/types.h> in these files as we reference Linux types. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21arm: Remove <asm/types.h> from asm/global_data.hTom Rini1-1/+0
We need and include <linux/types.h> and this in turn already includes <asm/types.h>, so drop it here. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21global: Remove duplicate common.h inclusionsTom Rini7-7/+0
These files include <common.h> twice. Start by removing the second inclusion of the file. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21global: Drop common.h inclusionTom Rini31-40/+7
In order to make it easier to move on to dropping common.h from code directly, remove common.h inclusion from the rest of the header file which had been including it. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21sandbox: Audit config.h and common.h usageTom Rini13-13/+6
Remove and replace common.h and config.h in sandbox when it's not needed and add some explicit includes where needed. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21arm: Partial cleanup and audit usage of <config.h>Tom Rini17-15/+7
We need to include <config.h> directly when a file needs to have something such as CFG_SYS_SDRAM_SIZE referenced as this file is not automatically globally included and is most commonly indirectly included via common.h. Remove most cases of arm including config.h directly, but add it where needed. This includes a few board-specific fixes. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21arc: Cleanup and audit usage of <config.h>Tom Rini6-26/+5
We need to include <config.h> directly when a file needs to have something such as CFG_SYS_SDRAM_SIZE referenced as this file is not automatically globally included and is most commonly indirectly included via common.h. Remove most cases of arc including config.h directly, but add it where needed. Further clean up the tb100 board config.h file so that we don't rely on config.h being included there for a value used in a single place. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21qe: Add <config.h> to linux/immap_qe.hTom Rini1-0/+2
Given how we define QE_MURAM_SIZE today, this header needs to have <config.h> added to it. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>