Kevin,

Notice that your patch changes SystemBiosDate for legacy smbios users from 
04/01/14 to 01/01/11 - I’m okay with this change.

Also notice that the RELEASE_DATE_STR[] in smbios.c has to be volatile or else 
it is optimized,
unlike BIOS_DATE[] which is used in a function call and is not optimized.

So the patch should be:

diff --git a/src/fw/biostables.c b/src/fw/biostables.c
index fe8626ef..718926d7 100644
--- a/src/fw/biostables.c
+++ b/src/fw/biostables.c
@@ -401,7 +401,7 @@ smbios_new_type_0(void *start,
 }

 #define BIOS_NAME "SeaBIOS"
-#define BIOS_DATE "04/01/2014"
+static const char BIOS_DATE[] = "04/01/2014";

 static int
 smbios_romfile_setup(void)

diff --git a/src/fw/smbios.c b/src/fw/smbios.c
index f3b5ad9d..fc4dcfe2 100644
--- a/src/fw/smbios.c
+++ b/src/fw/smbios.c

@@ -134,7 +141,7 @@ get_external(int type, char **p, unsigned *nr_structs,
             end += size;                                                \
             p->field = ++str_index;                                     \
         } else {                                                        \
-            memcpy(end, def, sizeof(def));                              \
+            memcpy(end, (void*)def, sizeof(def));                       \
             end += sizeof(def);                                         \
             p->field = ++str_index;                                     \
         }                                                               \
@@ -161,7 +168,7 @@ get_external(int type, char **p, unsigned *nr_structs,
     } while (0)

 /* Type 0 -- BIOS Information */
-#define RELEASE_DATE_STR "01/01/2011"
+const char volatile RELEASE_DATE_STR[] = "01/01/2011";
 static void *
 smbios_init_type_0(void *start)
 {
—

Sam

> On 24 May 2019, at 7:52, Gerd Hoffmann <kra...@redhat.com> wrote:
> 
>  Hi,
> 
>>      * Letting the user choose the date which will appear in the 
>> SystemBiosDate registry key
>> Under QEMU.
> 
> Ah, *this* is why qemu provides a type0 table.
> What is the use case for this?

The thing is that SystemBiosDate is different than the value in smbios0.date, 
at least on a legacy bios.

> 
>>      Legacy SMBIOS Bios Date is '01/01/2011’
> 
> Maybe it's time add a config option to compile out support for legacy
> acpi / smbios tables.  The qemu versions which need that are a few years
> old meanwhile …

I don’t know who uses legacy smbios at the moment except for qemu machines < 
2.1 but adding a config option is always nice.

Actually I think we used legacy smbios in v2v scenarios from VMware/PhoenixBios 
to QEMU/SeaBIOS (with hwversion < 12).

> 
> cheers,
>  Gerd
> 

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to