efi: Allow init messages to be optional

Add a 'verbose' argument to efi_init() so that the init messages can be
suppressed if desired.

For now, keep them as they are.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-11-06 15:47:58 +01:00
parent 93ce7858e3
commit dc475d0c11
4 changed files with 10 additions and 7 deletions

View File

@@ -675,10 +675,11 @@ unsigned long efi_get_ram_base(void);
* @banner: Banner to display when starting
* @image: The image handle passed to efi_main()
* @sys_table: The EFI system table pointer passed to efi_main()
* @verbose: true to show messages on startup
* Return: 0 on succcess, EFI error code on failure
*/
int efi_init(struct efi_priv *priv, const char *banner, efi_handle_t image,
struct efi_system_table *sys_table);
struct efi_system_table *sys_table, bool verbose);
/**
* efi_malloc() - Allocate some memory from EFI

View File

@@ -132,7 +132,7 @@ void efi_puts(struct efi_priv *priv, const char *str)
}
int efi_init(struct efi_priv *priv, const char *banner, efi_handle_t image,
struct efi_system_table *sys_table)
struct efi_system_table *sys_table, bool verbose)
{
efi_guid_t loaded_image_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
struct efi_boot_services *boot = sys_table->boottime;
@@ -145,9 +145,11 @@ int efi_init(struct efi_priv *priv, const char *banner, efi_handle_t image,
priv->parent_image = image;
priv->run = sys_table->runtime;
efi_puts(priv, "U-Boot EFI ");
efi_puts(priv, banner);
efi_putc(priv, ' ');
if (verbose) {
efi_puts(priv, "Laceboot EFI ");
efi_puts(priv, banner);
efi_putc(priv, ' ');
}
ret = boot->open_protocol(priv->parent_image, &loaded_image_guid,
(void **)&loaded_image, priv->parent_image,

View File

@@ -433,7 +433,7 @@ efi_status_t efi_startup(efi_handle_t image, struct efi_system_table *systab)
efi_status_t ret;
/* Set up access to EFI data structures */
ret = efi_init(priv, "App", image, systab);
ret = efi_init(priv, "App", image, systab, true);
if (ret) {
printf("Failed to set up U-Boot: err=%lx\n", ret);
return ret;

View File

@@ -207,7 +207,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
/* initially we can use the EFI UART */
use_hw_uart = false;
ret = efi_init(priv, "Payload", image, sys_table);
ret = efi_init(priv, "Payload", image, sys_table, true);
if (ret) {
printhex2(ret);
puts(" efi_init() failed\n");