Commit graph

3082 commits

Author SHA1 Message Date
Heinrich Schuchardt
e472ef8a3d efi_loader: fix device-path for USB devices
EFI device paths for block devices must be unique. If a non-unique device
path is discovered, probing of the block device fails.

Currently we use UsbClass() device path nodes. As multiple devices may
have the same vendor and product id these are non-unique. Instead we
should use Usb() device path nodes. They include the USB port on the
parent hub. Hence they are unique.

A USB storage device may contain multiple logical units. These can be
modeled as Ctrl() nodes.

Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-25 11:05:42 +01:00
Heinrich Schuchardt
c5cc6da855 efi_loader: support for Ctrl() device path node
* Add the definitions for Ctrl() device path nodes.
* Implement Ctrl() nodes in the device path to text protocol.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-03-25 11:05:42 +01:00
Tom Rini
99de38a109 zlib: trees.c: Fix a warning with clang-15
With clang-15 we now will get warnings such as:

warning: a function declaration without a prototype is deprecated in all
versions of C [-Wstrict-prototypes]

And it is easy enough to address this warning here, even if we would
like to stay in sync more with upstream as it's a single location.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-22 15:22:48 -04:00
Tom Rini
fbfcb614e0 libavb: Fix a warning with clang-15
With clang-15 we now will get warnings such as:

warning: a function declaration without a prototype is deprecated in all
versions of C [-Wstrict-prototypes]

And it is easy enough to address this warning here, as we aren't
concerned with re-syncing with an upstream.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-22 15:22:48 -04:00
Tom Rini
a5faa4a9eb Prepare v2023.04-rc4
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmQPxXsACgkQFHw5/5Y0
 tyzRWgwAlpwF0u0Xtfs+isnwy/2wb1uMKSeZTiMWkP8he48DX/+db1LHyxnb5apX
 5ULLLKnxZGDviFNw6F/Vuq/BlL8aK+K6wJm+HxdN4Df+sQZgP0kZVnZH1DcDGyJ7
 2I5mYxXCQiRfl3lG8uHdfQyGT5BOm1ZYTIBgXPzpdp/PS6Es74aIHfHS4UdsnpZ2
 dw5APUHnXsSeycbvgiZZEAQphRGplTgSmEDLZTCHD6+oIFoyJVMRr4QWc+KjYPR8
 MgfykqaITO7xKg1V2GwEWJA7LpU4L3HrK+8upSjdx0kfKw4jZoBTU5LE3dnk+6fz
 rgisMfyDGZ+w467uk9BSAO9smRRRI7GFMSkvi+kMQtVCFWCSaddkfYPlpFu1PND7
 nHfxkzoIjxeEOG8yIFF8P199w2lEorKTxlXuNBStfozvAz1wfhgq3o3WQGpvDmqF
 E+FoC7t73qVu6DVMiCXCOyUYNyI7d1tFlUhlbZPVCelVL8RX3JjMF/0uhLsOSDMc
 s4z/6fVq
 =xK+J
 -----END PGP SIGNATURE-----

Merge tag 'v2023.04-rc4' into next

Prepare v2023.04-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-03-14 12:06:35 -04:00
Heinrich Schuchardt
d3970e04e7 efi_loader: describe term_get_char()
Add a function description.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-03-13 13:56:14 +01:00
Masahisa Kojima
26a35023c4 efi_loader: update SetVariable attribute check
UEFI specification v2.10 says that
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and
EFI_UNSUPPORTED should be returned in SetVariable variable service.
Current implementation returns EFI_INVALID_PARAMETER,
let's fix the return value.

Together with above change, this commit also updates the SetVariable
attribute check to be aligned with the EDK2 reference implementation.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-03-13 13:56:14 +01:00
Simon Glass
3b510807f5 lib: Add an SPL config for LIB_UUID
This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-02 17:45:58 -05:00
Simon Glass
05a8e1a447 lib: Fix build condition for tiny-printf
This should be checking for any SPL build. Drop the use of SPL_TPL_ since
it is not necessary and will not work with split config.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-02 17:45:58 -05:00
Simon Glass
5a6bc166ef lib: Add VPL options for SHA1 and SHA256
Add these options so these algorithms can be used in VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-02 17:45:58 -05:00
Simon Glass
ae625d9287 lib: Add a Kconfig for SPL_BZIP2
This is implicitly used in the source and seems useful, so add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-02 17:45:58 -05:00
Simon Glass
a11be4c303 tpm: Implement tpm_auto_start() for TPMv1.2
Add an implementation of this, moving the common call to tpm_init() up
into the common API implementation.

