aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2019-07-23Merge tag 'efi-2019-10-rc1-2' of ↵Tom Rini12-107/+398
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for v2019.10-rc1 (2) * Implement the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. * Address errors of type -Werror=address-of-packed-member when building with GCC9.1 * Fix an error when adding memory add addres 0x00000000. * Rework some code comments for Sphinx compliance.
2019-07-18lib: rsa: add support to other openssl engine types than pkcs11Vesa Jääskeläinen1-0/+18
There are multiple other openssl engines used by HSMs that can be used to sign FIT images instead of forcing users to use pkcs11 type of service. Relax engine selection so that other openssl engines can be specified and use generic key id definition formula. Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Cc: Tom Rini <trini@konsulko.com>
2019-07-16efi_loader: unaligned access in efi_file_from_path()Heinrich Schuchardt1-1/+6
The device path structure is packed. So no assumption on the alignment is possible. Copy the file name in efi_file_from_path() to assure there is no unaligned access. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: efi_dp_from_file() expect UTF-8 pathHeinrich Schuchardt1-9/+31
Properly convert UTF-8 file names to UTF-16. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: support unaligned u16 stringsHeinrich Schuchardt1-9/+14
Allow unaligned u16 strings as arguments to u16_strdup() and u16_strlen(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: function comments efi_bootmgr.cHeinrich Schuchardt1-7/+40
Convert function descriptions to Sphinx style. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: fix comment for struct efi_pool_allocationHeinrich Schuchardt1-5/+9
Change comment for struct efi_pool_allocation to match Sphinx style. Describe all structure fields. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: fix comments for variable servicesHeinrich Schuchardt1-4/+23
Add missing parameter descriptions. Remove an invalid link. Correct the formatting of a function comment. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_driver: use Sphinx style commentsHeinrich Schuchardt1-19/+20
Use Sphinx style comments for describing function parameters. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: fix comments for efi_update_exit_data()Heinrich Schuchardt1-3/+3
Add missing colons after parameter descriptions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: fix function comments in efi_boottime.cHeinrich Schuchardt1-3/+4
scripts/kernel-doc pointed out some errors in the function comments in efi_boottime.c. Add missing and remove superfluous parameter descriptions. Escape * in a function description. Add empty lines for readability. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: Change return type of efi_add_memory_map()Bryan O'Donoghue2-15/+23
We currently have some inconsistent use of efi_add_memory_map() throughout the code. In particular the return value of efi_add_memory_map() is not interpreted the same way by various users in the codebase. This patch does the following: - Changes efi_add_memory_map() to return efi_status_t. - Adds a method description to efi_add_memory_map(). - Changes efi_add_memory_map() to return EFI_SUCCESS - Returns non-zero for error in efi_add_memory_map() - Updates efi_allocate_pages() to new efi_add_memory_map() - Updates efi_free_pages() to new efi_add_memory_map() - Updates efi_carve_out_dt_rsv() to new efi_add_memory_map() - Updates efi_add_runtime_mmio() to new efi_add_memory_map() Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map") Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes") Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Alexander Graf <agraf@csgraf.de> Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_selftest: EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGEHeinrich Schuchardt2-0/+193
Provide a unit test for SetVirtualAddressMap() and ConvertPointer(). As ConvertPointer() is not implemented yet this will spit out some warnings. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGEHeinrich Schuchardt2-8/+31
Implement the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. This requires allocating the event and the event list from runtime data. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_loader: efi_set_virtual_address_map_runtime()Heinrich Schuchardt1-1/+1
efi_set_virtual_address_map_runtime() must be of type __efi_runtime. Fixes: ee8ebaaaaedc ("efi_loader: split off detaching SetVirtualAddress()") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-16efi_selftest: do not call CloseEvent() after ExitBootServices()Heinrich Schuchardt1-23/+0
Boot services are not available after calling ExitBootServices(). So we should not try to close an event here. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-07-13configs: Make USE_TINY_PRINTF depend on SPL||TPL and be defaultTom Rini1-0/+2
The USE_TINY_PRINTF symbol only changes things within SPL and TPL builds, so make it depend on that support. Next, make it default as within these cases we should rarely have need of more advanced print formats outside of the debug context. To do this, in a few cases we need to correct our Kconfig dependencies as we had cases of non-SPL targets select'ing this symbol. Finally, in the case of a few boards we really do need the full printf functionality. Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-10trace: do not limit trace buffer to 2GiBHeinrich Schuchardt1-7/+7
There is no good reason to limit the trace buffer to 2GiB on a 64bit system. Adjust the types of the relevant parameters. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-10trace: make call depth limit customizableHeinrich Schuchardt2-2/+17
Up to now we had hard coded values for the call depth up to which trace records are created: 200 for early tracing, 15 thereafter. UEFI applications reach a call depth of 80 or above. Provide customizing settings for the call trace depth limit and the early call trace depth limit. Use the old values as defaults. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-10trace: conserve gd registerHeinrich Schuchardt1-0/+49
An UEFI application may change the value of the register that gd lives in. But some of our functions like get_ticks() access this register. So we have to set the gd register to the U-Boot value when entering a trace point and set it back to the application value when exiting the trace point. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-10fdtdec: test: Fix memory leakThierry Reding1-0/+2
Free the memory allocated to store the test FDT upon test completion to avoid leaking the memory. We don't bother cleaning up on test failure since the code is broken in that case and should be fixed, in which case the leak would also go away. Reported-by: Tom Rini <tom.rini@gmail.com> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-10sandbox: Quit when hang() is calledSimon Glass1-0/+3
It doesn't make a lot of sense to hang on sandbox when hang() is called, since the only way out is Ctrl-C. In fact, Ctrl-C does not work if the terminal is in raw mode, which it will be if the command-line has not been reached yet. In that case, Ctrl-Z / kill -9 must be used, which is not very friendly. Avoid all of this by quiting when hang() is called. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-06efi_loader: detach runtime in ExitBootServices()Heinrich Schuchardt2-1/+4
Linux can be called with a command line parameter efi=novamap, cf. commit 4e46c2a95621 ("efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted"). In this case SetVirtualAddressMap() is not called after ExitBootServices(). OpenBSD 32bit does not call SetVirtualAddressMap() either. Runtime services must be set to an implementation supported at runtime in ExitBootServices(). Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Suggested-by: Alexander Graf <agraf@csgraf.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: simplify detachingHeinrich Schuchardt1-32/+8
We do not need any array typed detach list. Let's simply update the pointers directly. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: decision on EFI_RT_SUPPORTED_RESET_SYSTEMHeinrich Schuchardt2-4/+7
Move the logic determining which board supports reset at runtime to Kconfig. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: split off detaching SetVirtualAddress()Heinrich Schuchardt1-11/+58
The runtime services SetVirtualAddress() and ConvertPointer() become unavailable after SetVirtualAddress(). Other runtime services become unavailable after ExitBootServices. Move the update of SetVirtualAddress() and ConvertPointer() to efi_relocate_runtime_table(). Use functions with the correct signature when detaching. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_selftest: test variable services at runtimeHeinrich Schuchardt2-0/+95
Provide a unit test for the variable services at runtime. Currently we expect EFI_UNSUPPORTED to be returned as the runtime implementation is still missing. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: unimplemented runtime servicesHeinrich Schuchardt1-32/+2
Unimplemented runtime services should always return EFI_UNSUPPORTED as described in the UEFI 2.8 spec. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: let the variable driver patch out the runtimeHeinrich Schuchardt3-10/+46
Our variable services are only provided at boottime. Therefore when leaving boottime the variable function are replaced by dummy functions returning EFI_UNSUPPORTED. Move this patching of the runtime table to the variable services implementation. Executed it in ExitBootServices(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: clean up runtime detachingHeinrich Schuchardt1-23/+55
The detaching of the runtime will have to move to ExitBootServices() to encompass operating system that do not call SetVirtualAddressMap(). This patch changes the logic for the relocation of the pointers in the runtime table such that the relocation becomes independent of the entries in the detach list. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: remove NULL entries from runtime detach listHeinrich Schuchardt2-20/+9
Some entries in the system table are set to NULL in ExitBootServices(). We had them in the runtime detach list to avoid relocation of NULL. Let's instead assign the pointers dynamically in efi_initialize_system_table() to avoid the relocation entry. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: initialization of variable servicesHeinrich Schuchardt2-0/+15
Provide an initialization routine for variable services. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: move efi_query_variable_info()Heinrich Schuchardt2-27/+27
Let's keep similar things together. Move efi_query_variable_info() to lib/efi_loader/efi_variable.c Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_loader: remove superfluous spaces in commentsHeinrich Schuchardt1-4/+4
Leave only a single space after * if not aligning. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06efi_selftest: description of CMD_BOOTEFI_SELFTESTHeinrich Schuchardt1-4/+4
The current short description has a typo. Let it stand out clear that we provide unit tests. Improve the description of the CMD_BOOTEFI_SELFTEST configuration option. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Alexander Graf <agraf@csgraf.de>
2019-06-21Merge tag 'efi-2019-07-rc5-3' of ↵Tom Rini7-86/+107
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for v2019.07-rc5 (3) This pull request provides error fixes for the graphical output protocol, the text output protocol, and the extended text input protocol. Setting the boot device for the bootefi command is now not only supported by the 'load' command but also for the file system specific commands like 'fatload'.
2019-06-21lib: Makefile: build fdtdec_common.c when OF_LIBFDT selectedPeng Fan1-1/+1
When build SPL_OF_PLATDATA on i.MX6, meet issue the fdtdec_get_int not defined, however fdtdec.c will use fdtdec_get_int, so let's compile fdtdec_common.c when OF_LIBFDT selected. Since there is also SPL_OF_LIBFDT, so need to use CONFIG_$(SPL_TPL_)OF_LIBFDT. Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-06-20efi_loader: fix typo in efi_variable.cHeinrich Schuchardt1-2/+2
%s/efi_efi_/efi_/ Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: Delete() return EFI_WARN_DELETE_FAILUREHeinrich Schuchardt1-8/+2
If EFI_FILE_PROTOCOL.Delete() fails, always close the handle and return EFI_WARN_DELETE_FAILURE. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: ListPackageLists() return EFI_NOT_FOUNDHeinrich Schuchardt1-35/+14
If no matching package list is found in ListPackageLists(), return EFI_NOT_FOUND. If we do not support a package type, we will not find a matching package list. Remove the unreachable EFI_PRINTF() statements. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: console incorrectly advertised left logo keyHeinrich Schuchardt1-3/+1
Avoid to signal that the left logo key is pressed, when it is not. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: alternative scan codes for F5, END, HOMEHeinrich Schuchardt1-8/+14
Depending on the key board alternative scan codes are used for F5, END, and HOME. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: GOP: provide accurate mode informationHeinrich Schuchardt1-12/+12
For 5:6:5 modes provide correct frame buffer information. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: SetMode() must blank screenHeinrich Schuchardt1-12/+38
EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() must blank the screen. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: system table setupHeinrich Schuchardt1-5/+5
When setting up the system table avoid superfluous void * conversions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: QueryMode() must allocate bufferHeinrich Schuchardt2-1/+10
EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() must allocate a buffer for the mode information structure. Adjust the unit test to free the buffer. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: SetMode() parameters checkHeinrich Schuchardt1-3/+5
If EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() is called with an invalid mode, return EFI_UNSUPPORTED. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: QueryMode() check parametersHeinrich Schuchardt1-1/+8
Check the parameters of EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: Blt() with incorrect BltOperationHeinrich Schuchardt1-1/+1
If EFI_GRAPHICS_OUTPUT_PROTOCOL.Blt() is called with an invalid value of BltOperation return EFI_INVALID_PARAMETER. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: fix SetAttribute()Heinrich Schuchardt1-0/+2
The SetAttribute() service and the Reset() service of the simple text output protocol must update the attribute value in the mode information. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>