]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
2 years agoboard: st: common: Fix board_get_alt_info_mtd()
Patrice Chotard [Fri, 17 Nov 2023 17:01:06 +0000 (18:01 +0100)] 
board: st: common: Fix board_get_alt_info_mtd()

Since MTD devices are partioned, we got the following
error when command "dfu 0" is executed:

DFU alt info setting: done
ERROR: Too many arguments for nor0
ERROR: DFU entities configuration failed!
ERROR: (partition table does not match dfu_alt_info?)

Fixes: 31325e1b8b9c ("stm32mp1: dynamically build DFU_ALT_INFO")
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoboard: stm32f469-disco: add splash screen with stmicroelectronics logo
Dario Binacchi [Mon, 11 Dec 2023 22:05:56 +0000 (23:05 +0100)] 
board: stm32f469-disco: add splash screen with stmicroelectronics logo

Display the STMicroelectronics logo with features VIDEO_LOGO and
SPLASH_SCREEN on stm32f469-disco board.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoboard: stm32f469-disco: add support to display
Dario Binacchi [Mon, 11 Dec 2023 22:05:55 +0000 (23:05 +0100)] 
board: stm32f469-disco: add support to display

Add support to Orise Tech OTM8009A display on stm32f469-disco board.

It was necessary to retrieve the framebuffer address from the device tree
because the address returned by the video-uclass driver pointed to a memory
area that was not usable.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32: support MIPI DSI on stm32f469-disco board
Dario Binacchi [Mon, 11 Dec 2023 22:05:54 +0000 (23:05 +0100)] 
ARM: dts: stm32: support MIPI DSI on stm32f469-disco board

Unlike Linux, the DSI driver requires the LTDC clock to be properly
probed. Hence, the changes made to the DSI node.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32: make the DSI clock usable by the clock driver
Dario Binacchi [Mon, 11 Dec 2023 22:05:53 +0000 (23:05 +0100)] 
ARM: dts: stm32: make the DSI clock usable by the clock driver

As described in [1], the "clocks" property contains "a phandle to the
clock device node, an index selecting between gated clocks (0) and other
clocks (1), and an index specifying the clock to use." The current version
of the clock driver, unlike the kernel, is currently able to properly
handle nodes with "clocks" properties with an index set to 0.

This patch is preparatory for future developments that require the use
of the DSI clock.

[1] Documentation/devicetree/bindings/clock/st,stm32-rcc.txt
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32: make the LTDC clock usable by the clock driver
Dario Binacchi [Mon, 11 Dec 2023 22:05:52 +0000 (23:05 +0100)] 
ARM: dts: stm32: make the LTDC clock usable by the clock driver

As described in [1], the "clocks" property contains "a phandle to the
clock device node, an index selecting between gated clocks (0) and other
clocks (1), and an index specifying the clock to use." The current version
of the clock driver, unlike the kernel, is currently able to properly
handle nodes with "clocks" properties with an index set to 0.

This patch is preparatory for future developments that require the use
of the LTDC clock.

[1] Documentation/devicetree/bindings/clock/st,stm32-rcc.txt
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32f469-disco: sync with Linux 6.5
Dario Binacchi [Mon, 11 Dec 2023 22:05:51 +0000 (23:05 +0100)] 
ARM: dts: stm32f469-disco: sync with Linux 6.5

Sync the devicetree with linux 6.5 for stm32f746-disco board.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoclk: stm32f: fix setting of LCD clock
Dario Binacchi [Sat, 11 Nov 2023 10:46:19 +0000 (11:46 +0100)] 
clk: stm32f: fix setting of LCD clock

Set pllsaidivr only if the PLLSAIR output frequency is an exact multiple
of the pixel clock rate. Otherwise, we search through all combinations
of pllsaidivr * pllsair and use the one which gives the rate closest to
requested one.

Fixes: 5e993508cb25 ("clk: clk_stm32f: Add set_rate for LTDC clock")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoclk: stm32f: fix setting of division factor for LCD_CLK
Dario Binacchi [Sat, 11 Nov 2023 10:46:18 +0000 (11:46 +0100)] 
clk: stm32f: fix setting of division factor for LCD_CLK

The value to be written to the register must be appropriately shifted,
as is correctly done in other parts of the code.

Fixes: 5e993508cb25 ("clk: clk_stm32f: Add set_rate for LTDC clock")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32f769-disco: rework ltdc node
Dario Binacchi [Sat, 11 Nov 2023 10:44:36 +0000 (11:44 +0100)] 
ARM: dts: stm32f769-disco: rework ltdc node

With commit f479f5dbb7ac ("ARM: dts: stm32: add ltdc support on
stm32f746 MCU"), which adds the 'ltdc' node in stm32f746.dtsi, we can
simplify stm32f769-disco-uboot.dtsi and align stm32f769-disco.dtsi with
the kernel version.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoMerge tag 'u-boot-imx-20231214' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Fri, 15 Dec 2023 13:22:20 +0000 (08:22 -0500)] 
Merge tag 'u-boot-imx-20231214' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

- Fix for i.MX8M Plus eDM SBC DDR timings with inline ECC
- Switch to FPWM mode on Data Modul i.MX8M Plus eDM SBC so that DRAM
  EDAC detects more correctable errors
- Fix for imx8mp-venice board DDR initialization

2 years agoimx8mp-venice: update DRAM config for 2000MHz
Tim Harvey [Thu, 14 Dec 2023 16:22:27 +0000 (08:22 -0800)] 
imx8mp-venice: update DRAM config for 2000MHz

