Commit graph

2146 commits

Author SHA1 Message Date
Ben Dooks
b46cec4166 ubifs: allow loading to above 4GiB
The ubifsload command is truncating any address above 4GiB as it casts
this address to an u32, instead of using an unsigned long which most of
the other load commands do. Change this to an unsigned long to allow
loading into high memory for boards which use these areas.

Fixes the following error:

=> ubifsload 0x2100000000 /boot/Image.lzma
Loading file '/boot/Image.lzma' to addr 0x00000000...
Unhandled exception: Store/AMO access fault

Signed-off-by: Ben Dooks <ben.dooks@sifive.com>
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
2023-06-06 10:37:25 +02:00
Tom Rini
6e1852ca2c Pull request efi-2023-07-rc3
Documentation:
 
 * update the description of signature algorithms
 
 UEFI:
 
 * fix unaligned access to GUID in HII database protocol
 * fix launching EFI binaries loaded via semihosting
 * fix filling of file path in loaded image protocol for non-block devices
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmRjIuIACgkQxIHbvCwF
 GsQsZQ/9HijBls1e0WV58F01w3ky0NQoJRVi0ujMEzQuPBkJX1i718f1O+QxJF43
 dpHNiPkXvC9PHDHxBevyC0x0ptsqeNB5Tg5gpl3/M1Ko+23nP4ozhJ6TrtngJ50h
 P9aadOhVAUPH1c4/tIqVFNBI8DrRl8waQ9F8hnycJQ8kw76ye5YBYWwcHKVBwoyc
 1ZIt60M3pBsopQJEVbaoUOc223yYnaV2mLweihndUsRjAI8xO8FNBcyTnDtwazLj
 5F99AnZ1JWH5fYVI+M8ssfMS14SkmdGXH3drbcsQtiUs3k1pFHihBfQdYalfgB/9
 QYsPc7A84Nua+5SajNd6aSFuZCmCXU/4yaAWKIaoKVfGVgsGrRxbqvDuKz3ax4Gb
 jLHWt+mLnk8IrLYNG91QrlA7vUxEcurSUnvq3j69MRUSJWUlDj+bkyGBzWcsdB2K
 niliWo53CFCqRmVL9wf8kLEdaOMV8KJ1V7dxZvbbUa48HccfBXzxbSYnNm1//RYL
 M3jOmBYr0p//I6vLk2P8NWpPqyJUPgrcCHF7RGS8axfa24HMhj2ECJMiXlO8beUx
 CeVov+8GhuRKAcUyf6NaUcbQhyHCk5szEbBKqlH4rwLyuuumOdyB+4SP/WDs7n+x
 +JEqK4m6yfzlkJM9UBHM/yG88DwDhEszk8u22x5/oU9SbYsvTx8=
 =gJu0
 -----END PGP SIGNATURE-----

Merge tag 'efi-2023-07-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-07-rc3

Documentation:

* update the description of signature algorithms

UEFI:

* fix unaligned access to GUID in HII database protocol
* fix launching EFI binaries loaded via semihosting
* fix filling of file path in loaded image protocol for non-block devices
2023-05-16 11:23:30 -04:00
Simon Glass
c889434845 bootstd: Tidy up reporting of errors
In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-13 09:52:32 -04:00
Simon Glass
d8d40bc392 bootstd: Correct default boot command
The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9 ("bootstd: Provide a default command")
2023-05-13 09:52:32 -04:00
Simon Glass
9fea3a799d usb: Tidy up the usb_start flag
This should be declared in a header file so that type-checking works
correctly.

Add a single declaration to usb.h and remove the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-05-13 09:52:32 -04:00
Heinrich Schuchardt
c7c0ca3767 efi_loader: fix efi_dp_from_file()
* When called from efi_dp_from_name() we miss to append the filename
  for non-block devices.
* expand_media_path() could be simplified by using efi_dp_from_file to
  prepend the device path of the boot device.

This can be avoided by passing a device path to efi_dp_from_file() instead
of a block device descriptor and a partition number.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-05-13 11:09:51 +02:00
Simon Glass
2f5210b703 x86: coreboot: Show unimplemented sysinfo tags
Sometimes coreboot adds new tags that U-Boot does not know about. These
are silently ignored, but it is useful to at least know what we are
missing.

