All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi: Use U-Boot version for OEM_REVISION
@ 2021-07-10 11:10 Pali Rohár
  2021-07-20 18:32 ` Simon Glass
  2021-10-06 17:46 ` Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Pali Rohár @ 2021-07-10 11:10 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot

OEM_REVISION is 32-bit unsigned number. It should be increased only when
changing software version. Therefore it should not depend on build time.

Change calculation to use U-Boot version numbers and set this revision
to date number.

Prior this change OEM_REVISION was calculated from build date and stored in
the same format.

After this change macro U_BOOT_BUILD_DATE is not used in other files so
remove it from global autogenerated files and also from Makefile.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
This patch depends on similar patch for BIOS Release Date which is here:
http://patchwork.ozlabs.org/project/uboot/patch/20210422160957.26936-1-pali@kernel.org/
---
 Makefile                |  2 --
 doc/develop/version.rst |  1 -
 lib/acpi/acpi_table.c   | 18 +++++++++++++++++-
 test/dm/acpi.c          | 20 ++++++++++++++------
 4 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 2047081a0739..6dd7d140cfa4 100644
--- a/Makefile
+++ b/Makefile
@@ -1903,7 +1903,6 @@ define filechk_timestamp.h
 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \
 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \
 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \
-			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_BUILD_DATE 0x%Y%m%d'; \
 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_EPOCH %s'; \
 		else \
 			return 42; \
@@ -1912,7 +1911,6 @@ define filechk_timestamp.h
 		LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \
 		LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \
 		LC_ALL=C date +'#define U_BOOT_TZ "%z"'; \
-		LC_ALL=C date +'#define U_BOOT_BUILD_DATE 0x%Y%m%d'; \
 		LC_ALL=C date +'#define U_BOOT_EPOCH %s'; \
 	fi)
 endef
diff --git a/doc/develop/version.rst b/doc/develop/version.rst
index 066901bcd2d9..3f2b07cd2261 100644
--- a/doc/develop/version.rst
+++ b/doc/develop/version.rst
@@ -84,7 +84,6 @@ fields. For example::
    #define U_BOOT_DATE "Jan 06 2021"     (US format only)
    #define U_BOOT_TIME "08:50:36"        (24-hour clock)
    #define U_BOOT_TZ "-0700"             (Time zone in hours)
-   #define U_BOOT_BUILD_DATE 0x20210106  (hex yyyymmdd format)
    #define U_BOOT_EPOCH 1609948236
 
 The Epoch is the number of seconds since midnight on 1/1/70. You can convert
diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c
index 2f0774178412..e2f1dc0fc08f 100644
--- a/lib/acpi/acpi_table.c
+++ b/lib/acpi/acpi_table.c
@@ -16,6 +16,22 @@
 #include <asm/global_data.h>
 #include <dm/acpi.h>
 
+/*
+ * OEM_REVISION is 32-bit unsigned number. It should be increased only when
+ * changing software version. Therefore it should not depend on build time.
+ * U-Boot calculates it from U-Boot version and represent it in hexadecimal
+ * notation. As U-Boot version is in form year.month set low 8 bits to 0x01
+ * to have valid date. So for U-Boot version 2021.04 OEM_REVISION is set to
+ * value 0x20210401.
+ */
+#define OEM_REVISION ((((U_BOOT_VERSION_NUM / 1000) % 10) << 28) | \
+		      (((U_BOOT_VERSION_NUM / 100) % 10) << 24) | \
+		      (((U_BOOT_VERSION_NUM / 10) % 10) << 20) | \
+		      ((U_BOOT_VERSION_NUM % 10) << 16) | \
+		      (((U_BOOT_VERSION_NUM_PATCH / 10) % 10) << 12) | \
+		      ((U_BOOT_VERSION_NUM_PATCH % 10) << 8) | \
+		      0x01)
+
 int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags)
 {
 	struct acpi_table_header *header = &dmar->header;
@@ -100,7 +116,7 @@ void acpi_fill_header(struct acpi_table_header *header, char *signature)
 	memcpy(header->signature, signature, 4);
 	memcpy(header->oem_id, OEM_ID, 6);
 	memcpy(header->oem_table_id, OEM_TABLE_ID, 8);
-	header->oem_revision = U_BOOT_BUILD_DATE;
+	header->oem_revision = OEM_REVISION;
 	memcpy(header->aslc_id, ASLC_ID, 4);
 }
 
diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index 2edab7be5445..92901f4c7cc4 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -25,6 +25,14 @@
 
 #define BUF_SIZE		4096
 