The imx8mp venice boards can support 2000Mhz DRAM.
Update the DRAM config to support this.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2 years agoimx8mp-venice: fix DRAM bus configuration
Tim Harvey [Thu, 14 Dec 2023 16:22:26 +0000 (08:22 -0800)] 
imx8mp-venice: fix DRAM bus configuration

The DRAM configuration for the 1GB and 4GB imx8mp venice boards had a
bus mapping issue (channel A and B swapped) which creates an invalid
deskewing configuration during training causing the DRAM to not be able
to run at its full bus speed.

Update the various config structures to resolve this.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2 years agoboard: gateworks: venice: remove extra file
Tim Harvey [Thu, 14 Dec 2023 16:22:25 +0000 (08:22 -0800)] 
board: gateworks: venice: remove extra file

Remove lpddr4_timing_imx8mm_512mb.c mistakenly committed

Fixes: a1c711046b0d "(board: gateworks: venice: add imx8mm-gw7903 support)"
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2 years agoARM: imx: Update DRAM timings with inline ECC on Data Modul i.MX8M Plus eDM SBC
Marek Vasut [Thu, 7 Dec 2023 17:50:32 +0000 (18:50 +0100)] 
ARM: imx: Update DRAM timings with inline ECC on Data Modul i.MX8M Plus eDM SBC

Import DRAM timings generated by the DDR tool 3.31 which introduce assorted
tweaks to the DRAM controller settings. Furthermore, enable DBI to improve
noise resilience of the DRAM bus by reducing the number of bit changes on
the bus.

Reduce the DRAM rate to 3600 MTps to remove all remaining correctable errors
reported by EDAC . It is not entirely clear why the slightly faster setting
does produce sporadic correctable errors, while this one does not, but this
could be related to simpler PLL setting at 3600 MTps.

Enable inline ECC which is necessary to detect ECC errors and collect
statistics by the EDAC driver in Linux. This reduces the DRAM size by
64 MiB for each 512 MiB of DRAM, so for a 4 GiB device the available
DRAM size becomes 3.5 GiB .

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoARM: imx: Force DRAM regulators into FPWM mode on Data Modul i.MX8M Plus eDM SBC
Marek Vasut [Thu, 7 Dec 2023 17:50:31 +0000 (18:50 +0100)] 
ARM: imx: Force DRAM regulators into FPWM mode on Data Modul i.MX8M Plus eDM SBC

In case the Buck5 and Buck6 regulators which supply DRAM Vdd1 and Vdd2/Vddq
respectively operate in automatic PWM/PFM mode, the DRAM EDAC detects more
correctable errors than if the regulators operate in forced PWM only mode.
Force DRAM regulators to forced PWM mode only to stop tempting the DRAM.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoARM: imx: Enable CAAM on DH i.MX8M Plus DHCOM
Marek Vasut [Sat, 2 Dec 2023 01:58:28 +0000 (02:58 +0100)] 
ARM: imx: Enable CAAM on DH i.MX8M Plus DHCOM

Enable CAAM in U-Boot to make crypto available early in the boot process.

This has a side-effect that in case an older kernel version contains a
broken CAAM initialization timeout code, initialization in bootloader
will help that old kernel version function correctly.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoARM: imx: Enable CAAM on Data Modul i.MX8M Mini/Plus eDM SBC
Marek Vasut [Sat, 2 Dec 2023 01:55:06 +0000 (02:55 +0100)] 
ARM: imx: Enable CAAM on Data Modul i.MX8M Mini/Plus eDM SBC

Enable CAAM in U-Boot to make crypto available early in the boot process.

This has a side-effect that in case an older kernel version contains a
broken CAAM initialization timeout code, initialization in bootloader
will help that old kernel version function correctly.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoddr: imx: Add 3600 MTps rate support
Marek Vasut [Sat, 2 Dec 2023 01:48:40 +0000 (02:48 +0100)] 
ddr: imx: Add 3600 MTps rate support

Add PLL settings for DDR 3600 MTps . This is very similar to 3200 MTps
PLL setting, except the divider is not 9 but 8 .

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoddr: imx: Handle 3734 in addition to 3733 and 3732 MTps rates
Marek Vasut [Sat, 2 Dec 2023 01:48:00 +0000 (02:48 +0100)] 
ddr: imx: Handle 3734 in addition to 3733 and 3732 MTps rates

The new MX8M DDR tool 3.31 now generates a programming file which uses
data rate 3734 instead of 3733 or 3732 . Handle another rounding option .

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoarm64: imx8mp: Inhibit DTC warning on DH i.MX8MP DHCOM rev.100 DTO
Marek Vasut [Sun, 5 Nov 2023 00:04:32 +0000 (01:04 +0100)] 
arm64: imx8mp: Inhibit DTC warning on DH i.MX8MP DHCOM rev.100 DTO

Inhibit DTC warning in imx8mp-dhcom-pdk3-overlay-rev100.dts:
"
arch/arm/dts/imx8mp-dhcom-pdk3-overlay-rev100.dtbo: Warning (reg_format): /fragment@0/__overlay__:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
arch/arm/dts/imx8mp-dhcom-pdk3-overlay-rev100.dtbo: Warning (avoid_default_addr_size): /fragment@0/__overlay__: Relying on default #address-cells value
arch/arm/dts/imx8mp-dhcom-pdk3-overlay-rev100.dtbo: Warning (avoid_default_addr_size): /fragment@0/__overlay__: Relying on default #size-cells value
"

The DTO overwrites the 'reg' property of an ethernet PHY and is only
used on specific combination of old prototype SoM and old prototype
PDK3 carrier board, which had incorrectly placed pull resistor, which
made the PHY change its MDIO address in that specific combination and
which is already fixed on production hardware.

