Commit Graph

1208 Commits

Author SHA1 Message Date
AKASHI Takahiro
e8bced62b6 cmd: efidebug: fix a failure of "boot rm" sub-command
There is a wrong usage of utf8_utf16_strncpy() in "boot rm" command, and
then it will end up with a failure of this command due to a wrong
value of an interim variable ("var_name16").

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-11 08:23:05 +01:00
Keerthy
805b3cac1e lib: elf: Move the generic elf loading/validating functions to lib
Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2020-03-03 13:08:14 +05:30
Ilias Apalodimas
ec80b4735a efi_loader: Implement FileLoad2 for initramfs loading
Following kernel's proposal for an arch-agnostic initrd loading
mechanism [1] let's implement the U-boot counterpart.
This new approach has a number of advantages compared to what we did up
to now. The file is loaded into memory only when requested limiting the
area of TOCTOU attacks. Users will be allowed to place the initramfs
file on any u-boot accessible partition instead of just the ESP one.
Finally this is an attempt of a generic interface across architectures
in the linux kernel so it makes sense to support that.

The file location is intentionally only supported as a config option
argument(CONFIG_EFI_INITRD_FILESPEC), in an effort to enhance security.
Although U-boot is not responsible for verifying the integrity of the
initramfs, we can enhance the offered security by only accepting a
built-in option, which will be naturally verified by UEFI Secure Boot.
This can easily change in the future if needed and configure that via ENV
or UEFI variable.

[1] https://lore.kernel.org/linux-efi/20200207202637.GA3464906@rani.riverdale.lan/T/#m4a25eb33112fab7a22faa0fd65d4d663209af32f

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-02-28 19:37:14 +01:00
Heinrich Schuchardt
76be687288 efi_loader: implement EFI_RT_PROPERTIES_TABLE
UEFI spec 2.8 errata A replaces the RuntimeServicesSupported variable
defined in UEFI spec 2.8 by the configuration table
EFI_RT_PROPERTIES_TABLE. So let's follow suit.

Cc: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
2020-02-26 19:32:09 +01:00
Heinrich Schuchardt
7d4d551e7d efi_loader: fix efi_install_fdt() description
In the function description use the correct parameter name.

Mention EFI_FDT_USE_INTERNAL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-02-19 12:53:36 +01:00
Tom Rini
9a8942b53d sandbox conversion to SDL2
TPM TEE driver
 Various minor sandbox video enhancements
 New driver model core utility functions
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAl48iogACgkQfxc6PpAI
 reaVzAf/an3/yKe6r3CVWlcRV6H/dVg1ApnnLpX7jS0p0b++oCVvOiy7z1WPXj3k
 b1SSgENDeeZ/8EHio+Gf7ZidH/TGEj7L6YEFwd1t60GMkZiWEkNf4Z53tw482YG+
 96hoPD+ySTW+ddIdVHWAFG2I4aEiKHANJAp/ItNdD+rLbrEwNQy+eiK5JTOk80B6
 /X8AJCLZeAC1s7vs+2+WolgjT78QGzA9HHalMiublcqh0ivKKk0QeQiOKKPe8JYJ
 om5YY1TxayQ60Xmo5f39/SBfzEEklxw83sU9o1tBeYzyVUpu7fQdkxiDbWdsij77
 DgwLdeYQJGbN+hdSWE0gjTqyhW+lWA==
 =KRoA
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-6feb20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

sandbox conversion to SDL2
TPM TEE driver
Various minor sandbox video enhancements
New driver model core utility functions
2020-02-11 10:58:41 -05:00
Joel Johnson
72732318a9 cmd: mdc/mwc: normalize disjoint MX_CYCLIC usage
Both CMD_MX_CYCLIC and MX_CYCLIC are in use and defined in Kconfig,
but only the non-CMD version currently does anything. This changes all
usages to prefer the CMD_MX_CYCLIC option (since it's only affecting
addition of the commands), and switches defconfigs using the non-CMD
version to use the CMD version.

Signed-off-by: Joel Johnson <mrjoel@lixil.net>
Reviewed-by: Tom Rini <trini@konsulko.com>
2020-02-09 14:58:08 +01:00
Tom Rini
89789ebd71 cmd/elf.c: Add SPDX tag
Based on reading the text of the license comment this appears to be
the BSD-2-Clause license but with an imperfect word match as
BSD-2-Clause was not (as far as I recall) a common license choice at the
time the code was written.

Cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
2020-02-07 13:59:58 -05:00
Luka Kovacic
4dbc107f46 cmd: gpio: Correct do_gpio() return value
Use the correct return value in function do_gpio() and update
commands documentation with the return values from command_ret_t enum.

CMD_RET_SUCCESS is returned on command success and CMD_RET_FAILURE is
returned on command failure.

