summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_device_path.c
Commit message (Collapse)AuthorAgeFilesLines
...
* efi_loader: create full device path for block devicesHeinrich Schuchardt2018-01-221-2/+16
| | | | | | | | | When creating the device path of a block device it has to comprise the block device itself and should not end at its parent. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: comments for dp_part_fill()Heinrich Schuchardt2017-12-161-1/+8
| | | | | | | | Add a description for dp_part_fill(). Reword a comment in the function. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: correctly setup device paths for block devicesHeinrich Schuchardt2017-12-161-2/+2
| | | | | | | | | | | 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 <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: correctly determine if an MMC device is an SD-cardHeinrich Schuchardt2017-12-161-3/+21
| | | | | | | | The SD cards and eMMC devices have different device nodes. The current coding interpretes all MMC devices as eMMC. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Ensure efi_dp_find_obj() finds exact matchesAlexander Graf2017-12-161-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <jsg@jsg.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: simplify find_objHeinrich Schuchardt2017-12-011-24/+19
| | | | | | | | Use function efi_search_protocol(). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: initialise partition_signature memoryJonathan Gray2017-12-011-2/+19
| | | | | | | | | | | | | | | | | | | | | Zero partition_signature in the efi_device_path_hard_drive_path structure when signature_type is 0 (no signature) as required by the UEFI specification. This is required so that efi_dp_match() will work as expected when doing memcmp() comparisons. Previously uninitialised memory would cause it not match nodes when it should have when the signature type was not GUID. Corrects a problem where the loaded image protocol would not return a device path with MEDIA_DEVICE causing the OpenBSD bootloader to fail on rpi_3 and other targets. v2: Also handle signature_type 1 (MBR) as described in the specification Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Tested-by: Artturi Alm <artturi.alm@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: efi_dp_match should have const argumentsHeinrich Schuchardt2017-12-011-1/+2
| | | | | | | | efi_dp_match does not change its arguments. So they should be marked as const. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Add mem-mapped for fallbackRob Clark2017-10-121-0/+24
| | | | | | | | | | | | When we don't have a real device/image path, such as 'bootefi hello', construct a mem-mapped device-path. This fixes 'bootefi hello' after devicepath refactoring. Fixes: 95c5553ea2 ("efi_loader: refactor boot device and loaded_image handling") Signed-off-by: Rob Clark <robdclark@gmail.com> Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: add device-path utilsRob Clark2017-09-201-0/+563
Helpers to construct device-paths from devices, partitions, files, and for parsing and manipulating device-paths. For non-legacy devices, this will use u-boot's device-model to construct device-paths which include bus hierarchy to construct device-paths. For legacy devices we still fake it, but slightly more convincingly. Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>