The DTO is implemented in this simple manner because if it contained a
full MDIO bus node reference to define #address-cells and #size-cells,
it would also require a full new copy of the PHY node, i.e.
ethernet-phy@5 { ... reg = <5>; ... }, to avoid DTC warnings about
mismatch between node unit and reg value. The node unit in SoM DT is
ethernet-phy@7 { ... }; .

This simpler approach avoids unnecessary duplication without adverse
side effects.

Reported-by: Fabio Estevam <festevam@denx.de>
Reported-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Tested-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoMerge tag 'xilinx-for-v2024.04-rc1' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Thu, 14 Dec 2023 18:27:11 +0000 (13:27 -0500)] 
Merge tag 'xilinx-for-v2024.04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2024.04-rc1

zynqmp:
- Introduce Kria specific defconfig
- Calculate SPI image location based on boot offset
- DT updates

zynqmp-clk:
- Fix topsw_lsbus_clock for DP

axi-enet:
- Support older DT binding

mailbox:
- Add support for multiple mailboxes

pcie-xilinx:
- Covert driver to newer interface
- Enable MMIO region

zynq:
- dfu updates
- Enable capsule update for Antminer S9
- DT updates

xilinx_spi:
- Add new xfer callback and support runtime fifo depth discovery

2 years agospi: cadence-quadspi: Fix error message on stuck busy state
Jan Kiszka [Mon, 30 Oct 2023 16:20:29 +0000 (17:20 +0100)] 
spi: cadence-quadspi: Fix error message on stuck busy state

We are not iterating CQSPI_REG_RETRY, we are waiting 'timeout' ms, since
day 1.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agomtd: spi-nor-ids: add support for xtx XT55Q02G
Bruce Suen [Wed, 18 Oct 2023 03:38:02 +0000 (23:38 -0400)] 
mtd: spi-nor-ids: add support for xtx XT55Q02G

Add support for XTX XT55Q02G(1.8V,2Gbit).

Signed-off-by: Bruce Suen <bruce_suen@163.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agomtd: spinand: add support for ESMT F50x1G41LB
Igor Prusov [Tue, 17 Oct 2023 19:29:26 +0000 (22:29 +0300)] 
mtd: spinand: add support for ESMT F50x1G41LB

Adaptation of Linux commit d74c36480a67

This patch adds support for ESMT F50L1G41LB and F50D1G41LB.
It seems that ESMT likes to use random JEDEC ID from other vendors.
Their 1G chips uses 0xc8 from GigaDevice and 2G/4G chips uses 0x2c from
Micron. For this reason, the ESMT entry is named esmt_c8 with explicit
JEDEC ID in variable name.

Datasheets:
https://www.esmt.com.tw/upload/pdf/ESMT/datasheets/F50L1G41LB(2M).pdf
https://www.esmt.com.tw/upload/pdf/ESMT/datasheets/F50D1G41LB(2M).pdf

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Signed-off-by: Martin Kurbanov <mmkurbanov@sberdevices.ru>
Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Tested-by: Martin Kurbanov <mmkurbanov@sberdevices.ru>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agomtd: spi-nor-core: Implement spi_nor_read_sfdp_dma_unsafe() for sfdp parse
Vaishnav Achath [Fri, 3 Jun 2022 07:01:32 +0000 (12:31 +0530)] 
mtd: spi-nor-core: Implement spi_nor_read_sfdp_dma_unsafe() for sfdp parse

During SFDP header parse and BFPT parse, structures in stack are used
to perform spi_nor_read_sfdp() which expects a dma-safe buffer.

This commit introduces spi_nor_read_sfdp_dma_unsafe() to wrap
spi_nor_read_sfdp() using a kmalloc'ed bounce buffer which is
the same implementation in Linux (drivers/mtd/spi-nor/sfdp.c).

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agoMerge tag 'u-boot-imx-next-20231214' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Thu, 14 Dec 2023 12:37:02 +0000 (07:37 -0500)] 
Merge tag 'u-boot-imx-next-20231214' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next

- Add TPM support for venice boards
- Add networking support for imx93-evk
- Enable TCP, IPv6, wget for DHCOM and Data Modul boards
- Enable fastboot support for Toradex boards
- Allow pico-imx7d to boot from SD
- Enable fastboot for beacon imx8m beacon boards, disabled
  SYS_CONSOLE_IS_IN_ENV
- Fix mxsboot to prevent NAND blocks being reported as bad
- Add imx8mm PWM clock support
- Several devicetree syncs with the kernel
- Add support for i.MX8MP Polyhex Debix Model A SBC
- Reworked ddr_load_train_firmware() to get a 50ms boot time improvement

2 years agoarm64: imx8mp: Enable TCP, IPv6, wget on Data Modul i.MX8M eDM SBC
Marek Vasut [Wed, 22 Nov 2023 23:37:38 +0000 (00:37 +0100)] 
arm64: imx8mp: Enable TCP, IPv6, wget on Data Modul i.MX8M eDM SBC

Enable support for TCP protocol, wget, and IPv6 on this platform.
The former two allow users download payload into the U-Boot from
a web server, which may be more convenient or easier to set up
than TFTP server. The later is enabled to future proof the IP
stack on this platform.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoarm64: imx8mp: Enable TCP, IPv6, wget on DH i.MX8MP DHCOM
Marek Vasut [Sat, 4 Nov 2023 16:32:21 +0000 (17:32 +0100)] 
arm64: imx8mp: Enable TCP, IPv6, wget on DH i.MX8MP DHCOM

