23 Mar, 2020

1 commit


22 Mar, 2020

6 commits


17 Mar, 2020

1 commit


11 Mar, 2020

2 commits

  • The assigned value NULL is never used.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • Currently, if GetMemoryMap API returns EFI_BUFFER_TOO_SMALL, it doesn't
    set valid values to other parameters, descriptor_size and
    descriptor_version, except memory_map_size.
    Some efi applications, however, may use those value; in particular,
    xen uses descriptor_size to calculate a size of buffer to be allocated.

    While UEFI specification is ambiguous in this point, it would be better
    to address this issue proactively to maximize the compatibility with
    existing efi applications.

    With this patch, for example, xen.efi (and hence linux kernel) can be
    started via bootefi without modification.

    Signed-off-by: AKASHI Takahiro
    Reviewed-by: Heinrich Schuchardt

    AKASHI Takahiro
     

29 Feb, 2020

1 commit

  • Following kernel's proposal for an arch-agnostic initrd loading
    mechanism [1] let's implement the U-boot counterpart.
    This new approach has a number of advantages compared to what we did up
    to now. The file is loaded into memory only when requested limiting the
    area of TOCTOU attacks. Users will be allowed to place the initramfs
    file on any u-boot accessible partition instead of just the ESP one.
    Finally this is an attempt of a generic interface across architectures
    in the linux kernel so it makes sense to support that.

    The file location is intentionally only supported as a config option
    argument(CONFIG_EFI_INITRD_FILESPEC), in an effort to enhance security.
    Although U-boot is not responsible for verifying the integrity of the
    initramfs, we can enhance the offered security by only accepting a
    built-in option, which will be naturally verified by UEFI Secure Boot.
    This can easily change in the future if needed and configure that via ENV
    or UEFI variable.

    [1] https://lore.kernel.org/linux-efi/20200207202637.GA3464906@rani.riverdale.lan/T/#m4a25eb33112fab7a22faa0fd65d4d663209af32f

    Signed-off-by: Ilias Apalodimas
    Signed-off-by: Heinrich Schuchardt

    Ilias Apalodimas
     

27 Feb, 2020

1 commit


19 Feb, 2020

1 commit


06 Feb, 2020

1 commit

  • At present dm/device.h includes the linux-compatible features. This
    requires including linux/compat.h which in turn includes a lot of headers.
    One of these is malloc.h which we thus end up including in every file in
    U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
    which needs to use the system malloc() in some files.

    Move the compatibility features into a separate header file.

    Signed-off-by: Simon Glass

    Simon Glass
     

15 Jan, 2020

3 commits


08 Jan, 2020

