[PATCH v2 1/3] efi: Collect the ACPI tables in the app

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Nov 21 12:58:57 CET 2023


On 11/12/23 21:55, Simon Glass wrote:
> Locate these so that they can be displayed using the 'acpi' command.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> (no changes since v1)
>
>   lib/efi/efi_app.c | 24 +++++++++++++++++++++---
>   1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c
> index 2209410f35b5..c5eb816655ea 100644
> --- a/lib/efi/efi_app.c
> +++ b/lib/efi/efi_app.c
> @@ -12,18 +12,21 @@
>   #include <cpu_func.h>
>   #include <debug_uart.h>
>   #include <dm.h>
> +#include <efi.h>
> +#include <efi_api.h>
>   #include <errno.h>
>   #include <init.h>
>   #include <malloc.h>
> +#include <sysreset.h>
> +#include <uuid.h>
>   #include <asm/global_data.h>
>   #include <linux/err.h>
>   #include <linux/types.h>
> -#include <efi.h>
> -#include <efi_api.h>
> -#include <sysreset.h>
> +#include <asm/global_data.h>
>   #include <dm/device-internal.h>
>   #include <dm/lists.h>
>   #include <dm/root.h>
> +#include <mapmem.h>
>
>   DECLARE_GLOBAL_DATA_PTR;
>
> @@ -320,6 +323,19 @@ int dm_scan_other(bool pre_reloc_only)
>   	return 0;
>   }
>
> +static void scan_tables(struct efi_system_table *sys_table)
> +{
> +	efi_guid_t acpi = EFI_ACPI_TABLE_GUID;
> +	uint i;
> +
> +	for (i = 0; i < sys_table->nr_tables; i++) {
> +		struct efi_configuration_table *tab = &sys_table->tables[i];

In cmd/bootefi we have a static function get_config_table() I guess we
should export and move it to lib/.

> +
> +		if (!memcmp(&tab->guid, &acpi, sizeof(efi_guid_t)))
> +			gd_set_acpi_start(map_to_sysmem(tab->table));

return; could be added here to shorten the search.

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

> +	}
> +}
> +
>   /**
>    * efi_main() - Start an EFI image
>    *
> @@ -354,6 +370,8 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
>   		return ret;
>   	}
>
> +	scan_tables(priv->sys_table);
> +
>   	/*
>   	 * We could store the EFI memory map here, but it changes all the time,
>   	 * so this is only useful for debugging.



More information about the U-Boot mailing list