summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2019-06-20efi_loader: QueryMode() check parametersHeinrich Schuchardt
Check the parameters of EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20efi_loader: Blt() with incorrect BltOperationHeinrich Schuchardt
If EFI_GRAPHICS_OUTPUT_PROTOCOL.Blt() is called with an invalid value of BltOperation return EFI_INVALID_PARAMETER. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: fix SetAttribute()Heinrich Schuchardt
The SetAttribute() service and the Reset() service of the simple text output protocol must update the attribute value in the mode information. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: fix SetMode()Heinrich Schuchardt
Correct the check of the mode number in SetMode() service of the simple text output protocol. Clear the screen in SetMode(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: GetTime() must return EFI_UNSUPPORTEDHeinrich Schuchardt
If the GetTime() runtime service is not supported, EFI_UNSUPPORTED has to be returned. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: add RuntimeServicesSupported variableAKASHI Takahiro
This variable is defined in UEFI specification 2.8, section 8.1. Its value should be updated whenever we add any usable runtime services function. Currently we only support SetVirtualAddress() for all systems and ResetSystem() for some. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: parameter checks SetVariable()Heinrich Schuchardt
Return EFI_INVALID_PARAMETER if the variable name has zero length or the variable has runtime access but not boottime access. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: legal characters in StrToFat()Heinrich Schuchardt
The UEFI specification does not specify if the characters that have to be replaced by underscore in function StrToFat() of the Unicode collation protocol are those forbidden in FAT long names or those in FAT short names. EDK2 and UEFI SCT assume it is those forbidden in FAT 8.3 short names. Adjust the list of forbidden characters. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: MetaiMatch() must be case insensitiveHeinrich Schuchardt
The MetaiMatch() service of the UnicodeCollationProtocol2 must be case insensitive. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: AllocatePages() must accept addr == 0Heinrich Schuchardt
It must be possible to allocate memory at address 0 with AllocatePages(). Move a NULL pointer check. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: correct ExitBootServices()Heinrich Schuchardt
Always use EFI_EXIT() to return from the function. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: loaded images cannot be started twiceHeinrich Schuchardt
If an image already has been started, return EFI_INVALID_PARAMETER when StartImage() is called for the same handle again. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: LoadImage must return EFI_NOT_FOUNDHeinrich Schuchardt
If the file path does not relate to an existing file, LoadImage() must return EFI_NOT_FOUND. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14efi_loader: LoadImage w/o SourceBuffer and DevicePathHeinrich Schuchardt
If both SourceBuffer and DevicePath are NULL, LoadImage() must return EFI_INVALID_PARAMETER. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-12Merge tag 'efi-2019-07-rc5' of git://git.denx.de/u-boot-efiTom Rini
Pull request for UEFI sub-system for v2019.07-rc5 This pull request provides fixes for event services.
2019-06-10efi_loader: implement event queueHeinrich Schuchardt
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>
2019-06-10efi_selftest: correct event group testHeinrich Schuchardt
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>
2019-06-10efi_loader: event signaling in ExitBootServicesHeinrich Schuchardt
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>
2019-06-10efi_loader: SignalEvent for event in signaled stateHeinrich Schuchardt
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>
2019-06-10efi_loader: RegisterProtocolNotify event signalingHeinrich Schuchardt
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>
2019-06-08Merge branch 'master' of git://git.denx.de/u-boot-tegraTom Rini
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.
2019-06-07lib/vsprintf: allow printing upper case GUIDsHeinrich Schuchardt
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>
2019-06-05Merge tag 'efi-2019-07-rc4-2' of git://git.denx.de/u-boot-efiTom Rini
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.
2019-06-05lib: Implement strndup()Thierry Reding
Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
2019-06-05fdtdec: Add fdtdec_set_ethernet_mac_address()Thierry Reding
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>
2019-06-04efi_loader: bootmgr: make BootNext non-volatileAKASHI Takahiro
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-04efi_loader: variable: support non-volatile attributeAKASHI Takahiro
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>
2019-06-04efi_loader: notify memory map changesHeinrich Schuchardt
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>
2019-06-04efi_loader: bootmgr: print a message when loading from BootNext failedAKASHI Takahiro
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>
2019-06-04efi_loader: close protocols in UnloadImage()Heinrich Schuchardt
When UnloadImage() is called all protocols opened by the image have to be closed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-04efi_loader: fix EnableCursor()Heinrich Schuchardt
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>
2019-06-04efi_loader: check timer events in Stall()Heinrich Schuchardt
During a call to Stall() we should periodically check for timer events. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-04lib: time: export usec_to_tick()Heinrich Schuchardt
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>
2019-06-04efi_loader: DisconnectController() with no driverHeinrich Schuchardt
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>
2019-06-01efi_selftest: unit test for OpenProtocolInformation()Heinrich Schuchardt
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>
2019-06-01efi_loader: CloseProtocol() fix open protocol informationHeinrich Schuchardt
CloseProtocol() must delete all open protocol information records relating to import parameters not only one. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-01efi_loader: open protocol informationHeinrich Schuchardt
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>
2019-06-01efi_loader: correct HandleProtocol()Heinrich Schuchardt
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>
2019-06-01efi_loader: Kconfig entries for GetTime(), SetTime()Heinrich Schuchardt
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>
2019-05-31efi_loader: handling of daylight saving timeHeinrich Schuchardt
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>
2019-05-31efi_loader: check time in SetTime()Heinrich Schuchardt
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>
2019-05-31efi_loader: correct UninstallProtocolInterface()Heinrich Schuchardt
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>
2019-05-31efi_loader: avoid crash in OpenProtocol()Heinrich Schuchardt
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>
2019-05-31efi_loader: correct OpenProtocol()Heinrich Schuchardt
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>
2019-05-31efi_loader: registration key in LocateProtocol()Heinrich Schuchardt
In LocateProtocol() implement searching by the registration key returned by RegisterNotifyProtocol(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-31efi_loader: factor out efi_check_register_notify_event()Heinrich Schuchardt
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>
2019-05-31efi_loader: bootmgr: print a message when loading from BootNext failedAKASHI Takahiro
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>
2019-05-31efi_loader: correct notification of protocol installationHeinrich Schuchardt
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>
2019-05-24efi_loader: variable: attributes may not be changed if a variable existsAKASHI Takahiro
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>
2019-05-24efi_loader: variable: return error for APPEND_WRITEAKASHI Takahiro
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>