aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2024-03-29Merge patch series "Clean up arm linker scripts"Tom Rini
Ilias Apalodimas <ilias.apalodimas@linaro.org> says: The arm linker scripts had a mix of symbols and C defined variables in an effort to emit relative references instead of absolute ones e.g [0]. A linker bug prevented us from doing so [1] -- fixed since 2016. This has led to confusion over the years, ending up with mixed section definitions. Some sections are defined with overlays and different definitions between v7 and v8 architectures. For example __efi_runtime_rel_start/end is defined as a linker symbol for armv8 and a C variable in armv7. Linker scripts nowadays can emit relative references, as long as the symbol definition is contained within the section definition. So let's switch most of the C defined variables and clean up the arm sections.c file. There's still a few symbols remaining -- __secure_start/end, __secure_stack_start/end and __end which can be cleaned up in a followup series. For both QEMU v7/v8 bloat-o-meter shows now size difference $~ ./scripts/bloat-o-meter u-boot u-boot.new add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0) Function old new delta Total: Before=798861, After=798861, chg +0.00% The symbols seem largely unchanged apart from a difference in .bss as well as the emited sections and object types of the affected variables. On the output below the first value is from -next and the second comes from -next + this patchset. The .bss_start/end sections have disappeared from the newer binaries. # For example on QEMU v8: efi_runtime_start 7945: 0000000000000178 0 OBJECT GLOBAL DEFAULT 2 __efi_runtime_start 7942: 0000000000000178 0 NOTYPE GLOBAL DEFAULT 2 __efi_runtime_start efi_runtime_stop 9050: 0000000000000d38 0 OBJECT GLOBAL DEFAULT 2 __efi_runtime_stop 9047: 0000000000000d38 0 NOTYPE GLOBAL DEFAULT 2 __efi_runtime_stop __efi_runtime_rel_start 7172: 00000000000dc2f0 0 OBJECT GLOBAL DEFAULT 10 __efi_runtime_rel_start 7169: 00000000000dc2f0 0 NOTYPE GLOBAL DEFAULT 10 __efi_runtime_rel_start __efi_runtime_rel_stop 7954: 00000000000dc4a0 0 OBJECT GLOBAL DEFAULT 10 __efi_runtime_rel_stop 7951: 00000000000dc4a0 0 NOTYPE GLOBAL DEFAULT 10 __efi_runtime_rel_stop __rel_dyn_start 7030: 00000000000dc4a0 0 OBJECT GLOBAL DEFAULT 11 __rel_dyn_start 7027: 00000000000dc4a0 0 NOTYPE GLOBAL DEFAULT 11 __rel_dyn_start __rel_dyn_end 8959: 0000000000102b10 0 OBJECT GLOBAL DEFAULT 12 __rel_dyn_end 8956: 0000000000102b10 0 NOTYPE GLOBAL DEFAULT 11 __rel_dyn_end image_copy_start 9051: 0000000000000000 0 OBJECT GLOBAL DEFAULT 1 __image_copy_start 9048: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 __image_copy_start image_copy_end 7467: 00000000000dc4a0 0 OBJECT GLOBAL DEFAULT 11 __image_copy_end 7464: 00000000000dc4a0 0 NOTYPE GLOBAL DEFAULT 11 __image_copy_end bss_start 12: 0000000000102b10 0 SECTION LOCAL DEFAULT 12 .bss_start 8087: 0000000000000018 0 NOTYPE GLOBAL DEFAULT 1 _bss_start_ofs 8375: 0000000000102b10 0 OBJECT GLOBAL DEFAULT 12 __bss_start 8084: 0000000000000018 0 NOTYPE GLOBAL DEFAULT 1 _bss_start_ofs 8372: 0000000000102b10 0 NOTYPE GLOBAL DEFAULT 12 __bss_start bss_end 14: 000000000010bc30 0 SECTION LOCAL DEFAULT 14 .bss_end 7683: 000000000010bc30 0 OBJECT GLOBAL DEFAULT 14 __bss_end 8479: 0000000000000020 0 NOTYPE GLOBAL DEFAULT 1 _bss_end_ofs 7680: 000000000010bbb0 0 NOTYPE GLOBAL DEFAULT 12 __bss_end 8476: 0000000000000020 0 NOTYPE GLOBAL DEFAULT 1 _bss_end_ofs # For QEMU v7: efi_runtime_start 10703: 000003bc 0 OBJECT GLOBAL DEFAULT 2 __efi_runtime_start 10699: 000003c0 0 NOTYPE GLOBAL DEFAULT 2 __efi_runtime_start efi_runtime_stop 11796: 000012ec 0 OBJECT GLOBAL DEFAULT 2 __efi_runtime_stop 11792: 000012ec 0 NOTYPE GLOBAL DEFAULT 2 __efi_runtime_stop __efi_runtime_rel_start 9937: 000c40dc 0 OBJECT GLOBAL DEFAULT 8 __efi_runtime_rel_start 9935: 000c40dc 0 NOTYPE GLOBAL DEFAULT 9 __efi_runtime_rel_start __efi_runtime_rel_stop 10712: 000c41dc 0 OBJECT GLOBAL DEFAULT 10 __efi_runtime_rel_stop 10708: 000c41dc 0 NOTYPE GLOBAL DEFAULT 9 __efi_runtime_rel_stop __rel_dyn_start 9791: 000c41dc 0 OBJECT GLOBAL DEFAULT 10 __rel_dyn_start 9789: 000c41dc 0 NOTYPE GLOBAL DEFAULT 10 __rel_dyn_start __rel_dyn_end 11708: 000da5f4 0 OBJECT GLOBAL DEFAULT 10 __rel_dyn_end 11704: 000da5f4 0 NOTYPE GLOBAL DEFAULT 10 __rel_dyn_end image_copy_start 448: 0000177c 0 NOTYPE LOCAL DEFAULT 3 _image_copy_start_ofs 11797: 00000000 0 OBJECT GLOBAL DEFAULT 1 __image_copy_start 445: 0000177c 0 NOTYPE LOCAL DEFAULT 3 _image_copy_start_ofs 11793: 00000000 0 NOTYPE GLOBAL DEFAULT 1 __image_copy_start image_copy_end 450: 00001780 0 NOTYPE LOCAL DEFAULT 3 _image_copy_end_ofs 10225: 000c41dc 0 OBJECT GLOBAL DEFAULT 10 __image_copy_end 447: 00001780 0 NOTYPE LOCAL DEFAULT 3 _image_copy_end_ofs 10222: 000c41dc 0 NOTYPE GLOBAL DEFAULT 10 __image_copy_end bss_start 11: 000c41dc 0 SECTION LOCAL DEFAULT 11 .bss_start 11124: 000c41dc 0 OBJECT GLOBAL DEFAULT 11 __bss_start 11120: 000c41dc 0 NOTYPE GLOBAL DEFAULT 11 __bss_start bss_end 13: 000cbbf8 0 SECTION LOCAL DEFAULT 13 .bss_end 10442: 000cbbf8 0 OBJECT GLOBAL DEFAULT 13 __bss_end 10439: 000cbbf8 0 NOTYPE GLOBAL DEFAULT 11 __bss_end It's worth noting that since the efi regions are affected by the change, booting with EFI is preferable while testing. Booting the kernel only should be enough since the efi stub and the kernel proper do request boottime and runtime services respectively. Something along the lines of > virtio scan && load virtio 0 $kernel_addr_r Image && bootefi $kernel_addr_r will work for QEMU aarch64. Tested platforms: - QEMU aarch64 - Xilinx kv260 kria starter kit & zynq - QEMU armv7 - STM32MP157C-DK2 [0] commit 3ebd1cbc49f0 ("arm: make __bss_start and __bss_end__ compiler-generated") [1] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object")
2024-03-29arm: fix __efi_runtime_rel_start/end definitionsIlias Apalodimas
__efi_runtime_rel_start/end are defined as c variables for arm7 only in order to force the compiler emit relative references. However, defining those within a section definition will do the same thing since [0]. On top of that the v8 linker scripts define it as a symbol. So let's remove the special sections from the linker scripts, the variable definitions from sections.c and define them as a symbols within the correct section. [0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object") Suggested-by: Sam Edwards <CFSworks@gmail.com> Reviewed-by: Sam Edwards <CFSworks@gmail.com> Tested-by: Sam Edwards <CFSworks@gmail.com> # Binary output identical Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-03-27smbios: fill wake-up typeHeinrich Schuchardt
We should not use the reserved value 0x00 for the wake up type but use 0x02 (Unknown). Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-03-27acpi: rename aslc_id, aslc_revisionHeinrich Schuchardt
The fields Creator ID and Creator Revision contain information about the tool that created an ACPI table. This may be the ASL compiler for some tables but it is not for others. Naming these fields aslc_id and aslc_revision is misleading. It is usual to see diverse values of Creator ID. On a laptop I saw these: 'AMD ', 'INTL, 'MSFT', 'PTEC'. Obviously not all relate to the Intel ASL compiler. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-03-25Merge tag 'v2024.04-rc5' into nextTom Rini
Prepare v2024.04-rc5
2024-03-21efi_loader: correct handling of EFI binary return codeHeinrich Schuchardt
We should not try to remove protocol interfaces from a NULL handle. efi_run_image() should always return the return code of the executed EFI binary. Fixes: 6422820ac3e5 ("efi_loader: split unrelated code from efi_bootmgr.c") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-03-21efi_selftest: Update StrToFat() unit test after CP473 map extensionJanne Grunau
Test that Unicode code points which map to CP437 code points 1-31 are converted to '_'. This ensures no FAT file names do not contain chars which are control characters in other code pages (CP 1250 for example). Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-03-21efi_selftest: Add geometric shapes character selftestJanne Grunau
Draw symbols from Unicode's "Geometric shapes" page which translate to code page 437 code points 1-31. These are used by UEFI applications to draw user interfaces using EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL. The output has to be checked manually on the screen for correctness. Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-03-21efi_selftest: Add box drawing character selftestAndre Przywara
UEFI applications rely on Unicode output capability, and might use that for drawing pseudo-graphical interfaces using Unicode defined box drawing characters. Add a simple test to display the most basic box characters, which would need to be checked manually on the screen for correctness. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-03-21efi_selftest: Add international characters testAndre Przywara
UEFI relies entirely on unicode output, which actual fonts displayed on the screen might not be ready for. Add a test displaying some international characters, to reveal missing glyphs, especially in our builtin fonts. This would be needed to be manually checked on the screen for correctness. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-03-21lib/charset: Map Unicode code points to CP437 code points 1-31Janne Grunau
Code page 437 uses code points 1-31 for glyphs instead of control characters. Map the appropriate Unicode code points to this code points. Fixes rendering of grub2's menu as EFI application using the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on a console with bitmap fonts. Signed-off-by: Janne Grunau <j@jannau.net>
2024-03-19Merge tag 'u-boot-socfpga-next-20240319' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-socfpga into next - A new driver in the misc to register setting from device tree. This also provides user a clean interface and all register settings are centralized in one place, device tree. - Enable Agilex5 platform for Intel product. Changes, modification and new files are created for board, dts, configs and makefile to create the base for Agilex5. Build-tested on SoC64 boards, boot tested on some of them.
2024-03-13initcall: break loop immediately on failureCaleb Connolly
The current ordering always results in func pointing to the next function in the init_sequence. e.g. if fdtdec_setup() fails, ret will be set to the error code, then func will be updated to point to initf_malloc(), only then is ret checked and the loop broken. The end result of this is that the "initcall failed at ..." error will point you to initf_malloc(), when the error actually occured in fdtdec_setup()! This can be quite confusing and result in a lot of time wasted debugging code that has nothing to do with the failure (ask me how I know :P). Adjust the for loop to check ret immediately after the call and break early so that func will correctly reference the failed function. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
2024-03-13efi_loader: Don't carve out memory reservations too earlyMark Kettenis
Moving the efi_carve_out_dt_rsv() call in commit 1be415b21b2d ("efi_loader: create memory reservations in ACPI case") broke boards that create additional memory reservations in ft_board_setup() since it is now called before those additional memory reservations are made. This is the case for the rk3588 boards and breaks booting OpenBSD on those boards. Move the call back to its original location and add a call in the code path used for ACPI. Fixes: 1be415b21b2d ("efi_loader: create memory reservations in ACPI case") Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-03-07Check curve_name for null to avoid crashBob Wolff
If mixed rsa and ecdsa keys are specified in dtsi, an rsa key can be sent into the ecdsa verify. Without the ecdsa,curve property, this function will crash due to lack of checking the null pointer return. Signed-off-by: Bob Wolff <bob.wolff68@gmail.com>
2024-02-28efi_driver: provide SBI based runtime system resetHeinrich Schuchardt
On RISC-V systems system the Supervisory Binary Interface provides system reset and poweroff. Use it at EFI runtime. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-02-12efi_loader: simplify error message in efi_disk_create_raw()Heinrich Schuchardt
The error message Adding disk for usb_mass_storage.lun0 failed (err=-9223372036854775788/0x8000000000000014) provides a decimal and a hexadecimal notation of the EFI status code EFI_ALREADY_STARTED which is defined as (EFI_ERROR_MASK | 20). The decimal output does not convey the value 20 clearly. With the patch we write Adding block device usb_mass_storage.lun0 failed, r = 20 similar to other EFI error messages. Fixes: 952018117ab4 ("dm: sandbox: Switch over to using the new host uclass") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-02-09lib: sparse: Fix error checking for write_sparse_chunk_rawSean Anderson
The return value of write_sparse_chunk_raw is unsigned, so the existing check has no effect. Use IS_ERR_VALUE to detect error instead, which is what write_sparse_chunk_raw does itself. Fixes: 62649165cb0 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/u-boot/1b323ec3-59b0-490b-a2f0-fd961dafcf49@moroto.mountain/ Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20240201181851.221701-1-sean.anderson@seco.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-02-02smbios: correctly name Structure Table Maximum Size fieldHeinrich Schuchardt
In the SMBIOS 3 entry point the Structure Table Maximum Size field was incorrectly named max_struct_size. A Maximum Structure Size field only exists in the SMBIOS 2.1 entry point and has a different meaning. Call the Structure Table Length field table_maximum_size. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-02-02smbios: do not determine maximum structure sizeHeinrich Schuchardt
Only the SMBIOS 2.1 entry point has a field for the maximum structure size. As we have switched to an SMBIOS 3 entry point remove the superfluous calculation. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-02-02smbios: correctly fill chassis handleHeinrich Schuchardt
The chassis handle field in the type 2 structure must point to the handle of the type 3 structure. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-02-02smbios: if a string value is unknown, use string number 0Heinrich Schuchardt
The SMBIOS specification describes: "If a string field references no string, a null (0) is placed in that string field." Accordingly we should avoid writing a string "Unknown" to the SMBIOS table. dmidecode displays 'Not Specified' if the string number is 0. Commit 00a871d34e2f ("smbios: empty strings in smbios_add_string()") correctly identified that strings may not have length 0 as two consecutive NULs indentify the end of the string list. But the suggested solution did not match the intent of the SMBIOS specification. Fixes: 00a871d34e2f ("smbios: empty strings in smbios_add_string()") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-02-02smbios: Fix table when no string is presentMatthias Brugger
When no string is present in a table, next_ptr points to the same location as eos. When calculating the string table length, we would only reserve one \0. By spec a SMBIOS table has to end with two \0\0 when no strings a present. Signed-off-by: Matthias Brugger <mbrugger@suse.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-02-02smbios: get_str_from_dt() - add sysinfo_id descriptionHeinrich Schuchardt
Add description for parameter sysinfo_id of function get_str_from_dt(). Fixes: 07c9e683a484 ("smbios: Allow a few values to come from sysinfo") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-02-02lib: smbios_entr() use logical or for booleansHeinrich Schuchardt
As a matter of programming style use logical or to combine two boolean results. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-29efi_loader: check efi_get_variable_int return valueMasahisa Kojima
efi_get_variable_int() may fail, the buffer should be cleared before using it. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Addresses-Coverity-ID: 478333 ("Error handling issues")
2024-01-29efi_loader: replace find_smbios_table by library functionHeinrich Schuchardt
The code in find_smbios_table() is redundant to efi_get_configuration_table(). Replace it. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-29efi_loader: export efi_get_configuration_tableHeinrich Schuchardt
In multiple places we need a function to find an EFI configuration table. Rename get_config_table() to efi_get_configuration_table() and export it. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-29efi_selftest: add missing line feed in efi_selftest_miniapp_exitHeinrich Schuchardt
If an error occurs we may see an output like: EFI application calling Exit Could not open loaded image protocolLoaded image protocol missing Add the missing line feed. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-26lib: support SMBIOS3 table in uuid_guid_get_str()Heinrich Schuchardt
As we support installing SMBIOS3 tables in U-Boot we need to add this GUID to the translation table used buy uuid_guid_get_str(). Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2024-01-26efi_loader: migrate SMBIOS 3.0 entry point structure for measurementMasahisa Kojima
Current U-Boot only supports the SMBIOS 3.0 entry point structure. TCG2 measurement code should migrate to SMBIOS 3.0 entry point structure. efi_selftest tcg2 test also needs to be updated, and expected PCR[1] result is changed since guid for SMBIOS EFI system table uses different guid SMBIOS3_TABLE_GUID instead of SMBIOS_TABLE_GUID. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-24lib: add comment in utf8_to_utf32_stream()Heinrich Schuchardt
The logic of utf8_to_utf32_stream() is not easy to understand. Add a comment. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-21efi_loader: return immediately in UCLASS_EFI_LOADER removalMasahisa Kojima
In case of UCLASS_EFI_LOADER, EFI handles are managed by EFI application/driver, we must not delete EFI handles. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-21efi_loader: create common function to free struct efi_disk_objMasahisa Kojima
Current error handling of creating raw disk/partition has following issues. - duplicate free for EFI handle, EFI handle is already freed in efi_delete_handle() - missing free for struct efi_device_path and struct efi_simple_file_system_protocol in some error paths To address those issues, this commit creates the common function to free the struct efi_disk_obj resources and calls it in case of error. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-21efi_loader: avoid pointer access after calling efi_delete_handleMasahisa Kojima
efi_delete_handle() calls efi_purge_handle(), then it finally frees the EFI handle. Both diskobj and handle variables in efi_disk_remove() have the same pointer, we can not access diskobj->dp after calling efi_delete_handle(). This commit saves the struct efi_device_path pointer before calling efi_delete_handle(). This commit also fixes the missing free for volume member in struct efi_disk_obj. This commit also removes the container_of() calls, and adds the TODO comment of missing efi_close_protocol() call for the parent EFI_BLOCK_IO_PROTOCOL. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-21efi_loader: auto-generate removable media boot option firstMasahisa Kojima
This commit auto-generates the boot option for removable block io devices followed by fixed block io devices. This is what EDK II reference implementation does. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-21efi_loader: auto-generate boot option for each blkio deviceMasahisa Kojima
Current efibootmgr auto-generates the boot option for all disks and partitions installing EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, while EDK II reference implementation auto-generates the boot option for all devices installing EFI_BLOCK_IO_PROTOCOL with eliminating logical partitions. This commit modifies the efibootmgr to get aligned to EDK II. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-21efi_loader: rename check_disk_has_default_file functionMasahisa Kojima
check_disk_has_default_file() function checks if the architecture-specific default file exists on the block device, and fills the default file device path if it exists. Rename the function name to fill_default_file_path(). Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-18smbios: fix matching issues for table typesIlias Apalodimas
commit 738b34668f28 ("smbios: Fallback to the default DT if sysinfo nodes are missing") allowed the code to fallback and fill in SMBIOS tables with properties from the compatible and product nodes of the DT, in case the 'smbios,sysinfo' node is missing. That works fine for Type1/2 tables, but for other types we need to match the smbios,sysinfo subnode name as well. So add it to the smbios_ctx and check it during the sysinfo <-> DT mathcing Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-18smbios: shorten sysinfo_str declarations and useIlias Apalodimas
sysinfo_str is a bit too long and makes indentation weird. Shorten it to si_str. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-18smbios: buffer overflow when zeroing entry pointHeinrich Schuchardt
A SMBIOS 3 entry point has a different length than an SMBIOS 2.1 entry point. Fixes: 70924294f375 ("smbios: Use SMBIOS 3.0 to support an address above 4GB") Fixes: 1c5f6fa3883d ("smbios: Drop support for SMBIOS2 tables") Addresses-Coverity-ID: 477212 ("Wrong sizeof argument") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-18lib: rsa: Allow legacy URI specification without "pkcs11:"Csókás Bence
But emit a warning for it. Then we can remove support when everyone had time to update their scripts, docs, CI etc. Fixes: ece85cc020 rsa: use pkcs11 uri as defined in rfc7512 Signed-off-by: Csókás Bence <csokas.bence@prolan.hu>
2024-01-18lib: rsa: Fix PKCS11 URI if one is not given in `keydir`Csókás Bence
If `keydir` is not present, we need to build a PKCS11 URI from just the key name. In this case, we *do* need 'pkcs11:' Fixes: ece85cc020 rsa: use pkcs11 uri as defined in rfc7512 Signed-off-by: Csókás Bence <csokas.bence@prolan.hu>
2024-01-17Merge tag 'efi-2024-04-rc1-2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-efi Documentation: * add generated index to table of contents * create index entries for commands * update Python packages used to build the documentation * fix typos in dfu documentation UEFI: * split unrelated code from efi_bootmgr.c * rename CONFIG_BOOTEFI_BOOTMGR to CONFIG_EFI_BOOTMGR * net: tftp: remove explicit EFI configuration dependency * fs: remove explicit EFI configuration dependency Other: * Add Goldfish RTC driver and make it available on RISC-V QEMU
2024-01-17efi_loader: rename BOOTEFI_BOOTMGR to EFI_BOOTMGRAKASHI Takahiro
At this point, EFI boot manager interfaces is fully independent from bootefi command. So just rename the configuration parameter. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-01-17efi_loader: split unrelated code from efi_bootmgr.cAKASHI Takahiro
Some code moved from cmd/bootefi.c is actually necessary only for "bootefi <addr>" command (starting an image manually loaded by a user using U-Boot load commands or other methods (like JTAG debugger). The code will never been opted out as unused code by a compiler which doesn't know how EFI boot manager is implemented. So introduce a new configuration, CONFIG_EFI_BINARY_EXEC, to enforce them opted out explicitly. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2024-01-16lib: smbios: remove redundant next_header()Heinrich Schuchardt
next_header() and get_next_header() only differ in how the const attribute is used. One function taking a const parameter and returning a non-const is good enough. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-16smbios: copy QEMU tablesHeinrich Schuchardt
QEMU provides SMBIOS tables with detailed information. We should not try to replicate them in U-Boot. If we want to inform about U-Boot, we can add a Firmware Inventory Information (type 45) table in future. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-01-13efi_loader: support fmp versioning for multi bank updateMasahisa Kojima
This commit stores the firmware version into the array of fmp_state structure to support the fmp versioning for multi bank update. The index of the array is identified by the bank index. This modification keeps the backward compatibility with the existing versioning feature. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-13fwu: fix fwu_get_image_index interfaceMasahisa Kojima
The capsule update uses the DFU framework for updating storage. fwu_get_image_index() currently returns the image_index calculated by (dfu_alt_num + 1), but this is different from the image_index in UEFI terminology. Since capsule update implementation calls dfu_write_by_alt function, it is better that FWU returns the dfu_alt_num. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>