The command was returning the pin value, which caused confusion when
debugging (#define DEBUG).

Signed-off-by: Luka Kovacic <luka.kovacic@sartura.hr>
Tested-by: Robert Marko <robert.marko@sartura.hr>
2020-02-07 13:59:58 -05:00
Simon Glass
336d4615f8 dm: core: Create a new header file for 'compat' features
At present dm/device.h includes the linux-compatible features. This
requires including linux/compat.h which in turn includes a lot of headers.
One of these is malloc.h which we thus end up including in every file in
U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
which needs to use the system malloc() in some files.

Move the compatibility features into a separate header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05 19:33:46 -07:00
Simon Glass
61b29b8268 dm: core: Require users of devres to include the header
At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
2020-02-05 19:33:46 -07:00
Sean Anderson
7b9d60fc1f cmd: Add command to dump drivers and compatible strings
This adds a subcommand to dm to dump out what drivers are installed, and their
compatible strings. I have found this useful in ensuring that I have the correct
drivers compiled, and that I have put in the correct compatible strings.

Signed-off-by Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-02-05 19:33:46 -07:00
Philippe Reynes
3780e2d08e cmd: tpm: add a subcommand device
The command tpm (and tpm2) search the tpm and use it.
On sandbox, there are two tpm (tpm 1.x and tpm 2.0).
So the command tpm and tpm2 are always executed with
the first tpm (tpm 1.x), and the command tpm2 always
fails.

This add a subcommand device to command tpm and
command tpm2. Then the command tpm and tpm2 use
the device selected with the subcommand device.

To be compatible with previous behaviour, if the
subcommand device is not used before a tpm (or tpm2)
command, the device 0 is selected.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2020-02-05 19:33:46 -07:00
Sam Protsenko
586a1bf5b2 doc: android: Convert to Sphinx format
Convert Android documentation from regular txt format to Sphinx (RST).
Also add Android index.rst file and reference it in root index.rst, so
that Android documentation is visible.

Test:

    $ make htmldocs
    $ xdg-open doc/output/index.html

Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-04 09:07:24 +05:30
Sam Protsenko
34b4319304 doc: android: Add documentation for Android Boot Image
Describe Android Boot Image format, how its support is implemented in
U-Boot and associated commands usage.

Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-04 09:07:24 +05:30
Sam Protsenko
94f6d0d1bd cmd: abootimg: Add abootimg command
This command can be used to extract fields and image payloads from
Android Boot Image. It can be used for example to implement boot flow
where dtb is taken from boot.img (as v2 incorporated dtb inside of
boot.img). Using this command, one can obtain needed dtb blob from
boot.img in scripting manner, and then apply needed dtbo's (from "dtbo"
partition) on top of that, providing then the resulting image to bootm
command in order to boot the Android.

Also right now this command has the sub-command to get an address and
size of recovery dtbo from recovery image (for non-A/B devices only,
see [1,2] for details).

It can be tested like this:

    => mmc dev 1
    => part start mmc 1 boot_a boot_start
    => part size mmc 1 boot_a boot_size
    => mmc read $loadaddr $boot_start $boot_size
    => abootimg get ver
    => abootimg dump dtb

[1] https://source.android.com/devices/bootloader/boot-image-header
[2] https://source.android.com/devices/architecture/dto/partitions

Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-04 09:07:24 +05:30
Tom Rini
5749faa3d6 cmd/gpt: Address error cases during gpt rename more correctly
New analysis by the tool has shown that we have some cases where we
weren't handling the error exit condition correctly.  When we ran into
the ENOMEM case we wouldn't exit the function and thus incorrect things
could happen.  Rework the unwinding such that we don't need a helper
function now and free what we may have allocated.

Fixes: 18030d04d2 ("GPT: fix memory leaks identified by Coverity")
Reported-by: Coverity (CID: 275475, 275476)
Cc: Alison Chaiken <alison@she-devel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Jordy <jordy@simplyhacker.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2020-01-30 13:30:35 -05:00
Tom Rini
86e42b3629 Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-spi
- spi cs accessing slaves (Bin Meng)
- spi prevent overriding established bus (Marcin Wojtas)
- support speed in spi command (Marek Vasut)
- add W25N01GV spinand (Robert Marko)
- move cadence_qspi to use spi-mem (Vignesh Raghavendra)
- add octal mode (Vignesh Raghavendra)
2020-01-27 19:57:13 -05:00
Martin Fuzzey
b852cca8f0 pmic: allow dump command for non contiguous register maps
Some PMICs (such as the DA9063) have non-contiguous register maps.
Attempting to read the non implemented registers returns an error
rather than a dummy value which causes 'pmic dump' to terminate
prematurely.

Fix this by allowing the PMIC driver to return -ENODATA for such
registers, which will then be displayed as '--' by pmic dump.

Use a single error code rather than any error code so that
we can distinguish between a hardware failure reading the PMIC
and a non implemented register known to the driver.

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
2020-01-27 19:54:20 -05:00
Peng Ma
2d7818d04f cmd: sata: Add block unbind device function
If we didn't unbind the sata from block device, the same devices would
be added after sata remove,
This patch is to resolve this issue as below:

=> sata info
SATA#0:
	(3.0 Gbps)
SATA#1:
	(3.0 Gbps)
Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY30
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX30
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
=> sata stop
=> sata info
SATA#0:
	(3.0 Gbps)
SATA#1:
	(3.0 Gbps)
Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
Device 2: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
Device 3: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)

Signed-off-by: Peng Ma <peng.ma@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-27 19:54:20 -05:00
Marek Vasut
6954756a15 cmd: spi: Permit setting bus frequency
The 'sspi' command hard-coded 1 MHz bus frequency for all transmissions.
Allow changing that at runtime by specifying '@freq' bus frequency in Hz.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2020-01-27 22:27:21 +05:30
Patrick Delaunay
b1b147f2b8 cmd: mtd: solve bad block support in erase command
This patch modify the loop in mtd erase command to erase one by one
the blocks in the requested area.

It solves issue on "mtd erase" command on nand with existing bad block,
the command is interrupted on the first bad block with the trace:
	"Skipping bad block at 0xffffffffffffffff"