Add a test.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-02-28 09:44:33 +02:00
Ilias Apalodimas
78fd2f54d5 efi_loader: use tpm_auto_start for the tpm device
A previous commit is adding a new tpm startup functions which
initializes the TPMv2 and performs all the needed selftests.
Since the TPM selftests might be needed depending on the requested
algorithm or functional module use that instead.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-02-28 09:44:22 +02:00
Ilias Apalodimas
a595be3a4a tpm: add a function that performs selftest + startup
As described in [0] if a command requires use of an untested algorithm
or functional module, the TPM performs the test and then completes the
command actions.

Since we don't check for TPM_RC_NEEDS_TEST (which is the return code of
the TPM in that case) and even if we would, it would complicate our TPM
code for no apparent reason,  add a wrapper function that performs both
the selftest and the startup sequence of the TPM.

It's worth noting that this is implemented on TPMv2.0.  The code for
1.2 would look similar,  but I don't have a device available to test.

[0]
https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.07-2014-03-13.pdf
§12.3 Self-test modes

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-02-28 09:44:19 +02:00
Etienne Carriere
4429393b5a efi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX
Adds CONFIG_EFI_CAPSULE_MAX to configure the max index value used in
EFI capsule reports. Prior to this change is the hard coded value was
65535 which would exceed available storage for variables. Now the
default value is 15 which should work fine with most systems.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2023-02-19 21:15:15 +01:00
Etienne Carriere
aa2d3945ce efi_loader: Measure the loaded DTB
Measures the DTB passed to the EFI application upon new boolean config
switch CONFIG_EFI_TCG2_PROTOCOL_MEASURE_DTB. For platforms where the
content of the DTB passed to the OS can change across reboots, there is
not point measuring it hence the config switch to allow platform to not
embed this feature.

Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-02-19 21:15:15 +01:00
Masahisa Kojima
a135320b42 efi_loader: fix wrong attribute check for QueryVariableInfo
QueryVariableInfo with EFI_VARIABLE_HARDWARE_ERROR_RECORD is
accepted, remove wrong attribute check.

Fixes: 454a9442fb ("efi_loader: update attribute check for QueryVariableInfo()")
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-19 21:15:15 +01:00
Heinrich Schuchardt
67af329a74 efi_loader: avoid buffer overrun in efi_var_mem_compare
We should not scan beyond the end of string name.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-19 21:15:15 +01:00
Sjoerd Simons
0d91c88230 lmb: Treat a region which is a subset as equal
In various cases logical memory blocks are coalesced; As a result doing
a strict check whether memory blocks are the same doesn't necessarily
work as a previous addition of a given block might have been merged into
a bigger block.

Fix this by considering a block is already registered if it's a pure
subset of one of the existing blocks.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2023-02-12 11:54:18 -05:00
Simon Glass
852d4dbd70 trace: Detect an infinite loop
If something is wrong with a board's timer function such that it calls
functions not marked with notrace, U-Boot will hang.

Detect this, print a message and disable the trace.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
80f91558a1 trace: Correct the relocation handover with buffer overflow
When the early trace buffer overflows it leaves a gap in the trace buffer
between where the actual data finished and where it would have finished if
there were enough buffer space. This results in corrupted output.

Adjust the logic to resolve this and add a message when the buffer
overflows.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
9dd665ad33 trace: Show a few more stats about tracing
Add a few more useful items into the output. Update the buffers to use hex
consistently.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
daca66d55f trace: Track the minimum stack depth
The trace does not necessarily start at the top level, so we can see it
go negative. Track this so that we can show an accurate value for the
stack depth.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
c3d91812a2 trace: Reduce the number of function sites
Given that the compiler adds two function calls into each function, the
current spacing is overkill. Drop it down to 16 bytes per function, which
is still plenty. This saves some space in the trace buffer.

Also move the calculation into a function, so it is common code. Add a
check for gd->mon_len being unset, which breaks tracing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
d9044e5363 trace: Update the file header
It seems better to put the TEXT_BASE value in the file header rather than
in an entry record. While it is true that there is a separate base for
pre-relocation, this can be handled by using offsets in the file.

