15 Feb, 2018

1 commit


10 Feb, 2018

7 commits

  • efi_disk_register should return as status code (efi_status_t).

    Disks with zero blocks should be reported as 'not ready' without throwing
    an error.

    This patch solves a problem running OpenBSD on system configured with
    CONFIG_BLK=n (e.g. i.MX6).

    Reported-by: Jonathan Gray
    Signed-off-by: Heinrich Schuchardt
    Tested-by: Jonathan Gray
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Add stubs for UpdateCapsule, QueryCapsuleCapabilities, and
    QueryVariableInfo.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Change the return type of efi_driver_init() to efi_status_t.

    efi_driver_init() calls efi_add_driver() which returns an efi_status_t
    value. efi_driver_init() should not subject this value to a conversion to
    int losing high bits on 64bit systems.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Currently the UEFI revision number in the system table header is set to
    2.0.5. This version number does not refer to any existing version of the
    UEFI standard.

    Set the revision number to 2.7.

    Signed-off-by: Heinrich Schuchardt
    Reviewed-by: Mark Kettenis
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Currently we set the function pointer for the CreateEventEx boot service
    to NULL. When called this would lead to an immediate failure.

    A function stub is provided which handles the case that the boot service
    is called without an event group and returns EFI_UNSUPPORTED otherwise.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • For EFI binaries we need special CFLAGS.

    They were specified for an object file that since has been replaced.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Before the patch an undefined constant EFI_SUBSYSTEM was used in the
    crt0 code. The current version of binutils does not swallow the error.

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888403

    The necessary constant IMAGE_SUBSYSTEM_EFI_APPLICATION is already
    defined in pe.h. So let's factor out asm-generic/pe.h for the
    image subsystem constants and use it in our assembler code.

    IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER does not exist in the specification
    let's use IMAGE_SUBSYSTEM_EFI_ROM instead.

    The include pe.h is only used in code maintained by Alex so let him be the
    maintainer here too.

    Reported-by: Andre Przywara
    Signed-off-by: Heinrich Schuchardt
    Tested-by: Vagrant Cascadian
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     

09 Feb, 2018

3 commits

  • config_fallbacks.h has some logic that sets HAVE_BLOCK_DEVICE
    based on a list of enabled options. Moving HAVE_BLOCK_DEVICE to
    Kconfig allows us to drastically shrink the logic in
    config_fallbacks.h

    Signed-off-by: Adam Ford
    [trini: Rename HAVE_BLOCK_DEVICE to CONFIG_BLOCK_DEVICE]
    Signed-off-by: Tom Rini

    Adam Ford
     
  • config_fallback.h has some logic that checks a variety of options
    and selects LIB_UUID if it hasn't already been selected. This
    will all LIB_UUID in Kconfig and select this option for the list
    of options to allow us to remove the logic from fallbacks

    Signed-off-by: Adam Ford

    Adam Ford
     
  • config_fallbacks.h had some logic to automatically select
    LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
    already selected. By migrating LIB_HW_RAND to Kconfig, we can
    remove this check from config_fallbacks.h and put it into Kconfig

    Signed-off-by: Adam Ford
    Reviewed-by: Lukasz Majewski
    [trini: Turn into a choice, add NET_RANDOM_ETHADDR]
    Signed-off-by: Tom Rini

    Adam Ford
     

30 Jan, 2018

1 commit

  • AES encryption in CBC mode, in most cases, must be used with random
    initialization vector. Using the same key and initialization vector several
    times is weak and must be avoided.

    Added iv parameter to the aes_cbc_encrypt_blocks and aes_cbc_decrypt_blocks
    functions for passing initialization vector.

    Command 'aes' now also require the initialization vector parameter.

    Signed-off-by: Andrey Mozzhuhin

    Андрей Мозжухин
     

29 Jan, 2018

