[PATCH v2 14/20] efi: x86: Use the installed SMBIOS tables

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Aug 18 08:50:54 CEST 2023


On Fri, 18 Aug 2023 at 04:19, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
>
>
> Am 18. August 2023 02:26:53 MESZ schrieb Simon Glass <sjg at chromium.org>:
> >U-Boot sets up the SMBIOS tables during startup. Rather than creating a
> >new set, install the existing ones. Rely on the ACPI table's memory-map
> >record to cover the tables.
> >
> >Tidy up the installation-condition code while we are here.
> >
> >Signed-off-by: Simon Glass <sjg at chromium.org>
> >---
> >
> >Changes in v2:
> >- Add new patch

In the ACPI changes, the makefile and code changes are in a single
patch which makes more sense.  Can you squash #15 in this one as well?

Thanks
/Ilias

> >
> > lib/efi_loader/efi_setup.c  | 10 +++++-----
> > lib/efi_loader/efi_smbios.c | 37 +++++++------------------------------
> > 2 files changed, 12 insertions(+), 35 deletions(-)
> >
> >diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> >index ad719afd6328..e6de685e8795 100644
> >--- a/lib/efi_loader/efi_setup.c
> >+++ b/lib/efi_loader/efi_setup.c
> >@@ -326,11 +326,11 @@ efi_status_t efi_init_obj_list(void)
> >               if (ret != EFI_SUCCESS)
> >                       goto out;
> >       }
> >-#ifdef CONFIG_GENERATE_SMBIOS_TABLE
> >-      ret = efi_smbios_register();
> >-      if (ret != EFI_SUCCESS)
> >-              goto out;
> >-#endif
> >+      if (IS_ENABLED(CONFIG_SMBIOS)) {
> >+              ret = efi_smbios_register();
> >+              if (ret != EFI_SUCCESS)
> >+                      goto out;
> >+      }
> >       ret = efi_watchdog_register();
> >       if (ret != EFI_SUCCESS)
> >               goto out;
> >diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c
> >index 306c0bc54f90..0e6454a8fe0b 100644
> >--- a/lib/efi_loader/efi_smbios.c
> >+++ b/lib/efi_loader/efi_smbios.c
> >@@ -20,36 +20,13 @@
> >  */
> > efi_status_t efi_smbios_register(void)
> > {
> >-      /* Map within the low 32 bits, to allow for 32bit SMBIOS tables */
> >-      u64 dmi_addr = U32_MAX;
> >-      efi_status_t ret;
> >-      void *dmi;
> >+      ulong addr;
> >
> >-      /* Reserve 4kiB page for SMBIOS */
> >-      ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
> >-                               EFI_RUNTIME_SERVICES_DATA, 1, &dmi_addr);
> >+      /* space for all tables is marked in efi_acpi_register() */
> >+      addr = gd->arch.smbios_start;
> >+      printf("EFI using SMBIOS tables at %lx\n", addr);
>
> This is should be log_debug() as typically only developers will ever need this address.
>
> Best regards
>
> Heinrich
>
>
> >
> >-      if (ret != EFI_SUCCESS) {
> >-              /* Could not find space in lowmem, use highmem instead */
> >-              ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES,
> >-                                       EFI_RUNTIME_SERVICES_DATA, 1,
> >-                                       &dmi_addr);
> >-
> >-              if (ret != EFI_SUCCESS)
> >-                      return ret;
> >-      }
> >-
> >-      /*
> >-       * Generate SMBIOS tables - we know that efi_allocate_pages() returns
> >-       * a 4k-aligned address, so it is safe to assume that
> >-       * write_smbios_table() will write the table at that address.
> >-       */
> >-      assert(!(dmi_addr & 0xf));
> >-      dmi = (void *)(uintptr_t)dmi_addr;
> >-      if (write_smbios_table(map_to_sysmem(dmi)))
> >-              /* Install SMBIOS information as configuration table */
> >-              return efi_install_configuration_table(&smbios_guid, dmi);
> >-      efi_free_pages(dmi_addr, 1);
> >-      log_err("Cannot create SMBIOS table\n");
> >-      return EFI_SUCCESS;
> >+      /* Install SMBIOS information as configuration table */
> >+      return efi_install_configuration_table(&smbios_guid,
> >+                                             map_sysmem(addr, 0));
> > }


More information about the U-Boot mailing list