29 Jan, 2018

1 commit

  • We have 2 users of the EFI headers: efi_loader and the EFI stub. Efi_loader
    always expects that the bitness of the definitions it uses is identical to
    the execution.

    The EFI stub however allows to run x86_64 U-Boot on 32bit EFI and the other
    way around, so it allows for different bitness of EFI definitions and U-Boot
    environment.

    This patch explicitly requests via Kconfig that efi_loader can only be enabled
    if the bitness is identical. Because we can run efi_loader on x86_64 without
    EFI stub enabled, it also ensures that this case propagates the correct ABI
    constraints.

    Signed-off-by: Alexander Graf

    Alexander Graf
     

01 Dec, 2017

1 commit


20 Sep, 2017

3 commits

  • Add EFI variable support, mapping to u-boot environment variables.
    Variables are pretty important for setting up boot order, among other
    things. If the board supports saveenv, then it will be called in
    ExitBootServices() to persist variables set by the efi payload. (For
    example, fallback.efi configuring BootOrder and BootXXXX load-option
    variables.)

    Variables are *not* currently exposed at runtime, post ExitBootServices.
    On boards without a dedicated device for storage, which the loaded OS
    is not trying to also use, this is rather tricky. One idea, at least
    for boards that can persist RAM across reboot, is to keep a "journal"
    of modified variables in RAM, and then turn halt into a reboot into
    u-boot, plus store variables, plus halt. Whatever the solution, it
    likely involves some per-board support.

    Mapping between EFI variables and u-boot variables:

    efi_$guid_$varname = {attributes}(type)value

    For example:

    efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported=
    "{ro,boot,run}(blob)0000000000000000"
    efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_BootOrder=
    "(blob)00010000"

    The attributes are a comma separated list of these possible
    attributes:

    + ro - read-only
    + boot - boot-services access
    + run - runtime access

    NOTE: with current implementation, no variables are available after
    ExitBootServices, and all are persisted (if possible).

    If not specified, the attributes default to "{boot}".

    The required type is one of:

    + utf8 - raw utf8 string
    + blob - arbitrary length hex string

    Signed-off-by: Rob Clark
    Signed-off-by: Alexander Graf

    Rob Clark
     
  • fallback.efi (and probably other things) use UEFI's simple-file-system
    protocol and file support to search for OS's to boot.

    Signed-off-by: Rob Clark
    [agraf: whitespace fixes, unsigned fixes]
    Signed-off-by: Alexander Graf

    Rob Clark
     
  • Prep work for next patch.

    Signed-off-by: Rob Clark
    Reviewed-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Rob Clark
     

19 Sep, 2017

1 commit


19 Jul, 2017

1 commit


15 Nov, 2016

1 commit

  • At present we use a CONFIG option in efi.h to determine whether we are
    building the EFI stub or not. This means that the same header cannot be
    used for EFI_LOADER support. The CONFIG option will be enabled for the
    whole build, even when not building the stub.

    Use a different define instead, set up just for the files that make up the
    stub.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Signed-off-by: Alexander Graf

    Simon Glass
     

19 Oct, 2016

1 commit


07 Sep, 2016

1 commit

  • Provide version of struct efi_mem_desc in efi_get_memory_map().

    EFI_BOOT_SERVICES.GetMemoryMap() in UEFI specification v2.6 defines
    memory descriptor version to 1. Linux kernel also expects descriptor
    version to be 1 and prints following warning during boot if its not:

    Unexpected EFI_MEMORY_DESCRIPTOR version 0

    Signed-off-by: Mian Yousaf Kaukab

    Mian Yousaf Kaukab
     

30 Aug, 2016

2 commits

  • There are lots of warnings when building EFI 64-bit payload.

    include/asm-generic/bitops/__fls.h:17:2:
    warning: left shift count >= width of type
    if (!(word & (~0ul << 32))) {
    ^

    In fact, U-Boot itself as EFI payload is running in 32-bit mode.
    So BITS_PER_LONG needs to still be 32, but EFI status codes are
    64-bit when booting from 64-bit EFI. Introduce EFI_BITS_PER_LONG
    to bridge those status codes with U-Boot's BITS_PER_LONG.

    Signed-off-by: Bin Meng
    Reviewed-by: Simon Glass

    Bin Meng
     
  • Since commit 73c5c39 "Makefile: Drop unnecessary -dtb suffixes",
    EFI payload does not build anymore. This fixes the build.

    Signed-off-by: Bin Meng
    Reviewed-by: Simon Glass

    Bin Meng
     

16 Mar, 2016

1 commit

  • The EFI API header is great, but missing a good chunk of function prototype,
    GUID defines and enum declarations.

    This patch extends it to cover more of the EFI API. It's still not 100%
    complete, but sufficient enough for our EFI payload interface.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass
    Tested-by: Simon Glass

    Alexander Graf
     

05 Aug, 2015

3 commits

  • Most EFI implementations use 64-bit. Add a way to build U-Boot as a 64-bit
    EFI payload. The payload unpacks a (32-bit) U-Boot and starts it. This can
    be enabled for x86 boards at present.

    Signed-off-by: Simon Glass
    Improvements to how the payload is built:
    Signed-off-by: Bin Meng
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Simon Glass
     
  • It is useful to be able to load U-Boot onto a board even if is it already
    running EFI. This can allow access to the U-Boot command interface, flexible
    booting options and easier development.

    The easiest way to do this is to build U-Boot as a binary blob and have an
    EFI stub copy it into RAM. Add support for this feature, targeting 32-bit
    initially.

    Also add a way to detect when U-Boot has been loaded via a stub. This goes
    in common.h since it needs to be widely available so that we avoid redoing
    initialisation that should be skipped.

    Signed-off-by: Simon Glass
    Improvements to how the payload is built:
    Signed-off-by: Bin Meng
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Simon Glass
     
  • When running as an EFI application, U-Boot must request memory from EFI,
    and provide access to the boot services U-Boot needs.

    Add library code to perform these tasks. This includes efi_main() which is
    the entry point from EFI. U-Boot is built as a shared library.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng

    Simon Glass