]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
10 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Wed, 19 Jul 2023 00:42:16 +0000 (20:42 -0400)] 
Merge https://source.denx.de/u-boot/custodians/u-boot-mmc

10 months agoMerge branch '2023-07-17-assorted-updates'
Tom Rini [Tue, 18 Jul 2023 13:55:32 +0000 (09:55 -0400)] 
Merge branch '2023-07-17-assorted-updates'

- Merge in some Kconfig dependencies fixes, typo fixes, erofs update,
  shell portability fix, an env save fix, better mbr+gpt support, and
  some android A/B enhancements.

10 months agommc: Set clock when reverting to safe bus mode
Valentine Barshak [Sat, 10 Jun 2023 11:22:33 +0000 (13:22 +0200)] 
mmc: Set clock when reverting to safe bus mode

Set MMC clock when reverting to safe bus mode and speed
in case current MMC mode fails. Otherwise, trying out
the other modes may fail as well.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
[hp: fallback to legacy_speed]
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agommc: renesas-sdhi: Send stop when MMC tuning command fails
Hai Pham [Mon, 19 Jun 2023 22:38:25 +0000 (00:38 +0200)] 
mmc: renesas-sdhi: Send stop when MMC tuning command fails

When tuning command (CMD21) fails with command error, call
mmc_send_stop_transmission() to send stop command (CMD12).

Reviewed-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
[Marek: Add dev_dbg() message in case tuning abort fails
        Move tuning opcode check from mmc_abort_tuning()]
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agommc: Introduce mmc_send_stop_transmission()
Hai Pham [Mon, 19 Jun 2023 22:38:24 +0000 (00:38 +0200)] 
mmc: Introduce mmc_send_stop_transmission()

If a tuning command times out, the card could still be processing it,
which will cause problems for recovery. The eMMC specification section
6.6 Data transfer mode (cont’d) claims that CMD12 can be used to stop
CMD21:
"
The relationship between the various data transfer modes is summarized (see Figure 27):
- All data read commands can be aborted any time by the stop command (CMD12).
  The data transfer will terminate and the Device will return to the Transfer State.
  The read commands are: ... send tuning block (CMD21) ....
"
Add a function that does that.

Based on Linux commit [1] and [2].