Enable support for TCP protocol, wget, and IPv6 on this platform.
The former two allow users download payload into the U-Boot from
a web server, which may be more convenient or easier to set up
than TFTP server. The later is enabled to future proof the IP
stack on this platform.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoarm: imx6: Enable TCP, IPv6, wget on DH i.MX6 DHCOM
Marek Vasut [Sat, 4 Nov 2023 16:32:20 +0000 (17:32 +0100)] 
arm: imx6: Enable TCP, IPv6, wget on DH i.MX6 DHCOM

Enable support for TCP protocol, wget, and IPv6 on this platform.
The former two allow users download payload into the U-Boot from
a web server, which may be more convenient or easier to set up
than TFTP server. The later is enabled to future proof the IP
stack on this platform.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoMerge tag 'dm-next-13dec23' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm...
Tom Rini [Wed, 13 Dec 2023 21:02:38 +0000 (16:02 -0500)] 
Merge tag 'dm-next-13dec23' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm into next

minor improvements to test, acpi
updates for new PyPl release

2 years agotest: vboot: Using variable 'old_dtb' before assignment
Heinrich Schuchardt [Mon, 11 Dec 2023 18:07:33 +0000 (19:07 +0100)] 
test: vboot: Using variable 'old_dtb' before assignment

old_dtb can only be assumed initialized in the finally block
if it is assigned a value before the try statement.

Avoid a pylint error reported by current pylint.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest: fit: Using variable 'old_dtb' before assignment
Heinrich Schuchardt [Mon, 11 Dec 2023 18:07:32 +0000 (19:07 +0100)] 
test: fit: Using variable 'old_dtb' before assignment

old_dtb can only be assumed initialized in the finally block
if it is assigned a value before the try statement.

Avoid a pylint error reported by current pylint.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: elf: Using variable 'old_val' before assignment
Heinrich Schuchardt [Sat, 9 Dec 2023 18:50:31 +0000 (19:50 +0100)] 
binman: elf: Using variable 'old_val' before assignment

old_val can only be assumed initialized in the finally block
if it is assigned a value before the try statement.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocmd: check argc for acpi dump
Heinrich Schuchardt [Sat, 9 Dec 2023 17:05:36 +0000 (18:05 +0100)] 
cmd: check argc for acpi dump

'acpi dump' without parameter results in a NULL dereference. Check the
number of arguments.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Fix a memory leak in the efi manager bootflow
Ilias Apalodimas [Thu, 7 Dec 2023 12:36:36 +0000 (14:36 +0200)] 
bootstd: Fix a memory leak in the efi manager bootflow

efi_get_var() allocates memory which has to be freed after the value of
the variable is consumed. Free the memory properly

Fixes: f2bfa0cb1794 ("bootstd: Make efi_mgr bootmeth work for non-sandbox setups")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2 years agodoc: board: ti: k3: Mention TI_DM argument
Neha Malcom Francis [Tue, 5 Dec 2023 09:42:20 +0000 (15:12 +0530)] 
doc: board: ti: k3: Mention TI_DM argument

Mention TI_DM argument can be used to fetch a custom DM binary in the
A72 build instructions for K3 devices.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
2 years agoarm: dts: k3-*-binman: Move to using ti-dm entry type
Neha Malcom Francis [Tue, 5 Dec 2023 09:42:19 +0000 (15:12 +0530)] 
arm: dts: k3-*-binman: Move to using ti-dm entry type

Move the DM entry in tispl.bin FIT image from default fetching an
external blob entry to fetching using ti-dm entry type. This way, the
DM entry will be populated by the TI_DM pathname if provided. Else it
will resort to the ti-dm.bin file.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: etype: dm: Add entry type for TI DM
Neha Malcom Francis [Tue, 5 Dec 2023 09:42:18 +0000 (15:12 +0530)] 
binman: etype: dm: Add entry type for TI DM

K3 devices introduces the concept of centralized power, resource and
security management to System Firmware. This is to overcome challenges
by the traditional approach that implements system control functions on
each of the processing units.

The software interface for System Firmware is split into TIFS and DM. DM
(Device Manager) is responsible for resource and power management from
secure and non-secure hosts. This additional binary is necessary for
specific platforms' ROM boot images and is to be packaged into tispl.bin

Add an entry for DM. The entry can be used for the packaging of
tispl.bin by binman along with ATF and TEE.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: doc: fix typo
Dario Binacchi [Thu, 23 Nov 2023 13:10:00 +0000 (14:10 +0100)] 
binman: doc: fix typo

s/use set/set/

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-By: Michael Trimarchi <michael@amarulasolutions.com>
2 years agocmd: acpi: fix acpi list command
Heinrich Schuchardt [Tue, 21 Nov 2023 14:41:28 +0000 (15:41 +0100)] 
cmd: acpi: fix acpi list command

ACPI tables may comprise either RSDT, XSDT, or both. The current code fails
to check the presence of the RSDT table before accessing it. This leads to
an exception if the RSDT table is not provided.

The XSDT table takes precedence over the RSDT table.

The return values of list_rsdt() and list_rsdp() are always zero and not
checked. Remove the return values.

Addresses in the XSDT table are 64-bit. Adjust the output accordingly.

As the RSDT table has to be ignored if the XSDT command is present there is
no need to compare the tables in a display command. Anyway the
specification does not require that the sequence of addresses in the RSDT
and XSDT table are the same.

The FACS table header does not provide revision information. Correct the
description of dump_hdr().

Adjust the ACPI test to match the changed output format of the 'acpi list'
command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: fix struct acpi_xsdt
Heinrich Schuchardt [Tue, 21 Nov 2023 14:41:27 +0000 (15:41 +0100)] 
acpi: fix struct acpi_xsdt

