aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorBarry Song <barry.song@analog.com>2010-01-06 23:11:17 -0500
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:48 -0500
commitd86bfb1600db38e8387beee0aaab4263cfd728a2 (patch)
tree95e6f3d77d6dede480d74a7a4b87f2794a5b31fe /arch/blackfin
parentaad16f32284030907b4f105e92e5fb534fd272bc (diff)
Blackfin: initial XIP support
Signed-off-by: Barry Song <barry.song@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r--arch/blackfin/Kconfig16
-rw-r--r--arch/blackfin/Makefile6
-rw-r--r--arch/blackfin/boot/Makefile23
-rw-r--r--arch/blackfin/include/asm/context.S10
-rw-r--r--arch/blackfin/include/asm/sections.h3
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbinit.c9
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c9
-rw-r--r--arch/blackfin/kernel/entry.S8
-rw-r--r--arch/blackfin/kernel/setup.c16
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S57
-rw-r--r--arch/blackfin/mach-common/entry.S17
-rw-r--r--arch/blackfin/mach-common/head.S5
-rw-r--r--arch/blackfin/mach-common/interrupt.S10
13 files changed, 160 insertions, 29 deletions
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index c0d6d966adec..f46db59eac8a 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -26,9 +26,9 @@ config BLACKFIN
26 select HAVE_FUNCTION_GRAPH_TRACER 26 select HAVE_FUNCTION_GRAPH_TRACER
27 select HAVE_FUNCTION_TRACER 27 select HAVE_FUNCTION_TRACER
28 select HAVE_IDE 28 select HAVE_IDE
29 select HAVE_KERNEL_GZIP 29 select HAVE_KERNEL_GZIP if RAMKERNEL
30 select HAVE_KERNEL_BZIP2 30 select HAVE_KERNEL_BZIP2 if RAMKERNEL
31 select HAVE_KERNEL_LZMA 31 select HAVE_KERNEL_LZMA if RAMKERNEL
32 select HAVE_OPROFILE 32 select HAVE_OPROFILE
33 select ARCH_WANT_OPTIONAL_GPIOLIB 33 select ARCH_WANT_OPTIONAL_GPIOLIB
34 34
@@ -407,10 +407,18 @@ config BOOT_LOAD
407config ROM_BASE 407config ROM_BASE
408 hex "Kernel ROM Base" 408 hex "Kernel ROM Base"
409 depends on ROMKERNEL 409 depends on ROMKERNEL
410 default "0x20040000" 410 default "0x20040040"
411 range 0x20000000 0x20400000 if !(BF54x || BF561) 411 range 0x20000000 0x20400000 if !(BF54x || BF561)
412 range 0x20000000 0x30000000 if (BF54x || BF561) 412 range 0x20000000 0x30000000 if (BF54x || BF561)
413 help 413 help
414 Make sure your ROM base does not include any file-header
415 information that is prepended to the kernel.
416
417 For example, the bootable U-Boot format (created with
418 mkimage) has a 64 byte header (0x40). So while the image
419 you write to flash might start at say 0x20080000, you have
420 to add 0x40 to get the kernel's ROM base as it will come
421 after the header.
414 422
415comment "Clock/PLL Setup" 423comment "Clock/PLL Setup"
416 424
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index d4c7177e7656..ba84206d0554 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -14,6 +14,9 @@ OBJCOPYFLAGS := -O binary -R .note -R .comment -S
14GZFLAGS := -9 14GZFLAGS := -9
15 15
16KBUILD_CFLAGS += $(call cc-option,-mno-fdpic) 16KBUILD_CFLAGS += $(call cc-option,-mno-fdpic)
17ifeq ($(CONFIG_ROMKERNEL),y)
18KBUILD_CFLAGS += -mlong-calls
19endif
17KBUILD_AFLAGS += $(call cc-option,-mno-fdpic) 20KBUILD_AFLAGS += $(call cc-option,-mno-fdpic)
18CFLAGS_MODULE += -mlong-calls 21CFLAGS_MODULE += -mlong-calls
19LDFLAGS_MODULE += -m elf32bfin 22LDFLAGS_MODULE += -m elf32bfin
@@ -138,7 +141,7 @@ archclean:
138 141
139INSTALL_PATH ?= /tftpboot 142INSTALL_PATH ?= /tftpboot
140boot := arch/$(ARCH)/boot 143boot := arch/$(ARCH)/boot
141BOOT_TARGETS = vmImage vmImage.bin vmImage.bz2 vmImage.gz vmImage.lzma 144BOOT_TARGETS = vmImage vmImage.bin vmImage.bz2 vmImage.gz vmImage.lzma vmImage.xip
142PHONY += $(BOOT_TARGETS) install 145PHONY += $(BOOT_TARGETS) install
143KBUILD_IMAGE := $(boot)/vmImage 146KBUILD_IMAGE := $(boot)/vmImage
144 147
@@ -156,6 +159,7 @@ define archhelp
156 echo ' vmImage.bz2 - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.bz2)' 159 echo ' vmImage.bz2 - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.bz2)'
157 echo '* vmImage.gz - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)' 160 echo '* vmImage.gz - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)'
158 echo ' vmImage.lzma - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)' 161 echo ' vmImage.lzma - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)'
162 echo ' vmImage.xip - XIP Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.xip)'
159 echo ' install - Install kernel using' 163 echo ' install - Install kernel using'
160 echo ' (your) ~/bin/$(INSTALLKERNEL) or' 164 echo ' (your) ~/bin/$(INSTALLKERNEL) or'
161 echo ' (distribution) PATH: $(INSTALLKERNEL) or' 165 echo ' (distribution) PATH: $(INSTALLKERNEL) or'
diff --git a/arch/blackfin/boot/Makefile b/arch/blackfin/boot/Makefile
index e9c48c6f8c1f..d1b3d6051fdf 100644
--- a/arch/blackfin/boot/Makefile
+++ b/arch/blackfin/boot/Makefile
@@ -8,14 +8,18 @@
8 8
9MKIMAGE := $(srctree)/scripts/mkuboot.sh 9MKIMAGE := $(srctree)/scripts/mkuboot.sh
10 10
11targets := vmImage vmImage.bin vmImage.bz2 vmImage.gz vmImage.lzma 11targets := vmImage vmImage.bin vmImage.bz2 vmImage.gz vmImage.lzma vmImage.xip
12extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma 12extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xip
13
14UIMAGE_OPTS-y :=
15UIMAGE_OPTS-$(CONFIG_RAMKERNEL) += -a $(CONFIG_BOOT_LOAD)
16UIMAGE_OPTS-$(CONFIG_ROMKERNEL) += -a $(CONFIG_ROM_BASE) -x
13 17
14quiet_cmd_uimage = UIMAGE $@ 18quiet_cmd_uimage = UIMAGE $@
15 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(ARCH) -O linux -T kernel \ 19 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(ARCH) -O linux -T kernel \
16 -C $(2) -n '$(MACHINE)-$(KERNELRELEASE)' -a $(CONFIG_BOOT_LOAD) \ 20 -C $(2) -n '$(MACHINE)-$(KERNELRELEASE)' \
17 -e $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}') \ 21 -e $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}') \
18 -d $< $@ 22 $(UIMAGE_OPTS-y) -d $< $@
19 23
20$(obj)/vmlinux.bin: vmlinux FORCE 24$(obj)/vmlinux.bin: vmlinux FORCE
21 $(call if_changed,objcopy) 25 $(call if_changed,objcopy)
@@ -29,6 +33,12 @@ $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
29$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE 33$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
30 $(call if_changed,lzma) 34 $(call if_changed,lzma)
31 35
36# The mkimage tool wants 64bytes prepended to the image
37quiet_cmd_mk_bin_xip = BIN $@
38 cmd_mk_bin_xip = ( printf '%64s' | tr ' ' '\377' ; cat $< ) > $@
39$(obj)/vmlinux.bin.xip: $(obj)/vmlinux.bin FORCE
40 $(call if_changed,mk_bin_xip)
41
32$(obj)/vmImage.bin: $(obj)/vmlinux.bin 42$(obj)/vmImage.bin: $(obj)/vmlinux.bin
33 $(call if_changed,uimage,none) 43 $(call if_changed,uimage,none)
34 44
@@ -41,10 +51,15 @@ $(obj)/vmImage.gz: $(obj)/vmlinux.bin.gz
41$(obj)/vmImage.lzma: $(obj)/vmlinux.bin.lzma 51$(obj)/vmImage.lzma: $(obj)/vmlinux.bin.lzma
42 $(call if_changed,uimage,lzma) 52 $(call if_changed,uimage,lzma)
43 53
54$(obj)/vmImage.xip: $(obj)/vmlinux.bin.xip
55 $(call if_changed,uimage,none)
56
44suffix-y := bin 57suffix-y := bin
45suffix-$(CONFIG_KERNEL_GZIP) := gz 58suffix-$(CONFIG_KERNEL_GZIP) := gz
46suffix-$(CONFIG_KERNEL_BZIP2) := bz2 59suffix-$(CONFIG_KERNEL_BZIP2) := bz2
47suffix-$(CONFIG_KERNEL_LZMA) := lzma 60suffix-$(CONFIG_KERNEL_LZMA) := lzma
61suffix-$(CONFIG_ROMKERNEL) := xip
62
48$(obj)/vmImage: $(obj)/vmImage.$(suffix-y) 63$(obj)/vmImage: $(obj)/vmImage.$(suffix-y)
49 @ln -sf $(notdir $<) $@ 64 @ln -sf $(notdir $<) $@
50 65
diff --git a/arch/blackfin/include/asm/context.S b/arch/blackfin/include/asm/context.S
index 5dffaf582a22..fada8e974a73 100644
--- a/arch/blackfin/include/asm/context.S
+++ b/arch/blackfin/include/asm/context.S
@@ -374,3 +374,13 @@
374 374
375 (R7:0, P5:0) = [SP++]; 375 (R7:0, P5:0) = [SP++];
376.endm 376.endm
377
378.macro pseudo_long_call func:req, scratch:req
379#ifdef CONFIG_ROMKERNEL
380 \scratch\().l = \func;
381 \scratch\().h = \func;
382 call (\scratch);
383#else
384 call \func;
385#endif
386.endm
diff --git a/arch/blackfin/include/asm/sections.h b/arch/blackfin/include/asm/sections.h
index 42f6c53c59c6..14a3e66d9167 100644
--- a/arch/blackfin/include/asm/sections.h
+++ b/arch/blackfin/include/asm/sections.h
@@ -21,6 +21,9 @@ extern unsigned long memory_start, memory_end, physical_mem_end;
21extern char _stext_l1[], _etext_l1[], _text_l1_lma[], __weak _text_l1_len[]; 21extern char _stext_l1[], _etext_l1[], _text_l1_lma[], __weak _text_l1_len[];
22extern char _sdata_l1[], _edata_l1[], _sbss_l1[], _ebss_l1[], 22extern char _sdata_l1[], _edata_l1[], _sbss_l1[], _ebss_l1[],
23 _data_l1_lma[], __weak _data_l1_len[]; 23 _data_l1_lma[], __weak _data_l1_len[];
24#ifdef CONFIG_ROMKERNEL
25extern char _data_lma[], _data_len[], _sinitdata[], _einitdata[], _init_data_lma[], _init_data_len[];
26#endif
24extern char _sdata_b_l1[], _edata_b_l1[], _sbss_b_l1[], _ebss_b_l1[], 27extern char _sdata_b_l1[], _edata_b_l1[], _sbss_b_l1[], _ebss_b_l1[],
25 _data_b_l1_lma[], __weak _data_b_l1_len[]; 28 _data_b_l1_lma[], __weak _data_b_l1_len[];
26extern char _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], 29extern char _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[],
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinit.c b/arch/blackfin/kernel/cplb-mpu/cplbinit.c
index 8d42b9e50dfa..30fd6417f069 100644
--- a/arch/blackfin/kernel/cplb-mpu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-mpu/cplbinit.c
@@ -64,6 +64,15 @@ void __init generate_cplb_tables_cpu(unsigned int cpu)
64 icplb_tbl[cpu][i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0); 64 icplb_tbl[cpu][i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0);
65 } 65 }
66 66
67#ifdef CONFIG_ROMKERNEL
68 /* Cover kernel XIP flash area */
69 addr = CONFIG_ROM_BASE & ~(4 * 1024 * 1024 - 1);
70 dcplb_tbl[cpu][i_d].addr = addr;
71 dcplb_tbl[cpu][i_d++].data = d_data | CPLB_USER_RD;
72 icplb_tbl[cpu][i_i].addr = addr;
73 icplb_tbl[cpu][i_i++].data = i_data | CPLB_USER_RD;
74#endif
75
67 /* Cover L1 memory. One 4M area for code and data each is enough. */ 76 /* Cover L1 memory. One 4M area for code and data each is enough. */
68#if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0 77#if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0
69 dcplb_tbl[cpu][i_d].addr = get_l1_data_a_start_cpu(cpu); 78 dcplb_tbl[cpu][i_d].addr = get_l1_data_a_start_cpu(cpu);
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index 282a7919821b..bfe75af4e8bd 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -56,6 +56,15 @@ void __init generate_cplb_tables_cpu(unsigned int cpu)
56 i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB; 56 i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB;
57 } 57 }
58 58
59#ifdef CONFIG_ROMKERNEL
60 /* Cover kernel XIP flash area */
61 addr = CONFIG_ROM_BASE & ~(4 * 1024 * 1024 - 1);
62 d_tbl[i_d].addr = addr;
63 d_tbl[i_d++].data = SDRAM_DGENERIC | PAGE_SIZE_4MB;
64 i_tbl[i_i].addr = addr;
65 i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB;
66#endif
67
59 /* Cover L1 memory. One 4M area for code and data each is enough. */ 68 /* Cover L1 memory. One 4M area for code and data each is enough. */
60 if (cpu == 0) { 69 if (cpu == 0) {
61 if (L1_DATA_A_LENGTH || L1_DATA_B_LENGTH) { 70 if (L1_DATA_A_LENGTH || L1_DATA_B_LENGTH) {
diff --git a/arch/blackfin/kernel/entry.S b/arch/blackfin/kernel/entry.S
index f27dc2292e1b..686478f5f66b 100644
--- a/arch/blackfin/kernel/entry.S
+++ b/arch/blackfin/kernel/entry.S
@@ -44,7 +44,7 @@ ENTRY(_ret_from_fork)
44 sti r4; 44 sti r4;
45#endif /* CONFIG_IPIPE */ 45#endif /* CONFIG_IPIPE */
46 SP += -12; 46 SP += -12;
47 call _schedule_tail; 47 pseudo_long_call _schedule_tail, p5;
48 SP += 12; 48 SP += 12;
49 r0 = [sp + PT_IPEND]; 49 r0 = [sp + PT_IPEND];
50 cc = bittst(r0,1); 50 cc = bittst(r0,1);
@@ -79,7 +79,7 @@ ENTRY(_sys_vfork)
79 r0 += 24; 79 r0 += 24;
80 [--sp] = rets; 80 [--sp] = rets;
81 SP += -12; 81 SP += -12;
82 call _bfin_vfork; 82 pseudo_long_call _bfin_vfork, p2;
83 SP += 12; 83 SP += 12;
84 rets = [sp++]; 84 rets = [sp++];
85 rts; 85 rts;
@@ -90,7 +90,7 @@ ENTRY(_sys_clone)
90 r0 += 24; 90 r0 += 24;
91 [--sp] = rets; 91 [--sp] = rets;
92 SP += -12; 92 SP += -12;
93 call _bfin_clone; 93 pseudo_long_call _bfin_clone, p2;
94 SP += 12; 94 SP += 12;
95 rets = [sp++]; 95 rets = [sp++];
96 rts; 96 rts;
@@ -101,7 +101,7 @@ ENTRY(_sys_rt_sigreturn)
101 r0 += 24; 101 r0 += 24;
102 [--sp] = rets; 102 [--sp] = rets;
103 SP += -12; 103 SP += -12;
104 call _do_rt_sigreturn; 104 pseudo_long_call _do_rt_sigreturn, p2;
105 SP += 12; 105 SP += 12;
106 rets = [sp++]; 106 rets = [sp++];
107 rts; 107 rts;
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index a0bc7d3e1bff..b54ba45db5f1 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -220,6 +220,16 @@ void __init bfin_relocate_l1_mem(void)
220 memcpy(_stext_l2, _l2_lma, l2_len); 220 memcpy(_stext_l2, _l2_lma, l2_len);
221} 221}
222 222
223#ifdef CONFIG_ROMKERNEL
224void __init bfin_relocate_xip_data(void)
225{
226 early_shadow_stamp();
227
228 memcpy(_sdata, _data_lma, (unsigned long)_data_len - THREAD_SIZE + sizeof(struct thread_info));
229 memcpy(_sinitdata, _init_data_lma, (unsigned long)_init_data_len);
230}
231#endif
232
223/* add_memory_region to memmap */ 233/* add_memory_region to memmap */
224static void __init add_memory_region(unsigned long long start, 234static void __init add_memory_region(unsigned long long start,
225 unsigned long long size, int type) 235 unsigned long long size, int type)
@@ -504,7 +514,7 @@ static __init void memory_setup(void)
504#endif 514#endif
505 unsigned long max_mem; 515 unsigned long max_mem;
506 516
507 _rambase = (unsigned long)_stext; 517 _rambase = CONFIG_BOOT_LOAD;
508 _ramstart = (unsigned long)_end; 518 _ramstart = (unsigned long)_end;
509 519
510 if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) { 520 if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) {
@@ -1261,8 +1271,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1261 seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", 1271 seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n",
1262 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); 1272 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end);
1263 seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n", 1273 seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n",
1264 ((int)memory_end - (int)_stext) >> 10, 1274 ((int)memory_end - (int)_rambase) >> 10,
1265 _stext, 1275 (void *)_rambase,
1266 (void *)memory_end); 1276 (void *)memory_end);
1267 seq_printf(m, "\n"); 1277 seq_printf(m, "\n");
1268 1278
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index be4b1bbb3918..984c78172397 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -15,7 +15,12 @@ _jiffies = _jiffies_64;
15 15
16SECTIONS 16SECTIONS
17{ 17{
18#ifdef CONFIG_RAMKERNEL
18 . = CONFIG_BOOT_LOAD; 19 . = CONFIG_BOOT_LOAD;
20#else
21 . = CONFIG_ROM_BASE;
22#endif
23
19 /* Neither the text, ro_data or bss section need to be aligned 24 /* Neither the text, ro_data or bss section need to be aligned
20 * So pack them back to back 25 * So pack them back to back
21 */ 26 */
@@ -31,6 +36,12 @@ SECTIONS
31 LOCK_TEXT 36 LOCK_TEXT
32 IRQENTRY_TEXT 37 IRQENTRY_TEXT
33 KPROBES_TEXT 38 KPROBES_TEXT
39#ifdef CONFIG_ROMKERNEL
40 __sinittext = .;
41 INIT_TEXT
42 __einittext = .;
43 EXIT_TEXT
44#endif
34 *(.text.*) 45 *(.text.*)
35 *(.fixup) 46 *(.fixup)
36 47
@@ -50,8 +61,14 @@ SECTIONS
50 61
51 /* Just in case the first read only is a 32-bit access */ 62 /* Just in case the first read only is a 32-bit access */
52 RO_DATA(4) 63 RO_DATA(4)
64 __rodata_end = .;
53 65
66#ifdef CONFIG_ROMKERNEL
67 . = CONFIG_BOOT_LOAD;
68 .bss : AT(__rodata_end)
69#else
54 .bss : 70 .bss :
71#endif
55 { 72 {
56 . = ALIGN(4); 73 . = ALIGN(4);
57 ___bss_start = .; 74 ___bss_start = .;
@@ -67,7 +84,11 @@ SECTIONS
67 ___bss_stop = .; 84 ___bss_stop = .;
68 } 85 }
69 86
87#if defined(CONFIG_ROMKERNEL)
88 .data : AT(LOADADDR(.bss) + SIZEOF(.bss))
89#else
70 .data : 90 .data :
91#endif
71 { 92 {
72 __sdata = .; 93 __sdata = .;
73 /* This gets done first, so the glob doesn't suck it in */ 94 /* This gets done first, so the glob doesn't suck it in */
@@ -94,6 +115,8 @@ SECTIONS
94 115
95 __edata = .; 116 __edata = .;
96 } 117 }
118 __data_lma = LOADADDR(.data);
119 __data_len = SIZEOF(.data);
97 120
98 /* The init section should be last, so when we free it, it goes into 121 /* The init section should be last, so when we free it, it goes into
99 * the general memory pool, and (hopefully) will decrease fragmentation 122 * the general memory pool, and (hopefully) will decrease fragmentation
@@ -103,6 +126,7 @@ SECTIONS
103 . = ALIGN(PAGE_SIZE); 126 . = ALIGN(PAGE_SIZE);
104 ___init_begin = .; 127 ___init_begin = .;
105 128
129#ifdef CONFIG_RAMKERNEL
106 INIT_TEXT_SECTION(PAGE_SIZE) 130 INIT_TEXT_SECTION(PAGE_SIZE)
107 131
108 /* We have to discard exit text and such at runtime, not link time, to 132 /* We have to discard exit text and such at runtime, not link time, to
@@ -125,6 +149,35 @@ SECTIONS
125 } 149 }
126 150
127 .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data)) 151 .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data))
152#else
153 .init.data : AT(__data_lma + __data_len)
154 {
155 __sinitdata = .;
156 INIT_DATA
157 INIT_SETUP(16)
158 INIT_CALLS
159 CON_INITCALL
160 SECURITY_INITCALL
161 INIT_RAM_FS
162
163 . = ALIGN(4);
164 ___per_cpu_load = .;
165 ___per_cpu_start = .;
166 *(.data.percpu.first)
167 *(.data.percpu.page_aligned)
168 *(.data.percpu)
169 *(.data.percpu.shared_aligned)
170 ___per_cpu_end = .;
171
172 EXIT_DATA
173 __einitdata = .;
174 }
175 __init_data_lma = LOADADDR(.init.data);
176 __init_data_len = SIZEOF(.init.data);
177 __init_data_end = .;
178
179 .text_l1 L1_CODE_START : AT(__init_data_lma + __init_data_len)
180#endif
128 { 181 {
129 . = ALIGN(4); 182 . = ALIGN(4);
130 __stext_l1 = .; 183 __stext_l1 = .;
@@ -205,7 +258,11 @@ SECTIONS
205 /* Force trailing alignment of our init section so that when we 258 /* Force trailing alignment of our init section so that when we
206 * free our init memory, we don't leave behind a partial page. 259 * free our init memory, we don't leave behind a partial page.
207 */ 260 */
261#ifdef CONFIG_RAMKERNEL
208 . = __l2_lma + __l2_len; 262 . = __l2_lma + __l2_len;
263#else
264 . = __init_data_end;
265#endif
209 . = ALIGN(PAGE_SIZE); 266 . = ALIGN(PAGE_SIZE);
210 ___init_end = .; 267 ___init_end = .;
211 268
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 0df7ef200f9d..ccfa7c490ff9 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -405,7 +405,7 @@ ENTRY(_double_fault)
405 405
406 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ 406 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
407 SP += -12; 407 SP += -12;
408 call _double_fault_c; 408 pseudo_long_call _double_fault_c, p5;
409 SP += 12; 409 SP += 12;
410.L_double_fault_panic: 410.L_double_fault_panic:
411 JUMP .L_double_fault_panic 411 JUMP .L_double_fault_panic
@@ -447,7 +447,7 @@ ENTRY(_exception_to_level5)
447 447
448 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ 448 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
449 SP += -12; 449 SP += -12;
450 call _trap_c; 450 pseudo_long_call _trap_c, p4;
451 SP += 12; 451 SP += 12;
452 452
453 /* If interrupts were off during the exception (IPEND[4] = 1), turn them off 453 /* If interrupts were off during the exception (IPEND[4] = 1), turn them off
@@ -551,7 +551,7 @@ ENTRY(_kernel_execve)
551 p0 = sp; 551 p0 = sp;
552 sp += -16; 552 sp += -16;
553 [sp + 12] = p0; 553 [sp + 12] = p0;
554 call _do_execve; 554 pseudo_long_call _do_execve, p5;
555 SP += 16; 555 SP += 16;
556 cc = r0 == 0; 556 cc = r0 == 0;
557 if ! cc jump .Lexecve_failed; 557 if ! cc jump .Lexecve_failed;
@@ -704,7 +704,7 @@ ENTRY(_system_call)
704 sp += 4; 704 sp += 4;
705 705
706 SP += -12; 706 SP += -12;
707 call _schedule; 707 pseudo_long_call _schedule, p4;
708 SP += 12; 708 SP += 12;
709 709
710 jump .Lresume_userspace_1; 710 jump .Lresume_userspace_1;
@@ -723,7 +723,7 @@ ENTRY(_system_call)
723 723
724 r0 = sp; 724 r0 = sp;
725 SP += -12; 725 SP += -12;
726 call _do_notify_resume; 726 pseudo_long_call _do_notify_resume, p5;
727 SP += 12; 727 SP += 12;
728 728
729.Lsyscall_really_exit: 729.Lsyscall_really_exit:
@@ -736,7 +736,7 @@ ENDPROC(_system_call)
736 * this symbol need not be global anyways, so ... 736 * this symbol need not be global anyways, so ...
737 */ 737 */
738_sys_trace: 738_sys_trace:
739 call _syscall_trace; 739 pseudo_long_call _syscall_trace, p5;
740 740
741 /* Execute the appropriate system call */ 741 /* Execute the appropriate system call */
742 742
@@ -760,7 +760,7 @@ _sys_trace:
760 SP += 24; 760 SP += 24;
761 [sp + PT_R0] = r0; 761 [sp + PT_R0] = r0;
762 762
763 call _syscall_trace; 763 pseudo_long_call _syscall_trace, p5;
764 jump .Lresume_userspace; 764 jump .Lresume_userspace;
765ENDPROC(_sys_trace) 765ENDPROC(_sys_trace)
766 766
@@ -1007,7 +1007,8 @@ ENTRY(_schedule_and_signal_from_int)
1007 1007
1008 r0 = sp; 1008 r0 = sp;
1009 sp += -12; 1009 sp += -12;
1010 call _finish_atomic_sections; 1010
1011 pseudo_long_call _finish_atomic_sections, p5;
1011 sp += 12; 1012 sp += 12;
1012 jump.s .Lresume_userspace; 1013 jump.s .Lresume_userspace;
1013ENDPROC(_schedule_and_signal_from_int) 1014ENDPROC(_schedule_and_signal_from_int)
diff --git a/arch/blackfin/mach-common/head.S b/arch/blackfin/mach-common/head.S
index cf037782c8ad..4391621d9048 100644
--- a/arch/blackfin/mach-common/head.S
+++ b/arch/blackfin/mach-common/head.S
@@ -186,6 +186,11 @@ ENTRY(__start)
186 186
187 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ 187 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
188 call _bfin_relocate_l1_mem; 188 call _bfin_relocate_l1_mem;
189
190#ifdef CONFIG_ROMKERNEL
191 call _bfin_relocate_xip_data;
192#endif
193
189#ifdef CONFIG_BFIN_KERNEL_CLOCK 194#ifdef CONFIG_BFIN_KERNEL_CLOCK
190 /* Only use on-chip scratch space for stack when absolutely required 195 /* Only use on-chip scratch space for stack when absolutely required
191 * to avoid Anomaly 05000227 ... we know the init_clocks() func only 196 * to avoid Anomaly 05000227 ... we know the init_clocks() func only
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index 8085ff1cce00..df984960cf90 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -109,10 +109,10 @@ __common_int_entry:
109 cc = r0 == 0; 109 cc = r0 == 0;
110 if cc jump .Lcommon_restore_context; 110 if cc jump .Lcommon_restore_context;
111#else /* CONFIG_IPIPE */ 111#else /* CONFIG_IPIPE */
112 call _do_irq; 112 pseudo_long_call _do_irq, p2;
113 SP += 12; 113 SP += 12;
114#endif /* CONFIG_IPIPE */ 114#endif /* CONFIG_IPIPE */
115 call _return_from_int; 115 pseudo_long_call _return_from_int, p2;
116.Lcommon_restore_context: 116.Lcommon_restore_context:
117 RESTORE_CONTEXT 117 RESTORE_CONTEXT
118 rti; 118 rti;
@@ -168,7 +168,7 @@ ENTRY(_evt_ivhw)
168 168
169 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ 169 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
170 SP += -12; 170 SP += -12;
171 call _trap_c; 171 pseudo_long_call _trap_c, p5;
172 SP += 12; 172 SP += 12;
173 173
174#ifdef EBIU_ERRMST 174#ifdef EBIU_ERRMST
@@ -179,7 +179,7 @@ ENTRY(_evt_ivhw)
179 w[p0] = r0.l; 179 w[p0] = r0.l;
180#endif 180#endif
181 181
182 call _ret_from_exception; 182 pseudo_long_call _ret_from_exception, p2;
183 183
184.Lcommon_restore_all_sys: 184.Lcommon_restore_all_sys:
185 RESTORE_ALL_SYS 185 RESTORE_ALL_SYS
@@ -223,7 +223,7 @@ ENTRY(_evt_system_call)
223#ifdef CONFIG_FRAME_POINTER 223#ifdef CONFIG_FRAME_POINTER
224 fp = 0; 224 fp = 0;
225#endif 225#endif
226 call _system_call; 226 pseudo_long_call _system_call, p2;
227 jump .Lcommon_restore_context; 227 jump .Lcommon_restore_context;
228ENDPROC(_evt_system_call) 228ENDPROC(_evt_system_call)
229 229