Add a way to collect this information. For Brya it shows:

   Unimpl. 38 41 37 34 42 40

These are:

   LB_TAG_PLATFORM_BLOB_VERSION
   LB_TAG_ACPI_CNVS
   LB_TAG_FMAP
   LB_TAG_VBOOT_WORKBUF
   LB_TAG_TYPE_C_INFO
   LB_TAG_BOARD_CONFIG

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2023-05-11 10:25:29 +08:00
Simon Glass
368fd56466 x86: coreboot: Collect the address of the ACPI tables
At present any ACPI tables created by prior-stage firmware are ignored.
It is useful to be able to view these in U-Boot.

Pick this up from the sysinfo tables and display it with the cbsysinfo
command. This allows the 'acpi list' command to work when booting from
coreboot.

Adjust the global_data condition so that acpi_start is available even if
table-generation is disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2023-05-11 10:25:29 +08:00
Simon Glass
37bf44073b acpi: Move the table-finding functions into the libary
This is useful for other features. Move the function into library code
so it can be used outside just the 'acpi' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2023-05-11 10:25:29 +08:00
Simon Glass
0992a90daa acpi: Create a new Kconfig for ACPI
We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-05-11 10:25:29 +08:00
Simon Glass
0fb19ffe30 mtrr: Don't show an invalid CPU number
When U-Boot did not do the MP init, we don't get an actual CPU number
here. Skip printing it in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-05-11 10:25:29 +08:00
Josua Mayer
fa0af90a0e cmd: tlv_eeprom: enable 'dev' subcommand before 'read'
Move the handler for "tlv_eeprom dev X" command to the beginning of
do_tlv_eeprom, to allow using it before issuing a "read" command for
currently selected eeprom.

Also remove the check if eeprom exists, since that can only work after
the first execution of read_eeprom triggered device lookup.
Instead accept values up to the defined array size (MAX_TLV_DEVICES).

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-05-08 10:47:13 +02:00
Josua Mayer
f6eff35b8c cmd: tlv_eeprom: handle -ENODEV error from read_eeprom function
When tlv eeprom does not exist, return error code instead of quietly
making up tlv structure in memory.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-05-08 10:47:11 +02:00
Josua Mayer
425d963dac cmd: tlv_eeprom: remove use of global variable has_been_read
has_been_read is only used as an optimization for do_tlv_eeprom.
Explicitly use and set inside this function, thus making read_eeprom
stateless.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-05-08 10:47:08 +02:00
Josua Mayer
dfda0c0140 cmd: tlv_eeprom: remove use of global variable current_dev
Make tlv_eeprom command device selection an explicit parameter of all
function calls.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-05-08 10:47:05 +02:00
Ehsan Mohandesi
6de98b60ba net: ipv6: Add support for default gateway discovery.
In IPv6, the default gateway and prefix length are determined by receiving
a router advertisement as defined in -
https://www.rfc-editor.org/rfc/rfc4861.

Add support for sending router solicitation (RS) and processing router
advertisements (RA).

If the RA has prefix info option and following conditions are met, then
gatewayip6 and net_prefix_length of ip6addr env variables are initialized.
These are later consumed by IPv6 code for non-local destination IP.

- "Router Lifetime" != 0
- Prefix is NOT link-local prefix (0xfe80::/10)
- L flag is 1
- "Valid Lifetime" != 0

Timing Parameters:
- MAX_RTR_SOLICITATION_DELAY (0-1s)
- RTR_SOLICITATION_INTERVAL (4s) (min retransmit delay)
- MAX_RTR_SOLICITATIONS (3 RS transmissions)

The functionality is enabled by CONFIG_IPV6_ROUTER_DISCOVERY and invoked
automatically from net_init_loop().

Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com>
Tested-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>Reviewed-by:
Tested-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Tested-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Sergei Antonov <saproj@gmail.com>
2023-05-05 17:58:52 -04:00
Dmitrii Merkurev
443d319180 net: add fastboot TCP support
Known limitations are
1. fastboot reboot doesn't work (answering OK but not rebooting)
2. flashing isn't supported (TCP transport only limitation)

The command syntax is
fastboot tcp

Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Сс: Joe Hershberger <joe.hershberger@ni.com>
Сс: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-05 17:48:44 -04:00
Sean Edmond
7d0188927b net: dhcp6: pxe: Add DHCP/PXE commands for IPv6
Adds commands to support DHCP and PXE with IPv6.