[1] e711f0309109 ("mmc: mmc: Introduce mmc_abort_tuning()")
[2] 21adc2e45f4e ("mmc: Improve function name when aborting a tuning
cmd")

Reviewed-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
[Marek: Update commit message, quote relevant part of the specification.
        Rename to mmc_send_stop_transmission().
Remove tuning opcode check, this is controller driver specific.
Deduplicate part of mmc_read_blocks() using this function.]
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agommc: Fix MMC_CMD_STOP_TRANSMISSION response type and add comment
Marek Vasut [Mon, 19 Jun 2023 22:38:23 +0000 (00:38 +0200)] 
mmc: Fix MMC_CMD_STOP_TRANSMISSION response type and add comment

For MMC/eMMC, the MMC_CMD_STOP_TRANSMISSION response is R1 for read
transfers and R1b for write transfers per JEDEC Standard No. 84-B51
Page 126 . The response is R1b unconditionally per Physical Layer
Simplified Specification Version 9.00.

Correct the response type and add a comment about it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoenv: Fix default environment saving issue
Ashok Reddy Soma [Tue, 4 Jul 2023 06:16:07 +0000 (00:16 -0600)] 
env: Fix default environment saving issue

When CONFIG_SYS_REDUNDAND_ENVIRONMENT is enabled, by default env is
getting saved to redundant environment irrespective of primary env is
present or not.

It means even if primary and redundant environment are not present, by
default, env is getting stored to redundant environment. Even if primary
env is present, it is choosing to store in redudndant env.

Ideally it should look for primary env and choose to store in primary env
if it is present. If both primary and redundant env are not present then
it should save in to primary env area.

Fix the issue by making env_valid = ENV_INVALID when both the
environments are not present.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoandroid_ab: Try backup booloader_message
Joshua Watt [Mon, 3 Jul 2023 15:07:13 +0000 (10:07 -0500)] 
android_ab: Try backup booloader_message

Some devices keep 2 copies of the bootloader_message in the misc
partition and write each in sequence when updating. This ensures that
there is always one valid copy of the bootloader_message. Teach u-boot
to optionally try a backup bootloader_message from a specified offset if
the primary one fails its CRC check.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
10 months agocmd: mbr: Force DOS driver to be used for verify
Joshua Watt [Mon, 3 Jul 2023 13:39:56 +0000 (08:39 -0500)] 
cmd: mbr: Force DOS driver to be used for verify

Forces the DOS partition type driver to be used when verifying the MBR.
This is particularly useful when using a hybrid MBR & GPT layout as
otherwise MBR verification would mostly likely fail since the GPT
partitions will be returned, even if the MBR is actually valid.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agodm: test: Add test for part_get_info_by_type
Joshua Watt [Mon, 3 Jul 2023 13:39:55 +0000 (08:39 -0500)] 
dm: test: Add test for part_get_info_by_type

Adds a test suite to ensure that part_get_info_by_type works correctly
by creating a hybrid GPT/MBR partition table and reading both.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
[trini: Add this on the other sandbox configs]
Signedd-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agodisk: part: Add API to get partitions with specific driver
Joshua Watt [Mon, 3 Jul 2023 13:39:54 +0000 (08:39 -0500)] 
disk: part: Add API to get partitions with specific driver

Adds part_driver_get_type() API which can be used to force a specific
driver to be used when getting partition information instead of relying
on auto detection.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agodm: test: Improve partition test error output
Joshua Watt [Mon, 3 Jul 2023 13:39:53 +0000 (08:39 -0500)] 
dm: test: Improve partition test error output

Improve the logging when the partition test fails so that it is clear
what went wrong, shown with actual values.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agodm: test: Fix partition test to use mmc2
Joshua Watt [Mon, 3 Jul 2023 13:39:52 +0000 (08:39 -0500)] 
dm: test: Fix partition test to use mmc2

d94d9844bc ("dm: part: Update test to use mmc2") attempted to make the
test use mmc2, but the change was incomplete in that it didn't also
change the strings that reference a specific partition. Fix these so
that the test passes again

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
10 months agotests: Fix exception when cleaning up skipped test
Joshua Watt [Mon, 3 Jul 2023 13:35:09 +0000 (08:35 -0500)] 
tests: Fix exception when cleaning up skipped test

If test_cat and test_xxd cannot create the required file, the test will
be skipped, but this would result in an exception being raised in the
finally block because the file didn't exist to be cleaned up. This
caused the test to be marked as failed instead of skipped.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoandroid_ab: Add option to skip decrementing tries
Joshua Watt [Fri, 23 Jun 2023 22:05:48 +0000 (17:05 -0500)] 
android_ab: Add option to skip decrementing tries

It is is sometimes desired to be able to skip decrementing the number of
tries remaining in an Android A/B boot, and instead just check which
slot will be tried later. This can commonly be be the case for platforms
that want to A/B u-boot itself, but are required to boot from a FAT MBR
partition. In these cases, u-boot must do an early check that the MBR
points to the correct A/B boot partition, and if not rewrite the MBR to
point to the correct one and reboot. Decrementing the try count in this
case is not desired because it means that each u-boot might constantly
ping-pong overwriting the MBR and rebooting until all the retries are
used up.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
10 months agodisk: Use BOOT_DEFAULTS instead of DISTRO_DEFAULTS
Jonas Karlman [Tue, 11 Jul 2023 22:37:30 +0000 (22:37 +0000)] 
disk: Use BOOT_DEFAULTS instead of DISTRO_DEFAULTS

Set default y based on common BOOT_DEFAULTS instead of DISTRO_DEFAULTS.

No change is intended, affected options is already implied for DISTRO
and BOOTSTD due to BOOT_DEFAULTS imply DOS_PARTITION (USB_STORAGE),
EFI_PARTITION and ISO_PARTITION.

Fixes: a0c739c184ca ("boot: Create a common BOOT_DEFAULTS for distro and bootstd")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agodfu: Add proper dependency for CONFIG_DFU_MMC
Ashok Reddy Soma [Fri, 7 Jul 2023 08:51:36 +0000 (02:51 -0600)] 
dfu: Add proper dependency for CONFIG_DFU_MMC

When CONFIG_CMD_MMC and CONFIG_MMC are disabled, still some compilation
errors are seen as below due to unresolved symbols.

drivers/dfu/dfu_mmc.o: in function `mmc_block_op':
drivers/dfu/dfu_mmc.c:32: undefined reference to `find_mmc_device'
drivers/dfu/dfu_mmc.c:54: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.c:67: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.c:70: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.o: in function `dfu_fill_entity_mmc':
drivers/dfu/dfu_mmc.c:369: undefined reference to `find_mmc_device'
drivers/dfu/dfu_mmc.c:376: undefined reference to `mmc_init'
drivers/dfu/dfu_mmc.c:403: undefined reference to `mmc_get_blk_desc'
gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld.bfd: line 4:
31661 Segmentation fault      (core dumped) $CC --sysroot=$LIBC
--no-warn-rwx-segment "$@"
Makefile:1760: recipe for target 'u-boot' failed
make: *** [u-boot] Error 139
make: *** Deleting file 'u-boot'

Add dependency of CONFIG_MMC for CONFIG_DFU_MMC config to fix the errors.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
10 months agofs/erofs: Introduce new features including ztailpacking, fragments and dedupe
Yifan Zhao [Fri, 7 Jul 2023 15:52:12 +0000 (23:52 +0800)] 
fs/erofs: Introduce new features including ztailpacking, fragments and dedupe

This patch updates erofs driver code to catch up with the latest code of
erofs_utils (commit e4939f9eaa177e05d697ace85d8dc283e25dc2ed).

LZMA will be supported in the separate patch later.

Signed-off-by: Yifan Zhao <zhaoyifan@sjtu.edu.cn>
Reviewed-by: Huang Jianan <jnhuang95@gmail.com>
10 months agoMakefile: Add missing quotes around sort --field-separator
Marek Vasut [Tue, 11 Jul 2023 12:15:53 +0000 (14:15 +0200)] 
Makefile: Add missing quotes around sort --field-separator

Busybox sort does not handle --field-separator== , replace this
with --field-separator='=' for maximum compatibility.

Fixes: cc5a490cf465 ("Makefile: Sort u-boot-initial-env output")
Reported-by: Milan P. Stanić <mps@arvanta.net>
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agobootstd: Correct 'bpot' typo
Julien Delbergue [Thu, 13 Jul 2023 09:53:09 +0000 (11:53 +0200)] 
bootstd: Correct 'bpot' typo

Fix it to 'boot' in the header, as it is in the source file.

Signed-off-by: Julien Delbergue <j.delbergue.foss@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 17 Jul 2023 14:38:28 +0000 (10:38 -0400)] 
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- bootstd: Add a bootmeth for ChromiumOS on x86
- x86: Use qemu-x86_64 to boot EFI installers

