]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
x86: select CONFIG_64BIT for X86_64
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Mon, 16 Dec 2024 18:07:35 +0000 (18:07 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 31 Dec 2024 16:58:30 +0000 (10:58 -0600)
Select CONFIG_64BIT so that we pass the -m64 option (instead of -m32) to
static analysis tools.
Introduce CONFIG_SPL_64BIT and select it for architectures other than
x86 with 64 bit builds. Do not select it for x86 builds as x86 uses
a 32 bit SPL.
Ensure that when limits are set they use CONFIG_64BIT for U-Boot
proper and CONFIG_SPL_64BIT for SPL. This is to allow for the 32 bit
SPL build used by x86.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
arch/Kconfig
arch/arm/Kconfig
arch/mips/Kconfig
arch/riscv/Kconfig
arch/sandbox/Kconfig
arch/x86/Kconfig
common/bloblist.c
include/limits.h

index 6258788f53ffbd45904b730d323c00a33da22234..bb2e7bedd106b3bdea7d0129bd4b347468d52996 100644 (file)
@@ -37,6 +37,14 @@ config 32BIT
 
 config 64BIT
        bool
+       help
+         Indicates that U-Boot proper will be built for a 64 bit
+         architecture.
+
+config SPL_64BIT
+       bool
+       help
+         Indicates that SPL will be built for a 64 bit architecture.
 
 config SYS_CACHELINE_SIZE
        int
index 7282c4123b08fab50c1ce3de125a19a4faf5cf1f..055762b0b9dd8dd44ef924841ffda817559fc8b3 100644 (file)
@@ -7,6 +7,7 @@ config SYS_ARCH
 config ARM64
        bool
        select 64BIT
+       select SPL_64BIT if SPL
        select PHYS_64BIT
        select SYS_CACHE_SHIFT_6
        imply SPL_SEPARATE_BSS
index 38577af43d03e2888504743357ae918912691761..7ea439e857ccb8ea8898e1e2972a00951d3268f9 100644 (file)
@@ -211,6 +211,7 @@ config CPU_MIPS64_R1
        bool "MIPS64 Release 1"
        depends on SUPPORTS_CPU_MIPS64_R1
        select 64BIT
+       select SPL_64BIT if SPL
        help
          Choose this option to build a kernel for release 1 through 5 of the
          MIPS64 architecture.
@@ -219,6 +220,7 @@ config CPU_MIPS64_R2
        bool "MIPS64 Release 2"
        depends on SUPPORTS_CPU_MIPS64_R2
        select 64BIT
+       select SPL_64BIT if SPL
        help
          Choose this option to build a kernel for release 2 through 5 of the
          MIPS64 architecture.
@@ -227,6 +229,7 @@ config CPU_MIPS64_R6
        bool "MIPS64 Release 6"
        depends on SUPPORTS_CPU_MIPS64_R6
        select 64BIT
+       select SPL_64BIT if SPL
        help
          Choose this option to build a kernel for release 6 or later of the
          MIPS64 architecture.
@@ -235,6 +238,7 @@ config CPU_MIPS64_OCTEON
        bool "Marvell Octeon series of CPUs"
        depends on SUPPORTS_CPU_MIPS64_OCTEON
        select 64BIT
+       select SPL_64BIT if SPL
        help
         Choose this option for Marvell Octeon CPUs.  These CPUs are between
         MIPS64 R5 and R6 with other extensions.
index 043d963f63445feff528e0b33c2c360886ca408f..abb7a984c48966614456b8f8653b621f2cefe8b2 100644 (file)
@@ -120,6 +120,7 @@ config ARCH_RV32I
 config ARCH_RV64I
        bool "RV64I"
        select 64BIT
+       select SPL_64BIT if SPL
        select PHYS_64BIT
        help
          Choose this option to target the RV64I base integer instruction set.
index db29ca14bdf712aa0f668b95c9c514a2daf49402..4c169034d9a28d3a5fe1df92e438604caeef7328 100644 (file)
@@ -47,6 +47,7 @@ config HOST_32BIT
 config HOST_64BIT
        def_bool $(cc-define,_LP64)
        select 64BIT
+       select SPL_64BIT if SPL
 
 config HOST_HAS_SDL
        def_bool $(success,sdl2-config --version)
index 23a1e21b29e1f78f90f573ac350e741f9228fbc6..006a59d6fa63cd6466babc80e8b1396ef31c5087 100644 (file)
@@ -44,6 +44,7 @@ endchoice
 
 config X86_64
        bool
+       select 64BIT
 
 config SPL_X86_64
        bool
index ec6ff7a5a93023deb113fafb33438392e885ba29..110bb9dc44af487ee9e8b83ff4698e73d0c374ba 100644 (file)
@@ -576,14 +576,17 @@ int bloblist_maybe_init(void)
 
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig)
 {
-       ulong version = BLOBLIST_REGCONV_VER;
+       u64 version = BLOBLIST_REGCONV_VER;
        ulong sigval;
 
-       sigval = (IS_ENABLED(CONFIG_64BIT)) ?
-                       ((BLOBLIST_MAGIC & ((1UL << BLOBLIST_REGCONV_SHIFT_64) - 1)) |
-                        ((version  & BLOBLIST_REGCONV_MASK) << BLOBLIST_REGCONV_SHIFT_64)) :
-                       ((BLOBLIST_MAGIC & ((1UL << BLOBLIST_REGCONV_SHIFT_32) - 1)) |
+       if ((IS_ENABLED(CONFIG_64BIT) && !IS_ENABLED(CONFIG_SPL_BUILD)) ||
+                       (IS_ENABLED(CONFIG_SPL_64BIT) && IS_ENABLED(CONFIG_SPL_BUILD))) {
+               sigval = ((BLOBLIST_MAGIC & ((1ULL << BLOBLIST_REGCONV_SHIFT_64) - 1)) |
+                        ((version  & BLOBLIST_REGCONV_MASK) << BLOBLIST_REGCONV_SHIFT_64));
+       } else {
+               sigval = ((BLOBLIST_MAGIC & ((1UL << BLOBLIST_REGCONV_SHIFT_32) - 1)) |
                         ((version  & BLOBLIST_REGCONV_MASK) << BLOBLIST_REGCONV_SHIFT_32));
+       }
 
        if (rzero || rsig != sigval ||
            rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) {
index 4700cc7a59ff830ab38528ba007b107237ec6ce9..1d0bbf69be7afad0d6cd1fae6b20dc6cba15ef9e 100644 (file)
@@ -9,7 +9,8 @@
 #define UINT32_MAX  0xffffffffU
 #define UINT64_MAX  0xffffffffffffffffULL
 
-#ifdef CONFIG_64BIT
+#if (defined(CONFIG_64BIT) && !defined(CONFIG_SPL_BUILD)) || \
+       (defined(CONFIG_SPL_64BIT) && defined(CONFIG_SPL_BUILD))
     #define UINTPTR_MAX UINT64_MAX
 #else
     #define UINTPTR_MAX UINT32_MAX