summaryrefslogtreecommitdiff
path: root/cmd/bootefi.c
Commit message (Collapse)AuthorAgeLines
* armv8: Support loading 32-bit OS in AArch32 execution stateAlison Wang2016-11-22-3/+20
| | | | | | | | | | | | | To support loading a 32-bit OS, the execution state will change from AArch64 to AArch32 when jumping to kernel. The architecture information will be got through checking FIT image, then U-Boot will load 32-bit OS or 64-bit OS automatically. Signed-off-by: Ebony Zhu <ebony.zhu@nxp.com> Signed-off-by: Alison Wang <alison.wang@nxp.com> Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
* efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3Alexander Graf2016-11-17-0/+11
| | | | | | | | | | Some boards decided not to run ATF or other secure firmware in EL3, so they instead run U-Boot there. The uEFI spec doesn't know what EL3 is though - it only knows about EL2 and EL1. So if we see that we're running in EL3, let's get into EL2 to make payloads happy. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: York Sun <york.sun@nxp.com>
* efi: Add support for a hello world test programSimon Glass2016-11-14-6/+21
| | | | | | | | | It is useful to have a basic sanity check for EFI loader support. Add a 'bootefi hello' command which loads HelloWord.efi and runs it under U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org> [agraf: Fix documentation, add unfulfilled kconfig dep] Signed-off-by: Alexander Graf <agraf@suse.de>
* efi: Fix debug message address formatSimon Glass2016-11-14-1/+1
| | | | | | | This should use U-Boot's standard format for hex address. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Revert device_handle to disk after net bootAlexander Graf2016-10-19-0/+2
| | | | | | | | | | | | | | | When you boot an efi payload from network, then exit that payload and load another payload from disk afterwords, the disk payload will currently see the network device as its boot path. This breaks grub2 for example which tries to find its modules based on the path it was loaded from. This patch fixes that issue by always reverting to disk paths if we're not in the network boot. That way the data structures after a network boot look the same as before. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi: Fix missing EFIAPI specifiersSimon Glass2016-10-19-2/+5
| | | | | | | | | These are missing in some functions. Add them to keep things consistent. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* smbios: Expose in efi_loader as tableAlexander Graf2016-10-19-0/+3
| | | | | | | | | | | | We can pass SMBIOS easily as EFI configuration table to an EFI payload. This patch adds enablement for that case. While at it, we also enable SMBIOS generation for ARM systems, since they support EFI_LOADER. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* efi_loader: Allow boards to implement get_time and reset_systemAlexander Graf2016-10-18-0/+4
| | | | | | | | | | | | | | | EFI allows an OS to leverage firmware drivers while the OS is running. In the generic code we so far had to stub those implementations out, because we would need board specific knowledge about MMIO setups for it. However, boards can easily implement those themselves. This patch provides the framework so that a board can implement its own versions of get_time and reset_system which would actually do something useful. While at it we also introduce a simple way for code to reserve MMIO pointers as runtime available. Signed-off-by: Alexander Graf <agraf@suse.de>
* cmd: efi_loader: Return CMD_RET_USAGE in case of not enough argumentsBin Meng2016-08-20-1/+1
| | | | | | | | When typing 'bootefi' from U-Boot shell, nothing outputs. Like other commands, return CMD_RET_USAGE so that it can print help message. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Alexander Graf <agraf@suse.de>
* efi_loader: disk: Fix CONFIG_BLK breakageAlexander Graf2016-08-08-5/+18
| | | | | | | | | | | | | | | When using CONFIG_BLK, there were 2 issues: 1) The name we generate the device with has to match the name we set in efi_set_bootdev() 2) The device we pass into our block functions was wrong, we should not rediscover it but just use the already known pointer. This patch fixes both issues. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Make exposed image loader path absoluteAlexander Graf2016-07-25-1/+6
| | | | | | | | | | | | | When loading an efi image, we pass it the location it was loaded from. On file system backends, there are no relative paths, so we should always pass in absolute ones. For network paths, we may be relative. This fixes distro booting with grub2 for me when it fetches the grub2 config file from the loader partition. Reported-by: york sun <york.sun@nxp.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* cmd: bootefi: cosmeticSergey Kubushyn2016-06-24-1/+1
| | | | | | | | | | | | | | | | | | Short help (description) in bootefi command has a trailing "\n" that breaks the "help" command output (empty line after "bootefi"). Nothing important, doesn't affect anything but better be fixed in the upcoming release. Still working on i.MX6 and their siblings NAND U-Boot update -- it works here but not ready for a submission yet. Anyway it is for the next cycle, not going to go into this release because it is too big and may affect something else. Also have some thoughts about fastboot (using multiple devices) but this will go into separate email with RFC. Signed-off-by: Sergey Kubushyn <ksi@koi8.net>
* efi_loader: Move to normal debug infrastructureAlexander Graf2016-06-06-3/+1
| | | | | | | | | | | | We introduced special "DEBUG_EFI" defines when the efi loader support was new. After giving it a bit of thought, turns out we really didn't have to - the normal #define DEBUG infrastructure works well enough for efi loader as well. So this patch switches to the common debug() and #define DEBUG way of printing debug information. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Add exit supportAlexander Graf2016-06-06-0/+6
| | | | | | | | | | | Some times you may want to exit an EFI payload again, for example to default boot into a PXE installation and decide that you would rather want to boot from the local disk instead. This patch adds exit functionality to the EFI implementation, allowing EFI payloads to exit. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Add network access supportAlexander Graf2016-05-27-0/+7
| | | | | | | | | | | | | We can now successfully boot EFI applications from disk, but users may want to also run them from a PXE setup. This patch implements rudimentary network support, allowing a payload to send and receive network packets. With this patch, I was able to successfully run grub2 with network access inside of QEMU's -M xlnx-ep108. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Pass fdt address directly to bootefi cmdAlexander Graf2016-04-18-20/+16
| | | | | | | | | | | | | | | The bootefi cmd today fetches its device tree pointer from either the location appointed by "fdt addr" with a fallback to the U-Boot control fdt. This integration is unusual for U-Boot and diverges from the way we usually handle parameters to boot commands. So let's pass the fdt directly into the bootefi command instead and move the control fdt logic into the distro boot script. Signed-off-by: Alexander Graf <agraf@suse.de> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Reviewed-by: Andreas Färber <afaerber@suse.de>
* efi_loader: Put fdt into convenient locationAlexander Graf2016-04-18-4/+26
| | | | | | | | | | | | The uEFI spec doesn't dictate where the device tree should live at, but legacy 32bit ARM grub2 has some assumptions that it may stay at its place when it's already loaded by the firmware. So let's put it somewhere where Linux that comes after would happily find it - around the recommended 128MB line. Signed-off-by: Alexander Graf <agraf@suse.de> Tested-by: Andreas Färber <afaerber@suse.de>
* efi_loader: Use system fdt as fallbackAlexander Graf2016-04-18-6/+31
| | | | | | | | | | | | | | | | When the user did not pass any device tree or the boot script didn't find any, let's use the system device tree as last resort to get something the payload (Linux) may understand. This means that on systems that use the same device tree for U-Boot and Linux we can just share it and there's no need to manually provide a device tree in the target image. While at it, also copy and pad the device tree by 64kb to give us space for modifications. Signed-off-by: Alexander Graf <agraf@suse.de> Tested-by: Andreas Färber <afaerber@suse.de>
* efi_loader: Increase path string to 32 charactersAlexander Graf2016-04-18-1/+1
| | | | | | | | | | | | Whenever we want to tell our payload about a path, we limit ourselves to a reasonable amount of characters. So far we only passed in device names - exceeding 16 chars was unlikely there. However by now we also pass real file path information, so let's increase the limit to 32 characters. That way common paths like "boot/efi/bootaa64.efi" fit just fine. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Pass file path to payloadAlexander Graf2016-04-18-7/+25
| | | | | | | | | | | | | | The payload gets information on where it got loaded from. This includes the device as well as file path. So far we've treated both as the same thing and always gave it the device name. However, in some situations grub2 actually wants to find its loading path to find its configuration file. So let's split the two semantically separte bits into separate structs and pass the loaded file name into our payload when we load it using "load". Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Add el torito supportAlexander Graf2016-04-18-0/+14
| | | | | | | | | | When loading an el torito image, uEFI exposes said image as a raw block device to the payload. Let's do the same by creating new block devices with added offsets for the respective el torito partitions. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Add GOP supportAlexander Graf2016-03-27-0/+3
| | | | | | | | | | | | The EFI standard defines a simple boot protocol that an EFI payload can use to access video output. This patch adds support to expose exactly that one (and the mode already in use) as possible graphical configuration to an EFI payload. With this, I can successfully run grub2 with graphical output. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Pass proper device path in on bootAlexander Graf2016-03-15-9/+25
| | | | | | | | | | | | | | | | | EFI payloads can query for the device they were booted from. Because we have a disconnect between loading binaries and running binaries, we passed in a dummy device path so far. Unfortunately that breaks grub2's logic to find its configuration file from the same device it was booted from. This patch adds logic to have the "load" command call into our efi code to set the device path to the one we last loaded a binary from. With this grub2 properly detects where we got booted from and can find its configuration file, even when searching by-partition. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Call fdt preparation functionsAlexander Graf2016-03-15-0/+8
| | | | | | | | | | | We have a nice framework around image fils to prepare a device tree for OS execution. That one patches in missing device tree nodes and fixes up the memory range bits. We need to call that one from the EFI boot path too to get all those nice fixups. This patch adds the call. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Add "bootefi" commandAlexander Graf2016-03-15-0/+182
In order to execute an EFI application, we need to bridge the gap between U-Boot's notion of executing images and EFI's notion of doing the same. The best path forward IMHO here is to stick completely to the way U-Boot deals with payloads. You manually load them using whatever method to RAM and then have a simple boot command to execute them. So in our case, you would do # load mmc 0:1 $loadaddr grub.efi # bootefi $loadaddr which then gets you into a grub shell. Fdt information known to U-boot via the fdt addr command is also passed to the EFI payload. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> [trini: Guard help text with CONFIG_SYS_LONGHELP] Signed-off-by: Tom Rini <trini@konsulko.com>