It is useful to have a version number in case we need to change the trace
format again.

Update the header to make these changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
90ad4e28e8 abuf: Support use from tools
Update the code slightly so that abuf can be used in U-Boot tools. It will
soon be needed for proftool.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:34 -05:00
Simon Glass
c33425c6f9 trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT
This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:34 -05:00
Simon Glass
64d445a3b7 time: Tidy up some unnecessary #ifdefs
Avoid using the preprocessor with TIMER_EARLY.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:34 -05:00
Tom Rini
c34009d5a9 Pull request for efi-2023-04-rc2
Documentation:
 
 * Provide page with links to talks on U-Boot
 
 UEFI:
 
 * Enable CTRL+S to save the boot order in eficonfig command
 * Run attribute check for QueryVariableInfo() only for the file store
 * Bug fixes
 
 Others:
 
 * Improve output formatting of the coninfo command
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmPme8EACgkQxIHbvCwF
 GsTJ6RAAiDVG2OFTodxLFVhzxoorrIf/piMZDxtc1ClRxF7CPe5CET18bHp0hvvw
 qKJW+dk3aCUSr+E1Ma9ndAHI+/mKmEXudZj/XuUyxlVhm9P8Fw2EQRGZFeogdp0v
 /tMB8c7DjW5kTg39/U3z3F7qo6ifs1I8rGcxAhvU38iuOmmIai6AZH1cEq2P2zY9
 JdHPzSCVz4TOGzmhJD3wxYMn+DjsLxIT0tggGPRJzXGaAdZdLS7cl/X52rabV/Tq
 aJXhjpWNl7RUiNiQbKMtltbmkJQ2MpHkhLGDj2/3H2W5sbpIx0GwDs7r0GSKJ0Ba
 6ycn5NBjP3C3gcl91oWJXrzux6LN2aWqe45lgOLpL2H2pPaRlDebBEdDA+oNQKoo
 mqX8pMbLfpb3nhg/fOXo/YDZ5Uug42fmpjj3Vu5+imjq9jL+tr5lxZ2oDpsUyT51
 MvQXohYTfsYNHQm7M4BzGIuA66WwCJ5TJ3D/YmwdDWPnCCN+QAUMI2/d8Osbct6W
 OBGaoZQoRpPZV62+mrHloXW9j8sapcQfJGejdby7S1bxagF/KG/BLXGCWH/HdWCc
 TsnW+bOOF4N9gIyyyu3yRfHyE7pIyszWlNwRAuPzjwG0dxEbkboA/JdLIFic3Qsj
 fk/65FSvvAeOuvNYEgsEA5VYXJzhD4oNtcNQZHIHjhSTGKBrJF4=
 =HVHT
 -----END PGP SIGNATURE-----

Merge tag 'efi-2023-04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc2

Documentation:

* Provide page with links to talks on U-Boot

UEFI:

* Enable CTRL+S to save the boot order in eficonfig command
* Run attribute check for QueryVariableInfo() only for the file store
* Bug fixes

Others:

* Improve output formatting of the coninfo command

# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Feb 2023 12:15:45 PM EST
# gpg:                using RSA key 6DC4F9C71F29A6FA06B76D33C481DBBC2C051AC4
# gpg: Good signature from "Heinrich Schuchardt <xypron.glpk@gmx.de>" [unknown]
# gpg:                 aka "[jpeg image of size 1389]" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6DC4 F9C7 1F29 A6FA 06B7  6D33 C481 DBBC 2C05 1AC4
2023-02-10 13:45:15 -05:00
Heinrich Schuchardt
124725732f efi_loader: static efi_query_variable_info_runtime()
This function is not used externally and hence should be static.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
f28c4b2222 efi_loader: make gop_blt() static
This function is not used externally.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
b9276637ce efi_loader: include definition of allow_unaligned()
Add missing include.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
6c2377f9a0 efi_loader: static functions in efi_runtime.c
Functions that are not used externally should be static.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
e7175f9320 efi_loader: static functions in efi_console.c
Define function set_shift_mask() as static as it is not used externally.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
be6784789e efi_loader: static functions in efi_boottime.c
Make functions that are no used externally static.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
575cfe7b47 efi_loader: static functions in helloworld.c
Make functions that are not used externally static.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
8d4c2c770c efi_loader: fix efi_ecpt_register()
num_entries should be unsigned to avoid warnings. As the target field is
u16 we should use this type.

    lib/efi_loader/efi_conformance.c: In function ‘efi_ecpt_register’:
    lib/efi_loader/efi_conformance.c:30:33: warning:
    conversion to ‘long unsigned int’ from ‘int’ may change
    the sign of the result [-Wsign-conversion]
       30 |         ecpt_size = num_entries * sizeof(efi_guid_t)
          |                                 ^
    lib/efi_loader/efi_conformance.c:46:36: warning:
    conversion from ‘int’ to ‘u16’ {aka ‘short unsigned int’}
    may change value [-Wconversion]
       46 |         ecpt->number_of_profiles = num_entries;
          |                                    ^~~~~~~~~~~

