···22# Makefile for the linux kernel.33#4455-AFLAGS_head.o := -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR)55+AFLAGS_head.o := -DKERNEL_RAM_ADDR=$(TEXTADDR)6677# Object file lists.88
···1515 */1616#include <linux/config.h>17171818+#include <asm/memory.h>1819#include <asm/glue.h>1920#include <asm/vfpmacros.h>2021#include <asm/hardware.h> /* should be moved into entry-macro.S */···311310312311#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)313312 @ make sure our user space atomic helper is aborted314314- cmp r2, #VIRT_OFFSET313313+ cmp r2, #TASK_SIZE315314 bichs r3, r3, #PSR_Z_BIT316315#endif317316
+17-40
arch/arm/kernel/head.S
···2121#include <asm/procinfo.h>2222#include <asm/ptrace.h>2323#include <asm/asm-offsets.h>2424+#include <asm/memory.h>2425#include <asm/thread_info.h>2526#include <asm/system.h>2627···3433#define MACHINFO_PGOFFIO 123534#define MACHINFO_NAME 1636353737-#ifndef CONFIG_XIP_KERNEL3836/*3939- * We place the page tables 16K below TEXTADDR. Therefore, we must make sure4040- * that TEXTADDR is correctly set. Currently, we expect the least significant4141- * 16 bits to be 0x8000, but we could probably relax this restriction to4242- * TEXTADDR >= PAGE_OFFSET + 0x40004343- *4444- * Note that swapper_pg_dir is the virtual address of the page tables, and4545- * pgtbl gives us a position-independent reference to these tables. We can4646- * do this because stext == TEXTADDR3737+ * swapper_pg_dir is the virtual address of the initial page table.3838+ * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must3939+ * make sure that KERNEL_RAM_ADDR is correctly set. Currently, we expect4040+ * the least significant 16 bits to be 0x8000, but we could probably4141+ * relax this restriction to KERNEL_RAM_ADDR >= PAGE_OFFSET + 0x4000.4742 */4848-#if (TEXTADDR & 0xffff) != 0x80004949-#error TEXTADDR must start at 0xXXXX80004343+#if (KERNEL_RAM_ADDR & 0xffff) != 0x80004444+#error KERNEL_RAM_ADDR must start at 0xXXXX80005045#endif51465247 .globl swapper_pg_dir5353- .equ swapper_pg_dir, TEXTADDR - 0x40004848+ .equ swapper_pg_dir, KERNEL_RAM_ADDR - 0x400054495555- .macro pgtbl, rd, phys5656- adr \rd, stext5757- sub \rd, \rd, #0x40005050+ .macro pgtbl, rd5151+ ldr \rd, =(__virt_to_phys(KERNEL_RAM_ADDR - 0x4000))5852 .endm5353+5454+#ifdef CONFIG_XIP_KERNEL5555+#define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)5956#else6060-/*6161- * XIP Kernel:6262- *6363- * We place the page tables 16K below DATAADDR. Therefore, we must make sure6464- * that DATAADDR is correctly set. Currently, we expect the least significant6565- * 16 bits to be 0x8000, but we could probably relax this restriction to6666- * DATAADDR >= PAGE_OFFSET + 0x40006767- *6868- * Note that pgtbl is meant to return the physical address of swapper_pg_dir.6969- * We can't make it relative to the kernel position in this case since7070- * the kernel can physically be anywhere.7171- */7272-#if (DATAADDR & 0xffff) != 0x80007373-#error DATAADDR must start at 0xXXXX80007474-#endif7575-7676- .globl swapper_pg_dir7777- .equ swapper_pg_dir, DATAADDR - 0x40007878-7979- .macro pgtbl, rd, phys8080- ldr \rd, =((DATAADDR - 0x4000) - VIRT_OFFSET)8181- add \rd, \rd, \phys8282- .endm5757+#define TEXTADDR KERNEL_RAM_ADDR8358#endif84598560/*···256279 .type __create_page_tables, %function257280__create_page_tables:258281 ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram259259- pgtbl r4, r5 @ page table address282282+ pgtbl r4 @ page table address260283261284 /*262285 * Clear the 16K level 1 swapper page table···301324 /*302325 * Then map first 1MB of ram in case it contains our boot params.303326 */304304- add r0, r4, #VIRT_OFFSET >> 18327327+ add r0, r4, #PAGE_OFFSET >> 18305328 orr r6, r5, r7306329 str r6, [r0]307330
···1717/*1818 * Physical DRAM offset.1919 */2020-#define PHYS_OFFSET (0x10000000UL)2020+#define PHYS_OFFSET UL(0x10000000)21212222/*2323 * These are exactly the same on the RiscPC as the
···1919/*2020 * Physical DRAM offset.2121 */2222-#define PHYS_OFFSET (0x00000000UL)2222+#define PHYS_OFFSET UL(0x00000000)23232424/*2525 * We keep this 1:1 so that we don't interfere
+5-5
include/asm-arm/arch-ebsa285/memory.h
···4646#if defined(CONFIG_ARCH_FOOTBRIDGE)47474848/* Task size and page offset at 3GB */4949-#define TASK_SIZE (0xbf000000UL)5050-#define PAGE_OFFSET (0xc0000000UL)4949+#define TASK_SIZE UL(0xbf000000)5050+#define PAGE_OFFSET UL(0xc0000000)51515252#elif defined(CONFIG_ARCH_CO285)53535454/* Task size and page offset at 1.5GB */5555-#define TASK_SIZE (0x5f000000UL)5656-#define PAGE_OFFSET (0x60000000UL)5555+#define TASK_SIZE UL(0x5f000000)5656+#define PAGE_OFFSET UL(0x60000000)57575858#else5959···6464/*6565 * Physical DRAM offset.6666 */6767-#define PHYS_OFFSET (0x00000000UL)6767+#define PHYS_OFFSET UL(0x00000000)68686969/*7070 * This decides where the kernel will search for a free chunk of vm
···15151616#ifndef __ASSEMBLY__17171818-/*1919- * The IXP2400 B0 silicon contains an erratum (#66) that causes writes2020- * to on-chip I/O register to not complete fully. What this means is2121- * that if you have a write to on-chip I/O followed by a back-to-back2222- * read or write, the first write will happen twice. OR...if it's2323- * not a back-to-back transaction, the read or write will generate2424- * incorrect data.2525- *2626- * The official work around for this is to set the on-chip I/O regions2727- * as XCB=101 and then force a read-back from the register.2828- *2929- */3030-#if defined(CONFIG_ARCH_ENP2611) || defined(CONFIG_ARCH_IXDP2400) || defined(CONFIG_ARCH_IXDP2401)3131-3232-#include <asm/system.h> /* Pickup local_irq_ functions */1818+static inline unsigned long ixp2000_reg_read(volatile void *reg)1919+{2020+ return *((volatile unsigned long *)reg);2121+}33223423static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)2424+{2525+ *((volatile unsigned long *)reg) = val;2626+}2727+2828+/*2929+ * On the IXP2400, we can't use XCB=000 due to chip bugs. We use3030+ * XCB=101 instead, but that makes all I/O accesses bufferable. This3131+ * is not a problem in general, but we do have to be slightly more3232+ * careful because I/O writes are no longer automatically flushed out3333+ * of the write buffer.3434+ *3535+ * In cases where we want to make sure that a write has been flushed3636+ * out of the write buffer before we proceed, for example when masking3737+ * a device interrupt before re-enabling IRQs in CPSR, we can use this3838+ * function, ixp2000_reg_wrb, which performs a write, a readback, and3939+ * issues a dummy instruction dependent on the value of the readback4040+ * (mov rX, rX) to make sure that the readback has completed before we4141+ * continue.4242+ */4343+static inline void ixp2000_reg_wrb(volatile void *reg, unsigned long val)3544{3645 unsigned long dummy;3737- unsigned long flags;38463939- local_irq_save(flags);4047 *((volatile unsigned long *)reg) = val;4141- barrier();4848+4249 dummy = *((volatile unsigned long *)reg);4343- local_irq_restore(flags);5050+ __asm__ __volatile__("mov %0, %0" : "+r" (dummy));4451}4545-#else4646-static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)4747-{4848- *((volatile unsigned long *)reg) = val;4949-}5050-#endif /* IXDP2400 || IXDP2401 */5151-#define ixp2000_reg_read(reg) (*((volatile unsigned long *)reg))52525353/*5454 * Boards may multiplex different devices on the 2nd channel of
···2121/*2222 * Physical DRAM offset.2323 */2424-#define PHYS_OFFSET (0x10000000UL)2424+#define PHYS_OFFSET UL(0x10000000)25252626/*2727 * These are exactly the same on the RiscPC as the
+2-2
include/asm-arm/arch-s3c2410/memory.h
···2828 * and at 0x0C000000 for S3C24002929 */3030#ifdef CONFIG_CPU_S3C24003131-#define PHYS_OFFSET (0x0C000000UL)3131+#define PHYS_OFFSET UL(0x0C000000)3232#else3333-#define PHYS_OFFSET (0x30000000UL)3333+#define PHYS_OFFSET UL(0x30000000)3434#endif35353636/*
+1-1
include/asm-arm/arch-sa1100/memory.h
···1313/*1414 * Physical DRAM offset is 0xc0000000 on the SA11001515 */1616-#define PHYS_OFFSET (0xc0000000UL)1616+#define PHYS_OFFSET UL(0xc0000000)17171818#ifndef __ASSEMBLY__1919
···14141515/*1616 * map_name: the map probe function name1717+ * name: flash device name (eg, as used with mtdparts=)1718 * width: width of mapped device1819 * init: method called at driver/device initialisation1920 * exit: method called at driver/device removal···2423 */2524struct flash_platform_data {2625 const char *map_name;2626+ const char *name;2727 unsigned int width;2828 int (*init)(void);2929 void (*exit)(void);
···1212#ifndef __ASM_ARM_MEMORY_H1313#define __ASM_ARM_MEMORY_H14141515+/*1616+ * Allow for constants defined here to be used from assembly code1717+ * by prepending the UL suffix only with actual C code compilation.1818+ */1919+#ifndef __ASSEMBLY__2020+#define UL(x) (x##UL)2121+#else2222+#define UL(x) (x)2323+#endif2424+1525#include <linux/config.h>1626#include <linux/compiler.h>1727#include <asm/arch/memory.h>···3121 * TASK_SIZE - the maximum size of a user space task.3222 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area3323 */3434-#define TASK_SIZE (0xbf000000UL)3535-#define TASK_UNMAPPED_BASE (0x40000000UL)2424+#define TASK_SIZE UL(0xbf000000)2525+#define TASK_UNMAPPED_BASE UL(0x40000000)3626#endif37273828/*3929 * The maximum size of a 26-bit user space task.4030 */4141-#define TASK_SIZE_26 (0x04000000UL)3131+#define TASK_SIZE_26 UL(0x04000000)42324333/*4434 * Page offset: 3GB4535 */4636#ifndef PAGE_OFFSET4747-#define PAGE_OFFSET (0xc0000000UL)3737+#define PAGE_OFFSET UL(0xc0000000)4838#endif49395040/*···6757#if TASK_SIZE > MODULE_START6858#error Top of user space clashes with start of module space6959#endif6060+6161+/*6262+ * The XIP kernel gets mapped at the bottom of the module vm area.6363+ * Since we use sections to map it, this macro replaces the physical address6464+ * with its virtual address while keeping offset from the base section.6565+ */6666+#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))70677168#ifndef __ASSEMBLY__7269