- Jun 14, 2018
-
-
Alexander Graf authored
When we boot using memdp (bootefi on an address without previous load that populates the device path) then the memory device path we pass in is not backed by any handle. That can result in weird effects. For example grub gets very grumpy about this inside the efi_net module and just loops endlessly. So let's expose a simple handle that the memory device path is backed on. That way any code that looks for the device the dp is on, finds one. Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Jun 03, 2018
-
-
Heinrich Schuchardt authored
Do not use anonymous constants when calling efi_allocage_pages. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
The UEFI spec mandates that unaligned memory access should be enabled if supported by the CPU architecture. This patch adds an empty weak function unaligned_access() that can be overridden by an architecture specific routine. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
Remove a superfluous call to efi_init_obj_list() invoked by 'bootefi selftest'. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- May 11, 2018
-
-
Tom Rini authored
As part of the main conversion a few files were missed. These files had additional whitespace after the '*' and before the SPDX tag and my previous regex was too strict. This time I did a grep for all SPDX tags and then filtered out anything that matched the correct styles. Fixes: 83d290c5 ("SPDX: Convert all of our single license tags to Linux Kernel style") Reported-by:
Heinrich Schuchardt <xypron.debian@gmx.de> Signed-off-by:
Tom Rini <trini@konsulko.com>
-
- Apr 13, 2018
-
-
Joe Hershberger authored
This reverts the parts of commit 3b3ea2c5 where it changed the EFI dependency on NET. Signed-off-by:
Joe Hershberger <joe.hershberger@ni.com> Reviewed-by:
Duncan Hare <dh@synoia.com>
-
- Apr 06, 2018
-
-
Alexander Graf authored
With legacy boot (booti, bootz), people can declare memory regions as reserved using device tree memory reservations. This feature is some times used to indicate memory regions that should not be touched. Since in a UEFI world, the DT memory reservations do not get honored, let's copy them into the UEFI memory map so everyone has a coherent view of the world and we give people the chance to add reservations on demand. Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Apr 04, 2018
-
-
Heinrich Schuchardt authored
The device path of the loaded image should be set to the partition from which the image was loaded. This requires using the same logic as the load command. Without the patch the device path pointed to the whole disk after executing load mmc 0: 0x43000000 FILE and not to the boot partition from which the file was actually loaded. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
The second argument of the bootefi command should always be usable to specify a device tree. This was missing for bootefi selftest and bootefi hello. Proper error handling is added. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
Up to now errors in the initialization of the EFI subsystems was not checked. If any initialization fails, leave the bootefi command. We do not retry initialization because this would require to undo all prior initalization steps. Suggested-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
The return type of do_bootefi_exec() is efi_status_t. So in case of an error we should always return an EFI status code. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
efi_init_obj_list() should be executed only once. Rather than having the caller check this variable and the callee set it, move all access to the variable inside the function. This reduces the logic needed to call efi_init_obj_list(). Suggested-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Mar 05, 2018
-
-
Masahiro Yamada authored
Thomas reported U-Boot failed to build host tools if libfdt-devel package is installed because tools include libfdt headers from /usr/include/ instead of using internal ones. This commit moves the header code: include/libfdt.h -> include/linux/libfdt.h include/libfdt_env.h -> include/linux/libfdt_env.h and replaces include directives: #include <libfdt.h> -> #include <linux/libfdt.h> #include <libfdt_env.h> -> #include <linux/libfdt_env.h> Reported-by:
Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com>
-
- Feb 27, 2018
-
-
Michal Simek authored
Enable networking command only when NET is enabled. And remove selecting NET for CMD_NET Signed-off-by:
Michal Simek <michal.simek@xilinx.com> Signed-off-by:
Tom Rini <trini@konsulko.com>
-
- Feb 09, 2018
-
-
Heinrich Schuchardt authored
The bootefi command is missing in the online help for bootefi bootmgr. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Jan 28, 2018
-
-
Heinrich Schuchardt authored
If 'bootefi hello' or 'bootefi selftest' can be executed depends on the configuration. If an invalid non-numeric 1st argument is passed to bootefi, e.g. 'bootefi hola', this string is converted to 0 and U-Boot jumps to this typically invalid address. With the patch the online help is shown instead. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Alexander Graf authored
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 <agraf@suse.de> --- v1 -> v2: - Use efi_status_t in all occurences
-
- Jan 22, 2018
-
-
Heinrich Schuchardt authored
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 <xypron.glpk@gmx.de> [agraf: add comment on calloc len] Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
The device tree is needed at runtime. So we have to store it in EFI_RUNTIME_SERVICES_DATA memory. The UEFI spec recommends to store all configuration tables in EFI_RUNTIME_SERVICES_DATA memory. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
We should consistently use the efi_handle_t typedef when referring to handles. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Dec 01, 2017
-
-
Heinrich Schuchardt authored
The handle of a loaded image is the value of the handle member of the loaded image info object and not the address of the loaded image info. Reviewed-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Stefan Roese authored
When trying to load an image from a non-existent USB key, U-Boot v2017.11 crashes on my x86 platform: => load usb 0:1 03000000 abc General Protection EIP: 0010:[<7b59030d>] EFLAGS: 00010286 Original EIP :[<fff4330d>] ... This used to work in v2017.09. Testing has shown, that this bug was introduced with patch 95c5553e [efi_loader: refactor boot device and loaded_image handling]. This patch now checks if a valid "desc" is returned from blk_get_dev() and only continues when "desc" is available. Resulting in this cmd output (again): => load usb 0:1 03000000 abc ** Bad device usb 0 ** Signed-off-by:
Stefan Roese <sr@denx.de> Reviewed-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
Use environment variable bootargs used as load options for bootefi payloads. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
After executing bootefi selftest * restore GD * unlink the load image handle * return 0 or 1 and not a truncated efi_status_t. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
Environment variable efi_selftest is passed as load options to the selftest application. It is used to select a single test to be executed. The load options are an UTF8 string. Yet I decided to keep the name propertiy of the tests as char[] to reduce code size. Special value 'list' displays a list of all available tests. Tests get an on_request property. If this property is set the tests are only executed if explicitly requested. The invocation of efi_selftest is changed to reflect that bootefi selftest with efi_selftest = 'list' will call the Exit bootservice. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
Currently we pass bootefi_device_path and bootefi_image_path as device and image path without initializing them. They may carry values from previous calls to bootefi. With the patch the variables are initialized valid dummy values. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
Where ulong or unsigned long are used to hold an EFI status code we should consistenly use efi_status_t. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
The watchdog is initialized with a 5 minute timeout period. It can be reset by SetWatchdogTimer. It is stopped by ExitBoottimeServices. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Oct 12, 2017
-
-
Rob Clark authored
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: 95c5553e ("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>
-
- Sep 21, 2017
-
-
Rob Clark authored
efi_exit() already restores gd, so we shouldn't EFI_EXIT() on the otherside of the longjmp(). Signed-off-by:
Rob Clark <robdclark@gmail.com> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Sep 20, 2017
-
-
Heinrich Schuchardt authored
ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling leads to an error when building with CONFIG_CMD_BOOTEFI_SELFTEST=y This patch fixes the problem. Fixes: ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by:
Rob Clark <robdclark@gmail.com> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Rob Clark authored
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>
-
Rob Clark authored
Add EFI variable support, mapping to u-boot environment variables. Variables are pretty important for setting up boot order, among other things. If the board supports saveenv, then it will be called in ExitBootServices() to persist variables set by the efi payload. (For example, fallback.efi configuring BootOrder and BootXXXX load-option variables.) Variables are *not* currently exposed at runtime, post ExitBootServices. On boards without a dedicated device for storage, which the loaded OS is not trying to also use, this is rather tricky. One idea, at least for boards that can persist RAM across reboot, is to keep a "journal" of modified variables in RAM, and then turn halt into a reboot into u-boot, plus store variables, plus halt. Whatever the solution, it likely involves some per-board support. Mapping between EFI variables and u-boot variables: efi_$guid_$varname = {attributes}(type)value For example: efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported= "{ro,boot,run}(blob)0000000000000000" efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_BootOrder= "(blob)00010000" The attributes are a comma separated list of these possible attributes: + ro - read-only + boot - boot-services access + run - runtime access NOTE: with current implementation, no variables are available after ExitBootServices, and all are persisted (if possible). If not specified, the attributes default to "{boot}". The required type is one of: + utf8 - raw utf8 string + blob - arbitrary length hex string Signed-off-by:
Rob Clark <robdclark@gmail.com> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Rob Clark authored
Get rid of the hacky fake boot-device and duplicate device-path constructing (which needs to match what efi_disk and efi_net do). Instead convert over to use efi_device_path helpers to construct device-paths, and use that to look up the actual boot device. Also, extract out a helper to plug things in properly to the loaded_image. In a following patch we'll want to re-use this in efi_load_image() to handle the case of loading an image from a file_path. Signed-off-by:
Rob Clark <robdclark@gmail.com> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Sep 18, 2017
-
-
Heinrich Schuchardt authored
A testing framework for the EFI API is provided. It can be executed with the 'bootefi selftest' command. It is coded in a way that at a later stage we may turn it into a standalone EFI application. The current build system does not allow this yet. All tests use a driver model and are run in three phases: setup, execute, teardown. A test may be setup and executed at boottime, it may be setup at boottime and executed at runtime, or it may be setup and executed at runtime. After executing all tests the system is reset. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
In scripts/Makefile.lib we build section including helloworld.efi. This allows to load the EFI binary with command 'bootefi hello'. scripts/Makefile.lib contains explicit references to strings containing helloworld and hello_world. This makes it impossible to generalize the coding to accomodate additional built in EFI binaries. Let us rename the variables __efi_hello_world_* to __efi_helloworld_*. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
Heinrich Schuchardt authored
Command 'bootefi hello' currently uses CONFIG_SYS_LOAD_ADDR as loading address. qemu machines have by default 128 MiB RAM. CONFIG_SYS_LOAD_ADDR for x86 is 0x20000000 (512 MiB). This causes 'bootefi hello' to fail. We should use the environment variable loadaddr if available. It defaults to 0x1000000 (16 MiB) on qemu_x86. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Aug 12, 2017
-
-
xypron.glpk@gmx.de authored
We should use constant EFI_PAGE_SIZE instead of 4096 where the coding relies on 4096 being EFI_PAGE_SIZE. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Jul 26, 2017
-
-
Alexander Graf authored
Before commit 7cbc1241 ("efi_loader: initalize EFI object list only once") we recreated the world on every bootefi invocation. That included the object tree as well as the configuration tables. Now however we don't recreate them, which means we must not explicitly override the configuration tables, as otherwise we may lose our SMBIOS table from the configuration table list on second bootefi invocation. This patch makes bootefi call our normal configuration table modification APIs to add/remove the FDT instead of recreating all tables from scratch. That way the SMBIOS table gets preserved across multiple invocations. Signed-off-by:
Alexander Graf <agraf@suse.de>
-
- Jul 24, 2017
-
-
Heinrich Schuchardt authored
If several EFI applications are executed in sequence we want to keep the content of the EFI object list. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by:
Alexander Graf <agraf@suse.de>
-