10 months agox86: Switch QEMU over to use the bochs driver
Simon Glass [Sun, 16 Jul 2023 03:39:19 +0000 (21:39 -0600)] 
x86: Switch QEMU over to use the bochs driver

This is more convenient since it does not require a video BIOS. Enable
it for QEMU.

Also drop use of video in SPL for the 64-bit QEMU, since it not needed
now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: video: Add a driver for QEMU bochs emulation
Simon Glass [Sun, 16 Jul 2023 03:39:18 +0000 (21:39 -0600)] 
x86: video: Add a driver for QEMU bochs emulation

Bochs is convenient with QEMU on x86 since it does not require a video
BIOS. Add a driver for it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agoefi: Use the installed ACPI tables
Simon Glass [Sun, 16 Jul 2023 03:39:17 +0000 (21:39 -0600)] 
efi: Use the installed ACPI tables

U-Boot sets up the ACPI tables during startup. Rather than creating a
new set, install the existing ones. Create a memory-map record to cover
the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agosandbox: Install ACPI tables on startup
Simon Glass [Sun, 16 Jul 2023 03:39:16 +0000 (21:39 -0600)] 
sandbox: Install ACPI tables on startup

With x86 we set up the ACPI tables on startup so they can be examined. Do
the same with sandbox, so it is consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agosandbox: Correct header order in board file
Simon Glass [Sun, 16 Jul 2023 03:39:15 +0000 (21:39 -0600)] 
sandbox: Correct header order in board file

Fix the header order in this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agolog: Support outputing function names in SPL
Simon Glass [Sun, 16 Jul 2023 03:39:14 +0000 (21:39 -0600)] 
log: Support outputing function names in SPL

The output is garbled when tiny printf() is used. Correct this by adding
a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Make sure that the LPC is active before SDRAM init
Simon Glass [Sun, 16 Jul 2023 03:39:13 +0000 (21:39 -0600)] 
x86: Make sure that the LPC is active before SDRAM init

Some boards need to access GPIOs to determine which SDRAM is fitted to the
board, for example chromebook_link. Probe this device (if it exists) to
make sure that this works as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: link: Support Micron memory
Simon Glass [Sun, 16 Jul 2023 03:39:12 +0000 (21:39 -0600)] 
x86: link: Support Micron memory

Add the required tag so that micron memory can be set up correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Convert some debug statements to use logging
Simon Glass [Sun, 16 Jul 2023 03:39:11 +0000 (21:39 -0600)] 
x86: Convert some debug statements to use logging

Move from using debug() to log_debug() so that we don't have to use the
__func__ parameter and can access other logging features.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Record the start and end of the tables
Simon Glass [Sun, 16 Jul 2023 03:39:10 +0000 (21:39 -0600)] 
x86: Record the start and end of the tables

The ACPI tables are special in that they are passed to EFI as a separate
piece, independent of other tables.

Also they can be spread over two areas of memory, e.g. with QEMU we end
up with tables kept in high memory as well.

Add new global_data fields to hold this information and update the bdinfo
command to show the table areas.

Move the rom_table_end variable into the loop that uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Refactor table-writing code a little
Simon Glass [Sun, 16 Jul 2023 03:39:09 +0000 (21:39 -0600)] 
x86: Refactor table-writing code a little

The implementation of write_tables() is confusing because it uses the
rom_table_start variable as the address pointer as it progresses.

Rename it to rom_addr to make the code clearer. Move the rom_table_end
variable into the block where it is used.

Also update logging to use the ACPI category, now that it is available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Enable useful options for qemu-86_64
Simon Glass [Sun, 16 Jul 2023 03:39:08 +0000 (21:39 -0600)] 
x86: Enable useful options for qemu-86_64

This build can be used to boot standard distro builds, since these are
mostly 64-bit these days. Enable some more options, so that all possible
EFI UUIDs are decoded, we get a proper printf() in SPL, can search
memory for tables, support the full set of standard-boot features, have
full logging and can boot from CDROM media.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agofs: fat: Shrink the size of a few strings
Simon Glass [Sun, 16 Jul 2023 03:39:06 +0000 (21:39 -0600)] 
fs: fat: Shrink the size of a few strings

To save a few bytes, replace Error with ** and try to use the same string
for multiple messages where possible.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Allow logging to be used in SPL reliably
Simon Glass [Sun, 16 Jul 2023 03:39:05 +0000 (21:39 -0600)] 
x86: Allow logging to be used in SPL reliably

When global_data is relocated, log_head moves in memory, meaning that
the items in that list point to the wrong place.

Disable logging when making the change, then reenable it afterwards, so
that logging works normally.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Enable display for QEMU 64-bit
Simon Glass [Sun, 16 Jul 2023 03:39:04 +0000 (21:39 -0600)] 
x86: Enable display for QEMU 64-bit

Enable the various options needed for display to work on the qemu-x86_64
board. This includes expanding the available malloc() memory in SPL,
since the PCI bus must be enumerated in order to find the video device.

It also includes enabling a bloblist, so that the video parameters can be
passed. This is placed at address 10000 but is not needed after U-Boot
proper reads the information there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agopci: Mask the ROM address in case it is already enabled
Simon Glass [Sun, 16 Jul 2023 03:39:03 +0000 (21:39 -0600)] 
pci: Mask the ROM address in case it is already enabled

