summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'efi-2019-07-rc5' of git://git.denx.de/u-boot-efiTom Rini2019-06-125-49/+99
|\ | | | | | | | | | | Pull request for UEFI sub-system for v2019.07-rc5 This pull request provides fixes for event services.
| * efi_loader: implement event queueHeinrich Schuchardt2019-06-101-26/+68
| | | | | | | | | | | | | | | | | | | | | | Up to now we have only been using a flag queued for events. But this does not satisfy the requirements of the UEFI spec. Events must be notified in the sequence of decreasing TPL level and within a TPL level in the sequence of signaling. Implement a queue for signaled events. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_selftest: correct event group testHeinrich Schuchardt2019-06-101-5/+4
| | | | | | | | | | | | | | If any member of the event group is signaled, all members must be set to signaled and their notification functions have to be queued. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: event signaling in ExitBootServicesHeinrich Schuchardt2019-06-104-22/+28
| | | | | | | | | | | | | | | | | | | | ExitBootServices() has to stop timer related activity before calling the events of the EFI_EVENT_GROUP_EXIT_BOOT_SERVICES event group. But our current implementation was stopping all other events. All events have to observe the task priority level. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: SignalEvent for event in signaled stateHeinrich Schuchardt2019-06-101-0/+2
| | | | | | | | | | | | | | If an event is already in the signaled state, SignalEvent should not queue the notification function but simply return EFI_SUCCESS. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: RegisterProtocolNotify event signalingHeinrich Schuchardt2019-06-101-0/+1
| | | | | | | | | | | | | | | | | | In a following patch efi_signal_event() will only queue an event if it is not signaled. Set the is_signaled status to false before signaling the event. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | Merge branch 'master' of git://git.denx.de/u-boot-tegraTom Rini2019-06-082-0/+52
|\ \ | |/ |/| | | | | | | | | | | The bulk of these changes are an effort to unify Tegra186 builds with builds of prior 64-bit Tegra generations. On top of that there are various improvements that allow data (such as the MAC address and boot arguments) to be passed through from early firmware to the kernel on boot.
| * lib: Implement strndup()Thierry Reding2019-06-051-0/+23
| | | | | | | | | | Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
| * fdtdec: Add fdtdec_set_ethernet_mac_address()Thierry Reding2019-06-051-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This function can be used to set the local MAC address for the default Ethernet interface in its device tree node. The default interface is identified by the "ethernet" alias. One case where this is useful is for devices that store their MAC address in a custom location. Once extracted, board code can store the MAC address in U-Boot's control DTB so that it will automatically be used by the Ethernet uclass. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | lib/vsprintf: allow printing upper case GUIDsHeinrich Schuchardt2019-06-072-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the UEFI context GUIDs are expected to be rendered in upper case. The patch uses the formerly unused bit 1 of the parameter str_format of function uuid_bin_to_str() to indicate if we need upper or lower case output. Function uuid_string() in vsprint.c is adjusted to correctly set the bit depending on the print format code. %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10 %pUB: 01020304-0506-0708-090A-0B0C0D0E0F10 %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10 %pUL: 04030201-0605-0807-090A-0B0C0D0E0F10 Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is concerned by the change. Further patches are needed to adjust the UEFI subsystem. A unit test is provided inside the ut_print command. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | Merge tag 'efi-2019-07-rc4-2' of git://git.denx.de/u-boot-efiTom Rini2019-06-056-10/+74
|\ \ | |/ |/| | | | | | | | | | | | | | | | | Pull request for UEFI sub-system for v2019.07-rc4-2 Support for managing the non-volatile attribute of UEFI variables is added though we do not have a backend for persistence yet. Error messages for changes of UEFI variables are provided. UEFI boottime service implementations are corrected.
| * efi_loader: bootmgr: make BootNext non-volatileAKASHI Takahiro2019-06-041-1/+2
| | | | | | | | | | Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: variable: support non-volatile attributeAKASHI Takahiro2019-06-041-3/+9
| | | | | | | | | | | | | | | | The attribute, EFI_VARIABLE_NON_VOLATILE, should be encoded as "nv" flag in U-Boot variable if specified. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: notify memory map changesHeinrich Schuchardt2019-06-041-0/+11
| | | | | | | | | | | | | | When the memory map is changed signal events of the EFI_EVENT_GROUP_MEMORY_MAP_CHANGE event group. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: bootmgr: print a message when loading from BootNext failedAKASHI Takahiro2019-06-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a user defines BootNext but not BootOrder and loading from BootNext fails, you will see only a message like this: BootOrder not defined This may confuse a user. Adding an error message will be helpful. An example output looks like this: => efidebug boot add 0001 label1 scsi 0:1 "\path1\file1.efi" "--option foo" => efidebug boot add 0002 label2 scsi 0:1 "\path2\file2.efi" "--option bar" => efidebug boot add 0003 label3 scsi 0:1 "\path3\file3.efi" "--option no" => efidebug boot order 0001 0002 => efidebug boot next 0003 => bootefi bootmgr Loading from Boot0003 'label3' failed Loading from BootNext failed, falling back to BootOrder Loading from Boot0001 'label1' failed Loading from Boot0002 'label2' failed EFI boot manager: Cannot load any image Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Adjust messages. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: close protocols in UnloadImage()Heinrich Schuchardt2019-06-041-2/+36
| | | | | | | | | | | | | | When UnloadImage() is called all protocols opened by the image have to be closed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: fix EnableCursor()Heinrich Schuchardt2019-06-041-0/+1
| | | | | | | | | | | | | | The EnableCursor() service of the simple text output protocol must update the the CursorVisible field of the output mode. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: check timer events in Stall()Heinrich Schuchardt2019-06-041-1/+7
| | | | | | | | | | | | During a call to Stall() we should periodically check for timer events. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * lib: time: export usec_to_tick()Heinrich Schuchardt2019-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | In the UEFI Stall() boottime service we need access to usec_to_tick(). Export the function. Remove redundant implementation in arch/arm/mach-rockchip/rk_timer.c. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: DisconnectController() with no driverHeinrich Schuchardt2019-06-041-2/+7
| | | | | | | | | | | | | | | | | | If DisconnectController() is called and no driver is managing ControllerHandle, return EFI_SUCCESS. UEFI SCT II 2017, 3.3.12 DisconnectController(), 5.1.3.12.4 - 5.1.3.12.6 Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_selftest: unit test for OpenProtocolInformation()Heinrich Schuchardt2019-06-012-0/+206
| | | | | | | | | | | | | | Provide a unit test that checks that the open protocol information is correctly updated when opening and closing protocols. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: CloseProtocol() fix open protocol informationHeinrich Schuchardt2019-06-011-1/+0
| | | | | | | | | | | | | | CloseProtocol() must delete all open protocol information records relating to import parameters not only one. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: open protocol informationHeinrich Schuchardt2019-06-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | When a protocol is opened the open protocol information must be updated. The key fields of the open protocol information records are ImageHandle, ControllerHandle, and Attributes. Consider the Attributes field when determining if an open protocol information record has to be updated or a new one has to be created. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: correct HandleProtocol()Heinrich Schuchardt2019-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | The UEFI specification requires that when a protocol is opened via HandleProtocol() the agent handle is the image handle of the EFI firmware (see chapter on EFI_BOOT_SERVICES.OpenProtocol()). Let efi_handle_protocol() pass efi_root as agent handle to efi_open_protocol(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: Kconfig entries for GetTime(), SetTime()Heinrich Schuchardt2019-06-014-15/+26
| | | | | | | | | | | | | | The GetTime() and the SetTime() runtime services are not obligatory. So let's make them customizable. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: handling of daylight saving timeHeinrich Schuchardt2019-05-311-4/+5
| | | | | | | | | | | | | | | | | | | | If SetTime() is meant to set daylight saving time it will be called with Time.Daylight == EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT. Return 0 from GetTime() if time is not in daylight because we cannot determine if we are in a time zone with daylight saving time. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: check time in SetTime()Heinrich Schuchardt2019-05-311-1/+25
| | | | | | | | | | | | | | The UEFI spec prescribes that we check that the timestamp passed to SetTime() is checked for validity. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: correct UninstallProtocolInterface()Heinrich Schuchardt2019-05-311-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When uninstalling a protocol the following steps are needed: * request all drivers to disconnect * close protocol for all non-drivers * check if any open instance of the protocol exists on the handle and return EFI_ACCESS_DENIED in this case * remove the protocol interface By tort we tested for remaining open protocol instances already after requesting drivers to disconnect. With this correction the UEFI SCT II tests for UninstallProtocolInterface() and ReinstallProtocolInterface are passed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: avoid crash in OpenProtocol()Heinrich Schuchardt2019-05-311-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | When trying to open a protocol exclusively attached drivers have to be removed. This removes entries in the open protocol information linked list over which we are looping. As additionally child controllers may have been removed the only safe thing to do is to restart the loop over the linked list when a driver is removed. By observing the return code of DisconnectController() we can eliminate a loop. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: correct OpenProtocol()Heinrich Schuchardt2019-05-311-3/+11
| | | | | | | | | | | | | | If a protocol is opened BY_DRIVER it cannot be opened by another agent BY_DRIVER. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: registration key in LocateProtocol()Heinrich Schuchardt2019-05-311-10/+39
| | | | | | | | | | | | | | In LocateProtocol() implement searching by the registration key returned by RegisterNotifyProtocol(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: factor out efi_check_register_notify_event()Heinrich Schuchardt2019-05-311-8/+23
| | | | | | | | | | | | | | | | The code to check if a registration key is a valid key returned by RegisterProtocolNotify() can be reused. So let us factor it out into a new function efi_check_register_notify_event(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: bootmgr: print a message when loading from BootNext failedAKASHI Takahiro2019-05-311-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a user defines BootNext but not BootOrder and loading from BootNext fails, you will see only a message like this: BootOrder not defined This may confuse a user. Adding an error message will be helpful. An example output looks like this: => efidebug boot add 0001 label1 scsi 0:1 "\path1\file1.efi" "--option foo" => efidebug boot add 0002 label2 scsi 0:1 "\path2\file2.efi" "--option bar" => efidebug boot add 0003 label3 scsi 0:1 "\path3\file3.efi" "--option no" => efidebug boot order 0001 0002 => efidebug boot next 0003 => bootefi bootmgr Loading from Boot0003 'label3' failed Loading from BootNext failed, falling back to BootOrder Loading from Boot0001 'label1' failed Loading from Boot0002 'label2' failed EFI boot manager: Cannot load any image Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Adjust messages. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | efi_loader: correct notification of protocol installationHeinrich Schuchardt2019-05-312-21/+58
|/ | | | | | | | | | | | | | | | When a protocol is installed the handle should be queued for the registration key of each registered event. LocateHandle() should return the first handle from the queue for the registration key and delete it from the queue. Implement the queueing. Correct the selftest. With the patch the UEFI SCT tests for LocateHandle() are passed without failure. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: variable: attributes may not be changed if a variable existsAKASHI Takahiro2019-05-241-2/+11
| | | | | | | | If a variable already exists, efi_set_variable() should not change the variable's attributes. This patch enforces it. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: variable: return error for APPEND_WRITEAKASHI Takahiro2019-05-241-1/+3
| | | | | | | | | | | | | The current efi_st_variable() doesn't support EFI_VARIABLE_APPEND_WRITE attiribute for now, and so should return an error. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Fix typos is commit message. Add TODO comment. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi: selftest: APPEND_WRITE is not supportedAKASHI Takahiro2019-05-241-14/+14
| | | | | | | The error here should be marked *todo*. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: DEL is an illegal file name characterHeinrich Schuchardt2019-05-241-1/+1
| | | | | | | According to the FAT32 specification 0x7f (DEL) is not a legal character for file names. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: correct device path checkHeinrich Schuchardt2019-05-241-1/+4
| | | | | | | | | | | | | | | | Since commit 226cddbe32f0 ("efi_loader: check device path in InstallMultipleProtocolInterfaces") iPXE fails to access the network. LocateDevicePath() returns EFI_SUCCESS even if a shorter path is found as a partial match. It returns the remaining path. So to be sure that we found a complete match we need to check that the remaining path refers to an end node. Provide debug output if a device path has already been installed. Fixes: 226cddbe32f0 ("efi_loader: check device path in InstallMultipleProtocolInterfaces") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: return values of GetTime()Heinrich Schuchardt2019-05-241-7/+7
| | | | | | | According to the UEFI spec 2.8 the GetTime() runtime service should return EFI_UNSUPPORTED if the real time clock is not available. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: implement SetTimeHeinrich Schuchardt2019-05-242-9/+120
| | | | | | | | Implement the SetTime() runtime service. Extend the real time clock selftest to check setting the clock. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* fdtdec: Remove fdt_{addr,size}_unpack()Thierry Reding2019-05-212-4/+12
| | | | | | | U-Boot already defines the {upper,lower}_32_bits() macros that have the same purpose. Use the existing macros instead of defining new APIs. Signed-off-by: Thierry Reding <treding@nvidia.com>
* efi_loader: parameter check OutputStringHeinrich Schuchardt2019-05-191-0/+5
| | | | | | Check the parameters against NULL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState() correct parameterHeinrich Schuchardt2019-05-191-3/+3
| | | | | | KeyToggleState is a pointer according to UEFI spec 2.8. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: GetNextMonotonicCount() check parameterHeinrich Schuchardt2019-05-191-1/+8
| | | | | | | | Do not write to address indicated by NULL pointer. UEFI SCT II 2.6 (2017), 3.6.5 GetNextMonotonicCount(), 5.1.5.5.1 Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: parameter checks CalculateCrc32()Heinrich Schuchardt2019-05-191-1/+8
| | | | | | | Not checking the parameters may lead reading or writing from NULL. Implement the parameter checks prescribed in the UEFI spec. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: check device path in InstallMultipleProtocolInterfacesHeinrich Schuchardt2019-05-191-0/+12
| | | | | | | | | | | According to the UEFI spec InstallMultipleProtocolInterfaces() must check if a device path has already been installed. In this case it must return EFI_ALREADY_STARTED. Cf. UEFI SCT II 2.6 A (2017), 3.3.16 InstallMultipleProtocolInterfaces(), 5.1.3.16.1. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: implement deprecated Unicode collation protocolHeinrich Schuchardt2019-05-193-1/+44
| | | | | | | | | | | | | | | | | | In EFI 1.10 a version of the Unicode collation protocol using ISO 639-2 language codes existed. This protocol is not part of the UEFI specification any longer. Unfortunately it is required to run the UEFI Self Certification Test (SCT) II, version 2.6, 2017. So we implement it here for the sole purpose of running the SCT. It can be removed once a compliant SCT is available. The configuration option defaults to no. Signed-off-by: Rob Clark <robdclark@gmail.com> Most of Rob's original patch is already merged. Only the deprecated protocol is missing. Rebase it and make it configurable. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: rename Unicode collation protocol 2 variablesHeinrich Schuchardt2019-05-195-10/+11
| | | | | | | Rename variables to make it clear they refer to the Unicode collation protocol identified by the EFI_UNICODE_PROTOCOL2_GUID. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: merge adjacent sprintf()Heinrich Schuchardt2019-05-191-3/+2
| | | | | | | In the implementation of the device path to text protocol join adjacent sprintf() statements. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>