aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader
Commit message (Collapse)AuthorAgeFilesLines
* efi_loader: parameter checks BLOCK_IO_PROTOCOLHeinrich Schuchardt2019-09-051-1/+36
| | | | | | | | | Check parameters of ReadBlocks() and WriteBlocks(). If the buffer size is not a multiple of the block size, we have to return EFI_BAD_BUFFER_SIZE. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: do not set invalid screen modeHeinrich Schuchardt2019-09-051-0/+4
| | | | | | | | EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetMode() should return EFI_UNDEFINED if a screen mode is not available. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Alexander Graf <agraf@csgraf.de>
* efi_loader: cursor positioningHeinrich Schuchardt2019-09-051-5/+13
| | | | | | | | | | When backspacing in column 0 do no set the column index to ULONG_MAX. Ensure that the row number is not set to ULONG_MAX even if the row count is advertised as 0. Ignore control characters other the 0x08, 0x0a, 0x0d when updating the column. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: correctly render UsbClass DP nodes as textHeinrich Schuchardt2019-09-051-1/+1
| | | | | | Correct the text representation of UsbClass device path nodes. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: correctly render CD-ROM device path nodesHeinrich Schuchardt2019-09-052-2/+3
| | | | | | | | | | Correct the name of the partition size component in struct efi_device_path_cdrom_path. Render entry, start, and size when converting a CD-ROM device path node to text. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: correctly render MAC address device path nodesHeinrich Schuchardt2019-09-051-8/+7
| | | | | | If the interface type is greater 1 render all 32 bytes of the MAC address. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: correct text conversion for vendor DPHeinrich Schuchardt2019-09-051-1/+10
| | | | | | | Vendor device paths may contain data. When converting vendor device paths to text this binary data has to be rendered. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: Extract adding a conventional memory in separate routinePark, Aiden2019-09-051-32/+50
| | | | | | | | | | Adding a conventional memory region to the memory map may require ram_top limitation and it can be also commonly used. Extract adding a conventional memory to the memory map in a separate routine for generic use. Signed-off-by: Aiden Park <aiden.park@intel.com> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: implement MCastIPtoMACHeinrich Schuchardt2019-09-051-2/+42
| | | | | | | | Implement the MCastIPtoMAC service of the simple network protocol. It converts an multicast IPv4 (or IPv6) address to a multicast Ethernet address. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: fix status management in network stackHeinrich Schuchardt2019-09-051-7/+62
| | | | | | | | | | | | The network should start in status EfiSimpleNetworkStopped. Add and correct status checks in the simple network protocol. Correct the unit test: * Shutdown() and Stop() during setup if needed * invoke Shutdown() before Stop() when tearing down Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: EFI_SIMPLE_NETWORK.Transmit() fill headerHeinrich Schuchardt2019-09-051-6/+25
| | | | | | | Fill the media header in EFI_SIMPLE_NETWORK.Transmit(). Check that the buffer size is large enough for the header. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: interrupts in simple network protocolHeinrich Schuchardt2019-09-051-15/+25
| | | | | | | | | GetStatus() must clear the interrupt status. Transmit() should set the TX interrupt. Receive() should clear the RX interrupt. Initialize() and Start() should clear the interrupt status. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: do not call efi_runtime_detach twiceHeinrich Schuchardt2019-08-151-9/+4
| | | | | | | | | | | | | Commit 7f95104d91cc ("efi_loader: detach runtime in ExitBootServices()") added a call to efi_runtime_detach() to ExitBootServices() but did not remove the call in SetVirtualAddressMap(). Remove the superfluous function call. Correct a comment referring to efi_runtime_detach(). Fixes: 7f95104d91cc ("efi_loader: detach runtime in ExitBootServices()") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: parameter check in SetVirtualAddressMapHeinrich Schuchardt2019-08-151-3/+10
| | | | | | | Check the parameters DescriptorSize and DescriptiorVersion of SetVirtualAddressMap() as prescribed by the UEFI specification. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: EFI_PXE_BASE_CODE_PROTOCOL stubHeinrich Schuchardt2019-08-151-3/+129
| | | | | | | | | | | | U-Boot implements the EFI_PXE_BASE_CODE_PROTOCOL because GRUB uses the mode information for booting via PXE. All function pointers in the protocol were NULL up to now which will cause immediate crashes when the services of the protocol are called. Create function stubs for all services of the protocol returning EFI_UNSUPPORTED. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* env: Rename environment.h to env_internal.hSimon Glass2019-08-111-1/+1
| | | | | | | | | | | | | | This file contains lots of internal details about the environment. Most code can include env.h instead, calling the functions there as needed. Rename this file and add a comment at the top to indicate its internal nature. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> [trini: Fixup apalis-tk1.c] Signed-off-by: Tom Rini <trini@konsulko.com>
* env: Drop environment.h header file where not neededSimon Glass2019-08-111-1/+0
| | | | | | | | This header file is now only used by files that access internal environment features. Drop it from various places where it is not needed. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Move env_get() to env.hSimon Glass2019-08-111-0/+1
| | | | | | | Move env_get() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Move env_set() to env.hSimon Glass2019-08-111-0/+1
| | | | | | | Move env_set() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* efi_loader: implement ConvertPointer()Heinrich Schuchardt2019-07-301-4/+71
| | | | | | | Implement the ConvertPointer() runtime service. Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: definition of efi_virtual_address_map()Heinrich Schuchardt2019-07-301-7/+7
| | | | | | | Use efi_uintn_t where the UEFI spec uses UINTN. Use efi_uintn_t also for the result of the division of two efi_uintn_t. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: re-enable GRUB workaround on 32bit ARMHeinrich Schuchardt2019-07-302-15/+21
| | | | | | | | | | | | | GRUB on ARM 32bit prior to version 2.04 lacks proper handling of caches. In U-Boot v2019.04 a workaround for this was inadvertently removed. The workaround is currently also needed for booting on systems with caches that cannot be managed via CP15 (e.g. with an i.MX6 CPU). Re-enable the workaround and make it customizable. Fixes: f69d63fae281 ("efi_loader: use efi_start_image() for bootefi") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: unaligned access in efi_file_from_path()Heinrich Schuchardt2019-07-161-1/+6
| | | | | | | | The device path structure is packed. So no assumption on the alignment is possible. Copy the file name in efi_file_from_path() to assure there is no unaligned access. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: efi_dp_from_file() expect UTF-8 pathHeinrich Schuchardt2019-07-161-9/+31
| | | | | | Properly convert UTF-8 file names to UTF-16. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: function comments efi_bootmgr.cHeinrich Schuchardt2019-07-161-7/+40
| | | | | | Convert function descriptions to Sphinx style. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: fix comment for struct efi_pool_allocationHeinrich Schuchardt2019-07-161-5/+9
| | | | | | | Change comment for struct efi_pool_allocation to match Sphinx style. Describe all structure fields. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: fix comments for variable servicesHeinrich Schuchardt2019-07-161-4/+23
| | | | | | | | Add missing parameter descriptions. Remove an invalid link. Correct the formatting of a function comment. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: fix comments for efi_update_exit_data()Heinrich Schuchardt2019-07-161-3/+3
| | | | | | Add missing colons after parameter descriptions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: fix function comments in efi_boottime.cHeinrich Schuchardt2019-07-161-3/+4
| | | | | | | | | | | scripts/kernel-doc pointed out some errors in the function comments in efi_boottime.c. Add missing and remove superfluous parameter descriptions. Escape * in a function description. Add empty lines for readability. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: Change return type of efi_add_memory_map()Bryan O'Donoghue2019-07-162-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | We currently have some inconsistent use of efi_add_memory_map() throughout the code. In particular the return value of efi_add_memory_map() is not interpreted the same way by various users in the codebase. This patch does the following: - Changes efi_add_memory_map() to return efi_status_t. - Adds a method description to efi_add_memory_map(). - Changes efi_add_memory_map() to return EFI_SUCCESS - Returns non-zero for error in efi_add_memory_map() - Updates efi_allocate_pages() to new efi_add_memory_map() - Updates efi_free_pages() to new efi_add_memory_map() - Updates efi_carve_out_dt_rsv() to new efi_add_memory_map() - Updates efi_add_runtime_mmio() to new efi_add_memory_map() Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map") Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes") Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Alexander Graf <agraf@csgraf.de> Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGEHeinrich Schuchardt2019-07-162-8/+31
| | | | | | | | Implement the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. This requires allocating the event and the event list from runtime data. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: efi_set_virtual_address_map_runtime()Heinrich Schuchardt2019-07-161-1/+1
| | | | | | | efi_set_virtual_address_map_runtime() must be of type __efi_runtime. Fixes: ee8ebaaaaedc ("efi_loader: split off detaching SetVirtualAddress()") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: detach runtime in ExitBootServices()Heinrich Schuchardt2019-07-062-1/+4
| | | | | | | | | | | | | | | | Linux can be called with a command line parameter efi=novamap, cf. commit 4e46c2a95621 ("efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted"). In this case SetVirtualAddressMap() is not called after ExitBootServices(). OpenBSD 32bit does not call SetVirtualAddressMap() either. Runtime services must be set to an implementation supported at runtime in ExitBootServices(). Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Suggested-by: Alexander Graf <agraf@csgraf.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: simplify detachingHeinrich Schuchardt2019-07-061-32/+8
| | | | | | | We do not need any array typed detach list. Let's simply update the pointers directly. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: decision on EFI_RT_SUPPORTED_RESET_SYSTEMHeinrich Schuchardt2019-07-062-4/+7
| | | | | | Move the logic determining which board supports reset at runtime to Kconfig. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: split off detaching SetVirtualAddress()Heinrich Schuchardt2019-07-061-11/+58
| | | | | | | | | | | | | The runtime services SetVirtualAddress() and ConvertPointer() become unavailable after SetVirtualAddress(). Other runtime services become unavailable after ExitBootServices. Move the update of SetVirtualAddress() and ConvertPointer() to efi_relocate_runtime_table(). Use functions with the correct signature when detaching. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: unimplemented runtime servicesHeinrich Schuchardt2019-07-061-32/+2
| | | | | | | Unimplemented runtime services should always return EFI_UNSUPPORTED as described in the UEFI 2.8 spec. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: let the variable driver patch out the runtimeHeinrich Schuchardt2019-07-063-10/+46
| | | | | | | | | Our variable services are only provided at boottime. Therefore when leaving boottime the variable function are replaced by dummy functions returning EFI_UNSUPPORTED. Move this patching of the runtime table to the variable services implementation. Executed it in ExitBootServices(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: clean up runtime detachingHeinrich Schuchardt2019-07-061-23/+55
| | | | | | | | | | | The detaching of the runtime will have to move to ExitBootServices() to encompass operating system that do not call SetVirtualAddressMap(). This patch changes the logic for the relocation of the pointers in the runtime table such that the relocation becomes independent of the entries in the detach list. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: remove NULL entries from runtime detach listHeinrich Schuchardt2019-07-062-20/+9
| | | | | | | | | Some entries in the system table are set to NULL in ExitBootServices(). We had them in the runtime detach list to avoid relocation of NULL. Let's instead assign the pointers dynamically in efi_initialize_system_table() to avoid the relocation entry. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: initialization of variable servicesHeinrich Schuchardt2019-07-062-0/+15
| | | | | | Provide an initialization routine for variable services. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: move efi_query_variable_info()Heinrich Schuchardt2019-07-062-27/+27
| | | | | | | | Let's keep similar things together. Move efi_query_variable_info() to lib/efi_loader/efi_variable.c Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: remove superfluous spaces in commentsHeinrich Schuchardt2019-07-061-4/+4
| | | | | | Leave only a single space after * if not aligning. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: fix typo in efi_variable.cHeinrich Schuchardt2019-06-201-2/+2
| | | | | | %s/efi_efi_/efi_/ Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: Delete() return EFI_WARN_DELETE_FAILUREHeinrich Schuchardt2019-06-201-8/+2
| | | | | | | If EFI_FILE_PROTOCOL.Delete() fails, always close the handle and return EFI_WARN_DELETE_FAILURE. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: ListPackageLists() return EFI_NOT_FOUNDHeinrich Schuchardt2019-06-201-35/+14
| | | | | | | | | | If no matching package list is found in ListPackageLists(), return EFI_NOT_FOUND. If we do not support a package type, we will not find a matching package list. Remove the unreachable EFI_PRINTF() statements. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: console incorrectly advertised left logo keyHeinrich Schuchardt2019-06-201-3/+1
| | | | | | Avoid to signal that the left logo key is pressed, when it is not. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: alternative scan codes for F5, END, HOMEHeinrich Schuchardt2019-06-201-8/+14
| | | | | | | Depending on the key board alternative scan codes are used for F5, END, and HOME. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: GOP: provide accurate mode informationHeinrich Schuchardt2019-06-201-12/+12
| | | | | | For 5:6:5 modes provide correct frame buffer information. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: SetMode() must blank screenHeinrich Schuchardt2019-06-201-12/+38
| | | | | | EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() must blank the screen. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>