diff options
33 files changed, 250 insertions, 167 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index a6e47e8a217..c2832345ab1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -945,6 +945,7 @@ S: Maintained T: git https://source.denx.de/u-boot/custodians/u-boot-dfu.git F: boot/bootmeth_android.c F: boot/bootmeth_android.h +F: doc/develop/bootstd/android.rst BTRFS M: Marek BehĂșn <kabel@kernel.org> @@ -1048,7 +1048,7 @@ endif CHECKFLAGS += --arch=$(ARCH) # insure the checker run with the right endianness -CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian) +CHECKFLAGS += $(if $(CONFIG_SYS_BIG_ENDIAN),-mbig-endian,-mlittle-endian) # the checker needs the correct machine size CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) diff --git a/arch/Kconfig b/arch/Kconfig index abd406d4884..8f1f4667012 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -8,6 +8,13 @@ config CREATE_ARCH_SYMLINK config HAVE_ARCH_IOREMAP bool +config SUPPORT_BIG_ENDIAN + bool + +config SUPPORT_LITTLE_ENDIAN + bool + default y if !SUPPORT_BIG_ENDIAN + config SYS_CACHE_SHIFT_4 bool @@ -59,6 +66,8 @@ config ARC select SUPPORT_OF_CONTROL select SYS_CACHE_SHIFT_7 select TIMER + select SUPPORT_BIG_ENDIAN + select SUPPORT_LITTLE_ENDIAN select SYS_BIG_ENDIAN if CPU_BIG_ENDIAN select SYS_LITTLE_ENDIAN if !CPU_BIG_ENDIAN @@ -68,6 +77,7 @@ config ARM select CREATE_ARCH_SYMLINK select HAVE_PRIVATE_LIBGCC if !ARM64 select SUPPORT_ACPI + select SUPPORT_LITTLE_ENDIAN select SUPPORT_OF_CONTROL config M68K @@ -77,10 +87,13 @@ config M68K select SYS_BOOT_GET_CMDLINE select SYS_BOOT_GET_KBD select SYS_CACHE_SHIFT_4 + select SUPPORT_BIG_ENDIAN select SUPPORT_OF_CONTROL config MICROBLAZE bool "MicroBlaze architecture" + select SUPPORT_BIG_ENDIAN + select SUPPORT_LITTLE_ENDIAN select SUPPORT_OF_CONTROL imply CMD_TIMER imply SPL_REGMAP if SPL @@ -101,12 +114,14 @@ config NIOS2 select DM select DM_EVENT select OF_CONTROL + select SUPPORT_LITTLE_ENDIAN select SUPPORT_OF_CONTROL imply CMD_DM config PPC bool "PowerPC architecture" select HAVE_PRIVATE_LIBGCC + select SUPPORT_BIG_ENDIAN select SUPPORT_OF_CONTROL select SYS_BOOT_GET_CMDLINE select SYS_BOOT_GET_KBD @@ -115,6 +130,7 @@ config RISCV bool "RISC-V architecture" select CREATE_ARCH_SYMLINK select SUPPORT_ACPI + select SUPPORT_LITTLE_ENDIAN select SUPPORT_OF_CONTROL select OF_CONTROL select DM @@ -160,6 +176,8 @@ config SANDBOX select PCI_ENDPOINT select SPI select SUPPORT_OF_CONTROL + select SUPPORT_BIG_ENDIAN + select SUPPORT_LITTLE_ENDIAN select SYSRESET_CMD_POWEROFF if CMD_POWEROFF select SYS_CACHE_SHIFT_4 select IRQ @@ -224,6 +242,7 @@ config SANDBOX config SH bool "SuperH architecture" + select SUPPORT_LITTLE_ENDIAN select HAVE_PRIVATE_LIBGCC select SUPPORT_OF_CONTROL @@ -231,6 +250,7 @@ config X86 bool "x86 architecture" select SUPPORT_SPL select SUPPORT_TPL + select SUPPORT_LITTLE_ENDIAN select CREATE_ARCH_SYMLINK select DM select HAVE_ARCH_IOMAP @@ -312,6 +332,7 @@ config X86 config XTENSA bool "Xtensa architecture" select CREATE_ARCH_SYMLINK + select SUPPORT_LITTLE_ENDIAN select SUPPORT_OF_CONTROL endchoice @@ -515,24 +536,21 @@ endif source "board/keymile/Kconfig" -if MIPS || MICROBLAZE - choice prompt "Endianness selection" + default SYS_BIG_ENDIAN if MIPS || MICROBLAZE + default SYS_LITTLE_ENDIAN help - Some MIPS boards can be configured for either little or big endian + Some boards can be configured for either little or big endian byte order. These modes require different U-Boot images. In general there is one preferred byteorder for a particular system but some systems are just as commonly used in the one or the other endianness. config SYS_BIG_ENDIAN bool "Big endian" - depends on (SUPPORTS_BIG_ENDIAN && MIPS) || MICROBLAZE + depends on SUPPORT_BIG_ENDIAN config SYS_LITTLE_ENDIAN bool "Little endian" - depends on (SUPPORTS_LITTLE_ENDIAN && MIPS) || MICROBLAZE - + depends on SUPPORT_LITTLE_ENDIAN endchoice - -endif diff --git a/arch/arc/include/asm/arc-bcr.h b/arch/arc/include/asm/arc-bcr.h index a6c972bf1e3..d4de9b818c1 100644 --- a/arch/arc/include/asm/arc-bcr.h +++ b/arch/arc/include/asm/arc-bcr.h @@ -15,7 +15,7 @@ union bcr_di_cache { struct { -#ifdef CONFIG_CPU_BIG_ENDIAN +#ifdef CONFIG_SYS_BIG_ENDIAN unsigned int pad:12, line_len:4, sz:4, config:4, ver:8; #else unsigned int ver:8, config:4, sz:4, line_len:4, pad:12; @@ -26,7 +26,7 @@ union bcr_di_cache { union bcr_slc_cfg { struct { -#ifdef CONFIG_CPU_BIG_ENDIAN +#ifdef CONFIG_SYS_BIG_ENDIAN unsigned int pad:24, way:2, lsz:2, sz:4; #else unsigned int sz:4, lsz:2, way:2, pad:24; @@ -37,7 +37,7 @@ union bcr_slc_cfg { union bcr_generic { struct { -#ifdef CONFIG_CPU_BIG_ENDIAN +#ifdef CONFIG_SYS_BIG_ENDIAN unsigned int pad:24, ver:8; #else unsigned int ver:8, pad:24; @@ -48,7 +48,7 @@ union bcr_generic { union bcr_clust_cfg { struct { -#ifdef CONFIG_CPU_BIG_ENDIAN +#ifdef CONFIG_SYS_BIG_ENDIAN unsigned int pad:7, c:1, num_entries:8, num_cores:8, ver:8; #else unsigned int ver:8, num_cores:8, num_entries:8, c:1, pad:7; @@ -59,7 +59,7 @@ union bcr_clust_cfg { union bcr_mmu_4 { struct { -#ifdef CONFIG_CPU_BIG_ENDIAN +#ifdef CONFIG_SYS_BIG_ENDIAN unsigned int ver:8, sasid:1, sz1:4, sz0:4, res:2, pae:1, n_ways:2, n_entry:2, n_super:2, u_itlb:3, u_dtlb:3; #else diff --git a/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h b/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h index b6394aee165..c6af825dbc7 100644 --- a/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h +++ b/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h @@ -31,7 +31,7 @@ * when PIE is in effect. So we need to split them up in 32-bit high and low * words. */ -#ifdef CONFIG_CPU_BIG_ENDIAN +#ifdef CONFIG_SYS_BIG_ENDIAN #define DATA_LE32(data) \ ((((data) & 0x000000ff) << 24) | \ (((data) & 0x0000ff00) << 8) | \ @@ -55,7 +55,7 @@ #endif #define __MEM_USAGE (__CODE_DATA_SIZE + __MAX_EXTRA_RAM_USAGE) -#ifdef CONFIG_CPU_BIG_ENDIAN +#ifdef CONFIG_SYS_BIG_ENDIAN #define __HEAD_FLAG_BE 1 #else #define __HEAD_FLAG_BE 0 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index eb7f3ad2376..38577af43d0 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -28,14 +28,14 @@ config TARGET_MALTA select OF_ISA_BUS select PCI_MAP_SYSTEM_MEMORY select ROM_EXCEPTION_VECTORS - select SUPPORTS_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 select SUPPORTS_CPU_MIPS32_R6 select SUPPORTS_CPU_MIPS64_R1 select SUPPORTS_CPU_MIPS64_R2 select SUPPORTS_CPU_MIPS64_R6 - select SUPPORTS_LITTLE_ENDIAN + select SUPPORT_BIG_ENDIAN + select SUPPORT_LITTLE_ENDIAN select SWAP_IO_SPACE imply CMD_DM @@ -86,7 +86,7 @@ config ARCH_MTMIPS select ROM_EXCEPTION_VECTORS select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 - select SUPPORTS_LITTLE_ENDIAN + select SUPPORT_LITTLE_ENDIAN select SUPPORT_SPL config ARCH_JZ47XX @@ -112,7 +112,7 @@ config ARCH_OCTEON select MIPS_TUNE_OCTEON3 select MTD select ROM_EXCEPTION_VECTORS - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS64_OCTEON select PHYS_64BIT select OF_CONTROL @@ -138,14 +138,14 @@ config TARGET_BOSTON select OF_BOARD_SETUP select OF_CONTROL select ROM_EXCEPTION_VECTORS - select SUPPORTS_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 select SUPPORTS_CPU_MIPS32_R6 select SUPPORTS_CPU_MIPS64_R1 select SUPPORTS_CPU_MIPS64_R2 select SUPPORTS_CPU_MIPS64_R6 - select SUPPORTS_LITTLE_ENDIAN + select SUPPORT_BIG_ENDIAN + select SUPPORT_LITTLE_ENDIAN imply CMD_DM config TARGET_XILFPGA @@ -159,7 +159,7 @@ config TARGET_XILFPGA select ROM_EXCEPTION_VECTORS select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 - select SUPPORTS_LITTLE_ENDIAN + select SUPPORT_LITTLE_ENDIAN imply CMD_DM help This supports IMGTEC MIPSfpga platform @@ -413,12 +413,6 @@ config MIPS_BOOT_FDT endmenu -config SUPPORTS_BIG_ENDIAN - bool - -config SUPPORTS_LITTLE_ENDIAN - bool - config SUPPORTS_CPU_MIPS32_R1 bool diff --git a/arch/mips/mach-ath79/Kconfig b/arch/mips/mach-ath79/Kconfig index cd85d1b6c31..2fa628568aa 100644 --- a/arch/mips/mach-ath79/Kconfig +++ b/arch/mips/mach-ath79/Kconfig @@ -8,7 +8,7 @@ config SOC_AR933X bool select MIPS_TUNE_24KC select ROM_EXCEPTION_VECTORS - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 help @@ -17,7 +17,7 @@ config SOC_AR933X config SOC_AR934X bool select MIPS_TUNE_74KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 select USB_EHCI_IS_TDI if USB_EHCI_HCD @@ -28,7 +28,7 @@ config SOC_QCA953X bool select MIPS_TUNE_24KC select ROM_EXCEPTION_VECTORS - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 help @@ -37,7 +37,7 @@ config SOC_QCA953X config SOC_QCA956X bool select MIPS_TUNE_74KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 help diff --git a/arch/mips/mach-bmips/Kconfig b/arch/mips/mach-bmips/Kconfig index eb9ea34c52f..b140552657f 100644 --- a/arch/mips/mach-bmips/Kconfig +++ b/arch/mips/mach-bmips/Kconfig @@ -23,7 +23,7 @@ config SOC_BMIPS_BCM3380 bool "BMIPS BCM3380 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_WATCHDOG help @@ -33,7 +33,7 @@ config SOC_BMIPS_BCM6318 bool "BMIPS BCM6318 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_SYSCON help @@ -43,7 +43,7 @@ config SOC_BMIPS_BCM6328 bool "BMIPS BCM6328 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_SYSCON help @@ -53,7 +53,7 @@ config SOC_BMIPS_BCM6338 bool "BMIPS BCM6338 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_SYSCON help @@ -63,7 +63,7 @@ config SOC_BMIPS_BCM6348 bool "BMIPS BCM6348 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_WATCHDOG help @@ -73,7 +73,7 @@ config SOC_BMIPS_BCM6358 bool "BMIPS BCM6358 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_SYSCON help @@ -83,7 +83,7 @@ config SOC_BMIPS_BCM6368 bool "BMIPS BCM6368 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_SYSCON help @@ -93,7 +93,7 @@ config SOC_BMIPS_BCM6362 bool "BMIPS BCM6362 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_SYSCON help @@ -103,7 +103,7 @@ config SOC_BMIPS_BCM63268 bool "BMIPS BCM63268 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_SYSCON help @@ -114,7 +114,7 @@ config SOC_BMIPS_BCM6838 bool "BMIPS BCM6838 family" select SYS_CACHE_SHIFT_4 select MIPS_TUNE_4KC - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SYSRESET_SYSCON help diff --git a/arch/mips/mach-jz47xx/Kconfig b/arch/mips/mach-jz47xx/Kconfig index dcaac016286..858173e75b4 100644 --- a/arch/mips/mach-jz47xx/Kconfig +++ b/arch/mips/mach-jz47xx/Kconfig @@ -6,7 +6,7 @@ config SYS_SOC config SOC_JZ4780 bool - select SUPPORTS_LITTLE_ENDIAN + select SUPPORT_LITTLE_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 help diff --git a/arch/mips/mach-mscc/Kconfig b/arch/mips/mach-mscc/Kconfig index affc4721f82..367d5248a1c 100644 --- a/arch/mips/mach-mscc/Kconfig +++ b/arch/mips/mach-mscc/Kconfig @@ -6,10 +6,10 @@ menu "MSCC VCore-III platforms" config SOC_VCOREIII select MIPS_TUNE_24KC select ROM_EXCEPTION_VECTORS - select SUPPORTS_BIG_ENDIAN + select SUPPORT_BIG_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 - select SUPPORTS_LITTLE_ENDIAN + select SUPPORT_LITTLE_ENDIAN bool config SYS_SOC diff --git a/arch/mips/mach-pic32/Kconfig b/arch/mips/mach-pic32/Kconfig index 2afa972074c..52d2eec0a76 100644 --- a/arch/mips/mach-pic32/Kconfig +++ b/arch/mips/mach-pic32/Kconfig @@ -13,7 +13,7 @@ config SOC_PIC32MZDA select ROM_EXCEPTION_VECTORS select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 - select SUPPORTS_LITTLE_ENDIAN + select SUPPORT_LITTLE_ENDIAN select SYS_MIPS_CACHE_INIT_RAM_LOAD help This supports Microchip PIC32MZ[DA] family of microcontrollers. diff --git a/boot/bootm.c b/boot/bootm.c index 376d63aafc9..480f8e6a0e6 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -740,18 +740,6 @@ ulong bootm_disable_interrupts(void) eth_halt(); #endif -#if defined(CONFIG_CMD_USB) - /* - * turn off USB to prevent the host controller from writing to the - * SDRAM while Linux is booting. This could happen (at least for OHCI - * controller), because the HCCA (Host Controller Communication Area) - * lies within the SDRAM and the host controller writes continously to - * this area (as busmaster!). The HccaFrameNumber is for example - * updated every 1 ms within the HCCA structure in SDRAM! For more - * details see the OpenHCI specification. - */ - usb_stop(); -#endif return iflag; } diff --git a/doc/develop/bootstd/android.rst b/doc/develop/bootstd/android.rst new file mode 100644 index 00000000000..41701d5bdff --- /dev/null +++ b/doc/develop/bootstd/android.rst @@ -0,0 +1,39 @@ +.. SPDX-License-Identifier: GPL-2.0+: + +Android Bootmeth +================ + +Android provides a mechanism for booting its Operating System from eMMC storage, +described on `source.android.com <https://source.android.com/docs/core/architecture/bootloader>`_. + +Android has strong requirements about partitioning layout which are described +`here <https://source.android.com/docs/core/architecture/partitions>`_. +Because multiple partitions are required, this bootmeth only operates on whole mmc +devices which have a valid partition table. + +When invoked on a bootdev, this bootmeth searches for the ``misc`` partition in order +to read the *boot mode*, which can be one of following: + +Normal + Boot the regular Android Operating System. + +Recovery + Boot a slimmed down Recovery Operating System. Can be used + to factory reset the device or to apply system updates. + +Bootloader + Stay in U-Boot and wait for fastboot commands from the host. + +After the *boot mode* has been determined, this bootmeth will read the *slot suffix* +from the ``misc`` partition. For details about slots, see +`the AOSP documentation <https://source.android.com/docs/core/ota/ab#slots>`_. + +When both the *boot mode* and the *slot suffix* are known, the bootflow is created. + +When the bootflow is booted, the bootmeth reads the kernel, the boot arguments and +the vendor ramdisk. +It then boots the kernel using bootm. The relevant devicetree blob is extracted +from the ``boot`` partition based on the ``adtb_idx`` environment variable. + +The compatible string "u-boot,android" is used for the driver. It is present +if `CONFIG_BOOTMETH_ANDROID` is enabled. diff --git a/doc/develop/bootstd/index.rst b/doc/develop/bootstd/index.rst index 9d35b567d55..4c4e26ccdb7 100644 --- a/doc/develop/bootstd/index.rst +++ b/doc/develop/bootstd/index.rst @@ -10,6 +10,7 @@ Standard Boot extlinux pxelinux qfw + android cros script sandbox diff --git a/doc/develop/bootstd/overview.rst b/doc/develop/bootstd/overview.rst index ff3cc48eb64..c6f003851b2 100644 --- a/doc/develop/bootstd/overview.rst +++ b/doc/develop/bootstd/overview.rst @@ -429,7 +429,7 @@ Available bootmeth drivers Bootmeth drivers are provided for booting from various media: - - Android bootflow (boot image v4) + - :doc:`Android <android>` bootflow (boot image v4) - :doc:`ChromiumOS <cros>` ChromiumOS boot from a disk - EFI boot using bootefi from disk - EFI boot using boot manager diff --git a/doc/develop/devicetree/control.rst b/doc/develop/devicetree/control.rst index ca4fb0b5b10..211f7e4909c 100644 --- a/doc/develop/devicetree/control.rst +++ b/doc/develop/devicetree/control.rst @@ -96,12 +96,12 @@ sync the `dts/upstream/` subtree from the devicetree-rebasing repo whenever the next branch opens (refer: :doc:`../release_cycle`) with the latest mainline Linux kernel release. To sync the `dts/upstream/` subtree, run:: - ./dts/update-dts-subtree.sh pull <devicetree-rebasing-release-tag> + ./tools/update-subtree.sh pull dts <devicetree-rebasing-release-tag> If required it is also possible to cherry-pick fixes from the devicetree-rebasing repository prior to next sync, usage:: - ./dts/update-dts-subtree.sh pick <devicetree-rebasing-commit-id> + ./tools/update-subtree.sh pick dts <devicetree-rebasing-commit-id> Configuration @@ -116,8 +116,8 @@ However, if `dts/upstream/` hasn't yet received devicetree source file for your newly added board support then one option is that you can add the corresponding devicetree source file as `arch/<arch>/dts/<name>.dts`. To select that add `# CONFIG_OF_UPSTREAM is not set` and set `DEFAULT_DEVICE_TREE=<name>` when -prompted by Kconfig. Another option is that you can use use the "pick" option of -`dts/update-dts-subtree.sh` mentioned above to bring in the commits that you +prompted by Kconfig. Another option is that you can use the "pick" option of +`tools/update-subtree.sh` mentioned above to bring in the commits that you need. This should include your CPU or SoC's devicetree file. On top of that any U-Boot diff --git a/drivers/core/util.c b/drivers/core/util.c index 108a3bc4dac..fa893485a09 100644 --- a/drivers/core/util.c +++ b/drivers/core/util.c @@ -3,23 +3,13 @@ * Copyright (c) 2013 Google, Inc */ +#include <vsprintf.h> #include <dm/device.h> #include <dm/ofnode.h> #include <dm/read.h> #include <dm/util.h> #include <linux/libfdt.h> -#include <vsprintf.h> - -int list_count_items(struct list_head *head) -{ - struct list_head *node; - int count = 0; - - list_for_each(node, head) - count++; - - return count; -} +#include <linux/list.h> #if CONFIG_IS_ENABLED(OF_REAL) int pci_get_devfn(struct udevice *dev) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index b7bf7cc0893..b1af3f717d4 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1698,7 +1698,7 @@ static int brcmnand_fill_dma_desc(struct brcmnand_host *host, desc->cmd_irq = (dma_cmd << 24) | (end ? (0x03 << 8) : 0) | /* IRQ | STOP */ (!!begin) | ((!!end) << 1); /* head, tail */ -#ifdef CONFIG_CPU_BIG_ENDIAN +#ifdef CONFIG_SYS_BIG_ENDIAN desc->cmd_irq |= 0x01 << 12; #endif desc->dram_addr = lower_32_bits(buf); diff --git a/dts/update-dts-subtree.sh b/dts/update-dts-subtree.sh deleted file mode 100755 index a57b78a41d3..00000000000 --- a/dts/update-dts-subtree.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0+ -# -# Copyright 2024 Linaro Ltd. -# -# Usage: from the top level U-Boot source tree, run: -# $ ./dts/update-dts-subtree.sh pull <release-tag> -# $ ./dts/update-dts-subtree.sh pick <commit-id> -# -# The script will pull changes from devicetree-rebasing repo into U-Boot -# as a subtree located as <U-Boot>/dts/upstream sub-directory. It will -# automatically create a squash/merge commit listing the commits imported. - -set -e - -merge_commit_msg=$(cat << EOF -Subtree merge tag '$2' of devicetree-rebasing repo [1] into dts/upstream - -[1] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/ -EOF -) - -remote_add_and_fetch() { - if ! git remote get-url devicetree-rebasing 2>/dev/null - then - echo "Warning: Script automatically adds new git remote via:" - echo " git remote add devicetree-rebasing \\" - echo " https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git" - git remote add devicetree-rebasing \ - https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git - fi - git fetch devicetree-rebasing master -} - -if [ "$1" = "pull" ] -then - remote_add_and_fetch - git subtree pull --prefix dts/upstream devicetree-rebasing \ - "$2" --squash -m "${merge_commit_msg}" -elif [ "$1" = "pick" ] -then - remote_add_and_fetch - git cherry-pick -x --strategy=subtree -Xsubtree=dts/upstream/ "$2" -else - echo "usage: $0 <op> <ref>" - echo " <op> pull or pick" - echo " <ref> release tag [pull] or commit id [pick]" -fi diff --git a/env/mmc.c b/env/mmc.c index 776df0786be..0338aa6c56a 100644 --- a/env/mmc.c +++ b/env/mmc.c @@ -110,8 +110,9 @@ static inline s64 mmc_offset(struct mmc *mmc, int copy) int hwpart = 0; int err; - if (IS_ENABLED(CONFIG_SYS_MMC_ENV_PART)) - hwpart = mmc_get_env_part(mmc); +#if defined(CONFIG_SYS_MMC_ENV_PART) + hwpart = mmc_get_env_part(mmc); +#endif #if defined(CONFIG_ENV_MMC_PARTITION) str = CONFIG_ENV_MMC_PARTITION; diff --git a/include/dm/util.h b/include/dm/util.h index 95c3527a37c..ec518c51d93 100644 --- a/include/dm/util.h +++ b/include/dm/util.h @@ -17,14 +17,6 @@ struct dm_stats; struct list_head; /** - * list_count_items() - Count number of items in a list - * - * @param head: Head of list - * Return: number of items, or 0 if empty - */ -int list_count_items(struct list_head *head); - -/** * Dump out a tree of all devices starting @uclass * * @dev_name: udevice name diff --git a/include/linux/list.h b/include/linux/list.h index 6910721c005..0f9d939b05f 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -547,6 +547,21 @@ static inline void list_splice_tail_init(struct list_head *list, &pos->member != (head); \ pos = n, n = list_entry(n->member.prev, typeof(*n), member)) +/** + * list_count_nodes - count nodes in the list + * @head: the head for your list. + */ +static inline size_t list_count_nodes(struct list_head *head) +{ + struct list_head *pos; + size_t count = 0; + + list_for_each(pos, head) + count++; + + return count; +} + /* * Double linked lists with a single pointer list head. * Mostly useful for hash tables where the two pointer list head is diff --git a/include/smbios.h b/include/smbios.h index a4fda9df7bd..00119d7a60c 100644 --- a/include/smbios.h +++ b/include/smbios.h @@ -105,6 +105,7 @@ struct __packed smbios_type0 { u8 bios_minor_release; u8 ec_major_release; u8 ec_minor_release; + u16 extended_bios_rom_size; char eos[SMBIOS_STRUCT_EOS_BYTES]; }; diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 38e64af2531..1179c31bb13 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -220,6 +220,7 @@ config EFI_CAPSULE_ON_DISK config EFI_IGNORE_OSINDICATIONS bool "Ignore OsIndications for CapsuleUpdate on-disk" depends on EFI_CAPSULE_ON_DISK + default y if !EFI_RT_VOLATILE_STORE help There are boards where U-Boot does not support SetVariable at runtime. Select this option if you want to use the capsule-on-disk feature @@ -486,6 +487,7 @@ config EFI_ECPT config EFI_EBBR_2_1_CONFORMANCE bool "Add the EBBRv2.1 conformance entry to the ECPT table" + depends on BOOTMETH_EFI_BOOTMGR depends on EFI_ECPT depends on EFI_LOADER_HII depends on EFI_RISCV_BOOT_PROTOCOL || !RISCV diff --git a/lib/efi_loader/efi_fdt.c b/lib/efi_loader/efi_fdt.c index 4ccf2055be3..c5ecade3aeb 100644 --- a/lib/efi_loader/efi_fdt.c +++ b/lib/efi_loader/efi_fdt.c @@ -43,6 +43,9 @@ int efi_get_distro_fdt_name(char *fname, int size, int seq) case 2: prefix = "/dtb/current"; break; + case 3: + prefix = "/dtbs"; + break; default: return log_msg_ret("pref", -EINVAL); } diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index 348612c3dad..65d2116381a 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -133,7 +133,7 @@ efi_status_t efi_load_option_dp_join(struct efi_device_path **dp, *dp = efi_dp_concat(tmp_dp, fdt_dp, *dp_size); efi_free_pool(tmp_dp); - if (!dp) + if (!*dp) return EFI_OUT_OF_RESOURCES; *dp_size += efi_dp_size(fdt_dp) + sizeof(END); } diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 12cf23fa3fa..c6f1dd09456 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -127,7 +127,7 @@ static uint64_t desc_get_end(struct efi_mem_desc *desc) */ static void efi_mem_sort(void) { - struct list_head *lhandle; + struct efi_mem_list *lmem; struct efi_mem_list *prevmem = NULL; bool merge_again = true; @@ -136,19 +136,18 @@ static void efi_mem_sort(void) /* Now merge entries that can be merged */ while (merge_again) { merge_again = false; - list_for_each(lhandle, &efi_mem) { - struct efi_mem_list *lmem; - struct efi_mem_desc *prev = &prevmem->desc; + list_for_each_entry(lmem, &efi_mem, link) { + struct efi_mem_desc *prev; struct efi_mem_desc *cur; uint64_t pages; - lmem = list_entry(lhandle, struct efi_mem_list, link); if (!prevmem) { prevmem = lmem; continue; } cur = &lmem->desc; + prev = &prevmem->desc; if ((desc_get_end(cur) == prev->physical_start) && (prev->type == cur->type) && @@ -268,7 +267,7 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, int memory_type, bool overlap_only_ram) { - struct list_head *lhandle; + struct efi_mem_list *lmem; struct efi_mem_list *newlist; bool carve_again; uint64_t carved_pages = 0; @@ -308,11 +307,9 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, /* Add our new map */ do { carve_again = false; - list_for_each(lhandle, &efi_mem) { - struct efi_mem_list *lmem; + list_for_each_entry(lmem, &efi_mem, link) { s64 r; - lmem = list_entry(lhandle, struct efi_mem_list, link); r = efi_mem_carve_out(lmem, &newlist->desc, overlap_only_ram); switch (r) { @@ -444,7 +441,7 @@ static efi_status_t efi_check_allocated(u64 addr, bool must_be_allocated) */ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr) { - struct list_head *lhandle; + struct efi_mem_list *lmem; /* * Prealign input max address, so we simplify our matching @@ -452,9 +449,7 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr) */ max_addr &= ~EFI_PAGE_MASK; - list_for_each(lhandle, &efi_mem) { - struct efi_mem_list *lmem = list_entry(lhandle, - struct efi_mem_list, link); + list_for_each_entry(lmem, &efi_mem, link) { struct efi_mem_desc *desc = &lmem->desc; uint64_t desc_len = desc->num_pages << EFI_PAGE_SHIFT; uint64_t desc_end = desc->physical_start + desc_len; @@ -742,9 +737,9 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, efi_uintn_t *descriptor_size, uint32_t *descriptor_version) { + size_t map_entries; efi_uintn_t map_size = 0; - int map_entries = 0; - struct list_head *lhandle; + struct efi_mem_list *lmem; efi_uintn_t provided_map_size; if (!memory_map_size) @@ -752,8 +747,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, provided_map_size = *memory_map_size; - list_for_each(lhandle, &efi_mem) - map_entries++; + map_entries = list_count_nodes(&efi_mem); map_size = map_entries * sizeof(struct efi_mem_desc); @@ -774,10 +768,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, /* Copy list into array */ /* Return the list in ascending order */ memory_map = &memory_map[map_entries - 1]; - list_for_each(lhandle, &efi_mem) { - struct efi_mem_list *lmem; - - lmem = list_entry(lhandle, struct efi_mem_list, link); + list_for_each_entry(lmem, &efi_mem, link) { *memory_map = lmem->desc; memory_map--; } diff --git a/lib/smbios.c b/lib/smbios.c index 4126466e34a..7c24ea129eb 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -22,6 +22,7 @@ #include <cpu.h> #include <dm/uclass-internal.h> #endif +#include <linux/sizes.h> /* Safeguard for checking that U_BOOT_VERSION_NUM macros are compatible with U_BOOT_DMI */ #if U_BOOT_VERSION_NUM < 2000 || U_BOOT_VERSION_NUM > 2099 || \ @@ -348,7 +349,13 @@ static int smbios_write_type0(ulong *current, int handle, #endif t->bios_release_date = smbios_add_prop(ctx, NULL, U_BOOT_DMI_DATE); #ifdef CONFIG_ROM_SIZE - t->bios_rom_size = (CONFIG_ROM_SIZE / 65536) - 1; + if (CONFIG_ROM_SIZE < SZ_16M) { + t->bios_rom_size = (CONFIG_ROM_SIZE / 65536) - 1; + } else { + /* CONFIG_ROM_SIZE < 8 GiB */ + t->bios_rom_size = 0xff; + t->extended_bios_rom_size = CONFIG_ROM_SIZE >> 20; + } #endif t->bios_characteristics = BIOS_CHARACTERISTICS_PCI_SUPPORTED | BIOS_CHARACTERISTICS_SELECTABLE_BOOT | diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 97dd4a64f6e..99cc29595b4 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -224,7 +224,7 @@ recordmcount_source := $(srctree)/scripts/recordmcount.c \ $(srctree)/scripts/recordmcount.h else sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ - "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ + "$(if $(CONFIG_SYS_BIG_ENDIAN),big,little)" \ "$(if $(CONFIG_64BIT),64,32)" \ "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)" \ "$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \ diff --git a/test/dm/bus.c b/test/dm/bus.c index a338c7f567c..95326f23dad 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -14,6 +14,7 @@ #include <dm/test.h> #include <dm/uclass-internal.h> #include <dm/util.h> +#include <linux/list.h> #include <test/test.h> #include <test/ut.h> @@ -27,14 +28,14 @@ static int dm_test_bus_children(struct unit_test_state *uts) struct uclass *uc; ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc)); - ut_asserteq(num_devices, list_count_items(&uc->dev_head)); + ut_asserteq(num_devices, list_count_nodes(&uc->dev_head)); /* Probe the bus, which should yield 3 more devices */ ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus)); num_devices += 3; ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc)); - ut_asserteq(num_devices, list_count_items(&uc->dev_head)); + ut_asserteq(num_devices, list_count_nodes(&uc->dev_head)); ut_assert(!dm_check_devices(uts, num_devices)); diff --git a/test/dm/core.c b/test/dm/core.c index dbad1b317db..5bc5e8e82ec 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -16,6 +16,7 @@ #include <dm/util.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <linux/list.h> #include <test/test.h> #include <test/ut.h> @@ -123,15 +124,15 @@ static int dm_test_autobind(struct unit_test_state *uts) * device with no children. */ ut_assert(uts->root); - ut_asserteq(1, list_count_items(gd->uclass_root)); - ut_asserteq(0, list_count_items(&gd->dm_root->child_head)); + ut_asserteq(1, list_count_nodes(gd->uclass_root)); + ut_asserteq(0, list_count_nodes(&gd->dm_root->child_head)); ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_POST_BIND]); ut_assertok(dm_scan_plat(false)); /* We should have our test class now at least, plus more children */ - ut_assert(1 < list_count_items(gd->uclass_root)); - ut_assert(0 < list_count_items(&gd->dm_root->child_head)); + ut_assert(1 < list_count_nodes(gd->uclass_root)); + ut_assert(0 < list_count_nodes(&gd->dm_root->child_head)); /* Our 3 dm_test_infox children should be bound to the test uclass */ ut_asserteq(3, dm_testdrv_op_count[DM_TEST_OP_POST_BIND]); diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 18c89eef43f..31effff59c2 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -19,6 +19,7 @@ #include <dm/util.h> #include <dm/of_access.h> #include <linux/ioport.h> +#include <linux/list.h> #include <test/test.h> #include <test/ut.h> @@ -162,7 +163,7 @@ static int dm_test_fdt(struct unit_test_state *uts) ut_assert(!ret); /* These are num_devices compatible root-level device tree nodes */ - ut_asserteq(num_devices, list_count_items(&uc->dev_head)); + ut_asserteq(num_devices, list_count_nodes(&uc->dev_head)); /* Each should have platform data but no private data */ for (i = 0; i < num_devices; i++) { @@ -217,7 +218,7 @@ static int dm_test_fdt_pre_reloc(struct unit_test_state *uts) * one with "bootph-all" property (a-test node), and the other * one whose driver marked with DM_FLAG_PRE_RELOC flag (h-test node). */ - ut_asserteq(2, list_count_items(&uc->dev_head)); + ut_asserteq(2, list_count_nodes(&uc->dev_head)); return 0; } diff --git a/tools/update-subtree.sh b/tools/update-subtree.sh new file mode 100755 index 00000000000..536b3318573 --- /dev/null +++ b/tools/update-subtree.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2024 Linaro Limited +# +# Usage: from the top level U-Boot source tree, run: +# $ ./tools/update-subtree.sh pull <subtree-name> <release-tag> +# Or: +# $ ./tools/update-subtree.sh pick <subtree-name> <commit-id> +# +# The script will pull changes from subtree repo into U-Boot. +# It will automatically create a squash/merge commit listing the commits +# imported. + +set -e + +print_usage() { + echo "usage: $0 <op> <subtree-name> <ref>" + echo " <op> pull or pick" + echo " <subtree-name> mbedtls or dts or lwip" + echo " <ref> release tag [pull] or commit id [pick]" +} + +if [ $# -ne 3 ]; then + print_usage + exit 1 +fi + +op=$1 +subtree_name=$2 +ref=$3 + +set_params() { + case "$subtree_name" in + mbedtls) + path=lib/mbedtls/external/mbedtls + repo_url=https://github.com/Mbed-TLS/mbedtls.git + remote_name="mbedtls_upstream" + ;; + dts) + path=dts/upstream + repo_url=https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git + remote_name="devicetree-rebasing" + ;; + lwip) + path=lib/lwip/lwip + repo_url=https://git.savannah.gnu.org/git/lwip.git + remote_name="lwip_upstream" + ;; + *) + echo "Invalid subtree name: $subtree_name" + print_usage + exit 1 + esac +} + +set_params + +merge_commit_msg=$(cat << EOF +Subtree merge tag '$ref' of $subtree_name repo [1] into $path + +[1] $repo_url +EOF +) + +remote_add_and_fetch() { + if [ -z "$(git remote get-url $remote_name 2>/dev/null)" ]; then + echo "Warning: Script automatically adds new git remote via:" + echo " git remote add $remote_name \\" + echo " $repo_url" + git remote add $remote_name $repo_url + fi + git fetch $remote_name master +} + +if [ "$op" = "pull" ]; then + remote_add_and_fetch + git subtree pull --prefix $path $remote_name "$ref" --squash -m "$merge_commit_msg" +elif [ "$op" = "pick" ]; then + remote_add_and_fetch + git cherry-pick -x --strategy=subtree -Xsubtree=$path/ "$ref" +else + print_usage + exit 1 +fi |