aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt7
-rw-r--r--MAINTAINERS7
-rw-r--r--arch/i386/kernel/apic.c4
-rw-r--r--arch/i386/kernel/cpu/mcheck/p4.c2
-rw-r--r--arch/i386/kernel/io_apic.c10
-rw-r--r--arch/i386/kernel/irq.c3
-rw-r--r--arch/i386/kernel/process.c53
-rw-r--r--arch/i386/kernel/smp.c2
-rw-r--r--arch/ia64/kernel/msi_ia64.c2
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c2
-rw-r--r--arch/mips/Kconfig18
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/cobalt/mtd.c2
-rw-r--r--arch/mips/configs/atlas_defconfig2
-rw-r--r--arch/mips/configs/bigsur_defconfig5
-rw-r--r--arch/mips/configs/capcella_defconfig3
-rw-r--r--arch/mips/configs/cobalt_defconfig7
-rw-r--r--arch/mips/configs/db1000_defconfig4
-rw-r--r--arch/mips/configs/db1100_defconfig4
-rw-r--r--arch/mips/configs/db1200_defconfig4
-rw-r--r--arch/mips/configs/db1500_defconfig7
-rw-r--r--arch/mips/configs/db1550_defconfig5
-rw-r--r--arch/mips/configs/ddb5477_defconfig4
-rw-r--r--arch/mips/configs/decstation_defconfig3
-rw-r--r--arch/mips/configs/e55_defconfig3
-rw-r--r--arch/mips/configs/emma2rh_defconfig5
-rw-r--r--arch/mips/configs/ev64120_defconfig5
-rw-r--r--arch/mips/configs/excite_defconfig7
-rw-r--r--arch/mips/configs/ip22_defconfig3
-rw-r--r--arch/mips/configs/ip27_defconfig5
-rw-r--r--arch/mips/configs/ip32_defconfig4
-rw-r--r--arch/mips/configs/jaguar-atx_defconfig7
-rw-r--r--arch/mips/configs/jazz_defconfig3
-rw-r--r--arch/mips/configs/jmr3927_defconfig4
-rw-r--r--arch/mips/configs/lasat200_defconfig5
-rw-r--r--arch/mips/configs/malta_defconfig2
-rw-r--r--arch/mips/configs/mipssim_defconfig4
-rw-r--r--arch/mips/configs/mpc30x_defconfig5
-rw-r--r--arch/mips/configs/ocelot_3_defconfig6
-rw-r--r--arch/mips/configs/ocelot_c_defconfig4
-rw-r--r--arch/mips/configs/ocelot_defconfig4
-rw-r--r--arch/mips/configs/ocelot_g_defconfig4
-rw-r--r--arch/mips/configs/pb1100_defconfig4
-rw-r--r--arch/mips/configs/pb1500_defconfig6
-rw-r--r--arch/mips/configs/pb1550_defconfig6
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig5
-rw-r--r--arch/mips/configs/pnx8550-stb810_defconfig5
-rw-r--r--arch/mips/configs/pnx8550-v2pci_defconfig6
-rw-r--r--arch/mips/configs/qemu_defconfig3
-rw-r--r--arch/mips/configs/rbhma4500_defconfig6
-rw-r--r--arch/mips/configs/rm200_defconfig4
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig5
-rw-r--r--arch/mips/configs/sead_defconfig2
-rw-r--r--arch/mips/configs/tb0226_defconfig4
-rw-r--r--arch/mips/configs/tb0229_defconfig5
-rw-r--r--arch/mips/configs/tb0287_defconfig5
-rw-r--r--arch/mips/configs/workpad_defconfig3
-rw-r--r--arch/mips/configs/wrppmc_defconfig3
-rw-r--r--arch/mips/configs/yosemite_defconfig4
-rw-r--r--arch/mips/defconfig3
-rw-r--r--arch/mips/kernel/asm-offsets.c4
-rw-r--r--arch/mips/kernel/ptrace.c10
-rw-r--r--arch/mips/kernel/signal.c7
-rw-r--r--arch/mips/kernel/smp.c25
-rw-r--r--arch/mips/kernel/traps.c3
-rw-r--r--arch/mips/mm/ioremap.c96
-rw-r--r--arch/mips/momentum/jaguar_atx/platform.c2
-rw-r--r--arch/mips/momentum/ocelot_3/platform.c2
-rw-r--r--arch/mips/momentum/ocelot_c/platform.c2
-rw-r--r--arch/x86_64/kernel/entry.S3
-rw-r--r--arch/x86_64/kernel/i8259.c52
-rw-r--r--arch/x86_64/kernel/io_apic.c439
-rw-r--r--drivers/char/agp/Makefile3
-rw-r--r--drivers/char/agp/agp.h8
-rw-r--r--drivers/char/agp/ali-agp.c6
-rw-r--r--drivers/char/agp/amd-k7-agp.c6
-rw-r--r--drivers/char/agp/amd64-agp.c4
-rw-r--r--drivers/char/agp/ati-agp.c4
-rw-r--r--drivers/char/agp/efficeon-agp.c6
-rw-r--r--drivers/char/agp/generic.c2
-rw-r--r--drivers/char/agp/hp-agp.c2
-rw-r--r--drivers/char/agp/i460-agp.c4
-rw-r--r--drivers/char/agp/intel-agp.c38
-rw-r--r--drivers/char/agp/nvidia-agp.c6
-rw-r--r--drivers/char/agp/parisc-agp.c2
-rw-r--r--drivers/char/agp/sgi-agp.c2
-rw-r--r--drivers/char/agp/sis-agp.c2
-rw-r--r--drivers/char/agp/sworks-agp.c6
-rw-r--r--drivers/char/agp/uninorth-agp.c8
-rw-r--r--drivers/char/agp/via-agp.c6
-rw-r--r--drivers/serial/serial_txx9.c276
-rw-r--r--drivers/usb/core/Makefile2
-rw-r--r--drivers/usb/core/driver.c69
-rw-r--r--drivers/usb/core/hub.c3
-rw-r--r--drivers/usb/core/message.c6
-rw-r--r--drivers/usb/core/quirks.c77
-rw-r--r--drivers/usb/core/sysfs.c111
-rw-r--r--drivers/usb/core/usb.c12
-rw-r--r--drivers/usb/core/usb.h9
-rw-r--r--drivers/usb/gadget/inode.c5
-rw-r--r--drivers/usb/host/uhci-debug.c57
-rw-r--r--drivers/usb/host/uhci-hcd.c58
-rw-r--r--drivers/usb/host/uhci-hcd.h82
-rw-r--r--drivers/usb/host/uhci-q.c219
-rw-r--r--drivers/usb/input/usbkbd.c4
-rw-r--r--drivers/usb/input/usbmouse.c4
-rw-r--r--drivers/usb/input/wacom_wac.c103
-rw-r--r--drivers/usb/input/wacom_wac.h1
-rw-r--r--drivers/usb/misc/Kconfig14
-rw-r--r--drivers/usb/misc/Makefile1
-rw-r--r--drivers/usb/misc/iowarrior.c925
-rw-r--r--drivers/usb/mon/mon_bin.c2
-rw-r--r--drivers/usb/mon/mon_text.c2
-rw-r--r--drivers/usb/mon/usb_mon.h4
-rw-r--r--drivers/usb/net/Kconfig9
-rw-r--r--drivers/usb/net/Makefile1
-rw-r--r--drivers/usb/net/asix.c14
-rw-r--r--drivers/usb/net/dm9601.c606
-rw-r--r--drivers/usb/serial/ftdi_sio.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.h6
-rw-r--r--drivers/usb/serial/option.c117
-rw-r--r--fs/sysfs/file.c44
-rw-r--r--include/asm-i386/idle.h14
-rw-r--r--include/asm-i386/processor.h8
-rw-r--r--include/asm-mips/ptrace.h4
-rw-r--r--include/asm-mips/sigcontext.h4
-rw-r--r--include/asm-mips/stackframe.h30
-rw-r--r--include/asm-x86_64/hw_irq.h25
-rw-r--r--include/linux/irq.h11
-rw-r--r--include/linux/sysfs.h17
-rw-r--r--include/linux/usb.h4
-rw-r--r--include/linux/usb/ch9.h22
-rw-r--r--include/linux/usb/iowarrior.h33
-rw-r--r--include/linux/usb/quirks.h11
-rw-r--r--kernel/irq/migration.c9
135 files changed, 3230 insertions, 887 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index c479d30eeaa3..03eb5ed503f7 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1758,6 +1758,13 @@ and is between 256 and 4096 characters. It is defined in the file
1758 Note that genuine overcurrent events won't be 1758 Note that genuine overcurrent events won't be
1759 reported either. 1759 reported either.
1760 1760
1761 usbcore.autosuspend=
1762 [USB] The autosuspend time delay (in seconds) used
1763 for newly-detected USB devices (default 2). This
1764 is the time required before an idle device will be
1765 autosuspended. Devices for which the delay is set
1766 to 0 won't be autosuspended at all.
1767
1761 usbhid.mousepoll= 1768 usbhid.mousepoll=
1762 [USBHID] The interval which mice are to be polled at. 1769 [USBHID] The interval which mice are to be polled at.
1763 1770
diff --git a/MAINTAINERS b/MAINTAINERS
index c268b51e4518..a9c13196f6bd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3392,6 +3392,13 @@ L: linux-usb-devel@lists.sourceforge.net
3392S: Maintained 3392S: Maintained
3393W: http://www.kroah.com/linux-usb/ 3393W: http://www.kroah.com/linux-usb/
3394 3394
3395USB DAVICOM DM9601 DRIVER
3396P: Peter Korsgaard
3397M: jacmet@sunsite.dk
3398L: linux-usb-devel@lists.sourceforge.net
3399W: http://www.linux-usb.org/usbnet
3400S: Maintained
3401
3395USB EHCI DRIVER 3402USB EHCI DRIVER
3396P: David Brownell 3403P: David Brownell
3397M: dbrownell@users.sourceforge.net 3404M: dbrownell@users.sourceforge.net
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 9655c233e6f1..7a2c9cbdb511 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -38,7 +38,6 @@
38#include <asm/hpet.h> 38#include <asm/hpet.h>
39#include <asm/i8253.h> 39#include <asm/i8253.h>
40#include <asm/nmi.h> 40#include <asm/nmi.h>
41#include <asm/idle.h>
42 41
43#include <mach_apic.h> 42#include <mach_apic.h>
44#include <mach_apicdef.h> 43#include <mach_apicdef.h>
@@ -561,7 +560,6 @@ void fastcall smp_apic_timer_interrupt(struct pt_regs *regs)
561 * Besides, if we don't timer interrupts ignore the global 560 * Besides, if we don't timer interrupts ignore the global
562 * interrupt lock, which is the WrongThing (tm) to do. 561 * interrupt lock, which is the WrongThing (tm) to do.
563 */ 562 */
564 exit_idle();
565 irq_enter(); 563 irq_enter();
566 local_apic_timer_interrupt(); 564 local_apic_timer_interrupt();
567 irq_exit(); 565 irq_exit();
@@ -1221,7 +1219,6 @@ void smp_spurious_interrupt(struct pt_regs *regs)
1221{ 1219{
1222 unsigned long v; 1220 unsigned long v;
1223 1221
1224 exit_idle();
1225 irq_enter(); 1222 irq_enter();
1226 /* 1223 /*
1227 * Check if this really is a spurious interrupt and ACK it 1224 * Check if this really is a spurious interrupt and ACK it
@@ -1245,7 +1242,6 @@ void smp_error_interrupt(struct pt_regs *regs)
1245{ 1242{
1246 unsigned long v, v1; 1243 unsigned long v, v1;
1247 1244
1248 exit_idle();
1249 irq_enter(); 1245 irq_enter();
1250 /* First tickle the hardware, only then report what went on. -- REW */ 1246 /* First tickle the hardware, only then report what went on. -- REW */
1251 v = apic_read(APIC_ESR); 1247 v = apic_read(APIC_ESR);
diff --git a/arch/i386/kernel/cpu/mcheck/p4.c b/arch/i386/kernel/cpu/mcheck/p4.c
index 8359c19d3a23..504434a46011 100644
--- a/arch/i386/kernel/cpu/mcheck/p4.c
+++ b/arch/i386/kernel/cpu/mcheck/p4.c
@@ -12,7 +12,6 @@
12#include <asm/system.h> 12#include <asm/system.h>
13#include <asm/msr.h> 13#include <asm/msr.h>
14#include <asm/apic.h> 14#include <asm/apic.h>
15#include <asm/idle.h>
16 15
17#include <asm/therm_throt.h> 16#include <asm/therm_throt.h>
18 17
@@ -60,7 +59,6 @@ static void (*vendor_thermal_interrupt)(struct pt_regs *regs) = unexpected_therm
60 59
61fastcall void smp_thermal_interrupt(struct pt_regs *regs) 60fastcall void smp_thermal_interrupt(struct pt_regs *regs)
62{ 61{
63 exit_idle();
64 irq_enter(); 62 irq_enter();
65 vendor_thermal_interrupt(regs); 63 vendor_thermal_interrupt(regs);
66 irq_exit(); 64 irq_exit();
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 4ccebd454e25..6fec4dab70bb 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -343,7 +343,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
343 break; 343 break;
344 entry = irq_2_pin + entry->next; 344 entry = irq_2_pin + entry->next;
345 } 345 }
346 set_native_irq_info(irq, cpumask); 346 irq_desc[irq].affinity = cpumask;
347 spin_unlock_irqrestore(&ioapic_lock, flags); 347 spin_unlock_irqrestore(&ioapic_lock, flags);
348} 348}
349 349
@@ -1354,7 +1354,7 @@ static void __init setup_IO_APIC_irqs(void)
1354 } 1354 }
1355 spin_lock_irqsave(&ioapic_lock, flags); 1355 spin_lock_irqsave(&ioapic_lock, flags);
1356 __ioapic_write_entry(apic, pin, entry); 1356 __ioapic_write_entry(apic, pin, entry);
1357 set_native_irq_info(irq, TARGET_CPUS); 1357 irq_desc[irq].affinity = TARGET_CPUS;
1358 spin_unlock_irqrestore(&ioapic_lock, flags); 1358 spin_unlock_irqrestore(&ioapic_lock, flags);
1359 } 1359 }
1360 } 1360 }
@@ -2585,7 +2585,7 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
2585 msg.address_lo |= MSI_ADDR_DEST_ID(dest); 2585 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
2586 2586
2587 write_msi_msg(irq, &msg); 2587 write_msi_msg(irq, &msg);
2588 set_native_irq_info(irq, mask); 2588 irq_desc[irq].affinity = mask;
2589} 2589}
2590#endif /* CONFIG_SMP */ 2590#endif /* CONFIG_SMP */
2591 2591
@@ -2669,7 +2669,7 @@ static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
2669 dest = cpu_mask_to_apicid(mask); 2669 dest = cpu_mask_to_apicid(mask);
2670 2670
2671 target_ht_irq(irq, dest); 2671 target_ht_irq(irq, dest);
2672 set_native_irq_info(irq, mask); 2672 irq_desc[irq].affinity = mask;
2673} 2673}
2674#endif 2674#endif
2675 2675
@@ -2875,7 +2875,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2875 2875
2876 spin_lock_irqsave(&ioapic_lock, flags); 2876 spin_lock_irqsave(&ioapic_lock, flags);
2877 __ioapic_write_entry(ioapic, pin, entry); 2877 __ioapic_write_entry(ioapic, pin, entry);
2878 set_native_irq_info(irq, TARGET_CPUS); 2878 irq_desc[irq].affinity = TARGET_CPUS;
2879 spin_unlock_irqrestore(&ioapic_lock, flags); 2879 spin_unlock_irqrestore(&ioapic_lock, flags);
2880 2880
2881 return 0; 2881 return 0;
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
index 0f2ca590bf23..8db8d514c9c0 100644
--- a/arch/i386/kernel/irq.c
+++ b/arch/i386/kernel/irq.c
@@ -18,8 +18,6 @@
18#include <linux/cpu.h> 18#include <linux/cpu.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20 20
21#include <asm/idle.h>
22
23#include <asm/apic.h> 21#include <asm/apic.h>
24#include <asm/uaccess.h> 22#include <asm/uaccess.h>
25 23
@@ -77,7 +75,6 @@ fastcall unsigned int do_IRQ(struct pt_regs *regs)
77 union irq_ctx *curctx, *irqctx; 75 union irq_ctx *curctx, *irqctx;
78 u32 *isp; 76 u32 *isp;
79#endif 77#endif
80 exit_idle();
81 78
82 if (unlikely((unsigned)irq >= NR_IRQS)) { 79 if (unlikely((unsigned)irq >= NR_IRQS)) {
83 printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 80 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index bea304d48cdb..393a67d5d943 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -49,7 +49,6 @@
49#include <asm/i387.h> 49#include <asm/i387.h>
50#include <asm/desc.h> 50#include <asm/desc.h>
51#include <asm/vm86.h> 51#include <asm/vm86.h>
52#include <asm/idle.h>
53#ifdef CONFIG_MATH_EMULATION 52#ifdef CONFIG_MATH_EMULATION
54#include <asm/math_emu.h> 53#include <asm/math_emu.h>
55#endif 54#endif
@@ -82,42 +81,6 @@ void (*pm_idle)(void);
82EXPORT_SYMBOL(pm_idle); 81EXPORT_SYMBOL(pm_idle);
83static DEFINE_PER_CPU(unsigned int, cpu_idle_state); 82static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
84 83
85static ATOMIC_NOTIFIER_HEAD(idle_notifier);
86
87void idle_notifier_register(struct notifier_block *n)
88{
89 atomic_notifier_chain_register(&idle_notifier, n);
90}
91
92void idle_notifier_unregister(struct notifier_block *n)
93{
94 atomic_notifier_chain_unregister(&idle_notifier, n);
95}
96
97static DEFINE_PER_CPU(volatile unsigned long, idle_state);
98
99void enter_idle(void)
100{
101 /* needs to be atomic w.r.t. interrupts, not against other CPUs */
102 __set_bit(0, &__get_cpu_var(idle_state));
103 atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
104}
105
106static void __exit_idle(void)
107{
108 /* needs to be atomic w.r.t. interrupts, not against other CPUs */
109 if (__test_and_clear_bit(0, &__get_cpu_var(idle_state)) == 0)
110 return;
111 atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
112}
113
114void exit_idle(void)
115{
116 if (current->pid)
117 return;
118 __exit_idle();
119}
120
121void disable_hlt(void) 84void disable_hlt(void)
122{ 85{
123 hlt_counter++; 86 hlt_counter++;
@@ -168,7 +131,6 @@ EXPORT_SYMBOL(default_idle);
168 */ 131 */
169static void poll_idle (void) 132static void poll_idle (void)
170{ 133{
171 local_irq_enable();
172 cpu_relax(); 134 cpu_relax();
173} 135}
174 136
@@ -229,16 +191,7 @@ void cpu_idle(void)
229 play_dead(); 191 play_dead();
230 192
231 __get_cpu_var(irq_stat).idle_timestamp = jiffies; 193 __get_cpu_var(irq_stat).idle_timestamp = jiffies;
232
233 /*
234 * Idle routines should keep interrupts disabled
235 * from here on, until they go to idle.
236 * Otherwise, idle callbacks can misfire.
237 */
238 local_irq_disable();
239 enter_idle();
240 idle(); 194 idle();
241 __exit_idle();
242 } 195 }
243 tick_nohz_restart_sched_tick(); 196 tick_nohz_restart_sched_tick();
244 preempt_enable_no_resched(); 197 preempt_enable_no_resched();
@@ -293,11 +246,7 @@ void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
293 __monitor((void *)&current_thread_info()->flags, 0, 0); 246 __monitor((void *)&current_thread_info()->flags, 0, 0);
294 smp_mb(); 247 smp_mb();
295 if (!need_resched()) 248 if (!need_resched())
296 __sti_mwait(eax, ecx); 249 __mwait(eax, ecx);
297 else
298 local_irq_enable();
299 } else {
300 local_irq_enable();
301 } 250 }
302} 251}
303 252
diff --git a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c
index 9bd9637ae692..0e8977871b1f 100644
--- a/arch/i386/kernel/smp.c
+++ b/arch/i386/kernel/smp.c
@@ -23,7 +23,6 @@
23 23
24#include <asm/mtrr.h> 24#include <asm/mtrr.h>
25#include <asm/tlbflush.h> 25#include <asm/tlbflush.h>
26#include <asm/idle.h>
27#include <mach_apic.h> 26#include <mach_apic.h>
28 27
29/* 28/*
@@ -624,7 +623,6 @@ fastcall void smp_call_function_interrupt(struct pt_regs *regs)
624 /* 623 /*
625 * At this point the info structure may be out of scope unless wait==1 624 * At this point the info structure may be out of scope unless wait==1
626 */ 625 */
627 exit_idle();
628 irq_enter(); 626 irq_enter();
629 (*func)(info); 627 (*func)(info);
630 irq_exit(); 628 irq_exit();
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 0d05450c91c4..e7220900ea14 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -60,7 +60,7 @@ static void ia64_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask)
60 msg.address_lo = addr; 60 msg.address_lo = addr;
61 61
62 write_msi_msg(irq, &msg); 62 write_msi_msg(irq, &msg);
63 set_native_irq_info(irq, cpu_mask); 63 irq_desc[irq].affinity = cpu_mask;
64} 64}
65#endif /* CONFIG_SMP */ 65#endif /* CONFIG_SMP */
66 66
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index ea3dc38d73fd..49873aa4a37d 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -204,7 +204,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask)
204 msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff); 204 msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff);
205 205
206 write_msi_msg(irq, &msg); 206 write_msi_msg(irq, &msg);
207 set_native_irq_info(irq, cpu_mask); 207 irq_desc[irq].affinity = cpu_mask;
208} 208}
209#endif /* CONFIG_SMP */ 209#endif /* CONFIG_SMP */
210 210
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index c6f74f1c6398..58e97886d771 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -274,6 +274,7 @@ config MIPS_ATLAS
274 select SYS_SUPPORTS_BIG_ENDIAN 274 select SYS_SUPPORTS_BIG_ENDIAN
275 select SYS_SUPPORTS_LITTLE_ENDIAN 275 select SYS_SUPPORTS_LITTLE_ENDIAN
276 select SYS_SUPPORTS_MULTITHREADING if EXPERIMENTAL 276 select SYS_SUPPORTS_MULTITHREADING if EXPERIMENTAL
277 select SYS_SUPPORTS_SMARTMIPS
277 select GENERIC_HARDIRQS_NO__DO_IRQ 278 select GENERIC_HARDIRQS_NO__DO_IRQ
278 help 279 help
279 This enables support for the MIPS Technologies Atlas evaluation 280 This enables support for the MIPS Technologies Atlas evaluation
@@ -305,6 +306,7 @@ config MIPS_MALTA
305 select SYS_SUPPORTS_BIG_ENDIAN 306 select SYS_SUPPORTS_BIG_ENDIAN
306 select SYS_SUPPORTS_LITTLE_ENDIAN 307 select SYS_SUPPORTS_LITTLE_ENDIAN
307 select SYS_SUPPORTS_MULTITHREADING 308 select SYS_SUPPORTS_MULTITHREADING
309 select SYS_SUPPORTS_SMARTMIPS
308 help 310 help
309 This enables support for the MIPS Technologies Malta evaluation 311 This enables support for the MIPS Technologies Malta evaluation
310 board. 312 board.
@@ -322,6 +324,7 @@ config MIPS_SEAD
322 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 324 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
323 select SYS_SUPPORTS_BIG_ENDIAN 325 select SYS_SUPPORTS_BIG_ENDIAN
324 select SYS_SUPPORTS_LITTLE_ENDIAN 326 select SYS_SUPPORTS_LITTLE_ENDIAN
327 select SYS_SUPPORTS_SMARTMIPS
325 help 328 help
326 This enables support for the MIPS Technologies SEAD evaluation 329 This enables support for the MIPS Technologies SEAD evaluation
327 board. 330 board.
@@ -1641,6 +1644,18 @@ config 64BIT_PHYS_ADDR
1641config CPU_HAS_LLSC 1644config CPU_HAS_LLSC
1642 bool 1645 bool
1643 1646
1647config CPU_HAS_SMARTMIPS
1648 depends on SYS_SUPPORTS_SMARTMIPS
1649 bool "Support for the SmartMIPS ASE"
1650 help
1651 SmartMIPS is a extension of the MIPS32 architecture aimed at
1652 increased security at both hardware and software level for
1653 smartcards. Enabling this option will allow proper use of the
1654 SmartMIPS instructions by Linux applications. However a kernel with
1655 this option will not work on a MIPS core without SmartMIPS core. If
1656 you don't know you probably don't have SmartMIPS and should say N
1657 here.
1658
1644config CPU_HAS_WB 1659config CPU_HAS_WB
1645 bool 1660 bool
1646 1661
@@ -1704,6 +1719,9 @@ config CPU_SUPPORTS_HIGHMEM
1704config SYS_SUPPORTS_HIGHMEM 1719config SYS_SUPPORTS_HIGHMEM
1705 bool 1720 bool
1706 1721
1722config SYS_SUPPORTS_SMARTMIPS
1723 bool
1724
1707config ARCH_FLATMEM_ENABLE 1725config ARCH_FLATMEM_ENABLE
1708 def_bool y 1726 def_bool y
1709 depends on !NUMA 1727 depends on !NUMA
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index c68b5d3e5d18..92bca6ad6ab1 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -103,6 +103,8 @@ predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
103cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) 103cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be))
104cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) 104cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
105 105
106cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips)
107
106cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ 108cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
107 -fno-omit-frame-pointer 109 -fno-omit-frame-pointer
108 110
diff --git a/arch/mips/cobalt/mtd.c b/arch/mips/cobalt/mtd.c
index 01d8ec77fe9c..2b088ef3839a 100644
--- a/arch/mips/cobalt/mtd.c
+++ b/arch/mips/cobalt/mtd.c
@@ -24,7 +24,7 @@
24 24
25static struct mtd_partition cobalt_mtd_partitions[] = { 25static struct mtd_partition cobalt_mtd_partitions[] = {
26 { 26 {
27 .name = "Colo", 27 .name = "firmware",
28 .offset = 0x0, 28 .offset = 0x0,
29 .size = 0x80000, 29 .size = 0x80000,
30 }, 30 },
diff --git a/arch/mips/configs/atlas_defconfig b/arch/mips/configs/atlas_defconfig
index 45874d1038d3..458894933a4c 100644
--- a/arch/mips/configs/atlas_defconfig
+++ b/arch/mips/configs/atlas_defconfig
@@ -139,10 +139,12 @@ CONFIG_MIPS_MT_DISABLED=y
139CONFIG_SYS_SUPPORTS_MULTITHREADING=y 139CONFIG_SYS_SUPPORTS_MULTITHREADING=y
140# CONFIG_64BIT_PHYS_ADDR is not set 140# CONFIG_64BIT_PHYS_ADDR is not set
141CONFIG_CPU_HAS_LLSC=y 141CONFIG_CPU_HAS_LLSC=y
142# CONFIG_CPU_HAS_SMARTMIPS is not set
142CONFIG_CPU_HAS_SYNC=y 143CONFIG_CPU_HAS_SYNC=y
143CONFIG_GENERIC_HARDIRQS=y 144CONFIG_GENERIC_HARDIRQS=y
144CONFIG_GENERIC_IRQ_PROBE=y 145CONFIG_GENERIC_IRQ_PROBE=y
145CONFIG_CPU_SUPPORTS_HIGHMEM=y 146CONFIG_CPU_SUPPORTS_HIGHMEM=y
147CONFIG_SYS_SUPPORTS_SMARTMIPS=y
146CONFIG_ARCH_FLATMEM_ENABLE=y 148CONFIG_ARCH_FLATMEM_ENABLE=y
147CONFIG_SELECT_MEMORY_MODEL=y 149CONFIG_SELECT_MEMORY_MODEL=y
148CONFIG_FLATMEM_MANUAL=y 150CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig
index b4cdd3e7cdfc..aa05e294ea62 100644
--- a/arch/mips/configs/bigsur_defconfig
+++ b/arch/mips/configs/bigsur_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:35 2007 4# Tue Feb 20 21:47:22 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -417,6 +417,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
417# 417#
418# Plug and Play support 418# Plug and Play support
419# 419#
420# CONFIG_PNPACPI is not set
420 421
421# 422#
422# Block devices 423# Block devices
@@ -589,6 +590,7 @@ CONFIG_NET_SB1250_MAC=y
589# CONFIG_TIGON3 is not set 590# CONFIG_TIGON3 is not set
590# CONFIG_BNX2 is not set 591# CONFIG_BNX2 is not set
591# CONFIG_QLA3XXX is not set 592# CONFIG_QLA3XXX is not set
593# CONFIG_ATL1 is not set
592 594
593# 595#
594# Ethernet (10000 Mbit) 596# Ethernet (10000 Mbit)
@@ -1025,7 +1027,6 @@ CONFIG_FORCED_INLINING=y
1025CONFIG_CROSSCOMPILE=y 1027CONFIG_CROSSCOMPILE=y
1026CONFIG_CMDLINE="" 1028CONFIG_CMDLINE=""
1027# CONFIG_DEBUG_STACK_USAGE is not set 1029# CONFIG_DEBUG_STACK_USAGE is not set
1028# CONFIG_KGDB is not set
1029# CONFIG_SB1XXX_CORELIS is not set 1030# CONFIG_SB1XXX_CORELIS is not set
1030# CONFIG_RUNTIME_DEBUG is not set 1031# CONFIG_RUNTIME_DEBUG is not set
1031 1032
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index b05469e0bcd0..b2594fa556f3 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:36 2007 4# Tue Feb 20 21:47:22 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -388,6 +388,7 @@ CONFIG_CONNECTOR=m
388# 388#
389# Plug and Play support 389# Plug and Play support
390# 390#
391# CONFIG_PNPACPI is not set
391 392
392# 393#
393# Block devices 394# Block devices
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index f88c40fc9948..9090a7aba6c1 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Mon Feb 19 14:51:58 2007 4# Tue Feb 20 21:47:24 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -425,7 +425,7 @@ CONFIG_MTD_CFI_UTIL=y
425# CONFIG_MTD_COMPLEX_MAPPINGS is not set 425# CONFIG_MTD_COMPLEX_MAPPINGS is not set
426CONFIG_MTD_PHYSMAP=y 426CONFIG_MTD_PHYSMAP=y
427CONFIG_MTD_PHYSMAP_START=0x0 427CONFIG_MTD_PHYSMAP_START=0x0
428CONFIG_MTD_PHYSMAP_LEN=0 428CONFIG_MTD_PHYSMAP_LEN=0x0
429CONFIG_MTD_PHYSMAP_BANKWIDTH=0 429CONFIG_MTD_PHYSMAP_BANKWIDTH=0
430# CONFIG_MTD_PLATRAM is not set 430# CONFIG_MTD_PLATRAM is not set
431 431
@@ -449,7 +449,6 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=0
449# NAND Flash Device Drivers 449# NAND Flash Device Drivers
450# 450#
451# CONFIG_MTD_NAND is not set 451# CONFIG_MTD_NAND is not set
452# CONFIG_MTD_NAND_CAFE is not set
453 452
454# 453#
455# OneNAND Flash Device Drivers 454# OneNAND Flash Device Drivers
@@ -464,6 +463,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=0
464# 463#
465# Plug and Play support 464# Plug and Play support
466# 465#
466# CONFIG_PNPACPI is not set
467 467
468# 468#
469# Block devices 469# Block devices
@@ -658,6 +658,7 @@ CONFIG_TULIP=y
658# CONFIG_TIGON3 is not set 658# CONFIG_TIGON3 is not set
659# CONFIG_BNX2 is not set 659# CONFIG_BNX2 is not set
660CONFIG_QLA3XXX=y 660CONFIG_QLA3XXX=y
661# CONFIG_ATL1 is not set
661 662
662# 663#
663# Ethernet (10000 Mbit) 664# Ethernet (10000 Mbit)
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index 1db19f1bfd4d..4cb8cf4255a2 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:39 2007 4# Tue Feb 20 21:47:24 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -548,6 +548,7 @@ CONFIG_MTD_ALCHEMY=y
548# 548#
549# Plug and Play support 549# Plug and Play support
550# 550#
551# CONFIG_PNPACPI is not set
551 552
552# 553#
553# Block devices 554# Block devices
@@ -1103,6 +1104,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1103CONFIG_LOG_BUF_SHIFT=14 1104CONFIG_LOG_BUF_SHIFT=14
1104CONFIG_CROSSCOMPILE=y 1105CONFIG_CROSSCOMPILE=y
1105CONFIG_CMDLINE="" 1106CONFIG_CMDLINE=""
1107CONFIG_SYS_SUPPORTS_KGDB=y
1106 1108
1107# 1109#
1108# Security options 1110# Security options
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index 529e6ebe2a8d..d86dedf27fc4 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:39 2007 4# Tue Feb 20 21:47:24 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -537,6 +537,7 @@ CONFIG_MTD_ALCHEMY=y
537# 537#
538# Plug and Play support 538# Plug and Play support
539# 539#
540# CONFIG_PNPACPI is not set
540 541
541# 542#
542# Block devices 543# Block devices
@@ -1103,6 +1104,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1103CONFIG_LOG_BUF_SHIFT=14 1104CONFIG_LOG_BUF_SHIFT=14
1104CONFIG_CROSSCOMPILE=y 1105CONFIG_CROSSCOMPILE=y
1105CONFIG_CMDLINE="" 1106CONFIG_CMDLINE=""
1107CONFIG_SYS_SUPPORTS_KGDB=y
1106 1108
1107# 1109#
1108# Security options 1110# Security options
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index 9e86dcd3c31e..c24b6008345e 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:40 2007 4# Tue Feb 20 21:47:25 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -541,6 +541,7 @@ CONFIG_MTD_NAND_IDS=y
541# 541#
542# Plug and Play support 542# Plug and Play support
543# 543#
544# CONFIG_PNPACPI is not set
544 545
545# 546#
546# Block devices 547# Block devices
@@ -1185,6 +1186,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1185CONFIG_LOG_BUF_SHIFT=14 1186CONFIG_LOG_BUF_SHIFT=14
1186CONFIG_CROSSCOMPILE=y 1187CONFIG_CROSSCOMPILE=y
1187CONFIG_CMDLINE="mem=48M" 1188CONFIG_CMDLINE="mem=48M"
1189CONFIG_SYS_SUPPORTS_KGDB=y
1188 1190
1189# 1191#
1190# Security options 1192# Security options
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index 9c944611edaa..baad2c5223ba 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:41 2007 4# Tue Feb 20 21:47:26 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -542,7 +542,6 @@ CONFIG_MTD_ALCHEMY=y
542# NAND Flash Device Drivers 542# NAND Flash Device Drivers
543# 543#
544# CONFIG_MTD_NAND is not set 544# CONFIG_MTD_NAND is not set
545# CONFIG_MTD_NAND_CAFE is not set
546 545
547# 546#
548# OneNAND Flash Device Drivers 547# OneNAND Flash Device Drivers
@@ -557,6 +556,7 @@ CONFIG_MTD_ALCHEMY=y
557# 556#
558# Plug and Play support 557# Plug and Play support
559# 558#
559# CONFIG_PNPACPI is not set
560 560
561# 561#
562# Block devices 562# Block devices
@@ -715,6 +715,7 @@ CONFIG_MIPS_AU1X00_ENET=y
715# CONFIG_TIGON3 is not set 715# CONFIG_TIGON3 is not set
716# CONFIG_BNX2 is not set 716# CONFIG_BNX2 is not set
717CONFIG_QLA3XXX=m 717CONFIG_QLA3XXX=m
718# CONFIG_ATL1 is not set
718 719
719# 720#
720# Ethernet (10000 Mbit) 721# Ethernet (10000 Mbit)
@@ -1145,6 +1146,7 @@ CONFIG_USB_MON=y
1145# CONFIG_USB_RIO500 is not set 1146# CONFIG_USB_RIO500 is not set
1146# CONFIG_USB_LEGOTOWER is not set 1147# CONFIG_USB_LEGOTOWER is not set
1147# CONFIG_USB_LCD is not set 1148# CONFIG_USB_LCD is not set
1149# CONFIG_USB_BERRY_CHARGE is not set
1148# CONFIG_USB_LED is not set 1150# CONFIG_USB_LED is not set
1149# CONFIG_USB_CYPRESS_CY7C63 is not set 1151# CONFIG_USB_CYPRESS_CY7C63 is not set
1150# CONFIG_USB_CYTHERM is not set 1152# CONFIG_USB_CYTHERM is not set
@@ -1402,6 +1404,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1402CONFIG_LOG_BUF_SHIFT=14 1404CONFIG_LOG_BUF_SHIFT=14
1403CONFIG_CROSSCOMPILE=y 1405CONFIG_CROSSCOMPILE=y
1404CONFIG_CMDLINE="" 1406CONFIG_CMDLINE=""
1407CONFIG_SYS_SUPPORTS_KGDB=y
1405 1408
1406# 1409#
1407# Security options 1410# Security options
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index 5b18d5da9858..c29fdab0423a 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:42 2007 4# Tue Feb 20 21:47:27 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -562,6 +562,7 @@ CONFIG_MTD_NAND_AU1550=m
562# 562#
563# Plug and Play support 563# Plug and Play support
564# 564#
565# CONFIG_PNPACPI is not set
565 566
566# 567#
567# Block devices 568# Block devices
@@ -751,6 +752,7 @@ CONFIG_MIPS_AU1X00_ENET=y
751# CONFIG_TIGON3 is not set 752# CONFIG_TIGON3 is not set
752# CONFIG_BNX2 is not set 753# CONFIG_BNX2 is not set
753CONFIG_QLA3XXX=m 754CONFIG_QLA3XXX=m
755# CONFIG_ATL1 is not set
754 756
755# 757#
756# Ethernet (10000 Mbit) 758# Ethernet (10000 Mbit)
@@ -1219,6 +1221,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1219CONFIG_LOG_BUF_SHIFT=14 1221CONFIG_LOG_BUF_SHIFT=14
1220CONFIG_CROSSCOMPILE=y 1222CONFIG_CROSSCOMPILE=y
1221CONFIG_CMDLINE="" 1223CONFIG_CMDLINE=""
1224CONFIG_SYS_SUPPORTS_KGDB=y
1222 1225
1223# 1226#
1224# Security options 1227# Security options
diff --git a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
index 121018886189..f4b316d2cd70 100644
--- a/arch/mips/configs/ddb5477_defconfig
+++ b/arch/mips/configs/ddb5477_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:43 2007 4# Tue Feb 20 21:47:28 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -386,6 +386,7 @@ CONFIG_PROC_EVENTS=y
386# 386#
387# Plug and Play support 387# Plug and Play support
388# 388#
389# CONFIG_PNPACPI is not set
389 390
390# 391#
391# Block devices 392# Block devices
@@ -925,6 +926,7 @@ CONFIG_ENABLE_MUST_CHECK=y
925CONFIG_LOG_BUF_SHIFT=14 926CONFIG_LOG_BUF_SHIFT=14
926CONFIG_CROSSCOMPILE=y 927CONFIG_CROSSCOMPILE=y
927CONFIG_CMDLINE="ip=any" 928CONFIG_CMDLINE="ip=any"
929CONFIG_SYS_SUPPORTS_KGDB=y
928 930
929# 931#
930# Security options 932# Security options
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index 2d717455a82f..9c38e5c77761 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:44 2007 4# Tue Feb 20 21:47:28 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -398,6 +398,7 @@ CONFIG_CONNECTOR=m
398# 398#
399# Plug and Play support 399# Plug and Play support
400# 400#
401# CONFIG_PNPACPI is not set
401 402
402# 403#
403# Block devices 404# Block devices
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index 0ee2fbb35f14..922af379aa41 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:44 2007 4# Tue Feb 20 21:47:28 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -294,6 +294,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
294# Plug and Play support 294# Plug and Play support
295# 295#
296# CONFIG_PNP is not set 296# CONFIG_PNP is not set
297# CONFIG_PNPACPI is not set
297 298
298# 299#
299# Block devices 300# Block devices
diff --git a/arch/mips/configs/emma2rh_defconfig b/arch/mips/configs/emma2rh_defconfig
index 218fe6e5f2db..c0db8f14713d 100644
--- a/arch/mips/configs/emma2rh_defconfig
+++ b/arch/mips/configs/emma2rh_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:46 2007 4# Tue Feb 20 21:47:29 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -611,7 +611,6 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
611# NAND Flash Device Drivers 611# NAND Flash Device Drivers
612# 612#
613# CONFIG_MTD_NAND is not set 613# CONFIG_MTD_NAND is not set
614# CONFIG_MTD_NAND_CAFE is not set
615 614
616# 615#
617# OneNAND Flash Device Drivers 616# OneNAND Flash Device Drivers
@@ -626,6 +625,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
626# 625#
627# Plug and Play support 626# Plug and Play support
628# 627#
628# CONFIG_PNPACPI is not set
629 629
630# 630#
631# Block devices 631# Block devices
@@ -1039,6 +1039,7 @@ CONFIG_HWMON=y
1039# CONFIG_SENSORS_ADM1021 is not set 1039# CONFIG_SENSORS_ADM1021 is not set
1040# CONFIG_SENSORS_ADM1025 is not set 1040# CONFIG_SENSORS_ADM1025 is not set
1041# CONFIG_SENSORS_ADM1026 is not set 1041# CONFIG_SENSORS_ADM1026 is not set
1042# CONFIG_SENSORS_ADM1029 is not set
1042# CONFIG_SENSORS_ADM1031 is not set 1043# CONFIG_SENSORS_ADM1031 is not set
1043# CONFIG_SENSORS_ADM9240 is not set 1044# CONFIG_SENSORS_ADM9240 is not set
1044# CONFIG_SENSORS_ASB100 is not set 1045# CONFIG_SENSORS_ASB100 is not set
diff --git a/arch/mips/configs/ev64120_defconfig b/arch/mips/configs/ev64120_defconfig
index 5ad4870ad5eb..ce088b36291d 100644
--- a/arch/mips/configs/ev64120_defconfig
+++ b/arch/mips/configs/ev64120_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:46 2007 4# Tue Feb 20 21:47:30 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -391,6 +391,7 @@ CONFIG_CONNECTOR=m
391# 391#
392# Plug and Play support 392# Plug and Play support
393# 393#
394# CONFIG_PNPACPI is not set
394 395
395# 396#
396# Block devices 397# Block devices
@@ -520,6 +521,7 @@ CONFIG_NET_ETHERNET=y
520# CONFIG_TIGON3 is not set 521# CONFIG_TIGON3 is not set
521# CONFIG_BNX2 is not set 522# CONFIG_BNX2 is not set
522CONFIG_QLA3XXX=m 523CONFIG_QLA3XXX=m
524# CONFIG_ATL1 is not set
523 525
524# 526#
525# Ethernet (10000 Mbit) 527# Ethernet (10000 Mbit)
@@ -914,6 +916,7 @@ CONFIG_ENABLE_MUST_CHECK=y
914CONFIG_LOG_BUF_SHIFT=14 916CONFIG_LOG_BUF_SHIFT=14
915CONFIG_CROSSCOMPILE=y 917CONFIG_CROSSCOMPILE=y
916CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.1.1:/mnt/disk2/fs.gal ip=192.168.1.211:192.168.1.1:::gt::" 918CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.1.1:/mnt/disk2/fs.gal ip=192.168.1.211:192.168.1.1:::gt::"
919CONFIG_SYS_SUPPORTS_KGDB=y
917 920
918# 921#
919# Security options 922# Security options
diff --git a/arch/mips/configs/excite_defconfig b/arch/mips/configs/excite_defconfig
index 5e179fe599b3..82f204d080b7 100644
--- a/arch/mips/configs/excite_defconfig
+++ b/arch/mips/configs/excite_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:47 2007 4# Tue Feb 20 21:47:31 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -451,6 +451,7 @@ CONFIG_MTD_NAND_VERIFY_WRITE=y
451# CONFIG_MTD_NAND_ECC_SMC is not set 451# CONFIG_MTD_NAND_ECC_SMC is not set
452CONFIG_MTD_NAND_IDS=y 452CONFIG_MTD_NAND_IDS=y
453# CONFIG_MTD_NAND_DISKONCHIP is not set 453# CONFIG_MTD_NAND_DISKONCHIP is not set
454# CONFIG_MTD_NAND_BASLER_EXCITE is not set
454# CONFIG_MTD_NAND_CAFE is not set 455# CONFIG_MTD_NAND_CAFE is not set
455# CONFIG_MTD_NAND_NANDSIM is not set 456# CONFIG_MTD_NAND_NANDSIM is not set
456 457
@@ -467,6 +468,7 @@ CONFIG_MTD_NAND_IDS=y
467# 468#
468# Plug and Play support 469# Plug and Play support
469# 470#
471# CONFIG_PNPACPI is not set
470 472
471# 473#
472# Block devices 474# Block devices
@@ -638,6 +640,7 @@ CONFIG_NETDEVICES=y
638# CONFIG_TIGON3 is not set 640# CONFIG_TIGON3 is not set
639# CONFIG_BNX2 is not set 641# CONFIG_BNX2 is not set
640CONFIG_QLA3XXX=m 642CONFIG_QLA3XXX=m
643# CONFIG_ATL1 is not set
641 644
642# 645#
643# Ethernet (10000 Mbit) 646# Ethernet (10000 Mbit)
@@ -1008,6 +1011,7 @@ CONFIG_USB_HID=m
1008# CONFIG_USB_RIO500 is not set 1011# CONFIG_USB_RIO500 is not set
1009# CONFIG_USB_LEGOTOWER is not set 1012# CONFIG_USB_LEGOTOWER is not set
1010# CONFIG_USB_LCD is not set 1013# CONFIG_USB_LCD is not set
1014# CONFIG_USB_BERRY_CHARGE is not set
1011# CONFIG_USB_LED is not set 1015# CONFIG_USB_LED is not set
1012# CONFIG_USB_CYPRESS_CY7C63 is not set 1016# CONFIG_USB_CYPRESS_CY7C63 is not set
1013# CONFIG_USB_CYTHERM is not set 1017# CONFIG_USB_CYTHERM is not set
@@ -1277,6 +1281,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1277CONFIG_LOG_BUF_SHIFT=14 1281CONFIG_LOG_BUF_SHIFT=14
1278CONFIG_CROSSCOMPILE=y 1282CONFIG_CROSSCOMPILE=y
1279CONFIG_CMDLINE="" 1283CONFIG_CMDLINE=""
1284CONFIG_SYS_SUPPORTS_KGDB=y
1280 1285
1281# 1286#
1282# Security options 1287# Security options
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index 864de219eb67..cb81f13bd45a 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:48 2007 4# Tue Feb 20 21:47:32 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -620,6 +620,7 @@ CONFIG_CONNECTOR=m
620# 620#
621# Plug and Play support 621# Plug and Play support
622# 622#
623# CONFIG_PNPACPI is not set
623 624
624# 625#
625# Block devices 626# Block devices
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 7b2f5f8397a2..46f6ac4083b9 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:49 2007 4# Tue Feb 20 21:47:32 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -456,6 +456,7 @@ CONFIG_CONNECTOR=m
456# 456#
457# Plug and Play support 457# Plug and Play support
458# 458#
459# CONFIG_PNPACPI is not set
459 460
460# 461#
461# Block devices 462# Block devices
@@ -672,6 +673,7 @@ CONFIG_SGI_IOC3_ETH=y
672# CONFIG_TIGON3 is not set 673# CONFIG_TIGON3 is not set
673# CONFIG_BNX2 is not set 674# CONFIG_BNX2 is not set
674CONFIG_QLA3XXX=m 675CONFIG_QLA3XXX=m
676# CONFIG_ATL1 is not set
675 677
676# 678#
677# Ethernet (10000 Mbit) 679# Ethernet (10000 Mbit)
@@ -1060,6 +1062,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1060CONFIG_LOG_BUF_SHIFT=15 1062CONFIG_LOG_BUF_SHIFT=15
1061CONFIG_CROSSCOMPILE=y 1063CONFIG_CROSSCOMPILE=y
1062CONFIG_CMDLINE="" 1064CONFIG_CMDLINE=""
1065CONFIG_SYS_SUPPORTS_KGDB=y
1063 1066
1064# 1067#
1065# Security options 1068# Security options
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index 14398e8a1768..d9e5000d5329 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:50 2007 4# Tue Feb 20 21:47:33 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -396,6 +396,7 @@ CONFIG_PROC_EVENTS=y
396# 396#
397# Plug and Play support 397# Plug and Play support
398# 398#
399# CONFIG_PNPACPI is not set
399 400
400# 401#
401# Block devices 402# Block devices
@@ -600,6 +601,7 @@ CONFIG_SGI_O2MACE_ETH=y
600# CONFIG_TIGON3 is not set 601# CONFIG_TIGON3 is not set
601# CONFIG_BNX2 is not set 602# CONFIG_BNX2 is not set
602CONFIG_QLA3XXX=y 603CONFIG_QLA3XXX=y
604# CONFIG_ATL1 is not set
603 605
604# 606#
605# Ethernet (10000 Mbit) 607# Ethernet (10000 Mbit)
diff --git a/arch/mips/configs/jaguar-atx_defconfig b/arch/mips/configs/jaguar-atx_defconfig
index b38978794a5a..57ef0c45a62b 100644
--- a/arch/mips/configs/jaguar-atx_defconfig
+++ b/arch/mips/configs/jaguar-atx_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:51 2007 4# Tue Feb 20 21:47:33 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -375,6 +375,7 @@ CONFIG_CONNECTOR=m
375# 375#
376# Plug and Play support 376# Plug and Play support
377# 377#
378# CONFIG_PNPACPI is not set
378 379
379# 380#
380# Block devices 381# Block devices
@@ -518,9 +519,6 @@ CONFIG_EEPRO100=y
518# CONFIG_TIGON3 is not set 519# CONFIG_TIGON3 is not set
519# CONFIG_BNX2 is not set 520# CONFIG_BNX2 is not set
520CONFIG_MV643XX_ETH=y 521CONFIG_MV643XX_ETH=y
521CONFIG_MV643XX_ETH_0=y
522CONFIG_MV643XX_ETH_1=y
523CONFIG_MV643XX_ETH_2=y
524CONFIG_QLA3XXX=m 522CONFIG_QLA3XXX=m
525 523
526# 524#
@@ -833,6 +831,7 @@ CONFIG_ENABLE_MUST_CHECK=y
833CONFIG_LOG_BUF_SHIFT=14 831CONFIG_LOG_BUF_SHIFT=14
834CONFIG_CROSSCOMPILE=y 832CONFIG_CROSSCOMPILE=y
835CONFIG_CMDLINE="" 833CONFIG_CMDLINE=""
834CONFIG_SYS_SUPPORTS_KGDB=y
836 835
837# 836#
838# Security options 837# Security options
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig
index dacf0a618d57..21d979f8326c 100644
--- a/arch/mips/configs/jazz_defconfig
+++ b/arch/mips/configs/jazz_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:52 2007 4# Tue Feb 20 21:47:33 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -646,6 +646,7 @@ CONFIG_PARPORT_1284=y
646# Plug and Play support 646# Plug and Play support
647# 647#
648# CONFIG_PNP is not set 648# CONFIG_PNP is not set
649# CONFIG_PNPACPI is not set
649 650
650# 651#
651# Block devices 652# Block devices
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index 29ed772455f1..9ebb522fbbbd 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:53 2007 4# Tue Feb 20 21:47:34 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -384,6 +384,7 @@ CONFIG_PROC_EVENTS=y
384# 384#
385# Plug and Play support 385# Plug and Play support
386# 386#
387# CONFIG_PNPACPI is not set
387 388
388# 389#
389# Block devices 390# Block devices
@@ -513,6 +514,7 @@ CONFIG_NET_ETHERNET=y
513# CONFIG_TIGON3 is not set 514# CONFIG_TIGON3 is not set
514# CONFIG_BNX2 is not set 515# CONFIG_BNX2 is not set
515CONFIG_QLA3XXX=y 516CONFIG_QLA3XXX=y
517# CONFIG_ATL1 is not set
516 518
517# 519#
518# Ethernet (10000 Mbit) 520# Ethernet (10000 Mbit)
diff --git a/arch/mips/configs/lasat200_defconfig b/arch/mips/configs/lasat200_defconfig
index a1437b34e18f..b3f767ff1c5a 100644
--- a/arch/mips/configs/lasat200_defconfig
+++ b/arch/mips/configs/lasat200_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:54 2007 4# Tue Feb 20 21:47:34 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -454,7 +454,6 @@ CONFIG_MTD_LASAT=y
454# NAND Flash Device Drivers 454# NAND Flash Device Drivers
455# 455#
456# CONFIG_MTD_NAND is not set 456# CONFIG_MTD_NAND is not set
457# CONFIG_MTD_NAND_CAFE is not set
458 457
459# 458#
460# OneNAND Flash Device Drivers 459# OneNAND Flash Device Drivers
@@ -469,6 +468,7 @@ CONFIG_MTD_LASAT=y
469# 468#
470# Plug and Play support 469# Plug and Play support
471# 470#
471# CONFIG_PNPACPI is not set
472 472
473# 473#
474# Block devices 474# Block devices
@@ -654,6 +654,7 @@ CONFIG_NET_ETHERNET=y
654# CONFIG_TIGON3 is not set 654# CONFIG_TIGON3 is not set
655# CONFIG_BNX2 is not set 655# CONFIG_BNX2 is not set
656CONFIG_QLA3XXX=m 656CONFIG_QLA3XXX=m
657# CONFIG_ATL1 is not set
657 658
658# 659#
659# Ethernet (10000 Mbit) 660# Ethernet (10000 Mbit)
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 8d21bb96349e..a5f379d626d6 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -145,6 +145,7 @@ CONFIG_SYS_SUPPORTS_MULTITHREADING=y
145CONFIG_MIPS_MT_FPAFF=y 145CONFIG_MIPS_MT_FPAFF=y
146# CONFIG_64BIT_PHYS_ADDR is not set 146# CONFIG_64BIT_PHYS_ADDR is not set
147CONFIG_CPU_HAS_LLSC=y 147CONFIG_CPU_HAS_LLSC=y
148# CONFIG_CPU_HAS_SMARTMIPS is not set
148CONFIG_CPU_MIPSR2_IRQ_VI=y 149CONFIG_CPU_MIPSR2_IRQ_VI=y
149CONFIG_CPU_MIPSR2_SRS=y 150CONFIG_CPU_MIPSR2_SRS=y
150CONFIG_CPU_HAS_SYNC=y 151CONFIG_CPU_HAS_SYNC=y
@@ -152,6 +153,7 @@ CONFIG_GENERIC_HARDIRQS=y
152CONFIG_GENERIC_IRQ_PROBE=y 153CONFIG_GENERIC_IRQ_PROBE=y
153CONFIG_IRQ_PER_CPU=y 154CONFIG_IRQ_PER_CPU=y
154CONFIG_CPU_SUPPORTS_HIGHMEM=y 155CONFIG_CPU_SUPPORTS_HIGHMEM=y
156CONFIG_SYS_SUPPORTS_SMARTMIPS=y
155CONFIG_ARCH_FLATMEM_ENABLE=y 157CONFIG_ARCH_FLATMEM_ENABLE=y
156CONFIG_SELECT_MEMORY_MODEL=y 158CONFIG_SELECT_MEMORY_MODEL=y
157CONFIG_FLATMEM_MANUAL=y 159CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index 2acb99bf2eca..5ff53e184912 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:56 2007 4# Tue Feb 20 21:47:35 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -436,6 +436,7 @@ CONFIG_FIB_RULES=y
436# 436#
437# Plug and Play support 437# Plug and Play support
438# 438#
439# CONFIG_PNPACPI is not set
439 440
440# 441#
441# Block devices 442# Block devices
@@ -878,7 +879,6 @@ CONFIG_FORCED_INLINING=y
878CONFIG_CROSSCOMPILE=y 879CONFIG_CROSSCOMPILE=y
879CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp" 880CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp"
880# CONFIG_DEBUG_STACK_USAGE is not set 881# CONFIG_DEBUG_STACK_USAGE is not set
881# CONFIG_KGDB is not set
882# CONFIG_RUNTIME_DEBUG is not set 882# CONFIG_RUNTIME_DEBUG is not set
883# CONFIG_MIPS_UNCACHED is not set 883# CONFIG_MIPS_UNCACHED is not set
884 884
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index d52a5a4877da..750e6445c613 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:56 2007 4# Tue Feb 20 21:47:35 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -405,6 +405,7 @@ CONFIG_CONNECTOR=m
405# 405#
406# Plug and Play support 406# Plug and Play support
407# 407#
408# CONFIG_PNPACPI is not set
408 409
409# 410#
410# Block devices 411# Block devices
@@ -531,6 +532,7 @@ CONFIG_MII=m
531# CONFIG_TIGON3 is not set 532# CONFIG_TIGON3 is not set
532# CONFIG_BNX2 is not set 533# CONFIG_BNX2 is not set
533CONFIG_QLA3XXX=m 534CONFIG_QLA3XXX=m
535# CONFIG_ATL1 is not set
534 536
535# 537#
536# Ethernet (10000 Mbit) 538# Ethernet (10000 Mbit)
@@ -883,6 +885,7 @@ CONFIG_USB_PEGASUS=m
883# CONFIG_USB_RIO500 is not set 885# CONFIG_USB_RIO500 is not set
884# CONFIG_USB_LEGOTOWER is not set 886# CONFIG_USB_LEGOTOWER is not set
885# CONFIG_USB_LCD is not set 887# CONFIG_USB_LCD is not set
888# CONFIG_USB_BERRY_CHARGE is not set
886# CONFIG_USB_LED is not set 889# CONFIG_USB_LED is not set
887# CONFIG_USB_CYPRESS_CY7C63 is not set 890# CONFIG_USB_CYPRESS_CY7C63 is not set
888# CONFIG_USB_CYTHERM is not set 891# CONFIG_USB_CYTHERM is not set
diff --git a/arch/mips/configs/ocelot_3_defconfig b/arch/mips/configs/ocelot_3_defconfig
index 746106b88bab..2febd0a7fba2 100644
--- a/arch/mips/configs/ocelot_3_defconfig
+++ b/arch/mips/configs/ocelot_3_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:58 2007 4# Tue Feb 20 21:47:35 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -496,6 +496,7 @@ CONFIG_CONNECTOR=m
496# 496#
497# Plug and Play support 497# Plug and Play support
498# 498#
499# CONFIG_PNPACPI is not set
499 500
500# 501#
501# Block devices 502# Block devices
@@ -713,9 +714,6 @@ CONFIG_E100=y
713# CONFIG_TIGON3 is not set 714# CONFIG_TIGON3 is not set
714# CONFIG_BNX2 is not set 715# CONFIG_BNX2 is not set
715CONFIG_MV643XX_ETH=y 716CONFIG_MV643XX_ETH=y
716CONFIG_MV643XX_ETH_0=y
717CONFIG_MV643XX_ETH_1=y
718CONFIG_MV643XX_ETH_2=y
719CONFIG_QLA3XXX=m 717CONFIG_QLA3XXX=m
720# CONFIG_ATL1 is not set 718# CONFIG_ATL1 is not set
721 719
diff --git a/arch/mips/configs/ocelot_c_defconfig b/arch/mips/configs/ocelot_c_defconfig
index 4b32b270df39..b8f457300bbf 100644
--- a/arch/mips/configs/ocelot_c_defconfig
+++ b/arch/mips/configs/ocelot_c_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:58 2007 4# Tue Feb 20 21:47:36 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -393,6 +393,7 @@ CONFIG_PROC_EVENTS=y
393# 393#
394# Plug and Play support 394# Plug and Play support
395# 395#
396# CONFIG_PNPACPI is not set
396 397
397# 398#
398# Block devices 399# Block devices
@@ -523,6 +524,7 @@ CONFIG_NET_ETHERNET=y
523# CONFIG_BNX2 is not set 524# CONFIG_BNX2 is not set
524# CONFIG_MV643XX_ETH is not set 525# CONFIG_MV643XX_ETH is not set
525CONFIG_QLA3XXX=y 526CONFIG_QLA3XXX=y
527# CONFIG_ATL1 is not set
526 528
527# 529#
528# Ethernet (10000 Mbit) 530# Ethernet (10000 Mbit)
diff --git a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
index 674631b09c99..8ade072271cd 100644
--- a/arch/mips/configs/ocelot_defconfig
+++ b/arch/mips/configs/ocelot_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:59 2007 4# Tue Feb 20 21:47:36 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -390,6 +390,7 @@ CONFIG_PROC_EVENTS=y
390# 390#
391# Plug and Play support 391# Plug and Play support
392# 392#
393# CONFIG_PNPACPI is not set
393 394
394# 395#
395# Block devices 396# Block devices
@@ -854,6 +855,7 @@ CONFIG_ENABLE_MUST_CHECK=y
854CONFIG_LOG_BUF_SHIFT=14 855CONFIG_LOG_BUF_SHIFT=14
855CONFIG_CROSSCOMPILE=y 856CONFIG_CROSSCOMPILE=y
856CONFIG_CMDLINE="" 857CONFIG_CMDLINE=""
858CONFIG_SYS_SUPPORTS_KGDB=y
857 859
858# 860#
859# Security options 861# Security options
diff --git a/arch/mips/configs/ocelot_g_defconfig b/arch/mips/configs/ocelot_g_defconfig
index 260026392347..d20a2216c11d 100644
--- a/arch/mips/configs/ocelot_g_defconfig
+++ b/arch/mips/configs/ocelot_g_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:00 2007 4# Tue Feb 20 21:47:36 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -392,6 +392,7 @@ CONFIG_PROC_EVENTS=y
392# 392#
393# Plug and Play support 393# Plug and Play support
394# 394#
395# CONFIG_PNPACPI is not set
395 396
396# 397#
397# Block devices 398# Block devices
@@ -522,6 +523,7 @@ CONFIG_GALILEO_64240_ETH=y
522# CONFIG_TIGON3 is not set 523# CONFIG_TIGON3 is not set
523# CONFIG_BNX2 is not set 524# CONFIG_BNX2 is not set
524CONFIG_QLA3XXX=y 525CONFIG_QLA3XXX=y
526# CONFIG_ATL1 is not set
525 527
526# 528#
527# Ethernet (10000 Mbit) 529# Ethernet (10000 Mbit)
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index 05a33a2aeb25..33fcc8133bc0 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:01 2007 4# Tue Feb 20 21:47:37 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -549,6 +549,7 @@ CONFIG_MTD_ALCHEMY=y
549# 549#
550# Plug and Play support 550# Plug and Play support
551# 551#
552# CONFIG_PNPACPI is not set
552 553
553# 554#
554# Block devices 555# Block devices
@@ -1096,6 +1097,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1096CONFIG_LOG_BUF_SHIFT=14 1097CONFIG_LOG_BUF_SHIFT=14
1097CONFIG_CROSSCOMPILE=y 1098CONFIG_CROSSCOMPILE=y
1098CONFIG_CMDLINE="" 1099CONFIG_CMDLINE=""
1100CONFIG_SYS_SUPPORTS_KGDB=y
1099 1101
1100# 1102#
1101# Security options 1103# Security options
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index 34a6bee589bd..e07c55dc8dc1 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:02 2007 4# Tue Feb 20 21:47:37 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -541,7 +541,6 @@ CONFIG_MTD_ALCHEMY=y
541# NAND Flash Device Drivers 541# NAND Flash Device Drivers
542# 542#
543# CONFIG_MTD_NAND is not set 543# CONFIG_MTD_NAND is not set
544# CONFIG_MTD_NAND_CAFE is not set
545 544
546# 545#
547# OneNAND Flash Device Drivers 546# OneNAND Flash Device Drivers
@@ -556,6 +555,7 @@ CONFIG_MTD_ALCHEMY=y
556# 555#
557# Plug and Play support 556# Plug and Play support
558# 557#
558# CONFIG_PNPACPI is not set
559 559
560# 560#
561# Block devices 561# Block devices
@@ -745,6 +745,7 @@ CONFIG_MIPS_AU1X00_ENET=y
745# CONFIG_TIGON3 is not set 745# CONFIG_TIGON3 is not set
746# CONFIG_BNX2 is not set 746# CONFIG_BNX2 is not set
747CONFIG_QLA3XXX=m 747CONFIG_QLA3XXX=m
748# CONFIG_ATL1 is not set
748 749
749# 750#
750# Ethernet (10000 Mbit) 751# Ethernet (10000 Mbit)
@@ -1213,6 +1214,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1213CONFIG_LOG_BUF_SHIFT=14 1214CONFIG_LOG_BUF_SHIFT=14
1214CONFIG_CROSSCOMPILE=y 1215CONFIG_CROSSCOMPILE=y
1215CONFIG_CMDLINE="" 1216CONFIG_CMDLINE=""
1217CONFIG_SYS_SUPPORTS_KGDB=y
1216 1218
1217# 1219#
1218# Security options 1220# Security options
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index e3bff462e62e..df210dd22476 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:03 2007 4# Tue Feb 20 21:47:37 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -542,7 +542,6 @@ CONFIG_MTD_ALCHEMY=y
542# NAND Flash Device Drivers 542# NAND Flash Device Drivers
543# 543#
544# CONFIG_MTD_NAND is not set 544# CONFIG_MTD_NAND is not set
545# CONFIG_MTD_NAND_CAFE is not set
546 545
547# 546#
548# OneNAND Flash Device Drivers 547# OneNAND Flash Device Drivers
@@ -557,6 +556,7 @@ CONFIG_MTD_ALCHEMY=y
557# 556#
558# Plug and Play support 557# Plug and Play support
559# 558#
559# CONFIG_PNPACPI is not set
560 560
561# 561#
562# Block devices 562# Block devices
@@ -746,6 +746,7 @@ CONFIG_MIPS_AU1X00_ENET=y
746# CONFIG_TIGON3 is not set 746# CONFIG_TIGON3 is not set
747# CONFIG_BNX2 is not set 747# CONFIG_BNX2 is not set
748CONFIG_QLA3XXX=m 748CONFIG_QLA3XXX=m
749# CONFIG_ATL1 is not set
749 750
750# 751#
751# Ethernet (10000 Mbit) 752# Ethernet (10000 Mbit)
@@ -1206,6 +1207,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1206CONFIG_LOG_BUF_SHIFT=14 1207CONFIG_LOG_BUF_SHIFT=14
1207CONFIG_CROSSCOMPILE=y 1208CONFIG_CROSSCOMPILE=y
1208CONFIG_CMDLINE="" 1209CONFIG_CMDLINE=""
1210CONFIG_SYS_SUPPORTS_KGDB=y
1209 1211
1210# 1212#
1211# Security options 1213# Security options
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 009b3f87b44e..106a1641c0b5 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:04 2007 4# Tue Feb 20 21:47:38 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -389,6 +389,7 @@ CONFIG_FW_LOADER=y
389# 389#
390# Plug and Play support 390# Plug and Play support
391# 391#
392# CONFIG_PNPACPI is not set
392 393
393# 394#
394# Block devices 395# Block devices
@@ -962,6 +963,7 @@ CONFIG_USB_MON=y
962# CONFIG_USB_RIO500 is not set 963# CONFIG_USB_RIO500 is not set
963# CONFIG_USB_LEGOTOWER is not set 964# CONFIG_USB_LEGOTOWER is not set
964# CONFIG_USB_LCD is not set 965# CONFIG_USB_LCD is not set
966# CONFIG_USB_BERRY_CHARGE is not set
965# CONFIG_USB_LED is not set 967# CONFIG_USB_LED is not set
966# CONFIG_USB_CYPRESS_CY7C63 is not set 968# CONFIG_USB_CYPRESS_CY7C63 is not set
967# CONFIG_USB_CYTHERM is not set 969# CONFIG_USB_CYTHERM is not set
@@ -1229,6 +1231,7 @@ CONFIG_CROSSCOMPILE=y
1229CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp" 1231CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp"
1230# CONFIG_DEBUG_STACK_USAGE is not set 1232# CONFIG_DEBUG_STACK_USAGE is not set
1231# CONFIG_KGDB is not set 1233# CONFIG_KGDB is not set
1234CONFIG_SYS_SUPPORTS_KGDB=y
1232# CONFIG_RUNTIME_DEBUG is not set 1235# CONFIG_RUNTIME_DEBUG is not set
1233# CONFIG_MIPS_UNCACHED is not set 1236# CONFIG_MIPS_UNCACHED is not set
1234 1237
diff --git a/arch/mips/configs/pnx8550-stb810_defconfig b/arch/mips/configs/pnx8550-stb810_defconfig
index 5bd377bdbb2c..8caa2cd1aa7c 100644
--- a/arch/mips/configs/pnx8550-stb810_defconfig
+++ b/arch/mips/configs/pnx8550-stb810_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:04 2007 4# Tue Feb 20 21:47:38 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -386,6 +386,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
386# 386#
387# Plug and Play support 387# Plug and Play support
388# 388#
389# CONFIG_PNPACPI is not set
389 390
390# 391#
391# Block devices 392# Block devices
@@ -952,6 +953,7 @@ CONFIG_USB_MON=y
952# CONFIG_USB_RIO500 is not set 953# CONFIG_USB_RIO500 is not set
953# CONFIG_USB_LEGOTOWER is not set 954# CONFIG_USB_LEGOTOWER is not set
954# CONFIG_USB_LCD is not set 955# CONFIG_USB_LCD is not set
956# CONFIG_USB_BERRY_CHARGE is not set
955# CONFIG_USB_LED is not set 957# CONFIG_USB_LED is not set
956# CONFIG_USB_CYPRESS_CY7C63 is not set 958# CONFIG_USB_CYPRESS_CY7C63 is not set
957# CONFIG_USB_CYTHERM is not set 959# CONFIG_USB_CYTHERM is not set
@@ -1219,6 +1221,7 @@ CONFIG_CROSSCOMPILE=y
1219CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp" 1221CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp"
1220# CONFIG_DEBUG_STACK_USAGE is not set 1222# CONFIG_DEBUG_STACK_USAGE is not set
1221# CONFIG_KGDB is not set 1223# CONFIG_KGDB is not set
1224CONFIG_SYS_SUPPORTS_KGDB=y
1222# CONFIG_RUNTIME_DEBUG is not set 1225# CONFIG_RUNTIME_DEBUG is not set
1223# CONFIG_MIPS_UNCACHED is not set 1226# CONFIG_MIPS_UNCACHED is not set
1224 1227
diff --git a/arch/mips/configs/pnx8550-v2pci_defconfig b/arch/mips/configs/pnx8550-v2pci_defconfig
index cc694709ba65..43f1becec2a4 100644
--- a/arch/mips/configs/pnx8550-v2pci_defconfig
+++ b/arch/mips/configs/pnx8550-v2pci_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:06 2007 4# Tue Feb 20 21:47:39 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -474,6 +474,7 @@ CONFIG_FW_LOADER=y
474# 474#
475# Plug and Play support 475# Plug and Play support
476# 476#
477# CONFIG_PNPACPI is not set
477 478
478# 479#
479# Block devices 480# Block devices
@@ -987,6 +988,7 @@ CONFIG_HWMON=y
987# CONFIG_SENSORS_ADM1021 is not set 988# CONFIG_SENSORS_ADM1021 is not set
988# CONFIG_SENSORS_ADM1025 is not set 989# CONFIG_SENSORS_ADM1025 is not set
989# CONFIG_SENSORS_ADM1026 is not set 990# CONFIG_SENSORS_ADM1026 is not set
991# CONFIG_SENSORS_ADM1029 is not set
990# CONFIG_SENSORS_ADM1031 is not set 992# CONFIG_SENSORS_ADM1031 is not set
991# CONFIG_SENSORS_ADM9240 is not set 993# CONFIG_SENSORS_ADM9240 is not set
992# CONFIG_SENSORS_ASB100 is not set 994# CONFIG_SENSORS_ASB100 is not set
@@ -1209,6 +1211,7 @@ CONFIG_USB_MON=y
1209# CONFIG_USB_RIO500 is not set 1211# CONFIG_USB_RIO500 is not set
1210# CONFIG_USB_LEGOTOWER is not set 1212# CONFIG_USB_LEGOTOWER is not set
1211# CONFIG_USB_LCD is not set 1213# CONFIG_USB_LCD is not set
1214# CONFIG_USB_BERRY_CHARGE is not set
1212# CONFIG_USB_LED is not set 1215# CONFIG_USB_LED is not set
1213# CONFIG_USB_CYPRESS_CY7C63 is not set 1216# CONFIG_USB_CYPRESS_CY7C63 is not set
1214# CONFIG_USB_CYTHERM is not set 1217# CONFIG_USB_CYTHERM is not set
@@ -1466,6 +1469,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1466CONFIG_LOG_BUF_SHIFT=14 1469CONFIG_LOG_BUF_SHIFT=14
1467CONFIG_CROSSCOMPILE=y 1470CONFIG_CROSSCOMPILE=y
1468CONFIG_CMDLINE="" 1471CONFIG_CMDLINE=""
1472CONFIG_SYS_SUPPORTS_KGDB=y
1469 1473
1470# 1474#
1471# Security options 1475# Security options
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index c18c5e71d8ac..f68396d19f9a 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:06 2007 4# Tue Feb 20 21:47:39 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -348,6 +348,7 @@ CONFIG_PROC_EVENTS=y
348# Plug and Play support 348# Plug and Play support
349# 349#
350# CONFIG_PNP is not set 350# CONFIG_PNP is not set
351# CONFIG_PNPACPI is not set
351 352
352# 353#
353# Block devices 354# Block devices
diff --git a/arch/mips/configs/rbhma4500_defconfig b/arch/mips/configs/rbhma4500_defconfig
index 678f23217c9a..a6a824fcc874 100644
--- a/arch/mips/configs/rbhma4500_defconfig
+++ b/arch/mips/configs/rbhma4500_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:07 2007 4# Tue Feb 20 21:47:39 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -560,7 +560,6 @@ CONFIG_MTD_CFI_UTIL=y
560# NAND Flash Device Drivers 560# NAND Flash Device Drivers
561# 561#
562# CONFIG_MTD_NAND is not set 562# CONFIG_MTD_NAND is not set
563# CONFIG_MTD_NAND_CAFE is not set
564 563
565# 564#
566# OneNAND Flash Device Drivers 565# OneNAND Flash Device Drivers
@@ -576,6 +575,7 @@ CONFIG_MTD_CFI_UTIL=y
576# Plug and Play support 575# Plug and Play support
577# 576#
578# CONFIG_PNP is not set 577# CONFIG_PNP is not set
578# CONFIG_PNPACPI is not set
579 579
580# 580#
581# Block devices 581# Block devices
@@ -1191,6 +1191,7 @@ CONFIG_USB_MON=y
1191# CONFIG_USB_RIO500 is not set 1191# CONFIG_USB_RIO500 is not set
1192# CONFIG_USB_LEGOTOWER is not set 1192# CONFIG_USB_LEGOTOWER is not set
1193# CONFIG_USB_LCD is not set 1193# CONFIG_USB_LCD is not set
1194# CONFIG_USB_BERRY_CHARGE is not set
1194# CONFIG_USB_LED is not set 1195# CONFIG_USB_LED is not set
1195# CONFIG_USB_CYPRESS_CY7C63 is not set 1196# CONFIG_USB_CYPRESS_CY7C63 is not set
1196# CONFIG_USB_CYTHERM is not set 1197# CONFIG_USB_CYTHERM is not set
@@ -1462,6 +1463,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1462CONFIG_LOG_BUF_SHIFT=14 1463CONFIG_LOG_BUF_SHIFT=14
1463CONFIG_CROSSCOMPILE=y 1464CONFIG_CROSSCOMPILE=y
1464CONFIG_CMDLINE="" 1465CONFIG_CMDLINE=""
1466CONFIG_SYS_SUPPORTS_KGDB=y
1465 1467
1466# 1468#
1467# Security options 1469# Security options
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index 0417e86ab627..bee3702d501d 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:09 2007 4# Tue Feb 20 21:47:40 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -661,6 +661,7 @@ CONFIG_PARPORT_NOT_PC=y
661# Plug and Play support 661# Plug and Play support
662# 662#
663# CONFIG_PNP is not set 663# CONFIG_PNP is not set
664# CONFIG_PNPACPI is not set
664 665
665# 666#
666# Block devices 667# Block devices
@@ -1397,6 +1398,7 @@ CONFIG_USB_AUERSWALD=m
1397CONFIG_USB_RIO500=m 1398CONFIG_USB_RIO500=m
1398CONFIG_USB_LEGOTOWER=m 1399CONFIG_USB_LEGOTOWER=m
1399CONFIG_USB_LCD=m 1400CONFIG_USB_LCD=m
1401# CONFIG_USB_BERRY_CHARGE is not set
1400CONFIG_USB_LED=m 1402CONFIG_USB_LED=m
1401# CONFIG_USB_CYPRESS_CY7C63 is not set 1403# CONFIG_USB_CYPRESS_CY7C63 is not set
1402CONFIG_USB_CYTHERM=m 1404CONFIG_USB_CYTHERM=m
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 533df6fd8b4d..3c891ed10141 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:09 2007 4# Tue Feb 20 21:47:40 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -424,6 +424,7 @@ CONFIG_CONNECTOR=m
424# 424#
425# Plug and Play support 425# Plug and Play support
426# 426#
427# CONFIG_PNPACPI is not set
427 428
428# 429#
429# Block devices 430# Block devices
@@ -581,6 +582,7 @@ CONFIG_NET_SB1250_MAC=y
581# CONFIG_TIGON3 is not set 582# CONFIG_TIGON3 is not set
582# CONFIG_BNX2 is not set 583# CONFIG_BNX2 is not set
583CONFIG_QLA3XXX=m 584CONFIG_QLA3XXX=m
585# CONFIG_ATL1 is not set
584 586
585# 587#
586# Ethernet (10000 Mbit) 588# Ethernet (10000 Mbit)
@@ -945,6 +947,7 @@ CONFIG_ENABLE_MUST_CHECK=y
945CONFIG_LOG_BUF_SHIFT=15 947CONFIG_LOG_BUF_SHIFT=15
946CONFIG_CROSSCOMPILE=y 948CONFIG_CROSSCOMPILE=y
947CONFIG_CMDLINE="" 949CONFIG_CMDLINE=""
950CONFIG_SYS_SUPPORTS_KGDB=y
948# CONFIG_SB1XXX_CORELIS is not set 951# CONFIG_SB1XXX_CORELIS is not set
949 952
950# 953#
diff --git a/arch/mips/configs/sead_defconfig b/arch/mips/configs/sead_defconfig
index 38816fe264a9..e31d964a053b 100644
--- a/arch/mips/configs/sead_defconfig
+++ b/arch/mips/configs/sead_defconfig
@@ -129,10 +129,12 @@ CONFIG_MIPS_MT_DISABLED=y
129# CONFIG_MIPS_VPE_LOADER is not set 129# CONFIG_MIPS_VPE_LOADER is not set
130# CONFIG_64BIT_PHYS_ADDR is not set 130# CONFIG_64BIT_PHYS_ADDR is not set
131CONFIG_CPU_HAS_LLSC=y 131CONFIG_CPU_HAS_LLSC=y
132# CONFIG_CPU_HAS_SMARTMIPS is not set
132CONFIG_CPU_HAS_SYNC=y 133CONFIG_CPU_HAS_SYNC=y
133CONFIG_GENERIC_HARDIRQS=y 134CONFIG_GENERIC_HARDIRQS=y
134CONFIG_GENERIC_IRQ_PROBE=y 135CONFIG_GENERIC_IRQ_PROBE=y
135CONFIG_CPU_SUPPORTS_HIGHMEM=y 136CONFIG_CPU_SUPPORTS_HIGHMEM=y
137CONFIG_SYS_SUPPORTS_SMARTMIPS=y
136CONFIG_ARCH_FLATMEM_ENABLE=y 138CONFIG_ARCH_FLATMEM_ENABLE=y
137CONFIG_SELECT_MEMORY_MODEL=y 139CONFIG_SELECT_MEMORY_MODEL=y
138CONFIG_FLATMEM_MANUAL=y 140CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index c2f7c8cea1e8..5771c1aee76a 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:11 2007 4# Tue Feb 20 21:47:41 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -396,6 +396,7 @@ CONFIG_CONNECTOR=m
396# 396#
397# Plug and Play support 397# Plug and Play support
398# 398#
399# CONFIG_PNPACPI is not set
399 400
400# 401#
401# Block devices 402# Block devices
@@ -920,6 +921,7 @@ CONFIG_USB_STORAGE=y
920# CONFIG_USB_RIO500 is not set 921# CONFIG_USB_RIO500 is not set
921# CONFIG_USB_LEGOTOWER is not set 922# CONFIG_USB_LEGOTOWER is not set
922# CONFIG_USB_LCD is not set 923# CONFIG_USB_LCD is not set
924# CONFIG_USB_BERRY_CHARGE is not set
923# CONFIG_USB_LED is not set 925# CONFIG_USB_LED is not set
924# CONFIG_USB_CYPRESS_CY7C63 is not set 926# CONFIG_USB_CYPRESS_CY7C63 is not set
925# CONFIG_USB_CYTHERM is not set 927# CONFIG_USB_CYTHERM is not set
diff --git a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig
index 33b788089ab5..a8eb4b182d34 100644
--- a/arch/mips/configs/tb0229_defconfig
+++ b/arch/mips/configs/tb0229_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:12 2007 4# Tue Feb 20 21:47:41 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -397,6 +397,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
397# 397#
398# Plug and Play support 398# Plug and Play support
399# 399#
400# CONFIG_PNPACPI is not set
400 401
401# 402#
402# Block devices 403# Block devices
@@ -530,6 +531,7 @@ CONFIG_R8169=y
530# CONFIG_TIGON3 is not set 531# CONFIG_TIGON3 is not set
531# CONFIG_BNX2 is not set 532# CONFIG_BNX2 is not set
532CONFIG_QLA3XXX=m 533CONFIG_QLA3XXX=m
534# CONFIG_ATL1 is not set
533 535
534# 536#
535# Ethernet (10000 Mbit) 537# Ethernet (10000 Mbit)
@@ -819,6 +821,7 @@ CONFIG_USB_MON=y
819# CONFIG_USB_RIO500 is not set 821# CONFIG_USB_RIO500 is not set
820# CONFIG_USB_LEGOTOWER is not set 822# CONFIG_USB_LEGOTOWER is not set
821# CONFIG_USB_LCD is not set 823# CONFIG_USB_LCD is not set
824# CONFIG_USB_BERRY_CHARGE is not set
822# CONFIG_USB_LED is not set 825# CONFIG_USB_LED is not set
823# CONFIG_USB_CYPRESS_CY7C63 is not set 826# CONFIG_USB_CYPRESS_CY7C63 is not set
824# CONFIG_USB_CYTHERM is not set 827# CONFIG_USB_CYTHERM is not set
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index d180586d6385..69b87304fdbc 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:13 2007 4# Tue Feb 20 21:47:41 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -409,6 +409,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
409# 409#
410# Plug and Play support 410# Plug and Play support
411# 411#
412# CONFIG_PNPACPI is not set
412 413
413# 414#
414# Block devices 415# Block devices
@@ -675,6 +676,7 @@ CONFIG_R8169=y
675# CONFIG_TIGON3 is not set 676# CONFIG_TIGON3 is not set
676# CONFIG_BNX2 is not set 677# CONFIG_BNX2 is not set
677# CONFIG_QLA3XXX is not set 678# CONFIG_QLA3XXX is not set
679# CONFIG_ATL1 is not set
678 680
679# 681#
680# Ethernet (10000 Mbit) 682# Ethernet (10000 Mbit)
@@ -1016,6 +1018,7 @@ CONFIG_USB_MON=y
1016# CONFIG_USB_RIO500 is not set 1018# CONFIG_USB_RIO500 is not set
1017# CONFIG_USB_LEGOTOWER is not set 1019# CONFIG_USB_LEGOTOWER is not set
1018# CONFIG_USB_LCD is not set 1020# CONFIG_USB_LCD is not set
1021# CONFIG_USB_BERRY_CHARGE is not set
1019# CONFIG_USB_LED is not set 1022# CONFIG_USB_LED is not set
1020# CONFIG_USB_CYPRESS_CY7C63 is not set 1023# CONFIG_USB_CYPRESS_CY7C63 is not set
1021# CONFIG_USB_CYTHERM is not set 1024# CONFIG_USB_CYTHERM is not set
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index 570f0c1475b3..2abbd6827720 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:13 2007 4# Tue Feb 20 21:47:42 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -396,6 +396,7 @@ CONFIG_CONNECTOR=m
396# Plug and Play support 396# Plug and Play support
397# 397#
398# CONFIG_PNP is not set 398# CONFIG_PNP is not set
399# CONFIG_PNPACPI is not set
399 400
400# 401#
401# Block devices 402# Block devices
diff --git a/arch/mips/configs/wrppmc_defconfig b/arch/mips/configs/wrppmc_defconfig
index 08f3190dda89..44b6b7c1fdb6 100644
--- a/arch/mips/configs/wrppmc_defconfig
+++ b/arch/mips/configs/wrppmc_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:14 2007 4# Tue Feb 20 21:47:42 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -400,6 +400,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
400# 400#
401# Plug and Play support 401# Plug and Play support
402# 402#
403# CONFIG_PNPACPI is not set
403 404
404# 405#
405# Block devices 406# Block devices
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index aa69fee321d2..f24e1c6fc484 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:28:15 2007 4# Tue Feb 20 21:47:42 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -381,6 +381,7 @@ CONFIG_CONNECTOR=m
381# 381#
382# Plug and Play support 382# Plug and Play support
383# 383#
384# CONFIG_PNPACPI is not set
384 385
385# 386#
386# Block devices 387# Block devices
@@ -841,6 +842,7 @@ CONFIG_CROSSCOMPILE=y
841CONFIG_CMDLINE="" 842CONFIG_CMDLINE=""
842# CONFIG_DEBUG_STACK_USAGE is not set 843# CONFIG_DEBUG_STACK_USAGE is not set
843# CONFIG_KGDB is not set 844# CONFIG_KGDB is not set
845CONFIG_SYS_SUPPORTS_KGDB=y
844# CONFIG_RUNTIME_DEBUG is not set 846# CONFIG_RUNTIME_DEBUG is not set
845 847
846# 848#
diff --git a/arch/mips/defconfig b/arch/mips/defconfig
index 6c2a233e36cb..8cb8f5919194 100644
--- a/arch/mips/defconfig
+++ b/arch/mips/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.20
4# Sun Feb 18 21:27:34 2007 4# Tue Feb 20 21:47:14 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -620,6 +620,7 @@ CONFIG_CONNECTOR=m
620# 620#
621# Plug and Play support 621# Plug and Play support
622# 622#
623# CONFIG_PNPACPI is not set
623 624
624# 625#
625# Block devices 626# Block devices
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index c0b089d47181..222de465db73 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -64,6 +64,9 @@ void output_ptreg_defines(void)
64 offset("#define PT_R31 ", struct pt_regs, regs[31]); 64 offset("#define PT_R31 ", struct pt_regs, regs[31]);
65 offset("#define PT_LO ", struct pt_regs, lo); 65 offset("#define PT_LO ", struct pt_regs, lo);
66 offset("#define PT_HI ", struct pt_regs, hi); 66 offset("#define PT_HI ", struct pt_regs, hi);
67#ifdef CONFIG_CPU_HAS_SMARTMIPS
68 offset("#define PT_ACX ", struct pt_regs, acx);
69#endif
67 offset("#define PT_EPC ", struct pt_regs, cp0_epc); 70 offset("#define PT_EPC ", struct pt_regs, cp0_epc);
68 offset("#define PT_BVADDR ", struct pt_regs, cp0_badvaddr); 71 offset("#define PT_BVADDR ", struct pt_regs, cp0_badvaddr);
69 offset("#define PT_STATUS ", struct pt_regs, cp0_status); 72 offset("#define PT_STATUS ", struct pt_regs, cp0_status);
@@ -246,6 +249,7 @@ void output_sc_defines(void)
246 text("/* Linux sigcontext offsets. */"); 249 text("/* Linux sigcontext offsets. */");
247 offset("#define SC_REGS ", struct sigcontext, sc_regs); 250 offset("#define SC_REGS ", struct sigcontext, sc_regs);
248 offset("#define SC_FPREGS ", struct sigcontext, sc_fpregs); 251 offset("#define SC_FPREGS ", struct sigcontext, sc_fpregs);
252 offset("#define SC_ACX ", struct sigcontext, sc_acx);
249 offset("#define SC_MDHI ", struct sigcontext, sc_mdhi); 253 offset("#define SC_MDHI ", struct sigcontext, sc_mdhi);
250 offset("#define SC_MDLO ", struct sigcontext, sc_mdlo); 254 offset("#define SC_MDLO ", struct sigcontext, sc_mdlo);
251 offset("#define SC_PC ", struct sigcontext, sc_pc); 255 offset("#define SC_PC ", struct sigcontext, sc_pc);
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 258d74fd0b63..201ae194d1b8 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -236,6 +236,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
236 case MMLO: 236 case MMLO:
237 tmp = regs->lo; 237 tmp = regs->lo;
238 break; 238 break;
239#ifdef CONFIG_CPU_HAS_SMARTMIPS
240 case ACX:
241 tmp = regs->acx;
242 break;
243#endif
239 case FPC_CSR: 244 case FPC_CSR:
240 tmp = child->thread.fpu.fcr31; 245 tmp = child->thread.fpu.fcr31;
241 break; 246 break;
@@ -362,6 +367,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
362 case MMLO: 367 case MMLO:
363 regs->lo = data; 368 regs->lo = data;
364 break; 369 break;
370#ifdef CONFIG_CPU_HAS_SMARTMIPS
371 case ACX:
372 regs->acx = data;
373 break;
374#endif
365 case FPC_CSR: 375 case FPC_CSR:
366 child->thread.fpu.fcr31 = data; 376 child->thread.fpu.fcr31 = data;
367 break; 377 break;
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index adbfb95e42d0..f091786187a6 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -89,6 +89,9 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
89 for (i = 1; i < 32; i++) 89 for (i = 1; i < 32; i++)
90 err |= __put_user(regs->regs[i], &sc->sc_regs[i]); 90 err |= __put_user(regs->regs[i], &sc->sc_regs[i]);
91 91
92#ifdef CONFIG_CPU_HAS_SMARTMIPS
93 err |= __put_user(regs->acx, &sc->sc_acx);
94#endif
92 err |= __put_user(regs->hi, &sc->sc_mdhi); 95 err |= __put_user(regs->hi, &sc->sc_mdhi);
93 err |= __put_user(regs->lo, &sc->sc_mdlo); 96 err |= __put_user(regs->lo, &sc->sc_mdlo);
94 if (cpu_has_dsp) { 97 if (cpu_has_dsp) {
@@ -132,6 +135,10 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
132 current_thread_info()->restart_block.fn = do_no_restart_syscall; 135 current_thread_info()->restart_block.fn = do_no_restart_syscall;
133 136
134 err |= __get_user(regs->cp0_epc, &sc->sc_pc); 137 err |= __get_user(regs->cp0_epc, &sc->sc_pc);
138
139#ifdef CONFIG_CPU_HAS_SMARTMIPS
140 err |= __get_user(regs->acx, &sc->sc_acx);
141#endif
135 err |= __get_user(regs->hi, &sc->sc_mdhi); 142 err |= __get_user(regs->hi, &sc->sc_mdhi);
136 err |= __get_user(regs->lo, &sc->sc_mdlo); 143 err |= __get_user(regs->lo, &sc->sc_mdlo);
137 if (cpu_has_dsp) { 144 if (cpu_has_dsp) {
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 0555fc554f65..c46e479c992b 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -51,31 +51,14 @@ int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
51EXPORT_SYMBOL(phys_cpu_present_map); 51EXPORT_SYMBOL(phys_cpu_present_map);
52EXPORT_SYMBOL(cpu_online_map); 52EXPORT_SYMBOL(cpu_online_map);
53 53
54/* This happens early in bootup, can't really do it better */
54static void smp_tune_scheduling (void) 55static void smp_tune_scheduling (void)
55{ 56{
56 struct cache_desc *cd = &current_cpu_data.scache; 57 struct cache_desc *cd = &current_cpu_data.scache;
57 unsigned long cachesize; /* kB */ 58 unsigned long cachesize = cd->linesz * cd->sets * cd->ways;
58 unsigned long cpu_khz;
59 59
60 /* 60 if (cachesize > max_cache_size)
61 * Crude estimate until we actually meassure ... 61 max_cache_size = cachesize;
62 */
63 cpu_khz = loops_per_jiffy * 2 * HZ / 1000;
64
65 /*
66 * Rough estimation for SMP scheduling, this is the number of
67 * cycles it takes for a fully memory-limited process to flush
68 * the SMP-local cache.
69 *
70 * (For a P5 this pretty much means we will choose another idle
71 * CPU almost always at wakeup time (this is due to the small
72 * L1 cache), on PIIs it's around 50-100 usecs, depending on
73 * the cache size)
74 */
75 if (!cpu_khz)
76 return;
77
78 cachesize = cd->linesz * cd->sets * cd->ways;
79} 62}
80 63
81extern void __init calibrate_delay(void); 64extern void __init calibrate_delay(void);
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 2aa208b99da8..18f56a9dbcfa 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -229,6 +229,9 @@ void show_regs(struct pt_regs *regs)
229 printk("\n"); 229 printk("\n");
230 } 230 }
231 231
232#ifdef CONFIG_CPU_HAS_SMARTMIPS
233 printk("Acx : %0*lx\n", field, regs->acx);
234#endif
232 printk("Hi : %0*lx\n", field, regs->hi); 235 printk("Hi : %0*lx\n", field, regs->hi);
233 printk("Lo : %0*lx\n", field, regs->lo); 236 printk("Lo : %0*lx\n", field, regs->lo);
234 237
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
index fc2c96f0a1fd..cea7d0ea36e4 100644
--- a/arch/mips/mm/ioremap.c
+++ b/arch/mips/mm/ioremap.c
@@ -6,13 +6,98 @@
6 * (C) Copyright 1995 1996 Linus Torvalds 6 * (C) Copyright 1995 1996 Linus Torvalds
7 * (C) Copyright 2001, 2002 Ralf Baechle 7 * (C) Copyright 2001, 2002 Ralf Baechle
8 */ 8 */
9#include <linux/mm.h>
10#include <linux/module.h> 9#include <linux/module.h>
11#include <asm/addrspace.h> 10#include <asm/addrspace.h>
12#include <asm/byteorder.h> 11#include <asm/byteorder.h>
13 12
14#include <linux/vmalloc.h> 13#include <linux/vmalloc.h>
15#include <linux/io.h> 14#include <asm/cacheflush.h>
15#include <asm/io.h>
16#include <asm/tlbflush.h>
17
18static inline void remap_area_pte(pte_t * pte, unsigned long address,
19 phys_t size, phys_t phys_addr, unsigned long flags)
20{
21 phys_t end;
22 unsigned long pfn;
23 pgprot_t pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | __READABLE
24 | __WRITEABLE | flags);
25
26 address &= ~PMD_MASK;
27 end = address + size;
28 if (end > PMD_SIZE)
29 end = PMD_SIZE;
30 if (address >= end)
31 BUG();
32 pfn = phys_addr >> PAGE_SHIFT;
33 do {
34 if (!pte_none(*pte)) {
35 printk("remap_area_pte: page already exists\n");
36 BUG();
37 }
38 set_pte(pte, pfn_pte(pfn, pgprot));
39 address += PAGE_SIZE;
40 pfn++;
41 pte++;
42 } while (address && (address < end));
43}
44
45static inline int remap_area_pmd(pmd_t * pmd, unsigned long address,
46 phys_t size, phys_t phys_addr, unsigned long flags)
47{
48 phys_t end;
49
50 address &= ~PGDIR_MASK;
51 end = address + size;
52 if (end > PGDIR_SIZE)
53 end = PGDIR_SIZE;
54 phys_addr -= address;
55 if (address >= end)
56 BUG();
57 do {
58 pte_t * pte = pte_alloc_kernel(pmd, address);
59 if (!pte)
60 return -ENOMEM;
61 remap_area_pte(pte, address, end - address, address + phys_addr, flags);
62 address = (address + PMD_SIZE) & PMD_MASK;
63 pmd++;
64 } while (address && (address < end));
65 return 0;
66}
67
68static int remap_area_pages(unsigned long address, phys_t phys_addr,
69 phys_t size, unsigned long flags)
70{
71 int error;
72 pgd_t * dir;
73 unsigned long end = address + size;
74
75 phys_addr -= address;
76 dir = pgd_offset(&init_mm, address);
77 flush_cache_all();
78 if (address >= end)
79 BUG();
80 do {
81 pud_t *pud;
82 pmd_t *pmd;
83
84 error = -ENOMEM;
85 pud = pud_alloc(&init_mm, dir, address);
86 if (!pud)
87 break;
88 pmd = pmd_alloc(&init_mm, pud, address);
89 if (!pmd)
90 break;
91 if (remap_area_pmd(pmd, address, end - address,
92 phys_addr + address, flags))
93 break;
94 error = 0;
95 address = (address + PGDIR_SIZE) & PGDIR_MASK;
96 dir++;
97 } while (address && (address < end));
98 flush_tlb_all();
99 return error;
100}
16 101
17/* 102/*
18 * Generic mapping function (not visible outside): 103 * Generic mapping function (not visible outside):
@@ -36,7 +121,6 @@ void __iomem * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags)
36 unsigned long offset; 121 unsigned long offset;
37 phys_t last_addr; 122 phys_t last_addr;
38 void * addr; 123 void * addr;
39 pgprot_t pgprot;
40 124
41 phys_addr = fixup_bigphys_addr(phys_addr, size); 125 phys_addr = fixup_bigphys_addr(phys_addr, size);
42 126
@@ -68,9 +152,6 @@ void __iomem * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags)
68 return NULL; 152 return NULL;
69 } 153 }
70 154
71 pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | __READABLE
72 | __WRITEABLE | flags);
73
74 /* 155 /*
75 * Mappings have to be page-aligned 156 * Mappings have to be page-aligned
76 */ 157 */
@@ -85,8 +166,7 @@ void __iomem * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags)
85 if (!area) 166 if (!area)
86 return NULL; 167 return NULL;
87 addr = area->addr; 168 addr = area->addr;
88 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, 169 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) {
89 phys_addr, pgprot)) {
90 vunmap(addr); 170 vunmap(addr);
91 return NULL; 171 return NULL;
92 } 172 }
diff --git a/arch/mips/momentum/jaguar_atx/platform.c b/arch/mips/momentum/jaguar_atx/platform.c
index c78ba3025af4..3df36eda75af 100644
--- a/arch/mips/momentum/jaguar_atx/platform.c
+++ b/arch/mips/momentum/jaguar_atx/platform.c
@@ -200,7 +200,7 @@ static int __init mv643xx_eth_add_pds(void)
200 int ret; 200 int ret;
201 201
202 get_mac(mac); 202 get_mac(mac);
203 eth_mac_add(eth1_mac_addr, mac, 0); 203 eth_mac_add(eth0_mac_addr, mac, 0);
204 eth_mac_add(eth1_mac_addr, mac, 1); 204 eth_mac_add(eth1_mac_addr, mac, 1);
205 eth_mac_add(eth2_mac_addr, mac, 2); 205 eth_mac_add(eth2_mac_addr, mac, 2);
206 ret = platform_add_devices(mv643xx_eth_pd_devs, 206 ret = platform_add_devices(mv643xx_eth_pd_devs,
diff --git a/arch/mips/momentum/ocelot_3/platform.c b/arch/mips/momentum/ocelot_3/platform.c
index 0ab8d231cf7d..024aef25f372 100644
--- a/arch/mips/momentum/ocelot_3/platform.c
+++ b/arch/mips/momentum/ocelot_3/platform.c
@@ -200,7 +200,7 @@ static int __init mv643xx_eth_add_pds(void)
200 int ret; 200 int ret;
201 201
202 get_mac(mac); 202 get_mac(mac);
203 eth_mac_add(eth1_mac_addr, mac, 0); 203 eth_mac_add(eth0_mac_addr, mac, 0);
204 eth_mac_add(eth1_mac_addr, mac, 1); 204 eth_mac_add(eth1_mac_addr, mac, 1);
205 eth_mac_add(eth2_mac_addr, mac, 2); 205 eth_mac_add(eth2_mac_addr, mac, 2);
206 ret = platform_add_devices(mv643xx_eth_pd_devs, 206 ret = platform_add_devices(mv643xx_eth_pd_devs,
diff --git a/arch/mips/momentum/ocelot_c/platform.c b/arch/mips/momentum/ocelot_c/platform.c
index 8e381d447573..fac8b2499387 100644
--- a/arch/mips/momentum/ocelot_c/platform.c
+++ b/arch/mips/momentum/ocelot_c/platform.c
@@ -174,7 +174,7 @@ static int __init mv643xx_eth_add_pds(void)
174 int ret; 174 int ret;
175 175
176 get_mac(mac); 176 get_mac(mac);
177 eth_mac_add(eth1_mac_addr, mac, 0); 177 eth_mac_add(eth0_mac_addr, mac, 0);
178 eth_mac_add(eth1_mac_addr, mac, 1); 178 eth_mac_add(eth1_mac_addr, mac, 1);
179 ret = platform_add_devices(mv643xx_eth_pd_devs, 179 ret = platform_add_devices(mv643xx_eth_pd_devs,
180 ARRAY_SIZE(mv643xx_eth_pd_devs)); 180 ARRAY_SIZE(mv643xx_eth_pd_devs));
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 9f5dac64aa8f..ed4350ced3d0 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -675,6 +675,9 @@ END(invalidate_interrupt\num)
675ENTRY(call_function_interrupt) 675ENTRY(call_function_interrupt)
676 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt 676 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt
677END(call_function_interrupt) 677END(call_function_interrupt)
678ENTRY(irq_move_cleanup_interrupt)
679 apicinterrupt IRQ_MOVE_CLEANUP_VECTOR,smp_irq_move_cleanup_interrupt
680END(irq_move_cleanup_interrupt)
678#endif 681#endif
679 682
680ENTRY(apic_timer_interrupt) 683ENTRY(apic_timer_interrupt)
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index 01e2cf0bdeb1..21d95b747437 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -299,7 +299,7 @@ void init_8259A(int auto_eoi)
299 * outb_p - this has to work on a wide range of PC hardware. 299 * outb_p - this has to work on a wide range of PC hardware.
300 */ 300 */
301 outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */ 301 outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */
302 outb_p(0x20 + 0, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */ 302 outb_p(IRQ0_VECTOR, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */
303 outb_p(0x04, 0x21); /* 8259A-1 (the master) has a slave on IR2 */ 303 outb_p(0x04, 0x21); /* 8259A-1 (the master) has a slave on IR2 */
304 if (auto_eoi) 304 if (auto_eoi)
305 outb_p(0x03, 0x21); /* master does Auto EOI */ 305 outb_p(0x03, 0x21); /* master does Auto EOI */
@@ -307,7 +307,7 @@ void init_8259A(int auto_eoi)
307 outb_p(0x01, 0x21); /* master expects normal EOI */ 307 outb_p(0x01, 0x21); /* master expects normal EOI */
308 308
309 outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */ 309 outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */
310 outb_p(0x20 + 8, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */ 310 outb_p(IRQ8_VECTOR, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */
311 outb_p(0x02, 0xA1); /* 8259A-2 is a slave on master's IR2 */ 311 outb_p(0x02, 0xA1); /* 8259A-2 is a slave on master's IR2 */
312 outb_p(0x01, 0xA1); /* (slave's support for AEOI in flat mode 312 outb_p(0x01, 0xA1); /* (slave's support for AEOI in flat mode
313 is to be investigated) */ 313 is to be investigated) */
@@ -398,24 +398,24 @@ device_initcall(i8259A_init_sysfs);
398 398
399static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; 399static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL};
400DEFINE_PER_CPU(vector_irq_t, vector_irq) = { 400DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
401 [0 ... FIRST_EXTERNAL_VECTOR - 1] = -1, 401 [0 ... IRQ0_VECTOR - 1] = -1,
402 [FIRST_EXTERNAL_VECTOR + 0] = 0, 402 [IRQ0_VECTOR] = 0,
403 [FIRST_EXTERNAL_VECTOR + 1] = 1, 403 [IRQ1_VECTOR] = 1,
404 [FIRST_EXTERNAL_VECTOR + 2] = 2, 404 [IRQ2_VECTOR] = 2,
405 [FIRST_EXTERNAL_VECTOR + 3] = 3, 405 [IRQ3_VECTOR] = 3,
406 [FIRST_EXTERNAL_VECTOR + 4] = 4, 406 [IRQ4_VECTOR] = 4,
407 [FIRST_EXTERNAL_VECTOR + 5] = 5, 407 [IRQ5_VECTOR] = 5,
408 [FIRST_EXTERNAL_VECTOR + 6] = 6, 408 [IRQ6_VECTOR] = 6,
409 [FIRST_EXTERNAL_VECTOR + 7] = 7, 409 [IRQ7_VECTOR] = 7,
410 [FIRST_EXTERNAL_VECTOR + 8] = 8, 410 [IRQ8_VECTOR] = 8,
411 [FIRST_EXTERNAL_VECTOR + 9] = 9, 411 [IRQ9_VECTOR] = 9,
412 [FIRST_EXTERNAL_VECTOR + 10] = 10, 412 [IRQ10_VECTOR] = 10,
413 [FIRST_EXTERNAL_VECTOR + 11] = 11, 413 [IRQ11_VECTOR] = 11,
414 [FIRST_EXTERNAL_VECTOR + 12] = 12, 414 [IRQ12_VECTOR] = 12,
415 [FIRST_EXTERNAL_VECTOR + 13] = 13, 415 [IRQ13_VECTOR] = 13,
416 [FIRST_EXTERNAL_VECTOR + 14] = 14, 416 [IRQ14_VECTOR] = 14,
417 [FIRST_EXTERNAL_VECTOR + 15] = 15, 417 [IRQ15_VECTOR] = 15,
418 [FIRST_EXTERNAL_VECTOR + 16 ... NR_VECTORS - 1] = -1 418 [IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1
419}; 419};
420 420
421void __init init_ISA_irqs (void) 421void __init init_ISA_irqs (void)
@@ -450,6 +450,7 @@ void spurious_interrupt(void);
450void error_interrupt(void); 450void error_interrupt(void);
451void reschedule_interrupt(void); 451void reschedule_interrupt(void);
452void call_function_interrupt(void); 452void call_function_interrupt(void);
453void irq_move_cleanup_interrupt(void);
453void invalidate_interrupt0(void); 454void invalidate_interrupt0(void);
454void invalidate_interrupt1(void); 455void invalidate_interrupt1(void);
455void invalidate_interrupt2(void); 456void invalidate_interrupt2(void);
@@ -520,12 +521,6 @@ void __init init_IRQ(void)
520 521
521#ifdef CONFIG_SMP 522#ifdef CONFIG_SMP
522 /* 523 /*
523 * IRQ0 must be given a fixed assignment and initialized,
524 * because it's used before the IO-APIC is set up.
525 */
526 __get_cpu_var(vector_irq)[FIRST_DEVICE_VECTOR] = 0;
527
528 /*
529 * The reschedule interrupt is a CPU-to-CPU reschedule-helper 524 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
530 * IPI, driven by wakeup. 525 * IPI, driven by wakeup.
531 */ 526 */
@@ -543,7 +538,10 @@ void __init init_IRQ(void)
543 538
544 /* IPI for generic function call */ 539 /* IPI for generic function call */
545 set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); 540 set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
546#endif 541
542 /* Low priority IPI to cleanup after moving an irq */
543 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
544#endif
547 set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); 545 set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
548 set_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt); 546 set_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
549 547
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 950682f35766..48593f6b708f 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -36,6 +36,7 @@
36#include <acpi/acpi_bus.h> 36#include <acpi/acpi_bus.h>
37#endif 37#endif
38 38
39#include <asm/idle.h>
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/smp.h> 41#include <asm/smp.h>
41#include <asm/desc.h> 42#include <asm/desc.h>
@@ -47,7 +48,35 @@
47#include <asm/msidef.h> 48#include <asm/msidef.h>
48#include <asm/hypertransport.h> 49#include <asm/hypertransport.h>
49 50
50static int assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result); 51struct irq_cfg {
52 cpumask_t domain;
53 cpumask_t old_domain;
54 unsigned move_cleanup_count;
55 u8 vector;
56 u8 move_in_progress : 1;
57};
58
59/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
60struct irq_cfg irq_cfg[NR_IRQS] __read_mostly = {
61 [0] = { .domain = CPU_MASK_ALL, .vector = IRQ0_VECTOR, },
62 [1] = { .domain = CPU_MASK_ALL, .vector = IRQ1_VECTOR, },
63 [2] = { .domain = CPU_MASK_ALL, .vector = IRQ2_VECTOR, },
64 [3] = { .domain = CPU_MASK_ALL, .vector = IRQ3_VECTOR, },
65 [4] = { .domain = CPU_MASK_ALL, .vector = IRQ4_VECTOR, },
66 [5] = { .domain = CPU_MASK_ALL, .vector = IRQ5_VECTOR, },
67 [6] = { .domain = CPU_MASK_ALL, .vector = IRQ6_VECTOR, },
68 [7] = { .domain = CPU_MASK_ALL, .vector = IRQ7_VECTOR, },
69 [8] = { .domain = CPU_MASK_ALL, .vector = IRQ8_VECTOR, },
70 [9] = { .domain = CPU_MASK_ALL, .vector = IRQ9_VECTOR, },
71 [10] = { .domain = CPU_MASK_ALL, .vector = IRQ10_VECTOR, },
72 [11] = { .domain = CPU_MASK_ALL, .vector = IRQ11_VECTOR, },
73 [12] = { .domain = CPU_MASK_ALL, .vector = IRQ12_VECTOR, },
74 [13] = { .domain = CPU_MASK_ALL, .vector = IRQ13_VECTOR, },
75 [14] = { .domain = CPU_MASK_ALL, .vector = IRQ14_VECTOR, },
76 [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
77};
78
79static int assign_irq_vector(int irq, cpumask_t mask);
51 80
52#define __apicdebuginit __init 81#define __apicdebuginit __init
53 82
@@ -74,7 +103,7 @@ int nr_ioapic_registers[MAX_IO_APICS];
74 * Rough estimation of how many shared IRQs there are, can 103 * Rough estimation of how many shared IRQs there are, can
75 * be changed anytime. 104 * be changed anytime.
76 */ 105 */
77#define MAX_PLUS_SHARED_IRQS NR_IRQ_VECTORS 106#define MAX_PLUS_SHARED_IRQS NR_IRQS
78#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) 107#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS)
79 108
80/* 109/*
@@ -149,11 +178,11 @@ static inline void io_apic_sync(unsigned int apic)
149 reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \ 178 reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \
150 reg ACTION; \ 179 reg ACTION; \
151 io_apic_modify(entry->apic, reg); \ 180 io_apic_modify(entry->apic, reg); \
181 FINAL; \
152 if (!entry->next) \ 182 if (!entry->next) \
153 break; \ 183 break; \
154 entry = irq_2_pin + entry->next; \ 184 entry = irq_2_pin + entry->next; \
155 } \ 185 } \
156 FINAL; \
157} 186}
158 187
159union entry_union { 188union entry_union {
@@ -237,21 +266,19 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
237 266
238static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) 267static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
239{ 268{
269 struct irq_cfg *cfg = irq_cfg + irq;
240 unsigned long flags; 270 unsigned long flags;
241 unsigned int dest; 271 unsigned int dest;
242 cpumask_t tmp; 272 cpumask_t tmp;
243 int vector;
244 273
245 cpus_and(tmp, mask, cpu_online_map); 274 cpus_and(tmp, mask, cpu_online_map);
246 if (cpus_empty(tmp)) 275 if (cpus_empty(tmp))
247 tmp = TARGET_CPUS; 276 return;
248
249 cpus_and(mask, tmp, CPU_MASK_ALL);
250 277
251 vector = assign_irq_vector(irq, mask, &tmp); 278 if (assign_irq_vector(irq, mask))
252 if (vector < 0)
253 return; 279 return;
254 280
281 cpus_and(tmp, cfg->domain, mask);
255 dest = cpu_mask_to_apicid(tmp); 282 dest = cpu_mask_to_apicid(tmp);
256 283
257 /* 284 /*
@@ -260,8 +287,8 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
260 dest = SET_APIC_LOGICAL_ID(dest); 287 dest = SET_APIC_LOGICAL_ID(dest);
261 288
262 spin_lock_irqsave(&ioapic_lock, flags); 289 spin_lock_irqsave(&ioapic_lock, flags);
263 __target_IO_APIC_irq(irq, dest, vector); 290 __target_IO_APIC_irq(irq, dest, cfg->vector);
264 set_native_irq_info(irq, mask); 291 irq_desc[irq].affinity = mask;
265 spin_unlock_irqrestore(&ioapic_lock, flags); 292 spin_unlock_irqrestore(&ioapic_lock, flags);
266} 293}
267#endif 294#endif
@@ -615,63 +642,7 @@ static int pin_2_irq(int idx, int apic, int pin)
615 return irq; 642 return irq;
616} 643}
617 644
618static inline int IO_APIC_irq_trigger(int irq) 645static int __assign_irq_vector(int irq, cpumask_t mask)
619{
620 int apic, idx, pin;
621
622 for (apic = 0; apic < nr_ioapics; apic++) {
623 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
624 idx = find_irq_entry(apic,pin,mp_INT);
625 if ((idx != -1) && (irq == pin_2_irq(idx,apic,pin)))
626 return irq_trigger(idx);
627 }
628 }
629 /*
630 * nonexistent IRQs are edge default
631 */
632 return 0;
633}
634
635/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
636static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = {
637 [0] = FIRST_EXTERNAL_VECTOR + 0,
638 [1] = FIRST_EXTERNAL_VECTOR + 1,
639 [2] = FIRST_EXTERNAL_VECTOR + 2,
640 [3] = FIRST_EXTERNAL_VECTOR + 3,
641 [4] = FIRST_EXTERNAL_VECTOR + 4,
642 [5] = FIRST_EXTERNAL_VECTOR + 5,
643 [6] = FIRST_EXTERNAL_VECTOR + 6,
644 [7] = FIRST_EXTERNAL_VECTOR + 7,
645 [8] = FIRST_EXTERNAL_VECTOR + 8,
646 [9] = FIRST_EXTERNAL_VECTOR + 9,
647 [10] = FIRST_EXTERNAL_VECTOR + 10,
648 [11] = FIRST_EXTERNAL_VECTOR + 11,
649 [12] = FIRST_EXTERNAL_VECTOR + 12,
650 [13] = FIRST_EXTERNAL_VECTOR + 13,
651 [14] = FIRST_EXTERNAL_VECTOR + 14,
652 [15] = FIRST_EXTERNAL_VECTOR + 15,
653};
654
655static cpumask_t irq_domain[NR_IRQ_VECTORS] __read_mostly = {
656 [0] = CPU_MASK_ALL,
657 [1] = CPU_MASK_ALL,
658 [2] = CPU_MASK_ALL,
659 [3] = CPU_MASK_ALL,
660 [4] = CPU_MASK_ALL,
661 [5] = CPU_MASK_ALL,
662 [6] = CPU_MASK_ALL,
663 [7] = CPU_MASK_ALL,
664 [8] = CPU_MASK_ALL,
665 [9] = CPU_MASK_ALL,
666 [10] = CPU_MASK_ALL,
667 [11] = CPU_MASK_ALL,
668 [12] = CPU_MASK_ALL,
669 [13] = CPU_MASK_ALL,
670 [14] = CPU_MASK_ALL,
671 [15] = CPU_MASK_ALL,
672};
673
674static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
675{ 646{
676 /* 647 /*
677 * NOTE! The local APIC isn't very good at handling 648 * NOTE! The local APIC isn't very good at handling
@@ -685,20 +656,25 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
685 * 0x80, because int 0x80 is hm, kind of importantish. ;) 656 * 0x80, because int 0x80 is hm, kind of importantish. ;)
686 */ 657 */
687 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; 658 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
688 int old_vector = -1; 659 unsigned int old_vector;
689 int cpu; 660 int cpu;
661 struct irq_cfg *cfg;
690 662
691 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); 663 BUG_ON((unsigned)irq >= NR_IRQS);
664 cfg = &irq_cfg[irq];
692 665
693 /* Only try and allocate irqs on cpus that are present */ 666 /* Only try and allocate irqs on cpus that are present */
694 cpus_and(mask, mask, cpu_online_map); 667 cpus_and(mask, mask, cpu_online_map);
695 668
696 if (irq_vector[irq] > 0) 669 if ((cfg->move_in_progress) || cfg->move_cleanup_count)
697 old_vector = irq_vector[irq]; 670 return -EBUSY;
698 if (old_vector > 0) { 671
699 cpus_and(*result, irq_domain[irq], mask); 672 old_vector = cfg->vector;
700 if (!cpus_empty(*result)) 673 if (old_vector) {
701 return old_vector; 674 cpumask_t tmp;
675 cpus_and(tmp, cfg->domain, mask);
676 if (!cpus_empty(tmp))
677 return 0;
702 } 678 }
703 679
704 for_each_cpu_mask(cpu, mask) { 680 for_each_cpu_mask(cpu, mask) {
@@ -728,48 +704,47 @@ next:
728 /* Found one! */ 704 /* Found one! */
729 current_vector = vector; 705 current_vector = vector;
730 current_offset = offset; 706 current_offset = offset;
731 if (old_vector >= 0) { 707 if (old_vector) {
732 cpumask_t old_mask; 708 cfg->move_in_progress = 1;
733 int old_cpu; 709 cfg->old_domain = cfg->domain;
734 cpus_and(old_mask, irq_domain[irq], cpu_online_map);
735 for_each_cpu_mask(old_cpu, old_mask)
736 per_cpu(vector_irq, old_cpu)[old_vector] = -1;
737 } 710 }
738 for_each_cpu_mask(new_cpu, new_mask) 711 for_each_cpu_mask(new_cpu, new_mask)
739 per_cpu(vector_irq, new_cpu)[vector] = irq; 712 per_cpu(vector_irq, new_cpu)[vector] = irq;
740 irq_vector[irq] = vector; 713 cfg->vector = vector;
741 irq_domain[irq] = domain; 714 cfg->domain = domain;
742 cpus_and(*result, domain, mask); 715 return 0;
743 return vector;
744 } 716 }
745 return -ENOSPC; 717 return -ENOSPC;
746} 718}
747 719
748static int assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result) 720static int assign_irq_vector(int irq, cpumask_t mask)
749{ 721{
750 int vector; 722 int err;
751 unsigned long flags; 723 unsigned long flags;
752 724
753 spin_lock_irqsave(&vector_lock, flags); 725 spin_lock_irqsave(&vector_lock, flags);
754 vector = __assign_irq_vector(irq, mask, result); 726 err = __assign_irq_vector(irq, mask);
755 spin_unlock_irqrestore(&vector_lock, flags); 727 spin_unlock_irqrestore(&vector_lock, flags);
756 return vector; 728 return err;
757} 729}
758 730
759static void __clear_irq_vector(int irq) 731static void __clear_irq_vector(int irq)
760{ 732{
733 struct irq_cfg *cfg;
761 cpumask_t mask; 734 cpumask_t mask;
762 int cpu, vector; 735 int cpu, vector;
763 736
764 BUG_ON(!irq_vector[irq]); 737 BUG_ON((unsigned)irq >= NR_IRQS);
738 cfg = &irq_cfg[irq];
739 BUG_ON(!cfg->vector);
765 740
766 vector = irq_vector[irq]; 741 vector = cfg->vector;
767 cpus_and(mask, irq_domain[irq], cpu_online_map); 742 cpus_and(mask, cfg->domain, cpu_online_map);
768 for_each_cpu_mask(cpu, mask) 743 for_each_cpu_mask(cpu, mask)
769 per_cpu(vector_irq, cpu)[vector] = -1; 744 per_cpu(vector_irq, cpu)[vector] = -1;
770 745
771 irq_vector[irq] = 0; 746 cfg->vector = 0;
772 irq_domain[irq] = CPU_MASK_NONE; 747 cfg->domain = CPU_MASK_NONE;
773} 748}
774 749
775void __setup_vector_irq(int cpu) 750void __setup_vector_irq(int cpu)
@@ -779,10 +754,10 @@ void __setup_vector_irq(int cpu)
779 int irq, vector; 754 int irq, vector;
780 755
781 /* Mark the inuse vectors */ 756 /* Mark the inuse vectors */
782 for (irq = 0; irq < NR_IRQ_VECTORS; ++irq) { 757 for (irq = 0; irq < NR_IRQS; ++irq) {
783 if (!cpu_isset(cpu, irq_domain[irq])) 758 if (!cpu_isset(cpu, irq_cfg[irq].domain))
784 continue; 759 continue;
785 vector = irq_vector[irq]; 760 vector = irq_cfg[irq].vector;
786 per_cpu(vector_irq, cpu)[vector] = irq; 761 per_cpu(vector_irq, cpu)[vector] = irq;
787 } 762 }
788 /* Mark the free vectors */ 763 /* Mark the free vectors */
@@ -790,36 +765,46 @@ void __setup_vector_irq(int cpu)
790 irq = per_cpu(vector_irq, cpu)[vector]; 765 irq = per_cpu(vector_irq, cpu)[vector];
791 if (irq < 0) 766 if (irq < 0)
792 continue; 767 continue;
793 if (!cpu_isset(cpu, irq_domain[irq])) 768 if (!cpu_isset(cpu, irq_cfg[irq].domain))
794 per_cpu(vector_irq, cpu)[vector] = -1; 769 per_cpu(vector_irq, cpu)[vector] = -1;
795 } 770 }
796} 771}
797 772
798 773
799extern void (*interrupt[NR_IRQS])(void);
800
801static struct irq_chip ioapic_chip; 774static struct irq_chip ioapic_chip;
802 775
803#define IOAPIC_AUTO -1 776static void ioapic_register_intr(int irq, unsigned long trigger)
804#define IOAPIC_EDGE 0
805#define IOAPIC_LEVEL 1
806
807static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
808{ 777{
809 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) || 778 if (trigger)
810 trigger == IOAPIC_LEVEL)
811 set_irq_chip_and_handler_name(irq, &ioapic_chip, 779 set_irq_chip_and_handler_name(irq, &ioapic_chip,
812 handle_fasteoi_irq, "fasteoi"); 780 handle_fasteoi_irq, "fasteoi");
813 else 781 else
814 set_irq_chip_and_handler_name(irq, &ioapic_chip, 782 set_irq_chip_and_handler_name(irq, &ioapic_chip,
815 handle_edge_irq, "edge"); 783 handle_edge_irq, "edge");
816} 784}
817static void __init setup_IO_APIC_irq(int apic, int pin, int idx, int irq) 785
786static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
787 int trigger, int polarity)
818{ 788{
789 struct irq_cfg *cfg = irq_cfg + irq;
819 struct IO_APIC_route_entry entry; 790 struct IO_APIC_route_entry entry;
820 int vector; 791 cpumask_t mask;
821 unsigned long flags; 792 unsigned long flags;
822 793
794 if (!IO_APIC_IRQ(irq))
795 return;
796
797 mask = TARGET_CPUS;
798 if (assign_irq_vector(irq, mask))
799 return;
800
801 cpus_and(mask, cfg->domain, mask);
802
803 apic_printk(APIC_VERBOSE,KERN_DEBUG
804 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
805 "IRQ %d Mode:%i Active:%i)\n",
806 apic, mp_ioapics[apic].mpc_apicid, pin, cfg->vector,
807 irq, trigger, polarity);
823 808
824 /* 809 /*
825 * add it to the IO-APIC irq-routing table: 810 * add it to the IO-APIC irq-routing table:
@@ -828,41 +813,27 @@ static void __init setup_IO_APIC_irq(int apic, int pin, int idx, int irq)
828 813
829 entry.delivery_mode = INT_DELIVERY_MODE; 814 entry.delivery_mode = INT_DELIVERY_MODE;
830 entry.dest_mode = INT_DEST_MODE; 815 entry.dest_mode = INT_DEST_MODE;
816 entry.dest = cpu_mask_to_apicid(mask);
831 entry.mask = 0; /* enable IRQ */ 817 entry.mask = 0; /* enable IRQ */
832 entry.dest = cpu_mask_to_apicid(TARGET_CPUS); 818 entry.trigger = trigger;
833 819 entry.polarity = polarity;
834 entry.trigger = irq_trigger(idx); 820 entry.vector = cfg->vector;
835 entry.polarity = irq_polarity(idx);
836 821
837 if (irq_trigger(idx)) { 822 /* Mask level triggered irqs.
838 entry.trigger = 1; 823 * Use IRQ_DELAYED_DISABLE for edge triggered irqs.
824 */
825 if (trigger)
839 entry.mask = 1; 826 entry.mask = 1;
840 entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
841 }
842
843 if (!apic && !IO_APIC_IRQ(irq))
844 return;
845
846 if (IO_APIC_IRQ(irq)) {
847 cpumask_t mask;
848 vector = assign_irq_vector(irq, TARGET_CPUS, &mask);
849 if (vector < 0)
850 return;
851
852 entry.dest = cpu_mask_to_apicid(mask);
853 entry.vector = vector;
854 827
855 ioapic_register_intr(irq, vector, IOAPIC_AUTO); 828 ioapic_register_intr(irq, trigger);
856 if (!apic && (irq < 16)) 829 if (irq < 16)
857 disable_8259A_irq(irq); 830 disable_8259A_irq(irq);
858 }
859 831
860 ioapic_write_entry(apic, pin, entry); 832 ioapic_write_entry(apic, pin, entry);
861 833
862 spin_lock_irqsave(&ioapic_lock, flags); 834 spin_lock_irqsave(&ioapic_lock, flags);
863 set_native_irq_info(irq, TARGET_CPUS); 835 irq_desc[irq].affinity = TARGET_CPUS;
864 spin_unlock_irqrestore(&ioapic_lock, flags); 836 spin_unlock_irqrestore(&ioapic_lock, flags);
865
866} 837}
867 838
868static void __init setup_IO_APIC_irqs(void) 839static void __init setup_IO_APIC_irqs(void)
@@ -887,8 +858,8 @@ static void __init setup_IO_APIC_irqs(void)
887 irq = pin_2_irq(idx, apic, pin); 858 irq = pin_2_irq(idx, apic, pin);
888 add_pin_to_irq(irq, apic, pin); 859 add_pin_to_irq(irq, apic, pin);
889 860
890 setup_IO_APIC_irq(apic, pin, idx, irq); 861 setup_IO_APIC_irq(apic, pin, irq,
891 862 irq_trigger(idx), irq_polarity(idx));
892 } 863 }
893 } 864 }
894 865
@@ -1373,16 +1344,15 @@ static unsigned int startup_ioapic_irq(unsigned int irq)
1373 1344
1374static int ioapic_retrigger_irq(unsigned int irq) 1345static int ioapic_retrigger_irq(unsigned int irq)
1375{ 1346{
1347 struct irq_cfg *cfg = &irq_cfg[irq];
1376 cpumask_t mask; 1348 cpumask_t mask;
1377 unsigned vector;
1378 unsigned long flags; 1349 unsigned long flags;
1379 1350
1380 spin_lock_irqsave(&vector_lock, flags); 1351 spin_lock_irqsave(&vector_lock, flags);
1381 vector = irq_vector[irq];
1382 cpus_clear(mask); 1352 cpus_clear(mask);
1383 cpu_set(first_cpu(irq_domain[irq]), mask); 1353 cpu_set(first_cpu(cfg->domain), mask);
1384 1354
1385 send_IPI_mask(mask, vector); 1355 send_IPI_mask(mask, cfg->vector);
1386 spin_unlock_irqrestore(&vector_lock, flags); 1356 spin_unlock_irqrestore(&vector_lock, flags);
1387 1357
1388 return 1; 1358 return 1;
@@ -1397,8 +1367,68 @@ static int ioapic_retrigger_irq(unsigned int irq)
1397 * races. 1367 * races.
1398 */ 1368 */
1399 1369
1370#ifdef CONFIG_SMP
1371asmlinkage void smp_irq_move_cleanup_interrupt(void)
1372{
1373 unsigned vector, me;
1374 ack_APIC_irq();
1375 exit_idle();
1376 irq_enter();
1377
1378 me = smp_processor_id();
1379 for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
1380 unsigned int irq;
1381 struct irq_desc *desc;
1382 struct irq_cfg *cfg;
1383 irq = __get_cpu_var(vector_irq)[vector];
1384 if (irq >= NR_IRQS)
1385 continue;
1386
1387 desc = irq_desc + irq;
1388 cfg = irq_cfg + irq;
1389 spin_lock(&desc->lock);
1390 if (!cfg->move_cleanup_count)
1391 goto unlock;
1392
1393 if ((vector == cfg->vector) && cpu_isset(me, cfg->domain))
1394 goto unlock;
1395
1396 __get_cpu_var(vector_irq)[vector] = -1;
1397 cfg->move_cleanup_count--;
1398unlock:
1399 spin_unlock(&desc->lock);
1400 }
1401
1402 irq_exit();
1403}
1404
1405static void irq_complete_move(unsigned int irq)
1406{
1407 struct irq_cfg *cfg = irq_cfg + irq;
1408 unsigned vector, me;
1409
1410 if (likely(!cfg->move_in_progress))
1411 return;
1412
1413 vector = ~get_irq_regs()->orig_rax;
1414 me = smp_processor_id();
1415 if ((vector == cfg->vector) &&
1416 cpu_isset(smp_processor_id(), cfg->domain)) {
1417 cpumask_t cleanup_mask;
1418
1419 cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map);
1420 cfg->move_cleanup_count = cpus_weight(cleanup_mask);
1421 send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
1422 cfg->move_in_progress = 0;
1423 }
1424}
1425#else
1426static inline void irq_complete_move(unsigned int irq) {}
1427#endif
1428
1400static void ack_apic_edge(unsigned int irq) 1429static void ack_apic_edge(unsigned int irq)
1401{ 1430{
1431 irq_complete_move(irq);
1402 move_native_irq(irq); 1432 move_native_irq(irq);
1403 ack_APIC_irq(); 1433 ack_APIC_irq();
1404} 1434}
@@ -1407,6 +1437,7 @@ static void ack_apic_level(unsigned int irq)
1407{ 1437{
1408 int do_unmask_irq = 0; 1438 int do_unmask_irq = 0;
1409 1439
1440 irq_complete_move(irq);
1410#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) 1441#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
1411 /* If we are moving the irq we need to mask it */ 1442 /* If we are moving the irq we need to mask it */
1412 if (unlikely(irq_desc[irq].status & IRQ_MOVE_PENDING)) { 1443 if (unlikely(irq_desc[irq].status & IRQ_MOVE_PENDING)) {
@@ -1457,7 +1488,7 @@ static inline void init_IO_APIC_traps(void)
1457 */ 1488 */
1458 for (irq = 0; irq < NR_IRQS ; irq++) { 1489 for (irq = 0; irq < NR_IRQS ; irq++) {
1459 int tmp = irq; 1490 int tmp = irq;
1460 if (IO_APIC_IRQ(tmp) && !irq_vector[tmp]) { 1491 if (IO_APIC_IRQ(tmp) && !irq_cfg[tmp].vector) {
1461 /* 1492 /*
1462 * Hmm.. We don't have an entry for this, 1493 * Hmm.. We don't have an entry for this,
1463 * so default to an old-fashioned 8259 1494 * so default to an old-fashioned 8259
@@ -1596,15 +1627,14 @@ static inline void unlock_ExtINT_logic(void)
1596 */ 1627 */
1597static inline void check_timer(void) 1628static inline void check_timer(void)
1598{ 1629{
1630 struct irq_cfg *cfg = irq_cfg + 0;
1599 int apic1, pin1, apic2, pin2; 1631 int apic1, pin1, apic2, pin2;
1600 int vector;
1601 cpumask_t mask;
1602 1632
1603 /* 1633 /*
1604 * get/set the timer IRQ vector: 1634 * get/set the timer IRQ vector:
1605 */ 1635 */
1606 disable_8259A_irq(0); 1636 disable_8259A_irq(0);
1607 vector = assign_irq_vector(0, TARGET_CPUS, &mask); 1637 assign_irq_vector(0, TARGET_CPUS);
1608 1638
1609 /* 1639 /*
1610 * Subtle, code in do_timer_interrupt() expects an AEOI 1640 * Subtle, code in do_timer_interrupt() expects an AEOI
@@ -1624,7 +1654,7 @@ static inline void check_timer(void)
1624 apic2 = ioapic_i8259.apic; 1654 apic2 = ioapic_i8259.apic;
1625 1655
1626 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", 1656 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
1627 vector, apic1, pin1, apic2, pin2); 1657 cfg->vector, apic1, pin1, apic2, pin2);
1628 1658
1629 if (pin1 != -1) { 1659 if (pin1 != -1) {
1630 /* 1660 /*
@@ -1655,7 +1685,7 @@ static inline void check_timer(void)
1655 /* 1685 /*
1656 * legacy devices should be connected to IO APIC #0 1686 * legacy devices should be connected to IO APIC #0
1657 */ 1687 */
1658 setup_ExtINT_IRQ0_pin(apic2, pin2, vector); 1688 setup_ExtINT_IRQ0_pin(apic2, pin2, cfg->vector);
1659 if (timer_irq_works()) { 1689 if (timer_irq_works()) {
1660 apic_printk(APIC_VERBOSE," works.\n"); 1690 apic_printk(APIC_VERBOSE," works.\n");
1661 nmi_watchdog_default(); 1691 nmi_watchdog_default();
@@ -1680,14 +1710,14 @@ static inline void check_timer(void)
1680 1710
1681 disable_8259A_irq(0); 1711 disable_8259A_irq(0);
1682 irq_desc[0].chip = &lapic_irq_type; 1712 irq_desc[0].chip = &lapic_irq_type;
1683 apic_write(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */ 1713 apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */
1684 enable_8259A_irq(0); 1714 enable_8259A_irq(0);
1685 1715
1686 if (timer_irq_works()) { 1716 if (timer_irq_works()) {
1687 apic_printk(APIC_VERBOSE," works.\n"); 1717 apic_printk(APIC_VERBOSE," works.\n");
1688 return; 1718 return;
1689 } 1719 }
1690 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); 1720 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
1691 apic_printk(APIC_VERBOSE," failed.\n"); 1721 apic_printk(APIC_VERBOSE," failed.\n");
1692 1722
1693 apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ..."); 1723 apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ...");
@@ -1834,19 +1864,16 @@ int create_irq(void)
1834 /* Allocate an unused irq */ 1864 /* Allocate an unused irq */
1835 int irq; 1865 int irq;
1836 int new; 1866 int new;
1837 int vector = 0;
1838 unsigned long flags; 1867 unsigned long flags;
1839 cpumask_t mask;
1840 1868
1841 irq = -ENOSPC; 1869 irq = -ENOSPC;
1842 spin_lock_irqsave(&vector_lock, flags); 1870 spin_lock_irqsave(&vector_lock, flags);
1843 for (new = (NR_IRQS - 1); new >= 0; new--) { 1871 for (new = (NR_IRQS - 1); new >= 0; new--) {
1844 if (platform_legacy_irq(new)) 1872 if (platform_legacy_irq(new))
1845 continue; 1873 continue;
1846 if (irq_vector[new] != 0) 1874 if (irq_cfg[new].vector != 0)
1847 continue; 1875 continue;
1848 vector = __assign_irq_vector(new, TARGET_CPUS, &mask); 1876 if (__assign_irq_vector(new, TARGET_CPUS) == 0)
1849 if (likely(vector > 0))
1850 irq = new; 1877 irq = new;
1851 break; 1878 break;
1852 } 1879 }
@@ -1875,12 +1902,15 @@ void destroy_irq(unsigned int irq)
1875#ifdef CONFIG_PCI_MSI 1902#ifdef CONFIG_PCI_MSI
1876static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg) 1903static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
1877{ 1904{
1878 int vector; 1905 struct irq_cfg *cfg = irq_cfg + irq;
1906 int err;
1879 unsigned dest; 1907 unsigned dest;
1880 cpumask_t tmp; 1908 cpumask_t tmp;
1881 1909
1882 vector = assign_irq_vector(irq, TARGET_CPUS, &tmp); 1910 tmp = TARGET_CPUS;
1883 if (vector >= 0) { 1911 err = assign_irq_vector(irq, tmp);
1912 if (!err) {
1913 cpus_and(tmp, cfg->domain, tmp);
1884 dest = cpu_mask_to_apicid(tmp); 1914 dest = cpu_mask_to_apicid(tmp);
1885 1915
1886 msg->address_hi = MSI_ADDR_BASE_HI; 1916 msg->address_hi = MSI_ADDR_BASE_HI;
@@ -1900,40 +1930,38 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
1900 ((INT_DELIVERY_MODE != dest_LowestPrio) ? 1930 ((INT_DELIVERY_MODE != dest_LowestPrio) ?
1901 MSI_DATA_DELIVERY_FIXED: 1931 MSI_DATA_DELIVERY_FIXED:
1902 MSI_DATA_DELIVERY_LOWPRI) | 1932 MSI_DATA_DELIVERY_LOWPRI) |
1903 MSI_DATA_VECTOR(vector); 1933 MSI_DATA_VECTOR(cfg->vector);
1904 } 1934 }
1905 return vector; 1935 return err;
1906} 1936}
1907 1937
1908#ifdef CONFIG_SMP 1938#ifdef CONFIG_SMP
1909static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) 1939static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
1910{ 1940{
1941 struct irq_cfg *cfg = irq_cfg + irq;
1911 struct msi_msg msg; 1942 struct msi_msg msg;
1912 unsigned int dest; 1943 unsigned int dest;
1913 cpumask_t tmp; 1944 cpumask_t tmp;
1914 int vector;
1915 1945
1916 cpus_and(tmp, mask, cpu_online_map); 1946 cpus_and(tmp, mask, cpu_online_map);
1917 if (cpus_empty(tmp)) 1947 if (cpus_empty(tmp))
1918 tmp = TARGET_CPUS; 1948 return;
1919
1920 cpus_and(mask, tmp, CPU_MASK_ALL);
1921 1949
1922 vector = assign_irq_vector(irq, mask, &tmp); 1950 if (assign_irq_vector(irq, mask))
1923 if (vector < 0)
1924 return; 1951 return;
1925 1952
1953 cpus_and(tmp, cfg->domain, mask);
1926 dest = cpu_mask_to_apicid(tmp); 1954 dest = cpu_mask_to_apicid(tmp);
1927 1955
1928 read_msi_msg(irq, &msg); 1956 read_msi_msg(irq, &msg);
1929 1957
1930 msg.data &= ~MSI_DATA_VECTOR_MASK; 1958 msg.data &= ~MSI_DATA_VECTOR_MASK;
1931 msg.data |= MSI_DATA_VECTOR(vector); 1959 msg.data |= MSI_DATA_VECTOR(cfg->vector);
1932 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; 1960 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
1933 msg.address_lo |= MSI_ADDR_DEST_ID(dest); 1961 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
1934 1962
1935 write_msi_msg(irq, &msg); 1963 write_msi_msg(irq, &msg);
1936 set_native_irq_info(irq, mask); 1964 irq_desc[irq].affinity = mask;
1937} 1965}
1938#endif /* CONFIG_SMP */ 1966#endif /* CONFIG_SMP */
1939 1967
@@ -2004,24 +2032,22 @@ static void target_ht_irq(unsigned int irq, unsigned int dest, u8 vector)
2004 2032
2005static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask) 2033static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
2006{ 2034{
2035 struct irq_cfg *cfg = irq_cfg + irq;
2007 unsigned int dest; 2036 unsigned int dest;
2008 cpumask_t tmp; 2037 cpumask_t tmp;
2009 int vector;
2010 2038
2011 cpus_and(tmp, mask, cpu_online_map); 2039 cpus_and(tmp, mask, cpu_online_map);
2012 if (cpus_empty(tmp)) 2040 if (cpus_empty(tmp))
2013 tmp = TARGET_CPUS; 2041 return;
2014
2015 cpus_and(mask, tmp, CPU_MASK_ALL);
2016 2042
2017 vector = assign_irq_vector(irq, mask, &tmp); 2043 if (assign_irq_vector(irq, mask))
2018 if (vector < 0)
2019 return; 2044 return;
2020 2045
2046 cpus_and(tmp, cfg->domain, mask);
2021 dest = cpu_mask_to_apicid(tmp); 2047 dest = cpu_mask_to_apicid(tmp);
2022 2048
2023 target_ht_irq(irq, dest, vector); 2049 target_ht_irq(irq, dest, cfg->vector);
2024 set_native_irq_info(irq, mask); 2050 irq_desc[irq].affinity = mask;
2025} 2051}
2026#endif 2052#endif
2027 2053
@@ -2038,14 +2064,17 @@ static struct irq_chip ht_irq_chip = {
2038 2064
2039int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev) 2065int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
2040{ 2066{
2041 int vector; 2067 struct irq_cfg *cfg = irq_cfg + irq;
2068 int err;
2042 cpumask_t tmp; 2069 cpumask_t tmp;
2043 2070
2044 vector = assign_irq_vector(irq, TARGET_CPUS, &tmp); 2071 tmp = TARGET_CPUS;
2045 if (vector >= 0) { 2072 err = assign_irq_vector(irq, tmp);
2073 if (!err) {
2046 struct ht_irq_msg msg; 2074 struct ht_irq_msg msg;
2047 unsigned dest; 2075 unsigned dest;
2048 2076
2077 cpus_and(tmp, cfg->domain, tmp);
2049 dest = cpu_mask_to_apicid(tmp); 2078 dest = cpu_mask_to_apicid(tmp);
2050 2079
2051 msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest); 2080 msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest);
@@ -2053,7 +2082,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
2053 msg.address_lo = 2082 msg.address_lo =
2054 HT_IRQ_LOW_BASE | 2083 HT_IRQ_LOW_BASE |
2055 HT_IRQ_LOW_DEST_ID(dest) | 2084 HT_IRQ_LOW_DEST_ID(dest) |
2056 HT_IRQ_LOW_VECTOR(vector) | 2085 HT_IRQ_LOW_VECTOR(cfg->vector) |
2057 ((INT_DEST_MODE == 0) ? 2086 ((INT_DEST_MODE == 0) ?
2058 HT_IRQ_LOW_DM_PHYSICAL : 2087 HT_IRQ_LOW_DM_PHYSICAL :
2059 HT_IRQ_LOW_DM_LOGICAL) | 2088 HT_IRQ_LOW_DM_LOGICAL) |
@@ -2068,7 +2097,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
2068 set_irq_chip_and_handler_name(irq, &ht_irq_chip, 2097 set_irq_chip_and_handler_name(irq, &ht_irq_chip,
2069 handle_edge_irq, "edge"); 2098 handle_edge_irq, "edge");
2070 } 2099 }
2071 return vector; 2100 return err;
2072} 2101}
2073#endif /* CONFIG_HT_IRQ */ 2102#endif /* CONFIG_HT_IRQ */
2074 2103
@@ -2095,11 +2124,6 @@ int __init io_apic_get_redir_entries (int ioapic)
2095 2124
2096int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity) 2125int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
2097{ 2126{
2098 struct IO_APIC_route_entry entry;
2099 unsigned long flags;
2100 int vector;
2101 cpumask_t mask;
2102
2103 if (!IO_APIC_IRQ(irq)) { 2127 if (!IO_APIC_IRQ(irq)) {
2104 apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", 2128 apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
2105 ioapic); 2129 ioapic);
@@ -2112,42 +2136,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
2112 if (irq >= 16) 2136 if (irq >= 16)
2113 add_pin_to_irq(irq, ioapic, pin); 2137 add_pin_to_irq(irq, ioapic, pin);
2114 2138
2115 2139 setup_IO_APIC_irq(ioapic, pin, irq, triggering, polarity);
2116 vector = assign_irq_vector(irq, TARGET_CPUS, &mask);
2117 if (vector < 0)
2118 return vector;
2119
2120 /*
2121 * Generate a PCI IRQ routing entry and program the IOAPIC accordingly.
2122 * Note that we mask (disable) IRQs now -- these get enabled when the
2123 * corresponding device driver registers for this IRQ.
2124 */
2125
2126 memset(&entry,0,sizeof(entry));
2127
2128 entry.delivery_mode = INT_DELIVERY_MODE;
2129 entry.dest_mode = INT_DEST_MODE;
2130 entry.dest = cpu_mask_to_apicid(mask);
2131 entry.trigger = triggering;
2132 entry.polarity = polarity;
2133 entry.mask = 1; /* Disabled (masked) */
2134 entry.vector = vector & 0xff;
2135
2136 apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
2137 "IRQ %d Mode:%i Active:%i)\n", ioapic,
2138 mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq,
2139 triggering, polarity);
2140
2141 ioapic_register_intr(irq, entry.vector, triggering);
2142
2143 if (!ioapic && (irq < 16))
2144 disable_8259A_irq(irq);
2145
2146 ioapic_write_entry(ioapic, pin, entry);
2147
2148 spin_lock_irqsave(&ioapic_lock, flags);
2149 set_native_irq_info(irq, TARGET_CPUS);
2150 spin_unlock_irqrestore(&ioapic_lock, flags);
2151 2140
2152 return 0; 2141 return 0;
2153} 2142}
@@ -2179,8 +2168,10 @@ void __init setup_ioapic_dest(void)
2179 * when you have too many devices, because at that time only boot 2168 * when you have too many devices, because at that time only boot
2180 * cpu is online. 2169 * cpu is online.
2181 */ 2170 */
2182 if(!irq_vector[irq]) 2171 if (!irq_cfg[irq].vector)
2183 setup_IO_APIC_irq(ioapic, pin, irq_entry, irq); 2172 setup_IO_APIC_irq(ioapic, pin, irq,
2173 irq_trigger(irq_entry),
2174 irq_polarity(irq_entry));
2184 else 2175 else
2185 set_ioapic_affinity_irq(irq, TARGET_CPUS); 2176 set_ioapic_affinity_irq(irq, TARGET_CPUS);
2186 } 2177 }
diff --git a/drivers/char/agp/Makefile b/drivers/char/agp/Makefile
index a0d04a23dacd..627f542827c7 100644
--- a/drivers/char/agp/Makefile
+++ b/drivers/char/agp/Makefile
@@ -1,7 +1,8 @@
1agpgart-y := backend.o frontend.o generic.o isoch.o 1agpgart-y := backend.o frontend.o generic.o isoch.o
2 2
3agpgart-$(CONFIG_COMPAT) += compat_ioctl.o
4
3obj-$(CONFIG_AGP) += agpgart.o 5obj-$(CONFIG_AGP) += agpgart.o
4obj-$(CONFIG_COMPAT) += compat_ioctl.o
5obj-$(CONFIG_AGP_ALI) += ali-agp.o 6obj-$(CONFIG_AGP_ALI) += ali-agp.o
6obj-$(CONFIG_AGP_ATI) += ati-agp.o 7obj-$(CONFIG_AGP_ATI) += ati-agp.o
7obj-$(CONFIG_AGP_AMD) += amd-k7-agp.o 8obj-$(CONFIG_AGP_AMD) += amd-k7-agp.o
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 9bd68d9f0f59..fdbca25a3948 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -93,12 +93,12 @@ struct aper_size_info_fixed {
93 93
94struct agp_bridge_driver { 94struct agp_bridge_driver {
95 struct module *owner; 95 struct module *owner;
96 void *aperture_sizes; 96 const void *aperture_sizes;
97 int num_aperture_sizes; 97 int num_aperture_sizes;
98 enum aper_size_type size_type; 98 enum aper_size_type size_type;
99 int cant_use_aperture; 99 int cant_use_aperture;
100 int needs_scratch_page; 100 int needs_scratch_page;
101 struct gatt_mask *masks; 101 const struct gatt_mask *masks;
102 int (*fetch_size)(void); 102 int (*fetch_size)(void);
103 int (*configure)(void); 103 int (*configure)(void);
104 void (*agp_enable)(struct agp_bridge_data *, u32); 104 void (*agp_enable)(struct agp_bridge_data *, u32);
@@ -119,7 +119,7 @@ struct agp_bridge_driver {
119 119
120struct agp_bridge_data { 120struct agp_bridge_data {
121 const struct agp_version *version; 121 const struct agp_version *version;
122 struct agp_bridge_driver *driver; 122 const struct agp_bridge_driver *driver;
123 struct vm_operations_struct *vm_ops; 123 struct vm_operations_struct *vm_ops;
124 void *previous_size; 124 void *previous_size;
125 void *current_size; 125 void *current_size;
@@ -290,7 +290,7 @@ void agp3_generic_cleanup(void);
290 290
291/* aperture sizes have been standardised since v3 */ 291/* aperture sizes have been standardised since v3 */
292#define AGP_GENERIC_SIZES_ENTRIES 11 292#define AGP_GENERIC_SIZES_ENTRIES 11
293extern struct aper_size_info_16 agp3_generic_sizes[]; 293extern const struct aper_size_info_16 agp3_generic_sizes[];
294 294
295#define virt_to_gart(x) (phys_to_gart(virt_to_phys(x))) 295#define virt_to_gart(x) (phys_to_gart(virt_to_phys(x)))
296#define gart_to_virt(x) (phys_to_virt(gart_to_phys(x))) 296#define gart_to_virt(x) (phys_to_virt(gart_to_phys(x)))
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 98177a93076f..5b684fddcc03 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -182,7 +182,7 @@ static void m1541_destroy_page(void * addr)
182 182
183/* Setup function */ 183/* Setup function */
184 184
185static struct aper_size_info_32 ali_generic_sizes[7] = 185static const struct aper_size_info_32 ali_generic_sizes[7] =
186{ 186{
187 {256, 65536, 6, 10}, 187 {256, 65536, 6, 10},
188 {128, 32768, 5, 9}, 188 {128, 32768, 5, 9},
@@ -193,7 +193,7 @@ static struct aper_size_info_32 ali_generic_sizes[7] =
193 {4, 1024, 0, 3} 193 {4, 1024, 0, 3}
194}; 194};
195 195
196static struct agp_bridge_driver ali_generic_bridge = { 196static const struct agp_bridge_driver ali_generic_bridge = {
197 .owner = THIS_MODULE, 197 .owner = THIS_MODULE,
198 .aperture_sizes = ali_generic_sizes, 198 .aperture_sizes = ali_generic_sizes,
199 .size_type = U32_APER_SIZE, 199 .size_type = U32_APER_SIZE,
@@ -217,7 +217,7 @@ static struct agp_bridge_driver ali_generic_bridge = {
217 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 217 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
218}; 218};
219 219
220static struct agp_bridge_driver ali_m1541_bridge = { 220static const struct agp_bridge_driver ali_m1541_bridge = {
221 .owner = THIS_MODULE, 221 .owner = THIS_MODULE,
222 .aperture_sizes = ali_generic_sizes, 222 .aperture_sizes = ali_generic_sizes,
223 .size_type = U32_APER_SIZE, 223 .size_type = U32_APER_SIZE,
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 3d8d448bf394..e6c534e62846 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -344,7 +344,7 @@ static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
344 return 0; 344 return 0;
345} 345}
346 346
347static struct aper_size_info_lvl2 amd_irongate_sizes[7] = 347static const struct aper_size_info_lvl2 amd_irongate_sizes[7] =
348{ 348{
349 {2048, 524288, 0x0000000c}, 349 {2048, 524288, 0x0000000c},
350 {1024, 262144, 0x0000000a}, 350 {1024, 262144, 0x0000000a},
@@ -355,12 +355,12 @@ static struct aper_size_info_lvl2 amd_irongate_sizes[7] =
355 {32, 8192, 0x00000000} 355 {32, 8192, 0x00000000}
356}; 356};
357 357
358static struct gatt_mask amd_irongate_masks[] = 358static const struct gatt_mask amd_irongate_masks[] =
359{ 359{
360 {.mask = 1, .type = 0} 360 {.mask = 1, .type = 0}
361}; 361};
362 362
363static struct agp_bridge_driver amd_irongate_driver = { 363static const struct agp_bridge_driver amd_irongate_driver = {
364 .owner = THIS_MODULE, 364 .owner = THIS_MODULE,
365 .aperture_sizes = amd_irongate_sizes, 365 .aperture_sizes = amd_irongate_sizes,
366 .size_type = LVL2_APER_SIZE, 366 .size_type = LVL2_APER_SIZE,
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 636d984ed4a6..485720486d60 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -192,7 +192,7 @@ static u64 amd64_configure (struct pci_dev *hammer, u64 gatt_table)
192} 192}
193 193
194 194
195static struct aper_size_info_32 amd_8151_sizes[7] = 195static const struct aper_size_info_32 amd_8151_sizes[7] =
196{ 196{
197 {2048, 524288, 9, 0x00000000 }, /* 0 0 0 0 0 0 */ 197 {2048, 524288, 9, 0x00000000 }, /* 0 0 0 0 0 0 */
198 {1024, 262144, 8, 0x00000400 }, /* 1 0 0 0 0 0 */ 198 {1024, 262144, 8, 0x00000400 }, /* 1 0 0 0 0 0 */
@@ -232,7 +232,7 @@ static void amd64_cleanup(void)
232} 232}
233 233
234 234
235static struct agp_bridge_driver amd_8151_driver = { 235static const struct agp_bridge_driver amd_8151_driver = {
236 .owner = THIS_MODULE, 236 .owner = THIS_MODULE,
237 .aperture_sizes = amd_8151_sizes, 237 .aperture_sizes = amd_8151_sizes,
238 .size_type = U32_APER_SIZE, 238 .size_type = U32_APER_SIZE,
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 77c9ad68fba9..780e59e588ad 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -24,7 +24,7 @@
24#define ATI_GART_CACHE_ENTRY_CNTRL 0x10 24#define ATI_GART_CACHE_ENTRY_CNTRL 0x10
25 25
26 26
27static struct aper_size_info_lvl2 ati_generic_sizes[7] = 27static const struct aper_size_info_lvl2 ati_generic_sizes[7] =
28{ 28{
29 {2048, 524288, 0x0000000c}, 29 {2048, 524288, 0x0000000c},
30 {1024, 262144, 0x0000000a}, 30 {1024, 262144, 0x0000000a},
@@ -410,7 +410,7 @@ static int ati_free_gatt_table(struct agp_bridge_data *bridge)
410 return 0; 410 return 0;
411} 411}
412 412
413static struct agp_bridge_driver ati_generic_bridge = { 413static const struct agp_bridge_driver ati_generic_bridge = {
414 .owner = THIS_MODULE, 414 .owner = THIS_MODULE,
415 .aperture_sizes = ati_generic_sizes, 415 .aperture_sizes = ati_generic_sizes,
416 .size_type = LVL2_APER_SIZE, 416 .size_type = LVL2_APER_SIZE,
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index 658cb1a72d2c..df8da7262853 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -59,7 +59,7 @@ static struct _efficeon_private {
59 unsigned long l1_table[EFFICEON_L1_SIZE]; 59 unsigned long l1_table[EFFICEON_L1_SIZE];
60} efficeon_private; 60} efficeon_private;
61 61
62static struct gatt_mask efficeon_generic_masks[] = 62static const struct gatt_mask efficeon_generic_masks[] =
63{ 63{
64 {.mask = 0x00000001, .type = 0} 64 {.mask = 0x00000001, .type = 0}
65}; 65};
@@ -70,7 +70,7 @@ static inline unsigned long efficeon_mask_memory(unsigned long addr)
70 return addr | 0x00000001; 70 return addr | 0x00000001;
71} 71}
72 72
73static struct aper_size_info_lvl2 efficeon_generic_sizes[4] = 73static const struct aper_size_info_lvl2 efficeon_generic_sizes[4] =
74{ 74{
75 {256, 65536, 0}, 75 {256, 65536, 0},
76 {128, 32768, 32}, 76 {128, 32768, 32},
@@ -309,7 +309,7 @@ static int efficeon_remove_memory(struct agp_memory * mem, off_t pg_start, int t
309} 309}
310 310
311 311
312static struct agp_bridge_driver efficeon_driver = { 312static const struct agp_bridge_driver efficeon_driver = {
313 .owner = THIS_MODULE, 313 .owner = THIS_MODULE,
314 .aperture_sizes = efficeon_generic_sizes, 314 .aperture_sizes = efficeon_generic_sizes,
315 .size_type = LVL2_APER_SIZE, 315 .size_type = LVL2_APER_SIZE,
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 7923337c3d26..f902d71947ba 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -1340,7 +1340,7 @@ void agp3_generic_cleanup(void)
1340} 1340}
1341EXPORT_SYMBOL(agp3_generic_cleanup); 1341EXPORT_SYMBOL(agp3_generic_cleanup);
1342 1342
1343struct aper_size_info_16 agp3_generic_sizes[AGP_GENERIC_SIZES_ENTRIES] = 1343const struct aper_size_info_16 agp3_generic_sizes[AGP_GENERIC_SIZES_ENTRIES] =
1344{ 1344{
1345 {4096, 1048576, 10,0x000}, 1345 {4096, 1048576, 10,0x000},
1346 {2048, 524288, 9, 0x800}, 1346 {2048, 524288, 9, 0x800},
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 847deabf7f9b..79f7c01db75a 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -419,7 +419,7 @@ hp_zx1_enable (struct agp_bridge_data *bridge, u32 mode)
419 agp_device_command(command, (mode & AGP8X_MODE) != 0); 419 agp_device_command(command, (mode & AGP8X_MODE) != 0);
420} 420}
421 421
422struct agp_bridge_driver hp_zx1_driver = { 422struct const agp_bridge_driver hp_zx1_driver = {
423 .owner = THIS_MODULE, 423 .owner = THIS_MODULE,
424 .size_type = FIXED_APER_SIZE, 424 .size_type = FIXED_APER_SIZE,
425 .configure = hp_zx1_configure, 425 .configure = hp_zx1_configure,
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
index 3e7618653abd..1cde376a45ef 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -78,7 +78,7 @@ static struct {
78 } *lp_desc; 78 } *lp_desc;
79} i460; 79} i460;
80 80
81static struct aper_size_info_8 i460_sizes[3] = 81static const struct aper_size_info_8 i460_sizes[3] =
82{ 82{
83 /* 83 /*
84 * The 32GB aperture is only available with a 4M GART page size. Due to the 84 * The 32GB aperture is only available with a 4M GART page size. Due to the
@@ -550,7 +550,7 @@ static unsigned long i460_mask_memory (struct agp_bridge_data *bridge,
550 | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xfffff000) >> 12); 550 | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xfffff000) >> 12);
551} 551}
552 552
553struct agp_bridge_driver intel_i460_driver = { 553struct const agp_bridge_driver intel_i460_driver = {
554 .owner = THIS_MODULE, 554 .owner = THIS_MODULE,
555 .aperture_sizes = i460_sizes, 555 .aperture_sizes = i460_sizes,
556 .size_type = U8_APER_SIZE, 556 .size_type = U8_APER_SIZE,
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 06b0bb6d982f..e542a628f1c7 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -63,7 +63,7 @@ extern int agp_memory_reserved;
63#define INTEL_I7505_AGPCTRL 0x70 63#define INTEL_I7505_AGPCTRL 0x70
64#define INTEL_I7505_MCHCFG 0x50 64#define INTEL_I7505_MCHCFG 0x50
65 65
66static struct aper_size_info_fixed intel_i810_sizes[] = 66static const struct aper_size_info_fixed intel_i810_sizes[] =
67{ 67{
68 {64, 16384, 4}, 68 {64, 16384, 4},
69 /* The 32M mode still requires a 64k gatt */ 69 /* The 32M mode still requires a 64k gatt */
@@ -1365,18 +1365,18 @@ static int intel_7505_configure(void)
1365} 1365}
1366 1366
1367/* Setup function */ 1367/* Setup function */
1368static struct gatt_mask intel_generic_masks[] = 1368static const struct gatt_mask intel_generic_masks[] =
1369{ 1369{
1370 {.mask = 0x00000017, .type = 0} 1370 {.mask = 0x00000017, .type = 0}
1371}; 1371};
1372 1372
1373static struct aper_size_info_8 intel_815_sizes[2] = 1373static const struct aper_size_info_8 intel_815_sizes[2] =
1374{ 1374{
1375 {64, 16384, 4, 0}, 1375 {64, 16384, 4, 0},
1376 {32, 8192, 3, 8}, 1376 {32, 8192, 3, 8},
1377}; 1377};
1378 1378
1379static struct aper_size_info_8 intel_8xx_sizes[7] = 1379static const struct aper_size_info_8 intel_8xx_sizes[7] =
1380{ 1380{
1381 {256, 65536, 6, 0}, 1381 {256, 65536, 6, 0},
1382 {128, 32768, 5, 32}, 1382 {128, 32768, 5, 32},
@@ -1387,7 +1387,7 @@ static struct aper_size_info_8 intel_8xx_sizes[7] =
1387 {4, 1024, 0, 63} 1387 {4, 1024, 0, 63}
1388}; 1388};
1389 1389
1390static struct aper_size_info_16 intel_generic_sizes[7] = 1390static const struct aper_size_info_16 intel_generic_sizes[7] =
1391{ 1391{
1392 {256, 65536, 6, 0}, 1392 {256, 65536, 6, 0},
1393 {128, 32768, 5, 32}, 1393 {128, 32768, 5, 32},
@@ -1398,7 +1398,7 @@ static struct aper_size_info_16 intel_generic_sizes[7] =
1398 {4, 1024, 0, 63} 1398 {4, 1024, 0, 63}
1399}; 1399};
1400 1400
1401static struct aper_size_info_8 intel_830mp_sizes[4] = 1401static const struct aper_size_info_8 intel_830mp_sizes[4] =
1402{ 1402{
1403 {256, 65536, 6, 0}, 1403 {256, 65536, 6, 0},
1404 {128, 32768, 5, 32}, 1404 {128, 32768, 5, 32},
@@ -1406,7 +1406,7 @@ static struct aper_size_info_8 intel_830mp_sizes[4] =
1406 {32, 8192, 3, 56} 1406 {32, 8192, 3, 56}
1407}; 1407};
1408 1408
1409static struct agp_bridge_driver intel_generic_driver = { 1409static const struct agp_bridge_driver intel_generic_driver = {
1410 .owner = THIS_MODULE, 1410 .owner = THIS_MODULE,
1411 .aperture_sizes = intel_generic_sizes, 1411 .aperture_sizes = intel_generic_sizes,
1412 .size_type = U16_APER_SIZE, 1412 .size_type = U16_APER_SIZE,
@@ -1430,7 +1430,7 @@ static struct agp_bridge_driver intel_generic_driver = {
1430 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1430 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1431}; 1431};
1432 1432
1433static struct agp_bridge_driver intel_810_driver = { 1433static const struct agp_bridge_driver intel_810_driver = {
1434 .owner = THIS_MODULE, 1434 .owner = THIS_MODULE,
1435 .aperture_sizes = intel_i810_sizes, 1435 .aperture_sizes = intel_i810_sizes,
1436 .size_type = FIXED_APER_SIZE, 1436 .size_type = FIXED_APER_SIZE,
@@ -1455,7 +1455,7 @@ static struct agp_bridge_driver intel_810_driver = {
1455 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1455 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1456}; 1456};
1457 1457
1458static struct agp_bridge_driver intel_815_driver = { 1458static const struct agp_bridge_driver intel_815_driver = {
1459 .owner = THIS_MODULE, 1459 .owner = THIS_MODULE,
1460 .aperture_sizes = intel_815_sizes, 1460 .aperture_sizes = intel_815_sizes,
1461 .size_type = U8_APER_SIZE, 1461 .size_type = U8_APER_SIZE,
@@ -1479,7 +1479,7 @@ static struct agp_bridge_driver intel_815_driver = {
1479 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1479 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1480}; 1480};
1481 1481
1482static struct agp_bridge_driver intel_830_driver = { 1482static const struct agp_bridge_driver intel_830_driver = {
1483 .owner = THIS_MODULE, 1483 .owner = THIS_MODULE,
1484 .aperture_sizes = intel_i830_sizes, 1484 .aperture_sizes = intel_i830_sizes,
1485 .size_type = FIXED_APER_SIZE, 1485 .size_type = FIXED_APER_SIZE,
@@ -1504,7 +1504,7 @@ static struct agp_bridge_driver intel_830_driver = {
1504 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1504 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1505}; 1505};
1506 1506
1507static struct agp_bridge_driver intel_820_driver = { 1507static const struct agp_bridge_driver intel_820_driver = {
1508 .owner = THIS_MODULE, 1508 .owner = THIS_MODULE,
1509 .aperture_sizes = intel_8xx_sizes, 1509 .aperture_sizes = intel_8xx_sizes,
1510 .size_type = U8_APER_SIZE, 1510 .size_type = U8_APER_SIZE,
@@ -1528,7 +1528,7 @@ static struct agp_bridge_driver intel_820_driver = {
1528 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1528 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1529}; 1529};
1530 1530
1531static struct agp_bridge_driver intel_830mp_driver = { 1531static const struct agp_bridge_driver intel_830mp_driver = {
1532 .owner = THIS_MODULE, 1532 .owner = THIS_MODULE,
1533 .aperture_sizes = intel_830mp_sizes, 1533 .aperture_sizes = intel_830mp_sizes,
1534 .size_type = U8_APER_SIZE, 1534 .size_type = U8_APER_SIZE,
@@ -1552,7 +1552,7 @@ static struct agp_bridge_driver intel_830mp_driver = {
1552 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1552 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1553}; 1553};
1554 1554
1555static struct agp_bridge_driver intel_840_driver = { 1555static const struct agp_bridge_driver intel_840_driver = {
1556 .owner = THIS_MODULE, 1556 .owner = THIS_MODULE,
1557 .aperture_sizes = intel_8xx_sizes, 1557 .aperture_sizes = intel_8xx_sizes,
1558 .size_type = U8_APER_SIZE, 1558 .size_type = U8_APER_SIZE,
@@ -1576,7 +1576,7 @@ static struct agp_bridge_driver intel_840_driver = {
1576 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1576 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1577}; 1577};
1578 1578
1579static struct agp_bridge_driver intel_845_driver = { 1579static const struct agp_bridge_driver intel_845_driver = {
1580 .owner = THIS_MODULE, 1580 .owner = THIS_MODULE,
1581 .aperture_sizes = intel_8xx_sizes, 1581 .aperture_sizes = intel_8xx_sizes,
1582 .size_type = U8_APER_SIZE, 1582 .size_type = U8_APER_SIZE,
@@ -1600,7 +1600,7 @@ static struct agp_bridge_driver intel_845_driver = {
1600 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1600 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1601}; 1601};
1602 1602
1603static struct agp_bridge_driver intel_850_driver = { 1603static const struct agp_bridge_driver intel_850_driver = {
1604 .owner = THIS_MODULE, 1604 .owner = THIS_MODULE,
1605 .aperture_sizes = intel_8xx_sizes, 1605 .aperture_sizes = intel_8xx_sizes,
1606 .size_type = U8_APER_SIZE, 1606 .size_type = U8_APER_SIZE,
@@ -1624,7 +1624,7 @@ static struct agp_bridge_driver intel_850_driver = {
1624 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1624 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1625}; 1625};
1626 1626
1627static struct agp_bridge_driver intel_860_driver = { 1627static const struct agp_bridge_driver intel_860_driver = {
1628 .owner = THIS_MODULE, 1628 .owner = THIS_MODULE,
1629 .aperture_sizes = intel_8xx_sizes, 1629 .aperture_sizes = intel_8xx_sizes,
1630 .size_type = U8_APER_SIZE, 1630 .size_type = U8_APER_SIZE,
@@ -1648,7 +1648,7 @@ static struct agp_bridge_driver intel_860_driver = {
1648 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1648 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1649}; 1649};
1650 1650
1651static struct agp_bridge_driver intel_915_driver = { 1651static const struct agp_bridge_driver intel_915_driver = {
1652 .owner = THIS_MODULE, 1652 .owner = THIS_MODULE,
1653 .aperture_sizes = intel_i830_sizes, 1653 .aperture_sizes = intel_i830_sizes,
1654 .size_type = FIXED_APER_SIZE, 1654 .size_type = FIXED_APER_SIZE,
@@ -1673,7 +1673,7 @@ static struct agp_bridge_driver intel_915_driver = {
1673 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1673 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1674}; 1674};
1675 1675
1676static struct agp_bridge_driver intel_i965_driver = { 1676static const struct agp_bridge_driver intel_i965_driver = {
1677 .owner = THIS_MODULE, 1677 .owner = THIS_MODULE,
1678 .aperture_sizes = intel_i830_sizes, 1678 .aperture_sizes = intel_i830_sizes,
1679 .size_type = FIXED_APER_SIZE, 1679 .size_type = FIXED_APER_SIZE,
@@ -1698,7 +1698,7 @@ static struct agp_bridge_driver intel_i965_driver = {
1698 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1698 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1699}; 1699};
1700 1700
1701static struct agp_bridge_driver intel_7505_driver = { 1701static const struct agp_bridge_driver intel_7505_driver = {
1702 .owner = THIS_MODULE, 1702 .owner = THIS_MODULE,
1703 .aperture_sizes = intel_8xx_sizes, 1703 .aperture_sizes = intel_8xx_sizes,
1704 .size_type = U8_APER_SIZE, 1704 .size_type = U8_APER_SIZE,
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index 2563286b2fcf..0c9dab557c94 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -272,7 +272,7 @@ static void nvidia_tlbflush(struct agp_memory *mem)
272} 272}
273 273
274 274
275static struct aper_size_info_8 nvidia_generic_sizes[5] = 275static const struct aper_size_info_8 nvidia_generic_sizes[5] =
276{ 276{
277 {512, 131072, 7, 0}, 277 {512, 131072, 7, 0},
278 {256, 65536, 6, 8}, 278 {256, 65536, 6, 8},
@@ -283,13 +283,13 @@ static struct aper_size_info_8 nvidia_generic_sizes[5] =
283}; 283};
284 284
285 285
286static struct gatt_mask nvidia_generic_masks[] = 286static const struct gatt_mask nvidia_generic_masks[] =
287{ 287{
288 { .mask = 1, .type = 0} 288 { .mask = 1, .type = 0}
289}; 289};
290 290
291 291
292static struct agp_bridge_driver nvidia_driver = { 292static const struct agp_bridge_driver nvidia_driver = {
293 .owner = THIS_MODULE, 293 .owner = THIS_MODULE,
294 .aperture_sizes = nvidia_generic_sizes, 294 .aperture_sizes = nvidia_generic_sizes,
295 .size_type = U8_APER_SIZE, 295 .size_type = U8_APER_SIZE,
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index b7b4590673ae..36d07e3635c6 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -210,7 +210,7 @@ parisc_agp_enable(struct agp_bridge_data *bridge, u32 mode)
210 agp_device_command(command, (mode & AGP8X_MODE) != 0); 210 agp_device_command(command, (mode & AGP8X_MODE) != 0);
211} 211}
212 212
213struct agp_bridge_driver parisc_agp_driver = { 213struct const agp_bridge_driver parisc_agp_driver = {
214 .owner = THIS_MODULE, 214 .owner = THIS_MODULE,
215 .size_type = FIXED_APER_SIZE, 215 .size_type = FIXED_APER_SIZE,
216 .configure = parisc_agp_configure, 216 .configure = parisc_agp_configure,
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c
index 92d1dc45b9be..e12773acf3df 100644
--- a/drivers/char/agp/sgi-agp.c
+++ b/drivers/char/agp/sgi-agp.c
@@ -247,7 +247,7 @@ static struct agp_bridge_data *sgi_tioca_find_bridge(struct pci_dev *pdev)
247 return bridge; 247 return bridge;
248} 248}
249 249
250struct agp_bridge_driver sgi_tioca_driver = { 250struct const agp_bridge_driver sgi_tioca_driver = {
251 .owner = THIS_MODULE, 251 .owner = THIS_MODULE,
252 .size_type = U16_APER_SIZE, 252 .size_type = U16_APER_SIZE,
253 .configure = sgi_tioca_configure, 253 .configure = sgi_tioca_configure,
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 60342b708152..125f4282d955 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -108,7 +108,7 @@ static void sis_delayed_enable(struct agp_bridge_data *bridge, u32 mode)
108 } 108 }
109} 109}
110 110
111static struct aper_size_info_8 sis_generic_sizes[7] = 111static const struct aper_size_info_8 sis_generic_sizes[7] =
112{ 112{
113 {256, 65536, 6, 99}, 113 {256, 65536, 6, 99},
114 {128, 32768, 5, 83}, 114 {128, 32768, 5, 83},
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 9f5ae7714f85..55212a3811fd 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -385,12 +385,12 @@ static int serverworks_remove_memory(struct agp_memory *mem, off_t pg_start,
385 return 0; 385 return 0;
386} 386}
387 387
388static struct gatt_mask serverworks_masks[] = 388static const struct gatt_mask serverworks_masks[] =
389{ 389{
390 {.mask = 1, .type = 0} 390 {.mask = 1, .type = 0}
391}; 391};
392 392
393static struct aper_size_info_lvl2 serverworks_sizes[7] = 393static const struct aper_size_info_lvl2 serverworks_sizes[7] =
394{ 394{
395 {2048, 524288, 0x80000000}, 395 {2048, 524288, 0x80000000},
396 {1024, 262144, 0xc0000000}, 396 {1024, 262144, 0xc0000000},
@@ -423,7 +423,7 @@ static void serverworks_agp_enable(struct agp_bridge_data *bridge, u32 mode)
423 agp_device_command(command, 0); 423 agp_device_command(command, 0);
424} 424}
425 425
426static struct agp_bridge_driver sworks_driver = { 426static const struct agp_bridge_driver sworks_driver = {
427 .owner = THIS_MODULE, 427 .owner = THIS_MODULE,
428 .aperture_sizes = serverworks_sizes, 428 .aperture_sizes = serverworks_sizes,
429 .size_type = LVL2_APER_SIZE, 429 .size_type = LVL2_APER_SIZE,
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 6c45702e542c..292b4ad1ae37 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -460,7 +460,7 @@ void null_cache_flush(void)
460 460
461/* Setup function */ 461/* Setup function */
462 462
463static struct aper_size_info_32 uninorth_sizes[7] = 463static const struct aper_size_info_32 uninorth_sizes[7] =
464{ 464{
465#if 0 /* Not sure uninorth supports that high aperture sizes */ 465#if 0 /* Not sure uninorth supports that high aperture sizes */
466 {256, 65536, 6, 64}, 466 {256, 65536, 6, 64},
@@ -477,7 +477,7 @@ static struct aper_size_info_32 uninorth_sizes[7] =
477 * Not sure that u3 supports that high aperture sizes but it 477 * Not sure that u3 supports that high aperture sizes but it
478 * would strange if it did not :) 478 * would strange if it did not :)
479 */ 479 */
480static struct aper_size_info_32 u3_sizes[8] = 480static const struct aper_size_info_32 u3_sizes[8] =
481{ 481{
482 {512, 131072, 7, 128}, 482 {512, 131072, 7, 128},
483 {256, 65536, 6, 64}, 483 {256, 65536, 6, 64},
@@ -489,7 +489,7 @@ static struct aper_size_info_32 u3_sizes[8] =
489 {4, 1024, 0, 1} 489 {4, 1024, 0, 1}
490}; 490};
491 491
492struct agp_bridge_driver uninorth_agp_driver = { 492struct const agp_bridge_driver uninorth_agp_driver = {
493 .owner = THIS_MODULE, 493 .owner = THIS_MODULE,
494 .aperture_sizes = (void *)uninorth_sizes, 494 .aperture_sizes = (void *)uninorth_sizes,
495 .size_type = U32_APER_SIZE, 495 .size_type = U32_APER_SIZE,
@@ -514,7 +514,7 @@ struct agp_bridge_driver uninorth_agp_driver = {
514 .cant_use_aperture = 1, 514 .cant_use_aperture = 1,
515}; 515};
516 516
517struct agp_bridge_driver u3_agp_driver = { 517struct const agp_bridge_driver u3_agp_driver = {
518 .owner = THIS_MODULE, 518 .owner = THIS_MODULE,
519 .aperture_sizes = (void *)u3_sizes, 519 .aperture_sizes = (void *)u3_sizes,
520 .size_type = U32_APER_SIZE, 520 .size_type = U32_APER_SIZE,
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index 2e7c04370cd9..a2bb4eccaab4 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -89,7 +89,7 @@ static void via_tlbflush(struct agp_memory *mem)
89} 89}
90 90
91 91
92static struct aper_size_info_8 via_generic_sizes[9] = 92static const struct aper_size_info_8 via_generic_sizes[9] =
93{ 93{
94 {256, 65536, 6, 0}, 94 {256, 65536, 6, 0},
95 {128, 32768, 5, 128}, 95 {128, 32768, 5, 128},
@@ -170,7 +170,7 @@ static void via_tlbflush_agp3(struct agp_memory *mem)
170} 170}
171 171
172 172
173static struct agp_bridge_driver via_agp3_driver = { 173static const struct agp_bridge_driver via_agp3_driver = {
174 .owner = THIS_MODULE, 174 .owner = THIS_MODULE,
175 .aperture_sizes = agp3_generic_sizes, 175 .aperture_sizes = agp3_generic_sizes,
176 .size_type = U8_APER_SIZE, 176 .size_type = U8_APER_SIZE,
@@ -194,7 +194,7 @@ static struct agp_bridge_driver via_agp3_driver = {
194 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 194 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
195}; 195};
196 196
197static struct agp_bridge_driver via_driver = { 197static const struct agp_bridge_driver via_driver = {
198 .owner = THIS_MODULE, 198 .owner = THIS_MODULE,
199 .aperture_sizes = via_generic_sizes, 199 .aperture_sizes = via_generic_sizes,
200 .size_type = U8_APER_SIZE, 200 .size_type = U8_APER_SIZE,
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index f4440d329310..509ace7e6881 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -38,6 +38,8 @@
38 * Fix some spin_locks. 38 * Fix some spin_locks.
39 * Do not call uart_add_one_port for absent ports. 39 * Do not call uart_add_one_port for absent ports.
40 * 1.07 Use CONFIG_SERIAL_TXX9_NR_UARTS. Cleanup. 40 * 1.07 Use CONFIG_SERIAL_TXX9_NR_UARTS. Cleanup.
41 * 1.08 Use platform_device.
42 * Fix and cleanup suspend/resume/initialization codes.
41 */ 43 */
42 44
43#if defined(CONFIG_SERIAL_TXX9_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 45#if defined(CONFIG_SERIAL_TXX9_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
@@ -50,7 +52,7 @@
50#include <linux/console.h> 52#include <linux/console.h>
51#include <linux/sysrq.h> 53#include <linux/sysrq.h>
52#include <linux/delay.h> 54#include <linux/delay.h>
53#include <linux/device.h> 55#include <linux/platform_device.h>
54#include <linux/pci.h> 56#include <linux/pci.h>
55#include <linux/tty.h> 57#include <linux/tty.h>
56#include <linux/tty_flip.h> 58#include <linux/tty_flip.h>
@@ -60,7 +62,7 @@
60 62
61#include <asm/io.h> 63#include <asm/io.h>
62 64
63static char *serial_version = "1.07"; 65static char *serial_version = "1.08";
64static char *serial_name = "TX39/49 Serial driver"; 66static char *serial_name = "TX39/49 Serial driver";
65 67
66#define PASS_LIMIT 256 68#define PASS_LIMIT 256
@@ -94,12 +96,7 @@ static char *serial_name = "TX39/49 Serial driver";
94 96
95struct uart_txx9_port { 97struct uart_txx9_port {
96 struct uart_port port; 98 struct uart_port port;
97 99 /* No additional info for now */
98 /*
99 * We provide a per-port pm hook.
100 */
101 void (*pm)(struct uart_port *port,
102 unsigned int state, unsigned int old);
103}; 100};
104 101
105#define TXX9_REGION_SIZE 0x24 102#define TXX9_REGION_SIZE 0x24
@@ -277,6 +274,31 @@ static void serial_txx9_enable_ms(struct uart_port *port)
277 /* TXX9-SIO can not control DTR... */ 274 /* TXX9-SIO can not control DTR... */
278} 275}
279 276
277static void serial_txx9_initialize(struct uart_port *port)
278{
279 struct uart_txx9_port *up = (struct uart_txx9_port *)port;
280 unsigned int tmout = 10000;
281
282 sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST);
283 /* TX4925 BUG WORKAROUND. Accessing SIOC register
284 * immediately after soft reset causes bus error. */
285 mmiowb();
286 udelay(1);
287 while ((sio_in(up, TXX9_SIFCR) & TXX9_SIFCR_SWRST) && --tmout)
288 udelay(1);
289 /* TX Int by FIFO Empty, RX Int by Receiving 1 char. */
290 sio_set(up, TXX9_SIFCR,
291 TXX9_SIFCR_TDIL_MAX | TXX9_SIFCR_RDIL_1);
292 /* initial settings */
293 sio_out(up, TXX9_SILCR,
294 TXX9_SILCR_UMODE_8BIT | TXX9_SILCR_USBL_1BIT |
295 ((up->port.flags & UPF_TXX9_USE_SCLK) ?
296 TXX9_SILCR_SCS_SCLK_BG : TXX9_SILCR_SCS_IMCLK_BG));
297 sio_quot_set(up, uart_get_divisor(port, 9600));
298 sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */);
299 sio_out(up, TXX9_SIDICR, 0);
300}
301
280static inline void 302static inline void
281receive_chars(struct uart_txx9_port *up, unsigned int *status) 303receive_chars(struct uart_txx9_port *up, unsigned int *status)
282{ 304{
@@ -657,9 +679,8 @@ static void
657serial_txx9_pm(struct uart_port *port, unsigned int state, 679serial_txx9_pm(struct uart_port *port, unsigned int state,
658 unsigned int oldstate) 680 unsigned int oldstate)
659{ 681{
660 struct uart_txx9_port *up = (struct uart_txx9_port *)port; 682 if (state == 0)
661 if (up->pm) 683 serial_txx9_initialize(port);
662 up->pm(port, state, oldstate);
663} 684}
664 685
665static int serial_txx9_request_resource(struct uart_txx9_port *up) 686static int serial_txx9_request_resource(struct uart_txx9_port *up)
@@ -732,7 +753,6 @@ static int serial_txx9_request_port(struct uart_port *port)
732static void serial_txx9_config_port(struct uart_port *port, int uflags) 753static void serial_txx9_config_port(struct uart_port *port, int uflags)
733{ 754{
734 struct uart_txx9_port *up = (struct uart_txx9_port *)port; 755 struct uart_txx9_port *up = (struct uart_txx9_port *)port;
735 unsigned long flags;
736 int ret; 756 int ret;
737 757
738 /* 758 /*
@@ -749,30 +769,7 @@ static void serial_txx9_config_port(struct uart_port *port, int uflags)
749 if (up->port.line == up->port.cons->index) 769 if (up->port.line == up->port.cons->index)
750 return; 770 return;
751#endif 771#endif
752 spin_lock_irqsave(&up->port.lock, flags); 772 serial_txx9_initialize(port);
753 /*
754 * Reset the UART.
755 */
756 sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST);
757#ifdef CONFIG_CPU_TX49XX
758 /* TX4925 BUG WORKAROUND. Accessing SIOC register
759 * immediately after soft reset causes bus error. */
760 iob();
761 udelay(1);
762#endif
763 while (sio_in(up, TXX9_SIFCR) & TXX9_SIFCR_SWRST)
764 ;
765 /* TX Int by FIFO Empty, RX Int by Receiving 1 char. */
766 sio_set(up, TXX9_SIFCR,
767 TXX9_SIFCR_TDIL_MAX | TXX9_SIFCR_RDIL_1);
768 /* initial settings */
769 sio_out(up, TXX9_SILCR,
770 TXX9_SILCR_UMODE_8BIT | TXX9_SILCR_USBL_1BIT |
771 ((up->port.flags & UPF_TXX9_USE_SCLK) ?
772 TXX9_SILCR_SCS_SCLK_BG : TXX9_SILCR_SCS_IMCLK_BG));
773 sio_quot_set(up, uart_get_divisor(port, 9600));
774 sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */);
775 spin_unlock_irqrestore(&up->port.lock, flags);
776} 773}
777 774
778static int 775static int
@@ -818,7 +815,8 @@ static struct uart_ops serial_txx9_pops = {
818 815
819static struct uart_txx9_port serial_txx9_ports[UART_NR]; 816static struct uart_txx9_port serial_txx9_ports[UART_NR];
820 817
821static void __init serial_txx9_register_ports(struct uart_driver *drv) 818static void __init serial_txx9_register_ports(struct uart_driver *drv,
819 struct device *dev)
822{ 820{
823 int i; 821 int i;
824 822
@@ -827,6 +825,7 @@ static void __init serial_txx9_register_ports(struct uart_driver *drv)
827 825
828 up->port.line = i; 826 up->port.line = i;
829 up->port.ops = &serial_txx9_pops; 827 up->port.ops = &serial_txx9_pops;
828 up->port.dev = dev;
830 if (up->port.iobase || up->port.mapbase) 829 if (up->port.iobase || up->port.mapbase)
831 uart_add_one_port(drv, &up->port); 830 uart_add_one_port(drv, &up->port);
832 } 831 }
@@ -898,7 +897,7 @@ serial_txx9_console_write(struct console *co, const char *s, unsigned int count)
898 sio_out(up, TXX9_SIDICR, ier); 897 sio_out(up, TXX9_SIDICR, ier);
899} 898}
900 899
901static int serial_txx9_console_setup(struct console *co, char *options) 900static int __init serial_txx9_console_setup(struct console *co, char *options)
902{ 901{
903 struct uart_port *port; 902 struct uart_port *port;
904 struct uart_txx9_port *up; 903 struct uart_txx9_port *up;
@@ -919,17 +918,7 @@ static int serial_txx9_console_setup(struct console *co, char *options)
919 if (!port->ops) 918 if (!port->ops)
920 return -ENODEV; 919 return -ENODEV;
921 920
922 /* 921 serial_txx9_initialize(&up->port);
923 * Disable UART interrupts, set DTR and RTS high
924 * and set speed.
925 */
926 sio_out(up, TXX9_SIDICR, 0);
927 /* initial settings */
928 sio_out(up, TXX9_SILCR,
929 TXX9_SILCR_UMODE_8BIT | TXX9_SILCR_USBL_1BIT |
930 ((port->flags & UPF_TXX9_USE_SCLK) ?
931 TXX9_SILCR_SCS_SCLK_BG : TXX9_SILCR_SCS_IMCLK_BG));
932 sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */);
933 922
934 if (options) 923 if (options)
935 uart_parse_options(options, &baud, &parity, &bits, &flow); 924 uart_parse_options(options, &baud, &parity, &bits, &flow);
@@ -981,31 +970,6 @@ int __init early_serial_txx9_setup(struct uart_port *port)
981 return 0; 970 return 0;
982} 971}
983 972
984#ifdef ENABLE_SERIAL_TXX9_PCI
985#ifdef CONFIG_PM
986/**
987 * serial_txx9_suspend_port - suspend one serial port
988 * @line: serial line number
989 *
990 * Suspend one serial port.
991 */
992static void serial_txx9_suspend_port(int line)
993{
994 uart_suspend_port(&serial_txx9_reg, &serial_txx9_ports[line].port);
995}
996
997/**
998 * serial_txx9_resume_port - resume one serial port
999 * @line: serial line number
1000 *
1001 * Resume one serial port.
1002 */
1003static void serial_txx9_resume_port(int line)
1004{
1005 uart_resume_port(&serial_txx9_reg, &serial_txx9_ports[line].port);
1006}
1007#endif
1008
1009static DEFINE_MUTEX(serial_txx9_mutex); 973static DEFINE_MUTEX(serial_txx9_mutex);
1010 974
1011/** 975/**
@@ -1028,8 +992,18 @@ static int __devinit serial_txx9_register_port(struct uart_port *port)
1028 mutex_lock(&serial_txx9_mutex); 992 mutex_lock(&serial_txx9_mutex);
1029 for (i = 0; i < UART_NR; i++) { 993 for (i = 0; i < UART_NR; i++) {
1030 uart = &serial_txx9_ports[i]; 994 uart = &serial_txx9_ports[i];
1031 if (!(uart->port.iobase || uart->port.mapbase)) 995 if (uart_match_port(&uart->port, port)) {
996 uart_remove_one_port(&serial_txx9_reg, &uart->port);
1032 break; 997 break;
998 }
999 }
1000 if (i == UART_NR) {
1001 /* Find unused port */
1002 for (i = 0; i < UART_NR; i++) {
1003 uart = &serial_txx9_ports[i];
1004 if (!(uart->port.iobase || uart->port.mapbase))
1005 break;
1006 }
1033 } 1007 }
1034 if (i < UART_NR) { 1008 if (i < UART_NR) {
1035 uart->port.iobase = port->iobase; 1009 uart->port.iobase = port->iobase;
@@ -1072,6 +1046,95 @@ static void __devexit serial_txx9_unregister_port(int line)
1072} 1046}
1073 1047
1074/* 1048/*
1049 * Register a set of serial devices attached to a platform device.
1050 */
1051static int __devinit serial_txx9_probe(struct platform_device *dev)
1052{
1053 struct uart_port *p = dev->dev.platform_data;
1054 struct uart_port port;
1055 int ret, i;
1056
1057 memset(&port, 0, sizeof(struct uart_port));
1058 for (i = 0; p && p->uartclk != 0; p++, i++) {
1059 port.iobase = p->iobase;
1060 port.membase = p->membase;
1061 port.irq = p->irq;
1062 port.uartclk = p->uartclk;
1063 port.iotype = p->iotype;
1064 port.flags = p->flags;
1065 port.mapbase = p->mapbase;
1066 port.dev = &dev->dev;
1067 ret = serial_txx9_register_port(&port);
1068 if (ret < 0) {
1069 dev_err(&dev->dev, "unable to register port at index %d "
1070 "(IO%x MEM%lx IRQ%d): %d\n", i,
1071 p->iobase, p->mapbase, p->irq, ret);
1072 }
1073 }
1074 return 0;
1075}
1076
1077/*
1078 * Remove serial ports registered against a platform device.
1079 */
1080static int __devexit serial_txx9_remove(struct platform_device *dev)
1081{
1082 int i;
1083
1084 for (i = 0; i < UART_NR; i++) {
1085 struct uart_txx9_port *up = &serial_txx9_ports[i];
1086
1087 if (up->port.dev == &dev->dev)
1088 serial_txx9_unregister_port(i);
1089 }
1090 return 0;
1091}
1092
1093#ifdef CONFIG_PM
1094static int serial_txx9_suspend(struct platform_device *dev, pm_message_t state)
1095{
1096 int i;
1097
1098 for (i = 0; i < UART_NR; i++) {
1099 struct uart_txx9_port *up = &serial_txx9_ports[i];
1100
1101 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
1102 uart_suspend_port(&serial_txx9_reg, &up->port);
1103 }
1104
1105 return 0;
1106}
1107
1108static int serial_txx9_resume(struct platform_device *dev)
1109{
1110 int i;
1111
1112 for (i = 0; i < UART_NR; i++) {
1113 struct uart_txx9_port *up = &serial_txx9_ports[i];
1114
1115 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
1116 uart_resume_port(&serial_txx9_reg, &up->port);
1117 }
1118
1119 return 0;
1120}
1121#endif
1122
1123static struct platform_driver serial_txx9_plat_driver = {
1124 .probe = serial_txx9_probe,
1125 .remove = __devexit_p(serial_txx9_remove),
1126#ifdef CONFIG_PM
1127 .suspend = serial_txx9_suspend,
1128 .resume = serial_txx9_resume,
1129#endif
1130 .driver = {
1131 .name = "serial_txx9",
1132 .owner = THIS_MODULE,
1133 },
1134};
1135
1136#ifdef ENABLE_SERIAL_TXX9_PCI
1137/*
1075 * Probe one serial board. Unfortunately, there is no rhyme nor reason 1138 * Probe one serial board. Unfortunately, there is no rhyme nor reason
1076 * to the arrangement of serial ports on a PCI card. 1139 * to the arrangement of serial ports on a PCI card.
1077 */ 1140 */
@@ -1097,20 +1160,22 @@ pciserial_txx9_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
1097 line = serial_txx9_register_port(&port); 1160 line = serial_txx9_register_port(&port);
1098 if (line < 0) { 1161 if (line < 0) {
1099 printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), line); 1162 printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), line);
1163 pci_disable_device(dev);
1164 return line;
1100 } 1165 }
1101 pci_set_drvdata(dev, (void *)(long)line); 1166 pci_set_drvdata(dev, &serial_txx9_ports[line]);
1102 1167
1103 return 0; 1168 return 0;
1104} 1169}
1105 1170
1106static void __devexit pciserial_txx9_remove_one(struct pci_dev *dev) 1171static void __devexit pciserial_txx9_remove_one(struct pci_dev *dev)
1107{ 1172{
1108 int line = (int)(long)pci_get_drvdata(dev); 1173 struct uart_txx9_port *up = pci_get_drvdata(dev);
1109 1174
1110 pci_set_drvdata(dev, NULL); 1175 pci_set_drvdata(dev, NULL);
1111 1176
1112 if (line) { 1177 if (up) {
1113 serial_txx9_unregister_port(line); 1178 serial_txx9_unregister_port(up->port.line);
1114 pci_disable_device(dev); 1179 pci_disable_device(dev);
1115 } 1180 }
1116} 1181}
@@ -1118,10 +1183,10 @@ static void __devexit pciserial_txx9_remove_one(struct pci_dev *dev)
1118#ifdef CONFIG_PM 1183#ifdef CONFIG_PM
1119static int pciserial_txx9_suspend_one(struct pci_dev *dev, pm_message_t state) 1184static int pciserial_txx9_suspend_one(struct pci_dev *dev, pm_message_t state)
1120{ 1185{
1121 int line = (int)(long)pci_get_drvdata(dev); 1186 struct uart_txx9_port *up = pci_get_drvdata(dev);
1122 1187
1123 if (line) 1188 if (up)
1124 serial_txx9_suspend_port(line); 1189 uart_suspend_port(&serial_txx9_reg, &up->port);
1125 pci_save_state(dev); 1190 pci_save_state(dev);
1126 pci_set_power_state(dev, pci_choose_state(dev, state)); 1191 pci_set_power_state(dev, pci_choose_state(dev, state));
1127 return 0; 1192 return 0;
@@ -1129,15 +1194,12 @@ static int pciserial_txx9_suspend_one(struct pci_dev *dev, pm_message_t state)
1129 1194
1130static int pciserial_txx9_resume_one(struct pci_dev *dev) 1195static int pciserial_txx9_resume_one(struct pci_dev *dev)
1131{ 1196{
1132 int line = (int)(long)pci_get_drvdata(dev); 1197 struct uart_txx9_port *up = pci_get_drvdata(dev);
1133 1198
1134 pci_set_power_state(dev, PCI_D0); 1199 pci_set_power_state(dev, PCI_D0);
1135 pci_restore_state(dev); 1200 pci_restore_state(dev);
1136 1201 if (up)
1137 if (line) { 1202 uart_resume_port(&serial_txx9_reg, &up->port);
1138 pci_enable_device(dev);
1139 serial_txx9_resume_port(line);
1140 }
1141 return 0; 1203 return 0;
1142} 1204}
1143#endif 1205#endif
@@ -1161,6 +1223,8 @@ static struct pci_driver serial_txx9_pci_driver = {
1161MODULE_DEVICE_TABLE(pci, serial_txx9_pci_tbl); 1223MODULE_DEVICE_TABLE(pci, serial_txx9_pci_tbl);
1162#endif /* ENABLE_SERIAL_TXX9_PCI */ 1224#endif /* ENABLE_SERIAL_TXX9_PCI */
1163 1225
1226static struct platform_device *serial_txx9_plat_devs;
1227
1164static int __init serial_txx9_init(void) 1228static int __init serial_txx9_init(void)
1165{ 1229{
1166 int ret; 1230 int ret;
@@ -1168,13 +1232,39 @@ static int __init serial_txx9_init(void)
1168 printk(KERN_INFO "%s version %s\n", serial_name, serial_version); 1232 printk(KERN_INFO "%s version %s\n", serial_name, serial_version);
1169 1233
1170 ret = uart_register_driver(&serial_txx9_reg); 1234 ret = uart_register_driver(&serial_txx9_reg);
1171 if (ret >= 0) { 1235 if (ret)
1172 serial_txx9_register_ports(&serial_txx9_reg); 1236 goto out;
1237
1238 serial_txx9_plat_devs = platform_device_alloc("serial_txx9", -1);
1239 if (!serial_txx9_plat_devs) {
1240 ret = -ENOMEM;
1241 goto unreg_uart_drv;
1242 }
1243
1244 ret = platform_device_add(serial_txx9_plat_devs);
1245 if (ret)
1246 goto put_dev;
1247
1248 serial_txx9_register_ports(&serial_txx9_reg,
1249 &serial_txx9_plat_devs->dev);
1250
1251 ret = platform_driver_register(&serial_txx9_plat_driver);
1252 if (ret)
1253 goto del_dev;
1173 1254
1174#ifdef ENABLE_SERIAL_TXX9_PCI 1255#ifdef ENABLE_SERIAL_TXX9_PCI
1175 ret = pci_register_driver(&serial_txx9_pci_driver); 1256 ret = pci_register_driver(&serial_txx9_pci_driver);
1176#endif 1257#endif
1177 } 1258 if (ret == 0)
1259 goto out;
1260
1261 del_dev:
1262 platform_device_del(serial_txx9_plat_devs);
1263 put_dev:
1264 platform_device_put(serial_txx9_plat_devs);
1265 unreg_uart_drv:
1266 uart_unregister_driver(&serial_txx9_reg);
1267 out:
1178 return ret; 1268 return ret;
1179} 1269}
1180 1270
@@ -1185,6 +1275,8 @@ static void __exit serial_txx9_exit(void)
1185#ifdef ENABLE_SERIAL_TXX9_PCI 1275#ifdef ENABLE_SERIAL_TXX9_PCI
1186 pci_unregister_driver(&serial_txx9_pci_driver); 1276 pci_unregister_driver(&serial_txx9_pci_driver);
1187#endif 1277#endif
1278 platform_driver_unregister(&serial_txx9_plat_driver);
1279 platform_device_unregister(serial_txx9_plat_devs);
1188 for (i = 0; i < UART_NR; i++) { 1280 for (i = 0; i < UART_NR; i++) {
1189 struct uart_txx9_port *up = &serial_txx9_ports[i]; 1281 struct uart_txx9_port *up = &serial_txx9_ports[i];
1190 if (up->port.iobase || up->port.mapbase) 1282 if (up->port.iobase || up->port.mapbase)
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
index 34e9bac319b4..b6078706fb93 100644
--- a/drivers/usb/core/Makefile
+++ b/drivers/usb/core/Makefile
@@ -4,7 +4,7 @@
4 4
5usbcore-objs := usb.o hub.o hcd.o urb.o message.o driver.o \ 5usbcore-objs := usb.o hub.o hcd.o urb.o message.o driver.o \
6 config.o file.o buffer.o sysfs.o endpoint.o \ 6 config.o file.o buffer.o sysfs.o endpoint.o \
7 devio.o notify.o generic.o 7 devio.o notify.o generic.o quirks.o
8 8
9ifeq ($(CONFIG_PCI),y) 9ifeq ($(CONFIG_PCI),y)
10 usbcore-objs += hcd-pci.o 10 usbcore-objs += hcd-pci.o
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2aded261f42c..9e3e943f313c 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -366,19 +366,8 @@ void usb_driver_release_interface(struct usb_driver *driver,
366EXPORT_SYMBOL(usb_driver_release_interface); 366EXPORT_SYMBOL(usb_driver_release_interface);
367 367
368/* returns 0 if no match, 1 if match */ 368/* returns 0 if no match, 1 if match */
369int usb_match_one_id(struct usb_interface *interface, 369int usb_match_device(struct usb_device *dev, const struct usb_device_id *id)
370 const struct usb_device_id *id)
371{ 370{
372 struct usb_host_interface *intf;
373 struct usb_device *dev;
374
375 /* proc_connectinfo in devio.c may call us with id == NULL. */
376 if (id == NULL)
377 return 0;
378
379 intf = interface->cur_altsetting;
380 dev = interface_to_usbdev(interface);
381
382 if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && 371 if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) &&
383 id->idVendor != le16_to_cpu(dev->descriptor.idVendor)) 372 id->idVendor != le16_to_cpu(dev->descriptor.idVendor))
384 return 0; 373 return 0;
@@ -409,6 +398,26 @@ int usb_match_one_id(struct usb_interface *interface,
409 (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) 398 (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol))
410 return 0; 399 return 0;
411 400
401 return 1;
402}
403
404/* returns 0 if no match, 1 if match */
405int usb_match_one_id(struct usb_interface *interface,
406 const struct usb_device_id *id)
407{
408 struct usb_host_interface *intf;
409 struct usb_device *dev;
410
411 /* proc_connectinfo in devio.c may call us with id == NULL. */
412 if (id == NULL)
413 return 0;
414
415 intf = interface->cur_altsetting;
416 dev = interface_to_usbdev(interface);
417
418 if (!usb_match_device(dev, id))
419 return 0;
420
412 /* The interface class, subclass, and protocol should never be 421 /* The interface class, subclass, and protocol should never be
413 * checked for a match if the device class is Vendor Specific, 422 * checked for a match if the device class is Vendor Specific,
414 * unless the match record specifies the Vendor ID. */ 423 * unless the match record specifies the Vendor ID. */
@@ -954,12 +963,16 @@ static int autosuspend_check(struct usb_device *udev)
954 int i; 963 int i;
955 struct usb_interface *intf; 964 struct usb_interface *intf;
956 965
957 /* For autosuspend, fail fast if anything is in use. 966 /* For autosuspend, fail fast if anything is in use or autosuspend
958 * Also fail if any interfaces require remote wakeup but it 967 * is disabled. Also fail if any interfaces require remote wakeup
959 * isn't available. */ 968 * but it isn't available.
969 */
960 udev->do_remote_wakeup = device_may_wakeup(&udev->dev); 970 udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
961 if (udev->pm_usage_cnt > 0) 971 if (udev->pm_usage_cnt > 0)
962 return -EBUSY; 972 return -EBUSY;
973 if (!udev->autosuspend_delay)
974 return -EPERM;
975
963 if (udev->actconfig) { 976 if (udev->actconfig) {
964 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 977 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
965 intf = udev->actconfig->interface[i]; 978 intf = udev->actconfig->interface[i];
@@ -982,7 +995,7 @@ static int autosuspend_check(struct usb_device *udev)
982 995
983#define autosuspend_check(udev) 0 996#define autosuspend_check(udev) 0
984 997
985#endif 998#endif /* CONFIG_USB_SUSPEND */
986 999
987/** 1000/**
988 * usb_suspend_both - suspend a USB device and its interfaces 1001 * usb_suspend_both - suspend a USB device and its interfaces
@@ -1177,7 +1190,7 @@ static int usb_autopm_do_device(struct usb_device *udev, int inc_usage_cnt)
1177 udev->pm_usage_cnt -= inc_usage_cnt; 1190 udev->pm_usage_cnt -= inc_usage_cnt;
1178 } else if (inc_usage_cnt <= 0 && autosuspend_check(udev) == 0) 1191 } else if (inc_usage_cnt <= 0 && autosuspend_check(udev) == 0)
1179 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend, 1192 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend,
1180 USB_AUTOSUSPEND_DELAY); 1193 udev->autosuspend_delay);
1181 usb_pm_unlock(udev); 1194 usb_pm_unlock(udev);
1182 return status; 1195 return status;
1183} 1196}
@@ -1212,6 +1225,26 @@ void usb_autosuspend_device(struct usb_device *udev)
1212} 1225}
1213 1226
1214/** 1227/**
1228 * usb_try_autosuspend_device - attempt an autosuspend of a USB device and its interfaces
1229 * @udev: the usb_device to autosuspend
1230 *
1231 * This routine should be called when a core subsystem thinks @udev may
1232 * be ready to autosuspend.
1233 *
1234 * @udev's usage counter left unchanged. If it or any of the usage counters
1235 * for an active interface is greater than 0, or autosuspend is not allowed
1236 * for any other reason, no autosuspend request will be queued.
1237 *
1238 * This routine can run only in process context.
1239 */
1240void usb_try_autosuspend_device(struct usb_device *udev)
1241{
1242 usb_autopm_do_device(udev, 0);
1243 // dev_dbg(&udev->dev, "%s: cnt %d\n",
1244 // __FUNCTION__, udev->pm_usage_cnt);
1245}
1246
1247/**
1215 * usb_autoresume_device - immediately autoresume a USB device and its interfaces 1248 * usb_autoresume_device - immediately autoresume a USB device and its interfaces
1216 * @udev: the usb_device to autoresume 1249 * @udev: the usb_device to autoresume
1217 * 1250 *
@@ -1261,7 +1294,7 @@ static int usb_autopm_do_interface(struct usb_interface *intf,
1261 intf->pm_usage_cnt -= inc_usage_cnt; 1294 intf->pm_usage_cnt -= inc_usage_cnt;
1262 } else if (inc_usage_cnt <= 0 && autosuspend_check(udev) == 0) 1295 } else if (inc_usage_cnt <= 0 && autosuspend_check(udev) == 0)
1263 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend, 1296 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend,
1264 USB_AUTOSUSPEND_DELAY); 1297 udev->autosuspend_delay);
1265 } 1298 }
1266 usb_pm_unlock(udev); 1299 usb_pm_unlock(udev);
1267 return status; 1300 return status;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 50c0db15304a..41400743ce2c 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1287,6 +1287,9 @@ int usb_new_device(struct usb_device *udev)
1287 if (!try_module_get(THIS_MODULE)) 1287 if (!try_module_get(THIS_MODULE))
1288 return -EINVAL; 1288 return -EINVAL;
1289 1289
1290 /* Determine quirks */
1291 usb_detect_quirks(udev);
1292
1290 err = usb_get_configuration(udev); 1293 err = usb_get_configuration(udev);
1291 if (err < 0) { 1294 if (err < 0) {
1292 dev_err(&udev->dev, "can't read configurations, error %d\n", 1295 dev_err(&udev->dev, "can't read configurations, error %d\n",
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 74edaea5665d..2f17468b5c1e 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -11,6 +11,7 @@
11#include <linux/timer.h> 11#include <linux/timer.h>
12#include <linux/ctype.h> 12#include <linux/ctype.h>
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/usb/quirks.h>
14#include <asm/byteorder.h> 15#include <asm/byteorder.h>
15#include <asm/scatterlist.h> 16#include <asm/scatterlist.h>
16 17
@@ -685,7 +686,10 @@ static int usb_string_sub(struct usb_device *dev, unsigned int langid,
685 686
686 /* Try to read the string descriptor by asking for the maximum 687 /* Try to read the string descriptor by asking for the maximum
687 * possible number of bytes */ 688 * possible number of bytes */
688 rc = usb_get_string(dev, langid, index, buf, 255); 689 if (dev->quirks & USB_QUIRK_STRING_FETCH_255)
690 rc = -EIO;
691 else
692 rc = usb_get_string(dev, langid, index, buf, 255);
689 693
690 /* If that failed try to read the descriptor length, then 694 /* If that failed try to read the descriptor length, then
691 * ask for just that many bytes */ 695 * ask for just that many bytes */
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
new file mode 100644
index 000000000000..0e5c646cb4f6
--- /dev/null
+++ b/drivers/usb/core/quirks.c
@@ -0,0 +1,77 @@
1/*
2 * USB device quirk handling logic and table
3 *
4 * Copyright (c) 2007 Oliver Neukum
5 * Copyright (c) 2007 Greg Kroah-Hartman <gregkh@suse.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation, version 2.
10 *
11 *
12 */
13
14#include <linux/usb.h>
15#include <linux/usb/quirks.h>
16#include "usb.h"
17
18/* List of quirky USB devices. Please keep this list ordered by:
19 * 1) Vendor ID
20 * 2) Product ID
21 * 3) Class ID
22 *
23 * as we want specific devices to be overridden first, and only after that, any
24 * class specific quirks.
25 *
26 * Right now the logic aborts if it finds a valid device in the table, we might
27 * want to change that in the future if it turns out that a whole class of
28 * devices is broken...
29 */
30static const struct usb_device_id usb_quirk_list[] = {
31 /* HP 5300/5370C scanner */
32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
33
34 /* Elsa MicroLink 56k (V.250) */
35 { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
36
37 { } /* terminating entry must be last */
38};
39
40static void usb_autosuspend_quirk(struct usb_device *udev)
41{
42#ifdef CONFIG_USB_SUSPEND
43 /* disable autosuspend, but allow the user to re-enable it via sysfs */
44 udev->autosuspend_delay = 0;
45#endif
46}
47
48static const struct usb_device_id *find_id(struct usb_device *udev)
49{
50 const struct usb_device_id *id = usb_quirk_list;
51
52 for (; id->idVendor || id->bDeviceClass || id->bInterfaceClass ||
53 id->driver_info; id++) {
54 if (usb_match_device(udev, id))
55 return id;
56 }
57 return NULL;
58}
59
60/*
61 * Detect any quirks the device has, and do any housekeeping for it if needed.
62 */
63void usb_detect_quirks(struct usb_device *udev)
64{
65 const struct usb_device_id *id = usb_quirk_list;
66
67 id = find_id(udev);
68 if (id)
69 udev->quirks = (u32)(id->driver_info);
70 if (udev->quirks)
71 dev_dbg(&udev->dev, "USB quirks for this device: %x\n",
72 udev->quirks);
73
74 /* do any special quirk handling here if needed */
75 if (udev->quirks & USB_QUIRK_NO_AUTOSUSPEND)
76 usb_autosuspend_quirk(udev);
77}
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 0edfbafd702c..311d5df80386 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -148,6 +148,75 @@ show_maxchild(struct device *dev, struct device_attribute *attr, char *buf)
148} 148}
149static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL); 149static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL);
150 150
151static ssize_t
152show_quirks(struct device *dev, struct device_attribute *attr, char *buf)
153{
154 struct usb_device *udev;
155
156 udev = to_usb_device(dev);
157 return sprintf(buf, "0x%x\n", udev->quirks);
158}
159static DEVICE_ATTR(quirks, S_IRUGO, show_quirks, NULL);
160
161#ifdef CONFIG_USB_SUSPEND
162
163static ssize_t
164show_autosuspend(struct device *dev, struct device_attribute *attr, char *buf)
165{
166 struct usb_device *udev = to_usb_device(dev);
167
168 return sprintf(buf, "%u\n", udev->autosuspend_delay / HZ);
169}
170
171static ssize_t
172set_autosuspend(struct device *dev, struct device_attribute *attr,
173 const char *buf, size_t count)
174{
175 struct usb_device *udev = to_usb_device(dev);
176 unsigned value, old;
177
178 if (sscanf(buf, "%u", &value) != 1 || value >= INT_MAX/HZ)
179 return -EINVAL;
180 value *= HZ;
181
182 old = udev->autosuspend_delay;
183 udev->autosuspend_delay = value;
184 if (value > 0 && old == 0)
185 usb_try_autosuspend_device(udev);
186
187 return count;
188}
189
190static DEVICE_ATTR(autosuspend, S_IRUGO | S_IWUSR,
191 show_autosuspend, set_autosuspend);
192
193static char power_group[] = "power";
194
195static int add_power_attributes(struct device *dev)
196{
197 int rc = 0;
198
199 if (is_usb_device(dev))
200 rc = sysfs_add_file_to_group(&dev->kobj,
201 &dev_attr_autosuspend.attr,
202 power_group);
203 return rc;
204}
205
206static void remove_power_attributes(struct device *dev)
207{
208 sysfs_remove_file_from_group(&dev->kobj,
209 &dev_attr_autosuspend.attr,
210 power_group);
211}
212
213#else
214
215#define add_power_attributes(dev) 0
216#define remove_power_attributes(dev) do {} while (0)
217
218#endif /* CONFIG_USB_SUSPEND */
219
151/* Descriptor fields */ 220/* Descriptor fields */
152#define usb_descriptor_attr_le16(field, format_string) \ 221#define usb_descriptor_attr_le16(field, format_string) \
153static ssize_t \ 222static ssize_t \
@@ -204,6 +273,7 @@ static struct attribute *dev_attrs[] = {
204 &dev_attr_devnum.attr, 273 &dev_attr_devnum.attr,
205 &dev_attr_version.attr, 274 &dev_attr_version.attr,
206 &dev_attr_maxchild.attr, 275 &dev_attr_maxchild.attr,
276 &dev_attr_quirks.attr,
207 NULL, 277 NULL,
208}; 278};
209static struct attribute_group dev_attr_grp = { 279static struct attribute_group dev_attr_grp = {
@@ -219,6 +289,10 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
219 if (retval) 289 if (retval)
220 return retval; 290 return retval;
221 291
292 retval = add_power_attributes(dev);
293 if (retval)
294 goto error;
295
222 if (udev->manufacturer) { 296 if (udev->manufacturer) {
223 retval = device_create_file(dev, &dev_attr_manufacturer); 297 retval = device_create_file(dev, &dev_attr_manufacturer);
224 if (retval) 298 if (retval)
@@ -239,10 +313,7 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
239 goto error; 313 goto error;
240 return 0; 314 return 0;
241error: 315error:
242 usb_remove_ep_files(&udev->ep0); 316 usb_remove_sysfs_dev_files(udev);
243 device_remove_file(dev, &dev_attr_manufacturer);
244 device_remove_file(dev, &dev_attr_product);
245 device_remove_file(dev, &dev_attr_serial);
246 return retval; 317 return retval;
247} 318}
248 319
@@ -251,14 +322,11 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev)
251 struct device *dev = &udev->dev; 322 struct device *dev = &udev->dev;
252 323
253 usb_remove_ep_files(&udev->ep0); 324 usb_remove_ep_files(&udev->ep0);
325 device_remove_file(dev, &dev_attr_manufacturer);
326 device_remove_file(dev, &dev_attr_product);
327 device_remove_file(dev, &dev_attr_serial);
328 remove_power_attributes(dev);
254 sysfs_remove_group(&dev->kobj, &dev_attr_grp); 329 sysfs_remove_group(&dev->kobj, &dev_attr_grp);
255
256 if (udev->manufacturer)
257 device_remove_file(dev, &dev_attr_manufacturer);
258 if (udev->product)
259 device_remove_file(dev, &dev_attr_product);
260 if (udev->serial)
261 device_remove_file(dev, &dev_attr_serial);
262} 330}
263 331
264/* Interface fields */ 332/* Interface fields */
@@ -362,33 +430,28 @@ static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
362 430
363int usb_create_sysfs_intf_files(struct usb_interface *intf) 431int usb_create_sysfs_intf_files(struct usb_interface *intf)
364{ 432{
433 struct device *dev = &intf->dev;
365 struct usb_device *udev = interface_to_usbdev(intf); 434 struct usb_device *udev = interface_to_usbdev(intf);
366 struct usb_host_interface *alt = intf->cur_altsetting; 435 struct usb_host_interface *alt = intf->cur_altsetting;
367 int retval; 436 int retval;
368 437
369 retval = sysfs_create_group(&intf->dev.kobj, &intf_attr_grp); 438 retval = sysfs_create_group(&dev->kobj, &intf_attr_grp);
370 if (retval) 439 if (retval)
371 goto error; 440 return retval;
372 441
373 if (alt->string == NULL) 442 if (alt->string == NULL)
374 alt->string = usb_cache_string(udev, alt->desc.iInterface); 443 alt->string = usb_cache_string(udev, alt->desc.iInterface);
375 if (alt->string) 444 if (alt->string)
376 retval = device_create_file(&intf->dev, &dev_attr_interface); 445 retval = device_create_file(dev, &dev_attr_interface);
377 usb_create_intf_ep_files(intf, udev); 446 usb_create_intf_ep_files(intf, udev);
378 return 0; 447 return 0;
379error:
380 if (alt->string)
381 device_remove_file(&intf->dev, &dev_attr_interface);
382 sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp);
383 usb_remove_intf_ep_files(intf);
384 return retval;
385} 448}
386 449
387void usb_remove_sysfs_intf_files(struct usb_interface *intf) 450void usb_remove_sysfs_intf_files(struct usb_interface *intf)
388{ 451{
389 usb_remove_intf_ep_files(intf); 452 struct device *dev = &intf->dev;
390 sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp);
391 453
392 if (intf->cur_altsetting->string) 454 usb_remove_intf_ep_files(intf);
393 device_remove_file(&intf->dev, &dev_attr_interface); 455 device_remove_file(dev, &dev_attr_interface);
456 sysfs_remove_group(&dev->kobj, &intf_attr_grp);
394} 457}
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 3db721cd557a..54b42ce311c1 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/moduleparam.h>
25#include <linux/string.h> 26#include <linux/string.h>
26#include <linux/bitops.h> 27#include <linux/bitops.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
@@ -50,6 +51,16 @@ static int nousb; /* Disable USB when built into kernel image */
50 51
51struct workqueue_struct *ksuspend_usb_wq; /* For autosuspend */ 52struct workqueue_struct *ksuspend_usb_wq; /* For autosuspend */
52 53
54#ifdef CONFIG_USB_SUSPEND
55static int usb_autosuspend_delay = 2; /* Default delay value,
56 * in seconds */
57module_param_named(autosuspend, usb_autosuspend_delay, uint, 0644);
58MODULE_PARM_DESC(autosuspend, "default autosuspend delay");
59
60#else
61#define usb_autosuspend_delay 0
62#endif
63
53 64
54/** 65/**
55 * usb_ifnum_to_if - get the interface object with a given interface number 66 * usb_ifnum_to_if - get the interface object with a given interface number
@@ -306,6 +317,7 @@ usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1)
306#ifdef CONFIG_PM 317#ifdef CONFIG_PM
307 mutex_init(&dev->pm_mutex); 318 mutex_init(&dev->pm_mutex);
308 INIT_DELAYED_WORK(&dev->autosuspend, usb_autosuspend_work); 319 INIT_DELAYED_WORK(&dev->autosuspend, usb_autosuspend_work);
320 dev->autosuspend_delay = usb_autosuspend_delay * HZ;
309#endif 321#endif
310 return dev; 322 return dev;
311} 323}
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 17830a81be14..08b5a04e3755 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -13,6 +13,7 @@ extern void usb_disable_interface (struct usb_device *dev,
13 struct usb_interface *intf); 13 struct usb_interface *intf);
14extern void usb_release_interface_cache(struct kref *ref); 14extern void usb_release_interface_cache(struct kref *ref);
15extern void usb_disable_device (struct usb_device *dev, int skip_ep0); 15extern void usb_disable_device (struct usb_device *dev, int skip_ep0);
16extern void usb_detect_quirks(struct usb_device *udev);
16 17
17extern int usb_get_device_descriptor(struct usb_device *dev, 18extern int usb_get_device_descriptor(struct usb_device *dev,
18 unsigned int size); 19 unsigned int size);
@@ -21,6 +22,8 @@ extern int usb_set_configuration(struct usb_device *dev, int configuration);
21 22
22extern void usb_kick_khubd(struct usb_device *dev); 23extern void usb_kick_khubd(struct usb_device *dev);
23extern void usb_resume_root_hub(struct usb_device *dev); 24extern void usb_resume_root_hub(struct usb_device *dev);
25extern int usb_match_device(struct usb_device *dev,
26 const struct usb_device_id *id);
24 27
25extern int usb_hub_init(void); 28extern int usb_hub_init(void);
26extern void usb_hub_cleanup(void); 29extern void usb_hub_cleanup(void);
@@ -62,14 +65,14 @@ static inline void usb_pm_unlock(struct usb_device *udev) {}
62 65
63#ifdef CONFIG_USB_SUSPEND 66#ifdef CONFIG_USB_SUSPEND
64 67
65#define USB_AUTOSUSPEND_DELAY (HZ*2)
66
67extern void usb_autosuspend_device(struct usb_device *udev); 68extern void usb_autosuspend_device(struct usb_device *udev);
69extern void usb_try_autosuspend_device(struct usb_device *udev);
68extern int usb_autoresume_device(struct usb_device *udev); 70extern int usb_autoresume_device(struct usb_device *udev);
69 71
70#else 72#else
71 73
72#define usb_autosuspend_device(udev) do {} while (0) 74#define usb_autosuspend_device(udev) do {} while (0)
75#define usb_try_autosuspend_device(udev) do {} while (0)
73static inline int usb_autoresume_device(struct usb_device *udev) 76static inline int usb_autoresume_device(struct usb_device *udev)
74{ 77{
75 return 0; 78 return 0;
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 34296e79edcf..188c74a95216 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -553,6 +553,7 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
553{ 553{
554 struct kiocb_priv *priv = iocb->private; 554 struct kiocb_priv *priv = iocb->private;
555 ssize_t len, total; 555 ssize_t len, total;
556 void *to_copy;
556 int i; 557 int i;
557 558
558 /* we "retry" to get the right mm context for this: */ 559 /* we "retry" to get the right mm context for this: */
@@ -560,10 +561,11 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
560 /* copy stuff into user buffers */ 561 /* copy stuff into user buffers */
561 total = priv->actual; 562 total = priv->actual;
562 len = 0; 563 len = 0;
564 to_copy = priv->buf;
563 for (i=0; i < priv->nr_segs; i++) { 565 for (i=0; i < priv->nr_segs; i++) {
564 ssize_t this = min((ssize_t)(priv->iv[i].iov_len), total); 566 ssize_t this = min((ssize_t)(priv->iv[i].iov_len), total);
565 567
566 if (copy_to_user(priv->iv[i].iov_base, priv->buf, this)) { 568 if (copy_to_user(priv->iv[i].iov_base, to_copy, this)) {
567 if (len == 0) 569 if (len == 0)
568 len = -EFAULT; 570 len = -EFAULT;
569 break; 571 break;
@@ -571,6 +573,7 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
571 573
572 total -= this; 574 total -= this;
573 len += this; 575 len += this;
576 to_copy += this;
574 if (total == 0) 577 if (total == 0)
575 break; 578 break;
576 } 579 }
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index 5d6c06bc4524..8d24d3dc0a61 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -196,7 +196,7 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
196 struct uhci_td *td = list_entry(urbp->td_list.next, 196 struct uhci_td *td = list_entry(urbp->td_list.next,
197 struct uhci_td, list); 197 struct uhci_td, list);
198 198
199 if (cpu_to_le32(td->dma_handle) != (element & ~UHCI_PTR_BITS)) 199 if (element != LINK_TO_TD(td))
200 out += sprintf(out, "%*s Element != First TD\n", 200 out += sprintf(out, "%*s Element != First TD\n",
201 space, ""); 201 space, "");
202 i = nurbs = 0; 202 i = nurbs = 0;
@@ -220,16 +220,6 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
220 return out - buf; 220 return out - buf;
221} 221}
222 222
223static const char * const qh_names[] = {
224 "skel_unlink_qh", "skel_iso_qh",
225 "skel_int128_qh", "skel_int64_qh",
226 "skel_int32_qh", "skel_int16_qh",
227 "skel_int8_qh", "skel_int4_qh",
228 "skel_int2_qh", "skel_int1_qh",
229 "skel_ls_control_qh", "skel_fs_control_qh",
230 "skel_bulk_qh", "skel_term_qh"
231};
232
233static int uhci_show_sc(int port, unsigned short status, char *buf, int len) 223static int uhci_show_sc(int port, unsigned short status, char *buf, int len)
234{ 224{
235 char *out = buf; 225 char *out = buf;
@@ -352,6 +342,12 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
352 struct uhci_td *td; 342 struct uhci_td *td;
353 struct list_head *tmp, *head; 343 struct list_head *tmp, *head;
354 int nframes, nerrs; 344 int nframes, nerrs;
345 __le32 link;
346
347 static const char * const qh_names[] = {
348 "unlink", "iso", "int128", "int64", "int32", "int16",
349 "int8", "int4", "int2", "async", "term"
350 };
355 351
356 out += uhci_show_root_hub_state(uhci, out, len - (out - buf)); 352 out += uhci_show_root_hub_state(uhci, out, len - (out - buf));
357 out += sprintf(out, "HC status\n"); 353 out += sprintf(out, "HC status\n");
@@ -374,7 +370,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
374 nframes = 10; 370 nframes = 10;
375 nerrs = 0; 371 nerrs = 0;
376 for (i = 0; i < UHCI_NUMFRAMES; ++i) { 372 for (i = 0; i < UHCI_NUMFRAMES; ++i) {
377 __le32 link, qh_dma; 373 __le32 qh_dma;
378 374
379 j = 0; 375 j = 0;
380 td = uhci->frame_cpu[i]; 376 td = uhci->frame_cpu[i];
@@ -393,7 +389,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
393 do { 389 do {
394 td = list_entry(tmp, struct uhci_td, fl_list); 390 td = list_entry(tmp, struct uhci_td, fl_list);
395 tmp = tmp->next; 391 tmp = tmp->next;
396 if (cpu_to_le32(td->dma_handle) != link) { 392 if (link != LINK_TO_TD(td)) {
397 if (nframes > 0) 393 if (nframes > 0)
398 out += sprintf(out, " link does " 394 out += sprintf(out, " link does "
399 "not match list entry!\n"); 395 "not match list entry!\n");
@@ -430,23 +426,21 @@ check_link:
430 426
431 for (i = 0; i < UHCI_NUM_SKELQH; ++i) { 427 for (i = 0; i < UHCI_NUM_SKELQH; ++i) {
432 int cnt = 0; 428 int cnt = 0;
429 __le32 fsbr_link = 0;
433 430
434 qh = uhci->skelqh[i]; 431 qh = uhci->skelqh[i];
435 out += sprintf(out, "- %s\n", qh_names[i]); \ 432 out += sprintf(out, "- skel_%s_qh\n", qh_names[i]); \
436 out += uhci_show_qh(qh, out, len - (out - buf), 4); 433 out += uhci_show_qh(qh, out, len - (out - buf), 4);
437 434
438 /* Last QH is the Terminating QH, it's different */ 435 /* Last QH is the Terminating QH, it's different */
439 if (i == UHCI_NUM_SKELQH - 1) { 436 if (i == SKEL_TERM) {
440 if (qh->link != UHCI_PTR_TERM) 437 if (qh_element(qh) != LINK_TO_TD(uhci->term_td))
441 out += sprintf(out, " bandwidth reclamation on!\n");
442
443 if (qh_element(qh) != cpu_to_le32(uhci->term_td->dma_handle))
444 out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); 438 out += sprintf(out, " skel_term_qh element is not set to term_td!\n");
445 439 if (link == LINK_TO_QH(uhci->skel_term_qh))
440 goto check_qh_link;
446 continue; 441 continue;
447 } 442 }
448 443
449 j = (i < 9) ? 9 : i+1; /* Next skeleton */
450 head = &qh->node; 444 head = &qh->node;
451 tmp = head->next; 445 tmp = head->next;
452 446
@@ -456,15 +450,26 @@ check_link:
456 if (++cnt <= 10) 450 if (++cnt <= 10)
457 out += uhci_show_qh(qh, out, 451 out += uhci_show_qh(qh, out,
458 len - (out - buf), 4); 452 len - (out - buf), 4);
453 if (!fsbr_link && qh->skel >= SKEL_FSBR)
454 fsbr_link = LINK_TO_QH(qh);
459 } 455 }
460 if ((cnt -= 10) > 0) 456 if ((cnt -= 10) > 0)
461 out += sprintf(out, " Skipped %d QHs\n", cnt); 457 out += sprintf(out, " Skipped %d QHs\n", cnt);
462 458
463 if (i > 1 && i < UHCI_NUM_SKELQH - 1) { 459 link = UHCI_PTR_TERM;
464 if (qh->link != 460 if (i <= SKEL_ISO)
465 (cpu_to_le32(uhci->skelqh[j]->dma_handle) | UHCI_PTR_QH)) 461 ;
466 out += sprintf(out, " last QH not linked to next skeleton!\n"); 462 else if (i < SKEL_ASYNC)
467 } 463 link = LINK_TO_QH(uhci->skel_async_qh);
464 else if (!uhci->fsbr_is_on)
465 ;
466 else if (fsbr_link)
467 link = fsbr_link;
468 else
469 link = LINK_TO_QH(uhci->skel_term_qh);
470check_qh_link:
471 if (qh->link != link)
472 out += sprintf(out, " last QH not linked to next skeleton!\n");
468 } 473 }
469 474
470 return out - buf; 475 return out - buf;
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index ded4df30a631..44da4334f1d6 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -13,7 +13,7 @@
13 * (C) Copyright 2000 Yggdrasil Computing, Inc. (port of new PCI interface 13 * (C) Copyright 2000 Yggdrasil Computing, Inc. (port of new PCI interface
14 * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com). 14 * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com).
15 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c) 15 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c)
16 * (C) Copyright 2004-2006 Alan Stern, stern@rowland.harvard.edu 16 * (C) Copyright 2004-2007 Alan Stern, stern@rowland.harvard.edu
17 * 17 *
18 * Intel documents this fairly well, and as far as I know there 18 * Intel documents this fairly well, and as far as I know there
19 * are no royalties or anything like that, but even so there are 19 * are no royalties or anything like that, but even so there are
@@ -107,16 +107,16 @@ static __le32 uhci_frame_skel_link(struct uhci_hcd *uhci, int frame)
107 * interrupt QHs, which will help spread out bandwidth utilization. 107 * interrupt QHs, which will help spread out bandwidth utilization.
108 * 108 *
109 * ffs (Find First bit Set) does exactly what we need: 109 * ffs (Find First bit Set) does exactly what we need:
110 * 1,3,5,... => ffs = 0 => use skel_int2_qh = skelqh[8], 110 * 1,3,5,... => ffs = 0 => use period-2 QH = skelqh[8],
111 * 2,6,10,... => ffs = 1 => use skel_int4_qh = skelqh[7], etc. 111 * 2,6,10,... => ffs = 1 => use period-4 QH = skelqh[7], etc.
112 * ffs >= 7 => not on any high-period queue, so use 112 * ffs >= 7 => not on any high-period queue, so use
113 * skel_int1_qh = skelqh[9]. 113 * period-1 QH = skelqh[9].
114 * Add in UHCI_NUMFRAMES to insure at least one bit is set. 114 * Add in UHCI_NUMFRAMES to insure at least one bit is set.
115 */ 115 */
116 skelnum = 8 - (int) __ffs(frame | UHCI_NUMFRAMES); 116 skelnum = 8 - (int) __ffs(frame | UHCI_NUMFRAMES);
117 if (skelnum <= 1) 117 if (skelnum <= 1)
118 skelnum = 9; 118 skelnum = 9;
119 return UHCI_PTR_QH | cpu_to_le32(uhci->skelqh[skelnum]->dma_handle); 119 return LINK_TO_QH(uhci->skelqh[skelnum]);
120} 120}
121 121
122#include "uhci-debug.c" 122#include "uhci-debug.c"
@@ -540,16 +540,18 @@ static void uhci_shutdown(struct pci_dev *pdev)
540 * 540 *
541 * The hardware doesn't really know any difference 541 * The hardware doesn't really know any difference
542 * in the queues, but the order does matter for the 542 * in the queues, but the order does matter for the
543 * protocols higher up. The order is: 543 * protocols higher up. The order in which the queues
544 * are encountered by the hardware is:
544 * 545 *
545 * - any isochronous events handled before any 546 * - All isochronous events are handled before any
546 * of the queues. We don't do that here, because 547 * of the queues. We don't do that here, because
547 * we'll create the actual TD entries on demand. 548 * we'll create the actual TD entries on demand.
548 * - The first queue is the interrupt queue. 549 * - The first queue is the high-period interrupt queue.
549 * - The second queue is the control queue, split into low- and full-speed 550 * - The second queue is the period-1 interrupt and async
550 * - The third queue is bulk queue. 551 * (low-speed control, full-speed control, then bulk) queue.
551 * - The fourth queue is the bandwidth reclamation queue, which loops back 552 * - The third queue is the terminating bandwidth reclamation queue,
552 * to the full-speed control queue. 553 * which contains no members, loops back to itself, and is present
554 * only when FSBR is on and there are no full-speed control or bulk QHs.
553 */ 555 */
554static int uhci_start(struct usb_hcd *hcd) 556static int uhci_start(struct usb_hcd *hcd)
555{ 557{
@@ -626,34 +628,18 @@ static int uhci_start(struct usb_hcd *hcd)
626 } 628 }
627 629
628 /* 630 /*
629 * 8 Interrupt queues; link all higher int queues to int1, 631 * 8 Interrupt queues; link all higher int queues to int1 = async
630 * then link int1 to control and control to bulk
631 */ 632 */
632 uhci->skel_int128_qh->link = 633 for (i = SKEL_ISO + 1; i < SKEL_ASYNC; ++i)
633 uhci->skel_int64_qh->link = 634 uhci->skelqh[i]->link = LINK_TO_QH(uhci->skel_async_qh);
634 uhci->skel_int32_qh->link = 635 uhci->skel_async_qh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM;
635 uhci->skel_int16_qh->link =
636 uhci->skel_int8_qh->link =
637 uhci->skel_int4_qh->link =
638 uhci->skel_int2_qh->link = UHCI_PTR_QH |
639 cpu_to_le32(uhci->skel_int1_qh->dma_handle);
640
641 uhci->skel_int1_qh->link = UHCI_PTR_QH |
642 cpu_to_le32(uhci->skel_ls_control_qh->dma_handle);
643 uhci->skel_ls_control_qh->link = UHCI_PTR_QH |
644 cpu_to_le32(uhci->skel_fs_control_qh->dma_handle);
645 uhci->skel_fs_control_qh->link = UHCI_PTR_QH |
646 cpu_to_le32(uhci->skel_bulk_qh->dma_handle);
647 uhci->skel_bulk_qh->link = UHCI_PTR_QH |
648 cpu_to_le32(uhci->skel_term_qh->dma_handle);
649 636
650 /* This dummy TD is to work around a bug in Intel PIIX controllers */ 637 /* This dummy TD is to work around a bug in Intel PIIX controllers */
651 uhci_fill_td(uhci->term_td, 0, uhci_explen(0) | 638 uhci_fill_td(uhci->term_td, 0, uhci_explen(0) |
652 (0x7f << TD_TOKEN_DEVADDR_SHIFT) | USB_PID_IN, 0); 639 (0x7f << TD_TOKEN_DEVADDR_SHIFT) | USB_PID_IN, 0);
653 uhci->term_td->link = cpu_to_le32(uhci->term_td->dma_handle); 640 uhci->term_td->link = UHCI_PTR_TERM;
654 641 uhci->skel_async_qh->element = uhci->skel_term_qh->element =
655 uhci->skel_term_qh->link = UHCI_PTR_TERM; 642 LINK_TO_TD(uhci->term_td);
656 uhci->skel_term_qh->element = cpu_to_le32(uhci->term_td->dma_handle);
657 643
658 /* 644 /*
659 * Fill the frame list: make all entries point to the proper 645 * Fill the frame list: make all entries point to the proper
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index 74469b5bcb61..1b3d23406ac4 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -129,11 +129,12 @@ struct uhci_qh {
129 __le32 element; /* Queue element (TD) pointer */ 129 __le32 element; /* Queue element (TD) pointer */
130 130
131 /* Software fields */ 131 /* Software fields */
132 dma_addr_t dma_handle;
133
132 struct list_head node; /* Node in the list of QHs */ 134 struct list_head node; /* Node in the list of QHs */
133 struct usb_host_endpoint *hep; /* Endpoint information */ 135 struct usb_host_endpoint *hep; /* Endpoint information */
134 struct usb_device *udev; 136 struct usb_device *udev;
135 struct list_head queue; /* Queue of urbps for this QH */ 137 struct list_head queue; /* Queue of urbps for this QH */
136 struct uhci_qh *skel; /* Skeleton for this QH */
137 struct uhci_td *dummy_td; /* Dummy TD to end the queue */ 138 struct uhci_td *dummy_td; /* Dummy TD to end the queue */
138 struct uhci_td *post_td; /* Last TD completed */ 139 struct uhci_td *post_td; /* Last TD completed */
139 140
@@ -149,8 +150,7 @@ struct uhci_qh {
149 150
150 int state; /* QH_STATE_xxx; see above */ 151 int state; /* QH_STATE_xxx; see above */
151 int type; /* Queue type (control, bulk, etc) */ 152 int type; /* Queue type (control, bulk, etc) */
152 153 int skel; /* Skeleton queue number */
153 dma_addr_t dma_handle;
154 154
155 unsigned int initial_toggle:1; /* Endpoint's current toggle value */ 155 unsigned int initial_toggle:1; /* Endpoint's current toggle value */
156 unsigned int needs_fixup:1; /* Must fix the TD toggle values */ 156 unsigned int needs_fixup:1; /* Must fix the TD toggle values */
@@ -171,6 +171,8 @@ static inline __le32 qh_element(struct uhci_qh *qh) {
171 return element; 171 return element;
172} 172}
173 173
174#define LINK_TO_QH(qh) (UHCI_PTR_QH | cpu_to_le32((qh)->dma_handle))
175
174 176
175/* 177/*
176 * Transfer Descriptors 178 * Transfer Descriptors
@@ -264,6 +266,8 @@ static inline u32 td_status(struct uhci_td *td) {
264 return le32_to_cpu(status); 266 return le32_to_cpu(status);
265} 267}
266 268
269#define LINK_TO_TD(td) (cpu_to_le32((td)->dma_handle))
270
267 271
268/* 272/*
269 * Skeleton Queue Headers 273 * Skeleton Queue Headers
@@ -272,12 +276,13 @@ static inline u32 td_status(struct uhci_td *td) {
272/* 276/*
273 * The UHCI driver uses QHs with Interrupt, Control and Bulk URBs for 277 * The UHCI driver uses QHs with Interrupt, Control and Bulk URBs for
274 * automatic queuing. To make it easy to insert entries into the schedule, 278 * automatic queuing. To make it easy to insert entries into the schedule,
275 * we have a skeleton of QHs for each predefined Interrupt latency, 279 * we have a skeleton of QHs for each predefined Interrupt latency.
276 * low-speed control, full-speed control, bulk, and terminating QH 280 * Asynchronous QHs (low-speed control, full-speed control, and bulk)
277 * (see explanation for the terminating QH below). 281 * go onto the period-1 interrupt list, since they all get accessed on
282 * every frame.
278 * 283 *
279 * When we want to add a new QH, we add it to the end of the list for the 284 * When we want to add a new QH, we add it to the list starting from the
280 * skeleton QH. For instance, the schedule list can look like this: 285 * appropriate skeleton QH. For instance, the schedule can look like this:
281 * 286 *
282 * skel int128 QH 287 * skel int128 QH
283 * dev 1 interrupt QH 288 * dev 1 interrupt QH
@@ -285,50 +290,47 @@ static inline u32 td_status(struct uhci_td *td) {
285 * skel int64 QH 290 * skel int64 QH
286 * skel int32 QH 291 * skel int32 QH
287 * ... 292 * ...
288 * skel int1 QH 293 * skel int1 + async QH
289 * skel low-speed control QH 294 * dev 5 low-speed control QH
290 * dev 5 control QH
291 * skel full-speed control QH
292 * skel bulk QH
293 * dev 1 bulk QH 295 * dev 1 bulk QH
294 * dev 2 bulk QH 296 * dev 2 bulk QH
295 * skel terminating QH
296 * 297 *
297 * The terminating QH is used for 2 reasons: 298 * There is a special terminating QH used to keep full-speed bandwidth
298 * - To place a terminating TD which is used to workaround a PIIX bug 299 * reclamation active when no full-speed control or bulk QHs are linked
299 * (see Intel errata for explanation), and 300 * into the schedule. It has an inactive TD (to work around a PIIX bug,
300 * - To loop back to the full-speed control queue for full-speed bandwidth 301 * see the Intel errata) and it points back to itself.
301 * reclamation.
302 * 302 *
303 * There's a special skeleton QH for Isochronous QHs. It never appears 303 * There's a special skeleton QH for Isochronous QHs which never appears
304 * on the schedule, and Isochronous TDs go on the schedule before the 304 * on the schedule. Isochronous TDs go on the schedule before the
305 * the skeleton QHs. The hardware accesses them directly rather than 305 * the skeleton QHs. The hardware accesses them directly rather than
306 * through their QH, which is used only for bookkeeping purposes. 306 * through their QH, which is used only for bookkeeping purposes.
307 * While the UHCI spec doesn't forbid the use of QHs for Isochronous, 307 * While the UHCI spec doesn't forbid the use of QHs for Isochronous,
308 * it doesn't use them either. And the spec says that queues never 308 * it doesn't use them either. And the spec says that queues never
309 * advance on an error completion status, which makes them totally 309 * advance on an error completion status, which makes them totally
310 * unsuitable for Isochronous transfers. 310 * unsuitable for Isochronous transfers.
311 *
312 * There's also a special skeleton QH used for QHs which are in the process
313 * of unlinking and so may still be in use by the hardware. It too never
314 * appears on the schedule.
311 */ 315 */
312 316
313#define UHCI_NUM_SKELQH 14 317#define UHCI_NUM_SKELQH 11
314#define skel_unlink_qh skelqh[0] 318#define SKEL_UNLINK 0
315#define skel_iso_qh skelqh[1] 319#define skel_unlink_qh skelqh[SKEL_UNLINK]
316#define skel_int128_qh skelqh[2] 320#define SKEL_ISO 1
317#define skel_int64_qh skelqh[3] 321#define skel_iso_qh skelqh[SKEL_ISO]
318#define skel_int32_qh skelqh[4] 322 /* int128, int64, ..., int1 = 2, 3, ..., 9 */
319#define skel_int16_qh skelqh[5] 323#define SKEL_INDEX(exponent) (9 - exponent)
320#define skel_int8_qh skelqh[6] 324#define SKEL_ASYNC 9
321#define skel_int4_qh skelqh[7] 325#define skel_async_qh skelqh[SKEL_ASYNC]
322#define skel_int2_qh skelqh[8] 326#define SKEL_TERM 10
323#define skel_int1_qh skelqh[9] 327#define skel_term_qh skelqh[SKEL_TERM]
324#define skel_ls_control_qh skelqh[10] 328
325#define skel_fs_control_qh skelqh[11] 329/* The following entries refer to sublists of skel_async_qh */
326#define skel_bulk_qh skelqh[12] 330#define SKEL_LS_CONTROL 20
327#define skel_term_qh skelqh[13] 331#define SKEL_FS_CONTROL 21
328 332#define SKEL_FSBR SKEL_FS_CONTROL
329/* Find the skelqh entry corresponding to an interval exponent */ 333#define SKEL_BULK 22
330#define UHCI_SKEL_INDEX(exponent) (9 - exponent)
331
332 334
333/* 335/*
334 * The UHCI controller and root hub 336 * The UHCI controller and root hub
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 68e66b33e726..f4ebdb3e488f 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -13,7 +13,7 @@
13 * (C) Copyright 2000 Yggdrasil Computing, Inc. (port of new PCI interface 13 * (C) Copyright 2000 Yggdrasil Computing, Inc. (port of new PCI interface
14 * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com). 14 * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com).
15 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c) 15 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c)
16 * (C) Copyright 2004-2006 Alan Stern, stern@rowland.harvard.edu 16 * (C) Copyright 2004-2007 Alan Stern, stern@rowland.harvard.edu
17 */ 17 */
18 18
19 19
@@ -45,15 +45,43 @@ static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci)
45 */ 45 */
46static void uhci_fsbr_on(struct uhci_hcd *uhci) 46static void uhci_fsbr_on(struct uhci_hcd *uhci)
47{ 47{
48 struct uhci_qh *fsbr_qh, *lqh, *tqh;
49
48 uhci->fsbr_is_on = 1; 50 uhci->fsbr_is_on = 1;
49 uhci->skel_term_qh->link = cpu_to_le32( 51 lqh = list_entry(uhci->skel_async_qh->node.prev,
50 uhci->skel_fs_control_qh->dma_handle) | UHCI_PTR_QH; 52 struct uhci_qh, node);
53
54 /* Find the first FSBR QH. Linear search through the list is
55 * acceptable because normally FSBR gets turned on as soon as
56 * one QH needs it. */
57 fsbr_qh = NULL;
58 list_for_each_entry_reverse(tqh, &uhci->skel_async_qh->node, node) {
59 if (tqh->skel < SKEL_FSBR)
60 break;
61 fsbr_qh = tqh;
62 }
63
64 /* No FSBR QH means we must insert the terminating skeleton QH */
65 if (!fsbr_qh) {
66 uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh);
67 wmb();
68 lqh->link = uhci->skel_term_qh->link;
69
70 /* Otherwise loop the last QH to the first FSBR QH */
71 } else
72 lqh->link = LINK_TO_QH(fsbr_qh);
51} 73}
52 74
53static void uhci_fsbr_off(struct uhci_hcd *uhci) 75static void uhci_fsbr_off(struct uhci_hcd *uhci)
54{ 76{
77 struct uhci_qh *lqh;
78
55 uhci->fsbr_is_on = 0; 79 uhci->fsbr_is_on = 0;
56 uhci->skel_term_qh->link = UHCI_PTR_TERM; 80 lqh = list_entry(uhci->skel_async_qh->node.prev,
81 struct uhci_qh, node);
82
83 /* End the async list normally and unlink the terminating QH */
84 lqh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM;
57} 85}
58 86
59static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb) 87static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb)
@@ -158,11 +186,11 @@ static inline void uhci_insert_td_in_frame_list(struct uhci_hcd *uhci,
158 186
159 td->link = ltd->link; 187 td->link = ltd->link;
160 wmb(); 188 wmb();
161 ltd->link = cpu_to_le32(td->dma_handle); 189 ltd->link = LINK_TO_TD(td);
162 } else { 190 } else {
163 td->link = uhci->frame[framenum]; 191 td->link = uhci->frame[framenum];
164 wmb(); 192 wmb();
165 uhci->frame[framenum] = cpu_to_le32(td->dma_handle); 193 uhci->frame[framenum] = LINK_TO_TD(td);
166 uhci->frame_cpu[framenum] = td; 194 uhci->frame_cpu[framenum] = td;
167 } 195 }
168} 196}
@@ -184,7 +212,7 @@ static inline void uhci_remove_td_from_frame_list(struct uhci_hcd *uhci,
184 struct uhci_td *ntd; 212 struct uhci_td *ntd;
185 213
186 ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list); 214 ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list);
187 uhci->frame[td->frame] = cpu_to_le32(ntd->dma_handle); 215 uhci->frame[td->frame] = LINK_TO_TD(ntd);
188 uhci->frame_cpu[td->frame] = ntd; 216 uhci->frame_cpu[td->frame] = ntd;
189 } 217 }
190 } else { 218 } else {
@@ -405,12 +433,81 @@ static void uhci_fixup_toggles(struct uhci_qh *qh, int skip_first)
405} 433}
406 434
407/* 435/*
408 * Put a QH on the schedule in both hardware and software 436 * Link an Isochronous QH into its skeleton's list
409 */ 437 */
410static void uhci_activate_qh(struct uhci_hcd *uhci, struct uhci_qh *qh) 438static inline void link_iso(struct uhci_hcd *uhci, struct uhci_qh *qh)
439{
440 list_add_tail(&qh->node, &uhci->skel_iso_qh->node);
441
442 /* Isochronous QHs aren't linked by the hardware */
443}
444
445/*
446 * Link a high-period interrupt QH into the schedule at the end of its
447 * skeleton's list
448 */
449static void link_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh)
411{ 450{
412 struct uhci_qh *pqh; 451 struct uhci_qh *pqh;
413 452
453 list_add_tail(&qh->node, &uhci->skelqh[qh->skel]->node);
454
455 pqh = list_entry(qh->node.prev, struct uhci_qh, node);
456 qh->link = pqh->link;
457 wmb();
458 pqh->link = LINK_TO_QH(qh);
459}
460
461/*
462 * Link a period-1 interrupt or async QH into the schedule at the
463 * correct spot in the async skeleton's list, and update the FSBR link
464 */
465static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
466{
467 struct uhci_qh *pqh, *lqh;
468 __le32 link_to_new_qh;
469 __le32 *extra_link = &link_to_new_qh;
470
471 /* Find the predecessor QH for our new one and insert it in the list.
472 * The list of QHs is expected to be short, so linear search won't
473 * take too long. */
474 list_for_each_entry_reverse(pqh, &uhci->skel_async_qh->node, node) {
475 if (pqh->skel <= qh->skel)
476 break;
477 }
478 list_add(&qh->node, &pqh->node);
479 qh->link = pqh->link;
480
481 link_to_new_qh = LINK_TO_QH(qh);
482
483 /* If this is now the first FSBR QH, take special action */
484 if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR &&
485 qh->skel >= SKEL_FSBR) {
486 lqh = list_entry(uhci->skel_async_qh->node.prev,
487 struct uhci_qh, node);
488
489 /* If the new QH is also the last one, we must unlink
490 * the terminating skeleton QH and make the new QH point
491 * back to itself. */
492 if (qh == lqh) {
493 qh->link = link_to_new_qh;
494 extra_link = &uhci->skel_term_qh->link;
495
496 /* Otherwise the last QH must point to the new QH */
497 } else
498 extra_link = &lqh->link;
499 }
500
501 /* Link it into the schedule */
502 wmb();
503 *extra_link = pqh->link = link_to_new_qh;
504}
505
506/*
507 * Put a QH on the schedule in both hardware and software
508 */
509static void uhci_activate_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
510{
414 WARN_ON(list_empty(&qh->queue)); 511 WARN_ON(list_empty(&qh->queue));
415 512
416 /* Set the element pointer if it isn't set already. 513 /* Set the element pointer if it isn't set already.
@@ -421,7 +518,7 @@ static void uhci_activate_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
421 struct uhci_td *td = list_entry(urbp->td_list.next, 518 struct uhci_td *td = list_entry(urbp->td_list.next,
422 struct uhci_td, list); 519 struct uhci_td, list);
423 520
424 qh->element = cpu_to_le32(td->dma_handle); 521 qh->element = LINK_TO_TD(td);
425 } 522 }
426 523
427 /* Treat the queue as if it has just advanced */ 524 /* Treat the queue as if it has just advanced */
@@ -432,18 +529,64 @@ static void uhci_activate_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
432 return; 529 return;
433 qh->state = QH_STATE_ACTIVE; 530 qh->state = QH_STATE_ACTIVE;
434 531
435 /* Move the QH from its old list to the end of the appropriate 532 /* Move the QH from its old list to the correct spot in the appropriate
436 * skeleton's list */ 533 * skeleton's list */
437 if (qh == uhci->next_qh) 534 if (qh == uhci->next_qh)
438 uhci->next_qh = list_entry(qh->node.next, struct uhci_qh, 535 uhci->next_qh = list_entry(qh->node.next, struct uhci_qh,
439 node); 536 node);
440 list_move_tail(&qh->node, &qh->skel->node); 537 list_del(&qh->node);
538
539 if (qh->skel == SKEL_ISO)
540 link_iso(uhci, qh);
541 else if (qh->skel < SKEL_ASYNC)
542 link_interrupt(uhci, qh);
543 else
544 link_async(uhci, qh);
545}
546
547/*
548 * Unlink a high-period interrupt QH from the schedule
549 */
550static void unlink_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh)
551{
552 struct uhci_qh *pqh;
441 553
442 /* Link it into the schedule */
443 pqh = list_entry(qh->node.prev, struct uhci_qh, node); 554 pqh = list_entry(qh->node.prev, struct uhci_qh, node);
444 qh->link = pqh->link; 555 pqh->link = qh->link;
445 wmb(); 556 mb();
446 pqh->link = UHCI_PTR_QH | cpu_to_le32(qh->dma_handle); 557}
558
559/*
560 * Unlink a period-1 interrupt or async QH from the schedule
561 */
562static void unlink_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
563{
564 struct uhci_qh *pqh, *lqh;
565 __le32 link_to_next_qh = qh->link;
566
567 pqh = list_entry(qh->node.prev, struct uhci_qh, node);
568
569 /* If this is the first FSBQ QH, take special action */
570 if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR &&
571 qh->skel >= SKEL_FSBR) {
572 lqh = list_entry(uhci->skel_async_qh->node.prev,
573 struct uhci_qh, node);
574
575 /* If this QH is also the last one, we must link in
576 * the terminating skeleton QH. */
577 if (qh == lqh) {
578 link_to_next_qh = LINK_TO_QH(uhci->skel_term_qh);
579 uhci->skel_term_qh->link = link_to_next_qh;
580 wmb();
581 qh->link = link_to_next_qh;
582
583 /* Otherwise the last QH must point to the new first FSBR QH */
584 } else
585 lqh->link = link_to_next_qh;
586 }
587
588 pqh->link = link_to_next_qh;
589 mb();
447} 590}
448 591
449/* 592/*
@@ -451,17 +594,18 @@ static void uhci_activate_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
451 */ 594 */
452static void uhci_unlink_qh(struct uhci_hcd *uhci, struct uhci_qh *qh) 595static void uhci_unlink_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
453{ 596{
454 struct uhci_qh *pqh;
455
456 if (qh->state == QH_STATE_UNLINKING) 597 if (qh->state == QH_STATE_UNLINKING)
457 return; 598 return;
458 WARN_ON(qh->state != QH_STATE_ACTIVE || !qh->udev); 599 WARN_ON(qh->state != QH_STATE_ACTIVE || !qh->udev);
459 qh->state = QH_STATE_UNLINKING; 600 qh->state = QH_STATE_UNLINKING;
460 601
461 /* Unlink the QH from the schedule and record when we did it */ 602 /* Unlink the QH from the schedule and record when we did it */
462 pqh = list_entry(qh->node.prev, struct uhci_qh, node); 603 if (qh->skel == SKEL_ISO)
463 pqh->link = qh->link; 604 ;
464 mb(); 605 else if (qh->skel < SKEL_ASYNC)
606 unlink_interrupt(uhci, qh);
607 else
608 unlink_async(uhci, qh);
465 609
466 uhci_get_current_frame_number(uhci); 610 uhci_get_current_frame_number(uhci);
467 qh->unlink_frame = uhci->frame_number; 611 qh->unlink_frame = uhci->frame_number;
@@ -697,6 +841,7 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
697 dma_addr_t data = urb->transfer_dma; 841 dma_addr_t data = urb->transfer_dma;
698 __le32 *plink; 842 __le32 *plink;
699 struct urb_priv *urbp = urb->hcpriv; 843 struct urb_priv *urbp = urb->hcpriv;
844 int skel;
700 845
701 /* The "pipe" thing contains the destination in bits 8--18 */ 846 /* The "pipe" thing contains the destination in bits 8--18 */
702 destination = (urb->pipe & PIPE_DEVEP_MASK) | USB_PID_SETUP; 847 destination = (urb->pipe & PIPE_DEVEP_MASK) | USB_PID_SETUP;
@@ -737,7 +882,7 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
737 td = uhci_alloc_td(uhci); 882 td = uhci_alloc_td(uhci);
738 if (!td) 883 if (!td)
739 goto nomem; 884 goto nomem;
740 *plink = cpu_to_le32(td->dma_handle); 885 *plink = LINK_TO_TD(td);
741 886
742 /* Alternate Data0/1 (start with Data1) */ 887 /* Alternate Data0/1 (start with Data1) */
743 destination ^= TD_TOKEN_TOGGLE; 888 destination ^= TD_TOKEN_TOGGLE;
@@ -757,7 +902,7 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
757 td = uhci_alloc_td(uhci); 902 td = uhci_alloc_td(uhci);
758 if (!td) 903 if (!td)
759 goto nomem; 904 goto nomem;
760 *plink = cpu_to_le32(td->dma_handle); 905 *plink = LINK_TO_TD(td);
761 906
762 /* 907 /*
763 * It's IN if the pipe is an output pipe or we're not expecting 908 * It's IN if the pipe is an output pipe or we're not expecting
@@ -784,7 +929,7 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
784 td = uhci_alloc_td(uhci); 929 td = uhci_alloc_td(uhci);
785 if (!td) 930 if (!td)
786 goto nomem; 931 goto nomem;
787 *plink = cpu_to_le32(td->dma_handle); 932 *plink = LINK_TO_TD(td);
788 933
789 uhci_fill_td(td, 0, USB_PID_OUT | uhci_explen(0), 0); 934 uhci_fill_td(td, 0, USB_PID_OUT | uhci_explen(0), 0);
790 wmb(); 935 wmb();
@@ -797,11 +942,13 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
797 * isn't in the CONFIGURED state. */ 942 * isn't in the CONFIGURED state. */
798 if (urb->dev->speed == USB_SPEED_LOW || 943 if (urb->dev->speed == USB_SPEED_LOW ||
799 urb->dev->state != USB_STATE_CONFIGURED) 944 urb->dev->state != USB_STATE_CONFIGURED)
800 qh->skel = uhci->skel_ls_control_qh; 945 skel = SKEL_LS_CONTROL;
801 else { 946 else {
802 qh->skel = uhci->skel_fs_control_qh; 947 skel = SKEL_FS_CONTROL;
803 uhci_add_fsbr(uhci, urb); 948 uhci_add_fsbr(uhci, urb);
804 } 949 }
950 if (qh->state != QH_STATE_ACTIVE)
951 qh->skel = skel;
805 952
806 urb->actual_length = -8; /* Account for the SETUP packet */ 953 urb->actual_length = -8; /* Account for the SETUP packet */
807 return 0; 954 return 0;
@@ -860,7 +1007,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
860 td = uhci_alloc_td(uhci); 1007 td = uhci_alloc_td(uhci);
861 if (!td) 1008 if (!td)
862 goto nomem; 1009 goto nomem;
863 *plink = cpu_to_le32(td->dma_handle); 1010 *plink = LINK_TO_TD(td);
864 } 1011 }
865 uhci_add_td_to_urbp(td, urbp); 1012 uhci_add_td_to_urbp(td, urbp);
866 uhci_fill_td(td, status, 1013 uhci_fill_td(td, status,
@@ -888,7 +1035,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
888 td = uhci_alloc_td(uhci); 1035 td = uhci_alloc_td(uhci);
889 if (!td) 1036 if (!td)
890 goto nomem; 1037 goto nomem;
891 *plink = cpu_to_le32(td->dma_handle); 1038 *plink = LINK_TO_TD(td);
892 1039
893 uhci_add_td_to_urbp(td, urbp); 1040 uhci_add_td_to_urbp(td, urbp);
894 uhci_fill_td(td, status, 1041 uhci_fill_td(td, status,
@@ -914,7 +1061,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
914 td = uhci_alloc_td(uhci); 1061 td = uhci_alloc_td(uhci);
915 if (!td) 1062 if (!td)
916 goto nomem; 1063 goto nomem;
917 *plink = cpu_to_le32(td->dma_handle); 1064 *plink = LINK_TO_TD(td);
918 1065
919 uhci_fill_td(td, 0, USB_PID_OUT | uhci_explen(0), 0); 1066 uhci_fill_td(td, 0, USB_PID_OUT | uhci_explen(0), 0);
920 wmb(); 1067 wmb();
@@ -931,7 +1078,7 @@ nomem:
931 return -ENOMEM; 1078 return -ENOMEM;
932} 1079}
933 1080
934static inline int uhci_submit_bulk(struct uhci_hcd *uhci, struct urb *urb, 1081static int uhci_submit_bulk(struct uhci_hcd *uhci, struct urb *urb,
935 struct uhci_qh *qh) 1082 struct uhci_qh *qh)
936{ 1083{
937 int ret; 1084 int ret;
@@ -940,7 +1087,8 @@ static inline int uhci_submit_bulk(struct uhci_hcd *uhci, struct urb *urb,
940 if (urb->dev->speed == USB_SPEED_LOW) 1087 if (urb->dev->speed == USB_SPEED_LOW)
941 return -EINVAL; 1088 return -EINVAL;
942 1089
943 qh->skel = uhci->skel_bulk_qh; 1090 if (qh->state != QH_STATE_ACTIVE)
1091 qh->skel = SKEL_BULK;
944 ret = uhci_submit_common(uhci, urb, qh); 1092 ret = uhci_submit_common(uhci, urb, qh);
945 if (ret == 0) 1093 if (ret == 0)
946 uhci_add_fsbr(uhci, urb); 1094 uhci_add_fsbr(uhci, urb);
@@ -968,7 +1116,7 @@ static int uhci_submit_interrupt(struct uhci_hcd *uhci, struct urb *urb,
968 if (exponent < 0) 1116 if (exponent < 0)
969 return -EINVAL; 1117 return -EINVAL;
970 qh->period = 1 << exponent; 1118 qh->period = 1 << exponent;
971 qh->skel = uhci->skelqh[UHCI_SKEL_INDEX(exponent)]; 1119 qh->skel = SKEL_INDEX(exponent);
972 1120
973 /* For now, interrupt phase is fixed by the layout 1121 /* For now, interrupt phase is fixed by the layout
974 * of the QH lists. */ 1122 * of the QH lists. */
@@ -1005,7 +1153,7 @@ static int uhci_fixup_short_transfer(struct uhci_hcd *uhci,
1005 * the queue at the status stage transaction, which is 1153 * the queue at the status stage transaction, which is
1006 * the last TD. */ 1154 * the last TD. */
1007 WARN_ON(list_empty(&urbp->td_list)); 1155 WARN_ON(list_empty(&urbp->td_list));
1008 qh->element = cpu_to_le32(td->dma_handle); 1156 qh->element = LINK_TO_TD(td);
1009 tmp = td->list.prev; 1157 tmp = td->list.prev;
1010 ret = -EINPROGRESS; 1158 ret = -EINPROGRESS;
1011 1159
@@ -1216,7 +1364,7 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb,
1216 qh->iso_status = 0; 1364 qh->iso_status = 0;
1217 } 1365 }
1218 1366
1219 qh->skel = uhci->skel_iso_qh; 1367 qh->skel = SKEL_ISO;
1220 if (!qh->bandwidth_reserved) 1368 if (!qh->bandwidth_reserved)
1221 uhci_reserve_bandwidth(uhci, qh); 1369 uhci_reserve_bandwidth(uhci, qh);
1222 return 0; 1370 return 0;
@@ -1566,8 +1714,7 @@ static int uhci_advance_check(struct uhci_hcd *uhci, struct uhci_qh *qh)
1566 if (time_after(jiffies, qh->advance_jiffies + QH_WAIT_TIMEOUT)) { 1714 if (time_after(jiffies, qh->advance_jiffies + QH_WAIT_TIMEOUT)) {
1567 1715
1568 /* Detect the Intel bug and work around it */ 1716 /* Detect the Intel bug and work around it */
1569 if (qh->post_td && qh_element(qh) == 1717 if (qh->post_td && qh_element(qh) == LINK_TO_TD(qh->post_td)) {
1570 cpu_to_le32(qh->post_td->dma_handle)) {
1571 qh->element = qh->post_td->link; 1718 qh->element = qh->post_td->link;
1572 qh->advance_jiffies = jiffies; 1719 qh->advance_jiffies = jiffies;
1573 ret = 1; 1720 ret = 1;
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c
index 8505824848f6..3749f4a235f9 100644
--- a/drivers/usb/input/usbkbd.c
+++ b/drivers/usb/input/usbkbd.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/usb/input.h> 33#include <linux/usb/input.h>
34#include <linux/hid.h>
34 35
35/* 36/*
36 * Version Information 37 * Version Information
@@ -330,7 +331,8 @@ static void usb_kbd_disconnect(struct usb_interface *intf)
330} 331}
331 332
332static struct usb_device_id usb_kbd_id_table [] = { 333static struct usb_device_id usb_kbd_id_table [] = {
333 { USB_INTERFACE_INFO(3, 1, 1) }, 334 { USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT,
335 USB_INTERFACE_PROTOCOL_KEYBOARD) },
334 { } /* Terminating entry */ 336 { } /* Terminating entry */
335}; 337};
336 338
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c
index 64a33e420cfb..692fd6087779 100644
--- a/drivers/usb/input/usbmouse.c
+++ b/drivers/usb/input/usbmouse.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/usb/input.h> 33#include <linux/usb/input.h>
34#include <linux/hid.h>
34 35
35/* 36/*
36 * Version Information 37 * Version Information
@@ -213,7 +214,8 @@ static void usb_mouse_disconnect(struct usb_interface *intf)
213} 214}
214 215
215static struct usb_device_id usb_mouse_id_table [] = { 216static struct usb_device_id usb_mouse_id_table [] = {
216 { USB_INTERFACE_INFO(3, 1, 2) }, 217 { USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT,
218 USB_INTERFACE_PROTOCOL_MOUSE) },
217 { } /* Terminating entry */ 219 { } /* Terminating entry */
218}; 220};
219 221
diff --git a/drivers/usb/input/wacom_wac.c b/drivers/usb/input/wacom_wac.c
index 4142e36730fc..4f3e9bc7177d 100644
--- a/drivers/usb/input/wacom_wac.c
+++ b/drivers/usb/input/wacom_wac.c
@@ -163,7 +163,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
163 } 163 }
164 164
165 id = STYLUS_DEVICE_ID; 165 id = STYLUS_DEVICE_ID;
166 if (data[1] & 0x10) { /* in prox */ 166 if (data[1] & 0x80) { /* in prox */
167 167
168 switch ((data[1] >> 5) & 3) { 168 switch ((data[1] >> 5) & 3) {
169 169
@@ -196,9 +196,6 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
196 wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); 196 wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
197 break; 197 break;
198 } 198 }
199 }
200
201 if (data[1] & 0x90) {
202 x = wacom_le16_to_cpu(&data[2]); 199 x = wacom_le16_to_cpu(&data[2]);
203 y = wacom_le16_to_cpu(&data[4]); 200 y = wacom_le16_to_cpu(&data[4]);
204 wacom_report_abs(wcombo, ABS_X, x); 201 wacom_report_abs(wcombo, ABS_X, x);
@@ -210,19 +207,28 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
210 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04); 207 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04);
211 } 208 }
212 wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */ 209 wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */
213 }
214 else
215 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */
216
217 if (data[1] & 0x10) /* only report prox-in when in area */
218 wacom_report_key(wcombo, wacom->tool[0], 1); 210 wacom_report_key(wcombo, wacom->tool[0], 1);
219 if (!(data[1] & 0x90)) /* report prox-out when physically out */ 211 } else if (!(data[1] & 0x90)) {
212 wacom_report_abs(wcombo, ABS_X, 0);
213 wacom_report_abs(wcombo, ABS_Y, 0);
214 if (wacom->tool[0] == BTN_TOOL_MOUSE) {
215 wacom_report_key(wcombo, BTN_LEFT, 0);
216 wacom_report_key(wcombo, BTN_RIGHT, 0);
217 wacom_report_abs(wcombo, ABS_DISTANCE, 0);
218 } else {
219 wacom_report_abs(wcombo, ABS_PRESSURE, 0);
220 wacom_report_key(wcombo, BTN_TOUCH, 0);
221 wacom_report_key(wcombo, BTN_STYLUS, 0);
222 wacom_report_key(wcombo, BTN_STYLUS2, 0);
223 }
224 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */
220 wacom_report_key(wcombo, wacom->tool[0], 0); 225 wacom_report_key(wcombo, wacom->tool[0], 0);
221 wacom_input_sync(wcombo); 226 }
222 227
223 /* send pad data */ 228 /* send pad data */
224 if (wacom->features->type == WACOM_G4) { 229 if (wacom->features->type == WACOM_G4) {
225 if ( (wacom->serial[1] & 0xc0) != (data[7] & 0xf8) ) { 230 if (data[7] & 0xf8) {
231 wacom_input_sync(wcombo); /* sync last event */
226 wacom->id[1] = 1; 232 wacom->id[1] = 1;
227 wacom->serial[1] = (data[7] & 0xf8); 233 wacom->serial[1] = (data[7] & 0xf8);
228 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); 234 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40));
@@ -230,10 +236,15 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
230 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); 236 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
231 wacom_report_rel(wcombo, REL_WHEEL, rw); 237 wacom_report_rel(wcombo, REL_WHEEL, rw);
232 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 238 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
239 wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID);
233 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 240 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
234 } else if (wacom->id[1]) { 241 } else if (wacom->id[1]) {
242 wacom_input_sync(wcombo); /* sync last event */
235 wacom->id[1] = 0; 243 wacom->id[1] = 0;
244 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40));
245 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80));
236 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0); 246 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0);
247 wacom_report_abs(wcombo, ABS_MISC, 0);
237 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 248 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
238 } 249 }
239 } 250 }
@@ -304,28 +315,35 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
304 default: /* Unknown tool */ 315 default: /* Unknown tool */
305 wacom->tool[idx] = BTN_TOOL_PEN; 316 wacom->tool[idx] = BTN_TOOL_PEN;
306 } 317 }
307 /* only large I3 support Lens Cursor */
308 if(!((wacom->tool[idx] == BTN_TOOL_LENS)
309 && ((wacom->features->type == INTUOS3)
310 || (wacom->features->type == INTUOS3S)))) {
311 wacom_report_abs(wcombo, ABS_MISC, wacom->id[idx]); /* report tool id */
312 wacom_report_key(wcombo, wacom->tool[idx], 1);
313 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
314 return 2;
315 }
316 return 1; 318 return 1;
317 } 319 }
318 320
319 /* Exit report */ 321 /* Exit report */
320 if ((data[1] & 0xfe) == 0x80) { 322 if ((data[1] & 0xfe) == 0x80) {
321 if(!((wacom->tool[idx] == BTN_TOOL_LENS) 323 wacom_report_abs(wcombo, ABS_X, 0);
322 && ((wacom->features->type == INTUOS3) 324 wacom_report_abs(wcombo, ABS_Y, 0);
323 || (wacom->features->type == INTUOS3S)))) { 325 wacom_report_abs(wcombo, ABS_DISTANCE, 0);
324 wacom_report_key(wcombo, wacom->tool[idx], 0); 326 if (wacom->tool[idx] >= BTN_TOOL_MOUSE) {
325 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ 327 wacom_report_key(wcombo, BTN_LEFT, 0);
326 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 328 wacom_report_key(wcombo, BTN_MIDDLE, 0);
327 return 2; 329 wacom_report_key(wcombo, BTN_RIGHT, 0);
330 wacom_report_key(wcombo, BTN_SIDE, 0);
331 wacom_report_key(wcombo, BTN_EXTRA, 0);
332 wacom_report_abs(wcombo, ABS_THROTTLE, 0);
333 wacom_report_abs(wcombo, ABS_RZ, 0);
334 } else {
335 wacom_report_abs(wcombo, ABS_PRESSURE, 0);
336 wacom_report_abs(wcombo, ABS_TILT_X, 0);
337 wacom_report_abs(wcombo, ABS_TILT_Y, 0);
338 wacom_report_key(wcombo, BTN_STYLUS, 0);
339 wacom_report_key(wcombo, BTN_STYLUS2, 0);
340 wacom_report_key(wcombo, BTN_TOUCH, 0);
341 wacom_report_abs(wcombo, ABS_WHEEL, 0);
328 } 342 }
343 wacom_report_key(wcombo, wacom->tool[idx], 0);
344 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */
345 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
346 return 2;
329 } 347 }
330 return 0; 348 return 0;
331} 349}
@@ -394,6 +412,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
394 wacom_report_key(wcombo, wacom->tool[1], 1); 412 wacom_report_key(wcombo, wacom->tool[1], 1);
395 else 413 else
396 wacom_report_key(wcombo, wacom->tool[1], 0); 414 wacom_report_key(wcombo, wacom->tool[1], 0);
415 wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID);
397 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xffffffff); 416 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xffffffff);
398 return 1; 417 return 1;
399 } 418 }
@@ -403,6 +422,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
403 if (result) 422 if (result)
404 return result-1; 423 return result-1;
405 424
425 /* Only large I3 and I1 & I2 support Lense Cursor */
426 if((wacom->tool[idx] == BTN_TOOL_LENS)
427 && ((wacom->features->type == INTUOS3)
428 || (wacom->features->type == INTUOS3S)))
429 return 0;
430
406 /* Cintiq doesn't send data when RDY bit isn't set */ 431 /* Cintiq doesn't send data when RDY bit isn't set */
407 if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) 432 if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40))
408 return 0; 433 return 0;
@@ -554,11 +579,11 @@ static struct wacom_features wacom_features[] = {
554 { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE }, 579 { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE },
555 { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 63, GRAPHIRE }, 580 { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 63, GRAPHIRE },
556 { "Wacom PenPartner2", 8, 3250, 2320, 255, 63, GRAPHIRE }, 581 { "Wacom PenPartner2", 8, 3250, 2320, 255, 63, GRAPHIRE },
557 { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 63, INTUOS }, 582 { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 31, INTUOS },
558 { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, 583 { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 31, INTUOS },
559 { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 63, INTUOS }, 584 { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 31, INTUOS },
560 { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 63, INTUOS }, 585 { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 31, INTUOS },
561 { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 63, INTUOS }, 586 { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 31, INTUOS },
562 { "Wacom PL400", 8, 5408, 4056, 255, 0, PL }, 587 { "Wacom PL400", 8, 5408, 4056, 255, 0, PL },
563 { "Wacom PL500", 8, 6144, 4608, 255, 0, PL }, 588 { "Wacom PL500", 8, 6144, 4608, 255, 0, PL },
564 { "Wacom PL600", 8, 6126, 4604, 255, 0, PL }, 589 { "Wacom PL600", 8, 6126, 4604, 255, 0, PL },
@@ -571,11 +596,11 @@ static struct wacom_features wacom_features[] = {
571 { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, 596 { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL },
572 { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, 597 { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL },
573 { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, 598 { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU },
574 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 63, INTUOS }, 599 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 31, INTUOS },
575 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, 600 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS },
576 { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 63, INTUOS }, 601 { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 31, INTUOS },
577 { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 63, INTUOS }, 602 { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 31, INTUOS },
578 { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 63, INTUOS }, 603 { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 31, INTUOS },
579 { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 63, INTUOS3S }, 604 { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 63, INTUOS3S },
580 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 63, INTUOS3 }, 605 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 63, INTUOS3 },
581 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 63, INTUOS3 }, 606 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 63, INTUOS3 },
@@ -584,7 +609,7 @@ static struct wacom_features wacom_features[] = {
584 { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 }, 609 { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 },
585 { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 63, INTUOS3S }, 610 { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 63, INTUOS3S },
586 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, 611 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ },
587 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, 612 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS },
588 { } 613 { }
589}; 614};
590 615
diff --git a/drivers/usb/input/wacom_wac.h b/drivers/usb/input/wacom_wac.h
index a1d9ce007970..a23022287248 100644
--- a/drivers/usb/input/wacom_wac.h
+++ b/drivers/usb/input/wacom_wac.h
@@ -12,6 +12,7 @@
12#define STYLUS_DEVICE_ID 0x02 12#define STYLUS_DEVICE_ID 0x02
13#define CURSOR_DEVICE_ID 0x06 13#define CURSOR_DEVICE_ID 0x06
14#define ERASER_DEVICE_ID 0x0A 14#define ERASER_DEVICE_ID 0x0A
15#define PAD_DEVICE_ID 0x0F
15 16
16enum { 17enum {
17 PENPARTNER = 0, 18 PENPARTNER = 0,
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index 4907e8b80070..9c7eb6144d02 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -244,6 +244,20 @@ config USB_TRANCEVIBRATOR
244 To compile this driver as a module, choose M here: the 244 To compile this driver as a module, choose M here: the
245 module will be called trancevibrator. 245 module will be called trancevibrator.
246 246
247config USB_IOWARRIOR
248 tristate "IO Warrior driver support"
249 depends on USB
250 help
251 Say Y here if you want to support the IO Warrior devices from Code
252 Mercenaries. This includes support for the following devices:
253 IO Warrior 40
254 IO Warrior 24
255 IO Warrior 56
256 IO Warrior 24 Power Vampire
257
258 To compile this driver as a module, choose M here: the
259 module will be called iowarrior.
260
247config USB_TEST 261config USB_TEST
248 tristate "USB testing driver (DEVELOPMENT)" 262 tristate "USB testing driver (DEVELOPMENT)"
249 depends on USB && USB_DEVICEFS && EXPERIMENTAL 263 depends on USB && USB_DEVICEFS && EXPERIMENTAL
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index dac2d5b71566..b68e6b774f1a 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_USB_EMI26) += emi26.o
13obj-$(CONFIG_USB_EMI62) += emi62.o 13obj-$(CONFIG_USB_EMI62) += emi62.o
14obj-$(CONFIG_USB_FTDI_ELAN) += ftdi-elan.o 14obj-$(CONFIG_USB_FTDI_ELAN) += ftdi-elan.o
15obj-$(CONFIG_USB_IDMOUSE) += idmouse.o 15obj-$(CONFIG_USB_IDMOUSE) += idmouse.o
16obj-$(CONFIG_USB_IOWARRIOR) += iowarrior.o
16obj-$(CONFIG_USB_LCD) += usblcd.o 17obj-$(CONFIG_USB_LCD) += usblcd.o
17obj-$(CONFIG_USB_LD) += ldusb.o 18obj-$(CONFIG_USB_LD) += ldusb.o
18obj-$(CONFIG_USB_LED) += usbled.o 19obj-$(CONFIG_USB_LED) += usbled.o
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
new file mode 100644
index 000000000000..d69665c8de02
--- /dev/null
+++ b/drivers/usb/misc/iowarrior.c
@@ -0,0 +1,925 @@
1/*
2 * Native support for the I/O-Warrior USB devices
3 *
4 * Copyright (c) 2003-2005 Code Mercenaries GmbH
5 * written by Christian Lucht <lucht@codemercs.com>
6 *
7 * based on
8
9 * usb-skeleton.c by Greg Kroah-Hartman <greg@kroah.com>
10 * brlvger.c by Stephane Dalton <sdalton@videotron.ca>
11 * and St�hane Doyon <s.doyon@videotron.ca>
12 *
13 * Released under the GPLv2.
14 */
15
16#include <linux/module.h>
17#include <linux/usb.h>
18#include <linux/init.h>
19#include <linux/slab.h>
20#include <linux/sched.h>
21#include <linux/poll.h>
22#include <linux/version.h>
23#include <linux/usb/iowarrior.h>
24
25/* Version Information */
26#define DRIVER_VERSION "v0.4.0"
27#define DRIVER_AUTHOR "Christian Lucht <lucht@codemercs.com>"
28#define DRIVER_DESC "USB IO-Warrior driver (Linux 2.6.x)"
29
30#define USB_VENDOR_ID_CODEMERCS 1984
31/* low speed iowarrior */
32#define USB_DEVICE_ID_CODEMERCS_IOW40 0x1500
33#define USB_DEVICE_ID_CODEMERCS_IOW24 0x1501
34#define USB_DEVICE_ID_CODEMERCS_IOWPV1 0x1511
35#define USB_DEVICE_ID_CODEMERCS_IOWPV2 0x1512
36/* full speed iowarrior */
37#define USB_DEVICE_ID_CODEMERCS_IOW56 0x1503
38
39/* Get a minor range for your devices from the usb maintainer */
40#ifdef CONFIG_USB_DYNAMIC_MINORS
41#define IOWARRIOR_MINOR_BASE 0
42#else
43#define IOWARRIOR_MINOR_BASE 208 // SKELETON_MINOR_BASE 192 + 16, not offical yet
44#endif
45
46/* interrupt input queue size */
47#define MAX_INTERRUPT_BUFFER 16
48/*
49 maximum number of urbs that are submitted for writes at the same time,
50 this applies to the IOWarrior56 only!
51 IOWarrior24 and IOWarrior40 use synchronous usb_control_msg calls.
52*/
53#define MAX_WRITES_IN_FLIGHT 4
54
55/* Use our own dbg macro */
56#undef dbg
57#define dbg( format, arg... ) do { if( debug ) printk( KERN_DEBUG __FILE__ ": " format "\n" , ## arg ); } while ( 0 )
58
59MODULE_AUTHOR(DRIVER_AUTHOR);
60MODULE_DESCRIPTION(DRIVER_DESC);
61MODULE_LICENSE("GPL");
62
63/* Module parameters */
64static int debug = 0;
65module_param(debug, bool, 0644);
66MODULE_PARM_DESC(debug, "debug=1 enables debugging messages");
67
68static struct usb_driver iowarrior_driver;
69
70/*--------------*/
71/* data */
72/*--------------*/
73
74/* Structure to hold all of our device specific stuff */
75struct iowarrior {
76 struct mutex mutex; /* locks this structure */
77 struct usb_device *udev; /* save off the usb device pointer */
78 struct usb_interface *interface; /* the interface for this device */
79 unsigned char minor; /* the starting minor number for this device */
80 struct usb_endpoint_descriptor *int_out_endpoint; /* endpoint for reading (needed for IOW56 only) */
81 struct usb_endpoint_descriptor *int_in_endpoint; /* endpoint for reading */
82 struct urb *int_in_urb; /* the urb for reading data */
83 unsigned char *int_in_buffer; /* buffer for data to be read */
84 unsigned char serial_number; /* to detect lost packages */
85 unsigned char *read_queue; /* size is MAX_INTERRUPT_BUFFER * packet size */
86 wait_queue_head_t read_wait;
87 wait_queue_head_t write_wait; /* wait-queue for writing to the device */
88 atomic_t write_busy; /* number of write-urbs submitted */
89 atomic_t read_idx;
90 atomic_t intr_idx;
91 spinlock_t intr_idx_lock; /* protects intr_idx */
92 atomic_t overflow_flag; /* signals an index 'rollover' */
93 int present; /* this is 1 as long as the device is connected */
94 int opened; /* this is 1 if the device is currently open */
95 char chip_serial[9]; /* the serial number string of the chip connected */
96 int report_size; /* number of bytes in a report */
97 u16 product_id;
98};
99
100/*--------------*/
101/* globals */
102/*--------------*/
103/* prevent races between open() and disconnect() */
104static DECLARE_MUTEX(disconnect_sem);
105
106/*
107 * USB spec identifies 5 second timeouts.
108 */
109#define GET_TIMEOUT 5
110#define USB_REQ_GET_REPORT 0x01
111//#if 0
112static int usb_get_report(struct usb_device *dev,
113 struct usb_host_interface *inter, unsigned char type,
114 unsigned char id, void *buf, int size)
115{
116 return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
117 USB_REQ_GET_REPORT,
118 USB_DIR_IN | USB_TYPE_CLASS |
119 USB_RECIP_INTERFACE, (type << 8) + id,
120 inter->desc.bInterfaceNumber, buf, size,
121 GET_TIMEOUT);
122}
123//#endif
124
125#define USB_REQ_SET_REPORT 0x09
126
127static int usb_set_report(struct usb_interface *intf, unsigned char type,
128 unsigned char id, void *buf, int size)
129{
130 return usb_control_msg(interface_to_usbdev(intf),
131 usb_sndctrlpipe(interface_to_usbdev(intf), 0),
132 USB_REQ_SET_REPORT,
133 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
134 (type << 8) + id,
135 intf->cur_altsetting->desc.bInterfaceNumber, buf,
136 size, 1);
137}
138
139/*---------------------*/
140/* driver registration */
141/*---------------------*/
142/* table of devices that work with this driver */
143static struct usb_device_id iowarrior_ids[] = {
144 {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40)},
145 {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24)},
146 {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOWPV1)},
147 {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOWPV2)},
148 {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW56)},
149 {} /* Terminating entry */
150};
151MODULE_DEVICE_TABLE(usb, iowarrior_ids);
152
153/*
154 * USB callback handler for reading data
155 */
156static void iowarrior_callback(struct urb *urb)
157{
158 struct iowarrior *dev = (struct iowarrior *)urb->context;
159 int intr_idx;
160 int read_idx;
161 int aux_idx;
162 int offset;
163 int status;
164
165 switch (urb->status) {
166 case 0:
167 /* success */
168 break;
169 case -ECONNRESET:
170 case -ENOENT:
171 case -ESHUTDOWN:
172 return;
173 default:
174 goto exit;
175 }
176
177 spin_lock(&dev->intr_idx_lock);
178 intr_idx = atomic_read(&dev->intr_idx);
179 /* aux_idx become previous intr_idx */
180 aux_idx = (intr_idx == 0) ? (MAX_INTERRUPT_BUFFER - 1) : (intr_idx - 1);
181 read_idx = atomic_read(&dev->read_idx);
182
183 /* queue is not empty and it's interface 0 */
184 if ((intr_idx != read_idx)
185 && (dev->interface->cur_altsetting->desc.bInterfaceNumber == 0)) {
186 /* + 1 for serial number */
187 offset = aux_idx * (dev->report_size + 1);
188 if (!memcmp
189 (dev->read_queue + offset, urb->transfer_buffer,
190 dev->report_size)) {
191 /* equal values on interface 0 will be ignored */
192 spin_unlock(&dev->intr_idx_lock);
193 goto exit;
194 }
195 }
196
197 /* aux_idx become next intr_idx */
198 aux_idx = (intr_idx == (MAX_INTERRUPT_BUFFER - 1)) ? 0 : (intr_idx + 1);
199 if (read_idx == aux_idx) {
200 /* queue full, dropping oldest input */
201 read_idx = (++read_idx == MAX_INTERRUPT_BUFFER) ? 0 : read_idx;
202 atomic_set(&dev->read_idx, read_idx);
203 atomic_set(&dev->overflow_flag, 1);
204 }
205
206 /* +1 for serial number */
207 offset = intr_idx * (dev->report_size + 1);
208 memcpy(dev->read_queue + offset, urb->transfer_buffer,
209 dev->report_size);
210 *(dev->read_queue + offset + (dev->report_size)) = dev->serial_number++;
211
212 atomic_set(&dev->intr_idx, aux_idx);
213 spin_unlock(&dev->intr_idx_lock);
214 /* tell the blocking read about the new data */
215 wake_up_interruptible(&dev->read_wait);
216
217exit:
218 status = usb_submit_urb(urb, GFP_ATOMIC);
219 if (status)
220 dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d",
221 __FUNCTION__, status);
222
223}
224
225/*
226 * USB Callback handler for write-ops
227 */
228static void iowarrior_write_callback(struct urb *urb)
229{
230 struct iowarrior *dev;
231 dev = (struct iowarrior *)urb->context;
232 /* sync/async unlink faults aren't errors */
233 if (urb->status &&
234 !(urb->status == -ENOENT ||
235 urb->status == -ECONNRESET || urb->status == -ESHUTDOWN)) {
236 dbg("%s - nonzero write bulk status received: %d",
237 __func__, urb->status);
238 }
239 /* free up our allocated buffer */
240 usb_buffer_free(urb->dev, urb->transfer_buffer_length,
241 urb->transfer_buffer, urb->transfer_dma);
242 /* tell a waiting writer the interrupt-out-pipe is available again */
243 atomic_dec(&dev->write_busy);
244 wake_up_interruptible(&dev->write_wait);
245}
246
247/**
248 * iowarrior_delete
249 */
250static inline void iowarrior_delete(struct iowarrior *dev)
251{
252 dbg("%s - minor %d", __func__, dev->minor);
253 kfree(dev->int_in_buffer);
254 usb_free_urb(dev->int_in_urb);
255 kfree(dev->read_queue);
256 kfree(dev);
257}
258
259/*---------------------*/
260/* fops implementation */
261/*---------------------*/
262
263static int read_index(struct iowarrior *dev)
264{
265 int intr_idx, read_idx;
266
267 read_idx = atomic_read(&dev->read_idx);
268 intr_idx = atomic_read(&dev->intr_idx);
269
270 return (read_idx == intr_idx ? -1 : read_idx);
271}
272
273/**
274 * iowarrior_read
275 */
276static ssize_t iowarrior_read(struct file *file, char __user *buffer,
277 size_t count, loff_t *ppos)
278{
279 struct iowarrior *dev;
280 int read_idx;
281 int offset;
282
283 dev = (struct iowarrior *)file->private_data;
284
285 /* verify that the device wasn't unplugged */
286 if (dev == NULL || !dev->present)
287 return -ENODEV;
288
289 dbg("%s - minor %d, count = %zd", __func__, dev->minor, count);
290
291 /* read count must be packet size (+ time stamp) */
292 if ((count != dev->report_size)
293 && (count != (dev->report_size + 1)))
294 return -EINVAL;
295
296 /* repeat until no buffer overrun in callback handler occur */
297 do {
298 atomic_set(&dev->overflow_flag, 0);
299 if ((read_idx = read_index(dev)) == -1) {
300 /* queue emty */
301 if (file->f_flags & O_NONBLOCK)
302 return -EAGAIN;
303 else {
304 //next line will return when there is either new data, or the device is unplugged
305 int r = wait_event_interruptible(dev->read_wait,
306 (!dev->present
307 || (read_idx =
308 read_index
309 (dev)) !=
310 -1));
311 if (r) {
312 //we were interrupted by a signal
313 return -ERESTART;
314 }
315 if (!dev->present) {
316 //The device was unplugged
317 return -ENODEV;
318 }
319 if (read_idx == -1) {
320 // Can this happen ???
321 return 0;
322 }
323 }
324 }
325
326 offset = read_idx * (dev->report_size + 1);
327 if (copy_to_user(buffer, dev->read_queue + offset, count)) {
328 return -EFAULT;
329 }
330 } while (atomic_read(&dev->overflow_flag));
331
332 read_idx = ++read_idx == MAX_INTERRUPT_BUFFER ? 0 : read_idx;
333 atomic_set(&dev->read_idx, read_idx);
334 return count;
335}
336
337/*
338 * iowarrior_write
339 */
340static ssize_t iowarrior_write(struct file *file,
341 const char __user *user_buffer,
342 size_t count, loff_t *ppos)
343{
344 struct iowarrior *dev;
345 int retval = 0;
346 char *buf = NULL; /* for IOW24 and IOW56 we need a buffer */
347 struct urb *int_out_urb = NULL;
348
349 dev = (struct iowarrior *)file->private_data;
350
351 mutex_lock(&dev->mutex);
352 /* verify that the device wasn't unplugged */
353 if (dev == NULL || !dev->present) {
354 retval = -ENODEV;
355 goto exit;
356 }
357 dbg("%s - minor %d, count = %zd", __func__, dev->minor, count);
358 /* if count is 0 we're already done */
359 if (count == 0) {
360 retval = 0;
361 goto exit;
362 }
363 /* We only accept full reports */
364 if (count != dev->report_size) {
365 retval = -EINVAL;
366 goto exit;
367 }
368 switch (dev->product_id) {
369 case USB_DEVICE_ID_CODEMERCS_IOW24:
370 case USB_DEVICE_ID_CODEMERCS_IOWPV1:
371 case USB_DEVICE_ID_CODEMERCS_IOWPV2:
372 case USB_DEVICE_ID_CODEMERCS_IOW40:
373 /* IOW24 and IOW40 use a synchronous call */
374 buf = kmalloc(8, GFP_KERNEL); /* 8 bytes are enough for both products */
375 if (!buf) {
376 retval = -ENOMEM;
377 goto exit;
378 }
379 if (copy_from_user(buf, user_buffer, count)) {
380 retval = -EFAULT;
381 kfree(buf);
382 goto exit;
383 }
384 retval = usb_set_report(dev->interface, 2, 0, buf, count);
385 kfree(buf);
386 goto exit;
387 break;
388 case USB_DEVICE_ID_CODEMERCS_IOW56:
389 /* The IOW56 uses asynchronous IO and more urbs */
390 if (atomic_read(&dev->write_busy) == MAX_WRITES_IN_FLIGHT) {
391 /* Wait until we are below the limit for submitted urbs */
392 if (file->f_flags & O_NONBLOCK) {
393 retval = -EAGAIN;
394 goto exit;
395 } else {
396 retval = wait_event_interruptible(dev->write_wait,
397 (!dev->present || (atomic_read (&dev-> write_busy) < MAX_WRITES_IN_FLIGHT)));
398 if (retval) {
399 /* we were interrupted by a signal */
400 retval = -ERESTART;
401 goto exit;
402 }
403 if (!dev->present) {
404 /* The device was unplugged */
405 retval = -ENODEV;
406 goto exit;
407 }
408 if (!dev->opened) {
409 /* We were closed while waiting for an URB */
410 retval = -ENODEV;
411 goto exit;
412 }
413 }
414 }
415 atomic_inc(&dev->write_busy);
416 int_out_urb = usb_alloc_urb(0, GFP_KERNEL);
417 if (!int_out_urb) {
418 retval = -ENOMEM;
419 dbg("%s Unable to allocate urb ", __func__);
420 goto error;
421 }
422 buf = usb_buffer_alloc(dev->udev, dev->report_size,
423 GFP_KERNEL, &int_out_urb->transfer_dma);
424 if (!buf) {
425 retval = -ENOMEM;
426 dbg("%s Unable to allocate buffer ", __func__);
427 goto error;
428 }
429 usb_fill_int_urb(int_out_urb, dev->udev,
430 usb_sndintpipe(dev->udev,
431 dev->int_out_endpoint->bEndpointAddress),
432 buf, dev->report_size,
433 iowarrior_write_callback, dev,
434 dev->int_out_endpoint->bInterval);
435 int_out_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
436 if (copy_from_user(buf, user_buffer, count)) {
437 retval = -EFAULT;
438 goto error;
439 }
440 retval = usb_submit_urb(int_out_urb, GFP_KERNEL);
441 if (retval) {
442 dbg("%s submit error %d for urb nr.%d", __func__,
443 retval, atomic_read(&dev->write_busy));
444 goto error;
445 }
446 /* submit was ok */
447 retval = count;
448 usb_free_urb(int_out_urb);
449 goto exit;
450 break;
451 default:
452 /* what do we have here ? An unsupported Product-ID ? */
453 dev_err(&dev->interface->dev, "%s - not supported for product=0x%x",
454 __FUNCTION__, dev->product_id);
455 retval = -EFAULT;
456 goto exit;
457 break;
458 }
459error:
460 usb_buffer_free(dev->udev, dev->report_size, buf,
461 int_out_urb->transfer_dma);
462 usb_free_urb(int_out_urb);
463 atomic_dec(&dev->write_busy);
464 wake_up_interruptible(&dev->write_wait);
465exit:
466 mutex_unlock(&dev->mutex);
467 return retval;
468}
469
470/**
471 * iowarrior_ioctl
472 */
473static int iowarrior_ioctl(struct inode *inode, struct file *file,
474 unsigned int cmd, unsigned long arg)
475{
476 struct iowarrior *dev = NULL;
477 __u8 *buffer;
478 __u8 __user *user_buffer;
479 int retval;
480 int io_res; /* checks for bytes read/written and copy_to/from_user results */
481
482 dev = (struct iowarrior *)file->private_data;
483 if (dev == NULL) {
484 return -ENODEV;
485 }
486
487 buffer = kzalloc(dev->report_size, GFP_KERNEL);
488 if (!buffer)
489 return -ENOMEM;
490
491 /* lock this object */
492 mutex_lock(&dev->mutex);
493
494 /* verify that the device wasn't unplugged */
495 if (!dev->present) {
496 mutex_unlock(&dev->mutex);
497 return -ENODEV;
498 }
499
500 dbg("%s - minor %d, cmd 0x%.4x, arg %ld", __func__, dev->minor, cmd,
501 arg);
502
503 retval = 0;
504 io_res = 0;
505 switch (cmd) {
506 case IOW_WRITE:
507 if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW24 ||
508 dev->product_id == USB_DEVICE_ID_CODEMERCS_IOWPV1 ||
509 dev->product_id == USB_DEVICE_ID_CODEMERCS_IOWPV2 ||
510 dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW40) {
511 user_buffer = (__u8 __user *)arg;
512 io_res = copy_from_user(buffer, user_buffer,
513 dev->report_size);
514 if (io_res) {
515 retval = -EFAULT;
516 } else {
517 io_res = usb_set_report(dev->interface, 2, 0,
518 buffer,
519 dev->report_size);
520 if (io_res < 0)
521 retval = io_res;
522 }
523 } else {
524 retval = -EINVAL;
525 dev_err(&dev->interface->dev,
526 "ioctl 'IOW_WRITE' is not supported for product=0x%x.",
527 dev->product_id);
528 }
529 break;
530 case IOW_READ:
531 user_buffer = (__u8 __user *)arg;
532 io_res = usb_get_report(dev->udev,
533 dev->interface->cur_altsetting, 1, 0,
534 buffer, dev->report_size);
535 if (io_res < 0)
536 retval = io_res;
537 else {
538 io_res = copy_to_user(user_buffer, buffer, dev->report_size);
539 if (io_res < 0)
540 retval = -EFAULT;
541 }
542 break;
543 case IOW_GETINFO:
544 {
545 /* Report available information for the device */
546 struct iowarrior_info info;
547 /* needed for power consumption */
548 struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc;
549
550 /* directly from the descriptor */
551 info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
552 info.product = dev->product_id;
553 info.revision = le16_to_cpu(dev->udev->descriptor.bcdDevice);
554
555 /* 0==UNKNOWN, 1==LOW(usb1.1) ,2=FULL(usb1.1), 3=HIGH(usb2.0) */
556 info.speed = le16_to_cpu(dev->udev->speed);
557 info.if_num = dev->interface->cur_altsetting->desc.bInterfaceNumber;
558 info.report_size = dev->report_size;
559
560 /* serial number string has been read earlier 8 chars or empty string */
561 memcpy(info.serial, dev->chip_serial,
562 sizeof(dev->chip_serial));
563 if (cfg_descriptor == NULL) {
564 info.power = -1; /* no information available */
565 } else {
566 /* the MaxPower is stored in units of 2mA to make it fit into a byte-value */
567 info.power = cfg_descriptor->bMaxPower * 2;
568 }
569 io_res = copy_to_user((struct iowarrior_info __user *)arg, &info,
570 sizeof(struct iowarrior_info));
571 if (io_res < 0)
572 retval = -EFAULT;
573 break;
574 }
575 default:
576 /* return that we did not understand this ioctl call */
577 retval = -ENOTTY;
578 break;
579 }
580
581 /* unlock the device */
582 mutex_unlock(&dev->mutex);
583 return retval;
584}
585
586/**
587 * iowarrior_open
588 */
589static int iowarrior_open(struct inode *inode, struct file *file)
590{
591 struct iowarrior *dev = NULL;
592 struct usb_interface *interface;
593 int subminor;
594 int retval = 0;
595
596 dbg("%s", __func__);
597
598 subminor = iminor(inode);
599
600 /* prevent disconnects */
601 down(&disconnect_sem);
602
603 interface = usb_find_interface(&iowarrior_driver, subminor);
604 if (!interface) {
605 err("%s - error, can't find device for minor %d", __FUNCTION__,
606 subminor);
607 retval = -ENODEV;
608 goto out;
609 }
610
611 dev = usb_get_intfdata(interface);
612 if (!dev) {
613 retval = -ENODEV;
614 goto out;
615 }
616
617 /* Only one process can open each device, no sharing. */
618 if (dev->opened) {
619 retval = -EBUSY;
620 goto out;
621 }
622
623 /* setup interrupt handler for receiving values */
624 if ((retval = usb_submit_urb(dev->int_in_urb, GFP_KERNEL)) < 0) {
625 dev_err(&interface->dev, "Error %d while submitting URB\n", retval);
626 retval = -EFAULT;
627 goto out;
628 }
629 /* increment our usage count for the driver */
630 ++dev->opened;
631 /* save our object in the file's private structure */
632 file->private_data = dev;
633 retval = 0;
634
635out:
636 up(&disconnect_sem);
637 return retval;
638}
639
640/**
641 * iowarrior_release
642 */
643static int iowarrior_release(struct inode *inode, struct file *file)
644{
645 struct iowarrior *dev;
646 int retval = 0;
647
648 dev = (struct iowarrior *)file->private_data;
649 if (dev == NULL) {
650 return -ENODEV;
651 }
652
653 dbg("%s - minor %d", __func__, dev->minor);
654
655 /* lock our device */
656 mutex_lock(&dev->mutex);
657
658 if (dev->opened <= 0) {
659 retval = -ENODEV; /* close called more than once */
660 mutex_unlock(&dev->mutex);
661 } else {
662 dev->opened = 0; /* we're closeing now */
663 retval = 0;
664 if (dev->present) {
665 /*
666 The device is still connected so we only shutdown
667 pending read-/write-ops.
668 */
669 usb_kill_urb(dev->int_in_urb);
670 wake_up_interruptible(&dev->read_wait);
671 wake_up_interruptible(&dev->write_wait);
672 mutex_unlock(&dev->mutex);
673 } else {
674 /* The device was unplugged, cleanup resources */
675 mutex_unlock(&dev->mutex);
676 iowarrior_delete(dev);
677 }
678 }
679 return retval;
680}
681
682static unsigned iowarrior_poll(struct file *file, poll_table * wait)
683{
684 struct iowarrior *dev = file->private_data;
685 unsigned int mask = 0;
686
687 if (!dev->present)
688 return POLLERR | POLLHUP;
689
690 poll_wait(file, &dev->read_wait, wait);
691 poll_wait(file, &dev->write_wait, wait);
692
693 if (!dev->present)
694 return POLLERR | POLLHUP;
695
696 if (read_index(dev) != -1)
697 mask |= POLLIN | POLLRDNORM;
698
699 if (atomic_read(&dev->write_busy) < MAX_WRITES_IN_FLIGHT)
700 mask |= POLLOUT | POLLWRNORM;
701 return mask;
702}
703
704/*
705 * File operations needed when we register this driver.
706 * This assumes that this driver NEEDS file operations,
707 * of course, which means that the driver is expected
708 * to have a node in the /dev directory. If the USB
709 * device were for a network interface then the driver
710 * would use "struct net_driver" instead, and a serial
711 * device would use "struct tty_driver".
712 */
713static struct file_operations iowarrior_fops = {
714 .owner = THIS_MODULE,
715 .write = iowarrior_write,
716 .read = iowarrior_read,
717 .ioctl = iowarrior_ioctl,
718 .open = iowarrior_open,
719 .release = iowarrior_release,
720 .poll = iowarrior_poll,
721};
722
723/*
724 * usb class driver info in order to get a minor number from the usb core,
725 * and to have the device registered with devfs and the driver core
726 */
727static struct usb_class_driver iowarrior_class = {
728 .name = "iowarrior%d",
729 .fops = &iowarrior_fops,
730 .minor_base = IOWARRIOR_MINOR_BASE,
731};
732
733/*---------------------------------*/
734/* probe and disconnect functions */
735/*---------------------------------*/
736/**
737 * iowarrior_probe
738 *
739 * Called by the usb core when a new device is connected that it thinks
740 * this driver might be interested in.
741 */
742static int iowarrior_probe(struct usb_interface *interface,
743 const struct usb_device_id *id)
744{
745 struct usb_device *udev = interface_to_usbdev(interface);
746 struct iowarrior *dev = NULL;
747 struct usb_host_interface *iface_desc;
748 struct usb_endpoint_descriptor *endpoint;
749 int i;
750 int retval = -ENOMEM;
751 int idele = 0;
752
753 /* allocate memory for our device state and intialize it */
754 dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL);
755 if (dev == NULL) {
756 dev_err(&interface->dev, "Out of memory");
757 return retval;
758 }
759
760 mutex_init(&dev->mutex);
761
762 atomic_set(&dev->intr_idx, 0);
763 atomic_set(&dev->read_idx, 0);
764 spin_lock_init(&dev->intr_idx_lock);
765 atomic_set(&dev->overflow_flag, 0);
766 init_waitqueue_head(&dev->read_wait);
767 atomic_set(&dev->write_busy, 0);
768 init_waitqueue_head(&dev->write_wait);
769
770 dev->udev = udev;
771 dev->interface = interface;
772
773 iface_desc = interface->cur_altsetting;
774 dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
775
776 /* set up the endpoint information */
777 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
778 endpoint = &iface_desc->endpoint[i].desc;
779
780 if (usb_endpoint_is_int_in(endpoint))
781 dev->int_in_endpoint = endpoint;
782 if (usb_endpoint_is_int_out(endpoint))
783 /* this one will match for the IOWarrior56 only */
784 dev->int_out_endpoint = endpoint;
785 }
786 /* we have to check the report_size often, so remember it in the endianess suitable for our machine */
787 dev->report_size = le16_to_cpu(dev->int_in_endpoint->wMaxPacketSize);
788 if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&
789 (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56))
790 /* IOWarrior56 has wMaxPacketSize different from report size */
791 dev->report_size = 7;
792
793 /* create the urb and buffer for reading */
794 dev->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
795 if (!dev->int_in_urb) {
796 dev_err(&interface->dev, "Couldn't allocate interrupt_in_urb\n");
797 goto error;
798 }
799 dev->int_in_buffer = kmalloc(dev->report_size, GFP_KERNEL);
800 if (!dev->int_in_buffer) {
801 dev_err(&interface->dev, "Couldn't allocate int_in_buffer\n");
802 goto error;
803 }
804 usb_fill_int_urb(dev->int_in_urb, dev->udev,
805 usb_rcvintpipe(dev->udev,
806 dev->int_in_endpoint->bEndpointAddress),
807 dev->int_in_buffer, dev->report_size,
808 iowarrior_callback, dev,
809 dev->int_in_endpoint->bInterval);
810 /* create an internal buffer for interrupt data from the device */
811 dev->read_queue =
812 kmalloc(((dev->report_size + 1) * MAX_INTERRUPT_BUFFER),
813 GFP_KERNEL);
814 if (!dev->read_queue) {
815 dev_err(&interface->dev, "Couldn't allocate read_queue\n");
816 goto error;
817 }
818 /* Get the serial-number of the chip */
819 memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial));
820 usb_string(udev, udev->descriptor.iSerialNumber, dev->chip_serial,
821 sizeof(dev->chip_serial));
822 if (strlen(dev->chip_serial) != 8)
823 memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial));
824
825 /* Set the idle timeout to 0, if this is interface 0 */
826 if (dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) {
827 idele = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
828 0x0A,
829 USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0,
830 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
831 dbg("idele = %d", idele);
832 }
833 /* allow device read and ioctl */
834 dev->present = 1;
835
836 /* we can register the device now, as it is ready */
837 usb_set_intfdata(interface, dev);
838
839 retval = usb_register_dev(interface, &iowarrior_class);
840 if (retval) {
841 /* something prevented us from registering this driver */
842 dev_err(&interface->dev, "Not able to get a minor for this device.\n");
843 usb_set_intfdata(interface, NULL);
844 goto error;
845 }
846
847 dev->minor = interface->minor;
848
849 /* let the user know what node this device is now attached to */
850 dev_info(&interface->dev, "IOWarrior product=0x%x, serial=%s interface=%d "
851 "now attached to iowarrior%d\n", dev->product_id, dev->chip_serial,
852 iface_desc->desc.bInterfaceNumber, dev->minor - IOWARRIOR_MINOR_BASE);
853 return retval;
854
855error:
856 iowarrior_delete(dev);
857 return retval;
858}
859
860/**
861 * iowarrior_disconnect
862 *
863 * Called by the usb core when the device is removed from the system.
864 */
865static void iowarrior_disconnect(struct usb_interface *interface)
866{
867 struct iowarrior *dev;
868 int minor;
869
870 /* prevent races with open() */
871 down(&disconnect_sem);
872
873 dev = usb_get_intfdata(interface);
874 usb_set_intfdata(interface, NULL);
875
876 mutex_lock(&dev->mutex);
877
878 minor = dev->minor;
879
880 /* give back our minor */
881 usb_deregister_dev(interface, &iowarrior_class);
882
883 /* prevent device read, write and ioctl */
884 dev->present = 0;
885
886 mutex_unlock(&dev->mutex);
887
888 if (dev->opened) {
889 /* There is a process that holds a filedescriptor to the device ,
890 so we only shutdown read-/write-ops going on.
891 Deleting the device is postponed until close() was called.
892 */
893 usb_kill_urb(dev->int_in_urb);
894 wake_up_interruptible(&dev->read_wait);
895 wake_up_interruptible(&dev->write_wait);
896 } else {
897 /* no process is using the device, cleanup now */
898 iowarrior_delete(dev);
899 }
900 up(&disconnect_sem);
901
902 dev_info(&interface->dev, "I/O-Warror #%d now disconnected\n",
903 minor - IOWARRIOR_MINOR_BASE);
904}
905
906/* usb specific object needed to register this driver with the usb subsystem */
907static struct usb_driver iowarrior_driver = {
908 .name = "iowarrior",
909 .probe = iowarrior_probe,
910 .disconnect = iowarrior_disconnect,
911 .id_table = iowarrior_ids,
912};
913
914static int __init iowarrior_init(void)
915{
916 return usb_register(&iowarrior_driver);
917}
918
919static void __exit iowarrior_exit(void)
920{
921 usb_deregister(&iowarrior_driver);
922}
923
924module_init(iowarrior_init);
925module_exit(iowarrior_exit);
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index c01dfe603672..b2bedd974ac3 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -1165,7 +1165,7 @@ err_dev:
1165 return rc; 1165 return rc;
1166} 1166}
1167 1167
1168void __exit mon_bin_exit(void) 1168void mon_bin_exit(void)
1169{ 1169{
1170 cdev_del(&mon_bin_cdev); 1170 cdev_del(&mon_bin_cdev);
1171 unregister_chrdev_region(mon_bin_dev0, MON_BIN_MAX_MINOR); 1171 unregister_chrdev_region(mon_bin_dev0, MON_BIN_MAX_MINOR);
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index d38a1279d9d9..494ee3b9a226 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -520,7 +520,7 @@ int __init mon_text_init(void)
520 return 0; 520 return 0;
521} 521}
522 522
523void __exit mon_text_exit(void) 523void mon_text_exit(void)
524{ 524{
525 debugfs_remove(mon_dir); 525 debugfs_remove(mon_dir);
526} 526}
diff --git a/drivers/usb/mon/usb_mon.h b/drivers/usb/mon/usb_mon.h
index 4f949ce8a7f3..efdfd8993d9e 100644
--- a/drivers/usb/mon/usb_mon.h
+++ b/drivers/usb/mon/usb_mon.h
@@ -57,9 +57,9 @@ void mon_text_del(struct mon_bus *mbus);
57// void mon_bin_add(struct mon_bus *); 57// void mon_bin_add(struct mon_bus *);
58 58
59int __init mon_text_init(void); 59int __init mon_text_init(void);
60void __exit mon_text_exit(void); 60void mon_text_exit(void);
61int __init mon_bin_init(void); 61int __init mon_bin_init(void);
62void __exit mon_bin_exit(void); 62void mon_bin_exit(void);
63 63
64/* 64/*
65 * DMA interface. 65 * DMA interface.
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig
index 0f3d7dbb537f..3de564b23147 100644
--- a/drivers/usb/net/Kconfig
+++ b/drivers/usb/net/Kconfig
@@ -186,6 +186,15 @@ config USB_NET_CDCETHER
186 IEEE 802 "local assignment" bit is set in the address, a "usbX" 186 IEEE 802 "local assignment" bit is set in the address, a "usbX"
187 name is used instead. 187 name is used instead.
188 188
189config USB_NET_DM9601
190 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
191 depends on USB_USBNET
192 select CRC32
193 select USB_USBNET_MII
194 help
195 This option adds support for Davicom DM9601 based USB 1.1
196 10/100 Ethernet adapters.
197
189config USB_NET_GL620A 198config USB_NET_GL620A
190 tristate "GeneSys GL620USB-A based cables" 199 tristate "GeneSys GL620USB-A based cables"
191 depends on USB_USBNET 200 depends on USB_USBNET
diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile
index 7b51964de171..595a539f8384 100644
--- a/drivers/usb/net/Makefile
+++ b/drivers/usb/net/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_USB_PEGASUS) += pegasus.o
8obj-$(CONFIG_USB_RTL8150) += rtl8150.o 8obj-$(CONFIG_USB_RTL8150) += rtl8150.o
9obj-$(CONFIG_USB_NET_AX8817X) += asix.o 9obj-$(CONFIG_USB_NET_AX8817X) += asix.o
10obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o 10obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
11obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
11obj-$(CONFIG_USB_NET_GL620A) += gl620a.o 12obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
12obj-$(CONFIG_USB_NET_NET1080) += net1080.o 13obj-$(CONFIG_USB_NET_NET1080) += net1080.o
13obj-$(CONFIG_USB_NET_PLUSB) += plusb.o 14obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c
index 7ef2e4b5e39b..5808ea082459 100644
--- a/drivers/usb/net/asix.c
+++ b/drivers/usb/net/asix.c
@@ -1395,9 +1395,9 @@ static const struct usb_device_id products [] = {
1395 USB_DEVICE (0x07b8, 0x420a), 1395 USB_DEVICE (0x07b8, 0x420a),
1396 .driver_info = (unsigned long) &hawking_uf200_info, 1396 .driver_info = (unsigned long) &hawking_uf200_info,
1397}, { 1397}, {
1398 // Billionton Systems, USB2AR 1398 // Billionton Systems, USB2AR
1399 USB_DEVICE (0x08dd, 0x90ff), 1399 USB_DEVICE (0x08dd, 0x90ff),
1400 .driver_info = (unsigned long) &ax8817x_info, 1400 .driver_info = (unsigned long) &ax8817x_info,
1401}, { 1401}, {
1402 // ATEN UC210T 1402 // ATEN UC210T
1403 USB_DEVICE (0x0557, 0x2009), 1403 USB_DEVICE (0x0557, 0x2009),
@@ -1423,9 +1423,13 @@ static const struct usb_device_id products [] = {
1423 USB_DEVICE (0x1631, 0x6200), 1423 USB_DEVICE (0x1631, 0x6200),
1424 .driver_info = (unsigned long) &ax8817x_info, 1424 .driver_info = (unsigned long) &ax8817x_info,
1425}, { 1425}, {
1426 // JVC MP-PRX1 Port Replicator
1427 USB_DEVICE (0x04f1, 0x3008),
1428 .driver_info = (unsigned long) &ax8817x_info,
1429}, {
1426 // ASIX AX88772 10/100 1430 // ASIX AX88772 10/100
1427 USB_DEVICE (0x0b95, 0x7720), 1431 USB_DEVICE (0x0b95, 0x7720),
1428 .driver_info = (unsigned long) &ax88772_info, 1432 .driver_info = (unsigned long) &ax88772_info,
1429}, { 1433}, {
1430 // ASIX AX88178 10/100/1000 1434 // ASIX AX88178 10/100/1000
1431 USB_DEVICE (0x0b95, 0x1780), 1435 USB_DEVICE (0x0b95, 0x1780),
diff --git a/drivers/usb/net/dm9601.c b/drivers/usb/net/dm9601.c
new file mode 100644
index 000000000000..4a932e1cd93b
--- /dev/null
+++ b/drivers/usb/net/dm9601.c
@@ -0,0 +1,606 @@
1/*
2 * Davicom DM9601 USB 1.1 10/100Mbps ethernet devices
3 *
4 * Peter Korsgaard <jacmet@sunsite.dk>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11//#define DEBUG
12
13#include <linux/module.h>
14#include <linux/sched.h>
15#include <linux/init.h>
16#include <linux/netdevice.h>
17#include <linux/etherdevice.h>
18#include <linux/ethtool.h>
19#include <linux/mii.h>
20#include <linux/usb.h>
21#include <linux/crc32.h>
22
23#include "usbnet.h"
24
25/* datasheet:
26 http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-P01-930914.pdf
27*/
28
29/* control requests */
30#define DM_READ_REGS 0x00
31#define DM_WRITE_REGS 0x01
32#define DM_READ_MEMS 0x02
33#define DM_WRITE_REG 0x03
34#define DM_WRITE_MEMS 0x05
35#define DM_WRITE_MEM 0x07
36
37/* registers */
38#define DM_NET_CTRL 0x00
39#define DM_RX_CTRL 0x05
40#define DM_SHARED_CTRL 0x0b
41#define DM_SHARED_ADDR 0x0c
42#define DM_SHARED_DATA 0x0d /* low + high */
43#define DM_PHY_ADDR 0x10 /* 6 bytes */
44#define DM_MCAST_ADDR 0x16 /* 8 bytes */
45#define DM_GPR_CTRL 0x1e
46#define DM_GPR_DATA 0x1f
47
48#define DM_MAX_MCAST 64
49#define DM_MCAST_SIZE 8
50#define DM_EEPROM_LEN 256
51#define DM_TX_OVERHEAD 2 /* 2 byte header */
52#define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */
53#define DM_TIMEOUT 1000
54
55
56static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data)
57{
58 devdbg(dev, "dm_read() reg=0x%02x length=%d", reg, length);
59 return usb_control_msg(dev->udev,
60 usb_rcvctrlpipe(dev->udev, 0),
61 DM_READ_REGS,
62 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
63 0, reg, data, length, USB_CTRL_SET_TIMEOUT);
64}
65
66static int dm_read_reg(struct usbnet *dev, u8 reg, u8 *value)
67{
68 return dm_read(dev, reg, 1, value);
69}
70
71static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data)
72{
73 devdbg(dev, "dm_write() reg=0x%02x, length=%d", reg, length);
74 return usb_control_msg(dev->udev,
75 usb_sndctrlpipe(dev->udev, 0),
76 DM_WRITE_REGS,
77 USB_DIR_OUT | USB_TYPE_VENDOR |USB_RECIP_DEVICE,
78 0, reg, data, length, USB_CTRL_SET_TIMEOUT);
79}
80
81static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value)
82{
83 devdbg(dev, "dm_write_reg() reg=0x%02x, value=0x%02x", reg, value);
84 return usb_control_msg(dev->udev,
85 usb_sndctrlpipe(dev->udev, 0),
86 DM_WRITE_REG,
87 USB_DIR_OUT | USB_TYPE_VENDOR |USB_RECIP_DEVICE,
88 value, reg, 0, 0, USB_CTRL_SET_TIMEOUT);
89}
90
91static void dm_write_async_callback(struct urb *urb)
92{
93 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
94
95 if (urb->status < 0)
96 printk(KERN_DEBUG "dm_write_async_callback() failed with %d",
97 urb->status);
98
99 kfree(req);
100 usb_free_urb(urb);
101}
102
103static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
104{
105 struct usb_ctrlrequest *req;
106 struct urb *urb;
107 int status;
108
109 devdbg(dev, "dm_write_async() reg=0x%02x length=%d", reg, length);
110
111 urb = usb_alloc_urb(0, GFP_ATOMIC);
112 if (!urb) {
113 deverr(dev, "Error allocating URB in dm_write_async!");
114 return;
115 }
116
117 req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
118 if (!req) {
119 deverr(dev, "Failed to allocate memory for control request");
120 usb_free_urb(urb);
121 return;
122 }
123
124 req->bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
125 req->bRequest = DM_WRITE_REGS;
126 req->wValue = 0;
127 req->wIndex = cpu_to_le16(reg);
128 req->wLength = cpu_to_le16(length);
129
130 usb_fill_control_urb(urb, dev->udev,
131 usb_sndctrlpipe(dev->udev, 0),
132 (void *)req, data, length,
133 dm_write_async_callback, req);
134
135 status = usb_submit_urb(urb, GFP_ATOMIC);
136 if (status < 0) {
137 deverr(dev, "Error submitting the control message: status=%d",
138 status);
139 kfree(req);
140 usb_free_urb(urb);
141 }
142}
143
144static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
145{
146 struct usb_ctrlrequest *req;
147 struct urb *urb;
148 int status;
149
150 devdbg(dev, "dm_write_reg_async() reg=0x%02x value=0x%02x",
151 reg, value);
152
153 urb = usb_alloc_urb(0, GFP_ATOMIC);
154 if (!urb) {
155 deverr(dev, "Error allocating URB in dm_write_async!");
156 return;
157 }
158
159 req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
160 if (!req) {
161 deverr(dev, "Failed to allocate memory for control request");
162 usb_free_urb(urb);
163 return;
164 }
165
166 req->bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
167 req->bRequest = DM_WRITE_REG;
168 req->wValue = cpu_to_le16(value);
169 req->wIndex = cpu_to_le16(reg);
170 req->wLength = 0;
171
172 usb_fill_control_urb(urb, dev->udev,
173 usb_sndctrlpipe(dev->udev, 0),
174 (void *)req, 0, 0, dm_write_async_callback, req);
175
176 status = usb_submit_urb(urb, GFP_ATOMIC);
177 if (status < 0) {
178 deverr(dev, "Error submitting the control message: status=%d",
179 status);
180 kfree(req);
181 usb_free_urb(urb);
182 }
183}
184
185static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, u16 *value)
186{
187 int ret, i;
188
189 mutex_lock(&dev->phy_mutex);
190
191 dm_write_reg(dev, DM_SHARED_ADDR, phy ? (reg | 0x40) : reg);
192 dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0xc : 0x4);
193
194 for (i = 0; i < DM_TIMEOUT; i++) {
195 u8 tmp;
196
197 udelay(1);
198 ret = dm_read_reg(dev, DM_SHARED_CTRL, &tmp);
199 if (ret < 0)
200 goto out;
201
202 /* ready */
203 if ((tmp & 1) == 0)
204 break;
205 }
206
207 if (i == DM_TIMEOUT) {
208 deverr(dev, "%s read timed out!", phy ? "phy" : "eeprom");
209 ret = -EIO;
210 goto out;
211 }
212
213 dm_write_reg(dev, DM_SHARED_CTRL, 0x0);
214 ret = dm_read(dev, DM_SHARED_DATA, 2, value);
215
216 devdbg(dev, "read shared %d 0x%02x returned 0x%04x, %d",
217 phy, reg, *value, ret);
218
219 out:
220 mutex_unlock(&dev->phy_mutex);
221 return ret;
222}
223
224static int dm_write_shared_word(struct usbnet *dev, int phy, u8 reg, u16 value)
225{
226 int ret, i;
227
228 mutex_lock(&dev->phy_mutex);
229
230 ret = dm_write(dev, DM_SHARED_DATA, 2, &value);
231 if (ret < 0)
232 goto out;
233
234 dm_write_reg(dev, DM_SHARED_ADDR, phy ? (reg | 0x40) : reg);
235 dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0x1c : 0x14);
236
237 for (i = 0; i < DM_TIMEOUT; i++) {
238 u8 tmp;
239
240 udelay(1);
241 ret = dm_read_reg(dev, DM_SHARED_CTRL, &tmp);
242 if (ret < 0)
243 goto out;
244
245 /* ready */
246 if ((tmp & 1) == 0)
247 break;
248 }
249
250 if (i == DM_TIMEOUT) {
251 deverr(dev, "%s write timed out!", phy ? "phy" : "eeprom");
252 ret = -EIO;
253 goto out;
254 }
255
256 dm_write_reg(dev, DM_SHARED_CTRL, 0x0);
257
258out:
259 mutex_unlock(&dev->phy_mutex);
260 return ret;
261}
262
263static int dm_read_eeprom_word(struct usbnet *dev, u8 offset, void *value)
264{
265 return dm_read_shared_word(dev, 0, offset, value);
266}
267
268
269
270static int dm9601_get_eeprom_len(struct net_device *dev)
271{
272 return DM_EEPROM_LEN;
273}
274
275static int dm9601_get_eeprom(struct net_device *net,
276 struct ethtool_eeprom *eeprom, u8 * data)
277{
278 struct usbnet *dev = netdev_priv(net);
279 u16 *ebuf = (u16 *) data;
280 int i;
281
282 /* access is 16bit */
283 if ((eeprom->offset % 2) || (eeprom->len % 2))
284 return -EINVAL;
285
286 for (i = 0; i < eeprom->len / 2; i++) {
287 if (dm_read_eeprom_word(dev, eeprom->offset / 2 + i,
288 &ebuf[i]) < 0)
289 return -EINVAL;
290 }
291 return 0;
292}
293
294static int dm9601_mdio_read(struct net_device *netdev, int phy_id, int loc)
295{
296 struct usbnet *dev = netdev_priv(netdev);
297
298 u16 res;
299
300 if (phy_id) {
301 devdbg(dev, "Only internal phy supported");
302 return 0;
303 }
304
305 dm_read_shared_word(dev, 1, loc, &res);
306
307 devdbg(dev,
308 "dm9601_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x",
309 phy_id, loc, le16_to_cpu(res));
310
311 return le16_to_cpu(res);
312}
313
314static void dm9601_mdio_write(struct net_device *netdev, int phy_id, int loc,
315 int val)
316{
317 struct usbnet *dev = netdev_priv(netdev);
318 u16 res = cpu_to_le16(val);
319
320 if (phy_id) {
321 devdbg(dev, "Only internal phy supported");
322 return;
323 }
324
325 devdbg(dev,"dm9601_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x",
326 phy_id, loc, val);
327
328 dm_write_shared_word(dev, 1, loc, res);
329}
330
331static void dm9601_get_drvinfo(struct net_device *net,
332 struct ethtool_drvinfo *info)
333{
334 /* Inherit standard device info */
335 usbnet_get_drvinfo(net, info);
336 info->eedump_len = DM_EEPROM_LEN;
337}
338
339static u32 dm9601_get_link(struct net_device *net)
340{
341 struct usbnet *dev = netdev_priv(net);
342
343 return mii_link_ok(&dev->mii);
344}
345
346static int dm9601_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
347{
348 struct usbnet *dev = netdev_priv(net);
349
350 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
351}
352
353static struct ethtool_ops dm9601_ethtool_ops = {
354 .get_drvinfo = dm9601_get_drvinfo,
355 .get_link = dm9601_get_link,
356 .get_msglevel = usbnet_get_msglevel,
357 .set_msglevel = usbnet_set_msglevel,
358 .get_eeprom_len = dm9601_get_eeprom_len,
359 .get_eeprom = dm9601_get_eeprom,
360 .get_settings = usbnet_get_settings,
361 .set_settings = usbnet_set_settings,
362 .nway_reset = usbnet_nway_reset,
363};
364
365static void dm9601_set_multicast(struct net_device *net)
366{
367 struct usbnet *dev = netdev_priv(net);
368 /* We use the 20 byte dev->data for our 8 byte filter buffer
369 * to avoid allocating memory that is tricky to free later */
370 u8 *hashes = (u8 *) & dev->data;
371 u8 rx_ctl = 0x01;
372
373 memset(hashes, 0x00, DM_MCAST_SIZE);
374 hashes[DM_MCAST_SIZE - 1] |= 0x80; /* broadcast address */
375
376 if (net->flags & IFF_PROMISC) {
377 rx_ctl |= 0x02;
378 } else if (net->flags & IFF_ALLMULTI || net->mc_count > DM_MAX_MCAST) {
379 rx_ctl |= 0x04;
380 } else if (net->mc_count) {
381 struct dev_mc_list *mc_list = net->mc_list;
382 int i;
383
384 for (i = 0; i < net->mc_count; i++) {
385 u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
386 hashes[crc >> 3] |= 1 << (crc & 0x7);
387 }
388 }
389
390 dm_write_async(dev, DM_MCAST_ADDR, DM_MCAST_SIZE, hashes);
391 dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl);
392}
393
394static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
395{
396 int ret;
397
398 ret = usbnet_get_endpoints(dev, intf);
399 if (ret)
400 goto out;
401
402 dev->net->do_ioctl = dm9601_ioctl;
403 dev->net->set_multicast_list = dm9601_set_multicast;
404 dev->net->ethtool_ops = &dm9601_ethtool_ops;
405 dev->net->hard_header_len += DM_TX_OVERHEAD;
406 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
407 dev->rx_urb_size = dev->net->mtu + DM_RX_OVERHEAD;
408
409 dev->mii.dev = dev->net;
410 dev->mii.mdio_read = dm9601_mdio_read;
411 dev->mii.mdio_write = dm9601_mdio_write;
412 dev->mii.phy_id_mask = 0x1f;
413 dev->mii.reg_num_mask = 0x1f;
414
415 /* reset */
416 ret = dm_write_reg(dev, DM_NET_CTRL, 1);
417 udelay(20);
418
419 /* read MAC */
420 ret = dm_read(dev, DM_PHY_ADDR, ETH_ALEN, dev->net->dev_addr);
421 if (ret < 0) {
422 printk(KERN_ERR "Error reading MAC address\n");
423 ret = -ENODEV;
424 goto out;
425 }
426
427
428 /* power up phy */
429 dm_write_reg(dev, DM_GPR_CTRL, 1);
430 dm_write_reg(dev, DM_GPR_DATA, 0);
431
432 /* receive broadcast packets */
433 dm9601_set_multicast(dev->net);
434
435 dm9601_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
436 dm9601_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
437 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
438 mii_nway_restart(&dev->mii);
439
440out:
441 return ret;
442}
443
444static int dm9601_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
445{
446 u8 status;
447 int len;
448
449 /* format:
450 b0: rx status
451 b1: packet length (incl crc) low
452 b2: packet length (incl crc) high
453 b3..n-4: packet data
454 bn-3..bn: ethernet crc
455 */
456
457 if (unlikely(skb->len < DM_RX_OVERHEAD)) {
458 dev_err(&dev->udev->dev, "unexpected tiny rx frame\n");
459 return 0;
460 }
461
462 status = skb->data[0];
463 len = (skb->data[1] | (skb->data[2] << 8)) - 4;
464
465 if (unlikely(status & 0xbf)) {
466 if (status & 0x01) dev->stats.rx_fifo_errors++;
467 if (status & 0x02) dev->stats.rx_crc_errors++;
468 if (status & 0x04) dev->stats.rx_frame_errors++;
469 if (status & 0x20) dev->stats.rx_missed_errors++;
470 if (status & 0x90) dev->stats.rx_length_errors++;
471 return 0;
472 }
473
474 skb_pull(skb, 3);
475 skb_trim(skb, len);
476
477 return 1;
478}
479
480static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
481 gfp_t flags)
482{
483 int len;
484
485 /* format:
486 b0: packet length low
487 b1: packet length high
488 b3..n: packet data
489 */
490
491 if (skb_headroom(skb) < DM_TX_OVERHEAD) {
492 struct sk_buff *skb2;
493
494 skb2 = skb_copy_expand(skb, DM_TX_OVERHEAD, 0, flags);
495 dev_kfree_skb_any(skb);
496 skb = skb2;
497 if (!skb)
498 return NULL;
499 }
500
501 __skb_push(skb, DM_TX_OVERHEAD);
502
503 len = skb->len;
504 /* usbnet adds padding if length is a multiple of packet size
505 if so, adjust length value in header */
506 if ((len % dev->maxpacket) == 0)
507 len++;
508
509 skb->data[0] = len;
510 skb->data[1] = len >> 8;
511
512 return skb;
513}
514
515static void dm9601_status(struct usbnet *dev, struct urb *urb)
516{
517 int link;
518 u8 *buf;
519
520 /* format:
521 b0: net status
522 b1: tx status 1
523 b2: tx status 2
524 b3: rx status
525 b4: rx overflow
526 b5: rx count
527 b6: tx count
528 b7: gpr
529 */
530
531 if (urb->actual_length < 8)
532 return;
533
534 buf = urb->transfer_buffer;
535
536 link = !!(buf[0] & 0x40);
537 if (netif_carrier_ok(dev->net) != link) {
538 if (link) {
539 netif_carrier_on(dev->net);
540 usbnet_defer_kevent (dev, EVENT_LINK_RESET);
541 }
542 else
543 netif_carrier_off(dev->net);
544 devdbg(dev, "Link Status is: %d", link);
545 }
546}
547
548static int dm9601_link_reset(struct usbnet *dev)
549{
550 struct ethtool_cmd ecmd;
551
552 mii_check_media(&dev->mii, 1, 1);
553 mii_ethtool_gset(&dev->mii, &ecmd);
554
555 devdbg(dev, "link_reset() speed: %d duplex: %d",
556 ecmd.speed, ecmd.duplex);
557
558 return 0;
559}
560
561static const struct driver_info dm9601_info = {
562 .description = "Davicom DM9601 USB Ethernet",
563 .flags = FLAG_ETHER,
564 .bind = dm9601_bind,
565 .rx_fixup = dm9601_rx_fixup,
566 .tx_fixup = dm9601_tx_fixup,
567 .status = dm9601_status,
568 .link_reset = dm9601_link_reset,
569 .reset = dm9601_link_reset,
570};
571
572static const struct usb_device_id products[] = {
573 {
574 USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */
575 .driver_info = (unsigned long)&dm9601_info,
576 },
577 {}, // END
578};
579
580MODULE_DEVICE_TABLE(usb, products);
581
582static struct usb_driver dm9601_driver = {
583 .name = "dm9601",
584 .id_table = products,
585 .probe = usbnet_probe,
586 .disconnect = usbnet_disconnect,
587 .suspend = usbnet_suspend,
588 .resume = usbnet_resume,
589};
590
591static int __init dm9601_init(void)
592{
593 return usb_register(&dm9601_driver);
594}
595
596static void __exit dm9601_exit(void)
597{
598 usb_deregister(&dm9601_driver);
599}
600
601module_init(dm9601_init);
602module_exit(dm9601_exit);
603
604MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>");
605MODULE_DESCRIPTION("Davicom DM9601 USB 1.1 ethernet devices");
606MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 4695952b6470..c525b42dadde 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -513,6 +513,7 @@ static struct usb_device_id id_table_combined [] = {
513 { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, 513 { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) },
514 { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) }, 514 { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) },
515 { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) }, 515 { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) },
516 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
516 { }, /* Optional parameter entry */ 517 { }, /* Optional parameter entry */
517 { } /* Terminating entry */ 518 { } /* Terminating entry */
518}; 519};
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 7eff1c03ba80..1bdda935f7d9 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -491,6 +491,12 @@
491#define FTDI_TACTRIX_OPENPORT_13S_PID 0xCC49 /* OpenPort 1.3 Subaru */ 491#define FTDI_TACTRIX_OPENPORT_13S_PID 0xCC49 /* OpenPort 1.3 Subaru */
492#define FTDI_TACTRIX_OPENPORT_13U_PID 0xCC4A /* OpenPort 1.3 Universal */ 492#define FTDI_TACTRIX_OPENPORT_13U_PID 0xCC4A /* OpenPort 1.3 Universal */
493 493
494/*
495 * Telldus Technologies
496 */
497#define TELLDUS_VID 0x1781 /* Vendor ID */
498#define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */
499
494/* Commands */ 500/* Commands */
495#define FTDI_SIO_RESET 0 /* Reset the port */ 501#define FTDI_SIO_RESET 0 /* Reset the port */
496#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 502#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 9963a8b75840..db92a7fb1f7c 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -67,50 +67,95 @@ static int option_tiocmset(struct usb_serial_port *port, struct file *file,
67static int option_send_setup(struct usb_serial_port *port); 67static int option_send_setup(struct usb_serial_port *port);
68 68
69/* Vendor and product IDs */ 69/* Vendor and product IDs */
70#define OPTION_VENDOR_ID 0x0AF0 70#define OPTION_VENDOR_ID 0x0AF0
71#define HUAWEI_VENDOR_ID 0x12D1 71#define OPTION_PRODUCT_COLT 0x5000
72#define NOVATELWIRELESS_VENDOR_ID 0x1410 72#define OPTION_PRODUCT_RICOLA 0x6000
73#define ANYDATA_VENDOR_ID 0x16d5 73#define OPTION_PRODUCT_RICOLA_LIGHT 0x6100
74 74#define OPTION_PRODUCT_RICOLA_QUAD 0x6200
75#define OPTION_PRODUCT_OLD 0x5000 75#define OPTION_PRODUCT_RICOLA_QUAD_LIGHT 0x6300
76#define OPTION_PRODUCT_FUSION 0x6000 76#define OPTION_PRODUCT_RICOLA_NDIS 0x6050
77#define OPTION_PRODUCT_FUSION2 0x6300 77#define OPTION_PRODUCT_RICOLA_NDIS_LIGHT 0x6150
78#define OPTION_PRODUCT_COBRA 0x6500 78#define OPTION_PRODUCT_RICOLA_NDIS_QUAD 0x6250
79#define OPTION_PRODUCT_COBRA2 0x6600 79#define OPTION_PRODUCT_RICOLA_NDIS_QUAD_LIGHT 0x6350
80#define OPTION_PRODUCT_GTMAX36 0x6701 80#define OPTION_PRODUCT_COBRA 0x6500
81#define HUAWEI_PRODUCT_E600 0x1001 81#define OPTION_PRODUCT_COBRA_BUS 0x6501
82#define HUAWEI_PRODUCT_E220 0x1003 82#define OPTION_PRODUCT_VIPER 0x6600
83#define NOVATELWIRELESS_PRODUCT_U740 0x1400 83#define OPTION_PRODUCT_VIPER_BUS 0x6601
84#define ANYDATA_PRODUCT_ID 0x6501 84#define OPTION_PRODUCT_GT_MAX_READY 0x6701
85#define OPTION_PRODUCT_GT_MAX 0x6711
86#define OPTION_PRODUCT_FUJI_MODEM_LIGHT 0x6721
87#define OPTION_PRODUCT_FUJI_MODEM_GT 0x6741
88#define OPTION_PRODUCT_FUJI_MODEM_EX 0x6761
89#define OPTION_PRODUCT_FUJI_NETWORK_LIGHT 0x6731
90#define OPTION_PRODUCT_FUJI_NETWORK_GT 0x6751
91#define OPTION_PRODUCT_FUJI_NETWORK_EX 0x6771
92#define OPTION_PRODUCT_KOI_MODEM 0x6800
93#define OPTION_PRODUCT_KOI_NETWORK 0x6811
94#define OPTION_PRODUCT_SCORPION_MODEM 0x6901
95#define OPTION_PRODUCT_SCORPION_NETWORK 0x6911
96#define OPTION_PRODUCT_ETNA_MODEM 0x7001
97#define OPTION_PRODUCT_ETNA_NETWORK 0x7011
98#define OPTION_PRODUCT_ETNA_MODEM_LITE 0x7021
99#define OPTION_PRODUCT_ETNA_MODEM_GT 0x7041
100#define OPTION_PRODUCT_ETNA_MODEM_EX 0x7061
101#define OPTION_PRODUCT_ETNA_NETWORK_LITE 0x7031
102#define OPTION_PRODUCT_ETNA_NETWORK_GT 0x7051
103#define OPTION_PRODUCT_ETNA_NETWORK_EX 0x7071
104#define OPTION_PRODUCT_ETNA_KOI_MODEM 0x7100
105#define OPTION_PRODUCT_ETNA_KOI_NETWORK 0x7111
106
107#define HUAWEI_VENDOR_ID 0x12D1
108#define HUAWEI_PRODUCT_E600 0x1001
109#define HUAWEI_PRODUCT_E220 0x1003
110
111#define NOVATELWIRELESS_VENDOR_ID 0x1410
112#define NOVATELWIRELESS_PRODUCT_U740 0x1400
113
114#define ANYDATA_VENDOR_ID 0x16d5
115#define ANYDATA_PRODUCT_ID 0x6501
85 116
86static struct usb_device_id option_ids[] = { 117static struct usb_device_id option_ids[] = {
87 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, 118 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
88 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, 119 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
89 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, 120 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
121 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD) },
122 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD_LIGHT) },
123 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_NDIS) },
124 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_NDIS_LIGHT) },
125 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_NDIS_QUAD) },
126 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_NDIS_QUAD_LIGHT) },
90 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, 127 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) },
91 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, 128 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA_BUS) },
92 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GTMAX36) }, 129 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER) },
130 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER_BUS) },
131 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX_READY) },
132 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX) },
133 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_LIGHT) },
134 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_GT) },
135 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_EX) },
136 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_LIGHT) },
137 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_GT) },
138 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_EX) },
139 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_MODEM) },
140 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_NETWORK) },
141 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_MODEM) },
142 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_NETWORK) },
143 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM) },
144 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK) },
145 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_LITE) },
146 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_GT) },
147 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_EX) },
148 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_LITE) },
149 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_GT) },
150 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) },
151 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) },
152 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) },
93 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 153 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
94 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) }, 154 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) },
95 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, 155 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) },
96 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, 156 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
97 { } /* Terminating entry */ 157 { } /* Terminating entry */
98}; 158};
99
100static struct usb_device_id option_ids1[] = {
101 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) },
102 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) },
103 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) },
104 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) },
105 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) },
106 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GTMAX36) },
107 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
108 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) },
109 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) },
110 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
111 { } /* Terminating entry */
112};
113
114MODULE_DEVICE_TABLE(usb, option_ids); 159MODULE_DEVICE_TABLE(usb, option_ids);
115 160
116static struct usb_driver option_driver = { 161static struct usb_driver option_driver = {
@@ -132,7 +177,7 @@ static struct usb_serial_driver option_1port_device = {
132 }, 177 },
133 .description = "GSM modem (1-port)", 178 .description = "GSM modem (1-port)",
134 .usb_driver = &option_driver, 179 .usb_driver = &option_driver,
135 .id_table = option_ids1, 180 .id_table = option_ids,
136 .num_interrupt_in = NUM_DONT_CARE, 181 .num_interrupt_in = NUM_DONT_CARE,
137 .num_bulk_in = NUM_DONT_CARE, 182 .num_bulk_in = NUM_DONT_CARE,
138 .num_bulk_out = NUM_DONT_CARE, 183 .num_bulk_out = NUM_DONT_CARE,
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 98b0910ad80c..8d4d839a9d88 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -502,6 +502,30 @@ int sysfs_create_file(struct kobject * kobj, const struct attribute * attr)
502 502
503 503
504/** 504/**
505 * sysfs_add_file_to_group - add an attribute file to a pre-existing group.
506 * @kobj: object we're acting for.
507 * @attr: attribute descriptor.
508 * @group: group name.
509 */
510int sysfs_add_file_to_group(struct kobject *kobj,
511 const struct attribute *attr, const char *group)
512{
513 struct dentry *dir;
514 int error;
515
516 dir = lookup_one_len(group, kobj->dentry, strlen(group));
517 if (IS_ERR(dir))
518 error = PTR_ERR(dir);
519 else {
520 error = sysfs_add_file(dir, attr, SYSFS_KOBJ_ATTR);
521 dput(dir);
522 }
523 return error;
524}
525EXPORT_SYMBOL_GPL(sysfs_add_file_to_group);
526
527
528/**
505 * sysfs_update_file - update the modified timestamp on an object attribute. 529 * sysfs_update_file - update the modified timestamp on an object attribute.
506 * @kobj: object we're acting for. 530 * @kobj: object we're acting for.
507 * @attr: attribute descriptor. 531 * @attr: attribute descriptor.
@@ -586,6 +610,26 @@ void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr)
586} 610}
587 611
588 612
613/**
614 * sysfs_remove_file_from_group - remove an attribute file from a group.
615 * @kobj: object we're acting for.
616 * @attr: attribute descriptor.
617 * @group: group name.
618 */
619void sysfs_remove_file_from_group(struct kobject *kobj,
620 const struct attribute *attr, const char *group)
621{
622 struct dentry *dir;
623
624 dir = lookup_one_len(group, kobj->dentry, strlen(group));
625 if (!IS_ERR(dir)) {
626 sysfs_hash_and_remove(dir, attr->name);
627 dput(dir);
628 }
629}
630EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group);
631
632
589EXPORT_SYMBOL_GPL(sysfs_create_file); 633EXPORT_SYMBOL_GPL(sysfs_create_file);
590EXPORT_SYMBOL_GPL(sysfs_remove_file); 634EXPORT_SYMBOL_GPL(sysfs_remove_file);
591EXPORT_SYMBOL_GPL(sysfs_update_file); 635EXPORT_SYMBOL_GPL(sysfs_update_file);
diff --git a/include/asm-i386/idle.h b/include/asm-i386/idle.h
deleted file mode 100644
index 87ab93911199..000000000000
--- a/include/asm-i386/idle.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _ASM_I386_IDLE_H
2#define _ASM_I386_IDLE_H 1
3
4#define IDLE_START 1
5#define IDLE_END 2
6
7struct notifier_block;
8void idle_notifier_register(struct notifier_block *n);
9void idle_notifier_unregister(struct notifier_block *n);
10
11void exit_idle(void);
12void enter_idle(void);
13
14#endif
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index edfbe46a5e13..11bf899de8aa 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -257,14 +257,6 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
257 : :"a" (eax), "c" (ecx)); 257 : :"a" (eax), "c" (ecx));
258} 258}
259 259
260static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
261{
262 /* "mwait %eax,%ecx;" */
263 asm volatile(
264 "sti; .byte 0x0f,0x01,0xc9;"
265 : :"a" (eax), "c" (ecx));
266}
267
268extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); 260extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
269 261
270/* from system description table in BIOS. Mostly for MCA use, but 262/* from system description table in BIOS. Mostly for MCA use, but
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 8a1f2b6f04ac..1906938285c0 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -21,6 +21,7 @@
21#define FPC_EIR 70 21#define FPC_EIR 70
22#define DSP_BASE 71 /* 3 more hi / lo register pairs */ 22#define DSP_BASE 71 /* 3 more hi / lo register pairs */
23#define DSP_CONTROL 77 23#define DSP_CONTROL 77
24#define ACX 78
24 25
25/* 26/*
26 * This struct defines the way the registers are stored on the stack during a 27 * This struct defines the way the registers are stored on the stack during a
@@ -39,6 +40,9 @@ struct pt_regs {
39 unsigned long cp0_status; 40 unsigned long cp0_status;
40 unsigned long hi; 41 unsigned long hi;
41 unsigned long lo; 42 unsigned long lo;
43#ifdef CONFIG_CPU_HAS_SMARTMIPS
44 unsigned long acx;
45#endif
42 unsigned long cp0_badvaddr; 46 unsigned long cp0_badvaddr;
43 unsigned long cp0_cause; 47 unsigned long cp0_cause;
44 unsigned long cp0_epc; 48 unsigned long cp0_epc;
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h
index 972947474eb7..9ce0607d7a4e 100644
--- a/include/asm-mips/sigcontext.h
+++ b/include/asm-mips/sigcontext.h
@@ -23,7 +23,7 @@ struct sigcontext {
23 unsigned long long sc_pc; 23 unsigned long long sc_pc;
24 unsigned long long sc_regs[32]; 24 unsigned long long sc_regs[32];
25 unsigned long long sc_fpregs[32]; 25 unsigned long long sc_fpregs[32];
26 unsigned int sc_ownedfp; /* Unused */ 26 unsigned int sc_acx; /* Was sc_ownedfp */
27 unsigned int sc_fpc_csr; 27 unsigned int sc_fpc_csr;
28 unsigned int sc_fpc_eir; /* Unused */ 28 unsigned int sc_fpc_eir; /* Unused */
29 unsigned int sc_used_math; 29 unsigned int sc_used_math;
@@ -79,7 +79,7 @@ struct sigcontext32 {
79 __u64 sc_pc; 79 __u64 sc_pc;
80 __u64 sc_regs[32]; 80 __u64 sc_regs[32];
81 __u64 sc_fpregs[32]; 81 __u64 sc_fpregs[32];
82 __u32 sc_ownedfp; /* Unused */ 82 __u32 sc_acx; /* Only MIPS32; was sc_ownedfp */
83 __u32 sc_fpc_csr; 83 __u32 sc_fpc_csr;
84 __u32 sc_fpc_eir; /* Unused */ 84 __u32 sc_fpc_eir; /* Unused */
85 __u32 sc_used_math; 85 __u32 sc_used_math;
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 1fae5dc58138..7afa1fdf70ca 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -29,16 +29,25 @@
29 .endm 29 .endm
30 30
31 .macro SAVE_TEMP 31 .macro SAVE_TEMP
32#ifdef CONFIG_CPU_HAS_SMARTMIPS
33 mflhxu v1
34 LONG_S v1, PT_LO(sp)
35 mflhxu v1
36 LONG_S v1, PT_HI(sp)
37 mflhxu v1
38 LONG_S v1, PT_ACX(sp)
39#else
32 mfhi v1 40 mfhi v1
41 LONG_S v1, PT_HI(sp)
42 mflo v1
43 LONG_S v1, PT_LO(sp)
44#endif
33#ifdef CONFIG_32BIT 45#ifdef CONFIG_32BIT
34 LONG_S $8, PT_R8(sp) 46 LONG_S $8, PT_R8(sp)
35 LONG_S $9, PT_R9(sp) 47 LONG_S $9, PT_R9(sp)
36#endif 48#endif
37 LONG_S v1, PT_HI(sp)
38 mflo v1
39 LONG_S $10, PT_R10(sp) 49 LONG_S $10, PT_R10(sp)
40 LONG_S $11, PT_R11(sp) 50 LONG_S $11, PT_R11(sp)
41 LONG_S v1, PT_LO(sp)
42 LONG_S $12, PT_R12(sp) 51 LONG_S $12, PT_R12(sp)
43 LONG_S $13, PT_R13(sp) 52 LONG_S $13, PT_R13(sp)
44 LONG_S $14, PT_R14(sp) 53 LONG_S $14, PT_R14(sp)
@@ -182,16 +191,25 @@
182 .endm 191 .endm
183 192
184 .macro RESTORE_TEMP 193 .macro RESTORE_TEMP
194#ifdef CONFIG_CPU_HAS_SMARTMIPS
195 LONG_L $24, PT_ACX(sp)
196 mtlhx $24
197 LONG_L $24, PT_HI(sp)
198 mtlhx $24
185 LONG_L $24, PT_LO(sp) 199 LONG_L $24, PT_LO(sp)
200 mtlhx $24
201#else
202 LONG_L $24, PT_LO(sp)
203 mtlo $24
204 LONG_L $24, PT_HI(sp)
205 mthi $24
206#endif
186#ifdef CONFIG_32BIT 207#ifdef CONFIG_32BIT
187 LONG_L $8, PT_R8(sp) 208 LONG_L $8, PT_R8(sp)
188 LONG_L $9, PT_R9(sp) 209 LONG_L $9, PT_R9(sp)
189#endif 210#endif
190 mtlo $24
191 LONG_L $24, PT_HI(sp)
192 LONG_L $10, PT_R10(sp) 211 LONG_L $10, PT_R10(sp)
193 LONG_L $11, PT_R11(sp) 212 LONG_L $11, PT_R11(sp)
194 mthi $24
195 LONG_L $12, PT_R12(sp) 213 LONG_L $12, PT_R12(sp)
196 LONG_L $13, PT_R13(sp) 214 LONG_L $13, PT_R13(sp)
197 LONG_L $14, PT_R14(sp) 215 LONG_L $14, PT_R14(sp)
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 552df5f10a6d..2e4b7a5ed1c4 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -32,9 +32,30 @@
32#define IA32_SYSCALL_VECTOR 0x80 32#define IA32_SYSCALL_VECTOR 0x80
33 33
34 34
35/* Reserve the lowest usable priority level 0x20 - 0x2f for triggering
36 * cleanup after irq migration.
37 */
38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
39
35/* 40/*
36 * Vectors 0x20-0x2f are used for ISA interrupts. 41 * Vectors 0x20-0x2f are used for ISA interrupts.
37 */ 42 */
43#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10
44#define IRQ1_VECTOR IRQ0_VECTOR + 1
45#define IRQ2_VECTOR IRQ0_VECTOR + 2
46#define IRQ3_VECTOR IRQ0_VECTOR + 3
47#define IRQ4_VECTOR IRQ0_VECTOR + 4
48#define IRQ5_VECTOR IRQ0_VECTOR + 5
49#define IRQ6_VECTOR IRQ0_VECTOR + 6
50#define IRQ7_VECTOR IRQ0_VECTOR + 7
51#define IRQ8_VECTOR IRQ0_VECTOR + 8
52#define IRQ9_VECTOR IRQ0_VECTOR + 9
53#define IRQ10_VECTOR IRQ0_VECTOR + 10
54#define IRQ11_VECTOR IRQ0_VECTOR + 11
55#define IRQ12_VECTOR IRQ0_VECTOR + 12
56#define IRQ13_VECTOR IRQ0_VECTOR + 13
57#define IRQ14_VECTOR IRQ0_VECTOR + 14
58#define IRQ15_VECTOR IRQ0_VECTOR + 15
38 59
39/* 60/*
40 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff 61 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
@@ -66,10 +87,10 @@
66 87
67/* 88/*
68 * First APIC vector available to drivers: (vectors 0x30-0xee) 89 * First APIC vector available to drivers: (vectors 0x30-0xee)
69 * we start at 0x31 to spread out vectors evenly between priority 90 * we start at 0x41 to spread out vectors evenly between priority
70 * levels. (0x80 is the syscall vector) 91 * levels. (0x80 is the syscall vector)
71 */ 92 */
72#define FIRST_DEVICE_VECTOR 0x31 93#define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
73#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */ 94#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
74 95
75 96
diff --git a/include/linux/irq.h b/include/linux/irq.h
index aa5b3e6178a0..b0a44b8e0281 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -200,17 +200,6 @@ extern int setup_irq(unsigned int irq, struct irqaction *new);
200#endif 200#endif
201 201
202#ifdef CONFIG_SMP 202#ifdef CONFIG_SMP
203static inline void set_native_irq_info(int irq, cpumask_t mask)
204{
205 irq_desc[irq].affinity = mask;
206}
207#else
208static inline void set_native_irq_info(int irq, cpumask_t mask)
209{
210}
211#endif
212
213#ifdef CONFIG_SMP
214 203
215#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) 204#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
216 205
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index f07065cba7c1..21805b500aa2 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -115,6 +115,11 @@ void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
115int __must_check sysfs_create_group(struct kobject *, 115int __must_check sysfs_create_group(struct kobject *,
116 const struct attribute_group *); 116 const struct attribute_group *);
117void sysfs_remove_group(struct kobject *, const struct attribute_group *); 117void sysfs_remove_group(struct kobject *, const struct attribute_group *);
118int sysfs_add_file_to_group(struct kobject *kobj,
119 const struct attribute *attr, const char *group);
120void sysfs_remove_file_from_group(struct kobject *kobj,
121 const struct attribute *attr, const char *group);
122
118void sysfs_notify(struct kobject * k, char *dir, char *attr); 123void sysfs_notify(struct kobject * k, char *dir, char *attr);
119 124
120 125
@@ -199,6 +204,18 @@ static inline void sysfs_remove_group(struct kobject * k, const struct attribute
199 ; 204 ;
200} 205}
201 206
207static inline int sysfs_add_file_to_group(struct kobject *kobj,
208 const struct attribute *attr, const char *group)
209{
210 return 0;
211}
212
213static inline void sysfs_remove_file_from_group(struct kobject *kobj,
214 const struct attribute *attr, const char *group);
215{
216 ;
217}
218
202static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) 219static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
203{ 220{
204} 221}
diff --git a/include/linux/usb.h b/include/linux/usb.h
index a8e8d1ecebb1..87dc75a6cee1 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -388,10 +388,14 @@ struct usb_device {
388 struct usb_device *children[USB_MAXCHILDREN]; 388 struct usb_device *children[USB_MAXCHILDREN];
389 389
390 int pm_usage_cnt; /* usage counter for autosuspend */ 390 int pm_usage_cnt; /* usage counter for autosuspend */
391 u32 quirks; /* quirks of the whole device */
392
391#ifdef CONFIG_PM 393#ifdef CONFIG_PM
392 struct delayed_work autosuspend; /* for delayed autosuspends */ 394 struct delayed_work autosuspend; /* for delayed autosuspends */
393 struct mutex pm_mutex; /* protects PM operations */ 395 struct mutex pm_mutex; /* protects PM operations */
394 396
397 unsigned autosuspend_delay; /* in jiffies */
398
395 unsigned auto_pm:1; /* autosuspend/resume in progress */ 399 unsigned auto_pm:1; /* autosuspend/resume in progress */
396 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 400 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
397#endif 401#endif
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 245c72531228..1122a6c2c1a3 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -1,8 +1,9 @@
1/* 1/*
2 * This file holds USB constants and structures that are needed for USB 2 * This file holds USB constants and structures that are needed for
3 * device APIs. These are used by the USB device model, which is defined 3 * USB device APIs. These are used by the USB device model, which is
4 * in chapter 9 of the USB 2.0 specification. Linux has several APIs in C 4 * defined in chapter 9 of the USB 2.0 specification and in the
5 * that need these: 5 * Wireless USB 1.0 (spread around). Linux has several APIs in C that
6 * need these:
6 * 7 *
7 * - the master/host side Linux-USB kernel driver API; 8 * - the master/host side Linux-USB kernel driver API;
8 * - the "usbfs" user space API; and 9 * - the "usbfs" user space API; and
@@ -14,6 +15,19 @@
14 * 15 *
15 * There's also "Wireless USB", using low power short range radios for 16 * There's also "Wireless USB", using low power short range radios for
16 * peripheral interconnection but otherwise building on the USB framework. 17 * peripheral interconnection but otherwise building on the USB framework.
18 *
19 * Note all descriptors are declared '__attribute__((packed))' so that:
20 *
21 * [a] they never get padded, either internally (USB spec writers
22 * probably handled that) or externally;
23 *
24 * [b] so that accessing bigger-than-a-bytes fields will never
25 * generate bus errors on any platform, even when the location of
26 * its descriptor inside a bundle isn't "naturally aligned", and
27 *
28 * [c] for consistency, removing all doubt even when it appears to
29 * someone that the two other points are non-issues for that
30 * particular descriptor type.
17 */ 31 */
18 32
19#ifndef __LINUX_USB_CH9_H 33#ifndef __LINUX_USB_CH9_H
diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h
new file mode 100644
index 000000000000..cbbe020a4f5c
--- /dev/null
+++ b/include/linux/usb/iowarrior.h
@@ -0,0 +1,33 @@
1#ifndef _IOWARRIOR_H_
2#define _IOWARRIOR_H_
3
4#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */
5
6/* Define the ioctl commands for reading and writing data */
7#define IOW_WRITE _IOW(CODEMERCS_MAGIC_NUMBER, 1, __u8 *)
8#define IOW_READ _IOW(CODEMERCS_MAGIC_NUMBER, 2, __u8 *)
9
10/*
11 A struct for available device info which is read
12 with the ioctl IOW_GETINFO.
13 To be compatible with 2.4 userspace which didn't have an easy way to get
14 this information.
15*/
16struct iowarrior_info {
17 __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
18 __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */
19 __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */
20 __u32 revision; /* revision number of the chip */
21 __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
22 __u32 power; /* power consumption of the device in mA */
23 __u32 if_num; /* the number of the endpoint */
24 __u32 report_size; /* size of the data-packets on this interface */
25};
26
27/*
28 Get some device-information (product-id , serial-number etc.)
29 in order to identify a chip.
30*/
31#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info)
32
33#endif /* _IOWARRIOR_H_ */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
new file mode 100644
index 000000000000..6bac8faacbc6
--- /dev/null
+++ b/include/linux/usb/quirks.h
@@ -0,0 +1,11 @@
1/*
2 * This file holds the definitions of quirks found in USB devices.
3 * Only quirks that affect the whole device, not an interface,
4 * belong here.
5 */
6
7/* device must not be autosuspended */
8#define USB_QUIRK_NO_AUTOSUSPEND 0x00000001
9
10/* string descriptors must not be fetched using a 255-byte read */
11#define USB_QUIRK_STRING_FETCH_255 0x00000002
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index 4baa3bbcd25a..77b7acc875c5 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -65,12 +65,11 @@ void move_native_irq(int irq)
65 if (likely(!(desc->status & IRQ_MOVE_PENDING))) 65 if (likely(!(desc->status & IRQ_MOVE_PENDING)))
66 return; 66 return;
67 67
68 if (likely(!(desc->status & IRQ_DISABLED))) 68 if (unlikely(desc->status & IRQ_DISABLED))
69 desc->chip->disable(irq); 69 return;
70 70
71 desc->chip->mask(irq);
71 move_masked_irq(irq); 72 move_masked_irq(irq);
72 73 desc->chip->unmask(irq);
73 if (likely(!(desc->status & IRQ_DISABLED)))
74 desc->chip->enable(irq);
75} 74}
76 75