[SeaBIOS] [SeaBIOS v2 PATCH] SMBIOS: Check for full tables & entry point in fw_cfg

Kevin O'Connor kevin at koconnor.net
Sat Apr 12 17:56:08 CEST 2014

On Fri, Apr 11, 2014 at 12:42:52PM -0400, Gabriel L. Somlo wrote:
> Check fw_cfg for the presence of a complete set of smbios tables
> (etc/smbios/smbios-tables), and an entry point structure
> (etc/smbios/smbios-anchor). If found, we no longer build smbios
> tables locally; instead, we replace only the type 0 table with a
> default of our own, and (re)calculate only the minimum set of
> necessary fields from the provided entry point.

Thanks for looking at this.

> diff --git a/src/fw/smbios.c b/src/fw/smbios.c
> index 0ac9ff5..b38d199 100644
> --- a/src/fw/smbios.c
> +++ b/src/fw/smbios.c

I'd prefer to add this code to src/fw/paravirt.c and
src/fw/biostables.c instead of src/fw/smbios.c.  That way, the
smbios.c file is limited to the legacy smbios generation and we can
more clearly document that the whole file is deprecated.

> +    /* rip out any type 0 tables we may have received */

I think we should make the type0 table replacement optional.
Something like:

    void *anchor, *tables = ... from qemu ...;
    if (romfile_loadint("etc/update-smbios-type0", 0)) {
        ... do update to tables ...
    copy_smbios(anchor, tables);

QEMU currently has command-line options that can modify the fields of
the type0 tables (-smbios type=0,vendor='foo').  To continue to
support that, I think QEMU should be able to build the type0 table as
it feels fit to, and SeaBIOS should be able to pass it through.  Of
course, if there's no specific request from the end user, then I think
QEMU can tell SeaBIOS that it may replace the type0 content with its
own data (eg, via "etc/update-smbios-type0").

> +    while (t < tables + t_len) {
> +        struct smbios_structure_header *h = (struct smbios_structure_header *)t;
> +        u8 *next;
> +
> +        /* find start of next structure (past the double-'\0' terminator) */
> +        for (next = t + h->length; *next || *(next+1); next++);
> +        next += 2;

The display_uuid() code also has sub-table iteration code.  It would
be nice to factor that out and use it in both places.  I'll send a
patch separately with a refactor of display_uuid.


More information about the SeaBIOS mailing list