8 commits

  • Install the EFI_RNG_PROTOCOL implementation for it's subsequent use by
    the kernel for features like kaslr.

    Signed-off-by: Sughosh Ganu
    Reviewed-by: Heinrich Schuchardt

    Sughosh Ganu
     
  • Add support for the EFI_RNG_PROTOCOL routines for the qemu arm64
    platform. EFI_RNG_PROTOCOL is an uefi boottime service which is
    invoked by the efi stub in the kernel for getting random seed for
    kaslr.

    The routines are platform specific, and use the virtio-rng device on
    the platform to get random data.

    The feature can be enabled through the following config
    CONFIG_EFI_RNG_PROTOCOL

    Signed-off-by: Sughosh Ganu
    Changed SPDX header to use /* instead of //.
    Reviewed-by: Heinrich Schuchardt

    Sughosh Ganu
     
  • Add guidcpy function to copy the source guid to the destination
    guid. Use this function instead of memcpy for copying to the
    destination guid.

    Signed-off-by: Sughosh Ganu

    Use void * instead of efi_guid_t * for arguments to allow copying unaligned
    GUIDs. The GUIDs of configuration tables are __packed.

    Signed-off-by: Heinrich Schuchardt

    Sughosh Ganu
     
  • U-Boot can be compiled with function tracing enabled.

    When compiling with FTRACE __cyg_profile_func_enter() is called when a
    function is entered and __cyg_profile_func_exit() when the function is
    left.

    To avoid a crash we have to define these function for the free-standing
    UEFI binaries.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • On a VT100 terminal [2J should be enough to both clear the whole
    screen and set the cursor to position (1, 1). But the Linux console does
    not behave like this. So send an extra [H. For reference see the
    console_codes(4) man page.

    Add a function description.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • Add *.S to .gitignore.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • When the GetInfo() method of the EFI_FILE_PROTOCOL is called to retrieve
    the file system info we claim that the volume is read only and has no free
    space. This leads to failures in programs that check this information
    before writing to the volume like SCT's InstallSct.efi.

    Currently there is no function to determine these parameters in U-Boot. So
    let's return optimistic values:

    Return that the volume is writable.

    Return the volume size as free space.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • UEFI applications like GRUB and SCT assume that function keys are enabled
    on the keyboard.

    Let EFI_LOADER imply USB_KEYBOARD_FN_KEYS.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     

03 Dec, 2019

5 commits


23 Nov, 2019

1 commit

  • Some of the ARM11 boards have tight limits on the size of U-Boots. Hence
    use EFI_LOADER=n as default on ARM11.

    Set EFI_LOADER=y for the Raspberry Pi and Raspberry Pi Zero as these boards
    have sufficient storage on the SD card.

    Suggested-by: Tom Rini
    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     

19 Nov, 2019

3 commits

  • With an implementation for allow_unaligned() available for arm1136 and
    arm1176 UEFI can be supported on these architectures.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • fatload USB was reported to fail on the Sheevaplug. Debugging showed that
    this was caused by an incorrect unaligned write to memory in
    path_to_uefi().

    UEFI on ARM requires that unaligned memory access is enabled.

    * ARMv5 does not support unaligned access at all.
    * ARMv6 supports unaligned access when we clear the A flag and set the
    U flag.
    * On ARMv7 unaligned access is possible when clearing the aligned flag,
    which we do in function allow_unaligned() (arch/arm/cpu/armv7/sctlr.S).
    For none of the other cpus in arch/arm/cpu/ we have implemented a
    similar function.
    * ARMv8 allows unaligned access.

    Let EFI_LOADER on ARM depend on SYS_CPU=armv7 or SYS_CPU=armv8.

    Once we have implemented allow_unaligned() for other ARM CPUs we can add
    these to Kconfig.

    Reported-by: Gray Remlin
    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • Function efi_dp_from_dev() is not used anywhere. Remove it.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     

13 Nov, 2019

4 commits

  • On the sandbox the UEFI binaries must match the host architectures.

    Adjust the Makefiles. Provide the PE/COFF header and relocation files.

    Allow building helloworld.efi on the sandbox.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • On the sandbox we should mark the stack area as EFI runtime memory like we
    do on any other architecture.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     
  • Currently, a whole disk without any partitions is not associated
    with EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses some
    file system, there is a chance that we may not be able to access
    it, particularly, when accesses are to be attempted after searching
    that protocol against a device handle.

    With this patch, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed
    to such a disk if part_get_info() shows there is no partition
    table installed on it.

    Signed-off-by: AKASHI Takahiro

    Only if no partition table exists, check for a file system on disk level.
    Signed-off-by: Heinrich Schuchardt

    AKASHI Takahiro
     
  • Correctly check the return value of efi_dp_from_file().
    If we can determine device path for the file, should not depend on the
    device path for the device being requested.
    Provide a function description for efi_dp_from_name().

    Reported-by: Coverity CID 273159, CID 273158
    Fixes: 08c51fff30cc ("efi_loader: device_path: check against file path length")
    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     

31 Oct, 2019

1 commit

  • 'make tests' on an 32bit ARM system leads to

    In file included from ../lib/efi_loader/efi_variable.c:9:
    ../include/malloc.h:364:7: error: conflicting types for ‘memset’
    void* memset(void*, int, size_t);
    ^~~~~~
    In file included from ../include/compiler.h:126,
    from ../include/env.h:12,
    from ../lib/efi_loader/efi_variable.c:8:
    ../include/linux/string.h:103:15:
    note: previous declaration of ‘memset’ was here
    extern void * memset(void *,int,__kernel_size_t);
    ^~~~~~
    In file included from ../lib/efi_loader/efi_variable.c:9:
    ../include/malloc.h:365:7: error: conflicting types for ‘memcpy’
    void* memcpy(void*, const void*, size_t);
    ^~~~~~
    In file included from ../include/compiler.h:126,
    from ../include/env.h:12,
    from ../lib/efi_loader/efi_variable.c:8:
    ../include/linux/string.h:106:15:
    note: previous declaration of ‘memcpy’ was here
    extern void * memcpy(void *,const void *,__kernel_size_t);
    ^~~~~~

    Use common.h as first include as recommended by the U-Boot coding style
    guide.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     

18 Oct, 2019

1 commit