In MTD driver (nand/raw), when a bad block is present on the MTD
device, the erase_op.fail_addr is not updated and we have the initial
value MTD_FAIL_ADDR_UNKNOWN = (ULL)-1.

This case seems normal in nand_base.c:nand_erase_nand(),
we have the 2 exit cases during the loop:

1/ we have a bad block (nand_block_checkbad)
	instr->state = MTD_ERASE_FAILED
	loop interrupted (goto erase_exit)

2/ if block erase failed (status & NAND_STATUS_FAIL)
	instr->state = MTD_ERASE_FAILED;
	instr->fail_addr =
				((loff_t)page << chip->page_shift);
	loop interrupted (goto erase_exit)

So erase_op.fail_addr can't be used if bad blocks were present
in the erased area; we need to use mtd_erase only one block to detect
and skip these existing bad blocks (as it is done in nand_util.c).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2020-01-24 11:19:52 -05:00
Joel Johnson
17f084fa8c zfs: remove unused buf variable
Remove unused variable to silence compiler warning

Signed-off-by: Joel Johnson <mrjoel@lixil.net>
2020-01-23 07:29:58 -05:00
Patrick Delaunay
e9c669867a cmd: pxe: execute the cls command only when supported
Execute the command cls (for clear screen), when the "menu background"
keyword is present in extlinux.conf file, only if the command is supported.

This patch avoid the warning "Unknown command 'cls'"
with "menu background" in extlinux.conf when CONFIG_CMD_BMP is activated
and CONFIG_CMD_CLS not activated (default for CONFIG_DM_VIDEO).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-01-22 17:49:25 -05:00
Baruch Siach
1c79f2ff88 cmd: add tlv_eeprom command
Add support for read/write of ONIE "Tlvinfo" EEPROM data format. TLV
stands for Type-Length-Value. The data format is described here:

  https://opencomputeproject.github.io/onie/design-spec/hw_requirements.html#board-eeprom-information-format

Based on U-Boot patch from the Open Compute project:

  ec87e872d4/patches/u-boot/common/feature-sys-eeprom-tlv-common.patch

Keep only I2C EEPROM support. Use the generic eeprom driver. Fix
checkpatch issues.

Add support for multiple EEPROM TLV stores on the same system. This is
useful in case of SOM and carrier that both provide ID and hardware
configuration information.

Add option to enable for SPL. This allows selection of RAM configuration
based on EEPROM stored board identification.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
2020-01-21 15:56:15 +01:00
Simon Glass
4d979bfdbc common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA
This is not really a CONFIG since it is not intended to be set by boards.
Move it into the compiler header with other similar defines, and rename
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 17:53:52 -05:00
Simon Glass
9b4a205f45 common: Move RAM-sizing functions to init.h
These functions relate to memory init so move them into the init
header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 14:02:35 -05:00
Simon Glass
220a3a44a3 common: Rename and move source()
This function has a very generic name which does not adequately describe
its purpose. Rename it and move it to image.h, since it relates to reading
a script from an image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 14:02:35 -05:00
Simon Glass
8e8ccfe1aa common: Move the image globals into image.h
These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 14:02:35 -05:00
Simon Glass
bb872dd930 image: Rename load_addr, save_addr, save_size
These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 14:02:35 -05:00
Simon Glass
9a3b4ceb37 common: Move reset_cpu() to the CPU header
Move this function out of common.h and into a relevant header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 14:02:31 -05:00
Simon Glass
015e3348fc common: Drop floppy disk support
This seems pretty old now. It has not been converted to driver model and
is not used by any boards.

Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 13:26:50 -05:00
Simon Glass
1444998230 common: Move functions for loading from fat/ext2 to fs.h
These are filesystem functions and belong in the filesystem header file.
Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 13:26:49 -05:00
Simon Glass
77f4e477ae common: Move do_tftpb() to net.h
This function belongs in the network header file. Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 13:26:48 -05:00
Simon Glass
0ee48252b4 common: Move flash_perror() to flash.h
This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17 13:26:48 -05:00
Philippe Reynes
8302d1708a aes: add support of aes192 and aes256
Until now, we only support aes128. This commit add the support
of aes192 and aes256.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-17 10:15:49 -05:00
Philippe Reynes
7012c04ef3 aes: add a define for the size of a block
In the code, we use the size of the key for the
size of the block. It's true when the key is 128 bits,
but it become false for key of 192 bits and 256 bits.
So to prepare the support of aes192  and 256,
we introduce a constant for the iaes block size.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-17 10:15:49 -05:00
Alexandre Besnard
45e4968e74 cmd/blk_common: clarify no partition error message
When no partition table is found, users should be warned so.
Warning that no device is available in this case could be misleading,
especially as it is the same error when no device is selected.

Signed-off-by: Alexandre Besnard <alexandre.besnard@softathome.com>
2020-01-16 09:39:45 -05:00
Eugeniu Rosca
4f731c795d cmd: adtimg: Refactor usage style
Trying to extend 'adtimg' functionality [1], we've been severely hit
by a major limitation in the command's usage scheme. Specifically, the
command's user interface appears to be too centric to getting the
DTB/DTBO entry [3] based on the index of the desired DT in the image,
which makes it really difficult retrieving the DT entry based on
alternative criteria (e.g. filtering by id/rev fields), the
latter being demanded by real life customer use-cases [1].

This went to the point of receiving below feedback from Sam [2]:

 -- snip --
 As for 'dtimg' command: after giving it some thought, I think not much
 people using it yet. So in this particular case I don't have some
 strong preference, and if you think the 'dtimg' interface is ugly, and
 it overcomes "don't break interfaces" rule, maybe now is a good time
 to rework it (before it gets widely used).
 -- snip --

