Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ARM] 3060/1: allow constants found in asm/memory.h to be used in asm code

Patch from Nicolas Pitre

This patch allows for assorted type of cleanups by letting assembly code
use the same set of defines for constant values and avoid duplicated
definitions that might not always be in sync, or that might simply be
confusing due to the different names for the same thing.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Nicolas Pitre and committed by
Russell King
f09b9979 c514e58c

+49 -38
-1
arch/arm/kernel/asm-offsets.c
··· 94 94 DEFINE(VM_EXEC, VM_EXEC); 95 95 BLANK(); 96 96 DEFINE(PAGE_SZ, PAGE_SIZE); 97 - DEFINE(VIRT_OFFSET, PAGE_OFFSET); 98 97 BLANK(); 99 98 DEFINE(SYS_ERROR0, 0x9f0000); 100 99 BLANK();
+2 -1
arch/arm/kernel/entry-armv.S
··· 15 15 */ 16 16 #include <linux/config.h> 17 17 18 + #include <asm/memory.h> 18 19 #include <asm/glue.h> 19 20 #include <asm/vfpmacros.h> 20 21 #include <asm/hardware.h> /* should be moved into entry-macro.S */ ··· 311 310 312 311 #if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) 313 312 @ make sure our user space atomic helper is aborted 314 - cmp r2, #VIRT_OFFSET 313 + cmp r2, #TASK_SIZE 315 314 bichs r3, r3, #PSR_Z_BIT 316 315 #endif 317 316
+3 -2
arch/arm/kernel/head.S
··· 21 21 #include <asm/procinfo.h> 22 22 #include <asm/ptrace.h> 23 23 #include <asm/asm-offsets.h> 24 + #include <asm/memory.h> 24 25 #include <asm/thread_info.h> 25 26 #include <asm/system.h> 26 27 ··· 77 76 .equ swapper_pg_dir, DATAADDR - 0x4000 78 77 79 78 .macro pgtbl, rd, phys 80 - ldr \rd, =((DATAADDR - 0x4000) - VIRT_OFFSET) 79 + ldr \rd, =((DATAADDR - 0x4000) - PAGE_OFFSET) 81 80 add \rd, \rd, \phys 82 81 .endm 83 82 #endif ··· 325 324 /* 326 325 * Then map first 1MB of ram in case it contains our boot params. 327 326 */ 328 - add r0, r4, #VIRT_OFFSET >> 18 327 + add r0, r4, #PAGE_OFFSET >> 18 329 328 orr r6, r5, r7 330 329 str r6, [r0] 331 330
+1 -1
include/asm-arm/arch-aaec2000/memory.h
··· 13 13 14 14 #include <linux/config.h> 15 15 16 - #define PHYS_OFFSET (0xf0000000UL) 16 + #define PHYS_OFFSET UL(0xf0000000) 17 17 18 18 #define __virt_to_bus(x) __virt_to_phys(x) 19 19 #define __bus_to_virt(x) __phys_to_virt(x)
+1 -1
include/asm-arm/arch-cl7500/memory.h
··· 17 17 /* 18 18 * Physical DRAM offset. 19 19 */ 20 - #define PHYS_OFFSET (0x10000000UL) 20 + #define PHYS_OFFSET UL(0x10000000) 21 21 22 22 /* 23 23 * These are exactly the same on the RiscPC as the
+1 -1
include/asm-arm/arch-clps711x/memory.h
··· 25 25 /* 26 26 * Physical DRAM offset. 27 27 */ 28 - #define PHYS_OFFSET (0xc0000000UL) 28 + #define PHYS_OFFSET UL(0xc0000000) 29 29 30 30 /* 31 31 * Virtual view <-> DMA view memory address translations
+1 -1
include/asm-arm/arch-ebsa110/memory.h
··· 19 19 /* 20 20 * Physical DRAM offset. 21 21 */ 22 - #define PHYS_OFFSET (0x00000000UL) 22 + #define PHYS_OFFSET UL(0x00000000) 23 23 24 24 /* 25 25 * We keep this 1:1 so that we don't interfere
+5 -5
include/asm-arm/arch-ebsa285/memory.h
··· 46 46 #if defined(CONFIG_ARCH_FOOTBRIDGE) 47 47 48 48 /* Task size and page offset at 3GB */ 49 - #define TASK_SIZE (0xbf000000UL) 50 - #define PAGE_OFFSET (0xc0000000UL) 49 + #define TASK_SIZE UL(0xbf000000) 50 + #define PAGE_OFFSET UL(0xc0000000) 51 51 52 52 #elif defined(CONFIG_ARCH_CO285) 53 53 54 54 /* Task size and page offset at 1.5GB */ 55 - #define TASK_SIZE (0x5f000000UL) 56 - #define PAGE_OFFSET (0x60000000UL) 55 + #define TASK_SIZE UL(0x5f000000) 56 + #define PAGE_OFFSET UL(0x60000000) 57 57 58 58 #else 59 59 ··· 64 64 /* 65 65 * Physical DRAM offset. 66 66 */ 67 - #define PHYS_OFFSET (0x00000000UL) 67 + #define PHYS_OFFSET UL(0x00000000) 68 68 69 69 /* 70 70 * This decides where the kernel will search for a free chunk of vm
+1 -1
include/asm-arm/arch-epxa10db/memory.h
··· 23 23 /* 24 24 * Physical DRAM offset. 25 25 */ 26 - #define PHYS_OFFSET (0x00000000UL) 26 + #define PHYS_OFFSET UL(0x00000000) 27 27 28 28 /* 29 29 * Virtual view <-> DMA view memory address translations
+1 -1
include/asm-arm/arch-h720x/memory.h
··· 11 11 * Page offset: 12 12 * ( 0xc0000000UL ) 13 13 */ 14 - #define PHYS_OFFSET (0x40000000UL) 14 + #define PHYS_OFFSET UL(0x40000000) 15 15 16 16 /* 17 17 * Virtual view <-> DMA view memory address translations
+1 -1
include/asm-arm/arch-imx/memory.h
··· 21 21 #ifndef __ASM_ARCH_MMU_H 22 22 #define __ASM_ARCH_MMU_H 23 23 24 - #define PHYS_OFFSET (0x08000000UL) 24 + #define PHYS_OFFSET UL(0x08000000) 25 25 26 26 /* 27 27 * Virtual view <-> DMA view memory address translations
+2 -2
include/asm-arm/arch-integrator/memory.h
··· 23 23 /* 24 24 * Physical DRAM offset. 25 25 */ 26 - #define PHYS_OFFSET (0x00000000UL) 27 - #define BUS_OFFSET (0x80000000UL) 26 + #define PHYS_OFFSET UL(0x00000000) 27 + #define BUS_OFFSET UL(0x80000000) 28 28 29 29 /* 30 30 * Virtual view <-> DMA view memory address translations
+2 -2
include/asm-arm/arch-iop3xx/memory.h
··· 12 12 * Physical DRAM offset. 13 13 */ 14 14 #ifndef CONFIG_ARCH_IOP331 15 - #define PHYS_OFFSET (0xa0000000UL) 15 + #define PHYS_OFFSET UL(0xa0000000) 16 16 #else 17 - #define PHYS_OFFSET (0x00000000UL) 17 + #define PHYS_OFFSET UL(0x00000000) 18 18 #endif 19 19 20 20 /*
+1 -1
include/asm-arm/arch-ixp2000/memory.h
··· 13 13 #ifndef __ASM_ARCH_MEMORY_H 14 14 #define __ASM_ARCH_MEMORY_H 15 15 16 - #define PHYS_OFFSET (0x00000000UL) 16 + #define PHYS_OFFSET UL(0x00000000) 17 17 18 18 /* 19 19 * Virtual view <-> DMA view memory address translations
+1 -1
include/asm-arm/arch-ixp4xx/memory.h
··· 12 12 /* 13 13 * Physical DRAM offset. 14 14 */ 15 - #define PHYS_OFFSET (0x00000000UL) 15 + #define PHYS_OFFSET UL(0x00000000) 16 16 17 17 #ifndef __ASSEMBLY__ 18 18
+1 -1
include/asm-arm/arch-l7200/memory.h
··· 15 15 /* 16 16 * Physical DRAM offset on the L7200 SDB. 17 17 */ 18 - #define PHYS_OFFSET (0xf0000000UL) 18 + #define PHYS_OFFSET UL(0xf0000000) 19 19 20 20 #define __virt_to_bus(x) __virt_to_phys(x) 21 21 #define __bus_to_virt(x) __phys_to_virt(x)
+1 -1
include/asm-arm/arch-lh7a40x/memory.h
··· 17 17 /* 18 18 * Physical DRAM offset. 19 19 */ 20 - #define PHYS_OFFSET (0xc0000000UL) 20 + #define PHYS_OFFSET UL(0xc0000000) 21 21 22 22 /* 23 23 * Virtual view <-> DMA view memory address translations
+3 -3
include/asm-arm/arch-omap/memory.h
··· 37 37 * Physical DRAM offset. 38 38 */ 39 39 #if defined(CONFIG_ARCH_OMAP1) 40 - #define PHYS_OFFSET (0x10000000UL) 40 + #define PHYS_OFFSET UL(0x10000000) 41 41 #elif defined(CONFIG_ARCH_OMAP2) 42 - #define PHYS_OFFSET (0x80000000UL) 42 + #define PHYS_OFFSET UL(0x80000000) 43 43 #endif 44 44 45 45 /* ··· 66 66 /* 67 67 * OMAP-1510 Local Bus address offset 68 68 */ 69 - #define OMAP1510_LB_OFFSET (0x30000000UL) 69 + #define OMAP1510_LB_OFFSET UL(0x30000000) 70 70 71 71 #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) 72 72 #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
+1 -1
include/asm-arm/arch-pxa/memory.h
··· 15 15 /* 16 16 * Physical DRAM offset. 17 17 */ 18 - #define PHYS_OFFSET (0xa0000000UL) 18 + #define PHYS_OFFSET UL(0xa0000000) 19 19 20 20 /* 21 21 * Virtual view <-> DMA view memory address translations
+1 -1
include/asm-arm/arch-rpc/memory.h
··· 21 21 /* 22 22 * Physical DRAM offset. 23 23 */ 24 - #define PHYS_OFFSET (0x10000000UL) 24 + #define PHYS_OFFSET UL(0x10000000) 25 25 26 26 /* 27 27 * These are exactly the same on the RiscPC as the
+2 -2
include/asm-arm/arch-s3c2410/memory.h
··· 28 28 * and at 0x0C000000 for S3C2400 29 29 */ 30 30 #ifdef CONFIG_CPU_S3C2400 31 - #define PHYS_OFFSET (0x0C000000UL) 31 + #define PHYS_OFFSET UL(0x0C000000) 32 32 #else 33 - #define PHYS_OFFSET (0x30000000UL) 33 + #define PHYS_OFFSET UL(0x30000000) 34 34 #endif 35 35 36 36 /*
+1 -1
include/asm-arm/arch-sa1100/memory.h
··· 13 13 /* 14 14 * Physical DRAM offset is 0xc0000000 on the SA1100 15 15 */ 16 - #define PHYS_OFFSET (0xc0000000UL) 16 + #define PHYS_OFFSET UL(0xc0000000) 17 17 18 18 #ifndef __ASSEMBLY__ 19 19
+1 -1
include/asm-arm/arch-shark/memory.h
··· 15 15 /* 16 16 * Physical DRAM offset. 17 17 */ 18 - #define PHYS_OFFSET (0x08000000UL) 18 + #define PHYS_OFFSET UL(0x08000000) 19 19 20 20 #ifndef __ASSEMBLY__ 21 21
+1 -1
include/asm-arm/arch-versatile/memory.h
··· 23 23 /* 24 24 * Physical DRAM offset. 25 25 */ 26 - #define PHYS_OFFSET (0x00000000UL) 26 + #define PHYS_OFFSET UL(0x00000000) 27 27 28 28 /* 29 29 * Virtual view <-> DMA view memory address translations
+14 -4
include/asm-arm/memory.h
··· 12 12 #ifndef __ASM_ARM_MEMORY_H 13 13 #define __ASM_ARM_MEMORY_H 14 14 15 + /* 16 + * Allow for constants defined here to be used from assembly code 17 + * by prepending the UL suffix only with actual C code compilation. 18 + */ 19 + #ifndef __ASSEMBLY__ 20 + #define UL(x) (x##UL) 21 + #else 22 + #define UL(x) (x) 23 + #endif 24 + 15 25 #include <linux/config.h> 16 26 #include <linux/compiler.h> 17 27 #include <asm/arch/memory.h> ··· 31 21 * TASK_SIZE - the maximum size of a user space task. 32 22 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area 33 23 */ 34 - #define TASK_SIZE (0xbf000000UL) 35 - #define TASK_UNMAPPED_BASE (0x40000000UL) 24 + #define TASK_SIZE UL(0xbf000000) 25 + #define TASK_UNMAPPED_BASE UL(0x40000000) 36 26 #endif 37 27 38 28 /* 39 29 * The maximum size of a 26-bit user space task. 40 30 */ 41 - #define TASK_SIZE_26 (0x04000000UL) 31 + #define TASK_SIZE_26 UL(0x04000000) 42 32 43 33 /* 44 34 * Page offset: 3GB 45 35 */ 46 36 #ifndef PAGE_OFFSET 47 - #define PAGE_OFFSET (0xc0000000UL) 37 + #define PAGE_OFFSET UL(0xc0000000) 48 38 #endif 49 39 50 40 /*