diff options
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/apm.c | 33 | ||||
-rw-r--r-- | arch/arm/kernel/debug.S | 35 | ||||
-rw-r--r-- | arch/arm/kernel/entry-armv.S | 13 | ||||
-rw-r--r-- | arch/arm/kernel/head-nommu.S | 12 | ||||
-rw-r--r-- | arch/arm/kernel/module.c | 8 | ||||
-rw-r--r-- | arch/arm/kernel/process.c | 22 | ||||
-rw-r--r-- | arch/arm/kernel/time.c | 6 | ||||
-rw-r--r-- | arch/arm/kernel/traps.c | 2 |
8 files changed, 102 insertions, 29 deletions
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c index 33c55689f999..ecf4f9472d94 100644 --- a/arch/arm/kernel/apm.c +++ b/arch/arm/kernel/apm.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/list.h> | 25 | #include <linux/list.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/completion.h> | 27 | #include <linux/completion.h> |
28 | #include <linux/kthread.h> | ||
28 | 29 | ||
29 | #include <asm/apm.h> /* apm_power_info */ | 30 | #include <asm/apm.h> /* apm_power_info */ |
30 | #include <asm/system.h> | 31 | #include <asm/system.h> |
@@ -80,7 +81,7 @@ struct apm_user { | |||
80 | */ | 81 | */ |
81 | static int suspends_pending; | 82 | static int suspends_pending; |
82 | static int apm_disabled; | 83 | static int apm_disabled; |
83 | static int arm_apm_active; | 84 | static struct task_struct *kapmd_tsk; |
84 | 85 | ||
85 | static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); | 86 | static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); |
86 | static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); | 87 | static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); |
@@ -97,7 +98,6 @@ static LIST_HEAD(apm_user_list); | |||
97 | * to be suspending the system. | 98 | * to be suspending the system. |
98 | */ | 99 | */ |
99 | static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait); | 100 | static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait); |
100 | static DECLARE_COMPLETION(kapmd_exit); | ||
101 | static DEFINE_SPINLOCK(kapmd_queue_lock); | 101 | static DEFINE_SPINLOCK(kapmd_queue_lock); |
102 | static struct apm_queue kapmd_queue; | 102 | static struct apm_queue kapmd_queue; |
103 | 103 | ||
@@ -468,16 +468,13 @@ static int apm_get_info(char *buf, char **start, off_t fpos, int length) | |||
468 | 468 | ||
469 | static int kapmd(void *arg) | 469 | static int kapmd(void *arg) |
470 | { | 470 | { |
471 | daemonize("kapmd"); | ||
472 | current->flags |= PF_NOFREEZE; | ||
473 | |||
474 | do { | 471 | do { |
475 | apm_event_t event; | 472 | apm_event_t event; |
476 | 473 | ||
477 | wait_event_interruptible(kapmd_wait, | 474 | wait_event_interruptible(kapmd_wait, |
478 | !queue_empty(&kapmd_queue) || !arm_apm_active); | 475 | !queue_empty(&kapmd_queue) || kthread_should_stop()); |
479 | 476 | ||
480 | if (!arm_apm_active) | 477 | if (kthread_should_stop()) |
481 | break; | 478 | break; |
482 | 479 | ||
483 | spin_lock_irq(&kapmd_queue_lock); | 480 | spin_lock_irq(&kapmd_queue_lock); |
@@ -508,7 +505,7 @@ static int kapmd(void *arg) | |||
508 | } | 505 | } |
509 | } while (1); | 506 | } while (1); |
510 | 507 | ||
511 | complete_and_exit(&kapmd_exit, 0); | 508 | return 0; |
512 | } | 509 | } |
513 | 510 | ||
514 | static int __init apm_init(void) | 511 | static int __init apm_init(void) |
@@ -520,13 +517,14 @@ static int __init apm_init(void) | |||
520 | return -ENODEV; | 517 | return -ENODEV; |
521 | } | 518 | } |
522 | 519 | ||
523 | arm_apm_active = 1; | 520 | kapmd_tsk = kthread_create(kapmd, NULL, "kapmd"); |
524 | 521 | if (IS_ERR(kapmd_tsk)) { | |
525 | ret = kernel_thread(kapmd, NULL, CLONE_KERNEL); | 522 | ret = PTR_ERR(kapmd_tsk); |
526 | if (ret < 0) { | 523 | kapmd_tsk = NULL; |
527 | arm_apm_active = 0; | ||
528 | return ret; | 524 | return ret; |
529 | } | 525 | } |
526 | kapmd_tsk->flags |= PF_NOFREEZE; | ||
527 | wake_up_process(kapmd_tsk); | ||
530 | 528 | ||
531 | #ifdef CONFIG_PROC_FS | 529 | #ifdef CONFIG_PROC_FS |
532 | create_proc_info_entry("apm", 0, NULL, apm_get_info); | 530 | create_proc_info_entry("apm", 0, NULL, apm_get_info); |
@@ -535,10 +533,7 @@ static int __init apm_init(void) | |||
535 | ret = misc_register(&apm_device); | 533 | ret = misc_register(&apm_device); |
536 | if (ret != 0) { | 534 | if (ret != 0) { |
537 | remove_proc_entry("apm", NULL); | 535 | remove_proc_entry("apm", NULL); |
538 | 536 | kthread_stop(kapmd_tsk); | |
539 | arm_apm_active = 0; | ||
540 | wake_up(&kapmd_wait); | ||
541 | wait_for_completion(&kapmd_exit); | ||
542 | } | 537 | } |
543 | 538 | ||
544 | return ret; | 539 | return ret; |
@@ -549,9 +544,7 @@ static void __exit apm_exit(void) | |||
549 | misc_deregister(&apm_device); | 544 | misc_deregister(&apm_device); |
550 | remove_proc_entry("apm", NULL); | 545 | remove_proc_entry("apm", NULL); |
551 | 546 | ||
552 | arm_apm_active = 0; | 547 | kthread_stop(kapmd_tsk); |
553 | wake_up(&kapmd_wait); | ||
554 | wait_for_completion(&kapmd_exit); | ||
555 | } | 548 | } |
556 | 549 | ||
557 | module_init(apm_init); | 550 | module_init(apm_init); |
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S index a5747e58a9dc..5617566477b4 100644 --- a/arch/arm/kernel/debug.S +++ b/arch/arm/kernel/debug.S | |||
@@ -21,6 +21,36 @@ | |||
21 | 21 | ||
22 | #if defined(CONFIG_DEBUG_ICEDCC) | 22 | #if defined(CONFIG_DEBUG_ICEDCC) |
23 | @@ debug using ARM EmbeddedICE DCC channel | 23 | @@ debug using ARM EmbeddedICE DCC channel |
24 | |||
25 | #if defined(CONFIG_CPU_V6) | ||
26 | |||
27 | .macro addruart, rx | ||
28 | .endm | ||
29 | |||
30 | .macro senduart, rd, rx | ||
31 | mcr p14, 0, \rd, c0, c5, 0 | ||
32 | .endm | ||
33 | |||
34 | .macro busyuart, rd, rx | ||
35 | 1001: | ||
36 | mrc p14, 0, \rx, c0, c1, 0 | ||
37 | tst \rx, #0x20000000 | ||
38 | beq 1001b | ||
39 | .endm | ||
40 | |||
41 | .macro waituart, rd, rx | ||
42 | mov \rd, #0x2000000 | ||
43 | 1001: | ||
44 | subs \rd, \rd, #1 | ||
45 | bmi 1002f | ||
46 | mrc p14, 0, \rx, c0, c1, 0 | ||
47 | tst \rx, #0x20000000 | ||
48 | bne 1001b | ||
49 | 1002: | ||
50 | .endm | ||
51 | |||
52 | #else | ||
53 | |||
24 | .macro addruart, rx | 54 | .macro addruart, rx |
25 | .endm | 55 | .endm |
26 | 56 | ||
@@ -46,9 +76,12 @@ | |||
46 | bne 1001b | 76 | bne 1001b |
47 | 1002: | 77 | 1002: |
48 | .endm | 78 | .endm |
79 | |||
80 | #endif /* CONFIG_CPU_V6 */ | ||
81 | |||
49 | #else | 82 | #else |
50 | #include <asm/arch/debug-macro.S> | 83 | #include <asm/arch/debug-macro.S> |
51 | #endif | 84 | #endif /* CONFIG_DEBUG_ICEDCC */ |
52 | 85 | ||
53 | /* | 86 | /* |
54 | * Useful debugging routines | 87 | * Useful debugging routines |
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index de4e33137901..bd623b73445f 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -191,6 +191,9 @@ __dabt_svc: | |||
191 | __irq_svc: | 191 | __irq_svc: |
192 | svc_entry | 192 | svc_entry |
193 | 193 | ||
194 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
195 | bl trace_hardirqs_off | ||
196 | #endif | ||
194 | #ifdef CONFIG_PREEMPT | 197 | #ifdef CONFIG_PREEMPT |
195 | get_thread_info tsk | 198 | get_thread_info tsk |
196 | ldr r8, [tsk, #TI_PREEMPT] @ get preempt count | 199 | ldr r8, [tsk, #TI_PREEMPT] @ get preempt count |
@@ -211,6 +214,10 @@ preempt_return: | |||
211 | #endif | 214 | #endif |
212 | ldr r0, [sp, #S_PSR] @ irqs are already disabled | 215 | ldr r0, [sp, #S_PSR] @ irqs are already disabled |
213 | msr spsr_cxsf, r0 | 216 | msr spsr_cxsf, r0 |
217 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
218 | tst r0, #PSR_I_BIT | ||
219 | bleq trace_hardirqs_on | ||
220 | #endif | ||
214 | ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr | 221 | ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr |
215 | 222 | ||
216 | .ltorg | 223 | .ltorg |
@@ -398,6 +405,9 @@ __dabt_usr: | |||
398 | __irq_usr: | 405 | __irq_usr: |
399 | usr_entry | 406 | usr_entry |
400 | 407 | ||
408 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
409 | bl trace_hardirqs_off | ||
410 | #endif | ||
401 | get_thread_info tsk | 411 | get_thread_info tsk |
402 | #ifdef CONFIG_PREEMPT | 412 | #ifdef CONFIG_PREEMPT |
403 | ldr r8, [tsk, #TI_PREEMPT] @ get preempt count | 413 | ldr r8, [tsk, #TI_PREEMPT] @ get preempt count |
@@ -412,6 +422,9 @@ __irq_usr: | |||
412 | teq r0, r7 | 422 | teq r0, r7 |
413 | strne r0, [r0, -r0] | 423 | strne r0, [r0, -r0] |
414 | #endif | 424 | #endif |
425 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
426 | bl trace_hardirqs_on | ||
427 | #endif | ||
415 | 428 | ||
416 | mov why, #0 | 429 | mov why, #0 |
417 | b ret_to_user | 430 | b ret_to_user |
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S index ac9eb3d30518..f359a189dcf2 100644 --- a/arch/arm/kernel/head-nommu.S +++ b/arch/arm/kernel/head-nommu.S | |||
@@ -9,7 +9,6 @@ | |||
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
10 | * | 10 | * |
11 | * Common kernel startup code (non-paged MM) | 11 | * Common kernel startup code (non-paged MM) |
12 | * for 32-bit CPUs which has a process ID register(CP15). | ||
13 | * | 12 | * |
14 | */ | 13 | */ |
15 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
@@ -40,7 +39,11 @@ | |||
40 | ENTRY(stext) | 39 | ENTRY(stext) |
41 | msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode | 40 | msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode |
42 | @ and irqs disabled | 41 | @ and irqs disabled |
42 | #ifndef CONFIG_CPU_CP15 | ||
43 | ldr r9, =CONFIG_PROCESSOR_ID | ||
44 | #else | ||
43 | mrc p15, 0, r9, c0, c0 @ get processor id | 45 | mrc p15, 0, r9, c0, c0 @ get processor id |
46 | #endif | ||
44 | bl __lookup_processor_type @ r5=procinfo r9=cpuid | 47 | bl __lookup_processor_type @ r5=procinfo r9=cpuid |
45 | movs r10, r5 @ invalid processor (r5=0)? | 48 | movs r10, r5 @ invalid processor (r5=0)? |
46 | beq __error_p @ yes, error 'p' | 49 | beq __error_p @ yes, error 'p' |
@@ -58,6 +61,7 @@ ENTRY(stext) | |||
58 | */ | 61 | */ |
59 | .type __after_proc_init, %function | 62 | .type __after_proc_init, %function |
60 | __after_proc_init: | 63 | __after_proc_init: |
64 | #ifdef CONFIG_CPU_CP15 | ||
61 | mrc p15, 0, r0, c1, c0, 0 @ read control reg | 65 | mrc p15, 0, r0, c1, c0, 0 @ read control reg |
62 | #ifdef CONFIG_ALIGNMENT_TRAP | 66 | #ifdef CONFIG_ALIGNMENT_TRAP |
63 | orr r0, r0, #CR_A | 67 | orr r0, r0, #CR_A |
@@ -73,7 +77,13 @@ __after_proc_init: | |||
73 | #ifdef CONFIG_CPU_ICACHE_DISABLE | 77 | #ifdef CONFIG_CPU_ICACHE_DISABLE |
74 | bic r0, r0, #CR_I | 78 | bic r0, r0, #CR_I |
75 | #endif | 79 | #endif |
80 | #ifdef CONFIG_CPU_HIGH_VECTOR | ||
81 | orr r0, r0, #CR_V | ||
82 | #else | ||
83 | bic r0, r0, #CR_V | ||
84 | #endif | ||
76 | mcr p15, 0, r0, c1, c0, 0 @ write control reg | 85 | mcr p15, 0, r0, c1, c0, 0 @ write control reg |
86 | #endif /* CONFIG_CPU_CP15 */ | ||
77 | 87 | ||
78 | mov pc, r13 @ clear the BSS and jump | 88 | mov pc, r13 @ clear the BSS and jump |
79 | @ to start_kernel | 89 | @ to start_kernel |
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 298363d97047..1b061583408e 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * linux/arch/arm/kernel/module.c | 2 | * linux/arch/arm/kernel/module.c |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Russell King. | 4 | * Copyright (C) 2002 Russell King. |
5 | * Modified for nommu by Hyok S. Choi | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
@@ -32,6 +33,7 @@ extern void _etext; | |||
32 | #define MODULE_START (((unsigned long)&_etext + ~PGDIR_MASK) & PGDIR_MASK) | 33 | #define MODULE_START (((unsigned long)&_etext + ~PGDIR_MASK) & PGDIR_MASK) |
33 | #endif | 34 | #endif |
34 | 35 | ||
36 | #ifdef CONFIG_MMU | ||
35 | void *module_alloc(unsigned long size) | 37 | void *module_alloc(unsigned long size) |
36 | { | 38 | { |
37 | struct vm_struct *area; | 39 | struct vm_struct *area; |
@@ -46,6 +48,12 @@ void *module_alloc(unsigned long size) | |||
46 | 48 | ||
47 | return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); | 49 | return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); |
48 | } | 50 | } |
51 | #else /* CONFIG_MMU */ | ||
52 | void *module_alloc(unsigned long size) | ||
53 | { | ||
54 | return size == 0 ? NULL : vmalloc(size); | ||
55 | } | ||
56 | #endif /* !CONFIG_MMU */ | ||
49 | 57 | ||
50 | void module_free(struct module *module, void *region) | 58 | void module_free(struct module *module, void *region) |
51 | { | 59 | { |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 3079535afccd..bf35c178a877 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -221,16 +221,26 @@ void __show_regs(struct pt_regs *regs) | |||
221 | processor_modes[processor_mode(regs)], | 221 | processor_modes[processor_mode(regs)], |
222 | thumb_mode(regs) ? " (T)" : "", | 222 | thumb_mode(regs) ? " (T)" : "", |
223 | get_fs() == get_ds() ? "kernel" : "user"); | 223 | get_fs() == get_ds() ? "kernel" : "user"); |
224 | #if CONFIG_CPU_CP15 | ||
224 | { | 225 | { |
225 | unsigned int ctrl, transbase, dac; | 226 | unsigned int ctrl; |
226 | __asm__ ( | 227 | __asm__ ( |
227 | " mrc p15, 0, %0, c1, c0\n" | 228 | " mrc p15, 0, %0, c1, c0\n" |
228 | " mrc p15, 0, %1, c2, c0\n" | 229 | : "=r" (ctrl)); |
229 | " mrc p15, 0, %2, c3, c0\n" | 230 | printk("Control: %04X\n", ctrl); |
230 | : "=r" (ctrl), "=r" (transbase), "=r" (dac)); | ||
231 | printk("Control: %04X Table: %08X DAC: %08X\n", | ||
232 | ctrl, transbase, dac); | ||
233 | } | 231 | } |
232 | #ifdef CONFIG_CPU_CP15_MMU | ||
233 | { | ||
234 | unsigned int transbase, dac; | ||
235 | __asm__ ( | ||
236 | " mrc p15, 0, %0, c2, c0\n" | ||
237 | " mrc p15, 0, %1, c3, c0\n" | ||
238 | : "=r" (transbase), "=r" (dac)); | ||
239 | printk("Table: %08X DAC: %08X\n", | ||
240 | transbase, dac); | ||
241 | } | ||
242 | #endif | ||
243 | #endif | ||
234 | } | 244 | } |
235 | 245 | ||
236 | void show_regs(struct pt_regs * regs) | 246 | void show_regs(struct pt_regs * regs) |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 09a67d771857..d4dceb5f06e9 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -69,10 +69,12 @@ EXPORT_SYMBOL(profile_pc); | |||
69 | */ | 69 | */ |
70 | int (*set_rtc)(void); | 70 | int (*set_rtc)(void); |
71 | 71 | ||
72 | #ifndef CONFIG_GENERIC_TIME | ||
72 | static unsigned long dummy_gettimeoffset(void) | 73 | static unsigned long dummy_gettimeoffset(void) |
73 | { | 74 | { |
74 | return 0; | 75 | return 0; |
75 | } | 76 | } |
77 | #endif | ||
76 | 78 | ||
77 | /* | 79 | /* |
78 | * Scheduler clock - returns current time in nanosec units. | 80 | * Scheduler clock - returns current time in nanosec units. |
@@ -230,6 +232,7 @@ static inline void do_leds(void) | |||
230 | #define do_leds() | 232 | #define do_leds() |
231 | #endif | 233 | #endif |
232 | 234 | ||
235 | #ifndef CONFIG_GENERIC_TIME | ||
233 | void do_gettimeofday(struct timeval *tv) | 236 | void do_gettimeofday(struct timeval *tv) |
234 | { | 237 | { |
235 | unsigned long flags; | 238 | unsigned long flags; |
@@ -291,6 +294,7 @@ int do_settimeofday(struct timespec *tv) | |||
291 | } | 294 | } |
292 | 295 | ||
293 | EXPORT_SYMBOL(do_settimeofday); | 296 | EXPORT_SYMBOL(do_settimeofday); |
297 | #endif /* !CONFIG_GENERIC_TIME */ | ||
294 | 298 | ||
295 | /** | 299 | /** |
296 | * save_time_delta - Save the offset between system time and RTC time | 300 | * save_time_delta - Save the offset between system time and RTC time |
@@ -500,8 +504,10 @@ device_initcall(timer_init_sysfs); | |||
500 | 504 | ||
501 | void __init time_init(void) | 505 | void __init time_init(void) |
502 | { | 506 | { |
507 | #ifndef CONFIG_GENERIC_TIME | ||
503 | if (system_timer->offset == NULL) | 508 | if (system_timer->offset == NULL) |
504 | system_timer->offset = dummy_gettimeoffset; | 509 | system_timer->offset = dummy_gettimeoffset; |
510 | #endif | ||
505 | system_timer->init(); | 511 | system_timer->init(); |
506 | 512 | ||
507 | #ifdef CONFIG_NO_IDLE_HZ | 513 | #ifdef CONFIG_NO_IDLE_HZ |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index aeeed806f991..bede380c07a9 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -191,7 +191,7 @@ void show_stack(struct task_struct *tsk, unsigned long *sp) | |||
191 | if (tsk != current) | 191 | if (tsk != current) |
192 | fp = thread_saved_fp(tsk); | 192 | fp = thread_saved_fp(tsk); |
193 | else | 193 | else |
194 | asm("mov%? %0, fp" : "=r" (fp)); | 194 | asm("mov %0, fp" : "=r" (fp) : : "cc"); |
195 | 195 | ||
196 | c_backtrace(fp, 0x10); | 196 | c_backtrace(fp, 0x10); |
197 | barrier(); | 197 | barrier(); |