The size of the ACPI table header is not a multiple of 8. We have to mark
struct acpi_xsdt as packed to correctly access field Entry.

Add a unit test for the offsets of field Entry in the RSDT and XSDT tables.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotools: Move python tools to version 0.0.6
Simon Glass [Sun, 19 Nov 2023 15:36:06 +0000 (08:36 -0700)] 
tools: Move python tools to version 0.0.6

A new release has been done with this version, so update it. Use the
version numbers in dependencies also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Update the run script
Simon Glass [Sun, 19 Nov 2023 15:36:05 +0000 (08:36 -0700)] 
patman: Update the run script

Patman now has its main program in a function, so update the toml file
to match.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotools/make_pip: Add mention of u_boot_pylib in tool list
Simon Glass [Sun, 19 Nov 2023 15:36:04 +0000 (08:36 -0700)] 
tools/make_pip: Add mention of u_boot_pylib in tool list

This is not a tool but it is handled by the script, so update the help
to include it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agou_boot_pylib: Correct files used for pip release
Simon Glass [Sun, 19 Nov 2023 15:36:03 +0000 (08:36 -0700)] 
u_boot_pylib: Correct files used for pip release

The files list is incorrect and dates from a time when the script was
run from a different directory. Update it to match all the other tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotools: Keep test_util and patman test files in the pip release
Simon Glass [Sun, 19 Nov 2023 15:36:02 +0000 (08:36 -0700)] 
tools: Keep test_util and patman test files in the pip release

The test_util module is actually imported by some tools, e.g. binman so
include it in the pip release.

The patman tool uses its test code when starting up, so keep that too.

Show a list of deleted files so it is clear what is happening.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Add a dummy booti command
Simon Glass [Mon, 2 Oct 2023 01:15:24 +0000 (19:15 -0600)] 
sandbox: Add a dummy booti command

Add basic sandbox support for 'booti' so we can start to boot the test
ARMbian image. This is helpful in checking that it is parsed correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agou_boot_pylib: Correct readme formatting
Simon Glass [Sun, 19 Nov 2023 15:36:01 +0000 (08:36 -0700)] 
u_boot_pylib: Correct readme formatting

Correct a heading which is too short in the readme.

Fixes: 75554dfac29 ("patman: Add support for building a u_boot_tools...")
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovideo: Add a function to clear the display
Simon Glass [Mon, 2 Oct 2023 01:15:23 +0000 (19:15 -0600)] 
video: Add a function to clear the display

Move the code from the 'cls' command into the console file, so it can
be called from elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Update documentation URL
Simon Glass [Sun, 19 Nov 2023 15:36:00 +0000 (08:36 -0700)] 
doc: Update documentation URL

Update to use the new docs.u-boot.org URL for documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: print: Skip test on x86
Simon Glass [Mon, 2 Oct 2023 01:15:22 +0000 (19:15 -0600)] 
test: print: Skip test on x86

These tests cannot work on x86 machines as memory at address zero is
not writable. Add a condition to skip these.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: unit test for acpi_find_table()
Heinrich Schuchardt [Sat, 18 Nov 2023 21:57:27 +0000 (22:57 +0100)] 
test: unit test for acpi_find_table()

Provide a unit test for acpi_find_table()

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest: lmb: Move tests into the lib suite
Simon Glass [Mon, 2 Oct 2023 01:15:21 +0000 (19:15 -0600)] 
test: lmb: Move tests into the lib suite

These tests are marked as driver model tests, but have nothing to do
with driver model. As a result, they are run as part of 'ut dm' which
only exists for sandbox.

Move them to the 'lib' suite and drop the requirement for initing
devices, since they don't use devices.

Also put the lib_test_lmb_max_regions() macro inside the same #ifdef
as its function, to avoid a build error if the condition is false.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: consider XSDT in acpi_find_table()
Heinrich Schuchardt [Sat, 18 Nov 2023 21:57:26 +0000 (22:57 +0100)] 
acpi: consider XSDT in acpi_find_table()

The RSDT table is deprecated and does not exist on all systems.

By preference scan XSDT for the table to find. If no XSDT table exists, try
to use the RSDT table.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotest: event: Only run test_event_probe() on sandbox
Simon Glass [Mon, 2 Oct 2023 01:15:20 +0000 (19:15 -0600)] 
test: event: Only run test_event_probe() on sandbox

This needs test devices which are only present on sandbox. Add a check
for this and skip just this test if running on a real board.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: simplify acpi_write_ssdt()
Heinrich Schuchardt [Sat, 18 Nov 2023 21:52:37 +0000 (22:52 +0100)] 
acpi: simplify acpi_write_ssdt()

* Converting to void * is superfluous when calling memset().
* acpi_fill_header() already fills oem_table_id.

Fixes: d953137526cc ("x86: Move SSDT table to a writer function")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest: font: Add dependencies on fonts
Simon Glass [Mon, 2 Oct 2023 01:15:19 +0000 (19:15 -0600)] 
test: font: Add dependencies on fonts

The font test needs two fonts. If one is not available, skip out early,
to avoid an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: cannot have RSDT above 4 GiB
Heinrich Schuchardt [Sun, 12 Nov 2023 23:53:56 +0000 (00:53 +0100)] 
acpi: cannot have RSDT above 4 GiB

The field RsdtAddress has only 32 bit. The RSDT table cannot be located
beyond 4 GiB.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest: fdt: Add a special case for real boards
Simon Glass [Mon, 2 Oct 2023 01:15:18 +0000 (19:15 -0600)] 
test: fdt: Add a special case for real boards

