aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-01-23Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini
Patch queue for efi - 2018-01-23 This time around we have a lot of EFI patches from Heinrich. Highlights are: - Allow EFI applications to register as drivers - Allow exposure of U-Boot block devices from an EFI payload - Compatibility improvements
2018-01-22Revert "travis-ci: Add qemu-x86_64 target"Tom Rini
This reverts commit 998ae28799c79c6bc796aea182ae6acf13d18284. This continues to fail in travis itself, so remove for now. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-01-22Convert CONFIG_SOC_DA8XX et al to KconfigAdam Ford
This converts the following to Kconfig: CONFIG_SOC_DA8XX CONFIG_SOC_DA850 CONFIG_DA850_LOWLEVEL CONFIG_MACH_DAVINCI_DA850_EVM CONFIG_SYS_DA850_PLL_INIT CONFIG_SYS_DA850_DDR_INIT Signed-off-by: Adam Ford <aford173@gmail.com> Reviewed-by: David Lechner <david@lechnology.com> [trini: Rework CONFIG_SYS_DA850_PLL_INIT so it's selected on SOC_DA8XX] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-01-22efi_selftest: reduce noise in test output for device treesHeinrich Schuchardt
Some messages are only useful if an error occurs. Fix a use after free. Add a missing free. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: allow creation of more device part nodesHeinrich Schuchardt
Create device path nodes for UCLASS_ETH udevices. Create device path nodes of block device children of UCLASS_MMC udevices. Consistently use debug for unsupported nodes. Set the log level to error. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: Fix build failure by adding #ifdef CONFIG_DM_ETH] Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: provide a test for block ioHeinrich Schuchardt
This test checks the driver for block IO devices. A disk image is created in memory. A handle is created for the new block IO device. The block I/O protocol is installed on the handle. ConnectController is used to setup partitions and to install the simple file protocol. A known file is read from the file system and verified. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_driver: EFI block driverHeinrich Schuchardt
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>
2018-01-22efi_selftest: add missing LF in test outputHeinrich Schuchardt
The output of the minicapps lacks a line feed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: store DT in EFI_RUNTIME_SERVICES_DATA memoryHeinrich Schuchardt
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>
2018-01-22efi_selftest: test start imageHeinrich Schuchardt
This pair of tests checks the StartImage boot service. Each test loads an EFI application into memory and starts it. One returns by calling the Exit boot service. The other returns directly. The tests are not built on x86_64 because the relocation code for the efi binary cannot be created. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: fix ExitBootServicesHeinrich Schuchardt
This patch lets the implementation of ExitBootServices conform to the UEFI standard. The timer events must be disabled before calling the notification functions of the exit boot services events. The boot services must be disabled in the system table. The handles in the system table should be defined as efi_handle_t. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: add check_tpl parameter to efi_signal_eventHeinrich Schuchardt
In ExitBootServices we need to signal events irrespective of the current TPL level. A new parameter check_tpl is added to efi_signal_event(). Function efi_console_timer_notify() gets some comments. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: provide function to get last node of a device pathHeinrich Schuchardt
On a block device and its partitions the same protocols can be installed. To tell the apart we can use the type of the last node of the device path which is not the end node. The patch provides a utility function to find this last node. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: correct EFI_BLOCK_IO_PROTOCOL definitionsHeinrich Schuchardt
Add the revision constants. Depending on the revision additional fields are needed in the media descriptor. Use efi_uintn_t for number of bytes to read or write. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: make efi_disk_create_partitions a global symbolHeinrich Schuchardt
Up to now we have been using efi_disk_create_partitions() to create partitions for block devices that existed before starting an EFI application. We need to call it for block devices created by EFI applications at run time. The EFI application will define the handle for the block device and install a device path protocol on it. We have to use this device path as stem for the partition device paths. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: provide a function to create a partition nodeHeinrich Schuchardt
Provide new function efi_dp_part_node() to create a device node for a partition. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: make efi_block_io_guid a global symbolHeinrich Schuchardt
The GUID of the EFI_BLOCK_IO_PROTOCOL is needed in different code parts. To avoid duplication make efi_block_io_guid a global symbol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: efi_disk_register: correctly determine if_type_nameHeinrich Schuchardt
The interface type name can be used to look up the interface type. Don't confound it with the driver name which may be different. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: fix StartImage bootserviceHeinrich Schuchardt
The calling convention for the entry point of an EFI image is always 'asmlinkage'. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: check tables in helloworld.efiHeinrich Schuchardt
Check if the device tree and the SMBIOS table are available. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: allocate correct memory type for EFI imageHeinrich Schuchardt
The category of memory allocated for an EFI image should depend on its type (application, bootime service driver, runtime service driver). Our helloworld.efi built on arm64 has an illegal image type. Treat it like an EFI application. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: print device path when entering efi_load_imageHeinrich Schuchardt
Use %pD to print the device path instead of its address when entering efi_load_image. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: correct find simple file system protocolHeinrich Schuchardt
In contrast to the description the code did not split the device path into device part and file part. The code should use the installed protocol and not refer to the internal structure of the the disk object. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: address of the simple file system protocolHeinrich Schuchardt
When installing the the simple file system protocol we have to path the address of the structure and not the address of a pointer to the structure. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: return NULL from device path functionsHeinrich Schuchardt
For the construction of device paths we need to call the AllocatePool service. We should not ignore if it fails due to an out of memory situation. This patch changes the device path functions to return NULL if the memory allocation fails. Additional patches will be needed to fix the callers. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: consistently use efi_handle_t for handlesHeinrich Schuchardt
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>
2018-01-22efi_selftest: test for (Dis)ConnectControllerHeinrich Schuchardt
This unit test checks the following protocol services: ConnectController, DisconnectController, InstallProtocol, UninstallProtocol, OpenProtocol, CloseProtcol, OpenProtocolInformation Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: remove todo in device path testHeinrich Schuchardt
The installation of UninstallProtocol is functional now. So we do not expect errors when calling it. Call UninstallProtocol with correct level of indirection for parameter handle. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: remove todo in manage protocolsHeinrich Schuchardt
The installation of UninstallProtocols is functional now. So we do not expect errors when calling it. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: disconnect controllers in UninstallProtocolHeinrich Schuchardt
The UninstallProtocol boot service should first try to disconnect controllers that have been connected with EFI_OPEN_PROTOCOL_BY_DRIVER. If the protocol is still opened by an agent, it should be closed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: implement DisconnectControllerHeinrich Schuchardt
Unfortunately we need a forward declaration because both OpenProtocol and CloseProtocol have to call DisconnectController. And DisconnectController calls both OpenProtcol and CloseProtocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: fix signature of efi_disconnect_controllerHeinrich Schuchardt
Handles should be passed as efi_handle_t and not as void *. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: implement ConnectControllerHeinrich Schuchardt
Implement the ConnectController boot service. A unit test is supplied in a subsequent patch. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: debug output installed device pathHeinrich Schuchardt
When a device path protocol is installed write the device path to the console in debug mode. For printing the new macro EFI_PRINT is used, which can be reused for future diagnostic output. Remove unused EFI_PRINT_GUID macro Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: implement OpenProtocolInformationHeinrich Schuchardt
efi_open_protocol_information provides the agent and controller handles as well as the attributes and open count of an protocol on a handle. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: fix counting error] Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: open_info in CloseProtocolHeinrich Schuchardt
efi_open_protocol and efi_close_protocol have to keep track of opened protocols. Check if the protocol was opened for the same agent and controller. Remove all open protocol information for this pair. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: open_info in OpenProtocolHeinrich Schuchardt
efi_open_protocol has to keep track of opened protocols. OpenProtocol enters the agent and controller handle information into this list. A unit test is supplied with a subsequent patch. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: list of open protocol infosHeinrich Schuchardt
Add a list of open protocol infos to each protocol of a handle. Provide helper functions to access the list items. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: do not try to close device path protocolHeinrich Schuchardt
CloseProtocol cannot be called without agent handle. There is no need to close the device path protocol if it has been opened without agent handle. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: simplify efi_remove_all_protocolsHeinrich Schuchardt
Replace list_for_each_safe() and list_entry() by list_for_each_entry_safe(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: colored test outputHeinrich Schuchardt
Add color coding to output: test section blue success green errors red todo yellow summary white others light gray Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> [agraf: Fold in move of set_attribute before the print] Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22tools: provide a tool to convert a binary file to an includeHeinrich Schuchardt
For testing EFI disk management we need an in-memory image of a disk. The tool file2include converts a file to a C include. The file is separated into strings of 8 bytes. Only the non-zero strings are written to the include. The output format has been designed to maintain readability. #define EFI_ST_DISK_IMG { 0x00010000, { \ {0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \ {0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \ {0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \ ... {0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \ {0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \ {0, NULL} } } As the disk image needed for testing contains mostly zeroes a high compression ratio can be attained. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: correctly call imagesHeinrich Schuchardt
Avoid a failed assertion when an EFI app calls an EFI app. Avoid that the indent level increases when calling 'bootefi hello' repeatedly. Avoid negative indent level when an EFI app calls an EFI app that calls an EFI app (e.g. iPXE loads grub which starts the kernel). Return the status code of a loaded image that returns without calling the Exit boot service. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22vsprintf.c: add EFI device path printingHeinrich Schuchardt
For debugging efi_loader we need the capability to print EFI device paths. With this patch we can write: debug("device path: %pD", dp); A possible output would be device path: /MemoryMapped(0x0,0x3ff93a82,0x3ff93a82) This enhancement is not available when building without EFI support and neither in the SPL nor in the API example. A test is provided. It can be executed in the sandbox with command ut_print. The development for EFI support in the sandbox is currently in branch u-boot-dm/efi-working. The branch currently lacks commit 6ea8b580f06b ("efi_loader: correct DeviceNodeToText for media types"). Ater rebasing the aforementioned branch on U-Boot v2018.01 the test is executed successfully. Without EFI support in the sandbox the test is simply skipped. Suggested-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: text output for device path end nodeHeinrich Schuchardt
Without the patch a device path consisting only of an end node is displayed as '/UNKNOWN(007f,00ff)'. It should be displayed as '/'. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22MAINTAINERS: correct entry for lib/efi*/Heinrich Schuchardt
lib/efi* indicates files efi* in directory lib. lib/efi*/ indicates all files in directories lib/efi*. Fixes: 623b3a579765 efi_selftest: provide an EFI selftest application Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: do not cut off u16 strings when printingHeinrich Schuchardt
Device paths can be very long. Due to a limited output buffer the output for device paths is cut off. We can avoid this by directly calling the boottime service with the the device path string. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: Remove coloring code change] Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: avoid superfluous messages for task priority levelsHeinrich Schuchardt
In the task priority levels test debug output is written even if no failure is detected. Remove this distracting output. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: avoid superfluous messages for event servicesHeinrich Schuchardt
In the event services test debug output is written even if no failure is detected. Remove this distracting output. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_loader: use correct format string for unsigned longHeinrich Schuchardt
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>