]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agox86: acpi_gpe: Update driver name to match devicetree
Simon Glass [Sun, 24 Jan 2021 17:06:02 +0000 (10:06 -0700)]
x86: acpi_gpe: Update driver name to match devicetree

Use a driver name in line with the compatible string so that of-platdata
can use this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoacpi: Tidy up documentation for struct acpi_gpio
Simon Glass [Sat, 23 Jan 2021 18:08:38 +0000 (11:08 -0700)]
acpi: Tidy up documentation for struct acpi_gpio

Some comments were provided after this patch was applied. Address them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: coral: Add a devicetree node for eMMC
Simon Glass [Thu, 14 Jan 2021 03:29:53 +0000 (20:29 -0700)]
x86: coral: Add a devicetree node for eMMC

Add a node for this so we can indicate that it is does not require any
ACPI code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tsc_timer: Correct overflow in __udelay()
Simon Glass [Thu, 14 Jan 2021 03:29:45 +0000 (20:29 -0700)]
x86: tsc_timer: Correct overflow in __udelay()

At present long delays such as msleep(2000) can cause an overflow in this
function. There is no need for this, since it already uses a 64-bit int.

Add a cast to correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agocmd: CMD_ACPI depends on ACPIGEN
Heinrich Schuchardt [Wed, 20 Jan 2021 20:37:56 +0000 (21:37 +0100)]
cmd: CMD_ACPI depends on ACPIGEN

Trying to compile qemu-x86_64_defconfig with CONFIG_CMD_ACPI=y and
CONFIG_ACPIGEN=n fails with

ld.bfd: cmd/built-in.o: in function `do_acpi_items':
cmd/acpi.c:162: undefined reference to `acpi_dump_items'

