summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2018-04-13Revert "Kconfig: cmd: Make networking command dependent on NET"Joe Hershberger2-2/+2
This reverts the parts of commit 3b3ea2c56ec4bc5588281fd103c744e608f8b25c where it changed the EFI dependency on NET. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Duncan Hare <dh@synoia.com>
2018-04-09Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini21-358/+1899
Patch queue for efi - 2018-04-09 Highlights this time around: - Lots of minor spec compliance fixes - Support full range of GOP BLT commands - More fine grained error checking - Network fixes (init, DP) - Lots of other bug fixes...
2018-04-06efi_loader: Check machine type in the image headerIvan Gorinov1-12/+39
Check FileHeader.Machine to make sure the EFI executable image is built for the same architecture. For example, 32-bit U-Boot on x86 will print an error message instead of loading an x86_64 image and crashing. Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-05efi_loader: completely initialize networkHeinrich Schuchardt1-2/+34
Add missing network initialization code. Before the patch the network was only usable if a network command like dhcp or tftp had beed executed. This was visible when interrupting the console countdown and executing bootefi selftest for vexpress_ca15_tc2_defconfig. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-05efi_loader: new functions to print loaded image informationHeinrich Schuchardt1-0/+46
Introduce functions to print information about loaded images. If we want to analyze an exception in an EFI image we need the offset between the PC and the start of the loaded image. With efi_print_image_info() we can print the necessary information for a single image, e.g. UEFI image [0xbffe6000:0xbffe631f] pc=0x138 '/\snp.efi' efi_print_image_infos() provides output for all loaded images. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-05efi_selftest: test getinfo(EFI_FILE_SYSTEM_INFO)Heinrich Schuchardt1-0/+22
Check that the getinfo() service of the file protocol correctly returns the partion label. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-05efi_selftest: partition label for test imageHeinrich Schuchardt1-36/+22
efi_selftest_disk_image.h contains a disk image. We use it to test the EFI_FILE_PROTOCOL. The patch sets the partition label to 'U-BOOT TEST'. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-05efi_loader: implement EFI_FILE_SYSTEM_INFOHeinrich Schuchardt1-0/+38
Implement the information type EFI_FILE_SYSTEM_INFO in the service GetInfo() of the EFI_FILE_PROTOCOL. The volume label is not available in U-Boot. As a work-around use the partition name instead. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-05efi_loader: use const for GUIDs in the EFI_FILE_PROTOCOLHeinrich Schuchardt1-2/+2
Use const efi_guid_t* when passing GUIDs. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04Merge git://git.denx.de/u-boot-sunxiTom Rini1-1/+0
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-04efi_loader: use correct types in EFI_FILE_PROTOCOLHeinrich Schuchardt3-15/+39
In the EFI_FILE_PROTOCOL buffer sizes and positions are passed as UINTN and not as u64. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: ImageSize must be multiple of SectionAlignmentHeinrich Schuchardt1-0/+2
According to the Portable Executable and Common Object File Format Specification the image size must be a multiple of the alignment of sections. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: save image relocation address and sizeHeinrich Schuchardt1-0/+2
For analyzing crash output the relocation address and size are needed. Save them in the loaded image info. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: use efi_uintn_t for LoadImageHeinrich Schuchardt1-2/+2
We generally use efi_uintn_t where the UEFI spec uses UINTN. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: initialize device path on allocPatrick Wildt1-0/+1
Since the backing memory for a new device path can contain stale data we have to make sure that we zero the buffer. Otherwise some code paths that don't set all fields in a structure backed by this device path might contain unwanted stale data. Signed-off-by: Patrick Wildt <patrick@blueri.se> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: Fix network DP with DM_ETHAlexander Graf1-2/+5
When CONFIG_DM_ETH is set, we assemble the device path properly with a full device hierarchy. Our helper function dp_fill() even put the MAC node itself in it for us. However, for non-DM compatibility we also have code in that added the MAC node manually. That code now runs on top of the existing MAC node: Handle 0x3db2f6b0 /HardwareVendor(e61d73b9-a384-4acc-aeab-82e828f3628b)[0: ] /USBClass(0,0,9,0,0)/USBClass(424,9514,9,0,2)/MacAddr(b8:27:eb:e1:81:47,1) /MacAddr(b8:27:eb:e1:81:47,57)/EndEntire We obviously don't need the additional node and in fact, grub chokes on it and fails to match the DP against the ethernet device node. So this patch moves the additional MAC node into the non-DM code path: Handle 0x3db3fde0 /HardwareVendor(e61d73b9-a384-4acc-aeab-82e828f3628b)[0: ] /USBClass(0,0,9,0,0)/USBClass(424,9514,9,0,2)/MacAddr(b8:27:eb:e1:81:47,1) /EndEntire While at it, we also mark the non-DM MAC node as ethernet. Fixes: b66c60dde9d ("efi_loader: add device-path utils") Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: Fix return value for efi_add_runtime_mmioAlexander Graf1-7/+7
The efi_add_runtime_mmio function incorrectly returned the added address as return value rather than EFI_SUCCESS. Fix it by checking the return value of efi_add_memory_map properly. Fixes: f057cfef5dc ("efi_loader: exit status for efi_reset_system_init") Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: Optimize GOP moreAlexander Graf1-62/+114
The GOP path was optimized, but still not as fast as it should be. Let's push it even further by trimming the hot path into simple 32bit load/store operations for buf->vid 32bpp operations. Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: Optimize GOP switchAlexander Graf1-34/+126
We usually try to compile for size, not for speed. Unfortunately with the more powerful GOP infrastructure to handle all sorts of GOP operations, we end up slowing down our copying hot path quite a lot. So this patch moves the 4 possible GOP operation modes into separate functions which call a common function again. The end result of that is more optimized code that can properly do constant propagation throughout its switch() statements and thus removes compares in the hot path. Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: use __always_inline for pixel conversionHeinrich Schuchardt1-2/+2
We optimize for size using -Os so gcc might ignore 'inline'. Pixel conversions are called so often that we always want to inline them. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: RestoreTPL should execute queued eventsHeinrich Schuchardt1-0/+5
When the TPL is lowered queued events may become eligible for execution. iPXE uses the following pattern to request event execution: bs->RestoreTPL ( TPL_APPLICATION ); bs->RaiseTPL ( TPL_CALLBACK ); Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: use TPL_NOTIFY for network timer eventHeinrich Schuchardt1-1/+3
We use a timer to poll the network. iPXE is used for booting from iSCSI drives. It has been changed to run at TPL_CALLBACK most of the time (which is not what the UEFI spec recommends). By changing our timer to TPL_NOTIFY we can ensure that it is nevertheless executed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: correctly support parameter delta in BltHeinrich Schuchardt2-7/+29
In the Blt service of the EFI_GRAPHICS_OUTPUT_PROTOCOL the parameter delta is measured in bytes and not in pixels. The coding only supports delta being a multiple of four. The UEFI specification does not explicitly require this but as pixels have a size of four bytes we should be able to assume four byte alignment. The corresponding unit test is corrected, too. It can be launched with setenv efi_selftest block image transfer bootefi selftest Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: unit test for event groupsHeinrich Schuchardt2-0/+141
Supply a unit test for event groups. Create multiple events in an event group. Signal each event once and check that all events are notified once in each round. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: fix device tree unit testHeinrich Schuchardt1-1/+1
Include libfdt.h was moved by commit b08c8c487083 ("libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>") Fixes: e236200c7fa6 ("efi_selftest: check installation of the device tree") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi: Correct header order in efi_memorySimon Glass1-3/+2
The headers are not in the correct order. Fix this. Also drop libfdt_env.h since it is not needed. Signed-off-by: Simon Glass <sjg@chromium.org> Rebased Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: use constants in efi_allocate_pages()Heinrich Schuchardt1-3/+3
Using the existing predefined constants is less error prone and makes the code easier to read. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: show UEFI revision in helloworldHeinrich Schuchardt1-0/+18
Output the UEFI revision number in helloworld. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: unit test for EFI_SIMPLE_TEXT_INPUT_PROTOCOLHeinrich Schuchardt2-0/+183
Provide a unit test for the EFI_SIMPLE_TEXT_INPUT_PROTOCOL. The unicode character and the scan code are printed for text input. To run the test: setenv efi_selftest text input bootefi selftest Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: add missing EFI_RESET_PLATFORM_SPECIFICHeinrich Schuchardt1-0/+1
EFI_RESET_PLATFORM_SPECIFIC is one of the values that can be used for the EFI service ResetSystem. The missing definition is added. The value has to handled in efi_reset_system(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: test gop bitbltHeinrich Schuchardt2-0/+312
The test checks all block image transfer operations of the graphical output protocol. An animated submarine is shown. To run the test: setenv efi_selftest bock image transfer bootefi selftest Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: implement missing bit blit operations in gopHeinrich Schuchardt1-36/+122
With the patch all block image transfer operations of the EFI_GRAPHICS_OUTPUT_PROTOCOL are supported. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: implement event groupsHeinrich Schuchardt5-27/+95
If an event of a group event is signaled all other events of the same group are signaled too. Function efi_signal_event is renamed to efi_queue_event. A new function efi_signal_event is introduced that checks if an event belongs to a group and than signals all events of the group. Event group notifciation is implemented for ExitBootServices, InstallConfigurationTable, and ResetSystem. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: define GUIDS for event groupsHeinrich Schuchardt1-0/+16
Event groups are used to signal multiple events at the same time. They are identified by GUIDs. This patch provided the predefined GUIDs of UEFI specification 2.7. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: manage events in a linked listHeinrich Schuchardt1-105/+87
Lift the limit on the number of events by using a linked list. This also allows to have events with type == 0. This patch is based on Rob's patch efi_loader: fix events https://lists.denx.de/pipermail/u-boot/2017-October/309348.html Suggested-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: fix formatting errorsHeinrich Schuchardt1-22/+26
Fix formatting errors in efi_boottime.c indicated by scripts/checkpatch.py. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: clear signaled state in CheckEventHeinrich Schuchardt1-2/+5
CheckEvent must clear the signaled state. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: check parameter in InstallConfigurationTableHeinrich Schuchardt1-0/+3
Check that parameter guid is not NULL. This avoids a possible NULL pointer exception. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: correct input of special keysHeinrich Schuchardt1-10/+94
Don't set unicode_char if scan_code is set. Add support for page up, page down, and insert. Correct input of function keys. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: check installation of the device treeHeinrich Schuchardt2-0/+189
The unit test checks if a device tree is installed. It requires that the 'compatible' property of the root node exists. If available it prints the 'serial-number' property. The serial-number property is derived from the environment variable 'serial#'. This can be used to check if the image_setup_libfdt() function is executed. A Python test is supplied. It sets a value for serial# and checks that the selftest shows this as serial-number. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: support device tree for bootefi selftestHeinrich Schuchardt1-0/+2
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>
2018-04-04efi_loader: efi_get_time_init should return status codeHeinrich Schuchardt1-1/+2
All EFI initialization functions should return a status code. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: exit status for efi_reset_system_initHeinrich Schuchardt1-3/+12
efi_reset_system_init provides the architecture or board specific initialization of the EFI subsystem. Errors should be caught and signalled by a return code. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: consistently return efi_status_t efi_watchdog_registerHeinrich Schuchardt1-2/+2
efi_watchdog_register() should always return a status code and not a boolean value. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: return efi_status_t from efi_net_registerHeinrich Schuchardt1-11/+13
Consistently return status codes form efi_net_register(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: return efi_status_t from efi_gop_registerHeinrich Schuchardt1-12/+22
All initialization routines should return a status code instead of a boolean. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: Convert warnings to debug() prints] Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: efi_smbios_register should have a return valueHeinrich Schuchardt1-8/+15
Errors may occur inside efi_smbios_register(). - Return a status code. - Remove unused variables. - Use constants where applicable. Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: Initial EFI_DEVICE_PATH_UTILITIES_PROTOCOLLeif Lindholm3-1/+97
Not complete, but enough for Shell.efi and SCT.efi. We'll implement the rest as needed or once we have SCT running properly so there is a way to validate the interface against the conformance test suite. Initial skeleton written by Leif, and then implementation by Rob. Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> [Fill initial skeleton] Signed-off-by: Rob Clark <robdclark@gmail.com> [Rebase on v2018.03-rc1] Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: remove deprecated ConsoleControlProtocolHeinrich Schuchardt2-51/+0
The console control protocol is not defined in the UEFI standard. It exists in EDK2's EdkCompatiblityPkg package. But this package is deprecated according to https://github.com/tianocore/tianocore.github.io/wiki/Differences-between-EDK-and-EDK-II Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: parameter checks for LoadImageHeinrich Schuchardt1-0/+20
Add parameter checks in efi_load_image(). Check memory allocation is successful in efi_load_image(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>