27 Dec, 2017

1 commit


19 Dec, 2017

1 commit


17 Dec, 2017

9 commits

  • Add a description for dp_part_fill().
    Reword a comment in the function.

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

    Heinrich Schuchardt
     
  • When converting device nodes and paths to text we should
    stick to the UEFI spec.

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

    Heinrich Schuchardt
     
  • According to the UEFI spec the numbering of partitions has to
    start with 1.

    Partion number 0 is reserved for the optional device path for
    the complete block device.

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

    Heinrich Schuchardt
     
  • The SD cards and eMMC devices have different device nodes.
    The current coding interpretes all MMC devices as eMMC.

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

    Heinrich Schuchardt
     
  • If a failure occurs when trying to load an image, it is insufficient
    to free() the EFI object. We must remove it from the object list,
    too. Otherwise a use after free will occur the next time we
    iterate over the object list.

    Furthermore errors in setting up the image should be handled.

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

    Heinrich Schuchardt
     
  • Provide a function to remove a handle from the object list
    after removing all protocols.

    To avoid forward declarations other functions have to move up
    in the coding.

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

    Heinrich Schuchardt
     
  • efi_setup_loaded_image() should return an error code indicating if
    an error has occurred.

    An error occurs if a protocol cannot be installed.

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

    Heinrich Schuchardt
     
  • When calling efi_dp_find_obj(), we usually want to find the *exact* match
    of an object for a given device path. However, I ran into a nasty corner case
    where I had the following objects with paths available:

    Handle 0x9feffa70
    /HardwareVendor(e61d73b9-a384-4acc-aeab-82e828f3628b)[0: ]/USB(6,0)/EndEntire
    Handle 0x9feffb58
    /HardwareVendor(e61d73b9-a384-4acc-aeab-82e828f3628b)[0: ]/USB(6,0)/HD(1,800,32000,2de808cb00000000,1,1)/EndEntire

    and was searching for

    /HardwareVendor(e61d73b9-a384-4acc-aeab-82e828f3628b)[0: ]/USB(6,0)/HD(1,800,32000,2de808cb00000000,1,1)/EndEntire

    But because our device path search looked for any substring match, it would
    return

    /HardwareVendor(e61d73b9-a384-4acc-aeab-82e828f3628b)[0: ]/USB(6,0)/EndEntire

    because that path is a full substring of the path we were searching for.

    So this patch adapts the device path search logic to always look for exact
    matches first. The way we distinguish between those cases is by looking at
    whether our caller actually deals with remainders.

    As a side effect, the code as is from all I can tell now never does a
    substring match anymore, because it always gets called with rem=NULL, so
    we always only do exact matches now.

    Reported-by: Jonathan Gray
    Signed-off-by: Alexander Graf

    Alexander Graf
     
  • Commit bbf75dd9345d0b ("efi_loader: output load options in helloworld")
    introduced a const variable in efi_main() called loaded_image_guid which
    got populated from a constant struct.

    While you would usually expect a compiler to realize that this variable
    should really just be a global pointer to .rodata, gcc disagrees and instead
    puts it on the stack. Unfortunately in some implementations of gcc it does
    so my calling memcpy() which we do not implement in our hello world
    environment.

    So let's explicitly move it to a global variable which in turn puts it in
    .rodata reliably and gets rid of the memcpy().

    Fixes: bbf75dd9345d0b ("efi_loader: output load options in helloworld")
    Reported-by: Florian Fainelli
    Signed-off-by: Alexander Graf
    Reviewed-by: Heinrich Schuchardt
    Tested-by: Florian Fainelli

    Alexander Graf
     

06 Dec, 2017

2 commits

  • Patch queue for efi - 2017-12-05

    Highlights for this release:

    - Dynamic EFI object creation (lists instead of static arrays)
    - EFI selftest improvements
    - Minor fixes

    Tom Rini
     
  • Commit f5a2a93892f ("efi_loader: consistently use efi_uintn_t in boot
    services") changed the internal EFI API header without adapting its existing
    EFI stub users. Let's adapt the EFI stub as well.

    Fixes: f5a2a93892f ("efi_loader: consistently use efi_uintn_t in boot services")
    Signed-off-by: Alexander Graf
    Reviewed-by: Heinrich Schuchardt

    Alexander Graf
     

04 Dec, 2017

2 commits


02 Dec, 2017

3 commits

  • Depending on your compiler, when compiling the hello world efi binary
    with -Os, gcc might think it's a smart idea to replace common patterns
    such as memory copies with explicit calls to memcpy().

    While that sounds great at first, we don't have any memcpy() available
    in our helloworld build target. So let's indicate to gcc that we really
    do want to have the code be built as freestanding.

    Fixes: bbf75dd9 ("efi_loader: output load options in helloworld")
    Signed-off-by: Alexander Graf

    Alexander Graf
     
  • Commit 884bcf6f65 (efi_loader: use proper device-paths for partitions) tried
    to introduce the el torito scheme to all partition table types: Spawn
    individual disk objects for each partition on a disk.

    Unfortunately, that code ended up creating partitions with offset=0 which meant
    that anyone accessing these objects gets data from the raw block device instead
    of the partition.

    Furthermore, all the el torito logic to spawn devices for partitions was
    duplicated. So let's merge the two code paths and give partition disk objects
    good offsets to work from, so that payloads can actually make use of them.

    Fixes: 884bcf6f65 (efi_loader: use proper device-paths for partitions)
    Reported-by: Yousaf Kaukab
    Signed-off-by: Alexander Graf

    Alexander Graf
     
  • Otherwise with GUID partition types you would end up with things like:

    .../HD(Part0,Sig6252c819-4624-4995-8d16-abc9cd5d4130)/HD(Part0,MBRType=02,SigType=02)

    Signed-off-by: Rob Clark
    [agraf: rebased]
    Signed-off-by: Alexander Graf

    Rob Clark
     

01 Dec, 2017

22 commits