aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2018-10-09tpm: Add a few new commands for v1Simon Glass1-3/+65
These are needed for the 2018 version of Chromium OS vboot. Add an implementation for TPM v1, with v2 to come later. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09tpm: Tidy up logging in tpm-common.cSimon Glass1-3/+7
At present this file uses logging but it should use the new macros. Update it and add a log message for an error. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09fdt: Remove fdtdec_decode_region() functionSimon Glass1-83/+0
This function is not used in U-Boot now. Remove it along with its 'memory' version. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09fdt: Allow libfdt in TPLSimon Glass1-0/+10
In some cases (e.g. sandbox with verified boot) it is useful to support libfdt in TPL. Update the Kconfig to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09serial: Allow serial to be absent in TPLSimon Glass1-2/+3
At present this option applies to SPL, but it should be available in TPL also, and separately. Change to using CONFIG_IS_ENABLED(), add a new Kconfig option and fix up hang(). Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09tpm: Add support for SPL and TPLSimon Glass2-3/+29
At present the tpm can only be used in U-Boot proper. Updated it to work in SPL and TPL also. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-02Merge branch 'master' of git://git.denx.de/u-boot-spiTom Rini1-20/+16
This is the PR for SPI-NAND changes along with few spi changes. [trini: Re-sync changes for ls1012afrwy_qspi*_defconfig] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-09-29fdt: fdtdec_setup_memory_banksize() use livetreeJens Wiklander1-23/+21
Converts fdtdec_setup_memory_banksize() to use ofnode functions instead. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-09-23efi_loader: refactor efi_setup_loaded_image()Heinrich Schuchardt2-58/+57
Create the handle of loaded images and the EFI_LOADED_IMAGE_PROTOCOL inside efi_setup_loaded_image(). Do not use local variables. Currently we expect the loaded image handle to point to the loaded image protocol. Additionally we have appended private fields to the protocol. With the patch the handle points to a loaded image object and the private fields are added here. This matches how we handle the net and the gop object. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: Disable efi selftest on sandbox for nowAlexander Graf1-1/+1
The EFI selftest does not succeed on Sandbox yet. The network support seems to need some love to actually make our current tests succeed. So let's disable running the selftest on sandbox for now until "make tests" just works. Then we can have more amazing CI than ever. Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: remove efi_exit_caches()Heinrich Schuchardt1-28/+0
Since GRUB patch d0c070179d4d ("arm/efi: Switch to arm64 linux loader", 2018-07-09) we do not need a workaround for GRUB on 32bit ARM anymore. So let's eliminate function efi_exit_caches(). This will require Linux distributions to update grub-efi-arm to the GRUB git HEAD (a tag containing the aforementioned GRUB patch is not available yet). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: remove redundant statementHeinrich Schuchardt1-1/+9
ascii2unicode() always ends the u16 string with '\0'. Remove redundant assignment. Add description for efi_str_to_u16() and ascii2unicode(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: create root nodeHeinrich Schuchardt4-22/+80
Currently we assign a lot of protocols to loaded images though these protocols are not related to them. Instead they should be installed on a separate handle. Via the device path it is the parent to the devices like the network adapter. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: avoid out of bound access in efi_get_variable()Heinrich Schuchardt1-1/+1
In efi_get_variable() a string is longer than the allocated space which results in overwriting the linked list of malloc(). The prefixes used for variables are 41 characters long, e.g. efi_67029eb5-0af2-f6b1-da53-fcb566dd1ce6_ Change PREFIX_LEN to 41. Fixes: faff21556748 ("efi_loader: remove limit on variable length") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_driver: convert function descriptions to Sphinx styleHeinrich Schuchardt1-32/+54
Convert the function descriptions to Sphinx style. efi_driver_init() is cCalled by efi_init_obj_list(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: query serial console size reliablyHeinrich Schuchardt1-13/+37
Not all terminals understand CSI [18t for querying the console size. We should adhere to escape sequences documented in the console_codes manpage and the ECMA-48 standard. So here we follow a different approach. We position the cursor to the bottom right and query its position. Before leaving the function we restore the original cursor position. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: Merge memory map entriesAlexander Graf1-0/+45
We currently do not combine memory entries that are adjacent and have the same attributes. The problem with that is that our memory map can easily grow multiple hundreds of entries in a simple UEFI Shell environment. So let's make sure we always combine all entries to make the memory map as small as possible. That way every other piece of code that loops through it should also gain some nice speed ups. Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_selftest: missing braces in efi_selftest_textinputex.cHeinrich Schuchardt1-1/+1
gcc 4.8.4 wants to see all levels of braces when initializing a structure to zeros. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: check parameter new_handle of efi_file_open()Heinrich Schuchardt1-1/+1
We should not check parameter file twice. We should check parameter new_handle. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: terminal left upper corner is [1, 1]Heinrich Schuchardt1-3/+21
For the VT102 and the Linux console the left upper corner is [1, 1]. EFI uses [0, 0] as left upper corner. Check parameters of the SetCursorPosition() service. Use CSI H like EDK2 for positioning. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: more debug info for efi_file_getinfo()Heinrich Schuchardt1-1/+1
efi_file_getinfo() is called with a GUID. In EFI_ENTRY use %pUl as format type. This way the GUID is printed in debug mode. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi: Correct the operation of efi_file_write()Simon Glass1-4/+2
We should not directly cast between pointers and addresses since it breaks sandbox. Fix this and simplify the code in file_read(). Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi: sandbox: Enable EFI loader build for sandboxSimon Glass1-1/+1
This allows this feature to build within sandbox. This is useful for testing. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: loosen check of parameters of efi_file_open()Heinrich Schuchardt1-1/+10
The UEFI spec requires that attributes are only set for when EFI_FILE_MODE_CREATE is set in open_mode. The SCT tries to read a directory with EFI_FILE_DIRECTORY. As EDK2 allows this we should not be more strict. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: provide description of file_open()Heinrich Schuchardt1-2/+12
Replace urban slang by proper description. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: check parameters of efi_file_open()Heinrich Schuchardt1-4/+26
Check the parameters of efi_file_open(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_selftest: test key notification functionsHeinrich Schuchardt1-7/+66
Use a key notification function to leave the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL test. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: implement key notify functionsHeinrich Schuchardt1-3/+98
Implement registering and unregistreing key notify functions in the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_selftest: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOLHeinrich Schuchardt2-0/+140
Provide a unit test for the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: support modifiers for F1 - F4Heinrich Schuchardt1-25/+39
Support modifiers for F1 - F4. Add support for letters with ALT key. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOLHeinrich Schuchardt1-22/+231
This patch implements the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. The implementation of notification functions is postponed to a later patch. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_selftest: use WaitForKey to test text inputHeinrich Schuchardt1-3/+24
We should test the WaitForKey event. Testing for EFI_NOT_READY can be done after resetting the console. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: rework event handling for consoleHeinrich Schuchardt1-38/+137
Preread the next key in the console timer event. The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL requires to trigger registered key notification functions based on the prefetched key. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_selftest: refactor text input testHeinrich Schuchardt2-107/+95
Move reusable utility functions to efi_selftest_util.c. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: support Unicode text inputHeinrich Schuchardt2-54/+96
Up to now the EFI_TEXT_INPUT_PROTOCOL only supported ASCII characters. With the patch it can consume UTF-8 from the console. Currently only the serial console and the console can deliver UTF-8. Local consoles are restricted to ASCII. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: implement a file deleteAKASHI Takahiro1-1/+13
'Delete' will be implemented here by calling fs_unlink() which relies on underlying file system's implementation. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: file: support creating a directoryAKASHI Takahiro1-4/+10
In efi world, there is no obvious "mkdir" interface, instead, Open() with EFI_FILE_MODE_CREATE in mode parameter and EFI_FILE_DIRECTORY in attributes parameter creates a directory. In this patch, efi_file_open() is extended so as to accept such a combination of parameters and call u-boot's mkdir interface for expected action. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: typos in efi_console.cHeinrich Schuchardt1-4/+4
Fix a few typos. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: struct efi_simple_text_input_protocolHeinrich Schuchardt2-4/+4
%s/efi_simple_input_interface/efi_simple_text_input_protocol/ We should be consistent in the naming of the EFI protocol interface structures. The protocol is called EFI_SIMPLE_TEXT_INPUT_PROTOCOL. %s/ExtendedVerification/extended_verification/ Use consistent naming of function parameters. Do not use CamelCase. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_selftest: EFI_UNICODE_COLLATION_PROTOCOLHeinrich Schuchardt2-0/+261
Provide a unit test for the EFI_UNICODE_COLLATION_PROTOCOL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: EFI_UNICODE_COLLATION_PROTOCOLHeinrich Schuchardt3-3/+347
The patch implements the EFI_UNICODE_COLLATION_PROTOCOL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23lib: charset: upper/lower case conversionHeinrich Schuchardt2-0/+57
Provide functions for upper and lower case conversion. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: Add console handle references to in/out/errAlexander Graf1-0/+6
We register the console in/out protocol on the loaded image handle, but never tell anyone about it in the systab. Because of this Shell.efi can not find the input protocol. So let's add a proper reference. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-09-23efi_loader: use correct documentation styleHeinrich Schuchardt1-1/+1
We have moved generating html documentation with Sphinx. %s/Return Value/Return/g Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: description efi_update_capsule()Heinrich Schuchardt1-1/+1
Correct the description of efi_update_capsule(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: fix typos in efi_runtime.cHeinrich Schuchardt1-7/+8
Fix multiple typos Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: fix typos in efi_boottime.cHeinrich Schuchardt1-21/+21
Fix numerous typos. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23Revert "Revert "efi_loader: efi_allocate_pages is too restrictive""Stephen Warren1-1/+1
This reverts commit ccfc78b820e5e431c5bd73b072e7536a972e1710. Now that the underlying issue is fixed, we can revert the revert and hence restore the original EFI code. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23lib: charset: remove obsolete functionsHeinrich Schuchardt1-79/+0
Remove functions: - utf8_to_utf16() - utf16_strcpy() - utf16_strdup() Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi_loader: don't use unlimited stack as bufferHeinrich Schuchardt1-7/+13
The length of a string printed to the console by the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is not limited by the UEFI spec. Hence should not allocate a buffer for it on the stack. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>