Given the above, rework the usage pattern from [4] to [5], in order to
allow an intuitive enablement of "by id|rev" DT search [6].

[1] https://patchwork.ozlabs.org/cover/1202575/
    ("cmd: dtimg: Enhance with --id and --rev options (take #1)")
[2] https://patchwork.ozlabs.org/patch/1182207/#2317020
[3] https://source.android.com/devices/architecture/dto/partitions
[4] Old usage
adtimg dump <addr>                    - Print image contents
adtimg start <addr> <index> <varname> - Get DT address by index
adtimg size <addr> <index> <varname>  - Get DT size by index

[5] New usage
adtimg addr <addr>                      - Set image location to <addr>
adtimg dump                             - Print out image contents
adtimg get dt --index=<i> [avar [svar]] - Get DT address and size by index

[6] Soon-to-be-provided "by id|rev" add-on functionality
adtimg get dt --id=<id> --rev=<rev> [avar [svar [ivar]]]
 - Get DT address/size/index by id|rev fields

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
2020-01-10 14:18:26 -05:00
Eugeniu Rosca
4c6edc288b cmd: adtimg: Rename internal symbols
With 'dtimg.c' renamed to 'adtimg.c', now ensure the naming
consistency in the internal implementation of 'adtimg.c'.

No functional change intended.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-10 14:18:26 -05:00
Eugeniu Rosca
b84acf1056 dtimg/am57xx_evm_defconfig: Rename dtimg to adtimg
Rename the existing 'dtimg' command to 'adtimg', in order to:
 - Suggest the Android origins and scope
 - Be consistent with the upcoming 'abootimg' command (naming
   suggested by Simon [*])

The change in _not_ backward compatible, but its benefits outweigh its
downsides, given that we don't expect active users of 'dtimg' today.

Perform the rename in several steps:
 1. Rename *.c file and Kconfig symbol. This should allow
    'git log --follow' to properly track the history of 'adtimg.c'
 2. 's/dtimg/adtimg/g' in the internal namespace of 'adtimg.c'

ELF comparison [**] before and after shows no functional change.

[*] https://patchwork.ozlabs.org/patch/1182212/#2291600
[**] diff -u <(objdump -d cmd/dtimg.o) <(objdump -d cmd/adtimg.o)

Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass<sjg@chromium.org>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
2020-01-10 14:18:26 -05:00
Klaus H. Sorensen
6478a7ee3b cmd/eeprom.c: prepend 0x to hex numbers in output message format
If the numbers do not happen to contain any digits from [a-f], it's
not clear that they are base 16.

Signed-off-by: Klaus H. Sorensen <khso@prevas.dk>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
2020-01-10 14:18:26 -05:00
Tom Rini
a74a2134b2 Merge branch 'master' of git://git.denx.de/u-boot-usb
- DFU updates
2020-01-09 08:51:57 -05:00
Tom Rini
7086de4948 Pull request for UEFI sub-system for efi-2020-04-rc1
This pull request provides:
 
 * support for FIT images for UEFI binaries
 * drivers for hardware random number generators
 * an implementation of the EFI_RNG_PROTOCOL
 * a sub-command for efidebug to display configuration tables
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAl4UvR4ACgkQxIHbvCwF
 GsRJZhAAmlsRBUS3fvFV5GtB8bkWcSU4/s3TVYJui0fOhY02ZDIKkrubZzDx/Lgv
 9OaVwjQ3JSmq5XkDmXqzNDzYkxitQ5Qf/cFiBF5HpA3USkOttb3GIfgj0qD6DGzM
 cKyhgJm7bZoMN/mkIzkWsry1ASwYpB3ipyoJAfRfryw9ok4j9RfJ7pPieeycGWGJ
 0sZsJI0v7e6xt5Qsytk5sZNvlCFhyhl2OMYliAlRKBryh31Ahr2e6KEwsJh7VyCP
 4K12eBTqIJq1qHk7Lr0g1CnMCdeOT8J7qvX1+kvt3HupxTMkYRv2AR5CQWRKck5E
 RsmcKmiTHz/76w6Gk7kLan7y0UCSHnfHQ3aSEkkx4O/v4OC85VteyLAEriS7J9Hx
 xSNyoj01U2wG3SLrUjkAZv6JgyC8uCezRzOHOqN25Q2mRROVq781mcMfRXwdq6cD
 L4rrTsIDPzNF19wDa7P5tK6JMF8BDifLNuMTQj5LdJYMHJTJZBWG/vTNFPEldaIP
 D9RPoCibTolpiuCYneeXJURHGm5yme7KoxAPiMU+fAWO1F6SO25zxYA7MAiY4OYw
 zk7Ipaat0luIu1gC2ICYxrLnsMBq9glABrdq99i0DpUg9n9N/7SpcJSj2DMrFGmY
 u4yenWM1KTgjLoVHRhpTbCzF15GlYN4SHXV5iYO+Pof5WQYnv8w=
 =SjPV
 -----END PGP SIGNATURE-----

Merge tag 'efi-2020-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc1

This pull request provides:

* support for FIT images for UEFI binaries
* drivers for hardware random number generators
* an implementation of the EFI_RNG_PROTOCOL
* a sub-command for efidebug to display configuration tables
2020-01-08 18:57:11 -05:00
Tom Rini
14a2dee765 cmd/Kconfig: Add more dependencies to OSE bootm support
Per Enea OSE documentation, it supports some classes of ARM, PowerPC and
X86.  Limit the option to those platforms.

