aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.mailmap2
-rw-r--r--Documentation/ABI/obsolete/dv13949
-rw-r--r--Documentation/feature-removal-schedule.txt11
-rw-r--r--Documentation/gpio.txt31
-rw-r--r--Documentation/networking/ip-sysctl.txt9
-rw-r--r--Documentation/x86_64/boot-options.txt4
-rw-r--r--MAINTAINERS41
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/kernel/core_mcpcia.c2
-rw-r--r--arch/alpha/kernel/err_titan.c1
-rw-r--r--arch/alpha/kernel/module.c8
-rw-r--r--arch/alpha/kernel/sys_nautilus.c6
-rw-r--r--arch/alpha/kernel/sys_noritake.c9
-rw-r--r--arch/alpha/kernel/sys_rawhide.c15
-rw-r--r--arch/alpha/kernel/sys_sio.c14
-rw-r--r--arch/alpha/kernel/sys_sx164.c2
-rw-r--r--arch/alpha/kernel/sys_titan.c3
-rw-r--r--arch/arm/configs/s3c2410_defconfig11
-rw-r--r--arch/arm/tools/mach-types99
-rw-r--r--arch/i386/kernel/alternative.c21
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c2
-rw-r--r--arch/i386/kernel/nmi.c17
-rw-r--r--arch/i386/kernel/vmi.c9
-rw-r--r--arch/i386/kernel/vmlinux.lds.S2
-rw-r--r--arch/ia64/kernel/msi_ia64.c4
-rw-r--r--arch/ia64/kernel/setup.c2
-rw-r--r--arch/ia64/sn/kernel/bte_error.c6
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c8
-rw-r--r--arch/mips/kernel/r2300_switch.S10
-rw-r--r--arch/mips/kernel/r4k_switch.S10
-rw-r--r--arch/mips/kernel/signal-common.h9
-rw-r--r--arch/mips/kernel/signal.c52
-rw-r--r--arch/mips/kernel/signal32.c52
-rw-r--r--arch/mips/kernel/traps.c25
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c2
-rw-r--r--arch/mips/sibyte/sb1250/setup.c12
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c4
-rw-r--r--arch/ppc/8xx_io/commproc.c26
-rw-r--r--arch/ppc/configs/ads8272_defconfig592
-rw-r--r--arch/ppc/platforms/mpc8272ads_setup.c17
-rw-r--r--arch/ppc/platforms/mpc866ads_setup.c17
-rw-r--r--arch/ppc/platforms/mpc885ads_setup.c20
-rw-r--r--arch/sparc/kernel/pcic.c4
-rw-r--r--arch/sparc/kernel/sys_sunos.c4
-rw-r--r--arch/sparc64/kernel/pci.c4
-rw-r--r--arch/sparc64/kernel/pci_iommu.c2
-rw-r--r--arch/sparc64/kernel/sbus.c560
-rw-r--r--arch/sparc64/kernel/sys32.S1
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c4
-rw-r--r--arch/sparc64/kernel/systbls.S2
-rw-r--r--arch/sparc64/solaris/misc.c6
-rw-r--r--arch/x86_64/kernel/functionlist1
-rw-r--r--arch/x86_64/kernel/hpet.c9
-rw-r--r--arch/x86_64/kernel/k8.c4
-rw-r--r--arch/x86_64/kernel/nmi.c10
-rw-r--r--arch/x86_64/kernel/pci-gart.c6
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S2
-rw-r--r--arch/x86_64/mm/pageattr.c2
-rw-r--r--block/cfq-iosched.c46
-rw-r--r--drivers/acpi/thermal.c3
-rw-r--r--drivers/ata/pata_sis.c10
-rw-r--r--drivers/base/power/main.c6
-rw-r--r--drivers/block/cciss.c35
-rw-r--r--drivers/block/paride/pcd.c2
-rw-r--r--drivers/block/paride/pf.c2
-rw-r--r--drivers/block/pktcdvd.c3
-rw-r--r--drivers/char/agp/intel-agp.c3
-rw-r--r--drivers/char/mem.c2
-rw-r--r--drivers/char/mxser.c48
-rw-r--r--drivers/char/mxser_new.c45
-rw-r--r--drivers/hid/hid-core.c2
-rw-r--r--drivers/hwmon/w83627ehf.c20
-rw-r--r--drivers/i2c/busses/Kconfig3
-rw-r--r--drivers/i2c/busses/i2c-pasemi.c6
-rw-r--r--drivers/ide/Kconfig1
-rw-r--r--drivers/ide/ide-cd.c9
-rw-r--r--drivers/ide/ide-io.c6
-rw-r--r--drivers/ide/ide-iops.c2
-rw-r--r--drivers/ide/ide.c2
-rw-r--r--drivers/ide/pci/delkin_cb.c1
-rw-r--r--drivers/ide/pci/hpt366.c5
-rw-r--r--drivers/ieee1394/Kconfig6
-rw-r--r--drivers/ieee1394/dv1394.c4
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c12
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c2
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h1
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c40
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c1
-rw-r--r--drivers/kvm/mmu.c1
-rw-r--r--drivers/macintosh/smu.c4
-rw-r--r--drivers/md/bitmap.c4
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c2
-rw-r--r--drivers/misc/asus-laptop.c151
-rw-r--r--drivers/net/Kconfig1
-rw-r--r--drivers/net/bnx2.c7
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/cxgb3/common.h7
-rw-r--r--drivers/net/cxgb3/cxgb3_defs.h5
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c16
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c83
-rw-r--r--drivers/net/cxgb3/regs.h6
-rw-r--r--drivers/net/cxgb3/t3_hw.c18
-rw-r--r--drivers/net/cxgb3/xgmac.c107
-rw-r--r--drivers/net/depca.c3
-rw-r--r--drivers/net/e1000/e1000_main.c13
-rw-r--r--drivers/net/hamradio/baycom_ser_fdx.c6
-rw-r--r--drivers/net/myri10ge/myri10ge.c37
-rw-r--r--drivers/net/ppp_async.c4
-rw-r--r--drivers/net/sc92031.c20
-rw-r--r--drivers/net/sis900.c44
-rw-r--r--drivers/net/skge.c93
-rw-r--r--drivers/net/sky2.c188
-rw-r--r--drivers/net/sky2.h11
-rw-r--r--drivers/net/spider_net.c2
-rw-r--r--drivers/net/sunhme.c2
-rw-r--r--drivers/net/sunlance.c4
-rw-r--r--drivers/net/sunqe.c4
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c20
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c57
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c12
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.h4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_al2230.c6
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c1
-rw-r--r--drivers/parport/parport_sunbpp.c10
-rw-r--r--drivers/pci/probe.c45
-rw-r--r--drivers/sbus/char/openprom.c3
-rw-r--r--drivers/sbus/char/vfc_dev.c3
-rw-r--r--drivers/scsi/3w-xxxx.c11
-rw-r--r--drivers/scsi/qlogicpti.c2
-rw-r--r--drivers/serial/8250.c8
-rw-r--r--drivers/serial/icom.c9
-rw-r--r--drivers/serial/icom.h1
-rw-r--r--drivers/spi/spi_s3c24xx.c4
-rw-r--r--drivers/usb/host/ehci-hcd.c1
-rw-r--r--drivers/usb/net/pegasus.c17
-rw-r--r--drivers/usb/net/pegasus.h3
-rw-r--r--drivers/usb/storage/unusual_devs.h7
-rw-r--r--drivers/video/Kconfig2
-rw-r--r--fs/9p/vfs_inode.c2
-rw-r--r--fs/autofs4/root.c6
-rw-r--r--fs/exec.c18
-rw-r--r--fs/nfs/dir.c3
-rw-r--r--fs/nfs/direct.c11
-rw-r--r--fs/nfs/inode.c6
-rw-r--r--fs/nfs/write.c197
-rw-r--r--fs/reiserfs/item_ops.c2
-rw-r--r--fs/reiserfs/xattr.c92
-rw-r--r--fs/ufs/inode.c29
-rw-r--r--include/asm-alpha/compiler.h47
-rw-r--r--include/asm-alpha/core_mcpcia.h2
-rw-r--r--include/asm-alpha/io.h1
-rw-r--r--include/asm-ia64/sn/pcibr_provider.h5
-rw-r--r--include/asm-mips/bug.h3
-rw-r--r--include/asm-mips/checksum.h2
-rw-r--r--include/asm-mips/fpu.h25
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h1
-rw-r--r--include/asm-mips/thread_info.h1
-rw-r--r--include/asm-powerpc/systbl.h2
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/io.h13
-rw-r--r--include/linux/ipv6.h3
-rw-r--r--include/linux/nfs_page.h31
-rw-r--r--include/linux/plist.h54
-rw-r--r--include/linux/skbuff.h10
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--include/linux/taskstats.h13
-rw-r--r--kernel/params.c4
-rw-r--r--kernel/sysctl.c2
-rw-r--r--mm/migrate.c15
-rw-r--r--mm/nommu.c1
-rw-r--r--mm/oom_kill.c4
-rw-r--r--net/8021q/vlan_dev.c3
-rw-r--r--net/bridge/br_stp_if.c9
-rw-r--r--net/core/neighbour.c5
-rw-r--r--net/core/netpoll.c7
-rw-r--r--net/core/pktgen.c3
-rw-r--r--net/core/skbuff.c55
-rw-r--r--net/ipv4/fib_frontend.c8
-rw-r--r--net/ipv4/netfilter/arp_tables.c10
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c2
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c7
-rw-r--r--net/ipv4/tcp_cong.c23
-rw-r--r--net/ipv4/tcp_output.c3
-rw-r--r--net/ipv4/xfrm4_mode_beet.c4
-rw-r--r--net/ipv6/addrconf.c11
-rw-r--r--net/ipv6/exthdrs.c40
-rw-r--r--net/ipv6/route.c31
-rw-r--r--net/irda/af_irda.c3
-rw-r--r--net/key/af_key.c90
-rw-r--r--net/netlink/af_netlink.c6
-rw-r--r--net/sched/cls_tcindex.c4
-rw-r--r--net/sctp/socket.c54
-rw-r--r--net/sctp/ulpqueue.c9
-rw-r--r--net/sunrpc/clnt.c4
-rw-r--r--net/sunrpc/svcauth_unix.c21
-rw-r--r--net/sunrpc/svcsock.c16
-rw-r--r--net/sunrpc/xprt.c10
-rw-r--r--net/xfrm/xfrm_user.c7
199 files changed, 2615 insertions, 1656 deletions
diff --git a/.mailmap b/.mailmap
index bf62dbea88e6..ebf9bf84da0a 100644
--- a/.mailmap
+++ b/.mailmap
@@ -67,6 +67,8 @@ Koushik <raghavendra.koushik@neterion.com>
67Leonid I Ananiev <leonid.i.ananiev@intel.com> 67Leonid I Ananiev <leonid.i.ananiev@intel.com>
68Linas Vepstas <linas@austin.ibm.com> 68Linas Vepstas <linas@austin.ibm.com>
69Matthieu CASTET <castet.matthieu@free.fr> 69Matthieu CASTET <castet.matthieu@free.fr>
70Michael Buesch <mb@bu3sch.de>
71Michael Buesch <mbuesch@freenet.de>
70Michel Dänzer <michel@tungstengraphics.com> 72Michel Dänzer <michel@tungstengraphics.com>
71Mitesh shah <mshah@teja.com> 73Mitesh shah <mshah@teja.com>
72Morten Welinder <terra@gnome.org> 74Morten Welinder <terra@gnome.org>
diff --git a/Documentation/ABI/obsolete/dv1394 b/Documentation/ABI/obsolete/dv1394
new file mode 100644
index 000000000000..2ee36864ca10
--- /dev/null
+++ b/Documentation/ABI/obsolete/dv1394
@@ -0,0 +1,9 @@
1What: dv1394 (a.k.a. "OHCI-DV I/O support" for FireWire)
2Contact: linux1394-devel@lists.sourceforge.net
3Description:
4 New application development should use raw1394 + userspace libraries
5 instead, notably libiec61883 which is functionally equivalent.
6
7Users:
8 ffmpeg/libavformat (used by a variety of media players)
9 dvgrab v1.x (replaced by dvgrab2 on top of raw1394 and resp. libraries)
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 0bc8b0b2e103..19b4c96b2a49 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -39,17 +39,6 @@ Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de>
39 39
40--------------------------- 40---------------------------
41 41
42What: dv1394 driver (CONFIG_IEEE1394_DV1394)
43When: June 2007
44Why: Replaced by raw1394 + userspace libraries, notably libiec61883. This
45 shift of application support has been indicated on www.linux1394.org
46 and developers' mailinglists for quite some time. Major applications
47 have been converted, with the exception of ffmpeg and hence xine.
48 Piped output of dvgrab2 is a partial equivalent to dv1394.
49Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de>
50
51---------------------------
52
53What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. 42What: Video4Linux API 1 ioctls and video_decoder.h from Video devices.
54When: December 2006 43When: December 2006
55Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 44Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
index 989f1130f4f3..f8528db967fa 100644
--- a/Documentation/gpio.txt
+++ b/Documentation/gpio.txt
@@ -27,7 +27,7 @@ The exact capabilities of GPIOs vary between systems. Common options:
27 - Output values are writable (high=1, low=0). Some chips also have 27 - Output values are writable (high=1, low=0). Some chips also have
28 options about how that value is driven, so that for example only one 28 options about how that value is driven, so that for example only one
29 value might be driven ... supporting "wire-OR" and similar schemes 29 value might be driven ... supporting "wire-OR" and similar schemes
30 for the other value. 30 for the other value (notably, "open drain" signaling).
31 31
32 - Input values are likewise readable (1, 0). Some chips support readback 32 - Input values are likewise readable (1, 0). Some chips support readback
33 of pins configured as "output", which is very useful in such "wire-OR" 33 of pins configured as "output", which is very useful in such "wire-OR"
@@ -247,6 +247,35 @@ with gpio_get_value(), for example to initialize or update driver state
247when the IRQ is edge-triggered. 247when the IRQ is edge-triggered.
248 248
249 249
250Emulating Open Drain Signals
251----------------------------
252Sometimes shared signals need to use "open drain" signaling, where only the
253low signal level is actually driven. (That term applies to CMOS transistors;
254"open collector" is used for TTL.) A pullup resistor causes the high signal
255level. This is sometimes called a "wire-AND"; or more practically, from the
256negative logic (low=true) perspective this is a "wire-OR".
257
258One common example of an open drain signal is a shared active-low IRQ line.
259Also, bidirectional data bus signals sometimes use open drain signals.
260
261Some GPIO controllers directly support open drain outputs; many don't. When
262you need open drain signaling but your hardware doesn't directly support it,
263there's a common idiom you can use to emulate it with any GPIO pin that can
264be used as either an input or an output:
265
266 LOW: gpio_direction_output(gpio, 0) ... this drives the signal
267 and overrides the pullup.
268
269 HIGH: gpio_direction_input(gpio) ... this turns off the output,
270 so the pullup (or some other device) controls the signal.
271
272If you are "driving" the signal high but gpio_get_value(gpio) reports a low
273value (after the appropriate rise time passes), you know some other component
274is driving the shared signal low. That's not necessarily an error. As one
275common example, that's how I2C clocks are stretched: a slave that needs a
276slower clock delays the rising edge of SCK, and the I2C master adjusts its
277signaling rate accordingly.
278
250 279
251What do these conventions omit? 280What do these conventions omit?
252=============================== 281===============================
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index d3aae1f9b4c1..702d1d8dd04a 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -851,6 +851,15 @@ accept_redirects - BOOLEAN
851 Functional default: enabled if local forwarding is disabled. 851 Functional default: enabled if local forwarding is disabled.
852 disabled if local forwarding is enabled. 852 disabled if local forwarding is enabled.
853 853
854accept_source_route - INTEGER
855 Accept source routing (routing extension header).
856
857 > 0: Accept routing header.
858 = 0: Accept only routing header type 2.
859 < 0: Do not accept routing header.
860
861 Default: 0
862
854autoconf - BOOLEAN 863autoconf - BOOLEAN
855 Autoconfigure addresses using Prefix Information in Router 864 Autoconfigure addresses using Prefix Information in Router
856 Advertisements. 865 Advertisements.
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt
index 625a21db0c2a..85f51e5a749f 100644
--- a/Documentation/x86_64/boot-options.txt
+++ b/Documentation/x86_64/boot-options.txt
@@ -293,7 +293,3 @@ Debugging
293 stuck (default) 293 stuck (default)
294 294
295Miscellaneous 295Miscellaneous
296
297 noreplacement Don't replace instructions with more appropriate ones
298 for the CPU. This may be useful on asymmetric MP systems
299 where some CPUs have less capabilities than others.
diff --git a/MAINTAINERS b/MAINTAINERS
index 829407ff41f1..277877a34ef6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1318,7 +1318,7 @@ S: Maintained
1318ETHERNET BRIDGE 1318ETHERNET BRIDGE
1319P: Stephen Hemminger 1319P: Stephen Hemminger
1320M: shemminger@linux-foundation.org 1320M: shemminger@linux-foundation.org
1321L: bridge@lists.osdl.org 1321L: bridge@lists.linux-foundation.org
1322W: http://bridge.sourceforge.net/ 1322W: http://bridge.sourceforge.net/
1323S: Maintained 1323S: Maintained
1324 1324
@@ -1355,6 +1355,11 @@ M: kevin.curtis@farsite.co.uk
1355W: http://www.farsite.co.uk/ 1355W: http://www.farsite.co.uk/
1356S: Supported 1356S: Supported
1357 1357
1358FAULT INJECTION SUPPORT
1359P: Akinobu Mita
1360M: akinobu.mita@gmail.com
1361S: Supported
1362
1358FRAMEBUFFER LAYER 1363FRAMEBUFFER LAYER
1359P: Antonino Daplas 1364P: Antonino Daplas
1360M: adaplas@gmail.com 1365M: adaplas@gmail.com
@@ -1404,7 +1409,7 @@ M: hch@infradead.org
1404W: ftp://ftp.openlinux.org/pub/people/hch/vxfs 1409W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
1405S: Maintained 1410S: Maintained
1406 1411
1407FUJITSU FR-V PORT 1412FUJITSU FR-V (FRV) PORT
1408P: David Howells 1413P: David Howells
1409M: dhowells@redhat.com 1414M: dhowells@redhat.com
1410S: Maintained 1415S: Maintained
@@ -1690,7 +1695,7 @@ S: Maintained
1690 1695
1691IEEE 1394 SUBSYSTEM 1696IEEE 1394 SUBSYSTEM
1692P: Ben Collins 1697P: Ben Collins
1693M: bcollins@debian.org 1698M: ben.collins@ubuntu.com
1694P: Stefan Richter 1699P: Stefan Richter
1695M: stefanr@s5r6.in-berlin.de 1700M: stefanr@s5r6.in-berlin.de
1696L: linux1394-devel@lists.sourceforge.net 1701L: linux1394-devel@lists.sourceforge.net
@@ -1698,25 +1703,11 @@ W: http://www.linux1394.org/
1698T: git kernel.org:/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git 1703T: git kernel.org:/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
1699S: Maintained 1704S: Maintained
1700 1705
1701IEEE 1394 IPV4 DRIVER (eth1394) 1706IEEE 1394 RAW I/O DRIVER (raw1394)
1702P: Stefan Richter
1703M: stefanr@s5r6.in-berlin.de
1704L: linux1394-devel@lists.sourceforge.net
1705S: Odd Fixes
1706
1707IEEE 1394 PCILYNX DRIVER
1708P: Jody McIntyre
1709M: scjody@modernduck.com
1710P: Stefan Richter
1711M: stefanr@s5r6.in-berlin.de
1712L: linux1394-devel@lists.sourceforge.net
1713S: Odd Fixes
1714
1715IEEE 1394 RAW I/O DRIVER
1716P: Ben Collins
1717M: bcollins@debian.org
1718P: Dan Dennedy 1707P: Dan Dennedy
1719M: dan@dennedy.org 1708M: dan@dennedy.org
1709P: Stefan Richter
1710M: stefanr@s5r6.in-berlin.de
1720L: linux1394-devel@lists.sourceforge.net 1711L: linux1394-devel@lists.sourceforge.net
1721S: Maintained 1712S: Maintained
1722 1713
@@ -1951,7 +1942,7 @@ P: Vivek Goyal
1951M: vgoyal@in.ibm.com 1942M: vgoyal@in.ibm.com
1952P: Haren Myneni 1943P: Haren Myneni
1953M: hbabu@us.ibm.com 1944M: hbabu@us.ibm.com
1954L: fastboot@lists.osdl.org 1945L: fastboot@lists.linux-foundation.org
1955L: linux-kernel@vger.kernel.org 1946L: linux-kernel@vger.kernel.org
1956W: http://lse.sourceforge.net/kdump/ 1947W: http://lse.sourceforge.net/kdump/
1957S: Maintained 1948S: Maintained
@@ -1978,7 +1969,7 @@ S: Maintained
1978 1969
1979KERNEL JANITORS 1970KERNEL JANITORS
1980P: Several 1971P: Several
1981L: kernel-janitors@lists.osdl.org 1972L: kernel-janitors@lists.linux-foundation.org
1982W: http://www.kerneljanitors.org/ 1973W: http://www.kerneljanitors.org/
1983S: Maintained 1974S: Maintained
1984 1975
@@ -2001,7 +1992,7 @@ P: Eric Biederman
2001M: ebiederm@xmission.com 1992M: ebiederm@xmission.com
2002W: http://www.xmission.com/~ebiederm/files/kexec/ 1993W: http://www.xmission.com/~ebiederm/files/kexec/
2003L: linux-kernel@vger.kernel.org 1994L: linux-kernel@vger.kernel.org
2004L: fastboot@lists.osdl.org 1995L: fastboot@lists.linux-foundation.org
2005S: Maintained 1996S: Maintained
2006 1997
2007KPROBES 1998KPROBES
@@ -2339,7 +2330,7 @@ S: Maintained
2339NETEM NETWORK EMULATOR 2330NETEM NETWORK EMULATOR
2340P: Stephen Hemminger 2331P: Stephen Hemminger
2341M: shemminger@linux-foundation.org 2332M: shemminger@linux-foundation.org
2342L: netem@lists.osdl.org 2333L: netem@lists.linux-foundation.org
2343S: Maintained 2334S: Maintained
2344 2335
2345NETFILTER/IPTABLES/IPCHAINS 2336NETFILTER/IPTABLES/IPCHAINS
@@ -3068,7 +3059,7 @@ S: Supported
3068SOFTWARE SUSPEND: 3059SOFTWARE SUSPEND:
3069P: Pavel Machek 3060P: Pavel Machek
3070M: pavel@suse.cz 3061M: pavel@suse.cz
3071L: linux-pm@lists.osdl.org 3062L: linux-pm@lists.linux-foundation.org
3072S: Maintained 3063S: Maintained
3073 3064
3074SONIC NETWORK DRIVER 3065SONIC NETWORK DRIVER
diff --git a/Makefile b/Makefile
index 6486af1ae69c..d970cb16545a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 21 3SUBLEVEL = 21
4EXTRAVERSION = -rc6 4EXTRAVERSION =
5NAME = Nocturnal Monster Puppy 5NAME = Nocturnal Monster Puppy
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/kernel/core_mcpcia.c b/arch/alpha/kernel/core_mcpcia.c
index 8d019071190a..381fec0af52e 100644
--- a/arch/alpha/kernel/core_mcpcia.c
+++ b/arch/alpha/kernel/core_mcpcia.c
@@ -40,8 +40,6 @@
40# define DBG_CFG(args) 40# define DBG_CFG(args)
41#endif 41#endif
42 42
43#define MCPCIA_MAX_HOSES 4
44
45/* 43/*
46 * Given a bus, device, and function number, compute resulting 44 * Given a bus, device, and function number, compute resulting
47 * configuration space address and setup the MCPCIA_HAXR2 register 45 * configuration space address and setup the MCPCIA_HAXR2 register
diff --git a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c
index febe71c6869f..543d96d7fa2b 100644
--- a/arch/alpha/kernel/err_titan.c
+++ b/arch/alpha/kernel/err_titan.c
@@ -16,6 +16,7 @@
16#include <asm/smp.h> 16#include <asm/smp.h>
17#include <asm/err_common.h> 17#include <asm/err_common.h>
18#include <asm/err_ev6.h> 18#include <asm/err_ev6.h>
19#include <asm/irq_regs.h>
19 20
20#include "err_impl.h" 21#include "err_impl.h"
21#include "proto.h" 22#include "proto.h"
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
index aac6d4b22f7a..bd03dc94c72b 100644
--- a/arch/alpha/kernel/module.c
+++ b/arch/alpha/kernel/module.c
@@ -285,12 +285,12 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
285 reloc_overflow: 285 reloc_overflow:
286 if (ELF64_ST_TYPE (sym->st_info) == STT_SECTION) 286 if (ELF64_ST_TYPE (sym->st_info) == STT_SECTION)
287 printk(KERN_ERR 287 printk(KERN_ERR
288 "module %s: Relocation overflow vs section %d\n", 288 "module %s: Relocation (type %lu) overflow vs section %d\n",
289 me->name, sym->st_shndx); 289 me->name, r_type, sym->st_shndx);
290 else 290 else
291 printk(KERN_ERR 291 printk(KERN_ERR
292 "module %s: Relocation overflow vs %s\n", 292 "module %s: Relocation (type %lu) overflow vs %s\n",
293 me->name, strtab + sym->st_name); 293 me->name, r_type, strtab + sym->st_name);
294 return -ENOEXEC; 294 return -ENOEXEC;
295 } 295 }
296 } 296 }
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index e7594a7cf585..920196bcbb61 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -70,6 +70,12 @@ nautilus_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
70 /* Preserve the IRQ set up by the console. */ 70 /* Preserve the IRQ set up by the console. */
71 71
72 u8 irq; 72 u8 irq;
73 /* UP1500: AGP INTA is actually routed to IRQ 5, not IRQ 10 as
74 console reports. Check the device id of AGP bridge to distinguish
75 UP1500 from UP1000/1100. Note: 'pin' is 2 due to bridge swizzle. */
76 if (slot == 1 && pin == 2 &&
77 dev->bus->self && dev->bus->self->device == 0x700f)
78 return 5;
73 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq); 79 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
74 return irq; 80 return irq;
75} 81}
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c
index de6ba3432e8a..eb2a1d63f484 100644
--- a/arch/alpha/kernel/sys_noritake.c
+++ b/arch/alpha/kernel/sys_noritake.c
@@ -66,6 +66,13 @@ noritake_startup_irq(unsigned int irq)
66 return 0; 66 return 0;
67} 67}
68 68
69static void
70noritake_end_irq(unsigned int irq)
71{
72 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
73 noritake_enable_irq(irq);
74}
75
69static struct hw_interrupt_type noritake_irq_type = { 76static struct hw_interrupt_type noritake_irq_type = {
70 .typename = "NORITAKE", 77 .typename = "NORITAKE",
71 .startup = noritake_startup_irq, 78 .startup = noritake_startup_irq,
@@ -73,7 +80,7 @@ static struct hw_interrupt_type noritake_irq_type = {
73 .enable = noritake_enable_irq, 80 .enable = noritake_enable_irq,
74 .disable = noritake_disable_irq, 81 .disable = noritake_disable_irq,
75 .ack = noritake_disable_irq, 82 .ack = noritake_disable_irq,
76 .end = noritake_enable_irq, 83 .end = noritake_end_irq,
77}; 84};
78 85
79static void 86static void
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c
index 581d08c70b92..672cb2df53df 100644
--- a/arch/alpha/kernel/sys_rawhide.c
+++ b/arch/alpha/kernel/sys_rawhide.c
@@ -52,6 +52,9 @@ rawhide_update_irq_hw(int hose, int mask)
52 *(vuip)MCPCIA_INT_MASK0(MCPCIA_HOSE2MID(hose)); 52 *(vuip)MCPCIA_INT_MASK0(MCPCIA_HOSE2MID(hose));
53} 53}
54 54
55#define hose_exists(h) \
56 (((h) < MCPCIA_MAX_HOSES) && (cached_irq_masks[(h)] != 0))
57
55static inline void 58static inline void
56rawhide_enable_irq(unsigned int irq) 59rawhide_enable_irq(unsigned int irq)
57{ 60{
@@ -59,6 +62,9 @@ rawhide_enable_irq(unsigned int irq)
59 62
60 irq -= 16; 63 irq -= 16;
61 hose = irq / 24; 64 hose = irq / 24;
65 if (!hose_exists(hose)) /* if hose non-existent, exit */
66 return;
67
62 irq -= hose * 24; 68 irq -= hose * 24;
63 mask = 1 << irq; 69 mask = 1 << irq;
64 70
@@ -76,6 +82,9 @@ rawhide_disable_irq(unsigned int irq)
76 82
77 irq -= 16; 83 irq -= 16;
78 hose = irq / 24; 84 hose = irq / 24;
85 if (!hose_exists(hose)) /* if hose non-existent, exit */
86 return;
87
79 irq -= hose * 24; 88 irq -= hose * 24;
80 mask = ~(1 << irq) | hose_irq_masks[hose]; 89 mask = ~(1 << irq) | hose_irq_masks[hose];
81 90
@@ -93,6 +102,9 @@ rawhide_mask_and_ack_irq(unsigned int irq)
93 102
94 irq -= 16; 103 irq -= 16;
95 hose = irq / 24; 104 hose = irq / 24;
105 if (!hose_exists(hose)) /* if hose non-existent, exit */
106 return;
107
96 irq -= hose * 24; 108 irq -= hose * 24;
97 mask1 = 1 << irq; 109 mask1 = 1 << irq;
98 mask = ~mask1 | hose_irq_masks[hose]; 110 mask = ~mask1 | hose_irq_masks[hose];
@@ -169,6 +181,9 @@ rawhide_init_irq(void)
169 181
170 mcpcia_init_hoses(); 182 mcpcia_init_hoses();
171 183
184 /* Clear them all; only hoses that exist will be non-zero. */
185 for (i = 0; i < MCPCIA_MAX_HOSES; i++) cached_irq_masks[i] = 0;
186
172 for (hose = hose_head; hose; hose = hose->next) { 187 for (hose = hose_head; hose; hose = hose->next) {
173 unsigned int h = hose->index; 188 unsigned int h = hose->index;
174 unsigned int mask = hose_irq_masks[h]; 189 unsigned int mask = hose_irq_masks[h];
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c
index a654014d202a..14b5a753aba5 100644
--- a/arch/alpha/kernel/sys_sio.c
+++ b/arch/alpha/kernel/sys_sio.c
@@ -84,12 +84,16 @@ alphabook1_init_arch(void)
84static void __init 84static void __init
85sio_pci_route(void) 85sio_pci_route(void)
86{ 86{
87#if defined(ALPHA_RESTORE_SRM_SETUP) 87 unsigned int orig_route_tab;
88 /* First, read and save the original setting. */ 88
89 /* First, ALWAYS read and print the original setting. */
89 pci_bus_read_config_dword(pci_isa_hose->bus, PCI_DEVFN(7, 0), 0x60, 90 pci_bus_read_config_dword(pci_isa_hose->bus, PCI_DEVFN(7, 0), 0x60,
90 &saved_config.orig_route_tab); 91 &orig_route_tab);
91 printk("%s: PIRQ original 0x%x new 0x%x\n", __FUNCTION__, 92 printk("%s: PIRQ original 0x%x new 0x%x\n", __FUNCTION__,
92 saved_config.orig_route_tab, alpha_mv.sys.sio.route_tab); 93 orig_route_tab, alpha_mv.sys.sio.route_tab);
94
95#if defined(ALPHA_RESTORE_SRM_SETUP)
96 saved_config.orig_route_tab = orig_route_tab;
93#endif 97#endif
94 98
95 /* Now override with desired setting. */ 99 /* Now override with desired setting. */
@@ -334,7 +338,7 @@ struct alpha_machine_vector avanti_mv __initmv = {
334 .pci_swizzle = common_swizzle, 338 .pci_swizzle = common_swizzle,
335 339
336 .sys = { .sio = { 340 .sys = { .sio = {
337 .route_tab = 0x0b0a0e0f, 341 .route_tab = 0x0b0a050f, /* leave 14 for IDE, 9 for SND */
338 }} 342 }}
339}; 343};
340ALIAS_MV(avanti) 344ALIAS_MV(avanti)
diff --git a/arch/alpha/kernel/sys_sx164.c b/arch/alpha/kernel/sys_sx164.c
index 94ad68b7c0ae..41d4ad4c7c44 100644
--- a/arch/alpha/kernel/sys_sx164.c
+++ b/arch/alpha/kernel/sys_sx164.c
@@ -132,7 +132,7 @@ sx164_init_arch(void)
132 132
133 if (amask(AMASK_MAX) != 0 133 if (amask(AMASK_MAX) != 0
134 && alpha_using_srm 134 && alpha_using_srm
135 && (cpu->pal_revision & 0xffff) == 0x117) { 135 && (cpu->pal_revision & 0xffff) <= 0x117) {
136 __asm__ __volatile__( 136 __asm__ __volatile__(
137 "lda $16,8($31)\n" 137 "lda $16,8($31)\n"
138 "call_pal 9\n" /* Allow PALRES insns in kernel mode */ 138 "call_pal 9\n" /* Allow PALRES insns in kernel mode */
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 29ab7db81c30..f009b7bc0943 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -257,8 +257,7 @@ titan_dispatch_irqs(u64 mask)
257 */ 257 */
258 while (mask) { 258 while (mask) {
259 /* convert to SRM vector... priority is <63> -> <0> */ 259 /* convert to SRM vector... priority is <63> -> <0> */
260 __asm__("ctlz %1, %0" : "=r"(vector) : "r"(mask)); 260 vector = 63 - __kernel_ctlz(mask);
261 vector = 63 - vector;
262 mask &= ~(1UL << vector); /* clear it out */ 261 mask &= ~(1UL << vector); /* clear it out */
263 vector = 0x900 + (vector << 4); /* convert to SRM vector */ 262 vector = 0x900 + (vector << 4); /* convert to SRM vector */
264 263
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index d4ca0f06be5f..a850da377a29 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -1,10 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc1 3# Linux kernel version: 2.6.21-rc6
4# Wed Feb 21 16:48:01 2007 4# Mon Apr 9 10:12:58 2007
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
8# CONFIG_GENERIC_TIME is not set 9# CONFIG_GENERIC_TIME is not set
9CONFIG_MMU=y 10CONFIG_MMU=y
10CONFIG_NO_IOPORT=y 11CONFIG_NO_IOPORT=y
@@ -45,6 +46,7 @@ CONFIG_SYSVIPC_SYSCTL=y
45# CONFIG_IKCONFIG is not set 46# CONFIG_IKCONFIG is not set
46CONFIG_SYSFS_DEPRECATED=y 47CONFIG_SYSFS_DEPRECATED=y
47# CONFIG_RELAY is not set 48# CONFIG_RELAY is not set
49CONFIG_BLK_DEV_INITRD=y
48CONFIG_INITRAMFS_SOURCE="" 50CONFIG_INITRAMFS_SOURCE=""
49CONFIG_CC_OPTIMIZE_FOR_SIZE=y 51CONFIG_CC_OPTIMIZE_FOR_SIZE=y
50CONFIG_SYSCTL=y 52CONFIG_SYSCTL=y
@@ -531,7 +533,6 @@ CONFIG_BLK_DEV_RAM=y
531CONFIG_BLK_DEV_RAM_COUNT=16 533CONFIG_BLK_DEV_RAM_COUNT=16
532CONFIG_BLK_DEV_RAM_SIZE=4096 534CONFIG_BLK_DEV_RAM_SIZE=4096
533CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 535CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
534CONFIG_BLK_DEV_INITRD=y
535# CONFIG_CDROM_PKTCDVD is not set 536# CONFIG_CDROM_PKTCDVD is not set
536CONFIG_ATA_OVER_ETH=m 537CONFIG_ATA_OVER_ETH=m
537 538
@@ -560,7 +561,6 @@ CONFIG_IDE_GENERIC=y
560CONFIG_BLK_DEV_IDE_BAST=y 561CONFIG_BLK_DEV_IDE_BAST=y
561# CONFIG_IDE_CHIPSETS is not set 562# CONFIG_IDE_CHIPSETS is not set
562# CONFIG_BLK_DEV_IDEDMA is not set 563# CONFIG_BLK_DEV_IDEDMA is not set
563# CONFIG_IDEDMA_AUTO is not set
564# CONFIG_BLK_DEV_HD is not set 564# CONFIG_BLK_DEV_HD is not set
565 565
566# 566#
@@ -941,6 +941,7 @@ CONFIG_LEDS_CLASS=m
941# LED drivers 941# LED drivers
942# 942#
943CONFIG_LEDS_S3C24XX=m 943CONFIG_LEDS_S3C24XX=m
944CONFIG_LEDS_H1940=m
944 945
945# 946#
946# LED Triggers 947# LED Triggers
@@ -1125,6 +1126,7 @@ CONFIG_USB_MON=y
1125# CONFIG_USB_APPLEDISPLAY is not set 1126# CONFIG_USB_APPLEDISPLAY is not set
1126# CONFIG_USB_LD is not set 1127# CONFIG_USB_LD is not set
1127# CONFIG_USB_TRANCEVIBRATOR is not set 1128# CONFIG_USB_TRANCEVIBRATOR is not set
1129# CONFIG_USB_IOWARRIOR is not set
1128# CONFIG_USB_TEST is not set 1130# CONFIG_USB_TEST is not set
1129 1131
1130# 1132#
@@ -1169,7 +1171,6 @@ CONFIG_RTC_INTF_DEV=y
1169# CONFIG_RTC_DRV_DS1672 is not set 1171# CONFIG_RTC_DRV_DS1672 is not set
1170# CONFIG_RTC_DRV_DS1742 is not set 1172# CONFIG_RTC_DRV_DS1742 is not set
1171# CONFIG_RTC_DRV_PCF8563 is not set 1173# CONFIG_RTC_DRV_PCF8563 is not set
1172# CONFIG_RTC_DRV_PCF8583 is not set
1173# CONFIG_RTC_DRV_RS5C348 is not set 1174# CONFIG_RTC_DRV_RS5C348 is not set
1174# CONFIG_RTC_DRV_RS5C372 is not set 1175# CONFIG_RTC_DRV_RS5C372 is not set
1175CONFIG_RTC_DRV_S3C=y 1176CONFIG_RTC_DRV_S3C=y
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index bd78058b7178..b1142ce4ac47 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Tue Jan 16 16:52:56 2007 15# Last update: Mon Apr 16 21:01:04 2007
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -1190,13 +1190,12 @@ g500 MACH_G500 G500 1178
1190bug MACH_BUG BUG 1179 1190bug MACH_BUG BUG 1179
1191mx33ads MACH_MX33ADS MX33ADS 1180 1191mx33ads MACH_MX33ADS MX33ADS 1180
1192chub MACH_CHUB CHUB 1181 1192chub MACH_CHUB CHUB 1181
1193gta01 MACH_GTA01 GTA01 1182 1193neo1973_gta01 MACH_NEO1973_GTA01 NEO1973_GTA01 1182
1194w90n740 MACH_W90N740 W90N740 1183 1194w90n740 MACH_W90N740 W90N740 1183
1195medallion_sa2410 MACH_MEDALLION_SA2410 MEDALLION_SA2410 1184 1195medallion_sa2410 MACH_MEDALLION_SA2410 MEDALLION_SA2410 1184
1196ia_cpu_9200_2 MACH_IA_CPU_9200_2 IA_CPU_9200_2 1185 1196ia_cpu_9200_2 MACH_IA_CPU_9200_2 IA_CPU_9200_2 1185
1197dimmrm9200 MACH_DIMMRM9200 DIMMRM9200 1186 1197dimmrm9200 MACH_DIMMRM9200 DIMMRM9200 1186
1198pm9261 MACH_PM9261 PM9261 1187 1198pm9261 MACH_PM9261 PM9261 1187
1199mx21 MACH_MX21 MX21 1188
1200ml7304 MACH_ML7304 ML7304 1189 1199ml7304 MACH_ML7304 ML7304 1189
1201ucp250 MACH_UCP250 UCP250 1190 1200ucp250 MACH_UCP250 UCP250 1190
1202intboard MACH_INTBOARD INTBOARD 1191 1201intboard MACH_INTBOARD INTBOARD 1191
@@ -1242,3 +1241,97 @@ xscale_treo680 MACH_XSCALE_TREO680 XSCALE_TREO680 1230
1242tecon_tmezon MACH_TECON_TMEZON TECON_TMEZON 1231 1241tecon_tmezon MACH_TECON_TMEZON TECON_TMEZON 1231
1243zylonite MACH_ZYLONITE ZYLONITE 1233 1242zylonite MACH_ZYLONITE ZYLONITE 1233
1244gene1270 MACH_GENE1270 GENE1270 1234 1243gene1270 MACH_GENE1270 GENE1270 1234
1244zir2412 MACH_ZIR2412 ZIR2412 1235
1245mx31lite MACH_MX31LITE MX31LITE 1236
1246t700wx MACH_T700WX T700WX 1237
1247vf100 MACH_VF100 VF100 1238
1248nsb2 MACH_NSB2 NSB2 1239
1249nxhmi_bb MACH_NXHMI_BB NXHMI_BB 1240
1250nxhmi_re MACH_NXHMI_RE NXHMI_RE 1241
1251n4100pro MACH_N4100PRO N4100PRO 1242
1252sam9260 MACH_SAM9260 SAM9260 1243
1253omap_treo600 MACH_OMAP_TREO600 OMAP_TREO600 1244
1254indy2410 MACH_INDY2410 INDY2410 1245
1255nelt_a MACH_NELT_A NELT_A 1246
1256n311 MACH_N311 N311 1248
1257at91sam9260vgk MACH_AT91SAM9260VGK AT91SAM9260VGK 1249
1258at91leppe MACH_AT91LEPPE AT91LEPPE 1250
1259at91lepccn MACH_AT91LEPCCN AT91LEPCCN 1251
1260apc7100 MACH_APC7100 APC7100 1252
1261stargazer MACH_STARGAZER STARGAZER 1253
1262sonata MACH_SONATA SONATA 1254
1263schmoogie MACH_SCHMOOGIE SCHMOOGIE 1255
1264aztool MACH_AZTOOL AZTOOL 1256
1265mioa701 MACH_MIOA701 MIOA701 1257
1266sxni9260 MACH_SXNI9260 SXNI9260 1258
1267mxc27520evb MACH_MXC27520EVB MXC27520EVB 1259
1268armadillo5x0 MACH_ARMADILLO5X0 ARMADILLO5X0 1260
1269mb9260 MACH_MB9260 MB9260 1261
1270mb9263 MACH_MB9263 MB9263 1262
1271ipac9302 MACH_IPAC9302 IPAC9302 1263
1272cc9p9360js MACH_CC9P9360JS CC9P9360JS 1264
1273gallium MACH_GALLIUM GALLIUM 1265
1274msc2410 MACH_MSC2410 MSC2410 1266
1275ghi270 MACH_GHI270 GHI270 1267
1276davinci_leonardo MACH_DAVINCI_LEONARDO DAVINCI_LEONARDO 1268
1277oiab MACH_OIAB OIAB 1269
1278smdk6400 MACH_SMDK6400 SMDK6400 1270
1279nokia_n800 MACH_NOKIA_N800 NOKIA_N800 1271
1280greenphone MACH_GREENPHONE GREENPHONE 1272
1281compex42x MACH_COMPEXWP18 COMPEXWP18 1273
1282xmate MACH_XMATE XMATE 1274
1283energizer MACH_ENERGIZER ENERGIZER 1275
1284ime1 MACH_IME1 IME1 1276
1285sweda_tms MACH_SWEDATMS SWEDATMS 1277
1286ntnp435c MACH_NTNP435C NTNP435C 1278
1287spectro2 MACH_SPECTRO2 SPECTRO2 1279
1288h6039 MACH_H6039 H6039 1280
1289ep80219 MACH_EP80219 EP80219 1281
1290samoa_ii MACH_SAMOA_II SAMOA_II 1282
1291cwmxl MACH_CWMXL CWMXL 1283
1292as9200 MACH_AS9200 AS9200 1284
1293sfx1149 MACH_SFX1149 SFX1149 1285
1294navi010 MACH_NAVI010 NAVI010 1286
1295multmdp MACH_MULTMDP MULTMDP 1287
1296scb9520 MACH_SCB9520 SCB9520 1288
1297htcathena MACH_HTCATHENA HTCATHENA 1289
1298xp179 MACH_XP179 XP179 1290
1299h4300 MACH_H4300 H4300 1291
1300goramo_mlr MACH_GORAMO_MLR GORAMO_MLR 1292
1301mxc30020evb MACH_MXC30020EVB MXC30020EVB 1293
1302adsbitsymx MACH_ADSBITSIMX ADSBITSIMX 1294
1303adsportalplus MACH_ADSPORTALPLUS ADSPORTALPLUS 1295
1304mmsp2plus MACH_MMSP2PLUS MMSP2PLUS 1296
1305em_x270 MACH_EM_X270 EM_X270 1297
1306tpp302 MACH_TPP302 TPP302 1298
1307tpp104 MACH_TPM104 TPM104 1299
1308tpm102 MACH_TPM102 TPM102 1300
1309tpm109 MACH_TPM109 TPM109 1301
1310fbxo1 MACH_FBXO1 FBXO1 1302
1311hxd8 MACH_HXD8 HXD8 1303
1312neo1973_gta02 MACH_NEO1973_GTA02 NEO1973_GTA02 1304
1313emtest MACH_EMTEST EMTEST 1305
1314ad6900 MACH_AD6900 AD6900 1306
1315europa MACH_EUROPA EUROPA 1307
1316metroconnect MACH_METROCONNECT METROCONNECT 1308
1317ez_s2410 MACH_EZ_S2410 EZ_S2410 1309
1318ez_s2440 MACH_EZ_S2440 EZ_S2440 1310
1319ez_ep9312 MACH_EZ_EP9312 EZ_EP9312 1311
1320ez_ep9315 MACH_EZ_EP9315 EZ_EP9315 1312
1321ez_x7 MACH_EZ_X7 EZ_X7 1313
1322godotdb MACH_GODOTDB GODOTDB 1314
1323mistral MACH_MISTRAL MISTRAL 1315
1324msm MACH_MSM MSM 1316
1325ct5910 MACH_CT5910 CT5910 1317
1326ct5912 MACH_CT5912 CT5912 1318
1327hynet_ine MACH_HYNET_INE HYNET_INE 1319
1328hynet_app MACH_HYNET_APP HYNET_APP 1320
1329msm7200 MACH_MSM7200 MSM7200 1321
1330msm7600 MACH_MSM7600 MSM7600 1322
1331ceb255 MACH_CEB255 CEB255 1323
1332ciel MACH_CIEL CIEL 1324
1333slm5650 MACH_SLM5650 SLM5650 1325
1334at91sam9rlek MACH_AT91SAM9RLEK AT91SAM9RLEK 1326
1335comtech_router MACH_COMTECH_ROUTER COMTECH_ROUTER 1327
1336sbc2410x MACH_SBC2410X SBC2410X 1328
1337at4x0bd MACH_AT4X0BD AT4X0BD 1329
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index 9eca21b49f6b..426f59b0106b 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -5,15 +5,9 @@
5#include <asm/alternative.h> 5#include <asm/alternative.h>
6#include <asm/sections.h> 6#include <asm/sections.h>
7 7
8static int no_replacement = 0;
9static int smp_alt_once = 0; 8static int smp_alt_once = 0;
10static int debug_alternative = 0; 9static int debug_alternative = 0;
11 10
12static int __init noreplacement_setup(char *s)
13{
14 no_replacement = 1;
15 return 1;
16}
17static int __init bootonly(char *str) 11static int __init bootonly(char *str)
18{ 12{
19 smp_alt_once = 1; 13 smp_alt_once = 1;
@@ -25,7 +19,6 @@ static int __init debug_alt(char *str)
25 return 1; 19 return 1;
26} 20}
27 21
28__setup("noreplacement", noreplacement_setup);
29__setup("smp-alt-boot", bootonly); 22__setup("smp-alt-boot", bootonly);
30__setup("debug-alternative", debug_alt); 23__setup("debug-alternative", debug_alt);
31 24
@@ -252,9 +245,6 @@ void alternatives_smp_module_add(struct module *mod, char *name,
252 struct smp_alt_module *smp; 245 struct smp_alt_module *smp;
253 unsigned long flags; 246 unsigned long flags;
254 247
255 if (no_replacement)
256 return;
257
258 if (smp_alt_once) { 248 if (smp_alt_once) {
259 if (boot_cpu_has(X86_FEATURE_UP)) 249 if (boot_cpu_has(X86_FEATURE_UP))
260 alternatives_smp_unlock(locks, locks_end, 250 alternatives_smp_unlock(locks, locks_end,
@@ -289,7 +279,7 @@ void alternatives_smp_module_del(struct module *mod)
289 struct smp_alt_module *item; 279 struct smp_alt_module *item;
290 unsigned long flags; 280 unsigned long flags;
291 281
292 if (no_replacement || smp_alt_once) 282 if (smp_alt_once)
293 return; 283 return;
294 284
295 spin_lock_irqsave(&smp_alt, flags); 285 spin_lock_irqsave(&smp_alt, flags);
@@ -320,7 +310,7 @@ void alternatives_smp_switch(int smp)
320 return; 310 return;
321#endif 311#endif
322 312
323 if (no_replacement || smp_alt_once) 313 if (smp_alt_once)
324 return; 314 return;
325 BUG_ON(!smp && (num_online_cpus() > 1)); 315 BUG_ON(!smp && (num_online_cpus() > 1));
326 316
@@ -386,13 +376,6 @@ extern struct paravirt_patch __start_parainstructions[],
386void __init alternative_instructions(void) 376void __init alternative_instructions(void)
387{ 377{
388 unsigned long flags; 378 unsigned long flags;
389 if (no_replacement) {
390 printk(KERN_INFO "(SMP-)alternatives turned off\n");
391 free_init_pages("SMP alternatives",
392 (unsigned long)__smp_alt_begin,
393 (unsigned long)__smp_alt_end);
394 return;
395 }
396 379
397 local_irq_save(flags); 380 local_irq_save(flags);
398 apply_alternatives(__alt_instructions, __alt_instructions_end); 381 apply_alternatives(__alt_instructions, __alt_instructions_end);
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index a1f1b715bcf8..2b030d6ccbf7 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -758,7 +758,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
758 NULL, (void *)&pr); 758 NULL, (void *)&pr);
759 759
760 /* Check ACPI support for C3 state */ 760 /* Check ACPI support for C3 state */
761 if (pr != NULL && longhaul_version != TYPE_LONGHAUL_V1) { 761 if (pr != NULL && longhaul_version == TYPE_POWERSAVER) {
762 cx = &pr->power.states[ACPI_STATE_C3]; 762 cx = &pr->power.states[ACPI_STATE_C3];
763 if (cx->address > 0 && cx->latency <= 1000) { 763 if (cx->address > 0 && cx->latency <= 1000) {
764 longhaul_flags |= USE_ACPI_C3; 764 longhaul_flags |= USE_ACPI_C3;
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index a98ba88a8c0c..84c3497efb60 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -41,16 +41,17 @@ int nmi_watchdog_enabled;
41 * different subsystems this reservation system just tries to coordinate 41 * different subsystems this reservation system just tries to coordinate
42 * things a little 42 * things a little
43 */ 43 */
44static DEFINE_PER_CPU(unsigned long, perfctr_nmi_owner);
45static DEFINE_PER_CPU(unsigned long, evntsel_nmi_owner[3]);
46
47static cpumask_t backtrace_mask = CPU_MASK_NONE;
48 44
49/* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's 45/* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's
50 * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) 46 * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now)
51 */ 47 */
52#define NMI_MAX_COUNTER_BITS 66 48#define NMI_MAX_COUNTER_BITS 66
49#define NMI_MAX_COUNTER_LONGS BITS_TO_LONGS(NMI_MAX_COUNTER_BITS)
53 50
51static DEFINE_PER_CPU(unsigned long, perfctr_nmi_owner[NMI_MAX_COUNTER_LONGS]);
52static DEFINE_PER_CPU(unsigned long, evntsel_nmi_owner[NMI_MAX_COUNTER_LONGS]);
53
54static cpumask_t backtrace_mask = CPU_MASK_NONE;
54/* nmi_active: 55/* nmi_active:
55 * >0: the lapic NMI watchdog is active, but can be disabled 56 * >0: the lapic NMI watchdog is active, but can be disabled
56 * <0: the lapic NMI watchdog has not been set up, and cannot 57 * <0: the lapic NMI watchdog has not been set up, and cannot
@@ -125,7 +126,7 @@ int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
125 int cpu; 126 int cpu;
126 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 127 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
127 for_each_possible_cpu (cpu) { 128 for_each_possible_cpu (cpu) {
128 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu))) 129 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)[0]))
129 return 0; 130 return 0;
130 } 131 }
131 return 1; 132 return 1;
@@ -141,7 +142,7 @@ int avail_to_resrv_perfctr_nmi(unsigned int msr)
141 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 142 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
142 143
143 for_each_possible_cpu (cpu) { 144 for_each_possible_cpu (cpu) {
144 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu))) 145 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)[0]))
145 return 0; 146 return 0;
146 } 147 }
147 return 1; 148 return 1;
@@ -156,7 +157,7 @@ static int __reserve_perfctr_nmi(int cpu, unsigned int msr)
156 counter = nmi_perfctr_msr_to_bit(msr); 157 counter = nmi_perfctr_msr_to_bit(msr);
157 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 158 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
158 159
159 if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu))) 160 if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)[0]))
160 return 1; 161 return 1;
161 return 0; 162 return 0;
162} 163}
@@ -170,7 +171,7 @@ static void __release_perfctr_nmi(int cpu, unsigned int msr)
170 counter = nmi_perfctr_msr_to_bit(msr); 171 counter = nmi_perfctr_msr_to_bit(msr);
171 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 172 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
172 173
173 clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)); 174 clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)[0]);
174} 175}
175 176
176int reserve_perfctr_nmi(unsigned int msr) 177int reserve_perfctr_nmi(unsigned int msr)
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
index edc339fa5038..697a70e8c0c9 100644
--- a/arch/i386/kernel/vmi.c
+++ b/arch/i386/kernel/vmi.c
@@ -712,11 +712,14 @@ static void *vmi_get_function(int vmicall)
712do { \ 712do { \
713 reloc = call_vrom_long_func(vmi_rom, get_reloc, \ 713 reloc = call_vrom_long_func(vmi_rom, get_reloc, \
714 VMI_CALL_##vmicall); \ 714 VMI_CALL_##vmicall); \
715 if (rel->type != VMI_RELOCATION_NONE) { \ 715 if (rel->type == VMI_RELOCATION_CALL_REL) \
716 BUG_ON(rel->type != VMI_RELOCATION_CALL_REL); \
717 paravirt_ops.opname = (void *)rel->eip; \ 716 paravirt_ops.opname = (void *)rel->eip; \
718 } else if (rel->type == VMI_RELOCATION_NOP) \ 717 else if (rel->type == VMI_RELOCATION_NOP) \
719 paravirt_ops.opname = (void *)vmi_nop; \ 718 paravirt_ops.opname = (void *)vmi_nop; \
719 else if (rel->type != VMI_RELOCATION_NONE) \
720 printk(KERN_WARNING "VMI: Unknown relocation " \
721 "type %d for " #vmicall"\n",\
722 rel->type); \
720} while (0) 723} while (0)
721 724
722/* 725/*
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index ca51610955df..6f38f818380b 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -26,7 +26,7 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
26OUTPUT_ARCH(i386) 26OUTPUT_ARCH(i386)
27ENTRY(phys_startup_32) 27ENTRY(phys_startup_32)
28jiffies = jiffies_64; 28jiffies = jiffies_64;
29_proxy_pda = 0; 29_proxy_pda = 1;
30 30
31PHDRS { 31PHDRS {
32 text PT_LOAD FLAGS(5); /* R_E */ 32 text PT_LOAD FLAGS(5); /* R_E */
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index ebbeadfee42d..c81080df70df 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -76,7 +76,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
76 76
77 set_irq_msi(irq, desc); 77 set_irq_msi(irq, desc);
78 dest_phys_id = cpu_physical_id(first_cpu(cpu_online_map)); 78 dest_phys_id = cpu_physical_id(first_cpu(cpu_online_map));
79 vector = irq; 79 vector = irq_to_vector(irq);
80 80
81 msg.address_hi = 0; 81 msg.address_hi = 0;
82 msg.address_lo = 82 msg.address_lo =
@@ -110,7 +110,7 @@ static void ia64_ack_msi_irq(unsigned int irq)
110 110
111static int ia64_msi_retrigger_irq(unsigned int irq) 111static int ia64_msi_retrigger_irq(unsigned int irq)
112{ 112{
113 unsigned int vector = irq; 113 unsigned int vector = irq_to_vector(irq);
114 ia64_resend_irq(vector); 114 ia64_resend_irq(vector);
115 115
116 return 1; 116 return 1;
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 69b9bb3fd7c5..dc7dd7648ec5 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -640,7 +640,7 @@ show_cpuinfo (struct seq_file *m, void *v)
640 "features : %s\n" 640 "features : %s\n"
641 "cpu number : %lu\n" 641 "cpu number : %lu\n"
642 "cpu regs : %u\n" 642 "cpu regs : %u\n"
643 "cpu MHz : %lu.%06lu\n" 643 "cpu MHz : %lu.%03lu\n"
644 "itc MHz : %lu.%06lu\n" 644 "itc MHz : %lu.%06lu\n"
645 "BogoMIPS : %lu.%02lu\n", 645 "BogoMIPS : %lu.%02lu\n",
646 cpunum, c->vendor, c->family, c->model, 646 cpunum, c->vendor, c->family, c->model,
diff --git a/arch/ia64/sn/kernel/bte_error.c b/arch/ia64/sn/kernel/bte_error.c
index f1ec1370b3e3..b6fcf8164f2b 100644
--- a/arch/ia64/sn/kernel/bte_error.c
+++ b/arch/ia64/sn/kernel/bte_error.c
@@ -78,7 +78,7 @@ int shub1_bte_error_handler(unsigned long _nodepda)
78 * There are errors which still need to be cleaned up by 78 * There are errors which still need to be cleaned up by
79 * hubiio_crb_error_handler 79 * hubiio_crb_error_handler
80 */ 80 */
81 mod_timer(recovery_timer, HZ * 5); 81 mod_timer(recovery_timer, jiffies + (HZ * 5));
82 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda, 82 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
83 smp_processor_id())); 83 smp_processor_id()));
84 return 1; 84 return 1;
@@ -95,7 +95,7 @@ int shub1_bte_error_handler(unsigned long _nodepda)
95 icrbd.ii_icrb0_d_regval = 95 icrbd.ii_icrb0_d_regval =
96 REMOTE_HUB_L(nasid, IIO_ICRB_D(i)); 96 REMOTE_HUB_L(nasid, IIO_ICRB_D(i));
97 if (icrbd.d_bteop) { 97 if (icrbd.d_bteop) {
98 mod_timer(recovery_timer, HZ * 5); 98 mod_timer(recovery_timer, jiffies + (HZ * 5));
99 BTE_PRINTK(("eh:%p:%d Valid %d, Giving up\n", 99 BTE_PRINTK(("eh:%p:%d Valid %d, Giving up\n",
100 err_nodepda, smp_processor_id(), 100 err_nodepda, smp_processor_id(),
101 i)); 101 i));
@@ -150,7 +150,7 @@ int shub2_bte_error_handler(unsigned long _nodepda)
150 status = BTE_LNSTAT_LOAD(bte); 150 status = BTE_LNSTAT_LOAD(bte);
151 if ((status & IBLS_ERROR) || !(status & IBLS_BUSY)) 151 if ((status & IBLS_ERROR) || !(status & IBLS_BUSY))
152 continue; 152 continue;
153 mod_timer(recovery_timer, HZ * 5); 153 mod_timer(recovery_timer, jiffies + (HZ * 5));
154 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda, 154 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
155 smp_processor_id())); 155 smp_processor_id()));
156 return 1; 156 return 1;
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 1ee977fb6ebb..95af40cb22f2 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -96,10 +96,14 @@ pcibr_dmamap_ate32(struct pcidev_info *info,
96 } 96 }
97 97
98 /* 98 /*
99 * If we're mapping for MSI, set the MSI bit in the ATE 99 * If we're mapping for MSI, set the MSI bit in the ATE. If it's a
100 * TIOCP based pci bus, we also need to set the PIO bit in the ATE.
100 */ 101 */
101 if (dma_flags & SN_DMA_MSI) 102 if (dma_flags & SN_DMA_MSI) {
102 ate |= PCI32_ATE_MSI; 103 ate |= PCI32_ATE_MSI;
104 if (IS_TIOCP_SOFT(pcibus_info))
105 ate |= PCI32_ATE_PIO;
106 }
103 107
104 ate_write(pcibus_info, ate_index, ate_count, ate); 108 ate_write(pcibus_info, ate_index, ate_count, ate);
105 109
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 28c2e2e6af73..656bde2e11b1 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -49,7 +49,8 @@ LEAF(resume)
49#ifndef CONFIG_CPU_HAS_LLSC 49#ifndef CONFIG_CPU_HAS_LLSC
50 sw zero, ll_bit 50 sw zero, ll_bit
51#endif 51#endif
52 mfc0 t2, CP0_STATUS 52 mfc0 t1, CP0_STATUS
53 sw t1, THREAD_STATUS(a0)
53 cpu_save_nonscratch a0 54 cpu_save_nonscratch a0
54 sw ra, THREAD_REG31(a0) 55 sw ra, THREAD_REG31(a0)
55 56
@@ -59,8 +60,8 @@ LEAF(resume)
59 lw t3, TASK_THREAD_INFO(a0) 60 lw t3, TASK_THREAD_INFO(a0)
60 lw t0, TI_FLAGS(t3) 61 lw t0, TI_FLAGS(t3)
61 li t1, _TIF_USEDFPU 62 li t1, _TIF_USEDFPU
62 and t1, t0 63 and t2, t0, t1
63 beqz t1, 1f 64 beqz t2, 1f
64 nor t1, zero, t1 65 nor t1, zero, t1
65 66
66 and t0, t0, t1 67 and t0, t0, t1
@@ -73,13 +74,10 @@ LEAF(resume)
73 li t1, ~ST0_CU1 74 li t1, ~ST0_CU1
74 and t0, t0, t1 75 and t0, t0, t1
75 sw t0, ST_OFF(t3) 76 sw t0, ST_OFF(t3)
76 /* clear thread_struct CU1 bit */
77 and t2, t1
78 77
79 fpu_save_single a0, t0 # clobbers t0 78 fpu_save_single a0, t0 # clobbers t0
80 79
811: 801:
82 sw t2, THREAD_STATUS(a0)
83 /* 81 /*
84 * The order of restoring the registers takes care of the race 82 * The order of restoring the registers takes care of the race
85 * updating $28, $29 and kernelsp without disabling ints. 83 * updating $28, $29 and kernelsp without disabling ints.
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index c7698fd9955c..cc566cf12246 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -48,7 +48,8 @@
48#ifndef CONFIG_CPU_HAS_LLSC 48#ifndef CONFIG_CPU_HAS_LLSC
49 sw zero, ll_bit 49 sw zero, ll_bit
50#endif 50#endif
51 mfc0 t2, CP0_STATUS 51 mfc0 t1, CP0_STATUS
52 LONG_S t1, THREAD_STATUS(a0)
52 cpu_save_nonscratch a0 53 cpu_save_nonscratch a0
53 LONG_S ra, THREAD_REG31(a0) 54 LONG_S ra, THREAD_REG31(a0)
54 55
@@ -58,8 +59,8 @@
58 PTR_L t3, TASK_THREAD_INFO(a0) 59 PTR_L t3, TASK_THREAD_INFO(a0)
59 LONG_L t0, TI_FLAGS(t3) 60 LONG_L t0, TI_FLAGS(t3)
60 li t1, _TIF_USEDFPU 61 li t1, _TIF_USEDFPU
61 and t1, t0 62 and t2, t0, t1
62 beqz t1, 1f 63 beqz t2, 1f
63 nor t1, zero, t1 64 nor t1, zero, t1
64 65
65 and t0, t0, t1 66 and t0, t0, t1
@@ -72,13 +73,10 @@
72 li t1, ~ST0_CU1 73 li t1, ~ST0_CU1
73 and t0, t0, t1 74 and t0, t0, t1
74 LONG_S t0, ST_OFF(t3) 75 LONG_S t0, ST_OFF(t3)
75 /* clear thread_struct CU1 bit */
76 and t2, t1
77 76
78 fpu_save_double a0 t0 t1 # c0_status passed in t0 77 fpu_save_double a0 t0 t1 # c0_status passed in t0
79 # clobbers t1 78 # clobbers t1
801: 791:
81 LONG_S t2, THREAD_STATUS(a0)
82 80
83 /* 81 /*
84 * The order of restoring the registers takes care of the race 82 * The order of restoring the registers takes care of the race
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 297dfcb97524..c0faabd52010 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -34,4 +34,13 @@ extern int install_sigtramp(unsigned int __user *tramp, unsigned int syscall);
34/* Check and clear pending FPU exceptions in saved CSR */ 34/* Check and clear pending FPU exceptions in saved CSR */
35extern int fpcsr_pending(unsigned int __user *fpcsr); 35extern int fpcsr_pending(unsigned int __user *fpcsr);
36 36
37/* Make sure we will not lose FPU ownership */
38#ifdef CONFIG_PREEMPT
39#define lock_fpu_owner() preempt_disable()
40#define unlock_fpu_owner() preempt_enable()
41#else
42#define lock_fpu_owner() pagefault_disable()
43#define unlock_fpu_owner() pagefault_enable()
44#endif
45
37#endif /* __SIGNAL_COMMON_H */ 46#endif /* __SIGNAL_COMMON_H */
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 8c3c5a5789b0..07d67309451a 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -20,6 +20,7 @@
20#include <linux/ptrace.h> 20#include <linux/ptrace.h>
21#include <linux/unistd.h> 21#include <linux/unistd.h>
22#include <linux/compiler.h> 22#include <linux/compiler.h>
23#include <linux/uaccess.h>
23 24
24#include <asm/abi.h> 25#include <asm/abi.h>
25#include <asm/asm.h> 26#include <asm/asm.h>
@@ -27,7 +28,6 @@
27#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
28#include <asm/fpu.h> 29#include <asm/fpu.h>
29#include <asm/sim.h> 30#include <asm/sim.h>
30#include <asm/uaccess.h>
31#include <asm/ucontext.h> 31#include <asm/ucontext.h>
32#include <asm/cpu-features.h> 32#include <asm/cpu-features.h>
33#include <asm/war.h> 33#include <asm/war.h>
@@ -78,6 +78,46 @@ struct rt_sigframe {
78/* 78/*
79 * Helper routines 79 * Helper routines
80 */ 80 */
81static int protected_save_fp_context(struct sigcontext __user *sc)
82{
83 int err;
84 while (1) {
85 lock_fpu_owner();
86 own_fpu_inatomic(1);
87 err = save_fp_context(sc); /* this might fail */
88 unlock_fpu_owner();
89 if (likely(!err))
90 break;
91 /* touch the sigcontext and try again */
92 err = __put_user(0, &sc->sc_fpregs[0]) |
93 __put_user(0, &sc->sc_fpregs[31]) |
94 __put_user(0, &sc->sc_fpc_csr);
95 if (err)
96 break; /* really bad sigcontext */
97 }
98 return err;
99}
100
101static int protected_restore_fp_context(struct sigcontext __user *sc)
102{
103 int err, tmp;
104 while (1) {
105 lock_fpu_owner();
106 own_fpu_inatomic(0);
107 err = restore_fp_context(sc); /* this might fail */
108 unlock_fpu_owner();
109 if (likely(!err))
110 break;
111 /* touch the sigcontext and try again */
112 err = __get_user(tmp, &sc->sc_fpregs[0]) |
113 __get_user(tmp, &sc->sc_fpregs[31]) |
114 __get_user(tmp, &sc->sc_fpc_csr);
115 if (err)
116 break; /* really bad sigcontext */
117 }
118 return err;
119}
120
81int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) 121int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
82{ 122{
83 int err = 0; 123 int err = 0;
@@ -113,10 +153,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
113 * Save FPU state to signal context. Signal handler 153 * Save FPU state to signal context. Signal handler
114 * will "inherit" current FPU state. 154 * will "inherit" current FPU state.
115 */ 155 */
116 own_fpu(1); 156 err |= protected_save_fp_context(sc);
117 enable_fp_in_kernel();
118 err |= save_fp_context(sc);
119 disable_fp_in_kernel();
120 } 157 }
121 return err; 158 return err;
122} 159}
@@ -148,7 +185,7 @@ check_and_restore_fp_context(struct sigcontext __user *sc)
148 err = sig = fpcsr_pending(&sc->sc_fpc_csr); 185 err = sig = fpcsr_pending(&sc->sc_fpc_csr);
149 if (err > 0) 186 if (err > 0)
150 err = 0; 187 err = 0;
151 err |= restore_fp_context(sc); 188 err |= protected_restore_fp_context(sc);
152 return err ?: sig; 189 return err ?: sig;
153} 190}
154 191
@@ -187,11 +224,8 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
187 224
188 if (used_math) { 225 if (used_math) {
189 /* restore fpu context if we have used it before */ 226 /* restore fpu context if we have used it before */
190 own_fpu(0);
191 enable_fp_in_kernel();
192 if (!err) 227 if (!err)
193 err = check_and_restore_fp_context(sc); 228 err = check_and_restore_fp_context(sc);
194 disable_fp_in_kernel();
195 } else { 229 } else {
196 /* signal handler may have used FPU. Give it up. */ 230 /* signal handler may have used FPU. Give it up. */
197 lose_fpu(0); 231 lose_fpu(0);
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 151fd2f0893a..b9a014411f83 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -22,6 +22,7 @@
22#include <linux/compat.h> 22#include <linux/compat.h>
23#include <linux/suspend.h> 23#include <linux/suspend.h>
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/uaccess.h>
25 26
26#include <asm/abi.h> 27#include <asm/abi.h>
27#include <asm/asm.h> 28#include <asm/asm.h>
@@ -29,7 +30,6 @@
29#include <linux/bitops.h> 30#include <linux/bitops.h>
30#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
31#include <asm/sim.h> 32#include <asm/sim.h>
32#include <asm/uaccess.h>
33#include <asm/ucontext.h> 33#include <asm/ucontext.h>
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/fpu.h> 35#include <asm/fpu.h>
@@ -176,6 +176,46 @@ struct rt_sigframe32 {
176/* 176/*
177 * sigcontext handlers 177 * sigcontext handlers
178 */ 178 */
179static int protected_save_fp_context32(struct sigcontext32 __user *sc)
180{
181 int err;
182 while (1) {
183 lock_fpu_owner();
184 own_fpu_inatomic(1);
185 err = save_fp_context32(sc); /* this might fail */
186 unlock_fpu_owner();
187 if (likely(!err))
188 break;
189 /* touch the sigcontext and try again */
190 err = __put_user(0, &sc->sc_fpregs[0]) |
191 __put_user(0, &sc->sc_fpregs[31]) |
192 __put_user(0, &sc->sc_fpc_csr);
193 if (err)
194 break; /* really bad sigcontext */
195 }
196 return err;
197}
198
199static int protected_restore_fp_context32(struct sigcontext32 __user *sc)
200{
201 int err, tmp;
202 while (1) {
203 lock_fpu_owner();
204 own_fpu_inatomic(0);
205 err = restore_fp_context32(sc); /* this might fail */
206 unlock_fpu_owner();
207 if (likely(!err))
208 break;
209 /* touch the sigcontext and try again */
210 err = __get_user(tmp, &sc->sc_fpregs[0]) |
211 __get_user(tmp, &sc->sc_fpregs[31]) |
212 __get_user(tmp, &sc->sc_fpc_csr);
213 if (err)
214 break; /* really bad sigcontext */
215 }
216 return err;
217}
218
179static int setup_sigcontext32(struct pt_regs *regs, 219static int setup_sigcontext32(struct pt_regs *regs,
180 struct sigcontext32 __user *sc) 220 struct sigcontext32 __user *sc)
181{ 221{
@@ -209,10 +249,7 @@ static int setup_sigcontext32(struct pt_regs *regs,
209 * Save FPU state to signal context. Signal handler 249 * Save FPU state to signal context. Signal handler
210 * will "inherit" current FPU state. 250 * will "inherit" current FPU state.
211 */ 251 */
212 own_fpu(1); 252 err |= protected_save_fp_context32(sc);
213 enable_fp_in_kernel();
214 err |= save_fp_context32(sc);
215 disable_fp_in_kernel();
216 } 253 }
217 return err; 254 return err;
218} 255}
@@ -225,7 +262,7 @@ check_and_restore_fp_context32(struct sigcontext32 __user *sc)
225 err = sig = fpcsr_pending(&sc->sc_fpc_csr); 262 err = sig = fpcsr_pending(&sc->sc_fpc_csr);
226 if (err > 0) 263 if (err > 0)
227 err = 0; 264 err = 0;
228 err |= restore_fp_context32(sc); 265 err |= protected_restore_fp_context32(sc);
229 return err ?: sig; 266 return err ?: sig;
230} 267}
231 268
@@ -261,11 +298,8 @@ static int restore_sigcontext32(struct pt_regs *regs,
261 298
262 if (used_math) { 299 if (used_math) {
263 /* restore fpu context if we have used it before */ 300 /* restore fpu context if we have used it before */
264 own_fpu(0);
265 enable_fp_in_kernel();
266 if (!err) 301 if (!err)
267 err = check_and_restore_fp_context32(sc); 302 err = check_and_restore_fp_context32(sc);
268 disable_fp_in_kernel();
269 } else { 303 } else {
270 /* signal handler may have used FPU. Give it up. */ 304 /* signal handler may have used FPU. Give it up. */
271 lose_fpu(0); 305 lose_fpu(0);
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 7d76a85422b2..493cb29b8a42 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -650,7 +650,7 @@ asmlinkage void do_bp(struct pt_regs *regs)
650 unsigned int opcode, bcode; 650 unsigned int opcode, bcode;
651 siginfo_t info; 651 siginfo_t info;
652 652
653 if (get_user(opcode, (unsigned int __user *) exception_epc(regs))) 653 if (__get_user(opcode, (unsigned int __user *) exception_epc(regs)))
654 goto out_sigsegv; 654 goto out_sigsegv;
655 655
656 /* 656 /*
@@ -700,7 +700,7 @@ asmlinkage void do_tr(struct pt_regs *regs)
700 unsigned int opcode, tcode = 0; 700 unsigned int opcode, tcode = 0;
701 siginfo_t info; 701 siginfo_t info;
702 702
703 if (get_user(opcode, (unsigned int __user *) exception_epc(regs))) 703 if (__get_user(opcode, (unsigned int __user *) exception_epc(regs)))
704 goto out_sigsegv; 704 goto out_sigsegv;
705 705
706 /* Immediate versions don't provide a code. */ 706 /* Immediate versions don't provide a code. */
@@ -757,11 +757,12 @@ asmlinkage void do_cpu(struct pt_regs *regs)
757{ 757{
758 unsigned int cpid; 758 unsigned int cpid;
759 759
760 die_if_kernel("do_cpu invoked from kernel context!", regs);
761
760 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; 762 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
761 763
762 switch (cpid) { 764 switch (cpid) {
763 case 0: 765 case 0:
764 die_if_kernel("do_cpu invoked from kernel context!", regs);
765 if (!cpu_has_llsc) 766 if (!cpu_has_llsc)
766 if (!simulate_llsc(regs)) 767 if (!simulate_llsc(regs))
767 return; 768 return;
@@ -772,9 +773,6 @@ asmlinkage void do_cpu(struct pt_regs *regs)
772 break; 773 break;
773 774
774 case 1: 775 case 1:
775 if (!test_thread_flag(TIF_ALLOW_FP_IN_KERNEL))
776 die_if_kernel("do_cpu invoked from kernel context!",
777 regs);
778 if (used_math()) /* Using the FPU again. */ 776 if (used_math()) /* Using the FPU again. */
779 own_fpu(1); 777 own_fpu(1);
780 else { /* First time FPU user. */ 778 else { /* First time FPU user. */
@@ -782,19 +780,7 @@ asmlinkage void do_cpu(struct pt_regs *regs)
782 set_used_math(); 780 set_used_math();
783 } 781 }
784 782
785 if (raw_cpu_has_fpu) { 783 if (!raw_cpu_has_fpu) {
786 if (test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) {
787 local_irq_disable();
788 if (cpu_has_fpu)
789 regs->cp0_status |= ST0_CU1;
790 /*
791 * We must return without enabling
792 * interrupts to ensure keep FPU
793 * ownership until resume.
794 */
795 return;
796 }
797 } else {
798 int sig; 784 int sig;
799 sig = fpu_emulator_cop1Handler(regs, 785 sig = fpu_emulator_cop1Handler(regs,
800 &current->thread.fpu, 0); 786 &current->thread.fpu, 0);
@@ -836,7 +822,6 @@ asmlinkage void do_cpu(struct pt_regs *regs)
836 822
837 case 2: 823 case 2:
838 case 3: 824 case 3:
839 die_if_kernel("do_cpu invoked from kernel context!", regs);
840 break; 825 break;
841 } 826 }
842 827
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 69a8bcfe72b2..4f94fa261aae 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -35,7 +35,7 @@
35#define vpe_id() smp_processor_id() 35#define vpe_id() smp_processor_id()
36#else 36#else
37#define WHAT 0 37#define WHAT 0
38#define vpe_id() smp_processor_id() 38#define vpe_id() 0
39#endif 39#endif
40 40
41#define __define_perf_accessors(r, n, np) \ 41#define __define_perf_accessors(r, n, np) \
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
index 87188f0f6fbe..f4a6169aa0a4 100644
--- a/arch/mips/sibyte/sb1250/setup.c
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -141,6 +141,18 @@ static int __init setup_bcm112x(void)
141 periph_rev = 3; 141 periph_rev = 3;
142 pass_str = "A2"; 142 pass_str = "A2";
143 break; 143 break;
144 case K_SYS_REVISION_BCM112x_A3:
145 periph_rev = 3;
146 pass_str = "A3";
147 break;
148 case K_SYS_REVISION_BCM112x_A4:
149 periph_rev = 3;
150 pass_str = "A4";
151 break;
152 case K_SYS_REVISION_BCM112x_B0:
153 periph_rev = 3;
154 pass_str = "B0";
155 break;
144 default: 156 default:
145 printk("Unknown %s rev %x\n", soc_str, soc_pass); 157 printk("Unknown %s rev %x\n", soc_str, soc_pass);
146 ret = 1; 158 ret = 1;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index c75192567e55..fbfff95b4437 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -128,7 +128,7 @@ static void mpc52xx_main_mask(unsigned int virq)
128 128
129 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 129 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
130 130
131 io_be_setbit(&intr->main_mask, 15 - l2irq); 131 io_be_setbit(&intr->main_mask, 16 - l2irq);
132} 132}
133 133
134static void mpc52xx_main_unmask(unsigned int virq) 134static void mpc52xx_main_unmask(unsigned int virq)
@@ -141,7 +141,7 @@ static void mpc52xx_main_unmask(unsigned int virq)
141 141
142 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 142 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
143 143
144 io_be_clrbit(&intr->main_mask, 15 - l2irq); 144 io_be_clrbit(&intr->main_mask, 16 - l2irq);
145} 145}
146 146
147static struct irq_chip mpc52xx_main_irqchip = { 147static struct irq_chip mpc52xx_main_irqchip = {
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
index 3b23bcb35b7a..7a8722beac12 100644
--- a/arch/ppc/8xx_io/commproc.c
+++ b/arch/ppc/8xx_io/commproc.c
@@ -39,6 +39,21 @@
39#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
40#include <asm/rheap.h> 40#include <asm/rheap.h>
41 41
42#define immr_map(member) \
43({ \
44 u32 offset = offsetof(immap_t, member); \
45 void *addr = ioremap (IMAP_ADDR + offset, \
46 sizeof( ((immap_t*)0)->member)); \
47 addr; \
48})
49
50#define immr_map_size(member, size) \
51({ \
52 u32 offset = offsetof(immap_t, member); \
53 void *addr = ioremap (IMAP_ADDR + offset, size); \
54 addr; \
55})
56
42static void m8xx_cpm_dpinit(void); 57static void m8xx_cpm_dpinit(void);
43static uint host_buffer; /* One page of host buffer */ 58static uint host_buffer; /* One page of host buffer */
44static uint host_end; /* end + 1 */ 59static uint host_end; /* end + 1 */
@@ -364,11 +379,16 @@ static rh_block_t cpm_boot_dpmem_rh_block[16];
364static rh_info_t cpm_dpmem_info; 379static rh_info_t cpm_dpmem_info;
365 380
366#define CPM_DPMEM_ALIGNMENT 8 381#define CPM_DPMEM_ALIGNMENT 8
382static u8* dpram_vbase;
383static uint dpram_pbase;
367 384
368void m8xx_cpm_dpinit(void) 385void m8xx_cpm_dpinit(void)
369{ 386{
370 spin_lock_init(&cpm_dpmem_lock); 387 spin_lock_init(&cpm_dpmem_lock);
371 388
389 dpram_vbase = immr_map_size(im_cpm.cp_dpmem, CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE);
390 dpram_pbase = (uint)&((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem;
391
372 /* Initialize the info header */ 392 /* Initialize the info header */
373 rh_init(&cpm_dpmem_info, CPM_DPMEM_ALIGNMENT, 393 rh_init(&cpm_dpmem_info, CPM_DPMEM_ALIGNMENT,
374 sizeof(cpm_boot_dpmem_rh_block) / 394 sizeof(cpm_boot_dpmem_rh_block) /
@@ -442,3 +462,9 @@ void *cpm_dpram_addr(uint offset)
442 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset; 462 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset;
443} 463}
444EXPORT_SYMBOL(cpm_dpram_addr); 464EXPORT_SYMBOL(cpm_dpram_addr);
465
466uint cpm_dpram_phys(u8* addr)
467{
468 return (dpram_pbase + (uint)(addr - dpram_vbase));
469}
470EXPORT_SYMBOL(cpm_dpram_phys);
diff --git a/arch/ppc/configs/ads8272_defconfig b/arch/ppc/configs/ads8272_defconfig
index d1db7d14780e..6619f9118b00 100644
--- a/arch/ppc/configs/ads8272_defconfig
+++ b/arch/ppc/configs/ads8272_defconfig
@@ -1,42 +1,69 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc5
4# Wed Apr 4 20:55:16 2007
3# 5#
4CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y 8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y 9CONFIG_ARCH_HAS_ILOG2_U32=y
10# CONFIG_ARCH_HAS_ILOG2_U64 is not set
11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y
7CONFIG_PPC=y 13CONFIG_PPC=y
8CONFIG_PPC32=y 14CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y 15CONFIG_GENERIC_NVRAM=y
16CONFIG_GENERIC_FIND_NEXT_BIT=y
17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_GENERIC_BUG=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
10 21
11# 22#
12# Code maturity level options 23# Code maturity level options
13# 24#
14CONFIG_EXPERIMENTAL=y 25CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_STANDALONE=y
17CONFIG_BROKEN_ON_SMP=y 26CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32
18 28
19# 29#
20# General setup 30# General setup
21# 31#
32CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y
22CONFIG_SWAP=y 34CONFIG_SWAP=y
23CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
36# CONFIG_IPC_NS is not set
37CONFIG_SYSVIPC_SYSCTL=y
24# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y 40# CONFIG_TASKSTATS is not set
41# CONFIG_UTS_NS is not set
27# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set
46CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE=""
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
49CONFIG_SYSCTL=y
31CONFIG_EMBEDDED=y 50CONFIG_EMBEDDED=y
51CONFIG_SYSCTL_SYSCALL=y
32# CONFIG_KALLSYMS is not set 52# CONFIG_KALLSYMS is not set
53# CONFIG_HOTPLUG is not set
54CONFIG_PRINTK=y
55CONFIG_BUG=y
56CONFIG_ELF_CORE=y
57CONFIG_BASE_FULL=y
33CONFIG_FUTEX=y 58CONFIG_FUTEX=y
34# CONFIG_EPOLL is not set 59# CONFIG_EPOLL is not set
35CONFIG_IOSCHED_NOOP=y 60CONFIG_SHMEM=y
36CONFIG_IOSCHED_AS=y 61CONFIG_SLAB=y
37CONFIG_IOSCHED_DEADLINE=y 62CONFIG_VM_EVENT_COUNTERS=y
38CONFIG_IOSCHED_CFQ=y 63CONFIG_RT_MUTEXES=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 64# CONFIG_TINY_SHMEM is not set
65CONFIG_BASE_SMALL=0
66# CONFIG_SLOB is not set
40 67
41# 68#
42# Loadable module support 69# Loadable module support
@@ -44,66 +71,124 @@ CONFIG_IOSCHED_CFQ=y
44# CONFIG_MODULES is not set 71# CONFIG_MODULES is not set
45 72
46# 73#
74# Block layer
75#
76CONFIG_BLOCK=y
77# CONFIG_LBD is not set
78# CONFIG_BLK_DEV_IO_TRACE is not set
79# CONFIG_LSF is not set
80
81#
82# IO Schedulers
83#
84CONFIG_IOSCHED_NOOP=y
85CONFIG_IOSCHED_AS=y
86CONFIG_IOSCHED_DEADLINE=y
87CONFIG_IOSCHED_CFQ=y
88# CONFIG_DEFAULT_AS is not set
89# CONFIG_DEFAULT_DEADLINE is not set
90CONFIG_DEFAULT_CFQ=y
91# CONFIG_DEFAULT_NOOP is not set
92CONFIG_DEFAULT_IOSCHED="cfq"
93
94#
47# Processor 95# Processor
48# 96#
49CONFIG_6xx=y 97CONFIG_6xx=y
50# CONFIG_40x is not set 98# CONFIG_40x is not set
51# CONFIG_44x is not set 99# CONFIG_44x is not set
52# CONFIG_POWER3 is not set
53# CONFIG_POWER4 is not set
54# CONFIG_8xx is not set 100# CONFIG_8xx is not set
101# CONFIG_E200 is not set
102# CONFIG_E500 is not set
103CONFIG_PPC_FPU=y
104# CONFIG_PPC_DCR_NATIVE is not set
105# CONFIG_KEXEC is not set
55# CONFIG_CPU_FREQ is not set 106# CONFIG_CPU_FREQ is not set
107# CONFIG_WANT_EARLY_SERIAL is not set
56CONFIG_EMBEDDEDBOOT=y 108CONFIG_EMBEDDEDBOOT=y
57CONFIG_PPC_STD_MMU=y 109CONFIG_PPC_STD_MMU=y
58 110
59# 111#
60# Platform options 112# Platform options
61# 113#
62# CONFIG_PPC_MULTIPLATFORM is not set 114
115#
116# Freescale Ethernet driver platform-specific options
117#
118# CONFIG_PPC_PREP is not set
63# CONFIG_APUS is not set 119# CONFIG_APUS is not set
120# CONFIG_KATANA is not set
64# CONFIG_WILLOW is not set 121# CONFIG_WILLOW is not set
65# CONFIG_PCORE is not set 122# CONFIG_CPCI690 is not set
66# CONFIG_POWERPMC250 is not set 123# CONFIG_POWERPMC250 is not set
67# CONFIG_EV64260 is not set 124# CONFIG_CHESTNUT is not set
68# CONFIG_SPRUCE is not set 125# CONFIG_SPRUCE is not set
126# CONFIG_HDPU is not set
127# CONFIG_EV64260 is not set
69# CONFIG_LOPEC is not set 128# CONFIG_LOPEC is not set
70# CONFIG_MCPN765 is not set
71# CONFIG_MVME5100 is not set 129# CONFIG_MVME5100 is not set
72# CONFIG_PPLUS is not set 130# CONFIG_PPLUS is not set
73# CONFIG_PRPMC750 is not set 131# CONFIG_PRPMC750 is not set
74# CONFIG_PRPMC800 is not set 132# CONFIG_PRPMC800 is not set
75# CONFIG_SANDPOINT is not set 133# CONFIG_SANDPOINT is not set
76# CONFIG_ADIR is not set 134# CONFIG_RADSTONE_PPC7D is not set
77# CONFIG_K2 is not set
78# CONFIG_PAL4 is not set 135# CONFIG_PAL4 is not set
79# CONFIG_GEMINI is not set
80# CONFIG_EST8260 is not set 136# CONFIG_EST8260 is not set
81# CONFIG_SBC82xx is not set 137# CONFIG_SBC82xx is not set
82# CONFIG_SBS8260 is not set 138# CONFIG_SBS8260 is not set
83# CONFIG_RPX6 is not set 139# CONFIG_RPX8260 is not set
84# CONFIG_TQM8260 is not set 140# CONFIG_TQM8260 is not set
85CONFIG_ADS8272=y 141CONFIG_ADS8272=y
142# CONFIG_PQ2FADS is not set
143# CONFIG_LITE5200 is not set
144# CONFIG_MPC834x_SYS is not set
145# CONFIG_EV64360 is not set
86CONFIG_PQ2ADS=y 146CONFIG_PQ2ADS=y
87CONFIG_8260=y 147CONFIG_8260=y
88CONFIG_8272=y 148CONFIG_8272=y
89CONFIG_CPM2=y 149CONFIG_CPM2=y
90# CONFIG_PC_KEYBOARD is not set 150# CONFIG_PC_KEYBOARD is not set
91CONFIG_SERIAL_CONSOLE=y
92# CONFIG_SMP is not set 151# CONFIG_SMP is not set
93# CONFIG_PREEMPT is not set
94# CONFIG_HIGHMEM is not set 152# CONFIG_HIGHMEM is not set
95CONFIG_KERNEL_ELF=y 153CONFIG_ARCH_POPULATES_NODE_MAP=y
154# CONFIG_HZ_100 is not set
155CONFIG_HZ_250=y
156# CONFIG_HZ_300 is not set
157# CONFIG_HZ_1000 is not set
158CONFIG_HZ=250
159CONFIG_PREEMPT_NONE=y
160# CONFIG_PREEMPT_VOLUNTARY is not set
161# CONFIG_PREEMPT is not set
162CONFIG_SELECT_MEMORY_MODEL=y
163CONFIG_FLATMEM_MANUAL=y
164# CONFIG_DISCONTIGMEM_MANUAL is not set
165# CONFIG_SPARSEMEM_MANUAL is not set
166CONFIG_FLATMEM=y
167CONFIG_FLAT_NODE_MEM_MAP=y
168# CONFIG_SPARSEMEM_STATIC is not set
169CONFIG_SPLIT_PTLOCK_CPUS=4
170# CONFIG_RESOURCES_64BIT is not set
171CONFIG_ZONE_DMA_FLAG=1
96CONFIG_BINFMT_ELF=y 172CONFIG_BINFMT_ELF=y
97# CONFIG_BINFMT_MISC is not set 173# CONFIG_BINFMT_MISC is not set
98# CONFIG_CMDLINE_BOOL is not set 174# CONFIG_CMDLINE_BOOL is not set
175# CONFIG_PM is not set
176CONFIG_SECCOMP=y
177CONFIG_ISA_DMA_API=y
99 178
100# 179#
101# Bus options 180# Bus options
102# 181#
182CONFIG_ZONE_DMA=y
183# CONFIG_PPC_I8259 is not set
184CONFIG_PPC_INDIRECT_PCI=y
103CONFIG_PCI=y 185CONFIG_PCI=y
104CONFIG_PCI_DOMAINS=y 186CONFIG_PCI_DOMAINS=y
105# CONFIG_PCI_LEGACY_PROC is not set 187CONFIG_PCI_8260=y
106# CONFIG_PCI_NAMES is not set 188
189#
190# PCCARD (PCMCIA/CardBus) support
191#
107 192
108# 193#
109# Advanced setup 194# Advanced setup
@@ -120,12 +205,110 @@ CONFIG_TASK_SIZE=0x80000000
120CONFIG_BOOT_LOAD=0x00400000 205CONFIG_BOOT_LOAD=0x00400000
121 206
122# 207#
208# Networking
209#
210CONFIG_NET=y
211
212#
213# Networking options
214#
215# CONFIG_NETDEBUG is not set
216CONFIG_PACKET=y
217# CONFIG_PACKET_MMAP is not set
218CONFIG_UNIX=y
219CONFIG_XFRM=y
220# CONFIG_XFRM_USER is not set
221# CONFIG_XFRM_SUB_POLICY is not set
222# CONFIG_XFRM_MIGRATE is not set
223# CONFIG_NET_KEY is not set
224CONFIG_INET=y
225CONFIG_IP_MULTICAST=y
226# CONFIG_IP_ADVANCED_ROUTER is not set
227CONFIG_IP_FIB_HASH=y
228CONFIG_IP_PNP=y
229CONFIG_IP_PNP_DHCP=y
230CONFIG_IP_PNP_BOOTP=y
231# CONFIG_IP_PNP_RARP is not set
232# CONFIG_NET_IPIP is not set
233# CONFIG_NET_IPGRE is not set
234# CONFIG_IP_MROUTE is not set
235# CONFIG_ARPD is not set
236CONFIG_SYN_COOKIES=y
237# CONFIG_INET_AH is not set
238# CONFIG_INET_ESP is not set
239# CONFIG_INET_IPCOMP is not set
240# CONFIG_INET_XFRM_TUNNEL is not set
241# CONFIG_INET_TUNNEL is not set
242CONFIG_INET_XFRM_MODE_TRANSPORT=y
243CONFIG_INET_XFRM_MODE_TUNNEL=y
244CONFIG_INET_XFRM_MODE_BEET=y
245CONFIG_INET_DIAG=y
246CONFIG_INET_TCP_DIAG=y
247# CONFIG_TCP_CONG_ADVANCED is not set
248CONFIG_TCP_CONG_CUBIC=y
249CONFIG_DEFAULT_TCP_CONG="cubic"
250# CONFIG_TCP_MD5SIG is not set
251# CONFIG_IPV6 is not set
252# CONFIG_INET6_XFRM_TUNNEL is not set
253# CONFIG_INET6_TUNNEL is not set
254# CONFIG_NETWORK_SECMARK is not set
255# CONFIG_NETFILTER is not set
256
257#
258# DCCP Configuration (EXPERIMENTAL)
259#
260# CONFIG_IP_DCCP is not set
261
262#
263# SCTP Configuration (EXPERIMENTAL)
264#
265# CONFIG_IP_SCTP is not set
266
267#
268# TIPC Configuration (EXPERIMENTAL)
269#
270# CONFIG_TIPC is not set
271# CONFIG_ATM is not set
272# CONFIG_BRIDGE is not set
273# CONFIG_VLAN_8021Q is not set
274# CONFIG_DECNET is not set
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278# CONFIG_X25 is not set
279# CONFIG_LAPB is not set
280# CONFIG_ECONET is not set
281# CONFIG_WAN_ROUTER is not set
282
283#
284# QoS and/or fair queueing
285#
286# CONFIG_NET_SCHED is not set
287
288#
289# Network testing
290#
291# CONFIG_NET_PKTGEN is not set
292# CONFIG_HAMRADIO is not set
293# CONFIG_IRDA is not set
294# CONFIG_BT is not set
295# CONFIG_IEEE80211 is not set
296
297#
123# Device Drivers 298# Device Drivers
124# 299#
125 300
126# 301#
127# Generic Driver Options 302# Generic Driver Options
128# 303#
304CONFIG_STANDALONE=y
305CONFIG_PREVENT_FIRMWARE_BUILD=y
306# CONFIG_SYS_HYPERVISOR is not set
307
308#
309# Connector - unified userspace <-> kernelspace linker
310#
311# CONFIG_CONNECTOR is not set
129 312
130# 313#
131# Memory Technology Devices (MTD) 314# Memory Technology Devices (MTD)
@@ -140,6 +323,7 @@ CONFIG_BOOT_LOAD=0x00400000
140# 323#
141# Plug and Play support 324# Plug and Play support
142# 325#
326# CONFIG_PNPACPI is not set
143 327
144# 328#
145# Block devices 329# Block devices
@@ -149,14 +333,23 @@ CONFIG_BOOT_LOAD=0x00400000
149# CONFIG_BLK_CPQ_CISS_DA is not set 333# CONFIG_BLK_CPQ_CISS_DA is not set
150# CONFIG_BLK_DEV_DAC960 is not set 334# CONFIG_BLK_DEV_DAC960 is not set
151# CONFIG_BLK_DEV_UMEM is not set 335# CONFIG_BLK_DEV_UMEM is not set
336# CONFIG_BLK_DEV_COW_COMMON is not set
152CONFIG_BLK_DEV_LOOP=y 337CONFIG_BLK_DEV_LOOP=y
153# CONFIG_BLK_DEV_CRYPTOLOOP is not set 338# CONFIG_BLK_DEV_CRYPTOLOOP is not set
154# CONFIG_BLK_DEV_NBD is not set 339# CONFIG_BLK_DEV_NBD is not set
155# CONFIG_BLK_DEV_CARMEL is not set 340# CONFIG_BLK_DEV_SX8 is not set
156CONFIG_BLK_DEV_RAM=y 341CONFIG_BLK_DEV_RAM=y
342CONFIG_BLK_DEV_RAM_COUNT=16
157CONFIG_BLK_DEV_RAM_SIZE=32768 343CONFIG_BLK_DEV_RAM_SIZE=32768
158CONFIG_BLK_DEV_INITRD=y 344CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
159# CONFIG_LBD is not set 345# CONFIG_CDROM_PKTCDVD is not set
346# CONFIG_ATA_OVER_ETH is not set
347
348#
349# Misc devices
350#
351# CONFIG_SGI_IOC4 is not set
352# CONFIG_TIFM_CORE is not set
160 353
161# 354#
162# ATA/ATAPI/MFM/RLL support 355# ATA/ATAPI/MFM/RLL support
@@ -166,7 +359,14 @@ CONFIG_BLK_DEV_INITRD=y
166# 359#
167# SCSI device support 360# SCSI device support
168# 361#
362# CONFIG_RAID_ATTRS is not set
169# CONFIG_SCSI is not set 363# CONFIG_SCSI is not set
364# CONFIG_SCSI_NETLINK is not set
365
366#
367# Serial ATA (prod) and Parallel ATA (experimental) drivers
368#
369# CONFIG_ATA is not set
170 370
171# 371#
172# Multi-device support (RAID and LVM) 372# Multi-device support (RAID and LVM)
@@ -176,6 +376,7 @@ CONFIG_BLK_DEV_INITRD=y
176# 376#
177# Fusion MPT device support 377# Fusion MPT device support
178# 378#
379# CONFIG_FUSION is not set
179 380
180# 381#
181# IEEE 1394 (FireWire) support 382# IEEE 1394 (FireWire) support
@@ -190,70 +391,12 @@ CONFIG_BLK_DEV_INITRD=y
190# 391#
191# Macintosh device drivers 392# Macintosh device drivers
192# 393#
394# CONFIG_MAC_EMUMOUSEBTN is not set
395# CONFIG_WINDFARM is not set
193 396
194# 397#
195# Networking support 398# Network device support
196#
197CONFIG_NET=y
198
199#
200# Networking options
201# 399#
202CONFIG_PACKET=y
203# CONFIG_PACKET_MMAP is not set
204# CONFIG_NETLINK_DEV is not set
205CONFIG_UNIX=y
206# CONFIG_NET_KEY is not set
207CONFIG_INET=y
208CONFIG_IP_MULTICAST=y
209# CONFIG_IP_ADVANCED_ROUTER is not set
210CONFIG_IP_PNP=y
211CONFIG_IP_PNP_DHCP=y
212CONFIG_IP_PNP_BOOTP=y
213# CONFIG_IP_PNP_RARP is not set
214# CONFIG_NET_IPIP is not set
215# CONFIG_NET_IPGRE is not set
216# CONFIG_IP_MROUTE is not set
217# CONFIG_ARPD is not set
218CONFIG_SYN_COOKIES=y
219# CONFIG_INET_AH is not set
220# CONFIG_INET_ESP is not set
221# CONFIG_INET_IPCOMP is not set
222# CONFIG_IPV6 is not set
223# CONFIG_NETFILTER is not set
224
225#
226# SCTP Configuration (EXPERIMENTAL)
227#
228# CONFIG_IP_SCTP is not set
229# CONFIG_ATM is not set
230# CONFIG_BRIDGE is not set
231# CONFIG_VLAN_8021Q is not set
232# CONFIG_DECNET is not set
233# CONFIG_LLC2 is not set
234# CONFIG_IPX is not set
235# CONFIG_ATALK is not set
236# CONFIG_X25 is not set
237# CONFIG_LAPB is not set
238# CONFIG_NET_DIVERT is not set
239# CONFIG_ECONET is not set
240# CONFIG_WAN_ROUTER is not set
241# CONFIG_NET_HW_FLOWCONTROL is not set
242
243#
244# QoS and/or fair queueing
245#
246# CONFIG_NET_SCHED is not set
247
248#
249# Network testing
250#
251# CONFIG_NET_PKTGEN is not set
252# CONFIG_NETPOLL is not set
253# CONFIG_NET_POLL_CONTROLLER is not set
254# CONFIG_HAMRADIO is not set
255# CONFIG_IRDA is not set
256# CONFIG_BT is not set
257CONFIG_NETDEVICES=y 400CONFIG_NETDEVICES=y
258# CONFIG_DUMMY is not set 401# CONFIG_DUMMY is not set
259# CONFIG_BONDING is not set 402# CONFIG_BONDING is not set
@@ -266,13 +409,31 @@ CONFIG_NETDEVICES=y
266# CONFIG_ARCNET is not set 409# CONFIG_ARCNET is not set
267 410
268# 411#
412# PHY device support
413#
414CONFIG_PHYLIB=y
415
416#
417# MII PHY device drivers
418#
419# CONFIG_MARVELL_PHY is not set
420CONFIG_DAVICOM_PHY=y
421# CONFIG_QSEMI_PHY is not set
422# CONFIG_LXT_PHY is not set
423# CONFIG_CICADA_PHY is not set
424# CONFIG_VITESSE_PHY is not set
425# CONFIG_SMSC_PHY is not set
426# CONFIG_BROADCOM_PHY is not set
427# CONFIG_FIXED_PHY is not set
428
429#
269# Ethernet (10 or 100Mbit) 430# Ethernet (10 or 100Mbit)
270# 431#
271CONFIG_NET_ETHERNET=y 432CONFIG_NET_ETHERNET=y
272# CONFIG_MII is not set 433CONFIG_MII=y
273# CONFIG_OAKNET is not set
274# CONFIG_HAPPYMEAL is not set 434# CONFIG_HAPPYMEAL is not set
275# CONFIG_SUNGEM is not set 435# CONFIG_SUNGEM is not set
436# CONFIG_CASSINI is not set
276# CONFIG_NET_VENDOR_3COM is not set 437# CONFIG_NET_VENDOR_3COM is not set
277 438
278# 439#
@@ -281,6 +442,9 @@ CONFIG_NET_ETHERNET=y
281# CONFIG_NET_TULIP is not set 442# CONFIG_NET_TULIP is not set
282# CONFIG_HP100 is not set 443# CONFIG_HP100 is not set
283# CONFIG_NET_PCI is not set 444# CONFIG_NET_PCI is not set
445CONFIG_FS_ENET=y
446# CONFIG_FS_ENET_HAS_SCC is not set
447CONFIG_FS_ENET_HAS_FCC=y
284 448
285# 449#
286# Ethernet (1000 Mbit) 450# Ethernet (1000 Mbit)
@@ -292,14 +456,24 @@ CONFIG_NET_ETHERNET=y
292# CONFIG_HAMACHI is not set 456# CONFIG_HAMACHI is not set
293# CONFIG_YELLOWFIN is not set 457# CONFIG_YELLOWFIN is not set
294# CONFIG_R8169 is not set 458# CONFIG_R8169 is not set
459# CONFIG_SIS190 is not set
460# CONFIG_SKGE is not set
461# CONFIG_SKY2 is not set
295# CONFIG_SK98LIN is not set 462# CONFIG_SK98LIN is not set
296# CONFIG_TIGON3 is not set 463# CONFIG_TIGON3 is not set
464# CONFIG_BNX2 is not set
465# CONFIG_QLA3XXX is not set
466# CONFIG_ATL1 is not set
297 467
298# 468#
299# Ethernet (10000 Mbit) 469# Ethernet (10000 Mbit)
300# 470#
471# CONFIG_CHELSIO_T1 is not set
472# CONFIG_CHELSIO_T3 is not set
301# CONFIG_IXGB is not set 473# CONFIG_IXGB is not set
302# CONFIG_S2IO is not set 474# CONFIG_S2IO is not set
475# CONFIG_MYRI10GE is not set
476# CONFIG_NETXEN_NIC is not set
303 477
304# 478#
305# Token Ring devices 479# Token Ring devices
@@ -321,6 +495,8 @@ CONFIG_NET_ETHERNET=y
321# CONFIG_SLIP is not set 495# CONFIG_SLIP is not set
322# CONFIG_SHAPER is not set 496# CONFIG_SHAPER is not set
323# CONFIG_NETCONSOLE is not set 497# CONFIG_NETCONSOLE is not set
498# CONFIG_NETPOLL is not set
499# CONFIG_NET_POLL_CONTROLLER is not set
324 500
325# 501#
326# ISDN subsystem 502# ISDN subsystem
@@ -336,6 +512,7 @@ CONFIG_NET_ETHERNET=y
336# Input device support 512# Input device support
337# 513#
338CONFIG_INPUT=y 514CONFIG_INPUT=y
515# CONFIG_INPUT_FF_MEMLESS is not set
339 516
340# 517#
341# Userland interfaces 518# Userland interfaces
@@ -347,14 +524,6 @@ CONFIG_INPUT=y
347# CONFIG_INPUT_EVBUG is not set 524# CONFIG_INPUT_EVBUG is not set
348 525
349# 526#
350# Input I/O drivers
351#
352# CONFIG_GAMEPORT is not set
353CONFIG_SOUND_GAMEPORT=y
354# CONFIG_SERIO is not set
355# CONFIG_SERIO_I8042 is not set
356
357#
358# Input Device Drivers 527# Input Device Drivers
359# 528#
360# CONFIG_INPUT_KEYBOARD is not set 529# CONFIG_INPUT_KEYBOARD is not set
@@ -364,6 +533,12 @@ CONFIG_SOUND_GAMEPORT=y
364# CONFIG_INPUT_MISC is not set 533# CONFIG_INPUT_MISC is not set
365 534
366# 535#
536# Hardware I/O ports
537#
538# CONFIG_SERIO is not set
539# CONFIG_GAMEPORT is not set
540
541#
367# Character devices 542# Character devices
368# 543#
369# CONFIG_VT is not set 544# CONFIG_VT is not set
@@ -377,10 +552,21 @@ CONFIG_SOUND_GAMEPORT=y
377# 552#
378# Non-8250 serial port support 553# Non-8250 serial port support
379# 554#
555# CONFIG_SERIAL_UARTLITE is not set
556CONFIG_SERIAL_CORE=y
557CONFIG_SERIAL_CORE_CONSOLE=y
558CONFIG_SERIAL_CPM=y
559CONFIG_SERIAL_CPM_CONSOLE=y
560CONFIG_SERIAL_CPM_SCC1=y
561# CONFIG_SERIAL_CPM_SCC2 is not set
562# CONFIG_SERIAL_CPM_SCC3 is not set
563CONFIG_SERIAL_CPM_SCC4=y
564# CONFIG_SERIAL_CPM_SMC1 is not set
565# CONFIG_SERIAL_CPM_SMC2 is not set
566# CONFIG_SERIAL_JSM is not set
380CONFIG_UNIX98_PTYS=y 567CONFIG_UNIX98_PTYS=y
381CONFIG_LEGACY_PTYS=y 568CONFIG_LEGACY_PTYS=y
382CONFIG_LEGACY_PTY_COUNT=256 569CONFIG_LEGACY_PTY_COUNT=256
383# CONFIG_QIC02_TAPE is not set
384 570
385# 571#
386# IPMI 572# IPMI
@@ -391,29 +577,53 @@ CONFIG_LEGACY_PTY_COUNT=256
391# Watchdog Cards 577# Watchdog Cards
392# 578#
393# CONFIG_WATCHDOG is not set 579# CONFIG_WATCHDOG is not set
580CONFIG_HW_RANDOM=y
394# CONFIG_NVRAM is not set 581# CONFIG_NVRAM is not set
395CONFIG_GEN_RTC=y 582CONFIG_GEN_RTC=y
396# CONFIG_GEN_RTC_X is not set 583# CONFIG_GEN_RTC_X is not set
397# CONFIG_DTLK is not set 584# CONFIG_DTLK is not set
398# CONFIG_R3964 is not set 585# CONFIG_R3964 is not set
399# CONFIG_APPLICOM is not set 586# CONFIG_APPLICOM is not set
400
401#
402# Ftape, the floppy tape device driver
403#
404# CONFIG_FTAPE is not set
405# CONFIG_AGP is not set 587# CONFIG_AGP is not set
406# CONFIG_DRM is not set 588# CONFIG_DRM is not set
407# CONFIG_RAW_DRIVER is not set 589# CONFIG_RAW_DRIVER is not set
408 590
409# 591#
592# TPM devices
593#
594# CONFIG_TCG_TPM is not set
595
596#
410# I2C support 597# I2C support
411# 598#
412# CONFIG_I2C is not set 599# CONFIG_I2C is not set
413 600
414# 601#
415# Misc devices 602# SPI support
603#
604# CONFIG_SPI is not set
605# CONFIG_SPI_MASTER is not set
606
416# 607#
608# Dallas's 1-wire bus
609#
610# CONFIG_W1 is not set
611
612#
613# Hardware Monitoring support
614#
615CONFIG_HWMON=y
616# CONFIG_HWMON_VID is not set
617# CONFIG_SENSORS_ABITUGURU is not set
618# CONFIG_SENSORS_F71805F is not set
619# CONFIG_SENSORS_PC87427 is not set
620# CONFIG_SENSORS_VT1211 is not set
621# CONFIG_HWMON_DEBUG_CHIP is not set
622
623#
624# Multifunction device drivers
625#
626# CONFIG_MFD_SM501 is not set
417 627
418# 628#
419# Multimedia devices 629# Multimedia devices
@@ -428,7 +638,9 @@ CONFIG_GEN_RTC=y
428# 638#
429# Graphics support 639# Graphics support
430# 640#
641# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
431# CONFIG_FB is not set 642# CONFIG_FB is not set
643# CONFIG_FB_IBM_GXT4500 is not set
432 644
433# 645#
434# Sound 646# Sound
@@ -436,35 +648,110 @@ CONFIG_GEN_RTC=y
436# CONFIG_SOUND is not set 648# CONFIG_SOUND is not set
437 649
438# 650#
651# HID Devices
652#
653CONFIG_HID=y
654# CONFIG_HID_DEBUG is not set
655
656#
439# USB support 657# USB support
440# 658#
659CONFIG_USB_ARCH_HAS_HCD=y
660CONFIG_USB_ARCH_HAS_OHCI=y
661CONFIG_USB_ARCH_HAS_EHCI=y
441# CONFIG_USB is not set 662# CONFIG_USB is not set
442 663
443# 664#
665# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
666#
667
668#
444# USB Gadget Support 669# USB Gadget Support
445# 670#
446# CONFIG_USB_GADGET is not set 671# CONFIG_USB_GADGET is not set
447 672
448# 673#
674# MMC/SD Card support
675#
676# CONFIG_MMC is not set
677
678#
679# LED devices
680#
681# CONFIG_NEW_LEDS is not set
682
683#
684# LED drivers
685#
686
687#
688# LED Triggers
689#
690
691#
692# InfiniBand support
693#
694# CONFIG_INFINIBAND is not set
695
696#
697# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
698#
699
700#
701# Real Time Clock
702#
703# CONFIG_RTC_CLASS is not set
704
705#
706# DMA Engine support
707#
708# CONFIG_DMA_ENGINE is not set
709
710#
711# DMA Clients
712#
713
714#
715# DMA Devices
716#
717
718#
719# Auxiliary Display support
720#
721
722#
723# Virtualization
724#
725
726#
449# File systems 727# File systems
450# 728#
451CONFIG_EXT2_FS=y 729CONFIG_EXT2_FS=y
452# CONFIG_EXT2_FS_XATTR is not set 730# CONFIG_EXT2_FS_XATTR is not set
731# CONFIG_EXT2_FS_XIP is not set
453CONFIG_EXT3_FS=y 732CONFIG_EXT3_FS=y
454CONFIG_EXT3_FS_XATTR=y 733CONFIG_EXT3_FS_XATTR=y
455# CONFIG_EXT3_FS_POSIX_ACL is not set 734# CONFIG_EXT3_FS_POSIX_ACL is not set
456# CONFIG_EXT3_FS_SECURITY is not set 735# CONFIG_EXT3_FS_SECURITY is not set
736# CONFIG_EXT4DEV_FS is not set
457CONFIG_JBD=y 737CONFIG_JBD=y
458# CONFIG_JBD_DEBUG is not set 738# CONFIG_JBD_DEBUG is not set
459CONFIG_FS_MBCACHE=y 739CONFIG_FS_MBCACHE=y
460# CONFIG_REISERFS_FS is not set 740# CONFIG_REISERFS_FS is not set
461# CONFIG_JFS_FS is not set 741# CONFIG_JFS_FS is not set
742CONFIG_FS_POSIX_ACL=y
462# CONFIG_XFS_FS is not set 743# CONFIG_XFS_FS is not set
744# CONFIG_GFS2_FS is not set
745# CONFIG_OCFS2_FS is not set
463# CONFIG_MINIX_FS is not set 746# CONFIG_MINIX_FS is not set
464# CONFIG_ROMFS_FS is not set 747# CONFIG_ROMFS_FS is not set
748CONFIG_INOTIFY=y
749CONFIG_INOTIFY_USER=y
465# CONFIG_QUOTA is not set 750# CONFIG_QUOTA is not set
751CONFIG_DNOTIFY=y
466# CONFIG_AUTOFS_FS is not set 752# CONFIG_AUTOFS_FS is not set
467# CONFIG_AUTOFS4_FS is not set 753# CONFIG_AUTOFS4_FS is not set
754# CONFIG_FUSE_FS is not set
468 755
469# 756#
470# CD-ROM/DVD Filesystems 757# CD-ROM/DVD Filesystems
@@ -475,7 +762,8 @@ CONFIG_FS_MBCACHE=y
475# 762#
476# DOS/FAT/NT Filesystems 763# DOS/FAT/NT Filesystems
477# 764#
478# CONFIG_FAT_FS is not set 765# CONFIG_MSDOS_FS is not set
766# CONFIG_VFAT_FS is not set
479# CONFIG_NTFS_FS is not set 767# CONFIG_NTFS_FS is not set
480 768
481# 769#
@@ -483,12 +771,13 @@ CONFIG_FS_MBCACHE=y
483# 771#
484CONFIG_PROC_FS=y 772CONFIG_PROC_FS=y
485CONFIG_PROC_KCORE=y 773CONFIG_PROC_KCORE=y
774CONFIG_PROC_SYSCTL=y
486CONFIG_SYSFS=y 775CONFIG_SYSFS=y
487# CONFIG_DEVFS_FS is not set
488# CONFIG_DEVPTS_FS_XATTR is not set
489CONFIG_TMPFS=y 776CONFIG_TMPFS=y
777# CONFIG_TMPFS_POSIX_ACL is not set
490# CONFIG_HUGETLB_PAGE is not set 778# CONFIG_HUGETLB_PAGE is not set
491CONFIG_RAMFS=y 779CONFIG_RAMFS=y
780# CONFIG_CONFIGFS_FS is not set
492 781
493# 782#
494# Miscellaneous filesystems 783# Miscellaneous filesystems
@@ -511,20 +800,26 @@ CONFIG_RAMFS=y
511# Network File Systems 800# Network File Systems
512# 801#
513CONFIG_NFS_FS=y 802CONFIG_NFS_FS=y
514# CONFIG_NFS_V3 is not set 803CONFIG_NFS_V3=y
515# CONFIG_NFS_V4 is not set 804CONFIG_NFS_V3_ACL=y
805CONFIG_NFS_V4=y
516# CONFIG_NFS_DIRECTIO is not set 806# CONFIG_NFS_DIRECTIO is not set
517# CONFIG_NFSD is not set 807# CONFIG_NFSD is not set
518CONFIG_ROOT_NFS=y 808CONFIG_ROOT_NFS=y
519CONFIG_LOCKD=y 809CONFIG_LOCKD=y
520# CONFIG_EXPORTFS is not set 810CONFIG_LOCKD_V4=y
811CONFIG_NFS_ACL_SUPPORT=y
812CONFIG_NFS_COMMON=y
521CONFIG_SUNRPC=y 813CONFIG_SUNRPC=y
522# CONFIG_RPCSEC_GSS_KRB5 is not set 814CONFIG_SUNRPC_GSS=y
815CONFIG_RPCSEC_GSS_KRB5=y
816# CONFIG_RPCSEC_GSS_SPKM3 is not set
523# CONFIG_SMB_FS is not set 817# CONFIG_SMB_FS is not set
524# CONFIG_CIFS is not set 818# CONFIG_CIFS is not set
525# CONFIG_NCP_FS is not set 819# CONFIG_NCP_FS is not set
526# CONFIG_CODA_FS is not set 820# CONFIG_CODA_FS is not set
527# CONFIG_AFS_FS is not set 821# CONFIG_AFS_FS is not set
822# CONFIG_9P_FS is not set
528 823
529# 824#
530# Partition Types 825# Partition Types
@@ -537,46 +832,99 @@ CONFIG_PARTITION_ADVANCED=y
537# CONFIG_MAC_PARTITION is not set 832# CONFIG_MAC_PARTITION is not set
538# CONFIG_MSDOS_PARTITION is not set 833# CONFIG_MSDOS_PARTITION is not set
539# CONFIG_LDM_PARTITION is not set 834# CONFIG_LDM_PARTITION is not set
540# CONFIG_NEC98_PARTITION is not set
541# CONFIG_SGI_PARTITION is not set 835# CONFIG_SGI_PARTITION is not set
542# CONFIG_ULTRIX_PARTITION is not set 836# CONFIG_ULTRIX_PARTITION is not set
543# CONFIG_SUN_PARTITION is not set 837# CONFIG_SUN_PARTITION is not set
838# CONFIG_KARMA_PARTITION is not set
544# CONFIG_EFI_PARTITION is not set 839# CONFIG_EFI_PARTITION is not set
545 840
546# 841#
547# Native Language Support 842# Native Language Support
548# 843#
549# CONFIG_NLS is not set 844# CONFIG_NLS is not set
845
846#
847# Distributed Lock Manager
848#
849# CONFIG_DLM is not set
550# CONFIG_SCC_ENET is not set 850# CONFIG_SCC_ENET is not set
551CONFIG_FEC_ENET=y 851# CONFIG_FEC_ENET is not set
552# CONFIG_USE_MDIO is not set
553 852
554# 853#
555# CPM2 Options 854# CPM2 Options
556# 855#
557CONFIG_SCC_CONSOLE=y
558CONFIG_FCC1_ENET=y
559# CONFIG_FCC2_ENET is not set
560# CONFIG_FCC3_ENET is not set
561 856
562# 857#
563# Library routines 858# Library routines
564# 859#
860# CONFIG_CRC_CCITT is not set
861# CONFIG_CRC16 is not set
565# CONFIG_CRC32 is not set 862# CONFIG_CRC32 is not set
566# CONFIG_LIBCRC32C is not set 863# CONFIG_LIBCRC32C is not set
864CONFIG_PLIST=y
865CONFIG_HAS_IOMEM=y
866CONFIG_HAS_IOPORT=y
867# CONFIG_PROFILING is not set
567 868
568# 869#
569# Kernel hacking 870# Kernel hacking
570# 871#
872# CONFIG_PRINTK_TIME is not set
873CONFIG_ENABLE_MUST_CHECK=y
874# CONFIG_MAGIC_SYSRQ is not set
875# CONFIG_UNUSED_SYMBOLS is not set
876# CONFIG_DEBUG_FS is not set
877# CONFIG_HEADERS_CHECK is not set
571# CONFIG_DEBUG_KERNEL is not set 878# CONFIG_DEBUG_KERNEL is not set
879CONFIG_LOG_BUF_SHIFT=14
880# CONFIG_DEBUG_BUGVERBOSE is not set
572# CONFIG_KGDB_CONSOLE is not set 881# CONFIG_KGDB_CONSOLE is not set
573 882
574# 883#
575# Security options 884# Security options
576# 885#
886# CONFIG_KEYS is not set
577# CONFIG_SECURITY is not set 887# CONFIG_SECURITY is not set
578 888
579# 889#
580# Cryptographic options 890# Cryptographic options
581# 891#
582# CONFIG_CRYPTO is not set 892CONFIG_CRYPTO=y
893CONFIG_CRYPTO_ALGAPI=y
894CONFIG_CRYPTO_BLKCIPHER=y
895CONFIG_CRYPTO_MANAGER=y
896# CONFIG_CRYPTO_HMAC is not set
897# CONFIG_CRYPTO_XCBC is not set
898# CONFIG_CRYPTO_NULL is not set
899# CONFIG_CRYPTO_MD4 is not set
900CONFIG_CRYPTO_MD5=y
901# CONFIG_CRYPTO_SHA1 is not set
902# CONFIG_CRYPTO_SHA256 is not set
903# CONFIG_CRYPTO_SHA512 is not set
904# CONFIG_CRYPTO_WP512 is not set
905# CONFIG_CRYPTO_TGR192 is not set
906# CONFIG_CRYPTO_GF128MUL is not set
907CONFIG_CRYPTO_ECB=y
908CONFIG_CRYPTO_CBC=y
909CONFIG_CRYPTO_PCBC=y
910# CONFIG_CRYPTO_LRW is not set
911CONFIG_CRYPTO_DES=y
912# CONFIG_CRYPTO_FCRYPT is not set
913# CONFIG_CRYPTO_BLOWFISH is not set
914# CONFIG_CRYPTO_TWOFISH is not set
915# CONFIG_CRYPTO_SERPENT is not set
916# CONFIG_CRYPTO_AES is not set
917# CONFIG_CRYPTO_CAST5 is not set
918# CONFIG_CRYPTO_CAST6 is not set
919# CONFIG_CRYPTO_TEA is not set
920# CONFIG_CRYPTO_ARC4 is not set
921# CONFIG_CRYPTO_KHAZAD is not set
922# CONFIG_CRYPTO_ANUBIS is not set
923# CONFIG_CRYPTO_DEFLATE is not set
924# CONFIG_CRYPTO_MICHAEL_MIC is not set
925# CONFIG_CRYPTO_CRC32C is not set
926# CONFIG_CRYPTO_CAMELLIA is not set
927
928#
929# Hardware crypto devices
930#
diff --git a/arch/ppc/platforms/mpc8272ads_setup.c b/arch/ppc/platforms/mpc8272ads_setup.c
index 0bc06768cf24..47f4b38edb5f 100644
--- a/arch/ppc/platforms/mpc8272ads_setup.c
+++ b/arch/ppc/platforms/mpc8272ads_setup.c
@@ -18,6 +18,7 @@
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/fs_enet_pd.h> 19#include <linux/fs_enet_pd.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/phy.h>
21 22
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/mpc8260.h> 24#include <asm/mpc8260.h>
@@ -30,10 +31,10 @@
30 31
31#include "pq2ads_pd.h" 32#include "pq2ads_pd.h"
32 33
33static void init_fcc1_ioports(void); 34static void init_fcc1_ioports(struct fs_platform_info*);
34static void init_fcc2_ioports(void); 35static void init_fcc2_ioports(struct fs_platform_info*);
35static void init_scc1_uart_ioports(void); 36static void init_scc1_uart_ioports(struct fs_uart_platform_info*);
36static void init_scc4_uart_ioports(void); 37static void init_scc4_uart_ioports(struct fs_uart_platform_info*);
37 38
38static struct fs_uart_platform_info mpc8272_uart_pdata[] = { 39static struct fs_uart_platform_info mpc8272_uart_pdata[] = {
39 [fsid_scc1_uart] = { 40 [fsid_scc1_uart] = {
@@ -103,7 +104,7 @@ static struct fs_platform_info mpc82xx_enet_pdata[] = {
103 }, 104 },
104}; 105};
105 106
106static void init_fcc1_ioports(struct fs_platform_info*) 107static void init_fcc1_ioports(struct fs_platform_info* pdata)
107{ 108{
108 struct io_port *io; 109 struct io_port *io;
109 u32 tempval; 110 u32 tempval;
@@ -144,7 +145,7 @@ static void init_fcc1_ioports(struct fs_platform_info*)
144 iounmap(immap); 145 iounmap(immap);
145} 146}
146 147
147static void init_fcc2_ioports(struct fs_platform_info*) 148static void init_fcc2_ioports(struct fs_platform_info* pdata)
148{ 149{
149 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t)); 150 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t));
150 u32 *bcsr = ioremap(BCSR_ADDR+12, sizeof(u32)); 151 u32 *bcsr = ioremap(BCSR_ADDR+12, sizeof(u32));
@@ -229,7 +230,7 @@ static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev,
229 } 230 }
230} 231}
231 232
232static void init_scc1_uart_ioports(struct fs_uart_platform_info*) 233static void init_scc1_uart_ioports(struct fs_uart_platform_info* pdata)
233{ 234{
234 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t)); 235 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t));
235 236
@@ -246,7 +247,7 @@ static void init_scc1_uart_ioports(struct fs_uart_platform_info*)
246 iounmap(immap); 247 iounmap(immap);
247} 248}
248 249
249static void init_scc4_uart_ioports(struct fs_uart_platform_info*) 250static void init_scc4_uart_ioports(struct fs_uart_platform_info* pdata)
250{ 251{
251 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t)); 252 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t));
252 253
diff --git a/arch/ppc/platforms/mpc866ads_setup.c b/arch/ppc/platforms/mpc866ads_setup.c
index 5b05d4bd0df7..7ce5364fdb3b 100644
--- a/arch/ppc/platforms/mpc866ads_setup.c
+++ b/arch/ppc/platforms/mpc866ads_setup.c
@@ -21,6 +21,7 @@
21#include <linux/fs_enet_pd.h> 21#include <linux/fs_enet_pd.h>
22#include <linux/fs_uart_pd.h> 22#include <linux/fs_uart_pd.h>
23#include <linux/mii.h> 23#include <linux/mii.h>
24#include <linux/phy.h>
24 25
25#include <asm/delay.h> 26#include <asm/delay.h>
26#include <asm/io.h> 27#include <asm/io.h>
@@ -37,10 +38,10 @@
37 38
38extern unsigned char __res[]; 39extern unsigned char __res[];
39 40
40static void setup_fec1_ioports(void); 41static void setup_fec1_ioports(struct fs_platform_info*);
41static void setup_scc1_ioports(void); 42static void setup_scc1_ioports(struct fs_platform_info*);
42static void setup_smc1_ioports(void); 43static void setup_smc1_ioports(struct fs_uart_platform_info*);
43static void setup_smc2_ioports(void); 44static void setup_smc2_ioports(struct fs_uart_platform_info*);
44 45
45static struct fs_mii_fec_platform_info mpc8xx_mdio_fec_pdata; 46static struct fs_mii_fec_platform_info mpc8xx_mdio_fec_pdata;
46 47
@@ -137,7 +138,7 @@ void __init board_init(void)
137 iounmap(bcsr_io); 138 iounmap(bcsr_io);
138} 139}
139 140
140static void setup_fec1_ioports(struct fs_platform_info*) 141static void setup_fec1_ioports(struct fs_platform_info* pdata)
141{ 142{
142 immap_t *immap = (immap_t *) IMAP_ADDR; 143 immap_t *immap = (immap_t *) IMAP_ADDR;
143 144
@@ -145,7 +146,7 @@ static void setup_fec1_ioports(struct fs_platform_info*)
145 setbits16(&immap->im_ioport.iop_pddir, 0x1fff); 146 setbits16(&immap->im_ioport.iop_pddir, 0x1fff);
146} 147}
147 148
148static void setup_scc1_ioports(struct fs_platform_info*) 149static void setup_scc1_ioports(struct fs_platform_info* pdata)
149{ 150{
150 immap_t *immap = (immap_t *) IMAP_ADDR; 151 immap_t *immap = (immap_t *) IMAP_ADDR;
151 unsigned *bcsr_io; 152 unsigned *bcsr_io;
@@ -194,7 +195,7 @@ static void setup_scc1_ioports(struct fs_platform_info*)
194 195
195} 196}
196 197
197static void setup_smc1_ioports(struct fs_uart_platform_info*) 198static void setup_smc1_ioports(struct fs_uart_platform_info* pdata)
198{ 199{
199 immap_t *immap = (immap_t *) IMAP_ADDR; 200 immap_t *immap = (immap_t *) IMAP_ADDR;
200 unsigned *bcsr_io; 201 unsigned *bcsr_io;
@@ -216,7 +217,7 @@ static void setup_smc1_ioports(struct fs_uart_platform_info*)
216 217
217} 218}
218 219
219static void setup_smc2_ioports(struct fs_uart_platform_info*) 220static void setup_smc2_ioports(struct fs_uart_platform_info* pdata)
220{ 221{
221 immap_t *immap = (immap_t *) IMAP_ADDR; 222 immap_t *immap = (immap_t *) IMAP_ADDR;
222 unsigned *bcsr_io; 223 unsigned *bcsr_io;
diff --git a/arch/ppc/platforms/mpc885ads_setup.c b/arch/ppc/platforms/mpc885ads_setup.c
index f8161f3557f5..87deaefd6c5b 100644
--- a/arch/ppc/platforms/mpc885ads_setup.c
+++ b/arch/ppc/platforms/mpc885ads_setup.c
@@ -35,13 +35,13 @@
35#include <asm/ppc_sys.h> 35#include <asm/ppc_sys.h>
36 36
37extern unsigned char __res[]; 37extern unsigned char __res[];
38static void setup_smc1_ioports(void); 38static void setup_smc1_ioports(struct fs_uart_platform_info*);
39static void setup_smc2_ioports(void); 39static void setup_smc2_ioports(struct fs_uart_platform_info*);
40 40
41static struct fs_mii_fec_platform_info mpc8xx_mdio_fec_pdata; 41static struct fs_mii_fec_platform_info mpc8xx_mdio_fec_pdata;
42static void setup_fec1_ioports(void); 42static void setup_fec1_ioports(struct fs_platform_info*);
43static void setup_fec2_ioports(void); 43static void setup_fec2_ioports(struct fs_platform_info*);
44static void setup_scc3_ioports(void); 44static void setup_scc3_ioports(struct fs_platform_info*);
45 45
46static struct fs_uart_platform_info mpc885_uart_pdata[] = { 46static struct fs_uart_platform_info mpc885_uart_pdata[] = {
47 [fsid_smc1_uart] = { 47 [fsid_smc1_uart] = {
@@ -161,7 +161,7 @@ void __init board_init(void)
161#endif 161#endif
162} 162}
163 163
164static void setup_fec1_ioports(struct fs_platform_info*) 164static void setup_fec1_ioports(struct fs_platform_info* pdata)
165{ 165{
166 immap_t *immap = (immap_t *) IMAP_ADDR; 166 immap_t *immap = (immap_t *) IMAP_ADDR;
167 167
@@ -181,7 +181,7 @@ static void setup_fec1_ioports(struct fs_platform_info*)
181 clrbits32(&immap->im_cpm.cp_cptr, 0x00000100); 181 clrbits32(&immap->im_cpm.cp_cptr, 0x00000100);
182} 182}
183 183
184static void setup_fec2_ioports(struct fs_platform_info*) 184static void setup_fec2_ioports(struct fs_platform_info* pdata)
185{ 185{
186 immap_t *immap = (immap_t *) IMAP_ADDR; 186 immap_t *immap = (immap_t *) IMAP_ADDR;
187 187
@@ -193,7 +193,7 @@ static void setup_fec2_ioports(struct fs_platform_info*)
193 clrbits32(&immap->im_cpm.cp_cptr, 0x00000080); 193 clrbits32(&immap->im_cpm.cp_cptr, 0x00000080);
194} 194}
195 195
196static void setup_scc3_ioports(struct fs_platform_info*) 196static void setup_scc3_ioports(struct fs_platform_info* pdata)
197{ 197{
198 immap_t *immap = (immap_t *) IMAP_ADDR; 198 immap_t *immap = (immap_t *) IMAP_ADDR;
199 unsigned *bcsr_io; 199 unsigned *bcsr_io;
@@ -315,7 +315,7 @@ static void __init mpc885ads_fixup_scc_enet_pdata(struct platform_device *pdev,
315 mpc885ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1); 315 mpc885ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1);
316} 316}
317 317
318static void setup_smc1_ioports(struct fs_uart_platform_info*) 318static void setup_smc1_ioports(struct fs_uart_platform_info* pdata)
319{ 319{
320 immap_t *immap = (immap_t *) IMAP_ADDR; 320 immap_t *immap = (immap_t *) IMAP_ADDR;
321 unsigned *bcsr_io; 321 unsigned *bcsr_io;
@@ -335,7 +335,7 @@ static void setup_smc1_ioports(struct fs_uart_platform_info*)
335 clrbits16(&immap->im_cpm.cp_pbodr, iobits); 335 clrbits16(&immap->im_cpm.cp_pbodr, iobits);
336} 336}
337 337
338static void setup_smc2_ioports(struct fs_uart_platform_info*) 338static void setup_smc2_ioports(struct fs_uart_platform_info* pdata)
339{ 339{
340 immap_t *immap = (immap_t *) IMAP_ADDR; 340 immap_t *immap = (immap_t *) IMAP_ADDR;
341 unsigned *bcsr_io; 341 unsigned *bcsr_io;
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 3fa5f95c4614..1c927c538b8b 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -601,7 +601,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
601/* 601/*
602 * Normally called from {do_}pci_scan_bus... 602 * Normally called from {do_}pci_scan_bus...
603 */ 603 */
604void __init pcibios_fixup_bus(struct pci_bus *bus) 604void __devinit pcibios_fixup_bus(struct pci_bus *bus)
605{ 605{
606 struct pci_dev *dev; 606 struct pci_dev *dev;
607 int i, has_io, has_mem; 607 int i, has_io, has_mem;
@@ -842,7 +842,7 @@ static void watchdog_reset() {
842/* 842/*
843 * Other archs parse arguments here. 843 * Other archs parse arguments here.
844 */ 844 */
845char * __init pcibios_setup(char *str) 845char * __devinit pcibios_setup(char *str)
846{ 846{
847 return str; 847 return str;
848} 848}
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index da6606f0cffc..f807172cab0e 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -910,7 +910,7 @@ asmlinkage long sunos_sysconf (int name)
910 ret = ARG_MAX; 910 ret = ARG_MAX;
911 break; 911 break;
912 case _SC_CHILD_MAX: 912 case _SC_CHILD_MAX:
913 ret = -1; /* no limit */ 913 ret = current->signal->rlim[RLIMIT_NPROC].rlim_cur;
914 break; 914 break;
915 case _SC_CLK_TCK: 915 case _SC_CLK_TCK:
916 ret = HZ; 916 ret = HZ;
@@ -919,7 +919,7 @@ asmlinkage long sunos_sysconf (int name)
919 ret = NGROUPS_MAX; 919 ret = NGROUPS_MAX;
920 break; 920 break;
921 case _SC_OPEN_MAX: 921 case _SC_OPEN_MAX:
922 ret = OPEN_MAX; 922 ret = current->signal->rlim[RLIMIT_NOFILE].rlim_cur;
923 break; 923 break;
924 case _SC_JOB_CONTROL: 924 case _SC_JOB_CONTROL:
925 ret = 1; /* yes, we do support job control */ 925 ret = 1; /* yes, we do support job control */
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 196b4b72482b..12109886bb1e 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -327,7 +327,7 @@ static int __init pcibios_init(void)
327 327
328subsys_initcall(pcibios_init); 328subsys_initcall(pcibios_init);
329 329
330void pcibios_fixup_bus(struct pci_bus *pbus) 330void __devinit pcibios_fixup_bus(struct pci_bus *pbus)
331{ 331{
332 struct pci_pbm_info *pbm = pbus->sysdata; 332 struct pci_pbm_info *pbm = pbus->sysdata;
333 333
@@ -405,7 +405,7 @@ void pcibios_bus_to_resource(struct pci_dev *pdev, struct resource *res,
405} 405}
406EXPORT_SYMBOL(pcibios_bus_to_resource); 406EXPORT_SYMBOL(pcibios_bus_to_resource);
407 407
408char * __init pcibios_setup(char *str) 408char * __devinit pcibios_setup(char *str)
409{ 409{
410 return str; 410 return str;
411} 411}
diff --git a/arch/sparc64/kernel/pci_iommu.c b/arch/sparc64/kernel/pci_iommu.c
index 2e7f1427088a..7aca0f33f885 100644
--- a/arch/sparc64/kernel/pci_iommu.c
+++ b/arch/sparc64/kernel/pci_iommu.c
@@ -64,7 +64,7 @@ static void __iommu_flushall(struct pci_iommu *iommu)
64#define IOPTE_IS_DUMMY(iommu, iopte) \ 64#define IOPTE_IS_DUMMY(iommu, iopte) \
65 ((iopte_val(*iopte) & IOPTE_PAGE) == (iommu)->dummy_page_pa) 65 ((iopte_val(*iopte) & IOPTE_PAGE) == (iommu)->dummy_page_pa)
66 66
67static void inline iopte_make_dummy(struct pci_iommu *iommu, iopte_t *iopte) 67static inline void iopte_make_dummy(struct pci_iommu *iommu, iopte_t *iopte)
68{ 68{
69 unsigned long val = iopte_val(*iopte); 69 unsigned long val = iopte_val(*iopte);
70 70
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
index 01d6d869ea2b..14f78fb5e890 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc64/kernel/sbus.c
@@ -24,48 +24,25 @@
24 24
25#include "iommu_common.h" 25#include "iommu_common.h"
26 26
27/* These should be allocated on an SMP_CACHE_BYTES
28 * aligned boundary for optimal performance.
29 *
30 * On SYSIO, using an 8K page size we have 1GB of SBUS
31 * DMA space mapped. We divide this space into equally
32 * sized clusters. We allocate a DMA mapping from the
33 * cluster that matches the order of the allocation, or
34 * if the order is greater than the number of clusters,
35 * we try to allocate from the last cluster.
36 */
37
38#define NCLUSTERS 8UL
39#define ONE_GIG (1UL * 1024UL * 1024UL * 1024UL)
40#define CLUSTER_SIZE (ONE_GIG / NCLUSTERS)
41#define CLUSTER_MASK (CLUSTER_SIZE - 1)
42#define CLUSTER_NPAGES (CLUSTER_SIZE >> IO_PAGE_SHIFT)
43#define MAP_BASE ((u32)0xc0000000) 27#define MAP_BASE ((u32)0xc0000000)
44 28
29struct sbus_iommu_arena {
30 unsigned long *map;
31 unsigned int hint;
32 unsigned int limit;
33};
34
45struct sbus_iommu { 35struct sbus_iommu {
46/*0x00*/spinlock_t lock; 36 spinlock_t lock;
47 37
48/*0x08*/iopte_t *page_table; 38 struct sbus_iommu_arena arena;
49/*0x10*/unsigned long strbuf_regs;
50/*0x18*/unsigned long iommu_regs;
51/*0x20*/unsigned long sbus_control_reg;
52 39
53/*0x28*/volatile unsigned long strbuf_flushflag; 40 iopte_t *page_table;
41 unsigned long strbuf_regs;
42 unsigned long iommu_regs;
43 unsigned long sbus_control_reg;
54 44
55 /* If NCLUSTERS is ever decresed to 4 or lower, 45 volatile unsigned long strbuf_flushflag;
56 * you must increase the size of the type of
57 * these counters. You have been duly warned. -DaveM
58 */
59/*0x30*/struct {
60 u16 next;
61 u16 flush;
62 } alloc_info[NCLUSTERS];
63
64 /* The lowest used consistent mapping entry. Since
65 * we allocate consistent maps out of cluster 0 this
66 * is relative to the beginning of closter 0.
67 */
68/*0x50*/u32 lowest_consistent_map;
69}; 46};
70 47
71/* Offsets from iommu_regs */ 48/* Offsets from iommu_regs */
@@ -91,19 +68,6 @@ static void __iommu_flushall(struct sbus_iommu *iommu)
91 tag += 8UL; 68 tag += 8UL;
92 } 69 }
93 upa_readq(iommu->sbus_control_reg); 70 upa_readq(iommu->sbus_control_reg);
94
95 for (entry = 0; entry < NCLUSTERS; entry++) {
96 iommu->alloc_info[entry].flush =
97 iommu->alloc_info[entry].next;
98 }
99}
100
101static void iommu_flush(struct sbus_iommu *iommu, u32 base, unsigned long npages)
102{
103 while (npages--)
104 upa_writeq(base + (npages << IO_PAGE_SHIFT),
105 iommu->iommu_regs + IOMMU_FLUSH);
106 upa_readq(iommu->sbus_control_reg);
107} 71}
108 72
109/* Offsets from strbuf_regs */ 73/* Offsets from strbuf_regs */
@@ -156,178 +120,115 @@ static void sbus_strbuf_flush(struct sbus_iommu *iommu, u32 base, unsigned long
156 base, npages); 120 base, npages);
157} 121}
158 122
159static iopte_t *alloc_streaming_cluster(struct sbus_iommu *iommu, unsigned long npages) 123/* Based largely upon the ppc64 iommu allocator. */
124static long sbus_arena_alloc(struct sbus_iommu *iommu, unsigned long npages)
160{ 125{
161 iopte_t *iopte, *limit, *first, *cluster; 126 struct sbus_iommu_arena *arena = &iommu->arena;
162 unsigned long cnum, ent, nent, flush_point, found; 127 unsigned long n, i, start, end, limit;
163 128 int pass;
164 cnum = 0; 129
165 nent = 1; 130 limit = arena->limit;
166 while ((1UL << cnum) < npages) 131 start = arena->hint;
167 cnum++; 132 pass = 0;
168 if(cnum >= NCLUSTERS) { 133
169 nent = 1UL << (cnum - NCLUSTERS); 134again:
170 cnum = NCLUSTERS - 1; 135 n = find_next_zero_bit(arena->map, limit, start);
171 } 136 end = n + npages;
172 iopte = iommu->page_table + (cnum * CLUSTER_NPAGES); 137 if (unlikely(end >= limit)) {
173 138 if (likely(pass < 1)) {
174 if (cnum == 0) 139 limit = start;
175 limit = (iommu->page_table + 140 start = 0;
176 iommu->lowest_consistent_map); 141 __iommu_flushall(iommu);
177 else 142 pass++;
178 limit = (iopte + CLUSTER_NPAGES); 143 goto again;
179
180 iopte += ((ent = iommu->alloc_info[cnum].next) << cnum);
181 flush_point = iommu->alloc_info[cnum].flush;
182
183 first = iopte;
184 cluster = NULL;
185 found = 0;
186 for (;;) {
187 if (iopte_val(*iopte) == 0UL) {
188 found++;
189 if (!cluster)
190 cluster = iopte;
191 } else { 144 } else {
192 /* Used cluster in the way */ 145 /* Scanned the whole thing, give up. */
193 cluster = NULL; 146 return -1;
194 found = 0;
195 } 147 }
148 }
196 149
197 if (found == nent) 150 for (i = n; i < end; i++) {
198 break; 151 if (test_bit(i, arena->map)) {
199 152 start = i + 1;
200 iopte += (1 << cnum); 153 goto again;
201 ent++;
202 if (iopte >= limit) {
203 iopte = (iommu->page_table + (cnum * CLUSTER_NPAGES));
204 ent = 0;
205
206 /* Multiple cluster allocations must not wrap */
207 cluster = NULL;
208 found = 0;
209 } 154 }
210 if (ent == flush_point)
211 __iommu_flushall(iommu);
212 if (iopte == first)
213 goto bad;
214 } 155 }
215 156
216 /* ent/iopte points to the last cluster entry we're going to use, 157 for (i = n; i < end; i++)
217 * so save our place for the next allocation. 158 __set_bit(i, arena->map);
218 */ 159
219 if ((iopte + (1 << cnum)) >= limit) 160 arena->hint = end;
220 ent = 0; 161
221 else 162 return n;
222 ent = ent + 1;
223 iommu->alloc_info[cnum].next = ent;
224 if (ent == flush_point)
225 __iommu_flushall(iommu);
226
227 /* I've got your streaming cluster right here buddy boy... */
228 return cluster;
229
230bad:
231 printk(KERN_EMERG "sbus: alloc_streaming_cluster of npages(%ld) failed!\n",
232 npages);
233 return NULL;
234} 163}
235 164
236static void free_streaming_cluster(struct sbus_iommu *iommu, u32 base, unsigned long npages) 165static void sbus_arena_free(struct sbus_iommu_arena *arena, unsigned long base, unsigned long npages)
237{ 166{
238 unsigned long cnum, ent, nent; 167 unsigned long i;
239 iopte_t *iopte;
240 168
241 cnum = 0; 169 for (i = base; i < (base + npages); i++)
242 nent = 1; 170 __clear_bit(i, arena->map);
243 while ((1UL << cnum) < npages)
244 cnum++;
245 if(cnum >= NCLUSTERS) {
246 nent = 1UL << (cnum - NCLUSTERS);
247 cnum = NCLUSTERS - 1;
248 }
249 ent = (base & CLUSTER_MASK) >> (IO_PAGE_SHIFT + cnum);
250 iopte = iommu->page_table + ((base - MAP_BASE) >> IO_PAGE_SHIFT);
251 do {
252 iopte_val(*iopte) = 0UL;
253 iopte += 1 << cnum;
254 } while(--nent);
255
256 /* If the global flush might not have caught this entry,
257 * adjust the flush point such that we will flush before
258 * ever trying to reuse it.
259 */
260#define between(X,Y,Z) (((Z) - (Y)) >= ((X) - (Y)))
261 if (between(ent, iommu->alloc_info[cnum].next, iommu->alloc_info[cnum].flush))
262 iommu->alloc_info[cnum].flush = ent;
263#undef between
264} 171}
265 172
266/* We allocate consistent mappings from the end of cluster zero. */ 173static void sbus_iommu_table_init(struct sbus_iommu *iommu, unsigned int tsbsize)
267static iopte_t *alloc_consistent_cluster(struct sbus_iommu *iommu, unsigned long npages)
268{ 174{
269 iopte_t *iopte; 175 unsigned long tsbbase, order, sz, num_tsb_entries;
270 176
271 iopte = iommu->page_table + (1 * CLUSTER_NPAGES); 177 num_tsb_entries = tsbsize / sizeof(iopte_t);
272 while (iopte > iommu->page_table) {
273 iopte--;
274 if (!(iopte_val(*iopte) & IOPTE_VALID)) {
275 unsigned long tmp = npages;
276 178
277 while (--tmp) { 179 /* Setup initial software IOMMU state. */
278 iopte--; 180 spin_lock_init(&iommu->lock);
279 if (iopte_val(*iopte) & IOPTE_VALID)
280 break;
281 }
282 if (tmp == 0) {
283 u32 entry = (iopte - iommu->page_table);
284 181
285 if (entry < iommu->lowest_consistent_map) 182 /* Allocate and initialize the free area map. */
286 iommu->lowest_consistent_map = entry; 183 sz = num_tsb_entries / 8;
287 return iopte; 184 sz = (sz + 7UL) & ~7UL;
288 } 185 iommu->arena.map = kzalloc(sz, GFP_KERNEL);
289 } 186 if (!iommu->arena.map) {
187 prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n");
188 prom_halt();
189 }
190 iommu->arena.limit = num_tsb_entries;
191
192 /* Now allocate and setup the IOMMU page table itself. */
193 order = get_order(tsbsize);
194 tsbbase = __get_free_pages(GFP_KERNEL, order);
195 if (!tsbbase) {
196 prom_printf("IOMMU: Error, gfp(tsb) failed.\n");
197 prom_halt();
290 } 198 }
291 return NULL; 199 iommu->page_table = (iopte_t *)tsbbase;
200 memset(iommu->page_table, 0, tsbsize);
292} 201}
293 202
294static void free_consistent_cluster(struct sbus_iommu *iommu, u32 base, unsigned long npages) 203static inline iopte_t *alloc_npages(struct sbus_iommu *iommu, unsigned long npages)
295{ 204{
296 iopte_t *iopte = iommu->page_table + ((base - MAP_BASE) >> IO_PAGE_SHIFT); 205 long entry;
297 206
298 if ((iopte - iommu->page_table) == iommu->lowest_consistent_map) { 207 entry = sbus_arena_alloc(iommu, npages);
299 iopte_t *walk = iopte + npages; 208 if (unlikely(entry < 0))
300 iopte_t *limit; 209 return NULL;
301 210
302 limit = iommu->page_table + CLUSTER_NPAGES; 211 return iommu->page_table + entry;
303 while (walk < limit) { 212}
304 if (iopte_val(*walk) != 0UL)
305 break;
306 walk++;
307 }
308 iommu->lowest_consistent_map =
309 (walk - iommu->page_table);
310 }
311 213
312 while (npages--) 214static inline void free_npages(struct sbus_iommu *iommu, dma_addr_t base, unsigned long npages)
313 *iopte++ = __iopte(0UL); 215{
216 sbus_arena_free(&iommu->arena, base >> IO_PAGE_SHIFT, npages);
314} 217}
315 218
316void *sbus_alloc_consistent(struct sbus_dev *sdev, size_t size, dma_addr_t *dvma_addr) 219void *sbus_alloc_consistent(struct sbus_dev *sdev, size_t size, dma_addr_t *dvma_addr)
317{ 220{
318 unsigned long order, first_page, flags;
319 struct sbus_iommu *iommu; 221 struct sbus_iommu *iommu;
320 iopte_t *iopte; 222 iopte_t *iopte;
223 unsigned long flags, order, first_page;
321 void *ret; 224 void *ret;
322 int npages; 225 int npages;
323 226
324 if (size <= 0 || sdev == NULL || dvma_addr == NULL)
325 return NULL;
326
327 size = IO_PAGE_ALIGN(size); 227 size = IO_PAGE_ALIGN(size);
328 order = get_order(size); 228 order = get_order(size);
329 if (order >= 10) 229 if (order >= 10)
330 return NULL; 230 return NULL;
231
331 first_page = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); 232 first_page = __get_free_pages(GFP_KERNEL|__GFP_COMP, order);
332 if (first_page == 0UL) 233 if (first_page == 0UL)
333 return NULL; 234 return NULL;
@@ -336,108 +237,121 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, size_t size, dma_addr_t *dvma
336 iommu = sdev->bus->iommu; 237 iommu = sdev->bus->iommu;
337 238
338 spin_lock_irqsave(&iommu->lock, flags); 239 spin_lock_irqsave(&iommu->lock, flags);
339 iopte = alloc_consistent_cluster(iommu, size >> IO_PAGE_SHIFT); 240 iopte = alloc_npages(iommu, size >> IO_PAGE_SHIFT);
340 if (iopte == NULL) { 241 spin_unlock_irqrestore(&iommu->lock, flags);
341 spin_unlock_irqrestore(&iommu->lock, flags); 242
243 if (unlikely(iopte == NULL)) {
342 free_pages(first_page, order); 244 free_pages(first_page, order);
343 return NULL; 245 return NULL;
344 } 246 }
345 247
346 /* Ok, we're committed at this point. */ 248 *dvma_addr = (MAP_BASE +
347 *dvma_addr = MAP_BASE + ((iopte - iommu->page_table) << IO_PAGE_SHIFT); 249 ((iopte - iommu->page_table) << IO_PAGE_SHIFT));
348 ret = (void *) first_page; 250 ret = (void *) first_page;
349 npages = size >> IO_PAGE_SHIFT; 251 npages = size >> IO_PAGE_SHIFT;
252 first_page = __pa(first_page);
350 while (npages--) { 253 while (npages--) {
351 *iopte++ = __iopte(IOPTE_VALID | IOPTE_CACHE | IOPTE_WRITE | 254 iopte_val(*iopte) = (IOPTE_VALID | IOPTE_CACHE |
352 (__pa(first_page) & IOPTE_PAGE)); 255 IOPTE_WRITE |
256 (first_page & IOPTE_PAGE));
257 iopte++;
353 first_page += IO_PAGE_SIZE; 258 first_page += IO_PAGE_SIZE;
354 } 259 }
355 iommu_flush(iommu, *dvma_addr, size >> IO_PAGE_SHIFT);
356 spin_unlock_irqrestore(&iommu->lock, flags);
357 260
358 return ret; 261 return ret;
359} 262}
360 263
361void sbus_free_consistent(struct sbus_dev *sdev, size_t size, void *cpu, dma_addr_t dvma) 264void sbus_free_consistent(struct sbus_dev *sdev, size_t size, void *cpu, dma_addr_t dvma)
362{ 265{
363 unsigned long order, npages;
364 struct sbus_iommu *iommu; 266 struct sbus_iommu *iommu;
365 267 iopte_t *iopte;
366 if (size <= 0 || sdev == NULL || cpu == NULL) 268 unsigned long flags, order, npages;
367 return;
368 269
369 npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT; 270 npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT;
370 iommu = sdev->bus->iommu; 271 iommu = sdev->bus->iommu;
272 iopte = iommu->page_table +
273 ((dvma - MAP_BASE) >> IO_PAGE_SHIFT);
274
275 spin_lock_irqsave(&iommu->lock, flags);
276
277 free_npages(iommu, dvma - MAP_BASE, npages);
371 278
372 spin_lock_irq(&iommu->lock); 279 spin_unlock_irqrestore(&iommu->lock, flags);
373 free_consistent_cluster(iommu, dvma, npages);
374 iommu_flush(iommu, dvma, npages);
375 spin_unlock_irq(&iommu->lock);
376 280
377 order = get_order(size); 281 order = get_order(size);
378 if (order < 10) 282 if (order < 10)
379 free_pages((unsigned long)cpu, order); 283 free_pages((unsigned long)cpu, order);
380} 284}
381 285
382dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t size, int dir) 286dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t sz, int direction)
383{ 287{
384 struct sbus_iommu *iommu = sdev->bus->iommu; 288 struct sbus_iommu *iommu;
385 unsigned long npages, pbase, flags; 289 iopte_t *base;
386 iopte_t *iopte; 290 unsigned long flags, npages, oaddr;
387 u32 dma_base, offset; 291 unsigned long i, base_paddr;
388 unsigned long iopte_bits; 292 u32 bus_addr, ret;
293 unsigned long iopte_protection;
294
295 iommu = sdev->bus->iommu;
389 296
390 if (dir == SBUS_DMA_NONE) 297 if (unlikely(direction == SBUS_DMA_NONE))
391 BUG(); 298 BUG();
392 299
393 pbase = (unsigned long) ptr; 300 oaddr = (unsigned long)ptr;
394 offset = (u32) (pbase & ~IO_PAGE_MASK); 301 npages = IO_PAGE_ALIGN(oaddr + sz) - (oaddr & IO_PAGE_MASK);
395 size = (IO_PAGE_ALIGN(pbase + size) - (pbase & IO_PAGE_MASK)); 302 npages >>= IO_PAGE_SHIFT;
396 pbase = (unsigned long) __pa(pbase & IO_PAGE_MASK);
397 303
398 spin_lock_irqsave(&iommu->lock, flags); 304 spin_lock_irqsave(&iommu->lock, flags);
399 npages = size >> IO_PAGE_SHIFT; 305 base = alloc_npages(iommu, npages);
400 iopte = alloc_streaming_cluster(iommu, npages);
401 if (iopte == NULL)
402 goto bad;
403 dma_base = MAP_BASE + ((iopte - iommu->page_table) << IO_PAGE_SHIFT);
404 npages = size >> IO_PAGE_SHIFT;
405 iopte_bits = IOPTE_VALID | IOPTE_STBUF | IOPTE_CACHE;
406 if (dir != SBUS_DMA_TODEVICE)
407 iopte_bits |= IOPTE_WRITE;
408 while (npages--) {
409 *iopte++ = __iopte(iopte_bits | (pbase & IOPTE_PAGE));
410 pbase += IO_PAGE_SIZE;
411 }
412 npages = size >> IO_PAGE_SHIFT;
413 spin_unlock_irqrestore(&iommu->lock, flags); 306 spin_unlock_irqrestore(&iommu->lock, flags);
414 307
415 return (dma_base | offset); 308 if (unlikely(!base))
309 BUG();
416 310
417bad: 311 bus_addr = (MAP_BASE +
418 spin_unlock_irqrestore(&iommu->lock, flags); 312 ((base - iommu->page_table) << IO_PAGE_SHIFT));
419 BUG(); 313 ret = bus_addr | (oaddr & ~IO_PAGE_MASK);
420 return 0; 314 base_paddr = __pa(oaddr & IO_PAGE_MASK);
315
316 iopte_protection = IOPTE_VALID | IOPTE_STBUF | IOPTE_CACHE;
317 if (direction != SBUS_DMA_TODEVICE)
318 iopte_protection |= IOPTE_WRITE;
319
320 for (i = 0; i < npages; i++, base++, base_paddr += IO_PAGE_SIZE)
321 iopte_val(*base) = iopte_protection | base_paddr;
322
323 return ret;
421} 324}
422 325
423void sbus_unmap_single(struct sbus_dev *sdev, dma_addr_t dma_addr, size_t size, int direction) 326void sbus_unmap_single(struct sbus_dev *sdev, dma_addr_t bus_addr, size_t sz, int direction)
424{ 327{
425 struct sbus_iommu *iommu = sdev->bus->iommu; 328 struct sbus_iommu *iommu = sdev->bus->iommu;
426 u32 dma_base = dma_addr & IO_PAGE_MASK; 329 iopte_t *base;
427 unsigned long flags; 330 unsigned long flags, npages, i;
331
332 if (unlikely(direction == SBUS_DMA_NONE))
333 BUG();
334
335 npages = IO_PAGE_ALIGN(bus_addr + sz) - (bus_addr & IO_PAGE_MASK);
336 npages >>= IO_PAGE_SHIFT;
337 base = iommu->page_table +
338 ((bus_addr - MAP_BASE) >> IO_PAGE_SHIFT);
428 339
429 size = (IO_PAGE_ALIGN(dma_addr + size) - dma_base); 340 bus_addr &= IO_PAGE_MASK;
430 341
431 spin_lock_irqsave(&iommu->lock, flags); 342 spin_lock_irqsave(&iommu->lock, flags);
432 free_streaming_cluster(iommu, dma_base, size >> IO_PAGE_SHIFT); 343 sbus_strbuf_flush(iommu, bus_addr, npages, direction);
433 sbus_strbuf_flush(iommu, dma_base, size >> IO_PAGE_SHIFT, direction); 344 for (i = 0; i < npages; i++)
345 iopte_val(base[i]) = 0UL;
346 free_npages(iommu, bus_addr - MAP_BASE, npages);
434 spin_unlock_irqrestore(&iommu->lock, flags); 347 spin_unlock_irqrestore(&iommu->lock, flags);
435} 348}
436 349
437#define SG_ENT_PHYS_ADDRESS(SG) \ 350#define SG_ENT_PHYS_ADDRESS(SG) \
438 (__pa(page_address((SG)->page)) + (SG)->offset) 351 (__pa(page_address((SG)->page)) + (SG)->offset)
439 352
440static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg, int nused, int nelems, unsigned long iopte_bits) 353static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg,
354 int nused, int nelems, unsigned long iopte_protection)
441{ 355{
442 struct scatterlist *dma_sg = sg; 356 struct scatterlist *dma_sg = sg;
443 struct scatterlist *sg_end = sg + nelems; 357 struct scatterlist *sg_end = sg + nelems;
@@ -462,7 +376,7 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg, int nused, in
462 for (;;) { 376 for (;;) {
463 unsigned long tmp; 377 unsigned long tmp;
464 378
465 tmp = (unsigned long) SG_ENT_PHYS_ADDRESS(sg); 379 tmp = SG_ENT_PHYS_ADDRESS(sg);
466 len = sg->length; 380 len = sg->length;
467 if (((tmp ^ pteval) >> IO_PAGE_SHIFT) != 0UL) { 381 if (((tmp ^ pteval) >> IO_PAGE_SHIFT) != 0UL) {
468 pteval = tmp & IO_PAGE_MASK; 382 pteval = tmp & IO_PAGE_MASK;
@@ -478,7 +392,7 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg, int nused, in
478 sg++; 392 sg++;
479 } 393 }
480 394
481 pteval = ((pteval & IOPTE_PAGE) | iopte_bits); 395 pteval = iopte_protection | (pteval & IOPTE_PAGE);
482 while (len > 0) { 396 while (len > 0) {
483 *iopte++ = __iopte(pteval); 397 *iopte++ = __iopte(pteval);
484 pteval += IO_PAGE_SIZE; 398 pteval += IO_PAGE_SIZE;
@@ -509,103 +423,111 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg, int nused, in
509 } 423 }
510} 424}
511 425
512int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, int nents, int dir) 426int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sglist, int nelems, int direction)
513{ 427{
514 struct sbus_iommu *iommu = sdev->bus->iommu; 428 struct sbus_iommu *iommu;
515 unsigned long flags, npages; 429 unsigned long flags, npages, iopte_protection;
516 iopte_t *iopte; 430 iopte_t *base;
517 u32 dma_base; 431 u32 dma_base;
518 struct scatterlist *sgtmp; 432 struct scatterlist *sgtmp;
519 int used; 433 int used;
520 unsigned long iopte_bits;
521
522 if (dir == SBUS_DMA_NONE)
523 BUG();
524 434
525 /* Fast path single entry scatterlists. */ 435 /* Fast path single entry scatterlists. */
526 if (nents == 1) { 436 if (nelems == 1) {
527 sg->dma_address = 437 sglist->dma_address =
528 sbus_map_single(sdev, 438 sbus_map_single(sdev,
529 (page_address(sg->page) + sg->offset), 439 (page_address(sglist->page) + sglist->offset),
530 sg->length, dir); 440 sglist->length, direction);
531 sg->dma_length = sg->length; 441 sglist->dma_length = sglist->length;
532 return 1; 442 return 1;
533 } 443 }
534 444
535 npages = prepare_sg(sg, nents); 445 iommu = sdev->bus->iommu;
446
447 if (unlikely(direction == SBUS_DMA_NONE))
448 BUG();
449
450 npages = prepare_sg(sglist, nelems);
536 451
537 spin_lock_irqsave(&iommu->lock, flags); 452 spin_lock_irqsave(&iommu->lock, flags);
538 iopte = alloc_streaming_cluster(iommu, npages); 453 base = alloc_npages(iommu, npages);
539 if (iopte == NULL) 454 spin_unlock_irqrestore(&iommu->lock, flags);
540 goto bad; 455
541 dma_base = MAP_BASE + ((iopte - iommu->page_table) << IO_PAGE_SHIFT); 456 if (unlikely(base == NULL))
457 BUG();
458
459 dma_base = MAP_BASE +
460 ((base - iommu->page_table) << IO_PAGE_SHIFT);
542 461
543 /* Normalize DVMA addresses. */ 462 /* Normalize DVMA addresses. */
544 sgtmp = sg; 463 used = nelems;
545 used = nents;
546 464
465 sgtmp = sglist;
547 while (used && sgtmp->dma_length) { 466 while (used && sgtmp->dma_length) {
548 sgtmp->dma_address += dma_base; 467 sgtmp->dma_address += dma_base;
549 sgtmp++; 468 sgtmp++;
550 used--; 469 used--;
551 } 470 }
552 used = nents - used; 471 used = nelems - used;
553 472
554 iopte_bits = IOPTE_VALID | IOPTE_STBUF | IOPTE_CACHE; 473 iopte_protection = IOPTE_VALID | IOPTE_STBUF | IOPTE_CACHE;
555 if (dir != SBUS_DMA_TODEVICE) 474 if (direction != SBUS_DMA_TODEVICE)
556 iopte_bits |= IOPTE_WRITE; 475 iopte_protection |= IOPTE_WRITE;
476
477 fill_sg(base, sglist, used, nelems, iopte_protection);
557 478
558 fill_sg(iopte, sg, used, nents, iopte_bits);
559#ifdef VERIFY_SG 479#ifdef VERIFY_SG
560 verify_sglist(sg, nents, iopte, npages); 480 verify_sglist(sglist, nelems, base, npages);
561#endif 481#endif
562 spin_unlock_irqrestore(&iommu->lock, flags);
563 482
564 return used; 483 return used;
565
566bad:
567 spin_unlock_irqrestore(&iommu->lock, flags);
568 BUG();
569 return 0;
570} 484}
571 485
572void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, int nents, int direction) 486void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sglist, int nelems, int direction)
573{ 487{
574 unsigned long size, flags;
575 struct sbus_iommu *iommu; 488 struct sbus_iommu *iommu;
576 u32 dvma_base; 489 iopte_t *base;
577 int i; 490 unsigned long flags, i, npages;
491 u32 bus_addr;
578 492
579 /* Fast path single entry scatterlists. */ 493 if (unlikely(direction == SBUS_DMA_NONE))
580 if (nents == 1) { 494 BUG();
581 sbus_unmap_single(sdev, sg->dma_address, sg->dma_length, direction); 495
582 return; 496 iommu = sdev->bus->iommu;
583 } 497
498 bus_addr = sglist->dma_address & IO_PAGE_MASK;
584 499
585 dvma_base = sg[0].dma_address & IO_PAGE_MASK; 500 for (i = 1; i < nelems; i++)
586 for (i = 0; i < nents; i++) { 501 if (sglist[i].dma_length == 0)
587 if (sg[i].dma_length == 0)
588 break; 502 break;
589 }
590 i--; 503 i--;
591 size = IO_PAGE_ALIGN(sg[i].dma_address + sg[i].dma_length) - dvma_base; 504 npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) -
505 bus_addr) >> IO_PAGE_SHIFT;
506
507 base = iommu->page_table +
508 ((bus_addr - MAP_BASE) >> IO_PAGE_SHIFT);
592 509
593 iommu = sdev->bus->iommu;
594 spin_lock_irqsave(&iommu->lock, flags); 510 spin_lock_irqsave(&iommu->lock, flags);
595 free_streaming_cluster(iommu, dvma_base, size >> IO_PAGE_SHIFT); 511 sbus_strbuf_flush(iommu, bus_addr, npages, direction);
596 sbus_strbuf_flush(iommu, dvma_base, size >> IO_PAGE_SHIFT, direction); 512 for (i = 0; i < npages; i++)
513 iopte_val(base[i]) = 0UL;
514 free_npages(iommu, bus_addr - MAP_BASE, npages);
597 spin_unlock_irqrestore(&iommu->lock, flags); 515 spin_unlock_irqrestore(&iommu->lock, flags);
598} 516}
599 517
600void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, dma_addr_t base, size_t size, int direction) 518void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, dma_addr_t bus_addr, size_t sz, int direction)
601{ 519{
602 struct sbus_iommu *iommu = sdev->bus->iommu; 520 struct sbus_iommu *iommu;
603 unsigned long flags; 521 unsigned long flags, npages;
522
523 iommu = sdev->bus->iommu;
604 524
605 size = (IO_PAGE_ALIGN(base + size) - (base & IO_PAGE_MASK)); 525 npages = IO_PAGE_ALIGN(bus_addr + sz) - (bus_addr & IO_PAGE_MASK);
526 npages >>= IO_PAGE_SHIFT;
527 bus_addr &= IO_PAGE_MASK;
606 528
607 spin_lock_irqsave(&iommu->lock, flags); 529 spin_lock_irqsave(&iommu->lock, flags);
608 sbus_strbuf_flush(iommu, base & IO_PAGE_MASK, size >> IO_PAGE_SHIFT, direction); 530 sbus_strbuf_flush(iommu, bus_addr, npages, direction);
609 spin_unlock_irqrestore(&iommu->lock, flags); 531 spin_unlock_irqrestore(&iommu->lock, flags);
610} 532}
611 533
@@ -613,23 +535,25 @@ void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, dma_addr_t base, siz
613{ 535{
614} 536}
615 537
616void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, struct scatterlist *sg, int nents, int direction) 538void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, struct scatterlist *sglist, int nelems, int direction)
617{ 539{
618 struct sbus_iommu *iommu = sdev->bus->iommu; 540 struct sbus_iommu *iommu;
619 unsigned long flags, size; 541 unsigned long flags, npages, i;
620 u32 base; 542 u32 bus_addr;
621 int i; 543
544 iommu = sdev->bus->iommu;
622 545
623 base = sg[0].dma_address & IO_PAGE_MASK; 546 bus_addr = sglist[0].dma_address & IO_PAGE_MASK;
624 for (i = 0; i < nents; i++) { 547 for (i = 0; i < nelems; i++) {
625 if (sg[i].dma_length == 0) 548 if (!sglist[i].dma_length)
626 break; 549 break;
627 } 550 }
628 i--; 551 i--;
629 size = IO_PAGE_ALIGN(sg[i].dma_address + sg[i].dma_length) - base; 552 npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length)
553 - bus_addr) >> IO_PAGE_SHIFT;
630 554
631 spin_lock_irqsave(&iommu->lock, flags); 555 spin_lock_irqsave(&iommu->lock, flags);
632 sbus_strbuf_flush(iommu, base, size >> IO_PAGE_SHIFT, direction); 556 sbus_strbuf_flush(iommu, bus_addr, npages, direction);
633 spin_unlock_irqrestore(&iommu->lock, flags); 557 spin_unlock_irqrestore(&iommu->lock, flags);
634} 558}
635 559
@@ -1104,7 +1028,7 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
1104 struct linux_prom64_registers *pr; 1028 struct linux_prom64_registers *pr;
1105 struct device_node *dp; 1029 struct device_node *dp;
1106 struct sbus_iommu *iommu; 1030 struct sbus_iommu *iommu;
1107 unsigned long regs, tsb_base; 1031 unsigned long regs;
1108 u64 control; 1032 u64 control;
1109 int i; 1033 int i;
1110 1034
@@ -1132,14 +1056,6 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
1132 1056
1133 memset(iommu, 0, sizeof(*iommu)); 1057 memset(iommu, 0, sizeof(*iommu));
1134 1058
1135 /* We start with no consistent mappings. */
1136 iommu->lowest_consistent_map = CLUSTER_NPAGES;
1137
1138 for (i = 0; i < NCLUSTERS; i++) {
1139 iommu->alloc_info[i].flush = 0;
1140 iommu->alloc_info[i].next = 0;
1141 }
1142
1143 /* Setup spinlock. */ 1059 /* Setup spinlock. */
1144 spin_lock_init(&iommu->lock); 1060 spin_lock_init(&iommu->lock);
1145 1061
@@ -1159,25 +1075,13 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
1159 sbus->portid, regs); 1075 sbus->portid, regs);
1160 1076
1161 /* Setup for TSB_SIZE=7, TBW_SIZE=0, MMU_DE=1, MMU_EN=1 */ 1077 /* Setup for TSB_SIZE=7, TBW_SIZE=0, MMU_DE=1, MMU_EN=1 */
1078 sbus_iommu_table_init(iommu, IO_TSB_SIZE);
1079
1162 control = upa_readq(iommu->iommu_regs + IOMMU_CONTROL); 1080 control = upa_readq(iommu->iommu_regs + IOMMU_CONTROL);
1163 control = ((7UL << 16UL) | 1081 control = ((7UL << 16UL) |
1164 (0UL << 2UL) | 1082 (0UL << 2UL) |
1165 (1UL << 1UL) | 1083 (1UL << 1UL) |
1166 (1UL << 0UL)); 1084 (1UL << 0UL));
1167
1168 /* Using the above configuration we need 1MB iommu page
1169 * table (128K ioptes * 8 bytes per iopte). This is
1170 * page order 7 on UltraSparc.
1171 */
1172 tsb_base = __get_free_pages(GFP_ATOMIC, get_order(IO_TSB_SIZE));
1173 if (tsb_base == 0UL) {
1174 prom_printf("sbus_iommu_init: Fatal error, cannot alloc TSB table.\n");
1175 prom_halt();
1176 }
1177
1178 iommu->page_table = (iopte_t *) tsb_base;
1179 memset(iommu->page_table, 0, IO_TSB_SIZE);
1180
1181 upa_writeq(control, iommu->iommu_regs + IOMMU_CONTROL); 1085 upa_writeq(control, iommu->iommu_regs + IOMMU_CONTROL);
1182 1086
1183 /* Clean out any cruft in the IOMMU using 1087 /* Clean out any cruft in the IOMMU using
@@ -1195,7 +1099,7 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
1195 upa_readq(iommu->sbus_control_reg); 1099 upa_readq(iommu->sbus_control_reg);
1196 1100
1197 /* Give the TSB to SYSIO. */ 1101 /* Give the TSB to SYSIO. */
1198 upa_writeq(__pa(tsb_base), iommu->iommu_regs + IOMMU_TSBBASE); 1102 upa_writeq(__pa(iommu->page_table), iommu->iommu_regs + IOMMU_TSBBASE);
1199 1103
1200 /* Setup streaming buffer, DE=1 SB_EN=1 */ 1104 /* Setup streaming buffer, DE=1 SB_EN=1 */
1201 control = (1UL << 1UL) | (1UL << 0UL); 1105 control = (1UL << 1UL) | (1UL << 0UL);
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S
index c09ab4b9431d..010a737908ee 100644
--- a/arch/sparc64/kernel/sys32.S
+++ b/arch/sparc64/kernel/sys32.S
@@ -91,7 +91,6 @@ SIGN1(sys32_select, compat_sys_select, %o0)
91SIGN1(sys32_mkdir, sys_mkdir, %o1) 91SIGN1(sys32_mkdir, sys_mkdir, %o1)
92SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) 92SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5)
93SIGN1(sys32_sysfs, compat_sys_sysfs, %o0) 93SIGN1(sys32_sysfs, compat_sys_sysfs, %o0)
94SIGN3(sys32_ipc, compat_sys_ipc, %o1, %o2, %o3)
95SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1) 94SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1)
96SIGN2(sys32_sendfile64, compat_sys_sendfile64, %o0, %o1) 95SIGN2(sys32_sendfile64, compat_sys_sendfile64, %o0, %o1)
97SIGN1(sys32_prctl, sys_prctl, %o0) 96SIGN1(sys32_prctl, sys_prctl, %o0)
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index 4cff95b7b3a4..8f7a06e2c7e7 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -871,7 +871,7 @@ asmlinkage s32 sunos_sysconf (int name)
871 ret = ARG_MAX; 871 ret = ARG_MAX;
872 break; 872 break;
873 case _SC_CHILD_MAX: 873 case _SC_CHILD_MAX:
874 ret = -1; /* no limit */ 874 ret = current->signal->rlim[RLIMIT_NPROC].rlim_cur;
875 break; 875 break;
876 case _SC_CLK_TCK: 876 case _SC_CLK_TCK:
877 ret = HZ; 877 ret = HZ;
@@ -880,7 +880,7 @@ asmlinkage s32 sunos_sysconf (int name)
880 ret = NGROUPS_MAX; 880 ret = NGROUPS_MAX;
881 break; 881 break;
882 case _SC_OPEN_MAX: 882 case _SC_OPEN_MAX:
883 ret = OPEN_MAX; 883 ret = current->signal->rlim[RLIMIT_NOFILE].rlim_cur;
884 break; 884 break;
885 case _SC_JOB_CONTROL: 885 case _SC_JOB_CONTROL:
886 ret = 1; /* yes, we do support job control */ 886 ret = 1; /* yes, we do support job control */
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index aaeb5e06735c..48c36fe6dc62 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -62,7 +62,7 @@ sys_call_table32:
62/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir 62/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
63 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64 63 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
64/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, compat_sys_sysinfo 64/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, compat_sys_sysinfo
65 .word sys32_ipc, sys32_sigreturn, sys_clone, sys32_ioprio_get, compat_sys_adjtimex 65 .word compat_sys_ipc, sys32_sigreturn, sys_clone, sys32_ioprio_get, compat_sys_adjtimex
66/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid 66/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid
67 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16 67 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
68/*230*/ .word sys32_select, compat_sys_time, sys32_splice, compat_sys_stime, compat_sys_statfs64 68/*230*/ .word sys32_select, compat_sys_time, sys32_splice, compat_sys_stime, compat_sys_statfs64
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
index bca16e8c95c3..9fcaad6dd11f 100644
--- a/arch/sparc64/solaris/misc.c
+++ b/arch/sparc64/solaris/misc.c
@@ -363,8 +363,10 @@ asmlinkage int solaris_sysconf(int id)
363{ 363{
364 switch (id) { 364 switch (id) {
365 case SOLARIS_CONFIG_NGROUPS: return NGROUPS_MAX; 365 case SOLARIS_CONFIG_NGROUPS: return NGROUPS_MAX;
366 case SOLARIS_CONFIG_CHILD_MAX: return -1; /* no limit */ 366 case SOLARIS_CONFIG_CHILD_MAX:
367 case SOLARIS_CONFIG_OPEN_FILES: return OPEN_MAX; 367 return current->signal->rlim[RLIMIT_NPROC].rlim_cur;
368 case SOLARIS_CONFIG_OPEN_FILES:
369 return current->signal->rlim[RLIMIT_NOFILE].rlim_cur;
368 case SOLARIS_CONFIG_POSIX_VER: return 199309; 370 case SOLARIS_CONFIG_POSIX_VER: return 199309;
369 case SOLARIS_CONFIG_PAGESIZE: return PAGE_SIZE; 371 case SOLARIS_CONFIG_PAGESIZE: return PAGE_SIZE;
370 case SOLARIS_CONFIG_XOPEN_VER: return 3; 372 case SOLARIS_CONFIG_XOPEN_VER: return 3;
diff --git a/arch/x86_64/kernel/functionlist b/arch/x86_64/kernel/functionlist
index 01fa23580c85..7ae18ec12454 100644
--- a/arch/x86_64/kernel/functionlist
+++ b/arch/x86_64/kernel/functionlist
@@ -514,7 +514,6 @@
514*(.text.dentry_open) 514*(.text.dentry_open)
515*(.text.dentry_iput) 515*(.text.dentry_iput)
516*(.text.bio_alloc) 516*(.text.bio_alloc)
517*(.text.alloc_skb_from_cache)
518*(.text.wait_on_page_bit) 517*(.text.wait_on_page_bit)
519*(.text.vfs_readdir) 518*(.text.vfs_readdir)
520*(.text.vfs_lstat) 519*(.text.vfs_lstat)
diff --git a/arch/x86_64/kernel/hpet.c b/arch/x86_64/kernel/hpet.c
index 8cf0b8a13778..b8286968662d 100644
--- a/arch/x86_64/kernel/hpet.c
+++ b/arch/x86_64/kernel/hpet.c
@@ -191,6 +191,7 @@ int hpet_reenable(void)
191 191
192#define TICK_COUNT 100000000 192#define TICK_COUNT 100000000
193#define TICK_MIN 5000 193#define TICK_MIN 5000
194#define MAX_TRIES 5
194 195
195/* 196/*
196 * Some platforms take periodic SMI interrupts with 5ms duration. Make sure none 197 * Some platforms take periodic SMI interrupts with 5ms duration. Make sure none
@@ -198,13 +199,15 @@ int hpet_reenable(void)
198 */ 199 */
199static void __init read_hpet_tsc(int *hpet, int *tsc) 200static void __init read_hpet_tsc(int *hpet, int *tsc)
200{ 201{
201 int tsc1, tsc2, hpet1; 202 int tsc1, tsc2, hpet1, i;
202 203
203 do { 204 for (i = 0; i < MAX_TRIES; i++) {
204 tsc1 = get_cycles_sync(); 205 tsc1 = get_cycles_sync();
205 hpet1 = hpet_readl(HPET_COUNTER); 206 hpet1 = hpet_readl(HPET_COUNTER);
206 tsc2 = get_cycles_sync(); 207 tsc2 = get_cycles_sync();
207 } while (tsc2 - tsc1 > TICK_MIN); 208 if (tsc2 - tsc1 > TICK_MIN)
209 break;
210 }
208 *hpet = hpet1; 211 *hpet = hpet1;
209 *tsc = tsc2; 212 *tsc = tsc2;
210} 213}
diff --git a/arch/x86_64/kernel/k8.c b/arch/x86_64/kernel/k8.c
index 6416682d33d0..bc11b32e8b4d 100644
--- a/arch/x86_64/kernel/k8.c
+++ b/arch/x86_64/kernel/k8.c
@@ -61,8 +61,8 @@ int cache_k8_northbridges(void)
61 dev = NULL; 61 dev = NULL;
62 i = 0; 62 i = 0;
63 while ((dev = next_k8_northbridge(dev)) != NULL) { 63 while ((dev = next_k8_northbridge(dev)) != NULL) {
64 k8_northbridges[i++] = dev; 64 k8_northbridges[i] = dev;
65 pci_read_config_dword(dev, 0x9c, &flush_words[i]); 65 pci_read_config_dword(dev, 0x9c, &flush_words[i++]);
66 } 66 }
67 k8_northbridges[i] = NULL; 67 k8_northbridges[i] = NULL;
68 return 0; 68 return 0;
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index a90996c27dc8..dfab9f167366 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -39,15 +39,17 @@ int panic_on_unrecovered_nmi;
39 * different subsystems this reservation system just tries to coordinate 39 * different subsystems this reservation system just tries to coordinate
40 * things a little 40 * things a little
41 */ 41 */
42static DEFINE_PER_CPU(unsigned, perfctr_nmi_owner);
43static DEFINE_PER_CPU(unsigned, evntsel_nmi_owner[2]);
44
45static cpumask_t backtrace_mask = CPU_MASK_NONE;
46 42
47/* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's 43/* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's
48 * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) 44 * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now)
49 */ 45 */
50#define NMI_MAX_COUNTER_BITS 66 46#define NMI_MAX_COUNTER_BITS 66
47#define NMI_MAX_COUNTER_LONGS BITS_TO_LONGS(NMI_MAX_COUNTER_BITS)
48
49static DEFINE_PER_CPU(unsigned, perfctr_nmi_owner[NMI_MAX_COUNTER_LONGS]);
50static DEFINE_PER_CPU(unsigned, evntsel_nmi_owner[NMI_MAX_COUNTER_LONGS]);
51
52static cpumask_t backtrace_mask = CPU_MASK_NONE;
51 53
52/* nmi_active: 54/* nmi_active:
53 * >0: the lapic NMI watchdog is active, but can be disabled 55 * >0: the lapic NMI watchdog is active, but can be disabled
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 2bac8c60ad61..0bae862e9a55 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -519,7 +519,11 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
519 gatt_size = (aper_size >> PAGE_SHIFT) * sizeof(u32); 519 gatt_size = (aper_size >> PAGE_SHIFT) * sizeof(u32);
520 gatt = (void *)__get_free_pages(GFP_KERNEL, get_order(gatt_size)); 520 gatt = (void *)__get_free_pages(GFP_KERNEL, get_order(gatt_size));
521 if (!gatt) 521 if (!gatt)
522 panic("Cannot allocate GATT table"); 522 panic("Cannot allocate GATT table");
523 if (change_page_attr_addr((unsigned long)gatt, gatt_size >> PAGE_SHIFT, PAGE_KERNEL_NOCACHE))
524 panic("Could not set GART PTEs to uncacheable pages");
525 global_flush_tlb();
526
523 memset(gatt, 0, gatt_size); 527 memset(gatt, 0, gatt_size);
524 agp_gatt_table = gatt; 528 agp_gatt_table = gatt;
525 529
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index b73212c0a550..5176ecf006ee 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -13,7 +13,7 @@ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
13OUTPUT_ARCH(i386:x86-64) 13OUTPUT_ARCH(i386:x86-64)
14ENTRY(phys_startup_64) 14ENTRY(phys_startup_64)
15jiffies_64 = jiffies; 15jiffies_64 = jiffies;
16_proxy_pda = 0; 16_proxy_pda = 1;
17PHDRS { 17PHDRS {
18 text PT_LOAD FLAGS(5); /* R_E */ 18 text PT_LOAD FLAGS(5); /* R_E */
19 data PT_LOAD FLAGS(7); /* RWE */ 19 data PT_LOAD FLAGS(7); /* RWE */
diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
index 65c5eaa59905..081409aa3452 100644
--- a/arch/x86_64/mm/pageattr.c
+++ b/arch/x86_64/mm/pageattr.c
@@ -81,8 +81,8 @@ static void flush_kernel_map(void *arg)
81 void *adr = page_address(pg); 81 void *adr = page_address(pg);
82 if (cpu_has_clflush) 82 if (cpu_has_clflush)
83 cache_flush_page(adr); 83 cache_flush_page(adr);
84 __flush_tlb_one(adr);
85 } 84 }
85 __flush_tlb_all();
86} 86}
87 87
88static inline void flush_map(struct list_head *l) 88static inline void flush_map(struct list_head *l)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index b6491c020f26..f92ba2a869b4 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -532,6 +532,12 @@ static void cfq_add_rq_rb(struct request *rq)
532 532
533 if (!cfq_cfqq_on_rr(cfqq)) 533 if (!cfq_cfqq_on_rr(cfqq))
534 cfq_add_cfqq_rr(cfqd, cfqq); 534 cfq_add_cfqq_rr(cfqd, cfqq);
535
536 /*
537 * check if this request is a better next-serve candidate
538 */
539 cfqq->next_rq = cfq_choose_req(cfqd, cfqq->next_rq, rq);
540 BUG_ON(!cfqq->next_rq);
535} 541}
536 542
537static inline void 543static inline void
@@ -986,9 +992,9 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq,
986 * expire an async queue immediately if it has used up its slice. idle 992 * expire an async queue immediately if it has used up its slice. idle
987 * queue always expire after 1 dispatch round. 993 * queue always expire after 1 dispatch round.
988 */ 994 */
989 if ((!cfq_cfqq_sync(cfqq) && 995 if (cfqd->busy_queues > 1 && ((!cfq_cfqq_sync(cfqq) &&
990 cfqd->dispatch_slice >= cfq_prio_to_maxrq(cfqd, cfqq)) || 996 cfqd->dispatch_slice >= cfq_prio_to_maxrq(cfqd, cfqq)) ||
991 cfq_class_idle(cfqq)) { 997 cfq_class_idle(cfqq))) {
992 cfqq->slice_end = jiffies + 1; 998 cfqq->slice_end = jiffies + 1;
993 cfq_slice_expired(cfqd, 0, 0); 999 cfq_slice_expired(cfqd, 0, 0);
994 } 1000 }
@@ -1051,19 +1057,21 @@ cfq_dispatch_requests(request_queue_t *q, int force)
1051 while ((cfqq = cfq_select_queue(cfqd)) != NULL) { 1057 while ((cfqq = cfq_select_queue(cfqd)) != NULL) {
1052 int max_dispatch; 1058 int max_dispatch;
1053 1059
1054 /* 1060 if (cfqd->busy_queues > 1) {
1055 * Don't repeat dispatch from the previous queue. 1061 /*
1056 */ 1062 * Don't repeat dispatch from the previous queue.
1057 if (prev_cfqq == cfqq) 1063 */
1058 break; 1064 if (prev_cfqq == cfqq)
1065 break;
1059 1066
1060 /* 1067 /*
1061 * So we have dispatched before in this round, if the 1068 * So we have dispatched before in this round, if the
1062 * next queue has idling enabled (must be sync), don't 1069 * next queue has idling enabled (must be sync), don't
1063 * allow it service until the previous have continued. 1070 * allow it service until the previous have continued.
1064 */ 1071 */
1065 if (cfqd->rq_in_driver && cfq_cfqq_idle_window(cfqq)) 1072 if (cfqd->rq_in_driver && cfq_cfqq_idle_window(cfqq))
1066 break; 1073 break;
1074 }
1067 1075
1068 cfq_clear_cfqq_must_dispatch(cfqq); 1076 cfq_clear_cfqq_must_dispatch(cfqq);
1069 cfq_clear_cfqq_wait_request(cfqq); 1077 cfq_clear_cfqq_wait_request(cfqq);
@@ -1370,7 +1378,9 @@ retry:
1370 atomic_set(&cfqq->ref, 0); 1378 atomic_set(&cfqq->ref, 0);
1371 cfqq->cfqd = cfqd; 1379 cfqq->cfqd = cfqd;
1372 1380
1373 cfq_mark_cfqq_idle_window(cfqq); 1381 if (key != CFQ_KEY_ASYNC)
1382 cfq_mark_cfqq_idle_window(cfqq);
1383
1374 cfq_mark_cfqq_prio_changed(cfqq); 1384 cfq_mark_cfqq_prio_changed(cfqq);
1375 cfq_mark_cfqq_queue_new(cfqq); 1385 cfq_mark_cfqq_queue_new(cfqq);
1376 cfq_init_prio_data(cfqq); 1386 cfq_init_prio_data(cfqq);
@@ -1635,12 +1645,6 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1635 cfqq->meta_pending++; 1645 cfqq->meta_pending++;
1636 1646
1637 /* 1647 /*
1638 * check if this request is a better next-serve candidate)) {
1639 */
1640 cfqq->next_rq = cfq_choose_req(cfqd, cfqq->next_rq, rq);
1641 BUG_ON(!cfqq->next_rq);
1642
1643 /*
1644 * we never wait for an async request and we don't allow preemption 1648 * we never wait for an async request and we don't allow preemption
1645 * of an async request. so just return early 1649 * of an async request. so just return early
1646 */ 1650 */
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 0ae8b9310cbf..589b98b7b216 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -758,7 +758,8 @@ static void acpi_thermal_check(void *data)
758 del_timer(&(tz->timer)); 758 del_timer(&(tz->timer));
759 } else { 759 } else {
760 if (timer_pending(&(tz->timer))) 760 if (timer_pending(&(tz->timer)))
761 mod_timer(&(tz->timer), (HZ * sleep_time) / 1000); 761 mod_timer(&(tz->timer),
762 jiffies + (HZ * sleep_time) / 1000);
762 else { 763 else {
763 tz->timer.data = (unsigned long)tz; 764 tz->timer.data = (unsigned long)tz;
764 tz->timer.function = acpi_thermal_run; 765 tz->timer.function = acpi_thermal_run;
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index f48207865930..8dc3bc4f5863 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -878,6 +878,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
878 struct ata_port_info *port; 878 struct ata_port_info *port;
879 struct pci_dev *host = NULL; 879 struct pci_dev *host = NULL;
880 struct sis_chipset *chipset = NULL; 880 struct sis_chipset *chipset = NULL;
881 struct sis_chipset *sets;
881 882
882 static struct sis_chipset sis_chipsets[] = { 883 static struct sis_chipset sis_chipsets[] = {
883 884
@@ -932,10 +933,11 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
932 933
933 /* We have to find the bridge first */ 934 /* We have to find the bridge first */
934 935
935 for (chipset = &sis_chipsets[0]; chipset->device; chipset++) { 936 for (sets = &sis_chipsets[0]; sets->device; sets++) {
936 host = pci_get_device(PCI_VENDOR_ID_SI, chipset->device, NULL); 937 host = pci_get_device(PCI_VENDOR_ID_SI, sets->device, NULL);
937 if (host != NULL) { 938 if (host != NULL) {
938 if (chipset->device == 0x630) { /* SIS630 */ 939 chipset = sets; /* Match found */
940 if (sets->device == 0x630) { /* SIS630 */
939 u8 host_rev; 941 u8 host_rev;
940 pci_read_config_byte(host, PCI_REVISION_ID, &host_rev); 942 pci_read_config_byte(host, PCI_REVISION_ID, &host_rev);
941 if (host_rev >= 0x30) /* 630 ET */ 943 if (host_rev >= 0x30) /* 630 ET */
@@ -946,7 +948,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
946 } 948 }
947 949
948 /* Look for concealed bridges */ 950 /* Look for concealed bridges */
949 if (host == NULL) { 951 if (chipset == NULL) {
950 /* Second check */ 952 /* Second check */
951 u32 idemisc; 953 u32 idemisc;
952 u16 trueid; 954 u16 trueid;
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index fdfa3d0cf6af..bbbb973a9d3c 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -54,7 +54,8 @@ int device_pm_add(struct device * dev)
54 int error; 54 int error;
55 55
56 pr_debug("PM: Adding info for %s:%s\n", 56 pr_debug("PM: Adding info for %s:%s\n",
57 dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); 57 dev->bus ? dev->bus->name : "No Bus",
58 kobject_name(&dev->kobj));
58 down(&dpm_list_sem); 59 down(&dpm_list_sem);
59 list_add_tail(&dev->power.entry, &dpm_active); 60 list_add_tail(&dev->power.entry, &dpm_active);
60 device_pm_set_parent(dev, dev->parent); 61 device_pm_set_parent(dev, dev->parent);
@@ -67,7 +68,8 @@ int device_pm_add(struct device * dev)
67void device_pm_remove(struct device * dev) 68void device_pm_remove(struct device * dev)
68{ 69{
69 pr_debug("PM: Removing info for %s:%s\n", 70 pr_debug("PM: Removing info for %s:%s\n",
70 dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); 71 dev->bus ? dev->bus->name : "No Bus",
72 kobject_name(&dev->kobj));
71 down(&dpm_list_sem); 73 down(&dpm_list_sem);
72 dpm_sysfs_remove(dev); 74 dpm_sysfs_remove(dev);
73 put_device(dev->power.pm_parent); 75 put_device(dev->power.pm_parent);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 14d780666c0a..65a725cd3422 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3423,6 +3423,25 @@ static void cciss_remove_one(struct pci_dev *pdev)
3423 "already be removed \n"); 3423 "already be removed \n");
3424 return; 3424 return;
3425 } 3425 }
3426
3427 remove_proc_entry(hba[i]->devname, proc_cciss);
3428 unregister_blkdev(hba[i]->major, hba[i]->devname);
3429
3430 /* remove it from the disk list */
3431 for (j = 0; j < CISS_MAX_LUN; j++) {
3432 struct gendisk *disk = hba[i]->gendisk[j];
3433 if (disk) {
3434 request_queue_t *q = disk->queue;
3435
3436 if (disk->flags & GENHD_FL_UP)
3437 del_gendisk(disk);
3438 if (q)
3439 blk_cleanup_queue(q);
3440 }
3441 }
3442
3443 cciss_unregister_scsi(i); /* unhook from SCSI subsystem */
3444
3426 /* Turn board interrupts off and send the flush cache command */ 3445 /* Turn board interrupts off and send the flush cache command */
3427 /* sendcmd will turn off interrupt, and send the flush... 3446 /* sendcmd will turn off interrupt, and send the flush...
3428 * To write all data in the battery backed cache to disks */ 3447 * To write all data in the battery backed cache to disks */
@@ -3444,22 +3463,6 @@ static void cciss_remove_one(struct pci_dev *pdev)
3444#endif /* CONFIG_PCI_MSI */ 3463#endif /* CONFIG_PCI_MSI */
3445 3464
3446 iounmap(hba[i]->vaddr); 3465 iounmap(hba[i]->vaddr);
3447 cciss_unregister_scsi(i); /* unhook from SCSI subsystem */
3448 unregister_blkdev(hba[i]->major, hba[i]->devname);
3449 remove_proc_entry(hba[i]->devname, proc_cciss);
3450
3451 /* remove it from the disk list */
3452 for (j = 0; j < CISS_MAX_LUN; j++) {
3453 struct gendisk *disk = hba[i]->gendisk[j];
3454 if (disk) {
3455 request_queue_t *q = disk->queue;
3456
3457 if (disk->flags & GENHD_FL_UP)
3458 del_gendisk(disk);
3459 if (q)
3460 blk_cleanup_queue(q);
3461 }
3462 }
3463 3466
3464 pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(CommandList_struct), 3467 pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(CommandList_struct),
3465 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); 3468 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle);
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index c852eed91e4b..1eeb8f2cde71 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -140,7 +140,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
140#include <linux/blkdev.h> 140#include <linux/blkdev.h>
141#include <asm/uaccess.h> 141#include <asm/uaccess.h>
142 142
143static spinlock_t pcd_lock; 143static DEFINE_SPINLOCK(pcd_lock);
144 144
145module_param(verbose, bool, 0644); 145module_param(verbose, bool, 0644);
146module_param(major, int, 0); 146module_param(major, int, 0);
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 7cdaa1951260..5826508f6731 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -154,7 +154,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_LUN, D_DLY};
154#include <linux/blkpg.h> 154#include <linux/blkpg.h>
155#include <asm/uaccess.h> 155#include <asm/uaccess.h>
156 156
157static spinlock_t pf_spin_lock; 157static DEFINE_SPINLOCK(pf_spin_lock);
158 158
159module_param(verbose, bool, 0644); 159module_param(verbose, bool, 0644);
160module_param(major, int, 0); 160module_param(major, int, 0);
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a4fb70383188..f1b9dd7d47d6 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -777,7 +777,8 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
777 rq->cmd_flags |= REQ_QUIET; 777 rq->cmd_flags |= REQ_QUIET;
778 778
779 blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0); 779 blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0);
780 ret = rq->errors; 780 if (rq->errors)
781 ret = -EIO;
781out: 782out:
782 blk_put_request(rq); 783 blk_put_request(rq);
783 return ret; 784 return ret;
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index a9fdbf9126ca..55392a45a14b 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -431,9 +431,8 @@ static void intel_i830_init_gtt_entries(void)
431 431
432 if (IS_I965) { 432 if (IS_I965) {
433 u32 pgetbl_ctl; 433 u32 pgetbl_ctl;
434 pgetbl_ctl = readl(intel_i830_private.registers+I810_PGETBL_CTL);
434 435
435 pci_read_config_dword(agp_bridge->dev, I810_PGETBL_CTL,
436 &pgetbl_ctl);
437 /* The 965 has a field telling us the size of the GTT, 436 /* The 965 has a field telling us the size of the GTT,
438 * which may be larger than what is necessary to map the 437 * which may be larger than what is necessary to map the
439 * aperture. 438 * aperture.
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index f5c160caf9f4..5f066963f171 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -248,7 +248,7 @@ static unsigned long get_unmapped_area_mem(struct file *file,
248{ 248{
249 if (!valid_mmap_phys_addr_range(pgoff, len)) 249 if (!valid_mmap_phys_addr_range(pgoff, len))
250 return (unsigned long) -EINVAL; 250 return (unsigned long) -EINVAL;
251 return pgoff; 251 return pgoff << PAGE_SHIFT;
252} 252}
253 253
254/* can't do an in-place private mapping if there's no MMU */ 254/* can't do an in-place private mapping if there's no MMU */
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index a61fb6da5d03..80a01150b86c 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1338,43 +1338,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c
1338 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) 1338 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
1339 * Caller should use TIOCGICOUNT to see which one it was 1339 * Caller should use TIOCGICOUNT to see which one it was
1340 */ 1340 */
1341 case TIOCMIWAIT: { 1341 case TIOCMIWAIT:
1342 DECLARE_WAITQUEUE(wait, current); 1342 spin_lock_irqsave(&info->slock, flags);
1343 int ret; 1343 cnow = info->icount; /* note the counters on entry */
1344 spin_unlock_irqrestore(&info->slock, flags);
1345
1346 wait_event_interruptible(info->delta_msr_wait, ({
1347 cprev = cnow;
1344 spin_lock_irqsave(&info->slock, flags); 1348 spin_lock_irqsave(&info->slock, flags);
1345 cprev = info->icount; /* note the counters on entry */ 1349 cnow = info->icount; /* atomic copy */
1346 spin_unlock_irqrestore(&info->slock, flags); 1350 spin_unlock_irqrestore(&info->slock, flags);
1347 1351
1348 add_wait_queue(&info->delta_msr_wait, &wait); 1352 ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
1349 while (1) { 1353 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
1350 spin_lock_irqsave(&info->slock, flags); 1354 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
1351 cnow = info->icount; /* atomic copy */ 1355 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts));
1352 spin_unlock_irqrestore(&info->slock, flags); 1356 }));
1353 1357 break;
1354 set_current_state(TASK_INTERRUPTIBLE);
1355 if (((arg & TIOCM_RNG) &&
1356 (cnow.rng != cprev.rng)) ||
1357 ((arg & TIOCM_DSR) &&
1358 (cnow.dsr != cprev.dsr)) ||
1359 ((arg & TIOCM_CD) &&
1360 (cnow.dcd != cprev.dcd)) ||
1361 ((arg & TIOCM_CTS) &&
1362 (cnow.cts != cprev.cts))) {
1363 ret = 0;
1364 break;
1365 }
1366 /* see if a signal did it */
1367 if (signal_pending(current)) {
1368 ret = -ERESTARTSYS;
1369 break;
1370 }
1371 cprev = cnow;
1372 }
1373 current->state = TASK_RUNNING;
1374 remove_wait_queue(&info->delta_msr_wait, &wait);
1375 break;
1376 }
1377 /* NOTREACHED */
1378 /* 1358 /*
1379 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1359 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1380 * Return: write counters to the user passed counter struct 1360 * Return: write counters to the user passed counter struct
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 9af07e4999d5..f7603b6aeb87 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -1758,43 +1758,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
1758 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) 1758 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
1759 * Caller should use TIOCGICOUNT to see which one it was 1759 * Caller should use TIOCGICOUNT to see which one it was
1760 */ 1760 */
1761 case TIOCMIWAIT: { 1761 case TIOCMIWAIT:
1762 DECLARE_WAITQUEUE(wait, current);
1763 int ret;
1764 spin_lock_irqsave(&info->slock, flags); 1762 spin_lock_irqsave(&info->slock, flags);
1765 cprev = info->icount; /* note the counters on entry */ 1763 cnow = info->icount; /* note the counters on entry */
1766 spin_unlock_irqrestore(&info->slock, flags); 1764 spin_unlock_irqrestore(&info->slock, flags);
1767 1765
1768 add_wait_queue(&info->delta_msr_wait, &wait); 1766 wait_event_interruptible(info->delta_msr_wait, ({
1769 while (1) { 1767 cprev = cnow;
1770 spin_lock_irqsave(&info->slock, flags); 1768 spin_lock_irqsave(&info->slock, flags);
1771 cnow = info->icount; /* atomic copy */ 1769 cnow = info->icount; /* atomic copy */
1772 spin_unlock_irqrestore(&info->slock, flags); 1770 spin_unlock_irqrestore(&info->slock, flags);
1773 1771
1774 set_current_state(TASK_INTERRUPTIBLE); 1772 ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
1775 if (((arg & TIOCM_RNG) && 1773 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
1776 (cnow.rng != cprev.rng)) || 1774 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
1777 ((arg & TIOCM_DSR) && 1775 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts));
1778 (cnow.dsr != cprev.dsr)) || 1776 }));
1779 ((arg & TIOCM_CD) &&
1780 (cnow.dcd != cprev.dcd)) ||
1781 ((arg & TIOCM_CTS) &&
1782 (cnow.cts != cprev.cts))) {
1783 ret = 0;
1784 break;
1785 }
1786 /* see if a signal did it */
1787 if (signal_pending(current)) {
1788 ret = -ERESTARTSYS;
1789 break;
1790 }
1791 cprev = cnow;
1792 }
1793 current->state = TASK_RUNNING;
1794 remove_wait_queue(&info->delta_msr_wait, &wait);
1795 break; 1777 break;
1796 }
1797 /* NOTREACHED */
1798 /* 1778 /*
1799 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1779 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1800 * Return: write counters to the user passed counter struct 1780 * Return: write counters to the user passed counter struct
@@ -2230,7 +2210,14 @@ end_intr:
2230 port->mon_data.rxcnt += cnt; 2210 port->mon_data.rxcnt += cnt;
2231 port->mon_data.up_rxcnt += cnt; 2211 port->mon_data.up_rxcnt += cnt;
2232 2212
2213 /*
2214 * We are called from an interrupt context with &port->slock
2215 * being held. Drop it temporarily in order to prevent
2216 * recursive locking.
2217 */
2218 spin_unlock(&port->slock);
2233 tty_flip_buffer_push(tty); 2219 tty_flip_buffer_push(tty);
2220 spin_lock(&port->slock);
2234} 2221}
2235 2222
2236static void mxser_transmit_chars(struct mxser_port *port) 2223static void mxser_transmit_chars(struct mxser_port *port)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 67f3347afcf3..1cca32f46947 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -969,7 +969,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
969 969
970 if (size < rsize) { 970 if (size < rsize) {
971 dbg("report %d is too short, (%d < %d)", report->id, size, rsize); 971 dbg("report %d is too short, (%d < %d)", report->id, size, rsize);
972 return -1; 972 memset(data + size, 0, rsize - size);
973 } 973 }
974 974
975 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) 975 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index da5828f2dfc2..30a76404f0af 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -121,9 +121,9 @@ superio_exit(void)
121 * ISA constants 121 * ISA constants
122 */ 122 */
123 123
124#define REGION_ALIGNMENT ~7 124#define IOREGION_ALIGNMENT ~7
125#define REGION_OFFSET 5 125#define IOREGION_OFFSET 5
126#define REGION_LENGTH 2 126#define IOREGION_LENGTH 2
127#define ADDR_REG_OFFSET 5 127#define ADDR_REG_OFFSET 5
128#define DATA_REG_OFFSET 6 128#define DATA_REG_OFFSET 6
129 129
@@ -407,7 +407,7 @@ static void w83627ehf_write_fan_div(struct i2c_client *client, int nr)
407 break; 407 break;
408 case 4: 408 case 4:
409 reg = (w83627ehf_read_value(client, W83627EHF_REG_DIODE) & 0x73) 409 reg = (w83627ehf_read_value(client, W83627EHF_REG_DIODE) & 0x73)
410 | ((data->fan_div[4] & 0x03) << 3) 410 | ((data->fan_div[4] & 0x03) << 2)
411 | ((data->fan_div[4] & 0x04) << 5); 411 | ((data->fan_div[4] & 0x04) << 5);
412 w83627ehf_write_value(client, W83627EHF_REG_DIODE, reg); 412 w83627ehf_write_value(client, W83627EHF_REG_DIODE, reg);
413 break; 413 break;
@@ -471,9 +471,9 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
471 time */ 471 time */
472 if (data->fan[i] == 0xff 472 if (data->fan[i] == 0xff
473 && data->fan_div[i] < 0x07) { 473 && data->fan_div[i] < 0x07) {
474 dev_dbg(&client->dev, "Increasing fan %d " 474 dev_dbg(&client->dev, "Increasing fan%d "
475 "clock divider from %u to %u\n", 475 "clock divider from %u to %u\n",
476 i, div_from_reg(data->fan_div[i]), 476 i + 1, div_from_reg(data->fan_div[i]),
477 div_from_reg(data->fan_div[i] + 1)); 477 div_from_reg(data->fan_div[i] + 1));
478 data->fan_div[i]++; 478 data->fan_div[i]++;
479 w83627ehf_write_fan_div(client, i); 479 w83627ehf_write_fan_div(client, i);
@@ -1194,7 +1194,7 @@ static int w83627ehf_detect(struct i2c_adapter *adapter)
1194 u8 fan4pin, fan5pin; 1194 u8 fan4pin, fan5pin;
1195 int i, err = 0; 1195 int i, err = 0;
1196 1196
1197 if (!request_region(address + REGION_OFFSET, REGION_LENGTH, 1197 if (!request_region(address + IOREGION_OFFSET, IOREGION_LENGTH,
1198 w83627ehf_driver.driver.name)) { 1198 w83627ehf_driver.driver.name)) {
1199 err = -EBUSY; 1199 err = -EBUSY;
1200 goto exit; 1200 goto exit;
@@ -1322,7 +1322,7 @@ exit_remove:
1322exit_free: 1322exit_free:
1323 kfree(data); 1323 kfree(data);
1324exit_release: 1324exit_release:
1325 release_region(address + REGION_OFFSET, REGION_LENGTH); 1325 release_region(address + IOREGION_OFFSET, IOREGION_LENGTH);
1326exit: 1326exit:
1327 return err; 1327 return err;
1328} 1328}
@@ -1337,7 +1337,7 @@ static int w83627ehf_detach_client(struct i2c_client *client)
1337 1337
1338 if ((err = i2c_detach_client(client))) 1338 if ((err = i2c_detach_client(client)))
1339 return err; 1339 return err;
1340 release_region(client->addr + REGION_OFFSET, REGION_LENGTH); 1340 release_region(client->addr + IOREGION_OFFSET, IOREGION_LENGTH);
1341 kfree(data); 1341 kfree(data);
1342 1342
1343 return 0; 1343 return 0;
@@ -1380,7 +1380,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr)
1380 superio_select(W83627EHF_LD_HWM); 1380 superio_select(W83627EHF_LD_HWM);
1381 val = (superio_inb(SIO_REG_ADDR) << 8) 1381 val = (superio_inb(SIO_REG_ADDR) << 8)
1382 | superio_inb(SIO_REG_ADDR + 1); 1382 | superio_inb(SIO_REG_ADDR + 1);
1383 *addr = val & REGION_ALIGNMENT; 1383 *addr = val & IOREGION_ALIGNMENT;
1384 if (*addr == 0) { 1384 if (*addr == 0) {
1385 superio_exit(); 1385 superio_exit();
1386 return -ENODEV; 1386 return -ENODEV;
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index fb19dbb31e42..ece31d2c6c64 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -344,8 +344,7 @@ config I2C_PARPORT_LIGHT
344 344
345config I2C_PASEMI 345config I2C_PASEMI
346 tristate "PA Semi SMBus interface" 346 tristate "PA Semi SMBus interface"
347# depends on PPC_PASEMI && I2C && PCI 347 depends on PPC_PASEMI && I2C && PCI
348 depends on I2C && PCI
349 help 348 help
350 Supports the PA Semi PWRficient on-chip SMBus interfaces. 349 Supports the PA Semi PWRficient on-chip SMBus interfaces.
351 350
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index f54fb5d65cc4..bf89eeef74e9 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -141,7 +141,7 @@ static int pasemi_i2c_xfer_msg(struct i2c_adapter *adapter,
141 for (i = 0; i < msg->len - 1; i++) 141 for (i = 0; i < msg->len - 1; i++)
142 TXFIFO_WR(smbus, msg->buf[i]); 142 TXFIFO_WR(smbus, msg->buf[i]);
143 143
144 TXFIFO_WR(smbus, msg->buf[msg->len] | 144 TXFIFO_WR(smbus, msg->buf[msg->len-1] |
145 (stop ? MTXFIFO_STOP : 0)); 145 (stop ? MTXFIFO_STOP : 0));
146 } 146 }
147 147
@@ -226,7 +226,7 @@ static int pasemi_smb_xfer(struct i2c_adapter *adapter,
226 rd = RXFIFO_RD(smbus); 226 rd = RXFIFO_RD(smbus);
227 len = min_t(u8, (rd & MRXFIFO_DATA_M), 227 len = min_t(u8, (rd & MRXFIFO_DATA_M),
228 I2C_SMBUS_BLOCK_MAX); 228 I2C_SMBUS_BLOCK_MAX);
229 TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | 229 TXFIFO_WR(smbus, len | MTXFIFO_READ |
230 MTXFIFO_STOP); 230 MTXFIFO_STOP);
231 } else { 231 } else {
232 len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); 232 len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX);
@@ -258,7 +258,7 @@ static int pasemi_smb_xfer(struct i2c_adapter *adapter,
258 rd = RXFIFO_RD(smbus); 258 rd = RXFIFO_RD(smbus);
259 len = min_t(u8, (rd & MRXFIFO_DATA_M), 259 len = min_t(u8, (rd & MRXFIFO_DATA_M),
260 I2C_SMBUS_BLOCK_MAX - len); 260 I2C_SMBUS_BLOCK_MAX - len);
261 TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | MTXFIFO_STOP); 261 TXFIFO_WR(smbus, len | MTXFIFO_READ | MTXFIFO_STOP);
262 break; 262 break;
263 263
264 default: 264 default:
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index ca2e4f830c39..5bdf64b77913 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -57,6 +57,7 @@ if IDE
57config IDE_MAX_HWIFS 57config IDE_MAX_HWIFS
58 int "Max IDE interfaces" 58 int "Max IDE interfaces"
59 depends on ALPHA || SUPERH || IA64 || EMBEDDED 59 depends on ALPHA || SUPERH || IA64 || EMBEDDED
60 range 1 10
60 default 4 61 default 4
61 help 62 help
62 This is the maximum number of IDE hardware interfaces that will 63 This is the maximum number of IDE hardware interfaces that will
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 45a928c058cf..638becda81c6 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -735,6 +735,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
735 cdrom_saw_media_change (drive); 735 cdrom_saw_media_change (drive);
736 /*printk("%s: media changed\n",drive->name);*/ 736 /*printk("%s: media changed\n",drive->name);*/
737 return 0; 737 return 0;
738 } else if ((sense_key == ILLEGAL_REQUEST) &&
739 (rq->cmd[0] == GPCMD_START_STOP_UNIT)) {
740 /*
741 * Don't print error message for this condition--
742 * SFF8090i indicates that 5/24/00 is the correct
743 * response to a request to close the tray if the
744 * drive doesn't have that capability.
745 * cdrom_log_sense() knows this!
746 */
738 } else if (!(rq->cmd_flags & REQ_QUIET)) { 747 } else if (!(rq->cmd_flags & REQ_QUIET)) {
739 /* Otherwise, print an error. */ 748 /* Otherwise, print an error. */
740 ide_dump_status(drive, "packet command error", stat); 749 ide_dump_status(drive, "packet command error", stat);
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 0e0280076fcd..8670112f1d39 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -1226,6 +1226,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1226#endif 1226#endif
1227 /* so that ide_timer_expiry knows what to do */ 1227 /* so that ide_timer_expiry knows what to do */
1228 hwgroup->sleeping = 1; 1228 hwgroup->sleeping = 1;
1229 hwgroup->req_gen_timer = hwgroup->req_gen;
1229 mod_timer(&hwgroup->timer, sleep); 1230 mod_timer(&hwgroup->timer, sleep);
1230 /* we purposely leave hwgroup->busy==1 1231 /* we purposely leave hwgroup->busy==1
1231 * while sleeping */ 1232 * while sleeping */
@@ -1411,7 +1412,8 @@ void ide_timer_expiry (unsigned long data)
1411 1412
1412 spin_lock_irqsave(&ide_lock, flags); 1413 spin_lock_irqsave(&ide_lock, flags);
1413 1414
1414 if ((handler = hwgroup->handler) == NULL) { 1415 if (((handler = hwgroup->handler) == NULL) ||
1416 (hwgroup->req_gen != hwgroup->req_gen_timer)) {
1415 /* 1417 /*
1416 * Either a marginal timeout occurred 1418 * Either a marginal timeout occurred
1417 * (got the interrupt just as timer expired), 1419 * (got the interrupt just as timer expired),
@@ -1439,6 +1441,7 @@ void ide_timer_expiry (unsigned long data)
1439 if ((wait = expiry(drive)) > 0) { 1441 if ((wait = expiry(drive)) > 0) {
1440 /* reset timer */ 1442 /* reset timer */
1441 hwgroup->timer.expires = jiffies + wait; 1443 hwgroup->timer.expires = jiffies + wait;
1444 hwgroup->req_gen_timer = hwgroup->req_gen;
1442 add_timer(&hwgroup->timer); 1445 add_timer(&hwgroup->timer);
1443 spin_unlock_irqrestore(&ide_lock, flags); 1446 spin_unlock_irqrestore(&ide_lock, flags);
1444 return; 1447 return;
@@ -1653,6 +1656,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
1653 printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name); 1656 printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name);
1654 } 1657 }
1655 hwgroup->handler = NULL; 1658 hwgroup->handler = NULL;
1659 hwgroup->req_gen++;
1656 del_timer(&hwgroup->timer); 1660 del_timer(&hwgroup->timer);
1657 spin_unlock(&ide_lock); 1661 spin_unlock(&ide_lock);
1658 1662
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 1ee53a551c3a..3caa176b3155 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -889,6 +889,7 @@ static void __ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
889 hwgroup->handler = handler; 889 hwgroup->handler = handler;
890 hwgroup->expiry = expiry; 890 hwgroup->expiry = expiry;
891 hwgroup->timer.expires = jiffies + timeout; 891 hwgroup->timer.expires = jiffies + timeout;
892 hwgroup->req_gen_timer = hwgroup->req_gen;
892 add_timer(&hwgroup->timer); 893 add_timer(&hwgroup->timer);
893} 894}
894 895
@@ -929,6 +930,7 @@ void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *ha
929 hwgroup->handler = handler; 930 hwgroup->handler = handler;
930 hwgroup->expiry = expiry; 931 hwgroup->expiry = expiry;
931 hwgroup->timer.expires = jiffies + timeout; 932 hwgroup->timer.expires = jiffies + timeout;
933 hwgroup->req_gen_timer = hwgroup->req_gen;
932 add_timer(&hwgroup->timer); 934 add_timer(&hwgroup->timer);
933 hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); 935 hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG);
934 /* Drive takes 400nS to respond, we must avoid the IRQ being 936 /* Drive takes 400nS to respond, we must avoid the IRQ being
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index a6f098fda884..ae5bf2be6f52 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1962,6 +1962,8 @@ static char *media_string(ide_drive_t *drive)
1962 return "tape"; 1962 return "tape";
1963 case ide_floppy: 1963 case ide_floppy:
1964 return "floppy"; 1964 return "floppy";
1965 case ide_optical:
1966 return "optical";
1965 default: 1967 default:
1966 return "UNKNOWN"; 1968 return "UNKNOWN";
1967 } 1969 }
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c
index d4b753e70119..dd7ec37fdeab 100644
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -108,6 +108,7 @@ delkin_cb_remove (struct pci_dev *dev)
108 108
109static struct pci_device_id delkin_cb_pci_tbl[] __devinitdata = { 109static struct pci_device_id delkin_cb_pci_tbl[] __devinitdata = {
110 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 110 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
111 { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
111 { 0, }, 112 { 0, },
112}; 113};
113MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl); 114MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl);
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 60ecdc258c7c..ab6fa271aeb3 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.01 Dec 23, 2006 2 * linux/drivers/ide/pci/hpt366.c Version 1.02 Apr 18, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
6 * Portions Copyright (C) 2003 Red Hat Inc 6 * Portions Copyright (C) 2003 Red Hat Inc
7 * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. 7 * Portions Copyright (C) 2005-2007 MontaVista Software, Inc.
8 * 8 *
9 * Thanks to HighPoint Technologies for their assistance, and hardware. 9 * Thanks to HighPoint Technologies for their assistance, and hardware.
10 * Special Thanks to Jon Burchmore in SanDiego for the deep pockets, his 10 * Special Thanks to Jon Burchmore in SanDiego for the deep pockets, his
@@ -494,6 +494,7 @@ static struct hpt_info hpt302n __devinitdata = {
494 .chip_type = HPT302N, 494 .chip_type = HPT302N,
495 .max_mode = HPT302_ALLOW_ATA133_6 ? 4 : 3, 495 .max_mode = HPT302_ALLOW_ATA133_6 ? 4 : 3,
496 .dpll_clk = 77, 496 .dpll_clk = 77,
497 .settings = hpt37x_settings
497}; 498};
498 499
499static struct hpt_info hpt371n __devinitdata = { 500static struct hpt_info hpt371n __devinitdata = {
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
index b8a47342cd2c..cd84a55ecf20 100644
--- a/drivers/ieee1394/Kconfig
+++ b/drivers/ieee1394/Kconfig
@@ -138,9 +138,9 @@ config IEEE1394_DV1394
138 tristate "OHCI-DV I/O support (deprecated)" 138 tristate "OHCI-DV I/O support (deprecated)"
139 depends on IEEE1394 && IEEE1394_OHCI1394 139 depends on IEEE1394 && IEEE1394_OHCI1394
140 help 140 help
141 The dv1394 driver will be removed from Linux in a future release. 141 The dv1394 driver is unsupported and may be removed from Linux in a
142 Its functionality is now provided by raw1394 together with libraries 142 future release. Its functionality is now provided by raw1394 together
143 such as libiec61883. 143 with libraries such as libiec61883.
144 144
145config IEEE1394_RAWIO 145config IEEE1394_RAWIO
146 tristate "Raw IEEE1394 I/O support" 146 tristate "Raw IEEE1394 I/O support"
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index dee9529aa8e7..026e38face5c 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -2564,8 +2564,8 @@ static int __init dv1394_init_module(void)
2564 int ret; 2564 int ret;
2565 2565
2566 printk(KERN_WARNING 2566 printk(KERN_WARNING
2567 "WARNING: The dv1394 driver is unsupported and will be removed " 2567 "NOTE: The dv1394 driver is unsupported and may be removed in a "
2568 "from Linux soon. Use raw1394 instead.\n"); 2568 "future Linux release. Use raw1394 instead.\n");
2569 2569
2570 cdev_init(&dv1394_cdev, &dv1394_fops); 2570 cdev_init(&dv1394_cdev, &dv1394_fops);
2571 dv1394_cdev.owner = THIS_MODULE; 2571 dv1394_cdev.owner = THIS_MODULE;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index d0ed1d35ca3e..2d2de9b8b729 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -2026,6 +2026,17 @@ static int sched(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
2026 return 0; 2026 return 0;
2027} 2027}
2028 2028
2029static int set_tcb_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
2030{
2031 struct cpl_set_tcb_rpl *rpl = cplhdr(skb);
2032
2033 if (rpl->status != CPL_ERR_NONE) {
2034 printk(KERN_ERR MOD "Unexpected SET_TCB_RPL status %u "
2035 "for tid %u\n", rpl->status, GET_TID(rpl));
2036 }
2037 return CPL_RET_BUF_DONE;
2038}
2039
2029int __init iwch_cm_init(void) 2040int __init iwch_cm_init(void)
2030{ 2041{
2031 skb_queue_head_init(&rxq); 2042 skb_queue_head_init(&rxq);
@@ -2053,6 +2064,7 @@ int __init iwch_cm_init(void)
2053 t3c_handlers[CPL_ABORT_REQ_RSS] = sched; 2064 t3c_handlers[CPL_ABORT_REQ_RSS] = sched;
2054 t3c_handlers[CPL_RDMA_TERMINATE] = sched; 2065 t3c_handlers[CPL_RDMA_TERMINATE] = sched;
2055 t3c_handlers[CPL_RDMA_EC_STATUS] = sched; 2066 t3c_handlers[CPL_RDMA_EC_STATUS] = sched;
2067 t3c_handlers[CPL_SET_TCB_RPL] = set_tcb_rpl;
2056 2068
2057 /* 2069 /*
2058 * These are the real handlers that are called from a 2070 * These are the real handlers that are called from a
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index fdb576dcfaa8..ee561c569d5f 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -835,6 +835,7 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr)
835 835
836 key = arbel_key_to_hw_index(fmr->ibmr.lkey); 836 key = arbel_key_to_hw_index(fmr->ibmr.lkey);
837 key &= dev->limits.num_mpts - 1; 837 key &= dev->limits.num_mpts - 1;
838 key = adjust_key(dev, key);
838 fmr->ibmr.lkey = fmr->ibmr.rkey = arbel_hw_index_to_key(key); 839 fmr->ibmr.lkey = fmr->ibmr.rkey = arbel_hw_index_to_key(key);
839 840
840 fmr->maps = 0; 841 fmr->maps = 0;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index e70492db74f6..2b242a4823f8 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -131,7 +131,7 @@ static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, int id, int
131 skb_fill_page_desc(skb, i, page, 0, PAGE_SIZE); 131 skb_fill_page_desc(skb, i, page, 0, PAGE_SIZE);
132 132
133 mapping[i + 1] = ib_dma_map_page(priv->ca, skb_shinfo(skb)->frags[i].page, 133 mapping[i + 1] = ib_dma_map_page(priv->ca, skb_shinfo(skb)->frags[i].page,
134 0, PAGE_SIZE, DMA_TO_DEVICE); 134 0, PAGE_SIZE, DMA_FROM_DEVICE);
135 if (unlikely(ib_dma_mapping_error(priv->ca, mapping[i + 1]))) 135 if (unlikely(ib_dma_mapping_error(priv->ca, mapping[i + 1])))
136 goto partial_error; 136 goto partial_error;
137 } 137 }
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index cae8c96a55f8..8960196ffb0f 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -245,7 +245,6 @@ struct iser_conn {
245 wait_queue_head_t wait; /* waitq for conn/disconn */ 245 wait_queue_head_t wait; /* waitq for conn/disconn */
246 atomic_t post_recv_buf_count; /* posted rx count */ 246 atomic_t post_recv_buf_count; /* posted rx count */
247 atomic_t post_send_buf_count; /* posted tx count */ 247 atomic_t post_send_buf_count; /* posted tx count */
248 struct work_struct comperror_work; /* conn term sleepable ctx*/
249 char name[ISER_OBJECT_NAME_SIZE]; 248 char name[ISER_OBJECT_NAME_SIZE];
250 struct iser_page_vec *page_vec; /* represents SG to fmr maps* 249 struct iser_page_vec *page_vec; /* represents SG to fmr maps*
251 * maps serialized as tx is*/ 250 * maps serialized as tx is*/
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 693b77002897..1fc967464a28 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -48,7 +48,6 @@
48 48
49static void iser_cq_tasklet_fn(unsigned long data); 49static void iser_cq_tasklet_fn(unsigned long data);
50static void iser_cq_callback(struct ib_cq *cq, void *cq_context); 50static void iser_cq_callback(struct ib_cq *cq, void *cq_context);
51static void iser_comp_error_worker(struct work_struct *work);
52 51
53static void iser_cq_event_callback(struct ib_event *cause, void *context) 52static void iser_cq_event_callback(struct ib_event *cause, void *context)
54{ 53{
@@ -480,7 +479,6 @@ int iser_conn_init(struct iser_conn **ibconn)
480 init_waitqueue_head(&ib_conn->wait); 479 init_waitqueue_head(&ib_conn->wait);
481 atomic_set(&ib_conn->post_recv_buf_count, 0); 480 atomic_set(&ib_conn->post_recv_buf_count, 0);
482 atomic_set(&ib_conn->post_send_buf_count, 0); 481 atomic_set(&ib_conn->post_send_buf_count, 0);
483 INIT_WORK(&ib_conn->comperror_work, iser_comp_error_worker);
484 INIT_LIST_HEAD(&ib_conn->conn_list); 482 INIT_LIST_HEAD(&ib_conn->conn_list);
485 spin_lock_init(&ib_conn->lock); 483 spin_lock_init(&ib_conn->lock);
486 484
@@ -753,26 +751,6 @@ int iser_post_send(struct iser_desc *tx_desc)
753 return ret_val; 751 return ret_val;
754} 752}
755 753
756static void iser_comp_error_worker(struct work_struct *work)
757{
758 struct iser_conn *ib_conn =
759 container_of(work, struct iser_conn, comperror_work);
760
761 /* getting here when the state is UP means that the conn is being *
762 * terminated asynchronously from the iSCSI layer's perspective. */
763 if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
764 ISER_CONN_TERMINATING))
765 iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
766 ISCSI_ERR_CONN_FAILED);
767
768 /* complete the termination process if disconnect event was delivered *
769 * note there are no more non completed posts to the QP */
770 if (ib_conn->disc_evt_flag) {
771 ib_conn->state = ISER_CONN_DOWN;
772 wake_up_interruptible(&ib_conn->wait);
773 }
774}
775
776static void iser_handle_comp_error(struct iser_desc *desc) 754static void iser_handle_comp_error(struct iser_desc *desc)
777{ 755{
778 struct iser_dto *dto = &desc->dto; 756 struct iser_dto *dto = &desc->dto;
@@ -791,8 +769,22 @@ static void iser_handle_comp_error(struct iser_desc *desc)
791 } 769 }
792 770
793 if (atomic_read(&ib_conn->post_recv_buf_count) == 0 && 771 if (atomic_read(&ib_conn->post_recv_buf_count) == 0 &&
794 atomic_read(&ib_conn->post_send_buf_count) == 0) 772 atomic_read(&ib_conn->post_send_buf_count) == 0) {
795 schedule_work(&ib_conn->comperror_work); 773 /* getting here when the state is UP means that the conn is *
774 * being terminated asynchronously from the iSCSI layer's *
775 * perspective. */
776 if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
777 ISER_CONN_TERMINATING))
778 iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
779 ISCSI_ERR_CONN_FAILED);
780
781 /* complete the termination process if disconnect event was delivered *
782 * note there are no more non completed posts to the QP */
783 if (ib_conn->disc_evt_flag) {
784 ib_conn->state = ISER_CONN_DOWN;
785 wake_up_interruptible(&ib_conn->wait);
786 }
787 }
796} 788}
797 789
798static void iser_cq_tasklet_fn(unsigned long data) 790static void iser_cq_tasklet_fn(unsigned long data)
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index c7db4032ef02..e8606c48c9c3 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -553,6 +553,7 @@ static int ucb1400_ts_remove(struct device *dev)
553} 553}
554 554
555static struct device_driver ucb1400_ts_driver = { 555static struct device_driver ucb1400_ts_driver = {
556 .name = "ucb1400_ts",
556 .owner = THIS_MODULE, 557 .owner = THIS_MODULE,
557 .bus = &ac97_bus_type, 558 .bus = &ac97_bus_type,
558 .probe = ucb1400_ts_probe, 559 .probe = ucb1400_ts_probe,
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index e85b4c7c36f7..cab26f301eab 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -1171,6 +1171,7 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes)
1171 * and zap two pdes instead of one. 1171 * and zap two pdes instead of one.
1172 */ 1172 */
1173 if (level == PT32_ROOT_LEVEL) { 1173 if (level == PT32_ROOT_LEVEL) {
1174 page_offset &= ~7; /* kill rounding error */
1174 page_offset <<= 1; 1175 page_offset <<= 1;
1175 npte = 2; 1176 npte = 2;
1176 } 1177 }
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 3096836d8bd3..c9f3dc4fd3ee 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -1259,9 +1259,9 @@ static int smu_release(struct inode *inode, struct file *file)
1259 set_current_state(TASK_UNINTERRUPTIBLE); 1259 set_current_state(TASK_UNINTERRUPTIBLE);
1260 if (pp->cmd.status != 1) 1260 if (pp->cmd.status != 1)
1261 break; 1261 break;
1262 spin_lock_irqsave(&pp->lock, flags);
1263 schedule();
1264 spin_unlock_irqrestore(&pp->lock, flags); 1262 spin_unlock_irqrestore(&pp->lock, flags);
1263 schedule();
1264 spin_lock_irqsave(&pp->lock, flags);
1265 } 1265 }
1266 set_current_state(TASK_RUNNING); 1266 set_current_state(TASK_RUNNING);
1267 remove_wait_queue(&pp->wait, &wait); 1267 remove_wait_queue(&pp->wait, &wait);
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 5554adaa58f9..e61e0efe9ec7 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -863,9 +863,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
863 863
864 /* We need 4 bits per page, rounded up to a multiple of sizeof(unsigned long) */ 864 /* We need 4 bits per page, rounded up to a multiple of sizeof(unsigned long) */
865 bitmap->filemap_attr = kzalloc( 865 bitmap->filemap_attr = kzalloc(
866 (((num_pages*4/8)+sizeof(unsigned long)-1) 866 roundup( DIV_ROUND_UP(num_pages*4, 8), sizeof(unsigned long)),
867 /sizeof(unsigned long))
868 *sizeof(unsigned long),
869 GFP_KERNEL); 867 GFP_KERNEL);
870 if (!bitmap->filemap_attr) 868 if (!bitmap->filemap_attr)
871 goto out; 869 goto out;
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index 9511a31c8f50..68ed3a788083 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -107,8 +107,6 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
107 return -ENOMEM; 107 return -ENOMEM;
108 108
109 input_dev->evbit[0] = BIT(EV_KEY); 109 input_dev->evbit[0] = BIT(EV_KEY);
110 input_dev->keycodesize = sizeof(unsigned char);
111 input_dev->keycodemax = KEY_MAX;
112 input_dev->name = "IR-receiver inside an USB DVB receiver"; 110 input_dev->name = "IR-receiver inside an USB DVB receiver";
113 input_dev->phys = d->rc_phys; 111 input_dev->phys = d->rc_phys;
114 usb_to_input_id(d->udev, &input_dev->id); 112 usb_to_input_id(d->udev, &input_dev->id);
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 4b232124a1ab..65c32a95e121 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * 4 *
5 * Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor 5 * Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor
6 * Copyright (C) 2006 Corentin Chary 6 * Copyright (C) 2006-2007 Corentin Chary
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@
48#include <acpi/acpi_bus.h> 48#include <acpi/acpi_bus.h>
49#include <asm/uaccess.h> 49#include <asm/uaccess.h>
50 50
51#define ASUS_LAPTOP_VERSION "0.40" 51#define ASUS_LAPTOP_VERSION "0.41"
52 52
53#define ASUS_HOTK_NAME "Asus Laptop Support" 53#define ASUS_HOTK_NAME "Asus Laptop Support"
54#define ASUS_HOTK_CLASS "hotkey" 54#define ASUS_HOTK_CLASS "hotkey"
@@ -81,7 +81,8 @@
81#define TLED_ON 0x08 //touchpad LED 81#define TLED_ON 0x08 //touchpad LED
82#define RLED_ON 0x10 //Record LED 82#define RLED_ON 0x10 //Record LED
83#define PLED_ON 0x20 //Phone LED 83#define PLED_ON 0x20 //Phone LED
84#define LCD_ON 0x40 //LCD backlight 84#define GLED_ON 0x40 //Gaming LED
85#define LCD_ON 0x80 //LCD backlight
85 86
86#define ASUS_LOG ASUS_HOTK_FILE ": " 87#define ASUS_LOG ASUS_HOTK_FILE ": "
87#define ASUS_ERR KERN_ERR ASUS_LOG 88#define ASUS_ERR KERN_ERR ASUS_LOG
@@ -94,6 +95,19 @@ MODULE_AUTHOR("Julien Lerouge, Karol Kozimor, Corentin Chary");
94MODULE_DESCRIPTION(ASUS_HOTK_NAME); 95MODULE_DESCRIPTION(ASUS_HOTK_NAME);
95MODULE_LICENSE("GPL"); 96MODULE_LICENSE("GPL");
96 97
98/* WAPF defines the behavior of the Fn+Fx wlan key
99 * The significance of values is yet to be found, but
100 * most of the time:
101 * 0x0 will do nothing
102 * 0x1 will allow to control the device with Fn+Fx key.
103 * 0x4 will send an ACPI event (0x88) while pressing the Fn+Fx key
104 * 0x5 like 0x1 or 0x4
105 * So, if something doesn't work as you want, just try other values =)
106 */
107static uint wapf = 1;
108module_param(wapf, uint, 0644);
109MODULE_PARM_DESC(wapf, "WAPF value");
110
97#define ASUS_HANDLE(object, paths...) \ 111#define ASUS_HANDLE(object, paths...) \
98 static acpi_handle object##_handle = NULL; \ 112 static acpi_handle object##_handle = NULL; \
99 static char *object##_paths[] = { paths } 113 static char *object##_paths[] = { paths }
@@ -103,6 +117,7 @@ ASUS_HANDLE(mled_set, ASUS_HOTK_PREFIX "MLED");
103ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED"); 117ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED");
104ASUS_HANDLE(rled_set, ASUS_HOTK_PREFIX "RLED"); /* W1JC */ 118ASUS_HANDLE(rled_set, ASUS_HOTK_PREFIX "RLED"); /* W1JC */
105ASUS_HANDLE(pled_set, ASUS_HOTK_PREFIX "PLED"); /* A7J */ 119ASUS_HANDLE(pled_set, ASUS_HOTK_PREFIX "PLED"); /* A7J */
120ASUS_HANDLE(gled_set, ASUS_HOTK_PREFIX "GLED"); /* G1, G2 (probably) */
106 121
107/* LEDD */ 122/* LEDD */
108ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM"); 123ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM");
@@ -221,6 +236,7 @@ ASUS_LED(mled, "mail");
221ASUS_LED(tled, "touchpad"); 236ASUS_LED(tled, "touchpad");
222ASUS_LED(rled, "record"); 237ASUS_LED(rled, "record");
223ASUS_LED(pled, "phone"); 238ASUS_LED(pled, "phone");
239ASUS_LED(gled, "gaming");
224 240
225/* 241/*
226 * This function evaluates an ACPI method, given an int as parameter, the 242 * This function evaluates an ACPI method, given an int as parameter, the
@@ -245,32 +261,19 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
245 return (status == AE_OK); 261 return (status == AE_OK);
246} 262}
247 263
248static int read_acpi_int(acpi_handle handle, const char *method, int *val,
249 struct acpi_object_list *params)
250{
251 struct acpi_buffer output;
252 union acpi_object out_obj;
253 acpi_status status;
254
255 output.length = sizeof(out_obj);
256 output.pointer = &out_obj;
257
258 status = acpi_evaluate_object(handle, (char *)method, params, &output);
259 *val = out_obj.integer.value;
260 return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER);
261}
262
263static int read_wireless_status(int mask) 264static int read_wireless_status(int mask)
264{ 265{
265 int status; 266 ulong status;
267 acpi_status rv = AE_OK;
266 268
267 if (!wireless_status_handle) 269 if (!wireless_status_handle)
268 return (hotk->status & mask) ? 1 : 0; 270 return (hotk->status & mask) ? 1 : 0;
269 271
270 if (read_acpi_int(wireless_status_handle, NULL, &status, NULL)) { 272 rv = acpi_evaluate_integer(wireless_status_handle, NULL, NULL, &status);
271 return (status & mask) ? 1 : 0; 273 if (ACPI_FAILURE(rv))
272 } else
273 printk(ASUS_WARNING "Error reading Wireless status\n"); 274 printk(ASUS_WARNING "Error reading Wireless status\n");
275 else
276 return (status & mask) ? 1 : 0;
274 277
275 return (hotk->status & mask) ? 1 : 0; 278 return (hotk->status & mask) ? 1 : 0;
276} 279}
@@ -285,19 +288,28 @@ static int read_status(int mask)
285 return (hotk->status & mask) ? 1 : 0; 288 return (hotk->status & mask) ? 1 : 0;
286} 289}
287 290
288static void write_status(acpi_handle handle, int out, int mask, int invert) 291static void write_status(acpi_handle handle, int out, int mask)
289{ 292{
290 hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask); 293 hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask);
291 294
292 if (invert) /* invert target value */ 295 switch (mask) {
296 case MLED_ON:
293 out = !out & 0x1; 297 out = !out & 0x1;
298 break;
299 case GLED_ON:
300 out = (out & 0x1) + 1;
301 break;
302 default:
303 out &= 0x1;
304 break;
305 }
294 306
295 if (handle && !write_acpi_int(handle, NULL, out, NULL)) 307 if (handle && !write_acpi_int(handle, NULL, out, NULL))
296 printk(ASUS_WARNING " write failed\n"); 308 printk(ASUS_WARNING " write failed %x\n", mask);
297} 309}
298 310
299/* /sys/class/led handlers */ 311/* /sys/class/led handlers */
300#define ASUS_LED_HANDLER(object, mask, invert) \ 312#define ASUS_LED_HANDLER(object, mask) \
301 static void object##_led_set(struct led_classdev *led_cdev, \ 313 static void object##_led_set(struct led_classdev *led_cdev, \
302 enum led_brightness value) \ 314 enum led_brightness value) \
303 { \ 315 { \
@@ -307,13 +319,14 @@ static void write_status(acpi_handle handle, int out, int mask, int invert)
307 static void object##_led_update(struct work_struct *ignored) \ 319 static void object##_led_update(struct work_struct *ignored) \
308 { \ 320 { \
309 int value = object##_led_wk; \ 321 int value = object##_led_wk; \
310 write_status(object##_set_handle, value, (mask), (invert)); \ 322 write_status(object##_set_handle, value, (mask)); \
311 } 323 }
312 324
313ASUS_LED_HANDLER(mled, MLED_ON, 1); 325ASUS_LED_HANDLER(mled, MLED_ON);
314ASUS_LED_HANDLER(pled, PLED_ON, 0); 326ASUS_LED_HANDLER(pled, PLED_ON);
315ASUS_LED_HANDLER(rled, RLED_ON, 0); 327ASUS_LED_HANDLER(rled, RLED_ON);
316ASUS_LED_HANDLER(tled, TLED_ON, 0); 328ASUS_LED_HANDLER(tled, TLED_ON);
329ASUS_LED_HANDLER(gled, GLED_ON);
317 330
318static int get_lcd_state(void) 331static int get_lcd_state(void)
319{ 332{
@@ -338,7 +351,7 @@ static int set_lcd_state(int value)
338 printk(ASUS_WARNING "Error switching LCD\n"); 351 printk(ASUS_WARNING "Error switching LCD\n");
339 } 352 }
340 353
341 write_status(NULL, lcd, LCD_ON, 0); 354 write_status(NULL, lcd, LCD_ON);
342 return 0; 355 return 0;
343} 356}
344 357
@@ -354,9 +367,11 @@ static void lcd_blank(int blank)
354 367
355static int read_brightness(struct backlight_device *bd) 368static int read_brightness(struct backlight_device *bd)
356{ 369{
357 int value; 370 ulong value;
371 acpi_status rv = AE_OK;
358 372
359 if (!read_acpi_int(brightness_get_handle, NULL, &value, NULL)) 373 rv = acpi_evaluate_integer(brightness_get_handle, NULL, NULL, &value);
374 if (ACPI_FAILURE(rv))
360 printk(ASUS_WARNING "Error reading brightness\n"); 375 printk(ASUS_WARNING "Error reading brightness\n");
361 376
362 return value; 377 return value;
@@ -403,8 +418,10 @@ static ssize_t show_infos(struct device *dev,
403 struct device_attribute *attr, char *page) 418 struct device_attribute *attr, char *page)
404{ 419{
405 int len = 0; 420 int len = 0;
406 int temp; 421 ulong temp;
407 char buf[16]; //enough for all info 422 char buf[16]; //enough for all info
423 acpi_status rv = AE_OK;
424
408 /* 425 /*
409 * We use the easy way, we don't care of off and count, so we don't set eof 426 * We use the easy way, we don't care of off and count, so we don't set eof
410 * to 1 427 * to 1
@@ -418,9 +435,10 @@ static ssize_t show_infos(struct device *dev,
418 * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card. 435 * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card.
419 * The significance of others is yet to be found. 436 * The significance of others is yet to be found.
420 */ 437 */
421 if (read_acpi_int(hotk->handle, "SFUN", &temp, NULL)) 438 rv = acpi_evaluate_integer(hotk->handle, "SFUN", NULL, &temp);
422 len += 439 if (!ACPI_FAILURE(rv))
423 sprintf(page + len, "SFUN value : 0x%04x\n", temp); 440 len += sprintf(page + len, "SFUN value : 0x%04x\n",
441 (uint) temp);
424 /* 442 /*
425 * Another value for userspace: the ASYM method returns 0x02 for 443 * Another value for userspace: the ASYM method returns 0x02 for
426 * battery low and 0x04 for battery critical, its readings tend to be 444 * battery low and 0x04 for battery critical, its readings tend to be
@@ -428,9 +446,10 @@ static ssize_t show_infos(struct device *dev,
428 * Note: since not all the laptops provide this method, errors are 446 * Note: since not all the laptops provide this method, errors are
429 * silently ignored. 447 * silently ignored.
430 */ 448 */
431 if (read_acpi_int(hotk->handle, "ASYM", &temp, NULL)) 449 rv = acpi_evaluate_integer(hotk->handle, "ASYM", NULL, &temp);
432 len += 450 if (!ACPI_FAILURE(rv))
433 sprintf(page + len, "ASYM value : 0x%04x\n", temp); 451 len += sprintf(page + len, "ASYM value : 0x%04x\n",
452 (uint) temp);
434 if (asus_info) { 453 if (asus_info) {
435 snprintf(buf, 16, "%d", asus_info->length); 454 snprintf(buf, 16, "%d", asus_info->length);
436 len += sprintf(page + len, "DSDT length : %s\n", buf); 455 len += sprintf(page + len, "DSDT length : %s\n", buf);
@@ -465,7 +484,7 @@ static int parse_arg(const char *buf, unsigned long count, int *val)
465} 484}
466 485
467static ssize_t store_status(const char *buf, size_t count, 486static ssize_t store_status(const char *buf, size_t count,
468 acpi_handle handle, int mask, int invert) 487 acpi_handle handle, int mask)
469{ 488{
470 int rv, value; 489 int rv, value;
471 int out = 0; 490 int out = 0;
@@ -474,7 +493,7 @@ static ssize_t store_status(const char *buf, size_t count,
474 if (rv > 0) 493 if (rv > 0)
475 out = value ? 1 : 0; 494 out = value ? 1 : 0;
476 495
477 write_status(handle, out, mask, invert); 496 write_status(handle, out, mask);
478 497
479 return rv; 498 return rv;
480} 499}
@@ -515,7 +534,7 @@ static ssize_t show_wlan(struct device *dev,
515static ssize_t store_wlan(struct device *dev, struct device_attribute *attr, 534static ssize_t store_wlan(struct device *dev, struct device_attribute *attr,
516 const char *buf, size_t count) 535 const char *buf, size_t count)
517{ 536{
518 return store_status(buf, count, wl_switch_handle, WL_ON, 0); 537 return store_status(buf, count, wl_switch_handle, WL_ON);
519} 538}
520 539
521/* 540/*
@@ -531,7 +550,7 @@ static ssize_t store_bluetooth(struct device *dev,
531 struct device_attribute *attr, const char *buf, 550 struct device_attribute *attr, const char *buf,
532 size_t count) 551 size_t count)
533{ 552{
534 return store_status(buf, count, bt_switch_handle, BT_ON, 0); 553 return store_status(buf, count, bt_switch_handle, BT_ON);
535} 554}
536 555
537/* 556/*
@@ -547,12 +566,15 @@ static void set_display(int value)
547 566
548static int read_display(void) 567static int read_display(void)
549{ 568{
550 int value = 0; 569 ulong value = 0;
570 acpi_status rv = AE_OK;
551 571
552 /* In most of the case, we know how to set the display, but sometime 572 /* In most of the case, we know how to set the display, but sometime
553 we can't read it */ 573 we can't read it */
554 if (display_get_handle) { 574 if (display_get_handle) {
555 if (!read_acpi_int(display_get_handle, NULL, &value, NULL)) 575 rv = acpi_evaluate_integer(display_get_handle, NULL,
576 NULL, &value);
577 if (ACPI_FAILURE(rv))
556 printk(ASUS_WARNING "Error reading display status\n"); 578 printk(ASUS_WARNING "Error reading display status\n");
557 } 579 }
558 580
@@ -656,10 +678,10 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
656 * switched 678 * switched
657 */ 679 */
658 if (event == ATKD_LCD_ON) { 680 if (event == ATKD_LCD_ON) {
659 write_status(NULL, 1, LCD_ON, 0); 681 write_status(NULL, 1, LCD_ON);
660 lcd_blank(FB_BLANK_UNBLANK); 682 lcd_blank(FB_BLANK_UNBLANK);
661 } else if (event == ATKD_LCD_OFF) { 683 } else if (event == ATKD_LCD_OFF) {
662 write_status(NULL, 0, LCD_ON, 0); 684 write_status(NULL, 0, LCD_ON);
663 lcd_blank(FB_BLANK_POWERDOWN); 685 lcd_blank(FB_BLANK_POWERDOWN);
664 } 686 }
665 687
@@ -771,7 +793,7 @@ static int asus_hotk_get_info(void)
771{ 793{
772 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 794 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
773 union acpi_object *model = NULL; 795 union acpi_object *model = NULL;
774 int bsts_result, hwrs_result; 796 ulong bsts_result, hwrs_result;
775 char *string = NULL; 797 char *string = NULL;
776 acpi_status status; 798 acpi_status status;
777 799
@@ -794,11 +816,16 @@ static int asus_hotk_get_info(void)
794 } 816 }
795 817
796 /* This needs to be called for some laptops to init properly */ 818 /* This needs to be called for some laptops to init properly */
797 if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result, NULL)) 819 status =
820 acpi_evaluate_integer(hotk->handle, "BSTS", NULL, &bsts_result);
821 if (ACPI_FAILURE(status))
798 printk(ASUS_WARNING "Error calling BSTS\n"); 822 printk(ASUS_WARNING "Error calling BSTS\n");
799 else if (bsts_result) 823 else if (bsts_result)
800 printk(ASUS_NOTICE "BSTS called, 0x%02x returned\n", 824 printk(ASUS_NOTICE "BSTS called, 0x%02x returned\n",
801 bsts_result); 825 (uint) bsts_result);
826
827 /* This too ... */
828 write_acpi_int(hotk->handle, "CWAP", wapf, NULL);
802 829
803 /* 830 /*
804 * Try to match the object returned by INIT to the specific model. 831 * Try to match the object returned by INIT to the specific model.
@@ -831,6 +858,7 @@ static int asus_hotk_get_info(void)
831 ASUS_HANDLE_INIT(tled_set); 858 ASUS_HANDLE_INIT(tled_set);
832 ASUS_HANDLE_INIT(rled_set); 859 ASUS_HANDLE_INIT(rled_set);
833 ASUS_HANDLE_INIT(pled_set); 860 ASUS_HANDLE_INIT(pled_set);
861 ASUS_HANDLE_INIT(gled_set);
834 862
835 ASUS_HANDLE_INIT(ledd_set); 863 ASUS_HANDLE_INIT(ledd_set);
836 864
@@ -840,7 +868,9 @@ static int asus_hotk_get_info(void)
840 * The significance of others is yet to be found. 868 * The significance of others is yet to be found.
841 * If we don't find the method, we assume the device are present. 869 * If we don't find the method, we assume the device are present.
842 */ 870 */
843 if (!read_acpi_int(hotk->handle, "HRWS", &hwrs_result, NULL)) 871 status =
872 acpi_evaluate_integer(hotk->handle, "HRWS", NULL, &hwrs_result);
873 if (ACPI_FAILURE(status))
844 hwrs_result = WL_HWRS | BT_HWRS; 874 hwrs_result = WL_HWRS | BT_HWRS;
845 875
846 if (hwrs_result & WL_HWRS) 876 if (hwrs_result & WL_HWRS)
@@ -928,11 +958,15 @@ static int asus_hotk_add(struct acpi_device *device)
928 asus_hotk_found = 1; 958 asus_hotk_found = 1;
929 959
930 /* WLED and BLED are on by default */ 960 /* WLED and BLED are on by default */
931 write_status(bt_switch_handle, 1, BT_ON, 0); 961 write_status(bt_switch_handle, 1, BT_ON);
932 write_status(wl_switch_handle, 1, WL_ON, 0); 962 write_status(wl_switch_handle, 1, WL_ON);
963
964 /* If the h/w switch is off, we need to check the real status */
965 write_status(NULL, read_status(BT_ON), BT_ON);
966 write_status(NULL, read_status(WL_ON), WL_ON);
933 967
934 /* LCD Backlight is on by default */ 968 /* LCD Backlight is on by default */
935 write_status(NULL, 1, LCD_ON, 0); 969 write_status(NULL, 1, LCD_ON);
936 970
937 /* LED display is off by default */ 971 /* LED display is off by default */
938 hotk->ledd_status = 0xFFF; 972 hotk->ledd_status = 0xFFF;
@@ -991,6 +1025,7 @@ static void asus_led_exit(void)
991 ASUS_LED_UNREGISTER(tled); 1025 ASUS_LED_UNREGISTER(tled);
992 ASUS_LED_UNREGISTER(pled); 1026 ASUS_LED_UNREGISTER(pled);
993 ASUS_LED_UNREGISTER(rled); 1027 ASUS_LED_UNREGISTER(rled);
1028 ASUS_LED_UNREGISTER(gled);
994 1029
995 destroy_workqueue(led_workqueue); 1030 destroy_workqueue(led_workqueue);
996} 1031}
@@ -1062,6 +1097,10 @@ static int asus_led_init(struct device *dev)
1062 if (rv) 1097 if (rv)
1063 return rv; 1098 return rv;
1064 1099
1100 rv = ASUS_LED_REGISTER(gled, dev);
1101 if (rv)
1102 return rv;
1103
1065 led_workqueue = create_singlethread_workqueue("led_workqueue"); 1104 led_workqueue = create_singlethread_workqueue("led_workqueue");
1066 if (!led_workqueue) 1105 if (!led_workqueue)
1067 return -ENOMEM; 1106 return -ENOMEM;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c3f9f599f134..a3d46ea37126 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2263,6 +2263,7 @@ config GIANFAR
2263 tristate "Gianfar Ethernet" 2263 tristate "Gianfar Ethernet"
2264 depends on 85xx || 83xx || PPC_86xx 2264 depends on 85xx || 83xx || PPC_86xx
2265 select PHYLIB 2265 select PHYLIB
2266 select CRC32
2266 help 2267 help
2267 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx, 2268 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
2268 and MPC86xx family of chips, and the FEC on the 8540. 2269 and MPC86xx family of chips, and the FEC on the 8540.
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 0b7aded8dcfd..e85f5ec48f96 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.5.7" 57#define DRV_MODULE_VERSION "1.5.8"
58#define DRV_MODULE_RELDATE "March 29, 2007" 58#define DRV_MODULE_RELDATE "April 24, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -3421,6 +3421,9 @@ bnx2_init_chip(struct bnx2 *bp)
3421 val = REG_RD(bp, BNX2_MQ_CONFIG); 3421 val = REG_RD(bp, BNX2_MQ_CONFIG);
3422 val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; 3422 val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE;
3423 val |= BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE_256; 3423 val |= BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE_256;
3424 if (CHIP_ID(bp) == CHIP_ID_5709_A0 || CHIP_ID(bp) == CHIP_ID_5709_A1)
3425 val |= BNX2_MQ_CONFIG_HALT_DIS;
3426
3424 REG_WR(bp, BNX2_MQ_CONFIG, val); 3427 REG_WR(bp, BNX2_MQ_CONFIG, val);
3425 3428
3426 val = 0x10000 + (MAX_CID_CNT * MB_KERNEL_CTX_SIZE); 3429 val = 0x10000 + (MAX_CID_CNT * MB_KERNEL_CTX_SIZE);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index ccbdf81c6599..878eee58f12a 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6518,6 +6518,7 @@ struct bnx2 {
6518#define CHIP_ID_5708_B0 0x57081000 6518#define CHIP_ID_5708_B0 0x57081000
6519#define CHIP_ID_5708_B1 0x57081010 6519#define CHIP_ID_5708_B1 0x57081010
6520#define CHIP_ID_5709_A0 0x57090000 6520#define CHIP_ID_5709_A0 0x57090000
6521#define CHIP_ID_5709_A1 0x57090010
6521 6522
6522#define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) 6523#define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf)
6523 6524
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 97128d88eaef..8d1379633698 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -478,8 +478,11 @@ struct cmac {
478 struct adapter *adapter; 478 struct adapter *adapter;
479 unsigned int offset; 479 unsigned int offset;
480 unsigned int nucast; /* # of address filters for unicast MACs */ 480 unsigned int nucast; /* # of address filters for unicast MACs */
481 unsigned int tcnt; 481 unsigned int tx_tcnt;
482 unsigned int xcnt; 482 unsigned int tx_xcnt;
483 u64 tx_mcnt;
484 unsigned int rx_xcnt;
485 u64 rx_mcnt;
483 unsigned int toggle_cnt; 486 unsigned int toggle_cnt;
484 unsigned int txen; 487 unsigned int txen;
485 struct mac_stats stats; 488 struct mac_stats stats;
diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h
index e14862b43d17..483a594210a7 100644
--- a/drivers/net/cxgb3/cxgb3_defs.h
+++ b/drivers/net/cxgb3/cxgb3_defs.h
@@ -67,7 +67,10 @@ static inline union listen_entry *stid2entry(const struct tid_info *t,
67static inline struct t3c_tid_entry *lookup_tid(const struct tid_info *t, 67static inline struct t3c_tid_entry *lookup_tid(const struct tid_info *t,
68 unsigned int tid) 68 unsigned int tid)
69{ 69{
70 return tid < t->ntids ? &(t->tid_tab[tid]) : NULL; 70 struct t3c_tid_entry *t3c_tid = tid < t->ntids ?
71 &(t->tid_tab[tid]) : NULL;
72
73 return (t3c_tid && t3c_tid->client) ? t3c_tid : NULL;
71} 74}
72 75
73/* 76/*
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 26240fd5e768..67b4b219d927 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -194,15 +194,13 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
194 194
195 if (link_stat != netif_carrier_ok(dev)) { 195 if (link_stat != netif_carrier_ok(dev)) {
196 if (link_stat) { 196 if (link_stat) {
197 t3_set_reg_field(adapter, 197 t3_mac_enable(mac, MAC_DIRECTION_RX);
198 A_XGM_TXFIFO_CFG + mac->offset,
199 F_ENDROPPKT, 0);
200 netif_carrier_on(dev); 198 netif_carrier_on(dev);
201 } else { 199 } else {
202 netif_carrier_off(dev); 200 netif_carrier_off(dev);
203 t3_set_reg_field(adapter, 201 pi->phy.ops->power_down(&pi->phy, 1);
204 A_XGM_TXFIFO_CFG + mac->offset, 202 t3_mac_disable(mac, MAC_DIRECTION_RX);
205 F_ENDROPPKT, F_ENDROPPKT); 203 t3_link_start(&pi->phy, mac, &pi->link_config);
206 } 204 }
207 205
208 link_report(dev); 206 link_report(dev);
@@ -772,6 +770,8 @@ static int cxgb_up(struct adapter *adap)
772 if (err) 770 if (err)
773 goto out; 771 goto out;
774 772
773 t3_write_reg(adap, A_ULPRX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12));
774
775 err = setup_sge_qsets(adap); 775 err = setup_sge_qsets(adap);
776 if (err) 776 if (err)
777 goto out; 777 goto out;
@@ -2119,7 +2119,9 @@ static void check_t3b2_mac(struct adapter *adapter)
2119{ 2119{
2120 int i; 2120 int i;
2121 2121
2122 rtnl_lock(); /* synchronize with ifdown */ 2122 if (!rtnl_trylock()) /* synchronize with ifdown */
2123 return;
2124
2123 for_each_port(adapter, i) { 2125 for_each_port(adapter, i) {
2124 struct net_device *dev = adapter->port[i]; 2126 struct net_device *dev = adapter->port[i];
2125 struct port_info *p = netdev_priv(dev); 2127 struct port_info *p = netdev_priv(dev);
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index eed7a48e3111..199e5066acf3 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -508,6 +508,7 @@ void cxgb3_queue_tid_release(struct t3cdev *tdev, unsigned int tid)
508 508
509 spin_lock_bh(&td->tid_release_lock); 509 spin_lock_bh(&td->tid_release_lock);
510 p->ctx = (void *)td->tid_release_list; 510 p->ctx = (void *)td->tid_release_list;
511 p->client = NULL;
511 td->tid_release_list = p; 512 td->tid_release_list = p;
512 if (!p->ctx) 513 if (!p->ctx)
513 schedule_work(&td->tid_release_task); 514 schedule_work(&td->tid_release_task);
@@ -623,7 +624,8 @@ static int do_act_open_rpl(struct t3cdev *dev, struct sk_buff *skb)
623 struct t3c_tid_entry *t3c_tid; 624 struct t3c_tid_entry *t3c_tid;
624 625
625 t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); 626 t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid);
626 if (t3c_tid->ctx && t3c_tid->client && t3c_tid->client->handlers && 627 if (t3c_tid && t3c_tid->ctx && t3c_tid->client &&
628 t3c_tid->client->handlers &&
627 t3c_tid->client->handlers[CPL_ACT_OPEN_RPL]) { 629 t3c_tid->client->handlers[CPL_ACT_OPEN_RPL]) {
628 return t3c_tid->client->handlers[CPL_ACT_OPEN_RPL] (dev, skb, 630 return t3c_tid->client->handlers[CPL_ACT_OPEN_RPL] (dev, skb,
629 t3c_tid-> 631 t3c_tid->
@@ -642,7 +644,7 @@ static int do_stid_rpl(struct t3cdev *dev, struct sk_buff *skb)
642 struct t3c_tid_entry *t3c_tid; 644 struct t3c_tid_entry *t3c_tid;
643 645
644 t3c_tid = lookup_stid(&(T3C_DATA(dev))->tid_maps, stid); 646 t3c_tid = lookup_stid(&(T3C_DATA(dev))->tid_maps, stid);
645 if (t3c_tid->ctx && t3c_tid->client->handlers && 647 if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers &&
646 t3c_tid->client->handlers[p->opcode]) { 648 t3c_tid->client->handlers[p->opcode]) {
647 return t3c_tid->client->handlers[p->opcode] (dev, skb, 649 return t3c_tid->client->handlers[p->opcode] (dev, skb,
648 t3c_tid->ctx); 650 t3c_tid->ctx);
@@ -660,7 +662,7 @@ static int do_hwtid_rpl(struct t3cdev *dev, struct sk_buff *skb)
660 struct t3c_tid_entry *t3c_tid; 662 struct t3c_tid_entry *t3c_tid;
661 663
662 t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); 664 t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid);
663 if (t3c_tid->ctx && t3c_tid->client->handlers && 665 if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers &&
664 t3c_tid->client->handlers[p->opcode]) { 666 t3c_tid->client->handlers[p->opcode]) {
665 return t3c_tid->client->handlers[p->opcode] 667 return t3c_tid->client->handlers[p->opcode]
666 (dev, skb, t3c_tid->ctx); 668 (dev, skb, t3c_tid->ctx);
@@ -689,6 +691,28 @@ static int do_cr(struct t3cdev *dev, struct sk_buff *skb)
689 } 691 }
690} 692}
691 693
694/*
695 * Returns an sk_buff for a reply CPL message of size len. If the input
696 * sk_buff has no other users it is trimmed and reused, otherwise a new buffer
697 * is allocated. The input skb must be of size at least len. Note that this
698 * operation does not destroy the original skb data even if it decides to reuse
699 * the buffer.
700 */
701static struct sk_buff *cxgb3_get_cpl_reply_skb(struct sk_buff *skb, size_t len,
702 int gfp)
703{
704 if (likely(!skb_cloned(skb))) {
705 BUG_ON(skb->len < len);
706 __skb_trim(skb, len);
707 skb_get(skb);
708 } else {
709 skb = alloc_skb(len, gfp);
710 if (skb)
711 __skb_put(skb, len);
712 }
713 return skb;
714}
715
692static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb) 716static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb)
693{ 717{
694 union opcode_tid *p = cplhdr(skb); 718 union opcode_tid *p = cplhdr(skb);
@@ -696,30 +720,39 @@ static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb)
696 struct t3c_tid_entry *t3c_tid; 720 struct t3c_tid_entry *t3c_tid;
697 721
698 t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); 722 t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid);
699 if (t3c_tid->ctx && t3c_tid->client->handlers && 723 if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers &&
700 t3c_tid->client->handlers[p->opcode]) { 724 t3c_tid->client->handlers[p->opcode]) {
701 return t3c_tid->client->handlers[p->opcode] 725 return t3c_tid->client->handlers[p->opcode]
702 (dev, skb, t3c_tid->ctx); 726 (dev, skb, t3c_tid->ctx);
703 } else { 727 } else {
704 struct cpl_abort_req_rss *req = cplhdr(skb); 728 struct cpl_abort_req_rss *req = cplhdr(skb);
705 struct cpl_abort_rpl *rpl; 729 struct cpl_abort_rpl *rpl;
730 struct sk_buff *reply_skb;
731 unsigned int tid = GET_TID(req);
732 u8 cmd = req->status;
733
734 if (req->status == CPL_ERR_RTX_NEG_ADVICE ||
735 req->status == CPL_ERR_PERSIST_NEG_ADVICE)
736 goto out;
706 737
707 struct sk_buff *skb = 738 reply_skb = cxgb3_get_cpl_reply_skb(skb,
708 alloc_skb(sizeof(struct cpl_abort_rpl), GFP_ATOMIC); 739 sizeof(struct
709 if (!skb) { 740 cpl_abort_rpl),
741 GFP_ATOMIC);
742
743 if (!reply_skb) {
710 printk("do_abort_req_rss: couldn't get skb!\n"); 744 printk("do_abort_req_rss: couldn't get skb!\n");
711 goto out; 745 goto out;
712 } 746 }
713 skb->priority = CPL_PRIORITY_DATA; 747 reply_skb->priority = CPL_PRIORITY_DATA;
714 __skb_put(skb, sizeof(struct cpl_abort_rpl)); 748 __skb_put(reply_skb, sizeof(struct cpl_abort_rpl));
715 rpl = cplhdr(skb); 749 rpl = cplhdr(reply_skb);
716 rpl->wr.wr_hi = 750 rpl->wr.wr_hi =
717 htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL)); 751 htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL));
718 rpl->wr.wr_lo = htonl(V_WR_TID(GET_TID(req))); 752 rpl->wr.wr_lo = htonl(V_WR_TID(tid));
719 OPCODE_TID(rpl) = 753 OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, tid));
720 htonl(MK_OPCODE_TID(CPL_ABORT_RPL, GET_TID(req))); 754 rpl->cmd = cmd;
721 rpl->cmd = req->status; 755 cxgb3_ofld_send(dev, reply_skb);
722 cxgb3_ofld_send(dev, skb);
723out: 756out:
724 return CPL_RET_BUF_DONE; 757 return CPL_RET_BUF_DONE;
725 } 758 }
@@ -732,7 +765,7 @@ static int do_act_establish(struct t3cdev *dev, struct sk_buff *skb)
732 struct t3c_tid_entry *t3c_tid; 765 struct t3c_tid_entry *t3c_tid;
733 766
734 t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); 767 t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid);
735 if (t3c_tid->ctx && t3c_tid->client->handlers && 768 if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers &&
736 t3c_tid->client->handlers[CPL_ACT_ESTABLISH]) { 769 t3c_tid->client->handlers[CPL_ACT_ESTABLISH]) {
737 return t3c_tid->client->handlers[CPL_ACT_ESTABLISH] 770 return t3c_tid->client->handlers[CPL_ACT_ESTABLISH]
738 (dev, skb, t3c_tid->ctx); 771 (dev, skb, t3c_tid->ctx);
@@ -743,17 +776,6 @@ static int do_act_establish(struct t3cdev *dev, struct sk_buff *skb)
743 } 776 }
744} 777}
745 778
746static int do_set_tcb_rpl(struct t3cdev *dev, struct sk_buff *skb)
747{
748 struct cpl_set_tcb_rpl *rpl = cplhdr(skb);
749
750 if (rpl->status != CPL_ERR_NONE)
751 printk(KERN_ERR
752 "Unexpected SET_TCB_RPL status %u for tid %u\n",
753 rpl->status, GET_TID(rpl));
754 return CPL_RET_BUF_DONE;
755}
756
757static int do_trace(struct t3cdev *dev, struct sk_buff *skb) 779static int do_trace(struct t3cdev *dev, struct sk_buff *skb)
758{ 780{
759 struct cpl_trace_pkt *p = cplhdr(skb); 781 struct cpl_trace_pkt *p = cplhdr(skb);
@@ -773,7 +795,7 @@ static int do_term(struct t3cdev *dev, struct sk_buff *skb)
773 struct t3c_tid_entry *t3c_tid; 795 struct t3c_tid_entry *t3c_tid;
774 796
775 t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); 797 t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid);
776 if (t3c_tid->ctx && t3c_tid->client->handlers && 798 if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers &&
777 t3c_tid->client->handlers[opcode]) { 799 t3c_tid->client->handlers[opcode]) {
778 return t3c_tid->client->handlers[opcode] (dev, skb, 800 return t3c_tid->client->handlers[opcode] (dev, skb,
779 t3c_tid->ctx); 801 t3c_tid->ctx);
@@ -972,7 +994,7 @@ void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
972 for (tid = 0; tid < ti->ntids; tid++) { 994 for (tid = 0; tid < ti->ntids; tid++) {
973 te = lookup_tid(ti, tid); 995 te = lookup_tid(ti, tid);
974 BUG_ON(!te); 996 BUG_ON(!te);
975 if (te->ctx && te->client && te->client->redirect) { 997 if (te && te->ctx && te->client && te->client->redirect) {
976 update_tcb = te->client->redirect(te->ctx, old, new, e); 998 update_tcb = te->client->redirect(te->ctx, old, new, e);
977 if (update_tcb) { 999 if (update_tcb) {
978 l2t_hold(L2DATA(tdev), e); 1000 l2t_hold(L2DATA(tdev), e);
@@ -1215,7 +1237,8 @@ void __init cxgb3_offload_init(void)
1215 t3_register_cpl_handler(CPL_CLOSE_CON_RPL, do_hwtid_rpl); 1237 t3_register_cpl_handler(CPL_CLOSE_CON_RPL, do_hwtid_rpl);
1216 t3_register_cpl_handler(CPL_ABORT_REQ_RSS, do_abort_req_rss); 1238 t3_register_cpl_handler(CPL_ABORT_REQ_RSS, do_abort_req_rss);
1217 t3_register_cpl_handler(CPL_ACT_ESTABLISH, do_act_establish); 1239 t3_register_cpl_handler(CPL_ACT_ESTABLISH, do_act_establish);
1218 t3_register_cpl_handler(CPL_SET_TCB_RPL, do_set_tcb_rpl); 1240 t3_register_cpl_handler(CPL_SET_TCB_RPL, do_hwtid_rpl);
1241 t3_register_cpl_handler(CPL_GET_TCB_RPL, do_hwtid_rpl);
1219 t3_register_cpl_handler(CPL_RDMA_TERMINATE, do_term); 1242 t3_register_cpl_handler(CPL_RDMA_TERMINATE, do_term);
1220 t3_register_cpl_handler(CPL_RDMA_EC_STATUS, do_hwtid_rpl); 1243 t3_register_cpl_handler(CPL_RDMA_EC_STATUS, do_hwtid_rpl);
1221 t3_register_cpl_handler(CPL_TRACE_PKT, do_trace); 1244 t3_register_cpl_handler(CPL_TRACE_PKT, do_trace);
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index f8be41c5a081..e5a553410e24 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1234,9 +1234,15 @@
1234 1234
1235#define A_ULPRX_ISCSI_TAGMASK 0x514 1235#define A_ULPRX_ISCSI_TAGMASK 0x514
1236 1236
1237#define S_HPZ0 0
1238#define M_HPZ0 0xf
1239#define V_HPZ0(x) ((x) << S_HPZ0)
1240#define G_HPZ0(x) (((x) >> S_HPZ0) & M_HPZ0)
1241
1237#define A_ULPRX_TDDP_LLIMIT 0x51c 1242#define A_ULPRX_TDDP_LLIMIT 0x51c
1238 1243
1239#define A_ULPRX_TDDP_ULIMIT 0x520 1244#define A_ULPRX_TDDP_ULIMIT 0x520
1245#define A_ULPRX_TDDP_PSZ 0x528
1240 1246
1241#define A_ULPRX_STAG_LLIMIT 0x52c 1247#define A_ULPRX_STAG_LLIMIT 0x52c
1242 1248
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index d83f075ef2d7..fb485d0a43d8 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1523,19 +1523,25 @@ static int mac_intr_handler(struct adapter *adap, unsigned int idx)
1523 */ 1523 */
1524int t3_phy_intr_handler(struct adapter *adapter) 1524int t3_phy_intr_handler(struct adapter *adapter)
1525{ 1525{
1526 static const int intr_gpio_bits[] = { 8, 0x20 }; 1526 u32 mask, gpi = adapter_info(adapter)->gpio_intr;
1527
1528 u32 i, cause = t3_read_reg(adapter, A_T3DBG_INT_CAUSE); 1527 u32 i, cause = t3_read_reg(adapter, A_T3DBG_INT_CAUSE);
1529 1528
1530 for_each_port(adapter, i) { 1529 for_each_port(adapter, i) {
1531 if (cause & intr_gpio_bits[i]) { 1530 struct port_info *p = adap2pinfo(adapter, i);
1532 struct cphy *phy = &adap2pinfo(adapter, i)->phy; 1531
1533 int phy_cause = phy->ops->intr_handler(phy); 1532 mask = gpi - (gpi & (gpi - 1));
1533 gpi -= mask;
1534
1535 if (!(p->port_type->caps & SUPPORTED_IRQ))
1536 continue;
1537
1538 if (cause & mask) {
1539 int phy_cause = p->phy.ops->intr_handler(&p->phy);
1534 1540
1535 if (phy_cause & cphy_cause_link_change) 1541 if (phy_cause & cphy_cause_link_change)
1536 t3_link_changed(adapter, i); 1542 t3_link_changed(adapter, i);
1537 if (phy_cause & cphy_cause_fifo_error) 1543 if (phy_cause & cphy_cause_fifo_error)
1538 phy->fifo_errors++; 1544 p->phy.fifo_errors++;
1539 } 1545 }
1540 } 1546 }
1541 1547
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index 94aaff005a35..a506792f9575 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -367,7 +367,8 @@ int t3_mac_enable(struct cmac *mac, int which)
367 int idx = macidx(mac); 367 int idx = macidx(mac);
368 struct adapter *adap = mac->adapter; 368 struct adapter *adap = mac->adapter;
369 unsigned int oft = mac->offset; 369 unsigned int oft = mac->offset;
370 370 struct mac_stats *s = &mac->stats;
371
371 if (which & MAC_DIRECTION_TX) { 372 if (which & MAC_DIRECTION_TX) {
372 t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN); 373 t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN);
373 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); 374 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
@@ -376,10 +377,16 @@ int t3_mac_enable(struct cmac *mac, int which)
376 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx); 377 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx);
377 378
378 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + idx); 379 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + idx);
379 mac->tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, 380 mac->tx_mcnt = s->tx_frames;
380 A_TP_PIO_DATA))); 381 mac->tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
381 mac->xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, 382 A_TP_PIO_DATA)));
382 A_XGM_TX_SPI4_SOP_EOP_CNT))); 383 mac->tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
384 A_XGM_TX_SPI4_SOP_EOP_CNT +
385 oft)));
386 mac->rx_mcnt = s->rx_frames;
387 mac->rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
388 A_XGM_RX_SPI4_SOP_EOP_CNT +
389 oft)));
383 mac->txen = F_TXEN; 390 mac->txen = F_TXEN;
384 mac->toggle_cnt = 0; 391 mac->toggle_cnt = 0;
385 } 392 }
@@ -392,6 +399,7 @@ int t3_mac_disable(struct cmac *mac, int which)
392{ 399{
393 int idx = macidx(mac); 400 int idx = macidx(mac);
394 struct adapter *adap = mac->adapter; 401 struct adapter *adap = mac->adapter;
402 int val;
395 403
396 if (which & MAC_DIRECTION_TX) { 404 if (which & MAC_DIRECTION_TX) {
397 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); 405 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);
@@ -401,44 +409,89 @@ int t3_mac_disable(struct cmac *mac, int which)
401 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx); 409 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx);
402 mac->txen = 0; 410 mac->txen = 0;
403 } 411 }
404 if (which & MAC_DIRECTION_RX) 412 if (which & MAC_DIRECTION_RX) {
413 t3_set_reg_field(mac->adapter, A_XGM_RESET_CTRL + mac->offset,
414 F_PCS_RESET_, 0);
415 msleep(100);
405 t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0); 416 t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0);
417 val = F_MAC_RESET_;
418 if (is_10G(adap))
419 val |= F_PCS_RESET_;
420 else if (uses_xaui(adap))
421 val |= F_PCS_RESET_ | F_XG2G_RESET_;
422 else
423 val |= F_RGMII_RESET_ | F_XG2G_RESET_;
424 t3_write_reg(mac->adapter, A_XGM_RESET_CTRL + mac->offset, val);
425 }
406 return 0; 426 return 0;
407} 427}
408 428
409int t3b2_mac_watchdog_task(struct cmac *mac) 429int t3b2_mac_watchdog_task(struct cmac *mac)
410{ 430{
411 struct adapter *adap = mac->adapter; 431 struct adapter *adap = mac->adapter;
412 unsigned int tcnt, xcnt; 432 struct mac_stats *s = &mac->stats;
433 unsigned int tx_tcnt, tx_xcnt;
434 unsigned int tx_mcnt = s->tx_frames;
435 unsigned int rx_mcnt = s->rx_frames;
436 unsigned int rx_xcnt;
413 int status; 437 int status;
414 438
415 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + macidx(mac)); 439 if (tx_mcnt == mac->tx_mcnt) {
416 tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, A_TP_PIO_DATA))); 440 tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
417 xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, 441 A_XGM_TX_SPI4_SOP_EOP_CNT +
418 A_XGM_TX_SPI4_SOP_EOP_CNT + 442 mac->offset)));
419 mac->offset))); 443 if (tx_xcnt == 0) {
420 444 t3_write_reg(adap, A_TP_PIO_ADDR,
421 if (tcnt != mac->tcnt && xcnt == 0 && mac->xcnt == 0) { 445 A_TP_TX_DROP_CNT_CH0 + macidx(mac));
422 if (mac->toggle_cnt > 4) { 446 tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
423 t3b2_mac_reset(mac); 447 A_TP_PIO_DATA)));
448 } else {
424 mac->toggle_cnt = 0; 449 mac->toggle_cnt = 0;
450 return 0;
451 }
452 } else {
453 mac->toggle_cnt = 0;
454 return 0;
455 }
456
457 if (((tx_tcnt != mac->tx_tcnt) &&
458 (tx_xcnt == 0) && (mac->tx_xcnt == 0)) ||
459 ((mac->tx_mcnt == tx_mcnt) &&
460 (tx_xcnt != 0) && (mac->tx_xcnt != 0))) {
461 if (mac->toggle_cnt > 4)
425 status = 2; 462 status = 2;
426 } else { 463 else
427 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);
428 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset);
429 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset,
430 mac->txen);
431 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset);
432 mac->toggle_cnt++;
433 status = 1; 464 status = 1;
434 }
435 } else { 465 } else {
436 mac->toggle_cnt = 0; 466 mac->toggle_cnt = 0;
437 status = 0; 467 return 0;
438 } 468 }
439 mac->tcnt = tcnt;
440 mac->xcnt = xcnt;
441 469
470 if (rx_mcnt != mac->rx_mcnt)
471 rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
472 A_XGM_RX_SPI4_SOP_EOP_CNT +
473 mac->offset)));
474 else
475 return 0;
476
477 if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0)
478 status = 2;
479
480 mac->tx_tcnt = tx_tcnt;
481 mac->tx_xcnt = tx_xcnt;
482 mac->tx_mcnt = s->tx_frames;
483 mac->rx_xcnt = rx_xcnt;
484 mac->rx_mcnt = s->rx_frames;
485 if (status == 1) {
486 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);
487 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset); /* flush */
488 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, mac->txen);
489 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset); /* flush */
490 mac->toggle_cnt++;
491 } else if (status == 2) {
492 t3b2_mac_reset(mac);
493 mac->toggle_cnt = 0;
494 }
442 return status; 495 return status;
443} 496}
444 497
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index 5113eef755b9..f3807aaf10aa 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -1491,8 +1491,9 @@ static void __init depca_platform_probe (void)
1491 depca_io_ports[i].device = pldev; 1491 depca_io_ports[i].device = pldev;
1492 1492
1493 if (platform_device_add(pldev)) { 1493 if (platform_device_add(pldev)) {
1494 platform_device_put(pldev);
1495 depca_io_ports[i].device = NULL; 1494 depca_io_ports[i].device = NULL;
1495 pldev->dev.platform_data = NULL;
1496 platform_device_put(pldev);
1496 continue; 1497 continue;
1497 } 1498 }
1498 1499
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 1d08e937af82..b28a915bd980 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3796,7 +3796,7 @@ e1000_intr_msi(int irq, void *data)
3796 3796
3797 for (i = 0; i < E1000_MAX_INTR; i++) 3797 for (i = 0; i < E1000_MAX_INTR; i++)
3798 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & 3798 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
3799 e1000_clean_tx_irq(adapter, adapter->tx_ring))) 3799 !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
3800 break; 3800 break;
3801 3801
3802 if (likely(adapter->itr_setting & 3)) 3802 if (likely(adapter->itr_setting & 3))
@@ -3899,7 +3899,7 @@ e1000_intr(int irq, void *data)
3899 3899
3900 for (i = 0; i < E1000_MAX_INTR; i++) 3900 for (i = 0; i < E1000_MAX_INTR; i++)
3901 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & 3901 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
3902 e1000_clean_tx_irq(adapter, adapter->tx_ring))) 3902 !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
3903 break; 3903 break;
3904 3904
3905 if (likely(adapter->itr_setting & 3)) 3905 if (likely(adapter->itr_setting & 3))
@@ -3949,7 +3949,7 @@ e1000_clean(struct net_device *poll_dev, int *budget)
3949 poll_dev->quota -= work_done; 3949 poll_dev->quota -= work_done;
3950 3950
3951 /* If no Tx and not enough Rx work done, exit the polling mode */ 3951 /* If no Tx and not enough Rx work done, exit the polling mode */
3952 if ((tx_cleaned && (work_done < work_to_do)) || 3952 if ((!tx_cleaned && (work_done == 0)) ||
3953 !netif_running(poll_dev)) { 3953 !netif_running(poll_dev)) {
3954quit_polling: 3954quit_polling:
3955 if (likely(adapter->itr_setting & 3)) 3955 if (likely(adapter->itr_setting & 3))
@@ -3979,7 +3979,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3979#ifdef CONFIG_E1000_NAPI 3979#ifdef CONFIG_E1000_NAPI
3980 unsigned int count = 0; 3980 unsigned int count = 0;
3981#endif 3981#endif
3982 boolean_t cleaned = TRUE; 3982 boolean_t cleaned = FALSE;
3983 unsigned int total_tx_bytes=0, total_tx_packets=0; 3983 unsigned int total_tx_bytes=0, total_tx_packets=0;
3984 3984
3985 i = tx_ring->next_to_clean; 3985 i = tx_ring->next_to_clean;
@@ -4013,10 +4013,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
4013#ifdef CONFIG_E1000_NAPI 4013#ifdef CONFIG_E1000_NAPI
4014#define E1000_TX_WEIGHT 64 4014#define E1000_TX_WEIGHT 64
4015 /* weight of a sort for tx, to avoid endless transmit cleanup */ 4015 /* weight of a sort for tx, to avoid endless transmit cleanup */
4016 if (count++ == E1000_TX_WEIGHT) { 4016 if (count++ == E1000_TX_WEIGHT) break;
4017 cleaned = FALSE;
4018 break;
4019 }
4020#endif 4017#endif
4021 } 4018 }
4022 4019
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
index 59214e74b9cf..30baf6ecfc63 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -75,12 +75,14 @@
75#include <linux/ioport.h> 75#include <linux/ioport.h>
76#include <linux/string.h> 76#include <linux/string.h>
77#include <linux/init.h> 77#include <linux/init.h>
78#include <asm/uaccess.h>
79#include <asm/io.h>
80#include <linux/hdlcdrv.h> 78#include <linux/hdlcdrv.h>
81#include <linux/baycom.h> 79#include <linux/baycom.h>
82#include <linux/jiffies.h> 80#include <linux/jiffies.h>
83 81
82#include <asm/uaccess.h>
83#include <asm/io.h>
84#include <asm/irq.h>
85
84/* --------------------------------------------------------------------- */ 86/* --------------------------------------------------------------------- */
85 87
86#define BAYCOM_DEBUG 88#define BAYCOM_DEBUG
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index c216e6a5d235..f8efe0e70a6b 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -71,7 +71,7 @@
71#include "myri10ge_mcp.h" 71#include "myri10ge_mcp.h"
72#include "myri10ge_mcp_gen_header.h" 72#include "myri10ge_mcp_gen_header.h"
73 73
74#define MYRI10GE_VERSION_STR "1.3.0-1.227" 74#define MYRI10GE_VERSION_STR "1.3.0-1.233"
75 75
76MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 76MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
77MODULE_AUTHOR("Maintainer: help@myri.com"); 77MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -900,19 +900,9 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
900 /* try to refill entire ring */ 900 /* try to refill entire ring */
901 while (rx->fill_cnt != (rx->cnt + rx->mask + 1)) { 901 while (rx->fill_cnt != (rx->cnt + rx->mask + 1)) {
902 idx = rx->fill_cnt & rx->mask; 902 idx = rx->fill_cnt & rx->mask;
903 903 if (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE) {
904 if ((bytes < MYRI10GE_ALLOC_SIZE / 2) &&
905 (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE)) {
906 /* we can use part of previous page */ 904 /* we can use part of previous page */
907 get_page(rx->page); 905 get_page(rx->page);
908#if MYRI10GE_ALLOC_SIZE > 4096
909 /* Firmware cannot cross 4K boundary.. */
910 if ((rx->page_offset >> 12) !=
911 ((rx->page_offset + bytes - 1) >> 12)) {
912 rx->page_offset =
913 (rx->page_offset + bytes) & ~4095;
914 }
915#endif
916 } else { 906 } else {
917 /* we need a new page */ 907 /* we need a new page */
918 page = 908 page =
@@ -941,6 +931,13 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
941 931
942 /* start next packet on a cacheline boundary */ 932 /* start next packet on a cacheline boundary */
943 rx->page_offset += SKB_DATA_ALIGN(bytes); 933 rx->page_offset += SKB_DATA_ALIGN(bytes);
934
935#if MYRI10GE_ALLOC_SIZE > 4096
936 /* don't cross a 4KB boundary */
937 if ((rx->page_offset >> 12) !=
938 ((rx->page_offset + bytes - 1) >> 12))
939 rx->page_offset = (rx->page_offset + 4096) & ~4095;
940#endif
944 rx->fill_cnt++; 941 rx->fill_cnt++;
945 942
946 /* copy 8 descriptors to the firmware at a time */ 943 /* copy 8 descriptors to the firmware at a time */
@@ -2490,6 +2487,10 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
2490 2487
2491#define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7 2488#define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7
2492#define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa 2489#define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa
2490#define PCI_DEVICE_ID_INTEL_6300ESB_PCIEE1 0x3510
2491#define PCI_DEVICE_ID_INTEL_6300ESB_PCIEE4 0x351b
2492#define PCI_DEVICE_ID_INTEL_E3000_PCIE 0x2779
2493#define PCI_DEVICE_ID_INTEL_E3010_PCIE 0x277a
2493#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST 0x140 2494#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST 0x140
2494#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST 0x142 2495#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST 0x142
2495 2496
@@ -2529,6 +2530,18 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2529 PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST 2530 PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST
2530 && bridge->device <= 2531 && bridge->device <=
2531 PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST) 2532 PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST)
2533 /* All Intel E3000/E3010 PCIE ports */
2534 || (bridge->vendor == PCI_VENDOR_ID_INTEL
2535 && (bridge->device ==
2536 PCI_DEVICE_ID_INTEL_E3000_PCIE
2537 || bridge->device ==
2538 PCI_DEVICE_ID_INTEL_E3010_PCIE))
2539 /* All Intel 6310/6311/6321ESB PCIE ports */
2540 || (bridge->vendor == PCI_VENDOR_ID_INTEL
2541 && bridge->device >=
2542 PCI_DEVICE_ID_INTEL_6300ESB_PCIEE1
2543 && bridge->device <=
2544 PCI_DEVICE_ID_INTEL_6300ESB_PCIEE4)
2532 /* All Intel E5000 PCIE ports */ 2545 /* All Intel E5000 PCIE ports */
2533 || (bridge->vendor == PCI_VENDOR_ID_INTEL 2546 || (bridge->vendor == PCI_VENDOR_ID_INTEL
2534 && bridge->device >= 2547 && bridge->device >=
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 933e2f3c77aa..caabbc408c34 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -802,9 +802,9 @@ process_input_packet(struct asyncppp *ap)
802 802
803 /* check for address/control and protocol compression */ 803 /* check for address/control and protocol compression */
804 p = skb->data; 804 p = skb->data;
805 if (p[0] == PPP_ALLSTATIONS && p[1] == PPP_UI) { 805 if (p[0] == PPP_ALLSTATIONS) {
806 /* chop off address/control */ 806 /* chop off address/control */
807 if (skb->len < 3) 807 if (p[1] != PPP_UI || skb->len < 3)
808 goto err; 808 goto err;
809 p = skb_pull(skb, 2); 809 p = skb_pull(skb, 2);
810 } 810 }
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 4a926f20b6ea..c32c21af3fdd 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -964,7 +964,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
964 goto out; 964 goto out;
965 } 965 }
966 966
967 spin_lock_bh(&priv->lock); 967 spin_lock(&priv->lock);
968 968
969 if (unlikely(!netif_carrier_ok(dev))) { 969 if (unlikely(!netif_carrier_ok(dev))) {
970 err = -ENOLINK; 970 err = -ENOLINK;
@@ -1005,7 +1005,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
1005 netif_stop_queue(dev); 1005 netif_stop_queue(dev);
1006 1006
1007out_unlock: 1007out_unlock:
1008 spin_unlock_bh(&priv->lock); 1008 spin_unlock(&priv->lock);
1009 1009
1010out: 1010out:
1011 dev_kfree_skb(skb); 1011 dev_kfree_skb(skb);
@@ -1042,12 +1042,12 @@ static int sc92031_open(struct net_device *dev)
1042 priv->pm_config = 0; 1042 priv->pm_config = 0;
1043 1043
1044 /* Interrupts already disabled by sc92031_stop or sc92031_probe */ 1044 /* Interrupts already disabled by sc92031_stop or sc92031_probe */
1045 spin_lock(&priv->lock); 1045 spin_lock_bh(&priv->lock);
1046 1046
1047 _sc92031_reset(dev); 1047 _sc92031_reset(dev);
1048 mmiowb(); 1048 mmiowb();
1049 1049
1050 spin_unlock(&priv->lock); 1050 spin_unlock_bh(&priv->lock);
1051 sc92031_enable_interrupts(dev); 1051 sc92031_enable_interrupts(dev);
1052 1052
1053 if (netif_carrier_ok(dev)) 1053 if (netif_carrier_ok(dev))
@@ -1077,13 +1077,13 @@ static int sc92031_stop(struct net_device *dev)
1077 /* Disable interrupts, stop Tx and Rx. */ 1077 /* Disable interrupts, stop Tx and Rx. */
1078 sc92031_disable_interrupts(dev); 1078 sc92031_disable_interrupts(dev);
1079 1079
1080 spin_lock(&priv->lock); 1080 spin_lock_bh(&priv->lock);
1081 1081
1082 _sc92031_disable_tx_rx(dev); 1082 _sc92031_disable_tx_rx(dev);
1083 _sc92031_tx_clear(dev); 1083 _sc92031_tx_clear(dev);
1084 mmiowb(); 1084 mmiowb();
1085 1085
1086 spin_unlock(&priv->lock); 1086 spin_unlock_bh(&priv->lock);
1087 1087
1088 free_irq(pdev->irq, dev); 1088 free_irq(pdev->irq, dev);
1089 pci_free_consistent(pdev, TX_BUF_TOT_LEN, priv->tx_bufs, 1089 pci_free_consistent(pdev, TX_BUF_TOT_LEN, priv->tx_bufs,
@@ -1539,13 +1539,13 @@ static int sc92031_suspend(struct pci_dev *pdev, pm_message_t state)
1539 /* Disable interrupts, stop Tx and Rx. */ 1539 /* Disable interrupts, stop Tx and Rx. */
1540 sc92031_disable_interrupts(dev); 1540 sc92031_disable_interrupts(dev);
1541 1541
1542 spin_lock(&priv->lock); 1542 spin_lock_bh(&priv->lock);
1543 1543
1544 _sc92031_disable_tx_rx(dev); 1544 _sc92031_disable_tx_rx(dev);
1545 _sc92031_tx_clear(dev); 1545 _sc92031_tx_clear(dev);
1546 mmiowb(); 1546 mmiowb();
1547 1547
1548 spin_unlock(&priv->lock); 1548 spin_unlock_bh(&priv->lock);
1549 1549
1550out: 1550out:
1551 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 1551 pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -1565,12 +1565,12 @@ static int sc92031_resume(struct pci_dev *pdev)
1565 goto out; 1565 goto out;
1566 1566
1567 /* Interrupts already disabled by sc92031_suspend */ 1567 /* Interrupts already disabled by sc92031_suspend */
1568 spin_lock(&priv->lock); 1568 spin_lock_bh(&priv->lock);
1569 1569
1570 _sc92031_reset(dev); 1570 _sc92031_reset(dev);
1571 mmiowb(); 1571 mmiowb();
1572 1572
1573 spin_unlock(&priv->lock); 1573 spin_unlock_bh(&priv->lock);
1574 sc92031_enable_interrupts(dev); 1574 sc92031_enable_interrupts(dev);
1575 1575
1576 netif_device_attach(dev); 1576 netif_device_attach(dev);
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index b3750f284279..b2a3b19d773a 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -1755,6 +1755,24 @@ static int sis900_rx(struct net_device *net_dev)
1755 } else { 1755 } else {
1756 struct sk_buff * skb; 1756 struct sk_buff * skb;
1757 1757
1758 pci_unmap_single(sis_priv->pci_dev,
1759 sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
1760 PCI_DMA_FROMDEVICE);
1761
1762 /* refill the Rx buffer, what if there is not enought
1763 * memory for new socket buffer ?? */
1764 if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) {
1765 /*
1766 * Not enough memory to refill the buffer
1767 * so we need to recycle the old one so
1768 * as to avoid creating a memory hole
1769 * in the rx ring
1770 */
1771 skb = sis_priv->rx_skbuff[entry];
1772 sis_priv->stats.rx_dropped++;
1773 goto refill_rx_ring;
1774 }
1775
1758 /* This situation should never happen, but due to 1776 /* This situation should never happen, but due to
1759 some unknow bugs, it is possible that 1777 some unknow bugs, it is possible that
1760 we are working on NULL sk_buff :-( */ 1778 we are working on NULL sk_buff :-( */
@@ -1768,9 +1786,6 @@ static int sis900_rx(struct net_device *net_dev)
1768 break; 1786 break;
1769 } 1787 }
1770 1788
1771 pci_unmap_single(sis_priv->pci_dev,
1772 sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
1773 PCI_DMA_FROMDEVICE);
1774 /* give the socket buffer to upper layers */ 1789 /* give the socket buffer to upper layers */
1775 skb = sis_priv->rx_skbuff[entry]; 1790 skb = sis_priv->rx_skbuff[entry];
1776 skb_put(skb, rx_size); 1791 skb_put(skb, rx_size);
@@ -1783,33 +1798,14 @@ static int sis900_rx(struct net_device *net_dev)
1783 net_dev->last_rx = jiffies; 1798 net_dev->last_rx = jiffies;
1784 sis_priv->stats.rx_bytes += rx_size; 1799 sis_priv->stats.rx_bytes += rx_size;
1785 sis_priv->stats.rx_packets++; 1800 sis_priv->stats.rx_packets++;
1786 1801 sis_priv->dirty_rx++;
1787 /* refill the Rx buffer, what if there is not enought 1802refill_rx_ring:
1788 * memory for new socket buffer ?? */
1789 if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) {
1790 /* not enough memory for skbuff, this makes a
1791 * "hole" on the buffer ring, it is not clear
1792 * how the hardware will react to this kind
1793 * of degenerated buffer */
1794 if (netif_msg_rx_status(sis_priv))
1795 printk(KERN_INFO "%s: Memory squeeze,"
1796 "deferring packet.\n",
1797 net_dev->name);
1798 sis_priv->rx_skbuff[entry] = NULL;
1799 /* reset buffer descriptor state */
1800 sis_priv->rx_ring[entry].cmdsts = 0;
1801 sis_priv->rx_ring[entry].bufptr = 0;
1802 sis_priv->stats.rx_dropped++;
1803 sis_priv->cur_rx++;
1804 break;
1805 }
1806 skb->dev = net_dev; 1803 skb->dev = net_dev;
1807 sis_priv->rx_skbuff[entry] = skb; 1804 sis_priv->rx_skbuff[entry] = skb;
1808 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; 1805 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE;
1809 sis_priv->rx_ring[entry].bufptr = 1806 sis_priv->rx_ring[entry].bufptr =
1810 pci_map_single(sis_priv->pci_dev, skb->data, 1807 pci_map_single(sis_priv->pci_dev, skb->data,
1811 RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 1808 RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
1812 sis_priv->dirty_rx++;
1813 } 1809 }
1814 sis_priv->cur_rx++; 1810 sis_priv->cur_rx++;
1815 entry = sis_priv->cur_rx % NUM_RX_DESC; 1811 entry = sis_priv->cur_rx % NUM_RX_DESC;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 39c6677dff5e..d476a3cc2e94 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -163,27 +163,46 @@ static void skge_wol_init(struct skge_port *skge)
163{ 163{
164 struct skge_hw *hw = skge->hw; 164 struct skge_hw *hw = skge->hw;
165 int port = skge->port; 165 int port = skge->port;
166 enum pause_control save_mode; 166 u16 ctrl;
167 u32 ctrl;
168 167
169 /* Bring hardware out of reset */
170 skge_write16(hw, B0_CTST, CS_RST_CLR); 168 skge_write16(hw, B0_CTST, CS_RST_CLR);
171 skge_write16(hw, SK_REG(port, GMAC_LINK_CTRL), GMLC_RST_CLR); 169 skge_write16(hw, SK_REG(port, GMAC_LINK_CTRL), GMLC_RST_CLR);
172 170
173 skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR); 171 /* Turn on Vaux */
174 skge_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); 172 skge_write8(hw, B0_POWER_CTRL,
173 PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF);
175 174
176 /* Force to 10/100 skge_reset will re-enable on resume */ 175 /* WA code for COMA mode -- clear PHY reset */
177 save_mode = skge->flow_control; 176 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
178 skge->flow_control = FLOW_MODE_SYMMETRIC; 177 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
178 u32 reg = skge_read32(hw, B2_GP_IO);
179 reg |= GP_DIR_9;
180 reg &= ~GP_IO_9;
181 skge_write32(hw, B2_GP_IO, reg);
182 }
179 183
180 ctrl = skge->advertising; 184 skge_write32(hw, SK_REG(port, GPHY_CTRL),
181 skge->advertising &= ~(ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full); 185 GPC_DIS_SLEEP |
186 GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0 |
187 GPC_ANEG_1 | GPC_RST_SET);
182 188
183 skge_phy_reset(skge); 189 skge_write32(hw, SK_REG(port, GPHY_CTRL),
190 GPC_DIS_SLEEP |
191 GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0 |
192 GPC_ANEG_1 | GPC_RST_CLR);
193
194 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR);
195
196 /* Force to 10/100 skge_reset will re-enable on resume */
197 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV,
198 PHY_AN_100FULL | PHY_AN_100HALF |
199 PHY_AN_10FULL | PHY_AN_10HALF| PHY_AN_CSMA);
200 /* no 1000 HD/FD */
201 gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, 0);
202 gm_phy_write(hw, port, PHY_MARV_CTRL,
203 PHY_CT_RESET | PHY_CT_SPS_LSB | PHY_CT_ANE |
204 PHY_CT_RE_CFG | PHY_CT_DUP_MD);
184 205
185 skge->flow_control = save_mode;
186 skge->advertising = ctrl;
187 206
188 /* Set GMAC to no flow control and auto update for speed/duplex */ 207 /* Set GMAC to no flow control and auto update for speed/duplex */
189 gma_write16(hw, port, GM_GP_CTRL, 208 gma_write16(hw, port, GM_GP_CTRL,
@@ -227,12 +246,10 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
227 struct skge_port *skge = netdev_priv(dev); 246 struct skge_port *skge = netdev_priv(dev);
228 struct skge_hw *hw = skge->hw; 247 struct skge_hw *hw = skge->hw;
229 248
230 if (wol->wolopts & wol_supported(hw)) 249 if (wol->wolopts & ~wol_supported(hw))
231 return -EOPNOTSUPP; 250 return -EOPNOTSUPP;
232 251
233 skge->wol = wol->wolopts; 252 skge->wol = wol->wolopts;
234 if (!netif_running(dev))
235 skge_wol_init(skge);
236 return 0; 253 return 0;
237} 254}
238 255
@@ -2535,10 +2552,12 @@ static int skge_down(struct net_device *dev)
2535 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); 2552 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
2536 2553
2537 netif_stop_queue(dev); 2554 netif_stop_queue(dev);
2555
2538 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) 2556 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
2539 del_timer_sync(&skge->link_timer); 2557 del_timer_sync(&skge->link_timer);
2540 2558
2541 netif_poll_disable(dev); 2559 netif_poll_disable(dev);
2560 netif_carrier_off(dev);
2542 2561
2543 spin_lock_irq(&hw->hw_lock); 2562 spin_lock_irq(&hw->hw_lock);
2544 hw->intr_mask &= ~portmask[port]; 2563 hw->intr_mask &= ~portmask[port];
@@ -3765,21 +3784,6 @@ static void __devexit skge_remove(struct pci_dev *pdev)
3765} 3784}
3766 3785
3767#ifdef CONFIG_PM 3786#ifdef CONFIG_PM
3768static int vaux_avail(struct pci_dev *pdev)
3769{
3770 int pm_cap;
3771
3772 pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
3773 if (pm_cap) {
3774 u16 ctl;
3775 pci_read_config_word(pdev, pm_cap + PCI_PM_PMC, &ctl);
3776 if (ctl & PCI_PM_CAP_AUX_POWER)
3777 return 1;
3778 }
3779 return 0;
3780}
3781
3782
3783static int skge_suspend(struct pci_dev *pdev, pm_message_t state) 3787static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
3784{ 3788{
3785 struct skge_hw *hw = pci_get_drvdata(pdev); 3789 struct skge_hw *hw = pci_get_drvdata(pdev);
@@ -3801,10 +3805,6 @@ static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
3801 wol |= skge->wol; 3805 wol |= skge->wol;
3802 } 3806 }
3803 3807
3804 if (wol && vaux_avail(pdev))
3805 skge_write8(hw, B0_POWER_CTRL,
3806 PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF);
3807
3808 skge_write32(hw, B0_IMSK, 0); 3808 skge_write32(hw, B0_IMSK, 0);
3809 pci_enable_wake(pdev, pci_choose_state(pdev, state), wol); 3809 pci_enable_wake(pdev, pci_choose_state(pdev, state), wol);
3810 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 3810 pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -3850,6 +3850,28 @@ out:
3850} 3850}
3851#endif 3851#endif
3852 3852
3853static void skge_shutdown(struct pci_dev *pdev)
3854{
3855 struct skge_hw *hw = pci_get_drvdata(pdev);
3856 int i, wol = 0;
3857
3858 for (i = 0; i < hw->ports; i++) {
3859 struct net_device *dev = hw->dev[i];
3860 struct skge_port *skge = netdev_priv(dev);
3861
3862 if (skge->wol)
3863 skge_wol_init(skge);
3864 wol |= skge->wol;
3865 }
3866
3867 pci_enable_wake(pdev, PCI_D3hot, wol);
3868 pci_enable_wake(pdev, PCI_D3cold, wol);
3869
3870 pci_disable_device(pdev);
3871 pci_set_power_state(pdev, PCI_D3hot);
3872
3873}
3874
3853static struct pci_driver skge_driver = { 3875static struct pci_driver skge_driver = {
3854 .name = DRV_NAME, 3876 .name = DRV_NAME,
3855 .id_table = skge_id_table, 3877 .id_table = skge_id_table,
@@ -3859,6 +3881,7 @@ static struct pci_driver skge_driver = {
3859 .suspend = skge_suspend, 3881 .suspend = skge_suspend,
3860 .resume = skge_resume, 3882 .resume = skge_resume,
3861#endif 3883#endif
3884 .shutdown = skge_shutdown,
3862}; 3885};
3863 3886
3864static int __init skge_init_module(void) 3887static int __init skge_init_module(void)
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index ab0ab92583fe..ac36152c68bf 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -49,7 +49,7 @@
49#include "sky2.h" 49#include "sky2.h"
50 50
51#define DRV_NAME "sky2" 51#define DRV_NAME "sky2"
52#define DRV_VERSION "1.13" 52#define DRV_VERSION "1.14"
53#define PFX DRV_NAME " " 53#define PFX DRV_NAME " "
54 54
55/* 55/*
@@ -123,7 +123,10 @@ static const struct pci_device_id sky2_id_table[] = {
123 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ 123 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */
124 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ 124 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */
125 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ 125 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */
126#ifdef broken
127 /* This device causes data corruption problems that are not resolved */
126 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ 128 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */
129#endif
127 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ 130 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */
128 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ 131 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */
129 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ 132 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */
@@ -510,9 +513,9 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
510 ledover &= ~PHY_M_LED_MO_RX; 513 ledover &= ~PHY_M_LED_MO_RX;
511 } 514 }
512 515
513 if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) { 516 if (hw->chip_id == CHIP_ID_YUKON_EC_U &&
517 hw->chip_rev == CHIP_REV_YU_EC_U_A1) {
514 /* apply fixes in PHY AFE */ 518 /* apply fixes in PHY AFE */
515 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
516 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255); 519 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255);
517 520
518 /* increase differential signal amplitude in 10BASE-T */ 521 /* increase differential signal amplitude in 10BASE-T */
@@ -524,7 +527,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
524 gm_phy_write(hw, port, 0x17, 0x2002); 527 gm_phy_write(hw, port, 0x17, 0x2002);
525 528
526 /* set page register to 0 */ 529 /* set page register to 0 */
527 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 530 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 0);
528 } else if (hw->chip_id != CHIP_ID_YUKON_EX) { 531 } else if (hw->chip_id != CHIP_ID_YUKON_EX) {
529 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); 532 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
530 533
@@ -740,12 +743,17 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
740 if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { 743 if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) {
741 sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); 744 sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8);
742 sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); 745 sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8);
743 if (hw->dev[port]->mtu > ETH_DATA_LEN) { 746
744 /* set Tx GMAC FIFO Almost Empty Threshold */ 747 /* set Tx GMAC FIFO Almost Empty Threshold */
745 sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR), 0x180); 748 sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR),
746 /* Disable Store & Forward mode for TX */ 749 (ECU_JUMBO_WM << 16) | ECU_AE_THR);
747 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_STFW_DIS); 750
748 } 751 if (hw->dev[port]->mtu > ETH_DATA_LEN)
752 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
753 TX_JUMBO_ENA | TX_STFW_DIS);
754 else
755 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
756 TX_JUMBO_DIS | TX_STFW_ENA);
749 } 757 }
750 758
751} 759}
@@ -1278,7 +1286,7 @@ static int sky2_up(struct net_device *dev)
1278 /* Set almost empty threshold */ 1286 /* Set almost empty threshold */
1279 if (hw->chip_id == CHIP_ID_YUKON_EC_U 1287 if (hw->chip_id == CHIP_ID_YUKON_EC_U
1280 && hw->chip_rev == CHIP_REV_YU_EC_U_A0) 1288 && hw->chip_rev == CHIP_REV_YU_EC_U_A0)
1281 sky2_write16(hw, Q_ADDR(txqaddr[port], Q_AL), 0x1a0); 1289 sky2_write16(hw, Q_ADDR(txqaddr[port], Q_AL), ECU_TXFF_LEV);
1282 1290
1283 sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, 1291 sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map,
1284 TX_RING_SIZE - 1); 1292 TX_RING_SIZE - 1);
@@ -1561,6 +1569,7 @@ static int sky2_down(struct net_device *dev)
1561 1569
1562 /* Stop more packets from being queued */ 1570 /* Stop more packets from being queued */
1563 netif_stop_queue(dev); 1571 netif_stop_queue(dev);
1572 netif_carrier_off(dev);
1564 1573
1565 /* Disable port IRQ */ 1574 /* Disable port IRQ */
1566 imask = sky2_read32(hw, B0_IMSK); 1575 imask = sky2_read32(hw, B0_IMSK);
@@ -1583,13 +1592,6 @@ static int sky2_down(struct net_device *dev)
1583 sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), 1592 sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL),
1584 RB_RST_SET | RB_DIS_OP_MD); 1593 RB_RST_SET | RB_DIS_OP_MD);
1585 1594
1586 /* WA for dev. #4.209 */
1587 if (hw->chip_id == CHIP_ID_YUKON_EC_U
1588 && (hw->chip_rev == CHIP_REV_YU_EC_U_A1 || hw->chip_rev == CHIP_REV_YU_EC_U_B0))
1589 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1590 sky2->speed != SPEED_1000 ?
1591 TX_STFW_ENA : TX_STFW_DIS);
1592
1593 ctrl = gma_read16(hw, port, GM_GP_CTRL); 1595 ctrl = gma_read16(hw, port, GM_GP_CTRL);
1594 ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA); 1596 ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA);
1595 gma_write16(hw, port, GM_GP_CTRL, ctrl); 1597 gma_write16(hw, port, GM_GP_CTRL, ctrl);
@@ -1889,6 +1891,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
1889{ 1891{
1890 struct sky2_port *sky2 = netdev_priv(dev); 1892 struct sky2_port *sky2 = netdev_priv(dev);
1891 struct sky2_hw *hw = sky2->hw; 1893 struct sky2_hw *hw = sky2->hw;
1894 unsigned port = sky2->port;
1892 int err; 1895 int err;
1893 u16 ctl, mode; 1896 u16 ctl, mode;
1894 u32 imask; 1897 u32 imask;
@@ -1896,9 +1899,8 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
1896 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) 1899 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
1897 return -EINVAL; 1900 return -EINVAL;
1898 1901
1899 /* TSO on Yukon Ultra and MTU > 1500 not supported */ 1902 if (new_mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_FE)
1900 if (hw->chip_id == CHIP_ID_YUKON_EC_U && new_mtu > ETH_DATA_LEN) 1903 return -EINVAL;
1901 dev->features &= ~NETIF_F_TSO;
1902 1904
1903 if (!netif_running(dev)) { 1905 if (!netif_running(dev)) {
1904 dev->mtu = new_mtu; 1906 dev->mtu = new_mtu;
@@ -1914,8 +1916,18 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
1914 1916
1915 synchronize_irq(hw->pdev->irq); 1917 synchronize_irq(hw->pdev->irq);
1916 1918
1917 ctl = gma_read16(hw, sky2->port, GM_GP_CTRL); 1919 if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) {
1918 gma_write16(hw, sky2->port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA); 1920 if (new_mtu > ETH_DATA_LEN) {
1921 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1922 TX_JUMBO_ENA | TX_STFW_DIS);
1923 dev->features &= NETIF_F_TSO | NETIF_F_SG | NETIF_F_IP_CSUM;
1924 } else
1925 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1926 TX_JUMBO_DIS | TX_STFW_ENA);
1927 }
1928
1929 ctl = gma_read16(hw, port, GM_GP_CTRL);
1930 gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
1919 sky2_rx_stop(sky2); 1931 sky2_rx_stop(sky2);
1920 sky2_rx_clean(sky2); 1932 sky2_rx_clean(sky2);
1921 1933
@@ -1927,9 +1939,9 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
1927 if (dev->mtu > ETH_DATA_LEN) 1939 if (dev->mtu > ETH_DATA_LEN)
1928 mode |= GM_SMOD_JUMBO_ENA; 1940 mode |= GM_SMOD_JUMBO_ENA;
1929 1941
1930 gma_write16(hw, sky2->port, GM_SERIAL_MODE, mode); 1942 gma_write16(hw, port, GM_SERIAL_MODE, mode);
1931 1943
1932 sky2_write8(hw, RB_ADDR(rxqaddr[sky2->port], RB_CTRL), RB_ENA_OP_MD); 1944 sky2_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD);
1933 1945
1934 err = sky2_rx_start(sky2); 1946 err = sky2_rx_start(sky2);
1935 sky2_write32(hw, B0_IMSK, imask); 1947 sky2_write32(hw, B0_IMSK, imask);
@@ -1937,7 +1949,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
1937 if (err) 1949 if (err)
1938 dev_close(dev); 1950 dev_close(dev);
1939 else { 1951 else {
1940 gma_write16(hw, sky2->port, GM_GP_CTRL, ctl); 1952 gma_write16(hw, port, GM_GP_CTRL, ctl);
1941 1953
1942 netif_poll_enable(hw->dev[0]); 1954 netif_poll_enable(hw->dev[0]);
1943 netif_wake_queue(dev); 1955 netif_wake_queue(dev);
@@ -2339,26 +2351,22 @@ static void sky2_mac_intr(struct sky2_hw *hw, unsigned port)
2339 } 2351 }
2340} 2352}
2341 2353
2342/* This should never happen it is a fatal situation */ 2354/* This should never happen it is a bug. */
2343static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port, 2355static void sky2_le_error(struct sky2_hw *hw, unsigned port,
2344 const char *rxtx, u32 mask) 2356 u16 q, unsigned ring_size)
2345{ 2357{
2346 struct net_device *dev = hw->dev[port]; 2358 struct net_device *dev = hw->dev[port];
2347 struct sky2_port *sky2 = netdev_priv(dev); 2359 struct sky2_port *sky2 = netdev_priv(dev);
2348 u32 imask; 2360 unsigned idx;
2349 2361 const u64 *le = (q == Q_R1 || q == Q_R2)
2350 printk(KERN_ERR PFX "%s: %s descriptor error (hardware problem)\n", 2362 ? (u64 *) sky2->rx_le : (u64 *) sky2->tx_le;
2351 dev ? dev->name : "<not registered>", rxtx);
2352 2363
2353 imask = sky2_read32(hw, B0_IMSK); 2364 idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX));
2354 imask &= ~mask; 2365 printk(KERN_ERR PFX "%s: descriptor error q=%#x get=%u [%llx] put=%u\n",
2355 sky2_write32(hw, B0_IMSK, imask); 2366 dev->name, (unsigned) q, idx, (unsigned long long) le[idx],
2367 (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX)));
2356 2368
2357 if (dev) { 2369 sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK);
2358 spin_lock(&sky2->phy_lock);
2359 sky2_link_down(sky2);
2360 spin_unlock(&sky2->phy_lock);
2361 }
2362} 2370}
2363 2371
2364/* If idle then force a fake soft NAPI poll once a second 2372/* If idle then force a fake soft NAPI poll once a second
@@ -2382,23 +2390,15 @@ static void sky2_idle(unsigned long arg)
2382 mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout)); 2390 mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout));
2383} 2391}
2384 2392
2385 2393/* Hardware/software error handling */
2386static int sky2_poll(struct net_device *dev0, int *budget) 2394static void sky2_err_intr(struct sky2_hw *hw, u32 status)
2387{ 2395{
2388 struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw; 2396 if (net_ratelimit())
2389 int work_limit = min(dev0->quota, *budget); 2397 dev_warn(&hw->pdev->dev, "error interrupt status=%#x\n", status);
2390 int work_done = 0;
2391 u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
2392 2398
2393 if (status & Y2_IS_HW_ERR) 2399 if (status & Y2_IS_HW_ERR)
2394 sky2_hw_intr(hw); 2400 sky2_hw_intr(hw);
2395 2401
2396 if (status & Y2_IS_IRQ_PHY1)
2397 sky2_phy_intr(hw, 0);
2398
2399 if (status & Y2_IS_IRQ_PHY2)
2400 sky2_phy_intr(hw, 1);
2401
2402 if (status & Y2_IS_IRQ_MAC1) 2402 if (status & Y2_IS_IRQ_MAC1)
2403 sky2_mac_intr(hw, 0); 2403 sky2_mac_intr(hw, 0);
2404 2404
@@ -2406,16 +2406,33 @@ static int sky2_poll(struct net_device *dev0, int *budget)
2406 sky2_mac_intr(hw, 1); 2406 sky2_mac_intr(hw, 1);
2407 2407
2408 if (status & Y2_IS_CHK_RX1) 2408 if (status & Y2_IS_CHK_RX1)
2409 sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1); 2409 sky2_le_error(hw, 0, Q_R1, RX_LE_SIZE);
2410 2410
2411 if (status & Y2_IS_CHK_RX2) 2411 if (status & Y2_IS_CHK_RX2)
2412 sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2); 2412 sky2_le_error(hw, 1, Q_R2, RX_LE_SIZE);
2413 2413
2414 if (status & Y2_IS_CHK_TXA1) 2414 if (status & Y2_IS_CHK_TXA1)
2415 sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1); 2415 sky2_le_error(hw, 0, Q_XA1, TX_RING_SIZE);
2416 2416
2417 if (status & Y2_IS_CHK_TXA2) 2417 if (status & Y2_IS_CHK_TXA2)
2418 sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); 2418 sky2_le_error(hw, 1, Q_XA2, TX_RING_SIZE);
2419}
2420
2421static int sky2_poll(struct net_device *dev0, int *budget)
2422{
2423 struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw;
2424 int work_limit = min(dev0->quota, *budget);
2425 int work_done = 0;
2426 u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
2427
2428 if (unlikely(status & Y2_IS_ERROR))
2429 sky2_err_intr(hw, status);
2430
2431 if (status & Y2_IS_IRQ_PHY1)
2432 sky2_phy_intr(hw, 0);
2433
2434 if (status & Y2_IS_IRQ_PHY2)
2435 sky2_phy_intr(hw, 1);
2419 2436
2420 work_done = sky2_status_intr(hw, work_limit); 2437 work_done = sky2_status_intr(hw, work_limit);
2421 if (work_done < work_limit) { 2438 if (work_done < work_limit) {
@@ -2533,16 +2550,14 @@ static void sky2_reset(struct sky2_hw *hw)
2533 int i; 2550 int i;
2534 2551
2535 /* disable ASF */ 2552 /* disable ASF */
2536 if (hw->chip_id <= CHIP_ID_YUKON_EC) { 2553 if (hw->chip_id == CHIP_ID_YUKON_EX) {
2537 if (hw->chip_id == CHIP_ID_YUKON_EX) { 2554 status = sky2_read16(hw, HCU_CCSR);
2538 status = sky2_read16(hw, HCU_CCSR); 2555 status &= ~(HCU_CCSR_AHB_RST | HCU_CCSR_CPU_RST_MODE |
2539 status &= ~(HCU_CCSR_AHB_RST | HCU_CCSR_CPU_RST_MODE | 2556 HCU_CCSR_UC_STATE_MSK);
2540 HCU_CCSR_UC_STATE_MSK); 2557 sky2_write16(hw, HCU_CCSR, status);
2541 sky2_write16(hw, HCU_CCSR, status); 2558 } else
2542 } else 2559 sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
2543 sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); 2560 sky2_write16(hw, B0_CTST, Y2_ASF_DISABLE);
2544 sky2_write16(hw, B0_CTST, Y2_ASF_DISABLE);
2545 }
2546 2561
2547 /* do a SW reset */ 2562 /* do a SW reset */
2548 sky2_write8(hw, B0_CTST, CS_RST_SET); 2563 sky2_write8(hw, B0_CTST, CS_RST_SET);
@@ -3327,6 +3342,36 @@ static void sky2_get_regs(struct net_device *dev, struct ethtool_regs *regs,
3327 regs->len - B3_RI_WTO_R1); 3342 regs->len - B3_RI_WTO_R1);
3328} 3343}
3329 3344
3345/* In order to do Jumbo packets on these chips, need to turn off the
3346 * transmit store/forward. Therefore checksum offload won't work.
3347 */
3348static int no_tx_offload(struct net_device *dev)
3349{
3350 const struct sky2_port *sky2 = netdev_priv(dev);
3351 const struct sky2_hw *hw = sky2->hw;
3352
3353 return dev->mtu > ETH_DATA_LEN &&
3354 (hw->chip_id == CHIP_ID_YUKON_EX
3355 || hw->chip_id == CHIP_ID_YUKON_EC_U);
3356}
3357
3358static int sky2_set_tx_csum(struct net_device *dev, u32 data)
3359{
3360 if (data && no_tx_offload(dev))
3361 return -EINVAL;
3362
3363 return ethtool_op_set_tx_csum(dev, data);
3364}
3365
3366
3367static int sky2_set_tso(struct net_device *dev, u32 data)
3368{
3369 if (data && no_tx_offload(dev))
3370 return -EINVAL;
3371
3372 return ethtool_op_set_tso(dev, data);
3373}
3374
3330static const struct ethtool_ops sky2_ethtool_ops = { 3375static const struct ethtool_ops sky2_ethtool_ops = {
3331 .get_settings = sky2_get_settings, 3376 .get_settings = sky2_get_settings,
3332 .set_settings = sky2_set_settings, 3377 .set_settings = sky2_set_settings,
@@ -3342,9 +3387,9 @@ static const struct ethtool_ops sky2_ethtool_ops = {
3342 .get_sg = ethtool_op_get_sg, 3387 .get_sg = ethtool_op_get_sg,
3343 .set_sg = ethtool_op_set_sg, 3388 .set_sg = ethtool_op_set_sg,
3344 .get_tx_csum = ethtool_op_get_tx_csum, 3389 .get_tx_csum = ethtool_op_get_tx_csum,
3345 .set_tx_csum = ethtool_op_set_tx_csum, 3390 .set_tx_csum = sky2_set_tx_csum,
3346 .get_tso = ethtool_op_get_tso, 3391 .get_tso = ethtool_op_get_tso,
3347 .set_tso = ethtool_op_set_tso, 3392 .set_tso = sky2_set_tso,
3348 .get_rx_csum = sky2_get_rx_csum, 3393 .get_rx_csum = sky2_get_rx_csum,
3349 .set_rx_csum = sky2_set_rx_csum, 3394 .set_rx_csum = sky2_set_rx_csum,
3350 .get_strings = sky2_get_strings, 3395 .get_strings = sky2_get_strings,
@@ -3769,6 +3814,11 @@ static int sky2_resume(struct pci_dev *pdev)
3769 goto out; 3814 goto out;
3770 3815
3771 pci_enable_wake(pdev, PCI_D0, 0); 3816 pci_enable_wake(pdev, PCI_D0, 0);
3817
3818 /* Re-enable all clocks */
3819 if (hw->chip_id == CHIP_ID_YUKON_EX || hw->chip_id == CHIP_ID_YUKON_EC_U)
3820 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
3821
3772 sky2_reset(hw); 3822 sky2_reset(hw);
3773 3823
3774 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 3824 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index ac24bdc42976..5efb5afc45ba 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -288,6 +288,9 @@ enum {
288 | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1, 288 | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1,
289 Y2_IS_PORT_2 = Y2_IS_IRQ_PHY2 | Y2_IS_IRQ_MAC2 289 Y2_IS_PORT_2 = Y2_IS_IRQ_PHY2 | Y2_IS_IRQ_MAC2
290 | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2, 290 | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2,
291 Y2_IS_ERROR = Y2_IS_HW_ERR |
292 Y2_IS_IRQ_MAC1 | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1 |
293 Y2_IS_IRQ_MAC2 | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2,
291}; 294};
292 295
293/* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */ 296/* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */
@@ -738,6 +741,11 @@ enum {
738 TX_GMF_RP = 0x0d70,/* 32 bit Tx GMAC FIFO Read Pointer */ 741 TX_GMF_RP = 0x0d70,/* 32 bit Tx GMAC FIFO Read Pointer */
739 TX_GMF_RSTP = 0x0d74,/* 32 bit Tx GMAC FIFO Restart Pointer */ 742 TX_GMF_RSTP = 0x0d74,/* 32 bit Tx GMAC FIFO Restart Pointer */
740 TX_GMF_RLEV = 0x0d78,/* 32 bit Tx GMAC FIFO Read Level */ 743 TX_GMF_RLEV = 0x0d78,/* 32 bit Tx GMAC FIFO Read Level */
744
745 /* Threshold values for Yukon-EC Ultra and Extreme */
746 ECU_AE_THR = 0x0070, /* Almost Empty Threshold */
747 ECU_TXFF_LEV = 0x01a0, /* Tx BMU FIFO Level */
748 ECU_JUMBO_WM = 0x0080, /* Jumbo Mode Watermark */
741}; 749};
742 750
743/* Descriptor Poll Timer Registers */ 751/* Descriptor Poll Timer Registers */
@@ -1631,6 +1639,9 @@ enum {
1631 TX_VLAN_TAG_ON = 1<<25,/* enable VLAN tagging */ 1639 TX_VLAN_TAG_ON = 1<<25,/* enable VLAN tagging */
1632 TX_VLAN_TAG_OFF = 1<<24,/* disable VLAN tagging */ 1640 TX_VLAN_TAG_OFF = 1<<24,/* disable VLAN tagging */
1633 1641
1642 TX_JUMBO_ENA = 1<<23,/* PCI Jumbo Mode enable (Yukon-EC Ultra) */
1643 TX_JUMBO_DIS = 1<<22,/* PCI Jumbo Mode enable (Yukon-EC Ultra) */
1644
1634 GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */ 1645 GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */
1635 GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */ 1646 GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */
1636 GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */ 1647 GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 3b91af89e4c7..e3019d52c30f 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -719,7 +719,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card,
719 SPIDER_NET_DESCR_CARDOWNED | SPIDER_NET_DMAC_NOCS; 719 SPIDER_NET_DESCR_CARDOWNED | SPIDER_NET_DMAC_NOCS;
720 spin_unlock_irqrestore(&chain->lock, flags); 720 spin_unlock_irqrestore(&chain->lock, flags);
721 721
722 if (skb->protocol == htons(ETH_P_IP)) 722 if (skb->protocol == htons(ETH_P_IP) && skb->ip_summed == CHECKSUM_PARTIAL)
723 switch (skb->nh.iph->protocol) { 723 switch (skb->nh.iph->protocol) {
724 case IPPROTO_TCP: 724 case IPPROTO_TCP:
725 hwdescr->dmac_cmd_status |= SPIDER_NET_DMAC_TCP; 725 hwdescr->dmac_cmd_status |= SPIDER_NET_DMAC_TCP;
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index ef671739cfea..192bbc91c731 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3314,7 +3314,7 @@ static int __devexit hme_sbus_remove(struct of_device *dev)
3314 struct happy_meal *hp = dev_get_drvdata(&dev->dev); 3314 struct happy_meal *hp = dev_get_drvdata(&dev->dev);
3315 struct net_device *net_dev = hp->dev; 3315 struct net_device *net_dev = hp->dev;
3316 3316
3317 unregister_netdevice(net_dev); 3317 unregister_netdev(net_dev);
3318 3318
3319 /* XXX qfe parent interrupt... */ 3319 /* XXX qfe parent interrupt... */
3320 3320
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 5b00d79b5573..b0929a457b60 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1550,7 +1550,7 @@ static int __exit sunlance_sun4_remove(void)
1550 struct lance_private *lp = dev_get_drvdata(&sun4_sdev.ofdev.dev); 1550 struct lance_private *lp = dev_get_drvdata(&sun4_sdev.ofdev.dev);
1551 struct net_device *net_dev = lp->dev; 1551 struct net_device *net_dev = lp->dev;
1552 1552
1553 unregister_netdevice(net_dev); 1553 unregister_netdev(net_dev);
1554 1554
1555 lance_free_hwresources(lp); 1555 lance_free_hwresources(lp);
1556 1556
@@ -1590,7 +1590,7 @@ static int __devexit sunlance_sbus_remove(struct of_device *dev)
1590 struct lance_private *lp = dev_get_drvdata(&dev->dev); 1590 struct lance_private *lp = dev_get_drvdata(&dev->dev);
1591 struct net_device *net_dev = lp->dev; 1591 struct net_device *net_dev = lp->dev;
1592 1592
1593 unregister_netdevice(net_dev); 1593 unregister_netdev(net_dev);
1594 1594
1595 lance_free_hwresources(lp); 1595 lance_free_hwresources(lp);
1596 1596
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index 7874eb1ef043..f3bad56d476a 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -845,6 +845,8 @@ static int __init qec_ether_init(struct sbus_dev *sdev)
845 if (!dev) 845 if (!dev)
846 return -ENOMEM; 846 return -ENOMEM;
847 847
848 memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
849
848 qe = netdev_priv(dev); 850 qe = netdev_priv(dev);
849 851
850 i = of_getintprop_default(sdev->ofdev.node, "channel#", -1); 852 i = of_getintprop_default(sdev->ofdev.node, "channel#", -1);
@@ -960,7 +962,7 @@ static int __devexit qec_sbus_remove(struct of_device *dev)
960 struct sunqe *qp = dev_get_drvdata(&dev->dev); 962 struct sunqe *qp = dev_get_drvdata(&dev->dev);
961 struct net_device *net_dev = qp->dev; 963 struct net_device *net_dev = qp->dev;
962 964
963 unregister_netdevice(net_dev); 965 unregister_netdev(net_dev);
964 966
965 sbus_iounmap(qp->qcregs, CREG_REG_SIZE); 967 sbus_iounmap(qp->qcregs, CREG_REG_SIZE);
966 sbus_iounmap(qp->mregs, MREGS_REG_SIZE); 968 sbus_iounmap(qp->mregs, MREGS_REG_SIZE);
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 80cb88eb98c6..a38e7eec0e62 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -946,6 +946,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
946 u8 channel; 946 u8 channel;
947 struct bcm43xx_phyinfo *phy; 947 struct bcm43xx_phyinfo *phy;
948 const char *iso_country; 948 const char *iso_country;
949 u8 max_bg_channel;
949 950
950 geo = kzalloc(sizeof(*geo), GFP_KERNEL); 951 geo = kzalloc(sizeof(*geo), GFP_KERNEL);
951 if (!geo) 952 if (!geo)
@@ -967,6 +968,23 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
967 } 968 }
968 iso_country = bcm43xx_locale_iso(bcm->sprom.locale); 969 iso_country = bcm43xx_locale_iso(bcm->sprom.locale);
969 970
971/* set the maximum channel based on locale set in sprom or witle locale option */
972 switch (bcm->sprom.locale) {
973 case BCM43xx_LOCALE_THAILAND:
974 case BCM43xx_LOCALE_ISRAEL:
975 case BCM43xx_LOCALE_JORDAN:
976 case BCM43xx_LOCALE_USA_CANADA_ANZ:
977 case BCM43xx_LOCALE_USA_LOW:
978 max_bg_channel = 11;
979 break;
980 case BCM43xx_LOCALE_JAPAN:
981 case BCM43xx_LOCALE_JAPAN_HIGH:
982 max_bg_channel = 14;
983 break;
984 default:
985 max_bg_channel = 13;
986 }
987
970 if (have_a) { 988 if (have_a) {
971 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; 989 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL;
972 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { 990 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) {
@@ -978,7 +996,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
978 } 996 }
979 if (have_bg) { 997 if (have_bg) {
980 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; 998 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL;
981 channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { 999 channel <= max_bg_channel; channel++) {
982 chan = &geo->bg[i++]; 1000 chan = &geo->bg[i++];
983 chan->freq = bcm43xx_channel_to_freq_bg(channel); 1001 chan->freq = bcm43xx_channel_to_freq_bg(channel);
984 chan->channel = channel; 1002 chan->channel = channel;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index d1e89be965cd..72529a440f15 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -978,7 +978,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
978{ 978{
979 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 979 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
980 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); 980 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
981 u16 backup_phy[15]; 981 u16 backup_phy[15] = {0};
982 u16 backup_radio[3]; 982 u16 backup_radio[3];
983 u16 backup_bband; 983 u16 backup_bband;
984 u16 i; 984 u16 i;
@@ -989,8 +989,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
989 backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); 989 backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001);
990 backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); 990 backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811);
991 backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); 991 backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812);
992 backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); 992 if (phy->rev != 1) {
993 backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); 993 backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814);
994 backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815);
995 }
994 backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); 996 backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A);
995 backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); 997 backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059);
996 backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); 998 backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058);
@@ -1018,14 +1020,16 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1018 bcm43xx_phy_read(bcm, 0x0811) | 0x0001); 1020 bcm43xx_phy_read(bcm, 0x0811) | 0x0001);
1019 bcm43xx_phy_write(bcm, 0x0812, 1021 bcm43xx_phy_write(bcm, 0x0812,
1020 bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); 1022 bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE);
1021 bcm43xx_phy_write(bcm, 0x0814, 1023 if (phy->rev != 1) {
1022 bcm43xx_phy_read(bcm, 0x0814) | 0x0001); 1024 bcm43xx_phy_write(bcm, 0x0814,
1023 bcm43xx_phy_write(bcm, 0x0815, 1025 bcm43xx_phy_read(bcm, 0x0814) | 0x0001);
1024 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE); 1026 bcm43xx_phy_write(bcm, 0x0815,
1025 bcm43xx_phy_write(bcm, 0x0814, 1027 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE);
1026 bcm43xx_phy_read(bcm, 0x0814) | 0x0002); 1028 bcm43xx_phy_write(bcm, 0x0814,
1027 bcm43xx_phy_write(bcm, 0x0815, 1029 bcm43xx_phy_read(bcm, 0x0814) | 0x0002);
1028 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); 1030 bcm43xx_phy_write(bcm, 0x0815,
1031 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD);
1032 }
1029 bcm43xx_phy_write(bcm, 0x0811, 1033 bcm43xx_phy_write(bcm, 0x0811,
1030 bcm43xx_phy_read(bcm, 0x0811) | 0x000C); 1034 bcm43xx_phy_read(bcm, 0x0811) | 0x000C);
1031 bcm43xx_phy_write(bcm, 0x0812, 1035 bcm43xx_phy_write(bcm, 0x0812,
@@ -1048,10 +1052,12 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1048 bcm43xx_phy_read(bcm, 0x000A) 1052 bcm43xx_phy_read(bcm, 0x000A)
1049 | 0x2000); 1053 | 0x2000);
1050 } 1054 }
1051 bcm43xx_phy_write(bcm, 0x0814, 1055 if (phy->rev != 1) {
1052 bcm43xx_phy_read(bcm, 0x0814) | 0x0004); 1056 bcm43xx_phy_write(bcm, 0x0814,
1053 bcm43xx_phy_write(bcm, 0x0815, 1057 bcm43xx_phy_read(bcm, 0x0814) | 0x0004);
1054 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); 1058 bcm43xx_phy_write(bcm, 0x0815,
1059 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB);
1060 }
1055 bcm43xx_phy_write(bcm, 0x0003, 1061 bcm43xx_phy_write(bcm, 0x0003,
1056 (bcm43xx_phy_read(bcm, 0x0003) 1062 (bcm43xx_phy_read(bcm, 0x0003)
1057 & 0xFF9F) | 0x0040); 1063 & 0xFF9F) | 0x0040);
@@ -1138,8 +1144,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1138 } 1144 }
1139 } 1145 }
1140 1146
1141 bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); 1147 if (phy->rev != 1) {
1142 bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); 1148 bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]);
1149 bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]);
1150 }
1143 bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); 1151 bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]);
1144 bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); 1152 bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]);
1145 bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); 1153 bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]);
@@ -1188,24 +1196,23 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1188 bcm43xx_phy_write(bcm, 0x0811, 0x0000); 1196 bcm43xx_phy_write(bcm, 0x0811, 0x0000);
1189 bcm43xx_phy_write(bcm, 0x0015, 0x00C0); 1197 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1190 } 1198 }
1191 if (phy->rev >= 3) { 1199 if (phy->rev > 5) {
1192 bcm43xx_phy_write(bcm, 0x0811, 0x0400); 1200 bcm43xx_phy_write(bcm, 0x0811, 0x0400);
1193 bcm43xx_phy_write(bcm, 0x0015, 0x00C0); 1201 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1194 } 1202 }
1195 if (phy->rev >= 2 && phy->connected) { 1203 if (phy->rev >= 2 && phy->connected) {
1196 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; 1204 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF;
1197 if (tmp < 6) { 1205 if (tmp ==3 || tmp == 5) {
1198 bcm43xx_phy_write(bcm, 0x04C2, 0x1816); 1206 bcm43xx_phy_write(bcm, 0x04C2, 0x1816);
1199 bcm43xx_phy_write(bcm, 0x04C3, 0x8006); 1207 bcm43xx_phy_write(bcm, 0x04C3, 0x8006);
1200 if (tmp != 3) { 1208 if (tmp == 5) {
1201 bcm43xx_phy_write(bcm, 0x04CC, 1209 bcm43xx_phy_write(bcm, 0x04CC,
1202 (bcm43xx_phy_read(bcm, 0x04CC) 1210 (bcm43xx_phy_read(bcm, 0x04CC)
1203 & 0x00FF) | 0x1F00); 1211 & 0x00FF) | 0x1F00);
1204 } 1212 }
1205 } 1213 }
1206 }
1207 if (phy->rev < 3 && phy->connected)
1208 bcm43xx_phy_write(bcm, 0x047E, 0x0078); 1214 bcm43xx_phy_write(bcm, 0x047E, 0x0078);
1215 }
1209 if (radio->revision == 8) { 1216 if (radio->revision == 8) {
1210 bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); 1217 bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080);
1211 bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); 1218 bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004);
@@ -1232,7 +1239,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1232 if (phy->rev >= 6) { 1239 if (phy->rev >= 6) {
1233 bcm43xx_phy_write(bcm, 0x0036, 1240 bcm43xx_phy_write(bcm, 0x0036,
1234 (bcm43xx_phy_read(bcm, 0x0036) 1241 (bcm43xx_phy_read(bcm, 0x0036)
1235 & 0xF000) | (radio->txctl2 << 12)); 1242 & 0x0FFF) | (radio->txctl2 << 12));
1236 } 1243 }
1237 if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) 1244 if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL)
1238 bcm43xx_phy_write(bcm, 0x002E, 0x8075); 1245 bcm43xx_phy_write(bcm, 0x002E, 0x8075);
@@ -1243,7 +1250,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1243 else 1250 else
1244 bcm43xx_phy_write(bcm, 0x002F, 0x0202); 1251 bcm43xx_phy_write(bcm, 0x002F, 0x0202);
1245 } 1252 }
1246 if (phy->connected) { 1253 if (phy->connected || phy->rev >= 2) {
1247 bcm43xx_phy_lo_adjust(bcm, 0); 1254 bcm43xx_phy_lo_adjust(bcm, 0);
1248 bcm43xx_phy_write(bcm, 0x080F, 0x8078); 1255 bcm43xx_phy_write(bcm, 0x080F, 0x8078);
1249 } 1256 }
@@ -1257,7 +1264,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1257 */ 1264 */
1258 bcm43xx_nrssi_hw_update(bcm, 0xFFFF); 1265 bcm43xx_nrssi_hw_update(bcm, 0xFFFF);
1259 bcm43xx_calc_nrssi_threshold(bcm); 1266 bcm43xx_calc_nrssi_threshold(bcm);
1260 } else if (phy->connected) { 1267 } else if (phy->connected || phy->rev >= 2) {
1261 if (radio->nrssi[0] == -1000) { 1268 if (radio->nrssi[0] == -1000) {
1262 assert(radio->nrssi[1] == -1000); 1269 assert(radio->nrssi[1] == -1000);
1263 bcm43xx_calc_nrssi_slope(bcm); 1270 bcm43xx_calc_nrssi_slope(bcm);
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 9c64f894b71b..87ee3ee020fe 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -337,6 +337,7 @@ static int read_pod(struct zd_chip *chip, u8 *rf_type)
337 chip->patch_cr157 = (value >> 13) & 0x1; 337 chip->patch_cr157 = (value >> 13) & 0x1;
338 chip->patch_6m_band_edge = (value >> 21) & 0x1; 338 chip->patch_6m_band_edge = (value >> 21) & 0x1;
339 chip->new_phy_layout = (value >> 31) & 0x1; 339 chip->new_phy_layout = (value >> 31) & 0x1;
340 chip->al2230s_bit = (value >> 7) & 0x1;
340 chip->link_led = ((value >> 4) & 1) ? LED1 : LED2; 341 chip->link_led = ((value >> 4) & 1) ? LED1 : LED2;
341 chip->supports_tx_led = 1; 342 chip->supports_tx_led = 1;
342 if (value & (1 << 24)) { /* LED scenario */ 343 if (value & (1 << 24)) { /* LED scenario */
@@ -591,16 +592,16 @@ int zd_chip_unlock_phy_regs(struct zd_chip *chip)
591 return r; 592 return r;
592} 593}
593 594
594/* CR157 can be optionally patched by the EEPROM */ 595/* CR157 can be optionally patched by the EEPROM for original ZD1211 */
595static int patch_cr157(struct zd_chip *chip) 596static int patch_cr157(struct zd_chip *chip)
596{ 597{
597 int r; 598 int r;
598 u32 value; 599 u16 value;
599 600
600 if (!chip->patch_cr157) 601 if (!chip->patch_cr157)
601 return 0; 602 return 0;
602 603
603 r = zd_ioread32_locked(chip, &value, E2P_PHY_REG); 604 r = zd_ioread16_locked(chip, &value, E2P_PHY_REG);
604 if (r) 605 if (r)
605 return r; 606 return r;
606 607
@@ -790,11 +791,6 @@ static int zd1211b_hw_reset_phy(struct zd_chip *chip)
790 goto out; 791 goto out;
791 792
792 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); 793 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
793 if (r)
794 goto unlock;
795
796 r = patch_cr157(chip);
797unlock:
798 t = zd_chip_unlock_phy_regs(chip); 794 t = zd_chip_unlock_phy_regs(chip);
799 if (t && !r) 795 if (t && !r)
800 r = t; 796 r = t;
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index b07569e391ee..e57ed75d9425 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -641,8 +641,8 @@ enum {
641 * also only 11 channels. */ 641 * also only 11 channels. */
642#define E2P_ALLOWED_CHANNEL E2P_DATA(0x18) 642#define E2P_ALLOWED_CHANNEL E2P_DATA(0x18)
643 643
644#define E2P_PHY_REG E2P_DATA(0x1a)
645#define E2P_DEVICE_VER E2P_DATA(0x20) 644#define E2P_DEVICE_VER E2P_DATA(0x20)
645#define E2P_PHY_REG E2P_DATA(0x25)
646#define E2P_36M_CAL_VALUE1 E2P_DATA(0x28) 646#define E2P_36M_CAL_VALUE1 E2P_DATA(0x28)
647#define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a) 647#define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a)
648#define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c) 648#define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c)
@@ -711,7 +711,7 @@ struct zd_chip {
711 u16 link_led; 711 u16 link_led;
712 unsigned int pa_type:4, 712 unsigned int pa_type:4,
713 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, 713 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1,
714 new_phy_layout:1, 714 new_phy_layout:1, al2230s_bit:1,
715 is_zd1211b:1, supports_tx_led:1; 715 is_zd1211b:1, supports_tx_led:1;
716}; 716};
717 717
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
index 25323a13a3db..5235a7827ac5 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
@@ -358,6 +358,12 @@ int zd_rf_init_al2230(struct zd_rf *rf)
358{ 358{
359 struct zd_chip *chip = zd_rf_to_chip(rf); 359 struct zd_chip *chip = zd_rf_to_chip(rf);
360 360
361 if (chip->al2230s_bit) {
362 dev_err(zd_chip_dev(chip), "AL2230S devices are not yet "
363 "supported by this driver.\n");
364 return -ENODEV;
365 }
366
361 rf->switch_radio_off = al2230_switch_radio_off; 367 rf->switch_radio_off = al2230_switch_radio_off;
362 if (chip->is_zd1211b) { 368 if (chip->is_zd1211b) {
363 rf->init_hw = zd1211b_al2230_init_hw; 369 rf->init_hw = zd1211b_al2230_init_hw;
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index aac8a1c5ba08..edaaad2f648b 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -62,6 +62,7 @@ static struct usb_device_id usb_ids[] = {
62 { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B }, 62 { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B },
63 { USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B }, 63 { USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B },
64 { USB_DEVICE(0x0586, 0x340f), .driver_info = DEVICE_ZD1211B }, 64 { USB_DEVICE(0x0586, 0x340f), .driver_info = DEVICE_ZD1211B },
65 { USB_DEVICE(0x0baf, 0x0121), .driver_info = DEVICE_ZD1211B },
65 /* "Driverless" devices that need ejecting */ 66 /* "Driverless" devices that need ejecting */
66 { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, 67 { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
67 {} 68 {}
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 9793533276ec..400bb90084cf 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -126,7 +126,7 @@ static unsigned char status_sunbpp_to_pc(struct parport *p)
126 if (!(value_tcr & P_TCR_BUSY)) 126 if (!(value_tcr & P_TCR_BUSY))
127 bits |= PARPORT_STATUS_BUSY; 127 bits |= PARPORT_STATUS_BUSY;
128 128
129 dprintk((KERN_DEBUG "tcr 0x%x ir 0x%x\n", regs->p_tcr, regs->p_ir)); 129 dprintk((KERN_DEBUG "tcr 0x%x ir 0x%x\n", value_tcr, value_ir));
130 dprintk((KERN_DEBUG "read status 0x%x\n", bits)); 130 dprintk((KERN_DEBUG "read status 0x%x\n", bits));
131 return bits; 131 return bits;
132} 132}
@@ -147,7 +147,7 @@ static unsigned char control_sunbpp_to_pc(struct parport *p)
147 if (value_or & P_OR_SLCT_IN) 147 if (value_or & P_OR_SLCT_IN)
148 bits |= PARPORT_CONTROL_SELECT; 148 bits |= PARPORT_CONTROL_SELECT;
149 149
150 dprintk((KERN_DEBUG "tcr 0x%x or 0x%x\n", regs->p_tcr, regs->p_or)); 150 dprintk((KERN_DEBUG "tcr 0x%x or 0x%x\n", value_tcr, value_or));
151 dprintk((KERN_DEBUG "read control 0x%x\n", bits)); 151 dprintk((KERN_DEBUG "read control 0x%x\n", bits));
152 return bits; 152 return bits;
153} 153}
@@ -165,7 +165,8 @@ static unsigned char parport_sunbpp_frob_control(struct parport *p,
165 unsigned char value_tcr = sbus_readb(&regs->p_tcr); 165 unsigned char value_tcr = sbus_readb(&regs->p_tcr);
166 unsigned char value_or = sbus_readb(&regs->p_or); 166 unsigned char value_or = sbus_readb(&regs->p_or);
167 167
168 dprintk((KERN_DEBUG "frob1: tcr 0x%x or 0x%x\n", regs->p_tcr, regs->p_or)); 168 dprintk((KERN_DEBUG "frob1: tcr 0x%x or 0x%x\n",
169 value_tcr, value_or));
169 if (mask & PARPORT_CONTROL_STROBE) { 170 if (mask & PARPORT_CONTROL_STROBE) {
170 if (val & PARPORT_CONTROL_STROBE) { 171 if (val & PARPORT_CONTROL_STROBE) {
171 value_tcr &= ~P_TCR_DS; 172 value_tcr &= ~P_TCR_DS;
@@ -197,7 +198,8 @@ static unsigned char parport_sunbpp_frob_control(struct parport *p,
197 198
198 sbus_writeb(value_or, &regs->p_or); 199 sbus_writeb(value_or, &regs->p_or);
199 sbus_writeb(value_tcr, &regs->p_tcr); 200 sbus_writeb(value_tcr, &regs->p_tcr);
200 dprintk((KERN_DEBUG "frob2: tcr 0x%x or 0x%x\n", regs->p_tcr, regs->p_or)); 201 dprintk((KERN_DEBUG "frob2: tcr 0x%x or 0x%x\n",
202 value_tcr, value_or));
201 return parport_sunbpp_read_control(p); 203 return parport_sunbpp_read_control(p);
202} 204}
203 205
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a4a96826d9e0..2fe1d690eb13 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -682,34 +682,7 @@ static void pci_read_irq(struct pci_dev *dev)
682 dev->irq = irq; 682 dev->irq = irq;
683} 683}
684 684
685static void change_legacy_io_resource(struct pci_dev * dev, unsigned index, 685#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
686 unsigned start, unsigned end)
687{
688 unsigned base = start & PCI_BASE_ADDRESS_IO_MASK;
689 unsigned len = (end | ~PCI_BASE_ADDRESS_IO_MASK) - base + 1;
690
691 /*
692 * Some X versions get confused when the BARs reported through
693 * /sys or /proc differ from those seen in config space, thus
694 * try to update the config space values, too.
695 */
696 if (!(pci_resource_flags(dev, index) & IORESOURCE_IO))
697 printk(KERN_WARNING "%s: cannot adjust BAR%u (not I/O)\n",
698 pci_name(dev), index);
699 else if (pci_resource_len(dev, index) != len)
700 printk(KERN_WARNING "%s: cannot adjust BAR%u (size %04X)\n",
701 pci_name(dev), index, (unsigned)pci_resource_len(dev, index));
702 else {
703 printk(KERN_INFO "%s: trying to change BAR%u from %04X to %04X\n",
704 pci_name(dev), index,
705 (unsigned)pci_resource_start(dev, index), base);
706 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + index * 4, base);
707 }
708 pci_resource_start(dev, index) = start;
709 pci_resource_end(dev, index) = end;
710 pci_resource_flags(dev, index) =
711 IORESOURCE_IO | IORESOURCE_PCI_FIXED | PCI_BASE_ADDRESS_SPACE_IO;
712}
713 686
714/** 687/**
715 * pci_setup_device - fill in class and map information of a device 688 * pci_setup_device - fill in class and map information of a device
@@ -762,12 +735,20 @@ static int pci_setup_device(struct pci_dev * dev)
762 u8 progif; 735 u8 progif;
763 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); 736 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
764 if ((progif & 1) == 0) { 737 if ((progif & 1) == 0) {
765 change_legacy_io_resource(dev, 0, 0x1F0, 0x1F7); 738 dev->resource[0].start = 0x1F0;
766 change_legacy_io_resource(dev, 1, 0x3F6, 0x3F6); 739 dev->resource[0].end = 0x1F7;
740 dev->resource[0].flags = LEGACY_IO_RESOURCE;
741 dev->resource[1].start = 0x3F6;
742 dev->resource[1].end = 0x3F6;
743 dev->resource[1].flags = LEGACY_IO_RESOURCE;
767 } 744 }
768 if ((progif & 4) == 0) { 745 if ((progif & 4) == 0) {
769 change_legacy_io_resource(dev, 2, 0x170, 0x177); 746 dev->resource[2].start = 0x170;
770 change_legacy_io_resource(dev, 3, 0x376, 0x376); 747 dev->resource[2].end = 0x177;
748 dev->resource[2].flags = LEGACY_IO_RESOURCE;
749 dev->resource[3].start = 0x376;
750 dev->resource[3].end = 0x376;
751 dev->resource[3].flags = LEGACY_IO_RESOURCE;
771 } 752 }
772 } 753 }
773 break; 754 break;
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index eec28c142a59..5041c9dfbe3b 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -249,7 +249,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
249#ifdef CONFIG_PCI 249#ifdef CONFIG_PCI
250 struct pci_dev *pdev; 250 struct pci_dev *pdev;
251 struct pcidev_cookie *pcp; 251 struct pcidev_cookie *pcp;
252 pdev = pci_find_slot (((int *) op->oprom_array)[0], 252 pdev = pci_get_bus_and_slot (((int *) op->oprom_array)[0],
253 ((int *) op->oprom_array)[1]); 253 ((int *) op->oprom_array)[1]);
254 254
255 pcp = pdev->sysdata; 255 pcp = pdev->sysdata;
@@ -260,6 +260,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
260 op->oprom_size = sizeof(int); 260 op->oprom_size = sizeof(int);
261 err = copyout(argp, op, bufsize + sizeof(int)); 261 err = copyout(argp, op, bufsize + sizeof(int));
262 } 262 }
263 pci_dev_put(pdev);
263#endif 264#endif
264 } 265 }
265 266
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index 8bfb67ccdcd4..c3135e2fbd5a 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -259,11 +259,10 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, void __user *argp)
259 if (copy_from_user(&inout, argp, sizeof(inout))) 259 if (copy_from_user(&inout, argp, sizeof(inout)))
260 return -EFAULT; 260 return -EFAULT;
261 261
262 buffer = kmalloc(inout.len, GFP_KERNEL); 262 buffer = kzalloc(inout.len, GFP_KERNEL);
263 if (buffer == NULL) 263 if (buffer == NULL)
264 return -ENOMEM; 264 return -ENOMEM;
265 265
266 memset(buffer,0,inout.len);
267 vfc_lock_device(dev); 266 vfc_lock_device(dev);
268 inout.ret= 267 inout.ret=
269 vfc_i2c_recvbuf(dev,inout.addr & 0xff 268 vfc_i2c_recvbuf(dev,inout.addr & 0xff
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index bf5d63e1beee..656bdb1352d8 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -1864,10 +1864,17 @@ static int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id)
1864/* This function will handle the request sense scsi command */ 1864/* This function will handle the request sense scsi command */
1865static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id) 1865static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id)
1866{ 1866{
1867 char request_buffer[18];
1868
1867 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_request_sense()\n"); 1869 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_request_sense()\n");
1868 1870
1869 /* For now we just zero the request buffer */ 1871 memset(request_buffer, 0, sizeof(request_buffer));
1870 memset(tw_dev->srb[request_id]->request_buffer, 0, tw_dev->srb[request_id]->request_bufflen); 1872 request_buffer[0] = 0x70; /* Immediate fixed format */
1873 request_buffer[7] = 10; /* minimum size per SPC: 18 bytes */
1874 /* leave all other fields zero, giving effectively NO_SENSE return */
1875 tw_transfer_internal(tw_dev, request_id, request_buffer,
1876 sizeof(request_buffer));
1877
1871 tw_dev->state[request_id] = TW_S_COMPLETED; 1878 tw_dev->state[request_id] = TW_S_COMPLETED;
1872 tw_state_request_finish(tw_dev, request_id); 1879 tw_state_request_finish(tw_dev, request_id);
1873 1880
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 9b827ceec501..9f10689905a8 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1281,7 +1281,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
1281 (struct scatterlist *)Cmnd->request_buffer, 1281 (struct scatterlist *)Cmnd->request_buffer,
1282 Cmnd->use_sg, 1282 Cmnd->use_sg,
1283 Cmnd->sc_data_direction); 1283 Cmnd->sc_data_direction);
1284 } else { 1284 } else if (Cmnd->request_bufflen) {
1285 sbus_unmap_single(qpti->sdev, 1285 sbus_unmap_single(qpti->sdev,
1286 (__u32)((unsigned long)Cmnd->SCp.ptr), 1286 (__u32)((unsigned long)Cmnd->SCp.ptr),
1287 Cmnd->request_bufflen, 1287 Cmnd->request_bufflen,
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index c129a0e8e807..90621c3312bc 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1310,7 +1310,8 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
1310{ 1310{
1311 unsigned int status = serial_in(up, UART_MSR); 1311 unsigned int status = serial_in(up, UART_MSR);
1312 1312
1313 if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI) { 1313 if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI &&
1314 up->port.info != NULL) {
1314 if (status & UART_MSR_TERI) 1315 if (status & UART_MSR_TERI)
1315 up->port.icount.rng++; 1316 up->port.icount.rng++;
1316 if (status & UART_MSR_DDSR) 1317 if (status & UART_MSR_DDSR)
@@ -1333,8 +1334,9 @@ static inline void
1333serial8250_handle_port(struct uart_8250_port *up) 1334serial8250_handle_port(struct uart_8250_port *up)
1334{ 1335{
1335 unsigned int status; 1336 unsigned int status;
1337 unsigned long flags;
1336 1338
1337 spin_lock(&up->port.lock); 1339 spin_lock_irqsave(&up->port.lock, flags);
1338 1340
1339 status = serial_inp(up, UART_LSR); 1341 status = serial_inp(up, UART_LSR);
1340 1342
@@ -1346,7 +1348,7 @@ serial8250_handle_port(struct uart_8250_port *up)
1346 if (status & UART_LSR_THRE) 1348 if (status & UART_LSR_THRE)
1347 transmit_chars(up); 1349 transmit_chars(up);
1348 1350
1349 spin_unlock(&up->port.lock); 1351 spin_unlock_irqrestore(&up->port.lock, flags);
1350} 1352}
1351 1353
1352/* 1354/*
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c
index 41431d0d5512..246c5572667b 100644
--- a/drivers/serial/icom.c
+++ b/drivers/serial/icom.c
@@ -164,7 +164,7 @@ static void free_port_memory(struct icom_port *icom_port)
164 } 164 }
165} 165}
166 166
167static int __init get_port_memory(struct icom_port *icom_port) 167static int __devinit get_port_memory(struct icom_port *icom_port)
168{ 168{
169 int index; 169 int index;
170 unsigned long stgAddr; 170 unsigned long stgAddr;
@@ -1380,7 +1380,7 @@ static void icom_port_active(struct icom_port *icom_port, struct icom_adapter *i
1380 0x8024 + 2 - 2 * (icom_port->port - 2); 1380 0x8024 + 2 - 2 * (icom_port->port - 2);
1381 } 1381 }
1382} 1382}
1383static int __init icom_load_ports(struct icom_adapter *icom_adapter) 1383static int __devinit icom_load_ports(struct icom_adapter *icom_adapter)
1384{ 1384{
1385 struct icom_port *icom_port; 1385 struct icom_port *icom_port;
1386 int port_num; 1386 int port_num;
@@ -1473,7 +1473,7 @@ static void icom_remove_adapter(struct icom_adapter *icom_adapter)
1473 } 1473 }
1474 } 1474 }
1475 1475
1476 free_irq(icom_adapter->irq_number, (void *) icom_adapter); 1476 free_irq(icom_adapter->pci_dev->irq, (void *) icom_adapter);
1477 iounmap(icom_adapter->base_addr); 1477 iounmap(icom_adapter->base_addr);
1478 icom_free_adapter(icom_adapter); 1478 icom_free_adapter(icom_adapter);
1479 pci_release_regions(icom_adapter->pci_dev); 1479 pci_release_regions(icom_adapter->pci_dev);
@@ -1539,7 +1539,6 @@ static int __devinit icom_probe(struct pci_dev *dev,
1539 } 1539 }
1540 1540
1541 icom_adapter->base_addr_pci = pci_resource_start(dev, 0); 1541 icom_adapter->base_addr_pci = pci_resource_start(dev, 0);
1542 icom_adapter->irq_number = dev->irq;
1543 icom_adapter->pci_dev = dev; 1542 icom_adapter->pci_dev = dev;
1544 icom_adapter->version = ent->driver_data; 1543 icom_adapter->version = ent->driver_data;
1545 icom_adapter->subsystem_id = ent->subdevice; 1544 icom_adapter->subsystem_id = ent->subdevice;
@@ -1570,7 +1569,7 @@ static int __devinit icom_probe(struct pci_dev *dev,
1570 icom_port = &icom_adapter->port_info[index]; 1569 icom_port = &icom_adapter->port_info[index];
1571 1570
1572 if (icom_port->status == ICOM_PORT_ACTIVE) { 1571 if (icom_port->status == ICOM_PORT_ACTIVE) {
1573 icom_port->uart_port.irq = icom_port->adapter->irq_number; 1572 icom_port->uart_port.irq = icom_port->adapter->pci_dev->irq;
1574 icom_port->uart_port.type = PORT_ICOM; 1573 icom_port->uart_port.type = PORT_ICOM;
1575 icom_port->uart_port.iotype = UPIO_MEM; 1574 icom_port->uart_port.iotype = UPIO_MEM;
1576 icom_port->uart_port.membase = 1575 icom_port->uart_port.membase =
diff --git a/drivers/serial/icom.h b/drivers/serial/icom.h
index 798f1ef23712..e8578d8cd35e 100644
--- a/drivers/serial/icom.h
+++ b/drivers/serial/icom.h
@@ -258,7 +258,6 @@ struct icom_port {
258struct icom_adapter { 258struct icom_adapter {
259 void __iomem * base_addr; 259 void __iomem * base_addr;
260 unsigned long base_addr_pci; 260 unsigned long base_addr_pci;
261 unsigned char irq_number;
262 struct pci_dev *pci_dev; 261 struct pci_dev *pci_dev;
263 struct icom_port port_info[4]; 262 struct icom_port port_info[4];
264 int index; 263 int index;
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 220abce63e4a..b10211c420ef 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -77,7 +77,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
77 77
78 switch (value) { 78 switch (value) {
79 case BITBANG_CS_INACTIVE: 79 case BITBANG_CS_INACTIVE:
80 hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol^1); 80 hw->set_cs(hw->pdata, spi->chip_select, cspol^1);
81 break; 81 break;
82 82
83 case BITBANG_CS_ACTIVE: 83 case BITBANG_CS_ACTIVE:
@@ -98,7 +98,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
98 /* write new configration */ 98 /* write new configration */
99 99
100 writeb(spcon, hw->regs + S3C2410_SPCON); 100 writeb(spcon, hw->regs + S3C2410_SPCON);
101 hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol); 101 hw->set_cs(hw->pdata, spi->chip_select, cspol);
102 102
103 break; 103 break;
104 } 104 }
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a74056488234..c7458f7e56cc 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -669,6 +669,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
669 */ 669 */
670 ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); 670 ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
671 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); 671 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
672 mod_timer(&hcd->rh_timer, ehci->reset_done[i]);
672 } 673 }
673 } 674 }
674 675
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index d48c024cff59..6d12961cf9f9 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -316,6 +316,7 @@ static int update_eth_regs_async(pegasus_t * pegasus)
316 return ret; 316 return ret;
317} 317}
318 318
319/* Returns 0 on success, error on failure */
319static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) 320static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
320{ 321{
321 int i; 322 int i;
@@ -847,10 +848,16 @@ static void intr_callback(struct urb *urb)
847 * d[0].NO_CARRIER kicks in only with failed TX. 848 * d[0].NO_CARRIER kicks in only with failed TX.
848 * ... so monitoring with MII may be safest. 849 * ... so monitoring with MII may be safest.
849 */ 850 */
850 if (d[0] & NO_CARRIER) 851 if (pegasus->features & TRUST_LINK_STATUS) {
851 netif_carrier_off(net); 852 if (d[5] & LINK_STATUS)
852 else 853 netif_carrier_on(net);
853 netif_carrier_on(net); 854 else
855 netif_carrier_off(net);
856 } else {
857 /* Never set carrier _on_ based on ! NO_CARRIER */
858 if (d[0] & NO_CARRIER)
859 netif_carrier_off(net);
860 }
854 861
855 /* bytes 3-4 == rx_lostpkt, reg 2E/2F */ 862 /* bytes 3-4 == rx_lostpkt, reg 2E/2F */
856 pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; 863 pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];
@@ -950,7 +957,7 @@ static void set_carrier(struct net_device *net)
950 pegasus_t *pegasus = netdev_priv(net); 957 pegasus_t *pegasus = netdev_priv(net);
951 u16 tmp; 958 u16 tmp;
952 959
953 if (!read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) 960 if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp))
954 return; 961 return;
955 962
956 if (tmp & BMSR_LSTATUS) 963 if (tmp & BMSR_LSTATUS)
diff --git a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h
index c7467823cd1c..c7aadb413e8c 100644
--- a/drivers/usb/net/pegasus.h
+++ b/drivers/usb/net/pegasus.h
@@ -11,6 +11,7 @@
11 11
12#define PEGASUS_II 0x80000000 12#define PEGASUS_II 0x80000000
13#define HAS_HOME_PNA 0x40000000 13#define HAS_HOME_PNA 0x40000000
14#define TRUST_LINK_STATUS 0x20000000
14 15
15#define PEGASUS_MTU 1536 16#define PEGASUS_MTU 1536
16#define RX_SKBS 4 17#define RX_SKBS 4
@@ -203,7 +204,7 @@ PEGASUS_DEV( "AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701,
203PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, 204PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
204 DEFAULT_GPIO_RESET | PEGASUS_II ) 205 DEFAULT_GPIO_RESET | PEGASUS_II )
205PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 206PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121,
206 DEFAULT_GPIO_RESET | PEGASUS_II ) 207 DEFAULT_GPIO_RESET | PEGASUS_II | TRUST_LINK_STATUS )
207PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, 208PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
208 DEFAULT_GPIO_RESET ) 209 DEFAULT_GPIO_RESET )
209PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987, 210PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index e13637dfb642..4a9d0d5c7282 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -327,6 +327,13 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
327 US_SC_DEVICE, US_PR_DEVICE, NULL, 327 US_SC_DEVICE, US_PR_DEVICE, NULL,
328 US_FL_FIX_CAPACITY), 328 US_FL_FIX_CAPACITY),
329 329
330/* Reported by Emil Larsson <emil@swip.net> */
331UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0100,
332 "NIKON",
333 "NIKON DSC D80",
334 US_SC_DEVICE, US_PR_DEVICE, NULL,
335 US_FL_FIX_CAPACITY),
336
330/* BENQ DC5330 337/* BENQ DC5330
331 * Reported by Manuel Fombuena <mfombuena@ya.com> and 338 * Reported by Manuel Fombuena <mfombuena@ya.com> and
332 * Frank Copeland <fjc@thingy.apana.org.au> */ 339 * Frank Copeland <fjc@thingy.apana.org.au> */
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index e4f0dd00ae85..8372ace4a0d9 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -139,7 +139,7 @@ config FB_TILEBLITTING
139 This is particularly important to one driver, matroxfb. If 139 This is particularly important to one driver, matroxfb. If
140 unsure, say N. 140 unsure, say N.
141 141
142comment "Frambuffer hardware drivers" 142comment "Frame buffer hardware drivers"
143 depends on FB 143 depends on FB
144 144
145config FB_CIRRUS 145config FB_CIRRUS
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 124a085d1f2e..b01b0a457932 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -415,7 +415,7 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
415 file_inode = file->d_inode; 415 file_inode = file->d_inode;
416 sb = file_inode->i_sb; 416 sb = file_inode->i_sb;
417 v9ses = v9fs_inode2v9ses(file_inode); 417 v9ses = v9fs_inode2v9ses(file_inode);
418 v9fid = v9fs_fid_lookup(file); 418 v9fid = v9fs_fid_clone(file);
419 if(IS_ERR(v9fid)) 419 if(IS_ERR(v9fid))
420 return PTR_ERR(v9fid); 420 return PTR_ERR(v9fid);
421 421
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index b4631046867e..d0e9b3a3905d 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -470,9 +470,6 @@ void autofs4_dentry_release(struct dentry *de)
470 if (inf) { 470 if (inf) {
471 struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb); 471 struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb);
472 472
473 inf->dentry = NULL;
474 inf->inode = NULL;
475
476 if (sbi) { 473 if (sbi) {
477 spin_lock(&sbi->rehash_lock); 474 spin_lock(&sbi->rehash_lock);
478 if (!list_empty(&inf->rehash)) 475 if (!list_empty(&inf->rehash))
@@ -480,6 +477,9 @@ void autofs4_dentry_release(struct dentry *de)
480 spin_unlock(&sbi->rehash_lock); 477 spin_unlock(&sbi->rehash_lock);
481 } 478 }
482 479
480 inf->dentry = NULL;
481 inf->inode = NULL;
482
483 autofs4_free_ino(inf); 483 autofs4_free_ino(inf);
484 } 484 }
485} 485}
diff --git a/fs/exec.c b/fs/exec.c
index 7e36c6f6f538..3155e915307a 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1244,13 +1244,17 @@ EXPORT_SYMBOL(set_binfmt);
1244 * name into corename, which must have space for at least 1244 * name into corename, which must have space for at least
1245 * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. 1245 * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
1246 */ 1246 */
1247static void format_corename(char *corename, const char *pattern, long signr) 1247static int format_corename(char *corename, const char *pattern, long signr)
1248{ 1248{
1249 const char *pat_ptr = pattern; 1249 const char *pat_ptr = pattern;
1250 char *out_ptr = corename; 1250 char *out_ptr = corename;
1251 char *const out_end = corename + CORENAME_MAX_SIZE; 1251 char *const out_end = corename + CORENAME_MAX_SIZE;
1252 int rc; 1252 int rc;
1253 int pid_in_pattern = 0; 1253 int pid_in_pattern = 0;
1254 int ispipe = 0;
1255
1256 if (*pattern == '|')
1257 ispipe = 1;
1254 1258
1255 /* Repeat as long as we have more pattern to process and more output 1259 /* Repeat as long as we have more pattern to process and more output
1256 space */ 1260 space */
@@ -1341,8 +1345,8 @@ static void format_corename(char *corename, const char *pattern, long signr)
1341 * 1345 *
1342 * If core_pattern does not include a %p (as is the default) 1346 * If core_pattern does not include a %p (as is the default)
1343 * and core_uses_pid is set, then .%pid will be appended to 1347 * and core_uses_pid is set, then .%pid will be appended to
1344 * the filename */ 1348 * the filename. Do not do this for piped commands. */
1345 if (!pid_in_pattern 1349 if (!ispipe && !pid_in_pattern
1346 && (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)) { 1350 && (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)) {
1347 rc = snprintf(out_ptr, out_end - out_ptr, 1351 rc = snprintf(out_ptr, out_end - out_ptr,
1348 ".%d", current->tgid); 1352 ".%d", current->tgid);
@@ -1350,8 +1354,9 @@ static void format_corename(char *corename, const char *pattern, long signr)
1350 goto out; 1354 goto out;
1351 out_ptr += rc; 1355 out_ptr += rc;
1352 } 1356 }
1353 out: 1357out:
1354 *out_ptr = 0; 1358 *out_ptr = 0;
1359 return ispipe;
1355} 1360}
1356 1361
1357static void zap_process(struct task_struct *start) 1362static void zap_process(struct task_struct *start)
@@ -1502,16 +1507,15 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1502 * uses lock_kernel() 1507 * uses lock_kernel()
1503 */ 1508 */
1504 lock_kernel(); 1509 lock_kernel();
1505 format_corename(corename, core_pattern, signr); 1510 ispipe = format_corename(corename, core_pattern, signr);
1506 unlock_kernel(); 1511 unlock_kernel();
1507 if (corename[0] == '|') { 1512 if (ispipe) {
1508 /* SIGPIPE can happen, but it's just never processed */ 1513 /* SIGPIPE can happen, but it's just never processed */
1509 if(call_usermodehelper_pipe(corename+1, NULL, NULL, &file)) { 1514 if(call_usermodehelper_pipe(corename+1, NULL, NULL, &file)) {
1510 printk(KERN_INFO "Core dump to %s pipe failed\n", 1515 printk(KERN_INFO "Core dump to %s pipe failed\n",
1511 corename); 1516 corename);
1512 goto fail_unlock; 1517 goto fail_unlock;
1513 } 1518 }
1514 ispipe = 1;
1515 } else 1519 } else
1516 file = filp_open(corename, 1520 file = filp_open(corename,
1517 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag, 1521 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 92d8ec859e22..cd3469720cbf 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1684,7 +1684,8 @@ go_ahead:
1684 * ... prune child dentries and writebacks if needed. 1684 * ... prune child dentries and writebacks if needed.
1685 */ 1685 */
1686 if (atomic_read(&old_dentry->d_count) > 1) { 1686 if (atomic_read(&old_dentry->d_count) > 1) {
1687 nfs_wb_all(old_inode); 1687 if (S_ISREG(old_inode->i_mode))
1688 nfs_wb_all(old_inode);
1688 shrink_dcache_parent(old_dentry); 1689 shrink_dcache_parent(old_dentry);
1689 } 1690 }
1690 nfs_inode_return_delegation(old_inode); 1691 nfs_inode_return_delegation(old_inode);
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index b1c98ea39b72..2877744cb606 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -432,10 +432,10 @@ static void nfs_direct_commit_result(struct rpc_task *task, void *calldata)
432 if (NFS_PROTO(data->inode)->commit_done(task, data) != 0) 432 if (NFS_PROTO(data->inode)->commit_done(task, data) != 0)
433 return; 433 return;
434 if (unlikely(task->tk_status < 0)) { 434 if (unlikely(task->tk_status < 0)) {
435 dreq->error = task->tk_status; 435 dprintk("NFS: %5u commit failed with error %d.\n",
436 task->tk_pid, task->tk_status);
436 dreq->flags = NFS_ODIRECT_RESCHED_WRITES; 437 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
437 } 438 } else if (memcmp(&dreq->verf, &data->verf, sizeof(data->verf))) {
438 if (memcmp(&dreq->verf, &data->verf, sizeof(data->verf))) {
439 dprintk("NFS: %5u commit verify failed\n", task->tk_pid); 439 dprintk("NFS: %5u commit verify failed\n", task->tk_pid);
440 dreq->flags = NFS_ODIRECT_RESCHED_WRITES; 440 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
441 } 441 }
@@ -531,9 +531,12 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
531 531
532 spin_lock(&dreq->lock); 532 spin_lock(&dreq->lock);
533 533
534 if (unlikely(dreq->error != 0))
535 goto out_unlock;
534 if (unlikely(status < 0)) { 536 if (unlikely(status < 0)) {
537 /* An error has occured, so we should not commit */
538 dreq->flags = 0;
535 dreq->error = status; 539 dreq->error = status;
536 goto out_unlock;
537 } 540 }
538 541
539 dreq->count += data->res.count; 542 dreq->count += data->res.count;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 93d046c85f52..44aa9b726573 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -341,8 +341,10 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
341 lock_kernel(); 341 lock_kernel();
342 nfs_begin_data_update(inode); 342 nfs_begin_data_update(inode);
343 /* Write all dirty data */ 343 /* Write all dirty data */
344 filemap_write_and_wait(inode->i_mapping); 344 if (S_ISREG(inode->i_mode)) {
345 nfs_wb_all(inode); 345 filemap_write_and_wait(inode->i_mapping);
346 nfs_wb_all(inode);
347 }
346 /* 348 /*
347 * Return any delegations if we're going to change ACLs 349 * Return any delegations if we're going to change ACLs
348 */ 350 */
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 2867e6b7096f..797558941745 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -38,7 +38,6 @@
38static struct nfs_page * nfs_update_request(struct nfs_open_context*, 38static struct nfs_page * nfs_update_request(struct nfs_open_context*,
39 struct page *, 39 struct page *,
40 unsigned int, unsigned int); 40 unsigned int, unsigned int);
41static void nfs_mark_request_dirty(struct nfs_page *req);
42static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how); 41static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how);
43static const struct rpc_call_ops nfs_write_partial_ops; 42static const struct rpc_call_ops nfs_write_partial_ops;
44static const struct rpc_call_ops nfs_write_full_ops; 43static const struct rpc_call_ops nfs_write_full_ops;
@@ -218,9 +217,11 @@ int nfs_congestion_kb;
218#define NFS_CONGESTION_OFF_THRESH \ 217#define NFS_CONGESTION_OFF_THRESH \
219 (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2)) 218 (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2))
220 219
221static void nfs_set_page_writeback(struct page *page) 220static int nfs_set_page_writeback(struct page *page)
222{ 221{
223 if (!test_set_page_writeback(page)) { 222 int ret = test_set_page_writeback(page);
223
224 if (!ret) {
224 struct inode *inode = page->mapping->host; 225 struct inode *inode = page->mapping->host;
225 struct nfs_server *nfss = NFS_SERVER(inode); 226 struct nfs_server *nfss = NFS_SERVER(inode);
226 227
@@ -228,6 +229,7 @@ static void nfs_set_page_writeback(struct page *page)
228 NFS_CONGESTION_ON_THRESH) 229 NFS_CONGESTION_ON_THRESH)
229 set_bdi_congested(&nfss->backing_dev_info, WRITE); 230 set_bdi_congested(&nfss->backing_dev_info, WRITE);
230 } 231 }
232 return ret;
231} 233}
232 234
233static void nfs_end_page_writeback(struct page *page) 235static void nfs_end_page_writeback(struct page *page)
@@ -252,7 +254,8 @@ static void nfs_end_page_writeback(struct page *page)
252static int nfs_page_mark_flush(struct page *page) 254static int nfs_page_mark_flush(struct page *page)
253{ 255{
254 struct nfs_page *req; 256 struct nfs_page *req;
255 spinlock_t *req_lock = &NFS_I(page->mapping->host)->req_lock; 257 struct nfs_inode *nfsi = NFS_I(page->mapping->host);
258 spinlock_t *req_lock = &nfsi->req_lock;
256 int ret; 259 int ret;
257 260
258 spin_lock(req_lock); 261 spin_lock(req_lock);
@@ -276,11 +279,23 @@ static int nfs_page_mark_flush(struct page *page)
276 return ret; 279 return ret;
277 spin_lock(req_lock); 280 spin_lock(req_lock);
278 } 281 }
279 spin_unlock(req_lock); 282 if (test_bit(PG_NEED_COMMIT, &req->wb_flags)) {
280 if (test_and_set_bit(PG_FLUSHING, &req->wb_flags) == 0) { 283 /* This request is marked for commit */
281 nfs_mark_request_dirty(req); 284 spin_unlock(req_lock);
282 nfs_set_page_writeback(page); 285 nfs_unlock_request(req);
286 return 1;
283 } 287 }
288 if (nfs_set_page_writeback(page) == 0) {
289 nfs_list_remove_request(req);
290 /* add the request to the inode's dirty list. */
291 radix_tree_tag_set(&nfsi->nfs_page_tree,
292 req->wb_index, NFS_PAGE_TAG_DIRTY);
293 nfs_list_add_request(req, &nfsi->dirty);
294 nfsi->ndirty++;
295 spin_unlock(req_lock);
296 __mark_inode_dirty(page->mapping->host, I_DIRTY_PAGES);
297 } else
298 spin_unlock(req_lock);
284 ret = test_bit(PG_NEED_FLUSH, &req->wb_flags); 299 ret = test_bit(PG_NEED_FLUSH, &req->wb_flags);
285 nfs_unlock_request(req); 300 nfs_unlock_request(req);
286 return ret; 301 return ret;
@@ -373,6 +388,8 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
373 } 388 }
374 SetPagePrivate(req->wb_page); 389 SetPagePrivate(req->wb_page);
375 set_page_private(req->wb_page, (unsigned long)req); 390 set_page_private(req->wb_page, (unsigned long)req);
391 if (PageDirty(req->wb_page))
392 set_bit(PG_NEED_FLUSH, &req->wb_flags);
376 nfsi->npages++; 393 nfsi->npages++;
377 atomic_inc(&req->wb_count); 394 atomic_inc(&req->wb_count);
378 return 0; 395 return 0;
@@ -392,6 +409,8 @@ static void nfs_inode_remove_request(struct nfs_page *req)
392 set_page_private(req->wb_page, 0); 409 set_page_private(req->wb_page, 0);
393 ClearPagePrivate(req->wb_page); 410 ClearPagePrivate(req->wb_page);
394 radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index); 411 radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index);
412 if (test_and_clear_bit(PG_NEED_FLUSH, &req->wb_flags))
413 __set_page_dirty_nobuffers(req->wb_page);
395 nfsi->npages--; 414 nfsi->npages--;
396 if (!nfsi->npages) { 415 if (!nfsi->npages) {
397 spin_unlock(&nfsi->req_lock); 416 spin_unlock(&nfsi->req_lock);
@@ -403,28 +422,9 @@ static void nfs_inode_remove_request(struct nfs_page *req)
403 nfs_release_request(req); 422 nfs_release_request(req);
404} 423}
405 424
406/*
407 * Add a request to the inode's dirty list.
408 */
409static void
410nfs_mark_request_dirty(struct nfs_page *req)
411{
412 struct inode *inode = req->wb_context->dentry->d_inode;
413 struct nfs_inode *nfsi = NFS_I(inode);
414
415 spin_lock(&nfsi->req_lock);
416 radix_tree_tag_set(&nfsi->nfs_page_tree,
417 req->wb_index, NFS_PAGE_TAG_DIRTY);
418 nfs_list_add_request(req, &nfsi->dirty);
419 nfsi->ndirty++;
420 spin_unlock(&nfsi->req_lock);
421 __mark_inode_dirty(inode, I_DIRTY_PAGES);
422}
423
424static void 425static void
425nfs_redirty_request(struct nfs_page *req) 426nfs_redirty_request(struct nfs_page *req)
426{ 427{
427 clear_bit(PG_FLUSHING, &req->wb_flags);
428 __set_page_dirty_nobuffers(req->wb_page); 428 __set_page_dirty_nobuffers(req->wb_page);
429} 429}
430 430
@@ -434,7 +434,11 @@ nfs_redirty_request(struct nfs_page *req)
434static inline int 434static inline int
435nfs_dirty_request(struct nfs_page *req) 435nfs_dirty_request(struct nfs_page *req)
436{ 436{
437 return test_bit(PG_FLUSHING, &req->wb_flags) == 0; 437 struct page *page = req->wb_page;
438
439 if (page == NULL || test_bit(PG_NEED_COMMIT, &req->wb_flags))
440 return 0;
441 return !PageWriteback(req->wb_page);
438} 442}
439 443
440#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 444#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
@@ -450,10 +454,48 @@ nfs_mark_request_commit(struct nfs_page *req)
450 spin_lock(&nfsi->req_lock); 454 spin_lock(&nfsi->req_lock);
451 nfs_list_add_request(req, &nfsi->commit); 455 nfs_list_add_request(req, &nfsi->commit);
452 nfsi->ncommit++; 456 nfsi->ncommit++;
457 set_bit(PG_NEED_COMMIT, &(req)->wb_flags);
453 spin_unlock(&nfsi->req_lock); 458 spin_unlock(&nfsi->req_lock);
454 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 459 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
455 __mark_inode_dirty(inode, I_DIRTY_DATASYNC); 460 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
456} 461}
462
463static inline
464int nfs_write_need_commit(struct nfs_write_data *data)
465{
466 return data->verf.committed != NFS_FILE_SYNC;
467}
468
469static inline
470int nfs_reschedule_unstable_write(struct nfs_page *req)
471{
472 if (test_bit(PG_NEED_COMMIT, &req->wb_flags)) {
473 nfs_mark_request_commit(req);
474 return 1;
475 }
476 if (test_and_clear_bit(PG_NEED_RESCHED, &req->wb_flags)) {
477 nfs_redirty_request(req);
478 return 1;
479 }
480 return 0;
481}
482#else
483static inline void
484nfs_mark_request_commit(struct nfs_page *req)
485{
486}
487
488static inline
489int nfs_write_need_commit(struct nfs_write_data *data)
490{
491 return 0;
492}
493
494static inline
495int nfs_reschedule_unstable_write(struct nfs_page *req)
496{
497 return 0;
498}
457#endif 499#endif
458 500
459/* 501/*
@@ -500,6 +542,7 @@ static void nfs_cancel_dirty_list(struct list_head *head)
500 while(!list_empty(head)) { 542 while(!list_empty(head)) {
501 req = nfs_list_entry(head->next); 543 req = nfs_list_entry(head->next);
502 nfs_list_remove_request(req); 544 nfs_list_remove_request(req);
545 nfs_end_page_writeback(req->wb_page);
503 nfs_inode_remove_request(req); 546 nfs_inode_remove_request(req);
504 nfs_clear_page_writeback(req); 547 nfs_clear_page_writeback(req);
505 } 548 }
@@ -513,6 +556,7 @@ static void nfs_cancel_commit_list(struct list_head *head)
513 req = nfs_list_entry(head->next); 556 req = nfs_list_entry(head->next);
514 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 557 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
515 nfs_list_remove_request(req); 558 nfs_list_remove_request(req);
559 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags);
516 nfs_inode_remove_request(req); 560 nfs_inode_remove_request(req);
517 nfs_unlock_request(req); 561 nfs_unlock_request(req);
518 } 562 }
@@ -739,26 +783,12 @@ int nfs_updatepage(struct file *file, struct page *page,
739 783
740static void nfs_writepage_release(struct nfs_page *req) 784static void nfs_writepage_release(struct nfs_page *req)
741{ 785{
742 nfs_end_page_writeback(req->wb_page);
743
744#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
745 if (!PageError(req->wb_page)) {
746 if (NFS_NEED_RESCHED(req)) {
747 nfs_redirty_request(req);
748 goto out;
749 } else if (NFS_NEED_COMMIT(req)) {
750 nfs_mark_request_commit(req);
751 goto out;
752 }
753 }
754 nfs_inode_remove_request(req);
755 786
756out: 787 if (PageError(req->wb_page) || !nfs_reschedule_unstable_write(req)) {
757 nfs_clear_commit(req); 788 nfs_end_page_writeback(req->wb_page);
758 nfs_clear_reschedule(req); 789 nfs_inode_remove_request(req);
759#else 790 } else
760 nfs_inode_remove_request(req); 791 nfs_end_page_writeback(req->wb_page);
761#endif
762 nfs_clear_page_writeback(req); 792 nfs_clear_page_writeback(req);
763} 793}
764 794
@@ -891,6 +921,7 @@ out_bad:
891 nfs_writedata_release(data); 921 nfs_writedata_release(data);
892 } 922 }
893 nfs_redirty_request(req); 923 nfs_redirty_request(req);
924 nfs_end_page_writeback(req->wb_page);
894 nfs_clear_page_writeback(req); 925 nfs_clear_page_writeback(req);
895 return -ENOMEM; 926 return -ENOMEM;
896} 927}
@@ -936,6 +967,7 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, int how)
936 struct nfs_page *req = nfs_list_entry(head->next); 967 struct nfs_page *req = nfs_list_entry(head->next);
937 nfs_list_remove_request(req); 968 nfs_list_remove_request(req);
938 nfs_redirty_request(req); 969 nfs_redirty_request(req);
970 nfs_end_page_writeback(req->wb_page);
939 nfs_clear_page_writeback(req); 971 nfs_clear_page_writeback(req);
940 } 972 }
941 return -ENOMEM; 973 return -ENOMEM;
@@ -971,6 +1003,7 @@ out_err:
971 req = nfs_list_entry(head->next); 1003 req = nfs_list_entry(head->next);
972 nfs_list_remove_request(req); 1004 nfs_list_remove_request(req);
973 nfs_redirty_request(req); 1005 nfs_redirty_request(req);
1006 nfs_end_page_writeback(req->wb_page);
974 nfs_clear_page_writeback(req); 1007 nfs_clear_page_writeback(req);
975 } 1008 }
976 return error; 1009 return error;
@@ -998,22 +1031,28 @@ static void nfs_writeback_done_partial(struct rpc_task *task, void *calldata)
998 nfs_set_pageerror(page); 1031 nfs_set_pageerror(page);
999 req->wb_context->error = task->tk_status; 1032 req->wb_context->error = task->tk_status;
1000 dprintk(", error = %d\n", task->tk_status); 1033 dprintk(", error = %d\n", task->tk_status);
1001 } else { 1034 goto out;
1002#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
1003 if (data->verf.committed < NFS_FILE_SYNC) {
1004 if (!NFS_NEED_COMMIT(req)) {
1005 nfs_defer_commit(req);
1006 memcpy(&req->wb_verf, &data->verf, sizeof(req->wb_verf));
1007 dprintk(" defer commit\n");
1008 } else if (memcmp(&req->wb_verf, &data->verf, sizeof(req->wb_verf))) {
1009 nfs_defer_reschedule(req);
1010 dprintk(" server reboot detected\n");
1011 }
1012 } else
1013#endif
1014 dprintk(" OK\n");
1015 } 1035 }
1016 1036
1037 if (nfs_write_need_commit(data)) {
1038 spinlock_t *req_lock = &NFS_I(page->mapping->host)->req_lock;
1039
1040 spin_lock(req_lock);
1041 if (test_bit(PG_NEED_RESCHED, &req->wb_flags)) {
1042 /* Do nothing we need to resend the writes */
1043 } else if (!test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags)) {
1044 memcpy(&req->wb_verf, &data->verf, sizeof(req->wb_verf));
1045 dprintk(" defer commit\n");
1046 } else if (memcmp(&req->wb_verf, &data->verf, sizeof(req->wb_verf))) {
1047 set_bit(PG_NEED_RESCHED, &req->wb_flags);
1048 clear_bit(PG_NEED_COMMIT, &req->wb_flags);
1049 dprintk(" server reboot detected\n");
1050 }
1051 spin_unlock(req_lock);
1052 } else
1053 dprintk(" OK\n");
1054
1055out:
1017 if (atomic_dec_and_test(&req->wb_complete)) 1056 if (atomic_dec_and_test(&req->wb_complete))
1018 nfs_writepage_release(req); 1057 nfs_writepage_release(req);
1019} 1058}
@@ -1054,25 +1093,21 @@ static void nfs_writeback_done_full(struct rpc_task *task, void *calldata)
1054 if (task->tk_status < 0) { 1093 if (task->tk_status < 0) {
1055 nfs_set_pageerror(page); 1094 nfs_set_pageerror(page);
1056 req->wb_context->error = task->tk_status; 1095 req->wb_context->error = task->tk_status;
1057 nfs_end_page_writeback(page);
1058 nfs_inode_remove_request(req);
1059 dprintk(", error = %d\n", task->tk_status); 1096 dprintk(", error = %d\n", task->tk_status);
1060 goto next; 1097 goto remove_request;
1061 } 1098 }
1062 nfs_end_page_writeback(page);
1063 1099
1064#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 1100 if (nfs_write_need_commit(data)) {
1065 if (data->args.stable != NFS_UNSTABLE || data->verf.committed == NFS_FILE_SYNC) { 1101 memcpy(&req->wb_verf, &data->verf, sizeof(req->wb_verf));
1066 nfs_inode_remove_request(req); 1102 nfs_mark_request_commit(req);
1067 dprintk(" OK\n"); 1103 nfs_end_page_writeback(page);
1104 dprintk(" marked for commit\n");
1068 goto next; 1105 goto next;
1069 } 1106 }
1070 memcpy(&req->wb_verf, &data->verf, sizeof(req->wb_verf)); 1107 dprintk(" OK\n");
1071 nfs_mark_request_commit(req); 1108remove_request:
1072 dprintk(" marked for commit\n"); 1109 nfs_end_page_writeback(page);
1073#else
1074 nfs_inode_remove_request(req); 1110 nfs_inode_remove_request(req);
1075#endif
1076 next: 1111 next:
1077 nfs_clear_page_writeback(req); 1112 nfs_clear_page_writeback(req);
1078 } 1113 }
@@ -1260,6 +1295,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
1260 while (!list_empty(&data->pages)) { 1295 while (!list_empty(&data->pages)) {
1261 req = nfs_list_entry(data->pages.next); 1296 req = nfs_list_entry(data->pages.next);
1262 nfs_list_remove_request(req); 1297 nfs_list_remove_request(req);
1298 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags);
1263 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1299 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1264 1300
1265 dprintk("NFS: commit (%s/%Ld %d@%Ld)", 1301 dprintk("NFS: commit (%s/%Ld %d@%Ld)",
@@ -1495,15 +1531,22 @@ int nfs_wb_page(struct inode *inode, struct page* page)
1495 1531
1496int nfs_set_page_dirty(struct page *page) 1532int nfs_set_page_dirty(struct page *page)
1497{ 1533{
1534 spinlock_t *req_lock = &NFS_I(page->mapping->host)->req_lock;
1498 struct nfs_page *req; 1535 struct nfs_page *req;
1536 int ret;
1499 1537
1500 req = nfs_page_find_request(page); 1538 spin_lock(req_lock);
1539 req = nfs_page_find_request_locked(page);
1501 if (req != NULL) { 1540 if (req != NULL) {
1502 /* Mark any existing write requests for flushing */ 1541 /* Mark any existing write requests for flushing */
1503 set_bit(PG_NEED_FLUSH, &req->wb_flags); 1542 ret = !test_and_set_bit(PG_NEED_FLUSH, &req->wb_flags);
1543 spin_unlock(req_lock);
1504 nfs_release_request(req); 1544 nfs_release_request(req);
1545 return ret;
1505 } 1546 }
1506 return __set_page_dirty_nobuffers(page); 1547 ret = __set_page_dirty_nobuffers(page);
1548 spin_unlock(req_lock);
1549 return ret;
1507} 1550}
1508 1551
1509 1552
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c
index b9b423b22a8b..9475557ab499 100644
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -23,7 +23,7 @@ static void sd_decrement_key(struct cpu_key *key)
23{ 23{
24 key->on_disk_key.k_objectid--; 24 key->on_disk_key.k_objectid--;
25 set_cpu_key_k_type(key, TYPE_ANY); 25 set_cpu_key_k_type(key, TYPE_ANY);
26 set_cpu_key_k_offset(key, (loff_t) (-1)); 26 set_cpu_key_k_offset(key, (loff_t)(~0ULL >> 1));
27} 27}
28 28
29static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize) 29static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize)
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index f01389fd162e..c8178b7b9212 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -54,82 +54,48 @@
54static struct reiserfs_xattr_handler *find_xattr_handler_prefix(const char 54static struct reiserfs_xattr_handler *find_xattr_handler_prefix(const char
55 *prefix); 55 *prefix);
56 56
57static struct dentry *create_xa_root(struct super_block *sb) 57/* Returns the dentry referring to the root of the extended attribute
58 * directory tree. If it has already been retrieved, it is used. If it
59 * hasn't been created and the flags indicate creation is allowed, we
60 * attempt to create it. On error, we return a pointer-encoded error.
61 */
62static struct dentry *get_xa_root(struct super_block *sb, int flags)
58{ 63{
59 struct dentry *privroot = dget(REISERFS_SB(sb)->priv_root); 64 struct dentry *privroot = dget(REISERFS_SB(sb)->priv_root);
60 struct dentry *xaroot; 65 struct dentry *xaroot;
61 66
62 /* This needs to be created at mount-time */ 67 /* This needs to be created at mount-time */
63 if (!privroot) 68 if (!privroot)
64 return ERR_PTR(-EOPNOTSUPP); 69 return ERR_PTR(-ENODATA);
65 70
66 xaroot = lookup_one_len(XAROOT_NAME, privroot, strlen(XAROOT_NAME)); 71 mutex_lock(&privroot->d_inode->i_mutex);
67 if (IS_ERR(xaroot)) { 72 if (REISERFS_SB(sb)->xattr_root) {
73 xaroot = dget(REISERFS_SB(sb)->xattr_root);
68 goto out; 74 goto out;
69 } else if (!xaroot->d_inode) {
70 int err;
71 mutex_lock(&privroot->d_inode->i_mutex);
72 err =
73 privroot->d_inode->i_op->mkdir(privroot->d_inode, xaroot,
74 0700);
75 mutex_unlock(&privroot->d_inode->i_mutex);
76
77 if (err) {
78 dput(xaroot);
79 dput(privroot);
80 return ERR_PTR(err);
81 }
82 REISERFS_SB(sb)->xattr_root = dget(xaroot);
83 } 75 }
84 76
85 out:
86 dput(privroot);
87 return xaroot;
88}
89
90/* This will return a dentry, or error, refering to the xa root directory.
91 * If the xa root doesn't exist yet, the dentry will be returned without
92 * an associated inode. This dentry can be used with ->mkdir to create
93 * the xa directory. */
94static struct dentry *__get_xa_root(struct super_block *s)
95{
96 struct dentry *privroot = dget(REISERFS_SB(s)->priv_root);
97 struct dentry *xaroot = NULL;
98
99 if (IS_ERR(privroot) || !privroot)
100 return privroot;
101
102 xaroot = lookup_one_len(XAROOT_NAME, privroot, strlen(XAROOT_NAME)); 77 xaroot = lookup_one_len(XAROOT_NAME, privroot, strlen(XAROOT_NAME));
103 if (IS_ERR(xaroot)) { 78 if (IS_ERR(xaroot)) {
104 goto out; 79 goto out;
105 } else if (!xaroot->d_inode) { 80 } else if (!xaroot->d_inode) {
106 dput(xaroot); 81 int err = -ENODATA;
107 xaroot = NULL; 82 if (flags == 0 || flags & XATTR_CREATE)
108 goto out; 83 err = privroot->d_inode->i_op->mkdir(privroot->d_inode,
84 xaroot, 0700);
85 if (err) {
86 dput(xaroot);
87 xaroot = ERR_PTR(err);
88 goto out;
89 }
109 } 90 }
110 91 REISERFS_SB(sb)->xattr_root = dget(xaroot);
111 REISERFS_SB(s)->xattr_root = dget(xaroot);
112 92
113 out: 93 out:
94 mutex_unlock(&privroot->d_inode->i_mutex);
114 dput(privroot); 95 dput(privroot);
115 return xaroot; 96 return xaroot;
116} 97}
117 98
118/* Returns the dentry (or NULL) referring to the root of the extended
119 * attribute directory tree. If it has already been retrieved, it is used.
120 * Otherwise, we attempt to retrieve it from disk. It may also return
121 * a pointer-encoded error.
122 */
123static inline struct dentry *get_xa_root(struct super_block *s)
124{
125 struct dentry *dentry = dget(REISERFS_SB(s)->xattr_root);
126
127 if (!dentry)
128 dentry = __get_xa_root(s);
129
130 return dentry;
131}
132
133/* Opens the directory corresponding to the inode's extended attribute store. 99/* Opens the directory corresponding to the inode's extended attribute store.
134 * If flags allow, the tree to the directory may be created. If creation is 100 * If flags allow, the tree to the directory may be created. If creation is
135 * prohibited, -ENODATA is returned. */ 101 * prohibited, -ENODATA is returned. */
@@ -138,21 +104,11 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags)
138 struct dentry *xaroot, *xadir; 104 struct dentry *xaroot, *xadir;
139 char namebuf[17]; 105 char namebuf[17];
140 106
141 xaroot = get_xa_root(inode->i_sb); 107 xaroot = get_xa_root(inode->i_sb, flags);
142 if (IS_ERR(xaroot)) { 108 if (IS_ERR(xaroot))
143 return xaroot; 109 return xaroot;
144 } else if (!xaroot) {
145 if (flags == 0 || flags & XATTR_CREATE) {
146 xaroot = create_xa_root(inode->i_sb);
147 if (IS_ERR(xaroot))
148 return xaroot;
149 }
150 if (!xaroot)
151 return ERR_PTR(-ENODATA);
152 }
153 110
154 /* ok, we have xaroot open */ 111 /* ok, we have xaroot open */
155
156 snprintf(namebuf, sizeof(namebuf), "%X.%X", 112 snprintf(namebuf, sizeof(namebuf), "%X.%X",
157 le32_to_cpu(INODE_PKEY(inode)->k_objectid), 113 le32_to_cpu(INODE_PKEY(inode)->k_objectid),
158 inode->i_generation); 114 inode->i_generation);
@@ -821,7 +777,7 @@ int reiserfs_delete_xattrs(struct inode *inode)
821 777
822 /* Leftovers besides . and .. -- that's not good. */ 778 /* Leftovers besides . and .. -- that's not good. */
823 if (dir->d_inode->i_nlink <= 2) { 779 if (dir->d_inode->i_nlink <= 2) {
824 root = get_xa_root(inode->i_sb); 780 root = get_xa_root(inode->i_sb, XATTR_REPLACE);
825 reiserfs_write_lock_xattrs(inode->i_sb); 781 reiserfs_write_lock_xattrs(inode->i_sb);
826 err = vfs_rmdir(root->d_inode, dir); 782 err = vfs_rmdir(root->d_inode, dir);
827 reiserfs_write_unlock_xattrs(inode->i_sb); 783 reiserfs_write_unlock_xattrs(inode->i_sb);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 013d7afe7cde..f18b79122fa3 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -601,7 +601,7 @@ static void ufs_set_inode_ops(struct inode *inode)
601 ufs_get_inode_dev(inode->i_sb, UFS_I(inode))); 601 ufs_get_inode_dev(inode->i_sb, UFS_I(inode)));
602} 602}
603 603
604static void ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) 604static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
605{ 605{
606 struct ufs_inode_info *ufsi = UFS_I(inode); 606 struct ufs_inode_info *ufsi = UFS_I(inode);
607 struct super_block *sb = inode->i_sb; 607 struct super_block *sb = inode->i_sb;
@@ -613,8 +613,10 @@ static void ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
613 */ 613 */
614 inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode); 614 inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode);
615 inode->i_nlink = fs16_to_cpu(sb, ufs_inode->ui_nlink); 615 inode->i_nlink = fs16_to_cpu(sb, ufs_inode->ui_nlink);
616 if (inode->i_nlink == 0) 616 if (inode->i_nlink == 0) {
617 ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); 617 ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino);
618 return -1;
619 }
618 620
619 /* 621 /*
620 * Linux now has 32-bit uid and gid, so we can support EFT. 622 * Linux now has 32-bit uid and gid, so we can support EFT.
@@ -643,9 +645,10 @@ static void ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
643 for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) 645 for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++)
644 ufsi->i_u1.i_symlink[i] = ufs_inode->ui_u2.ui_symlink[i]; 646 ufsi->i_u1.i_symlink[i] = ufs_inode->ui_u2.ui_symlink[i];
645 } 647 }
648 return 0;
646} 649}
647 650
648static void ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) 651static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
649{ 652{
650 struct ufs_inode_info *ufsi = UFS_I(inode); 653 struct ufs_inode_info *ufsi = UFS_I(inode);
651 struct super_block *sb = inode->i_sb; 654 struct super_block *sb = inode->i_sb;
@@ -658,8 +661,10 @@ static void ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
658 */ 661 */
659 inode->i_mode = mode = fs16_to_cpu(sb, ufs2_inode->ui_mode); 662 inode->i_mode = mode = fs16_to_cpu(sb, ufs2_inode->ui_mode);
660 inode->i_nlink = fs16_to_cpu(sb, ufs2_inode->ui_nlink); 663 inode->i_nlink = fs16_to_cpu(sb, ufs2_inode->ui_nlink);
661 if (inode->i_nlink == 0) 664 if (inode->i_nlink == 0) {
662 ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); 665 ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino);
666 return -1;
667 }
663 668
664 /* 669 /*
665 * Linux now has 32-bit uid and gid, so we can support EFT. 670 * Linux now has 32-bit uid and gid, so we can support EFT.
@@ -690,6 +695,7 @@ static void ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
690 for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) 695 for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++)
691 ufsi->i_u1.i_symlink[i] = ufs2_inode->ui_u2.ui_symlink[i]; 696 ufsi->i_u1.i_symlink[i] = ufs2_inode->ui_u2.ui_symlink[i];
692 } 697 }
698 return 0;
693} 699}
694 700
695void ufs_read_inode(struct inode * inode) 701void ufs_read_inode(struct inode * inode)
@@ -698,6 +704,7 @@ void ufs_read_inode(struct inode * inode)
698 struct super_block * sb; 704 struct super_block * sb;
699 struct ufs_sb_private_info * uspi; 705 struct ufs_sb_private_info * uspi;
700 struct buffer_head * bh; 706 struct buffer_head * bh;
707 int err;
701 708
702 UFSD("ENTER, ino %lu\n", inode->i_ino); 709 UFSD("ENTER, ino %lu\n", inode->i_ino);
703 710
@@ -720,14 +727,17 @@ void ufs_read_inode(struct inode * inode)
720 if ((UFS_SB(sb)->s_flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { 727 if ((UFS_SB(sb)->s_flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
721 struct ufs2_inode *ufs2_inode = (struct ufs2_inode *)bh->b_data; 728 struct ufs2_inode *ufs2_inode = (struct ufs2_inode *)bh->b_data;
722 729
723 ufs2_read_inode(inode, 730 err = ufs2_read_inode(inode,
724 ufs2_inode + ufs_inotofsbo(inode->i_ino)); 731 ufs2_inode + ufs_inotofsbo(inode->i_ino));
725 } else { 732 } else {
726 struct ufs_inode *ufs_inode = (struct ufs_inode *)bh->b_data; 733 struct ufs_inode *ufs_inode = (struct ufs_inode *)bh->b_data;
727 734
728 ufs1_read_inode(inode, ufs_inode + ufs_inotofsbo(inode->i_ino)); 735 err = ufs1_read_inode(inode,
736 ufs_inode + ufs_inotofsbo(inode->i_ino));
729 } 737 }
730 738
739 if (err)
740 goto bad_inode;
731 inode->i_version++; 741 inode->i_version++;
732 ufsi->i_lastfrag = 742 ufsi->i_lastfrag =
733 (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift; 743 (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift;
@@ -888,6 +898,8 @@ void ufs_delete_inode (struct inode * inode)
888 loff_t old_i_size; 898 loff_t old_i_size;
889 899
890 truncate_inode_pages(&inode->i_data, 0); 900 truncate_inode_pages(&inode->i_data, 0);
901 if (is_bad_inode(inode))
902 goto no_delete;
891 /*UFS_I(inode)->i_dtime = CURRENT_TIME;*/ 903 /*UFS_I(inode)->i_dtime = CURRENT_TIME;*/
892 lock_kernel(); 904 lock_kernel();
893 mark_inode_dirty(inode); 905 mark_inode_dirty(inode);
@@ -898,4 +910,7 @@ void ufs_delete_inode (struct inode * inode)
898 ufs_warning(inode->i_sb, __FUNCTION__, "ufs_truncate failed\n"); 910 ufs_warning(inode->i_sb, __FUNCTION__, "ufs_truncate failed\n");
899 ufs_free_inode (inode); 911 ufs_free_inode (inode);
900 unlock_kernel(); 912 unlock_kernel();
913 return;
914no_delete:
915 clear_inode(inode); /* We must guarantee clearing of inode... */
901} 916}
diff --git a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h
index d2768cc3d7a4..da6bb199839c 100644
--- a/include/asm-alpha/compiler.h
+++ b/include/asm-alpha/compiler.h
@@ -17,9 +17,6 @@
17# define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift) 17# define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift)
18# define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift) 18# define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift)
19# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b) 19# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b)
20# define __kernel_cttz(x) __builtin_ctzl(x)
21# define __kernel_ctlz(x) __builtin_clzl(x)
22# define __kernel_ctpop(x) __builtin_popcountl(x)
23#else 20#else
24# define __kernel_insbl(val, shift) \ 21# define __kernel_insbl(val, shift) \
25 ({ unsigned long __kir; \ 22 ({ unsigned long __kir; \
@@ -49,17 +46,39 @@
49 ({ unsigned long __kir; \ 46 ({ unsigned long __kir; \
50 __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \ 47 __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \
51 __kir; }) 48 __kir; })
49#endif
50
51#ifdef __alpha_cix__
52# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
53# define __kernel_cttz(x) __builtin_ctzl(x)
54# define __kernel_ctlz(x) __builtin_clzl(x)
55# define __kernel_ctpop(x) __builtin_popcountl(x)
56# else
57# define __kernel_cttz(x) \
58 ({ unsigned long __kir; \
59 __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \
60 __kir; })
61# define __kernel_ctlz(x) \
62 ({ unsigned long __kir; \
63 __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
64 __kir; })
65# define __kernel_ctpop(x) \
66 ({ unsigned long __kir; \
67 __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
68 __kir; })
69# endif
70#else
52# define __kernel_cttz(x) \ 71# define __kernel_cttz(x) \
53 ({ unsigned long __kir; \ 72 ({ unsigned long __kir; \
54 __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \ 73 __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x)); \
55 __kir; }) 74 __kir; })
56# define __kernel_ctlz(x) \ 75# define __kernel_ctlz(x) \
57 ({ unsigned long __kir; \ 76 ({ unsigned long __kir; \
58 __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \ 77 __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
59 __kir; }) 78 __kir; })
60# define __kernel_ctpop(x) \ 79# define __kernel_ctpop(x) \
61 ({ unsigned long __kir; \ 80 ({ unsigned long __kir; \
62 __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \ 81 __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
63 __kir; }) 82 __kir; })
64#endif 83#endif
65 84
@@ -78,16 +97,20 @@
78#else 97#else
79#define __kernel_ldbu(mem) \ 98#define __kernel_ldbu(mem) \
80 ({ unsigned char __kir; \ 99 ({ unsigned char __kir; \
81 __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \ 100 __asm__(".arch ev56; \
101 ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \
82 __kir; }) 102 __kir; })
83#define __kernel_ldwu(mem) \ 103#define __kernel_ldwu(mem) \
84 ({ unsigned short __kir; \ 104 ({ unsigned short __kir; \
85 __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \ 105 __asm__(".arch ev56; \
106 ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \
86 __kir; }) 107 __kir; })
87#define __kernel_stb(val,mem) \ 108#define __kernel_stb(val,mem) \
88 __asm__("stb %1,%0" : "=m"(mem) : "r"(val)) 109 __asm__(".arch ev56; \
89#define __kernel_stw(val,mem) \ 110 stb %1,%0" : "=m"(mem) : "r"(val))
90 __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) 111#define __kernel_stw(val,mem) \
112 __asm__(".arch ev56; \
113 stw %1,%0" : "=m"(mem) : "r"(val))
91#endif 114#endif
92 115
93#ifdef __KERNEL__ 116#ifdef __KERNEL__
diff --git a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h
index 980a3c51b18e..525b4f6a7ace 100644
--- a/include/asm-alpha/core_mcpcia.h
+++ b/include/asm-alpha/core_mcpcia.h
@@ -72,6 +72,8 @@
72 * 72 *
73 */ 73 */
74 74
75#define MCPCIA_MAX_HOSES 4
76
75#define MCPCIA_MID(m) ((unsigned long)(m) << 33) 77#define MCPCIA_MID(m) ((unsigned long)(m) << 33)
76 78
77/* Dodge has PCI0 and PCI1 at MID 4 and 5 respectively. 79/* Dodge has PCI0 and PCI1 at MID 4 and 5 respectively.
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index 24bdcc8b63aa..21a86f1a05b3 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -113,6 +113,7 @@ static inline unsigned long virt_to_bus(void *address)
113 unsigned long bus = phys + __direct_map_base; 113 unsigned long bus = phys + __direct_map_base;
114 return phys <= __direct_map_size ? bus : 0; 114 return phys <= __direct_map_size ? bus : 0;
115} 115}
116#define isa_virt_to_bus virt_to_bus
116 117
117static inline void *bus_to_virt(unsigned long address) 118static inline void *bus_to_virt(unsigned long address)
118{ 119{
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h
index 17cb6cc3f21a..da205b7cdaac 100644
--- a/include/asm-ia64/sn/pcibr_provider.h
+++ b/include/asm-ia64/sn/pcibr_provider.h
@@ -21,6 +21,7 @@
21#define IS_PCI_BRIDGE_ASIC(asic) (asic == PCIIO_ASIC_TYPE_PIC || \ 21#define IS_PCI_BRIDGE_ASIC(asic) (asic == PCIIO_ASIC_TYPE_PIC || \
22 asic == PCIIO_ASIC_TYPE_TIOCP) 22 asic == PCIIO_ASIC_TYPE_TIOCP)
23#define IS_PIC_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_PIC) 23#define IS_PIC_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_PIC)
24#define IS_TIOCP_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_TIOCP)
24 25
25 26
26/* 27/*
@@ -53,8 +54,8 @@
53 * Bridge PMU Address Transaltion Entry Attibutes 54 * Bridge PMU Address Transaltion Entry Attibutes
54 */ 55 */
55#define PCI32_ATE_V (0x1 << 0) 56#define PCI32_ATE_V (0x1 << 0)
56#define PCI32_ATE_CO (0x1 << 1) 57#define PCI32_ATE_CO (0x1 << 1) /* PIC ASIC ONLY */
57#define PCI32_ATE_PREC (0x1 << 2) 58#define PCI32_ATE_PIO (0x1 << 1) /* TIOCP ASIC ONLY */
58#define PCI32_ATE_MSI (0x1 << 2) 59#define PCI32_ATE_MSI (0x1 << 2)
59#define PCI32_ATE_PREF (0x1 << 3) 60#define PCI32_ATE_PREF (0x1 << 3)
60#define PCI32_ATE_BAR (0x1 << 4) 61#define PCI32_ATE_BAR (0x1 << 4)
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
index 4d560a533940..7eb63de808bc 100644
--- a/include/asm-mips/bug.h
+++ b/include/asm-mips/bug.h
@@ -18,7 +18,8 @@ do { \
18 18
19#define BUG_ON(condition) \ 19#define BUG_ON(condition) \
20do { \ 20do { \
21 __asm__ __volatile__("tne $0, %0" : : "r" (condition)); \ 21 __asm__ __volatile__("tne $0, %0, %1" \
22 : : "r" (condition), "i" (BRK_BUG)); \
22} while (0) 23} while (0)
23 24
24#define HAVE_ARCH_BUG_ON 25#define HAVE_ARCH_BUG_ON
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index 20a81e1548f5..290485ac5407 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -166,7 +166,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr,
166#else 166#else
167 "r" (proto + len), 167 "r" (proto + len),
168#endif 168#endif
169 "r" (sum)); 169 "r" ((__force unsigned long)sum));
170 170
171 return sum; 171 return sum;
172} 172}
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 4e12d1f9534f..b414a7d9db43 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -68,8 +68,6 @@ do { \
68 /* We don't care about the c0 hazard here */ \ 68 /* We don't care about the c0 hazard here */ \
69} while (0) 69} while (0)
70 70
71#define __fpu_enabled() (read_c0_status() & ST0_CU1)
72
73#define enable_fpu() \ 71#define enable_fpu() \
74do { \ 72do { \
75 if (cpu_has_fpu) \ 73 if (cpu_has_fpu) \
@@ -102,14 +100,19 @@ static inline void __own_fpu(void)
102 set_thread_flag(TIF_USEDFPU); 100 set_thread_flag(TIF_USEDFPU);
103} 101}
104 102
105static inline void own_fpu(int restore) 103static inline void own_fpu_inatomic(int restore)
106{ 104{
107 preempt_disable();
108 if (cpu_has_fpu && !__is_fpu_owner()) { 105 if (cpu_has_fpu && !__is_fpu_owner()) {
109 __own_fpu(); 106 __own_fpu();
110 if (restore) 107 if (restore)
111 _restore_fp(current); 108 _restore_fp(current);
112 } 109 }
110}
111
112static inline void own_fpu(int restore)
113{
114 preempt_disable();
115 own_fpu_inatomic(restore);
113 preempt_enable(); 116 preempt_enable();
114} 117}
115 118
@@ -162,18 +165,4 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
162 return tsk->thread.fpu.fpr; 165 return tsk->thread.fpu.fpr;
163} 166}
164 167
165static inline void enable_fp_in_kernel(void)
166{
167 set_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
168 /* make sure CU1 and FPU ownership are consistent */
169 if (!__is_fpu_owner() && __fpu_enabled())
170 __disable_fpu();
171}
172
173static inline void disable_fp_in_kernel(void)
174{
175 BUG_ON(!__is_fpu_owner() && __fpu_enabled());
176 clear_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
177}
178
179#endif /* _ASM_FPU_H */ 168#endif /* _ASM_FPU_H */
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
index 7ed0bb611e56..b6a7d8f6ced5 100644
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -84,6 +84,7 @@
84#define K_SYS_REVISION_BCM112x_A2 0x21 84#define K_SYS_REVISION_BCM112x_A2 0x21
85#define K_SYS_REVISION_BCM112x_A3 0x22 85#define K_SYS_REVISION_BCM112x_A3 0x22
86#define K_SYS_REVISION_BCM112x_A4 0x23 86#define K_SYS_REVISION_BCM112x_A4 0x23
87#define K_SYS_REVISION_BCM112x_B0 0x30
87 88
88#define K_SYS_REVISION_BCM1480_S0 0x01 89#define K_SYS_REVISION_BCM1480_S0 0x01
89#define K_SYS_REVISION_BCM1480_A1 0x02 90#define K_SYS_REVISION_BCM1480_A1 0x02
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index 6cf05f4a4e7e..fbcda8204473 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -119,7 +119,6 @@ register struct thread_info *__current_thread_info __asm__("$28");
119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
120#define TIF_MEMDIE 18 120#define TIF_MEMDIE 18
121#define TIF_FREEZE 19 121#define TIF_FREEZE 19
122#define TIF_ALLOW_FP_IN_KERNEL 20
123#define TIF_SYSCALL_TRACE 31 /* syscall trace active */ 122#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
124 123
125#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 124#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 8d853c554631..0b00068313f9 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -288,7 +288,7 @@ COMPAT_SYS(ppoll)
288SYSCALL_SPU(unshare) 288SYSCALL_SPU(unshare)
289SYSCALL_SPU(splice) 289SYSCALL_SPU(splice)
290SYSCALL_SPU(tee) 290SYSCALL_SPU(tee)
291SYSCALL_SPU(vmsplice) 291COMPAT_SYS_SPU(vmsplice)
292COMPAT_SYS_SPU(openat) 292COMPAT_SYS_SPU(openat)
293SYSCALL_SPU(mkdirat) 293SYSCALL_SPU(mkdirat)
294SYSCALL_SPU(mknodat) 294SYSCALL_SPU(mknodat)
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 58564a199862..d3bbc7188b6a 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -861,6 +861,8 @@ typedef struct hwgroup_s {
861 int (*expiry)(ide_drive_t *); 861 int (*expiry)(ide_drive_t *);
862 /* ide_system_bus_speed */ 862 /* ide_system_bus_speed */
863 int pio_clock; 863 int pio_clock;
864 int req_gen;
865 int req_gen_timer;
864 866
865 unsigned char cmd_buf[4]; 867 unsigned char cmd_buf[4];
866} ide_hwgroup_t; 868} ide_hwgroup_t;
diff --git a/include/linux/io.h b/include/linux/io.h
index c244a0cc9319..09d351236379 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -33,9 +33,22 @@ int ioremap_page_range(unsigned long addr, unsigned long end,
33/* 33/*
34 * Managed iomap interface 34 * Managed iomap interface
35 */ 35 */
36#ifdef CONFIG_HAS_IOPORT
36void __iomem * devm_ioport_map(struct device *dev, unsigned long port, 37void __iomem * devm_ioport_map(struct device *dev, unsigned long port,
37 unsigned int nr); 38 unsigned int nr);
38void devm_ioport_unmap(struct device *dev, void __iomem *addr); 39void devm_ioport_unmap(struct device *dev, void __iomem *addr);
40#else
41static inline void __iomem *devm_ioport_map(struct device *dev,
42 unsigned long port,
43 unsigned int nr)
44{
45 return NULL;
46}
47
48static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
49{
50}
51#endif
39 52
40void __iomem * devm_ioremap(struct device *dev, unsigned long offset, 53void __iomem * devm_ioremap(struct device *dev, unsigned long offset,
41 unsigned long size); 54 unsigned long size);
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index f8241130f5ea..713eb5eaa81f 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -177,6 +177,7 @@ struct ipv6_devconf {
177#endif 177#endif
178#endif 178#endif
179 __s32 proxy_ndp; 179 __s32 proxy_ndp;
180 __s32 accept_source_route;
180 void *sysctl; 181 void *sysctl;
181}; 182};
182 183
@@ -205,6 +206,8 @@ enum {
205 DEVCONF_RTR_PROBE_INTERVAL, 206 DEVCONF_RTR_PROBE_INTERVAL,
206 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, 207 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
207 DEVCONF_PROXY_NDP, 208 DEVCONF_PROXY_NDP,
209 __DEVCONF_OPTIMISTIC_DAD,
210 DEVCONF_ACCEPT_SOURCE_ROUTE,
208 DEVCONF_MAX 211 DEVCONF_MAX
209}; 212};
210 213
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 2e555d49c9b7..16b0266b14fd 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -31,7 +31,6 @@
31#define PG_NEED_COMMIT 1 31#define PG_NEED_COMMIT 1
32#define PG_NEED_RESCHED 2 32#define PG_NEED_RESCHED 2
33#define PG_NEED_FLUSH 3 33#define PG_NEED_FLUSH 3
34#define PG_FLUSHING 4
35 34
36struct nfs_inode; 35struct nfs_inode;
37struct nfs_page { 36struct nfs_page {
@@ -50,8 +49,6 @@ struct nfs_page {
50}; 49};
51 50
52#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 51#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
53#define NFS_NEED_COMMIT(req) (test_bit(PG_NEED_COMMIT,&(req)->wb_flags))
54#define NFS_NEED_RESCHED(req) (test_bit(PG_NEED_RESCHED,&(req)->wb_flags))
55 52
56extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, 53extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
57 struct inode *inode, 54 struct inode *inode,
@@ -122,34 +119,6 @@ nfs_list_remove_request(struct nfs_page *req)
122 req->wb_list_head = NULL; 119 req->wb_list_head = NULL;
123} 120}
124 121
125static inline int
126nfs_defer_commit(struct nfs_page *req)
127{
128 return !test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags);
129}
130
131static inline void
132nfs_clear_commit(struct nfs_page *req)
133{
134 smp_mb__before_clear_bit();
135 clear_bit(PG_NEED_COMMIT, &req->wb_flags);
136 smp_mb__after_clear_bit();
137}
138
139static inline int
140nfs_defer_reschedule(struct nfs_page *req)
141{
142 return !test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags);
143}
144
145static inline void
146nfs_clear_reschedule(struct nfs_page *req)
147{
148 smp_mb__before_clear_bit();
149 clear_bit(PG_NEED_RESCHED, &req->wb_flags);
150 smp_mb__after_clear_bit();
151}
152
153static inline struct nfs_page * 122static inline struct nfs_page *
154nfs_list_entry(struct list_head *head) 123nfs_list_entry(struct list_head *head)
155{ 124{
diff --git a/include/linux/plist.h b/include/linux/plist.h
index b95818a037ad..85de2f055874 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -97,9 +97,9 @@ struct plist_node {
97#endif 97#endif
98 98
99/** 99/**
100 * #PLIST_HEAD_INIT - static struct plist_head initializer 100 * PLIST_HEAD_INIT - static struct plist_head initializer
101 *
102 * @head: struct plist_head variable name 101 * @head: struct plist_head variable name
102 * @_lock: lock to initialize for this list
103 */ 103 */
104#define PLIST_HEAD_INIT(head, _lock) \ 104#define PLIST_HEAD_INIT(head, _lock) \
105{ \ 105{ \
@@ -109,8 +109,7 @@ struct plist_node {
109} 109}
110 110
111/** 111/**
112 * #PLIST_NODE_INIT - static struct plist_node initializer 112 * PLIST_NODE_INIT - static struct plist_node initializer
113 *
114 * @node: struct plist_node variable name 113 * @node: struct plist_node variable name
115 * @__prio: initial node priority 114 * @__prio: initial node priority
116 */ 115 */
@@ -122,8 +121,8 @@ struct plist_node {
122 121
123/** 122/**
124 * plist_head_init - dynamic struct plist_head initializer 123 * plist_head_init - dynamic struct plist_head initializer
125 *
126 * @head: &struct plist_head pointer 124 * @head: &struct plist_head pointer
125 * @lock: list spinlock, remembered for debugging
127 */ 126 */
128static inline void 127static inline void
129plist_head_init(struct plist_head *head, spinlock_t *lock) 128plist_head_init(struct plist_head *head, spinlock_t *lock)
@@ -137,7 +136,6 @@ plist_head_init(struct plist_head *head, spinlock_t *lock)
137 136
138/** 137/**
139 * plist_node_init - Dynamic struct plist_node initializer 138 * plist_node_init - Dynamic struct plist_node initializer
140 *
141 * @node: &struct plist_node pointer 139 * @node: &struct plist_node pointer
142 * @prio: initial node priority 140 * @prio: initial node priority
143 */ 141 */
@@ -152,49 +150,46 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
152 150
153/** 151/**
154 * plist_for_each - iterate over the plist 152 * plist_for_each - iterate over the plist
155 * 153 * @pos: the type * to use as a loop counter
156 * @pos1: the type * to use as a loop counter. 154 * @head: the head for your list
157 * @head: the head for your list.
158 */ 155 */
159#define plist_for_each(pos, head) \ 156#define plist_for_each(pos, head) \
160 list_for_each_entry(pos, &(head)->node_list, plist.node_list) 157 list_for_each_entry(pos, &(head)->node_list, plist.node_list)
161 158
162/** 159/**
163 * plist_for_each_entry_safe - iterate over a plist of given type safe 160 * plist_for_each_safe - iterate safely over a plist of given type
164 * against removal of list entry 161 * @pos: the type * to use as a loop counter
162 * @n: another type * to use as temporary storage
163 * @head: the head for your list
165 * 164 *
166 * @pos1: the type * to use as a loop counter. 165 * Iterate over a plist of given type, safe against removal of list entry.
167 * @n1: another type * to use as temporary storage
168 * @head: the head for your list.
169 */ 166 */
170#define plist_for_each_safe(pos, n, head) \ 167#define plist_for_each_safe(pos, n, head) \
171 list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) 168 list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list)
172 169
173/** 170/**
174 * plist_for_each_entry - iterate over list of given type 171 * plist_for_each_entry - iterate over list of given type
175 * 172 * @pos: the type * to use as a loop counter
176 * @pos: the type * to use as a loop counter. 173 * @head: the head for your list
177 * @head: the head for your list. 174 * @mem: the name of the list_struct within the struct
178 * @member: the name of the list_struct within the struct.
179 */ 175 */
180#define plist_for_each_entry(pos, head, mem) \ 176#define plist_for_each_entry(pos, head, mem) \
181 list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) 177 list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list)
182 178
183/** 179/**
184 * plist_for_each_entry_safe - iterate over list of given type safe against 180 * plist_for_each_entry_safe - iterate safely over list of given type
185 * removal of list entry 181 * @pos: the type * to use as a loop counter
186 *
187 * @pos: the type * to use as a loop counter.
188 * @n: another type * to use as temporary storage 182 * @n: another type * to use as temporary storage
189 * @head: the head for your list. 183 * @head: the head for your list
190 * @m: the name of the list_struct within the struct. 184 * @m: the name of the list_struct within the struct
185 *
186 * Iterate over list of given type, safe against removal of list entry.
191 */ 187 */
192#define plist_for_each_entry_safe(pos, n, head, m) \ 188#define plist_for_each_entry_safe(pos, n, head, m) \
193 list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list) 189 list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list)
194 190
195/** 191/**
196 * plist_head_empty - return !0 if a plist_head is empty 192 * plist_head_empty - return !0 if a plist_head is empty
197 *
198 * @head: &struct plist_head pointer 193 * @head: &struct plist_head pointer
199 */ 194 */
200static inline int plist_head_empty(const struct plist_head *head) 195static inline int plist_head_empty(const struct plist_head *head)
@@ -204,7 +199,6 @@ static inline int plist_head_empty(const struct plist_head *head)
204 199
205/** 200/**
206 * plist_node_empty - return !0 if plist_node is not on a list 201 * plist_node_empty - return !0 if plist_node is not on a list
207 *
208 * @node: &struct plist_node pointer 202 * @node: &struct plist_node pointer
209 */ 203 */
210static inline int plist_node_empty(const struct plist_node *node) 204static inline int plist_node_empty(const struct plist_node *node)
@@ -216,10 +210,9 @@ static inline int plist_node_empty(const struct plist_node *node)
216 210
217/** 211/**
218 * plist_first_entry - get the struct for the first entry 212 * plist_first_entry - get the struct for the first entry
219 * 213 * @head: the &struct plist_head pointer
220 * @ptr: the &struct plist_head pointer. 214 * @type: the type of the struct this is embedded in
221 * @type: the type of the struct this is embedded in. 215 * @member: the name of the list_struct within the struct
222 * @member: the name of the list_struct within the struct.
223 */ 216 */
224#ifdef CONFIG_DEBUG_PI_LIST 217#ifdef CONFIG_DEBUG_PI_LIST
225# define plist_first_entry(head, type, member) \ 218# define plist_first_entry(head, type, member) \
@@ -234,7 +227,6 @@ static inline int plist_node_empty(const struct plist_node *node)
234 227
235/** 228/**
236 * plist_first - return the first node (and thus, highest priority) 229 * plist_first - return the first node (and thus, highest priority)
237 *
238 * @head: the &struct plist_head pointer 230 * @head: the &struct plist_head pointer
239 * 231 *
240 * Assumes the plist is _not_ empty. 232 * Assumes the plist is _not_ empty.
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 82f43ad478c7..5992f65b4184 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -346,9 +346,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
346 return __alloc_skb(size, priority, 1, -1); 346 return __alloc_skb(size, priority, 1, -1);
347} 347}
348 348
349extern struct sk_buff *alloc_skb_from_cache(struct kmem_cache *cp,
350 unsigned int size,
351 gfp_t priority);
352extern void kfree_skbmem(struct sk_buff *skb); 349extern void kfree_skbmem(struct sk_buff *skb);
353extern struct sk_buff *skb_clone(struct sk_buff *skb, 350extern struct sk_buff *skb_clone(struct sk_buff *skb,
354 gfp_t priority); 351 gfp_t priority);
@@ -622,6 +619,13 @@ static inline void skb_queue_head_init(struct sk_buff_head *list)
622 list->qlen = 0; 619 list->qlen = 0;
623} 620}
624 621
622static inline void skb_queue_head_init_class(struct sk_buff_head *list,
623 struct lock_class_key *class)
624{
625 skb_queue_head_init(list);
626 lockdep_set_class(&list->lock, class);
627}
628
625/* 629/*
626 * Insert an sk_buff at the start of a list. 630 * Insert an sk_buff at the start of a list.
627 * 631 *
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 2c5fb38d9392..9a8970bf99a6 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -580,6 +580,7 @@ enum {
580 NET_IPV6_RTR_PROBE_INTERVAL=21, 580 NET_IPV6_RTR_PROBE_INTERVAL=21,
581 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, 581 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
582 NET_IPV6_PROXY_NDP=23, 582 NET_IPV6_PROXY_NDP=23,
583 NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
583 __NET_IPV6_MAX 584 __NET_IPV6_MAX
584}; 585};
585 586
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index 3fced4798255..a46104a28f66 100644
--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33 33
34#define TASKSTATS_VERSION 3 34#define TASKSTATS_VERSION 4
35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN 35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
36 * in linux/sched.h */ 36 * in linux/sched.h */
37 37
@@ -66,7 +66,7 @@ struct taskstats {
66 /* Delay waiting for cpu, while runnable 66 /* Delay waiting for cpu, while runnable
67 * count, delay_total NOT updated atomically 67 * count, delay_total NOT updated atomically
68 */ 68 */
69 __u64 cpu_count; 69 __u64 cpu_count __attribute__((aligned(8)));
70 __u64 cpu_delay_total; 70 __u64 cpu_delay_total;
71 71
72 /* Following four fields atomically updated using task->delays->lock */ 72 /* Following four fields atomically updated using task->delays->lock */
@@ -101,14 +101,17 @@ struct taskstats {
101 101
102 /* Basic Accounting Fields start */ 102 /* Basic Accounting Fields start */
103 char ac_comm[TS_COMM_LEN]; /* Command name */ 103 char ac_comm[TS_COMM_LEN]; /* Command name */
104 __u8 ac_sched; /* Scheduling discipline */ 104 __u8 ac_sched __attribute__((aligned(8)));
105 /* Scheduling discipline */
105 __u8 ac_pad[3]; 106 __u8 ac_pad[3];
106 __u32 ac_uid; /* User ID */ 107 __u32 ac_uid __attribute__((aligned(8)));
108 /* User ID */
107 __u32 ac_gid; /* Group ID */ 109 __u32 ac_gid; /* Group ID */
108 __u32 ac_pid; /* Process ID */ 110 __u32 ac_pid; /* Process ID */
109 __u32 ac_ppid; /* Parent process ID */ 111 __u32 ac_ppid; /* Parent process ID */
110 __u32 ac_btime; /* Begin time [sec since 1970] */ 112 __u32 ac_btime; /* Begin time [sec since 1970] */
111 __u64 ac_etime; /* Elapsed time [usec] */ 113 __u64 ac_etime __attribute__((aligned(8)));
114 /* Elapsed time [usec] */
112 __u64 ac_utime; /* User CPU time [usec] */ 115 __u64 ac_utime; /* User CPU time [usec] */
113 __u64 ac_stime; /* SYstem CPU time [usec] */ 116 __u64 ac_stime; /* SYstem CPU time [usec] */
114 __u64 ac_minflt; /* Minor Page Fault Count */ 117 __u64 ac_minflt; /* Minor Page Fault Count */
diff --git a/kernel/params.c b/kernel/params.c
index e265b13195b1..1fc4ac746cd8 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -356,6 +356,10 @@ int param_set_copystring(const char *val, struct kernel_param *kp)
356{ 356{
357 struct kparam_string *kps = kp->arg; 357 struct kparam_string *kps = kp->arg;
358 358
359 if (!val) {
360 printk(KERN_ERR "%s: missing param set value\n", kp->name);
361 return -EINVAL;
362 }
359 if (strlen(val)+1 > kps->maxlen) { 363 if (strlen(val)+1 > kps->maxlen) {
360 printk(KERN_ERR "%s: string doesn't fit in %u chars.\n", 364 printk(KERN_ERR "%s: string doesn't fit in %u chars.\n",
361 kp->name, kps->maxlen-1); 365 kp->name, kps->maxlen-1);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 1b255df4fcd0..c904748f2290 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1676,7 +1676,7 @@ static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
1676{ 1676{
1677 int op; 1677 int op;
1678 1678
1679 if (!capable(CAP_SYS_ADMIN)) 1679 if (write && !capable(CAP_SYS_ADMIN))
1680 return -EPERM; 1680 return -EPERM;
1681 1681
1682 op = OP_OR; 1682 op = OP_OR;
diff --git a/mm/migrate.c b/mm/migrate.c
index 7a66ca25dc8a..a91ca00abebe 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -297,7 +297,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
297 void **pslot; 297 void **pslot;
298 298
299 if (!mapping) { 299 if (!mapping) {
300 /* Anonymous page */ 300 /* Anonymous page without mapping */
301 if (page_count(page) != 1) 301 if (page_count(page) != 1)
302 return -EAGAIN; 302 return -EAGAIN;
303 return 0; 303 return 0;
@@ -333,6 +333,19 @@ static int migrate_page_move_mapping(struct address_space *mapping,
333 */ 333 */
334 __put_page(page); 334 __put_page(page);
335 335
336 /*
337 * If moved to a different zone then also account
338 * the page for that zone. Other VM counters will be
339 * taken care of when we establish references to the
340 * new page and drop references to the old page.
341 *
342 * Note that anonymous pages are accounted for
343 * via NR_FILE_PAGES and NR_ANON_PAGES if they
344 * are mapped to swap space.
345 */
346 __dec_zone_page_state(page, NR_FILE_PAGES);
347 __inc_zone_page_state(newpage, NR_FILE_PAGES);
348
336 write_unlock_irq(&mapping->tree_lock); 349 write_unlock_irq(&mapping->tree_lock);
337 350
338 return 0; 351 return 0;
diff --git a/mm/nommu.c b/mm/nommu.c
index cbbc13774819..1f60194d9b9b 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -45,6 +45,7 @@ int heap_stack_gap = 0;
45 45
46EXPORT_SYMBOL(mem_map); 46EXPORT_SYMBOL(mem_map);
47EXPORT_SYMBOL(__vm_enough_memory); 47EXPORT_SYMBOL(__vm_enough_memory);
48EXPORT_SYMBOL(num_physpages);
48 49
49/* list of shareable VMAs */ 50/* list of shareable VMAs */
50struct rb_root nommu_vma_tree = RB_ROOT; 51struct rb_root nommu_vma_tree = RB_ROOT;
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 2f3916986abf..3791edfffeeb 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -176,6 +176,8 @@ static inline int constrained_alloc(struct zonelist *zonelist, gfp_t gfp_mask)
176 struct zone **z; 176 struct zone **z;
177 nodemask_t nodes; 177 nodemask_t nodes;
178 int node; 178 int node;
179
180 nodes_clear(nodes);
179 /* node has memory ? */ 181 /* node has memory ? */
180 for_each_online_node(node) 182 for_each_online_node(node)
181 if (NODE_DATA(node)->node_present_pages) 183 if (NODE_DATA(node)->node_present_pages)
@@ -333,7 +335,7 @@ static int oom_kill_task(struct task_struct *p)
333 */ 335 */
334 do_each_thread(g, q) { 336 do_each_thread(g, q) {
335 if (q->mm == mm && q->tgid != p->tgid) 337 if (q->mm == mm && q->tgid != p->tgid)
336 force_sig(SIGKILL, p); 338 force_sig(SIGKILL, q);
337 } while_each_thread(g, q); 339 } while_each_thread(g, q);
338 340
339 return 0; 341 return 0;
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 2fc8fe2cb366..b6e0eea1e39e 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -380,6 +380,9 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
380 } else { 380 } else {
381 vhdr->h_vlan_encapsulated_proto = htons(len); 381 vhdr->h_vlan_encapsulated_proto = htons(len);
382 } 382 }
383
384 skb->protocol = htons(ETH_P_8021Q);
385 skb->nh.raw = skb->data;
383 } 386 }
384 387
385 /* Before delegating work to the lower layer, enter our MAC-address */ 388 /* Before delegating work to the lower layer, enter our MAC-address */
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 58d13f2bd121..a285897a2fb4 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -126,7 +126,9 @@ void br_stp_disable_port(struct net_bridge_port *p)
126/* called under bridge lock */ 126/* called under bridge lock */
127void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *addr) 127void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *addr)
128{ 128{
129 unsigned char oldaddr[6]; 129 /* should be aligned on 2 bytes for compare_ether_addr() */
130 unsigned short oldaddr_aligned[ETH_ALEN >> 1];
131 unsigned char *oldaddr = (unsigned char *)oldaddr_aligned;
130 struct net_bridge_port *p; 132 struct net_bridge_port *p;
131 int wasroot; 133 int wasroot;
132 134
@@ -151,11 +153,14 @@ void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *addr)
151 br_become_root_bridge(br); 153 br_become_root_bridge(br);
152} 154}
153 155
154static const unsigned char br_mac_zero[6]; 156/* should be aligned on 2 bytes for compare_ether_addr() */
157static const unsigned short br_mac_zero_aligned[ETH_ALEN >> 1];
155 158
156/* called under bridge lock */ 159/* called under bridge lock */
157void br_stp_recalculate_bridge_id(struct net_bridge *br) 160void br_stp_recalculate_bridge_id(struct net_bridge *br)
158{ 161{
162 const unsigned char *br_mac_zero =
163 (const unsigned char *)br_mac_zero_aligned;
159 const unsigned char *addr = br_mac_zero; 164 const unsigned char *addr = br_mac_zero;
160 struct net_bridge_port *p; 165 struct net_bridge_port *p;
161 166
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index cfc60019cf92..841e3f32cab1 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1331,6 +1331,8 @@ void neigh_parms_destroy(struct neigh_parms *parms)
1331 kfree(parms); 1331 kfree(parms);
1332} 1332}
1333 1333
1334static struct lock_class_key neigh_table_proxy_queue_class;
1335
1334void neigh_table_init_no_netlink(struct neigh_table *tbl) 1336void neigh_table_init_no_netlink(struct neigh_table *tbl)
1335{ 1337{
1336 unsigned long now = jiffies; 1338 unsigned long now = jiffies;
@@ -1379,7 +1381,8 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
1379 init_timer(&tbl->proxy_timer); 1381 init_timer(&tbl->proxy_timer);
1380 tbl->proxy_timer.data = (unsigned long)tbl; 1382 tbl->proxy_timer.data = (unsigned long)tbl;
1381 tbl->proxy_timer.function = neigh_proxy_process; 1383 tbl->proxy_timer.function = neigh_proxy_process;
1382 skb_queue_head_init(&tbl->proxy_queue); 1384 skb_queue_head_init_class(&tbl->proxy_queue,
1385 &neigh_table_proxy_queue_class);
1383 1386
1384 tbl->last_flush = now; 1387 tbl->last_flush = now;
1385 tbl->last_rand = now + tbl->parms.reachable_time * 20; 1388 tbl->last_rand = now + tbl->parms.reachable_time * 20;
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index da1019451ccb..4581ece48bb2 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -471,6 +471,13 @@ int __netpoll_rx(struct sk_buff *skb)
471 if (skb->len < len || len < iph->ihl*4) 471 if (skb->len < len || len < iph->ihl*4)
472 goto out; 472 goto out;
473 473
474 /*
475 * Our transport medium may have padded the buffer out.
476 * Now We trim to the true length of the frame.
477 */
478 if (pskb_trim_rcsum(skb, len))
479 goto out;
480
474 if (iph->protocol != IPPROTO_UDP) 481 if (iph->protocol != IPPROTO_UDP)
475 goto out; 482 goto out;
476 483
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 74a9a32b906d..4b01496dc33d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -129,6 +129,7 @@
129#include <linux/ioport.h> 129#include <linux/ioport.h>
130#include <linux/interrupt.h> 130#include <linux/interrupt.h>
131#include <linux/capability.h> 131#include <linux/capability.h>
132#include <linux/freezer.h>
132#include <linux/delay.h> 133#include <linux/delay.h>
133#include <linux/timer.h> 134#include <linux/timer.h>
134#include <linux/list.h> 135#include <linux/list.h>
@@ -3333,6 +3334,8 @@ static int pktgen_thread_worker(void *arg)
3333 t->control &= ~(T_REMDEV); 3334 t->control &= ~(T_REMDEV);
3334 } 3335 }
3335 3336
3337 try_to_freeze();
3338
3336 set_current_state(TASK_INTERRUPTIBLE); 3339 set_current_state(TASK_INTERRUPTIBLE);
3337 } 3340 }
3338 3341
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 87573ae35b02..336958fbbcb2 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -197,61 +197,6 @@ nodata:
197} 197}
198 198
199/** 199/**
200 * alloc_skb_from_cache - allocate a network buffer
201 * @cp: kmem_cache from which to allocate the data area
202 * (object size must be big enough for @size bytes + skb overheads)
203 * @size: size to allocate
204 * @gfp_mask: allocation mask
205 *
206 * Allocate a new &sk_buff. The returned buffer has no headroom and
207 * tail room of size bytes. The object has a reference count of one.
208 * The return is the buffer. On a failure the return is %NULL.
209 *
210 * Buffers may only be allocated from interrupts using a @gfp_mask of
211 * %GFP_ATOMIC.
212 */
213struct sk_buff *alloc_skb_from_cache(struct kmem_cache *cp,
214 unsigned int size,
215 gfp_t gfp_mask)
216{
217 struct sk_buff *skb;
218 u8 *data;
219
220 /* Get the HEAD */
221 skb = kmem_cache_alloc(skbuff_head_cache,
222 gfp_mask & ~__GFP_DMA);
223 if (!skb)
224 goto out;
225
226 /* Get the DATA. */
227 size = SKB_DATA_ALIGN(size);
228 data = kmem_cache_alloc(cp, gfp_mask);
229 if (!data)
230 goto nodata;
231
232 memset(skb, 0, offsetof(struct sk_buff, truesize));
233 skb->truesize = size + sizeof(struct sk_buff);
234 atomic_set(&skb->users, 1);
235 skb->head = data;
236 skb->data = data;
237 skb->tail = data;
238 skb->end = data + size;
239
240 atomic_set(&(skb_shinfo(skb)->dataref), 1);
241 skb_shinfo(skb)->nr_frags = 0;
242 skb_shinfo(skb)->gso_size = 0;
243 skb_shinfo(skb)->gso_segs = 0;
244 skb_shinfo(skb)->gso_type = 0;
245 skb_shinfo(skb)->frag_list = NULL;
246out:
247 return skb;
248nodata:
249 kmem_cache_free(skbuff_head_cache, skb);
250 skb = NULL;
251 goto out;
252}
253
254/**
255 * __netdev_alloc_skb - allocate an skbuff for rx on a specific device 200 * __netdev_alloc_skb - allocate an skbuff for rx on a specific device
256 * @dev: network device to receive on 201 * @dev: network device to receive on
257 * @length: length to allocate 202 * @length: length to allocate
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index fc920f63452b..cac06c43f004 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -776,6 +776,8 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb )
776 .nl_u = { .ip4_u = { .daddr = frn->fl_addr, 776 .nl_u = { .ip4_u = { .daddr = frn->fl_addr,
777 .tos = frn->fl_tos, 777 .tos = frn->fl_tos,
778 .scope = frn->fl_scope } } }; 778 .scope = frn->fl_scope } } };
779
780 frn->err = -ENOENT;
779 if (tb) { 781 if (tb) {
780 local_bh_disable(); 782 local_bh_disable();
781 783
@@ -787,6 +789,7 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb )
787 frn->nh_sel = res.nh_sel; 789 frn->nh_sel = res.nh_sel;
788 frn->type = res.type; 790 frn->type = res.type;
789 frn->scope = res.scope; 791 frn->scope = res.scope;
792 fib_res_put(&res);
790 } 793 }
791 local_bh_enable(); 794 local_bh_enable();
792 } 795 }
@@ -801,6 +804,9 @@ static void nl_fib_input(struct sock *sk, int len)
801 struct fib_table *tb; 804 struct fib_table *tb;
802 805
803 skb = skb_dequeue(&sk->sk_receive_queue); 806 skb = skb_dequeue(&sk->sk_receive_queue);
807 if (skb == NULL)
808 return;
809
804 nlh = (struct nlmsghdr *)skb->data; 810 nlh = (struct nlmsghdr *)skb->data;
805 if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || 811 if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
806 nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) { 812 nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) {
@@ -813,7 +819,7 @@ static void nl_fib_input(struct sock *sk, int len)
813 819
814 nl_fib_lookup(frn, tb); 820 nl_fib_lookup(frn, tb);
815 821
816 pid = nlh->nlmsg_pid; /*pid of sending process */ 822 pid = NETLINK_CB(skb).pid; /* pid of sending process */
817 NETLINK_CB(skb).pid = 0; /* from kernel */ 823 NETLINK_CB(skb).pid = 0; /* from kernel */
818 NETLINK_CB(skb).dst_group = 0; /* unicast */ 824 NETLINK_CB(skb).dst_group = 0; /* unicast */
819 netlink_unicast(sk, skb, pid, MSG_DONTWAIT); 825 netlink_unicast(sk, skb, pid, MSG_DONTWAIT);
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 5170f5c75f9d..57b0221f9e24 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -166,13 +166,9 @@ static inline int arp_packet_match(const struct arphdr *arphdr,
166 return 0; 166 return 0;
167 } 167 }
168 168
169 for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { 169 for (i = 0, ret = 0; i < IFNAMSIZ; i++) {
170 unsigned long odev; 170 ret |= (outdev[i] ^ arpinfo->outiface[i])
171 memcpy(&odev, outdev + i*sizeof(unsigned long), 171 & arpinfo->outiface_mask[i];
172 sizeof(unsigned long));
173 ret |= (odev
174 ^ ((const unsigned long *)arpinfo->outiface)[i])
175 & ((const unsigned long *)arpinfo->outiface_mask)[i];
176 } 172 }
177 173
178 if (FWINV(ret != 0, ARPT_INV_VIA_OUT)) { 174 if (FWINV(ret != 0, ARPT_INV_VIA_OUT)) {
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index e965b333c997..42b08029e867 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -411,12 +411,10 @@ checkentry(const char *tablename,
411 "has invalid config pointer!\n"); 411 "has invalid config pointer!\n");
412 return 0; 412 return 0;
413 } 413 }
414 clusterip_config_entry_get(cipinfo->config);
415 } else { 414 } else {
416 /* Case B: This is a new rule referring to an existing 415 /* Case B: This is a new rule referring to an existing
417 * clusterip config. */ 416 * clusterip config. */
418 cipinfo->config = config; 417 cipinfo->config = config;
419 clusterip_config_entry_get(cipinfo->config);
420 } 418 }
421 } else { 419 } else {
422 /* Case C: This is a completely new clusterip config */ 420 /* Case C: This is a completely new clusterip config */
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index a26404dbe212..9acc018766f2 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -61,6 +61,7 @@
61#include <linux/netfilter_ipv4/ipt_ULOG.h> 61#include <linux/netfilter_ipv4/ipt_ULOG.h>
62#include <net/sock.h> 62#include <net/sock.h>
63#include <linux/bitops.h> 63#include <linux/bitops.h>
64#include <asm/unaligned.h>
64 65
65MODULE_LICENSE("GPL"); 66MODULE_LICENSE("GPL");
66MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); 67MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
@@ -236,9 +237,9 @@ static void ipt_ulog_packet(unsigned int hooknum,
236 237
237 /* copy hook, prefix, timestamp, payload, etc. */ 238 /* copy hook, prefix, timestamp, payload, etc. */
238 pm->data_len = copy_len; 239 pm->data_len = copy_len;
239 pm->timestamp_sec = skb->tstamp.off_sec; 240 put_unaligned(skb->tstamp.off_sec, &pm->timestamp_sec);
240 pm->timestamp_usec = skb->tstamp.off_usec; 241 put_unaligned(skb->tstamp.off_usec, &pm->timestamp_usec);
241 pm->mark = skb->mark; 242 put_unaligned(skb->mark, &pm->mark);
242 pm->hook = hooknum; 243 pm->hook = hooknum;
243 if (prefix != NULL) 244 if (prefix != NULL)
244 strncpy(pm->prefix, prefix, sizeof(pm->prefix)); 245 strncpy(pm->prefix, prefix, sizeof(pm->prefix));
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 5c8caf4a1244..34ae3f13483a 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -77,18 +77,19 @@ void tcp_init_congestion_control(struct sock *sk)
77 struct inet_connection_sock *icsk = inet_csk(sk); 77 struct inet_connection_sock *icsk = inet_csk(sk);
78 struct tcp_congestion_ops *ca; 78 struct tcp_congestion_ops *ca;
79 79
80 if (icsk->icsk_ca_ops != &tcp_init_congestion_ops) 80 /* if no choice made yet assign the current value set as default */
81 return; 81 if (icsk->icsk_ca_ops == &tcp_init_congestion_ops) {
82 rcu_read_lock();
83 list_for_each_entry_rcu(ca, &tcp_cong_list, list) {
84 if (try_module_get(ca->owner)) {
85 icsk->icsk_ca_ops = ca;
86 break;
87 }
82 88
83 rcu_read_lock(); 89 /* fallback to next available */
84 list_for_each_entry_rcu(ca, &tcp_cong_list, list) {
85 if (try_module_get(ca->owner)) {
86 icsk->icsk_ca_ops = ca;
87 break;
88 } 90 }
89 91 rcu_read_unlock();
90 } 92 }
91 rcu_read_unlock();
92 93
93 if (icsk->icsk_ca_ops->init) 94 if (icsk->icsk_ca_ops->init)
94 icsk->icsk_ca_ops->init(sk); 95 icsk->icsk_ca_ops->init(sk);
@@ -236,6 +237,7 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
236 237
237 rcu_read_lock(); 238 rcu_read_lock();
238 ca = tcp_ca_find(name); 239 ca = tcp_ca_find(name);
240
239 /* no change asking for existing value */ 241 /* no change asking for existing value */
240 if (ca == icsk->icsk_ca_ops) 242 if (ca == icsk->icsk_ca_ops)
241 goto out; 243 goto out;
@@ -261,7 +263,8 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
261 else { 263 else {
262 tcp_cleanup_congestion_control(sk); 264 tcp_cleanup_congestion_control(sk);
263 icsk->icsk_ca_ops = ca; 265 icsk->icsk_ca_ops = ca;
264 if (icsk->icsk_ca_ops->init) 266
267 if (sk->sk_state != TCP_CLOSE && icsk->icsk_ca_ops->init)
265 icsk->icsk_ca_ops->init(sk); 268 icsk->icsk_ca_ops->init(sk);
266 } 269 }
267 out: 270 out:
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 688b95594f2e..3c24881f2a65 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -943,7 +943,8 @@ static void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp)
943 if (tp->packets_out > tp->snd_cwnd_used) 943 if (tp->packets_out > tp->snd_cwnd_used)
944 tp->snd_cwnd_used = tp->packets_out; 944 tp->snd_cwnd_used = tp->packets_out;
945 945
946 if ((s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= inet_csk(sk)->icsk_rto) 946 if (sysctl_tcp_slow_start_after_idle &&
947 (s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= inet_csk(sk)->icsk_rto)
947 tcp_cwnd_application_limited(sk); 948 tcp_cwnd_application_limited(sk);
948 } 949 }
949} 950}
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c
index f68dfd8a0f5c..d419e15d9803 100644
--- a/net/ipv4/xfrm4_mode_beet.c
+++ b/net/ipv4/xfrm4_mode_beet.c
@@ -52,7 +52,7 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
52 52
53 ph = (struct ip_beet_phdr *)skb->h.raw; 53 ph = (struct ip_beet_phdr *)skb->h.raw;
54 ph->padlen = 4 - (optlen & 4); 54 ph->padlen = 4 - (optlen & 4);
55 ph->hdrlen = (optlen + ph->padlen + sizeof(*ph)) / 8; 55 ph->hdrlen = optlen / 8;
56 ph->nexthdr = top_iph->protocol; 56 ph->nexthdr = top_iph->protocol;
57 if (ph->padlen) 57 if (ph->padlen)
58 memset(ph + 1, IPOPT_NOP, ph->padlen); 58 memset(ph + 1, IPOPT_NOP, ph->padlen);
@@ -85,7 +85,7 @@ static int xfrm4_beet_input(struct xfrm_state *x, struct sk_buff *skb)
85 ph = (struct ip_beet_phdr *)(skb->h.ipiph + 1); 85 ph = (struct ip_beet_phdr *)(skb->h.ipiph + 1);
86 86
87 phlen = sizeof(*ph) + ph->padlen; 87 phlen = sizeof(*ph) + ph->padlen;
88 optlen = ph->hdrlen * 8 - phlen; 88 optlen = ph->hdrlen * 8 + (IPV4_BEET_PHMAXLEN - phlen);
89 if (optlen < 0 || optlen & 3 || optlen > 250) 89 if (optlen < 0 || optlen & 3 || optlen > 250)
90 goto out; 90 goto out;
91 91
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 7552663aa125..452a82ce4796 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -172,6 +172,7 @@ struct ipv6_devconf ipv6_devconf __read_mostly = {
172#endif 172#endif
173#endif 173#endif
174 .proxy_ndp = 0, 174 .proxy_ndp = 0,
175 .accept_source_route = 0, /* we do not accept RH0 by default. */
175}; 176};
176 177
177static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = { 178static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
@@ -203,6 +204,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
203#endif 204#endif
204#endif 205#endif
205 .proxy_ndp = 0, 206 .proxy_ndp = 0,
207 .accept_source_route = 0, /* we do not accept RH0 by default. */
206}; 208};
207 209
208/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ 210/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
@@ -3356,6 +3358,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
3356#endif 3358#endif
3357#endif 3359#endif
3358 array[DEVCONF_PROXY_NDP] = cnf->proxy_ndp; 3360 array[DEVCONF_PROXY_NDP] = cnf->proxy_ndp;
3361 array[DEVCONF_ACCEPT_SOURCE_ROUTE] = cnf->accept_source_route;
3359} 3362}
3360 3363
3361static inline size_t inet6_if_nlmsg_size(void) 3364static inline size_t inet6_if_nlmsg_size(void)
@@ -3884,6 +3887,14 @@ static struct addrconf_sysctl_table
3884 .proc_handler = &proc_dointvec, 3887 .proc_handler = &proc_dointvec,
3885 }, 3888 },
3886 { 3889 {
3890 .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE,
3891 .procname = "accept_source_route",
3892 .data = &ipv6_devconf.accept_source_route,
3893 .maxlen = sizeof(int),
3894 .mode = 0644,
3895 .proc_handler = &proc_dointvec,
3896 },
3897 {
3887 .ctl_name = 0, /* sentinel */ 3898 .ctl_name = 0, /* sentinel */
3888 } 3899 }
3889 }, 3900 },
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 28e0c6568272..fb39604c3d09 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -362,10 +362,27 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
362 struct inet6_skb_parm *opt = IP6CB(skb); 362 struct inet6_skb_parm *opt = IP6CB(skb);
363 struct in6_addr *addr = NULL; 363 struct in6_addr *addr = NULL;
364 struct in6_addr daddr; 364 struct in6_addr daddr;
365 struct inet6_dev *idev;
365 int n, i; 366 int n, i;
366
367 struct ipv6_rt_hdr *hdr; 367 struct ipv6_rt_hdr *hdr;
368 struct rt0_hdr *rthdr; 368 struct rt0_hdr *rthdr;
369 int accept_source_route = ipv6_devconf.accept_source_route;
370
371 if (accept_source_route < 0 ||
372 ((idev = in6_dev_get(skb->dev)) == NULL)) {
373 kfree_skb(skb);
374 return -1;
375 }
376 if (idev->cnf.accept_source_route < 0) {
377 in6_dev_put(idev);
378 kfree_skb(skb);
379 return -1;
380 }
381
382 if (accept_source_route > idev->cnf.accept_source_route)
383 accept_source_route = idev->cnf.accept_source_route;
384
385 in6_dev_put(idev);
369 386
370 if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || 387 if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
371 !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { 388 !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
@@ -377,6 +394,22 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
377 394
378 hdr = (struct ipv6_rt_hdr *) skb->h.raw; 395 hdr = (struct ipv6_rt_hdr *) skb->h.raw;
379 396
397 switch (hdr->type) {
398#ifdef CONFIG_IPV6_MIP6
399 break;
400#endif
401 case IPV6_SRCRT_TYPE_0:
402 if (accept_source_route > 0)
403 break;
404 kfree_skb(skb);
405 return -1;
406 default:
407 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
408 IPSTATS_MIB_INHDRERRORS);
409 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->type) - skb->nh.raw);
410 return -1;
411 }
412
380 if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) || 413 if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) ||
381 skb->pkt_type != PACKET_HOST) { 414 skb->pkt_type != PACKET_HOST) {
382 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 415 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
@@ -434,11 +467,6 @@ looped_back:
434 } 467 }
435 break; 468 break;
436#endif 469#endif
437 default:
438 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
439 IPSTATS_MIB_INHDRERRORS);
440 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->type) - skb->nh.raw);
441 return -1;
442 } 470 }
443 471
444 /* 472 /*
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ad9b285692ba..aebb4e2d5ae3 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1766,13 +1766,22 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
1766 * Drop the packet on the floor 1766 * Drop the packet on the floor
1767 */ 1767 */
1768 1768
1769static inline int ip6_pkt_drop(struct sk_buff *skb, int code) 1769static inline int ip6_pkt_drop(struct sk_buff *skb, int code,
1770{ 1770 int ipstats_mib_noroutes)
1771 int type = ipv6_addr_type(&skb->nh.ipv6h->daddr); 1771{
1772 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) 1772 int type;
1773 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); 1773 switch (ipstats_mib_noroutes) {
1774 1774 case IPSTATS_MIB_INNOROUTES:
1775 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_OUTNOROUTES); 1775 type = ipv6_addr_type(&skb->nh.ipv6h->daddr);
1776 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
1777 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS);
1778 break;
1779 }
1780 /* FALLTHROUGH */
1781 case IPSTATS_MIB_OUTNOROUTES:
1782 IP6_INC_STATS(ip6_dst_idev(skb->dst), ipstats_mib_noroutes);
1783 break;
1784 }
1776 icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); 1785 icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev);
1777 kfree_skb(skb); 1786 kfree_skb(skb);
1778 return 0; 1787 return 0;
@@ -1780,26 +1789,26 @@ static inline int ip6_pkt_drop(struct sk_buff *skb, int code)
1780 1789
1781static int ip6_pkt_discard(struct sk_buff *skb) 1790static int ip6_pkt_discard(struct sk_buff *skb)
1782{ 1791{
1783 return ip6_pkt_drop(skb, ICMPV6_NOROUTE); 1792 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES);
1784} 1793}
1785 1794
1786static int ip6_pkt_discard_out(struct sk_buff *skb) 1795static int ip6_pkt_discard_out(struct sk_buff *skb)
1787{ 1796{
1788 skb->dev = skb->dst->dev; 1797 skb->dev = skb->dst->dev;
1789 return ip6_pkt_discard(skb); 1798 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES);
1790} 1799}
1791 1800
1792#ifdef CONFIG_IPV6_MULTIPLE_TABLES 1801#ifdef CONFIG_IPV6_MULTIPLE_TABLES
1793 1802
1794static int ip6_pkt_prohibit(struct sk_buff *skb) 1803static int ip6_pkt_prohibit(struct sk_buff *skb)
1795{ 1804{
1796 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED); 1805 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES);
1797} 1806}
1798 1807
1799static int ip6_pkt_prohibit_out(struct sk_buff *skb) 1808static int ip6_pkt_prohibit_out(struct sk_buff *skb)
1800{ 1809{
1801 skb->dev = skb->dst->dev; 1810 skb->dev = skb->dst->dev;
1802 return ip6_pkt_prohibit(skb); 1811 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
1803} 1812}
1804 1813
1805static int ip6_pkt_blk_hole(struct sk_buff *skb) 1814static int ip6_pkt_blk_hole(struct sk_buff *skb)
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index eabd6838f50a..0eb7d596d470 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -138,7 +138,6 @@ static void irda_disconnect_indication(void *instance, void *sap,
138 sk->sk_shutdown |= SEND_SHUTDOWN; 138 sk->sk_shutdown |= SEND_SHUTDOWN;
139 139
140 sk->sk_state_change(sk); 140 sk->sk_state_change(sk);
141 sock_orphan(sk);
142 release_sock(sk); 141 release_sock(sk);
143 142
144 /* Close our TSAP. 143 /* Close our TSAP.
@@ -1446,7 +1445,7 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock,
1446 */ 1445 */
1447 ret = sock_error(sk); 1446 ret = sock_error(sk);
1448 if (ret) 1447 if (ret)
1449 break; 1448 ;
1450 else if (sk->sk_shutdown & RCV_SHUTDOWN) 1449 else if (sk->sk_shutdown & RCV_SHUTDOWN)
1451 ; 1450 ;
1452 else if (noblock) 1451 else if (noblock)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index a4e7e2db0ff3..345019345f09 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -630,6 +630,35 @@ pfkey_sockaddr_size(sa_family_t family)
630 /* NOTREACHED */ 630 /* NOTREACHED */
631} 631}
632 632
633static inline int pfkey_mode_from_xfrm(int mode)
634{
635 switch(mode) {
636 case XFRM_MODE_TRANSPORT:
637 return IPSEC_MODE_TRANSPORT;
638 case XFRM_MODE_TUNNEL:
639 return IPSEC_MODE_TUNNEL;
640 case XFRM_MODE_BEET:
641 return IPSEC_MODE_BEET;
642 default:
643 return -1;
644 }
645}
646
647static inline int pfkey_mode_to_xfrm(int mode)
648{
649 switch(mode) {
650 case IPSEC_MODE_ANY: /*XXX*/
651 case IPSEC_MODE_TRANSPORT:
652 return XFRM_MODE_TRANSPORT;
653 case IPSEC_MODE_TUNNEL:
654 return XFRM_MODE_TUNNEL;
655 case IPSEC_MODE_BEET:
656 return XFRM_MODE_BEET;
657 default:
658 return -1;
659 }
660}
661
633static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, int hsc) 662static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, int hsc)
634{ 663{
635 struct sk_buff *skb; 664 struct sk_buff *skb;
@@ -651,6 +680,7 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys,
651 int encrypt_key_size = 0; 680 int encrypt_key_size = 0;
652 int sockaddr_size; 681 int sockaddr_size;
653 struct xfrm_encap_tmpl *natt = NULL; 682 struct xfrm_encap_tmpl *natt = NULL;
683 int mode;
654 684
655 /* address family check */ 685 /* address family check */
656 sockaddr_size = pfkey_sockaddr_size(x->props.family); 686 sockaddr_size = pfkey_sockaddr_size(x->props.family);
@@ -928,7 +958,11 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys,
928 sa2 = (struct sadb_x_sa2 *) skb_put(skb, sizeof(struct sadb_x_sa2)); 958 sa2 = (struct sadb_x_sa2 *) skb_put(skb, sizeof(struct sadb_x_sa2));
929 sa2->sadb_x_sa2_len = sizeof(struct sadb_x_sa2)/sizeof(uint64_t); 959 sa2->sadb_x_sa2_len = sizeof(struct sadb_x_sa2)/sizeof(uint64_t);
930 sa2->sadb_x_sa2_exttype = SADB_X_EXT_SA2; 960 sa2->sadb_x_sa2_exttype = SADB_X_EXT_SA2;
931 sa2->sadb_x_sa2_mode = x->props.mode + 1; 961 if ((mode = pfkey_mode_from_xfrm(x->props.mode)) < 0) {
962 kfree_skb(skb);
963 return ERR_PTR(-EINVAL);
964 }
965 sa2->sadb_x_sa2_mode = mode;
932 sa2->sadb_x_sa2_reserved1 = 0; 966 sa2->sadb_x_sa2_reserved1 = 0;
933 sa2->sadb_x_sa2_reserved2 = 0; 967 sa2->sadb_x_sa2_reserved2 = 0;
934 sa2->sadb_x_sa2_sequence = 0; 968 sa2->sadb_x_sa2_sequence = 0;
@@ -1155,9 +1189,12 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
1155 1189
1156 if (ext_hdrs[SADB_X_EXT_SA2-1]) { 1190 if (ext_hdrs[SADB_X_EXT_SA2-1]) {
1157 struct sadb_x_sa2 *sa2 = (void*)ext_hdrs[SADB_X_EXT_SA2-1]; 1191 struct sadb_x_sa2 *sa2 = (void*)ext_hdrs[SADB_X_EXT_SA2-1];
1158 x->props.mode = sa2->sadb_x_sa2_mode; 1192 int mode = pfkey_mode_to_xfrm(sa2->sadb_x_sa2_mode);
1159 if (x->props.mode) 1193 if (mode < 0) {
1160 x->props.mode--; 1194 err = -EINVAL;
1195 goto out;
1196 }
1197 x->props.mode = mode;
1161 x->props.reqid = sa2->sadb_x_sa2_reqid; 1198 x->props.reqid = sa2->sadb_x_sa2_reqid;
1162 } 1199 }
1163 1200
@@ -1218,7 +1255,7 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1218 struct sadb_address *saddr, *daddr; 1255 struct sadb_address *saddr, *daddr;
1219 struct sadb_msg *out_hdr; 1256 struct sadb_msg *out_hdr;
1220 struct xfrm_state *x = NULL; 1257 struct xfrm_state *x = NULL;
1221 u8 mode; 1258 int mode;
1222 u32 reqid; 1259 u32 reqid;
1223 u8 proto; 1260 u8 proto;
1224 unsigned short family; 1261 unsigned short family;
@@ -1233,7 +1270,9 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1233 return -EINVAL; 1270 return -EINVAL;
1234 1271
1235 if ((sa2 = ext_hdrs[SADB_X_EXT_SA2-1]) != NULL) { 1272 if ((sa2 = ext_hdrs[SADB_X_EXT_SA2-1]) != NULL) {
1236 mode = sa2->sadb_x_sa2_mode - 1; 1273 mode = pfkey_mode_to_xfrm(sa2->sadb_x_sa2_mode);
1274 if (mode < 0)
1275 return -EINVAL;
1237 reqid = sa2->sadb_x_sa2_reqid; 1276 reqid = sa2->sadb_x_sa2_reqid;
1238 } else { 1277 } else {
1239 mode = 0; 1278 mode = 0;
@@ -1756,6 +1795,7 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq)
1756#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1795#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
1757 struct sockaddr_in6 *sin6; 1796 struct sockaddr_in6 *sin6;
1758#endif 1797#endif
1798 int mode;
1759 1799
1760 if (xp->xfrm_nr >= XFRM_MAX_DEPTH) 1800 if (xp->xfrm_nr >= XFRM_MAX_DEPTH)
1761 return -ELOOP; 1801 return -ELOOP;
@@ -1764,7 +1804,9 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq)
1764 return -EINVAL; 1804 return -EINVAL;
1765 1805
1766 t->id.proto = rq->sadb_x_ipsecrequest_proto; /* XXX check proto */ 1806 t->id.proto = rq->sadb_x_ipsecrequest_proto; /* XXX check proto */
1767 t->mode = rq->sadb_x_ipsecrequest_mode-1; 1807 if ((mode = pfkey_mode_to_xfrm(rq->sadb_x_ipsecrequest_mode)) < 0)
1808 return -EINVAL;
1809 t->mode = mode;
1768 if (rq->sadb_x_ipsecrequest_level == IPSEC_LEVEL_USE) 1810 if (rq->sadb_x_ipsecrequest_level == IPSEC_LEVEL_USE)
1769 t->optional = 1; 1811 t->optional = 1;
1770 else if (rq->sadb_x_ipsecrequest_level == IPSEC_LEVEL_UNIQUE) { 1812 else if (rq->sadb_x_ipsecrequest_level == IPSEC_LEVEL_UNIQUE) {
@@ -1877,7 +1919,7 @@ static struct sk_buff * pfkey_xfrm_policy2msg_prep(struct xfrm_policy *xp)
1877 return skb; 1919 return skb;
1878} 1920}
1879 1921
1880static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, int dir) 1922static int pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, int dir)
1881{ 1923{
1882 struct sadb_msg *hdr; 1924 struct sadb_msg *hdr;
1883 struct sadb_address *addr; 1925 struct sadb_address *addr;
@@ -2014,6 +2056,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i
2014 struct sadb_x_ipsecrequest *rq; 2056 struct sadb_x_ipsecrequest *rq;
2015 struct xfrm_tmpl *t = xp->xfrm_vec + i; 2057 struct xfrm_tmpl *t = xp->xfrm_vec + i;
2016 int req_size; 2058 int req_size;
2059 int mode;
2017 2060
2018 req_size = sizeof(struct sadb_x_ipsecrequest); 2061 req_size = sizeof(struct sadb_x_ipsecrequest);
2019 if (t->mode == XFRM_MODE_TUNNEL) 2062 if (t->mode == XFRM_MODE_TUNNEL)
@@ -2027,7 +2070,9 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i
2027 memset(rq, 0, sizeof(*rq)); 2070 memset(rq, 0, sizeof(*rq));
2028 rq->sadb_x_ipsecrequest_len = req_size; 2071 rq->sadb_x_ipsecrequest_len = req_size;
2029 rq->sadb_x_ipsecrequest_proto = t->id.proto; 2072 rq->sadb_x_ipsecrequest_proto = t->id.proto;
2030 rq->sadb_x_ipsecrequest_mode = t->mode+1; 2073 if ((mode = pfkey_mode_from_xfrm(t->mode)) < 0)
2074 return -EINVAL;
2075 rq->sadb_x_ipsecrequest_mode = mode;
2031 rq->sadb_x_ipsecrequest_level = IPSEC_LEVEL_REQUIRE; 2076 rq->sadb_x_ipsecrequest_level = IPSEC_LEVEL_REQUIRE;
2032 if (t->reqid) 2077 if (t->reqid)
2033 rq->sadb_x_ipsecrequest_level = IPSEC_LEVEL_UNIQUE; 2078 rq->sadb_x_ipsecrequest_level = IPSEC_LEVEL_UNIQUE;
@@ -2089,6 +2134,8 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i
2089 2134
2090 hdr->sadb_msg_len = size / sizeof(uint64_t); 2135 hdr->sadb_msg_len = size / sizeof(uint64_t);
2091 hdr->sadb_msg_reserved = atomic_read(&xp->refcnt); 2136 hdr->sadb_msg_reserved = atomic_read(&xp->refcnt);
2137
2138 return 0;
2092} 2139}
2093 2140
2094static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c) 2141static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c)
@@ -2102,7 +2149,9 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
2102 err = PTR_ERR(out_skb); 2149 err = PTR_ERR(out_skb);
2103 goto out; 2150 goto out;
2104 } 2151 }
2105 pfkey_xfrm_policy2msg(out_skb, xp, dir); 2152 err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
2153 if (err < 0)
2154 return err;
2106 2155
2107 out_hdr = (struct sadb_msg *) out_skb->data; 2156 out_hdr = (struct sadb_msg *) out_skb->data;
2108 out_hdr->sadb_msg_version = PF_KEY_V2; 2157 out_hdr->sadb_msg_version = PF_KEY_V2;
@@ -2327,7 +2376,9 @@ static int key_pol_get_resp(struct sock *sk, struct xfrm_policy *xp, struct sadb
2327 err = PTR_ERR(out_skb); 2376 err = PTR_ERR(out_skb);
2328 goto out; 2377 goto out;
2329 } 2378 }
2330 pfkey_xfrm_policy2msg(out_skb, xp, dir); 2379 err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
2380 if (err < 0)
2381 goto out;
2331 2382
2332 out_hdr = (struct sadb_msg *) out_skb->data; 2383 out_hdr = (struct sadb_msg *) out_skb->data;
2333 out_hdr->sadb_msg_version = hdr->sadb_msg_version; 2384 out_hdr->sadb_msg_version = hdr->sadb_msg_version;
@@ -2409,6 +2460,7 @@ static int ipsecrequests_to_migrate(struct sadb_x_ipsecrequest *rq1, int len,
2409{ 2460{
2410 int err; 2461 int err;
2411 struct sadb_x_ipsecrequest *rq2; 2462 struct sadb_x_ipsecrequest *rq2;
2463 int mode;
2412 2464
2413 if (len <= sizeof(struct sadb_x_ipsecrequest) || 2465 if (len <= sizeof(struct sadb_x_ipsecrequest) ||
2414 len < rq1->sadb_x_ipsecrequest_len) 2466 len < rq1->sadb_x_ipsecrequest_len)
@@ -2439,7 +2491,9 @@ static int ipsecrequests_to_migrate(struct sadb_x_ipsecrequest *rq1, int len,
2439 return -EINVAL; 2491 return -EINVAL;
2440 2492
2441 m->proto = rq1->sadb_x_ipsecrequest_proto; 2493 m->proto = rq1->sadb_x_ipsecrequest_proto;
2442 m->mode = rq1->sadb_x_ipsecrequest_mode - 1; 2494 if ((mode = pfkey_mode_to_xfrm(rq1->sadb_x_ipsecrequest_mode)) < 0)
2495 return -EINVAL;
2496 m->mode = mode;
2443 m->reqid = rq1->sadb_x_ipsecrequest_reqid; 2497 m->reqid = rq1->sadb_x_ipsecrequest_reqid;
2444 2498
2445 return ((int)(rq1->sadb_x_ipsecrequest_len + 2499 return ((int)(rq1->sadb_x_ipsecrequest_len +
@@ -2579,12 +2633,15 @@ static int dump_sp(struct xfrm_policy *xp, int dir, int count, void *ptr)
2579 struct pfkey_dump_data *data = ptr; 2633 struct pfkey_dump_data *data = ptr;
2580 struct sk_buff *out_skb; 2634 struct sk_buff *out_skb;
2581 struct sadb_msg *out_hdr; 2635 struct sadb_msg *out_hdr;
2636 int err;
2582 2637
2583 out_skb = pfkey_xfrm_policy2msg_prep(xp); 2638 out_skb = pfkey_xfrm_policy2msg_prep(xp);
2584 if (IS_ERR(out_skb)) 2639 if (IS_ERR(out_skb))
2585 return PTR_ERR(out_skb); 2640 return PTR_ERR(out_skb);
2586 2641
2587 pfkey_xfrm_policy2msg(out_skb, xp, dir); 2642 err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
2643 if (err < 0)
2644 return err;
2588 2645
2589 out_hdr = (struct sadb_msg *) out_skb->data; 2646 out_hdr = (struct sadb_msg *) out_skb->data;
2590 out_hdr->sadb_msg_version = data->hdr->sadb_msg_version; 2647 out_hdr->sadb_msg_version = data->hdr->sadb_msg_version;
@@ -3513,7 +3570,10 @@ static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
3513 3570
3514 for (i = 0, mp = m; i < num_bundles; i++, mp++) { 3571 for (i = 0, mp = m; i < num_bundles; i++, mp++) {
3515 /* old ipsecrequest */ 3572 /* old ipsecrequest */
3516 if (set_ipsecrequest(skb, mp->proto, mp->mode + 1, 3573 int mode = pfkey_mode_from_xfrm(mp->mode);
3574 if (mode < 0)
3575 return -EINVAL;
3576 if (set_ipsecrequest(skb, mp->proto, mode,
3517 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3577 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3518 mp->reqid, mp->old_family, 3578 mp->reqid, mp->old_family,
3519 &mp->old_saddr, &mp->old_daddr) < 0) { 3579 &mp->old_saddr, &mp->old_daddr) < 0) {
@@ -3521,7 +3581,7 @@ static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
3521 } 3581 }
3522 3582
3523 /* new ipsecrequest */ 3583 /* new ipsecrequest */
3524 if (set_ipsecrequest(skb, mp->proto, mp->mode + 1, 3584 if (set_ipsecrequest(skb, mp->proto, mode,
3525 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3585 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3526 mp->reqid, mp->new_family, 3586 mp->reqid, mp->new_family,
3527 &mp->new_saddr, &mp->new_daddr) < 0) { 3587 &mp->new_saddr, &mp->new_daddr) < 0) {
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index e73d8f546c6b..c48b0f49f003 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -443,6 +443,7 @@ static int netlink_release(struct socket *sock)
443 return 0; 443 return 0;
444 444
445 netlink_remove(sk); 445 netlink_remove(sk);
446 sock_orphan(sk);
446 nlk = nlk_sk(sk); 447 nlk = nlk_sk(sk);
447 448
448 spin_lock(&nlk->cb_lock); 449 spin_lock(&nlk->cb_lock);
@@ -457,7 +458,6 @@ static int netlink_release(struct socket *sock)
457 /* OK. Socket is unlinked, and, therefore, 458 /* OK. Socket is unlinked, and, therefore,
458 no new packets will arrive */ 459 no new packets will arrive */
459 460
460 sock_orphan(sk);
461 sock->sk = NULL; 461 sock->sk = NULL;
462 wake_up_interruptible_all(&nlk->wait); 462 wake_up_interruptible_all(&nlk->wait);
463 463
@@ -1412,9 +1412,9 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
1412 return -ECONNREFUSED; 1412 return -ECONNREFUSED;
1413 } 1413 }
1414 nlk = nlk_sk(sk); 1414 nlk = nlk_sk(sk);
1415 /* A dump is in progress... */ 1415 /* A dump or destruction is in progress... */
1416 spin_lock(&nlk->cb_lock); 1416 spin_lock(&nlk->cb_lock);
1417 if (nlk->cb) { 1417 if (nlk->cb || sock_flag(sk, SOCK_DEAD)) {
1418 spin_unlock(&nlk->cb_lock); 1418 spin_unlock(&nlk->cb_lock);
1419 netlink_destroy_callback(cb); 1419 netlink_destroy_callback(cb);
1420 sock_put(sk); 1420 sock_put(sk);
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index 040e2d2d281a..7563fdcef4b7 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -245,9 +245,9 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
245 } 245 }
246 246
247 if (tb[TCA_TCINDEX_SHIFT-1]) { 247 if (tb[TCA_TCINDEX_SHIFT-1]) {
248 if (RTA_PAYLOAD(tb[TCA_TCINDEX_SHIFT-1]) < sizeof(u16)) 248 if (RTA_PAYLOAD(tb[TCA_TCINDEX_SHIFT-1]) < sizeof(int))
249 goto errout; 249 goto errout;
250 cp.shift = *(u16 *) RTA_DATA(tb[TCA_TCINDEX_SHIFT-1]); 250 cp.shift = *(int *) RTA_DATA(tb[TCA_TCINDEX_SHIFT-1]);
251 } 251 }
252 252
253 err = -EBUSY; 253 err = -EBUSY;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 536298c2eda2..a1d026f12b0e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -627,6 +627,12 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
627 retval = -EINVAL; 627 retval = -EINVAL;
628 goto err_bindx_rem; 628 goto err_bindx_rem;
629 } 629 }
630
631 if (!af->addr_valid(sa_addr, sp, NULL)) {
632 retval = -EADDRNOTAVAIL;
633 goto err_bindx_rem;
634 }
635
630 if (sa_addr->v4.sin_port != htons(bp->port)) { 636 if (sa_addr->v4.sin_port != htons(bp->port)) {
631 retval = -EINVAL; 637 retval = -EINVAL;
632 goto err_bindx_rem; 638 goto err_bindx_rem;
@@ -5638,6 +5644,36 @@ void sctp_wait_for_close(struct sock *sk, long timeout)
5638 finish_wait(sk->sk_sleep, &wait); 5644 finish_wait(sk->sk_sleep, &wait);
5639} 5645}
5640 5646
5647static void sctp_sock_rfree_frag(struct sk_buff *skb)
5648{
5649 struct sk_buff *frag;
5650
5651 if (!skb->data_len)
5652 goto done;
5653
5654 /* Don't forget the fragments. */
5655 for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next)
5656 sctp_sock_rfree_frag(frag);
5657
5658done:
5659 sctp_sock_rfree(skb);
5660}
5661
5662static void sctp_skb_set_owner_r_frag(struct sk_buff *skb, struct sock *sk)
5663{
5664 struct sk_buff *frag;
5665
5666 if (!skb->data_len)
5667 goto done;
5668
5669 /* Don't forget the fragments. */
5670 for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next)
5671 sctp_skb_set_owner_r_frag(frag, sk);
5672
5673done:
5674 sctp_skb_set_owner_r(skb, sk);
5675}
5676
5641/* Populate the fields of the newsk from the oldsk and migrate the assoc 5677/* Populate the fields of the newsk from the oldsk and migrate the assoc
5642 * and its messages to the newsk. 5678 * and its messages to the newsk.
5643 */ 5679 */
@@ -5692,10 +5728,10 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
5692 sctp_skb_for_each(skb, &oldsk->sk_receive_queue, tmp) { 5728 sctp_skb_for_each(skb, &oldsk->sk_receive_queue, tmp) {
5693 event = sctp_skb2event(skb); 5729 event = sctp_skb2event(skb);
5694 if (event->asoc == assoc) { 5730 if (event->asoc == assoc) {
5695 sctp_sock_rfree(skb); 5731 sctp_sock_rfree_frag(skb);
5696 __skb_unlink(skb, &oldsk->sk_receive_queue); 5732 __skb_unlink(skb, &oldsk->sk_receive_queue);
5697 __skb_queue_tail(&newsk->sk_receive_queue, skb); 5733 __skb_queue_tail(&newsk->sk_receive_queue, skb);
5698 sctp_skb_set_owner_r(skb, newsk); 5734 sctp_skb_set_owner_r_frag(skb, newsk);
5699 } 5735 }
5700 } 5736 }
5701 5737
@@ -5723,10 +5759,10 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
5723 sctp_skb_for_each(skb, &oldsp->pd_lobby, tmp) { 5759 sctp_skb_for_each(skb, &oldsp->pd_lobby, tmp) {
5724 event = sctp_skb2event(skb); 5760 event = sctp_skb2event(skb);
5725 if (event->asoc == assoc) { 5761 if (event->asoc == assoc) {
5726 sctp_sock_rfree(skb); 5762 sctp_sock_rfree_frag(skb);
5727 __skb_unlink(skb, &oldsp->pd_lobby); 5763 __skb_unlink(skb, &oldsp->pd_lobby);
5728 __skb_queue_tail(queue, skb); 5764 __skb_queue_tail(queue, skb);
5729 sctp_skb_set_owner_r(skb, newsk); 5765 sctp_skb_set_owner_r_frag(skb, newsk);
5730 } 5766 }
5731 } 5767 }
5732 5768
@@ -5738,6 +5774,16 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
5738 5774
5739 } 5775 }
5740 5776
5777 sctp_skb_for_each(skb, &assoc->ulpq.reasm, tmp) {
5778 sctp_sock_rfree_frag(skb);
5779 sctp_skb_set_owner_r_frag(skb, newsk);
5780 }
5781
5782 sctp_skb_for_each(skb, &assoc->ulpq.lobby, tmp) {
5783 sctp_sock_rfree_frag(skb);
5784 sctp_skb_set_owner_r_frag(skb, newsk);
5785 }
5786
5741 /* Set the type of socket to indicate that it is peeled off from the 5787 /* Set the type of socket to indicate that it is peeled off from the
5742 * original UDP-style socket or created with the accept() call on a 5788 * original UDP-style socket or created with the accept() call on a
5743 * TCP-style socket.. 5789 * TCP-style socket..
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index bfb197e37da3..b29e3e4b72c9 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -190,7 +190,14 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
190 if (!sctp_sk(sk)->pd_mode) { 190 if (!sctp_sk(sk)->pd_mode) {
191 queue = &sk->sk_receive_queue; 191 queue = &sk->sk_receive_queue;
192 } else if (ulpq->pd_mode) { 192 } else if (ulpq->pd_mode) {
193 if (event->msg_flags & MSG_NOTIFICATION) 193 /* If the association is in partial delivery, we
194 * need to finish delivering the partially processed
195 * packet before passing any other data. This is
196 * because we don't truly support stream interleaving.
197 */
198 if ((event->msg_flags & MSG_NOTIFICATION) ||
199 (SCTP_DATA_NOT_FRAG ==
200 (event->msg_flags & SCTP_DATA_FRAG_MASK)))
194 queue = &sctp_sk(sk)->pd_lobby; 201 queue = &sctp_sk(sk)->pd_lobby;
195 else { 202 else {
196 clear_pd = event->msg_flags & MSG_EOR; 203 clear_pd = event->msg_flags & MSG_EOR;
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 6d7221fe990a..396cdbe249d1 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1046,6 +1046,8 @@ call_status(struct rpc_task *task)
1046 rpc_delay(task, 3*HZ); 1046 rpc_delay(task, 3*HZ);
1047 case -ETIMEDOUT: 1047 case -ETIMEDOUT:
1048 task->tk_action = call_timeout; 1048 task->tk_action = call_timeout;
1049 if (task->tk_client->cl_discrtry)
1050 xprt_disconnect(task->tk_xprt);
1049 break; 1051 break;
1050 case -ECONNREFUSED: 1052 case -ECONNREFUSED:
1051 case -ENOTCONN: 1053 case -ENOTCONN:
@@ -1169,6 +1171,8 @@ call_decode(struct rpc_task *task)
1169out_retry: 1171out_retry:
1170 req->rq_received = req->rq_private_buf.len = 0; 1172 req->rq_received = req->rq_private_buf.len = 0;
1171 task->tk_status = 0; 1173 task->tk_status = 0;
1174 if (task->tk_client->cl_discrtry)
1175 xprt_disconnect(task->tk_xprt);
1172} 1176}
1173 1177
1174/* 1178/*
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 9bae4090254c..2bd23ea2aa8b 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -383,7 +383,10 @@ void svcauth_unix_purge(void)
383static inline struct ip_map * 383static inline struct ip_map *
384ip_map_cached_get(struct svc_rqst *rqstp) 384ip_map_cached_get(struct svc_rqst *rqstp)
385{ 385{
386 struct ip_map *ipm = rqstp->rq_sock->sk_info_authunix; 386 struct ip_map *ipm;
387 struct svc_sock *svsk = rqstp->rq_sock;
388 spin_lock_bh(&svsk->sk_defer_lock);
389 ipm = svsk->sk_info_authunix;
387 if (ipm != NULL) { 390 if (ipm != NULL) {
388 if (!cache_valid(&ipm->h)) { 391 if (!cache_valid(&ipm->h)) {
389 /* 392 /*
@@ -391,12 +394,14 @@ ip_map_cached_get(struct svc_rqst *rqstp)
391 * remembered, e.g. by a second mount from the 394 * remembered, e.g. by a second mount from the
392 * same IP address. 395 * same IP address.
393 */ 396 */
394 rqstp->rq_sock->sk_info_authunix = NULL; 397 svsk->sk_info_authunix = NULL;
398 spin_unlock_bh(&svsk->sk_defer_lock);
395 cache_put(&ipm->h, &ip_map_cache); 399 cache_put(&ipm->h, &ip_map_cache);
396 return NULL; 400 return NULL;
397 } 401 }
398 cache_get(&ipm->h); 402 cache_get(&ipm->h);
399 } 403 }
404 spin_unlock_bh(&svsk->sk_defer_lock);
400 return ipm; 405 return ipm;
401} 406}
402 407
@@ -405,9 +410,15 @@ ip_map_cached_put(struct svc_rqst *rqstp, struct ip_map *ipm)
405{ 410{
406 struct svc_sock *svsk = rqstp->rq_sock; 411 struct svc_sock *svsk = rqstp->rq_sock;
407 412
408 if (svsk->sk_sock->type == SOCK_STREAM && svsk->sk_info_authunix == NULL) 413 spin_lock_bh(&svsk->sk_defer_lock);
409 svsk->sk_info_authunix = ipm; /* newly cached, keep the reference */ 414 if (svsk->sk_sock->type == SOCK_STREAM &&
410 else 415 svsk->sk_info_authunix == NULL) {
416 /* newly cached, keep the reference */
417 svsk->sk_info_authunix = ipm;
418 ipm = NULL;
419 }
420 spin_unlock_bh(&svsk->sk_defer_lock);
421 if (ipm)
411 cache_put(&ipm->h, &ip_map_cache); 422 cache_put(&ipm->h, &ip_map_cache);
412} 423}
413 424
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 593f62ff8521..2772fee93881 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -452,6 +452,8 @@ union svc_pktinfo_u {
452 struct in_pktinfo pkti; 452 struct in_pktinfo pkti;
453 struct in6_pktinfo pkti6; 453 struct in6_pktinfo pkti6;
454}; 454};
455#define SVC_PKTINFO_SPACE \
456 CMSG_SPACE(sizeof(union svc_pktinfo_u))
455 457
456static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh) 458static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh)
457{ 459{
@@ -491,8 +493,11 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
491 struct svc_sock *svsk = rqstp->rq_sock; 493 struct svc_sock *svsk = rqstp->rq_sock;
492 struct socket *sock = svsk->sk_sock; 494 struct socket *sock = svsk->sk_sock;
493 int slen; 495 int slen;
494 char buffer[CMSG_SPACE(sizeof(union svc_pktinfo_u))]; 496 union {
495 struct cmsghdr *cmh = (struct cmsghdr *)buffer; 497 struct cmsghdr hdr;
498 long all[SVC_PKTINFO_SPACE / sizeof(long)];
499 } buffer;
500 struct cmsghdr *cmh = &buffer.hdr;
496 int len = 0; 501 int len = 0;
497 int result; 502 int result;
498 int size; 503 int size;
@@ -745,8 +750,11 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
745 struct svc_sock *svsk = rqstp->rq_sock; 750 struct svc_sock *svsk = rqstp->rq_sock;
746 struct svc_serv *serv = svsk->sk_server; 751 struct svc_serv *serv = svsk->sk_server;
747 struct sk_buff *skb; 752 struct sk_buff *skb;
748 char buffer[CMSG_SPACE(sizeof(union svc_pktinfo_u))]; 753 union {
749 struct cmsghdr *cmh = (struct cmsghdr *)buffer; 754 struct cmsghdr hdr;
755 long all[SVC_PKTINFO_SPACE / sizeof(long)];
756 } buffer;
757 struct cmsghdr *cmh = &buffer.hdr;
750 int err, len; 758 int err, len;
751 struct msghdr msg = { 759 struct msghdr msg = {
752 .msg_name = svc_addr(rqstp), 760 .msg_name = svc_addr(rqstp),
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index ee6ffa01dfb1..456a14510308 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -735,16 +735,6 @@ void xprt_transmit(struct rpc_task *task)
735 xprt_reset_majortimeo(req); 735 xprt_reset_majortimeo(req);
736 /* Turn off autodisconnect */ 736 /* Turn off autodisconnect */
737 del_singleshot_timer_sync(&xprt->timer); 737 del_singleshot_timer_sync(&xprt->timer);
738 } else {
739 /* If all request bytes have been sent,
740 * then we must be retransmitting this one */
741 if (!req->rq_bytes_sent) {
742 if (task->tk_client->cl_discrtry) {
743 xprt_disconnect(xprt);
744 task->tk_status = -ENOTCONN;
745 return;
746 }
747 }
748 } 738 }
749 } else if (!req->rq_bytes_sent) 739 } else if (!req->rq_bytes_sent)
750 return; 740 return;
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index e81e2fb3d429..816e3690b60f 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -272,9 +272,8 @@ static int attach_encap_tmpl(struct xfrm_encap_tmpl **encapp, struct rtattr *u_a
272} 272}
273 273
274 274
275static inline int xfrm_user_sec_ctx_size(struct xfrm_policy *xp) 275static inline int xfrm_user_sec_ctx_size(struct xfrm_sec_ctx *xfrm_ctx)
276{ 276{
277 struct xfrm_sec_ctx *xfrm_ctx = xp->security;
278 int len = 0; 277 int len = 0;
279 278
280 if (xfrm_ctx) { 279 if (xfrm_ctx) {
@@ -2170,7 +2169,7 @@ static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt,
2170 2169
2171 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); 2170 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
2172 len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire)); 2171 len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire));
2173 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); 2172 len += RTA_SPACE(xfrm_user_sec_ctx_size(x->security));
2174#ifdef CONFIG_XFRM_SUB_POLICY 2173#ifdef CONFIG_XFRM_SUB_POLICY
2175 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); 2174 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
2176#endif 2175#endif
@@ -2280,7 +2279,7 @@ static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, struct km_eve
2280 2279
2281 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); 2280 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
2282 len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire)); 2281 len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire));
2283 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); 2282 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp->security));
2284#ifdef CONFIG_XFRM_SUB_POLICY 2283#ifdef CONFIG_XFRM_SUB_POLICY
2285 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); 2284 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
2286#endif 2285#endif