+#define OEM_REVISION ((((U_BOOT_VERSION_NUM / 1000) % 10) << 28) | \
+		      (((U_BOOT_VERSION_NUM / 100) % 10) << 24) | \
+		      (((U_BOOT_VERSION_NUM / 10) % 10) << 20) | \
+		      ((U_BOOT_VERSION_NUM % 10) << 16) | \
+		      (((U_BOOT_VERSION_NUM_PATCH / 10) % 10) << 12) | \
+		      ((U_BOOT_VERSION_NUM_PATCH % 10) << 8) | \
+		      0x01)
+
 /**
  * struct testacpi_plat - Platform data for the test ACPI device
  *
@@ -218,7 +226,7 @@ static int dm_test_acpi_fill_header(struct unit_test_state *uts)
 	ut_asserteq_mem(OEM_ID, hdr.oem_id, sizeof(hdr.oem_id));
 	ut_asserteq_mem(OEM_TABLE_ID, hdr.oem_table_id,
 			sizeof(hdr.oem_table_id));
-	ut_asserteq(U_BOOT_BUILD_DATE, hdr.oem_revision);
+	ut_asserteq(OEM_REVISION, hdr.oem_revision);
 	ut_asserteq_mem(ASLC_ID, hdr.aslc_id, sizeof(hdr.aslc_id));
 	ut_asserteq(0x44, hdr.aslc_revision);
 
@@ -365,20 +373,20 @@ static int dm_test_acpi_cmd_list(struct unit_test_state *uts)
 	addr = ALIGN(addr + sizeof(struct acpi_rsdp), 16);
 	ut_assert_nextline("RSDT %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
 			   addr, sizeof(struct acpi_table_header) +
-			   3 * sizeof(u32), U_BOOT_BUILD_DATE);
+			   3 * sizeof(u32), OEM_REVISION);
 	addr = ALIGN(addr + sizeof(struct acpi_rsdt), 16);
 	ut_assert_nextline("XSDT %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
 			   addr, sizeof(struct acpi_table_header) +
-			   3 * sizeof(u64), U_BOOT_BUILD_DATE);
+			   3 * sizeof(u64), OEM_REVISION);
 	addr = ALIGN(addr + sizeof(struct acpi_xsdt), 64);
 	ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
-			   addr, sizeof(struct acpi_dmar), U_BOOT_BUILD_DATE);
+			   addr, sizeof(struct acpi_dmar), OEM_REVISION);
 	addr = ALIGN(addr + sizeof(struct acpi_dmar), 16);
 	ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
-			   addr, sizeof(struct acpi_dmar), U_BOOT_BUILD_DATE);
+			   addr, sizeof(struct acpi_dmar), OEM_REVISION);
 	addr = ALIGN(addr + sizeof(struct acpi_dmar), 16);
 	ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
-			   addr, sizeof(struct acpi_dmar), U_BOOT_BUILD_DATE);
+			   addr, sizeof(struct acpi_dmar), OEM_REVISION);
 	ut_assert_console_end();
 
 	return 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] acpi: Use U-Boot version for OEM_REVISION
  2021-07-10 11:10 [PATCH] acpi: Use U-Boot version for OEM_REVISION Pali Rohár
@ 2021-07-20 18:32 ` Simon Glass
  2021-09-12 21:30   ` Pali Rohár
  2021-10-06 17:46 ` Tom Rini
  1 sibling, 1 reply; 7+ messages in thread
From: Simon Glass @ 2021-07-20 18:32 UTC (permalink / raw)
  To: Pali Rohár; +Cc: U-Boot Mailing List

On Sat, 10 Jul 2021 at 05:10, Pali Rohár <pali@kernel.org> wrote:
>
> OEM_REVISION is 32-bit unsigned number. It should be increased only when
> changing software version. Therefore it should not depend on build time.
>
> Change calculation to use U-Boot version numbers and set this revision
> to date number.
>
> Prior this change OEM_REVISION was calculated from build date and stored in
> the same format.
>
> After this change macro U_BOOT_BUILD_DATE is not used in other files so
> remove it from global autogenerated files and also from Makefile.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> This patch depends on similar patch for BIOS Release Date which is here:
> http://patchwork.ozlabs.org/project/uboot/patch/20210422160957.26936-1-pali@kernel.org/
> ---
>  Makefile                |  2 --
>  doc/develop/version.rst |  1 -
>  lib/acpi/acpi_table.c   | 18 +++++++++++++++++-
>  test/dm/acpi.c          | 20 ++++++++++++++------
>  4 files changed, 31 insertions(+), 10 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] acpi: Use U-Boot version for OEM_REVISION
  2021-07-20 18:32 ` Simon Glass
@ 2021-09-12 21:30   ` Pali Rohár
  2021-09-30  4:08     ` Simon Glass
  0 siblings, 1 reply; 7+ messages in thread
From: Pali Rohár @ 2021-09-12 21:30 UTC (permalink / raw)
  To: Simon Glass; +Cc: U-Boot Mailing List

On Tuesday 20 July 2021 12:32:46 Simon Glass wrote:
> On Sat, 10 Jul 2021 at 05:10, Pali Rohár <pali@kernel.org> wrote:
> >
> > OEM_REVISION is 32-bit unsigned number. It should be increased only when
> > changing software version. Therefore it should not depend on build time.
> >
> > Change calculation to use U-Boot version numbers and set this revision
> > to date number.
> >
> > Prior this change OEM_REVISION was calculated from build date and stored in
> > the same format.
> >
> > After this change macro U_BOOT_BUILD_DATE is not used in other files so
> > remove it from global autogenerated files and also from Makefile.
> >
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> > This patch depends on similar patch for BIOS Release Date which is here:
> > http://patchwork.ozlabs.org/project/uboot/patch/20210422160957.26936-1-pali@kernel.org/
> > ---
> >  Makefile                |  2 --
> >  doc/develop/version.rst |  1 -
> >  lib/acpi/acpi_table.c   | 18 +++++++++++++++++-
> >  test/dm/acpi.c          | 20 ++++++++++++++------
> >  4 files changed, 31 insertions(+), 10 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>

Hello! Could you process this patch? Or are there any issues?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] acpi: Use U-Boot version for OEM_REVISION
  2021-09-12 21:30   ` Pali Rohár
@ 2021-09-30  4:08     ` Simon Glass
  2021-09-30 17:46       ` Tom Rini
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2021-09-30  4:08 UTC (permalink / raw)
  To: Pali Rohár, Tom Rini; +Cc: U-Boot Mailing List

Hi Pali,

On Sun, 12 Sept 2021 at 15:30, Pali Rohár <pali@kernel.org> wrote:
>
> On Tuesday 20 July 2021 12:32:46 Simon Glass wrote:
> > On Sat, 10 Jul 2021 at 05:10, Pali Rohár <pali@kernel.org> wrote:
> > >
> > > OEM_REVISION is 32-bit unsigned number. It should be increased only when
> > > changing software version. Therefore it should not depend on build time.
> > >
> > > Change calculation to use U-Boot version numbers and set this revision
> > > to date number.
> > >
> > > Prior this change OEM_REVISION was calculated from build date and stored in
> > > the same format.
> > >
> > > After this change macro U_BOOT_BUILD_DATE is not used in other files so
> > > remove it from global autogenerated files and also from Makefile.
> > >
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > ---
> > > This patch depends on similar patch for BIOS Release Date which is here:
> > > http://patchwork.ozlabs.org/project/uboot/patch/20210422160957.26936-1-pali@kernel.org/
> > > ---
> > >  Makefile                |  2 --
> > >  doc/develop/version.rst |  1 -
> > >  lib/acpi/acpi_table.c   | 18 +++++++++++++++++-
> > >  test/dm/acpi.c          | 20 ++++++++++++++------
> > >  4 files changed, 31 insertions(+), 10 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Hello! Could you process this patch? Or are there any issues?

+Tom Rini

It isn't in my queue. Perhaps Tom has it?

Regards,
Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] acpi: Use U-Boot version for OEM_REVISION
  2021-09-30  4:08     ` Simon Glass
@ 2021-09-30 17:46       ` Tom Rini
  2021-10-06 12:19         ` Pali Rohár
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Rini @ 2021-09-30 17:46 UTC (permalink / raw)
  To: Simon Glass; +Cc: Pali Rohár, U-Boot Mailing List

[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]

On Wed, Sep 29, 2021 at 10:08:58PM -0600, Simon Glass wrote:
> Hi Pali,
> 
> On Sun, 12 Sept 2021 at 15:30, Pali Rohár <pali@kernel.org> wrote:
> >
> > On Tuesday 20 July 2021 12:32:46 Simon Glass wrote:
> > > On Sat, 10 Jul 2021 at 05:10, Pali Rohár <pali@kernel.org> wrote:
> > > >
> > > > OEM_REVISION is 32-bit unsigned number. It should be increased only when
> > > > changing software version. Therefore it should not depend on build time.
> > > >
> > > > Change calculation to use U-Boot version numbers and set this revision
> > > > to date number.
> > > >
> > > > Prior this change OEM_REVISION was calculated from build date and stored in
> > > > the same format.
> > > >
> > > > After this change macro U_BOOT_BUILD_DATE is not used in other files so
> > > > remove it from global autogenerated files and also from Makefile.
> > > >
> > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > ---
> > > > This patch depends on similar patch for BIOS Release Date which is here:
> > > > http://patchwork.ozlabs.org/project/uboot/patch/20210422160957.26936-1-pali@kernel.org/
> > > > ---
> > > >  Makefile                |  2 --
> > > >  doc/develop/version.rst |  1 -
> > > >  lib/acpi/acpi_table.c   | 18 +++++++++++++++++-
> > > >  test/dm/acpi.c          | 20 ++++++++++++++------
> > > >  4 files changed, 31 insertions(+), 10 deletions(-)
> > >
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > Hello! Could you process this patch? Or are there any issues?
> 
> +Tom Rini
> 
> It isn't in my queue. Perhaps Tom has it?

Well, hunh.  I don't know when I moved it to Accepted, but it clearly
wasn't.  Sorry about that.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] acpi: Use U-Boot version for OEM_REVISION
  2021-09-30 17:46       ` Tom Rini
@ 2021-10-06 12:19         ` Pali Rohár
  0 siblings, 0 replies; 7+ messages in thread
From: Pali Rohár @ 2021-10-06 12:19 UTC (permalink / raw)
  To: Tom Rini; +Cc: Simon Glass, U-Boot Mailing List

On Thursday 30 September 2021 13:46:31 Tom Rini wrote:
> On Wed, Sep 29, 2021 at 10:08:58PM -0600, Simon Glass wrote:
> > Hi Pali,
> > 
> > On Sun, 12 Sept 2021 at 15:30, Pali Rohár <pali@kernel.org> wrote:
> > >
> > > On Tuesday 20 July 2021 12:32:46 Simon Glass wrote:
> > > > On Sat, 10 Jul 2021 at 05:10, Pali Rohár <pali@kernel.org> wrote:
> > > > >
> > > > > OEM_REVISION is 32-bit unsigned number. It should be increased only when
> > > > > changing software version. Therefore it should not depend on build time.
> > > > >
> > > > > Change calculation to use U-Boot version numbers and set this revision
> > > > > to date number.
> > > > >
> > > > > Prior this change OEM_REVISION was calculated from build date and stored in
> > > > > the same format.
> > > > >
> > > > > After this change macro U_BOOT_BUILD_DATE is not used in other files so
> > > > > remove it from global autogenerated files and also from Makefile.
> > > > >
> > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > > ---
> > > > > This patch depends on similar patch for BIOS Release Date which is here:
> > > > > http://patchwork.ozlabs.org/project/uboot/patch/20210422160957.26936-1-pali@kernel.org/
> > > > > ---
> > > > >  Makefile                |  2 --
> > > > >  doc/develop/version.rst |  1 -
> > > > >  lib/acpi/acpi_table.c   | 18 +++++++++++++++++-
> > > > >  test/dm/acpi.c          | 20 ++++++++++++++------
> > > > >  4 files changed, 31 insertions(+), 10 deletions(-)
> > > >
> > > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > >
> > > Hello! Could you process this patch? Or are there any issues?
> > 
> > +Tom Rini
> > 
> > It isn't in my queue. Perhaps Tom has it?
> 
> Well, hunh.  I don't know when I moved it to Accepted, but it clearly
> wasn't.  Sorry about that.

Ok, so could be this patch accepted?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] acpi: Use U-Boot version for OEM_REVISION
  2021-07-10 11:10 [PATCH] acpi: Use U-Boot version for OEM_REVISION Pali Rohár
  2021-07-20 18:32 ` Simon Glass
@ 2021-10-06 17:46 ` Tom Rini
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2021-10-06 17:46 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Simon Glass, u-boot

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

On Sat, Jul 10, 2021 at 01:10:01PM +0200, Pali Rohár wrote:

> OEM_REVISION is 32-bit unsigned number. It should be increased only when
> changing software version. Therefore it should not depend on build time.
> 
> Change calculation to use U-Boot version numbers and set this revision
> to date number.
> 
> Prior this change OEM_REVISION was calculated from build date and stored in
> the same format.
> 
> After this change macro U_BOOT_BUILD_DATE is not used in other files so
> remove it from global autogenerated files and also from Makefile.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-06 17:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-10 11:10 [PATCH] acpi: Use U-Boot version for OEM_REVISION Pali Rohár
2021-07-20 18:32 ` Simon Glass
2021-09-12 21:30   ` Pali Rohár
2021-09-30  4:08     ` Simon Glass
2021-09-30 17:46       ` Tom Rini
2021-10-06 12:19         ` Pali Rohár
2021-10-06 17:46 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.