In some cases the video ROM may have been enabled previously, such as by
a previous firmware stage. Use the correct address in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agopci: Adjust video BIOS debugging to be SPL-friendly
Simon Glass [Sun, 16 Jul 2023 03:39:02 +0000 (21:39 -0600)] 
pci: Adjust video BIOS debugging to be SPL-friendly

A hex value is expected for the VGA mode. Add a 0x prefix, since the #
construct is not supported in SPL. We don't want to add it, due to
code-size constraints.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Init video in SPL if enabled
Simon Glass [Sun, 16 Jul 2023 03:39:01 +0000 (21:39 -0600)] 
x86: Init video in SPL if enabled

When video is required in SPL, set this up ready for use. Ignore any
problems since it may be that video is not actually available and we
still want to continue on to U-Boot proper in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Ensure SPL banner is only shown once
Simon Glass [Sun, 16 Jul 2023 03:39:00 +0000 (21:39 -0600)] 
x86: Ensure SPL banner is only shown once

Print the banner in SPL init only if the spl_board_init() function isn't
enabled. The spl_board_init() function is in the same file, but is called
later, by board_init_r().

This avoids printing two banners, which causes tests to fail.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Pass video settings from SPL to U-Boot proper
Simon Glass [Sun, 16 Jul 2023 03:38:59 +0000 (21:38 -0600)] 
x86: Pass video settings from SPL to U-Boot proper

When video is set up in SPL, U-Boot proper needs to use the correct
parameters so it can write to the display.

Put these in a bloblist so they are available to U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Allow video-BIOS code to be built for SPL
Simon Glass [Sun, 16 Jul 2023 03:38:58 +0000 (21:38 -0600)] 
x86: Allow video-BIOS code to be built for SPL

With qemu-x86_64 we need to run the video BIOS while in 32-bit mode, i.e.
SPL. Add a Kconfig option for this, adjust the Makefile rules and use
CONFIG_IS_ENABLED() where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agopci: Tidy up logging and reporting for video BIOS
Simon Glass [Sun, 16 Jul 2023 03:38:57 +0000 (21:38 -0600)] 
pci: Tidy up logging and reporting for video BIOS

When running the ROM the code is not very helpful when something goes
wrong. Add a little more debugging and some logging of return values to
improve this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agopci: Support autoconfig in SPL
Simon Glass [Sun, 16 Jul 2023 03:38:55 +0000 (21:38 -0600)] 
pci: Support autoconfig in SPL

Allow PCI autoconfig to be handled in SPL, so that we can set it up
correctly for boards which need to do this before U-Boot proper. This
includes qemu-x64_64 which needs to set up the video device while in
32-bit mode.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agonvme: Provide more useful debugging messages
Simon Glass [Sun, 16 Jul 2023 03:38:54 +0000 (21:38 -0600)] 
nvme: Provide more useful debugging messages

When scanning fails it is useful to be able to decode what went wrong. Add
some debugging for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobdinfo: Show the malloc base with the bdinfo command
Simon Glass [Sun, 16 Jul 2023 03:38:53 +0000 (21:38 -0600)] 
bdinfo: Show the malloc base with the bdinfo command

It is useful to see the base of the malloc region. This is visible when
debugging but not in normal usage.

Add it to the global data so that it can be shown.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Nikhil M Jain <n-jain1@ti.com>
10 months agox86: Improve the trampoline in 64-bit mode
Simon Glass [Sun, 16 Jul 2023 03:38:52 +0000 (21:38 -0600)] 
x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agoefi: Show all known UUIDs with CONFIG_CMD_EFIDEBUG
Simon Glass [Sun, 16 Jul 2023 03:38:51 +0000 (21:38 -0600)] 
efi: Show all known UUIDs with CONFIG_CMD_EFIDEBUG

The CMD_EFIDEBUG option enables debugging so it is reasonable to assume
that all effects should be made to decode the dreaded UUIDs favoured by
UEFI.

Update the table to show them all when CONFIG_CMD_EFIDEBUG is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agoqfw: Set the address of the ACPI tables
Simon Glass [Sun, 16 Jul 2023 03:38:50 +0000 (21:38 -0600)] 
qfw: Set the address of the ACPI tables

Once the ACPI tables have been set up, record their address so that it is
possible to list them with 'acpi list'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agolog: Tidy up an ambiguous comment
Simon Glass [Sun, 16 Jul 2023 03:38:49 +0000 (21:38 -0600)] 
log: Tidy up an ambiguous comment

Add a bit more detail so it is clear that multiple devices are
supported, but only one per driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agoqfw: Show the file address if available
Simon Glass [Sun, 16 Jul 2023 03:38:48 +0000 (21:38 -0600)] 
qfw: Show the file address if available

Some files have an associated address. Show this with the 'qfw list'
command so that it is possible to dump the data.

Note that the reference to 'md' is for the md.rst file, not a
markdown file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agopart: Allow setting the partition-table type
Simon Glass [Sun, 16 Jul 2023 03:38:47 +0000 (21:38 -0600)] 
part: Allow setting the partition-table type

Some devices have multiple partition types available on the same media.
It is sometimes useful to see these to check that everything is working
correctly.

Provide a way to manually set the partition-table type, avoiding the
auto-detection process.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobdinfo: Show the RAM top and approximate stack pointer
Simon Glass [Sun, 16 Jul 2023 03:38:46 +0000 (21:38 -0600)] 
bdinfo: Show the RAM top and approximate stack pointer

