aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2022-05-03efi_loader: bootmgr: add booting from removable mediaAKASHI Takahiro1-0/+45
Under the current implementation, booting from removable media using a architecture-specific default image name, say BOOTAA64.EFI, is supported only in distro_bootcmd script. See the commit 74522c898b35 ("efi_loader: Add distro boot script for removable media"). This is, however, half-baked implementation because 1) UEFI specification requires this feature to be implemented as part of Boot Manager's responsibility: 3 - Boot Manager 3.5.1 Boot via the Simple File Protocol When booting via the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, the FilePath will start with a device path that points to the device that implements the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL or the EFI_BLOCK_IO_PROTOCOL. The next part of the FilePath may point to the file name, including subdirectories, which contain the bootable image. If the file name is a null device path, the file name must be generated from the rules defined below. ... 3.5.1.1 Removable Media Boot Behavior To generate a file name when none is present in the FilePath, the firmware must append a default file name in the form \EFI\BOOT\BOOT{machine type short-name}.EFI ... 2) So (1) entails the hehavior that the user's preference of boot media order should be determined by Boot#### and BootOrder variables. With this patch, the semantics mentioned above is fully implemented. For example, if you want to boot the system from USB and SCSI in this order, * define Boot0001 which contains only a device path to the USB device (without any file path/name) * define Boot0002 which contains only a device path to the SCSI device, and * set BootOrder to Boot0001:Boot0002 To avoid build error for sandbox, default file name "BOOTSANDBOX.efi" is defined even if it is out of scope of UEFI specification. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> On sandbox use binary name corresponding to host architecture. Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-03efi_loader: export efi_locate_device_handle()AKASHI Takahiro1-0/+4
This function will be used in the next commit where some behavior of EFI boot manager will be expanded. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-03lib/charset: add u16_strlcat() functionMasahisa Kojima1-0/+14
Provide u16 string version of strlcat(). Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-02Merge branch '2022-05-02-add-verifying-program-loader'WIP/02May2022Tom Rini3-3/+24
To quote the author: U-Boot provides a verified-boot feature based around FIT, but there is no standard way of implementing it for a board. At present the various required pieces must be built up separately, to produce a working implementation. In particular, there is no built-in support for selecting A/B boot or recovery mode. This series introduces VPL, a verified program loader phase for U-Boot. Its purpose is to run the verified-boot process and decide which SPL binary should be run. It is critical that this decision happens before SPL runs, since SPL sets up SDRAM and we need to be able to update the SDRAM-init code in the field. Adding VPL into the boot flow provides a standard place to implement verified boot. This series includes the phase itself, some useful Kconfig options and a sandbox_vpl build for sandbox. No verfied-boot support is provided in this series. Most of the patches in this series are fixes and improvements to docs and various Kconfig conditions for SPL.
2022-05-02Introduce Verifying Program Loader (VPL)Simon Glass3-3/+24
Add support for VPL, a new phase of U-Boot. This runs after TPL. It is responsible for selecting which SPL binary to run, based on a verified-boot process. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-05-02arm: kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver for DM EthernetTony Dinh1-8/+3
The Zyxel NSA310s board has the network chip Marvell Alaska 88E1318S. Use uclass mvgbe and the compatible driver M88E1310 driver to bring up Ethernet. - Use uclass mvgbe to bring up the network. And remove ad-hoc code. - Remove CONFIG_RESET_PHY_R. - Enable CONFIG_PHY_MARVELL to properly configure the network. - Add phy mode RGMII to kirkwood-nsa310s.dts - Miscellaneous changes: Move constants to .c file and remove header file board/zyxel/nsa310s/nsa310s.h, add support for large USB and SATA HDDs, use BIT macro, add/cleanup comments, and cosmetic changes. Note that this patch is depended on the following patch: https://patchwork.ozlabs.org/project/uboot/patch/20220412201820.10291-1-mibodhi@gmail.com/ Signed-off-by: Tony Dinh <mibodhi@gmail.com>
2022-05-02arm: mvebu: turris_mox: Add NVMe and SCSI to boot targetsPali Rohár1-0/+2
U-Boot for Turris Mox has already enabled NVMe and SCSI support. So add NVMe and SCSI to boot targets. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-05-02arm: mvebu: turris_omnia: Add NVMe to boot targetsPali Rohár1-0/+1
U-Boot for Turris Omnia has already enabled NVMe support. So add NVMe to boot targets. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-05-02arm: mvebu: turris_omnia: Always enable MMC, SCSI and USB boot targetsPali Rohár1-21/+3
U-Boot for Turris Omnia is always compiled with MMC, SCSI and USB support, so always enable macros for booting from these devices. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-05-02arm: mvebu: turris_omnia: Define CONFIG_ETHPRIME instead of ethact= ENVPali Rohár1-1/+0
CONFIG_ETHPRIME defines primary ethernet device and env variable $ethact stores currently active ethernet device. So there is no point to set ethact= in default environment. Instead set CONFIG_ETHPRIME properly. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2022-04-28dt-bindings: leds: import common led bindings from linux 5.17WIP/2022-04-28-led-updatesPali Rohár1-11/+37
This allows usage of LED_COLOR_ID_RGB macro in DTS files. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-04-28led: Drop led_default_state()Marek Vasut1-9/+0
This function is empty, drop it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-28dm: core: Add DM_FLAG_PROBE_AFTER_BIND flagMarek Vasut1-0/+3
Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete. This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind(). Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-27Merge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xxWIP/27Apr2022Tom Rini21-35/+54
fsl-qoriq: Fixes and updates on fsl-layerscape mpc85xx: fixes and code cleanup
2022-04-26board: freescale: p1_p2_rdb_pc: Define SW macros for lower and upper NOR banksPali Rohár1-2/+11
Replace hardcoded i2c hex values for NOR banks by named SW macros in map_lowernorbank/map_uppernorbank env commands. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2022-04-26board: freescale: p1_p2_rdb_pc: Use named macros for i2c bus num and addressPali Rohár1-12/+12
Replace hardcoded boot i2c bus num and address by existing macros when generating env for CONFIG_EXTRA_ENV_SETTINGS. Same macros are used in U-Boot board code when reading information from boot i2c data. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2022-04-26board: freescale: p1_p2_rdb_pc: Fix env $vscfw_addrPali Rohár1-2/+6
Do not stringify env $vscfw_addr two times (once implicitly via string operator "" and second time explicitly via __stringify() macro) and allow to compile U-Boot without CONFIG_VSC7385_ENET (when __VSCFW_ADDR was not defined and so macro name was stringified into CONFIG_EXTRA_ENV_SETTINGS). Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2022-04-26board: freescale: p1_p2_rdb_pc: Detect both P2020 SD switch configurationsPali Rohár1-1/+2
As written in comment, P2020 has two possible SD switch configurations. Extend code to detect both of them. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2022-04-26powerpc: mpc85xx: Remove duplicate u-boot-nand.ldsPali Rohár6-0/+20
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2022-04-26mmc: fsl_esdhc: Define macro ESDHCCTL_SNOOP for Snoop attributePali Rohár1-0/+1
Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2022-04-26include: configs: at91/sam: remove stray #ifdef/#elseEugen Hristev6-52/+0
With the commit that moves the BOOTCOMMAND to Kconfig: 970bf8603b ("Convert CONFIG_USE_BOOTCOMMAND et al to Kconfig") some stray ifdefs have been left in the header files which are now useless. Clean up the include files to remove these lines. Fixes: 970bf8603b ("Convert CONFIG_USE_BOOTCOMMAND et al to Kconfig") Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2022-04-26board: Add sam9x60_curiosity supportDurai Manickam KR1-0/+31
Add board files, Kconfig, Makefile and MAINTAINERS. Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2022-04-25nds32: Remove the architectureWIP/25Apr2022Tom Rini2-485/+0
As removal of nds32 has been ack'd for the Linux kernel, remove support here as well. Cc: Rick Chen <rick@andestech.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Rick Chen <rick@andestech.com>
2022-04-25Merge branch '2022-04-25-initial-implementation-of-stdboot'Tom Rini15-53/+1054
To quote the author: The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting. It introduces the following concepts: - bootdev - a device which can hold a distro - bootmeth - a method to scan a bootdev to find bootflows (owned by U-Boot) - bootflow - a description of how to boot (owned by the distro) This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot. With this we can boot on a Raspberry Pi 3 with just one command: bootflow scan -lb which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this. With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only. ... The design is described in these two documents: https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
2022-04-25bootstd: Add tests for bootstd including all uclassesSimon Glass1-0/+2
Add a set of combined tests for the bootdev, bootflow and bootmeth commands, along with associated functionality. Expand the sandbox console-recording limit so that these can work. These tests rely on a filesystem script which is not yet added to the Python tests. It is included here as a shell script. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: mmc: Add a bootdev driverSimon Glass1-1/+11
Add a bootdev driver for MMC. It mostly just calls the bootdev helper function. Add a function to obtain the block device for an MMC controller. Fix up the comment for mmc_get_blk_desc() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add an implementation of distro bootSimon Glass1-0/+24
Add a bootmeth driver which handles distro boot from a disk, so we can boot a bootflow using this commonly used mechanism. In effect, this provides the same functionality as the 'sysboot' command and shares the same code. But the interface into it is via a bootmeth. For now this requires the 'pxe' command be enabled. Future work may tidy this up so that it can be used without CONFIG_CMDLINE being enabled. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add support for bootflowsSimon Glass1-0/+50
Add support for bootflows, including maintaining a list of them and iterating to find them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the bootmeth uclass and helpersSimon Glass3-0/+242
A bootmeth is a method of locating an operating system. For now, just add the uclass itself. Drivers for particular bootmeths are added later. If no bootmeths devices are included in the devicetree, create them automatically. This avoids the need for boilerplate in the devicetree files. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the bootdev uclassSimon Glass2-0/+276
A 'bootdev' is a device which can be used to boot an operating system. It is a child of the media device (e.g. MMC) which handles reading files from that device, such as a bootflow file. Add a uclass for bootdev and the various helpers needed to make it work. Also add a binding file, empty for now. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the bootstd uclass and core implementationSimon Glass2-0/+81
The 'bootstd' device provides the central information about U-Boot standard boot. Add a uclass for bootstd and the various helpers needed to make it work. Also add a binding file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the concept of a bootflowSimon Glass1-0/+260
A bootflow encapsulates the process used to boot an operating system. It typically has a control file (such as extlinux.conf) and information about which 'bootdev' it came from. Add the header file for this first, since it is needed by all other files. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25fs: Add a function to set the filesystem typeSimon Glass1-0/+11
When sandbox is used with hostfs we won't have a block device, but still must set up the filesystem type before any filesystem operation, such as loading a file. Add a function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: blk: Add a function to return the device typeSimon Glass1-0/+8
Use the uclass name to get the device type for a block device. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Allow finding a uclass device by partial nameSimon Glass2-1/+17
In some cases two devices are related and the only way to tell is to check that the names partially patch. Add a way to check this without needing to create a new string for the comparison. Fix the comment for device_find_child_by_namelen() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Rename and fix uclass_get_by_name_len()Simon Glass1-3/+3
It seems that namelen is more common in U-Boot. Rename this function to fit in better. Also fix a bug where it breaks the operation of uclass_get_by_name() and add a test. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reported-by: Tim Harvey <tharvey@gateworks.com>
2022-04-25lib: Add a way to find the postiion of a trailing numberSimon Glass1-0/+18
At present it is not possible to find out which part of the string is the number part and which is before it. Add a new variant which provides this feature, so we can separate the two in the caller. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Fix a few bugs in trailing_strtoln()Simon Glass1-0/+3
At present this has a minor bug in that it reads the byte before the start of the string, if it is empty. Also it doesn't handle a non-numeric prefix which is only one character long. Fix these bugs with a reworked implementation. Add a test for the second case. The first one is hard to test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Correct comment formatting to avoid sphinx problemsSimon Glass1-46/+46
Tweak a few comments to kep sphinx happy, in case we want to include this file one day. Also fix the 'exxamine' typo. Patch-notes: This uses: sed -i 's/@param \(\S*\)\s*/@\1: /' include/vsprintf.h to convert the @param to the new format. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: Add tests for trailing_strtol()Simon Glass1-2/+2
This function currently has no tests. Add some. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25configs: Layerscape: Remove the 'fdt_addr' envHou Zhiqiang14-20/+4
On Layerscape platforms, the DTB is loaded from boot filesystem, per the fdt_addr description in doc/README.distro, it must be removed. Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com> [Rebased] Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2022-04-23Merge tag 'efi-2022-07-rc1-3' of ↵WIP/23Apr2022Tom Rini4-5/+43
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-07-rc1-3 Documentation: * Document image size parameter of bootefi command UEFI: * avoid building partition support in SPL/TPL where not required * improve integration of EFI subsystem and driver model * restore ability to boot arbitrary blob
2022-04-23dm: disk: add read/write interfaces with udeviceAKASHI Takahiro1-0/+7
In include/blk.h, Simon suggested: ===> /* * These functions should take struct udevice instead of struct blk_desc, * but this is convenient for migration to driver model. Add a 'd' prefix * to the function operations, so that blk_read(), etc. can be reserved for * functions with the correct arguments. */ unsigned long blk_dread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, void *buffer); unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, const void *buffer); unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt); <=== So new interfaces are provided with this patch. They are expected to be used everywhere in U-Boot at the end. The exceptions are block device drivers, partition drivers and efi_disk which should know details of blk_desc structure. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-23efi_loader: disk: a helper function to create efi_disk objects from udeviceAKASHI Takahiro1-2/+2
Add efi_disk_probe() function. This function creates an efi_disk object for a raw disk device (UCLASS_BLK) and additional objects for related partitions (UCLASS_PARTITION). So this function is expected to be called through driver model's "probe" interface every time one raw disk device is detected and activated. We assume that partition devices (UCLASS_PARTITION) have been created when this function is invoked. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-23efi_loader: split efi_init_obj_list() into two stagesAKASHI Takahiro1-0/+2
In the next commit, CONFIG_EFI_SETUP_EARLY will become mandated in order to support dynamic enumeration of efi_disk objects. This can, however, be problematic particularly in case of file-based variable storage (efi_variable.c, default). Non-volatile variables are to be restored from EFI system partition by efi_init_variables() in efi_init_obj_list(). When efi_init_obj_list() is called in board_init_r(), we don't know yet what disk devices we have since none of device probing commands (say, scsi rescan) has not been executed at that stage. So in this commit, a preparatory change is made; efi_init_obj_list() is broken into the two functions; * efi_init_early(), and * new efi_init_obj_list() Only efi_init_early() will be called in board_init_r(), which allows us to execute any of device probing commands, either though "preboot" variable or normal command line, before calling efi_init_obj_list() which is to be invoked at the first execution of an efi-related command (or at efi_launch_capsules()) as used to be. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-23dm: disk: add UCLASS_PARTITIONAKASHI Takahiro2-0/+11
NOTE: probably we have to update config dependencies, in particular, SPL/TPL_PRINTF? With this new function, UCLASS_PARTITION devices will be created as child nodes of UCLASS_BLK device. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-23sandbox: move a function prototypeAKASHI Takahiro2-1/+2
Since host_get_dev_errr() is defined in drivers/block/sandbox.c, the associated function prototype should be in a more appropriate header file. Fixes: commit 4101f6879256 ("dm: Drop the block_dev_desc_t typedef") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-23disk: define nullified functions for !PARTITIONSAKASHI Takahiro1-0/+16
Some defconfig enables CMD_PART even if none of any partition table types (CONFIG_*_PARTITION) are enabled. This will lead to the size growth in SPL/TPL code since disk/part.c will be compiled in any way. We will change disk/Kconfig later so that CONFIG_PARTITIONS is only enabled when, at least, one of CONFIG_*_PARTITION is enabled. To make the build work (in particular, "part" command) correctly, a few functions should be defined as void functions in case of !CONFIG_PARTITIONS. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-23disk: enable function prototypes in part.h for SPL/TPLAKASHI Takahiro1-2/+2
Since CONFIG_[SPL|TPL]_PARTITIONS were introduced, part.h has not been updated. Due to this, while the build won't fail, some functionality may possibly break as some partition-related functions are nullified even though some partition table types are enabled for SPL/TPL. Fixes: commit 88ca8e26958b ("disk: Add an option for partitions in SPL") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-23disk: include errno.h explicitly in part.hAKASHI Takahiro1-0/+1
Some errno numbers are used in defining inline functions. So "errno.h" should be explicitly included to avoid possible build errors. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>