aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-02-14xilinx: Move zynq_board_read_rom_ethaddr to shared locationMichal Simek7-30/+30
Zynq and ZynqMP are sharing similar code and there is no reason to do code duplication. Move zynq_board_read_rom_ethaddr() to common file for easier conversion to DM. Use ZynqMP version that's why also add CONFIG_ZYNQ_EEPROM_BUS to Syzygy which is only one Zynq board which is using this feature. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-02-14arm64: zynqmp: Define distro boot commnads for qspi and nandSiva Durga Prasad Paladugu1-0/+32
This patch adds distro boot commands for qspi and nand. The distro boot commands now reads the script from flash offset of 63.5MB and executes it. Setup default location via script_offset_f to 63.5MB to match the most xilinx reference boards. 512kB allocated space for script size (script_size_f) should be more than enough to cover custom boot logic. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-02-14ARM: zynq: Run distribution boot commands firstMichal Simek21-21/+8
This patch is doing two things. 1. Exchanging order of boot commands. distro_bootcmd is run first followed by Xilinx boot command. 2. Remove CONFIG_BOOTCOMMAND from configs (and follow mainline) by creating Xilinx distribution bootcommand and wiring it as the last bootcommand. QSPI, NAND distribution boot command will be added later. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-02-13Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini50-336/+3980
Patch queue for efi - 2019-02-13 Goodness this time around: - HII protocol, finally allows us to run the UEFI Shell! (experimantal, disabled by default) - efi selftest now available on Cortex-M - NVMe support for distro boot - Lots of code cleanup
2019-02-13efi_loader: fix EFI_FILE_PROTOCOL.GetInfo()Heinrich Schuchardt1-0/+4
We check the existence of files with fs_exist(). This function calls fs_close(). If we do not set the active block device again fs_opendir() fails and we do not set the flag EFI_FILE_DIRECTORY. Due to this error the `cd` command in the EFI shell fails. So let's add the missing set_blk_dev(fh) call. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13lib: vsprintf: avoid overflow printing UTF16 stringsHeinrich Schuchardt1-3/+7
We have to ensure while printing UTF16 strings that we do not exceed the end of the print buffer. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: Make HII a config optionAlexander Graf3-1/+18
Heinrich ran into issues with HII and iPXE which lead to #SErrors on his Odroid-C2 system. We definitely do not want to regress just yet, so let's not expose the HII protocols by default. Instead, let's make it a config option that people can play with This way, we can stabilize the code in tree without breaking any users. Once someone figures out, why this breaks iPXE (probably a NULL dereference), we can enable it by default. Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de> --- v1 -> v2: - Remove HII selftest as well v2 -> v3: - Make config option
2019-02-13arm: Leave smccc calls in .text when efi_loader=nAlexander Graf2-0/+4
Commit 81ea00838c6 ("efi_loader: PSCI reset and shutdown") put the SMCCC assembly code into the efi specific code section. This is wrong when we do not have EFI_LOADER enabled, as that strips efi runtime sections from the output binary Reported-by: Michal Simek <monstr@monstr.eu> Reported-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Tested-by: Michal Simek <monstr@monstr.eu> Fixes: 81ea00838c6 ("efi_loader: PSCI reset and shutdown") Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: debug output for HII protocolsHeinrich Schuchardt2-26/+26
For correct indention use EFI_PRINT() instead of debug(). For printing efi_uintn_t or size_t use the %zu or %zx format code. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_selftest: fix HII testsHeinrich Schuchardt1-11/+0
efi_st_printf() does not support format code %ld. Anyway the format code for size_t would be %zu which isn't supported either. We do not want any divisions to avoid invalid references to integer arithmetic routines, cf. https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html. As a simple remedy remove the noisy messages from the output. They are not relevant for automated testing. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_selftest: add HII database protocols testAKASHI Takahiro3-0/+1500
This efi_selftest tests HII database protocol and HII string protocol. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi: hii: add HII config routing/access protocolsAKASHI Takahiro5-1/+318
This patch is a place holder for HII configuration routing protocol and HII configuration access protocol. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi: hii: add keyboard layout package supportAKASHI Takahiro2-5/+148
Allow for handling keyboard layout package in HII database protocol. A package can be added or deleted in HII database protocol, but we don't set 'current' keyboard layout as there is no driver that requests a keyboard layout. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi: hii: add guid package supportAKASHI Takahiro2-6/+51
Allow for handling GUID package in HII database protocol. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: Initial HII database protocolsLeif Lindholm5-1/+1183
This patch provides enough implementation of the following protocols to run EDKII's Shell.efi and UEFI SCT: * EfiHiiDatabaseProtocol * EfiHiiStringProtocol Not implemented are: * ExportPackageLists() * RegisterPackageNotify()/UnregisterPackageNotify() * SetKeyboardLayout() (i.e. *current* keyboard layout) HII database protocol in this patch series can handle only: * GUID package * string package * keyboard layout package (The other packages, except Device path package, will be necessary for interactive and graphical UI.) Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13x86: do not use i386 code for x86_64 memory functionsHeinrich Schuchardt2-9/+24
arch/x86/lib/string.c contains assembler implementations of memcpy(), memmove(), and memset() written for i386. Don't use it on x86_64. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: GetNextVariableName() relies on REGEXHeinrich Schuchardt1-0/+1
Our implementation of GetNextVariableName() relies on CONFIG_REGEX=y. So EFI_LOADER has to select it. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: fix GetNextVariableNameHeinrich Schuchardt1-1/+2
Our current implementation of GetNextVariableName() first collects all EFI variables. If none is found at all hexport_r() returns a zero length string terminated by \0 and the value 1 as number of bytes in the returned buffer. In this case GetNextVariableName() has to return EFI_NOT_FOUND. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: do not use symbolic linksHeinrich Schuchardt2-2/+1
Symbolic links are not supported on all file systems, e.g. not on FAT. So it is not wise to use them in our source tree. Use a qualified path to refer to lib/efi_loader/efi_freestanding.c in scripts/Makefile.lib instead. Reported-by: Alexander Graf <agraf@suse.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: Fix build with O=] Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: use library memcpy() in helloworld.efiHeinrich Schuchardt1-30/+6
Helloworld does not need its own memcpy() implementation anymore. Use the one provided in efi_freestanding.c. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: use freestanding library for efi appsHeinrich Schuchardt2-1/+2
GCC requires that freestanding programs provide memcpy(), memmove(), memset(), and memcmp(). Add the library functions when building a *.efi files. The EFI selftests might use other compilation flags. So use a symbolic link to provide lib/efi_selftest/efi_freestanding.c and compile it separately. Reported-by: Alexander Graf <agraf@suse.de> Fixes: 5be444d14b38 ("efi_loader: consistent build flags for EFI applications") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: provide freestanding libraryHeinrich Schuchardt1-0/+90
GCC requires that freestanding programs provide memcpy(), memmove(), memset(), and memcmp(). Provide the required library functions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_selftest: fix variables test for GetNextVariableName()AKASHI Takahiro1-5/+8
There is a bug in efi variables test. Fix it with some cosmetic improvements. Please note that efi variables test still fails at QueryVariableInfo() and GetVariable(), but this is not due to a change in this patch. ==8<== Testing EFI API implementation Selected test: 'variables' Setting up 'variables' Setting up 'variables' succeeded Executing 'variables' .../u-boot/lib/efi_selftest/efi_selftest_variables.c(60): TODO: QueryVariableInfo failed .../u-boot/lib/efi_selftest/efi_selftest_variables.c(131): TODO: GetVariable returned wrong length 7 .../u-boot/lib/efi_selftest/efi_selftest_variables.c(133): TODO: GetVariable returned wrong value Executing 'variables' succeeded Boot services terminated Summary: 0 failures ==>8== Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: implement GetNextVariableName()AKASHI Takahiro1-10/+146
The current GetNextVariableName() is a placeholder. With this patch, it works well as expected. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> rebased on efi-next Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: comments for variable servicesHeinrich Schuchardt1-5/+81
Comment the functions implementing the runtime variable services. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: remove duplicate function mem2hex()Heinrich Schuchardt1-14/+1
Replace duplicate function mem2hex() by inline function bin2hex(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: eliminate duplicate function hex2mem()Heinrich Schuchardt1-41/+3
Use existing inline function hex2bin() instead of defining a new one. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: remove duplicate GUID definitionHeinrich Schuchardt1-3/+0
Remove duplicate definition o EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: consistent build flags for EFI applicationsHeinrich Schuchardt2-3/+3
At the same time adding and removing the -Os flag does not make any sense. Actually it leads to -Os not being used. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: use u16* for file nameHeinrich Schuchardt3-11/+11
UTF-16 strings in our code should all be u16 *. Fix an inconsistency for file names which may lead to a warning for printf("%ls", ). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: fix CopyMem()Heinrich Schuchardt1-1/+1
CopyMem() must support overlapping buffers. So replace memcpy() by memmove(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: refactor switch to non-secure modeHeinrich Schuchardt7-67/+132
Refactor the switch from supervisor to hypervisor to a new function called at the beginning of do_bootefi(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_driver: simplify error messageHeinrich Schuchardt1-2/+1
Stating the function module is sufficient. We don't need file and line number. Anyway the format code for the line number was incorrect (should be %d). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_selftest: tpl unit test, check return valuesHeinrich Schuchardt1-2/+2
For some API calls checks for the return values are missing. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_selftest: events unit test, check return valuesHeinrich Schuchardt1-3/+3
For some API calls checks for the return values are missing. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_selftest: SNP unit test on sandboxHeinrich Schuchardt1-0/+8
Running the simple network protocol test on the sandbox requires setting the environment variable ethact to a network interface connected to a DHCP server and ethrotate to 'no'. So let's make it an on-request test on the sandbox (selectable by setting environment variable efi_selftest). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: efi_set_variable use const void *Heinrich Schuchardt3-3/+4
The SetVariable() runtime service does not change the data passed to it. So mark the parameter as constant. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: use const efi_guid_t * for variable servicesHeinrich Schuchardt4-20/+22
The runtime variable services never change GUIDs. So we should declare the GUID parameters as constant. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: move efi_init_obj_list() to a new efi_setup.cAKASHI Takahiro4-77/+89
The function, efi_init_obj_list(), can be shared in different pseudo efi applications, like bootefi/bootmgr as well as my efishell. Moreover, it will be utilized to extend efi initialization, for example, my "removable disk support" patch and "capsule-on-disk support" patch in the future. So with this patch, it will be moved to a new file, efi_setup.c, under lib/efi_loader and exported, making no changes in functionality. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Remove lines deactivated by #if 1 #else Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13doc: README.uefi: fix typosHeinrich Schuchardt1-5/+5
%s/specfication/specification/ %s/selftest/self-test/ %s/little endian/little-endian/ Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_selftest: allow building on ARMv7-MHeinrich Schuchardt2-4/+8
ARMv7-M only supports the Thumb instruction set. Our current crt0 code does not support it. With the patch we can build all unit tests of the EFI subsystem that do not require crt0. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: signature of StartImage and ExitHeinrich Schuchardt2-8/+8
We use u16* for Unicode strings and efi_uintn_t for UINTN. Correct the signature of efi_exit() and efi_start_image(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: avoid unnecessary pointer to long conversionHeinrich Schuchardt1-1/+1
debug() support supports %p to print pointers. The debug message is unique. So there is not need to write a possibly distracting line number. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: fix memory allocation on sandboxHeinrich Schuchardt1-0/+6
Commit 7b78d6438a2b ("efi_loader: Reserve unaccessible memory") introduced a comparison between RAM top and RAM start that was not known at the time when the patch of commit 49759743bf09 ("efi_loader: eliminate sandbox addresses") was written. The sandbox uses an address space that is only relevant in the sandbox context. We have to map ram_top from the sandbox address space to the physical address space before using it in the EFI subsystem. Fixes: 49759743bf09 ("efi_loader: eliminate sandbox addresses") Fixes: 7b78d6438a2b ("efi_loader: Reserve unaccessible memory") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: CMD_BOOTEFI_HELLO_COMPILE in configsHeinrich Schuchardt7-7/+1
It should not be necessary to adjust CMD_BOOTEFI_HELLO_COMPILE in config files. arch/arm/lib/crt0_arm_efi.S cannot be compiled in thumbs mode. We can disable CMD_BOOTEFI_HELLO_COMPILE for CONFIG_CPU_V7M. So there is no longer a need to disable it in stm32 configs. helloworld.efi can be built without problems on x86_64. So there is no need to disable it in chromebook_link64_defconfig and qemu-x86_64_defconfig. Same is true for ARM V7A. So do not disable CMD_BOOTEFI_HELLO_COMPILE in kp_imx6q_tpc_defconfig. Some architecture checks are already make for EFI_LOADER. There is no need to repeat them for CMD_BOOTEFI_HELLO_COMPILE Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrice.Chotard@st.com Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: use named constant for efi_dp_from_mem()Heinrich Schuchardt1-1/+1
When calling efi_dp_from_mem() use a named constant for the memory type. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13distro: not taint environment variables if possibleAKASHI Takahiro1-6/+7
The aim of this patch is not to have temporary variables used in distro_bootcmd left as environment variables after run something. See the discussion[1]. Without this patch, saveenv command also saves those variables, too. While they are apparently safe, scsi_need_init can be harmful. Please note that, in most cases, a variable should be converted to hush's local variable, while "devplist" cannot because it is created by "part" command as an environment variable. [1] https://lists.denx.de/pipermail/u-boot/2018-December/350209.html Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: efi_connect_controller() use %pDHeinrich Schuchardt1-1/+1
EFI_ENTRY in efi_connect_controller() should use %pD to print the remaining device path. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: efi_add_runtime_mmio()Heinrich Schuchardt1-1/+2
The first parameter of efi_add_runtime_mmio() is a pointer to a pointer. This should be reflected in the documentation. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13distro_bootcmd: add NVME supportHeinrich Schuchardt1-0/+27
Some boards support NVME drives. We should be able to use them as boot devices. NVME access requires running 'nvme scan'. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>