These are useful pieces of information when debugging. The RAM top shows
where U-Boot started allocating memory from, before it relocated. The
stack pointer can be checked to ensure it is in the correct region.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Nikhil M Jain <n-jain1@ti.com>
10 months agoacpi: Add a comment to set the acpi tables
Simon Glass [Sun, 16 Jul 2023 03:38:45 +0000 (21:38 -0600)] 
acpi: Add a comment to set the acpi tables

Sometimes a previous bootloader has written ACPI tables. It is useful to
be able to find and list these. Add an 'acpi set' command to set the
address for these tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Show an error when a BIOS exception occurs
Simon Glass [Sun, 16 Jul 2023 03:38:44 +0000 (21:38 -0600)] 
x86: Show an error when a BIOS exception occurs

Rather than silently hanging, show an error first. This can happen when
there is something wrong with the video BIOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Correct get_sp() implementation for 64-bit
Simon Glass [Sun, 16 Jul 2023 03:38:43 +0000 (21:38 -0600)] 
x86: Correct get_sp() implementation for 64-bit

Use an assembler implementation as is done for i386, so that the results
are equivalent for i386 and x86_64.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Show the CPU physical address size with bdinfo
Simon Glass [Sun, 16 Jul 2023 03:38:42 +0000 (21:38 -0600)] 
x86: Show the CPU physical address size with bdinfo

This is useful information so show it with the bdinfo command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Add a comment for board_init_f_r_trampoline()
Simon Glass [Sun, 16 Jul 2023 03:38:41 +0000 (21:38 -0600)] 
x86: Add a comment for board_init_f_r_trampoline()

Add a comment for this function in the header.

Change the function (and the one after) to use __noreturn to keep
checkpatch happy.

Add docs to board_init_f_r() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Tidy up EFI code in interrupt_init()
Simon Glass [Sun, 16 Jul 2023 03:38:40 +0000 (21:38 -0600)] 
x86: Tidy up EFI code in interrupt_init()

The ll_boot_init() check handles the EFI case so we don't need the rest
of the code. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobios_emulator: Drop VIDEO_IO_OFFSET
Simon Glass [Sun, 16 Jul 2023 03:38:39 +0000 (21:38 -0600)] 
bios_emulator: Drop VIDEO_IO_OFFSET

This is always zero in the source tree, so drop it.

While we are here, add a comment to _X86EMU_env since the symbol is
actually defined twice, which can cause confusion when building.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobios_emulator: Add Kconfig and adjust Makefile for SPL
Simon Glass [Sun, 16 Jul 2023 03:38:38 +0000 (21:38 -0600)] 
bios_emulator: Add Kconfig and adjust Makefile for SPL

The Kconfig for this is currently inside a particular board. Move it into
the correct place and allow use in SPL, so that video can be used there
if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: mtrr: Add documentation
Simon Glass [Sun, 16 Jul 2023 03:38:37 +0000 (21:38 -0600)] 
x86: mtrr: Add documentation

Add documention for the x86 'mtrr' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
10 months agox86: Allow listing MTRRs in SPL
Simon Glass [Sun, 16 Jul 2023 03:38:36 +0000 (21:38 -0600)] 
x86: Allow listing MTRRs in SPL

Move MTRR-listing code into a common file so it can be used from SPL.
Update the 'mtrr' command to call it.

Use this in SPL just before adjusting the MTRRs, so we can see the state
set up by the board. Only show it when debug is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: coral: Adjust various config options
Simon Glass [Wed, 12 Jul 2023 15:04:47 +0000 (09:04 -0600)] 
x86: coral: Adjust various config options

Add ms so it is easier to search for tables in memory.

Expand the command-line and print buffers so that we can deal with the
very long ChromeOS command lines. (typically 700 characters).

Enable BOOTSTD_FULL to get the full set of standard-boot options.

Replace the existing manual script with 'bootflow scan', since it can
find and boot the OS.

Finally, expand the malloc() space so we can read large kernels into a
bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: coreboot: Adjust various config options
Simon Glass [Wed, 12 Jul 2023 15:04:46 +0000 (09:04 -0600)] 
x86: coreboot: Adjust various config options

Drop IDE and add NVME since this is more common now.

Add ms so it is easier to search for tables in memory.

Expand the command-line and print buffers so that we can deal with the
very long ChromeOS command lines. (typically 700 characters).

Enable BOOTSTD_FULL to get the full set up standard-boot options.

Finally, expand the malloc() space so we can read large kernels into a
bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Add a simple bootmeth for ChromiumOS
Simon Glass [Wed, 12 Jul 2023 15:04:45 +0000 (09:04 -0600)] 
bootstd: Add a simple bootmeth for ChromiumOS

It is possible to boot x86-based ChromeOS machines by parsing a table and
locating the kernel and command line. Add a bootmeth for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: zimage: Export the function to obtain the cmdline
Simon Glass [Wed, 12 Jul 2023 15:04:44 +0000 (09:04 -0600)] 
x86: zimage: Export the function to obtain the cmdline

Allow reading the command line from a zimage, so that it can be recorded
in the bootflow.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agox86: Add a function to boot a zimage
Simon Glass [Wed, 12 Jul 2023 15:04:43 +0000 (09:04 -0600)] 
x86: Add a function to boot a zimage

