aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2018-07-20Merge git://git.denx.de/u-boot-x86Tom Rini1-1/+27
2018-07-20hashtable: do not recreate whole hash table if vars are passed to himport_rQuentin Schulz1-3/+10
When vars are passed to the himport_r function with H_NOCLEAR flag, those vars will be overridden in the current environment and if one of those vars is not in the imported environment, it'll be deleted in the current environment whatever the flag passed to himport_r. The H_NOCLEAR flag is used to clear the whole environment whether vars are passed to the function or not. This leads to incoherent behaviour. If one passes vars to himport_r with the H_NOCLEAR flag, if a var in vars is not in the imported env, that var will be removed from the current env. If one passes vars to himport_r without the H_NOCLEAR flag, the whole environment will be removed and vars will be imported from the environment in RAM. It makes more sense to keep the variable that is in the current environment but not in the imported environment if the H_NOCLEAR flag is set and remove only that variable if the H_NOCLEAR flag is not set. Let's clear the whole environment only if H_NOCLEAR and vars are not passed to himport_r. Let's remove variables that are in the current environment but not in the imported env only if the H_NOCLEAR flag is not passed. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
2018-07-20efi: app: Add a sysreset driverBin Meng1-1/+27
This adds the DM sysreset driver for EFI application support. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-19lib: fdtdec: Rename routine fdtdec_setup_memory_size()Siva Durga Prasad Paladugu1-1/+1
This patch renames the routine fdtdec_setup_memory_size() to fdtdec_setup_mem_size_base() as it now fills the mem base as well along with size. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-07-19lib: fdtdec: Update ram_base to store ram start adddressSiva Durga Prasad Paladugu1-0/+1
This patch updates the ram_base to store the start address of the first bank DRAM and the use this ram_base to calculate ram_top properly. This patch fixes the erroneous calculation of ram_top incase of non zero ram start address. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-07-19xilinx: zynq: Add support to secure imagesSiva Durga Prasad Paladugu1-0/+51
This patch basically adds two new commands for loadig secure images. 1. zynq rsa adds support to load secure image which can be both authenticated or encrypted or both authenticated and encrypted image in xilinx bootimage(BOOT.bin) format. 2. zynq aes command adds support to decrypt and load encrypted image back to DDR as per destination address. The image has to be encrypted using xilinx bootgen tool and to get only the encrypted image from tool use -split option while invoking bootgen. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-07-10board: arm: Add support for Broadcom BCM7445Thomas Fitzsimmons1-0/+4
Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT. Signed-off-by: Thomas Fitzsimmons <fitzsim@fitzsim.org> Cc: Stefan Roese <sr@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Florian Fainelli <f.fainelli@gmail.com>
2018-07-09fdt: Add device tree memory bindingsMichael Pratt1-0/+109
Support a default memory bank, specified in reg, as well as board-specific memory banks in subtree board-id nodes. This allows memory information to be provided in the device tree, rather than hard-coded in, which will make it simpler to handle similar devices with different memory banks, as the board-id values or masks can be used to match devices. Signed-off-by: Michael Pratt <mpratt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-07-02efi_loader: helloworld: Output ACPI configuration tableBin Meng1-0/+4
Output ACPI configuration table if it exists. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-07-02efi_loader: Install ACPI configuration tablesBin Meng2-0/+43
ACPI tables can be passed via EFI configuration table to an EFI application. This is only supported on x86 so far. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-02efi_loader: Increase number of configuration tables to 16Bin Meng1-1/+1
At present the number of configuration tables is set to 2. By looking at which tables the Linux EFI stub or iPXE can process, it looks 16 is a reasonable number. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-06-24efi: stub: Move the use_uart assignment immediately after ↵Bin Meng1-3/+3
exit_boot_services() call The use_uart assignment should follow immediately after the call to exit_boot_services(), in case we want some debug output after that. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-06-24efi.h: Do not use config optionsAlexander Graf1-2/+2
Currently efi.h determines a few bits of its environment according to config options. This falls apart with the efi stub support which may result in efi.h getting pulled into the stub as well as real U-Boot code. In that case, one may be 32bit while the other one is 64bit. This patch changes the conditionals to use compiler provided defines instead. That way we always adhere to the build environment we're in and the definitions adjust automatically. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: added some comments to describe the __x86_64__ check] Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-06-21efi_loader: Fix GOP 32bpp exposureAlexander Graf1-1/+1
We store pixels as BGRA in memory, as can be seen from struct efi_gop_pixel. So we need to expose the same format to UEFI payloads to actually have them use the correct colors. Reported-by: Fabian Vogt <fvogt@suse.com> Tested-by: Peter Robinson <pbrobinson@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-19libavb: Update SPDX tag styleTom Rini36-73/+36
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-06-19rsa: Fix missing memory leak on error in fdt_add_bignum()Simon Glass1-3/+10
Thsi function can fail without freeing all its memory. Fix it. Reported-by: Coverity (CID: 131217) Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-18avb2.0: integrate avb 2.0 into the build systemIgor Opaniuk3-0/+30
Integrate libavb into the build system. Introduce CONFIG_LIBAVB build option. Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-06-18avb2.0: add Android Verified Boot 2.0 libraryIgor Opaniuk35-0/+6698
Add libavb lib (3rd party library from AOSP), that implements support of AVB 2.0. This library is used for integrity checking of Android partitions on eMMC. libavb was added as it is and minimal changes were introduced to reduce maintenance cost, because it will be deviated from AOSP upstream in the future. Changes: - license headers changed to conform SPDX-style - avb_crc32.c dropped - updates in avb_sysdeps_posix.c/avb_sysdeps.h For additional details check [1] AVB 2.0 README. [1] https://android.googlesource.com/platform/external/avb/+/master/README.md Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-06-17efi: stub: Pass EFI GOP information to U-Boot payloadBin Meng1-0/+15
If UEFI BIOS has the graphics output protocol (GOP), let's pass its information to U-Boot payload so that U-Boot can utilize it (eg: an EFI framebuffer driver). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-06-17x86: use EFI calling convention for efi_main on x86_64Ivan Gorinov2-2/+4
UEFI specifies the calling convention used in Microsoft compilers; first arguments of a function are passed in (%rcx, %rdx, %r8, %r9). All other compilers use System V ABI by default, passing first integer arguments of a function in (%rdi, %rsi, %rdx, %rcx, %r8, %r9). These ABI also specify different sets of registers that must be preserved across function calls (callee-saved). GCC allows using the Microsoft calling convention by adding the ms_abi attribute to a function declaration. Current EFI implementation in U-Boot specifies EFIAPI for efi_main() in the test apps but uses default calling convention in lib/efi. Save efi_main() arguments in the startup code on x86_64; use EFI calling convention for _relocate() on x86_64; consistently use EFI calling convention for efi_main() everywhere. Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com> Reviewed-by: Alexander Graf <agraf@suse.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2018-06-14Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini2-0/+18
Patch queue for efi - 2018-06-14 A few minor fixes for the release: - Compile fixes - HI20 relocations for RISC-V - Fix bootefi without load path - Fix Runtime Services with certain compilers
2018-06-14efi: Add a comment about duplicated ELF constantsSimon Glass1-0/+4
These constants are defined in arch-specific code but redefined here. Add a TODO to clean this up. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-14riscv: Add support for HI20 PE relocationsAlexander Graf1-0/+14
The PE standard allows for HI20/LOW12 relocations. Within the efi_loader target we always know that our relocation target is 4k aligned, so we don't need to worry about the LOW12 part. This patch adds support for the respective relocations. With this and a few grub patches I have cooking in parallel I'm able to run grub on RISC-V. Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-13Merge git://git.denx.de/u-boot-x86Tom Rini2-5/+9
2018-06-13lib: Add hexdumpAlexey Brodkin4-14/+255
Often during debugging session it's very interesting to see what data we were dealing with. For example what we write or read to/from memory or peripherals. This change introduces functions that allow to dump binary data with one simple function invocation like: ------------------->8---------------- print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len); ------------------->8---------------- which gives us the following: ------------------->8---------------- 00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115 00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con 00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520 00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3. 00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage. 00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9 00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr 00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde 00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022 00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial 000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou 000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220 000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00.............. ... ------------------->8---------------- Source of hexdump.c was copied from Linux kernel v4.7-rc2. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Mario Six <mario.six@gdsys.cc> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Stefan Roese <sr@denx.de>
2018-06-13x86: efi: payload: Minor clean up on error message outputBin Meng1-3/+5
If GetMemoryMap() fails, we really want to know EFI_BITS_PER_LONG instead of BITS_PER_LONG. A space and LF are added in places where error message is output to improve readability. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-06-13x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codesBin Meng1-2/+4
Attempting to use a toolchain that is preconfigured to generate code for the 32-bit architecture (i386), for example, the i386-linux-gcc toolchain on kernel.org, to compile the 64-bit EFI payload does not build. This updates the makefile fragments to ensure '-m64' is passed to toolchain when building the 64-bit EFI payload stub codes. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-06-03SPDX: Fixup tags from latest EFI PRTom Rini1-2/+1
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-06-03efi_loader: Fix warning in raw/cols queryAlexander Graf1-1/+1
The code to determine rows / cols on the screen could potentially run into a case where it doesn't know how big the screen is. In that case, assume 80x25. Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: create handles from normal memoryHeinrich Schuchardt1-7/+6
Handles are not used at runtime. They are freed by the firmware when the last protocol interface is uninstalled. So there is no reason to use EFI memory when creating handles. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: efi_mem_carve_out should return s64Heinrich Schuchardt1-14/+18
efi_mem_carve_out() is used to remove memory pages from a mapping. As the number of pages to be removed is a 64bit type the return type should be 64bit too. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: avoid anonymous constants for AllocatePagesHeinrich Schuchardt1-3/+5
Do not use anonymous constants when calling efi_allocage_pages. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: check for buffer overflow in efi_get_variableIvan Gorinov1-1/+17
Allocate a buffer on the stack instead of an array of uninitialized pointers; check if GetVariable writes past the end of the buffer. Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: imply FAT, FAT_WRITEHeinrich Schuchardt1-0/+2
efi_selftest_block_device accesses a FAT file system. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: DocBook comments for boot servicesHeinrich Schuchardt1-396/+436
With 'make htmldocs' we can generate a documentation if the function comments follow the DocBook conventions. This patch adjusts the comments for EFI boot services and provides the DocBook template for the EFI subsystem. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi: Update some comments related to smbios tablesSimon Glass1-1/+6
Clarify the operation of this code with some additional comments. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: test unaligned memory accessHeinrich Schuchardt2-0/+71
According to the UEFI spec unaligned memory access should be enabled on CPUs supporting it. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: test ReinstallProtocolInterfaceHeinrich Schuchardt1-3/+32
Add a test for ReinstallProtocolInterface to the controller selftest. As ReinstallProtocolInterface has to connect controllers to the new interface is does not fit to the manage protocols selftest. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: implement ReinstallProtocolInterfaceHeinrich Schuchardt1-23/+43
The ReinstallProtocolInterface boot time service is implemented. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: check interface when uninstalling protocolHeinrich Schuchardt1-0/+2
The interface has to be checked in UninstallProtocolInterface. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: correct efi_selftest_manageprotocolsHeinrich Schuchardt1-1/+1
Pass the correct interface when uninstalling a protocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: fix off-by-one bug in efi_get_variableIvan Gorinov1-24/+16
efi_get_variable() always stores an extra zero byte after the output data. When the returned data size matches the output buffer size, the extra zero byte is stored past the end of the output buffer. Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: avoid using unitialized values as console sizeHeinrich Schuchardt1-2/+12
If a request for the console size would be answered with a response with less then three values, uninitialized stack memory would be copied to the number of rows and columns of the terminal. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: unit test for variable servicesHeinrich Schuchardt2-0/+181
Provide a unit test for variable services. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: adjust definitions of variable servicesHeinrich Schuchardt3-22/+22
The definitons of the variable services are adjusted: - use efi_uintn_t instead of unsigned long - use u16 * instead of s16 * for Unicode strings - correct definition of QueryVariableInfo - rename efi_get_next_variable to efi_get_next_variable_name Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: always check parameters in efi_cout_query_mode()Heinrich Schuchardt1-42/+48
If we cannot determine the size of the serial terminal we still have to check the parameters of efi_cout_query_mode(). Querying the size of the serial terminal drains the keyboard buffer. So make sure we do this during the initialization and not in the midst of an EFI application. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: updating the cursor positionHeinrich Schuchardt1-0/+78
The test case for text output is updated to check correct updating of the cursor position. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: updating the cursor positionHeinrich Schuchardt1-8/+19
The current coding advances the column by the number of UTF-8 bytes. The column should be increased by one per unicode character. The UEFI spec provides advance rules for U+0000, U+0008, U+000A, and U000D. All other characters, including control characters U+0007 (bel) and U+0009 (tab), have to increase the column by one. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: remove unnecessary includeHeinrich Schuchardt4-4/+0
asm/global_data.h is already included via common.h. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_loader: if EFI_LOADER is enabled, enable CFB_CONSOLE_ANSIHeinrich Schuchardt1-0/+1
EFI applications like GRUB issue ANSI sequences for setting colors and for positioning. So if the EFI subsystem is enabled, we should also enable ANSI control sequences by default. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>