aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv
diff options
context:
space:
mode:
Diffstat (limited to 'arch/frv')
-rw-r--r--arch/frv/kernel/Makefile2
-rw-r--r--arch/frv/kernel/frv_ksyms.c1
-rw-r--r--arch/frv/kernel/pm.c8
-rw-r--r--arch/frv/kernel/semaphore.c155
-rw-r--r--arch/frv/kernel/traps.c31
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.h2
-rw-r--r--arch/frv/mb93090-mb00/pci-vdk.c53
-rw-r--r--arch/frv/mm/highmem.c3
8 files changed, 17 insertions, 238 deletions
diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile
index e8f73ed28b52..c36f70b6699a 100644
--- a/arch/frv/kernel/Makefile
+++ b/arch/frv/kernel/Makefile
@@ -9,7 +9,7 @@ extra-y:= head.o init_task.o vmlinux.lds
9 9
10obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \ 10obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \
11 kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \ 11 kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \
12 sys_frv.o time.o semaphore.o setup.o frv_ksyms.o \ 12 sys_frv.o time.o setup.o frv_ksyms.o \
13 debug-stub.o irq.o sleep.o uaccess.o 13 debug-stub.o irq.o sleep.o uaccess.o
14 14
15obj-$(CONFIG_GDBSTUB) += gdb-stub.o gdb-io.o 15obj-$(CONFIG_GDBSTUB) += gdb-stub.o gdb-io.o
diff --git a/arch/frv/kernel/frv_ksyms.c b/arch/frv/kernel/frv_ksyms.c
index f772704b3d28..0316b3c50eff 100644
--- a/arch/frv/kernel/frv_ksyms.c
+++ b/arch/frv/kernel/frv_ksyms.c
@@ -12,7 +12,6 @@
12#include <asm/pgalloc.h> 12#include <asm/pgalloc.h>
13#include <asm/irq.h> 13#include <asm/irq.h>
14#include <asm/io.h> 14#include <asm/io.h>
15#include <asm/semaphore.h>
16#include <asm/checksum.h> 15#include <asm/checksum.h>
17#include <asm/hardirq.h> 16#include <asm/hardirq.h>
18#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index c57ce3f1f2e2..73f3aeefd203 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -163,14 +163,11 @@ static int sysctl_pm_do_suspend(ctl_table *ctl, int write, struct file *filp,
163 if ((mode != 1) && (mode != 5)) 163 if ((mode != 1) && (mode != 5))
164 return -EINVAL; 164 return -EINVAL;
165 165
166 retval = pm_send_all(PM_SUSPEND, (void *)3);
167
168 if (retval == 0) { 166 if (retval == 0) {
169 if (mode == 5) 167 if (mode == 5)
170 retval = pm_do_bus_sleep(); 168 retval = pm_do_bus_sleep();
171 else 169 else
172 retval = pm_do_suspend(); 170 retval = pm_do_suspend();
173 pm_send_all(PM_RESUME, (void *)0);
174 } 171 }
175 172
176 return retval; 173 return retval;
@@ -183,9 +180,6 @@ static int try_set_cmode(int new_cmode)
183 if (!(clock_cmodes_permitted & (1<<new_cmode))) 180 if (!(clock_cmodes_permitted & (1<<new_cmode)))
184 return -EINVAL; 181 return -EINVAL;
185 182
186 /* tell all the drivers we're suspending */
187 pm_send_all(PM_SUSPEND, (void *)3);
188
189 /* now change cmode */ 183 /* now change cmode */
190 local_irq_disable(); 184 local_irq_disable();
191 frv_dma_pause_all(); 185 frv_dma_pause_all();
@@ -201,8 +195,6 @@ static int try_set_cmode(int new_cmode)
201 frv_dma_resume_all(); 195 frv_dma_resume_all();
202 local_irq_enable(); 196 local_irq_enable();
203 197
204 /* tell all the drivers we're resuming */
205 pm_send_all(PM_RESUME, (void *)0);
206 return 0; 198 return 0;
207} 199}
208 200
diff --git a/arch/frv/kernel/semaphore.c b/arch/frv/kernel/semaphore.c
deleted file mode 100644
index 7ee3a147b471..000000000000
--- a/arch/frv/kernel/semaphore.c
+++ /dev/null
@@ -1,155 +0,0 @@
1/* semaphore.c: FR-V semaphores
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from lib/rwsem-spinlock.c
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/sched.h>
14#include <linux/module.h>
15#include <asm/semaphore.h>
16
17struct sem_waiter {
18 struct list_head list;
19 struct task_struct *task;
20};
21
22#ifdef CONFIG_DEBUG_SEMAPHORE
23void semtrace(struct semaphore *sem, const char *str)
24{
25 if (sem->debug)
26 printk("[%d] %s({%d,%d})\n",
27 current->pid,
28 str,
29 sem->counter,
30 list_empty(&sem->wait_list) ? 0 : 1);
31}
32#else
33#define semtrace(SEM,STR) do { } while(0)
34#endif
35
36/*
37 * wait for a token to be granted from a semaphore
38 * - entered with lock held and interrupts disabled
39 */
40void __down(struct semaphore *sem, unsigned long flags)
41{
42 struct task_struct *tsk = current;
43 struct sem_waiter waiter;
44
45 semtrace(sem, "Entering __down");
46
47 /* set up my own style of waitqueue */
48 waiter.task = tsk;
49 get_task_struct(tsk);
50
51 list_add_tail(&waiter.list, &sem->wait_list);
52
53 /* we don't need to touch the semaphore struct anymore */
54 spin_unlock_irqrestore(&sem->wait_lock, flags);
55
56 /* wait to be given the semaphore */
57 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
58
59 for (;;) {
60 if (list_empty(&waiter.list))
61 break;
62 schedule();
63 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
64 }
65
66 tsk->state = TASK_RUNNING;
67 semtrace(sem, "Leaving __down");
68}
69
70EXPORT_SYMBOL(__down);
71
72/*
73 * interruptibly wait for a token to be granted from a semaphore
74 * - entered with lock held and interrupts disabled
75 */
76int __down_interruptible(struct semaphore *sem, unsigned long flags)
77{
78 struct task_struct *tsk = current;
79 struct sem_waiter waiter;
80 int ret;
81
82 semtrace(sem,"Entering __down_interruptible");
83
84 /* set up my own style of waitqueue */
85 waiter.task = tsk;
86 get_task_struct(tsk);
87
88 list_add_tail(&waiter.list, &sem->wait_list);
89
90 /* we don't need to touch the semaphore struct anymore */
91 set_task_state(tsk, TASK_INTERRUPTIBLE);
92
93 spin_unlock_irqrestore(&sem->wait_lock, flags);
94
95 /* wait to be given the semaphore */
96 ret = 0;
97 for (;;) {
98 if (list_empty(&waiter.list))
99 break;
100 if (unlikely(signal_pending(current)))
101 goto interrupted;
102 schedule();
103 set_task_state(tsk, TASK_INTERRUPTIBLE);
104 }
105
106 out:
107 tsk->state = TASK_RUNNING;
108 semtrace(sem, "Leaving __down_interruptible");
109 return ret;
110
111 interrupted:
112 spin_lock_irqsave(&sem->wait_lock, flags);
113
114 if (!list_empty(&waiter.list)) {
115 list_del(&waiter.list);
116 ret = -EINTR;
117 }
118
119 spin_unlock_irqrestore(&sem->wait_lock, flags);
120 if (ret == -EINTR)
121 put_task_struct(current);
122 goto out;
123}
124
125EXPORT_SYMBOL(__down_interruptible);
126
127/*
128 * release a single token back to a semaphore
129 * - entered with lock held and interrupts disabled
130 */
131void __up(struct semaphore *sem)
132{
133 struct task_struct *tsk;
134 struct sem_waiter *waiter;
135
136 semtrace(sem,"Entering __up");
137
138 /* grant the token to the process at the front of the queue */
139 waiter = list_entry(sem->wait_list.next, struct sem_waiter, list);
140
141 /* We must be careful not to touch 'waiter' after we set ->task = NULL.
142 * It is allocated on the waiter's stack and may become invalid at
143 * any time after that point (due to a wakeup from another source).
144 */
145 list_del_init(&waiter->list);
146 tsk = waiter->task;
147 mb();
148 waiter->task = NULL;
149 wake_up_process(tsk);
150 put_task_struct(tsk);
151
152 semtrace(sem,"Leaving __up");
153}
154
155EXPORT_SYMBOL(__up);
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index 7089c2428b3f..a40df80b2ebd 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -49,7 +49,7 @@ asmlinkage void insn_access_error(unsigned long esfr1, unsigned long epcr0, unsi
49 info.si_signo = SIGSEGV; 49 info.si_signo = SIGSEGV;
50 info.si_code = SEGV_ACCERR; 50 info.si_code = SEGV_ACCERR;
51 info.si_errno = 0; 51 info.si_errno = 0;
52 info.si_addr = (void *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc); 52 info.si_addr = (void __user *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc);
53 53
54 force_sig_info(info.si_signo, &info, current); 54 force_sig_info(info.si_signo, &info, current);
55} /* end insn_access_error() */ 55} /* end insn_access_error() */
@@ -73,7 +73,7 @@ asmlinkage void illegal_instruction(unsigned long esfr1, unsigned long epcr0, un
73 epcr0, esr0, esfr1); 73 epcr0, esr0, esfr1);
74 74
75 info.si_errno = 0; 75 info.si_errno = 0;
76 info.si_addr = (void *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc); 76 info.si_addr = (void __user *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc);
77 77
78 switch (__frame->tbr & TBR_TT) { 78 switch (__frame->tbr & TBR_TT) {
79 case TBR_TT_ILLEGAL_INSTR: 79 case TBR_TT_ILLEGAL_INSTR:
@@ -111,7 +111,8 @@ asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
111 unsigned long esr0) 111 unsigned long esr0)
112{ 112{
113 static DEFINE_SPINLOCK(atomic_op_lock); 113 static DEFINE_SPINLOCK(atomic_op_lock);
114 unsigned long x, y, z, *p; 114 unsigned long x, y, z;
115 unsigned long __user *p;
115 mm_segment_t oldfs; 116 mm_segment_t oldfs;
116 siginfo_t info; 117 siginfo_t info;
117 int ret; 118 int ret;
@@ -128,7 +129,7 @@ asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
128 * u32 __atomic_user_cmpxchg32(u32 *ptr, u32 test, u32 new) 129 * u32 __atomic_user_cmpxchg32(u32 *ptr, u32 test, u32 new)
129 */ 130 */
130 case TBR_TT_ATOMIC_CMPXCHG32: 131 case TBR_TT_ATOMIC_CMPXCHG32:
131 p = (unsigned long *) __frame->gr8; 132 p = (unsigned long __user *) __frame->gr8;
132 x = __frame->gr9; 133 x = __frame->gr9;
133 y = __frame->gr10; 134 y = __frame->gr10;
134 135
@@ -158,7 +159,7 @@ asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
158 * u32 __atomic_kernel_xchg32(void *v, u32 new) 159 * u32 __atomic_kernel_xchg32(void *v, u32 new)
159 */ 160 */
160 case TBR_TT_ATOMIC_XCHG32: 161 case TBR_TT_ATOMIC_XCHG32:
161 p = (unsigned long *) __frame->gr8; 162 p = (unsigned long __user *) __frame->gr8;
162 y = __frame->gr9; 163 y = __frame->gr9;
163 164
164 for (;;) { 165 for (;;) {
@@ -181,7 +182,7 @@ asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
181 * ulong __atomic_kernel_XOR_return(ulong i, ulong *v) 182 * ulong __atomic_kernel_XOR_return(ulong i, ulong *v)
182 */ 183 */
183 case TBR_TT_ATOMIC_XOR: 184 case TBR_TT_ATOMIC_XOR:
184 p = (unsigned long *) __frame->gr8; 185 p = (unsigned long __user *) __frame->gr8;
185 x = __frame->gr9; 186 x = __frame->gr9;
186 187
187 for (;;) { 188 for (;;) {
@@ -205,7 +206,7 @@ asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
205 * ulong __atomic_kernel_OR_return(ulong i, ulong *v) 206 * ulong __atomic_kernel_OR_return(ulong i, ulong *v)
206 */ 207 */
207 case TBR_TT_ATOMIC_OR: 208 case TBR_TT_ATOMIC_OR:
208 p = (unsigned long *) __frame->gr8; 209 p = (unsigned long __user *) __frame->gr8;
209 x = __frame->gr9; 210 x = __frame->gr9;
210 211
211 for (;;) { 212 for (;;) {
@@ -229,7 +230,7 @@ asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
229 * ulong __atomic_kernel_AND_return(ulong i, ulong *v) 230 * ulong __atomic_kernel_AND_return(ulong i, ulong *v)
230 */ 231 */
231 case TBR_TT_ATOMIC_AND: 232 case TBR_TT_ATOMIC_AND:
232 p = (unsigned long *) __frame->gr8; 233 p = (unsigned long __user *) __frame->gr8;
233 x = __frame->gr9; 234 x = __frame->gr9;
234 235
235 for (;;) { 236 for (;;) {
@@ -253,7 +254,7 @@ asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
253 * int __atomic_user_sub_return(atomic_t *v, int i) 254 * int __atomic_user_sub_return(atomic_t *v, int i)
254 */ 255 */
255 case TBR_TT_ATOMIC_SUB: 256 case TBR_TT_ATOMIC_SUB:
256 p = (unsigned long *) __frame->gr8; 257 p = (unsigned long __user *) __frame->gr8;
257 x = __frame->gr9; 258 x = __frame->gr9;
258 259
259 for (;;) { 260 for (;;) {
@@ -277,7 +278,7 @@ asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
277 * int __atomic_user_add_return(atomic_t *v, int i) 278 * int __atomic_user_add_return(atomic_t *v, int i)
278 */ 279 */
279 case TBR_TT_ATOMIC_ADD: 280 case TBR_TT_ATOMIC_ADD:
280 p = (unsigned long *) __frame->gr8; 281 p = (unsigned long __user *) __frame->gr8;
281 x = __frame->gr9; 282 x = __frame->gr9;
282 283
283 for (;;) { 284 for (;;) {
@@ -322,7 +323,7 @@ error:
322 info.si_signo = SIGSEGV; 323 info.si_signo = SIGSEGV;
323 info.si_code = SEGV_ACCERR; 324 info.si_code = SEGV_ACCERR;
324 info.si_errno = 0; 325 info.si_errno = 0;
325 info.si_addr = (void *) __frame->pc; 326 info.si_addr = (void __user *) __frame->pc;
326 327
327 force_sig_info(info.si_signo, &info, current); 328 force_sig_info(info.si_signo, &info, current);
328} 329}
@@ -343,7 +344,7 @@ asmlinkage void media_exception(unsigned long msr0, unsigned long msr1)
343 info.si_signo = SIGFPE; 344 info.si_signo = SIGFPE;
344 info.si_code = FPE_MDAOVF; 345 info.si_code = FPE_MDAOVF;
345 info.si_errno = 0; 346 info.si_errno = 0;
346 info.si_addr = (void *) __frame->pc; 347 info.si_addr = (void __user *) __frame->pc;
347 348
348 force_sig_info(info.si_signo, &info, current); 349 force_sig_info(info.si_signo, &info, current);
349} /* end media_exception() */ 350} /* end media_exception() */
@@ -383,7 +384,7 @@ asmlinkage void memory_access_exception(unsigned long esr0,
383 info.si_addr = NULL; 384 info.si_addr = NULL;
384 385
385 if ((esr0 & (ESRx_VALID | ESR0_EAV)) == (ESRx_VALID | ESR0_EAV)) 386 if ((esr0 & (ESRx_VALID | ESR0_EAV)) == (ESRx_VALID | ESR0_EAV))
386 info.si_addr = (void *) ear0; 387 info.si_addr = (void __user *) ear0;
387 388
388 force_sig_info(info.si_signo, &info, current); 389 force_sig_info(info.si_signo, &info, current);
389 390
@@ -412,7 +413,7 @@ asmlinkage void data_access_error(unsigned long esfr1, unsigned long esr15, unsi
412 info.si_signo = SIGSEGV; 413 info.si_signo = SIGSEGV;
413 info.si_code = SEGV_ACCERR; 414 info.si_code = SEGV_ACCERR;
414 info.si_errno = 0; 415 info.si_errno = 0;
415 info.si_addr = (void *) 416 info.si_addr = (void __user *)
416 (((esr15 & (ESRx_VALID|ESR15_EAV)) == (ESRx_VALID|ESR15_EAV)) ? ear15 : 0); 417 (((esr15 & (ESRx_VALID|ESR15_EAV)) == (ESRx_VALID|ESR15_EAV)) ? ear15 : 0);
417 418
418 force_sig_info(info.si_signo, &info, current); 419 force_sig_info(info.si_signo, &info, current);
@@ -446,7 +447,7 @@ asmlinkage void division_exception(unsigned long esfr1, unsigned long esr0, unsi
446 info.si_signo = SIGFPE; 447 info.si_signo = SIGFPE;
447 info.si_code = FPE_INTDIV; 448 info.si_code = FPE_INTDIV;
448 info.si_errno = 0; 449 info.si_errno = 0;
449 info.si_addr = (void *) __frame->pc; 450 info.si_addr = (void __user *) __frame->pc;
450 451
451 force_sig_info(info.si_signo, &info, current); 452 force_sig_info(info.si_signo, &info, current);
452} /* end division_exception() */ 453} /* end division_exception() */
diff --git a/arch/frv/mb93090-mb00/pci-frv.h b/arch/frv/mb93090-mb00/pci-frv.h
index 7481797ab382..0c7bf39dc729 100644
--- a/arch/frv/mb93090-mb00/pci-frv.h
+++ b/arch/frv/mb93090-mb00/pci-frv.h
@@ -17,8 +17,6 @@
17#define PCI_PROBE_BIOS 0x0001 17#define PCI_PROBE_BIOS 0x0001
18#define PCI_PROBE_CONF1 0x0002 18#define PCI_PROBE_CONF1 0x0002
19#define PCI_PROBE_CONF2 0x0004 19#define PCI_PROBE_CONF2 0x0004
20#define PCI_NO_SORT 0x0100
21#define PCI_BIOS_SORT 0x0200
22#define PCI_NO_CHECKS 0x0400 20#define PCI_NO_CHECKS 0x0400
23#define PCI_ASSIGN_ROMS 0x1000 21#define PCI_ASSIGN_ROMS 0x1000
24#define PCI_BIOS_IRQ_SCAN 0x2000 22#define PCI_BIOS_IRQ_SCAN 0x2000
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index 6d51f133fb23..f003cfa68b7a 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -199,58 +199,6 @@ static struct pci_ops * __init pci_check_direct(void)
199} 199}
200 200
201/* 201/*
202 * Several buggy motherboards address only 16 devices and mirror
203 * them to next 16 IDs. We try to detect this `feature' on all
204 * primary buses (those containing host bridges as they are
205 * expected to be unique) and remove the ghost devices.
206 */
207
208static void __init pcibios_fixup_ghosts(struct pci_bus *b)
209{
210 struct list_head *ln, *mn;
211 struct pci_dev *d, *e;
212 int mirror = PCI_DEVFN(16,0);
213 int seen_host_bridge = 0;
214 int i;
215
216 for (ln=b->devices.next; ln != &b->devices; ln=ln->next) {
217 d = pci_dev_b(ln);
218 if ((d->class >> 8) == PCI_CLASS_BRIDGE_HOST)
219 seen_host_bridge++;
220 for (mn=ln->next; mn != &b->devices; mn=mn->next) {
221 e = pci_dev_b(mn);
222 if (e->devfn != d->devfn + mirror ||
223 e->vendor != d->vendor ||
224 e->device != d->device ||
225 e->class != d->class)
226 continue;
227 for(i=0; i<PCI_NUM_RESOURCES; i++)
228 if (e->resource[i].start != d->resource[i].start ||
229 e->resource[i].end != d->resource[i].end ||
230 e->resource[i].flags != d->resource[i].flags)
231 continue;
232 break;
233 }
234 if (mn == &b->devices)
235 return;
236 }
237 if (!seen_host_bridge)
238 return;
239 printk("PCI: Ignoring ghost devices on bus %02x\n", b->number);
240
241 ln = &b->devices;
242 while (ln->next != &b->devices) {
243 d = pci_dev_b(ln->next);
244 if (d->devfn >= mirror) {
245 list_del(&d->global_list);
246 list_del(&d->bus_list);
247 kfree(d);
248 } else
249 ln = ln->next;
250 }
251}
252
253/*
254 * Discover remaining PCI buses in case there are peer host bridges. 202 * Discover remaining PCI buses in case there are peer host bridges.
255 * We use the number of last PCI bus provided by the PCI BIOS. 203 * We use the number of last PCI bus provided by the PCI BIOS.
256 */ 204 */
@@ -356,7 +304,6 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
356#if 0 304#if 0
357 printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); 305 printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number);
358#endif 306#endif
359 pcibios_fixup_ghosts(bus);
360 pci_read_bridge_bases(bus); 307 pci_read_bridge_bases(bus);
361 308
362 if (bus->number == 0) { 309 if (bus->number == 0) {
diff --git a/arch/frv/mm/highmem.c b/arch/frv/mm/highmem.c
index 7f77db7fabc7..eadd07658075 100644
--- a/arch/frv/mm/highmem.c
+++ b/arch/frv/mm/highmem.c
@@ -36,6 +36,3 @@ struct page *kmap_atomic_to_page(void *ptr)
36{ 36{
37 return virt_to_page(ptr); 37 return virt_to_page(ptr);
38} 38}
39
40
41EXPORT_SYMBOL(kmap_atomic_to_page);