aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/atomic.h5
-rw-r--r--arch/mips/include/asm/byteorder.h52
-rw-r--r--arch/mips/include/asm/swab.h55
-rw-r--r--arch/mips/kernel/stacktrace.c24
-rw-r--r--arch/mips/kernel/vpe.c2
-rw-r--r--arch/mips/pci/pci-ip27.c6
-rw-r--r--arch/mips/pci/pci.c24
-rw-r--r--arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c2
9 files changed, 81 insertions, 90 deletions
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 7897f05e3165..023866c0c102 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -1,3 +1,4 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += cachectl.h sgidefs.h sysmips.h 3header-y += cachectl.h sgidefs.h sysmips.h
4header-y += swab.h
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 1232be3885b0..c996c3b4d074 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -15,13 +15,12 @@
15#define _ASM_ATOMIC_H 15#define _ASM_ATOMIC_H
16 16
17#include <linux/irqflags.h> 17#include <linux/irqflags.h>
18#include <linux/types.h>
18#include <asm/barrier.h> 19#include <asm/barrier.h>
19#include <asm/cpu-features.h> 20#include <asm/cpu-features.h>
20#include <asm/war.h> 21#include <asm/war.h>
21#include <asm/system.h> 22#include <asm/system.h>
22 23
23typedef struct { volatile int counter; } atomic_t;
24
25#define ATOMIC_INIT(i) { (i) } 24#define ATOMIC_INIT(i) { (i) }
26 25
27/* 26/*
@@ -404,8 +403,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
404 403
405#ifdef CONFIG_64BIT 404#ifdef CONFIG_64BIT
406 405
407typedef struct { volatile long counter; } atomic64_t;
408
409#define ATOMIC64_INIT(i) { (i) } 406#define ATOMIC64_INIT(i) { (i) }
410 407
411/* 408/*
diff --git a/arch/mips/include/asm/byteorder.h b/arch/mips/include/asm/byteorder.h
index 33790b9e0cc0..607b71830707 100644
--- a/arch/mips/include/asm/byteorder.h
+++ b/arch/mips/include/asm/byteorder.h
@@ -8,60 +8,14 @@
8#ifndef _ASM_BYTEORDER_H 8#ifndef _ASM_BYTEORDER_H
9#define _ASM_BYTEORDER_H 9#define _ASM_BYTEORDER_H
10 10
11#include <linux/compiler.h> 11#include <asm/swab.h>
12#include <asm/types.h>
13 12
14#if defined(__MIPSEB__) 13#if defined(__MIPSEB__)
15# define __BIG_ENDIAN 14#include <linux/byteorder/big_endian.h>
16#elif defined(__MIPSEL__) 15#elif defined(__MIPSEL__)
17# define __LITTLE_ENDIAN 16#include <linux/byteorder/little_endian.h>
18#else 17#else
19# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" 18# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
20#endif 19#endif
21 20
22#define __SWAB_64_THRU_32__
23
24#ifdef CONFIG_CPU_MIPSR2
25
26static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
27{
28 __asm__(
29 " wsbh %0, %1 \n"
30 : "=r" (x)
31 : "r" (x));
32
33 return x;
34}
35#define __arch_swab16 __arch_swab16
36
37static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
38{
39 __asm__(
40 " wsbh %0, %1 \n"
41 " rotr %0, %0, 16 \n"
42 : "=r" (x)
43 : "r" (x));
44
45 return x;
46}
47#define __arch_swab32 __arch_swab32
48
49#ifdef CONFIG_CPU_MIPS64_R2
50static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
51{
52 __asm__(
53 " dsbh %0, %1\n"
54 " dshd %0, %0"
55 : "=r" (x)
56 : "r" (x));
57
58 return x;
59}
60#define __arch_swab64 __arch_swab64
61#endif /* CONFIG_CPU_MIPS64_R2 */
62
63#endif /* CONFIG_CPU_MIPSR2 */
64
65#include <linux/byteorder.h>
66
67#endif /* _ASM_BYTEORDER_H */ 21#endif /* _ASM_BYTEORDER_H */
diff --git a/arch/mips/include/asm/swab.h b/arch/mips/include/asm/swab.h
new file mode 100644
index 000000000000..88f1f7d555cb
--- /dev/null
+++ b/arch/mips/include/asm/swab.h
@@ -0,0 +1,55 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 99, 2003 by Ralf Baechle
7 */
8#ifndef _ASM_SWAB_H
9#define _ASM_SWAB_H
10
11#include <linux/compiler.h>
12#include <asm/types.h>
13
14#define __SWAB_64_THRU_32__
15
16#ifdef CONFIG_CPU_MIPSR2
17
18static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
19{
20 __asm__(
21 " wsbh %0, %1 \n"
22 : "=r" (x)
23 : "r" (x));
24
25 return x;
26}
27#define __arch_swab16 __arch_swab16
28
29static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
30{
31 __asm__(
32 " wsbh %0, %1 \n"
33 " rotr %0, %0, 16 \n"
34 : "=r" (x)
35 : "r" (x));
36
37 return x;
38}
39#define __arch_swab32 __arch_swab32
40
41#ifdef CONFIG_CPU_MIPS64_R2
42static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
43{
44 __asm__(
45 " dsbh %0, %1\n"
46 " dshd %0, %0"
47 : "=r" (x)
48 : "r" (x));
49
50 return x;
51}
52#define __arch_swab64 __arch_swab64
53#endif /* CONFIG_CPU_MIPS64_R2 */
54#endif /* CONFIG_CPU_MIPSR2 */
55#endif /* _ASM_SWAB_H */
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
index 0632e2a849c0..58f5cd76c8c3 100644
--- a/arch/mips/kernel/stacktrace.c
+++ b/arch/mips/kernel/stacktrace.c
@@ -32,7 +32,8 @@ static void save_raw_context_stack(struct stack_trace *trace,
32 } 32 }
33} 33}
34 34
35static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs) 35static void save_context_stack(struct stack_trace *trace,
36 struct task_struct *tsk, struct pt_regs *regs)
36{ 37{
37 unsigned long sp = regs->regs[29]; 38 unsigned long sp = regs->regs[29];
38#ifdef CONFIG_KALLSYMS 39#ifdef CONFIG_KALLSYMS
@@ -41,7 +42,7 @@ static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs)
41 42
42 if (raw_show_trace || !__kernel_text_address(pc)) { 43 if (raw_show_trace || !__kernel_text_address(pc)) {
43 unsigned long stack_page = 44 unsigned long stack_page =
44 (unsigned long)task_stack_page(current); 45 (unsigned long)task_stack_page(tsk);
45 if (stack_page && sp >= stack_page && 46 if (stack_page && sp >= stack_page &&
46 sp <= stack_page + THREAD_SIZE - 32) 47 sp <= stack_page + THREAD_SIZE - 32)
47 save_raw_context_stack(trace, sp); 48 save_raw_context_stack(trace, sp);
@@ -54,7 +55,7 @@ static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs)
54 trace->entries[trace->nr_entries++] = pc; 55 trace->entries[trace->nr_entries++] = pc;
55 if (trace->nr_entries >= trace->max_entries) 56 if (trace->nr_entries >= trace->max_entries)
56 break; 57 break;
57 pc = unwind_stack(current, &sp, pc, &ra); 58 pc = unwind_stack(tsk, &sp, pc, &ra);
58 } while (pc); 59 } while (pc);
59#else 60#else
60 save_raw_context_stack(trace, sp); 61 save_raw_context_stack(trace, sp);
@@ -66,12 +67,23 @@ static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs)
66 */ 67 */
67void save_stack_trace(struct stack_trace *trace) 68void save_stack_trace(struct stack_trace *trace)
68{ 69{
70 save_stack_trace_tsk(current, trace);
71}
72EXPORT_SYMBOL_GPL(save_stack_trace);
73
74void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
75{
69 struct pt_regs dummyregs; 76 struct pt_regs dummyregs;
70 struct pt_regs *regs = &dummyregs; 77 struct pt_regs *regs = &dummyregs;
71 78
72 WARN_ON(trace->nr_entries || !trace->max_entries); 79 WARN_ON(trace->nr_entries || !trace->max_entries);
73 80
74 prepare_frametrace(regs); 81 if (tsk != current) {
75 save_context_stack(trace, regs); 82 regs->regs[29] = tsk->thread.reg29;
83 regs->regs[31] = 0;
84 regs->cp0_epc = tsk->thread.reg31;
85 } else
86 prepare_frametrace(regs);
87 save_context_stack(trace, tsk, regs);
76} 88}
77EXPORT_SYMBOL_GPL(save_stack_trace); 89EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 010b27e01f7b..3ca5f42e819d 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1454,7 +1454,7 @@ static int __init vpe_module_init(void)
1454 device_initialize(&vpe_device); 1454 device_initialize(&vpe_device);
1455 vpe_device.class = &vpe_class, 1455 vpe_device.class = &vpe_class,
1456 vpe_device.parent = NULL, 1456 vpe_device.parent = NULL,
1457 strlcpy(vpe_device.bus_id, "vpe1", BUS_ID_SIZE); 1457 dev_set_name(&vpe_device, "vpe1");
1458 vpe_device.devt = MKDEV(major, minor); 1458 vpe_device.devt = MKDEV(major, minor);
1459 err = device_add(&vpe_device); 1459 err = device_add(&vpe_device);
1460 if (err) { 1460 if (err) {
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index f97ab1461012..dda6f2058665 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -146,12 +146,6 @@ int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
146 return 0; 146 return 0;
147} 147}
148 148
149/* Most MIPS systems have straight-forward swizzling needs. */
150static inline u8 bridge_swizzle(u8 pin, u8 slot)
151{
152 return (((pin - 1) + slot) % 4) + 1;
153}
154
155static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev) 149static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev)
156{ 150{
157 while (dev->bus->parent) { 151 while (dev->bus->parent) {
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 62cae740e250..b0eb9e75c682 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -149,28 +149,6 @@ out:
149 "Skipping PCI bus scan due to resource conflict\n"); 149 "Skipping PCI bus scan due to resource conflict\n");
150} 150}
151 151
152/* Most MIPS systems have straight-forward swizzling needs. */
153
154static inline u8 bridge_swizzle(u8 pin, u8 slot)
155{
156 return (((pin - 1) + slot) % 4) + 1;
157}
158
159static u8 __init common_swizzle(struct pci_dev *dev, u8 *pinp)
160{
161 u8 pin = *pinp;
162
163 while (dev->bus->parent) {
164 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
165 /* Move up the chain of bridges. */
166 dev = dev->bus->self;
167 }
168 *pinp = pin;
169
170 /* The slot is the slot of the last bridge. */
171 return PCI_SLOT(dev->devfn);
172}
173
174static int __init pcibios_init(void) 152static int __init pcibios_init(void)
175{ 153{
176 struct pci_controller *hose; 154 struct pci_controller *hose;
@@ -179,7 +157,7 @@ static int __init pcibios_init(void)
179 for (hose = hose_head; hose; hose = hose->next) 157 for (hose = hose_head; hose; hose = hose->next)
180 pcibios_scanbus(hose); 158 pcibios_scanbus(hose);
181 159
182 pci_fixup_irqs(common_swizzle, pcibios_map_irq); 160 pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
183 161
184 pci_initialized = 1; 162 pci_initialized = 1;
185 163
diff --git a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
index 97862f45496d..caf5e9a0acc7 100644
--- a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
+++ b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
@@ -148,7 +148,7 @@ int read_eeprom(char *buffer, int eeprom_size, int size)
148 send_byte(W_HEADER); 148 send_byte(W_HEADER);
149 recv_ack(); 149 recv_ack();
150 150
151 /* EEPROM with size of more then 2K need two byte addressing */ 151 /* EEPROM with size of more than 2K need two byte addressing */
152 if (eeprom_size > 2048) { 152 if (eeprom_size > 2048) {
153 send_byte(0x00); 153 send_byte(0x00);
154 recv_ack(); 154 recv_ack();