Add a direct interface to booting a zimage, so that bootstd can call it
without going through the command-line interface.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Support automatically setting Linux parameters
Simon Glass [Wed, 12 Jul 2023 15:04:42 +0000 (09:04 -0600)] 
bootstd: Support automatically setting Linux parameters

Some Linux parameters can be set automatically by U-Boot, if it knows the
device being used. For example, since U-Boot knows the serial console
being used, it can add parameters for earlycon and console.

Add support for this.

Note that this is an experimental feature and we will see how useful it
turns out to be. It is very handy for ChromeOS, since otherwise it is very
difficult to manually determine the UART address or port number,
particularly in a script.

Provide an example of how this is used with ChromeOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: qemu: Switch to standard boot
Simon Glass [Wed, 12 Jul 2023 15:04:41 +0000 (09:04 -0600)] 
x86: qemu: Switch to standard boot

Drop use of the distro boot script and use standard boot instead.

Moving to a text-based environment would be desirable also, but requires
additional work.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: qemu: Create a little more room for U-Boot
Simon Glass [Wed, 12 Jul 2023 15:04:40 +0000 (09:04 -0600)] 
x86: qemu: Create a little more room for U-Boot

We want to enable some of the more interesting bootstd features. Move SPL
up to create some room for the larger U-Boot binary. Also disable
microcode since this is not needed

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Add support for updating elements of the cmdline
Simon Glass [Wed, 12 Jul 2023 15:04:39 +0000 (09:04 -0600)] 
bootstd: Add support for updating elements of the cmdline

Add a bootflow command to update the command line more easily. This allows
changing a particular parameter rather than editing a very long strings.
It is also easier to handle with scripting.

The new 'bootflow cmdline' command allows getting and setting single
parameters.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Add a function to update a command line
Simon Glass [Wed, 12 Jul 2023 15:04:38 +0000 (09:04 -0600)] 
bootstd: Add a function to update a command line

The Linux command line consists of a number of words with optional values.
At present U-Boot allows this to be changed using the bootargs environment
variable.

But this is quite painful, since the command line can be very long.

Add a function which can adjust a single field in the command line, so
that it is easier to make changes before booting.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobdinfo: Show information about the serial port
Simon Glass [Wed, 12 Jul 2023 15:04:37 +0000 (09:04 -0600)] 
bdinfo: Show information about the serial port

It is useful to see the detailed setting of the serial port, e.g. to
allow setting up earlycon or console for Linux. Add this output to the
'bdinfo' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in 20230716033929.253357-2-sjg@chromium.org]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
10 months agoMerge tag 'video-20230714' of https://source.denx.de/u-boot/custodians/u-boot-video
Tom Rini [Sun, 16 Jul 2023 20:31:18 +0000 (16:31 -0400)] 
Merge tag 'video-20230714' of https://source.denx.de/u-boot/custodians/u-boot-video

 - fix video console default font selection
 - add panel driver for HannStar HSD060BHW4
 - fix backlight pwm integer overflow in duty
   cycle calculation
 - fix dw_mipi_dsi hsync/vsync settings
 - various other fixes for rockchip dw_mipi_dsi

10 months agobootstd: Allow storing x86 setup information
Simon Glass [Wed, 12 Jul 2023 15:04:36 +0000 (09:04 -0600)] 
bootstd: Allow storing x86 setup information

On x86 boards Linux uses a block of binary data to provide information
about the command line, memory map, etc. Provide a way to store this in
the bootflow so it can be passed on to the OS.

No attempt is made to generalise the code, since other archs don't need
this information. The field is present always, though, to avoid needing
accessors or #ifdefs when building code on other archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Use the bootargs env var for changing the cmdline
Simon Glass [Wed, 12 Jul 2023 15:04:35 +0000 (09:04 -0600)] 
bootstd: Use the bootargs env var for changing the cmdline

The "bootargs" environment variable is used to set the command-line
arguments to pass to the OS. Use this same mechanism with bootstd as well.
When the variable is updated, it is written to the current bootflow. When
the current bootflow is updated, the environment variable is updated too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Allow storing the OS command line in the bootflow
Simon Glass [Wed, 12 Jul 2023 15:04:34 +0000 (09:04 -0600)] 
bootstd: Allow storing the OS command line in the bootflow

Some operating systems have a command line which can be adjusted before
booting. Store this in the bootflow so it can be controlled within
U-Boot.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Correct baudrate typo
Simon Glass [Wed, 12 Jul 2023 15:04:33 +0000 (09:04 -0600)] 
bootstd: Correct baudrate typo

This is a copy error. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Use bootdev instead of bootdevice
Simon Glass [Wed, 12 Jul 2023 15:04:32 +0000 (09:04 -0600)] 
bootstd: Use bootdev instead of bootdevice

It seems better to call this a 'bootdev' since this is name used in the
documentation. The older 'Bootdevice' name is no-longer used and may cause
confusion with the 'bootdevice' environment variable.

Update throughout to use bootdev.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agobootstd: Correct the name of the QEMU bootmeth
Simon Glass [Wed, 12 Jul 2023 15:04:31 +0000 (09:04 -0600)] 
bootstd: Correct the name of the QEMU bootmeth

This does not relate to sandbox. Correct the name.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agotest: Skip flat-tree tests if devicetree is not used
Simon Glass [Wed, 12 Jul 2023 15:04:30 +0000 (09:04 -0600)] 
test: Skip flat-tree tests if devicetree is not used