Add the missing configuration dependency.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 31 Jan 2021 19:24:35 +0000 (14:24 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- Assorted gadget changes including:
  - dfu: Fix handling of UBI partitions in MTD backend
  - gadget: f_thor: fix wrong file size cast
  - Extend cmd: bcb
  - Fixes for fastboot and rockchip gadgets
  - dfu: Add SCRIPT and SKIP entities
  - dfu/thor: Add `dfu_alt_info` reinitialization from flashed script
  - u-boot: Reduce size of u-boot as usbd_device_* arrays are not exported

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 31 Jan 2021 19:23:47 +0000 (14:23 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sh

- Sync r8a774a1 DT files, tmio sdhi DMA fix

3 years agoMerge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 31 Jan 2021 13:49:53 +0000 (08:49 -0500)]
Merge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

tpm fixes for coral
binman fixes support for symbols in sub-sections
support for additional cros_ec commands
various minor fixes / tweaks

3 years agousb: gaget: ci: set ep's desc when enable ep
Li Jun [Mon, 25 Jan 2021 13:44:00 +0000 (21:44 +0800)]
usb: gaget: ci: set ep's desc when enable ep

As we need standard usb_ep's desc, so set it when enable ep.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: fastboot: use correct max packet size
Li Jun [Mon, 25 Jan 2021 13:43:59 +0000 (21:43 +0800)]
usb: gadget: fastboot: use correct max packet size

Change to use wMaxPacketSize of current speed EP desc for request
length wrap up.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: udc: ci: update speed handling
Li Jun [Mon, 25 Jan 2021 13:43:58 +0000 (21:43 +0800)]
usb: udc: ci: update speed handling

Remove the gadget driver speed check, and set its max_speed to
be USB_SPEED_HIGH.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: composite: force gadget to be USB2 for HS only function
Li Jun [Mon, 25 Jan 2021 13:43:57 +0000 (21:43 +0800)]
usb: composite: force gadget to be USB2 for HS only function

If one of functions is not super speed capable, we need force the udc
to be high speed, this is an equivalent implementation of
usb_gadget_udc_set_speed() in kernel but simple, which set the gadget
max_speed to be high speed, so afterwards when start gadget duc can
set the HW to be USB 2.0 mode.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: dnl: set dnl to be super speed
Li Jun [Mon, 25 Jan 2021 13:43:56 +0000 (21:43 +0800)]
usb: gadget: dnl: set dnl to be super speed

Set its max_speed to be super speed.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: fastboot: add super speed support
Li Jun [Mon, 25 Jan 2021 13:43:55 +0000 (21:43 +0800)]
usb: fastboot: add super speed support

Add super speed EP config.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add super speed support
Li Jun [Mon, 25 Jan 2021 13:43:54 +0000 (21:43 +0800)]
usb: gadget: add super speed support

This patch is to add usb gadget super speed support in common
driver, including BOS descriptor and select the super speed
descriptor from function driver.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: update os_desc_config when add config
Jun Li [Mon, 25 Jan 2021 13:43:53 +0000 (21:43 +0800)]
usb: gadget: update os_desc_config when add config

Always use the new added config for os_desc_config to fix cdev->
os_desc_config may miss set in case we restart usb gadget driver.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: set correct usb_configuration for os_desc_config
Jun Li [Mon, 25 Jan 2021 13:43:52 +0000 (21:43 +0800)]
usb: gadget: set correct usb_configuration for os_desc_config

The current way to set cdev->os_desc_config is wrong if user restart
fastboot, as the old config is not used anymore and new allocated
usb_configuration will be used, so set the os_desc_config while
usb_add_config.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: fastboot: add ext properties for WCID
Li Jun [Mon, 25 Jan 2021 13:43:51 +0000 (21:43 +0800)]
usb: gadget: fastboot: add ext properties for WCID

Add device interface GUID for Microsoft Extended Properties Feature
Descriptor.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add WCID support for mfgtool
Li Jun [Mon, 25 Jan 2021 13:43:50 +0000 (21:43 +0800)]
usb: gadget: add WCID support for mfgtool

Enable WCID(Microsoft Compatible ID Feature Descriptor) for mfgtool.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: OS Feature Descriptors support
Li Jun [Mon, 25 Jan 2021 13:43:49 +0000 (21:43 +0800)]
usb: gadget: OS Feature Descriptors support

This is a proting patch from linux kernel: 37a3a533429e
("usb: gadget: OS Feature Descriptors support"), the original commit
log see below:

There is a custom (non-USB IF) extension to the USB standard:

http://msdn.microsoft.com/library/windows/hardware/gg463182

They grant permission to use the specification - there is
"Microsoft OS Descriptor Specification License Agreement"
under the link mentioned above, and its Section 2 "Grant
of License", letter (b) reads:

"Patent license. Microsoft hereby grants to You a nonexclusive,
royalty-free, nontransferable, worldwide license under Microsoft鈥檚
patents embodied solely within the Specification and that are owned
or licensable by Microsoft to make, use, import, offer to sell,
sell and distribute directly or indirectly to Your Licensees Your
Implementation. You may sublicense this patent license to Your
Licensees under the same terms and conditions."

The said extension is maintained by Microsoft for Microsoft.

Yet it is fairly common for various devices to use it, and a
popular proprietary operating system expects devices to provide
"OS descriptors", so Linux-based USB gadgets whishing to be able
to talk to a variety of operating systems should be able to provide
the "OS descriptors".

This patch adds optional support for gadgets whishing to expose
the so called "OS Feature Descriptors", that is "Extended Compatibility ID"
and "Extended Properties".

Hosts which do request "OS descriptors" from gadgets do so during
the enumeration phase and before the configuration is set with
SET_CONFIGURATION. What is more, those hosts never ask for configurations
at indices other than 0. Therefore, gadgets whishing to provide
"OS descriptors" must designate one configuration to be used with
this kind of hosts - this is what os_desc_config is added for in
struct usb_composite_dev. There is an additional advantage to it:
if a gadget provides "OS descriptors" and designates one configuration
to be used with such non-USB-compliant hosts it can invoke
"usb_add_config" in any order because the designated configuration
will be reported to be at index 0 anyway.

This patch also adds handling vendor-specific requests addressed
at device or interface and related to handling "OS descriptors"."

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add Kconfig for OS descriptors
Peng Fan [Mon, 25 Jan 2021 13:43:48 +0000 (21:43 +0800)]
usb: gadget: add Kconfig for OS descriptors

Add Kconfig for OS descriptors

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: move utf8_to_utf16le to header file
Li Jun [Mon, 25 Jan 2021 13:43:47 +0000 (21:43 +0800)]
usb: gadget: move utf8_to_utf16le to header file

As other users may use utf8_to_utf16le() to convert the utf8
to utf16 for usb, so move it to head file.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: OS String support
Li Jun [Mon, 25 Jan 2021 13:43:46 +0000 (21:43 +0800)]
usb: gadget: OS String support

This is a porting patch from linux kernel: 19824d5eeece
("usb: gadget: OS String support"), original commit log
see below:

"There is a custom (non-USB IF) extension to the USB standard:

http://msdn.microsoft.com/library/windows/hardware/gg463182

They grant permission to use the specification - there is
"Microsoft OS Descriptor Specification License Agreement"
under the link mentioned above, and its Section 2 "Grant
of License", letter (b) reads:

"Patent license. Microsoft hereby grants to You a nonexclusive,
royalty-free, nontransferable, worldwide license under Microsoft鈥檚
patents embodied solely within the Specification and that are owned
or licensable by Microsoft to make, use, import, offer to sell,
sell and distribute directly or indirectly to Your Licensees Your
Implementation. You may sublicense this patent license to Your
Licensees under the same terms and conditions."

The said extension is maintained by Microsoft for Microsoft.

Yet it is fairly common for various devices to use it, and a
popular proprietary operating system expects devices to provide
"OS descriptors", so Linux-based USB gadgets whishing to be able
to talk to a variety of operating systems should be able to provide
the "OS descriptors".

This patch adds optional support for gadgets whishing to expose
the so called "OS String" under index 0xEE of language 0.
The contents of the string is generated based on the qw_sign
array and b_vendor_code.

Interested gadgets need to set the cdev->use_os_string flag,
fill cdev->qw_sign with appropriate values and fill cdev->b_vendor_code
with a value of their choice.

This patch does not however implement responding to any vendor-specific
USB requests."

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: don't change ep name for dwc3 while ep autoconfig
Li Jun [Mon, 25 Jan 2021 13:43:45 +0000 (21:43 +0800)]
usb: gadget: don't change ep name for dwc3 while ep autoconfig

As the SDP protocol use the predefined ep num for communication, we can't
change its name hence reset its ep num while do ep autoconfig, this is
only apply for SPL.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: Add ep_config call back to usb_gadget_ops
Ye Li [Mon, 25 Jan 2021 13:43:44 +0000 (21:43 +0800)]
usb: gadget: Add ep_config call back to usb_gadget_ops

Since some new fields in usb_ep structure been moved to usb_ss_ep.
The CDNS3 gadget driver should replies on this operation to bind the
usb_ss_ep with the endpoint descriptor when function layer uses
usb_ep_autoconfig to add endpoint descriptors to gadget. So that
CDNS3 driver can know the EP information and configure the EP once
the set configuration request is received.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: Do not export usbd_device_* arrays
Pali Rohár [Sat, 26 Dec 2020 18:12:11 +0000 (19:12 +0100)]
usb: gadget: Do not export usbd_device_* arrays

Each array is used only in one file (core.c or ep0.c). Move their content
to correct file, mark them as static and do not export out of current file.

This change allows to decrease size of u-boot.bin as more of those strings
are not used.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agothor: add support for the dfu_alt_info reintialization from the flashed script
Marek Szyprowski [Tue, 22 Dec 2020 10:32:24 +0000 (11:32 +0100)]
thor: add support for the dfu_alt_info reintialization from the flashed script

Reinitialize dfu_env_entities after flashing the 'SCRIPT' entity to
ensure that the potential changes to the 'dfu_alt_info' environment
variable are applied.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: add support for the dfu_alt_info reintialization from the flashed script
Marek Szyprowski [Tue, 22 Dec 2020 10:32:23 +0000 (11:32 +0100)]
dfu: add support for the dfu_alt_info reintialization from the flashed script

Reinitialize DFU USB gadget after flashing the 'SCRIPT' entity to ensure
that the potential changes to the 'dfu_alt_info' environment variable are
applied.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[lukma - I've moved the bool retry to avoid build (CI) errors]

3 years agodfu: add 'SCRIPT' entity
Marek Szyprowski [Tue, 22 Dec 2020 10:32:22 +0000 (11:32 +0100)]
dfu: add 'SCRIPT' entity

Define a new 'SCRIPT' type for DFU entities. The downloaded data are
treated as simple u-boot's scripts and executed with run_command_list()
function.

Flashing the 'SCRIPT' entity might result in changing the 'dfu_alt_info'
environment variable from the flashed script, so add a global variable
for tracking the potential need to reinitialize the dfu_alt_info related
structures.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: add 'SKIP' entity
Jaehoon Chung [Tue, 22 Dec 2020 10:32:21 +0000 (11:32 +0100)]
dfu: add 'SKIP' entity

Define a new 'SKIP' type for the DFU entities. The flashed data for that
entity is simply ignored without returning any error values.

This allows to have one flashing procedure and images for the different
board types or variants, where each board uses only the images relevant
to it and skips the rest. This is especially usefull for the THOR
protocol, which usually transfers more than one file in a single session.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
[mszyprow: rephrased commit message and docs for easier reading, changed
   subject to "dfu: add 'SKIP' entity"]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: mmc: use the default MMC device if entity specifies it as -1
Marek Szyprowski [Tue, 22 Dec 2020 10:32:20 +0000 (11:32 +0100)]
dfu: mmc: use the default MMC device if entity specifies it as -1

Use the default MMC device set in the command line if entity specifies it
as -1. This allows to use the same dfu_alt_info string for different MMC
devices (like embedded eMMC and external SD card if data layout is the
same on both devices).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agocmd: usb_mass_storage: show device interface name
Marek Szyprowski [Thu, 17 Dec 2020 10:47:11 +0000 (11:47 +0100)]
cmd: usb_mass_storage: show device interface name

Show the interface name (i.e. 'mmc') in the information string to ease
user checking which device is exported via USB Mass Storage protocol.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agof_fastboot: Avoid use-after-free in the global pointer variable
Andy Shevchenko [Thu, 3 Dec 2020 15:32:05 +0000 (17:32 +0200)]
f_fastboot: Avoid use-after-free in the global pointer variable

In case of usb_add_function() failure the error path has an issue,
i.e the global pointer variable is assigned to garbage

Fix the above mentioned issue by assigning pointer to NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agof_rockusb: Avoid use-after-free in the global pointer variable
Andy Shevchenko [Thu, 3 Dec 2020 15:32:04 +0000 (17:32 +0200)]
f_rockusb: Avoid use-after-free in the global pointer variable

In case of usb_add_function() failure the error path has two issues:
 - the potentially allocated structure isn't getting freed
 - the global pointer variable is assigned to garbage

Fix the above mentioned issues by freeing memory and assigning NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agof_rockusb: Use NULL instead of 0 for pointers
Andy Shevchenko [Thu, 3 Dec 2020 15:32:03 +0000 (17:32 +0200)]
f_rockusb: Use NULL instead of 0 for pointers

get_rkusb() mistakenly uses integers without cast.
Convert them to proper type.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agocmd: bcb: Add support for processing const string literals in bcb_set()
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:23 +0000 (11:52 +0300)]
cmd: bcb: Add support for processing const string literals in bcb_set()

On request/suggestion from Simon Glass back in May 22 2019 [1], the
'strsep' mechanism implemented in bcb_set() was set to work directly
with user-provided argv strings, to avoid duplicating memory and for
the sake of simpler implementation.

However, since we recently exposed bcb_write_reboot_reason() API to be
called by U-Boot fastboot, the idea is to be able to pass const string
literals to this new BCB API, carrying the reboot reason.

Since 'strsep' (just like its older/superseded sibling 'strtok')
modifies the input string passed as parameter, BCB command in its
current state would attempt to perform in-place modifications in a
readonly string, which might lead to unexpected results.

Fix the above with the cost of one dynamic memory allocation ('strdup').
This will also ensure no compiler warnings when passing string literals
to bcb_write_reboot_reason().

[1] http://u-boot.10912.n7.nabble.com/PATCH-v2-0-2-Add-bcb-command-to-read-modify-write-Android-BCB-td369934i20.html#a370456

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Expose 'bcb_write_reboot_reason' to external callers
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:22 +0000 (11:52 +0300)]
cmd: bcb: Expose 'bcb_write_reboot_reason' to external callers

