Commit Graph

1884 Commits

Author SHA1 Message Date
Heinrich Schuchardt
ee8ebaaaae efi_loader: split off detaching SetVirtualAddress()
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>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
1bb52fc2d2 efi_selftest: test variable services at runtime
Provide a unit test for the variable services at runtime.

Currently we expect EFI_UNSUPPORTED to be returned as the runtime
implementation is still missing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
b94461c224 efi_loader: unimplemented runtime services
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>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
29018abb09 efi_loader: let the variable driver patch out the runtime
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>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
24a238f763 efi_loader: clean up runtime detaching
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>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
93148eba77 efi_loader: remove NULL entries from runtime detach list
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>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
88192098d1 efi_loader: initialization of variable services
Provide an initialization routine for variable services.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
ce43528d6a efi_loader: move efi_query_variable_info()
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>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
359a699a12 efi_loader: remove superfluous spaces in comments
Leave only a single space after * if not aligning.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-06 21:25:32 +02:00
Heinrich Schuchardt
fb083801d5 efi_selftest: description of CMD_BOOTEFI_SELFTEST
The current short description has a typo. Let it stand out clear that we
provide unit tests.

Improve the description of the CMD_BOOTEFI_SELFTEST configuration option.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <agraf@csgraf.de>
2019-07-06 21:25:32 +02:00
Tom Rini
bdf97b5d39 Pull request for UEFI sub-system for v2019.07-rc5 (3)
This pull request provides error fixes for the graphical output protocol,
 the text output protocol, and the extended text input protocol.
 
 Setting the boot device for the bootefi command is now not only supported
 by the 'load' command but also for the file system specific commands like
 'fatload'.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAl0NDgQACgkQxIHbvCwF
 GsQ5wBAAgUPlH9jb9wokgMht8cOjNMJk5QHiiZr65iyXIPHWQ+c+Pu4QyQu5J3tO
 avOjWvtwW4aGPBTkSl0dA8w2RF738YWIOskg04YxBlFL46D3op61OJ2DgSqglDiy
 ugotkg/MZPkNr2gWTtNw9RWvehb9gnBn7w8OSQ/ffnC+8YoSvBvmaWHtSepgvRXn
 3hPh2YsSe8u74cLN/P3gxWnUIdpwHRsBwIc8b7/PNIviWLcjyQE6B1qBIZWIspvo
 qlqadijJIs331zeJXEaoXRdgV2VEdA0eHEAzeC4cswc/KpSmfH5XmxWjOU2o/TiM
 V2FgN9ud4JwuNnhAJKkXSdVHuzKsbtt3XRkUdKgLG+PYYBsRGfCkyrPPjI6z7VtA
 5yh+kN65UuLCxrWskZQrdwTqSZ9WMPhGFDt727vuOHdvbAoZ7cuqMtvoDj3hJ4ig
 kb1++il5lQ5sXwEiB9+WrDTXCT0TwZw4qiVL72IDpeGlXRTfxvb/s5pLDU7O0rfV
 Pfp4rDDl0hGMP4guch4fJDEW1jYMQATowzh3PNkpw+vvjtofRFoVNtS9lhx1vXCN
 kxG9I8m4F5Iexe9eFfx7gAYiqM42fd/VbSNAsJKyl/q4OFK4ebbCK7lwRqpZKPg4
 5jVR8pPKVTqxRolsWa4ikIGG/pVAecLWO+TawLeq//brp2PJ/a8=
 =GvWF
 -----END PGP SIGNATURE-----

Merge tag 'efi-2019-07-rc5-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc5 (3)

This pull request provides error fixes for the graphical output protocol,
the text output protocol, and the extended text input protocol.

Setting the boot device for the bootefi command is now not only supported
by the 'load' command but also for the file system specific commands like
'fatload'.
2019-06-21 14:12:28 -04:00
Peng Fan
d3329f09c7 lib: Makefile: build fdtdec_common.c when OF_LIBFDT selected
When build SPL_OF_PLATDATA on i.MX6, meet issue the fdtdec_get_int
not defined, however fdtdec.c will use fdtdec_get_int, so let's
compile fdtdec_common.c when OF_LIBFDT selected.

Since there is also SPL_OF_LIBFDT, so need to use
CONFIG_$(SPL_TPL_)OF_LIBFDT.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-06-21 10:07:11 -04:00
Heinrich Schuchardt
8f89a574a9 efi_loader: fix typo in efi_variable.c
%s/efi_efi_/efi_/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:21 +00:00
Heinrich Schuchardt
fa390810e1 efi_loader: Delete() return EFI_WARN_DELETE_FAILURE
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>
2019-06-20 22:26:19 +00:00
Heinrich Schuchardt
c974ab0ecb efi_loader: ListPackageLists() return EFI_NOT_FOUND
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>
2019-06-20 22:26:19 +00:00
Heinrich Schuchardt
3b435c1193 efi_loader: console incorrectly advertised left logo key
Avoid to signal that the left logo key is pressed, when it is not.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:18 +00:00
Heinrich Schuchardt
3b2b2de8ee efi_loader: alternative scan codes for F5, END, HOME
Depending on the key board alternative scan codes are used for F5, END, and
HOME.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:18 +00:00
Heinrich Schuchardt
db311f0675 efi_loader: GOP: provide accurate mode information
For 5:6:5 modes provide correct frame buffer information.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:17 +00:00
Heinrich Schuchardt
40c8f112f5 efi_loader: SetMode() must blank screen
EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() must blank the screen.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:17 +00:00
Heinrich Schuchardt
3c783bfbfb efi_loader: system table setup
When setting up the system table avoid superfluous void * conversions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:16 +00:00
Heinrich Schuchardt
97cf20861a efi_loader: QueryMode() must allocate buffer
EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() must allocate a buffer for the
mode information structure.

Adjust the unit test to free the buffer.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:15 +00:00
Heinrich Schuchardt
1f7a8b3389 efi_loader: SetMode() parameters check
If EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() is called with an invalid mode,
return EFI_UNSUPPORTED.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:15 +00:00
Heinrich Schuchardt
997c2ce5cf efi_loader: QueryMode() check parameters
Check the parameters of EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-20 22:26:15 +00:00
Heinrich Schuchardt
3352b306bf efi_loader: Blt() with incorrect BltOperation
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-20 22:26:14 +00:00
Heinrich Schuchardt
3950f0f856 efi_loader: fix SetAttribute()
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-14 19:18:41 +02:00
Heinrich Schuchardt
2ad238fcc4 efi_loader: fix SetMode()
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-14 19:18:40 +02:00
Heinrich Schuchardt
c5b63bec2f efi_loader: GetTime() must return EFI_UNSUPPORTED
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-14 19:18:40 +02:00
AKASHI Takahiro
e771b4b39e efi_loader: add RuntimeServicesSupported variable
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-14 19:18:40 +02:00
Heinrich Schuchardt
c77d8e9d89 efi_loader: parameter checks SetVariable()
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-14 19:18:40 +02:00
Heinrich Schuchardt
3796156a80 efi_loader: legal characters in StrToFat()
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-14 19:18:40 +02:00
Heinrich Schuchardt
336476a959 efi_loader: MetaiMatch() must be case insensitive
The MetaiMatch() service of the UnicodeCollationProtocol2 must be case
insensitive.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14 19:18:40 +02:00
Heinrich Schuchardt
0e22c7cbeb efi_loader: AllocatePages() must accept addr == 0
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-14 19:18:40 +02:00
Heinrich Schuchardt
98967379b6 efi_loader: correct ExitBootServices()
Always use EFI_EXIT() to return from the function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14 19:18:39 +02:00
Heinrich Schuchardt
1d3e8dc792 efi_loader: loaded images cannot be started twice
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-14 19:18:39 +02:00
Heinrich Schuchardt
200000387c efi_loader: LoadImage must return EFI_NOT_FOUND
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-14 19:18:39 +02:00
Heinrich Schuchardt
e4afcb2876 efi_loader: LoadImage w/o SourceBuffer and DevicePath
If both SourceBuffer and DevicePath are NULL, LoadImage() must return
EFI_INVALID_PARAMETER.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-14 19:18:39 +02:00
Tom Rini
c2ea87883e Pull request for UEFI sub-system for v2019.07-rc5
This pull request provides fixes for event services.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAlz/1tkACgkQxIHbvCwF
 GsTKgQ/+JstN5TtGtkmQUIFae0WXhgG7YY3VC4mLgHzjCCxnAe7zztBiKpAq0dYI
 au/t6hBVybRSK8rX6QM4iYv26U9/UEih3A8cXTGv+lxjlMEq2ly4bE5/SaJgIdVq
 pf7Z+n74hYEQ70o1/bBHEv9VvSO4d+eZVMD48HxK8f9cfeNKgZCO3sE+rFVFDzMc
 CjalvXEKZhHVs2BCePt8gGekc8ywyAKOtcEgj4Il3b8dnCn4MlqqKNdEcCQtt+SD
 u9XIRCVsg8jwxJsBo1T3sdhB4+kKKR2B1sEb6ULw2krU9nnSpvAJRRpqugelmjy7
 LeHmEwgxVAFiV9FmcgBQWOu1tbHWTeeeHddfuFj336ia2PX78NOxy3rsaMy/0cQC
 iUUAmueO3pbom1JWq7vpNr526ZLmz+HZe7dUPb3VyWCOEv5n98ew6xcBn5jNhDRU
 HkJgMdhDlfW7jb1UXNK+jt0IBgqkEKyxrA1vvDZv20Re8jy2kGkoaexIH29vFo4D
 p+t4GJSZ2v4alj5WVXOYlsxZWNCkpF7Uz6zcyiXhtIeat/NvwYSA8sppNFF0PRaN
 hkuuSGqzqh7rF0/8AFwWnBycx6Ib3BihwR91N63bxvLZLXTO2dNV1OPy+4HMBOtW
 kb7DgRsX0C6LjZBnR/BOekgsco8IDghunN1J08QJd88ceFIoaAM=
 =hvI1
 -----END PGP SIGNATURE-----

