[SeaBIOS] Re: [PATCH 3/6] bios_date: Change BiosDate to SMBIOS bios date

Sam Eiderman posted 1 patch 4 years, 11 months ago
Failed in applying to current master (apply log)
[SeaBIOS] Re: [PATCH 3/6] bios_date: Change BiosDate to SMBIOS bios date
Posted by Sam Eiderman 4 years, 11 months ago
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 <kraxel@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-leave@seabios.org
[SeaBIOS] Re: [PATCH 3/6] bios_date: Change BiosDate to SMBIOS bios date
Posted by Sam Eiderman 4 years, 10 months ago
Kevin,

I have used your method to clean FSEG from unwanted date strings and added
a new fw_cfg to control the date that will eventually appear in SystemBiosDate.

New patches submitted.

Thanks,
Sam

> On 24 May 2019, at 19:35, Sam Eiderman <shmuel.eiderman@oracle.com> wrote:
> 
> 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 <kraxel@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 <mailto:seabios@seabios.org>
> To unsubscribe send an email to seabios-leave@seabios.org <mailto:seabios-leave@seabios.org>
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org