MIPS: drop asm/const.h
Subsystems (6)
PATCH v3 1/5 MIPS: drop asm/const.h
Commit 86f21c96f467368 (mips: Use common _AC macro now.) removed the _AC definition from const.h. All other macros defined in const.h are not used anywhere. Remove this header.
---
v3: New patch in this series
--- arch/mips/include/asm/const.h | 27 --------------------- arch/mips/include/asm/mach-generic/spaces.h | 2 -- 2 files changed, 29 deletions(-) delete mode 100644 arch/mips/include/asm/const.h
arch/mips/include/asm/const.h deleted +0 -27
@@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* const.h: Macros for dealing with constants. -*/ - -#ifndef _LINUX_CONST_H -#define _LINUX_CONST_H - -/* Some constant macros are used in both assembler and -* C code. Therefore we cannot annotate them always with -* 'UL' and other type specifiers unilaterally. We -* use the following macros to deal with this. -* -* Similarly, _AT() will cast an expression with a type in C, but -* leave it unchanged in asm. -*/ - -#ifdef __ASSEMBLY__ -#define _AT (T ,X ) X -#else -#define _AT (T ,X ) ((T)(X)) -#endif - -#define _BITUL (x) (_AC(1,UL) << (x)) -#define _BITULL (x) (_AC(1,ULL) << (x)) - -#endif /* !(_LINUX_CONST_H) */
arch/mips/include/asm/mach-generic/spaces.h +0 -2
@@ -7,8 +7,6 @@#ifndef _ASM_MACH_GENERIC_SPACES_H#define _ASM_MACH_GENERIC_SPACES_H -#include <asm/const.h> -/* * This gives the physical RAM offset. */
Signature · 1 line
2.19.1
PATCH v3 2/5 linux/const.h: import from kernel
Combine the uapi/linux/const.h header into the kernel linux/const.h. The next commit will use the _AC macro this header instead of the common.h definition.
---
v3: New patch in this series
--- include/linux/const.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/linux/const.h
include/linux/const.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_CONST_H +#define _LINUX_CONST_H + +/* const.h: Macros for dealing with constants. */ + +/* Some constant macros are used in both assembler and +* C code. Therefore we cannot annotate them always with +* 'UL' and other type specifiers unilaterally. We +* use the following macros to deal with this. +* +* Similarly, _AT() will cast an expression with a type in C, but +* leave it unchanged in asm. +*/ + +#ifdef __ASSEMBLY__ +#define _AC (X ,Y ) X +#define _AT (T ,X ) X +#else +#define __AC (X ,Y ) (X##Y) +#define _AC (X ,Y ) __AC(X,Y) +#define _AT (T ,X ) ((T)(X)) +#endif + +#define _UL (x) (_AC(x, UL)) +#define _ULL (x) (_AC(x, ULL)) + +#define _BITUL (x) (_UL(1) << (x)) +#define _BITULL (x) (_ULL(1) << (x)) + +#define UL (x) (_UL(x)) +#define ULL (x) (_ULL(x)) + +#endif /* _LINUX_CONST_H */
Signature · 1 line
2.19.1
PATCH v3 2/5 linux/const.h: import from kernel
Quoted 8 lines · Baruch Siach
Combine the
uapi/linux/const.hheader into the kernellinux/const.h. The next commit will use the_ACmacro this header instead of thecommon.hdefinition.Signed-off-by Baruch Siach <[email protected]>---
v3: New patch in this series
---
This should be patch #1 and mention what kernel release it's from please, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181108/f97d1506/attachment.sig>
PATCH v3 3/5 Use _AC and UL macros from linux/const.h
In reply to Baruch SiachDrop the _AC and UL macros from common.h. Linux headers is the original source of this macro, so keep its definition in the same header.
Update existing users of these macros to include const.h directly.
---
v3: New patch in this series
--- arch/arm/include/asm/armv8/mmu.h | 2 ++ arch/mips/include/asm/mach-generic/spaces.h | 2 ++ arch/riscv/include/asm/csr.h | 2 ++ include/common.h | 9 --------- 4 files changed, 6 insertions(+), 9 deletions(-)
arch/arm/include/asm/armv8/mmu.h +2 -0
@@ -7,6 +7,8 @@#ifndef _ASM_ARMV8_MMU_H_#define _ASM_ARMV8_MMU_H_ +#include <linux/const.h> +/* * block/section address mask and size definitions. */
arch/mips/include/asm/mach-generic/spaces.h +2 -0
@@ -7,6 +7,8 @@#ifndef _ASM_MACH_GENERIC_SPACES_H#define _ASM_MACH_GENERIC_SPACES_H +#include <linux/const.h> +/* * This gives the physical RAM offset. */
arch/riscv/include/asm/csr.h +2 -0
@@ -8,6 +8,8 @@#ifndef _ASM_RISCV_CSR_H#define _ASM_RISCV_CSR_H +#include <linux/const.h> +/* Status register flags */ #define SR_SIE _AC(0x00000002, UL)/* Supervisor Interrupt Enable */ #define SR_SPIE _AC(0x00000020, UL)/* Previous Supervisor IE */
include/common.h +0 -9
@@ -14,9 +14,6 @@ typedef volatile unsigned long vu_long;typedef volatile unsigned short vu_short ;typedef volatile unsigned char vu_char ; -/* Allow sharing constants with type modifiers between C and assembly. */ -#define _AC (X ,Y ) (X##Y) -#include <config.h> #include <errno.h> #include <time.h>
@@ -542,16 +539,10 @@ int cpu_release(u32 nr, int argc, char * const argv[]);#else /* __ASSEMBLY__ */ -/* Drop a C type modifier (like in 3UL) for constants used in assembly. */ -#define _AC (X ,Y ) X -#endif /* __ASSEMBLY__ */ /* Put only stuff here that the assembler can digest */ -/* Declare an unsigned long constant digestable both by C and an assembler. */ -#define UL (x) _AC(x, UL) -#ifdef CONFIG_POST #define CONFIG_HAS_POST #ifndef CONFIG_POST_ALT_LIST
Signature · 1 line
2.19.1
PATCH v3 3/5 Use _AC and UL macros from linux/const.h
Quoted 8 lines · Baruch Siach
Drop the
_ACand UL macros fromcommon.h. Linux headers is the original source of this macro, so keep its definition in the same header.Update existing users of these macros to include
const.hdirectly.Cc Daniel Schwierzeck <[email protected]>Cc Rick Chen <[email protected]>Signed-off-by Baruch Siach <[email protected]>
I know you'll need to now drop the MIPS part but otherwise:
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181108/fff409f9/attachment.sig>
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 3/5 Use _AC and UL macros from linux/const.h
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Drop the
_ACand UL macros fromcommon.h. Linux headers is the original source of this macro, so keep its definition in the same header.Update existing users of these macros to include
const.hdirectly.
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Cc Daniel Schwierzeck <[email protected]>Cc Rick Chen <[email protected]>Signed-off-by Baruch Siach <[email protected]>I know you'll need to now drop the MIPS part but otherwise:
Reviewed-by Tom Rini <[email protected]>
Quoted 2 lines
Quoted 2 lines
--
Tom
PATCH v3 4/5 linux/sizes.h: sync from kernel
In reply to Baruch SiachThe kernel added SZ_4G macro in commit f2b9ba871b (arm64/kernel: kaslr:
reduce module randomization range to 4 GB).
Include linux/const.h for the _AC macro.
Drop a local SZ_4G definition in tegra code.
---
v3: Use linux/const.h
v2: No change
--- arch/arm/mach-tegra/tegra186/nvtboot_mem.c | 3 +-- include/linux/sizes.h | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/tegra186/nvtboot_mem.c +1 -2
@@ -6,11 +6,10 @@#include <common.h> #include <fdt_support.h> #include <fdtdec.h> +#include <linux/sizes.h> #include <asm/arch/tegra.h> #include <asm/armv8/mmu.h> -#define SZ_4G 0x100000000ULL -/* * Size of a region that's large enough to hold the relocated U-Boot and all * other allocations made around it (stack, heap, page tables, etc.)
include/linux/sizes.h +4 -0
@@ -8,6 +8,8 @@#ifndef __LINUX_SIZES_H__#define __LINUX_SIZES_H__ +#include <linux/const.h> +#define SZ_1 0x00000001#define SZ_2 0x00000002#define SZ_4 0x00000004
@@ -44,4 +46,6 @@#define SZ_1G 0x40000000#define SZ_2G 0x80000000 +#define SZ_4G _AC(0x100000000, ULL) +#endif /* __LINUX_SIZES_H__ */
Signature · 1 line
2.19.1
PATCH v3 4/5 linux/sizes.h: sync from kernel
Quoted 9 lines · Baruch Siach
The kernel added
SZ_4Gmacro in commitf2b9ba871b(arm64/kernel: kaslr:
reduce module randomization range to 4 GB).Include
linux/const.hfor the_ACmacro.Drop a local
SZ_4Gdefinition in tegra code.Cc Tom Warren <[email protected]>Signed-off-by Baruch Siach <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181108/fd9d8405/attachment.sig>
PATCH v3 5/5 arm64: mvebu: a8k: autodetect RAM size
In reply to Baruch SiachSome Armada 8K boards like Macchiatobin and Clearfog GT-8K use RAM from external DIMM. Hard coding the RAM size in the device-tree is not convenient. Fortunately, the ATF that initializes the RAM knows the size of RAM, and U-Boot can query the ATF using a SMC call.
The ATF maps the lower 3G of RAM starting at address 0. Higher RAM is mapped at 4G. This leaves a 1G hole between 3G and 4G for IO peripherals. Use a second bi_dram[] entry to describe the higher RAM area. As a result, CONFIG_NR_DRAM_BANKS must be set to 2 to use more than 3GB RAM.
This code in this commit is mostly taken from downstream Marvell U-Boot code by Grzegorz Jaszczyk.
---
v3:
No change
v2:
Expand memory layout description in code comment and the commit log (Stefan)
--- arch/arm/mach-mvebu/arm64-common.c | 50 +++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/arm64-common.c +49 -1
@@ -7,6 +7,7 @@#include <dm.h> #include <fdtdec.h> #include <linux/libfdt.h> +#include <linux/sizes.h> #include <pci.h> #include <asm/io.h> #include <asm/system.h>
@@ -45,15 +46,62 @@ const struct mbus_dram_target_info *mvebu_mbus_dram_info(void)/* DRAM init code ... */ +#define MV_SIP_DRAM_SIZE 0x82000010 + +static u64 a8k_dram_scan_ap_sz (void ) +{ +struct pt_regs pregs; + + pregs.regs[0 ] =MV_SIP_DRAM_SIZE ; + pregs.regs[1 ] =SOC_REGS_PHY_BASE ; +smc_call (&pregs); + +return pregs.regs[0 ]; +} + +static void a8k_dram_init_banksize (void ) +{ +/* +* The firmware (ATF) leaves a 1G whole above the 3G mark for IO +* devices. Higher RAM is mapped at 4G. +* +* Config 2 DRAM banks: +* Bank 0 - max size 4G - 1G +* Bank 1 - ram size - 4G + 1G +*/ +phys_size_t max_bank0_size =SZ_4G -SZ_1G ; + + gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; +if (gd->ram_size <= max_bank0_size) { + gd->bd->bi_dram[0 ].size = gd->ram_size; +return ; + } + + gd->bd->bi_dram[0 ].size = max_bank0_size; +if (CONFIG_NR_DRAM_BANKS >1 ) { + gd->bd->bi_dram[1 ].start =SZ_4G ; + gd->bd->bi_dram[1 ].size = gd->ram_size - max_bank0_size; + } +} +int dram_init_banksize (void ) { -fdtdec_setup_memory_banksize (); +if (CONFIG_IS_ENABLED (ARMADA_8K )) +a8k_dram_init_banksize (); +else +fdtdec_setup_memory_banksize ();return 0 ; }int dram_init (void ) { +if (CONFIG_IS_ENABLED (ARMADA_8K )) { + gd->ram_size =a8k_dram_scan_ap_sz (); +if (gd->ram_size !=0 ) +return 0 ; + } +if (fdtdec_setup_mem_size_base () !=0 )return -EINVAL ;
Signature · 1 line
2.19.1
PATCH v3 1/5 MIPS: drop asm/const.h
In reply to Baruch SiachQuoted 9 lines · Baruch Siach
Commit
86f21c96f467368(mips: Use common_ACmacro now.) removed the_ACdefinition fromconst.h. All other macros defined inconst.hare not used anywhere. Remove this header.Cc Daniel Schwierzeck <[email protected]>Signed-off-by Baruch Siach <[email protected]>---
v3: New patch in this series
---
This should be patch #2 and switch asm/mach/spaces.h to using <linux/const.h> I think.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181108/299cfa9c/attachment.sig>
PATCH v3 1/5 MIPS: drop asm/const.h
In reply to Baruch SiachAm Do., 8. Nov. 2018 um 13:29 Uhr schrieb Baruch Siach <[email protected]>:
Quoted 38 lines
Commit
86f21c96f467368(mips: Use common_ACmacro now.) removed the_ACdefinition fromconst.h. All other macros defined inconst.hare not used anywhere. Remove this header.Cc Daniel Schwierzeck <[email protected]>Signed-off-by Baruch Siach <[email protected]>---
v3: New patch in this series--- arch/mips/include/asm/const.h | 27 --------------------- arch/mips/include/asm/mach-generic/spaces.h | 2 -- 2 files changed, 29 deletions(-) delete mode 100644 arch/mips/include/asm/const.harch/mips/include/asm/const.h deleted +0
-17@@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* const.h: Macros for dealing with constants. -*/ - -#ifndef _LINUX_CONST_H -#define _LINUX_CONST_H - -/* Some constant macros are used in both assembler and -* C code. Therefore we cannot annotate them always with -* 'UL' and other type specifiers unilaterally. We -* use the following macros to deal with this. -* -* Similarly, _AT() will cast an expression with a type in C, but -* leave it unchanged in asm. -*/ -
arch/mips/include/asm/const.h line 27
Quoted 10 lines
arch/mips/include/asm/const.h deleted +0
-10-#ifdef __ASSEMBLY__ -#define _AT (T ,X ) X -#else -#define _AT (T ,X ) ((T)(X)) -#endif - -#define _BITUL (x) (_AC(1,UL) << (x)) -#define _BITULL (x) (_AC(1,ULL) << (x)) - -#endif /* !(_LINUX_CONST_H) */
The removal of arch/mips/include/asm/const.h should be a standalone patch after patch 3/5 (after switching MIPS to generic linux/const.h, see comment below).
arch/mips/include/asm/mach-generic/spaces.h line 12
Quoted 13 lines
arch/mips/include/asm/mach-generic/spaces.h +0
-2@@ -7,8 +7,6 @@#ifndef _ASM_MACH_GENERIC_SPACES_H#define _ASM_MACH_GENERIC_SPACES_H -#include <asm/const.h> -/* * This gives the physical RAM offset. */
This hunk should be squashed into patch 3/5.
Quoted 3 lines
--
2.19.1
Signature · 1 line
- Daniel