aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2012-01-11 09:41:47 -0500
committerRalf Baechle <ralf@linux-mips.org>2012-01-11 09:41:47 -0500
commit39b741431af7f6f46b2e0e7f7f13ea2351fb4a5f (patch)
tree89355f4ae7bbb874537bb65f71ba0d19b3d468e1 /arch/mips
parent5b0ec2efb7d373faa7b1a7632c459b93895d45cd (diff)
parentd7a887a73dec6c387b02a966a71aac767bbd9ce6 (diff)
Merge branch 'next/generic' into mips-for-linux-next
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/alchemy/common/dbdma.c3
-rw-r--r--arch/mips/alchemy/common/time.c2
-rw-r--r--arch/mips/alchemy/devboards/db1200/platform.c4
-rw-r--r--arch/mips/cavium-octeon/setup.c8
-rw-r--r--arch/mips/dec/setup.c1
-rw-r--r--arch/mips/include/asm/bootinfo.h1
-rw-r--r--arch/mips/include/asm/gio_device.h56
-rw-r--r--arch/mips/include/asm/hugetlb.h2
-rw-r--r--arch/mips/include/asm/mach-generic/floppy.h2
-rw-r--r--arch/mips/include/asm/mach-jazz/floppy.h2
-rw-r--r--arch/mips/include/asm/page.h8
-rw-r--r--arch/mips/include/asm/pgtable-32.h12
-rw-r--r--arch/mips/jazz/irq.c2
-rw-r--r--arch/mips/kernel/cevt-bcm1480.c2
-rw-r--r--arch/mips/kernel/cevt-ds1287.c2
-rw-r--r--arch/mips/kernel/cevt-gt641xx.c2
-rw-r--r--arch/mips/kernel/cevt-r4k.c2
-rw-r--r--arch/mips/kernel/cevt-sb1250.c2
-rw-r--r--arch/mips/kernel/cevt-txx9.c2
-rw-r--r--arch/mips/kernel/i8253.c2
-rw-r--r--arch/mips/kernel/rtlx.c1
-rw-r--r--arch/mips/kernel/setup.c43
-rw-r--r--arch/mips/kernel/smtc.c2
-rw-r--r--arch/mips/lantiq/irq.c1
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_mfgpt.c2
-rw-r--r--arch/mips/mm/Makefile4
-rw-r--r--arch/mips/mm/gup.c315
-rw-r--r--arch/mips/mm/init.c9
-rw-r--r--arch/mips/mm/tlb-r4k.c67
-rw-r--r--arch/mips/mti-malta/malta-int.c4
-rw-r--r--arch/mips/pci/ops-pmcmsp.c2
-rw-r--r--arch/mips/pci/ops-tx3927.c2
-rw-r--r--arch/mips/pci/pci-tx4927.c2
-rw-r--r--arch/mips/pci/pci-tx4938.c2
-rw-r--r--arch/mips/pci/pci-tx4939.c2
-rw-r--r--arch/mips/pci/pci.c29
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c2
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_smp.c4
-rw-r--r--arch/mips/pnx8550/common/int.c4
-rw-r--r--arch/mips/pnx8550/common/time.c4
-rw-r--r--arch/mips/sgi-ip22/Makefile2
-rw-r--r--arch/mips/sgi-ip22/ip22-gio.c428
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c10
-rw-r--r--arch/mips/sgi-ip22/ip22-mc.c10
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c21
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c2
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c2
-rw-r--r--arch/mips/sni/irq.c2
-rw-r--r--arch/mips/sni/time.c2
-rw-r--r--arch/mips/txx9/generic/pci.c2
51 files changed, 946 insertions, 155 deletions
diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c
index 0e63ee487d6d..9ba407b4fc97 100644
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@ -1019,8 +1019,7 @@ static int __init dbdma_setup(unsigned int irq, dbdev_tab_t *idtable)
1019 dbdma_gptr->ddma_inten = 0xffff; 1019 dbdma_gptr->ddma_inten = 0xffff;
1020 au_sync(); 1020 au_sync();
1021 1021
1022 ret = request_irq(irq, dbdma_interrupt, IRQF_DISABLED, "dbdma", 1022 ret = request_irq(irq, dbdma_interrupt, 0, "dbdma", (void *)dbdma_gptr);
1023 (void *)dbdma_gptr);
1024 if (ret) 1023 if (ret)
1025 printk(KERN_ERR "Cannot grab DBDMA interrupt!\n"); 1024 printk(KERN_ERR "Cannot grab DBDMA interrupt!\n");
1026 else { 1025 else {
diff --git a/arch/mips/alchemy/common/time.c b/arch/mips/alchemy/common/time.c
index d5da6adbf634..146a5fa80360 100644
--- a/arch/mips/alchemy/common/time.c
+++ b/arch/mips/alchemy/common/time.c
@@ -92,7 +92,7 @@ static struct clock_event_device au1x_rtcmatch2_clockdev = {
92 92
93static struct irqaction au1x_rtcmatch2_irqaction = { 93static struct irqaction au1x_rtcmatch2_irqaction = {
94 .handler = au1x_rtcmatch2_irq, 94 .handler = au1x_rtcmatch2_irq,
95 .flags = IRQF_DISABLED | IRQF_TIMER, 95 .flags = IRQF_TIMER,
96 .name = "timer", 96 .name = "timer",
97 .dev_id = &au1x_rtcmatch2_clockdev, 97 .dev_id = &au1x_rtcmatch2_clockdev,
98}; 98};
diff --git a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200/platform.c
index c61867c93c4a..78459c17c628 100644
--- a/arch/mips/alchemy/devboards/db1200/platform.c
+++ b/arch/mips/alchemy/devboards/db1200/platform.c
@@ -276,12 +276,12 @@ static int db1200_mmc_cd_setup(void *mmc_host, int en)
276 276
277 if (en) { 277 if (en) {
278 ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd, 278 ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd,
279 IRQF_DISABLED, "sd_insert", mmc_host); 279 0, "sd_insert", mmc_host);
280 if (ret) 280 if (ret)
281 goto out; 281 goto out;
282 282
283 ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd, 283 ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd,
284 IRQF_DISABLED, "sd_eject", mmc_host); 284 0, "sd_eject", mmc_host);
285 if (ret) { 285 if (ret) {
286 free_irq(DB1200_SD0_INSERT_INT, mmc_host); 286 free_irq(DB1200_SD0_INSERT_INT, mmc_host);
287 goto out; 287 goto out;
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 853bac4f25b2..260b27367347 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -642,14 +642,6 @@ void __init plat_mem_setup(void)
642 642
643 total = 0; 643 total = 0;
644 644
645 /* First add the init memory we will be returning. */
646 memory = __pa_symbol(&__init_begin) & PAGE_MASK;
647 mem_alloc_size = (__pa_symbol(&__init_end) & PAGE_MASK) - memory;
648 if (mem_alloc_size > 0) {
649 add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM);
650 total += mem_alloc_size;
651 }
652
653 /* 645 /*
654 * The Mips memory init uses the first memory location for 646 * The Mips memory init uses the first memory location for
655 * some memory vectors. When SPARSEMEM is in use, it doesn't 647 * some memory vectors. When SPARSEMEM is in use, it doesn't
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
index f7b7ba6d5c45..b874accd878a 100644
--- a/arch/mips/dec/setup.c
+++ b/arch/mips/dec/setup.c
@@ -110,7 +110,6 @@ static struct irqaction fpuirq = {
110}; 110};
111 111
112static struct irqaction busirq = { 112static struct irqaction busirq = {
113 .flags = IRQF_DISABLED,
114 .name = "bus error", 113 .name = "bus error",
115 .flags = IRQF_NO_THREAD, 114 .flags = IRQF_NO_THREAD,
116}; 115};
diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index 35cd1bab69c3..7a51d879e6ca 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -86,6 +86,7 @@ extern unsigned long mips_machtype;
86#define BOOT_MEM_RAM 1 86#define BOOT_MEM_RAM 1
87#define BOOT_MEM_ROM_DATA 2 87#define BOOT_MEM_ROM_DATA 2
88#define BOOT_MEM_RESERVED 3 88#define BOOT_MEM_RESERVED 3
89#define BOOT_MEM_INIT_RAM 4
89 90
90/* 91/*
91 * A memory map that's built upon what was determined 92 * A memory map that's built upon what was determined
diff --git a/arch/mips/include/asm/gio_device.h b/arch/mips/include/asm/gio_device.h
new file mode 100644
index 000000000000..5437c84664bf
--- /dev/null
+++ b/arch/mips/include/asm/gio_device.h
@@ -0,0 +1,56 @@
1#include <linux/device.h>
2#include <linux/mod_devicetable.h>
3
4struct gio_device_id {
5 __u8 id;
6};
7
8struct gio_device {
9 struct device dev;
10 struct resource resource;
11 unsigned int irq;
12 unsigned int slotno;
13
14 const char *name;
15 struct gio_device_id id;
16 unsigned id32:1;
17 unsigned gio64:1;
18};
19#define to_gio_device(d) container_of(d, struct gio_device, dev)
20
21struct gio_driver {
22 const char *name;
23 struct module *owner;
24 const struct gio_device_id *id_table;
25
26 int (*probe)(struct gio_device *, const struct gio_device_id *);
27 void (*remove)(struct gio_device *);
28 int (*suspend)(struct gio_device *, pm_message_t);
29 int (*resume)(struct gio_device *);
30 void (*shutdown)(struct gio_device *);
31
32 struct device_driver driver;
33};
34#define to_gio_driver(drv) container_of(drv, struct gio_driver, driver)
35
36extern const struct gio_device_id *gio_match_device(const struct gio_device_id *,
37 const struct gio_device *);
38extern struct gio_device *gio_dev_get(struct gio_device *);
39extern void gio_dev_put(struct gio_device *);
40
41extern int gio_device_register(struct gio_device *);
42extern void gio_device_unregister(struct gio_device *);
43extern void gio_release_dev(struct device *);
44
45static inline void gio_device_free(struct gio_device *dev)
46{
47 gio_release_dev(&dev->dev);
48}
49
50extern int gio_register_driver(struct gio_driver *);
51extern void gio_unregister_driver(struct gio_driver *);
52
53#define gio_get_drvdata(_dev) drv_get_drvdata(&(_dev)->dev)
54#define gio_set_drvdata(_dev, data) drv_set_drvdata(&(_dev)->dev, (data))
55
56extern void gio_set_master(struct gio_device *);
diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h
index c565b7c3f0b5..58d36889f09b 100644
--- a/arch/mips/include/asm/hugetlb.h
+++ b/arch/mips/include/asm/hugetlb.h
@@ -70,7 +70,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
70static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, 70static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
71 unsigned long addr, pte_t *ptep) 71 unsigned long addr, pte_t *ptep)
72{ 72{
73 flush_tlb_mm(vma->vm_mm); 73 flush_tlb_page(vma, addr & huge_page_mask(hstate_vma(vma)));
74} 74}
75 75
76static inline int huge_pte_none(pte_t pte) 76static inline int huge_pte_none(pte_t pte)
diff --git a/arch/mips/include/asm/mach-generic/floppy.h b/arch/mips/include/asm/mach-generic/floppy.h
index 001a8ce17c17..a38f4d43e5e5 100644
--- a/arch/mips/include/asm/mach-generic/floppy.h
+++ b/arch/mips/include/asm/mach-generic/floppy.h
@@ -98,7 +98,7 @@ static inline void fd_disable_irq(void)
98static inline int fd_request_irq(void) 98static inline int fd_request_irq(void)
99{ 99{
100 return request_irq(FLOPPY_IRQ, floppy_interrupt, 100 return request_irq(FLOPPY_IRQ, floppy_interrupt,
101 IRQF_DISABLED, "floppy", NULL); 101 0, "floppy", NULL);
102} 102}
103 103
104static inline void fd_free_irq(void) 104static inline void fd_free_irq(void)
diff --git a/arch/mips/include/asm/mach-jazz/floppy.h b/arch/mips/include/asm/mach-jazz/floppy.h
index 56e9ca6ae426..88b5acb75145 100644
--- a/arch/mips/include/asm/mach-jazz/floppy.h
+++ b/arch/mips/include/asm/mach-jazz/floppy.h
@@ -90,7 +90,7 @@ static inline void fd_disable_irq(void)
90static inline int fd_request_irq(void) 90static inline int fd_request_irq(void)
91{ 91{
92 return request_irq(FLOPPY_IRQ, floppy_interrupt, 92 return request_irq(FLOPPY_IRQ, floppy_interrupt,
93 IRQF_DISABLED, "floppy", NULL); 93 0, "floppy", NULL);
94} 94}
95 95
96static inline void fd_free_irq(void) 96static inline void fd_free_irq(void)
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index e59cd1ac09c2..d41790928c64 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -38,6 +38,14 @@
38#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 38#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
39#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 39#define HPAGE_MASK (~(HPAGE_SIZE - 1))
40#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 40#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
41#else /* !CONFIG_HUGETLB_PAGE */
42# ifndef BUILD_BUG
43# define BUILD_BUG() do { extern void __build_bug(void); __build_bug(); } while (0)
44# endif
45#define HPAGE_SHIFT ({BUILD_BUG(); 0; })
46#define HPAGE_SIZE ({BUILD_BUG(); 0; })
47#define HPAGE_MASK ({BUILD_BUG(); 0; })
48#define HUGETLB_PAGE_ORDER ({BUILD_BUG(); 0; })
41#endif /* CONFIG_HUGETLB_PAGE */ 49#endif /* CONFIG_HUGETLB_PAGE */
42 50
43#ifndef __ASSEMBLY__ 51#ifndef __ASSEMBLY__
diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h
index 469390656c3f..5d56bb230345 100644
--- a/arch/mips/include/asm/pgtable-32.h
+++ b/arch/mips/include/asm/pgtable-32.h
@@ -19,17 +19,7 @@
19#include <asm-generic/pgtable-nopmd.h> 19#include <asm-generic/pgtable-nopmd.h>
20 20
21/* 21/*
22 * - add_temporary_entry() add a temporary TLB entry. We use TLB entries 22 * Basically we have the same two-level (which is the logical three level
23 * starting at the top and working down. This is for populating the
24 * TLB before trap_init() puts the TLB miss handler in place. It
25 * should be used only for entries matching the actual page tables,
26 * to prevent inconsistencies.
27 */
28extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
29 unsigned long entryhi, unsigned long pagemask);
30
31
32/* Basically we have the same two-level (which is the logical three level
33 * Linux page table layout folded) page tables as the i386. Some day 23 * Linux page table layout folded) page tables as the i386. Some day
34 * when we have proper page coloring support we can have a 1% quicker 24 * when we have proper page coloring support we can have a 1% quicker
35 * tlb refill handling mechanism, but for now it is a bit slower but 25 * tlb refill handling mechanism, but for now it is a bit slower but
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index 99ab86ffa4c0..f21868b28b24 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -134,7 +134,7 @@ static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id)
134 134
135static struct irqaction r4030_timer_irqaction = { 135static struct irqaction r4030_timer_irqaction = {
136 .handler = r4030_timer_interrupt, 136 .handler = r4030_timer_interrupt,
137 .flags = IRQF_DISABLED | IRQF_TIMER, 137 .flags = IRQF_TIMER,
138 .name = "R4030 timer", 138 .name = "R4030 timer",
139}; 139};
140 140
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c
index 36c3898b76db..69bbfae183bc 100644
--- a/arch/mips/kernel/cevt-bcm1480.c
+++ b/arch/mips/kernel/cevt-bcm1480.c
@@ -145,7 +145,7 @@ void __cpuinit sb1480_clockevent_init(void)
145 bcm1480_unmask_irq(cpu, irq); 145 bcm1480_unmask_irq(cpu, irq);
146 146
147 action->handler = sibyte_counter_handler; 147 action->handler = sibyte_counter_handler;
148 action->flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER; 148 action->flags = IRQF_PERCPU | IRQF_TIMER;
149 action->name = name; 149 action->name = name;
150 action->dev_id = cd; 150 action->dev_id = cd;
151 151
diff --git a/arch/mips/kernel/cevt-ds1287.c b/arch/mips/kernel/cevt-ds1287.c
index 939157e397b9..ed648cb5a69f 100644
--- a/arch/mips/kernel/cevt-ds1287.c
+++ b/arch/mips/kernel/cevt-ds1287.c
@@ -108,7 +108,7 @@ static irqreturn_t ds1287_interrupt(int irq, void *dev_id)
108 108
109static struct irqaction ds1287_irqaction = { 109static struct irqaction ds1287_irqaction = {
110 .handler = ds1287_interrupt, 110 .handler = ds1287_interrupt,
111 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, 111 .flags = IRQF_PERCPU | IRQF_TIMER,
112 .name = "ds1287", 112 .name = "ds1287",
113}; 113};
114 114
diff --git a/arch/mips/kernel/cevt-gt641xx.c b/arch/mips/kernel/cevt-gt641xx.c
index 339f3639b90e..831b47585b7c 100644
--- a/arch/mips/kernel/cevt-gt641xx.c
+++ b/arch/mips/kernel/cevt-gt641xx.c
@@ -114,7 +114,7 @@ static irqreturn_t gt641xx_timer0_interrupt(int irq, void *dev_id)
114 114
115static struct irqaction gt641xx_timer0_irqaction = { 115static struct irqaction gt641xx_timer0_irqaction = {
116 .handler = gt641xx_timer0_interrupt, 116 .handler = gt641xx_timer0_interrupt,
117 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, 117 .flags = IRQF_PERCPU | IRQF_TIMER,
118 .name = "gt641xx_timer0", 118 .name = "gt641xx_timer0",
119}; 119};
120 120
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index e2d8e199be32..51095dd9599d 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -84,7 +84,7 @@ out:
84 84
85struct irqaction c0_compare_irqaction = { 85struct irqaction c0_compare_irqaction = {
86 .handler = c0_compare_interrupt, 86 .handler = c0_compare_interrupt,
87 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, 87 .flags = IRQF_PERCPU | IRQF_TIMER,
88 .name = "timer", 88 .name = "timer",
89}; 89};
90 90
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c
index 590c54f28a81..e73439fd6850 100644
--- a/arch/mips/kernel/cevt-sb1250.c
+++ b/arch/mips/kernel/cevt-sb1250.c
@@ -144,7 +144,7 @@ void __cpuinit sb1250_clockevent_init(void)
144 sb1250_unmask_irq(cpu, irq); 144 sb1250_unmask_irq(cpu, irq);
145 145
146 action->handler = sibyte_counter_handler; 146 action->handler = sibyte_counter_handler;
147 action->flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER; 147 action->flags = IRQF_PERCPU | IRQF_TIMER;
148 action->name = name; 148 action->name = name;
149 action->dev_id = cd; 149 action->dev_id = cd;
150 150
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c
index f0ab92a1b057..e5c30b1d0860 100644
--- a/arch/mips/kernel/cevt-txx9.c
+++ b/arch/mips/kernel/cevt-txx9.c
@@ -146,7 +146,7 @@ static irqreturn_t txx9tmr_interrupt(int irq, void *dev_id)
146 146
147static struct irqaction txx9tmr_irq = { 147static struct irqaction txx9tmr_irq = {
148 .handler = txx9tmr_interrupt, 148 .handler = txx9tmr_interrupt,
149 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, 149 .flags = IRQF_PERCPU | IRQF_TIMER,
150 .name = "txx9tmr", 150 .name = "txx9tmr",
151 .dev_id = &txx9_clock_event_device, 151 .dev_id = &txx9_clock_event_device,
152}; 152};
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c
index 7047bff35ea5..c5bc344fc745 100644
--- a/arch/mips/kernel/i8253.c
+++ b/arch/mips/kernel/i8253.c
@@ -19,7 +19,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
19 19
20static struct irqaction irq0 = { 20static struct irqaction irq0 = {
21 .handler = timer_interrupt, 21 .handler = timer_interrupt,
22 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER, 22 .flags = IRQF_NOBALANCING | IRQF_TIMER,
23 .name = "timer" 23 .name = "timer"
24}; 24};
25 25
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 933166f44a6d..a9d801dec6b0 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -473,7 +473,6 @@ static const struct file_operations rtlx_fops = {
473 473
474static struct irqaction rtlx_irq = { 474static struct irqaction rtlx_irq = {
475 .handler = rtlx_interrupt, 475 .handler = rtlx_interrupt,
476 .flags = IRQF_DISABLED,
477 .name = "RTLX", 476 .name = "RTLX",
478}; 477};
479 478
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 84af26ab2212..e86c2cf554aa 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -121,6 +121,9 @@ static void __init print_memory_map(void)
121 case BOOT_MEM_RAM: 121 case BOOT_MEM_RAM:
122 printk(KERN_CONT "(usable)\n"); 122 printk(KERN_CONT "(usable)\n");
123 break; 123 break;
124 case BOOT_MEM_INIT_RAM:
125 printk(KERN_CONT "(usable after init)\n");
126 break;
124 case BOOT_MEM_ROM_DATA: 127 case BOOT_MEM_ROM_DATA:
125 printk(KERN_CONT "(ROM data)\n"); 128 printk(KERN_CONT "(ROM data)\n");
126 break; 129 break;
@@ -361,15 +364,24 @@ static void __init bootmem_init(void)
361 for (i = 0; i < boot_mem_map.nr_map; i++) { 364 for (i = 0; i < boot_mem_map.nr_map; i++) {
362 unsigned long start, end, size; 365 unsigned long start, end, size;
363 366
367 start = PFN_UP(boot_mem_map.map[i].addr);
368 end = PFN_DOWN(boot_mem_map.map[i].addr
369 + boot_mem_map.map[i].size);
370
364 /* 371 /*
365 * Reserve usable memory. 372 * Reserve usable memory.
366 */ 373 */
367 if (boot_mem_map.map[i].type != BOOT_MEM_RAM) 374 switch (boot_mem_map.map[i].type) {
375 case BOOT_MEM_RAM:
376 break;
377 case BOOT_MEM_INIT_RAM:
378 memory_present(0, start, end);
368 continue; 379 continue;
380 default:
381 /* Not usable memory */
382 continue;
383 }
369 384
370 start = PFN_UP(boot_mem_map.map[i].addr);
371 end = PFN_DOWN(boot_mem_map.map[i].addr
372 + boot_mem_map.map[i].size);
373 /* 385 /*
374 * We are rounding up the start address of usable memory 386 * We are rounding up the start address of usable memory
375 * and at the end of the usable range downwards. 387 * and at the end of the usable range downwards.
@@ -455,11 +467,33 @@ early_param("mem", early_parse_mem);
455 467
456static void __init arch_mem_init(char **cmdline_p) 468static void __init arch_mem_init(char **cmdline_p)
457{ 469{
470 phys_t init_mem, init_end, init_size;
471
458 extern void plat_mem_setup(void); 472 extern void plat_mem_setup(void);
459 473
460 /* call board setup routine */ 474 /* call board setup routine */
461 plat_mem_setup(); 475 plat_mem_setup();
462 476
477 init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT;
478 init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT;
479 init_size = init_end - init_mem;
480 if (init_size) {
481 /* Make sure it is in the boot_mem_map */
482 int i, found;
483 found = 0;
484 for (i = 0; i < boot_mem_map.nr_map; i++) {
485 if (init_mem >= boot_mem_map.map[i].addr &&
486 init_mem < (boot_mem_map.map[i].addr +
487 boot_mem_map.map[i].size)) {
488 found = 1;
489 break;
490 }
491 }
492 if (!found)
493 add_memory_region(init_mem, init_size,
494 BOOT_MEM_INIT_RAM);
495 }
496
463 pr_info("Determined physical RAM map:\n"); 497 pr_info("Determined physical RAM map:\n");
464 print_memory_map(); 498 print_memory_map();
465 499
@@ -523,6 +557,7 @@ static void __init resource_init(void)
523 res = alloc_bootmem(sizeof(struct resource)); 557 res = alloc_bootmem(sizeof(struct resource));
524 switch (boot_mem_map.map[i].type) { 558 switch (boot_mem_map.map[i].type) {
525 case BOOT_MEM_RAM: 559 case BOOT_MEM_RAM:
560 case BOOT_MEM_INIT_RAM:
526 case BOOT_MEM_ROM_DATA: 561 case BOOT_MEM_ROM_DATA:
527 res->name = "System RAM"; 562 res->name = "System RAM";
528 break; 563 break;
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index b1eea63cc988..0a42ff3ff6a1 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -1130,7 +1130,7 @@ static void ipi_irq_dispatch(void)
1130 1130
1131static struct irqaction irq_ipi = { 1131static struct irqaction irq_ipi = {
1132 .handler = ipi_interrupt, 1132 .handler = ipi_interrupt,
1133 .flags = IRQF_DISABLED | IRQF_PERCPU, 1133 .flags = IRQF_PERCPU,
1134 .name = "SMTC_IPI" 1134 .name = "SMTC_IPI"
1135}; 1135};
1136 1136
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index 51fa0a4ba556..d673731c538a 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -240,7 +240,6 @@ out:
240 240
241static struct irqaction cascade = { 241static struct irqaction cascade = {
242 .handler = no_action, 242 .handler = no_action,
243 .flags = IRQF_DISABLED,
244 .name = "cascade", 243 .name = "cascade",
245}; 244};
246 245
diff --git a/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c b/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
index 0cb1b9760e34..5d1f48fa1a52 100644
--- a/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
+++ b/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
@@ -111,7 +111,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
111 111
112static struct irqaction irq5 = { 112static struct irqaction irq5 = {
113 .handler = timer_interrupt, 113 .handler = timer_interrupt,
114 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER, 114 .flags = IRQF_NOBALANCING | IRQF_TIMER,
115 .name = "timer" 115 .name = "timer"
116}; 116};
117 117
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
index 4d8c1623eee2..3ca2a065cf76 100644
--- a/arch/mips/mm/Makefile
+++ b/arch/mips/mm/Makefile
@@ -3,8 +3,8 @@
3# 3#
4 4
5obj-y += cache.o dma-default.o extable.o fault.o \ 5obj-y += cache.o dma-default.o extable.o fault.o \
6 init.o mmap.o tlbex.o tlbex-fault.o uasm.o \ 6 gup.o init.o mmap.o page.o tlbex.o \
7 page.o 7 tlbex-fault.o uasm.o
8 8
9obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o 9obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o
10obj-$(CONFIG_64BIT) += pgtable-64.o 10obj-$(CONFIG_64BIT) += pgtable-64.o
diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c
new file mode 100644
index 000000000000..33aadbcf170b
--- /dev/null
+++ b/arch/mips/mm/gup.c
@@ -0,0 +1,315 @@
1/*
2 * Lockless get_user_pages_fast for MIPS
3 *
4 * Copyright (C) 2008 Nick Piggin
5 * Copyright (C) 2008 Novell Inc.
6 * Copyright (C) 2011 Ralf Baechle
7 */
8#include <linux/sched.h>
9#include <linux/mm.h>
10#include <linux/vmstat.h>
11#include <linux/highmem.h>
12#include <linux/swap.h>
13#include <linux/hugetlb.h>
14
15#include <asm/pgtable.h>
16
17static inline pte_t gup_get_pte(pte_t *ptep)
18{
19#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
20 pte_t pte;
21
22retry:
23 pte.pte_low = ptep->pte_low;
24 smp_rmb();
25 pte.pte_high = ptep->pte_high;
26 smp_rmb();
27 if (unlikely(pte.pte_low != ptep->pte_low))
28 goto retry;
29
30 return pte;
31#else
32 return ACCESS_ONCE(*ptep);
33#endif
34}
35
36static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
37 int write, struct page **pages, int *nr)
38{
39 pte_t *ptep = pte_offset_map(&pmd, addr);
40 do {
41 pte_t pte = gup_get_pte(ptep);
42 struct page *page;
43
44 if (!pte_present(pte) ||
45 pte_special(pte) || (write && !pte_write(pte))) {
46 pte_unmap(ptep);
47 return 0;
48 }
49 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
50 page = pte_page(pte);
51 get_page(page);
52 SetPageReferenced(page);
53 pages[*nr] = page;
54 (*nr)++;
55
56 } while (ptep++, addr += PAGE_SIZE, addr != end);
57
58 pte_unmap(ptep - 1);
59 return 1;
60}
61
62static inline void get_head_page_multiple(struct page *page, int nr)
63{
64 VM_BUG_ON(page != compound_head(page));
65 VM_BUG_ON(page_count(page) == 0);
66 atomic_add(nr, &page->_count);
67 SetPageReferenced(page);
68}
69
70static int gup_huge_pmd(pmd_t pmd, unsigned long addr, unsigned long end,
71 int write, struct page **pages, int *nr)
72{
73 pte_t pte = *(pte_t *)&pmd;
74 struct page *head, *page;
75 int refs;
76
77 if (write && !pte_write(pte))
78 return 0;
79 /* hugepages are never "special" */
80 VM_BUG_ON(pte_special(pte));
81 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
82
83 refs = 0;
84 head = pte_page(pte);
85 page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
86 do {
87 VM_BUG_ON(compound_head(page) != head);
88 pages[*nr] = page;
89 if (PageTail(page))
90 get_huge_page_tail(page);
91 (*nr)++;
92 page++;
93 refs++;
94 } while (addr += PAGE_SIZE, addr != end);
95
96 get_head_page_multiple(head, refs);
97 return 1;
98}
99
100static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
101 int write, struct page **pages, int *nr)
102{
103 unsigned long next;
104 pmd_t *pmdp;
105
106 pmdp = pmd_offset(&pud, addr);
107 do {
108 pmd_t pmd = *pmdp;
109
110 next = pmd_addr_end(addr, end);
111 /*
112 * The pmd_trans_splitting() check below explains why
113 * pmdp_splitting_flush has to flush the tlb, to stop
114 * this gup-fast code from running while we set the
115 * splitting bit in the pmd. Returning zero will take
116 * the slow path that will call wait_split_huge_page()
117 * if the pmd is still in splitting state. gup-fast
118 * can't because it has irq disabled and
119 * wait_split_huge_page() would never return as the
120 * tlb flush IPI wouldn't run.
121 */
122 if (pmd_none(pmd) || pmd_trans_splitting(pmd))
123 return 0;
124 if (unlikely(pmd_huge(pmd))) {
125 if (!gup_huge_pmd(pmd, addr, next, write, pages,nr))
126 return 0;
127 } else {
128 if (!gup_pte_range(pmd, addr, next, write, pages,nr))
129 return 0;
130 }
131 } while (pmdp++, addr = next, addr != end);
132
133 return 1;
134}
135
136static int gup_huge_pud(pud_t pud, unsigned long addr, unsigned long end,
137 int write, struct page **pages, int *nr)
138{
139 pte_t pte = *(pte_t *)&pud;
140 struct page *head, *page;
141 int refs;
142
143 if (write && !pte_write(pte))
144 return 0;
145 /* hugepages are never "special" */
146 VM_BUG_ON(pte_special(pte));
147 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
148
149 refs = 0;
150 head = pte_page(pte);
151 page = head + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
152 do {
153 VM_BUG_ON(compound_head(page) != head);
154 pages[*nr] = page;
155 (*nr)++;
156 page++;
157 refs++;
158 } while (addr += PAGE_SIZE, addr != end);
159
160 get_head_page_multiple(head, refs);
161 return 1;
162}
163
164static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
165 int write, struct page **pages, int *nr)
166{
167 unsigned long next;
168 pud_t *pudp;
169
170 pudp = pud_offset(&pgd, addr);
171 do {
172 pud_t pud = *pudp;
173
174 next = pud_addr_end(addr, end);
175 if (pud_none(pud))
176 return 0;
177 if (unlikely(pud_huge(pud))) {
178 if (!gup_huge_pud(pud, addr, next, write, pages,nr))
179 return 0;
180 } else {
181 if (!gup_pmd_range(pud, addr, next, write, pages,nr))
182 return 0;
183 }
184 } while (pudp++, addr = next, addr != end);
185
186 return 1;
187}
188
189/*
190 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
191 * back to the regular GUP.
192 */
193int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
194 struct page **pages)
195{
196 struct mm_struct *mm = current->mm;
197 unsigned long addr, len, end;
198 unsigned long next;
199 unsigned long flags;
200 pgd_t *pgdp;
201 int nr = 0;
202
203 start &= PAGE_MASK;
204 addr = start;
205 len = (unsigned long) nr_pages << PAGE_SHIFT;
206 end = start + len;
207 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
208 (void __user *)start, len)))
209 return 0;
210
211 /*
212 * XXX: batch / limit 'nr', to avoid large irq off latency
213 * needs some instrumenting to determine the common sizes used by
214 * important workloads (eg. DB2), and whether limiting the batch
215 * size will decrease performance.
216 *
217 * It seems like we're in the clear for the moment. Direct-IO is
218 * the main guy that batches up lots of get_user_pages, and even
219 * they are limited to 64-at-a-time which is not so many.
220 */
221 /*
222 * This doesn't prevent pagetable teardown, but does prevent
223 * the pagetables and pages from being freed.
224 *
225 * So long as we atomically load page table pointers versus teardown,
226 * we can follow the address down to the page and take a ref on it.
227 */
228 local_irq_save(flags);
229 pgdp = pgd_offset(mm, addr);
230 do {
231 pgd_t pgd = *pgdp;
232
233 next = pgd_addr_end(addr, end);
234 if (pgd_none(pgd))
235 break;
236 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
237 break;
238 } while (pgdp++, addr = next, addr != end);
239 local_irq_restore(flags);
240
241 return nr;
242}
243
244/**
245 * get_user_pages_fast() - pin user pages in memory
246 * @start: starting user address
247 * @nr_pages: number of pages from start to pin
248 * @write: whether pages will be written to
249 * @pages: array that receives pointers to the pages pinned.
250 * Should be at least nr_pages long.
251 *
252 * Attempt to pin user pages in memory without taking mm->mmap_sem.
253 * If not successful, it will fall back to taking the lock and
254 * calling get_user_pages().
255 *
256 * Returns number of pages pinned. This may be fewer than the number
257 * requested. If nr_pages is 0 or negative, returns 0. If no pages
258 * were pinned, returns -errno.
259 */
260int get_user_pages_fast(unsigned long start, int nr_pages, int write,
261 struct page **pages)
262{
263 struct mm_struct *mm = current->mm;
264 unsigned long addr, len, end;
265 unsigned long next;
266 pgd_t *pgdp;
267 int ret, nr = 0;
268
269 start &= PAGE_MASK;
270 addr = start;
271 len = (unsigned long) nr_pages << PAGE_SHIFT;
272
273 end = start + len;
274 if (end < start)
275 goto slow_irqon;
276
277 /* XXX: batch / limit 'nr' */
278 local_irq_disable();
279 pgdp = pgd_offset(mm, addr);
280 do {
281 pgd_t pgd = *pgdp;
282
283 next = pgd_addr_end(addr, end);
284 if (pgd_none(pgd))
285 goto slow;
286 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
287 goto slow;
288 } while (pgdp++, addr = next, addr != end);
289 local_irq_enable();
290
291 VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT);
292 return nr;
293slow:
294 local_irq_enable();
295
296slow_irqon:
297 /* Try to get the remaining pages with get_user_pages */
298 start += nr << PAGE_SHIFT;
299 pages += nr;
300
301 down_read(&mm->mmap_sem);
302 ret = get_user_pages(current, mm, start,
303 (end - start) >> PAGE_SHIFT,
304 write, 0, pages, NULL);
305 up_read(&mm->mmap_sem);
306
307 /* Have to be a bit careful with return values */
308 if (nr > 0) {
309 if (ret < 0)
310 ret = nr;
311 else
312 ret += nr;
313 }
314 return ret;
315}
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index b7ebc4fa89bc..3b3ffd439cd7 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -304,9 +304,14 @@ int page_is_ram(unsigned long pagenr)
304 for (i = 0; i < boot_mem_map.nr_map; i++) { 304 for (i = 0; i < boot_mem_map.nr_map; i++) {
305 unsigned long addr, end; 305 unsigned long addr, end;
306 306
307 if (boot_mem_map.map[i].type != BOOT_MEM_RAM) 307 switch (boot_mem_map.map[i].type) {
308 case BOOT_MEM_RAM:
309 case BOOT_MEM_INIT_RAM:
310 break;
311 default:
308 /* not usable memory */ 312 /* not usable memory */
309 continue; 313 continue;
314 }
310 315
311 addr = PFN_UP(boot_mem_map.map[i].addr); 316 addr = PFN_UP(boot_mem_map.map[i].addr);
312 end = PFN_DOWN(boot_mem_map.map[i].addr + 317 end = PFN_DOWN(boot_mem_map.map[i].addr +
@@ -379,7 +384,7 @@ void __init mem_init(void)
379 384
380 reservedpages = ram = 0; 385 reservedpages = ram = 0;
381 for (tmp = 0; tmp < max_low_pfn; tmp++) 386 for (tmp = 0; tmp < max_low_pfn; tmp++)
382 if (page_is_ram(tmp)) { 387 if (page_is_ram(tmp) && pfn_valid(tmp)) {
383 ram++; 388 ram++;
384 if (PageReserved(pfn_to_page(tmp))) 389 if (PageReserved(pfn_to_page(tmp)))
385 reservedpages++; 390 reservedpages++;
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index d163455552b0..2dc625346c40 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -121,22 +121,30 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
121 121
122 if (cpu_context(cpu, mm) != 0) { 122 if (cpu_context(cpu, mm) != 0) {
123 unsigned long size, flags; 123 unsigned long size, flags;
124 int huge = is_vm_hugetlb_page(vma);
124 125
125 ENTER_CRITICAL(flags); 126 ENTER_CRITICAL(flags);
126 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 127 if (huge) {
127 size = (size + 1) >> 1; 128 start = round_down(start, HPAGE_SIZE);
129 end = round_up(end, HPAGE_SIZE);
130 size = (end - start) >> HPAGE_SHIFT;
131 } else {
132 start = round_down(start, PAGE_SIZE << 1);
133 end = round_up(end, PAGE_SIZE << 1);
134 size = (end - start) >> (PAGE_SHIFT + 1);
135 }
128 if (size <= current_cpu_data.tlbsize/2) { 136 if (size <= current_cpu_data.tlbsize/2) {
129 int oldpid = read_c0_entryhi(); 137 int oldpid = read_c0_entryhi();
130 int newpid = cpu_asid(cpu, mm); 138 int newpid = cpu_asid(cpu, mm);
131 139
132 start &= (PAGE_MASK << 1);
133 end += ((PAGE_SIZE << 1) - 1);
134 end &= (PAGE_MASK << 1);
135 while (start < end) { 140 while (start < end) {
136 int idx; 141 int idx;
137 142
138 write_c0_entryhi(start | newpid); 143 write_c0_entryhi(start | newpid);
139 start += (PAGE_SIZE << 1); 144 if (huge)
145 start += HPAGE_SIZE;
146 else
147 start += (PAGE_SIZE << 1);
140 mtc0_tlbw_hazard(); 148 mtc0_tlbw_hazard();
141 tlb_probe(); 149 tlb_probe();
142 tlb_probe_hazard(); 150 tlb_probe_hazard();
@@ -369,51 +377,6 @@ void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
369 EXIT_CRITICAL(flags); 377 EXIT_CRITICAL(flags);
370} 378}
371 379
372/*
373 * Used for loading TLB entries before trap_init() has started, when we
374 * don't actually want to add a wired entry which remains throughout the
375 * lifetime of the system
376 */
377
378static int temp_tlb_entry __cpuinitdata;
379
380__init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
381 unsigned long entryhi, unsigned long pagemask)
382{
383 int ret = 0;
384 unsigned long flags;
385 unsigned long wired;
386 unsigned long old_pagemask;
387 unsigned long old_ctx;
388
389 ENTER_CRITICAL(flags);
390 /* Save old context and create impossible VPN2 value */
391 old_ctx = read_c0_entryhi();
392 old_pagemask = read_c0_pagemask();
393 wired = read_c0_wired();
394 if (--temp_tlb_entry < wired) {
395 printk(KERN_WARNING
396 "No TLB space left for add_temporary_entry\n");
397 ret = -ENOSPC;
398 goto out;
399 }
400
401 write_c0_index(temp_tlb_entry);
402 write_c0_pagemask(pagemask);
403 write_c0_entryhi(entryhi);
404 write_c0_entrylo0(entrylo0);
405 write_c0_entrylo1(entrylo1);
406 mtc0_tlbw_hazard();
407 tlb_write_indexed();
408 tlbw_use_hazard();
409
410 write_c0_entryhi(old_ctx);
411 write_c0_pagemask(old_pagemask);
412out:
413 EXIT_CRITICAL(flags);
414 return ret;
415}
416
417static int __cpuinitdata ntlb; 380static int __cpuinitdata ntlb;
418static int __init set_ntlb(char *str) 381static int __init set_ntlb(char *str)
419{ 382{
@@ -451,8 +414,6 @@ void __cpuinit tlb_init(void)
451 write_c0_pagegrain(pg); 414 write_c0_pagegrain(pg);
452 } 415 }
453 416
454 temp_tlb_entry = current_cpu_data.tlbsize - 1;
455
456 /* From this point on the ARC firmware is dead. */ 417 /* From this point on the ARC firmware is dead. */
457 local_flush_tlb_all(); 418 local_flush_tlb_all();
458 419
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index d53ff91b277c..a588b5cef8d2 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -322,13 +322,13 @@ static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
322 322
323static struct irqaction irq_resched = { 323static struct irqaction irq_resched = {
324 .handler = ipi_resched_interrupt, 324 .handler = ipi_resched_interrupt,
325 .flags = IRQF_DISABLED|IRQF_PERCPU, 325 .flags = IRQF_PERCPU,
326 .name = "IPI_resched" 326 .name = "IPI_resched"
327}; 327};
328 328
329static struct irqaction irq_call = { 329static struct irqaction irq_call = {
330 .handler = ipi_call_interrupt, 330 .handler = ipi_call_interrupt,
331 .flags = IRQF_DISABLED|IRQF_PERCPU, 331 .flags = IRQF_PERCPU,
332 .name = "IPI_call" 332 .name = "IPI_call"
333}; 333};
334#endif /* CONFIG_MIPS_MT_SMP */ 334#endif /* CONFIG_MIPS_MT_SMP */
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index 8fbfbf2b931c..389bf669d56e 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -405,7 +405,7 @@ int msp_pcibios_config_access(unsigned char access_type,
405 if (pciirqflag == 0) { 405 if (pciirqflag == 0) {
406 ret = request_irq(MSP_INT_PCI,/* Hardcoded internal MSP7120 wiring */ 406 ret = request_irq(MSP_INT_PCI,/* Hardcoded internal MSP7120 wiring */
407 bpci_interrupt, 407 bpci_interrupt,
408 IRQF_SHARED | IRQF_DISABLED, 408 IRQF_SHARED,
409 "PMC MSP PCI Host", 409 "PMC MSP PCI Host",
410 preg); 410 preg);
411 if (ret != 0) 411 if (ret != 0)
diff --git a/arch/mips/pci/ops-tx3927.c b/arch/mips/pci/ops-tx3927.c
index 6a3bdb5ffa80..02d64f77e967 100644
--- a/arch/mips/pci/ops-tx3927.c
+++ b/arch/mips/pci/ops-tx3927.c
@@ -225,7 +225,7 @@ void __init tx3927_setup_pcierr_irq(void)
225{ 225{
226 if (request_irq(TXX9_IRQ_BASE + TX3927_IR_PCI, 226 if (request_irq(TXX9_IRQ_BASE + TX3927_IR_PCI,
227 tx3927_pcierr_interrupt, 227 tx3927_pcierr_interrupt,
228 IRQF_DISABLED, "PCI error", 228 0, "PCI error",
229 (void *)TX3927_PCIC_REG)) 229 (void *)TX3927_PCIC_REG))
230 printk(KERN_WARNING "Failed to request irq for PCIERR\n"); 230 printk(KERN_WARNING "Failed to request irq for PCIERR\n");
231} 231}
diff --git a/arch/mips/pci/pci-tx4927.c b/arch/mips/pci/pci-tx4927.c
index a5807406a7f1..a032ae0a533d 100644
--- a/arch/mips/pci/pci-tx4927.c
+++ b/arch/mips/pci/pci-tx4927.c
@@ -85,7 +85,7 @@ void __init tx4927_setup_pcierr_irq(void)
85{ 85{
86 if (request_irq(TXX9_IRQ_BASE + TX4927_IR_PCIERR, 86 if (request_irq(TXX9_IRQ_BASE + TX4927_IR_PCIERR,
87 tx4927_pcierr_interrupt, 87 tx4927_pcierr_interrupt,
88 IRQF_DISABLED, "PCI error", 88 0, "PCI error",
89 (void *)TX4927_PCIC_REG)) 89 (void *)TX4927_PCIC_REG))
90 printk(KERN_WARNING "Failed to request irq for PCIERR\n"); 90 printk(KERN_WARNING "Failed to request irq for PCIERR\n");
91} 91}
diff --git a/arch/mips/pci/pci-tx4938.c b/arch/mips/pci/pci-tx4938.c
index 20e45f30b2ef..141bba562488 100644
--- a/arch/mips/pci/pci-tx4938.c
+++ b/arch/mips/pci/pci-tx4938.c
@@ -136,7 +136,7 @@ void __init tx4938_setup_pcierr_irq(void)
136{ 136{
137 if (request_irq(TXX9_IRQ_BASE + TX4938_IR_PCIERR, 137 if (request_irq(TXX9_IRQ_BASE + TX4938_IR_PCIERR,
138 tx4927_pcierr_interrupt, 138 tx4927_pcierr_interrupt,
139 IRQF_DISABLED, "PCI error", 139 0, "PCI error",
140 (void *)TX4927_PCIC_REG)) 140 (void *)TX4927_PCIC_REG))
141 printk(KERN_WARNING "Failed to request irq for PCIERR\n"); 141 printk(KERN_WARNING "Failed to request irq for PCIERR\n");
142} 142}
diff --git a/arch/mips/pci/pci-tx4939.c b/arch/mips/pci/pci-tx4939.c
index 9ef840693baf..c10fbf2a19dc 100644
--- a/arch/mips/pci/pci-tx4939.c
+++ b/arch/mips/pci/pci-tx4939.c
@@ -101,7 +101,7 @@ void __init tx4939_setup_pcierr_irq(void)
101{ 101{
102 if (request_irq(TXX9_IRQ_BASE + TX4939_IR_PCIERR, 102 if (request_irq(TXX9_IRQ_BASE + TX4939_IR_PCIERR,
103 tx4927_pcierr_interrupt, 103 tx4927_pcierr_interrupt,
104 IRQF_DISABLED, "PCI error", 104 0, "PCI error",
105 (void *)TX4939_PCIC_REG)) 105 (void *)TX4939_PCIC_REG))
106 pr_warning("Failed to request irq for PCIERR\n"); 106 pr_warning("Failed to request irq for PCIERR\n");
107} 107}
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 41af7fa2887b..8ac0d4841852 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -4,8 +4,11 @@
4 * Free Software Foundation; either version 2 of the License, or (at your 4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version. 5 * option) any later version.
6 * 6 *
7 * Copyright (C) 2003, 04 Ralf Baechle (ralf@linux-mips.org) 7 * Copyright (C) 2003, 04, 11 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 2011 Wind River Systems,
9 * written by Ralf Baechle (ralf@linux-mips.org)
8 */ 10 */
11#include <linux/bug.h>
9#include <linux/kernel.h> 12#include <linux/kernel.h>
10#include <linux/mm.h> 13#include <linux/mm.h>
11#include <linux/bootmem.h> 14#include <linux/bootmem.h>
@@ -14,6 +17,8 @@
14#include <linux/types.h> 17#include <linux/types.h>
15#include <linux/pci.h> 18#include <linux/pci.h>
16 19
20#include <asm/cpu-info.h>
21
17/* 22/*
18 * Indicate whether we respect the PCI setup left by the firmware. 23 * Indicate whether we respect the PCI setup left by the firmware.
19 * 24 *
@@ -150,10 +155,32 @@ out:
150 "Skipping PCI bus scan due to resource conflict\n"); 155 "Skipping PCI bus scan due to resource conflict\n");
151} 156}
152 157
158static void __init pcibios_set_cache_line_size(void)
159{
160 struct cpuinfo_mips *c = &current_cpu_data;
161 unsigned int lsize;
162
163 /*
164 * Set PCI cacheline size to that of the highest level in the
165 * cache hierarchy.
166 */
167 lsize = c->dcache.linesz;
168 lsize = c->scache.linesz ? : lsize;
169 lsize = c->tcache.linesz ? : lsize;
170
171 BUG_ON(!lsize);
172
173 pci_dfl_cache_line_size = lsize >> 2;
174
175 pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
176}
177
153static int __init pcibios_init(void) 178static int __init pcibios_init(void)
154{ 179{
155 struct pci_controller *hose; 180 struct pci_controller *hose;
156 181
182 pcibios_set_cache_line_size();
183
157 /* Scan all of the recorded PCI controllers. */ 184 /* Scan all of the recorded PCI controllers. */
158 for (hose = hose_head; hose; hose = hose->next) 185 for (hose = hose_head; hose; hose = hose->next)
159 pcibios_scanbus(hose); 186 pcibios_scanbus(hose);
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
index c841f083a7f5..bb57ed9ea2bd 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
@@ -149,7 +149,7 @@ static int msp_hwbutton_register(struct hwbutton_interrupt *hirq)
149 CIC_EXT_SET_ACTIVE_HI(cic_ext, hirq->eirq); 149 CIC_EXT_SET_ACTIVE_HI(cic_ext, hirq->eirq);
150 *CIC_EXT_CFG_REG = cic_ext; 150 *CIC_EXT_CFG_REG = cic_ext;
151 151
152 return request_irq(hirq->irq, hwbutton_handler, IRQF_DISABLED, 152 return request_irq(hirq->irq, hwbutton_handler, 0,
153 hirq->name, hirq); 153 hirq->name, hirq);
154} 154}
155 155
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_smp.c b/arch/mips/pmc-sierra/msp71xx/msp_smp.c
index bec17901ff03..10170580a2de 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_smp.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_smp.c
@@ -51,13 +51,13 @@ static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
51 51
52static struct irqaction irq_resched = { 52static struct irqaction irq_resched = {
53 .handler = ipi_resched_interrupt, 53 .handler = ipi_resched_interrupt,
54 .flags = IRQF_DISABLED | IRQF_PERCPU, 54 .flags = IRQF_PERCPU,
55 .name = "IPI_resched" 55 .name = "IPI_resched"
56}; 56};
57 57
58static struct irqaction irq_call = { 58static struct irqaction irq_call = {
59 .handler = ipi_call_interrupt, 59 .handler = ipi_call_interrupt,
60 .flags = IRQF_DISABLED | IRQF_PERCPU, 60 .flags = IRQF_PERCPU,
61 .name = "IPI_call" 61 .name = "IPI_call"
62}; 62};
63 63
diff --git a/arch/mips/pnx8550/common/int.c b/arch/mips/pnx8550/common/int.c
index 1ebe22bdadc8..ec684b8c3f79 100644
--- a/arch/mips/pnx8550/common/int.c
+++ b/arch/mips/pnx8550/common/int.c
@@ -167,13 +167,13 @@ static struct irq_chip level_irq_type = {
167 167
168static struct irqaction gic_action = { 168static struct irqaction gic_action = {
169 .handler = no_action, 169 .handler = no_action,
170 .flags = IRQF_DISABLED | IRQF_NO_THREAD, 170 .flags = IRQF_NO_THREAD,
171 .name = "GIC", 171 .name = "GIC",
172}; 172};
173 173
174static struct irqaction timer_action = { 174static struct irqaction timer_action = {
175 .handler = no_action, 175 .handler = no_action,
176 .flags = IRQF_DISABLED | IRQF_TIMER, 176 .flags = IRQF_TIMER,
177 .name = "Timer", 177 .name = "Timer",
178}; 178};
179 179
diff --git a/arch/mips/pnx8550/common/time.c b/arch/mips/pnx8550/common/time.c
index 8836c6203df0..831d6b369e9c 100644
--- a/arch/mips/pnx8550/common/time.c
+++ b/arch/mips/pnx8550/common/time.c
@@ -59,7 +59,7 @@ static irqreturn_t pnx8xxx_timer_interrupt(int irq, void *dev_id)
59 59
60static struct irqaction pnx8xxx_timer_irq = { 60static struct irqaction pnx8xxx_timer_irq = {
61 .handler = pnx8xxx_timer_interrupt, 61 .handler = pnx8xxx_timer_interrupt,
62 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, 62 .flags = IRQF_PERCPU | IRQF_TIMER,
63 .name = "pnx8xxx_timer", 63 .name = "pnx8xxx_timer",
64}; 64};
65 65
@@ -72,7 +72,7 @@ static irqreturn_t monotonic_interrupt(int irq, void *dev_id)
72 72
73static struct irqaction monotonic_irqaction = { 73static struct irqaction monotonic_irqaction = {
74 .handler = monotonic_interrupt, 74 .handler = monotonic_interrupt,
75 .flags = IRQF_DISABLED | IRQF_TIMER, 75 .flags = IRQF_TIMER,
76 .name = "Monotonic timer", 76 .name = "Monotonic timer",
77}; 77};
78 78
diff --git a/arch/mips/sgi-ip22/Makefile b/arch/mips/sgi-ip22/Makefile
index cc538493cae1..411cda9ee030 100644
--- a/arch/mips/sgi-ip22/Makefile
+++ b/arch/mips/sgi-ip22/Makefile
@@ -4,7 +4,7 @@
4# 4#
5 5
6obj-y += ip22-mc.o ip22-hpc.o ip22-int.o ip22-time.o ip22-nvram.o \ 6obj-y += ip22-mc.o ip22-hpc.o ip22-int.o ip22-time.o ip22-nvram.o \
7 ip22-platform.o ip22-reset.o ip22-setup.o 7 ip22-platform.o ip22-reset.o ip22-setup.o ip22-gio.o
8 8
9obj-$(CONFIG_SGI_IP22) += ip22-berr.o 9obj-$(CONFIG_SGI_IP22) += ip22-berr.o
10obj-$(CONFIG_SGI_IP28) += ip28-berr.o 10obj-$(CONFIG_SGI_IP28) += ip28-berr.o
diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
new file mode 100644
index 000000000000..f5ebc092aed5
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -0,0 +1,428 @@
1#include <linux/export.h>
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/slab.h>
5
6#include <asm/addrspace.h>
7#include <asm/paccess.h>
8#include <asm/gio_device.h>
9#include <asm/sgi/gio.h>
10#include <asm/sgi/hpc3.h>
11#include <asm/sgi/mc.h>
12#include <asm/sgi/ip22.h>
13
14static struct bus_type gio_bus_type;
15
16static struct {
17 const char *name;
18 __u8 id;
19} gio_name_table[] = {
20 { .name = "SGI Impact", .id = 0x10 },
21 { .name = "Phobos G160", .id = 0x35 },
22 /* fake IDs */
23 { .name = "SGI Newport", .id = 0x7e },
24 { .name = "SGI GR2/GR3", .id = 0x7f },
25};
26
27static struct device gio_bus = {
28 .init_name = "gio",
29};
30
31/**
32 * gio_match_device - Tell if an of_device structure has a matching
33 * gio_match structure
34 * @ids: array of of device match structures to search in
35 * @dev: the of device structure to match against
36 *
37 * Used by a driver to check whether an of_device present in the
38 * system is in its list of supported devices.
39 */
40const struct gio_device_id *gio_match_device(const struct gio_device_id *match,
41 const struct gio_device *dev)
42{
43 const struct gio_device_id *ids;
44
45 for (ids = match; ids->id != 0xff; ids++)
46 if (ids->id == dev->id.id)
47 return ids;
48
49 return NULL;
50}
51EXPORT_SYMBOL_GPL(gio_match_device);
52
53struct gio_device *gio_dev_get(struct gio_device *dev)
54{
55 struct device *tmp;
56
57 if (!dev)
58 return NULL;
59 tmp = get_device(&dev->dev);
60 if (tmp)
61 return to_gio_device(tmp);
62 else
63 return NULL;
64}
65EXPORT_SYMBOL_GPL(gio_dev_get);
66
67void gio_dev_put(struct gio_device *dev)
68{
69 if (dev)
70 put_device(&dev->dev);
71}
72EXPORT_SYMBOL_GPL(gio_dev_put);
73
74/**
75 * gio_release_dev - free an gio device structure when all users of it are finished.
76 * @dev: device that's been disconnected
77 *
78 * Will be called only by the device core when all users of this gio device are
79 * done.
80 */
81void gio_release_dev(struct device *dev)
82{
83 struct gio_device *giodev;
84
85 giodev = to_gio_device(dev);
86 kfree(giodev);
87}
88EXPORT_SYMBOL_GPL(gio_release_dev);
89
90int gio_device_register(struct gio_device *giodev)
91{
92 giodev->dev.bus = &gio_bus_type;
93 giodev->dev.parent = &gio_bus;
94 return device_register(&giodev->dev);
95}
96EXPORT_SYMBOL_GPL(gio_device_register);
97
98void gio_device_unregister(struct gio_device *giodev)
99{
100 device_unregister(&giodev->dev);
101}
102EXPORT_SYMBOL_GPL(gio_device_unregister);
103
104static int gio_bus_match(struct device *dev, struct device_driver *drv)
105{
106 struct gio_device *gio_dev = to_gio_device(dev);
107 struct gio_driver *gio_drv = to_gio_driver(drv);
108
109 return gio_match_device(gio_drv->id_table, gio_dev) != NULL;
110}
111
112static int gio_device_probe(struct device *dev)
113{
114 int error = -ENODEV;
115 struct gio_driver *drv;
116 struct gio_device *gio_dev;
117 const struct gio_device_id *match;
118
119 drv = to_gio_driver(dev->driver);
120 gio_dev = to_gio_device(dev);
121
122 if (!drv->probe)
123 return error;
124
125 gio_dev_get(gio_dev);
126
127 match = gio_match_device(drv->id_table, gio_dev);
128 if (match)
129 error = drv->probe(gio_dev, match);
130 if (error)
131 gio_dev_put(gio_dev);
132
133 return error;
134}
135
136static int gio_device_remove(struct device *dev)
137{
138 struct gio_device *gio_dev = to_gio_device(dev);
139 struct gio_driver *drv = to_gio_driver(dev->driver);
140
141 if (dev->driver && drv->remove)
142 drv->remove(gio_dev);
143 return 0;
144}
145
146static int gio_device_suspend(struct device *dev, pm_message_t state)
147{
148 struct gio_device *gio_dev = to_gio_device(dev);
149 struct gio_driver *drv = to_gio_driver(dev->driver);
150 int error = 0;
151
152 if (dev->driver && drv->suspend)
153 error = drv->suspend(gio_dev, state);
154 return error;
155}
156
157static int gio_device_resume(struct device *dev)
158{
159 struct gio_device *gio_dev = to_gio_device(dev);
160 struct gio_driver *drv = to_gio_driver(dev->driver);
161 int error = 0;
162
163 if (dev->driver && drv->resume)
164 error = drv->resume(gio_dev);
165 return error;
166}
167
168static void gio_device_shutdown(struct device *dev)
169{
170 struct gio_device *gio_dev = to_gio_device(dev);
171 struct gio_driver *drv = to_gio_driver(dev->driver);
172
173 if (dev->driver && drv->shutdown)
174 drv->shutdown(gio_dev);
175}
176
177static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
178 char *buf)
179{
180 struct gio_device *gio_dev = to_gio_device(dev);
181 int len = snprintf(buf, PAGE_SIZE, "gio:%x\n", gio_dev->id.id);
182
183 return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
184}
185
186static ssize_t name_show(struct device *dev,
187 struct device_attribute *attr, char *buf)
188{
189 struct gio_device *giodev;
190
191 giodev = to_gio_device(dev);
192 return sprintf(buf, "%s", giodev->name);
193}
194
195static ssize_t id_show(struct device *dev,
196 struct device_attribute *attr, char *buf)
197{
198 struct gio_device *giodev;
199
200 giodev = to_gio_device(dev);
201 return sprintf(buf, "%x", giodev->id.id);
202}
203
204static struct device_attribute gio_dev_attrs[] = {
205 __ATTR_RO(modalias),
206 __ATTR_RO(name),
207 __ATTR_RO(id),
208 __ATTR_NULL,
209};
210
211static int gio_device_uevent(struct device *dev, struct kobj_uevent_env *env)
212{
213 struct gio_device *gio_dev = to_gio_device(dev);
214
215 add_uevent_var(env, "MODALIAS=gio:%x", gio_dev->id.id);
216 return 0;
217}
218
219int gio_register_driver(struct gio_driver *drv)
220{
221 /* initialize common driver fields */
222 if (!drv->driver.name)
223 drv->driver.name = drv->name;
224 if (!drv->driver.owner)
225 drv->driver.owner = drv->owner;
226 drv->driver.bus = &gio_bus_type;
227
228 /* register with core */
229 return driver_register(&drv->driver);
230}
231EXPORT_SYMBOL_GPL(gio_register_driver);
232
233void gio_unregister_driver(struct gio_driver *drv)
234{
235 driver_unregister(&drv->driver);
236}
237EXPORT_SYMBOL_GPL(gio_unregister_driver);
238
239void gio_set_master(struct gio_device *dev)
240{
241 u32 tmp = sgimc->giopar;
242
243 switch (dev->slotno) {
244 case 0:
245 tmp |= SGIMC_GIOPAR_MASTERGFX;
246 break;
247 case 1:
248 tmp |= SGIMC_GIOPAR_MASTEREXP0;
249 break;
250 case 2:
251 tmp |= SGIMC_GIOPAR_MASTEREXP1;
252 break;
253 }
254 sgimc->giopar = tmp;
255}
256EXPORT_SYMBOL_GPL(gio_set_master);
257
258void ip22_gio_set_64bit(int slotno)
259{
260 u32 tmp = sgimc->giopar;
261
262 switch (slotno) {
263 case 0:
264 tmp |= SGIMC_GIOPAR_GFX64;
265 break;
266 case 1:
267 tmp |= SGIMC_GIOPAR_EXP064;
268 break;
269 case 2:
270 tmp |= SGIMC_GIOPAR_EXP164;
271 break;
272 }
273 sgimc->giopar = tmp;
274}
275
276static int ip22_gio_id(unsigned long addr, u32 *res)
277{
278 u8 tmp8;
279 u8 tmp16;
280 u32 tmp32;
281 u8 *ptr8;
282 u16 *ptr16;
283 u32 *ptr32;
284
285 ptr32 = (void *)CKSEG1ADDR(addr);
286 if (!get_dbe(tmp32, ptr32)) {
287 /*
288 * We got no DBE, but this doesn't mean anything.
289 * If GIO is pipelined (which can't be disabled
290 * for GFX slot) we don't get a DBE, but we see
291 * the transfer size as data. So we do an 8bit
292 * and a 16bit access and check whether the common
293 * data matches
294 */
295 ptr8 = (void *)CKSEG1ADDR(addr + 3);
296 get_dbe(tmp8, ptr8);
297 ptr16 = (void *)CKSEG1ADDR(addr + 2);
298 get_dbe(tmp16, ptr16);
299 if (tmp8 == (tmp16 & 0xff) &&
300 tmp8 == (tmp32 & 0xff) &&
301 tmp16 == (tmp32 & 0xffff)) {
302 *res = tmp32;
303 return 1;
304 }
305 }
306 return 0; /* nothing here */
307}
308
309#define HQ2_MYSTERY_OFFS 0x6A07C
310#define NEWPORT_USTATUS_OFFS 0xF133C
311
312static int ip22_is_gr2(unsigned long addr)
313{
314 u32 tmp;
315 u32 *ptr;
316
317 /* HQ2 only allows 32bit accesses */
318 ptr = (void *)CKSEG1ADDR(addr + HQ2_MYSTERY_OFFS);
319 if (!get_dbe(tmp, ptr)) {
320 if (tmp == 0xdeadbeef)
321 return 1;
322 }
323 return 0;
324}
325
326
327static void ip22_check_gio(int slotno, unsigned long addr)
328{
329 const char *name = "Unknown";
330 struct gio_device *gio_dev;
331 u32 tmp;
332 __u8 id;
333 int i;
334
335 /* first look for GR2/GR3 by checking mystery register */
336 if (ip22_is_gr2(addr))
337 tmp = 0x7f;
338 else {
339 if (!ip22_gio_id(addr, &tmp)) {
340 /*
341 * no GIO signature at start address of slot, but
342 * Newport doesn't have one, so let's check usea
343 * status register
344 */
345 if (ip22_gio_id(addr + NEWPORT_USTATUS_OFFS, &tmp))
346 tmp = 0x7e;
347 else
348 tmp = 0;
349 }
350 }
351 if (tmp) {
352 id = GIO_ID(tmp);
353 if (tmp & GIO_32BIT_ID) {
354 if (tmp & GIO_64BIT_IFACE)
355 ip22_gio_set_64bit(slotno);
356 }
357 for (i = 0; i < ARRAY_SIZE(gio_name_table); i++) {
358 if (id == gio_name_table[i].id) {
359 name = gio_name_table[i].name;
360 break;
361 }
362 }
363 printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
364 slotno, name, id);
365 gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
366 gio_dev->name = name;
367 gio_dev->slotno = slotno;
368 gio_dev->id.id = id;
369 gio_dev->resource.start = addr;
370 gio_dev->resource.end = addr + 0x3fffff;
371 gio_dev->resource.flags = IORESOURCE_MEM;
372 dev_set_name(&gio_dev->dev, "%d", slotno);
373 gio_device_register(gio_dev);
374 } else
375 printk(KERN_INFO "GIO: slot %d : Empty\n", slotno);
376}
377
378static struct bus_type gio_bus_type = {
379 .name = "gio",
380 .dev_attrs = gio_dev_attrs,
381 .match = gio_bus_match,
382 .probe = gio_device_probe,
383 .remove = gio_device_remove,
384 .suspend = gio_device_suspend,
385 .resume = gio_device_resume,
386 .shutdown = gio_device_shutdown,
387 .uevent = gio_device_uevent,
388};
389
390static struct resource gio_bus_resource = {
391 .start = GIO_SLOT_GFX_BASE,
392 .end = GIO_SLOT_GFX_BASE + 0x9fffff,
393 .name = "GIO Bus",
394 .flags = IORESOURCE_MEM,
395};
396
397int __init ip22_gio_init(void)
398{
399 unsigned int pbdma __maybe_unused;
400 int ret;
401
402 ret = device_register(&gio_bus);
403 if (ret)
404 return ret;
405
406 ret = bus_register(&gio_bus_type);
407 if (!ret) {
408 request_resource(&iomem_resource, &gio_bus_resource);
409 printk(KERN_INFO "GIO: Probing bus...\n");
410
411 if (ip22_is_fullhouse() ||
412 !get_dbe(pbdma, (unsigned int *)&hpc3c1->pbdma[1])) {
413 /* Indigo2 and ChallengeS */
414 ip22_check_gio(0, GIO_SLOT_GFX_BASE);
415 ip22_check_gio(1, GIO_SLOT_EXP0_BASE);
416 } else {
417 /* Indy */
418 ip22_check_gio(0, GIO_SLOT_GFX_BASE);
419 ip22_check_gio(1, GIO_SLOT_EXP0_BASE);
420 ip22_check_gio(2, GIO_SLOT_EXP1_BASE);
421 }
422 } else
423 device_unregister(&gio_bus);
424
425 return ret;
426}
427
428subsys_initcall(ip22_gio_init);
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index f72c336ea27b..3f2b7633f946 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -155,32 +155,32 @@ static void __irq_entry indy_buserror_irq(void)
155 155
156static struct irqaction local0_cascade = { 156static struct irqaction local0_cascade = {
157 .handler = no_action, 157 .handler = no_action,
158 .flags = IRQF_DISABLED | IRQF_NO_THREAD, 158 .flags = IRQF_NO_THREAD,
159 .name = "local0 cascade", 159 .name = "local0 cascade",
160}; 160};
161 161
162static struct irqaction local1_cascade = { 162static struct irqaction local1_cascade = {
163 .handler = no_action, 163 .handler = no_action,
164 .flags = IRQF_DISABLED | IRQF_NO_THREAD, 164 .flags = IRQF_NO_THREAD,
165 .name = "local1 cascade", 165 .name = "local1 cascade",
166}; 166};
167 167
168static struct irqaction buserr = { 168static struct irqaction buserr = {
169 .handler = no_action, 169 .handler = no_action,
170 .flags = IRQF_DISABLED | IRQF_NO_THREAD, 170 .flags = IRQF_NO_THREAD,
171 .name = "Bus Error", 171 .name = "Bus Error",
172}; 172};
173 173
174static struct irqaction map0_cascade = { 174static struct irqaction map0_cascade = {
175 .handler = no_action, 175 .handler = no_action,
176 .flags = IRQF_DISABLED | IRQF_NO_THREAD, 176 .flags = IRQF_NO_THREAD,
177 .name = "mapable0 cascade", 177 .name = "mapable0 cascade",
178}; 178};
179 179
180#ifdef USE_LIO3_IRQ 180#ifdef USE_LIO3_IRQ
181static struct irqaction map1_cascade = { 181static struct irqaction map1_cascade = {
182 .handler = no_action, 182 .handler = no_action,
183 .flags = IRQF_DISABLED | IRQF_NO_THREAD, 183 .flags = IRQF_NO_THREAD,
184 .name = "mapable1 cascade", 184 .name = "mapable1 cascade",
185}; 185};
186#define SGI_INTERRUPTS SGINT_END 186#define SGI_INTERRUPTS SGINT_END
diff --git a/arch/mips/sgi-ip22/ip22-mc.c b/arch/mips/sgi-ip22/ip22-mc.c
index d22262ee6853..75ada8a9713b 100644
--- a/arch/mips/sgi-ip22/ip22-mc.c
+++ b/arch/mips/sgi-ip22/ip22-mc.c
@@ -139,11 +139,11 @@ void __init sgimc_init(void)
139 * zero. 139 * zero.
140 */ 140 */
141 /* don't touch parity settings for IP28 */ 141 /* don't touch parity settings for IP28 */
142#ifndef CONFIG_SGI_IP28
143 tmp = sgimc->cpuctrl0; 142 tmp = sgimc->cpuctrl0;
144 tmp |= (SGIMC_CCTRL0_EPERRGIO | SGIMC_CCTRL0_EPERRMEM | 143#ifndef CONFIG_SGI_IP28
145 SGIMC_CCTRL0_R4KNOCHKPARR); 144 tmp |= SGIMC_CCTRL0_EPERRGIO | SGIMC_CCTRL0_EPERRMEM;
146#endif 145#endif
146 tmp |= SGIMC_CCTRL0_R4KNOCHKPARR;
147 sgimc->cpuctrl0 = tmp; 147 sgimc->cpuctrl0 = tmp;
148 148
149 /* Step 3: Setup the MC write buffer depth, this is controlled 149 /* Step 3: Setup the MC write buffer depth, this is controlled
@@ -178,7 +178,8 @@ void __init sgimc_init(void)
178 */ 178 */
179 179
180 /* First the basic invariants across all GIO64 implementations. */ 180 /* First the basic invariants across all GIO64 implementations. */
181 tmp = SGIMC_GIOPAR_HPC64; /* All 1st HPC's interface at 64bits */ 181 tmp = sgimc->giopar & SGIMC_GIOPAR_GFX64; /* keep gfx 64bit settings */
182 tmp |= SGIMC_GIOPAR_HPC64; /* All 1st HPC's interface at 64bits */
182 tmp |= SGIMC_GIOPAR_ONEBUS; /* Only one physical GIO bus exists */ 183 tmp |= SGIMC_GIOPAR_ONEBUS; /* Only one physical GIO bus exists */
183 184
184 if (ip22_is_fullhouse()) { 185 if (ip22_is_fullhouse()) {
@@ -193,7 +194,6 @@ void __init sgimc_init(void)
193 tmp |= SGIMC_GIOPAR_PLINEEXP0; /* exp[01] pipelined */ 194 tmp |= SGIMC_GIOPAR_PLINEEXP0; /* exp[01] pipelined */
194 tmp |= SGIMC_GIOPAR_PLINEEXP1; 195 tmp |= SGIMC_GIOPAR_PLINEEXP1;
195 tmp |= SGIMC_GIOPAR_MASTEREISA; /* EISA masters */ 196 tmp |= SGIMC_GIOPAR_MASTEREISA; /* EISA masters */
196 tmp |= SGIMC_GIOPAR_GFX64; /* GFX at 64 bits */
197 } 197 }
198 } else { 198 } else {
199 /* Guiness specific settings. */ 199 /* Guiness specific settings. */
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
index 5e6621349471..c7bdfe43df5b 100644
--- a/arch/mips/sgi-ip22/ip22-setup.c
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -26,9 +26,6 @@
26#include <asm/sgi/hpc3.h> 26#include <asm/sgi/hpc3.h>
27#include <asm/sgi/ip22.h> 27#include <asm/sgi/ip22.h>
28 28
29unsigned long sgi_gfxaddr;
30EXPORT_SYMBOL_GPL(sgi_gfxaddr);
31
32extern void ip22_be_init(void) __init; 29extern void ip22_be_init(void) __init;
33 30
34void __init plat_mem_setup(void) 31void __init plat_mem_setup(void)
@@ -78,22 +75,4 @@ void __init plat_mem_setup(void)
78 prom_flags |= PROM_FLAG_USE_AS_CONSOLE; 75 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
79 add_preferred_console("arc", 0, NULL); 76 add_preferred_console("arc", 0, NULL);
80 } 77 }
81
82#if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
83 {
84 ULONG *gfxinfo;
85 ULONG * (*__vec)(void) = (void *) (long)
86 *((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));
87
88 gfxinfo = __vec();
89 sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
90 && gfxinfo[1] <= 0xc0000000)
91 ? gfxinfo[1] - 0xa0000000 : 0);
92
93 /* newport addresses? */
94 if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
95 conswitchp = &newport_con;
96 }
97 }
98#endif
99} 78}
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index ec3782d31894..23642238c689 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -116,7 +116,7 @@ static int ms1bit(unsigned long x)
116} 116}
117 117
118/* 118/*
119 * This code is unnecessarily complex, because we do IRQF_DISABLED 119 * This code is unnecessarily complex, because we do
120 * intr enabling. Basically, once we grab the set of intrs we need 120 * intr enabling. Basically, once we grab the set of intrs we need
121 * to service, we must mask _all_ these interrupts; firstly, to make 121 * to service, we must mask _all_ these interrupts; firstly, to make
122 * sure the same intr does not intr again, causing recursion that 122 * sure the same intr does not intr again, causing recursion that
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index ef74f3267f91..13cfeab50528 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -91,7 +91,7 @@ static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
91 91
92struct irqaction hub_rt_irqaction = { 92struct irqaction hub_rt_irqaction = {
93 .handler = hub_rt_counter_handler, 93 .handler = hub_rt_counter_handler,
94 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, 94 .flags = IRQF_PERCPU | IRQF_TIMER,
95 .name = "hub-rt", 95 .name = "hub-rt",
96}; 96};
97 97
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index c65ea76d56c7..a092860d5196 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -113,13 +113,11 @@ extern irqreturn_t crime_cpuerr_intr(int irq, void *dev_id);
113 113
114static struct irqaction memerr_irq = { 114static struct irqaction memerr_irq = {
115 .handler = crime_memerr_intr, 115 .handler = crime_memerr_intr,
116 .flags = IRQF_DISABLED,
117 .name = "CRIME memory error", 116 .name = "CRIME memory error",
118}; 117};
119 118
120static struct irqaction cpuerr_irq = { 119static struct irqaction cpuerr_irq = {
121 .handler = crime_cpuerr_intr, 120 .handler = crime_cpuerr_intr,
122 .flags = IRQF_DISABLED,
123 .name = "CRIME CPU error", 121 .name = "CRIME CPU error",
124}; 122};
125 123
diff --git a/arch/mips/sni/irq.c b/arch/mips/sni/irq.c
index e8e72bb3a9af..5a4ec75382e2 100644
--- a/arch/mips/sni/irq.c
+++ b/arch/mips/sni/irq.c
@@ -42,7 +42,7 @@ static irqreturn_t sni_isa_irq_handler(int dummy, void *p)
42struct irqaction sni_isa_irq = { 42struct irqaction sni_isa_irq = {
43 .handler = sni_isa_irq_handler, 43 .handler = sni_isa_irq_handler,
44 .name = "ISA", 44 .name = "ISA",
45 .flags = IRQF_SHARED | IRQF_DISABLED 45 .flags = IRQF_SHARED
46}; 46};
47 47
48/* 48/*
diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c
index ec0be14996a4..494c9e7847aa 100644
--- a/arch/mips/sni/time.c
+++ b/arch/mips/sni/time.c
@@ -68,7 +68,7 @@ static irqreturn_t a20r_interrupt(int irq, void *dev_id)
68 68
69static struct irqaction a20r_irqaction = { 69static struct irqaction a20r_irqaction = {
70 .handler = a20r_interrupt, 70 .handler = a20r_interrupt,
71 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, 71 .flags = IRQF_PERCPU | IRQF_TIMER,
72 .name = "a20r-timer", 72 .name = "a20r-timer",
73}; 73};
74 74
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index 85a87de17eb4..682efb0c108d 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -262,7 +262,7 @@ txx9_i8259_irq_setup(int irq)
262 int err; 262 int err;
263 263
264 init_i8259_irqs(); 264 init_i8259_irqs();
265 err = request_irq(irq, &i8259_interrupt, IRQF_DISABLED|IRQF_SHARED, 265 err = request_irq(irq, &i8259_interrupt, IRQF_SHARED,
266 "cascade(i8259)", (void *)(long)irq); 266 "cascade(i8259)", (void *)(long)irq);
267 if (!err) 267 if (!err)
268 printk(KERN_INFO "PCI-ISA bridge PIC (irq %d)\n", irq); 268 printk(KERN_INFO "PCI-ISA bridge PIC (irq %d)\n", irq);