summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-12-03efi_loader: add firmware management protocol for raw imageAKASHI Takahiro
In this commit, a very simple firmware management protocol driver is implemented. It will take a binary image in a capsule file and apply the data using dfu backend storage drivers via dfu_write_by_alt() interface. So "dfu_alt_info" variable should be properly set to specify a device and location to be updated. Please read README.dfu. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-12-03efi_loader: add firmware management protocol for FIT imageAKASHI Takahiro
In this commit, a very simple firmware management protocol driver is implemented. It will take a common FIT image firmware in a capsule file and apply the data using dfu backend storage drivers via update_fit() interface. So "dfu_alt_info" variable should be properly set to specify a device and location to be updated. Please read README.dfu. Fit image is a common file format for firmware update on U-Boot, and this protocol works neatly just as a wrapper for one. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-12-03efi_loader: capsule: support firmware updateAKASHI Takahiro
A capsule tagged with the guid, EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID, is handled as a firmware update object. What efi_update_capsule() basically does is to load any firmware management protocol (or fmp) drivers contained in a capsule, find out an appropriate fmp driver and then invoke its set_image() interface against each binary in a capsule. In this commit, however, loading drivers is not supported. The result of applying a capsule is set to be stored in "CapsuleXXXX" variable, but its implementation is deferred to a fmp driver. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-12-03efi_loader: capsule: add memory range capsule definitionsAKASHI Takahiro
Memory range capsule gives us a way to notify that some memory regions should be left untouched across the next reset. See UEFI specification, section 8.5.3. Since how we should handle this kind of capsule is totally up to the system, no implementation will be added in this commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-12-03efi_loader: capsule: add capsule_on_disk supportAKASHI Takahiro
Capsule data can be loaded into the system either via UpdateCapsule runtime service or files on a file system (of boot device). The latter case is called "capsules on disk", and actual updates will take place at the next boot time. In this commit, we will support capsule on disk mechanism. Please note that U-Boot itself has no notion of "boot device" and all the capsule files to be executed will be detected only if they are located in a specific directory, \EFI\UpdateCapsule, on a device that is identified as a boot device by "BootXXXX" variables. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-12-03efi_loader: define UpdateCapsule apiAKASHI Takahiro
In this commit, skeleton functions for capsule-related API's are added under CONFIG_EFI_UPDATE_CAPSULE configuration. Detailed implementation for a specific capsule type will be added in the succeeding patches. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-12-03common: update: fix an "unused" warning against update_flash()AKASHI Takahiro
Since update_flash() is used only in update_tftp(), it should be guarded with appropriate config options. After the commit 3149e524fc1e, common/update.c will be built under either CONFIG_UDATE_TFTP, CONFIG_DFU_TFTP or CONFIG_UPDATE_FIT. Since CONFIG_UPDATE_FIT, hence fit_update(), doesn't rely on update_flash(), the compiler may cause an "unused" warning if CONFIG_UPDATE_FIT=y and CONFIG_UPDATE_TFTP=n and CONFIG_DFU_TFTP=n. This is, for example, the case for sandbox defconfig where EFI_CAPSULE_FIRMWARE_FIT is enabled for test purpose. Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT image") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-12-03cmd: efidebug: Add support for TCG2 final events tableIlias Apalodimas
A previous commit is adding EFI_TCG2_PROTOCOL, which in it's eventlog support registers an EFI configuration table. Let's add the necessary GUID so 'efidebug table' command can display table names properly. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2020-12-03efi_loader: Introduce eventlog support for TCG2_PROTOCOLIlias Apalodimas
In the previous patches we only introduced a minimal subset of the EFI_TCG2_PROTOCOL protocol implementing GetCapability(). So let's continue adding features to it, introducing the GetEventLog() and HashLogExtendEvent() functions. In order to do that we first need to construct the eventlog in memory, specifically in EFI_BOOT_SERVICES_DATA memory and a configuration table from EFI_ACPI_MEMORY_NVS. U-Boot won't currently add any events to the log or measure any components, but will expose the necessary EFI APIs for applications to do so. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2020-12-03tpm: Add tpm2 headers for TCG2 eventlog supportIlias Apalodimas
A following patch introduces support for the EFI_TCG2_PROTOCOL eventlog management. Introduce the necessary tpm related headers Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2020-12-03tpm: use more than sha256 on pcr_extendIlias Apalodimas
The current tpm2_pcr_extend is hardcoded using SHA256. Let's make the actual command to the TPM2 configurable so we can support a wider range of algorithms and keep the current command line as-is i.e limited to SHA256 only Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-12-03efi_loader: replace printf by log in efi_uclass.cHeinrich Schuchardt
Use logging functions instead of printf() and debug(). Change logging messages for uclass creation and destruction to log_debug(). Reported-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-12-02Merge branch '2020-12-01-next-imports' into nextTom Rini
- More IPQ40xx improvements - Add string support to setexpr (and tests) - ProxyDHCP support - Assorted cleanups
2020-12-01km/arm: coding style clean upHolger Brunck
Address most of the checkpatch issues we found in km_arm and common km code. CC: Stefan Roese <sr@denx.de> CC: Valentin Longchamp <valentin.longchamp@hitachi-powergrids.com> Signed-off-by: Holger Brunck <holger.brunck@hitachi-powergrids.com> Reviewed-by: Stefan Roese <sr@denx.de>
2020-12-01spl: spl_fit.c: enable check of signature for config node in spl/tplPhilippe Reynes
This commit add the support of signature check for config node in spl/tpl when the function spl_load_simple_fit is used. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-12-01IPQ40xx: clk: add USB clock handlingRobert Marko
USB clocks were completely forgotten as driver would always return 0 even if clock ID was unknown. This behaviour changed with "IPQ40xx: clk: dont always return 0" and this will now causes the USB-s to fail probing as clock enable will return -EINVAL. So to fix that lets add all of the USB clocks to the driver. Fixes: 430e1dcf ("IPQ40xx: Add USB nodes") Signed-off-by: Robert Marko <robert.marko@sartura.hr> Cc: Luka Perkov <luka.perkov@sartura.hr>
2020-12-01IPQ40xx: clk: dont always return 0Robert Marko
Currently the driver will go through the clock ID-s and set/enable them as needed. But if the ID is unknown it will fall through the switch case to the default case which will always return 0. This is not correct and default cases should return a error code since clock ID is unknown. So lets return -EINVAL instead. Signed-off-by: Robert Marko <robert.marko@sartura.hr> Cc: Luka Perkov <luka.perkov@sartura.hr>
2020-12-01IPQ40xx: clk: drop breaks in switch caseRobert Marko
There is no point in having break statements in the switch case as there is already a return before break. So lets drop them from the driver. Signed-off-by: Robert Marko <robert.marko@sartura.hr> Cc: Luka Perkov <luka.perkov@sartura.hr>
2020-12-01IPQ40xx: clk: use dev_read_addr()Robert Marko
Lets convert the driver to use dev_read_addr() instead of the devfdt_get_addr(). While we are here, lets also alphabetise the includes. Signed-off-by: Robert Marko <robert.marko@sartura.hr> Cc: Luka Perkov <luka.perkov@sartura.hr>
2020-12-01cmd: Kconfig: migrate CONFIG_SYS_PROMPT_HUSH_PS2Patrick Delaunay
Move CONFIG_SYS_PROMPT_HUSH_PS2 in Kconfig, depending on CONFIG_HUSH_PARSER, and remove the default value defined in cli_hush.c under __U_BOOT__. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-12-01hush: Remove default CONFIG_SYS_PROMPT_HUSH_PS2 setting from board filesPatrick Delaunay
There is no reason to define default option for this macro which is already done in common/cli_hush.c. 87 #ifndef CONFIG_SYS_PROMPT_HUSH_PS2 88 #define CONFIG_SYS_PROMPT_HUSH_PS2 "> " 89 #endif Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
2020-12-01net: sntp: remove CONFIG_TIMESTAMP constraintHeinrich Schuchardt
CONFIG_TIMESTAMP is not related to the RTC drivers. It does not make any sense to let the updating of the RTC by the sntp command depend on it. Drop the CONFIG_TIMESTAMP checks. Furthermore function dm_rtc_set() is enabled by CONFIG_DM_RTC. There is no reason to require CONFIG_CMD_DATE when using a driver model RTC. The UEFI sub-system can consume the RTC functions even if there is not date command. Only check CONFIG_CMD_DATE when using a non-driver model RTC. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-12-01setexpr: Add support for stringsSimon Glass
Add support for dealing with string operands, including reading a string from memory into an environment variable and concatenating two strings. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Behún <marek.behun@nic.cz>
2020-12-01setexpr: Convert to use a struct for valuesSimon Glass
At present a ulong is used to hold operand values. This means that strings cannot be used. While most operations are not useful for strings, concatenation is. As a starting point to supporting strings, convert the code to use a struct instead of a ulong for operands. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Correct buffer overflow bug and enable testsSimon Glass
At present when more than one substitution is made this function overwrites its buffers. Fix this bug and update the tests now that they can pass. Also update the debug code to show all substrings, since at present it omits the final one. Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution") Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Correct dropping of final unmatched stringSimon Glass
At present the 'nlen' variable increases with each loop. If the previous loop had back references, then subsequent loops without back references use the wrong value of nlen. The value is larger, meaning that the string terminator from nbuf is copied along to the main buffer, thus terminating the string prematurely. This leads to the final result being truncated, e.g. missing the last (unmatched) part of the string. So "match match tail" become "replaced replaced" instead of "replaced replaced tail". Fix this by resetting nlen to the correct value each time around the lop. Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution") Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Add some tests for buffer overflow and backrefSimon Glass
Add tests to check for buffer overflow using simple replacement as well as back references. At present these don't fully pass. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Split the core logic into its own functionSimon Glass
At present this function always allocates a large amount of stack, and selects its own size for buffers. This makes it hard to test the code for buffer overflow. Separate out the inner logic of the substitution so that tests can call this directly. This will allow checking that the algorithm does not overflow the buffer. Fix up one of the error lines at the same time, since it should be printing nbuf_size, not data_size. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01test: Add some setexpr regex testsSimon Glass
Add tests for the setexpr regex commands. Note that these tests currently crash on sandbox due to an existing bug in the setexpr implementation, so two of the tests are commented out. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01setexpr: Add explicit support for 32- and 64-bit intsSimon Glass
At present this function assumes that a size of 4 refers to a ulong. This is true on 32-bit machines but not commonly on 64-bit machines. This means that the 'l' specify does not work correctly with setexpr. Add an explicit case for 32-bit values so that 64-bit machines can still use the 'l' specifier. On 32-bit machines, 64-bit is still not supported. This corrects the operation of the default size (which is 4 for setexpr), so update the tests accordingly. The original code for reading from memory was included in 47ab5ad1457 ("cmd_setexpr: allow memory addresses in expressions") but I am not adding a Fixes: tag since that code was not written with 64-bit machines in mind. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01command: Add constants for cmd_get_data_size string / errorSimon Glass
At present these values are open-coded in a few places. Add constants so the meaning is clear. Also add a comment to cmd_get_data_size() Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01test: Add some tests for setexprSimon Glass
This command currently has no tests. Add some for basic assignment and the integer operations. Note that the default size for setexpr is ulong, which varies depending on the build machine. So for sandbox on a 64-bit host, this means that the default size is 64 bits. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01Makefile: Correctly propagate failure when removing targetPali Rohár
On more places is used pattern 'command > $@ || rm -f $@'. But it does not propagate failure from 'command' as 'rm -f' returns success. Fix it by calling 'false' to correctly propagate failure after 'rm -f'. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-12-01gpio: Convert to use APIs which support live DTPatrick Delaunay
Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the driver can support live DT. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2020-12-01Adds basic support for ProxyDHCPLyle Franklin
- ProxyDHCP allows a second DHCP server to exist alongside your main DHCP server and supply additional BOOTP related options - When u-boot sends out a DHCP request, the real DHCP server will respond with a normal response containing the new client IP address while simultaneously the ProxyDHCP server will respond with a blank client IP address and a `bootfile` option - This patch adds CONFIG_SERVERIP_FROM_PROXYDHCP (default false) to enable this behavior and CONFIG_SERVERIP_FROM_PROXYDHCP_DELAY_MS (default 100) which tells u-boot to wait additional time after receiving the main DHCP response to give the ProxyDHCP response time to arrive - The PXE spec for ProxyDHCP is more complicated than the solution added here as diagramed on page 16: http://www.pix.net/software/pxeboot/archive/pxespec.pdf: ``` DHCP Discover will be retried four times. The four timeouts are 4, 8, 16 and 32 seconds respectively. If a DHCPOFFER is received without an Option timeouts in an attempt to receive a PXE response. ``` - Adding a simple delay worked for my purposes but let me know if a more robust solution is required Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com>
2020-12-01cmd: pxe: Use internal FDT if retrieving from FDTDIR failsAnton Leontiev
As FDTDIR label doesn't specify exact file to be loaded, it should not fail if no file exists in the directory. In this case try to boot with internal FDT if it exists. Signed-off-by: Anton Leontiev <aleontiev@elvees.com>
2020-11-30Prepare v2021.01-rc3Tom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2020-11-30configs: Resync with savedefconfigTom Rini
Rsync all defconfig files using moveconfig.py Signed-off-by: Tom Rini <trini@konsulko.com>
2020-11-29Merge tag 'mmc-2020-11-29' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-mmc - mmc minor update for better debug and error check - fsl_esdhc sysctl set and make sure delay check for HS400
2020-11-29Merge tag 'efi-2021-01-rc3-3' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2021-01-rc3 (3) The following errors are corrected: * Linux crash when accessing UEFI variables at runtime. * UEFI variable using standalone MM on 32 bit systems not working due to missing packing of communication structure * NULL dereference when FAT16 root directory is full * FAT files with a short file name starting with 0xE5 (0x05 in directory entry) where treated as deleted. The UEFI SetTime() service is enabled on ARM QEMU.
2020-11-29charset: make u16_strnlen accessible at runtimeIlias Apalodimas
commit 1fabfeef506c ("efi_loader: parameter check in GetNextVariableName()") introduces a check using u16_strnlen(). This code is used on EFI runtime variables as well, so unless we mark it as runtime, the kernel will crash trying to access it. Fixes: 1fabfeef506c ("efi_loader: parameter check in GetNextVariableName()") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-11-29lib/efi_loader: fix ABI in efi_mm_communicate_headerEtienne Carriere
Pack struct efi_mm_communicate_header as done in EDK2 as seen in release 201808 [1]. If not packed sizeof() for the structure adds 4 additional bytes on 32bit targets which breaks the ABI. Link: [1] https://github.com/tianocore/edk2/blob/edk2-stable201808/MdePkg/Include/Protocol/MmCommunication.h#L21 Fixes: 23a397d2e2fb ("efi_loader: Add headers for EDK2 StandAloneMM communication") Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2020-11-29efi_loader: enable EFI_SET_TIME on sandbox and QEMU ARMHeinrich Schuchardt
Enable EFI_SET_TIME on the sandbox and QEMU ARM to ensure that we compile and test the relevant code. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-11-29fs: fat: use ATTR_ARCH instead of anonymous 0x20Heinrich Schuchardt
Using constants instead of anonymous numbers increases code readability. Fixes: 704df6aa0a28 ("fs: fat: refactor write interface for a file offset") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-11-29fs: fat: directory entries starting with 0x05Heinrich Schuchardt
0x05 is used as replacement letter for 0xe5 at the first position of short file names. We must not skip over directory entries starting with 0x05. Cf. Microsoft FAT Specification, August 30 2005 Fixes: 39606d462c97 ("fs: fat: handle deleted directory entries correctly") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-11-29fs: fat: avoid NULL dereference when root dir is fullHeinrich Schuchardt
When trying to create a file in the full root directory of a FAT32 filesystem a NULL dereference can be observed. When the root directory of a FAT16 filesystem is full fill_dir_slot() must return -1 to signal that a new directory entry could not be allocated. Fixes: cd2d727fff7e ("fs: fat: allocate a new cluster for root directory of fat32") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-11-28Merge https://gitlab.denx.de/u-boot/custodians/u-boot-i2cTom Rini
2020-11-28riscv: sifive/fu540: kconfig: Enable support for Opencores I2C controllerPragnesh Patel
Enable support for SiFive FU540 Opencores I2C master controller. Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> Reviewed-by: Rick Chen <rick@andestech.com>
2020-11-28i2c: ocores: add i2c driver for OpenCores I2C controllerPragnesh Patel
Add support for the OpenCores I2C controller IP core (See http://www.opencores.org/projects.cgi/web/i2c/overview). This driver implementation is inspired from the Linux OpenCores I2C driver available. Thanks to Peter Korsgaard <peter@korsgaard.com> for writing Linux OpenCores I2C driver. Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> Reviewed-by: Rick Chen <rick@andestech.com>
2020-11-28i2c: designware_i2c: Don't warn if no reset controllerSimon Glass
At present if CONFIG_RESET is not enabled, this code shows a warning: designware_i2c_ofdata_to_platdata() i2c_designware_pci i2c2@16,0: Can't get reset: -524 Avoid this by checking if reset is supported, first. Fixes: 622597dee4f ("i2c: designware: add reset ctrl to driver") Signed-off-by: Simon Glass <sjg@chromium.org>