Vignesh Raghavendra [Fri, 21 Jan 2022 07:17:52 +0000 (12:47 +0530)]
ARM: dts: k3-am642-sk: Disable cpsw_port1 in SPL
ROM supports cpsw_port2 for Ethernet boot and SPL stages continue to
download images on the same port, therefore there is no need to enable
cpsw_port1. Disable the same.
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Vignesh Raghavendra [Fri, 21 Jan 2022 07:17:51 +0000 (12:47 +0530)]
net: ti: am65-cpsw-nuss: Fix err msg for port bind failures
Replace error case print with meaning full message.
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Jamin Lin [Wed, 19 Jan 2022 08:23:21 +0000 (16:23 +0800)]
rsa: adds rsa3072 algorithm
Add to support rsa 3072 bits algorithm in tools
for image sign at host side and adds rsa 3072 bits
verification in the image binary.
Add test case in vboot for sha384 with rsa3072 algorithm testing.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Heinrich Schuchardt [Wed, 19 Jan 2022 00:33:43 +0000 (01:33 +0100)]
bootcount: fix printf() code
For printing phys_addr_t we should use %pa to avoid warning like:
drivers/bootcount/bootcount_syscon.c:110:17: note: in expansion of macro ‘dev_err’
110 | dev_err(dev, "%s: Unsupported register size: %d\n", __func__,
| ^~~~~~~
seen for sandbox_defconfig with CONFIG_PHYS_64BIT=y.
Cf. commit
1eebd14b7902 ("vsprintf: Add modifier for phys_addr_t")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Patrick Delaunay [Tue, 18 Jan 2022 09:26:21 +0000 (10:26 +0100)]
dfu: mtd: skip empty pages when writing page for UBI partition
Align the DFU MTD backend for the UBI partitions with the mtd command write
behavior when the option .dontskipff is not used: don't write the empty
pages (full of 0xFF); it is not required for UBI, see [1] for details.
This patch avoids the "free space fixup" procedure in the kernel [2]
and allows to program a UBIFS volume generated by mkfs.ubifs without the
option -F, --space-fixup.
The MTD DFU backend implements this behavior introduced on DFU NAND
backend by the commit
13cb7cc9e8e4 ("dfu: Add option to skip empty pages
when flashing UBI images to NAND") and also supported by the command nand
by CONFIG_CMD_NAND_TRIMFFS and by commit
c9494866df83 ("cmd_nand: add nand
write.trimffs command").
[1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo
[2] http://www.linux-mtd.infradead.org/faq/ubifs.html#L_free_space_fixup
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Pali Rohár [Mon, 17 Jan 2022 15:38:40 +0000 (16:38 +0100)]
pci: Extend 'pci' command with bus option '*'
Allow to call 'pci' and 'pci regions' commands with bus option '*' which
cause pci to process all buses.
PCIe is point-to-point HW and so on each bus is maximally one physical
device. Therefore for PCIe it is common to have multiple buses.
This change allows to easily print all available PCIe devices in system.
Make '*' as default option when no bus argument is specified.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Pali Rohár [Mon, 17 Jan 2022 15:38:39 +0000 (16:38 +0100)]
pci: Add checks for valid cmdline arguments
Currently pci command ignores invalid cmdline arguments and do something.
Add checks that all passed arguments were processed.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Pali Rohár [Mon, 17 Jan 2022 15:38:38 +0000 (16:38 +0100)]
pci: Extend 'pci regions' command with bus number
'pci regions' currently prints only region information from bus 0 which
belongs to controller 0. Parser for 'pci regions' cmdline currently ignores
any additional arguments and so U-Boot always uses bus 0.
Regions are stored in controller (not on the bus) and therefore to retrieve
controller from the bus, it is needed to call pci_get_controller() which
returns root bus. Because bus 0 is root bus, current code worked fine for
controller 0.
Extend cmdline parser for 'pci regions' to allows specifying bus number,
extend pci_show_regions() code to accept also non-zero bus number and
print bus ranges for which is regions configuration assigned.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Pali Rohár [Mon, 17 Jan 2022 15:38:37 +0000 (16:38 +0100)]
pci: Fix setting controller's last_busno
Initially it is set to dev_seq but update to the last bus number is
missing. Fix it.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Heiko Thiery [Mon, 17 Jan 2022 15:25:41 +0000 (16:25 +0100)]
spl: add support for custom boot method names
Currently the names MMC1, MMC2 and MMC2_2 are output in the SPL. To
achieve more userbility here the name of the boot source can be returned.
E.g. for "MMC1" -> "eMMC" or "MMC2" -> "SD card".
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Tested-by: Michael Walle <michael@walle.cc>
Tom Rini [Fri, 28 Jan 2022 17:13:23 +0000 (12:13 -0500)]
Merge branch '2022-01-28-fastboot-updates'
- 3 DFU/fastboot bugfixes
Matthias Schiffer [Thu, 16 Dec 2021 10:26:38 +0000 (11:26 +0100)]
fastboot: only look up real partition names when no alias exists
Having U-Boot look up the passed partition name even though an alias
exists is unexpected, leading to warning messages (when the alias name
doesn't exist as a real partition name) or the use of the wrong
partition.
Change part_get_info_by_name_or_alias() to consider real partitions
names only if no alias of the same name exists, allowing to use aliases
to override the configuration for existing partition names.
Also change one use of strcpy() to strlcpy().
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Patrick Delaunay [Wed, 13 Oct 2021 15:01:37 +0000 (17:01 +0200)]
dfu: handle short frame result of UPLOAD in state_dfu_idle
In DFU v1.1 specification [1] the DFU_UPLOAD (Short Frame)
is handled only in dfuUPLOADIDLE state:
- Figure A.1 Interface state transition diagram
- the state description in chapter A.2
A.2.3 State 2 dfuIDLE
on Receipt of the DFU_UPLOAD request,and bitCanUpload = 1
the Next State is dfuUPLOADIDLE
A.2.10 State 9 dfuUPLOAD-IDLE
When the length of the data transferred by the device in response
to a DFU_UPLOAD request is less than wLength. (Short frame)
the Next State is dfuIDLE
In current code, when an UPLOAD is completely performed after the first
request (for example with wLength=200 and data read = 9), the DFU state
stay at dfuUPLOADIDLE until receiving a DFU_UPLOAD or a DFU_ABORT request
even it is unnecessary as the previous DFU_UPLOAD request already reached
the EOF.
This patch proposes to finish the DFU uploading (don't go to dfuUPLOADIDLE)
and completes the control-read operation (go to DFU_STATE_dfuIDLE) when
the first UPLOAD response has a short frame as an end of file (EOF)
indicator even if it is not explicitly allowed in the DFU specification
but this seems logical.
[1] https://www.usb.org/sites/default/files/DFU_1.1.pdf
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Roman Stratiienko [Sat, 8 May 2021 22:25:24 +0000 (01:25 +0300)]
fastboot: fix fastboot_set_reboot_flag()
In case CONFIG_FASTBOOT_FLASH_MMC_DEV == 0, compile-time condition
is not met and fastboot_set_reboot_flag() fails.
Fixes:
a362ce214f03 ("fastboot: Implement generic fastboot_set_reboot_flag")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tom Rini [Thu, 27 Jan 2022 19:14:47 +0000 (14:14 -0500)]
Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm
acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements
Tom Rini [Thu, 27 Jan 2022 01:41:38 +0000 (20:41 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb
Loic Poulain [Thu, 25 Nov 2021 17:16:15 +0000 (18:16 +0100)]
usb: gadget: Add CDC ACM function
Add support for CDC ACM using the new UDC and gadget API. This protocol
can be used for serial over USB data transfer and is widely supported
by various OS (GNU/Linux, MS-Windows, OSX...). The usual purpose of
such link is to access device debug console and can be useful for
products not exposing regular UART to the user.
A default stdio device named 'usbacm' is created, and can be used
to redirect console to USB link over CDC ACM:
> setenv stdin usbacm; setenv stdout usbacm
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Loic Poulain [Thu, 25 Nov 2021 17:16:14 +0000 (18:16 +0100)]
lib/circbuf: Make circbuf selectable symbol
It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Lukasz Majewski [Wed, 22 Dec 2021 09:55:09 +0000 (10:55 +0100)]
usb: ehci: dm: Convert i.MX28 ehci code to driver model
This commit converts i.MX28's EHCI USB host driver to driver model
(DM_USB). It is a straightforward conversion (to reuse as much code
as possible), based on ehci-mx5.c code.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Lukasz Majewski [Wed, 22 Dec 2021 09:55:08 +0000 (10:55 +0100)]
usb: ehci: Move common mxs code to separate functions (ehci_hcd_{stop|start})
Those functions will be re-used when the ehci MXS driver (for imx28)
will be converted to also support CONFIG_DM_USB.
No functional changes introduced - only cosmetic changes (u32 type)
and alignment to pass checkpatch.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Lukasz Majewski [Wed, 22 Dec 2021 09:55:07 +0000 (10:55 +0100)]
usb: ehci: Refactor the ehci_mxs_toggle_clock function to be reused with DM
This function is going to be reused with the CONFIG_DM_USB enabled in
the imx28 mxs USB ehci driver.
No functional changes introduced.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Lukasz Majewski [Wed, 22 Dec 2021 09:55:06 +0000 (10:55 +0100)]
usb: Modify Kconfig of the USB_EHCI_MXS to use this driver with imx28
The ehci-mxs driver can be also used with imx28 SoC, not only
imx23.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Simon Glass [Fri, 12 Nov 2021 19:28:13 +0000 (12:28 -0700)]
tools: mkimage: Show where signatures/keys are written
At present mkimage displays the node information but it is not clear what
signing action was taken. Add a message that shows it. For now it only
supports showing a single signing action, since that is the common case.
Sample:
Signature written to 'sha1-basic/test.fit',
node '/configurations/conf-1/signature'
Public key written to 'sha1-basic/sandbox-u-boot.dtb',
node '/signature/key-dev'
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:12 +0000 (12:28 -0700)]
tools: Pass public-key node through to caller
Update the two functions that call add_verify_data() so that the caller
can see the node that was written to.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:11 +0000 (12:28 -0700)]
image: Return destination node for add_verify_data() method
It is useful to know where the verification data was written. Update the
API to return this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:10 +0000 (12:28 -0700)]
tools: Pass the key blob around
At present we rely on the key blob being in the global_data fdt_blob
pointer. This is true in U-Boot but not with tools. For clarity, pass the
parameter around.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:09 +0000 (12:28 -0700)]
tools: Tidy up argument order in fit_config_check_sig()
Put the parent node first in the parameters as this is more natural. Also
add a comment to explain what is going on.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:08 +0000 (12:28 -0700)]
tools: Avoid confusion between keys and signatures
We should be consistent in using the term 'signature' to describe a value
added to sign something and 'key' to describe the key that can be used to
verify the signature.
Tidy up the code to stick to this.
Add some comments to fit_config_verify_key() and its callers while we are
here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:07 +0000 (12:28 -0700)]
tools: Drop unused name in image-host
The name is created but never used. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:06 +0000 (12:28 -0700)]
tools: Improve comments in signing functions
Add some more comments to explain what is going on in the signing
functions. Fix two repeated typos.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:05 +0000 (12:28 -0700)]
tools: Avoid leaving extra data at the end of copied files
The copyfile() implementation has strange behaviour if the destination
file already exists. Update it to ensure that any existing data in the
destination file is dropped.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:04 +0000 (12:28 -0700)]
tools: Move copyfile() into a common file
This function is useful in other places. Move it to a common file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:03 +0000 (12:28 -0700)]
fit_check_sign: Update help to mention the key is in a dtb
The key is inside a dtb file, so tweak the help to make that clear.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 12 Nov 2021 19:28:02 +0000 (12:28 -0700)]
rsa: Add debugging for failure cases
Add some more debugging to make it easier to see what is being tried and
what fails. Fix a few comment styles while here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Heiko Thiery [Mon, 24 Jan 2022 07:11:01 +0000 (08:11 +0100)]
binman: doc: fix typo for u-boot-tpl
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sun, 23 Jan 2022 19:55:46 +0000 (12:55 -0700)]
binman: Document the __bss_size symbol error
Add a note about the message so it is clear why it occurs.
Signed-off-by: Simon Glass <sjg@chromium.org>
Heinrich Schuchardt [Fri, 21 Jan 2022 17:01:23 +0000 (18:01 +0100)]
sandbox: eth-raw: fix building with musl library
The definition of struct udphdr in include netinet/udp.h in the
musl library differs from the definition in the glibc library.
To use the same definition with musl the symbol _GNU_SOURCE has
to be defined.
Reported-by: Milan P. Stanić <mps@arvanta.net>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Milan P. Stanić <mps@arvanta.net>
Heinrich Schuchardt [Fri, 21 Jan 2022 15:07:30 +0000 (16:07 +0100)]
sandbox: sandbox_serial_pending depends on DM_VIDEO
When building sandbox_defconfig with CONFIG_DM_VIDEO=n a link time error
occurs:
in function `sandbox_serial_pending':
drivers/serial/sandbox.c:101: undefined reference to `video_sync_all'
video_sync_all() is only defined if we have CONFIG_DM_VIDEO=y.
Calling this function in a serial driver looks quite hackish
but at least let's add the missing build constraint.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:12 +0000 (20:14 -0700)]
binman: Add documentation for bintools
Add this documention to explain how bintools are used and which ones are
available.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:11 +0000 (20:14 -0700)]
binman: Add a command to generate bintool docs
Each bintool has some documentation which can be useful for the user.
Add a new command that collects this and writes it into a .rst file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:10 +0000 (20:14 -0700)]
binman: Complete test coverage of comp_util
Drop the unused gzip code, update comments and add a test for an
invalid algorithm. The temporary file is not needed now, so drop that
also.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:09 +0000 (20:14 -0700)]
binman: Plumb in support for missing bintools
Bintools can be missing, in which case binman continues operation but
reports an invalid image. Plumb in support for this and add tests for
entry types which use bintools.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:08 +0000 (20:14 -0700)]
binman: Convert to using the lzma_alone bintool
Update the code to use this bintool, instead of running lzma_alone
directly. This simplifies the code and provides more consistency.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:07 +0000 (20:14 -0700)]
binman: Add a bintool implementation for lzma_alone
Add a Bintool for this, which is used to compress and decompress data.
It supports the features needed by binman as well as installing via the
lzma-alone package.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:06 +0000 (20:14 -0700)]
binman: Convert to using the lz4 bintool
Update the code to use this bintool, instead of running lz4 directly. This
simplifies the code and provides more consistency.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:05 +0000 (20:14 -0700)]
binman: Add a bintool implementation for lz4
Add a Bintool for this, which is used to compress and decompress data.
It supports the features needed by binman as well as installing via the
lz4 package.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:04 +0000 (20:14 -0700)]
binman: Tidy up pylint warnings in comp_util
Tweak some naming and comments to resolve these. Use WriteFile() to write
the file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:03 +0000 (20:14 -0700)]
binman: Move compression into binman
The compression functions are not actually used by patman, so we don't
need then in the tools module. Also we want to change them to use
bintools, which patman will not support.
Move these into a new comp_util module, within binman.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:02 +0000 (20:14 -0700)]
binman: Convert to using the mkimage bintool
Update the fit and mkimage entry types to use this bintool, instead of
running mkimage directly. This simplifies the code and provides more
consistency as well as supporting missing bintools.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:01 +0000 (20:14 -0700)]
binman: Convert to using the ifwitool bintool
Update the ifwi entry type to use this bintool, instead of running
ifwitool directly. This simplifies the code and provides more
consistency as well as supporting missing bintools.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:14:00 +0000 (20:14 -0700)]
binman: Convert to using the futility bintool
Update the GBB and vblock entry types to use this bintool, instead of
running futility directly. This simplifies the code and provides more
consistency as well as supporting missing bintools.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:59 +0000 (20:13 -0700)]
binman: Convert to using the FIP bintool
Update the FIP tests to use this bintool, instead of running fiptool
directly. This simplifies the code and provides more consistency as well
as supporting missing bintools.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:58 +0000 (20:13 -0700)]
binman: Convert to using the CBFS bintool
Update the CBFS tests to use this bintool, instead of running cbfstool
directly. This simplifies the overall code and provides more consistency,
as well as supporting missing bintools.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:57 +0000 (20:13 -0700)]
binman: Enable bintool tests including cmdline processing
The tests rely on having at least 5 bintool implementions. Now that we
have this, enable them. Add tests for the binman 'tool' subcommand.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:56 +0000 (20:13 -0700)]
binman: Add a bintool implementation for mkimage
Add a Bintool for this, which is used to build images for use by U-Boot.
It supports the features needed by binman as well as installing via the
u-boot-tools packages. Although this is built in the U-Boot tree, it is
still useful to install a binary on the system.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:55 +0000 (20:13 -0700)]
binman: Add a bintool implementation for ifwitool
Add a Bintool for this, which is used to build Intel IFWI images. It
supports the features needed by the tests as well as downloading a binary
from Google Drive. Although this is built in the U-Boot tree, it is not
currently included with u-boot-tools, so it may be useful to install a
binary on the system.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:54 +0000 (20:13 -0700)]
binman: Add a bintool implementation for futility
Add a Bintool for this, which is used to sign Chrome OS images and
build the Google Binary Block (GBB). It supports the features needed by
binman as well as fetching a binary from Google Drive. Building it from
source is possible but is left for another time, as it requires at least
one other library.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:53 +0000 (20:13 -0700)]
binman: Add a bintool implementation for fiptool
Add a Bintool for this, which is used to run FIP tests. It supports
the features needed by the tests as well as building a binary from
the git tree.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:52 +0000 (20:13 -0700)]
binman: Add a bintool implementation for cbfstool
Add a Bintool for this, which is used to run CBFS tests. It supports
the features needed by the tests as well as fetching a binary from
Google Drive. Building it from source is very slow since it is not
separately supported by the coreboot build system and it builds an
entire gcc toolchain before starting.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:51 +0000 (20:13 -0700)]
binman: Add tests for bintool
Add tests to cover the bintool functionality.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:50 +0000 (20:13 -0700)]
binman: Plumb in support for bintools
Support collecting the available bintools needed by an image, by
scanning the entries in the image.
Also add a command-line interface to access the basic bintool features,
such as listing the bintools and fetching them if needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:49 +0000 (20:13 -0700)]
binman: Add support for bintools
Binman requires various tools to actually work, such as 'lz4' to compress
data and 'futility' to sign Chrome OS firmware. At present these are
handled in an ad-hoc manner and there is no easy way to find out what
tools are needd to build an image, nor where to obtain them.
Add an implementation of 'bintool', a base class which implements this
functionality. When a bintool is required, it can be requested from this
module, then executed. When the tool is missing, it can provide a way to
obtain it.
Note that this uses Command directly, not the tools.Run() function. This
allows proper handling of missing tools and avoids needing to catch and
re-raise exceptions.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:48 +0000 (20:13 -0700)]
binman: Add installation instructions
Explain how to install binman, since it is not obvious.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:47 +0000 (20:13 -0700)]
binman: Correct path for fip_util
This should be imported from the binman module. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:46 +0000 (20:13 -0700)]
binman: Allow faked blobs in blob-ext-list
Since this is a list of blobs, each blob should have the ability to be
faked, as with blob-ext. Update the Entry base class to set allow_fake
and use the base class in the section code also, so that this propagagtes
to blob-ext-list, which is not a section.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:45 +0000 (20:13 -0700)]
binman: Drop the image name from the fake-blob message
This is not really needed and it makes the message different from the
missing-blob message. Update it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:43 +0000 (20:13 -0700)]
patman: Add a function to find a tool on the path
The Run() function automatically uses the PATH variable to locate a tool
when running it. Add a function that does this manually, so we don't have
to run a tool to find out if it is present.
This is needed by the new Bintool class, which wants to check which tools
are present.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:42 +0000 (20:13 -0700)]
patman: Tidy up the download function a little
Reverse the order of the return tuple, so that the filename is first.
This seems more obvious than putting the temporary directory first.
Correct a bug that leaves a space on the final line.
Allow the caller to control the name of the temporary directory.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:41 +0000 (20:13 -0700)]
buildman: Move the download function to tools
This function is handy for binman as well. Move it into the shared 'tools'
module.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:40 +0000 (20:13 -0700)]
patman: Allow running a tool and returning the full result
Add a new function which returns the entire result from running a tool,
not just stdout. Update Run() to use this and to return stdout on error,
if stderr is empty, since some unfortunate tools write their error
output to stdout rather than stderr.
Move building of the PATH to a separate function.
Make the exception catching more specific, to catch just ValueError, since
broad exceptions are a pain to debug.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:39 +0000 (20:13 -0700)]
binman: Expand the external FIT test a little
At present this does not check that the external data is in the expected
place. Use a non-zero offset for the external data and check it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:38 +0000 (20:13 -0700)]
mkimage: Show the external-offset error
This is a debug message at present, which is not very helpful. Print out
the error so that action can be taken.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:37 +0000 (20:13 -0700)]
binman: Tweak elf tests for a toolchain change
Some newer toolchains do not create a symbol for the .ucode section that
this test relies on. Update the test to use the symbol that is explicitly
created, instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 10 Jan 2022 03:13:36 +0000 (20:13 -0700)]
Makefile: Fake external blobs by default with binman
This behaviour is necessary with boards where the binman description
requires processing external blobs, since these may be missing.
Enable it by default, so that CI is happy. Warnings indicate that a valid
image is not produced, as with the --allow-missing option.
Signed-off-by: Simon Glass <sjg@chromium.org>
Patrice Chotard [Tue, 4 Jan 2022 07:42:48 +0000 (08:42 +0100)]
dm: Fix OF_BAD_ADDR definition
When OF_LIVE flag is enabled on a 64 bits platform, there is an
issue when dev_read_addr() is called and need to perform an address
translation using __of_translate_address().
In case of error, __of_translate_address() return's value is OF_BAD_ADDR
(wich is defined in include/dm/of.h to ((u64)-1) = 0xffffffffffffffff).
The return value of dev_read_addr() is often compared to FDT_ADDR_T_NONE
which is defined as (-1U) = 0xffffffff.
In this case the comparison is always false.
To fix this issue, define FDT_ADDR_T_NONE to (ulong)(-1) in case of
AARCH64. Update accordingly related tests.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Rasmus Villemoes [Sun, 21 Nov 2021 13:52:51 +0000 (14:52 +0100)]
introduce CONFIG_DEVICE_TREE_INCLUDES
The build system already automatically looks for and includes an
in-tree *-u-boot.dtsi when building the control .dtb. However, there
are some things that are awkward to maintain in such an in-tree file,
most notably the metadata associated to public keys used for verified
boot.
The only "official" API to get that metadata into the .dtb is via
mkimage, as a side effect of building an actual signed image. But
there are multiple problems with that. First of all, the final U-Boot
(be it U-Boot proper or an SPL) image is built based on a binary
image, the .dtb, and possibly some other binary artifacts. So
modifying the .dtb after the build requires the meta-buildsystem
(Yocto, buildroot, whatnot) to know about and repeat some of the steps
that are already known to and handled by U-Boot's build system,
resulting in needless duplication of code. It's also somewhat annoying
and inconsistent to have a .dtb file in the build folder which is not
generated by the command listed in the corresponding .cmd file (that
of course applies to any generated file).
So the contents of the /signature node really needs to be baked into
the .dtb file when it is first created, which means providing the
relevant data in the form of a .dtsi file. One could in theory put
that data into the *-u-boot.dtsi file, but it's more convenient to be
able to provide it externally: For example, when developing for a
customer, it's common to use a set of dummy keys for development,
while the consultants do not (and should not) have access to the
actual keys used in production. For such a setup, it's easier if the
keys used are chosen via the meta-buildsystem and the path(s) patched
in during the configure step. And of course, nothing prevents anybody
from having DEVICE_TREE_INCLUDES point at files maintained in git, or
for that matter from including the public key metadata in the
*-u-boot.dtsi directly and ignore this feature.
There are other uses for this, e.g. in combination with ENV_IMPORT_FDT
it can be used for providing the contents of the /config/environment
node, so I don't want to tie this exclusively to use for verified
boot.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Fix doc formatting error (make htmldocs)
Signed-off-by: Simon Glass <sjg@chromium.org>
Sean Anderson [Fri, 5 Nov 2021 16:52:55 +0000 (12:52 -0400)]
usb: Use the first available device for ehci_gadget
For whatever reason, usb_setup_ehci_gadget removes and probes USB device
0. However, not all systems have a device 0. Use the first device
instead.
The device probed should probably have something to do with the
controller (as specified by e.g. ums <controller> or fastboot
<controller>). In fact, I find it odd that we probe the USB device in
the first place, because this is just to set up the gadget itself.
Presumably, the controller should be probed by usb_gadget_initialize
somehow.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:09 +0000 (09:03 -0700)]
acpi: Add myself as maintainer
Add myself as maintainer of the generic ACPI code, until someone else
steps up to take it on.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:08 +0000 (09:03 -0700)]
acpi: Add some tables needed by ARM devices
Add some tables needed for ARM devices, including more MADT subtables,
a CSRT descriptor, GTDT and PPTT.
WIP: This needs comments added.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:07 +0000 (09:03 -0700)]
doc: Add usage information for the acpi command
Add some documentation for this command.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:06 +0000 (09:03 -0700)]
acpi: Tidy up the table list
At present this is really just a debugging aid, but it is a bit untidy.
Add proper columns so it is easier to read.
Sample output for coral:
=> acpi list
Name Base Size Detail
---- -------- ----- ------
RSDP
79925000 24 v02 U-BOOT
RSDT
79925030 48 v01 U-BOOT U-BOOTBL
20220101 INTL 0
XSDT
799250e0 6c v01 U-BOOT U-BOOTBL
20220101 INTL 0
FACP
79929570 f4 v04 U-BOOT U-BOOTBL
20220101 INTL 1
DSDT
79925280 32ea v02 U-BOOT U-BOOTBL
20110725 INTL
20180105
FACS
79925240 40
MCFG
79929670 2c v01 U-BOOT U-BOOTBL
20220101 INTL 0
SPCR
799296a0 50 v02 U-BOOT U-BOOTBL
20220101 INTL 0
TPM2
799296f0 4c v04 U-BOOT U-BOOTBL
20220101 INTL 0
APIC
79929740 6c v02 U-BOOT U-BOOTBL
20220101 INTL 0
SSDT
799297b0 1523 v02 U-BOOT U-BOOTBL
20220101 INTL 1
NHLT
7992ace0 e60 v05 coral coral 3 INTL 0
DBG2
7992db40 61 v00 U-BOOT U-BOOTBL
20220101 INTL 0
HPET
7992dbb0 38 v01 U-BOOT U-BOOTBL
20220101 INTL 0
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:05 +0000 (09:03 -0700)]
acpi: Tidy up the item list
At present this is really just a debugging aid, but it is a bit untidy.
Add proper columns and display the type name instead of a number.
Sample output for coral:
=> acpi items
Seq Type Addr Size Device/Writer
--- ----- -------- ---- -------------
0 other
79925000 240 0base
1 other
79925240 40 1facs
2 dsdt
799252a4 58 board
3 dsdt
799252fc 10 lpc
4 other
79925280 32f0 3dsdt
5 other
79928570 1000 4gnvs
6 other
79929570 100 5fact
7 other
79929670 30 5mcfg
8 other
799296a0 50 5spcr
9 other
799296f0 50 5tpm2
a other
79929740 70 5x86
b ssdt
799297d4 fe maxim-codec
c ssdt
799298d2 28 i2c2@16,0
d ssdt
799298fa 270 da-codec
e ssdt
79929b6a 28 i2c2@16,1
f ssdt
79929b92 28 i2c2@16,2
10 ssdt
79929bba 83 tpm@50
11 ssdt
79929c3d 28 i2c2@16,3
12 ssdt
79929c65 282 elan-touchscreen@10
13 ssdt
79929ee7 285 raydium-touchscreen@39
14 ssdt
7992a16c 28 i2c2@17,0
15 ssdt
7992a194 d8 elan-touchpad@15
16 ssdt
7992a26c 163 synaptics-touchpad@2c
17 ssdt
7992a3cf 28 i2c2@17,1
18 ssdt
7992a3f7 111 wacom-digitizer@9
19 ssdt
7992a508 8f sdmmc@1b,0
1a ssdt
7992a597 4b wifi
1b ssdt
7992a5e2 1a0 cpu@0
1c ssdt
7992a782 1a0 cpu@1
1d ssdt
7992a922 1a0 cpu@2
1e ssdt
7992aac2 211 cpu@3
1f other
799297b0 1530 6ssdt
20 other
7992ace0 2f10 8dev
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:04 +0000 (09:03 -0700)]
acpi: Collect tables in the acpi_item list
At present this list is used to collect items within the DSDT and SSDT
tables. It is useful for it to collect the whole tables as well, so there
is a list of what was created and which write created each one.
Refactor the code accordingly.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:03 +0000 (09:03 -0700)]
x86: Move acpi_get_rsdp_addr() ACPI tables to the writer
Move this over to use a writer file, moving the code from the x86
implementation.
There is no need to store a separate variable since we can simply access
the ACPI context.
With this, the original monolithic x86 function for writing ACPI tables
is gone.
Note that QEMU has its own implementation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:02 +0000 (09:03 -0700)]
x86: Move device-specific ACPI tables to a writer function
Move this over to use a writer function, moving the code from the x86
implementation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:03:01 +0000 (09:03 -0700)]
x86: acpi: Update acpi_fill_csrt() to use acpi_ctx
Update this function to the newer style, so we can avoid passing and
returning an address through this function.
Also move this function out of the x86 code so it can be used by other
archs.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Simon Glass [Wed, 1 Dec 2021 16:03:00 +0000 (09:03 -0700)]
x86: Move CSRT table to a writer function
Move this table over to use a writer function, moving the code from the
x86 implementation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:59 +0000 (09:02 -0700)]
x86: Move TCPA table to a writer function
Move this table over to use a writer function, for x86 only.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:58 +0000 (09:02 -0700)]
x86: Move MADT table to a writer function
Move this table over to use a writer function, for x86 only.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:57 +0000 (09:02 -0700)]
x86: Move TPM2 table to a writer function
Move this table over to use a writer function, for x86 only.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:56 +0000 (09:02 -0700)]
x86: Move SSDT table to a writer function
Move this table over to use a writer function, moving the code from the
x86 implementation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:55 +0000 (09:02 -0700)]
x86: Move FACP table into separate functions
Each board has its own way of creating this table. Rather than calling the
acpi_create_fadt() function for each one from a common acpi_write_fadt()
function, just move the writer into the board-specific code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Simon Glass [Wed, 1 Dec 2021 16:02:54 +0000 (09:02 -0700)]
x86: Move FADT table to a writer function
Move this table over to use a writer function, for x86 only.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:53 +0000 (09:02 -0700)]
x86: Move GNVS table to a writer function
Move this table over to use a writer function, for x86 only. Handle the
two cases
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:52 +0000 (09:02 -0700)]
x86: Move DSDT table to a writer function
Move this table over to use a writer function, moving the code from the
x86 implementation.
Add a pointer to the DSDT in struct acpi_ctx so we can reference it later.
Disable this table for sandbox since we don't actually compile real ASL
code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:51 +0000 (09:02 -0700)]
x86: Move FACS table to a writer function
Move this table over to use a writer function, moving the code from the
x86 implementation.
Add a pointer to the DSDT in struct acpi_ctx so we can reference it later.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:50 +0000 (09:02 -0700)]
x86: Move base tables to a writer function
Use the new ACPI writer to write the base tables at the start of the area,
moving this code from the x86 implementation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:49 +0000 (09:02 -0700)]
x86: Use the ACPI table writer
Use the new ACPI writer to write the ACPI tables. At present this is all
done in one monolithic function. Future work will split this out.
Unfortunately the QFW write_acpi_tables() function conflicts with the
'writer' version, so disable that for sandbox.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:48 +0000 (09:02 -0700)]
x86: acpi: Split out context creation from base tables
At present acpi_setup_base_tables() both sets up the ACPI context and
writes out the base tables.
We want to use an ACPI writer to write the base tables, so split this
function into two, with acpi_setup_ctx() doing the context set, and
acpi_setup_base_tables() just doing the base tables.
Disable the writer's write_acpi_tables() function for now, to avoid
build errors. It is enabled in a following patch.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Wed, 1 Dec 2021 16:02:47 +0000 (09:02 -0700)]
acpi: Add a linker list for ACPI tables
At present we call lots of functions to generate the required ACPI tables.
It would be better to standardise these functions and allow them to be
automatically collected and used when needed.
Add a linker list to handle this.
Signed-off-by: Simon Glass <sjg@chromium.org>