diff options
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r-- | arch/blackfin/kernel/Makefile | 7 | ||||
-rw-r--r-- | arch/blackfin/kernel/asm-offsets.c | 7 | ||||
-rw-r--r-- | arch/blackfin/kernel/bfin_dma_5xx.c | 251 | ||||
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 11 | ||||
-rw-r--r-- | arch/blackfin/kernel/bfin_ksyms.c | 5 | ||||
-rw-r--r-- | arch/blackfin/kernel/cacheinit.c | 66 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplbinit.c | 433 | ||||
-rw-r--r-- | arch/blackfin/kernel/dma-mapping.c | 13 | ||||
-rw-r--r-- | arch/blackfin/kernel/dualcore_test.c | 6 | ||||
-rw-r--r-- | arch/blackfin/kernel/fixed_code.S | 132 | ||||
-rw-r--r-- | arch/blackfin/kernel/flat.c | 55 | ||||
-rw-r--r-- | arch/blackfin/kernel/irqchip.c | 2 | ||||
-rw-r--r-- | arch/blackfin/kernel/kgdb.c | 421 | ||||
-rw-r--r-- | arch/blackfin/kernel/module.c | 32 | ||||
-rw-r--r-- | arch/blackfin/kernel/process.c | 75 | ||||
-rw-r--r-- | arch/blackfin/kernel/ptrace.c | 6 | ||||
-rw-r--r-- | arch/blackfin/kernel/setup.c | 368 | ||||
-rw-r--r-- | arch/blackfin/kernel/signal.c | 10 | ||||
-rw-r--r-- | arch/blackfin/kernel/sys_bfin.c | 8 | ||||
-rw-r--r-- | arch/blackfin/kernel/time.c | 4 | ||||
-rw-r--r-- | arch/blackfin/kernel/traps.c | 62 | ||||
-rw-r--r-- | arch/blackfin/kernel/vmlinux.lds.S | 12 |
22 files changed, 1316 insertions, 670 deletions
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile index f3b7d2f9d49c..f429ebc3a961 100644 --- a/arch/blackfin/kernel/Makefile +++ b/arch/blackfin/kernel/Makefile | |||
@@ -6,9 +6,12 @@ extra-y := init_task.o vmlinux.lds | |||
6 | 6 | ||
7 | obj-y := \ | 7 | obj-y := \ |
8 | entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ | 8 | entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ |
9 | sys_bfin.o time.o traps.o irqchip.o dma-mapping.o bfin_gpio.o \ | 9 | sys_bfin.o time.o traps.o irqchip.o dma-mapping.o flat.o \ |
10 | flat.o | 10 | fixed_code.o cplbinit.o cacheinit.o |
11 | 11 | ||
12 | obj-$(CONFIG_BF53x) += bfin_gpio.o | ||
13 | obj-$(CONFIG_BF561) += bfin_gpio.o | ||
12 | obj-$(CONFIG_MODULES) += module.o | 14 | obj-$(CONFIG_MODULES) += module.o |
13 | obj-$(CONFIG_BFIN_DMA_5XX) += bfin_dma_5xx.o | 15 | obj-$(CONFIG_BFIN_DMA_5XX) += bfin_dma_5xx.o |
14 | obj-$(CONFIG_DUAL_CORE_TEST_MODULE) += dualcore_test.o | 16 | obj-$(CONFIG_DUAL_CORE_TEST_MODULE) += dualcore_test.o |
17 | obj-$(CONFIG_KGDB) += kgdb.o | ||
diff --git a/arch/blackfin/kernel/asm-offsets.c b/arch/blackfin/kernel/asm-offsets.c index e455f4504509..b56b2741cdea 100644 --- a/arch/blackfin/kernel/asm-offsets.c +++ b/arch/blackfin/kernel/asm-offsets.c | |||
@@ -32,11 +32,10 @@ | |||
32 | #include <linux/kernel_stat.h> | 32 | #include <linux/kernel_stat.h> |
33 | #include <linux/ptrace.h> | 33 | #include <linux/ptrace.h> |
34 | #include <linux/hardirq.h> | 34 | #include <linux/hardirq.h> |
35 | #include <asm/irq.h> | 35 | #include <linux/irq.h> |
36 | #include <asm/thread_info.h> | 36 | #include <linux/thread_info.h> |
37 | 37 | ||
38 | #define DEFINE(sym, val) \ | 38 | #define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
39 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | ||
40 | 39 | ||
41 | int main(void) | 40 | int main(void) |
42 | { | 41 | { |
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 069a896a8f26..7cf02f02a1db 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
35 | #include <linux/param.h> | 35 | #include <linux/param.h> |
36 | 36 | ||
37 | #include <asm/blackfin.h> | ||
37 | #include <asm/dma.h> | 38 | #include <asm/dma.h> |
38 | #include <asm/cacheflush.h> | 39 | #include <asm/cacheflush.h> |
39 | 40 | ||
@@ -45,67 +46,6 @@ | |||
45 | ***************************************************************************/ | 46 | ***************************************************************************/ |
46 | 47 | ||
47 | static struct dma_channel dma_ch[MAX_BLACKFIN_DMA_CHANNEL]; | 48 | static struct dma_channel dma_ch[MAX_BLACKFIN_DMA_CHANNEL]; |
48 | #if defined (CONFIG_BF561) | ||
49 | static struct dma_register *base_addr[MAX_BLACKFIN_DMA_CHANNEL] = { | ||
50 | (struct dma_register *) DMA1_0_NEXT_DESC_PTR, | ||
51 | (struct dma_register *) DMA1_1_NEXT_DESC_PTR, | ||
52 | (struct dma_register *) DMA1_2_NEXT_DESC_PTR, | ||
53 | (struct dma_register *) DMA1_3_NEXT_DESC_PTR, | ||
54 | (struct dma_register *) DMA1_4_NEXT_DESC_PTR, | ||
55 | (struct dma_register *) DMA1_5_NEXT_DESC_PTR, | ||
56 | (struct dma_register *) DMA1_6_NEXT_DESC_PTR, | ||
57 | (struct dma_register *) DMA1_7_NEXT_DESC_PTR, | ||
58 | (struct dma_register *) DMA1_8_NEXT_DESC_PTR, | ||
59 | (struct dma_register *) DMA1_9_NEXT_DESC_PTR, | ||
60 | (struct dma_register *) DMA1_10_NEXT_DESC_PTR, | ||
61 | (struct dma_register *) DMA1_11_NEXT_DESC_PTR, | ||
62 | (struct dma_register *) DMA2_0_NEXT_DESC_PTR, | ||
63 | (struct dma_register *) DMA2_1_NEXT_DESC_PTR, | ||
64 | (struct dma_register *) DMA2_2_NEXT_DESC_PTR, | ||
65 | (struct dma_register *) DMA2_3_NEXT_DESC_PTR, | ||
66 | (struct dma_register *) DMA2_4_NEXT_DESC_PTR, | ||
67 | (struct dma_register *) DMA2_5_NEXT_DESC_PTR, | ||
68 | (struct dma_register *) DMA2_6_NEXT_DESC_PTR, | ||
69 | (struct dma_register *) DMA2_7_NEXT_DESC_PTR, | ||
70 | (struct dma_register *) DMA2_8_NEXT_DESC_PTR, | ||
71 | (struct dma_register *) DMA2_9_NEXT_DESC_PTR, | ||
72 | (struct dma_register *) DMA2_10_NEXT_DESC_PTR, | ||
73 | (struct dma_register *) DMA2_11_NEXT_DESC_PTR, | ||
74 | (struct dma_register *) MDMA1_D0_NEXT_DESC_PTR, | ||
75 | (struct dma_register *) MDMA1_S0_NEXT_DESC_PTR, | ||
76 | (struct dma_register *) MDMA1_D1_NEXT_DESC_PTR, | ||
77 | (struct dma_register *) MDMA1_S1_NEXT_DESC_PTR, | ||
78 | (struct dma_register *) MDMA2_D0_NEXT_DESC_PTR, | ||
79 | (struct dma_register *) MDMA2_S0_NEXT_DESC_PTR, | ||
80 | (struct dma_register *) MDMA2_D1_NEXT_DESC_PTR, | ||
81 | (struct dma_register *) MDMA2_S1_NEXT_DESC_PTR, | ||
82 | (struct dma_register *) IMDMA_D0_NEXT_DESC_PTR, | ||
83 | (struct dma_register *) IMDMA_S0_NEXT_DESC_PTR, | ||
84 | (struct dma_register *) IMDMA_D1_NEXT_DESC_PTR, | ||
85 | (struct dma_register *) IMDMA_S1_NEXT_DESC_PTR, | ||
86 | }; | ||
87 | #else | ||
88 | static struct dma_register *base_addr[MAX_BLACKFIN_DMA_CHANNEL] = { | ||
89 | (struct dma_register *) DMA0_NEXT_DESC_PTR, | ||
90 | (struct dma_register *) DMA1_NEXT_DESC_PTR, | ||
91 | (struct dma_register *) DMA2_NEXT_DESC_PTR, | ||
92 | (struct dma_register *) DMA3_NEXT_DESC_PTR, | ||
93 | (struct dma_register *) DMA4_NEXT_DESC_PTR, | ||
94 | (struct dma_register *) DMA5_NEXT_DESC_PTR, | ||
95 | (struct dma_register *) DMA6_NEXT_DESC_PTR, | ||
96 | (struct dma_register *) DMA7_NEXT_DESC_PTR, | ||
97 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF534) || defined(CONFIG_BF536)) | ||
98 | (struct dma_register *) DMA8_NEXT_DESC_PTR, | ||
99 | (struct dma_register *) DMA9_NEXT_DESC_PTR, | ||
100 | (struct dma_register *) DMA10_NEXT_DESC_PTR, | ||
101 | (struct dma_register *) DMA11_NEXT_DESC_PTR, | ||
102 | #endif | ||
103 | (struct dma_register *) MDMA_D0_NEXT_DESC_PTR, | ||
104 | (struct dma_register *) MDMA_S0_NEXT_DESC_PTR, | ||
105 | (struct dma_register *) MDMA_D1_NEXT_DESC_PTR, | ||
106 | (struct dma_register *) MDMA_S1_NEXT_DESC_PTR, | ||
107 | }; | ||
108 | #endif | ||
109 | 49 | ||
110 | /*------------------------------------------------------------------------------ | 50 | /*------------------------------------------------------------------------------ |
111 | * Set the Buffer Clear bit in the Configuration register of specific DMA | 51 | * Set the Buffer Clear bit in the Configuration register of specific DMA |
@@ -138,149 +78,6 @@ static int __init blackfin_dma_init(void) | |||
138 | 78 | ||
139 | arch_initcall(blackfin_dma_init); | 79 | arch_initcall(blackfin_dma_init); |
140 | 80 | ||
141 | /* | ||
142 | * Form the channel find the irq number for that channel. | ||
143 | */ | ||
144 | #if !defined(CONFIG_BF561) | ||
145 | |||
146 | static int bf533_channel2irq(unsigned int channel) | ||
147 | { | ||
148 | int ret_irq = -1; | ||
149 | |||
150 | switch (channel) { | ||
151 | case CH_PPI: | ||
152 | ret_irq = IRQ_PPI; | ||
153 | break; | ||
154 | |||
155 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF534) || defined(CONFIG_BF536)) | ||
156 | case CH_EMAC_RX: | ||
157 | ret_irq = IRQ_MAC_RX; | ||
158 | break; | ||
159 | |||
160 | case CH_EMAC_TX: | ||
161 | ret_irq = IRQ_MAC_TX; | ||
162 | break; | ||
163 | |||
164 | case CH_UART1_RX: | ||
165 | ret_irq = IRQ_UART1_RX; | ||
166 | break; | ||
167 | |||
168 | case CH_UART1_TX: | ||
169 | ret_irq = IRQ_UART1_TX; | ||
170 | break; | ||
171 | #endif | ||
172 | |||
173 | case CH_SPORT0_RX: | ||
174 | ret_irq = IRQ_SPORT0_RX; | ||
175 | break; | ||
176 | |||
177 | case CH_SPORT0_TX: | ||
178 | ret_irq = IRQ_SPORT0_TX; | ||
179 | break; | ||
180 | |||
181 | case CH_SPORT1_RX: | ||
182 | ret_irq = IRQ_SPORT1_RX; | ||
183 | break; | ||
184 | |||
185 | case CH_SPORT1_TX: | ||
186 | ret_irq = IRQ_SPORT1_TX; | ||
187 | break; | ||
188 | |||
189 | case CH_SPI: | ||
190 | ret_irq = IRQ_SPI; | ||
191 | break; | ||
192 | |||
193 | case CH_UART_RX: | ||
194 | ret_irq = IRQ_UART_RX; | ||
195 | break; | ||
196 | |||
197 | case CH_UART_TX: | ||
198 | ret_irq = IRQ_UART_TX; | ||
199 | break; | ||
200 | |||
201 | case CH_MEM_STREAM0_SRC: | ||
202 | case CH_MEM_STREAM0_DEST: | ||
203 | ret_irq = IRQ_MEM_DMA0; | ||
204 | break; | ||
205 | |||
206 | case CH_MEM_STREAM1_SRC: | ||
207 | case CH_MEM_STREAM1_DEST: | ||
208 | ret_irq = IRQ_MEM_DMA1; | ||
209 | break; | ||
210 | } | ||
211 | return ret_irq; | ||
212 | } | ||
213 | |||
214 | # define channel2irq(channel) bf533_channel2irq(channel) | ||
215 | |||
216 | #else | ||
217 | |||
218 | static int bf561_channel2irq(unsigned int channel) | ||
219 | { | ||
220 | int ret_irq = -1; | ||
221 | |||
222 | switch (channel) { | ||
223 | case CH_PPI0: | ||
224 | ret_irq = IRQ_PPI0; | ||
225 | break; | ||
226 | case CH_PPI1: | ||
227 | ret_irq = IRQ_PPI1; | ||
228 | break; | ||
229 | case CH_SPORT0_RX: | ||
230 | ret_irq = IRQ_SPORT0_RX; | ||
231 | break; | ||
232 | case CH_SPORT0_TX: | ||
233 | ret_irq = IRQ_SPORT0_TX; | ||
234 | break; | ||
235 | case CH_SPORT1_RX: | ||
236 | ret_irq = IRQ_SPORT1_RX; | ||
237 | break; | ||
238 | case CH_SPORT1_TX: | ||
239 | ret_irq = IRQ_SPORT1_TX; | ||
240 | break; | ||
241 | case CH_SPI: | ||
242 | ret_irq = IRQ_SPI; | ||
243 | break; | ||
244 | case CH_UART_RX: | ||
245 | ret_irq = IRQ_UART_RX; | ||
246 | break; | ||
247 | case CH_UART_TX: | ||
248 | ret_irq = IRQ_UART_TX; | ||
249 | break; | ||
250 | |||
251 | case CH_MEM_STREAM0_SRC: | ||
252 | case CH_MEM_STREAM0_DEST: | ||
253 | ret_irq = IRQ_MEM_DMA0; | ||
254 | break; | ||
255 | case CH_MEM_STREAM1_SRC: | ||
256 | case CH_MEM_STREAM1_DEST: | ||
257 | ret_irq = IRQ_MEM_DMA1; | ||
258 | break; | ||
259 | case CH_MEM_STREAM2_SRC: | ||
260 | case CH_MEM_STREAM2_DEST: | ||
261 | ret_irq = IRQ_MEM_DMA2; | ||
262 | break; | ||
263 | case CH_MEM_STREAM3_SRC: | ||
264 | case CH_MEM_STREAM3_DEST: | ||
265 | ret_irq = IRQ_MEM_DMA3; | ||
266 | break; | ||
267 | |||
268 | case CH_IMEM_STREAM0_SRC: | ||
269 | case CH_IMEM_STREAM0_DEST: | ||
270 | ret_irq = IRQ_IMEM_DMA0; | ||
271 | break; | ||
272 | case CH_IMEM_STREAM1_SRC: | ||
273 | case CH_IMEM_STREAM1_DEST: | ||
274 | ret_irq = IRQ_IMEM_DMA1; | ||
275 | break; | ||
276 | } | ||
277 | return ret_irq; | ||
278 | } | ||
279 | |||
280 | # define channel2irq(channel) bf561_channel2irq(channel) | ||
281 | |||
282 | #endif | ||
283 | |||
284 | /*------------------------------------------------------------------------------ | 81 | /*------------------------------------------------------------------------------ |
285 | * Request the specific DMA channel from the system. | 82 | * Request the specific DMA channel from the system. |
286 | *-----------------------------------------------------------------------------*/ | 83 | *-----------------------------------------------------------------------------*/ |
@@ -535,7 +332,7 @@ set_bfin_dma_config(char direction, char flow_mode, | |||
535 | } | 332 | } |
536 | EXPORT_SYMBOL(set_bfin_dma_config); | 333 | EXPORT_SYMBOL(set_bfin_dma_config); |
537 | 334 | ||
538 | void set_dma_sg(unsigned int channel, struct dmasg * sg, int nr_sg) | 335 | void set_dma_sg(unsigned int channel, struct dmasg *sg, int nr_sg) |
539 | { | 336 | { |
540 | BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE | 337 | BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE |
541 | && channel < MAX_BLACKFIN_DMA_CHANNEL)); | 338 | && channel < MAX_BLACKFIN_DMA_CHANNEL)); |
@@ -604,7 +401,7 @@ static void *__dma_memcpy(void *dest, const void *src, size_t size) | |||
604 | 401 | ||
605 | if (size <= 0) | 402 | if (size <= 0) |
606 | return NULL; | 403 | return NULL; |
607 | 404 | ||
608 | local_irq_save(flags); | 405 | local_irq_save(flags); |
609 | 406 | ||
610 | if ((unsigned long)src < memory_end) | 407 | if ((unsigned long)src < memory_end) |
@@ -748,7 +545,6 @@ void *dma_memcpy(void *dest, const void *src, size_t size) | |||
748 | addr = __dma_memcpy(dest+bulk, src+bulk, rest); | 545 | addr = __dma_memcpy(dest+bulk, src+bulk, rest); |
749 | return addr; | 546 | return addr; |
750 | } | 547 | } |
751 | |||
752 | EXPORT_SYMBOL(dma_memcpy); | 548 | EXPORT_SYMBOL(dma_memcpy); |
753 | 549 | ||
754 | void *safe_dma_memcpy(void *dest, const void *src, size_t size) | 550 | void *safe_dma_memcpy(void *dest, const void *src, size_t size) |
@@ -761,14 +557,13 @@ EXPORT_SYMBOL(safe_dma_memcpy); | |||
761 | 557 | ||
762 | void dma_outsb(void __iomem *addr, const void *buf, unsigned short len) | 558 | void dma_outsb(void __iomem *addr, const void *buf, unsigned short len) |
763 | { | 559 | { |
764 | |||
765 | unsigned long flags; | 560 | unsigned long flags; |
766 | 561 | ||
767 | local_irq_save(flags); | 562 | local_irq_save(flags); |
768 | |||
769 | blackfin_dcache_flush_range((unsigned int)buf,(unsigned int)(buf) + len); | ||
770 | 563 | ||
771 | bfin_write_MDMA_D0_START_ADDR(addr); | 564 | blackfin_dcache_flush_range((unsigned int)buf, (unsigned int)(buf) + len); |
565 | |||
566 | bfin_write_MDMA_D0_START_ADDR(addr); | ||
772 | bfin_write_MDMA_D0_X_COUNT(len); | 567 | bfin_write_MDMA_D0_X_COUNT(len); |
773 | bfin_write_MDMA_D0_X_MODIFY(0); | 568 | bfin_write_MDMA_D0_X_MODIFY(0); |
774 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); | 569 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); |
@@ -796,9 +591,9 @@ EXPORT_SYMBOL(dma_outsb); | |||
796 | void dma_insb(const void __iomem *addr, void *buf, unsigned short len) | 591 | void dma_insb(const void __iomem *addr, void *buf, unsigned short len) |
797 | { | 592 | { |
798 | unsigned long flags; | 593 | unsigned long flags; |
799 | 594 | ||
800 | local_irq_save(flags); | 595 | local_irq_save(flags); |
801 | bfin_write_MDMA_D0_START_ADDR(buf); | 596 | bfin_write_MDMA_D0_START_ADDR(buf); |
802 | bfin_write_MDMA_D0_X_COUNT(len); | 597 | bfin_write_MDMA_D0_X_COUNT(len); |
803 | bfin_write_MDMA_D0_X_MODIFY(1); | 598 | bfin_write_MDMA_D0_X_MODIFY(1); |
804 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); | 599 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); |
@@ -827,12 +622,12 @@ EXPORT_SYMBOL(dma_insb); | |||
827 | void dma_outsw(void __iomem *addr, const void *buf, unsigned short len) | 622 | void dma_outsw(void __iomem *addr, const void *buf, unsigned short len) |
828 | { | 623 | { |
829 | unsigned long flags; | 624 | unsigned long flags; |
830 | 625 | ||
831 | local_irq_save(flags); | 626 | local_irq_save(flags); |
832 | |||
833 | blackfin_dcache_flush_range((unsigned int)buf,(unsigned int)(buf) + len); | ||
834 | 627 | ||
835 | bfin_write_MDMA_D0_START_ADDR(addr); | 628 | blackfin_dcache_flush_range((unsigned int)buf, (unsigned int)(buf) + len); |
629 | |||
630 | bfin_write_MDMA_D0_START_ADDR(addr); | ||
836 | bfin_write_MDMA_D0_X_COUNT(len); | 631 | bfin_write_MDMA_D0_X_COUNT(len); |
837 | bfin_write_MDMA_D0_X_MODIFY(0); | 632 | bfin_write_MDMA_D0_X_MODIFY(0); |
838 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); | 633 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); |
@@ -859,10 +654,10 @@ EXPORT_SYMBOL(dma_outsw); | |||
859 | void dma_insw(const void __iomem *addr, void *buf, unsigned short len) | 654 | void dma_insw(const void __iomem *addr, void *buf, unsigned short len) |
860 | { | 655 | { |
861 | unsigned long flags; | 656 | unsigned long flags; |
862 | 657 | ||
863 | local_irq_save(flags); | 658 | local_irq_save(flags); |
864 | 659 | ||
865 | bfin_write_MDMA_D0_START_ADDR(buf); | 660 | bfin_write_MDMA_D0_START_ADDR(buf); |
866 | bfin_write_MDMA_D0_X_COUNT(len); | 661 | bfin_write_MDMA_D0_X_COUNT(len); |
867 | bfin_write_MDMA_D0_X_MODIFY(2); | 662 | bfin_write_MDMA_D0_X_MODIFY(2); |
868 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); | 663 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); |
@@ -891,12 +686,12 @@ EXPORT_SYMBOL(dma_insw); | |||
891 | void dma_outsl(void __iomem *addr, const void *buf, unsigned short len) | 686 | void dma_outsl(void __iomem *addr, const void *buf, unsigned short len) |
892 | { | 687 | { |
893 | unsigned long flags; | 688 | unsigned long flags; |
894 | 689 | ||
895 | local_irq_save(flags); | 690 | local_irq_save(flags); |
896 | |||
897 | blackfin_dcache_flush_range((unsigned int)buf,(unsigned int)(buf) + len); | ||
898 | 691 | ||
899 | bfin_write_MDMA_D0_START_ADDR(addr); | 692 | blackfin_dcache_flush_range((unsigned int)buf, (unsigned int)(buf) + len); |
693 | |||
694 | bfin_write_MDMA_D0_START_ADDR(addr); | ||
900 | bfin_write_MDMA_D0_X_COUNT(len); | 695 | bfin_write_MDMA_D0_X_COUNT(len); |
901 | bfin_write_MDMA_D0_X_MODIFY(0); | 696 | bfin_write_MDMA_D0_X_MODIFY(0); |
902 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); | 697 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); |
@@ -923,10 +718,10 @@ EXPORT_SYMBOL(dma_outsl); | |||
923 | void dma_insl(const void __iomem *addr, void *buf, unsigned short len) | 718 | void dma_insl(const void __iomem *addr, void *buf, unsigned short len) |
924 | { | 719 | { |
925 | unsigned long flags; | 720 | unsigned long flags; |
926 | 721 | ||
927 | local_irq_save(flags); | 722 | local_irq_save(flags); |
928 | 723 | ||
929 | bfin_write_MDMA_D0_START_ADDR(buf); | 724 | bfin_write_MDMA_D0_START_ADDR(buf); |
930 | bfin_write_MDMA_D0_X_COUNT(len); | 725 | bfin_write_MDMA_D0_X_COUNT(len); |
931 | bfin_write_MDMA_D0_X_MODIFY(4); | 726 | bfin_write_MDMA_D0_X_MODIFY(4); |
932 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); | 727 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); |
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index bb1f4fb2467c..bafcfa52142b 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -162,7 +162,7 @@ static void port_setup(unsigned short gpio, unsigned short usage) | |||
162 | 162 | ||
163 | static void default_gpio(unsigned short gpio) | 163 | static void default_gpio(unsigned short gpio) |
164 | { | 164 | { |
165 | unsigned short bank,bitmask; | 165 | unsigned short bank, bitmask; |
166 | 166 | ||
167 | bank = gpio_bank(gpio); | 167 | bank = gpio_bank(gpio); |
168 | bitmask = gpio_bit(gpio); | 168 | bitmask = gpio_bit(gpio); |
@@ -183,7 +183,7 @@ static int __init bfin_gpio_init(void) | |||
183 | 183 | ||
184 | printk(KERN_INFO "Blackfin GPIO Controller\n"); | 184 | printk(KERN_INFO "Blackfin GPIO Controller\n"); |
185 | 185 | ||
186 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i+=GPIO_BANKSIZE) | 186 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) |
187 | reserved_map[gpio_bank(i)] = 0; | 187 | reserved_map[gpio_bank(i)] = 0; |
188 | 188 | ||
189 | #if defined(BF537_FAMILY) && (defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) | 189 | #if defined(BF537_FAMILY) && (defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) |
@@ -478,7 +478,7 @@ u32 gpio_pm_setup(void) | |||
478 | u32 sic_iwr = 0; | 478 | u32 sic_iwr = 0; |
479 | u16 bank, mask, i, gpio; | 479 | u16 bank, mask, i, gpio; |
480 | 480 | ||
481 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i+=GPIO_BANKSIZE) { | 481 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { |
482 | mask = wakeup_map[gpio_bank(i)]; | 482 | mask = wakeup_map[gpio_bank(i)]; |
483 | bank = gpio_bank(i); | 483 | bank = gpio_bank(i); |
484 | 484 | ||
@@ -522,12 +522,11 @@ u32 gpio_pm_setup(void) | |||
522 | return IWR_ENABLE_ALL; | 522 | return IWR_ENABLE_ALL; |
523 | } | 523 | } |
524 | 524 | ||
525 | |||
526 | void gpio_pm_restore(void) | 525 | void gpio_pm_restore(void) |
527 | { | 526 | { |
528 | u16 bank, mask, i; | 527 | u16 bank, mask, i; |
529 | 528 | ||
530 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i+=GPIO_BANKSIZE) { | 529 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { |
531 | mask = wakeup_map[gpio_bank(i)]; | 530 | mask = wakeup_map[gpio_bank(i)]; |
532 | bank = gpio_bank(i); | 531 | bank = gpio_bank(i); |
533 | 532 | ||
@@ -591,7 +590,6 @@ int gpio_request(unsigned short gpio, const char *label) | |||
591 | } | 590 | } |
592 | EXPORT_SYMBOL(gpio_request); | 591 | EXPORT_SYMBOL(gpio_request); |
593 | 592 | ||
594 | |||
595 | void gpio_free(unsigned short gpio) | 593 | void gpio_free(unsigned short gpio) |
596 | { | 594 | { |
597 | unsigned long flags; | 595 | unsigned long flags; |
@@ -616,7 +614,6 @@ void gpio_free(unsigned short gpio) | |||
616 | } | 614 | } |
617 | EXPORT_SYMBOL(gpio_free); | 615 | EXPORT_SYMBOL(gpio_free); |
618 | 616 | ||
619 | |||
620 | void gpio_direction_input(unsigned short gpio) | 617 | void gpio_direction_input(unsigned short gpio) |
621 | { | 618 | { |
622 | unsigned long flags; | 619 | unsigned long flags; |
diff --git a/arch/blackfin/kernel/bfin_ksyms.c b/arch/blackfin/kernel/bfin_ksyms.c index f64ecb638fab..70455949cfd2 100644 --- a/arch/blackfin/kernel/bfin_ksyms.c +++ b/arch/blackfin/kernel/bfin_ksyms.c | |||
@@ -28,10 +28,11 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <asm/irq.h> | 31 | #include <linux/irq.h> |
32 | #include <linux/uaccess.h> | ||
33 | |||
32 | #include <asm/checksum.h> | 34 | #include <asm/checksum.h> |
33 | #include <asm/cacheflush.h> | 35 | #include <asm/cacheflush.h> |
34 | #include <asm/uaccess.h> | ||
35 | 36 | ||
36 | /* platform dependent support */ | 37 | /* platform dependent support */ |
37 | 38 | ||
diff --git a/arch/blackfin/kernel/cacheinit.c b/arch/blackfin/kernel/cacheinit.c new file mode 100644 index 000000000000..4d41a40e8133 --- /dev/null +++ b/arch/blackfin/kernel/cacheinit.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2007 Analog Devices Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, see the file COPYING, or write | ||
16 | * to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/cpu.h> | ||
21 | |||
22 | #include <asm/cacheflush.h> | ||
23 | #include <asm/blackfin.h> | ||
24 | #include <asm/cplbinit.h> | ||
25 | |||
26 | #if defined(CONFIG_BLKFIN_CACHE) | ||
27 | void bfin_icache_init(void) | ||
28 | { | ||
29 | unsigned long *table = icplb_table; | ||
30 | unsigned long ctrl; | ||
31 | int i; | ||
32 | |||
33 | for (i = 0; i < MAX_CPLBS; i++) { | ||
34 | unsigned long addr = *table++; | ||
35 | unsigned long data = *table++; | ||
36 | if (addr == (unsigned long)-1) | ||
37 | break; | ||
38 | bfin_write32(ICPLB_ADDR0 + i * 4, addr); | ||
39 | bfin_write32(ICPLB_DATA0 + i * 4, data); | ||
40 | } | ||
41 | ctrl = bfin_read_IMEM_CONTROL(); | ||
42 | ctrl |= IMC | ENICPLB; | ||
43 | bfin_write_IMEM_CONTROL(ctrl); | ||
44 | } | ||
45 | #endif | ||
46 | |||
47 | #if defined(CONFIG_BLKFIN_DCACHE) | ||
48 | void bfin_dcache_init(void) | ||
49 | { | ||
50 | unsigned long *table = dcplb_table; | ||
51 | unsigned long ctrl; | ||
52 | int i; | ||
53 | |||
54 | for (i = 0; i < MAX_CPLBS; i++) { | ||
55 | unsigned long addr = *table++; | ||
56 | unsigned long data = *table++; | ||
57 | if (addr == (unsigned long)-1) | ||
58 | break; | ||
59 | bfin_write32(DCPLB_ADDR0 + i * 4, addr); | ||
60 | bfin_write32(DCPLB_DATA0 + i * 4, data); | ||
61 | } | ||
62 | ctrl = bfin_read_DMEM_CONTROL(); | ||
63 | ctrl |= DMEM_CNTR; | ||
64 | bfin_write_DMEM_CONTROL(ctrl); | ||
65 | } | ||
66 | #endif | ||
diff --git a/arch/blackfin/kernel/cplbinit.c b/arch/blackfin/kernel/cplbinit.c new file mode 100644 index 000000000000..bbdb403fcb55 --- /dev/null +++ b/arch/blackfin/kernel/cplbinit.c | |||
@@ -0,0 +1,433 @@ | |||
1 | /* | ||
2 | * Blackfin CPLB initialization | ||
3 | * | ||
4 | * Copyright 2004-2007 Analog Devices Inc. | ||
5 | * | ||
6 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, see the file COPYING, or write | ||
20 | * to the Free Software Foundation, Inc., | ||
21 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | */ | ||
23 | #include <linux/module.h> | ||
24 | |||
25 | #include <asm/blackfin.h> | ||
26 | #include <asm/cplbinit.h> | ||
27 | |||
28 | u_long icplb_table[MAX_CPLBS+1]; | ||
29 | u_long dcplb_table[MAX_CPLBS+1]; | ||
30 | |||
31 | #ifdef CONFIG_CPLB_SWITCH_TAB_L1 | ||
32 | u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]__attribute__((l1_data)); | ||
33 | u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]__attribute__((l1_data)); | ||
34 | |||
35 | #ifdef CONFIG_CPLB_INFO | ||
36 | u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]__attribute__((l1_data)); | ||
37 | u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]__attribute__((l1_data)); | ||
38 | #endif /* CONFIG_CPLB_INFO */ | ||
39 | |||
40 | #else | ||
41 | |||
42 | u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]; | ||
43 | u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]; | ||
44 | |||
45 | #ifdef CONFIG_CPLB_INFO | ||
46 | u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]; | ||
47 | u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]; | ||
48 | #endif /* CONFIG_CPLB_INFO */ | ||
49 | |||
50 | #endif /*CONFIG_CPLB_SWITCH_TAB_L1*/ | ||
51 | |||
52 | struct s_cplb { | ||
53 | struct cplb_tab init_i; | ||
54 | struct cplb_tab init_d; | ||
55 | struct cplb_tab switch_i; | ||
56 | struct cplb_tab switch_d; | ||
57 | }; | ||
58 | |||
59 | #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE) | ||
60 | static struct cplb_desc cplb_data[] = { | ||
61 | { | ||
62 | .start = 0, | ||
63 | .end = SIZE_1K, | ||
64 | .psize = SIZE_1K, | ||
65 | .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB, | ||
66 | .i_conf = SDRAM_OOPS, | ||
67 | .d_conf = SDRAM_OOPS, | ||
68 | #if defined(CONFIG_DEBUG_HUNT_FOR_ZERO) | ||
69 | .valid = 1, | ||
70 | #else | ||
71 | .valid = 0, | ||
72 | #endif | ||
73 | .name = "ZERO Pointer Saveguard", | ||
74 | }, | ||
75 | { | ||
76 | .start = L1_CODE_START, | ||
77 | .end = L1_CODE_START + L1_CODE_LENGTH, | ||
78 | .psize = SIZE_4M, | ||
79 | .attr = INITIAL_T | SWITCH_T | I_CPLB, | ||
80 | .i_conf = L1_IMEMORY, | ||
81 | .d_conf = 0, | ||
82 | .valid = 1, | ||
83 | .name = "L1 I-Memory", | ||
84 | }, | ||
85 | { | ||
86 | .start = L1_DATA_A_START, | ||
87 | .end = L1_DATA_B_START + L1_DATA_B_LENGTH, | ||
88 | .psize = SIZE_4M, | ||
89 | .attr = INITIAL_T | SWITCH_T | D_CPLB, | ||
90 | .i_conf = 0, | ||
91 | .d_conf = L1_DMEMORY, | ||
92 | #if ((L1_DATA_A_LENGTH > 0) || (L1_DATA_B_LENGTH > 0)) | ||
93 | .valid = 1, | ||
94 | #else | ||
95 | .valid = 0, | ||
96 | #endif | ||
97 | .name = "L1 D-Memory", | ||
98 | }, | ||
99 | { | ||
100 | .start = 0, | ||
101 | .end = 0, /* dynamic */ | ||
102 | .psize = 0, | ||
103 | .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB, | ||
104 | .i_conf = SDRAM_IGENERIC, | ||
105 | .d_conf = SDRAM_DGENERIC, | ||
106 | .valid = 1, | ||
107 | .name = "SDRAM Kernel", | ||
108 | }, | ||
109 | { | ||
110 | .start = 0, /* dynamic */ | ||
111 | .end = 0, /* dynamic */ | ||
112 | .psize = 0, | ||
113 | .attr = INITIAL_T | SWITCH_T | D_CPLB, | ||
114 | .i_conf = SDRAM_IGENERIC, | ||
115 | .d_conf = SDRAM_DNON_CHBL, | ||
116 | .valid = 1, | ||
117 | .name = "SDRAM RAM MTD", | ||
118 | }, | ||
119 | { | ||
120 | .start = 0, /* dynamic */ | ||
121 | .end = 0, /* dynamic */ | ||
122 | .psize = SIZE_1M, | ||
123 | .attr = INITIAL_T | SWITCH_T | D_CPLB, | ||
124 | .d_conf = SDRAM_DNON_CHBL, | ||
125 | .valid = 1, | ||
126 | .name = "SDRAM Uncached DMA ZONE", | ||
127 | }, | ||
128 | { | ||
129 | .start = 0, /* dynamic */ | ||
130 | .end = 0, /* dynamic */ | ||
131 | .psize = 0, | ||
132 | .attr = SWITCH_T | D_CPLB, | ||
133 | .i_conf = 0, /* dynamic */ | ||
134 | .d_conf = 0, /* dynamic */ | ||
135 | .valid = 1, | ||
136 | .name = "SDRAM Reserved Memory", | ||
137 | }, | ||
138 | { | ||
139 | .start = ASYNC_BANK0_BASE, | ||
140 | .end = ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE, | ||
141 | .psize = 0, | ||
142 | .attr = SWITCH_T | D_CPLB, | ||
143 | .d_conf = SDRAM_EBIU, | ||
144 | .valid = 1, | ||
145 | .name = "ASYNC Memory", | ||
146 | }, | ||
147 | { | ||
148 | #if defined(CONFIG_BF561) | ||
149 | .start = L2_SRAM, | ||
150 | .end = L2_SRAM_END, | ||
151 | .psize = SIZE_1M, | ||
152 | .attr = SWITCH_T | D_CPLB, | ||
153 | .i_conf = L2_MEMORY, | ||
154 | .d_conf = L2_MEMORY, | ||
155 | .valid = 1, | ||
156 | #else | ||
157 | .valid = 0, | ||
158 | #endif | ||
159 | .name = "L2 Memory", | ||
160 | } | ||
161 | }; | ||
162 | |||
163 | static u16 __init lock_kernel_check(u32 start, u32 end) | ||
164 | { | ||
165 | if ((start <= (u32) _stext && end >= (u32) _end) | ||
166 | || (start >= (u32) _stext && end <= (u32) _end)) | ||
167 | return IN_KERNEL; | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static unsigned short __init | ||
172 | fill_cplbtab(struct cplb_tab *table, | ||
173 | unsigned long start, unsigned long end, | ||
174 | unsigned long block_size, unsigned long cplb_data) | ||
175 | { | ||
176 | int i; | ||
177 | |||
178 | switch (block_size) { | ||
179 | case SIZE_4M: | ||
180 | i = 3; | ||
181 | break; | ||
182 | case SIZE_1M: | ||
183 | i = 2; | ||
184 | break; | ||
185 | case SIZE_4K: | ||
186 | i = 1; | ||
187 | break; | ||
188 | case SIZE_1K: | ||
189 | default: | ||
190 | i = 0; | ||
191 | break; | ||
192 | } | ||
193 | |||
194 | cplb_data = (cplb_data & ~(3 << 16)) | (i << 16); | ||
195 | |||
196 | while ((start < end) && (table->pos < table->size)) { | ||
197 | |||
198 | table->tab[table->pos++] = start; | ||
199 | |||
200 | if (lock_kernel_check(start, start + block_size) == IN_KERNEL) | ||
201 | table->tab[table->pos++] = | ||
202 | cplb_data | CPLB_LOCK | CPLB_DIRTY; | ||
203 | else | ||
204 | table->tab[table->pos++] = cplb_data; | ||
205 | |||
206 | start += block_size; | ||
207 | } | ||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | static unsigned short __init | ||
212 | close_cplbtab(struct cplb_tab *table) | ||
213 | { | ||
214 | |||
215 | while (table->pos < table->size) { | ||
216 | |||
217 | table->tab[table->pos++] = 0; | ||
218 | table->tab[table->pos++] = 0; /* !CPLB_VALID */ | ||
219 | } | ||
220 | return 0; | ||
221 | } | ||
222 | |||
223 | /* helper function */ | ||
224 | static void __fill_code_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end) | ||
225 | { | ||
226 | if (cplb_data[i].psize) { | ||
227 | fill_cplbtab(t, | ||
228 | cplb_data[i].start, | ||
229 | cplb_data[i].end, | ||
230 | cplb_data[i].psize, | ||
231 | cplb_data[i].i_conf); | ||
232 | } else { | ||
233 | #if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263)) | ||
234 | if (i == SDRAM_KERN) { | ||
235 | fill_cplbtab(t, | ||
236 | cplb_data[i].start, | ||
237 | cplb_data[i].end, | ||
238 | SIZE_4M, | ||
239 | cplb_data[i].i_conf); | ||
240 | } else | ||
241 | #endif | ||
242 | { | ||
243 | fill_cplbtab(t, | ||
244 | cplb_data[i].start, | ||
245 | a_start, | ||
246 | SIZE_1M, | ||
247 | cplb_data[i].i_conf); | ||
248 | fill_cplbtab(t, | ||
249 | a_start, | ||
250 | a_end, | ||
251 | SIZE_4M, | ||
252 | cplb_data[i].i_conf); | ||
253 | fill_cplbtab(t, a_end, | ||
254 | cplb_data[i].end, | ||
255 | SIZE_1M, | ||
256 | cplb_data[i].i_conf); | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | |||
261 | static void __fill_data_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end) | ||
262 | { | ||
263 | if (cplb_data[i].psize) { | ||
264 | fill_cplbtab(t, | ||
265 | cplb_data[i].start, | ||
266 | cplb_data[i].end, | ||
267 | cplb_data[i].psize, | ||
268 | cplb_data[i].d_conf); | ||
269 | } else { | ||
270 | fill_cplbtab(t, | ||
271 | cplb_data[i].start, | ||
272 | a_start, SIZE_1M, | ||
273 | cplb_data[i].d_conf); | ||
274 | fill_cplbtab(t, a_start, | ||
275 | a_end, SIZE_4M, | ||
276 | cplb_data[i].d_conf); | ||
277 | fill_cplbtab(t, a_end, | ||
278 | cplb_data[i].end, | ||
279 | SIZE_1M, | ||
280 | cplb_data[i].d_conf); | ||
281 | } | ||
282 | } | ||
283 | |||
284 | void __init generate_cpl_tables(void) | ||
285 | { | ||
286 | |||
287 | u16 i, j, process; | ||
288 | u32 a_start, a_end, as, ae, as_1m; | ||
289 | |||
290 | struct cplb_tab *t_i = NULL; | ||
291 | struct cplb_tab *t_d = NULL; | ||
292 | struct s_cplb cplb; | ||
293 | |||
294 | cplb.init_i.size = MAX_CPLBS; | ||
295 | cplb.init_d.size = MAX_CPLBS; | ||
296 | cplb.switch_i.size = MAX_SWITCH_I_CPLBS; | ||
297 | cplb.switch_d.size = MAX_SWITCH_D_CPLBS; | ||
298 | |||
299 | cplb.init_i.pos = 0; | ||
300 | cplb.init_d.pos = 0; | ||
301 | cplb.switch_i.pos = 0; | ||
302 | cplb.switch_d.pos = 0; | ||
303 | |||
304 | cplb.init_i.tab = icplb_table; | ||
305 | cplb.init_d.tab = dcplb_table; | ||
306 | cplb.switch_i.tab = ipdt_table; | ||
307 | cplb.switch_d.tab = dpdt_table; | ||
308 | |||
309 | cplb_data[SDRAM_KERN].end = memory_end; | ||
310 | |||
311 | #ifdef CONFIG_MTD_UCLINUX | ||
312 | cplb_data[SDRAM_RAM_MTD].start = memory_mtd_start; | ||
313 | cplb_data[SDRAM_RAM_MTD].end = memory_mtd_start + mtd_size; | ||
314 | cplb_data[SDRAM_RAM_MTD].valid = mtd_size > 0; | ||
315 | # if defined(CONFIG_ROMFS_FS) | ||
316 | cplb_data[SDRAM_RAM_MTD].attr |= I_CPLB; | ||
317 | |||
318 | /* | ||
319 | * The ROMFS_FS size is often not multiple of 1MB. | ||
320 | * This can cause multiple CPLB sets covering the same memory area. | ||
321 | * This will then cause multiple CPLB hit exceptions. | ||
322 | * Workaround: We ensure a contiguous memory area by extending the kernel | ||
323 | * memory section over the mtd section. | ||
324 | * For ROMFS_FS memory must be covered with ICPLBs anyways. | ||
325 | * So there is no difference between kernel and mtd memory setup. | ||
326 | */ | ||
327 | |||
328 | cplb_data[SDRAM_KERN].end = memory_mtd_start + mtd_size;; | ||
329 | cplb_data[SDRAM_RAM_MTD].valid = 0; | ||
330 | |||
331 | # endif | ||
332 | #else | ||
333 | cplb_data[SDRAM_RAM_MTD].valid = 0; | ||
334 | #endif | ||
335 | |||
336 | cplb_data[SDRAM_DMAZ].start = _ramend - DMA_UNCACHED_REGION; | ||
337 | cplb_data[SDRAM_DMAZ].end = _ramend; | ||
338 | |||
339 | cplb_data[RES_MEM].start = _ramend; | ||
340 | cplb_data[RES_MEM].end = physical_mem_end; | ||
341 | |||
342 | if (reserved_mem_dcache_on) | ||
343 | cplb_data[RES_MEM].d_conf = SDRAM_DGENERIC; | ||
344 | else | ||
345 | cplb_data[RES_MEM].d_conf = SDRAM_DNON_CHBL; | ||
346 | |||
347 | if (reserved_mem_icache_on) | ||
348 | cplb_data[RES_MEM].i_conf = SDRAM_IGENERIC; | ||
349 | else | ||
350 | cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL; | ||
351 | |||
352 | for (i = ZERO_P; i <= L2_MEM; i++) { | ||
353 | if (!cplb_data[i].valid) | ||
354 | continue; | ||
355 | |||
356 | as_1m = cplb_data[i].start % SIZE_1M; | ||
357 | |||
358 | /* We need to make sure all sections are properly 1M aligned | ||
359 | * However between Kernel Memory and the Kernel mtd section, depending on the | ||
360 | * rootfs size, there can be overlapping memory areas. | ||
361 | */ | ||
362 | |||
363 | if (as_1m && i != L1I_MEM && i != L1D_MEM) { | ||
364 | #ifdef CONFIG_MTD_UCLINUX | ||
365 | if (i == SDRAM_RAM_MTD) { | ||
366 | if ((cplb_data[SDRAM_KERN].end + 1) > cplb_data[SDRAM_RAM_MTD].start) | ||
367 | cplb_data[SDRAM_RAM_MTD].start = (cplb_data[i].start & (-2*SIZE_1M)) + SIZE_1M; | ||
368 | else | ||
369 | cplb_data[SDRAM_RAM_MTD].start = (cplb_data[i].start & (-2*SIZE_1M)); | ||
370 | } else | ||
371 | #endif | ||
372 | printk(KERN_WARNING "Unaligned Start of %s at 0x%X\n", | ||
373 | cplb_data[i].name, cplb_data[i].start); | ||
374 | } | ||
375 | |||
376 | as = cplb_data[i].start % SIZE_4M; | ||
377 | ae = cplb_data[i].end % SIZE_4M; | ||
378 | |||
379 | if (as) | ||
380 | a_start = cplb_data[i].start + (SIZE_4M - (as)); | ||
381 | else | ||
382 | a_start = cplb_data[i].start; | ||
383 | |||
384 | a_end = cplb_data[i].end - ae; | ||
385 | |||
386 | for (j = INITIAL_T; j <= SWITCH_T; j++) { | ||
387 | |||
388 | switch (j) { | ||
389 | case INITIAL_T: | ||
390 | if (cplb_data[i].attr & INITIAL_T) { | ||
391 | t_i = &cplb.init_i; | ||
392 | t_d = &cplb.init_d; | ||
393 | process = 1; | ||
394 | } else | ||
395 | process = 0; | ||
396 | break; | ||
397 | case SWITCH_T: | ||
398 | if (cplb_data[i].attr & SWITCH_T) { | ||
399 | t_i = &cplb.switch_i; | ||
400 | t_d = &cplb.switch_d; | ||
401 | process = 1; | ||
402 | } else | ||
403 | process = 0; | ||
404 | break; | ||
405 | default: | ||
406 | process = 0; | ||
407 | break; | ||
408 | } | ||
409 | |||
410 | if (!process) | ||
411 | continue; | ||
412 | if (cplb_data[i].attr & I_CPLB) | ||
413 | __fill_code_cplbtab(t_i, i, a_start, a_end); | ||
414 | |||
415 | if (cplb_data[i].attr & D_CPLB) | ||
416 | __fill_data_cplbtab(t_d, i, a_start, a_end); | ||
417 | } | ||
418 | } | ||
419 | |||
420 | /* close tables */ | ||
421 | |||
422 | close_cplbtab(&cplb.init_i); | ||
423 | close_cplbtab(&cplb.init_d); | ||
424 | |||
425 | cplb.init_i.tab[cplb.init_i.pos] = -1; | ||
426 | cplb.init_d.tab[cplb.init_d.pos] = -1; | ||
427 | cplb.switch_i.tab[cplb.switch_i.pos] = -1; | ||
428 | cplb.switch_d.tab[cplb.switch_d.pos] = -1; | ||
429 | |||
430 | } | ||
431 | |||
432 | #endif | ||
433 | |||
diff --git a/arch/blackfin/kernel/dma-mapping.c b/arch/blackfin/kernel/dma-mapping.c index 539eb24e062f..ea48d5b13f11 100644 --- a/arch/blackfin/kernel/dma-mapping.c +++ b/arch/blackfin/kernel/dma-mapping.c | |||
@@ -34,8 +34,8 @@ | |||
34 | #include <linux/spinlock.h> | 34 | #include <linux/spinlock.h> |
35 | #include <linux/device.h> | 35 | #include <linux/device.h> |
36 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
37 | #include <linux/io.h> | ||
37 | #include <asm/cacheflush.h> | 38 | #include <asm/cacheflush.h> |
38 | #include <asm/io.h> | ||
39 | #include <asm/bfin-global.h> | 39 | #include <asm/bfin-global.h> |
40 | 40 | ||
41 | static spinlock_t dma_page_lock; | 41 | static spinlock_t dma_page_lock; |
@@ -159,10 +159,13 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
159 | 159 | ||
160 | BUG_ON(direction == DMA_NONE); | 160 | BUG_ON(direction == DMA_NONE); |
161 | 161 | ||
162 | for (i = 0; i < nents; i++) | 162 | for (i = 0; i < nents; i++, sg++) { |
163 | invalidate_dcache_range(sg_dma_address(&sg[i]), | 163 | sg->dma_address = page_address(sg->page) + sg->offset; |
164 | sg_dma_address(&sg[i]) + | 164 | |
165 | sg_dma_len(&sg[i])); | 165 | invalidate_dcache_range(sg_dma_address(sg), |
166 | sg_dma_address(sg) + | ||
167 | sg_dma_len(sg)); | ||
168 | } | ||
166 | 169 | ||
167 | return nents; | 170 | return nents; |
168 | } | 171 | } |
diff --git a/arch/blackfin/kernel/dualcore_test.c b/arch/blackfin/kernel/dualcore_test.c index 8b89c99f9dfa..0fcba74840b7 100644 --- a/arch/blackfin/kernel/dualcore_test.c +++ b/arch/blackfin/kernel/dualcore_test.c | |||
@@ -30,19 +30,19 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | 32 | ||
33 | static int *testarg = (int*)0xfeb00000; | 33 | static int *testarg = (int *)0xfeb00000; |
34 | 34 | ||
35 | static int test_init(void) | 35 | static int test_init(void) |
36 | { | 36 | { |
37 | *testarg = 1; | 37 | *testarg = 1; |
38 | printk("Dual core test module inserted: set testarg = [%d]\n @ [%p]\n", | 38 | printk(KERN_INFO "Dual core test module inserted: set testarg = [%d]\n @ [%p]\n", |
39 | *testarg, testarg); | 39 | *testarg, testarg); |
40 | return 0; | 40 | return 0; |
41 | } | 41 | } |
42 | 42 | ||
43 | static void test_exit(void) | 43 | static void test_exit(void) |
44 | { | 44 | { |
45 | printk("Dual core test module removed: testarg = [%d]\n", *testarg); | 45 | printk(KERN_INFO "Dual core test module removed: testarg = [%d]\n", *testarg); |
46 | } | 46 | } |
47 | 47 | ||
48 | module_init(test_init); | 48 | module_init(test_init); |
diff --git a/arch/blackfin/kernel/fixed_code.S b/arch/blackfin/kernel/fixed_code.S new file mode 100644 index 000000000000..d8b1ebc70996 --- /dev/null +++ b/arch/blackfin/kernel/fixed_code.S | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * This file contains sequences of code that will be copied to a | ||
3 | * fixed location, defined in <asm/atomic_seq.h>. The interrupt | ||
4 | * handlers ensure that these sequences appear to be atomic when | ||
5 | * executed from userspace. | ||
6 | * These are aligned to 16 bytes, so that we have some space to replace | ||
7 | * these sequences with something else (e.g. kernel traps if we ever do | ||
8 | * BF561 SMP). | ||
9 | */ | ||
10 | #include <linux/linkage.h> | ||
11 | #include <linux/unistd.h> | ||
12 | #include <asm/entry.h> | ||
13 | |||
14 | .text | ||
15 | ENTRY(_fixed_code_start) | ||
16 | |||
17 | .align 16 | ||
18 | ENTRY(_sigreturn_stub) | ||
19 | P0 = __NR_rt_sigreturn; | ||
20 | EXCPT 0; | ||
21 | /* Speculative execution paranoia. */ | ||
22 | 0: JUMP.S 0b; | ||
23 | ENDPROC (_sigreturn_stub) | ||
24 | |||
25 | .align 16 | ||
26 | /* | ||
27 | * Atomic swap, 8 bit. | ||
28 | * Inputs: P0: memory address to use | ||
29 | * R1: value to store | ||
30 | * Output: R0: old contents of the memory address, zero extended. | ||
31 | */ | ||
32 | ENTRY(_atomic_xchg32) | ||
33 | R0 = [P0]; | ||
34 | [P0] = R1; | ||
35 | rts; | ||
36 | ENDPROC (_atomic_xchg32) | ||
37 | |||
38 | .align 16 | ||
39 | /* | ||
40 | * Compare and swap, 32 bit. | ||
41 | * Inputs: P0: memory address to use | ||
42 | * R1: compare value | ||
43 | * R2: new value to store | ||
44 | * The new value is stored if the contents of the memory | ||
45 | * address is equal to the compare value. | ||
46 | * Output: R0: old contents of the memory address. | ||
47 | */ | ||
48 | ENTRY(_atomic_cas32) | ||
49 | R0 = [P0]; | ||
50 | CC = R0 == R1; | ||
51 | IF !CC JUMP 1f; | ||
52 | [P0] = R2; | ||
53 | 1: | ||
54 | rts; | ||
55 | ENDPROC (_atomic_cas32) | ||
56 | |||
57 | .align 16 | ||
58 | /* | ||
59 | * Atomic add, 32 bit. | ||
60 | * Inputs: P0: memory address to use | ||
61 | * R0: value to add | ||
62 | * Outputs: R0: new contents of the memory address. | ||
63 | * R1: previous contents of the memory address. | ||
64 | */ | ||
65 | ENTRY(_atomic_add32) | ||
66 | R1 = [P0]; | ||
67 | R0 = R1 + R0; | ||
68 | [P0] = R0; | ||
69 | rts; | ||
70 | ENDPROC (_atomic_add32) | ||
71 | |||
72 | .align 16 | ||
73 | /* | ||
74 | * Atomic sub, 32 bit. | ||
75 | * Inputs: P0: memory address to use | ||
76 | * R0: value to subtract | ||
77 | * Outputs: R0: new contents of the memory address. | ||
78 | * R1: previous contents of the memory address. | ||
79 | */ | ||
80 | ENTRY(_atomic_sub32) | ||
81 | R1 = [P0]; | ||
82 | R0 = R1 - R0; | ||
83 | [P0] = R0; | ||
84 | rts; | ||
85 | ENDPROC (_atomic_sub32) | ||
86 | |||
87 | .align 16 | ||
88 | /* | ||
89 | * Atomic ior, 32 bit. | ||
90 | * Inputs: P0: memory address to use | ||
91 | * R0: value to ior | ||
92 | * Outputs: R0: new contents of the memory address. | ||
93 | * R1: previous contents of the memory address. | ||
94 | */ | ||
95 | ENTRY(_atomic_ior32) | ||
96 | R1 = [P0]; | ||
97 | R0 = R1 | R0; | ||
98 | [P0] = R0; | ||
99 | rts; | ||
100 | ENDPROC (_atomic_ior32) | ||
101 | |||
102 | .align 16 | ||
103 | /* | ||
104 | * Atomic ior, 32 bit. | ||
105 | * Inputs: P0: memory address to use | ||
106 | * R0: value to ior | ||
107 | * Outputs: R0: new contents of the memory address. | ||
108 | * R1: previous contents of the memory address. | ||
109 | */ | ||
110 | ENTRY(_atomic_and32) | ||
111 | R1 = [P0]; | ||
112 | R0 = R1 & R0; | ||
113 | [P0] = R0; | ||
114 | rts; | ||
115 | ENDPROC (_atomic_ior32) | ||
116 | |||
117 | .align 16 | ||
118 | /* | ||
119 | * Atomic ior, 32 bit. | ||
120 | * Inputs: P0: memory address to use | ||
121 | * R0: value to ior | ||
122 | * Outputs: R0: new contents of the memory address. | ||
123 | * R1: previous contents of the memory address. | ||
124 | */ | ||
125 | ENTRY(_atomic_xor32) | ||
126 | R1 = [P0]; | ||
127 | R0 = R1 ^ R0; | ||
128 | [P0] = R0; | ||
129 | rts; | ||
130 | ENDPROC (_atomic_ior32) | ||
131 | |||
132 | ENTRY(_fixed_code_end) | ||
diff --git a/arch/blackfin/kernel/flat.c b/arch/blackfin/kernel/flat.c index a92587b628b5..d188b2430536 100644 --- a/arch/blackfin/kernel/flat.c +++ b/arch/blackfin/kernel/flat.c | |||
@@ -36,24 +36,22 @@ unsigned long bfin_get_addr_from_rp(unsigned long *ptr, | |||
36 | unsigned long val; | 36 | unsigned long val; |
37 | 37 | ||
38 | switch (type) { | 38 | switch (type) { |
39 | case FLAT_BFIN_RELOC_TYPE_16_BIT: | 39 | case FLAT_BFIN_RELOC_TYPE_16_BIT: |
40 | case FLAT_BFIN_RELOC_TYPE_16H_BIT: | 40 | case FLAT_BFIN_RELOC_TYPE_16H_BIT: |
41 | usptr = (unsigned short *)ptr; | 41 | usptr = (unsigned short *)ptr; |
42 | pr_debug("*usptr = %x", get_unaligned(usptr)); | 42 | pr_debug("*usptr = %x", get_unaligned(usptr)); |
43 | val = get_unaligned(usptr); | 43 | val = get_unaligned(usptr); |
44 | val += *persistent; | 44 | val += *persistent; |
45 | break; | 45 | break; |
46 | 46 | ||
47 | case FLAT_BFIN_RELOC_TYPE_32_BIT: | 47 | case FLAT_BFIN_RELOC_TYPE_32_BIT: |
48 | pr_debug("*ptr = %lx", get_unaligned(ptr)); | 48 | pr_debug("*ptr = %lx", get_unaligned(ptr)); |
49 | val = get_unaligned(ptr); | 49 | val = get_unaligned(ptr); |
50 | break; | 50 | break; |
51 | 51 | ||
52 | default: | 52 | default: |
53 | pr_debug("BINFMT_FLAT: Unknown relocation type %x\n", | 53 | pr_debug("BINFMT_FLAT: Unknown relocation type %x\n", type); |
54 | type); | 54 | return 0; |
55 | |||
56 | return 0; | ||
57 | } | 55 | } |
58 | 56 | ||
59 | /* | 57 | /* |
@@ -81,21 +79,20 @@ void bfin_put_addr_at_rp(unsigned long *ptr, unsigned long addr, | |||
81 | int type = (relval >> 26) & 7; | 79 | int type = (relval >> 26) & 7; |
82 | 80 | ||
83 | switch (type) { | 81 | switch (type) { |
84 | case FLAT_BFIN_RELOC_TYPE_16_BIT: | 82 | case FLAT_BFIN_RELOC_TYPE_16_BIT: |
85 | put_unaligned(addr, usptr); | 83 | put_unaligned(addr, usptr); |
86 | pr_debug("new value %x at %p", get_unaligned(usptr), | 84 | pr_debug("new value %x at %p", get_unaligned(usptr), usptr); |
87 | usptr); | 85 | break; |
88 | break; | ||
89 | 86 | ||
90 | case FLAT_BFIN_RELOC_TYPE_16H_BIT: | 87 | case FLAT_BFIN_RELOC_TYPE_16H_BIT: |
91 | put_unaligned(addr >> 16, usptr); | 88 | put_unaligned(addr >> 16, usptr); |
92 | pr_debug("new value %x", get_unaligned(usptr)); | 89 | pr_debug("new value %x", get_unaligned(usptr)); |
93 | break; | 90 | break; |
94 | 91 | ||
95 | case FLAT_BFIN_RELOC_TYPE_32_BIT: | 92 | case FLAT_BFIN_RELOC_TYPE_32_BIT: |
96 | put_unaligned(addr, ptr); | 93 | put_unaligned(addr, ptr); |
97 | pr_debug("new ptr =%lx", get_unaligned(ptr)); | 94 | pr_debug("new ptr =%lx", get_unaligned(ptr)); |
98 | break; | 95 | break; |
99 | } | 96 | } |
100 | } | 97 | } |
101 | EXPORT_SYMBOL(bfin_put_addr_at_rp); | 98 | EXPORT_SYMBOL(bfin_put_addr_at_rp); |
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c index 80996a1a94ca..1fc001c7abda 100644 --- a/arch/blackfin/kernel/irqchip.c +++ b/arch/blackfin/kernel/irqchip.c | |||
@@ -82,7 +82,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
82 | seq_printf(p, ", %s", action->name); | 82 | seq_printf(p, ", %s", action->name); |
83 | 83 | ||
84 | seq_putc(p, '\n'); | 84 | seq_putc(p, '\n'); |
85 | unlock: | 85 | unlock: |
86 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 86 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
87 | } else if (i == NR_IRQS) { | 87 | } else if (i == NR_IRQS) { |
88 | seq_printf(p, "Err: %10lu\n", irq_err_count); | 88 | seq_printf(p, "Err: %10lu\n", irq_err_count); |
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c new file mode 100644 index 000000000000..a9c15515bfd7 --- /dev/null +++ b/arch/blackfin/kernel/kgdb.c | |||
@@ -0,0 +1,421 @@ | |||
1 | /* | ||
2 | * File: arch/blackfin/kernel/kgdb.c | ||
3 | * Based on: | ||
4 | * Author: Sonic Zhang | ||
5 | * | ||
6 | * Created: | ||
7 | * Description: | ||
8 | * | ||
9 | * Rev: $Id: kgdb_bfin_linux-2.6.x.patch 4934 2007-02-13 09:32:11Z sonicz $ | ||
10 | * | ||
11 | * Modified: | ||
12 | * Copyright 2005-2006 Analog Devices Inc. | ||
13 | * | ||
14 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License as published by | ||
18 | * the Free Software Foundation; either version 2 of the License, or | ||
19 | * (at your option) any later version. | ||
20 | * | ||
21 | * This program is distributed in the hope that it will be useful, | ||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
24 | * GNU General Public License for more details. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License | ||
27 | * along with this program; if not, see the file COPYING, or write | ||
28 | * to the Free Software Foundation, Inc., | ||
29 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
30 | */ | ||
31 | |||
32 | #include <linux/string.h> | ||
33 | #include <linux/kernel.h> | ||
34 | #include <linux/sched.h> | ||
35 | #include <linux/smp.h> | ||
36 | #include <linux/spinlock.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include <linux/ptrace.h> /* for linux pt_regs struct */ | ||
39 | #include <linux/kgdb.h> | ||
40 | #include <linux/console.h> | ||
41 | #include <linux/init.h> | ||
42 | #include <linux/debugger.h> | ||
43 | #include <linux/errno.h> | ||
44 | #include <linux/irq.h> | ||
45 | #include <asm/system.h> | ||
46 | #include <asm/traps.h> | ||
47 | #include <asm/blackfin.h> | ||
48 | |||
49 | /* Put the error code here just in case the user cares. */ | ||
50 | int gdb_bf533errcode; | ||
51 | /* Likewise, the vector number here (since GDB only gets the signal | ||
52 | number through the usual means, and that's not very specific). */ | ||
53 | int gdb_bf533vector = -1; | ||
54 | |||
55 | #if KGDB_MAX_NO_CPUS != 8 | ||
56 | #error change the definition of slavecpulocks | ||
57 | #endif | ||
58 | |||
59 | void regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) | ||
60 | { | ||
61 | gdb_regs[BFIN_R0] = regs->r0; | ||
62 | gdb_regs[BFIN_R1] = regs->r1; | ||
63 | gdb_regs[BFIN_R2] = regs->r2; | ||
64 | gdb_regs[BFIN_R3] = regs->r3; | ||
65 | gdb_regs[BFIN_R4] = regs->r4; | ||
66 | gdb_regs[BFIN_R5] = regs->r5; | ||
67 | gdb_regs[BFIN_R6] = regs->r6; | ||
68 | gdb_regs[BFIN_R7] = regs->r7; | ||
69 | gdb_regs[BFIN_P0] = regs->p0; | ||
70 | gdb_regs[BFIN_P1] = regs->p1; | ||
71 | gdb_regs[BFIN_P2] = regs->p2; | ||
72 | gdb_regs[BFIN_P3] = regs->p3; | ||
73 | gdb_regs[BFIN_P4] = regs->p4; | ||
74 | gdb_regs[BFIN_P5] = regs->p5; | ||
75 | gdb_regs[BFIN_SP] = regs->reserved; | ||
76 | gdb_regs[BFIN_FP] = regs->fp; | ||
77 | gdb_regs[BFIN_I0] = regs->i0; | ||
78 | gdb_regs[BFIN_I1] = regs->i1; | ||
79 | gdb_regs[BFIN_I2] = regs->i2; | ||
80 | gdb_regs[BFIN_I3] = regs->i3; | ||
81 | gdb_regs[BFIN_M0] = regs->m0; | ||
82 | gdb_regs[BFIN_M1] = regs->m1; | ||
83 | gdb_regs[BFIN_M2] = regs->m2; | ||
84 | gdb_regs[BFIN_M3] = regs->m3; | ||
85 | gdb_regs[BFIN_B0] = regs->b0; | ||
86 | gdb_regs[BFIN_B1] = regs->b1; | ||
87 | gdb_regs[BFIN_B2] = regs->b2; | ||
88 | gdb_regs[BFIN_B3] = regs->b3; | ||
89 | gdb_regs[BFIN_L0] = regs->l0; | ||
90 | gdb_regs[BFIN_L1] = regs->l1; | ||
91 | gdb_regs[BFIN_L2] = regs->l2; | ||
92 | gdb_regs[BFIN_L3] = regs->l3; | ||
93 | gdb_regs[BFIN_A0_DOT_X] = regs->a0x; | ||
94 | gdb_regs[BFIN_A0_DOT_W] = regs->a0w; | ||
95 | gdb_regs[BFIN_A1_DOT_X] = regs->a1x; | ||
96 | gdb_regs[BFIN_A1_DOT_W] = regs->a1w; | ||
97 | gdb_regs[BFIN_ASTAT] = regs->astat; | ||
98 | gdb_regs[BFIN_RETS] = regs->rets; | ||
99 | gdb_regs[BFIN_LC0] = regs->lc0; | ||
100 | gdb_regs[BFIN_LT0] = regs->lt0; | ||
101 | gdb_regs[BFIN_LB0] = regs->lb0; | ||
102 | gdb_regs[BFIN_LC1] = regs->lc1; | ||
103 | gdb_regs[BFIN_LT1] = regs->lt1; | ||
104 | gdb_regs[BFIN_LB1] = regs->lb1; | ||
105 | gdb_regs[BFIN_CYCLES] = 0; | ||
106 | gdb_regs[BFIN_CYCLES2] = 0; | ||
107 | gdb_regs[BFIN_USP] = regs->usp; | ||
108 | gdb_regs[BFIN_SEQSTAT] = regs->seqstat; | ||
109 | gdb_regs[BFIN_SYSCFG] = regs->syscfg; | ||
110 | gdb_regs[BFIN_RETI] = regs->pc; | ||
111 | gdb_regs[BFIN_RETX] = regs->retx; | ||
112 | gdb_regs[BFIN_RETN] = regs->retn; | ||
113 | gdb_regs[BFIN_RETE] = regs->rete; | ||
114 | gdb_regs[BFIN_PC] = regs->pc; | ||
115 | gdb_regs[BFIN_CC] = 0; | ||
116 | gdb_regs[BFIN_EXTRA1] = 0; | ||
117 | gdb_regs[BFIN_EXTRA2] = 0; | ||
118 | gdb_regs[BFIN_EXTRA3] = 0; | ||
119 | gdb_regs[BFIN_IPEND] = regs->ipend; | ||
120 | } | ||
121 | |||
122 | /* | ||
123 | * Extracts ebp, esp and eip values understandable by gdb from the values | ||
124 | * saved by switch_to. | ||
125 | * thread.esp points to ebp. flags and ebp are pushed in switch_to hence esp | ||
126 | * prior to entering switch_to is 8 greater then the value that is saved. | ||
127 | * If switch_to changes, change following code appropriately. | ||
128 | */ | ||
129 | void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) | ||
130 | { | ||
131 | gdb_regs[BFIN_SP] = p->thread.ksp; | ||
132 | gdb_regs[BFIN_PC] = p->thread.pc; | ||
133 | gdb_regs[BFIN_SEQSTAT] = p->thread.seqstat; | ||
134 | } | ||
135 | |||
136 | void gdb_regs_to_regs(unsigned long *gdb_regs, struct pt_regs *regs) | ||
137 | { | ||
138 | regs->r0 = gdb_regs[BFIN_R0]; | ||
139 | regs->r1 = gdb_regs[BFIN_R1]; | ||
140 | regs->r2 = gdb_regs[BFIN_R2]; | ||
141 | regs->r3 = gdb_regs[BFIN_R3]; | ||
142 | regs->r4 = gdb_regs[BFIN_R4]; | ||
143 | regs->r5 = gdb_regs[BFIN_R5]; | ||
144 | regs->r6 = gdb_regs[BFIN_R6]; | ||
145 | regs->r7 = gdb_regs[BFIN_R7]; | ||
146 | regs->p0 = gdb_regs[BFIN_P0]; | ||
147 | regs->p1 = gdb_regs[BFIN_P1]; | ||
148 | regs->p2 = gdb_regs[BFIN_P2]; | ||
149 | regs->p3 = gdb_regs[BFIN_P3]; | ||
150 | regs->p4 = gdb_regs[BFIN_P4]; | ||
151 | regs->p5 = gdb_regs[BFIN_P5]; | ||
152 | regs->fp = gdb_regs[BFIN_FP]; | ||
153 | regs->i0 = gdb_regs[BFIN_I0]; | ||
154 | regs->i1 = gdb_regs[BFIN_I1]; | ||
155 | regs->i2 = gdb_regs[BFIN_I2]; | ||
156 | regs->i3 = gdb_regs[BFIN_I3]; | ||
157 | regs->m0 = gdb_regs[BFIN_M0]; | ||
158 | regs->m1 = gdb_regs[BFIN_M1]; | ||
159 | regs->m2 = gdb_regs[BFIN_M2]; | ||
160 | regs->m3 = gdb_regs[BFIN_M3]; | ||
161 | regs->b0 = gdb_regs[BFIN_B0]; | ||
162 | regs->b1 = gdb_regs[BFIN_B1]; | ||
163 | regs->b2 = gdb_regs[BFIN_B2]; | ||
164 | regs->b3 = gdb_regs[BFIN_B3]; | ||
165 | regs->l0 = gdb_regs[BFIN_L0]; | ||
166 | regs->l1 = gdb_regs[BFIN_L1]; | ||
167 | regs->l2 = gdb_regs[BFIN_L2]; | ||
168 | regs->l3 = gdb_regs[BFIN_L3]; | ||
169 | regs->a0x = gdb_regs[BFIN_A0_DOT_X]; | ||
170 | regs->a0w = gdb_regs[BFIN_A0_DOT_W]; | ||
171 | regs->a1x = gdb_regs[BFIN_A1_DOT_X]; | ||
172 | regs->a1w = gdb_regs[BFIN_A1_DOT_W]; | ||
173 | regs->rets = gdb_regs[BFIN_RETS]; | ||
174 | regs->lc0 = gdb_regs[BFIN_LC0]; | ||
175 | regs->lt0 = gdb_regs[BFIN_LT0]; | ||
176 | regs->lb0 = gdb_regs[BFIN_LB0]; | ||
177 | regs->lc1 = gdb_regs[BFIN_LC1]; | ||
178 | regs->lt1 = gdb_regs[BFIN_LT1]; | ||
179 | regs->lb1 = gdb_regs[BFIN_LB1]; | ||
180 | regs->usp = gdb_regs[BFIN_USP]; | ||
181 | regs->syscfg = gdb_regs[BFIN_SYSCFG]; | ||
182 | regs->retx = gdb_regs[BFIN_PC]; | ||
183 | regs->retn = gdb_regs[BFIN_RETN]; | ||
184 | regs->rete = gdb_regs[BFIN_RETE]; | ||
185 | regs->pc = gdb_regs[BFIN_PC]; | ||
186 | |||
187 | #if 0 /* can't change these */ | ||
188 | regs->astat = gdb_regs[BFIN_ASTAT]; | ||
189 | regs->seqstat = gdb_regs[BFIN_SEQSTAT]; | ||
190 | regs->ipend = gdb_regs[BFIN_IPEND]; | ||
191 | #endif | ||
192 | } | ||
193 | |||
194 | struct hw_breakpoint { | ||
195 | unsigned int occupied:1; | ||
196 | unsigned int skip:1; | ||
197 | unsigned int enabled:1; | ||
198 | unsigned int type:1; | ||
199 | unsigned int dataacc:2; | ||
200 | unsigned short count; | ||
201 | unsigned int addr; | ||
202 | } breakinfo[HW_BREAKPOINT_NUM]; | ||
203 | |||
204 | int kgdb_arch_init(void) | ||
205 | { | ||
206 | kgdb_remove_all_hw_break(); | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | int kgdb_set_hw_break(unsigned long addr) | ||
211 | { | ||
212 | int breakno; | ||
213 | for (breakno = 0; breakno < HW_BREAKPOINT_NUM; breakno++) | ||
214 | if (!breakinfo[breakno].occupied) { | ||
215 | breakinfo[breakno].occupied = 1; | ||
216 | breakinfo[breakno].enabled = 1; | ||
217 | breakinfo[breakno].type = 1; | ||
218 | breakinfo[breakno].addr = addr; | ||
219 | return 0; | ||
220 | } | ||
221 | |||
222 | return -ENOSPC; | ||
223 | } | ||
224 | |||
225 | int kgdb_remove_hw_break(unsigned long addr) | ||
226 | { | ||
227 | int breakno; | ||
228 | for (breakno = 0; breakno < HW_BREAKPOINT_NUM; breakno++) | ||
229 | if (breakinfo[breakno].addr == addr) | ||
230 | memset(&(breakinfo[breakno]), 0, sizeof(struct hw_breakpoint)); | ||
231 | |||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | void kgdb_remove_all_hw_break(void) | ||
236 | { | ||
237 | memset(breakinfo, 0, sizeof(struct hw_breakpoint)*8); | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | void kgdb_show_info(void) | ||
242 | { | ||
243 | printk(KERN_DEBUG "hwd: wpia0=0x%x, wpiacnt0=%d, wpiactl=0x%x, wpstat=0x%x\n", | ||
244 | bfin_read_WPIA0(), bfin_read_WPIACNT0(), | ||
245 | bfin_read_WPIACTL(), bfin_read_WPSTAT()); | ||
246 | } | ||
247 | */ | ||
248 | |||
249 | void kgdb_correct_hw_break(void) | ||
250 | { | ||
251 | int breakno; | ||
252 | int correctit; | ||
253 | uint32_t wpdactl = bfin_read_WPDACTL(); | ||
254 | |||
255 | correctit = 0; | ||
256 | for (breakno = 0; breakno < HW_BREAKPOINT_NUM; breakno++) { | ||
257 | if (breakinfo[breakno].type == 1) { | ||
258 | switch (breakno) { | ||
259 | case 0: | ||
260 | if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN0)) { | ||
261 | correctit = 1; | ||
262 | wpdactl &= ~(WPIREN01|EMUSW0); | ||
263 | wpdactl |= WPIAEN0|WPICNTEN0; | ||
264 | bfin_write_WPIA0(breakinfo[breakno].addr); | ||
265 | bfin_write_WPIACNT0(breakinfo[breakno].skip); | ||
266 | } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN0)) { | ||
267 | correctit = 1; | ||
268 | wpdactl &= ~WPIAEN0; | ||
269 | } | ||
270 | break; | ||
271 | |||
272 | case 1: | ||
273 | if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN1)) { | ||
274 | correctit = 1; | ||
275 | wpdactl &= ~(WPIREN01|EMUSW1); | ||
276 | wpdactl |= WPIAEN1|WPICNTEN1; | ||
277 | bfin_write_WPIA1(breakinfo[breakno].addr); | ||
278 | bfin_write_WPIACNT1(breakinfo[breakno].skip); | ||
279 | } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN1)) { | ||
280 | correctit = 1; | ||
281 | wpdactl &= ~WPIAEN1; | ||
282 | } | ||
283 | break; | ||
284 | |||
285 | case 2: | ||
286 | if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN2)) { | ||
287 | correctit = 1; | ||
288 | wpdactl &= ~(WPIREN23|EMUSW2); | ||
289 | wpdactl |= WPIAEN2|WPICNTEN2; | ||
290 | bfin_write_WPIA2(breakinfo[breakno].addr); | ||
291 | bfin_write_WPIACNT2(breakinfo[breakno].skip); | ||
292 | } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN2)) { | ||
293 | correctit = 1; | ||
294 | wpdactl &= ~WPIAEN2; | ||
295 | } | ||
296 | break; | ||
297 | |||
298 | case 3: | ||
299 | if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN3)) { | ||
300 | correctit = 1; | ||
301 | wpdactl &= ~(WPIREN23|EMUSW3); | ||
302 | wpdactl |= WPIAEN3|WPICNTEN3; | ||
303 | bfin_write_WPIA3(breakinfo[breakno].addr); | ||
304 | bfin_write_WPIACNT3(breakinfo[breakno].skip); | ||
305 | } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN3)) { | ||
306 | correctit = 1; | ||
307 | wpdactl &= ~WPIAEN3; | ||
308 | } | ||
309 | break; | ||
310 | case 4: | ||
311 | if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN4)) { | ||
312 | correctit = 1; | ||
313 | wpdactl &= ~(WPIREN45|EMUSW4); | ||
314 | wpdactl |= WPIAEN4|WPICNTEN4; | ||
315 | bfin_write_WPIA4(breakinfo[breakno].addr); | ||
316 | bfin_write_WPIACNT4(breakinfo[breakno].skip); | ||
317 | } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN4)) { | ||
318 | correctit = 1; | ||
319 | wpdactl &= ~WPIAEN4; | ||
320 | } | ||
321 | break; | ||
322 | case 5: | ||
323 | if (breakinfo[breakno].enabled && !(wpdactl & WPIAEN5)) { | ||
324 | correctit = 1; | ||
325 | wpdactl &= ~(WPIREN45|EMUSW5); | ||
326 | wpdactl |= WPIAEN5|WPICNTEN5; | ||
327 | bfin_write_WPIA5(breakinfo[breakno].addr); | ||
328 | bfin_write_WPIACNT5(breakinfo[breakno].skip); | ||
329 | } else if (!breakinfo[breakno].enabled && (wpdactl & WPIAEN5)) { | ||
330 | correctit = 1; | ||
331 | wpdactl &= ~WPIAEN5; | ||
332 | } | ||
333 | break; | ||
334 | } | ||
335 | } | ||
336 | } | ||
337 | if (correctit) { | ||
338 | wpdactl &= ~WPAND; | ||
339 | wpdactl |= WPPWR; | ||
340 | /*printk("correct_hw_break: wpdactl=0x%x\n", wpdactl);*/ | ||
341 | bfin_write_WPDACTL(wpdactl); | ||
342 | CSYNC(); | ||
343 | /*kgdb_show_info();*/ | ||
344 | } | ||
345 | } | ||
346 | |||
347 | void kgdb_disable_hw_debug(struct pt_regs *regs) | ||
348 | { | ||
349 | /* Disable hardware debugging while we are in kgdb */ | ||
350 | bfin_write_WPIACTL(bfin_read_WPIACTL() & ~0x1); | ||
351 | CSYNC(); | ||
352 | } | ||
353 | |||
354 | void kgdb_post_master_code(struct pt_regs *regs, int eVector, int err_code) | ||
355 | { | ||
356 | /* Master processor is completely in the debugger */ | ||
357 | gdb_bf533vector = eVector; | ||
358 | gdb_bf533errcode = err_code; | ||
359 | } | ||
360 | |||
361 | int kgdb_arch_handle_exception(int exceptionVector, int signo, | ||
362 | int err_code, char *remcom_in_buffer, | ||
363 | char *remcom_out_buffer, | ||
364 | struct pt_regs *linux_regs) | ||
365 | { | ||
366 | long addr; | ||
367 | long breakno; | ||
368 | char *ptr; | ||
369 | int newPC; | ||
370 | int wp_status; | ||
371 | |||
372 | switch (remcom_in_buffer[0]) { | ||
373 | case 'c': | ||
374 | case 's': | ||
375 | if (kgdb_contthread && kgdb_contthread != current) { | ||
376 | strcpy(remcom_out_buffer, "E00"); | ||
377 | break; | ||
378 | } | ||
379 | |||
380 | kgdb_contthread = NULL; | ||
381 | |||
382 | /* try to read optional parameter, pc unchanged if no parm */ | ||
383 | ptr = &remcom_in_buffer[1]; | ||
384 | if (kgdb_hex2long(&ptr, &addr)) { | ||
385 | linux_regs->retx = addr; | ||
386 | } | ||
387 | newPC = linux_regs->retx; | ||
388 | |||
389 | /* clear the trace bit */ | ||
390 | linux_regs->syscfg &= 0xfffffffe; | ||
391 | |||
392 | /* set the trace bit if we're stepping */ | ||
393 | if (remcom_in_buffer[0] == 's') { | ||
394 | linux_regs->syscfg |= 0x1; | ||
395 | debugger_step = 1; | ||
396 | } | ||
397 | |||
398 | wp_status = bfin_read_WPSTAT(); | ||
399 | CSYNC(); | ||
400 | |||
401 | if (exceptionVector == VEC_WATCH) { | ||
402 | for (breakno = 0; breakno < 6; ++breakno) { | ||
403 | if (wp_status & (1 << breakno)) { | ||
404 | breakinfo->skip = 1; | ||
405 | break; | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | kgdb_correct_hw_break(); | ||
410 | |||
411 | bfin_write_WPSTAT(0); | ||
412 | |||
413 | return 0; | ||
414 | } /* switch */ | ||
415 | return -1; /* this means that we do not want to exit from the handler */ | ||
416 | } | ||
417 | |||
418 | struct kgdb_arch arch_kgdb_ops = { | ||
419 | .gdb_bpt_instr = {0xa1}, | ||
420 | .flags = KGDB_HW_BREAKPOINT, | ||
421 | }; | ||
diff --git a/arch/blackfin/kernel/module.c b/arch/blackfin/kernel/module.c index 372f756f1ad9..8b9fe29d03f4 100644 --- a/arch/blackfin/kernel/module.c +++ b/arch/blackfin/kernel/module.c | |||
@@ -165,8 +165,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | |||
165 | 165 | ||
166 | for (s = sechdrs; s < sechdrs_end; ++s) { | 166 | for (s = sechdrs; s < sechdrs_end; ++s) { |
167 | if ((strcmp(".l1.text", secstrings + s->sh_name) == 0) || | 167 | if ((strcmp(".l1.text", secstrings + s->sh_name) == 0) || |
168 | ((strcmp(".text", secstrings + s->sh_name)==0) && | 168 | ((strcmp(".text", secstrings + s->sh_name) == 0) && |
169 | (hdr->e_flags & FLG_CODE_IN_L1) && (s->sh_size > 0))) { | 169 | (hdr->e_flags & FLG_CODE_IN_L1) && (s->sh_size > 0))) { |
170 | mod->arch.text_l1 = s; | 170 | mod->arch.text_l1 = s; |
171 | dest = l1_inst_sram_alloc(s->sh_size); | 171 | dest = l1_inst_sram_alloc(s->sh_size); |
172 | if (dest == NULL) { | 172 | if (dest == NULL) { |
@@ -179,9 +179,9 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | |||
179 | s->sh_flags &= ~SHF_ALLOC; | 179 | s->sh_flags &= ~SHF_ALLOC; |
180 | s->sh_addr = (unsigned long)dest; | 180 | s->sh_addr = (unsigned long)dest; |
181 | } | 181 | } |
182 | if ((strcmp(".l1.data", secstrings + s->sh_name) == 0)|| | 182 | if ((strcmp(".l1.data", secstrings + s->sh_name) == 0) || |
183 | ((strcmp(".data", secstrings + s->sh_name)==0) && | 183 | ((strcmp(".data", secstrings + s->sh_name) == 0) && |
184 | (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { | 184 | (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { |
185 | mod->arch.data_a_l1 = s; | 185 | mod->arch.data_a_l1 = s; |
186 | dest = l1_data_sram_alloc(s->sh_size); | 186 | dest = l1_data_sram_alloc(s->sh_size); |
187 | if (dest == NULL) { | 187 | if (dest == NULL) { |
@@ -195,8 +195,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | |||
195 | s->sh_addr = (unsigned long)dest; | 195 | s->sh_addr = (unsigned long)dest; |
196 | } | 196 | } |
197 | if (strcmp(".l1.bss", secstrings + s->sh_name) == 0 || | 197 | if (strcmp(".l1.bss", secstrings + s->sh_name) == 0 || |
198 | ((strcmp(".bss", secstrings + s->sh_name)==0) && | 198 | ((strcmp(".bss", secstrings + s->sh_name) == 0) && |
199 | (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { | 199 | (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { |
200 | mod->arch.bss_a_l1 = s; | 200 | mod->arch.bss_a_l1 = s; |
201 | dest = l1_data_sram_alloc(s->sh_size); | 201 | dest = l1_data_sram_alloc(s->sh_size); |
202 | if (dest == NULL) { | 202 | if (dest == NULL) { |
@@ -326,7 +326,7 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab, | |||
326 | pr_debug("before %x after %x\n", *location16, | 326 | pr_debug("before %x after %x\n", *location16, |
327 | (value & 0xffff)); | 327 | (value & 0xffff)); |
328 | tmp = (value & 0xffff); | 328 | tmp = (value & 0xffff); |
329 | if((unsigned long)location16 >= L1_CODE_START) { | 329 | if ((unsigned long)location16 >= L1_CODE_START) { |
330 | dma_memcpy(location16, &tmp, 2); | 330 | dma_memcpy(location16, &tmp, 2); |
331 | } else | 331 | } else |
332 | *location16 = tmp; | 332 | *location16 = tmp; |
@@ -335,7 +335,7 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab, | |||
335 | pr_debug("before %x after %x\n", *location16, | 335 | pr_debug("before %x after %x\n", *location16, |
336 | ((value >> 16) & 0xffff)); | 336 | ((value >> 16) & 0xffff)); |
337 | tmp = ((value >> 16) & 0xffff); | 337 | tmp = ((value >> 16) & 0xffff); |
338 | if((unsigned long)location16 >= L1_CODE_START) { | 338 | if ((unsigned long)location16 >= L1_CODE_START) { |
339 | dma_memcpy(location16, &tmp, 2); | 339 | dma_memcpy(location16, &tmp, 2); |
340 | } else | 340 | } else |
341 | *location16 = tmp; | 341 | *location16 = tmp; |
@@ -404,8 +404,8 @@ module_finalize(const Elf_Ehdr * hdr, | |||
404 | continue; | 404 | continue; |
405 | 405 | ||
406 | if ((sechdrs[i].sh_type == SHT_RELA) && | 406 | if ((sechdrs[i].sh_type == SHT_RELA) && |
407 | ((strcmp(".rela.l1.text", secstrings + sechdrs[i].sh_name) == 0)|| | 407 | ((strcmp(".rela.l1.text", secstrings + sechdrs[i].sh_name) == 0) || |
408 | ((strcmp(".rela.text", secstrings + sechdrs[i].sh_name) == 0) && | 408 | ((strcmp(".rela.text", secstrings + sechdrs[i].sh_name) == 0) && |
409 | (hdr->e_flags & FLG_CODE_IN_L1)))) { | 409 | (hdr->e_flags & FLG_CODE_IN_L1)))) { |
410 | apply_relocate_add((Elf_Shdr *) sechdrs, strtab, | 410 | apply_relocate_add((Elf_Shdr *) sechdrs, strtab, |
411 | symindex, i, mod); | 411 | symindex, i, mod); |
@@ -417,13 +417,13 @@ module_finalize(const Elf_Ehdr * hdr, | |||
417 | void module_arch_cleanup(struct module *mod) | 417 | void module_arch_cleanup(struct module *mod) |
418 | { | 418 | { |
419 | if ((mod->arch.text_l1) && (mod->arch.text_l1->sh_addr)) | 419 | if ((mod->arch.text_l1) && (mod->arch.text_l1->sh_addr)) |
420 | l1_inst_sram_free((void*)mod->arch.text_l1->sh_addr); | 420 | l1_inst_sram_free((void *)mod->arch.text_l1->sh_addr); |
421 | if ((mod->arch.data_a_l1) && (mod->arch.data_a_l1->sh_addr)) | 421 | if ((mod->arch.data_a_l1) && (mod->arch.data_a_l1->sh_addr)) |
422 | l1_data_sram_free((void*)mod->arch.data_a_l1->sh_addr); | 422 | l1_data_sram_free((void *)mod->arch.data_a_l1->sh_addr); |
423 | if ((mod->arch.bss_a_l1) && (mod->arch.bss_a_l1->sh_addr)) | 423 | if ((mod->arch.bss_a_l1) && (mod->arch.bss_a_l1->sh_addr)) |
424 | l1_data_sram_free((void*)mod->arch.bss_a_l1->sh_addr); | 424 | l1_data_sram_free((void *)mod->arch.bss_a_l1->sh_addr); |
425 | if ((mod->arch.data_b_l1) && (mod->arch.data_b_l1->sh_addr)) | 425 | if ((mod->arch.data_b_l1) && (mod->arch.data_b_l1->sh_addr)) |
426 | l1_data_B_sram_free((void*)mod->arch.data_b_l1->sh_addr); | 426 | l1_data_B_sram_free((void *)mod->arch.data_b_l1->sh_addr); |
427 | if ((mod->arch.bss_b_l1) && (mod->arch.bss_b_l1->sh_addr)) | 427 | if ((mod->arch.bss_b_l1) && (mod->arch.bss_b_l1->sh_addr)) |
428 | l1_data_B_sram_free((void*)mod->arch.bss_b_l1->sh_addr); | 428 | l1_data_B_sram_free((void *)mod->arch.bss_b_l1->sh_addr); |
429 | } | 429 | } |
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index 3eff7439d8d3..5a51dd6ab280 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c | |||
@@ -32,9 +32,10 @@ | |||
32 | #include <linux/unistd.h> | 32 | #include <linux/unistd.h> |
33 | #include <linux/user.h> | 33 | #include <linux/user.h> |
34 | #include <linux/a.out.h> | 34 | #include <linux/a.out.h> |
35 | #include <linux/uaccess.h> | ||
35 | 36 | ||
36 | #include <asm/blackfin.h> | 37 | #include <asm/blackfin.h> |
37 | #include <asm/uaccess.h> | 38 | #include <asm/fixed_code.h> |
38 | 39 | ||
39 | #define LED_ON 0 | 40 | #define LED_ON 0 |
40 | #define LED_OFF 1 | 41 | #define LED_OFF 1 |
@@ -173,8 +174,8 @@ void show_regs(struct pt_regs *regs) | |||
173 | printk(KERN_NOTICE "R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n", | 174 | printk(KERN_NOTICE "R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n", |
174 | regs->r4, regs->r5, regs->r6, regs->r7); | 175 | regs->r4, regs->r5, regs->r6, regs->r7); |
175 | 176 | ||
176 | if (!(regs->ipend)) | 177 | if (!regs->ipend) |
177 | printk("USP: %08lx\n", rdusp()); | 178 | printk(KERN_NOTICE "USP: %08lx\n", rdusp()); |
178 | } | 179 | } |
179 | 180 | ||
180 | /* Fill in the fpu structure for a core dump. */ | 181 | /* Fill in the fpu structure for a core dump. */ |
@@ -322,7 +323,7 @@ asmlinkage int sys_execve(char *name, char **argv, char **envp) | |||
322 | goto out; | 323 | goto out; |
323 | error = do_execve(filename, argv, envp, regs); | 324 | error = do_execve(filename, argv, envp, regs); |
324 | putname(filename); | 325 | putname(filename); |
325 | out: | 326 | out: |
326 | unlock_kernel(); | 327 | unlock_kernel(); |
327 | return error; | 328 | return error; |
328 | } | 329 | } |
@@ -350,13 +351,77 @@ unsigned long get_wchan(struct task_struct *p) | |||
350 | return 0; | 351 | return 0; |
351 | } | 352 | } |
352 | 353 | ||
354 | void finish_atomic_sections (struct pt_regs *regs) | ||
355 | { | ||
356 | if (regs->pc < ATOMIC_SEQS_START || regs->pc >= ATOMIC_SEQS_END) | ||
357 | return; | ||
358 | |||
359 | switch (regs->pc) { | ||
360 | case ATOMIC_XCHG32 + 2: | ||
361 | put_user(regs->r1, (int *)regs->p0); | ||
362 | regs->pc += 2; | ||
363 | break; | ||
364 | |||
365 | case ATOMIC_CAS32 + 2: | ||
366 | case ATOMIC_CAS32 + 4: | ||
367 | if (regs->r0 == regs->r1) | ||
368 | put_user(regs->r2, (int *)regs->p0); | ||
369 | regs->pc = ATOMIC_CAS32 + 8; | ||
370 | break; | ||
371 | case ATOMIC_CAS32 + 6: | ||
372 | put_user(regs->r2, (int *)regs->p0); | ||
373 | regs->pc += 2; | ||
374 | break; | ||
375 | |||
376 | case ATOMIC_ADD32 + 2: | ||
377 | regs->r0 = regs->r1 + regs->r0; | ||
378 | /* fall through */ | ||
379 | case ATOMIC_ADD32 + 4: | ||
380 | put_user(regs->r0, (int *)regs->p0); | ||
381 | regs->pc = ATOMIC_ADD32 + 6; | ||
382 | break; | ||
383 | |||
384 | case ATOMIC_SUB32 + 2: | ||
385 | regs->r0 = regs->r1 - regs->r0; | ||
386 | /* fall through */ | ||
387 | case ATOMIC_SUB32 + 4: | ||
388 | put_user(regs->r0, (int *)regs->p0); | ||
389 | regs->pc = ATOMIC_SUB32 + 6; | ||
390 | break; | ||
391 | |||
392 | case ATOMIC_IOR32 + 2: | ||
393 | regs->r0 = regs->r1 | regs->r0; | ||
394 | /* fall through */ | ||
395 | case ATOMIC_IOR32 + 4: | ||
396 | put_user(regs->r0, (int *)regs->p0); | ||
397 | regs->pc = ATOMIC_IOR32 + 6; | ||
398 | break; | ||
399 | |||
400 | case ATOMIC_AND32 + 2: | ||
401 | regs->r0 = regs->r1 & regs->r0; | ||
402 | /* fall through */ | ||
403 | case ATOMIC_AND32 + 4: | ||
404 | put_user(regs->r0, (int *)regs->p0); | ||
405 | regs->pc = ATOMIC_AND32 + 6; | ||
406 | break; | ||
407 | |||
408 | case ATOMIC_XOR32 + 2: | ||
409 | regs->r0 = regs->r1 ^ regs->r0; | ||
410 | /* fall through */ | ||
411 | case ATOMIC_XOR32 + 4: | ||
412 | put_user(regs->r0, (int *)regs->p0); | ||
413 | regs->pc = ATOMIC_XOR32 + 6; | ||
414 | break; | ||
415 | } | ||
416 | } | ||
417 | |||
353 | #if defined(CONFIG_ACCESS_CHECK) | 418 | #if defined(CONFIG_ACCESS_CHECK) |
354 | int _access_ok(unsigned long addr, unsigned long size) | 419 | int _access_ok(unsigned long addr, unsigned long size) |
355 | { | 420 | { |
356 | 421 | ||
357 | if (addr > (addr + size)) | 422 | if (addr > (addr + size)) |
358 | return 0; | 423 | return 0; |
359 | if (segment_eq(get_fs(),KERNEL_DS)) | 424 | if (segment_eq(get_fs(), KERNEL_DS)) |
360 | return 1; | 425 | return 1; |
361 | #ifdef CONFIG_MTD_UCLINUX | 426 | #ifdef CONFIG_MTD_UCLINUX |
362 | if (addr >= memory_start && (addr + size) <= memory_end) | 427 | if (addr >= memory_start && (addr + size) <= memory_end) |
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index e718bb4a1ef0..ed800c7456dd 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c | |||
@@ -36,8 +36,8 @@ | |||
36 | #include <linux/ptrace.h> | 36 | #include <linux/ptrace.h> |
37 | #include <linux/user.h> | 37 | #include <linux/user.h> |
38 | #include <linux/signal.h> | 38 | #include <linux/signal.h> |
39 | #include <linux/uaccess.h> | ||
39 | 40 | ||
40 | #include <asm/uaccess.h> | ||
41 | #include <asm/page.h> | 41 | #include <asm/page.h> |
42 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
43 | #include <asm/system.h> | 43 | #include <asm/system.h> |
@@ -122,7 +122,7 @@ static inline long get_reg(struct task_struct *task, int regno) | |||
122 | static inline int | 122 | static inline int |
123 | put_reg(struct task_struct *task, int regno, unsigned long data) | 123 | put_reg(struct task_struct *task, int regno, unsigned long data) |
124 | { | 124 | { |
125 | char * reg_ptr; | 125 | char *reg_ptr; |
126 | 126 | ||
127 | struct pt_regs *regs = | 127 | struct pt_regs *regs = |
128 | (struct pt_regs *)((unsigned long)task_stack_page(task) + | 128 | (struct pt_regs *)((unsigned long)task_stack_page(task) + |
@@ -146,7 +146,7 @@ put_reg(struct task_struct *task, int regno, unsigned long data) | |||
146 | break; | 146 | break; |
147 | default: | 147 | default: |
148 | if (regno <= 216) | 148 | if (regno <= 216) |
149 | *(long *)(reg_ptr + regno) = data; | 149 | *(long *)(reg_ptr + regno) = data; |
150 | } | 150 | } |
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 83060f98d15d..f59dcee7bae3 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <asm/cacheflush.h> | 42 | #include <asm/cacheflush.h> |
43 | #include <asm/blackfin.h> | 43 | #include <asm/blackfin.h> |
44 | #include <asm/cplbinit.h> | 44 | #include <asm/cplbinit.h> |
45 | #include <asm/fixed_code.h> | ||
45 | 46 | ||
46 | u16 _bfin_swrst; | 47 | u16 _bfin_swrst; |
47 | 48 | ||
@@ -63,10 +64,6 @@ EXPORT_SYMBOL(mtd_size); | |||
63 | 64 | ||
64 | char __initdata command_line[COMMAND_LINE_SIZE]; | 65 | char __initdata command_line[COMMAND_LINE_SIZE]; |
65 | 66 | ||
66 | #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE) | ||
67 | static void generate_cpl_tables(void); | ||
68 | #endif | ||
69 | |||
70 | void __init bf53x_cache_init(void) | 67 | void __init bf53x_cache_init(void) |
71 | { | 68 | { |
72 | #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE) | 69 | #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE) |
@@ -197,6 +194,17 @@ void __init setup_arch(char **cmdline_p) | |||
197 | /* this give a chance to get printk() working before crash. */ | 194 | /* this give a chance to get printk() working before crash. */ |
198 | #endif | 195 | #endif |
199 | 196 | ||
197 | printk(KERN_INFO "Hardware Trace "); | ||
198 | if (bfin_read_TBUFCTL() & 0x1 ) | ||
199 | printk("Active "); | ||
200 | else | ||
201 | printk("Off "); | ||
202 | if (bfin_read_TBUFCTL() & 0x2) | ||
203 | printk("and Enabled\n"); | ||
204 | else | ||
205 | printk("and Disabled\n"); | ||
206 | |||
207 | |||
200 | #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH) | 208 | #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH) |
201 | /* we need to initialize the Flashrom device here since we might | 209 | /* we need to initialize the Flashrom device here since we might |
202 | * do things with flash early on in the boot | 210 | * do things with flash early on in the boot |
@@ -354,15 +362,15 @@ void __init setup_arch(char **cmdline_p) | |||
354 | , _stext, _etext, | 362 | , _stext, _etext, |
355 | __start_rodata, __end_rodata, | 363 | __start_rodata, __end_rodata, |
356 | _sdata, _edata, | 364 | _sdata, _edata, |
357 | (void*)&init_thread_union, (void*)((int)(&init_thread_union) + 0x2000), | 365 | (void *)&init_thread_union, (void *)((int)(&init_thread_union) + 0x2000), |
358 | __init_begin, __init_end, | 366 | __init_begin, __init_end, |
359 | __bss_start, __bss_stop, | 367 | __bss_start, __bss_stop, |
360 | (void*)_ramstart, (void*)memory_end | 368 | (void *)_ramstart, (void *)memory_end |
361 | #ifdef CONFIG_MTD_UCLINUX | 369 | #ifdef CONFIG_MTD_UCLINUX |
362 | , (void*)memory_mtd_start, (void*)(memory_mtd_start + mtd_size) | 370 | , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size) |
363 | #endif | 371 | #endif |
364 | #if DMA_UNCACHED_REGION > 0 | 372 | #if DMA_UNCACHED_REGION > 0 |
365 | , (void*)(_ramend - DMA_UNCACHED_REGION), (void*)(_ramend) | 373 | , (void *)(_ramend - DMA_UNCACHED_REGION), (void *)(_ramend) |
366 | #endif | 374 | #endif |
367 | ); | 375 | ); |
368 | 376 | ||
@@ -388,11 +396,11 @@ void __init setup_arch(char **cmdline_p) | |||
388 | /* check the size of the l1 area */ | 396 | /* check the size of the l1 area */ |
389 | l1_length = _etext_l1 - _stext_l1; | 397 | l1_length = _etext_l1 - _stext_l1; |
390 | if (l1_length > L1_CODE_LENGTH) | 398 | if (l1_length > L1_CODE_LENGTH) |
391 | panic("L1 memory overflow\n"); | 399 | panic("L1 code memory overflow\n"); |
392 | 400 | ||
393 | l1_length = _ebss_l1 - _sdata_l1; | 401 | l1_length = _ebss_l1 - _sdata_l1; |
394 | if (l1_length > L1_DATA_A_LENGTH) | 402 | if (l1_length > L1_DATA_A_LENGTH) |
395 | panic("L1 memory overflow\n"); | 403 | panic("L1 data memory overflow\n"); |
396 | 404 | ||
397 | #ifdef BF561_FAMILY | 405 | #ifdef BF561_FAMILY |
398 | _bfin_swrst = bfin_read_SICA_SWRST(); | 406 | _bfin_swrst = bfin_read_SICA_SWRST(); |
@@ -400,10 +408,28 @@ void __init setup_arch(char **cmdline_p) | |||
400 | _bfin_swrst = bfin_read_SWRST(); | 408 | _bfin_swrst = bfin_read_SWRST(); |
401 | #endif | 409 | #endif |
402 | 410 | ||
403 | bf53x_cache_init(); | 411 | /* Copy atomic sequences to their fixed location, and sanity check that |
412 | these locations are the ones that we advertise to userspace. */ | ||
413 | memcpy((void *)FIXED_CODE_START, &fixed_code_start, | ||
414 | FIXED_CODE_END - FIXED_CODE_START); | ||
415 | BUG_ON((char *)&sigreturn_stub - (char *)&fixed_code_start | ||
416 | != SIGRETURN_STUB - FIXED_CODE_START); | ||
417 | BUG_ON((char *)&atomic_xchg32 - (char *)&fixed_code_start | ||
418 | != ATOMIC_XCHG32 - FIXED_CODE_START); | ||
419 | BUG_ON((char *)&atomic_cas32 - (char *)&fixed_code_start | ||
420 | != ATOMIC_CAS32 - FIXED_CODE_START); | ||
421 | BUG_ON((char *)&atomic_add32 - (char *)&fixed_code_start | ||
422 | != ATOMIC_ADD32 - FIXED_CODE_START); | ||
423 | BUG_ON((char *)&atomic_sub32 - (char *)&fixed_code_start | ||
424 | != ATOMIC_SUB32 - FIXED_CODE_START); | ||
425 | BUG_ON((char *)&atomic_ior32 - (char *)&fixed_code_start | ||
426 | != ATOMIC_IOR32 - FIXED_CODE_START); | ||
427 | BUG_ON((char *)&atomic_and32 - (char *)&fixed_code_start | ||
428 | != ATOMIC_AND32 - FIXED_CODE_START); | ||
429 | BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start | ||
430 | != ATOMIC_XOR32 - FIXED_CODE_START); | ||
404 | 431 | ||
405 | printk(KERN_INFO "Hardware Trace Enabled\n"); | 432 | bf53x_cache_init(); |
406 | bfin_write_TBUFCTL(0x03); | ||
407 | } | 433 | } |
408 | 434 | ||
409 | static int __init topology_init(void) | 435 | static int __init topology_init(void) |
@@ -421,286 +447,6 @@ static int __init topology_init(void) | |||
421 | 447 | ||
422 | subsys_initcall(topology_init); | 448 | subsys_initcall(topology_init); |
423 | 449 | ||
424 | #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE) | ||
425 | static u16 __init lock_kernel_check(u32 start, u32 end) | ||
426 | { | ||
427 | if ((start <= (u32) _stext && end >= (u32) _end) | ||
428 | || (start >= (u32) _stext && end <= (u32) _end)) | ||
429 | return IN_KERNEL; | ||
430 | return 0; | ||
431 | } | ||
432 | |||
433 | static unsigned short __init | ||
434 | fill_cplbtab(struct cplb_tab *table, | ||
435 | unsigned long start, unsigned long end, | ||
436 | unsigned long block_size, unsigned long cplb_data) | ||
437 | { | ||
438 | int i; | ||
439 | |||
440 | switch (block_size) { | ||
441 | case SIZE_4M: | ||
442 | i = 3; | ||
443 | break; | ||
444 | case SIZE_1M: | ||
445 | i = 2; | ||
446 | break; | ||
447 | case SIZE_4K: | ||
448 | i = 1; | ||
449 | break; | ||
450 | case SIZE_1K: | ||
451 | default: | ||
452 | i = 0; | ||
453 | break; | ||
454 | } | ||
455 | |||
456 | cplb_data = (cplb_data & ~(3 << 16)) | (i << 16); | ||
457 | |||
458 | while ((start < end) && (table->pos < table->size)) { | ||
459 | |||
460 | table->tab[table->pos++] = start; | ||
461 | |||
462 | if (lock_kernel_check(start, start + block_size) == IN_KERNEL) | ||
463 | table->tab[table->pos++] = | ||
464 | cplb_data | CPLB_LOCK | CPLB_DIRTY; | ||
465 | else | ||
466 | table->tab[table->pos++] = cplb_data; | ||
467 | |||
468 | start += block_size; | ||
469 | } | ||
470 | return 0; | ||
471 | } | ||
472 | |||
473 | static unsigned short __init | ||
474 | close_cplbtab(struct cplb_tab *table) | ||
475 | { | ||
476 | |||
477 | while (table->pos < table->size) { | ||
478 | |||
479 | table->tab[table->pos++] = 0; | ||
480 | table->tab[table->pos++] = 0; /* !CPLB_VALID */ | ||
481 | } | ||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | /* helper function */ | ||
486 | static void __fill_code_cplbtab(struct cplb_tab *t, int i, | ||
487 | u32 a_start, u32 a_end) | ||
488 | { | ||
489 | if (cplb_data[i].psize) { | ||
490 | fill_cplbtab(t, | ||
491 | cplb_data[i].start, | ||
492 | cplb_data[i].end, | ||
493 | cplb_data[i].psize, | ||
494 | cplb_data[i].i_conf); | ||
495 | } else { | ||
496 | #if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263)) | ||
497 | if (i == SDRAM_KERN) { | ||
498 | fill_cplbtab(t, | ||
499 | cplb_data[i].start, | ||
500 | cplb_data[i].end, | ||
501 | SIZE_4M, | ||
502 | cplb_data[i].i_conf); | ||
503 | } else { | ||
504 | #endif | ||
505 | fill_cplbtab(t, | ||
506 | cplb_data[i].start, | ||
507 | a_start, | ||
508 | SIZE_1M, | ||
509 | cplb_data[i].i_conf); | ||
510 | fill_cplbtab(t, | ||
511 | a_start, | ||
512 | a_end, | ||
513 | SIZE_4M, | ||
514 | cplb_data[i].i_conf); | ||
515 | fill_cplbtab(t, a_end, | ||
516 | cplb_data[i].end, | ||
517 | SIZE_1M, | ||
518 | cplb_data[i].i_conf); | ||
519 | } | ||
520 | } | ||
521 | } | ||
522 | |||
523 | static void __fill_data_cplbtab(struct cplb_tab *t, int i, | ||
524 | u32 a_start, u32 a_end) | ||
525 | { | ||
526 | if (cplb_data[i].psize) { | ||
527 | fill_cplbtab(t, | ||
528 | cplb_data[i].start, | ||
529 | cplb_data[i].end, | ||
530 | cplb_data[i].psize, | ||
531 | cplb_data[i].d_conf); | ||
532 | } else { | ||
533 | fill_cplbtab(t, | ||
534 | cplb_data[i].start, | ||
535 | a_start, SIZE_1M, | ||
536 | cplb_data[i].d_conf); | ||
537 | fill_cplbtab(t, a_start, | ||
538 | a_end, SIZE_4M, | ||
539 | cplb_data[i].d_conf); | ||
540 | fill_cplbtab(t, a_end, | ||
541 | cplb_data[i].end, | ||
542 | SIZE_1M, | ||
543 | cplb_data[i].d_conf); | ||
544 | } | ||
545 | } | ||
546 | static void __init generate_cpl_tables(void) | ||
547 | { | ||
548 | |||
549 | u16 i, j, process; | ||
550 | u32 a_start, a_end, as, ae, as_1m; | ||
551 | |||
552 | struct cplb_tab *t_i = NULL; | ||
553 | struct cplb_tab *t_d = NULL; | ||
554 | struct s_cplb cplb; | ||
555 | |||
556 | cplb.init_i.size = MAX_CPLBS; | ||
557 | cplb.init_d.size = MAX_CPLBS; | ||
558 | cplb.switch_i.size = MAX_SWITCH_I_CPLBS; | ||
559 | cplb.switch_d.size = MAX_SWITCH_D_CPLBS; | ||
560 | |||
561 | cplb.init_i.pos = 0; | ||
562 | cplb.init_d.pos = 0; | ||
563 | cplb.switch_i.pos = 0; | ||
564 | cplb.switch_d.pos = 0; | ||
565 | |||
566 | cplb.init_i.tab = icplb_table; | ||
567 | cplb.init_d.tab = dcplb_table; | ||
568 | cplb.switch_i.tab = ipdt_table; | ||
569 | cplb.switch_d.tab = dpdt_table; | ||
570 | |||
571 | cplb_data[SDRAM_KERN].end = memory_end; | ||
572 | |||
573 | #ifdef CONFIG_MTD_UCLINUX | ||
574 | cplb_data[SDRAM_RAM_MTD].start = memory_mtd_start; | ||
575 | cplb_data[SDRAM_RAM_MTD].end = memory_mtd_start + mtd_size; | ||
576 | cplb_data[SDRAM_RAM_MTD].valid = mtd_size > 0; | ||
577 | # if defined(CONFIG_ROMFS_FS) | ||
578 | cplb_data[SDRAM_RAM_MTD].attr |= I_CPLB; | ||
579 | |||
580 | /* | ||
581 | * The ROMFS_FS size is often not multiple of 1MB. | ||
582 | * This can cause multiple CPLB sets covering the same memory area. | ||
583 | * This will then cause multiple CPLB hit exceptions. | ||
584 | * Workaround: We ensure a contiguous memory area by extending the kernel | ||
585 | * memory section over the mtd section. | ||
586 | * For ROMFS_FS memory must be covered with ICPLBs anyways. | ||
587 | * So there is no difference between kernel and mtd memory setup. | ||
588 | */ | ||
589 | |||
590 | cplb_data[SDRAM_KERN].end = memory_mtd_start + mtd_size;; | ||
591 | cplb_data[SDRAM_RAM_MTD].valid = 0; | ||
592 | |||
593 | # endif | ||
594 | #else | ||
595 | cplb_data[SDRAM_RAM_MTD].valid = 0; | ||
596 | #endif | ||
597 | |||
598 | cplb_data[SDRAM_DMAZ].start = _ramend - DMA_UNCACHED_REGION; | ||
599 | cplb_data[SDRAM_DMAZ].end = _ramend; | ||
600 | |||
601 | cplb_data[RES_MEM].start = _ramend; | ||
602 | cplb_data[RES_MEM].end = physical_mem_end; | ||
603 | |||
604 | if (reserved_mem_dcache_on) | ||
605 | cplb_data[RES_MEM].d_conf = SDRAM_DGENERIC; | ||
606 | else | ||
607 | cplb_data[RES_MEM].d_conf = SDRAM_DNON_CHBL; | ||
608 | |||
609 | if (reserved_mem_icache_on) | ||
610 | cplb_data[RES_MEM].i_conf = SDRAM_IGENERIC; | ||
611 | else | ||
612 | cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL; | ||
613 | |||
614 | for (i = ZERO_P; i <= L2_MEM; i++) { | ||
615 | if (!cplb_data[i].valid) | ||
616 | continue; | ||
617 | |||
618 | as_1m = cplb_data[i].start % SIZE_1M; | ||
619 | |||
620 | /* | ||
621 | * We need to make sure all sections are properly 1M aligned | ||
622 | * However between Kernel Memory and the Kernel mtd section, | ||
623 | * depending on the rootfs size, there can be overlapping | ||
624 | * memory areas. | ||
625 | */ | ||
626 | |||
627 | if (as_1m && i != L1I_MEM && i != L1D_MEM) { | ||
628 | #ifdef CONFIG_MTD_UCLINUX | ||
629 | if (i == SDRAM_RAM_MTD) { | ||
630 | if ((cplb_data[SDRAM_KERN].end + 1) > | ||
631 | cplb_data[SDRAM_RAM_MTD].start) | ||
632 | cplb_data[SDRAM_RAM_MTD].start = | ||
633 | (cplb_data[i].start & | ||
634 | (-2*SIZE_1M)) + SIZE_1M; | ||
635 | else | ||
636 | cplb_data[SDRAM_RAM_MTD].start = | ||
637 | (cplb_data[i].start & | ||
638 | (-2*SIZE_1M)); | ||
639 | } else | ||
640 | #endif | ||
641 | printk(KERN_WARNING | ||
642 | "Unaligned Start of %s at 0x%X\n", | ||
643 | cplb_data[i].name, cplb_data[i].start); | ||
644 | } | ||
645 | |||
646 | as = cplb_data[i].start % SIZE_4M; | ||
647 | ae = cplb_data[i].end % SIZE_4M; | ||
648 | |||
649 | if (as) | ||
650 | a_start = cplb_data[i].start + (SIZE_4M - (as)); | ||
651 | else | ||
652 | a_start = cplb_data[i].start; | ||
653 | |||
654 | a_end = cplb_data[i].end - ae; | ||
655 | |||
656 | for (j = INITIAL_T; j <= SWITCH_T; j++) { | ||
657 | |||
658 | switch (j) { | ||
659 | case INITIAL_T: | ||
660 | if (cplb_data[i].attr & INITIAL_T) { | ||
661 | t_i = &cplb.init_i; | ||
662 | t_d = &cplb.init_d; | ||
663 | process = 1; | ||
664 | } else | ||
665 | process = 0; | ||
666 | break; | ||
667 | case SWITCH_T: | ||
668 | if (cplb_data[i].attr & SWITCH_T) { | ||
669 | t_i = &cplb.switch_i; | ||
670 | t_d = &cplb.switch_d; | ||
671 | process = 1; | ||
672 | } else | ||
673 | process = 0; | ||
674 | break; | ||
675 | default: | ||
676 | process = 0; | ||
677 | break; | ||
678 | } | ||
679 | |||
680 | if (!process) | ||
681 | continue; | ||
682 | if (cplb_data[i].attr & I_CPLB) | ||
683 | __fill_code_cplbtab(t_i, i, a_start, a_end); | ||
684 | |||
685 | if (cplb_data[i].attr & D_CPLB) | ||
686 | __fill_data_cplbtab(t_d, i, a_start, a_end); | ||
687 | } | ||
688 | } | ||
689 | |||
690 | /* close tables */ | ||
691 | |||
692 | close_cplbtab(&cplb.init_i); | ||
693 | close_cplbtab(&cplb.init_d); | ||
694 | |||
695 | cplb.init_i.tab[cplb.init_i.pos] = -1; | ||
696 | cplb.init_d.tab[cplb.init_d.pos] = -1; | ||
697 | cplb.switch_i.tab[cplb.switch_i.pos] = -1; | ||
698 | cplb.switch_d.tab[cplb.switch_d.pos] = -1; | ||
699 | |||
700 | } | ||
701 | |||
702 | #endif | ||
703 | |||
704 | static u_long get_vco(void) | 450 | static u_long get_vco(void) |
705 | { | 451 | { |
706 | u_long msel; | 452 | u_long msel; |
@@ -730,7 +476,6 @@ u_long get_cclk(void) | |||
730 | return get_vco() / ssel; | 476 | return get_vco() / ssel; |
731 | return get_vco() >> csel; | 477 | return get_vco() >> csel; |
732 | } | 478 | } |
733 | |||
734 | EXPORT_SYMBOL(get_cclk); | 479 | EXPORT_SYMBOL(get_cclk); |
735 | 480 | ||
736 | /* Get the System clock */ | 481 | /* Get the System clock */ |
@@ -749,7 +494,6 @@ u_long get_sclk(void) | |||
749 | 494 | ||
750 | return get_vco() / ssel; | 495 | return get_vco() / ssel; |
751 | } | 496 | } |
752 | |||
753 | EXPORT_SYMBOL(get_sclk); | 497 | EXPORT_SYMBOL(get_sclk); |
754 | 498 | ||
755 | /* | 499 | /* |
@@ -804,23 +548,23 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
804 | seq_printf(m, "D-CACHE:\tOFF\n"); | 548 | seq_printf(m, "D-CACHE:\tOFF\n"); |
805 | 549 | ||
806 | 550 | ||
807 | switch(bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) { | 551 | switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) { |
808 | case ACACHE_BSRAM: | 552 | case ACACHE_BSRAM: |
809 | seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tSRAM\n"); | 553 | seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tSRAM\n"); |
810 | dcache_size = 16; | 554 | dcache_size = 16; |
811 | dsup_banks = 1; | 555 | dsup_banks = 1; |
812 | break; | 556 | break; |
813 | case ACACHE_BCACHE: | 557 | case ACACHE_BCACHE: |
814 | seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tCACHE\n"); | 558 | seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tCACHE\n"); |
815 | dcache_size = 32; | 559 | dcache_size = 32; |
816 | dsup_banks = 2; | 560 | dsup_banks = 2; |
817 | break; | 561 | break; |
818 | case ASRAM_BSRAM: | 562 | case ASRAM_BSRAM: |
819 | seq_printf(m, "DBANK-A:\tSRAM\n" "DBANK-B:\tSRAM\n"); | 563 | seq_printf(m, "DBANK-A:\tSRAM\n" "DBANK-B:\tSRAM\n"); |
820 | dcache_size = 0; | 564 | dcache_size = 0; |
821 | dsup_banks = 0; | 565 | dsup_banks = 0; |
822 | break; | 566 | break; |
823 | default: | 567 | default: |
824 | break; | 568 | break; |
825 | } | 569 | } |
826 | 570 | ||
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index 316e65c3439d..5564c9588aa8 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -34,8 +34,8 @@ | |||
34 | #include <linux/personality.h> | 34 | #include <linux/personality.h> |
35 | #include <linux/binfmts.h> | 35 | #include <linux/binfmts.h> |
36 | #include <linux/freezer.h> | 36 | #include <linux/freezer.h> |
37 | #include <linux/uaccess.h> | ||
37 | 38 | ||
38 | #include <asm/uaccess.h> | ||
39 | #include <asm/cacheflush.h> | 39 | #include <asm/cacheflush.h> |
40 | #include <asm/ucontext.h> | 40 | #include <asm/ucontext.h> |
41 | 41 | ||
@@ -124,7 +124,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused) | |||
124 | 124 | ||
125 | return r0; | 125 | return r0; |
126 | 126 | ||
127 | badframe: | 127 | badframe: |
128 | force_sig(SIGSEGV, current); | 128 | force_sig(SIGSEGV, current); |
129 | return 0; | 129 | return 0; |
130 | } | 130 | } |
@@ -239,7 +239,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | |||
239 | 239 | ||
240 | return 0; | 240 | return 0; |
241 | 241 | ||
242 | give_sigsegv: | 242 | give_sigsegv: |
243 | if (sig == SIGSEGV) | 243 | if (sig == SIGSEGV) |
244 | ka->sa.sa_handler = SIG_DFL; | 244 | ka->sa.sa_handler = SIG_DFL; |
245 | force_sig(SIGSEGV, current); | 245 | force_sig(SIGSEGV, current); |
@@ -263,7 +263,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) | |||
263 | } | 263 | } |
264 | /* fallthrough */ | 264 | /* fallthrough */ |
265 | case -ERESTARTNOINTR: | 265 | case -ERESTARTNOINTR: |
266 | do_restart: | 266 | do_restart: |
267 | regs->p0 = regs->orig_p0; | 267 | regs->p0 = regs->orig_p0; |
268 | regs->r0 = regs->orig_r0; | 268 | regs->r0 = regs->orig_r0; |
269 | regs->pc -= 2; | 269 | regs->pc -= 2; |
@@ -341,7 +341,7 @@ asmlinkage void do_signal(struct pt_regs *regs) | |||
341 | return; | 341 | return; |
342 | } | 342 | } |
343 | 343 | ||
344 | no_signal: | 344 | no_signal: |
345 | /* Did we come from a system call? */ | 345 | /* Did we come from a system call? */ |
346 | if (regs->orig_p0 >= 0) | 346 | if (regs->orig_p0 >= 0) |
347 | /* Restart the system call - no handlers present */ | 347 | /* Restart the system call - no handlers present */ |
diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c index f436e6743f5a..f5e1ae3d1705 100644 --- a/arch/blackfin/kernel/sys_bfin.c +++ b/arch/blackfin/kernel/sys_bfin.c | |||
@@ -37,12 +37,12 @@ | |||
37 | #include <linux/syscalls.h> | 37 | #include <linux/syscalls.h> |
38 | #include <linux/mman.h> | 38 | #include <linux/mman.h> |
39 | #include <linux/file.h> | 39 | #include <linux/file.h> |
40 | #include <linux/uaccess.h> | ||
41 | #include <linux/ipc.h> | ||
42 | #include <linux/unistd.h> | ||
40 | 43 | ||
41 | #include <asm/cacheflush.h> | 44 | #include <asm/cacheflush.h> |
42 | #include <asm/uaccess.h> | ||
43 | #include <asm/ipc.h> | ||
44 | #include <asm/dma.h> | 45 | #include <asm/dma.h> |
45 | #include <asm/unistd.h> | ||
46 | 46 | ||
47 | /* | 47 | /* |
48 | * sys_pipe() is the normal C calling standard for creating | 48 | * sys_pipe() is the normal C calling standard for creating |
@@ -83,7 +83,7 @@ do_mmap2(unsigned long addr, unsigned long len, | |||
83 | 83 | ||
84 | if (file) | 84 | if (file) |
85 | fput(file); | 85 | fput(file); |
86 | out: | 86 | out: |
87 | return error; | 87 | return error; |
88 | } | 88 | } |
89 | 89 | ||
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c index f578176b6d92..beef057bd1dc 100644 --- a/arch/blackfin/kernel/time.c +++ b/arch/blackfin/kernel/time.c | |||
@@ -87,7 +87,7 @@ void __init init_leds(void) | |||
87 | static inline void do_leds(void) | 87 | static inline void do_leds(void) |
88 | { | 88 | { |
89 | static unsigned int count = 50; | 89 | static unsigned int count = 50; |
90 | static int flag = 0; | 90 | static int flag; |
91 | unsigned short tmp = 0; | 91 | unsigned short tmp = 0; |
92 | 92 | ||
93 | if (--count == 0) { | 93 | if (--count == 0) { |
@@ -200,7 +200,7 @@ irqreturn_t timer_interrupt(int irq, void *dummy)__attribute__((l1_text)); | |||
200 | irqreturn_t timer_interrupt(int irq, void *dummy) | 200 | irqreturn_t timer_interrupt(int irq, void *dummy) |
201 | { | 201 | { |
202 | /* last time the cmos clock got updated */ | 202 | /* last time the cmos clock got updated */ |
203 | static long last_rtc_update = 0; | 203 | static long last_rtc_update; |
204 | 204 | ||
205 | write_seqlock(&xtime_lock); | 205 | write_seqlock(&xtime_lock); |
206 | 206 | ||
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index 56058b0b6d4a..3909f5b35536 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
@@ -27,15 +27,15 @@ | |||
27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <asm/uaccess.h> | 30 | #include <linux/uaccess.h> |
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/kallsyms.h> | ||
31 | #include <asm/traps.h> | 34 | #include <asm/traps.h> |
32 | #include <asm/cacheflush.h> | 35 | #include <asm/cacheflush.h> |
33 | #include <asm/blackfin.h> | 36 | #include <asm/blackfin.h> |
34 | #include <asm/uaccess.h> | ||
35 | #include <asm/irq_handler.h> | 37 | #include <asm/irq_handler.h> |
36 | #include <linux/interrupt.h> | 38 | #include <asm/trace.h> |
37 | #include <linux/module.h> | ||
38 | #include <linux/kallsyms.h> | ||
39 | 39 | ||
40 | #ifdef CONFIG_KGDB | 40 | #ifdef CONFIG_KGDB |
41 | # include <linux/debugger.h> | 41 | # include <linux/debugger.h> |
@@ -76,7 +76,7 @@ static int printk_address(unsigned long address) | |||
76 | if (!modname) | 76 | if (!modname) |
77 | modname = delim = ""; | 77 | modname = delim = ""; |
78 | return printk("<0x%p> { %s%s%s%s + 0x%lx }", | 78 | return printk("<0x%p> { %s%s%s%s + 0x%lx }", |
79 | (void*)address, delim, modname, delim, symname, | 79 | (void *)address, delim, modname, delim, symname, |
80 | (unsigned long)offset); | 80 | (unsigned long)offset); |
81 | 81 | ||
82 | } | 82 | } |
@@ -119,7 +119,7 @@ static int printk_address(unsigned long address) | |||
119 | 119 | ||
120 | write_unlock_irq(&tasklist_lock); | 120 | write_unlock_irq(&tasklist_lock); |
121 | return printk("<0x%p> [ %s + 0x%lx ]", | 121 | return printk("<0x%p> [ %s + 0x%lx ]", |
122 | (void*)address, name, offset); | 122 | (void *)address, name, offset); |
123 | } | 123 | } |
124 | 124 | ||
125 | vml = vml->next; | 125 | vml = vml->next; |
@@ -128,19 +128,9 @@ static int printk_address(unsigned long address) | |||
128 | write_unlock_irq(&tasklist_lock); | 128 | write_unlock_irq(&tasklist_lock); |
129 | 129 | ||
130 | /* we were unable to find this address anywhere */ | 130 | /* we were unable to find this address anywhere */ |
131 | return printk("[<0x%p>]", (void*)address); | 131 | return printk("[<0x%p>]", (void *)address); |
132 | } | 132 | } |
133 | 133 | ||
134 | #define trace_buffer_save(x) \ | ||
135 | do { \ | ||
136 | (x) = bfin_read_TBUFCTL(); \ | ||
137 | bfin_write_TBUFCTL((x) & ~TBUFEN); \ | ||
138 | } while (0) | ||
139 | #define trace_buffer_restore(x) \ | ||
140 | do { \ | ||
141 | bfin_write_TBUFCTL((x)); \ | ||
142 | } while (0) | ||
143 | |||
144 | asmlinkage void trap_c(struct pt_regs *fp) | 134 | asmlinkage void trap_c(struct pt_regs *fp) |
145 | { | 135 | { |
146 | int j, sig = 0; | 136 | int j, sig = 0; |
@@ -203,15 +193,14 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
203 | #else | 193 | #else |
204 | /* 0x02 - User Defined, Caught by default */ | 194 | /* 0x02 - User Defined, Caught by default */ |
205 | #endif | 195 | #endif |
206 | /* 0x03 - Atomic test and set */ | 196 | /* 0x03 - User Defined, userspace stack overflow */ |
207 | case VEC_EXCPT03: | 197 | case VEC_EXCPT03: |
208 | info.si_code = SEGV_STACKFLOW; | 198 | info.si_code = SEGV_STACKFLOW; |
209 | sig = SIGSEGV; | 199 | sig = SIGSEGV; |
210 | printk(KERN_EMERG EXC_0x03); | 200 | printk(KERN_EMERG EXC_0x03); |
211 | CHK_DEBUGGER_TRAP(); | 201 | CHK_DEBUGGER_TRAP(); |
212 | break; | 202 | break; |
213 | /* 0x04 - spinlock - handled by _ex_spinlock, | 203 | /* 0x04 - User Defined, Caught by default */ |
214 | getting here is an error */ | ||
215 | /* 0x05 - User Defined, Caught by default */ | 204 | /* 0x05 - User Defined, Caught by default */ |
216 | /* 0x06 - User Defined, Caught by default */ | 205 | /* 0x06 - User Defined, Caught by default */ |
217 | /* 0x07 - User Defined, Caught by default */ | 206 | /* 0x07 - User Defined, Caught by default */ |
@@ -547,29 +536,28 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr) | |||
547 | printk(KERN_EMERG "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" | 536 | printk(KERN_EMERG "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" |
548 | KERN_EMERG "BSS = 0x%p-0x%p USER-STACK = 0x%p\n" | 537 | KERN_EMERG "BSS = 0x%p-0x%p USER-STACK = 0x%p\n" |
549 | KERN_EMERG "\n", | 538 | KERN_EMERG "\n", |
550 | (void*)current->mm->start_code, | 539 | (void *)current->mm->start_code, |
551 | (void*)current->mm->end_code, | 540 | (void *)current->mm->end_code, |
552 | (void*)current->mm->start_data, | 541 | (void *)current->mm->start_data, |
553 | (void*)current->mm->end_data, | 542 | (void *)current->mm->end_data, |
554 | (void*)current->mm->end_data, | 543 | (void *)current->mm->end_data, |
555 | (void*)current->mm->brk, | 544 | (void *)current->mm->brk, |
556 | (void*)current->mm->start_stack); | 545 | (void *)current->mm->start_stack); |
557 | } | 546 | } |
558 | 547 | ||
559 | printk(KERN_EMERG "return address: [0x%p]; contents of:", retaddr); | 548 | printk(KERN_EMERG "return address: [0x%p]; contents of:", retaddr); |
560 | if (retaddr != 0 && retaddr <= (void*)physical_mem_end | 549 | if (retaddr != 0 && retaddr <= (void *)physical_mem_end |
561 | #if L1_CODE_LENGTH != 0 | 550 | #if L1_CODE_LENGTH != 0 |
562 | /* FIXME: Copy the code out of L1 Instruction SRAM through dma | 551 | /* FIXME: Copy the code out of L1 Instruction SRAM through dma |
563 | memcpy. */ | 552 | memcpy. */ |
564 | && !(retaddr >= (void*)L1_CODE_START | 553 | && !(retaddr >= (void *)L1_CODE_START |
565 | && retaddr < (void*)(L1_CODE_START + L1_CODE_LENGTH)) | 554 | && retaddr < (void *)(L1_CODE_START + L1_CODE_LENGTH)) |
566 | #endif | 555 | #endif |
567 | ) { | 556 | ) { |
568 | int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32; | 557 | int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32; |
569 | unsigned short x = 0; | 558 | unsigned short x = 0; |
570 | for (; i < ((unsigned int)retaddr & 0xFFFFFFF0 ) + 32 ; | 559 | for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) { |
571 | i += 2) { | 560 | if (!(i & 0xF)) |
572 | if ( !(i & 0xF) ) | ||
573 | printk(KERN_EMERG "\n" KERN_EMERG | 561 | printk(KERN_EMERG "\n" KERN_EMERG |
574 | "0x%08x: ", i); | 562 | "0x%08x: ", i); |
575 | 563 | ||
@@ -588,7 +576,7 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr) | |||
588 | " The rest of this error" | 576 | " The rest of this error" |
589 | " is meanless\n"); | 577 | " is meanless\n"); |
590 | #endif | 578 | #endif |
591 | if ( i == (unsigned int)retaddr ) | 579 | if (i == (unsigned int)retaddr) |
592 | printk("[%04x]", x); | 580 | printk("[%04x]", x); |
593 | else | 581 | else |
594 | printk(" %04x ", x); | 582 | printk(" %04x ", x); |
@@ -681,8 +669,8 @@ void panic_cplb_error(int cplb_panic, struct pt_regs *fp) | |||
681 | break; | 669 | break; |
682 | } | 670 | } |
683 | 671 | ||
684 | printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void*)bfin_read_DCPLB_FAULT_ADDR()); | 672 | printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR()); |
685 | printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void*)bfin_read_ICPLB_FAULT_ADDR()); | 673 | printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR()); |
686 | dump_bfin_regs(fp, (void *)fp->retx); | 674 | dump_bfin_regs(fp, (void *)fp->retx); |
687 | dump_stack(); | 675 | dump_stack(); |
688 | panic("Unrecoverable event\n"); | 676 | panic("Unrecoverable event\n"); |
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S index 1ef1e36b3957..d06f860f4790 100644 --- a/arch/blackfin/kernel/vmlinux.lds.S +++ b/arch/blackfin/kernel/vmlinux.lds.S | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include <asm-generic/vmlinux.lds.h> | 32 | #include <asm-generic/vmlinux.lds.h> |
33 | #include <asm/mem_map.h> | 33 | #include <asm/mem_map.h> |
34 | #include <asm/page.h> | ||
34 | 35 | ||
35 | OUTPUT_FORMAT("elf32-bfin") | 36 | OUTPUT_FORMAT("elf32-bfin") |
36 | ENTRY(__start) | 37 | ENTRY(__start) |
@@ -63,8 +64,8 @@ SECTIONS | |||
63 | 64 | ||
64 | .data : | 65 | .data : |
65 | { | 66 | { |
67 | . = ALIGN(PAGE_SIZE); | ||
66 | __sdata = .; | 68 | __sdata = .; |
67 | . = ALIGN(0x2000); | ||
68 | *(.data.init_task) | 69 | *(.data.init_task) |
69 | DATA_DATA | 70 | DATA_DATA |
70 | CONSTRUCTORS | 71 | CONSTRUCTORS |
@@ -72,14 +73,14 @@ SECTIONS | |||
72 | . = ALIGN(32); | 73 | . = ALIGN(32); |
73 | *(.data.cacheline_aligned) | 74 | *(.data.cacheline_aligned) |
74 | 75 | ||
75 | . = ALIGN(0x2000); | 76 | . = ALIGN(PAGE_SIZE); |
76 | __edata = .; | 77 | __edata = .; |
77 | } | 78 | } |
78 | 79 | ||
80 | . = ALIGN(PAGE_SIZE); | ||
79 | ___init_begin = .; | 81 | ___init_begin = .; |
80 | .init : | 82 | .init : |
81 | { | 83 | { |
82 | . = ALIGN(4096); | ||
83 | __sinittext = .; | 84 | __sinittext = .; |
84 | *(.init.text) | 85 | *(.init.text) |
85 | __einittext = .; | 86 | __einittext = .; |
@@ -152,9 +153,10 @@ SECTIONS | |||
152 | __ebss_b_l1 = .; | 153 | __ebss_b_l1 = .; |
153 | } | 154 | } |
154 | 155 | ||
155 | ___init_end = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1); | 156 | . = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1); |
157 | ___init_end = ALIGN(PAGE_SIZE); | ||
156 | 158 | ||
157 | .bss LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1) : | 159 | .bss ___init_end : |
158 | { | 160 | { |
159 | . = ALIGN(4); | 161 | . = ALIGN(4); |
160 | ___bss_start = .; | 162 | ___bss_start = .; |