diff options
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r-- | arch/blackfin/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/blackfin/kernel/bfin_dma_5xx.c | 10 | ||||
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 20 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-mpu/cplbinit.c | 9 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-mpu/cplbmgr.c | 54 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cplbinit.c | 9 | ||||
-rw-r--r-- | arch/blackfin/kernel/dma-mapping.c | 2 | ||||
-rw-r--r-- | arch/blackfin/kernel/entry.S | 8 | ||||
-rw-r--r-- | arch/blackfin/kernel/ftrace-entry.S | 23 | ||||
-rw-r--r-- | arch/blackfin/kernel/ftrace.c | 6 | ||||
-rw-r--r-- | arch/blackfin/kernel/init_task.c | 2 | ||||
-rw-r--r-- | arch/blackfin/kernel/kgdb.c | 10 | ||||
-rw-r--r-- | arch/blackfin/kernel/nmi.c | 299 | ||||
-rw-r--r-- | arch/blackfin/kernel/process.c | 7 | ||||
-rw-r--r-- | arch/blackfin/kernel/ptrace.c | 360 | ||||
-rw-r--r-- | arch/blackfin/kernel/setup.c | 34 | ||||
-rw-r--r-- | arch/blackfin/kernel/signal.c | 24 | ||||
-rw-r--r-- | arch/blackfin/kernel/time-ts.c | 205 | ||||
-rw-r--r-- | arch/blackfin/kernel/traps.c | 32 | ||||
-rw-r--r-- | arch/blackfin/kernel/vmlinux.lds.S | 70 |
20 files changed, 819 insertions, 366 deletions
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile index a8ddbc8ed5af..346a421f1562 100644 --- a/arch/blackfin/kernel/Makefile +++ b/arch/blackfin/kernel/Makefile | |||
@@ -25,6 +25,7 @@ obj-$(CONFIG_CPLB_INFO) += cplbinfo.o | |||
25 | obj-$(CONFIG_MODULES) += module.o | 25 | obj-$(CONFIG_MODULES) += module.o |
26 | obj-$(CONFIG_KGDB) += kgdb.o | 26 | obj-$(CONFIG_KGDB) += kgdb.o |
27 | obj-$(CONFIG_KGDB_TESTS) += kgdb_test.o | 27 | obj-$(CONFIG_KGDB_TESTS) += kgdb_test.o |
28 | obj-$(CONFIG_NMI_WATCHDOG) += nmi.o | ||
28 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 29 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
29 | obj-$(CONFIG_EARLY_PRINTK) += shadow_console.o | 30 | obj-$(CONFIG_EARLY_PRINTK) += shadow_console.o |
30 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 31 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 924c00286bab..26403d1c9e65 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c | |||
@@ -91,7 +91,7 @@ late_initcall(proc_dma_init); | |||
91 | */ | 91 | */ |
92 | int request_dma(unsigned int channel, const char *device_id) | 92 | int request_dma(unsigned int channel, const char *device_id) |
93 | { | 93 | { |
94 | pr_debug("request_dma() : BEGIN \n"); | 94 | pr_debug("request_dma() : BEGIN\n"); |
95 | 95 | ||
96 | if (device_id == NULL) | 96 | if (device_id == NULL) |
97 | printk(KERN_WARNING "request_dma(%u): no device_id given\n", channel); | 97 | printk(KERN_WARNING "request_dma(%u): no device_id given\n", channel); |
@@ -107,7 +107,7 @@ int request_dma(unsigned int channel, const char *device_id) | |||
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | if (atomic_cmpxchg(&dma_ch[channel].chan_status, 0, 1)) { | 109 | if (atomic_cmpxchg(&dma_ch[channel].chan_status, 0, 1)) { |
110 | pr_debug("DMA CHANNEL IN USE \n"); | 110 | pr_debug("DMA CHANNEL IN USE\n"); |
111 | return -EBUSY; | 111 | return -EBUSY; |
112 | } | 112 | } |
113 | 113 | ||
@@ -131,7 +131,7 @@ int request_dma(unsigned int channel, const char *device_id) | |||
131 | * you have to request DMA, before doing any operations on | 131 | * you have to request DMA, before doing any operations on |
132 | * descriptor/channel | 132 | * descriptor/channel |
133 | */ | 133 | */ |
134 | pr_debug("request_dma() : END \n"); | 134 | pr_debug("request_dma() : END\n"); |
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | EXPORT_SYMBOL(request_dma); | 137 | EXPORT_SYMBOL(request_dma); |
@@ -171,7 +171,7 @@ static void clear_dma_buffer(unsigned int channel) | |||
171 | 171 | ||
172 | void free_dma(unsigned int channel) | 172 | void free_dma(unsigned int channel) |
173 | { | 173 | { |
174 | pr_debug("freedma() : BEGIN \n"); | 174 | pr_debug("freedma() : BEGIN\n"); |
175 | BUG_ON(channel >= MAX_DMA_CHANNELS || | 175 | BUG_ON(channel >= MAX_DMA_CHANNELS || |
176 | !atomic_read(&dma_ch[channel].chan_status)); | 176 | !atomic_read(&dma_ch[channel].chan_status)); |
177 | 177 | ||
@@ -185,7 +185,7 @@ void free_dma(unsigned int channel) | |||
185 | /* Clear the DMA Variable in the Channel */ | 185 | /* Clear the DMA Variable in the Channel */ |
186 | atomic_set(&dma_ch[channel].chan_status, 0); | 186 | atomic_set(&dma_ch[channel].chan_status, 0); |
187 | 187 | ||
188 | pr_debug("freedma() : END \n"); | 188 | pr_debug("freedma() : END\n"); |
189 | } | 189 | } |
190 | EXPORT_SYMBOL(free_dma); | 190 | EXPORT_SYMBOL(free_dma); |
191 | 191 | ||
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index a174596cc009..e35e20f00d9b 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -1289,44 +1289,50 @@ __initcall(gpio_register_proc); | |||
1289 | #endif | 1289 | #endif |
1290 | 1290 | ||
1291 | #ifdef CONFIG_GPIOLIB | 1291 | #ifdef CONFIG_GPIOLIB |
1292 | int bfin_gpiolib_direction_input(struct gpio_chip *chip, unsigned gpio) | 1292 | static int bfin_gpiolib_direction_input(struct gpio_chip *chip, unsigned gpio) |
1293 | { | 1293 | { |
1294 | return bfin_gpio_direction_input(gpio); | 1294 | return bfin_gpio_direction_input(gpio); |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | int bfin_gpiolib_direction_output(struct gpio_chip *chip, unsigned gpio, int level) | 1297 | static int bfin_gpiolib_direction_output(struct gpio_chip *chip, unsigned gpio, int level) |
1298 | { | 1298 | { |
1299 | return bfin_gpio_direction_output(gpio, level); | 1299 | return bfin_gpio_direction_output(gpio, level); |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | int bfin_gpiolib_get_value(struct gpio_chip *chip, unsigned gpio) | 1302 | static int bfin_gpiolib_get_value(struct gpio_chip *chip, unsigned gpio) |
1303 | { | 1303 | { |
1304 | return bfin_gpio_get_value(gpio); | 1304 | return bfin_gpio_get_value(gpio); |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value) | 1307 | static void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value) |
1308 | { | 1308 | { |
1309 | return bfin_gpio_set_value(gpio, value); | 1309 | return bfin_gpio_set_value(gpio, value); |
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio) | 1312 | static int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio) |
1313 | { | 1313 | { |
1314 | return bfin_gpio_request(gpio, chip->label); | 1314 | return bfin_gpio_request(gpio, chip->label); |
1315 | } | 1315 | } |
1316 | 1316 | ||
1317 | void bfin_gpiolib_gpio_free(struct gpio_chip *chip, unsigned gpio) | 1317 | static void bfin_gpiolib_gpio_free(struct gpio_chip *chip, unsigned gpio) |
1318 | { | 1318 | { |
1319 | return bfin_gpio_free(gpio); | 1319 | return bfin_gpio_free(gpio); |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | static int bfin_gpiolib_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) | ||
1323 | { | ||
1324 | return gpio + GPIO_IRQ_BASE; | ||
1325 | } | ||
1326 | |||
1322 | static struct gpio_chip bfin_chip = { | 1327 | static struct gpio_chip bfin_chip = { |
1323 | .label = "Blackfin-GPIOlib", | 1328 | .label = "BFIN-GPIO", |
1324 | .direction_input = bfin_gpiolib_direction_input, | 1329 | .direction_input = bfin_gpiolib_direction_input, |
1325 | .get = bfin_gpiolib_get_value, | 1330 | .get = bfin_gpiolib_get_value, |
1326 | .direction_output = bfin_gpiolib_direction_output, | 1331 | .direction_output = bfin_gpiolib_direction_output, |
1327 | .set = bfin_gpiolib_set_value, | 1332 | .set = bfin_gpiolib_set_value, |
1328 | .request = bfin_gpiolib_gpio_request, | 1333 | .request = bfin_gpiolib_gpio_request, |
1329 | .free = bfin_gpiolib_gpio_free, | 1334 | .free = bfin_gpiolib_gpio_free, |
1335 | .to_irq = bfin_gpiolib_gpio_to_irq, | ||
1330 | .base = 0, | 1336 | .base = 0, |
1331 | .ngpio = MAX_BLACKFIN_GPIOS, | 1337 | .ngpio = MAX_BLACKFIN_GPIOS, |
1332 | }; | 1338 | }; |
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinit.c b/arch/blackfin/kernel/cplb-mpu/cplbinit.c index 8d42b9e50dfa..30fd6417f069 100644 --- a/arch/blackfin/kernel/cplb-mpu/cplbinit.c +++ b/arch/blackfin/kernel/cplb-mpu/cplbinit.c | |||
@@ -64,6 +64,15 @@ void __init generate_cplb_tables_cpu(unsigned int cpu) | |||
64 | icplb_tbl[cpu][i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0); | 64 | icplb_tbl[cpu][i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0); |
65 | } | 65 | } |
66 | 66 | ||
67 | #ifdef CONFIG_ROMKERNEL | ||
68 | /* Cover kernel XIP flash area */ | ||
69 | addr = CONFIG_ROM_BASE & ~(4 * 1024 * 1024 - 1); | ||
70 | dcplb_tbl[cpu][i_d].addr = addr; | ||
71 | dcplb_tbl[cpu][i_d++].data = d_data | CPLB_USER_RD; | ||
72 | icplb_tbl[cpu][i_i].addr = addr; | ||
73 | icplb_tbl[cpu][i_i++].data = i_data | CPLB_USER_RD; | ||
74 | #endif | ||
75 | |||
67 | /* Cover L1 memory. One 4M area for code and data each is enough. */ | 76 | /* Cover L1 memory. One 4M area for code and data each is enough. */ |
68 | #if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0 | 77 | #if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0 |
69 | dcplb_tbl[cpu][i_d].addr = get_l1_data_a_start_cpu(cpu); | 78 | dcplb_tbl[cpu][i_d].addr = get_l1_data_a_start_cpu(cpu); |
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c index 930c01c06813..87b25b1b30ed 100644 --- a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c +++ b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c | |||
@@ -31,6 +31,12 @@ int nr_dcplb_miss[NR_CPUS], nr_icplb_miss[NR_CPUS]; | |||
31 | int nr_icplb_supv_miss[NR_CPUS], nr_dcplb_prot[NR_CPUS]; | 31 | int nr_icplb_supv_miss[NR_CPUS], nr_dcplb_prot[NR_CPUS]; |
32 | int nr_cplb_flush[NR_CPUS]; | 32 | int nr_cplb_flush[NR_CPUS]; |
33 | 33 | ||
34 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 | ||
35 | #define MGR_ATTR __attribute__((l1_text)) | ||
36 | #else | ||
37 | #define MGR_ATTR | ||
38 | #endif | ||
39 | |||
34 | /* | 40 | /* |
35 | * Given the contents of the status register, return the index of the | 41 | * Given the contents of the status register, return the index of the |
36 | * CPLB that caused the fault. | 42 | * CPLB that caused the fault. |
@@ -59,7 +65,7 @@ static int icplb_rr_index[NR_CPUS], dcplb_rr_index[NR_CPUS]; | |||
59 | /* | 65 | /* |
60 | * Find an ICPLB entry to be evicted and return its index. | 66 | * Find an ICPLB entry to be evicted and return its index. |
61 | */ | 67 | */ |
62 | static int evict_one_icplb(unsigned int cpu) | 68 | MGR_ATTR static int evict_one_icplb(unsigned int cpu) |
63 | { | 69 | { |
64 | int i; | 70 | int i; |
65 | for (i = first_switched_icplb; i < MAX_CPLBS; i++) | 71 | for (i = first_switched_icplb; i < MAX_CPLBS; i++) |
@@ -74,7 +80,7 @@ static int evict_one_icplb(unsigned int cpu) | |||
74 | return i; | 80 | return i; |
75 | } | 81 | } |
76 | 82 | ||
77 | static int evict_one_dcplb(unsigned int cpu) | 83 | MGR_ATTR static int evict_one_dcplb(unsigned int cpu) |
78 | { | 84 | { |
79 | int i; | 85 | int i; |
80 | for (i = first_switched_dcplb; i < MAX_CPLBS; i++) | 86 | for (i = first_switched_dcplb; i < MAX_CPLBS; i++) |
@@ -89,7 +95,7 @@ static int evict_one_dcplb(unsigned int cpu) | |||
89 | return i; | 95 | return i; |
90 | } | 96 | } |
91 | 97 | ||
92 | static noinline int dcplb_miss(unsigned int cpu) | 98 | MGR_ATTR static noinline int dcplb_miss(unsigned int cpu) |
93 | { | 99 | { |
94 | unsigned long addr = bfin_read_DCPLB_FAULT_ADDR(); | 100 | unsigned long addr = bfin_read_DCPLB_FAULT_ADDR(); |
95 | int status = bfin_read_DCPLB_STATUS(); | 101 | int status = bfin_read_DCPLB_STATUS(); |
@@ -114,10 +120,15 @@ static noinline int dcplb_miss(unsigned int cpu) | |||
114 | d_data = L2_DMEMORY; | 120 | d_data = L2_DMEMORY; |
115 | } else if (addr >= physical_mem_end) { | 121 | } else if (addr >= physical_mem_end) { |
116 | if (addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE) { | 122 | if (addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE) { |
117 | addr &= ~(4 * 1024 * 1024 - 1); | 123 | mask = current_rwx_mask[cpu]; |
118 | d_data &= ~PAGE_SIZE_4KB; | 124 | if (mask) { |
119 | d_data |= PAGE_SIZE_4MB; | 125 | int page = (addr - (ASYNC_BANK0_BASE - _ramend)) >> PAGE_SHIFT; |
120 | d_data |= CPLB_USER_RD | CPLB_USER_WR; | 126 | int idx = page >> 5; |
127 | int bit = 1 << (page & 31); | ||
128 | |||
129 | if (mask[idx] & bit) | ||
130 | d_data |= CPLB_USER_RD; | ||
131 | } | ||
121 | } else if (addr >= BOOT_ROM_START && addr < BOOT_ROM_START + BOOT_ROM_LENGTH | 132 | } else if (addr >= BOOT_ROM_START && addr < BOOT_ROM_START + BOOT_ROM_LENGTH |
122 | && (status & (FAULT_RW | FAULT_USERSUPV)) == FAULT_USERSUPV) { | 133 | && (status & (FAULT_RW | FAULT_USERSUPV)) == FAULT_USERSUPV) { |
123 | addr &= ~(1 * 1024 * 1024 - 1); | 134 | addr &= ~(1 * 1024 * 1024 - 1); |
@@ -126,7 +137,9 @@ static noinline int dcplb_miss(unsigned int cpu) | |||
126 | } else | 137 | } else |
127 | return CPLB_PROT_VIOL; | 138 | return CPLB_PROT_VIOL; |
128 | } else if (addr >= _ramend) { | 139 | } else if (addr >= _ramend) { |
129 | d_data |= CPLB_USER_RD | CPLB_USER_WR; | 140 | d_data |= CPLB_USER_RD | CPLB_USER_WR; |
141 | if (reserved_mem_dcache_on) | ||
142 | d_data |= CPLB_L1_CHBL; | ||
130 | } else { | 143 | } else { |
131 | mask = current_rwx_mask[cpu]; | 144 | mask = current_rwx_mask[cpu]; |
132 | if (mask) { | 145 | if (mask) { |
@@ -156,7 +169,7 @@ static noinline int dcplb_miss(unsigned int cpu) | |||
156 | return 0; | 169 | return 0; |
157 | } | 170 | } |
158 | 171 | ||
159 | static noinline int icplb_miss(unsigned int cpu) | 172 | MGR_ATTR static noinline int icplb_miss(unsigned int cpu) |
160 | { | 173 | { |
161 | unsigned long addr = bfin_read_ICPLB_FAULT_ADDR(); | 174 | unsigned long addr = bfin_read_ICPLB_FAULT_ADDR(); |
162 | int status = bfin_read_ICPLB_STATUS(); | 175 | int status = bfin_read_ICPLB_STATUS(); |
@@ -204,10 +217,19 @@ static noinline int icplb_miss(unsigned int cpu) | |||
204 | i_data = L2_IMEMORY; | 217 | i_data = L2_IMEMORY; |
205 | } else if (addr >= physical_mem_end) { | 218 | } else if (addr >= physical_mem_end) { |
206 | if (addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE) { | 219 | if (addr >= ASYNC_BANK0_BASE && addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE) { |
207 | addr &= ~(4 * 1024 * 1024 - 1); | 220 | if (!(status & FAULT_USERSUPV)) { |
208 | i_data &= ~PAGE_SIZE_4KB; | 221 | unsigned long *mask = current_rwx_mask[cpu]; |
209 | i_data |= PAGE_SIZE_4MB; | 222 | |
210 | i_data |= CPLB_USER_RD; | 223 | if (mask) { |
224 | int page = (addr - (ASYNC_BANK0_BASE - _ramend)) >> PAGE_SHIFT; | ||
225 | int idx = page >> 5; | ||
226 | int bit = 1 << (page & 31); | ||
227 | |||
228 | mask += 2 * page_mask_nelts; | ||
229 | if (mask[idx] & bit) | ||
230 | i_data |= CPLB_USER_RD; | ||
231 | } | ||
232 | } | ||
211 | } else if (addr >= BOOT_ROM_START && addr < BOOT_ROM_START + BOOT_ROM_LENGTH | 233 | } else if (addr >= BOOT_ROM_START && addr < BOOT_ROM_START + BOOT_ROM_LENGTH |
212 | && (status & FAULT_USERSUPV)) { | 234 | && (status & FAULT_USERSUPV)) { |
213 | addr &= ~(1 * 1024 * 1024 - 1); | 235 | addr &= ~(1 * 1024 * 1024 - 1); |
@@ -217,6 +239,8 @@ static noinline int icplb_miss(unsigned int cpu) | |||
217 | return CPLB_PROT_VIOL; | 239 | return CPLB_PROT_VIOL; |
218 | } else if (addr >= _ramend) { | 240 | } else if (addr >= _ramend) { |
219 | i_data |= CPLB_USER_RD; | 241 | i_data |= CPLB_USER_RD; |
242 | if (reserved_mem_icache_on) | ||
243 | i_data |= CPLB_L1_CHBL; | ||
220 | } else { | 244 | } else { |
221 | /* | 245 | /* |
222 | * Two cases to distinguish - a supervisor access must | 246 | * Two cases to distinguish - a supervisor access must |
@@ -251,7 +275,7 @@ static noinline int icplb_miss(unsigned int cpu) | |||
251 | return 0; | 275 | return 0; |
252 | } | 276 | } |
253 | 277 | ||
254 | static noinline int dcplb_protection_fault(unsigned int cpu) | 278 | MGR_ATTR static noinline int dcplb_protection_fault(unsigned int cpu) |
255 | { | 279 | { |
256 | int status = bfin_read_DCPLB_STATUS(); | 280 | int status = bfin_read_DCPLB_STATUS(); |
257 | 281 | ||
@@ -271,7 +295,7 @@ static noinline int dcplb_protection_fault(unsigned int cpu) | |||
271 | return CPLB_PROT_VIOL; | 295 | return CPLB_PROT_VIOL; |
272 | } | 296 | } |
273 | 297 | ||
274 | int cplb_hdr(int seqstat, struct pt_regs *regs) | 298 | MGR_ATTR int cplb_hdr(int seqstat, struct pt_regs *regs) |
275 | { | 299 | { |
276 | int cause = seqstat & 0x3f; | 300 | int cause = seqstat & 0x3f; |
277 | unsigned int cpu = raw_smp_processor_id(); | 301 | unsigned int cpu = raw_smp_processor_id(); |
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c index 282a7919821b..bfe75af4e8bd 100644 --- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c +++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c | |||
@@ -56,6 +56,15 @@ void __init generate_cplb_tables_cpu(unsigned int cpu) | |||
56 | i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB; | 56 | i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB; |
57 | } | 57 | } |
58 | 58 | ||
59 | #ifdef CONFIG_ROMKERNEL | ||
60 | /* Cover kernel XIP flash area */ | ||
61 | addr = CONFIG_ROM_BASE & ~(4 * 1024 * 1024 - 1); | ||
62 | d_tbl[i_d].addr = addr; | ||
63 | d_tbl[i_d++].data = SDRAM_DGENERIC | PAGE_SIZE_4MB; | ||
64 | i_tbl[i_i].addr = addr; | ||
65 | i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB; | ||
66 | #endif | ||
67 | |||
59 | /* Cover L1 memory. One 4M area for code and data each is enough. */ | 68 | /* Cover L1 memory. One 4M area for code and data each is enough. */ |
60 | if (cpu == 0) { | 69 | if (cpu == 0) { |
61 | if (L1_DATA_A_LENGTH || L1_DATA_B_LENGTH) { | 70 | if (L1_DATA_A_LENGTH || L1_DATA_B_LENGTH) { |
diff --git a/arch/blackfin/kernel/dma-mapping.c b/arch/blackfin/kernel/dma-mapping.c index e937f323d82c..04ddcfeb7981 100644 --- a/arch/blackfin/kernel/dma-mapping.c +++ b/arch/blackfin/kernel/dma-mapping.c | |||
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(dma_free_coherent); | |||
116 | void __dma_sync(dma_addr_t addr, size_t size, | 116 | void __dma_sync(dma_addr_t addr, size_t size, |
117 | enum dma_data_direction dir) | 117 | enum dma_data_direction dir) |
118 | { | 118 | { |
119 | _dma_sync(addr, size, dir); | 119 | __dma_sync_inline(addr, size, dir); |
120 | } | 120 | } |
121 | EXPORT_SYMBOL(__dma_sync); | 121 | EXPORT_SYMBOL(__dma_sync); |
122 | 122 | ||
diff --git a/arch/blackfin/kernel/entry.S b/arch/blackfin/kernel/entry.S index f27dc2292e1b..686478f5f66b 100644 --- a/arch/blackfin/kernel/entry.S +++ b/arch/blackfin/kernel/entry.S | |||
@@ -44,7 +44,7 @@ ENTRY(_ret_from_fork) | |||
44 | sti r4; | 44 | sti r4; |
45 | #endif /* CONFIG_IPIPE */ | 45 | #endif /* CONFIG_IPIPE */ |
46 | SP += -12; | 46 | SP += -12; |
47 | call _schedule_tail; | 47 | pseudo_long_call _schedule_tail, p5; |
48 | SP += 12; | 48 | SP += 12; |
49 | r0 = [sp + PT_IPEND]; | 49 | r0 = [sp + PT_IPEND]; |
50 | cc = bittst(r0,1); | 50 | cc = bittst(r0,1); |
@@ -79,7 +79,7 @@ ENTRY(_sys_vfork) | |||
79 | r0 += 24; | 79 | r0 += 24; |
80 | [--sp] = rets; | 80 | [--sp] = rets; |
81 | SP += -12; | 81 | SP += -12; |
82 | call _bfin_vfork; | 82 | pseudo_long_call _bfin_vfork, p2; |
83 | SP += 12; | 83 | SP += 12; |
84 | rets = [sp++]; | 84 | rets = [sp++]; |
85 | rts; | 85 | rts; |
@@ -90,7 +90,7 @@ ENTRY(_sys_clone) | |||
90 | r0 += 24; | 90 | r0 += 24; |
91 | [--sp] = rets; | 91 | [--sp] = rets; |
92 | SP += -12; | 92 | SP += -12; |
93 | call _bfin_clone; | 93 | pseudo_long_call _bfin_clone, p2; |
94 | SP += 12; | 94 | SP += 12; |
95 | rets = [sp++]; | 95 | rets = [sp++]; |
96 | rts; | 96 | rts; |
@@ -101,7 +101,7 @@ ENTRY(_sys_rt_sigreturn) | |||
101 | r0 += 24; | 101 | r0 += 24; |
102 | [--sp] = rets; | 102 | [--sp] = rets; |
103 | SP += -12; | 103 | SP += -12; |
104 | call _do_rt_sigreturn; | 104 | pseudo_long_call _do_rt_sigreturn, p2; |
105 | SP += 12; | 105 | SP += 12; |
106 | rets = [sp++]; | 106 | rets = [sp++]; |
107 | rts; | 107 | rts; |
diff --git a/arch/blackfin/kernel/ftrace-entry.S b/arch/blackfin/kernel/ftrace-entry.S index 76dd4fbcd17a..d66446b572c0 100644 --- a/arch/blackfin/kernel/ftrace-entry.S +++ b/arch/blackfin/kernel/ftrace-entry.S | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * mcount and friends -- ftrace stuff | 2 | * mcount and friends -- ftrace stuff |
3 | * | 3 | * |
4 | * Copyright (C) 2009 Analog Devices Inc. | 4 | * Copyright (C) 2009-2010 Analog Devices Inc. |
5 | * Licensed under the GPL-2 or later. | 5 | * Licensed under the GPL-2 or later. |
6 | */ | 6 | */ |
7 | 7 | ||
@@ -21,6 +21,15 @@ | |||
21 | * function will be waiting there. mmmm pie. | 21 | * function will be waiting there. mmmm pie. |
22 | */ | 22 | */ |
23 | ENTRY(__mcount) | 23 | ENTRY(__mcount) |
24 | #ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST | ||
25 | /* optional micro optimization: return if stopped */ | ||
26 | p1.l = _function_trace_stop; | ||
27 | p1.h = _function_trace_stop; | ||
28 | r3 = [p1]; | ||
29 | cc = r3 == 0; | ||
30 | if ! cc jump _ftrace_stub (bp); | ||
31 | #endif | ||
32 | |||
24 | /* save third function arg early so we can do testing below */ | 33 | /* save third function arg early so we can do testing below */ |
25 | [--sp] = r2; | 34 | [--sp] = r2; |
26 | 35 | ||
@@ -106,9 +115,12 @@ ENTRY(_ftrace_graph_caller) | |||
106 | [--sp] = r1; | 115 | [--sp] = r1; |
107 | [--sp] = rets; | 116 | [--sp] = rets; |
108 | 117 | ||
109 | /* prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) */ | 118 | /* prepare_ftrace_return(parent, self_addr, frame_pointer) */ |
110 | r0 = sp; | 119 | r0 = sp; /* unsigned long *parent */ |
111 | r1 = rets; | 120 | r1 = rets; /* unsigned long self_addr */ |
121 | #ifdef CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST | ||
122 | r2 = fp; /* unsigned long frame_pointer */ | ||
123 | #endif | ||
112 | r0 += 16; /* skip the 4 local regs on stack */ | 124 | r0 += 16; /* skip the 4 local regs on stack */ |
113 | r1 += -MCOUNT_INSN_SIZE; | 125 | r1 += -MCOUNT_INSN_SIZE; |
114 | call _prepare_ftrace_return; | 126 | call _prepare_ftrace_return; |
@@ -127,6 +139,9 @@ ENTRY(_return_to_handler) | |||
127 | [--sp] = r1; | 139 | [--sp] = r1; |
128 | 140 | ||
129 | /* get original return address */ | 141 | /* get original return address */ |
142 | #ifdef CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST | ||
143 | r0 = fp; /* Blackfin is sane, so omit this */ | ||
144 | #endif | ||
130 | call _ftrace_return_to_handler; | 145 | call _ftrace_return_to_handler; |
131 | rets = r0; | 146 | rets = r0; |
132 | 147 | ||
diff --git a/arch/blackfin/kernel/ftrace.c b/arch/blackfin/kernel/ftrace.c index f2c85ac6f2da..a61d948ea925 100644 --- a/arch/blackfin/kernel/ftrace.c +++ b/arch/blackfin/kernel/ftrace.c | |||
@@ -16,7 +16,8 @@ | |||
16 | * Hook the return address and push it in the stack of return addrs | 16 | * Hook the return address and push it in the stack of return addrs |
17 | * in current thread info. | 17 | * in current thread info. |
18 | */ | 18 | */ |
19 | void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) | 19 | void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, |
20 | unsigned long frame_pointer) | ||
20 | { | 21 | { |
21 | struct ftrace_graph_ent trace; | 22 | struct ftrace_graph_ent trace; |
22 | unsigned long return_hooker = (unsigned long)&return_to_handler; | 23 | unsigned long return_hooker = (unsigned long)&return_to_handler; |
@@ -24,7 +25,8 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) | |||
24 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | 25 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) |
25 | return; | 26 | return; |
26 | 27 | ||
27 | if (ftrace_push_return_trace(*parent, self_addr, &trace.depth, 0) == -EBUSY) | 28 | if (ftrace_push_return_trace(*parent, self_addr, &trace.depth, |
29 | frame_pointer) == -EBUSY) | ||
28 | return; | 30 | return; |
29 | 31 | ||
30 | trace.func = self_addr; | 32 | trace.func = self_addr; |
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c index 118c5b9dedac..d3970e8acd1a 100644 --- a/arch/blackfin/kernel/init_task.c +++ b/arch/blackfin/kernel/init_task.c | |||
@@ -28,5 +28,5 @@ EXPORT_SYMBOL(init_task); | |||
28 | * "init_task" linker map entry. | 28 | * "init_task" linker map entry. |
29 | */ | 29 | */ |
30 | union thread_union init_thread_union | 30 | union thread_union init_thread_union |
31 | __attribute__ ((__section__(".init_task.data"))) = { | 31 | __init_task_data = { |
32 | INIT_THREAD_INFO(init_task)}; | 32 | INIT_THREAD_INFO(init_task)}; |
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c index 34c7c3ed2c9c..2c501ceb1e55 100644 --- a/arch/blackfin/kernel/kgdb.c +++ b/arch/blackfin/kernel/kgdb.c | |||
@@ -145,7 +145,7 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) | |||
145 | #endif | 145 | #endif |
146 | } | 146 | } |
147 | 147 | ||
148 | struct hw_breakpoint { | 148 | static struct hw_breakpoint { |
149 | unsigned int occupied:1; | 149 | unsigned int occupied:1; |
150 | unsigned int skip:1; | 150 | unsigned int skip:1; |
151 | unsigned int enabled:1; | 151 | unsigned int enabled:1; |
@@ -155,7 +155,7 @@ struct hw_breakpoint { | |||
155 | unsigned int addr; | 155 | unsigned int addr; |
156 | } breakinfo[HW_WATCHPOINT_NUM]; | 156 | } breakinfo[HW_WATCHPOINT_NUM]; |
157 | 157 | ||
158 | int bfin_set_hw_break(unsigned long addr, int len, enum kgdb_bptype type) | 158 | static int bfin_set_hw_break(unsigned long addr, int len, enum kgdb_bptype type) |
159 | { | 159 | { |
160 | int breakno; | 160 | int breakno; |
161 | int bfin_type; | 161 | int bfin_type; |
@@ -202,7 +202,7 @@ int bfin_set_hw_break(unsigned long addr, int len, enum kgdb_bptype type) | |||
202 | return -ENOSPC; | 202 | return -ENOSPC; |
203 | } | 203 | } |
204 | 204 | ||
205 | int bfin_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype type) | 205 | static int bfin_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype type) |
206 | { | 206 | { |
207 | int breakno; | 207 | int breakno; |
208 | int bfin_type; | 208 | int bfin_type; |
@@ -230,7 +230,7 @@ int bfin_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype type) | |||
230 | return 0; | 230 | return 0; |
231 | } | 231 | } |
232 | 232 | ||
233 | void bfin_remove_all_hw_break(void) | 233 | static void bfin_remove_all_hw_break(void) |
234 | { | 234 | { |
235 | int breakno; | 235 | int breakno; |
236 | 236 | ||
@@ -242,7 +242,7 @@ void bfin_remove_all_hw_break(void) | |||
242 | breakinfo[breakno].type = TYPE_DATA_WATCHPOINT; | 242 | breakinfo[breakno].type = TYPE_DATA_WATCHPOINT; |
243 | } | 243 | } |
244 | 244 | ||
245 | void bfin_correct_hw_break(void) | 245 | static void bfin_correct_hw_break(void) |
246 | { | 246 | { |
247 | int breakno; | 247 | int breakno; |
248 | unsigned int wpiactl = 0; | 248 | unsigned int wpiactl = 0; |
diff --git a/arch/blackfin/kernel/nmi.c b/arch/blackfin/kernel/nmi.c new file mode 100644 index 000000000000..0b5f72f17fd0 --- /dev/null +++ b/arch/blackfin/kernel/nmi.c | |||
@@ -0,0 +1,299 @@ | |||
1 | /* | ||
2 | * Blackfin nmi_watchdog Driver | ||
3 | * | ||
4 | * Originally based on bfin_wdt.c | ||
5 | * Copyright 2010-2010 Analog Devices Inc. | ||
6 | * Graff Yang <graf.yang@analog.com> | ||
7 | * | ||
8 | * Enter bugs at http://blackfin.uclinux.org/ | ||
9 | * | ||
10 | * Licensed under the GPL-2 or later. | ||
11 | */ | ||
12 | |||
13 | #include <linux/bitops.h> | ||
14 | #include <linux/hardirq.h> | ||
15 | #include <linux/sysdev.h> | ||
16 | #include <linux/pm.h> | ||
17 | #include <linux/nmi.h> | ||
18 | #include <linux/smp.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <asm/blackfin.h> | ||
21 | #include <asm/atomic.h> | ||
22 | #include <asm/cacheflush.h> | ||
23 | #include <asm/bfin_watchdog.h> | ||
24 | |||
25 | #define DRV_NAME "nmi-wdt" | ||
26 | |||
27 | #define NMI_WDT_TIMEOUT 5 /* 5 seconds */ | ||
28 | #define NMI_CHECK_TIMEOUT (4 * HZ) /* 4 seconds in jiffies */ | ||
29 | static int nmi_wdt_cpu = 1; | ||
30 | |||
31 | static unsigned int timeout = NMI_WDT_TIMEOUT; | ||
32 | static int nmi_active; | ||
33 | |||
34 | static unsigned short wdoga_ctl; | ||
35 | static unsigned int wdoga_cnt; | ||
36 | static struct corelock_slot saved_corelock; | ||
37 | static atomic_t nmi_touched[NR_CPUS]; | ||
38 | static struct timer_list ntimer; | ||
39 | |||
40 | enum { | ||
41 | COREA_ENTER_NMI = 0, | ||
42 | COREA_EXIT_NMI, | ||
43 | COREB_EXIT_NMI, | ||
44 | |||
45 | NMI_EVENT_NR, | ||
46 | }; | ||
47 | static unsigned long nmi_event __attribute__ ((__section__(".l2.bss"))); | ||
48 | |||
49 | /* we are in nmi, non-atomic bit ops is safe */ | ||
50 | static inline void set_nmi_event(int event) | ||
51 | { | ||
52 | __set_bit(event, &nmi_event); | ||
53 | } | ||
54 | |||
55 | static inline void wait_nmi_event(int event) | ||
56 | { | ||
57 | while (!test_bit(event, &nmi_event)) | ||
58 | barrier(); | ||
59 | __clear_bit(event, &nmi_event); | ||
60 | } | ||
61 | |||
62 | static inline void send_corea_nmi(void) | ||
63 | { | ||
64 | wdoga_ctl = bfin_read_WDOGA_CTL(); | ||
65 | wdoga_cnt = bfin_read_WDOGA_CNT(); | ||
66 | |||
67 | bfin_write_WDOGA_CTL(WDEN_DISABLE); | ||
68 | bfin_write_WDOGA_CNT(0); | ||
69 | bfin_write_WDOGA_CTL(WDEN_ENABLE | ICTL_NMI); | ||
70 | } | ||
71 | |||
72 | static inline void restore_corea_nmi(void) | ||
73 | { | ||
74 | bfin_write_WDOGA_CTL(WDEN_DISABLE); | ||
75 | bfin_write_WDOGA_CTL(WDOG_EXPIRED | WDEN_DISABLE | ICTL_NONE); | ||
76 | |||
77 | bfin_write_WDOGA_CNT(wdoga_cnt); | ||
78 | bfin_write_WDOGA_CTL(wdoga_ctl); | ||
79 | } | ||
80 | |||
81 | static inline void save_corelock(void) | ||
82 | { | ||
83 | saved_corelock = corelock; | ||
84 | corelock.lock = 0; | ||
85 | } | ||
86 | |||
87 | static inline void restore_corelock(void) | ||
88 | { | ||
89 | corelock = saved_corelock; | ||
90 | } | ||
91 | |||
92 | |||
93 | static inline void nmi_wdt_keepalive(void) | ||
94 | { | ||
95 | bfin_write_WDOGB_STAT(0); | ||
96 | } | ||
97 | |||
98 | static inline void nmi_wdt_stop(void) | ||
99 | { | ||
100 | bfin_write_WDOGB_CTL(WDEN_DISABLE); | ||
101 | } | ||
102 | |||
103 | /* before calling this function, you must stop the WDT */ | ||
104 | static inline void nmi_wdt_clear(void) | ||
105 | { | ||
106 | /* clear TRO bit, disable event generation */ | ||
107 | bfin_write_WDOGB_CTL(WDOG_EXPIRED | WDEN_DISABLE | ICTL_NONE); | ||
108 | } | ||
109 | |||
110 | static inline void nmi_wdt_start(void) | ||
111 | { | ||
112 | bfin_write_WDOGB_CTL(WDEN_ENABLE | ICTL_NMI); | ||
113 | } | ||
114 | |||
115 | static inline int nmi_wdt_running(void) | ||
116 | { | ||
117 | return ((bfin_read_WDOGB_CTL() & WDEN_MASK) != WDEN_DISABLE); | ||
118 | } | ||
119 | |||
120 | static inline int nmi_wdt_set_timeout(unsigned long t) | ||
121 | { | ||
122 | u32 cnt, max_t, sclk; | ||
123 | int run; | ||
124 | |||
125 | sclk = get_sclk(); | ||
126 | max_t = -1 / sclk; | ||
127 | cnt = t * sclk; | ||
128 | if (t > max_t) { | ||
129 | pr_warning("NMI: timeout value is too large\n"); | ||
130 | return -EINVAL; | ||
131 | } | ||
132 | |||
133 | run = nmi_wdt_running(); | ||
134 | nmi_wdt_stop(); | ||
135 | bfin_write_WDOGB_CNT(cnt); | ||
136 | if (run) | ||
137 | nmi_wdt_start(); | ||
138 | |||
139 | timeout = t; | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | int check_nmi_wdt_touched(void) | ||
145 | { | ||
146 | unsigned int this_cpu = smp_processor_id(); | ||
147 | unsigned int cpu; | ||
148 | |||
149 | cpumask_t mask = cpu_online_map; | ||
150 | |||
151 | if (!atomic_read(&nmi_touched[this_cpu])) | ||
152 | return 0; | ||
153 | |||
154 | atomic_set(&nmi_touched[this_cpu], 0); | ||
155 | |||
156 | cpu_clear(this_cpu, mask); | ||
157 | for_each_cpu_mask(cpu, mask) { | ||
158 | invalidate_dcache_range((unsigned long)(&nmi_touched[cpu]), | ||
159 | (unsigned long)(&nmi_touched[cpu])); | ||
160 | if (!atomic_read(&nmi_touched[cpu])) | ||
161 | return 0; | ||
162 | atomic_set(&nmi_touched[cpu], 0); | ||
163 | } | ||
164 | |||
165 | return 1; | ||
166 | } | ||
167 | |||
168 | static void nmi_wdt_timer(unsigned long data) | ||
169 | { | ||
170 | if (check_nmi_wdt_touched()) | ||
171 | nmi_wdt_keepalive(); | ||
172 | |||
173 | mod_timer(&ntimer, jiffies + NMI_CHECK_TIMEOUT); | ||
174 | } | ||
175 | |||
176 | static int __init init_nmi_wdt(void) | ||
177 | { | ||
178 | nmi_wdt_set_timeout(timeout); | ||
179 | nmi_wdt_start(); | ||
180 | nmi_active = true; | ||
181 | |||
182 | init_timer(&ntimer); | ||
183 | ntimer.function = nmi_wdt_timer; | ||
184 | ntimer.expires = jiffies + NMI_CHECK_TIMEOUT; | ||
185 | add_timer(&ntimer); | ||
186 | |||
187 | pr_info("nmi_wdt: initialized: timeout=%d sec\n", timeout); | ||
188 | return 0; | ||
189 | } | ||
190 | device_initcall(init_nmi_wdt); | ||
191 | |||
192 | void touch_nmi_watchdog(void) | ||
193 | { | ||
194 | atomic_set(&nmi_touched[smp_processor_id()], 1); | ||
195 | } | ||
196 | |||
197 | /* Suspend/resume support */ | ||
198 | #ifdef CONFIG_PM | ||
199 | static int nmi_wdt_suspend(struct sys_device *dev, pm_message_t state) | ||
200 | { | ||
201 | nmi_wdt_stop(); | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static int nmi_wdt_resume(struct sys_device *dev) | ||
206 | { | ||
207 | if (nmi_active) | ||
208 | nmi_wdt_start(); | ||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | static struct sysdev_class nmi_sysclass = { | ||
213 | .name = DRV_NAME, | ||
214 | .resume = nmi_wdt_resume, | ||
215 | .suspend = nmi_wdt_suspend, | ||
216 | }; | ||
217 | |||
218 | static struct sys_device device_nmi_wdt = { | ||
219 | .id = 0, | ||
220 | .cls = &nmi_sysclass, | ||
221 | }; | ||
222 | |||
223 | static int __init init_nmi_wdt_sysfs(void) | ||
224 | { | ||
225 | int error; | ||
226 | |||
227 | if (!nmi_active) | ||
228 | return 0; | ||
229 | |||
230 | error = sysdev_class_register(&nmi_sysclass); | ||
231 | if (!error) | ||
232 | error = sysdev_register(&device_nmi_wdt); | ||
233 | return error; | ||
234 | } | ||
235 | late_initcall(init_nmi_wdt_sysfs); | ||
236 | |||
237 | #endif /* CONFIG_PM */ | ||
238 | |||
239 | |||
240 | asmlinkage notrace void do_nmi(struct pt_regs *fp) | ||
241 | { | ||
242 | unsigned int cpu = smp_processor_id(); | ||
243 | nmi_enter(); | ||
244 | |||
245 | cpu_pda[cpu].__nmi_count += 1; | ||
246 | |||
247 | if (cpu == nmi_wdt_cpu) { | ||
248 | /* CoreB goes here first */ | ||
249 | |||
250 | /* reload the WDOG_STAT */ | ||
251 | nmi_wdt_keepalive(); | ||
252 | |||
253 | /* clear nmi interrupt for CoreB */ | ||
254 | nmi_wdt_stop(); | ||
255 | nmi_wdt_clear(); | ||
256 | |||
257 | /* trigger NMI interrupt of CoreA */ | ||
258 | send_corea_nmi(); | ||
259 | |||
260 | /* waiting CoreB to enter NMI */ | ||
261 | wait_nmi_event(COREA_ENTER_NMI); | ||
262 | |||
263 | /* recover WDOGA's settings */ | ||
264 | restore_corea_nmi(); | ||
265 | |||
266 | save_corelock(); | ||
267 | |||
268 | /* corelock is save/cleared, CoreA is dummping messages */ | ||
269 | |||
270 | wait_nmi_event(COREA_EXIT_NMI); | ||
271 | } else { | ||
272 | /* OK, CoreA entered NMI */ | ||
273 | set_nmi_event(COREA_ENTER_NMI); | ||
274 | } | ||
275 | |||
276 | pr_emerg("\nNMI Watchdog detected LOCKUP, dump for CPU %d\n", cpu); | ||
277 | dump_bfin_process(fp); | ||
278 | dump_bfin_mem(fp); | ||
279 | show_regs(fp); | ||
280 | dump_bfin_trace_buffer(); | ||
281 | show_stack(current, (unsigned long *)fp); | ||
282 | |||
283 | if (cpu == nmi_wdt_cpu) { | ||
284 | pr_emerg("This fault is not recoverable, sorry!\n"); | ||
285 | |||
286 | /* CoreA dump finished, restore the corelock */ | ||
287 | restore_corelock(); | ||
288 | |||
289 | set_nmi_event(COREB_EXIT_NMI); | ||
290 | } else { | ||
291 | /* CoreB dump finished, notice the CoreA we are done */ | ||
292 | set_nmi_event(COREA_EXIT_NMI); | ||
293 | |||
294 | /* synchronize with CoreA */ | ||
295 | wait_nmi_event(COREB_EXIT_NMI); | ||
296 | } | ||
297 | |||
298 | nmi_exit(); | ||
299 | } | ||
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index b56b0e485e0b..29705cec91de 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c | |||
@@ -98,13 +98,6 @@ void cpu_idle(void) | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | /* Fill in the fpu structure for a core dump. */ | ||
102 | |||
103 | int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpregs) | ||
104 | { | ||
105 | return 1; | ||
106 | } | ||
107 | |||
108 | /* | 101 | /* |
109 | * This gets run with P1 containing the | 102 | * This gets run with P1 containing the |
110 | * function to call, and R1 containing | 103 | * function to call, and R1 containing |
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index 65567dc4b9f5..43eb969405d1 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds | 2 | * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds |
3 | * these modifications are Copyright 2004-2009 Analog Devices Inc. | 3 | * these modifications are Copyright 2004-2010 Analog Devices Inc. |
4 | * | 4 | * |
5 | * Licensed under the GPL-2 | 5 | * Licensed under the GPL-2 |
6 | */ | 6 | */ |
@@ -9,10 +9,13 @@ | |||
9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
12 | #include <linux/elf.h> | ||
12 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
13 | #include <linux/ptrace.h> | 14 | #include <linux/ptrace.h> |
14 | #include <linux/user.h> | 15 | #include <linux/user.h> |
16 | #include <linux/regset.h> | ||
15 | #include <linux/signal.h> | 17 | #include <linux/signal.h> |
18 | #include <linux/tracehook.h> | ||
16 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
17 | 20 | ||
18 | #include <asm/page.h> | 21 | #include <asm/page.h> |
@@ -25,90 +28,57 @@ | |||
25 | #include <asm/cacheflush.h> | 28 | #include <asm/cacheflush.h> |
26 | #include <asm/mem_map.h> | 29 | #include <asm/mem_map.h> |
27 | 30 | ||
28 | #define TEXT_OFFSET 0 | ||
29 | /* | 31 | /* |
30 | * does not yet catch signals sent when the child dies. | 32 | * does not yet catch signals sent when the child dies. |
31 | * in exit.c or in signal.c. | 33 | * in exit.c or in signal.c. |
32 | */ | 34 | */ |
33 | 35 | ||
34 | /* determines which bits in the SYSCFG reg the user has access to. */ | ||
35 | /* 1 = access 0 = no access */ | ||
36 | #define SYSCFG_MASK 0x0007 /* SYSCFG reg */ | ||
37 | /* sets the trace bits. */ | ||
38 | #define TRACE_BITS 0x0001 | ||
39 | |||
40 | /* Find the stack offset for a register, relative to thread.esp0. */ | ||
41 | #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) | ||
42 | |||
43 | /* | ||
44 | * Get the address of the live pt_regs for the specified task. | ||
45 | * These are saved onto the top kernel stack when the process | ||
46 | * is not running. | ||
47 | * | ||
48 | * Note: if a user thread is execve'd from kernel space, the | ||
49 | * kernel stack will not be empty on entry to the kernel, so | ||
50 | * ptracing these tasks will fail. | ||
51 | */ | ||
52 | static inline struct pt_regs *get_user_regs(struct task_struct *task) | ||
53 | { | ||
54 | return (struct pt_regs *) | ||
55 | ((unsigned long)task_stack_page(task) + | ||
56 | (THREAD_SIZE - sizeof(struct pt_regs))); | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * Get all user integer registers. | ||
61 | */ | ||
62 | static inline int ptrace_getregs(struct task_struct *tsk, void __user *uregs) | ||
63 | { | ||
64 | struct pt_regs regs; | ||
65 | memcpy(®s, get_user_regs(tsk), sizeof(regs)); | ||
66 | regs.usp = tsk->thread.usp; | ||
67 | return copy_to_user(uregs, ®s, sizeof(struct pt_regs)) ? -EFAULT : 0; | ||
68 | } | ||
69 | |||
70 | /* Mapping from PT_xxx to the stack offset at which the register is | ||
71 | * saved. Notice that usp has no stack-slot and needs to be treated | ||
72 | * specially (see get_reg/put_reg below). | ||
73 | */ | ||
74 | |||
75 | /* | 36 | /* |
76 | * Get contents of register REGNO in task TASK. | 37 | * Get contents of register REGNO in task TASK. |
77 | */ | 38 | */ |
78 | static inline long get_reg(struct task_struct *task, int regno) | 39 | static inline long |
40 | get_reg(struct task_struct *task, long regno, unsigned long __user *datap) | ||
79 | { | 41 | { |
80 | unsigned char *reg_ptr; | 42 | long tmp; |
43 | struct pt_regs *regs = task_pt_regs(task); | ||
81 | 44 | ||
82 | struct pt_regs *regs = | 45 | if (regno & 3 || regno > PT_LAST_PSEUDO || regno < 0) |
83 | (struct pt_regs *)((unsigned long)task_stack_page(task) + | 46 | return -EIO; |
84 | (THREAD_SIZE - sizeof(struct pt_regs))); | ||
85 | reg_ptr = (char *)regs; | ||
86 | 47 | ||
87 | switch (regno) { | 48 | switch (regno) { |
49 | case PT_TEXT_ADDR: | ||
50 | tmp = task->mm->start_code; | ||
51 | break; | ||
52 | case PT_TEXT_END_ADDR: | ||
53 | tmp = task->mm->end_code; | ||
54 | break; | ||
55 | case PT_DATA_ADDR: | ||
56 | tmp = task->mm->start_data; | ||
57 | break; | ||
88 | case PT_USP: | 58 | case PT_USP: |
89 | return task->thread.usp; | 59 | tmp = task->thread.usp; |
60 | break; | ||
90 | default: | 61 | default: |
91 | if (regno <= 216) | 62 | if (regno < sizeof(*regs)) { |
92 | return *(long *)(reg_ptr + regno); | 63 | void *reg_ptr = regs; |
64 | tmp = *(long *)(reg_ptr + regno); | ||
65 | } else | ||
66 | return -EIO; | ||
93 | } | 67 | } |
94 | /* slight mystery ... never seems to come here but kernel misbehaves without this code! */ | ||
95 | 68 | ||
96 | printk(KERN_WARNING "Request to get for unknown register %d\n", regno); | 69 | return put_user(tmp, datap); |
97 | return 0; | ||
98 | } | 70 | } |
99 | 71 | ||
100 | /* | 72 | /* |
101 | * Write contents of register REGNO in task TASK. | 73 | * Write contents of register REGNO in task TASK. |
102 | */ | 74 | */ |
103 | static inline int | 75 | static inline int |
104 | put_reg(struct task_struct *task, int regno, unsigned long data) | 76 | put_reg(struct task_struct *task, long regno, unsigned long data) |
105 | { | 77 | { |
106 | char *reg_ptr; | 78 | struct pt_regs *regs = task_pt_regs(task); |
107 | 79 | ||
108 | struct pt_regs *regs = | 80 | if (regno & 3 || regno > PT_LAST_PSEUDO || regno < 0) |
109 | (struct pt_regs *)((unsigned long)task_stack_page(task) + | 81 | return -EIO; |
110 | (THREAD_SIZE - sizeof(struct pt_regs))); | ||
111 | reg_ptr = (char *)regs; | ||
112 | 82 | ||
113 | switch (regno) { | 83 | switch (regno) { |
114 | case PT_PC: | 84 | case PT_PC: |
@@ -125,10 +95,18 @@ put_reg(struct task_struct *task, int regno, unsigned long data) | |||
125 | regs->usp = data; | 95 | regs->usp = data; |
126 | task->thread.usp = data; | 96 | task->thread.usp = data; |
127 | break; | 97 | break; |
98 | case PT_SYSCFG: /* don't let userspace screw with this */ | ||
99 | if ((data & ~1) != 0x6) | ||
100 | pr_warning("ptrace: ignore syscfg write of %#lx\n", data); | ||
101 | break; /* regs->syscfg = data; break; */ | ||
128 | default: | 102 | default: |
129 | if (regno <= 216) | 103 | if (regno < sizeof(*regs)) { |
130 | *(long *)(reg_ptr + regno) = data; | 104 | void *reg_offset = regs; |
105 | *(long *)(reg_offset + regno) = data; | ||
106 | } | ||
107 | /* Ignore writes to pseudo registers */ | ||
131 | } | 108 | } |
109 | |||
132 | return 0; | 110 | return 0; |
133 | } | 111 | } |
134 | 112 | ||
@@ -160,24 +138,98 @@ static inline int is_user_addr_valid(struct task_struct *child, | |||
160 | return -EIO; | 138 | return -EIO; |
161 | } | 139 | } |
162 | 140 | ||
163 | void ptrace_enable(struct task_struct *child) | 141 | /* |
142 | * retrieve the contents of Blackfin userspace general registers | ||
143 | */ | ||
144 | static int genregs_get(struct task_struct *target, | ||
145 | const struct user_regset *regset, | ||
146 | unsigned int pos, unsigned int count, | ||
147 | void *kbuf, void __user *ubuf) | ||
164 | { | 148 | { |
165 | unsigned long tmp; | 149 | struct pt_regs *regs = task_pt_regs(target); |
166 | tmp = get_reg(child, PT_SYSCFG) | (TRACE_BITS); | 150 | int ret; |
167 | put_reg(child, PT_SYSCFG, tmp); | 151 | |
152 | /* This sucks ... */ | ||
153 | regs->usp = target->thread.usp; | ||
154 | |||
155 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, | ||
156 | regs, 0, sizeof(*regs)); | ||
157 | if (ret < 0) | ||
158 | return ret; | ||
159 | |||
160 | return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, | ||
161 | sizeof(*regs), -1); | ||
168 | } | 162 | } |
169 | 163 | ||
170 | /* | 164 | /* |
171 | * Called by kernel/ptrace.c when detaching.. | 165 | * update the contents of the Blackfin userspace general registers |
172 | * | 166 | */ |
173 | * Make sure the single step bit is not set. | 167 | static int genregs_set(struct task_struct *target, |
168 | const struct user_regset *regset, | ||
169 | unsigned int pos, unsigned int count, | ||
170 | const void *kbuf, const void __user *ubuf) | ||
171 | { | ||
172 | struct pt_regs *regs = task_pt_regs(target); | ||
173 | int ret; | ||
174 | |||
175 | /* Don't let people set SYSCFG (it's at the end of pt_regs) */ | ||
176 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | ||
177 | regs, 0, PT_SYSCFG); | ||
178 | if (ret < 0) | ||
179 | return ret; | ||
180 | |||
181 | /* This sucks ... */ | ||
182 | target->thread.usp = regs->usp; | ||
183 | /* regs->retx = regs->pc; */ | ||
184 | |||
185 | return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, | ||
186 | PT_SYSCFG, -1); | ||
187 | } | ||
188 | |||
189 | /* | ||
190 | * Define the register sets available on the Blackfin under Linux | ||
174 | */ | 191 | */ |
175 | void ptrace_disable(struct task_struct *child) | 192 | enum bfin_regset { |
193 | REGSET_GENERAL, | ||
194 | }; | ||
195 | |||
196 | static const struct user_regset bfin_regsets[] = { | ||
197 | [REGSET_GENERAL] = { | ||
198 | .core_note_type = NT_PRSTATUS, | ||
199 | .n = sizeof(struct pt_regs) / sizeof(long), | ||
200 | .size = sizeof(long), | ||
201 | .align = sizeof(long), | ||
202 | .get = genregs_get, | ||
203 | .set = genregs_set, | ||
204 | }, | ||
205 | }; | ||
206 | |||
207 | static const struct user_regset_view user_bfin_native_view = { | ||
208 | .name = "Blackfin", | ||
209 | .e_machine = EM_BLACKFIN, | ||
210 | .regsets = bfin_regsets, | ||
211 | .n = ARRAY_SIZE(bfin_regsets), | ||
212 | }; | ||
213 | |||
214 | const struct user_regset_view *task_user_regset_view(struct task_struct *task) | ||
215 | { | ||
216 | return &user_bfin_native_view; | ||
217 | } | ||
218 | |||
219 | void user_enable_single_step(struct task_struct *child) | ||
220 | { | ||
221 | struct pt_regs *regs = task_pt_regs(child); | ||
222 | regs->syscfg |= SYSCFG_SSSTEP; | ||
223 | |||
224 | set_tsk_thread_flag(child, TIF_SINGLESTEP); | ||
225 | } | ||
226 | |||
227 | void user_disable_single_step(struct task_struct *child) | ||
176 | { | 228 | { |
177 | unsigned long tmp; | 229 | struct pt_regs *regs = task_pt_regs(child); |
178 | /* make sure the single step bit is not set. */ | 230 | regs->syscfg &= ~SYSCFG_SSSTEP; |
179 | tmp = get_reg(child, PT_SYSCFG) & ~TRACE_BITS; | 231 | |
180 | put_reg(child, PT_SYSCFG, tmp); | 232 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); |
181 | } | 233 | } |
182 | 234 | ||
183 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | 235 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
@@ -240,40 +292,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
240 | break; | 292 | break; |
241 | } | 293 | } |
242 | 294 | ||
243 | /* read the word at location addr in the USER area. */ | ||
244 | case PTRACE_PEEKUSR: | ||
245 | { | ||
246 | unsigned long tmp; | ||
247 | ret = -EIO; | ||
248 | tmp = 0; | ||
249 | if ((addr & 3) || (addr > (sizeof(struct pt_regs) + 16))) { | ||
250 | printk(KERN_WARNING "ptrace error : PEEKUSR : temporarily returning " | ||
251 | "0 - %x sizeof(pt_regs) is %lx\n", | ||
252 | (int)addr, sizeof(struct pt_regs)); | ||
253 | break; | ||
254 | } | ||
255 | if (addr == sizeof(struct pt_regs)) { | ||
256 | /* PT_TEXT_ADDR */ | ||
257 | tmp = child->mm->start_code + TEXT_OFFSET; | ||
258 | } else if (addr == (sizeof(struct pt_regs) + 4)) { | ||
259 | /* PT_TEXT_END_ADDR */ | ||
260 | tmp = child->mm->end_code; | ||
261 | } else if (addr == (sizeof(struct pt_regs) + 8)) { | ||
262 | /* PT_DATA_ADDR */ | ||
263 | tmp = child->mm->start_data; | ||
264 | #ifdef CONFIG_BINFMT_ELF_FDPIC | ||
265 | } else if (addr == (sizeof(struct pt_regs) + 12)) { | ||
266 | goto case_PTRACE_GETFDPIC_EXEC; | ||
267 | } else if (addr == (sizeof(struct pt_regs) + 16)) { | ||
268 | goto case_PTRACE_GETFDPIC_INTERP; | ||
269 | #endif | ||
270 | } else { | ||
271 | tmp = get_reg(child, addr); | ||
272 | } | ||
273 | ret = put_user(tmp, datap); | ||
274 | break; | ||
275 | } | ||
276 | |||
277 | #ifdef CONFIG_BINFMT_ELF_FDPIC | 295 | #ifdef CONFIG_BINFMT_ELF_FDPIC |
278 | case PTRACE_GETFDPIC: { | 296 | case PTRACE_GETFDPIC: { |
279 | unsigned long tmp = 0; | 297 | unsigned long tmp = 0; |
@@ -336,78 +354,36 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
336 | break; | 354 | break; |
337 | } | 355 | } |
338 | 356 | ||
339 | case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ | 357 | case PTRACE_PEEKUSR: |
340 | ret = -EIO; | 358 | switch (addr) { |
341 | if ((addr & 3) || (addr > (sizeof(struct pt_regs) + 16))) { | 359 | #ifdef CONFIG_BINFMT_ELF_FDPIC /* backwards compat */ |
342 | printk(KERN_WARNING "ptrace error : POKEUSR: temporarily returning 0\n"); | 360 | case PT_FDPIC_EXEC: goto case_PTRACE_GETFDPIC_EXEC; |
343 | break; | 361 | case PT_FDPIC_INTERP: goto case_PTRACE_GETFDPIC_INTERP; |
344 | } | 362 | #endif |
345 | 363 | default: | |
346 | if (addr >= (sizeof(struct pt_regs))) { | 364 | ret = get_reg(child, addr, datap); |
347 | ret = 0; | ||
348 | break; | ||
349 | } | ||
350 | if (addr == PT_SYSCFG) { | ||
351 | data &= SYSCFG_MASK; | ||
352 | data |= get_reg(child, PT_SYSCFG); | ||
353 | } | 365 | } |
354 | ret = put_reg(child, addr, data); | 366 | pr_debug("ptrace: PEEKUSR reg %li with %#lx = %i\n", addr, data, ret); |
355 | break; | 367 | break; |
356 | 368 | ||
357 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 369 | case PTRACE_POKEUSR: |
358 | case PTRACE_CONT: /* restart after signal. */ | 370 | ret = put_reg(child, addr, data); |
359 | pr_debug("ptrace: syscall/cont\n"); | 371 | pr_debug("ptrace: POKEUSR reg %li with %li = %i\n", addr, data, ret); |
360 | |||
361 | ret = -EIO; | ||
362 | if (!valid_signal(data)) | ||
363 | break; | ||
364 | if (request == PTRACE_SYSCALL) | ||
365 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
366 | else | ||
367 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
368 | child->exit_code = data; | ||
369 | ptrace_disable(child); | ||
370 | pr_debug("ptrace: before wake_up_process\n"); | ||
371 | wake_up_process(child); | ||
372 | ret = 0; | ||
373 | break; | ||
374 | |||
375 | /* | ||
376 | * make the child exit. Best I can do is send it a sigkill. | ||
377 | * perhaps it should be put in the status that it wants to | ||
378 | * exit. | ||
379 | */ | ||
380 | case PTRACE_KILL: | ||
381 | ret = 0; | ||
382 | if (child->exit_state == EXIT_ZOMBIE) /* already dead */ | ||
383 | break; | ||
384 | child->exit_code = SIGKILL; | ||
385 | ptrace_disable(child); | ||
386 | wake_up_process(child); | ||
387 | break; | ||
388 | |||
389 | case PTRACE_SINGLESTEP: /* set the trap flag. */ | ||
390 | pr_debug("ptrace: single step\n"); | ||
391 | ret = -EIO; | ||
392 | if (!valid_signal(data)) | ||
393 | break; | ||
394 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
395 | ptrace_enable(child); | ||
396 | child->exit_code = data; | ||
397 | wake_up_process(child); | ||
398 | ret = 0; | ||
399 | break; | 372 | break; |
400 | 373 | ||
401 | case PTRACE_GETREGS: | 374 | case PTRACE_GETREGS: |
402 | /* Get all gp regs from the child. */ | 375 | pr_debug("ptrace: PTRACE_GETREGS\n"); |
403 | ret = ptrace_getregs(child, datap); | 376 | return copy_regset_to_user(child, &user_bfin_native_view, |
404 | break; | 377 | REGSET_GENERAL, |
378 | 0, sizeof(struct pt_regs), | ||
379 | (void __user *)data); | ||
405 | 380 | ||
406 | case PTRACE_SETREGS: | 381 | case PTRACE_SETREGS: |
407 | printk(KERN_WARNING "ptrace: SETREGS: **** NOT IMPLEMENTED ***\n"); | 382 | pr_debug("ptrace: PTRACE_SETREGS\n"); |
408 | /* Set all gp regs in the child. */ | 383 | return copy_regset_from_user(child, &user_bfin_native_view, |
409 | ret = 0; | 384 | REGSET_GENERAL, |
410 | break; | 385 | 0, sizeof(struct pt_regs), |
386 | (const void __user *)data); | ||
411 | 387 | ||
412 | default: | 388 | default: |
413 | ret = ptrace_request(child, request, addr, data); | 389 | ret = ptrace_request(child, request, addr, data); |
@@ -417,27 +393,21 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
417 | return ret; | 393 | return ret; |
418 | } | 394 | } |
419 | 395 | ||
420 | asmlinkage void syscall_trace(void) | 396 | asmlinkage int syscall_trace_enter(struct pt_regs *regs) |
421 | { | 397 | { |
422 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 398 | int ret = 0; |
423 | return; | 399 | |
424 | 400 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | |
425 | if (!(current->ptrace & PT_PTRACED)) | 401 | ret = tracehook_report_syscall_entry(regs); |
426 | return; | 402 | |
427 | 403 | return ret; | |
428 | /* the 0x80 provides a way for the tracing parent to distinguish | 404 | } |
429 | * between a syscall stop and SIGTRAP delivery | 405 | |
430 | */ | 406 | asmlinkage void syscall_trace_leave(struct pt_regs *regs) |
431 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | 407 | { |
432 | ? 0x80 : 0)); | 408 | int step; |
433 | 409 | ||
434 | /* | 410 | step = test_thread_flag(TIF_SINGLESTEP); |
435 | * this isn't the same as continuing with a signal, but it will do | 411 | if (step || test_thread_flag(TIF_SYSCALL_TRACE)) |
436 | * for normal use. strace only continues with a signal if the | 412 | tracehook_report_syscall_exit(regs, step); |
437 | * stopping signal is not SIGTRAP. -brl | ||
438 | */ | ||
439 | if (current->exit_code) { | ||
440 | send_sig(current->exit_code, current, 1); | ||
441 | current->exit_code = 0; | ||
442 | } | ||
443 | } | 413 | } |
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 95448ae9c43a..8e2efceb364b 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
@@ -220,6 +220,16 @@ void __init bfin_relocate_l1_mem(void) | |||
220 | memcpy(_stext_l2, _l2_lma, l2_len); | 220 | memcpy(_stext_l2, _l2_lma, l2_len); |
221 | } | 221 | } |
222 | 222 | ||
223 | #ifdef CONFIG_ROMKERNEL | ||
224 | void __init bfin_relocate_xip_data(void) | ||
225 | { | ||
226 | early_shadow_stamp(); | ||
227 | |||
228 | memcpy(_sdata, _data_lma, (unsigned long)_data_len - THREAD_SIZE + sizeof(struct thread_info)); | ||
229 | memcpy(_sinitdata, _init_data_lma, (unsigned long)_init_data_len); | ||
230 | } | ||
231 | #endif | ||
232 | |||
223 | /* add_memory_region to memmap */ | 233 | /* add_memory_region to memmap */ |
224 | static void __init add_memory_region(unsigned long long start, | 234 | static void __init add_memory_region(unsigned long long start, |
225 | unsigned long long size, int type) | 235 | unsigned long long size, int type) |
@@ -504,7 +514,7 @@ static __init void memory_setup(void) | |||
504 | #endif | 514 | #endif |
505 | unsigned long max_mem; | 515 | unsigned long max_mem; |
506 | 516 | ||
507 | _rambase = (unsigned long)_stext; | 517 | _rambase = CONFIG_BOOT_LOAD; |
508 | _ramstart = (unsigned long)_end; | 518 | _ramstart = (unsigned long)_end; |
509 | 519 | ||
510 | if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) { | 520 | if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) { |
@@ -597,7 +607,12 @@ static __init void memory_setup(void) | |||
597 | } | 607 | } |
598 | 608 | ||
599 | #ifdef CONFIG_MPU | 609 | #ifdef CONFIG_MPU |
610 | #if defined(CONFIG_ROMFS_ON_MTD) && defined(CONFIG_MTD_ROM) | ||
611 | page_mask_nelts = (((_ramend + ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE - | ||
612 | ASYNC_BANK0_BASE) >> PAGE_SHIFT) + 31) / 32; | ||
613 | #else | ||
600 | page_mask_nelts = ((_ramend >> PAGE_SHIFT) + 31) / 32; | 614 | page_mask_nelts = ((_ramend >> PAGE_SHIFT) + 31) / 32; |
615 | #endif | ||
601 | page_mask_order = get_order(3 * page_mask_nelts * sizeof(long)); | 616 | page_mask_order = get_order(3 * page_mask_nelts * sizeof(long)); |
602 | #endif | 617 | #endif |
603 | 618 | ||
@@ -630,7 +645,7 @@ static __init void memory_setup(void) | |||
630 | __bss_start, __bss_stop, | 645 | __bss_start, __bss_stop, |
631 | _sdata, _edata, | 646 | _sdata, _edata, |
632 | (void *)&init_thread_union, | 647 | (void *)&init_thread_union, |
633 | (void *)((int)(&init_thread_union) + 0x2000), | 648 | (void *)((int)(&init_thread_union) + THREAD_SIZE), |
634 | __init_begin, __init_end, | 649 | __init_begin, __init_end, |
635 | (void *)_ramstart, (void *)memory_end | 650 | (void *)_ramstart, (void *)memory_end |
636 | #ifdef CONFIG_MTD_UCLINUX | 651 | #ifdef CONFIG_MTD_UCLINUX |
@@ -792,10 +807,17 @@ static inline int __init get_mem_size(void) | |||
792 | BUG(); | 807 | BUG(); |
793 | } | 808 | } |
794 | 809 | ||
810 | __attribute__((weak)) | ||
811 | void __init native_machine_early_platform_add_devices(void) | ||
812 | { | ||
813 | } | ||
814 | |||
795 | void __init setup_arch(char **cmdline_p) | 815 | void __init setup_arch(char **cmdline_p) |
796 | { | 816 | { |
797 | unsigned long sclk, cclk; | 817 | unsigned long sclk, cclk; |
798 | 818 | ||
819 | native_machine_early_platform_add_devices(); | ||
820 | |||
799 | enable_shadow_console(); | 821 | enable_shadow_console(); |
800 | 822 | ||
801 | /* Check to make sure we are running on the right processor */ | 823 | /* Check to make sure we are running on the right processor */ |
@@ -1217,10 +1239,10 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1217 | dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS, | 1239 | dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS, |
1218 | BFIN_DLINES); | 1240 | BFIN_DLINES); |
1219 | #ifdef __ARCH_SYNC_CORE_DCACHE | 1241 | #ifdef __ARCH_SYNC_CORE_DCACHE |
1220 | seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", cpudata->dcache_invld_count); | 1242 | seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", dcache_invld_count[cpu_num]); |
1221 | #endif | 1243 | #endif |
1222 | #ifdef __ARCH_SYNC_CORE_ICACHE | 1244 | #ifdef __ARCH_SYNC_CORE_ICACHE |
1223 | seq_printf(m, "SMP Icache Flushes\t: %lu\n\n", cpudata->icache_invld_count); | 1245 | seq_printf(m, "SMP Icache Flushes\t: %lu\n\n", icache_invld_count[cpu_num]); |
1224 | #endif | 1246 | #endif |
1225 | 1247 | ||
1226 | if (cpu_num != num_possible_cpus() - 1) | 1248 | if (cpu_num != num_possible_cpus() - 1) |
@@ -1249,8 +1271,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1249 | seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", | 1271 | seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", |
1250 | physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); | 1272 | physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); |
1251 | seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n", | 1273 | seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n", |
1252 | ((int)memory_end - (int)_stext) >> 10, | 1274 | ((int)memory_end - (int)_rambase) >> 10, |
1253 | _stext, | 1275 | (void *)_rambase, |
1254 | (void *)memory_end); | 1276 | (void *)memory_end); |
1255 | seq_printf(m, "\n"); | 1277 | seq_printf(m, "\n"); |
1256 | 1278 | ||
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index e0fd63e9e38a..d536f35d1f43 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2004-2009 Analog Devices Inc. | 2 | * Copyright 2004-2010 Analog Devices Inc. |
3 | * | 3 | * |
4 | * Licensed under the GPL-2 or later | 4 | * Licensed under the GPL-2 or later |
5 | */ | 5 | */ |
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/cacheflush.h> | 17 | #include <asm/cacheflush.h> |
18 | #include <asm/ucontext.h> | 18 | #include <asm/ucontext.h> |
19 | #include <asm/fixed_code.h> | 19 | #include <asm/fixed_code.h> |
20 | #include <asm/syscall.h> | ||
20 | 21 | ||
21 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 22 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
22 | 23 | ||
@@ -50,6 +51,9 @@ rt_restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *p | |||
50 | unsigned long usp = 0; | 51 | unsigned long usp = 0; |
51 | int err = 0; | 52 | int err = 0; |
52 | 53 | ||
54 | /* Always make any pending restarted system calls return -EINTR */ | ||
55 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
56 | |||
53 | #define RESTORE(x) err |= __get_user(regs->x, &sc->sc_##x) | 57 | #define RESTORE(x) err |= __get_user(regs->x, &sc->sc_##x) |
54 | 58 | ||
55 | /* restore passed registers */ | 59 | /* restore passed registers */ |
@@ -206,16 +210,6 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | |||
206 | regs->r1 = (unsigned long)(&frame->info); | 210 | regs->r1 = (unsigned long)(&frame->info); |
207 | regs->r2 = (unsigned long)(&frame->uc); | 211 | regs->r2 = (unsigned long)(&frame->uc); |
208 | 212 | ||
209 | /* | ||
210 | * Clear the trace flag when entering the signal handler, but | ||
211 | * notify any tracer that was single-stepping it. The tracer | ||
212 | * may want to single-step inside the handler too. | ||
213 | */ | ||
214 | if (regs->syscfg & TRACE_BITS) { | ||
215 | regs->syscfg &= ~TRACE_BITS; | ||
216 | ptrace_notify(SIGTRAP); | ||
217 | } | ||
218 | |||
219 | return 0; | 213 | return 0; |
220 | 214 | ||
221 | give_sigsegv: | 215 | give_sigsegv: |
@@ -247,6 +241,11 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) | |||
247 | regs->r0 = regs->orig_r0; | 241 | regs->r0 = regs->orig_r0; |
248 | regs->pc -= 2; | 242 | regs->pc -= 2; |
249 | break; | 243 | break; |
244 | |||
245 | case -ERESTART_RESTARTBLOCK: | ||
246 | regs->p0 = __NR_restart_syscall; | ||
247 | regs->pc -= 2; | ||
248 | break; | ||
250 | } | 249 | } |
251 | } | 250 | } |
252 | 251 | ||
@@ -315,6 +314,9 @@ asmlinkage void do_signal(struct pt_regs *regs) | |||
315 | * clear the TIF_RESTORE_SIGMASK flag */ | 314 | * clear the TIF_RESTORE_SIGMASK flag */ |
316 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 315 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
317 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 316 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
317 | |||
318 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
319 | test_thread_flag(TIF_SINGLESTEP)); | ||
318 | } | 320 | } |
319 | 321 | ||
320 | return; | 322 | return; |
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c index 17c38c5b5b22..cb7a01d4f009 100644 --- a/arch/blackfin/kernel/time-ts.c +++ b/arch/blackfin/kernel/time-ts.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/blackfin.h> | 21 | #include <asm/blackfin.h> |
22 | #include <asm/time.h> | 22 | #include <asm/time.h> |
23 | #include <asm/gptimers.h> | 23 | #include <asm/gptimers.h> |
24 | #include <asm/nmi.h> | ||
24 | 25 | ||
25 | /* Accelerators for sched_clock() | 26 | /* Accelerators for sched_clock() |
26 | * convert from cycles(64bits) => nanoseconds (64bits) | 27 | * convert from cycles(64bits) => nanoseconds (64bits) |
@@ -50,7 +51,11 @@ | |||
50 | 51 | ||
51 | static notrace cycle_t bfin_read_cycles(struct clocksource *cs) | 52 | static notrace cycle_t bfin_read_cycles(struct clocksource *cs) |
52 | { | 53 | { |
54 | #ifdef CONFIG_CPU_FREQ | ||
53 | return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod); | 55 | return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod); |
56 | #else | ||
57 | return get_cycles(); | ||
58 | #endif | ||
54 | } | 59 | } |
55 | 60 | ||
56 | static struct clocksource bfin_cs_cycles = { | 61 | static struct clocksource bfin_cs_cycles = { |
@@ -132,7 +137,6 @@ static int __init bfin_cs_gptimer0_init(void) | |||
132 | # define bfin_cs_gptimer0_init() | 137 | # define bfin_cs_gptimer0_init() |
133 | #endif | 138 | #endif |
134 | 139 | ||
135 | |||
136 | #if defined(CONFIG_GPTMR0_CLOCKSOURCE) || defined(CONFIG_CYCLES_CLOCKSOURCE) | 140 | #if defined(CONFIG_GPTMR0_CLOCKSOURCE) || defined(CONFIG_CYCLES_CLOCKSOURCE) |
137 | /* prefer to use cycles since it has higher rating */ | 141 | /* prefer to use cycles since it has higher rating */ |
138 | notrace unsigned long long sched_clock(void) | 142 | notrace unsigned long long sched_clock(void) |
@@ -145,47 +149,8 @@ notrace unsigned long long sched_clock(void) | |||
145 | } | 149 | } |
146 | #endif | 150 | #endif |
147 | 151 | ||
148 | #ifdef CONFIG_CORE_TIMER_IRQ_L1 | ||
149 | __attribute__((l1_text)) | ||
150 | #endif | ||
151 | irqreturn_t timer_interrupt(int irq, void *dev_id); | ||
152 | |||
153 | static int bfin_timer_set_next_event(unsigned long, \ | ||
154 | struct clock_event_device *); | ||
155 | |||
156 | static void bfin_timer_set_mode(enum clock_event_mode, \ | ||
157 | struct clock_event_device *); | ||
158 | |||
159 | static struct clock_event_device clockevent_bfin = { | ||
160 | #if defined(CONFIG_TICKSOURCE_GPTMR0) | ||
161 | .name = "bfin_gptimer0", | ||
162 | .rating = 300, | ||
163 | .irq = IRQ_TIMER0, | ||
164 | #else | ||
165 | .name = "bfin_core_timer", | ||
166 | .rating = 350, | ||
167 | .irq = IRQ_CORETMR, | ||
168 | #endif | ||
169 | .shift = 32, | ||
170 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
171 | .set_next_event = bfin_timer_set_next_event, | ||
172 | .set_mode = bfin_timer_set_mode, | ||
173 | }; | ||
174 | |||
175 | static struct irqaction bfin_timer_irq = { | ||
176 | #if defined(CONFIG_TICKSOURCE_GPTMR0) | ||
177 | .name = "Blackfin GPTimer0", | ||
178 | #else | ||
179 | .name = "Blackfin CoreTimer", | ||
180 | #endif | ||
181 | .flags = IRQF_DISABLED | IRQF_TIMER | \ | ||
182 | IRQF_IRQPOLL | IRQF_PERCPU, | ||
183 | .handler = timer_interrupt, | ||
184 | .dev_id = &clockevent_bfin, | ||
185 | }; | ||
186 | |||
187 | #if defined(CONFIG_TICKSOURCE_GPTMR0) | 152 | #if defined(CONFIG_TICKSOURCE_GPTMR0) |
188 | static int bfin_timer_set_next_event(unsigned long cycles, | 153 | static int bfin_gptmr0_set_next_event(unsigned long cycles, |
189 | struct clock_event_device *evt) | 154 | struct clock_event_device *evt) |
190 | { | 155 | { |
191 | disable_gptimers(TIMER0bit); | 156 | disable_gptimers(TIMER0bit); |
@@ -196,7 +161,7 @@ static int bfin_timer_set_next_event(unsigned long cycles, | |||
196 | return 0; | 161 | return 0; |
197 | } | 162 | } |
198 | 163 | ||
199 | static void bfin_timer_set_mode(enum clock_event_mode mode, | 164 | static void bfin_gptmr0_set_mode(enum clock_event_mode mode, |
200 | struct clock_event_device *evt) | 165 | struct clock_event_device *evt) |
201 | { | 166 | { |
202 | switch (mode) { | 167 | switch (mode) { |
@@ -224,25 +189,65 @@ static void bfin_timer_set_mode(enum clock_event_mode mode, | |||
224 | } | 189 | } |
225 | } | 190 | } |
226 | 191 | ||
227 | static void bfin_timer_ack(void) | 192 | static void bfin_gptmr0_ack(void) |
228 | { | 193 | { |
229 | set_gptimer_status(TIMER_GROUP1, TIMER_STATUS_TIMIL0); | 194 | set_gptimer_status(TIMER_GROUP1, TIMER_STATUS_TIMIL0); |
230 | } | 195 | } |
231 | 196 | ||
232 | static void __init bfin_timer_init(void) | 197 | static void __init bfin_gptmr0_init(void) |
233 | { | 198 | { |
234 | disable_gptimers(TIMER0bit); | 199 | disable_gptimers(TIMER0bit); |
235 | } | 200 | } |
236 | 201 | ||
237 | static unsigned long __init bfin_clockevent_check(void) | 202 | #ifdef CONFIG_CORE_TIMER_IRQ_L1 |
203 | __attribute__((l1_text)) | ||
204 | #endif | ||
205 | irqreturn_t bfin_gptmr0_interrupt(int irq, void *dev_id) | ||
238 | { | 206 | { |
239 | setup_irq(IRQ_TIMER0, &bfin_timer_irq); | 207 | struct clock_event_device *evt = dev_id; |
240 | return get_sclk(); | 208 | smp_mb(); |
209 | evt->event_handler(evt); | ||
210 | bfin_gptmr0_ack(); | ||
211 | return IRQ_HANDLED; | ||
241 | } | 212 | } |
242 | 213 | ||
243 | #else /* CONFIG_TICKSOURCE_CORETMR */ | 214 | static struct irqaction gptmr0_irq = { |
215 | .name = "Blackfin GPTimer0", | ||
216 | .flags = IRQF_DISABLED | IRQF_TIMER | \ | ||
217 | IRQF_IRQPOLL | IRQF_PERCPU, | ||
218 | .handler = bfin_gptmr0_interrupt, | ||
219 | }; | ||
244 | 220 | ||
245 | static int bfin_timer_set_next_event(unsigned long cycles, | 221 | static struct clock_event_device clockevent_gptmr0 = { |
222 | .name = "bfin_gptimer0", | ||
223 | .rating = 300, | ||
224 | .irq = IRQ_TIMER0, | ||
225 | .shift = 32, | ||
226 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
227 | .set_next_event = bfin_gptmr0_set_next_event, | ||
228 | .set_mode = bfin_gptmr0_set_mode, | ||
229 | }; | ||
230 | |||
231 | static void __init bfin_gptmr0_clockevent_init(struct clock_event_device *evt) | ||
232 | { | ||
233 | unsigned long clock_tick; | ||
234 | |||
235 | clock_tick = get_sclk(); | ||
236 | evt->mult = div_sc(clock_tick, NSEC_PER_SEC, evt->shift); | ||
237 | evt->max_delta_ns = clockevent_delta2ns(-1, evt); | ||
238 | evt->min_delta_ns = clockevent_delta2ns(100, evt); | ||
239 | |||
240 | evt->cpumask = cpumask_of(0); | ||
241 | |||
242 | clockevents_register_device(evt); | ||
243 | } | ||
244 | #endif /* CONFIG_TICKSOURCE_GPTMR0 */ | ||
245 | |||
246 | #if defined(CONFIG_TICKSOURCE_CORETMR) | ||
247 | /* per-cpu local core timer */ | ||
248 | static DEFINE_PER_CPU(struct clock_event_device, coretmr_events); | ||
249 | |||
250 | static int bfin_coretmr_set_next_event(unsigned long cycles, | ||
246 | struct clock_event_device *evt) | 251 | struct clock_event_device *evt) |
247 | { | 252 | { |
248 | bfin_write_TCNTL(TMPWR); | 253 | bfin_write_TCNTL(TMPWR); |
@@ -253,7 +258,7 @@ static int bfin_timer_set_next_event(unsigned long cycles, | |||
253 | return 0; | 258 | return 0; |
254 | } | 259 | } |
255 | 260 | ||
256 | static void bfin_timer_set_mode(enum clock_event_mode mode, | 261 | static void bfin_coretmr_set_mode(enum clock_event_mode mode, |
257 | struct clock_event_device *evt) | 262 | struct clock_event_device *evt) |
258 | { | 263 | { |
259 | switch (mode) { | 264 | switch (mode) { |
@@ -285,19 +290,13 @@ static void bfin_timer_set_mode(enum clock_event_mode mode, | |||
285 | } | 290 | } |
286 | } | 291 | } |
287 | 292 | ||
288 | static void bfin_timer_ack(void) | 293 | void bfin_coretmr_init(void) |
289 | { | ||
290 | } | ||
291 | |||
292 | static void __init bfin_timer_init(void) | ||
293 | { | 294 | { |
294 | /* power up the timer, but don't enable it just yet */ | 295 | /* power up the timer, but don't enable it just yet */ |
295 | bfin_write_TCNTL(TMPWR); | 296 | bfin_write_TCNTL(TMPWR); |
296 | CSYNC(); | 297 | CSYNC(); |
297 | 298 | ||
298 | /* | 299 | /* the TSCALE prescaler counter. */ |
299 | * the TSCALE prescaler counter. | ||
300 | */ | ||
301 | bfin_write_TSCALE(TIME_SCALE - 1); | 300 | bfin_write_TSCALE(TIME_SCALE - 1); |
302 | bfin_write_TPERIOD(0); | 301 | bfin_write_TPERIOD(0); |
303 | bfin_write_TCOUNT(0); | 302 | bfin_write_TCOUNT(0); |
@@ -305,48 +304,54 @@ static void __init bfin_timer_init(void) | |||
305 | CSYNC(); | 304 | CSYNC(); |
306 | } | 305 | } |
307 | 306 | ||
308 | static unsigned long __init bfin_clockevent_check(void) | 307 | #ifdef CONFIG_CORE_TIMER_IRQ_L1 |
309 | { | 308 | __attribute__((l1_text)) |
310 | setup_irq(IRQ_CORETMR, &bfin_timer_irq); | 309 | #endif |
311 | return get_cclk() / TIME_SCALE; | 310 | irqreturn_t bfin_coretmr_interrupt(int irq, void *dev_id) |
312 | } | ||
313 | |||
314 | void __init setup_core_timer(void) | ||
315 | { | 311 | { |
316 | bfin_timer_init(); | 312 | int cpu = smp_processor_id(); |
317 | bfin_timer_set_mode(CLOCK_EVT_MODE_PERIODIC, NULL); | 313 | struct clock_event_device *evt = &per_cpu(coretmr_events, cpu); |
318 | } | ||
319 | #endif /* CONFIG_TICKSOURCE_GPTMR0 */ | ||
320 | 314 | ||
321 | /* | ||
322 | * timer_interrupt() needs to keep up the real-time clock, | ||
323 | * as well as call the "do_timer()" routine every clocktick | ||
324 | */ | ||
325 | irqreturn_t timer_interrupt(int irq, void *dev_id) | ||
326 | { | ||
327 | struct clock_event_device *evt = dev_id; | ||
328 | smp_mb(); | 315 | smp_mb(); |
329 | evt->event_handler(evt); | 316 | evt->event_handler(evt); |
330 | bfin_timer_ack(); | ||
331 | return IRQ_HANDLED; | ||
332 | } | ||
333 | |||
334 | static int __init bfin_clockevent_init(void) | ||
335 | { | ||
336 | unsigned long timer_clk; | ||
337 | 317 | ||
338 | timer_clk = bfin_clockevent_check(); | 318 | touch_nmi_watchdog(); |
339 | 319 | ||
340 | bfin_timer_init(); | 320 | return IRQ_HANDLED; |
321 | } | ||
341 | 322 | ||
342 | clockevent_bfin.mult = div_sc(timer_clk, NSEC_PER_SEC, clockevent_bfin.shift); | 323 | static struct irqaction coretmr_irq = { |
343 | clockevent_bfin.max_delta_ns = clockevent_delta2ns(-1, &clockevent_bfin); | 324 | .name = "Blackfin CoreTimer", |
344 | clockevent_bfin.min_delta_ns = clockevent_delta2ns(100, &clockevent_bfin); | 325 | .flags = IRQF_DISABLED | IRQF_TIMER | \ |
345 | clockevent_bfin.cpumask = cpumask_of(0); | 326 | IRQF_IRQPOLL | IRQF_PERCPU, |
346 | clockevents_register_device(&clockevent_bfin); | 327 | .handler = bfin_coretmr_interrupt, |
328 | }; | ||
347 | 329 | ||
348 | return 0; | 330 | void bfin_coretmr_clockevent_init(void) |
331 | { | ||
332 | unsigned long clock_tick; | ||
333 | unsigned int cpu = smp_processor_id(); | ||
334 | struct clock_event_device *evt = &per_cpu(coretmr_events, cpu); | ||
335 | |||
336 | evt->name = "bfin_core_timer"; | ||
337 | evt->rating = 350; | ||
338 | evt->irq = -1; | ||
339 | evt->shift = 32; | ||
340 | evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | ||
341 | evt->set_next_event = bfin_coretmr_set_next_event; | ||
342 | evt->set_mode = bfin_coretmr_set_mode; | ||
343 | |||
344 | clock_tick = get_cclk() / TIME_SCALE; | ||
345 | evt->mult = div_sc(clock_tick, NSEC_PER_SEC, evt->shift); | ||
346 | evt->max_delta_ns = clockevent_delta2ns(-1, evt); | ||
347 | evt->min_delta_ns = clockevent_delta2ns(100, evt); | ||
348 | |||
349 | evt->cpumask = cpumask_of(cpu); | ||
350 | |||
351 | clockevents_register_device(evt); | ||
349 | } | 352 | } |
353 | #endif /* CONFIG_TICKSOURCE_CORETMR */ | ||
354 | |||
350 | 355 | ||
351 | void __init time_init(void) | 356 | void __init time_init(void) |
352 | { | 357 | { |
@@ -370,5 +375,21 @@ void __init time_init(void) | |||
370 | 375 | ||
371 | bfin_cs_cycles_init(); | 376 | bfin_cs_cycles_init(); |
372 | bfin_cs_gptimer0_init(); | 377 | bfin_cs_gptimer0_init(); |
373 | bfin_clockevent_init(); | 378 | |
379 | #if defined(CONFIG_TICKSOURCE_CORETMR) | ||
380 | bfin_coretmr_init(); | ||
381 | setup_irq(IRQ_CORETMR, &coretmr_irq); | ||
382 | bfin_coretmr_clockevent_init(); | ||
383 | #endif | ||
384 | |||
385 | #if defined(CONFIG_TICKSOURCE_GPTMR0) | ||
386 | bfin_gptmr0_init(); | ||
387 | setup_irq(IRQ_TIMER0, &gptmr0_irq); | ||
388 | gptmr0_irq.dev_id = &clockevent_gptmr0; | ||
389 | bfin_gptmr0_clockevent_init(&clockevent_gptmr0); | ||
390 | #endif | ||
391 | |||
392 | #if !defined(CONFIG_TICKSOURCE_CORETMR) && !defined(CONFIG_TICKSOURCE_GPTMR0) | ||
393 | # error at least one clock event device is required | ||
394 | #endif | ||
374 | } | 395 | } |
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index d3cbcd6bd985..ba70c4bc2699 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
@@ -138,6 +138,12 @@ static void decode_address(char *buf, unsigned long address) | |||
138 | if (!mm) | 138 | if (!mm) |
139 | continue; | 139 | continue; |
140 | 140 | ||
141 | if (!down_read_trylock(&mm->mmap_sem)) { | ||
142 | if (!in_atomic) | ||
143 | mmput(mm); | ||
144 | continue; | ||
145 | } | ||
146 | |||
141 | for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) { | 147 | for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) { |
142 | struct vm_area_struct *vma; | 148 | struct vm_area_struct *vma; |
143 | 149 | ||
@@ -177,6 +183,7 @@ static void decode_address(char *buf, unsigned long address) | |||
177 | sprintf(buf, "[ %s vma:0x%lx-0x%lx]", | 183 | sprintf(buf, "[ %s vma:0x%lx-0x%lx]", |
178 | name, vma->vm_start, vma->vm_end); | 184 | name, vma->vm_start, vma->vm_end); |
179 | 185 | ||
186 | up_read(&mm->mmap_sem); | ||
180 | if (!in_atomic) | 187 | if (!in_atomic) |
181 | mmput(mm); | 188 | mmput(mm); |
182 | 189 | ||
@@ -186,11 +193,16 @@ static void decode_address(char *buf, unsigned long address) | |||
186 | goto done; | 193 | goto done; |
187 | } | 194 | } |
188 | } | 195 | } |
196 | |||
197 | up_read(&mm->mmap_sem); | ||
189 | if (!in_atomic) | 198 | if (!in_atomic) |
190 | mmput(mm); | 199 | mmput(mm); |
191 | } | 200 | } |
192 | 201 | ||
193 | /* we were unable to find this address anywhere */ | 202 | /* |
203 | * we were unable to find this address anywhere, | ||
204 | * or some MMs were skipped because they were in use. | ||
205 | */ | ||
194 | sprintf(buf, "/* kernel dynamic memory */"); | 206 | sprintf(buf, "/* kernel dynamic memory */"); |
195 | 207 | ||
196 | done: | 208 | done: |
@@ -248,9 +260,7 @@ asmlinkage notrace void trap_c(struct pt_regs *fp) | |||
248 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON | 260 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON |
249 | int j; | 261 | int j; |
250 | #endif | 262 | #endif |
251 | #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO | ||
252 | unsigned int cpu = raw_smp_processor_id(); | 263 | unsigned int cpu = raw_smp_processor_id(); |
253 | #endif | ||
254 | const char *strerror = NULL; | 264 | const char *strerror = NULL; |
255 | int sig = 0; | 265 | int sig = 0; |
256 | siginfo_t info; | 266 | siginfo_t info; |
@@ -639,7 +649,17 @@ asmlinkage notrace void trap_c(struct pt_regs *fp) | |||
639 | { | 649 | { |
640 | info.si_signo = sig; | 650 | info.si_signo = sig; |
641 | info.si_errno = 0; | 651 | info.si_errno = 0; |
642 | info.si_addr = (void __user *)fp->pc; | 652 | switch (trapnr) { |
653 | case VEC_CPLB_VL: | ||
654 | case VEC_MISALI_D: | ||
655 | case VEC_CPLB_M: | ||
656 | case VEC_CPLB_MHIT: | ||
657 | info.si_addr = (void __user *)cpu_pda[cpu].dcplb_fault_addr; | ||
658 | break; | ||
659 | default: | ||
660 | info.si_addr = (void __user *)fp->pc; | ||
661 | break; | ||
662 | } | ||
643 | force_sig_info(sig, &info, current); | 663 | force_sig_info(sig, &info, current); |
644 | } | 664 | } |
645 | 665 | ||
@@ -712,7 +732,7 @@ static void decode_instruction(unsigned short *address) | |||
712 | verbose_printk("RTE"); | 732 | verbose_printk("RTE"); |
713 | else if (opcode == 0x0025) | 733 | else if (opcode == 0x0025) |
714 | verbose_printk("EMUEXCPT"); | 734 | verbose_printk("EMUEXCPT"); |
715 | else if (opcode == 0x0040 && opcode <= 0x0047) | 735 | else if (opcode >= 0x0040 && opcode <= 0x0047) |
716 | verbose_printk("STI R%i", opcode & 7); | 736 | verbose_printk("STI R%i", opcode & 7); |
717 | else if (opcode >= 0x0050 && opcode <= 0x0057) | 737 | else if (opcode >= 0x0050 && opcode <= 0x0057) |
718 | verbose_printk("JUMP (P%i)", opcode & 7); | 738 | verbose_printk("JUMP (P%i)", opcode & 7); |
@@ -1096,7 +1116,7 @@ void dump_bfin_mem(struct pt_regs *fp) | |||
1096 | /* And the last RETI points to the current userspace context */ | 1116 | /* And the last RETI points to the current userspace context */ |
1097 | if ((fp + 1)->pc >= current->mm->start_code && | 1117 | if ((fp + 1)->pc >= current->mm->start_code && |
1098 | (fp + 1)->pc <= current->mm->end_code) { | 1118 | (fp + 1)->pc <= current->mm->end_code) { |
1099 | verbose_printk(KERN_NOTICE "It might be better to look around here : \n"); | 1119 | verbose_printk(KERN_NOTICE "It might be better to look around here :\n"); |
1100 | verbose_printk(KERN_NOTICE "-------------------------------------------\n"); | 1120 | verbose_printk(KERN_NOTICE "-------------------------------------------\n"); |
1101 | show_regs(fp + 1); | 1121 | show_regs(fp + 1); |
1102 | verbose_printk(KERN_NOTICE "-------------------------------------------\n"); | 1122 | verbose_printk(KERN_NOTICE "-------------------------------------------\n"); |
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S index 66799e763dc9..984c78172397 100644 --- a/arch/blackfin/kernel/vmlinux.lds.S +++ b/arch/blackfin/kernel/vmlinux.lds.S | |||
@@ -15,7 +15,12 @@ _jiffies = _jiffies_64; | |||
15 | 15 | ||
16 | SECTIONS | 16 | SECTIONS |
17 | { | 17 | { |
18 | #ifdef CONFIG_RAMKERNEL | ||
18 | . = CONFIG_BOOT_LOAD; | 19 | . = CONFIG_BOOT_LOAD; |
20 | #else | ||
21 | . = CONFIG_ROM_BASE; | ||
22 | #endif | ||
23 | |||
19 | /* Neither the text, ro_data or bss section need to be aligned | 24 | /* Neither the text, ro_data or bss section need to be aligned |
20 | * So pack them back to back | 25 | * So pack them back to back |
21 | */ | 26 | */ |
@@ -31,6 +36,12 @@ SECTIONS | |||
31 | LOCK_TEXT | 36 | LOCK_TEXT |
32 | IRQENTRY_TEXT | 37 | IRQENTRY_TEXT |
33 | KPROBES_TEXT | 38 | KPROBES_TEXT |
39 | #ifdef CONFIG_ROMKERNEL | ||
40 | __sinittext = .; | ||
41 | INIT_TEXT | ||
42 | __einittext = .; | ||
43 | EXIT_TEXT | ||
44 | #endif | ||
34 | *(.text.*) | 45 | *(.text.*) |
35 | *(.fixup) | 46 | *(.fixup) |
36 | 47 | ||
@@ -50,8 +61,14 @@ SECTIONS | |||
50 | 61 | ||
51 | /* Just in case the first read only is a 32-bit access */ | 62 | /* Just in case the first read only is a 32-bit access */ |
52 | RO_DATA(4) | 63 | RO_DATA(4) |
64 | __rodata_end = .; | ||
53 | 65 | ||
66 | #ifdef CONFIG_ROMKERNEL | ||
67 | . = CONFIG_BOOT_LOAD; | ||
68 | .bss : AT(__rodata_end) | ||
69 | #else | ||
54 | .bss : | 70 | .bss : |
71 | #endif | ||
55 | { | 72 | { |
56 | . = ALIGN(4); | 73 | . = ALIGN(4); |
57 | ___bss_start = .; | 74 | ___bss_start = .; |
@@ -67,7 +84,11 @@ SECTIONS | |||
67 | ___bss_stop = .; | 84 | ___bss_stop = .; |
68 | } | 85 | } |
69 | 86 | ||
87 | #if defined(CONFIG_ROMKERNEL) | ||
88 | .data : AT(LOADADDR(.bss) + SIZEOF(.bss)) | ||
89 | #else | ||
70 | .data : | 90 | .data : |
91 | #endif | ||
71 | { | 92 | { |
72 | __sdata = .; | 93 | __sdata = .; |
73 | /* This gets done first, so the glob doesn't suck it in */ | 94 | /* This gets done first, so the glob doesn't suck it in */ |
@@ -94,6 +115,8 @@ SECTIONS | |||
94 | 115 | ||
95 | __edata = .; | 116 | __edata = .; |
96 | } | 117 | } |
118 | __data_lma = LOADADDR(.data); | ||
119 | __data_len = SIZEOF(.data); | ||
97 | 120 | ||
98 | /* The init section should be last, so when we free it, it goes into | 121 | /* The init section should be last, so when we free it, it goes into |
99 | * the general memory pool, and (hopefully) will decrease fragmentation | 122 | * the general memory pool, and (hopefully) will decrease fragmentation |
@@ -103,25 +126,58 @@ SECTIONS | |||
103 | . = ALIGN(PAGE_SIZE); | 126 | . = ALIGN(PAGE_SIZE); |
104 | ___init_begin = .; | 127 | ___init_begin = .; |
105 | 128 | ||
129 | #ifdef CONFIG_RAMKERNEL | ||
106 | INIT_TEXT_SECTION(PAGE_SIZE) | 130 | INIT_TEXT_SECTION(PAGE_SIZE) |
107 | . = ALIGN(16); | ||
108 | INIT_DATA_SECTION(16) | ||
109 | PERCPU(4) | ||
110 | 131 | ||
111 | /* we have to discard exit text and such at runtime, not link time, to | 132 | /* We have to discard exit text and such at runtime, not link time, to |
112 | * handle embedded cross-section references (alt instructions, bug | 133 | * handle embedded cross-section references (alt instructions, bug |
113 | * table, eh_frame, etc...) | 134 | * table, eh_frame, etc...). We need all of our .text up front and |
135 | * .data after it for PCREL call issues. | ||
114 | */ | 136 | */ |
115 | .exit.text : | 137 | .exit.text : |
116 | { | 138 | { |
117 | EXIT_TEXT | 139 | EXIT_TEXT |
118 | } | 140 | } |
141 | |||
142 | . = ALIGN(16); | ||
143 | INIT_DATA_SECTION(16) | ||
144 | PERCPU(4) | ||
145 | |||
119 | .exit.data : | 146 | .exit.data : |
120 | { | 147 | { |
121 | EXIT_DATA | 148 | EXIT_DATA |
122 | } | 149 | } |
123 | 150 | ||
124 | .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data)) | 151 | .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data)) |
152 | #else | ||
153 | .init.data : AT(__data_lma + __data_len) | ||
154 | { | ||
155 | __sinitdata = .; | ||
156 | INIT_DATA | ||
157 | INIT_SETUP(16) | ||
158 | INIT_CALLS | ||
159 | CON_INITCALL | ||
160 | SECURITY_INITCALL | ||
161 | INIT_RAM_FS | ||
162 | |||
163 | . = ALIGN(4); | ||
164 | ___per_cpu_load = .; | ||
165 | ___per_cpu_start = .; | ||
166 | *(.data.percpu.first) | ||
167 | *(.data.percpu.page_aligned) | ||
168 | *(.data.percpu) | ||
169 | *(.data.percpu.shared_aligned) | ||
170 | ___per_cpu_end = .; | ||
171 | |||
172 | EXIT_DATA | ||
173 | __einitdata = .; | ||
174 | } | ||
175 | __init_data_lma = LOADADDR(.init.data); | ||
176 | __init_data_len = SIZEOF(.init.data); | ||
177 | __init_data_end = .; | ||
178 | |||
179 | .text_l1 L1_CODE_START : AT(__init_data_lma + __init_data_len) | ||
180 | #endif | ||
125 | { | 181 | { |
126 | . = ALIGN(4); | 182 | . = ALIGN(4); |
127 | __stext_l1 = .; | 183 | __stext_l1 = .; |
@@ -202,7 +258,11 @@ SECTIONS | |||
202 | /* Force trailing alignment of our init section so that when we | 258 | /* Force trailing alignment of our init section so that when we |
203 | * free our init memory, we don't leave behind a partial page. | 259 | * free our init memory, we don't leave behind a partial page. |
204 | */ | 260 | */ |
261 | #ifdef CONFIG_RAMKERNEL | ||
205 | . = __l2_lma + __l2_len; | 262 | . = __l2_lma + __l2_len; |
263 | #else | ||
264 | . = __init_data_end; | ||
265 | #endif | ||
206 | . = ALIGN(PAGE_SIZE); | 266 | . = ALIGN(PAGE_SIZE); |
207 | ___init_end = .; | 267 | ___init_end = .; |
208 | 268 | ||