Signed-off-by: Tom Rini <trini@konsulko.com>
2020-01-08 09:27:44 -05:00
Heinrich Schuchardt
4f24ac08af cmd: add rng command
For the RNG uclass we currently only have a test working on the sandbox.

Provide a command to test the hardware random number generator on
non-sandbox systems.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:21 +01:00
Cristian Ciocaltea
ecc7fdaa9e bootm: Add a bootm command for type IH_OS_EFI
Add support for booting EFI binaries contained in FIT images.
A typical usage scenario is chain-loading GRUB2 in a verified
boot environment.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:21 +01:00
Heinrich Schuchardt
07e2fe7971 cmd: efidebug: capitalize UEFI
%s/uefi/UEFI/g

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:21 +01:00
Heinrich Schuchardt
986e064884 cmd: efidebug: new sub-command tables
Provide sub-command for efidebug to list configuration tables.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:21 +01:00
Heinrich Schuchardt
173cd9e73a cmd: efidebug: simplify get_guid_text()
When we hit a matching GUID we can directly return the text. There is no
need for a check after the loop.

efi_guid_t is defined as 8 byte aligned but GUIDs in packed structures do
not follow this alignment. Do not require the argument of get_guid_text()
to be correctly aligned.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:20 +01:00
Heinrich Schuchardt
a3850e40e1 efi_loader: free load options after execution
When be launch a binary via bootefi the bootargs environment variable is
used to set the load options in the loaded image protocol.

Free memory allocated for load options when the UEFI binary exits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:20 +01:00
Heinrich Schuchardt
f64f223256 efi_loader: export efi_install_fdt()
Use a pointer to addressable memory instead of a "physical" address in the
virtual address space of the sandbox to efi_install_fdt().

Export the efi_install_fdt() function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:20 +01:00
Heinrich Schuchardt
f9ceb6ac14 efi_loader: carve out efi_run_image()
Provide public function efi_run_imager() which can be used to run an UEFI
image from memory.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:20 +01:00
Heinrich Schuchardt
753aa18f17 efi_loader: use hardware device tree by default
If the bootefi command is called without passing the address of a device
tree, the internal device tree is used. For devices with a hardware device
tree it is preferable to used the hardware device tree in this case.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:20 +01:00
Heinrich Schuchardt
7a597259d2 efi_loader: pass address to efi_install_fdt()
As part of moving the parsing of command line arguments to do_bootefi()
call efi_install_fdt() with the address of the device tree instead of a
string.

If the address is EFI_FDT_USE_INTERNAL (= 0), the internal device tree
is used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 18:08:20 +01:00
Heiko Schocher
8ad0c66437 bdinfo: show multi_dtb_fit
if MULTI_DTB_FIT is enabled it is helpful to display
the value of gd->multi_dtb_fit in bdinfo.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-07 11:13:26 -05:00
Andy Shevchenko
98a8f445fd dfu: Add optional timeout parameter
When the `dfu` command is called from the U-Boot environment,
it now accepts an optional parameter that specifies a timeout (in seconds).
If a DFU connection is not made within that time the `dfu` command exits
(as it would if Ctrl+C was pressed). If the timeout is left empty or being
zero the `dfu` command behaves as it does now.

This is useful for allowing U-Boot to check to see if anything wants to
upload new firmware before continuing to boot.

The patch is based on the commit
5e966ccc3c
by Sebastien Colleur, which has been heavily reworked due to U-Boot changes
in the past.

Signed-off-by: Brad Campbell <bradjc5@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-01-07 14:37:50 +01:00
Andy Shevchenko
2b1f8c2bdf dfu: Refactor do_dfu() to handle optional argument
In the future we may utilize optional argument in 'dfu' command line.
As a preparation for this, refactor do_dfu().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
2020-01-07 14:37:50 +01:00
Simon Glass
b75617b035 x86: Update the fsp command for FSP2
The current 'fsp' command only works with FSP1. Update it to handle FSP2
as well. Convert everything to hex which is what U-Boot uses.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-12-15 11:44:19 +08:00
Simon Glass
3b65ee34b9 x86: sandbox: Add a PMC emulator and test
Add a simple PMC for sandbox to permit tests to run.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-12-15 11:44:11 +08:00
Ben Wolsieffer
2c4e067d49 cmd: pxe: Increase maximum path length
On NixOS, cross compiled kernels have long suffixes that cause them to
exceed the current maximum path length. The PXE/TFTP max path length is
used for extlinux.conf support as well, which is where this problem
usually manifest's itself.

Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-12-09 09:49:48 -06:00
Ramon Fried
7d9701db40 cmd: mdio/mii: add Kconfig help and allow break dependency
* Add Kconfig help describing the purpose of each command.
* Add CONFIG_CMD_MDIO so it could be selected individually, as
  it doesn't depend on the mii command.
* Add Kconfig imply to mii to automatically select the mdio
  command.

Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-12-09 09:47:42 -06:00
Joe Hershberger
fb8977c5be net: Always build the string_to_enetaddr() helper
Part of the env cleanup moved this out of the environment code and into
the net code. However, this helper is sometimes needed even when the net
stack isn't included.