Merge tag 'efi-2019-07-rc5' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc5

This pull request provides fixes for event services.
2019-06-12 07:15:38 -04:00
Heinrich Schuchardt
7a69e97ba4 efi_loader: implement event queue
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-10 23:06:19 +02:00
Heinrich Schuchardt
1e37be5e20 efi_selftest: correct event group test
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-10 23:06:19 +02:00
Heinrich Schuchardt
7eaa900e56 efi_loader: event signaling in ExitBootServices
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-10 23:06:19 +02:00
Heinrich Schuchardt
dfa306e442 efi_loader: SignalEvent for event in signaled state
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-10 23:06:19 +02:00
Heinrich Schuchardt
daa3f8472a efi_loader: RegisterProtocolNotify event signaling
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-10 23:06:19 +02:00
Tom Rini
5973901826 Merge branch 'master' of git://git.denx.de/u-boot-tegra
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-08 09:10:31 -04:00
Heinrich Schuchardt
3bad256f5b lib/vsprintf: allow printing upper case GUIDs
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-07 10:52:30 -04:00
Tom Rini
dbbb1c43f2 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAlz3mYcACgkQxIHbvCwF
 GsTNgw/8DSxiFXvOF6eTWd2POYfu9wjZXCcMtpsfuLA3b58AjF0VfYhoXgQoel1B
 BnP6wzaIajIM8yafvia38EBloa2ZkBPjqUD/dtvs/hYe9x9kMCqLpsbOgHmjKF4b
 X6w4j4OOvOaEuKnsi6faWmXfsOWA5laYz6/u1Ewau+0P5SMnt/0piVMqkLofFO1i
 TcUzzn8MyfuCOu6UH+nqMZMguPaLkiCZX+aS6Q6tDfd5wfVRDtGTMGrMO/X42tLB
 vqAgW6qRV8U4H08gBx8u2+xiO67soiH+7AVuhc+/6inMCPyAXBwVlr79YihNi75o
 FOftPJ3hcJ+YkLNSVpwayKzrPa9GCCB2PGVDPCWQMwejIgQMkLPq2xRbFCPmLC4N
 WM4E11lqLSDL4xUTqhn+bJfRofaIpV9t79VVNAOkwHD7Wj0mnOVWjnpY+bB3n3hN
 LAneXPiUoQXSy9d3F2dd6J3emQMSTK4TPchGwWyfFwTe8VszynvHbWU8AGyCjbop
 /XAlBHYfuTLjvB+j8WLfua7ocmMtvIAU3CLC8OJ6bvga/VIPtG17rGAiQ1RP9W0u
 JZ4QKOnU2M8NiOrq45GIQEUV/UocNDJ2g5fZshLIzNk1it90RFEQ7kR6WYZZg4Hq
 zHSVjKijqxUcqKfQbSukJInDYI8xS1F+jKgB3HdGCg49ZZb/y74=
 =mCc9
 -----END PGP SIGNATURE-----

