Commit graph

84727 commits

Author SHA1 Message Date
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
a9f20ef37a efi_loader: provide definition for efi_add_known_memory()
We should provide a definition in an include for efi_add_known_memory().

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
60e3fedc64 efi_loader: add definition for efi_main()
U-Boot provides multiple EFI applications. The entry point is called
efi_main(). Provide a definition for this function. This avoids
build warnings like

    lib/efi_loader/initrddump.c:468:21: warning:
    no previous prototype for ‘efi_main’ [-Wmissing-prototypes]
      468 | efi_status_t EFIAPI efi_main(efi_handle_t image_handle,
          |                     ^~~~~~~~

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
4db17a4b12 efi_loader: fix struct efi_input_key
The UEFI specification defines filed UnicodeChar as CHAR16. We use
u16 for CHAR16 throughout our code. The change fixes the following errors:

    lib/efi_loader/initrddump.c: In function ‘efi_input’:
    lib/efi_loader/initrddump.c:218:38: warning:
    comparison is always false due to limited range of data type
    [-Wtype-limits]
      218 | if (key.unicode_char >= 0xD800 && key.unicode_char <= 0xDBFF)
          |                      ^~
    lib/efi_loader/initrddump.c:218:68: warning:
    comparison is always true due to limited range of data type
    [-Wtype-limits]
      218 | if (key.unicode_char >= 0xD800 && key.unicode_char <= 0xDBFF)
          |                                                    ^~

Fixes: 867a6ac86d ("efi: Add start-up library code")
Reported-by: Marek Vasut <marex@denx.de>
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
Heinrich Schuchardt
8925f0ee7e efi_loader: enable eficonfig command by default
The eficonfig command is required to set boot options.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:40 +01:00
Heinrich Schuchardt
75d494df01 cmd: CONFIG_CMD_EFICONFIG requires CONFIG_MENU
The eficonfig command invokes functions implemented in common/menu.c like

* menu_default_set()
* menu_get_choice()
* menu_destroy()
* menu_item_add()

Fixes: 87d791423a ("eficonfig: menu-driven addition of UEFI boot option")
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-02-10 13:05:39 +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
Masahisa Kojima
1f0583beeb eficonfig: set EFICONFIG_ENTRY_NUM_MAX to INT_MAX - 1
eficonfig_append_menu_entryi() accepts the number of entries
less than or equal to EFICONFIG_ENTRY_NUM_MAX.
EFICONFIG_ENTRY_NUM_MAX is currently set as INT_MAX, so
the invalid menu count check(efi_menu->count > EFICONFIG_ENTRY_NUM_MAX)
in eficonfig_process_common() is always false.

This commit sets EFICONFIG_ENTRY_NUM_MAX to (INT_MAX - 1).

Reported-by: Coverity (CID 435659)
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:39 +01:00
Masahisa Kojima
88df36346c eficonfig: CTRL+S to save the boot order
The change boot order menu in eficonfig can have at most INT_MAX lines
and it is troublesome to scroll down to the "Save" entry.

This commit assigns CTRL+S to save the boot order.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:39 +01:00
Masahisa Kojima
45f5319fa6 menu: remove CTRL+C to quit
On the sandbox called without "--terminal raw" CTRL+C leaves U-Boot,
"ESC/CTRL+C to quit" is misleading.

Let's remove CTRL+C to quit key handling from bootmenu and eficonfig menu.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10 13:05:39 +01:00
Masahisa Kojima
1dd705cf99 efi: use 32-bit alignment for efi_guid_t
Current U-Boot implements 64-bit boundary for efi_guid_t structure.
It follows the UEFI specification, page 21 of the UEFI Specification v2.10
says about EFI_GUID:
  128-bit buffer containing a unique identifier value. Unless
  otherwise specified, aligned on a 64-bit boundary.

On the other hand, page 163 of the UEFI specification v2.10 and
EDK2 reference implementation both define EFI_GUID as
struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied
alignment is 32-bit not 64-bit like U-Boot efi_guid_t.

Due to this alignment difference, EDK2 application "CapsuleApp.efi -P"
does not work as expected.
This calls EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo()
and dump the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure,
offsetof(EFI_FIRMWARE_IMAGE_DESCRIPTOR, ImageTypeId) is different,
8 in U-Boot and 4 in EDK2(CapsuleApp.efi).
Here is the wrong EFI_GUID dump.
  wrong dump : ImageTypeId - 00000000-7D83-058B-D550-474CA19560D8
  expected   : ImageTypeId - 058B7D83-50D5-4C47-A195-60D86AD341C4

EFI_FIRMWARE_IMAGE_DESCRIPTOR structure is defined in UEFI specification:
  typedef struct {
          UINT8 ImageIndex;
          EFI_GUID ImageTypeId;
          UINT64 ImageId
          <snip>

  } EFI_FIRMWARE_IMAGE_DESCRIPTOR;

There was the relevant patch for linux kernel to use 32-bit alignment
for efi_guid_t [1].
U-Boot should get aligned to EDK2 reference implementation and
linux kernel.

Due to this alignment change, efi_hii_ref structure in include/efi_api.h
is affected, but it is not used in the current U-Boot code.

[1] https://lore.kernel.org/all/20190202094119.13230-5-ard.biesheuvel@linaro.org/

Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-02-10 13:05:39 +01:00
Simon Glass
8ad7cfec37 doc: Link to some useful talks
Talks are a great way to learn about U-Boot and have been lost now that
the Denx Wiki has gone away.

These are stored at elinux.org so link to that .

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
2023-02-10 13:05:39 +01:00
Heinrich Schuchardt
67835c2090 doc: complete setexpr configuration information
Add missing information to the configuration section of the setexpr
man-page.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-10 13:05:39 +01:00
Heinrich Schuchardt
fe34e163e0 cmd: improve coninfo output formatting
Device name are typically longer than 8 characters. This leads to ragged
output.
Only the I and O bit of the device flags are of interest for the user.
Writing a hexadecimal number is just confusing.

Before the patch the output looked like this:

    => coninfo
    List of available devices:
    pl011@9000000 00000007 IO stdin stdout stderr
    serial   00000003 IO
    usbkbd   00000001 I.

With the patch the output looks like this:

    => coninfo
    List of available devices
    |-- pl011@9000000 (IO)
    |   |-- stdin
    |   |-- stdout
    |   |-- stderr
    |-- serial (IO)
    |-- usbkbd (I)

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-10 13:05:39 +01:00
Heinrich Schuchardt
eeb55254dd buildman: invalid reference to README
The readme file for buildman is called buildman.rst.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-10 13:05:39 +01:00
Simon Glass
93e2ce496e Correct SPL use of FSL_MC_ENET
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_FSL_MC_ENET defined in Kconfig

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

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

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

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
64d6bfb660 Correct SPL uses of FASTBOOT_FLASH
This converts 3 usages of this option to the non-SPL form, since there is
no SPL_FASTBOOT_FLASH defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-02-09 16:32:26 -05:00
Simon Glass
418f2173b1 Correct SPL use of EXYNOS7420
This converts 1 usage of this option to the non-SPL form, since there is
no SPL_EXYNOS7420 defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05: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
b2561c5bea Correct SPL uses of ENV_VARS_UBOOT_RUNTIME_CONFIG
This converts 4 usages of this option to the non-SPL form, since there is
no SPL_ENV_VARS_UBOOT_RUNTIME_CONFIG defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
821d1df52a Correct SPL uses of ENV_IS_IN_UBI
This converts 2 usages of this option to the non-SPL form, since there is
no SPL_ENV_IS_IN_UBI 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
71aa806d5d Correct SPL uses of EFI_HAVE_CAPSULE_SUPPORT
This converts 13 usages of this option to the non-SPL form, since there is
no SPL_EFI_HAVE_CAPSULE_SUPPORT 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
Simon Glass
299cca0e72 Correct SPL uses of DWC_ETH_QOS
This converts 3 usages of this option to the non-SPL form, since there is
no SPL_DWC_ETH_QOS defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
866ec874f5 Correct SPL uses of DTB_RESELECT
This converts 2 usages of this option to the non-SPL form, since there is
no SPL_DTB_RESELECT defined in Kconfig

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

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

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
7c31107249 Correct SPL uses of CPU_MICROBLAZE
This converts 2 usages of this option to the non-SPL form, since there is
no SPL_CPU_MICROBLAZE defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
93bb62abaf Correct SPL uses of CMD_USB
This converts 8 usages of this option to the non-SPL form, since there is
no SPL_CMD_USB defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
b15a4af810 Correct SPL uses of CMD_TFTPPUT
This converts 3 usages of this option to the non-SPL form, since there is
no SPL_CMD_TFTPPUT defined in Kconfig

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

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

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

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
04e7493c4a Correct SPL uses of CMD_SF
This converts 2 usages of this option to the non-SPL form, since there is
no SPL_CMD_SF defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00
Simon Glass
b8ed1a82d0 Correct SPL uses of CMD_SCSI
This converts 2 usages of this option to the non-SPL form, since there is
no SPL_CMD_SCSI defined in Kconfig

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

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09 16:32:26 -05:00