Move the helper to lib/net_utils.c like it's similarly-purposed
string_to_ip(). Also rename the moved function to similar naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reported-by: Ondrej Jirman <megous@megous.com>
2019-12-09 09:47:41 -06:00
AKASHI Takahiro
05429b6cf5 rtc: move date.c from drivers/rtc/ to lib/
In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2019-12-06 16:44:19 -05:00
Patrice Chotard
31839dc2d2 cmd: pxe: Fix checkpatch WARNING/CHECK
Fix checkpatch WARNING and CHECK issues

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2019-12-06 16:44:19 -05:00
Patrice Chotard
51843eaba6 cmd: sysboot: Fix checkpatch WARNING/CHECK
Fix checkpatch WARNING and CHECK issues

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2019-12-06 16:44:19 -05:00
Patrice Chotard
8cb22a66a7 cmd: pxe_utils: Fix checkpatch WARNING/CHECK
Fix checkpatch WARNING and CHECK issues

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2019-12-06 16:44:19 -05:00
Patrice Chotard
993c912d30 cmd: sysboot: Create a sysboot command dedicated file
Extract all sysboot command related code from pxe.c to new sysboot.c
Update Kconfig to insure that DISTRO_DEFAULT select new CMD_SYSBOOT
command.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2019-12-06 16:44:18 -05:00
Patrice Chotard
2373cba3d2 cmd: Prepare sysboot command independence
As sysboot and pxe commands are sharing piece of code, migrate this
common code into a new file pxe_utils.c to prepare sysboot command
code extraction from pxe.c

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2019-12-06 16:44:18 -05:00
Patrice Chotard
1ac2cb9741 cmd: Migrate from_env() from pxe.c to nvedit.c
Migrate from_env() from pxe.c to nvedit.c as it's not pxe specific.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2019-12-06 16:44:18 -05:00
Philippe Reynes
787f10a9d2 cmd: cp: add missing map_sysmem
The command cp fails on sandbox because the address is used
directly. To fix this issue, we call the function map_sysmem
to translate the address.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2019-12-05 10:28:38 -05:00
Philippe Reynes
ae0d12f8df iminfo: add missing map_sysmem
The command iminfo fails on sandbox because the address
is used directly. To fix this issue, we call the function
map_sysmem to translate the address.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2019-12-05 10:28:38 -05:00
Miquel Raynal
ff102c54b0 cmd: make MTD commands depend on MTD
Defconfigs have been fixed, now we can add proper dependencies in
Kconfig. SPI FLASH is still not dependent on MTD (deeper rework needed).

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2019-12-04 17:10:51 -05:00
Miquel Raynal
eb446ef625 cmd: nand/sf: isolate legacy code
The 'sf' command is not supposed to rely on the MTD stack, but both
'sf' and 'nand' commands use helpers located in mtd_uboot.c. Despite
their location, these functions do not depend at all on the MTD
stack.