9 commits

  • Now that we have %pD support in vsprintf we should avoid separate
    logic for printing device paths in other places.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • In an image is loaded from memory we do not have a device path.
    Do not install NULL as device path in this case.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • When printing '%pD' with a value of NULL we want to output
    ''. But this requires copying to buf. Leave this
    to string16.

    A unit test is supplied which relies on EFI support in the sandbox.

    The development for EFI support in the sandbox is currently in branch
    u-boot-dm/efi-working. The branch lacks commit 6ea8b580f06b ("efi_loader:
    correct DeviceNodeToText for media types"). Ater rebasing the aforementioned
    branch on U-Boot v2018.01 and adding 256060e4257a2 and this patch the test
    is executed successfully.

    Fixes: 256060e4257a2 (vsprintf.c: add EFI device path printing)
    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • When a UEFI payload just returns instead of calling the Exit() callback,
    we handle that in efi_do_enter() and call Exit on its behalf, so that
    the loaded_image->exit_status value is correct.

    We were missing that logic in StartImage(). Call it there too.

    Reported-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Alexander Graf
     
  • Provide a better description for indent_string.
    Fix a typo.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • EFI calls are usually defined as asmlinkage. That means we pass all parameters
    to functions via the stack x86_32.

    On x86_64 however, we need to also stick to the MS ABI calling conventions,
    which the EFIAPI define conveniently handles for us. Most EFI functions were
    also marked with EFIAPI, except for the entry call.

    So this patch adjusts all entry calls to use EFIAPI instead of the manual
    asmlinkage attribute.

    While at it, we also change the prototype of the entry point to return
    efi_status_t instead of ulong, as this is the correct prototype definition.

    Signed-off-by: Alexander Graf

    ---

    v1 -> v2:

    - Use efi_status_t in all occurences

    Alexander Graf
     
  • 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
     
  • There is tons of code duplication between lib/libfdt/libfdt.h and
    scripts/dtc/libfdt/libfdt.h. Evacuate the U-Boot own code to
    include/libfdt.h and remove lib/libfdt/libfdt.h.

    For host tools, should include scripts/dtc/libfdt/libfdt.h,
    which is already suitable for user-space.

    For compiling U-Boot, should be included because we
    need a different libfdt_env.h .

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The only difference between scripts/dtc/libfdt/fdt_rw.c and
    lib/libfdt/fdt_rw.c is fdt_remove_unused_strings().

    It is only used by fdtgrep, so we do not need to compile it for U-Boot
    image. Move it to tools/libfdt/fdw_rw.c so that lib/libfdt/fdt_rw.c
    can be a wrapper of scripts/dtc/libfdt/fdt_rw.c.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass

    Masahiro Yamada
     

27 Jan, 2018

1 commit


26 Jan, 2018

1 commit

  • The sunXi arm64 build has overflown, leading to the main U-boot binary
    overwriting the environment when flashing the new image, or even worse,
    overwriting itself when we're calling saveenv.

    Disable this option that is not critical until we can adress the issue
    properly.

    Reviewed-by: Andre Przywara
    Signed-off-by: Maxime Ripard
    Reviewed-by: Jagan Teki

    Maxime Ripard
     

23 Jan, 2018

17 commits

  • Some messages are only useful if an error occurs.
    Fix a use after free.
    Add a missing free.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Create device path nodes for UCLASS_ETH udevices.
    Create device path nodes of block device children of UCLASS_MMC udevices.
    Consistently use debug for unsupported nodes.
    Set the log level to error.

    Signed-off-by: Heinrich Schuchardt
    [agraf: Fix build failure by adding #ifdef CONFIG_DM_ETH]
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • This test checks the driver for block IO devices.
    A disk image is created in memory.
    A handle is created for the new block IO device.
    The block I/O protocol is installed on the handle.
    ConnectController is used to setup partitions and to install the simple
    file protocol.
    A known file is read from the file system and verified.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • This patch provides
    * a uclass for EFI drivers
    * a EFI driver for block devices

    For each EFI driver the uclass
    * creates a handle
    * adds the driver binding protocol

    The uclass provides the bind, start, and stop entry points for the driver
    binding protocol.

    In bind() and stop() it checks if the controller implements the protocol
    supported by the EFI driver. In the start() function it calls the bind()
    function of the EFI driver. In the stop() function it destroys the child
    controllers.

    The EFI block driver binds to controllers implementing the block io
    protocol.

    When the bind function of the EFI block driver is called it creates a
    new U-Boot block device. It installs child handles for all partitions and
    installs the simple file protocol on these.

    The read and write functions of the EFI block driver delegate calls to the
    controller that it is bound to.

    A usage example is as following:

    U-Boot loads the iPXE snp.efi executable. iPXE connects an iSCSI drive and
    exposes a handle with the block IO protocol. It calls ConnectController.

    Now the EFI block driver installs the partitions with the simple file
    protocol.

    iPXE uses the simple file protocol to load Grub or the Linux Kernel.

    Signed-off-by: Heinrich Schuchardt
    [agraf: add comment on calloc len]
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • The output of the minicapps lacks a line feed.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • This pair of tests checks the StartImage boot service.

    Each test loads an EFI application into memory and starts it.
    One returns by calling the Exit boot service. The other returns directly.

    The tests are not built on x86_64 because the relocation code for the efi
    binary cannot be created.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • This patch lets the implementation of ExitBootServices conform to
    the UEFI standard.

    The timer events must be disabled before calling the notification
    functions of the exit boot services events.

    The boot services must be disabled in the system table.

    The handles in the system table should be defined as efi_handle_t.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • In ExitBootServices we need to signal events irrespective of the current
    TPL level. A new parameter check_tpl is added to efi_signal_event().

    Function efi_console_timer_notify() gets some comments.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • On a block device and its partitions the same protocols can be
    installed. To tell the apart we can use the type of the last
    node of the device path which is not the end node.

    The patch provides a utility function to find this last node.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Add the revision constants.
    Depending on the revision additional fields are needed in the
    media descriptor.
    Use efi_uintn_t for number of bytes to read or write.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Up to now we have been using efi_disk_create_partitions() to create
    partitions for block devices that existed before starting an EFI
    application.

    We need to call it for block devices created by EFI
    applications at run time. The EFI application will define the
    handle for the block device and install a device path protocol
    on it. We have to use this device path as stem for the partition
    device paths.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Provide new function efi_dp_part_node() to create a device
    node for a partition.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • The GUID of the EFI_BLOCK_IO_PROTOCOL is needed in different code
    parts. To avoid duplication make efi_block_io_guid a global symbol.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • The interface type name can be used to look up the interface type.
    Don't confound it with the driver name which may be different.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • The calling convention for the entry point of an EFI image
    is always 'asmlinkage'.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • Check if the device tree and the SMBIOS table are available.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     
  • The category of memory allocated for an EFI image should depend on
    its type (application, bootime service driver, runtime service driver).

    Our helloworld.efi built on arm64 has an illegal image type. Treat it
    like an EFI application.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt