From patchwork Sat Jul 10 11:10:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1503464 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Aq5LpYeL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GMS4X1qMlz9sSs for ; Sat, 10 Jul 2021 21:10:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C318783249; Sat, 10 Jul 2021 13:10:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Aq5LpYeL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B46A083277; Sat, 10 Jul 2021 13:10:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2060B83247 for ; Sat, 10 Jul 2021 13:10:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 08897613D0; Sat, 10 Jul 2021 11:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625915420; bh=Gw9+lto7WXEDqGUigaQrt7JI/V6B06gnqWJqLNmUHYc=; h=From:To:Cc:Subject:Date:From; b=Aq5LpYeLKRA8WCvrx35A6vBSvKrOgEiECp322Ow8TQTH2FP0/zuKi56xtyER14qIi Es5MtybIBve5euWTc+m/k2e6J0Cdzeut85NNlWDgwcCJpaVANxm7BweuBRwCH94UeF PDK0BO5hHUCkNnDl1DZTLcDbkDyWzEkg70vvZu8nhJWLfbxNrfBiIYWJ8ykW9Bl9Wd Xr8VgIHS4potxeerjrjTT/MwYqFgMKoC6iVNWGCInMPK6ikW2+UeNgueYB6mktio9k C1PDazsmJYrLtm+0081Vn3huZUF8cZ4RyQ77Ry/oUuMr20RuUEZpMlOp+lWRa3egY+ pxM2kDOM4bF/g== Received: by pali.im (Postfix) id 35E5B7BA; Sat, 10 Jul 2021 13:10:17 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Simon Glass Cc: u-boot@lists.denx.de Subject: [PATCH] acpi: Use U-Boot version for OEM_REVISION Date: Sat, 10 Jul 2021 13:10:01 +0200 Message-Id: <20210710111001.32325-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Simon Glass --- 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 #include +/* + * 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;