The error that this test checks for is only shown on sandbox. For real
boards, there is normally no error. Add a special case to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofdt: Move ft_verify_fdt() before the final fixups
Simon Glass [Sun, 12 Nov 2023 15:27:50 +0000 (08:27 -0700)] 
fdt: Move ft_verify_fdt() before the final fixups

Move this check before the FDT fixups so that we can use a livetree
after this point.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: bdinfo: Add missing asserts
Simon Glass [Mon, 2 Oct 2023 01:15:17 +0000 (19:15 -0600)] 
test: bdinfo: Add missing asserts

Calling into sub-test functions should be done using ut_assertok() so
that the test exits immediately on failure. Add those which are
missing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofdt: Drop the confusing casts in lmb_free()
Simon Glass [Sun, 12 Nov 2023 15:27:49 +0000 (08:27 -0700)] 
fdt: Drop the confusing casts in lmb_free()

Just use map_to_sysmem() instead of all the casting.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Handle use of stack pointer in bdinfo
Simon Glass [Mon, 2 Oct 2023 01:15:16 +0000 (19:15 -0600)] 
test: Handle use of stack pointer in bdinfo

This test assumes that the stack pointer is the same across two calls
to lmb_init_and_reserve() but this is not the case on x86, for example.

Add a special case to handle this, along with a detailed comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoboot: Move adding initrd earlier in image_setup_libfdt()
Simon Glass [Sun, 12 Nov 2023 15:27:48 +0000 (08:27 -0700)] 
boot: Move adding initrd earlier in image_setup_libfdt()

This may as well happen before the general event is emitted, so move it.
This will allow us to use the livetree for the event part, but the
flattree for the earlier part.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Run bootstd tests only on sandbox
Simon Glass [Mon, 2 Oct 2023 01:15:15 +0000 (19:15 -0600)] 
test: Run bootstd tests only on sandbox

These make use of disk images which are not available on reak boards.
Add a new Kconfig to ensure these tests only run where they are valid.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofdt: ppc: Drop extra size for ramdisk
Simon Glass [Sun, 12 Nov 2023 15:27:47 +0000 (08:27 -0700)] 
fdt: ppc: Drop extra size for ramdisk

This code dates from around 2008:

   56844a22b76 powerpc: Fix bootm to boot up again with a Ramdisk

Since then we have added FDT relocation which provides enough space
for expansion. We have also added all sorts of fixups earlier in
image_setup_libfdt() which require more space, with ramdisk being the
least of them.

Therefore this extra hack for ramdisk seems unnecessary. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agotest: Make UT_LIB_ASN1 depend on sandbox
Simon Glass [Mon, 2 Oct 2023 01:15:14 +0000 (19:15 -0600)] 
test: Make UT_LIB_ASN1 depend on sandbox

This doesn't seem to work on a real board, so use the test on sandbox
only.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofdt: Improve the comment for fdt_shrink_to_minimum()
Simon Glass [Sun, 12 Nov 2023 15:27:46 +0000 (08:27 -0700)] 
fdt: Improve the comment for fdt_shrink_to_minimum()

Add a bit more detail about what this function does.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Add helper to skip to partial console line
Simon Glass [Mon, 2 Oct 2023 01:15:13 +0000 (19:15 -0600)] 
test: Add helper to skip to partial console line

Sometimes we need to skip to a line but it includes addresses or other
information which can vary depending on the runtime conditions.

Add a new ut_assert_skip_to_linen() which is similar to the existing
ut_assert_skip_to_line() function but only checks that the console line
matches up to the length of the provided string.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofdt: Check for a valid fdt in oftree_ensure()
Simon Glass [Sun, 12 Nov 2023 15:27:45 +0000 (08:27 -0700)] 
fdt: Check for a valid fdt in oftree_ensure()

Check the header before starting to use it, since this could provide
very confusing later, when ofnode calls start to fail.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoboot: Drop size parameter from image_setup_libfdt()
Simon Glass [Sun, 12 Nov 2023 15:27:44 +0000 (08:27 -0700)] 
boot: Drop size parameter from image_setup_libfdt()

The of_size parameter is not used, so remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoacpi: move acpi_get_rsdp_addr() to acpi/acpi_table.h
Heinrich Schuchardt [Thu, 9 Nov 2023 17:23:02 +0000 (09:23 -0800)] 
acpi: move acpi_get_rsdp_addr() to acpi/acpi_table.h

Function acpi_get_rsdp_addr() is needed on all architectures which
write ACPI tables. Move the definition from the x86 include to an
architecture independent one.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add a menu option to bootflow scan
Simon Glass [Mon, 2 Oct 2023 01:15:25 +0000 (19:15 -0600)] 
bootstd: Add a menu option to bootflow scan

Allow showing a menu and automatically booting, with 'bootflow scan'.
This is more convenient than using a script.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Add a new suite for commands
Simon Glass [Mon, 2 Oct 2023 01:15:12 +0000 (19:15 -0600)] 
test: Add a new suite for commands

Add a new suite for 'cmd' tests, used for testing commands. These are
kept in the test/cmd directory.

For now it is empty, but it will be used for coreboot-command tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopico-imx7d: add baseboard SD card boot detect
Benjamin Szőke [Wed, 13 Dec 2023 18:51:49 +0000 (15:51 -0300)] 
pico-imx7d: add baseboard SD card boot detect