Many tests don't actually use the devicetree at all so there is no point
in running the tests both with livetree and flat tree. Check for this and
skip the flat tree test in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agoMerge tag 'efi-2023-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 15 Jul 2023 15:19:11 +0000 (11:19 -0400)] 
Merge tag 'efi-2023-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-10-rc1

Documentation:

* enhance UEFI anti-rollback documentation

EFI:

* Reconnect drivers if UninstallProtocol fails
* Prefer short device paths for boot options
* Fix error handling when updating boot options for block devices

10 months agodoc: uefi: enhance anti-rollback documentation
Masahisa Kojima [Thu, 22 Jun 2023 08:06:29 +0000 (17:06 +0900)] 
doc: uefi: enhance anti-rollback documentation

To enforce anti-rollback to any older version, dtb must be
always update manually. This should be described in the
documentation.

This commit also adds the recommendation that secure system should not
enable the fdt command because lowest-supported-version
property in device tree can be changed by fdt command.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
10 months agoREADME: remove Minicom comment
Heinrich Schuchardt [Sun, 25 Jun 2023 22:04:50 +0000 (00:04 +0200)] 
README: remove Minicom comment

The main README file is the wrong place to document how different terminal
emulations can be used to access the U-Boot serial console. C-Kermit which
requires a configuration file or several commands to access the U-Boot
console may not be the preferred choice for newcomers. The provided wiki
link is invalid.

The man-pages for loadb and loads already show how to use the commands with
picocom.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
10 months agoefi_selftests: add extra testcases on controller handling
Ilias Apalodimas [Tue, 20 Jun 2023 06:19:31 +0000 (09:19 +0300)] 
efi_selftests: add extra testcases on controller handling

We recently fixed a few issues wrt to controller handling.  Add a few
test cases to cover the new code.
- return EFI_DEVICE_ERROR the first time the protocol interface of
  the controller is uninstalled, after all the children have been
  disconnected.  This should make the drivers reconnect
- add tests to verify controllers are reconnected when uninstalling a
  protocol fails
- add tests to make sure EFI_NOT_FOUND is returned if a non existent
  interface is being removed

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
10 months agoefi_loader: fix the return codes of UninstallProtocol
Ilias Apalodimas [Tue, 20 Jun 2023 06:19:30 +0000 (09:19 +0300)] 
efi_loader: fix the return codes of UninstallProtocol

Up to now we did not check the return value of DisconnectController.
A previous patch is fixing that taking into account what happened during
the controller disconnect.  But that check takes place before our code
is trying to figure out if the interface exists to begin with.  In case a
driver is not allowed to unbind -- e.g returning EFI_DEVICE_ERROR, we
will end up returning that error instead of EFI_NOT_FOUND.

Add an extra check on the top of the function to make sure the protocol
interface exists before trying to disconnect any drivers

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
10 months agoefi_loader: check the status of disconnected drivers
Ilias Apalodimas [Tue, 20 Jun 2023 06:19:29 +0000 (09:19 +0300)] 
efi_loader: check the status of disconnected drivers

efi_uninstall_protocol() calls efi_disconnect_all_drivers() but never
checks the return value.  Instead it tries to identify protocols that
are still open after closing the ones that were opened with
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL, EFI_OPEN_PROTOCOL_GET_PROTOCOL
and EFI_OPEN_PROTOCOL_TEST_PROTOCOL.

Instead of doing that,  check the return value early and exit if
disconnecting the drivers failed.  Also reconnect all the drivers of
a handle if protocols are still found on the handle after disconnecting
controllers and closing the remaining protocols.

While at it fix a memory leak and properly free the opened protocol
information when closing a protocol.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
10 months agoefi_loader: reconnect drivers on failure
Ilias Apalodimas [Tue, 20 Jun 2023 06:19:28 +0000 (09:19 +0300)] 
efi_loader: reconnect drivers on failure

efi_disconnect_controller() doesn't reconnect drivers in case of
failure.  Reconnect the disconnected drivers properly

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
10 months agoLoad option with short device path for boot vars
Raymond Mao [Mon, 19 Jun 2023 21:23:01 +0000 (14:23 -0700)] 
Load option with short device path for boot vars

The boot variables automatically generated for removable medias
should be with short form of device path without device nodes.
This is a requirement for the case that a removable media is
plugged into a different port but is still able to work with the
existing boot variables.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
10 months agoFix incorrect return code of boot option update
Raymond Mao [Mon, 19 Jun 2023 21:22:59 +0000 (14:22 -0700)] 
Fix incorrect return code of boot option update

Correct the return code for out-of-memory and no boot option found

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
10 months agoMove bootorder and bootoption apis to lib
Raymond Mao [Mon, 19 Jun 2023 21:22:58 +0000 (14:22 -0700)] 
Move bootorder and bootoption apis to lib

Rename and move bootorder and bootoption apis from cmd to lib
for re-use between eficonfig and bootmgr
Fix 'unexpected indentation' when 'make htmldocs' after functions
are moved

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
10 months agoMerge branch '2023-07-14-assorted-general-updates'
Tom Rini [Fri, 14 Jul 2023 19:21:48 +0000 (15:21 -0400)] 
Merge branch '2023-07-14-assorted-general-updates'

- A number of assorted general fixes and code updates

10 months agopowerpc: Fix flush_cache() speed regression
Christophe Leroy [Wed, 5 Jul 2023 14:51:37 +0000 (16:51 +0200)] 
powerpc: Fix flush_cache() speed regression

