Commit f09b9979 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Russell King

[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: default avatarNicolas Pitre <nico@cam.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent c514e58c
...@@ -94,7 +94,6 @@ int main(void) ...@@ -94,7 +94,6 @@ int main(void)
DEFINE(VM_EXEC, VM_EXEC); DEFINE(VM_EXEC, VM_EXEC);
BLANK(); BLANK();
DEFINE(PAGE_SZ, PAGE_SIZE); DEFINE(PAGE_SZ, PAGE_SIZE);
DEFINE(VIRT_OFFSET, PAGE_OFFSET);
BLANK(); BLANK();
DEFINE(SYS_ERROR0, 0x9f0000); DEFINE(SYS_ERROR0, 0x9f0000);
BLANK(); BLANK();
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <asm/memory.h>
#include <asm/glue.h> #include <asm/glue.h>
#include <asm/vfpmacros.h> #include <asm/vfpmacros.h>
#include <asm/hardware.h> /* should be moved into entry-macro.S */ #include <asm/hardware.h> /* should be moved into entry-macro.S */
...@@ -310,7 +311,7 @@ __pabt_svc: ...@@ -310,7 +311,7 @@ __pabt_svc:
#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) #if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
@ make sure our user space atomic helper is aborted @ make sure our user space atomic helper is aborted
cmp r2, #VIRT_OFFSET cmp r2, #TASK_SIZE
bichs r3, r3, #PSR_Z_BIT bichs r3, r3, #PSR_Z_BIT
#endif #endif
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/procinfo.h> #include <asm/procinfo.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/memory.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -76,7 +77,7 @@ ...@@ -76,7 +77,7 @@
.equ swapper_pg_dir, DATAADDR - 0x4000 .equ swapper_pg_dir, DATAADDR - 0x4000
.macro pgtbl, rd, phys .macro pgtbl, rd, phys
ldr \rd, =((DATAADDR - 0x4000) - VIRT_OFFSET) ldr \rd, =((DATAADDR - 0x4000) - PAGE_OFFSET)
add \rd, \rd, \phys add \rd, \rd, \phys
.endm .endm
#endif #endif
...@@ -324,7 +325,7 @@ __create_page_tables: ...@@ -324,7 +325,7 @@ __create_page_tables:
/* /*
* Then map first 1MB of ram in case it contains our boot params. * Then map first 1MB of ram in case it contains our boot params.
*/ */
add r0, r4, #VIRT_OFFSET >> 18 add r0, r4, #PAGE_OFFSET >> 18
orr r6, r5, r7 orr r6, r5, r7
str r6, [r0] str r6, [r0]
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/config.h> #include <linux/config.h>
#define PHYS_OFFSET (0xf0000000UL) #define PHYS_OFFSET UL(0xf0000000)
#define __virt_to_bus(x) __virt_to_phys(x) #define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x) #define __bus_to_virt(x) __phys_to_virt(x)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x10000000UL) #define PHYS_OFFSET UL(0x10000000)
/* /*
* These are exactly the same on the RiscPC as the * These are exactly the same on the RiscPC as the
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0xc0000000UL) #define PHYS_OFFSET UL(0xc0000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET UL(0x00000000)
/* /*
* We keep this 1:1 so that we don't interfere * We keep this 1:1 so that we don't interfere
......
...@@ -46,14 +46,14 @@ extern unsigned long __bus_to_virt(unsigned long); ...@@ -46,14 +46,14 @@ extern unsigned long __bus_to_virt(unsigned long);
#if defined(CONFIG_ARCH_FOOTBRIDGE) #if defined(CONFIG_ARCH_FOOTBRIDGE)
/* Task size and page offset at 3GB */ /* Task size and page offset at 3GB */
#define TASK_SIZE (0xbf000000UL) #define TASK_SIZE UL(0xbf000000)
#define PAGE_OFFSET (0xc0000000UL) #define PAGE_OFFSET UL(0xc0000000)
#elif defined(CONFIG_ARCH_CO285) #elif defined(CONFIG_ARCH_CO285)
/* Task size and page offset at 1.5GB */ /* Task size and page offset at 1.5GB */
#define TASK_SIZE (0x5f000000UL) #define TASK_SIZE UL(0x5f000000)
#define PAGE_OFFSET (0x60000000UL) #define PAGE_OFFSET UL(0x60000000)
#else #else
...@@ -64,7 +64,7 @@ extern unsigned long __bus_to_virt(unsigned long); ...@@ -64,7 +64,7 @@ extern unsigned long __bus_to_virt(unsigned long);
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET UL(0x00000000)
/* /*
* This decides where the kernel will search for a free chunk of vm * This decides where the kernel will search for a free chunk of vm
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET UL(0x00000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* Page offset: * Page offset:
* ( 0xc0000000UL ) * ( 0xc0000000UL )
*/ */
#define PHYS_OFFSET (0x40000000UL) #define PHYS_OFFSET UL(0x40000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#ifndef __ASM_ARCH_MMU_H #ifndef __ASM_ARCH_MMU_H
#define __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H
#define PHYS_OFFSET (0x08000000UL) #define PHYS_OFFSET UL(0x08000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET UL(0x00000000)
#define BUS_OFFSET (0x80000000UL) #define BUS_OFFSET UL(0x80000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#ifndef CONFIG_ARCH_IOP331 #ifndef CONFIG_ARCH_IOP331
#define PHYS_OFFSET (0xa0000000UL) #define PHYS_OFFSET UL(0xa0000000)
#else #else
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET UL(0x00000000)
#endif #endif
/* /*
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#ifndef __ASM_ARCH_MEMORY_H #ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET UL(0x00000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET UL(0x00000000)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/* /*
* Physical DRAM offset on the L7200 SDB. * Physical DRAM offset on the L7200 SDB.
*/ */
#define PHYS_OFFSET (0xf0000000UL) #define PHYS_OFFSET UL(0xf0000000)
#define __virt_to_bus(x) __virt_to_phys(x) #define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x) #define __bus_to_virt(x) __phys_to_virt(x)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0xc0000000UL) #define PHYS_OFFSET UL(0xc0000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#if defined(CONFIG_ARCH_OMAP1) #if defined(CONFIG_ARCH_OMAP1)
#define PHYS_OFFSET (0x10000000UL) #define PHYS_OFFSET UL(0x10000000)
#elif defined(CONFIG_ARCH_OMAP2) #elif defined(CONFIG_ARCH_OMAP2)
#define PHYS_OFFSET (0x80000000UL) #define PHYS_OFFSET UL(0x80000000)
#endif #endif
/* /*
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
/* /*
* OMAP-1510 Local Bus address offset * OMAP-1510 Local Bus address offset
*/ */
#define OMAP1510_LB_OFFSET (0x30000000UL) #define OMAP1510_LB_OFFSET UL(0x30000000)
#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0xa0000000UL) #define PHYS_OFFSET UL(0xa0000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x10000000UL) #define PHYS_OFFSET UL(0x10000000)
/* /*
* These are exactly the same on the RiscPC as the * These are exactly the same on the RiscPC as the
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
* and at 0x0C000000 for S3C2400 * and at 0x0C000000 for S3C2400
*/ */
#ifdef CONFIG_CPU_S3C2400 #ifdef CONFIG_CPU_S3C2400
#define PHYS_OFFSET (0x0C000000UL) #define PHYS_OFFSET UL(0x0C000000)
#else #else
#define PHYS_OFFSET (0x30000000UL) #define PHYS_OFFSET UL(0x30000000)
#endif #endif
/* /*
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/* /*
* Physical DRAM offset is 0xc0000000 on the SA1100 * Physical DRAM offset is 0xc0000000 on the SA1100
*/ */
#define PHYS_OFFSET (0xc0000000UL) #define PHYS_OFFSET UL(0xc0000000)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x08000000UL) #define PHYS_OFFSET UL(0x08000000)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#define PHYS_OFFSET (0x00000000UL) #define PHYS_OFFSET UL(0x00000000)
/* /*
* Virtual view <-> DMA view memory address translations * Virtual view <-> DMA view memory address translations
......
...@@ -12,6 +12,16 @@ ...@@ -12,6 +12,16 @@
#ifndef __ASM_ARM_MEMORY_H #ifndef __ASM_ARM_MEMORY_H
#define __ASM_ARM_MEMORY_H #define __ASM_ARM_MEMORY_H
/*
* Allow for constants defined here to be used from assembly code
* by prepending the UL suffix only with actual C code compilation.
*/
#ifndef __ASSEMBLY__
#define UL(x) (x##UL)
#else
#define UL(x) (x)
#endif
#include <linux/config.h> #include <linux/config.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <asm/arch/memory.h> #include <asm/arch/memory.h>
...@@ -21,20 +31,20 @@ ...@@ -21,20 +31,20 @@
* TASK_SIZE - the maximum size of a user space task. * TASK_SIZE - the maximum size of a user space task.
* TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
*/ */
#define TASK_SIZE (0xbf000000UL) #define TASK_SIZE UL(0xbf000000)
#define TASK_UNMAPPED_BASE (0x40000000UL) #define TASK_UNMAPPED_BASE UL(0x40000000)
#endif #endif
/* /*
* The maximum size of a 26-bit user space task. * The maximum size of a 26-bit user space task.
*/ */
#define TASK_SIZE_26 (0x04000000UL) #define TASK_SIZE_26 UL(0x04000000)
/* /*
* Page offset: 3GB * Page offset: 3GB
*/ */
#ifndef PAGE_OFFSET #ifndef PAGE_OFFSET
#define PAGE_OFFSET (0xc0000000UL) #define PAGE_OFFSET UL(0xc0000000)
#endif #endif
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment