[SeaBIOS] [PATCH 1/6] bios_date: Make all dates in BIOS consistent

Sam Eiderman posted 6 patches 18 weeks ago

[SeaBIOS] [PATCH 1/6] bios_date: Make all dates in BIOS consistent

Posted by Sam Eiderman 18 weeks ago
From: Liran Alon <liran.alon@oracle.com>

There are 2 places where SeaBIOS reports its release date:

    1. SMBIOS Type 0 entry
    2. Hard-coded address 0xFFFF5

Previous to this commit, each of these places defined it's own unique
date which doesn't make sense.

Therefore, define the BIOS date in a single place and make sure all
relevant places in code use it.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 src/config.h        | 11 +++++++++++
 src/fw/biostables.c |  1 -
 src/fw/smbios.c     |  3 +--
 src/misc.c          |  2 +-
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/config.h b/src/config.h
index 93c8dbc2..6795440c 100644
--- a/src/config.h
+++ b/src/config.h
@@ -29,6 +29,17 @@
 #define BUILD_SUBMODEL_ID   0x00
 #define BUILD_BIOS_REVISION 0x01
 
+#define BIOS_DATE_MONTH         "04"
+#define BIOS_DATE_DAY           "01"
+#define BIOS_DATE_YEAR          "14"
+#define BIOS_DATE_YEAR_PREFIX   "20"
+#define BIOS_DATE           (BIOS_DATE_MONTH "/"    \
+                             BIOS_DATE_DAY   "/"    \
+                             BIOS_DATE_YEAR_PREFIX BIOS_DATE_YEAR)
+#define BIOS_DATE_SHORT     (BIOS_DATE_MONTH "/"    \
+                             BIOS_DATE_DAY   "/"    \
+                             BIOS_DATE_YEAR)
+
 // Various memory addresses used by the code.
 #define BUILD_STACK_ADDR          0x7000
 #define BUILD_S3RESUME_STACK_ADDR 0x1000
diff --git a/src/fw/biostables.c b/src/fw/biostables.c
index fe8626ef..b055c9b2 100644
--- a/src/fw/biostables.c
+++ b/src/fw/biostables.c
@@ -401,7 +401,6 @@ smbios_new_type_0(void *start,
 }
 
 #define BIOS_NAME "SeaBIOS"
-#define BIOS_DATE "04/01/2014"
 
 static int
 smbios_romfile_setup(void)
diff --git a/src/fw/smbios.c b/src/fw/smbios.c
index 62a563b2..96104714 100644
--- a/src/fw/smbios.c
+++ b/src/fw/smbios.c
@@ -161,7 +161,6 @@ get_external(int type, char **p, unsigned *nr_structs,
     } while (0)
 
 /* Type 0 -- BIOS Information */