Flushing kernel image after decompression was taking 113 milliseconds
with U-boot 2022.10. With U-boot 2023.01 and 2023.04, flushing
the same amount of memory takes approx 1.5 seconds. With
U-boot 2023.07-rc6, it takes 6.5 seconds.

powerpc flush_cache() function used to call WATCHDOG_RESET() after
flushing every cacheline. At that time WATCHDOG_RESET() was light
so the operation was almost seamless.

But commit 29caf9305b6 ("cyclic: Use schedule() instead of
WATCHDOG_RESET()") replaced WATCHDOG_RESET() by schedule() and that
started to hurt with U-boot 2022.10.

And in U-boot 2023.07-rc6 that's even worse after
commit 26e8ebcd7cb ("watchdog: mpc8xxx: Make it generic").

In the meantime commit 729c1fe656 ("powerpc: introduce
CONFIG_CACHE_FLUSH_WATCHDOG_THRESHOLD") gives us the opportinity to
only call schedule() every given chunk of data instead of every
cacheline. As explained in that commit there is no point in pinging
the watchdog after every cacheline flush, so lets define a sensible
default chunk size of 4k which matches to size of a page on most
powerpc platforms.

With that new default threshold, the culprit flushing performed after
kernel image decompression now takes 85 milliseconds on a powerpc 8xx.

Fixes: 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
10 months agolzma: Fix decompression speed regression
Christophe Leroy [Wed, 5 Jul 2023 08:34:26 +0000 (10:34 +0200)] 
lzma: Fix decompression speed regression

Uncompressing a 1.7Mbytes FIT image on U-boot 2023.04 takes
approx 7s on a powerpc 8xx.
The same on U-boot 2023.07-rc6 takes approx 28s unless watchdog
is disabled.

During that decompression, LzmaDec_DecodeReal() calls schedule
1.6 million times, that is every 4µs in average.

In the past it used to be a call to WATCHDOG_RESET() which was
just calling hw_watchdog_reset().

But the combination of commit 29caf9305b6 ("cyclic: Use schedule()
instead of WATCHDOG_RESET()") and commit 26e8ebcd7cb ("watchdog:
mpc8xxx: Make it generic") results in an heavier processing.

However, there is absolutely no point in calling schedule() that
often.

By moving and keeping only one call to schedule() in the main
loop the number of calls is reduced to 1.2 million which is still
too much. So add logic to only call schedule every 1024 times.
That leads to a call to schedule approx every 6ms which is still
far enough to entertain the watchdog which has a 1s timeout on
powerpc 8xx.

powerpc 8xx being one of the slowest targets we have today in
U-boot, and most other watchdogs having a timeout of one minutes
instead of one second like the 8xx, this fix should not have
negative impact on other targets.

Fixes: 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoufs: Use 'TASK_TAG' to construct the ucd_req_ptr->header.dword_0
Bhupesh Sharma [Sun, 2 Jul 2023 19:09:12 +0000 (00:39 +0530)] 
ufs: Use 'TASK_TAG' to construct the ucd_req_ptr->header.dword_0

Instead of using the hard-coded value of 0x1f, use 'TASK_TAG'
macro instead to construct the ucd_req_ptr->header.dword_0

This is in sync with what the Linux UFS driver does, i.e.
set the byte0 equal to TASK_TAG (see [1]).

Setting it to a fixed value of 0x1f is wrong as we define
TASK_TAG as 0 inside u-boot ufs framework. So, instead we
should  use the macro value directly.

[1]. https://github.com/torvalds/linux/blob/master/drivers/ufs/core/ufshcd.c#L2705

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
10 months agodrivers: led: bcm6753: do not use null label to find the top
Philippe Reynes [Thu, 29 Jun 2023 09:25:23 +0000 (11:25 +0200)] 
drivers: led: bcm6753: do not use null label to find the top

This driver considers that a node with an empty label is the top.
But the led class has changed, if a label is not provided for a led,
the label is filed with the node name. So we update this driver
to use a wrapper to manage the top led node.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
10 months agoboard_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set
Kunihiko Hayashi [Tue, 20 Jun 2023 10:50:48 +0000 (19:50 +0900)] 
board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agolib/zlib: Fix a bug when getting a gzip header extra field
Oleksandr Suvorov [Thu, 15 Jun 2023 14:54:34 +0000 (17:54 +0300)] 
lib/zlib: Fix a bug when getting a gzip header extra field

This fixes CVE-2022-37434 [1] and bases on 2 commits from Mark
Adler's zlib master repo - the original fix of CVE bug [2] and
the fix for the fix [3].

[1]
https://github.com/advisories/GHSA-cfmr-vrgj-vqwv
[2]
https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1
[3]
https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d

Fixes: e89516f031d ("zlib: split up to match original source tree")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
10 months agonet: ti: am65-cpsw-nuss: Use dedicated port mode control registers
Andreas Dannenberg [Wed, 14 Jun 2023 22:28:53 +0000 (17:28 -0500)] 
net: ti: am65-cpsw-nuss: Use dedicated port mode control registers

The different CPSW sub-system Ethernet ports have different PHY mode
control registers. In order to allow the modes to get configured
independently only the register for the port in question must be
accessed, otherwise we would just be re-configuring the mode for port 1,
while leaving all others at their power-on defaults. Fix this issue by
adding a port-number based offset to the mode control base register
address based on the fact that the control registers for the different
ports are spaced exactly 0x4 bytes apart.

Fixes: 9d0dca1199d1 ("net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver")
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>