Fastboot is evolving and beginning with commit [1], the
upstream implementation expects bootloaders to offer support for:
 - reboot-recovery
 - reboot-fastboot

The most natural way to achieve the above is through a set of
pre-defined "reboot reason" strings, written into / read from
the BCB "command" field, e.g.:
 - bootonce-bootloader [2]
 - boot-fastboot [3]
 - boot-recovery [4]

Expose the first 'bcb' API meant to be called by e.g. fastboot stack,
to allow updating the BCB reboot reason via the BCB 'command' field.

[1] https://android.googlesource.com/platform/system/core/+/dea91b4b5354af2
    ("Add fastbootd.")
[2] https://android.googlesource.com/platform/bootable/recovery/+/cba7fa88d8b9
    ("Add 'reboot bootloader' to bootloader_message.")
[3] https://android.googlesource.com/platform/bootable/recovery/+/eee4e260f9f6
    ("recovery: Add "boot-fastboot" command to BCB.")
[4] https://android.googlesource.com/platform/system/core/+/5e98b633a748695f
    ("init: Write the reason in BCB on "reboot recovery"")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
[lukma - added missing #include <linux/errno.h> to avoid build breaks]

3 years agocmd: bcb: Extract '__bcb_store' from 'do_bcb_store' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:21 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_store' from 'do_bcb_store' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This third patch makes '__bcb_store' available for internal needs.

No functional change intended.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Extract '__bcb_set' from 'do_bcb_set' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:20 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_set' from 'do_bcb_set' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This second patch makes '__bcb_set' available for internal needs.

No functional change intended.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Extract '__bcb_load' from 'do_bcb_load' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:19 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_load' from 'do_bcb_load' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This first patch makes '__bcb_load' available for internal needs.

No functional change, except for a tiny update in error handling.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agogadget: f_thor: fix wrong file size cast
Seung-Woo Kim [Fri, 16 Oct 2020 07:29:02 +0000 (16:29 +0900)]
gadget: f_thor: fix wrong file size cast

Casting 32bit int value directly into 64bit unsigned type causes
wrong value for file size equal or larger than 2GB. Fix the wrong
file size by casting uint32_t first.

Fixes: commit 1fe9ae76b113 ("gadget: f_thor: update to support more than 4GB file as thor 5.0")
Reported-by: Junghoon Kim <jhoon20.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodfu: Fix handling of UBI partitions in MTD backend
Guillermo Rodriguez [Wed, 2 Sep 2020 11:06:06 +0000 (13:06 +0200)]
dfu: Fix handling of UBI partitions in MTD backend

For UBI partitions ("partubi" in dfu_alt_info), dfu_fill_entity_mtd sets
the mtd.ubi flag; however other functions incorrectly check for nand.ubi
instead. Fix this by checking for the correct flag.

Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agommc: tmio: sdhi: Configure internal DMA bus width
Marek Vasut [Sun, 3 Jan 2021 10:38:25 +0000 (11:38 +0100)]
mmc: tmio: sdhi: Configure internal DMA bus width

The R-Car3 SDHI should set these two bits in DMA_MODE register according
to the specification, to indicate 64bit bus width. No other bus width
options are permitted and the default value is 0, which is incorrect.
Set the bits accordingly.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
3 years agoarm: dts: rmobile: r8a774a1: Synchronize DTs with Linux 5.10
Biju Das [Sun, 17 Jan 2021 16:30:11 +0000 (16:30 +0000)]
arm: dts: rmobile: r8a774a1: Synchronize DTs with Linux 5.10

DTS files apart from r8a774a1-hihope-rzg2m-u-boot.dts and
r8a774a1-u-boot.dtsi have been imported from linux 5.10
commit 2c85ebc57b3e1817 ("Linux 5.10").

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agodisk: part: sandbox support in dev_print()
Heinrich Schuchardt [Mon, 25 Jan 2021 11:57:15 +0000 (12:57 +0100)]
disk: part: sandbox support in dev_print()

Commands like 'fatinfo' call dev_print() to print device information. If
the block device is created via 'host bind', we should print accurate
information.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agosandbox: fill block device meta information
Heinrich Schuchardt [Mon, 25 Jan 2021 11:57:14 +0000 (12:57 +0100)]
sandbox: fill block device meta information

Provide information about host backed block device.

Mark the device created by 'host bind' as removable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodm: replace auto_alloc_size with auto
Dario Binacchi [Sat, 23 Jan 2021 18:48:57 +0000 (19:48 +0100)]
dm: replace auto_alloc_size with auto

The auto_alloc_size members of struct driver has been renamed auto.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodo not pass NULL pointer to libfdt
Stanislav Pinchuk [Wed, 20 Jan 2021 18:52:23 +0000 (21:52 +0300)]
do not pass NULL pointer to libfdt

Re-send because of line-wraps.

Without this patch, u-boot just hangs if the fdt pointer is
not initialized. The diagnostic subsystems are not yet initialized,
so all you get is a blind hang.

Signed-off-by: Stanislav.Pinchuk@kaspersky.com
3 years agosandbox: keep time offset when resetting
Heinrich Schuchardt [Wed, 30 Dec 2020 17:07:48 +0000 (18:07 +0100)]
sandbox: keep time offset when resetting

The UEFI Self Certification Test (SCT) checks the SetTime() service with
the following steps:

* set date
* reset
* check date matches

To be compliant the sandbox should keep the offset to the host RTC during
resets. The implementation uses the environment variable
UBOOT_SB_TIME_OFFSET to persist the offset.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Print a debug message when binman selects a node
Simon Glass [Thu, 21 Jan 2021 20:57:16 +0000 (13:57 -0700)]
binman: Print a debug message when binman selects a node

Add some debugging to indicate which node the binman library is looking
at.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoAdd a symlink for ctype.h
Simon Glass [Thu, 21 Jan 2021 20:57:15 +0000 (13:57 -0700)]
Add a symlink for ctype.h

Libraries that link with U-Boot typically may expect to be able to include
ctype.h but this file is in a different place in U-Boot. Add a symlink to
make this work.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Update ofnode_read_fmap_entry() to read hashes
Simon Glass [Thu, 21 Jan 2021 20:57:14 +0000 (13:57 -0700)]
dm: core: Update ofnode_read_fmap_entry() to read hashes

At present this function uses the old format for reading hashes. Add
support for the current format.

Add a test while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add a comment about pinctrl_select_state()
Simon Glass [Thu, 21 Jan 2021 20:57:13 +0000 (13:57 -0700)]
dm: core: Add a comment about pinctrl_select_state()

The use of pinctrl in the core of driver model is useful but can provoke
some strange behaviour. Add a comment to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoclk: x86: Correct the driver name
Simon Glass [Thu, 21 Jan 2021 20:57:12 +0000 (13:57 -0700)]
clk: x86: Correct the driver name

The current driver name does not match its compatible string, so
of-platdata does not work correctly. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoclk: Add debugging for return values
Simon Glass [Thu, 21 Jan 2021 20:57:11 +0000 (13:57 -0700)]
clk: Add debugging for return values

Use the log_msg_ret() mechanism to get error-return information when
clocks fail to probe, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Don't inline dev_read...() calls with of-platdata
Simon Glass [Thu, 21 Jan 2021 20:57:10 +0000 (13:57 -0700)]
dm: core: Don't inline dev_read...() calls with of-platdata

At present if these calls are used with of-platdata, a confusing error is
produced, referring to a function not actually called by the code causing
the problem.

Fix this by not inlining, so that the error mentions the dev_read_...()
function and it is more obvious what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Disable I2C emulators in SPL
Simon Glass [Thu, 21 Jan 2021 20:57:09 +0000 (13:57 -0700)]
sandbox: Disable I2C emulators in SPL

These cannot work with of-platdata since they currently need the
devicetree at runtime. Disable the emulators and the sandbox I2C driver
that needs them. We can enable these later, if needed for testing.

Switch the of_plat_parent test over to use a simple bus instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoi2c: desigware: Add an alias for Intel Apollo Lake
Simon Glass [Thu, 21 Jan 2021 20:57:08 +0000 (13:57 -0700)]
i2c: desigware: Add an alias for Intel Apollo Lake

Add an alias so that this driver can be used in TPL on coral.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agox86: coral: Support TPM and RTC in SPL
Simon Glass [Thu, 21 Jan 2021 20:57:07 +0000 (13:57 -0700)]
x86: coral: Support TPM and RTC in SPL

Update the devicetree so that the TPM and RTC can be used in SPL. Also
enable the pins used for getting the memory configuration settings while
we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospl: Tidy up SPL/TPL malloc sizes
Simon Glass [Thu, 21 Jan 2021 20:57:06 +0000 (13:57 -0700)]
spl: Tidy up SPL/TPL malloc sizes

The current help talks about relocation which doesn't apply to SPL and
TPL. Update it to avoid confusion.

Also make the TPL size default to the same as the SPL size, since this is
more likely to be a useful value than the one used by U-Boot proper, which
may be quite a bit larger.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add vstore support
Simon Glass [Sat, 16 Jan 2021 21:52:31 +0000 (14:52 -0700)]
cros_ec: Add vstore support

The EC can store small amounts of data for the benefit of the
verified boot process. Since the EC is seldom reset, this can allow the
AP to store data that survives a reboot or a suspend/resume cycle.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Allow use with of-platdata
Simon Glass [Sat, 16 Jan 2021 21:52:30 +0000 (14:52 -0700)]
cros_ec: Allow use with of-platdata

Avoid reading the device tree when of-platdata is in use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Show events in human-readable form
Simon Glass [Sat, 16 Jan 2021 21:52:29 +0000 (14:52 -0700)]
cros_ec: Show events in human-readable form

Add a command to show the current events as a list of names. This is
easier to decipher than a bit mask.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add support for switches
Simon Glass [Sat, 16 Jan 2021 21:52:28 +0000 (14:52 -0700)]
cros_ec: Add support for switches

On x86 platforms the EC provides a way to read 'switches', which are
on/off values determined by the EC.

Add a new driver method for this and implement it for LPC.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add documentation for cros_ec driver operations
Simon Glass [Sat, 16 Jan 2021 21:52:27 +0000 (14:52 -0700)]
cros_ec: Add documentation for cros_ec driver operations

Add comments to these methods so it is documented in this central place,
not just in each driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Support reading EC features
Simon Glass [Sat, 16 Jan 2021 21:52:26 +0000 (14:52 -0700)]
cros_ec: Support reading EC features

The EC can support a variety of features and provides a way to find out
what is available. Add support for this.

Also update the feature list to the lastest available while we are here.
This is at:

   https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/include/ec_commands.h

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add support for reading the SKU ID
Simon Glass [Sat, 16 Jan 2021 21:52:25 +0000 (14:52 -0700)]
cros_ec: Add support for reading the SKU ID

This allows reading strapping pins attached to the EC. Add an
implementation for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add run-time check for input buffer overflow
Simon Glass [Sat, 16 Jan 2021 21:52:24 +0000 (14:52 -0700)]
cros_ec: Add run-time check for input buffer overflow

This should not happen in normal operation, but the EC might have a bug,
so add a run-time check just in case.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Tidy up a few delays
Simon Glass [Sat, 16 Jan 2021 21:52:23 +0000 (14:52 -0700)]
cros_ec: Tidy up a few delays

Allow a longer time for the EC to reboot. Also use a constant for the
hash delay time, so it is clear what it is for.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add a function for the hello message
Simon Glass [Sat, 16 Jan 2021 21:52:22 +0000 (14:52 -0700)]
cros_ec: Add a function for the hello message

This is used several times in this file. Put it in a function to avoid
code duplication.

Also add a test for this function. There are no cros_ec tests at present,
so it is time to update the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodoc/sandbox: improve formatting of command line options
Heinrich Schuchardt [Wed, 30 Dec 2020 17:10:24 +0000 (18:10 +0100)]
doc/sandbox: improve formatting of command line options

Show the command line options in bold.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: fix sandbox_cmdline_cb_test_fdt()
Heinrich Schuchardt [Fri, 25 Dec 2020 15:04:26 +0000 (16:04 +0100)]
sandbox: fix sandbox_cmdline_cb_test_fdt()

fmt does not foresee any parameter.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agox86: typo segement
Heinrich Schuchardt [Tue, 22 Dec 2020 06:53:03 +0000 (07:53 +0100)]
x86: typo segement

%s/segement/segment/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agobinman: Allow for skip_at_start when reading entries
Simon Glass [Thu, 7 Jan 2021 04:35:19 +0000 (21:35 -0700)]
binman: Allow for skip_at_start when reading entries

The offset of an entry needs to be adjusted by its skip-at-start value.
This is currently missing when reading entry data. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support alignment of files
Simon Glass [Thu, 7 Jan 2021 04:35:18 +0000 (21:35 -0700)]
binman: Support alignment of files

When packing files it is sometimes useful to align the start of each file,
e.g. if the flash driver can only access 32-bit-aligned data. Provides a
new property to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Allow vblock to include devicetree blobs
Simon Glass [Thu, 7 Jan 2021 04:35:17 +0000 (21:35 -0700)]
binman: Allow vblock to include devicetree blobs

At present if a devicetree blob is included in a vblock it does not deal
with updates. This is because the vblock is created once at the start and
does not have a method to update itself later, after all the entry
contents are finalised.

Fix this by adjusting how the vblock is created.

Also simplify Image.ProcessEntryContents() since it effectively duplicates
the code in Section.ProcessContents().

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support reading an image with entry args
Simon Glass [Thu, 7 Jan 2021 04:35:16 +0000 (21:35 -0700)]
binman: Support reading an image with entry args

Normally when an entry is created, any entry arguments it has are required
to be provided, so it can actually generate its contents correctly.

However when an existing image is read, Entry objects are created for each
of the entries in the image. This happens as part of the process of
reading the image into binman.

In this case we don't need the entry arguments, since we do not intend to
regenerate the entries, or at least not unless requested. So there is no
sense in reporting an error for missing entry arguments.

Add a new property for the Image to handle this case. Update the error
reporting to be conditional on this property.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support finding symbols in sub-sections
Simon Glass [Thu, 7 Jan 2021 04:35:15 +0000 (21:35 -0700)]
binman: Support finding symbols in sub-sections

At present binman only supports resolving symbols in the same section as
the binary that uses it. This is quite limited because we often need to
group entries into different sections.

Enhance the algorithm to search the entire image for symbols.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Fix a few file comments
Simon Glass [Thu, 7 Jan 2021 04:35:14 +0000 (21:35 -0700)]
binman: Fix a few file comments

Two files have the wrong comment at the top of them. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Show the size when writing entries
Simon Glass [Thu, 7 Jan 2021 04:35:13 +0000 (21:35 -0700)]
binman: Show the size when writing entries

Update the log output to show the size, since this is useful information.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Update the TODO list
Simon Glass [Thu, 7 Jan 2021 04:35:12 +0000 (21:35 -0700)]
binman: Update the TODO list

Two of the items have been completed and I thought of another one. Update
the list.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Correct lz4 compression parameters
Simon Glass [Thu, 7 Jan 2021 04:35:11 +0000 (21:35 -0700)]
patman: Correct lz4 compression parameters

At present on large files, lz4 uses a larger block size (e.g. 256KB) than
the 64KB supported by the U-Boot decompression implementation. Also it is
optimised for maximum compression speed, producing larger output than we
would like.

Update the parameters to correct these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: binman: Drop Python 2 code
Simon Glass [Thu, 7 Jan 2021 04:35:10 +0000 (21:35 -0700)]
dtoc: binman: Drop Python 2 code

Drop a few more Python 2 relics that are no-longer needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: coral: Enable CONFIG_BOOTARGS_SUBST
Simon Glass [Thu, 31 Dec 2020 16:52:16 +0000 (09:52 -0700)]
x86: coral: Enable CONFIG_BOOTARGS_SUBST

Enable this option so that the boot-script substitutions of %U works as
expected. With this, it can boot into Chrome OS.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: coral: Update an unused pin to reduce power
Simon Glass [Thu, 31 Dec 2020 16:52:15 +0000 (09:52 -0700)]
x86: coral: Update an unused pin to reduce power

GPIO_25 is not used on coral, so set it up in deep sleep.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotpm: cr50: Rename driver to work with of-platdata
Simon Glass [Thu, 31 Dec 2020 16:52:14 +0000 (09:52 -0700)]
tpm: cr50: Rename driver to work with of-platdata

Update the driver name to match the compatible string, so it can work
with of-platdata.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotpm: cr50: Add a better description and more debug
Simon Glass [Thu, 31 Dec 2020 16:52:13 +0000 (09:52 -0700)]
tpm: cr50: Add a better description and more debug

Update the TPM description to include the interrupt mechanicm since this
is useful to know. Also add a warning if the TPM cannot be found and a
debug line if it succeeds.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotpm: cr50: Check for valid locality
Simon Glass [Thu, 31 Dec 2020 16:52:12 +0000 (09:52 -0700)]
tpm: cr50: Check for valid locality

When the Cr50 starts up it doesn't have a valid locality. The driver sets
it to -1 to indicate that. Tracking this allows cr50_i2c_cleanup() to
avoid releasing a locality that was not claimed.

However the helper functions that generate the flags use a u8 type which
cannot support -1, so they return a locality of 0xff.

Fix this by updating the type. With this, 'tpm startup TPM2_SU_CLEAR'
works as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'efi-2021-04-rc1-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 30 Jan 2021 19:49:17 +0000 (14:49 -0500)]
Merge tag 'efi-2021-04-rc1-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-04-rc1-4

Bug fixes:

* re-read the partition table after writing GPT
* fix a problem booting ARMv7 boards with PSCI without UEFI
* make aarch64 UEFI test programs compatible with GRUB linux command
* correct the alignment check in the EFI_BLOCK_IO_PROTOCOL
* check EFI_BLOCK_IO_PROTOCOL.Media->LastBlock in unit test

3 years agoefi_loader: add Linux magic to aarch64 crt0
Heinrich Schuchardt [Fri, 29 Jan 2021 11:35:51 +0000 (12:35 +0100)]
efi_loader: add Linux magic to aarch64 crt0

Add the Linux magic to the EFI file header to allow running our test
programs with GRUB's linux command. Now we can dump the fixed-up device
tree with our dtbdump.efi tool.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotools: add mkeficapsule to .gitignore
Heinrich Schuchardt [Thu, 28 Jan 2021 21:46:13 +0000 (22:46 +0100)]
tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodisk: part_efi: update partition table entries after write
Gary Bisson [Tue, 26 Jan 2021 13:56:23 +0000 (14:56 +0100)]
disk: part_efi: update partition table entries after write

Fixes fastboot issues when switching from mbr to gpt partition tables.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: switch to non-secure mode later
Heinrich Schuchardt [Sun, 24 Jan 2021 14:34:12 +0000 (14:34 +0000)]
efi_loader: switch to non-secure mode later

Some ARMv7 boards using PSCI require to be in secure-mode when booted via
'bootz' or 'bootm'. During distro-boot 'bootefi bootmgr' is called to check
if booting via UEFI is possible.

With the change we change the switch from secure mode to non-secure mode is
moved from the UEFI subsystem setup to just before calling StartImage().

Cc: Jernej Škrabec <jernej.skrabec@gmail.com>
Reported by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: correct block IO alignment check
Heinrich Schuchardt [Sat, 23 Jan 2021 18:33:11 +0000 (19:33 +0100)]
efi_loader: correct block IO alignment check

If the field Media->IoAlign of the EFI block IO protocol is zero, no
alignment is required. Our code required 4 GiB alignment in this case.

Don't check buffer alignment if Media->IoAlign == 0.

Fixes: f59f0825e8b9 ("efi_loader: parameter checks BLOCK_IO_PROTOCOL")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: test EFI_BLOCK_IO_PROTOCOL.Media->LastBlock
Heinrich Schuchardt [Sat, 23 Jan 2021 18:08:04 +0000 (19:08 +0100)]
efi_selftest: test EFI_BLOCK_IO_PROTOCOL.Media->LastBlock

The field Media->LastBlock of the EFI_BLOCK_IO_PROTOCOL must be filled
with the index of the last logical block (LBA) for the block device that
our test driver provides.

After calling ConnectController() U-Boot exposes the block IO protocol for
the partition check that the value of Media->LastBlock equals the partition
size minus one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 29 Jan 2021 18:56:04 +0000 (13:56 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-29-assorted-fixes'
Tom Rini [Fri, 29 Jan 2021 18:50:06 +0000 (13:50 -0500)]
Merge branch '2021-01-29-assorted-fixes'

- Assorted test fixes
- Assorted minor FAT fixes
- Assorted Kconfig dependency fixes
- MediaTek, vexpress_aemv8a improvements
- Other assorted minor fixes

3 years agocmd: add more implementation IDs to sbi command
Heinrich Schuchardt [Tue, 19 Jan 2021 19:44:45 +0000 (19:44 +0000)]
cmd: add more implementation IDs to sbi command

Additional SBI implementation IDs have been added to the upcoming
next version of the SBI specification.

https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotest: inconsistent string tests
Heinrich Schuchardt [Sun, 17 Jan 2021 23:17:34 +0000 (00:17 +0100)]
test: inconsistent string tests

Excluding ut str in test/cmd_ut.c but compiling test/str_ut.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_str_upper]

Allow to compile test/str_ut.c on all boards.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: inconsistent bootm tests
Heinrich Schuchardt [Sun, 17 Jan 2021 23:17:33 +0000 (00:17 +0100)]
test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>