New configs added:
- CMD_DHCP6
- DHCP6_PXE_CLIENTARCH
- DHCP6_PXE_DHCP_OPTION
- DHCP6_ENTERPRISE_ID

New commands added (when IPv6 is enabled):
- dhcp6
- pxe get -ipv6
- pxe boot -ipv6

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-05-05 17:48:44 -04:00
Sean Edmond
5e541c48a7 net: ipv6: IPv6 environment variable cleanup
Fix "setenv gatewayip6".

Synchronize IPv6 local variables with environment variables
in netboot_update_env()

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
2023-05-05 13:41:55 -04:00
Tom Rini
ab75996ba4 - enable video support in SPL
- support splash screen for TI am62x
  - replace #ifdef and #if with if's in bmp/splash
  - add lm3533 backlight driver
  - add Solomon SSD2825 DSI/LVDS bridge driver
  - add Renesas R61307 and R69328 MIPI DSI panel drivers
  - add tegra DC based PWM backlight driver
  - add generic endeavoru (HTC One X) panel driver
 -----BEGIN PGP SIGNATURE-----
 
 iGwEABECACwWIQSC4hxrSoIUVfFO0kRM6ATMmsalXAUCZFS44Q4cYWd1c3RAZGVu
 eC5kZQAKCRBM6ATMmsalXPcDAJ9JjtVNvOUbS8mW51dHvmCYIP/tFwCfbfYTNVmq
 jvfn5+wAnkARJxcU6G8=
 =zXBt
 -----END PGP SIGNATURE-----

Merge tag 'video-for-v2023.07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-video

 - enable video support in SPL
 - support splash screen for TI am62x
 - replace #ifdef and #if with if's in bmp/splash
 - add lm3533 backlight driver
 - add Solomon SSD2825 DSI/LVDS bridge driver
 - add Renesas R61307 and R69328 MIPI DSI panel drivers
 - add tegra DC based PWM backlight driver
 - add generic endeavoru (HTC One X) panel driver
2023-05-05 09:36:08 -04:00
Marek Vasut
a76315052b cmd: bdinfo: Print ethaddr of current MAC
Instead of always printing ethaddr of MAC 0, print eth%daddr of the current MAC.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-03 18:30:46 -04:00
Marek Vasut
d8eb4e2c05 cmd: bdinfo: Wrap network information printing into print_eth()
Move all the network information printing into print_eth(),
no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-03 18:30:46 -04:00
Marek Vasut
55922ed5fa cmd: bdinfo: Map fdt_blob and new_fdt to sysmem
Map fdt_blob and new_fdt to sysmem, otherwise $fdtcontroladdr
and bdinfo output do not match and the bdinfo output address
is not a valid address accessible via sandbox memory accessors.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-03 18:30:46 -04:00
Heinrich Schuchardt
7e218c19c7 cmd: missing break in test_write_limit()
In test_write_limit() an unintended fall-through occurs.

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-05-02 14:09:19 +03:00
Tom Rini
e0dda26c2e bootflow: Rework do_bootflow_menu() slightly
When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
        printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
                                 ^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code.  Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28 11:30:17 -06:00
Simon Glass
80778f505c ide: Move ide_init() into probing
At present the code does ide_init() as a separate operation, then calls
device_probe() to copy over the information. We can call ide_init() from
probe just as easily.

The only difference is that using 'ide init' twice will do nothing.
However it already fails to copy over the new data in that case, so the
effect is the same. For now, unbind the block devices and remove the IDE
device, which causes the bus to be probed again. Later patches will fix
this up fully, so that all blk_desc data is copied across.

Since ide_reset() is only called from ide_init(), there is no need to init
the ide_dev_desc[] array. This is already done at the end of ide_init() so
drop this code.

The call to uclass_first_device() is now within the probe() function of
the same device, so does nothing. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27 13:51:06 -04:00
Simon Glass
f9fb57c691 bootstd: Show a message sometimes if no bootflows are found
Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
2023-04-26 08:43:04 -04:00
Nikhil M Jain
58182b2db9 cmd: bmp: Split bmp commands and functions
To enable splash screen at SPL, need to compile cmd/bmp.c which also
includes bmp commands, since SPL doesn't use commands split bmp.c into
common/bmp.c which includes all bmp functions and cmd/bmp.c which only
contains bmp commands.

