summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2024-12-12lmb: Return -EEXIST in lmb_add_region_flags() if region already addedSam Protsenko
An attempt to add the already added LMB region using lmb_add_region_flags() ends up in lmb_addrs_overlap() check, which eventually leads to either returning 0 if 'flags' is LMB_NONE, or -1 otherwise. It makes it impossible for the user of this function to catch the case when the region is already added and differentiate it from regular errors. That in turn may lead to incorrect error handling in the caller code, like reporting misleading errors or interrupting the normal code path where it could be treated as the normal case. An example is boot_fdt_reserve_region() function, which might be called twice (e.g. during board startup in initr_lmb(), and then during 'booti' command booting the OS), thus trying to reserve exactly the same memory regions described in the device tree twice, which produces an error message on second call. Return -EEXIST error code in case when the added region exists and it's not LMB_NONE; for LMB_NONE return 0, to conform to unit tests (specifically test_alloc_addr() in test/lib/lmb.c) and the preferred behavior described in commit 1d9aa4a283da ("lmb: Fix the allocation of overlapping memory areas with !LMB_NONE"). The change of lmb_add_region_flags() return values is described in the table below: Return case Pre-1d9 1d9 New ----------------------------------------------------------- Added successfully 0 0 0 Failed to add -1 -1 -1 Already added, flags == LMB_NONE 0 0 0 Already added, flags != LMB_NONE 0 -1 -EEXIST Rework all affected functions and their documentation. Also fix the corresponding unit test which checks reserving the same region with the same flags to account for the changed return value. No functional change is intended (by this patch itself). Fixes: 1d9aa4a283da ("lmb: Fix the allocation of overlapping memory areas with !LMB_NONE") Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Tested-by: Michal Simek <michal.simek@amd.com>
2024-12-06mbedtls: remove MBEDTLS_HAVE_TIMEIlias Apalodimas
When MbedTLS TLS features were added MBEDTLS_HAVE_TIME was defined as part of enabling https:// support. However that pointed to the wrong function which could crash if it received a NULL pointer. Looking closer that function is not really needed, as it only seems to increase the RNG entropy by using 4b of the current time and date. The reason that was enabled is that lwIP was unconditionally requiring it, although it's configurable and can be turned off. Since lwIP doesn't use that field anywhere else, make it conditional and disable it from our config. Fixes: commit a564f5094f62 ("mbedtls: Enable TLS 1.2 support") Reported-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
2024-12-06net: disable MBEDTLS in SPLHeinrich Schuchardt
Building SPL fails with MBEDTLS enabled. Currently we don't need it there. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
2024-12-06lmb: prohibit allocations above ram_top even from same bankSughosh Ganu
There are platforms which set the value of ram_top based on certain restrictions that the platform might have in accessing memory above ram_top, even when the memory region is in the same DRAM bank. So, even though the LMB allocator works as expected, when trying to allocate memory above ram_top, prohibit this by marking all memory above ram_top as reserved, even if the said memory region is from the same bank. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Tested-by: Andreas Schwab <schwab@suse.de>
2024-12-05lmb: Fix the allocation of overlapping memory areas with !LMB_NONEIlias Apalodimas
At the moment the LMB allocator will return 'success' immediately on two consecutive allocations if the second one is smaller and the flags match without resizing the reserved area. This is problematic for two reasons, first of all the new updated allocation won't update the size and we end up holding more memory than needed, but most importantly it breaks the EFI SCT tests since EFI now allocates via LMB. More specifically when EFI requests a specific address twice with the EFI_ALLOCATE_ADDRESS flag set, the first allocation will succeed and update the EFI memory map. Due to the LMB behavior the second allocation will also succeed but the address ranges are already in the EFI memory map due the first allocation. EFI will then fail to update the memory map, returning EFI_OUT_OF_RESOURCES instead of EFI_NOT_FOUND which break EFI conformance. So let's remove the fast check with is problematic anyway and leave LMB resize and calculate address properly. LMB will now - try to resize the reservations for LMB_NONE - return -1 if the memory is not LMB_NONE and already reserved The LMB code needs some cleanup in that part, but since we are close to 2025.01 do the easy fix and plan to refactor it later. Also update the dm tests with the new behavior. Fixes: commit 22f2c9ed9f53 ("efi: memory: use the lmb API's for allocating and freeing memory") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-12-05efi_loader: Check for a valid fw_name before auto generating GUIDsIlias Apalodimas
The gen_v5_guid() is a void and does no error checking with pointers being available etc. Instead it expects all things to be in place to generate GUIDs. If a board capsule definition is buggy and does not define the firmware names when enabling capsule updates, the board will crash trying to bring up the EFI subsystem. Check for a valid firmware name before generating GUIDs. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-12-02binman: Avoid skipping binman_init()Simon Glass
A recent lwip change stopped binman's init from working, so it is not possible to read nodes from the image description anymore. Correct this by dropping the offending line. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 4d4d7838127 net: lwip: add TFTP support and tftpboot command
2024-11-30Revert "efi_memory: do not add U-Boot memory to the memory map"Ilias Apalodimas
This reverts commit ("commit a68c9ac5d8af ("efi_memory: do not add U-Boot memory to the memory map"). This code was removed when the EFI subsystem started using LMB calls for the reservations. In hindsight it unearthed two problems. The e820 code is adding u-boot memory as EfiReservedMemory while it should look at what LMB added and decide instead of blindly overwriting it. The reason this worked is that we marked that code properly late, when the EFI came up. But now with the LMB changes, the EFI map gets added first and the e820 code overwrites it. The second problem is that we never mark SetVirtualAddressMap as runtime code, which we should according to the spec. Until we fix this the current hack can't go away, at least for architectures that *need* to call SVAM. More specifically x86 currently requires SVAM and sets the NX bit for pages not marked as *_CODE. So unless we do that late, it will crash trying to execute from non-executable memory. It's also worth noting that x86 calls SVAM late in the boot, so this will work until someone decides to overwrite/use BootServicesCode from the OS. Notably arm64 disables it explicitly if the VA space is > 48bits, so doesn't suffer from any of these problems. This doesn't really deserve a fixes tag, since it brings back a hack to remedy a situation that was wrong long before that commit, but in case anyone hits the same bug ... Simon sent the original revert in the link, but we need a proper justification for it. Link: https://lore.kernel.org/u-boot/20241112131830.576864-1-sjg@chromium.org/ Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reported-by: Simon Glass <sjg@chromium.org>
2024-11-24Merge patch series "Fix device removal order for Apple dart iommu"Tom Rini
Janne Grunau <j@jannau.net> says: Starting with v2024.10 dev_iommu_dma_unmap calls during device removal trigger a NULL pointer dereference in the Apple dart iommu driver. The iommu device is removed before its user. The sparsely used DM_FLAG_VITAL flag is intended to describe this dependency. Add it to the driver. Adding this flag is unfortunately not enough since the boot routines except the arm one simply remove all drivers. Add and use a new function which calls dm_remove_devioce_flags(DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL); dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL); to ensure this order dependency is head consistently. Link: https://lore.kernel.org/r/20241123-iommu_apple_dart_ordering-v2-0-cc2ade6dde97@jannau.net
2024-11-24dm: Add dm_remove_devices_active() for ordered device removalJanne Grunau
This replaces dm_remove_devices_flags() calls in all boot implementations to ensure non vital devices are consistently removed first. All boot implementation except arch/arm/lib/bootm.c currently just call dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL). This can result in crashes when dependencies between devices exists. The driver model's design document describes DM_FLAG_VITAL as "indicates that the device is 'vital' to the operation of other devices". Device removal at boot should follow this. Instead of adding dm_remove_devices_flags() with (DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL) everywhere add dm_remove_devices_active() which does this. Fixes a NULL pointer deref in the apple dart IOMMU driver during EFI boot. The xhci-pci (driver which depends on the IOMMU to work) removes its mapping on removal. This explodes when the IOMMU device was removed first. dm_remove_devices_flags() is kept since it is used for testing of device_remove() calls in dm. Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-24lmb: Correctly unmap and free memory on errorsIlias Apalodimas
We never free and unmap the memory on errors and we never unmap it when freeing it. The latter won't cause any problems even on sandbox, but for consistency always use unmap_sysmem() Fixes: commit 22f2c9ed9f53 ("efi: memory: use the lmb API's for allocating and freeing memory") Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-23efi_loader: allow EFI_LOADER_BOUNCE_BUFFER on all architecturesHeinrich Schuchardt
Commit 775f7657ba58 ("Kconfig: clean up the efi configuration status") by mistake revoked commit dcd1b63b7072 ("efi_loader: allow EFI_LOADER_BOUNCE_BUFFER on all architectures"). Fixes: 775f7657ba58 ("Kconfig: clean up the efi configuration status") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Tested-by: Loic Devulder <ldevulder@suse.com>
2024-11-23efi_loader: simplify efi_tcg2_hash_log_extend_event()Heinrich Schuchardt
The value of variable nt is never used. Just use NULL when calling efi_check_pe(). The API function is not expected to write to the console. Such output might have unwanted side effects on the screen layout of an EFI application. Leave error handling to the caller. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-16tpm: use memmove() for overlapping buffersHeinrich Schuchardt
The behavior of memcpy() for overlapping buffers is undefined. Fixes: 4c57ec76b725 ("tpm: Implement state command for Cr50") Addresses-Coverity-ID: 356664 Overlapping buffer in memory copy Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-14lmb.c: add missing comma in lmb_dump_region()Heinrich Schuchardt
In the message string " %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: " a comma is missing before flags. To avoid increasing the code size replace '0x%' by '%#'. Printing the size with leading zeros but not the addresses does not really make sense. Remove the leading zeros from the size output. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> [trini: Fix test/cmd/bdinfo.c for these changes] Signed-off-by: Tom Rini <trini@konsulko.com>
2024-11-14lmb: do not panic in lmb_print_region_flagsHeinrich Schuchardt
Commit c3cf0dc64f1c ("lmb: add a check to prevent memory overrun") addressed a possible buffer overrun using assert_noisy(). Resetting via panic() in lmb_print_region() while allowing invalid lmb flags elsewhere is not reasonable. Instead of panicking print a message indicating the problem. fls() returns an int. Using a u64 for bitpos does not match. Use int instead. fls() takes an int as argument. Using 1ull << bitpos generates a u64. Use 1u << bitpos instead. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-11-14lib: rsa: Set conventional salt length RSA-PSS parameterLoic Poulain
RFC 3447 says that Typical salt length are either 0 or the length of the output of the digest algorithm, RFC 4055 also recommends hash value length as the salt length. Moreover, By convention, most of the signing infrastructures/libraries use the length of the digest algorithm (such as google cloud kms: https://cloud.google.com/kms/docs/algorithms). If the salt-length parameter is not set, openssl default to the maximum allowed value, which is a openssl 'specificity', so this works well for local signing, but restricts compatibility with other engines (e.g pkcs11/libkmsp11): ``` returning 0x71 from C_SignInit due to status INVALID_ARGUMENT: at rsassa_pss.cc:53: expected salt length for key XX is 32, but 478 was supplied in the parameters Could not obtain signature: error:41000070:PKCS#11 module::Mechanism invalid ``` To improve compatibility, we set the default RSA-PSS salt-length value to the conventional one. A further improvement could consist in making it configurable as signature FIT node attribute. rfc3447: https://datatracker.ietf.org/doc/html/rfc3447 rfc4055: https://datatracker.ietf.org/doc/html/rfc4055 Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2024-11-14lwip: fix code style issuesJerome Forissier
Fix various code style issues in the lwIP code. Reported-by: Tom Rini <trini@konsulko.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-13lib: vsprintf: fix API buildHeinrich Schuchardt
Avoid a build failure when building with CONFIG_API=y, CONFIG_EXAMPLES=y: lib/vsprintf.c:312:14: warning: ‘device_path_string’ defined but not used [-Wunused-function] 312 | static char *device_path_string(char *buf, char *end, void *dp, int field_width, | ^~~~~~~~~~~~~~~~~~ Fixes: 64b5ba4d293a ("efi_loader: make device path to text protocol customizable") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-13Merge patch series "lib: uuid: fix uuid_str_to_le_bin() on 32-bit"Tom Rini
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says: The lib_test_uuid_to_le and lib lib_test_dynamic_uuid tests fail on 32-bit systems. But we never caught this in our CI because we never ran any of our C unit tests on 32-bit. Enable CONFIG_UNIT_TEST on qemu_arm_defconfig. hextoul() cannot convert a string to a 64-bit number on a 32-bit system. Use the new function hextoull() instead. Link: https://lore.kernel.org/r/20241103224223.195255-1-heinrich.schuchardt@canonical.com
2024-11-13lib: uuid: fix uuid_str_to_bin() on 32-bitHeinrich Schuchardt
hextoul() cannot convert a string to a 64-bit number on a 32-bit system. Use function hextoull() instead. Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Fixes: 22c48a92cdce ("lib: uuid: supporting building as part of host tools") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Tested-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2024-11-13lib: uuid: fix uuid_str_to_le_bin() on 32-bitHeinrich Schuchardt
hextoul() cannot convert a string to a 64-bit number on a 32-bit system. Use function hextoull() instead. Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Fixes: 22c48a92cdce ("lib: uuid: supporting building as part of host tools") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> Tested-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-13lib: provide function hextoull()Heinrich Schuchardt
We often convert hexadecimal strings to hextoull(). Provide a wrapper function to simple_strtoull() that does not require specifying the radix. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-12Merge patch series "Enable https for wget"Tom Rini
Ilias Apalodimas <ilias.apalodimas@linaro.org> says: Hi all, This is a respin of [1] adding https support to wget. In short patch#1 enables the crypto algorithms we need in mbedTLS patches#2, #3 enable anf fix the lwIP part we need patch#4 is adding https:// parsing support in our wget patch#5 is making https:// the default for QEMU lwip defconfig so people can easily test and finaly patch#6 updates our documentation [1] https://lore.kernel.org/u-boot/20241024112449.1362319-1-ilias.apalodimas@linaro.org/ Link: https://lore.kernel.org/r/20241110083017.367565-1-ilias.apalodimas@linaro.org
2024-11-12net: lwip: Add Support Server Name Indication supportJavier Tia
SNI, or Server Name Indication, is an addition to the TLS encryption protocol that enables a client device to specify the domain name it is trying to reach in the first step of the TLS handshake, preventing common name mismatch errors and not reaching to HTTPS server that enforce this condition. Since most of the websites require it nowadays add support for it. It's worth noting that this is already sent to lwIP [0] [0] https://github.com/lwip-tcpip/lwip/pull/47 Signed-off-by: Javier Tia <javier.tia@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-12net: lwip: Update lwIP for mbedTLS > 3.0 support and enable httpsJavier Tia
The current code support mbedTLS 2.28. Since we are using a newer version in U-Boot, update the necessary accessors and the lwIP codebase to work with mbedTLS 3.6.0. It's worth noting that the patches are already sent to lwIP [0] While at it enable LWIP_ALTCP_TLS and enable TLS support in lwIP [0] https://github.com/lwip-tcpip/lwip/pull/47 Signed-off-by: Javier Tia <javier.tia@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-12mbedtls: Enable TLS 1.2 supportIlias Apalodimas
Since lwIP and mbedTLS have been merged we can tweak the config options and enable TLS1.2 support. Add RSA and ECDSA by default and enable enough block cipher modes of operation to be comatible with modern TLS requirements and webservers Reviewed-by: Raymond Mao <raymond.mao@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-11lmb: Add basic io_lmb functionalityJanne Grunau
These functions can be used with struct lmb pointers and will be used to manage IOVA space in the apple_dart iommu driver. This restores part of the pointer base struct lmb API from before commit ed17a33fed29 ("lmb: make LMB memory map persistent and global"). io_lmb_add() and io_lmb_free() can trivially reuse exisiting lmb functions. io_lmb_setup() is separate for unique error log messages. io_lmb_alloc() is a simplified copy of _lmb_alloc_base() since the later has unused features and internal use of the global LMB memory map. Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-11lmb: cosmetic: reorder functions and global LMB variableJanne Grunau
Low lovel LMB functionality will be used to manage IOVA space in the Apple dart iommu driver. This reordering ensures that those function can not access the global LMB memory map variable. Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-11lmb: Do not use global LMB variable in _lmb_free()Janne Grunau
It will be re-used with a lmb list pointer as argument for IOVA allocations in the apple_dart iommu driver. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-09efi_loader: Drop sandbox PXE architectureSimon Glass
Rather than returning 0, just return an error, since sandbox is not used with PXE at present. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-09sandbox: Report host default-filename in native modeSimon Glass
When the --native flag is given, pretend to be running the host architecture rather than sandbox. Allow the same control for PXE too. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-09efi_loader: Move get_efi_pxe_arch() to efi_helperSimon Glass
Move this function from the EFI bootmeth to the common efi_helper file. No functional change is intended. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-09efi: Move default filename to a functionSimon Glass
Use a function to obtain the device EFI filename, so that we can control how sandbox behaves. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-09efi_loader: Add a test appSimon Glass
Add a simple app to use for testing. This is intended to do whatever it needs to for testing purposes. For now it just prints a message and exits boot services. There was a considerable amount of discussion about whether it is OK to call exit-boot-services and then return to U-Boot. This is not normally done in a real application, since exit-boot-services is used to completely disconnect from U-Boot. For now, this part is skipped. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-11-09efi_loader: Change efi_dp_from_mem() to use sizeMoritz Fischer
All call sites are using size rather than end addresses, so instead - as previously done - calculating an end address everywhere, just modify the function to use size and internally calculate the end address Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Patrick Wildt <pwildt@google.com> Signed-off-by: Moritz Fischer <moritzf@google.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-11-09lmb: Drop extra 16KB of stack spaceSimon Glass
There is already a defined stack-size which is used to reserve space for the stack. It is confusing to add more in the lmb module, since then the memory map (with meminfo command) seems to have a hole in it. Drop this unnecessary feature. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-03alist: Add a way to efficiently filter an alistSimon Glass
Unlike linked lists, it is inefficient to remove items from an alist, particularly if it is large. If most items need to be removed, then the time-complexity approaches O(n2). Provide a way to do this efficiently, by working through the alist once and copying elements down. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-03alist: Add a function to empty the listSimon Glass
Sometimes it is useful to empty the list without de-allocating any of the memory used, e.g. when the list will be re-populated immediately afterwards. Add a new function for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-03alist: Add for-loop helpersSimon Glass
Add some macros which permit easy iteration through an alist, similar to those provided by the 'list' implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-03alist: Add a way to get the next elementSimon Glass
Add a new function which returns the next element after the one provided, if it exists in the list. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-01Merge patch series "fs: ext4: implement opendir, readdir, closedir"Tom Rini
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says: With this series opendir, readdir, closedir are implemented for ext4. These functions are needed for the UEFI sub-system to interact with the ext4 file system. To reduce code growth the functions are reused to implement the ls command for ext4. A memory leak in ext4fs_exists is resolved. ext4fs_iterate_dir is simplified by removing a redundant pointer copy. Link: https://lore.kernel.org/r/20241026064048.370062-1-heinrich.schuchardt@canonical.com
2024-11-01efi_loader: fix GetInfo and SetInfoHeinrich Schuchardt
* Some of our file system drivers cannot report a file size for directories. Use a dummy value in this case. * For SetInfo the UEFI spec requires to ignore the file size field. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-11-01lmb: remove __maybe_unused from lmb_map_update_notifyHeinrich Schuchardt
Function lmb_map_update_notify() is always referenced. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-11-01acpi_table: Fix coverity defect in acpi_write_spcrPatrick Rudolph
Fix "Integer handling issues (SIGN_EXTENSION)" in newly added code: Cast serial_info.reg_offset to u64 to prevent an integer overflow when shifted too many bits to the left. Currently this never happens as the shift is supposed to be less than 4. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2024-10-31Merge tag 'efi-2025-01-rc2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request efi-2025-01-rc2 Documentation: * include semihosting and K3 boards only once in table of contents * include file-system API into HTML docs * describe struct ext2_inode * update Python requirements UEFI: * mark local functions static * simplify efi_free_pages() * pass correct end address value to efi_dp_from_mem() * fix typos in HII test and eficonfig command
2024-10-31lib: efi_loader: Fix efi_dp_from_mem() callsMoritz Fischer
The function expects an end address but is being called with an size instead. Fixes: 6422820ac3 ("efi_loader: split unrelated code from efi_bootmgr.c") Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Moritz Fischer <moritzf@google.com> Reviewed-by: Patrick Wildt <pwildt@google.com>
2024-10-31efi_loader: Make tcg2_uninit() staticIlias Apalodimas
This function is only used locally, so make it static and quiesce the W=1 warning Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-10-30efi_loader: Remove unused diskidIlias Apalodimas
That variable is defined and assigned a value in two functions but it's never used. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-10-30efi_loader: Mark static functions in smbiosdumpIlias Apalodimas
Mark functions that are only used locally as static and quiesce W=1 warnings Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>