Merge tag 'efi-2019-07-rc4-2' of git://git.denx.de/u-boot-efi

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-05 15:53:18 -04:00
Thierry Reding
0c4e2658e8 lib: Implement strndup()
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2019-06-05 09:16:32 -07:00
Thierry Reding
ebf30e8451 fdtdec: Add fdtdec_set_ethernet_mac_address()
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-05 09:16:32 -07:00
AKASHI Takahiro
366161cf97 efi_loader: bootmgr: make BootNext non-volatile
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-04 23:56:14 +02:00
AKASHI Takahiro
cee2cbc731 efi_loader: variable: support non-volatile attribute
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-04 23:56:14 +02:00
Heinrich Schuchardt
e80474ad39 efi_loader: notify memory map changes
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-04 22:09:38 +02:00
AKASHI Takahiro
94e6e55053 efi_loader: bootmgr: print a message when loading from BootNext failed
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-04 22:09:26 +02:00
Heinrich Schuchardt
120ff7ba68 efi_loader: close protocols in UnloadImage()
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-04 22:09:26 +02:00
Heinrich Schuchardt
25e6fb5e93 efi_loader: fix EnableCursor()
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-04 22:09:26 +02:00
Heinrich Schuchardt
22f23db428 efi_loader: check timer events in Stall()
During a call to Stall() we should periodically check for timer events.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-04 22:09:26 +02:00
Heinrich Schuchardt
6a853dbcc0 lib: time: export usec_to_tick()
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-04 22:09:26 +02:00
Heinrich Schuchardt
66ca24a9a0 efi_loader: DisconnectController() with no driver
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-04 22:09:26 +02:00
Heinrich Schuchardt
7950e8e2eb efi_selftest: unit test for OpenProtocolInformation()
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-01 22:40:24 +02:00
Heinrich Schuchardt
7e572cf69d efi_loader: CloseProtocol() fix open protocol information
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-01 22:40:24 +02:00
Heinrich Schuchardt
b4863baa68 efi_loader: open protocol information
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-01 22:40:23 +02:00
Heinrich Schuchardt
755d42d420 efi_loader: correct HandleProtocol()
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-01 22:40:23 +02:00
Heinrich Schuchardt
5ec48e38ee efi_loader: Kconfig entries for GetTime(), SetTime()
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-06-01 04:53:13 +02:00
Heinrich Schuchardt
38b9a79c63 efi_loader: handling of daylight saving time
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-31 23:27:20 +02:00
Heinrich Schuchardt
e6bcc35452 efi_loader: check time in SetTime()
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-31 23:27:12 +02:00
Heinrich Schuchardt
a248bc8055 efi_loader: correct UninstallProtocolInterface()
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-31 23:27:12 +02:00
Heinrich Schuchardt
dae7ce451c efi_loader: avoid crash in OpenProtocol()
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-31 23:27:12 +02:00
Heinrich Schuchardt
399a39e34a efi_loader: correct OpenProtocol()
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-31 23:27:12 +02:00
Heinrich Schuchardt
e31b3b1622 efi_loader: registration key in LocateProtocol()
In LocateProtocol() implement searching by the registration key returned by
RegisterNotifyProtocol().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-31 23:27:12 +02:00
Heinrich Schuchardt
b8abd743ff efi_loader: factor out efi_check_register_notify_event()
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-31 23:27:11 +02:00
AKASHI Takahiro
8eee1d3ec6 efi_loader: bootmgr: print a message when loading from BootNext failed
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-31 23:27:11 +02:00
Heinrich Schuchardt
f09cea36ca efi_loader: correct notification of protocol installation
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-31 23:27:11 +02:00
AKASHI Takahiro
a2c6983740 efi_loader: variable: attributes may not be changed if a variable exists
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-24 18:58:14 +02:00
AKASHI Takahiro
dbebae5ec7 efi_loader: variable: return error for APPEND_WRITE
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>
2019-05-24 18:58:14 +02:00
AKASHI Takahiro
609b6ba61d efi: selftest: APPEND_WRITE is not supported
The error here should be marked *todo*.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-24 18:58:14 +02:00
Heinrich Schuchardt
2d51bd2926 efi_loader: DEL is an illegal file name character
According to the FAT32 specification 0x7f (DEL) is not a legal character
for file names.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-24 18:58:13 +02:00
Heinrich Schuchardt
20562893fa efi_loader: correct device path check
Since commit 226cddbe32 ("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: 226cddbe32 ("efi_loader: check device path in
       InstallMultipleProtocolInterfaces")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-24 18:58:13 +02:00
Heinrich Schuchardt
bb2b13d528 efi_loader: return values of GetTime()
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>
2019-05-24 18:58:13 +02:00
Heinrich Schuchardt
433bfe7b12 efi_loader: implement SetTime
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>
2019-05-24 18:58:13 +02:00
Thierry Reding
3bf2f15351 fdtdec: Remove fdt_{addr,size}_unpack()
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>
2019-05-21 17:33:23 -06:00
Heinrich Schuchardt
b31ca6bf84 efi_loader: parameter check OutputString
Check the parameters against NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
acee965263 efi_loader: EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState() correct parameter
KeyToggleState is a pointer according to UEFI spec 2.8.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
1344f7d0f6 efi_loader: GetNextMonotonicCount() check parameter
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>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
db80fe3866 efi_loader: parameter checks CalculateCrc32()
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>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
226cddbe32 efi_loader: check device path in InstallMultipleProtocolInterfaces
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>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
b1b782d306 efi_loader: implement deprecated Unicode collation protocol
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>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
95ab381676 efi_loader: rename Unicode collation protocol 2 variables
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>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
f005f573a8 efi_loader: merge adjacent sprintf()
In the implementation of the device path to text protocol join adjacent
sprintf() statements.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
ce54fdc492 efi_loader: parameter checks simple network protocol
Check buffer pointers are not NULL as required by the UEFI 2.7 spec.

Return EFI_UNSUPPORTED instead of EFI_INVALID_PARAMETER when trying to
transmit with non-zero header_size.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
487d8c75f1 efi_loader: GetVariable set attributes for EFI_BUFFER_TOO_SMALL
UEFI spec 2.7 erratum A leaves it undefined if Attributes should be set if
GetVariable() returns EFI_BUFFER_TOO_SMALL.

UEFI spec 2.8 defines that Attributes should be set if the return value is
either EFI_SUCCESS or EFI_BUFFER_TOO_SMALL.

Set Attributes if the return value is EFI_BUFFER_TOO_SMALL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-19 08:10:10 +02:00
Heinrich Schuchardt
05fefe7681 efi_loader: ACPI device node to text
The device path to text protocol renders ACPI device nodes incorrectly.

Use capital hexadecimal numbers as shown in the UEFI spec examples.

Always output the optional UID. This matches what UEFI SCT expects and
saves us an `if`.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
3b985113be efi_loader: infinite recursion notifying events
UEFI SCT uses this call sequence to determine the current TPL level inside
notification functions:

    OldTpl = BS->RaiseTPL(TPL_HIGH_LEVEL);
    BS->RestoreTPL(OldTpl);

In RestoreTPL() we trigger the notification function of queued events. If
we do not mark the event as non-queued before calling the notification
function, this results in an infinite recursive call sequence.

Mark the event as non-queued before entering the notification function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
8ae39857b9 efi_loader: simplify efi_allocate_pages()
Replace unnecessary control structures by using return statements.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
f756fe83b0 efi_loader: AllocateAdress error handling
If AllocatePages() is called with AllocateAddress, the UEFI spec requires
to return EFI_NOT_FOUND in case the memory page does not exist.

The UEFI SCT II 2017 spec additionally requires to return EFI_NOT_FOUND if
the page is already allocated.

Check that *Memory refers to an unallocated page.

UEFI SCT II (2017): AllocatePages(), 5.1.2.1.9 - 5.1.2.1.10

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
735fd22800 efi_loader: out of resources in AllocatePages()
According to the UEFI AllocatePages() has to return EFI_OUT_OF_RESOURCES if
sufficient memory is not available.

Change the return value.

UEFI SCT II (2017): 3.2.1 AllocatePages(), 5.1.2.1.8

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
7d3af58ed9 efi_loader: check memory address before freeing
When we call FreePages() we essentially add memory to our memory map. We
shouldn't do this for memory that does not exit.

Check if the memory that is to be freed via FreePages() or FreePool() is in
our memory map and is not EFI_CONVENTIONAL_MEMORY.

This check is mandated by the UEFI specification.

Cf. UEFI SCT  II (2017), 3.2.2 FreePages(), 5.1.2.1 - 5.1.2.2

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
96aa99cded efi_loader: error code in UninstallProtocolInterface()
According to the UEFI specification UninstallProtocolInteface() has to
return EFI_NOT_FOUND if the interface is not found.

Correct the return value.

Cf. UEFI SCT II spec (2017), 3.3.2 UninstallProtocolInterface(), 5.1.3.2.4

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
61c63db7fe efi_loader: superfluous check in efi_remove_protocol()
efi_search_protocol() already checks that the GUID matches. Don't check
a second time.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
ab557141c2 efi_loader: LocateDevicePath() incorrect parameter check
A parameter check in LocateDevicePath() does not match the requirements of
the UEFI spec.

If device is NULL, only return EFI_INVALID_PARAMETER if a matching handle
is found.

Cf. UEFI SCT II specification (2017)3.3.7 LocateDevicePath(), 5.1.3.7.3

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
0a84319665 efi_loader: fix typo in efi_locate_handle() comment
%s/not buffer/no buffer/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
64b5ba4d29 efi_loader: make device path to text protocol customizable
The device path to text protocol is not needed for EBBR compliance. So
let's make it a customizable option.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
334997356e efi_loader: make Unicode collation protocol customizable
The Unicode collation protocol is not needed for EBBR compliance. So let's
make it a customizable option.

The Unicode capitalization table is only needed by this protocol. So let it
depend on the Unicode collation protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
9363fd22df efi_loader: reword the EFI_LOADER config option
No need to mention U-Boot in brief description.
Fix several typos, mention iPXE.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
5684c8d1ea efi_loader: format Kconfig
Use if/endif for dependencies to give structure to the configuration menu.

Sort important settings to the top.

Abbreviate the short description of EFI_LOADER_HII.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
5ad3877448 efi_loader: observe CONFIG_EFI_LOADER_HII
If EFI_LOADER_HII is not set, do not unnecessarily compile files for HII
protocols.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-12 20:54:22 +02:00
Heinrich Schuchardt
b015ab57bf efi_loader: signature of ExitBootServices()
Consistently use efi_uintn_t as type of memory keys.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <graf@amazon.com>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
470dfa50da efi_loader: LoadImage() check source size
If the size of the source buffer is 0, return EFI_LOAD_ERROR.
(UEFI SCT II 2017: 3.4.1 LoadImage() - 5.1.4.1.6)

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
84a918e8ce efi_loader: LoadImage() check parent image
If the parent image handle does not refer to a loaded image return
EFI_INVALID_PARAMETER.
(UEFI SCT II 2017: 3.4.1 LoadImage() - 5.1.4.1.1)

Mark our root node as a loaded image to avoid an error when using it as
parent image.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
e7c3cd6b67 efi_loader: HandleProtocol parameter checks
HandleProtocol() and OpenProtocol() have to return EFI_UNSUPPORTED if the
protocol is not installed on the handle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
529886a097 efi_loader: use EFI_PRINT instead of debug
For correct indentation of messages in the UEFI API implementation use
EFI_PRINT() instead of debug().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
ec163faa1b efi_loader: CloseProtocol() requires valid agent handle
Return EFI_INVALID_PARAMETER from CloseProtcol() if the agent handle is not
valid.

Return EFI_INVALID_PARAMETER if the optional controller handle is not
valid.

Return immediately from efi_search_obj if the handle is NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
24f6be7ada efi_selftest: unit test for RegisterProtocolNotify()
Provide a unit test for the RegisterProtocolNotify() boot service.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
ab15d4149e efi_loader: implement RegisterProtocolNotify()
The RegisterProtocolNotify() boot service registers an event to be
notified upon the installation of a protocol interface with the
specified GUID.

Add the missing implementation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
3626e53990 efi_loader: EVT_NOTIFY_SIGNAL events
The notification function of events of type EVT_NOTIFY_SIGNAL should always
be queued when SignalEvent() is called.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
8101dd3dfa efi_selftest: remove redundant function efi_st_memcmp()
Function memcmp() is available in efi_freestanding.c. So we do not remove a
further implementation.

Replace all usages of efi_st_memcmp() by memcmp().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:04 +02:00
Heinrich Schuchardt
126a43f15b efi_loader: unload applications upon Exit()
Implement unloading of images in the Exit() boot services:

* unload images that are not yet started,
* unload started applications,
* unload drivers returning an error.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:03 +02:00
Heinrich Schuchardt
df116e81ea efi_loader: implement UnloadImage()
Implement the UnloadImage() boot service

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:03 +02:00
Heinrich Schuchardt
46e99a9cf7 efi_loader: move efi_unload_image() down in source
Move efi_unload_image() down in source to avoid forward declaration in
follwing page.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:03 +02:00
Heinrich Schuchardt
cd73aba656 efi_loader: mark started images
In UnloadImage() we need to know if an image is already started.

Add a field to the handle structure identifying loaded and started images.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:03 +02:00
Heinrich Schuchardt
8dfb5e6e21 efi_loader: correct parameter check in LocateHandle()
If LocateHandle() does not find an entry EFI_NOT_FOUND has to be returned
even if BufferSize is NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:03 +02:00
Heinrich Schuchardt
1884512b77 efi_loader: allowable event types in CreateEventEx()
CreateEventEx() does not allow the following event types:

* EVT_SIGNAL_EXIT_BOOT_SERVICES
* EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE

This check is needed to pass the UEFI SCT conformance test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <agraf@csgraf.de>
2019-05-07 21:10:03 +02:00
Heinrich Schuchardt
52cbac9b06 efi_loader: clean up UEFI sub-system initialization
allow_unaligned(), switch_to_non_secure_mode(), and efi_init_obj_list() are
called in sequence in multiple places.

Move calls to allow_unaligned() and switch_to_non_secure_mode() to
efi_init_obj_list().

Remove unused includes.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07 21:10:03 +02:00
Marek Behún
8509f22aac lib: add Zstandard decompression support
Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
2019-05-05 08:48:50 -04:00
Marek Behún
83a486b6fd lib: Add xxhash support
This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
2019-05-05 08:48:50 -04:00
Heinrich Schuchardt
6c74e94a65 lib/display_options: avoid illegal memory access
display_options_get_banner_priv() overwrites bytes before the start of the
buffer if the buffer size is less then 3. This case occurs in the Sandbox
when executing the `ut_print` command.

Correctly handle small buffer sizes. Adjust the print unit test to catch
when bytes before the buffer are overwritten.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-05-05 08:48:50 -04:00
Tom Rini
b362fe0848 Merge branch '2019-05-03-master-imports'
- Various btrfs fixes
- Various TI platform fixes
- Other fixes (cross build, taurus update, Kconfig help text)
2019-05-03 07:30:55 -04:00
Heiko Schocher
5132361ad4 lib: Kconfig: fix help text for GZIP
commit 95f4bbd581 ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
2019-05-03 07:23:17 -04:00
Heinrich Schuchardt
cb943418bf lib/vsprintf: remove #include <uuid.h> from vsprintf.c
common.h already includes uuid.h

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-03 07:23:17 -04:00
Eugeniu Rosca
4ccf678f37 lib: uuid: Fix unseeded PRNG on RANDOM_UUID=y
The random uuid values (enabled via CONFIG_RANDOM_UUID=y) on our
platform are always the same. Below is consistent on each cold boot:

 => ### interrupt autoboot
 => env default -a; gpt write mmc 1 $partitions; print uuid_gpt_misc
 ...
 uuid_gpt_misc=d117f98e-6f2c-d04b-a5b2-331a19f91cb2
 => env default -a; gpt write mmc 1 $partitions; print uuid_gpt_misc
 ...
 uuid_gpt_misc=ad5ec4b6-2d9f-8544-9417-fe3bd1c9b1b3
 => env default -a; gpt write mmc 1 $partitions; print uuid_gpt_misc
 ...
 uuid_gpt_misc=cceb0b18-39cb-d547-9db7-03b405fa77d4
 => env default -a; gpt write mmc 1 $partitions; print uuid_gpt_misc
 ...
 uuid_gpt_misc=d4981a2b-0478-544e-9607-7fd3c651068d
 => env default -a; gpt write mmc 1 $partitions; print uuid_gpt_misc
 ...
 uuid_gpt_misc=6d6c9a36-e919-264d-a9ee-bd00379686c7

While the uuids do change on every 'gpt write' command, the values
appear to be taken from the same pool, in the same order.

Assuming U-Boot with RANDOM_UUID=y is deployed on a large number of
devices, all those devices would essentially expose the same UUID,
breaking the assumption of system/RFS/application designers who rely
on UUID as being globally unique (e.g. a database using UUID as key
would alias/mix up entries/records due to duplicated UUID).

The root cause seems to be simply _not_ seeding PRNG before generating
a random value. It turns out this belongs to an established class of
PRNG-specific problems, commonly known as "unseeded randomness", for
which I am able to find below bugs/CVE/CWE:
 - https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2015-0285
   ("CVE-2015-0285 openssl: handshake with unseeded PRNG")
 - https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2015-9019
   ("CVE-2015-9019 libxslt: math.random() in xslt uses unseeded
   randomness")
 - https://cwe.mitre.org/data/definitions/336.html
   ("CWE-336: Same Seed in Pseudo-Random Number Generator (PRNG)")

The first revision [1] of this patch updated the seed based on the
output of get_timer(), similar to [4].

There are two problems with this approach:
 - get_timer() has a poor _ms_ resolution
 - when gen_rand_uuid() is called in a loop, get_timer() returns the
   same result, leading to the same seed being passed to srand(),
   leading to the same uuid being generated for several partitions
   with different names

The above drawbacks have been addressed in the second version [2].
In its third revision (current), the patch reworded the description
and summary line to emphasize it is a *fix* rather than an improvement.

Testing [3] consisted of running 'gpt write mmc 1 $partitions' in a
loop on R-Car3 for several minutes, collecting 8844 randomly generated
UUIDS. Two consecutive cold boots are concatenated in the log.
As a result, all uuid values are unique (scripted check).

Thanks to Roman, who reported the issue and provided support in fixing.

[1] https://patchwork.ozlabs.org/patch/1091802/
[2] https://patchwork.ozlabs.org/patch/1092945/
[3] https://gist.github.com/erosca/2820be9d554f76b982edd48474d0e7ca
[4] commit da384a9d76 ("net: rename and refactor eth_rand_ethaddr() function")

Reported-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02 18:17:50 +02:00
Heinrich Schuchardt
e6023be41e efi_loader: description of efi_add_handle()
Correct the comments describing function efi_add_handle().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02 18:17:50 +02:00
Heinrich Schuchardt
a9a25cc3e7 efi_selftest: test exit_data
Amend the unit test 'start image exit' to transfer a string as exit data.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02 18:17:50 +02:00
Heinrich Schuchardt
556d8dc937 efi_loader: implement support of exit data
In case of a failure exit data may be passed to Exit() which in turn is
returned by StartImage().

Let the `bootefi` command print the exit data string in case of an error.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02 18:17:50 +02:00
Heinrich Schuchardt
39a1ff8cea efi_loader: optional data in load options are binary
The field boot OptionalData in structure _EFI_LOAD_OPTIONS is for binary
data.

When we use `efidebug boot add` we should convert the 5th argument from
UTF-8 to UTF-16 before putting it into the BootXXXX variable.

When printing boot variables with `efidebug boot dump` we should support
the OptionalData being arbitrary binary data. So let's dump the data as
hexadecimal values.

Here is an example session protocol:

=> efidebug boot add 00a1 label1 scsi 0:1 doit1 'my option'
=> efidebug boot add 00a2 label2 scsi 0:1 doit2
=> efidebug boot dump
Boot00A0:
  attributes: A-- (0x00000001)
  label: label1
  file_path: .../HD(1,MBR,0xeac4e18b,0x800,0x3fffe)/doit1
  data:
    00000000: 6d 00 79 00 20 00 6f 00 70 00 74 00 69 00 6f 00  m.y. .o.p.t.i.o.
    00000010: 6e 00 00 00                                      n...
Boot00A1:
  attributes: A-- (0x00000001)
  label: label2
  file_path: .../HD(1,MBR,0xeac4e18b,0x800,0x3fffe)/doit2
  data:

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02 18:17:50 +02:00
AKASHI Takahiro
d40e05ae95 efi_loader: set OsIndicationsSupported at init
UEFI variables should be installed using well-defined API.
Currently we don't support much, but the value of OsIndicationsSupported
will be updated once some features are added in the future.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Add comments. Rename a variable.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02 18:17:49 +02:00
Heinrich Schuchardt
e00b82db80 efi_loader: FreePages() must fail with pages = 0
The UEFI spec requires that freeing of pages fails if the number of pages
to be freed is 'invalid'. Check that it is not zero.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02 18:17:49 +02:00
Heinrich Schuchardt
751e928d07 efi_loader: parameter check CreateEventEx()
CreateEvent() and CreateEventEx() should check that a notify function is
provided for either of EVT_NOTIFY_SIGNAL or EVT_NOTIFY_WAIT.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02 18:17:49 +02:00
Tom Rini
7d99406742 Various minor sandbox iumprovements
Fixes for tracing with sandbox
 Refactoring for boot_get_fdt()
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAlzAfvkACgkQfxc6PpAI
 reYu9AgAjaFmydXjE8DxkSB3rR7DHZFTs1erVKAAL2v+Tdf7LDmz+j6u1M3v55WY
 6r54f/gZ1UX5TEmQgEAKLa7QvvRO/lNvSGQnLHhZhv2IVWo7uWCKAUPdQ6XVZnUK
 zO5v+ucs9Ne4HxQJHMC509HUIIBbydiRvUm8W0SeBZy4kEyJDuub4L+rpARkXNks
 IZfKuY+VS4FK73D4M9PIhoXSubZgVS4AEcapakU1DvEz0kjsN4wr4idGrp3lutPC
 455imz83JBq2+mx1oxclOGedkIDzTCq+nWQAwSftMehrJpGrp7RLNo0v4QZZUf4V
 LIXRqObIYse9yQLkYPpeBdePMc8/tQ==
 =0NJ2
 -----END PGP SIGNATURE-----

Merge tag 'pull-24apr19' of git://git.denx.de/u-boot-dm

Various minor sandbox iumprovements
Fixes for tracing with sandbox
Refactoring for boot_get_fdt()
2019-04-24 12:27:29 -04:00
Tom Rini
180e38ad2d Pull request for UEFI sub-system for v2019.07-rc1 (3)
This patch series reworks the implementation of the `bootefi` command to
 remove code duplication by using the LoadImage() boot service to load
 binaries.
 
 Missing short texts for UEFI protocols are added for display by the
 `efidebug dh` command.
 
 Missing parameter checks for AllocatePages() and CreateDeviceNode() are
 implemented.
 
 The constants for protocol GUIDs are changed to match the names in the UEFI
 specification.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAly/PhwACgkQxIHbvCwF
 GsRlbA/+JeegsUbV0fYFvdTi4JNPRlKqkzwyo2DoWN76M2MPb+l6d4quxhOdAOaf
 3MpnCHb2z0567b7Ma5+KmAFYEBNJZrxAHthmtRnYhAbJMpE1ei6HzwJ29p+IYQKB
 usc6eOH7ybb99v0KtxLRr1CMpvxK6zud5Zxcyym5nzoAaNP4AplaQDUM1mfYOHox
 sRbEuoNpPkn50ejUtldb0Oh63vJ/bBBLojwQyGnGtBcRDf5bFehHzw5spD0oHPJv
 7E1kze2679kOEsjPa39rFhh/8YaUd+giJW137V2cyFeEyw6ydNKXuWo9Zg0ahLOy
 e+ddRjDCbi0edHbOjL6hdNTgGzdcKwy9bHqYJEacP+OLczmzimNQaALCDUzXcH1C
 lGLHrhbMpV+Do4mFIFdIqPyW+rfRDsz9Sp84Y02M6TBzCK3XPmPXDRVpiTcWmfbb
 ixD4HSQjvPDcmm98iJQIZrfcasnWbBInITqcGDDTIRg0snrYUsIoUNmQPpBDsuwD
 O1hPV8iOpFA/a/8GLJpIgta34YIPZzjlaU38c5+qV7Tsx0ODsdpTVx8JCWeJPeK+
 uhOXTWMlokgH//2ypHzIS9cUEBkoA6I9r4/fWpIjZe3iuxtV8ct2P5dHYcmrRFjY
 lF1WpX3gNeWCgPbGa3Yg/crtpVW+M6hDEgknOPqTAOTjx/g7jpg=
 =caQ+
 -----END PGP SIGNATURE-----

Merge tag 'efi-2019-07-rc1-3' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc1 (3)

This patch series reworks the implementation of the `bootefi` command to
remove code duplication by using the LoadImage() boot service to load
binaries.

Missing short texts for UEFI protocols are added for display by the
`efidebug dh` command.

Missing parameter checks for AllocatePages() and CreateDeviceNode() are
implemented.

The constants for protocol GUIDs are changed to match the names in the UEFI
specification.
2019-04-24 12:26:58 -04:00
Eugeniu Rosca
829ceb2821 image: android: allow booting lz4-compressed kernels
According to Android image format [1], kernel image resides at 1 page
offset from the boot image address. Grab the magic number from there
and allow U-Boot to handle LZ4-compressed KNL binaries instead of
hardcoding compression type to IH_COMP_NONE. Other compression types,
if needed, can be added later.

Tested on H3ULCB-KF using the image detailed in [2].

[1] Excerpt from include/android_image.h
    +-----------------+
    | boot header     | 1 page
    +-----------------+
    | kernel          | n pages
    +-----------------+
    | ramdisk         | m pages
    +-----------------+
    | second stage    | o pages
    +-----------------+

[2] => iminfo 4c000000
    ## Checking Image at 4c000000 ...
    Android image found
    kernel size:      85b9d1
    kernel address:   48080000
    ramdisk size:     54ddbc
    ramdisk addrress: 4a180000
    second size:      0
    second address:   48000800
    tags address:     48000100
    page size:        800
    os_version:       1200012a (ver: 0.9.0, level: 2018.10)
    name:
    cmdline:          buildvariant=userdebug

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
2019-04-24 07:27:32 -04:00
Thierry Reding
d81d96901e fdtdec: Use fdt_setprop_u32() for fdtdec_set_phandle()
The fdt_setprop_u32() function does everything that we need, so we
really only use the function as a convenience wrapper, in which case it
can simply be a static inline function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-23 20:26:43 -06:00
Simon Glass
1c6eb075a3 Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig
This converts the following to Kconfig:
   CONFIG_TRACE_BUFFER_SIZE
   CONFIG_TRACE_EARLY_SIZE
   CONFIG_TRACE_EARLY
   CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-04-23 20:26:43 -06:00
Simon Glass
a24a78d7e3 Convert CONFIG_TRACE to Kconfig
This converts the following to Kconfig:
   CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-04-23 20:26:43 -06:00
Simon Glass
f564d09608 trace: Tidy up error returns
At present many functions in this file return -1. Update them to return a
valid error code. Also tidy up the 'return' statements at the same time,
since these should have a blank line before them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-04-23 20:26:43 -06:00
Simon Glass
f611a46ef1 div64: Don't instrument the division function
This function may be called from tracing code, since that code needs to
read the timer and this often requires calling do_div(), which calls
__div64_32(). If this function is instrumented it causes an infinite loop,
since emitting a trace record requests the time, which in turn emits a
trace record, etc.

Update the prototype to prevent instrumentation code being added.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-04-23 20:26:43 -06:00
Simon Glass
ca49b2c6e2 div64: Use kernel types
These functions still use uint32_t and uint64_t but checkpatch now
requests that the kernel types be used instead. Update them as well as a
few resulting checkpatch errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-04-23 20:26:43 -06:00
Heinrich Schuchardt
7d1e4b73e3 efi_loader: check length in CreateDeviceNode()
When creating a device path node ensure that the size of the allocated
memory at lest matches the size of the node header.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:51:01 +02:00
Heinrich Schuchardt
f12bcc9149 efi_loader: check memory type in AllocatePages()
The UEFI specification prescribes that AllocatePages() checks the memory
type.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:37:28 +02:00
Heinrich Schuchardt
6182495e10 efi_loader: need either ACPI table or device tree
The EBBR specification prescribes that we should have either an ACPI table
or a device tree but not both. Let us enforce this condition in the
`bootefi` command.

If the bootefi command is called without a device tree parameter use a
previously device tree or fall back to the internal device tree.

The fdt unit test should not be run on boards with an ACPI table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:37:28 +02:00
Heinrich Schuchardt
68066d5bcd efi_selftest: do not run FDT test with ACPI table.
The EBBR specification prescribes that we should have either an ACPI table
or a device tree but not both.

So do not run the device tree unit test on boards with an ACPI table.
Hence there is no need any longer to make it 'on request' only.
Do not pass $fdtcontroladdr to `bootefi selftest`.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:37:28 +02:00
AKASHI Takahiro
6b95b38c41 efi_loader: rework bootmgr/bootefi using load_image API
In the current implementation, bootefi command and EFI boot manager
don't use load_image API, instead, use more primitive and internal
functions. This will introduce duplicated code and potentially
unknown bugs as well as inconsistent behaviours.

With this patch, do_efibootmgr() and do_boot_efi() are completely
overhauled and re-implemented using load_image API.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Use efi_root as parent handle for the loaded image.
LoadImage() should be called with BootPolicy = true by the boot manager.
Avoid duplicate free_pool().
Eliminate variable memdp which is not needed after anymore due to
"efi_loader: correctly split device path of loaded image".

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:37:28 +02:00
Heinrich Schuchardt
1e15a9cb7f efi_loader: correctly split device path of loaded image
When the LoadImage() service is called for an image that is already loaded
to memory the file path may be NULL or it will contain both a device path
as well as a media path. We should not assume that there is no media path.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:37:28 +02:00
Heinrich Schuchardt
dec88e41e0 efi_loader: consistent naming of protocol GUIDs
We should consistently use the same name for protocol GUIDs as defined in
the UEFI specification. Not adhering to this rule has led to duplicate
definitions for the EFI_LOADED_IMAGE_PROTOCOL_GUID.

Adjust misnamed protocol GUIDs.

Adjust the text for the graphics output protocol in the output of the
`efidebug dh` command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:37:27 +02:00
AKASHI Takahiro
a2a4bc3b09 efi_loader: export root node handle
This is a preparatory patch.
The root node handle will be used as a dummy parent handle when invoking
an EFI image from bootefi/bootmgr command.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Rebased.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:37:27 +02:00
AKASHI Takahiro
f86076d885 efi_loader: efi_setup_loaded_image() handle missing file name
This is a preparatory patch.

efi_dp_split_file_path() is used to create device_path and file_path
from file_path for efi_setup_loaded_image().
In a special case, however, of HARDWARE_DEVICE/MEMORY, it doesn't
work expectedly since this path doesn't contain any FILE_PATH sub-type.

This patch makes a workaround.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Adjust the logic such that for all paths that do no end on a media file
path we return NULL as file_path.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23 00:37:27 +02:00
Tom Rini
38f94d3539 Pull request for UEFI sub-system for v2019.07-rc1 (2)
In the aarch64 crash dump information about the loaded EFI images is added.
 
 In README.uefi the development target is for the UEFI subsystem is
 described as "Embedded Base Boot Requirements (EBBR) Specification"
 compliance.
 
 Several bug fixes are supplied.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAlyyzHEACgkQxIHbvCwF
 GsS+9Q/9HahVvxHFljI8ymxznml7AlFCrxWwcVo5HhftbGuQIgF3NMXRlsxmsSPM
 Z+Cc3EFni4EWWWe9yDMLqXV4NCd6bnfWYWP4UvbqAKCfeX8jScRyMypPnxZ3rNrg
 oe/8zDT9qXQnEah4sB+AQhar2VRTS1p97wKDObt3mj9c2g5pGL1zdejS/4SfnCd0
 a1BymV7p7fpykDjW8S0GQM56QAkbB9CJ4Q7nlPCDlspqJlQB318lWs46FfUn2Aue
 DNLm0uscrMZtEr/aAdT+r/96GIq4AVkexy7b5MZ0v/NDNAtmIqO1ORUmLSNSDfcM
 /cbtxq53VbeztMzMoYDdU0zNR//N4dL3GbSRKJulksvxeIExCp3dRV7gfTOwWq7J
 Lg/b43WJI1f2vgXDgEPddTO3E3SPjCGQcnCNOcVNNfTkyrtVaCmRYh69lV2BpKKF
 oQCYQyzS8yYLxj16YXixK9seyQYxh/vPYVT78ed5A8B1dmyxSQMnEJjY93jngj1g
 k5DRH9nnx12aeEqkhsWvVdHT0OBNj/+oZlzT3KGDcxhrDeZXAgqxAO1oPG85Wqnx
 kPeadyVD0T5Dd8fpMqF+tToB+GCbvyUVJsVlNqDSC7NslJ3AbxBKNDuEsMJlXgwL
 Yh4/lusg/YXzZ4ACWHgUnckZDVZGNj+58QRgEU+3mZinMjDS38E=
 =QdJl
 -----END PGP SIGNATURE-----

Merge tag 'efi-2019-07-rc1-2' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc1 (2)

In the aarch64 crash dump information about the loaded EFI images is added.

In README.uefi the development target is for the UEFI subsystem is
described as "Embedded Base Boot Requirements (EBBR) Specification"
compliance.

Several bug fixes are supplied.
2019-04-15 07:30:25 -04:00
Tom Rini
216800acf1 Merge branch 'master' of git://git.denx.de/u-boot-spi
Conflicts:
	arch/arm/dts/armada-385-amc.dts
	arch/arm/dts/armada-xp-theadorable.dts
	arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi

Signed-off-by: Tom Rini <trini@konsulko.com>
2019-04-14 00:03:06 -04:00
Heinrich Schuchardt
8688b75391 efi_selftest: expect boot services data for fdt
In a previous patch the memory type used for the FDT has been changed to
boot services data. We have to adjust the test.

Correct an incorrect comment. The tested services are boot services.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:09:09 +02:00
Heinrich Schuchardt
f1465c1597 efi_loader: simplify protocol installation
By using InstallMultipleProtocolInterfaces() the coding for installing
protocol interfaces on the root node can be simplified.

Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:42 +02:00
Heinrich Schuchardt
7657ae12f3 efi_loader: export efi_install_multiple_protocol_interfaces
Export function efi_install_multiple_protocol_interfaces() so that we can
call it in others parts of the UEFI subsystem.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:42 +02:00
Heinrich Schuchardt
207c5bcce1 efi_selftest: physical and virtual addresses must match
At boottime physical and virtual addresses must match. Add a corresponding
check to the memory unit test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:42 +02:00
Heinrich Schuchardt
9631fa0fd1 efi_loader: update virtual address in efi_mem_carve_out
Handle virtual address in efi_mem_carve_out() function
when a new region is created to avoid issue in EFI memory map.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

At boottime physical and virtual addressed have to be the same.
This allowed to simplify the proposed logic.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:42 +02:00
Patrick Delaunay
74f5baa28b efi_loader: add protection for block_dev
Check the value of block_dev before to use this pointer.

This patch solves problem for the command "load" when ubifs
is previously mounted: in this case the function
blk_get_device_part_str("ubi 0") don't return error but return
block_dev = NULL and then data abort.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:42 +02:00
Heinrich Schuchardt
07805f203b efi_loader: fix setting PlatformLang
The UEFI variables PlatformLang and PlatformLangCodes specify the current
firmware language and the list of all available languages.

Currently their values are hard coded. With the patch a new configuration
variable EFI_PLATFORM_LANG_CODES is provided.

When initializing the UEFI subsystem this configuration variable is used to
initialize PlatformLangCodes. The value of variable PlatformLang is read.
If it is not set, the first language specified in EFI_PLATFORM_LANG_CODES
is used to initialize PlatformLang.

Suggested-by: Takahiro Akashi <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:42 +02:00
Heinrich Schuchardt
e7ac009b00 efi_loader: move efi_save_gd() call to board_r.c
The first functions of the UEFI sub-system are invoked before reaching the
U-Boot shell, e.g. efi_set_bootdev(), efi_dp_from_name(),
efi_dp_from_file(). We should be able to print out device paths for
debugging purposes here.

When printing device paths via printf("%pD\n", dp) this invokes functions
defined as EFIAPI. So efi_save_gd() must be called beforehand.

So let's move the efi_save_gd() call to function initr_reloc_global_data(()
in board_r.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:42 +02:00
Heinrich Schuchardt
2337741fb4 efi_loader: remove stray #define LOG_CATEGORY LOGL_ERR
The statement '#define LOG_CATEGORY LOGL_ERR' makes not sense. LOGL_ERR is
not a LOG_CATEGORY. Remove the statement.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:41 +02:00
Heinrich Schuchardt
084f093301 efi_loader: enable HII protocols by default
As the UEFI shell requires the HII protocols let's enable them by default.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:41 +02:00
Heinrich Schuchardt
8ec7d5d355 efi_loader: assign HII protocols to root node
We should not install the HII protocols on every loaded image. It is
sufficient to install them once on the root node.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-12 22:00:41 +02:00
Neil Armstrong
51e4e3e5d0 x86: dts: switch spi-flash to jedec, spi-nor compatible
The x86 code and DT uses "spi-flash" to detect a flash node, switch to
"jedec,spi-nor" in the DTS files and in fdtdec by switching the
GENERIC_SPI_FLASH value to to jedec,spi-nor.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
2019-04-12 10:54:27 +05:30
Thierry Reding
4e4bde30c6 fdtdec: test: Add carveout tests
Implement carveout tests for 32-bit and 64-bit builds.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-11 20:10:50 -06:00
Thierry Reding
a95460a45b fdtdec: test: Use compound statement macros
This eliminates the need for intermediate helper functions and allow the
macros to return a value so that it can be used subsequently.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-11 20:10:50 -06:00
Thierry Reding
3db600c3ea fdtdec: test: Fix build warning
Hide the declaration of the "fd" variable When not building a DEBUG
configuration, to avoid the variable being unused.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-11 20:10:50 -06:00
Thierry Reding
54969b40a0 fdtdec: Add Kconfig symbol for tests
Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-11 20:10:50 -06:00
Thierry Reding
16523ac790 fdtdec: Implement carveout support functions
The fdtdec_get_carveout() and fdtdec_set_carveout() function can be used
to read a carveout from a given node or add a carveout to a given node
using the standard device tree bindings (involving reserved-memory nodes
and the memory-region property).

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-11 20:10:50 -06:00
Thierry Reding
c9222a08b3 fdtdec: Implement fdtdec_add_reserved_memory()
This function can be used to add subnodes in the /reserved-memory node.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-11 20:10:50 -06:00
Thierry Reding
8153d53b93 fdtdec: Implement fdtdec_set_phandle()
This function can be used to set a phandle for a given node.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-11 20:10:50 -06:00
Thierry Reding
ea1df3e07c libfdt: Add phandle generation helper
The new fdt_generate_phandle() function can be used to generate a new,
unused phandle given a specific device tree blob. The implementation is
somewhat naive in that it simply walks the entire device tree to find
the highest phandle value and then returns a phandle value one higher
than that. A more clever implementation might try to find holes in the
current set of phandle values and fill them. But this implementation is
relatively simple and works reliably.

Also add a test that validates that phandles generated by this new API
are indeed unique.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-11 20:10:50 -06:00
Thierry Reding
1701892790 vsprintf: Support phys_addr_t specifier unconditionally
When phys_addr_t printf specifier support was first introduced in commit
1eebd14b79 ("vsprintf: Add modifier for phys_addr_t"), it was enabled
only if CONFIG_CMD_NET was selected. Since physical addresses are not
unique to networking support it doesn't make sense to conditionally add
it in those cases only. Move support for it outside of the CMD_NET guard
so that the specifier is always supported.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-11 20:10:05 -06:00
Tom Rini
f95fdf237d Merge branch 'master' of git://git.denx.de/u-boot-sh
- Various rmobile fixes
2019-04-11 14:29:22 -04:00
Marek Vasut
95f4bbd581 lib: fdt: Allow LZO and GZIP DT compression in U-Boot
Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
2019-04-09 18:19:10 +02:00
Marek Vasut
1fd303543a lib: fdt: Allow enabling both LZO and GZIP DT compression
Allow enabling both LZO and GZIP DT compression in SPL and fix a
bug where if the GZIP decompression failed, the LZO decompression
would not even be attempted.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
2019-04-09 18:19:10 +02:00
Marek Vasut
118f4d4559 lib: fdt: Split fdtdec_setup_memory_banksize()
Split fdtdec_setup_memory_banksize() into fdtdec_setup_memory_banksize_fdt(),
which allows the caller to pass custom blob into the function and the
original fdtdec_setup_memory_banksize(), which uses the gd->fdt_blob. This
is useful when configuring the DRAM properties from a FDT blob fragment
passed in by the firmware.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-09 18:19:09 +02:00
Marek Vasut
3ebe09d09a lib: fdt: Split fdtdec_setup_mem_size_base()
Split fdtdec_setup_mem_size_base() into fdtdec_setup_mem_size_base_fdt(),
which allows the caller to pass custom blob into the function and the
original fdtdec_setup_mem_size_base(), which uses the gd->fdt_blob. This
is useful when configuring the DRAM properties from a FDT blob fragment
passed in by the firmware.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-09 18:19:09 +02:00
Heinrich Schuchardt
bfc2dd5381 efi_loader: correct CTRL-A - CTRL-Z console input
In the extended text input protocol CTRL-A - CTRL-Z have to be signaled as
Unicode characters a-z or A-Z depending on the shift state and not as 0x01
to 0x1a.

Update Python unit test.

This patch is required for using the EFI shell `edit` command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 15:11:33 +02:00
Heinrich Schuchardt
fbe4c7df00 efi_loader: enable file SetInfo()
EFI shell command edit uses the SetInfo() methods to unset the read only
attribute of the file to be edited. So let efi_file_setinfo() return
success in this case.

Return an error if the function is called for to rename or resize a file
as we do not support this yet.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
cb0c2a7430 efi_loader: correct file creation
The EFI shell expects that after opening a file with EFI_FILE_MODE_CREATE
GetInfo() succeeds. Up to now we do not actually create the file when
method Open() of the EFI_FILE_PROTOCOL is called.

If method Open() of the EFI_FILE_PROTOCOL is called with
EFI_FILE_MODE_CREATE and the file does not yet exist, call fs_write() with
a buffer size of zero to actually create the file.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
19b2d895fb efi_loader: debug output file handle in efi_file_open()
For debugging it is helpful to know the address of the file handle created
by the Open() method of the EFI file protocol. So let's write it with
EFI_PRINT().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
AKASHI Takahiro
d7e0b0109e efi_loader: boottime: export efi_[un]load_image()
Those two functions will be used later to re-implement do_bootefi_exec().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
AKASHI Takahiro
bc8fc32855 efi_loader: boottime: add loaded image device path protocol to image handle
To meet UEFI spec v2.7a section 9.2, we should add
EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL to image handle,
instead of EFI_DEVICE_PATH_PROTOCOL.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
734d3252af efi_loader: variables PlatformLang and PlatformLangCodes
Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate
proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI
variable PlatformLang is not defined.

As this variable is anyway prescribed in the UEFI 2.7 spec let's define it
to L"en-US". Use the same value for PlatformLangCodes that defines the list
of all supported languages.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
e301e024e5 efi_loader: EFI_PRINT instead of debug for memory services
For debug messages inside EFI API functions we should use the EFI_PRINT
macro which gives us well aligned output like:

EFI: Entry efi_allocate_pool_ext(4, 14, 000000007edd7718)
  EFI: efi_add_memory_map: 0x7dcfa000 0x1 4 yes
EFI: Exit: efi_allocate_pool_ext: 0

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
cc2ed79182 efi_loader: EFI_PRINT instead of debug for variable services
For debug messages inside EFI API functions we should use the EFI_PRINT
macro which gives us well aligned output like:

EFI: Entry efi_get_variable("PlatformLang" ...)
  EFI: get 'efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_PlatformLang'
EFI: Exit: efi_get_variable: 14

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
bb31c3f725 efi_loader: parameter checks in StartImage and Exit()
Add parameter checks in the StartImage() and Exit() boottime services:
- check that the image handle is valid and has the loaded image protocol
  installed
- in StartImage() record the current image
- in Exit() check that the image is the current image

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
a115d56502 efi_loader: rearrange boottime service functions
To avoid forward declarations move efi_start_image() and efi_exit() down.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
2c3ec28935 efi_loader: sanity checks when freeing memory
Use a checksum to validate that efi_free_pool() is only called for memory
allocated by efi_allocated_pool().

Add a plausibility check to efi_free_pages() checking that the address
passed is page aligned.

Update related function comments to match Sphinx style.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
1c606e8490 efi_selftest: check image_base, image_size
In efi_selftest_start_image_exit.c test the image_base and image_size are
correctly set in the loaded image protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
AKASHI Takahiro
8458bf648f efi_loader: set image_base and image_size to correct values
Currently, image's image_base points to an address where the image was
temporarily uploaded for further loading. Since efi_loader relocates
the image to final destination, image_base and image_size should reflect
that.

This bug was detected in UEFI SCT, "Loaded Image Protocol Test - test 2,"
which shows that 'Unload' function doesn't fit into a range suggested by
image_base and image_size.

	TestCase/UEFI/EFI/Protocol/LoadedImage/BlackBoxTest/
	LoadedImageBBTestMain.c:1002

Changes in this patch also includes:
* reverts a patch, "efi_loader: save image relocation address
  and size" since newly added fields are no longer needed.
* copy PE headers as well since those information will be needed
  for module loading, in particular, at gurb.
  (This bug was reported by Heinrich.)

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Rebase patch.
Remove unused fields from struct efi_loaded_image_obj.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
AKASHI Takahiro
37279ad3ee efi_loader: bootmgr: support BootNext and BootCurrent variable behavior
See UEFI v2.7, section 3.1.2 for details of the specification.

With efidebug command, you can run any EFI boot option as follows:
  => efi boot add 1 SHELL ...
  => efi boot add 2 HELLO ...
  => efi boot order 1 2
  => efi bootmgr
     (starting SHELL ...)

  => efi boot next 2
  => efi bootmgr
     (starting HELLO ...)
  => env print -e
  <snip ...>
  BootCurrent: {boot,run}(blob)
  00000000:  02 00                    ..
  BootOrder: {boot,run}(blob)
  00000000:  01 00 02 00              ....

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
Heinrich Schuchardt
b0c3c346c6 efi_loader: release file buffer after loading image
Commit 0e18f584de ("efi_loader: LoadImage: always allocate new pages")
ensured that whether we load an image from file or from memory we end up
with the same number of newly allocated buffers. But essentially we ended
up with one buffer too many in both cases:

efi_load_pe() copies and rebases the UEFI image.
We do not need the buffer with the file contents afterwards.

Fixes: 0e18f584de ("efi_loader: LoadImage: always allocate new pages")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-07 14:17:06 +02:00
默默
ab8fc41302 fix compile error on macOS Mojave 2019-04-03 10:26:46 -04:00
Tom Rini
c3aef9339c Merge branch '2019-03-29-master-imports'
- Bugfixes:
  - mmc: correct the HS400 initialization process
  - configs: ti: Move FIT image load address to avoid overwrite
  - lib: time: update module enable MACRO
  - Add mbrugger as RPi board maintainer, correct agraf's email address.
2019-03-29 10:53:28 -04:00
Kever Yang
f00c26284e lib: time: update module enable MACRO
We'd better use correct way to check if module has enabled.
for we have 3 timer MACRO:
- CONFIG_TIMER
- CONFIG_SPL_TIMER
- CONFIG_TPL_TIMER

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2019-03-29 10:53:18 -04:00
Heinrich Schuchardt
17394f9a66 efi_loader: TODO for the EFI file protocol
We currently only support EFI_FILE_PROTOCOL_REVISION while
UEFI specs 2.4 - 2.7 prescribe EFI_FILE_PROTOCOL_REVISION2.
Add a todo.

Add missing constants for the EFI file protocol revision.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-27 21:52:11 +01:00
Heinrich Schuchardt
d0826507e2 efi_selftest: avoid double free in dp utilities test
Avoid duplicate FreePool() in unit test for the device patch utilities
protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-27 06:32:27 +01:00
Philippe Reynes
b02f2e79c6 rsa: check that pointer checksum isn't NULL before using it
The pointer checksum were used before checking that it
isn't NULL. We move the code that use it after the check.

Reported-by: Coverity (CID: 185835)
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-03-25 11:44:12 -04:00
Heinrich Schuchardt
d0bd87612f efi_selftest: fix test_hii_string_get_string()
The check testing the string result of get_string() returned the wrong
result. The result was ignored.

Use efi_st_strcmp_16_8() for the string comparison.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-20 18:16:53 +01:00
Heinrich Schuchardt
1646e0928c efi_loader: superfluous conversion in efi_file_open()
printf("%ls", ..) expects u16 * as argument to print. There is not need for
a conversion to wchar_t *.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-20 18:16:53 +01:00
Heinrich Schuchardt
d5974af7f7 efi_loader: remove superfluous check in efi_setup_loaded_image()
It does not make any sense to check if a pointer is NULL if we have
dereferenced it before.

Reported-by: Coverity (CID 185827)
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-20 18:16:53 +01:00
Heinrich Schuchardt
e7dae584b0 efi_loader: missing return in efi_get_next_variable_name()
Add a missing return statement in efi_get_next_variable_name().

Reported-by: Coverity (CID 185834)
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-20 18:16:53 +01:00
Heinrich Schuchardt
bd3b7478d1 efi_loader: endless loop in add_strings_package()
Avoid an endless loop in add_strings_package().

Suggested-by: Takahiro Akashi <takahiro.akashi@linaro.org>
Reported-by: Coverity (CID 185833)
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-20 18:16:53 +01:00
Heinrich Schuchardt
306b16718e efi_loader: correct parameter size in efi_allocate_pool
efi_allocate_pages() expects a (uint64_t *) pointer to pass the address of
the assigned memory. If we pass the address of a pointer here, an illegal
memory access occurs on 32bit systems.

Fixes: 282a06cbca ("efi_loader: Expose U-Boot addresses in memory map
for sandbox")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-20 18:16:53 +01:00
Heinrich Schuchardt
e616100eab efi_loader: fix build error for freestanding.o
Since commit f51a226436 ("efi_loader: provide freestanding library") in
parallel builds errors

    lib/efi_selftest/../efi_loader/efi_freestanding.o:
    file not recognized: File truncated

occur. Obviously make cannot correctly sequence parallel builds with a
dependency like ../efi_loader/efi_freestanding.o.

Fixes: f51a226436 ("efi_loader: provide freestanding library")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-14 21:03:14 +01:00
Matthias Brugger
dd1a1ec2af efi_loader: Fix serial console size detection
Function term_read_reply tries to read from the serial console until
the end_char was read. This can hang forever if we are, for some reason,
not able to read the full response (e.g. serial buffer too small,
frame error). This patch moves the timeout detection into
term_read_reply() to assure we will make progress.

Fixes: 6bb591f704 ("efi_loader: query serial console size reliably")
Signed-off-by: Matthias Brugger <mbrugger@suse.com>

Throw missing error when an incomplete reply for the cursor position is
received.

Change type of argument of term_get_char() *s32. This renders the function
reusable in efi_cin_read_key().

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-10 19:56:59 +01:00
Heinrich Schuchardt
1a9fce5039 efi_loader: HII protocols: debug messages
When package types are not supported by our implementation of the HII
database protocol supported error messages are displayed.

Essentially the output is only needed for debugging. By using EFI_PRINT()
the messages are only written for in debug mode and with correct
indentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-02 23:34:26 +01:00
Heinrich Schuchardt
fdef298338 efi_loader: HII protocols: fix new_package_list()
In new_package_list() we call new_packagelist() to create a new package
list. Next we try to add the packages which fails for form packages. Due
to this error we call free_packagelist(). Now in free_packagelist()
list_del() is called for an uninitialized field hii->link. This leads to
changing random memory addresses.

To solve the problem move the initialization of hii->link to
new_packagelist().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2019-03-02 23:34:26 +01:00
Heinrich Schuchardt
30a231dcce efi_loader: do not add \ in efi_fs_from_name()
In the `efidebug boot add` command we do not want an unsolicited leading
backslash added to the file name.

There is no good reason to mark a loaded file with a backslash as absolute.
Anyway when reading files the file name will be interpreted as relative to
root directory of the device.

So let's get rid of this backslash.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-02 23:34:26 +01:00
AKASHI Takahiro
454568b4f0 efi_loader: define load option attributes
See UEFI specification v2.7a, section 3.1.3, "Load Option Processing."

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-25 12:47:13 +01:00
Heinrich Schuchardt
ccecc3456a efi_loader: fix entry count in bootmgr
Since commit 914df75b0c ("efi_loader: fix EFI entry counting")
entry_count is already set to 1 before efi_bootmgr_load() is called. So we
should not increment it when entering the function.

Without the patch an assert error occurs in efi_get_variable() if DEBUG is
defined.

Fixes: 914df75b0c ("efi_loader: fix EFI entry counting")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-25 12:39:48 +01:00
Heinrich Schuchardt
33e44971a2 efi_loader: error message if BootOrder not defined
For booting via `bootefi bootmgr` it is necessary that the EFI variable
BootOrder is defined. Provide a diagnostic message if the variable is
missing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-25 12:39:47 +01:00
Heinrich Schuchardt
c7cd4afb92 tpm: simplify: tpm_set_global_lock()
When in pack_byte_string() memcpy() is called for size 0 the source buffer
address has no relevance. So we can use NULL here.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-02-19 08:55:43 -05:00
Heinrich Schuchardt
997fc12ec9 efi_loader: do not miss last relocation block
If the last block in the relocation table contains only a single
relocation, the current coding ignores it.

Fix the determination of the end of the relocation table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:51:14 +01:00
Heinrich Schuchardt
1db561e11f efi_loader: documentation of image loader
- Add missing function descriptions.
- Update existing function descriptions to match Sphinx style.
- Add lib/efi_loader/efi_image_loader.c to the input files for Sphinx
  generated documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:48:58 +01:00
Heinrich Schuchardt
914df75b0c efi_loader: fix EFI entry counting
`bootefi selftest` fails on qemu-x86_defconfig if efi_selftest() is not
invoked using EFI_CALL().

Likewise we call the entry point of EFI payloads with
EFI_CALL(efi_start_image()).

entry_count indicates if we are in U-Boot (1) or in EFI payload code (0).
As we start in U-Boot code the initial value has to be 1.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:20 +01:00
Heinrich Schuchardt
f69d63fae2 efi_loader: use efi_start_image() for bootefi
Remove the duplicate code in efi_do_enter() and use efi_start_image() to
start the image invoked by the bootefi command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:20 +01:00
Heinrich Schuchardt
8f7e2b2980 efi_loader: set entry point in efi_load_pe()
Up to now efi_load_pe() returns the entry point or NULL in case of an
error. This does not allow to return correct error codes from LoadImage().

Let efi_load_pe() return a status code and fill in the entry point in the
corresponding field of the image object.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:20 +01:00
Heinrich Schuchardt
0e18f584de efi_loader: LoadImage: always allocate new pages
If we want to properly unload images in Exit() the memory should always be
allocated in the same way. As we allocate memory when reading from file we
should do the same when the original image is in memory.

A further patch will be needed to free the memory when Exit() is called.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:20 +01:00
Heinrich Schuchardt
16112f9f48 efi_loader: error handling in efi_setup_loaded_image()
In case of an error we should set the returned pointers to NULL. This
ensures that an illegal free does not occur even if the caller calls
free() for the handles.

If protocols cannot be installed, release all resources.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:20 +01:00
Heinrich Schuchardt
60c4454ddb lib/vsprintf: print '?' for illegal Unicode sequence
Commit 0e66c10a7d ("lib: vsprintf: avoid overflow printing UTF16
strings") broke the Unicode unit tests: an illegal UTF16 code point
should be printed as '?'.

Fixes: 0e66c10a7d ("lib: vsprintf: avoid overflow printing UTF16 strings")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:20 +01:00
Heinrich Schuchardt
d787caddf1 efi_selftest: LoadImage from file device path
Provide a unit test that calls LoadImage() with a file device path and
executes the application via StartImage().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:19 +01:00
Heinrich Schuchardt
95288b1e94 efi_loader: comments for efi_file_from_path()
Add more comments for efi_file_from_path().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:19 +01:00
Heinrich Schuchardt
caf6d2fd1a efi_loader: efi_dp_split_file_path() error handling
If the path passed to efi_dp_split_file_path() does not contain a
reference to a file it returns EFI_OUT_OF_RESOURCES. This does not properly
indicate the kind of the problem that occurred. Return
EFI_INVALID_PARAMETER instead.

Update function description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16 15:42:19 +01:00
Heinrich Schuchardt
ee3c8ba855 efi_selftest: fix memory allocation in HII tests
In efi_selftest we are in EFI land. We cannot call U-Boot library
functions malloc() and free() but should use the boot time services
instead.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
2019-02-16 15:42:19 +01:00
Heinrich Schuchardt
afa17aa23f efi_selftest: do not use efi_free_pool()
In efi_selftest we are in EFI land. We should not use U-Boot library
functions but boot time services for memory management.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
2019-02-16 15:42:19 +01:00
Heinrich Schuchardt
823c233b7a efi_loader: fix EFI_FILE_PROTOCOL.GetInfo()
We check the existence of files with fs_exist(). This function calls
fs_close(). If we do not set the active block device again fs_opendir()
fails and we do not set the flag EFI_FILE_DIRECTORY. Due to this error the
`cd` command in the EFI shell fails.

So let's add the missing set_blk_dev(fh) call.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
0e66c10a7d lib: vsprintf: avoid overflow printing UTF16 strings
We have to ensure while printing UTF16 strings that we do not exceed the
end of the print buffer.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Alexander Graf
5fbb28958b efi_loader: Make HII a config option
Heinrich ran into issues with HII and iPXE which lead to #SErrors on
his Odroid-C2 system. We definitely do not want to regress just yet,
so let's not expose the HII protocols by default.

Instead, let's make it a config option that people can play with
This way, we can stabilize the code in tree without breaking any
users.

Once someone figures out, why this breaks iPXE (probably a NULL
dereference), we can enable it by default.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - Remove HII selftest as well

v2 -> v3:

  - Make config option
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
6f8f4217e7 efi_loader: debug output for HII protocols
For correct indention use EFI_PRINT() instead of debug().

For printing efi_uintn_t or size_t use the %zu or %zx format code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
f38753d2ef efi_selftest: fix HII tests
efi_st_printf() does not support format code %ld. Anyway the format code
for size_t would be %zu which isn't supported either.

We do not want any divisions to avoid invalid references to integer
arithmetic routines, cf.
https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html.

As a simple remedy remove the noisy messages from the output.
They are not relevant for automated testing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
AKASHI Takahiro
4c4fb10da2 efi_selftest: add HII database protocols test
This efi_selftest tests HII database protocol and HII string protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
AKASHI Takahiro
cb728e51a7 efi: hii: add HII config routing/access protocols
This patch is a place holder for HII configuration routing protocol and
HII configuration access protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
AKASHI Takahiro
8d3b77e36e efi: hii: add keyboard layout package support
Allow for handling keyboard layout package in HII database protocol.

A package can be added or deleted in HII database protocol, but
we don't set 'current' keyboard layout as there is no driver that
requests a keyboard layout.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
AKASHI Takahiro
9ab0bdd9fe efi: hii: add guid package support
Allow for handling GUID package in HII database protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Leif Lindholm
c9bfb22296 efi_loader: Initial HII database protocols
This patch provides enough implementation of the following protocols to
run EDKII's Shell.efi and UEFI SCT:

  * EfiHiiDatabaseProtocol
  * EfiHiiStringProtocol

Not implemented are:
  * ExportPackageLists()
  * RegisterPackageNotify()/UnregisterPackageNotify()
  * SetKeyboardLayout() (i.e. *current* keyboard layout)

HII database protocol in this patch series can handle only:
  * GUID package
  * string package
  * keyboard layout package
  (The other packages, except Device path package, will be necessary
   for interactive and graphical UI.)

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
dba5148049 efi_loader: GetNextVariableName() relies on REGEX
Our implementation of GetNextVariableName() relies on
CONFIG_REGEX=y. So EFI_LOADER has to select it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
eefb790e90 efi_loader: fix GetNextVariableName
Our current implementation of GetNextVariableName() first collects all EFI
variables. If none is found at all hexport_r() returns a zero length string
terminated by \0 and the value 1 as number of bytes in the returned buffer.

In this case GetNextVariableName() has to return EFI_NOT_FOUND.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
6c75db07f4 efi_loader: do not use symbolic links
Symbolic links are not supported on all file systems, e.g. not on FAT. So
it is not wise to use them in our source tree.

Use a qualified path to refer to lib/efi_loader/efi_freestanding.c in
scripts/Makefile.lib instead.

Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: Fix build with O=]
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
6446304460 efi_loader: use library memcpy() in helloworld.efi
Helloworld does not need its own memcpy() implementation anymore. Use the
one provided in efi_freestanding.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
2013c6850e efi_loader: use freestanding library for efi apps
GCC requires that freestanding programs provide memcpy(), memmove(),
memset(), and memcmp().

Add the library functions when building a *.efi files.

The EFI selftests might use other compilation flags. So use a symbolic
link to provide lib/efi_selftest/efi_freestanding.c and compile it
separately.

Reported-by: Alexander Graf <agraf@suse.de>
Fixes: 5be444d14b38 ("efi_loader: consistent build flags for EFI applications")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
f51a226436 efi_loader: provide freestanding library
GCC requires that freestanding programs provide memcpy(), memmove(),
memset(), and memcmp().

Provide the required library functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
AKASHI Takahiro
1170fee695 efi_selftest: fix variables test for GetNextVariableName()
There is a bug in efi variables test.
Fix it with some cosmetic improvements.

Please note that efi variables test still fails at QueryVariableInfo()
and GetVariable(), but this is not due to a change in this patch.
  ==8<==
  Testing EFI API implementation

  Selected test: 'variables'

  Setting up 'variables'
  Setting up 'variables' succeeded

  Executing 'variables'
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(60):
  TODO: QueryVariableInfo failed
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(131):
  TODO: GetVariable returned wrong length 7
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(133):
  TODO: GetVariable returned wrong value
  Executing 'variables' succeeded

  Boot services terminated

  Summary: 0 failures
  ==>8==

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
AKASHI Takahiro
d99a87f84b efi_loader: implement GetNextVariableName()
The current GetNextVariableName() is a placeholder.
With this patch, it works well as expected.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
rebased on efi-next
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
77d4d39656 efi_loader: comments for variable services
Comment the functions implementing the runtime variable services.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00
Heinrich Schuchardt
8377ee36d6 efi_loader: remove duplicate function mem2hex()
Replace duplicate function mem2hex() by inline function bin2hex().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2019-02-13 09:40:06 +01:00