aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/drivers/pci/ops-cayman.c9
-rw-r--r--arch/sh/drivers/pci/pci.c22
-rw-r--r--arch/sh/include/asm/Kbuild1
-rw-r--r--arch/sh/include/asm/atomic.h7
-rw-r--r--arch/sh/include/asm/byteorder.h62
-rw-r--r--arch/sh/include/asm/mmu.h1
-rw-r--r--arch/sh/include/asm/swab.h60
-rw-r--r--arch/sh/kernel/traps_32.c1
-rw-r--r--arch/sh/mm/init.c3
9 files changed, 73 insertions, 93 deletions
diff --git a/arch/sh/drivers/pci/ops-cayman.c b/arch/sh/drivers/pci/ops-cayman.c
index 5ccf9ea3a9de..38ef76207af6 100644
--- a/arch/sh/drivers/pci/ops-cayman.c
+++ b/arch/sh/drivers/pci/ops-cayman.c
@@ -5,11 +5,6 @@
5#include <cpu/irq.h> 5#include <cpu/irq.h>
6#include "pci-sh5.h" 6#include "pci-sh5.h"
7 7
8static inline u8 bridge_swizzle(u8 pin, u8 slot)
9{
10 return (((pin - 1) + slot) % 4) + 1;
11}
12
13int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) 8int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
14{ 9{
15 int result = -1; 10 int result = -1;
@@ -42,7 +37,7 @@ int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
42 while (dev->bus->number > 0) { 37 while (dev->bus->number > 0) {
43 38
44 slot = path[i].slot = PCI_SLOT(dev->devfn); 39 slot = path[i].slot = PCI_SLOT(dev->devfn);
45 pin = path[i].pin = bridge_swizzle(pin, slot); 40 pin = path[i].pin = pci_swizzle_interrupt_pin(dev, pin);
46 dev = dev->bus->self; 41 dev = dev->bus->self;
47 i++; 42 i++;
48 if (i > 3) panic("PCI path to root bus too long!\n"); 43 if (i > 3) panic("PCI path to root bus too long!\n");
@@ -56,7 +51,7 @@ int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
56 if ((slot < 3) || (i == 0)) { 51 if ((slot < 3) || (i == 0)) {
57 /* Bus 0 (incl. PCI-PCI bridge itself) : perform the final 52 /* Bus 0 (incl. PCI-PCI bridge itself) : perform the final
58 swizzle now. */ 53 swizzle now. */
59 result = IRQ_INTA + bridge_swizzle(pin, slot) - 1; 54 result = IRQ_INTA + pci_swizzle_interrupt_pin(dev, pin) - 1;
60 } else { 55 } else {
61 i--; 56 i--;
62 slot = path[i].slot; 57 slot = path[i].slot;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index d3839e609aac..e36c7b870861 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -21,26 +21,6 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24static inline u8 bridge_swizzle(u8 pin, u8 slot)
25{
26 return (((pin - 1) + slot) % 4) + 1;
27}
28
29static u8 __init simple_swizzle(struct pci_dev *dev, u8 *pinp)
30{
31 u8 pin = *pinp;
32
33 while (dev->bus->parent) {
34 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
35 /* Move up the chain of bridges. */
36 dev = dev->bus->self;
37 }
38 *pinp = pin;
39
40 /* The slot is the slot of the last bridge. */
41 return PCI_SLOT(dev->devfn);
42}
43
44static int __init pcibios_init(void) 24static int __init pcibios_init(void)
45{ 25{
46 struct pci_channel *p; 26 struct pci_channel *p;
@@ -61,7 +41,7 @@ static int __init pcibios_init(void)
61 busno = bus->subordinate + 1; 41 busno = bus->subordinate + 1;
62 } 42 }
63 43
64 pci_fixup_irqs(simple_swizzle, pcibios_map_platform_irq); 44 pci_fixup_irqs(pci_common_swizzle, pcibios_map_platform_irq);
65 45
66 return 0; 46 return 0;
67} 47}
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 43910cdf78a5..f1a2a0d1c79c 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -6,3 +6,4 @@ unifdef-y += unistd_32.h
6unifdef-y += unistd_64.h 6unifdef-y += unistd_64.h
7unifdef-y += posix_types_32.h 7unifdef-y += posix_types_32.h
8unifdef-y += posix_types_64.h 8unifdef-y += posix_types_64.h
9unifdef-y += swab.h
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h
index c043ef003028..6327ffbb1992 100644
--- a/arch/sh/include/asm/atomic.h
+++ b/arch/sh/include/asm/atomic.h
@@ -7,16 +7,15 @@
7 * 7 *
8 */ 8 */
9 9
10typedef struct { volatile int counter; } atomic_t; 10#include <linux/compiler.h>
11#include <linux/types.h>
12#include <asm/system.h>
11 13
12#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) 14#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
13 15
14#define atomic_read(v) ((v)->counter) 16#define atomic_read(v) ((v)->counter)
15#define atomic_set(v,i) ((v)->counter = (i)) 17#define atomic_set(v,i) ((v)->counter = (i))
16 18
17#include <linux/compiler.h>
18#include <asm/system.h>
19
20#if defined(CONFIG_GUSA_RB) 19#if defined(CONFIG_GUSA_RB)
21#include <asm/atomic-grb.h> 20#include <asm/atomic-grb.h>
22#elif defined(CONFIG_CPU_SH4A) 21#elif defined(CONFIG_CPU_SH4A)
diff --git a/arch/sh/include/asm/byteorder.h b/arch/sh/include/asm/byteorder.h
index f5fa0653ebc6..e95c41a5c8cc 100644
--- a/arch/sh/include/asm/byteorder.h
+++ b/arch/sh/include/asm/byteorder.h
@@ -1,68 +1,12 @@
1#ifndef __ASM_SH_BYTEORDER_H 1#ifndef __ASM_SH_BYTEORDER_H
2#define __ASM_SH_BYTEORDER_H 2#define __ASM_SH_BYTEORDER_H
3 3
4/* 4#include <asm/swab.h>
5 * Copyright (C) 1999 Niibe Yutaka
6 * Copyright (C) 2000, 2001 Paolo Alberelli
7 */
8#include <linux/compiler.h>
9#include <linux/types.h>
10 5
11#ifdef __LITTLE_ENDIAN__ 6#ifdef __LITTLE_ENDIAN__
12# define __LITTLE_ENDIAN 7#include <linux/byteorder/little_endian.h>
13#else 8#else
14# define __BIG_ENDIAN 9#include <linux/byteorder/big_endian.h>
15#endif 10#endif
16 11
17#define __SWAB_64_THRU_32__
18
19static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
20{
21 __asm__(
22#ifdef __SH5__
23 "byterev %0, %0\n\t"
24 "shari %0, 32, %0"
25#else
26 "swap.b %0, %0\n\t"
27 "swap.w %0, %0\n\t"
28 "swap.b %0, %0"
29#endif
30 : "=r" (x)
31 : "0" (x));
32
33 return x;
34}
35#define __arch_swab32 __arch_swab32
36
37static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
38{
39 __asm__(
40#ifdef __SH5__
41 "byterev %0, %0\n\t"
42 "shari %0, 32, %0"
43#else
44 "swap.b %0, %0"
45#endif
46 : "=r" (x)
47 : "0" (x));
48
49 return x;
50}
51#define __arch_swab16 __arch_swab16
52
53static inline __u64 __arch_swab64(__u64 val)
54{
55 union {
56 struct { __u32 a,b; } s;
57 __u64 u;
58 } v, w;
59 v.u = val;
60 w.s.b = __arch_swab32(v.s.a);
61 w.s.a = __arch_swab32(v.s.b);
62 return w.u;
63}
64#define __arch_swab64 __arch_swab64
65
66#include <linux/byteorder.h>
67
68#endif /* __ASM_SH_BYTEORDER_H */ 12#endif /* __ASM_SH_BYTEORDER_H */
diff --git a/arch/sh/include/asm/mmu.h b/arch/sh/include/asm/mmu.h
index fdcb93bc6d11..6c43625bb1a5 100644
--- a/arch/sh/include/asm/mmu.h
+++ b/arch/sh/include/asm/mmu.h
@@ -9,7 +9,6 @@ typedef struct {
9 mm_context_id_t id; 9 mm_context_id_t id;
10 void *vdso; 10 void *vdso;
11#else 11#else
12 struct vm_list_struct *vmlist;
13 unsigned long end_brk; 12 unsigned long end_brk;
14#endif 13#endif
15#ifdef CONFIG_BINFMT_ELF_FDPIC 14#ifdef CONFIG_BINFMT_ELF_FDPIC
diff --git a/arch/sh/include/asm/swab.h b/arch/sh/include/asm/swab.h
new file mode 100644
index 000000000000..e69315935107
--- /dev/null
+++ b/arch/sh/include/asm/swab.h
@@ -0,0 +1,60 @@
1#ifndef __ASM_SH_SWAB_H
2#define __ASM_SH_SWAB_H
3
4/*
5 * Copyright (C) 1999 Niibe Yutaka
6 * Copyright (C) 2000, 2001 Paolo Alberelli
7 */
8#include <linux/compiler.h>
9#include <linux/types.h>
10
11#define __SWAB_64_THRU_32__
12
13static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
14{
15 __asm__(
16#ifdef __SH5__
17 "byterev %0, %0\n\t"
18 "shari %0, 32, %0"
19#else
20 "swap.b %0, %0\n\t"
21 "swap.w %0, %0\n\t"
22 "swap.b %0, %0"
23#endif
24 : "=r" (x)
25 : "0" (x));
26
27 return x;
28}
29#define __arch_swab32 __arch_swab32
30
31static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
32{
33 __asm__(
34#ifdef __SH5__
35 "byterev %0, %0\n\t"
36 "shari %0, 32, %0"
37#else
38 "swap.b %0, %0"
39#endif
40 : "=r" (x)
41 : "0" (x));
42
43 return x;
44}
45#define __arch_swab16 __arch_swab16
46
47static inline __u64 __arch_swab64(__u64 val)
48{
49 union {
50 struct { __u32 a,b; } s;
51 __u64 u;
52 } v, w;
53 v.u = val;
54 w.s.b = __arch_swab32(v.s.a);
55 w.s.a = __arch_swab32(v.s.b);
56 return w.u;
57}
58#define __arch_swab64 __arch_swab64
59
60#endif /* __ASM_SH_SWAB_H */
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 88807a2aacc3..c0aa3d83ec0e 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -13,6 +13,7 @@
13 */ 13 */
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/ptrace.h> 15#include <linux/ptrace.h>
16#include <linux/hardirq.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/spinlock.h> 18#include <linux/spinlock.h>
18#include <linux/module.h> 19#include <linux/module.h>
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 6cbef8caeb56..3edf297c829b 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -311,7 +311,8 @@ int arch_add_memory(int nid, u64 start, u64 size)
311 pgdat = NODE_DATA(nid); 311 pgdat = NODE_DATA(nid);
312 312
313 /* We only have ZONE_NORMAL, so this is easy.. */ 313 /* We only have ZONE_NORMAL, so this is easy.. */
314 ret = __add_pages(pgdat->node_zones + ZONE_NORMAL, start_pfn, nr_pages); 314 ret = __add_pages(nid, pgdat->node_zones + ZONE_NORMAL,
315 start_pfn, nr_pages);
315 if (unlikely(ret)) 316 if (unlikely(ret))
316 printk("%s: Failed, __add_pages() == %d\n", __func__, ret); 317 printk("%s: Failed, __add_pages() == %d\n", __func__, ret);
317 318