aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--Documentation/sparse.txt10
-rw-r--r--arch/avr32/kernel/ptrace.c4
-rw-r--r--arch/avr32/kernel/traps.c52
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c2
-rw-r--r--arch/avr32/mm/cache.c3
-rw-r--r--arch/i386/kernel/acpi/boot.c23
-rw-r--r--arch/i386/kernel/acpi/earlyquirk.c7
-rw-r--r--arch/i386/kernel/smpboot.c16
-rw-r--r--arch/ia64/kernel/asm-offsets.c1
-rw-r--r--arch/ia64/kernel/efi.c10
-rw-r--r--arch/ia64/kernel/fsys.S105
-rw-r--r--arch/ia64/kernel/iosapic.c8
-rw-r--r--arch/ia64/kernel/setup.c2
-rw-r--r--arch/ia64/sn/kernel/io_acpi_init.c44
-rw-r--r--arch/ia64/sn/kernel/irq.c14
-rw-r--r--arch/ia64/sn/kernel/setup.c2
-rw-r--r--arch/mips/arc/init.c6
-rw-r--r--arch/mips/dec/prom/init.c3
-rw-r--r--arch/mips/kernel/linux32.c46
-rw-r--r--arch/mips/sibyte/Kconfig22
-rw-r--r--arch/mips/sibyte/sb1250/bcm1250_tbprof.c377
-rw-r--r--arch/mips/sibyte/sb1250/setup.c2
-rw-r--r--arch/powerpc/kernel/cputable.c16
-rw-r--r--arch/powerpc/kernel/prom_parse.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c8
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/celleb/scc_epci.c82
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/powermac/feature.c5
-rw-r--r--arch/powerpc/platforms/powermac/pci.c7
-rw-r--r--arch/powerpc/xmon/xmon.c2
-rw-r--r--arch/sh/boards/renesas/r7780rp/Makefile2
-rw-r--r--arch/sh/boards/renesas/r7780rp/io.c233
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c24
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c26
-rw-r--r--arch/sh/configs/rts7751r2d_defconfig110
-rw-r--r--arch/sh/kernel/entry-common.S2
-rw-r--r--arch/sh/kernel/io_generic.c3
-rw-r--r--arch/sh/kernel/process.c5
-rw-r--r--arch/sh/kernel/ptrace.c45
-rw-r--r--arch/sh/kernel/signal.c4
-rw-r--r--arch/sh/kernel/vmlinux.lds.S3
-rw-r--r--arch/sh/mm/cache-sh4.c12
-rw-r--r--arch/sh/mm/cache-sh7705.c9
-rw-r--r--arch/sh/mm/pg-sh4.c22
-rw-r--r--arch/sh/mm/pg-sh7705.c31
-rw-r--r--arch/sh/mm/tlb-flush.c55
-rw-r--r--arch/sh/mm/tlb-sh3.c63
-rw-r--r--arch/sh/mm/tlb-sh4.c68
-rw-r--r--arch/um/drivers/daemon_user.c17
-rw-r--r--arch/um/drivers/line.c6
-rw-r--r--arch/um/drivers/mcast_user.c10
-rw-r--r--arch/um/drivers/ssl.c2
-rw-r--r--arch/um/drivers/stdio_console.c2
-rw-r--r--arch/um/include/os.h3
-rw-r--r--arch/um/kernel/irq.c1
-rw-r--r--arch/um/os-Linux/process.c3
-rw-r--r--arch/um/os-Linux/signal.c5
-rw-r--r--arch/um/sys-x86_64/syscalls.c6
-rw-r--r--arch/x86_64/ia32/ptrace32.c1
-rw-r--r--arch/x86_64/kernel/early-quirks.c9
-rw-r--r--arch/x86_64/kernel/smpboot.c5
-rw-r--r--drivers/acpi/Kconfig11
-rw-r--r--drivers/acpi/ibm_acpi.c28
-rw-r--r--drivers/acpi/power.c13
-rw-r--r--drivers/acpi/resources/rscreate.c25
-rw-r--r--drivers/ata/ata_piix.c11
-rw-r--r--drivers/ata/libata-acpi.c24
-rw-r--r--drivers/ata/libata-core.c19
-rw-r--r--drivers/ata/sata_nv.c8
-rw-r--r--drivers/base/core.c7
-rw-r--r--drivers/char/ds1286.c9
-rw-r--r--drivers/connector/connector.c22
-rw-r--r--drivers/infiniband/core/cma.c2
-rw-r--r--drivers/infiniband/core/ucma.c2
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.c1
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c19
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_ev.c12
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c40
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.h33
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_qp.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_classes.h6
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c16
-rw-r--r--drivers/infiniband/hw/ehca/ehca_irq.c59
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c10
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c5
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c13
-rw-r--r--drivers/input/serio/i8042.c10
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c2
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c2
-rw-r--r--drivers/mtd/maps/dilnetpc.c4
-rw-r--r--drivers/mtd/maps/esb2rom.c11
-rw-r--r--drivers/mtd/mtdconcat.c1
-rw-r--r--drivers/mtd/mtdpart.c7
-rw-r--r--drivers/mtd/nand/diskonchip.c2
-rw-r--r--drivers/mtd/nand/nand_base.c1
-rw-r--r--drivers/mtd/onenand/onenand_base.c77
-rw-r--r--drivers/net/3c59x.c28
-rw-r--r--drivers/net/mv643xx_eth.c10
-rw-r--r--drivers/net/myri10ge/myri10ge.c42
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c5
-rw-r--r--drivers/net/r8169.c14
-rw-r--r--drivers/net/sky2.c24
-rw-r--r--drivers/net/tokenring/ibmtr.c25
-rw-r--r--drivers/net/via-rhine.c32
-rw-r--r--drivers/net/wan/z85230.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c6
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c10
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c10
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c120
-rw-r--r--drivers/serial/sn_console.c52
-rw-r--r--fs/compat.c100
-rw-r--r--fs/dlm/user.c1
-rw-r--r--fs/ecryptfs/inode.c2
-rw-r--r--fs/gfs2/glock.c4
-rw-r--r--fs/gfs2/glops.c3
-rw-r--r--fs/gfs2/incore.h2
-rw-r--r--fs/gfs2/inode.c7
-rw-r--r--fs/gfs2/ops_address.c7
-rw-r--r--fs/gfs2/ops_export.c5
-rw-r--r--fs/gfs2/ops_fstype.c2
-rw-r--r--fs/gfs2/quota.c2
-rw-r--r--fs/gfs2/super.c1
-rw-r--r--fs/hostfs/hostfs_kern.c17
-rw-r--r--fs/jffs2/background.c8
-rw-r--r--fs/jffs2/readinode.c16
-rw-r--r--fs/jffs2/scan.c9
-rw-r--r--fs/jffs2/wbuf.c7
-rw-r--r--fs/partitions/check.c2
-rw-r--r--include/asm-avr32/Kbuild2
-rw-r--r--include/asm-avr32/dma-mapping.h18
-rw-r--r--include/asm-mips/dma.h2
-rw-r--r--include/asm-mips/sibyte/trace_prof.h110
-rw-r--r--include/asm-sh/cache.h3
-rw-r--r--include/asm-sh/cacheflush.h3
-rw-r--r--include/asm-sh/cpu-sh3/cacheflush.h2
-rw-r--r--include/asm-sh/cpu-sh4/cacheflush.h2
-rw-r--r--include/asm-sh/pgtable.h5
-rw-r--r--include/asm-sh/thread_info.h2
-rw-r--r--include/asm-sparc64/parport.h11
-rw-r--r--include/linux/compat.h19
-rw-r--r--include/linux/mtd/mtd.h1
-rw-r--r--include/linux/mtd/onenand.h5
-rw-r--r--include/net/xfrm.h5
-rw-r--r--kernel/sysctl.c3
-rw-r--r--net/bluetooth/hci_sock.c4
-rw-r--r--net/bridge/br_if.c4
-rw-r--r--net/dccp/ccids/ccid3.c7
-rw-r--r--net/dccp/input.c21
-rw-r--r--net/ipv4/udp.c1
-rw-r--r--net/ipv6/addrconf.c4
-rw-r--r--net/ipv6/ipv6_sockglue.c10
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c1
-rw-r--r--net/key/af_key.c26
-rw-r--r--net/netfilter/nfnetlink_log.c4
-rw-r--r--net/sctp/ipv6.c4
-rw-r--r--net/xfrm/xfrm_policy.c18
-rw-r--r--net/xfrm/xfrm_user.c24
160 files changed, 1886 insertions, 1203 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 6e92ba61f7c0..914119309ddb 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -79,6 +79,7 @@ parameter is applicable:
79 Documentation/scsi/. 79 Documentation/scsi/.
80 SELINUX SELinux support is enabled. 80 SELINUX SELinux support is enabled.
81 SERIAL Serial support is enabled. 81 SERIAL Serial support is enabled.
82 SH SuperH architecture is enabled.
82 SMP The kernel is an SMP kernel. 83 SMP The kernel is an SMP kernel.
83 SPARC Sparc architecture is enabled. 84 SPARC Sparc architecture is enabled.
84 SWSUSP Software suspend is enabled. 85 SWSUSP Software suspend is enabled.
@@ -485,7 +486,7 @@ and is between 256 and 4096 characters. It is defined in the file
485 486
486 dtc3181e= [HW,SCSI] 487 dtc3181e= [HW,SCSI]
487 488
488 earlyprintk= [IA-32,X86-64] 489 earlyprintk= [IA-32,X86-64,SH]
489 earlyprintk=vga 490 earlyprintk=vga
490 earlyprintk=serial[,ttySn[,baudrate]] 491 earlyprintk=serial[,ttySn[,baudrate]]
491 492
@@ -1784,7 +1785,7 @@ and is between 256 and 4096 characters. It is defined in the file
1784 usbhid.mousepoll= 1785 usbhid.mousepoll=
1785 [USBHID] The interval which mice are to be polled at. 1786 [USBHID] The interval which mice are to be polled at.
1786 1787
1787 vdso= [IA-32] 1788 vdso= [IA-32,SH]
1788 vdso=1: enable VDSO (default) 1789 vdso=1: enable VDSO (default)
1789 vdso=0: disable VDSO mapping 1790 vdso=0: disable VDSO mapping
1790 1791
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt
index f9c99c9a54f9..1a3bdc27d95e 100644
--- a/Documentation/sparse.txt
+++ b/Documentation/sparse.txt
@@ -45,11 +45,15 @@ special.
45Getting sparse 45Getting sparse
46~~~~~~~~~~~~~~ 46~~~~~~~~~~~~~~
47 47
48With git, you can just get it from 48You can get latest released versions from the Sparse homepage at
49http://www.kernel.org/pub/linux/kernel/people/josh/sparse/
49 50
50 rsync://rsync.kernel.org/pub/scm/devel/sparse/sparse.git 51Alternatively, you can get snapshots of the latest development version
52of sparse using git to clone..
51 53
52and DaveJ has tar-balls at 54 git://git.kernel.org/pub/scm/linux/kernel/git/josh/sparse.git
55
56DaveJ has hourly generated tarballs of the git tree available at..
53 57
54 http://www.codemonkey.org.uk/projects/git-snapshots/sparse/ 58 http://www.codemonkey.org.uk/projects/git-snapshots/sparse/
55 59
diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c
index f2e81cd79002..6f4388f7c20b 100644
--- a/arch/avr32/kernel/ptrace.c
+++ b/arch/avr32/kernel/ptrace.c
@@ -313,7 +313,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs)
313 __mtdr(DBGREG_DC, dc); 313 __mtdr(DBGREG_DC, dc);
314 314
315 ti = current_thread_info(); 315 ti = current_thread_info();
316 ti->flags |= _TIF_BREAKPOINT; 316 set_ti_thread_flag(ti, TIF_BREAKPOINT);
317 317
318 /* The TLB miss handlers don't check thread flags */ 318 /* The TLB miss handlers don't check thread flags */
319 if ((regs->pc >= (unsigned long)&itlb_miss) 319 if ((regs->pc >= (unsigned long)&itlb_miss)
@@ -328,7 +328,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs)
328 * single step. 328 * single step.
329 */ 329 */
330 if ((regs->sr & MODE_MASK) != MODE_SUPERVISOR) 330 if ((regs->sr & MODE_MASK) != MODE_SUPERVISOR)
331 ti->flags |= TIF_SINGLE_STEP; 331 set_ti_thread_flag(ti, TIF_SINGLE_STEP);
332 } else { 332 } else {
333 panic("Unable to handle debug trap at pc = %08lx\n", 333 panic("Unable to handle debug trap at pc = %08lx\n",
334 regs->pc); 334 regs->pc);
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c
index 7e803f4d7a12..adc01a12d154 100644
--- a/arch/avr32/kernel/traps.c
+++ b/arch/avr32/kernel/traps.c
@@ -49,39 +49,45 @@ out:
49 return; 49 return;
50} 50}
51 51
52static inline int valid_stack_ptr(struct thread_info *tinfo, unsigned long p)
53{
54 return (p > (unsigned long)tinfo)
55 && (p < (unsigned long)tinfo + THREAD_SIZE - 3);
56}
57
52#ifdef CONFIG_FRAME_POINTER 58#ifdef CONFIG_FRAME_POINTER
53static inline void __show_trace(struct task_struct *tsk, unsigned long *sp, 59static inline void __show_trace(struct task_struct *tsk, unsigned long *sp,
54 struct pt_regs *regs) 60 struct pt_regs *regs)
55{ 61{
56 unsigned long __user *fp; 62 unsigned long lr, fp;
57 unsigned long __user *last_fp = NULL; 63 struct thread_info *tinfo;
58 64
59 if (regs) { 65 tinfo = (struct thread_info *)
60 fp = (unsigned long __user *)regs->r7; 66 ((unsigned long)sp & ~(THREAD_SIZE - 1));
61 } else if (tsk == current) { 67
62 register unsigned long __user *real_fp __asm__("r7"); 68 if (regs)
63 fp = real_fp; 69 fp = regs->r7;
64 } else { 70 else if (tsk == current)
65 fp = (unsigned long __user *)tsk->thread.cpu_context.r7; 71 asm("mov %0, r7" : "=r"(fp));
66 } 72 else
73 fp = tsk->thread.cpu_context.r7;
67 74
68 /* 75 /*
69 * Walk the stack until (a) we get an exception, (b) the frame 76 * Walk the stack as long as the frame pointer (a) is within
70 * pointer becomes zero, or (c) the frame pointer gets stuck 77 * the kernel stack of the task, and (b) it doesn't move
71 * at the same value. 78 * downwards.
72 */ 79 */
73 while (fp && fp != last_fp) { 80 while (valid_stack_ptr(tinfo, fp)) {
74 unsigned long lr, new_fp = 0; 81 unsigned long new_fp;
75
76 last_fp = fp;
77 if (__get_user(lr, fp))
78 break;
79 if (fp && __get_user(new_fp, fp + 1))
80 break;
81 fp = (unsigned long __user *)new_fp;
82 82
83 lr = *(unsigned long *)fp;
83 printk(" [<%08lx>] ", lr); 84 printk(" [<%08lx>] ", lr);
84 print_symbol("%s\n", lr); 85 print_symbol("%s\n", lr);
86
87 new_fp = *(unsigned long *)(fp + 4);
88 if (new_fp <= fp)
89 break;
90 fp = new_fp;
85 } 91 }
86 printk("\n"); 92 printk("\n");
87} 93}
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index bc235507c5c7..472703f90c22 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -752,7 +752,7 @@ static struct resource atmel_spi1_resource[] = {
752DEFINE_DEV(atmel_spi, 1); 752DEFINE_DEV(atmel_spi, 1);
753DEV_CLK(spi_clk, atmel_spi1, pba, 1); 753DEV_CLK(spi_clk, atmel_spi1, pba, 1);
754 754
755static void 755static void __init
756at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, 756at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b,
757 unsigned int n, const u8 *pins) 757 unsigned int n, const u8 *pins)
758{ 758{
diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index fb13f72e9a02..8f7b1c3cd0f9 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -121,9 +121,8 @@ void flush_icache_range(unsigned long start, unsigned long end)
121void flush_icache_page(struct vm_area_struct *vma, struct page *page) 121void flush_icache_page(struct vm_area_struct *vma, struct page *page)
122{ 122{
123 if (vma->vm_flags & VM_EXEC) { 123 if (vma->vm_flags & VM_EXEC) {
124 void *v = kmap(page); 124 void *v = page_address(page);
125 __flush_icache_range((unsigned long)v, (unsigned long)v + PAGE_SIZE); 125 __flush_icache_range((unsigned long)v, (unsigned long)v + PAGE_SIZE);
126 kunmap(v);
127 } 126 }
128} 127}
129 128
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index e5eb97a910ed..9ea5b8ecc7e1 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -1072,7 +1072,28 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
1072 "ASUS A7V ACPI BIOS Revision 1007"), 1072 "ASUS A7V ACPI BIOS Revision 1007"),
1073 }, 1073 },
1074 }, 1074 },
1075 1075 {
1076 /*
1077 * Latest BIOS for IBM 600E (1.16) has bad pcinum
1078 * for LPC bridge, which is needed for the PCI
1079 * interrupt links to work. DSDT fix is in bug 5966.
1080 * 2645, 2646 model numbers are shared with 600/600E/600X
1081 */
1082 .callback = disable_acpi_irq,
1083 .ident = "IBM Thinkpad 600 Series 2645",
1084 .matches = {
1085 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1086 DMI_MATCH(DMI_BOARD_NAME, "2645"),
1087 },
1088 },
1089 {
1090 .callback = disable_acpi_irq,
1091 .ident = "IBM Thinkpad 600 Series 2646",
1092 .matches = {
1093 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1094 DMI_MATCH(DMI_BOARD_NAME, "2646"),
1095 },
1096 },
1076 /* 1097 /*
1077 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled 1098 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
1078 */ 1099 */
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c
index bf86f7662d8b..a7d22d9f3d7e 100644
--- a/arch/i386/kernel/acpi/earlyquirk.c
+++ b/arch/i386/kernel/acpi/earlyquirk.c
@@ -14,11 +14,8 @@
14 14
15#ifdef CONFIG_ACPI 15#ifdef CONFIG_ACPI
16 16
17static int nvidia_hpet_detected __initdata;
18
19static int __init nvidia_hpet_check(struct acpi_table_header *header) 17static int __init nvidia_hpet_check(struct acpi_table_header *header)
20{ 18{
21 nvidia_hpet_detected = 1;
22 return 0; 19 return 0;
23} 20}
24#endif 21#endif
@@ -29,9 +26,7 @@ static int __init check_bridge(int vendor, int device)
29 /* According to Nvidia all timer overrides are bogus unless HPET 26 /* According to Nvidia all timer overrides are bogus unless HPET
30 is enabled. */ 27 is enabled. */
31 if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) { 28 if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) {
32 nvidia_hpet_detected = 0; 29 if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check)) {
33 acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check);
34 if (nvidia_hpet_detected == 0) {
35 acpi_skip_timer_override = 1; 30 acpi_skip_timer_override = 1;
36 printk(KERN_INFO "Nvidia board " 31 printk(KERN_INFO "Nvidia board "
37 "detected. Ignoring ACPI " 32 "detected. Ignoring ACPI "
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 9b0dd2744c82..4ff55e675576 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -45,6 +45,7 @@
45#include <linux/notifier.h> 45#include <linux/notifier.h>
46#include <linux/cpu.h> 46#include <linux/cpu.h>
47#include <linux/percpu.h> 47#include <linux/percpu.h>
48#include <linux/nmi.h>
48 49
49#include <linux/delay.h> 50#include <linux/delay.h>
50#include <linux/mc146818rtc.h> 51#include <linux/mc146818rtc.h>
@@ -1278,8 +1279,9 @@ void __cpu_die(unsigned int cpu)
1278 1279
1279int __cpuinit __cpu_up(unsigned int cpu) 1280int __cpuinit __cpu_up(unsigned int cpu)
1280{ 1281{
1282 unsigned long flags;
1281#ifdef CONFIG_HOTPLUG_CPU 1283#ifdef CONFIG_HOTPLUG_CPU
1282 int ret=0; 1284 int ret = 0;
1283 1285
1284 /* 1286 /*
1285 * We do warm boot only on cpus that had booted earlier 1287 * We do warm boot only on cpus that had booted earlier
@@ -1297,23 +1299,25 @@ int __cpuinit __cpu_up(unsigned int cpu)
1297 /* In case one didn't come up */ 1299 /* In case one didn't come up */
1298 if (!cpu_isset(cpu, cpu_callin_map)) { 1300 if (!cpu_isset(cpu, cpu_callin_map)) {
1299 printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); 1301 printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu);
1300 local_irq_enable();
1301 return -EIO; 1302 return -EIO;
1302 } 1303 }
1303 1304
1304 local_irq_enable();
1305
1306 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 1305 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
1307 /* Unleash the CPU! */ 1306 /* Unleash the CPU! */
1308 cpu_set(cpu, smp_commenced_mask); 1307 cpu_set(cpu, smp_commenced_mask);
1309 1308
1310 /* 1309 /*
1311 * Check TSC synchronization with the AP: 1310 * Check TSC synchronization with the AP (keep irqs disabled
1311 * while doing so):
1312 */ 1312 */
1313 local_irq_save(flags);
1313 check_tsc_sync_source(cpu); 1314 check_tsc_sync_source(cpu);
1315 local_irq_restore(flags);
1314 1316
1315 while (!cpu_isset(cpu, cpu_online_map)) 1317 while (!cpu_isset(cpu, cpu_online_map)) {
1316 cpu_relax(); 1318 cpu_relax();
1319 touch_nmi_watchdog();
1320 }
1317 1321
1318#ifdef CONFIG_X86_GENERICARCH 1322#ifdef CONFIG_X86_GENERICARCH
1319 if (num_online_cpus() > 8 && genapic == &apic_default) 1323 if (num_online_cpus() > 8 && genapic == &apic_default)
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index 75a2a2c12258..2236fabbb3c6 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -35,6 +35,7 @@ void foo(void)
35 BLANK(); 35 BLANK();
36 36
37 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 37 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
38 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
38 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count)); 39 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
39 40
40 BLANK(); 41 BLANK();
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 4061593e5b17..49b93682c752 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -971,6 +971,11 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
971 if (!is_memory_available(md)) 971 if (!is_memory_available(md))
972 continue; 972 continue;
973 973
974#ifdef CONFIG_CRASH_DUMP
975 /* saved_max_pfn should ignore max_addr= command line arg */
976 if (saved_max_pfn < (efi_md_end(md) >> PAGE_SHIFT))
977 saved_max_pfn = (efi_md_end(md) >> PAGE_SHIFT);
978#endif
974 /* 979 /*
975 * Round ends inward to granule boundaries 980 * Round ends inward to granule boundaries
976 * Give trimmings to uncached allocator 981 * Give trimmings to uncached allocator
@@ -1010,11 +1015,6 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
1010 } else 1015 } else
1011 ae = efi_md_end(md); 1016 ae = efi_md_end(md);
1012 1017
1013#ifdef CONFIG_CRASH_DUMP
1014 /* saved_max_pfn should ignore max_addr= command line arg */
1015 if (saved_max_pfn < (ae >> PAGE_SHIFT))
1016 saved_max_pfn = (ae >> PAGE_SHIFT);
1017#endif
1018 /* keep within max_addr= and min_addr= command line arg */ 1018 /* keep within max_addr= and min_addr= command line arg */
1019 as = max(as, min_addr); 1019 as = max(as, min_addr);
1020 ae = min(ae, max_addr); 1020 ae = min(ae, max_addr);
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index 7a05b1cb2ad5..8589e84a27c6 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -10,6 +10,8 @@
10 * probably broke it along the way... ;-) 10 * probably broke it along the way... ;-)
11 * 13-Jul-04 clameter Implement fsys_clock_gettime and revise fsys_gettimeofday to make 11 * 13-Jul-04 clameter Implement fsys_clock_gettime and revise fsys_gettimeofday to make
12 * it capable of using memory based clocks without falling back to C code. 12 * it capable of using memory based clocks without falling back to C code.
13 * 08-Feb-07 Fenghua Yu Implement fsys_getcpu.
14 *
13 */ 15 */
14 16
15#include <asm/asmmacro.h> 17#include <asm/asmmacro.h>
@@ -505,6 +507,59 @@ EX(.fail_efault, (p15) st8 [r34]=r3)
505#endif 507#endif
506END(fsys_rt_sigprocmask) 508END(fsys_rt_sigprocmask)
507 509
510/*
511 * fsys_getcpu doesn't use the third parameter in this implementation. It reads
512 * current_thread_info()->cpu and corresponding node in cpu_to_node_map.
513 */
514ENTRY(fsys_getcpu)
515 .prologue
516 .altrp b6
517 .body
518 ;;
519 add r2=TI_FLAGS+IA64_TASK_SIZE,r16
520 tnat.nz p6,p0 = r32 // guard against NaT argument
521 add r3=TI_CPU+IA64_TASK_SIZE,r16
522 ;;
523 ld4 r3=[r3] // M r3 = thread_info->cpu
524 ld4 r2=[r2] // M r2 = thread_info->flags
525(p6) br.cond.spnt.few .fail_einval // B
526 ;;
527 tnat.nz p7,p0 = r33 // I guard against NaT argument
528(p7) br.cond.spnt.few .fail_einval // B
529#ifdef CONFIG_NUMA
530 movl r17=cpu_to_node_map
531 ;;
532EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles
533EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles
534 shladd r18=r3,1,r17
535 ;;
536 ld2 r20=[r18] // r20 = cpu_to_node_map[cpu]
537 and r2 = TIF_ALLWORK_MASK,r2
538 ;;
539 cmp.ne p8,p0=0,r2
540(p8) br.spnt.many fsys_fallback_syscall
541 ;;
542 ;;
543EX(.fail_efault, st4 [r32] = r3)
544EX(.fail_efault, st2 [r33] = r20)
545 mov r8=0
546 ;;
547#else
548EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles
549EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles
550 and r2 = TIF_ALLWORK_MASK,r2
551 ;;
552 cmp.ne p8,p0=0,r2
553(p8) br.spnt.many fsys_fallback_syscall
554 ;;
555EX(.fail_efault, st4 [r32] = r3)
556EX(.fail_efault, st2 [r33] = r0)
557 mov r8=0
558 ;;
559#endif
560 FSYS_RETURN
561END(fsys_getcpu)
562
508ENTRY(fsys_fallback_syscall) 563ENTRY(fsys_fallback_syscall)
509 .prologue 564 .prologue
510 .altrp b6 565 .altrp b6
@@ -878,6 +933,56 @@ fsyscall_table:
878 data8 0 // timer_delete 933 data8 0 // timer_delete
879 data8 0 // clock_settime 934 data8 0 // clock_settime
880 data8 fsys_clock_gettime // clock_gettime 935 data8 fsys_clock_gettime // clock_gettime
936 data8 0 // clock_getres // 1255
937 data8 0 // clock_nanosleep
938 data8 0 // fstatfs64
939 data8 0 // statfs64
940 data8 0 // mbind
941 data8 0 // get_mempolicy // 1260
942 data8 0 // set_mempolicy
943 data8 0 // mq_open
944 data8 0 // mq_unlink
945 data8 0 // mq_timedsend
946 data8 0 // mq_timedreceive // 1265
947 data8 0 // mq_notify
948 data8 0 // mq_getsetattr
949 data8 0 // kexec_load
950 data8 0 // vserver
951 data8 0 // waitid // 1270
952 data8 0 // add_key
953 data8 0 // request_key
954 data8 0 // keyctl
955 data8 0 // ioprio_set
956 data8 0 // ioprio_get // 1275
957 data8 0 // move_pages
958 data8 0 // inotify_init
959 data8 0 // inotify_add_watch
960 data8 0 // inotify_rm_watch
961 data8 0 // migrate_pages // 1280
962 data8 0 // openat
963 data8 0 // mkdirat
964 data8 0 // mknodat
965 data8 0 // fchownat
966 data8 0 // futimesat // 1285
967 data8 0 // newfstatat
968 data8 0 // unlinkat
969 data8 0 // renameat
970 data8 0 // linkat
971 data8 0 // symlinkat // 1290
972 data8 0 // readlinkat
973 data8 0 // fchmodat
974 data8 0 // faccessat
975 data8 0
976 data8 0 // 1295
977 data8 0 // unshare
978 data8 0 // splice
979 data8 0 // set_robust_list
980 data8 0 // get_robust_list
981 data8 0 // sync_file_range // 1300
982 data8 0 // tee
983 data8 0 // vmsplice
984 data8 0
985 data8 fsys_getcpu // getcpu // 1304
881 986
882 // fill in zeros for the remaining entries 987 // fill in zeros for the remaining entries
883 .zero: 988 .zero:
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index d6aab40c6416..dcfbf3e7a9ef 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -446,7 +446,7 @@ iosapic_end_level_irq (unsigned int irq)
446#define iosapic_disable_level_irq mask_irq 446#define iosapic_disable_level_irq mask_irq
447#define iosapic_ack_level_irq nop 447#define iosapic_ack_level_irq nop
448 448
449struct hw_interrupt_type irq_type_iosapic_level = { 449struct irq_chip irq_type_iosapic_level = {
450 .name = "IO-SAPIC-level", 450 .name = "IO-SAPIC-level",
451 .startup = iosapic_startup_level_irq, 451 .startup = iosapic_startup_level_irq,
452 .shutdown = iosapic_shutdown_level_irq, 452 .shutdown = iosapic_shutdown_level_irq,
@@ -454,6 +454,8 @@ struct hw_interrupt_type irq_type_iosapic_level = {
454 .disable = iosapic_disable_level_irq, 454 .disable = iosapic_disable_level_irq,
455 .ack = iosapic_ack_level_irq, 455 .ack = iosapic_ack_level_irq,
456 .end = iosapic_end_level_irq, 456 .end = iosapic_end_level_irq,
457 .mask = mask_irq,
458 .unmask = unmask_irq,
457 .set_affinity = iosapic_set_affinity 459 .set_affinity = iosapic_set_affinity
458}; 460};
459 461
@@ -493,7 +495,7 @@ iosapic_ack_edge_irq (unsigned int irq)
493#define iosapic_disable_edge_irq nop 495#define iosapic_disable_edge_irq nop
494#define iosapic_end_edge_irq nop 496#define iosapic_end_edge_irq nop
495 497
496struct hw_interrupt_type irq_type_iosapic_edge = { 498struct irq_chip irq_type_iosapic_edge = {
497 .name = "IO-SAPIC-edge", 499 .name = "IO-SAPIC-edge",
498 .startup = iosapic_startup_edge_irq, 500 .startup = iosapic_startup_edge_irq,
499 .shutdown = iosapic_disable_edge_irq, 501 .shutdown = iosapic_disable_edge_irq,
@@ -501,6 +503,8 @@ struct hw_interrupt_type irq_type_iosapic_edge = {
501 .disable = iosapic_disable_edge_irq, 503 .disable = iosapic_disable_edge_irq,
502 .ack = iosapic_ack_edge_irq, 504 .ack = iosapic_ack_edge_irq,
503 .end = iosapic_end_edge_irq, 505 .end = iosapic_end_edge_irq,
506 .mask = mask_irq,
507 .unmask = unmask_irq,
504 .set_affinity = iosapic_set_affinity 508 .set_affinity = iosapic_set_affinity
505}; 509};
506 510
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 7d6fe65c93f4..339e8a54c2f1 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -91,8 +91,6 @@ static struct resource code_resource = {
91 .name = "Kernel code", 91 .name = "Kernel code",
92 .flags = IORESOURCE_BUSY | IORESOURCE_MEM 92 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
93}; 93};
94extern void efi_initialize_iomem_resources(struct resource *,
95 struct resource *);
96extern char _text[], _end[], _etext[]; 94extern char _text[], _end[], _etext[];
97 95
98unsigned long ia64_max_cacheline_size; 96unsigned long ia64_max_cacheline_size;
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index 8c331ca6e5c9..c6216f454ffb 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -53,12 +53,15 @@ sal_ioif_init(u64 *result)
53} 53}
54 54
55/* 55/*
56 * sn_hubdev_add - The 'add' function of the acpi_sn_hubdev_driver. 56 * sn_acpi_hubdev_init() - This function is called by acpi_ns_get_device_callback()
57 * Called for every "SGIHUB" or "SGITIO" device defined 57 * for all SGIHUB and SGITIO acpi devices defined in the
58 * in the ACPI namespace. 58 * DSDT. It obtains the hubdev_info pointer from the
59 * ACPI vendor resource, which the PROM setup, and sets up the
60 * hubdev_info in the pda.
59 */ 61 */
60static int __init 62
61sn_hubdev_add(struct acpi_device *device) 63static acpi_status __init
64sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret)
62{ 65{
63 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 66 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
64 u64 addr; 67 u64 addr;
@@ -67,18 +70,19 @@ sn_hubdev_add(struct acpi_device *device)
67 int i; 70 int i;
68 u64 nasid; 71 u64 nasid;
69 struct acpi_resource *resource; 72 struct acpi_resource *resource;
70 int ret = 0;
71 acpi_status status; 73 acpi_status status;
72 struct acpi_resource_vendor_typed *vendor; 74 struct acpi_resource_vendor_typed *vendor;
73 extern void sn_common_hubdev_init(struct hubdev_info *); 75 extern void sn_common_hubdev_init(struct hubdev_info *);
74 76
75 status = acpi_get_vendor_resource(device->handle, METHOD_NAME__CRS, 77 status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
76 &sn_uuid, &buffer); 78 &sn_uuid, &buffer);
77 if (ACPI_FAILURE(status)) { 79 if (ACPI_FAILURE(status)) {
78 printk(KERN_ERR 80 printk(KERN_ERR
79 "sn_hubdev_add: acpi_get_vendor_resource() failed: %d\n", 81 "sn_acpi_hubdev_init: acpi_get_vendor_resource() "
80 status); 82 "(0x%x) failed for: ", status);
81 return 1; 83 acpi_ns_print_node_pathname(handle, NULL);
84 printk("\n");
85 return AE_OK; /* Continue walking namespace */
82 } 86 }
83 87
84 resource = buffer.pointer; 88 resource = buffer.pointer;
@@ -86,9 +90,10 @@ sn_hubdev_add(struct acpi_device *device)
86 if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != 90 if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) !=
87 sizeof(struct hubdev_info *)) { 91 sizeof(struct hubdev_info *)) {
88 printk(KERN_ERR 92 printk(KERN_ERR
89 "sn_hubdev_add: Invalid vendor data length: %d\n", 93 "sn_acpi_hubdev_init: Invalid vendor data length: %d for: ",
90 vendor->byte_length); 94 vendor->byte_length);
91 ret = 1; 95 acpi_ns_print_node_pathname(handle, NULL);
96 printk("\n");
92 goto exit; 97 goto exit;
93 } 98 }
94 99
@@ -103,7 +108,7 @@ sn_hubdev_add(struct acpi_device *device)
103 108
104exit: 109exit:
105 kfree(buffer.pointer); 110 kfree(buffer.pointer);
106 return ret; 111 return AE_OK; /* Continue walking namespace */
107} 112}
108 113
109/* 114/*
@@ -441,14 +446,6 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
441 446
442EXPORT_SYMBOL(sn_acpi_slot_fixup); 447EXPORT_SYMBOL(sn_acpi_slot_fixup);
443 448
444static struct acpi_driver acpi_sn_hubdev_driver = {
445 .name = "SGI HUBDEV Driver",
446 .ids = "SGIHUB,SGITIO",
447 .ops = {
448 .add = sn_hubdev_add,
449 },
450};
451
452 449
453/* 450/*
454 * sn_acpi_bus_fixup - Perform SN specific setup of software structs 451 * sn_acpi_bus_fixup - Perform SN specific setup of software structs
@@ -492,7 +489,10 @@ sn_io_acpi_init(void)
492 /* SN Altix does not follow the IOSAPIC IRQ routing model */ 489 /* SN Altix does not follow the IOSAPIC IRQ routing model */
493 acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; 490 acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
494 491
495 acpi_bus_register_driver(&acpi_sn_hubdev_driver); 492 /* Setup hubdev_info for all SGIHUB/SGITIO devices */
493 acpi_get_devices("SGIHUB", sn_acpi_hubdev_init, NULL, NULL);
494 acpi_get_devices("SGITIO", sn_acpi_hubdev_init, NULL, NULL);
495
496 status = sal_ioif_init(&result); 496 status = sal_ioif_init(&result);
497 if (status || result) 497 if (status || result)
498 panic("sal_ioif_init failed: [%lx] %s\n", 498 panic("sal_ioif_init failed: [%lx] %s\n",
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 8c5bee01eaa2..8d2a1bfbfe7c 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -205,7 +205,17 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
205 (void)sn_retarget_vector(sn_irq_info, nasid, slice); 205 (void)sn_retarget_vector(sn_irq_info, nasid, slice);
206} 206}
207 207
208struct hw_interrupt_type irq_type_sn = { 208static void
209sn_mask_irq(unsigned int irq)
210{
211}
212
213static void
214sn_unmask_irq(unsigned int irq)
215{
216}
217
218struct irq_chip irq_type_sn = {
209 .name = "SN hub", 219 .name = "SN hub",
210 .startup = sn_startup_irq, 220 .startup = sn_startup_irq,
211 .shutdown = sn_shutdown_irq, 221 .shutdown = sn_shutdown_irq,
@@ -213,6 +223,8 @@ struct hw_interrupt_type irq_type_sn = {
213 .disable = sn_disable_irq, 223 .disable = sn_disable_irq,
214 .ack = sn_ack_irq, 224 .ack = sn_ack_irq,
215 .end = sn_end_irq, 225 .end = sn_end_irq,
226 .mask = sn_mask_irq,
227 .unmask = sn_unmask_irq,
216 .set_affinity = sn_set_affinity_irq 228 .set_affinity = sn_set_affinity_irq
217}; 229};
218 230
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 8571e52c2efd..bd5373d593e1 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -397,6 +397,8 @@ void __init sn_setup(char **cmdline_p)
397 ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE); 397 ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE);
398 ia64_sn_set_os_feature(OSF_ACPI_ENABLE); 398 ia64_sn_set_os_feature(OSF_ACPI_ENABLE);
399 399
400 /* Load the new DSDT and SSDT tables into the global table list. */
401 acpi_table_init();
400 402
401#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) 403#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
402 /* 404 /*
diff --git a/arch/mips/arc/init.c b/arch/mips/arc/init.c
index 0ac8f42d3752..e2f75b13312f 100644
--- a/arch/mips/arc/init.c
+++ b/arch/mips/arc/init.c
@@ -23,16 +23,16 @@ LONG *_prom_argv, *_prom_envp;
23void __init prom_init(void) 23void __init prom_init(void)
24{ 24{
25 PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK; 25 PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK;
26
26 romvec = ROMVECTOR; 27 romvec = ROMVECTOR;
27 ULONG cnt;
28 CHAR c;
29 28
30 prom_argc = fw_arg0; 29 prom_argc = fw_arg0;
31 _prom_argv = (LONG *) fw_arg1; 30 _prom_argv = (LONG *) fw_arg1;
32 _prom_envp = (LONG *) fw_arg2; 31 _prom_envp = (LONG *) fw_arg2;
33 32
34 if (pb->magic != 0x53435241) { 33 if (pb->magic != 0x53435241) {
35 printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n", pb->magic); 34 printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n",
35 (unsigned long) pb->magic);
36 while(1) 36 while(1)
37 ; 37 ;
38 } 38 }
diff --git a/arch/mips/dec/prom/init.c b/arch/mips/dec/prom/init.c
index bf2858071f1f..a217aafe59f6 100644
--- a/arch/mips/dec/prom/init.c
+++ b/arch/mips/dec/prom/init.c
@@ -103,9 +103,6 @@ void __init prom_init(void)
103 if (prom_is_rex(magic)) 103 if (prom_is_rex(magic))
104 rex_clear_cache(); 104 rex_clear_cache();
105 105
106 /* Register the early console. */
107 register_prom_console();
108
109 /* Were we compiled with the right CPU option? */ 106 /* Were we compiled with the right CPU option? */
110#if defined(CONFIG_CPU_R3000) 107#if defined(CONFIG_CPU_R3000)
111 if ((current_cpu_data.cputype == CPU_R4000SC) || 108 if ((current_cpu_data.cputype == CPU_R4000SC) ||
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 30d433f14f93..1df544c1f966 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -564,49 +564,3 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs)
564 return do_fork(clone_flags, newsp, &regs, 0, 564 return do_fork(clone_flags, newsp, &regs, 0,
565 parent_tidptr, child_tidptr); 565 parent_tidptr, child_tidptr);
566} 566}
567
568/*
569 * Implement the event wait interface for the eventpoll file. It is the kernel
570 * part of the user space epoll_pwait(2).
571 */
572asmlinkage long compat_sys_epoll_pwait(int epfd,
573 struct epoll_event __user *events, int maxevents, int timeout,
574 const compat_sigset_t __user *sigmask, size_t sigsetsize)
575{
576 int error;
577 sigset_t ksigmask, sigsaved;
578
579 /*
580 * If the caller wants a certain signal mask to be set during the wait,
581 * we apply it here.
582 */
583 if (sigmask) {
584 if (sigsetsize != sizeof(sigset_t))
585 return -EINVAL;
586 if (!access_ok(VERIFY_READ, sigmask, sizeof(ksigmask)))
587 return -EFAULT;
588 if (__copy_conv_sigset_from_user(&ksigmask, sigmask))
589 return -EFAULT;
590 sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
591 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
592 }
593
594 error = sys_epoll_wait(epfd, events, maxevents, timeout);
595
596 /*
597 * If we changed the signal mask, we need to restore the original one.
598 * In case we've got a signal while waiting, we do not restore the
599 * signal mask yet, and we allow do_signal() to deliver the signal on
600 * the way back to userspace, before the signal mask is restored.
601 */
602 if (sigmask) {
603 if (error == -EINTR) {
604 memcpy(&current->saved_sigmask, &sigsaved,
605 sizeof(sigsaved));
606 set_thread_flag(TIF_RESTORE_SIGMASK);
607 } else
608 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
609 }
610
611 return error;
612}
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index 67dac6204b6d..bdf24a7b5494 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -1,31 +1,35 @@
1config SIBYTE_SB1250 1config SIBYTE_SB1250
2 bool 2 bool
3 select HW_HAS_PCI 3 select HW_HAS_PCI
4 select SIBYTE_HAS_LDT 4 select SIBYTE_ENABLE_LDT_IF_PCI
5 select SIBYTE_SB1xxx_SOC 5 select SIBYTE_SB1xxx_SOC
6 select SYS_SUPPORTS_SMP 6 select SYS_SUPPORTS_SMP
7 7
8config SIBYTE_BCM1120 8config SIBYTE_BCM1120
9 bool 9 bool
10 select SIBYTE_BCM112X 10 select SIBYTE_BCM112X
11 select SIBYTE_HAS_ZBUS_PROFILING
11 select SIBYTE_SB1xxx_SOC 12 select SIBYTE_SB1xxx_SOC
12 13
13config SIBYTE_BCM1125 14config SIBYTE_BCM1125
14 bool 15 bool
15 select HW_HAS_PCI 16 select HW_HAS_PCI
16 select SIBYTE_BCM112X 17 select SIBYTE_BCM112X
18 select SIBYTE_HAS_ZBUS_PROFILING
17 select SIBYTE_SB1xxx_SOC 19 select SIBYTE_SB1xxx_SOC
18 20
19config SIBYTE_BCM1125H 21config SIBYTE_BCM1125H
20 bool 22 bool
21 select HW_HAS_PCI 23 select HW_HAS_PCI
22 select SIBYTE_BCM112X 24 select SIBYTE_BCM112X
23 select SIBYTE_HAS_LDT 25 select SIBYTE_ENABLE_LDT_IF_PCI
26 select SIBYTE_HAS_ZBUS_PROFILING
24 select SIBYTE_SB1xxx_SOC 27 select SIBYTE_SB1xxx_SOC
25 28
26config SIBYTE_BCM112X 29config SIBYTE_BCM112X
27 bool 30 bool
28 select SIBYTE_SB1xxx_SOC 31 select SIBYTE_SB1xxx_SOC
32 select SIBYTE_HAS_ZBUS_PROFILING
29 33
30config SIBYTE_BCM1x80 34config SIBYTE_BCM1x80
31 bool 35 bool
@@ -37,6 +41,7 @@ config SIBYTE_BCM1x55
37 bool 41 bool
38 select HW_HAS_PCI 42 select HW_HAS_PCI
39 select SIBYTE_SB1xxx_SOC 43 select SIBYTE_SB1xxx_SOC
44 select SIBYTE_HAS_ZBUS_PROFILING
40 select SYS_SUPPORTS_SMP 45 select SYS_SUPPORTS_SMP
41 46
42config SIBYTE_SB1xxx_SOC 47config SIBYTE_SB1xxx_SOC
@@ -95,8 +100,10 @@ config CPU_SB1_PASS_2
95 100
96config SIBYTE_HAS_LDT 101config SIBYTE_HAS_LDT
97 bool 102 bool
98 depends on PCI && (SIBYTE_SB1250 || SIBYTE_BCM1125H) 103
99 default y 104config SIBYTE_ENABLE_LDT_IF_PCI
105 bool
106 select SIBYTE_HAS_LDT if PCI
100 107
101config SIMULATION 108config SIMULATION
102 bool "Running under simulation" 109 bool "Running under simulation"
@@ -162,5 +169,8 @@ config SIBYTE_SB1250_PROF
162 depends on SIBYTE_SB1xxx_SOC 169 depends on SIBYTE_SB1xxx_SOC
163 170
164config SIBYTE_TBPROF 171config SIBYTE_TBPROF
165 bool "Support for ZBbus profiling" 172 tristate "Support for ZBbus profiling"
166 depends on SIBYTE_SB1xxx_SOC 173 depends on SIBYTE_HAS_ZBUS_PROFILING
174
175config SIBYTE_HAS_ZBUS_PROFILING
176 bool
diff --git a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
index 212547c57310..ea0ca131a3cf 100644
--- a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
+++ b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or 2 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 3 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2 4 * as published by the Free Software Foundation; either version 2
@@ -14,10 +12,16 @@
14 * You should have received a copy of the GNU General Public License 12 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software 13 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
17 * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org>
18 * Copyright (C) 2007 MIPS Technologies, Inc.
19 * written by Ralf Baechle <ralf@linux-mips.org>
17 */ 20 */
18 21
19#define SBPROF_TB_DEBUG 0 22#undef DEBUG
20 23
24#include <linux/device.h>
21#include <linux/module.h> 25#include <linux/module.h>
22#include <linux/kernel.h> 26#include <linux/kernel.h>
23#include <linux/types.h> 27#include <linux/types.h>
@@ -27,24 +31,98 @@
27#include <linux/vmalloc.h> 31#include <linux/vmalloc.h>
28#include <linux/fs.h> 32#include <linux/fs.h>
29#include <linux/errno.h> 33#include <linux/errno.h>
30#include <linux/reboot.h> 34#include <linux/types.h>
31#include <linux/smp_lock.h>
32#include <linux/wait.h> 35#include <linux/wait.h>
33#include <asm/uaccess.h> 36
34#include <asm/io.h> 37#include <asm/io.h>
35#include <asm/sibyte/sb1250.h> 38#include <asm/sibyte/sb1250.h>
36#include <asm/sibyte/sb1250_regs.h> 39#include <asm/sibyte/sb1250_regs.h>
37#include <asm/sibyte/sb1250_scd.h> 40#include <asm/sibyte/sb1250_scd.h>
38#include <asm/sibyte/sb1250_int.h> 41#include <asm/sibyte/sb1250_int.h>
39#include <asm/sibyte/trace_prof.h> 42#include <asm/system.h>
43#include <asm/uaccess.h>
40 44
41#define DEVNAME "bcm1250_tbprof" 45#define SBPROF_TB_MAJOR 240
46
47typedef u64 tb_sample_t[6*256];
48
49enum open_status {
50 SB_CLOSED,
51 SB_OPENING,
52 SB_OPEN
53};
54
55struct sbprof_tb {
56 wait_queue_head_t tb_sync;
57 wait_queue_head_t tb_read;
58 struct mutex lock;
59 enum open_status open;
60 tb_sample_t *sbprof_tbbuf;
61 int next_tb_sample;
62
63 volatile int tb_enable;
64 volatile int tb_armed;
65
66};
42 67
43static struct sbprof_tb sbp; 68static struct sbprof_tb sbp;
44 69
70#define MAX_SAMPLE_BYTES (24*1024*1024)
71#define MAX_TBSAMPLE_BYTES (12*1024*1024)
72
73#define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t))
74#define TB_SAMPLE_SIZE (sizeof(tb_sample_t))
75#define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE)
76
77/* ioctls */
78#define SBPROF_ZBSTART _IOW('s', 0, int)
79#define SBPROF_ZBSTOP _IOW('s', 1, int)
80#define SBPROF_ZBWAITFULL _IOW('s', 2, int)
81
82/*
83 * Routines for using 40-bit SCD cycle counter
84 *
85 * Client responsible for either handling interrupts or making sure
86 * the cycles counter never saturates, e.g., by doing
87 * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs.
88 */
89
90/*
91 * Configures SCD counter 0 to count ZCLKs starting from val;
92 * Configures SCD counters1,2,3 to count nothing.
93 * Must not be called while gathering ZBbus profiles.
94 */
95
96#define zclk_timer_init(val) \
97 __asm__ __volatile__ (".set push;" \
98 ".set mips64;" \
99 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
100 "sd %0, 0x10($8);" /* write val to counter0 */ \
101 "sd %1, 0($8);" /* config counter0 for zclks*/ \
102 ".set pop" \
103 : /* no outputs */ \
104 /* enable, counter0 */ \
105 : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \
106 : /* modifies */ "$8" )
107
108
109/* Reads SCD counter 0 and puts result in value
110 unsigned long long val; */
111#define zclk_get(val) \
112 __asm__ __volatile__ (".set push;" \
113 ".set mips64;" \
114 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
115 "ld %0, 0x10($8);" /* write val to counter0 */ \
116 ".set pop" \
117 : /* outputs */ "=r"(val) \
118 : /* inputs */ \
119 : /* modifies */ "$8" )
120
121#define DEVNAME "bcm1250_tbprof"
122
45#define TB_FULL (sbp.next_tb_sample == MAX_TB_SAMPLES) 123#define TB_FULL (sbp.next_tb_sample == MAX_TB_SAMPLES)
46 124
47/************************************************************************ 125/*
48 * Support for ZBbus sampling using the trace buffer 126 * Support for ZBbus sampling using the trace buffer
49 * 127 *
50 * We use the SCD performance counter interrupt, caused by a Zclk counter 128 * We use the SCD performance counter interrupt, caused by a Zclk counter
@@ -54,30 +132,36 @@ static struct sbprof_tb sbp;
54 * overflow. 132 * overflow.
55 * 133 *
56 * We map the interrupt for trace_buffer_freeze to handle it on CPU 0. 134 * We map the interrupt for trace_buffer_freeze to handle it on CPU 0.
57 * 135 */
58 ************************************************************************/
59 136
60static u_int64_t tb_period; 137static u64 tb_period;
61 138
62static void arm_tb(void) 139static void arm_tb(void)
63{ 140{
64 u_int64_t scdperfcnt; 141 u64 scdperfcnt;
65 u_int64_t next = (1ULL << 40) - tb_period; 142 u64 next = (1ULL << 40) - tb_period;
66 u_int64_t tb_options = M_SCD_TRACE_CFG_FREEZE_FULL; 143 u64 tb_options = M_SCD_TRACE_CFG_FREEZE_FULL;
67 /* Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to 144
68 trigger start of trace. XXX vary sampling period */ 145 /*
146 * Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to trigger
147 *start of trace. XXX vary sampling period
148 */
69 __raw_writeq(0, IOADDR(A_SCD_PERF_CNT_1)); 149 __raw_writeq(0, IOADDR(A_SCD_PERF_CNT_1));
70 scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); 150 scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG));
71 /* Unfortunately, in Pass 2 we must clear all counters to knock down 151
72 a previous interrupt request. This means that bus profiling 152 /*
73 requires ALL of the SCD perf counters. */ 153 * Unfortunately, in Pass 2 we must clear all counters to knock down a
154 * previous interrupt request. This means that bus profiling requires
155 * ALL of the SCD perf counters.
156 */
74 __raw_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) | 157 __raw_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) |
75 // keep counters 0,2,3 as is 158 /* keep counters 0,2,3 as is */
76 M_SPC_CFG_ENABLE | // enable counting 159 M_SPC_CFG_ENABLE | /* enable counting */
77 M_SPC_CFG_CLEAR | // clear all counters 160 M_SPC_CFG_CLEAR | /* clear all counters */
78 V_SPC_CFG_SRC1(1), // counter 1 counts cycles 161 V_SPC_CFG_SRC1(1), /* counter 1 counts cycles */
79 IOADDR(A_SCD_PERF_CNT_CFG)); 162 IOADDR(A_SCD_PERF_CNT_CFG));
80 __raw_writeq(next, IOADDR(A_SCD_PERF_CNT_1)); 163 __raw_writeq(next, IOADDR(A_SCD_PERF_CNT_1));
164
81 /* Reset the trace buffer */ 165 /* Reset the trace buffer */
82 __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); 166 __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG));
83#if 0 && defined(M_SCD_TRACE_CFG_FORCECNT) 167#if 0 && defined(M_SCD_TRACE_CFG_FORCECNT)
@@ -91,43 +175,45 @@ static void arm_tb(void)
91static irqreturn_t sbprof_tb_intr(int irq, void *dev_id) 175static irqreturn_t sbprof_tb_intr(int irq, void *dev_id)
92{ 176{
93 int i; 177 int i;
94 DBG(printk(DEVNAME ": tb_intr\n")); 178
179 pr_debug(DEVNAME ": tb_intr\n");
180
95 if (sbp.next_tb_sample < MAX_TB_SAMPLES) { 181 if (sbp.next_tb_sample < MAX_TB_SAMPLES) {
96 /* XXX should use XKPHYS to make writes bypass L2 */ 182 /* XXX should use XKPHYS to make writes bypass L2 */
97 u_int64_t *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++]; 183 u64 *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++];
98 /* Read out trace */ 184 /* Read out trace */
99 __raw_writeq(M_SCD_TRACE_CFG_START_READ, 185 __raw_writeq(M_SCD_TRACE_CFG_START_READ,
100 IOADDR(A_SCD_TRACE_CFG)); 186 IOADDR(A_SCD_TRACE_CFG));
101 __asm__ __volatile__ ("sync" : : : "memory"); 187 __asm__ __volatile__ ("sync" : : : "memory");
102 /* Loop runs backwards because bundles are read out in reverse order */ 188 /* Loop runs backwards because bundles are read out in reverse order */
103 for (i = 256 * 6; i > 0; i -= 6) { 189 for (i = 256 * 6; i > 0; i -= 6) {
104 // Subscripts decrease to put bundle in the order 190 /* Subscripts decrease to put bundle in the order */
105 // t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi 191 /* t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi */
106 p[i - 1] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 192 p[i - 1] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
107 // read t2 hi 193 /* read t2 hi */
108 p[i - 2] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 194 p[i - 2] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
109 // read t2 lo 195 /* read t2 lo */
110 p[i - 3] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 196 p[i - 3] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
111 // read t1 hi 197 /* read t1 hi */
112 p[i - 4] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 198 p[i - 4] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
113 // read t1 lo 199 /* read t1 lo */
114 p[i - 5] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 200 p[i - 5] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
115 // read t0 hi 201 /* read t0 hi */
116 p[i - 6] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 202 p[i - 6] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
117 // read t0 lo 203 /* read t0 lo */
118 } 204 }
119 if (!sbp.tb_enable) { 205 if (!sbp.tb_enable) {
120 DBG(printk(DEVNAME ": tb_intr shutdown\n")); 206 pr_debug(DEVNAME ": tb_intr shutdown\n");
121 __raw_writeq(M_SCD_TRACE_CFG_RESET, 207 __raw_writeq(M_SCD_TRACE_CFG_RESET,
122 IOADDR(A_SCD_TRACE_CFG)); 208 IOADDR(A_SCD_TRACE_CFG));
123 sbp.tb_armed = 0; 209 sbp.tb_armed = 0;
124 wake_up(&sbp.tb_sync); 210 wake_up(&sbp.tb_sync);
125 } else { 211 } else {
126 arm_tb(); // knock down current interrupt and get another one later 212 arm_tb(); /* knock down current interrupt and get another one later */
127 } 213 }
128 } else { 214 } else {
129 /* No more trace buffer samples */ 215 /* No more trace buffer samples */
130 DBG(printk(DEVNAME ": tb_intr full\n")); 216 pr_debug(DEVNAME ": tb_intr full\n");
131 __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); 217 __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG));
132 sbp.tb_armed = 0; 218 sbp.tb_armed = 0;
133 if (!sbp.tb_enable) { 219 if (!sbp.tb_enable) {
@@ -135,6 +221,7 @@ static irqreturn_t sbprof_tb_intr(int irq, void *dev_id)
135 } 221 }
136 wake_up(&sbp.tb_read); 222 wake_up(&sbp.tb_read);
137 } 223 }
224
138 return IRQ_HANDLED; 225 return IRQ_HANDLED;
139} 226}
140 227
@@ -144,23 +231,30 @@ static irqreturn_t sbprof_pc_intr(int irq, void *dev_id)
144 return IRQ_NONE; 231 return IRQ_NONE;
145} 232}
146 233
147int sbprof_zbprof_start(struct file *filp) 234/*
235 * Requires: Already called zclk_timer_init with a value that won't
236 * saturate 40 bits. No subsequent use of SCD performance counters
237 * or trace buffer.
238 */
239
240static int sbprof_zbprof_start(struct file *filp)
148{ 241{
149 u_int64_t scdperfcnt; 242 u64 scdperfcnt;
243 int err;
150 244
151 if (sbp.tb_enable) 245 if (xchg(&sbp.tb_enable, 1))
152 return -EBUSY; 246 return -EBUSY;
153 247
154 DBG(printk(DEVNAME ": starting\n")); 248 pr_debug(DEVNAME ": starting\n");
155 249
156 sbp.tb_enable = 1;
157 sbp.next_tb_sample = 0; 250 sbp.next_tb_sample = 0;
158 filp->f_pos = 0; 251 filp->f_pos = 0;
159 252
160 if (request_irq 253 err = request_irq(K_INT_TRACE_FREEZE, sbprof_tb_intr, 0,
161 (K_INT_TRACE_FREEZE, sbprof_tb_intr, 0, DEVNAME " trace freeze", &sbp)) { 254 DEVNAME " trace freeze", &sbp);
255 if (err)
162 return -EBUSY; 256 return -EBUSY;
163 } 257
164 /* Make sure there isn't a perf-cnt interrupt waiting */ 258 /* Make sure there isn't a perf-cnt interrupt waiting */
165 scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); 259 scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG));
166 /* Disable and clear counters, override SRC_1 */ 260 /* Disable and clear counters, override SRC_1 */
@@ -168,18 +262,21 @@ int sbprof_zbprof_start(struct file *filp)
168 M_SPC_CFG_ENABLE | M_SPC_CFG_CLEAR | V_SPC_CFG_SRC1(1), 262 M_SPC_CFG_ENABLE | M_SPC_CFG_CLEAR | V_SPC_CFG_SRC1(1),
169 IOADDR(A_SCD_PERF_CNT_CFG)); 263 IOADDR(A_SCD_PERF_CNT_CFG));
170 264
171 /* We grab this interrupt to prevent others from trying to use 265 /*
172 it, even though we don't want to service the interrupts 266 * We grab this interrupt to prevent others from trying to use it, even
173 (they only feed into the trace-on-interrupt mechanism) */ 267 * though we don't want to service the interrupts (they only feed into
174 if (request_irq 268 * the trace-on-interrupt mechanism)
175 (K_INT_PERF_CNT, sbprof_pc_intr, 0, DEVNAME " scd perfcnt", &sbp)) { 269 */
176 free_irq(K_INT_TRACE_FREEZE, &sbp); 270 err = request_irq(K_INT_PERF_CNT, sbprof_pc_intr, 0,
177 return -EBUSY; 271 DEVNAME " scd perfcnt", &sbp);
178 } 272 if (err)
179 273 goto out_free_irq;
180 /* I need the core to mask these, but the interrupt mapper to 274
181 pass them through. I am exploiting my knowledge that 275 /*
182 cp0_status masks out IP[5]. krw */ 276 * I need the core to mask these, but the interrupt mapper to pass them
277 * through. I am exploiting my knowledge that cp0_status masks out
278 * IP[5]. krw
279 */
183 __raw_writeq(K_INT_MAP_I3, 280 __raw_writeq(K_INT_MAP_I3,
184 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) + 281 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) +
185 (K_INT_PERF_CNT << 3))); 282 (K_INT_PERF_CNT << 3)));
@@ -201,7 +298,7 @@ int sbprof_zbprof_start(struct file *filp)
201 __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3)); 298 __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3));
202 299
203 /* Initialize Trace Event 0-7 */ 300 /* Initialize Trace Event 0-7 */
204 // when interrupt 301 /* when interrupt */
205 __raw_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0)); 302 __raw_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0));
206 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1)); 303 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1));
207 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2)); 304 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2));
@@ -212,10 +309,10 @@ int sbprof_zbprof_start(struct file *filp)
212 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7)); 309 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7));
213 310
214 /* Initialize Trace Sequence 0-7 */ 311 /* Initialize Trace Sequence 0-7 */
215 // Start on event 0 (interrupt) 312 /* Start on event 0 (interrupt) */
216 __raw_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff, 313 __raw_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff,
217 IOADDR(A_SCD_TRACE_SEQUENCE_0)); 314 IOADDR(A_SCD_TRACE_SEQUENCE_0));
218 // dsamp when d used | asamp when a used 315 /* dsamp when d used | asamp when a used */
219 __raw_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE | 316 __raw_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE |
220 K_SCD_TRSEQ_TRIGGER_ALL, 317 K_SCD_TRSEQ_TRIGGER_ALL,
221 IOADDR(A_SCD_TRACE_SEQUENCE_1)); 318 IOADDR(A_SCD_TRACE_SEQUENCE_1));
@@ -232,33 +329,41 @@ int sbprof_zbprof_start(struct file *filp)
232 329
233 arm_tb(); 330 arm_tb();
234 331
235 DBG(printk(DEVNAME ": done starting\n")); 332 pr_debug(DEVNAME ": done starting\n");
236 333
237 return 0; 334 return 0;
335
336out_free_irq:
337 free_irq(K_INT_TRACE_FREEZE, &sbp);
338
339 return err;
238} 340}
239 341
240int sbprof_zbprof_stop(void) 342static int sbprof_zbprof_stop(void)
241{ 343{
242 DEFINE_WAIT(wait); 344 int err;
243 DBG(printk(DEVNAME ": stopping\n")); 345
346 pr_debug(DEVNAME ": stopping\n");
244 347
245 if (sbp.tb_enable) { 348 if (sbp.tb_enable) {
349 /*
350 * XXXKW there is a window here where the intr handler may run,
351 * see the disable, and do the wake_up before this sleep
352 * happens.
353 */
354 pr_debug(DEVNAME ": wait for disarm\n");
355 err = wait_event_interruptible(sbp.tb_sync, !sbp.tb_armed);
356 pr_debug(DEVNAME ": disarm complete, stat %d\n", err);
357
358 if (err)
359 return err;
360
246 sbp.tb_enable = 0; 361 sbp.tb_enable = 0;
247 /* XXXKW there is a window here where the intr handler
248 may run, see the disable, and do the wake_up before
249 this sleep happens. */
250 if (sbp.tb_armed) {
251 DBG(printk(DEVNAME ": wait for disarm\n"));
252 prepare_to_wait(&sbp.tb_sync, &wait, TASK_INTERRUPTIBLE);
253 schedule();
254 finish_wait(&sbp.tb_sync, &wait);
255 DBG(printk(DEVNAME ": disarm complete\n"));
256 }
257 free_irq(K_INT_TRACE_FREEZE, &sbp); 362 free_irq(K_INT_TRACE_FREEZE, &sbp);
258 free_irq(K_INT_PERF_CNT, &sbp); 363 free_irq(K_INT_PERF_CNT, &sbp);
259 } 364 }
260 365
261 DBG(printk(DEVNAME ": done stopping\n")); 366 pr_debug(DEVNAME ": done stopping\n");
262 367
263 return 0; 368 return 0;
264} 369}
@@ -268,42 +373,45 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp)
268 int minor; 373 int minor;
269 374
270 minor = iminor(inode); 375 minor = iminor(inode);
271 if (minor != 0) { 376 if (minor != 0)
272 return -ENODEV; 377 return -ENODEV;
273 } 378
274 if (sbp.open) { 379 if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED)
275 return -EBUSY; 380 return -EBUSY;
276 }
277 381
278 memset(&sbp, 0, sizeof(struct sbprof_tb)); 382 memset(&sbp, 0, sizeof(struct sbprof_tb));
383
279 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); 384 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES);
280 if (!sbp.sbprof_tbbuf) { 385 if (!sbp.sbprof_tbbuf)
281 return -ENOMEM; 386 return -ENOMEM;
282 } 387
283 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); 388 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES);
284 init_waitqueue_head(&sbp.tb_sync); 389 init_waitqueue_head(&sbp.tb_sync);
285 init_waitqueue_head(&sbp.tb_read); 390 init_waitqueue_head(&sbp.tb_read);
286 sbp.open = 1; 391 mutex_init(&sbp.lock);
392
393 sbp.open = SB_OPEN;
287 394
288 return 0; 395 return 0;
289} 396}
290 397
291static int sbprof_tb_release(struct inode *inode, struct file *filp) 398static int sbprof_tb_release(struct inode *inode, struct file *filp)
292{ 399{
293 int minor; 400 int minor = iminor(inode);
294 401
295 minor = iminor(inode); 402 if (minor != 0 || !sbp.open)
296 if (minor != 0 || !sbp.open) {
297 return -ENODEV; 403 return -ENODEV;
298 }
299 404
300 if (sbp.tb_armed || sbp.tb_enable) { 405 mutex_lock(&sbp.lock);
406
407 if (sbp.tb_armed || sbp.tb_enable)
301 sbprof_zbprof_stop(); 408 sbprof_zbprof_stop();
302 }
303 409
304 vfree(sbp.sbprof_tbbuf); 410 vfree(sbp.sbprof_tbbuf);
305 sbp.open = 0; 411 sbp.open = 0;
306 412
413 mutex_unlock(&sbp.lock);
414
307 return 0; 415 return 0;
308} 416}
309 417
@@ -311,21 +419,35 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf,
311 size_t size, loff_t *offp) 419 size_t size, loff_t *offp)
312{ 420{
313 int cur_sample, sample_off, cur_count, sample_left; 421 int cur_sample, sample_off, cur_count, sample_left;
314 char *src;
315 int count = 0;
316 char *dest = buf;
317 long cur_off = *offp; 422 long cur_off = *offp;
423 char *dest = buf;
424 int count = 0;
425 char *src;
426
427 if (!access_ok(VERIFY_WRITE, buf, size))
428 return -EFAULT;
429
430 mutex_lock(&sbp.lock);
318 431
319 count = 0; 432 count = 0;
320 cur_sample = cur_off / TB_SAMPLE_SIZE; 433 cur_sample = cur_off / TB_SAMPLE_SIZE;
321 sample_off = cur_off % TB_SAMPLE_SIZE; 434 sample_off = cur_off % TB_SAMPLE_SIZE;
322 sample_left = TB_SAMPLE_SIZE - sample_off; 435 sample_left = TB_SAMPLE_SIZE - sample_off;
436
323 while (size && (cur_sample < sbp.next_tb_sample)) { 437 while (size && (cur_sample < sbp.next_tb_sample)) {
438 int err;
439
324 cur_count = size < sample_left ? size : sample_left; 440 cur_count = size < sample_left ? size : sample_left;
325 src = (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off); 441 src = (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off);
326 copy_to_user(dest, src, cur_count); 442 err = __copy_to_user(dest, src, cur_count);
327 DBG(printk(DEVNAME ": read from sample %d, %d bytes\n", 443 if (err) {
328 cur_sample, cur_count)); 444 *offp = cur_off + cur_count - err;
445 mutex_unlock(&sbp.lock);
446 return err;
447 }
448
449 pr_debug(DEVNAME ": read from sample %d, %d bytes\n",
450 cur_sample, cur_count);
329 size -= cur_count; 451 size -= cur_count;
330 sample_left -= cur_count; 452 sample_left -= cur_count;
331 if (!sample_left) { 453 if (!sample_left) {
@@ -339,37 +461,43 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf,
339 dest += cur_count; 461 dest += cur_count;
340 count += cur_count; 462 count += cur_count;
341 } 463 }
464
342 *offp = cur_off; 465 *offp = cur_off;
466 mutex_unlock(&sbp.lock);
343 467
344 return count; 468 return count;
345} 469}
346 470
347static long sbprof_tb_ioctl(struct file *filp, 471static long sbprof_tb_ioctl(struct file *filp, unsigned int command,
348 unsigned int command, 472 unsigned long arg)
349 unsigned long arg)
350{ 473{
351 int error = 0; 474 int error = 0;
352 475
353 lock_kernel();
354 switch (command) { 476 switch (command) {
355 case SBPROF_ZBSTART: 477 case SBPROF_ZBSTART:
478 mutex_lock(&sbp.lock);
356 error = sbprof_zbprof_start(filp); 479 error = sbprof_zbprof_start(filp);
480 mutex_unlock(&sbp.lock);
357 break; 481 break;
482
358 case SBPROF_ZBSTOP: 483 case SBPROF_ZBSTOP:
484 mutex_lock(&sbp.lock);
359 error = sbprof_zbprof_stop(); 485 error = sbprof_zbprof_stop();
486 mutex_unlock(&sbp.lock);
360 break; 487 break;
488
361 case SBPROF_ZBWAITFULL: 489 case SBPROF_ZBWAITFULL:
362 DEFINE_WAIT(wait); 490 error = wait_event_interruptible(sbp.tb_read, TB_FULL);
363 prepare_to_wait(&sbp.tb_read, &wait, TASK_INTERRUPTIBLE); 491 if (error)
364 schedule(); 492 break;
365 finish_wait(&sbp.tb_read, &wait); 493
366 /* XXXKW check if interrupted? */ 494 error = put_user(TB_FULL, (int *) arg);
367 return put_user(TB_FULL, (int *) arg); 495 break;
496
368 default: 497 default:
369 error = -EINVAL; 498 error = -EINVAL;
370 break; 499 break;
371 } 500 }
372 unlock_kernel();
373 501
374 return error; 502 return error;
375} 503}
@@ -384,23 +512,60 @@ static const struct file_operations sbprof_tb_fops = {
384 .mmap = NULL, 512 .mmap = NULL,
385}; 513};
386 514
515static struct class *tb_class;
516static struct device *tb_dev;
517
387static int __init sbprof_tb_init(void) 518static int __init sbprof_tb_init(void)
388{ 519{
520 struct device *dev;
521 struct class *tbc;
522 int err;
523
389 if (register_chrdev(SBPROF_TB_MAJOR, DEVNAME, &sbprof_tb_fops)) { 524 if (register_chrdev(SBPROF_TB_MAJOR, DEVNAME, &sbprof_tb_fops)) {
390 printk(KERN_WARNING DEVNAME ": initialization failed (dev %d)\n", 525 printk(KERN_WARNING DEVNAME ": initialization failed (dev %d)\n",
391 SBPROF_TB_MAJOR); 526 SBPROF_TB_MAJOR);
392 return -EIO; 527 return -EIO;
393 } 528 }
529
530 tbc = class_create(THIS_MODULE, "sb_tracebuffer");
531 if (IS_ERR(tbc)) {
532 err = PTR_ERR(tbc);
533 goto out_chrdev;
534 }
535
536 tb_class = tbc;
537
538 dev = device_create(tbc, NULL, MKDEV(SBPROF_TB_MAJOR, 0), "tb");
539 if (IS_ERR(dev)) {
540 err = PTR_ERR(dev);
541 goto out_class;
542 }
543 tb_dev = dev;
544
394 sbp.open = 0; 545 sbp.open = 0;
395 tb_period = zbbus_mhz * 10000LL; 546 tb_period = zbbus_mhz * 10000LL;
396 printk(KERN_INFO DEVNAME ": initialized - tb_period = %lld\n", tb_period); 547 pr_info(DEVNAME ": initialized - tb_period = %lld\n", tb_period);
548
397 return 0; 549 return 0;
550
551out_class:
552 class_destroy(tb_class);
553out_chrdev:
554 unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME);
555
556 return err;
398} 557}
399 558
400static void __exit sbprof_tb_cleanup(void) 559static void __exit sbprof_tb_cleanup(void)
401{ 560{
561 device_destroy(tb_class, MKDEV(SBPROF_TB_MAJOR, 0));
402 unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME); 562 unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME);
563 class_destroy(tb_class);
403} 564}
404 565
405module_init(sbprof_tb_init); 566module_init(sbprof_tb_init);
406module_exit(sbprof_tb_cleanup); 567module_exit(sbprof_tb_cleanup);
568
569MODULE_ALIAS_CHARDEV_MAJOR(SBPROF_TB_MAJOR);
570MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
571MODULE_LICENSE("GPL");
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
index 1cb042eab720..87188f0f6fbe 100644
--- a/arch/mips/sibyte/sb1250/setup.c
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -16,6 +16,7 @@
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/module.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/reboot.h> 21#include <linux/reboot.h>
21#include <linux/string.h> 22#include <linux/string.h>
@@ -32,6 +33,7 @@ unsigned int soc_pass;
32unsigned int soc_type; 33unsigned int soc_type;
33unsigned int periph_rev; 34unsigned int periph_rev;
34unsigned int zbbus_mhz; 35unsigned int zbbus_mhz;
36EXPORT_SYMBOL(zbbus_mhz);
35 37
36static char *soc_str; 38static char *soc_str;
37static char *pass_str; 39static char *pass_str;
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 7ec4ac77c0fa..e4006dc087ca 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -225,6 +225,22 @@ static struct cpu_spec cpu_specs[] = {
225 .oprofile_type = PPC_OPROFILE_POWER4, 225 .oprofile_type = PPC_OPROFILE_POWER4,
226 .platform = "ppc970", 226 .platform = "ppc970",
227 }, 227 },
228 { /* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */
229 .pvr_mask = 0xffffffff,
230 .pvr_value = 0x00440100,
231 .cpu_name = "PPC970MP",
232 .cpu_features = CPU_FTRS_PPC970,
233 .cpu_user_features = COMMON_USER_POWER4 |
234 PPC_FEATURE_HAS_ALTIVEC_COMP,
235 .icache_bsize = 128,
236 .dcache_bsize = 128,
237 .num_pmcs = 8,
238 .cpu_setup = __setup_cpu_ppc970,
239 .cpu_restore = __restore_cpu_ppc970,
240 .oprofile_cpu_type = "ppc64/970MP",
241 .oprofile_type = PPC_OPROFILE_POWER4,
242 .platform = "ppc970",
243 },
228 { /* PPC970MP */ 244 { /* PPC970MP */
229 .pvr_mask = 0xffff0000, 245 .pvr_mask = 0xffff0000,
230 .pvr_value = 0x00440000, 246 .pvr_value = 0x00440000,
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index ea6fd552c7ea..91b443c9a488 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -916,7 +916,7 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw);
916static int of_irq_map_oldworld(struct device_node *device, int index, 916static int of_irq_map_oldworld(struct device_node *device, int index,
917 struct of_irq *out_irq) 917 struct of_irq *out_irq)
918{ 918{
919 const u32 *ints; 919 const u32 *ints = NULL;
920 int intlen; 920 int intlen;
921 921
922 /* 922 /*
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index e5d819166874..8aa9a93e2aa2 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -55,9 +55,9 @@ static int mpc834x_usb_cfg(void)
55 struct device_node *np = NULL; 55 struct device_node *np = NULL;
56 int port0_is_dr = 0; 56 int port0_is_dr = 0;
57 57
58 if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL) 58 if ((np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr")) != NULL)
59 port0_is_dr = 1; 59 port0_is_dr = 1;
60 if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL){ 60 if ((np = of_find_compatible_node(NULL, "usb", "fsl-usb2-mph")) != NULL){
61 if (port0_is_dr) { 61 if (port0_is_dr) {
62 printk(KERN_WARNING 62 printk(KERN_WARNING
63 "There is only one USB port on PB board! \n"); 63 "There is only one USB port on PB board! \n");
@@ -103,8 +103,8 @@ static int mpc834x_usb_cfg(void)
103 return -1; 103 return -1;
104 104
105 /* 105 /*
106 * if MDS board is plug into PIB board, 106 * if Processor Board is plugged into PIB board,
107 * force to use the PHY on MDS board 107 * force to use the PHY on Processor Board
108 */ 108 */
109 bcsr5 = in_8(bcsr_regs + 5); 109 bcsr5 = in_8(bcsr_regs + 5);
110 if (!(bcsr5 & BCSR5_INT_USB)) 110 if (!(bcsr5 & BCSR5_INT_USB))
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index eb661ccf2dab..e764c0aced88 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -47,6 +47,7 @@ config MPC85xx
47 bool 47 bool
48 select PPC_UDBG_16550 48 select PPC_UDBG_16550
49 select PPC_INDIRECT_PCI 49 select PPC_INDIRECT_PCI
50 select SERIAL_8250_SHARE_IRQ if SERIAL_8250
50 default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS || MPC85xx_MDS 51 default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS || MPC85xx_MDS
51 52
52config PPC_INDIRECT_PCI_BE 53config PPC_INDIRECT_PCI_BE
diff --git a/arch/powerpc/platforms/celleb/scc_epci.c b/arch/powerpc/platforms/celleb/scc_epci.c
index c11b39c3776a..fb23d53eb09c 100644
--- a/arch/powerpc/platforms/celleb/scc_epci.c
+++ b/arch/powerpc/platforms/celleb/scc_epci.c
@@ -43,11 +43,34 @@
43 43
44#define iob() __asm__ __volatile__("eieio; sync":::"memory") 44#define iob() __asm__ __volatile__("eieio; sync":::"memory")
45 45
46static inline volatile void __iomem *celleb_epci_get_epci_base(
47 struct pci_controller *hose)
48{
49 /*
50 * Note:
51 * Celleb epci uses cfg_addr as a base address for
52 * epci control registers.
53 */
54
55 return hose->cfg_addr;
56}
57
58static inline volatile void __iomem *celleb_epci_get_epci_cfg(
59 struct pci_controller *hose)
60{
61 /*
62 * Note:
63 * Celleb epci uses cfg_data as a base address for
64 * configuration area for epci devices.
65 */
66
67 return hose->cfg_data;
68}
46 69
47#if 0 /* test code for epci dummy read */ 70#if 0 /* test code for epci dummy read */
48static void celleb_epci_dummy_read(struct pci_dev *dev) 71static void celleb_epci_dummy_read(struct pci_dev *dev)
49{ 72{
50 void __iomem *epci_base; 73 volatile void __iomem *epci_base;
51 struct device_node *node; 74 struct device_node *node;
52 struct pci_controller *hose; 75 struct pci_controller *hose;
53 u32 val; 76 u32 val;
@@ -58,7 +81,7 @@ static void celleb_epci_dummy_read(struct pci_dev *dev)
58 if (!hose) 81 if (!hose)
59 return; 82 return;
60 83
61 epci_base = hose->cfg_addr; 84 epci_base = celleb_epci_get_epci_base(hose);
62 85
63 val = in_be32(epci_base + SCC_EPCI_WATRP); 86 val = in_be32(epci_base + SCC_EPCI_WATRP);
64 iosync(); 87 iosync();
@@ -70,19 +93,20 @@ static void celleb_epci_dummy_read(struct pci_dev *dev)
70static inline void clear_and_disable_master_abort_interrupt( 93static inline void clear_and_disable_master_abort_interrupt(
71 struct pci_controller *hose) 94 struct pci_controller *hose)
72{ 95{
73 void __iomem *addr; 96 volatile void __iomem *epci_base, *reg;
74 addr = hose->cfg_addr + PCI_COMMAND; 97 epci_base = celleb_epci_get_epci_base(hose);
75 out_be32(addr, in_be32(addr) | (PCI_STATUS_REC_MASTER_ABORT << 16)); 98 reg = epci_base + PCI_COMMAND;
99 out_be32(reg, in_be32(reg) | (PCI_STATUS_REC_MASTER_ABORT << 16));
76} 100}
77 101
78static int celleb_epci_check_abort(struct pci_controller *hose, 102static int celleb_epci_check_abort(struct pci_controller *hose,
79 void __iomem *addr) 103 volatile void __iomem *addr)
80{ 104{
81 void __iomem *reg, *epci_base; 105 volatile void __iomem *reg, *epci_base;
82 u32 val; 106 u32 val;
83 107
84 iob(); 108 iob();
85 epci_base = hose->cfg_addr; 109 epci_base = celleb_epci_get_epci_base(hose);
86 110
87 reg = epci_base + PCI_COMMAND; 111 reg = epci_base + PCI_COMMAND;
88 val = in_be32(reg); 112 val = in_be32(reg);
@@ -108,20 +132,21 @@ static int celleb_epci_check_abort(struct pci_controller *hose,
108 return PCIBIOS_SUCCESSFUL; 132 return PCIBIOS_SUCCESSFUL;
109} 133}
110 134
111static void __iomem *celleb_epci_make_config_addr(struct pci_controller *hose, 135static volatile void __iomem *celleb_epci_make_config_addr(
136 struct pci_controller *hose,
112 unsigned int devfn, int where) 137 unsigned int devfn, int where)
113{ 138{
114 void __iomem *addr; 139 volatile void __iomem *addr;
115 struct pci_bus *bus = hose->bus; 140 struct pci_bus *bus = hose->bus;
116 141
117 if (bus->self) 142 if (bus->self)
118 addr = hose->cfg_data + 143 addr = celleb_epci_get_epci_cfg(hose) +
119 (((bus->number & 0xff) << 16) 144 (((bus->number & 0xff) << 16)
120 | ((devfn & 0xff) << 8) 145 | ((devfn & 0xff) << 8)
121 | (where & 0xff) 146 | (where & 0xff)
122 | 0x01000000); 147 | 0x01000000);
123 else 148 else
124 addr = hose->cfg_data + 149 addr = celleb_epci_get_epci_cfg(hose) +
125 (((devfn & 0xff) << 8) | (where & 0xff)); 150 (((devfn & 0xff) << 8) | (where & 0xff));
126 151
127 pr_debug("EPCI: config_addr = 0x%p\n", addr); 152 pr_debug("EPCI: config_addr = 0x%p\n", addr);
@@ -132,7 +157,7 @@ static void __iomem *celleb_epci_make_config_addr(struct pci_controller *hose,
132static int celleb_epci_read_config(struct pci_bus *bus, 157static int celleb_epci_read_config(struct pci_bus *bus,
133 unsigned int devfn, int where, int size, u32 * val) 158 unsigned int devfn, int where, int size, u32 * val)
134{ 159{
135 void __iomem *addr; 160 volatile void __iomem *epci_base, *addr;
136 struct device_node *node; 161 struct device_node *node;
137 struct pci_controller *hose; 162 struct pci_controller *hose;
138 163
@@ -142,13 +167,14 @@ static int celleb_epci_read_config(struct pci_bus *bus,
142 node = (struct device_node *)bus->sysdata; 167 node = (struct device_node *)bus->sysdata;
143 hose = pci_find_hose_for_OF_device(node); 168 hose = pci_find_hose_for_OF_device(node);
144 169
145 if (!hose->cfg_data) 170 if (!celleb_epci_get_epci_cfg(hose))
146 return PCIBIOS_DEVICE_NOT_FOUND; 171 return PCIBIOS_DEVICE_NOT_FOUND;
147 172
148 if (bus->number == hose->first_busno && devfn == 0) { 173 if (bus->number == hose->first_busno && devfn == 0) {
149 /* EPCI controller self */ 174 /* EPCI controller self */
150 175
151 addr = hose->cfg_addr + where; 176 epci_base = celleb_epci_get_epci_base(hose);
177 addr = epci_base + where;
152 178
153 switch (size) { 179 switch (size) {
154 case 1: 180 case 1:
@@ -185,7 +211,7 @@ static int celleb_epci_read_config(struct pci_bus *bus,
185 } 211 }
186 212
187 pr_debug("EPCI: " 213 pr_debug("EPCI: "
188 "addr=0x%lx, devfn=0x%x, where=0x%x, size=0x%x, val=0x%x\n", 214 "addr=0x%p, devfn=0x%x, where=0x%x, size=0x%x, val=0x%x\n",
189 addr, devfn, where, size, *val); 215 addr, devfn, where, size, *val);
190 216
191 return celleb_epci_check_abort(hose, NULL); 217 return celleb_epci_check_abort(hose, NULL);
@@ -194,7 +220,7 @@ static int celleb_epci_read_config(struct pci_bus *bus,
194static int celleb_epci_write_config(struct pci_bus *bus, 220static int celleb_epci_write_config(struct pci_bus *bus,
195 unsigned int devfn, int where, int size, u32 val) 221 unsigned int devfn, int where, int size, u32 val)
196{ 222{
197 void __iomem *addr; 223 volatile void __iomem *epci_base, *addr;
198 struct device_node *node; 224 struct device_node *node;
199 struct pci_controller *hose; 225 struct pci_controller *hose;
200 226
@@ -204,13 +230,15 @@ static int celleb_epci_write_config(struct pci_bus *bus,
204 node = (struct device_node *)bus->sysdata; 230 node = (struct device_node *)bus->sysdata;
205 hose = pci_find_hose_for_OF_device(node); 231 hose = pci_find_hose_for_OF_device(node);
206 232
207 if (!hose->cfg_data) 233
234 if (!celleb_epci_get_epci_cfg(hose))
208 return PCIBIOS_DEVICE_NOT_FOUND; 235 return PCIBIOS_DEVICE_NOT_FOUND;
209 236
210 if (bus->number == hose->first_busno && devfn == 0) { 237 if (bus->number == hose->first_busno && devfn == 0) {
211 /* EPCI controller self */ 238 /* EPCI controller self */
212 239
213 addr = hose->cfg_addr + where; 240 epci_base = celleb_epci_get_epci_base(hose);
241 addr = epci_base + where;
214 242
215 switch (size) { 243 switch (size) {
216 case 1: 244 case 1:
@@ -258,10 +286,10 @@ struct pci_ops celleb_epci_ops = {
258static int __devinit celleb_epci_init(struct pci_controller *hose) 286static int __devinit celleb_epci_init(struct pci_controller *hose)
259{ 287{
260 u32 val; 288 u32 val;
261 void __iomem *reg, *epci_base; 289 volatile void __iomem *reg, *epci_base;
262 int hwres = 0; 290 int hwres = 0;
263 291
264 epci_base = hose->cfg_addr; 292 epci_base = celleb_epci_get_epci_base(hose);
265 293
266 /* PCI core reset(Internal bus and PCI clock) */ 294 /* PCI core reset(Internal bus and PCI clock) */
267 reg = epci_base + SCC_EPCI_CKCTRL; 295 reg = epci_base + SCC_EPCI_CKCTRL;
@@ -382,6 +410,18 @@ int __devinit celleb_setup_epci(struct device_node *node,
382 410
383 pr_debug("PCI: celleb_setup_epci()\n"); 411 pr_debug("PCI: celleb_setup_epci()\n");
384 412
413 /*
414 * Note:
415 * Celleb epci uses cfg_addr and cfg_data member of
416 * pci_controller structure in irregular way.
417 *
418 * cfg_addr is used to map for control registers of
419 * celleb epci.
420 *
421 * cfg_data is used for configuration area of devices
422 * on Celleb epci buses.
423 */
424
385 if (of_address_to_resource(node, 0, &r)) 425 if (of_address_to_resource(node, 0, &r))
386 goto error; 426 goto error;
387 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1)); 427 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1));
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 886c522d78e9..3410bcbc9dbe 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -79,6 +79,7 @@ config LINKSTATION
79 select MPIC 79 select MPIC
80 select FSL_SOC 80 select FSL_SOC
81 select PPC_UDBG_16550 if SERIAL_8250 81 select PPC_UDBG_16550 if SERIAL_8250
82 select DEFAULT_UIMAGE
82 help 83 help
83 Select LINKSTATION if configuring for one of PPC- (MPC8241) 84 Select LINKSTATION if configuring for one of PPC- (MPC8241)
84 based NAS systems from Buffalo Technology. So far only 85 based NAS systems from Buffalo Technology. So far only
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index c29a6a064d22..24cc50c1774a 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -810,6 +810,7 @@ core99_ata100_enable(struct device_node *node, long value)
810 unsigned long flags; 810 unsigned long flags;
811 struct pci_dev *pdev = NULL; 811 struct pci_dev *pdev = NULL;
812 u8 pbus, pid; 812 u8 pbus, pid;
813 int rc;
813 814
814 if (uninorth_rev < 0x24) 815 if (uninorth_rev < 0x24)
815 return -ENODEV; 816 return -ENODEV;
@@ -828,7 +829,9 @@ core99_ata100_enable(struct device_node *node, long value)
828 pdev = pci_find_slot(pbus, pid); 829 pdev = pci_find_slot(pbus, pid);
829 if (pdev == NULL) 830 if (pdev == NULL)
830 return 0; 831 return 0;
831 pci_enable_device(pdev); 832 rc = pci_enable_device(pdev);
833 if (rc)
834 return rc;
832 pci_set_master(pdev); 835 pci_set_master(pdev);
833 } 836 }
834 return 0; 837 return 0;
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index f42475b27c15..6fbac308ded6 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1191,8 +1191,11 @@ void __init pmac_pcibios_after_init(void)
1191 * -- BenH 1191 * -- BenH
1192 */ 1192 */
1193 for_each_pci_dev(dev) { 1193 for_each_pci_dev(dev) {
1194 if ((dev->class >> 16) == PCI_BASE_CLASS_STORAGE) 1194 if ((dev->class >> 16) != PCI_BASE_CLASS_STORAGE)
1195 pci_enable_device(dev); 1195 continue;
1196 if (pci_enable_device(dev))
1197 printk(KERN_WARNING
1198 "pci: Failed to enable %s\n", pci_name(dev));
1196 } 1199 }
1197#endif /* CONFIG_BLK_DEV_IDE */ 1200#endif /* CONFIG_BLK_DEV_IDE */
1198 1201
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0183e5fbaf46..bf299b66f3fc 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -218,7 +218,7 @@ Commands:\n\
218" ss stop execution on all spus\n\ 218" ss stop execution on all spus\n\
219 sr restore execution on stopped spus\n\ 219 sr restore execution on stopped spus\n\
220 sf # dump spu fields for spu # (in hex)\n\ 220 sf # dump spu fields for spu # (in hex)\n\
221 sd # dump spu local store for spu # (in hex)\ 221 sd # dump spu local store for spu # (in hex)\n\
222 sdi # disassemble spu local store for spu # (in hex)\n" 222 sdi # disassemble spu local store for spu # (in hex)\n"
223#endif 223#endif
224" S print special registers\n\ 224" S print special registers\n\
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/renesas/r7780rp/Makefile
index 3c93012e91a3..ed5f5a9a3b3e 100644
--- a/arch/sh/boards/renesas/r7780rp/Makefile
+++ b/arch/sh/boards/renesas/r7780rp/Makefile
@@ -2,6 +2,6 @@
2# Makefile for the R7780RP-1 specific parts of the kernel 2# Makefile for the R7780RP-1 specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
6 6
7obj-$(CONFIG_PUSH_SWITCH) += psw.o 7obj-$(CONFIG_PUSH_SWITCH) += psw.o
diff --git a/arch/sh/boards/renesas/r7780rp/io.c b/arch/sh/boards/renesas/r7780rp/io.c
deleted file mode 100644
index f74d2ffb3851..000000000000
--- a/arch/sh/boards/renesas/r7780rp/io.c
+++ /dev/null
@@ -1,233 +0,0 @@
1/*
2 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
3 * Based largely on io_se.c.
4 *
5 * I/O routine for Renesas Solutions Highlander R7780RP-1
6 *
7 * Initial version only to support LAN access; some
8 * placeholder code from io_r7780rp.c left in with the
9 * expectation of later SuperIO and PCMCIA access.
10 */
11#include <linux/pci.h>
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/io.h>
15#include <asm/r7780rp.h>
16#include <asm/addrspace.h>
17
18static inline unsigned long port88796l(unsigned int port, int flag)
19{
20 unsigned long addr;
21
22 if (flag)
23 addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1);
24 else
25 addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1) + 0x1000;
26
27 return addr;
28}
29
30#if defined(CONFIG_NE2000) || defined(CONFIG_NE2000_MODULE)
31#define CHECK_AX88796L_PORT(port) \
32 ((port >= AX88796L_IO_BASE) && (port < (AX88796L_IO_BASE+0x20)))
33#else
34#define CHECK_AX88796L_PORT(port) (0)
35#endif
36
37/*
38 * General outline: remap really low stuff [eventually] to SuperIO,
39 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
40 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
41 * should be way beyond the window, and is used w/o translation for
42 * compatibility.
43 */
44u8 r7780rp_inb(unsigned long port)
45{
46 if (CHECK_AX88796L_PORT(port))
47 return ctrl_inw(port88796l(port, 0)) & 0xff;
48 else if (is_pci_ioaddr(port))
49 return ctrl_inb(pci_ioaddr(port));
50
51 return ctrl_inw(port) & 0xff;
52}
53
54u8 r7780rp_inb_p(unsigned long port)
55{
56 u8 v;
57
58 if (CHECK_AX88796L_PORT(port))
59 v = ctrl_inw(port88796l(port, 0)) & 0xff;
60 else if (is_pci_ioaddr(port))
61 v = ctrl_inb(pci_ioaddr(port));
62 else
63 v = ctrl_inw(port) & 0xff;
64
65 ctrl_delay();
66
67 return v;
68}
69
70u16 r7780rp_inw(unsigned long port)
71{
72 if (is_pci_ioaddr(port))
73 return ctrl_inw(pci_ioaddr(port));
74
75 return ctrl_inw(port);
76}
77
78u32 r7780rp_inl(unsigned long port)
79{
80 if (is_pci_ioaddr(port))
81 return ctrl_inl(pci_ioaddr(port));
82
83 return ctrl_inl(port);
84}
85
86void r7780rp_outb(u8 value, unsigned long port)
87{
88 if (CHECK_AX88796L_PORT(port))
89 ctrl_outw(value, port88796l(port, 0));
90 else if (is_pci_ioaddr(port))
91 ctrl_outb(value, pci_ioaddr(port));
92 else
93 ctrl_outb(value, port);
94}
95
96void r7780rp_outb_p(u8 value, unsigned long port)
97{
98 if (CHECK_AX88796L_PORT(port))
99 ctrl_outw(value, port88796l(port, 0));
100 else if (is_pci_ioaddr(port))
101 ctrl_outb(value, pci_ioaddr(port));
102 else
103 ctrl_outb(value, port);
104
105 ctrl_delay();
106}
107
108void r7780rp_outw(u16 value, unsigned long port)
109{
110 if (is_pci_ioaddr(port))
111 ctrl_outw(value, pci_ioaddr(port));
112 else
113 ctrl_outw(value, port);
114}
115
116void r7780rp_outl(u32 value, unsigned long port)
117{
118 if (is_pci_ioaddr(port))
119 ctrl_outl(value, pci_ioaddr(port));
120 else
121 ctrl_outl(value, port);
122}
123
124void r7780rp_insb(unsigned long port, void *dst, unsigned long count)
125{
126 volatile u16 *p;
127 u8 *buf = dst;
128
129 if (CHECK_AX88796L_PORT(port)) {
130 p = (volatile u16 *)port88796l(port, 0);
131 while (count--)
132 *buf++ = *p & 0xff;
133 } else if (is_pci_ioaddr(port)) {
134 volatile u8 *bp = (volatile u8 *)pci_ioaddr(port);
135
136 while (count--)
137 *buf++ = *bp;
138 } else {
139 p = (volatile u16 *)port;
140 while (count--)
141 *buf++ = *p & 0xff;
142 }
143}
144
145void r7780rp_insw(unsigned long port, void *dst, unsigned long count)
146{
147 volatile u16 *p;
148 u16 *buf = dst;
149
150 if (CHECK_AX88796L_PORT(port))
151 p = (volatile u16 *)port88796l(port, 1);
152 else if (is_pci_ioaddr(port))
153 p = (volatile u16 *)pci_ioaddr(port);
154 else
155 p = (volatile u16 *)port;
156
157 while (count--)
158 *buf++ = *p;
159
160 flush_dcache_all();
161}
162
163void r7780rp_insl(unsigned long port, void *dst, unsigned long count)
164{
165 if (is_pci_ioaddr(port)) {
166 volatile u32 *p = (volatile u32 *)pci_ioaddr(port);
167 u32 *buf = dst;
168
169 while (count--)
170 *buf++ = *p;
171 }
172}
173
174void r7780rp_outsb(unsigned long port, const void *src, unsigned long count)
175{
176 volatile u16 *p;
177 const u8 *buf = src;
178
179 if (CHECK_AX88796L_PORT(port)) {
180 p = (volatile u16 *)port88796l(port, 0);
181 while (count--)
182 *p = *buf++;
183 } else if (is_pci_ioaddr(port)) {
184 volatile u8 *bp = (volatile u8 *)pci_ioaddr(port);
185
186 while (count--)
187 *bp = *buf++;
188 } else
189 while (count--)
190 ctrl_outb(*buf++, port);
191}
192
193void r7780rp_outsw(unsigned long port, const void *src, unsigned long count)
194{
195 volatile u16 *p;
196 const u16 *buf = src;
197
198 if (CHECK_AX88796L_PORT(port))
199 p = (volatile u16 *)port88796l(port, 1);
200 else if (is_pci_ioaddr(port))
201 p = (volatile u16 *)pci_ioaddr(port);
202 else
203 p = (volatile u16 *)port;
204
205 while (count--)
206 *p = *buf++;
207
208 flush_dcache_all();
209}
210
211void r7780rp_outsl(unsigned long port, const void *src, unsigned long count)
212{
213 const u32 *buf = src;
214 u32 *p;
215
216 if (is_pci_ioaddr(port))
217 p = (u32 *)pci_ioaddr(port);
218 else
219 p = (u32 *)port;
220
221 while (count--)
222 ctrl_outl(*buf++, (unsigned long)p);
223}
224
225void __iomem *r7780rp_ioport_map(unsigned long port, unsigned int size)
226{
227 if (CHECK_AX88796L_PORT(port))
228 return (void __iomem *)port88796l(port, size > 1);
229 else if (is_pci_ioaddr(port))
230 return (void __iomem *)pci_ioaddr(port);
231
232 return (void __iomem *)port;
233}
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index 0d74db9f1792..2faba6679e64 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -187,31 +187,7 @@ static void __init r7780rp_setup(char **cmdline_p)
187struct sh_machine_vector mv_r7780rp __initmv = { 187struct sh_machine_vector mv_r7780rp __initmv = {
188 .mv_name = "Highlander R7780RP-1", 188 .mv_name = "Highlander R7780RP-1",
189 .mv_setup = r7780rp_setup, 189 .mv_setup = r7780rp_setup,
190
191 .mv_nr_irqs = 109, 190 .mv_nr_irqs = 109,
192
193 .mv_inb = r7780rp_inb,
194 .mv_inw = r7780rp_inw,
195 .mv_inl = r7780rp_inl,
196 .mv_outb = r7780rp_outb,
197 .mv_outw = r7780rp_outw,
198 .mv_outl = r7780rp_outl,
199
200 .mv_inb_p = r7780rp_inb_p,
201 .mv_inw_p = r7780rp_inw,
202 .mv_inl_p = r7780rp_inl,
203 .mv_outb_p = r7780rp_outb_p,
204 .mv_outw_p = r7780rp_outw,
205 .mv_outl_p = r7780rp_outl,
206
207 .mv_insb = r7780rp_insb,
208 .mv_insw = r7780rp_insw,
209 .mv_insl = r7780rp_insl,
210 .mv_outsb = r7780rp_outsb,
211 .mv_outsw = r7780rp_outsw,
212 .mv_outsl = r7780rp_outsl,
213
214 .mv_ioport_map = r7780rp_ioport_map,
215 .mv_init_irq = init_r7780rp_IRQ, 191 .mv_init_irq = init_r7780rp_IRQ,
216}; 192};
217ALIAS_MV(r7780rp) 193ALIAS_MV(r7780rp)
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 44b42082a0af..593f26a85e9c 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -12,6 +12,7 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/pata_platform.h> 13#include <linux/pata_platform.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/sm501.h>
15#include <linux/pm.h> 16#include <linux/pm.h>
16#include <asm/machvec.h> 17#include <asm/machvec.h>
17#include <asm/rts7751r2d.h> 18#include <asm/rts7751r2d.h>
@@ -111,10 +112,35 @@ static struct platform_device heartbeat_device = {
111 .resource = heartbeat_resources, 112 .resource = heartbeat_resources,
112}; 113};
113 114
115static struct resource sm501_resources[] = {
116 [0] = {
117 .start = 0x10000000,
118 .end = 0x13e00000 - 1,
119 .flags = IORESOURCE_MEM,
120 },
121 [1] = {
122 .start = 0x13e00000,
123 .end = 0x13ffffff,
124 .flags = IORESOURCE_MEM,
125 },
126 [2] = {
127 .start = 32,
128 .flags = IORESOURCE_IRQ,
129 },
130};
131
132static struct platform_device sm501_device = {
133 .name = "sm501",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(sm501_resources),
136 .resource = sm501_resources,
137};
138
114static struct platform_device *rts7751r2d_devices[] __initdata = { 139static struct platform_device *rts7751r2d_devices[] __initdata = {
115 &uart_device, 140 &uart_device,
116 &heartbeat_device, 141 &heartbeat_device,
117 &cf_ide_device, 142 &cf_ide_device,
143 &sm501_device,
118}; 144};
119 145
120static int __init rts7751r2d_devices_setup(void) 146static int __init rts7751r2d_devices_setup(void)
diff --git a/arch/sh/configs/rts7751r2d_defconfig b/arch/sh/configs/rts7751r2d_defconfig
index db6a02df5af6..a59bb78bd071 100644
--- a/arch/sh/configs/rts7751r2d_defconfig
+++ b/arch/sh/configs/rts7751r2d_defconfig
@@ -1,14 +1,13 @@
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.21-rc1
4# Thu Feb 15 17:17:29 2007 4# Thu Mar 1 16:42:40 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 8CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 9CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
12CONFIG_GENERIC_IRQ_PROBE=y 11CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 12CONFIG_GENERIC_CALIBRATE_DELAY=y
14# CONFIG_GENERIC_TIME is not set 13# CONFIG_GENERIC_TIME is not set
@@ -33,6 +32,7 @@ CONFIG_LOCALVERSION_AUTO=y
33CONFIG_SWAP=y 32CONFIG_SWAP=y
34CONFIG_SYSVIPC=y 33CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 34# CONFIG_IPC_NS is not set
35CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 36# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 37# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 38# CONFIG_TASKSTATS is not set
@@ -119,7 +119,6 @@ CONFIG_SH_RTS7751R2D=y
119# CONFIG_SH_SHMIN is not set 119# CONFIG_SH_SHMIN is not set
120# CONFIG_SH_7206_SOLUTION_ENGINE is not set 120# CONFIG_SH_7206_SOLUTION_ENGINE is not set
121# CONFIG_SH_7619_SOLUTION_ENGINE is not set 121# CONFIG_SH_7619_SOLUTION_ENGINE is not set
122# CONFIG_SH_ASDAP310 is not set
123# CONFIG_SH_UNKNOWN is not set 122# CONFIG_SH_UNKNOWN is not set
124 123
125# 124#
@@ -281,7 +280,7 @@ CONFIG_ZERO_PAGE_OFFSET=0x00010000
281CONFIG_BOOT_LINK_OFFSET=0x00800000 280CONFIG_BOOT_LINK_OFFSET=0x00800000
282# CONFIG_UBC_WAKEUP is not set 281# CONFIG_UBC_WAKEUP is not set
283CONFIG_CMDLINE_BOOL=y 282CONFIG_CMDLINE_BOOL=y
284CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1" 283CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 root=/dev/sda1"
285 284
286# 285#
287# Bus options 286# Bus options
@@ -433,6 +432,7 @@ CONFIG_FW_LOADER=m
433# 432#
434# Plug and Play support 433# Plug and Play support
435# 434#
435# CONFIG_PNPACPI is not set
436 436
437# 437#
438# Block devices 438# Block devices
@@ -770,7 +770,26 @@ CONFIG_NET_WIRELESS=y
770# 770#
771# Input device support 771# Input device support
772# 772#
773# CONFIG_INPUT is not set 773CONFIG_INPUT=y
774# CONFIG_INPUT_FF_MEMLESS is not set
775
776#
777# Userland interfaces
778#
779# CONFIG_INPUT_MOUSEDEV is not set
780# CONFIG_INPUT_JOYDEV is not set
781# CONFIG_INPUT_TSDEV is not set
782# CONFIG_INPUT_EVDEV is not set
783# CONFIG_INPUT_EVBUG is not set
784
785#
786# Input Device Drivers
787#
788# CONFIG_INPUT_KEYBOARD is not set
789# CONFIG_INPUT_MOUSE is not set
790# CONFIG_INPUT_JOYSTICK is not set
791# CONFIG_INPUT_TOUCHSCREEN is not set
792# CONFIG_INPUT_MISC is not set
774 793
775# 794#
776# Hardware I/O ports 795# Hardware I/O ports
@@ -781,7 +800,10 @@ CONFIG_NET_WIRELESS=y
781# 800#
782# Character devices 801# Character devices
783# 802#
784# CONFIG_VT is not set 803CONFIG_VT=y
804CONFIG_VT_CONSOLE=y
805CONFIG_HW_CONSOLE=y
806CONFIG_VT_HW_CONSOLE_BINDING=y
785# CONFIG_SERIAL_NONSTANDARD is not set 807# CONFIG_SERIAL_NONSTANDARD is not set
786 808
787# 809#
@@ -857,6 +879,11 @@ CONFIG_HWMON=y
857# CONFIG_HWMON_DEBUG_CHIP is not set 879# CONFIG_HWMON_DEBUG_CHIP is not set
858 880
859# 881#
882# Multifunction device drivers
883#
884CONFIG_MFD_SM501=y
885
886#
860# Multimedia devices 887# Multimedia devices
861# 888#
862# CONFIG_VIDEO_DEV is not set 889# CONFIG_VIDEO_DEV is not set
@@ -869,9 +896,66 @@ CONFIG_HWMON=y
869# 896#
870# Graphics support 897# Graphics support
871# 898#
872CONFIG_FIRMWARE_EDID=y
873# CONFIG_FB is not set
874# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 899# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
900CONFIG_FB=y
901# CONFIG_FIRMWARE_EDID is not set
902# CONFIG_FB_DDC is not set
903CONFIG_FB_CFB_FILLRECT=y
904CONFIG_FB_CFB_COPYAREA=y
905CONFIG_FB_CFB_IMAGEBLIT=y
906# CONFIG_FB_SVGALIB is not set
907# CONFIG_FB_MACMODES is not set
908# CONFIG_FB_BACKLIGHT is not set
909# CONFIG_FB_MODE_HELPERS is not set
910# CONFIG_FB_TILEBLITTING is not set
911
912#
913# Frambuffer hardware drivers
914#
915# CONFIG_FB_CIRRUS is not set
916# CONFIG_FB_PM2 is not set
917# CONFIG_FB_CYBER2000 is not set
918# CONFIG_FB_ASILIANT is not set
919# CONFIG_FB_IMSTT is not set
920# CONFIG_FB_EPSON1355 is not set
921# CONFIG_FB_S1D13XXX is not set
922# CONFIG_FB_NVIDIA is not set
923# CONFIG_FB_RIVA is not set
924# CONFIG_FB_MATROX is not set
925# CONFIG_FB_RADEON is not set
926# CONFIG_FB_ATY128 is not set
927# CONFIG_FB_ATY is not set
928# CONFIG_FB_S3 is not set
929# CONFIG_FB_SAVAGE is not set
930# CONFIG_FB_SIS is not set
931# CONFIG_FB_NEOMAGIC is not set
932# CONFIG_FB_KYRO is not set
933# CONFIG_FB_3DFX is not set
934# CONFIG_FB_VOODOO1 is not set
935# CONFIG_FB_TRIDENT is not set
936CONFIG_FB_SM501=y
937# CONFIG_FB_VIRTUAL is not set
938
939#
940# Console display driver support
941#
942CONFIG_DUMMY_CONSOLE=y
943CONFIG_FRAMEBUFFER_CONSOLE=y
944# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
945# CONFIG_FONTS is not set
946CONFIG_FONT_8x8=y
947CONFIG_FONT_8x16=y
948
949#
950# Logo configuration
951#
952CONFIG_LOGO=y
953# CONFIG_LOGO_LINUX_MONO is not set
954# CONFIG_LOGO_LINUX_VGA16 is not set
955# CONFIG_LOGO_LINUX_CLUT224 is not set
956# CONFIG_LOGO_SUPERH_MONO is not set
957# CONFIG_LOGO_SUPERH_VGA16 is not set
958CONFIG_LOGO_SUPERH_CLUT224=y
875 959
876# 960#
877# Sound 961# Sound
@@ -985,6 +1069,12 @@ CONFIG_SOUND_PRIME=m
985CONFIG_AC97_BUS=m 1069CONFIG_AC97_BUS=m
986 1070
987# 1071#
1072# HID Devices
1073#
1074CONFIG_HID=y
1075# CONFIG_HID_DEBUG is not set
1076
1077#
988# USB support 1078# USB support
989# 1079#
990CONFIG_USB_ARCH_HAS_HCD=y 1080CONFIG_USB_ARCH_HAS_HCD=y
@@ -1237,7 +1327,7 @@ CONFIG_LOG_BUF_SHIFT=14
1237CONFIG_EARLY_SCIF_CONSOLE=y 1327CONFIG_EARLY_SCIF_CONSOLE=y
1238CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000 1328CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
1239CONFIG_EARLY_PRINTK=y 1329CONFIG_EARLY_PRINTK=y
1240# CONFIG_KGDB is not set 1330# CONFIG_SH_KGDB is not set
1241 1331
1242# 1332#
1243# Security options 1333# Security options
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index ab4ebb856c2a..b46728027195 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -224,7 +224,7 @@ work_resched:
224syscall_exit_work: 224syscall_exit_work:
225 ! r0: current_thread_info->flags 225 ! r0: current_thread_info->flags
226 ! r8: current_thread_info 226 ! r8: current_thread_info
227 tst #_TIF_SYSCALL_TRACE, r0 227 tst #_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP, r0
228 bt/s work_pending 228 bt/s work_pending
229 tst #_TIF_NEED_RESCHED, r0 229 tst #_TIF_NEED_RESCHED, r0
230#ifdef CONFIG_TRACE_IRQFLAGS 230#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
index 66626c03e1ee..771ea4230441 100644
--- a/arch/sh/kernel/io_generic.c
+++ b/arch/sh/kernel/io_generic.c
@@ -14,7 +14,6 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <asm/machvec.h> 16#include <asm/machvec.h>
17#include <asm/cacheflush.h>
18 17
19#ifdef CONFIG_CPU_SH3 18#ifdef CONFIG_CPU_SH3
20/* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a 19/* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a
@@ -96,7 +95,6 @@ void generic_insw(unsigned long port, void *dst, unsigned long count)
96 while (count--) 95 while (count--)
97 *buf++ = *port_addr; 96 *buf++ = *port_addr;
98 97
99 flush_dcache_all();
100 dummy_read(); 98 dummy_read();
101} 99}
102 100
@@ -171,7 +169,6 @@ void generic_outsw(unsigned long port, const void *src, unsigned long count)
171 while (count--) 169 while (count--)
172 *port_addr = *buf++; 170 *port_addr = *buf++;
173 171
174 flush_dcache_all();
175 dummy_read(); 172 dummy_read();
176} 173}
177 174
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 9d6a438b3eaf..e7607366ac4e 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -250,12 +250,11 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
250 childregs->regs[15] = usp; 250 childregs->regs[15] = usp;
251 ti->addr_limit = USER_DS; 251 ti->addr_limit = USER_DS;
252 } else { 252 } else {
253 childregs->regs[15] = (unsigned long)task_stack_page(p) + 253 childregs->regs[15] = (unsigned long)childregs;
254 THREAD_SIZE;
255 ti->addr_limit = KERNEL_DS; 254 ti->addr_limit = KERNEL_DS;
256 } 255 }
257 256
258 if (clone_flags & CLONE_SETTLS) 257 if (clone_flags & CLONE_SETTLS)
259 childregs->gbr = childregs->regs[0]; 258 childregs->gbr = childregs->regs[0];
260 259
261 childregs->regs[0] = 0; /* Set return value for child */ 260 childregs->regs[0] = 0; /* Set return value for child */
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
index 04ca13a041c1..855f7246cfff 100644
--- a/arch/sh/kernel/ptrace.c
+++ b/arch/sh/kernel/ptrace.c
@@ -8,7 +8,6 @@
8 * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka 8 * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka
9 * 9 *
10 */ 10 */
11
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/sched.h> 12#include <linux/sched.h>
14#include <linux/mm.h> 13#include <linux/mm.h>
@@ -20,8 +19,7 @@
20#include <linux/slab.h> 19#include <linux/slab.h>
21#include <linux/security.h> 20#include <linux/security.h>
22#include <linux/signal.h> 21#include <linux/signal.h>
23 22#include <linux/io.h>
24#include <asm/io.h>
25#include <asm/uaccess.h> 23#include <asm/uaccess.h>
26#include <asm/pgtable.h> 24#include <asm/pgtable.h>
27#include <asm/system.h> 25#include <asm/system.h>
@@ -59,6 +57,23 @@ static inline int put_stack_long(struct task_struct *task, int offset,
59 return 0; 57 return 0;
60} 58}
61 59
60static void ptrace_disable_singlestep(struct task_struct *child)
61{
62 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
63
64 /*
65 * Ensure the UBC is not programmed at the next context switch.
66 *
67 * Normally this is not needed but there are sequences such as
68 * singlestep, signal delivery, and continue that leave the
69 * ubc_pc non-zero leading to spurious SIGTRAPs.
70 */
71 if (child->thread.ubc_pc != 0) {
72 ubc_usercnt -= 1;
73 child->thread.ubc_pc = 0;
74 }
75}
76
62/* 77/*
63 * Called by kernel/ptrace.c when detaching.. 78 * Called by kernel/ptrace.c when detaching..
64 * 79 *
@@ -66,7 +81,7 @@ static inline int put_stack_long(struct task_struct *task, int offset,
66 */ 81 */
67void ptrace_disable(struct task_struct *child) 82void ptrace_disable(struct task_struct *child)
68{ 83{
69 /* nothing to do.. */ 84 ptrace_disable_singlestep(child);
70} 85}
71 86
72long arch_ptrace(struct task_struct *child, long request, long addr, long data) 87long arch_ptrace(struct task_struct *child, long request, long addr, long data)
@@ -76,7 +91,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
76 91
77 switch (request) { 92 switch (request) {
78 /* when I and D space are separate, these will need to be fixed. */ 93 /* when I and D space are separate, these will need to be fixed. */
79 case PTRACE_PEEKTEXT: /* read word at location addr. */ 94 case PTRACE_PEEKTEXT: /* read word at location addr. */
80 case PTRACE_PEEKDATA: { 95 case PTRACE_PEEKDATA: {
81 unsigned long tmp; 96 unsigned long tmp;
82 int copied; 97 int copied;
@@ -94,7 +109,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
94 unsigned long tmp; 109 unsigned long tmp;
95 110
96 ret = -EIO; 111 ret = -EIO;
97 if ((addr & 3) || addr < 0 || 112 if ((addr & 3) || addr < 0 ||
98 addr > sizeof(struct user) - 3) 113 addr > sizeof(struct user) - 3)
99 break; 114 break;
100 115
@@ -129,7 +144,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
129 144
130 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 145 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
131 ret = -EIO; 146 ret = -EIO;
132 if ((addr & 3) || addr < 0 || 147 if ((addr & 3) || addr < 0 ||
133 addr > sizeof(struct user) - 3) 148 addr > sizeof(struct user) - 3)
134 break; 149 break;
135 150
@@ -156,6 +171,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
156 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 171 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
157 else 172 else
158 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 173 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
174
175 ptrace_disable_singlestep(child);
176
159 child->exit_code = data; 177 child->exit_code = data;
160 wake_up_process(child); 178 wake_up_process(child);
161 ret = 0; 179 ret = 0;
@@ -163,14 +181,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
163 } 181 }
164 182
165/* 183/*
166 * make the child exit. Best I can do is send it a sigkill. 184 * make the child exit. Best I can do is send it a sigkill.
167 * perhaps it should be put in the status that it wants to 185 * perhaps it should be put in the status that it wants to
168 * exit. 186 * exit.
169 */ 187 */
170 case PTRACE_KILL: { 188 case PTRACE_KILL: {
171 ret = 0; 189 ret = 0;
172 if (child->exit_state == EXIT_ZOMBIE) /* already dead */ 190 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
173 break; 191 break;
192 ptrace_disable_singlestep(child);
174 child->exit_code = SIGKILL; 193 child->exit_code = SIGKILL;
175 wake_up_process(child); 194 wake_up_process(child);
176 break; 195 break;
@@ -196,6 +215,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
196 ubc_usercnt += 1; 215 ubc_usercnt += 1;
197 child->thread.ubc_pc = pc; 216 child->thread.ubc_pc = pc;
198 217
218 set_tsk_thread_flag(child, TIF_SINGLESTEP);
199 child->exit_code = data; 219 child->exit_code = data;
200 /* give it a chance to run. */ 220 /* give it a chance to run. */
201 wake_up_process(child); 221 wake_up_process(child);
@@ -248,14 +268,15 @@ asmlinkage void do_syscall_trace(void)
248{ 268{
249 struct task_struct *tsk = current; 269 struct task_struct *tsk = current;
250 270
251 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 271 if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
272 !test_thread_flag(TIF_SINGLESTEP))
252 return; 273 return;
253 if (!(tsk->ptrace & PT_PTRACED)) 274 if (!(tsk->ptrace & PT_PTRACED))
254 return; 275 return;
255 /* the 0x80 provides a way for the tracing parent to distinguish 276 /* the 0x80 provides a way for the tracing parent to distinguish
256 between a syscall stop and SIGTRAP delivery */ 277 between a syscall stop and SIGTRAP delivery */
257 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 278 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
258 ? 0x80 : 0)); 279 !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
259 280
260 /* 281 /*
261 * this isn't the same as continuing with a signal, but it will do 282 * this isn't the same as continuing with a signal, but it will do
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 32f10a03fbb5..9f39ef1f73da 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -589,6 +589,8 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
589 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 589 if (test_thread_flag(TIF_RESTORE_SIGMASK))
590 clear_thread_flag(TIF_RESTORE_SIGMASK); 590 clear_thread_flag(TIF_RESTORE_SIGMASK);
591 } 591 }
592
593 return;
592 } 594 }
593 595
594 no_signal: 596 no_signal:
@@ -598,7 +600,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
598 if (regs->regs[0] == -ERESTARTNOHAND || 600 if (regs->regs[0] == -ERESTARTNOHAND ||
599 regs->regs[0] == -ERESTARTSYS || 601 regs->regs[0] == -ERESTARTSYS ||
600 regs->regs[0] == -ERESTARTNOINTR) { 602 regs->regs[0] == -ERESTARTNOINTR) {
601 regs->regs[0] = save_r0; 603 regs->regs[0] = save_r0;
602 regs->pc -= 2; 604 regs->pc -= 2;
603 } else if (regs->regs[0] == -ERESTART_RESTARTBLOCK) { 605 } else if (regs->regs[0] == -ERESTART_RESTARTBLOCK) {
604 regs->pc -= 2; 606 regs->pc -= 2;
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index 75de165867a0..78a6c09875b2 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -3,6 +3,7 @@
3 * Written by Niibe Yutaka 3 * Written by Niibe Yutaka
4 */ 4 */
5#include <asm/thread_info.h> 5#include <asm/thread_info.h>
6#include <asm/cache.h>
6#include <asm-generic/vmlinux.lds.h> 7#include <asm-generic/vmlinux.lds.h>
7 8
8#ifdef CONFIG_CPU_LITTLE_ENDIAN 9#ifdef CONFIG_CPU_LITTLE_ENDIAN
@@ -53,7 +54,7 @@ SECTIONS
53 . = ALIGN(PAGE_SIZE); 54 . = ALIGN(PAGE_SIZE);
54 .data.page_aligned : { *(.data.page_aligned) } 55 .data.page_aligned : { *(.data.page_aligned) }
55 56
56 . = ALIGN(32); 57 . = ALIGN(L1_CACHE_BYTES);
57 __per_cpu_start = .; 58 __per_cpu_start = .;
58 .data.percpu : { *(.data.percpu) } 59 .data.percpu : { *(.data.percpu) }
59 __per_cpu_end = .; 60 __per_cpu_end = .;
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index e0cd4b7f4aeb..981b04089055 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -237,20 +237,10 @@ static inline void flush_cache_4096(unsigned long start,
237/* 237/*
238 * Write back & invalidate the D-cache of the page. 238 * Write back & invalidate the D-cache of the page.
239 * (To avoid "alias" issues) 239 * (To avoid "alias" issues)
240 *
241 * This uses a lazy write-back on UP, which is explicitly
242 * disabled on SMP.
243 */ 240 */
244void flush_dcache_page(struct page *page) 241void flush_dcache_page(struct page *page)
245{ 242{
246#ifndef CONFIG_SMP 243 if (test_bit(PG_mapped, &page->flags)) {
247 struct address_space *mapping = page_mapping(page);
248
249 if (mapping && !mapping_mapped(mapping))
250 set_bit(PG_dcache_dirty, &page->flags);
251 else
252#endif
253 {
254 unsigned long phys = PHYSADDR(page_address(page)); 244 unsigned long phys = PHYSADDR(page_address(page));
255 unsigned long addr = CACHE_OC_ADDRESS_ARRAY; 245 unsigned long addr = CACHE_OC_ADDRESS_ARRAY;
256 int i, n; 246 int i, n;
diff --git a/arch/sh/mm/cache-sh7705.c b/arch/sh/mm/cache-sh7705.c
index 31f8deb7a158..4896d7376926 100644
--- a/arch/sh/mm/cache-sh7705.c
+++ b/arch/sh/mm/cache-sh7705.c
@@ -3,11 +3,11 @@
3 * 3 *
4 * Copyright (C) 1999, 2000 Niibe Yutaka 4 * Copyright (C) 1999, 2000 Niibe Yutaka
5 * Copyright (C) 2004 Alex Song 5 * Copyright (C) 2004 Alex Song
6 * Copyright (C) 2006 Paul Mundt
7 * 6 *
8 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
10 * for more details. 9 * for more details.
10 *
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mman.h> 13#include <linux/mman.h>
@@ -51,6 +51,7 @@ static inline void cache_wback_all(void)
51 51
52 if ((data & v) == v) 52 if ((data & v) == v)
53 ctrl_outl(data & ~v, addr); 53 ctrl_outl(data & ~v, addr);
54
54 } 55 }
55 56
56 addrstart += current_cpu_data.dcache.way_incr; 57 addrstart += current_cpu_data.dcache.way_incr;
@@ -127,11 +128,7 @@ static void __flush_dcache_page(unsigned long phys)
127 */ 128 */
128void flush_dcache_page(struct page *page) 129void flush_dcache_page(struct page *page)
129{ 130{
130 struct address_space *mapping = page_mapping(page); 131 if (test_bit(PG_mapped, &page->flags))
131
132 if (mapping && !mapping_mapped(mapping))
133 set_bit(PG_dcache_dirty, &page->flags);
134 else
135 __flush_dcache_page(PHYSADDR(page_address(page))); 132 __flush_dcache_page(PHYSADDR(page_address(page)));
136} 133}
137 134
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
index 969efeceb928..df69da9ca69c 100644
--- a/arch/sh/mm/pg-sh4.c
+++ b/arch/sh/mm/pg-sh4.c
@@ -23,6 +23,7 @@ extern struct mutex p3map_mutex[];
23 */ 23 */
24void clear_user_page(void *to, unsigned long address, struct page *page) 24void clear_user_page(void *to, unsigned long address, struct page *page)
25{ 25{
26 __set_bit(PG_mapped, &page->flags);
26 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 27 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
27 clear_page(to); 28 clear_page(to);
28 else { 29 else {
@@ -58,6 +59,7 @@ void clear_user_page(void *to, unsigned long address, struct page *page)
58void copy_user_page(void *to, void *from, unsigned long address, 59void copy_user_page(void *to, void *from, unsigned long address,
59 struct page *page) 60 struct page *page)
60{ 61{
62 __set_bit(PG_mapped, &page->flags);
61 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 63 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
62 copy_page(to, from); 64 copy_page(to, from);
63 else { 65 else {
@@ -82,3 +84,23 @@ void copy_user_page(void *to, void *from, unsigned long address,
82 mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]); 84 mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
83 } 85 }
84} 86}
87
88/*
89 * For SH-4, we have our own implementation for ptep_get_and_clear
90 */
91inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
92{
93 pte_t pte = *ptep;
94
95 pte_clear(mm, addr, ptep);
96 if (!pte_not_present(pte)) {
97 unsigned long pfn = pte_pfn(pte);
98 if (pfn_valid(pfn)) {
99 struct page *page = pfn_to_page(pfn);
100 struct address_space *mapping = page_mapping(page);
101 if (!mapping || !mapping_writably_mapped(mapping))
102 __clear_bit(PG_mapped, &page->flags);
103 }
104 }
105 return pte;
106}
diff --git a/arch/sh/mm/pg-sh7705.c b/arch/sh/mm/pg-sh7705.c
index 887ab9d18ccd..a4b015f95a3a 100644
--- a/arch/sh/mm/pg-sh7705.c
+++ b/arch/sh/mm/pg-sh7705.c
@@ -7,7 +7,9 @@
7 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 9 * for more details.
10 *
10 */ 11 */
12
11#include <linux/init.h> 13#include <linux/init.h>
12#include <linux/mman.h> 14#include <linux/mman.h>
13#include <linux/mm.h> 15#include <linux/mm.h>
@@ -74,6 +76,7 @@ void clear_user_page(void *to, unsigned long address, struct page *pg)
74{ 76{
75 struct page *page = virt_to_page(to); 77 struct page *page = virt_to_page(to);
76 78
79 __set_bit(PG_mapped, &page->flags);
77 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) { 80 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) {
78 clear_page(to); 81 clear_page(to);
79 __flush_wback_region(to, PAGE_SIZE); 82 __flush_wback_region(to, PAGE_SIZE);
@@ -92,11 +95,12 @@ void clear_user_page(void *to, unsigned long address, struct page *pg)
92 * @from: P1 address 95 * @from: P1 address
93 * @address: U0 address to be mapped 96 * @address: U0 address to be mapped
94 */ 97 */
95void copy_user_page(void *to, void *from, unsigned long address, 98void copy_user_page(void *to, void *from, unsigned long address, struct page *pg)
96 struct page *pg)
97{ 99{
98 struct page *page = virt_to_page(to); 100 struct page *page = virt_to_page(to);
99 101
102
103 __set_bit(PG_mapped, &page->flags);
100 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) { 104 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) {
101 copy_page(to, from); 105 copy_page(to, from);
102 __flush_wback_region(to, PAGE_SIZE); 106 __flush_wback_region(to, PAGE_SIZE);
@@ -108,3 +112,26 @@ void copy_user_page(void *to, void *from, unsigned long address,
108 __flush_wback_region(to, PAGE_SIZE); 112 __flush_wback_region(to, PAGE_SIZE);
109 } 113 }
110} 114}
115
116/*
117 * For SH7705, we have our own implementation for ptep_get_and_clear
118 * Copied from pg-sh4.c
119 */
120inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
121{
122 pte_t pte = *ptep;
123
124 pte_clear(mm, addr, ptep);
125 if (!pte_not_present(pte)) {
126 unsigned long pfn = pte_pfn(pte);
127 if (pfn_valid(pfn)) {
128 struct page *page = pfn_to_page(pfn);
129 struct address_space *mapping = page_mapping(page);
130 if (!mapping || !mapping_writably_mapped(mapping))
131 __clear_bit(PG_mapped, &page->flags);
132 }
133 }
134
135 return pte;
136}
137
diff --git a/arch/sh/mm/tlb-flush.c b/arch/sh/mm/tlb-flush.c
index d2f7b4a2eb05..6f45c1f8a7fe 100644
--- a/arch/sh/mm/tlb-flush.c
+++ b/arch/sh/mm/tlb-flush.c
@@ -2,17 +2,15 @@
2 * TLB flushing operations for SH with an MMU. 2 * TLB flushing operations for SH with an MMU.
3 * 3 *
4 * Copyright (C) 1999 Niibe Yutaka 4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 - 2006 Paul Mundt 5 * Copyright (C) 2003 Paul Mundt
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 9 * for more details.
10 */ 10 */
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/io.h>
13#include <asm/mmu_context.h> 12#include <asm/mmu_context.h>
14#include <asm/tlbflush.h> 13#include <asm/tlbflush.h>
15#include <asm/cacheflush.h>
16 14
17void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) 15void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
18{ 16{
@@ -140,54 +138,3 @@ void local_flush_tlb_all(void)
140 ctrl_barrier(); 138 ctrl_barrier();
141 local_irq_restore(flags); 139 local_irq_restore(flags);
142} 140}
143
144void update_mmu_cache(struct vm_area_struct *vma,
145 unsigned long address, pte_t pte)
146{
147 unsigned long flags;
148 unsigned long pteval;
149 unsigned long vpn;
150 struct page *page;
151 unsigned long pfn = pte_pfn(pte);
152 struct address_space *mapping;
153
154 if (!pfn_valid(pfn))
155 return;
156
157 page = pfn_to_page(pfn);
158 mapping = page_mapping(page);
159 if (mapping) {
160 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
161 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
162
163 if (dirty)
164 __flush_wback_region((void *)P1SEGADDR(phys),
165 PAGE_SIZE);
166 }
167
168 local_irq_save(flags);
169
170 /* Set PTEH register */
171 vpn = (address & MMU_VPN_MASK) | get_asid();
172 ctrl_outl(vpn, MMU_PTEH);
173
174 pteval = pte_val(pte);
175
176#ifdef CONFIG_CPU_HAS_PTEA
177 /* Set PTEA register */
178 /* TODO: make this look less hacky */
179 ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA);
180#endif
181
182 /* Set PTEL register */
183 pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
184#if defined(CONFIG_SH_WRITETHROUGH) && defined(CONFIG_CPU_SH4)
185 pteval |= _PAGE_WT;
186#endif
187 /* conveniently, we want all the software flags to be 0 anyway */
188 ctrl_outl(pteval, MMU_PTEL);
189
190 /* Load the TLB */
191 asm volatile("ldtlb": /* no output */ : /* no input */ : "memory");
192 local_irq_restore(flags);
193}
diff --git a/arch/sh/mm/tlb-sh3.c b/arch/sh/mm/tlb-sh3.c
index e5e76eb7ee09..7fbfd5a11ffa 100644
--- a/arch/sh/mm/tlb-sh3.c
+++ b/arch/sh/mm/tlb-sh3.c
@@ -8,9 +8,69 @@
8 * 8 *
9 * Released under the terms of the GNU GPL v2.0. 9 * Released under the terms of the GNU GPL v2.0.
10 */ 10 */
11#include <linux/io.h> 11#include <linux/signal.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/string.h>
16#include <linux/types.h>
17#include <linux/ptrace.h>
18#include <linux/mman.h>
19#include <linux/mm.h>
20#include <linux/smp.h>
21#include <linux/smp_lock.h>
22#include <linux/interrupt.h>
23
12#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/io.h>
26#include <asm/uaccess.h>
27#include <asm/pgalloc.h>
13#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
29#include <asm/cacheflush.h>
30
31void update_mmu_cache(struct vm_area_struct * vma,
32 unsigned long address, pte_t pte)
33{
34 unsigned long flags;
35 unsigned long pteval;
36 unsigned long vpn;
37
38 /* Ptrace may call this routine. */
39 if (vma && current->active_mm != vma->vm_mm)
40 return;
41
42#if defined(CONFIG_SH7705_CACHE_32KB)
43 {
44 struct page *page = pte_page(pte);
45 unsigned long pfn = pte_pfn(pte);
46
47 if (pfn_valid(pfn) && !test_bit(PG_mapped, &page->flags)) {
48 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
49
50 __flush_wback_region((void *)P1SEGADDR(phys),
51 PAGE_SIZE);
52 __set_bit(PG_mapped, &page->flags);
53 }
54 }
55#endif
56
57 local_irq_save(flags);
58
59 /* Set PTEH register */
60 vpn = (address & MMU_VPN_MASK) | get_asid();
61 ctrl_outl(vpn, MMU_PTEH);
62
63 pteval = pte_val(pte);
64
65 /* Set PTEL register */
66 pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
67 /* conveniently, we want all the software flags to be 0 anyway */
68 ctrl_outl(pteval, MMU_PTEL);
69
70 /* Load the TLB */
71 asm volatile("ldtlb": /* no output */ : /* no input */ : "memory");
72 local_irq_restore(flags);
73}
14 74
15void local_flush_tlb_one(unsigned long asid, unsigned long page) 75void local_flush_tlb_one(unsigned long asid, unsigned long page)
16{ 76{
@@ -34,3 +94,4 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
34 for (i = 0; i < ways; i++) 94 for (i = 0; i < ways; i++)
35 ctrl_outl(data, addr + (i << 8)); 95 ctrl_outl(data, addr + (i << 8));
36} 96}
97
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c
index 221e7095473d..f74cf667c8fa 100644
--- a/arch/sh/mm/tlb-sh4.c
+++ b/arch/sh/mm/tlb-sh4.c
@@ -8,9 +8,74 @@
8 * 8 *
9 * Released under the terms of the GNU GPL v2.0. 9 * Released under the terms of the GNU GPL v2.0.
10 */ 10 */
11#include <linux/io.h> 11#include <linux/signal.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/string.h>
16#include <linux/types.h>
17#include <linux/ptrace.h>
18#include <linux/mman.h>
19#include <linux/mm.h>
20#include <linux/smp.h>
21#include <linux/smp_lock.h>
22#include <linux/interrupt.h>
23
12#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/io.h>
26#include <asm/uaccess.h>
27#include <asm/pgalloc.h>
13#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
29#include <asm/cacheflush.h>
30
31void update_mmu_cache(struct vm_area_struct * vma,
32 unsigned long address, pte_t pte)
33{
34 unsigned long flags;
35 unsigned long pteval;
36 unsigned long vpn;
37 struct page *page;
38 unsigned long pfn;
39
40 /* Ptrace may call this routine. */
41 if (vma && current->active_mm != vma->vm_mm)
42 return;
43
44 pfn = pte_pfn(pte);
45 if (pfn_valid(pfn)) {
46 page = pfn_to_page(pfn);
47 if (!test_bit(PG_mapped, &page->flags)) {
48 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
49 __flush_wback_region((void *)P1SEGADDR(phys), PAGE_SIZE);
50 __set_bit(PG_mapped, &page->flags);
51 }
52 }
53
54 local_irq_save(flags);
55
56 /* Set PTEH register */
57 vpn = (address & MMU_VPN_MASK) | get_asid();
58 ctrl_outl(vpn, MMU_PTEH);
59
60 pteval = pte_val(pte);
61
62 /* Set PTEA register */
63 if (cpu_data->flags & CPU_HAS_PTEA)
64 /* TODO: make this look less hacky */
65 ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA);
66
67 /* Set PTEL register */
68 pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
69#ifdef CONFIG_SH_WRITETHROUGH
70 pteval |= _PAGE_WT;
71#endif
72 /* conveniently, we want all the software flags to be 0 anyway */
73 ctrl_outl(pteval, MMU_PTEL);
74
75 /* Load the TLB */
76 asm volatile("ldtlb": /* no output */ : /* no input */ : "memory");
77 local_irq_restore(flags);
78}
14 79
15void local_flush_tlb_one(unsigned long asid, unsigned long page) 80void local_flush_tlb_one(unsigned long asid, unsigned long page)
16{ 81{
@@ -28,3 +93,4 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
28 ctrl_outl(data, addr); 93 ctrl_outl(data, addr);
29 back_to_P1(); 94 back_to_P1();
30} 95}
96
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index 310af0f1e49e..021b82c7a759 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -56,30 +56,31 @@ static int connect_to_switch(struct daemon_data *pri)
56 56
57 pri->control = socket(AF_UNIX, SOCK_STREAM, 0); 57 pri->control = socket(AF_UNIX, SOCK_STREAM, 0);
58 if(pri->control < 0){ 58 if(pri->control < 0){
59 err = -errno;
59 printk("daemon_open : control socket failed, errno = %d\n", 60 printk("daemon_open : control socket failed, errno = %d\n",
60 errno); 61 -err);
61 return(-errno); 62 return err;
62 } 63 }
63 64
64 if(connect(pri->control, (struct sockaddr *) ctl_addr, 65 if(connect(pri->control, (struct sockaddr *) ctl_addr,
65 sizeof(*ctl_addr)) < 0){ 66 sizeof(*ctl_addr)) < 0){
66 printk("daemon_open : control connect failed, errno = %d\n",
67 errno);
68 err = -errno; 67 err = -errno;
68 printk("daemon_open : control connect failed, errno = %d\n",
69 -err);
69 goto out; 70 goto out;
70 } 71 }
71 72
72 fd = socket(AF_UNIX, SOCK_DGRAM, 0); 73 fd = socket(AF_UNIX, SOCK_DGRAM, 0);
73 if(fd < 0){ 74 if(fd < 0){
74 printk("daemon_open : data socket failed, errno = %d\n",
75 errno);
76 err = -errno; 75 err = -errno;
76 printk("daemon_open : data socket failed, errno = %d\n",
77 -err);
77 goto out; 78 goto out;
78 } 79 }
79 if(bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0){ 80 if(bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0){
80 printk("daemon_open : data bind failed, errno = %d\n",
81 errno);
82 err = -errno; 81 err = -errno;
82 printk("daemon_open : data bind failed, errno = %d\n",
83 -err);
83 goto out_close; 84 goto out_close;
84 } 85 }
85 86
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 01d4ab6b0ef1..f75d7b05c481 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -370,10 +370,10 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
370 struct tty_struct *tty = line->tty; 370 struct tty_struct *tty = line->tty;
371 int err; 371 int err;
372 372
373 /* Interrupts are enabled here because we registered the interrupt with 373 /* Interrupts are disabled here because we registered the interrupt with
374 * IRQF_DISABLED (see line_setup_irq).*/ 374 * IRQF_DISABLED (see line_setup_irq).*/
375 375
376 spin_lock_irq(&line->lock); 376 spin_lock(&line->lock);
377 err = flush_buffer(line); 377 err = flush_buffer(line);
378 if (err == 0) { 378 if (err == 0) {
379 return IRQ_NONE; 379 return IRQ_NONE;
@@ -381,7 +381,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
381 line->head = line->buffer; 381 line->head = line->buffer;
382 line->tail = line->buffer; 382 line->tail = line->buffer;
383 } 383 }
384 spin_unlock_irq(&line->lock); 384 spin_unlock(&line->lock);
385 385
386 if(tty == NULL) 386 if(tty == NULL)
387 return IRQ_NONE; 387 return IRQ_NONE;
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 8138f5ea1bf7..b827e82884c9 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -50,6 +50,14 @@ static void mcast_user_init(void *data, void *dev)
50 pri->dev = dev; 50 pri->dev = dev;
51} 51}
52 52
53static void mcast_remove(void *data)
54{
55 struct mcast_data *pri = data;
56
57 kfree(pri->mcast_addr);
58 pri->mcast_addr = NULL;
59}
60
53static int mcast_open(void *data) 61static int mcast_open(void *data)
54{ 62{
55 struct mcast_data *pri = data; 63 struct mcast_data *pri = data;
@@ -157,7 +165,7 @@ const struct net_user_info mcast_user_info = {
157 .init = mcast_user_init, 165 .init = mcast_user_init,
158 .open = mcast_open, 166 .open = mcast_open,
159 .close = mcast_close, 167 .close = mcast_close,
160 .remove = NULL, 168 .remove = mcast_remove,
161 .set_mtu = mcast_set_mtu, 169 .set_mtu = mcast_set_mtu,
162 .add_address = NULL, 170 .add_address = NULL,
163 .delete_address = NULL, 171 .delete_address = NULL,
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index fc22b9bd9153..4b382a6e710f 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -179,7 +179,7 @@ static struct console ssl_cons = {
179 .write = ssl_console_write, 179 .write = ssl_console_write,
180 .device = ssl_console_device, 180 .device = ssl_console_device,
181 .setup = ssl_console_setup, 181 .setup = ssl_console_setup,
182 .flags = CON_PRINTBUFFER, 182 .flags = CON_PRINTBUFFER|CON_ANYTIME,
183 .index = -1, 183 .index = -1,
184}; 184};
185 185
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 7ff0b0fc37e7..76d1f1c980ef 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -153,7 +153,7 @@ static struct console stdiocons = {
153 .write = uml_console_write, 153 .write = uml_console_write,
154 .device = uml_console_device, 154 .device = uml_console_device,
155 .setup = uml_console_setup, 155 .setup = uml_console_setup,
156 .flags = CON_PRINTBUFFER, 156 .flags = CON_PRINTBUFFER|CON_ANYTIME,
157 .index = -1, 157 .index = -1,
158}; 158};
159 159
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 8629bd191492..5c74da410451 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -192,7 +192,9 @@ extern int os_process_parent(int pid);
192extern void os_stop_process(int pid); 192extern void os_stop_process(int pid);
193extern void os_kill_process(int pid, int reap_child); 193extern void os_kill_process(int pid, int reap_child);
194extern void os_kill_ptraced_process(int pid, int reap_child); 194extern void os_kill_ptraced_process(int pid, int reap_child);
195#ifdef UML_CONFIG_MODE_TT
195extern void os_usr1_process(int pid); 196extern void os_usr1_process(int pid);
197#endif
196extern long os_ptrace_ldt(long pid, long addr, long data); 198extern long os_ptrace_ldt(long pid, long addr, long data);
197 199
198extern int os_getpid(void); 200extern int os_getpid(void);
@@ -261,7 +263,6 @@ extern void block_signals(void);
261extern void unblock_signals(void); 263extern void unblock_signals(void);
262extern int get_signals(void); 264extern int get_signals(void);
263extern int set_signals(int enable); 265extern int set_signals(int enable);
264extern void os_usr1_signal(int on);
265 266
266/* trap.c */ 267/* trap.c */
267extern void os_fill_handlinfo(struct kern_handlers h); 268extern void os_fill_handlinfo(struct kern_handlers h);
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 50a288bb875a..dbf2f5bc842f 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -142,6 +142,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
142 .events = events, 142 .events = events,
143 .current_events = 0 } ); 143 .current_events = 0 } );
144 144
145 err = -EBUSY;
145 spin_lock_irqsave(&irq_lock, flags); 146 spin_lock_irqsave(&irq_lock, flags);
146 for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) { 147 for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) {
147 if ((irq_fd->fd == fd) && (irq_fd->type == type)) { 148 if ((irq_fd->fd == fd) && (irq_fd->type == type)) {
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index c692a192957a..76bdd6712417 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -21,6 +21,7 @@
21#include "longjmp.h" 21#include "longjmp.h"
22#include "skas_ptrace.h" 22#include "skas_ptrace.h"
23#include "kern_constants.h" 23#include "kern_constants.h"
24#include "uml-config.h"
24 25
25#define ARBITRARY_ADDR -1 26#define ARBITRARY_ADDR -1
26#define FAILURE_PID -1 27#define FAILURE_PID -1
@@ -131,10 +132,12 @@ void os_kill_ptraced_process(int pid, int reap_child)
131 CATCH_EINTR(waitpid(pid, NULL, 0)); 132 CATCH_EINTR(waitpid(pid, NULL, 0));
132} 133}
133 134
135#ifdef UML_CONFIG_MODE_TT
134void os_usr1_process(int pid) 136void os_usr1_process(int pid)
135{ 137{
136 kill(pid, SIGUSR1); 138 kill(pid, SIGUSR1);
137} 139}
140#endif
138 141
139/* Don't use the glibc version, which caches the result in TLS. It misses some 142/* Don't use the glibc version, which caches the result in TLS. It misses some
140 * syscalls, and also breaks with clone(), which does not unshare the TLS. 143 * syscalls, and also breaks with clone(), which does not unshare the TLS.
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index b897e8592d77..266768629fee 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -243,8 +243,3 @@ int set_signals(int enable)
243 243
244 return ret; 244 return ret;
245} 245}
246
247void os_usr1_signal(int on)
248{
249 change_sig(SIGUSR1, on);
250}
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 01b91f9fa789..b3f6350cac44 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -103,6 +103,9 @@ long arch_prctl_skas(struct task_struct *task, int code,
103 103
104 switch(code){ 104 switch(code){
105 case ARCH_SET_FS: 105 case ARCH_SET_FS:
106 current->thread.arch.fs = (unsigned long) ptr;
107 save_registers(pid, &current->thread.regs.regs);
108 break;
106 case ARCH_SET_GS: 109 case ARCH_SET_GS:
107 save_registers(pid, &current->thread.regs.regs); 110 save_registers(pid, &current->thread.regs.regs);
108 break; 111 break;
@@ -140,9 +143,8 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
140 143
141void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) 144void arch_switch_to_skas(struct task_struct *from, struct task_struct *to)
142{ 145{
143 if(to->thread.arch.fs == 0) 146 if((to->thread.arch.fs == 0) || (to->mm == NULL))
144 return; 147 return;
145 148
146 arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); 149 arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs);
147} 150}
148
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c
index 04566fe5de49..4de3a54318f4 100644
--- a/arch/x86_64/ia32/ptrace32.c
+++ b/arch/x86_64/ia32/ptrace32.c
@@ -243,6 +243,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
243 case PTRACE_SINGLESTEP: 243 case PTRACE_SINGLESTEP:
244 case PTRACE_DETACH: 244 case PTRACE_DETACH:
245 case PTRACE_SYSCALL: 245 case PTRACE_SYSCALL:
246 case PTRACE_OLDSETOPTIONS:
246 case PTRACE_SETOPTIONS: 247 case PTRACE_SETOPTIONS:
247 case PTRACE_SET_THREAD_AREA: 248 case PTRACE_SET_THREAD_AREA:
248 case PTRACE_GET_THREAD_AREA: 249 case PTRACE_GET_THREAD_AREA:
diff --git a/arch/x86_64/kernel/early-quirks.c b/arch/x86_64/kernel/early-quirks.c
index 8047ea8c2ab2..dec587b293bf 100644
--- a/arch/x86_64/kernel/early-quirks.c
+++ b/arch/x86_64/kernel/early-quirks.c
@@ -30,11 +30,8 @@ static void via_bugs(void)
30 30
31#ifdef CONFIG_ACPI 31#ifdef CONFIG_ACPI
32 32
33static int nvidia_hpet_detected __initdata;
34
35static int __init nvidia_hpet_check(struct acpi_table_header *header) 33static int __init nvidia_hpet_check(struct acpi_table_header *header)
36{ 34{
37 nvidia_hpet_detected = 1;
38 return 0; 35 return 0;
39} 36}
40#endif 37#endif
@@ -52,11 +49,7 @@ static void nvidia_bugs(void)
52 if (acpi_use_timer_override) 49 if (acpi_use_timer_override)
53 return; 50 return;
54 51
55 nvidia_hpet_detected = 0; 52 if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check)) {
56 if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check))
57 return;
58
59 if (nvidia_hpet_detected == 0) {
60 acpi_skip_timer_override = 1; 53 acpi_skip_timer_override = 1;
61 printk(KERN_INFO "Nvidia board " 54 printk(KERN_INFO "Nvidia board "
62 "detected. Ignoring ACPI " 55 "detected. Ignoring ACPI "
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 35443729aad8..cd4643a37022 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -923,8 +923,9 @@ void __init smp_prepare_boot_cpu(void)
923 */ 923 */
924int __cpuinit __cpu_up(unsigned int cpu) 924int __cpuinit __cpu_up(unsigned int cpu)
925{ 925{
926 int err;
927 int apicid = cpu_present_to_apicid(cpu); 926 int apicid = cpu_present_to_apicid(cpu);
927 unsigned long flags;
928 int err;
928 929
929 WARN_ON(irqs_disabled()); 930 WARN_ON(irqs_disabled());
930 931
@@ -958,7 +959,9 @@ int __cpuinit __cpu_up(unsigned int cpu)
958 /* 959 /*
959 * Make sure and check TSC sync: 960 * Make sure and check TSC sync:
960 */ 961 */
962 local_irq_save(flags);
961 check_tsc_sync_source(cpu); 963 check_tsc_sync_source(cpu);
964 local_irq_restore(flags);
962 965
963 while (!cpu_isset(cpu, cpu_online_map)) 966 while (!cpu_isset(cpu, cpu_online_map))
964 cpu_relax(); 967 cpu_relax();
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 7c49e103cf8f..4a3220b218d8 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -243,6 +243,17 @@ config ACPI_IBM_DOCK
243 243
244 If you are not sure, say N here. 244 If you are not sure, say N here.
245 245
246config ACPI_IBM_BAY
247 bool "Legacy Removable Bay Support"
248 depends on ACPI_IBM
249 default y
250 ---help---
251 Allows the ibm_acpi driver to handle removable bays. It will allow
252 disabling the device in the bay, and also generate notifications when
253 the bay lever is ejected or inserted.
254
255 If you are not sure, say Y here.
256
246config ACPI_TOSHIBA 257config ACPI_TOSHIBA
247 tristate "Toshiba Laptop Extras" 258 tristate "Toshiba Laptop Extras"
248 depends on X86 259 depends on X86
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 4cc534e36e81..36901362fd24 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -86,6 +86,7 @@
86 86
87#include <linux/proc_fs.h> 87#include <linux/proc_fs.h>
88#include <linux/backlight.h> 88#include <linux/backlight.h>
89#include <linux/fb.h>
89#include <asm/uaccess.h> 90#include <asm/uaccess.h>
90 91
91#include <linux/dmi.h> 92#include <linux/dmi.h>
@@ -157,6 +158,7 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */
157 "\\_SB.PCI.ISA.SLCE", /* 570 */ 158 "\\_SB.PCI.ISA.SLCE", /* 570 */
158 ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */ 159 ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */
159#endif 160#endif
161#ifdef CONFIG_ACPI_IBM_BAY
160IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */ 162IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */
161 "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */ 163 "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */
162 "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */ 164 "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */
@@ -174,6 +176,7 @@ IBM_HANDLE(bay2, root, "\\_SB.PCI0.IDE0.PRIM.SLAV", /* A3x, R32 */
174IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */ 176IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */
175 "_EJ0", /* 770x */ 177 "_EJ0", /* 770x */
176 ); /* all others */ 178 ); /* all others */
179#endif /* CONFIG_ACPI_IBM_BAY */
177 180
178/* don't list other alternatives as we install a notify handler on the 570 */ 181/* don't list other alternatives as we install a notify handler on the 570 */
179IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ 182IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */
@@ -1044,6 +1047,7 @@ static int light_write(char *buf)
1044 return 0; 1047 return 0;
1045} 1048}
1046 1049
1050#if defined(CONFIG_ACPI_IBM_DOCK) || defined(CONFIG_ACPI_IBM_BAY)
1047static int _sta(acpi_handle handle) 1051static int _sta(acpi_handle handle)
1048{ 1052{
1049 int status; 1053 int status;
@@ -1053,6 +1057,7 @@ static int _sta(acpi_handle handle)
1053 1057
1054 return status; 1058 return status;
1055} 1059}
1060#endif
1056 1061
1057#ifdef CONFIG_ACPI_IBM_DOCK 1062#ifdef CONFIG_ACPI_IBM_DOCK
1058#define dock_docked() (_sta(dock_handle) & 1) 1063#define dock_docked() (_sta(dock_handle) & 1)
@@ -1119,6 +1124,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
1119} 1124}
1120#endif 1125#endif
1121 1126
1127#ifdef CONFIG_ACPI_IBM_BAY
1122static int bay_status_supported; 1128static int bay_status_supported;
1123static int bay_status2_supported; 1129static int bay_status2_supported;
1124static int bay_eject_supported; 1130static int bay_eject_supported;
@@ -1194,6 +1200,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event)
1194{ 1200{
1195 acpi_bus_generate_event(ibm->device, event, 0); 1201 acpi_bus_generate_event(ibm->device, event, 0);
1196} 1202}
1203#endif /* CONFIG_ACPI_IBM_BAY */
1197 1204
1198static int cmos_read(char *p) 1205static int cmos_read(char *p)
1199{ 1206{
@@ -1701,7 +1708,10 @@ static int brightness_write(char *buf)
1701 1708
1702static int brightness_update_status(struct backlight_device *bd) 1709static int brightness_update_status(struct backlight_device *bd)
1703{ 1710{
1704 return brightness_set(bd->props.brightness); 1711 return brightness_set(
1712 (bd->props.fb_blank == FB_BLANK_UNBLANK &&
1713 bd->props.power == FB_BLANK_UNBLANK) ?
1714 bd->props.brightness : 0);
1705} 1715}
1706 1716
1707static struct backlight_ops ibm_backlight_data = { 1717static struct backlight_ops ibm_backlight_data = {
@@ -1711,6 +1721,12 @@ static struct backlight_ops ibm_backlight_data = {
1711 1721
1712static int brightness_init(void) 1722static int brightness_init(void)
1713{ 1723{
1724 int b;
1725
1726 b = brightness_get(NULL);
1727 if (b < 0)
1728 return b;
1729
1714 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, 1730 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
1715 &ibm_backlight_data); 1731 &ibm_backlight_data);
1716 if (IS_ERR(ibm_backlight_device)) { 1732 if (IS_ERR(ibm_backlight_device)) {
@@ -1718,7 +1734,9 @@ static int brightness_init(void)
1718 return PTR_ERR(ibm_backlight_device); 1734 return PTR_ERR(ibm_backlight_device);
1719 } 1735 }
1720 1736
1721 ibm_backlight_device->props.max_brightness = 7; 1737 ibm_backlight_device->props.max_brightness = 7;
1738 ibm_backlight_device->props.brightness = b;
1739 backlight_update_status(ibm_backlight_device);
1722 1740
1723 return 0; 1741 return 0;
1724} 1742}
@@ -2353,6 +2371,7 @@ static struct ibm_struct ibms[] = {
2353 .type = ACPI_SYSTEM_NOTIFY, 2371 .type = ACPI_SYSTEM_NOTIFY,
2354 }, 2372 },
2355#endif 2373#endif
2374#ifdef CONFIG_ACPI_IBM_BAY
2356 { 2375 {
2357 .name = "bay", 2376 .name = "bay",
2358 .init = bay_init, 2377 .init = bay_init,
@@ -2362,6 +2381,7 @@ static struct ibm_struct ibms[] = {
2362 .handle = &bay_handle, 2381 .handle = &bay_handle,
2363 .type = ACPI_SYSTEM_NOTIFY, 2382 .type = ACPI_SYSTEM_NOTIFY,
2364 }, 2383 },
2384#endif /* CONFIG_ACPI_IBM_BAY */
2365 { 2385 {
2366 .name = "cmos", 2386 .name = "cmos",
2367 .read = cmos_read, 2387 .read = cmos_read,
@@ -2647,7 +2667,9 @@ IBM_PARAM(light);
2647#ifdef CONFIG_ACPI_IBM_DOCK 2667#ifdef CONFIG_ACPI_IBM_DOCK
2648IBM_PARAM(dock); 2668IBM_PARAM(dock);
2649#endif 2669#endif
2670#ifdef CONFIG_ACPI_IBM_BAY
2650IBM_PARAM(bay); 2671IBM_PARAM(bay);
2672#endif /* CONFIG_ACPI_IBM_BAY */
2651IBM_PARAM(cmos); 2673IBM_PARAM(cmos);
2652IBM_PARAM(led); 2674IBM_PARAM(led);
2653IBM_PARAM(beep); 2675IBM_PARAM(beep);
@@ -2723,12 +2745,14 @@ static int __init acpi_ibm_init(void)
2723 IBM_HANDLE_INIT(dock); 2745 IBM_HANDLE_INIT(dock);
2724#endif 2746#endif
2725 IBM_HANDLE_INIT(pci); 2747 IBM_HANDLE_INIT(pci);
2748#ifdef CONFIG_ACPI_IBM_BAY
2726 IBM_HANDLE_INIT(bay); 2749 IBM_HANDLE_INIT(bay);
2727 if (bay_handle) 2750 if (bay_handle)
2728 IBM_HANDLE_INIT(bay_ej); 2751 IBM_HANDLE_INIT(bay_ej);
2729 IBM_HANDLE_INIT(bay2); 2752 IBM_HANDLE_INIT(bay2);
2730 if (bay2_handle) 2753 if (bay2_handle)
2731 IBM_HANDLE_INIT(bay2_ej); 2754 IBM_HANDLE_INIT(bay2_ej);
2755#endif /* CONFIG_ACPI_IBM_BAY */
2732 IBM_HANDLE_INIT(beep); 2756 IBM_HANDLE_INIT(beep);
2733 IBM_HANDLE_INIT(ecrd); 2757 IBM_HANDLE_INIT(ecrd);
2734 IBM_HANDLE_INIT(ecwr); 2758 IBM_HANDLE_INIT(ecwr);
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 1ef338545dfe..547eee7537bc 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -436,8 +436,6 @@ int acpi_power_transition(struct acpi_device *device, int state)
436 cl = &device->power.states[device->power.state].resources; 436 cl = &device->power.states[device->power.state].resources;
437 tl = &device->power.states[state].resources; 437 tl = &device->power.states[state].resources;
438 438
439 device->power.state = ACPI_STATE_UNKNOWN;
440
441 if (!cl->count && !tl->count) { 439 if (!cl->count && !tl->count) {
442 result = -ENODEV; 440 result = -ENODEV;
443 goto end; 441 goto end;
@@ -468,12 +466,15 @@ int acpi_power_transition(struct acpi_device *device, int state)
468 goto end; 466 goto end;
469 } 467 }
470 468
471 /* We shouldn't change the state till all above operations succeed */ 469 end:
472 device->power.state = state; 470 if (result) {
473 end: 471 device->power.state = ACPI_STATE_UNKNOWN;
474 if (result)
475 printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", 472 printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n",
476 device->pnp.bus_id, state); 473 device->pnp.bus_id, state);
474 } else {
475 /* We shouldn't change the state till all above operations succeed */
476 device->power.state = state;
477 }
477 478
478 return result; 479 return result;
479} 480}
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 1358c06a969c..cc48ab05676c 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -191,6 +191,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); 191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
192 192
193 for (index = 0; index < number_of_elements; index++) { 193 for (index = 0; index < number_of_elements; index++) {
194 int source_name_index = 2;
195 int source_index_index = 3;
196
194 /* 197 /*
195 * Point user_prt past this current structure 198 * Point user_prt past this current structure
196 * 199 *
@@ -261,10 +264,28 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
261 } 264 }
262 265
263 /* 266 /*
267 * If BIOS erroneously reversed the _PRT source_name and source_index,
268 * then reverse them back.
269 */
270 if (ACPI_GET_OBJECT_TYPE (sub_object_list[3]) != ACPI_TYPE_INTEGER) {
271 if (acpi_gbl_enable_interpreter_slack) {
272 source_name_index = 3;
273 source_index_index = 2;
274 printk(KERN_WARNING "ACPI: Handling Garbled _PRT entry\n");
275 } else {
276 ACPI_ERROR((AE_INFO,
277 "(PRT[%X].source_index) Need Integer, found %s",
278 index,
279 acpi_ut_get_object_type_name(sub_object_list[3])));
280 return_ACPI_STATUS(AE_BAD_DATA);
281 }
282 }
283
284 /*
264 * 3) Third subobject: Dereference the PRT.source_name 285 * 3) Third subobject: Dereference the PRT.source_name
265 * The name may be unresolved (slack mode), so allow a null object 286 * The name may be unresolved (slack mode), so allow a null object
266 */ 287 */
267 obj_desc = sub_object_list[2]; 288 obj_desc = sub_object_list[source_name_index];
268 if (obj_desc) { 289 if (obj_desc) {
269 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { 290 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
270 case ACPI_TYPE_LOCAL_REFERENCE: 291 case ACPI_TYPE_LOCAL_REFERENCE:
@@ -339,7 +360,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
339 360
340 /* 4) Fourth subobject: Dereference the PRT.source_index */ 361 /* 4) Fourth subobject: Dereference the PRT.source_index */
341 362
342 obj_desc = sub_object_list[3]; 363 obj_desc = sub_object_list[source_index_index];
343 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 364 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
344 user_prt->source_index = (u32) obj_desc->integer.value; 365 user_prt->source_index = (u32) obj_desc->integer.value;
345 } else { 366 } else {
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index dc42ba1b46f7..b952c584338f 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -93,7 +93,7 @@
93#include <linux/libata.h> 93#include <linux/libata.h>
94 94
95#define DRV_NAME "ata_piix" 95#define DRV_NAME "ata_piix"
96#define DRV_VERSION "2.10" 96#define DRV_VERSION "2.10ac1"
97 97
98enum { 98enum {
99 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 99 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
@@ -667,14 +667,9 @@ static int ich_pata_prereset(struct ata_port *ap)
667{ 667{
668 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 668 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
669 669
670 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) { 670 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))
671 ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); 671 return -ENOENT;
672 ap->eh_context.i.action &= ~ATA_EH_RESET_MASK;
673 return 0;
674 }
675
676 ich_pata_cbl_detect(ap); 672 ich_pata_cbl_detect(ap);
677
678 return ata_std_prereset(ap); 673 return ata_std_prereset(ap);
679} 674}
680 675
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index d14a48e75f1b..c428a56e6f31 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -34,6 +34,13 @@ struct taskfile_array {
34 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ 34 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */
35}; 35};
36 36
37/*
38 * Helper - belongs in the PCI layer somewhere eventually
39 */
40static int is_pci_dev(struct device *dev)
41{
42 return (dev->bus == &pci_bus_type);
43}
37 44
38/** 45/**
39 * sata_get_dev_handle - finds acpi_handle and PCI device.function 46 * sata_get_dev_handle - finds acpi_handle and PCI device.function
@@ -53,6 +60,9 @@ static int sata_get_dev_handle(struct device *dev, acpi_handle *handle,
53 struct pci_dev *pci_dev; 60 struct pci_dev *pci_dev;
54 acpi_integer addr; 61 acpi_integer addr;
55 62
63 if (!is_pci_dev(dev))
64 return -ENODEV;
65
56 pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */ 66 pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */
57 /* Please refer to the ACPI spec for the syntax of _ADR. */ 67 /* Please refer to the ACPI spec for the syntax of _ADR. */
58 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 68 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
@@ -84,7 +94,12 @@ static int pata_get_dev_handle(struct device *dev, acpi_handle *handle,
84 acpi_status status; 94 acpi_status status;
85 struct acpi_device_info *dinfo = NULL; 95 struct acpi_device_info *dinfo = NULL;
86 int ret = -ENODEV; 96 int ret = -ENODEV;
87 struct pci_dev *pdev = to_pci_dev(dev); 97 struct pci_dev *pdev;
98
99 if (!is_pci_dev(dev))
100 return -ENODEV;
101
102 pdev = to_pci_dev(dev);
88 103
89 bus = pdev->bus->number; 104 bus = pdev->bus->number;
90 devnum = PCI_SLOT(pdev->devfn); 105 devnum = PCI_SLOT(pdev->devfn);
@@ -561,6 +576,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
561 576
562 if (noacpi) 577 if (noacpi)
563 return 0; 578 return 0;
579 /*
580 * TBD - implement PATA support. For now,
581 * we should not run GTF on PATA devices since some
582 * PATA require execution of GTM/STM before GTF.
583 */
584 if (!(ap->cbl == ATA_CBL_SATA))
585 return 0;
564 586
565 for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { 587 for (ix = 0; ix < ATA_MAX_DEVICES; ix++) {
566 if (!ata_dev_enabled(&ap->device[ix])) 588 if (!ata_dev_enabled(&ap->device[ix]))
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index dc362fa01ca4..3c1f8830ac8b 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3455,7 +3455,8 @@ static void ata_dev_xfermask(struct ata_device *dev)
3455 "device is on DMA blacklist, disabling DMA\n"); 3455 "device is on DMA blacklist, disabling DMA\n");
3456 } 3456 }
3457 3457
3458 if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed != ap) { 3458 if ((host->flags & ATA_HOST_SIMPLEX) &&
3459 host->simplex_claimed && host->simplex_claimed != ap) {
3459 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 3460 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
3460 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " 3461 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by "
3461 "other device, disabling DMA\n"); 3462 "other device, disabling DMA\n");
@@ -5684,18 +5685,22 @@ static void ata_host_release(struct device *gendev, void *res)
5684 for (i = 0; i < host->n_ports; i++) { 5685 for (i = 0; i < host->n_ports; i++) {
5685 struct ata_port *ap = host->ports[i]; 5686 struct ata_port *ap = host->ports[i];
5686 5687
5687 if (!ap) 5688 if (ap && ap->ops->port_stop)
5688 continue;
5689
5690 if (ap->ops->port_stop)
5691 ap->ops->port_stop(ap); 5689 ap->ops->port_stop(ap);
5692
5693 scsi_host_put(ap->scsi_host);
5694 } 5690 }
5695 5691
5696 if (host->ops->host_stop) 5692 if (host->ops->host_stop)
5697 host->ops->host_stop(host); 5693 host->ops->host_stop(host);
5698 5694
5695 for (i = 0; i < host->n_ports; i++) {
5696 struct ata_port *ap = host->ports[i];
5697
5698 if (ap)
5699 scsi_host_put(ap->scsi_host);
5700
5701 host->ports[i] = NULL;
5702 }
5703
5699 dev_set_drvdata(gendev, NULL); 5704 dev_set_drvdata(gendev, NULL);
5700} 5705}
5701 5706
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 388d07fab5f7..9d9670a9b117 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -874,8 +874,14 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
874 874
875 if (status & (NV_ADMA_STAT_DONE | 875 if (status & (NV_ADMA_STAT_DONE |
876 NV_ADMA_STAT_CPBERR)) { 876 NV_ADMA_STAT_CPBERR)) {
877 u32 check_commands = notifier | notifier_error; 877 u32 check_commands;
878 int pos, error = 0; 878 int pos, error = 0;
879
880 if(ata_tag_valid(ap->active_tag))
881 check_commands = 1 << ap->active_tag;
882 else
883 check_commands = ap->sactive;
884
879 /** Check CPBs for completed commands */ 885 /** Check CPBs for completed commands */
880 while ((pos = ffs(check_commands)) && !error) { 886 while ((pos = ffs(check_commands)) && !error) {
881 pos--; 887 pos--;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index cf2a398aaaa1..89ebe3682726 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -787,6 +787,13 @@ void device_del(struct device * dev)
787 device_remove_attrs(dev); 787 device_remove_attrs(dev);
788 bus_remove_device(dev); 788 bus_remove_device(dev);
789 789
790 /*
791 * Some platform devices are driven without driver attached
792 * and managed resources may have been acquired. Make sure
793 * all resources are released.
794 */
795 devres_release_all(dev);
796
790 /* Notify the platform of the removal, in case they 797 /* Notify the platform of the removal, in case they
791 * need to do anything... 798 * need to do anything...
792 */ 799 */
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index 6d58b0370802..59146e3365ba 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -197,6 +197,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
197 197
198 hrs = alm_tm.tm_hour; 198 hrs = alm_tm.tm_hour;
199 min = alm_tm.tm_min; 199 min = alm_tm.tm_min;
200 sec = alm_tm.tm_sec;
200 201
201 if (hrs >= 24) 202 if (hrs >= 24)
202 hrs = 0xff; 203 hrs = 0xff;
@@ -204,9 +205,11 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
204 if (min >= 60) 205 if (min >= 60)
205 min = 0xff; 206 min = 0xff;
206 207
207 BIN_TO_BCD(sec); 208 if (sec != 0)
208 BIN_TO_BCD(min); 209 return -EINVAL;
209 BIN_TO_BCD(hrs); 210
211 min = BIN2BCD(min);
212 min = BIN2BCD(hrs);
210 213
211 spin_lock(&ds1286_lock); 214 spin_lock(&ds1286_lock);
212 rtc_write(hrs, RTC_HOURS_ALARM); 215 rtc_write(hrs, RTC_HOURS_ALARM);
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index a44db75bc25b..a905f7820331 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);
128 */ 128 */
129static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data) 129static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data)
130{ 130{
131 struct cn_callback_entry *__cbq; 131 struct cn_callback_entry *__cbq, *__new_cbq;
132 struct cn_dev *dev = &cdev; 132 struct cn_dev *dev = &cdev;
133 int err = -ENODEV; 133 int err = -ENODEV;
134 134
@@ -148,27 +148,27 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
148 } else { 148 } else {
149 struct cn_callback_data *d; 149 struct cn_callback_data *d;
150 150
151 __cbq = kzalloc(sizeof(*__cbq), GFP_ATOMIC); 151 err = -ENOMEM;
152 if (__cbq) { 152 __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
153 d = &__cbq->data; 153 if (__new_cbq) {
154 d = &__new_cbq->data;
154 d->callback_priv = msg; 155 d->callback_priv = msg;
155 d->callback = __cbq->data.callback; 156 d->callback = __cbq->data.callback;
156 d->ddata = data; 157 d->ddata = data;
157 d->destruct_data = destruct_data; 158 d->destruct_data = destruct_data;
158 d->free = __cbq; 159 d->free = __new_cbq;
159 160
160 INIT_WORK(&__cbq->work, 161 INIT_WORK(&__new_cbq->work,
161 &cn_queue_wrapper); 162 &cn_queue_wrapper);
162 163
163 if (queue_work(dev->cbdev->cn_queue, 164 if (queue_work(dev->cbdev->cn_queue,
164 &__cbq->work)) 165 &__new_cbq->work))
165 err = 0; 166 err = 0;
166 else { 167 else {
167 kfree(__cbq); 168 kfree(__new_cbq);
168 err = -EINVAL; 169 err = -EINVAL;
169 } 170 }
170 } else 171 }
171 err = -ENOMEM;
172 } 172 }
173 break; 173 break;
174 } 174 }
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d441815a3e0c..fde92ce45153 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1821,7 +1821,7 @@ static int cma_alloc_port(struct idr *ps, struct rdma_id_private *id_priv,
1821 struct rdma_bind_list *bind_list; 1821 struct rdma_bind_list *bind_list;
1822 int port, ret; 1822 int port, ret;
1823 1823
1824 bind_list = kmalloc(sizeof *bind_list, GFP_KERNEL); 1824 bind_list = kzalloc(sizeof *bind_list, GFP_KERNEL);
1825 if (!bind_list) 1825 if (!bind_list)
1826 return -ENOMEM; 1826 return -ENOMEM;
1827 1827
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index b516b93b8550..c859134c1daa 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -266,7 +266,7 @@ static int ucma_event_handler(struct rdma_cm_id *cm_id,
266 mutex_lock(&ctx->file->mut); 266 mutex_lock(&ctx->file->mut);
267 if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) { 267 if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) {
268 if (!ctx->backlog) { 268 if (!ctx->backlog) {
269 ret = -EDQUOT; 269 ret = -ENOMEM;
270 kfree(uevent); 270 kfree(uevent);
271 goto out; 271 goto out;
272 } 272 }
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index d737c738d876..818cf1aee8c7 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -36,6 +36,7 @@
36#include <linux/sched.h> 36#include <linux/sched.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/dma-mapping.h>
39 40
40#include "cxio_resource.h" 41#include "cxio_resource.h"
41#include "cxio_hal.h" 42#include "cxio_hal.h"
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index b21fde8b659d..d0ed1d35ca3e 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -305,8 +305,7 @@ static int status2errno(int status)
305 */ 305 */
306static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) 306static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp)
307{ 307{
308 if (skb) { 308 if (skb && !skb_is_nonlinear(skb) && !skb_cloned(skb)) {
309 BUG_ON(skb_cloned(skb));
310 skb_trim(skb, 0); 309 skb_trim(skb, 0);
311 skb_get(skb); 310 skb_get(skb);
312 } else { 311 } else {
@@ -1415,6 +1414,7 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1415 wake_up(&ep->com.waitq); 1414 wake_up(&ep->com.waitq);
1416 break; 1415 break;
1417 case FPDU_MODE: 1416 case FPDU_MODE:
1417 start_ep_timer(ep);
1418 __state_set(&ep->com, CLOSING); 1418 __state_set(&ep->com, CLOSING);
1419 attrs.next_state = IWCH_QP_STATE_CLOSING; 1419 attrs.next_state = IWCH_QP_STATE_CLOSING;
1420 iwch_modify_qp(ep->com.qp->rhp, ep->com.qp, 1420 iwch_modify_qp(ep->com.qp->rhp, ep->com.qp,
@@ -1425,7 +1425,6 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1425 disconnect = 0; 1425 disconnect = 0;
1426 break; 1426 break;
1427 case CLOSING: 1427 case CLOSING:
1428 start_ep_timer(ep);
1429 __state_set(&ep->com, MORIBUND); 1428 __state_set(&ep->com, MORIBUND);
1430 disconnect = 0; 1429 disconnect = 0;
1431 break; 1430 break;
@@ -1487,8 +1486,10 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1487 case CONNECTING: 1486 case CONNECTING:
1488 break; 1487 break;
1489 case MPA_REQ_WAIT: 1488 case MPA_REQ_WAIT:
1489 stop_ep_timer(ep);
1490 break; 1490 break;
1491 case MPA_REQ_SENT: 1491 case MPA_REQ_SENT:
1492 stop_ep_timer(ep);
1492 connect_reply_upcall(ep, -ECONNRESET); 1493 connect_reply_upcall(ep, -ECONNRESET);
1493 break; 1494 break;
1494 case MPA_REP_SENT: 1495 case MPA_REP_SENT:
@@ -1507,9 +1508,10 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1507 get_ep(&ep->com); 1508 get_ep(&ep->com);
1508 break; 1509 break;
1509 case MORIBUND: 1510 case MORIBUND:
1511 case CLOSING:
1510 stop_ep_timer(ep); 1512 stop_ep_timer(ep);
1513 /*FALLTHROUGH*/
1511 case FPDU_MODE: 1514 case FPDU_MODE:
1512 case CLOSING:
1513 if (ep->com.cm_id && ep->com.qp) { 1515 if (ep->com.cm_id && ep->com.qp) {
1514 attrs.next_state = IWCH_QP_STATE_ERROR; 1516 attrs.next_state = IWCH_QP_STATE_ERROR;
1515 ret = iwch_modify_qp(ep->com.qp->rhp, 1517 ret = iwch_modify_qp(ep->com.qp->rhp,
@@ -1570,7 +1572,6 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1570 spin_lock_irqsave(&ep->com.lock, flags); 1572 spin_lock_irqsave(&ep->com.lock, flags);
1571 switch (ep->com.state) { 1573 switch (ep->com.state) {
1572 case CLOSING: 1574 case CLOSING:
1573 start_ep_timer(ep);
1574 __state_set(&ep->com, MORIBUND); 1575 __state_set(&ep->com, MORIBUND);
1575 break; 1576 break;
1576 case MORIBUND: 1577 case MORIBUND:
@@ -1586,6 +1587,8 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1586 __state_set(&ep->com, DEAD); 1587 __state_set(&ep->com, DEAD);
1587 release = 1; 1588 release = 1;
1588 break; 1589 break;
1590 case ABORTING:
1591 break;
1589 case DEAD: 1592 case DEAD:
1590 default: 1593 default:
1591 BUG_ON(1); 1594 BUG_ON(1);
@@ -1659,6 +1662,7 @@ static void ep_timeout(unsigned long arg)
1659 break; 1662 break;
1660 case MPA_REQ_WAIT: 1663 case MPA_REQ_WAIT:
1661 break; 1664 break;
1665 case CLOSING:
1662 case MORIBUND: 1666 case MORIBUND:
1663 if (ep->com.cm_id && ep->com.qp) { 1667 if (ep->com.cm_id && ep->com.qp) {
1664 attrs.next_state = IWCH_QP_STATE_ERROR; 1668 attrs.next_state = IWCH_QP_STATE_ERROR;
@@ -1687,12 +1691,11 @@ int iwch_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
1687 return -ECONNRESET; 1691 return -ECONNRESET;
1688 } 1692 }
1689 BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD); 1693 BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD);
1690 state_set(&ep->com, CLOSING);
1691 if (mpa_rev == 0) 1694 if (mpa_rev == 0)
1692 abort_connection(ep, NULL, GFP_KERNEL); 1695 abort_connection(ep, NULL, GFP_KERNEL);
1693 else { 1696 else {
1694 err = send_mpa_reject(ep, pdata, pdata_len); 1697 err = send_mpa_reject(ep, pdata, pdata_len);
1695 err = send_halfclose(ep, GFP_KERNEL); 1698 err = iwch_ep_disconnect(ep, 0, GFP_KERNEL);
1696 } 1699 }
1697 return 0; 1700 return 0;
1698} 1701}
@@ -1957,11 +1960,11 @@ int iwch_ep_disconnect(struct iwch_ep *ep, int abrupt, gfp_t gfp)
1957 case MPA_REQ_RCVD: 1960 case MPA_REQ_RCVD:
1958 case MPA_REP_SENT: 1961 case MPA_REP_SENT:
1959 case FPDU_MODE: 1962 case FPDU_MODE:
1963 start_ep_timer(ep);
1960 ep->com.state = CLOSING; 1964 ep->com.state = CLOSING;
1961 close = 1; 1965 close = 1;
1962 break; 1966 break;
1963 case CLOSING: 1967 case CLOSING:
1964 start_ep_timer(ep);
1965 ep->com.state = MORIBUND; 1968 ep->com.state = MORIBUND;
1966 close = 1; 1969 close = 1;
1967 break; 1970 break;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_ev.c b/drivers/infiniband/hw/cxgb3/iwch_ev.c
index 54362afbf72f..b40676662a8a 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_ev.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_ev.c
@@ -47,12 +47,6 @@ static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp,
47 struct iwch_qp_attributes attrs; 47 struct iwch_qp_attributes attrs;
48 struct iwch_qp *qhp; 48 struct iwch_qp *qhp;
49 49
50 printk(KERN_ERR "%s - AE qpid 0x%x opcode %d status 0x%x "
51 "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__,
52 CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe),
53 CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe),
54 CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe));
55
56 spin_lock(&rnicp->lock); 50 spin_lock(&rnicp->lock);
57 qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe)); 51 qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe));
58 52
@@ -73,6 +67,12 @@ static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp,
73 return; 67 return;
74 } 68 }
75 69
70 printk(KERN_ERR "%s - AE qpid 0x%x opcode %d status 0x%x "
71 "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__,
72 CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe),
73 CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe),
74 CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe));
75
76 atomic_inc(&qhp->refcnt); 76 atomic_inc(&qhp->refcnt);
77 spin_unlock(&rnicp->lock); 77 spin_unlock(&rnicp->lock);
78 78
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 9947a144a929..f2774ae906bf 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -331,6 +331,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
331 int ret = 0; 331 int ret = 0;
332 struct iwch_mm_entry *mm; 332 struct iwch_mm_entry *mm;
333 struct iwch_ucontext *ucontext; 333 struct iwch_ucontext *ucontext;
334 u64 addr;
334 335
335 PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff, 336 PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff,
336 key, len); 337 key, len);
@@ -345,10 +346,11 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
345 mm = remove_mmap(ucontext, key, len); 346 mm = remove_mmap(ucontext, key, len);
346 if (!mm) 347 if (!mm)
347 return -EINVAL; 348 return -EINVAL;
349 addr = mm->addr;
348 kfree(mm); 350 kfree(mm);
349 351
350 if ((mm->addr >= rdev_p->rnic_info.udbell_physbase) && 352 if ((addr >= rdev_p->rnic_info.udbell_physbase) &&
351 (mm->addr < (rdev_p->rnic_info.udbell_physbase + 353 (addr < (rdev_p->rnic_info.udbell_physbase +
352 rdev_p->rnic_info.udbell_len))) { 354 rdev_p->rnic_info.udbell_len))) {
353 355
354 /* 356 /*
@@ -362,7 +364,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
362 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; 364 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND;
363 vma->vm_flags &= ~VM_MAYREAD; 365 vma->vm_flags &= ~VM_MAYREAD;
364 ret = io_remap_pfn_range(vma, vma->vm_start, 366 ret = io_remap_pfn_range(vma, vma->vm_start,
365 mm->addr >> PAGE_SHIFT, 367 addr >> PAGE_SHIFT,
366 len, vma->vm_page_prot); 368 len, vma->vm_page_prot);
367 } else { 369 } else {
368 370
@@ -370,7 +372,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
370 * Map WQ or CQ contig dma memory... 372 * Map WQ or CQ contig dma memory...
371 */ 373 */
372 ret = remap_pfn_range(vma, vma->vm_start, 374 ret = remap_pfn_range(vma, vma->vm_start,
373 mm->addr >> PAGE_SHIFT, 375 addr >> PAGE_SHIFT,
374 len, vma->vm_page_prot); 376 len, vma->vm_page_prot);
375 } 377 }
376 378
@@ -463,9 +465,6 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd,
463 php = to_iwch_pd(pd); 465 php = to_iwch_pd(pd);
464 rhp = php->rhp; 466 rhp = php->rhp;
465 467
466 acc = iwch_convert_access(acc);
467
468
469 mhp = kzalloc(sizeof(*mhp), GFP_KERNEL); 468 mhp = kzalloc(sizeof(*mhp), GFP_KERNEL);
470 if (!mhp) 469 if (!mhp)
471 return ERR_PTR(-ENOMEM); 470 return ERR_PTR(-ENOMEM);
@@ -491,12 +490,7 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd,
491 mhp->attr.pdid = php->pdid; 490 mhp->attr.pdid = php->pdid;
492 mhp->attr.zbva = 0; 491 mhp->attr.zbva = 0;
493 492
494 /* NOTE: TPT perms are backwards from BIND WR perms! */ 493 mhp->attr.perms = iwch_ib_to_tpt_access(acc);
495 mhp->attr.perms = (acc & 0x1) << 3;
496 mhp->attr.perms |= (acc & 0x2) << 1;
497 mhp->attr.perms |= (acc & 0x4) >> 1;
498 mhp->attr.perms |= (acc & 0x8) >> 3;
499
500 mhp->attr.va_fbo = *iova_start; 494 mhp->attr.va_fbo = *iova_start;
501 mhp->attr.page_size = shift - 12; 495 mhp->attr.page_size = shift - 12;
502 496
@@ -525,7 +519,6 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
525 struct iwch_mr mh, *mhp; 519 struct iwch_mr mh, *mhp;
526 struct iwch_pd *php; 520 struct iwch_pd *php;
527 struct iwch_dev *rhp; 521 struct iwch_dev *rhp;
528 int new_acc;
529 __be64 *page_list = NULL; 522 __be64 *page_list = NULL;
530 int shift = 0; 523 int shift = 0;
531 u64 total_size; 524 u64 total_size;
@@ -546,14 +539,12 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
546 if (rhp != php->rhp) 539 if (rhp != php->rhp)
547 return -EINVAL; 540 return -EINVAL;
548 541
549 new_acc = mhp->attr.perms;
550
551 memcpy(&mh, mhp, sizeof *mhp); 542 memcpy(&mh, mhp, sizeof *mhp);
552 543
553 if (mr_rereg_mask & IB_MR_REREG_PD) 544 if (mr_rereg_mask & IB_MR_REREG_PD)
554 php = to_iwch_pd(pd); 545 php = to_iwch_pd(pd);
555 if (mr_rereg_mask & IB_MR_REREG_ACCESS) 546 if (mr_rereg_mask & IB_MR_REREG_ACCESS)
556 mh.attr.perms = iwch_convert_access(acc); 547 mh.attr.perms = iwch_ib_to_tpt_access(acc);
557 if (mr_rereg_mask & IB_MR_REREG_TRANS) 548 if (mr_rereg_mask & IB_MR_REREG_TRANS)
558 ret = build_phys_page_list(buffer_list, num_phys_buf, 549 ret = build_phys_page_list(buffer_list, num_phys_buf,
559 iova_start, 550 iova_start,
@@ -568,7 +559,7 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
568 if (mr_rereg_mask & IB_MR_REREG_PD) 559 if (mr_rereg_mask & IB_MR_REREG_PD)
569 mhp->attr.pdid = php->pdid; 560 mhp->attr.pdid = php->pdid;
570 if (mr_rereg_mask & IB_MR_REREG_ACCESS) 561 if (mr_rereg_mask & IB_MR_REREG_ACCESS)
571 mhp->attr.perms = acc; 562 mhp->attr.perms = iwch_ib_to_tpt_access(acc);
572 if (mr_rereg_mask & IB_MR_REREG_TRANS) { 563 if (mr_rereg_mask & IB_MR_REREG_TRANS) {
573 mhp->attr.zbva = 0; 564 mhp->attr.zbva = 0;
574 mhp->attr.va_fbo = *iova_start; 565 mhp->attr.va_fbo = *iova_start;
@@ -613,8 +604,6 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
613 goto err; 604 goto err;
614 } 605 }
615 606
616 acc = iwch_convert_access(acc);
617
618 i = n = 0; 607 i = n = 0;
619 608
620 list_for_each_entry(chunk, &region->chunk_list, list) 609 list_for_each_entry(chunk, &region->chunk_list, list)
@@ -630,10 +619,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
630 mhp->rhp = rhp; 619 mhp->rhp = rhp;
631 mhp->attr.pdid = php->pdid; 620 mhp->attr.pdid = php->pdid;
632 mhp->attr.zbva = 0; 621 mhp->attr.zbva = 0;
633 mhp->attr.perms = (acc & 0x1) << 3; 622 mhp->attr.perms = iwch_ib_to_tpt_access(acc);
634 mhp->attr.perms |= (acc & 0x2) << 1;
635 mhp->attr.perms |= (acc & 0x4) >> 1;
636 mhp->attr.perms |= (acc & 0x8) >> 3;
637 mhp->attr.va_fbo = region->virt_base; 623 mhp->attr.va_fbo = region->virt_base;
638 mhp->attr.page_size = shift - 12; 624 mhp->attr.page_size = shift - 12;
639 mhp->attr.len = (u32) region->length; 625 mhp->attr.len = (u32) region->length;
@@ -736,10 +722,8 @@ static int iwch_destroy_qp(struct ib_qp *ib_qp)
736 qhp = to_iwch_qp(ib_qp); 722 qhp = to_iwch_qp(ib_qp);
737 rhp = qhp->rhp; 723 rhp = qhp->rhp;
738 724
739 if (qhp->attr.state == IWCH_QP_STATE_RTS) { 725 attrs.next_state = IWCH_QP_STATE_ERROR;
740 attrs.next_state = IWCH_QP_STATE_ERROR; 726 iwch_modify_qp(rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, &attrs, 0);
741 iwch_modify_qp(rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, &attrs, 0);
742 }
743 wait_event(qhp->wait, !qhp->ep); 727 wait_event(qhp->wait, !qhp->ep);
744 728
745 remove_handle(rhp, &rhp->qpidr, qhp->wq.qpid); 729 remove_handle(rhp, &rhp->qpidr, qhp->wq.qpid);
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h b/drivers/infiniband/hw/cxgb3/iwch_provider.h
index de0fe1b93a0c..93bcc56756bd 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h
@@ -286,27 +286,20 @@ static inline int iwch_convert_state(enum ib_qp_state ib_state)
286 } 286 }
287} 287}
288 288
289enum iwch_mem_perms { 289static inline u32 iwch_ib_to_tpt_access(int acc)
290 IWCH_MEM_ACCESS_LOCAL_READ = 1 << 0,
291 IWCH_MEM_ACCESS_LOCAL_WRITE = 1 << 1,
292 IWCH_MEM_ACCESS_REMOTE_READ = 1 << 2,
293 IWCH_MEM_ACCESS_REMOTE_WRITE = 1 << 3,
294 IWCH_MEM_ACCESS_ATOMICS = 1 << 4,
295 IWCH_MEM_ACCESS_BINDING = 1 << 5,
296 IWCH_MEM_ACCESS_LOCAL =
297 (IWCH_MEM_ACCESS_LOCAL_READ | IWCH_MEM_ACCESS_LOCAL_WRITE),
298 IWCH_MEM_ACCESS_REMOTE =
299 (IWCH_MEM_ACCESS_REMOTE_WRITE | IWCH_MEM_ACCESS_REMOTE_READ)
300 /* cannot go beyond 1 << 31 */
301} __attribute__ ((packed));
302
303static inline u32 iwch_convert_access(int acc)
304{ 290{
305 return (acc & IB_ACCESS_REMOTE_WRITE ? IWCH_MEM_ACCESS_REMOTE_WRITE : 0) 291 return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) |
306 | (acc & IB_ACCESS_REMOTE_READ ? IWCH_MEM_ACCESS_REMOTE_READ : 0) | 292 (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0) |
307 (acc & IB_ACCESS_LOCAL_WRITE ? IWCH_MEM_ACCESS_LOCAL_WRITE : 0) | 293 (acc & IB_ACCESS_LOCAL_WRITE ? TPT_LOCAL_WRITE : 0) |
308 (acc & IB_ACCESS_MW_BIND ? IWCH_MEM_ACCESS_BINDING : 0) | 294 TPT_LOCAL_READ;
309 IWCH_MEM_ACCESS_LOCAL_READ; 295}
296
297static inline u32 iwch_ib_to_mwbind_access(int acc)
298{
299 return (acc & IB_ACCESS_REMOTE_WRITE ? T3_MEM_ACCESS_REM_WRITE : 0) |
300 (acc & IB_ACCESS_REMOTE_READ ? T3_MEM_ACCESS_REM_READ : 0) |
301 (acc & IB_ACCESS_LOCAL_WRITE ? T3_MEM_ACCESS_LOCAL_WRITE : 0) |
302 T3_MEM_ACCESS_LOCAL_READ;
310} 303}
311 304
312enum iwch_mmid_state { 305enum iwch_mmid_state {
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c
index 9ea00cc4a5f8..0a472c9b44db 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_qp.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c
@@ -439,7 +439,7 @@ int iwch_bind_mw(struct ib_qp *qp,
439 wqe->bind.type = T3_VA_BASED_TO; 439 wqe->bind.type = T3_VA_BASED_TO;
440 440
441 /* TBD: check perms */ 441 /* TBD: check perms */
442 wqe->bind.perms = iwch_convert_access(mw_bind->mw_access_flags); 442 wqe->bind.perms = iwch_ib_to_mwbind_access(mw_bind->mw_access_flags);
443 wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey); 443 wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey);
444 wqe->bind.mw_stag = cpu_to_be32(mw->rkey); 444 wqe->bind.mw_stag = cpu_to_be32(mw->rkey);
445 wqe->bind.mw_len = cpu_to_be32(mw_bind->length); 445 wqe->bind.mw_len = cpu_to_be32(mw_bind->length);
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index 40404c9e2817..82ded44c6cee 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -52,6 +52,8 @@ struct ehca_mw;
52struct ehca_pd; 52struct ehca_pd;
53struct ehca_av; 53struct ehca_av;
54 54
55#include <linux/wait.h>
56
55#include <rdma/ib_verbs.h> 57#include <rdma/ib_verbs.h>
56#include <rdma/ib_user_verbs.h> 58#include <rdma/ib_user_verbs.h>
57 59
@@ -153,7 +155,9 @@ struct ehca_cq {
153 spinlock_t cb_lock; 155 spinlock_t cb_lock;
154 struct hlist_head qp_hashtab[QP_HASHTAB_LEN]; 156 struct hlist_head qp_hashtab[QP_HASHTAB_LEN];
155 struct list_head entry; 157 struct list_head entry;
156 u32 nr_callbacks; 158 u32 nr_callbacks; /* #events assigned to cpu by scaling code */
159 u32 nr_events; /* #events seen */
160 wait_queue_head_t wait_completion;
157 spinlock_t task_lock; 161 spinlock_t task_lock;
158 u32 ownpid; 162 u32 ownpid;
159 /* mmap counter for resources mapped into user space */ 163 /* mmap counter for resources mapped into user space */
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index 6ebfa27e4e16..e2cdc1a16fe9 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -146,6 +146,7 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe,
146 spin_lock_init(&my_cq->spinlock); 146 spin_lock_init(&my_cq->spinlock);
147 spin_lock_init(&my_cq->cb_lock); 147 spin_lock_init(&my_cq->cb_lock);
148 spin_lock_init(&my_cq->task_lock); 148 spin_lock_init(&my_cq->task_lock);
149 init_waitqueue_head(&my_cq->wait_completion);
149 my_cq->ownpid = current->tgid; 150 my_cq->ownpid = current->tgid;
150 151
151 cq = &my_cq->ib_cq; 152 cq = &my_cq->ib_cq;
@@ -302,6 +303,16 @@ create_cq_exit1:
302 return cq; 303 return cq;
303} 304}
304 305
306static int get_cq_nr_events(struct ehca_cq *my_cq)
307{
308 int ret;
309 unsigned long flags;
310 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
311 ret = my_cq->nr_events;
312 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
313 return ret;
314}
315
305int ehca_destroy_cq(struct ib_cq *cq) 316int ehca_destroy_cq(struct ib_cq *cq)
306{ 317{
307 u64 h_ret; 318 u64 h_ret;
@@ -329,10 +340,11 @@ int ehca_destroy_cq(struct ib_cq *cq)
329 } 340 }
330 341
331 spin_lock_irqsave(&ehca_cq_idr_lock, flags); 342 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
332 while (my_cq->nr_callbacks) { 343 while (my_cq->nr_events) {
333 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); 344 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
334 yield(); 345 wait_event(my_cq->wait_completion, !get_cq_nr_events(my_cq));
335 spin_lock_irqsave(&ehca_cq_idr_lock, flags); 346 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
347 /* recheck nr_events to assure no cqe has just arrived */
336 } 348 }
337 349
338 idr_remove(&ehca_cq_idr, my_cq->token); 350 idr_remove(&ehca_cq_idr, my_cq->token);
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c
index 3ec53c687d08..20f36bf8b2b6 100644
--- a/drivers/infiniband/hw/ehca/ehca_irq.c
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -404,10 +404,11 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe)
404 u32 token; 404 u32 token;
405 unsigned long flags; 405 unsigned long flags;
406 struct ehca_cq *cq; 406 struct ehca_cq *cq;
407
407 eqe_value = eqe->entry; 408 eqe_value = eqe->entry;
408 ehca_dbg(&shca->ib_device, "eqe_value=%lx", eqe_value); 409 ehca_dbg(&shca->ib_device, "eqe_value=%lx", eqe_value);
409 if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) { 410 if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) {
410 ehca_dbg(&shca->ib_device, "... completion event"); 411 ehca_dbg(&shca->ib_device, "Got completion event");
411 token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value); 412 token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value);
412 spin_lock_irqsave(&ehca_cq_idr_lock, flags); 413 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
413 cq = idr_find(&ehca_cq_idr, token); 414 cq = idr_find(&ehca_cq_idr, token);
@@ -419,16 +420,20 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe)
419 return; 420 return;
420 } 421 }
421 reset_eq_pending(cq); 422 reset_eq_pending(cq);
422 if (ehca_scaling_code) { 423 cq->nr_events++;
424 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
425 if (ehca_scaling_code)
423 queue_comp_task(cq); 426 queue_comp_task(cq);
424 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); 427 else {
425 } else {
426 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
427 comp_event_callback(cq); 428 comp_event_callback(cq);
429 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
430 cq->nr_events--;
431 if (!cq->nr_events)
432 wake_up(&cq->wait_completion);
433 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
428 } 434 }
429 } else { 435 } else {
430 ehca_dbg(&shca->ib_device, 436 ehca_dbg(&shca->ib_device, "Got non completion event");
431 "Got non completion event");
432 parse_identifier(shca, eqe_value); 437 parse_identifier(shca, eqe_value);
433 } 438 }
434} 439}
@@ -478,6 +483,7 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
478 "token=%x", token); 483 "token=%x", token);
479 continue; 484 continue;
480 } 485 }
486 eqe_cache[eqe_cnt].cq->nr_events++;
481 spin_unlock(&ehca_cq_idr_lock); 487 spin_unlock(&ehca_cq_idr_lock);
482 } else 488 } else
483 eqe_cache[eqe_cnt].cq = NULL; 489 eqe_cache[eqe_cnt].cq = NULL;
@@ -504,12 +510,18 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
504 /* call completion handler for cached eqes */ 510 /* call completion handler for cached eqes */
505 for (i = 0; i < eqe_cnt; i++) 511 for (i = 0; i < eqe_cnt; i++)
506 if (eq->eqe_cache[i].cq) { 512 if (eq->eqe_cache[i].cq) {
507 if (ehca_scaling_code) { 513 if (ehca_scaling_code)
508 spin_lock(&ehca_cq_idr_lock);
509 queue_comp_task(eq->eqe_cache[i].cq); 514 queue_comp_task(eq->eqe_cache[i].cq);
510 spin_unlock(&ehca_cq_idr_lock); 515 else {
511 } else 516 struct ehca_cq *cq = eq->eqe_cache[i].cq;
512 comp_event_callback(eq->eqe_cache[i].cq); 517 comp_event_callback(cq);
518 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
519 cq->nr_events--;
520 if (!cq->nr_events)
521 wake_up(&cq->wait_completion);
522 spin_unlock_irqrestore(&ehca_cq_idr_lock,
523 flags);
524 }
513 } else { 525 } else {
514 ehca_dbg(&shca->ib_device, "Got non completion event"); 526 ehca_dbg(&shca->ib_device, "Got non completion event");
515 parse_identifier(shca, eq->eqe_cache[i].eqe->entry); 527 parse_identifier(shca, eq->eqe_cache[i].eqe->entry);
@@ -523,7 +535,6 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
523 if (!eqe) 535 if (!eqe)
524 break; 536 break;
525 process_eqe(shca, eqe); 537 process_eqe(shca, eqe);
526 eqe_cnt++;
527 } while (1); 538 } while (1);
528 539
529unlock_irq_spinlock: 540unlock_irq_spinlock:
@@ -567,8 +578,7 @@ static void __queue_comp_task(struct ehca_cq *__cq,
567 list_add_tail(&__cq->entry, &cct->cq_list); 578 list_add_tail(&__cq->entry, &cct->cq_list);
568 cct->cq_jobs++; 579 cct->cq_jobs++;
569 wake_up(&cct->wait_queue); 580 wake_up(&cct->wait_queue);
570 } 581 } else
571 else
572 __cq->nr_callbacks++; 582 __cq->nr_callbacks++;
573 583
574 spin_unlock(&__cq->task_lock); 584 spin_unlock(&__cq->task_lock);
@@ -577,18 +587,21 @@ static void __queue_comp_task(struct ehca_cq *__cq,
577 587
578static void queue_comp_task(struct ehca_cq *__cq) 588static void queue_comp_task(struct ehca_cq *__cq)
579{ 589{
580 int cpu;
581 int cpu_id; 590 int cpu_id;
582 struct ehca_cpu_comp_task *cct; 591 struct ehca_cpu_comp_task *cct;
592 int cq_jobs;
593 unsigned long flags;
583 594
584 cpu = get_cpu();
585 cpu_id = find_next_online_cpu(pool); 595 cpu_id = find_next_online_cpu(pool);
586 BUG_ON(!cpu_online(cpu_id)); 596 BUG_ON(!cpu_online(cpu_id));
587 597
588 cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); 598 cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id);
589 BUG_ON(!cct); 599 BUG_ON(!cct);
590 600
591 if (cct->cq_jobs > 0) { 601 spin_lock_irqsave(&cct->task_lock, flags);
602 cq_jobs = cct->cq_jobs;
603 spin_unlock_irqrestore(&cct->task_lock, flags);
604 if (cq_jobs > 0) {
592 cpu_id = find_next_online_cpu(pool); 605 cpu_id = find_next_online_cpu(pool);
593 cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); 606 cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id);
594 BUG_ON(!cct); 607 BUG_ON(!cct);
@@ -608,11 +621,17 @@ static void run_comp_task(struct ehca_cpu_comp_task* cct)
608 cq = list_entry(cct->cq_list.next, struct ehca_cq, entry); 621 cq = list_entry(cct->cq_list.next, struct ehca_cq, entry);
609 spin_unlock_irqrestore(&cct->task_lock, flags); 622 spin_unlock_irqrestore(&cct->task_lock, flags);
610 comp_event_callback(cq); 623 comp_event_callback(cq);
611 spin_lock_irqsave(&cct->task_lock, flags);
612 624
625 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
626 cq->nr_events--;
627 if (!cq->nr_events)
628 wake_up(&cq->wait_completion);
629 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
630
631 spin_lock_irqsave(&cct->task_lock, flags);
613 spin_lock(&cq->task_lock); 632 spin_lock(&cq->task_lock);
614 cq->nr_callbacks--; 633 cq->nr_callbacks--;
615 if (cq->nr_callbacks == 0) { 634 if (!cq->nr_callbacks) {
616 list_del_init(cct->cq_list.next); 635 list_del_init(cct->cq_list.next);
617 cct->cq_jobs--; 636 cct->cq_jobs--;
618 } 637 }
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index c1835121a822..059da9628bb5 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -52,7 +52,7 @@
52MODULE_LICENSE("Dual BSD/GPL"); 52MODULE_LICENSE("Dual BSD/GPL");
53MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); 53MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>");
54MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver"); 54MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver");
55MODULE_VERSION("SVNEHCA_0021"); 55MODULE_VERSION("SVNEHCA_0022");
56 56
57int ehca_open_aqp1 = 0; 57int ehca_open_aqp1 = 0;
58int ehca_debug_level = 0; 58int ehca_debug_level = 0;
@@ -810,7 +810,7 @@ int __init ehca_module_init(void)
810 int ret; 810 int ret;
811 811
812 printk(KERN_INFO "eHCA Infiniband Device Driver " 812 printk(KERN_INFO "eHCA Infiniband Device Driver "
813 "(Rel.: SVNEHCA_0021)\n"); 813 "(Rel.: SVNEHCA_0022)\n");
814 idr_init(&ehca_qp_idr); 814 idr_init(&ehca_qp_idr);
815 idr_init(&ehca_cq_idr); 815 idr_init(&ehca_cq_idr);
816 spin_lock_init(&ehca_qp_idr_lock); 816 spin_lock_init(&ehca_qp_idr_lock);
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 71dc84bd4254..1c6b63aca268 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1088,21 +1088,21 @@ static void mthca_unmap_memfree(struct mthca_dev *dev,
1088static int mthca_alloc_memfree(struct mthca_dev *dev, 1088static int mthca_alloc_memfree(struct mthca_dev *dev,
1089 struct mthca_qp *qp) 1089 struct mthca_qp *qp)
1090{ 1090{
1091 int ret = 0;
1092
1093 if (mthca_is_memfree(dev)) { 1091 if (mthca_is_memfree(dev)) {
1094 qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, 1092 qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ,
1095 qp->qpn, &qp->rq.db); 1093 qp->qpn, &qp->rq.db);
1096 if (qp->rq.db_index < 0) 1094 if (qp->rq.db_index < 0)
1097 return ret; 1095 return -ENOMEM;
1098 1096
1099 qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, 1097 qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ,
1100 qp->qpn, &qp->sq.db); 1098 qp->qpn, &qp->sq.db);
1101 if (qp->sq.db_index < 0) 1099 if (qp->sq.db_index < 0) {
1102 mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); 1100 mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
1101 return -ENOMEM;
1102 }
1103 } 1103 }
1104 1104
1105 return ret; 1105 return 0;
1106} 1106}
1107 1107
1108static void mthca_free_memfree(struct mthca_dev *dev, 1108static void mthca_free_memfree(struct mthca_dev *dev,
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index bb2e3d5eee20..56c87a81bb67 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -407,6 +407,10 @@ static int ipoib_mcast_join_complete(int status,
407 queue_delayed_work(ipoib_workqueue, 407 queue_delayed_work(ipoib_workqueue,
408 &priv->mcast_task, 0); 408 &priv->mcast_task, 0);
409 mutex_unlock(&mcast_mutex); 409 mutex_unlock(&mcast_mutex);
410
411 if (mcast == priv->broadcast)
412 netif_carrier_on(dev);
413
410 return 0; 414 return 0;
411 } 415 }
412 416
@@ -594,7 +598,6 @@ void ipoib_mcast_join_task(struct work_struct *work)
594 ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); 598 ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n");
595 599
596 clear_bit(IPOIB_MCAST_RUN, &priv->flags); 600 clear_bit(IPOIB_MCAST_RUN, &priv->flags);
597 netif_carrier_on(dev);
598} 601}
599 602
600int ipoib_mcast_start_thread(struct net_device *dev) 603int ipoib_mcast_start_thread(struct net_device *dev)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index 3cb551b88756..7f3ec205e35f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -259,12 +259,13 @@ void ipoib_event(struct ib_event_handler *handler,
259 struct ipoib_dev_priv *priv = 259 struct ipoib_dev_priv *priv =
260 container_of(handler, struct ipoib_dev_priv, event_handler); 260 container_of(handler, struct ipoib_dev_priv, event_handler);
261 261
262 if (record->event == IB_EVENT_PORT_ERR || 262 if ((record->event == IB_EVENT_PORT_ERR ||
263 record->event == IB_EVENT_PKEY_CHANGE || 263 record->event == IB_EVENT_PKEY_CHANGE ||
264 record->event == IB_EVENT_PORT_ACTIVE || 264 record->event == IB_EVENT_PORT_ACTIVE ||
265 record->event == IB_EVENT_LID_CHANGE || 265 record->event == IB_EVENT_LID_CHANGE ||
266 record->event == IB_EVENT_SM_CHANGE || 266 record->event == IB_EVENT_SM_CHANGE ||
267 record->event == IB_EVENT_CLIENT_REREGISTER) { 267 record->event == IB_EVENT_CLIENT_REREGISTER) &&
268 record->element.port_num == priv->port) {
268 ipoib_dbg(priv, "Port state change event\n"); 269 ipoib_dbg(priv, "Port state change event\n");
269 queue_work(ipoib_workqueue, &priv->flush_task); 270 queue_work(ipoib_workqueue, &priv->flush_task);
270 } 271 }
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index ec195a36e8f6..db9cca3b65e0 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -553,7 +553,8 @@ static int __devinit i8042_check_aux(void)
553 */ 553 */
554 554
555 param = 0x5a; 555 param = 0x5a;
556 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0x5a) { 556 retval = i8042_command(&param, I8042_CMD_AUX_LOOP);
557 if (retval || param != 0x5a) {
557 558
558/* 559/*
559 * External connection test - filters out AT-soldered PS/2 i8042's 560 * External connection test - filters out AT-soldered PS/2 i8042's
@@ -567,7 +568,12 @@ static int __devinit i8042_check_aux(void)
567 (param && param != 0xfa && param != 0xff)) 568 (param && param != 0xfa && param != 0xff))
568 return -1; 569 return -1;
569 570
570 aux_loop_broken = 1; 571/*
572 * If AUX_LOOP completed without error but returned unexpected data
573 * mark it as broken
574 */
575 if (!retval)
576 aux_loop_broken = 1;
571 } 577 }
572 578
573/* 579/*
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index e3acd398fb37..1f6445840461 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -359,6 +359,8 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
359 cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp; 359 cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp;
360 cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; 360 cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp;
361 cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; 361 cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp;
362 cfi->chips[i].ref_point_counter = 0;
363 init_waitqueue_head(&(cfi->chips[i].wq));
362 } 364 }
363 365
364 map->fldrv = &cfi_amdstd_chipdrv; 366 map->fldrv = &cfi_amdstd_chipdrv;
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index 69d49e0250a9..b344ff858b2d 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -158,6 +158,8 @@ struct mtd_info *cfi_cmdset_0020(struct map_info *map, int primary)
158 cfi->chips[i].word_write_time = 128; 158 cfi->chips[i].word_write_time = 128;
159 cfi->chips[i].buffer_write_time = 128; 159 cfi->chips[i].buffer_write_time = 128;
160 cfi->chips[i].erase_time = 1024; 160 cfi->chips[i].erase_time = 1024;
161 cfi->chips[i].ref_point_counter = 0;
162 init_waitqueue_head(&(cfi->chips[i].wq));
161 } 163 }
162 164
163 return cfi_staa_setup(map); 165 return cfi_staa_setup(map);
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c
index b1104fe1f207..1c3b34ad7325 100644
--- a/drivers/mtd/maps/dilnetpc.c
+++ b/drivers/mtd/maps/dilnetpc.c
@@ -402,8 +402,8 @@ static int __init init_dnpc(void)
402 ++higlvl_partition_info[i].name; 402 ++higlvl_partition_info[i].name;
403 } 403 }
404 404
405 printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n", 405 printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%llx\n",
406 is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys); 406 is_dnp ? "DNPC" : "ADNP", dnpc_map.size, (unsigned long long)dnpc_map.phys);
407 407
408 dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size); 408 dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size);
409 409
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index 0bc013fd66a3..aa64a4752781 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -30,7 +30,7 @@
30 30
31#define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */ 31#define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */
32 32
33#define BIOS_CNTL 0xDC 33#define BIOS_CNTL 0xDC
34#define BIOS_LOCK_ENABLE 0x02 34#define BIOS_LOCK_ENABLE 0x02
35#define BIOS_WRITE_ENABLE 0x01 35#define BIOS_WRITE_ENABLE 0x01
36 36
@@ -145,7 +145,7 @@ static void esb2rom_cleanup(struct esb2rom_window *window)
145} 145}
146 146
147static int __devinit esb2rom_init_one(struct pci_dev *pdev, 147static int __devinit esb2rom_init_one(struct pci_dev *pdev,
148 const struct pci_device_id *ent) 148 const struct pci_device_id *ent)
149{ 149{
150 static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; 150 static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
151 struct esb2rom_window *window = &esb2rom_window; 151 struct esb2rom_window *window = &esb2rom_window;
@@ -185,7 +185,7 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev,
185 /* Find a region continuous to the end of the ROM window */ 185 /* Find a region continuous to the end of the ROM window */
186 window->phys = 0; 186 window->phys = 0;
187 pci_read_config_word(pdev, FWH_DEC_EN1, &word); 187 pci_read_config_word(pdev, FWH_DEC_EN1, &word);
188 printk(KERN_DEBUG "pci_read_config_byte : %x\n", word); 188 printk(KERN_DEBUG "pci_read_config_word : %x\n", word);
189 189
190 if ((word & FWH_8MiB) == FWH_8MiB) 190 if ((word & FWH_8MiB) == FWH_8MiB)
191 window->phys = 0xff400000; 191 window->phys = 0xff400000;
@@ -212,6 +212,11 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev,
212 else if ((word & FWH_0_5MiB) == FWH_0_5MiB) 212 else if ((word & FWH_0_5MiB) == FWH_0_5MiB)
213 window->phys = 0xfff80000; 213 window->phys = 0xfff80000;
214 214
215 if (window->phys == 0) {
216 printk(KERN_ERR MOD_NAME ": Rom window is closed\n");
217 goto out;
218 }
219
215 /* reserved 0x0020 and 0x0010 */ 220 /* reserved 0x0020 and 0x0010 */
216 window->phys -= 0x400000UL; 221 window->phys -= 0x400000UL;
217 window->size = (0xffffffffUL - window->phys) + 1UL; 222 window->size = (0xffffffffUL - window->phys) + 1UL;
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 880580c44e01..41844ea02462 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -727,6 +727,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c
727 concat->mtd.erasesize = subdev[0]->erasesize; 727 concat->mtd.erasesize = subdev[0]->erasesize;
728 concat->mtd.writesize = subdev[0]->writesize; 728 concat->mtd.writesize = subdev[0]->writesize;
729 concat->mtd.oobsize = subdev[0]->oobsize; 729 concat->mtd.oobsize = subdev[0]->oobsize;
730 concat->mtd.oobavail = subdev[0]->oobavail;
730 if (subdev[0]->writev) 731 if (subdev[0]->writev)
731 concat->mtd.writev = concat_writev; 732 concat->mtd.writev = concat_writev;
732 if (subdev[0]->read_oob) 733 if (subdev[0]->read_oob)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 633def3fb087..1af989023c66 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -200,6 +200,11 @@ static int part_erase (struct mtd_info *mtd, struct erase_info *instr)
200 return -EINVAL; 200 return -EINVAL;
201 instr->addr += part->offset; 201 instr->addr += part->offset;
202 ret = part->master->erase(part->master, instr); 202 ret = part->master->erase(part->master, instr);
203 if (ret) {
204 if (instr->fail_addr != 0xffffffff)
205 instr->fail_addr -= part->offset;
206 instr->addr -= part->offset;
207 }
203 return ret; 208 return ret;
204} 209}
205 210
@@ -338,6 +343,7 @@ int add_mtd_partitions(struct mtd_info *master,
338 slave->mtd.size = parts[i].size; 343 slave->mtd.size = parts[i].size;
339 slave->mtd.writesize = master->writesize; 344 slave->mtd.writesize = master->writesize;
340 slave->mtd.oobsize = master->oobsize; 345 slave->mtd.oobsize = master->oobsize;
346 slave->mtd.oobavail = master->oobavail;
341 slave->mtd.subpage_sft = master->subpage_sft; 347 slave->mtd.subpage_sft = master->subpage_sft;
342 348
343 slave->mtd.name = parts[i].name; 349 slave->mtd.name = parts[i].name;
@@ -559,4 +565,3 @@ EXPORT_SYMBOL_GPL(deregister_mtd_parser);
559MODULE_LICENSE("GPL"); 565MODULE_LICENSE("GPL");
560MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>"); 566MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
561MODULE_DESCRIPTION("Generic support for partitioning of MTD devices"); 567MODULE_DESCRIPTION("Generic support for partitioning of MTD devices");
562
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index 12608c13cce5..595208f965a5 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -114,7 +114,7 @@ module_param(no_autopart, int, 0);
114static int show_firmware_partition = 0; 114static int show_firmware_partition = 0;
115module_param(show_firmware_partition, int, 0); 115module_param(show_firmware_partition, int, 0);
116 116
117#ifdef MTD_NAND_DISKONCHIP_BBTWRITE 117#ifdef CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE
118static int inftl_bbt_write = 1; 118static int inftl_bbt_write = 1;
119#else 119#else
120static int inftl_bbt_write = 0; 120static int inftl_bbt_write = 0;
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index acaf97bc80d1..6af37b8cff65 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2524,6 +2524,7 @@ int nand_scan_tail(struct mtd_info *mtd)
2524 for (i = 0; chip->ecc.layout->oobfree[i].length; i++) 2524 for (i = 0; chip->ecc.layout->oobfree[i].length; i++)
2525 chip->ecc.layout->oobavail += 2525 chip->ecc.layout->oobavail +=
2526 chip->ecc.layout->oobfree[i].length; 2526 chip->ecc.layout->oobfree[i].length;
2527 mtd->oobavail = chip->ecc.layout->oobavail;
2527 2528
2528 /* 2529 /*
2529 * Set the number of read / write steps for one page depending on ECC 2530 * Set the number of read / write steps for one page depending on ECC
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 7f1cb6e5dccb..9e14a26ca4e8 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -4,6 +4,11 @@
4 * Copyright (C) 2005-2007 Samsung Electronics 4 * Copyright (C) 2005-2007 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com> 5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * 6 *
7 * Credits:
8 * Adrian Hunter <ext-adrian.hunter@nokia.com>:
9 * auto-placement support, read-while load support, various fixes
10 * Copyright (C) Nokia Corporation, 2007
11 *
7 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
@@ -831,7 +836,7 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col
831 int readcol = column; 836 int readcol = column;
832 int readend = column + thislen; 837 int readend = column + thislen;
833 int lastgap = 0; 838 int lastgap = 0;
834 uint8_t *oob_buf = this->page_buf + mtd->writesize; 839 uint8_t *oob_buf = this->oob_buf;
835 840
836 for (free = this->ecclayout->oobfree; free->length; ++free) { 841 for (free = this->ecclayout->oobfree; free->length; ++free) {
837 if (readcol >= lastgap) 842 if (readcol >= lastgap)
@@ -849,7 +854,8 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col
849 int n = ed - st; 854 int n = ed - st;
850 memcpy(buf, oob_buf + st, n); 855 memcpy(buf, oob_buf + st, n);
851 buf += n; 856 buf += n;
852 } 857 } else
858 break;
853 } 859 }
854 return 0; 860 return 0;
855} 861}
@@ -947,9 +953,9 @@ static int onenand_do_read_oob(struct mtd_info *mtd, loff_t from, size_t len,
947 953
948/** 954/**
949 * onenand_read_oob - [MTD Interface] NAND write data and/or out-of-band 955 * onenand_read_oob - [MTD Interface] NAND write data and/or out-of-band
950 * @mtd: MTD device structure 956 * @param mtd: MTD device structure
951 * @from: offset to read from 957 * @param from: offset to read from
952 * @ops: oob operation description structure 958 * @param ops: oob operation description structure
953 */ 959 */
954static int onenand_read_oob(struct mtd_info *mtd, loff_t from, 960static int onenand_read_oob(struct mtd_info *mtd, loff_t from,
955 struct mtd_oob_ops *ops) 961 struct mtd_oob_ops *ops)
@@ -1017,7 +1023,7 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)
1017 * onenand_bbt_read_oob - [MTD Interface] OneNAND read out-of-band for bbt scan 1023 * onenand_bbt_read_oob - [MTD Interface] OneNAND read out-of-band for bbt scan
1018 * @param mtd MTD device structure 1024 * @param mtd MTD device structure
1019 * @param from offset to read from 1025 * @param from offset to read from
1020 * @param @ops oob operation description structure 1026 * @param ops oob operation description structure
1021 * 1027 *
1022 * OneNAND read out-of-band data from the spare area for bbt scan 1028 * OneNAND read out-of-band data from the spare area for bbt scan
1023 */ 1029 */
@@ -1093,7 +1099,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
1093static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to) 1099static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to)
1094{ 1100{
1095 struct onenand_chip *this = mtd->priv; 1101 struct onenand_chip *this = mtd->priv;
1096 char *readp = this->page_buf + mtd->writesize; 1102 char oobbuf[64];
1097 int status, i; 1103 int status, i;
1098 1104
1099 this->command(mtd, ONENAND_CMD_READOOB, to, mtd->oobsize); 1105 this->command(mtd, ONENAND_CMD_READOOB, to, mtd->oobsize);
@@ -1102,9 +1108,9 @@ static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to
1102 if (status) 1108 if (status)
1103 return status; 1109 return status;
1104 1110
1105 this->read_bufferram(mtd, ONENAND_SPARERAM, readp, 0, mtd->oobsize); 1111 this->read_bufferram(mtd, ONENAND_SPARERAM, oobbuf, 0, mtd->oobsize);
1106 for(i = 0; i < mtd->oobsize; i++) 1112 for (i = 0; i < mtd->oobsize; i++)
1107 if (buf[i] != 0xFF && buf[i] != readp[i]) 1113 if (buf[i] != 0xFF && buf[i] != oobbuf[i])
1108 return -EBADMSG; 1114 return -EBADMSG;
1109 1115
1110 return 0; 1116 return 0;
@@ -1290,7 +1296,8 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,
1290 int n = ed - st; 1296 int n = ed - st;
1291 memcpy(oob_buf + st, buf, n); 1297 memcpy(oob_buf + st, buf, n);
1292 buf += n; 1298 buf += n;
1293 } 1299 } else
1300 break;
1294 } 1301 }
1295 return 0; 1302 return 0;
1296} 1303}
@@ -1312,6 +1319,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1312 struct onenand_chip *this = mtd->priv; 1319 struct onenand_chip *this = mtd->priv;
1313 int column, ret = 0, oobsize; 1320 int column, ret = 0, oobsize;
1314 int written = 0; 1321 int written = 0;
1322 u_char *oobbuf;
1315 1323
1316 DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len); 1324 DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len);
1317 1325
@@ -1331,7 +1339,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1331 } 1339 }
1332 1340
1333 /* For compatibility with NAND: Do not allow write past end of page */ 1341 /* For compatibility with NAND: Do not allow write past end of page */
1334 if (column + len > oobsize) { 1342 if (unlikely(column + len > oobsize)) {
1335 printk(KERN_ERR "onenand_write_oob: " 1343 printk(KERN_ERR "onenand_write_oob: "
1336 "Attempt to write past end of page\n"); 1344 "Attempt to write past end of page\n");
1337 return -EINVAL; 1345 return -EINVAL;
@@ -1348,6 +1356,8 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1348 /* Grab the lock and see if the device is available */ 1356 /* Grab the lock and see if the device is available */
1349 onenand_get_device(mtd, FL_WRITING); 1357 onenand_get_device(mtd, FL_WRITING);
1350 1358
1359 oobbuf = this->oob_buf;
1360
1351 /* Loop until all data write */ 1361 /* Loop until all data write */
1352 while (written < len) { 1362 while (written < len) {
1353 int thislen = min_t(int, oobsize, len - written); 1363 int thislen = min_t(int, oobsize, len - written);
@@ -1358,12 +1368,12 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1358 1368
1359 /* We send data to spare ram with oobsize 1369 /* We send data to spare ram with oobsize
1360 * to prevent byte access */ 1370 * to prevent byte access */
1361 memset(this->page_buf, 0xff, mtd->oobsize); 1371 memset(oobbuf, 0xff, mtd->oobsize);
1362 if (mode == MTD_OOB_AUTO) 1372 if (mode == MTD_OOB_AUTO)
1363 onenand_fill_auto_oob(mtd, this->page_buf, buf, column, thislen); 1373 onenand_fill_auto_oob(mtd, oobbuf, buf, column, thislen);
1364 else 1374 else
1365 memcpy(this->page_buf + column, buf, thislen); 1375 memcpy(oobbuf + column, buf, thislen);
1366 this->write_bufferram(mtd, ONENAND_SPARERAM, this->page_buf, 0, mtd->oobsize); 1376 this->write_bufferram(mtd, ONENAND_SPARERAM, oobbuf, 0, mtd->oobsize);
1367 1377
1368 this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize); 1378 this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize);
1369 1379
@@ -1375,7 +1385,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1375 break; 1385 break;
1376 } 1386 }
1377 1387
1378 ret = onenand_verify_oob(mtd, this->page_buf, to); 1388 ret = onenand_verify_oob(mtd, oobbuf, to);
1379 if (ret) { 1389 if (ret) {
1380 printk(KERN_ERR "onenand_write_oob: verify failed %d\n", ret); 1390 printk(KERN_ERR "onenand_write_oob: verify failed %d\n", ret);
1381 break; 1391 break;
@@ -1400,9 +1410,9 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1400 1410
1401/** 1411/**
1402 * onenand_write_oob - [MTD Interface] NAND write data and/or out-of-band 1412 * onenand_write_oob - [MTD Interface] NAND write data and/or out-of-band
1403 * @mtd: MTD device structure 1413 * @param mtd: MTD device structure
1404 * @from: offset to read from 1414 * @param to: offset to write
1405 * @ops: oob operation description structure 1415 * @param ops: oob operation description structure
1406 */ 1416 */
1407static int onenand_write_oob(struct mtd_info *mtd, loff_t to, 1417static int onenand_write_oob(struct mtd_info *mtd, loff_t to,
1408 struct mtd_oob_ops *ops) 1418 struct mtd_oob_ops *ops)
@@ -1616,6 +1626,7 @@ static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
1616 * @param mtd MTD device structure 1626 * @param mtd MTD device structure
1617 * @param ofs offset relative to mtd start 1627 * @param ofs offset relative to mtd start
1618 * @param len number of bytes to lock or unlock 1628 * @param len number of bytes to lock or unlock
1629 * @param cmd lock or unlock command
1619 * 1630 *
1620 * Lock or unlock one or more blocks 1631 * Lock or unlock one or more blocks
1621 */ 1632 */
@@ -2117,10 +2128,11 @@ static void onenand_check_features(struct mtd_info *mtd)
2117} 2128}
2118 2129
2119/** 2130/**
2120 * onenand_print_device_info - Print device ID 2131 * onenand_print_device_info - Print device & version ID
2121 * @param device device ID 2132 * @param device device ID
2133 * @param version version ID
2122 * 2134 *
2123 * Print device ID 2135 * Print device & version ID
2124 */ 2136 */
2125static void onenand_print_device_info(int device, int version) 2137static void onenand_print_device_info(int device, int version)
2126{ 2138{
@@ -2320,15 +2332,25 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
2320 2332
2321 /* Allocate buffers, if necessary */ 2333 /* Allocate buffers, if necessary */
2322 if (!this->page_buf) { 2334 if (!this->page_buf) {
2323 size_t len; 2335 this->page_buf = kzalloc(mtd->writesize, GFP_KERNEL);
2324 len = mtd->writesize + mtd->oobsize;
2325 this->page_buf = kmalloc(len, GFP_KERNEL);
2326 if (!this->page_buf) { 2336 if (!this->page_buf) {
2327 printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); 2337 printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n");
2328 return -ENOMEM; 2338 return -ENOMEM;
2329 } 2339 }
2330 this->options |= ONENAND_PAGEBUF_ALLOC; 2340 this->options |= ONENAND_PAGEBUF_ALLOC;
2331 } 2341 }
2342 if (!this->oob_buf) {
2343 this->oob_buf = kzalloc(mtd->oobsize, GFP_KERNEL);
2344 if (!this->oob_buf) {
2345 printk(KERN_ERR "onenand_scan(): Can't allocate oob_buf\n");
2346 if (this->options & ONENAND_PAGEBUF_ALLOC) {
2347 this->options &= ~ONENAND_PAGEBUF_ALLOC;
2348 kfree(this->page_buf);
2349 }
2350 return -ENOMEM;
2351 }
2352 this->options |= ONENAND_OOBBUF_ALLOC;
2353 }
2332 2354
2333 this->state = FL_READY; 2355 this->state = FL_READY;
2334 init_waitqueue_head(&this->wq); 2356 init_waitqueue_head(&this->wq);
@@ -2367,6 +2389,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
2367 for (i = 0; this->ecclayout->oobfree[i].length; i++) 2389 for (i = 0; this->ecclayout->oobfree[i].length; i++)
2368 this->ecclayout->oobavail += 2390 this->ecclayout->oobavail +=
2369 this->ecclayout->oobfree[i].length; 2391 this->ecclayout->oobfree[i].length;
2392 mtd->oobavail = this->ecclayout->oobavail;
2370 2393
2371 mtd->ecclayout = this->ecclayout; 2394 mtd->ecclayout = this->ecclayout;
2372 2395
@@ -2424,9 +2447,11 @@ void onenand_release(struct mtd_info *mtd)
2424 kfree(bbm->bbt); 2447 kfree(bbm->bbt);
2425 kfree(this->bbm); 2448 kfree(this->bbm);
2426 } 2449 }
2427 /* Buffer allocated by onenand_scan */ 2450 /* Buffers allocated by onenand_scan */
2428 if (this->options & ONENAND_PAGEBUF_ALLOC) 2451 if (this->options & ONENAND_PAGEBUF_ALLOC)
2429 kfree(this->page_buf); 2452 kfree(this->page_buf);
2453 if (this->options & ONENAND_OOBBUF_ALLOC)
2454 kfree(this->oob_buf);
2430} 2455}
2431 2456
2432EXPORT_SYMBOL_GPL(onenand_scan); 2457EXPORT_SYMBOL_GPL(onenand_scan);
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 72995777f809..b406ecfa7268 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -858,19 +858,7 @@ static struct eisa_device_id vortex_eisa_ids[] = {
858}; 858};
859MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); 859MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids);
860 860
861static int vortex_eisa_probe(struct device *device); 861static int __init vortex_eisa_probe(struct device *device)
862static int vortex_eisa_remove(struct device *device);
863
864static struct eisa_driver vortex_eisa_driver = {
865 .id_table = vortex_eisa_ids,
866 .driver = {
867 .name = "3c59x",
868 .probe = vortex_eisa_probe,
869 .remove = vortex_eisa_remove
870 }
871};
872
873static int vortex_eisa_probe(struct device *device)
874{ 862{
875 void __iomem *ioaddr; 863 void __iomem *ioaddr;
876 struct eisa_device *edev; 864 struct eisa_device *edev;
@@ -893,7 +881,7 @@ static int vortex_eisa_probe(struct device *device)
893 return 0; 881 return 0;
894} 882}
895 883
896static int vortex_eisa_remove(struct device *device) 884static int __devexit vortex_eisa_remove(struct device *device)
897{ 885{
898 struct eisa_device *edev; 886 struct eisa_device *edev;
899 struct net_device *dev; 887 struct net_device *dev;
@@ -918,7 +906,17 @@ static int vortex_eisa_remove(struct device *device)
918 free_netdev(dev); 906 free_netdev(dev);
919 return 0; 907 return 0;
920} 908}
921#endif 909
910static struct eisa_driver vortex_eisa_driver = {
911 .id_table = vortex_eisa_ids,
912 .driver = {
913 .name = "3c59x",
914 .probe = vortex_eisa_probe,
915 .remove = __devexit_p(vortex_eisa_remove)
916 }
917};
918
919#endif /* CONFIG_EISA */
922 920
923/* returns count found (>= 0), or negative on error */ 921/* returns count found (>= 0), or negative on error */
924static int __init vortex_eisa_init(void) 922static int __init vortex_eisa_init(void)
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 9ba21e0f27c5..1ee27c360a4b 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -787,6 +787,12 @@ static int mv643xx_eth_open(struct net_device *dev)
787 unsigned int size; 787 unsigned int size;
788 int err; 788 int err;
789 789
790 /* Clear any pending ethernet port interrupts */
791 mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0);
792 mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
793 /* wait for previous write to complete */
794 mv_read (MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num));
795
790 err = request_irq(dev->irq, mv643xx_eth_int_handler, 796 err = request_irq(dev->irq, mv643xx_eth_int_handler,
791 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); 797 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev);
792 if (err) { 798 if (err) {
@@ -875,10 +881,6 @@ static int mv643xx_eth_open(struct net_device *dev)
875 881
876 mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */ 882 mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */
877 883
878 /* Clear any pending ethernet port interrupts */
879 mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0);
880 mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
881
882 eth_port_start(dev); 884 eth_port_start(dev);
883 885
884 /* Interrupt Coalescing */ 886 /* Interrupt Coalescing */
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index b05dc6ed7fb7..ac02b3b60f92 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -181,6 +181,7 @@ struct myri10ge_priv {
181 int intr_coal_delay; 181 int intr_coal_delay;
182 __be32 __iomem *intr_coal_delay_ptr; 182 __be32 __iomem *intr_coal_delay_ptr;
183 int mtrr; 183 int mtrr;
184 int wc_enabled;
184 int wake_queue; 185 int wake_queue;
185 int stop_queue; 186 int stop_queue;
186 int down_cnt; 187 int down_cnt;
@@ -717,6 +718,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
717 int status; 718 int status;
718 size_t bytes; 719 size_t bytes;
719 u32 len; 720 u32 len;
721 struct page *dmatest_page;
722 dma_addr_t dmatest_bus;
720 723
721 /* try to send a reset command to the card to see if it 724 /* try to send a reset command to the card to see if it
722 * is alive */ 725 * is alive */
@@ -726,6 +729,11 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
726 dev_err(&mgp->pdev->dev, "failed reset\n"); 729 dev_err(&mgp->pdev->dev, "failed reset\n");
727 return -ENXIO; 730 return -ENXIO;
728 } 731 }
732 dmatest_page = alloc_page(GFP_KERNEL);
733 if (!dmatest_page)
734 return -ENOMEM;
735 dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE,
736 DMA_BIDIRECTIONAL);
729 737
730 /* Now exchange information about interrupts */ 738 /* Now exchange information about interrupts */
731 739
@@ -764,8 +772,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
764 772
765 len = mgp->tx.boundary; 773 len = mgp->tx.boundary;
766 774
767 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 775 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
768 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 776 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
769 cmd.data2 = len * 0x10000; 777 cmd.data2 = len * 0x10000;
770 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 778 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
771 if (status == 0) 779 if (status == 0)
@@ -774,8 +782,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
774 else 782 else
775 dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n", 783 dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n",
776 status); 784 status);
777 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 785 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
778 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 786 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
779 cmd.data2 = len * 0x1; 787 cmd.data2 = len * 0x1;
780 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 788 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
781 if (status == 0) 789 if (status == 0)
@@ -785,8 +793,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
785 dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n", 793 dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n",
786 status); 794 status);
787 795
788 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 796 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
789 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 797 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
790 cmd.data2 = len * 0x10001; 798 cmd.data2 = len * 0x10001;
791 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 799 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
792 if (status == 0) 800 if (status == 0)
@@ -796,6 +804,9 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
796 dev_warn(&mgp->pdev->dev, 804 dev_warn(&mgp->pdev->dev,
797 "DMA read/write benchmark failed: %d\n", status); 805 "DMA read/write benchmark failed: %d\n", status);
798 806
807 pci_unmap_page(mgp->pdev, dmatest_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);
808 put_page(dmatest_page);
809
799 memset(mgp->rx_done.entry, 0, bytes); 810 memset(mgp->rx_done.entry, 0, bytes);
800 811
801 /* reset mcp/driver shared state back to 0 */ 812 /* reset mcp/driver shared state back to 0 */
@@ -1375,7 +1386,7 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1375 data[i] = ((unsigned long *)&mgp->stats)[i]; 1386 data[i] = ((unsigned long *)&mgp->stats)[i];
1376 1387
1377 data[i++] = (unsigned int)mgp->tx.boundary; 1388 data[i++] = (unsigned int)mgp->tx.boundary;
1378 data[i++] = (unsigned int)(mgp->mtrr >= 0); 1389 data[i++] = (unsigned int)mgp->wc_enabled;
1379 data[i++] = (unsigned int)mgp->pdev->irq; 1390 data[i++] = (unsigned int)mgp->pdev->irq;
1380 data[i++] = (unsigned int)mgp->msi_enabled; 1391 data[i++] = (unsigned int)mgp->msi_enabled;
1381 data[i++] = (unsigned int)mgp->read_dma; 1392 data[i++] = (unsigned int)mgp->read_dma;
@@ -1456,6 +1467,8 @@ static int myri10ge_allocate_rings(struct net_device *dev)
1456 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0); 1467 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0);
1457 tx_ring_size = cmd.data0; 1468 tx_ring_size = cmd.data0;
1458 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); 1469 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0);
1470 if (status != 0)
1471 return status;
1459 rx_ring_size = cmd.data0; 1472 rx_ring_size = cmd.data0;
1460 1473
1461 tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send); 1474 tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send);
@@ -1463,6 +1476,8 @@ static int myri10ge_allocate_rings(struct net_device *dev)
1463 mgp->tx.mask = tx_ring_entries - 1; 1476 mgp->tx.mask = tx_ring_entries - 1;
1464 mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1; 1477 mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1;
1465 1478
1479 status = -ENOMEM;
1480
1466 /* allocate the host shadow rings */ 1481 /* allocate the host shadow rings */
1467 1482
1468 bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4) 1483 bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4)
@@ -1735,7 +1750,7 @@ static int myri10ge_open(struct net_device *dev)
1735 goto abort_with_irq; 1750 goto abort_with_irq;
1736 } 1751 }
1737 1752
1738 if (myri10ge_wcfifo && mgp->mtrr >= 0) { 1753 if (myri10ge_wcfifo && mgp->wc_enabled) {
1739 mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4; 1754 mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4;
1740 mgp->rx_small.wc_fifo = 1755 mgp->rx_small.wc_fifo =
1741 (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL; 1756 (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL;
@@ -2510,6 +2525,12 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2510 bridge->vendor, bridge->device); 2525 bridge->vendor, bridge->device);
2511 mgp->tx.boundary = 4096; 2526 mgp->tx.boundary = 4096;
2512 mgp->fw_name = myri10ge_fw_aligned; 2527 mgp->fw_name = myri10ge_fw_aligned;
2528 } else if (bridge &&
2529 bridge->vendor == PCI_VENDOR_ID_SGI &&
2530 bridge->device == 0x4002 /* TIOCE pcie-port */ ) {
2531 /* this pcie bridge does not support 4K rdma request */
2532 mgp->tx.boundary = 2048;
2533 mgp->fw_name = myri10ge_fw_aligned;
2513 } 2534 }
2514 } else { 2535 } else {
2515 if (myri10ge_force_firmware == 1) { 2536 if (myri10ge_force_firmware == 1) {
@@ -2830,9 +2851,12 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2830 mgp->board_span = pci_resource_len(pdev, 0); 2851 mgp->board_span = pci_resource_len(pdev, 0);
2831 mgp->iomem_base = pci_resource_start(pdev, 0); 2852 mgp->iomem_base = pci_resource_start(pdev, 0);
2832 mgp->mtrr = -1; 2853 mgp->mtrr = -1;
2854 mgp->wc_enabled = 0;
2833#ifdef CONFIG_MTRR 2855#ifdef CONFIG_MTRR
2834 mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span, 2856 mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span,
2835 MTRR_TYPE_WRCOMB, 1); 2857 MTRR_TYPE_WRCOMB, 1);
2858 if (mgp->mtrr >= 0)
2859 mgp->wc_enabled = 1;
2836#endif 2860#endif
2837 /* Hack. need to get rid of these magic numbers */ 2861 /* Hack. need to get rid of these magic numbers */
2838 mgp->sram_size = 2862 mgp->sram_size =
@@ -2927,7 +2951,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2927 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", 2951 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n",
2928 (mgp->msi_enabled ? "MSI" : "xPIC"), 2952 (mgp->msi_enabled ? "MSI" : "xPIC"),
2929 netdev->irq, mgp->tx.boundary, mgp->fw_name, 2953 netdev->irq, mgp->tx.boundary, mgp->fw_name,
2930 (mgp->mtrr >= 0 ? "Enabled" : "Disabled")); 2954 (mgp->wc_enabled ? "Enabled" : "Disabled"));
2931 2955
2932 return 0; 2956 return 0;
2933 2957
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index a2877f33fa85..1be55702557d 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -228,7 +228,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
228 &adapter->ctx_desc_pdev); 228 &adapter->ctx_desc_pdev);
229 229
230 printk("ctx_desc_phys_addr: 0x%llx\n", 230 printk("ctx_desc_phys_addr: 0x%llx\n",
231 (u64) adapter->ctx_desc_phys_addr); 231 (unsigned long long) adapter->ctx_desc_phys_addr);
232 if (addr == NULL) { 232 if (addr == NULL) {
233 DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); 233 DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
234 err = -ENOMEM; 234 err = -ENOMEM;
@@ -247,7 +247,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
247 adapter->max_tx_desc_count, 247 adapter->max_tx_desc_count,
248 (dma_addr_t *) & hw->cmd_desc_phys_addr, 248 (dma_addr_t *) & hw->cmd_desc_phys_addr,
249 &adapter->ahw.cmd_desc_pdev); 249 &adapter->ahw.cmd_desc_pdev);
250 printk("cmd_desc_phys_addr: 0x%llx\n", (u64) hw->cmd_desc_phys_addr); 250 printk("cmd_desc_phys_addr: 0x%llx\n",
251 (unsigned long long) hw->cmd_desc_phys_addr);
251 252
252 if (addr == NULL) { 253 if (addr == NULL) {
253 DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); 254 DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 15d954e50cae..521b5f0618a4 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -572,8 +572,8 @@ static void rtl8169_xmii_reset_enable(void __iomem *ioaddr)
572{ 572{
573 unsigned int val; 573 unsigned int val;
574 574
575 mdio_write(ioaddr, MII_BMCR, BMCR_RESET); 575 val = mdio_read(ioaddr, MII_BMCR) | BMCR_RESET;
576 val = mdio_read(ioaddr, MII_BMCR); 576 mdio_write(ioaddr, MII_BMCR, val & 0xffff);
577} 577}
578 578
579static void rtl8169_check_link_status(struct net_device *dev, 579static void rtl8169_check_link_status(struct net_device *dev,
@@ -1368,11 +1368,7 @@ static inline void rtl8169_request_timer(struct net_device *dev)
1368 (tp->phy_version >= RTL_GIGA_PHY_VER_H)) 1368 (tp->phy_version >= RTL_GIGA_PHY_VER_H))
1369 return; 1369 return;
1370 1370
1371 init_timer(timer); 1371 mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT);
1372 timer->expires = jiffies + RTL8169_PHY_TIMEOUT;
1373 timer->data = (unsigned long)(dev);
1374 timer->function = rtl8169_phy_timer;
1375 add_timer(timer);
1376} 1372}
1377 1373
1378#ifdef CONFIG_NET_POLL_CONTROLLER 1374#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1685,6 +1681,10 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1685 tp->mmio_addr = ioaddr; 1681 tp->mmio_addr = ioaddr;
1686 tp->align = rtl_cfg_info[ent->driver_data].align; 1682 tp->align = rtl_cfg_info[ent->driver_data].align;
1687 1683
1684 init_timer(&tp->timer);
1685 tp->timer.data = (unsigned long) dev;
1686 tp->timer.function = rtl8169_phy_timer;
1687
1688 spin_lock_init(&tp->lock); 1688 spin_lock_init(&tp->lock);
1689 1689
1690 rc = register_netdev(dev); 1690 rc = register_netdev(dev);
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 53839979cfb8..ab0ab92583fe 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2165,9 +2165,27 @@ force_update:
2165 /* fall through */ 2165 /* fall through */
2166#endif 2166#endif
2167 case OP_RXCHKS: 2167 case OP_RXCHKS:
2168 skb = sky2->rx_ring[sky2->rx_next].skb; 2168 if (!sky2->rx_csum)
2169 skb->ip_summed = CHECKSUM_COMPLETE; 2169 break;
2170 skb->csum = status & 0xffff; 2170
2171 /* Both checksum counters are programmed to start at
2172 * the same offset, so unless there is a problem they
2173 * should match. This failure is an early indication that
2174 * hardware receive checksumming won't work.
2175 */
2176 if (likely(status >> 16 == (status & 0xffff))) {
2177 skb = sky2->rx_ring[sky2->rx_next].skb;
2178 skb->ip_summed = CHECKSUM_COMPLETE;
2179 skb->csum = status & 0xffff;
2180 } else {
2181 printk(KERN_NOTICE PFX "%s: hardware receive "
2182 "checksum problem (status = %#x)\n",
2183 dev->name, status);
2184 sky2->rx_csum = 0;
2185 sky2_write32(sky2->hw,
2186 Q_ADDR(rxqaddr[le->link], Q_CSR),
2187 BMU_DIS_RX_CHKSUM);
2188 }
2171 break; 2189 break;
2172 2190
2173 case OP_TXINDEXLE: 2191 case OP_TXINDEXLE:
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index 0d97e10ccac5..36202e94ee91 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -186,7 +186,6 @@ static char __devinit *adapter_def(char type)
186#define TRC_INITV 0x02 /* verbose init trace points */ 186#define TRC_INITV 0x02 /* verbose init trace points */
187static unsigned char ibmtr_debug_trace = 0; 187static unsigned char ibmtr_debug_trace = 0;
188 188
189static int ibmtr_probe(struct net_device *dev);
190static int ibmtr_probe1(struct net_device *dev, int ioaddr); 189static int ibmtr_probe1(struct net_device *dev, int ioaddr);
191static unsigned char get_sram_size(struct tok_info *adapt_info); 190static unsigned char get_sram_size(struct tok_info *adapt_info);
192static int trdev_init(struct net_device *dev); 191static int trdev_init(struct net_device *dev);
@@ -335,17 +334,6 @@ static void ibmtr_cleanup_card(struct net_device *dev)
335#endif 334#endif
336} 335}
337 336
338int ibmtr_probe_card(struct net_device *dev)
339{
340 int err = ibmtr_probe(dev);
341 if (!err) {
342 err = register_netdev(dev);
343 if (err)
344 ibmtr_cleanup_card(dev);
345 }
346 return err;
347}
348
349/**************************************************************************** 337/****************************************************************************
350 * ibmtr_probe(): Routine specified in the network device structure 338 * ibmtr_probe(): Routine specified in the network device structure
351 * to probe for an IBM Token Ring Adapter. Routine outline: 339 * to probe for an IBM Token Ring Adapter. Routine outline:
@@ -358,7 +346,7 @@ int ibmtr_probe_card(struct net_device *dev)
358 * which references it. 346 * which references it.
359 ****************************************************************************/ 347 ****************************************************************************/
360 348
361static int ibmtr_probe(struct net_device *dev) 349static int __init ibmtr_probe(struct net_device *dev)
362{ 350{
363 int i; 351 int i;
364 int base_addr = dev->base_addr; 352 int base_addr = dev->base_addr;
@@ -378,6 +366,17 @@ static int ibmtr_probe(struct net_device *dev)
378 return -ENODEV; 366 return -ENODEV;
379} 367}
380 368
369int __init ibmtr_probe_card(struct net_device *dev)
370{
371 int err = ibmtr_probe(dev);
372 if (!err) {
373 err = register_netdev(dev);
374 if (err)
375 ibmtr_cleanup_card(dev);
376 }
377 return err;
378}
379
381/*****************************************************************************/ 380/*****************************************************************************/
382 381
383static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) 382static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index ebbda1d8f542..f3a972e74e9a 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -30,8 +30,8 @@
30*/ 30*/
31 31
32#define DRV_NAME "via-rhine" 32#define DRV_NAME "via-rhine"
33#define DRV_VERSION "1.4.2" 33#define DRV_VERSION "1.4.3"
34#define DRV_RELDATE "Sept-11-2006" 34#define DRV_RELDATE "2007-03-06"
35 35
36 36
37/* A few user-configurable values. 37/* A few user-configurable values.
@@ -105,6 +105,7 @@ static const int multicast_filter_limit = 32;
105#include <asm/io.h> 105#include <asm/io.h>
106#include <asm/irq.h> 106#include <asm/irq.h>
107#include <asm/uaccess.h> 107#include <asm/uaccess.h>
108#include <linux/dmi.h>
108 109
109/* These identify the driver base version and may not be removed. */ 110/* These identify the driver base version and may not be removed. */
110static char version[] __devinitdata = 111static char version[] __devinitdata =
@@ -1995,6 +1996,23 @@ static struct pci_driver rhine_driver = {
1995 .shutdown = rhine_shutdown, 1996 .shutdown = rhine_shutdown,
1996}; 1997};
1997 1998
1999static struct dmi_system_id __initdata rhine_dmi_table[] = {
2000 {
2001 .ident = "EPIA-M",
2002 .matches = {
2003 DMI_MATCH(DMI_BIOS_VENDOR, "Award Software International, Inc."),
2004 DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"),
2005 },
2006 },
2007 {
2008 .ident = "KV7",
2009 .matches = {
2010 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
2011 DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"),
2012 },
2013 },
2014 { NULL }
2015};
1998 2016
1999static int __init rhine_init(void) 2017static int __init rhine_init(void)
2000{ 2018{
@@ -2002,6 +2020,16 @@ static int __init rhine_init(void)
2002#ifdef MODULE 2020#ifdef MODULE
2003 printk(version); 2021 printk(version);
2004#endif 2022#endif
2023 if (dmi_check_system(rhine_dmi_table)) {
2024 /* these BIOSes fail at PXE boot if chip is in D3 */
2025 avoid_D3 = 1;
2026 printk(KERN_WARNING "%s: Broken BIOS detected, avoid_D3 "
2027 "enabled.\n",
2028 DRV_NAME);
2029 }
2030 else if (avoid_D3)
2031 printk(KERN_INFO "%s: avoid_D3 set.\n", DRV_NAME);
2032
2005 return pci_register_driver(&rhine_driver); 2033 return pci_register_driver(&rhine_driver);
2006} 2034}
2007 2035
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c
index 8dbcf83bb5f3..8b4540bfc1b0 100644
--- a/drivers/net/wan/z85230.c
+++ b/drivers/net/wan/z85230.c
@@ -407,7 +407,7 @@ static void z8530_tx(struct z8530_channel *c)
407 while(c->txcount) { 407 while(c->txcount) {
408 /* FIFO full ? */ 408 /* FIFO full ? */
409 if(!(read_zsreg(c, R0)&4)) 409 if(!(read_zsreg(c, R0)&4))
410 break; 410 return;
411 c->txcount--; 411 c->txcount--;
412 /* 412 /*
413 * Shovel out the byte 413 * Shovel out the byte
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index e594af46ff05..80cb88eb98c6 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -1858,9 +1858,6 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id)
1858 1858
1859 spin_lock(&bcm->irq_lock); 1859 spin_lock(&bcm->irq_lock);
1860 1860
1861 assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
1862 assert(bcm->current_core->id == BCM43xx_COREID_80211);
1863
1864 reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); 1861 reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
1865 if (reason == 0xffffffff) { 1862 if (reason == 0xffffffff) {
1866 /* irq not for us (shared irq) */ 1863 /* irq not for us (shared irq) */
@@ -1871,6 +1868,9 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id)
1871 if (!reason) 1868 if (!reason)
1872 goto out; 1869 goto out;
1873 1870
1871 assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
1872 assert(bcm->current_core->id == BCM43xx_COREID_80211);
1873
1874 bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON) 1874 bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON)
1875 & 0x0001DC00; 1875 & 0x0001DC00;
1876 bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON) 1876 bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index 3a5c9c2b2150..cae89258a640 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -859,6 +859,11 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
859 bcm43xx_radio_write16(bcm, 0x005D, 0x0088); 859 bcm43xx_radio_write16(bcm, 0x005D, 0x0088);
860 bcm43xx_radio_write16(bcm, 0x005E, 0x0088); 860 bcm43xx_radio_write16(bcm, 0x005E, 0x0088);
861 bcm43xx_radio_write16(bcm, 0x007D, 0x0088); 861 bcm43xx_radio_write16(bcm, 0x007D, 0x0088);
862 bcm43xx_shm_write32(bcm, BCM43xx_SHM_SHARED,
863 BCM43xx_UCODEFLAGS_OFFSET,
864 (bcm43xx_shm_read32(bcm, BCM43xx_SHM_SHARED,
865 BCM43xx_UCODEFLAGS_OFFSET)
866 | 0x00000200));
862 } 867 }
863 if (radio->revision == 8) { 868 if (radio->revision == 8) {
864 bcm43xx_radio_write16(bcm, 0x0051, 0x0000); 869 bcm43xx_radio_write16(bcm, 0x0051, 0x0000);
@@ -941,7 +946,8 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
941 bcm43xx_phy_write(bcm, 0x0038, 0x0668); 946 bcm43xx_phy_write(bcm, 0x0038, 0x0668);
942 bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF); 947 bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF);
943 if (radio->revision <= 5) 948 if (radio->revision <= 5)
944 bcm43xx_phy_write(bcm, 0x005D, bcm43xx_phy_read(bcm, 0x005D) | 0x0003); 949 bcm43xx_phy_write(bcm, 0x005D, (bcm43xx_phy_read(bcm, 0x005D)
950 & 0xFF80) | 0x0003);
945 if (radio->revision <= 2) 951 if (radio->revision <= 2)
946 bcm43xx_radio_write16(bcm, 0x005D, 0x000D); 952 bcm43xx_radio_write16(bcm, 0x005D, 0x000D);
947 953
@@ -958,7 +964,7 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
958 bcm43xx_phy_write(bcm, 0x0016, 0x0410); 964 bcm43xx_phy_write(bcm, 0x0016, 0x0410);
959 bcm43xx_phy_write(bcm, 0x0017, 0x0820); 965 bcm43xx_phy_write(bcm, 0x0017, 0x0820);
960 bcm43xx_phy_write(bcm, 0x0062, 0x0007); 966 bcm43xx_phy_write(bcm, 0x0062, 0x0007);
961 (void) bcm43xx_radio_calibrationvalue(bcm); 967 bcm43xx_radio_init2050(bcm);
962 bcm43xx_phy_lo_g_measure(bcm); 968 bcm43xx_phy_lo_g_measure(bcm);
963 if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) { 969 if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) {
964 bcm43xx_calc_nrssi_slope(bcm); 970 bcm43xx_calc_nrssi_slope(bcm);
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index 7b665e2386a8..d6d9413d7f23 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -105,18 +105,24 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
105 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 105 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
106 unsigned long flags; 106 unsigned long flags;
107 u8 channel; 107 u8 channel;
108 s8 expon;
108 int freq; 109 int freq;
109 int err = -EINVAL; 110 int err = -EINVAL;
110 111
111 mutex_lock(&bcm->mutex); 112 mutex_lock(&bcm->mutex);
112 spin_lock_irqsave(&bcm->irq_lock, flags); 113 spin_lock_irqsave(&bcm->irq_lock, flags);
113 114
114 if ((data->freq.m >= 0) && (data->freq.m <= 1000)) { 115 if ((data->freq.e == 0) &&
116 (data->freq.m >= 0) && (data->freq.m <= 1000)) {
115 channel = data->freq.m; 117 channel = data->freq.m;
116 freq = bcm43xx_channel_to_freq(bcm, channel); 118 freq = bcm43xx_channel_to_freq(bcm, channel);
117 } else { 119 } else {
118 channel = bcm43xx_freq_to_channel(bcm, data->freq.m);
119 freq = data->freq.m; 120 freq = data->freq.m;
121 expon = 6 - data->freq.e;
122 while (--expon >= 0) /* scale down the frequency to MHz */
123 freq /= 10;
124 assert(freq > 1000);
125 channel = bcm43xx_freq_to_channel(bcm, freq);
120 } 126 }
121 if (!ieee80211_is_valid_channel(bcm->ieee, channel)) 127 if (!ieee80211_is_valid_channel(bcm->ieee, channel))
122 goto out_unlock; 128 goto out_unlock;
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 7a535542fe92..118ac9779b3c 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -89,6 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
89 return; 89 return;
90 90
91 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag 91 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
92 res->irq_resource[i].flags |= irq_flags(triggering, polarity);
92 irq = acpi_register_gsi(gsi, triggering, polarity); 93 irq = acpi_register_gsi(gsi, triggering, polarity);
93 if (irq < 0) { 94 if (irq < 0) {
94 res->irq_resource[i].flags |= IORESOURCE_DISABLED; 95 res->irq_resource[i].flags |= IORESOURCE_DISABLED;
@@ -103,8 +104,52 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
103 pcibios_penalize_isa_irq(irq, 1); 104 pcibios_penalize_isa_irq(irq, 1);
104} 105}
105 106
107static int dma_flags(int type, int bus_master, int transfer)
108{
109 int flags = 0;
110
111 if (bus_master)
112 flags |= IORESOURCE_DMA_MASTER;
113 switch (type) {
114 case ACPI_COMPATIBILITY:
115 flags |= IORESOURCE_DMA_COMPATIBLE;
116 break;
117 case ACPI_TYPE_A:
118 flags |= IORESOURCE_DMA_TYPEA;
119 break;
120 case ACPI_TYPE_B:
121 flags |= IORESOURCE_DMA_TYPEB;
122 break;
123 case ACPI_TYPE_F:
124 flags |= IORESOURCE_DMA_TYPEF;
125 break;
126 default:
127 /* Set a default value ? */
128 flags |= IORESOURCE_DMA_COMPATIBLE;
129 pnp_err("Invalid DMA type");
130 }
131 switch (transfer) {
132 case ACPI_TRANSFER_8:
133 flags |= IORESOURCE_DMA_8BIT;
134 break;
135 case ACPI_TRANSFER_8_16:
136 flags |= IORESOURCE_DMA_8AND16BIT;
137 break;
138 case ACPI_TRANSFER_16:
139 flags |= IORESOURCE_DMA_16BIT;
140 break;
141 default:
142 /* Set a default value ? */
143 flags |= IORESOURCE_DMA_8AND16BIT;
144 pnp_err("Invalid DMA transfer type");
145 }
146
147 return flags;
148}
149
106static void 150static void
107pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) 151pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma,
152 int type, int bus_master, int transfer)
108{ 153{
109 int i = 0; 154 int i = 0;
110 while (i < PNP_MAX_DMA && 155 while (i < PNP_MAX_DMA &&
@@ -112,6 +157,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma)
112 i++; 157 i++;
113 if (i < PNP_MAX_DMA) { 158 if (i < PNP_MAX_DMA) {
114 res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag 159 res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag
160 res->dma_resource[i].flags |= dma_flags(type, bus_master, transfer);
115 if (dma == -1) { 161 if (dma == -1) {
116 res->dma_resource[i].flags |= IORESOURCE_DISABLED; 162 res->dma_resource[i].flags |= IORESOURCE_DISABLED;
117 return; 163 return;
@@ -123,7 +169,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma)
123 169
124static void 170static void
125pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, 171pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
126 u64 io, u64 len) 172 u64 io, u64 len, int io_decode)
127{ 173{
128 int i = 0; 174 int i = 0;
129 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && 175 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -131,6 +177,8 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
131 i++; 177 i++;
132 if (i < PNP_MAX_PORT) { 178 if (i < PNP_MAX_PORT) {
133 res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag 179 res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag
180 if (io_decode == ACPI_DECODE_16)
181 res->port_resource[i].flags |= PNP_PORT_FLAG_16BITADDR;
134 if (len <= 0 || (io + len -1) >= 0x10003) { 182 if (len <= 0 || (io + len -1) >= 0x10003) {
135 res->port_resource[i].flags |= IORESOURCE_DISABLED; 183 res->port_resource[i].flags |= IORESOURCE_DISABLED;
136 return; 184 return;
@@ -142,7 +190,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
142 190
143static void 191static void
144pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, 192pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
145 u64 mem, u64 len) 193 u64 mem, u64 len, int write_protect)
146{ 194{
147 int i = 0; 195 int i = 0;
148 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && 196 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
@@ -154,6 +202,9 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
154 res->mem_resource[i].flags |= IORESOURCE_DISABLED; 202 res->mem_resource[i].flags |= IORESOURCE_DISABLED;
155 return; 203 return;
156 } 204 }
205 if(write_protect == ACPI_READ_WRITE_MEMORY)
206 res->mem_resource[i].flags |= IORESOURCE_MEM_WRITEABLE;
207
157 res->mem_resource[i].start = mem; 208 res->mem_resource[i].start = mem;
158 res->mem_resource[i].end = mem + len - 1; 209 res->mem_resource[i].end = mem + len - 1;
159 } 210 }
@@ -178,10 +229,11 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
178 229
179 if (p->resource_type == ACPI_MEMORY_RANGE) 230 if (p->resource_type == ACPI_MEMORY_RANGE)
180 pnpacpi_parse_allocated_memresource(res_table, 231 pnpacpi_parse_allocated_memresource(res_table,
181 p->minimum, p->address_length); 232 p->minimum, p->address_length, p->info.mem.write_protect);
182 else if (p->resource_type == ACPI_IO_RANGE) 233 else if (p->resource_type == ACPI_IO_RANGE)
183 pnpacpi_parse_allocated_ioresource(res_table, 234 pnpacpi_parse_allocated_ioresource(res_table,
184 p->minimum, p->address_length); 235 p->minimum, p->address_length,
236 p->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16);
185} 237}
186 238
187static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, 239static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
@@ -208,13 +260,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
208 case ACPI_RESOURCE_TYPE_DMA: 260 case ACPI_RESOURCE_TYPE_DMA:
209 if (res->data.dma.channel_count > 0) 261 if (res->data.dma.channel_count > 0)
210 pnpacpi_parse_allocated_dmaresource(res_table, 262 pnpacpi_parse_allocated_dmaresource(res_table,
211 res->data.dma.channels[0]); 263 res->data.dma.channels[0],
264 res->data.dma.type,
265 res->data.dma.bus_master,
266 res->data.dma.transfer);
212 break; 267 break;
213 268
214 case ACPI_RESOURCE_TYPE_IO: 269 case ACPI_RESOURCE_TYPE_IO:
215 pnpacpi_parse_allocated_ioresource(res_table, 270 pnpacpi_parse_allocated_ioresource(res_table,
216 res->data.io.minimum, 271 res->data.io.minimum,
217 res->data.io.address_length); 272 res->data.io.address_length,
273 res->data.io.io_decode);
218 break; 274 break;
219 275
220 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 276 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -224,7 +280,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
224 case ACPI_RESOURCE_TYPE_FIXED_IO: 280 case ACPI_RESOURCE_TYPE_FIXED_IO:
225 pnpacpi_parse_allocated_ioresource(res_table, 281 pnpacpi_parse_allocated_ioresource(res_table,
226 res->data.fixed_io.address, 282 res->data.fixed_io.address,
227 res->data.fixed_io.address_length); 283 res->data.fixed_io.address_length,
284 ACPI_DECODE_10);
228 break; 285 break;
229 286
230 case ACPI_RESOURCE_TYPE_VENDOR: 287 case ACPI_RESOURCE_TYPE_VENDOR:
@@ -236,17 +293,20 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
236 case ACPI_RESOURCE_TYPE_MEMORY24: 293 case ACPI_RESOURCE_TYPE_MEMORY24:
237 pnpacpi_parse_allocated_memresource(res_table, 294 pnpacpi_parse_allocated_memresource(res_table,
238 res->data.memory24.minimum, 295 res->data.memory24.minimum,
239 res->data.memory24.address_length); 296 res->data.memory24.address_length,
297 res->data.memory24.write_protect);
240 break; 298 break;
241 case ACPI_RESOURCE_TYPE_MEMORY32: 299 case ACPI_RESOURCE_TYPE_MEMORY32:
242 pnpacpi_parse_allocated_memresource(res_table, 300 pnpacpi_parse_allocated_memresource(res_table,
243 res->data.memory32.minimum, 301 res->data.memory32.minimum,
244 res->data.memory32.address_length); 302 res->data.memory32.address_length,
303 res->data.memory32.write_protect);
245 break; 304 break;
246 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 305 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
247 pnpacpi_parse_allocated_memresource(res_table, 306 pnpacpi_parse_allocated_memresource(res_table,
248 res->data.fixed_memory32.address, 307 res->data.fixed_memory32.address,
249 res->data.fixed_memory32.address_length); 308 res->data.fixed_memory32.address_length,
309 res->data.fixed_memory32.write_protect);
250 break; 310 break;
251 case ACPI_RESOURCE_TYPE_ADDRESS16: 311 case ACPI_RESOURCE_TYPE_ADDRESS16:
252 case ACPI_RESOURCE_TYPE_ADDRESS32: 312 case ACPI_RESOURCE_TYPE_ADDRESS32:
@@ -304,42 +364,8 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
304 364
305 for(i = 0; i < p->channel_count; i++) 365 for(i = 0; i < p->channel_count; i++)
306 dma->map |= 1 << p->channels[i]; 366 dma->map |= 1 << p->channels[i];
307 dma->flags = 0; 367
308 if (p->bus_master) 368 dma->flags = dma_flags(p->type, p->bus_master, p->transfer);
309 dma->flags |= IORESOURCE_DMA_MASTER;
310 switch (p->type) {
311 case ACPI_COMPATIBILITY:
312 dma->flags |= IORESOURCE_DMA_COMPATIBLE;
313 break;
314 case ACPI_TYPE_A:
315 dma->flags |= IORESOURCE_DMA_TYPEA;
316 break;
317 case ACPI_TYPE_B:
318 dma->flags |= IORESOURCE_DMA_TYPEB;
319 break;
320 case ACPI_TYPE_F:
321 dma->flags |= IORESOURCE_DMA_TYPEF;
322 break;
323 default:
324 /* Set a default value ? */
325 dma->flags |= IORESOURCE_DMA_COMPATIBLE;
326 pnp_err("Invalid DMA type");
327 }
328 switch (p->transfer) {
329 case ACPI_TRANSFER_8:
330 dma->flags |= IORESOURCE_DMA_8BIT;
331 break;
332 case ACPI_TRANSFER_8_16:
333 dma->flags |= IORESOURCE_DMA_8AND16BIT;
334 break;
335 case ACPI_TRANSFER_16:
336 dma->flags |= IORESOURCE_DMA_16BIT;
337 break;
338 default:
339 /* Set a default value ? */
340 dma->flags |= IORESOURCE_DMA_8AND16BIT;
341 pnp_err("Invalid DMA transfer type");
342 }
343 369
344 pnp_register_dma_resource(option, dma); 370 pnp_register_dma_resource(option, dma);
345 return; 371 return;
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index 253ceb895ca7..a27e9e92cb5e 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -636,25 +636,6 @@ static irqreturn_t sn_sal_interrupt(int irq, void *dev_id)
636} 636}
637 637
638/** 638/**
639 * sn_sal_connect_interrupt - Request interrupt, handled by sn_sal_interrupt
640 * @port: Our sn_cons_port (which contains the uart port)
641 *
642 * returns the console irq if interrupt is successfully registered, else 0
643 *
644 */
645static int sn_sal_connect_interrupt(struct sn_cons_port *port)
646{
647 if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt,
648 IRQF_DISABLED | IRQF_SHARED,
649 "SAL console driver", port) >= 0) {
650 return SGI_UART_VECTOR;
651 }
652
653 printk(KERN_INFO "sn_console: console proceeding in polled mode\n");
654 return 0;
655}
656
657/**
658 * sn_sal_timer_poll - this function handles polled console mode 639 * sn_sal_timer_poll - this function handles polled console mode
659 * @data: A pointer to our sn_cons_port (which contains the uart port) 640 * @data: A pointer to our sn_cons_port (which contains the uart port)
660 * 641 *
@@ -746,30 +727,31 @@ static void __init sn_sal_switch_to_asynch(struct sn_cons_port *port)
746 * mode. We were previously in asynch/polling mode (using init_timer). 727 * mode. We were previously in asynch/polling mode (using init_timer).
747 * 728 *
748 * We attempt to switch to interrupt mode here by calling 729 * We attempt to switch to interrupt mode here by calling
749 * sn_sal_connect_interrupt. If that works out, we enable receive interrupts. 730 * request_irq. If that works out, we enable receive interrupts.
750 */ 731 */
751static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port) 732static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port)
752{ 733{
753 int irq;
754 unsigned long flags; 734 unsigned long flags;
755 735
756 if (!port) 736 if (port) {
757 return; 737 DPRINTF("sn_console: switching to interrupt driven console\n");
758
759 DPRINTF("sn_console: switching to interrupt driven console\n");
760
761 spin_lock_irqsave(&port->sc_port.lock, flags);
762 738
763 irq = sn_sal_connect_interrupt(port); 739 if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt,
740 IRQF_DISABLED | IRQF_SHARED,
741 "SAL console driver", port) >= 0) {
742 spin_lock_irqsave(&port->sc_port.lock, flags);
743 port->sc_port.irq = SGI_UART_VECTOR;
744 port->sc_ops = &intr_ops;
764 745
765 if (irq) { 746 /* turn on receive interrupts */
766 port->sc_port.irq = irq; 747 ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV);
767 port->sc_ops = &intr_ops; 748 spin_unlock_irqrestore(&port->sc_port.lock, flags);
768 749 }
769 /* turn on receive interrupts */ 750 else {
770 ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV); 751 printk(KERN_INFO
752 "sn_console: console proceeding in polled mode\n");
753 }
771 } 754 }
772 spin_unlock_irqrestore(&port->sc_port.lock, flags);
773} 755}
774 756
775/* 757/*
diff --git a/fs/compat.c b/fs/compat.c
index 0ec70e3cee0a..040a8be38a48 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -48,6 +48,7 @@
48#include <linux/highmem.h> 48#include <linux/highmem.h>
49#include <linux/poll.h> 49#include <linux/poll.h>
50#include <linux/mm.h> 50#include <linux/mm.h>
51#include <linux/eventpoll.h>
51 52
52#include <net/sock.h> /* siocdevprivate_ioctl */ 53#include <net/sock.h> /* siocdevprivate_ioctl */
53 54
@@ -2235,3 +2236,102 @@ long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2)
2235 return sys_ni_syscall(); 2236 return sys_ni_syscall();
2236} 2237}
2237#endif 2238#endif
2239
2240#ifdef CONFIG_EPOLL
2241
2242#ifdef CONFIG_HAS_COMPAT_EPOLL_EVENT
2243asmlinkage long compat_sys_epoll_ctl(int epfd, int op, int fd,
2244 struct compat_epoll_event __user *event)
2245{
2246 long err = 0;
2247 struct compat_epoll_event user;
2248 struct epoll_event __user *kernel = NULL;
2249
2250 if (event) {
2251 if (copy_from_user(&user, event, sizeof(user)))
2252 return -EFAULT;
2253 kernel = compat_alloc_user_space(sizeof(struct epoll_event));
2254 err |= __put_user(user.events, &kernel->events);
2255 err |= __put_user(user.data, &kernel->data);
2256 }
2257
2258 return err ? err : sys_epoll_ctl(epfd, op, fd, kernel);
2259}
2260
2261
2262asmlinkage long compat_sys_epoll_wait(int epfd,
2263 struct compat_epoll_event __user *events,
2264 int maxevents, int timeout)
2265{
2266 long i, ret, err = 0;
2267 struct epoll_event __user *kbuf;
2268 struct epoll_event ev;
2269
2270 if ((maxevents <= 0) ||
2271 (maxevents > (INT_MAX / sizeof(struct epoll_event))))
2272 return -EINVAL;
2273 kbuf = compat_alloc_user_space(sizeof(struct epoll_event) * maxevents);
2274 ret = sys_epoll_wait(epfd, kbuf, maxevents, timeout);
2275 for (i = 0; i < ret; i++) {
2276 err |= __get_user(ev.events, &kbuf[i].events);
2277 err |= __get_user(ev.data, &kbuf[i].data);
2278 err |= __put_user(ev.events, &events->events);
2279 err |= __put_user_unaligned(ev.data, &events->data);
2280 events++;
2281 }
2282
2283 return err ? -EFAULT: ret;
2284}
2285#endif /* CONFIG_HAS_COMPAT_EPOLL_EVENT */
2286
2287#ifdef TIF_RESTORE_SIGMASK
2288asmlinkage long compat_sys_epoll_pwait(int epfd,
2289 struct compat_epoll_event __user *events,
2290 int maxevents, int timeout,
2291 const compat_sigset_t __user *sigmask,
2292 compat_size_t sigsetsize)
2293{
2294 long err;
2295 compat_sigset_t csigmask;
2296 sigset_t ksigmask, sigsaved;
2297
2298 /*
2299 * If the caller wants a certain signal mask to be set during the wait,
2300 * we apply it here.
2301 */
2302 if (sigmask) {
2303 if (sigsetsize != sizeof(compat_sigset_t))
2304 return -EINVAL;
2305 if (copy_from_user(&csigmask, sigmask, sizeof(csigmask)))
2306 return -EFAULT;
2307 sigset_from_compat(&ksigmask, &csigmask);
2308 sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
2309 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
2310 }
2311
2312#ifdef CONFIG_HAS_COMPAT_EPOLL_EVENT
2313 err = compat_sys_epoll_wait(epfd, events, maxevents, timeout);
2314#else
2315 err = sys_epoll_wait(epfd, events, maxevents, timeout);
2316#endif
2317
2318 /*
2319 * If we changed the signal mask, we need to restore the original one.
2320 * In case we've got a signal while waiting, we do not restore the
2321 * signal mask yet, and we allow do_signal() to deliver the signal on
2322 * the way back to userspace, before the signal mask is restored.
2323 */
2324 if (sigmask) {
2325 if (err == -EINTR) {
2326 memcpy(&current->saved_sigmask, &sigsaved,
2327 sizeof(sigsaved));
2328 set_thread_flag(TIF_RESTORE_SIGMASK);
2329 } else
2330 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
2331 }
2332
2333 return err;
2334}
2335#endif /* TIF_RESTORE_SIGMASK */
2336
2337#endif /* CONFIG_EPOLL */
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index 40db61dc95f2..3870150b83a4 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -22,6 +22,7 @@
22#include "lockspace.h" 22#include "lockspace.h"
23#include "lock.h" 23#include "lock.h"
24#include "lvb_table.h" 24#include "lvb_table.h"
25#include "user.h"
25 26
26static const char *name_prefix="dlm"; 27static const char *name_prefix="dlm";
27static struct miscdevice ctl_device; 28static struct miscdevice ctl_device;
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index e62f3fc7241e..1548be26b5e6 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -38,7 +38,7 @@ static struct dentry *lock_parent(struct dentry *dentry)
38 struct dentry *dir; 38 struct dentry *dir;
39 39
40 dir = dget(dentry->d_parent); 40 dir = dget(dentry->d_parent);
41 mutex_lock(&(dir->d_inode->i_mutex)); 41 mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT);
42 return dir; 42 return dir;
43} 43}
44 44
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 6618c1190252..12accb08fe02 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -20,6 +20,7 @@
20#include <linux/list.h> 20#include <linux/list.h>
21#include <linux/lm_interface.h> 21#include <linux/lm_interface.h>
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/module.h>
23#include <linux/rwsem.h> 24#include <linux/rwsem.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25 26
@@ -953,9 +954,6 @@ static void drop_bh(struct gfs2_glock *gl, unsigned int ret)
953 spin_unlock(&gl->gl_spin); 954 spin_unlock(&gl->gl_spin);
954 } 955 }
955 956
956 if (glops->go_drop_bh)
957 glops->go_drop_bh(gl);
958
959 spin_lock(&gl->gl_spin); 957 spin_lock(&gl->gl_spin);
960 gl->gl_req_gh = NULL; 958 gl->gl_req_gh = NULL;
961 gl->gl_req_bh = NULL; 959 gl->gl_req_bh = NULL;
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 46af55355513..39c8ae23bd9c 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -245,7 +245,6 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
245 245
246 if (ip && S_ISREG(ip->i_inode.i_mode)) { 246 if (ip && S_ISREG(ip->i_inode.i_mode)) {
247 truncate_inode_pages(ip->i_inode.i_mapping, 0); 247 truncate_inode_pages(ip->i_inode.i_mapping, 0);
248 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), !ip->i_inode.i_mapping->nrpages);
249 clear_bit(GIF_PAGED, &ip->i_flags); 248 clear_bit(GIF_PAGED, &ip->i_flags);
250 } 249 }
251} 250}
@@ -459,6 +458,8 @@ const struct gfs2_glock_operations gfs2_inode_glops = {
459}; 458};
460 459
461const struct gfs2_glock_operations gfs2_rgrp_glops = { 460const struct gfs2_glock_operations gfs2_rgrp_glops = {
461 .go_xmote_th = meta_go_sync,
462 .go_drop_th = meta_go_sync,
462 .go_inval = meta_go_inval, 463 .go_inval = meta_go_inval,
463 .go_demote_ok = rgrp_go_demote_ok, 464 .go_demote_ok = rgrp_go_demote_ok,
464 .go_lock = rgrp_go_lock, 465 .go_lock = rgrp_go_lock,
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 12c80fd28db5..49f0dbf40d86 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -104,7 +104,6 @@ struct gfs2_glock_operations {
104 void (*go_xmote_th) (struct gfs2_glock *gl); 104 void (*go_xmote_th) (struct gfs2_glock *gl);
105 void (*go_xmote_bh) (struct gfs2_glock *gl); 105 void (*go_xmote_bh) (struct gfs2_glock *gl);
106 void (*go_drop_th) (struct gfs2_glock *gl); 106 void (*go_drop_th) (struct gfs2_glock *gl);
107 void (*go_drop_bh) (struct gfs2_glock *gl);
108 void (*go_inval) (struct gfs2_glock *gl, int flags); 107 void (*go_inval) (struct gfs2_glock *gl, int flags);
109 int (*go_demote_ok) (struct gfs2_glock *gl); 108 int (*go_demote_ok) (struct gfs2_glock *gl);
110 int (*go_lock) (struct gfs2_holder *gh); 109 int (*go_lock) (struct gfs2_holder *gh);
@@ -416,7 +415,6 @@ struct gfs2_tune {
416 unsigned int gt_stall_secs; /* Detects trouble! */ 415 unsigned int gt_stall_secs; /* Detects trouble! */
417 unsigned int gt_complain_secs; 416 unsigned int gt_complain_secs;
418 unsigned int gt_reclaim_limit; /* Max num of glocks in reclaim list */ 417 unsigned int gt_reclaim_limit; /* Max num of glocks in reclaim list */
419 unsigned int gt_entries_per_readdir;
420 unsigned int gt_statfs_quantum; 418 unsigned int gt_statfs_quantum;
421 unsigned int gt_statfs_slow; 419 unsigned int gt_statfs_slow;
422}; 420};
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 0d6831a40565..df0b8b3018b9 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -43,7 +43,8 @@ static int iget_test(struct inode *inode, void *opaque)
43 struct gfs2_inode *ip = GFS2_I(inode); 43 struct gfs2_inode *ip = GFS2_I(inode);
44 struct gfs2_inum_host *inum = opaque; 44 struct gfs2_inum_host *inum = opaque;
45 45
46 if (ip->i_num.no_addr == inum->no_addr) 46 if (ip->i_num.no_addr == inum->no_addr &&
47 inode->i_private != NULL)
47 return 1; 48 return 1;
48 49
49 return 0; 50 return 0;
@@ -61,13 +62,13 @@ static int iget_set(struct inode *inode, void *opaque)
61 62
62struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum) 63struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum)
63{ 64{
64 return ilookup5(sb, (unsigned long)inum->no_formal_ino, 65 return ilookup5(sb, (unsigned long)inum->no_addr,
65 iget_test, inum); 66 iget_test, inum);
66} 67}
67 68
68static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum_host *inum) 69static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum_host *inum)
69{ 70{
70 return iget5_locked(sb, (unsigned long)inum->no_formal_ino, 71 return iget5_locked(sb, (unsigned long)inum->no_addr,
71 iget_test, iget_set, inum); 72 iget_test, iget_set, inum);
72} 73}
73 74
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 56e33590b656..b3b7e8475359 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -266,9 +266,11 @@ skip_lock:
266out: 266out:
267 return error; 267 return error;
268out_unlock: 268out_unlock:
269 if (error == GLR_TRYFAILED)
270 error = AOP_TRUNCATED_PAGE;
271 unlock_page(page); 269 unlock_page(page);
270 if (error == GLR_TRYFAILED) {
271 error = AOP_TRUNCATED_PAGE;
272 yield();
273 }
272 if (do_unlock) 274 if (do_unlock)
273 gfs2_holder_uninit(&gh); 275 gfs2_holder_uninit(&gh);
274 goto out; 276 goto out;
@@ -364,6 +366,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
364 if (error == GLR_TRYFAILED) { 366 if (error == GLR_TRYFAILED) {
365 unlock_page(page); 367 unlock_page(page);
366 error = AOP_TRUNCATED_PAGE; 368 error = AOP_TRUNCATED_PAGE;
369 yield();
367 } 370 }
368 goto out_uninit; 371 goto out_uninit;
369 } 372 }
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index 1de05b63d43a..aad918337a46 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -38,14 +38,11 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb,
38 struct gfs2_fh_obj fh_obj; 38 struct gfs2_fh_obj fh_obj;
39 struct gfs2_inum_host *this, parent; 39 struct gfs2_inum_host *this, parent;
40 40
41 if (fh_type != fh_len)
42 return NULL;
43
44 this = &fh_obj.this; 41 this = &fh_obj.this;
45 fh_obj.imode = DT_UNKNOWN; 42 fh_obj.imode = DT_UNKNOWN;
46 memset(&parent, 0, sizeof(struct gfs2_inum)); 43 memset(&parent, 0, sizeof(struct gfs2_inum));
47 44
48 switch (fh_type) { 45 switch (fh_len) {
49 case GFS2_LARGE_FH_SIZE: 46 case GFS2_LARGE_FH_SIZE:
50 parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32; 47 parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
51 parent.no_formal_ino |= be32_to_cpu(fh[5]); 48 parent.no_formal_ino |= be32_to_cpu(fh[5]);
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ee80b8a5e7bc..ee54cb667083 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -840,7 +840,7 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
840 } 840 }
841 841
842 printk(KERN_WARNING "GFS2: Unrecognized block device or " 842 printk(KERN_WARNING "GFS2: Unrecognized block device or "
843 "mount point %s", dev_name); 843 "mount point %s\n", dev_name);
844 844
845free_nd: 845free_nd:
846 path_release(&nd); 846 path_release(&nd);
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index d0db881b55d2..c186857e48a8 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -279,7 +279,7 @@ static int bh_get(struct gfs2_quota_data *qd)
279 (bh->b_data + sizeof(struct gfs2_meta_header) + 279 (bh->b_data + sizeof(struct gfs2_meta_header) +
280 offset * sizeof(struct gfs2_quota_change)); 280 offset * sizeof(struct gfs2_quota_change));
281 281
282 mutex_lock(&sdp->sd_quota_mutex); 282 mutex_unlock(&sdp->sd_quota_mutex);
283 283
284 return 0; 284 return 0;
285 285
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 70f424fcf1cd..4fdda974dc83 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -76,7 +76,6 @@ void gfs2_tune_init(struct gfs2_tune *gt)
76 gt->gt_stall_secs = 600; 76 gt->gt_stall_secs = 600;
77 gt->gt_complain_secs = 10; 77 gt->gt_complain_secs = 10;
78 gt->gt_reclaim_limit = 5000; 78 gt->gt_reclaim_limit = 5000;
79 gt->gt_entries_per_readdir = 32;
80 gt->gt_statfs_quantum = 30; 79 gt->gt_statfs_quantum = 30;
81 gt->gt_statfs_slow = 0; 80 gt->gt_statfs_slow = 0;
82} 81}
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index e965eb11d76f..9baf69773ed1 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -47,7 +47,7 @@ struct dentry_operations hostfs_dentry_ops = {
47}; 47};
48 48
49/* Changed in hostfs_args before the kernel starts running */ 49/* Changed in hostfs_args before the kernel starts running */
50static char *root_ino = "/"; 50static char *root_ino = "";
51static int append = 0; 51static int append = 0;
52 52
53#define HOSTFS_SUPER_MAGIC 0x00c0ffee 53#define HOSTFS_SUPER_MAGIC 0x00c0ffee
@@ -947,15 +947,17 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
947 sb->s_magic = HOSTFS_SUPER_MAGIC; 947 sb->s_magic = HOSTFS_SUPER_MAGIC;
948 sb->s_op = &hostfs_sbops; 948 sb->s_op = &hostfs_sbops;
949 949
950 if((data == NULL) || (*data == '\0')) 950 /* NULL is printed as <NULL> by sprintf: avoid that. */
951 data = root_ino; 951 if (data == NULL)
952 data = "";
952 953
953 err = -ENOMEM; 954 err = -ENOMEM;
954 name = kmalloc(strlen(data) + 1, GFP_KERNEL); 955 name = kmalloc(strlen(root_ino) + 1
956 + strlen(data) + 1, GFP_KERNEL);
955 if(name == NULL) 957 if(name == NULL)
956 goto out; 958 goto out;
957 959
958 strcpy(name, data); 960 sprintf(name, "%s/%s", root_ino, data);
959 961
960 root_inode = iget(sb, 0); 962 root_inode = iget(sb, 0);
961 if(root_inode == NULL) 963 if(root_inode == NULL)
@@ -966,6 +968,9 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
966 goto out_put; 968 goto out_put;
967 969
968 HOSTFS_I(root_inode)->host_filename = name; 970 HOSTFS_I(root_inode)->host_filename = name;
971 /* Avoid that in the error path, iput(root_inode) frees again name through
972 * hostfs_destroy_inode! */
973 name = NULL;
969 974
970 err = -ENOMEM; 975 err = -ENOMEM;
971 sb->s_root = d_alloc_root(root_inode); 976 sb->s_root = d_alloc_root(root_inode);
@@ -977,7 +982,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
977 /* No iput in this case because the dput does that for us */ 982 /* No iput in this case because the dput does that for us */
978 dput(sb->s_root); 983 dput(sb->s_root);
979 sb->s_root = NULL; 984 sb->s_root = NULL;
980 goto out_free; 985 goto out;
981 } 986 }
982 987
983 return(0); 988 return(0);
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 6eb3daebd563..888f236e5494 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -99,7 +99,13 @@ static int jffs2_garbage_collect_thread(void *_c)
99 if (try_to_freeze()) 99 if (try_to_freeze())
100 continue; 100 continue;
101 101
102 cond_resched(); 102 /* This thread is purely an optimisation. But if it runs when
103 other things could be running, it actually makes things a
104 lot worse. Use yield() and put it at the back of the runqueue
105 every time. Especially during boot, pulling an inode in
106 with read_inode() is much preferable to having the GC thread
107 get there first. */
108 yield();
103 109
104 /* Put_super will send a SIGKILL and then wait on the sem. 110 /* Put_super will send a SIGKILL and then wait on the sem.
105 */ 111 */
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 58a0b912e9d0..717a48cf7df2 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -373,7 +373,14 @@ free_out:
373static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, struct jffs2_unknown_node *un) 373static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, struct jffs2_unknown_node *un)
374{ 374{
375 /* We don't mark unknown nodes as REF_UNCHECKED */ 375 /* We don't mark unknown nodes as REF_UNCHECKED */
376 BUG_ON(ref_flags(ref) == REF_UNCHECKED); 376 if (ref_flags(ref) == REF_UNCHECKED) {
377 JFFS2_ERROR("REF_UNCHECKED but unknown node at %#08x\n",
378 ref_offset(ref));
379 JFFS2_ERROR("Node is {%04x,%04x,%08x,%08x}. Please report this error.\n",
380 je16_to_cpu(un->magic), je16_to_cpu(un->nodetype),
381 je32_to_cpu(un->totlen), je32_to_cpu(un->hdr_crc));
382 return 1;
383 }
377 384
378 un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype)); 385 un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype));
379 386
@@ -576,6 +583,13 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
576 jffs2_mark_node_obsolete(c, ref); 583 jffs2_mark_node_obsolete(c, ref);
577 goto cont; 584 goto cont;
578 } 585 }
586 /* Due to poor choice of crc32 seed, an all-zero node will have a correct CRC */
587 if (!je32_to_cpu(node->u.hdr_crc) && !je16_to_cpu(node->u.nodetype) &&
588 !je16_to_cpu(node->u.magic) && !je32_to_cpu(node->u.totlen)) {
589 JFFS2_NOTICE("All zero node header at %#08x.\n", ref_offset(ref));
590 jffs2_mark_node_obsolete(c, ref);
591 goto cont;
592 }
579 593
580 switch (je16_to_cpu(node->u.nodetype)) { 594 switch (je16_to_cpu(node->u.nodetype)) {
581 595
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 31c1475d922a..7fb45bd4915c 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -734,6 +734,15 @@ scan_more:
734 ofs += 4; 734 ofs += 4;
735 continue; 735 continue;
736 } 736 }
737 /* Due to poor choice of crc32 seed, an all-zero node will have a correct CRC */
738 if (!je32_to_cpu(node->hdr_crc) && !je16_to_cpu(node->nodetype) &&
739 !je16_to_cpu(node->magic) && !je32_to_cpu(node->totlen)) {
740 noisy_printk(&noise, "jffs2_scan_eraseblock(): All zero node header at 0x%08x.\n", ofs);
741 if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
742 return err;
743 ofs += 4;
744 continue;
745 }
737 746
738 if (ofs + je32_to_cpu(node->totlen) > 747 if (ofs + je32_to_cpu(node->totlen) >
739 jeb->offset + c->sector_size) { 748 jeb->offset + c->sector_size) {
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index de718e3a1692..4fac6dd53954 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -238,7 +238,10 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
238 jeb = &c->blocks[c->wbuf_ofs / c->sector_size]; 238 jeb = &c->blocks[c->wbuf_ofs / c->sector_size];
239 239
240 spin_lock(&c->erase_completion_lock); 240 spin_lock(&c->erase_completion_lock);
241 jffs2_block_refile(c, jeb, REFILE_NOTEMPTY); 241 if (c->wbuf_ofs % c->mtd->erasesize)
242 jffs2_block_refile(c, jeb, REFILE_NOTEMPTY);
243 else
244 jffs2_block_refile(c, jeb, REFILE_ANYWAY);
242 spin_unlock(&c->erase_completion_lock); 245 spin_unlock(&c->erase_completion_lock);
243 246
244 BUG_ON(!ref_obsolete(jeb->last_node)); 247 BUG_ON(!ref_obsolete(jeb->last_node));
@@ -1087,7 +1090,7 @@ int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *
1087 if (!c->mtd->block_markbad) 1090 if (!c->mtd->block_markbad)
1088 return 1; // What else can we do? 1091 return 1; // What else can we do?
1089 1092
1090 D1(printk(KERN_WARNING "jffs2_write_nand_badblock(): Marking bad block at %08x\n", bad_offset)); 1093 printk(KERN_WARNING "JFFS2: marking eraseblock at %08x\n as bad", bad_offset);
1091 ret = c->mtd->block_markbad(c->mtd, bad_offset); 1094 ret = c->mtd->block_markbad(c->mtd, bad_offset);
1092 1095
1093 if (ret) { 1096 if (ret) {
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 22d38ffc9ef0..e46d237b10f9 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -180,7 +180,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
180 } 180 }
181 if (res > 0) 181 if (res > 0)
182 return state; 182 return state;
183 if (!err) 183 if (err)
184 /* The partition is unrecognized. So report I/O errors if there were any */ 184 /* The partition is unrecognized. So report I/O errors if there were any */
185 res = err; 185 res = err;
186 if (!res) 186 if (!res)
diff --git a/include/asm-avr32/Kbuild b/include/asm-avr32/Kbuild
index 8770e73ce938..3136628ba8d2 100644
--- a/include/asm-avr32/Kbuild
+++ b/include/asm-avr32/Kbuild
@@ -1,3 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3headers-y += cachectl.h 3header-y += cachectl.h
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index 115813e48fe0..21bb60bbb9a1 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -274,6 +274,24 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
274 dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction); 274 dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction);
275} 275}
276 276
277static inline void
278dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
279 unsigned long offset, size_t size,
280 enum dma_data_direction direction)
281{
282 /* just sync everything, that's all the pci API can do */
283 dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
284}
285
286static inline void
287dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
288 unsigned long offset, size_t size,
289 enum dma_data_direction direction)
290{
291 /* just sync everything, that's all the pci API can do */
292 dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
293}
294
277/** 295/**
278 * dma_sync_sg_for_cpu 296 * dma_sync_sg_for_cpu
279 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 297 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index e06ef0776d48..833437d31ef1 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -74,7 +74,7 @@
74 * 74 *
75 */ 75 */
76 76
77#ifndef GENERIC_ISA_DMA_SUPPORT_BROKEN 77#ifndef CONFIG_GENERIC_ISA_DMA_SUPPORT_BROKEN
78#define MAX_DMA_CHANNELS 8 78#define MAX_DMA_CHANNELS 8
79#endif 79#endif
80 80
diff --git a/include/asm-mips/sibyte/trace_prof.h b/include/asm-mips/sibyte/trace_prof.h
deleted file mode 100644
index 557792075e9a..000000000000
--- a/include/asm-mips/sibyte/trace_prof.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * Copyright (C) 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef __ASM_SIBYTE_TRACE_PROF_H
20#define __ASM_SIBYTE_TRACE_PROF_H
21
22#undef DBG
23#if SBPROF_TB_DEBUG
24#define DBG(a) a
25#else
26#define DBG(a)
27#endif
28
29#define SBPROF_TB_MAJOR 240
30#define DEVNAME "bcm1250_tbprof"
31
32typedef u_int64_t tb_sample_t[6*256];
33
34struct sbprof_tb {
35 int open;
36 tb_sample_t *sbprof_tbbuf;
37 int next_tb_sample;
38
39 volatile int tb_enable;
40 volatile int tb_armed;
41
42 wait_queue_head_t tb_sync;
43 wait_queue_head_t tb_read;
44};
45
46#define MAX_SAMPLE_BYTES (24*1024*1024)
47#define MAX_TBSAMPLE_BYTES (12*1024*1024)
48
49#define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t))
50#define TB_SAMPLE_SIZE (sizeof(tb_sample_t))
51#define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE)
52
53/* IOCTLs */
54#define SBPROF_ZBSTART _IOW('s', 0, int)
55#define SBPROF_ZBSTOP _IOW('s', 1, int)
56#define SBPROF_ZBWAITFULL _IOW('s', 2, int)
57
58/***************************************************************************
59 * Routines for gathering ZBbus profiles using trace buffer
60 ***************************************************************************/
61
62/* Requires: Already called zclk_timer_init with a value that won't
63 saturate 40 bits. No subsequent use of SCD performance counters
64 or trace buffer.
65 Effect: Starts gathering random ZBbus profiles using trace buffer. */
66extern int sbprof_zbprof_start(struct file *filp);
67
68/* Effect: Stops collection of ZBbus profiles */
69extern int sbprof_zbprof_stop(void);
70
71
72/***************************************************************************
73 * Routines for using 40-bit SCD cycle counter
74 *
75 * Client responsible for either handling interrupts or making sure
76 * the cycles counter never saturates, e.g., by doing
77 * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs.
78 ***************************************************************************/
79
80/* Configures SCD counter 0 to count ZCLKs starting from val;
81 Configures SCD counters1,2,3 to count nothing.
82 Must not be called while gathering ZBbus profiles.
83
84unsigned long long val; */
85#define zclk_timer_init(val) \
86 __asm__ __volatile__ (".set push;" \
87 ".set mips64;" \
88 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
89 "sd %0, 0x10($8);" /* write val to counter0 */ \
90 "sd %1, 0($8);" /* config counter0 for zclks*/ \
91 ".set pop" \
92 : /* no outputs */ \
93 /* enable, counter0 */ \
94 : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \
95 : /* modifies */ "$8" )
96
97
98/* Reads SCD counter 0 and puts result in value
99 unsigned long long val; */
100#define zclk_get(val) \
101 __asm__ __volatile__ (".set push;" \
102 ".set mips64;" \
103 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
104 "ld %0, 0x10($8);" /* write val to counter0 */ \
105 ".set pop" \
106 : /* outputs */ "=r"(val) \
107 : /* inputs */ \
108 : /* modifies */ "$8" )
109
110#endif /* __ASM_SIBYTE_TRACE_PROF_H */
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
index e3a180cf5062..9a3cb6ba9d15 100644
--- a/include/asm-sh/cache.h
+++ b/include/asm-sh/cache.h
@@ -21,6 +21,7 @@
21 21
22#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 22#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
23 23
24#ifndef __ASSEMBLY__
24struct cache_info { 25struct cache_info {
25 unsigned int ways; /* Number of cache ways */ 26 unsigned int ways; /* Number of cache ways */
26 unsigned int sets; /* Number of cache sets */ 27 unsigned int sets; /* Number of cache sets */
@@ -47,6 +48,6 @@ struct cache_info {
47 48
48 unsigned long flags; 49 unsigned long flags;
49}; 50};
50 51#endif /* __ASSEMBLY__ */
51#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
52#endif /* __ASM_SH_CACHE_H */ 53#endif /* __ASM_SH_CACHE_H */
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
index 22f12634975b..07f62ec9ff0c 100644
--- a/include/asm-sh/cacheflush.h
+++ b/include/asm-sh/cacheflush.h
@@ -30,8 +30,5 @@ extern void __flush_invalidate_region(void *start, int size);
30 30
31#define HAVE_ARCH_UNMAPPED_AREA 31#define HAVE_ARCH_UNMAPPED_AREA
32 32
33/* Page flag for lazy dcache write-back for the aliasing UP caches */
34#define PG_dcache_dirty PG_arch_1
35
36#endif /* __KERNEL__ */ 33#endif /* __KERNEL__ */
37#endif /* __ASM_SH_CACHEFLUSH_H */ 34#endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh3/cacheflush.h b/include/asm-sh/cpu-sh3/cacheflush.h
index 6fabbba228de..f70d8ef76a15 100644
--- a/include/asm-sh/cpu-sh3/cacheflush.h
+++ b/include/asm-sh/cpu-sh3/cacheflush.h
@@ -36,6 +36,8 @@
36 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */ 36 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */
37#define CACHE_ALIAS 0x00001000 37#define CACHE_ALIAS 0x00001000
38 38
39#define PG_mapped PG_arch_1
40
39void flush_cache_all(void); 41void flush_cache_all(void);
40void flush_cache_mm(struct mm_struct *mm); 42void flush_cache_mm(struct mm_struct *mm);
41#define flush_cache_dup_mm(mm) flush_cache_mm(mm) 43#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
diff --git a/include/asm-sh/cpu-sh4/cacheflush.h b/include/asm-sh/cpu-sh4/cacheflush.h
index b3746a936a09..5fd5c89ef86a 100644
--- a/include/asm-sh/cpu-sh4/cacheflush.h
+++ b/include/asm-sh/cpu-sh4/cacheflush.h
@@ -39,4 +39,6 @@ void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
39/* Initialization of P3 area for copy_user_page */ 39/* Initialization of P3 area for copy_user_page */
40void p3_cache_init(void); 40void p3_cache_init(void);
41 41
42#define PG_mapped PG_arch_1
43
42#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */ 44#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index 9214c015fe14..184d7fcaaf10 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -583,6 +583,11 @@ struct mm_struct;
583extern unsigned int kobjsize(const void *objp); 583extern unsigned int kobjsize(const void *objp);
584#endif /* !CONFIG_MMU */ 584#endif /* !CONFIG_MMU */
585 585
586#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)
587#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
588extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
589#endif
590
586extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 591extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
587extern void paging_init(void); 592extern void paging_init(void);
588 593
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 279e70a77c75..31d55e3782d5 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -111,6 +111,7 @@ static inline struct thread_info *current_thread_info(void)
111#define TIF_SIGPENDING 2 /* signal pending */ 111#define TIF_SIGPENDING 2 /* signal pending */
112#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 112#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
113#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ 113#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
114#define TIF_SINGLESTEP 5 /* singlestepping active */
114#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 115#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
115#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 116#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
116#define TIF_MEMDIE 18 117#define TIF_MEMDIE 18
@@ -121,6 +122,7 @@ static inline struct thread_info *current_thread_info(void)
121#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 122#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
122#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 123#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
123#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 124#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
125#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
124#define _TIF_USEDFPU (1<<TIF_USEDFPU) 126#define _TIF_USEDFPU (1<<TIF_USEDFPU)
125#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 127#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
126#define _TIF_FREEZE (1<<TIF_FREEZE) 128#define _TIF_FREEZE (1<<TIF_FREEZE)
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index be9509c8f8c1..284dfd01a33d 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -19,6 +19,17 @@
19 */ 19 */
20#define HAS_DMA 20#define HAS_DMA
21 21
22static DEFINE_SPINLOCK(dma_spin_lock);
23
24#define claim_dma_lock() \
25({ unsigned long flags; \
26 spin_lock_irqsave(&dma_spin_lock, flags); \
27 flags; \
28})
29
30#define release_dma_lock(__flags) \
31 spin_unlock_irqrestore(&dma_spin_lock, __flags);
32
22static struct sparc_ebus_info { 33static struct sparc_ebus_info {
23 struct ebus_dma_info info; 34 struct ebus_dma_info info;
24 unsigned int addr; 35 unsigned int addr;
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 80b17f440ec1..ccd863dd77fa 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -234,5 +234,24 @@ asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
234 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, 234 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
235 const compat_ulong_t __user *new_nodes); 235 const compat_ulong_t __user *new_nodes);
236 236
237/*
238 * epoll (fs/eventpoll.c) compat bits follow ...
239 */
240#ifndef CONFIG_HAS_COMPAT_EPOLL_EVENT
241struct epoll_event;
242#define compat_epoll_event epoll_event
243#else
244asmlinkage long compat_sys_epoll_ctl(int epfd, int op, int fd,
245 struct compat_epoll_event __user *event);
246asmlinkage long compat_sys_epoll_wait(int epfd,
247 struct compat_epoll_event __user *events,
248 int maxevents, int timeout);
249#endif
250asmlinkage long compat_sys_epoll_pwait(int epfd,
251 struct compat_epoll_event __user *events,
252 int maxevents, int timeout,
253 const compat_sigset_t __user *sigmask,
254 compat_size_t sigsetsize);
255
237#endif /* CONFIG_COMPAT */ 256#endif /* CONFIG_COMPAT */
238#endif /* _LINUX_COMPAT_H */ 257#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 6a8570be331b..3d956c3abb31 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -121,6 +121,7 @@ struct mtd_info {
121 u_int32_t writesize; 121 u_int32_t writesize;
122 122
123 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 123 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16)
124 u_int32_t oobavail; // Available OOB bytes per block
124 125
125 // Kernel-only stuff starts here. 126 // Kernel-only stuff starts here.
126 char *name; 127 char *name;
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index d8af8a95e58d..a56d24ada505 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -82,7 +82,8 @@ struct onenand_bufferram {
82 * @wq: [INTERN] wait queue to sleep on if a OneNAND 82 * @wq: [INTERN] wait queue to sleep on if a OneNAND
83 * operation is in progress 83 * operation is in progress
84 * @state: [INTERN] the current state of the OneNAND device 84 * @state: [INTERN] the current state of the OneNAND device
85 * @page_buf: data buffer 85 * @page_buf: [INTERN] page main data buffer
86 * @oob_buf: [INTERN] page oob data buffer
86 * @subpagesize: [INTERN] holds the subpagesize 87 * @subpagesize: [INTERN] holds the subpagesize
87 * @ecclayout: [REPLACEABLE] the default ecc placement scheme 88 * @ecclayout: [REPLACEABLE] the default ecc placement scheme
88 * @bbm: [REPLACEABLE] pointer to Bad Block Management 89 * @bbm: [REPLACEABLE] pointer to Bad Block Management
@@ -122,6 +123,7 @@ struct onenand_chip {
122 wait_queue_head_t wq; 123 wait_queue_head_t wq;
123 onenand_state_t state; 124 onenand_state_t state;
124 unsigned char *page_buf; 125 unsigned char *page_buf;
126 unsigned char *oob_buf;
125 127
126 int subpagesize; 128 int subpagesize;
127 struct nand_ecclayout *ecclayout; 129 struct nand_ecclayout *ecclayout;
@@ -156,6 +158,7 @@ struct onenand_chip {
156#define ONENAND_HAS_CONT_LOCK (0x0001) 158#define ONENAND_HAS_CONT_LOCK (0x0001)
157#define ONENAND_HAS_UNLOCK_ALL (0x0002) 159#define ONENAND_HAS_UNLOCK_ALL (0x0002)
158#define ONENAND_PAGEBUF_ALLOC (0x1000) 160#define ONENAND_PAGEBUF_ALLOC (0x1000)
161#define ONENAND_OOBBUF_ALLOC (0x2000)
159 162
160/* 163/*
161 * OneNAND Flash Manufacturer ID Codes 164 * OneNAND Flash Manufacturer ID Codes
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 92a1fc46ea59..5a00aa85b756 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -988,8 +988,9 @@ extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int,
988int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 988int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
989struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 989struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
990 struct xfrm_selector *sel, 990 struct xfrm_selector *sel,
991 struct xfrm_sec_ctx *ctx, int delete); 991 struct xfrm_sec_ctx *ctx, int delete,
992struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); 992 int *err);
993struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err);
993void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); 994void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
994u32 xfrm_get_acqseq(void); 995u32 xfrm_get_acqseq(void);
995void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi); 996void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 34b2301276ce..1b255df4fcd0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -846,7 +846,8 @@ static ctl_table vm_table[] = {
846 .extra2 = &one_hundred, 846 .extra2 = &one_hundred,
847 }, 847 },
848#endif 848#endif
849#ifdef CONFIG_X86_32 849#if defined(CONFIG_X86_32) || \
850 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
850 { 851 {
851 .ctl_name = VM_VDSO_ENABLED, 852 .ctl_name = VM_VDSO_ENABLED,
852 .procname = "vdso_enabled", 853 .procname = "vdso_enabled",
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index f928d2b2a17d..71f5cfbbebb8 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -656,7 +656,7 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
656 /* Detach sockets from device */ 656 /* Detach sockets from device */
657 read_lock(&hci_sk_list.lock); 657 read_lock(&hci_sk_list.lock);
658 sk_for_each(sk, node, &hci_sk_list.head) { 658 sk_for_each(sk, node, &hci_sk_list.head) {
659 bh_lock_sock(sk); 659 lock_sock(sk);
660 if (hci_pi(sk)->hdev == hdev) { 660 if (hci_pi(sk)->hdev == hdev) {
661 hci_pi(sk)->hdev = NULL; 661 hci_pi(sk)->hdev = NULL;
662 sk->sk_err = EPIPE; 662 sk->sk_err = EPIPE;
@@ -665,7 +665,7 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
665 665
666 hci_dev_put(hdev); 666 hci_dev_put(hdev);
667 } 667 }
668 bh_unlock_sock(sk); 668 release_sock(sk);
669 } 669 }
670 read_unlock(&hci_sk_list.lock); 670 read_unlock(&hci_sk_list.lock);
671 } 671 }
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 6845a258408f..f3a2e29be40c 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -428,6 +428,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
428 spin_lock_bh(&br->lock); 428 spin_lock_bh(&br->lock);
429 br_stp_recalculate_bridge_id(br); 429 br_stp_recalculate_bridge_id(br);
430 br_features_recompute(br); 430 br_features_recompute(br);
431
432 if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) &&
433 (br->dev->flags & IFF_UP))
434 br_stp_enable_port(p);
431 spin_unlock_bh(&br->lock); 435 spin_unlock_bh(&br->lock);
432 436
433 dev_set_mtu(br->dev, br_min_mtu(br)); 437 dev_set_mtu(br->dev, br_min_mtu(br));
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 5361a4d8e13b..746f79d104b3 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -545,12 +545,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
545 /* set idle flag */ 545 /* set idle flag */
546 hctx->ccid3hctx_idle = 1; 546 hctx->ccid3hctx_idle = 1;
547 break; 547 break;
548 case TFRC_SSTATE_NO_SENT: 548 case TFRC_SSTATE_NO_SENT: /* fall through */
549 /*
550 * XXX when implementing bidirectional rx/tx check this again
551 */
552 DCCP_WARN("Illegal ACK received - no packet sent\n");
553 /* fall through */
554 case TFRC_SSTATE_TERM: /* ignore feedback when closing */ 549 case TFRC_SSTATE_TERM: /* ignore feedback when closing */
555 break; 550 break;
556 } 551 }
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 287099f7f042..78b043c458bf 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -248,18 +248,8 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
248 DCCP_ACKVEC_STATE_RECEIVED)) 248 DCCP_ACKVEC_STATE_RECEIVED))
249 goto discard; 249 goto discard;
250 250
251 /* 251 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
252 * Deliver to the CCID module in charge. 252 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
253 * FIXME: Currently DCCP operates one-directional only, i.e. a listening
254 * server is not at the same time a connecting client. There is
255 * not much sense in delivering to both rx/tx sides at the moment
256 * (only one is active at a time); when moving to bidirectional
257 * service, this needs to be revised.
258 */
259 if (dccp_sk(sk)->dccps_role == DCCP_ROLE_CLIENT)
260 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
261 else /* listening or connected server */
262 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
263 253
264 return __dccp_rcv_established(sk, skb, dh, len); 254 return __dccp_rcv_established(sk, skb, dh, len);
265discard: 255discard:
@@ -494,11 +484,8 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
494 DCCP_ACKVEC_STATE_RECEIVED)) 484 DCCP_ACKVEC_STATE_RECEIVED))
495 goto discard; 485 goto discard;
496 486
497 /* XXX see the comments in dccp_rcv_established about this */ 487 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
498 if (dccp_sk(sk)->dccps_role == DCCP_ROLE_CLIENT) 488 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
499 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
500 else
501 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
502 } 489 }
503 490
504 /* 491 /*
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ce6c46034314..fc620a7c1db4 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1215,6 +1215,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1215 1215
1216 if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen)) 1216 if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen))
1217 goto short_packet; 1217 goto short_packet;
1218 uh = skb->h.uh;
1218 1219
1219 udp4_csum_init(skb, uh); 1220 udp4_csum_init(skb, uh);
1220 1221
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e16f1bba5dff..a7fee6b27320 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -342,10 +342,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
342 } 342 }
343#endif 343#endif
344 344
345 if (netif_carrier_ok(dev))
346 ndev->if_flags |= IF_READY;
347
348
349 ipv6_mc_init_dev(ndev); 345 ipv6_mc_init_dev(ndev);
350 ndev->tstamp = jiffies; 346 ndev->tstamp = jiffies;
351#ifdef CONFIG_SYSCTL 347#ifdef CONFIG_SYSCTL
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 286c86735aed..4e0561a082d0 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -795,11 +795,15 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
795EXPORT_SYMBOL(compat_ipv6_setsockopt); 795EXPORT_SYMBOL(compat_ipv6_setsockopt);
796#endif 796#endif
797 797
798static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr, 798static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
799 char __user *optval, int len) 799 char __user *optval, int len)
800{ 800{
801 if (!hdr) 801 struct ipv6_opt_hdr *hdr;
802
803 if (!opt || !opt->hopopt)
802 return 0; 804 return 0;
805 hdr = opt->hopopt;
806
803 len = min_t(int, len, ipv6_optlen(hdr)); 807 len = min_t(int, len, ipv6_optlen(hdr));
804 if (copy_to_user(optval, hdr, ipv6_optlen(hdr))) 808 if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
805 return -EFAULT; 809 return -EFAULT;
@@ -940,7 +944,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
940 { 944 {
941 945
942 lock_sock(sk); 946 lock_sock(sk);
943 len = ipv6_getsockopt_sticky(sk, np->opt->hopopt, 947 len = ipv6_getsockopt_sticky(sk, np->opt,
944 optval, len); 948 optval, len);
945 release_sock(sk); 949 release_sock(sk);
946 return put_user(len, optlen); 950 return put_user(len, optlen);
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 6f19c4a49560..d1102455668d 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -257,6 +257,7 @@ static unsigned int ipv6_conntrack_in(unsigned int hooknum,
257 } 257 }
258 nf_conntrack_get(reasm->nfct); 258 nf_conntrack_get(reasm->nfct);
259 (*pskb)->nfct = reasm->nfct; 259 (*pskb)->nfct = reasm->nfct;
260 (*pskb)->nfctinfo = reasm->nfctinfo;
260 return NF_ACCEPT; 261 return NF_ACCEPT;
261 } 262 }
262 263
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 1c58204d767e..a4e7e2db0ff3 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1467,9 +1467,6 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1467 1467
1468 err = xfrm_state_delete(x); 1468 err = xfrm_state_delete(x);
1469 1469
1470 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
1471 AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
1472
1473 if (err < 0) 1470 if (err < 0)
1474 goto out; 1471 goto out;
1475 1472
@@ -1478,6 +1475,8 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1478 c.event = XFRM_MSG_DELSA; 1475 c.event = XFRM_MSG_DELSA;
1479 km_state_notify(x, &c); 1476 km_state_notify(x, &c);
1480out: 1477out:
1478 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
1479 AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
1481 xfrm_state_put(x); 1480 xfrm_state_put(x);
1482 1481
1483 return err; 1482 return err;
@@ -2294,14 +2293,12 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
2294 } 2293 }
2295 2294
2296 xp = xfrm_policy_bysel_ctx(XFRM_POLICY_TYPE_MAIN, pol->sadb_x_policy_dir-1, 2295 xp = xfrm_policy_bysel_ctx(XFRM_POLICY_TYPE_MAIN, pol->sadb_x_policy_dir-1,
2297 &sel, tmp.security, 1); 2296 &sel, tmp.security, 1, &err);
2298 security_xfrm_policy_free(&tmp); 2297 security_xfrm_policy_free(&tmp);
2299 2298
2300 if (xp == NULL) 2299 if (xp == NULL)
2301 return -ENOENT; 2300 return -ENOENT;
2302 2301
2303 err = security_xfrm_policy_delete(xp);
2304
2305 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0, 2302 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
2306 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL); 2303 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
2307 2304
@@ -2539,7 +2536,7 @@ static int pfkey_migrate(struct sock *sk, struct sk_buff *skb,
2539static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs) 2536static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
2540{ 2537{
2541 unsigned int dir; 2538 unsigned int dir;
2542 int err; 2539 int err = 0, delete;
2543 struct sadb_x_policy *pol; 2540 struct sadb_x_policy *pol;
2544 struct xfrm_policy *xp; 2541 struct xfrm_policy *xp;
2545 struct km_event c; 2542 struct km_event c;
@@ -2551,16 +2548,20 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2551 if (dir >= XFRM_POLICY_MAX) 2548 if (dir >= XFRM_POLICY_MAX)
2552 return -EINVAL; 2549 return -EINVAL;
2553 2550
2551 delete = (hdr->sadb_msg_type == SADB_X_SPDDELETE2);
2554 xp = xfrm_policy_byid(XFRM_POLICY_TYPE_MAIN, dir, pol->sadb_x_policy_id, 2552 xp = xfrm_policy_byid(XFRM_POLICY_TYPE_MAIN, dir, pol->sadb_x_policy_id,
2555 hdr->sadb_msg_type == SADB_X_SPDDELETE2); 2553 delete, &err);
2556 if (xp == NULL) 2554 if (xp == NULL)
2557 return -ENOENT; 2555 return -ENOENT;
2558 2556
2559 err = 0; 2557 if (delete) {
2558 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
2559 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
2560 2560
2561 c.seq = hdr->sadb_msg_seq; 2561 if (err)
2562 c.pid = hdr->sadb_msg_pid; 2562 goto out;
2563 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) { 2563 c.seq = hdr->sadb_msg_seq;
2564 c.pid = hdr->sadb_msg_pid;
2564 c.data.byid = 1; 2565 c.data.byid = 1;
2565 c.event = XFRM_MSG_DELPOLICY; 2566 c.event = XFRM_MSG_DELPOLICY;
2566 km_policy_notify(xp, dir, &c); 2567 km_policy_notify(xp, dir, &c);
@@ -2568,6 +2569,7 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2568 err = key_pol_get_resp(sk, xp, hdr, dir); 2569 err = key_pol_get_resp(sk, xp, hdr, dir);
2569 } 2570 }
2570 2571
2572out:
2571 xfrm_pol_put(xp); 2573 xfrm_pol_put(xp);
2572 return err; 2574 return err;
2573} 2575}
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 91a0972ec117..5cb30ebba0f4 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -486,7 +486,7 @@ __build_packet_message(struct nfulnl_instance *inst,
486 * for physical device (when called from ipv4) */ 486 * for physical device (when called from ipv4) */
487 NFA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, 487 NFA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV,
488 sizeof(tmp_uint), &tmp_uint); 488 sizeof(tmp_uint), &tmp_uint);
489 if (skb->nf_bridge) { 489 if (skb->nf_bridge && skb->nf_bridge->physoutdev) {
490 tmp_uint = 490 tmp_uint =
491 htonl(skb->nf_bridge->physoutdev->ifindex); 491 htonl(skb->nf_bridge->physoutdev->ifindex);
492 NFA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, 492 NFA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV,
@@ -615,7 +615,7 @@ nfulnl_log_packet(unsigned int pf,
615 615
616 plen = 0; 616 plen = 0;
617 if (prefix) 617 if (prefix)
618 plen = strlen(prefix); 618 plen = strlen(prefix) + 1;
619 619
620 /* all macros expand to constant values at compile time */ 620 /* all macros expand to constant values at compile time */
621 /* FIXME: do we want to make the size calculation conditional based on 621 /* FIXME: do we want to make the size calculation conditional based on
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 63fe1093b616..0b9c49b3a100 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -360,7 +360,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist,
360 return; 360 return;
361 } 361 }
362 362
363 read_lock(&in6_dev->lock); 363 read_lock_bh(&in6_dev->lock);
364 for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) { 364 for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) {
365 /* Add the address to the local list. */ 365 /* Add the address to the local list. */
366 addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC); 366 addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC);
@@ -374,7 +374,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist,
374 } 374 }
375 } 375 }
376 376
377 read_unlock(&in6_dev->lock); 377 read_unlock_bh(&in6_dev->lock);
378 rcu_read_unlock(); 378 rcu_read_unlock();
379} 379}
380 380
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 946b715db5ec..0c3a70ac5075 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -735,12 +735,14 @@ EXPORT_SYMBOL(xfrm_policy_insert);
735 735
736struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 736struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
737 struct xfrm_selector *sel, 737 struct xfrm_selector *sel,
738 struct xfrm_sec_ctx *ctx, int delete) 738 struct xfrm_sec_ctx *ctx, int delete,
739 int *err)
739{ 740{
740 struct xfrm_policy *pol, *ret; 741 struct xfrm_policy *pol, *ret;
741 struct hlist_head *chain; 742 struct hlist_head *chain;
742 struct hlist_node *entry; 743 struct hlist_node *entry;
743 744
745 *err = 0;
744 write_lock_bh(&xfrm_policy_lock); 746 write_lock_bh(&xfrm_policy_lock);
745 chain = policy_hash_bysel(sel, sel->family, dir); 747 chain = policy_hash_bysel(sel, sel->family, dir);
746 ret = NULL; 748 ret = NULL;
@@ -750,6 +752,11 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
750 xfrm_sec_ctx_match(ctx, pol->security)) { 752 xfrm_sec_ctx_match(ctx, pol->security)) {
751 xfrm_pol_hold(pol); 753 xfrm_pol_hold(pol);
752 if (delete) { 754 if (delete) {
755 *err = security_xfrm_policy_delete(pol);
756 if (*err) {
757 write_unlock_bh(&xfrm_policy_lock);
758 return pol;
759 }
753 hlist_del(&pol->bydst); 760 hlist_del(&pol->bydst);
754 hlist_del(&pol->byidx); 761 hlist_del(&pol->byidx);
755 xfrm_policy_count[dir]--; 762 xfrm_policy_count[dir]--;
@@ -768,12 +775,14 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
768} 775}
769EXPORT_SYMBOL(xfrm_policy_bysel_ctx); 776EXPORT_SYMBOL(xfrm_policy_bysel_ctx);
770 777
771struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete) 778struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete,
779 int *err)
772{ 780{
773 struct xfrm_policy *pol, *ret; 781 struct xfrm_policy *pol, *ret;
774 struct hlist_head *chain; 782 struct hlist_head *chain;
775 struct hlist_node *entry; 783 struct hlist_node *entry;
776 784
785 *err = 0;
777 write_lock_bh(&xfrm_policy_lock); 786 write_lock_bh(&xfrm_policy_lock);
778 chain = xfrm_policy_byidx + idx_hash(id); 787 chain = xfrm_policy_byidx + idx_hash(id);
779 ret = NULL; 788 ret = NULL;
@@ -781,6 +790,11 @@ struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete)
781 if (pol->type == type && pol->index == id) { 790 if (pol->type == type && pol->index == id) {
782 xfrm_pol_hold(pol); 791 xfrm_pol_hold(pol);
783 if (delete) { 792 if (delete) {
793 *err = security_xfrm_policy_delete(pol);
794 if (*err) {
795 write_unlock_bh(&xfrm_policy_lock);
796 return pol;
797 }
784 hlist_del(&pol->bydst); 798 hlist_del(&pol->bydst);
785 hlist_del(&pol->byidx); 799 hlist_del(&pol->byidx);
786 xfrm_policy_count[dir]--; 800 xfrm_policy_count[dir]--;
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 956cfe0ff7f8..96789952f6a3 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -530,9 +530,6 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
530 530
531 err = xfrm_state_delete(x); 531 err = xfrm_state_delete(x);
532 532
533 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
534 AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
535
536 if (err < 0) 533 if (err < 0)
537 goto out; 534 goto out;
538 535
@@ -542,6 +539,8 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
542 km_state_notify(x, &c); 539 km_state_notify(x, &c);
543 540
544out: 541out:
542 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
543 AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
545 xfrm_state_put(x); 544 xfrm_state_put(x);
546 return err; 545 return err;
547} 546}
@@ -1254,7 +1253,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1254 return err; 1253 return err;
1255 1254
1256 if (p->index) 1255 if (p->index)
1257 xp = xfrm_policy_byid(type, p->dir, p->index, delete); 1256 xp = xfrm_policy_byid(type, p->dir, p->index, delete, &err);
1258 else { 1257 else {
1259 struct rtattr *rt = xfrma[XFRMA_SEC_CTX-1]; 1258 struct rtattr *rt = xfrma[XFRMA_SEC_CTX-1];
1260 struct xfrm_policy tmp; 1259 struct xfrm_policy tmp;
@@ -1270,7 +1269,8 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1270 if ((err = security_xfrm_policy_alloc(&tmp, uctx))) 1269 if ((err = security_xfrm_policy_alloc(&tmp, uctx)))
1271 return err; 1270 return err;
1272 } 1271 }
1273 xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security, delete); 1272 xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security,
1273 delete, &err);
1274 security_xfrm_policy_free(&tmp); 1274 security_xfrm_policy_free(&tmp);
1275 } 1275 }
1276 if (xp == NULL) 1276 if (xp == NULL)
@@ -1288,8 +1288,6 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1288 MSG_DONTWAIT); 1288 MSG_DONTWAIT);
1289 } 1289 }
1290 } else { 1290 } else {
1291 err = security_xfrm_policy_delete(xp);
1292
1293 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, 1291 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
1294 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL); 1292 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
1295 1293
@@ -1303,9 +1301,8 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1303 km_policy_notify(xp, p->dir, &c); 1301 km_policy_notify(xp, p->dir, &c);
1304 } 1302 }
1305 1303
1306 xfrm_pol_put(xp);
1307
1308out: 1304out:
1305 xfrm_pol_put(xp);
1309 return err; 1306 return err;
1310} 1307}
1311 1308
@@ -1502,7 +1499,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1502 return err; 1499 return err;
1503 1500
1504 if (p->index) 1501 if (p->index)
1505 xp = xfrm_policy_byid(type, p->dir, p->index, 0); 1502 xp = xfrm_policy_byid(type, p->dir, p->index, 0, &err);
1506 else { 1503 else {
1507 struct rtattr *rt = xfrma[XFRMA_SEC_CTX-1]; 1504 struct rtattr *rt = xfrma[XFRMA_SEC_CTX-1];
1508 struct xfrm_policy tmp; 1505 struct xfrm_policy tmp;
@@ -1518,13 +1515,14 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1518 if ((err = security_xfrm_policy_alloc(&tmp, uctx))) 1515 if ((err = security_xfrm_policy_alloc(&tmp, uctx)))
1519 return err; 1516 return err;
1520 } 1517 }
1521 xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security, 0); 1518 xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security,
1519 0, &err);
1522 security_xfrm_policy_free(&tmp); 1520 security_xfrm_policy_free(&tmp);
1523 } 1521 }
1524 1522
1525 if (xp == NULL) 1523 if (xp == NULL)
1526 return err; 1524 return -ENOENT;
1527 read_lock(&xp->lock); 1525 read_lock(&xp->lock);
1528 if (xp->dead) { 1526 if (xp->dead) {
1529 read_unlock(&xp->lock); 1527 read_unlock(&xp->lock);
1530 goto out; 1528 goto out;