summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'efi-2019-07-rc1-2' of git://git.denx.de/u-boot-efiTom Rini2019-04-158-88/+106
|\ | | | | | | | | | | | | | | | | | | | | | | Pull request for UEFI sub-system for v2019.07-rc1 (2) In the aarch64 crash dump information about the loaded EFI images is added. In README.uefi the development target is for the UEFI subsystem is described as "Embedded Base Boot Requirements (EBBR) Specification" compliance. Several bug fixes are supplied.
| * efi_selftest: expect boot services data for fdtHeinrich Schuchardt2019-04-121-3/+3
| | | | | | | | | | | | | | | | | | In a previous patch the memory type used for the FDT has been changed to boot services data. We have to adjust the test. Correct an incorrect comment. The tested services are boot services. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: simplify protocol installationHeinrich Schuchardt2019-04-121-51/+25
| | | | | | | | | | | | | | | | By using InstallMultipleProtocolInterfaces() the coding for installing protocol interfaces on the root node can be simplified. Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: export efi_install_multiple_protocol_interfacesHeinrich Schuchardt2019-04-121-1/+1
| | | | | | | | | | | | | | Export function efi_install_multiple_protocol_interfaces() so that we can call it in others parts of the UEFI subsystem. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_selftest: physical and virtual addresses must matchHeinrich Schuchardt2019-04-121-0/+5
| | | | | | | | | | | | | | At boottime physical and virtual addresses must match. Add a corresponding check to the memory unit test. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: update virtual address in efi_mem_carve_outHeinrich Schuchardt2019-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Handle virtual address in efi_mem_carve_out() function when a new region is created to avoid issue in EFI memory map. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> At boottime physical and virtual addressed have to be the same. This allowed to simplify the proposed logic. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: add protection for block_devPatrick Delaunay2019-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Check the value of block_dev before to use this pointer. This patch solves problem for the command "load" when ubifs is previously mounted: in this case the function blk_get_device_part_str("ubi 0") don't return error but return block_dev = NULL and then data abort. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: fix setting PlatformLangHeinrich Schuchardt2019-04-122-15/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UEFI variables PlatformLang and PlatformLangCodes specify the current firmware language and the list of all available languages. Currently their values are hard coded. With the patch a new configuration variable EFI_PLATFORM_LANG_CODES is provided. When initializing the UEFI subsystem this configuration variable is used to initialize PlatformLangCodes. The value of variable PlatformLang is read. If it is not set, the first language specified in EFI_PLATFORM_LANG_CODES is used to initialize PlatformLang. Suggested-by: Takahiro Akashi <takahiro.akashi@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: move efi_save_gd() call to board_r.cHeinrich Schuchardt2019-04-122-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first functions of the UEFI sub-system are invoked before reaching the U-Boot shell, e.g. efi_set_bootdev(), efi_dp_from_name(), efi_dp_from_file(). We should be able to print out device paths for debugging purposes here. When printing device paths via printf("%pD\n", dp) this invokes functions defined as EFIAPI. So efi_save_gd() must be called beforehand. So let's move the efi_save_gd() call to function initr_reloc_global_data(() in board_r.c. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: remove stray #define LOG_CATEGORY LOGL_ERRHeinrich Schuchardt2019-04-121-2/+0
| | | | | | | | | | | | | | The statement '#define LOG_CATEGORY LOGL_ERR' makes not sense. LOGL_ERR is not a LOG_CATEGORY. Remove the statement. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: enable HII protocols by defaultHeinrich Schuchardt2019-04-121-5/+2
| | | | | | | | | | | | As the UEFI shell requires the HII protocols let's enable them by default. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: assign HII protocols to root nodeHeinrich Schuchardt2019-04-122-20/+20
| | | | | | | | | | | | | | We should not install the HII protocols on every loaded image. It is sufficient to install them once on the root node. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | Merge branch 'master' of git://git.denx.de/u-boot-spiTom Rini2019-04-141-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: arch/arm/dts/armada-385-amc.dts arch/arm/dts/armada-xp-theadorable.dts arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi Signed-off-by: Tom Rini <trini@konsulko.com>
| * | x86: dts: switch spi-flash to jedec, spi-nor compatibleNeil Armstrong2019-04-121-1/+1
| |/ | | | | | | | | | | | | | | | | | | The x86 code and DT uses "spi-flash" to detect a flash node, switch to "jedec,spi-nor" in the DTS files and in fdtdec by switching the GENERIC_SPI_FLASH value to to jedec,spi-nor. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Jagan Teki <jagan@openedev.com>
* | fdtdec: test: Add carveout testsThierry Reding2019-04-111-0/+152
| | | | | | | | | | | | | | Implement carveout tests for 32-bit and 64-bit builds. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | fdtdec: test: Use compound statement macrosThierry Reding2019-04-111-42/+22
| | | | | | | | | | | | | | | | This eliminates the need for intermediate helper functions and allow the macros to return a value so that it can be used subsequently. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | fdtdec: test: Fix build warningThierry Reding2019-04-111-0/+2
| | | | | | | | | | | | | | | | Hide the declaration of the "fd" variable When not building a DEBUG configuration, to avoid the variable being unused. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | fdtdec: Add Kconfig symbol for testsThierry Reding2019-04-111-0/+4
| | | | | | | | | | | | | | | | | | Runtime tests are provided as a test_fdtdec command implementation. Add a Kconfig symbol that allows this command to be built so that the tests can be used. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | fdtdec: Implement carveout support functionsThierry Reding2019-04-111-0/+87
| | | | | | | | | | | | | | | | | | | | The fdtdec_get_carveout() and fdtdec_set_carveout() function can be used to read a carveout from a given node or add a carveout to a given node using the standard device tree bindings (involving reserved-memory nodes and the memory-region property). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
* | fdtdec: Implement fdtdec_add_reserved_memory()Thierry Reding2019-04-111-0/+131
| | | | | | | | | | | | | | This function can be used to add subnodes in the /reserved-memory node. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
* | fdtdec: Implement fdtdec_set_phandle()Thierry Reding2019-04-111-0/+7
| | | | | | | | | | | | This function can be used to set a phandle for a given node. Signed-off-by: Thierry Reding <treding@nvidia.com>
* | libfdt: Add phandle generation helperThierry Reding2019-04-111-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new fdt_generate_phandle() function can be used to generate a new, unused phandle given a specific device tree blob. The implementation is somewhat naive in that it simply walks the entire device tree to find the highest phandle value and then returns a phandle value one higher than that. A more clever implementation might try to find holes in the current set of phandle values and fill them. But this implementation is relatively simple and works reliably. Also add a test that validates that phandles generated by this new API are indeed unique. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | vsprintf: Support phys_addr_t specifier unconditionallyThierry Reding2019-04-111-1/+1
|/ | | | | | | | | | | | When phys_addr_t printf specifier support was first introduced in commit 1eebd14b7902 ("vsprintf: Add modifier for phys_addr_t"), it was enabled only if CONFIG_CMD_NET was selected. Since physical addresses are not unique to networking support it doesn't make sense to conditionally add it in those cases only. Move support for it outside of the CMD_NET guard so that the specifier is always supported. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-shTom Rini2019-04-112-16/+47
|\ | | | | | | - Various rmobile fixes
| * lib: fdt: Allow LZO and GZIP DT compression in U-BootMarek Vasut2019-04-092-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Add required Kconfig symbols, Makefile bits and macro fixes in a few places to support LZO and DT compression in U-Boot. This can save a lot of space with multi-DTB fitImages. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
| * lib: fdt: Allow enabling both LZO and GZIP DT compressionMarek Vasut2019-04-091-6/+13
| | | | | | | | | | | | | | | | | | | | | | Allow enabling both LZO and GZIP DT compression in SPL and fix a bug where if the GZIP decompression failed, the LZO decompression would not even be attempted. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
| * lib: fdt: Split fdtdec_setup_memory_banksize()Marek Vasut2019-04-091-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Split fdtdec_setup_memory_banksize() into fdtdec_setup_memory_banksize_fdt(), which allows the caller to pass custom blob into the function and the original fdtdec_setup_memory_banksize(), which uses the gd->fdt_blob. This is useful when configuring the DRAM properties from a FDT blob fragment passed in by the firmware. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * lib: fdt: Split fdtdec_setup_mem_size_base()Marek Vasut2019-04-091-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Split fdtdec_setup_mem_size_base() into fdtdec_setup_mem_size_base_fdt(), which allows the caller to pass custom blob into the function and the original fdtdec_setup_mem_size_base(), which uses the gd->fdt_blob. This is useful when configuring the DRAM properties from a FDT blob fragment passed in by the firmware. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | efi_loader: correct CTRL-A - CTRL-Z console inputHeinrich Schuchardt2019-04-071-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | In the extended text input protocol CTRL-A - CTRL-Z have to be signaled as Unicode characters a-z or A-Z depending on the shift state and not as 0x01 to 0x1a. Update Python unit test. This patch is required for using the EFI shell `edit` command. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: enable file SetInfo()Heinrich Schuchardt2019-04-071-2/+65
| | | | | | | | | | | | | | | | | | | | | | EFI shell command edit uses the SetInfo() methods to unset the read only attribute of the file to be edited. So let efi_file_setinfo() return success in this case. Return an error if the function is called for to rename or resize a file as we do not support this yet. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: correct file creationHeinrich Schuchardt2019-04-071-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | The EFI shell expects that after opening a file with EFI_FILE_MODE_CREATE GetInfo() succeeds. Up to now we do not actually create the file when method Open() of the EFI_FILE_PROTOCOL is called. If method Open() of the EFI_FILE_PROTOCOL is called with EFI_FILE_MODE_CREATE and the file does not yet exist, call fs_write() with a buffer size of zero to actually create the file. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: debug output file handle in efi_file_open()Heinrich Schuchardt2019-04-071-2/+4
| | | | | | | | | | | | | | | | For debugging it is helpful to know the address of the file handle created by the Open() method of the EFI file protocol. So let's write it with EFI_PRINT(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: boottime: export efi_[un]load_image()AKASHI Takahiro2019-04-071-7/+7
| | | | | | | | | | | | | | | | Those two functions will be used later to re-implement do_bootefi_exec(). Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: boottime: add loaded image device path protocol to image handleAKASHI Takahiro2019-04-072-7/+14
| | | | | | | | | | | | | | | | | | To meet UEFI spec v2.7a section 9.2, we should add EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL to image handle, instead of EFI_DEVICE_PATH_PROTOCOL. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: variables PlatformLang and PlatformLangCodesHeinrich Schuchardt2019-04-071-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI variable PlatformLang is not defined. As this variable is anyway prescribed in the UEFI 2.7 spec let's define it to L"en-US". Use the same value for PlatformLangCodes that defines the list of all supported languages. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: EFI_PRINT instead of debug for memory servicesHeinrich Schuchardt2019-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | For debug messages inside EFI API functions we should use the EFI_PRINT macro which gives us well aligned output like: EFI: Entry efi_allocate_pool_ext(4, 14, 000000007edd7718) EFI: efi_add_memory_map: 0x7dcfa000 0x1 4 yes EFI: Exit: efi_allocate_pool_ext: 0 Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: EFI_PRINT instead of debug for variable servicesHeinrich Schuchardt2019-04-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | For debug messages inside EFI API functions we should use the EFI_PRINT macro which gives us well aligned output like: EFI: Entry efi_get_variable("PlatformLang" ...) EFI: get 'efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_PlatformLang' EFI: Exit: efi_get_variable: 14 Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: parameter checks in StartImage and Exit()Heinrich Schuchardt2019-04-071-0/+27
| | | | | | | | | | | | | | | | | | | | Add parameter checks in the StartImage() and Exit() boottime services: - check that the image handle is valid and has the loaded image protocol installed - in StartImage() record the current image - in Exit() check that the image is the current image Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: rearrange boottime service functionsHeinrich Schuchardt2019-04-071-109/+109
| | | | | | | | | | | | To avoid forward declarations move efi_start_image() and efi_exit() down. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: sanity checks when freeing memoryHeinrich Schuchardt2019-04-071-18/+58
| | | | | | | | | | | | | | | | | | | | | | | | Use a checksum to validate that efi_free_pool() is only called for memory allocated by efi_allocated_pool(). Add a plausibility check to efi_free_pages() checking that the address passed is page aligned. Update related function comments to match Sphinx style. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_selftest: check image_base, image_sizeHeinrich Schuchardt2019-04-071-5/+53
| | | | | | | | | | | | | | In efi_selftest_start_image_exit.c test the image_base and image_size are correctly set in the loaded image protocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: set image_base and image_size to correct valuesAKASHI Takahiro2019-04-071-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, image's image_base points to an address where the image was temporarily uploaded for further loading. Since efi_loader relocates the image to final destination, image_base and image_size should reflect that. This bug was detected in UEFI SCT, "Loaded Image Protocol Test - test 2," which shows that 'Unload' function doesn't fit into a range suggested by image_base and image_size. TestCase/UEFI/EFI/Protocol/LoadedImage/BlackBoxTest/ LoadedImageBBTestMain.c:1002 Changes in this patch also includes: * reverts a patch, "efi_loader: save image relocation address and size" since newly added fields are no longer needed. * copy PE headers as well since those information will be needed for module loading, in particular, at gurb. (This bug was reported by Heinrich.) Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Rebase patch. Remove unused fields from struct efi_loaded_image_obj. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: bootmgr: support BootNext and BootCurrent variable behaviorAKASHI Takahiro2019-04-071-4/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See UEFI v2.7, section 3.1.2 for details of the specification. With efidebug command, you can run any EFI boot option as follows: => efi boot add 1 SHELL ... => efi boot add 2 HELLO ... => efi boot order 1 2 => efi bootmgr (starting SHELL ...) => efi boot next 2 => efi bootmgr (starting HELLO ...) => env print -e <snip ...> BootCurrent: {boot,run}(blob) 00000000: 02 00 .. BootOrder: {boot,run}(blob) 00000000: 01 00 02 00 .... Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: release file buffer after loading imageHeinrich Schuchardt2019-04-071-32/+18
|/ | | | | | | | | | | | | Commit 0e18f584de59 ("efi_loader: LoadImage: always allocate new pages") ensured that whether we load an image from file or from memory we end up with the same number of newly allocated buffers. But essentially we ended up with one buffer too many in both cases: efi_load_pe() copies and rebases the UEFI image. We do not need the buffer with the file contents afterwards. Fixes: 0e18f584de59 ("efi_loader: LoadImage: always allocate new pages") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* fix compile error on macOS Mojave默默2019-04-031-1/+8
|
* Merge branch '2019-03-29-master-imports'Tom Rini2019-03-291-1/+1
|\ | | | | | | | | | | | | | | - Bugfixes: - mmc: correct the HS400 initialization process - configs: ti: Move FIT image load address to avoid overwrite - lib: time: update module enable MACRO - Add mbrugger as RPi board maintainer, correct agraf's email address.
| * lib: time: update module enable MACROKever Yang2019-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | We'd better use correct way to check if module has enabled. for we have 3 timer MACRO: - CONFIG_TIMER - CONFIG_SPL_TIMER - CONFIG_TPL_TIMER Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* | efi_loader: TODO for the EFI file protocolHeinrich Schuchardt2019-03-271-0/+4
| | | | | | | | | | | | | | | | | | | | We currently only support EFI_FILE_PROTOCOL_REVISION while UEFI specs 2.4 - 2.7 prescribe EFI_FILE_PROTOCOL_REVISION2. Add a todo. Add missing constants for the EFI file protocol revision. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_selftest: avoid double free in dp utilities testHeinrich Schuchardt2019-03-271-5/+0
|/ | | | | | | Avoid duplicate FreePool() in unit test for the device patch utilities protocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* rsa: check that pointer checksum isn't NULL before using itPhilippe Reynes2019-03-251-1/+2
| | | | | | | | | The pointer checksum were used before checking that it isn't NULL. We move the code that use it after the check. Reported-by: Coverity (CID: 185835) Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>