Add function delclaration for bmp_info in video.h.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-24 21:37:45 +02:00
Pali Rohár
4548b37a29 cmd: mvebu/bubt: a38x: Do not hardcode SATA block size to 512
Find SATA block device by blk_get_devnum_by_uclass_id() function and read
from it the real block size of the SATA disk. In case of error, fallback
back to 512 bytes.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-04-13 11:34:47 +02:00
Pali Rohár
fbf368f176 cmd: mmc: Return CMD_RET_* from commands
Numeric return values may cause strange errors line:
exit not allowed from main input shell.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-10 12:18:45 +09:00
Pali Rohár
8b88206696 mmc: Use EXT_CSD_EXTRACT_BOOT_PART() macro for extracting boot part
Mask macro PART_ACCESS_MASK filter out access bits of emmc register and
macro EXT_CSD_EXTRACT_BOOT_PART() extracts boot part bits of emmc register.
So use EXT_CSD_EXTRACT_BOOT_PART() when extracting boot partition.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-10 12:18:17 +09:00
Heinrich Schuchardt
d9d07d751e cmd: consider multiplexing in coninfo
If console multiplexing in enabled (CONFIG_CONSOLE_MUX=y), the output of
the coninfo command should show the file association (stdin, stderr,
stdout) for all devices not only the default ones.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-08 07:50:43 +02:00
Simon Glass
a554ee7ede cmd: Add 2048 game
Add the 2048 game, a good demo of ANSI sequences and a way to waste a
little time.

