[PATCH 2/4] efi: Collect the ACPI tables in the app

Simon Glass sjg at chromium.org
Sun Nov 12 21:01:14 CET 2023


Hi Heinrich,

On Sun, 12 Nov 2023 at 09:22, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 11/12/23 16:58, Simon Glass wrote:
> > Locate these so that they can be displayed using the 'acpi' command.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >   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];
> > +
> > +             if (!memcmp(&tab->guid, &acpi, sizeof(efi_guid_t)))
> > +                     gd_set_acpi_start(map_to_sysmem(tab->table));
> > +     }
>
> Should we have a function efi_get_configuration_table(efi_guid_t *guid)
> that we can use to retrieve different configuration tables?
>
> This would allow us to read the device-tree on non-x86 tables.
>
> We may at some point also be interested in reading the
> EFI_RT_PROPERTIES_TABLE to find out which runtime services we are
> allowed to call.
>
> Or would you prefer to all of this into scan_tables()?

I'm not sure...but perhaps the best approach is to use this function
to find all the tables we are interested in?

BTW I started this series with a view to figuring out what is needed
to make the app boot Linux, etc. It is a bit strange since the boot
services need to be 'passed through' U-Boot to the underlying UEFI.

Regards,
Simon


More information about the U-Boot mailing list