aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_image_loader.c
AgeCommit message (Collapse)AuthorFilesLines
2018-01-22efi_loader: use correct format string for unsigned longHeinrich Schuchardt1-4/+4
virt_size is of type unsigned long. So it should be printed with %ul. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-20efi_loader: set loaded image code/data type properlyRob Clark1-0/+22
These should be set according to the image type. Shell.efi and SCT.efi use these fields to determine what sort of image they are loading. Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-20efi_loader: add bootmgrRob Clark1-0/+1
Similar to a "real" UEFI implementation, the bootmgr looks at the BootOrder and BootXXXX variables to try to find an EFI payload to load and boot. This is added as a sub-command of bootefi. The idea is that the distro bootcmd would first try loading a payload via the bootmgr, and then if that fails (ie. first boot or corrupted EFI variables) it would fallback to loading bootaa64.efi. (Which would then load fallback.efi which would look for \EFI\*\boot.csv and populate BootOrder and BootXXXX based on what it found.) Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-20efi_loader: add file/filesys supportRob Clark1-0/+3
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 <robdclark@gmail.com> [agraf: whitespace fixes, unsigned fixes] Signed-off-by: Alexander Graf <agraf@suse.de>
2017-07-19efi_loader: refactor efi_open_protocolxypron.glpk@gmx.de1-8/+0
efi_open_protocol was implemented to call a protocol specific open function to retrieve the protocol interface. The UEFI specification does not know of such a function. It is not possible to implement InstallProtocolInterface with the current design. With the patch the protocol interface itself is stored in the list of installed protocols of an efi_object instead of an open function. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: fix efi gop support] Signed-off-by: Alexander Graf <agraf@suse.de>
2017-07-04efi_loader: abort on unsupported relocation typexypron.glpk@gmx.de1-2/+8
If a relocation type is not supported loading the EFI binary should be aborted. Writing a message only is insufficient. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: use a() != b coding style] Signed-off-by: Alexander Graf <agraf@suse.de>
2016-11-14efi: Correct cache flush alignmentSimon Glass1-1/+2
Make sure that the cache flushes correctly by ensuring that the end address is correctly aligned. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2016-08-20efi_loader: Fix relocations above 64kb image sizeAlexander Graf1-1/+1
We were truncating the image offset within the target image to 16 bits which again meant that we were potentially overwriting random memory in the lower 16 bits of the image. This patch casts the offset to a more reasonable 32bits. With this applied, I can successfully see Shell.efi assert because it can't find a protocol it expects to be available. Signed-off-by: Alexander Graf <agraf@suse.de>
2016-03-27efi_loader: Fix some entry/exit pointsAlexander Graf1-4/+1
When switching between EFI context and U-Boot context we need to swap the register that "gd" resides in. Some functions slipped through here, with efi_allocate_pool / efi_free_pool not doing the switch correctly and efi_return_handle switching too often. Fix them all up to make sure we always have consistent register state. Signed-off-by: Alexander Graf <agraf@suse.de>
2016-03-15efi_loader: Add PE image loaderAlexander Graf1-0/+188
EFI uses the PE binary format for its application images. Add support to EFI PE binaries as well as all necessary bits for the "EFI image loader" interfaces. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>