Technexion PICO-IMX7 SoM is supporting USDHC3 (eMMC or micro SD on SoM)
and USDHC1 (SD on carrier board) to use on any carrier board like
PICO-NYMPH. Based on the U-Boot version from Technexion it adds
baseboard SD card boot detect to able to boot from selected USDHC1
or USDHC3 boot devices.

Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
Tested-by: Fabio Estevam <festevam@gmail.com>
2 years agoimx: imx-hab: Select SPL_DRIVERS_MISC in the SPL case
Fabio Estevam [Mon, 11 Dec 2023 13:46:17 +0000 (10:46 -0300)] 
imx: imx-hab: Select SPL_DRIVERS_MISC in the SPL case

Selecting CONFIG_IMX_HAB=y on a SPL target, such as apalis_imx6_defconfig,
for example, leads to the following build error:

/usr/bin/arm-linux-gnueabihf-ld.bfd: arch/arm/mach-imx/hab.o: in function `imx_hab_is_enabled':
arch/arm/mach-imx/hab.c:879: undefined reference to `fuse_read'

fuse_read() comes from SPL_MXC_OCOTP, which depends on SPL_DRIVERS_MISC,
since commit 251a3053b1e6 ("misc: imx: remove DM dependency for ocotp
driver in SPL").

Select SPL_DRIVERS_MISC in the SPL case to fix this build issue.

Reported-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Tested-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
2 years agotools: mxsboot: pre-fill buffer with 0xff, not 0
Alessandro Rubini [Sun, 3 Dec 2023 17:08:26 +0000 (18:08 +0100)] 
tools: mxsboot: pre-fill buffer with 0xff, not 0

The tool works for me, with imx28 and NAND memory, but the resulting
blocks are reported as bad, both by u-boot and the kernel.

This makes it impossible to erase from Linux (for an upgrade without
console access, for example -- u-boot can "nand scrub" but linux can't).

pre-filling with 0xff creates a proper boot loader image, but no
bad-block marker is there when written to flash.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agoarm: mxs: Clear CPSR V bit to activate low vectors
Marek Vasut [Wed, 18 Oct 2023 18:51:59 +0000 (20:51 +0200)] 
arm: mxs: Clear CPSR V bit to activate low vectors

The MXS starts with CPSR V bit set, which makes the CPU jump to high vectors
in case of an exception. Those high vectors are located at 0xffff0000, which
is where the BootROM exception table is located as well. U-Boot should handle
exceptions on its own using its own exception handling code, which is located
at 0x0, i.e. at low vectors. Clear the CPSR V bit, so that the CPU would jump
to low vectors on exception instead, and therefore run the U-Boot exception
handling code.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoMerge patch series "bootm: Refactoring to reduce reliance on CMDLINE (part A)"
Tom Rini [Wed, 13 Dec 2023 16:51:53 +0000 (11:51 -0500)] 
Merge patch series "bootm: Refactoring to reduce reliance on CMDLINE (part A)"

To quote the author:

It would be useful to be able to boot an OS when CONFIG_CMDLINE is
disabled. This could allow reduced code size.

Standard boot provides a way to handle programmatic boot, without
scripts, so such a feature is possible. The main impediment is the
inability to use the booting features of U-Boot without a command line.
So the solution is to avoid passing command arguments and the like to
code in boot/

A similar process has taken place with filesystems, for example, where
we have (somewhat) separate Kconfig options for the filesystem commands
and the filesystems themselves.

This series starts the process of refactoring the bootm logic so that
it can be called from standard boot without using the command line.
Mostly it removes the use of argc, argv and cmdtbl from the internal
logic.

Some limited tidy-up is included, but this is kept to smaller patches,
rather than trying to remove all #ifdefs etc. Some function comments
are added, however.

A simple programmatic boot is provided as a starting point.

This work will likely take many series, so this is just the start.

Size growth with this series for firefly-rk3288 (Thumb2) is:

       arm: (for 1/1 boards) all +23.0 rodata -49.0 text +72.0

This should be removed by:

   https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/11

but it is not included in this series as it is already large enough.

No functional change is intended in this series.

Changes in v3:
- Add a panic if programmatic boot fails
- Drop RFC tag

Changes in v2:
- Add new patch to adjust position of unmap_sysmem() in boot_get_kernel()
- Add new patch to obtain command arguments
- Fix 'boot_find_os' typo
- Pass in the command name
- Use the command table to provide the command name, instead of "bootm"

2 years agocommand: Introduce functions to obtain command arguments
Simon Glass [Sat, 18 Nov 2023 21:05:20 +0000 (14:05 -0700)] 
command: Introduce functions to obtain command arguments

Add some functions which provide an argument to a command, or NULL if
the argument does not exist.

Use the same numbering as argv[] since it seems less confusing than the
previous idea.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
2 years agobootstd: Introduce programmatic boot
Simon Glass [Sat, 18 Nov 2023 21:05:19 +0000 (14:05 -0700)] 
bootstd: Introduce programmatic boot

At present bootstd requires CONFIG_CMDLINE to operate. Add a new
'programmatic' boot which can be used when no command line is available.
For now it does almost nothing, since most bootmeths require the
command line.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootm: Reduce arguments to bootm_find_other()
Simon Glass [Sat, 18 Nov 2023 21:05:18 +0000 (14:05 -0700)] 
bootm: Reduce arguments to bootm_find_other()

Rather than passing the full list of command arguments, pass only those
which are needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Add a function to check overlap
Simon Glass [Sat, 18 Nov 2023 21:05:17 +0000 (14:05 -0700)] 
bootm: Add a function to check overlap

Move this code into a function to reduce code size and make it easier
to understand. Drop the unnecessary 0x to help a little with code size.

Use this in bootm_find_images()

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Adjust the parameters of bootm_find_images()
Simon Glass [Sat, 18 Nov 2023 21:05:16 +0000 (14:05 -0700)] 
bootm: Adjust the parameters of bootm_find_images()

Rather than passing it all the command-line args, pass in the pieces
that it needs. These are the image address, the ramdisk address/name
and the FDT address/name.

Ultimately this will allow usage of this function without being called
from the command line.

Move the function comment to the header file and tidy it a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootm: optee: Drop special call to bootm_find_other()
Simon Glass [Sat, 18 Nov 2023 21:05:15 +0000 (14:05 -0700)] 
bootm: optee: Drop special call to bootm_find_other()

The normal bootm flow calls bootm_find_other() can call the
BOOTM_STATE_FINDOTHER state as part of its processing. Fix the
condition there so that this hack can be removed.

Also drop the confusing check for the OS type, since do_bootm_tee() is
only called if the condition is met - see bootm_os_get_boot_func()

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootm: efi: Drop special call to bootm_find_other()
Simon Glass [Sat, 18 Nov 2023 21:05:14 +0000 (14:05 -0700)] 
bootm: efi: Drop special call to bootm_find_other()

The normal bootm flow calls bootm_find_other() can call the
BOOTM_STATE_FINDOTHER state as part of its processing. Fix the
condition there so that this hack can be removed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootm: Simplify Android ramdisk addr in bootm_find_images()
Simon Glass [Sat, 18 Nov 2023 21:05:13 +0000 (14:05 -0700)] 
bootm: Simplify Android ramdisk addr in bootm_find_images()

The Android mechanism uses the loadaddr envrionment-variable to get the
load address, if none is provided. This is equivalent to
image_load_addr so use that instead, converting it to a string as
needed.

This change will permit passing img_addr to this function, in a future
change.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Reduce arguments to boot_get_loadables()
Simon Glass [Sat, 18 Nov 2023 21:05:12 +0000 (14:05 -0700)] 
bootm: Reduce arguments to boot_get_loadables()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

Tidy up the function comment while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Reduce arguments to boot_get_fpga()
Simon Glass [Sat, 18 Nov 2023 21:05:11 +0000 (14:05 -0700)] 
bootm: Reduce arguments to boot_get_fpga()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Reduce arguments to boot_get_fdt()
Simon Glass [Sat, 18 Nov 2023 21:05:10 +0000 (14:05 -0700)] 
bootm: Reduce arguments to boot_get_fdt()

This function only uses one argument from bootm (argv[2]) so pass it in
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Pass image buffer to boot_get_fdt()
Simon Glass [Sat, 18 Nov 2023 21:05:09 +0000 (14:05 -0700)] 
bootm: Pass image buffer to boot_get_fdt()

Rather than having boot_get_fdt() calculate this, move the calculation
into the caller. This removes the access to argv[0] in this function,
so we can later refactor it to just accept argv[2] instead of the whole
argv[].

Move the function comment to the header file and fix the u8 argument,
while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Drop #ifdef in bootm_find_images()
Simon Glass [Sat, 18 Nov 2023 21:05:08 +0000 (14:05 -0700)] 
bootm: Drop #ifdef in bootm_find_images()

The OF_LIBFDT #ifdef makes it harder to use a local variable for that
code block. Convert it to if() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofdt: Allow use of fdt_support inside if() statements
Simon Glass [Sat, 18 Nov 2023 21:05:07 +0000 (14:05 -0700)] 
fdt: Allow use of fdt_support inside if() statements

Most of the fdt_support.h header file is included only if OF_LIBFDT or
OF_CONTROL are enabled. This means that calling functions defined in
that file must happen inside an #ifdef

This is unnecessary, so reduce the condition to just !USE_HOSTCC

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Reduce arguments to boot_get_ramdisk()
Simon Glass [Sat, 18 Nov 2023 21:05:06 +0000 (14:05 -0700)] 
bootm: Reduce arguments to boot_get_ramdisk()

This function normally only uses one argument so pass it in directly.
Move comments to the header file so could one day include these
functions in API docs. Fix up the u8 argument while here, since it
avoids the compiler having to mask the value on some machines.

The Android case here is bit strange, since it can use argv[0], so deal
with that in the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Reduce arguments to bootm_find_os()
Simon Glass [Sat, 18 Nov 2023 21:05:05 +0000 (14:05 -0700)] 
bootm: Reduce arguments to bootm_find_os()

This function only uses one argument so pass it in directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Move error printing out of boot_get_kernel()
Simon Glass [Sat, 18 Nov 2023 21:05:04 +0000 (14:05 -0700)] 
bootm: Move error printing out of boot_get_kernel()

The same error message is printed in two places. Move it out to the
caller so we can avoid passing in the command name. Leave the bootstage
handling where it is.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootstage: Drop BOOTSTAGE_ID_FIT_KERNEL_INFO
Simon Glass [Sat, 18 Nov 2023 21:05:03 +0000 (14:05 -0700)] 
bootstage: Drop BOOTSTAGE_ID_FIT_KERNEL_INFO

This is a misnomer since we don't necessarily know that the image is a
FIT. Use the existing BOOTSTAGE_ID_CHECK_IMAGETYPE instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Use the error return from boot_get_kernel()
Simon Glass [Sat, 18 Nov 2023 21:05:02 +0000 (14:05 -0700)] 
bootm: Use the error return from boot_get_kernel()

Rather than looking for a zero-sized image, use the error code returned
to determine if things are OK.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Adjust position of unmap_sysmem() in boot_get_kernel()
Simon Glass [Sat, 18 Nov 2023 21:05:01 +0000 (14:05 -0700)] 
bootm: Adjust position of unmap_sysmem() in boot_get_kernel()

These unmaps should happen regardless of the return value. Move them
before the 'return' statement.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>