[PATCH] boot/bootfdt: Add smbios3-entrypoint to FDT for non-EFI boots

Ilias Apalodimas ilias.apalodimas at linaro.org
Wed Nov 12 09:54:51 CET 2025


Hi Adriana,

I agree with Tom that we should pull a version of this once the spec
changes are merged

>
> +/**
> + * board_fdt_chosen_smbios - boards may override this function to provide
> + *                           specific SMBIOS address
> + */
> +__weak phys_addr_t board_fdt_chosen_smbios(void)
> +{
> +       phys_addr_t ret = 0;
> +       const struct smbios3_entry *entry;
> +
> +       /* Only provide SMBIOS address if EFI is not enabled */
> +       if (IS_ENABLED(CONFIG_EFI_LOADER))
> +               return 0;
> +
> +       /* Only proceed if SMBIOS support is compiled in */
> +#if defined(CONFIG_SMBIOS) || defined(CONFIG_GENERATE_SMBIOS_TABLE)

IS_ENABLED() is the preferred macro instead of ifdefs. Also
CONFIG_GENERATE_SMBIOS_TABLE depends on CONFIG_SMBIOS.

> +       ret = gd->arch.smbios_start;
> +       if (!ret)
> +               return 0;
> +
> +       /* Verify this is SMBIOS 3 */
> +       entry = (struct smbios3_entry *)(uintptr_t)ret;
> +
> +       /* Check for "_SM3_" signature */
> +       if (memcmp(entry->anchor, "_SM3_", 5) != 0) {
> +               printf("SMBIOS: Not version 3, skipping DTB injection\n");
> +               return 0;
> +       }
> +
> +       /* Verify entry point length and version */
> +       if (entry->length < sizeof(struct smbios3_entry)) {
> +               printf("SMBIOS: Invalid entry length %d\n", entry->length);
> +               return 0;
> +       }
> +
> +       printf("SMBIOS: Found version %d.%d at 0x%llx\n",
> +              entry->major_ver, entry->minor_ver, (u64)ret);
> +#endif /* CONFIG_SMBIOS || CONFIG_GENERATE_SMBIOS_TABLE */
> +
> +       return ret;
> +}
> +
>  int fdt_chosen(void *fdt)
>  {
>         struct abuf buf = {};
>         int   nodeoffset;
>         int   err;
>         const char *str;                /* used to set string properties */
> +       phys_addr_t smbiosaddr; /* SMBIOS table address */
>
>         err = fdt_check_header(fdt);
>         if (err < 0) {
> @@ -387,6 +429,19 @@ int fdt_chosen(void *fdt)
>                 return err;
>         }
>
> +       /* Inject SMBIOS address when we have a valid address.
> +        * This is useful for systems using booti/bootm instead of bootefi.
> +        */
> +       smbiosaddr = board_fdt_chosen_smbios();
> +       if (smbiosaddr) {
> +               err = fdt_setprop_u64(fdt, nodeoffset, "linux,smbios3-entrypoint",
> +                                     smbiosaddr);
> +               if (err < 0) {
> +                       printf("WARNING: could not set linux,smbios3-entrypoint %s.\n",
> +                              fdt_strerror(err));

The errors are treated as fatal and return without running
fdt_fixup_stdout(). Arguably some of the errors should be fatal -- e.g
failing to set bootargs, while others shouldn't and only produce a
warning, like setting the rng-seed.
IMHO SMBIOS is fine and we should only print a warning, just making
sure that everyone is ok with that.

> +               }
> +       }
> +
>         return fdt_fixup_stdout(fdt, nodeoffset);
>  }
>
[...]

Thanks
/Ilias


More information about the U-Boot mailing list