This file (drivers/mtd/mtd_uboot.c) is only compiled if CONFIG_MTD is
selected, which is inconsistent with the current situation. Solve this
by moving these three functions (which are only used by the above two
commands) out of mtd_uboot.c and put them in a C file only compiled
with cmd/sf.c and cmd/nand.c.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[trini: Don't export get_part function now]
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-12-04 17:10:51 -05:00
Miquel Raynal
587f44576e cmd: mtdparts: Kconfig: join mtdparts command entry with its options
Move the Kconfig entry of the option right after the entry of the
mtdparts command.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2019-12-04 17:10:51 -05:00
Miquel Raynal
888f184abe mtd: rename CONFIG_MTD_DEVICE -> CONFIG_MTD
Like in Linux, just use CONFIG_MTD to compile the MTD stack.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
2019-12-03 23:04:10 -05:00
Miquel Raynal
88718be300 mtd: rename CONFIG_NAND -> CONFIG_MTD_RAW_NAND
Add more clarity by changing the Kconfig entry name.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[trini: Re-run migration, update a few more cases]
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
2019-12-03 23:04:10 -05:00
Tom Rini
94d022bb40 Pull request for UEFI sub-system for efi-2020-01-rc5
A type error in the implementation of the efidebug command is fixed.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAl3mvYkACgkQxIHbvCwF
 GsTwNA//dr4Zzsxn+HsAqsriwCu8NrSFiJrLl/V4PKl4EdoZC7mG2XLEH1oWdny1
 TYORBwq5e+j6Qrja9b71N2BVoPQ69JNrZotDl0M7RhmpZ8STuAfhI+7uaM7FCKq5
 Gh2tpUpN3NSTUA18Gl2rJ9IDI7Yf5DFzoX2NKkoQs88Us5HXz6ddNugJFWYdl+Xg
 tAIpn+X8pwMeFkJ0Fp+ytyayBRNtU7Et6MudfdGeTtd6jRVpIkM5HODtmzallWN3
 hO58yHmU/zwze97MT8DEYV8lboxM1Fwdd9Jw6R8nPU/y4KPfIveHemXfqFd67CbJ
 8azfdyCRIkK04y6mhkJK/h+iHBXink363/SWgnHZG75C2LtvH33T5VW7PhPiKuQI
 hfuExLvXHjKYWW6Hkw//Yg4a33gEDR2M2wlNrcmi5SJTNT+dG7C4DjSmVE9qEGe/
 ykDX5DQFyO9UQk8lQgF5mTQ/jd60mcTc02pDaEUQ40n5+kZbTWoM0yKrMwLLRhz+
 pVUD/pJ29X8jO76YQK5UnCUZA9V/YJllasDZ9AV7uJc/Yov9PwpMe4It6goFqCT7
 HuMfN+Hx+Y531zZ1tHUGe7kush46HgAA6pxFi2NFKg+06tjQD0lTun1vD4xYFFtI
 Uu3kZ6Yk+kpDNj1h8HrDgw1HcPqohj7RGa60fSzMifRUxH9N6HA=
 =spg0
 -----END PGP SIGNATURE-----

Merge tag 'efi-2020-01-rc5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-01-rc5

A type error in the implementation of the efidebug command is fixed.
2019-12-03 18:12:58 -05:00
AKASHI Takahiro
0bffb8c46b cmd: efidebug: fix a build error in show_efi_boot_opt()
I detected the following error in sandbox with Clang on Travis CI:
    +cmd/efidebug.c:703:15: error: result of comparison of constant
     9223372036854775822 with expression of type 'int' is always false
     [-Werror,-Wtautological-constant-out-of-range-compare]
    +        else if (ret == EFI_NOT_FOUND)
    +                 ~~~ ^  ~~~~~~~~~~~~~

Simply changing a type of 'ret' to efi_status_t will fix this error.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-12-03 20:54:05 +01:00
Abhishek Shah
ca326781b4 cmd: pxe: Fix bootm argument count
pxe command parses the init ramfs address(through initrd lable in
pxe config file), but is not passing it to bootm command as argument
as bootm_argc count is not increased.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-12-03 08:43:24 -05:00
Tom Rini
4df23e58a4 blk: Make use of CONFIG_HAVE_BLOCK_DEVICE more
When we do not have CONFIG_BLK (or SPL/TPL) enabled there are very few
cases where we need the blk_legacy code linked in. To catch these, build
when we have CONFIG_HAVE_BLOCK_DEVICE set.  In addition, we only need
cmd/blk_common.o to be linked in when we have CONFIG_HAVE_BLOCK_DEVICE
set, so make use of that directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
2019-12-03 08:43:24 -05:00
Simon Glass
cb3ef6810a common: Move old EEPROM functions into a new header
These functions do not use driver model but are still used. Move them to a
new eeprom.h header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:25:25 -05:00
Simon Glass
428a6a18fe common: Drop board_show_dram()
This function is not defined by any boards so the feature is not used.
Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:25:02 -05:00
Simon Glass
36bf446b64 common: Move enable/disable_interrupts out of common.h
Move these two functions into the irq_funcs.h header file. Also move
interrupt_handler_t as this is used by the irq_install_handler() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:25:01 -05:00
Simon Glass
1eb69ae498 common: Move ARM cache operations out of common.h
These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:24:58 -05:00
Simon Glass
9edefc2776 common: Move some cache and MMU functions out of common.h
These functions belong in cpu_func.h. Another option would be cache.h
but that code uses driver model and we have not moved these cache
functions to use driver model. Since they are CPU-related it seems
reasonable to put them here.

Move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:55 -05:00
Simon Glass
62270f4395 common: Move some SMP functions out of common.h
These functions belong in cpu_func.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:14 -05:00
Simon Glass
b03e0510d7 common: Move serial functions out of common.h
These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:11 -05:00
Simon Glass
2189d5f1e8 Move strtomhz() to vsprintf.h
At present this function sits in its own file but it does not really
justify it. There are similar string functions in vsprintf.h, so move it
there. Also add the missing function comment.

Use the vsprintf.h include file explicitly where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:09 -05:00
Simon Glass
8bef79bf3c common: Move sorting functions to their own header file
These don't need to be in common.h so move them out into a new header.
Also add some missing comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:08 -05:00
Simon Glass
3db7110857 crc32: Use the crc.h header for crc functions
Drop inclusion of crc.h in common.h and use the correct header directly
instead.

With this we can drop the conflicting definition in fw_env.h and rely on
the crc.h header, which is already included.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:08 -05:00
Simon Glass
b2ea91ba57 crc: Fix code style with crc functions
Some of these have a space before the bracket. Drop it to fix the style.
Add some missing function comments while here.

Note that u32 and u8 cannot be used here since crc.h is included on the
host side.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:07 -05:00
Simon Glass
62f9b65447 common: Move older CPU functions to their own header
These should be moved to driver model, but in the meantime, move them
out of the common header to help reduce its size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:06 -05:00
Heinrich Schuchardt
3b4847cbee efi_loader: support building UEFI binaries on sandbox
On the sandbox the UEFI binaries must match the host architectures.

Adjust the Makefiles. Provide the PE/COFF header and relocation files.

Allow building helloworld.efi on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-11-12 23:13:54 +01:00
AKASHI Takahiro
fefff63633 cmd: move down CONFIG_CMD_BOOTEFI after CONFIG_BOOTM_VXWORKS
Due to the commit 4b0bcfa7c4 ("Kconfig: Migrate CONFIG_BOOTM_* options")
BOOTEFI and BOOTEFI_HELLO_COMPILE (and other BOOTEFI configs) are
displayed in a long distance. This will make it difficult for us to
understand that those configurations are closely related.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-11-08 07:10:14 -05:00
Alexander Dahl
672c57057f cmd: mtdparts: Fix build with option ..._SHOW_NET_SIZES
That option is currently not used by any defconfig and could not be set
anymore since it became mandatory to used Kconfig when introducing new
options with U-Boot v2016.11 or commit eed921d923 ("Kconfig: Add a
whitelist of ad-hoc CONFIG options") and commit 371244cb19 ("Makefile:
Give a build error if ad-hoc CONFIG options are added").

It was also not considered when fixing build warnings in
commit 39ac34473f ("cmd_mtdparts: use 64 bits for flash size,
partition size & offset") and could probably not be compiled anyway
after commit dfe64e2c89 ("mtd: resync with Linux-3.7.1"), which
renamed some members of struct mtd_info … so it was probably broken
since then, which was U-Boot v2013.07-rc1.

However it still seems to work, see example output below:

U-Boot 2019.10-00035-g06a9b259ca-dirty (Oct 30 2019 - 14:03:44 +0100)

CPU: SAMA5D27 1G bits DDR2 SDRAM
Crystal frequency:       24 MHz
CPU clock        :      492 MHz
Master clock     :      164 MHz
Model: ***
DRAM:  128 MiB
NAND:  256 MiB
Loading Environment from NAND... OK
In:    serial@f8020000
Out:   serial@f8020000
Err:   serial@f8020000
Net:   eth0: ethernet@f8008000
Hit keys 'tt' to stop autoboot (3 seconds).
U-Boot> mtdparts

device nand0 <atmel_nand>, # parts = 8
 #: name                size            net size        offset          mask_flags
 0: bootstrap           0x00040000      0x00040000      0x00000000      1
 1: uboot               0x000c0000      0x000c0000      0x00040000      1
 2: env1                0x00040000      0x00040000      0x00100000      0
 3: env2                0x00040000      0x00040000      0x00140000      0
 4: fpga_led            0x00040000      0x00040000      0x00180000      1
 5: reserved            0x00040000      0x00040000      0x001c0000      1
 6: rootfs_rec          0x03200000      0x03200000      0x00200000      1
 7: filesystem          0x0cc00000      0x0cb80000 (!)  0x03400000      0

active partition: nand0,0 - (bootstrap) 0x00040000 @ 0x00000000

defaults:
mtdids  : nand0=atmel_nand
mtdparts: mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256k(env1),256k(env2),256k(fpga_led)ro,256k(reserved)ro,50M(rootfs_rec)ro,-(filesystem)

Signed-off-by: Alexander Dahl <ada@thorsis.com>
2019-11-07 18:01:13 -05:00
Alexander Dahl
20841c52bb cmd: nand: Remove not used declaration
This declaration is not used anywhere in the whole tree. There is a
function 'mtd_id_parse()' which was renamed from 'id_parse()' in
commit 68d7d65100 ("Separate mtdparts command from jffs2"), but that
function is not used (anymore?) in cmd nand and build is fine without
that declaration, so it's probably just safe to remove.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
2019-11-07 18:01:13 -05:00
Tom Rini
a8c1846633 Merge branch 'master' of git://git.denx.de/u-boot-usb
- DFU updates
- USB Storage updates
2019-11-06 07:11:02 -05:00
Tom Rini
24b77393a5 Pull request for UEFI sub-system for efi-2020-01-rc2
Provide a better user interface for setting UEFI variables.
 
 Bug fixes:
 - ext4 file system not discovered on UEFI block device
 - 'make tests' build error on 32bit systems
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAl25wUcACgkQxIHbvCwF
 GsQ16w/+IibWYFw2t6AdI8DLWOvlHR/PVAOrbF9cBi1vZPr4drEH6m1ymRWAKjRt
 E4u8siBiIs5yhD7laL09JK4p/veTnoHCVrCdli9iPhIJUFGKz9uuXh4ruZgRnGIn
 +j0ra0tkTRHeGX4bMtTpMVySQqIuLQ+2ZrMMnfKfnTTlLmhv436xUyBZ/CFl7k4J
 7sFj/FfjRCYpe7nfHTqUGidJtJG1cc+hw26c1YrfiKB6piVdH43myOB5sPDW24g3
 OPptJyUFqbQjjV6Eq0EOVJt103rVtXpQc0e4Oa/mDDkmrQZ1pUhXi3zhxmzMRDQu
 k+9gX0IoSNJcW+e7DrcQsx5SmOnlvoC4euCypzhWEWvES89ftAHIitEAz9oTs6Gc
 etwXFomvH797ZOoBztrja9XsfnLFHBQHaAiExqEVVFi/1nhDsYdj+xEDHjDU+cZx
 E3UcrRNXcfA2+oaXpNBguzAOrMPX8UbrR1kkaMDTuJfA32Pe7RLz3aMfXyx1rAOU
 t7GWSROOYtoNf5IU/Jha1F8231WRPJnWm1LQdzNLaGSmbG/H7vFgW4dpdxEyLn4m
 C0Goj0GzmBIQxRL+38sCOKLVxPEpGoU/GzonC9bU0O+UyN57rAiwn9ZbTa6ZvJqG
 /2tPoKiutJRueUH3IDWViMhyW/w0h0tj0BUiV5lAQ9X9vW4E1YQ=
 =f0m8
 -----END PGP SIGNATURE-----

Merge tag 'efi-2020-01-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-01-rc2

Provide a better user interface for setting UEFI variables.

Bug fixes:
- ext4 file system not discovered on UEFI block device
- 'make tests' build error on 32bit systems
2019-11-01 09:37:02 -04:00
Sam Protsenko
965ec3caa8 cmd: avb: Support A/B slots
Add optional parameter to 'avb verify' sub-command, so that user is able
to specify which slot to use, in case when user's partitions are
slotted. If that parameter is omitted, the behavior of 'avb verify' will
be the same as before, so user API is content.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Acked-by: Igor Opaniuk <igor.opaniuk@gmail.com>
2019-10-31 07:22:53 -04:00