-#define RELEASE_DATE_STR "01/01/2011"
 static void *
 smbios_init_type_0(void *start)
 {
@@ -179,7 +178,7 @@ smbios_init_type_0(void *start)
 
     p->bios_starting_address_segment = 0xe800;
 
-    load_str_field_with_default(0, bios_release_date_str, RELEASE_DATE_STR);
+    load_str_field_with_default(0, bios_release_date_str, BIOS_DATE);
 
     p->bios_rom_size = 0; /* FIXME */
 
diff --git a/src/misc.c b/src/misc.c
index b5117304..189d487b 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -174,7 +174,7 @@ struct descloc_s rombios32_gdt_48 VARFSEG = {
  ****************************************************************/
 
 // BIOS build date
-char BiosDate[] VARFSEGFIXED(0xfff5) = "06/23/99";
+char BiosDate[] VARFSEGFIXED(0xfff5) = BIOS_DATE_SHORT;
 
 u8 BiosModelId VARFSEGFIXED(0xfffe) = BUILD_MODEL_ID;
 
-- 
2.13.3
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org

[SeaBIOS] Re: [PATCH 1/6] bios_date: Make all dates in BIOS consistent

Posted by Kevin O'Connor 17 weeks ago
On Fri, May 17, 2019 at 11:57:21PM +0300, Sam Eiderman wrote:
> From: Liran Alon <liran.alon@oracle.com>
> 
> There are 2 places where SeaBIOS reports its release date:
> 
>     1. SMBIOS Type 0 entry
>     2. Hard-coded address 0xFFFF5
> 
> Previous to this commit, each of these places defined it's own unique
> date which doesn't make sense.
> 
> Therefore, define the BIOS date in a single place and make sure all
> relevant places in code use it.
> 
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> ---
>  src/config.h        | 11 +++++++++++
>  src/fw/biostables.c |  1 -
>  src/fw/smbios.c     |  3 +--
>  src/misc.c          |  2 +-
>  4 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/src/config.h b/src/config.h
> index 93c8dbc2..6795440c 100644
> --- a/src/config.h
> +++ b/src/config.h
> @@ -29,6 +29,17 @@
>  #define BUILD_SUBMODEL_ID   0x00
>  #define BUILD_BIOS_REVISION 0x01
>  
> +#define BIOS_DATE_MONTH         "04"
> +#define BIOS_DATE_DAY           "01"
> +#define BIOS_DATE_YEAR          "14"
> +#define BIOS_DATE_YEAR_PREFIX   "20"
> +#define BIOS_DATE           (BIOS_DATE_MONTH "/"    \
> +                             BIOS_DATE_DAY   "/"    \
> +                             BIOS_DATE_YEAR_PREFIX BIOS_DATE_YEAR)
> +#define BIOS_DATE_SHORT     (BIOS_DATE_MONTH "/"    \
> +                             BIOS_DATE_DAY   "/"    \
> +                             BIOS_DATE_YEAR)
> +
>  // Various memory addresses used by the code.
>  #define BUILD_STACK_ADDR          0x7000
>  #define BUILD_S3RESUME_STACK_ADDR 0x1000
> diff --git a/src/fw/biostables.c b/src/fw/biostables.c
> index fe8626ef..b055c9b2 100644
> --- a/src/fw/biostables.c
> +++ b/src/fw/biostables.c
> @@ -401,7 +401,6 @@ smbios_new_type_0(void *start,
>  }
>  
>  #define BIOS_NAME "SeaBIOS"
> -#define BIOS_DATE "04/01/2014"

Thanks, however, this would change the contents of the smbios tables
for existing QEMU machine types.  We've seen in the past that any
change to these tables can cause some OSes to perform unwanted
behavior.  In general, if something in the smbios table needs to be
modified, then it's the role of QEMU (or similar) to pass in the
desired content.

[...]
>  
>  static int
>  smbios_romfile_setup(void)
> diff --git a/src/fw/smbios.c b/src/fw/smbios.c
> index 62a563b2..96104714 100644
> --- a/src/fw/smbios.c
> +++ b/src/fw/smbios.c
> @@ -161,7 +161,6 @@ get_external(int type, char **p, unsigned *nr_structs,
>      } while (0)
>  
>  /* Type 0 -- BIOS Information */
> -#define RELEASE_DATE_STR "01/01/2011"
>  static void *
>  smbios_init_type_0(void *start)
>  {
> @@ -179,7 +178,7 @@ smbios_init_type_0(void *start)
>  
>      p->bios_starting_address_segment = 0xe800;
>  
> -    load_str_field_with_default(0, bios_release_date_str, RELEASE_DATE_STR);
> +    load_str_field_with_default(0, bios_release_date_str, BIOS_DATE);

Similarly, we don't want to make any content changes to the legacy
src/fw/smbios.c file.  At this point, we want the legacy smbios tables
to remain identical in content.

>  
>      p->bios_rom_size = 0; /* FIXME */
>  
> diff --git a/src/misc.c b/src/misc.c
> index b5117304..189d487b 100644
> --- a/src/misc.c
> +++ b/src/misc.c
> @@ -174,7 +174,7 @@ struct descloc_s rombios32_gdt_48 VARFSEG = {
>   ****************************************************************/
>  
>  // BIOS build date
> -char BiosDate[] VARFSEGFIXED(0xfff5) = "06/23/99";
> +char BiosDate[] VARFSEGFIXED(0xfff5) = BIOS_DATE_SHORT;

I'm concerned that this could cause regressions with old software.  My
vague understanding is that the 1999 date was used because some very
old (DOS era) software would do a simple greater/less-than comparison
on the year to test for certain bios features.  If a small year (eg,
"14") is used there is a fear that these old programs my change
behavior.

As with the smbios tables, the goal of the dates in seabios is purely
for compatibility.

-Kevin


>  
>  u8 BiosModelId VARFSEGFIXED(0xfffe) = BUILD_MODEL_ID;
>  
> -- 
> 2.13.3
> 
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org