Bring it it from Barebox, modified for code style.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-06 19:10:08 -04:00
Heinrich Schuchardt
fa3f0cbe13 cmd: CONFIG_CMD_SCSI depends on CONFIG_SCSI
Compiling with CONFIG_CMD_SCSI=y, CONFIG_SCSI results in

    cmd/scsi.c:46: undefined reference to `scsi_scan'

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-06 19:10:08 -04:00
Heinrich Schuchardt
16abdd42b3 cmd/regulator: missing fallthrough in do_dev()
Add missing fallthrough macro.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-06 19:10:08 -04:00
Heinrich Schuchardt
62d92d87f3 cmd: missing fallthrough macro in do_pci()
Add a missing fallthrough macro to avoid a -Wimplicit-fallthrough warning.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-06 19:10:08 -04:00
Heinrich Schuchardt
06a94b3e8b cmd: convert fallthrough comment.
gcc does not understand /* FALL TROUGH */ and emits a warning:

    cmd/date.c: In function ‘do_date’:
    cmd/date.c:62:20: warning:
    this statement may fall through [-Wimplicit-fallthrough=]
       62 |                 if (strcmp(argv[1],"reset") == 0) {
          |                    ^
    cmd/date.c:102:9: note: here
      102 |         case 1:                 /* get date & time */
          |         ^~~~

Use the fallthrough macro instead.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-06 19:10:08 -04:00
Tobias Waldekranz
bb56da117f cmd: blkmap: Add blkmap command
Add a frontend for the blkmap subsystem. In addition to the common
block device operations, this allows users to create and destroy
devices, and map in memory and slices of other block devices.

With that we support two primary use-cases:

- Being able to "distro boot" from a RAM disk. I.e., from an image
  where the kernel is stored in /boot of some filesystem supported
  by U-Boot.

- Accessing filesystems not located on exact partition boundaries,
  e.g. when a filesystem image is wrapped in an FIT image and stored
  in a disk partition.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-05 10:54:47 -04:00
Tobias Waldekranz
3d2fc79714 cmd: blk: Allow generic read/write operations to work in sandbox
Ensure that the memory destination/source addresses of block
read/write operations are mapped in before access. Currently, this is
only needed on sandbox builds.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-05 10:54:47 -04:00
Safae Ouajih
636da2039a android: boot: support boot image header version 3 and 4
Enable the support for boot image header version 3 and 4
using abootimg command.

In order to use version 3 or 4:

1- Vendor boot image address should be given to abootimg cmd.

	abootimg addr $1 $vendor_boot_load_addr

2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host
the ramdisk : generic ramdisk + vendor ramdisk

Replace "struct andr_boot_img_hdr_v0*" by "void *" in
some functions since v3 and v4 are now supported as well.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04 14:50:47 -04:00
Safae Ouajih
e058176be3 android: boot: add vendor boot image to prepare for v3, v4 support
Introduce vendor boot image for version 3 and 4 of boot image header.
The vendor boot image will hold extra information about kernel, dtb
and ramdisk.

This is done to prepare for boot image version 3 and 4 support.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04 14:50:47 -04:00
Safae Ouajih
607b07554e android: boot: move to andr_image_data structure
Move from andr_boot_img_hdr_v0 to andr_image_data
structure to prepare for boot image header
version 3 and 4.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04 14:50:46 -04:00
Safae Ouajih
734cb47d6d android: boot: replace android_image_check_header
With the new vendor boot image introduced in versions 3 and 4
of boot image header, the header check must be done for both boot
image and vendor boot image. Thus, replace android_image_check_header()
by is_android_boot_image_header() to only refer to boot image header check.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04 14:50:46 -04:00
Safae Ouajih
86b62947eb android: boot: support vendor boot image in abootimg
Vendor boot image is introduced in boot image header
version 3 and 4. Please check [1] for more details.

To prepare for boot image v3/v4 support, allow the abootimg command
to store the vendor_boot image address.

Full support for this new format will be done in a future patch.

Link:[1] https://source.android.com/docs/core/architecture/bootloader/partitions/vendor-boot-partitions

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04 14:50:46 -04:00
Safae Ouajih
d71a732af4 android: boot: rename andr_img_hdr -> andr_boot_img_hdr_v0
Android introduced boot header version 3 or 4.
The header structure change with version 3 and 4 to support
the new updates such as:
- Introducing Vendor boot image: with a vendor ramdisk
- Bootconfig feature (v4)

Change andr_img_hdr struct name to maintain support for version v0,
v1 and v2 while introducing version 3 and 4.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04 14:50:46 -04:00
Peter Hoyes
b4fae89c48 fdt: Make fdt addr -q quieter
64597346 "fdt: Add -q option to fdt addr for distro_bootcmd" introduced
the -q option for fdt addr, which sets the current working fdt address
without printing any output.

baf41410 "fdt: Show a message when the working FDT changes" made the
utility function set_working_fdt_addr (in cmd/fdt.c) output a message
on each invocation, even if called via fdt addr -q, in which case its
output is now slightly noisier.

To fix this, split out set_working_fdt_addr into set_working_fdt_addr
plus the static function set_working_fdt_addr_quiet.
set_working_fdt_addr_quiet can be called by "quiet" fdt cmd logic and
set_working_fdt_addr is exported (as before) to other boot logic. The
latter calls the former.

Remove the assertion from the fdt addr test case when calling with the
-q argument.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-03 06:53:53 +12:00
Marek Vasut
2fb74a1d13 cmd: fdt: Use env_set_hex() for "get addr" and "get size"
The 'fdt get addr' and 'env get size' is always assumed to be hex
value, drop the prefix, and outright switch to env_set_hex(). Since
this might break existing users who depend on the existing behavior
with 0x prefix, this is a separate patch.

Revert if this breaks anything.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-03 06:53:53 +12:00
Svyatoslav Ryhel
a57adacf50 cmd: ums: abort mounting by pressing any key
This patch introduses config which allows interrupt run of usb
mass storage with any key. This is especially useful on devices
with limited input capabilities like tablets and smatphones which
have only gpio keys in direct access.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-30 15:09:59 -04:00
Stephen Carlson
59b1c9be01 cmd: pci: Add command to set MPS of all PCIe devices
Enable tuning of the PCI Express MPS (Maximum Payload Size) of
each device. The Maximum Read Request Size is not altered.

The SAFE method uses the largest MPS value supported by all devices in the
system for each device. This method is the same algorithm as used by Linux
pci=pcie_bus_safe.

The PEER2PEER method sets all devices to the minimal (128 byte) MPS, which
allows hot plug of devices later that might only support the minimum size,
and ensures compatibility of DMA between two devices on the bus.

Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
2023-03-30 15:09:59 -04:00
Rasmus Villemoes
732b082547 nvedit: simplify do_env_indirect()
Instead of calling env_get(from) up to three times, just do it once,
computing the value we will put into 'to' and error out if that is
NULL (i.e. no 'from' variable and no default provided).

No functional change.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-30 15:09:59 -04:00