Skip to content

Commit 1e4d965

Browse files
sjg20trini
authored andcommitted
acpi: Put the version numbers in a central place
At present two acpi files are built every time since they use a version number from version.h This is not necessary. Make use of the same technique as for the version string, so that they are build only when they change. Signed-off-by: Simon Glass <[email protected]>
1 parent 36fc832 commit 1e4d965

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

cmd/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING
2020

2121
const char version_string[] = U_BOOT_VERSION_STRING;
22+
const unsigned short version_num = U_BOOT_VERSION_NUM;
23+
const unsigned char version_num_patch = U_BOOT_VERSION_NUM_PATCH;
2224

2325
static int do_version(struct cmd_tbl *cmdtp, int flag, int argc,
2426
char *const argv[])

include/version_string.h

+2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
#define __VERSION_STRING_H__
55

66
extern const char version_string[];
7+
extern const unsigned short version_num;
8+
extern const unsigned char version_num_patch;
79

810
#endif /* __VERSION_STRING_H__ */

lib/acpi/acpi_table.c

+7-8
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include <log.h>
1212
#include <mapmem.h>
1313
#include <tables_csum.h>
14-
#include <timestamp.h>
15-
#include <version.h>
14+
#include <version_string.h>
1615
#include <acpi/acpi_table.h>
1716
#include <asm/global_data.h>
1817
#include <dm/acpi.h>
@@ -25,12 +24,12 @@
2524
* to have valid date. So for U-Boot version 2021.04 OEM_REVISION is set to
2625
* value 0x20210401.
2726
*/
28-
#define OEM_REVISION ((((U_BOOT_VERSION_NUM / 1000) % 10) << 28) | \
29-
(((U_BOOT_VERSION_NUM / 100) % 10) << 24) | \
30-
(((U_BOOT_VERSION_NUM / 10) % 10) << 20) | \
31-
((U_BOOT_VERSION_NUM % 10) << 16) | \
32-
(((U_BOOT_VERSION_NUM_PATCH / 10) % 10) << 12) | \
33-
((U_BOOT_VERSION_NUM_PATCH % 10) << 8) | \
27+
#define OEM_REVISION ((((version_num / 1000) % 10) << 28) | \
28+
(((version_num / 100) % 10) << 24) | \
29+
(((version_num / 10) % 10) << 20) | \
30+
((version_num % 10) << 16) | \
31+
(((version_num_patch / 10) % 10) << 12) | \
32+
((version_num_patch % 10) << 8) | \
3433
0x01)
3534

3635
int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags)

test/dm/acpi.c

+7-9
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
#include <dm.h>
1212
#include <malloc.h>
1313
#include <mapmem.h>
14-
#include <timestamp.h>
15-
#include <version.h>
1614
#include <tables_csum.h>
17-
#include <version.h>
15+
#include <version_string.h>
1816
#include <acpi/acpigen.h>
1917
#include <acpi/acpi_device.h>
2018
#include <acpi/acpi_table.h>
@@ -26,12 +24,12 @@
2624

2725
#define BUF_SIZE 4096
2826

29-
#define OEM_REVISION ((((U_BOOT_VERSION_NUM / 1000) % 10) << 28) | \
30-
(((U_BOOT_VERSION_NUM / 100) % 10) << 24) | \
31-
(((U_BOOT_VERSION_NUM / 10) % 10) << 20) | \
32-
((U_BOOT_VERSION_NUM % 10) << 16) | \
33-
(((U_BOOT_VERSION_NUM_PATCH / 10) % 10) << 12) | \
34-
((U_BOOT_VERSION_NUM_PATCH % 10) << 8) | \
27+
#define OEM_REVISION ((((version_num / 1000) % 10) << 28) | \
28+
(((version_num / 100) % 10) << 24) | \
29+
(((version_num / 10) % 10) << 20) | \
30+
((version_num % 10) << 16) | \
31+
(((version_num_patch / 10) % 10) << 12) | \
32+
((version_num_patch % 10) << 8) | \
3533
0x01)
3634

3735
/**

0 commit comments

Comments
 (0)