Fixes: 6b92c17352 ("efi: Create ECPT table")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
7d840627ca efi_loader: make get_load_options() static
In program initrddump.efi function get_load_options() can be static.

This avoids a warning when building with 'make W=1':

    lib/efi_loader/initrddump.c:442:6: warning:
    no previous prototype for ‘get_load_options’ [-Wmissing-prototypes]
      442 | u16 *get_load_options(void)
          |      ^~~~~~~~~~~~~~~~

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Masahisa Kojima
454a9442fb efi_loader: update attribute check for QueryVariableInfo()
Current U-Boot supports two EFI variable service, U-Boot own
implementation and op-tee based StMM variable service.

With ACS Security Interface Extension(SIE) v22.10_SIE_REL1.1.0,
there are several failure items of QueryVariableInfo().

Current attribute check for QueryVariableInfo() was implemented
based on the Self Certification Test (SCT) II Case Specification,
June 2017, chapter 4.1.4 QueryVariableInfo().
This test case specification is outdated and don't align at all
with the SCT test case code, and UEFI specification v2.10 does
not clearly define the priority of the attribute check.

For U-Boot standard case that EFI variables are stored in a file
in the ESP, this commit modifies the attribute check to get align
to the EDK2 implementation.

For latter case(op-tee based StMM variable service), parameter check
should be delegated to StMM.

Now all ACS SIE QueryVariableInfo() test cases passed both EFI variable
storage implementations.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:39 +01:00
Simon Glass
28de1e06c9 Correct SPL use of ENV_WRITEABLE_LIST
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_ENV_WRITEABLE_LIST defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
bed722328b Correct SPL use of EFI_UNICODE_COLLATION_PROTOCOL2
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_EFI_UNICODE_COLLATION_PROTOCOL2 defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
07754cb0ae Correct SPL use of EFI_TCG2_PROTOCOL
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_EFI_TCG2_PROTOCOL defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
da841537ce Correct SPL use of EFI_LOADER_HII
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_EFI_LOADER_HII defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
5cf9952e69 Correct SPL use of EFI_DEVICE_PATH_UTIL
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_EFI_DEVICE_PATH_UTIL defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
deda5d5ecd Correct SPL use of EFI_APP
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_EFI_APP defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Sjoerd Simons
2dc16a2c1f Bump LMB_MAX_REGIONS default to 16
Since commit 06d514d77c ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]
2023-02-08 14:09:39 -05:00
Tom Rini
948d3999bf Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"
As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-02-08 10:18:26 -05:00
Sjoerd Simons
c5279ea1c3 lmb: Set correct lmb flags for EFI memory map entries
When adding reserved memory areas from the EFI memory map set the NOMAP
flag when applicable. When this isn't done adding "no-map" flagged entries
from the fdt after receiving the same from the EFI memory map fails due
to non-matching flags.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2023-02-06 12:07:18 -05:00
Tom Rini
007ae5d108 lmb: Default to not-LMB_USE_MAX_REGIONS
The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-02-06 12:07:18 -05:00
Heinrich Schuchardt
15436faa46 efi_loader: don't use HandleProtocol
HandleProtocol() is deprecrated. According to the UEFI specification it
should be implemented as a call to  OpenProtocolInterface() with a hard
coded agent handle. This implies that we would have to call
CloseProtocolInterfaces() after usage with the same handle.

Getting rid of an EFI_CALL() is also appreciated.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-01-27 18:32:00 +01:00