[PATCH] smbios: Try CONFIG_SYS_ options before using "Unknow" as a value

Simon Glass sjg at chromium.org
Tue Jul 6 17:21:41 CEST 2021


Hi Ilias,

On Mon, 5 Jul 2021 at 11:31, Ilias Apalodimas
<ilias.apalodimas at linaro.org> wrote:
>
> Simon, Bin,
>
> As Heinrich points out some of the CONFIG_SYS_* values are not representing
> the devices properly. Maybe it's a better idea to only check the .dts?
> If the values are missing we can pop a runtime warning and keep using
> 'Unknown'.

I think we should pick one of two options:

1. Fail if we don't have the info
2. Try to use CONFIG_SYS_... as the old code did

As mentioned earlier, I actually prefer 1, since then it means boards
must add the info in the DT (probably) which indicates that someone
has actually thought about it.

But if we go with 2, we may as well go all the way, and use all the
info at our disposal.

>
> On Mon, Jul 05, 2021 at 09:29:57AM -0600, Simon Glass wrote:
> > On Mon, 5 Jul 2021 at 02:49, Ilias Apalodimas
> > <ilias.apalodimas at linaro.org> wrote:
> > >
> > > SMBIOS entries for manufacturer and board can't be empty, as the spec
> > > explicitly requires a value.
> > > Instead of passing "Unknown" and "Unknown product" for the manufacturer and
> > > product name if the .dts options are missing, try to use CONFIG_SYS_VENDOR
> > > and CONFIG_SYS_BOARD respectively.  If those are not found either warn the
> > > user at runtime and use "Unknown" for both entries.
> > >
> > > Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> > > ---
> > >  lib/smbios.c | 14 ++++++++------
> > >  1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg at chromium.org>
> >
> > I'm not quite sure what this is based on, but perhaps the code changed
> > without me noticing.
> >
> > How about adding some tests for this code?
>
> How? The only valid test we can do is that the values we expect are not "".
> But as the code is right now it will always replace "" with "Unknown"

I just mean we need unit tests for generation of smbios tables....it
is complicated enough.

Regards,
Simon


More information about the U-Boot mailing list