On Wed, May 29, 2019 at 10:27:57PM +0300, Sam Eiderman wrote:
The implementation for this is very hacky.
For non-legacy smbios we need to deconstruct a packed smbios table that qemu supplies. Preferably around this code in smbios_romfile_setup(void):
/* did we get a type 0 structure ? */ for (t0 = smbios_next(&ep, NULL); t0; t0 = smbios_next(&ep, t0)) if (t0->header.type == 0) { need_t0 = 0; break; }
We need to do some smbios tables math to find the correct date string.
For legacy smbios we can read the fw_cfg that supplies the date, just like get_field() does, ignoring the unused case for get_external() which may also require deconstructing a packed smbios table table.
This will not look good.
I think using a simple fw_cfg value for this task has the following advantages: Makes less changes in the current flow Only enabled by “power users” that know what they are doing, otherwise nothing changes Detaches smbios date from the date that is reported via SystemBiosDate (So we can now support cases that require different values to be reported that way) Makes the SystemBiosDate behavior more explicit
WDYT?
I'm not sure adding another interface between QEMU and SeaBIOS is less complex. Also, ideally this would work regardless of where the smbios table came from (seabios, qemu, coreboot, csm, etc.). So, I think it would be preferable if the code followed SMBiosAddr to the date string - take a look at display_uuid() for similar code.
That said, if there's a simpler approach that would be even better.
-Kevin