Merge branch 'for-2.6.21' of master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 9 Apr 2007 18:45:18 +0000 (11:45 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 9 Apr 2007 18:45:18 +0000 (11:45 -0700)
* 'for-2.6.21' of master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart:
  [AGPGART] intel_agp: PCI id update for Intel 965GM

408 files changed:
Documentation/cpusets.txt
Documentation/kernel-parameters.txt
Documentation/networking/ax25.txt
Documentation/power/pci.txt
Documentation/sysrq.txt
MAINTAINERS
Makefile
arch/arm/kernel/dma.c
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-iop32x/Kconfig
arch/arm/mach-iop32x/iq31244.c
arch/arm/mach-s3c2410/mach-h1940.c
arch/arm/mach-s3c2440/mach-rx3715.c
arch/arm/mach-s3c2443/irq.c
arch/cris/arch-v32/drivers/pci/bios.c
arch/frv/mb93090-mb00/pci-vdk.c
arch/i386/boot/video.S
arch/i386/kernel/apic.c
arch/i386/kernel/cpu/amd.c
arch/i386/kernel/hpet.c
arch/i386/kernel/i8253.c
arch/i386/kernel/io_apic.c
arch/i386/kernel/microcode.c
arch/i386/kernel/nmi.c
arch/i386/kernel/tsc.c
arch/i386/kernel/vmi.c
arch/i386/lib/usercopy.c
arch/i386/mm/highmem.c
arch/i386/pci/common.c
arch/ia64/Kconfig
arch/ia64/kernel/msi_ia64.c
arch/ia64/kernel/smpboot.c
arch/ia64/mm/init.c
arch/ia64/pci/pci.c
arch/mips/Kconfig
arch/mips/gt64120/momenco_ocelot/prom.c
arch/mips/gt64120/momenco_ocelot/setup.c
arch/mips/jazz/jazzdma.c
arch/mips/kernel/entry.S
arch/mips/kernel/genex.S
arch/mips/kernel/smtc.c
arch/mips/mm/c-r3k.c
arch/mips/mm/cache.c
arch/mips/mm/cerr-sb1.c
arch/mips/mm/dma-default.c
arch/mips/mm/fault.c
arch/mips/mm/init.c
arch/mips/mm/pg-sb1.c
arch/mips/pci/pci-bcm1480.c
arch/mips/pci/pci-ev64120.c
arch/mips/pci/pci-sb1250.c
arch/mips/sibyte/bcm1480/irq.c
arch/mips/sibyte/bcm1480/smp.c
arch/mips/sibyte/swarm/setup.c
arch/powerpc/kernel/process.c
arch/powerpc/platforms/pseries/hvCall.S
arch/powerpc/platforms/pseries/lpar.c
arch/powerpc/platforms/pseries/plpar_wrappers.h
arch/powerpc/sysdev/dcr.c
arch/powerpc/sysdev/qe_lib/qe.c
arch/s390/kernel/kprobes.c
arch/sh/kernel/sh_ksyms.c
arch/sparc/lib/atomic32.c
arch/um/drivers/chan_kern.c
arch/um/drivers/mconsole_kern.c
arch/um/drivers/ubd_kern.c
arch/um/include/mconsole.h
arch/um/include/sysdep-x86_64/ptrace.h
arch/um/kernel/mem.c
arch/um/os-Linux/skas/mem.c
arch/um/os-Linux/skas/process.c
arch/um/os-Linux/sys-i386/registers.c
arch/um/os-Linux/sys-x86_64/registers.c
arch/um/sys-i386/delay.c
arch/um/sys-i386/ldt.c
arch/um/sys-x86_64/delay.c
arch/x86_64/boot/video.S
arch/x86_64/kernel/acpi/sleep.c
arch/x86_64/kernel/apic.c
arch/x86_64/kernel/early-quirks.c
arch/x86_64/kernel/i8259.c
arch/x86_64/kernel/nmi.c
block/elevator.c
block/genhd.c
block/ll_rw_blk.c
crypto/scatterwalk.c
drivers/acpi/events/evmisc.c
drivers/acpi/events/evregion.c
drivers/acpi/events/evxface.c
drivers/acpi/executer/excreate.c
drivers/acpi/executer/exsystem.c
drivers/acpi/executer/exutils.c
drivers/acpi/hardware/hwsleep.c
drivers/acpi/ibm_acpi.c
drivers/acpi/namespace/nseval.c
drivers/acpi/namespace/nsinit.c
drivers/acpi/namespace/nsxfeval.c
drivers/acpi/processor_idle.c
drivers/acpi/tables.c
drivers/ata/ahci.c
drivers/ata/libata-acpi.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/libata.h
drivers/ata/pata_pdc202xx_old.c
drivers/base/core.c
drivers/base/driver.c
drivers/block/cciss.c
drivers/char/Kconfig
drivers/char/drm/Makefile
drivers/char/drm/ffb_context.c [deleted file]
drivers/char/drm/ffb_drv.c [deleted file]
drivers/char/drm/ffb_drv.h [deleted file]
drivers/char/generic_serial.c
drivers/char/vt_ioctl.c
drivers/clocksource/acpi_pm.c
drivers/cpufreq/cpufreq.c
drivers/eisa/pci_eisa.c
drivers/i2c/busses/i2c-amd8111.c
drivers/i2c/busses/i2c-i801.c
drivers/i2c/chips/ds1374.c
drivers/ide/Kconfig
drivers/ide/ide-io.c
drivers/ide/ide-iops.c
drivers/ide/ide.c
drivers/ide/pci/pdc202xx_new.c
drivers/ieee1394/eth1394.c
drivers/infiniband/hw/cxgb3/cxio_hal.c
drivers/infiniband/hw/cxgb3/iwch_provider.c
drivers/infiniband/hw/ehca/ehca_irq.c
drivers/infiniband/hw/ipath/ipath_fs.c
drivers/infiniband/hw/mthca/mthca_mr.c
drivers/infiniband/ulp/ipoib/ipoib_cm.c
drivers/infiniband/ulp/ipoib/ipoib_ib.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
drivers/infiniband/ulp/iser/iser_initiator.c
drivers/isdn/gigaset/bas-gigaset.c
drivers/isdn/gigaset/common.c
drivers/isdn/gigaset/ev-layer.c
drivers/isdn/gigaset/isocdata.c
drivers/isdn/gigaset/ser-gigaset.c
drivers/isdn/gigaset/usb-gigaset.c
drivers/isdn/hisax/isar.c
drivers/kvm/vmx.c
drivers/md/md.c
drivers/md/raid5.c
drivers/media/common/ir-functions.c
drivers/media/dvb/dvb-core/dmxdev.c
drivers/media/dvb/dvb-core/dvb_demux.c
drivers/media/dvb/dvb-core/dvbdev.c
drivers/media/dvb/frontends/isl6421.c
drivers/media/dvb/frontends/nxt200x.c
drivers/media/dvb/frontends/tda10086.c
drivers/media/dvb/pluto2/pluto2.c
drivers/media/radio/Kconfig
drivers/media/video/msp3400-driver.c
drivers/media/video/saa7115.c
drivers/media/video/tuner-core.c
drivers/message/fusion/mptsas.c
drivers/message/i2o/i2o_block.c
drivers/mfd/sm501.c
drivers/net/Kconfig
drivers/net/atl1/atl1_hw.c
drivers/net/atl1/atl1_main.c
drivers/net/b44.c
drivers/net/bnx2.c
drivers/net/cxgb3/common.h
drivers/net/cxgb3/cxgb3_main.c
drivers/net/cxgb3/cxgb3_offload.c
drivers/net/cxgb3/mc5.c
drivers/net/cxgb3/regs.h
drivers/net/cxgb3/sge.c
drivers/net/cxgb3/t3_hw.c
drivers/net/cxgb3/version.h
drivers/net/cxgb3/xgmac.c
drivers/net/ewrk3.c
drivers/net/forcedeth.c
drivers/net/ifb.c
drivers/net/irda/irda-usb.c
drivers/net/irda/pxaficp_ir.c
drivers/net/mv643xx_eth.c
drivers/net/myri10ge/myri10ge.c
drivers/net/netxen/netxen_nic_init.c
drivers/net/pci-skeleton.c
drivers/net/ppp_generic.c
drivers/net/qla3xxx.c
drivers/net/qla3xxx.h
drivers/net/r8169.c
drivers/net/saa9730.c
drivers/net/sb1250-mac.c
drivers/net/sis190.c
drivers/net/skge.c
drivers/net/skge.h
drivers/net/sun3lance.c
drivers/net/sungem.c
drivers/net/tg3.c
drivers/net/tg3.h
drivers/net/ucc_geth.c
drivers/net/wan/lmc/lmc_media.h [deleted file]
drivers/net/wireless/airo.c
drivers/net/wireless/bcm43xx/bcm43xx_phy.c
drivers/net/wireless/bcm43xx/bcm43xx_radio.c
drivers/oprofile/event_buffer.c
drivers/oprofile/oprofilefs.c
drivers/pci/msi.c
drivers/pci/pcie/portdrv_pci.c
drivers/pci/quirks.c
drivers/pcmcia/au1000_generic.c
drivers/pcmcia/omap_cf.c
drivers/pnp/system.c
drivers/rtc/rtc-cmos.c
drivers/s390/block/dasd_diag.c
drivers/s390/cio/device_status.c
drivers/s390/crypto/ap_bus.c
drivers/scsi/gdth.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/scsi_error.c
drivers/serial/8250_pnp.c
drivers/spi/spi.c
drivers/tc/zs.c
drivers/usb/core/quirks.c
drivers/usb/gadget/omap_udc.c
drivers/usb/host/uhci-debug.c
drivers/usb/host/uhci-hcd.c
drivers/usb/host/uhci-q.c
drivers/usb/serial/airprime.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/generic.c
drivers/video/cg3.c
drivers/video/ffb.c
drivers/video/riva/fbdev.c
drivers/video/s3fb.c
fs/9p/v9fs_vfs.h
fs/9p/vfs_file.c
fs/aio.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/char_dev.c
fs/cifs/CHANGES
fs/cifs/cifspdu.h
fs/cifs/inode.c
fs/cifs/readdir.c
fs/compat_ioctl.c
fs/ext3/inode.c
fs/ext3/xattr.c
fs/ext4/inode.c
fs/fuse/dir.c
fs/fuse/fuse_i.h
fs/fuse/inode.c
fs/hostfs/hostfs_kern.c
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs4acl.c
fs/nfsd/nfs4state.c
fs/ocfs2/dlm/dlmdomain.c
fs/ocfs2/dlm/dlmmaster.c
fs/ocfs2/dlm/dlmthread.c
fs/proc/Makefile
fs/proc/internal.h
fs/proc/root.c
fs/splice.c
fs/xfs/linux-2.6/xfs_buf.c
include/acpi/acinterp.h
include/acpi/actypes.h
include/asm-arm/arch-ixp4xx/io.h
include/asm-arm/arch-ns9xxx/clock.h
include/asm-arm/arch-pxa/pxa-regs.h
include/asm-arm/system.h
include/asm-arm/unistd.h
include/asm-generic/pgtable.h
include/asm-i386/apic.h
include/asm-i386/cpufeature.h
include/asm-i386/elf.h
include/asm-i386/msr.h
include/asm-i386/paravirt.h
include/asm-i386/termbits.h
include/asm-ia64/processor.h
include/asm-mips/cacheflush.h
include/asm-mips/delay.h
include/asm-mips/hazards.h
include/asm-mips/irqflags.h
include/asm-mips/marvell.h
include/asm-mips/pgtable-64.h
include/asm-mips/pgtable.h
include/asm-mips/sgiarcs.h
include/asm-mips/sibyte/sb1250.h
include/asm-mips/smtc_ipi.h
include/asm-powerpc/hvcall.h
include/asm-powerpc/immap_qe.h
include/asm-s390/checksum.h
include/asm-sh/hp6xx.h
include/asm-sh/system.h
include/asm-sparc/a.out.h
include/asm-sparc/mostek.h
include/asm-sparc64/a.out.h
include/asm-sparc64/mostek.h
include/asm-um/common.lds.S
include/asm-um/delay.h
include/asm-um/pgtable-2level.h
include/asm-x86_64/apic.h
include/asm-x86_64/hw_irq.h
include/linux/ata.h
include/linux/bootmem.h
include/linux/compiler.h
include/linux/cpu.h
include/linux/device.h
include/linux/eventpoll.h
include/linux/hrtimer.h
include/linux/ide.h
include/linux/ipc.h
include/linux/kdev_t.h
include/linux/libata.h
include/linux/lockdep.h
include/linux/pipe_fs_i.h
include/linux/raid/md_k.h
include/linux/skbuff.h
include/linux/utsname.h
include/linux/wireless.h
include/media/saa7146_vv.h
include/net/fib_rules.h
include/net/ip6_fib.h
include/net/iw_handler.h
include/net/neighbour.h
include/net/pkt_cls.h
include/net/sctp/structs.h
include/net/sctp/ulpqueue.h
ipc/util.c
kernel/cpu.c
kernel/exit.c
kernel/hrtimer.c
kernel/irq/devres.c
kernel/lockdep.c
kernel/module.c
kernel/power/disk.c
kernel/power/swsusp.c
kernel/power/user.c
kernel/sched.c
kernel/time.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/jiffies.c
kernel/time/ntp.c
kernel/time/timer_list.c
kernel/timer.c
mm/bounce.c
mm/filemap_xip.c
mm/madvise.c
mm/nommu.c
mm/rmap.c
mm/shmem.c
mm/slab.c
net/appletalk/ddp.c
net/atm/clip.c
net/ax25/Kconfig
net/bluetooth/hidp/core.c
net/bridge/br_fdb.c
net/bridge/br_netfilter.c
net/core/dev.c
net/core/fib_rules.c
net/core/neighbour.c
net/core/rtnetlink.c
net/core/skbuff.c
net/core/sock.c
net/core/wireless.c
net/dccp/dccp.h
net/dccp/proto.c
net/dccp/timer.c
net/decnet/dn_fib.c
net/decnet/dn_rules.c
net/ieee80211/Kconfig
net/ipv4/fib_frontend.c
net/ipv4/fib_rules.c
net/ipv4/fib_semantics.c
net/ipv4/fib_trie.c
net/ipv4/netfilter/ip_nat_standalone.c
net/ipv4/netfilter/nf_nat_standalone.c
net/ipv4/tcp_output.c
net/ipv4/xfrm4_mode_beet.c
net/ipv6/addrconf.c
net/ipv6/fib6_rules.c
net/ipv6/ip6_fib.c
net/ipv6/ip6_input.c
net/ipv6/raw.c
net/ipv6/route.c
net/ipv6/udp.c
net/ipv6/xfrm6_tunnel.c
net/irda/irnet/irnet.h
net/irda/irnet/irnet_irda.c
net/irda/irttp.c
net/netfilter/Kconfig
net/sched/Makefile
net/sched/act_mirred.c
net/sched/cls_basic.c
net/sched/cls_route.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sctp/associola.c
net/sctp/sm_statefuns.c
net/sctp/transport.c
net/sctp/ulpqueue.c
net/socket.c
net/sunrpc/svcsock.c
net/x25/x25_forward.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
scripts/basic/fixdep.c

index 842f0d1..f2c0a68 100644 (file)
@@ -557,6 +557,9 @@ Set some flags:
 Add some cpus:
 # /bin/echo 0-7 > cpus
 
+Add some mems:
+# /bin/echo 0-7 > mems
+
 Now attach your shell to this cpuset:
 # /bin/echo $$ > tasks
 
index 856c8b1..12533a9 100644 (file)
@@ -138,6 +138,12 @@ and is between 256 and 4096 characters. It is defined in the file
 
                        See also Documentation/pm.txt, pci=noacpi
 
+       acpi_apic_instance=     [ACPI, IOAPIC]
+                       Format: <int>
+                       2: use 2nd APIC table, if available
+                       1,0: use 1st APIC table
+                       default: 0
+
        acpi_sleep=     [HW,ACPI] Sleep options
                        Format: { s3_bios, s3_mode }
                        See Documentation/power/video.txt
@@ -774,6 +780,9 @@ and is between 256 and 4096 characters. It is defined in the file
        lapic           [IA-32,APIC] Enable the local APIC even if BIOS
                        disabled it.
 
+       lapic_timer_c2_ok       [IA-32,x86-64,APIC] trust the local apic timer in
+                       C2 power state.
+
        lasi=           [HW,SCSI] PARISC LASI driver for the 53c700 chip
                        Format: addr:<io>,irq:<irq>
 
@@ -1117,6 +1126,8 @@ and is between 256 and 4096 characters. It is defined in the file
 
        nolapic         [IA-32,APIC] Do not enable or use the local APIC.
 
+       nolapic_timer   [IA-32,APIC] Do not use the local APIC timer.
+
        noltlbs         [PPC] Do not use large page/tlb entries for kernel
                        lowmem mapping on PPC40x.
 
index 37c25b0..8257dbf 100644 (file)
@@ -1,16 +1,10 @@
 To use the amateur radio protocols within Linux you will need to get a
-suitable copy of the AX.25 Utilities. More detailed information about these
-and associated programs can be found on http://zone.pspt.fi/~jsn/.
-
-For more information about the AX.25, NET/ROM and ROSE protocol stacks, see
-the AX25-HOWTO written by Terry Dawson <terry@perf.no.itg.telstra.com.au>
-who is also the AX.25 Utilities maintainer.
+suitable copy of the AX.25 Utilities. More detailed information about
+AX.25, NET/ROM and ROSE, associated programs and and utilities can be
+found on http://www.linux-ax25.org.
 
 There is an active mailing list for discussing Linux amateur radio matters
-called linux-hams. To subscribe to it, send a message to
+called linux-hams@vger.kernel.org. To subscribe to it, send a message to
 majordomo@vger.kernel.org with the words "subscribe linux-hams" in the body
-of the message, the subject field is ignored.
-
-Jonathan G4KLX
-
-g4klx@g4klx.demon.co.uk
+of the message, the subject field is ignored.  You don't need to be
+subscribed to post but of course that means you might miss an answer.
index c750f9f..b6a3cbf 100644 (file)
@@ -102,31 +102,28 @@ pci_save_state
 --------------
 
 Usage:
-       pci_save_state(dev, buffer);
+       pci_save_state(struct pci_dev *dev);
 
 Description:
-       Save first 64 bytes of PCI config space. Buffer must be allocated by
-       caller.
+       Save first 64 bytes of PCI config space, along with any additional
+       PCI-Express or PCI-X information.
 
 
 pci_restore_state
 -----------------
 
 Usage:
-       pci_restore_state(dev, buffer);
+       pci_restore_state(struct pci_dev *dev);
 
 Description:
-       Restore previously saved config space. (First 64 bytes only);
-
-       If buffer is NULL, then restore what information we know about the
-       device from bootup: BARs and interrupt line.
+       Restore previously saved config space.
 
 
 pci_set_power_state
 -------------------
 
 Usage:
-       pci_set_power_state(dev, state);
+       pci_set_power_state(struct pci_dev *dev, pci_power_t state);
 
 Description:
        Transition device to low power state using PCI PM Capabilities
@@ -142,7 +139,7 @@ pci_enable_wake
 ---------------
 
 Usage:
-       pci_enable_wake(dev, state, enable);
+       pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
 
 Description:
        Enable device to generate PME# during low power state using PCI PM 
index 452c0f1..d43aa9d 100644 (file)
@@ -93,6 +93,8 @@ On all -  write a character to /proc/sysrq-trigger.  e.g.:
 
 'p'     - Will dump the current registers and flags to your console.
 
+'q'     - Will dump a list of all running timers.
+
 'r'     - Turns off keyboard raw mode and sets it to XLATE.
 
 's'     - Will attempt to sync all mounted filesystems.
index 6d8d5b9..829407f 100644 (file)
@@ -198,10 +198,25 @@ L:        linux-sound@vger.kernel.org
 W:     http://www.stud.uni-karlsruhe.de/~uh1b/
 S:     Maintained
 
+IPS SCSI RAID DRIVER
+P:     Adaptec OEM Raid Solutions
+M:     aacraid@adaptec.com
+L:     linux-scsi@vger.kernel.org
+W:     http://www.adaptec.com/
+S:     Maintained
+
+DPT_I2O SCSI RAID DRIVER
+P:     Adaptec OEM Raid Solutions
+M:     aacraid@adaptec.com
+L:     linux-scsi@vger.kernel.org
+W:     http://www.adaptec.com/
+S:     Maintained
+
 AACRAID SCSI RAID DRIVER
 P:     Adaptec OEM Raid Solutions
+M:     aacraid@adaptec.com
 L:     linux-scsi@vger.kernel.org
-W:     http://linux.dell.com/storage.shtml
+W:     http://www.adaptec.com/
 S:     Supported
 
 ACPI
@@ -1585,12 +1600,6 @@ L:       i2c@lm-sensors.org
 T:     quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
 S:     Maintained
 
-I2O
-P:     Markus Lidel
-M:     markus.lidel@shadowconnect.com
-W:     http://i2o.shadowconnect.com/
-S:     Maintained
-
 i386 BOOT CODE
 P:     Riley H. Williams
 M:     Riley@Williams.Name
@@ -2928,9 +2937,12 @@ L:       linux-scsi@vger.kernel.org
 S:     Maintained
 
 SCTP PROTOCOL
+P:     Vlad Yasevich
+M:     vladislav.yasevich@hp.com
 P:     Sridhar Samudrala
 M:     sri@us.ibm.com
 L:     lksctp-developers@lists.sourceforge.net
+W:     http://lksctp.sourceforge.net
 S:     Supported
 
 SCx200 CPU SUPPORT
@@ -3066,11 +3078,10 @@ L:      netdev@vger.kernel.org
 S:     Maintained
 
 SONY VAIO CONTROL DEVICE DRIVER
-P:     Stelian Pop
-M:     stelian@popies.net
 P:     Mattia Dongili
 M:     malattia@linux.it
-W:     http://popies.net/sonypi/
+L:     linux-acpi@vger.kernel.org
+W:     http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
 S:     Maintained
 
 SOUND
index 1c018c4..6486af1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 21
-EXTRAVERSION = -rc4
+EXTRAVERSION = -rc6
 NAME = Nocturnal Monster Puppy
 
 # *DOCUMENTATION*
index 5a0f4bc..ba99a20 100644 (file)
@@ -228,6 +228,7 @@ int dma_channel_active(dmach_t channel)
 {
        return dma_chan[channel].active;
 }
+EXPORT_SYMBOL(dma_channel_active);
 
 void set_dma_page(dmach_t channel, char pagenr)
 {
index f7d342c..40586e2 100644 (file)
@@ -320,16 +320,16 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
        at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
                        | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
 
-       at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5)
-                       | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5));
+       at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
+                       | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
 
-       at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7));
+       at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
 
        if (data->bus_width_16)
                mode = AT91_SMC_DBW_16;
        else
                mode = AT91_SMC_DBW_8;
-       at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1));
+       at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
 
        /* enable pin */
        if (data->enable_pin)
index c072d94..9dd49cf 100644 (file)
@@ -4,6 +4,9 @@ menu "IOP32x Implementation Options"
 
 comment "IOP32x Platform Types"
 
+config MACH_EP80219
+       bool
+
 config MACH_GLANTANK
        bool "Enable support for the IO-Data GLAN Tank"
        help
@@ -19,6 +22,7 @@ config ARCH_IQ80321
 
 config ARCH_IQ31244
        bool "Enable support for EP80219/IQ31244"
+       select MACH_EP80219
        help
          Say Y here if you want to run your kernel on the Intel EP80219
          evaluation kit for the Intel 80219 processor (a IOP321 variant)
index 571ac35..60e7430 100644 (file)
 #include <asm/arch/time.h>
 
 /*
- * The EP80219 and IQ31244 use the same machine ID.  To find out
- * which of the two we're running on, we look at the processor ID.
+ * Until March of 2007 iq31244 platforms and ep80219 platforms shared the
+ * same machine id, and the processor type was used to select board type.
+ * However this assumption breaks for an iq80219 board which is an iop219
+ * processor on an iq31244 board.  The force_ep80219 flag has been added
+ * for old boot loaders using the iq31244 machine id for an ep80219 platform.
  */
+static int force_ep80219;
+
 static int is_80219(void)
 {
        extern int processor_id;
        return !!((processor_id & 0xffffffe0) == 0x69052e20);
 }
 
+static int is_ep80219(void)
+{
+       if (machine_is_ep80219() || force_ep80219)
+               return 1;
+       else
+               return 0;
+}
+
 
 /*
  * EP80219/IQ31244 timer tick configuration.
  */
 static void __init iq31244_timer_init(void)
 {
-       if (is_80219()) {
+       if (is_ep80219()) {
                /* 33.333 MHz crystal.  */
                iop_init_time(200000000);
        } else {
@@ -165,12 +178,18 @@ static struct hw_pci iq31244_pci __initdata = {
 
 static int __init iq31244_pci_init(void)
 {
-       if (machine_is_iq31244()) {
+       if (is_ep80219())
+               pci_common_init(&ep80219_pci);
+       else if (machine_is_iq31244()) {
                if (is_80219()) {
-                       pci_common_init(&ep80219_pci);
-               } else {
-                       pci_common_init(&iq31244_pci);
+                       printk("note: iq31244 board type has been selected\n");
+                       printk("note: to select ep80219 operation:\n");
+                       printk("\t1/ specify \"force_ep80219\" on the kernel"
+                               " command line\n");
+                       printk("\t2/ update boot loader to pass"
+                               " the ep80219 id: %d\n", MACH_TYPE_EP80219);
                }
+               pci_common_init(&iq31244_pci);
        }
 
        return 0;
@@ -277,10 +296,18 @@ static void __init iq31244_init_machine(void)
        platform_device_register(&iq31244_flash_device);
        platform_device_register(&iq31244_serial_device);
 
-       if (is_80219())
+       if (is_ep80219())
                pm_power_off = ep80219_power_off;
 }
 
+static int __init force_ep80219_setup(char *str)
+{
+       force_ep80219 = 1;
+       return 1;
+}
+
+__setup("force_ep80219", force_ep80219_setup);
+
 MACHINE_START(IQ31244, "Intel IQ31244")
        /* Maintainer: Intel Corp. */
        .phys_io        = IQ31244_UART,
@@ -291,3 +318,19 @@ MACHINE_START(IQ31244, "Intel IQ31244")
        .timer          = &iq31244_timer,
        .init_machine   = iq31244_init_machine,
 MACHINE_END
+
+/* There should have been an ep80219 machine identifier from the beginning.
+ * Boot roms older than March 2007 do not know the ep80219 machine id.  Pass
+ * "force_ep80219" on the kernel command line, otherwise iq31244 operation
+ * will be selected.
+ */
+MACHINE_START(EP80219, "Intel EP80219")
+       /* Maintainer: Intel Corp. */
+       .phys_io        = IQ31244_UART,
+       .io_pg_offst    = ((IQ31244_UART) >> 18) & 0xfffc,
+       .boot_params    = 0xa0000100,
+       .map_io         = iq31244_map_io,
+       .init_irq       = iop32x_init_irq,
+       .timer          = &iq31244_timer,
+       .init_machine   = iq31244_init_machine,
+MACHINE_END
index 01c60d0..d052ab2 100644 (file)
@@ -202,7 +202,9 @@ static void __init h1940_map_io(void)
 
        /* setup PM */
 
+#ifdef CONFIG_PM_H1940
        memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
+#endif
        s3c2410_pm_init();
 }
 
index 480ccde..ae1d0a8 100644 (file)
@@ -224,7 +224,9 @@ static void __init rx3715_init_irq(void)
 
 static void __init rx3715_init_machine(void)
 {
+#ifdef CONFIG_PM_H1940
        memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
+#endif
        s3c2410_pm_init();
 
        s3c24xx_fb_set_platdata(&rx3715_lcdcfg);
index 7a45b6d..7565735 100644 (file)
@@ -137,7 +137,7 @@ static struct irq_chip s3c2443_irq_lcd = {
 
 static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
 {
-       s3c2443_irq_demux(IRQ_S3C2443_DMA1, 6);
+       s3c2443_irq_demux(IRQ_S3C2443_DMA0, 6);
 }
 
 #define INTMSK_DMA     (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0))
index a2b9c60..5b79a7a 100644 (file)
@@ -100,7 +100,9 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
        if ((err = pcibios_enable_resources(dev, mask)) < 0)
                return err;
 
-       return pcibios_enable_irq(dev);
+       if (!dev->msi_enabled)
+               pcibios_enable_irq(dev);
+       return 0;
 }
 
 int pcibios_assign_resources(void)
index f7279d7..0b581e3 100644 (file)
@@ -466,6 +466,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 
        if ((err = pcibios_enable_resources(dev, mask)) < 0)
                return err;
-       pcibios_enable_irq(dev);
+       if (!dev->msi_enabled)
+               pcibios_enable_irq(dev);
        return 0;
 }
index 2c5b5cc..8143c95 100644 (file)
@@ -571,6 +571,16 @@ setr1:     lodsw
        jmp     _m_s
 
 check_vesa:
+#ifdef CONFIG_FIRMWARE_EDID
+       leaw    modelist+1024, %di
+       movw    $0x4f00, %ax
+       int     $0x10
+       cmpw    $0x004f, %ax
+       jnz     setbad
+
+       movw    4(%di), %ax
+       movw    %ax, vbe_version
+#endif
        leaw    modelist+1024, %di
        subb    $VIDEO_FIRST_VESA>>8, %bh
        movw    %bx, %cx                        # Get mode information structure
@@ -1945,6 +1955,9 @@ store_edid:
        rep
        stosl
 
+       cmpw    $0x0200, vbe_version            # only do EDID on >= VBE2.0
+       jl      no_edid
+
        pushw   %es                             # save ES
        xorw    %di, %di                        # Report Capability
        pushw   %di
@@ -1987,6 +2000,7 @@ do_restore:       .byte   0       # Screen contents altered during mode change
 svga_prefix:   .byte   VIDEO_FIRST_BIOS>>8     # Default prefix for BIOS modes
 graphic_mode:  .byte   0       # Graphic mode with a linear frame buffer
 dac_size:      .byte   6       # DAC bit depth
+vbe_version:   .word   0       # VBE bios version
 
 # Status messages
 keymsg:                .ascii  "Press <RETURN> to see video modes available, "
index 5cff797..93aa911 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/clockchips.h>
 #include <linux/acpi_pmtmr.h>
 #include <linux/module.h>
+#include <linux/dmi.h>
 
 #include <asm/atomic.h>
 #include <asm/smp.h>
@@ -61,6 +62,11 @@ static int enable_local_apic __initdata = 0;
 
 /* Local APIC timer verification ok */
 static int local_apic_timer_verify_ok;
+/* Disable local APIC timer from the kernel commandline or via dmi quirk */
+static int local_apic_timer_disabled;
+/* Local APIC timer works in C2 */
+int local_apic_timer_c2_ok;
+EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
 
 /*
  * Debug level, exported for io_apic.c
@@ -340,6 +346,22 @@ void __init setup_boot_APIC_clock(void)
        long delta, deltapm;
        int pm_referenced = 0;
 
+       if (boot_cpu_has(X86_FEATURE_LAPIC_TIMER_BROKEN))
+               local_apic_timer_disabled = 1;
+
+       /*
+        * The local apic timer can be disabled via the kernel
+        * commandline or from the test above. Register the lapic
+        * timer as a dummy clock event source on SMP systems, so the
+        * broadcast mechanism is used. On UP systems simply ignore it.
+        */
+       if (local_apic_timer_disabled) {
+               /* No broadcast on UP ! */
+               if (num_possible_cpus() > 1)
+                       setup_APIC_timer();
+               return;
+       }
+
        apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
                    "calibrating APIC timer ...\n");
 
@@ -461,7 +483,8 @@ void __init setup_boot_APIC_clock(void)
                        apic_printk(APIC_VERBOSE, "... jiffies result ok\n");
                else
                        local_apic_timer_verify_ok = 0;
-       }
+       } else
+               local_irq_enable();
 
        if (!local_apic_timer_verify_ok) {
                printk(KERN_WARNING
@@ -1179,6 +1202,20 @@ static int __init parse_nolapic(char *arg)
 }
 early_param("nolapic", parse_nolapic);
 
+static int __init parse_disable_lapic_timer(char *arg)
+{
+       local_apic_timer_disabled = 1;
+       return 0;
+}
+early_param("nolapic_timer", parse_disable_lapic_timer);
+
+static int __init parse_lapic_timer_c2_ok(char *arg)
+{
+       local_apic_timer_c2_ok = 1;
+       return 0;
+}
+early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
+
 static int __init apic_set_verbosity(char *str)
 {
        if (strcmp("debug", str) == 0)
index 41cfea5..2d47db4 100644 (file)
 extern void vide(void);
 __asm__(".align 4\nvide: ret");
 
+#define ENABLE_C1E_MASK         0x18000000
+#define CPUID_PROCESSOR_SIGNATURE       1
+#define CPUID_XFAM              0x0ff00000
+#define CPUID_XFAM_K8           0x00000000
+#define CPUID_XFAM_10H          0x00100000
+#define CPUID_XFAM_11H          0x00200000
+#define CPUID_XMOD              0x000f0000
+#define CPUID_XMOD_REV_F        0x00040000
+
+/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */
+static __cpuinit int amd_apic_timer_broken(void)
+{
+       u32 lo, hi;
+       u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
+       switch (eax & CPUID_XFAM) {
+       case CPUID_XFAM_K8:
+               if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
+                       break;
+       case CPUID_XFAM_10H:
+       case CPUID_XFAM_11H:
+               rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
+               if (lo & ENABLE_C1E_MASK)
+                       return 1;
+                break;
+        default:
+                /* err on the side of caution */
+               return 1;
+        }
+       return 0;
+}
+
 static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 {
        u32 l, h;
@@ -241,6 +272,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 
        if (cpuid_eax(0x80000000) >= 0x80000006)
                num_cache_leaves = 3;
+
+       if (amd_apic_timer_broken())
+               set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability);
 }
 
 static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size)
index f3ab61e..17d7345 100644 (file)
@@ -3,6 +3,8 @@
 #include <linux/errno.h>
 #include <linux/hpet.h>
 #include <linux/init.h>
+#include <linux/sysdev.h>
+#include <linux/pm.h>
 
 #include <asm/hpet.h>
 #include <asm/io.h>
@@ -197,7 +199,7 @@ static int hpet_next_event(unsigned long delta,
        cnt += delta;
        hpet_writel(cnt, HPET_T0_CMP);
 
-       return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0);
+       return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0) ? -ETIME : 0;
 }
 
 /*
@@ -307,6 +309,7 @@ int __init hpet_enable(void)
 out_nohpet:
        iounmap(hpet_virt_address);
        hpet_virt_address = NULL;
+       boot_hpet_disable = 1;
        return 0;
 }
 
@@ -521,3 +524,68 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 #endif
+
+
+/*
+ * Suspend/resume part
+ */
+
+#ifdef CONFIG_PM
+
+static int hpet_suspend(struct sys_device *sys_device, pm_message_t state)
+{
+       unsigned long cfg = hpet_readl(HPET_CFG);
+
+       cfg &= ~(HPET_CFG_ENABLE|HPET_CFG_LEGACY);
+       hpet_writel(cfg, HPET_CFG);
+
+       return 0;
+}
+
+static int hpet_resume(struct sys_device *sys_device)
+{
+       unsigned int id;
+
+       hpet_start_counter();
+
+       id = hpet_readl(HPET_ID);
+
+       if (id & HPET_ID_LEGSUP)
+               hpet_enable_int();
+
+       return 0;
+}
+
+static struct sysdev_class hpet_class = {
+       set_kset_name("hpet"),
+       .suspend        = hpet_suspend,
+       .resume         = hpet_resume,
+};
+
+static struct sys_device hpet_device = {
+       .id             = 0,
+       .cls            = &hpet_class,
+};
+
+
+static __init int hpet_register_sysfs(void)
+{
+       int err;
+
+       if (!is_hpet_capable())
+               return 0;
+
+       err = sysdev_class_register(&hpet_class);
+
+       if (!err) {
+               err = sysdev_register(&hpet_device);
+               if (err)
+                       sysdev_class_unregister(&hpet_class);
+       }
+
+       return err;
+}
+
+device_initcall(hpet_register_sysfs);
+
+#endif
index 5cbb776..10cef5c 100644 (file)
@@ -47,9 +47,17 @@ static void init_pit_timer(enum clock_event_mode mode,
                outb(LATCH >> 8 , PIT_CH0);     /* MSB */
                break;
 
-       case CLOCK_EVT_MODE_ONESHOT:
+       /*
+        * Avoid unnecessary state transitions, as it confuses
+        * Geode / Cyrix based boxen.
+        */
        case CLOCK_EVT_MODE_SHUTDOWN:
+               if (evt->mode == CLOCK_EVT_MODE_UNUSED)
+                       break;
        case CLOCK_EVT_MODE_UNUSED:
+               if (evt->mode == CLOCK_EVT_MODE_SHUTDOWN)
+                       break;
+       case CLOCK_EVT_MODE_ONESHOT:
                /* One shot setup */
                outb_p(0x38, PIT_MODE);
                udelay(10);
index e4408ff..b3ab8ff 100644 (file)
@@ -736,7 +736,7 @@ failed:
        return 0;
 }
 
-int __init irqbalance_disable(char *str)
+int __devinit irqbalance_disable(char *str)
 {
        irqbalance_disabled = 1;
        return 1;
index b8f1663..cbe7ec8 100644 (file)
@@ -567,6 +567,53 @@ static int cpu_request_microcode(int cpu)
        return error;
 }
 
+static int apply_microcode_on_cpu(int cpu)
+{
+       struct cpuinfo_x86 *c = cpu_data + cpu;
+       struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+       cpumask_t old;
+       unsigned int val[2];
+       int err = 0;
+
+       if (!uci->mc)
+               return -EINVAL;
+
+       old = current->cpus_allowed;
+       set_cpus_allowed(current, cpumask_of_cpu(cpu));
+
+       /* Check if the microcode we have in memory matches the CPU */
+       if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
+           cpu_has(c, X86_FEATURE_IA64) || uci->sig != cpuid_eax(0x00000001))
+               err = -EINVAL;
+
+       if (!err && ((c->x86_model >= 5) || (c->x86 > 6))) {
+               /* get processor flags from MSR 0x17 */
+               rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
+               if (uci->pf != (1 << ((val[1] >> 18) & 7)))
+                       err = -EINVAL;
+       }
+
+       if (!err) {
+               wrmsr(MSR_IA32_UCODE_REV, 0, 0);
+               /* see notes above for revision 1.07.  Apparent chip bug */
+               sync_core();
+               /* get the current revision from MSR 0x8B */
+               rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
+               if (uci->rev != val[1])
+                       err = -EINVAL;
+       }
+
+       if (!err)
+               apply_microcode(cpu);
+       else
+               printk(KERN_ERR "microcode: Could not apply microcode to CPU%d:"
+                       " sig=0x%x, pf=0x%x, rev=0x%x\n",
+                       cpu, uci->sig, uci->pf, uci->rev);
+
+       set_cpus_allowed(current, old);
+       return err;
+}
+
 static void microcode_init_cpu(int cpu)
 {
        cpumask_t old;
@@ -577,7 +624,8 @@ static void microcode_init_cpu(int cpu)
        set_cpus_allowed(current, cpumask_of_cpu(cpu));
        mutex_lock(&microcode_mutex);
        collect_cpu_info(cpu);
-       if (uci->valid && system_state == SYSTEM_RUNNING)
+       if (uci->valid && system_state == SYSTEM_RUNNING &&
+           !suspend_cpu_hotplug)
                cpu_request_microcode(cpu);
        mutex_unlock(&microcode_mutex);
        set_cpus_allowed(current, old);
@@ -663,13 +711,24 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
                return 0;
 
        pr_debug("Microcode:CPU %d added\n", cpu);
-       memset(uci, 0, sizeof(*uci));
+       /* If suspend_cpu_hotplug is set, the system is resuming and we should
+        * use the data from before the suspend.
+        */
+       if (suspend_cpu_hotplug) {
+               err = apply_microcode_on_cpu(cpu);
+               if (err)
+                       microcode_fini_cpu(cpu);
+       }
+       if (!uci->valid)
+               memset(uci, 0, sizeof(*uci));
 
        err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group);
        if (err)
                return err;
 
-       microcode_init_cpu(cpu);
+       if (!uci->valid)
+               microcode_init_cpu(cpu);
+
        return 0;
 }
 
@@ -680,7 +739,11 @@ static int mc_sysdev_remove(struct sys_device *sys_dev)
        if (!cpu_online(cpu))
                return 0;
        pr_debug("Microcode:CPU %d removed\n", cpu);
-       microcode_fini_cpu(cpu);
+       /* If suspend_cpu_hotplug is set, the system is suspending and we should
+        * keep the microcode in memory for the resume.
+        */
+       if (!suspend_cpu_hotplug)
+               microcode_fini_cpu(cpu);
        sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
        return 0;
 }
index 1470242..a98ba88 100644 (file)
@@ -122,64 +122,129 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
 /* checks for a bit availability (hack for oprofile) */
 int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
 {
+       int cpu;
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
-
-       return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner)));
+       for_each_possible_cpu (cpu) {
+               if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
+                       return 0;
+       }
+       return 1;
 }
 
 /* checks the an msr for availability */
 int avail_to_resrv_perfctr_nmi(unsigned int msr)
 {
        unsigned int counter;
+       int cpu;
 
        counter = nmi_perfctr_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner)));
+       for_each_possible_cpu (cpu) {
+               if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
+                       return 0;
+       }
+       return 1;
 }
 
-int reserve_perfctr_nmi(unsigned int msr)
+static int __reserve_perfctr_nmi(int cpu, unsigned int msr)
 {
        unsigned int counter;
+       if (cpu < 0)
+               cpu = smp_processor_id();
 
        counter = nmi_perfctr_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner)))
+       if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
                return 1;
        return 0;
 }
 
-void release_perfctr_nmi(unsigned int msr)
+static void __release_perfctr_nmi(int cpu, unsigned int msr)
 {
        unsigned int counter;
+       if (cpu < 0)
+               cpu = smp_processor_id();
 
        counter = nmi_perfctr_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner));
+       clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu));
 }
 
-int reserve_evntsel_nmi(unsigned int msr)
+int reserve_perfctr_nmi(unsigned int msr)
+{
+       int cpu, i;
+       for_each_possible_cpu (cpu) {
+               if (!__reserve_perfctr_nmi(cpu, msr)) {
+                       for_each_possible_cpu (i) {
+                               if (i >= cpu)
+                                       break;
+                               __release_perfctr_nmi(i, msr);
+                       }
+                       return 0;
+               }
+       }
+       return 1;
+}
+
+void release_perfctr_nmi(unsigned int msr)
+{
+       int cpu;
+       for_each_possible_cpu (cpu) {
+               __release_perfctr_nmi(cpu, msr);
+       }
+}
+
+int __reserve_evntsel_nmi(int cpu, unsigned int msr)
 {
        unsigned int counter;
+       if (cpu < 0)
+               cpu = smp_processor_id();
 
        counter = nmi_evntsel_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0]))
+       if (!test_and_set_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]))
                return 1;
        return 0;
 }
 
-void release_evntsel_nmi(unsigned int msr)
+static void __release_evntsel_nmi(int cpu, unsigned int msr)
 {
        unsigned int counter;
+       if (cpu < 0)
+               cpu = smp_processor_id();
 
        counter = nmi_evntsel_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0]);
+       clear_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]);
+}
+
+int reserve_evntsel_nmi(unsigned int msr)
+{
+       int cpu, i;
+       for_each_possible_cpu (cpu) {
+               if (!__reserve_evntsel_nmi(cpu, msr)) {
+                       for_each_possible_cpu (i) {
+                               if (i >= cpu)
+                                       break;
+                               __release_evntsel_nmi(i, msr);
+                       }
+                       return 0;
+               }
+       }
+       return 1;
+}
+
+void release_evntsel_nmi(unsigned int msr)
+{
+       int cpu;
+       for_each_possible_cpu (cpu) {
+               __release_evntsel_nmi(cpu, msr);
+       }
 }
 
 static __cpuinit inline int nmi_known_cpu(void)
@@ -263,7 +328,7 @@ static int __init check_nmi_watchdog(void)
        for_each_possible_cpu(cpu)
                prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
        local_irq_enable();
-       mdelay((10*1000)/nmi_hz); // wait 10 ticks
+       mdelay((20*1000)/nmi_hz); // wait 20 ticks
 
        for_each_possible_cpu(cpu) {
 #ifdef CONFIG_SMP
@@ -507,10 +572,10 @@ static int setup_k7_watchdog(void)
 
        perfctr_msr = MSR_K7_PERFCTR0;
        evntsel_msr = MSR_K7_EVNTSEL0;
-       if (!reserve_perfctr_nmi(perfctr_msr))
+       if (!__reserve_perfctr_nmi(-1, perfctr_msr))
                goto fail;
 
-       if (!reserve_evntsel_nmi(evntsel_msr))
+       if (!__reserve_evntsel_nmi(-1, evntsel_msr))
                goto fail1;
 
        wrmsrl(perfctr_msr, 0UL);
@@ -533,7 +598,7 @@ static int setup_k7_watchdog(void)
        wd->check_bit = 1ULL<<63;
        return 1;
 fail1:
-       release_perfctr_nmi(perfctr_msr);
+       __release_perfctr_nmi(-1, perfctr_msr);
 fail:
        return 0;
 }
@@ -544,8 +609,8 @@ static void stop_k7_watchdog(void)
 
        wrmsr(wd->evntsel_msr, 0, 0);
 
-       release_evntsel_nmi(wd->evntsel_msr);
-       release_perfctr_nmi(wd->perfctr_msr);
+       __release_evntsel_nmi(-1, wd->evntsel_msr);
+       __release_perfctr_nmi(-1, wd->perfctr_msr);
 }
 
 #define P6_EVNTSEL0_ENABLE     (1 << 22)
@@ -563,10 +628,10 @@ static int setup_p6_watchdog(void)
 
        perfctr_msr = MSR_P6_PERFCTR0;
        evntsel_msr = MSR_P6_EVNTSEL0;
-       if (!reserve_perfctr_nmi(perfctr_msr))
+       if (!__reserve_perfctr_nmi(-1, perfctr_msr))
                goto fail;
 
-       if (!reserve_evntsel_nmi(evntsel_msr))
+       if (!__reserve_evntsel_nmi(-1, evntsel_msr))
                goto fail1;
 
        wrmsrl(perfctr_msr, 0UL);
@@ -590,7 +655,7 @@ static int setup_p6_watchdog(void)
        wd->check_bit = 1ULL<<39;
        return 1;
 fail1:
-       release_perfctr_nmi(perfctr_msr);
+       __release_perfctr_nmi(-1, perfctr_msr);
 fail:
        return 0;
 }
@@ -601,8 +666,8 @@ static void stop_p6_watchdog(void)
 
        wrmsr(wd->evntsel_msr, 0, 0);
 
-       release_evntsel_nmi(wd->evntsel_msr);
-       release_perfctr_nmi(wd->perfctr_msr);
+       __release_evntsel_nmi(-1, wd->evntsel_msr);
+       __release_perfctr_nmi(-1, wd->perfctr_msr);
 }
 
 /* Note that these events don't tick when the CPU idles. This means
@@ -668,10 +733,10 @@ static int setup_p4_watchdog(void)
                cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4);
        }
 
-       if (!reserve_perfctr_nmi(perfctr_msr))
+       if (!__reserve_perfctr_nmi(-1, perfctr_msr))
                goto fail;
 
-       if (!reserve_evntsel_nmi(evntsel_msr))
+       if (!__reserve_evntsel_nmi(-1, evntsel_msr))
                goto fail1;
 
        evntsel = P4_ESCR_EVENT_SELECT(0x3F)
@@ -695,7 +760,7 @@ static int setup_p4_watchdog(void)
        wd->check_bit = 1ULL<<39;
        return 1;
 fail1:
-       release_perfctr_nmi(perfctr_msr);
+       __release_perfctr_nmi(-1, perfctr_msr);
 fail:
        return 0;
 }
@@ -707,8 +772,8 @@ static void stop_p4_watchdog(void)
        wrmsr(wd->cccr_msr, 0, 0);
        wrmsr(wd->evntsel_msr, 0, 0);
 
-       release_evntsel_nmi(wd->evntsel_msr);
-       release_perfctr_nmi(wd->perfctr_msr);
+       __release_evntsel_nmi(-1, wd->evntsel_msr);
+       __release_perfctr_nmi(-1, wd->perfctr_msr);
 }
 
 #define ARCH_PERFMON_NMI_EVENT_SEL     ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL
@@ -736,10 +801,10 @@ static int setup_intel_arch_watchdog(void)
        perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
        evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
 
-       if (!reserve_perfctr_nmi(perfctr_msr))
+       if (!__reserve_perfctr_nmi(-1, perfctr_msr))
                goto fail;
 
-       if (!reserve_evntsel_nmi(evntsel_msr))
+       if (!__reserve_evntsel_nmi(-1, evntsel_msr))
                goto fail1;
 
        wrmsrl(perfctr_msr, 0UL);
@@ -764,7 +829,7 @@ static int setup_intel_arch_watchdog(void)
        wd->check_bit = 1ULL << (eax.split.bit_width - 1);
        return 1;
 fail1:
-       release_perfctr_nmi(perfctr_msr);
+       __release_perfctr_nmi(-1, perfctr_msr);
 fail:
        return 0;
 }
@@ -787,8 +852,8 @@ static void stop_intel_arch_watchdog(void)
                return;
 
        wrmsr(wd->evntsel_msr, 0, 0);
-       release_evntsel_nmi(wd->evntsel_msr);
-       release_perfctr_nmi(wd->perfctr_msr);
+       __release_evntsel_nmi(-1, wd->evntsel_msr);
+       __release_perfctr_nmi(-1, wd->perfctr_msr);
 }
 
 void setup_apic_nmi_watchdog (void *unused)
index 0e65f7a..6cb8f53 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "mach_timer.h"
 
+static int tsc_enabled;
+
 /*
  * On some systems the TSC frequency does not
  * change with the cpu frequency. So we need
@@ -105,7 +107,7 @@ unsigned long long sched_clock(void)
        /*
         * Fall back to jiffies if there's no TSC available:
         */
-       if (tsc_unstable || unlikely(tsc_disable))
+       if (unlikely(!tsc_enabled))
                /* No locking but a rare wrong value is not a big deal: */
                return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
 
@@ -283,6 +285,7 @@ void mark_tsc_unstable(void)
 {
        if (!tsc_unstable) {
                tsc_unstable = 1;
+               tsc_enabled = 0;
                /* Can be called before registration */
                if (clocksource_tsc.mult)
                        clocksource_change_rating(&clocksource_tsc, 0);
@@ -383,7 +386,9 @@ void __init tsc_init(void)
        if (check_tsc_unstable()) {
                clocksource_tsc.rating = 0;
                clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
-       }
+       } else
+               tsc_enabled = 1;
+
        clocksource_register(&clocksource_tsc);
 
        return;
index fb07a1a..edc339f 100644 (file)
@@ -69,6 +69,7 @@ struct {
        void (*flush_tlb)(int);
        void (*set_initial_ap_state)(int, int);
        void (*halt)(void);
+       void (*set_lazy_mode)(int mode);
 } vmi_ops;
 
 /* XXX move this to alternative.h */
@@ -574,6 +575,26 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
 }
 #endif
 
+static void vmi_set_lazy_mode(int mode)
+{
+       static DEFINE_PER_CPU(int, lazy_mode);
+
+       if (!vmi_ops.set_lazy_mode)
+               return;
+
+       /* Modes should never nest or overlap */
+       BUG_ON(__get_cpu_var(lazy_mode) && !(mode == PARAVIRT_LAZY_NONE ||
+                                            mode == PARAVIRT_LAZY_FLUSH));
+
+       if (mode == PARAVIRT_LAZY_FLUSH) {
+               vmi_ops.set_lazy_mode(0);
+               vmi_ops.set_lazy_mode(__get_cpu_var(lazy_mode));
+       } else {
+               vmi_ops.set_lazy_mode(mode);
+               __get_cpu_var(lazy_mode) = mode;
+       }
+}
+
 static inline int __init check_vmi_rom(struct vrom_header *rom)
 {
        struct pci_header *pci;
@@ -804,7 +825,7 @@ static inline int __init activate_vmi(void)
        para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack);
        para_fill(set_iopl_mask, SetIOPLMask);
        para_fill(io_delay, IODelay);
-       para_fill(set_lazy_mode, SetLazyMode);
+       para_wrap(set_lazy_mode, vmi_set_lazy_mode, set_lazy_mode, SetLazyMode);
 
        /* user and kernel flush are just handled with different flags to FlushTLB */
        para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB);
index d22cfc9..086b372 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/blkdev.h>
 #include <linux/module.h>
 #include <linux/backing-dev.h>
+#include <linux/interrupt.h>
 #include <asm/uaccess.h>
 #include <asm/mmx.h>
 
@@ -719,6 +720,14 @@ unsigned long __copy_to_user_ll(void __user *to, const void *from,
 #ifndef CONFIG_X86_WP_WORKS_OK
        if (unlikely(boot_cpu_data.wp_works_ok == 0) &&
                        ((unsigned long )to) < TASK_SIZE) {
+               /*
+                * When we are in an atomic section (see
+                * mm/filemap.c:file_read_actor), return the full
+                * length to take the slow path.
+                */
+               if (in_atomic())
+                       return n;
+
                /* 
                 * CPU does not honor the WP bit when writing
                 * from supervisory mode, and due to preemption or SMP,
index bb2de10..ac70d09 100644 (file)
@@ -42,6 +42,7 @@ void *kmap_atomic(struct page *page, enum km_type type)
 
        vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
        set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
+       arch_flush_lazy_mmu_mode();
 
        return (void*) vaddr;
 }
@@ -82,6 +83,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
        idx = type + KM_TYPE_NR*smp_processor_id();
        vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
        set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
+       arch_flush_lazy_mmu_mode();
 
        return (void*) vaddr;
 }
index 1bb0693..3f78d4d 100644 (file)
@@ -191,6 +191,14 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2950"),
                },
        },
+       {
+               .callback = set_bf_sort,
+               .ident = "Dell PowerEdge R900",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R900"),
+               },
+       },
        {
                .callback = set_bf_sort,
                .ident = "HP ProLiant BL20p G3",
@@ -426,11 +434,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
        if ((err = pcibios_enable_resources(dev, mask)) < 0)
                return err;
 
-       return pcibios_enable_irq(dev);
+       if (!dev->msi_enabled)
+               return pcibios_enable_irq(dev);
+       return 0;
 }
 
 void pcibios_disable_device (struct pci_dev *dev)
 {
-       if (pcibios_disable_irq)
+       if (!dev->msi_enabled && pcibios_disable_irq)
                pcibios_disable_irq(dev);
 }
index d51f0f1..e19185d 100644 (file)
@@ -13,6 +13,7 @@ config IA64
        bool
        select PCI if (!IA64_HP_SIM)
        select ACPI if (!IA64_HP_SIM)
+       select PM if (!IA64_HP_SIM)
        default y
        help
          The Itanium Processor Family is Intel's 64-bit successor to
index e722090..ebbeadf 100644 (file)
@@ -68,7 +68,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
        struct msi_msg  msg;
        unsigned long   dest_phys_id;
-       unsigned int    irq, vector;
+       int     irq, vector;
 
        irq = create_irq();
        if (irq < 0)
index b21ddec..ff7df43 100644 (file)
@@ -375,6 +375,7 @@ static void __devinit
 smp_callin (void)
 {
        int cpuid, phys_id, itc_master;
+       struct cpuinfo_ia64 *last_cpuinfo, *this_cpuinfo;
        extern void ia64_init_itm(void);
        extern volatile int time_keeper_id;
 
@@ -424,7 +425,21 @@ smp_callin (void)
         * Get our bogomips.
         */
        ia64_init_itm();
-       calibrate_delay();
+
+       /*
+        * Delay calibration can be skipped if new processor is identical to the
+        * previous processor.
+        */
+       last_cpuinfo = cpu_data(cpuid - 1);
+       this_cpuinfo = local_cpu_data;
+       if (last_cpuinfo->itc_freq != this_cpuinfo->itc_freq ||
+           last_cpuinfo->proc_freq != this_cpuinfo->proc_freq ||
+           last_cpuinfo->features != this_cpuinfo->features ||
+           last_cpuinfo->revision != this_cpuinfo->revision ||
+           last_cpuinfo->family != this_cpuinfo->family ||
+           last_cpuinfo->archrev != this_cpuinfo->archrev ||
+           last_cpuinfo->model != this_cpuinfo->model)
+               calibrate_delay();
        local_cpu_data->loops_per_jiffy = loops_per_jiffy;
 
 #ifdef CONFIG_IA32_SUPPORT
index c8da621..4f36987 100644 (file)
@@ -155,7 +155,7 @@ ia64_set_rbs_bot (void)
 
        if (stack_size > MAX_USER_STACK_SIZE)
                stack_size = MAX_USER_STACK_SIZE;
-       current->thread.rbs_bot = STACK_TOP - stack_size;
+       current->thread.rbs_bot = PAGE_ALIGN(current->mm->start_stack - stack_size);
 }
 
 /*
index 474d179..0e83f3b 100644 (file)
@@ -557,14 +557,17 @@ pcibios_enable_device (struct pci_dev *dev, int mask)
        if (ret < 0)
                return ret;
 
-       return acpi_pci_irq_enable(dev);
+       if (!dev->msi_enabled)
+               return acpi_pci_irq_enable(dev);
+       return 0;
 }
 
 void
 pcibios_disable_device (struct pci_dev *dev)
 {
        BUG_ON(atomic_read(&dev->enable_cnt));
-       acpi_pci_irq_disable(dev);
+       if (!dev->msi_enabled)
+               acpi_pci_irq_disable(dev);
 }
 
 void
index 656f0ca..c78b143 100644 (file)
@@ -1606,7 +1606,7 @@ config MIPS_MT_FPAFF
 
 config MIPS_MT_SMTC_INSTANT_REPLAY
        bool "Low-latency Dispatch of Deferred SMTC IPIs"
-       depends on MIPS_MT_SMTC
+       depends on MIPS_MT_SMTC && !PREEMPT
        default y
        help
          SMTC pseudo-interrupts between TCs are deferred and queued
index 78f393b..c71c852 100644 (file)
@@ -32,7 +32,6 @@ void __init prom_init(void)
        char **arg = (char **) fw_arg1;
        char **env = (char **) fw_arg2;
        struct callvectors *cv = (struct callvectors *) fw_arg3;
-       uint32_t tmp;
        int i;
 
        /* save the PROM vectors for debugging use */
index 94f94eb..98b6fb3 100644 (file)
@@ -79,7 +79,7 @@ static char reset_reason;
 static void __init setup_l3cache(unsigned long size);
 
 /* setup code for a handoff from a version 1 PMON 2000 PROM */
-void PMON_v1_setup()
+static void PMON_v1_setup(void)
 {
        /* A wired TLB entry for the GT64120A and the serial port. The
           GT64120A is going to be hit on every IRQ anyway - there's
index 46e421e..e8e0ffb 100644 (file)
@@ -67,7 +67,8 @@ void __init vdma_init(void)
         * aligned and should be uncached to avoid cache flushing after every
         * update.
         */
-       vdma_pagetable_start = alloc_bootmem_low_pages(VDMA_PGTBL_SIZE);
+       vdma_pagetable_start =
+               (unsigned long) alloc_bootmem_low_pages(VDMA_PGTBL_SIZE);
        if (!vdma_pagetable_start)
                BUG();
        dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE);
index 0b78fcb..686249c 100644 (file)
@@ -121,7 +121,11 @@ FEXPORT(restore_partial)           # restore partial frame
        SAVE_AT
        SAVE_TEMP
        LONG_L  v0, PT_STATUS(sp)
-       and     v0, 1
+#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
+       and     v0, ST0_IEP
+#else
+       and     v0, ST0_IE
+#endif
        beqz    v0, 1f
        jal     trace_hardirqs_on
        b       2f
index 83843a2..297bd56 100644 (file)
@@ -128,6 +128,37 @@ handle_vcei:
 
        .align  5
 NESTED(handle_int, PT_SIZE, sp)
+#ifdef CONFIG_TRACE_IRQFLAGS
+       /*
+        * Check to see if the interrupted code has just disabled
+        * interrupts and ignore this interrupt for now if so.
+        *
+        * local_irq_disable() disables interrupts and then calls
+        * trace_hardirqs_off() to track the state. If an interrupt is taken
+        * after interrupts are disabled but before the state is updated
+        * it will appear to restore_all that it is incorrectly returning with
+        * interrupts disabled
+        */
+       .set    push
+       .set    noat
+       mfc0    k0, CP0_STATUS
+#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
+       and     k0, ST0_IEP
+       bnez    k0, 1f
+
+       mfc0    k0, EP0_EPC
+       .set    noreorder
+       j       k0
+       rfe
+#else
+       and     k0, ST0_IE
+       bnez    k0, 1f
+
+       eret
+#endif
+1:
+       .set pop
+#endif
        SAVE_ALL
        CLI
        TRACE_IRQS_OFF
index f253eda..5dcfab6 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/sched.h>
 #include <linux/cpumask.h>
 #include <linux/interrupt.h>
+#include <linux/kernel_stat.h>
 #include <linux/module.h>
 
 #include <asm/cpu.h>
@@ -14,6 +15,7 @@
 #include <asm/hazards.h>
 #include <asm/mmu_context.h>
 #include <asm/smp.h>
+#include <asm/mips-boards/maltaint.h>
 #include <asm/mipsregs.h>
 #include <asm/cacheflush.h>
 #include <asm/time.h>
@@ -75,7 +77,7 @@ static struct smtc_ipi_q freeIPIq;
 
 void ipi_decode(struct smtc_ipi *);
 static void post_direct_ipi(int cpu, struct smtc_ipi *pipi);
-static void setup_cross_vpe_interrupts(void);
+static void setup_cross_vpe_interrupts(unsigned int nvpe);
 void init_smtc_stats(void);
 
 /* Global SMTC Status */
@@ -168,7 +170,10 @@ __setup("tintq=", tintq);
 
 int imstuckcount[2][8];
 /* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */
-int vpemask[2][8] = {{0,1,1,0,0,0,0,1},{0,1,0,0,0,0,0,1}};
+int vpemask[2][8] = {
+       {0, 0, 1, 0, 0, 0, 0, 1},
+       {0, 0, 0, 0, 0, 0, 0, 1}
+};
 int tcnoprog[NR_CPUS];
 static atomic_t idle_hook_initialized = {0};
 static int clock_hang_reported[NR_CPUS];
@@ -501,8 +506,7 @@ void mipsmt_prepare_cpus(void)
 
        /* If we have multiple VPEs running, set up the cross-VPE interrupt */
 
-       if (nvpe > 1)
-               setup_cross_vpe_interrupts();
+       setup_cross_vpe_interrupts(nvpe);
 
        /* Set up queue of free IPI "messages". */
        nipi = NR_CPUS * IPIBUF_PER_CPU;
@@ -607,7 +611,12 @@ void smtc_cpus_done(void)
 int setup_irq_smtc(unsigned int irq, struct irqaction * new,
                        unsigned long hwmask)
 {
+       unsigned int vpe = current_cpu_data.vpe_id;
+
        irq_hwmask[irq] = hwmask;
+#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
+       vpemask[vpe][irq - MIPSCPU_INT_BASE] = 1;
+#endif
 
        return setup_irq(irq, new);
 }
@@ -812,12 +821,15 @@ void ipi_decode(struct smtc_ipi *pipi)
        smtc_ipi_nq(&freeIPIq, pipi);
        switch (type_copy) {
        case SMTC_CLOCK_TICK:
+               irq_enter();
+               kstat_this_cpu.irqs[MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR]++;
                /* Invoke Clock "Interrupt" */
                ipi_timer_latch[dest_copy] = 0;
 #ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
                clock_hang_reported[dest_copy] = 0;
 #endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */
                local_timer_interrupt(0, NULL);
+               irq_exit();
                break;
        case LINUX_SMP_IPI:
                switch ((int)arg_copy) {
@@ -965,8 +977,11 @@ static void ipi_irq_dispatch(void)
 
 static struct irqaction irq_ipi;
 
-static void setup_cross_vpe_interrupts(void)
+static void setup_cross_vpe_interrupts(unsigned int nvpe)
 {
+       if (nvpe < 1)
+               return;
+
        if (!cpu_has_vint)
                panic("SMTC Kernel requires Vectored Interupt support");
 
@@ -984,10 +999,17 @@ static void setup_cross_vpe_interrupts(void)
 
 /*
  * SMTC-specific hacks invoked from elsewhere in the kernel.
+ *
+ * smtc_ipi_replay is called from raw_local_irq_restore which is only ever
+ * called with interrupts disabled.  We do rely on interrupts being disabled
+ * here because using spin_lock_irqsave()/spin_unlock_irqrestore() would
+ * result in a recursive call to raw_local_irq_restore().
  */
 
-void smtc_ipi_replay(void)
+static void __smtc_ipi_replay(void)
 {
+       unsigned int cpu = smp_processor_id();
+
        /*
         * To the extent that we've ever turned interrupts off,
         * we may have accumulated deferred IPIs.  This is subtle.
@@ -1002,17 +1024,30 @@ void smtc_ipi_replay(void)
         * is clear, and we'll handle it as a real pseudo-interrupt
         * and not a pseudo-pseudo interrupt.
         */
-       if (IPIQ[smp_processor_id()].depth > 0) {
-               struct smtc_ipi *pipi;
-               extern void self_ipi(struct smtc_ipi *);
+       if (IPIQ[cpu].depth > 0) {
+               while (1) {
+                       struct smtc_ipi_q *q = &IPIQ[cpu];
+                       struct smtc_ipi *pipi;
+                       extern void self_ipi(struct smtc_ipi *);
+
+                       spin_lock(&q->lock);
+                       pipi = __smtc_ipi_dq(q);
+                       spin_unlock(&q->lock);
+                       if (!pipi)
+                               break;
 
-               while ((pipi = smtc_ipi_dq(&IPIQ[smp_processor_id()]))) {
                        self_ipi(pipi);
-                       smtc_cpu_stats[smp_processor_id()].selfipis++;
+                       smtc_cpu_stats[cpu].selfipis++;
                }
        }
 }
 
+void smtc_ipi_replay(void)
+{
+       raw_local_irq_disable();
+       __smtc_ipi_replay();
+}
+
 EXPORT_SYMBOL(smtc_ipi_replay);
 
 void smtc_idle_loop_hook(void)
@@ -1117,7 +1152,13 @@ void smtc_idle_loop_hook(void)
         * is in use, there should never be any.
         */
 #ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
-       smtc_ipi_replay();
+       {
+               unsigned long flags;
+
+               local_irq_save(flags);
+               __smtc_ipi_replay();
+               local_irq_restore(flags);
+       }
 #endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
 }
 
index d1af42c..59868a1 100644 (file)
@@ -260,7 +260,7 @@ static void r3k_flush_cache_page(struct vm_area_struct *vma, unsigned long page,
 {
 }
 
-static void local_r3k_flush_data_cache_page(unsigned long addr)
+static void local_r3k_flush_data_cache_page(void *addr)
 {
 }
 
index 31819c5..4e8f1b6 100644 (file)
@@ -3,7 +3,8 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 1994 - 2003 by Ralf Baechle
+ * Copyright (C) 1994 - 2003, 07 by Ralf Baechle (ralf@linux-mips.org)
+ * Copyright (C) 2007 MIPS Technologies, Inc.
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -88,6 +89,19 @@ void __flush_dcache_page(struct page *page)
 
 EXPORT_SYMBOL(__flush_dcache_page);
 
+void __flush_anon_page(struct page *page, unsigned long vmaddr)
+{
+       if (pages_do_alias((unsigned long)page_address(page), vmaddr)) {
+               void *kaddr;
+
+               kaddr = kmap_coherent(page, vmaddr);
+               flush_data_cache_page((unsigned long)kaddr);
+               kunmap_coherent(kaddr);
+       }
+}
+
+EXPORT_SYMBOL(__flush_anon_page);
+
 void __update_cache(struct vm_area_struct *vma, unsigned long address,
        pte_t pte)
 {
index 11a9166..4c72e65 100644 (file)
@@ -177,8 +177,8 @@ extern void check_bus_watcher(void);
 
 asmlinkage void sb1_cache_error(void)
 {
-       uint64_t cerr_dpa;
        uint32_t errctl, cerr_i, cerr_d, dpalo, dpahi, eepc, res;
+       unsigned long long cerr_dpa;
 
 #ifdef CONFIG_SIBYTE_BW_TRACE
        /* Freeze the trace buffer now */
@@ -329,8 +329,9 @@ static uint32_t extract_ic(unsigned short addr, int data)
 {
        unsigned short way;
        int valid;
-       uint64_t taglo, va, tlo_tmp;
        uint32_t taghi, taglolo, taglohi;
+       unsigned long long taglo, va;
+       uint64_t tlo_tmp;
        uint8_t lru;
        int res = 0;
 
@@ -484,8 +485,8 @@ static uint32_t extract_dc(unsigned short addr, int data)
 {
        int valid, way;
        unsigned char state;
-       uint64_t taglo, pa;
        uint32_t taghi, taglolo, taglohi;
+       unsigned long long taglo, pa;
        uint8_t ecc, lru;
        int res = 0;
 
@@ -535,8 +536,8 @@ static uint32_t extract_dc(unsigned short addr, int data)
                }
 
                if (data) {
-                       uint64_t datalo;
                        uint32_t datalohi, datalolo, datahi;
+                       unsigned long long datalo;
                        int offset;
                        char bad_ecc = 0;
 
index f503d02..f0eb299 100644 (file)
 
 #include <dma-coherence.h>
 
+static inline unsigned long dma_addr_to_virt(dma_addr_t dma_addr)
+{
+       unsigned long addr = plat_dma_addr_to_phys(dma_addr);
+
+       return (unsigned long)phys_to_virt(addr);
+}
+
 /*
  * Warning on the terminology - Linux calls an uncached area coherent;
  * MIPS terminology calls memory areas with hardware maintained coherency
@@ -140,7 +147,7 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
        enum dma_data_direction direction)
 {
        if (cpu_is_noncoherent_r10000(dev))
-               __dma_sync(plat_dma_addr_to_phys(dma_addr) + PAGE_OFFSET, size,
+               __dma_sync(dma_addr_to_virt(dma_addr), size,
                           direction);
 
        plat_unmap_dma_mem(dma_addr);
@@ -234,7 +241,7 @@ void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
        if (cpu_is_noncoherent_r10000(dev)) {
                unsigned long addr;
 
-               addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle);
+               addr = dma_addr_to_virt(dma_handle);
                __dma_sync(addr, size, direction);
        }
 }
@@ -249,7 +256,7 @@ void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
        if (!plat_device_is_coherent(dev)) {
                unsigned long addr;
 
-               addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle);
+               addr = dma_addr_to_virt(dma_handle);
                __dma_sync(addr, size, direction);
        }
 }
@@ -264,7 +271,7 @@ void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
        if (cpu_is_noncoherent_r10000(dev)) {
                unsigned long addr;
 
-               addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle);
+               addr = dma_addr_to_virt(dma_handle);
                __dma_sync(addr + offset, size, direction);
        }
 }
@@ -279,7 +286,7 @@ void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
        if (!plat_device_is_coherent(dev)) {
                unsigned long addr;
 
-               addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle);
+               addr = dma_addr_to_virt(dma_handle);
                __dma_sync(addr + offset, size, direction);
        }
 }
index 6f90e7e..f9c595d 100644 (file)
@@ -42,7 +42,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
        siginfo_t info;
 
 #if 0
-       printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", smp_processor_id(),
+       printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", raw_smp_processor_id(),
               current->comm, current->pid, field, address, write,
               field, regs->cp0_epc);
 #endif
@@ -165,7 +165,7 @@ no_context:
 
        printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at "
               "virtual address %0*lx, epc == %0*lx, ra == %0*lx\n",
-              smp_processor_id(), field, address, field, regs->cp0_epc,
+              raw_smp_processor_id(), field, address, field, regs->cp0_epc,
               field,  regs->regs[31]);
        die("Oops", regs);
 
@@ -228,7 +228,7 @@ vmalloc_fault:
                pmd_t *pmd, *pmd_k;
                pte_t *pte_k;
 
-               pgd = (pgd_t *) pgd_current[smp_processor_id()] + offset;
+               pgd = (pgd_t *) pgd_current[raw_smp_processor_id()] + offset;
                pgd_k = init_mm.pgd + offset;
 
                if (!pgd_present(*pgd_k))
index f08ae71..e9951c0 100644 (file)
@@ -123,7 +123,7 @@ static void __init kmap_coherent_init(void)
 static inline void kmap_coherent_init(void) {}
 #endif
 
-static inline void *kmap_coherent(struct page *page, unsigned long addr)
+void *kmap_coherent(struct page *page, unsigned long addr)
 {
        enum fixed_addresses idx;
        unsigned long vaddr, flags, entrylo;
@@ -177,7 +177,7 @@ static inline void *kmap_coherent(struct page *page, unsigned long addr)
 
 #define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
 
-static inline void kunmap_coherent(struct page *page)
+void kunmap_coherent(struct page *page)
 {
 #ifndef CONFIG_MIPS_MT_SMTC
        unsigned int wired;
@@ -377,7 +377,7 @@ void __init paging_init(void)
 #ifdef CONFIG_FLATMEM
        free_area_init(zones_size);
 #else
-       pfn = 0;
+       pfn = min_low_pfn;
        for (i = 0; i < MAX_NR_ZONES; i++)
                for (j = 0; j < zones_size[i]; j++, pfn++)
                        if (!page_is_ram(pfn))
index fc3c787..adb37d0 100644 (file)
@@ -218,8 +218,7 @@ void sb1_dma_init(void)
        for (i = 0; i < DM_NUM_CHANNELS; i++) {
                const u64 base_val = CPHYSADDR(&page_descr[i]) |
                                     V_DM_DSCR_BASE_RINGSZ(1);
-               volatile void *base_reg =
-                       IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE));
+               void *base_reg = IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE));
 
                __raw_writeq(base_val, base_reg);
                __raw_writeq(base_val | M_DM_DSCR_BASE_RESET, base_reg);
index f6774f5..d7b9e13 100644 (file)
@@ -216,7 +216,7 @@ static int __init bcm1480_pcibios_init(void)
        /*
         * See if the PCI bus has been configured by the firmware.
         */
-       reg = *((volatile uint64_t *) IOADDR(A_SCD_SYSTEM_CFG));
+       reg = __raw_readq(IOADDR(A_SCD_SYSTEM_CFG));
        if (!(reg & M_BCM1480_SYS_PCI_HOST)) {
                bcm1480_bus_status |= PCI_DEVICE_MODE;
        } else {
index 9cd859e..a84f594 100644 (file)
@@ -1,4 +1,5 @@
 #include <linux/pci.h>
+#include <asm/irq.h>
 
 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
 {
index 80f5e8c..75c1246 100644 (file)
@@ -228,7 +228,7 @@ static int __init sb1250_pcibios_init(void)
        /*
         * See if the PCI bus has been configured by the firmware.
         */
-       reg = *((volatile uint64_t *) IOADDR(A_SCD_SYSTEM_CFG));
+       reg = __raw_readq(IOADDR(A_SCD_SYSTEM_CFG));
        if (!(reg & M_SYS_PCI_HOST)) {
                sb1250_bus_status |= PCI_DEVICE_MODE;
        } else {
index 20af0f1..ba0c4b7 100644 (file)
@@ -141,11 +141,11 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
        unsigned long flags;
        unsigned int irq_dirty;
 
-       i = first_cpu(mask);
-       if (next_cpu(i, mask) <= NR_CPUS) {
+       if (cpus_weight(mask) != 1) {
                printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
                return;
        }
+       i = first_cpu(mask);
 
        /* Convert logical CPU to physical CPU */
        cpu = cpu_logical_map(i);
index bf32827..6eac36d 100644 (file)
@@ -34,21 +34,21 @@ extern void smp_call_function_interrupt(void);
  * independent of board/firmware
  */
 
-static volatile void *mailbox_0_set_regs[] = {
+static void *mailbox_0_set_regs[] = {
        IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
        IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
        IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
        IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
 };
 
-static volatile void *mailbox_0_clear_regs[] = {
+static void *mailbox_0_clear_regs[] = {
        IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
        IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
        IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
        IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
 };
 
-static volatile void *mailbox_0_regs[] = {
+static void *mailbox_0_regs[] = {
        IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
        IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
        IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
index defa1f1..83572d8 100644 (file)
@@ -169,17 +169,19 @@ void __init plat_mem_setup(void)
 #define LEDS_PHYS MLEDS_PHYS
 #endif
 
-#define setled(index, c) \
-  ((unsigned char *)(IOADDR(LEDS_PHYS)+0x20))[(3-(index))<<3] = (c)
 void setleds(char *str)
 {
+       void *reg;
        int i;
+
        for (i = 0; i < 4; i++) {
-               if (!str[i]) {
-                       setled(i, ' ');
-               } else {
-                       setled(i, str[i]);
-               }
+               reg = IOADDR(LEDS_PHYS) + 0x20 + ((3 - i) << 3);
+
+               if (!str[i])
+                       writeb(' ', reg);
+               else
+                       writeb(str[i], reg);
        }
 }
-#endif
+
+#endif /* LEDS_PHYS */
index f3d4dd5..e53b298 100644 (file)
@@ -465,8 +465,13 @@ void flush_thread(void)
 #ifdef CONFIG_PPC64
        struct thread_info *t = current_thread_info();
 
-       if (t->flags & _TIF_ABI_PENDING)
-               t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT);
+       if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
+               clear_ti_thread_flag(t, TIF_ABI_PENDING);
+               if (test_ti_thread_flag(t, TIF_32BIT))
+                       clear_ti_thread_flag(t, TIF_32BIT);
+               else
+                       set_ti_thread_flag(t, TIF_32BIT);
+       }
 #endif
 
        discard_lazy_cpu_state();
index 5c7e387..c1427b3 100644 (file)
@@ -30,9 +30,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_PURR);
        
 /*
  * postcall is performed immediately before function return which
- * allows liberal use of volatile registers.
+ * allows liberal use of volatile registers.  We branch around this
+ * in early init (eg when populating the MMU hashtable) by using an
+ * unconditional cpu feature.
  */
 #define HCALL_INST_POSTCALL                                    \
+BEGIN_FTR_SECTION;                                             \
+       b       1f;                                             \
+END_FTR_SECTION(0, 1);                                         \
        ld      r4,STK_PARM(r3)(r1);    /* validate opcode */   \
        cmpldi  cr7,r4,MAX_HCALL_OPCODE;                        \
        bgt-    cr7,1f;                                         \
@@ -123,6 +128,40 @@ _GLOBAL(plpar_hcall)
 
        blr                             /* return r3 = status */
 
+/*
+ * plpar_hcall_raw can be called in real mode. kexec/kdump need some
+ * hypervisor calls to be executed in real mode. So plpar_hcall_raw
+ * does not access the per cpu hypervisor call statistics variables,
+ * since these variables may not be present in the RMO region.
+ */
+_GLOBAL(plpar_hcall_raw)
+       HMT_MEDIUM
+
+       mfcr    r0
+       stw     r0,8(r1)
+
+       std     r4,STK_PARM(r4)(r1)     /* Save ret buffer */
+
+       mr      r4,r5
+       mr      r5,r6
+       mr      r6,r7
+       mr      r7,r8
+       mr      r8,r9
+       mr      r9,r10
+
+       HVSC                            /* invoke the hypervisor */
+
+       ld      r12,STK_PARM(r4)(r1)
+       std     r4,  0(r12)
+       std     r5,  8(r12)
+       std     r6, 16(r12)
+       std     r7, 24(r12)
+
+       lwz     r0,8(r1)
+       mtcrf   0xff,r0
+
+       blr                             /* return r3 = status */
+
 _GLOBAL(plpar_hcall9)
        HMT_MEDIUM
 
index 7496005..843ee96 100644 (file)
@@ -378,7 +378,7 @@ static void pSeries_lpar_hptab_clear(void)
 
        /* TODO: Use bulk call */
        for (i = 0; i < hpte_count; i++)
-               plpar_pte_remove(0, i, 0, &dummy1, &dummy2);
+               plpar_pte_remove_raw(0, i, 0, &dummy1, &dummy2);
 }
 
 /*
index 3eb7b29..2e4d10c 100644 (file)
@@ -78,6 +78,22 @@ static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
        return rc;
 }
 
+/* plpar_pte_remove_raw can be called in real mode. It calls plpar_hcall_raw */
+static inline long plpar_pte_remove_raw(unsigned long flags, unsigned long ptex,
+               unsigned long avpn, unsigned long *old_pteh_ret,
+               unsigned long *old_ptel_ret)
+{
+       long rc;
+       unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
+
+       rc = plpar_hcall_raw(H_REMOVE, retbuf, flags, ptex, avpn);
+
+       *old_pteh_ret = retbuf[0];
+       *old_ptel_ret = retbuf[1];
+
+       return rc;
+}
+
 static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
                unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
 {
index dffeeae..1fc5819 100644 (file)
@@ -129,7 +129,7 @@ void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c)
 
        if (h.token == NULL)
                return;
-       h.token -= dcr_n * h.stride;
+       h.token += dcr_n * h.stride;
        iounmap(h.token);
        h.token = NULL;
 }
index e3d71e0..43f6cc9 100644 (file)
@@ -251,13 +251,13 @@ static int qe_sdma_init(void)
 
        /* allocate 2 internal temporary buffers (512 bytes size each) for
         * the SDMA */
-       sdma_buf_offset = qe_muram_alloc(512 * 2, 64);
+       sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
        if (IS_MURAM_ERR(sdma_buf_offset))
                return -ENOMEM;
 
        out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK);
-       out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | (0x1 >>
-                                       QE_SDMR_CEN_SHIFT)));
+       out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK |
+                                       (0x1 << QE_SDMR_CEN_SHIFT)));
 
        return 0;
 }
index 8af549e..993f353 100644 (file)
@@ -167,7 +167,7 @@ static int __kprobes swap_instruction(void *aref)
         * shall not cross any page boundaries (vmalloc area!) when writing
         * the new instruction.
         */
-       addr = (u32 *)ALIGN((unsigned long)args->ptr, 4);
+       addr = (u32 *)((unsigned long)args->ptr & -4UL);
        if ((unsigned long)args->ptr & 2)
                instr = ((*addr) & 0xffff0000) | args->new;
        else
index fe1b276..6e0d10f 100644 (file)
@@ -82,9 +82,6 @@ DECLARE_EXPORT(__movstr);
 DECLARE_EXPORT(__movmem_i4_even);
 DECLARE_EXPORT(__movmem_i4_odd);
 DECLARE_EXPORT(__movmemSI12_i4);
-DECLARE_EXPORT(__sdivsi3_i4i);
-DECLARE_EXPORT(__udiv_qrnnd_16);
-DECLARE_EXPORT(__udivsi3_i4i);
 #else /* GCC 3.x */
 DECLARE_EXPORT(__movstr_i4_even);
 DECLARE_EXPORT(__movstr_i4_odd);
index 53ddcd9..559335f 100644 (file)
@@ -52,6 +52,7 @@ int atomic_cmpxchg(atomic_t *v, int old, int new)
        spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
        return ret;
 }
+EXPORT_SYMBOL(atomic_cmpxchg);
 
 int atomic_add_unless(atomic_t *v, int a, int u)
 {
@@ -65,6 +66,7 @@ int atomic_add_unless(atomic_t *v, int a, int u)
        spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
        return ret != u;
 }
+EXPORT_SYMBOL(atomic_add_unless);
 
 /* Atomic operations are already serializing */
 void atomic_set(atomic_t *v, int i)
index 7b8baf1..9fdfad6 100644 (file)
@@ -236,11 +236,11 @@ void free_irqs(void)
        struct chan *chan;
        LIST_HEAD(list);
        struct list_head *ele;
+       unsigned long flags;
 
-       spin_lock_irq(&irqs_to_free_lock);
+       spin_lock_irqsave(&irqs_to_free_lock, flags);
        list_splice_init(&irqs_to_free, &list);
-       INIT_LIST_HEAD(&irqs_to_free);
-       spin_unlock_irq(&irqs_to_free_lock);
+       spin_unlock_irqrestore(&irqs_to_free_lock, flags);
 
        list_for_each(ele, &list){
                chan = list_entry(ele, struct chan, free_list);
@@ -255,13 +255,15 @@ void free_irqs(void)
 
 static void close_one_chan(struct chan *chan, int delay_free_irq)
 {
+       unsigned long flags;
+
        if(!chan->opened)
                return;
 
        if(delay_free_irq){
-               spin_lock_irq(&irqs_to_free_lock);
+               spin_lock_irqsave(&irqs_to_free_lock, flags);
                list_add(&chan->free_list, &irqs_to_free);
-               spin_unlock_irq(&irqs_to_free_lock);
+               spin_unlock_irqrestore(&irqs_to_free_lock, flags);
        }
        else {
                if(chan->input)
index 178b2ef..65ad293 100644 (file)
@@ -615,6 +615,9 @@ void mconsole_remove(struct mc_request *req)
        err_msg = NULL;
        err = (*dev->remove)(n, &err_msg);
        switch(err){
+       case 0:
+               err_msg = "";
+               break;
        case -ENODEV:
                if(err_msg == NULL)
                        err_msg = "Device doesn't exist";
index f98d26e..8bd9204 100644 (file)
@@ -109,10 +109,6 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data)
 
 static DEFINE_MUTEX(ubd_lock);
 
-/* XXX - this made sense in 2.4 days, now it's only used as a boolean, and
- * probably it doesn't make sense even for that. */
-static int do_ubd;
-
 static int ubd_open(struct inode * inode, struct file * filp);
 static int ubd_release(struct inode * inode, struct file * file);
 static int ubd_ioctl(struct inode * inode, struct file * file,
@@ -169,6 +165,7 @@ struct ubd {
        struct platform_device pdev;
        struct request_queue *queue;
        spinlock_t lock;
+       int active;
 };
 
 #define DEFAULT_COW { \
@@ -190,6 +187,7 @@ struct ubd {
        .shared =               0, \
         .cow =                 DEFAULT_COW, \
        .lock =                 SPIN_LOCK_UNLOCKED,     \
+       .active =               0, \
 }
 
 /* Protected by ubd_lock */
@@ -507,7 +505,6 @@ static void ubd_handler(void)
        struct ubd *dev;
        int n;
 
-       do_ubd = 0;
        n = os_read_file(thread_fd, &req, sizeof(req));
        if(n != sizeof(req)){
                printk(KERN_ERR "Pid %d - spurious interrupt in ubd_handler, "
@@ -517,6 +514,7 @@ static void ubd_handler(void)
 
        rq = req.req;
        dev = rq->rq_disk->private_data;
+       dev->active = 0;
 
        ubd_finish(rq, req.error);
        reactivate_fd(thread_fd, UBD_IRQ);
@@ -1081,11 +1079,12 @@ static void do_ubd_request(request_queue_t *q)
                }
        }
        else {
-               if(do_ubd || (req = elv_next_request(q)) == NULL)
+               struct ubd *dev = q->queuedata;
+               if(dev->active || (req = elv_next_request(q)) == NULL)
                        return;
                err = prepare_request(req, &io_req);
                if(!err){
-                       do_ubd = 1;
+                       dev->active = 1;
                        n = os_write_file(thread_fd, (char *) &io_req,
                                         sizeof(io_req));
                        if(n != sizeof(io_req))
index 2666815..b282839 100644 (file)
@@ -12,6 +12,8 @@
 #define u32 uint32_t
 #endif
 
+#include "sysdep/ptrace.h"
+
 #define MCONSOLE_MAGIC (0xcafebabe)
 #define MCONSOLE_MAX_DATA (512)
 #define MCONSOLE_VERSION 2
index 66cb400..62403bd 100644 (file)
@@ -104,10 +104,6 @@ union uml_pt_regs {
 #endif
 #ifdef UML_CONFIG_MODE_SKAS
        struct skas_regs {
-               /* x86_64 ptrace uses sizeof(user_regs_struct) as its register
-                * file size, while i386 uses FRAME_SIZE.  Therefore, we need
-                * to use UM_FRAME_SIZE here instead of HOST_FRAME_SIZE.
-                */
                unsigned long regs[MAX_REG_NR];
                unsigned long fp[HOST_FP_SIZE];
                 struct faultinfo faultinfo;
index e85d65d..df7d662 100644 (file)
@@ -64,8 +64,6 @@ static void setup_highmem(unsigned long highmem_start,
 
 void mem_init(void)
 {
-       max_low_pfn = (high_physmem - uml_physmem) >> PAGE_SHIFT;
-
        /* clear the zero-page */
        memset((void *) empty_zero_page, 0, PAGE_SIZE);
 
@@ -80,6 +78,7 @@ void mem_init(void)
 
        /* this will put all low memory onto the freelists */
        totalram_pages = free_all_bootmem();
+       max_low_pfn = totalram_pages;
 #ifdef CONFIG_HIGHMEM
        totalhigh_pages = highmem >> PAGE_SHIFT;
        totalram_pages += totalhigh_pages;
index b3c11cf..9383e87 100644 (file)
@@ -48,7 +48,7 @@ int multi_op_count = 0;
 static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
 {
        unsigned long regs[MAX_REG_NR];
-       int n;
+       int n, i;
        long ret, offset;
        unsigned long * data;
        unsigned long * syscall;
@@ -66,9 +66,13 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
                 (unsigned long) &__syscall_stub_start);
 
        n = ptrace_setregs(pid, regs);
-       if(n < 0)
+       if(n < 0){
+               printk("Registers - \n");
+               for(i = 0; i < MAX_REG_NR; i++)
+                       printk("\t%d\t0x%lx\n", i, regs[i]);
                panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
-                     n);
+                     -n);
+       }
 
        wait_stub_done(pid, 0, "do_syscall_stub");
 
index dda0678..0564422 100644 (file)
@@ -67,7 +67,7 @@ void wait_stub_done(int pid, int sig, char * fname)
 
        if((n < 0) || !WIFSTOPPED(status) ||
           (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
-               unsigned long regs[HOST_FRAME_SIZE];
+               unsigned long regs[MAX_REG_NR];
 
                if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
                        printk("Failed to get registers from stub, "
@@ -76,7 +76,7 @@ void wait_stub_done(int pid, int sig, char * fname)
                        int i;
 
                        printk("Stub registers -\n");
-                       for(i = 0; i < HOST_FRAME_SIZE; i++)
+                       for(i = 0; i < ARRAY_SIZE(regs); i++)
                                printk("\t%d - %lx\n", i, regs[i]);
                }
                panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
@@ -328,7 +328,7 @@ void userspace(union uml_pt_regs *regs)
 int copy_context_skas0(unsigned long new_stack, int pid)
 {
        int err;
-       unsigned long regs[HOST_FRAME_SIZE];
+       unsigned long regs[MAX_REG_NR];
        unsigned long fp_regs[HOST_FP_SIZE];
        unsigned long current_stack = current_stub_stack();
        struct stub_data *data = (struct stub_data *) current_stack;
index 79cd93c..84b44f9 100644 (file)
@@ -15,7 +15,7 @@
 
 /* These are set once at boot time and not changed thereafter */
 
-static unsigned long exec_regs[HOST_FRAME_SIZE];
+static unsigned long exec_regs[MAX_REG_NR];
 static unsigned long exec_fp_regs[HOST_FP_SIZE];
 static unsigned long exec_fpx_regs[HOST_XFP_SIZE];
 static int have_fpx_regs = 1;
@@ -101,6 +101,7 @@ void init_registers(int pid)
 {
        int err;
 
+       memset(exec_regs, 0, sizeof(exec_regs));
        err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
        if(err)
                panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
@@ -124,7 +125,7 @@ void init_registers(int pid)
 
 void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
 {
-       memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
+       memcpy(regs, exec_regs, sizeof(exec_regs));
        if(fp_regs != NULL)
                memcpy(fp_regs, exec_fp_regs,
                       HOST_FP_SIZE * sizeof(unsigned long));
index a2d7e0c..e6fc217 100644 (file)
@@ -14,7 +14,7 @@
 
 /* These are set once at boot time and not changed thereafter */
 
-static unsigned long exec_regs[HOST_FRAME_SIZE];
+static unsigned long exec_regs[MAX_REG_NR];
 static unsigned long exec_fp_regs[HOST_FP_SIZE];
 
 void init_thread_registers(union uml_pt_regs *to)
@@ -72,7 +72,7 @@ void init_registers(int pid)
 
 void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
 {
-       memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
+       memcpy(regs, exec_regs, sizeof(exec_regs));
        if(fp_regs != NULL)
                memcpy(fp_regs, exec_fp_regs,
                       HOST_FP_SIZE * sizeof(unsigned long));
index 2c11b97..d623e07 100644 (file)
@@ -27,14 +27,3 @@ void __udelay(unsigned long usecs)
 }
 
 EXPORT_SYMBOL(__udelay);
-
-void __const_udelay(unsigned long usecs)
-{
-       int i, n;
-
-       n = (loops_per_jiffy * HZ * usecs) / MILLION;
-        for(i=0;i<n;i++)
-                cpu_relax();
-}
-
-EXPORT_SYMBOL(__const_udelay);
index 4a8b420..a939a7e 100644 (file)
@@ -394,7 +394,8 @@ static short * host_ldt_entries = NULL;
 static void ldt_get_host_info(void)
 {
        long ret;
-       struct ldt_entry * ldt, *tmp;
+       struct ldt_entry * ldt;
+       short *tmp;
        int i, size, k, order;
 
        spin_lock(&host_ldt_lock);
index 137f444..dee5be6 100644 (file)
@@ -28,14 +28,3 @@ void __udelay(unsigned long usecs)
 }
 
 EXPORT_SYMBOL(__udelay);
-
-void __const_udelay(unsigned long usecs)
-{
-       unsigned long i, n;
-
-       n = (loops_per_jiffy * HZ * usecs) / MILLION;
-        for(i=0;i<n;i++)
-                cpu_relax();
-}
-
-EXPORT_SYMBOL(__const_udelay);
index d6ff88f..6090516 100644 (file)
@@ -571,6 +571,16 @@ setr1:     lodsw
        jmp     _m_s
 
 check_vesa:
+#ifdef CONFIG_FIRMWARE_EDID
+       leaw    modelist+1024, %di
+       movw    $0x4f00, %ax
+       int     $0x10
+       cmpw    $0x004f, %ax
+       jnz     setbad
+
+       movw    4(%di), %ax
+       movw    %ax, vbe_version
+#endif
        leaw    modelist+1024, %di
        subb    $VIDEO_FIRST_VESA>>8, %bh
        movw    %bx, %cx                        # Get mode information structure
@@ -1945,6 +1955,9 @@ store_edid:
        rep
        stosl
 
+       cmpw    $0x0200, vbe_version            # only do EDID on >= VBE2.0
+       jl      no_edid
+
        pushw   %es                             # save ES
        xorw    %di, %di                        # Report Capability
        pushw   %di
@@ -1987,6 +2000,7 @@ do_restore:       .byte   0       # Screen contents altered during mode change
 svga_prefix:   .byte   VIDEO_FIRST_BIOS>>8     # Default prefix for BIOS modes
 graphic_mode:  .byte   0       # Graphic mode with a linear frame buffer
 dac_size:      .byte   6       # DAC bit depth
+vbe_version:   .word   0       # VBE bios version
 
 # Status messages
 keymsg:                .ascii  "Press <RETURN> to see video modes available, "
index 23178ce..e1548fb 100644 (file)
@@ -66,8 +66,10 @@ static void init_low_mapping(void)
 {
        pgd_t *slot0 = pgd_offset(current->mm, 0UL);
        low_ptr = *slot0;
+       /* FIXME: We're playing with the current task's page tables here, which
+        * is potentially dangerous on SMP systems.
+        */
        set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET));
-       WARN_ON(num_online_cpus() != 1);
        local_flush_tlb();
 }
 
index 723417d..bd3e45d 100644 (file)
@@ -47,6 +47,10 @@ int apic_calibrate_pmtmr __initdata;
 
 int disable_apic_timer __initdata;
 
+/* Local APIC timer works in C2? */
+int local_apic_timer_c2_ok;
+EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
+
 static struct resource *ioapic_resources;
 static struct resource lapic_resource = {
        .name = "Local APIC",
@@ -930,9 +934,17 @@ EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
 
 void smp_send_timer_broadcast_ipi(void)
 {
+       int cpu = smp_processor_id();
        cpumask_t mask;
 
        cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask);
+
+       if (cpu_isset(cpu, mask)) {
+               cpu_clear(cpu, mask);
+               add_pda(apic_timer_irqs, 1);
+               smp_local_timer_interrupt();
+       }
+
        if (!cpus_empty(mask)) {
                send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
        }
@@ -1192,6 +1204,13 @@ static __init int setup_nolapic(char *str)
 } 
 early_param("nolapic", setup_nolapic);
 
+static int __init parse_lapic_timer_c2_ok(char *arg)
+{
+       local_apic_timer_c2_ok = 1;
+       return 0;
+}
+early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
+
 static __init int setup_noapictimer(char *str) 
 { 
        if (str[0] != ' ' && str[0] != 0)
index 148c6bc..fede55a 100644 (file)
@@ -88,7 +88,7 @@ struct chipset {
        void (*f)(void);
 };
 
-static struct __initdata chipset early_qrk[] = {
+static struct chipset early_qrk[] __initdata = {
        { PCI_VENDOR_ID_NVIDIA, nvidia_bugs },
        { PCI_VENDOR_ID_VIA, via_bugs },
        { PCI_VENDOR_ID_ATI, ati_bugs },
index 21d95b7..4894266 100644 (file)
@@ -45,7 +45,7 @@
 
 /*
  * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
- * (these are usually mapped to vectors 0x20-0x2f)
+ * (these are usually mapped to vectors 0x30-0x3f)
  */
 
 /*
@@ -299,7 +299,7 @@ void init_8259A(int auto_eoi)
         * outb_p - this has to work on a wide range of PC hardware.
         */
        outb_p(0x11, 0x20);     /* ICW1: select 8259A-1 init */
-       outb_p(IRQ0_VECTOR, 0x21);      /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */
+       outb_p(IRQ0_VECTOR, 0x21);      /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 */
        outb_p(0x04, 0x21);     /* 8259A-1 (the master) has a slave on IR2 */
        if (auto_eoi)
                outb_p(0x03, 0x21);     /* master does Auto EOI */
@@ -307,7 +307,7 @@ void init_8259A(int auto_eoi)
                outb_p(0x01, 0x21);     /* master expects normal EOI */
 
        outb_p(0x11, 0xA0);     /* ICW1: select 8259A-2 init */
-       outb_p(IRQ8_VECTOR, 0xA1);      /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */
+       outb_p(IRQ8_VECTOR, 0xA1);      /* ICW2: 8259A-2 IR0-7 mapped to 0x38-0x3f */
        outb_p(0x02, 0xA1);     /* 8259A-2 is a slave on master's IR2 */
        outb_p(0x01, 0xA1);     /* (slave's support for AEOI in flat mode
                                    is to be investigated) */
index 82d9d85..a90996c 100644 (file)
@@ -108,64 +108,128 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
 /* checks for a bit availability (hack for oprofile) */
 int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
 {
+       int cpu;
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
-
-       return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner)));
+       for_each_possible_cpu (cpu) {
+               if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
+                       return 0;
+       }
+       return 1;
 }
 
 /* checks the an msr for availability */
 int avail_to_resrv_perfctr_nmi(unsigned int msr)
 {
        unsigned int counter;
+       int cpu;
 
        counter = nmi_perfctr_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner)));
+       for_each_possible_cpu (cpu) {
+               if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
+                       return 0;
+       }
+       return 1;
 }
 
-int reserve_perfctr_nmi(unsigned int msr)
+static int __reserve_perfctr_nmi(int cpu, unsigned int msr)
 {
        unsigned int counter;
+       if (cpu < 0)
+               cpu = smp_processor_id();
 
        counter = nmi_perfctr_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner)))
+       if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
                return 1;
        return 0;
 }
 
-void release_perfctr_nmi(unsigned int msr)
+static void __release_perfctr_nmi(int cpu, unsigned int msr)
 {
        unsigned int counter;
+       if (cpu < 0)
+               cpu = smp_processor_id();
 
        counter = nmi_perfctr_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner));
+       clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu));
 }
 
-int reserve_evntsel_nmi(unsigned int msr)
+int reserve_perfctr_nmi(unsigned int msr)
+{
+       int cpu, i;
+       for_each_possible_cpu (cpu) {
+               if (!__reserve_perfctr_nmi(cpu, msr)) {
+                       for_each_possible_cpu (i) {
+                               if (i >= cpu)
+                                       break;
+                               __release_perfctr_nmi(i, msr);
+                       }
+                       return 0;
+               }
+       }
+       return 1;
+}
+
+void release_perfctr_nmi(unsigned int msr)
+{
+       int cpu;
+       for_each_possible_cpu (cpu)
+               __release_perfctr_nmi(cpu, msr);
+}
+
+int __reserve_evntsel_nmi(int cpu, unsigned int msr)
 {
        unsigned int counter;
+       if (cpu < 0)
+               cpu = smp_processor_id();
 
        counter = nmi_evntsel_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner)))
+       if (!test_and_set_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]))
                return 1;
        return 0;
 }
 
-void release_evntsel_nmi(unsigned int msr)
+static void __release_evntsel_nmi(int cpu, unsigned int msr)
 {
        unsigned int counter;
+       if (cpu < 0)
+               cpu = smp_processor_id();
 
        counter = nmi_evntsel_msr_to_bit(msr);
        BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-       clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner));
+       clear_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]);
+}
+
+int reserve_evntsel_nmi(unsigned int msr)
+{
+       int cpu, i;
+       for_each_possible_cpu (cpu) {
+               if (!__reserve_evntsel_nmi(cpu, msr)) {
+                       for_each_possible_cpu (i) {
+                               if (i >= cpu)
+                                       break;
+                               __release_evntsel_nmi(i, msr);
+                       }
+                       return 0;
+               }
+       }
+       return 1;
+}
+
+void release_evntsel_nmi(unsigned int msr)
+{
+       int cpu;
+       for_each_possible_cpu (cpu) {
+               __release_evntsel_nmi(cpu, msr);
+       }
 }
 
 static __cpuinit inline int nmi_known_cpu(void)
@@ -253,7 +317,7 @@ int __init check_nmi_watchdog (void)
        for (cpu = 0; cpu < NR_CPUS; cpu++)
                counts[cpu] = cpu_pda(cpu)->__nmi_count;
        local_irq_enable();
-       mdelay((10*1000)/nmi_hz); // wait 10 ticks
+       mdelay((20*1000)/nmi_hz); // wait 20 ticks
 
        for_each_online_cpu(cpu) {
                if (!per_cpu(nmi_watchdog_ctlblk, cpu).enabled)
@@ -472,10 +536,10 @@ static int setup_k7_watchdog(void)
 
        perfctr_msr = MSR_K7_PERFCTR0;
        evntsel_msr = MSR_K7_EVNTSEL0;
-       if (!reserve_perfctr_nmi(perfctr_msr))
+       if (!__reserve_perfctr_nmi(-1, perfctr_msr))
                goto fail;
 
-       if (!reserve_evntsel_nmi(evntsel_msr))
+       if (!__reserve_evntsel_nmi(-1, evntsel_msr))
                goto fail1;
 
        /* Simulator may not support it */
@@ -501,9 +565,9 @@ static int setup_k7_watchdog(void)
        wd->check_bit = 1ULL<<63;
        return 1;
 fail2:
-       release_evntsel_nmi(evntsel_msr);
+       __release_evntsel_nmi(-1, evntsel_msr);
 fail1:
-       release_perfctr_nmi(perfctr_msr);
+       __release_perfctr_nmi(-1, perfctr_msr);
 fail:
        return 0;
 }
@@ -514,8 +578,8 @@ static void stop_k7_watchdog(void)
 
        wrmsr(wd->evntsel_msr, 0, 0);
 
-       release_evntsel_nmi(wd->evntsel_msr);
-       release_perfctr_nmi(wd->perfctr_msr);
+       __release_evntsel_nmi(-1, wd->evntsel_msr);
+       __release_perfctr_nmi(-1, wd->perfctr_msr);
 }
 
 /* Note that these events don't tick when the CPU idles. This means
@@ -581,10 +645,10 @@ static int setup_p4_watchdog(void)
                cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4);
        }
 
-       if (!reserve_perfctr_nmi(perfctr_msr))
+       if (!__reserve_perfctr_nmi(-1, perfctr_msr))
                goto fail;
 
-       if (!reserve_evntsel_nmi(evntsel_msr))
+       if (!__reserve_evntsel_nmi(-1, evntsel_msr))
                goto fail1;
 
        evntsel = P4_ESCR_EVENT_SELECT(0x3F)
@@ -609,7 +673,7 @@ static int setup_p4_watchdog(void)
        wd->check_bit = 1ULL<<39;
        return 1;
 fail1:
-       release_perfctr_nmi(perfctr_msr);
+       __release_perfctr_nmi(-1, perfctr_msr);
 fail:
        return 0;
 }
@@ -621,8 +685,8 @@ static void stop_p4_watchdog(void)
        wrmsr(wd->cccr_msr, 0, 0);
        wrmsr(wd->evntsel_msr, 0, 0);
 
-       release_evntsel_nmi(wd->evntsel_msr);
-       release_perfctr_nmi(wd->perfctr_msr);
+       __release_evntsel_nmi(-1, wd->evntsel_msr);
+       __release_perfctr_nmi(-1, wd->perfctr_msr);
 }
 
 #define ARCH_PERFMON_NMI_EVENT_SEL     ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL
@@ -650,10 +714,10 @@ static int setup_intel_arch_watchdog(void)
        perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
        evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
 
-       if (!reserve_perfctr_nmi(perfctr_msr))
+       if (!__reserve_perfctr_nmi(-1, perfctr_msr))
                goto fail;
 
-       if (!reserve_evntsel_nmi(evntsel_msr))
+       if (!__reserve_evntsel_nmi(-1, evntsel_msr))
                goto fail1;
 
        wrmsrl(perfctr_msr, 0UL);
@@ -680,7 +744,7 @@ static int setup_intel_arch_watchdog(void)
        wd->check_bit = 1ULL << (eax.split.bit_width - 1);
        return 1;
 fail1:
-       release_perfctr_nmi(perfctr_msr);
+       __release_perfctr_nmi(-1, perfctr_msr);
 fail:
        return 0;
 }
@@ -704,8 +768,8 @@ static void stop_intel_arch_watchdog(void)
 
        wrmsr(wd->evntsel_msr, 0, 0);
 
-       release_evntsel_nmi(wd->evntsel_msr);
-       release_perfctr_nmi(wd->perfctr_msr);
+       __release_evntsel_nmi(-1, wd->evntsel_msr);
+       __release_perfctr_nmi(-1, wd->perfctr_msr);
 }
 
 void setup_apic_nmi_watchdog(void *unused)
index 25f6ef2..96a00c8 100644 (file)
@@ -964,17 +964,18 @@ void elv_unregister_queue(struct request_queue *q)
 
 int elv_register(struct elevator_type *e)
 {
+       char *def = "";
        spin_lock_irq(&elv_list_lock);
        BUG_ON(elevator_find(e->elevator_name));
        list_add_tail(&e->list, &elv_list);
        spin_unlock_irq(&elv_list_lock);
 
-       printk(KERN_INFO "io scheduler %s registered", e->elevator_name);
        if (!strcmp(e->elevator_name, chosen_elevator) ||
                        (!*chosen_elevator &&
                         !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED)))
-                               printk(" (default)");
-       printk("\n");
+                               def = " (default)";
+
+       printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
        return 0;
 }
 EXPORT_SYMBOL_GPL(elv_register);
index 050a1f0..441432a 100644 (file)
@@ -62,8 +62,6 @@ int register_blkdev(unsigned int major, const char *name)
        /* temporary */
        if (major == 0) {
                for (index = ARRAY_SIZE(major_names)-1; index > 0; index--) {
-                       if (is_lanana_major(index))
-                               continue;
                        if (major_names[index] == NULL)
                                break;
                }
index 38c293b..3de0695 100644 (file)
@@ -1221,7 +1221,7 @@ void blk_recount_segments(request_queue_t *q, struct bio *bio)
                 * considered part of another segment, since that might
                 * change with the bounce page.
                 */
-               high = page_to_pfn(bv->bv_page) >= q->bounce_pfn;
+               high = page_to_pfn(bv->bv_page) > q->bounce_pfn;
                if (high || highprv)
                        goto new_hw_segment;
                if (cluster) {
@@ -3658,8 +3658,8 @@ int __init blk_dev_init(void)
        open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL);
        register_hotcpu_notifier(&blk_cpu_notifier);
 
-       blk_max_low_pfn = max_low_pfn;
-       blk_max_pfn = max_pfn;
+       blk_max_low_pfn = max_low_pfn - 1;
+       blk_max_pfn = max_pfn - 1;
 
        return 0;
 }
index a664231..81afd17 100644 (file)
@@ -59,8 +59,12 @@ EXPORT_SYMBOL_GPL(scatterwalk_map);
 static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
                                 unsigned int more)
 {
-       if (out)
-               flush_dcache_page(scatterwalk_page(walk));
+       if (out) {
+               struct page *page;
+
+               page = walk->sg->page + ((walk->offset - 1) >> PAGE_SHIFT);
+               flush_dcache_page(page);
+       }
 
        if (more) {
                walk->offset += PAGE_SIZE - 1;
@@ -91,7 +95,7 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
                memcpy_dir(buf, vaddr, len_this_page, out);
                scatterwalk_unmap(vaddr, out);
 
-               scatterwalk_advance(walk, nbytes);
+               scatterwalk_advance(walk, len_this_page);
 
                if (nbytes == len_this_page)
                        break;
index 3a799b9..cae786c 100644 (file)
@@ -196,11 +196,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
                notify_info->notify.value = (u16) notify_value;
                notify_info->notify.handler_obj = handler_obj;
 
-               acpi_ex_relinquish_interpreter();
+               acpi_ex_exit_interpreter();
 
                acpi_ev_notify_dispatch(notify_info);
 
-               acpi_ex_reacquire_interpreter();
+               status = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
+
        }
 
        if (!handler_obj) {
index e99f0c4..96b0e84 100644 (file)
@@ -291,6 +291,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                               u32 bit_width, acpi_integer * value)
 {
        acpi_status status;
+       acpi_status status2;
        acpi_adr_space_handler handler;
        acpi_adr_space_setup region_setup;
        union acpi_operand_object *handler_desc;
@@ -344,7 +345,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                 * setup will potentially execute control methods
                 * (e.g., _REG method for this region)
                 */
-               acpi_ex_relinquish_interpreter();
+               acpi_ex_exit_interpreter();
 
                status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
                                      handler_desc->address_space.context,
@@ -352,7 +353,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
 
                /* Re-enter the interpreter */
 
-               acpi_ex_reacquire_interpreter();
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status2)) {
+                       return_ACPI_STATUS(status2);
+               }
 
                /* Check for failure of the Region Setup */
 
@@ -405,7 +409,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                 * exit the interpreter because the handler *might* block -- we don't
                 * know what it will do, so we can't hold the lock on the intepreter.
                 */
-               acpi_ex_relinquish_interpreter();
+               acpi_ex_exit_interpreter();
        }
 
        /* Call the handler */
@@ -426,7 +430,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                 * We just returned from a non-default handler, we must re-enter the
                 * interpreter
                 */
-               acpi_ex_reacquire_interpreter();
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status2)) {
+                       return_ACPI_STATUS(status2);
+               }
        }
 
        return_ACPI_STATUS(status);
index 685a103..a3379ba 100644 (file)
@@ -768,9 +768,11 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
                return (AE_BAD_PARAMETER);
        }
 
-       /* Must lock interpreter to prevent race conditions */
+       status = acpi_ex_enter_interpreter();
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
 
-       acpi_ex_enter_interpreter();
        status = acpi_ev_acquire_global_lock(timeout);
        acpi_ex_exit_interpreter();
 
index 7c38528..ae97812 100644 (file)
@@ -583,7 +583,10 @@ acpi_ex_create_method(u8 * aml_start,
         * Get the sync_level. If method is serialized, a mutex will be
         * created for this method when it is parsed.
         */
-       if (method_flags & AML_METHOD_SERIALIZED) {
+       if (acpi_gbl_all_methods_serialized) {
+               obj_desc->method.sync_level = 0;
+               obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
+       } else if (method_flags & AML_METHOD_SERIALIZED) {
                /*
                 * ACPI 1.0: sync_level = 0
                 * ACPI 2.0: sync_level = sync_level in method declaration
index 9460baf..b2edf62 100644 (file)
@@ -66,6 +66,7 @@ ACPI_MODULE_NAME("exsystem")
 acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
 {
        acpi_status status;
+       acpi_status status2;
 
        ACPI_FUNCTION_TRACE(ex_system_wait_semaphore);
 
@@ -78,7 +79,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
 
                /* We must wait, so unlock the interpreter */
 
-               acpi_ex_relinquish_interpreter();
+               acpi_ex_exit_interpreter();
 
                status = acpi_os_wait_semaphore(semaphore, 1, timeout);
 
@@ -88,7 +89,13 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
 
                /* Reacquire the interpreter */
 
-               acpi_ex_reacquire_interpreter();
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status2)) {
+
+                       /* Report fatal error, could not acquire interpreter */
+
+                       return_ACPI_STATUS(status2);
+               }
        }
 
        return_ACPI_STATUS(status);
@@ -112,6 +119,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
 acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
 {
        acpi_status status;
+       acpi_status status2;
 
        ACPI_FUNCTION_TRACE(ex_system_wait_mutex);
 
@@ -124,7 +132,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
 
                /* We must wait, so unlock the interpreter */
 
-               acpi_ex_relinquish_interpreter();
+               acpi_ex_exit_interpreter();
 
                status = acpi_os_acquire_mutex(mutex, timeout);
 
@@ -134,7 +142,13 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
 
                /* Reacquire the interpreter */
 
-               acpi_ex_reacquire_interpreter();
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status2)) {
+
+                       /* Report fatal error, could not acquire interpreter */
+
+                       return_ACPI_STATUS(status2);
+               }
        }
 
        return_ACPI_STATUS(status);
@@ -195,18 +209,20 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)
 
 acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
 {
+       acpi_status status;
+
        ACPI_FUNCTION_ENTRY();
 
        /* Since this thread will sleep, we must release the interpreter */
 
-       acpi_ex_relinquish_interpreter();
+       acpi_ex_exit_interpreter();
 
        acpi_os_sleep(how_long);
 
        /* And now we must get the interpreter again */
 
-       acpi_ex_reacquire_interpreter();
-       return (AE_OK);
+       status = acpi_ex_enter_interpreter();
+       return (status);
 }
 
 /*******************************************************************************
index 6b0aecc..aea461f 100644 (file)
@@ -76,15 +76,14 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
  *
  * PARAMETERS:  None
  *
- * RETURN:      None
+ * RETURN:      Status
  *
- * DESCRIPTION: Enter the interpreter execution region. Failure to enter
- *              the interpreter region is a fatal system error. Used in
- *              conjunction with exit_interpreter.
+ * DESCRIPTION: Enter the interpreter execution region.  Failure to enter
+ *              the interpreter region is a fatal system error
  *
  ******************************************************************************/
 
-void acpi_ex_enter_interpreter(void)
+acpi_status acpi_ex_enter_interpreter(void)
 {
        acpi_status status;
 
@@ -92,42 +91,10 @@ void acpi_ex_enter_interpreter(void)
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
        if (ACPI_FAILURE(status)) {
-               ACPI_ERROR((AE_INFO,
-                           "Could not acquire AML Interpreter mutex"));
+               ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
        }
 
-       return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ex_reacquire_interpreter
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Reacquire the interpreter execution region from within the
- *              interpreter code. Failure to enter the interpreter region is a
- *              fatal system error. Used in  conjuction with
- *              relinquish_interpreter
- *
- ******************************************************************************/
-
-void acpi_ex_reacquire_interpreter(void)
-{
-       ACPI_FUNCTION_TRACE(ex_reacquire_interpreter);
-
-       /*
-        * If the global serialized flag is set, do not release the interpreter,
-        * since it was not actually released by acpi_ex_relinquish_interpreter.
-        * This forces the interpreter to be single threaded.
-        */
-       if (!acpi_gbl_all_methods_serialized) {
-               acpi_ex_enter_interpreter();
-       }
-
-       return_VOID;
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -138,9 +105,17 @@ void acpi_ex_reacquire_interpreter(void)
  *
  * RETURN:      None
  *
- * DESCRIPTION: Exit the interpreter execution region. This is the top level
- *              routine used to exit the interpreter when all processing has
- *              been completed.
+ * DESCRIPTION: Exit the interpreter execution region
+ *
+ * Cases where the interpreter is unlocked:
+ *      1) Completion of the execution of a control method
+ *      2) Method blocked on a Sleep() AML opcode
+ *      3) Method blocked on an Acquire() AML opcode
+ *      4) Method blocked on a Wait() AML opcode
+ *      5) Method blocked to acquire the global lock
+ *      6) Method blocked to execute a serialized control method that is
+ *          already executing
+ *      7) About to invoke a user-installed opregion handler
  *
  ******************************************************************************/
 
@@ -152,46 +127,7 @@ void acpi_ex_exit_interpreter(void)
 
        status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
        if (ACPI_FAILURE(status)) {
-               ACPI_ERROR((AE_INFO,
-                           "Could not release AML Interpreter mutex"));
-       }
-
-       return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ex_relinquish_interpreter
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Exit the interpreter execution region, from within the
- *              interpreter - before attempting an operation that will possibly
- *              block the running thread.
- *
- * Cases where the interpreter is unlocked internally
- *      1) Method to be blocked on a Sleep() AML opcode
- *      2) Method to be blocked on an Acquire() AML opcode
- *      3) Method to be blocked on a Wait() AML opcode
- *      4) Method to be blocked to acquire the global lock
- *      5) Method to be blocked waiting to execute a serialized control method
- *          that is currently executing
- *      6) About to invoke a user-installed opregion handler
- *
- ******************************************************************************/
-
-void acpi_ex_relinquish_interpreter(void)
-{
-       ACPI_FUNCTION_TRACE(ex_relinquish_interpreter);
-
-       /*
-        * If the global serialized flag is set, do not release the interpreter.
-        * This forces the interpreter to be single threaded.
-        */
-       if (!acpi_gbl_all_methods_serialized) {
-               acpi_ex_exit_interpreter();
+               ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
        }
 
        return_VOID;
@@ -205,8 +141,8 @@ void acpi_ex_relinquish_interpreter(void)
  *
  * RETURN:      none
  *
- * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
- *              32-bit, as determined by the revision of the DSDT.
+ * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
+ *              belongs to a 32-bit ACPI table.
  *
  ******************************************************************************/
 
index 8fa9312..c84b1fa 100644 (file)
@@ -300,6 +300,11 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
        /*
         * 2) Enable all wakeup GPEs
         */
+       status = acpi_hw_disable_all_gpes();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
        acpi_gbl_system_awake_and_running = FALSE;
 
        status = acpi_hw_enable_all_wakeup_gpes();
index 3690136..dc10966 100644 (file)
@@ -2507,7 +2507,7 @@ static int __init setup_notify(struct ibm_struct *ibm)
        ret = acpi_bus_get_device(*ibm->handle, &ibm->device);
        if (ret < 0) {
                printk(IBM_ERR "%s device not present\n", ibm->name);
-               return 0;
+               return -ENODEV;
        }
 
        acpi_driver_data(ibm->device) = ibm;
@@ -2516,8 +2516,13 @@ static int __init setup_notify(struct ibm_struct *ibm)
        status = acpi_install_notify_handler(*ibm->handle, ibm->type,
                                             dispatch_notify, ibm);
        if (ACPI_FAILURE(status)) {
-               printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n",
-                      ibm->name, status);
+               if (status == AE_ALREADY_EXISTS) {
+                       printk(IBM_NOTICE "another device driver is already handling %s events\n",
+                               ibm->name);
+               } else {
+                       printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n",
+                               ibm->name, status);
+               }
                return -ENODEV;
        }
        ibm->notify_installed = 1;
@@ -2553,6 +2558,8 @@ static int __init register_driver(struct ibm_struct *ibm)
        return ret;
 }
 
+static void ibm_exit(struct ibm_struct *ibm);
+
 static int __init ibm_init(struct ibm_struct *ibm)
 {
        int ret;
@@ -2594,6 +2601,12 @@ static int __init ibm_init(struct ibm_struct *ibm)
 
        if (ibm->notify) {
                ret = setup_notify(ibm);
+               if (ret == -ENODEV) {
+                       printk(IBM_NOTICE "disabling subdriver %s\n",
+                               ibm->name);
+                       ibm_exit(ibm);
+                       return 0;
+               }
                if (ret < 0)
                        return ret;
        }
index aa6370c..26fd0dd 100644 (file)
@@ -154,7 +154,11 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
                 * Execute the method via the interpreter. The interpreter is locked
                 * here before calling into the AML parser
                 */
-               acpi_ex_enter_interpreter();
+               status = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
+
                status = acpi_ps_execute_method(info);
                acpi_ex_exit_interpreter();
        } else {
@@ -178,7 +182,10 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
                 * resolution, we must lock it because we could access an opregion.
                 * The opregion access code assumes that the interpreter is locked.
                 */
-               acpi_ex_enter_interpreter();
+               status = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
 
                /* Function has a strange interface */
 
index 33db224..c4ab615 100644 (file)
@@ -214,7 +214,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
                        u32 level, void *context, void **return_value)
 {
        acpi_object_type type;
-       acpi_status status = AE_OK;
+       acpi_status status;
        struct acpi_init_walk_info *info =
            (struct acpi_init_walk_info *)context;
        struct acpi_namespace_node *node =
@@ -268,7 +268,10 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
        /*
         * Must lock the interpreter before executing AML code
         */
-       acpi_ex_enter_interpreter();
+       status = acpi_ex_enter_interpreter();
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
 
        /*
         * Each of these types can contain executable AML code within the
index 7ac6ace..8904d0f 100644 (file)
@@ -170,6 +170,7 @@ acpi_evaluate_object(acpi_handle handle,
                     struct acpi_buffer *return_buffer)
 {
        acpi_status status;
+       acpi_status status2;
        struct acpi_evaluate_info *info;
        acpi_size buffer_space_needed;
        u32 i;
@@ -328,12 +329,14 @@ acpi_evaluate_object(acpi_handle handle,
                 * Delete the internal return object. NOTE: Interpreter must be
                 * locked to avoid race condition.
                 */
-               acpi_ex_enter_interpreter();
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_SUCCESS(status2)) {
 
-               /* Remove one reference on the return object (should delete it) */
+                       /* Remove one reference on the return object (should delete it) */
 
-               acpi_ut_remove_reference(info->return_object);
-               acpi_ex_exit_interpreter();
+                       acpi_ut_remove_reference(info->return_object);
+                       acpi_ex_exit_interpreter();
+               }
        }
 
       cleanup:
index 6077300..cdf7894 100644 (file)
@@ -268,6 +268,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
                                   struct acpi_processor_cx *cx)
 {
        struct acpi_processor_power *pwr = &pr->power;
+       u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2;
 
        /*
         * Check, if one of the previous states already marked the lapic
@@ -276,7 +277,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
        if (pwr->timer_broadcast_on_state < state)
                return;
 
-       if (cx->type >= ACPI_STATE_C2)
+       if (cx->type >= type)
                pr->power.timer_broadcast_on_state = state;
 }
 
index 849e2c3..c341918 100644 (file)
@@ -42,7 +42,9 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
 
 static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;
 
-void acpi_table_print_madt_entry(struct acpi_subtable_header * header)
+static int acpi_apic_instance __initdata;
+
+void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 {
        if (!header)
                return;
@@ -183,8 +185,10 @@ acpi_table_parse_entries(char *id,
        if (!handler)
                return -EINVAL;
 
-       /* Locate the table (if exists). There should only be one. */
-       acpi_get_table(id, 0, &table_header);
+       if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
+               acpi_get_table(id, acpi_apic_instance, &table_header);
+       else
+               acpi_get_table(id, 0, &table_header);
 
        if (!table_header) {
                printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
@@ -237,10 +241,15 @@ acpi_table_parse_madt(enum acpi_madt_type id,
 int __init acpi_table_parse(char *id, acpi_table_handler handler)
 {
        struct acpi_table_header *table = NULL;
+
        if (!handler)
                return -EINVAL;
 
-       acpi_get_table(id, 0, &table);
+       if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
+               acpi_get_table(id, acpi_apic_instance, &table);
+       else
+               acpi_get_table(id, 0, &table);
+
        if (table) {
                handler(table);
                return 0;
@@ -248,6 +257,31 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
                return 1;
 }
 
+/* 
+ * The BIOS is supposed to supply a single APIC/MADT,
+ * but some report two.  Provide a knob to use either.
+ * (don't you wish instance 0 and 1 were not the same?)
+ */
+static void __init check_multiple_madt(void)
+{
+       struct acpi_table_header *table = NULL;
+
+       acpi_get_table(ACPI_SIG_MADT, 2, &table);
+       if (table) {
+               printk(KERN_WARNING PREFIX
+                      "BIOS bug: multiple APIC/MADT found,"
+                      " using %d\n", acpi_apic_instance);
+               printk(KERN_WARNING PREFIX
+                      "If \"acpi_apic_instance=%d\" works better, "
+                      "notify linux-acpi@vger.kernel.org\n",
+                      acpi_apic_instance ? 0 : 2);
+
+       } else
+               acpi_apic_instance = 0;
+
+       return;
+}
+
 /*
  * acpi_table_init()
  *
@@ -257,9 +291,22 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
  * result: sdt_entry[] is initialized
  */
 
-
 int __init acpi_table_init(void)
 {
        acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
+       check_multiple_madt();
+       return 0;
+}
+
+static int __init acpi_parse_apic_instance(char *str)
+{
+
+       acpi_apic_instance = simple_strtoul(str, NULL, 0);
+
+       printk(KERN_NOTICE PREFIX "Shall use APIC/MADT table %d\n",
+              acpi_apic_instance);
+
        return 0;
 }
+
+early_param("acpi_apic_instance", acpi_parse_apic_instance);
index dc7b562..fd27227 100644 (file)
@@ -80,6 +80,7 @@ enum {
        board_ahci_pi           = 1,
        board_ahci_vt8251       = 2,
        board_ahci_ign_iferr    = 3,
+       board_ahci_sb600        = 4,
 
        /* global controller registers */
        HOST_CAP                = 0x00, /* host capabilities */
@@ -168,6 +169,7 @@ enum {
        AHCI_FLAG_NO_NCQ                = (1 << 24),
        AHCI_FLAG_IGN_IRQ_IF_ERR        = (1 << 25), /* ignore IRQ_IF_ERR */
        AHCI_FLAG_HONOR_PI              = (1 << 26), /* honor PORTS_IMPL */
+       AHCI_FLAG_IGN_SERR_INTERNAL     = (1 << 27), /* ignore SERR_INTERNAL */
 };
 
 struct ahci_cmd_hdr {
@@ -362,6 +364,18 @@ static const struct ata_port_info ahci_port_info[] = {
                .udma_mask      = 0x7f, /* udma0-6 ; FIXME */
                .port_ops       = &ahci_ops,
        },
+       /* board_ahci_sb600 */
+       {
+               .sht            = &ahci_sht,
+               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+                                 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
+                                 ATA_FLAG_SKIP_D2H_BSY |
+                                 AHCI_FLAG_IGN_SERR_INTERNAL,
+               .pio_mask       = 0x1f, /* pio0-4 */
+               .udma_mask      = 0x7f, /* udma0-6 ; FIXME */
+               .port_ops       = &ahci_ops,
+       },
+
 };
 
 static const struct pci_device_id ahci_pci_tbl[] = {
@@ -399,7 +413,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
          PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr },
 
        /* ATI */
-       { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */
+       { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 non-raid */
        { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */
 
        /* VIA */
@@ -1067,8 +1081,11 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
        if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR)
                irq_stat &= ~PORT_IRQ_IF_ERR;
 
-       if (irq_stat & PORT_IRQ_TF_ERR)
+       if (irq_stat & PORT_IRQ_TF_ERR) {
                err_mask |= AC_ERR_DEV;
+               if (ap->flags & AHCI_FLAG_IGN_SERR_INTERNAL)
+                       serror &= ~SERR_INTERNAL;
+       }
 
        if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) {
                err_mask |= AC_ERR_HOST_BUS;
index c428a56..03a0acf 100644 (file)
@@ -305,7 +305,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
        *gtf_address = 0UL;
        *obj_loc = 0UL;
 
-       if (noacpi)
+       if (libata_noacpi)
                return 0;
 
        if (ata_msg_probe(ap))
@@ -531,7 +531,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap,
                ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n",
                               __FUNCTION__, ap->port_no);
 
-       if (noacpi || !(ap->cbl == ATA_CBL_SATA))
+       if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA))
                return 0;
 
        if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED))
@@ -574,7 +574,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
        unsigned long   gtf_address;
        unsigned long   obj_loc;
 
-       if (noacpi)
+       if (libata_noacpi)
                return 0;
        /*
         * TBD - implement PATA support.  For now,
@@ -636,7 +636,7 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix)
        struct acpi_object_list         input;
        union acpi_object               in_params[1];
 
-       if (noacpi)
+       if (libata_noacpi)
                return 0;
 
        if (ata_msg_probe(ap))
index bf327d4..0abd72d 100644 (file)
@@ -93,8 +93,8 @@ static int ata_probe_timeout = ATA_TMOUT_INTERNAL / HZ;
 module_param(ata_probe_timeout, int, 0444);
 MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)");
 
-int noacpi;
-module_param(noacpi, int, 0444);
+int libata_noacpi = 1;
+module_param_named(noacpi, libata_noacpi, int, 0444);
 MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set");
 
 MODULE_AUTHOR("Jeff Garzik");
@@ -1784,6 +1784,13 @@ int ata_dev_configure(struct ata_device *dev)
                dev->max_sectors = ATA_MAX_SECTORS;
        }
 
+       if (ata_device_blacklisted(dev) & ATA_HORKAGE_MAX_SEC_128)
+               dev->max_sectors = min(ATA_MAX_SECTORS_128, dev->max_sectors);
+
+       /* limit ATAPI DMA to R/W commands only */
+       if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY)
+               dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY;
+
        if (ap->ops->dev_config)
                ap->ops->dev_config(ap, dev);
 
@@ -3352,6 +3359,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "_NEC DV5800A",       NULL,           ATA_HORKAGE_NODMA },
        { "SAMSUNG CD-ROM SN-124","N001",       ATA_HORKAGE_NODMA },
 
+       /* Weird ATAPI devices */
+       { "TORiSAN DVD-ROM DRD-N216", NULL,     ATA_HORKAGE_MAX_SEC_128 |
+                                               ATA_HORKAGE_DMA_RW_ONLY },
+
        /* Devices we expect to fail diagnostics */
 
        /* Devices where NCQ should be avoided */
@@ -3359,6 +3370,15 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
         { "WDC WD740ADFD-00",   NULL,          ATA_HORKAGE_NONCQ },
        /* http://thread.gmane.org/gmane.linux.ide/14907 */
        { "FUJITSU MHT2060BH",  NULL,           ATA_HORKAGE_NONCQ },
+       /* NCQ is broken */
+       { "Maxtor 6L250S0",     "BANC1G10",     ATA_HORKAGE_NONCQ },
+       /* NCQ hard hangs device under heavier load, needs hard power cycle */
+       { "Maxtor 6B250S0",     "BANC1B70",     ATA_HORKAGE_NONCQ },
+       /* Blacklist entries taken from Silicon Image 3124/3132
+          Windows driver .inf file - also several Linux problem reports */
+       { "HTS541060G9SA00",    "MB3OC60D",     ATA_HORKAGE_NONCQ, },
+       { "HTS541080G9SA00",    "MB4OC60D",     ATA_HORKAGE_NONCQ, },
+       { "HTS541010G9SA00",    "MBZOC60D",     ATA_HORKAGE_NONCQ, },
 
        /* Devices with NCQ limits */
 
@@ -3670,6 +3690,26 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
        struct ata_port *ap = qc->ap;
        int rc = 0; /* Assume ATAPI DMA is OK by default */
 
+       /* some drives can only do ATAPI DMA on read/write */
+       if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) {
+               struct scsi_cmnd *cmd = qc->scsicmd;
+               u8 *scsicmd = cmd->cmnd;
+
+               switch (scsicmd[0]) {
+               case READ_10:
+               case WRITE_10:
+               case READ_12:
+               case WRITE_12:
+               case READ_6:
+               case WRITE_6:
+                       /* atapi dma maybe ok */
+                       break;
+               default:
+                       /* turn off atapi dma */
+                       return 1;
+               }
+       }
+
        if (ap->ops->check_atapi_dma)
                rc = ap->ops->check_atapi_dma(qc);
 
@@ -4713,8 +4753,8 @@ static void fill_result_tf(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
 
-       ap->ops->tf_read(ap, &qc->result_tf);
        qc->result_tf.flags = qc->tf.flags;
+       ap->ops->tf_read(ap, &qc->result_tf);
 }
 
 /**
index 361953a..39f556c 100644 (file)
@@ -982,26 +982,27 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
  *     RETURNS:
  *     0 on success, AC_ERR_* mask on failure
  */
-static unsigned int atapi_eh_request_sense(struct ata_device *dev,
-                                          unsigned char *sense_buf)
+static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
 {
+       struct ata_device *dev = qc->dev;
+       unsigned char *sense_buf = qc->scsicmd->sense_buffer;
        struct ata_port *ap = dev->ap;
        struct ata_taskfile tf;
        u8 cdb[ATAPI_CDB_LEN];
 
        DPRINTK("ATAPI request sense\n");
 
-       ata_tf_init(dev, &tf);
-
        /* FIXME: is this needed? */
        memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
 
-       /* XXX: why tf_read here? */
-       ap->ops->tf_read(ap, &tf);
-
-       /* fill these in, for the case where they are -not- overwritten */
+       /* initialize sense_buf with the error register,
+        * for the case where they are -not- overwritten
+        */
        sense_buf[0] = 0x70;
-       sense_buf[2] = tf.feature >> 4;
+       sense_buf[2] = qc->result_tf.feature >> 4;
+
+       /* some devices time out if garbage left in tf */ 
+       ata_tf_init(dev, &tf);
 
        memset(cdb, 0, ATAPI_CDB_LEN);
        cdb[0] = REQUEST_SENSE;
@@ -1165,8 +1166,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
 
        case ATA_DEV_ATAPI:
                if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) {
-                       tmp = atapi_eh_request_sense(qc->dev,
-                                                    qc->scsicmd->sense_buffer);
+                       tmp = atapi_eh_request_sense(qc);
                        if (!tmp) {
                                /* ATA_QCFLAG_SENSE_VALID is used to
                                 * tell atapi_qc_complete() that sense
@@ -1743,12 +1743,17 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
 {
        struct ata_eh_context *ehc = &ap->eh_context;
        struct ata_device *dev;
+       unsigned int new_mask = 0;
        unsigned long flags;
        int i, rc = 0;
 
        DPRINTK("ENTER\n");
 
-       for (i = 0; i < ATA_MAX_DEVICES; i++) {
+       /* For PATA drive side cable detection to work, IDENTIFY must
+        * be done backwards such that PDIAG- is released by the slave
+        * device before the master device is identified.
+        */
+       for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) {
                unsigned int action, readid_flags = 0;
 
                dev = &ap->device[i];
@@ -1760,13 +1765,13 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
                if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) {
                        if (ata_port_offline(ap)) {
                                rc = -EIO;
-                               break;
+                               goto err;
                        }
 
                        ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE);
                        rc = ata_dev_revalidate(dev, readid_flags);
                        if (rc)
-                               break;
+                               goto err;
 
                        ata_eh_done(ap, dev, ATA_EH_REVALIDATE);
 
@@ -1784,40 +1789,53 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
 
                        rc = ata_dev_read_id(dev, &dev->class, readid_flags,
                                             dev->id);
-                       if (rc == 0) {
-                               ehc->i.flags |= ATA_EHI_PRINTINFO;
-                               rc = ata_dev_configure(dev);
-                               ehc->i.flags &= ~ATA_EHI_PRINTINFO;
-                       } else if (rc == -ENOENT) {
+                       switch (rc) {
+                       case 0:
+                               new_mask |= 1 << i;
+                               break;
+                       case -ENOENT:
                                /* IDENTIFY was issued to non-existent
                                 * device.  No need to reset.  Just
                                 * thaw and kill the device.
                                 */
                                ata_eh_thaw_port(ap);
-                               dev->class = ATA_DEV_UNKNOWN;
-                               rc = 0;
-                       }
-
-                       if (rc) {
                                dev->class = ATA_DEV_UNKNOWN;
                                break;
+                       default:
+                               dev->class = ATA_DEV_UNKNOWN;
+                               goto err;
                        }
+               }
+       }
 
-                       if (ata_dev_enabled(dev)) {
-                               spin_lock_irqsave(ap->lock, flags);
-                               ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
-                               spin_unlock_irqrestore(ap->lock, flags);
+       /* Configure new devices forward such that user doesn't see
+        * device detection messages backwards.
+        */
+       for (i = 0; i < ATA_MAX_DEVICES; i++) {
+               dev = &ap->device[i];
 
-                               /* new device discovered, configure xfermode */
-                               ehc->i.flags |= ATA_EHI_SETMODE;
-                       }
-               }
+               if (!(new_mask & (1 << i)))
+                       continue;
+
+               ehc->i.flags |= ATA_EHI_PRINTINFO;
+               rc = ata_dev_configure(dev);
+               ehc->i.flags &= ~ATA_EHI_PRINTINFO;
+               if (rc)
+                       goto err;
+
+               spin_lock_irqsave(ap->lock, flags);
+               ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
+               spin_unlock_irqrestore(ap->lock, flags);
+
+               /* new device discovered, configure xfermode */
+               ehc->i.flags |= ATA_EHI_SETMODE;
        }
 
-       if (rc)
-               *r_failed_dev = dev;
+       return 0;
 
-       DPRINTK("EXIT\n");
+ err:
+       *r_failed_dev = dev;
+       DPRINTK("EXIT rc=%d\n", rc);
        return rc;
 }
 
index 6cc817a..e936443 100644 (file)
@@ -333,7 +333,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
        scsi_cmd[8]  = args[3];
        scsi_cmd[10] = args[4];
        scsi_cmd[12] = args[5];
-       scsi_cmd[13] = args[6] & 0x0f;
+       scsi_cmd[13] = args[6] & 0x4f;
        scsi_cmd[14] = args[0];
 
        /* Good values for timeout and retries?  Values below
index c426714..1f1e3a5 100644 (file)
@@ -56,7 +56,7 @@ extern struct workqueue_struct *ata_aux_wq;
 extern int atapi_enabled;
 extern int atapi_dmadir;
 extern int libata_fua;
-extern int noacpi;
+extern int libata_noacpi;
 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
 extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
                           u64 block, u32 n_block, unsigned int tf_flags,
index acdc52c..0a14933 100644 (file)
@@ -195,7 +195,7 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
        /* Cases the state machine will not complete correctly without help */
        if ((tf->flags & ATA_TFLAG_LBA48) ||  tf->protocol == ATA_PROT_ATAPI_DMA)
        {
-               len = qc->nbytes;
+               len = qc->nbytes / 2;
 
                if (tf->flags & ATA_TFLAG_WRITE)
                        len |= 0x06000000;
index ad0f4a2..d7fcf82 100644 (file)
 int (*platform_notify)(struct device * dev) = NULL;
 int (*platform_notify_remove)(struct device * dev) = NULL;
 
-/*
- * Detect the LANANA-assigned LOCAL/EXPERIMENTAL majors
- */
-bool is_lanana_major(unsigned int major)
-{
-       if (major >= 60 && major <= 63)
-               return 1;
-       if (major >= 120 && major <= 127)
-               return 1;
-       if (major >= 240 && major <= 254)
-               return 1;
-       return 0;
-}
-
 /*
  * sysfs bindings for devices.
  */
index 1214cbd..082bfde 100644 (file)
@@ -183,7 +183,14 @@ int driver_register(struct device_driver * drv)
 void driver_unregister(struct device_driver * drv)
 {
        bus_remove_driver(drv);
-       wait_for_completion(&drv->unloaded);
+       /*
+        * If the driver is a module, we are probably in
+        * the module unload path, and we want to wait
+        * for everything to unload before we can actually
+        * finish the unload.
+        */
+       if (drv->owner)
+               wait_for_completion(&drv->unloaded);
 }
 
 /**
index 072e18e..14d7806 100644 (file)
@@ -1915,6 +1915,7 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
                               "does not support reading geometry\n");
                        drv->heads = 255;
                        drv->sectors = 32;      // Sectors per track
+                       drv->cylinders = total_size + 1;
                        drv->raid_level = RAID_UNKNOWN;
                } else {
                        drv->heads = inq_buff->data_byte[6];
index 3429ece..d0c978f 100644 (file)
@@ -386,6 +386,39 @@ config AU1000_SERIAL_CONSOLE
          If you have an Alchemy AU1000 processor (MIPS based) and you want
          to use a console on a serial port, say Y.  Otherwise, say N.
 
+config SERIAL_DEC
+       bool "DECstation serial support"
+       depends on MACH_DECSTATION
+       default y
+       help
+         This selects whether you want to be asked about drivers for
+         DECstation serial ports.
+
+         Note that the answer to this question won't directly affect the
+         kernel: saying N will just cause the configurator to skip all
+         the questions about DECstation serial ports.
+
+config SERIAL_DEC_CONSOLE
+       bool "Support for console on a DECstation serial port"
+       depends on SERIAL_DEC
+       default y
+       help
+         If you say Y here, it will be possible to use a serial port as the
+         system console (the system console is the device which receives all
+         kernel messages and warnings and which allows logins in single user
+         mode).  Note that the firmware uses ttyS0 as the serial console on
+         the Maxine and ttyS2 on the others.
+
+         If unsure, say Y.
+
+config ZS
+       bool "Z85C30 Serial Support"
+       depends on SERIAL_DEC
+       default y
+       help
+         Documentation on the Zilog 85C350 serial communications controller
+         is downloadable at <http://www.zilog.com/pdfs/serial/z85c30.pdf>
+
 config A2232
        tristate "Commodore A2232 serial support (EXPERIMENTAL)"
        depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP
index 3ad0f64..6915a05 100644 (file)
@@ -15,7 +15,6 @@ i810-objs   := i810_drv.o i810_dma.o
 i830-objs   := i830_drv.o i830_dma.o i830_irq.o
 i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
 radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
-ffb-objs    := ffb_drv.o ffb_context.o
 sis-objs    := sis_drv.o sis_mm.o
 savage-objs := savage_drv.o savage_bci.o savage_state.o
 via-objs    := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
@@ -36,7 +35,6 @@ obj-$(CONFIG_DRM_MGA) += mga.o
 obj-$(CONFIG_DRM_I810) += i810.o
 obj-$(CONFIG_DRM_I830) += i830.o
 obj-$(CONFIG_DRM_I915)  += i915.o
-obj-$(CONFIG_DRM_FFB)   += ffb.o
 obj-$(CONFIG_DRM_SIS)   += sis.o
 obj-$(CONFIG_DRM_SAVAGE)+= savage.o
 obj-$(CONFIG_DRM_VIA)  +=via.o
diff --git a/drivers/char/drm/ffb_context.c b/drivers/char/drm/ffb_context.c
deleted file mode 100644 (file)
index ac9ab40..0000000
+++ /dev/null
@@ -1,544 +0,0 @@
-/* $Id: ffb_context.c,v 1.5 2001/08/09 17:47:51 davem Exp $
- * ffb_context.c: Creator/Creator3D DRI/DRM context switching.
- *
- * Copyright (C) 2000 David S. Miller (davem@redhat.com)
- *
- * Almost entirely stolen from tdfx_context.c, see there
- * for authors.
- */
-
-#include <asm/upa.h>
-
-#include "ffb.h"
-#include "drmP.h"
-
-#include "ffb_drv.h"
-
-static int DRM(alloc_queue) (drm_device_t * dev, int is_2d_only) {
-       ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
-       int i;
-
-       for (i = 0; i < FFB_MAX_CTXS; i++) {
-               if (fpriv->hw_state[i] == NULL)
-                       break;
-       }
-       if (i == FFB_MAX_CTXS)
-               return -1;
-
-       fpriv->hw_state[i] = kmalloc(sizeof(struct ffb_hw_context), GFP_KERNEL);
-       if (fpriv->hw_state[i] == NULL)
-               return -1;
-
-       fpriv->hw_state[i]->is_2d_only = is_2d_only;
-
-       /* Plus one because 0 is the special DRM_KERNEL_CONTEXT. */
-       return i + 1;
-}
-
-static void ffb_save_context(ffb_dev_priv_t * fpriv, int idx)
-{
-       ffb_fbcPtr ffb = fpriv->regs;
-       struct ffb_hw_context *ctx;
-       int i;
-
-       ctx = fpriv->hw_state[idx - 1];
-       if (idx == 0 || ctx == NULL)
-               return;
-
-       if (ctx->is_2d_only) {
-               /* 2D applications only care about certain pieces
-                * of state.
-                */
-               ctx->drawop = upa_readl(&ffb->drawop);
-               ctx->ppc = upa_readl(&ffb->ppc);
-               ctx->wid = upa_readl(&ffb->wid);
-               ctx->fg = upa_readl(&ffb->fg);
-               ctx->bg = upa_readl(&ffb->bg);
-               ctx->xclip = upa_readl(&ffb->xclip);
-               ctx->fbc = upa_readl(&ffb->fbc);
-               ctx->rop = upa_readl(&ffb->rop);
-               ctx->cmp = upa_readl(&ffb->cmp);
-               ctx->matchab = upa_readl(&ffb->matchab);
-               ctx->magnab = upa_readl(&ffb->magnab);
-               ctx->pmask = upa_readl(&ffb->pmask);
-               ctx->xpmask = upa_readl(&ffb->xpmask);
-               ctx->lpat = upa_readl(&ffb->lpat);
-               ctx->fontxy = upa_readl(&ffb->fontxy);
-               ctx->fontw = upa_readl(&ffb->fontw);
-               ctx->fontinc = upa_readl(&ffb->fontinc);
-
-               /* stencil/stencilctl only exists on FFB2+ and later
-                * due to the introduction of 3DRAM-III.
-                */
-               if (fpriv->ffb_type == ffb2_vertical_plus ||
-                   fpriv->ffb_type == ffb2_horizontal_plus) {
-                       ctx->stencil = upa_readl(&ffb->stencil);
-                       ctx->stencilctl = upa_readl(&ffb->stencilctl);
-               }
-
-               for (i = 0; i < 32; i++)
-                       ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]);
-               ctx->ucsr = upa_readl(&ffb->ucsr);
-               return;
-       }
-
-       /* Fetch drawop. */
-       ctx->drawop = upa_readl(&ffb->drawop);
-
-       /* If we were saving the vertex registers, this is where
-        * we would do it.  We would save 32 32-bit words starting
-        * at ffb->suvtx.
-        */
-
-       /* Capture rendering attributes. */
-
-       ctx->ppc = upa_readl(&ffb->ppc);        /* Pixel Processor Control */
-       ctx->wid = upa_readl(&ffb->wid);        /* Current WID */
-       ctx->fg = upa_readl(&ffb->fg);  /* Constant FG color */
-       ctx->bg = upa_readl(&ffb->bg);  /* Constant BG color */
-       ctx->consty = upa_readl(&ffb->consty);  /* Constant Y */
-       ctx->constz = upa_readl(&ffb->constz);  /* Constant Z */
-       ctx->xclip = upa_readl(&ffb->xclip);    /* X plane clip */
-       ctx->dcss = upa_readl(&ffb->dcss);      /* Depth Cue Scale Slope */
-       ctx->vclipmin = upa_readl(&ffb->vclipmin);      /* Primary XY clip, minimum */
-       ctx->vclipmax = upa_readl(&ffb->vclipmax);      /* Primary XY clip, maximum */
-       ctx->vclipzmin = upa_readl(&ffb->vclipzmin);    /* Primary Z clip, minimum */
-       ctx->vclipzmax = upa_readl(&ffb->vclipzmax);    /* Primary Z clip, maximum */
-       ctx->dcsf = upa_readl(&ffb->dcsf);      /* Depth Cue Scale Front Bound */
-       ctx->dcsb = upa_readl(&ffb->dcsb);      /* Depth Cue Scale Back Bound */
-       ctx->dczf = upa_readl(&ffb->dczf);      /* Depth Cue Scale Z Front */
-       ctx->dczb = upa_readl(&ffb->dczb);      /* Depth Cue Scale Z Back */
-       ctx->blendc = upa_readl(&ffb->blendc);  /* Alpha Blend Control */
-       ctx->blendc1 = upa_readl(&ffb->blendc1);        /* Alpha Blend Color 1 */
-       ctx->blendc2 = upa_readl(&ffb->blendc2);        /* Alpha Blend Color 2 */
-       ctx->fbc = upa_readl(&ffb->fbc);        /* Frame Buffer Control */
-       ctx->rop = upa_readl(&ffb->rop);        /* Raster Operation */
-       ctx->cmp = upa_readl(&ffb->cmp);        /* Compare Controls */
-       ctx->matchab = upa_readl(&ffb->matchab);        /* Buffer A/B Match Ops */
-       ctx->matchc = upa_readl(&ffb->matchc);  /* Buffer C Match Ops */
-       ctx->magnab = upa_readl(&ffb->magnab);  /* Buffer A/B Magnitude Ops */
-       ctx->magnc = upa_readl(&ffb->magnc);    /* Buffer C Magnitude Ops */
-       ctx->pmask = upa_readl(&ffb->pmask);    /* RGB Plane Mask */
-       ctx->xpmask = upa_readl(&ffb->xpmask);  /* X Plane Mask */
-       ctx->ypmask = upa_readl(&ffb->ypmask);  /* Y Plane Mask */
-       ctx->zpmask = upa_readl(&ffb->zpmask);  /* Z Plane Mask */
-
-       /* Auxiliary Clips. */
-       ctx->auxclip0min = upa_readl(&ffb->auxclip[0].min);
-       ctx->auxclip0max = upa_readl(&ffb->auxclip[0].max);
-       ctx->auxclip1min = upa_readl(&ffb->auxclip[1].min);
-       ctx->auxclip1max = upa_readl(&ffb->auxclip[1].max);
-       ctx->auxclip2min = upa_readl(&ffb->auxclip[2].min);
-       ctx->auxclip2max = upa_readl(&ffb->auxclip[2].max);
-       ctx->auxclip3min = upa_readl(&ffb->auxclip[3].min);
-       ctx->auxclip3max = upa_readl(&ffb->auxclip[3].max);
-
-       ctx->lpat = upa_readl(&ffb->lpat);      /* Line Pattern */
-       ctx->fontxy = upa_readl(&ffb->fontxy);  /* XY Font Coordinate */
-       ctx->fontw = upa_readl(&ffb->fontw);    /* Font Width */
-       ctx->fontinc = upa_readl(&ffb->fontinc);        /* Font X/Y Increment */
-
-       /* These registers/features only exist on FFB2 and later chips. */
-       if (fpriv->ffb_type >= ffb2_prototype) {
-               ctx->dcss1 = upa_readl(&ffb->dcss1);    /* Depth Cue Scale Slope 1 */
-               ctx->dcss2 = upa_readl(&ffb->dcss2);    /* Depth Cue Scale Slope 2 */
-               ctx->dcss2 = upa_readl(&ffb->dcss3);    /* Depth Cue Scale Slope 3 */
-               ctx->dcs2 = upa_readl(&ffb->dcs2);      /* Depth Cue Scale 2 */
-               ctx->dcs3 = upa_readl(&ffb->dcs3);      /* Depth Cue Scale 3 */
-               ctx->dcs4 = upa_readl(&ffb->dcs4);      /* Depth Cue Scale 4 */
-               ctx->dcd2 = upa_readl(&ffb->dcd2);      /* Depth Cue Depth 2 */
-               ctx->dcd3 = upa_readl(&ffb->dcd3);      /* Depth Cue Depth 3 */
-               ctx->dcd4 = upa_readl(&ffb->dcd4);      /* Depth Cue Depth 4 */
-
-               /* And stencil/stencilctl only exists on FFB2+ and later
-                * due to the introduction of 3DRAM-III.
-                */
-               if (fpriv->ffb_type == ffb2_vertical_plus ||
-                   fpriv->ffb_type == ffb2_horizontal_plus) {
-                       ctx->stencil = upa_readl(&ffb->stencil);
-                       ctx->stencilctl = upa_readl(&ffb->stencilctl);
-               }
-       }
-
-       /* Save the 32x32 area pattern. */
-       for (i = 0; i < 32; i++)
-               ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]);
-
-       /* Finally, stash away the User Constol/Status Register. */
-       ctx->ucsr = upa_readl(&ffb->ucsr);
-}
-
-static void ffb_restore_context(ffb_dev_priv_t * fpriv, int old, int idx)
-{
-       ffb_fbcPtr ffb = fpriv->regs;
-       struct ffb_hw_context *ctx;
-       int i;
-
-       ctx = fpriv->hw_state[idx - 1];
-       if (idx == 0 || ctx == NULL)
-               return;
-
-       if (ctx->is_2d_only) {
-               /* 2D applications only care about certain pieces
-                * of state.
-                */
-               upa_writel(ctx->drawop, &ffb->drawop);
-
-               /* If we were restoring the vertex registers, this is where
-                * we would do it.  We would restore 32 32-bit words starting
-                * at ffb->suvtx.
-                */
-
-               upa_writel(ctx->ppc, &ffb->ppc);
-               upa_writel(ctx->wid, &ffb->wid);
-               upa_writel(ctx->fg, &ffb->fg);
-               upa_writel(ctx->bg, &ffb->bg);
-               upa_writel(ctx->xclip, &ffb->xclip);
-               upa_writel(ctx->fbc, &ffb->fbc);
-               upa_writel(ctx->rop, &ffb->rop);
-               upa_writel(ctx->cmp, &ffb->cmp);
-               upa_writel(ctx->matchab, &ffb->matchab);
-               upa_writel(ctx->magnab, &ffb->magnab);
-               upa_writel(ctx->pmask, &ffb->pmask);
-               upa_writel(ctx->xpmask, &ffb->xpmask);
-               upa_writel(ctx->lpat, &ffb->lpat);
-               upa_writel(ctx->fontxy, &ffb->fontxy);
-               upa_writel(ctx->fontw, &ffb->fontw);
-               upa_writel(ctx->fontinc, &ffb->fontinc);
-
-               /* stencil/stencilctl only exists on FFB2+ and later
-                * due to the introduction of 3DRAM-III.
-                */
-               if (fpriv->ffb_type == ffb2_vertical_plus ||
-                   fpriv->ffb_type == ffb2_horizontal_plus) {
-                       upa_writel(ctx->stencil, &ffb->stencil);
-                       upa_writel(ctx->stencilctl, &ffb->stencilctl);
-                       upa_writel(0x80000000, &ffb->fbc);
-                       upa_writel((ctx->stencilctl | 0x80000),
-                                  &ffb->rawstencilctl);
-                       upa_writel(ctx->fbc, &ffb->fbc);
-               }
-
-               for (i = 0; i < 32; i++)
-                       upa_writel(ctx->area_pattern[i], &ffb->pattern[i]);
-               upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr);
-               return;
-       }
-
-       /* Restore drawop. */
-       upa_writel(ctx->drawop, &ffb->drawop);
-
-       /* If we were restoring the vertex registers, this is where
-        * we would do it.  We would restore 32 32-bit words starting
-        * at ffb->suvtx.
-        */
-
-       /* Restore rendering attributes. */
-
-       upa_writel(ctx->ppc, &ffb->ppc);        /* Pixel Processor Control */
-       upa_writel(ctx->wid, &ffb->wid);        /* Current WID */
-       upa_writel(ctx->fg, &ffb->fg);  /* Constant FG color */
-       upa_writel(ctx->bg, &ffb->bg);  /* Constant BG color */
-       upa_writel(ctx->consty, &ffb->consty);  /* Constant Y */
-       upa_writel(ctx->constz, &ffb->constz);  /* Constant Z */
-       upa_writel(ctx->xclip, &ffb->xclip);    /* X plane clip */
-       upa_writel(ctx->dcss, &ffb->dcss);      /* Depth Cue Scale Slope */
-       upa_writel(ctx->vclipmin, &ffb->vclipmin);      /* Primary XY clip, minimum */
-       upa_writel(ctx->vclipmax, &ffb->vclipmax);      /* Primary XY clip, maximum */
-       upa_writel(ctx->vclipzmin, &ffb->vclipzmin);    /* Primary Z clip, minimum */
-       upa_writel(ctx->vclipzmax, &ffb->vclipzmax);    /* Primary Z clip, maximum */
-       upa_writel(ctx->dcsf, &ffb->dcsf);      /* Depth Cue Scale Front Bound */
-       upa_writel(ctx->dcsb, &ffb->dcsb);      /* Depth Cue Scale Back Bound */
-       upa_writel(ctx->dczf, &ffb->dczf);      /* Depth Cue Scale Z Front */
-       upa_writel(ctx->dczb, &ffb->dczb);      /* Depth Cue Scale Z Back */
-       upa_writel(ctx->blendc, &ffb->blendc);  /* Alpha Blend Control */
-       upa_writel(ctx->blendc1, &ffb->blendc1);        /* Alpha Blend Color 1 */
-       upa_writel(ctx->blendc2, &ffb->blendc2);        /* Alpha Blend Color 2 */
-       upa_writel(ctx->fbc, &ffb->fbc);        /* Frame Buffer Control */
-       upa_writel(ctx->rop, &ffb->rop);        /* Raster Operation */
-       upa_writel(ctx->cmp, &ffb->cmp);        /* Compare Controls */
-       upa_writel(ctx->matchab, &ffb->matchab);        /* Buffer A/B Match Ops */
-       upa_writel(ctx->matchc, &ffb->matchc);  /* Buffer C Match Ops */
-       upa_writel(ctx->magnab, &ffb->magnab);  /* Buffer A/B Magnitude Ops */
-       upa_writel(ctx->magnc, &ffb->magnc);    /* Buffer C Magnitude Ops */
-       upa_writel(ctx->pmask, &ffb->pmask);    /* RGB Plane Mask */
-       upa_writel(ctx->xpmask, &ffb->xpmask);  /* X Plane Mask */
-       upa_writel(ctx->ypmask, &ffb->ypmask);  /* Y Plane Mask */
-       upa_writel(ctx->zpmask, &ffb->zpmask);  /* Z Plane Mask */
-
-       /* Auxiliary Clips. */
-       upa_writel(ctx->auxclip0min, &ffb->auxclip[0].min);
-       upa_writel(ctx->auxclip0max, &ffb->auxclip[0].max);
-       upa_writel(ctx->auxclip1min, &ffb->auxclip[1].min);
-       upa_writel(ctx->auxclip1max, &ffb->auxclip[1].max);
-       upa_writel(ctx->auxclip2min, &ffb->auxclip[2].min);
-       upa_writel(ctx->auxclip2max, &ffb->auxclip[2].max);
-       upa_writel(ctx->auxclip3min, &ffb->auxclip[3].min);
-       upa_writel(ctx->auxclip3max, &ffb->auxclip[3].max);
-
-       upa_writel(ctx->lpat, &ffb->lpat);      /* Line Pattern */
-       upa_writel(ctx->fontxy, &ffb->fontxy);  /* XY Font Coordinate */
-       upa_writel(ctx->fontw, &ffb->fontw);    /* Font Width */
-       upa_writel(ctx->fontinc, &ffb->fontinc);        /* Font X/Y Increment */
-
-       /* These registers/features only exist on FFB2 and later chips. */
-       if (fpriv->ffb_type >= ffb2_prototype) {
-               upa_writel(ctx->dcss1, &ffb->dcss1);    /* Depth Cue Scale Slope 1 */
-               upa_writel(ctx->dcss2, &ffb->dcss2);    /* Depth Cue Scale Slope 2 */
-               upa_writel(ctx->dcss3, &ffb->dcss2);    /* Depth Cue Scale Slope 3 */
-               upa_writel(ctx->dcs2, &ffb->dcs2);      /* Depth Cue Scale 2 */
-               upa_writel(ctx->dcs3, &ffb->dcs3);      /* Depth Cue Scale 3 */
-               upa_writel(ctx->dcs4, &ffb->dcs4);      /* Depth Cue Scale 4 */
-               upa_writel(ctx->dcd2, &ffb->dcd2);      /* Depth Cue Depth 2 */
-               upa_writel(ctx->dcd3, &ffb->dcd3);      /* Depth Cue Depth 3 */
-               upa_writel(ctx->dcd4, &ffb->dcd4);      /* Depth Cue Depth 4 */
-
-               /* And stencil/stencilctl only exists on FFB2+ and later
-                * due to the introduction of 3DRAM-III.
-                */
-               if (fpriv->ffb_type == ffb2_vertical_plus ||
-                   fpriv->ffb_type == ffb2_horizontal_plus) {
-                       /* Unfortunately, there is a hardware bug on
-                        * the FFB2+ chips which prevents a normal write
-                        * to the stencil control register from working
-                        * as it should.
-                        *
-                        * The state controlled by the FFB stencilctl register
-                        * really gets transferred to the per-buffer instances
-                        * of the stencilctl register in the 3DRAM chips.
-                        *
-                        * The bug is that FFB does not update buffer C correctly,
-                        * so we have to do it by hand for them.
-                        */
-
-                       /* This will update buffers A and B. */
-                       upa_writel(ctx->stencil, &ffb->stencil);
-                       upa_writel(ctx->stencilctl, &ffb->stencilctl);
-
-                       /* Force FFB to use buffer C 3dram regs. */
-                       upa_writel(0x80000000, &ffb->fbc);
-                       upa_writel((ctx->stencilctl | 0x80000),
-                                  &ffb->rawstencilctl);
-
-                       /* Now restore the correct FBC controls. */
-                       upa_writel(ctx->fbc, &ffb->fbc);
-               }
-       }
-
-       /* Restore the 32x32 area pattern. */
-       for (i = 0; i < 32; i++)
-               upa_writel(ctx->area_pattern[i], &ffb->pattern[i]);
-
-       /* Finally, stash away the User Constol/Status Register.
-        * The only state we really preserve here is the picking
-        * control.
-        */
-       upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr);
-}
-
-#define FFB_UCSR_FB_BUSY       0x01000000
-#define FFB_UCSR_RP_BUSY       0x02000000
-#define FFB_UCSR_ALL_BUSY      (FFB_UCSR_RP_BUSY|FFB_UCSR_FB_BUSY)
-
-static void FFBWait(ffb_fbcPtr ffb)
-{
-       int limit = 100000;
-
-       do {
-               u32 regval = upa_readl(&ffb->ucsr);
-
-               if ((regval & FFB_UCSR_ALL_BUSY) == 0)
-                       break;
-       } while (--limit);
-}
-
-int ffb_driver_context_switch(drm_device_t * dev, int old, int new)
-{
-       ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
-
-#ifdef DRM_DMA_HISTOGRAM
-       dev->ctx_start = get_cycles();
-#endif
-
-       DRM_DEBUG("Context switch from %d to %d\n", old, new);
-
-       if (new == dev->last_context || dev->last_context == 0) {
-               dev->last_context = new;
-               return 0;
-       }
-
-       FFBWait(fpriv->regs);
-       ffb_save_context(fpriv, old);
-       ffb_restore_context(fpriv, old, new);
-       FFBWait(fpriv->regs);
-
-       dev->last_context = new;
-
-       return 0;
-}
-
-int ffb_driver_resctx(struct inode *inode, struct file *filp, unsigned int cmd,
-                     unsigned long arg)
-{
-       drm_ctx_res_t res;
-       drm_ctx_t ctx;
-       int i;
-
-       DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS);
-       if (copy_from_user(&res, (drm_ctx_res_t __user *) arg, sizeof(res)))
-               return -EFAULT;
-       if (res.count >= DRM_RESERVED_CONTEXTS) {
-               memset(&ctx, 0, sizeof(ctx));
-               for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
-                       ctx.handle = i;
-                       if (copy_to_user(&res.contexts[i], &i, sizeof(i)))
-                               return -EFAULT;
-               }
-       }
-       res.count = DRM_RESERVED_CONTEXTS;
-       if (copy_to_user((drm_ctx_res_t __user *) arg, &res, sizeof(res)))
-               return -EFAULT;
-       return 0;
-}
-
-int ffb_driver_addctx(struct inode *inode, struct file *filp, unsigned int cmd,
-                     unsigned long arg)
-{
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->dev;
-       drm_ctx_t ctx;
-       int idx;
-
-       if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
-               return -EFAULT;
-       idx = DRM(alloc_queue) (dev, (ctx.flags & _DRM_CONTEXT_2DONLY));
-       if (idx < 0)
-               return -ENFILE;
-
-       DRM_DEBUG("%d\n", ctx.handle);
-       ctx.handle = idx;
-       if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx)))
-               return -EFAULT;
-       return 0;
-}
-
-int ffb_driver_modctx(struct inode *inode, struct file *filp, unsigned int cmd,
-                     unsigned long arg)
-{
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->dev;
-       ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
-       struct ffb_hw_context *hwctx;
-       drm_ctx_t ctx;
-       int idx;
-
-       if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
-               return -EFAULT;
-
-       idx = ctx.handle;
-       if (idx <= 0 || idx >= FFB_MAX_CTXS)
-               return -EINVAL;
-
-       hwctx = fpriv->hw_state[idx - 1];
-       if (hwctx == NULL)
-               return -EINVAL;
-
-       if ((ctx.flags & _DRM_CONTEXT_2DONLY) == 0)
-               hwctx->is_2d_only = 0;
-       else
-               hwctx->is_2d_only = 1;
-
-       return 0;
-}
-
-int ffb_driver_getctx(struct inode *inode, struct file *filp, unsigned int cmd,
-                     unsigned long arg)
-{
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->dev;
-       ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
-       struct ffb_hw_context *hwctx;
-       drm_ctx_t ctx;
-       int idx;
-
-       if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
-               return -EFAULT;
-
-       idx = ctx.handle;
-       if (idx <= 0 || idx >= FFB_MAX_CTXS)
-               return -EINVAL;
-
-       hwctx = fpriv->hw_state[idx - 1];
-       if (hwctx == NULL)
-               return -EINVAL;
-
-       if (hwctx->is_2d_only != 0)
-               ctx.flags = _DRM_CONTEXT_2DONLY;
-       else
-               ctx.flags = 0;
-
-       if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx)))
-               return -EFAULT;
-
-       return 0;
-}
-
-int ffb_driver_switchctx(struct inode *inode, struct file *filp,
-                        unsigned int cmd, unsigned long arg)
-{
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->dev;
-       drm_ctx_t ctx;
-
-       if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
-               return -EFAULT;
-       DRM_DEBUG("%d\n", ctx.handle);
-       return ffb_driver_context_switch(dev, dev->last_context, ctx.handle);
-}
-
-int ffb_driver_newctx(struct inode *inode, struct file *filp, unsigned int cmd,
-                     unsigned long arg)
-{
-       drm_ctx_t ctx;
-
-       if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
-               return -EFAULT;
-       DRM_DEBUG("%d\n", ctx.handle);
-
-       return 0;
-}
-
-int ffb_driver_rmctx(struct inode *inode, struct file *filp, unsigned int cmd,
-                    unsigned long arg)
-{
-       drm_ctx_t ctx;
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->dev;
-       ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
-       int idx;
-
-       if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
-               return -EFAULT;
-       DRM_DEBUG("%d\n", ctx.handle);
-
-       idx = ctx.handle - 1;
-       if (idx < 0 || idx >= FFB_MAX_CTXS)
-               return -EINVAL;
-
-       kfree(fpriv->hw_state[idx]);
-       fpriv->hw_state[idx] = NULL;
-       return 0;
-}
-
-void ffb_set_context_ioctls(void)
-{
-       DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)].func = ffb_driver_addctx;
-       DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)].func = ffb_driver_rmctx;
-       DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)].func = ffb_driver_modctx;
-       DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)].func = ffb_driver_getctx;
-       DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)].func =
-           ffb_driver_switchctx;
-       DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)].func = ffb_driver_newctx;
-       DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)].func = ffb_driver_resctx;
-
-}
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
deleted file mode 100644 (file)
index 9a19879..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/* $Id: ffb_drv.c,v 1.16 2001/10/18 16:00:24 davem Exp $
- * ffb_drv.c: Creator/Creator3D direct rendering driver.
- *
- * Copyright (C) 2000 David S. Miller (davem@redhat.com)
- */
-
-#include "ffb.h"
-#include "drmP.h"
-
-#include "ffb_drv.h"
-
-#include <linux/smp_lock.h>
-#include <asm/shmparam.h>
-#include <asm/oplib.h>
-#include <asm/upa.h>
-
-#define DRIVER_AUTHOR          "David S. Miller"
-
-#define DRIVER_NAME            "ffb"
-#define DRIVER_DESC            "Creator/Creator3D"
-#define DRIVER_DATE            "20000517"
-
-#define DRIVER_MAJOR           0
-#define DRIVER_MINOR           0
-#define DRIVER_PATCHLEVEL      1
-
-typedef struct _ffb_position_t {
-       int node;
-       int root;
-} ffb_position_t;
-
-static ffb_position_t *ffb_position;
-
-static void get_ffb_type(ffb_dev_priv_t * ffb_priv, int instance)
-{
-       volatile unsigned char *strap_bits;
-       unsigned char val;
-
-       strap_bits = (volatile unsigned char *)
-           (ffb_priv->card_phys_base + 0x00200000UL);
-
-       /* Don't ask, you have to read the value twice for whatever
-        * reason to get correct contents.
-        */
-       val = upa_readb(strap_bits);
-       val = upa_readb(strap_bits);
-       switch (val & 0x78) {
-       case (0x0 << 5) | (0x0 << 3):
-               ffb_priv->ffb_type = ffb1_prototype;
-               printk("ffb%d: Detected FFB1 pre-FCS prototype\n", instance);
-               break;
-       case (0x0 << 5) | (0x1 << 3):
-               ffb_priv->ffb_type = ffb1_standard;
-               printk("ffb%d: Detected FFB1\n", instance);
-               break;
-       case (0x0 << 5) | (0x3 << 3):
-               ffb_priv->ffb_type = ffb1_speedsort;
-               printk("ffb%d: Detected FFB1-SpeedSort\n", instance);
-               break;
-       case (0x1 << 5) | (0x0 << 3):
-               ffb_priv->ffb_type = ffb2_prototype;
-               printk("ffb%d: Detected FFB2/vertical pre-FCS prototype\n",
-                      instance);
-               break;
-       case (0x1 << 5) | (0x1 << 3):
-               ffb_priv->ffb_type = ffb2_vertical;
-               printk("ffb%d: Detected FFB2/vertical\n", instance);
-               break;
-       case (0x1 << 5) | (0x2 << 3):
-               ffb_priv->ffb_type = ffb2_vertical_plus;
-               printk("ffb%d: Detected FFB2+/vertical\n", instance);
-               break;
-       case (0x2 << 5) | (0x0 << 3):
-               ffb_priv->ffb_type = ffb2_horizontal;
-               printk("ffb%d: Detected FFB2/horizontal\n", instance);
-               break;
-       case (0x2 << 5) | (0x2 << 3):
-               ffb_priv->ffb_type = ffb2_horizontal;
-               printk("ffb%d: Detected FFB2+/horizontal\n", instance);
-               break;
-       default:
-               ffb_priv->ffb_type = ffb2_vertical;
-               printk("ffb%d: Unknown boardID[%08x], assuming FFB2\n",
-                      instance, val);
-               break;
-       };
-}
-
-static void ffb_apply_upa_parent_ranges(int parent,
-                                       struct linux_prom64_registers *regs)
-{
-       struct linux_prom64_ranges ranges[PROMREG_MAX];
-       char name[128];
-       int len, i;
-
-       prom_getproperty(parent, "name", name, sizeof(name));
-       if (strcmp(name, "upa") != 0)
-               return;
-
-       len =
-           prom_getproperty(parent, "ranges", (void *)ranges, sizeof(ranges));
-       if (len <= 0)
-               return;
-
-       len /= sizeof(struct linux_prom64_ranges);
-       for (i = 0; i < len; i++) {
-               struct linux_prom64_ranges *rng = &ranges[i];
-               u64 phys_addr = regs->phys_addr;
-
-               if (phys_addr >= rng->ot_child_base &&
-                   phys_addr < (rng->ot_child_base + rng->or_size)) {
-                       regs->phys_addr -= rng->ot_child_base;
-                       regs->phys_addr += rng->ot_parent_base;
-                       return;
-               }
-       }
-
-       return;
-}
-
-static int ffb_init_one(drm_device_t * dev, int prom_node, int parent_node,
-                       int instance)
-{
-       struct linux_prom64_registers regs[2 * PROMREG_MAX];
-       ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
-       int i;
-
-       ffb_priv->prom_node = prom_node;
-       if (prom_getproperty(ffb_priv->prom_node, "reg",
-                            (void *)regs, sizeof(regs)) <= 0) {
-               return -EINVAL;
-       }
-       ffb_apply_upa_parent_ranges(parent_node, &regs[0]);
-       ffb_priv->card_phys_base = regs[0].phys_addr;
-       ffb_priv->regs = (ffb_fbcPtr)
-           (regs[0].phys_addr + 0x00600000UL);
-       get_ffb_type(ffb_priv, instance);
-       for (i = 0; i < FFB_MAX_CTXS; i++)
-               ffb_priv->hw_state[i] = NULL;
-
-       return 0;
-}
-
-static drm_map_t *ffb_find_map(struct file *filp, unsigned long off)
-{
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev;
-       drm_map_list_t *r_list;
-       struct list_head *list;
-       drm_map_t *map;
-
-       if (!priv || (dev = priv->dev) == NULL)
-               return NULL;
-
-       list_for_each(list, &dev->maplist->head) {
-               r_list = (drm_map_list_t *) list;
-               map = r_list->map;
-               if (!map)
-                       continue;
-               if (r_list->user_token == off)
-                       return map;
-       }
-
-       return NULL;
-}
-
-unsigned long ffb_get_unmapped_area(struct file *filp,
-                                   unsigned long hint,
-                                   unsigned long len,
-                                   unsigned long pgoff, unsigned long flags)
-{
-       drm_map_t *map = ffb_find_map(filp, pgoff << PAGE_SHIFT);
-       unsigned long addr = -ENOMEM;
-
-       if (!map)
-               return get_unmapped_area(NULL, hint, len, pgoff, flags);
-
-       if (map->type == _DRM_FRAME_BUFFER || map->type == _DRM_REGISTERS) {
-#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
-               addr = get_fb_unmapped_area(filp, hint, len, pgoff, flags);
-#else
-               addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
-#endif
-       } else if (map->type == _DRM_SHM && SHMLBA > PAGE_SIZE) {
-               unsigned long slack = SHMLBA - PAGE_SIZE;
-
-               addr = get_unmapped_area(NULL, hint, len + slack, pgoff, flags);
-               if (!(addr & ~PAGE_MASK)) {
-                       unsigned long kvirt = (unsigned long)map->handle;
-
-                       if ((kvirt & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) {
-                               unsigned long koff, aoff;
-
-                               koff = kvirt & (SHMLBA - 1);
-                               aoff = addr & (SHMLBA - 1);
-                               if (koff < aoff)
-                                       koff += SHMLBA;
-
-                               addr += (koff - aoff);
-                       }
-               }
-       } else {
-               addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
-       }
-
-       return addr;
-}
-
-static int ffb_presetup(drm_device_t * dev)
-{
-       ffb_dev_priv_t *ffb_priv;
-       int ret = 0;
-       int i = 0;
-
-       /* Check for the case where no device was found. */
-       if (ffb_position == NULL)
-               return -ENODEV;
-
-       /* code used to use numdevs no numdevs anymore */
-       ffb_priv = kmalloc(sizeof(ffb_dev_priv_t), GFP_KERNEL);
-       if (!ffb_priv)
-               return -ENOMEM;
-       memset(ffb_priv, 0, sizeof(*ffb_priv));
-       dev->dev_private = ffb_priv;
-
-       ret = ffb_init_one(dev, ffb_position[i].node, ffb_position[i].root, i);
-       return ret;
-}
-
-static void ffb_driver_release(drm_device_t * dev, struct file *filp)
-{
-       ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
-       int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock);
-       int idx;
-
-       idx = context - 1;
-       if (fpriv &&
-           context != DRM_KERNEL_CONTEXT && fpriv->hw_state[idx] != NULL) {
-               kfree(fpriv->hw_state[idx]);
-               fpriv->hw_state[idx] = NULL;
-       }
-}
-
-static void ffb_driver_pretakedown(drm_device_t * dev)
-{
-       kfree(dev->dev_private);
-}
-
-static int ffb_driver_postcleanup(drm_device_t * dev)
-{
-       kfree(ffb_position);
-       return 0;
-}
-
-static void ffb_driver_kernel_context_switch_unlock(struct drm_device *dev,
-                                                   drm_lock_t * lock)
-{
-       dev->lock.filp = 0;
-       {
-               __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
-               unsigned int old, new, prev, ctx;
-
-               ctx = lock->context;
-               do {
-                       old = *plock;
-                       new = ctx;
-                       prev = cmpxchg(plock, old, new);
-               } while (prev != old);
-       }
-       wake_up_interruptible(&dev->lock.lock_queue);
-}
-
-static unsigned long ffb_driver_get_map_ofs(drm_map_t * map)
-{
-       return (map->offset & 0xffffffff);
-}
-
-static unsigned long ffb_driver_get_reg_ofs(drm_device_t * dev)
-{
-       ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
-
-       if (ffb_priv)
-               return ffb_priv->card_phys_base;
-
-       return 0;
-}
-
-static int postinit(struct drm_device *dev, unsigned long flags)
-{
-       DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-                DRIVER_NAME,
-                DRIVER_MAJOR,
-                DRIVER_MINOR, DRIVER_PATCHLEVEL, DRIVER_DATE, dev->minor);
-       return 0;
-}
-
-static int version(drm_version_t * version)
-{
-       int len;
-
-       version->version_major = DRIVER_MAJOR;
-       version->version_minor = DRIVER_MINOR;
-       version->version_patchlevel = DRIVER_PATCHLEVEL;
-       DRM_COPY(version->name, DRIVER_NAME);
-       DRM_COPY(version->date, DRIVER_DATE);
-       DRM_COPY(version->desc, DRIVER_DESC);
-       return 0;
-}
-
-static drm_ioctl_desc_t ioctls[] = {
-
-};
-
-static struct drm_driver driver = {
-       .driver_features = 0,
-       .dev_priv_size = sizeof(u32),
-       .release = ffb_driver_release,
-       .presetup = ffb_presetup,
-       .pretakedown = ffb_driver_pretakedown,
-       .postcleanup = ffb_driver_postcleanup,
-       .kernel_context_switch = ffb_driver_context_switch,
-       .kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock,
-       .get_map_ofs = ffb_driver_get_map_ofs,
-       .get_reg_ofs = ffb_driver_get_reg_ofs,
-       .postinit = postinit,
-       .version = version,
-       .ioctls = ioctls,
-       .num_ioctls = DRM_ARRAY_SIZE(ioctls),
-       .fops = {
-                .owner = THIS_MODULE,
-                .open = drm_open,
-                .release = drm_release,
-                .ioctl = drm_ioctl,
-                .mmap = drm_mmap,
-                .poll = drm_poll,
-                .fasync = drm_fasync,
-                }
-       ,
-};
-
-static int __init ffb_init(void)
-{
-       return -ENODEV;
-}
-
-static void __exit ffb_exit(void)
-{
-}
-
-module_init(ffb_init);
-module_exit(ffb_exit);
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/char/drm/ffb_drv.h b/drivers/char/drm/ffb_drv.h
deleted file mode 100644 (file)
index 582afa6..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/* $Id: ffb_drv.h,v 1.1 2000/06/01 04:24:39 davem Exp $
- * ffb_drv.h: Creator/Creator3D direct rendering driver.
- *
- * Copyright (C) 2000 David S. Miller (davem@redhat.com)
- */
-
-/* Auxilliary clips. */
-typedef struct {
-       volatile unsigned int min;
-       volatile unsigned int max;
-} ffb_auxclip, *ffb_auxclipPtr;
-
-/* FFB register set. */
-typedef struct _ffb_fbc {
-       /* Next vertex registers, on the right we list which drawops
-        * use said register and the logical name the register has in
-        * that context.
-        *//* DESCRIPTION          DRAWOP(NAME)    */
-                                       /*0x00*/ unsigned int pad1[3];
-                                       /* Reserved                             */
-                                               /*0x0c*/ volatile unsigned int alpha;
-                                               /* ALPHA Transparency                   */
-                                               /*0x10*/ volatile unsigned int red;
-                                               /* RED                                  */
-                                               /*0x14*/ volatile unsigned int green;
-                                               /* GREEN                                */
-                                               /*0x18*/ volatile unsigned int blue;
-                                               /* BLUE                                 */
-                                               /*0x1c*/ volatile unsigned int z;
-                                               /* DEPTH                                */
-                                               /*0x20*/ volatile unsigned int y;
-                                               /* Y                    triangle(DOYF)  */
-       /*                      aadot(DYF)      */
-       /*                      ddline(DYF)     */
-       /*                      aaline(DYF)     */
-                                               /*0x24*/ volatile unsigned int x;
-                                               /* X                    triangle(DOXF)  */
-       /*                      aadot(DXF)      */
-       /*                      ddline(DXF)     */
-       /*                      aaline(DXF)     */
-                                       /*0x28*/ unsigned int pad2[2];
-                                       /* Reserved                             */
-                                               /*0x30*/ volatile unsigned int ryf;
-                                               /* Y (alias to DOYF)    ddline(RYF)     */
-       /*                      aaline(RYF)     */
-       /*                      triangle(RYF)   */
-                                               /*0x34*/ volatile unsigned int rxf;
-                                               /* X                    ddline(RXF)     */
-       /*                      aaline(RXF)     */
-       /*                      triangle(RXF)   */
-                                       /*0x38*/ unsigned int pad3[2];
-                                       /* Reserved                             */
-                                               /*0x40*/ volatile unsigned int dmyf;
-                                               /* Y (alias to DOYF)    triangle(DMYF)  */
-                                               /*0x44*/ volatile unsigned int dmxf;
-                                               /* X                    triangle(DMXF)  */
-                                       /*0x48*/ unsigned int pad4[2];
-                                       /* Reserved                             */
-                                               /*0x50*/ volatile unsigned int ebyi;
-                                               /* Y (alias to RYI)     polygon(EBYI)   */
-                                               /*0x54*/ volatile unsigned int ebxi;
-                                               /* X                    polygon(EBXI)   */
-                                       /*0x58*/ unsigned int pad5[2];
-                                       /* Reserved                             */
-                                               /*0x60*/ volatile unsigned int by;
-                                               /* Y                    brline(RYI)     */
-       /*                      fastfill(OP)    */
-       /*                      polygon(YI)     */
-       /*                      rectangle(YI)   */
-       /*                      bcopy(SRCY)     */
-       /*                      vscroll(SRCY)   */
-                                               /*0x64*/ volatile unsigned int bx;
-                                               /* X                    brline(RXI)     */
-       /*                      polygon(XI)     */
-       /*                      rectangle(XI)   */
-       /*                      bcopy(SRCX)     */
-       /*                      vscroll(SRCX)   */
-       /*                      fastfill(GO)    */
-                                               /*0x68*/ volatile unsigned int dy;
-                                               /* destination Y        fastfill(DSTY)  */
-       /*                      bcopy(DSRY)     */
-       /*                      vscroll(DSRY)   */
-                                               /*0x6c*/ volatile unsigned int dx;
-                                               /* destination X        fastfill(DSTX)  */
-       /*                      bcopy(DSTX)     */
-       /*                      vscroll(DSTX)   */
-                                               /*0x70*/ volatile unsigned int bh;
-                                               /* Y (alias to RYI)     brline(DYI)     */
-       /*                      dot(DYI)        */
-       /*                      polygon(ETYI)   */
-       /* Height               fastfill(H)     */
-       /*                      bcopy(H)        */
-       /*                      vscroll(H)      */
-       /* Y count              fastfill(NY)    */
-                                               /*0x74*/ volatile unsigned int bw;
-                                               /* X                    dot(DXI)        */
-       /*                      brline(DXI)     */
-       /*                      polygon(ETXI)   */
-       /*                      fastfill(W)     */
-       /*                      bcopy(W)        */
-       /*                      vscroll(W)      */
-       /*                      fastfill(NX)    */
-                                       /*0x78*/ unsigned int pad6[2];
-                                       /* Reserved                             */
-                                       /*0x80*/ unsigned int pad7[32];
-                                       /* Reserved                             */
-
-       /* Setup Unit's vertex state register */
-/*100*/ volatile unsigned int suvtx;
-                                       /*104*/ unsigned int pad8[63];
-                                       /* Reserved                             */
-
-       /* Frame Buffer Control Registers */
-                                               /*200*/ volatile unsigned int ppc;
-                                               /* Pixel Processor Control              */
-                                               /*204*/ volatile unsigned int wid;
-                                               /* Current WID                          */
-                                               /*208*/ volatile unsigned int fg;
-                                               /* FG data                              */
-                                               /*20c*/ volatile unsigned int bg;
-                                               /* BG data                              */
-                                               /*210*/ volatile unsigned int consty;
-                                               /* Constant Y                           */
-                                               /*214*/ volatile unsigned int constz;
-                                               /* Constant Z                           */
-                                               /*218*/ volatile unsigned int xclip;
-                                               /* X Clip                               */
-                                               /*21c*/ volatile unsigned int dcss;
-                                               /* Depth Cue Scale Slope                */
-                                               /*220*/ volatile unsigned int vclipmin;
-                                               /* Viewclip XY Min Bounds               */
-                                               /*224*/ volatile unsigned int vclipmax;
-                                               /* Viewclip XY Max Bounds               */
-                                                       /*228*/ volatile unsigned int vclipzmin;
-                                                       /* Viewclip Z Min Bounds                */
-                                                       /*22c*/ volatile unsigned int vclipzmax;
-                                                       /* Viewclip Z Max Bounds                */
-                                               /*230*/ volatile unsigned int dcsf;
-                                               /* Depth Cue Scale Front Bound          */
-                                               /*234*/ volatile unsigned int dcsb;
-                                               /* Depth Cue Scale Back Bound           */
-                                               /*238*/ volatile unsigned int dczf;
-                                               /* Depth Cue Z Front                    */
-                                               /*23c*/ volatile unsigned int dczb;
-                                               /* Depth Cue Z Back                     */
-                                       /*240*/ unsigned int pad9;
-                                       /* Reserved                             */
-                                               /*244*/ volatile unsigned int blendc;
-                                               /* Alpha Blend Control                  */
-                                               /*248*/ volatile unsigned int blendc1;
-                                               /* Alpha Blend Color 1                  */
-                                               /*24c*/ volatile unsigned int blendc2;
-                                               /* Alpha Blend Color 2                  */
-                                               /*250*/ volatile unsigned int fbramitc;
-                                               /* FB RAM Interleave Test Control       */
-                                               /*254*/ volatile unsigned int fbc;
-                                               /* Frame Buffer Control                 */
-                                               /*258*/ volatile unsigned int rop;
-                                               /* Raster OPeration                     */
-                                               /*25c*/ volatile unsigned int cmp;
-                                               /* Frame Buffer Compare                 */
-                                               /*260*/ volatile unsigned int matchab;
-                                               /* Buffer AB Match Mask                 */
-                                               /*264*/ volatile unsigned int matchc;
-                                               /* Buffer C(YZ) Match Mask              */
-                                               /*268*/ volatile unsigned int magnab;
-                                               /* Buffer AB Magnitude Mask             */
-                                               /*26c*/ volatile unsigned int magnc;
-                                               /* Buffer C(YZ) Magnitude Mask          */
-                                               /*270*/ volatile unsigned int fbcfg0;
-                                               /* Frame Buffer Config 0                */
-                                               /*274*/ volatile unsigned int fbcfg1;
-                                               /* Frame Buffer Config 1                */
-                                               /*278*/ volatile unsigned int fbcfg2;
-                                               /* Frame Buffer Config 2                */
-                                               /*27c*/ volatile unsigned int fbcfg3;
-                                               /* Frame Buffer Config 3                */
-                                               /*280*/ volatile unsigned int ppcfg;
-                                               /* Pixel Processor Config               */
-                                               /*284*/ volatile unsigned int pick;
-                                               /* Picking Control                      */
-                                               /*288*/ volatile unsigned int fillmode;
-                                               /* FillMode                             */
-                                               /*28c*/ volatile unsigned int fbramwac;
-                                               /* FB RAM Write Address Control         */
-                                               /*290*/ volatile unsigned int pmask;
-                                               /* RGB PlaneMask                        */
-                                               /*294*/ volatile unsigned int xpmask;
-                                               /* X PlaneMask                          */
-                                               /*298*/ volatile unsigned int ypmask;
-                                               /* Y PlaneMask                          */
-                                               /*29c*/ volatile unsigned int zpmask;
-                                               /* Z PlaneMask                          */
-                                       /*2a0*/ ffb_auxclip auxclip[4];
-                                       /* Auxilliary Viewport Clip             */
-
-       /* New 3dRAM III support regs */
-/*2c0*/ volatile unsigned int rawblend2;
-/*2c4*/ volatile unsigned int rawpreblend;
-/*2c8*/ volatile unsigned int rawstencil;
-/*2cc*/ volatile unsigned int rawstencilctl;
-/*2d0*/ volatile unsigned int threedram1;
-/*2d4*/ volatile unsigned int threedram2;
-/*2d8*/ volatile unsigned int passin;
-/*2dc*/ volatile unsigned int rawclrdepth;
-/*2e0*/ volatile unsigned int rawpmask;
-/*2e4*/ volatile unsigned int rawcsrc;
-/*2e8*/ volatile unsigned int rawmatch;
-/*2ec*/ volatile unsigned int rawmagn;
-/*2f0*/ volatile unsigned int rawropblend;
-/*2f4*/ volatile unsigned int rawcmp;
-/*2f8*/ volatile unsigned int rawwac;
-/*2fc*/ volatile unsigned int fbramid;
-
-                                               /*300*/ volatile unsigned int drawop;
-                                               /* Draw OPeration                       */
-                                       /*304*/ unsigned int pad10[2];
-                                       /* Reserved                             */
-                                               /*30c*/ volatile unsigned int lpat;
-                                               /* Line Pattern control                 */
-                                       /*310*/ unsigned int pad11;
-                                       /* Reserved                             */
-                                               /*314*/ volatile unsigned int fontxy;
-                                               /* XY Font coordinate                   */
-                                               /*318*/ volatile unsigned int fontw;
-                                               /* Font Width                           */
-                                               /*31c*/ volatile unsigned int fontinc;
-                                               /* Font Increment                       */
-                                               /*320*/ volatile unsigned int font;
-                                               /* Font bits                            */
-                                       /*324*/ unsigned int pad12[3];
-                                       /* Reserved                             */
-/*330*/ volatile unsigned int blend2;
-/*334*/ volatile unsigned int preblend;
-/*338*/ volatile unsigned int stencil;
-/*33c*/ volatile unsigned int stencilctl;
-
-                                       /*340*/ unsigned int pad13[4];
-                                       /* Reserved                             */
-                                               /*350*/ volatile unsigned int dcss1;
-                                               /* Depth Cue Scale Slope 1              */
-                                               /*354*/ volatile unsigned int dcss2;
-                                               /* Depth Cue Scale Slope 2              */
-                                               /*358*/ volatile unsigned int dcss3;
-                                               /* Depth Cue Scale Slope 3              */
-/*35c*/ volatile unsigned int widpmask;
-/*360*/ volatile unsigned int dcs2;
-/*364*/ volatile unsigned int dcs3;
-/*368*/ volatile unsigned int dcs4;
-                                       /*36c*/ unsigned int pad14;
-                                       /* Reserved                             */
-/*370*/ volatile unsigned int dcd2;
-/*374*/ volatile unsigned int dcd3;
-/*378*/ volatile unsigned int dcd4;
-                                       /*37c*/ unsigned int pad15;
-                                       /* Reserved                             */
-                                                       /*380*/ volatile unsigned int pattern[32];
-                                                       /* area Pattern                         */
-                                       /*400*/ unsigned int pad16[8];
-                                       /* Reserved                             */
-                                               /*420*/ volatile unsigned int reset;
-                                               /* chip RESET                           */
-                                               /*424*/ unsigned int pad17[247];
-                                               /* Reserved                             */
-                                               /*800*/ volatile unsigned int devid;
-                                               /* Device ID                            */
-                                       /*804*/ unsigned int pad18[63];
-                                       /* Reserved                             */
-                                               /*900*/ volatile unsigned int ucsr;
-                                               /* User Control & Status Register       */
-                                       /*904*/ unsigned int pad19[31];
-                                       /* Reserved                             */
-                                               /*980*/ volatile unsigned int mer;
-                                               /* Mode Enable Register                 */
-                                               /*984*/ unsigned int pad20[1439];
-                                               /* Reserved                             */
-} ffb_fbc, *ffb_fbcPtr;
-
-struct ffb_hw_context {
-       int is_2d_only;
-
-       unsigned int ppc;
-       unsigned int wid;
-       unsigned int fg;
-       unsigned int bg;
-       unsigned int consty;
-       unsigned int constz;
-       unsigned int xclip;
-       unsigned int dcss;
-       unsigned int vclipmin;
-       unsigned int vclipmax;
-       unsigned int vclipzmin;
-       unsigned int vclipzmax;
-       unsigned int dcsf;
-       unsigned int dcsb;
-       unsigned int dczf;
-       unsigned int dczb;
-       unsigned int blendc;
-       unsigned int blendc1;
-       unsigned int blendc2;
-       unsigned int fbc;
-       unsigned int rop;
-       unsigned int cmp;
-       unsigned int matchab;
-       unsigned int matchc;
-       unsigned int magnab;
-       unsigned int magnc;
-       unsigned int pmask;
-       unsigned int xpmask;
-       unsigned int ypmask;
-       unsigned int zpmask;
-       unsigned int auxclip0min;
-       unsigned int auxclip0max;
-       unsigned int auxclip1min;
-       unsigned int auxclip1max;
-       unsigned int auxclip2min;
-       unsigned int auxclip2max;
-       unsigned int auxclip3min;
-       unsigned int auxclip3max;
-       unsigned int drawop;
-       unsigned int lpat;
-       unsigned int fontxy;
-       unsigned int fontw;
-       unsigned int fontinc;
-       unsigned int area_pattern[32];
-       unsigned int ucsr;
-       unsigned int stencil;
-       unsigned int stencilctl;
-       unsigned int dcss1;
-       unsigned int dcss2;
-       unsigned int dcss3;
-       unsigned int dcs2;
-       unsigned int dcs3;
-       unsigned int dcs4;
-       unsigned int dcd2;
-       unsigned int dcd3;
-       unsigned int dcd4;
-       unsigned int mer;
-};
-
-#define FFB_MAX_CTXS   32
-
-enum ffb_chip_type {
-       ffb1_prototype = 0,     /* Early pre-FCS FFB */
-       ffb1_standard,          /* First FCS FFB, 100Mhz UPA, 66MHz gclk */
-       ffb1_speedsort,         /* Second FCS FFB, 100Mhz UPA, 75MHz gclk */
-       ffb2_prototype,         /* Early pre-FCS vertical FFB2 */
-       ffb2_vertical,          /* First FCS FFB2/vertical, 100Mhz UPA, 100MHZ gclk,
-                                  75(SingleBuffer)/83(DoubleBuffer) MHz fclk */
-       ffb2_vertical_plus,     /* Second FCS FFB2/vertical, same timings */
-       ffb2_horizontal,        /* First FCS FFB2/horizontal, same timings as FFB2/vert */
-       ffb2_horizontal_plus,   /* Second FCS FFB2/horizontal, same timings */
-       afb_m3,                 /* FCS Elite3D, 3 float chips */
-       afb_m6                  /* FCS Elite3D, 6 float chips */
-};
-
-typedef struct ffb_dev_priv {
-       /* Misc software state. */
-       int prom_node;
-       enum ffb_chip_type ffb_type;
-       u64 card_phys_base;
-       struct miscdevice miscdev;
-
-       /* Controller registers. */
-       ffb_fbcPtr regs;
-
-       /* Context table. */
-       struct ffb_hw_context *hw_state[FFB_MAX_CTXS];
-} ffb_dev_priv_t;
-
-extern unsigned long ffb_get_unmapped_area(struct file *filp,
-                                          unsigned long hint,
-                                          unsigned long len,
-                                          unsigned long pgoff,
-                                          unsigned long flags);
-extern void ffb_set_context_ioctls(void);
-extern drm_ioctl_desc_t DRM(ioctls)[];
-
-extern int ffb_driver_context_switch(drm_device_t * dev, int old, int new);
index 337bbcd..8ea0275 100644 (file)
@@ -710,12 +710,6 @@ void gs_close(struct tty_struct * tty, struct file * filp)
 }
 
 
-static unsigned int     gs_baudrates[] = {
-  0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
-  9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
-};
-
-
 void gs_set_termios (struct tty_struct * tty, 
                      struct ktermios * old_termios)
 {
@@ -771,7 +765,6 @@ void gs_set_termios (struct tty_struct * tty,
 
        baudrate = tty_get_baud_rate(tty);
 
-       baudrate = gs_baudrates[baudrate];
        if ((tiosp->c_cflag & CBAUD) == B38400) {
                if (     (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
                        baudrate = 57600;
index 1fa2da8..c9f2dd6 100644 (file)
@@ -1039,10 +1039,22 @@ int vt_waitactive(int vt)
 
        add_wait_queue(&vt_activate_queue, &wait);
        for (;;) {
-               set_current_state(TASK_INTERRUPTIBLE);
                retval = 0;
-               if (vt == fg_console)
+
+               /*
+                * Synchronize with redraw_screen(). By acquiring the console
+                * semaphore we make sure that the console switch is completed
+                * before we return. If we didn't wait for the semaphore, we
+                * could return at a point where fg_console has already been
+                * updated, but the console switch hasn't been completed.
+                */
+               acquire_console_sem();
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (vt == fg_console) {
+                       release_console_sem();
                        break;
+               }
+               release_console_sem();
                retval = -EINTR;
                if (signal_pending(current))
                        break;
index d42060e..5ac309e 100644 (file)
@@ -90,7 +90,7 @@ __setup("acpi_pm_good", acpi_pm_good_setup);
 static inline void acpi_pm_need_workaround(void)
 {
        clocksource_acpi_pm.read = acpi_pm_read_slow;
-       clocksource_acpi_pm.rating = 110;
+       clocksource_acpi_pm.rating = 120;
 }
 
 /*
index f52facc..3162010 100644 (file)
@@ -1015,6 +1015,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
 {
        unsigned int cpu = sys_dev->id;
        int retval;
+
+       if (cpu_is_offline(cpu))
+               return 0;
+
        if (unlikely(lock_policy_rwsem_write(cpu)))
                BUG();
 
index 9e91362..74edb1d 100644 (file)
@@ -19,8 +19,8 @@
 /* There is only *one* pci_eisa device per machine, right ? */
 static struct eisa_root_device pci_eisa_root;
 
-static int __devinit pci_eisa_init (struct pci_dev *pdev,
-                                   const struct pci_device_id *ent)
+static int __init pci_eisa_init(struct pci_dev *pdev,
+                               const struct pci_device_id *ent)
 {
        int rc;
 
index e15f9e3..0c70f82 100644 (file)
@@ -254,7 +254,8 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr,
                        break;
 
                case I2C_SMBUS_BLOCK_PROC_CALL:
-                       len = min_t(u8, data->block[0], 31);
+                       len = min_t(u8, data->block[0],
+                                   I2C_SMBUS_BLOCK_MAX - 1);
                        amd_ec_write(smbus, AMD_SMB_CMD, command);
                        amd_ec_write(smbus, AMD_SMB_BCNT, len);
                        for (i = 0; i < len; i++)
index 6569a36..a320e7d 100644 (file)
@@ -97,6 +97,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
                                  int command, int hwpec);
 
 static unsigned long i801_smba;
+static unsigned char i801_original_hstcfg;
 static struct pci_driver i801_driver;
 static struct pci_dev *I801_dev;
 static int isich4;
@@ -510,6 +511,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
        }
 
        pci_read_config_byte(I801_dev, SMBHSTCFG, &temp);
+       i801_original_hstcfg = temp;
        temp &= ~SMBHSTCFG_I2C_EN;      /* SMBus timing */
        if (!(temp & SMBHSTCFG_HST_EN)) {
                dev_info(&dev->dev, "Enabling SMBus device\n");
@@ -543,6 +545,7 @@ exit:
 static void __devexit i801_remove(struct pci_dev *dev)
 {
        i2c_del_adapter(&i801_adapter);
+       pci_write_config_byte(I801_dev, SMBHSTCFG, i801_original_hstcfg);
        pci_release_region(dev, SMBBAR);
        /*
         * do not call pci_disable_device(dev) since it can cause hard hangs on
@@ -550,11 +553,33 @@ static void __devexit i801_remove(struct pci_dev *dev)
         */
 }
 
+#ifdef CONFIG_PM
+static int i801_suspend(struct pci_dev *dev, pm_message_t mesg)
+{
+       pci_save_state(dev);
+       pci_write_config_byte(dev, SMBHSTCFG, i801_original_hstcfg);
+       pci_set_power_state(dev, pci_choose_state(dev, mesg));
+       return 0;
+}
+
+static int i801_resume(struct pci_dev *dev)
+{
+       pci_set_power_state(dev, PCI_D0);
+       pci_restore_state(dev);
+       return pci_enable_device(dev);
+}
+#else
+#define i801_suspend NULL
+#define i801_resume NULL
+#endif
+
 static struct pci_driver i801_driver = {
        .name           = "i801_smbus",
        .id_table       = i801_ids,
        .probe          = i801_probe,
        .remove         = __devexit_p(i801_remove),
+       .suspend        = i801_suspend,
+       .resume         = i801_resume,
 };
 
 static int __init i2c_i801_init(void)
index 15edf40..8a2ff0c 100644 (file)
@@ -207,6 +207,10 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind)
        client->driver = &ds1374_driver;
 
        ds1374_workqueue = create_singlethread_workqueue("ds1374");
+       if (!ds1374_workqueue) {
+               kfree(client);
+               return -ENOMEM; /* most expected reason */
+       }
 
        if ((rc = i2c_attach_client(client)) != 0) {
                kfree(client);
index 8f1fd01..ca2e4f8 100644 (file)
@@ -103,8 +103,10 @@ config BLK_DEV_IDE_SATA
        ---help---
          There are two drivers for Serial ATA controllers.
 
-         The main driver, "libata", exists inside the SCSI subsystem
-         and supports most modern SATA controllers.
+         The main driver, "libata", uses the SCSI subsystem
+         and supports most modern SATA controllers. In order to use it
+         you may take a look at "Serial ATA (prod) and Parallel ATA
+         (experimental) drivers".
 
          The IDE driver (which you are currently configuring) supports
          a few first-generation SATA controllers.
index c193553..0e02800 100644 (file)
@@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
        if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)
                try_to_flush_leftover_data(drive);
 
+       if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) {
+               ide_kill_rq(drive, rq);
+               return ide_stopped;
+       }
+
        if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
-               /* force an abort */
-               hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
+               rq->errors |= ERROR_RESET;
 
-       if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
-               ide_kill_rq(drive, rq);
-       else {
-               if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
-                       ++rq->errors;
-                       return ide_do_reset(drive);
-               }
-               if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
-                       drive->special.b.recalibrate = 1;
+       if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
                ++rq->errors;
+               return ide_do_reset(drive);
        }
+
+       if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
+               drive->special.b.recalibrate = 1;
+
+       ++rq->errors;
+
        return ide_stopped;
 }
 
@@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
        if (!drive->special.all) {
                ide_driver_t *drv;
 
+               /*
+                * We reset the drive so we need to issue a SETFEATURES.
+                * Do it _after_ do_special() restored device parameters.
+                */
+               if (drive->current_speed == 0xff)
+                       ide_config_drive_speed(drive, drive->desired_speed);
+
                if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
                    rq->cmd_type == REQ_TYPE_ATA_TASK ||
                    rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
index bd513f5..1ee53a5 100644 (file)
@@ -583,8 +583,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
        if(!(drive->id->hw_config & 0x4000))
                return 0;
 #endif /* CONFIG_IDEDMA_IVB */
-       if (!(drive->id->hw_config & 0x2000))
-               return 0;
+       /*
+        * FIXME:
+        * - change master/slave IDENTIFY order
+        * - force bit13 (80c cable present) check
+        *   (unless the slave device is pre-ATA3)
+        */
        return 1;
 }
 
@@ -1090,6 +1094,9 @@ static void pre_reset(ide_drive_t *drive)
        if (HWIF(drive)->pre_reset != NULL)
                HWIF(drive)->pre_reset(drive);
 
+       if (drive->current_speed != 0xff)
+               drive->desired_speed = drive->current_speed;
+       drive->current_speed = 0xff;
 }
 
 /*
index 695610f..a6f098f 100644 (file)
@@ -1124,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg)
 static int set_using_dma (ide_drive_t *drive, int arg)
 {
 #ifdef CONFIG_BLK_DEV_IDEDMA
+       ide_hwif_t *hwif = drive->hwif;
+       int err = -EPERM;
+
        if (!drive->id || !(drive->id->capability & 1))
-               return -EPERM;
-       if (HWIF(drive)->ide_dma_check == NULL)
-               return -EPERM;
+               goto out;
+
+       if (hwif->ide_dma_check == NULL)
+               goto out;
+
+       err = -EBUSY;
+       if (ide_spin_wait_hwgroup(drive))
+               goto out;
+       /*
+        * set ->busy flag, unlock and let it ride
+        */
+       hwif->hwgroup->busy = 1;
+       spin_unlock_irq(&ide_lock);
+
+       err = 0;
+
        if (arg) {
-               if (ide_set_dma(drive))
-                       return -EIO;
-               if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
+               if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
+                       err = -EIO;
        } else
                ide_dma_off(drive);
-       return 0;
+
+       /*
+        * lock, clear ->busy flag and unlock before leaving
+        */
+       spin_lock_irq(&ide_lock);
+       hwif->hwgroup->busy = 0;
+       spin_unlock_irq(&ide_lock);
+out:
+       return err;
 #else
        return -EPERM;
 #endif
index 6ceb25b..ace9892 100644 (file)
@@ -255,7 +255,7 @@ static int config_chipset_for_dma(ide_drive_t *drive)
                printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
        }
 
-       if (drive->media != ide_disk)
+       if (drive->media != ide_disk && drive->media != ide_cdrom)
                return 0;
 
        if (id->capability & 4) {
@@ -545,6 +545,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
 
        hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
 
+       hwif->atapi_dma  = 1;
        hwif->ultra_mask = 0x7f;
        hwif->mwdma_mask = 0x07;
 
index a953135..03e44b3 100644 (file)
@@ -584,7 +584,10 @@ static void ether1394_add_host (struct hpsb_host *host)
         }
 
        SET_MODULE_OWNER(dev);
+#if 0
+       /* FIXME - Is this the correct parent device anyway? */
        SET_NETDEV_DEV(dev, &host->device);
+#endif
 
        priv = netdev_priv(dev);
 
index 818cf1a..f5e9aee 100644 (file)
@@ -498,9 +498,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
        u64 sge_cmd, ctx0, ctx1;
        u64 base_addr;
        struct t3_modify_qp_wr *wqe;
-       struct sk_buff *skb = alloc_skb(sizeof(*wqe), GFP_KERNEL);
-
+       struct sk_buff *skb;
 
+       skb = alloc_skb(sizeof(*wqe), GFP_KERNEL);
        if (!skb) {
                PDBG("%s alloc_skb failed\n", __FUNCTION__);
                return -ENOMEM;
@@ -508,7 +508,7 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
        err = cxio_hal_init_ctrl_cq(rdev_p);
        if (err) {
                PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err);
-               return err;
+               goto err;
        }
        rdev_p->ctrl_qp.workq = dma_alloc_coherent(
                                        &(rdev_p->rnic_info.pdev->dev),
@@ -518,7 +518,8 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
                                        GFP_KERNEL);
        if (!rdev_p->ctrl_qp.workq) {
                PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__);
-               return -ENOMEM;
+               err = -ENOMEM;
+               goto err;
        }
        pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping,
                           rdev_p->ctrl_qp.dma_addr);
@@ -556,6 +557,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
             rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2);
        skb->priority = CPL_PRIORITY_CONTROL;
        return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb));
+err:
+       kfree_skb(skb);
+       return err;
 }
 
 static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p)
index f2774ae..24e0df0 100644 (file)
@@ -545,11 +545,14 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
                php = to_iwch_pd(pd);
        if (mr_rereg_mask & IB_MR_REREG_ACCESS)
                mh.attr.perms = iwch_ib_to_tpt_access(acc);
-       if (mr_rereg_mask & IB_MR_REREG_TRANS)
+       if (mr_rereg_mask & IB_MR_REREG_TRANS) {
                ret = build_phys_page_list(buffer_list, num_phys_buf,
                                           iova_start,
                                           &total_size, &npages,
                                           &shift, &page_list);
+               if (ret)
+                       return ret;
+       }
 
        ret = iwch_reregister_mem(rhp, php, &mh, shift, page_list, npages);
        kfree(page_list);
index 20f36bf..f284be1 100644 (file)
@@ -66,7 +66,9 @@
 static void queue_comp_task(struct ehca_cq *__cq);
 
 static struct ehca_comp_pool* pool;
+#ifdef CONFIG_HOTPLUG_CPU
 static struct notifier_block comp_pool_callback_nb;
+#endif
 
 static inline void comp_event_callback(struct ehca_cq *cq)
 {
@@ -733,6 +735,7 @@ static void take_over_work(struct ehca_comp_pool *pool,
 
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
 static int comp_pool_callback(struct notifier_block *nfb,
                              unsigned long action,
                              void *hcpu)
@@ -775,6 +778,7 @@ static int comp_pool_callback(struct notifier_block *nfb,
 
        return NOTIFY_OK;
 }
+#endif
 
 int ehca_create_comp_pool(void)
 {
@@ -805,9 +809,11 @@ int ehca_create_comp_pool(void)
                }
        }
 
+#ifdef CONFIG_HOTPLUG_CPU
        comp_pool_callback_nb.notifier_call = comp_pool_callback;
        comp_pool_callback_nb.priority =0;
        register_cpu_notifier(&comp_pool_callback_nb);
+#endif
 
        printk(KERN_INFO "eHCA scaling code enabled\n");
 
@@ -821,7 +827,9 @@ void ehca_destroy_comp_pool(void)
        if (!ehca_scaling_code)
                return;
 
+#ifdef CONFIG_HOTPLUG_CPU
        unregister_cpu_notifier(&comp_pool_callback_nb);
+#endif
 
        for (i = 0; i < NR_CPUS; i++) {
                if (cpu_online(i))
index 5b40a84..ed55979 100644 (file)
@@ -451,12 +451,18 @@ bail:
        return ret;
 }
 
-static void remove_file(struct dentry *parent, char *name)
+static int remove_file(struct dentry *parent, char *name)
 {
        struct dentry *tmp;
+       int ret;
 
        tmp = lookup_one_len(name, parent, strlen(name));
 
+       if (IS_ERR(tmp)) {
+               ret = PTR_ERR(tmp);
+               goto bail;
+       }
+
        spin_lock(&dcache_lock);
        spin_lock(&tmp->d_lock);
        if (!(d_unhashed(tmp) && tmp->d_inode)) {
@@ -469,6 +475,14 @@ static void remove_file(struct dentry *parent, char *name)
                spin_unlock(&tmp->d_lock);
                spin_unlock(&dcache_lock);
        }
+
+       ret = 0;
+bail:
+       /*
+        * We don't expect clients to care about the return value, but
+        * it's there if they need it.
+        */
+       return ret;
 }
 
 static int remove_device_files(struct super_block *sb,
index 8e4846b..fdb576d 100644 (file)
@@ -881,8 +881,8 @@ int mthca_init_mr_table(struct mthca_dev *dev)
                }
                mpts = mtts = 1 << i;
        } else {
-               mpts = dev->limits.num_mtt_segs;
-               mtts = dev->limits.num_mpts;
+               mtts = dev->limits.num_mtt_segs;
+               mpts = dev->limits.num_mpts;
        }
 
        if (!mthca_is_memfree(dev) &&
index 3484e8b..e70492d 100644 (file)
@@ -452,7 +452,7 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
                           skb->len, tx->mtu);
                ++priv->stats.tx_dropped;
                ++priv->stats.tx_errors;
-               ipoib_cm_skb_too_long(dev, skb, tx->mtu - INFINIBAND_ALEN);
+               ipoib_cm_skb_too_long(dev, skb, tx->mtu - IPOIB_ENCAP_LEN);
                return;
        }
 
@@ -1095,7 +1095,7 @@ static void ipoib_cm_stale_task(struct work_struct *work)
                /* List if sorted by LRU, start from tail,
                 * stop when we see a recently used entry */
                p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list);
-               if (time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT))
+               if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT))
                        break;
                list_del_init(&p->list);
                spin_unlock_irqrestore(&priv->lock, flags);
index f2aa923..ba0ee5c 100644 (file)
@@ -328,9 +328,9 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
        struct ipoib_tx_buf *tx_req;
        u64 addr;
 
-       if (unlikely(skb->len > priv->mcast_mtu + INFINIBAND_ALEN)) {
+       if (unlikely(skb->len > priv->mcast_mtu + IPOIB_ENCAP_LEN)) {
                ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n",
-                          skb->len, priv->mcast_mtu + INFINIBAND_ALEN);
+                          skb->len, priv->mcast_mtu + IPOIB_ENCAP_LEN);
                ++priv->stats.tx_dropped;
                ++priv->stats.tx_errors;
                ipoib_cm_skb_too_long(dev, skb, priv->mcast_mtu);
index f9dbc6f..f2a40ae 100644 (file)
@@ -380,7 +380,7 @@ static void path_rec_completion(int status,
        struct net_device *dev = path->dev;
        struct ipoib_dev_priv *priv = netdev_priv(dev);
        struct ipoib_ah *ah = NULL;
-       struct ipoib_neigh *neigh;
+       struct ipoib_neigh *neigh, *tn;
        struct sk_buff_head skqueue;
        struct sk_buff *skb;
        unsigned long flags;
@@ -418,7 +418,7 @@ static void path_rec_completion(int status,
                while ((skb = __skb_dequeue(&path->queue)))
                        __skb_queue_tail(&skqueue, skb);
 
-               list_for_each_entry(neigh, &path->neigh_list, list) {
+               list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) {
                        kref_get(&path->ah->ref);
                        neigh->ah = path->ah;
                        memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw,
@@ -814,7 +814,7 @@ static void ipoib_set_mcast_list(struct net_device *dev)
        queue_work(ipoib_workqueue, &priv->restart_task);
 }
 
-static void ipoib_neigh_destructor(struct neighbour *n)
+static void ipoib_neigh_cleanup(struct neighbour *n)
 {
        struct ipoib_neigh *neigh;
        struct ipoib_dev_priv *priv = netdev_priv(n->dev);
@@ -822,7 +822,7 @@ static void ipoib_neigh_destructor(struct neighbour *n)
        struct ipoib_ah *ah = NULL;
 
        ipoib_dbg(priv,
-                 "neigh_destructor for %06x " IPOIB_GID_FMT "\n",
+                 "neigh_cleanup for %06x " IPOIB_GID_FMT "\n",
                  IPOIB_QPN(n->ha),
                  IPOIB_GID_RAW_ARG(n->ha + 4));
 
@@ -874,7 +874,7 @@ void ipoib_neigh_free(struct net_device *dev, struct ipoib_neigh *neigh)
 
 static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms)
 {
-       parms->neigh_destructor = ipoib_neigh_destructor;
+       parms->neigh_cleanup = ipoib_neigh_cleanup;
 
        return 0;
 }
index 56c87a8..54fbead 100644 (file)
@@ -644,6 +644,9 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
        struct ipoib_dev_priv *priv = netdev_priv(dev);
        int ret = 0;
 
+       if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags))
+               ib_sa_free_multicast(mcast->mc);
+
        if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) {
                ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n",
                                IPOIB_GID_ARG(mcast->mcmember.mgid));
@@ -655,9 +658,6 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
                        ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret);
        }
 
-       if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags))
-               ib_sa_free_multicast(mcast->mc);
-
        return 0;
 }
 
index 89e3728..278fcbc 100644 (file)
@@ -658,6 +658,7 @@ void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *iser_ctask)
 {
        int deferred;
        int is_rdma_aligned = 1;
+       struct iser_regd_buf *regd;
 
        /* if we were reading, copy back to unaligned sglist,
         * anyway dma_unmap and free the copy
@@ -672,20 +673,20 @@ void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *iser_ctask)
        }
 
        if (iser_ctask->dir[ISER_DIR_IN]) {
-               deferred = iser_regd_buff_release
-                       (&iser_ctask->rdma_regd[ISER_DIR_IN]);
+               regd = &iser_ctask->rdma_regd[ISER_DIR_IN];
+               deferred = iser_regd_buff_release(regd);
                if (deferred) {
-                       iser_err("References remain for BUF-IN rdma reg\n");
-                       BUG();
+                       iser_err("%d references remain for BUF-IN rdma reg\n",
+                                atomic_read(&regd->ref_count));
                }
        }
 
        if (iser_ctask->dir[ISER_DIR_OUT]) {
-               deferred = iser_regd_buff_release
-                       (&iser_ctask->rdma_regd[ISER_DIR_OUT]);
+               regd = &iser_ctask->rdma_regd[ISER_DIR_OUT];
+               deferred = iser_regd_buff_release(regd);
                if (deferred) {
-                       iser_err("References remain for BUF-OUT rdma reg\n");
-                       BUG();
+                       iser_err("%d references remain for BUF-OUT rdma reg\n",
+                                atomic_read(&regd->ref_count));
                }
        }
 
index 63e51dd..00e3160 100644 (file)
@@ -54,7 +54,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
 #define USB_SX353_PRODUCT_ID    0x0022
 
 /* table of devices that work with this driver */
-static struct usb_device_id gigaset_table [] = {
+static const struct usb_device_id gigaset_table [] = {
        { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) },
        { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) },
        { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) },
@@ -2305,7 +2305,7 @@ static void gigaset_disconnect(struct usb_interface *interface)
        gigaset_unassign(cs);
 }
 
-static struct gigaset_ops gigops = {
+static const struct gigaset_ops gigops = {
        gigaset_write_cmd,
        gigaset_write_room,
        gigaset_chars_in_buffer,
index b460a73..6df336b 100644 (file)
@@ -944,8 +944,8 @@ static DEFINE_SPINLOCK(driver_lock);
 struct cardstate *gigaset_get_cs_by_id(int id)
 {
        unsigned long flags;
-       static struct cardstate *ret = NULL;
-       static struct cardstate *cs;
+       struct cardstate *ret = NULL;
+       struct cardstate *cs;
        struct gigaset_driver *drv;
        unsigned i;
 
@@ -999,7 +999,7 @@ void gigaset_debugdrivers(void)
 static struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
 {
        unsigned long flags;
-       static struct cardstate *ret = NULL;
+       struct cardstate *ret = NULL;
        struct gigaset_driver *drv;
        unsigned index;
 
index 4661e2c..cec1ef3 100644 (file)
@@ -409,7 +409,7 @@ static struct reply_t tab_cid[] = /* no dle mode */ //FIXME
 };
 #endif
 
-static struct resp_type_t resp_type[]=
+static const struct resp_type_t resp_type[] =
 {
        /*{"",          RSP_EMPTY,      RT_NOTHING},*/
        {"OK",          RSP_OK,         RT_NOTHING},
@@ -511,7 +511,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
        unsigned char *argv[MAX_REC_PARAMS + 1];
        int params;
        int i, j;
-       struct resp_type_t *rt;
+       const struct resp_type_t *rt;
        int curarg;
        unsigned long flags;
        unsigned next, tail, head;
index 8c0eb52..e0505f2 100644 (file)
@@ -274,7 +274,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
  *        bit 12..10 = number of trailing '1' bits in result
  *        bit 14..13 = number of bits added by stuffing
  */
-static u16 stufftab[5 * 256] = {
+static const u16 stufftab[5 * 256] = {
 // previous 1s = 0:
  0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
  0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f,
@@ -629,7 +629,7 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
  *                  (replacing 8 by 7 to make it fit; the algorithm won't care)
  *        bit 7 set if there are 5 or more "interior" consecutive '1' bits
  */
-static unsigned char bitcounts[256] = {
+static const unsigned char bitcounts[256] = {
   0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
   0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05,
   0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
index c8b7db6..ea44302 100644 (file)
@@ -459,7 +459,7 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag)
        return -EINVAL;
 }
 
-static struct gigaset_ops ops = {
+static const struct gigaset_ops ops = {
        gigaset_write_cmd,
        gigaset_write_room,
        gigaset_chars_in_buffer,
index 04f2ad7..2baef34 100644 (file)
@@ -50,7 +50,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
 #define USB_M105_PRODUCT_ID    0x0009
 
 /* table of devices that work with this driver */
-static struct usb_device_id gigaset_table [] = {
+static const struct usb_device_id gigaset_table [] = {
        { USB_DEVICE(USB_M105_VENDOR_ID, USB_M105_PRODUCT_ID) },
        { }                                     /* Terminating entry */
 };
@@ -860,7 +860,7 @@ static void gigaset_disconnect(struct usb_interface *interface)
        gigaset_unassign(cs);
 }
 
-static struct gigaset_ops ops = {
+static const struct gigaset_ops ops = {
        gigaset_write_cmd,
        gigaset_write_room,
        gigaset_chars_in_buffer,
index 9df9e35..c547a66 100644 (file)
@@ -440,7 +440,7 @@ isar_bh(struct work_struct *work)
 {
        struct BCState *bcs = container_of(work, struct BCState, tqueue);
 
-       BChannel_bh(bcs);
+       BChannel_bh(work);
        if (test_and_clear_bit(B_LL_NOCARRIER, &bcs->event))
                ll_deliver_faxstat(bcs, ISDN_FAX_CLASS1_NOCARR);
        if (test_and_clear_bit(B_LL_CONNECT, &bcs->event))
index bfa0ce4..fbbf9d6 100644 (file)
@@ -618,7 +618,7 @@ static void fix_pmode_dataseg(int seg, struct kvm_save_segment *save)
 {
        struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg];
 
-       if (vmcs_readl(sf->base) == save->base) {
+       if (vmcs_readl(sf->base) == save->base && (save->base & AR_S_MASK)) {
                vmcs_write16(sf->selector, save->selector);
                vmcs_writel(sf->base, save->base);
                vmcs_write32(sf->limit, save->limit);
@@ -1888,6 +1888,27 @@ again:
                [cr2]"i"(offsetof(struct kvm_vcpu, cr2))
              : "cc", "memory" );
 
+       /*
+        * Reload segment selectors ASAP. (it's needed for a functional
+        * kernel: x86 relies on having __KERNEL_PDA in %fs and x86_64
+        * relies on having 0 in %gs for the CPU PDA to work.)
+        */
+       if (fs_gs_ldt_reload_needed) {
+               load_ldt(ldt_sel);
+               load_fs(fs_sel);
+               /*
+                * If we have to reload gs, we must take care to
+                * preserve our gs base.
+                */
+               local_irq_disable();
+               load_gs(gs_sel);
+#ifdef CONFIG_X86_64
+               wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE));
+#endif
+               local_irq_enable();
+
+               reload_tss();
+       }
        ++kvm_stat.exits;
 
        save_msrs(vcpu->guest_msrs, NR_BAD_MSRS);
@@ -1905,22 +1926,6 @@ again:
                kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR);
                r = 0;
        } else {
-               if (fs_gs_ldt_reload_needed) {
-                       load_ldt(ldt_sel);
-                       load_fs(fs_sel);
-                       /*
-                        * If we have to reload gs, we must take care to
-                        * preserve our gs base.
-                        */
-                       local_irq_disable();
-                       load_gs(gs_sel);
-#ifdef CONFIG_X86_64
-                       wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE));
-#endif
-                       local_irq_enable();
-
-                       reload_tss();
-               }
                /*
                 * Profile KVM exit RIPs:
                 */
index 6c06e82..509171c 100644 (file)
@@ -1318,6 +1318,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
        char b[BDEVNAME_SIZE];
        struct kobject *ko;
        char *s;
+       int err;
 
        if (rdev->mddev) {
                MD_BUG();
@@ -1352,20 +1353,35 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
        while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
                *s = '!';
                        
-       list_add(&rdev->same_set, &mddev->disks);
        rdev->mddev = mddev;
        printk(KERN_INFO "md: bind<%s>\n", b);
 
        rdev->kobj.parent = &mddev->kobj;
-       kobject_add(&rdev->kobj);
+       if ((err = kobject_add(&rdev->kobj)))
+               goto fail;
 
        if (rdev->bdev->bd_part)
                ko = &rdev->bdev->bd_part->kobj;
        else
                ko = &rdev->bdev->bd_disk->kobj;
-       sysfs_create_link(&rdev->kobj, ko, "block");
+       if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) {
+               kobject_del(&rdev->kobj);
+               goto fail;
+       }
+       list_add(&rdev->same_set, &mddev->disks);
        bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk);
        return 0;
+
+ fail:
+       printk(KERN_WARNING "md: failed to register dev-%s for %s\n",
+              b, mdname(mddev));
+       return err;
+}
+
+static void delayed_delete(struct work_struct *ws)
+{
+       mdk_rdev_t *rdev = container_of(ws, mdk_rdev_t, del_work);
+       kobject_del(&rdev->kobj);
 }
 
 static void unbind_rdev_from_array(mdk_rdev_t * rdev)
@@ -1380,7 +1396,12 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev)
        printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b));
        rdev->mddev = NULL;
        sysfs_remove_link(&rdev->kobj, "block");
-       kobject_del(&rdev->kobj);
+
+       /* We need to delay this, otherwise we can deadlock when
+        * writing to 'remove' to "dev/state"
+        */
+       INIT_WORK(&rdev->del_work, delayed_delete);
+       schedule_work(&rdev->del_work);
 }
 
 /*
@@ -2966,7 +2987,9 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
        mddev->kobj.k_name = NULL;
        snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
        mddev->kobj.ktype = &md_ktype;
-       kobject_register(&mddev->kobj);
+       if (kobject_register(&mddev->kobj))
+               printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
+                      disk->disk_name);
        return NULL;
 }
 
@@ -3144,9 +3167,12 @@ static int do_md_run(mddev_t * mddev)
                bitmap_destroy(mddev);
                return err;
        }
-       if (mddev->pers->sync_request)
-               sysfs_create_group(&mddev->kobj, &md_redundancy_group);
-       else if (mddev->ro == 2) /* auto-readonly not meaningful */
+       if (mddev->pers->sync_request) {
+               if (sysfs_create_group(&mddev->kobj, &md_redundancy_group))
+                       printk(KERN_WARNING
+                              "md: cannot register extra attributes for %s\n",
+                              mdname(mddev));
+       } else if (mddev->ro == 2) /* auto-readonly not meaningful */
                mddev->ro = 0;
 
        atomic_set(&mddev->writes_pending,0);
@@ -3160,7 +3186,9 @@ static int do_md_run(mddev_t * mddev)
                if (rdev->raid_disk >= 0) {
                        char nm[20];
                        sprintf(nm, "rd%d", rdev->raid_disk);
-                       sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
+                       if (sysfs_create_link(&mddev->kobj, &rdev->kobj, nm))
+                               printk("md: cannot register %s for %s\n",
+                                      nm, mdname(mddev));
                }
        
        set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
@@ -3325,6 +3353,7 @@ static int do_md_stop(mddev_t * mddev, int mode)
                        mddev->queue->merge_bvec_fn = NULL;
                        mddev->queue->unplug_fn = NULL;
                        mddev->queue->issue_flush_fn = NULL;
+                       mddev->queue->backing_dev_info.congested_fn = NULL;
                        if (mddev->pers->sync_request)
                                sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
 
@@ -3371,6 +3400,9 @@ static int do_md_stop(mddev_t * mddev, int mode)
                                sysfs_remove_link(&mddev->kobj, nm);
                        }
 
+               /* make sure all delayed_delete calls have finished */
+               flush_scheduled_work();
+
                export_array(mddev);
 
                mddev->array_size = 0;
@@ -5385,8 +5417,12 @@ static int remove_and_add_spares(mddev_t *mddev)
                                if (mddev->pers->hot_add_disk(mddev,rdev)) {
                                        char nm[20];
                                        sprintf(nm, "rd%d", rdev->raid_disk);
-                                       sysfs_create_link(&mddev->kobj,
-                                                         &rdev->kobj, nm);
+                                       if (sysfs_create_link(&mddev->kobj,
+                                                             &rdev->kobj, nm))
+                                               printk(KERN_WARNING
+                                                      "md: cannot register "
+                                                      "%s for %s\n",
+                                                      nm, mdname(mddev));
                                        spares++;
                                        md_new_event(mddev);
                                } else
index 54a1ad5..8d59914 100644 (file)
@@ -3642,12 +3642,15 @@ static int run(mddev_t *mddev)
        }
 
        /* Ok, everything is just fine now */
-       sysfs_create_group(&mddev->kobj, &raid5_attrs_group);
+       if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
+               printk(KERN_WARNING
+                      "raid5: failed to create sysfs attributes for %s\n",
+                      mdname(mddev));
 
        mddev->queue->unplug_fn = raid5_unplug_device;
        mddev->queue->issue_flush_fn = raid5_issue_flush;
-       mddev->queue->backing_dev_info.congested_fn = raid5_congested;
        mddev->queue->backing_dev_info.congested_data = mddev;
+       mddev->queue->backing_dev_info.congested_fn = raid5_congested;
 
        mddev->array_size =  mddev->size * (conf->previous_raid_disks -
                                            conf->max_degraded);
@@ -3678,6 +3681,7 @@ static int stop(mddev_t *mddev)
        mddev->thread = NULL;
        shrink_stripes(conf);
        kfree(conf->stripe_hashtbl);
+       mddev->queue->backing_dev_info.congested_fn = NULL;
        blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
        sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
        kfree(conf->disks);
@@ -3950,7 +3954,12 @@ static int raid5_start_reshape(mddev_t *mddev)
                                added_devices++;
                                rdev->recovery_offset = 0;
                                sprintf(nm, "rd%d", rdev->raid_disk);
-                               sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
+                               if (sysfs_create_link(&mddev->kobj,
+                                                     &rdev->kobj, nm))
+                                       printk(KERN_WARNING
+                                              "raid5: failed to create "
+                                              " link %s for %s\n",
+                                              nm, mdname(mddev));
                        } else
                                break;
                }
@@ -4104,6 +4113,10 @@ static struct mdk_personality raid4_personality =
        .spare_active   = raid5_spare_active,
        .sync_request   = sync_request,
        .resize         = raid5_resize,
+#ifdef CONFIG_MD_RAID5_RESHAPE
+       .check_reshape  = raid5_check_reshape,
+       .start_reshape  = raid5_start_reshape,
+#endif
        .quiesce        = raid5_quiesce,
 };
 
index cbf7c05..fcb1941 100644 (file)
@@ -310,13 +310,15 @@ void ir_rc5_timer_end(unsigned long data)
                    tv.tv_usec - ir->base_time.tv_usec;
        }
 
-       /* Allow some timmer jitter (RC5 is ~24ms anyway so this is ok) */
+       /* signal we're ready to start a new code */
+       ir->active = 0;
+
+       /* Allow some timer jitter (RC5 is ~24ms anyway so this is ok) */
        if (gap < 28000) {
                dprintk(1, "ir-common: spurious timer_end\n");
                return;
        }
 
-       ir->active = 0;
        if (ir->last_bit < 20) {
                /* ignore spurious codes (caused by light/other remotes) */
                dprintk(1, "ir-common: short code: %x\n", ir->code);
index fc77de4..a5c0e1a 100644 (file)
@@ -180,8 +180,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file)
        struct dvb_device *dvbdev = file->private_data;
        struct dmxdev *dmxdev = dvbdev->priv;
 
-       if (mutex_lock_interruptible(&dmxdev->mutex))
-               return -ERESTARTSYS;
+       mutex_lock(&dmxdev->mutex);
 
        if ((file->f_flags & O_ACCMODE) == O_WRONLY) {
                dmxdev->demux->disconnect_frontend(dmxdev->demux);
@@ -673,13 +672,8 @@ static int dvb_demux_open(struct inode *inode, struct file *file)
 static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev,
                                  struct dmxdev_filter *dmxdevfilter)
 {
-       if (mutex_lock_interruptible(&dmxdev->mutex))
-               return -ERESTARTSYS;
-
-       if (mutex_lock_interruptible(&dmxdevfilter->mutex)) {
-               mutex_unlock(&dmxdev->mutex);
-               return -ERESTARTSYS;
-       }
+       mutex_lock(&dmxdev->mutex);
+       mutex_lock(&dmxdevfilter->mutex);
 
        dvb_dmxdev_filter_stop(dmxdevfilter);
        dvb_dmxdev_filter_reset(dmxdevfilter);
index fcff5ea..6d8d1c3 100644 (file)
@@ -673,8 +673,7 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed *ts_feed)
        struct dvb_demux *demux = feed->demux;
        int ret;
 
-       if (mutex_lock_interruptible(&demux->mutex))
-               return -ERESTARTSYS;
+       mutex_lock(&demux->mutex);
 
        if (feed->state < DMX_STATE_GO) {
                mutex_unlock(&demux->mutex);
@@ -748,8 +747,7 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx,
        struct dvb_demux *demux = (struct dvb_demux *)dmx;
        struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed;
 
-       if (mutex_lock_interruptible(&demux->mutex))
-               return -ERESTARTSYS;
+       mutex_lock(&demux->mutex);
 
        if (feed->state == DMX_STATE_FREE) {
                mutex_unlock(&demux->mutex);
@@ -916,8 +914,7 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed)
        struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
        int ret;
 
-       if (mutex_lock_interruptible(&dvbdmx->mutex))
-               return -ERESTARTSYS;
+       mutex_lock(&dvbdmx->mutex);
 
        if (!dvbdmx->stop_feed) {
                mutex_unlock(&dvbdmx->mutex);
@@ -942,8 +939,7 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed,
        struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
        struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
 
-       if (mutex_lock_interruptible(&dvbdmx->mutex))
-               return -ERESTARTSYS;
+       mutex_lock(&dvbdmx->mutex);
 
        if (dvbdmxfilter->feed != dvbdmxfeed) {
                mutex_unlock(&dvbdmx->mutex);
@@ -1016,8 +1012,7 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux,
        struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
        struct dvb_demux *dvbdmx = (struct dvb_demux *)demux;
 
-       if (mutex_lock_interruptible(&dvbdmx->mutex))
-               return -ERESTARTSYS;
+       mutex_lock(&dvbdmx->mutex);
 
        if (dvbdmxfeed->state == DMX_STATE_FREE) {
                mutex_unlock(&dvbdmx->mutex);
@@ -1126,8 +1121,7 @@ static int dvbdmx_connect_frontend(struct dmx_demux *demux,
        if (demux->frontend)
                return -EINVAL;
 
-       if (mutex_lock_interruptible(&dvbdemux->mutex))
-               return -ERESTARTSYS;
+       mutex_lock(&dvbdemux->mutex);
 
        demux->frontend = frontend;
        mutex_unlock(&dvbdemux->mutex);
@@ -1138,8 +1132,7 @@ static int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
 {
        struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
 
-       if (mutex_lock_interruptible(&dvbdemux->mutex))
-               return -ERESTARTSYS;
+       mutex_lock(&dvbdemux->mutex);
 
        demux->frontend = NULL;
        mutex_unlock(&dvbdemux->mutex);
index 490337b..14a372a 100644 (file)
@@ -203,8 +203,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
 
        int id;
 
-       if (mutex_lock_interruptible(&dvbdev_register_lock))
-               return -ERESTARTSYS;
+       mutex_lock(&dvbdev_register_lock);
 
        if ((id = dvbdev_get_free_id (adap, type)) < 0){
                mutex_unlock(&dvbdev_register_lock);
@@ -294,8 +293,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu
 {
        int num;
 
-       if (mutex_lock_interruptible(&dvbdev_register_lock))
-               return -ERESTARTSYS;
+       mutex_lock(&dvbdev_register_lock);
 
        if ((num = dvbdev_get_free_adapter_num ()) < 0) {
                mutex_unlock(&dvbdev_register_lock);
@@ -323,8 +321,7 @@ EXPORT_SYMBOL(dvb_register_adapter);
 
 int dvb_unregister_adapter(struct dvb_adapter *adap)
 {
-       if (mutex_lock_interruptible(&dvbdev_register_lock))
-               return -ERESTARTSYS;
+       mutex_lock(&dvbdev_register_lock);
        list_del (&adap->list_head);
        mutex_unlock(&dvbdev_register_lock);
        return 0;
index ef31936..c967148 100644 (file)
@@ -122,6 +122,7 @@ struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter
        /* detect if it is present or not */
        if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) {
                kfree(isl6421);
+               fe->sec_priv = NULL;
                return NULL;
        }
 
index 87c286e..b809f83 100644 (file)
@@ -562,7 +562,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
 
                        /* set input */
                        if (state->config->set_pll_input)
-                               state->config->set_pll_input(buf, 1);
+                               state->config->set_pll_input(buf+1, 1);
                        break;
                case VSB_8:
                        /* Set non-punctured clock for VSB */
@@ -571,7 +571,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
 
                        /* set input */
                        if (state->config->set_pll_input)
-                               state->config->set_pll_input(buf, 0);
+                               state->config->set_pll_input(buf+1, 0);
                        break;
                default:
                        return -EINVAL;
index 4c27a2d..ccc429c 100644 (file)
@@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
        for(i=0; i< cmd->msg_len; i++) {
                tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
        }
-       tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len + 1) << 4));
+       tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4));
 
        tda10086_diseqc_wait(state);
 
index ffda71d..058df5c 100644 (file)
@@ -149,6 +149,15 @@ static inline void pluto_rw(struct pluto *pluto, u32 reg, u32 mask, u32 bits)
        writel(val, &pluto->io_mem[reg]);
 }
 
+static void pluto_write_tscr(struct pluto *pluto, u32 val)
+{
+       /* set the number of packets */
+       val &= ~TSCR_ADEF;
+       val |= TS_DMA_PACKETS / 2;
+
+       pluto_writereg(pluto, REG_TSCR, val);
+}
+
 static void pluto_setsda(void *data, int state)
 {
        struct pluto *pluto = data;
@@ -213,11 +222,11 @@ static void pluto_reset_ts(struct pluto *pluto, int reenable)
 
        if (val & TSCR_RSTN) {
                val &= ~TSCR_RSTN;
-               pluto_writereg(pluto, REG_TSCR, val);
+               pluto_write_tscr(pluto, val);
        }
        if (reenable) {
                val |= TSCR_RSTN;
-               pluto_writereg(pluto, REG_TSCR, val);
+               pluto_write_tscr(pluto, val);
        }
 }
 
@@ -339,7 +348,7 @@ static irqreturn_t pluto_irq(int irq, void *dev_id)
        }
 
        /* ACK the interrupt */
-       pluto_writereg(pluto, REG_TSCR, tscr | TSCR_IACK);
+       pluto_write_tscr(pluto, tscr | TSCR_IACK);
 
        return IRQ_HANDLED;
 }
@@ -348,9 +357,6 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto)
 {
        u32 val = pluto_readreg(pluto, REG_TSCR);
 
-       /* set the number of packets */
-       val &= ~TSCR_ADEF;
-       val |= TS_DMA_PACKETS / 2;
        /* disable AFUL and LOCK interrupts */
        val |= (TSCR_MSKA | TSCR_MSKL);
        /* enable DMA and OVERFLOW interrupts */
@@ -358,7 +364,7 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto)
        /* clear pending interrupts */
        val |= TSCR_IACK;
 
-       pluto_writereg(pluto, REG_TSCR, val);
+       pluto_write_tscr(pluto, val);
 }
 
 static void pluto_disable_irqs(struct pluto *pluto)
@@ -370,7 +376,7 @@ static void pluto_disable_irqs(struct pluto *pluto)
        /* clear pending interrupts */
        val |= TSCR_IACK;
 
-       pluto_writereg(pluto, REG_TSCR, val);
+       pluto_write_tscr(pluto, val);
 }
 
 static int __devinit pluto_hw_init(struct pluto *pluto)
index 920b63f..af66a5d 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 menu "Radio Adapters"
-       depends on VIDEO_DEV!=n
+       depends on VIDEO_DEV
 
 config RADIO_CADET
        tristate "ADS Cadet AM/FM Tuner"
index 2fb9fe6..ba1af3c 100644 (file)
@@ -780,18 +780,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
        return 0;
 }
 
-static int msp_suspend(struct device * dev, pm_message_t state)
+static int msp_suspend(struct i2c_client *client, pm_message_t state)
 {
-       struct i2c_client *client = container_of(dev, struct i2c_client, dev);
 
        v4l_dbg(1, msp_debug, client, "suspend\n");
        msp_reset(client);
        return 0;
 }
 
-static int msp_resume(struct device * dev)
+static int msp_resume(struct i2c_client *client)
 {
-       struct i2c_client *client = container_of(dev, struct i2c_client, dev);
 
        v4l_dbg(1, msp_debug, client, "resume\n");
        msp_wake_thread(client);
@@ -825,7 +823,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
        if (msp_reset(client) == -1) {
                v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
                kfree(client);
-               return -1;
+               return 0;
        }
 
        state = kmalloc(sizeof(*state), GFP_KERNEL);
@@ -859,7 +857,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
                v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n");
                kfree(state);
                kfree(client);
-               return -1;
+               return 0;
        }
 
        msp_set_audio(client);
@@ -996,11 +994,11 @@ static struct i2c_driver i2c_driver = {
        .id             = I2C_DRIVERID_MSP3400,
        .attach_adapter = msp_probe,
        .detach_client  = msp_detach,
+       .suspend = msp_suspend,
+       .resume  = msp_resume,
        .command        = msp_command,
        .driver = {
                .name    = "msp3400",
-               .suspend = msp_suspend,
-               .resume  = msp_resume,
        },
 };
 
index 7735b67..4d5bbd8 100644 (file)
@@ -961,7 +961,7 @@ static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
                        reg |= 0x10;
                } else if (std == V4L2_STD_NTSC_M_JP) {
                        reg |= 0x40;
-               } else if (std == V4L2_STD_SECAM) {
+               } else if (std & V4L2_STD_SECAM) {
                        reg |= 0x50;
                }
                saa711x_write(client, R_0E_CHROMA_CNTL_1, reg);
index 7be73e3..15dbc6b 100644 (file)
@@ -804,9 +804,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
        return 0;
 }
 
-static int tuner_suspend(struct device *dev, pm_message_t state)
+static int tuner_suspend(struct i2c_client *c, pm_message_t state)
 {
-       struct i2c_client *c = container_of (dev, struct i2c_client, dev);
        struct tuner *t = i2c_get_clientdata (c);
 
        tuner_dbg ("suspend\n");
@@ -814,9 +813,8 @@ static int tuner_suspend(struct device *dev, pm_message_t state)
        return 0;
 }
 
-static int tuner_resume(struct device *dev)
+static int tuner_resume(struct i2c_client *c)
 {
-       struct i2c_client *c = container_of (dev, struct i2c_client, dev);
        struct tuner *t = i2c_get_clientdata (c);
 
        tuner_dbg ("resume\n");
@@ -837,10 +835,10 @@ static struct i2c_driver driver = {
        .attach_adapter = tuner_probe,
        .detach_client = tuner_detach,
        .command = tuner_command,
+       .suspend = tuner_suspend,
+       .resume  = tuner_resume,
        .driver = {
                .name    = "tuner",
-               .suspend = tuner_suspend,
-               .resume  = tuner_resume,
        },
 };
 static struct i2c_client client_template = {
index 404c014..1d2d03f 100644 (file)
@@ -815,7 +815,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 static int
 mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
 {
-       MPT_SCSI_HOST   *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata;
+       MPT_SCSI_HOST   *hd;
        struct mptsas_target_reset_event *target_reset_list, *n;
        int rc;
 
@@ -827,7 +827,10 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
        if (reset_phase != MPT_IOC_POST_RESET)
                goto out;
 
-       if (!hd || !hd->ioc)
+       if (!ioc->sh || !ioc->sh->hostdata)
+               goto out;
+       hd = (MPT_SCSI_HOST *)ioc->sh->hostdata;
+       if (!hd->ioc)
                goto out;
 
        if (list_empty(&hd->target_reset_list))
index da9859f..b17c4b2 100644 (file)
@@ -390,13 +390,6 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
                return BLKPREP_KILL;
        }
 
-       /* request is already processed by us, so return */
-       if (blk_special_request(req)) {
-               osm_debug("REQ_SPECIAL already set!\n");
-               req->cmd_flags |= REQ_DONTPREP;
-               return BLKPREP_OK;
-       }
-
        /* connect the i2o_block_request to the request */
        if (!req->special) {
                ireq = i2o_block_request_alloc();
@@ -408,11 +401,8 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
                ireq->i2o_blk_dev = i2o_blk_dev;
                req->special = ireq;
                ireq->req = req;
-       } else
-               ireq = req->special;
-
+       }
        /* do not come back here */
-       req->cmd_type = REQ_TYPE_SPECIAL;
        req->cmd_flags |= REQ_DONTPREP;
 
        return BLKPREP_OK;
index c707c8e..b0b4458 100644 (file)
@@ -319,7 +319,7 @@ int sm501_unit_power(struct device *dev, unsigned int unit, unsigned int to)
 
        mode &= 3;              /* get current power mode */
 
-       if (unit > ARRAY_SIZE(sm->unit_power)) {
+       if (unit >= ARRAY_SIZE(sm->unit_power)) {
                dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit);
                goto already;
        }
index 5ff0922..c3f9f59 100644 (file)
@@ -2372,22 +2372,23 @@ config CHELSIO_T1_NAPI
          when the driver is receiving lots of packets from the card.
 
 config CHELSIO_T3
-        tristate "Chelsio Communications T3 10Gb Ethernet support"
-        depends on PCI
-        help
-          This driver supports Chelsio T3-based gigabit and 10Gb Ethernet
-          adapters.
+       tristate "Chelsio Communications T3 10Gb Ethernet support"
+       depends on PCI
+       select FW_LOADER
+       help
+         This driver supports Chelsio T3-based gigabit and 10Gb Ethernet
+         adapters.
 
-          For general information about Chelsio and our products, visit
-          our website at <http://www.chelsio.com>.
+         For general information about Chelsio and our products, visit
+         our website at <http://www.chelsio.com>.
 
-          For customer support, please visit our customer support page at
-          <http://www.chelsio.com/support.htm>.
+         For customer support, please visit our customer support page at
+         <http://www.chelsio.com/support.htm>.
 
-          Please send feedback to <linux-bugs@chelsio.com>.
+         Please send feedback to <linux-bugs@chelsio.com>.
 
-          To compile this driver as a module, choose M here: the module
-          will be called cxgb3.
+         To compile this driver as a module, choose M here: the module
+         will be called cxgb3.
 
 config EHEA
        tristate "eHEA Ethernet support"
index 314dbaa..69482e0 100644 (file)
@@ -334,7 +334,6 @@ u32 atl1_hash_mc_addr(struct atl1_hw *hw, u8 *mc_addr)
        int i;
 
        crc32 = ether_crc_le(6, mc_addr);
-       crc32 = ~crc32;
        for (i = 0; i < 32; i++)
                value |= (((crc32 >> i) & 1) << (31 - i));
 
index dee3638..8606eac 100644 (file)
@@ -2320,6 +2320,16 @@ static void __devexit atl1_remove(struct pci_dev *pdev)
                return;
 
        adapter = netdev_priv(netdev);
+
+       /* Some atl1 boards lack persistent storage for their MAC, and get it
+        * from the BIOS during POST.  If we've been messing with the MAC
+        * address, we need to save the permanent one.
+        */
+       if (memcmp(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN)) {
+               memcpy(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN);
+               atl1_set_mac_addr(&adapter->hw);
+       }
+
        iowrite16(0, adapter->hw.hw_addr + REG_GPHY_ENABLE);
        unregister_netdev(netdev);
        pci_iounmap(pdev, adapter->hw.hw_addr);
index aaada57..d742bfe 100644 (file)
@@ -1709,7 +1709,7 @@ static void __b44_set_rx_mode(struct net_device *dev)
                bw32(bp, B44_RXCONFIG, val);
        } else {
                unsigned char zero[6] = {0, 0, 0, 0, 0, 0};
-               int i = 0;
+               int i = 1;
 
                __b44_set_mac_addr(bp);
 
index c12e5ea..0b7aded 100644 (file)
@@ -54,8 +54,8 @@
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.5.5"
-#define DRV_MODULE_RELDATE     "February 1, 2007"
+#define DRV_MODULE_VERSION     "1.5.7"
+#define DRV_MODULE_RELDATE     "March 29, 2007"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -2033,8 +2033,8 @@ bnx2_has_work(struct bnx2 *bp)
            (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
                return 1;
 
-       if (((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != 0) !=
-           bp->link_up)
+       if ((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) !=
+           (sblk->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE))
                return 1;
 
        return 0;
@@ -3099,20 +3099,18 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
 
        if ((align_start = (offset32 & 3))) {
                offset32 &= ~3;
-               len32 += (4 - align_start);
+               len32 += align_start;
+               if (len32 < 4)
+                       len32 = 4;
                if ((rc = bnx2_nvram_read(bp, offset32, start, 4)))
                        return rc;
        }
 
        if (len32 & 3) {
-               if ((len32 > 4) || !align_start) {
-                       align_end = 4 - (len32 & 3);
-                       len32 += align_end;
-                       if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4,
-                               end, 4))) {
-                               return rc;
-                       }
-               }
+               align_end = 4 - (len32 & 3);
+               len32 += align_end;
+               if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4, end, 4)))
+                       return rc;
        }
 
        if (align_start || align_end) {
@@ -3187,17 +3185,17 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
                if ((rc = bnx2_enable_nvram_write(bp)) != 0)
                        goto nvram_write_end;
 
-               /* Erase the page */
-               if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
-                       goto nvram_write_end;
-
-               /* Re-enable the write again for the actual write */
-               bnx2_enable_nvram_write(bp);
-
                /* Loop to write back the buffer data from page_start to
                 * data_start */
                i = 0;
                if (bp->flash_info->buffered == 0) {
+                       /* Erase the page */
+                       if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
+                               goto nvram_write_end;
+
+                       /* Re-enable the write again for the actual write */
+                       bnx2_enable_nvram_write(bp);
+
                        for (addr = page_start; addr < data_start;
                                addr += 4, i += 4) {
 
index e23deeb..97128d8 100644 (file)
@@ -112,8 +112,7 @@ enum {
 };
 
 enum {
-       SUPPORTED_OFFLOAD = 1 << 24,
-       SUPPORTED_IRQ = 1 << 25
+       SUPPORTED_IRQ      = 1 << 24
 };
 
 enum {                         /* adapter interrupt-maintained statistics */
@@ -260,6 +259,10 @@ struct mac_stats {
        unsigned long serdes_signal_loss;
        unsigned long xaui_pcs_ctc_err;
        unsigned long xaui_pcs_align_change;
+
+       unsigned long num_toggled; /* # times toggled TxEn due to stuck TX */
+       unsigned long num_resets;  /* # times reset due to stuck TX */
+
 };
 
 struct tp_mib_stats {
@@ -354,6 +357,9 @@ enum {
        MC5_MODE_72_BIT = 2
 };
 
+/* MC5 min active region size */
+enum { MC5_MIN_TIDS = 16 };
+
 struct vpd_params {
        unsigned int cclk;
        unsigned int mclk;
@@ -398,6 +404,13 @@ struct adapter_params {
        unsigned int stats_update_period;       /* MAC stats accumulation period */
        unsigned int linkpoll_period;   /* link poll period in 0.1s */
        unsigned int rev;       /* chip revision */
+       unsigned int offload;
+};
+
+enum {                                     /* chip revisions */
+       T3_REV_A  = 0,
+       T3_REV_B  = 2,
+       T3_REV_B2 = 3,
 };
 
 struct trace_params {
@@ -465,6 +478,10 @@ struct cmac {
        struct adapter *adapter;
        unsigned int offset;
        unsigned int nucast;    /* # of address filters for unicast MACs */
+       unsigned int tcnt;
+       unsigned int xcnt;
+       unsigned int toggle_cnt;
+       unsigned int txen;
        struct mac_stats stats;
 };
 
@@ -588,7 +605,7 @@ static inline int is_10G(const struct adapter *adap)
 
 static inline int is_offload(const struct adapter *adap)
 {
-       return adapter_info(adap)->caps & SUPPORTED_OFFLOAD;
+       return adap->params.offload;
 }
 
 static inline unsigned int core_ticks_per_usec(const struct adapter *adap)
@@ -666,6 +683,7 @@ int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]);
 int t3_mac_set_num_ucast(struct cmac *mac, int n);
 const struct mac_stats *t3_mac_update_stats(struct cmac *mac);
 int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc);
+int t3b2_mac_watchdog_task(struct cmac *mac);
 
 void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode);
 int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters,
index 7ff834e..26240fd 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/workqueue.h>
 #include <linux/proc_fs.h>
 #include <linux/rtnetlink.h>
+#include <linux/firmware.h>
 #include <asm/uaccess.h>
 
 #include "common.h"
@@ -184,16 +185,26 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
                        int speed, int duplex, int pause)
 {
        struct net_device *dev = adapter->port[port_id];
+       struct port_info *pi = netdev_priv(dev);
+       struct cmac *mac = &pi->mac;
 
        /* Skip changes from disabled ports. */
        if (!netif_running(dev))
                return;
 
        if (link_stat != netif_carrier_ok(dev)) {
-               if (link_stat)
+               if (link_stat) {
+                       t3_set_reg_field(adapter,
+                                        A_XGM_TXFIFO_CFG + mac->offset,
+                                        F_ENDROPPKT, 0);
                        netif_carrier_on(dev);
-               else
+               } else {
                        netif_carrier_off(dev);
+                       t3_set_reg_field(adapter,
+                                        A_XGM_TXFIFO_CFG + mac->offset,
+                                        F_ENDROPPKT, F_ENDROPPKT);
+               }
+
                link_report(dev);
        }
 }
@@ -406,7 +417,7 @@ static void quiesce_rx(struct adapter *adap)
 static int setup_sge_qsets(struct adapter *adap)
 {
        int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0;
-       unsigned int ntxq = is_offload(adap) ? SGE_TXQ_PER_SET : 1;
+       unsigned int ntxq = SGE_TXQ_PER_SET;
 
        if (adap->params.rev > 0 && !(adap->flags & USING_MSI))
                irq_idx = -1;
@@ -484,12 +495,14 @@ static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
 static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
 {
        struct adapter *adap = dev->priv;
+       int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
 
        if (adap->flags & FULL_INIT_DONE)
                return -EBUSY;
        if (val && adap->params.rev == 0)
                return -EINVAL;
-       if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers)
+       if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers -
+           min_tids)
                return -EINVAL;
        adap->params.mc5.nfilters = val;
        return 0;
@@ -507,7 +520,8 @@ static ssize_t set_nservers(struct net_device *dev, unsigned int val)
 
        if (adap->flags & FULL_INIT_DONE)
                return -EBUSY;
-       if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters)
+       if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters -
+           MC5_MIN_TIDS)
                return -EINVAL;
        adap->params.mc5.nservers = val;
        return 0;
@@ -707,6 +721,28 @@ static void bind_qsets(struct adapter *adap)
        }
 }
 
+#define FW_FNAME "t3fw-%d.%d.%d.bin"
+
+static int upgrade_fw(struct adapter *adap)
+{
+       int ret;
+       char buf[64];
+       const struct firmware *fw;
+       struct device *dev = &adap->pdev->dev;
+
+       snprintf(buf, sizeof(buf), FW_FNAME, FW_VERSION_MAJOR,
+                FW_VERSION_MINOR, FW_VERSION_MICRO);
+       ret = request_firmware(&fw, buf, dev);
+       if (ret < 0) {
+               dev_err(dev, "could not upgrade firmware: unable to load %s\n",
+                       buf);
+               return ret;
+       }
+       ret = t3_load_fw(adap, fw->data, fw->size);
+       release_firmware(fw);
+       return ret;
+}
+
 /**
  *     cxgb_up - enable the adapter
  *     @adapter: adapter being enabled
@@ -723,6 +759,8 @@ static int cxgb_up(struct adapter *adap)
 
        if (!(adap->flags & FULL_INIT_DONE)) {
                err = t3_check_fw_version(adap);
+               if (err == -EINVAL)
+                       err = upgrade_fw(adap);
                if (err)
                        goto out;
 
@@ -894,7 +932,7 @@ static int cxgb_open(struct net_device *dev)
                return err;
 
        set_bit(pi->port_id, &adapter->open_device_map);
-       if (!ofld_disable) {
+       if (is_offload(adapter) && !ofld_disable) {
                err = offload_open(dev);
                if (err)
                        printk(KERN_WARNING
@@ -1031,7 +1069,11 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
        "VLANinsertions     ",
        "TxCsumOffload      ",
        "RxCsumGood         ",
-       "RxDrops            "
+       "RxDrops            ",
+
+       "CheckTXEnToggled   ",
+       "CheckResets        ",
+
 };
 
 static int get_stats_count(struct net_device *dev)
@@ -1145,6 +1187,9 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
        *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_TX_CSUM);
        *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_RX_CSUM_GOOD);
        *data++ = s->rx_cong_drops;
+
+       *data++ = s->num_toggled;
+       *data++ = s->num_resets;
 }
 
 static inline void reg_block_dump(struct adapter *ap, void *buf,
@@ -1362,23 +1407,27 @@ static int set_rx_csum(struct net_device *dev, u32 data)
 
 static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
 {
-       struct adapter *adapter = dev->priv;
+       const struct adapter *adapter = dev->priv;
+       const struct port_info *pi = netdev_priv(dev);
+       const struct qset_params *q = &adapter->params.sge.qset[pi->first_qset];
 
        e->rx_max_pending = MAX_RX_BUFFERS;
        e->rx_mini_max_pending = 0;
        e->rx_jumbo_max_pending = MAX_RX_JUMBO_BUFFERS;
        e->tx_max_pending = MAX_TXQ_ENTRIES;
 
-       e->rx_pending = adapter->params.sge.qset[0].fl_size;
-       e->rx_mini_pending = adapter->params.sge.qset[0].rspq_size;
-       e->rx_jumbo_pending = adapter->params.sge.qset[0].jumbo_size;
-       e->tx_pending = adapter->params.sge.qset[0].txq_size[0];
+       e->rx_pending = q->fl_size;
+       e->rx_mini_pending = q->rspq_size;
+       e->rx_jumbo_pending = q->jumbo_size;
+       e->tx_pending = q->txq_size[0];
 }
 
 static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
 {
        int i;
+       struct qset_params *q;
        struct adapter *adapter = dev->priv;
+       const struct port_info *pi = netdev_priv(dev);
 
        if (e->rx_pending > MAX_RX_BUFFERS ||
            e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS ||
@@ -1393,9 +1442,8 @@ static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
        if (adapter->flags & FULL_INIT_DONE)
                return -EBUSY;
 
-       for (i = 0; i < SGE_QSETS; ++i) {
-               struct qset_params *q = &adapter->params.sge.qset[i];
-
+       q = &adapter->params.sge.qset[pi->first_qset];
+       for (i = 0; i < pi->nqsets; ++i, ++q) {
                q->rspq_size = e->rx_mini_pending;
                q->fl_size = e->rx_pending;
                q->jumbo_size = e->rx_jumbo_pending;
@@ -2067,6 +2115,40 @@ static void check_link_status(struct adapter *adapter)
        }
 }
 
+static void check_t3b2_mac(struct adapter *adapter)
+{
+       int i;
+
+       rtnl_lock();                      /* synchronize with ifdown */
+       for_each_port(adapter, i) {
+               struct net_device *dev = adapter->port[i];
+               struct port_info *p = netdev_priv(dev);
+               int status;
+
+               if (!netif_running(dev))
+                       continue;
+
+               status = 0;
+               if (netif_running(dev) && netif_carrier_ok(dev))
+                       status = t3b2_mac_watchdog_task(&p->mac);
+               if (status == 1)
+                       p->mac.stats.num_toggled++;
+               else if (status == 2) {
+                       struct cmac *mac = &p->mac;
+
+                       t3_mac_set_mtu(mac, dev->mtu);
+                       t3_mac_set_address(mac, 0, dev->dev_addr);
+                       cxgb_set_rxmode(dev);
+                       t3_link_start(&p->phy, mac, &p->link_config);
+                       t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
+                       t3_port_intr_enable(adapter, p->port_id);
+                       p->mac.stats.num_resets++;
+               }
+       }
+       rtnl_unlock();
+}
+
+
 static void t3_adap_check_task(struct work_struct *work)
 {
        struct adapter *adapter = container_of(work, struct adapter,
@@ -2087,6 +2169,9 @@ static void t3_adap_check_task(struct work_struct *work)
                adapter->check_task_cnt = 0;
        }
 
+       if (p->rev == T3_REV_B2)
+               check_t3b2_mac(adapter);
+
        /* Schedule the next check update if any port is active. */
        spin_lock(&adapter->work_lock);
        if (adapter->open_device_map & PORT_MASK)
@@ -2195,9 +2280,9 @@ static void __devinit print_port_info(struct adapter *adap,
 
                if (!test_bit(i, &adap->registered_device_map))
                        continue;
-               printk(KERN_INFO "%s: %s %s RNIC (rev %d) %s%s\n",
+               printk(KERN_INFO "%s: %s %s %sNIC (rev %d) %s%s\n",
                       dev->name, ai->desc, pi->port_type->desc,
-                      adap->params.rev, buf,
+                      is_offload(adap) ? "R" : "", adap->params.rev, buf,
                       (adap->flags & USING_MSIX) ? " MSI-X" :
                       (adap->flags & USING_MSI) ? " MSI" : "");
                if (adap->name == dev->name && adap->params.vpd.mclk)
index f6ed033..eed7a48 100644 (file)
@@ -553,7 +553,9 @@ int cxgb3_alloc_atid(struct t3cdev *tdev, struct cxgb3_client *client,
        struct tid_info *t = &(T3C_DATA(tdev))->tid_maps;
 
        spin_lock_bh(&t->atid_lock);
-       if (t->afree) {
+       if (t->afree &&
+           t->atids_in_use + atomic_read(&t->tids_in_use) + MC5_MIN_TIDS <=
+           t->ntids) {
                union active_open_entry *p = t->afree;
 
                atid = (p - t->atid_tab) + t->atid_base;
index 644d62e..84c1ffa 100644 (file)
@@ -328,6 +328,9 @@ int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters,
        unsigned int tcam_size = mc5->tcam_size;
        struct adapter *adap = mc5->adapter;
 
+       if (!tcam_size)
+               return 0;
+
        if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size)
                return -EINVAL;
 
index b56c5f5..f8be41c 100644 (file)
 
 #define A_TP_RX_TRC_KEY0 0x120
 
+#define A_TP_TX_DROP_CNT_CH0 0x12d
+
+#define S_TXDROPCNTCH0RCVD    0
+#define M_TXDROPCNTCH0RCVD    0xffff
+#define V_TXDROPCNTCH0RCVD(x) ((x) << S_TXDROPCNTCH0RCVD)
+#define G_TXDROPCNTCH0RCVD(x) (((x) >> S_TXDROPCNTCH0RCVD) & \
+                              M_TXDROPCNTCH0RCVD)
+
 #define A_ULPRX_CTL 0x500
 
 #define S_ROUND_ROBIN    4
 #define V_TXPAUSEEN(x) ((x) << S_TXPAUSEEN)
 #define F_TXPAUSEEN    V_TXPAUSEEN(1U)
 
+#define A_XGM_TX_PAUSE_QUANTA 0x808
+
 #define A_XGM_RX_CTRL 0x80c
 
 #define S_RXEN    0
 
 #define A_XGM_TXFIFO_CFG 0x888
 
+#define S_TXIPG    13
+#define M_TXIPG    0xff
+#define V_TXIPG(x) ((x) << S_TXIPG)
+#define G_TXIPG(x) (((x) >> S_TXIPG) & M_TXIPG)
+
 #define S_TXFIFOTHRESH    4
 #define M_TXFIFOTHRESH    0x1ff
 
 #define V_TXFIFOTHRESH(x) ((x) << S_TXFIFOTHRESH)
 
+#define S_ENDROPPKT    21
+#define V_ENDROPPKT(x) ((x) << S_ENDROPPKT)
+#define F_ENDROPPKT    V_ENDROPPKT(1U)
+
 #define A_XGM_SERDES_CTRL 0x890
 #define A_XGM_SERDES_CTRL0 0x8e0
 
 
 #define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4
 
+#define A_XGM_TX_SPI4_SOP_EOP_CNT 0x9a8
+
+#define S_TXSPI4SOPCNT    16
+#define M_TXSPI4SOPCNT    0xffff
+#define V_TXSPI4SOPCNT(x) ((x) << S_TXSPI4SOPCNT)
+#define G_TXSPI4SOPCNT(x) (((x) >> S_TXSPI4SOPCNT) & M_TXSPI4SOPCNT)
+
 #define A_XGM_RX_SPI4_SOP_EOP_CNT 0x9ac
 
 #define XGMAC0_1_BASE_ADDR 0xa00
index c237834..027ab2c 100644 (file)
@@ -2631,7 +2631,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
        q->txq[TXQ_ETH].stop_thres = nports *
            flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3);
 
-       if (ntxq == 1) {
+       if (!is_offload(adapter)) {
 #ifdef USE_RX_PAGE
                q->fl[0].buf_size = RX_PAGE_SIZE;
 #else
index eaa7a2e..d83f075 100644 (file)
@@ -438,23 +438,23 @@ static const struct adapter_info t3_adap_info[] = {
        {2, 0, 0, 0,
         F_GPIO2_OEN | F_GPIO4_OEN |
         F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5,
-        SUPPORTED_OFFLOAD,
+        0,
         &mi1_mdio_ops, "Chelsio PE9000"},
        {2, 0, 0, 0,
         F_GPIO2_OEN | F_GPIO4_OEN |
         F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5,
-        SUPPORTED_OFFLOAD,
+        0,
         &mi1_mdio_ops, "Chelsio T302"},
        {1, 0, 0, 0,
         F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN |
         F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0,
-        SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD,
+        SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
         &mi1_mdio_ext_ops, "Chelsio T310"},
        {2, 0, 0, 0,
         F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN |
         F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL |
         F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0,
-        SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD,
+        SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
         &mi1_mdio_ext_ops, "Chelsio T320"},
 };
 
@@ -681,7 +681,8 @@ enum {
        SF_ERASE_SECTOR = 0xd8, /* erase sector */
 
        FW_FLASH_BOOT_ADDR = 0x70000,   /* start address of FW in flash */
-       FW_VERS_ADDR = 0x77ffc  /* flash address holding FW version */
+       FW_VERS_ADDR = 0x77ffc,    /* flash address holding FW version */
+       FW_MIN_SIZE = 8            /* at least version and csum */
 };
 
 /**
@@ -935,7 +936,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size)
        const u32 *p = (const u32 *)fw_data;
        int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16;
 
-       if (size & 3)
+       if ((size & 3) || size < FW_MIN_SIZE)
                return -EINVAL;
        if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR)
                return -EFBIG;
@@ -2899,6 +2900,9 @@ static int mc7_init(struct mc7 *mc7, unsigned int mc7_clock, int mem_type)
        struct adapter *adapter = mc7->adapter;
        const struct mc7_timing_params *p = &mc7_timings[mem_type];
 
+       if (!mc7->size)
+               return 0;
+
        val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG);
        slow = val & F_SLOW;
        width = G_WIDTH(val);
@@ -3099,8 +3103,10 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params)
        do {                    /* wait for uP to initialize */
                msleep(20);
        } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts);
-       if (!attempts)
+       if (!attempts) {
+               CH_ERR(adapter, "uP initialization timed out\n");
                goto out_err;
+       }
 
        err = 0;
 out_err:
@@ -3200,7 +3206,7 @@ static void __devinit mc7_prep(struct adapter *adapter, struct mc7 *mc7,
        mc7->name = name;
        mc7->offset = base_addr - MC7_PMRX_BASE_ADDR;
        cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG);
-       mc7->size = mc7_calc_size(cfg);
+       mc7->size = mc7->size = G_DEN(cfg) == M_DEN ? 0 : mc7_calc_size(cfg);
        mc7->width = G_WIDTH(cfg);
 }
 
@@ -3227,6 +3233,7 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai)
                     V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1));
        t3_write_reg(adapter, A_T3DBG_GPIO_EN,
                     ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL);
+       t3_write_reg(adapter, A_MC5_DB_SERVER_INDEX, 0);
 
        if (adapter->params.rev == 0 || !uses_xaui(adapter))
                val |= F_ENRGMII;
@@ -3243,15 +3250,17 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai)
 }
 
 /*
- * Reset the adapter.  PCIe cards lose their config space during reset, PCI-X
+ * Reset the adapter. 
+ * Older PCIe cards lose their config space during reset, PCI-X
  * ones don't.
  */
 int t3_reset_adapter(struct adapter *adapter)
 {
-       int i;
+       int i, save_and_restore_pcie = 
+           adapter->params.rev < T3_REV_B2 && is_pcie(adapter);
        uint16_t devid = 0;
 
-       if (is_pcie(adapter))
+       if (save_and_restore_pcie)
                pci_save_state(adapter->pdev);
        t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE);
 
@@ -3269,7 +3278,7 @@ int t3_reset_adapter(struct adapter *adapter)
        if (devid != 0x1425)
                return -1;
 
-       if (is_pcie(adapter))
+       if (save_and_restore_pcie)
                pci_restore_state(adapter->pdev);
        return 0;
 }
@@ -3323,7 +3332,13 @@ int __devinit t3_prep_adapter(struct adapter *adapter,
                p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size);
                p->ntimer_qs = p->cm_size >= (128 << 20) ||
                    adapter->params.rev > 0 ? 12 : 6;
+       }
+
+       adapter->params.offload = t3_mc7_size(&adapter->pmrx) &&
+                                 t3_mc7_size(&adapter->pmtx) &&
+                                 t3_mc7_size(&adapter->cm);
 
+       if (is_offload(adapter)) {
                adapter->params.mc5.nservers = DEFAULT_NSERVERS;
                adapter->params.mc5.nfilters = adapter->params.rev > 0 ?
                    DEFAULT_NFILTERS : 0;
index 82278f8..042e27e 100644 (file)
@@ -36,6 +36,9 @@
 #define DRV_NAME "cxgb3"
 /* Driver version */
 #define DRV_VERSION "1.0-ko"
+
+/* Firmware version */
 #define FW_VERSION_MAJOR 3
-#define FW_VERSION_MINOR 2
+#define FW_VERSION_MINOR 3
+#define FW_VERSION_MICRO 0
 #endif                         /* __CHELSIO_VERSION_H */
index 907a272..94aaff0 100644 (file)
@@ -124,9 +124,6 @@ int t3_mac_reset(struct cmac *mac)
                        xaui_serdes_reset(mac);
        }
 
-       if (adap->params.rev > 0)
-               t3_write_reg(adap, A_XGM_PAUSE_TIMER + oft, 0xf000);
-
        val = F_MAC_RESET_;
        if (is_10G(adap))
                val |= F_PCS_RESET_;
@@ -145,6 +142,58 @@ int t3_mac_reset(struct cmac *mac)
        return 0;
 }
 
+int t3b2_mac_reset(struct cmac *mac)
+{
+       struct adapter *adap = mac->adapter;
+       unsigned int oft = mac->offset;
+       u32 val;
+
+       if (!macidx(mac)) 
+               t3_set_reg_field(adap, A_MPS_CFG, F_PORT0ACTIVE, 0);
+       else
+               t3_set_reg_field(adap, A_MPS_CFG, F_PORT1ACTIVE, 0);
+
+       t3_write_reg(adap, A_XGM_RESET_CTRL + oft, F_MAC_RESET_);
+       t3_read_reg(adap, A_XGM_RESET_CTRL + oft);    /* flush */
+
+       msleep(10);
+
+       /* Check for xgm Rx fifo empty */
+       if (t3_wait_op_done(adap, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + oft,
+                           0x80000000, 1, 5, 2)) {
+               CH_ERR(adap, "MAC %d Rx fifo drain failed\n",
+                      macidx(mac));
+               return -1;
+       }
+
+       t3_write_reg(adap, A_XGM_RESET_CTRL + oft, 0);
+       t3_read_reg(adap, A_XGM_RESET_CTRL + oft);    /* flush */
+
+       val = F_MAC_RESET_;
+       if (is_10G(adap))
+               val |= F_PCS_RESET_;
+       else if (uses_xaui(adap))
+               val |= F_PCS_RESET_ | F_XG2G_RESET_;
+       else
+               val |= F_RGMII_RESET_ | F_XG2G_RESET_;
+       t3_write_reg(adap, A_XGM_RESET_CTRL + oft, val);
+       t3_read_reg(adap, A_XGM_RESET_CTRL + oft);  /* flush */
+       if ((val & F_PCS_RESET_) && adap->params.rev) {
+               msleep(1);
+               t3b_pcs_reset(mac);
+       }
+       t3_write_reg(adap, A_XGM_RX_CFG + oft, 
+                    F_DISPAUSEFRAMES | F_EN1536BFRAMES |
+                    F_RMFCS | F_ENJUMBO | F_ENHASHMCAST);
+
+       if (!macidx(mac)) 
+               t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT0ACTIVE);
+       else
+               t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT1ACTIVE);
+
+       return 0;
+}
+
 /*
  * Set the exact match register 'idx' to recognize the given Ethernet address.
  */
@@ -251,9 +300,11 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
         * Adjust the PAUSE frame watermarks.  We always set the LWM, and the
         * HWM only if flow-control is enabled.
         */
-       hwm = max(MAC_RXFIFO_SIZE - 3 * mtu, MAC_RXFIFO_SIZE / 2U);
-       hwm = min(hwm, 3 * MAC_RXFIFO_SIZE / 4 + 1024);
-       lwm = hwm - 1024;
+       hwm = max_t(unsigned int, MAC_RXFIFO_SIZE - 3 * mtu, 
+                   MAC_RXFIFO_SIZE * 38 / 100);
+       hwm = min(hwm, MAC_RXFIFO_SIZE - 8192);
+       lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4);
+
        v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset);
        v &= ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM);
        v |= V_RXFIFOPAUSELWM(lwm / 8);
@@ -270,7 +321,15 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
        thres = mtu > thres ? (mtu - thres + 7) / 8 : 0;
        thres = max(thres, 8U); /* need at least 8 */
        t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset,
-                        V_TXFIFOTHRESH(M_TXFIFOTHRESH), V_TXFIFOTHRESH(thres));
+                        V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG),
+                        V_TXFIFOTHRESH(thres) | V_TXIPG(1));
+
+       if (adap->params.rev > 0)
+               t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset,
+                            (hwm - lwm) * 4 / 8);
+       t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset,
+                    MAC_RXFIFO_SIZE * 4 * 8 / 512);
+
        return 0;
 }
 
@@ -298,12 +357,6 @@ int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc)
                                 V_PORTSPEED(M_PORTSPEED), val);
        }
 
-       val = t3_read_reg(adap, A_XGM_RXFIFO_CFG + oft);
-       val &= ~V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM);
-       if (fc & PAUSE_TX)
-               val |= V_RXFIFOPAUSEHWM(G_RXFIFOPAUSELWM(val) + 128);   /* +1KB */
-       t3_write_reg(adap, A_XGM_RXFIFO_CFG + oft, val);
-
        t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN,
                         (fc & PAUSE_RX) ? F_TXPAUSEEN : 0);
        return 0;
@@ -318,9 +371,17 @@ int t3_mac_enable(struct cmac *mac, int which)
        if (which & MAC_DIRECTION_TX) {
                t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN);
                t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
-               t3_write_reg(adap, A_TP_PIO_DATA, 0xbf000001);
+               t3_write_reg(adap, A_TP_PIO_DATA, 0xc0ede401);
                t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE);
                t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx);
+
+               t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + idx);
+               mac->tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
+                                                           A_TP_PIO_DATA)));
+               mac->xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
+                                               A_XGM_TX_SPI4_SOP_EOP_CNT)));
+               mac->txen = F_TXEN;
+               mac->toggle_cnt = 0;
        }
        if (which & MAC_DIRECTION_RX)
                t3_write_reg(adap, A_XGM_RX_CTRL + oft, F_RXEN);
@@ -337,13 +398,50 @@ int t3_mac_disable(struct cmac *mac, int which)
                t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
                t3_write_reg(adap, A_TP_PIO_DATA, 0xc000001f);
                t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE);
-               t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 0);
+               t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx);
+               mac->txen = 0;
        }
        if (which & MAC_DIRECTION_RX)
                t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0);
        return 0;
 }
 
+int t3b2_mac_watchdog_task(struct cmac *mac)
+{
+       struct adapter *adap = mac->adapter;
+       unsigned int tcnt, xcnt;
+       int status;
+
+       t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + macidx(mac));
+       tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, A_TP_PIO_DATA)));
+       xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, 
+                                          A_XGM_TX_SPI4_SOP_EOP_CNT +
+                                          mac->offset)));
+
+       if (tcnt != mac->tcnt && xcnt == 0 && mac->xcnt == 0) {
+               if (mac->toggle_cnt > 4) {
+                       t3b2_mac_reset(mac);
+                       mac->toggle_cnt = 0;
+                       status = 2;
+               } else {
+                       t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);
+                       t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset);
+                       t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset,
+                                    mac->txen);
+                       t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset);
+                       mac->toggle_cnt++;
+                       status = 1;
+               }       
+       } else {
+               mac->toggle_cnt = 0;
+               status = 0;
+       }
+       mac->tcnt = tcnt;
+       mac->xcnt = xcnt;
+
+       return status;
+}
+
 /*
  * This function is called periodically to accumulate the current values of the
  * RMON counters into the port statistics.  Since the packet counters are only
@@ -373,7 +471,11 @@ const struct mac_stats *t3_mac_update_stats(struct cmac *mac)
        RMON_UPDATE(mac, rx_symbol_errs, RX_SYM_CODE_ERR_FRAMES);
 
        RMON_UPDATE(mac, rx_too_long, RX_OVERSIZE_FRAMES);
-       mac->stats.rx_too_long += RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT);
+
+       v = RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT);
+       if (mac->adapter->params.rev == T3_REV_B2)
+               v &= 0x7fffffff;
+       mac->stats.rx_too_long += v;
 
        RMON_UPDATE(mac, rx_frames_64, RX_64B_FRAMES);
        RMON_UPDATE(mac, rx_frames_65_127, RX_65_127B_FRAMES);
index c8c41f0..714ea11 100644 (file)
@@ -414,10 +414,9 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
        icr &= 0x70;
        outb(icr, EWRK3_ICR);   /* Disable all the IRQs */
 
-       if (nicsr == (CSR_TXD | CSR_RXD))
+       if (nicsr != (CSR_TXD | CSR_RXD))
                return -ENXIO;
 
-
        /* Check that the EEPROM is alive and well and not living on Pluto... */
        for (chksum = 0, i = 0; i < EEPROM_MAX; i += 2) {
                union {
index 46e1697..d04214e 100644 (file)
@@ -2050,9 +2050,10 @@ static void nv_tx_timeout(struct net_device *dev)
                nv_drain_tx(dev);
                nv_init_tx(dev);
                setup_hw_rings(dev, NV_SETUP_TX_RING);
-               netif_wake_queue(dev);
        }
 
+       netif_wake_queue(dev);
+
        /* 4) restart tx engine */
        nv_start_tx(dev);
        spin_unlock_irq(&np->lock);
@@ -3536,7 +3537,10 @@ static void nv_do_nic_poll(unsigned long data)
        pci_push(base);
 
        if (!using_multi_irqs(dev)) {
-               nv_nic_irq(0, dev);
+               if (np->desc_ver == DESC_VER_3)
+                       nv_nic_irq_optimized(0, dev);
+               else
+                       nv_nic_irq(0, dev);
                if (np->msi_flags & NV_MSI_X_ENABLED)
                        enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
                else
index ca2b21f..07b4c0d 100644 (file)
@@ -96,17 +96,24 @@ static void ri_tasklet(unsigned long dev)
                skb->tc_verd = SET_TC_NCLS(skb->tc_verd);
                stats->tx_packets++;
                stats->tx_bytes +=skb->len;
+
+               skb->dev = __dev_get_by_index(skb->iif);
+               if (!skb->dev) {
+                       dev_kfree_skb(skb);
+                       stats->tx_dropped++;
+                       break;
+               }
+               skb->iif = _dev->ifindex;
+
                if (from & AT_EGRESS) {
                        dp->st_rx_frm_egr++;
                        dev_queue_xmit(skb);
                } else if (from & AT_INGRESS) {
-
                        dp->st_rx_frm_ing++;
+                       skb_pull(skb, skb->dev->hard_header_len);
                        netif_rx(skb);
-               } else {
-                       dev_kfree_skb(skb);
-                       stats->tx_dropped++;
-               }
+               } else
+                       BUG();
        }
 
        if (netif_tx_trylock(_dev)) {
@@ -157,26 +164,10 @@ static int ifb_xmit(struct sk_buff *skb, struct net_device *dev)
        stats->rx_packets++;
        stats->rx_bytes+=skb->len;
 
-       if (!from || !skb->input_dev) {
-dropped:
+       if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->iif) {
                dev_kfree_skb(skb);
                stats->rx_dropped++;
                return ret;
-       } else {
-               /*
-                * note we could be going
-                * ingress -> egress or
-                * egress -> ingress
-               */
-               skb->dev = skb->input_dev;
-               skb->input_dev = dev;
-               if (from & AT_INGRESS) {
-                       skb_pull(skb, skb->dev->hard_header_len);
-               } else {
-                       if (!(from & AT_EGRESS)) {
-                               goto dropped;
-                       }
-               }
        }
 
        if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) {
index 340ee99..1d510bd 100644 (file)
@@ -1057,6 +1057,8 @@ static int stir421x_fw_upload(struct irda_usb_cb *self,
 
                if (ret < 0)
                        break;
+
+               mdelay(10);
        }
 
        kfree(patch_block);
index 9137e23..2272156 100644 (file)
@@ -321,15 +321,22 @@ static void pxa_irda_fir_dma_tx_irq(int channel, void *data)
                pxa_irda_set_speed(si, si->newspeed);
                si->newspeed = 0;
        } else {
+               int i = 64;
+
                ICCR0 = 0;
                pxa_irda_fir_dma_rx_start(si);
+               while ((ICSR1 & ICSR1_RNE) && i--)
+                       (void)ICDR;
                ICCR0 = ICCR0_ITR | ICCR0_RXE;
+
+               if (i < 0)
+                       printk(KERN_ERR "pxa_ir: cannot clear Rx FIFO!\n");
        }
        netif_wake_queue(dev);
 }
 
 /* EIF(Error in FIFO/End in Frame) handler for FIR */
-static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev)
+static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, int icsr0)
 {
        unsigned int len, stat, data;
 
@@ -350,7 +357,7 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev)
                        }
                        if (stat & ICSR1_ROR) {
                                printk(KERN_DEBUG "pxa_ir: fir receive overrun\n");
-                               si->stats.rx_frame_errors++;
+                               si->stats.rx_over_errors++;
                        }
                } else  {
                        si->dma_rx_buff[len++] = data;
@@ -362,7 +369,15 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev)
 
        if (stat & ICSR1_EOF) {
                /* end of frame. */
-               struct sk_buff *skb = alloc_skb(len+1,GFP_ATOMIC);
+               struct sk_buff *skb;
+
+               if (icsr0 & ICSR0_FRE) {
+                       printk(KERN_ERR "pxa_ir: dropping erroneous frame\n");
+                       si->stats.rx_dropped++;
+                       return;
+               }
+
+               skb = alloc_skb(len+1,GFP_ATOMIC);
                if (!skb)  {
                        printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n");
                        si->stats.rx_dropped++;
@@ -392,7 +407,7 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct pxa_irda *si = netdev_priv(dev);
-       int icsr0;
+       int icsr0, i = 64;
 
        /* stop RX DMA */
        DCSR(si->rxdma) &= ~DCSR_RUN;
@@ -412,13 +427,18 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
 
        if (icsr0 & ICSR0_EIF) {
                /* An error in FIFO occured, or there is a end of frame */
-               pxa_irda_fir_irq_eif(si, dev);
+               pxa_irda_fir_irq_eif(si, dev, icsr0);
        }
 
        ICCR0 = 0;
        pxa_irda_fir_dma_rx_start(si);
+       while ((ICSR1 & ICSR1_RNE) && i--)
+               (void)ICDR;
        ICCR0 = ICCR0_ITR | ICCR0_RXE;
 
+       if (i < 0)
+               printk(KERN_ERR "pxa_ir: cannot clear Rx FIFO!\n");
+
        return IRQ_HANDLED;
 }
 
index 1ee27c3..8015a7c 100644 (file)
@@ -1379,7 +1379,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 
        spin_lock_init(&mp->lock);
 
-       port_num = pd->port_number;
+       port_num = mp->port_num = pd->port_number;
 
        /* set default config values */
        eth_port_uc_addr_get(dev, dev->dev_addr);
@@ -1411,8 +1411,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
        duplex = pd->duplex;
        speed = pd->speed;
 
-       mp->port_num = port_num;
-
        /* Hook up MII support for ethtool */
        mp->mii.dev = dev;
        mp->mii.mdio_read = mv643xx_mdio_read;
@@ -1516,9 +1514,23 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
        return 0;
 }
 
+static void mv643xx_eth_shutdown(struct platform_device *pdev)
+{
+       struct net_device *dev = platform_get_drvdata(pdev);
+       struct mv643xx_private *mp = netdev_priv(dev);
+       unsigned int port_num = mp->port_num;
+
+       /* Mask all interrupts on ethernet port */
+       mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), 0);
+       mv_read (MV643XX_ETH_INTERRUPT_MASK_REG(port_num));
+
+       eth_port_reset(port_num);
+}
+
 static struct platform_driver mv643xx_eth_driver = {
        .probe = mv643xx_eth_probe,
        .remove = mv643xx_eth_remove,
+       .shutdown = mv643xx_eth_shutdown,
        .driver = {
                .name = MV643XX_ETH_NAME,
        },
index ac02b3b..c216e6a 100644 (file)
@@ -71,7 +71,7 @@
 #include "myri10ge_mcp.h"
 #include "myri10ge_mcp_gen_header.h"
 
-#define MYRI10GE_VERSION_STR "1.2.0"
+#define MYRI10GE_VERSION_STR "1.3.0-1.227"
 
 MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
 MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -234,7 +234,7 @@ static int myri10ge_msi = 1;        /* enable msi by default */
 module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts\n");
 
-static int myri10ge_intr_coal_delay = 25;
+static int myri10ge_intr_coal_delay = 75;
 module_param(myri10ge_intr_coal_delay, int, S_IRUGO);
 MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay\n");
 
@@ -279,7 +279,7 @@ static int myri10ge_fill_thresh = 256;
 module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n");
 
-static int myri10ge_wcfifo = 1;
+static int myri10ge_wcfifo = 0;
 module_param(myri10ge_wcfifo, int, S_IRUGO);
 MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n");
 
@@ -905,6 +905,14 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
                    (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE)) {
                        /* we can use part of previous page */
                        get_page(rx->page);
+#if MYRI10GE_ALLOC_SIZE > 4096
+                       /* Firmware cannot cross 4K boundary.. */
+                       if ((rx->page_offset >> 12) !=
+                           ((rx->page_offset + bytes - 1) >> 12)) {
+                               rx->page_offset =
+                                   (rx->page_offset + bytes) & ~4095;
+                       }
+#endif
                } else {
                        /* we need a new page */
                        page =
@@ -2007,10 +2015,9 @@ again:
        mss = 0;
        max_segments = MXGEFW_MAX_SEND_DESC;
 
-       if (skb->len > (dev->mtu + ETH_HLEN)) {
+       if (skb_is_gso(skb)) {
                mss = skb_shinfo(skb)->gso_size;
-               if (mss != 0)
-                       max_segments = MYRI10GE_MAX_SEND_DESC_TSO;
+               max_segments = MYRI10GE_MAX_SEND_DESC_TSO;
        }
 
        if ((unlikely(avail < max_segments))) {
@@ -2483,6 +2490,8 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
 
 #define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7
 #define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa
+#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST 0x140
+#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST 0x142
 
 static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
 {
@@ -2514,6 +2523,12 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
                           ((bridge->vendor == PCI_VENDOR_ID_SERVERWORKS
                             && bridge->device ==
                             PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE)
+                           /* ServerWorks HT2100 */
+                           || (bridge->vendor == PCI_VENDOR_ID_SERVERWORKS
+                               && bridge->device >=
+                               PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST
+                               && bridge->device <=
+                               PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST)
                            /* All Intel E5000 PCIE ports */
                            || (bridge->vendor == PCI_VENDOR_ID_INTEL
                                && bridge->device >=
index 229aa1c..eff965d 100644 (file)
@@ -438,6 +438,7 @@ do_rom_fast_read_words(struct netxen_adapter *adapter, int addr,
 
        for (addridx = addr; addridx < (addr + size); addridx += 4) {
                ret = do_rom_fast_read(adapter, addridx, (int *)bytes);
+               *(int *)bytes = cpu_to_le32(*(int *)bytes);
                if (ret != 0)
                        break;
                bytes += 4;
@@ -497,7 +498,7 @@ static inline int do_rom_fast_write_words(struct netxen_adapter *adapter,
                int timeout = 0;
                int data;
 
-               data = *(u32*)bytes;
+               data = le32_to_cpu((*(u32*)bytes));
 
                ret = do_rom_fast_write(adapter, addridx, data);
                if (ret < 0)
index 00ca0fd..6ca4e4f 100644 (file)
@@ -710,8 +710,8 @@ match:
                tp->chipset,
                rtl_chip_info[tp->chipset].name);
 
-       i = register_netdev (dev);
-       if (i)
+       rc = register_netdev (dev);
+       if (rc)
                goto err_out_unmap;
 
        DPRINTK ("EXIT, returning 0\n");
index 11b575f..ef58e41 100644 (file)
@@ -2544,6 +2544,9 @@ static void ppp_destroy_interface(struct ppp *ppp)
        ppp->active_filter = NULL;
 #endif /* CONFIG_PPP_FILTER */
 
+       if (ppp->xmit_pending)
+               kfree_skb(ppp->xmit_pending);
+
        kfree(ppp);
 }
 
index d3f65da..a8246eb 100755 (executable)
@@ -1688,6 +1688,27 @@ static int ql_populate_free_queue(struct ql3_adapter *qdev)
        return 0;
 }
 
+/*
+ * Caller holds hw_lock.
+ */
+static void ql_update_small_bufq_prod_index(struct ql3_adapter *qdev)
+{
+       struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
+       if (qdev->small_buf_release_cnt >= 16) {
+               while (qdev->small_buf_release_cnt >= 16) {
+                       qdev->small_buf_q_producer_index++;
+
+                       if (qdev->small_buf_q_producer_index ==
+                           NUM_SBUFQ_ENTRIES)
+                               qdev->small_buf_q_producer_index = 0;
+                       qdev->small_buf_release_cnt -= 8;
+               }
+               wmb();
+               writel(qdev->small_buf_q_producer_index,
+                       &port_regs->CommonRegs.rxSmallQProducerIndex);
+       }
+}
+
 /*
  * Caller holds hw_lock.
  */
@@ -1732,13 +1753,10 @@ static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev)
                                lrg_buf_q_ele = qdev->lrg_buf_q_virt_addr;
                        }
                }
-
+               wmb();
                qdev->lrg_buf_next_free = lrg_buf_q_ele;
-
-               ql_write_common_reg(qdev,
-                                   &port_regs->CommonRegs.
-                                   rxLargeQProducerIndex,
-                                   qdev->lrg_buf_q_producer_index);
+               writel(qdev->lrg_buf_q_producer_index,
+                       &port_regs->CommonRegs.rxLargeQProducerIndex);
        }
 }
 
@@ -1915,17 +1933,18 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
                u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum);
                if (checksum & 
                        (IB_IP_IOCB_RSP_3032_ICE | 
-                        IB_IP_IOCB_RSP_3032_CE | 
-                        IB_IP_IOCB_RSP_3032_NUC)) {
+                        IB_IP_IOCB_RSP_3032_CE)) { 
                        printk(KERN_ERR
                               "%s: Bad checksum for this %s packet, checksum = %x.\n",
                               __func__,
                               ((checksum & 
                                IB_IP_IOCB_RSP_3032_TCP) ? "TCP" :
                                "UDP"),checksum);
-               } else if (checksum & IB_IP_IOCB_RSP_3032_TCP) {
+               } else if ((checksum & IB_IP_IOCB_RSP_3032_TCP) ||
+                               (checksum & IB_IP_IOCB_RSP_3032_UDP &&
+                               !(checksum & IB_IP_IOCB_RSP_3032_NUC))) {
                        skb2->ip_summed = CHECKSUM_UNNECESSARY;
-               } 
+               }
        }
        skb2->dev = qdev->ndev;
        skb2->protocol = eth_type_trans(skb2, qdev->ndev);
@@ -1944,16 +1963,12 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
 static int ql_tx_rx_clean(struct ql3_adapter *qdev,
                          int *tx_cleaned, int *rx_cleaned, int work_to_do)
 {
-       struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
        struct net_rsp_iocb *net_rsp;
        struct net_device *ndev = qdev->ndev;
-       unsigned long hw_flags;
        int work_done = 0;
 
-       u32 rsp_producer_index = le32_to_cpu(*(qdev->prsp_producer_index));
-
        /* While there are entries in the completion queue. */
-       while ((rsp_producer_index !=
+       while ((le32_to_cpu(*(qdev->prsp_producer_index)) !=
                qdev->rsp_consumer_index) && (work_done < work_to_do)) {
 
                net_rsp = qdev->rsp_current;
@@ -2009,33 +2024,7 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
                work_done = *tx_cleaned + *rx_cleaned;
        }
 
-       if(work_done) {
-               spin_lock_irqsave(&qdev->hw_lock, hw_flags);
-
-               ql_update_lrg_bufq_prod_index(qdev);
-
-               if (qdev->small_buf_release_cnt >= 16) {
-                       while (qdev->small_buf_release_cnt >= 16) {
-                               qdev->small_buf_q_producer_index++;
-
-                               if (qdev->small_buf_q_producer_index ==
-                                   NUM_SBUFQ_ENTRIES)
-                                       qdev->small_buf_q_producer_index = 0;
-                               qdev->small_buf_release_cnt -= 8;
-                       }
-
-                       wmb();
-                       ql_write_common_reg(qdev,
-                                           &port_regs->CommonRegs.
-                                           rxSmallQProducerIndex,
-                                           qdev->small_buf_q_producer_index);
-
-               }
-
-               spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
-       }
-
-       return *tx_cleaned + *rx_cleaned;
+       return work_done;
 }
 
 static int ql_poll(struct net_device *ndev, int *budget)
@@ -2059,9 +2048,10 @@ quit_polling:
                netif_rx_complete(ndev);
 
                spin_lock_irqsave(&qdev->hw_lock, hw_flags);
-               ql_write_common_reg(qdev,
-                                   &port_regs->CommonRegs.rspQConsumerIndex,
-                                   qdev->rsp_consumer_index);
+               ql_update_small_bufq_prod_index(qdev);
+               ql_update_lrg_bufq_prod_index(qdev);
+               writel(qdev->rsp_consumer_index,
+                           &port_regs->CommonRegs.rspQConsumerIndex);
                spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
 
                ql_enable_interrupts(qdev);
@@ -2217,12 +2207,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
        int seg_cnt, seg = 0;
        int frag_cnt = (int)skb_shinfo(skb)->nr_frags;
 
-       seg_cnt = tx_cb->seg_count = ql_get_seg_count(qdev,
-                                                     (skb_shinfo(skb)->nr_frags));
-       if(seg_cnt == -1) {
-               printk(KERN_ERR PFX"%s: invalid segment count!\n",__func__);
-               return NETDEV_TX_BUSY;
-       }
+       seg_cnt = tx_cb->seg_count;
        /*
         * Map the skb buffer first.
         */
@@ -2278,7 +2263,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
                                pci_unmap_addr_set(&tx_cb->map[seg], mapaddr,
                                                   map);
                                pci_unmap_len_set(&tx_cb->map[seg], maplen,
-                                                 len);
+                                                 sizeof(struct oal));
                                oal_entry = (struct oal_entry *)oal;
                                oal++;
                                seg++;
@@ -2380,6 +2365,7 @@ static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev)
        }
        
        mac_iocb_ptr = tx_cb->queue_entry;
+       memset((void *)mac_iocb_ptr, 0, sizeof(struct ob_mac_iocb_req));
        mac_iocb_ptr->opcode = qdev->mac_ob_opcode;
        mac_iocb_ptr->flags = OB_MAC_IOCB_REQ_X;
        mac_iocb_ptr->flags |= qdev->mb_bit_mask;
@@ -3054,15 +3040,6 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
                        goto out;
                }
 
-               if (qdev->mac_index)
-                       ql_write_page0_reg(qdev,
-                                          &port_regs->mac1MaxFrameLengthReg,
-                                          qdev->max_frame_size);
-               else
-                       ql_write_page0_reg(qdev,
-                                          &port_regs->mac0MaxFrameLengthReg,
-                                          qdev->max_frame_size);
-
                value = qdev->nvram_data.tcpMaxWindowSize;
                ql_write_page0_reg(qdev, &port_regs->tcpMaxWindow, value);
 
@@ -3082,6 +3059,14 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
                ql_sem_unlock(qdev, QL_FLASH_SEM_MASK);
        }
 
+       if (qdev->mac_index)
+               ql_write_page0_reg(qdev,
+                                  &port_regs->mac1MaxFrameLengthReg,
+                                  qdev->max_frame_size);
+       else
+               ql_write_page0_reg(qdev,
+                                          &port_regs->mac0MaxFrameLengthReg,
+                                          qdev->max_frame_size);
 
        if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK,
                        (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) *
@@ -3152,7 +3137,8 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
        if (qdev->device_id == QL3032_DEVICE_ID) {
                value =
                    (QL3032_PORT_CONTROL_EF | QL3032_PORT_CONTROL_KIE |
-                    QL3032_PORT_CONTROL_EIv6 | QL3032_PORT_CONTROL_EIv4);
+                    QL3032_PORT_CONTROL_EIv6 | QL3032_PORT_CONTROL_EIv4 |
+                       QL3032_PORT_CONTROL_ET);
                ql_write_page0_reg(qdev, &port_regs->functionControl,
                                   ((value << 16) | value));
        } else {
index 34cd658..0203f88 100755 (executable)
@@ -1014,8 +1014,7 @@ struct eeprom_data {
 
 /* Transmit and Receive Buffers */
 #define NUM_LBUFQ_ENTRIES      128
-#define JUMBO_NUM_LBUFQ_ENTRIES        \
-(NUM_LBUFQ_ENTRIES/(JUMBO_MTU_SIZE/NORMAL_MTU_SIZE))
+#define JUMBO_NUM_LBUFQ_ENTRIES 32
 #define NUM_SBUFQ_ENTRIES      64
 #define QL_SMALL_BUFFER_SIZE    32
 #define QL_ADDR_ELE_PER_BUFQ_ENTRY \
index 521b5f0..6a77b8a 100644 (file)
@@ -66,6 +66,7 @@ VERSION 2.2LK <2005/01/25>
 #include <linux/init.h>
 #include <linux/dma-mapping.h>
 
+#include <asm/system.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 
@@ -486,6 +487,7 @@ static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *,
                                void __iomem *);
 static int rtl8169_change_mtu(struct net_device *dev, int new_mtu);
 static void rtl8169_down(struct net_device *dev);
+static void rtl8169_rx_clear(struct rtl8169_private *tp);
 
 #ifdef CONFIG_R8169_NAPI
 static int rtl8169_poll(struct net_device *dev, int *budget);
@@ -1751,16 +1753,10 @@ static int rtl8169_open(struct net_device *dev)
 {
        struct rtl8169_private *tp = netdev_priv(dev);
        struct pci_dev *pdev = tp->pci_dev;
-       int retval;
+       int retval = -ENOMEM;
 
-       rtl8169_set_rxbufsize(tp, dev);
-
-       retval =
-           request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED, dev->name, dev);
-       if (retval < 0)
-               goto out;
 
-       retval = -ENOMEM;
+       rtl8169_set_rxbufsize(tp, dev);
 
        /*
         * Rx and Tx desscriptors needs 256 bytes alignment.
@@ -1769,19 +1765,26 @@ static int rtl8169_open(struct net_device *dev)
        tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES,
                                               &tp->TxPhyAddr);
        if (!tp->TxDescArray)
-               goto err_free_irq;
+               goto out;
 
        tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES,
                                               &tp->RxPhyAddr);
        if (!tp->RxDescArray)
-               goto err_free_tx;
+               goto err_free_tx_0;
 
        retval = rtl8169_init_ring(dev);
        if (retval < 0)
-               goto err_free_rx;
+               goto err_free_rx_1;
 
        INIT_DELAYED_WORK(&tp->task, NULL);
 
+       smp_mb();
+
+       retval = request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED,
+                            dev->name, dev);
+       if (retval < 0)
+               goto err_release_ring_2;
+
        rtl8169_hw_start(dev);
 
        rtl8169_request_timer(dev);
@@ -1790,14 +1793,14 @@ static int rtl8169_open(struct net_device *dev)
 out:
        return retval;
 
-err_free_rx:
+err_release_ring_2:
+       rtl8169_rx_clear(tp);
+err_free_rx_1:
        pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray,
                            tp->RxPhyAddr);
-err_free_tx:
+err_free_tx_0:
        pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray,
                            tp->TxPhyAddr);
-err_free_irq:
-       free_irq(dev->irq, dev);
        goto out;
 }
 
@@ -2887,7 +2890,7 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state)
        void __iomem *ioaddr = tp->mmio_addr;
 
        if (!netif_running(dev))
-               goto out;
+               goto out_pci_suspend;
 
        netif_device_detach(dev);
        netif_stop_queue(dev);
@@ -2901,10 +2904,11 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state)
 
        spin_unlock_irq(&tp->lock);
 
+out_pci_suspend:
        pci_save_state(pdev);
        pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled);
        pci_set_power_state(pdev, pci_choose_state(pdev, state));
-out:
+
        return 0;
 }
 
@@ -2912,15 +2916,15 @@ static int rtl8169_resume(struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
 
+       pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
+       pci_enable_wake(pdev, PCI_D0, 0);
+
        if (!netif_running(dev))
                goto out;
 
        netif_device_attach(dev);
 
-       pci_set_power_state(pdev, PCI_D0);
-       pci_restore_state(pdev);
-       pci_enable_wake(pdev, PCI_D0, 0);
-
        rtl8169_schedule_work(dev, rtl8169_reset_task);
 out:
        return 0;
index b269513..143958f 100644 (file)
@@ -64,37 +64,37 @@ static unsigned int pci_irq_line;
 
 static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp)
 {
-       outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT,
-            &lp->evm_saa9730_regs->InterruptBlock1);
-       outl(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT,
-            &lp->evm_saa9730_regs->InterruptStatus1);
-       outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT |
-            EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1);
+       writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT,
+              &lp->evm_saa9730_regs->InterruptBlock1);
+       writel(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT,
+              &lp->evm_saa9730_regs->InterruptStatus1);
+       writel(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT |
+              EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1);
 }
 
 static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp)
 {
-       outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT,
-            &lp->evm_saa9730_regs->InterruptBlock1);
-       outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT,
-            &lp->evm_saa9730_regs->InterruptEnable1);
+       writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT,
+              &lp->evm_saa9730_regs->InterruptBlock1);
+       writel(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT,
+              &lp->evm_saa9730_regs->InterruptEnable1);
 }
 
 static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp)
 {
-       outl(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1);
+       writel(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1);
 }
 
 static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp)
 {
-       outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT,
-            &lp->evm_saa9730_regs->InterruptBlock1);
+       writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT,
+              &lp->evm_saa9730_regs->InterruptBlock1);
 }
 
 static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp)
 {
-       outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT,
-            &lp->evm_saa9730_regs->InterruptBlock1);
+       writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT,
+              &lp->evm_saa9730_regs->InterruptBlock1);
 }
 
 static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp)
@@ -147,7 +147,7 @@ static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp)
        printk("lp->lan_saa9730_regs->RxStatus = %x\n",
               readl(&lp->lan_saa9730_regs->RxStatus));
        for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) {
-               outl(i, &lp->lan_saa9730_regs->CamAddress);
+               writel(i, &lp->lan_saa9730_regs->CamAddress);
                printk("lp->lan_saa9730_regs->CamData = %x\n",
                       readl(&lp->lan_saa9730_regs->CamData));
        }
@@ -288,28 +288,27 @@ static int lan_saa9730_allocate_buffers(struct pci_dev *pdev,
         * Set rx buffer A and rx buffer B to point to the first two buffer
         * spaces.
         */
-       outl(lp->dma_addr + rxoffset,
-            &lp->lan_saa9730_regs->RxBuffA);
-       outl(lp->dma_addr + rxoffset +
-            LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE,
-            &lp->lan_saa9730_regs->RxBuffB);
+       writel(lp->dma_addr + rxoffset, &lp->lan_saa9730_regs->RxBuffA);
+       writel(lp->dma_addr + rxoffset +
+              LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE,
+              &lp->lan_saa9730_regs->RxBuffB);
 
        /*
         * Set txm_buf_a and txm_buf_b to point to the first two buffer
         * space
         */
-       outl(lp->dma_addr + txoffset,
-            &lp->lan_saa9730_regs->TxBuffA);
-       outl(lp->dma_addr + txoffset +
-            LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE,
-            &lp->lan_saa9730_regs->TxBuffB);
+       writel(lp->dma_addr + txoffset,
+              &lp->lan_saa9730_regs->TxBuffA);
+       writel(lp->dma_addr + txoffset +
+              LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE,
+              &lp->lan_saa9730_regs->TxBuffB);
 
        /* Set packet number */
-       outl((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) |
-            (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) |
-            (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) |
-            (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF),
-            &lp->lan_saa9730_regs->PacketCount);
+       writel((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) |
+              (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) |
+              (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) |
+              (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF),
+              &lp->lan_saa9730_regs->PacketCount);
 
        return 0;
 
@@ -326,10 +325,10 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp)
 
        for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) {
                /* First set address to where data is written */
-               outl(i, &lp->lan_saa9730_regs->CamAddress);
-               outl((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16)
-                    | (NetworkAddress[2] << 8) | NetworkAddress[3],
-                    &lp->lan_saa9730_regs->CamData);
+               writel(i, &lp->lan_saa9730_regs->CamAddress);
+               writel((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) |
+                      (NetworkAddress[2] << 8) | NetworkAddress[3],
+                      &lp->lan_saa9730_regs->CamData);
                NetworkAddress += 4;
        }
        return 0;
@@ -365,8 +364,8 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
        }
 
        /* Now set the control and address register. */
-       outl(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF,
-            &lp->lan_saa9730_regs->StationMgmtCtl);
+       writel(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF,
+              &lp->lan_saa9730_regs->StationMgmtCtl);
 
        /* check link status, spin here till station is not busy */
        i = 0;
@@ -391,23 +390,23 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
                /* Link is down, reset the PHY first. */
 
                /* set PHY address = 'CONTROL' */
-               outl(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL,
-                    &lp->lan_saa9730_regs->StationMgmtCtl);
+               writel(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL,
+                      &lp->lan_saa9730_regs->StationMgmtCtl);
 
                /* Wait for 1 ms. */
                mdelay(1);
 
                /* set 'CONTROL' = force reset and renegotiate */
-               outl(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG |
-                    PHY_CONTROL_RESTART_AUTO_NEG,
-                    &lp->lan_saa9730_regs->StationMgmtData);
+               writel(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG |
+                      PHY_CONTROL_RESTART_AUTO_NEG,
+                      &lp->lan_saa9730_regs->StationMgmtData);
 
                /* Wait for 50 ms. */
                mdelay(50);
 
                /* set 'BUSY' to start operation */
-               outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR |
-                    PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl);
+               writel(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR |
+                      PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl);
 
                /* await completion */
                i = 0;
@@ -427,9 +426,9 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
 
                for (l = 0; l < 2; l++) {
                        /* set PHY address = 'STATUS' */
-                       outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF |
-                            PHY_STATUS,
-                            &lp->lan_saa9730_regs->StationMgmtCtl);
+                       writel(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF |
+                              PHY_STATUS,
+                              &lp->lan_saa9730_regs->StationMgmtCtl);
 
                        /* await completion */
                        i = 0;
@@ -462,35 +461,35 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
 static int lan_saa9730_control_init(struct lan_saa9730_private *lp)
 {
        /* Initialize DMA control register. */
-       outl((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) |
-            (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) |
-            (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF)
-            | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN |
-            DMA_CTL_MAC_RX_INT_EN | DMA_CTL_MAC_TX_INT_EN,
-            &lp->lan_saa9730_regs->LanDmaCtl);
+       writel((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) |
+              (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) |
+              (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF)
+              | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN |
+              DMA_CTL_MAC_RX_INT_EN | DMA_CTL_MAC_TX_INT_EN,
+              &lp->lan_saa9730_regs->LanDmaCtl);
 
        /* Initial MAC control register. */
-       outl((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP,
-            &lp->lan_saa9730_regs->MacCtl);
+       writel((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP,
+              &lp->lan_saa9730_regs->MacCtl);
 
        /* Initialize CAM control register. */
-       outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC,
-            &lp->lan_saa9730_regs->CamCtl);
+       writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC,
+              &lp->lan_saa9730_regs->CamCtl);
 
        /*
         * Initialize CAM enable register, only turn on first entry, should
         * contain own addr.
         */
-       outl(0x0001, &lp->lan_saa9730_regs->CamEnable);
+       writel(0x0001, &lp->lan_saa9730_regs->CamEnable);
 
        /* Initialize Tx control register */
-       outl(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl);
+       writel(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl);
 
        /* Initialize Rcv control register */
-       outl(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl);
+       writel(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl);
 
        /* Reset DMA engine */
-       outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest);
+       writel(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest);
 
        return 0;
 }
@@ -500,14 +499,14 @@ static int lan_saa9730_stop(struct lan_saa9730_private *lp)
        int i;
 
        /* Stop DMA first */
-       outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) &
-            ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA),
-            &lp->lan_saa9730_regs->LanDmaCtl);
+       writel(readl(&lp->lan_saa9730_regs->LanDmaCtl) &
+              ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA),
+              &lp->lan_saa9730_regs->LanDmaCtl);
 
        /* Set the SW Reset bits in DMA and MAC control registers */
-       outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest);
-       outl(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET,
-            &lp->lan_saa9730_regs->MacCtl);
+       writel(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest);
+       writel(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET,
+              &lp->lan_saa9730_regs->MacCtl);
 
        /*
         * Wait for MAC reset to have finished. The reset bit is auto cleared
@@ -532,8 +531,8 @@ static int lan_saa9730_dma_init(struct lan_saa9730_private *lp)
        /* Stop lan controller. */
        lan_saa9730_stop(lp);
 
-       outl(LAN_SAA9730_DEFAULT_TIME_OUT_CNT,
-            &lp->lan_saa9730_regs->Timeout);
+       writel(LAN_SAA9730_DEFAULT_TIME_OUT_CNT,
+              &lp->lan_saa9730_regs->Timeout);
 
        return 0;
 }
@@ -552,19 +551,19 @@ static int lan_saa9730_start(struct lan_saa9730_private *lp)
        lp->PendingTxmPacketIndex = 0;
        lp->PendingTxmBufferIndex = 0;
 
-       outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA |
-            DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl);
+       writel(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA |
+              DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl);
 
        /* For Tx, turn on MAC then DMA */
-       outl(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN,
-            &lp->lan_saa9730_regs->TxCtl);
+       writel(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN,
+              &lp->lan_saa9730_regs->TxCtl);
 
        /* For Rx, turn on DMA then MAC */
-       outl(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN,
-            &lp->lan_saa9730_regs->RxCtl);
+       writel(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN,
+              &lp->lan_saa9730_regs->RxCtl);
 
        /* Set Ok2Use to let hardware own the buffers.  */
-       outl(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use);
+       writel(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use);
 
        return 0;
 }
@@ -587,7 +586,7 @@ static int lan_saa9730_tx(struct net_device *dev)
                printk("lan_saa9730_tx interrupt\n");
 
        /* Clear interrupt. */
-       outl(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus);
+       writel(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus);
 
        while (1) {
                pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex]
@@ -660,8 +659,8 @@ static int lan_saa9730_rx(struct net_device *dev)
                printk("lan_saa9730_rx interrupt\n");
 
        /* Clear receive interrupts. */
-       outl(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT |
-            DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus);
+       writel(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT |
+              DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus);
 
        /* Address next packet */
        BufferIndex = lp->NextRcvBufferIndex;
@@ -725,8 +724,8 @@ static int lan_saa9730_rx(struct net_device *dev)
                *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF);
 
                /* Make sure A or B is available to hardware as appropriate. */
-               outl(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A,
-                    &lp->lan_saa9730_regs->Ok2Use);
+               writel(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A,
+                      &lp->lan_saa9730_regs->Ok2Use);
 
                /* Go to next packet in sequence. */
                lp->NextRcvPacketIndex++;
@@ -844,8 +843,8 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp,
                            (len << TX_STAT_CTL_LENGTH_SHF));
 
        /* Make sure A or B is available to hardware as appropriate. */
-       outl(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A,
-            &lp->lan_saa9730_regs->Ok2Use);
+       writel(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A,
+              &lp->lan_saa9730_regs->Ok2Use);
 
        return 0;
 }
@@ -938,15 +937,15 @@ static void lan_saa9730_set_multicast(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC) {
                /* accept all packets */
-               outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC |
-                    CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC,
-                    &lp->lan_saa9730_regs->CamCtl);
+               writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC |
+                      CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC,
+                      &lp->lan_saa9730_regs->CamCtl);
        } else {
                if (dev->flags & IFF_ALLMULTI) {
                        /* accept all multicast packets */
-                       outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC |
-                            CAM_CONTROL_BROAD_ACC,
-                            &lp->lan_saa9730_regs->CamCtl);
+                       writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC |
+                              CAM_CONTROL_BROAD_ACC,
+                              &lp->lan_saa9730_regs->CamCtl);
                } else {
                        /*
                         * Will handle the multicast stuff later. -carstenl
index 1eae16b..103c317 100644 (file)
@@ -243,7 +243,7 @@ struct sbmac_softc {
         * Controller-specific things
         */
 
-       volatile void __iomem *sbm_base;          /* MAC's base address */
+       void __iomem            *sbm_base;          /* MAC's base address */
        sbmac_state_t    sbm_state;         /* current state */
 
        volatile void __iomem   *sbm_macenable; /* MAC Enable Register */
index b08508b..34463ce 100644 (file)
@@ -324,6 +324,7 @@ static struct mii_chip_info {
        u32 feature;
 } mii_chip_table[] = {
        { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 },
+       { "Broadcom PHY AC131",   { 0x0143, 0xbc70 }, LAN, 0 },
        { "Agere PHY ET1101B",    { 0x0282, 0xf010 }, LAN, 0 },
        { "Marvell PHY 88E1111",  { 0x0141, 0x0cc0 }, LAN, F_PHY_88E1111 },
        { "Realtek PHY RTL8201",  { 0x0000, 0x8200 }, LAN, 0 },
index 8fecf1b..39c6677 100644 (file)
@@ -105,7 +105,8 @@ static const int txqaddr[] = { Q_XA1, Q_XA2 };
 static const int rxqaddr[] = { Q_R1, Q_R2 };
 static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F };
 static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F };
-static const u32 irqmask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F };
+static const u32 napimask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F };
+static const u32 portmask[] = { IS_PORT_1, IS_PORT_2 };
 
 static int skge_get_regs_len(struct net_device *dev)
 {
@@ -671,7 +672,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
        struct skge_hw *hw = skge->hw;
        int port = skge->port;
 
-       mutex_lock(&hw->phy_mutex);
+       spin_lock_bh(&hw->phy_lock);
        if (hw->chip_id == CHIP_ID_GENESIS) {
                switch (mode) {
                case LED_MODE_OFF:
@@ -742,7 +743,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
                                     PHY_M_LED_MO_RX(MO_LED_ON));
                }
        }
-       mutex_unlock(&hw->phy_mutex);
+       spin_unlock_bh(&hw->phy_lock);
 }
 
 /* blink LED's for finding board */
@@ -1316,7 +1317,7 @@ static void xm_phy_init(struct skge_port *skge)
        xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl);
 
        /* Poll PHY for status changes */
-       schedule_delayed_work(&skge->link_thread, LINK_HZ);
+       mod_timer(&skge->link_timer, jiffies + LINK_HZ);
 }
 
 static void xm_check_link(struct net_device *dev)
@@ -1391,10 +1392,9 @@ static void xm_check_link(struct net_device *dev)
  * Since internal PHY is wired to a level triggered pin, can't
  * get an interrupt when carrier is detected.
  */
-static void xm_link_timer(struct work_struct *work)
+static void xm_link_timer(unsigned long arg)
 {
-       struct skge_port *skge =
-               container_of(work, struct skge_port, link_thread.work);
+       struct skge_port *skge = (struct skge_port *) arg;
        struct net_device *dev = skge->netdev;
        struct skge_hw *hw = skge->hw;
        int port = skge->port;
@@ -1414,13 +1414,13 @@ static void xm_link_timer(struct work_struct *work)
                        goto nochange;
        }
 
-       mutex_lock(&hw->phy_mutex);
+       spin_lock(&hw->phy_lock);
        xm_check_link(dev);
-       mutex_unlock(&hw->phy_mutex);
+       spin_unlock(&hw->phy_lock);
 
 nochange:
        if (netif_running(dev))
-               schedule_delayed_work(&skge->link_thread, LINK_HZ);
+               mod_timer(&skge->link_timer, jiffies + LINK_HZ);
 }
 
 static void genesis_mac_init(struct skge_hw *hw, int port)
@@ -2323,7 +2323,7 @@ static void skge_phy_reset(struct skge_port *skge)
        netif_stop_queue(skge->netdev);
        netif_carrier_off(skge->netdev);
 
-       mutex_lock(&hw->phy_mutex);
+       spin_lock_bh(&hw->phy_lock);
        if (hw->chip_id == CHIP_ID_GENESIS) {
                genesis_reset(hw, port);
                genesis_mac_init(hw, port);
@@ -2331,7 +2331,7 @@ static void skge_phy_reset(struct skge_port *skge)
                yukon_reset(hw, port);
                yukon_init(hw, port);
        }
-       mutex_unlock(&hw->phy_mutex);
+       spin_unlock_bh(&hw->phy_lock);
 
        dev->set_multicast_list(dev);
 }
@@ -2354,12 +2354,12 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                /* fallthru */
        case SIOCGMIIREG: {
                u16 val = 0;
-               mutex_lock(&hw->phy_mutex);
+               spin_lock_bh(&hw->phy_lock);
                if (hw->chip_id == CHIP_ID_GENESIS)
                        err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val);
                else
                        err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val);
-               mutex_unlock(&hw->phy_mutex);
+               spin_unlock_bh(&hw->phy_lock);
                data->val_out = val;
                break;
        }
@@ -2368,14 +2368,14 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                if (!capable(CAP_NET_ADMIN))
                        return -EPERM;
 
-               mutex_lock(&hw->phy_mutex);
+               spin_lock_bh(&hw->phy_lock);
                if (hw->chip_id == CHIP_ID_GENESIS)
                        err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f,
                                   data->val_in);
                else
                        err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f,
                                   data->val_in);
-               mutex_unlock(&hw->phy_mutex);
+               spin_unlock_bh(&hw->phy_lock);
                break;
        }
        return err;
@@ -2481,12 +2481,12 @@ static int skge_up(struct net_device *dev)
                goto free_rx_ring;
 
        /* Initialize MAC */
-       mutex_lock(&hw->phy_mutex);
+       spin_lock_bh(&hw->phy_lock);
        if (hw->chip_id == CHIP_ID_GENESIS)
                genesis_mac_init(hw, port);
        else
                yukon_mac_init(hw, port);
-       mutex_unlock(&hw->phy_mutex);
+       spin_unlock_bh(&hw->phy_lock);
 
        /* Configure RAMbuffers */
        chunk = hw->ram_size / ((hw->ports + 1)*2);
@@ -2504,6 +2504,11 @@ static int skge_up(struct net_device *dev)
        skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
        skge_led(skge, LED_MODE_ON);
 
+       spin_lock_irq(&hw->hw_lock);
+       hw->intr_mask |= portmask[port];
+       skge_write32(hw, B0_IMSK, hw->intr_mask);
+       spin_unlock_irq(&hw->hw_lock);
+
        netif_poll_enable(dev);
        return 0;
 
@@ -2531,7 +2536,14 @@ static int skge_down(struct net_device *dev)
 
        netif_stop_queue(dev);
        if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
-               cancel_delayed_work(&skge->link_thread);
+               del_timer_sync(&skge->link_timer);
+
+       netif_poll_disable(dev);
+
+       spin_lock_irq(&hw->hw_lock);
+       hw->intr_mask &= ~portmask[port];
+       skge_write32(hw, B0_IMSK, hw->intr_mask);
+       spin_unlock_irq(&hw->hw_lock);
 
        skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
        if (hw->chip_id == CHIP_ID_GENESIS)
@@ -2575,8 +2587,10 @@ static int skge_down(struct net_device *dev)
 
        skge_led(skge, LED_MODE_OFF);
 
-       netif_poll_disable(dev);
+       netif_tx_lock_bh(dev);
        skge_tx_clean(dev);
+       netif_tx_unlock_bh(dev);
+
        skge_rx_clean(skge);
 
        kfree(skge->rx_ring.start);
@@ -2721,7 +2735,6 @@ static void skge_tx_clean(struct net_device *dev)
        struct skge_port *skge = netdev_priv(dev);
        struct skge_element *e;
 
-       netif_tx_lock_bh(dev);
        for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) {
                struct skge_tx_desc *td = e->desc;
                skge_tx_free(skge, e, td->control);
@@ -2730,7 +2743,6 @@ static void skge_tx_clean(struct net_device *dev)
 
        skge->tx_ring.to_clean = e;
        netif_wake_queue(dev);
-       netif_tx_unlock_bh(dev);
 }
 
 static void skge_tx_timeout(struct net_device *dev)
@@ -3049,7 +3061,7 @@ static int skge_poll(struct net_device *dev, int *budget)
 
        spin_lock_irqsave(&hw->hw_lock, flags);
        __netif_rx_complete(dev);
-       hw->intr_mask |= irqmask[skge->port];
+       hw->intr_mask |= napimask[skge->port];
        skge_write32(hw, B0_IMSK, hw->intr_mask);
        skge_read32(hw, B0_IMSK);
        spin_unlock_irqrestore(&hw->hw_lock, flags);
@@ -3160,28 +3172,29 @@ static void skge_error_irq(struct skge_hw *hw)
 }
 
 /*
- * Interrupt from PHY are handled in work queue
+ * Interrupt from PHY are handled in tasklet (softirq)
  * because accessing phy registers requires spin wait which might
  * cause excess interrupt latency.
  */
-static void skge_extirq(struct work_struct *work)
+static void skge_extirq(unsigned long arg)
 {
-       struct skge_hw *hw = container_of(work, struct skge_hw, phy_work);
+       struct skge_hw *hw = (struct skge_hw *) arg;
        int port;
 
-       mutex_lock(&hw->phy_mutex);
        for (port = 0; port < hw->ports; port++) {
                struct net_device *dev = hw->dev[port];
-               struct skge_port *skge = netdev_priv(dev);
 
                if (netif_running(dev)) {
+                       struct skge_port *skge = netdev_priv(dev);
+
+                       spin_lock(&hw->phy_lock);
                        if (hw->chip_id != CHIP_ID_GENESIS)
                                yukon_phy_intr(skge);
                        else if (hw->phy_type == SK_PHY_BCOM)
                                bcom_phy_intr(skge);
+                       spin_unlock(&hw->phy_lock);
                }
        }
-       mutex_unlock(&hw->phy_mutex);
 
        spin_lock_irq(&hw->hw_lock);
        hw->intr_mask |= IS_EXT_REG;
@@ -3206,7 +3219,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
        status &= hw->intr_mask;
        if (status & IS_EXT_REG) {
                hw->intr_mask &= ~IS_EXT_REG;
-               schedule_work(&hw->phy_work);
+               tasklet_schedule(&hw->phy_task);
        }
 
        if (status & (IS_XA1_F|IS_R1_F)) {
@@ -3282,23 +3295,28 @@ static int skge_set_mac_address(struct net_device *dev, void *p)
 
        memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
 
-       /* disable Rx */
-       ctrl = gma_read16(hw, port, GM_GP_CTRL);
-       gma_write16(hw, port, GM_GP_CTRL, ctrl & ~GM_GPCR_RX_ENA);
+       if (!netif_running(dev)) {
+               memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN);
+               memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN);
+       } else {
+               /* disable Rx */
+               spin_lock_bh(&hw->phy_lock);
+               ctrl = gma_read16(hw, port, GM_GP_CTRL);
+               gma_write16(hw, port, GM_GP_CTRL, ctrl & ~GM_GPCR_RX_ENA);
 
-       memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN);
-       memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN);
+               memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN);
+               memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN);
 
-       if (netif_running(dev)) {
                if (hw->chip_id == CHIP_ID_GENESIS)
                        xm_outaddr(hw, port, XM_SA, dev->dev_addr);
                else {
                        gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr);
                        gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr);
                }
-       }
 
-       gma_write16(hw, port, GM_GP_CTRL, ctrl);
+               gma_write16(hw, port, GM_GP_CTRL, ctrl);
+               spin_unlock_bh(&hw->phy_lock);
+       }
 
        return 0;
 }
@@ -3413,10 +3431,9 @@ static int skge_reset(struct skge_hw *hw)
        else
                hw->ram_size = t8 * 4096;
 
-       hw->intr_mask = IS_HW_ERR | IS_PORT_1;
-       if (hw->ports > 1)
-               hw->intr_mask |= IS_PORT_2;
+       hw->intr_mask = IS_HW_ERR;
 
+       /* Use PHY IRQ for all but fiber based Genesis board */
        if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC))
                hw->intr_mask |= IS_EXT_REG;
 
@@ -3484,14 +3501,12 @@ static int skge_reset(struct skge_hw *hw)
 
        skge_write32(hw, B0_IMSK, hw->intr_mask);
 
-       mutex_lock(&hw->phy_mutex);
        for (i = 0; i < hw->ports; i++) {
                if (hw->chip_id == CHIP_ID_GENESIS)
                        genesis_reset(hw, i);
                else
                        yukon_reset(hw, i);
        }
-       mutex_unlock(&hw->phy_mutex);
 
        return 0;
 }
@@ -3539,6 +3554,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
        skge->netdev = dev;
        skge->hw = hw;
        skge->msg_enable = netif_msg_init(debug, default_msg);
+
        skge->tx_ring.count = DEFAULT_TX_RING_SIZE;
        skge->rx_ring.count = DEFAULT_RX_RING_SIZE;
 
@@ -3555,7 +3571,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
        skge->port = port;
 
        /* Only used for Genesis XMAC */
-       INIT_DELAYED_WORK(&skge->link_thread, xm_link_timer);
+       setup_timer(&skge->link_timer, xm_link_timer, (unsigned long) skge);
 
        if (hw->chip_id != CHIP_ID_GENESIS) {
                dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
@@ -3637,9 +3653,9 @@ static int __devinit skge_probe(struct pci_dev *pdev,
        }
 
        hw->pdev = pdev;
-       mutex_init(&hw->phy_mutex);
-       INIT_WORK(&hw->phy_work, skge_extirq);
        spin_lock_init(&hw->hw_lock);
+       spin_lock_init(&hw->phy_lock);
+       tasklet_init(&hw->phy_task, &skge_extirq, (unsigned long) hw);
 
        hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000);
        if (!hw->regs) {
@@ -3725,6 +3741,8 @@ static void __devexit skge_remove(struct pci_dev *pdev)
        dev0 = hw->dev[0];
        unregister_netdev(dev0);
 
+       tasklet_disable(&hw->phy_task);
+
        spin_lock_irq(&hw->hw_lock);
        hw->intr_mask = 0;
        skge_write32(hw, B0_IMSK, 0);
index e9354df..86467ae 100644 (file)
@@ -2424,8 +2424,8 @@ struct skge_hw {
        u32                  ram_size;
        u32                  ram_offset;
        u16                  phy_addr;
-       struct work_struct   phy_work;
-       struct mutex         phy_mutex;
+       spinlock_t           phy_lock;
+       struct tasklet_struct phy_task;
 };
 
 enum pause_control {
@@ -2457,7 +2457,7 @@ struct skge_port {
 
        struct net_device_stats net_stats;
 
-       struct delayed_work  link_thread;
+       struct timer_list    link_timer;
        enum pause_control   flow_control;
        enum pause_status    flow_status;
        u8                   rx_csum;
index c62e85d..7bee45b 100644 (file)
@@ -336,13 +336,27 @@ static int __init lance_probe( struct net_device *dev)
 
        /* XXX - leak? */
        MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000);
+       if (MEM == NULL) {
+#ifdef CONFIG_SUN3
+               iounmap((void __iomem *)ioaddr);
+#endif
+               printk(KERN_WARNING "SUN3 Lance couldn't allocate DVMA memory\n");
+               return 0;
+       }
 
        lp->iobase = (volatile unsigned short *)ioaddr;
        dev->base_addr = (unsigned long)ioaddr; /* informational only */
 
        REGA(CSR0) = CSR0_STOP;
 
-       request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev);
+       if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) {
+#ifdef CONFIG_SUN3
+               iounmap((void __iomem *)ioaddr);
+#endif
+               dvma_free((void *)MEM);
+               printk(KERN_WARNING "SUN3 Lance unable to allocate IRQ\n");
+               return 0;
+       }
        dev->irq = (unsigned short)LANCE_IRQ;
 
 
index 616be8d..08ea61d 100644 (file)
@@ -2530,6 +2530,35 @@ static struct net_device_stats *gem_get_stats(struct net_device *dev)
        return &gp->net_stats;
 }
 
+static int gem_set_mac_address(struct net_device *dev, void *addr)
+{
+       struct sockaddr *macaddr = (struct sockaddr *) addr;
+       struct gem *gp = dev->priv;
+       unsigned char *e = &dev->dev_addr[0];
+
+       if (!is_valid_ether_addr(macaddr->sa_data))
+               return -EADDRNOTAVAIL;
+
+       if (!netif_running(dev) || !netif_device_present(dev)) {
+               /* We'll just catch it later when the
+                * device is up'd or resumed.
+                */
+               memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len);
+               return 0;
+       }
+
+       mutex_lock(&gp->pm_mutex);
+       memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len);
+       if (gp->running) {
+               writel((e[4] << 8) | e[5], gp->regs + MAC_ADDR0);
+               writel((e[2] << 8) | e[3], gp->regs + MAC_ADDR1);
+               writel((e[0] << 8) | e[1], gp->regs + MAC_ADDR2);
+       }
+       mutex_unlock(&gp->pm_mutex);
+
+       return 0;
+}
+
 static void gem_set_multicast(struct net_device *dev)
 {
        struct gem *gp = dev->priv;
@@ -3122,6 +3151,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
        dev->change_mtu = gem_change_mtu;
        dev->irq = pdev->irq;
        dev->dma = 0;
+       dev->set_mac_address = gem_set_mac_address;
 #ifdef CONFIG_NET_POLL_CONTROLLER
        dev->poll_controller = gem_poll_controller;
 #endif
index 8c8f9f4..256969e 100644 (file)
@@ -64,8 +64,8 @@
 
 #define DRV_MODULE_NAME                "tg3"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "3.74"
-#define DRV_MODULE_RELDATE     "February 20, 2007"
+#define DRV_MODULE_VERSION     "3.75"
+#define DRV_MODULE_RELDATE     "March 23, 2007"
 
 #define TG3_DEF_MAC_MODE       0
 #define TG3_DEF_RX_MODE                0
@@ -3568,32 +3568,34 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id)
         * Reading the PCI State register will confirm whether the
         * interrupt is ours and will flush the status block.
         */
-       if ((sblk->status & SD_STATUS_UPDATED) ||
-           !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
-               /*
-                * Writing any value to intr-mbox-0 clears PCI INTA# and
-                * chip-internal interrupt pending events.
-                * Writing non-zero to intr-mbox-0 additional tells the
-                * NIC to stop sending us irqs, engaging "in-intr-handler"
-                * event coalescing.
-                */
-               tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
-                            0x00000001);
-               if (tg3_irq_sync(tp))
+       if (unlikely(!(sblk->status & SD_STATUS_UPDATED))) {
+               if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) ||
+                   (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
+                       handled = 0;
                        goto out;
-               sblk->status &= ~SD_STATUS_UPDATED;
-               if (likely(tg3_has_work(tp))) {
-                       prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
-                       netif_rx_schedule(dev);         /* schedule NAPI poll */
-               } else {
-                       /* No work, shared interrupt perhaps?  re-enable
-                        * interrupts, and flush that PCI write
-                        */
-                       tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
-                               0x00000000);
                }
-       } else {        /* shared interrupt */
-               handled = 0;
+       }
+
+       /*
+        * Writing any value to intr-mbox-0 clears PCI INTA# and
+        * chip-internal interrupt pending events.
+        * Writing non-zero to intr-mbox-0 additional tells the
+        * NIC to stop sending us irqs, engaging "in-intr-handler"
+        * event coalescing.
+        */
+       tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
+       if (tg3_irq_sync(tp))
+               goto out;
+       sblk->status &= ~SD_STATUS_UPDATED;
+       if (likely(tg3_has_work(tp))) {
+               prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
+               netif_rx_schedule(dev);         /* schedule NAPI poll */
+       } else {
+               /* No work, shared interrupt perhaps?  re-enable
+                * interrupts, and flush that PCI write
+                */
+               tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
+                              0x00000000);
        }
 out:
        return IRQ_RETVAL(handled);
@@ -3611,31 +3613,33 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
         * Reading the PCI State register will confirm whether the
         * interrupt is ours and will flush the status block.
         */
-       if ((sblk->status_tag != tp->last_tag) ||
-           !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
-               /*
-                * writing any value to intr-mbox-0 clears PCI INTA# and
-                * chip-internal interrupt pending events.
-                * writing non-zero to intr-mbox-0 additional tells the
-                * NIC to stop sending us irqs, engaging "in-intr-handler"
-                * event coalescing.
-                */
-               tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
-                            0x00000001);
-               if (tg3_irq_sync(tp))
+       if (unlikely(sblk->status_tag == tp->last_tag)) {
+               if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) ||
+                   (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
+                       handled = 0;
                        goto out;
-               if (netif_rx_schedule_prep(dev)) {
-                       prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
-                       /* Update last_tag to mark that this status has been
-                        * seen. Because interrupt may be shared, we may be
-                        * racing with tg3_poll(), so only update last_tag
-                        * if tg3_poll() is not scheduled.
-                        */
-                       tp->last_tag = sblk->status_tag;
-                       __netif_rx_schedule(dev);
                }
-       } else {        /* shared interrupt */
-               handled = 0;
+       }
+
+       /*
+        * writing any value to intr-mbox-0 clears PCI INTA# and
+        * chip-internal interrupt pending events.
+        * writing non-zero to intr-mbox-0 additional tells the
+        * NIC to stop sending us irqs, engaging "in-intr-handler"
+        * event coalescing.
+        */
+       tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
+       if (tg3_irq_sync(tp))
+               goto out;
+       if (netif_rx_schedule_prep(dev)) {
+               prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
+               /* Update last_tag to mark that this status has been
+                * seen. Because interrupt may be shared, we may be
+                * racing with tg3_poll(), so only update last_tag
+                * if tg3_poll() is not scheduled.
+                */
+               tp->last_tag = sblk->status_tag;
+               __netif_rx_schedule(dev);
        }
 out:
        return IRQ_RETVAL(handled);
@@ -4823,6 +4827,21 @@ static int tg3_chip_reset(struct tg3 *tp)
        if (write_op == tg3_write_flush_reg32)
                tp->write32 = tg3_write32;
 
+       /* Prevent the irq handler from reading or writing PCI registers
+        * during chip reset when the memory enable bit in the PCI command
+        * register may be cleared.  The chip does not generate interrupt
+        * at this time, but the irq handler may still be called due to irq
+        * sharing or irqpoll.
+        */
+       tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING;
+       if (tp->hw_status) {
+               tp->hw_status->status = 0;
+               tp->hw_status->status_tag = 0;
+       }
+       tp->last_tag = 0;
+       smp_mb();
+       synchronize_irq(tp->pdev->irq);
+
        /* do the reset */
        val = GRC_MISC_CFG_CORECLK_RESET;
 
@@ -4904,6 +4923,8 @@ static int tg3_chip_reset(struct tg3 *tp)
 
        pci_restore_state(tp->pdev);
 
+       tp->tg3_flags &= ~TG3_FLAG_CHIP_RESETTING;
+
        /* Make sure PCI-X relaxed ordering bit is clear. */
        pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val);
        val &= ~PCIX_CAPS_RELAXED_ORDERING;
@@ -6321,8 +6342,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
                      RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB |
                      RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB |
                      RDMAC_MODE_LNGREAD_ENAB);
-       if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
-               rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE;
 
        /* If statement applies to 5705 and 5750 PCI devices only */
        if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
@@ -6495,9 +6514,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
                } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
                        val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK);
                        val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT);
-                       if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
-                               val |= (tp->split_mode_max_reqs <<
-                                       PCIX_CAPS_SPLIT_SHIFT);
                }
                tw32(TG3PCI_X_CAPS, val);
        }
@@ -10863,14 +10879,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
        grc_misc_cfg = tr32(GRC_MISC_CFG);
        grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK;
 
-       /* Broadcom's driver says that CIOBE multisplit has a bug */
-#if 0
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
-           grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5704CIOBE) {
-               tp->tg3_flags |= TG3_FLAG_SPLIT_MODE;
-               tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ;
-       }
-#endif
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
            (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 ||
             grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M))
@@ -11968,14 +11976,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
                       i == 5 ? '\n' : ':');
 
        printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] "
-              "MIirq[%d] ASF[%d] Split[%d] WireSpeed[%d] "
-              "TSOcap[%d] \n",
+              "MIirq[%d] ASF[%d] WireSpeed[%d] TSOcap[%d]\n",
               dev->name,
               (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0,
               (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0,
               (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0,
               (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0,
-              (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) != 0,
               (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0,
               (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0);
        printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n",
index 086892d..d515ed2 100644 (file)
@@ -2223,7 +2223,7 @@ struct tg3 {
 #define TG3_FLAG_40BIT_DMA_BUG         0x08000000
 #define TG3_FLAG_BROKEN_CHECKSUMS      0x10000000
 #define TG3_FLAG_GOT_SERDES_FLOWCTL    0x20000000
-#define TG3_FLAG_SPLIT_MODE            0x40000000
+#define TG3_FLAG_CHIP_RESETTING                0x40000000
 #define TG3_FLAG_INIT_COMPLETE         0x80000000
        u32                             tg3_flags2;
 #define TG3_FLG2_RESTART_TIMER         0x00000001
@@ -2262,9 +2262,6 @@ struct tg3 {
 #define TG3_FLG2_NO_FWARE_REPORTED     0x40000000
 #define TG3_FLG2_PHY_ADJUST_TRIM       0x80000000
 
-       u32                             split_mode_max_reqs;
-#define SPLIT_MODE_5704_MAX_REQ                3
-
        struct timer_list               timer;
        u16                             timer_counter;
        u16                             timer_multiplier;
index dab88b9..639e1e6 100644 (file)
@@ -3607,7 +3607,6 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (bd == ugeth->confBd[txQ]) {
                if (!netif_queue_stopped(dev))
                        netif_stop_queue(dev);
-               return NETDEV_TX_BUSY;
        }
 
        ugeth->txBd[txQ] = bd;
@@ -3623,7 +3622,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        spin_unlock_irq(&ugeth->lock);
 
-       return NETDEV_TX_OK;
+       return 0;
 }
 
 static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit)
diff --git a/drivers/net/wan/lmc/lmc_media.h b/drivers/net/wan/lmc/lmc_media.h
deleted file mode 100644 (file)
index ddcc004..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef _LMC_MEDIA_H_
-#define _LMC_MEDIA_H_
-
-lmc_media_t lmc_ds3_media = {
-  lmc_ds3_init,                        /* special media init stuff */
-  lmc_ds3_default,             /* reset to default state */
-  lmc_ds3_set_status,          /* reset status to state provided */
-  lmc_dummy_set_1,             /* set clock source */
-  lmc_dummy_set2_1,            /* set line speed */
-  lmc_ds3_set_100ft,           /* set cable length */
-  lmc_ds3_set_scram,           /* set scrambler */
-  lmc_ds3_get_link_status,     /* get link status */
-  lmc_dummy_set_1,             /* set link status */
-  lmc_ds3_set_crc_length,      /* set CRC length */
-  lmc_dummy_set_1,             /* set T1 or E1 circuit type */
-  lmc_ds3_watchdog
-};
-
-lmc_media_t lmc_hssi_media = {
-  lmc_hssi_init,               /* special media init stuff */
-  lmc_hssi_default,            /* reset to default state */
-  lmc_hssi_set_status,         /* reset status to state provided */
-  lmc_hssi_set_clock,          /* set clock source */
-  lmc_dummy_set2_1,            /* set line speed */
-  lmc_dummy_set_1,             /* set cable length */
-  lmc_dummy_set_1,             /* set scrambler */
-  lmc_hssi_get_link_status,    /* get link status */
-  lmc_hssi_set_link_status,    /* set link status */
-  lmc_hssi_set_crc_length,     /* set CRC length */
-  lmc_dummy_set_1,             /* set T1 or E1 circuit type */
-  lmc_hssi_watchdog
-};
-
-lmc_media_t lmc_ssi_media = { lmc_ssi_init,    /* special media init stuff */
-  lmc_ssi_default,             /* reset to default state */
-  lmc_ssi_set_status,          /* reset status to state provided */
-  lmc_ssi_set_clock,           /* set clock source */
-  lmc_ssi_set_speed,           /* set line speed */
-  lmc_dummy_set_1,             /* set cable length */
-  lmc_dummy_set_1,             /* set scrambler */
-  lmc_ssi_get_link_status,     /* get link status */
-  lmc_ssi_set_link_status,     /* set link status */
-  lmc_ssi_set_crc_length,      /* set CRC length */
-  lmc_dummy_set_1,             /* set T1 or E1 circuit type */
-  lmc_ssi_watchdog
-};
-
-lmc_media_t lmc_t1_media = {
-  lmc_t1_init,                 /* special media init stuff */
-  lmc_t1_default,              /* reset to default state */
-  lmc_t1_set_status,           /* reset status to state provided */
-  lmc_t1_set_clock,            /* set clock source */
-  lmc_dummy_set2_1,            /* set line speed */
-  lmc_dummy_set_1,             /* set cable length */
-  lmc_dummy_set_1,             /* set scrambler */
-  lmc_t1_get_link_status,      /* get link status */
-  lmc_dummy_set_1,             /* set link status */
-  lmc_t1_set_crc_length,       /* set CRC length */
-  lmc_t1_set_circuit_type,     /* set T1 or E1 circuit type */
-  lmc_t1_watchdog
-};
-
-
-#endif
-
index a8c2bfe..2ada76a 100644 (file)
@@ -2852,7 +2852,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
        if (rc) {
                airo_print_err(dev->name, "register interrupt %d failed, rc %d",
                                irq, rc);
-               goto err_out_unlink;
+               goto err_out_nets;
        }
        if (!is_pcmcia) {
                if (!request_region( dev->base_addr, 64, dev->name )) {
@@ -2935,6 +2935,8 @@ err_out_res:
                release_region( dev->base_addr, 64 );
 err_out_irq:
        free_irq(dev->irq, dev);
+err_out_nets:
+       airo_networks_free(ai);
 err_out_unlink:
        del_airo_dev(dev);
 err_out_thr:
index cae8925..d1e89be 100644 (file)
@@ -757,7 +757,7 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
        if (radio->version == 0x2050)
                bcm43xx_phy_write(bcm, 0x0038, 0x0667);
 
-       if (phy->type == BCM43xx_PHYTYPE_G) {
+       if (phy->connected) {
                if (radio->version == 0x2050) {
                        bcm43xx_radio_write16(bcm, 0x007A,
                                              bcm43xx_radio_read16(bcm, 0x007A)
@@ -1192,7 +1192,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
                bcm43xx_phy_write(bcm, 0x0811, 0x0400);
                bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
        }
-       if (phy->connected) {
+       if (phy->rev >= 2 && phy->connected) {
                tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF;
                if (tmp < 6) {
                        bcm43xx_phy_write(bcm, 0x04C2, 0x1816);
index 32beb91..4025dd0 100644 (file)
@@ -458,7 +458,7 @@ static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm)
                bcm43xx_phy_write(bcm, 0x005A, 0x0480);
                bcm43xx_phy_write(bcm, 0x0059, 0x0810);
                bcm43xx_phy_write(bcm, 0x0058, 0x000D);
-               if (phy->rev == 0) {
+               if (phy->analog == 0) {
                        bcm43xx_phy_write(bcm, 0x0003, 0x0122);
                } else {
                        bcm43xx_phy_write(bcm, 0x000A,
@@ -570,9 +570,9 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
                nrssi0 = (s16)bcm43xx_phy_read(bcm, 0x0027);
                bcm43xx_radio_write16(bcm, 0x007A,
                                      bcm43xx_radio_read16(bcm, 0x007A) & 0x007F);
-               if (phy->rev >= 2) {
+               if (phy->analog >= 2) {
                        bcm43xx_write16(bcm, 0x03E6, 0x0040);
-               } else if (phy->rev == 0) {
+               } else if (phy->analog == 0) {
                        bcm43xx_write16(bcm, 0x03E6, 0x0122);
                } else {
                        bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT,
@@ -596,7 +596,7 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
                bcm43xx_phy_write(bcm, 0x0015, backup[5]);
                bcm43xx_phy_write(bcm, 0x002A, backup[6]);
                bcm43xx_synth_pu_workaround(bcm, radio->channel);
-               if (phy->rev != 0)
+               if (phy->analog != 0)
                        bcm43xx_write16(bcm, 0x03F4, backup[13]);
 
                bcm43xx_phy_write(bcm, 0x0020, backup[7]);
@@ -692,7 +692,7 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
 
                bcm43xx_radio_write16(bcm, 0x007A,
                                      bcm43xx_radio_read16(bcm, 0x007A) & 0x007F);
-               if (phy->rev >= 2) {
+               if (phy->analog >= 2) {
                        bcm43xx_phy_write(bcm, 0x0003,
                                          (bcm43xx_phy_read(bcm, 0x0003)
                                           & 0xFF9F) | 0x0040);
@@ -882,10 +882,10 @@ static void _stack_save(u32 *_stackptr, size_t *stackidx,
 {
        u32 *stackptr = &(_stackptr[*stackidx]);
 
-       assert((offset & 0xF000) == 0x0000);
-       assert((id & 0xF0) == 0x00);
+       assert((offset & 0xE000) == 0x0000);
+       assert((id & 0xF8) == 0x00);
        *stackptr = offset;
-       *stackptr |= ((u32)id) << 12;
+       *stackptr |= ((u32)id) << 13;
        *stackptr |= ((u32)value) << 16;
        (*stackidx)++;
        assert(*stackidx < BCM43xx_INTERFSTACK_SIZE);
@@ -896,12 +896,12 @@ static u16 _stack_restore(u32 *stackptr,
 {
        size_t i;
 
-       assert((offset & 0xF000) == 0x0000);
-       assert((id & 0xF0) == 0x00);
+       assert((offset & 0xE000) == 0x0000);
+       assert((id & 0xF8) == 0x00);
        for (i = 0; i < BCM43xx_INTERFSTACK_SIZE; i++, stackptr++) {
-               if ((*stackptr & 0x00000FFF) != offset)
+               if ((*stackptr & 0x00001FFF) != offset)
                        continue;
-               if (((*stackptr & 0x0000F000) >> 12) != id)
+               if (((*stackptr & 0x00007000) >> 13) != id)
                        continue;
                return ((*stackptr & 0xFFFF0000) >> 16);
        }
@@ -1579,7 +1579,7 @@ void bcm43xx_radio_set_tx_iq(struct bcm43xx_private *bcm)
        
        for (i = 0; i < 5; i++) {
                for (j = 0; j < 5; j++) {
-                       if (tmp == (data_high[i] << 4 | data_low[j])) {
+                       if (tmp == (data_high[i] | data_low[j])) {
                                bcm43xx_phy_write(bcm, 0x0069, (i - j) << 8 | 0x00C0);
                                return;
                        }
index 00e937e..e7fbac5 100644 (file)
@@ -70,11 +70,12 @@ void wake_up_buffer_waiter(void)
 int alloc_event_buffer(void)
 {
        int err = -ENOMEM;
+       unsigned long flags;
 
-       spin_lock(&oprofilefs_lock);
+       spin_lock_irqsave(&oprofilefs_lock, flags);
        buffer_size = fs_buffer_size;
        buffer_watershed = fs_buffer_watershed;
-       spin_unlock(&oprofilefs_lock);
+       spin_unlock_irqrestore(&oprofilefs_lock, flags);
  
        if (buffer_watershed >= buffer_size)
                return -EINVAL;
index 6e67b42..8543cb2 100644 (file)
@@ -65,6 +65,7 @@ ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t co
 int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count)
 {
        char tmpbuf[TMPBUFSIZE];
+       unsigned long flags;
 
        if (!count)
                return 0;
@@ -77,9 +78,9 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, siz
        if (copy_from_user(tmpbuf, buf, count))
                return -EFAULT;
 
-       spin_lock(&oprofilefs_lock);
+       spin_lock_irqsave(&oprofilefs_lock, flags);
        *val = simple_strtoul(tmpbuf, NULL, 0);
-       spin_unlock(&oprofilefs_lock);
+       spin_unlock_irqrestore(&oprofilefs_lock, flags);
        return 0;
 }
 
index ad33e01..435c195 100644 (file)
@@ -94,6 +94,7 @@ static void msi_set_mask_bit(unsigned int irq, int flag)
                int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE +
                        PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET;
                writel(flag, entry->mask_base + offset);
+               readl(entry->mask_base + offset);
                break;
        }
        default:
index 0be5a0b..df38364 100644 (file)
@@ -93,7 +93,7 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
         if (!dev->irq && dev->pin) {
                printk(KERN_WARNING 
                "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", 
-               __FUNCTION__, dev->device, dev->vendor);
+               __FUNCTION__, dev->vendor, dev->device);
        }
        if (pcie_port_device_register(dev)) {
                pci_disable_device(dev);
index 7f94fc0..65d6f23 100644 (file)
@@ -963,6 +963,13 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho
  * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it 
  * becomes necessary to do this tweak in two steps -- I've chosen the Host
  * bridge as trigger.
+ *
+ * Note that we used to unhide the SMBus that way on Toshiba laptops
+ * (Satellite A40 and Tecra M2) but then found that the thermal management
+ * was done by SMM code, which could cause unsynchronized concurrent
+ * accesses to the SMBus registers, with potentially bad effects. Thus you
+ * should be very careful when adding new entries: if SMM is accessing the
+ * Intel SMBus, this is a very good reason to leave it hidden.
  */
 static int asus_hides_smbus;
 
@@ -1040,17 +1047,6 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
                        case 0x099c: /* HP Compaq nx6110 */
                                asus_hides_smbus = 1;
                        }
-       } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_TOSHIBA)) {
-               if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB)
-                       switch(dev->subsystem_device) {
-                       case 0x0001: /* Toshiba Satellite A40 */
-                               asus_hides_smbus = 1;
-                       }
-               else if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
-                       switch(dev->subsystem_device) {
-                       case 0x0001: /* Toshiba Tecra M2 */
-                               asus_hides_smbus = 1;
-                       }
        } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
                if (dev->device ==  PCI_DEVICE_ID_INTEL_82855PM_HB)
                        switch(dev->subsystem_device) {
index 551bde5..b693367 100644 (file)
@@ -372,7 +372,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
                skt->socket.resource_ops = &pccard_static_ops;
                skt->socket.ops = &au1x00_pcmcia_operations;
                skt->socket.owner = ops->owner;
-               skt->socket.dev.dev = dev;
+               skt->socket.dev.parent = dev;
 
                init_timer(&skt->poll_timer);
                skt->poll_timer.function = au1x00_pcmcia_poll_event;
index d77f751..2df216b 100644 (file)
@@ -202,15 +202,14 @@ static struct pccard_operations omap_cf_ops = {
  * "what chipselect is used".  Boards could want more.
  */
 
-static int __devinit omap_cf_probe(struct device *dev)
+static int __init omap_cf_probe(struct platform_device *pdev)
 {
        unsigned                seg;
        struct omap_cf_socket   *cf;
-       struct platform_device  *pdev = to_platform_device(dev);
        int                     irq;
        int                     status;
 
-       seg = (int) dev->platform_data;
+       seg = (int) pdev->dev.platform_data;
        if (seg == 0 || seg > 3)
                return -ENODEV;
 
@@ -227,7 +226,7 @@ static int __devinit omap_cf_probe(struct device *dev)
        cf->timer.data = (unsigned long) cf;
 
        cf->pdev = pdev;
-       dev_set_drvdata(dev, cf);
+       platform_set_drvdata(pdev, cf);
 
        /* this primarily just shuts up irq handling noise */
        status = request_irq(irq, omap_cf_irq, IRQF_SHARED,
@@ -291,7 +290,7 @@ static int __devinit omap_cf_probe(struct device *dev)
                omap_cf_present() ? "present" : "(not present)");
 
        cf->socket.owner = THIS_MODULE;
-       cf->socket.dev.parent = dev;
+       cf->socket.dev.parent = &pdev->dev;
        cf->socket.ops = &omap_cf_ops;
        cf->socket.resource_ops = &pccard_static_ops;
        cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP
@@ -318,9 +317,9 @@ fail0:
        return status;
 }
 
-static int __devexit omap_cf_remove(struct device *dev)
+static int __exit omap_cf_remove(struct platform_device *pdev)
 {
-       struct omap_cf_socket *cf = dev_get_drvdata(dev);
+       struct omap_cf_socket *cf = platform_get_drvdata(pdev);
 
        cf->active = 0;
        pcmcia_unregister_socket(&cf->socket);
@@ -332,26 +331,36 @@ static int __devexit omap_cf_remove(struct device *dev)
        return 0;
 }
 
-static struct device_driver omap_cf_driver = {
-       .name           = (char *) driver_name,
-       .bus            = &platform_bus_type,
-       .probe          = omap_cf_probe,
-       .remove         = __devexit_p(omap_cf_remove),
-       .suspend        = pcmcia_socket_dev_suspend,
-       .resume         = pcmcia_socket_dev_resume,
+static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
+{
+       return pcmcia_socket_dev_suspend(&pdev->dev, mesg);
+}
+
+static int omap_cf_resume(struct platform_device *pdev)
+{
+       return pcmcia_socket_dev_resume(&pdev->dev);
+}
+
+static struct platform_driver omap_cf_driver = {
+       .driver = {
+               .name   = (char *) driver_name,
+       },
+       .remove         = __exit_p(omap_cf_remove),
+       .suspend        = omap_cf_suspend,
+       .resume         = omap_cf_resume,
 };
 
 static int __init omap_cf_init(void)
 {
        if (cpu_is_omap16xx())
-               return driver_register(&omap_cf_driver);
+               return platform_driver_probe(&omap_cf_driver, omap_cf_probe);
        return -ENODEV;
 }
 
 static void __exit omap_cf_exit(void)
 {
        if (cpu_is_omap16xx())
-               driver_unregister(&omap_cf_driver);
+               platform_driver_unregister(&omap_cf_driver);
 }
 
 module_init(omap_cf_init);
index 2065e74..a8a9554 100644 (file)
@@ -22,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
        {       "",                     0       }
 };
 
-static void reserve_range(char *pnpid, int start, int end, int port)
+static void reserve_range(const char *pnpid, resource_size_t start, resource_size_t end, int port)
 {
        struct resource *res;
        char *regionid;
@@ -32,9 +32,9 @@ static void reserve_range(char *pnpid, int start, int end, int port)
                return;
        snprintf(regionid, 16, "pnp %s", pnpid);
        if (port)
-               res = request_region(start,end-start+1,regionid);
+               res = request_region(start, end-start+1, regionid);
        else
-               res = request_mem_region(start,end-start+1,regionid);
+               res = request_mem_region(start, end-start+1, regionid);
        if (res == NULL)
                kfree(regionid);
        else
@@ -45,12 +45,13 @@ static void reserve_range(char *pnpid, int start, int end, int port)
         * have double reservations.
         */
        printk(KERN_INFO
-               "pnp: %s: %s range 0x%x-0x%x %s reserved\n",
-               pnpid, port ? "ioport" : "iomem", start, end,
+               "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
+               pnpid, port ? "ioport" : "iomem",
+                (unsigned long long)start, (unsigned long long)end,
                NULL != res ? "has been" : "could not be");
 }
 
-static void reserve_resources_of_dev(struct pnp_dev *dev)
+static void reserve_resources_of_dev(const struct pnp_dev *dev)
 {
        int i;
 
index 85bf795..7c0d609 100644 (file)
@@ -59,6 +59,19 @@ struct cmos_rtc {
 
 static const char driver_name[] = "rtc_cmos";
 
+/* The RTC_INTR register may have e.g. RTC_PF set even if RTC_PIE is clear;
+ * always mask it against the irq enable bits in RTC_CONTROL.  Bit values
+ * are the same: PF==PIE, AF=AIE, UF=UIE; so RTC_IRQMASK works with both.
+ */
+#define        RTC_IRQMASK     (RTC_PF | RTC_AF | RTC_UF)
+
+static inline int is_intr(u8 rtc_intr)
+{
+       if (!(rtc_intr & RTC_IRQF))
+               return 0;
+       return rtc_intr & RTC_IRQMASK;
+}
+
 /*----------------------------------------------------------------*/
 
 static int cmos_read_time(struct device *dev, struct rtc_time *t)
@@ -188,7 +201,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
        rtc_control &= ~RTC_AIE;
        CMOS_WRITE(rtc_control, RTC_CONTROL);
        rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
-       if (rtc_intr)
+       rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
+       if (is_intr(rtc_intr))
                rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
 
        /* update alarm */
@@ -207,7 +221,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
                rtc_control |= RTC_AIE;
                CMOS_WRITE(rtc_control, RTC_CONTROL);
                rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
-               if (rtc_intr)
+               rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
+               if (is_intr(rtc_intr))
                        rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
        }
 
@@ -287,7 +302,8 @@ cmos_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
        }
        CMOS_WRITE(rtc_control, RTC_CONTROL);
        rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
-       if (rtc_intr)
+       rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
+       if (is_intr(rtc_intr))
                rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
        spin_unlock_irqrestore(&rtc_lock, flags);
        return 0;
@@ -353,12 +369,10 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
 
        spin_lock(&rtc_lock);
        irqstat = CMOS_READ(RTC_INTR_FLAGS);
+       irqstat &= (CMOS_READ(RTC_CONTROL) & RTC_IRQMASK) | RTC_IRQF;
        spin_unlock(&rtc_lock);
 
-       if (irqstat) {
-               /* NOTE: irqstat may have e.g. RTC_PF set
-                * even when RTC_PIE is clear...
-                */
+       if (is_intr(irqstat)) {
                rtc_update_irq(p, 1, irqstat);
                return IRQ_HANDLED;
        } else
@@ -525,25 +539,26 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg)
 {
        struct cmos_rtc *cmos = dev_get_drvdata(dev);
        int             do_wake = device_may_wakeup(dev);
-       unsigned char   tmp, irqstat;
+       unsigned char   tmp;
 
        /* only the alarm might be a wakeup event source */
        spin_lock_irq(&rtc_lock);
        cmos->suspend_ctrl = tmp = CMOS_READ(RTC_CONTROL);
        if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) {
+               unsigned char   irqstat;
+
                if (do_wake)
                        tmp &= ~(RTC_PIE|RTC_UIE);
                else
                        tmp &= ~(RTC_PIE|RTC_AIE|RTC_UIE);
                CMOS_WRITE(tmp, RTC_CONTROL);
                irqstat = CMOS_READ(RTC_INTR_FLAGS);
-       } else
-               irqstat = 0;
+               irqstat &= (tmp & RTC_IRQMASK) | RTC_IRQF;
+               if (is_intr(irqstat))
+                       rtc_update_irq(&cmos->rtc->class_dev, 1, irqstat);
+       }
        spin_unlock_irq(&rtc_lock);
 
-       if (irqstat)
-               rtc_update_irq(&cmos->rtc->class_dev, 1, irqstat);
-
        /* ACPI HOOK:  enable ACPI_EVENT_RTC when (tmp & RTC_AIE)
         * ... it'd be best if we could do that under rtc_lock.
         */
@@ -573,9 +588,10 @@ static int cmos_resume(struct device *dev)
                spin_lock_irq(&rtc_lock);
                CMOS_WRITE(tmp, RTC_CONTROL);
                tmp = CMOS_READ(RTC_INTR_FLAGS);
-               spin_unlock_irq(&rtc_lock);
-               if (tmp)
+               tmp &= (cmos->suspend_ctrl & RTC_IRQMASK) | RTC_IRQF;
+               if (is_intr(tmp))
                        rtc_update_irq(&cmos->rtc->class_dev, 1, tmp);
+               spin_unlock_irq(&rtc_lock);
        }
 
        pr_debug("%s: resume, ctrl %02x\n",
@@ -594,7 +610,7 @@ static int cmos_resume(struct device *dev)
 /*----------------------------------------------------------------*/
 
 /* The "CMOS" RTC normally lives on the platform_bus.  On ACPI systems,
- * the device node may alternatively be created as a PNP device.
+ * the device node will always be created as a PNPACPI device.
  */
 
 #ifdef CONFIG_PNPACPI
@@ -673,7 +689,7 @@ module_exit(cmos_exit);
 /*----------------------------------------------------------------*/
 
 /* Platform setup should have set up an RTC device, when PNPACPI is
- * unavailable ... this is the normal case, common even on PCs.
+ * unavailable ... this could happen even on (older) PCs.
  */
 
 static int __init cmos_platform_probe(struct platform_device *pdev)
index ab782bb..e810e4a 100644 (file)
@@ -65,7 +65,7 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */
  * resulting condition code and DIAG return code. */
 static inline int dia250(void *iob, int cmd)
 {
-       register unsigned long reg0 asm ("0") = (unsigned long) iob;
+       register unsigned long reg2 asm ("2") = (unsigned long) iob;
        typedef union {
                struct dasd_diag_init_io init_io;
                struct dasd_diag_rw_io rw_io;
@@ -74,15 +74,15 @@ static inline int dia250(void *iob, int cmd)
 
        rc = 3;
        asm volatile(
-               "       diag    0,%2,0x250\n"
+               "       diag    2,%2,0x250\n"
                "0:     ipm     %0\n"
                "       srl     %0,28\n"
-               "       or      %0,1\n"
+               "       or      %0,3\n"
                "1:\n"
                EX_TABLE(0b,1b)
                : "+d" (rc), "=m" (*(addr_type *) iob)
-               : "d" (cmd), "d" (reg0), "m" (*(addr_type *) iob)
-               : "1", "cc");
+               : "d" (cmd), "d" (reg2), "m" (*(addr_type *) iob)
+               : "3", "cc");
        return rc;
 }
 
index 6b1caea..aa96e67 100644 (file)
@@ -221,6 +221,14 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb)
 
        cdev_irb = &cdev->private->irb;
 
+       /*
+        * If the clear function had been performed, all formerly pending
+        * status at the subchannel has been cleared and we must not pass
+        * intermediate accumulated status to the device driver.
+        */
+       if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC)
+               memset(&cdev->private->irb, 0, sizeof(struct irb));
+
        /* Copy bits which are valid only for the start function. */
        if (irb->scsw.fctl & SCSW_FCTL_START_FUNC) {
                /* Copy key. */
@@ -263,7 +271,11 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb)
                cdev_irb->scsw.cpa = irb->scsw.cpa;
        /* Accumulate device status, but not the device busy flag. */
        cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY;
-       cdev_irb->scsw.dstat |= irb->scsw.dstat;
+       /* dstat is not always valid. */
+       if (irb->scsw.stctl &
+           (SCSW_STCTL_PRIM_STATUS | SCSW_STCTL_SEC_STATUS
+            | SCSW_STCTL_INTER_STATUS | SCSW_STCTL_ALERT_STATUS))
+               cdev_irb->scsw.dstat |= irb->scsw.dstat;
        /* Accumulate subchannel status. */
        cdev_irb->scsw.cstat |= irb->scsw.cstat;
        /* Copy residual count if it is valid. */
index 181b517..bf37cdf 100644 (file)
@@ -505,6 +505,9 @@ static int ap_device_remove(struct device *dev)
        spin_lock_bh(&ap_device_lock);
        list_del_init(&ap_dev->list);
        spin_unlock_bh(&ap_device_lock);
+       spin_lock_bh(&ap_dev->lock);
+       atomic_sub(ap_dev->queue_count, &ap_poll_requests);
+       spin_unlock_bh(&ap_dev->lock);
        return 0;
 }
 
@@ -757,10 +760,16 @@ static void ap_scan_bus(struct work_struct *unused)
                                      (void *)(unsigned long)qid,
                                      __ap_scan_bus);
                rc = ap_query_queue(qid, &queue_depth, &device_type);
-               if (dev && rc) {
-                       put_device(dev);
-                       device_unregister(dev);
-                       continue;
+               if (dev) {
+                       ap_dev = to_ap_dev(dev);
+                       spin_lock_bh(&ap_dev->lock);
+                       if (rc || ap_dev->unregistered) {
+                               spin_unlock_bh(&ap_dev->lock);
+                               put_device(dev);
+                               device_unregister(dev);
+                               continue;
+                       } else
+                               spin_unlock_bh(&ap_dev->lock);
                }
                if (dev) {
                        put_device(dev);
@@ -861,6 +870,7 @@ static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags)
        case AP_RESPONSE_NO_PENDING_REPLY:
                if (status.queue_empty) {
                        /* The card shouldn't forget requests but who knows. */
+                       atomic_sub(ap_dev->queue_count, &ap_poll_requests);
                        ap_dev->queue_count = 0;
                        list_splice_init(&ap_dev->pendingq, &ap_dev->requestq);
                        ap_dev->requestq_count += ap_dev->pendingq_count;
@@ -994,7 +1004,7 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
                        ap_dev->unregistered = 1;
        } else {
                ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV));
-               rc = 0;
+               rc = -ENODEV;
        }
        spin_unlock_bh(&ap_dev->lock);
        if (rc == -ENODEV)
@@ -1044,18 +1054,12 @@ static void ap_poll_timeout(unsigned long unused)
  */
 static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags)
 {
-       int rc;
-
        spin_lock(&ap_dev->lock);
        if (!ap_dev->unregistered) {
-               rc = ap_poll_queue(ap_dev, flags);
-               if (rc)
+               if (ap_poll_queue(ap_dev, flags))
                        ap_dev->unregistered = 1;
-       } else
-               rc = 0;
+       }
        spin_unlock(&ap_dev->lock);
-       if (rc)
-               device_unregister(&ap_dev->device);
        return 0;
 }
 
index 8c81cec..60446b8 100644 (file)
@@ -3091,6 +3091,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
             cmdp->u.raw64.direction  = 
                 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
             memcpy(cmdp->u.raw64.cmd,scp->cmnd,16);
+            cmdp->u.raw64.sg_ranz    = 0;
         } else {
             cmdp->u.raw.reserved   = 0;
             cmdp->u.raw.mdisc_time = 0;
@@ -3107,6 +3108,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
             cmdp->u.raw.direction  = 
                 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
             memcpy(cmdp->u.raw.cmd,scp->cmnd,12);
+            cmdp->u.raw.sg_ranz    = 0;
         }
 
         if (scp->use_sg) {
index 9d014e5..057fd7e 100644 (file)
@@ -1817,10 +1817,9 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
        struct lpfc_sli *psli = &phba->sli;
        struct lpfc_sli_ring  *pring;
 
-       if (state == pci_channel_io_perm_failure) {
-               lpfc_pci_remove_one(pdev);
+       if (state == pci_channel_io_perm_failure)
                return PCI_ERS_RESULT_DISCONNECT;
-       }
+
        pci_disable_device(pdev);
        /*
         * There may be I/Os dropped by the firmware.
index b8edcf5..918bb60 100644 (file)
@@ -716,7 +716,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
         */
        if (copy_sense) {
                if (!SCSI_SENSE_VALID(scmd)) {
-                       memcpy(scmd->sense_buffer, scmd->request_buffer,
+                       memcpy(scmd->sense_buffer, page_address(sgl.page),
                               sizeof(scmd->sense_buffer));
                }
                __free_page(sgl.page);
index cde5db4..301c8c0 100644 (file)
@@ -340,6 +340,9 @@ static const struct pnp_device_id pnp_dev_table[] = {
        {       "FUJ02B8",              0 },
        {       "FUJ02B9",              0 },
        {       "FUJ02BC",              0 },
+       /* Fujitsu Wacom Tablet PC devices */
+       {       "FUJ02E5",              0       },
+       {       "FUJ02E6",              0       },
        /* Rockwell's (PORALiNK) 33600 INT PNP */
        {       "WCI0003",              0       },
        /* Unkown PnP modems */
index 2328128..6657331 100644 (file)
@@ -189,8 +189,8 @@ static DECLARE_MUTEX(board_lock);
  * this is exported so that for example a USB or parport based adapter
  * driver could add devices (which it would learn about out-of-band).
  */
-struct spi_device *__init_or_module
-spi_new_device(struct spi_master *master, struct spi_board_info *chip)
+struct spi_device *spi_new_device(struct spi_master *master,
+                                 struct spi_board_info *chip)
 {
        struct spi_device       *proxy;
        struct device           *dev = master->cdev.dev;
@@ -352,8 +352,7 @@ static struct class spi_master_class = {
  * the master's methods before calling spi_register_master(); and (after errors
  * adding the device) calling spi_master_put() to prevent a memory leak.
  */
-struct spi_master * __init_or_module
-spi_alloc_master(struct device *dev, unsigned size)
+struct spi_master *spi_alloc_master(struct device *dev, unsigned size)
 {
        struct spi_master       *master;
 
@@ -392,8 +391,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
  * After a successful return, the caller is responsible for calling
  * spi_unregister_master().
  */
-int __init_or_module
-spi_register_master(struct spi_master *master)
+int spi_register_master(struct spi_master *master)
 {
        static atomic_t         dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
        struct device           *dev = master->cdev.dev;
index 3d72aa5..3524e3f 100644 (file)
@@ -70,7 +70,6 @@
 #include <asm/dec/machtype.h>
 #include <asm/dec/serial.h>
 #include <asm/dec/system.h>
-#include <asm/dec/tc.h>
 
 #ifdef CONFIG_KGDB
 #include <asm/kgdb.h>
index 0e5c646..f08ec85 100644 (file)
@@ -30,7 +30,8 @@
 static const struct usb_device_id usb_quirk_list[] = {
        /* HP 5300/5370C scanner */
        { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
-
+       /* Seiko Epson Corp - Perfection 1670 */
+       { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
        /* Elsa MicroLink 56k (V.250) */
        { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
 
index 8f9a2b6..b394e63 100644 (file)
@@ -296,6 +296,15 @@ omap_free_request(struct usb_ep *ep, struct usb_request *_req)
 
 /*-------------------------------------------------------------------------*/
 
+/*
+ * dma-coherent memory allocation (for dma-capable endpoints)
+ *
+ * NOTE: the dma_*_coherent() API calls suck.  Most implementations are
+ * (a) page-oriented, so small buffers lose big; and (b) asymmetric with
+ * respect to calls with irqs disabled:  alloc is safe, free is not.
+ * We currently work around (b), but not (a).
+ */
+
 static void *
 omap_alloc_buffer(
        struct usb_ep   *_ep,
@@ -307,6 +316,9 @@ omap_alloc_buffer(
        void            *retval;
        struct omap_ep  *ep;
 
+       if (!_ep)
+               return NULL;
+
        ep = container_of(_ep, struct omap_ep, ep);
        if (use_dma && ep->has_dma) {
                static int      warned;
@@ -326,6 +338,35 @@ omap_alloc_buffer(
        return retval;
 }
 
+static DEFINE_SPINLOCK(buflock);
+static LIST_HEAD(buffers);
+
+struct free_record {
+       struct list_head        list;
+       struct device           *dev;
+       unsigned                bytes;
+       dma_addr_t              dma;
+};
+
+static void do_free(unsigned long ignored)
+{
+       spin_lock_irq(&buflock);
+       while (!list_empty(&buffers)) {
+               struct free_record      *buf;
+
+               buf = list_entry(buffers.next, struct free_record, list);
+               list_del(&buf->list);
+               spin_unlock_irq(&buflock);
+
+               dma_free_coherent(buf->dev, buf->bytes, buf, buf->dma);
+
+               spin_lock_irq(&buflock);
+       }
+       spin_unlock_irq(&buflock);
+}
+
+static DECLARE_TASKLET(deferred_free, do_free, 0);
+
 static void omap_free_buffer(
        struct usb_ep   *_ep,
        void            *buf,
@@ -333,13 +374,29 @@ static void omap_free_buffer(
        unsigned        bytes
 )
 {
-       struct omap_ep  *ep;
+       if (!_ep) {
+               WARN_ON(1);
+               return;
+       }
 
-       ep = container_of(_ep, struct omap_ep, ep);
-       if (use_dma && _ep && ep->has_dma)
-               dma_free_coherent(ep->udc->gadget.dev.parent, bytes, buf, dma);
-       else
-               kfree (buf);
+       /* free memory into the right allocator */
+       if (dma != DMA_ADDR_INVALID) {
+               struct omap_ep          *ep;
+               struct free_record      *rec = buf;
+               unsigned long           flags;
+
+               ep = container_of(_ep, struct omap_ep, ep);
+
+               rec->dev = ep->udc->gadget.dev.parent;
+               rec->bytes = bytes;
+               rec->dma = dma;
+
+               spin_lock_irqsave(&buflock, flags);
+               list_add_tail(&rec->list, &buffers);
+               tasklet_schedule(&deferred_free);
+               spin_unlock_irqrestore(&buflock, flags);
+       } else
+               kfree(buf);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -1691,12 +1748,38 @@ ep0out_status_stage:
                        udc->ep0_pending = 0;
                        break;
                case USB_REQ_GET_STATUS:
+                       /* USB_ENDPOINT_HALT status? */
+                       if (u.r.bRequestType != (USB_DIR_IN|USB_RECIP_ENDPOINT))
+                               goto intf_status;
+
+                       /* ep0 never stalls */
+                       if (!(w_index & 0xf))
+                               goto zero_status;
+
+                       /* only active endpoints count */
+                       ep = &udc->ep[w_index & 0xf];
+                       if (w_index & USB_DIR_IN)
+                               ep += 16;
+                       if (!ep->desc)
+                               goto do_stall;
+
+                       /* iso never stalls */
+                       if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC)
+                               goto zero_status;
+
+                       /* FIXME don't assume non-halted endpoints!! */
+                       ERR("%s status, can't report\n", ep->ep.name);
+                       goto do_stall;
+
+intf_status:
                        /* return interface status.  if we were pedantic,
                         * we'd detect non-existent interfaces, and stall.
                         */
                        if (u.r.bRequestType
                                        != (USB_DIR_IN|USB_RECIP_INTERFACE))
                                goto delegate;
+
+zero_status:
                        /* return two zero bytes */
                        UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR;
                        UDC_DATA_REG = 0;
@@ -2068,7 +2151,7 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev)
 
 /*-------------------------------------------------------------------------*/
 
-static inline int machine_needs_vbus_session(void)
+static inline int machine_without_vbus_sense(void)
 {
        return (machine_is_omap_innovator()
                || machine_is_omap_osk()
@@ -2156,7 +2239,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
        /* boards that don't have VBUS sensing can't autogate 48MHz;
         * can't enter deep sleep while a gadget driver is active.
         */
-       if (machine_needs_vbus_session())
+       if (machine_without_vbus_sense())
                omap_vbus_session(&udc->gadget, 1);
 
 done:
@@ -2179,7 +2262,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
        if (udc->dc_clk != NULL)
                omap_udc_enable_clock(1);
 
-       if (machine_needs_vbus_session())
+       if (machine_without_vbus_sense())
                omap_vbus_session(&udc->gadget, 0);
 
        if (udc->transceiver)
@@ -2822,7 +2905,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
                hmc = HMC_1510;
                type = "(unknown)";
 
-               if (machine_is_omap_innovator() || machine_is_sx1()) {
+               if (machine_without_vbus_sense()) {
                        /* just set up software VBUS detect, and then
                         * later rig it so we always report VBUS.
                         * FIXME without really sensing VBUS, we can't
index 8d24d3d..1497371 100644 (file)
@@ -145,7 +145,8 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space)
        return out - buf;
 }
 
-static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
+static int uhci_show_qh(struct uhci_hcd *uhci,
+               struct uhci_qh *qh, char *buf, int len, int space)
 {
        char *out = buf;
        int i, nurbs;
@@ -190,6 +191,9 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
 
        if (list_empty(&qh->queue)) {
                out += sprintf(out, "%*s  queue is empty\n", space, "");
+               if (qh == uhci->skel_async_qh)
+                       out += uhci_show_td(uhci->term_td, out,
+                                       len - (out - buf), 0);
        } else {
                struct urb_priv *urbp = list_entry(qh->queue.next,
                                struct urb_priv, node);
@@ -343,6 +347,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
        struct list_head *tmp, *head;
        int nframes, nerrs;
        __le32 link;
+       __le32 fsbr_link;
 
        static const char * const qh_names[] = {
                "unlink", "iso", "int128", "int64", "int32", "int16",
@@ -424,21 +429,22 @@ check_link:
 
        out += sprintf(out, "Skeleton QHs\n");
 
+       fsbr_link = 0;
        for (i = 0; i < UHCI_NUM_SKELQH; ++i) {
                int cnt = 0;
-               __le32 fsbr_link = 0;
 
                qh = uhci->skelqh[i];
                out += sprintf(out, "- skel_%s_qh\n", qh_names[i]); \
-               out += uhci_show_qh(qh, out, len - (out - buf), 4);
+               out += uhci_show_qh(uhci, qh, out, len - (out - buf), 4);
 
                /* Last QH is the Terminating QH, it's different */
                if (i == SKEL_TERM) {
                        if (qh_element(qh) != LINK_TO_TD(uhci->term_td))
                                out += sprintf(out, "    skel_term_qh element is not set to term_td!\n");
-                       if (link == LINK_TO_QH(uhci->skel_term_qh))
-                               goto check_qh_link;
-                       continue;
+                       link = fsbr_link;
+                       if (!link)
+                               link = LINK_TO_QH(uhci->skel_term_qh);
+                       goto check_qh_link;
                }
 
                head = &qh->node;
@@ -448,7 +454,7 @@ check_link:
                        qh = list_entry(tmp, struct uhci_qh, node);
                        tmp = tmp->next;
                        if (++cnt <= 10)
-                               out += uhci_show_qh(qh, out,
+                               out += uhci_show_qh(uhci, qh, out,
                                                len - (out - buf), 4);
                        if (!fsbr_link && qh->skel >= SKEL_FSBR)
                                fsbr_link = LINK_TO_QH(qh);
@@ -463,8 +469,6 @@ check_link:
                        link = LINK_TO_QH(uhci->skel_async_qh);
                else if (!uhci->fsbr_is_on)
                        ;
-               else if (fsbr_link)
-                       link = fsbr_link;
                else
                        link = LINK_TO_QH(uhci->skel_term_qh);
 check_qh_link:
@@ -573,8 +577,8 @@ static const struct file_operations uhci_debug_operations = {
 static inline void lprintk(char *buf)
 {}
 
-static inline int uhci_show_qh(struct uhci_qh *qh, char *buf,
-               int len, int space)
+static inline int uhci_show_qh(struct uhci_hcd *uhci,
+               struct uhci_qh *qh, char *buf, int len, int space)
 {
        return 0;
 }
index 44da433..d22da26 100644 (file)
@@ -632,7 +632,8 @@ static int uhci_start(struct usb_hcd *hcd)
         */
        for (i = SKEL_ISO + 1; i < SKEL_ASYNC; ++i)
                uhci->skelqh[i]->link = LINK_TO_QH(uhci->skel_async_qh);
-       uhci->skel_async_qh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM;
+       uhci->skel_async_qh->link = UHCI_PTR_TERM;
+       uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh);
 
        /* This dummy TD is to work around a bug in Intel PIIX controllers */
        uhci_fill_td(uhci->term_td, 0, uhci_explen(0) |
index f4ebdb3..19a0cc0 100644 (file)
@@ -45,43 +45,27 @@ static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci)
  */
 static void uhci_fsbr_on(struct uhci_hcd *uhci)
 {
-       struct uhci_qh *fsbr_qh, *lqh, *tqh;
+       struct uhci_qh *lqh;
 
+       /* The terminating skeleton QH always points back to the first
+        * FSBR QH.  Make the last async QH point to the terminating
+        * skeleton QH. */
        uhci->fsbr_is_on = 1;
        lqh = list_entry(uhci->skel_async_qh->node.prev,
                        struct uhci_qh, node);
-
-       /* Find the first FSBR QH.  Linear search through the list is
-        * acceptable because normally FSBR gets turned on as soon as
-        * one QH needs it. */
-       fsbr_qh = NULL;
-       list_for_each_entry_reverse(tqh, &uhci->skel_async_qh->node, node) {
-               if (tqh->skel < SKEL_FSBR)
-                       break;
-               fsbr_qh = tqh;
-       }
-
-       /* No FSBR QH means we must insert the terminating skeleton QH */
-       if (!fsbr_qh) {
-               uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh);
-               wmb();
-               lqh->link = uhci->skel_term_qh->link;
-
-       /* Otherwise loop the last QH to the first FSBR QH */
-       } else
-               lqh->link = LINK_TO_QH(fsbr_qh);
+       lqh->link = LINK_TO_QH(uhci->skel_term_qh);
 }
 
 static void uhci_fsbr_off(struct uhci_hcd *uhci)
 {
        struct uhci_qh *lqh;
 
+       /* Remove the link from the last async QH to the terminating
+        * skeleton QH. */
        uhci->fsbr_is_on = 0;
        lqh = list_entry(uhci->skel_async_qh->node.prev,
                        struct uhci_qh, node);
-
-       /* End the async list normally and unlink the terminating QH */
-       lqh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM;
+       lqh->link = UHCI_PTR_TERM;
 }
 
 static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb)
@@ -464,9 +448,8 @@ static void link_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh)
  */
 static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
 {
-       struct uhci_qh *pqh, *lqh;
+       struct uhci_qh *pqh;
        __le32 link_to_new_qh;
-       __le32 *extra_link = &link_to_new_qh;
 
        /* Find the predecessor QH for our new one and insert it in the list.
         * The list of QHs is expected to be short, so linear search won't
@@ -476,31 +459,17 @@ static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
                        break;
        }
        list_add(&qh->node, &pqh->node);
-       qh->link = pqh->link;
-
-       link_to_new_qh = LINK_TO_QH(qh);
-
-       /* If this is now the first FSBR QH, take special action */
-       if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR &&
-                       qh->skel >= SKEL_FSBR) {
-               lqh = list_entry(uhci->skel_async_qh->node.prev,
-                               struct uhci_qh, node);
-
-               /* If the new QH is also the last one, we must unlink
-                * the terminating skeleton QH and make the new QH point
-                * back to itself. */
-               if (qh == lqh) {
-                       qh->link = link_to_new_qh;
-                       extra_link = &uhci->skel_term_qh->link;
-
-               /* Otherwise the last QH must point to the new QH */
-               } else
-                       extra_link = &lqh->link;
-       }
 
        /* Link it into the schedule */
+       qh->link = pqh->link;
        wmb();
-       *extra_link = pqh->link = link_to_new_qh;
+       link_to_new_qh = LINK_TO_QH(qh);
+       pqh->link = link_to_new_qh;
+
+       /* If this is now the first FSBR QH, link the terminating skeleton
+        * QH to it. */
+       if (pqh->skel < SKEL_FSBR && qh->skel >= SKEL_FSBR)
+               uhci->skel_term_qh->link = link_to_new_qh;
 }
 
 /*
@@ -561,31 +530,16 @@ static void unlink_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh)
  */
 static void unlink_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
 {
-       struct uhci_qh *pqh, *lqh;
+       struct uhci_qh *pqh;
        __le32 link_to_next_qh = qh->link;
 
        pqh = list_entry(qh->node.prev, struct uhci_qh, node);
-
-       /* If this is the first FSBQ QH, take special action */
-       if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR &&
-                       qh->skel >= SKEL_FSBR) {
-               lqh = list_entry(uhci->skel_async_qh->node.prev,
-                               struct uhci_qh, node);
-
-               /* If this QH is also the last one, we must link in
-                * the terminating skeleton QH. */
-               if (qh == lqh) {
-                       link_to_next_qh = LINK_TO_QH(uhci->skel_term_qh);
-                       uhci->skel_term_qh->link = link_to_next_qh;
-                       wmb();
-                       qh->link = link_to_next_qh;
-
-               /* Otherwise the last QH must point to the new first FSBR QH */
-               } else
-                       lqh->link = link_to_next_qh;
-       }
-
        pqh->link = link_to_next_qh;
+
+       /* If this was the old first FSBR QH, link the terminating skeleton
+        * QH to the next (new first FSBR) QH. */
+       if (pqh->skel < SKEL_FSBR && qh->skel >= SKEL_FSBR)
+               uhci->skel_term_qh->link = link_to_next_qh;
        mb();
 }
 
@@ -1217,7 +1171,7 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
 
                                if (debug > 1 && errbuf) {
                                        /* Print the chain for debugging */
-                                       uhci_show_qh(urbp->qh, errbuf,
+                                       uhci_show_qh(uhci, urbp->qh, errbuf,
                                                        ERRBUF_LEN, 0);
                                        lprintk(errbuf);
                                }
index 7538c64..39a4983 100644 (file)
@@ -18,7 +18,6 @@
 
 static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
-       { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */
        { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */
        { },
 };
index 1633a0f..8ff9d54 100644 (file)
@@ -879,6 +879,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
                break;
        case FT232BM: /* FT232BM chip */
        case FT2232C: /* FT2232C chip */
+       case FT232RL:
                if (baud <= 3000000) {
                        div_value = ftdi_232bm_baud_to_divisor(baud);
                } else {
@@ -1021,9 +1022,12 @@ static void ftdi_determine_type(struct usb_serial_port *port)
                /* (It might be a BM because of the iSerialNumber bug,
                 * but it will still work as an AM device.) */
                priv->chip_type = FT8U232AM;
-       } else {
+       } else if (version < 0x600) {
                /* Assume its an FT232BM (or FT245BM) */
                priv->chip_type = FT232BM;
+       } else {
+               /* Assume its an FT232R  */
+               priv->chip_type = FT232RL;
        }
        info("Detected %s", ftdi_chip_name[priv->chip_type]);
 }
index 53baeec..4f8282a 100644 (file)
 #include <linux/usb/serial.h>
 #include <asm/uaccess.h>
 
-static int generic_probe(struct usb_interface *interface,
-                        const struct usb_device_id *id);
-
 
 static int debug;
 
 #ifdef CONFIG_USB_SERIAL_GENERIC
+
+static int generic_probe(struct usb_interface *interface,
+                        const struct usb_device_id *id);
+
 static __u16 vendor  = 0x05f9;
 static __u16 product = 0xffff;
 
index ada6f7e..767c850 100644 (file)
@@ -186,8 +186,7 @@ static int cg3_setcolreg(unsigned regno,
  *      @blank_mode: the blank mode we want.
  *      @info: frame buffer structure that represents a single frame buffer
  */
-static int
-cg3_blank(int blank, struct fb_info *info)
+static int cg3_blank(int blank, struct fb_info *info)
 {
        struct cg3_par *par = (struct cg3_par *) info->par;
        struct cg3_regs __iomem *regs = par->regs;
@@ -251,8 +250,8 @@ static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
  *  Initialisation
  */
 
-static void
-cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp)
+static void __devinit cg3_init_fix(struct fb_info *info, int linebytes,
+                                  struct device_node *dp)
 {
        strlcpy(info->fix.id, dp->name, sizeof(info->fix.id));
 
@@ -264,8 +263,8 @@ cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp)
        info->fix.accel = FB_ACCEL_SUN_CGTHREE;
 }
 
-static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
-                                   struct device_node *dp)
+static void __devinit cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
+                                             struct device_node *dp)
 {
        char *params;
        char *p;
@@ -287,36 +286,36 @@ static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
        }
 }
 
-static u8 cg3regvals_66hz[] __initdata = {     /* 1152 x 900, 66 Hz */
+static u8 cg3regvals_66hz[] __devinitdata = {  /* 1152 x 900, 66 Hz */
        0x14, 0xbb,     0x15, 0x2b,     0x16, 0x04,     0x17, 0x14,
        0x18, 0xae,     0x19, 0x03,     0x1a, 0xa8,     0x1b, 0x24,
        0x1c, 0x01,     0x1d, 0x05,     0x1e, 0xff,     0x1f, 0x01,
        0x10, 0x20,     0
 };
 
-static u8 cg3regvals_76hz[] __initdata = {     /* 1152 x 900, 76 Hz */
+static u8 cg3regvals_76hz[] __devinitdata = {  /* 1152 x 900, 76 Hz */
        0x14, 0xb7,     0x15, 0x27,     0x16, 0x03,     0x17, 0x0f,
        0x18, 0xae,     0x19, 0x03,     0x1a, 0xae,     0x1b, 0x2a,
        0x1c, 0x01,     0x1d, 0x09,     0x1e, 0xff,     0x1f, 0x01,
        0x10, 0x24,     0
 };
 
-static u8 cg3regvals_rdi[] __initdata = {      /* 640 x 480, cgRDI */
+static u8 cg3regvals_rdi[] __devinitdata = {   /* 640 x 480, cgRDI */
        0x14, 0x70,     0x15, 0x20,     0x16, 0x08,     0x17, 0x10,
        0x18, 0x06,     0x19, 0x02,     0x1a, 0x31,     0x1b, 0x51,
        0x1c, 0x06,     0x1d, 0x0c,     0x1e, 0xff,     0x1f, 0x01,
        0x10, 0x22,     0
 };
 
-static u8 *cg3_regvals[] __initdata = {
+static u8 *cg3_regvals[] __devinitdata = {
        cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi
 };
 
-static u_char cg3_dacvals[] __initdata = {
+static u_char cg3_dacvals[] __devinitdata = {
        4, 0xff,        5, 0x00,        6, 0x70,        7, 0x00,        0
 };
 
-static void cg3_do_default_mode(struct cg3_par *par)
+static void __devinit cg3_do_default_mode(struct cg3_par *par)
 {
        enum cg3_type type;
        u8 *p;
@@ -433,7 +432,8 @@ static int __devinit cg3_init_one(struct of_device *op)
        return 0;
 }
 
-static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id *match)
+static int __devinit cg3_probe(struct of_device *dev,
+                              const struct of_device_id *match)
 {
        struct of_device *op = to_of_device(&dev->dev);
 
index 15854ae..1d4e835 100644 (file)
@@ -336,14 +336,30 @@ struct ffb_dac {
        u32     value2;
 };
 
+#define FFB_DAC_UCTRL  0x1001 /* User Control */
+#define  FFB_DAC_UCTRL_MANREV  0x00000f00 /* 4-bit Manufacturing Revision */
+#define  FFB_DAC_UCTRL_MANREV_SHIFT 8
+#define FFB_DAC_TGEN   0x6000 /* Timing Generator */
+#define  FFB_DAC_TGEN_VIDE     0x00000001 /* Video Enable */
+#define FFB_DAC_DID    0x8000 /* Device Identification */
+#define  FFB_DAC_DID_PNUM      0x0ffff000 /* Device Part Number */
+#define  FFB_DAC_DID_PNUM_SHIFT 12
+#define  FFB_DAC_DID_REV       0xf0000000 /* Device Revision */
+#define  FFB_DAC_DID_REV_SHIFT 28
+
+#define FFB_DAC_CUR_CTRL       0x100
+#define  FFB_DAC_CUR_CTRL_P0   0x00000001
+#define  FFB_DAC_CUR_CTRL_P1   0x00000002
+
 struct ffb_par {
        spinlock_t              lock;
        struct ffb_fbc __iomem  *fbc;
        struct ffb_dac __iomem  *dac;
 
        u32                     flags;
-#define FFB_FLAG_AFB           0x00000001
-#define FFB_FLAG_BLANKED       0x00000002
+#define FFB_FLAG_AFB           0x00000001 /* AFB m3 or m6 */
+#define FFB_FLAG_BLANKED       0x00000002 /* screen is blanked */
+#define FFB_FLAG_INVCURSOR     0x00000004 /* DAC has inverted cursor logic */
 
        u32                     fg_cache __attribute__((aligned (8)));
        u32                     bg_cache;
@@ -354,7 +370,6 @@ struct ffb_par {
        unsigned long           physbase;
        unsigned long           fbsize;
 
-       int                     dac_rev;
        int                     board_type;
 };
 
@@ -426,11 +441,12 @@ static void ffb_switch_from_graph(struct ffb_par *par)
        FFBWait(par);
 
        /* Disable cursor.  */
-       upa_writel(0x100, &dac->type2);
-       if (par->dac_rev <= 2)
+       upa_writel(FFB_DAC_CUR_CTRL, &dac->type2);
+       if (par->flags & FFB_FLAG_INVCURSOR)
                upa_writel(0, &dac->value2);
        else
-               upa_writel(3, &dac->value2);
+               upa_writel((FFB_DAC_CUR_CTRL_P0 |
+                           FFB_DAC_CUR_CTRL_P1), &dac->value2);
 
        spin_unlock_irqrestore(&par->lock, flags);
 }
@@ -664,18 +680,18 @@ ffb_blank(int blank, struct fb_info *info)
        struct ffb_par *par = (struct ffb_par *) info->par;
        struct ffb_dac __iomem *dac = par->dac;
        unsigned long flags;
-       u32 tmp;
+       u32 val;
+       int i;
 
        spin_lock_irqsave(&par->lock, flags);
 
        FFBWait(par);
 
+       upa_writel(FFB_DAC_TGEN, &dac->type);
+       val = upa_readl(&dac->value);
        switch (blank) {
        case FB_BLANK_UNBLANK: /* Unblanking */
-               upa_writel(0x6000, &dac->type);
-               tmp = (upa_readl(&dac->value) | 0x1);
-               upa_writel(0x6000, &dac->type);
-               upa_writel(tmp, &dac->value);
+               val |= FFB_DAC_TGEN_VIDE;
                par->flags &= ~FFB_FLAG_BLANKED;
                break;
 
@@ -683,13 +699,16 @@ ffb_blank(int blank, struct fb_info *info)
        case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */
        case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */
        case FB_BLANK_POWERDOWN: /* Poweroff */
-               upa_writel(0x6000, &dac->type);
-               tmp = (upa_readl(&dac->value) & ~0x1);
-               upa_writel(0x6000, &dac->type);
-               upa_writel(tmp, &dac->value);
+               val &= ~FFB_DAC_TGEN_VIDE;
                par->flags |= FFB_FLAG_BLANKED;
                break;
        }
+       upa_writel(FFB_DAC_TGEN, &dac->type);
+       upa_writel(val, &dac->value);
+       for (i = 0; i < 10; i++) {
+               upa_writel(FFB_DAC_TGEN, &dac->type);
+               upa_readl(&dac->value);
+       }
 
        spin_unlock_irqrestore(&par->lock, flags);
 
@@ -894,6 +913,7 @@ static int ffb_init_one(struct of_device *op)
        struct ffb_dac __iomem *dac;
        struct all_info *all;
        int err;
+       u32 dac_pnum, dac_rev, dac_mrev;
 
        all = kzalloc(sizeof(*all), GFP_KERNEL);
        if (!all)
@@ -948,17 +968,31 @@ static int ffb_init_one(struct of_device *op)
        if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0)
                upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr);
 
-       ffb_switch_from_graph(&all->par);
-
        dac = all->par.dac;
-       upa_writel(0x8000, &dac->type);
-       all->par.dac_rev = upa_readl(&dac->value) >> 0x1c;
+       upa_writel(FFB_DAC_DID, &dac->type);
+       dac_pnum = upa_readl(&dac->value);
+       dac_rev = (dac_pnum & FFB_DAC_DID_REV) >> FFB_DAC_DID_REV_SHIFT;
+       dac_pnum = (dac_pnum & FFB_DAC_DID_PNUM) >> FFB_DAC_DID_PNUM_SHIFT;
+
+       upa_writel(FFB_DAC_UCTRL, &dac->type);
+       dac_mrev = upa_readl(&dac->value);
+       dac_mrev = (dac_mrev & FFB_DAC_UCTRL_MANREV) >>
+               FFB_DAC_UCTRL_MANREV_SHIFT;
 
        /* Elite3D has different DAC revision numbering, and no DAC revisions
-        * have the reversed meaning of cursor enable.
+        * have the reversed meaning of cursor enable.  Otherwise, Pacifica 1
+        * ramdacs with manufacturing revision less than 3 have inverted
+        * cursor logic.  We identify Pacifica 1 as not Pacifica 2, the
+        * latter having a part number value of 0x236e.
         */
-       if (all->par.flags & FFB_FLAG_AFB)
-               all->par.dac_rev = 10;
+       if ((all->par.flags & FFB_FLAG_AFB) || dac_pnum == 0x236e) {
+               all->par.flags &= ~FFB_FLAG_INVCURSOR;
+       } else {
+               if (dac_mrev < 3)
+                       all->par.flags |= FFB_FLAG_INVCURSOR;
+       }
+
+       ffb_switch_from_graph(&all->par);
 
        /* Unblank it just to be sure.  When there are multiple
         * FFB/AFB cards in the system, or it is not the OBP
@@ -993,10 +1027,12 @@ static int ffb_init_one(struct of_device *op)
 
        dev_set_drvdata(&op->dev, all);
 
-       printk("%s: %s at %016lx, type %d, DAC revision %d\n",
+       printk("%s: %s at %016lx, type %d, "
+              "DAC pnum[%x] rev[%d] manuf_rev[%d]\n",
               dp->full_name,
               ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"),
-              all->par.physbase, all->par.board_type, all->par.dac_rev);
+              all->par.physbase, all->par.board_type,
+              dac_pnum, dac_rev, dac_mrev);
 
        return 0;
 }
index 1d1c7c6..d7ece8d 100644 (file)
@@ -285,8 +285,6 @@ static const struct riva_regs reg_template = {
 #define MAX_LEVEL 0x534
 #define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX)
 
-static struct backlight_properties riva_bl_data;
-
 static int riva_bl_get_level_brightness(struct riva_par *par,
                int level)
 {
@@ -372,7 +370,7 @@ static void riva_bl_init(struct riva_par *par)
                FB_BACKLIGHT_MAX);
 
        bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
-       bd->props.brightness = riva_bl_data.max_brightness;
+       bd->props.brightness = bd->props.max_brightness;
        bd->props.power = FB_BLANK_UNBLANK;
        backlight_update_status(bd);
 
index 98919a6..3091b20 100644 (file)
@@ -1000,11 +1000,12 @@ err_enable_device:
 static void __devexit s3_pci_remove(struct pci_dev *dev)
 {
        struct fb_info *info = pci_get_drvdata(dev);
-       struct s3fb_info *par = info->par;
 
        if (info) {
 
 #ifdef CONFIG_MTRR
+               struct s3fb_info *par = info->par;
+
                if (par->mtrr_reg >= 0) {
                        mtrr_del(par->mtrr_reg, 0, 0);
                        par->mtrr_reg = -1;
index 8ada4c5..6a82d39 100644 (file)
@@ -40,7 +40,6 @@
 extern struct file_system_type v9fs_fs_type;
 extern const struct address_space_operations v9fs_addr_operations;
 extern const struct file_operations v9fs_file_operations;
-extern const struct file_operations v9fs_cached_file_operations;
 extern const struct file_operations v9fs_dir_operations;
 extern struct dentry_operations v9fs_dentry_operations;
 extern struct dentry_operations v9fs_cached_dentry_operations;
index 653dfa5..c7b6772 100644 (file)
@@ -42,6 +42,8 @@
 #include "v9fs_vfs.h"
 #include "fid.h"
 
+static const struct file_operations v9fs_cached_file_operations;
+
 /**
  * v9fs_file_open - open a file (or directory)
  * @inode: inode to be opened
@@ -245,7 +247,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
        return total;
 }
 
-const struct file_operations v9fs_cached_file_operations = {
+static const struct file_operations v9fs_cached_file_operations = {
        .llseek = generic_file_llseek,
        .read = do_sync_read,
        .aio_read = generic_file_aio_read,
index 0b4ee0a..e4598d6 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -136,7 +136,6 @@ static int aio_setup_ring(struct kioctx *ctx)
                                  0);
        if (IS_ERR((void *)info->mmap_base)) {
                up_write(&ctx->mm->mmap_sem);
-               printk("mmap err: %ld\n", -info->mmap_base);
                info->mmap_size = 0;
                aio_free_ring(ctx);
                return -EAGAIN;
index a2fceba..9cc4f0a 100644 (file)
@@ -1704,7 +1704,10 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
                                DUMP_SEEK(PAGE_SIZE);
                        } else {
                                if (page == ZERO_PAGE(addr)) {
-                                       DUMP_SEEK(PAGE_SIZE);
+                                       if (!dump_seek(file, PAGE_SIZE)) {
+                                               page_cache_release(page);
+                                               goto end_coredump;
+                                       }
                                } else {
                                        void *kaddr;
                                        flush_cache_page(vma, addr,
index 5810aa1..f3ddca4 100644 (file)
@@ -179,6 +179,8 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
        int executable_stack;
        int retval, i;
 
+       kdebug("____ LOAD %d ____", current->pid);
+
        memset(&exec_params, 0, sizeof(exec_params));
        memset(&interp_params, 0, sizeof(interp_params));
 
@@ -941,8 +943,11 @@ static int elf_fdpic_map_file_constdisp_on_uclinux(
 
                if (mm) {
                        if (phdr->p_flags & PF_X) {
-                               mm->start_code = seg->addr;
-                               mm->end_code = seg->addr + phdr->p_memsz;
+                               if (!mm->start_code) {
+                                       mm->start_code = seg->addr;
+                                       mm->end_code = seg->addr +
+                                               phdr->p_memsz;
+                               }
                        } else if (!mm->start_data) {
                                mm->start_data = seg->addr;
 #ifndef CONFIG_MMU
@@ -1123,8 +1128,10 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
 
                if (mm) {
                        if (phdr->p_flags & PF_X) {
-                               mm->start_code = maddr;
-                               mm->end_code = maddr + phdr->p_memsz;
+                               if (!mm->start_code) {
+                                       mm->start_code = maddr;
+                                       mm->end_code = maddr + phdr->p_memsz;
+                               }
                        } else if (!mm->start_data) {
                                mm->start_data = maddr;
                                mm->end_data = maddr + phdr->p_memsz;
@@ -1473,8 +1480,8 @@ static int elf_fdpic_dump_segments(struct file *file, struct mm_struct *mm,
                                DUMP_SEEK(file->f_pos + PAGE_SIZE);
                        }
                        else if (page == ZERO_PAGE(addr)) {
-                               DUMP_SEEK(file->f_pos + PAGE_SIZE);
                                page_cache_release(page);
+                               DUMP_SEEK(file->f_pos + PAGE_SIZE);
                        }
                        else {
                                void *kaddr;
index 78ced72..164a45c 100644 (file)
@@ -109,8 +109,6 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
        /* temporary */
        if (major == 0) {
                for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) {
-                       if (is_lanana_major(i))
-                               continue;
                        if (chrdevs[i] == NULL)
                                break;
                }
index 6247628..5d1f487 100644 (file)
@@ -4,6 +4,12 @@ Fix mtime bouncing around from local idea of last write times to remote time.
 Fix hang (in i_size_read) when simultaneous size update of same remote file
 on smp system corrupts sequence number. Do not reread unnecessarily partial page
 (which we are about to overwrite anyway) when writing out file opened rw.
+When DOS attribute of file on non-Unix server's file changes on the server side
+from read-only back to read-write, reflect this change in default file mode
+(we had been leaving a file's mode read-only until the inode were reloaded).
+Allow setting of attribute back to ATTR_NORMAL (removing readonly dos attribute
+when archive dos attribute not set and we are changing mode back to writeable
+on server which does not support the Unix Extensions).
 
 Version 1.47
 ------------
index 3af7624..4d8948e 100644 (file)
@@ -1887,7 +1887,13 @@ typedef struct {
                                                      calls including posix open
                                                      and posix unlink */ 
 #ifdef CONFIG_CIFS_POSIX
-#define CIFS_UNIX_CAP_MASK              0x0000003b
+/* Can not set pathnames cap yet until we send new posix create SMB since
+   otherwise server can treat such handles opened with older ntcreatex
+   (by a new client which knows how to send posix path ops)
+   as non-posix handles (can affect write behavior with byte range locks.
+   We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */
+/* #define CIFS_UNIX_CAP_MASK              0x0000003b */
+#define CIFS_UNIX_CAP_MASK              0x0000001b 
 #else 
 #define CIFS_UNIX_CAP_MASK              0x00000013
 #endif /* CONFIG_CIFS_POSIX */
index 86b9dbb..f414526 100644 (file)
@@ -494,6 +494,12 @@ int cifs_get_inode_info(struct inode **pinode,
                           mode e.g. 555 */
                        if (cifsInfo->cifsAttrs & ATTR_READONLY)
                                inode->i_mode &= ~(S_IWUGO);
+                       else if ((inode->i_mode & S_IWUGO) == 0)
+                               /* the ATTR_READONLY flag may have been */
+                               /* changed on server -- set any w bits  */
+                               /* allowed by mnt_file_mode             */
+                               inode->i_mode |= (S_IWUGO &
+                                                 cifs_sb->mnt_file_mode);
                /* BB add code here -
                   validate if device or weird share or device type? */
                }
@@ -1190,6 +1196,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
        struct cifsFileInfo *open_file = NULL;
        FILE_BASIC_INFO time_buf;
        int set_time = FALSE;
+       int set_dosattr = FALSE;
        __u64 mode = 0xFFFFFFFFFFFFFFFFULL;
        __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
        __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
@@ -1326,15 +1333,23 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
        else if (attrs->ia_valid & ATTR_MODE) {
                rc = 0;
                if ((mode & S_IWUGO) == 0) /* not writeable */ {
-                       if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0)
+                       if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
+                               set_dosattr = TRUE;
                                time_buf.Attributes =
                                        cpu_to_le32(cifsInode->cifsAttrs |
                                                    ATTR_READONLY);
+                       }
                } else if ((mode & S_IWUGO) == S_IWUGO) {
-                       if (cifsInode->cifsAttrs & ATTR_READONLY)
+                       if (cifsInode->cifsAttrs & ATTR_READONLY) {
+                               set_dosattr = TRUE;
                                time_buf.Attributes =
                                        cpu_to_le32(cifsInode->cifsAttrs &
                                                    (~ATTR_READONLY));
+                               /* Windows ignores set to zero */
+                               if(time_buf.Attributes == 0)
+                                       time_buf.Attributes |= 
+                                               cpu_to_le32(ATTR_NORMAL);
+                       }
                }
                /* BB to be implemented -
                   via Windows security descriptors or streams */
@@ -1372,7 +1387,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
        } else
                time_buf.ChangeTime = 0;
 
-       if (set_time || time_buf.Attributes) {
+       if (set_time || set_dosattr) {
                time_buf.CreationTime = 0;      /* do not change */
                /* In the future we should experiment - try setting timestamps
                   via Handle (SetFileInfo) instead of by path */
index 44cfb52..2a374d5 100644 (file)
@@ -219,6 +219,10 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
                tmp_inode->i_mode |= S_IFREG;
                if (attr & ATTR_READONLY)
                        tmp_inode->i_mode &= ~(S_IWUGO);
+               else if ((tmp_inode->i_mode & S_IWUGO) == 0)
+                       /* the ATTR_READONLY flag may have been changed on   */
+                       /* server -- set any w bits allowed by mnt_file_mode */
+                       tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode);
        } /* could add code here - to validate if device or weird share type? */
 
        /* can not fill in nlink here as in qpathinfo version and Unx search */
index c81c958..8b1c5d8 100644 (file)
@@ -2553,11 +2553,15 @@ HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl)
 HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl)
 /* wireless */
 HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCGIWPRIV, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCGIWSTATS, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCSIWMLME, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCSIWSCAN, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl)
@@ -2565,6 +2569,11 @@ HANDLE_IOCTL(SIOCSIWNICKN, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCSIWGENIE, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCGIWGENIE, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCSIWENCODEEXT, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCGIWENCODEEXT, do_wireless_ioctl)
+HANDLE_IOCTL(SIOCSIWPMKSA, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl)
 HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl)
 HANDLE_IOCTL(RTC_IRQP_READ32, rtc_ioctl)
index 8a824f4..a5b150f 100644 (file)
@@ -1148,102 +1148,37 @@ static int do_journal_get_write_access(handle_t *handle,
        return ext3_journal_get_write_access(handle, bh);
 }
 
-/*
- * The idea of this helper function is following:
- * if prepare_write has allocated some blocks, but not all of them, the
- * transaction must include the content of the newly allocated blocks.
- * This content is expected to be set to zeroes by block_prepare_write().
- * 2006/10/14  SAW
- */
-static int ext3_prepare_failure(struct file *file, struct page *page,
-                               unsigned from, unsigned to)
-{
-       struct address_space *mapping;
-       struct buffer_head *bh, *head, *next;
-       unsigned block_start, block_end;
-       unsigned blocksize;
-       int ret;
-       handle_t *handle = ext3_journal_current_handle();
-
-       mapping = page->mapping;
-       if (ext3_should_writeback_data(mapping->host)) {
-               /* optimization: no constraints about data */
-skip:
-               return ext3_journal_stop(handle);
-       }
-
-       head = page_buffers(page);
-       blocksize = head->b_size;
-       for (   bh = head, block_start = 0;
-               bh != head || !block_start;
-               block_start = block_end, bh = next)
-       {
-               next = bh->b_this_page;
-               block_end = block_start + blocksize;
-               if (block_end <= from)
-                       continue;
-               if (block_start >= to) {
-                       block_start = to;
-                       break;
-               }
-               if (!buffer_mapped(bh))
-               /* prepare_write failed on this bh */
-                       break;
-               if (ext3_should_journal_data(mapping->host)) {
-                       ret = do_journal_get_write_access(handle, bh);
-                       if (ret) {
-                               ext3_journal_stop(handle);
-                               return ret;
-                       }
-               }
-       /*
-        * block_start here becomes the first block where the current iteration
-        * of prepare_write failed.
-        */
-       }
-       if (block_start <= from)
-               goto skip;
-
-       /* commit allocated and zeroed buffers */
-       return mapping->a_ops->commit_write(file, page, from, block_start);
-}
-
 static int ext3_prepare_write(struct file *file, struct page *page,
                              unsigned from, unsigned to)
 {
        struct inode *inode = page->mapping->host;
-       int ret, ret2;
-       int needed_blocks = ext3_writepage_trans_blocks(inode);
+       int ret, needed_blocks = ext3_writepage_trans_blocks(inode);
        handle_t *handle;
        int retries = 0;
 
 retry:
        handle = ext3_journal_start(inode, needed_blocks);
-       if (IS_ERR(handle))
-               return PTR_ERR(handle);
+       if (IS_ERR(handle)) {
+               ret = PTR_ERR(handle);
+               goto out;
+       }
        if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
                ret = nobh_prepare_write(page, from, to, ext3_get_block);
        else
                ret = block_prepare_write(page, from, to, ext3_get_block);
        if (ret)
-               goto failure;
+               goto prepare_write_failed;
 
        if (ext3_should_journal_data(inode)) {
                ret = walk_page_buffers(handle, page_buffers(page),
                                from, to, NULL, do_journal_get_write_access);
-               if (ret)
-                       /* fatal error, just put the handle and return */
-                       journal_stop(handle);
        }
-       return ret;
-
-failure:
-       ret2 = ext3_prepare_failure(file, page, from, to);
-       if (ret2 < 0)
-               return ret2;
+prepare_write_failed:
+       if (ret)
+               ext3_journal_stop(handle);
        if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries))
                goto retry;
-       /* retry number exceeded, or other error like -EDQUOT */
+out:
        return ret;
 }
 
index 12f7dda..f58cbb2 100644 (file)
@@ -495,7 +495,8 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode,
                BHDR(bh)->h_refcount = cpu_to_le32(
                                le32_to_cpu(BHDR(bh)->h_refcount) - 1);
                error = ext3_journal_dirty_metadata(handle, bh);
-               handle->h_sync = 1;
+               if (IS_SYNC(inode))
+                       handle->h_sync = 1;
                DQUOT_FREE_BLOCK(inode, 1);
                ea_bdebug(bh, "refcount now=%d; releasing",
                          le32_to_cpu(BHDR(bh)->h_refcount));
index fbff4b9..810b6d6 100644 (file)
@@ -1147,102 +1147,37 @@ static int do_journal_get_write_access(handle_t *handle,
        return ext4_journal_get_write_access(handle, bh);
 }
 
-/*
- * The idea of this helper function is following:
- * if prepare_write has allocated some blocks, but not all of them, the
- * transaction must include the content of the newly allocated blocks.
- * This content is expected to be set to zeroes by block_prepare_write().
- * 2006/10/14  SAW
- */
-static int ext4_prepare_failure(struct file *file, struct page *page,
-                               unsigned from, unsigned to)
-{
-       struct address_space *mapping;
-       struct buffer_head *bh, *head, *next;
-       unsigned block_start, block_end;
-       unsigned blocksize;
-       int ret;
-       handle_t *handle = ext4_journal_current_handle();
-
-       mapping = page->mapping;
-       if (ext4_should_writeback_data(mapping->host)) {
-               /* optimization: no constraints about data */
-skip:
-               return ext4_journal_stop(handle);
-       }
-
-       head = page_buffers(page);
-       blocksize = head->b_size;
-       for (   bh = head, block_start = 0;
-               bh != head || !block_start;
-               block_start = block_end, bh = next)
-       {
-               next = bh->b_this_page;
-               block_end = block_start + blocksize;
-               if (block_end <= from)
-                       continue;
-               if (block_start >= to) {
-                       block_start = to;
-                       break;
-               }
-               if (!buffer_mapped(bh))
-               /* prepare_write failed on this bh */
-                       break;
-               if (ext4_should_journal_data(mapping->host)) {
-                       ret = do_journal_get_write_access(handle, bh);
-                       if (ret) {
-                               ext4_journal_stop(handle);
-                               return ret;
-                       }
-               }
-       /*
-        * block_start here becomes the first block where the current iteration
-        * of prepare_write failed.
-        */
-       }
-       if (block_start <= from)
-               goto skip;
-
-       /* commit allocated and zeroed buffers */
-       return mapping->a_ops->commit_write(file, page, from, block_start);
-}
-
 static int ext4_prepare_write(struct file *file, struct page *page,
                              unsigned from, unsigned to)
 {
        struct inode *inode = page->mapping->host;
-       int ret, ret2;
-       int needed_blocks = ext4_writepage_trans_blocks(inode);
+       int ret, needed_blocks = ext4_writepage_trans_blocks(inode);
        handle_t *handle;
        int retries = 0;
 
 retry:
        handle = ext4_journal_start(inode, needed_blocks);
-       if (IS_ERR(handle))
-               return PTR_ERR(handle);
+       if (IS_ERR(handle)) {
+               ret = PTR_ERR(handle);
+               goto out;
+       }
        if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode))
                ret = nobh_prepare_write(page, from, to, ext4_get_block);
        else
                ret = block_prepare_write(page, from, to, ext4_get_block);
        if (ret)
-               goto failure;
+               goto prepare_write_failed;
 
        if (ext4_should_journal_data(inode)) {
                ret = walk_page_buffers(handle, page_buffers(page),
                                from, to, NULL, do_journal_get_write_access);
-               if (ret)
-                       /* fatal error, just put the handle and return */
-                       ext4_journal_stop(handle);
        }
-       return ret;
-
-failure:
-       ret2 = ext4_prepare_failure(file, page, from, to);
-       if (ret2 < 0)
-               return ret2;
+prepare_write_failed:
+       if (ret)
+               ext4_journal_stop(handle);
        if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
                goto retry;
-       /* retry number exceeded, or other error like -EDQUOT */
+out:
        return ret;
 }
 
index 406bf61..8890eba 100644 (file)
@@ -195,7 +195,7 @@ static struct dentry_operations fuse_dentry_operations = {
        .d_revalidate   = fuse_dentry_revalidate,
 };
 
-static int valid_mode(int m)
+int fuse_valid_type(int m)
 {
        return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) ||
                S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m);
@@ -248,7 +248,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
        fuse_put_request(fc, req);
        /* Zero nodeid is same as -ENOENT, but with valid timeout */
        if (!err && outarg.nodeid &&
-           (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode)))
+           (invalid_nodeid(outarg.nodeid) ||
+            !fuse_valid_type(outarg.attr.mode)))
                err = -EIO;
        if (!err && outarg.nodeid) {
                inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
index b98b20d..68ae87c 100644 (file)
@@ -552,3 +552,8 @@ int fuse_ctl_add_conn(struct fuse_conn *fc);
  * Remove connection from control filesystem
  */
 void fuse_ctl_remove_conn(struct fuse_conn *fc);
+
+/**
+ * Is file type valid?
+ */
+int fuse_valid_type(int m);
index 5ab8e50..608db81 100644 (file)
@@ -330,6 +330,8 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
                case OPT_ROOTMODE:
                        if (match_octal(&args[0], &value))
                                return 0;
+                       if (!fuse_valid_type(value))
+                               return 0;
                        d->rootmode = value;
                        d->rootmode_present = 1;
                        break;
index 9baf697..fd301a9 100644 (file)
@@ -20,7 +20,6 @@
 #include "hostfs.h"
 #include "kern_util.h"
 #include "kern.h"
-#include "user_util.h"
 #include "init.h"
 
 struct hostfs_inode_info {
@@ -939,7 +938,7 @@ static const struct address_space_operations hostfs_link_aops = {
 static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
 {
        struct inode *root_inode;
-       char *name, *data = d;
+       char *host_root_path, *req_root = d;
        int err;
 
        sb->s_blocksize = 1024;
@@ -948,16 +947,16 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
        sb->s_op = &hostfs_sbops;
 
        /* NULL is printed as <NULL> by sprintf: avoid that. */
-       if (data == NULL)
-               data = "";
+       if (req_root == NULL)
+               req_root = "";
 
        err = -ENOMEM;
-       name = kmalloc(strlen(root_ino) + 1
-                       + strlen(data) + 1, GFP_KERNEL);
-       if(name == NULL)
+       host_root_path = kmalloc(strlen(root_ino) + 1
+                                + strlen(req_root) + 1, GFP_KERNEL);
+       if(host_root_path == NULL)
                goto out;
 
-       sprintf(name, "%s/%s", root_ino, data);
+       sprintf(host_root_path, "%s/%s", root_ino, req_root);
 
        root_inode = iget(sb, 0);
        if(root_inode == NULL)
@@ -967,10 +966,10 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
        if(err)
                goto out_put;
 
-       HOSTFS_I(root_inode)->host_filename = name;
-       /* Avoid that in the error path, iput(root_inode) frees again name through
-        * hostfs_destroy_inode! */
-       name = NULL;
+       HOSTFS_I(root_inode)->host_filename = host_root_path;
+       /* Avoid that in the error path, iput(root_inode) frees again
+        * host_root_path through hostfs_destroy_inode! */
+       host_root_path = NULL;
 
        err = -ENOMEM;
        sb->s_root = d_alloc_root(root_inode);
@@ -990,7 +989,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
  out_put:
         iput(root_inode);
  out_free:
-       kfree(name);
+       kfree(host_root_path);
  out:
        return(err);
 }
index 6f67798..7e4bb0a 100644 (file)
@@ -859,8 +859,8 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
 #define NFS3_ENTRY_BAGGAGE     (2 + 1 + 2 + 1)
 #define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2))
 static int
-encode_entry(struct readdir_cd *ccd, const char *name,
-            int namlen, off_t offset, ino_t ino, unsigned int d_type, int plus)
+encode_entry(struct readdir_cd *ccd, const char *name, int namlen,
+            loff_t offset, ino_t ino, unsigned int d_type, int plus)
 {
        struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres,
                                                        common);
@@ -880,7 +880,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
                        *cd->offset1 = htonl(offset64 & 0xffffffff);
                        cd->offset1 = NULL;
                } else {
-                       xdr_encode_hyper(cd->offset, (u64) offset);
+                       xdr_encode_hyper(cd->offset, offset64);
                }
        }
 
index 832673b..673a53c 100644 (file)
@@ -228,7 +228,7 @@ _posix_to_nfsv4_one(struct posix_acl *pacl, struct nfs4_acl *acl,
        struct posix_acl_summary pas;
        unsigned short deny;
        int eflag = ((flags & NFS4_ACL_TYPE_DEFAULT) ?
-                                       NFS4_INHERITANCE_FLAGS : 0);
+               NFS4_INHERITANCE_FLAGS | NFS4_ACE_INHERIT_ONLY_ACE : 0);
 
        BUG_ON(pacl->a_count < 3);
        summarize_posix_acl(pacl, &pas);
index 9e40679..af36070 100644 (file)
@@ -750,9 +750,8 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                status = nfserr_clid_inuse;
                if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred)
                                || conf->cl_addr != sin->sin_addr.s_addr) {
-                       printk("NFSD: setclientid: string in use by client"
-                       "(clientid %08x/%08x)\n",
-                       conf->cl_clientid.cl_boot, conf->cl_clientid.cl_id);
+                       dprintk("NFSD: setclientid: string in use by client"
+                               "at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr));
                        goto out;
                }
        }
@@ -3261,7 +3260,6 @@ __nfs4_state_shutdown(void)
                unhash_delegation(dp);
        }
 
-       cancel_delayed_work(&laundromat_work);
        nfsd4_shutdown_recdir();
        nfs4_init = 0;
 }
index 6087c47..c558442 100644 (file)
@@ -138,8 +138,10 @@ static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm);
 
 void __dlm_unhash_lockres(struct dlm_lock_resource *lockres)
 {
-       hlist_del_init(&lockres->hash_node);
-       dlm_lockres_put(lockres);
+       if (!hlist_unhashed(&lockres->hash_node)) {
+               hlist_del_init(&lockres->hash_node);
+               dlm_lockres_put(lockres);
+       }
 }
 
 void __dlm_insert_lockres(struct dlm_ctxt *dlm,
@@ -655,6 +657,8 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm)
                dlm_kick_thread(dlm, NULL);
 
                while (dlm_migrate_all_locks(dlm)) {
+                       /* Give dlm_thread time to purge the lockres' */
+                       msleep(500);
                        mlog(0, "%s: more migration to do\n", dlm->name);
                }
                dlm_mark_domain_leaving(dlm);
index 9229e04..6edffca 100644 (file)
@@ -2424,6 +2424,57 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data)
        dlm_lockres_put(res);
 }
 
+/* Checks whether the lockres can be migrated. Returns 0 if yes, < 0
+ * if not. If 0, numlocks is set to the number of locks in the lockres.
+ */
+static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm,
+                                     struct dlm_lock_resource *res,
+                                     int *numlocks)
+{
+       int ret;
+       int i;
+       int count = 0;
+       struct list_head *queue, *iter;
+       struct dlm_lock *lock;
+
+       assert_spin_locked(&res->spinlock);
+
+       ret = -EINVAL;
+       if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) {
+               mlog(0, "cannot migrate lockres with unknown owner!\n");
+               goto leave;
+       }
+
+       if (res->owner != dlm->node_num) {
+               mlog(0, "cannot migrate lockres this node doesn't own!\n");
+               goto leave;
+       }
+
+       ret = 0;
+       queue = &res->granted;
+       for (i = 0; i < 3; i++) {
+               list_for_each(iter, queue) {
+                       lock = list_entry(iter, struct dlm_lock, list);
+                       ++count;
+                       if (lock->ml.node == dlm->node_num) {
+                               mlog(0, "found a lock owned by this node still "
+                                    "on the %s queue!  will not migrate this "
+                                    "lockres\n", (i == 0 ? "granted" :
+                                                  (i == 1 ? "converting" :
+                                                   "blocked")));
+                               ret = -ENOTEMPTY;
+                               goto leave;
+                       }
+               }
+               queue++;
+       }
+
+       *numlocks = count;
+       mlog(0, "migrateable lockres having %d locks\n", *numlocks);
+
+leave:
+       return ret;
+}
 
 /*
  * DLM_MIGRATE_LOCKRES
@@ -2437,14 +2488,12 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
        struct dlm_master_list_entry *mle = NULL;
        struct dlm_master_list_entry *oldmle = NULL;
        struct dlm_migratable_lockres *mres = NULL;
-       int ret = -EINVAL;
+       int ret = 0;
        const char *name;
        unsigned int namelen;
        int mle_added = 0;
-       struct list_head *queue, *iter;
-       int i;
-       struct dlm_lock *lock;
-       int empty = 1, wake = 0;
+       int numlocks;
+       int wake = 0;
 
        if (!dlm_grab(dlm))
                return -EINVAL;
@@ -2458,42 +2507,16 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
         * ensure this lockres is a proper candidate for migration
         */
        spin_lock(&res->spinlock);
-       if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) {
-               mlog(0, "cannot migrate lockres with unknown owner!\n");
-               spin_unlock(&res->spinlock);
-               goto leave;
-       }
-       if (res->owner != dlm->node_num) {
-               mlog(0, "cannot migrate lockres this node doesn't own!\n");
+       ret = dlm_is_lockres_migrateable(dlm, res, &numlocks);
+       if (ret < 0) {
                spin_unlock(&res->spinlock);
                goto leave;
        }
-       mlog(0, "checking queues...\n");
-       queue = &res->granted;
-       for (i=0; i<3; i++) {
-               list_for_each(iter, queue) {
-                       lock = list_entry (iter, struct dlm_lock, list);
-                       empty = 0;
-                       if (lock->ml.node == dlm->node_num) {
-                               mlog(0, "found a lock owned by this node "
-                                    "still on the %s queue!  will not "
-                                    "migrate this lockres\n",
-                                    i==0 ? "granted" :
-                                    (i==1 ? "converting" : "blocked"));
-                               spin_unlock(&res->spinlock);
-                               ret = -ENOTEMPTY;
-                               goto leave;
-                       }
-               }
-               queue++;
-       }
-       mlog(0, "all locks on this lockres are nonlocal.  continuing\n");
        spin_unlock(&res->spinlock);
 
        /* no work to do */
-       if (empty) {
+       if (numlocks == 0) {
                mlog(0, "no locks were found on this lockres! done!\n");
-               ret = 0;
                goto leave;
        }
 
@@ -2729,6 +2752,7 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)
 {
        int ret;
        int lock_dropped = 0;
+       int numlocks;
 
        spin_lock(&res->spinlock);
        if (res->owner != dlm->node_num) {
@@ -2740,6 +2764,13 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)
                spin_unlock(&res->spinlock);
                goto leave;
        }
+
+       /* No need to migrate a lockres having no locks */
+       ret = dlm_is_lockres_migrateable(dlm, res, &numlocks);
+       if (ret >= 0 && numlocks == 0) {
+               spin_unlock(&res->spinlock);
+               goto leave;
+       }
        spin_unlock(&res->spinlock);
 
        /* Wheee! Migrate lockres here! Will sleep so drop spinlock. */
index 6421a8f..2b264c6 100644 (file)
@@ -256,20 +256,14 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm,
                        break;
                }
 
-               mlog(0, "removing lockres %.*s:%p from purgelist\n",
-                    lockres->lockname.len, lockres->lockname.name, lockres);
-               list_del_init(&lockres->purge);
-               dlm_lockres_put(lockres);
-               dlm->purge_count--;
+               dlm_lockres_get(lockres);
 
                /* This may drop and reacquire the dlm spinlock if it
                 * has to do migration. */
-               mlog(0, "calling dlm_purge_lockres!\n");
-               dlm_lockres_get(lockres);
                if (dlm_purge_lockres(dlm, lockres))
                        BUG();
+
                dlm_lockres_put(lockres);
-               mlog(0, "DONE calling dlm_purge_lockres!\n");
 
                /* Avoid adding any scheduling latencies */
                cond_resched_lock(&dlm->spinlock);
index a6b3a8f..bce38e3 100644 (file)
@@ -8,8 +8,9 @@ proc-y                  := nommu.o task_nommu.o
 proc-$(CONFIG_MMU)     := mmu.o task_mmu.o
 
 proc-y       += inode.o root.o base.o generic.o array.o \
-               proc_tty.o proc_misc.o proc_sysctl.o
+               proc_tty.o proc_misc.o
 
+proc-$(CONFIG_PROC_SYSCTL)     += proc_sysctl.o
 proc-$(CONFIG_PROC_KCORE)      += kcore.o
 proc-$(CONFIG_PROC_VMCORE)     += vmcore.o
 proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
index c932aa6..f771889 100644 (file)
 
 #include <linux/proc_fs.h>
 
+#ifdef CONFIG_PROC_SYSCTL
 extern int proc_sys_init(void);
+#else
+static inline void proc_sys_init(void) { }
+#endif
 
 struct vmalloc_info {
        unsigned long   used;
index 5834a74..41f1703 100644 (file)
@@ -79,9 +79,7 @@ void __init proc_root_init(void)
        proc_device_tree_init();
 #endif
        proc_bus = proc_mkdir("bus", NULL);
-#ifdef CONFIG_SYSCTL
        proc_sys_init();
-#endif
 }
 
 static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
index 2fca6eb..5428b0f 100644 (file)
@@ -576,76 +576,21 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
        if (this_len + offset > PAGE_CACHE_SIZE)
                this_len = PAGE_CACHE_SIZE - offset;
 
-       /*
-        * Reuse buf page, if SPLICE_F_MOVE is set and we are doing a full
-        * page.
-        */
-       if ((sd->flags & SPLICE_F_MOVE) && this_len == PAGE_CACHE_SIZE) {
-               /*
-                * If steal succeeds, buf->page is now pruned from the
-                * pagecache and we can reuse it. The page will also be
-                * locked on successful return.
-                */
-               if (buf->ops->steal(pipe, buf))
-                       goto find_page;
-
-               page = buf->page;
-               if (add_to_page_cache(page, mapping, index, GFP_KERNEL)) {
-                       unlock_page(page);
-                       goto find_page;
-               }
-
-               page_cache_get(page);
-
-               if (!(buf->flags & PIPE_BUF_FLAG_LRU))
-                       lru_cache_add(page);
-       } else {
 find_page:
-               page = find_lock_page(mapping, index);
-               if (!page) {
-                       ret = -ENOMEM;
-                       page = page_cache_alloc_cold(mapping);
-                       if (unlikely(!page))
-                               goto out_ret;
-
-                       /*
-                        * This will also lock the page
-                        */
-                       ret = add_to_page_cache_lru(page, mapping, index,
-                                                   GFP_KERNEL);
-                       if (unlikely(ret))
-                               goto out;
-               }
+       page = find_lock_page(mapping, index);
+       if (!page) {
+               ret = -ENOMEM;
+               page = page_cache_alloc_cold(mapping);
+               if (unlikely(!page))
+                       goto out_ret;
 
                /*
-                * We get here with the page locked. If the page is also
-                * uptodate, we don't need to do more. If it isn't, we
-                * may need to bring it in if we are not going to overwrite
-                * the full page.
+                * This will also lock the page
                 */
-               if (!PageUptodate(page)) {
-                       if (this_len < PAGE_CACHE_SIZE) {
-                               ret = mapping->a_ops->readpage(file, page);
-                               if (unlikely(ret))
-                                       goto out;
-
-                               lock_page(page);
-
-                               if (!PageUptodate(page)) {
-                                       /*
-                                        * Page got invalidated, repeat.
-                                        */
-                                       if (!page->mapping) {
-                                               unlock_page(page);
-                                               page_cache_release(page);
-                                               goto find_page;
-                                       }
-                                       ret = -EIO;
-                                       goto out;
-                               }
-                       } else
-                               SetPageUptodate(page);
-               }
+               ret = add_to_page_cache_lru(page, mapping, index,
+                                           GFP_KERNEL);
+               if (unlikely(ret))
+                       goto out;
        }
 
        ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len);
@@ -682,18 +627,25 @@ find_page:
        }
 
        ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len);
-       if (!ret) {
+       if (ret) {
+               if (ret == AOP_TRUNCATED_PAGE) {
+                       page_cache_release(page);
+                       goto find_page;
+               }
+               if (ret < 0)
+                       goto out;
                /*
-                * Return the number of bytes written and mark page as
-                * accessed, we are now done!
+                * Partial write has happened, so 'ret' already initialized by
+                * number of bytes written, Where is nothing we have to do here.
                 */
+       } else
                ret = this_len;
-               mark_page_accessed(page);
-               balance_dirty_pages_ratelimited(mapping);
-       } else if (ret == AOP_TRUNCATED_PAGE) {
-               page_cache_release(page);
-               goto find_page;
-       }
+       /*
+        * Return the number of bytes written and mark page as
+        * accessed, we are now done!
+        */
+       mark_page_accessed(page);
+       balance_dirty_pages_ratelimited(mapping);
 out:
        page_cache_release(page);
        unlock_page(page);
@@ -706,9 +658,9 @@ out_ret:
  * key here is the 'actor' worker passed in that actually moves the data
  * to the wanted destination. See pipe_to_file/pipe_to_sendpage above.
  */
-static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
-                                 struct file *out, loff_t *ppos, size_t len,
-                                 unsigned int flags, splice_actor *actor)
+ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
+                          struct file *out, loff_t *ppos, size_t len,
+                          unsigned int flags, splice_actor *actor)
 {
        int ret, do_wakeup, err;
        struct splice_desc sd;
@@ -802,6 +754,7 @@ static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
 
        return ret;
 }
+EXPORT_SYMBOL(__splice_from_pipe);
 
 ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
                         loff_t *ppos, size_t len, unsigned int flags,
index e2bea6a..69e9e80 100644 (file)
@@ -1829,11 +1829,11 @@ xfs_buf_init(void)
        if (!xfs_buf_zone)
                goto out_free_trace_buf;
 
-       xfslogd_workqueue = create_freezeable_workqueue("xfslogd");
+       xfslogd_workqueue = create_workqueue("xfslogd");
        if (!xfslogd_workqueue)
                goto out_free_buf_zone;
 
-       xfsdatad_workqueue = create_freezeable_workqueue("xfsdatad");
+       xfsdatad_workqueue = create_workqueue("xfsdatad");
        if (!xfsdatad_workqueue)
                goto out_destroy_xfslogd_workqueue;
 
index 73967c8..4409830 100644 (file)
@@ -446,14 +446,10 @@ acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
 /*
  * exutils - interpreter/scanner utilities
  */
-void acpi_ex_enter_interpreter(void);
+acpi_status acpi_ex_enter_interpreter(void);
 
 void acpi_ex_exit_interpreter(void);
 
-void acpi_ex_reacquire_interpreter(void);
-
-void acpi_ex_relinquish_interpreter(void);
-
 void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
 
 u8 acpi_ex_acquire_global_lock(u32 rule);
index 72a6e2c..56bf492 100644 (file)
@@ -344,7 +344,7 @@ typedef u32 acpi_integer;
 
 /* 64-bit integers */
 
-typedef u64 acpi_integer;
+typedef unsigned long long              acpi_integer;
 #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
 #define ACPI_INTEGER_BIT_SIZE           64
 #define ACPI_MAX_DECIMAL_DIGITS         20     /* 2^64 = 18,446,744,073,709,551,616 */
index b7b5414..a41ba22 100644 (file)
@@ -238,23 +238,6 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
 #define memcpy_fromio(a,c,l)           _memcpy_fromio((a),(c),(l))
 #define memcpy_toio(c,a,l)             _memcpy_toio((c),(a),(l))
 
-static inline int
-check_signature(const unsigned char __iomem *bus_addr, const unsigned char *signature,
-               int length)
-{
-       int retval = 0;
-       do {
-               if (readb(bus_addr) != *signature)
-                       goto out;
-               bus_addr++;
-               signature++;
-               length--;
-       } while (length);
-       retval = 1;
-out:
-       return retval;
-}
-
 #endif
 
 #ifndef CONFIG_PCI
index 4371a48..a7c5ab3 100644 (file)
@@ -11,6 +11,7 @@
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
+static inline u32 ns9xxx_systemclock(void) __attribute__((const));
 static inline u32 ns9xxx_systemclock(void)
 {
        /*
@@ -19,17 +20,20 @@ static inline u32 ns9xxx_systemclock(void)
        return 353894400;
 }
 
-static inline const u32 ns9xxx_cpuclock(void)
+static inline u32 ns9xxx_cpuclock(void) __attribute__((const));
+static inline u32 ns9xxx_cpuclock(void)
 {
        return ns9xxx_systemclock() / 2;
 }
 
-static inline const u32 ns9xxx_ahbclock(void)
+static inline u32 ns9xxx_ahbclock(void) __attribute__((const));
+static inline u32 ns9xxx_ahbclock(void)
 {
        return ns9xxx_systemclock() / 4;
 }
 
-static inline const u32 ns9xxx_bbusclock(void)
+static inline u32 ns9xxx_bbusclock(void) __attribute__((const));
+static inline u32 ns9xxx_bbusclock(void)
 {
        return ns9xxx_systemclock() / 8;
 }
index aec835b..139c9d9 100644 (file)
 #define GPIO112_MMCCMD_MD      (112 | GPIO_ALT_FN_1_OUT)
 #define GPIO113_I2S_SYSCLK_MD  (113 | GPIO_ALT_FN_1_OUT)
 #define GPIO113_AC97_RESET_N_MD        (113 | GPIO_ALT_FN_2_OUT)
-#define GPIO117_I2CSCL_MD      (117 | GPIO_ALT_FN_1_OUT)
+#define GPIO117_I2CSCL_MD      (117 | GPIO_ALT_FN_1_IN)
 #define GPIO118_I2CSDA_MD      (118 | GPIO_ALT_FN_1_IN)
 
 /*
index f06d8a4..69134c7 100644 (file)
@@ -3,6 +3,7 @@
 
 #ifdef __KERNEL__
 
+#include <asm/memory.h>
 
 #define CPU_ARCH_UNKNOWN       0
 #define CPU_ARCH_ARMv3         1
@@ -154,7 +155,7 @@ extern unsigned int user_debug;
 #define vectors_high() (0)
 #endif
 
-#if __LINUX_ARM_ARCH__ >= 6
+#if defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ >= 6
 #define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
                                    : : "r" (0) : "memory")
 #define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
@@ -168,22 +169,23 @@ extern unsigned int user_debug;
 #define dmb() __asm__ __volatile__ ("" : : : "memory")
 #endif
 
-#define mb()                   barrier()
-#define rmb()                  barrier()
-#define wmb()                  barrier()
-#define read_barrier_depends() do { } while(0)
-
-#ifdef CONFIG_SMP
-#define smp_mb()               dmb()
-#define smp_rmb()              dmb()
-#define smp_wmb()              dmb()
-#define smp_read_barrier_depends()     read_barrier_depends()
+#ifndef CONFIG_SMP
+#define mb()   do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
+#define rmb()  do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
+#define wmb()  do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
+#define smp_mb()       barrier()
+#define smp_rmb()      barrier()
+#define smp_wmb()      barrier()
 #else
-#define smp_mb()               barrier()
-#define smp_rmb()              barrier()
-#define smp_wmb()              barrier()
-#define smp_read_barrier_depends()     read_barrier_depends()
-#endif /* CONFIG_SMP */
+#define mb()           dmb()
+#define rmb()          dmb()
+#define wmb()          dmb()
+#define smp_mb()       dmb()
+#define smp_rmb()      dmb()
+#define smp_wmb()      dmb()
+#endif
+#define read_barrier_depends()         do { } while(0)
+#define smp_read_barrier_depends()     do { } while(0)
 
 #define set_mb(var, value)     do { var = value; smp_mb(); } while (0)
 #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
index 0991b7b..c025ab4 100644 (file)
 #define __NR_move_pages                        (__NR_SYSCALL_BASE+344)
 #define __NR_getcpu                    (__NR_SYSCALL_BASE+345)
                                        /* 346 for epoll_pwait */
-#define __NR_sys_kexec_load            (__NR_SYSCALL_BASE+347)
+#define __NR_kexec_load                        (__NR_SYSCALL_BASE+347)
 
 /*
  * The following SWIs are ARM private.
index 00c2343..6d7e279 100644 (file)
@@ -180,6 +180,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
 #ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
 #define arch_enter_lazy_mmu_mode()     do {} while (0)
 #define arch_leave_lazy_mmu_mode()     do {} while (0)
+#define arch_flush_lazy_mmu_mode()     do {} while (0)
 #endif
 
 /*
@@ -193,6 +194,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
 #ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
 #define arch_enter_lazy_cpu_mode()     do {} while (0)
 #define arch_leave_lazy_cpu_mode()     do {} while (0)
+#define arch_flush_lazy_cpu_mode()     do {} while (0)
 #endif
 
 /*
index cc6b165..a19810a 100644 (file)
@@ -117,6 +117,7 @@ extern void enable_NMI_through_LVT0 (void * dummy);
 #define ARCH_APICTIMER_STOPS_ON_C3     1
 
 extern int timer_over_8254;
+extern int local_apic_timer_c2_ok;
 
 #else /* !CONFIG_X86_LOCAL_APIC */
 static inline void lapic_shutdown(void) { }
index 3f92b94..d1b8e4a 100644 (file)
@@ -75,6 +75,7 @@
 #define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
 #define X86_FEATURE_PEBS       (3*32+12)  /* Precise-Event Based Sampling */
 #define X86_FEATURE_BTS                (3*32+13)  /* Branch Trace Store */
+#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3       (4*32+ 0) /* Streaming SIMD Extensions-3 */
index 8d33c9b..952b3ee 100644 (file)
@@ -88,16 +88,16 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
        pr_reg[4] = regs->edi;                          \
        pr_reg[5] = regs->ebp;                          \
        pr_reg[6] = regs->eax;                          \
-       pr_reg[7] = regs->xds;                          \
-       pr_reg[8] = regs->xes;                          \
-       pr_reg[9] = regs->xfs;                          \
+       pr_reg[7] = regs->xds & 0xffff;                 \
+       pr_reg[8] = regs->xes & 0xffff;                 \
+       pr_reg[9] = regs->xfs & 0xffff;                 \
        savesegment(gs,pr_reg[10]);                     \
        pr_reg[11] = regs->orig_eax;                    \
        pr_reg[12] = regs->eip;                         \
-       pr_reg[13] = regs->xcs;                         \
+       pr_reg[13] = regs->xcs & 0xffff;                \
        pr_reg[14] = regs->eflags;                      \
        pr_reg[15] = regs->esp;                         \
-       pr_reg[16] = regs->xss;
+       pr_reg[16] = regs->xss & 0xffff;
 
 /* This yields a mask that user programs can use to figure out what
    instruction set this CPU supports.  This could be done in user space,
index ec3b680..2ad3f30 100644 (file)
@@ -275,6 +275,8 @@ static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
 #define MSR_K7_FID_VID_CTL             0xC0010041
 #define MSR_K7_FID_VID_STATUS          0xC0010042
 
+#define MSR_K8_ENABLE_C1E              0xC0010055
+
 /* extended feature register */
 #define MSR_EFER                       0xc0000080
 
index 46dc34c..e63f1e4 100644 (file)
@@ -421,14 +421,17 @@ static inline void pmd_clear(pmd_t *pmdp)
 #define PARAVIRT_LAZY_NONE 0
 #define PARAVIRT_LAZY_MMU  1
 #define PARAVIRT_LAZY_CPU  2
+#define PARAVIRT_LAZY_FLUSH 3
 
 #define  __HAVE_ARCH_ENTER_LAZY_CPU_MODE
 #define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU)
 #define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
+#define arch_flush_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
 
 #define  __HAVE_ARCH_ENTER_LAZY_MMU_MODE
 #define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU)
 #define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
+#define arch_flush_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
 
 /* These all sit in the .parainstructions section to tell us what to patch. */
 struct paravirt_patch {
index 12baf1d..2e62376 100644 (file)
@@ -144,7 +144,7 @@ struct ktermios {
 #define  B3000000 0010015
 #define  B3500000 0010016
 #define  B4000000 0010017
-#define CIBAUD   002003600000  /* input baud rate (not used) */
+#define CIBAUD   002003600000
 #define CMSPAR   010000000000          /* mark or space (stick) parity */
 #define CRTSCTS          020000000000          /* flow control */
 
index 5830d36..4f4ee1c 100644 (file)
@@ -210,7 +210,7 @@ struct desc_struct {
        unsigned int a, b;
 };
 
-#define desc_empty(desc)               (!((desc)->a + (desc)->b))
+#define desc_empty(desc)               (!((desc)->a | (desc)->b))
 #define desc_equal(desc1, desc2)       (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b))
 
 #define GDT_ENTRY_TLS_ENTRIES  3
index 0ddada3..28d907d 100644 (file)
@@ -48,6 +48,15 @@ static inline void flush_dcache_page(struct page *page)
 #define flush_dcache_mmap_lock(mapping)                do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)      do { } while (0)
 
+#define ARCH_HAS_FLUSH_ANON_PAGE
+extern void __flush_anon_page(struct page *, unsigned long);
+static inline void flush_anon_page(struct vm_area_struct *vma,
+       struct page *page, unsigned long vmaddr)
+{
+       if (cpu_has_dc_aliases && PageAnon(page))
+               __flush_anon_page(page, vmaddr);
+}
+
 static inline void flush_icache_page(struct vm_area_struct *vma,
        struct page *page)
 {
@@ -86,4 +95,7 @@ extern void (*flush_data_cache_page)(unsigned long addr);
 /* Run kernel code uncached, useful for cache probing functions. */
 unsigned long __init run_uncached(void *func);
 
+extern void *kmap_coherent(struct page *page, unsigned long addr);
+extern void kunmap_coherent(struct page *page);
+
 #endif /* _ASM_CACHEFLUSH_H */
index ea77050..223d156 100644 (file)
@@ -79,7 +79,7 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
        __delay(usecs);
 }
 
-#define __udelay_val cpu_data[smp_processor_id()].udelay_val
+#define __udelay_val cpu_data[raw_smp_processor_id()].udelay_val
 
 #define udelay(usecs) __udelay((usecs),__udelay_val)
 
index 5007315..e50c77e 100644 (file)
@@ -52,6 +52,7 @@ ASMMACRO(tlb_probe_hazard,
         _ehb
        )
 ASMMACRO(irq_enable_hazard,
+        _ehb
        )
 ASMMACRO(irq_disable_hazard,
        _ehb
index af3b07d..e459fa0 100644 (file)
 
 #ifndef __ASSEMBLY__
 
+#include <linux/compiler.h>
 #include <asm/hazards.h>
 
-/*
- * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred IPIs,
- * at the cost of branch and call overhead on each local_irq_restore()
- */
-
-#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
-
-extern void smtc_ipi_replay(void);
-
-#define irq_restore_epilog(flags)                              \
-do {                                                           \
-       if (!(flags & 0x0400))                                  \
-               smtc_ipi_replay();                              \
-} while (0)
-
-#else
-
-#define irq_restore_epilog(ignore) do { } while (0)
-
-#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
-
 __asm__ (
        "       .macro  raw_local_irq_enable                            \n"
        "       .set    push                                            \n"
@@ -205,17 +185,28 @@ __asm__ (
        "       .set    pop                                             \n"
        "       .endm                                                   \n");
 
-#define raw_local_irq_restore(flags)                                   \
-do {                                                                   \
-       unsigned long __tmp1;                                           \
-                                                                       \
-       __asm__ __volatile__(                                           \
-               "raw_local_irq_restore\t%0"                             \
-               : "=r" (__tmp1)                                         \
-               : "0" (flags)                                           \
-               : "memory");                                            \
-       irq_restore_epilog(flags);                                      \
-} while(0)
+extern void smtc_ipi_replay(void);
+
+static inline void raw_local_irq_restore(unsigned long flags)
+{
+       unsigned long __tmp1;
+
+#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
+       /*
+        * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred
+        * IPIs, at the cost of branch and call overhead on each
+        * local_irq_restore()
+        */
+       if (unlikely(!(flags & 0x0400)))
+               smtc_ipi_replay();
+#endif
+
+       __asm__ __volatile__(
+               "raw_local_irq_restore\t%0"
+               : "=r" (__tmp1)
+               : "0" (flags)
+               : "memory");
+}
 
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
index df94955..b6144ba 100644 (file)
@@ -54,5 +54,6 @@ struct mv_pci_controller {
 };
 
 extern void ll_mv64340_irq(void);
+extern void mv64340_irq_init(unsigned int base);
 
 #endif /* __ASM_MIPS_MARVELL_H */
index a5b1871..49f5a1a 100644 (file)
@@ -199,7 +199,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud)
 {
        return pud_val(pud);
 }
-#define pud_phys(pud)          (pud_val(pud) - PAGE_OFFSET)
+#define pud_phys(pud)          virt_to_phys((void *)pud_val(pud))
 #define pud_page(pud)          (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
 
 /* Find an entry in the second-level page table.. */
index 3fcfd79..0d3295f 100644 (file)
@@ -75,7 +75,7 @@ extern void paging_init(void);
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
  */
-#define pmd_phys(pmd)          (pmd_val(pmd) - PAGE_OFFSET)
+#define pmd_phys(pmd)          virt_to_phys((void *)pmd_val(pmd))
 #define pmd_page(pmd)          (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
 #define pmd_page_vaddr(pmd)    pmd_val(pmd)
 
index ddb859d..439bce7 100644 (file)
@@ -459,7 +459,7 @@ struct linux_smonblock {
        register signed int __a2 __asm__("$5") = (int) (long) (a2);     \
        register signed int __a3 __asm__("$6") = (int) (long) (a3);     \
        register signed int __a4 __asm__("$7") = (int) (long) (a4);     \
-       register signed int __a5 = (a5);                                \
+       register signed int __a5 = (int) (long) (a5);                   \
        long __vec = (long) romvec->dest;                               \
        __asm__ __volatile__(                                           \
        "dsubu\t$29, 32\n\t"                                            \
index dfb29e1..494aa65 100644 (file)
@@ -67,6 +67,6 @@ extern void bcm1480_smp_finish(void);
 
 #endif
 
-#define IOADDR(a) ((volatile void __iomem *)(IO_BASE + (a)))
+#define IOADDR(a) ((void __iomem *)(IO_BASE + (a)))
 
 #endif
index 360ea6d..a52a4a7 100644 (file)
@@ -65,12 +65,10 @@ static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
        spin_unlock_irqrestore(&q->lock, flags);
 }
 
-static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
+static inline struct smtc_ipi *__smtc_ipi_dq(struct smtc_ipi_q *q)
 {
        struct smtc_ipi *p;
-       long flags;
 
-       spin_lock_irqsave(&q->lock, flags);
        if (q->head == NULL)
                p = NULL;
        else {
@@ -81,7 +79,19 @@ static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
                if (q->head == NULL)
                        q->tail = NULL;
        }
+
+       return p;
+}
+
+static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
+{
+       unsigned long flags;
+       struct smtc_ipi *p;
+
+       spin_lock_irqsave(&q->lock, flags);
+       p = __smtc_ipi_dq(q);
        spin_unlock_irqrestore(&q->lock, flags);
+
        return p;
 }
 
index 6097780..62efd9d 100644 (file)
@@ -236,6 +236,20 @@ long plpar_hcall_norets(unsigned long opcode, ...);
 #define PLPAR_HCALL_BUFSIZE 4
 long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
 
+/**
+ * plpar_hcall_raw: - Make a hypervisor call without calculating hcall stats
+ * @opcode: The hypervisor call to make.
+ * @retbuf: Buffer to store up to 4 return arguments in.
+ *
+ * This call supports up to 6 arguments and 4 return arguments. Use
+ * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
+ *
+ * Used when phyp interface needs to be called in real mode. Similar to
+ * plpar_hcall, but plpar_hcall_raw works in real mode and does not
+ * calculate hypervisor call statistics.
+ */
+long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
+
 /**
  * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
  * @opcode: The hypervisor call to make.
index 9fdd049..1020b7f 100644 (file)
@@ -258,8 +258,9 @@ struct ucc_slow {
        u8      uccs;           /* UCCx status register */
        u8      res3[0x24];
        __be16  utpt;
+       u8      res4[0x52];
        u8      guemr;          /* UCC general extended mode register */
-       u8      res4[0x200 - 0x091];
+       u8      res5[0x200 - 0x091];
 } __attribute__ ((packed));
 
 /* QE UCC Fast */
index 0a3cd7e..d5a8e7c 100644 (file)
@@ -121,50 +121,21 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
                    unsigned short len, unsigned short proto,
                    __wsum sum)
 {
-#ifndef __s390x__
-       asm volatile(
-               "       alr     %0,%1\n" /* sum += saddr */
-               "       brc     12,0f\n"
-               "       ahi     %0,1\n"  /* add carry */
-               "0:"
-               : "+&d" (sum) : "d" (saddr) : "cc");
-       asm volatile(
-               "       alr     %0,%1\n" /* sum += daddr */
-               "       brc     12,1f\n"
-               "       ahi     %0,1\n"  /* add carry */
-               "1:"
-               : "+&d" (sum) : "d" (daddr) : "cc");
-       asm volatile(
-               "       alr     %0,%1\n" /* sum += len + proto */
-               "       brc     12,2f\n"
-               "       ahi     %0,1\n"  /* add carry */
-               "2:"
-               : "+&d" (sum)
-               : "d" (len + proto)
-               : "cc");
-#else /* __s390x__ */
-       asm volatile(
-               "       lgfr    %0,%0\n"
-               "       algr    %0,%1\n"  /* sum += saddr */
-               "       brc     12,0f\n"
-               "       aghi    %0,1\n"   /* add carry */
-               "0:     algr    %0,%2\n"  /* sum += daddr */
-               "       brc     12,1f\n"
-               "       aghi    %0,1\n"   /* add carry */
-               "1:     algfr   %0,%3\n"  /* sum += len + proto */
-               "       brc     12,2f\n"
-               "       aghi    %0,1\n"   /* add carry */
-               "2:     srlg    0,%0,32\n"
-               "       alr     %0,0\n"   /* fold to 32 bits */
-               "       brc     12,3f\n"
-               "       ahi     %0,1\n"   /* add carry */
-               "3:     llgfr   %0,%0"
-               : "+&d" (sum)
-               : "d" (saddr), "d" (daddr),
-                 "d" (len + proto)
-               : "cc", "0");
-#endif /* __s390x__ */
-       return sum;
+       __u32 csum = (__force __u32)sum;
+
+       csum += (__force __u32)saddr;
+       if (csum < (__force __u32)saddr)
+               csum++;
+
+       csum += (__force __u32)daddr;
+       if (csum < (__force __u32)daddr)
+               csum++;
+
+       csum += len + proto;
+       if (csum < len + proto)
+               csum++;
+
+       return (__force __wsum)csum;
 }
 
 /*
index f35134c..53ca564 100644 (file)
@@ -10,9 +10,9 @@
  *
  */
 
-#define HP680_BTN_IRQ          IRQ0_IRQ
-#define HP680_TS_IRQ           IRQ3_IRQ
-#define HP680_HD64461_IRQ      IRQ4_IRQ
+#define HP680_BTN_IRQ          32            /* IRQ0_IRQ */
+#define HP680_TS_IRQ           35            /* IRQ3_IRQ */
+#define HP680_HD64461_IRQ      36            /* IRQ4_IRQ */
 
 #define DAC_LCD_BRIGHTNESS     0
 #define DAC_SPEAKER_VOLUME     1
index b1e42e7..4a6a19f 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include <linux/irqflags.h>
+#include <linux/compiler.h>
 #include <asm/types.h>
 
 /*
index e4e83eb..9090060 100644 (file)
@@ -80,7 +80,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
         unsigned long   r_address;  /* relocation addr */
         unsigned int    r_index:24; /* segment index or symbol index */
         unsigned int    r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
-        int             r_pad:2;    /* <unused> */
+        unsigned int    r_pad:2;    /* <unused> */
         enum reloc_type r_type:5;   /* type of relocation to perform */
         long            r_addend;   /* addend for relocation value */
 };
index bd92a78..958d051 100644 (file)
@@ -87,7 +87,7 @@ extern void __iomem *mstk48t02_regs;
 #define        MSTK_DOW_MASK   0x07
 #define        MSTK_DOM_MASK   0x3f
 #define        MSTK_MONTH_MASK 0x1f
-#define        MSTK_YEAR_MASK  0xff
+#define        MSTK_YEAR_MASK  0xffU
 
 /* Binary coded decimal conversion macros. */
 #define MSTK_REGVAL_TO_DECIMAL(x)  (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
index 35cb5c9..eb3b8e9 100644 (file)
@@ -86,7 +86,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
         unsigned int    r_address;  /* relocation addr */
         unsigned int    r_index:24; /* segment index or symbol index */
         unsigned int    r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
-        int             r_pad:2;    /* <unused> */
+        unsigned int    r_pad:2;    /* <unused> */
         enum reloc_type r_type:5;   /* type of relocation to perform */
         int             r_addend;   /* addend for relocation value */
 };
index 09b5aba..d14dd89 100644 (file)
@@ -89,7 +89,7 @@ extern void __iomem *mstk48t02_regs;
 #define        MSTK_DOW_MASK   0x07
 #define        MSTK_DOM_MASK   0x3f
 #define        MSTK_MONTH_MASK 0x1f
-#define        MSTK_YEAR_MASK  0xff
+#define        MSTK_YEAR_MASK  0xffU
 
 /* Binary coded decimal conversion macros. */
 #define MSTK_REGVAL_TO_DECIMAL(x)  (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
index f045451..f5de80c 100644 (file)
@@ -15,6 +15,7 @@
   PROVIDE (_unprotected_end = .);
 
   . = ALIGN(4096);
+  .note : { *(.note.*) }
   __start___ex_table = .;
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;
index 0985bda..c71e32b 100644 (file)
@@ -1,9 +1,20 @@
 #ifndef __UM_DELAY_H
 #define __UM_DELAY_H
 
-#include "asm/arch/delay.h"
-#include "asm/archparam.h"
-
 #define MILLION 1000000
 
+/* Undefined on purpose */
+extern void __bad_udelay(void);
+
+extern void __udelay(unsigned long usecs);
+extern void __delay(unsigned long loops);
+
+#define udelay(n) ((__builtin_constant_p(n) && (n) > 20000) ? \
+       __bad_udelay() : __udelay(n))
+
+/* It appears that ndelay is not used at all for UML, and has never been
+ * implemented. */
+extern void __unimplemented_ndelay(void);
+#define ndelay(n) __unimplemented_ndelay()
+
 #endif
index 6050e0e..172a75f 100644 (file)
@@ -45,12 +45,12 @@ static inline void pgd_mkuptodate(pgd_t pgd)        { }
        ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
 
 /*
- * Bits 0 through 3 are taken
+ * Bits 0 through 4 are taken
  */
-#define PTE_FILE_MAX_BITS      28
+#define PTE_FILE_MAX_BITS      27
 
-#define pte_to_pgoff(pte) (pte_val(pte) >> 4)
+#define pte_to_pgoff(pte) (pte_val(pte) >> 5)
 
-#define pgoff_to_pte(off) ((pte_t) { ((off) << 4) + _PAGE_FILE })
+#define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE })
 
 #endif
index e81d0f2..7cfb39c 100644 (file)
@@ -102,5 +102,6 @@ void switch_ipi_to_APIC_timer(void *cpumask);
 #define ARCH_APICTIMER_STOPS_ON_C3     1
 
 extern unsigned boot_cpu_id;
+extern int local_apic_timer_c2_ok;
 
 #endif /* __ASM_APIC_H */
index 2e4b7a5..6153ae5 100644 (file)
@@ -38,7 +38,7 @@
 #define IRQ_MOVE_CLEANUP_VECTOR        FIRST_EXTERNAL_VECTOR
  
 /*
- * Vectors 0x20-0x2f are used for ISA interrupts.
+ * Vectors 0x30-0x3f are used for ISA interrupts.
  */
 #define IRQ0_VECTOR            FIRST_EXTERNAL_VECTOR + 0x10
 #define IRQ1_VECTOR            IRQ0_VECTOR + 1
index c331da2..6caeb98 100644 (file)
@@ -40,6 +40,7 @@ enum {
        ATA_MAX_DEVICES         = 2,    /* per bus/port */
        ATA_MAX_PRD             = 256,  /* we could make these 256/256 */
        ATA_SECT_SIZE           = 512,
+       ATA_MAX_SECTORS_128     = 128,
        ATA_MAX_SECTORS         = 256,
        ATA_MAX_SECTORS_LBA48   = 65535,/* TODO: 65536? */
 
index 2275f27..81c07cd 100644 (file)
@@ -108,7 +108,7 @@ static inline void *alloc_remap(int nid, unsigned long size)
 #endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
 
 extern unsigned long __meminitdata nr_kernel_pages;
-extern unsigned long nr_all_pages;
+extern unsigned long __meminitdata nr_all_pages;
 
 extern void *alloc_large_system_hash(const char *tablename,
                                     unsigned long bucketsize,
index aca6698..3b6949b 100644 (file)
@@ -15,8 +15,8 @@
 # define __acquire(x)  __context__(x,1)
 # define __release(x)  __context__(x,-1)
 # define __cond_lock(x,c)      ((c) ? ({ __acquire(x); 1; }) : 0)
-extern void __chk_user_ptr(void __user *);
-extern void __chk_io_ptr(void __iomem *);
+extern void __chk_user_ptr(const void __user *);
+extern void __chk_io_ptr(const void __iomem *);
 #else
 # define __user
 # define __kernel
index 769ddc6..c22b0df 100644 (file)
@@ -127,9 +127,13 @@ static inline int cpu_is_offline(int cpu) { return 0; }
 #endif         /* CONFIG_HOTPLUG_CPU */
 
 #ifdef CONFIG_SUSPEND_SMP
+extern int suspend_cpu_hotplug;
+
 extern int disable_nonboot_cpus(void);
 extern void enable_nonboot_cpus(void);
 #else
+#define suspend_cpu_hotplug    0
+
 static inline int disable_nonboot_cpus(void) { return 0; }
 static inline void enable_nonboot_cpus(void) {}
 #endif
index caad9bb..5cf30e9 100644 (file)
@@ -128,6 +128,7 @@ struct device_driver {
 
        struct module           * owner;
        const char              * mod_name;     /* used for built-in modules */
+       struct module_kobject   * mkobj;
 
        int     (*probe)        (struct device * dev);
        int     (*remove)       (struct device * dev);
index 84cfa8b..d2a96cb 100644 (file)
 /* 
  * On x86-64 make the 64bit structure have the same alignment as the
  * 32bit structure. This makes 32bit emulation easier.
+ *
+ * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 +
+ * 64_BIT adds up to UML/x86_64.
  */
 #ifdef __x86_64__
 #define EPOLL_PACKED __attribute__((packed))
 #else
+#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
+#define EPOLL_PACKED __attribute__((packed))
+#else
 #define EPOLL_PACKED
 #endif
+#endif
 
 struct epoll_event {
        __u32 events;
index 5bdbc74..17c29dc 100644 (file)
@@ -206,6 +206,7 @@ struct hrtimer_cpu_base {
 struct clock_event_device;
 
 extern void clock_was_set(void);
+extern void hres_timers_resume(void);
 extern void hrtimer_interrupt(struct clock_event_device *dev);
 
 /*
@@ -236,6 +237,8 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
  */
 static inline void clock_was_set(void) { }
 
+static inline void hres_timers_resume(void) { }
+
 /*
  * In non high resolution mode the time reference is taken from
  * the base softirq time variable.
index 34f2676..58564a1 100644 (file)
@@ -615,6 +615,7 @@ typedef struct ide_drive_s {
         u8     init_speed;     /* transfer rate set at boot */
         u8     pio_speed;      /* unused by core, used by some drivers for fallback from DMA */
         u8     current_speed;  /* current transfer rate set */
+       u8      desired_speed;  /* desired transfer rate set */
         u8     dn;             /* now wide spread use */
         u8     wcache;         /* status of write cache */
        u8      acoustic;       /* acoustic management */
index 636094c..6da6772 100644 (file)
@@ -92,19 +92,16 @@ extern struct ipc_namespace init_ipc_ns;
 
 #ifdef CONFIG_SYSVIPC
 #define INIT_IPC_NS(ns)                .ns             = &init_ipc_ns,
+extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
 #else
 #define INIT_IPC_NS(ns)
+static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
+{ return 0; }
 #endif
 
 #ifdef CONFIG_IPC_NS
 extern void free_ipc_ns(struct kref *kref);
-extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
 extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns);
-#else
-static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
-{
-       return 0;
-}
 #endif
 
 static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
index 4c2c373..2dacab8 100644 (file)
@@ -87,8 +87,6 @@ static inline unsigned sysv_minor(u32 dev)
        return dev & 0x3ffff;
 }
 
-bool is_lanana_major(unsigned int major);
-
 #else /* __KERNEL__ */
 
 /*
index e3f32f3..0cfbcb6 100644 (file)
@@ -311,15 +311,17 @@ enum {
        ATA_HORKAGE_DIAGNOSTIC  = (1 << 0),     /* Failed boot diag */
        ATA_HORKAGE_NODMA       = (1 << 1),     /* DMA problems */
        ATA_HORKAGE_NONCQ       = (1 << 2),     /* Don't use NCQ */
+       ATA_HORKAGE_MAX_SEC_128 = (1 << 3),     /* Limit max sects to 128 */
+       ATA_HORKAGE_DMA_RW_ONLY = (1 << 4),     /* ATAPI DMA for RW only */
 };
 
 enum hsm_task_states {
        HSM_ST_IDLE,            /* no command on going */
+       HSM_ST_FIRST,           /* (waiting the device to)
+                                  write CDB or first data block */
        HSM_ST,                 /* (waiting the device to) transfer data */
        HSM_ST_LAST,            /* (waiting the device to) complete command */
        HSM_ST_ERR,             /* error */
-       HSM_ST_FIRST,           /* (waiting the device to)
-                                  write CDB or first data block */
 };
 
 enum ata_completion_errors {
index 06fe93a..14c937d 100644 (file)
@@ -245,7 +245,7 @@ extern void lock_release(struct lockdep_map *lock, int nested,
 
 # define INIT_LOCKDEP                          .lockdep_recursion = 0,
 
-#define lockdep_depth(tsk)     ((tsk)->lockdep_depth)
+#define lockdep_depth(tsk)     (debug_locks ? (tsk)->lockdep_depth : 0)
 
 #else /* !LOCKDEP */
 
index 2e19478..8bcbc54 100644 (file)
@@ -99,4 +99,8 @@ extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
                                loff_t *, size_t, unsigned int,
                                splice_actor *);
 
+extern ssize_t __splice_from_pipe(struct pipe_inode_info *, struct file *,
+                                 loff_t *, size_t, unsigned int,
+                                 splice_actor *);
+
 #endif
index 8245c28..de72c49 100644 (file)
@@ -104,6 +104,7 @@ struct mdk_rdev_s
                                           * for reporting to userspace and storing
                                           * in superblock.
                                           */
+       struct work_struct del_work;    /* used for delayed sysfs removal */
 };
 
 struct mddev_s
index 4ff3940..82f43ad 100644 (file)
@@ -188,7 +188,7 @@ enum {
  *     @sk: Socket we are owned by
  *     @tstamp: Time we arrived
  *     @dev: Device we arrived on/are leaving by
- *     @input_dev: Device we arrived on
+ *     @iif: ifindex of device we arrived on
  *     @h: Transport layer header
  *     @nh: Network layer header
  *     @mac: Link layer header
@@ -235,7 +235,8 @@ struct sk_buff {
        struct sock             *sk;
        struct skb_timeval      tstamp;
        struct net_device       *dev;
-       struct net_device       *input_dev;
+       int                     iif;
+       /* 4 byte hole on 64 bit*/
 
        union {
                struct tcphdr   *th;
index a4555fe..e10267d 100644 (file)
@@ -70,6 +70,8 @@ static inline int unshare_utsname(unsigned long unshare_flags,
 
 static inline int copy_utsname(int flags, struct task_struct *tsk)
 {
+       if (flags & CLONE_NEWUTS)
+               return -EINVAL;
        return 0;
 }
 static inline void put_uts_ns(struct uts_namespace *ns)
index 447c52b..48759b2 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file define a set of standard wireless extensions
  *
- * Version :   21      14.3.06
+ * Version :   22      16.3.07
  *
  * Authors :   Jean Tourrilhes - HPL - <jt@hpl.hp.com>
- * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved.
+ * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
  */
 
 #ifndef _LINUX_WIRELESS_H
@@ -85,7 +85,7 @@
  * (there is some stuff that will be added in the future...)
  * I just plan to increment with each new version.
  */
-#define WIRELESS_EXT   21
+#define WIRELESS_EXT   22
 
 /*
  * Changes :
  *     - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
  *     - Power/Retry relative values no longer * 100000
  *     - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
+ *
+ * V21 to V22
+ * ----------
+ *     - Prevent leaking of kernel space in stream on 64 bits.
  */
 
 /**************************** CONSTANTS ****************************/
@@ -1085,4 +1089,15 @@ struct iw_event
 #define IW_EV_POINT_LEN        (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
                         IW_EV_POINT_OFF)
 
+/* Size of the Event prefix when packed in stream */
+#define IW_EV_LCP_PK_LEN       (4)
+/* Size of the various events when packed in stream */
+#define IW_EV_CHAR_PK_LEN      (IW_EV_LCP_PK_LEN + IFNAMSIZ)
+#define IW_EV_UINT_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(__u32))
+#define IW_EV_FREQ_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq))
+#define IW_EV_PARAM_PK_LEN     (IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
+#define IW_EV_ADDR_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
+#define IW_EV_QUAL_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
+#define IW_EV_POINT_PK_LEN     (IW_EV_LCP_LEN + 4)
+
 #endif /* _LINUX_WIRELESS_H */
index 83fe2e3..50e33b0 100644 (file)
@@ -239,7 +239,8 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits);
 #define SAA7146_HPS_SYNC_PORT_B                0x01
 
 /* some memory sizes */
-#define SAA7146_CLIPPING_MEM   (14*PAGE_SIZE)
+/* max. 16 clipping rectangles */
+#define SAA7146_CLIPPING_MEM   (16 * 4 * sizeof(u32))
 
 /* some defines for the various clipping-modes */
 #define SAA7146_CLIPPING_RECT          0x4
index bc3c264..d585ea9 100644 (file)
@@ -34,6 +34,7 @@ struct fib_rules_ops
        int                     family;
        struct list_head        list;
        int                     rule_size;
+       int                     addr_size;
 
        int                     (*action)(struct fib_rule *,
                                          struct flowi *, int,
index 9eda572..cf355a3 100644 (file)
@@ -58,6 +58,7 @@ struct fib6_node
        __u16                   fn_bit;         /* bit key */
        __u16                   fn_flags;
        __u32                   fn_sernum;
+       struct rt6_info         *rr_ptr;
 };
 
 #ifndef CONFIG_IPV6_SUBTREES
index 10559e9..8a83018 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file define the new driver API for Wireless Extensions
  *
- * Version :   7       18.3.05
+ * Version :   8       16.3.07
  *
  * Authors :   Jean Tourrilhes - HPL - <jt@hpl.hp.com>
- * Copyright (c) 2001-2006 Jean Tourrilhes, All Rights Reserved.
+ * Copyright (c) 2001-2007 Jean Tourrilhes, All Rights Reserved.
  */
 
 #ifndef _IW_HANDLER_H
  * will be needed...
  * I just plan to increment with each new version.
  */
-#define IW_HANDLER_VERSION     7
+#define IW_HANDLER_VERSION     8
 
 /*
  * Changes :
  *     - Remove (struct iw_point *)->pointer from events and streams
  *     - Remove spy_offset from struct iw_handler_def
  *     - Add "check" version of event macros for ieee802.11 stack
+ *
+ * V7 to V8
+ * ----------
+ *     - Prevent leaking of kernel space in stream on 64 bits.
  */
 
 /**************************** CONSTANTS ****************************/
@@ -500,7 +504,11 @@ iwe_stream_add_event(char *        stream,         /* Stream of events */
        /* Check if it's possible */
        if(likely((stream + event_len) < ends)) {
                iwe->len = event_len;
-               memcpy(stream, (char *) iwe, event_len);
+               /* Beware of alignement issues on 64 bits */
+               memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
+               memcpy(stream + IW_EV_LCP_LEN,
+                      ((char *) iwe) + IW_EV_LCP_LEN,
+                      event_len - IW_EV_LCP_LEN);
                stream += event_len;
        }
        return stream;
@@ -521,10 +529,10 @@ iwe_stream_add_point(char *       stream,         /* Stream of events */
        /* Check if it's possible */
        if(likely((stream + event_len) < ends)) {
                iwe->len = event_len;
-               memcpy(stream, (char *) iwe, IW_EV_LCP_LEN);
+               memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
                memcpy(stream + IW_EV_LCP_LEN,
                       ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
-                      IW_EV_POINT_LEN - IW_EV_LCP_LEN);
+                      IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
                memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
                stream += event_len;
        }
@@ -574,7 +582,11 @@ iwe_stream_check_add_event(char *  stream,         /* Stream of events */
        /* Check if it's possible, set error if not */
        if(likely((stream + event_len) < ends)) {
                iwe->len = event_len;
-               memcpy(stream, (char *) iwe, event_len);
+               /* Beware of alignement issues on 64 bits */
+               memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
+               memcpy(stream + IW_EV_LCP_LEN,
+                      ((char *) iwe) + IW_EV_LCP_LEN,
+                      event_len - IW_EV_LCP_LEN);
                stream += event_len;
        } else
                *perr = -E2BIG;
@@ -598,10 +610,10 @@ iwe_stream_check_add_point(char * stream,         /* Stream of events */
        /* Check if it's possible */
        if(likely((stream + event_len) < ends)) {
                iwe->len = event_len;
-               memcpy(stream, (char *) iwe, IW_EV_LCP_LEN);
+               memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
                memcpy(stream + IW_EV_LCP_LEN,
                       ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
-                      IW_EV_POINT_LEN - IW_EV_LCP_LEN);
+                      IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
                memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
                stream += event_len;
        } else
index 3725b93..ad7fe11 100644 (file)
@@ -36,7 +36,7 @@ struct neigh_parms
        struct net_device *dev;
        struct neigh_parms *next;
        int     (*neigh_setup)(struct neighbour *);
-       void    (*neigh_destructor)(struct neighbour *);
+       void    (*neigh_cleanup)(struct neighbour *);
        struct neigh_table *tbl;
 
        void    *sysctl_table;
index b902d24..02647fe 100644 (file)
@@ -352,10 +352,13 @@ tcf_change_indev(struct tcf_proto *tp, char *indev, struct rtattr *indev_tlv)
 static inline int
 tcf_match_indev(struct sk_buff *skb, char *indev)
 {
+       struct net_device *dev;
+
        if (indev[0]) {
-               if  (!skb->input_dev)
+               if  (!skb->iif)
                        return 0;
-               if (strcmp(indev, skb->input_dev->name))
+               dev = __dev_get_by_index(skb->iif);
+               if (!dev || strcmp(indev, dev->name))
                        return 0;
        }
 
index 31a8e88..f431acf 100644 (file)
@@ -1002,6 +1002,7 @@ void sctp_transport_update_rto(struct sctp_transport *, __u32);
 void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
 void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
 unsigned long sctp_transport_timeout(struct sctp_transport *);
+void sctp_transport_reset(struct sctp_transport *);
 
 
 /* This is the structure we use to queue packets as they come into
index a43c878..ab26ab3 100644 (file)
@@ -59,6 +59,7 @@ struct sctp_ulpq {
 /* Prototypes. */
 struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *,
                                 struct sctp_association *);
+void sctp_ulpq_flush(struct sctp_ulpq *ulpq);
 void sctp_ulpq_free(struct sctp_ulpq *);
 
 /* Add a new DATA chunk for processing. */
index 08a6479..0b65238 100644 (file)
@@ -144,6 +144,13 @@ void free_ipc_ns(struct kref *kref)
        shm_exit_ns(ns);
        kfree(ns);
 }
+#else
+int copy_ipcs(unsigned long flags, struct task_struct *tsk)
+{
+       if (flags & CLONE_NEWIPC)
+               return -EINVAL;
+       return 0;
+}
 #endif
 
 /**
index 3d4206a..36e7084 100644 (file)
@@ -254,6 +254,12 @@ int __cpuinit cpu_up(unsigned int cpu)
 }
 
 #ifdef CONFIG_SUSPEND_SMP
+/* Needed to prevent the microcode driver from requesting firmware in its CPU
+ * hotplug notifier during the suspend/resume.
+ */
+int suspend_cpu_hotplug;
+EXPORT_SYMBOL(suspend_cpu_hotplug);
+
 static cpumask_t frozen_cpus;
 
 int disable_nonboot_cpus(void)
@@ -261,16 +267,8 @@ int disable_nonboot_cpus(void)
        int cpu, first_cpu, error = 0;
 
        mutex_lock(&cpu_add_remove_lock);
-       first_cpu = first_cpu(cpu_present_map);
-       if (!cpu_online(first_cpu)) {
-               error = _cpu_up(first_cpu);
-               if (error) {
-                       printk(KERN_ERR "Could not bring CPU%d up.\n",
-                               first_cpu);
-                       goto out;
-               }
-       }
-
+       suspend_cpu_hotplug = 1;
+       first_cpu = first_cpu(cpu_online_map);
        /* We take down all of the non-boot CPUs in one shot to avoid races
         * with the userspace trying to use the CPU hotplug at the same time
         */
@@ -296,7 +294,7 @@ int disable_nonboot_cpus(void)
        } else {
                printk(KERN_ERR "Non-boot CPUs are not disabled\n");
        }
-out:
+       suspend_cpu_hotplug = 0;
        mutex_unlock(&cpu_add_remove_lock);
        return error;
 }
@@ -308,20 +306,22 @@ void enable_nonboot_cpus(void)
        /* Allow everyone to use the CPU hotplug again */
        mutex_lock(&cpu_add_remove_lock);
        cpu_hotplug_disabled = 0;
-       mutex_unlock(&cpu_add_remove_lock);
        if (cpus_empty(frozen_cpus))
-               return;
+               goto out;
 
+       suspend_cpu_hotplug = 1;
        printk("Enabling non-boot CPUs ...\n");
        for_each_cpu_mask(cpu, frozen_cpus) {
-               error = cpu_up(cpu);
+               error = _cpu_up(cpu);
                if (!error) {
                        printk("CPU%d is up\n", cpu);
                        continue;
                }
-               printk(KERN_WARNING "Error taking CPU%d up: %d\n",
-                       cpu, error);
+               printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
        }
        cpus_clear(frozen_cpus);
+       suspend_cpu_hotplug = 0;
+out:
+       mutex_unlock(&cpu_add_remove_lock);
 }
 #endif
index f132349..b55ed4c 100644 (file)
@@ -790,7 +790,7 @@ static void exit_notify(struct task_struct *tsk)
        
        pgrp = task_pgrp(tsk);
        if ((task_pgrp(t) != pgrp) &&
-           (task_session(t) != task_session(tsk)) &&
+           (task_session(t) == task_session(tsk)) &&
            will_become_orphaned_pgrp(pgrp, tsk) &&
            has_stopped_jobs(pgrp)) {
                __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp);
index 6a7938a..b74860a 100644 (file)
@@ -458,6 +458,18 @@ void clock_was_set(void)
        on_each_cpu(retrigger_next_event, NULL, 0, 1);
 }
 
+/*
+ * During resume we might have to reprogram the high resolution timer
+ * interrupt (on the local CPU):
+ */
+void hres_timers_resume(void)
+{
+       WARN_ON_ONCE(num_online_cpus() > 1);
+
+       /* Retrigger the CPU local events: */
+       retrigger_next_event(NULL);
+}
+
 /*
  * Check, whether the timer is on the callback pending list
  */
@@ -814,7 +826,12 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
 
        timer_stats_hrtimer_set_start_info(timer);
 
-       enqueue_hrtimer(timer, new_base, base == new_base);
+       /*
+        * Only allow reprogramming if the new base is on this CPU.
+        * (it might still be on another CPU if the timer was pending)
+        */
+       enqueue_hrtimer(timer, new_base,
+                       new_base->cpu_base == &__get_cpu_var(hrtimer_bases));
 
        unlock_hrtimer_base(timer, &flags);
 
index 85a430d..d8ee241 100644 (file)
@@ -54,7 +54,7 @@ int devm_request_irq(struct device *dev, unsigned int irq,
 
        rc = request_irq(irq, handler, irqflags, devname, dev_id);
        if (rc) {
-               kfree(dr);
+               devres_free(dr);
                return rc;
        }
 
index 8dc24c9..7065a68 100644 (file)
@@ -2742,6 +2742,10 @@ void debug_show_all_locks(void)
        int count = 10;
        int unlock = 1;
 
+       if (unlikely(!debug_locks)) {
+               printk("INFO: lockdep is turned off.\n");
+               return;
+       }
        printk("\nShowing all locks held in the system:\n");
 
        /*
@@ -2785,6 +2789,10 @@ EXPORT_SYMBOL_GPL(debug_show_all_locks);
 
 void debug_show_held_locks(struct task_struct *task)
 {
+       if (unlikely(!debug_locks)) {
+               printk("INFO: lockdep is turned off.\n");
+               return;
+       }
        lockdep_print_held_locks(task);
 }
 
index fbc51de..dcdb32b 100644 (file)
@@ -2384,8 +2384,13 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
 
                /* Lookup built-in module entry in /sys/modules */
                mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name);
-               if (mkobj)
+               if (mkobj) {
                        mk = container_of(mkobj, struct module_kobject, kobj);
+                       /* remember our module structure */
+                       drv->mkobj = mk;
+                       /* kset_find_obj took a reference */
+                       kobject_put(mkobj);
+               }
        }
 
        if (!mk)
@@ -2405,17 +2410,22 @@ EXPORT_SYMBOL(module_add_driver);
 
 void module_remove_driver(struct device_driver *drv)
 {
+       struct module_kobject *mk = NULL;
        char *driver_name;
 
        if (!drv)
                return;
 
        sysfs_remove_link(&drv->kobj, "module");
-       if (drv->owner && drv->owner->mkobj.drivers_dir) {
+
+       if (drv->owner)
+               mk = &drv->owner->mkobj;
+       else if (drv->mkobj)
+               mk = drv->mkobj;
+       if (mk && mk->drivers_dir) {
                driver_name = make_driver_name(drv);
                if (driver_name) {
-                       sysfs_remove_link(drv->owner->mkobj.drivers_dir,
-                                         driver_name);
+                       sysfs_remove_link(mk->drivers_dir, driver_name);
                        kfree(driver_name);
                }
        }
index 873cdf8..aec19b0 100644 (file)
@@ -58,7 +58,6 @@ static inline int platform_prepare(void)
 
 static void power_down(suspend_disk_method_t mode)
 {
-       disable_nonboot_cpus();
        switch(mode) {
        case PM_DISK_PLATFORM:
                if (pm_ops && pm_ops->enter) {
@@ -241,18 +240,11 @@ static int software_resume(void)
                goto Done;
        }
 
-       error = platform_prepare();
-       if (error) {
-               swsusp_free();
-               goto Thaw;
-       }
-
        pr_debug("PM: Reading swsusp image.\n");
 
        error = swsusp_read();
        if (error) {
                swsusp_free();
-               platform_finish();
                goto Thaw;
        }
 
@@ -270,7 +262,6 @@ static int software_resume(void)
        enable_nonboot_cpus();
  Free:
        swsusp_free();
-       platform_finish();
        device_resume();
        resume_console();
  Thaw:
index 7fb8343..1753708 100644 (file)
@@ -229,13 +229,13 @@ int swsusp_shrink_memory(void)
                size += highmem_size;
                for_each_zone (zone)
                        if (populated_zone(zone)) {
+                               tmp += snapshot_additional_pages(zone);
                                if (is_highmem(zone)) {
                                        highmem_size -=
                                        zone_page_state(zone, NR_FREE_PAGES);
                                } else {
                                        tmp -= zone_page_state(zone, NR_FREE_PAGES);
                                        tmp += zone->lowmem_reserve[ZONE_NORMAL];
-                                       tmp += snapshot_additional_pages(zone);
                                }
                        }
 
index d6a8dcc..7cf6713 100644 (file)
@@ -368,9 +368,12 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                if (error) {
                        printk(KERN_ERR "Failed to suspend some devices.\n");
                } else {
-                       /* Enter S3, system is already frozen */
-                       suspend_enter(PM_SUSPEND_MEM);
-
+                       error = disable_nonboot_cpus();
+                       if (!error) {
+                               /* Enter S3, system is already frozen */
+                               suspend_enter(PM_SUSPEND_MEM);
+                               enable_nonboot_cpus();
+                       }
                        /* Wake up devices */
                        device_resume();
                }
@@ -398,10 +401,9 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
 
                case PMOPS_ENTER:
                        if (data->platform_suspend) {
-                               disable_nonboot_cpus();
                                kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
                                error = pm_ops->enter(PM_SUSPEND_DISK);
-                               enable_nonboot_cpus();
+                               error = 0;
                        }
                        break;
 
index a4ca632..b9a6837 100644 (file)
@@ -4687,32 +4687,10 @@ out_unlock:
        return retval;
 }
 
-static inline struct task_struct *eldest_child(struct task_struct *p)
-{
-       if (list_empty(&p->children))
-               return NULL;
-       return list_entry(p->children.next,struct task_struct,sibling);
-}
-
-static inline struct task_struct *older_sibling(struct task_struct *p)
-{
-       if (p->sibling.prev==&p->parent->children)
-               return NULL;
-       return list_entry(p->sibling.prev,struct task_struct,sibling);
-}
-
-static inline struct task_struct *younger_sibling(struct task_struct *p)
-{
-       if (p->sibling.next==&p->parent->children)
-               return NULL;
-       return list_entry(p->sibling.next,struct task_struct,sibling);
-}
-
 static const char stat_nam[] = "RSDTtZX";
 
 static void show_task(struct task_struct *p)
 {
-       struct task_struct *relative;
        unsigned long free = 0;
        unsigned state;
 
@@ -4738,19 +4716,7 @@ static void show_task(struct task_struct *p)
                free = (unsigned long)n - (unsigned long)end_of_stack(p);
        }
 #endif
-       printk("%5lu %5d %6d ", free, p->pid, p->parent->pid);
-       if ((relative = eldest_child(p)))
-               printk("%5d ", relative->pid);
-       else
-               printk("      ");
-       if ((relative = younger_sibling(p)))
-               printk("%7d", relative->pid);
-       else
-               printk("       ");
-       if ((relative = older_sibling(p)))
-               printk(" %5d", relative->pid);
-       else
-               printk("      ");
+       printk("%5lu %5d %6d", free, p->pid, p->parent->pid);
        if (!p->mm)
                printk(" (L-TLB)\n");
        else
index c6c80ea..2f47888 100644 (file)
@@ -635,6 +635,7 @@ timeval_to_jiffies(const struct timeval *value)
                (((u64)usec * USEC_CONVERSION + USEC_ROUND) >>
                 (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;
 }
+EXPORT_SYMBOL(timeval_to_jiffies);
 
 void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
 {
@@ -649,6 +650,7 @@ void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
        tv_usec /= NSEC_PER_USEC;
        value->tv_usec = tv_usec;
 }
+EXPORT_SYMBOL(jiffies_to_timeval);
 
 /*
  * Convert jiffies/jiffies_64 to clock_t and back.
index 67932ea..76212b2 100644 (file)
@@ -274,72 +274,3 @@ void clockevents_notify(unsigned long reason, void *arg)
 }
 EXPORT_SYMBOL_GPL(clockevents_notify);
 
-#ifdef CONFIG_SYSFS
-
-/**
- * clockevents_show_registered - sysfs interface for listing clockevents
- * @dev:       unused
- * @buf:       char buffer to be filled with clock events list
- *
- * Provides sysfs interface for listing registered clock event devices
- */
-static ssize_t clockevents_show_registered(struct sys_device *dev, char *buf)
-{
-       struct list_head *tmp;
-       char *p = buf;
-       int cpu;
-
-       spin_lock(&clockevents_lock);
-
-       list_for_each(tmp, &clockevent_devices) {
-               struct clock_event_device *ce;
-
-               ce = list_entry(tmp, struct clock_event_device, list);
-               p += sprintf(p, "%-20s F:%04x M:%d", ce->name,
-                            ce->features, ce->mode);
-               p += sprintf(p, " C:");
-               if (!cpus_equal(ce->cpumask, cpu_possible_map)) {
-                       for_each_cpu_mask(cpu, ce->cpumask)
-                               p += sprintf(p, " %d", cpu);
-               } else {
-                       /*
-                        * FIXME: Add the cpu which is handling this sucker
-                        */
-               }
-               p += sprintf(p, "\n");
-       }
-
-       spin_unlock(&clockevents_lock);
-
-       return p - buf;
-}
-
-/*
- * Sysfs setup bits:
- */
-static SYSDEV_ATTR(registered, 0600,
-                  clockevents_show_registered, NULL);
-
-static struct sysdev_class clockevents_sysclass = {
-       set_kset_name("clockevents"),
-};
-
-static struct sys_device clockevents_sys_device = {
-       .id     = 0,
-       .cls    = &clockevents_sysclass,
-};
-
-static int __init clockevents_sysfs_init(void)
-{
-       int error = sysdev_class_register(&clockevents_sysclass);
-
-       if (!error)
-               error = sysdev_register(&clockevents_sys_device);
-       if (!error)
-               error = sysdev_create_file(
-                               &clockevents_sys_device,
-                               &attr_registered);
-       return error;
-}
-device_initcall(clockevents_sysfs_init);
-#endif
index 5b0e46b..fe5c7db 100644 (file)
@@ -151,7 +151,8 @@ static void clocksource_check_watchdog(struct clocksource *cs)
                        watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
                        add_timer(&watchdog_timer);
                }
-       } else if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) {
+       } else {
+               if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
                        cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
 
                if (!watchdog || cs->rating > watchdog->rating) {
index 3be8da8..4c256fd 100644 (file)
@@ -69,4 +69,4 @@ static int __init init_jiffies_clocksource(void)
        return clocksource_register(&clocksource_jiffies);
 }
 
-module_init(init_jiffies_clocksource);
+core_initcall(init_jiffies_clocksource);
index eb12509..cb25649 100644 (file)
@@ -32,7 +32,7 @@ static u64 tick_length, tick_length_base;
 /* TIME_ERROR prevents overwriting the CMOS clock */
 static int time_state = TIME_OK;       /* clock synchronization status */
 int time_status = STA_UNSYNC;          /* clock status bits            */
-static long time_offset;               /* time adjustment (ns)         */
+static s64 time_offset;                /* time adjustment (ns)         */
 static long time_constant = 2;         /* pll time constant            */
 long time_maxerror = NTP_PHASE_LIMIT;  /* maximum error (us)           */
 long time_esterror = NTP_PHASE_LIMIT;  /* estimated error (us)         */
@@ -196,7 +196,7 @@ void __attribute__ ((weak)) notify_arch_cmos_timer(void)
  */
 int do_adjtimex(struct timex *txc)
 {
-       long ltemp, mtemp, save_adjust;
+       long mtemp, save_adjust, rem;
        s64 freq_adj, temp64;
        int result;
 
@@ -277,14 +277,14 @@ int do_adjtimex(struct timex *txc)
                    time_adjust = txc->offset;
                }
                else if (time_status & STA_PLL) {
-                   ltemp = txc->offset * NSEC_PER_USEC;
+                   time_offset = txc->offset * NSEC_PER_USEC;
 
                    /*
                     * Scale the phase adjustment and
                     * clamp to the operating range.
                     */
-                   time_offset = min(ltemp, MAXPHASE * NSEC_PER_USEC);
-                   time_offset = max(time_offset, -MAXPHASE * NSEC_PER_USEC);
+                   time_offset = min(time_offset, (s64)MAXPHASE * NSEC_PER_USEC);
+                   time_offset = max(time_offset, (s64)-MAXPHASE * NSEC_PER_USEC);
 
                    /*
                     * Select whether the frequency is to be controlled
@@ -297,11 +297,11 @@ int do_adjtimex(struct timex *txc)
                    mtemp = xtime.tv_sec - time_reftime;
                    time_reftime = xtime.tv_sec;
 
-                   freq_adj = (s64)time_offset * mtemp;
+                   freq_adj = time_offset * mtemp;
                    freq_adj = shift_right(freq_adj, time_constant * 2 +
                                           (SHIFT_PLL + 2) * 2 - SHIFT_NSEC);
                    if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) {
-                       temp64 = (s64)time_offset << (SHIFT_NSEC - SHIFT_FLL);
+                       temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL);
                        if (time_offset < 0) {
                            temp64 = -temp64;
                            do_div(temp64, mtemp);
@@ -314,8 +314,10 @@ int do_adjtimex(struct timex *txc)
                    freq_adj += time_freq;
                    freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC);
                    time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC);
-                   time_offset = (time_offset / NTP_INTERVAL_FREQ)
-                                       << SHIFT_UPDATE;
+                   time_offset = div_long_long_rem_signed(time_offset,
+                                                          NTP_INTERVAL_FREQ,
+                                                          &rem);
+                   time_offset <<= SHIFT_UPDATE;
                } /* STA_PLL */
            } /* txc->modes & ADJ_OFFSET */
            if (txc->modes & ADJ_TICK)
@@ -328,12 +330,12 @@ leave:    if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
                result = TIME_ERROR;
 
        if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
-           txc->offset    = save_adjust;
+               txc->offset = save_adjust;
        else
-           txc->offset    = shift_right(time_offset, SHIFT_UPDATE)
-                               NTP_INTERVAL_FREQ / 1000;
-       txc->freq          = (time_freq / NSEC_PER_USEC)
-                               << (SHIFT_USEC - SHIFT_NSEC);
+               txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) *
+                               NTP_INTERVAL_FREQ / 1000;
+       txc->freq          = (time_freq / NSEC_PER_USEC) <<
+                               (SHIFT_USEC - SHIFT_NSEC);
        txc->maxerror      = time_maxerror;
        txc->esterror      = time_esterror;
        txc->status        = time_status;
index f82c635..59df5e8 100644 (file)
@@ -194,9 +194,9 @@ print_tickdevice(struct seq_file *m, struct tick_device *td)
                return;
        }
        SEQ_printf(m, "%s\n", dev->name);
-       SEQ_printf(m, " max_delta_ns:   %ld\n", dev->max_delta_ns);
-       SEQ_printf(m, " min_delta_ns:   %ld\n", dev->min_delta_ns);
-       SEQ_printf(m, " mult:           %ld\n", dev->mult);
+       SEQ_printf(m, " max_delta_ns:   %lu\n", dev->max_delta_ns);
+       SEQ_printf(m, " min_delta_ns:   %lu\n", dev->min_delta_ns);
+       SEQ_printf(m, " mult:           %lu\n", dev->mult);
        SEQ_printf(m, " shift:          %d\n", dev->shift);
        SEQ_printf(m, " mode:           %d\n", dev->mode);
        SEQ_printf(m, " next_event:     %Ld nsecs\n",
index 797cccb..dd6c2c1 100644 (file)
@@ -695,15 +695,28 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now,
 {
        ktime_t hr_delta = hrtimer_get_next_event();
        struct timespec tsdelta;
+       unsigned long delta;
 
        if (hr_delta.tv64 == KTIME_MAX)
                return expires;
 
-       if (hr_delta.tv64 <= TICK_NSEC)
-               return now;
+       /*
+        * Expired timer available, let it expire in the next tick
+        */
+       if (hr_delta.tv64 <= 0)
+               return now + 1;
 
        tsdelta = ktime_to_timespec(hr_delta);
-       now += timespec_to_jiffies(&tsdelta);
+       delta = timespec_to_jiffies(&tsdelta);
+       /*
+        * Take rounding errors in to account and make sure, that it
+        * expires in the next tick. Otherwise we go into an endless
+        * ping pong due to tick_nohz_stop_sched_tick() retriggering
+        * the timer softirq
+        */
+       if (delta < 1)
+               delta = 1;
+       now += delta;
        if (time_before(now, expires))
                return now;
        return expires;
@@ -1003,7 +1016,7 @@ static int timekeeping_resume(struct sys_device *dev)
        clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL);
 
        /* Resume hrtimers */
-       clock_was_set();
+       hres_timers_resume();
 
        return 0;
 }
index 643efbe..ad401fc 100644 (file)
@@ -204,7 +204,7 @@ static void __blk_queue_bounce(request_queue_t *q, struct bio **bio_orig,
                /*
                 * is destination page below bounce pfn?
                 */
-               if (page_to_pfn(page) < q->bounce_pfn)
+               if (page_to_pfn(page) <= q->bounce_pfn)
                        continue;
 
                /*
index 9dd9fbb..cbb3358 100644 (file)
 #include <asm/tlbflush.h>
 #include "filemap.h"
 
+/*
+ * We do use our own empty page to avoid interference with other users
+ * of ZERO_PAGE(), such as /dev/zero
+ */
+static struct page *__xip_sparse_page;
+
+static struct page *xip_sparse_page(void)
+{
+       if (!__xip_sparse_page) {
+               unsigned long zeroes = get_zeroed_page(GFP_HIGHUSER);
+               if (zeroes) {
+                       static DEFINE_SPINLOCK(xip_alloc_lock);
+                       spin_lock(&xip_alloc_lock);
+                       if (!__xip_sparse_page)
+                               __xip_sparse_page = virt_to_page(zeroes);
+                       else
+                               free_page(zeroes);
+                       spin_unlock(&xip_alloc_lock);
+               }
+       }
+       return __xip_sparse_page;
+}
+
 /*
  * This is a file read routine for execute in place files, and uses
  * the mapping->a_ops->get_xip_page() function for the actual low-level
@@ -162,7 +185,7 @@ EXPORT_SYMBOL_GPL(xip_file_sendfile);
  * xip_write
  *
  * This function walks all vmas of the address_space and unmaps the
- * ZERO_PAGE when found at pgoff. Should it go in rmap.c?
+ * __xip_sparse_page when found at pgoff.
  */
 static void
 __xip_unmap (struct address_space * mapping,
@@ -177,13 +200,16 @@ __xip_unmap (struct address_space * mapping,
        spinlock_t *ptl;
        struct page *page;
 
+       page = __xip_sparse_page;
+       if (!page)
+               return;
+
        spin_lock(&mapping->i_mmap_lock);
        vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
                mm = vma->vm_mm;
                address = vma->vm_start +
                        ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
                BUG_ON(address < vma->vm_start || address >= vma->vm_end);
-               page = ZERO_PAGE(0);
                pte = page_check_address(page, mm, address, &ptl);
                if (pte) {
                        /* Nuke the page table entry. */
@@ -222,16 +248,14 @@ xip_file_nopage(struct vm_area_struct * area,
                + area->vm_pgoff;
 
        size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-       if (pgoff >= size) {
-               return NULL;
-       }
+       if (pgoff >= size)
+               return NOPAGE_SIGBUS;
 
        page = mapping->a_ops->get_xip_page(mapping, pgoff*(PAGE_SIZE/512), 0);
-       if (!IS_ERR(page)) {
+       if (!IS_ERR(page))
                goto out;
-       }
        if (PTR_ERR(page) != -ENODATA)
-               return NULL;
+               return NOPAGE_SIGBUS;
 
        /* sparse block */
        if ((area->vm_flags & (VM_WRITE | VM_MAYWRITE)) &&
@@ -241,12 +265,14 @@ xip_file_nopage(struct vm_area_struct * area,
                page = mapping->a_ops->get_xip_page (mapping,
                        pgoff*(PAGE_SIZE/512), 1);
                if (IS_ERR(page))
-                       return NULL;
+                       return NOPAGE_SIGBUS;
                /* unmap page at pgoff from all other vmas */
                __xip_unmap(mapping, pgoff);
        } else {
-               /* not shared and writable, use ZERO_PAGE() */
-               page = ZERO_PAGE(0);
+               /* not shared and writable, use xip_sparse_page() */
+               page = xip_sparse_page();
+               if (!page)
+                       return NOPAGE_OOM;
        }
 
 out:
index 77916e9..603c525 100644 (file)
@@ -159,9 +159,10 @@ static long madvise_remove(struct vm_area_struct *vma,
                                unsigned long start, unsigned long end)
 {
        struct address_space *mapping;
-        loff_t offset, endoff;
+       loff_t offset, endoff;
+       int error;
 
-       *prev = vma;
+       *prev = NULL;   /* tell sys_madvise we drop mmap_sem */
 
        if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))
                return -EINVAL;
@@ -180,7 +181,12 @@ static long madvise_remove(struct vm_area_struct *vma,
                        + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
        endoff = (loff_t)(end - vma->vm_start - 1)
                        + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
-       return  vmtruncate_range(mapping->host, offset, endoff);
+
+       /* vmtruncate_range needs to take i_mutex and i_alloc_sem */
+       up_write(&current->mm->mmap_sem);
+       error = vmtruncate_range(mapping->host, offset, endoff);
+       down_write(&current->mm->mmap_sem);
+       return error;
 }
 
 static long
@@ -315,12 +321,15 @@ asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
                if (error)
                        goto out;
                start = tmp;
-               if (start < prev->vm_end)
+               if (prev && start < prev->vm_end)
                        start = prev->vm_end;
                error = unmapped_error;
                if (start >= end)
                        goto out;
-               vma = prev->vm_next;
+               if (prev)
+                       vma = prev->vm_next;
+               else    /* madvise_remove dropped mmap_sem */
+                       vma = find_vma(current->mm, start);
        }
 out:
        up_write(&current->mm->mmap_sem);
index 23fb033..cbbc137 100644 (file)
@@ -826,6 +826,11 @@ unsigned long do_mmap_pgoff(struct file *file,
                unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
                unsigned long vmpglen;
 
+               /* suppress VMA sharing for shared regions */
+               if (vm_flags & VM_SHARED &&
+                   capabilities & BDI_CAP_MAP_DIRECT)
+                       goto dont_share_VMAs;
+
                for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) {
                        vma = rb_entry(rb, struct vm_area_struct, vm_rb);
 
@@ -859,6 +864,7 @@ unsigned long do_mmap_pgoff(struct file *file,
                        goto shared;
                }
 
+       dont_share_VMAs:
                vma = NULL;
 
                /* obtain the address at which to make a shared mapping
@@ -1192,6 +1198,28 @@ void unmap_mapping_range(struct address_space *mapping,
 }
 EXPORT_SYMBOL(unmap_mapping_range);
 
+/*
+ * ask for an unmapped area at which to create a mapping on a file
+ */
+unsigned long get_unmapped_area(struct file *file, unsigned long addr,
+                               unsigned long len, unsigned long pgoff,
+                               unsigned long flags)
+{
+       unsigned long (*get_area)(struct file *, unsigned long, unsigned long,
+                                 unsigned long, unsigned long);
+
+       get_area = current->mm->get_unmapped_area;
+       if (file && file->f_op && file->f_op->get_unmapped_area)
+               get_area = file->f_op->get_unmapped_area;
+
+       if (!get_area)
+               return -ENOSYS;
+
+       return get_area(file, addr, len, pgoff, flags);
+}
+
+EXPORT_SYMBOL(get_unmapped_area);
+
 /*
  * Check that a process has enough memory to allocate a new virtual
  * mapping. 0 means there is enough memory for the allocation to
index 22ed3f7..b82146e 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -498,9 +498,9 @@ int page_mkclean(struct page *page)
                struct address_space *mapping = page_mapping(page);
                if (mapping)
                        ret = page_mkclean_file(mapping, page);
+               if (page_test_and_clear_dirty(page))
+                       ret = 1;
        }
-       if (page_test_and_clear_dirty(page))
-               ret = 1;
 
        return ret;
 }
index b8c429a..b2a35eb 100644 (file)
@@ -402,26 +402,38 @@ static swp_entry_t *shmem_swp_alloc(struct shmem_inode_info *info, unsigned long
 /*
  * shmem_free_swp - free some swap entries in a directory
  *
- * @dir:   pointer to the directory
- * @edir:  pointer after last entry of the directory
+ * @dir:        pointer to the directory
+ * @edir:       pointer after last entry of the directory
+ * @punch_lock: pointer to spinlock when needed for the holepunch case
  */
-static int shmem_free_swp(swp_entry_t *dir, swp_entry_t *edir)
+static int shmem_free_swp(swp_entry_t *dir, swp_entry_t *edir,
+                                               spinlock_t *punch_lock)
 {
+       spinlock_t *punch_unlock = NULL;
        swp_entry_t *ptr;
        int freed = 0;
 
        for (ptr = dir; ptr < edir; ptr++) {
                if (ptr->val) {
+                       if (unlikely(punch_lock)) {
+                               punch_unlock = punch_lock;
+                               punch_lock = NULL;
+                               spin_lock(punch_unlock);
+                               if (!ptr->val)
+                                       continue;
+                       }
                        free_swap_and_cache(*ptr);
                        *ptr = (swp_entry_t){0};
                        freed++;
                }
        }
+       if (punch_unlock)
+               spin_unlock(punch_unlock);
        return freed;
 }
 
-static int shmem_map_and_free_swp(struct page *subdir,
-               int offset, int limit, struct page ***dir)
+static int shmem_map_and_free_swp(struct page *subdir, int offset,
+               int limit, struct page ***dir, spinlock_t *punch_lock)
 {
        swp_entry_t *ptr;
        int freed = 0;
@@ -431,7 +443,8 @@ static int shmem_map_and_free_swp(struct page *subdir,
                int size = limit - offset;
                if (size > LATENCY_LIMIT)
                        size = LATENCY_LIMIT;
-               freed += shmem_free_swp(ptr+offset, ptr+offset+size);
+               freed += shmem_free_swp(ptr+offset, ptr+offset+size,
+                                                       punch_lock);
                if (need_resched()) {
                        shmem_swp_unmap(ptr);
                        if (*dir) {
@@ -481,7 +494,10 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
        long nr_swaps_freed = 0;
        int offset;
        int freed;
-       int punch_hole = 0;
+       int punch_hole;
+       spinlock_t *needs_lock;
+       spinlock_t *punch_lock;
+       unsigned long upper_limit;
 
        inode->i_ctime = inode->i_mtime = CURRENT_TIME;
        idx = (start + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
@@ -492,11 +508,20 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
        info->flags |= SHMEM_TRUNCATE;
        if (likely(end == (loff_t) -1)) {
                limit = info->next_index;
+               upper_limit = SHMEM_MAX_INDEX;
                info->next_index = idx;
+               needs_lock = NULL;
+               punch_hole = 0;
        } else {
-               limit = (end + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-               if (limit > info->next_index)
-                       limit = info->next_index;
+               if (end + 1 >= inode->i_size) { /* we may free a little more */
+                       limit = (inode->i_size + PAGE_CACHE_SIZE - 1) >>
+                                                       PAGE_CACHE_SHIFT;
+                       upper_limit = SHMEM_MAX_INDEX;
+               } else {
+                       limit = (end + 1) >> PAGE_CACHE_SHIFT;
+                       upper_limit = limit;
+               }
+               needs_lock = &info->lock;
                punch_hole = 1;
        }
 
@@ -513,17 +538,30 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
                size = limit;
                if (size > SHMEM_NR_DIRECT)
                        size = SHMEM_NR_DIRECT;
-               nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size);
+               nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size, needs_lock);
        }
 
        /*
         * If there are no indirect blocks or we are punching a hole
         * below indirect blocks, nothing to be done.
         */
-       if (!topdir || (punch_hole && (limit <= SHMEM_NR_DIRECT)))
+       if (!topdir || limit <= SHMEM_NR_DIRECT)
                goto done2;
 
-       BUG_ON(limit <= SHMEM_NR_DIRECT);
+       /*
+        * The truncation case has already dropped info->lock, and we're safe
+        * because i_size and next_index have already been lowered, preventing
+        * access beyond.  But in the punch_hole case, we still need to take
+        * the lock when updating the swap directory, because there might be
+        * racing accesses by shmem_getpage(SGP_CACHE), shmem_unuse_inode or
+        * shmem_writepage.  However, whenever we find we can remove a whole
+        * directory page (not at the misaligned start or end of the range),
+        * we first NULLify its pointer in the level above, and then have no
+        * need to take the lock when updating its contents: needs_lock and
+        * punch_lock (either pointing to info->lock or NULL) manage this.
+        */
+
+       upper_limit -= SHMEM_NR_DIRECT;
        limit -= SHMEM_NR_DIRECT;
        idx = (idx > SHMEM_NR_DIRECT)? (idx - SHMEM_NR_DIRECT): 0;
        offset = idx % ENTRIES_PER_PAGE;
@@ -543,8 +581,14 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
                if (*dir) {
                        diroff = ((idx - ENTRIES_PER_PAGEPAGE/2) %
                                ENTRIES_PER_PAGEPAGE) / ENTRIES_PER_PAGE;
-                       if (!diroff && !offset) {
-                               *dir = NULL;
+                       if (!diroff && !offset && upper_limit >= stage) {
+                               if (needs_lock) {
+                                       spin_lock(needs_lock);
+                                       *dir = NULL;
+                                       spin_unlock(needs_lock);
+                                       needs_lock = NULL;
+                               } else
+                                       *dir = NULL;
                                nr_pages_to_free++;
                                list_add(&middir->lru, &pages_to_free);
                        }
@@ -570,39 +614,55 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
                        }
                        stage = idx + ENTRIES_PER_PAGEPAGE;
                        middir = *dir;
-                       *dir = NULL;
-                       nr_pages_to_free++;
-                       list_add(&middir->lru, &pages_to_free);
+                       if (punch_hole)
+                               needs_lock = &info->lock;
+                       if (upper_limit >= stage) {
+                               if (needs_lock) {
+                                       spin_lock(needs_lock);
+                                       *dir = NULL;
+                                       spin_unlock(needs_lock);
+                                       needs_lock = NULL;
+                               } else
+                                       *dir = NULL;
+                               nr_pages_to_free++;
+                               list_add(&middir->lru, &pages_to_free);
+                       }
                        shmem_dir_unmap(dir);
                        cond_resched();
                        dir = shmem_dir_map(middir);
                        diroff = 0;
                }
+               punch_lock = needs_lock;
                subdir = dir[diroff];
-               if (subdir && page_private(subdir)) {
+               if (subdir && !offset && upper_limit-idx >= ENTRIES_PER_PAGE) {
+                       if (needs_lock) {
+                               spin_lock(needs_lock);
+                               dir[diroff] = NULL;
+                               spin_unlock(needs_lock);
+                               punch_lock = NULL;
+                       } else
+                               dir[diroff] = NULL;
+                       nr_pages_to_free++;
+                       list_add(&subdir->lru, &pages_to_free);
+               }
+               if (subdir && page_private(subdir) /* has swap entries */) {
                        size = limit - idx;
                        if (size > ENTRIES_PER_PAGE)
                                size = ENTRIES_PER_PAGE;
                        freed = shmem_map_and_free_swp(subdir,
-                                               offset, size, &dir);
+                                       offset, size, &dir, punch_lock);
                        if (!dir)
                                dir = shmem_dir_map(middir);
                        nr_swaps_freed += freed;
-                       if (offset)
+                       if (offset || punch_lock) {
                                spin_lock(&info->lock);
-                       set_page_private(subdir, page_private(subdir) - freed);
-                       if (offset)
+                               set_page_private(subdir,
+                                       page_private(subdir) - freed);
                                spin_unlock(&info->lock);
-                       if (!punch_hole)
-                               BUG_ON(page_private(subdir) > offset);
-               }
-               if (offset)
-                       offset = 0;
-               else if (subdir && !page_private(subdir)) {
-                       dir[diroff] = NULL;
-                       nr_pages_to_free++;
-                       list_add(&subdir->lru, &pages_to_free);
+                       } else
+                               BUG_ON(page_private(subdir) != freed);
                }
+               offset = 0;
        }
 done1:
        shmem_dir_unmap(dir);
@@ -614,8 +674,16 @@ done2:
                 * generic_delete_inode did it, before we lowered next_index.
                 * Also, though shmem_getpage checks i_size before adding to
                 * cache, no recheck after: so fix the narrow window there too.
+                *
+                * Recalling truncate_inode_pages_range and unmap_mapping_range
+                * every time for punch_hole (which never got a chance to clear
+                * SHMEM_PAGEIN at the start of vmtruncate_range) is expensive,
+                * yet hardly ever necessary: try to optimize them out later.
                 */
                truncate_inode_pages_range(inode->i_mapping, start, end);
+               if (punch_hole)
+                       unmap_mapping_range(inode->i_mapping, start,
+                                                       end - start, 1);
        }
 
        spin_lock(&info->lock);
index 57f7aa4..4cbac24 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1802,8 +1802,8 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp)
                        /* Print header */
                        if (lines == 0) {
                                printk(KERN_ERR
-                                       "Slab corruption: start=%p, len=%d\n",
-                                       realobj, size);
+                                       "Slab corruption: %s start=%p, len=%d\n",
+                                       cachep->name, realobj, size);
                                print_objinfo(cachep, objp, 0);
                        }
                        /* Hexdump the affected line */
index 113c175..c8b7dc2 100644 (file)
@@ -1417,10 +1417,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
        /*
         * Size check to see if ddp->deh_len was crap
         * (Otherwise we'll detonate most spectacularly
-        * in the middle of recvmsg()).
+        * in the middle of atalk_checksum() or recvmsg()).
         */
-       if (skb->len < sizeof(*ddp))
+       if (skb->len < sizeof(*ddp) || skb->len < (len_hops & 1023)) {
+               pr_debug("AppleTalk: dropping corrupted frame (deh_len=%u, "
+                        "skb->len=%u)\n", len_hops & 1023, skb->len);
                goto freeit;
+       }
 
        /*
         * Any checksums. Note we don't do htons() on this == is assumed to be
index ebb5d0c..8c38258 100644 (file)
@@ -261,14 +261,6 @@ static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb)
        spin_unlock_irqrestore(&PRIV(dev)->xoff_lock, flags);
 }
 
-static void clip_neigh_destroy(struct neighbour *neigh)
-{
-       DPRINTK("clip_neigh_destroy (neigh %p)\n", neigh);
-       if (NEIGH2ENTRY(neigh)->vccs)
-               printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n");
-       NEIGH2ENTRY(neigh)->vccs = (void *) NEIGHBOR_DEAD;
-}
-
 static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb)
 {
        DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb);
@@ -342,7 +334,6 @@ static struct neigh_table clip_tbl = {
        /* parameters are copied from ARP ... */
        .parms = {
                .tbl                    = &clip_tbl,
-               .neigh_destructor       = clip_neigh_destroy,
                .base_reachable_time    = 30 * HZ,
                .retrans_time           = 1 * HZ,
                .gc_staletime           = 60 * HZ,
index a8993a0..43dd86f 100644 (file)
@@ -1,30 +1,27 @@
 #
 # Amateur Radio protocols and AX.25 device configuration
 #
-# 19971130     Now in an own category to make correct compilation of the
-#              AX.25 stuff easier...
-#              Joerg Reuter DL1BKE <jreuter@yaina.de>
-# 19980129     Moved to net/ax25/Config.in, sourcing device drivers.
 
 menuconfig HAMRADIO
        depends on NET
        bool "Amateur Radio support"
        help
          If you want to connect your Linux box to an amateur radio, answer Y
-         here. You want to read <http://www.tapr.org/tapr/html/pkthome.html> and
-         the AX25-HOWTO, available from <http://www.tldp.org/docs.html#howto>.
+         here. You want to read <http://www.tapr.org/tapr/html/pkthome.html>
+         and more specifically about AX.25 on Linux
+         <http://www.linux-ax25.org/>.
 
          Note that the answer to this question won't directly affect the
          kernel: saying N will just cause the configurator to skip all
          the questions about amateur radio.
 
 comment "Packet Radio protocols"
-       depends on HAMRADIO && NET
+       depends on HAMRADIO
 
 config AX25
        tristate "Amateur Radio AX.25 Level 2 protocol"
-       depends on HAMRADIO && NET
-       ---help---
+       depends on HAMRADIO
+       help
          This is the protocol used for computer communication over amateur
          radio. It is either used by itself for point-to-point links, or to
          carry other protocols such as tcp/ip. To use it, you need a device
@@ -52,6 +49,7 @@ config AX25
 
 config AX25_DAMA_SLAVE
        bool "AX.25 DAMA Slave support"
+       default y
        depends on AX25
        help
          DAMA is a mechanism to prevent collisions when doing AX.25
@@ -59,23 +57,38 @@ config AX25_DAMA_SLAVE
          from clients (called "slaves") and redistributes it to other slaves.
          If you say Y here, your Linux box will act as a DAMA slave; this is
          transparent in that you don't have to do any special DAMA
-         configuration. (Linux cannot yet act as a DAMA server.) If unsure,
-         say N.
+         configuration. Linux cannot yet act as a DAMA server.  This option
+         only compiles DAMA slave support into the kernel.  It still needs to
+         be enabled at runtime.  For more about DAMA see
+         <http://www.linux-ax25.org>.  If unsure, say Y.
+
+# placeholder until implemented
+config AX25_DAMA_MASTER
+       bool 'AX.25 DAMA Master support'
+       depends on AX25_DAMA_SLAVE && BROKEN
+       help
+         DAMA is a mechanism to prevent collisions when doing AX.25
+         networking. A DAMA server (called "master") accepts incoming traffic
+         from clients (called "slaves") and redistributes it to other slaves.
+         If you say Y here, your Linux box will act as a DAMA master; this is
+         transparent in that you don't have to do any special DAMA
+         configuration. Linux cannot yet act as a DAMA server.  This option
+         only compiles DAMA slave support into the kernel.  It still needs to
+         be explicitly enabled, so if unsure, say Y.
 
-#       bool '    AX.25 DAMA Master support' CONFIG_AX25_DAMA_MASTER
 config NETROM
        tristate "Amateur Radio NET/ROM protocol"
        depends on AX25
-       ---help---
+       help
          NET/ROM is a network layer protocol on top of AX.25 useful for
          routing.
 
          A comprehensive listing of all the software for Linux amateur radio
          users as well as information about how to configure an AX.25 port is
-         contained in the AX25-HOWTO, available from
-         <http://www.tldp.org/docs.html#howto>. You also might want to
-         check out the file <file:Documentation/networking/ax25.txt>. More
-         information about digital amateur radio in general is on the WWW at
+         contained in the Linux Ham Wiki, available from
+         <http://www.linux-ax25.org>. You also might want to check out the
+         file <file:Documentation/networking/ax25.txt>. More information about
+         digital amateur radio in general is on the WWW at
          <http://www.tapr.org/tapr/html/pkthome.html>.
 
          To compile this driver as a module, choose M here: the
@@ -84,27 +97,25 @@ config NETROM
 config ROSE
        tristate "Amateur Radio X.25 PLP (Rose)"
        depends on AX25
-       ---help---
+       help
          The Packet Layer Protocol (PLP) is a way to route packets over X.25
          connections in general and amateur radio AX.25 connections in
          particular, essentially an alternative to NET/ROM.
 
          A comprehensive listing of all the software for Linux amateur radio
          users as well as information about how to configure an AX.25 port is
-         contained in the AX25-HOWTO, available from
-         <http://www.tldp.org/docs.html#howto>.  You also might want to
-         check out the file <file:Documentation/networking/ax25.txt>. More
-         information about digital amateur radio in general is on the WWW at
+         contained in the Linux Ham Wiki, available from
+         <http://www.linux-ax25.org>.  You also might want to check out the
+         file <file:Documentation/networking/ax25.txt>. More information about
+         digital amateur radio in general is on the WWW at
          <http://www.tapr.org/tapr/html/pkthome.html>.
 
          To compile this driver as a module, choose M here: the
          module will be called rose.
 
-
 menu "AX.25 network device drivers"
-       depends on HAMRADIO && NET && AX25!=n
+       depends on HAMRADIO && AX25
 
 source "drivers/net/hamradio/Kconfig"
 
 endmenu
-
index 4c914df..d342e89 100644 (file)
@@ -319,7 +319,7 @@ static int __hidp_send_ctrl_message(struct hidp_session *session,
        return 0;
 }
 
-static int inline hidp_send_ctrl_message(struct hidp_session *session,
+static inline int hidp_send_ctrl_message(struct hidp_session *session,
                        unsigned char hdr, unsigned char *data, int size)
 {
        int err;
@@ -679,6 +679,27 @@ static void hidp_close(struct hid_device *hid)
 {
 }
 
+static const struct {
+       __u16 idVendor;
+       __u16 idProduct;
+       unsigned quirks;
+} hidp_blacklist[] = {
+       /* Apple wireless Mighty Mouse */
+       { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL },
+
+       { }     /* Terminating entry */
+};
+
+static void hidp_setup_quirks(struct hid_device *hid)
+{
+       unsigned int n;
+
+       for (n = 0; hidp_blacklist[n].idVendor; n++)
+               if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) &&
+                               hidp_blacklist[n].idProduct == le16_to_cpu(hid->product))
+                       hid->quirks = hidp_blacklist[n].quirks;
+}
+
 static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_connadd_req *req)
 {
        struct hid_device *hid = session->hid;
@@ -708,6 +729,8 @@ static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_conn
 
        hid->hidinput_input_event = hidp_hidinput_event;
 
+       hidp_setup_quirks(hid);
+
        list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list)
                hidp_send_report(session, report);
 
index def2e40..8d566c1 100644 (file)
@@ -197,8 +197,8 @@ struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
 
        rcu_read_lock();
        fdb = __br_fdb_get(br, addr);
-       if (fdb)
-               atomic_inc(&fdb->use_count);
+       if (fdb && !atomic_inc_not_zero(&fdb->use_count))
+               fdb = NULL;
        rcu_read_unlock();
        return fdb;
 }
index 7712d76..5439a3c 100644 (file)
@@ -61,7 +61,7 @@ static int brnf_filter_vlan_tagged __read_mostly = 1;
 #define brnf_filter_vlan_tagged 1
 #endif
 
-static __be16 inline vlan_proto(const struct sk_buff *skb)
+static inline __be16 vlan_proto(const struct sk_buff *skb)
 {
        return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
 }
index cf71614..4dc93cc 100644 (file)
@@ -751,13 +751,10 @@ int dev_change_name(struct net_device *dev, char *newname)
        else
                strlcpy(dev->name, newname, IFNAMSIZ);
 
-       err = device_rename(&dev->dev, dev->name);
-       if (!err) {
-               hlist_del(&dev->name_hlist);
-               hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
-               raw_notifier_call_chain(&netdev_chain,
-                               NETDEV_CHANGENAME, dev);
-       }
+       device_rename(&dev->dev, dev->name);
+       hlist_del(&dev->name_hlist);
+       hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
+       raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
 
        return err;
 }
@@ -1741,8 +1738,8 @@ static int ing_filter(struct sk_buff *skb)
        if (dev->qdisc_ingress) {
                __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd);
                if (MAX_RED_LOOP < ttl++) {
-                       printk(KERN_WARNING "Redir loop detected Dropping packet (%s->%s)\n",
-                               skb->input_dev->name, skb->dev->name);
+                       printk(KERN_WARNING "Redir loop detected Dropping packet (%d->%d)\n",
+                               skb->iif, skb->dev->ifindex);
                        return TC_ACT_SHOT;
                }
 
@@ -1750,10 +1747,10 @@ static int ing_filter(struct sk_buff *skb)
 
                skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS);
 
-               spin_lock(&dev->ingress_lock);
+               spin_lock(&dev->queue_lock);
                if ((q = dev->qdisc_ingress) != NULL)
                        result = q->enqueue(skb, q);
-               spin_unlock(&dev->ingress_lock);
+               spin_unlock(&dev->queue_lock);
 
        }
 
@@ -1775,8 +1772,8 @@ int netif_receive_skb(struct sk_buff *skb)
        if (!skb->tstamp.off_sec)
                net_timestamp(skb);
 
-       if (!skb->input_dev)
-               skb->input_dev = skb->dev;
+       if (!skb->iif)
+               skb->iif = skb->dev->ifindex;
 
        orig_dev = skb_bond(skb);
 
index 215f1bf..7174ced 100644 (file)
@@ -143,7 +143,7 @@ int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
                }
        }
 
-       err = -ENETUNREACH;
+       err = -ESRCH;
 out:
        rcu_read_unlock();
 
@@ -152,6 +152,28 @@ out:
 
 EXPORT_SYMBOL_GPL(fib_rules_lookup);
 
+static int validate_rulemsg(struct fib_rule_hdr *frh, struct nlattr **tb,
+                           struct fib_rules_ops *ops)
+{
+       int err = -EINVAL;
+
+       if (frh->src_len)
+               if (tb[FRA_SRC] == NULL ||
+                   frh->src_len > (ops->addr_size * 8) ||
+                   nla_len(tb[FRA_SRC]) != ops->addr_size)
+                       goto errout;
+
+       if (frh->dst_len)
+               if (tb[FRA_DST] == NULL ||
+                   frh->dst_len > (ops->addr_size * 8) ||
+                   nla_len(tb[FRA_DST]) != ops->addr_size)
+                       goto errout;
+
+       err = 0;
+errout:
+       return err;
+}
+
 int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
 {
        struct fib_rule_hdr *frh = nlmsg_data(nlh);
@@ -173,6 +195,10 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
        if (err < 0)
                goto errout;
 
+       err = validate_rulemsg(frh, tb, ops);
+       if (err < 0)
+               goto errout;
+
        rule = kzalloc(ops->rule_size, GFP_KERNEL);
        if (rule == NULL) {
                err = -ENOMEM;
@@ -260,6 +286,10 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
        if (err < 0)
                goto errout;
 
+       err = validate_rulemsg(frh, tb, ops);
+       if (err < 0)
+               goto errout;
+
        list_for_each_entry(rule, ops->rules_list, list) {
                if (frh->action && (frh->action != rule->action))
                        continue;
@@ -374,7 +404,7 @@ int fib_rules_dump(struct sk_buff *skb, struct netlink_callback *cb, int family)
                return -EAFNOSUPPORT;
 
        rcu_read_lock();
-       list_for_each_entry(rule, ops->rules_list, list) {
+       list_for_each_entry_rcu(rule, ops->rules_list, list) {
                if (idx < cb->args[0])
                        goto skip;
 
index 3183142..cfc6001 100644 (file)
@@ -140,6 +140,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
                                n->dead = 1;
                                shrunk  = 1;
                                write_unlock(&n->lock);
+                               if (n->parms->neigh_cleanup)
+                                       n->parms->neigh_cleanup(n);
                                neigh_release(n);
                                continue;
                        }
@@ -211,6 +213,8 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
                                NEIGH_PRINTK2("neigh %p is stray.\n", n);
                        }
                        write_unlock(&n->lock);
+                       if (n->parms->neigh_cleanup)
+                               n->parms->neigh_cleanup(n);
                        neigh_release(n);
                }
        }
@@ -582,9 +586,6 @@ void neigh_destroy(struct neighbour *neigh)
                        kfree(hh);
        }
 
-       if (neigh->parms->neigh_destructor)
-               (neigh->parms->neigh_destructor)(neigh);
-
        skb_queue_purge(&neigh->arp_queue);
 
        dev_put(neigh->dev);
@@ -675,6 +676,8 @@ static void neigh_periodic_timer(unsigned long arg)
                        *np = n->next;
                        n->dead = 1;
                        write_unlock(&n->lock);
+                       if (n->parms->neigh_cleanup)
+                               n->parms->neigh_cleanup(n);
                        neigh_release(n);
                        continue;
                }
@@ -2088,8 +2091,11 @@ void __neigh_for_each_release(struct neigh_table *tbl,
                        } else
                                np = &n->next;
                        write_unlock(&n->lock);
-                       if (release)
+                       if (release) {
+                               if (n->parms->neigh_cleanup)
+                                       n->parms->neigh_cleanup(n);
                                neigh_release(n);
+                       }
                }
        }
 }
index 6055074..33ea8ea 100644 (file)
@@ -621,7 +621,8 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
                if (err < 0)
                        goto errout;
 
-               iw += IW_EV_POINT_OFF;
+               /* Payload is at an offset in buffer */
+               iw = iw_buf + IW_EV_POINT_OFF;
        }
 #endif /* CONFIG_NET_WIRELESS_RTNETLINK */
 
index 702fa8f..87573ae 100644 (file)
@@ -496,7 +496,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
        n->tc_verd = SET_TC_VERD(skb->tc_verd,0);
        n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
        n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
-       C(input_dev);
+       C(iif);
 #endif
        skb_copy_secmark(n, skb);
 #endif
index 8d65d64..27c4f62 100644 (file)
@@ -808,7 +808,7 @@ lenout:
  *
  * (We also register the sk_lock with the lock validator.)
  */
-static void inline sock_lock_init(struct sock *sk)
+static inline void sock_lock_init(struct sock *sk)
 {
        sock_lock_init_class_and_name(sk,
                        af_family_slock_key_strings[sk->sk_family],
index 9936ab1..b07fe27 100644 (file)
@@ -2,7 +2,7 @@
  * This file implement the Wireless Extensions APIs.
  *
  * Authors :   Jean Tourrilhes - HPL - <jt@hpl.hp.com>
- * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved.
+ * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
  *
  * (As all part of the Linux kernel, this file is GPL)
  */
@@ -76,6 +76,9 @@
  *     o Change length in ESSID and NICK to strlen() instead of strlen()+1
  *     o Make standard_ioctl_num and standard_event_num unsigned
  *     o Remove (struct net_device *)->get_wireless_stats()
+ *
+ * v10 - 16.3.07 - Jean II
+ *     o Prevent leaking of kernel space in stream on 64 bits.
  */
 
 /***************************** INCLUDES *****************************/
@@ -427,6 +430,21 @@ static const int event_type_size[] = {
        IW_EV_QUAL_LEN,                 /* IW_HEADER_TYPE_QUAL */
 };
 
+/* Size (in bytes) of various events, as packed */
+static const int event_type_pk_size[] = {
+       IW_EV_LCP_PK_LEN,               /* IW_HEADER_TYPE_NULL */
+       0,
+       IW_EV_CHAR_PK_LEN,              /* IW_HEADER_TYPE_CHAR */
+       0,
+       IW_EV_UINT_PK_LEN,              /* IW_HEADER_TYPE_UINT */
+       IW_EV_FREQ_PK_LEN,              /* IW_HEADER_TYPE_FREQ */
+       IW_EV_ADDR_PK_LEN,              /* IW_HEADER_TYPE_ADDR */
+       0,
+       IW_EV_POINT_PK_LEN,             /* Without variable payload */
+       IW_EV_PARAM_PK_LEN,             /* IW_HEADER_TYPE_PARAM */
+       IW_EV_QUAL_PK_LEN,              /* IW_HEADER_TYPE_QUAL */
+};
+
 /************************ COMMON SUBROUTINES ************************/
 /*
  * Stuff that may be used in various place or doesn't fit in one
@@ -1217,7 +1235,7 @@ static int rtnetlink_standard_get(struct net_device *     dev,
                memcpy(buffer + IW_EV_POINT_OFF, request, request_len);
                /* Use our own copy of wrqu */
                wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF
-                                            + IW_EV_LCP_LEN);
+                                            + IW_EV_LCP_PK_LEN);
 
                /* No extra arguments. Trivial to handle */
                ret = handler(dev, &info, wrqu, NULL);
@@ -1229,8 +1247,8 @@ static int rtnetlink_standard_get(struct net_device *     dev,
 
                /* Get a temp copy of wrqu (skip pointer) */
                memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
-                      ((char *) request) + IW_EV_LCP_LEN,
-                      IW_EV_POINT_LEN - IW_EV_LCP_LEN);
+                      ((char *) request) + IW_EV_LCP_PK_LEN,
+                      IW_EV_POINT_LEN - IW_EV_LCP_PK_LEN);
 
                /* Calculate space needed by arguments. Always allocate
                 * for max space. Easier, and won't last long... */
@@ -1240,7 +1258,7 @@ static int rtnetlink_standard_get(struct net_device *     dev,
                   (wrqu_point.data.length > descr->max_tokens))
                        extra_size = (wrqu_point.data.length
                                      * descr->token_size);
-               buffer_size = extra_size + IW_EV_POINT_LEN + IW_EV_POINT_OFF;
+               buffer_size = extra_size + IW_EV_POINT_PK_LEN + IW_EV_POINT_OFF;
 #ifdef WE_RTNETLINK_DEBUG
                printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n",
                       dev->name, extra_size, buffer_size);
@@ -1254,15 +1272,15 @@ static int rtnetlink_standard_get(struct net_device *   dev,
 
                /* Put wrqu in the right place (just before extra).
                 * Leave space for IWE header and dummy pointer...
-                * Note that IW_EV_LCP_LEN==4 bytes, so it's still aligned...
+                * Note that IW_EV_LCP_PK_LEN==4 bytes, so it's still aligned.
                 */
-               memcpy(buffer + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
+               memcpy(buffer + IW_EV_LCP_PK_LEN + IW_EV_POINT_OFF,
                       ((char *) &wrqu_point) + IW_EV_POINT_OFF,
-                      IW_EV_POINT_LEN - IW_EV_LCP_LEN);
-               wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_LEN);
+                      IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
+               wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_PK_LEN);
 
                /* Extra comes logically after that. Offset +12 bytes. */
-               extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_LEN;
+               extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_PK_LEN;
 
                /* Call the handler */
                ret = handler(dev, &info, wrqu, extra);
@@ -1270,11 +1288,11 @@ static int rtnetlink_standard_get(struct net_device *   dev,
                /* Calculate real returned length */
                extra_size = (wrqu->data.length * descr->token_size);
                /* Re-adjust reply size */
-               request->len = extra_size + IW_EV_POINT_LEN;
+               request->len = extra_size + IW_EV_POINT_PK_LEN;
 
                /* Put the iwe header where it should, i.e. scrap the
                 * dummy pointer. */
-               memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_LEN);
+               memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_PK_LEN);
 
 #ifdef WE_RTNETLINK_DEBUG
                printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size);
@@ -1331,10 +1349,10 @@ static inline int rtnetlink_standard_set(struct net_device *    dev,
 #endif /* WE_RTNETLINK_DEBUG */
 
        /* Extract fixed header from request. This is properly aligned. */
-       wrqu = &request->u;
+       wrqu = (union iwreq_data *) (((char *) request) + IW_EV_LCP_PK_LEN);
 
        /* Check if wrqu is complete */
-       hdr_len = event_type_size[descr->header_type];
+       hdr_len = event_type_pk_size[descr->header_type];
        if(request_len < hdr_len) {
 #ifdef WE_RTNETLINK_DEBUG
                printk(KERN_DEBUG
@@ -1359,7 +1377,7 @@ static inline int rtnetlink_standard_set(struct net_device *      dev,
 
                /* Put wrqu in the right place (skip pointer) */
                memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
-                      wrqu, IW_EV_POINT_LEN - IW_EV_LCP_LEN);
+                      wrqu, IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
                /* Don't forget about the event code... */
                wrqu = &wrqu_point;
 
@@ -1483,7 +1501,7 @@ static inline int rtnetlink_private_get(struct net_device *       dev,
                hdr_len = extra_size;
                extra_size = 0;
        } else {
-               hdr_len = IW_EV_POINT_LEN;
+               hdr_len = IW_EV_POINT_PK_LEN;
        }
 
        /* Check if wrqu is complete */
@@ -1514,7 +1532,7 @@ static inline int rtnetlink_private_get(struct net_device *       dev,
                memcpy(buffer + IW_EV_POINT_OFF, request, request_len);
                /* Use our own copy of wrqu */
                wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF
-                                            + IW_EV_LCP_LEN);
+                                            + IW_EV_LCP_PK_LEN);
 
                /* No extra arguments. Trivial to handle */
                ret = handler(dev, &info, wrqu, (char *) wrqu);
@@ -1523,7 +1541,7 @@ static inline int rtnetlink_private_get(struct net_device *       dev,
                char *  extra;
 
                /* Buffer for full reply */
-               buffer_size = extra_size + IW_EV_POINT_LEN + IW_EV_POINT_OFF;
+               buffer_size = extra_size + IW_EV_POINT_PK_LEN + IW_EV_POINT_OFF;
 
 #ifdef WE_RTNETLINK_DEBUG
                printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n",
@@ -1538,15 +1556,15 @@ static inline int rtnetlink_private_get(struct net_device *     dev,
 
                /* Put wrqu in the right place (just before extra).
                 * Leave space for IWE header and dummy pointer...
-                * Note that IW_EV_LCP_LEN==4 bytes, so it's still aligned...
+                * Note that IW_EV_LCP_PK_LEN==4 bytes, so it's still aligned.
                 */
-               memcpy(buffer + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
-                      ((char *) request) + IW_EV_LCP_LEN,
-                      IW_EV_POINT_LEN - IW_EV_LCP_LEN);
-               wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_LEN);
+               memcpy(buffer + IW_EV_LCP_PK_LEN + IW_EV_POINT_OFF,
+                      ((char *) request) + IW_EV_LCP_PK_LEN,
+                      IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
+               wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_PK_LEN);
 
                /* Extra comes logically after that. Offset +12 bytes. */
-               extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_LEN;
+               extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_PK_LEN;
 
                /* Call the handler */
                ret = handler(dev, &info, wrqu, extra);
@@ -1556,11 +1574,11 @@ static inline int rtnetlink_private_get(struct net_device *     dev,
                if (!(descr->get_args & IW_PRIV_SIZE_FIXED))
                        extra_size = adjust_priv_size(descr->get_args, wrqu);
                /* Re-adjust reply size */
-               request->len = extra_size + IW_EV_POINT_LEN;
+               request->len = extra_size + IW_EV_POINT_PK_LEN;
 
                /* Put the iwe header where it should, i.e. scrap the
                 * dummy pointer. */
-               memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_LEN);
+               memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_PK_LEN);
 
 #ifdef WE_RTNETLINK_DEBUG
                printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size);
@@ -1641,14 +1659,14 @@ static inline int rtnetlink_private_set(struct net_device *     dev,
        /* Does it fits in wrqu ? */
        if((descr->set_args & IW_PRIV_SIZE_FIXED) &&
           (extra_size <= IFNAMSIZ)) {
-               hdr_len = IW_EV_LCP_LEN + extra_size;
+               hdr_len = IW_EV_LCP_PK_LEN + extra_size;
                extra_size = 0;
        } else {
-               hdr_len = IW_EV_POINT_LEN;
+               hdr_len = IW_EV_POINT_PK_LEN;
        }
 
        /* Extract fixed header from request. This is properly aligned. */
-       wrqu = &request->u;
+       wrqu = (union iwreq_data *) (((char *) request) + IW_EV_LCP_PK_LEN);
 
        /* Check if wrqu is complete */
        if(request_len < hdr_len) {
@@ -1675,7 +1693,7 @@ static inline int rtnetlink_private_set(struct net_device *       dev,
 
                /* Put wrqu in the right place (skip pointer) */
                memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
-                      wrqu, IW_EV_POINT_LEN - IW_EV_LCP_LEN);
+                      wrqu, IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
 
                /* Does it fits within bounds ? */
                if(wrqu_point.data.length > (descr->set_args &
@@ -1738,7 +1756,7 @@ int wireless_rtnetlink_get(struct net_device *    dev,
        iw_handler              handler;
 
        /* Check length */
-       if(len < IW_EV_LCP_LEN) {
+       if(len < IW_EV_LCP_PK_LEN) {
                printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n",
                       dev->name, len);
                return -EINVAL;
@@ -1822,7 +1840,7 @@ int wireless_rtnetlink_set(struct net_device *    dev,
        iw_handler              handler;
 
        /* Check length */
-       if(len < IW_EV_LCP_LEN) {
+       if(len < IW_EV_LCP_PK_LEN) {
                printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n",
                       dev->name, len);
                return -EINVAL;
index a0e7cd1..e33a9ed 100644 (file)
@@ -191,7 +191,6 @@ extern void dccp_send_sync(struct sock *sk, const u64 seq,
                           const enum dccp_pkt_type pkt_type);
 
 extern void dccp_write_xmit(struct sock *sk, int block);
-extern void dccp_write_xmit_timer(unsigned long data);
 extern void dccp_write_space(struct sock *sk);
 
 extern void dccp_init_xmit_timers(struct sock *sk);
index cf28c53..6607b7b 100644 (file)
@@ -575,7 +575,7 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
        if (get_user(len, optlen))
                return -EFAULT;
 
-       if (len < sizeof(int))
+       if (len < (int)sizeof(int))
                return -EINVAL;
 
        dp = dccp_sk(sk);
@@ -589,9 +589,11 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
                                               (__be32 __user *)optval, optlen);
        case DCCP_SOCKOPT_SEND_CSCOV:
                val = dp->dccps_pcslen;
+               len = sizeof(val);
                break;
        case DCCP_SOCKOPT_RECV_CSCOV:
                val = dp->dccps_pcrlen;
+               len = sizeof(val);
                break;
        case 128 ... 191:
                return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname,
index b038a0a..0197a41 100644 (file)
@@ -262,7 +262,7 @@ out:
 }
 
 /* Transmit-delay timer: used by the CCIDs to delay actual send time */
-void dccp_write_xmit_timer(unsigned long data)
+static void dccp_write_xmit_timer(unsigned long data)
 {
        struct sock *sk = (struct sock *)data;
        struct dccp_sock *dp = dccp_sk(sk);
index 3cbfddc..82d58a9 100644 (file)
@@ -63,7 +63,7 @@ static struct
 {
        int error;
        u8 scope;
-} dn_fib_props[RTA_MAX+1] = {
+} dn_fib_props[RTN_MAX+1] = {
        [RTN_UNSPEC] =      { .error = 0,       .scope = RT_SCOPE_NOWHERE },
        [RTN_UNICAST] =     { .error = 0,       .scope = RT_SCOPE_UNIVERSE },
        [RTN_LOCAL] =       { .error = 0,       .scope = RT_SCOPE_HOST },
@@ -276,6 +276,9 @@ struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, struct dn_kern_rta
        struct dn_fib_info *ofi;
        int nhs = 1;
 
+       if (r->rtm_type > RTN_MAX)
+               goto err_inval;
+
        if (dn_fib_props[r->rtm_type].scope > r->rtm_scope)
                goto err_inval;
 
index b6c98ac..5e86dd5 100644 (file)
@@ -109,8 +109,6 @@ errout:
 
 static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
        FRA_GENERIC_POLICY,
-       [FRA_SRC]       = { .type = NLA_U16 },
-       [FRA_DST]       = { .type = NLA_U16 },
 };
 
 static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
@@ -133,7 +131,7 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
        int err = -EINVAL;
        struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
 
-       if (frh->src_len > 16 || frh->dst_len > 16 || frh->tos)
+       if (frh->tos)
                goto  errout;
 
        if (rule->table == RT_TABLE_UNSPEC) {
@@ -150,10 +148,10 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
                }
        }
 
-       if (tb[FRA_SRC])
+       if (frh->src_len)
                r->src = nla_get_le16(tb[FRA_SRC]);
 
-       if (tb[FRA_DST])
+       if (frh->dst_len)
                r->dst = nla_get_le16(tb[FRA_DST]);
 
        r->src_len = frh->src_len;
@@ -176,10 +174,10 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
        if (frh->dst_len && (r->dst_len != frh->dst_len))
                return 0;
 
-       if (tb[FRA_SRC] && (r->src != nla_get_le16(tb[FRA_SRC])))
+       if (frh->src_len && (r->src != nla_get_le16(tb[FRA_SRC])))
                return 0;
 
-       if (tb[FRA_DST] && (r->dst != nla_get_le16(tb[FRA_DST])))
+       if (frh->dst_len && (r->dst != nla_get_le16(tb[FRA_DST])))
                return 0;
 
        return 1;
@@ -249,6 +247,7 @@ int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb)
 static struct fib_rules_ops dn_fib_rules_ops = {
        .family         = AF_DECnet,
        .rule_size      = sizeof(struct dn_fib_rule),
+       .addr_size      = sizeof(u16),
        .action         = dn_fib_rule_action,
        .match          = dn_fib_rule_match,
        .configure      = dn_fib_rule_configure,
index a64be6c..6ef766e 100644 (file)
@@ -38,7 +38,7 @@ config IEEE80211_CRYPT_WEP
        Include software based cipher suites in support of IEEE
        802.11's WEP.  This is needed for WEP as well as 802.1x.
 
-       This can be compiled as a modules and it will be called
+       This can be compiled as a module and it will be called
        "ieee80211_crypt_wep".
 
 config IEEE80211_CRYPT_CCMP
@@ -51,7 +51,7 @@ config IEEE80211_CRYPT_CCMP
        (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with CCMP enabled
        networks.
 
-       This can be compiled as a modules and it will be called
+       This can be compiled as a module and it will be called
        "ieee80211_crypt_ccmp".
 
 config IEEE80211_CRYPT_TKIP
@@ -66,7 +66,7 @@ config IEEE80211_CRYPT_TKIP
        (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with TKIP enabled
        networks.
 
-       This can be compiled as a modules and it will be called
+       This can be compiled as a module and it will be called
        "ieee80211_crypt_tkip".
 
 source "net/ieee80211/softmac/Kconfig"
index 1fba643..fc920f6 100644 (file)
@@ -493,6 +493,11 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh,
        cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid;
        cfg->fc_nlinfo.nlh = nlh;
 
+       if (cfg->fc_type > RTN_MAX) {
+               err = -EINVAL;
+               goto errout;
+       }
+
        nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) {
                switch (attr->nla_type) {
                case RTA_DST:
index b837c33..c660c07 100644 (file)
@@ -171,8 +171,6 @@ static struct fib_table *fib_empty_table(void)
 
 static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = {
        FRA_GENERIC_POLICY,
-       [FRA_SRC]       = { .type = NLA_U32 },
-       [FRA_DST]       = { .type = NLA_U32 },
        [FRA_FLOW]      = { .type = NLA_U32 },
 };
 
@@ -183,8 +181,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
        int err = -EINVAL;
        struct fib4_rule *rule4 = (struct fib4_rule *) rule;
 
-       if (frh->src_len > 32 || frh->dst_len > 32 ||
-           (frh->tos & ~IPTOS_TOS_MASK))
+       if (frh->tos & ~IPTOS_TOS_MASK)
                goto errout;
 
        if (rule->table == RT_TABLE_UNSPEC) {
@@ -201,10 +198,10 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
                }
        }
 
-       if (tb[FRA_SRC])
+       if (frh->src_len)
                rule4->src = nla_get_be32(tb[FRA_SRC]);
 
-       if (tb[FRA_DST])
+       if (frh->dst_len)
                rule4->dst = nla_get_be32(tb[FRA_DST]);
 
 #ifdef CONFIG_NET_CLS_ROUTE
@@ -242,10 +239,10 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
                return 0;
 #endif
 
-       if (tb[FRA_SRC] && (rule4->src != nla_get_be32(tb[FRA_SRC])))
+       if (frh->src_len && (rule4->src != nla_get_be32(tb[FRA_SRC])))
                return 0;
 
-       if (tb[FRA_DST] && (rule4->dst != nla_get_be32(tb[FRA_DST])))
+       if (frh->dst_len && (rule4->dst != nla_get_be32(tb[FRA_DST])))
                return 0;
 
        return 1;
@@ -309,6 +306,7 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule)
 static struct fib_rules_ops fib4_rules_ops = {
        .family         = AF_INET,
        .rule_size      = sizeof(struct fib4_rule),
+       .addr_size      = sizeof(u32),
        .action         = fib4_rule_action,
        .match          = fib4_rule_match,
        .configure      = fib4_rule_configure,
index 2f1fdae..3dad12e 100644 (file)
@@ -89,7 +89,7 @@ static const struct
 {
        int     error;
        u8      scope;
-} fib_props[RTA_MAX + 1] = {
+} fib_props[RTN_MAX + 1] = {
        {
                .error  = 0,
                .scope  = RT_SCOPE_NOWHERE,
index ada9b3d..214c347 100644 (file)
@@ -1123,6 +1123,9 @@ err:
        return fa_head;
 }
 
+/*
+ * Caller must hold RTNL.
+ */
 static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
 {
        struct trie *t = (struct trie *) tb->tb_data;
@@ -1540,6 +1543,9 @@ static int trie_leaf_remove(struct trie *t, t_key key)
        return 1;
 }
 
+/*
+ * Caller must hold RTNL.
+ */
 static int fn_trie_delete(struct fib_table *tb, struct fib_config *cfg)
 {
        struct trie *t = (struct trie *) tb->tb_data;
@@ -1718,6 +1724,9 @@ up:
        return NULL; /* Ready. Root of trie */
 }
 
+/*
+ * Caller must hold RTNL.
+ */
 static int fn_trie_flush(struct fib_table *tb)
 {
        struct trie *t = (struct trie *) tb->tb_data;
index adf25f9..6bcfdf6 100644 (file)
@@ -253,14 +253,17 @@ ip_nat_local_fn(unsigned int hooknum,
                enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
 
                if (ct->tuplehash[dir].tuple.dst.ip !=
-                   ct->tuplehash[!dir].tuple.src.ip
-#ifdef CONFIG_XFRM
-                   || ct->tuplehash[dir].tuple.dst.u.all !=
-                      ct->tuplehash[!dir].tuple.src.u.all
-#endif
-                   )
+                   ct->tuplehash[!dir].tuple.src.ip) {
                        if (ip_route_me_harder(pskb, RTN_UNSPEC))
                                ret = NF_DROP;
+               }
+#ifdef CONFIG_XFRM
+               else if (ct->tuplehash[dir].tuple.dst.u.all !=
+                        ct->tuplehash[!dir].tuple.src.u.all)
+                       if (ip_xfrm_me_harder(pskb))
+                               ret = NF_DROP;
+#endif
+
        }
        return ret;
 }
index e4d3ef1..15aa3db 100644 (file)
@@ -245,14 +245,16 @@ nf_nat_local_fn(unsigned int hooknum,
                enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
 
                if (ct->tuplehash[dir].tuple.dst.u3.ip !=
-                   ct->tuplehash[!dir].tuple.src.u3.ip
-#ifdef CONFIG_XFRM
-                   || ct->tuplehash[dir].tuple.dst.u.all !=
-                      ct->tuplehash[!dir].tuple.src.u.all
-#endif
-                   )
+                   ct->tuplehash[!dir].tuple.src.u3.ip) {
                        if (ip_route_me_harder(pskb, RTN_UNSPEC))
                                ret = NF_DROP;
+               }
+#ifdef CONFIG_XFRM
+               else if (ct->tuplehash[dir].tuple.dst.u.all !=
+                        ct->tuplehash[!dir].tuple.src.u.all)
+                       if (ip_xfrm_me_harder(pskb))
+                               ret = NF_DROP;
+#endif
        }
        return ret;
 }
index dc15113..688b955 100644 (file)
@@ -1607,6 +1607,9 @@ u32 __tcp_select_window(struct sock *sk)
                 */
                if (window <= free_space - mss || window > free_space)
                        window = (free_space/mss)*mss;
+               else if (mss == full_space &&
+                        free_space > window + full_space/2)
+                       window = free_space;
        }
 
        return window;
index 89cf59e..f68dfd8 100644 (file)
@@ -42,10 +42,9 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
 
        skb->nh.raw = skb_push(skb, x->props.header_len + hdrlen);
        top_iph = skb->nh.iph;
-       hdrlen = iph->ihl * 4 - optlen;
-       skb->h.raw += hdrlen;
+       skb->h.raw += sizeof(*iph) - hdrlen;
 
-       memmove(top_iph, iph, hdrlen);
+       memmove(top_iph, iph, sizeof(*iph));
        if (unlikely(optlen)) {
                struct ip_beet_phdr *ph;
 
@@ -55,6 +54,8 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
                ph->padlen = 4 - (optlen & 4);
                ph->hdrlen = (optlen + ph->padlen + sizeof(*ph)) / 8;
                ph->nexthdr = top_iph->protocol;
+               if (ph->padlen)
+                       memset(ph + 1, IPOPT_NOP, ph->padlen);
 
                top_iph->protocol = IPPROTO_BEETPH;
                top_iph->ihl = sizeof(struct iphdr) / 4;
@@ -77,29 +78,32 @@ static int xfrm4_beet_input(struct xfrm_state *x, struct sk_buff *skb)
        protocol = iph->protocol;
 
        if (unlikely(iph->protocol == IPPROTO_BEETPH)) {
-               struct ip_beet_phdr *ph = (struct ip_beet_phdr*)(iph + 1);
+               struct ip_beet_phdr *ph;
 
                if (!pskb_may_pull(skb, sizeof(*ph)))
                        goto out;
+               ph = (struct ip_beet_phdr *)(skb->h.ipiph + 1);
 
-               phlen = ph->hdrlen * 8;
-               optlen = phlen - ph->padlen - sizeof(*ph);
+               phlen = sizeof(*ph) + ph->padlen;
+               optlen = ph->hdrlen * 8 - phlen;
                if (optlen < 0 || optlen & 3 || optlen > 250)
                        goto out;
 
-               if (!pskb_may_pull(skb, phlen))
+               if (!pskb_may_pull(skb, phlen + optlen))
                        goto out;
+               skb->len -= phlen + optlen;
 
                ph_nexthdr = ph->nexthdr;
        }
 
-       skb_push(skb, sizeof(*iph) - phlen + optlen);
-       memmove(skb->data, skb->nh.raw, sizeof(*iph));
-       skb->nh.raw = skb->data;
+       skb->nh.raw = skb->data + (phlen - sizeof(*iph));
+       memmove(skb->nh.raw, iph, sizeof(*iph));
+       skb->h.raw = skb->data + (phlen + optlen);
+       skb->data = skb->h.raw;
 
        iph = skb->nh.iph;
        iph->ihl = (sizeof(*iph) + optlen) / 4;
-       iph->tot_len = htons(skb->len);
+       iph->tot_len = htons(skb->len + iph->ihl * 4);
        iph->daddr = x->sel.daddr.a4;
        iph->saddr = x->sel.saddr.a4;
        if (ph_nexthdr)
index a7fee6b..7552663 100644 (file)
@@ -342,6 +342,9 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
        }
 #endif
 
+       if (netif_running(dev) && netif_carrier_ok(dev))
+               ndev->if_flags |= IF_READY;
+
        ipv6_mc_init_dev(ndev);
        ndev->tstamp = jiffies;
 #ifdef CONFIG_SYSCTL
@@ -804,7 +807,7 @@ struct ipv6_saddr_score {
 #define IPV6_SADDR_SCORE_LABEL         0x0020
 #define IPV6_SADDR_SCORE_PRIVACY       0x0040
 
-static int inline ipv6_saddr_preferred(int type)
+static inline int ipv6_saddr_preferred(int type)
 {
        if (type & (IPV6_ADDR_MAPPED|IPV6_ADDR_COMPATv4|
                    IPV6_ADDR_LOOPBACK|IPV6_ADDR_RESERVED))
@@ -813,7 +816,7 @@ static int inline ipv6_saddr_preferred(int type)
 }
 
 /* static matching label */
-static int inline ipv6_saddr_label(const struct in6_addr *addr, int type)
+static inline int ipv6_saddr_label(const struct in6_addr *addr, int type)
 {
  /*
   *    prefix (longest match)  label
@@ -3318,7 +3321,7 @@ errout:
                rtnl_set_sk_err(RTNLGRP_IPV6_IFADDR, err);
 }
 
-static void inline ipv6_store_devconf(struct ipv6_devconf *cnf,
+static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
                                __s32 *array, int bytes)
 {
        BUG_ON(bytes < (DEVCONF_MAX * 4));
index 0862809..ea3035b 100644 (file)
@@ -131,8 +131,6 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
 
 static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = {
        FRA_GENERIC_POLICY,
-       [FRA_SRC]       = { .len = sizeof(struct in6_addr) },
-       [FRA_DST]       = { .len = sizeof(struct in6_addr) },
 };
 
 static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
@@ -142,9 +140,6 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
        int err = -EINVAL;
        struct fib6_rule *rule6 = (struct fib6_rule *) rule;
 
-       if (frh->src_len > 128 || frh->dst_len > 128)
-               goto errout;
-
        if (rule->action == FR_ACT_TO_TBL) {
                if (rule->table == RT6_TABLE_UNSPEC)
                        goto errout;
@@ -155,11 +150,11 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
                }
        }
 
-       if (tb[FRA_SRC])
+       if (frh->src_len)
                nla_memcpy(&rule6->src.addr, tb[FRA_SRC],
                           sizeof(struct in6_addr));
 
-       if (tb[FRA_DST])
+       if (frh->dst_len)
                nla_memcpy(&rule6->dst.addr, tb[FRA_DST],
                           sizeof(struct in6_addr));
 
@@ -186,11 +181,11 @@ static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
        if (frh->tos && (rule6->tclass != frh->tos))
                return 0;
 
-       if (tb[FRA_SRC] &&
+       if (frh->src_len &&
            nla_memcmp(tb[FRA_SRC], &rule6->src.addr, sizeof(struct in6_addr)))
                return 0;
 
-       if (tb[FRA_DST] &&
+       if (frh->dst_len &&
            nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr)))
                return 0;
 
@@ -240,6 +235,7 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule)
 static struct fib_rules_ops fib6_rules_ops = {
        .family                 = AF_INET6,
        .rule_size              = sizeof(struct fib6_rule),
+       .addr_size              = sizeof(struct in6_addr),
        .action                 = fib6_rule_action,
        .match                  = fib6_rule_match,
        .configure              = fib6_rule_configure,
index f4d7be7..268f476 100644 (file)
@@ -658,6 +658,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
                ins = &iter->u.dst.rt6_next;
        }
 
+       /* Reset round-robin state, if necessary */
+       if (ins == &fn->leaf)
+               fn->rr_ptr = NULL;
+
        /*
         *      insert node
         */
@@ -1109,6 +1113,10 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
        rt6_stats.fib_rt_entries--;
        rt6_stats.fib_discarded_routes++;
 
+       /* Reset round-robin state, if necessary */
+       if (fn->rr_ptr == rt)
+               fn->rr_ptr = NULL;
+
        /* Adjust walkers */
        read_lock(&fib6_walker_lock);
        FOR_WALKERS(w) {
index 11bfc7c..61e7a6c 100644 (file)
@@ -108,8 +108,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
 
        /* pkt_len may be zero if Jumbo payload option is present */
        if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) {
-               if (pkt_len + sizeof(struct ipv6hdr) > skb->len)
-                       goto truncated;
+               if (pkt_len + sizeof(struct ipv6hdr) > skb->len) {
+                       IP6_INC_STATS_BH(idev, IPSTATS_MIB_INTRUNCATEDPKTS);
+                       goto drop;
+               }
                if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) {
                        IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
                        goto drop;
@@ -128,8 +130,6 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
        rcu_read_unlock();
 
        return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish);
-truncated:
-       IP6_INC_STATS_BH(idev, IPSTATS_MIB_INTRUNCATEDPKTS);
 err:
        IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
 drop:
index 306d5d8..203e069 100644 (file)
@@ -687,9 +687,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
        int err;
 
        /* Rough check on arithmetic overflow,
-          better check is made in ip6_build_xmit
+          better check is made in ip6_append_data().
         */
-       if (len < 0)
+       if (len > INT_MAX)
                return -EMSGSIZE;
 
        /* Mirror BSD error message compatibility */
index 0e1f4b2..ad9b285 100644 (file)
@@ -308,27 +308,18 @@ static inline void rt6_probe(struct rt6_info *rt)
 /*
  * Default Router Selection (RFC 2461 6.3.6)
  */
-static int inline rt6_check_dev(struct rt6_info *rt, int oif)
+static inline int rt6_check_dev(struct rt6_info *rt, int oif)
 {
        struct net_device *dev = rt->rt6i_dev;
-       int ret = 0;
-
-       if (!oif)
-               return 2;
-       if (dev->flags & IFF_LOOPBACK) {
-               if (!WARN_ON(rt->rt6i_idev == NULL) &&
-                   rt->rt6i_idev->dev->ifindex == oif)
-                       ret = 1;
-               else
-                       return 0;
-       }
-       if (dev->ifindex == oif)
+       if (!oif || dev->ifindex == oif)
                return 2;
-
-       return ret;
+       if ((dev->flags & IFF_LOOPBACK) &&
+           rt->rt6i_idev && rt->rt6i_idev->dev->ifindex == oif)
+               return 1;
+       return 0;
 }
 
-static int inline rt6_check_neigh(struct rt6_info *rt)
+static inline int rt6_check_neigh(struct rt6_info *rt)
 {
        struct neighbour *neigh = rt->rt6i_nexthop;
        int m = 0;
@@ -363,55 +354,76 @@ static int rt6_score_route(struct rt6_info *rt, int oif,
        return m;
 }
 
-static struct rt6_info *rt6_select(struct rt6_info **head, int oif,
-                                  int strict)
+static struct rt6_info *find_match(struct rt6_info *rt, int oif, int strict,
+                                  int *mpri, struct rt6_info *match)
+{
+       int m;
+
+       if (rt6_check_expired(rt))
+               goto out;
+
+       m = rt6_score_route(rt, oif, strict);
+       if (m < 0)
+               goto out;
+
+       if (m > *mpri) {
+               if (strict & RT6_LOOKUP_F_REACHABLE)
+                       rt6_probe(match);
+               *mpri = m;
+               match = rt;
+       } else if (strict & RT6_LOOKUP_F_REACHABLE) {
+               rt6_probe(rt);
+       }
+
+out:
+       return match;
+}
+
+static struct rt6_info *find_rr_leaf(struct fib6_node *fn,
+                                    struct rt6_info *rr_head,
+                                    u32 metric, int oif, int strict)
 {
-       struct rt6_info *match = NULL, *last = NULL;
-       struct rt6_info *rt, *rt0 = *head;
-       u32 metric;
+       struct rt6_info *rt, *match;
        int mpri = -1;
 
-       RT6_TRACE("%s(head=%p(*head=%p), oif=%d)\n",
-                 __FUNCTION__, head, head ? *head : NULL, oif);
+       match = NULL;
+       for (rt = rr_head; rt && rt->rt6i_metric == metric;
+            rt = rt->u.dst.rt6_next)
+               match = find_match(rt, oif, strict, &mpri, match);
+       for (rt = fn->leaf; rt && rt != rr_head && rt->rt6i_metric == metric;
+            rt = rt->u.dst.rt6_next)
+               match = find_match(rt, oif, strict, &mpri, match);
 
-       for (rt = rt0, metric = rt0->rt6i_metric;
-            rt && rt->rt6i_metric == metric && (!last || rt != rt0);
-            rt = rt->u.dst.rt6_next) {
-               int m;
+       return match;
+}
 
-               if (rt6_check_expired(rt))
-                       continue;
+static struct rt6_info *rt6_select(struct fib6_node *fn, int oif, int strict)
+{
+       struct rt6_info *match, *rt0;
 
-               last = rt;
+       RT6_TRACE("%s(fn->leaf=%p, oif=%d)\n",
+                 __FUNCTION__, fn->leaf, oif);
 
-               m = rt6_score_route(rt, oif, strict);
-               if (m < 0)
-                       continue;
+       rt0 = fn->rr_ptr;
+       if (!rt0)
+               fn->rr_ptr = rt0 = fn->leaf;
 
-               if (m > mpri) {
-                       if (strict & RT6_LOOKUP_F_REACHABLE)
-                               rt6_probe(match);
-                       match = rt;
-                       mpri = m;
-               } else if (strict & RT6_LOOKUP_F_REACHABLE) {
-                       rt6_probe(rt);
-               }
-       }
+       match = find_rr_leaf(fn, rt0, rt0->rt6i_metric, oif, strict);
 
        if (!match &&
-           (strict & RT6_LOOKUP_F_REACHABLE) &&
-           last && last != rt0) {
+           (strict & RT6_LOOKUP_F_REACHABLE)) {
+               struct rt6_info *next = rt0->u.dst.rt6_next;
+
                /* no entries matched; do round-robin */
-               static DEFINE_SPINLOCK(lock);
-               spin_lock(&lock);
-               *head = rt0->u.dst.rt6_next;
-               rt0->u.dst.rt6_next = last->u.dst.rt6_next;
-               last->u.dst.rt6_next = rt0;
-               spin_unlock(&lock);
+               if (!next || next->rt6i_metric != rt0->rt6i_metric)
+                       next = fn->leaf;
+
+               if (next != rt0)
+                       fn->rr_ptr = next;
        }
 
-       RT6_TRACE("%s() => %p, score=%d\n",
-                 __FUNCTION__, match, mpri);
+       RT6_TRACE("%s() => %p\n",
+                 __FUNCTION__, match);
 
        return (match ? match : &ip6_null_entry);
 }
@@ -657,7 +669,7 @@ restart_2:
        fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
 
 restart:
-       rt = rt6_select(&fn->leaf, fl->iif, strict | reachable);
+       rt = rt6_select(fn, fl->iif, strict | reachable);
        BACKTRACK(&fl->fl6_src);
        if (rt == &ip6_null_entry ||
            rt->rt6i_flags & RTF_CACHE)
@@ -752,7 +764,7 @@ restart_2:
        fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
 
 restart:
-       rt = rt6_select(&fn->leaf, fl->oif, strict | reachable);
+       rt = rt6_select(fn, fl->oif, strict | reachable);
        BACKTRACK(&fl->fl6_src);
        if (rt == &ip6_null_entry ||
            rt->rt6i_flags & RTF_CACHE)
index 0ad4719..f590db5 100644 (file)
@@ -615,7 +615,7 @@ do_udp_sendmsg:
                return udp_sendmsg(iocb, sk, msg, len);
 
        /* Rough check on arithmetic overflow,
-          better check is made in ip6_build_xmit
+          better check is made in ip6_append_data().
           */
        if (len > INT_MAX - sizeof(struct udphdr))
                return -EMSGSIZE;
index ee4b84a..93c4223 100644 (file)
@@ -58,7 +58,7 @@ static struct kmem_cache *xfrm6_tunnel_spi_kmem __read_mostly;
 static struct hlist_head xfrm6_tunnel_spi_byaddr[XFRM6_TUNNEL_SPI_BYADDR_HSIZE];
 static struct hlist_head xfrm6_tunnel_spi_byspi[XFRM6_TUNNEL_SPI_BYSPI_HSIZE];
 
-static unsigned inline xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr)
+static inline unsigned xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr)
 {
        unsigned h;
 
@@ -70,7 +70,7 @@ static unsigned inline xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr)
        return h;
 }
 
-static unsigned inline xfrm6_tunnel_spi_hash_byspi(u32 spi)
+static inline unsigned xfrm6_tunnel_spi_hash_byspi(u32 spi)
 {
        return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE;
 }
index 873ae18..bc2e15c 100644 (file)
@@ -419,7 +419,7 @@ typedef struct irnet_socket
   u32                  raccm;          /* to please pppd - dummy) */
   unsigned int         flags;          /* PPP flags (compression, ...) */
   unsigned int         rbits;          /* Unused receive flags ??? */
-
+  struct work_struct disconnect_work;   /* Process context disconnection */
   /* ------------------------ IrTTP part ------------------------ */
   /* We create a pseudo "socket" over the IrDA tranport */
   unsigned long                ttp_open;       /* Set when IrTTP is ready */
index c378e66..a4f1439 100644 (file)
 
 #include "irnet_irda.h"                /* Private header */
 
+/*
+ * PPP disconnect work: we need to make sure we're in
+ * process context when calling ppp_unregister_channel().
+ */
+static void irnet_ppp_disconnect(struct work_struct *work)
+{
+       irnet_socket * self =
+               container_of(work, irnet_socket, disconnect_work);
+
+       if (self == NULL)
+               return;
+       /*
+        * If we were connected, cleanup & close the PPP
+        * channel, which will kill pppd (hangup) and the rest.
+        */
+       if (self->ppp_open && !self->ttp_open && !self->ttp_connect) {
+               ppp_unregister_channel(&self->chan);
+               self->ppp_open = 0;
+       }
+}
+
 /************************* CONTROL CHANNEL *************************/
 /*
  * When ppp is not active, /dev/irnet act as a control channel.
@@ -499,6 +520,8 @@ irda_irnet_create(irnet_socket *    self)
 #endif /* DISCOVERY_NOMASK */
   self->tx_flow = FLOW_START;  /* Flow control from IrTTP */
 
+  INIT_WORK(&self->disconnect_work, irnet_ppp_disconnect);
+
   DEXIT(IRDA_SOCK_TRACE, "\n");
   return(0);
 }
@@ -1134,15 +1157,8 @@ irnet_disconnect_indication(void *       instance,
     {
       if(test_open)
        {
-#ifdef MISSING_PPP_API
-         /* ppp_unregister_channel() wants a user context, which we
-          * are guaranteed to NOT have here. What are we supposed
-          * to do here ? Jean II */
-         /* If we were connected, cleanup & close the PPP channel,
-          * which will kill pppd (hangup) and the rest */
-         ppp_unregister_channel(&self->chan);
-         self->ppp_open = 0;
-#endif
+         /* ppp_unregister_channel() wants a user context. */
+         schedule_work(&self->disconnect_work);
        }
       else
        {
index a7486b3..da3f2bc 100644 (file)
@@ -1455,6 +1455,7 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
 
        /* Not everything should be copied */
        new->notify.instance = instance;
+       spin_lock_init(&new->lock);
        init_timer(&new->todo_timer);
 
        skb_queue_head_init(&new->rx_queue);
index 253fce3..54698af 100644 (file)
@@ -275,6 +275,7 @@ config NF_CT_NETLINK
        tristate 'Connection tracking netlink interface (EXPERIMENTAL)'
        depends on EXPERIMENTAL && NF_CONNTRACK && NETFILTER_NETLINK
        depends on NF_CONNTRACK!=y || NETFILTER_NETLINK!=m
+       depends on NF_NAT=n || NF_NAT
        help
          This option enables support for a netlink-based userspace interface
 
index ff2d6e5..020767a 100644 (file)
@@ -17,7 +17,6 @@ obj-$(CONFIG_NET_ACT_SIMP)    += act_simple.o
 obj-$(CONFIG_NET_SCH_FIFO)     += sch_fifo.o
 obj-$(CONFIG_NET_SCH_CBQ)      += sch_cbq.o
 obj-$(CONFIG_NET_SCH_HTB)      += sch_htb.o
-obj-$(CONFIG_NET_SCH_HPFQ)     += sch_hpfq.o
 obj-$(CONFIG_NET_SCH_HFSC)     += sch_hfsc.o
 obj-$(CONFIG_NET_SCH_RED)      += sch_red.o
 obj-$(CONFIG_NET_SCH_GRED)     += sch_gred.o
index 68f26cb..3e93683 100644 (file)
@@ -198,7 +198,7 @@ bad_mirred:
                skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at);
 
        skb2->dev = dev;
-       skb2->input_dev = skb->dev;
+       skb2->iif = skb->dev->ifindex;
        dev_queue_xmit(skb2);
        spin_unlock(&m->tcf_lock);
        return m->tcf_action;
index fad08e5..4a91f08 100644 (file)
@@ -81,6 +81,13 @@ static void basic_put(struct tcf_proto *tp, unsigned long f)
 
 static int basic_init(struct tcf_proto *tp)
 {
+       struct basic_head *head;
+
+       head = kzalloc(sizeof(*head), GFP_KERNEL);
+       if (head == NULL)
+               return -ENOBUFS;
+       INIT_LIST_HEAD(&head->flist);
+       tp->root = head;
        return 0;
 }
 
@@ -102,6 +109,7 @@ static void basic_destroy(struct tcf_proto *tp)
                list_del(&f->link);
                basic_delete_filter(tp, f);
        }
+       kfree(head);
 }
 
 static int basic_delete(struct tcf_proto *tp, unsigned long arg)
@@ -176,15 +184,6 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
        }
 
        err = -ENOBUFS;
-       if (head == NULL) {
-               head = kzalloc(sizeof(*head), GFP_KERNEL);
-               if (head == NULL)
-                       goto errout;
-
-               INIT_LIST_HEAD(&head->flist);
-               tp->root = head;
-       }
-
        f = kzalloc(sizeof(*f), GFP_KERNEL);
        if (f == NULL)
                goto errout;
index e85df07..abc47cc 100644 (file)
@@ -93,7 +93,7 @@ void route4_reset_fastmap(struct net_device *dev, struct route4_head *head, u32
        spin_unlock_bh(&dev->queue_lock);
 }
 
-static void __inline__
+static inline void
 route4_set_fastmap(struct route4_head *head, u32 id, int iif,
                   struct route4_filter *f)
 {
index 396deb7..407c6fb 100644 (file)
@@ -1184,10 +1184,12 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
 
        sch_tree_lock(sch);
 
-       list_del(&cl->hlist);
        list_del(&cl->siblings);
        hfsc_adjust_levels(cl->cl_parent);
+
        hfsc_purge_queue(sch, cl);
+       list_del(&cl->hlist);
+
        if (--cl->refcnt == 0)
                hfsc_destroy_class(sch, cl);
 
index 97cbb9a..3c3294d 100644 (file)
@@ -1380,15 +1380,15 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
 
        sch_tree_lock(sch);
 
-       /* delete from hash and active; remainder in destroy_class */
-       hlist_del_init(&cl->hlist);
-
        if (!cl->level) {
                qlen = cl->un.leaf.q->q.qlen;
                qdisc_reset(cl->un.leaf.q);
                qdisc_tree_decrease_qlen(cl->un.leaf.q, qlen);
        }
 
+       /* delete from hash and active; remainder in destroy_class */
+       hlist_del_init(&cl->hlist);
+
        if (cl->prio_activity)
                htb_deactivate(q, cl);
 
index fa82b73..78d2ddb 100644 (file)
@@ -1046,6 +1046,9 @@ void sctp_assoc_update(struct sctp_association *asoc,
                trans = list_entry(pos, struct sctp_transport, transports);
                if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
                        sctp_assoc_del_peer(asoc, &trans->ipaddr);
+
+               if (asoc->state >= SCTP_STATE_ESTABLISHED)
+                       sctp_transport_reset(trans);
        }
 
        /* If the case is A (association restart), use
@@ -1063,6 +1066,18 @@ void sctp_assoc_update(struct sctp_association *asoc,
                 */
                sctp_ssnmap_clear(asoc->ssnmap);
 
+               /* Flush the ULP reassembly and ordered queue.
+                * Any data there will now be stale and will
+                * cause problems.
+                */
+               sctp_ulpq_flush(&asoc->ulpq);
+
+               /* reset the overall association error count so
+                * that the restarted association doesn't get torn
+                * down on the next retransmission timer.
+                */
+               asoc->overall_error_count = 0;
+
        } else {
                /* Add any peer addresses from the new association. */
                list_for_each(pos, &new->peer.transport_addr_list) {
index 70c39ea..e9097cf 100644 (file)
@@ -4342,8 +4342,24 @@ sctp_disposition_t sctp_sf_do_prm_requestheartbeat(
                                        void *arg,
                                        sctp_cmd_seq_t *commands)
 {
-       return sctp_sf_heartbeat(ep, asoc, type, (struct sctp_transport *)arg,
-                                commands);
+       if (SCTP_DISPOSITION_NOMEM == sctp_sf_heartbeat(ep, asoc, type,
+                                     (struct sctp_transport *)arg, commands))
+               return SCTP_DISPOSITION_NOMEM;
+
+       /*
+        * RFC 2960 (bis), section 8.3
+        *
+        *    D) Request an on-demand HEARTBEAT on a specific destination
+        *    transport address of a given association.
+        *
+        *    The endpoint should increment the respective error  counter of
+        *    the destination transport address each time a HEARTBEAT is sent
+        *    to that address and not acknowledged within one RTO.
+        *
+        */
+       sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_RESET,
+                       SCTP_TRANSPORT(arg));
+       return SCTP_DISPOSITION_CONSUME;
 }
 
 /*
index a596f53..4d8c2ab 100644 (file)
@@ -526,3 +526,35 @@ unsigned long sctp_transport_timeout(struct sctp_transport *t)
        timeout += jiffies;
        return timeout;
 }
+
+/* Reset transport variables to their initial values */
+void sctp_transport_reset(struct sctp_transport *t)
+{
+       struct sctp_association *asoc = t->asoc;
+
+       /* RFC 2960 (bis), Section 5.2.4
+        * All the congestion control parameters (e.g., cwnd, ssthresh)
+        * related to this peer MUST be reset to their initial values
+        * (see Section 6.2.1)
+        */
+       t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
+       t->ssthresh = asoc->peer.i.a_rwnd;
+       t->rto = asoc->rto_initial;
+       t->rtt = 0;
+       t->srtt = 0;
+       t->rttvar = 0;
+
+       /* Reset these additional varibles so that we have a clean
+        * slate.
+        */
+       t->partial_bytes_acked = 0;
+       t->flight_size = 0;
+       t->error_count = 0;
+       t->rto_pending = 0;
+
+       /* Initialize the state information for SFR-CACC */
+       t->cacc.changeover_active = 0;
+       t->cacc.cycling_changeover = 0;
+       t->cacc.next_tsn_at_change = 0;
+       t->cacc.cacc_saw_newack = 0;
+}
index f4759a9..bfb197e 100644 (file)
@@ -73,7 +73,7 @@ struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *ulpq,
 
 
 /* Flush the reassembly and ordering queues.  */
-static void sctp_ulpq_flush(struct sctp_ulpq *ulpq)
+void sctp_ulpq_flush(struct sctp_ulpq *ulpq)
 {
        struct sk_buff *skb;
        struct sctp_ulpevent *event;
index 9566e57..ea8f81a 100644 (file)
@@ -1381,7 +1381,7 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
 
        err = sock_attach_fd(newsock, newfile);
        if (err < 0)
-               goto out_fd;
+               goto out_fd_simple;
 
        err = security_socket_accept(sock, newsock);
        if (err)
@@ -1414,6 +1414,11 @@ out_put:
        fput_light(sock->file, fput_needed);
 out:
        return err;
+out_fd_simple:
+       sock_release(newsock);
+       put_filp(newfile);
+       put_unused_fd(newfd);
+       goto out_put;
 out_fd:
        fput(newfile);
        put_unused_fd(newfd);
index f6e1eb1..593f62f 100644 (file)
@@ -779,8 +779,8 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
        }
 
        clear_bit(SK_DATA, &svsk->sk_flags);
-       while ((err == kernel_recvmsg(svsk->sk_sock, &msg, NULL,
-                                     0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 ||
+       while ((err = kernel_recvmsg(svsk->sk_sock, &msg, NULL,
+                                    0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 ||
               (skb = skb_recv_datagram(svsk->sk_sk, 0, 1, &err)) == NULL) {
                if (err == -EAGAIN) {
                        svc_sock_received(svsk);
index d339e0c..8738ec7 100644 (file)
@@ -26,64 +26,66 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,
        short same_lci = 0;
        int rc = 0;
 
-       if ((rt = x25_get_route(dest_addr)) != NULL) {
+       if ((rt = x25_get_route(dest_addr)) == NULL)
+               goto out_no_route;
 
-               if ((neigh_new = x25_get_neigh(rt->dev)) == NULL) {
-                       /* This shouldnt happen, if it occurs somehow
-                        * do something sensible
-                        */
-                       goto out_put_route;
-               }
-
-               /* Avoid a loop. This is the normal exit path for a
-                * system with only one x.25 iface and default route
+       if ((neigh_new = x25_get_neigh(rt->dev)) == NULL) {
+               /* This shouldnt happen, if it occurs somehow
+                * do something sensible
                 */
-               if (rt->dev == from->dev) {
-                       goto out_put_nb;
-               }
+               goto out_put_route;
+       }
 
-               /* Remote end sending a call request on an already
-                * established LCI? It shouldnt happen, just in case..
-                */
-               read_lock_bh(&x25_forward_list_lock);
-               list_for_each(entry, &x25_forward_list) {
-                       x25_frwd = list_entry(entry, struct x25_forward, node);
-                       if (x25_frwd->lci == lci) {
-                               printk(KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n");
-                               same_lci = 1;
-                       }
-               }
-               read_unlock_bh(&x25_forward_list_lock);
-
-               /* Save the forwarding details for future traffic */
-               if (!same_lci){
-                       if ((new_frwd = kmalloc(sizeof(struct x25_forward),
-                                                       GFP_ATOMIC)) == NULL){
-                               rc = -ENOMEM;
-                               goto out_put_nb;
-                       }
-                       new_frwd->lci = lci;
-                       new_frwd->dev1 = rt->dev;
-                       new_frwd->dev2 = from->dev;
-                       write_lock_bh(&x25_forward_list_lock);
-                       list_add(&new_frwd->node, &x25_forward_list);
-                       write_unlock_bh(&x25_forward_list_lock);
+       /* Avoid a loop. This is the normal exit path for a
+        * system with only one x.25 iface and default route
+        */
+       if (rt->dev == from->dev) {
+               goto out_put_nb;
+       }
+
+       /* Remote end sending a call request on an already
+        * established LCI? It shouldnt happen, just in case..
+        */
+       read_lock_bh(&x25_forward_list_lock);
+       list_for_each(entry, &x25_forward_list) {
+               x25_frwd = list_entry(entry, struct x25_forward, node);
+               if (x25_frwd->lci == lci) {
+                       printk(KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n");
+                       same_lci = 1;
                }
+       }
+       read_unlock_bh(&x25_forward_list_lock);
 
-               /* Forward the call request */
-               if ( (skbn = skb_clone(skb, GFP_ATOMIC)) == NULL){
+       /* Save the forwarding details for future traffic */
+       if (!same_lci){
+               if ((new_frwd = kmalloc(sizeof(struct x25_forward),
+                                               GFP_ATOMIC)) == NULL){
+                       rc = -ENOMEM;
                        goto out_put_nb;
                }
-               x25_transmit_link(skbn, neigh_new);
-               rc = 1;
+               new_frwd->lci = lci;
+               new_frwd->dev1 = rt->dev;
+               new_frwd->dev2 = from->dev;
+               write_lock_bh(&x25_forward_list_lock);
+               list_add(&new_frwd->node, &x25_forward_list);
+               write_unlock_bh(&x25_forward_list_lock);
        }
 
+       /* Forward the call request */
+       if ( (skbn = skb_clone(skb, GFP_ATOMIC)) == NULL){
+               goto out_put_nb;
+       }
+       x25_transmit_link(skbn, neigh_new);
+       rc = 1;
+
 
 out_put_nb:
        x25_neigh_put(neigh_new);
 
 out_put_route:
        x25_route_put(rt);
+
+out_no_route:
        return rc;
 }
 
index 0c3a70a..785c3e3 100644 (file)
@@ -2089,7 +2089,7 @@ void xfrm_audit_log(uid_t auid, u32 sid, int type, int result,
                                        sizeof(struct in6_addr));
                        }
                        audit_log_format(audit_buf,
-                                        " src=" NIP6_FMT "dst=" NIP6_FMT,
+                                        " src=" NIP6_FMT " dst=" NIP6_FMT,
                                         NIP6(saddr6), NIP6(daddr6));
                }
                break;
index 5c5f6dc..e3a0bcf 100644 (file)
@@ -1371,7 +1371,8 @@ int xfrm_replay_check(struct xfrm_state *x, __be32 net_seq)
                return 0;
 
        diff = x->replay.seq - seq;
-       if (diff >= x->props.replay_window) {
+       if (diff >= min_t(unsigned int, x->props.replay_window,
+                         sizeof(x->replay.bitmap) * 8)) {
                x->stats.replay_window++;
                return -EINVAL;
        }
index 9678995..e81e2fb 100644 (file)
@@ -2025,7 +2025,7 @@ nlmsg_failure:
        return -1;
 }
 
-static int inline xfrm_sa_len(struct xfrm_state *x)
+static inline int xfrm_sa_len(struct xfrm_state *x)
 {
        int l = 0;
        if (x->aalg)
index 668a11a..6bc7e7c 100644 (file)
  * the dependency on linux/autoconf.h by a dependency on every config
  * option which is mentioned in any of the listed prequisites.
  *
- * To be exact, split-include populates a tree in include/config/,
- * e.g. include/config/his/driver.h, which contains the #define/#undef
- * for the CONFIG_HIS_DRIVER option.
+ * kconfig populates a tree in include/config/ with an empty file
+ * for each config symbol and when the configuration is updated
+ * the files representing changed config options are touched
+ * which then let make pick up the changes and the files that use
+ * the config symbols are rebuilt.
  *
  * So if the user changes his CONFIG_HIS_DRIVER option, only the objects
  * which depend on "include/linux/config/his/driver.h" will be rebuilt,
@@ -245,6 +247,8 @@ void parse_config_file(char *map, size_t len)
                continue;
 
        found:
+               if (!memcmp(q - 7, "_MODULE", 7))
+                       q -= 7;
                use_config(p+7, q-p-7);
        }
 }