aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/SubmittingPatches86
-rw-r--r--Documentation/dell_rbu.txt38
-rw-r--r--Documentation/keys-request-key.txt161
-rw-r--r--Documentation/keys.txt18
-rw-r--r--Documentation/networking/ip-sysctl.txt10
-rw-r--r--MAINTAINERS17
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/kernel/entry.S1
-rw-r--r--arch/alpha/kernel/traps.c15
-rw-r--r--arch/arm/common/gic.c2
-rw-r--r--arch/arm/common/locomo.c1
-rw-r--r--arch/arm/common/scoop.c20
-rw-r--r--arch/arm/configs/collie_defconfig888
-rw-r--r--arch/arm/configs/corgi_defconfig1523
-rw-r--r--arch/arm/configs/poodle_defconfig1015
-rw-r--r--arch/arm/configs/spitz_defconfig1401
-rw-r--r--arch/arm/kernel/sys_arm.c2
-rw-r--r--arch/arm/kernel/traps.c2
-rw-r--r--arch/arm/mach-clps711x/fortunet.c2
-rw-r--r--arch/arm/mach-imx/generic.c23
-rw-r--r--arch/arm/mach-imx/leds-mx1ads.c1
-rw-r--r--arch/arm/mach-imx/mx1ads.c2
-rw-r--r--arch/arm/mach-iop3xx/common.c1
-rw-r--r--arch/arm/mach-iop3xx/iop321-time.c1
-rw-r--r--arch/arm/mach-iop3xx/iop331-time.c1
-rw-r--r--arch/arm/mach-iop3xx/iq31244-mm.c1
-rw-r--r--arch/arm/mach-iop3xx/iq80321-mm.c1
-rw-r--r--arch/arm/mach-iop3xx/iq80331-mm.c1
-rw-r--r--arch/arm/mach-iop3xx/iq80332-mm.c1
-rw-r--r--arch/arm/mach-ixp2000/core.c3
-rw-r--r--arch/arm/mach-ixp2000/pci.c1
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c2
-rw-r--r--arch/arm/mach-l7200/core.c1
-rw-r--r--arch/arm/mach-pxa/corgi.c1
-rw-r--r--arch/arm/mach-pxa/corgi_lcd.c1
-rw-r--r--arch/arm/mach-pxa/generic.c1
-rw-r--r--arch/arm/mach-s3c2410/usb-simtec.c1
-rw-r--r--arch/arm/mach-sa1100/collie.c6
-rw-r--r--arch/arm/mach-versatile/core.c44
-rw-r--r--arch/arm/mach-versatile/pci.c1
-rw-r--r--arch/arm/mm/Kconfig8
-rw-r--r--arch/arm/mm/abort-ev6.S5
-rw-r--r--arch/arm/mm/alignment.c11
-rw-r--r--arch/arm/mm/cache-v6.S9
-rw-r--r--arch/arm/mm/flush.c36
-rw-r--r--arch/arm/plat-omap/common.c1
-rw-r--r--arch/arm/plat-omap/cpu-omap.c1
-rw-r--r--arch/arm/plat-omap/usb.c1
-rw-r--r--arch/arm/tools/mach-types90
-rw-r--r--arch/cris/arch-v32/drivers/pci/dma.c2
-rw-r--r--arch/i386/kernel/acpi/boot.c2
-rw-r--r--arch/i386/kernel/cpu/amd.c16
-rw-r--r--arch/i386/kernel/pci-dma.c2
-rw-r--r--arch/i386/kernel/signal.c6
-rw-r--r--arch/i386/pci/acpi.c2
-rw-r--r--arch/i386/pci/irq.c2
-rw-r--r--arch/ia64/kernel/mca.c5
-rw-r--r--arch/m32r/kernel/entry.S9
-rw-r--r--arch/m32r/kernel/traps.c33
-rw-r--r--arch/powerpc/platforms/pseries/pci.c4
-rw-r--r--arch/ppc/boot/ld.script2
-rw-r--r--arch/ppc/kernel/dma-mapping.c4
-rw-r--r--arch/ppc/platforms/4xx/bamboo.c1
-rw-r--r--arch/ppc/platforms/4xx/ebony.c1
-rw-r--r--arch/ppc/platforms/4xx/luan.c1
-rw-r--r--arch/ppc/platforms/4xx/ocotea.c1
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c1
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.c1
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.c1
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_ads_common.c1
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c1
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.c1
-rw-r--r--arch/ppc/platforms/85xx/sbc85xx.c1
-rw-r--r--arch/ppc/platforms/85xx/stx_gp3.c1
-rw-r--r--arch/ppc/platforms/chestnut.c1
-rw-r--r--arch/ppc/platforms/chrp_setup.c1
-rw-r--r--arch/ppc/platforms/gemini_setup.c1
-rw-r--r--arch/ppc/platforms/mvme5100.c1
-rw-r--r--arch/ppc/platforms/pmac_cpufreq.c7
-rw-r--r--arch/ppc/platforms/pmac_feature.c4
-rw-r--r--arch/ppc/platforms/pmac_setup.c1
-rw-r--r--arch/ppc/platforms/pmac_time.c2
-rw-r--r--arch/ppc/platforms/powerpmc250.c1
-rw-r--r--arch/ppc/platforms/pplus.c1
-rw-r--r--arch/ppc/platforms/prpmc750.c1
-rw-r--r--arch/ppc/platforms/prpmc800.c1
-rw-r--r--arch/ppc/platforms/radstone_ppc7d.c2
-rw-r--r--arch/ppc/platforms/sandpoint.c1
-rw-r--r--arch/ppc/syslib/mv64x60.c4
-rw-r--r--arch/ppc/syslib/open_pic.c1
-rw-r--r--arch/ppc/syslib/open_pic2.c1
-rw-r--r--arch/ppc/syslib/ppc4xx_setup.c1
-rw-r--r--arch/ppc64/kernel/bpa_iommu.c8
-rw-r--r--arch/ppc64/kernel/dma.c2
-rw-r--r--arch/ppc64/kernel/iommu.c2
-rw-r--r--arch/ppc64/kernel/kprobes.c8
-rw-r--r--arch/ppc64/kernel/module.c13
-rw-r--r--arch/ppc64/kernel/pci_direct_iommu.c2
-rw-r--r--arch/ppc64/kernel/pci_iommu.c2
-rw-r--r--arch/ppc64/kernel/vio.c2
-rw-r--r--arch/s390/kernel/compat_signal.c6
-rw-r--r--arch/s390/kernel/signal.c4
-rw-r--r--arch/sparc/Kconfig56
-rw-r--r--arch/sparc/kernel/setup.c2
-rw-r--r--arch/sparc/kernel/time.c2
-rw-r--r--arch/sparc/mm/srmmu.c2
-rw-r--r--arch/sparc64/kernel/cpu.c4
-rw-r--r--arch/sparc64/kernel/entry.S82
-rw-r--r--arch/sparc64/kernel/etrap.S51
-rw-r--r--arch/sparc64/kernel/head.S167
-rw-r--r--arch/sparc64/kernel/irq.c1
-rw-r--r--arch/sparc64/kernel/power.c64
-rw-r--r--arch/sparc64/kernel/ptrace.c14
-rw-r--r--arch/sparc64/kernel/rtrap.S30
-rw-r--r--arch/sparc64/kernel/setup.c29
-rw-r--r--arch/sparc64/kernel/sys32.S170
-rw-r--r--arch/sparc64/kernel/trampoline.S15
-rw-r--r--arch/sparc64/kernel/traps.c60
-rw-r--r--arch/sparc64/kernel/una_asm.S65
-rw-r--r--arch/sparc64/kernel/unaligned.c53
-rw-r--r--arch/sparc64/kernel/us3_cpufreq.c5
-rw-r--r--arch/sparc64/kernel/winfixup.S33
-rw-r--r--arch/sparc64/lib/VISsave.S8
-rw-r--r--arch/sparc64/lib/strncpy_from_user.S16
-rw-r--r--arch/sparc64/lib/user_fixup.c63
-rw-r--r--arch/sparc64/mm/Makefile2
-rw-r--r--arch/sparc64/mm/extable.c80
-rw-r--r--arch/sparc64/mm/fault.c69
-rw-r--r--arch/sparc64/mm/init.c441
-rw-r--r--arch/sparc64/prom/Makefile2
-rw-r--r--arch/sparc64/prom/init.c3
-rw-r--r--arch/sparc64/prom/memory.c152
-rw-r--r--arch/um/Makefile70
-rw-r--r--arch/um/Makefile-i38622
-rw-r--r--arch/um/Makefile-skas2
-rw-r--r--arch/um/Makefile-x86_6421
-rw-r--r--arch/um/drivers/cow.h39
-rw-r--r--arch/um/drivers/cow_user.c1
-rw-r--r--arch/um/drivers/mconsole_user.c2
-rw-r--r--arch/um/drivers/port_kern.c1
-rw-r--r--arch/um/include/common-offsets.h4
-rw-r--r--arch/um/include/os.h4
-rw-r--r--arch/um/include/registers.h12
-rw-r--r--arch/um/include/skas_ptregs.h6
-rw-r--r--arch/um/include/sysdep-i386/sc.h44
-rw-r--r--arch/um/include/sysdep-i386/sigcontext.h10
-rw-r--r--arch/um/include/sysdep-i386/thread.h11
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace.h4
-rw-r--r--arch/um/include/sysdep-x86_64/sc.h45
-rw-r--r--arch/um/include/sysdep-x86_64/sigcontext.h5
-rw-r--r--arch/um/include/sysdep-x86_64/thread.h10
-rw-r--r--arch/um/include/task.h9
-rw-r--r--arch/um/kernel/irq.c1
-rw-r--r--arch/um/kernel/skas/Makefile2
-rw-r--r--arch/um/kernel/skas/util/Makefile5
-rw-r--r--arch/um/kernel/skas/util/mk_ptregs-i386.c49
-rw-r--r--arch/um/kernel/skas/util/mk_ptregs-x86_64.c66
-rw-r--r--arch/um/kernel/sysrq.c8
-rw-r--r--arch/um/kernel/trap_kern.c5
-rw-r--r--arch/um/kernel/um_arch.c2
-rw-r--r--arch/um/os-Linux/elf_aux.c2
-rw-r--r--arch/um/os-Linux/start_up.c11
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c19
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c19
-rw-r--r--arch/um/os-Linux/util/Makefile4
-rw-r--r--arch/um/os-Linux/util/mk_user_constants.c23
-rw-r--r--arch/um/scripts/Makefile.rules4
-rw-r--r--arch/um/sys-i386/Makefile2
-rw-r--r--arch/um/sys-i386/kernel-offsets.c4
-rw-r--r--arch/um/sys-i386/sysrq.c13
-rw-r--r--arch/um/sys-i386/user-offsets.c71
-rw-r--r--arch/um/sys-i386/util/Makefile5
-rw-r--r--arch/um/sys-i386/util/mk_sc.c51
-rw-r--r--arch/um/sys-i386/util/mk_thread.c22
-rw-r--r--arch/um/sys-x86_64/Makefile2
-rw-r--r--arch/um/sys-x86_64/kernel-offsets.c2
-rw-r--r--arch/um/sys-x86_64/stub_segv.c37
-rw-r--r--arch/um/sys-x86_64/user-offsets.c117
-rw-r--r--arch/um/sys-x86_64/util/Makefile8
-rw-r--r--arch/um/sys-x86_64/util/mk_sc.c47
-rw-r--r--arch/um/sys-x86_64/util/mk_thread.c20
-rw-r--r--arch/um/util/Makefile5
-rw-r--r--arch/um/util/mk_constants.c32
-rw-r--r--arch/um/util/mk_task.c30
-rw-r--r--arch/x86_64/ia32/ia32_signal.c6
-rw-r--r--arch/x86_64/kernel/head.S40
-rw-r--r--arch/x86_64/kernel/kprobes.c8
-rw-r--r--arch/x86_64/kernel/mce.c10
-rw-r--r--arch/x86_64/kernel/setup.c27
-rw-r--r--arch/x86_64/kernel/setup64.c4
-rw-r--r--arch/x86_64/kernel/smpboot.c6
-rw-r--r--arch/x86_64/kernel/suspend.c127
-rw-r--r--arch/x86_64/kernel/suspend_asm.S17
-rw-r--r--arch/x86_64/mm/numa.c10
-rw-r--r--arch/x86_64/mm/pageattr.c2
-rw-r--r--drivers/atm/ambassador.c2
-rw-r--r--drivers/atm/firestream.c5
-rw-r--r--drivers/atm/fore200e.c10
-rw-r--r--drivers/base/dmapool.c5
-rw-r--r--drivers/block/pktcdvd.c4
-rw-r--r--drivers/block/scsi_ioctl.c8
-rw-r--r--drivers/bluetooth/bpa10x.c2
-rw-r--r--drivers/bluetooth/hci_usb.c2
-rw-r--r--drivers/char/drm/drm_drv.c2
-rw-r--r--drivers/char/drm/drm_proc.c2
-rw-r--r--drivers/char/drm/drm_stub.c2
-rw-r--r--drivers/char/n_r3964.c84
-rw-r--r--drivers/char/s3c2410-rtc.c1
-rw-r--r--drivers/char/watchdog/mv64x60_wdt.c14
-rw-r--r--drivers/char/watchdog/pcwd_pci.c239
-rw-r--r--drivers/connector/connector.c2
-rw-r--r--drivers/firmware/dell_rbu.c174
-rw-r--r--drivers/ide/ide-io.c8
-rw-r--r--drivers/ieee1394/amdtp.c1
-rw-r--r--drivers/ieee1394/csr1212.h1
-rw-r--r--drivers/ieee1394/dv1394.c1
-rw-r--r--drivers/ieee1394/eth1394.c12
-rw-r--r--drivers/ieee1394/eth1394.h6
-rw-r--r--drivers/ieee1394/hosts.c3
-rw-r--r--drivers/ieee1394/hosts.h8
-rw-r--r--drivers/ieee1394/ieee1394_core.c32
-rw-r--r--drivers/ieee1394/nodemgr.c23
-rw-r--r--drivers/ieee1394/ohci1394.c4
-rw-r--r--drivers/ieee1394/raw1394.c3
-rw-r--r--drivers/ieee1394/sbp2.c107
-rw-r--r--drivers/ieee1394/video1394.c1
-rw-r--r--drivers/infiniband/core/mad.c2
-rw-r--r--drivers/infiniband/core/sa_query.c6
-rw-r--r--drivers/infiniband/hw/mthca/mthca_main.c45
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c4
-rw-r--r--drivers/isdn/divert/divert_procfs.c6
-rw-r--r--drivers/isdn/hardware/eicon/diva_didd.c6
-rw-r--r--drivers/isdn/hardware/eicon/divasproc.c2
-rw-r--r--drivers/isdn/hysdn/hysdn_procconf.c2
-rw-r--r--drivers/macintosh/smu.c4
-rw-r--r--drivers/md/dm-crypt.c2
-rw-r--r--drivers/md/dm-io.c2
-rw-r--r--drivers/md/dm-raid1.c2
-rw-r--r--drivers/md/multipath.c2
-rw-r--r--drivers/md/raid1.c4
-rw-r--r--drivers/md/raid10.c4
-rw-r--r--drivers/media/video/bttv-cards.c6
-rw-r--r--drivers/media/video/cpia.c2
-rw-r--r--drivers/media/video/rds.h2
-rw-r--r--drivers/media/video/saa6588.c4
-rw-r--r--drivers/mfd/ucb1x00-core.c24
-rw-r--r--drivers/mfd/ucb1x00.h2
-rw-r--r--drivers/mtd/maps/bast-flash.c1
-rw-r--r--drivers/mtd/maps/ixp2000.c1
-rw-r--r--drivers/mtd/maps/ixp4xx.c3
-rw-r--r--drivers/mtd/maps/omap_nor.c1
-rw-r--r--drivers/mtd/maps/sa1100-flash.c1
-rw-r--r--drivers/mtd/nand/s3c2410.c1
-rw-r--r--drivers/net/Kconfig16
-rw-r--r--drivers/net/Makefile1
-rw-r--r--drivers/net/arm/am79c961a.c22
-rw-r--r--drivers/net/bmac.c2
-rw-r--r--drivers/net/bonding/bond_main.c287
-rw-r--r--drivers/net/bonding/bonding.h4
-rw-r--r--drivers/net/cassini.c5237
-rw-r--r--drivers/net/cassini.h4425
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.c31
-rw-r--r--drivers/net/ibmveth.c6
-rw-r--r--drivers/net/irda/vlsi_ir.c4
-rw-r--r--drivers/net/ns83820.c2
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pppoe.c4
-rw-r--r--drivers/net/r8169.c3
-rw-r--r--drivers/net/sk98lin/skge.c8
-rw-r--r--drivers/net/skge.c24
-rw-r--r--drivers/net/starfire.c46
-rw-r--r--drivers/net/sungem.h3
-rw-r--r--drivers/net/tg3.c27
-rw-r--r--drivers/net/tokenring/ibmtr.c5
-rw-r--r--drivers/net/tulip/21142.c2
-rw-r--r--drivers/net/wan/sdlamain.c23
-rw-r--r--drivers/net/wan/syncppp.c2
-rw-r--r--drivers/net/wireless/orinoco.c14
-rw-r--r--drivers/net/wireless/strip.c4
-rw-r--r--drivers/parisc/led.c5
-rw-r--r--drivers/pcmcia/cs.c3
-rw-r--r--drivers/pcmcia/omap_cf.c1
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c10
-rw-r--r--drivers/pcmcia/ti113x.h5
-rw-r--r--drivers/s390/cio/device.c2
-rw-r--r--drivers/s390/net/qeth.h2
-rw-r--r--drivers/s390/net/qeth_main.c41
-rw-r--r--drivers/s390/scsi/zfcp_aux.c2
-rw-r--r--drivers/scsi/3w-9xxx.c55
-rw-r--r--drivers/scsi/3w-9xxx.h17
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/aacraid/aachba.c283
-rw-r--r--drivers/scsi/aacraid/aacraid.h17
-rw-r--r--drivers/scsi/aacraid/comminit.c17
-rw-r--r--drivers/scsi/aacraid/commsup.c581
-rw-r--r--drivers/scsi/aacraid/linit.c12
-rw-r--r--drivers/scsi/aic7xxx/aic7770_osm.c3
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c8
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm_pci.c3
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c8
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c3
-rw-r--r--drivers/scsi/hosts.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c6
-rw-r--r--drivers/scsi/megaraid.c70
-rw-r--r--drivers/scsi/megaraid/Kconfig.megaraid9
-rw-r--r--drivers/scsi/megaraid/Makefile1
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c2806
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h1142
-rw-r--r--drivers/scsi/qla2xxx/qla_rscn.c2
-rw-r--r--drivers/scsi/scsi_scan.c96
-rw-r--r--drivers/scsi/scsi_transport_sas.c9
-rw-r--r--drivers/scsi/sg.c3
-rw-r--r--drivers/serial/imx.c11
-rw-r--r--drivers/serial/ioc4_serial.c12
-rw-r--r--drivers/serial/s3c2410.c9
-rw-r--r--drivers/serial/sunsab.c1
-rw-r--r--drivers/serial/sunsu.c4
-rw-r--r--drivers/serial/sunzilog.c5
-rw-r--r--drivers/usb/core/devio.c16
-rw-r--r--drivers/usb/core/hcd-pci.c9
-rw-r--r--drivers/usb/core/inode.c2
-rw-r--r--drivers/usb/core/usb.h3
-rw-r--r--drivers/usb/host/ohci-lh7a404.c2
-rw-r--r--drivers/usb/host/ohci-omap.c1
-rw-r--r--drivers/usb/host/ohci-s3c2410.c1
-rw-r--r--drivers/usb/media/vicam.c4
-rw-r--r--drivers/video/Kconfig1
-rw-r--r--drivers/video/aty/radeon_base.c2
-rw-r--r--drivers/video/aty/radeon_pm.c14
-rw-r--r--drivers/video/aty/radeonfb.h2
-rw-r--r--drivers/video/backlight/corgi_bl.c1
-rw-r--r--drivers/video/cyblafb.c11
-rw-r--r--drivers/video/i810/i810-i2c.c16
-rw-r--r--drivers/video/imxfb.c1
-rw-r--r--drivers/video/intelfb/intelfbdrv.c21
-rw-r--r--drivers/video/p9100.c4
-rw-r--r--drivers/video/pxafb.c108
-rw-r--r--drivers/video/pxafb.h9
-rw-r--r--drivers/video/s3c2410fb.c4
-rw-r--r--fs/9p/vfs_file.c114
-rw-r--r--fs/9p/vfs_super.c2
-rw-r--r--fs/aio.c98
-rw-r--r--fs/bfs/dir.c2
-rw-r--r--fs/bfs/inode.c44
-rw-r--r--fs/binfmt_elf.c2
-rw-r--r--fs/bio.c10
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/fuse/file.c4
-rw-r--r--fs/hostfs/hostfs_kern.c7
-rw-r--r--fs/mpage.c2
-rw-r--r--fs/namei.c6
-rw-r--r--fs/nfs_common/nfsacl.c70
-rw-r--r--fs/ntfs/ChangeLog3
-rw-r--r--fs/ntfs/bitmap.c5
-rw-r--r--fs/ntfs/layout.h2
-rw-r--r--fs/ntfs/malloc.h2
-rw-r--r--fs/ntfs/mft.c3
-rw-r--r--fs/ntfs/unistr.c2
-rw-r--r--fs/posix_acl.c6
-rw-r--r--fs/read_write.c3
-rw-r--r--fs/relayfs/buffers.c2
-rw-r--r--fs/xfs/linux-2.6/kmem.c10
-rw-r--r--fs/xfs/linux-2.6/kmem.h13
-rw-r--r--include/asm-arm/arch-h720x/system.h8
-rw-r--r--include/asm-arm/arch-imx/imx-regs.h48
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h2
-rw-r--r--include/asm-arm/arch-rpc/hardware.h4
-rw-r--r--include/asm-arm/arch-versatile/io.h6
-rw-r--r--include/asm-arm/elf.h2
-rw-r--r--include/asm-arm/hardware/scoop.h2
-rw-r--r--include/asm-generic/dma-mapping.h4
-rw-r--r--include/asm-i386/dma-mapping.h2
-rw-r--r--include/asm-i386/hw_irq.h2
-rw-r--r--include/asm-ia64/uaccess.h12
-rw-r--r--include/asm-ppc/dma-mapping.h2
-rw-r--r--include/asm-ppc/io.h20
-rw-r--r--include/asm-ppc/mv64x60.h4
-rw-r--r--include/asm-ppc64/dma-mapping.h4
-rw-r--r--include/asm-ppc64/iommu.h2
-rw-r--r--include/asm-ppc64/uaccess.h6
-rw-r--r--include/asm-s390/sigcontext.h2
-rw-r--r--include/asm-s390/signal.h2
-rw-r--r--include/asm-sparc/btfixup.h24
-rw-r--r--include/asm-sparc/cache.h18
-rw-r--r--include/asm-sparc/cypress.h8
-rw-r--r--include/asm-sparc/delay.h2
-rw-r--r--include/asm-sparc/dma.h2
-rw-r--r--include/asm-sparc/iommu.h4
-rw-r--r--include/asm-sparc/kdebug.h2
-rw-r--r--include/asm-sparc/mbus.h4
-rw-r--r--include/asm-sparc/msi.h2
-rw-r--r--include/asm-sparc/mxcc.h8
-rw-r--r--include/asm-sparc/obio.h30
-rw-r--r--include/asm-sparc/pci.h6
-rw-r--r--include/asm-sparc/pgtable.h46
-rw-r--r--include/asm-sparc/pgtsrmmu.h30
-rw-r--r--include/asm-sparc/processor.h2
-rw-r--r--include/asm-sparc/psr.h6
-rw-r--r--include/asm-sparc/sbi.h10
-rw-r--r--include/asm-sparc/sbus.h6
-rw-r--r--include/asm-sparc/smp.h26
-rw-r--r--include/asm-sparc/smpprim.h8
-rw-r--r--include/asm-sparc/spinlock.h10
-rw-r--r--include/asm-sparc/system.h2
-rw-r--r--include/asm-sparc/traps.h2
-rw-r--r--include/asm-sparc64/head.h9
-rw-r--r--include/asm-sparc64/openprom.h4
-rw-r--r--include/asm-sparc64/oplib.h14
-rw-r--r--include/asm-sparc64/page.h17
-rw-r--r--include/asm-sparc64/pgtable.h7
-rw-r--r--include/asm-sparc64/uaccess.h24
-rw-r--r--include/asm-um/processor-generic.h23
-rw-r--r--include/asm-um/processor-i386.h15
-rw-r--r--include/asm-um/processor-x86_64.h14
-rw-r--r--include/asm-um/uaccess.h2
-rw-r--r--include/asm-x86_64/msr.h1
-rw-r--r--include/asm-x86_64/pgtable.h2
-rw-r--r--include/asm-x86_64/smp.h1
-rw-r--r--include/linux/aio.h34
-rw-r--r--include/linux/atmdev.h12
-rw-r--r--include/linux/bfs_fs.h42
-rw-r--r--include/linux/bio.h6
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/cpuset.h5
-rw-r--r--include/linux/dmapool.h2
-rw-r--r--include/linux/gfp.h14
-rw-r--r--include/linux/if_ether.h2
-rw-r--r--include/linux/inetdevice.h12
-rw-r--r--include/linux/ipv6.h5
-rw-r--r--include/linux/jbd.h2
-rw-r--r--include/linux/key-ui.h91
-rw-r--r--include/linux/kfifo.h4
-rw-r--r--include/linux/mempool.h9
-rw-r--r--include/linux/mod_devicetable.h2
-rw-r--r--include/linux/netdevice.h89
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/pagemap.h2
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/posix_acl.h6
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/sched.h13
-rw-r--r--include/linux/security.h6
-rw-r--r--include/linux/skbuff.h40
-rw-r--r--include/linux/slab.h19
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/suspend.h2
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/tc_ematch/tc_em_meta.h2
-rw-r--r--include/linux/textsearch.h3
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/net/bluetooth/bluetooth.h2
-rw-r--r--include/net/bluetooth/rfcomm.h2
-rw-r--r--include/net/dn_nsp.h8
-rw-r--r--include/net/dn_route.h2
-rw-r--r--include/net/inet6_hashtables.h21
-rw-r--r--include/net/inet_connection_sock.h2
-rw-r--r--include/net/inet_hashtables.h66
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/ip_vs.h2
-rw-r--r--include/net/llc_conn.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/sm.h10
-rw-r--r--include/net/sctp/structs.h24
-rw-r--r--include/net/sctp/ulpevent.h16
-rw-r--r--include/net/sctp/ulpqueue.h11
-rw-r--r--include/net/sctp/user.h33
-rw-r--r--include/net/sock.h21
-rw-r--r--include/net/tcp.h3
-rw-r--r--include/net/xfrm.h7
-rw-r--r--include/rdma/ib_mad.h2
-rw-r--r--include/rdma/ib_sa.h10
-rw-r--r--include/rxrpc/call.h2
-rw-r--r--include/rxrpc/message.h2
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/sound/ac97_codec.h2
-rw-r--r--include/sound/core.h8
-rw-r--r--include/sound/driver.h2
-rw-r--r--include/sound/emu10k1.h2
-rw-r--r--kernel/audit.c2
-rw-r--r--kernel/cpuset.c14
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/kfifo.c4
-rw-r--r--kernel/power/swsusp.c7
-rw-r--r--kernel/signal.c42
-rw-r--r--lib/radix-tree.c2
-rw-r--r--lib/ts_bm.c2
-rw-r--r--lib/ts_fsm.c2
-rw-r--r--lib/ts_kmp.c2
-rw-r--r--mm/bootmem.c14
-rw-r--r--mm/fremap.c3
-rw-r--r--mm/highmem.c2
-rw-r--r--mm/madvise.c11
-rw-r--r--mm/mempolicy.c8
-rw-r--r--mm/mempool.c6
-rw-r--r--mm/nommu.c3
-rw-r--r--mm/oom_kill.c2
-rw-r--r--mm/page_alloc.c12
-rw-r--r--mm/page_io.c2
-rw-r--r--mm/shmem.c3
-rw-r--r--mm/slab.c34
-rw-r--r--mm/swap_state.c2
-rw-r--r--mm/vmalloc.c4
-rw-r--r--net/appletalk/ddp.c31
-rw-r--r--net/atm/addr.c55
-rw-r--r--net/atm/addr.h12
-rw-r--r--net/atm/atm_misc.c2
-rw-r--r--net/atm/br2684.c2
-rw-r--r--net/atm/clip.c2
-rw-r--r--net/atm/common.c6
-rw-r--r--net/atm/ioctl.c34
-rw-r--r--net/atm/lec.c43
-rw-r--r--net/atm/resources.c20
-rw-r--r--net/atm/signaling.c8
-rw-r--r--net/atm/svc.c1
-rw-r--r--net/ax25/ax25_in.c2
-rw-r--r--net/bluetooth/l2cap.c2
-rw-r--r--net/bluetooth/rfcomm/core.c2
-rw-r--r--net/bluetooth/rfcomm/sock.c2
-rw-r--r--net/bluetooth/rfcomm/tty.c2
-rw-r--r--net/bluetooth/sco.c2
-rw-r--r--net/core/datagram.c81
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/netpoll.c2
-rw-r--r--net/core/pktgen.c26
-rw-r--r--net/core/skbuff.c19
-rw-r--r--net/core/sock.c30
-rw-r--r--net/dccp/ackvec.c2
-rw-r--r--net/dccp/ackvec.h4
-rw-r--r--net/dccp/ccids/lib/loss_interval.h2
-rw-r--r--net/dccp/ccids/lib/packet_history.h4
-rw-r--r--net/dccp/ipv4.c12
-rw-r--r--net/decnet/af_decnet.c4
-rw-r--r--net/decnet/dn_nsp_out.c21
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ethernet/eth.c31
-rw-r--r--net/ieee80211/ieee80211_module.c2
-rw-r--r--net/ieee80211/ieee80211_tx.c2
-rw-r--r--net/ipv4/arp.c21
-rw-r--r--net/ipv4/devinet.c22
-rw-r--r--net/ipv4/fib_frontend.c4
-rw-r--r--net/ipv4/fib_semantics.c4
-rw-r--r--net/ipv4/fib_trie.c23
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/inet_connection_sock.c2
-rw-r--r--net/ipv4/inet_timewait_sock.c6
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ipmr.c6
-rw-r--r--net/ipv4/ipvs/ip_vs_app.c2
-rw-r--r--net/ipv4/netfilter/Kconfig2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netbios_ns.c2
-rw-r--r--net/ipv4/netfilter/ip_queue.c4
-rw-r--r--net/ipv4/netfilter/ipt_REDIRECT.c2
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c4
-rw-r--r--net/ipv4/route.c6
-rw-r--r--net/ipv4/tcp_bic.c2
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv4/tcp_ipv4.c11
-rw-r--r--net/ipv4/tcp_output.c4
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/mcast.c2
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/netfilter/ip6_queue.c4
-rw-r--r--net/ipv6/tcp_ipv6.c18
-rw-r--r--net/ipv6/udp.c18
-rw-r--r--net/irda/irlan/irlan_eth.c2
-rw-r--r--net/key/af_key.c18
-rw-r--r--net/llc/llc_conn.c3
-rw-r--r--net/netfilter/nfnetlink.c2
-rw-r--r--net/netfilter/nfnetlink_log.c4
-rw-r--r--net/netfilter/nfnetlink_queue.c4
-rw-r--r--net/netlink/af_netlink.c4
-rw-r--r--net/netrom/nr_dev.c2
-rw-r--r--net/packet/af_packet.c4
-rw-r--r--net/rose/af_rose.c26
-rw-r--r--net/rxrpc/call.c2
-rw-r--r--net/rxrpc/connection.c2
-rw-r--r--net/sched/em_meta.c6
-rw-r--r--net/sctp/associola.c10
-rw-r--r--net/sctp/bind_addr.c12
-rw-r--r--net/sctp/chunk.c2
-rw-r--r--net/sctp/endpointola.c5
-rw-r--r--net/sctp/protocol.c4
-rw-r--r--net/sctp/sm_make_chunk.c14
-rw-r--r--net/sctp/sm_sideeffect.c12
-rw-r--r--net/sctp/socket.c252
-rw-r--r--net/sctp/ssnmap.c2
-rw-r--r--net/sctp/transport.c4
-rw-r--r--net/sctp/ulpevent.c18
-rw-r--r--net/sctp/ulpqueue.c8
-rw-r--r--net/socket.c13
-rw-r--r--net/sunrpc/sched.c2
-rw-r--r--net/sysctl_net.c2
-rw-r--r--net/xfrm/xfrm_policy.c6
-rw-r--r--security/keys/Makefile1
-rw-r--r--security/keys/permission.c70
-rw-r--r--security/keys/request_key.c2
-rw-r--r--security/keys/request_key_auth.c3
-rw-r--r--security/selinux/hooks.c30
-rw-r--r--sound/arm/pxa2xx-ac97.c2
-rw-r--r--sound/core/memalloc.c2
-rw-r--r--sound/core/memory.c10
-rw-r--r--sound/core/seq/instr/ainstr_iw.c2
-rw-r--r--sound/core/wrappers.c2
-rw-r--r--sound/isa/opl3sa2.c2
-rw-r--r--sound/pci/ac97/ac97_bus.c23
-rw-r--r--sound/pci/ac97/ac97_codec.c3
-rw-r--r--sound/pci/ac97/ac97_patch.c6
-rw-r--r--sound/pci/ali5451/ali5451.c6
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c5
-rw-r--r--sound/pci/emu10k1/emumixer.c11
-rw-r--r--sound/pci/hda/hda_generic.c6
-rw-r--r--sound/pci/hda/hda_intel.c5
-rw-r--r--sound/pci/hda/patch_realtek.c22
-rw-r--r--sound/pci/korg1212/korg1212.c2
-rw-r--r--sound/pci/via82xx.c2
-rw-r--r--sound/ppc/pmac.c1
-rw-r--r--sound/usb/usbaudio.c8
-rw-r--r--sound/usb/usbmixer_maps.c10
-rw-r--r--sound/usb/usbquirks.h50
626 files changed, 23932 insertions, 4578 deletions
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 7f43b040311e..237d54c44bc5 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -301,8 +301,84 @@ now, but you can do this to mark internal company procedures or just
301point out some special detail about the sign-off. 301point out some special detail about the sign-off.
302 302
303 303
30412) The canonical patch format
304 305
30512) More references for submitting patches 306The canonical patch subject line is:
307
308 Subject: [PATCH 001/123] subsystem: summary phrase
309
310The canonical patch message body contains the following:
311
312 - A "from" line specifying the patch author.
313
314 - An empty line.
315
316 - The body of the explanation, which will be copied to the
317 permanent changelog to describe this patch.
318
319 - The "Signed-off-by:" lines, described above, which will
320 also go in the changelog.
321
322 - A marker line containing simply "---".
323
324 - Any additional comments not suitable for the changelog.
325
326 - The actual patch (diff output).
327
328The Subject line format makes it very easy to sort the emails
329alphabetically by subject line - pretty much any email reader will
330support that - since because the sequence number is zero-padded,
331the numerical and alphabetic sort is the same.
332
333The "subsystem" in the email's Subject should identify which
334area or subsystem of the kernel is being patched.
335
336The "summary phrase" in the email's Subject should concisely
337describe the patch which that email contains. The "summary
338phrase" should not be a filename. Do not use the same "summary
339phrase" for every patch in a whole patch series.
340
341Bear in mind that the "summary phrase" of your email becomes
342a globally-unique identifier for that patch. It propagates
343all the way into the git changelog. The "summary phrase" may
344later be used in developer discussions which refer to the patch.
345People will want to google for the "summary phrase" to read
346discussion regarding that patch.
347
348A couple of example Subjects:
349
350 Subject: [patch 2/5] ext2: improve scalability of bitmap searching
351 Subject: [PATCHv2 001/207] x86: fix eflags tracking
352
353The "from" line must be the very first line in the message body,
354and has the form:
355
356 From: Original Author <author@example.com>
357
358The "from" line specifies who will be credited as the author of the
359patch in the permanent changelog. If the "from" line is missing,
360then the "From:" line from the email header will be used to determine
361the patch author in the changelog.
362
363The explanation body will be committed to the permanent source
364changelog, so should make sense to a competent reader who has long
365since forgotten the immediate details of the discussion that might
366have led to this patch.
367
368The "---" marker line serves the essential purpose of marking for patch
369handling tools where the changelog message ends.
370
371One good use for the additional comments after the "---" marker is for
372a diffstat, to show what files have changed, and the number of inserted
373and deleted lines per file. A diffstat is especially useful on bigger
374patches. Other comments relevant only to the moment or the maintainer,
375not suitable for the permanent changelog, should also go here.
376
377See more details on the proper patch format in the following
378references.
379
380
38113) More references for submitting patches
306 382
307Andrew Morton, "The perfect patch" (tpp). 383Andrew Morton, "The perfect patch" (tpp).
308 <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt> 384 <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt>
@@ -310,6 +386,14 @@ Andrew Morton, "The perfect patch" (tpp).
310Jeff Garzik, "Linux kernel patch submission format." 386Jeff Garzik, "Linux kernel patch submission format."
311 <http://linux.yyz.us/patch-format.html> 387 <http://linux.yyz.us/patch-format.html>
312 388
389Greg KH, "How to piss off a kernel subsystem maintainer"
390 <http://www.kroah.com/log/2005/03/31/>
391
392Kernel Documentation/CodingStyle
393 <http://sosdg.org/~coywolf/lxr/source/Documentation/CodingStyle>
394
395Linus Torvald's mail on the canonical patch format:
396 <http://lkml.org/lkml/2005/4/7/183>
313 397
314 398
315----------------------------------- 399-----------------------------------
diff --git a/Documentation/dell_rbu.txt b/Documentation/dell_rbu.txt
index 95d7f62e4dbc..941343a7a265 100644
--- a/Documentation/dell_rbu.txt
+++ b/Documentation/dell_rbu.txt
@@ -35,6 +35,7 @@ The driver load creates the following directories under the /sys file system.
35/sys/class/firmware/dell_rbu/data 35/sys/class/firmware/dell_rbu/data
36/sys/devices/platform/dell_rbu/image_type 36/sys/devices/platform/dell_rbu/image_type
37/sys/devices/platform/dell_rbu/data 37/sys/devices/platform/dell_rbu/data
38/sys/devices/platform/dell_rbu/packet_size
38 39
39The driver supports two types of update mechanism; monolithic and packetized. 40The driver supports two types of update mechanism; monolithic and packetized.
40These update mechanism depends upon the BIOS currently running on the system. 41These update mechanism depends upon the BIOS currently running on the system.
@@ -47,8 +48,26 @@ By default the driver uses monolithic memory for the update type. This can be
47changed to packets during the driver load time by specifying the load 48changed to packets during the driver load time by specifying the load
48parameter image_type=packet. This can also be changed later as below 49parameter image_type=packet. This can also be changed later as below
49echo packet > /sys/devices/platform/dell_rbu/image_type 50echo packet > /sys/devices/platform/dell_rbu/image_type
50Also echoing either mono ,packet or init in to image_type will free up the 51
51memory allocated by the driver. 52In packet update mode the packet size has to be given before any packets can
53be downloaded. It is done as below
54echo XXXX > /sys/devices/platform/dell_rbu/packet_size
55In the packet update mechanism, the user neesd to create a new file having
56packets of data arranged back to back. It can be done as follows
57The user creates packets header, gets the chunk of the BIOS image and
58placs it next to the packetheader; now, the packetheader + BIOS image chunk
59added to geather should match the specified packet_size. This makes one
60packet, the user needs to create more such packets out of the entire BIOS
61image file and then arrange all these packets back to back in to one single
62file.
63This file is then copied to /sys/class/firmware/dell_rbu/data.
64Once this file gets to the driver, the driver extracts packet_size data from
65the file and spreads it accross the physical memory in contiguous packet_sized
66space.
67This method makes sure that all the packets get to the driver in a single operation.
68
69In monolithic update the user simply get the BIOS image (.hdr file) and copies
70to the data file as is without any change to the BIOS image itself.
52 71
53Do the steps below to download the BIOS image. 72Do the steps below to download the BIOS image.
541) echo 1 > /sys/class/firmware/dell_rbu/loading 731) echo 1 > /sys/class/firmware/dell_rbu/loading
@@ -58,7 +77,10 @@ Do the steps below to download the BIOS image.
58The /sys/class/firmware/dell_rbu/ entries will remain till the following is 77The /sys/class/firmware/dell_rbu/ entries will remain till the following is
59done. 78done.
60echo -1 > /sys/class/firmware/dell_rbu/loading. 79echo -1 > /sys/class/firmware/dell_rbu/loading.
61Until this step is completed the drivr cannot be unloaded. 80Until this step is completed the driver cannot be unloaded.
81Also echoing either mono ,packet or init in to image_type will free up the
82memory allocated by the driver.
83
62If an user by accident executes steps 1 and 3 above without executing step 2; 84If an user by accident executes steps 1 and 3 above without executing step 2;
63it will make the /sys/class/firmware/dell_rbu/ entries to disappear. 85it will make the /sys/class/firmware/dell_rbu/ entries to disappear.
64The entries can be recreated by doing the following 86The entries can be recreated by doing the following
@@ -66,15 +88,11 @@ echo init > /sys/devices/platform/dell_rbu/image_type
66NOTE: echoing init in image_type does not change it original value. 88NOTE: echoing init in image_type does not change it original value.
67 89
68Also the driver provides /sys/devices/platform/dell_rbu/data readonly file to 90Also the driver provides /sys/devices/platform/dell_rbu/data readonly file to
69read back the image downloaded. This is useful in case of packet update 91read back the image downloaded.
70mechanism where the above steps 1,2,3 will repeated for every packet.
71By reading the /sys/devices/platform/dell_rbu/data file all packet data
72downloaded can be verified in a single file.
73The packets are arranged in this file one after the other in a FIFO order.
74 92
75NOTE: 93NOTE:
76This driver requires a patch for firmware_class.c which has the addition 94This driver requires a patch for firmware_class.c which has the modified
77of request_firmware_nowait_nohotplug function to wortk 95request_firmware_nowait function.
78Also after updating the BIOS image an user mdoe application neeeds to execute 96Also after updating the BIOS image an user mdoe application neeeds to execute
79code which message the BIOS update request to the BIOS. So on the next reboot 97code which message the BIOS update request to the BIOS. So on the next reboot
80the BIOS knows about the new image downloaded and it updates it self. 98the BIOS knows about the new image downloaded and it updates it self.
diff --git a/Documentation/keys-request-key.txt b/Documentation/keys-request-key.txt
new file mode 100644
index 000000000000..5f2b9c5edbb5
--- /dev/null
+++ b/Documentation/keys-request-key.txt
@@ -0,0 +1,161 @@
1 ===================
2 KEY REQUEST SERVICE
3 ===================
4
5The key request service is part of the key retention service (refer to
6Documentation/keys.txt). This document explains more fully how that the
7requesting algorithm works.
8
9The process starts by either the kernel requesting a service by calling
10request_key():
11
12 struct key *request_key(const struct key_type *type,
13 const char *description,
14 const char *callout_string);
15
16Or by userspace invoking the request_key system call:
17
18 key_serial_t request_key(const char *type,
19 const char *description,
20 const char *callout_info,
21 key_serial_t dest_keyring);
22
23The main difference between the two access points is that the in-kernel
24interface does not need to link the key to a keyring to prevent it from being
25immediately destroyed. The kernel interface returns a pointer directly to the
26key, and it's up to the caller to destroy the key.
27
28The userspace interface links the key to a keyring associated with the process
29to prevent the key from going away, and returns the serial number of the key to
30the caller.
31
32
33===========
34THE PROCESS
35===========
36
37A request proceeds in the following manner:
38
39 (1) Process A calls request_key() [the userspace syscall calls the kernel
40 interface].
41
42 (2) request_key() searches the process's subscribed keyrings to see if there's
43 a suitable key there. If there is, it returns the key. If there isn't, and
44 callout_info is not set, an error is returned. Otherwise the process
45 proceeds to the next step.
46
47 (3) request_key() sees that A doesn't have the desired key yet, so it creates
48 two things:
49
50 (a) An uninstantiated key U of requested type and description.
51
52 (b) An authorisation key V that refers to key U and notes that process A
53 is the context in which key U should be instantiated and secured, and
54 from which associated key requests may be satisfied.
55
56 (4) request_key() then forks and executes /sbin/request-key with a new session
57 keyring that contains a link to auth key V.
58
59 (5) /sbin/request-key execs an appropriate program to perform the actual
60 instantiation.
61
62 (6) The program may want to access another key from A's context (say a
63 Kerberos TGT key). It just requests the appropriate key, and the keyring
64 search notes that the session keyring has auth key V in its bottom level.
65
66 This will permit it to then search the keyrings of process A with the
67 UID, GID, groups and security info of process A as if it was process A,
68 and come up with key W.
69
70 (7) The program then does what it must to get the data with which to
71 instantiate key U, using key W as a reference (perhaps it contacts a
72 Kerberos server using the TGT) and then instantiates key U.
73
74 (8) Upon instantiating key U, auth key V is automatically revoked so that it
75 may not be used again.
76
77 (9) The program then exits 0 and request_key() deletes key V and returns key
78 U to the caller.
79
80This also extends further. If key W (step 5 above) didn't exist, key W would be
81created uninstantiated, another auth key (X) would be created [as per step 3]
82and another copy of /sbin/request-key spawned [as per step 4]; but the context
83specified by auth key X will still be process A, as it was in auth key V.
84
85This is because process A's keyrings can't simply be attached to
86/sbin/request-key at the appropriate places because (a) execve will discard two
87of them, and (b) it requires the same UID/GID/Groups all the way through.
88
89
90======================
91NEGATIVE INSTANTIATION
92======================
93
94Rather than instantiating a key, it is possible for the possessor of an
95authorisation key to negatively instantiate a key that's under construction.
96This is a short duration placeholder that causes any attempt at re-requesting
97the key whilst it exists to fail with error ENOKEY.
98
99This is provided to prevent excessive repeated spawning of /sbin/request-key
100processes for a key that will never be obtainable.
101
102Should the /sbin/request-key process exit anything other than 0 or die on a
103signal, the key under construction will be automatically negatively
104instantiated for a short amount of time.
105
106
107====================
108THE SEARCH ALGORITHM
109====================
110
111A search of any particular keyring proceeds in the following fashion:
112
113 (1) When the key management code searches for a key (keyring_search_aux) it
114 firstly calls key_permission(SEARCH) on the keyring it's starting with,
115 if this denies permission, it doesn't search further.
116
117 (2) It considers all the non-keyring keys within that keyring and, if any key
118 matches the criteria specified, calls key_permission(SEARCH) on it to see
119 if the key is allowed to be found. If it is, that key is returned; if
120 not, the search continues, and the error code is retained if of higher
121 priority than the one currently set.
122
123 (3) It then considers all the keyring-type keys in the keyring it's currently
124 searching. It calls key_permission(SEARCH) on each keyring, and if this
125 grants permission, it recurses, executing steps (2) and (3) on that
126 keyring.
127
128The process stops immediately a valid key is found with permission granted to
129use it. Any error from a previous match attempt is discarded and the key is
130returned.
131
132When search_process_keyrings() is invoked, it performs the following searches
133until one succeeds:
134
135 (1) If extant, the process's thread keyring is searched.
136
137 (2) If extant, the process's process keyring is searched.
138
139 (3) The process's session keyring is searched.
140
141 (4) If the process has a request_key() authorisation key in its session
142 keyring then:
143
144 (a) If extant, the calling process's thread keyring is searched.
145
146 (b) If extant, the calling process's process keyring is searched.
147
148 (c) The calling process's session keyring is searched.
149
150The moment one succeeds, all pending errors are discarded and the found key is
151returned.
152
153Only if all these fail does the whole thing fail with the highest priority
154error. Note that several errors may have come from LSM.
155
156The error priority is:
157
158 EKEYREVOKED > EKEYEXPIRED > ENOKEY
159
160EACCES/EPERM are only returned on a direct search of a specific keyring where
161the basal keyring does not grant Search permission.
diff --git a/Documentation/keys.txt b/Documentation/keys.txt
index b22e7c8d059a..4afe03a58c5b 100644
--- a/Documentation/keys.txt
+++ b/Documentation/keys.txt
@@ -361,6 +361,8 @@ The main syscalls are:
361 /sbin/request-key will be invoked in an attempt to obtain a key. The 361 /sbin/request-key will be invoked in an attempt to obtain a key. The
362 callout_info string will be passed as an argument to the program. 362 callout_info string will be passed as an argument to the program.
363 363
364 See also Documentation/keys-request-key.txt.
365
364 366
365The keyctl syscall functions are: 367The keyctl syscall functions are:
366 368
@@ -533,8 +535,8 @@ The keyctl syscall functions are:
533 535
534 (*) Read the payload data from a key: 536 (*) Read the payload data from a key:
535 537
536 key_serial_t keyctl(KEYCTL_READ, key_serial_t keyring, char *buffer, 538 long keyctl(KEYCTL_READ, key_serial_t keyring, char *buffer,
537 size_t buflen); 539 size_t buflen);
538 540
539 This function attempts to read the payload data from the specified key 541 This function attempts to read the payload data from the specified key
540 into the buffer. The process must have read permission on the key to 542 into the buffer. The process must have read permission on the key to
@@ -555,9 +557,9 @@ The keyctl syscall functions are:
555 557
556 (*) Instantiate a partially constructed key. 558 (*) Instantiate a partially constructed key.
557 559
558 key_serial_t keyctl(KEYCTL_INSTANTIATE, key_serial_t key, 560 long keyctl(KEYCTL_INSTANTIATE, key_serial_t key,
559 const void *payload, size_t plen, 561 const void *payload, size_t plen,
560 key_serial_t keyring); 562 key_serial_t keyring);
561 563
562 If the kernel calls back to userspace to complete the instantiation of a 564 If the kernel calls back to userspace to complete the instantiation of a
563 key, userspace should use this call to supply data for the key before the 565 key, userspace should use this call to supply data for the key before the
@@ -576,8 +578,8 @@ The keyctl syscall functions are:
576 578
577 (*) Negatively instantiate a partially constructed key. 579 (*) Negatively instantiate a partially constructed key.
578 580
579 key_serial_t keyctl(KEYCTL_NEGATE, key_serial_t key, 581 long keyctl(KEYCTL_NEGATE, key_serial_t key,
580 unsigned timeout, key_serial_t keyring); 582 unsigned timeout, key_serial_t keyring);
581 583
582 If the kernel calls back to userspace to complete the instantiation of a 584 If the kernel calls back to userspace to complete the instantiation of a
583 key, userspace should use this call mark the key as negative before the 585 key, userspace should use this call mark the key as negative before the
@@ -688,6 +690,8 @@ payload contents" for more information.
688 If successful, the key will have been attached to the default keyring for 690 If successful, the key will have been attached to the default keyring for
689 implicitly obtained request-key keys, as set by KEYCTL_SET_REQKEY_KEYRING. 691 implicitly obtained request-key keys, as set by KEYCTL_SET_REQKEY_KEYRING.
690 692
693 See also Documentation/keys-request-key.txt.
694
691 695
692(*) When it is no longer required, the key should be released using: 696(*) When it is no longer required, the key should be released using:
693 697
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index ab65714d95fc..b433c8a27e2d 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -355,10 +355,14 @@ ip_dynaddr - BOOLEAN
355 Default: 0 355 Default: 0
356 356
357icmp_echo_ignore_all - BOOLEAN 357icmp_echo_ignore_all - BOOLEAN
358 If set non-zero, then the kernel will ignore all ICMP ECHO
359 requests sent to it.
360 Default: 0
361
358icmp_echo_ignore_broadcasts - BOOLEAN 362icmp_echo_ignore_broadcasts - BOOLEAN
359 If either is set to true, then the kernel will ignore either all 363 If set non-zero, then the kernel will ignore all ICMP ECHO and
360 ICMP ECHO requests sent to it or just those to broadcast/multicast 364 TIMESTAMP requests sent to it via broadcast/multicast.
361 addresses, respectively. 365 Default: 1
362 366
363icmp_ratelimit - INTEGER 367icmp_ratelimit - INTEGER
364 Limit the maximal rates for sending ICMP packets whose type matches 368 Limit the maximal rates for sending ICMP packets whose type matches
diff --git a/MAINTAINERS b/MAINTAINERS
index c1bc9a86a99d..abf7f7a17ae0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1168,11 +1168,6 @@ L: linux1394-devel@lists.sourceforge.net
1168W: http://www.linux1394.org/ 1168W: http://www.linux1394.org/
1169S: Orphan 1169S: Orphan
1170 1170
1171IEEE 1394 SBP2
1172L: linux1394-devel@lists.sourceforge.net
1173W: http://www.linux1394.org/
1174S: Orphan
1175
1176IEEE 1394 SUBSYSTEM 1171IEEE 1394 SUBSYSTEM
1177P: Ben Collins 1172P: Ben Collins
1178M: bcollins@debian.org 1173M: bcollins@debian.org
@@ -1207,6 +1202,15 @@ L: linux1394-devel@lists.sourceforge.net
1207W: http://www.linux1394.org/ 1202W: http://www.linux1394.org/
1208S: Maintained 1203S: Maintained
1209 1204
1205IEEE 1394 SBP2
1206P: Ben Collins
1207M: bcollins@debian.org
1208P: Stefan Richter
1209M: stefanr@s5r6.in-berlin.de
1210L: linux1394-devel@lists.sourceforge.net
1211W: http://www.linux1394.org/
1212S: Maintained
1213
1210IMS TWINTURBO FRAMEBUFFER DRIVER 1214IMS TWINTURBO FRAMEBUFFER DRIVER
1211P: Paul Mundt 1215P: Paul Mundt
1212M: lethal@chaoticdreams.org 1216M: lethal@chaoticdreams.org
@@ -1743,8 +1747,11 @@ S: Maintained
1743IPVS 1747IPVS
1744P: Wensong Zhang 1748P: Wensong Zhang
1745M: wensong@linux-vs.org 1749M: wensong@linux-vs.org
1750P: Simon Horman
1751M: horms@verge.net.au
1746P: Julian Anastasov 1752P: Julian Anastasov
1747M: ja@ssi.bg 1753M: ja@ssi.bg
1754L: netdev@vger.kernel.org
1748S: Maintained 1755S: Maintained
1749 1756
1750NFS CLIENT 1757NFS CLIENT
diff --git a/Makefile b/Makefile
index 8cf6becf68dc..504ba3ceb296 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 14 3SUBLEVEL = 14
4EXTRAVERSION =-rc2 4EXTRAVERSION =-rc4
5NAME=Affluent Albatross 5NAME=Affluent Albatross
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index 76cc0cb5fc2e..e38671c922bc 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -196,6 +196,7 @@ entUna:
196 stq $26, 208($sp) 196 stq $26, 208($sp)
197 stq $27, 216($sp) 197 stq $27, 216($sp)
198 stq $28, 224($sp) 198 stq $28, 224($sp)
199 mov $sp, $19
199 stq $gp, 232($sp) 200 stq $gp, 232($sp)
200 lda $8, 0x3fff 201 lda $8, 0x3fff
201 stq $31, 248($sp) 202 stq $31, 248($sp)
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index 6f509a644bdd..f9d12319e0fb 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -446,16 +446,15 @@ struct unaligned_stat {
446 446
447 447
448/* Macro for exception fixup code to access integer registers. */ 448/* Macro for exception fixup code to access integer registers. */
449#define una_reg(r) (regs.regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)]) 449#define una_reg(r) (regs->regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)])
450 450
451 451
452asmlinkage void 452asmlinkage void
453do_entUna(void * va, unsigned long opcode, unsigned long reg, 453do_entUna(void * va, unsigned long opcode, unsigned long reg,
454 unsigned long a3, unsigned long a4, unsigned long a5, 454 struct allregs *regs)
455 struct allregs regs)
456{ 455{
457 long error, tmp1, tmp2, tmp3, tmp4; 456 long error, tmp1, tmp2, tmp3, tmp4;
458 unsigned long pc = regs.pc - 4; 457 unsigned long pc = regs->pc - 4;
459 const struct exception_table_entry *fixup; 458 const struct exception_table_entry *fixup;
460 459
461 unaligned[0].count++; 460 unaligned[0].count++;
@@ -636,7 +635,7 @@ got_exception:
636 printk("Forwarding unaligned exception at %lx (%lx)\n", 635 printk("Forwarding unaligned exception at %lx (%lx)\n",
637 pc, newpc); 636 pc, newpc);
638 637
639 (&regs)->pc = newpc; 638 regs->pc = newpc;
640 return; 639 return;
641 } 640 }
642 641
@@ -650,7 +649,7 @@ got_exception:
650 current->comm, current->pid); 649 current->comm, current->pid);
651 650
652 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n", 651 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n",
653 pc, una_reg(26), regs.ps); 652 pc, una_reg(26), regs->ps);
654 printk("r0 = %016lx r1 = %016lx r2 = %016lx\n", 653 printk("r0 = %016lx r1 = %016lx r2 = %016lx\n",
655 una_reg(0), una_reg(1), una_reg(2)); 654 una_reg(0), una_reg(1), una_reg(2));
656 printk("r3 = %016lx r4 = %016lx r5 = %016lx\n", 655 printk("r3 = %016lx r4 = %016lx r5 = %016lx\n",
@@ -670,10 +669,10 @@ got_exception:
670 una_reg(22), una_reg(23), una_reg(24)); 669 una_reg(22), una_reg(23), una_reg(24));
671 printk("r25= %016lx r27= %016lx r28= %016lx\n", 670 printk("r25= %016lx r27= %016lx r28= %016lx\n",
672 una_reg(25), una_reg(27), una_reg(28)); 671 una_reg(25), una_reg(27), una_reg(28));
673 printk("gp = %016lx sp = %p\n", regs.gp, &regs+1); 672 printk("gp = %016lx sp = %p\n", regs->gp, regs+1);
674 673
675 dik_show_code((unsigned int *)pc); 674 dik_show_code((unsigned int *)pc);
676 dik_show_trace((unsigned long *)(&regs+1)); 675 dik_show_trace((unsigned long *)(regs+1));
677 676
678 if (test_and_set_thread_flag (TIF_DIE_IF_KERNEL)) { 677 if (test_and_set_thread_flag (TIF_DIE_IF_KERNEL)) {
679 printk("die_if_kernel recursion detected.\n"); 678 printk("die_if_kernel recursion detected.\n");
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index d74990717559..c02dc8116a18 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -68,6 +68,7 @@ static void gic_unmask_irq(unsigned int irq)
68 writel(mask, gic_dist_base + GIC_DIST_ENABLE_SET + (irq / 32) * 4); 68 writel(mask, gic_dist_base + GIC_DIST_ENABLE_SET + (irq / 32) * 4);
69} 69}
70 70
71#ifdef CONFIG_SMP
71static void gic_set_cpu(struct irqdesc *desc, unsigned int irq, unsigned int cpu) 72static void gic_set_cpu(struct irqdesc *desc, unsigned int irq, unsigned int cpu)
72{ 73{
73 void __iomem *reg = gic_dist_base + GIC_DIST_TARGET + (irq & ~3); 74 void __iomem *reg = gic_dist_base + GIC_DIST_TARGET + (irq & ~3);
@@ -78,6 +79,7 @@ static void gic_set_cpu(struct irqdesc *desc, unsigned int irq, unsigned int cpu
78 val |= 1 << (cpu + shift); 79 val |= 1 << (cpu + shift);
79 writel(val, reg); 80 writel(val, reg);
80} 81}
82#endif
81 83
82static struct irqchip gic_chip = { 84static struct irqchip gic_chip = {
83 .ack = gic_ack_irq, 85 .ack = gic_ack_irq,
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index a7bd85700152..e8053d16829b 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -27,7 +27,6 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28 28
29#include <asm/hardware.h> 29#include <asm/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/io.h> 30#include <asm/io.h>
32#include <asm/irq.h> 31#include <asm/irq.h>
33#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index d3a04c2a2c85..9e5245c702de 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -26,6 +26,8 @@ struct scoop_pcmcia_dev *scoop_devs;
26struct scoop_dev { 26struct scoop_dev {
27 void *base; 27 void *base;
28 spinlock_t scoop_lock; 28 spinlock_t scoop_lock;
29 unsigned short suspend_clr;
30 unsigned short suspend_set;
29 u32 scoop_gpwr; 31 u32 scoop_gpwr;
30}; 32};
31 33
@@ -90,14 +92,24 @@ EXPORT_SYMBOL(reset_scoop);
90EXPORT_SYMBOL(read_scoop_reg); 92EXPORT_SYMBOL(read_scoop_reg);
91EXPORT_SYMBOL(write_scoop_reg); 93EXPORT_SYMBOL(write_scoop_reg);
92 94
95static void check_scoop_reg(struct scoop_dev *sdev)
96{
97 unsigned short mcr;
98
99 mcr = SCOOP_REG(sdev->base, SCOOP_MCR);
100 if ((mcr & 0x100) == 0)
101 SCOOP_REG(sdev->base, SCOOP_MCR) = 0x0101;
102}
103
93#ifdef CONFIG_PM 104#ifdef CONFIG_PM
94static int scoop_suspend(struct device *dev, pm_message_t state, uint32_t level) 105static int scoop_suspend(struct device *dev, pm_message_t state, uint32_t level)
95{ 106{
96 if (level == SUSPEND_POWER_DOWN) { 107 if (level == SUSPEND_POWER_DOWN) {
97 struct scoop_dev *sdev = dev_get_drvdata(dev); 108 struct scoop_dev *sdev = dev_get_drvdata(dev);
98 109
99 sdev->scoop_gpwr = SCOOP_REG(sdev->base,SCOOP_GPWR); 110 check_scoop_reg(sdev);
100 SCOOP_REG(sdev->base,SCOOP_GPWR) = 0; 111 sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
112 SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set;
101 } 113 }
102 return 0; 114 return 0;
103} 115}
@@ -107,6 +119,7 @@ static int scoop_resume(struct device *dev, uint32_t level)
107 if (level == RESUME_POWER_ON) { 119 if (level == RESUME_POWER_ON) {
108 struct scoop_dev *sdev = dev_get_drvdata(dev); 120 struct scoop_dev *sdev = dev_get_drvdata(dev);
109 121
122 check_scoop_reg(sdev);
110 SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr; 123 SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
111 } 124 }
112 return 0; 125 return 0;
@@ -151,6 +164,9 @@ int __init scoop_probe(struct device *dev)
151 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff; 164 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
152 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff; 165 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
153 166
167 devptr->suspend_clr = inf->suspend_clr;
168 devptr->suspend_set = inf->suspend_set;
169
154 return 0; 170 return 0;
155} 171}
156 172
diff --git a/arch/arm/configs/collie_defconfig b/arch/arm/configs/collie_defconfig
new file mode 100644
index 000000000000..40dfe07a8bce
--- /dev/null
+++ b/arch/arm/configs/collie_defconfig
@@ -0,0 +1,888 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc3
4# Sun Oct 9 16:55:14 2005
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16# CONFIG_CLEAN_COMPILE is not set
17CONFIG_BROKEN=y
18CONFIG_BROKEN_ON_SMP=y
19CONFIG_LOCK_KERNEL=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y
27CONFIG_SWAP=y
28CONFIG_SYSVIPC=y
29# CONFIG_POSIX_MQUEUE is not set
30CONFIG_BSD_PROCESS_ACCT=y
31# CONFIG_BSD_PROCESS_ACCT_V3 is not set
32CONFIG_SYSCTL=y
33# CONFIG_AUDIT is not set
34CONFIG_HOTPLUG=y
35CONFIG_KOBJECT_UEVENT=y
36# CONFIG_IKCONFIG is not set
37CONFIG_INITRAMFS_SOURCE=""
38CONFIG_EMBEDDED=y
39CONFIG_KALLSYMS=y
40# CONFIG_KALLSYMS_ALL is not set
41# CONFIG_KALLSYMS_EXTRA_PASS is not set
42CONFIG_PRINTK=y
43CONFIG_BUG=y
44CONFIG_BASE_FULL=y
45CONFIG_FUTEX=y
46CONFIG_EPOLL=y
47# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
48CONFIG_SHMEM=y
49CONFIG_CC_ALIGN_FUNCTIONS=0
50CONFIG_CC_ALIGN_LABELS=0
51CONFIG_CC_ALIGN_LOOPS=0
52CONFIG_CC_ALIGN_JUMPS=0
53# CONFIG_TINY_SHMEM is not set
54CONFIG_BASE_SMALL=0
55
56#
57# Loadable module support
58#
59CONFIG_MODULES=y
60CONFIG_MODULE_UNLOAD=y
61CONFIG_MODULE_FORCE_UNLOAD=y
62CONFIG_OBSOLETE_MODPARM=y
63CONFIG_MODVERSIONS=y
64# CONFIG_MODULE_SRCVERSION_ALL is not set
65CONFIG_KMOD=y
66
67#
68# System Type
69#
70# CONFIG_ARCH_CLPS7500 is not set
71# CONFIG_ARCH_CLPS711X is not set
72# CONFIG_ARCH_CO285 is not set
73# CONFIG_ARCH_EBSA110 is not set
74# CONFIG_ARCH_CAMELOT is not set
75# CONFIG_ARCH_FOOTBRIDGE is not set
76# CONFIG_ARCH_INTEGRATOR is not set
77# CONFIG_ARCH_IOP3XX is not set
78# CONFIG_ARCH_IXP4XX is not set
79# CONFIG_ARCH_IXP2000 is not set
80# CONFIG_ARCH_L7200 is not set
81# CONFIG_ARCH_PXA is not set
82# CONFIG_ARCH_RPC is not set
83CONFIG_ARCH_SA1100=y
84# CONFIG_ARCH_S3C2410 is not set
85# CONFIG_ARCH_SHARK is not set
86# CONFIG_ARCH_LH7A40X is not set
87# CONFIG_ARCH_OMAP is not set
88# CONFIG_ARCH_VERSATILE is not set
89# CONFIG_ARCH_IMX is not set
90# CONFIG_ARCH_H720X is not set
91# CONFIG_ARCH_AAEC2000 is not set
92
93#
94# SA11x0 Implementations
95#
96# CONFIG_SA1100_ASSABET is not set
97# CONFIG_SA1100_CERF is not set
98CONFIG_SA1100_COLLIE=y
99# CONFIG_SA1100_H3100 is not set
100# CONFIG_SA1100_H3600 is not set
101# CONFIG_SA1100_H3800 is not set
102# CONFIG_SA1100_BADGE4 is not set
103# CONFIG_SA1100_JORNADA720 is not set
104# CONFIG_SA1100_HACKKIT is not set
105# CONFIG_SA1100_LART is not set
106# CONFIG_SA1100_PLEB is not set
107# CONFIG_SA1100_SHANNON is not set
108# CONFIG_SA1100_SIMPAD is not set
109# CONFIG_SA1100_SSP is not set
110
111#
112# Processor Type
113#
114CONFIG_CPU_32=y
115CONFIG_CPU_SA1100=y
116CONFIG_CPU_32v4=y
117CONFIG_CPU_ABRT_EV4=y
118CONFIG_CPU_CACHE_V4WB=y
119CONFIG_CPU_CACHE_VIVT=y
120CONFIG_CPU_TLB_V4WB=y
121
122#
123# Processor Features
124#
125CONFIG_SHARP_LOCOMO=y
126CONFIG_SHARP_PARAM=y
127CONFIG_SHARP_SCOOP=y
128
129#
130# Bus support
131#
132CONFIG_ISA=y
133CONFIG_ISA_DMA_API=y
134
135#
136# PCCARD (PCMCIA/CardBus) support
137#
138# CONFIG_PCCARD is not set
139
140#
141# Kernel Features
142#
143# CONFIG_SMP is not set
144CONFIG_PREEMPT=y
145# CONFIG_NO_IDLE_HZ is not set
146CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
147CONFIG_SELECT_MEMORY_MODEL=y
148# CONFIG_FLATMEM_MANUAL is not set
149CONFIG_DISCONTIGMEM_MANUAL=y
150# CONFIG_SPARSEMEM_MANUAL is not set
151CONFIG_DISCONTIGMEM=y
152CONFIG_FLAT_NODE_MEM_MAP=y
153CONFIG_NEED_MULTIPLE_NODES=y
154# CONFIG_SPARSEMEM_STATIC is not set
155# CONFIG_LEDS is not set
156CONFIG_ALIGNMENT_TRAP=y
157
158#
159# Boot options
160#
161CONFIG_ZBOOT_ROM_TEXT=0x0
162CONFIG_ZBOOT_ROM_BSS=0x0
163CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug"
164# CONFIG_XIP_KERNEL is not set
165
166#
167# CPU Frequency scaling
168#
169# CONFIG_CPU_FREQ is not set
170
171#
172# Floating point emulation
173#
174
175#
176# At least one emulation must be selected
177#
178CONFIG_FPE_NWFPE=y
179# CONFIG_FPE_NWFPE_XP is not set
180# CONFIG_FPE_FASTFPE is not set
181
182#
183# Userspace binary formats
184#
185CONFIG_BINFMT_ELF=y
186CONFIG_BINFMT_AOUT=m
187CONFIG_BINFMT_MISC=m
188# CONFIG_ARTHUR is not set
189
190#
191# Power management options
192#
193CONFIG_PM=y
194CONFIG_APM=y
195
196#
197# Networking
198#
199CONFIG_NET=y
200
201#
202# Networking options
203#
204CONFIG_PACKET=y
205CONFIG_PACKET_MMAP=y
206CONFIG_UNIX=y
207# CONFIG_NET_KEY is not set
208CONFIG_INET=y
209# CONFIG_IP_MULTICAST is not set
210# CONFIG_IP_ADVANCED_ROUTER is not set
211CONFIG_IP_FIB_HASH=y
212# CONFIG_IP_PNP is not set
213# CONFIG_NET_IPIP is not set
214# CONFIG_NET_IPGRE is not set
215# CONFIG_ARPD is not set
216CONFIG_SYN_COOKIES=y
217# CONFIG_INET_AH is not set
218# CONFIG_INET_ESP is not set
219# CONFIG_INET_IPCOMP is not set
220# CONFIG_INET_TUNNEL is not set
221CONFIG_INET_DIAG=y
222CONFIG_INET_TCP_DIAG=y
223# CONFIG_TCP_CONG_ADVANCED is not set
224CONFIG_TCP_CONG_BIC=y
225# CONFIG_IPV6 is not set
226# CONFIG_NETFILTER is not set
227
228#
229# DCCP Configuration (EXPERIMENTAL)
230#
231# CONFIG_IP_DCCP is not set
232
233#
234# SCTP Configuration (EXPERIMENTAL)
235#
236# CONFIG_IP_SCTP is not set
237# CONFIG_ATM is not set
238# CONFIG_BRIDGE is not set
239# CONFIG_VLAN_8021Q is not set
240# CONFIG_DECNET is not set
241# CONFIG_LLC2 is not set
242# CONFIG_IPX is not set
243# CONFIG_ATALK is not set
244# CONFIG_X25 is not set
245# CONFIG_LAPB is not set
246# CONFIG_NET_DIVERT is not set
247# CONFIG_ECONET is not set
248# CONFIG_WAN_ROUTER is not set
249# CONFIG_NET_SCHED is not set
250# CONFIG_NET_CLS_ROUTE is not set
251
252#
253# Network testing
254#
255# CONFIG_NET_PKTGEN is not set
256# CONFIG_HAMRADIO is not set
257# CONFIG_IRDA is not set
258# CONFIG_BT is not set
259# CONFIG_IEEE80211 is not set
260
261#
262# Device Drivers
263#
264
265#
266# Generic Driver Options
267#
268CONFIG_STANDALONE=y
269CONFIG_PREVENT_FIRMWARE_BUILD=y
270CONFIG_FW_LOADER=m
271# CONFIG_DEBUG_DRIVER is not set
272
273#
274# Memory Technology Devices (MTD)
275#
276CONFIG_MTD=y
277# CONFIG_MTD_DEBUG is not set
278# CONFIG_MTD_CONCAT is not set
279CONFIG_MTD_PARTITIONS=y
280# CONFIG_MTD_REDBOOT_PARTS is not set
281# CONFIG_MTD_CMDLINE_PARTS is not set
282# CONFIG_MTD_AFS_PARTS is not set
283
284#
285# User Modules And Translation Layers
286#
287CONFIG_MTD_CHAR=y
288CONFIG_MTD_BLOCK=y
289# CONFIG_FTL is not set
290# CONFIG_NFTL is not set
291# CONFIG_INFTL is not set
292
293#
294# RAM/ROM/Flash chip drivers
295#
296# CONFIG_MTD_CFI is not set
297# CONFIG_MTD_JEDECPROBE is not set
298CONFIG_MTD_MAP_BANK_WIDTH_1=y
299CONFIG_MTD_MAP_BANK_WIDTH_2=y
300CONFIG_MTD_MAP_BANK_WIDTH_4=y
301# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
302# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
303# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
304CONFIG_MTD_CFI_I1=y
305CONFIG_MTD_CFI_I2=y
306# CONFIG_MTD_CFI_I4 is not set
307# CONFIG_MTD_CFI_I8 is not set
308# CONFIG_MTD_RAM is not set
309# CONFIG_MTD_ROM is not set
310# CONFIG_MTD_ABSENT is not set
311CONFIG_MTD_OBSOLETE_CHIPS=y
312# CONFIG_MTD_AMDSTD is not set
313CONFIG_MTD_SHARP=y
314# CONFIG_MTD_JEDEC is not set
315
316#
317# Mapping drivers for chip access
318#
319# CONFIG_MTD_COMPLEX_MAPPINGS is not set
320# CONFIG_MTD_PLATRAM is not set
321
322#
323# Self-contained MTD device drivers
324#
325# CONFIG_MTD_SLRAM is not set
326# CONFIG_MTD_PHRAM is not set
327# CONFIG_MTD_MTDRAM is not set
328# CONFIG_MTD_BLKMTD is not set
329# CONFIG_MTD_BLOCK2MTD is not set
330
331#
332# Disk-On-Chip Device Drivers
333#
334# CONFIG_MTD_DOC2000 is not set
335# CONFIG_MTD_DOC2001 is not set
336# CONFIG_MTD_DOC2001PLUS is not set
337
338#
339# NAND Flash Device Drivers
340#
341# CONFIG_MTD_NAND is not set
342
343#
344# Parallel port support
345#
346# CONFIG_PARPORT is not set
347
348#
349# Plug and Play support
350#
351# CONFIG_PNP is not set
352
353#
354# Block devices
355#
356# CONFIG_BLK_DEV_XD is not set
357# CONFIG_BLK_DEV_COW_COMMON is not set
358CONFIG_BLK_DEV_LOOP=y
359# CONFIG_BLK_DEV_CRYPTOLOOP is not set
360# CONFIG_BLK_DEV_NBD is not set
361CONFIG_BLK_DEV_RAM=y
362CONFIG_BLK_DEV_RAM_COUNT=16
363CONFIG_BLK_DEV_RAM_SIZE=1024
364CONFIG_BLK_DEV_INITRD=y
365# CONFIG_CDROM_PKTCDVD is not set
366
367#
368# IO Schedulers
369#
370CONFIG_IOSCHED_NOOP=y
371CONFIG_IOSCHED_AS=y
372CONFIG_IOSCHED_DEADLINE=y
373CONFIG_IOSCHED_CFQ=y
374CONFIG_ATA_OVER_ETH=m
375
376#
377# ATA/ATAPI/MFM/RLL support
378#
379# CONFIG_IDE is not set
380
381#
382# SCSI device support
383#
384# CONFIG_RAID_ATTRS is not set
385# CONFIG_SCSI is not set
386
387#
388# Multi-device support (RAID and LVM)
389#
390# CONFIG_MD is not set
391
392#
393# Fusion MPT device support
394#
395# CONFIG_FUSION is not set
396
397#
398# IEEE 1394 (FireWire) support
399#
400# CONFIG_IEEE1394 is not set
401
402#
403# I2O device support
404#
405
406#
407# Network device support
408#
409# CONFIG_NETDEVICES is not set
410# CONFIG_NETPOLL is not set
411# CONFIG_NET_POLL_CONTROLLER is not set
412
413#
414# ISDN subsystem
415#
416# CONFIG_ISDN is not set
417
418#
419# Input device support
420#
421CONFIG_INPUT=y
422
423#
424# Userland interfaces
425#
426# CONFIG_INPUT_MOUSEDEV is not set
427# CONFIG_INPUT_JOYDEV is not set
428CONFIG_INPUT_TSDEV=y
429CONFIG_INPUT_TSDEV_SCREEN_X=240
430CONFIG_INPUT_TSDEV_SCREEN_Y=320
431CONFIG_INPUT_EVDEV=y
432CONFIG_INPUT_EVBUG=y
433
434#
435# Input Device Drivers
436#
437CONFIG_INPUT_KEYBOARD=y
438# CONFIG_KEYBOARD_ATKBD is not set
439# CONFIG_KEYBOARD_SUNKBD is not set
440# CONFIG_KEYBOARD_LKKBD is not set
441CONFIG_KEYBOARD_LOCOMO=y
442# CONFIG_KEYBOARD_XTKBD is not set
443# CONFIG_KEYBOARD_NEWTON is not set
444# CONFIG_INPUT_MOUSE is not set
445# CONFIG_INPUT_JOYSTICK is not set
446# CONFIG_INPUT_TOUCHSCREEN is not set
447# CONFIG_INPUT_MISC is not set
448
449#
450# Hardware I/O ports
451#
452CONFIG_SERIO=y
453# CONFIG_SERIO_SERPORT is not set
454# CONFIG_SERIO_LIBPS2 is not set
455# CONFIG_SERIO_RAW is not set
456# CONFIG_GAMEPORT is not set
457
458#
459# Character devices
460#
461CONFIG_VT=y
462CONFIG_VT_CONSOLE=y
463CONFIG_HW_CONSOLE=y
464# CONFIG_SERIAL_NONSTANDARD is not set
465
466#
467# Serial drivers
468#
469# CONFIG_SERIAL_8250 is not set
470
471#
472# Non-8250 serial port support
473#
474CONFIG_SERIAL_SA1100=y
475CONFIG_SERIAL_SA1100_CONSOLE=y
476CONFIG_SERIAL_CORE=y
477CONFIG_SERIAL_CORE_CONSOLE=y
478CONFIG_UNIX98_PTYS=y
479# CONFIG_LEGACY_PTYS is not set
480
481#
482# IPMI
483#
484# CONFIG_IPMI_HANDLER is not set
485
486#
487# Watchdog Cards
488#
489# CONFIG_WATCHDOG is not set
490# CONFIG_NVRAM is not set
491# CONFIG_RTC is not set
492# CONFIG_DTLK is not set
493# CONFIG_R3964 is not set
494
495#
496# Ftape, the floppy tape device driver
497#
498# CONFIG_RAW_DRIVER is not set
499
500#
501# TPM devices
502#
503
504#
505# I2C support
506#
507CONFIG_I2C=m
508# CONFIG_I2C_CHARDEV is not set
509
510#
511# I2C Algorithms
512#
513CONFIG_I2C_ALGOBIT=m
514# CONFIG_I2C_ALGOPCF is not set
515# CONFIG_I2C_ALGOPCA is not set
516
517#
518# I2C Hardware Bus support
519#
520# CONFIG_I2C_ELEKTOR is not set
521# CONFIG_I2C_PARPORT_LIGHT is not set
522# CONFIG_I2C_STUB is not set
523# CONFIG_I2C_PCA_ISA is not set
524
525#
526# Miscellaneous I2C Chip support
527#
528# CONFIG_SENSORS_DS1337 is not set
529# CONFIG_SENSORS_DS1374 is not set
530# CONFIG_SENSORS_EEPROM is not set
531# CONFIG_SENSORS_PCF8574 is not set
532# CONFIG_SENSORS_PCA9539 is not set
533# CONFIG_SENSORS_PCF8591 is not set
534# CONFIG_SENSORS_RTC8564 is not set
535# CONFIG_SENSORS_MAX6875 is not set
536# CONFIG_I2C_DEBUG_CORE is not set
537# CONFIG_I2C_DEBUG_ALGO is not set
538# CONFIG_I2C_DEBUG_BUS is not set
539# CONFIG_I2C_DEBUG_CHIP is not set
540
541#
542# Hardware Monitoring support
543#
544CONFIG_HWMON=y
545# CONFIG_HWMON_VID is not set
546# CONFIG_SENSORS_ADM1021 is not set
547# CONFIG_SENSORS_ADM1025 is not set
548# CONFIG_SENSORS_ADM1026 is not set
549# CONFIG_SENSORS_ADM1031 is not set
550# CONFIG_SENSORS_ADM9240 is not set
551# CONFIG_SENSORS_ASB100 is not set
552# CONFIG_SENSORS_ATXP1 is not set
553# CONFIG_SENSORS_DS1621 is not set
554# CONFIG_SENSORS_FSCHER is not set
555# CONFIG_SENSORS_FSCPOS is not set
556# CONFIG_SENSORS_GL518SM is not set
557# CONFIG_SENSORS_GL520SM is not set
558# CONFIG_SENSORS_IT87 is not set
559# CONFIG_SENSORS_LM63 is not set
560# CONFIG_SENSORS_LM75 is not set
561# CONFIG_SENSORS_LM77 is not set
562# CONFIG_SENSORS_LM78 is not set
563# CONFIG_SENSORS_LM80 is not set
564# CONFIG_SENSORS_LM83 is not set
565# CONFIG_SENSORS_LM85 is not set
566# CONFIG_SENSORS_LM87 is not set
567# CONFIG_SENSORS_LM90 is not set
568# CONFIG_SENSORS_LM92 is not set
569# CONFIG_SENSORS_MAX1619 is not set
570# CONFIG_SENSORS_PC87360 is not set
571# CONFIG_SENSORS_SMSC47M1 is not set
572# CONFIG_SENSORS_SMSC47B397 is not set
573# CONFIG_SENSORS_W83781D is not set
574# CONFIG_SENSORS_W83792D is not set
575# CONFIG_SENSORS_W83L785TS is not set
576# CONFIG_SENSORS_W83627HF is not set
577# CONFIG_SENSORS_W83627EHF is not set
578# CONFIG_HWMON_DEBUG_CHIP is not set
579
580#
581# Misc devices
582#
583
584#
585# Multimedia Capabilities Port drivers
586#
587# CONFIG_MCP_SA11X0 is not set
588
589#
590# Multimedia devices
591#
592CONFIG_VIDEO_DEV=m
593
594#
595# Video For Linux
596#
597
598#
599# Video Adapters
600#
601# CONFIG_VIDEO_PMS is not set
602# CONFIG_VIDEO_CPIA is not set
603# CONFIG_VIDEO_SAA5246A is not set
604# CONFIG_VIDEO_SAA5249 is not set
605# CONFIG_TUNER_3036 is not set
606# CONFIG_VIDEO_OVCAMCHIP is not set
607
608#
609# Radio Adapters
610#
611# CONFIG_RADIO_CADET is not set
612# CONFIG_RADIO_RTRACK is not set
613# CONFIG_RADIO_RTRACK2 is not set
614# CONFIG_RADIO_AZTECH is not set
615# CONFIG_RADIO_GEMTEK is not set
616# CONFIG_RADIO_MAESTRO is not set
617# CONFIG_RADIO_SF16FMI is not set
618# CONFIG_RADIO_SF16FMR2 is not set
619# CONFIG_RADIO_TERRATEC is not set
620# CONFIG_RADIO_TRUST is not set
621# CONFIG_RADIO_TYPHOON is not set
622# CONFIG_RADIO_ZOLTRIX is not set
623
624#
625# Digital Video Broadcasting Devices
626#
627# CONFIG_DVB is not set
628
629#
630# Graphics support
631#
632CONFIG_FB=y
633CONFIG_FB_CFB_FILLRECT=y
634CONFIG_FB_CFB_COPYAREA=y
635CONFIG_FB_CFB_IMAGEBLIT=y
636CONFIG_FB_SOFT_CURSOR=y
637# CONFIG_FB_MACMODES is not set
638CONFIG_FB_MODE_HELPERS=y
639# CONFIG_FB_TILEBLITTING is not set
640CONFIG_FB_SA1100=y
641# CONFIG_FB_S1D13XXX is not set
642# CONFIG_FB_VIRTUAL is not set
643
644#
645# Console display driver support
646#
647# CONFIG_VGA_CONSOLE is not set
648# CONFIG_MDA_CONSOLE is not set
649CONFIG_DUMMY_CONSOLE=y
650CONFIG_FRAMEBUFFER_CONSOLE=y
651CONFIG_FONTS=y
652CONFIG_FONT_8x8=y
653# CONFIG_FONT_8x16 is not set
654# CONFIG_FONT_6x11 is not set
655# CONFIG_FONT_7x14 is not set
656# CONFIG_FONT_PEARL_8x8 is not set
657# CONFIG_FONT_ACORN_8x8 is not set
658# CONFIG_FONT_MINI_4x6 is not set
659# CONFIG_FONT_SUN8x16 is not set
660# CONFIG_FONT_SUN12x22 is not set
661# CONFIG_FONT_10x18 is not set
662
663#
664# Logo configuration
665#
666# CONFIG_LOGO is not set
667# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
668
669#
670# Sound
671#
672# CONFIG_SOUND is not set
673
674#
675# USB support
676#
677CONFIG_USB_ARCH_HAS_HCD=y
678# CONFIG_USB_ARCH_HAS_OHCI is not set
679# CONFIG_USB is not set
680
681#
682# USB Gadget Support
683#
684CONFIG_USB_GADGET=y
685# CONFIG_USB_GADGET_DEBUG_FILES is not set
686# CONFIG_USB_GADGET_NET2280 is not set
687# CONFIG_USB_GADGET_PXA2XX is not set
688# CONFIG_USB_GADGET_GOKU is not set
689# CONFIG_USB_GADGET_LH7A40X is not set
690# CONFIG_USB_GADGET_OMAP is not set
691# CONFIG_USB_GADGET_DUMMY_HCD is not set
692# CONFIG_USB_GADGET_DUALSPEED is not set
693
694#
695# MMC/SD Card support
696#
697# CONFIG_MMC is not set
698
699#
700# File systems
701#
702CONFIG_EXT2_FS=y
703CONFIG_EXT2_FS_XATTR=y
704CONFIG_EXT2_FS_POSIX_ACL=y
705CONFIG_EXT2_FS_SECURITY=y
706# CONFIG_EXT2_FS_XIP is not set
707# CONFIG_EXT3_FS is not set
708# CONFIG_JBD is not set
709CONFIG_FS_MBCACHE=y
710# CONFIG_REISERFS_FS is not set
711# CONFIG_JFS_FS is not set
712CONFIG_FS_POSIX_ACL=y
713# CONFIG_XFS_FS is not set
714# CONFIG_MINIX_FS is not set
715CONFIG_ROMFS_FS=y
716CONFIG_INOTIFY=y
717# CONFIG_QUOTA is not set
718# CONFIG_DNOTIFY is not set
719# CONFIG_AUTOFS_FS is not set
720# CONFIG_AUTOFS4_FS is not set
721# CONFIG_FUSE_FS is not set
722
723#
724# CD-ROM/DVD Filesystems
725#
726# CONFIG_ISO9660_FS is not set
727# CONFIG_UDF_FS is not set
728
729#
730# DOS/FAT/NT Filesystems
731#
732CONFIG_FAT_FS=y
733CONFIG_MSDOS_FS=y
734CONFIG_VFAT_FS=y
735CONFIG_FAT_DEFAULT_CODEPAGE=437
736CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
737# CONFIG_NTFS_FS is not set
738
739#
740# Pseudo filesystems
741#
742CONFIG_PROC_FS=y
743CONFIG_SYSFS=y
744CONFIG_TMPFS=y
745# CONFIG_HUGETLBFS is not set
746# CONFIG_HUGETLB_PAGE is not set
747CONFIG_RAMFS=y
748# CONFIG_RELAYFS_FS is not set
749
750#
751# Miscellaneous filesystems
752#
753# CONFIG_ADFS_FS is not set
754# CONFIG_AFFS_FS is not set
755# CONFIG_HFS_FS is not set
756# CONFIG_HFSPLUS_FS is not set
757# CONFIG_BEFS_FS is not set
758# CONFIG_BFS_FS is not set
759# CONFIG_EFS_FS is not set
760# CONFIG_JFFS_FS is not set
761CONFIG_JFFS2_FS=y
762CONFIG_JFFS2_FS_DEBUG=0
763CONFIG_JFFS2_FS_WRITEBUFFER=y
764# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
765CONFIG_JFFS2_ZLIB=y
766CONFIG_JFFS2_RTIME=y
767# CONFIG_JFFS2_RUBIN is not set
768CONFIG_CRAMFS=y
769# CONFIG_VXFS_FS is not set
770# CONFIG_HPFS_FS is not set
771# CONFIG_QNX4FS_FS is not set
772# CONFIG_SYSV_FS is not set
773# CONFIG_UFS_FS is not set
774
775#
776# Network File Systems
777#
778# CONFIG_NFS_FS is not set
779# CONFIG_NFSD is not set
780# CONFIG_SMB_FS is not set
781# CONFIG_CIFS is not set
782# CONFIG_NCP_FS is not set
783# CONFIG_CODA_FS is not set
784# CONFIG_AFS_FS is not set
785# CONFIG_9P_FS is not set
786
787#
788# Partition Types
789#
790# CONFIG_PARTITION_ADVANCED is not set
791CONFIG_MSDOS_PARTITION=y
792
793#
794# Native Language Support
795#
796CONFIG_NLS=y
797CONFIG_NLS_DEFAULT="cp437"
798CONFIG_NLS_CODEPAGE_437=m
799# CONFIG_NLS_CODEPAGE_737 is not set
800# CONFIG_NLS_CODEPAGE_775 is not set
801# CONFIG_NLS_CODEPAGE_850 is not set
802# CONFIG_NLS_CODEPAGE_852 is not set
803# CONFIG_NLS_CODEPAGE_855 is not set
804# CONFIG_NLS_CODEPAGE_857 is not set
805# CONFIG_NLS_CODEPAGE_860 is not set
806# CONFIG_NLS_CODEPAGE_861 is not set
807# CONFIG_NLS_CODEPAGE_862 is not set
808# CONFIG_NLS_CODEPAGE_863 is not set
809# CONFIG_NLS_CODEPAGE_864 is not set
810# CONFIG_NLS_CODEPAGE_865 is not set
811# CONFIG_NLS_CODEPAGE_866 is not set
812# CONFIG_NLS_CODEPAGE_869 is not set
813# CONFIG_NLS_CODEPAGE_936 is not set
814# CONFIG_NLS_CODEPAGE_950 is not set
815# CONFIG_NLS_CODEPAGE_932 is not set
816# CONFIG_NLS_CODEPAGE_949 is not set
817# CONFIG_NLS_CODEPAGE_874 is not set
818# CONFIG_NLS_ISO8859_8 is not set
819# CONFIG_NLS_CODEPAGE_1250 is not set
820# CONFIG_NLS_CODEPAGE_1251 is not set
821# CONFIG_NLS_ASCII is not set
822CONFIG_NLS_ISO8859_1=m
823# CONFIG_NLS_ISO8859_2 is not set
824# CONFIG_NLS_ISO8859_3 is not set
825# CONFIG_NLS_ISO8859_4 is not set
826# CONFIG_NLS_ISO8859_5 is not set
827# CONFIG_NLS_ISO8859_6 is not set
828# CONFIG_NLS_ISO8859_7 is not set
829# CONFIG_NLS_ISO8859_9 is not set
830# CONFIG_NLS_ISO8859_13 is not set
831# CONFIG_NLS_ISO8859_14 is not set
832# CONFIG_NLS_ISO8859_15 is not set
833# CONFIG_NLS_KOI8_R is not set
834# CONFIG_NLS_KOI8_U is not set
835CONFIG_NLS_UTF8=m
836
837#
838# Profiling support
839#
840# CONFIG_PROFILING is not set
841
842#
843# Kernel hacking
844#
845# CONFIG_PRINTK_TIME is not set
846CONFIG_DEBUG_KERNEL=y
847CONFIG_MAGIC_SYSRQ=y
848CONFIG_LOG_BUF_SHIFT=14
849CONFIG_DETECT_SOFTLOCKUP=y
850# CONFIG_SCHEDSTATS is not set
851# CONFIG_DEBUG_SLAB is not set
852CONFIG_DEBUG_PREEMPT=y
853# CONFIG_DEBUG_SPINLOCK is not set
854# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
855# CONFIG_DEBUG_KOBJECT is not set
856# CONFIG_DEBUG_BUGVERBOSE is not set
857# CONFIG_DEBUG_INFO is not set
858# CONFIG_DEBUG_FS is not set
859CONFIG_FRAME_POINTER=y
860# CONFIG_DEBUG_USER is not set
861# CONFIG_DEBUG_WAITQ is not set
862CONFIG_DEBUG_ERRORS=y
863# CONFIG_DEBUG_LL is not set
864
865#
866# Security options
867#
868# CONFIG_KEYS is not set
869# CONFIG_SECURITY is not set
870
871#
872# Cryptographic options
873#
874# CONFIG_CRYPTO is not set
875
876#
877# Hardware crypto devices
878#
879
880#
881# Library routines
882#
883# CONFIG_CRC_CCITT is not set
884# CONFIG_CRC16 is not set
885CONFIG_CRC32=y
886# CONFIG_LIBCRC32C is not set
887CONFIG_ZLIB_INFLATE=y
888CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
new file mode 100644
index 000000000000..24987c89609a
--- /dev/null
+++ b/arch/arm/configs/corgi_defconfig
@@ -0,0 +1,1523 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc3
4# Sun Oct 9 15:46:42 2005
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_LOCALVERSION_AUTO=y
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29CONFIG_BSD_PROCESS_ACCT=y
30# CONFIG_BSD_PROCESS_ACCT_V3 is not set
31CONFIG_SYSCTL=y
32# CONFIG_AUDIT is not set
33CONFIG_HOTPLUG=y
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_INITRAMFS_SOURCE=""
37CONFIG_EMBEDDED=y
38CONFIG_KALLSYMS=y
39# CONFIG_KALLSYMS_ALL is not set
40# CONFIG_KALLSYMS_EXTRA_PASS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45CONFIG_EPOLL=y
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58CONFIG_MODULES=y
59CONFIG_MODULE_UNLOAD=y
60CONFIG_MODULE_FORCE_UNLOAD=y
61CONFIG_OBSOLETE_MODPARM=y
62# CONFIG_MODVERSIONS is not set
63# CONFIG_MODULE_SRCVERSION_ALL is not set
64CONFIG_KMOD=y
65
66#
67# System Type
68#
69# CONFIG_ARCH_CLPS7500 is not set
70# CONFIG_ARCH_CLPS711X is not set
71# CONFIG_ARCH_CO285 is not set
72# CONFIG_ARCH_EBSA110 is not set
73# CONFIG_ARCH_CAMELOT is not set
74# CONFIG_ARCH_FOOTBRIDGE is not set
75# CONFIG_ARCH_INTEGRATOR is not set
76# CONFIG_ARCH_IOP3XX is not set
77# CONFIG_ARCH_IXP4XX is not set
78# CONFIG_ARCH_IXP2000 is not set
79# CONFIG_ARCH_L7200 is not set
80CONFIG_ARCH_PXA=y
81# CONFIG_ARCH_RPC is not set
82# CONFIG_ARCH_SA1100 is not set
83# CONFIG_ARCH_S3C2410 is not set
84# CONFIG_ARCH_SHARK is not set
85# CONFIG_ARCH_LH7A40X is not set
86# CONFIG_ARCH_OMAP is not set
87# CONFIG_ARCH_VERSATILE is not set
88# CONFIG_ARCH_IMX is not set
89# CONFIG_ARCH_H720X is not set
90# CONFIG_ARCH_AAEC2000 is not set
91
92#
93# Intel PXA2xx Implementations
94#
95# CONFIG_ARCH_LUBBOCK is not set
96# CONFIG_MACH_MAINSTONE is not set
97# CONFIG_ARCH_PXA_IDP is not set
98CONFIG_PXA_SHARPSL=y
99CONFIG_PXA_SHARPSL_25x=y
100# CONFIG_PXA_SHARPSL_27x is not set
101# CONFIG_MACH_POODLE is not set
102CONFIG_MACH_CORGI=y
103CONFIG_MACH_SHEPHERD=y
104CONFIG_MACH_HUSKY=y
105CONFIG_PXA25x=y
106CONFIG_PXA_SHARP_C7xx=y
107
108#
109# Processor Type
110#
111CONFIG_CPU_32=y
112CONFIG_CPU_XSCALE=y
113CONFIG_CPU_32v5=y
114CONFIG_CPU_ABRT_EV5T=y
115CONFIG_CPU_CACHE_VIVT=y
116CONFIG_CPU_TLB_V4WBI=y
117
118#
119# Processor Features
120#
121CONFIG_ARM_THUMB=y
122CONFIG_XSCALE_PMU=y
123CONFIG_SHARP_PARAM=y
124CONFIG_SHARP_SCOOP=y
125
126#
127# Bus support
128#
129CONFIG_ISA_DMA_API=y
130
131#
132# PCCARD (PCMCIA/CardBus) support
133#
134CONFIG_PCCARD=y
135# CONFIG_PCMCIA_DEBUG is not set
136CONFIG_PCMCIA=y
137CONFIG_PCMCIA_LOAD_CIS=y
138CONFIG_PCMCIA_IOCTL=y
139
140#
141# PC-card bridges
142#
143CONFIG_PCMCIA_PXA2XX=y
144
145#
146# Kernel Features
147#
148CONFIG_PREEMPT=y
149# CONFIG_NO_IDLE_HZ is not set
150# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
151CONFIG_SELECT_MEMORY_MODEL=y
152CONFIG_FLATMEM_MANUAL=y
153# CONFIG_DISCONTIGMEM_MANUAL is not set
154# CONFIG_SPARSEMEM_MANUAL is not set
155CONFIG_FLATMEM=y
156CONFIG_FLAT_NODE_MEM_MAP=y
157# CONFIG_SPARSEMEM_STATIC is not set
158CONFIG_ALIGNMENT_TRAP=y
159
160#
161# Boot options
162#
163CONFIG_ZBOOT_ROM_TEXT=0x0
164CONFIG_ZBOOT_ROM_BSS=0x0
165CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug"
166# CONFIG_XIP_KERNEL is not set
167
168#
169# Floating point emulation
170#
171
172#
173# At least one emulation must be selected
174#
175CONFIG_FPE_NWFPE=y
176# CONFIG_FPE_NWFPE_XP is not set
177# CONFIG_FPE_FASTFPE is not set
178
179#
180# Userspace binary formats
181#
182CONFIG_BINFMT_ELF=y
183CONFIG_BINFMT_AOUT=m
184CONFIG_BINFMT_MISC=m
185# CONFIG_ARTHUR is not set
186
187#
188# Power management options
189#
190CONFIG_PM=y
191CONFIG_APM=y
192
193#
194# Networking
195#
196CONFIG_NET=y
197
198#
199# Networking options
200#
201CONFIG_PACKET=y
202CONFIG_PACKET_MMAP=y
203CONFIG_UNIX=y
204CONFIG_XFRM=y
205CONFIG_XFRM_USER=m
206# CONFIG_NET_KEY is not set
207CONFIG_INET=y
208# CONFIG_IP_MULTICAST is not set
209# CONFIG_IP_ADVANCED_ROUTER is not set
210CONFIG_IP_FIB_HASH=y
211# CONFIG_IP_PNP is not set
212# CONFIG_NET_IPIP is not set
213# CONFIG_NET_IPGRE is not set
214# CONFIG_ARPD is not set
215CONFIG_SYN_COOKIES=y
216# CONFIG_INET_AH is not set
217# CONFIG_INET_ESP is not set
218# CONFIG_INET_IPCOMP is not set
219# CONFIG_INET_TUNNEL is not set
220CONFIG_INET_DIAG=y
221CONFIG_INET_TCP_DIAG=y
222# CONFIG_TCP_CONG_ADVANCED is not set
223CONFIG_TCP_CONG_BIC=y
224
225#
226# IP: Virtual Server Configuration
227#
228# CONFIG_IP_VS is not set
229CONFIG_IPV6=m
230# CONFIG_IPV6_PRIVACY is not set
231CONFIG_INET6_AH=m
232CONFIG_INET6_ESP=m
233CONFIG_INET6_IPCOMP=m
234CONFIG_INET6_TUNNEL=m
235CONFIG_IPV6_TUNNEL=m
236CONFIG_NETFILTER=y
237# CONFIG_NETFILTER_DEBUG is not set
238# CONFIG_NETFILTER_NETLINK is not set
239
240#
241# IP: Netfilter Configuration
242#
243CONFIG_IP_NF_CONNTRACK=m
244# CONFIG_IP_NF_CT_ACCT is not set
245# CONFIG_IP_NF_CONNTRACK_MARK is not set
246# CONFIG_IP_NF_CONNTRACK_EVENTS is not set
247CONFIG_IP_NF_CT_PROTO_SCTP=m
248CONFIG_IP_NF_FTP=m
249CONFIG_IP_NF_IRC=m
250# CONFIG_IP_NF_NETBIOS_NS is not set
251CONFIG_IP_NF_TFTP=m
252CONFIG_IP_NF_AMANDA=m
253# CONFIG_IP_NF_PPTP is not set
254CONFIG_IP_NF_QUEUE=m
255CONFIG_IP_NF_IPTABLES=m
256CONFIG_IP_NF_MATCH_LIMIT=m
257CONFIG_IP_NF_MATCH_IPRANGE=m
258CONFIG_IP_NF_MATCH_MAC=m
259CONFIG_IP_NF_MATCH_PKTTYPE=m
260CONFIG_IP_NF_MATCH_MARK=m
261CONFIG_IP_NF_MATCH_MULTIPORT=m
262CONFIG_IP_NF_MATCH_TOS=m
263CONFIG_IP_NF_MATCH_RECENT=m
264CONFIG_IP_NF_MATCH_ECN=m
265CONFIG_IP_NF_MATCH_DSCP=m
266CONFIG_IP_NF_MATCH_AH_ESP=m
267CONFIG_IP_NF_MATCH_LENGTH=m
268CONFIG_IP_NF_MATCH_TTL=m
269CONFIG_IP_NF_MATCH_TCPMSS=m
270CONFIG_IP_NF_MATCH_HELPER=m
271CONFIG_IP_NF_MATCH_STATE=m
272CONFIG_IP_NF_MATCH_CONNTRACK=m
273CONFIG_IP_NF_MATCH_OWNER=m
274CONFIG_IP_NF_MATCH_ADDRTYPE=m
275CONFIG_IP_NF_MATCH_REALM=m
276CONFIG_IP_NF_MATCH_SCTP=m
277# CONFIG_IP_NF_MATCH_DCCP is not set
278CONFIG_IP_NF_MATCH_COMMENT=m
279CONFIG_IP_NF_MATCH_HASHLIMIT=m
280# CONFIG_IP_NF_MATCH_STRING is not set
281CONFIG_IP_NF_FILTER=m
282# CONFIG_IP_NF_TARGET_REJECT is not set
283CONFIG_IP_NF_TARGET_LOG=m
284CONFIG_IP_NF_TARGET_ULOG=m
285CONFIG_IP_NF_TARGET_TCPMSS=m
286# CONFIG_IP_NF_TARGET_NFQUEUE is not set
287CONFIG_IP_NF_NAT=m
288CONFIG_IP_NF_NAT_NEEDED=y
289# CONFIG_IP_NF_TARGET_MASQUERADE is not set
290# CONFIG_IP_NF_TARGET_REDIRECT is not set
291# CONFIG_IP_NF_TARGET_NETMAP is not set
292# CONFIG_IP_NF_TARGET_SAME is not set
293# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
294CONFIG_IP_NF_NAT_IRC=m
295CONFIG_IP_NF_NAT_FTP=m
296CONFIG_IP_NF_NAT_TFTP=m
297CONFIG_IP_NF_NAT_AMANDA=m
298CONFIG_IP_NF_MANGLE=m
299# CONFIG_IP_NF_TARGET_TOS is not set
300# CONFIG_IP_NF_TARGET_ECN is not set
301# CONFIG_IP_NF_TARGET_DSCP is not set
302# CONFIG_IP_NF_TARGET_MARK is not set
303# CONFIG_IP_NF_TARGET_CLASSIFY is not set
304# CONFIG_IP_NF_TARGET_TTL is not set
305CONFIG_IP_NF_RAW=m
306# CONFIG_IP_NF_TARGET_NOTRACK is not set
307CONFIG_IP_NF_ARPTABLES=m
308CONFIG_IP_NF_ARPFILTER=m
309CONFIG_IP_NF_ARP_MANGLE=m
310
311#
312# IPv6: Netfilter Configuration (EXPERIMENTAL)
313#
314CONFIG_IP6_NF_QUEUE=m
315CONFIG_IP6_NF_IPTABLES=m
316CONFIG_IP6_NF_MATCH_LIMIT=m
317CONFIG_IP6_NF_MATCH_MAC=m
318CONFIG_IP6_NF_MATCH_RT=m
319CONFIG_IP6_NF_MATCH_OPTS=m
320CONFIG_IP6_NF_MATCH_FRAG=m
321CONFIG_IP6_NF_MATCH_HL=m
322CONFIG_IP6_NF_MATCH_MULTIPORT=m
323CONFIG_IP6_NF_MATCH_OWNER=m
324CONFIG_IP6_NF_MATCH_MARK=m
325CONFIG_IP6_NF_MATCH_IPV6HEADER=m
326CONFIG_IP6_NF_MATCH_AHESP=m
327CONFIG_IP6_NF_MATCH_LENGTH=m
328CONFIG_IP6_NF_MATCH_EUI64=m
329CONFIG_IP6_NF_FILTER=m
330# CONFIG_IP6_NF_TARGET_LOG is not set
331# CONFIG_IP6_NF_TARGET_REJECT is not set
332# CONFIG_IP6_NF_TARGET_NFQUEUE is not set
333CONFIG_IP6_NF_MANGLE=m
334# CONFIG_IP6_NF_TARGET_MARK is not set
335# CONFIG_IP6_NF_TARGET_HL is not set
336CONFIG_IP6_NF_RAW=m
337
338#
339# DCCP Configuration (EXPERIMENTAL)
340#
341# CONFIG_IP_DCCP is not set
342
343#
344# SCTP Configuration (EXPERIMENTAL)
345#
346# CONFIG_IP_SCTP is not set
347# CONFIG_ATM is not set
348# CONFIG_BRIDGE is not set
349# CONFIG_VLAN_8021Q is not set
350# CONFIG_DECNET is not set
351# CONFIG_LLC2 is not set
352# CONFIG_IPX is not set
353# CONFIG_ATALK is not set
354# CONFIG_X25 is not set
355# CONFIG_LAPB is not set
356# CONFIG_NET_DIVERT is not set
357# CONFIG_ECONET is not set
358# CONFIG_WAN_ROUTER is not set
359# CONFIG_NET_SCHED is not set
360CONFIG_NET_CLS_ROUTE=y
361
362#
363# Network testing
364#
365# CONFIG_NET_PKTGEN is not set
366# CONFIG_HAMRADIO is not set
367CONFIG_IRDA=m
368
369#
370# IrDA protocols
371#
372CONFIG_IRLAN=m
373CONFIG_IRNET=m
374CONFIG_IRCOMM=m
375# CONFIG_IRDA_ULTRA is not set
376
377#
378# IrDA options
379#
380# CONFIG_IRDA_CACHE_LAST_LSAP is not set
381# CONFIG_IRDA_FAST_RR is not set
382# CONFIG_IRDA_DEBUG is not set
383
384#
385# Infrared-port device drivers
386#
387
388#
389# SIR device drivers
390#
391# CONFIG_IRTTY_SIR is not set
392
393#
394# Dongle support
395#
396
397#
398# Old SIR device drivers
399#
400# CONFIG_IRPORT_SIR is not set
401
402#
403# Old Serial dongle support
404#
405
406#
407# FIR device drivers
408#
409# CONFIG_USB_IRDA is not set
410# CONFIG_SIGMATEL_FIR is not set
411# CONFIG_NSC_FIR is not set
412# CONFIG_WINBOND_FIR is not set
413# CONFIG_SMC_IRCC_FIR is not set
414# CONFIG_ALI_FIR is not set
415# CONFIG_VIA_FIR is not set
416CONFIG_BT=m
417CONFIG_BT_L2CAP=m
418CONFIG_BT_SCO=m
419CONFIG_BT_RFCOMM=m
420CONFIG_BT_RFCOMM_TTY=y
421CONFIG_BT_BNEP=m
422CONFIG_BT_BNEP_MC_FILTER=y
423CONFIG_BT_BNEP_PROTO_FILTER=y
424CONFIG_BT_HIDP=m
425
426#
427# Bluetooth device drivers
428#
429CONFIG_BT_HCIUSB=m
430# CONFIG_BT_HCIUSB_SCO is not set
431CONFIG_BT_HCIUART=m
432CONFIG_BT_HCIUART_H4=y
433CONFIG_BT_HCIUART_BCSP=y
434CONFIG_BT_HCIUART_BCSP_TXCRC=y
435CONFIG_BT_HCIBCM203X=m
436CONFIG_BT_HCIBPA10X=m
437CONFIG_BT_HCIBFUSB=m
438CONFIG_BT_HCIDTL1=m
439CONFIG_BT_HCIBT3C=m
440CONFIG_BT_HCIBLUECARD=m
441CONFIG_BT_HCIBTUART=m
442CONFIG_BT_HCIVHCI=m
443CONFIG_IEEE80211=m
444# CONFIG_IEEE80211_DEBUG is not set
445CONFIG_IEEE80211_CRYPT_WEP=m
446# CONFIG_IEEE80211_CRYPT_CCMP is not set
447# CONFIG_IEEE80211_CRYPT_TKIP is not set
448
449#
450# Device Drivers
451#
452
453#
454# Generic Driver Options
455#
456CONFIG_STANDALONE=y
457CONFIG_PREVENT_FIRMWARE_BUILD=y
458CONFIG_FW_LOADER=y
459# CONFIG_DEBUG_DRIVER is not set
460
461#
462# Memory Technology Devices (MTD)
463#
464CONFIG_MTD=y
465# CONFIG_MTD_DEBUG is not set
466# CONFIG_MTD_CONCAT is not set
467CONFIG_MTD_PARTITIONS=y
468# CONFIG_MTD_REDBOOT_PARTS is not set
469CONFIG_MTD_CMDLINE_PARTS=y
470# CONFIG_MTD_AFS_PARTS is not set
471
472#
473# User Modules And Translation Layers
474#
475CONFIG_MTD_CHAR=y
476CONFIG_MTD_BLOCK=y
477# CONFIG_FTL is not set
478# CONFIG_NFTL is not set
479# CONFIG_INFTL is not set
480
481#
482# RAM/ROM/Flash chip drivers
483#
484# CONFIG_MTD_CFI is not set
485# CONFIG_MTD_JEDECPROBE is not set
486CONFIG_MTD_MAP_BANK_WIDTH_1=y
487CONFIG_MTD_MAP_BANK_WIDTH_2=y
488CONFIG_MTD_MAP_BANK_WIDTH_4=y
489# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
490# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
491# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
492CONFIG_MTD_CFI_I1=y
493CONFIG_MTD_CFI_I2=y
494# CONFIG_MTD_CFI_I4 is not set
495# CONFIG_MTD_CFI_I8 is not set
496# CONFIG_MTD_RAM is not set
497CONFIG_MTD_ROM=y
498# CONFIG_MTD_ABSENT is not set
499
500#
501# Mapping drivers for chip access
502#
503CONFIG_MTD_COMPLEX_MAPPINGS=y
504CONFIG_MTD_SHARP_SL=y
505# CONFIG_MTD_PLATRAM is not set
506
507#
508# Self-contained MTD device drivers
509#
510# CONFIG_MTD_SLRAM is not set
511# CONFIG_MTD_PHRAM is not set
512# CONFIG_MTD_MTDRAM is not set
513# CONFIG_MTD_BLKMTD is not set
514# CONFIG_MTD_BLOCK2MTD is not set
515
516#
517# Disk-On-Chip Device Drivers
518#
519# CONFIG_MTD_DOC2000 is not set
520# CONFIG_MTD_DOC2001 is not set
521# CONFIG_MTD_DOC2001PLUS is not set
522
523#
524# NAND Flash Device Drivers
525#
526CONFIG_MTD_NAND=y
527CONFIG_MTD_NAND_VERIFY_WRITE=y
528# CONFIG_MTD_NAND_H1900 is not set
529CONFIG_MTD_NAND_IDS=y
530# CONFIG_MTD_NAND_DISKONCHIP is not set
531CONFIG_MTD_NAND_SHARPSL=y
532# CONFIG_MTD_NAND_NANDSIM is not set
533
534#
535# Parallel port support
536#
537# CONFIG_PARPORT is not set
538
539#
540# Plug and Play support
541#
542
543#
544# Block devices
545#
546# CONFIG_BLK_DEV_COW_COMMON is not set
547CONFIG_BLK_DEV_LOOP=y
548# CONFIG_BLK_DEV_CRYPTOLOOP is not set
549# CONFIG_BLK_DEV_NBD is not set
550# CONFIG_BLK_DEV_UB is not set
551# CONFIG_BLK_DEV_RAM is not set
552CONFIG_BLK_DEV_RAM_COUNT=16
553# CONFIG_CDROM_PKTCDVD is not set
554
555#
556# IO Schedulers
557#
558CONFIG_IOSCHED_NOOP=y
559CONFIG_IOSCHED_AS=y
560CONFIG_IOSCHED_DEADLINE=y
561CONFIG_IOSCHED_CFQ=y
562# CONFIG_ATA_OVER_ETH is not set
563
564#
565# ATA/ATAPI/MFM/RLL support
566#
567CONFIG_IDE=y
568CONFIG_BLK_DEV_IDE=y
569
570#
571# Please see Documentation/ide.txt for help/info on IDE drives
572#
573# CONFIG_BLK_DEV_IDE_SATA is not set
574CONFIG_BLK_DEV_IDEDISK=y
575# CONFIG_IDEDISK_MULTI_MODE is not set
576CONFIG_BLK_DEV_IDECS=y
577# CONFIG_BLK_DEV_IDECD is not set
578# CONFIG_BLK_DEV_IDETAPE is not set
579# CONFIG_BLK_DEV_IDEFLOPPY is not set
580# CONFIG_BLK_DEV_IDESCSI is not set
581# CONFIG_IDE_TASK_IOCTL is not set
582
583#
584# IDE chipset support/bugfixes
585#
586CONFIG_IDE_GENERIC=y
587# CONFIG_IDE_ARM is not set
588# CONFIG_BLK_DEV_IDEDMA is not set
589# CONFIG_IDEDMA_AUTO is not set
590# CONFIG_BLK_DEV_HD is not set
591
592#
593# SCSI device support
594#
595# CONFIG_RAID_ATTRS is not set
596CONFIG_SCSI=m
597CONFIG_SCSI_PROC_FS=y
598
599#
600# SCSI support type (disk, tape, CD-ROM)
601#
602CONFIG_BLK_DEV_SD=m
603CONFIG_CHR_DEV_ST=m
604CONFIG_CHR_DEV_OSST=m
605CONFIG_BLK_DEV_SR=m
606# CONFIG_BLK_DEV_SR_VENDOR is not set
607CONFIG_CHR_DEV_SG=m
608# CONFIG_CHR_DEV_SCH is not set
609
610#
611# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
612#
613CONFIG_SCSI_MULTI_LUN=y
614# CONFIG_SCSI_CONSTANTS is not set
615# CONFIG_SCSI_LOGGING is not set
616
617#
618# SCSI Transport Attributes
619#
620# CONFIG_SCSI_SPI_ATTRS is not set
621# CONFIG_SCSI_FC_ATTRS is not set
622# CONFIG_SCSI_ISCSI_ATTRS is not set
623# CONFIG_SCSI_SAS_ATTRS is not set
624
625#
626# SCSI low-level drivers
627#
628# CONFIG_SCSI_SATA is not set
629# CONFIG_SCSI_DEBUG is not set
630
631#
632# PCMCIA SCSI adapter support
633#
634# CONFIG_PCMCIA_AHA152X is not set
635# CONFIG_PCMCIA_FDOMAIN is not set
636# CONFIG_PCMCIA_NINJA_SCSI is not set
637# CONFIG_PCMCIA_QLOGIC is not set
638# CONFIG_PCMCIA_SYM53C500 is not set
639
640#
641# Multi-device support (RAID and LVM)
642#
643# CONFIG_MD is not set
644
645#
646# Fusion MPT device support
647#
648# CONFIG_FUSION is not set
649
650#
651# IEEE 1394 (FireWire) support
652#
653
654#
655# I2O device support
656#
657
658#
659# Network device support
660#
661CONFIG_NETDEVICES=y
662# CONFIG_DUMMY is not set
663# CONFIG_BONDING is not set
664# CONFIG_EQUALIZER is not set
665# CONFIG_TUN is not set
666
667#
668# PHY device support
669#
670# CONFIG_PHYLIB is not set
671
672#
673# Ethernet (10 or 100Mbit)
674#
675CONFIG_NET_ETHERNET=y
676CONFIG_MII=m
677# CONFIG_SMC91X is not set
678# CONFIG_DM9000 is not set
679
680#
681# Ethernet (1000 Mbit)
682#
683
684#
685# Ethernet (10000 Mbit)
686#
687
688#
689# Token Ring devices
690#
691
692#
693# Wireless LAN (non-hamradio)
694#
695CONFIG_NET_RADIO=y
696
697#
698# Obsolete Wireless cards support (pre-802.11)
699#
700# CONFIG_STRIP is not set
701# CONFIG_PCMCIA_WAVELAN is not set
702# CONFIG_PCMCIA_NETWAVE is not set
703
704#
705# Wireless 802.11 Frequency Hopping cards support
706#
707# CONFIG_PCMCIA_RAYCS is not set
708
709#
710# Wireless 802.11b ISA/PCI cards support
711#
712CONFIG_HERMES=m
713# CONFIG_ATMEL is not set
714
715#
716# Wireless 802.11b Pcmcia/Cardbus cards support
717#
718CONFIG_PCMCIA_HERMES=m
719CONFIG_PCMCIA_SPECTRUM=m
720# CONFIG_AIRO_CS is not set
721# CONFIG_PCMCIA_WL3501 is not set
722CONFIG_HOSTAP=m
723CONFIG_HOSTAP_FIRMWARE=y
724CONFIG_HOSTAP_CS=m
725CONFIG_NET_WIRELESS=y
726
727#
728# PCMCIA network device support
729#
730CONFIG_NET_PCMCIA=y
731# CONFIG_PCMCIA_3C589 is not set
732# CONFIG_PCMCIA_3C574 is not set
733# CONFIG_PCMCIA_FMVJ18X is not set
734CONFIG_PCMCIA_PCNET=m
735# CONFIG_PCMCIA_NMCLAN is not set
736# CONFIG_PCMCIA_SMC91C92 is not set
737# CONFIG_PCMCIA_XIRC2PS is not set
738# CONFIG_PCMCIA_AXNET is not set
739
740#
741# Wan interfaces
742#
743# CONFIG_WAN is not set
744CONFIG_PPP=m
745# CONFIG_PPP_MULTILINK is not set
746# CONFIG_PPP_FILTER is not set
747CONFIG_PPP_ASYNC=m
748# CONFIG_PPP_SYNC_TTY is not set
749# CONFIG_PPP_DEFLATE is not set
750CONFIG_PPP_BSDCOMP=m
751# CONFIG_PPPOE is not set
752# CONFIG_SLIP is not set
753# CONFIG_SHAPER is not set
754# CONFIG_NETCONSOLE is not set
755# CONFIG_NETPOLL is not set
756# CONFIG_NET_POLL_CONTROLLER is not set
757
758#
759# ISDN subsystem
760#
761# CONFIG_ISDN is not set
762
763#
764# Input device support
765#
766CONFIG_INPUT=y
767
768#
769# Userland interfaces
770#
771# CONFIG_INPUT_MOUSEDEV is not set
772# CONFIG_INPUT_JOYDEV is not set
773# CONFIG_INPUT_TSDEV is not set
774CONFIG_INPUT_EVDEV=y
775# CONFIG_INPUT_EVBUG is not set
776
777#
778# Input Device Drivers
779#
780CONFIG_INPUT_KEYBOARD=y
781# CONFIG_KEYBOARD_ATKBD is not set
782# CONFIG_KEYBOARD_SUNKBD is not set
783# CONFIG_KEYBOARD_LKKBD is not set
784# CONFIG_KEYBOARD_XTKBD is not set
785# CONFIG_KEYBOARD_NEWTON is not set
786CONFIG_KEYBOARD_CORGI=y
787CONFIG_KEYBOARD_SPITZ=y
788# CONFIG_INPUT_MOUSE is not set
789# CONFIG_INPUT_JOYSTICK is not set
790CONFIG_INPUT_TOUCHSCREEN=y
791CONFIG_TOUCHSCREEN_CORGI=y
792# CONFIG_TOUCHSCREEN_GUNZE is not set
793# CONFIG_TOUCHSCREEN_ELO is not set
794# CONFIG_TOUCHSCREEN_MTOUCH is not set
795# CONFIG_TOUCHSCREEN_MK712 is not set
796CONFIG_INPUT_MISC=y
797CONFIG_INPUT_UINPUT=m
798
799#
800# Hardware I/O ports
801#
802# CONFIG_SERIO is not set
803# CONFIG_GAMEPORT is not set
804
805#
806# Character devices
807#
808CONFIG_VT=y
809CONFIG_VT_CONSOLE=y
810CONFIG_HW_CONSOLE=y
811# CONFIG_SERIAL_NONSTANDARD is not set
812
813#
814# Serial drivers
815#
816CONFIG_SERIAL_8250=m
817CONFIG_SERIAL_8250_CS=m
818CONFIG_SERIAL_8250_NR_UARTS=4
819# CONFIG_SERIAL_8250_EXTENDED is not set
820
821#
822# Non-8250 serial port support
823#
824CONFIG_SERIAL_PXA=y
825CONFIG_SERIAL_PXA_CONSOLE=y
826CONFIG_SERIAL_CORE=y
827CONFIG_SERIAL_CORE_CONSOLE=y
828CONFIG_UNIX98_PTYS=y
829# CONFIG_LEGACY_PTYS is not set
830
831#
832# IPMI
833#
834# CONFIG_IPMI_HANDLER is not set
835
836#
837# Watchdog Cards
838#
839# CONFIG_WATCHDOG is not set
840# CONFIG_NVRAM is not set
841# CONFIG_RTC is not set
842# CONFIG_DTLK is not set
843# CONFIG_R3964 is not set
844
845#
846# Ftape, the floppy tape device driver
847#
848
849#
850# PCMCIA character devices
851#
852# CONFIG_SYNCLINK_CS is not set
853# CONFIG_RAW_DRIVER is not set
854
855#
856# TPM devices
857#
858
859#
860# I2C support
861#
862CONFIG_I2C=y
863# CONFIG_I2C_CHARDEV is not set
864
865#
866# I2C Algorithms
867#
868CONFIG_I2C_ALGOBIT=y
869# CONFIG_I2C_ALGOPCF is not set
870# CONFIG_I2C_ALGOPCA is not set
871
872#
873# I2C Hardware Bus support
874#
875CONFIG_I2C_PXA=y
876# CONFIG_I2C_PXA_SLAVE is not set
877# CONFIG_I2C_PARPORT_LIGHT is not set
878# CONFIG_I2C_STUB is not set
879# CONFIG_I2C_PCA_ISA is not set
880
881#
882# Miscellaneous I2C Chip support
883#
884# CONFIG_SENSORS_DS1337 is not set
885# CONFIG_SENSORS_DS1374 is not set
886# CONFIG_SENSORS_EEPROM is not set
887# CONFIG_SENSORS_PCF8574 is not set
888# CONFIG_SENSORS_PCA9539 is not set
889# CONFIG_SENSORS_PCF8591 is not set
890# CONFIG_SENSORS_RTC8564 is not set
891# CONFIG_SENSORS_MAX6875 is not set
892# CONFIG_I2C_DEBUG_CORE is not set
893# CONFIG_I2C_DEBUG_ALGO is not set
894# CONFIG_I2C_DEBUG_BUS is not set
895# CONFIG_I2C_DEBUG_CHIP is not set
896
897#
898# Hardware Monitoring support
899#
900CONFIG_HWMON=y
901# CONFIG_HWMON_VID is not set
902# CONFIG_SENSORS_ADM1021 is not set
903# CONFIG_SENSORS_ADM1025 is not set
904# CONFIG_SENSORS_ADM1026 is not set
905# CONFIG_SENSORS_ADM1031 is not set
906# CONFIG_SENSORS_ADM9240 is not set
907# CONFIG_SENSORS_ASB100 is not set
908# CONFIG_SENSORS_ATXP1 is not set
909# CONFIG_SENSORS_DS1621 is not set
910# CONFIG_SENSORS_FSCHER is not set
911# CONFIG_SENSORS_FSCPOS is not set
912# CONFIG_SENSORS_GL518SM is not set
913# CONFIG_SENSORS_GL520SM is not set
914# CONFIG_SENSORS_IT87 is not set
915# CONFIG_SENSORS_LM63 is not set
916# CONFIG_SENSORS_LM75 is not set
917# CONFIG_SENSORS_LM77 is not set
918# CONFIG_SENSORS_LM78 is not set
919# CONFIG_SENSORS_LM80 is not set
920# CONFIG_SENSORS_LM83 is not set
921# CONFIG_SENSORS_LM85 is not set
922# CONFIG_SENSORS_LM87 is not set
923# CONFIG_SENSORS_LM90 is not set
924# CONFIG_SENSORS_LM92 is not set
925# CONFIG_SENSORS_MAX1619 is not set
926# CONFIG_SENSORS_PC87360 is not set
927# CONFIG_SENSORS_SMSC47M1 is not set
928# CONFIG_SENSORS_SMSC47B397 is not set
929# CONFIG_SENSORS_W83781D is not set
930# CONFIG_SENSORS_W83792D is not set
931# CONFIG_SENSORS_W83L785TS is not set
932# CONFIG_SENSORS_W83627HF is not set
933# CONFIG_SENSORS_W83627EHF is not set
934# CONFIG_HWMON_DEBUG_CHIP is not set
935
936#
937# Misc devices
938#
939
940#
941# Multimedia Capabilities Port drivers
942#
943
944#
945# Multimedia devices
946#
947CONFIG_VIDEO_DEV=m
948
949#
950# Video For Linux
951#
952
953#
954# Video Adapters
955#
956# CONFIG_VIDEO_CPIA is not set
957# CONFIG_VIDEO_SAA5246A is not set
958# CONFIG_VIDEO_SAA5249 is not set
959# CONFIG_TUNER_3036 is not set
960# CONFIG_VIDEO_OVCAMCHIP is not set
961
962#
963# Radio Adapters
964#
965# CONFIG_RADIO_MAESTRO is not set
966
967#
968# Digital Video Broadcasting Devices
969#
970# CONFIG_DVB is not set
971
972#
973# Graphics support
974#
975CONFIG_FB=y
976CONFIG_FB_CFB_FILLRECT=y
977CONFIG_FB_CFB_COPYAREA=y
978CONFIG_FB_CFB_IMAGEBLIT=y
979CONFIG_FB_SOFT_CURSOR=y
980# CONFIG_FB_MACMODES is not set
981# CONFIG_FB_MODE_HELPERS is not set
982# CONFIG_FB_TILEBLITTING is not set
983# CONFIG_FB_PXA is not set
984CONFIG_FB_W100=y
985# CONFIG_FB_S1D13XXX is not set
986# CONFIG_FB_VIRTUAL is not set
987
988#
989# Console display driver support
990#
991# CONFIG_VGA_CONSOLE is not set
992CONFIG_DUMMY_CONSOLE=y
993CONFIG_FRAMEBUFFER_CONSOLE=y
994CONFIG_FONTS=y
995CONFIG_FONT_8x8=y
996CONFIG_FONT_8x16=y
997# CONFIG_FONT_6x11 is not set
998# CONFIG_FONT_7x14 is not set
999# CONFIG_FONT_PEARL_8x8 is not set
1000# CONFIG_FONT_ACORN_8x8 is not set
1001# CONFIG_FONT_MINI_4x6 is not set
1002# CONFIG_FONT_SUN8x16 is not set
1003# CONFIG_FONT_SUN12x22 is not set
1004# CONFIG_FONT_10x18 is not set
1005
1006#
1007# Logo configuration
1008#
1009# CONFIG_LOGO is not set
1010CONFIG_BACKLIGHT_LCD_SUPPORT=y
1011CONFIG_BACKLIGHT_CLASS_DEVICE=y
1012CONFIG_BACKLIGHT_DEVICE=y
1013# CONFIG_LCD_CLASS_DEVICE is not set
1014CONFIG_BACKLIGHT_CORGI=y
1015
1016#
1017# Sound
1018#
1019CONFIG_SOUND=y
1020
1021#
1022# Advanced Linux Sound Architecture
1023#
1024# CONFIG_SND is not set
1025
1026#
1027# Open Sound System
1028#
1029CONFIG_SOUND_PRIME=y
1030# CONFIG_SOUND_MSNDCLAS is not set
1031# CONFIG_SOUND_MSNDPIN is not set
1032CONFIG_SOUND_OSS=y
1033# CONFIG_SOUND_TRACEINIT is not set
1034# CONFIG_SOUND_DMAP is not set
1035# CONFIG_SOUND_AD1816 is not set
1036# CONFIG_SOUND_SGALAXY is not set
1037# CONFIG_SOUND_ADLIB is not set
1038# CONFIG_SOUND_ACI_MIXER is not set
1039# CONFIG_SOUND_CS4232 is not set
1040# CONFIG_SOUND_SSCAPE is not set
1041# CONFIG_SOUND_GUS is not set
1042# CONFIG_SOUND_VMIDI is not set
1043# CONFIG_SOUND_TRIX is not set
1044# CONFIG_SOUND_MSS is not set
1045# CONFIG_SOUND_MPU401 is not set
1046# CONFIG_SOUND_NM256 is not set
1047# CONFIG_SOUND_MAD16 is not set
1048# CONFIG_SOUND_PAS is not set
1049# CONFIG_SOUND_PSS is not set
1050# CONFIG_SOUND_SB is not set
1051# CONFIG_SOUND_AWE32_SYNTH is not set
1052# CONFIG_SOUND_WAVEFRONT is not set
1053# CONFIG_SOUND_MAUI is not set
1054# CONFIG_SOUND_YM3812 is not set
1055# CONFIG_SOUND_OPL3SA1 is not set
1056# CONFIG_SOUND_OPL3SA2 is not set
1057# CONFIG_SOUND_UART6850 is not set
1058# CONFIG_SOUND_AEDSP16 is not set
1059# CONFIG_SOUND_TVMIXER is not set
1060# CONFIG_SOUND_AD1980 is not set
1061
1062#
1063# USB support
1064#
1065CONFIG_USB_ARCH_HAS_HCD=y
1066# CONFIG_USB_ARCH_HAS_OHCI is not set
1067CONFIG_USB=m
1068# CONFIG_USB_DEBUG is not set
1069
1070#
1071# Miscellaneous USB options
1072#
1073CONFIG_USB_DEVICEFS=y
1074# CONFIG_USB_BANDWIDTH is not set
1075# CONFIG_USB_DYNAMIC_MINORS is not set
1076# CONFIG_USB_SUSPEND is not set
1077# CONFIG_USB_OTG is not set
1078
1079#
1080# USB Host Controller Drivers
1081#
1082# CONFIG_USB_ISP116X_HCD is not set
1083CONFIG_USB_SL811_HCD=m
1084CONFIG_USB_SL811_CS=m
1085
1086#
1087# USB Device Class drivers
1088#
1089# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
1090
1091#
1092# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
1093#
1094CONFIG_USB_ACM=m
1095CONFIG_USB_PRINTER=m
1096
1097#
1098# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
1099#
1100CONFIG_USB_STORAGE=m
1101# CONFIG_USB_STORAGE_DEBUG is not set
1102# CONFIG_USB_STORAGE_DATAFAB is not set
1103# CONFIG_USB_STORAGE_FREECOM is not set
1104# CONFIG_USB_STORAGE_ISD200 is not set
1105# CONFIG_USB_STORAGE_DPCM is not set
1106# CONFIG_USB_STORAGE_USBAT is not set
1107# CONFIG_USB_STORAGE_SDDR09 is not set
1108# CONFIG_USB_STORAGE_SDDR55 is not set
1109# CONFIG_USB_STORAGE_JUMPSHOT is not set
1110# CONFIG_USB_STORAGE_ONETOUCH is not set
1111
1112#
1113# USB Input Devices
1114#
1115CONFIG_USB_HID=m
1116CONFIG_USB_HIDINPUT=y
1117# CONFIG_HID_FF is not set
1118# CONFIG_USB_HIDDEV is not set
1119
1120#
1121# USB HID Boot Protocol drivers
1122#
1123CONFIG_USB_KBD=m
1124CONFIG_USB_MOUSE=m
1125CONFIG_USB_AIPTEK=m
1126CONFIG_USB_WACOM=m
1127# CONFIG_USB_ACECAD is not set
1128CONFIG_USB_KBTAB=m
1129CONFIG_USB_POWERMATE=m
1130CONFIG_USB_MTOUCH=m
1131# CONFIG_USB_ITMTOUCH is not set
1132CONFIG_USB_EGALAX=m
1133# CONFIG_USB_YEALINK is not set
1134CONFIG_USB_XPAD=m
1135CONFIG_USB_ATI_REMOTE=m
1136# CONFIG_USB_KEYSPAN_REMOTE is not set
1137# CONFIG_USB_APPLETOUCH is not set
1138
1139#
1140# USB Imaging devices
1141#
1142CONFIG_USB_MDC800=m
1143CONFIG_USB_MICROTEK=m
1144
1145#
1146# USB Multimedia devices
1147#
1148CONFIG_USB_DABUSB=m
1149CONFIG_USB_VICAM=m
1150CONFIG_USB_DSBR=m
1151CONFIG_USB_IBMCAM=m
1152CONFIG_USB_KONICAWC=m
1153CONFIG_USB_OV511=m
1154CONFIG_USB_SE401=m
1155CONFIG_USB_SN9C102=m
1156CONFIG_USB_STV680=m
1157# CONFIG_USB_PWC is not set
1158
1159#
1160# USB Network Adapters
1161#
1162CONFIG_USB_CATC=m
1163CONFIG_USB_KAWETH=m
1164CONFIG_USB_PEGASUS=m
1165CONFIG_USB_RTL8150=m
1166CONFIG_USB_USBNET=m
1167CONFIG_USB_NET_AX8817X=m
1168CONFIG_USB_NET_CDCETHER=m
1169# CONFIG_USB_NET_GL620A is not set
1170CONFIG_USB_NET_NET1080=m
1171# CONFIG_USB_NET_PLUSB is not set
1172# CONFIG_USB_NET_RNDIS_HOST is not set
1173# CONFIG_USB_NET_CDC_SUBSET is not set
1174CONFIG_USB_NET_ZAURUS=m
1175# CONFIG_USB_ZD1201 is not set
1176CONFIG_USB_MON=y
1177
1178#
1179# USB port drivers
1180#
1181
1182#
1183# USB Serial Converter support
1184#
1185CONFIG_USB_SERIAL=m
1186CONFIG_USB_SERIAL_GENERIC=y
1187# CONFIG_USB_SERIAL_AIRPRIME is not set
1188CONFIG_USB_SERIAL_BELKIN=m
1189# CONFIG_USB_SERIAL_WHITEHEAT is not set
1190CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1191# CONFIG_USB_SERIAL_CP2101 is not set
1192CONFIG_USB_SERIAL_CYPRESS_M8=m
1193CONFIG_USB_SERIAL_EMPEG=m
1194CONFIG_USB_SERIAL_FTDI_SIO=m
1195CONFIG_USB_SERIAL_VISOR=m
1196CONFIG_USB_SERIAL_IPAQ=m
1197CONFIG_USB_SERIAL_IR=m
1198CONFIG_USB_SERIAL_EDGEPORT=m
1199CONFIG_USB_SERIAL_EDGEPORT_TI=m
1200CONFIG_USB_SERIAL_GARMIN=m
1201CONFIG_USB_SERIAL_IPW=m
1202CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1203CONFIG_USB_SERIAL_KEYSPAN=m
1204# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set
1205# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set
1206# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set
1207# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set
1208# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set
1209# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set
1210# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set
1211# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set
1212# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set
1213# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set
1214# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set
1215# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set
1216CONFIG_USB_SERIAL_KLSI=m
1217CONFIG_USB_SERIAL_KOBIL_SCT=m
1218CONFIG_USB_SERIAL_MCT_U232=m
1219CONFIG_USB_SERIAL_PL2303=m
1220# CONFIG_USB_SERIAL_HP4X is not set
1221CONFIG_USB_SERIAL_SAFE=m
1222# CONFIG_USB_SERIAL_SAFE_PADDED is not set
1223CONFIG_USB_SERIAL_TI=m
1224CONFIG_USB_SERIAL_CYBERJACK=m
1225CONFIG_USB_SERIAL_XIRCOM=m
1226CONFIG_USB_SERIAL_OMNINET=m
1227CONFIG_USB_EZUSB=y
1228
1229#
1230# USB Miscellaneous drivers
1231#
1232CONFIG_USB_EMI62=m
1233CONFIG_USB_EMI26=m
1234CONFIG_USB_AUERSWALD=m
1235CONFIG_USB_RIO500=m
1236CONFIG_USB_LEGOTOWER=m
1237CONFIG_USB_LCD=m
1238CONFIG_USB_LED=m
1239CONFIG_USB_CYTHERM=m
1240CONFIG_USB_PHIDGETKIT=m
1241CONFIG_USB_PHIDGETSERVO=m
1242CONFIG_USB_IDMOUSE=m
1243# CONFIG_USB_LD is not set
1244# CONFIG_USB_TEST is not set
1245
1246#
1247# USB DSL modem support
1248#
1249
1250#
1251# USB Gadget Support
1252#
1253CONFIG_USB_GADGET=y
1254# CONFIG_USB_GADGET_DEBUG_FILES is not set
1255CONFIG_USB_GADGET_SELECTED=y
1256# CONFIG_USB_GADGET_NET2280 is not set
1257CONFIG_USB_GADGET_PXA2XX=y
1258CONFIG_USB_PXA2XX=y
1259# CONFIG_USB_PXA2XX_SMALL is not set
1260# CONFIG_USB_GADGET_GOKU is not set
1261# CONFIG_USB_GADGET_LH7A40X is not set
1262# CONFIG_USB_GADGET_OMAP is not set
1263# CONFIG_USB_GADGET_DUMMY_HCD is not set
1264# CONFIG_USB_GADGET_DUALSPEED is not set
1265CONFIG_USB_ZERO=m
1266CONFIG_USB_ETH=m
1267CONFIG_USB_ETH_RNDIS=y
1268CONFIG_USB_GADGETFS=m
1269CONFIG_USB_FILE_STORAGE=m
1270# CONFIG_USB_FILE_STORAGE_TEST is not set
1271CONFIG_USB_G_SERIAL=m
1272
1273#
1274# MMC/SD Card support
1275#
1276CONFIG_MMC=y
1277# CONFIG_MMC_DEBUG is not set
1278CONFIG_MMC_BLOCK=y
1279CONFIG_MMC_PXA=y
1280# CONFIG_MMC_WBSD is not set
1281
1282#
1283# File systems
1284#
1285CONFIG_EXT2_FS=y
1286# CONFIG_EXT2_FS_XATTR is not set
1287# CONFIG_EXT2_FS_XIP is not set
1288# CONFIG_EXT3_FS is not set
1289# CONFIG_JBD is not set
1290# CONFIG_REISERFS_FS is not set
1291# CONFIG_JFS_FS is not set
1292# CONFIG_FS_POSIX_ACL is not set
1293# CONFIG_XFS_FS is not set
1294# CONFIG_MINIX_FS is not set
1295# CONFIG_ROMFS_FS is not set
1296CONFIG_INOTIFY=y
1297# CONFIG_QUOTA is not set
1298CONFIG_DNOTIFY=y
1299# CONFIG_AUTOFS_FS is not set
1300# CONFIG_AUTOFS4_FS is not set
1301# CONFIG_FUSE_FS is not set
1302
1303#
1304# CD-ROM/DVD Filesystems
1305#
1306# CONFIG_ISO9660_FS is not set
1307# CONFIG_UDF_FS is not set
1308
1309#
1310# DOS/FAT/NT Filesystems
1311#
1312CONFIG_FAT_FS=y
1313CONFIG_MSDOS_FS=y
1314CONFIG_VFAT_FS=y
1315CONFIG_FAT_DEFAULT_CODEPAGE=437
1316CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1317# CONFIG_NTFS_FS is not set
1318
1319#
1320# Pseudo filesystems
1321#
1322CONFIG_PROC_FS=y
1323CONFIG_SYSFS=y
1324CONFIG_TMPFS=y
1325# CONFIG_HUGETLB_PAGE is not set
1326CONFIG_RAMFS=y
1327# CONFIG_RELAYFS_FS is not set
1328
1329#
1330# Miscellaneous filesystems
1331#
1332# CONFIG_ADFS_FS is not set
1333# CONFIG_AFFS_FS is not set
1334# CONFIG_HFS_FS is not set
1335# CONFIG_HFSPLUS_FS is not set
1336# CONFIG_BEFS_FS is not set
1337# CONFIG_BFS_FS is not set
1338# CONFIG_EFS_FS is not set
1339# CONFIG_JFFS_FS is not set
1340CONFIG_JFFS2_FS=y
1341CONFIG_JFFS2_FS_DEBUG=0
1342CONFIG_JFFS2_FS_WRITEBUFFER=y
1343CONFIG_JFFS2_COMPRESSION_OPTIONS=y
1344CONFIG_JFFS2_ZLIB=y
1345CONFIG_JFFS2_RTIME=y
1346CONFIG_JFFS2_RUBIN=y
1347# CONFIG_JFFS2_CMODE_NONE is not set
1348CONFIG_JFFS2_CMODE_PRIORITY=y
1349# CONFIG_JFFS2_CMODE_SIZE is not set
1350CONFIG_CRAMFS=m
1351# CONFIG_VXFS_FS is not set
1352# CONFIG_HPFS_FS is not set
1353# CONFIG_QNX4FS_FS is not set
1354# CONFIG_SYSV_FS is not set
1355# CONFIG_UFS_FS is not set
1356
1357#
1358# Network File Systems
1359#
1360CONFIG_NFS_FS=m
1361CONFIG_NFS_V3=y
1362# CONFIG_NFS_V3_ACL is not set
1363CONFIG_NFS_V4=y
1364# CONFIG_NFS_DIRECTIO is not set
1365# CONFIG_NFSD is not set
1366CONFIG_LOCKD=m
1367CONFIG_LOCKD_V4=y
1368CONFIG_NFS_COMMON=y
1369CONFIG_SUNRPC=m
1370CONFIG_SUNRPC_GSS=m
1371CONFIG_RPCSEC_GSS_KRB5=m
1372# CONFIG_RPCSEC_GSS_SPKM3 is not set
1373CONFIG_SMB_FS=m
1374CONFIG_SMB_NLS_DEFAULT=y
1375CONFIG_SMB_NLS_REMOTE="cp437"
1376# CONFIG_CIFS is not set
1377# CONFIG_NCP_FS is not set
1378# CONFIG_CODA_FS is not set
1379# CONFIG_AFS_FS is not set
1380# CONFIG_9P_FS is not set
1381
1382#
1383# Partition Types
1384#
1385CONFIG_PARTITION_ADVANCED=y
1386# CONFIG_ACORN_PARTITION is not set
1387# CONFIG_OSF_PARTITION is not set
1388# CONFIG_AMIGA_PARTITION is not set
1389# CONFIG_ATARI_PARTITION is not set
1390# CONFIG_MAC_PARTITION is not set
1391CONFIG_MSDOS_PARTITION=y
1392# CONFIG_BSD_DISKLABEL is not set
1393# CONFIG_MINIX_SUBPARTITION is not set
1394# CONFIG_SOLARIS_X86_PARTITION is not set
1395# CONFIG_UNIXWARE_DISKLABEL is not set
1396# CONFIG_LDM_PARTITION is not set
1397# CONFIG_SGI_PARTITION is not set
1398# CONFIG_ULTRIX_PARTITION is not set
1399# CONFIG_SUN_PARTITION is not set
1400# CONFIG_EFI_PARTITION is not set
1401
1402#
1403# Native Language Support
1404#
1405CONFIG_NLS=y
1406CONFIG_NLS_DEFAULT="cp437"
1407CONFIG_NLS_CODEPAGE_437=y
1408# CONFIG_NLS_CODEPAGE_737 is not set
1409# CONFIG_NLS_CODEPAGE_775 is not set
1410# CONFIG_NLS_CODEPAGE_850 is not set
1411# CONFIG_NLS_CODEPAGE_852 is not set
1412# CONFIG_NLS_CODEPAGE_855 is not set
1413# CONFIG_NLS_CODEPAGE_857 is not set
1414# CONFIG_NLS_CODEPAGE_860 is not set
1415# CONFIG_NLS_CODEPAGE_861 is not set
1416# CONFIG_NLS_CODEPAGE_862 is not set
1417# CONFIG_NLS_CODEPAGE_863 is not set
1418# CONFIG_NLS_CODEPAGE_864 is not set
1419# CONFIG_NLS_CODEPAGE_865 is not set
1420# CONFIG_NLS_CODEPAGE_866 is not set
1421# CONFIG_NLS_CODEPAGE_869 is not set
1422# CONFIG_NLS_CODEPAGE_936 is not set
1423# CONFIG_NLS_CODEPAGE_950 is not set
1424# CONFIG_NLS_CODEPAGE_932 is not set
1425# CONFIG_NLS_CODEPAGE_949 is not set
1426# CONFIG_NLS_CODEPAGE_874 is not set
1427# CONFIG_NLS_ISO8859_8 is not set
1428# CONFIG_NLS_CODEPAGE_1250 is not set
1429# CONFIG_NLS_CODEPAGE_1251 is not set
1430# CONFIG_NLS_ASCII is not set
1431CONFIG_NLS_ISO8859_1=y
1432# CONFIG_NLS_ISO8859_2 is not set
1433# CONFIG_NLS_ISO8859_3 is not set
1434# CONFIG_NLS_ISO8859_4 is not set
1435# CONFIG_NLS_ISO8859_5 is not set
1436# CONFIG_NLS_ISO8859_6 is not set
1437# CONFIG_NLS_ISO8859_7 is not set
1438# CONFIG_NLS_ISO8859_9 is not set
1439# CONFIG_NLS_ISO8859_13 is not set
1440# CONFIG_NLS_ISO8859_14 is not set
1441# CONFIG_NLS_ISO8859_15 is not set
1442# CONFIG_NLS_KOI8_R is not set
1443# CONFIG_NLS_KOI8_U is not set
1444CONFIG_NLS_UTF8=y
1445
1446#
1447# Profiling support
1448#
1449CONFIG_PROFILING=y
1450CONFIG_OPROFILE=m
1451
1452#
1453# Kernel hacking
1454#
1455# CONFIG_PRINTK_TIME is not set
1456CONFIG_DEBUG_KERNEL=y
1457CONFIG_MAGIC_SYSRQ=y
1458CONFIG_LOG_BUF_SHIFT=14
1459CONFIG_DETECT_SOFTLOCKUP=y
1460# CONFIG_SCHEDSTATS is not set
1461# CONFIG_DEBUG_SLAB is not set
1462# CONFIG_DEBUG_PREEMPT is not set
1463# CONFIG_DEBUG_SPINLOCK is not set
1464# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1465# CONFIG_DEBUG_KOBJECT is not set
1466CONFIG_DEBUG_BUGVERBOSE=y
1467# CONFIG_DEBUG_INFO is not set
1468# CONFIG_DEBUG_FS is not set
1469CONFIG_FRAME_POINTER=y
1470# CONFIG_DEBUG_USER is not set
1471# CONFIG_DEBUG_WAITQ is not set
1472CONFIG_DEBUG_ERRORS=y
1473CONFIG_DEBUG_LL=y
1474# CONFIG_DEBUG_ICEDCC is not set
1475
1476#
1477# Security options
1478#
1479# CONFIG_KEYS is not set
1480# CONFIG_SECURITY is not set
1481
1482#
1483# Cryptographic options
1484#
1485CONFIG_CRYPTO=y
1486CONFIG_CRYPTO_HMAC=y
1487CONFIG_CRYPTO_NULL=m
1488CONFIG_CRYPTO_MD4=m
1489CONFIG_CRYPTO_MD5=m
1490CONFIG_CRYPTO_SHA1=m
1491CONFIG_CRYPTO_SHA256=m
1492CONFIG_CRYPTO_SHA512=m
1493CONFIG_CRYPTO_WP512=m
1494# CONFIG_CRYPTO_TGR192 is not set
1495CONFIG_CRYPTO_DES=m
1496CONFIG_CRYPTO_BLOWFISH=m
1497CONFIG_CRYPTO_TWOFISH=m
1498CONFIG_CRYPTO_SERPENT=m
1499CONFIG_CRYPTO_AES=m
1500CONFIG_CRYPTO_CAST5=m
1501CONFIG_CRYPTO_CAST6=m
1502CONFIG_CRYPTO_TEA=m
1503CONFIG_CRYPTO_ARC4=m
1504CONFIG_CRYPTO_KHAZAD=m
1505CONFIG_CRYPTO_ANUBIS=m
1506CONFIG_CRYPTO_DEFLATE=m
1507CONFIG_CRYPTO_MICHAEL_MIC=m
1508CONFIG_CRYPTO_CRC32C=m
1509CONFIG_CRYPTO_TEST=m
1510
1511#
1512# Hardware crypto devices
1513#
1514
1515#
1516# Library routines
1517#
1518CONFIG_CRC_CCITT=y
1519# CONFIG_CRC16 is not set
1520CONFIG_CRC32=y
1521CONFIG_LIBCRC32C=m
1522CONFIG_ZLIB_INFLATE=y
1523CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/configs/poodle_defconfig b/arch/arm/configs/poodle_defconfig
new file mode 100644
index 000000000000..72822907759f
--- /dev/null
+++ b/arch/arm/configs/poodle_defconfig
@@ -0,0 +1,1015 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc3
4# Sun Oct 9 17:04:29 2005
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_LOCALVERSION_AUTO=y
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29CONFIG_BSD_PROCESS_ACCT=y
30# CONFIG_BSD_PROCESS_ACCT_V3 is not set
31CONFIG_SYSCTL=y
32# CONFIG_AUDIT is not set
33CONFIG_HOTPLUG=y
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_INITRAMFS_SOURCE=""
37CONFIG_EMBEDDED=y
38CONFIG_KALLSYMS=y
39# CONFIG_KALLSYMS_ALL is not set
40# CONFIG_KALLSYMS_EXTRA_PASS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45CONFIG_EPOLL=y
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58CONFIG_MODULES=y
59CONFIG_MODULE_UNLOAD=y
60CONFIG_MODULE_FORCE_UNLOAD=y
61CONFIG_OBSOLETE_MODPARM=y
62CONFIG_MODVERSIONS=y
63# CONFIG_MODULE_SRCVERSION_ALL is not set
64CONFIG_KMOD=y
65
66#
67# System Type
68#
69# CONFIG_ARCH_CLPS7500 is not set
70# CONFIG_ARCH_CLPS711X is not set
71# CONFIG_ARCH_CO285 is not set
72# CONFIG_ARCH_EBSA110 is not set
73# CONFIG_ARCH_CAMELOT is not set
74# CONFIG_ARCH_FOOTBRIDGE is not set
75# CONFIG_ARCH_INTEGRATOR is not set
76# CONFIG_ARCH_IOP3XX is not set
77# CONFIG_ARCH_IXP4XX is not set
78# CONFIG_ARCH_IXP2000 is not set
79# CONFIG_ARCH_L7200 is not set
80CONFIG_ARCH_PXA=y
81# CONFIG_ARCH_RPC is not set
82# CONFIG_ARCH_SA1100 is not set
83# CONFIG_ARCH_S3C2410 is not set
84# CONFIG_ARCH_SHARK is not set
85# CONFIG_ARCH_LH7A40X is not set
86# CONFIG_ARCH_OMAP is not set
87# CONFIG_ARCH_VERSATILE is not set
88# CONFIG_ARCH_IMX is not set
89# CONFIG_ARCH_H720X is not set
90# CONFIG_ARCH_AAEC2000 is not set
91
92#
93# Intel PXA2xx Implementations
94#
95# CONFIG_ARCH_LUBBOCK is not set
96# CONFIG_MACH_MAINSTONE is not set
97# CONFIG_ARCH_PXA_IDP is not set
98CONFIG_PXA_SHARPSL=y
99CONFIG_PXA_SHARPSL_25x=y
100# CONFIG_PXA_SHARPSL_27x is not set
101CONFIG_MACH_POODLE=y
102# CONFIG_MACH_CORGI is not set
103# CONFIG_MACH_SHEPHERD is not set
104# CONFIG_MACH_HUSKY is not set
105CONFIG_PXA25x=y
106
107#
108# Processor Type
109#
110CONFIG_CPU_32=y
111CONFIG_CPU_XSCALE=y
112CONFIG_CPU_32v5=y
113CONFIG_CPU_ABRT_EV5T=y
114CONFIG_CPU_CACHE_VIVT=y
115CONFIG_CPU_TLB_V4WBI=y
116
117#
118# Processor Features
119#
120CONFIG_ARM_THUMB=y
121CONFIG_XSCALE_PMU=y
122CONFIG_SHARP_LOCOMO=y
123CONFIG_SHARP_PARAM=y
124CONFIG_SHARP_SCOOP=y
125
126#
127# Bus support
128#
129CONFIG_ISA_DMA_API=y
130
131#
132# PCCARD (PCMCIA/CardBus) support
133#
134CONFIG_PCCARD=y
135# CONFIG_PCMCIA_DEBUG is not set
136CONFIG_PCMCIA=y
137CONFIG_PCMCIA_LOAD_CIS=y
138CONFIG_PCMCIA_IOCTL=y
139
140#
141# PC-card bridges
142#
143CONFIG_PCMCIA_PXA2XX=y
144
145#
146# Kernel Features
147#
148CONFIG_PREEMPT=y
149# CONFIG_NO_IDLE_HZ is not set
150# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
151CONFIG_SELECT_MEMORY_MODEL=y
152CONFIG_FLATMEM_MANUAL=y
153# CONFIG_DISCONTIGMEM_MANUAL is not set
154# CONFIG_SPARSEMEM_MANUAL is not set
155CONFIG_FLATMEM=y
156CONFIG_FLAT_NODE_MEM_MAP=y
157# CONFIG_SPARSEMEM_STATIC is not set
158CONFIG_ALIGNMENT_TRAP=y
159
160#
161# Boot options
162#
163CONFIG_ZBOOT_ROM_TEXT=0x0
164CONFIG_ZBOOT_ROM_BSS=0x0
165CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug"
166# CONFIG_XIP_KERNEL is not set
167
168#
169# Floating point emulation
170#
171
172#
173# At least one emulation must be selected
174#
175CONFIG_FPE_NWFPE=y
176# CONFIG_FPE_NWFPE_XP is not set
177# CONFIG_FPE_FASTFPE is not set
178
179#
180# Userspace binary formats
181#
182CONFIG_BINFMT_ELF=y
183CONFIG_BINFMT_AOUT=m
184CONFIG_BINFMT_MISC=m
185# CONFIG_ARTHUR is not set
186
187#
188# Power management options
189#
190CONFIG_PM=y
191CONFIG_APM=y
192
193#
194# Networking
195#
196CONFIG_NET=y
197
198#
199# Networking options
200#
201CONFIG_PACKET=y
202CONFIG_PACKET_MMAP=y
203CONFIG_UNIX=y
204# CONFIG_NET_KEY is not set
205CONFIG_INET=y
206# CONFIG_IP_MULTICAST is not set
207# CONFIG_IP_ADVANCED_ROUTER is not set
208CONFIG_IP_FIB_HASH=y
209# CONFIG_IP_PNP is not set
210# CONFIG_NET_IPIP is not set
211# CONFIG_NET_IPGRE is not set
212# CONFIG_ARPD is not set
213CONFIG_SYN_COOKIES=y
214# CONFIG_INET_AH is not set
215# CONFIG_INET_ESP is not set
216# CONFIG_INET_IPCOMP is not set
217# CONFIG_INET_TUNNEL is not set
218CONFIG_INET_DIAG=y
219CONFIG_INET_TCP_DIAG=y
220# CONFIG_TCP_CONG_ADVANCED is not set
221CONFIG_TCP_CONG_BIC=y
222# CONFIG_IPV6 is not set
223# CONFIG_NETFILTER is not set
224
225#
226# DCCP Configuration (EXPERIMENTAL)
227#
228# CONFIG_IP_DCCP is not set
229
230#
231# SCTP Configuration (EXPERIMENTAL)
232#
233# CONFIG_IP_SCTP is not set
234# CONFIG_ATM is not set
235# CONFIG_BRIDGE is not set
236# CONFIG_VLAN_8021Q is not set
237# CONFIG_DECNET is not set
238# CONFIG_LLC2 is not set
239# CONFIG_IPX is not set
240# CONFIG_ATALK is not set
241# CONFIG_X25 is not set
242# CONFIG_LAPB is not set
243# CONFIG_NET_DIVERT is not set
244# CONFIG_ECONET is not set
245# CONFIG_WAN_ROUTER is not set
246# CONFIG_NET_SCHED is not set
247# CONFIG_NET_CLS_ROUTE is not set
248
249#
250# Network testing
251#
252# CONFIG_NET_PKTGEN is not set
253# CONFIG_HAMRADIO is not set
254# CONFIG_IRDA is not set
255# CONFIG_BT is not set
256# CONFIG_IEEE80211 is not set
257
258#
259# Device Drivers
260#
261
262#
263# Generic Driver Options
264#
265CONFIG_STANDALONE=y
266CONFIG_PREVENT_FIRMWARE_BUILD=y
267CONFIG_FW_LOADER=y
268# CONFIG_DEBUG_DRIVER is not set
269
270#
271# Memory Technology Devices (MTD)
272#
273CONFIG_MTD=y
274# CONFIG_MTD_DEBUG is not set
275# CONFIG_MTD_CONCAT is not set
276CONFIG_MTD_PARTITIONS=y
277# CONFIG_MTD_REDBOOT_PARTS is not set
278# CONFIG_MTD_CMDLINE_PARTS is not set
279# CONFIG_MTD_AFS_PARTS is not set
280
281#
282# User Modules And Translation Layers
283#
284CONFIG_MTD_CHAR=y
285CONFIG_MTD_BLOCK=y
286# CONFIG_FTL is not set
287# CONFIG_NFTL is not set
288# CONFIG_INFTL is not set
289
290#
291# RAM/ROM/Flash chip drivers
292#
293# CONFIG_MTD_CFI is not set
294# CONFIG_MTD_JEDECPROBE is not set
295CONFIG_MTD_MAP_BANK_WIDTH_1=y
296CONFIG_MTD_MAP_BANK_WIDTH_2=y
297CONFIG_MTD_MAP_BANK_WIDTH_4=y
298# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
299# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
300# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
301CONFIG_MTD_CFI_I1=y
302CONFIG_MTD_CFI_I2=y
303# CONFIG_MTD_CFI_I4 is not set
304# CONFIG_MTD_CFI_I8 is not set
305# CONFIG_MTD_RAM is not set
306# CONFIG_MTD_ROM is not set
307# CONFIG_MTD_ABSENT is not set
308
309#
310# Mapping drivers for chip access
311#
312CONFIG_MTD_COMPLEX_MAPPINGS=y
313CONFIG_MTD_SHARP_SL=y
314# CONFIG_MTD_PLATRAM is not set
315
316#
317# Self-contained MTD device drivers
318#
319# CONFIG_MTD_SLRAM is not set
320# CONFIG_MTD_PHRAM is not set
321# CONFIG_MTD_MTDRAM is not set
322# CONFIG_MTD_BLKMTD is not set
323# CONFIG_MTD_BLOCK2MTD is not set
324
325#
326# Disk-On-Chip Device Drivers
327#
328# CONFIG_MTD_DOC2000 is not set
329# CONFIG_MTD_DOC2001 is not set
330# CONFIG_MTD_DOC2001PLUS is not set
331
332#
333# NAND Flash Device Drivers
334#
335CONFIG_MTD_NAND=y
336CONFIG_MTD_NAND_VERIFY_WRITE=y
337# CONFIG_MTD_NAND_H1900 is not set
338CONFIG_MTD_NAND_IDS=y
339# CONFIG_MTD_NAND_DISKONCHIP is not set
340CONFIG_MTD_NAND_SHARPSL=y
341# CONFIG_MTD_NAND_NANDSIM is not set
342
343#
344# Parallel port support
345#
346# CONFIG_PARPORT is not set
347
348#
349# Plug and Play support
350#
351
352#
353# Block devices
354#
355# CONFIG_BLK_DEV_COW_COMMON is not set
356CONFIG_BLK_DEV_LOOP=y
357# CONFIG_BLK_DEV_CRYPTOLOOP is not set
358# CONFIG_BLK_DEV_NBD is not set
359# CONFIG_BLK_DEV_RAM is not set
360CONFIG_BLK_DEV_RAM_COUNT=16
361# CONFIG_CDROM_PKTCDVD is not set
362
363#
364# IO Schedulers
365#
366CONFIG_IOSCHED_NOOP=y
367CONFIG_IOSCHED_AS=y
368CONFIG_IOSCHED_DEADLINE=y
369CONFIG_IOSCHED_CFQ=y
370# CONFIG_ATA_OVER_ETH is not set
371
372#
373# ATA/ATAPI/MFM/RLL support
374#
375CONFIG_IDE=y
376CONFIG_BLK_DEV_IDE=y
377
378#
379# Please see Documentation/ide.txt for help/info on IDE drives
380#
381# CONFIG_BLK_DEV_IDE_SATA is not set
382CONFIG_BLK_DEV_IDEDISK=y
383# CONFIG_IDEDISK_MULTI_MODE is not set
384CONFIG_BLK_DEV_IDECS=y
385# CONFIG_BLK_DEV_IDECD is not set
386# CONFIG_BLK_DEV_IDETAPE is not set
387# CONFIG_BLK_DEV_IDEFLOPPY is not set
388# CONFIG_IDE_TASK_IOCTL is not set
389
390#
391# IDE chipset support/bugfixes
392#
393CONFIG_IDE_GENERIC=y
394# CONFIG_IDE_ARM is not set
395# CONFIG_BLK_DEV_IDEDMA is not set
396# CONFIG_IDEDMA_AUTO is not set
397# CONFIG_BLK_DEV_HD is not set
398
399#
400# SCSI device support
401#
402# CONFIG_RAID_ATTRS is not set
403# CONFIG_SCSI is not set
404
405#
406# Multi-device support (RAID and LVM)
407#
408# CONFIG_MD is not set
409
410#
411# Fusion MPT device support
412#
413# CONFIG_FUSION is not set
414
415#
416# IEEE 1394 (FireWire) support
417#
418
419#
420# I2O device support
421#
422
423#
424# Network device support
425#
426CONFIG_NETDEVICES=y
427# CONFIG_DUMMY is not set
428# CONFIG_BONDING is not set
429# CONFIG_EQUALIZER is not set
430# CONFIG_TUN is not set
431
432#
433# PHY device support
434#
435# CONFIG_PHYLIB is not set
436
437#
438# Ethernet (10 or 100Mbit)
439#
440CONFIG_NET_ETHERNET=y
441# CONFIG_MII is not set
442# CONFIG_SMC91X is not set
443# CONFIG_DM9000 is not set
444
445#
446# Ethernet (1000 Mbit)
447#
448
449#
450# Ethernet (10000 Mbit)
451#
452
453#
454# Token Ring devices
455#
456
457#
458# Wireless LAN (non-hamradio)
459#
460CONFIG_NET_RADIO=y
461
462#
463# Obsolete Wireless cards support (pre-802.11)
464#
465# CONFIG_STRIP is not set
466# CONFIG_PCMCIA_WAVELAN is not set
467# CONFIG_PCMCIA_NETWAVE is not set
468
469#
470# Wireless 802.11 Frequency Hopping cards support
471#
472# CONFIG_PCMCIA_RAYCS is not set
473
474#
475# Wireless 802.11b ISA/PCI cards support
476#
477# CONFIG_HERMES is not set
478# CONFIG_ATMEL is not set
479
480#
481# Wireless 802.11b Pcmcia/Cardbus cards support
482#
483# CONFIG_AIRO_CS is not set
484# CONFIG_PCMCIA_WL3501 is not set
485# CONFIG_HOSTAP is not set
486CONFIG_NET_WIRELESS=y
487
488#
489# PCMCIA network device support
490#
491CONFIG_NET_PCMCIA=y
492# CONFIG_PCMCIA_3C589 is not set
493# CONFIG_PCMCIA_3C574 is not set
494# CONFIG_PCMCIA_FMVJ18X is not set
495CONFIG_PCMCIA_PCNET=y
496# CONFIG_PCMCIA_NMCLAN is not set
497# CONFIG_PCMCIA_SMC91C92 is not set
498# CONFIG_PCMCIA_XIRC2PS is not set
499# CONFIG_PCMCIA_AXNET is not set
500
501#
502# Wan interfaces
503#
504# CONFIG_WAN is not set
505CONFIG_PPP=m
506# CONFIG_PPP_MULTILINK is not set
507# CONFIG_PPP_FILTER is not set
508CONFIG_PPP_ASYNC=m
509# CONFIG_PPP_SYNC_TTY is not set
510# CONFIG_PPP_DEFLATE is not set
511CONFIG_PPP_BSDCOMP=m
512# CONFIG_PPPOE is not set
513# CONFIG_SLIP is not set
514# CONFIG_SHAPER is not set
515# CONFIG_NETCONSOLE is not set
516# CONFIG_NETPOLL is not set
517# CONFIG_NET_POLL_CONTROLLER is not set
518
519#
520# ISDN subsystem
521#
522# CONFIG_ISDN is not set
523
524#
525# Input device support
526#
527CONFIG_INPUT=y
528
529#
530# Userland interfaces
531#
532# CONFIG_INPUT_MOUSEDEV is not set
533# CONFIG_INPUT_JOYDEV is not set
534CONFIG_INPUT_TSDEV=y
535CONFIG_INPUT_TSDEV_SCREEN_X=240
536CONFIG_INPUT_TSDEV_SCREEN_Y=320
537CONFIG_INPUT_EVDEV=y
538CONFIG_INPUT_EVBUG=y
539
540#
541# Input Device Drivers
542#
543CONFIG_INPUT_KEYBOARD=y
544# CONFIG_KEYBOARD_ATKBD is not set
545# CONFIG_KEYBOARD_SUNKBD is not set
546# CONFIG_KEYBOARD_LKKBD is not set
547CONFIG_KEYBOARD_LOCOMO=y
548# CONFIG_KEYBOARD_XTKBD is not set
549# CONFIG_KEYBOARD_NEWTON is not set
550# CONFIG_KEYBOARD_CORGI is not set
551CONFIG_KEYBOARD_SPITZ=y
552# CONFIG_INPUT_MOUSE is not set
553# CONFIG_INPUT_JOYSTICK is not set
554# CONFIG_INPUT_TOUCHSCREEN is not set
555# CONFIG_INPUT_MISC is not set
556
557#
558# Hardware I/O ports
559#
560# CONFIG_SERIO is not set
561# CONFIG_GAMEPORT is not set
562
563#
564# Character devices
565#
566CONFIG_VT=y
567CONFIG_VT_CONSOLE=y
568CONFIG_HW_CONSOLE=y
569# CONFIG_SERIAL_NONSTANDARD is not set
570
571#
572# Serial drivers
573#
574# CONFIG_SERIAL_8250 is not set
575
576#
577# Non-8250 serial port support
578#
579CONFIG_SERIAL_PXA=y
580CONFIG_SERIAL_PXA_CONSOLE=y
581CONFIG_SERIAL_CORE=y
582CONFIG_SERIAL_CORE_CONSOLE=y
583CONFIG_UNIX98_PTYS=y
584# CONFIG_LEGACY_PTYS is not set
585
586#
587# IPMI
588#
589# CONFIG_IPMI_HANDLER is not set
590
591#
592# Watchdog Cards
593#
594# CONFIG_WATCHDOG is not set
595# CONFIG_NVRAM is not set
596# CONFIG_RTC is not set
597# CONFIG_DTLK is not set
598# CONFIG_R3964 is not set
599
600#
601# Ftape, the floppy tape device driver
602#
603
604#
605# PCMCIA character devices
606#
607# CONFIG_SYNCLINK_CS is not set
608# CONFIG_RAW_DRIVER is not set
609
610#
611# TPM devices
612#
613
614#
615# I2C support
616#
617CONFIG_I2C=y
618# CONFIG_I2C_CHARDEV is not set
619
620#
621# I2C Algorithms
622#
623CONFIG_I2C_ALGOBIT=y
624# CONFIG_I2C_ALGOPCF is not set
625# CONFIG_I2C_ALGOPCA is not set
626
627#
628# I2C Hardware Bus support
629#
630# CONFIG_I2C_PXA is not set
631# CONFIG_I2C_PARPORT_LIGHT is not set
632# CONFIG_I2C_STUB is not set
633# CONFIG_I2C_PCA_ISA is not set
634
635#
636# Miscellaneous I2C Chip support
637#
638# CONFIG_SENSORS_DS1337 is not set
639# CONFIG_SENSORS_DS1374 is not set
640# CONFIG_SENSORS_EEPROM is not set
641# CONFIG_SENSORS_PCF8574 is not set
642# CONFIG_SENSORS_PCA9539 is not set
643# CONFIG_SENSORS_PCF8591 is not set
644# CONFIG_SENSORS_RTC8564 is not set
645# CONFIG_SENSORS_MAX6875 is not set
646CONFIG_I2C_DEBUG_CORE=y
647CONFIG_I2C_DEBUG_ALGO=y
648CONFIG_I2C_DEBUG_BUS=y
649# CONFIG_I2C_DEBUG_CHIP is not set
650
651#
652# Hardware Monitoring support
653#
654CONFIG_HWMON=y
655# CONFIG_HWMON_VID is not set
656# CONFIG_SENSORS_ADM1021 is not set
657# CONFIG_SENSORS_ADM1025 is not set
658# CONFIG_SENSORS_ADM1026 is not set
659# CONFIG_SENSORS_ADM1031 is not set
660# CONFIG_SENSORS_ADM9240 is not set
661# CONFIG_SENSORS_ASB100 is not set
662# CONFIG_SENSORS_ATXP1 is not set
663# CONFIG_SENSORS_DS1621 is not set
664# CONFIG_SENSORS_FSCHER is not set
665# CONFIG_SENSORS_FSCPOS is not set
666# CONFIG_SENSORS_GL518SM is not set
667# CONFIG_SENSORS_GL520SM is not set
668# CONFIG_SENSORS_IT87 is not set
669# CONFIG_SENSORS_LM63 is not set
670# CONFIG_SENSORS_LM75 is not set
671# CONFIG_SENSORS_LM77 is not set
672# CONFIG_SENSORS_LM78 is not set
673# CONFIG_SENSORS_LM80 is not set
674# CONFIG_SENSORS_LM83 is not set
675# CONFIG_SENSORS_LM85 is not set
676# CONFIG_SENSORS_LM87 is not set
677# CONFIG_SENSORS_LM90 is not set
678# CONFIG_SENSORS_LM92 is not set
679# CONFIG_SENSORS_MAX1619 is not set
680# CONFIG_SENSORS_PC87360 is not set
681# CONFIG_SENSORS_SMSC47M1 is not set
682# CONFIG_SENSORS_SMSC47B397 is not set
683# CONFIG_SENSORS_W83781D is not set
684# CONFIG_SENSORS_W83792D is not set
685# CONFIG_SENSORS_W83L785TS is not set
686# CONFIG_SENSORS_W83627HF is not set
687# CONFIG_SENSORS_W83627EHF is not set
688# CONFIG_HWMON_DEBUG_CHIP is not set
689
690#
691# Misc devices
692#
693
694#
695# Multimedia Capabilities Port drivers
696#
697
698#
699# Multimedia devices
700#
701CONFIG_VIDEO_DEV=m
702
703#
704# Video For Linux
705#
706
707#
708# Video Adapters
709#
710# CONFIG_VIDEO_CPIA is not set
711# CONFIG_VIDEO_SAA5246A is not set
712# CONFIG_VIDEO_SAA5249 is not set
713# CONFIG_TUNER_3036 is not set
714# CONFIG_VIDEO_OVCAMCHIP is not set
715
716#
717# Radio Adapters
718#
719# CONFIG_RADIO_MAESTRO is not set
720
721#
722# Digital Video Broadcasting Devices
723#
724# CONFIG_DVB is not set
725
726#
727# Graphics support
728#
729CONFIG_FB=y
730CONFIG_FB_CFB_FILLRECT=y
731CONFIG_FB_CFB_COPYAREA=y
732CONFIG_FB_CFB_IMAGEBLIT=y
733CONFIG_FB_SOFT_CURSOR=y
734# CONFIG_FB_MACMODES is not set
735CONFIG_FB_MODE_HELPERS=y
736# CONFIG_FB_TILEBLITTING is not set
737CONFIG_FB_PXA=y
738# CONFIG_FB_W100 is not set
739# CONFIG_FB_PXA_PARAMETERS is not set
740# CONFIG_FB_S1D13XXX is not set
741# CONFIG_FB_VIRTUAL is not set
742
743#
744# Console display driver support
745#
746# CONFIG_VGA_CONSOLE is not set
747CONFIG_DUMMY_CONSOLE=y
748CONFIG_FRAMEBUFFER_CONSOLE=y
749CONFIG_FONTS=y
750CONFIG_FONT_8x8=y
751# CONFIG_FONT_8x16 is not set
752# CONFIG_FONT_6x11 is not set
753# CONFIG_FONT_7x14 is not set
754# CONFIG_FONT_PEARL_8x8 is not set
755# CONFIG_FONT_ACORN_8x8 is not set
756# CONFIG_FONT_MINI_4x6 is not set
757# CONFIG_FONT_SUN8x16 is not set
758# CONFIG_FONT_SUN12x22 is not set
759# CONFIG_FONT_10x18 is not set
760
761#
762# Logo configuration
763#
764# CONFIG_LOGO is not set
765# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
766
767#
768# Sound
769#
770# CONFIG_SOUND is not set
771
772#
773# USB support
774#
775CONFIG_USB_ARCH_HAS_HCD=y
776# CONFIG_USB_ARCH_HAS_OHCI is not set
777# CONFIG_USB is not set
778
779#
780# USB Gadget Support
781#
782CONFIG_USB_GADGET=y
783# CONFIG_USB_GADGET_DEBUG_FILES is not set
784CONFIG_USB_GADGET_SELECTED=y
785# CONFIG_USB_GADGET_NET2280 is not set
786CONFIG_USB_GADGET_PXA2XX=y
787CONFIG_USB_PXA2XX=y
788# CONFIG_USB_PXA2XX_SMALL is not set
789# CONFIG_USB_GADGET_GOKU is not set
790# CONFIG_USB_GADGET_LH7A40X is not set
791# CONFIG_USB_GADGET_OMAP is not set
792# CONFIG_USB_GADGET_DUMMY_HCD is not set
793# CONFIG_USB_GADGET_DUALSPEED is not set
794# CONFIG_USB_ZERO is not set
795CONFIG_USB_ETH=y
796CONFIG_USB_ETH_RNDIS=y
797# CONFIG_USB_GADGETFS is not set
798# CONFIG_USB_FILE_STORAGE is not set
799# CONFIG_USB_G_SERIAL is not set
800
801#
802# MMC/SD Card support
803#
804CONFIG_MMC=y
805CONFIG_MMC_DEBUG=y
806CONFIG_MMC_BLOCK=y
807CONFIG_MMC_PXA=y
808# CONFIG_MMC_WBSD is not set
809
810#
811# File systems
812#
813CONFIG_EXT2_FS=y
814CONFIG_EXT2_FS_XATTR=y
815CONFIG_EXT2_FS_POSIX_ACL=y
816CONFIG_EXT2_FS_SECURITY=y
817# CONFIG_EXT2_FS_XIP is not set
818# CONFIG_EXT3_FS is not set
819# CONFIG_JBD is not set
820CONFIG_FS_MBCACHE=y
821# CONFIG_REISERFS_FS is not set
822# CONFIG_JFS_FS is not set
823CONFIG_FS_POSIX_ACL=y
824# CONFIG_XFS_FS is not set
825# CONFIG_MINIX_FS is not set
826# CONFIG_ROMFS_FS is not set
827CONFIG_INOTIFY=y
828# CONFIG_QUOTA is not set
829CONFIG_DNOTIFY=y
830# CONFIG_AUTOFS_FS is not set
831# CONFIG_AUTOFS4_FS is not set
832# CONFIG_FUSE_FS is not set
833
834#
835# CD-ROM/DVD Filesystems
836#
837# CONFIG_ISO9660_FS is not set
838# CONFIG_UDF_FS is not set
839
840#
841# DOS/FAT/NT Filesystems
842#
843CONFIG_FAT_FS=y
844CONFIG_MSDOS_FS=y
845CONFIG_VFAT_FS=y
846CONFIG_FAT_DEFAULT_CODEPAGE=437
847CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
848# CONFIG_NTFS_FS is not set
849
850#
851# Pseudo filesystems
852#
853CONFIG_PROC_FS=y
854CONFIG_SYSFS=y
855CONFIG_TMPFS=y
856# CONFIG_HUGETLB_PAGE is not set
857CONFIG_RAMFS=y
858# CONFIG_RELAYFS_FS is not set
859
860#
861# Miscellaneous filesystems
862#
863# CONFIG_ADFS_FS is not set
864# CONFIG_AFFS_FS is not set
865# CONFIG_HFS_FS is not set
866# CONFIG_HFSPLUS_FS is not set
867# CONFIG_BEFS_FS is not set
868# CONFIG_BFS_FS is not set
869# CONFIG_EFS_FS is not set
870# CONFIG_JFFS_FS is not set
871CONFIG_JFFS2_FS=y
872CONFIG_JFFS2_FS_DEBUG=0
873CONFIG_JFFS2_FS_WRITEBUFFER=y
874CONFIG_JFFS2_COMPRESSION_OPTIONS=y
875CONFIG_JFFS2_ZLIB=y
876CONFIG_JFFS2_RTIME=y
877CONFIG_JFFS2_RUBIN=y
878# CONFIG_JFFS2_CMODE_NONE is not set
879CONFIG_JFFS2_CMODE_PRIORITY=y
880# CONFIG_JFFS2_CMODE_SIZE is not set
881CONFIG_CRAMFS=m
882# CONFIG_VXFS_FS is not set
883# CONFIG_HPFS_FS is not set
884# CONFIG_QNX4FS_FS is not set
885# CONFIG_SYSV_FS is not set
886# CONFIG_UFS_FS is not set
887
888#
889# Network File Systems
890#
891# CONFIG_NFS_FS is not set
892# CONFIG_NFSD is not set
893# CONFIG_SMB_FS is not set
894# CONFIG_CIFS is not set
895# CONFIG_NCP_FS is not set
896# CONFIG_CODA_FS is not set
897# CONFIG_AFS_FS is not set
898# CONFIG_9P_FS is not set
899
900#
901# Partition Types
902#
903CONFIG_PARTITION_ADVANCED=y
904# CONFIG_ACORN_PARTITION is not set
905# CONFIG_OSF_PARTITION is not set
906# CONFIG_AMIGA_PARTITION is not set
907# CONFIG_ATARI_PARTITION is not set
908# CONFIG_MAC_PARTITION is not set
909CONFIG_MSDOS_PARTITION=y
910# CONFIG_BSD_DISKLABEL is not set
911# CONFIG_MINIX_SUBPARTITION is not set
912# CONFIG_SOLARIS_X86_PARTITION is not set
913# CONFIG_UNIXWARE_DISKLABEL is not set
914# CONFIG_LDM_PARTITION is not set
915# CONFIG_SGI_PARTITION is not set
916# CONFIG_ULTRIX_PARTITION is not set
917# CONFIG_SUN_PARTITION is not set
918# CONFIG_EFI_PARTITION is not set
919
920#
921# Native Language Support
922#
923CONFIG_NLS=y
924CONFIG_NLS_DEFAULT="cp437"
925CONFIG_NLS_CODEPAGE_437=y
926# CONFIG_NLS_CODEPAGE_737 is not set
927# CONFIG_NLS_CODEPAGE_775 is not set
928# CONFIG_NLS_CODEPAGE_850 is not set
929# CONFIG_NLS_CODEPAGE_852 is not set
930# CONFIG_NLS_CODEPAGE_855 is not set
931# CONFIG_NLS_CODEPAGE_857 is not set
932# CONFIG_NLS_CODEPAGE_860 is not set
933# CONFIG_NLS_CODEPAGE_861 is not set
934# CONFIG_NLS_CODEPAGE_862 is not set
935# CONFIG_NLS_CODEPAGE_863 is not set
936# CONFIG_NLS_CODEPAGE_864 is not set
937# CONFIG_NLS_CODEPAGE_865 is not set
938# CONFIG_NLS_CODEPAGE_866 is not set
939# CONFIG_NLS_CODEPAGE_869 is not set
940# CONFIG_NLS_CODEPAGE_936 is not set
941# CONFIG_NLS_CODEPAGE_950 is not set
942# CONFIG_NLS_CODEPAGE_932 is not set
943# CONFIG_NLS_CODEPAGE_949 is not set
944# CONFIG_NLS_CODEPAGE_874 is not set
945# CONFIG_NLS_ISO8859_8 is not set
946# CONFIG_NLS_CODEPAGE_1250 is not set
947# CONFIG_NLS_CODEPAGE_1251 is not set
948CONFIG_NLS_ASCII=y
949CONFIG_NLS_ISO8859_1=y
950# CONFIG_NLS_ISO8859_2 is not set
951# CONFIG_NLS_ISO8859_3 is not set
952# CONFIG_NLS_ISO8859_4 is not set
953# CONFIG_NLS_ISO8859_5 is not set
954# CONFIG_NLS_ISO8859_6 is not set
955# CONFIG_NLS_ISO8859_7 is not set
956# CONFIG_NLS_ISO8859_9 is not set
957# CONFIG_NLS_ISO8859_13 is not set
958# CONFIG_NLS_ISO8859_14 is not set
959# CONFIG_NLS_ISO8859_15 is not set
960# CONFIG_NLS_KOI8_R is not set
961# CONFIG_NLS_KOI8_U is not set
962CONFIG_NLS_UTF8=y
963
964#
965# Profiling support
966#
967# CONFIG_PROFILING is not set
968
969#
970# Kernel hacking
971#
972# CONFIG_PRINTK_TIME is not set
973CONFIG_DEBUG_KERNEL=y
974CONFIG_MAGIC_SYSRQ=y
975CONFIG_LOG_BUF_SHIFT=14
976CONFIG_DETECT_SOFTLOCKUP=y
977# CONFIG_SCHEDSTATS is not set
978# CONFIG_DEBUG_SLAB is not set
979CONFIG_DEBUG_PREEMPT=y
980# CONFIG_DEBUG_SPINLOCK is not set
981# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
982# CONFIG_DEBUG_KOBJECT is not set
983# CONFIG_DEBUG_BUGVERBOSE is not set
984# CONFIG_DEBUG_INFO is not set
985# CONFIG_DEBUG_FS is not set
986CONFIG_FRAME_POINTER=y
987# CONFIG_DEBUG_USER is not set
988# CONFIG_DEBUG_WAITQ is not set
989CONFIG_DEBUG_ERRORS=y
990# CONFIG_DEBUG_LL is not set
991
992#
993# Security options
994#
995# CONFIG_KEYS is not set
996# CONFIG_SECURITY is not set
997
998#
999# Cryptographic options
1000#
1001# CONFIG_CRYPTO is not set
1002
1003#
1004# Hardware crypto devices
1005#
1006
1007#
1008# Library routines
1009#
1010CONFIG_CRC_CCITT=y
1011# CONFIG_CRC16 is not set
1012CONFIG_CRC32=y
1013# CONFIG_LIBCRC32C is not set
1014CONFIG_ZLIB_INFLATE=y
1015CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
new file mode 100644
index 000000000000..900e04f8e38c
--- /dev/null
+++ b/arch/arm/configs/spitz_defconfig
@@ -0,0 +1,1401 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc3
4# Sun Oct 9 17:11:19 2005
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_LOCALVERSION_AUTO=y
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29CONFIG_BSD_PROCESS_ACCT=y
30# CONFIG_BSD_PROCESS_ACCT_V3 is not set
31CONFIG_SYSCTL=y
32# CONFIG_AUDIT is not set
33CONFIG_HOTPLUG=y
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set
36CONFIG_INITRAMFS_SOURCE=""
37CONFIG_EMBEDDED=y
38CONFIG_KALLSYMS=y
39# CONFIG_KALLSYMS_ALL is not set
40# CONFIG_KALLSYMS_EXTRA_PASS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45CONFIG_EPOLL=y
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58CONFIG_MODULES=y
59CONFIG_MODULE_UNLOAD=y
60CONFIG_MODULE_FORCE_UNLOAD=y
61CONFIG_OBSOLETE_MODPARM=y
62# CONFIG_MODVERSIONS is not set
63# CONFIG_MODULE_SRCVERSION_ALL is not set
64CONFIG_KMOD=y
65
66#
67# System Type
68#
69# CONFIG_ARCH_CLPS7500 is not set
70# CONFIG_ARCH_CLPS711X is not set
71# CONFIG_ARCH_CO285 is not set
72# CONFIG_ARCH_EBSA110 is not set
73# CONFIG_ARCH_CAMELOT is not set
74# CONFIG_ARCH_FOOTBRIDGE is not set
75# CONFIG_ARCH_INTEGRATOR is not set
76# CONFIG_ARCH_IOP3XX is not set
77# CONFIG_ARCH_IXP4XX is not set
78# CONFIG_ARCH_IXP2000 is not set
79# CONFIG_ARCH_L7200 is not set
80CONFIG_ARCH_PXA=y
81# CONFIG_ARCH_RPC is not set
82# CONFIG_ARCH_SA1100 is not set
83# CONFIG_ARCH_S3C2410 is not set
84# CONFIG_ARCH_SHARK is not set
85# CONFIG_ARCH_LH7A40X is not set
86# CONFIG_ARCH_OMAP is not set
87# CONFIG_ARCH_VERSATILE is not set
88# CONFIG_ARCH_IMX is not set
89# CONFIG_ARCH_H720X is not set
90# CONFIG_ARCH_AAEC2000 is not set
91
92#
93# Intel PXA2xx Implementations
94#
95# CONFIG_ARCH_LUBBOCK is not set
96# CONFIG_MACH_MAINSTONE is not set
97# CONFIG_ARCH_PXA_IDP is not set
98CONFIG_PXA_SHARPSL=y
99# CONFIG_PXA_SHARPSL_25x is not set
100CONFIG_PXA_SHARPSL_27x=y
101CONFIG_MACH_SPITZ=y
102CONFIG_MACH_BORZOI=y
103CONFIG_PXA27x=y
104CONFIG_PXA_SHARP_Cxx00=y
105
106#
107# Processor Type
108#
109CONFIG_CPU_32=y
110CONFIG_CPU_XSCALE=y
111CONFIG_CPU_32v5=y
112CONFIG_CPU_ABRT_EV5T=y
113CONFIG_CPU_CACHE_VIVT=y
114CONFIG_CPU_TLB_V4WBI=y
115
116#
117# Processor Features
118#
119CONFIG_ARM_THUMB=y
120CONFIG_XSCALE_PMU=y
121CONFIG_SHARP_PARAM=y
122CONFIG_SHARP_SCOOP=y
123
124#
125# Bus support
126#
127CONFIG_ISA_DMA_API=y
128
129#
130# PCCARD (PCMCIA/CardBus) support
131#
132CONFIG_PCCARD=y
133# CONFIG_PCMCIA_DEBUG is not set
134CONFIG_PCMCIA=y
135CONFIG_PCMCIA_LOAD_CIS=y
136CONFIG_PCMCIA_IOCTL=y
137
138#
139# PC-card bridges
140#
141CONFIG_PCMCIA_PXA2XX=y
142
143#
144# Kernel Features
145#
146CONFIG_PREEMPT=y
147# CONFIG_NO_IDLE_HZ is not set
148# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
149CONFIG_SELECT_MEMORY_MODEL=y
150CONFIG_FLATMEM_MANUAL=y
151# CONFIG_DISCONTIGMEM_MANUAL is not set
152# CONFIG_SPARSEMEM_MANUAL is not set
153CONFIG_FLATMEM=y
154CONFIG_FLAT_NODE_MEM_MAP=y
155# CONFIG_SPARSEMEM_STATIC is not set
156CONFIG_ALIGNMENT_TRAP=y
157
158#
159# Boot options
160#
161CONFIG_ZBOOT_ROM_TEXT=0x0
162CONFIG_ZBOOT_ROM_BSS=0x0
163CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug"
164# CONFIG_XIP_KERNEL is not set
165
166#
167# Floating point emulation
168#
169
170#
171# At least one emulation must be selected
172#
173CONFIG_FPE_NWFPE=y
174# CONFIG_FPE_NWFPE_XP is not set
175# CONFIG_FPE_FASTFPE is not set
176
177#
178# Userspace binary formats
179#
180CONFIG_BINFMT_ELF=y
181CONFIG_BINFMT_AOUT=m
182CONFIG_BINFMT_MISC=m
183# CONFIG_ARTHUR is not set
184
185#
186# Power management options
187#
188CONFIG_PM=y
189CONFIG_APM=y
190
191#
192# Networking
193#
194CONFIG_NET=y
195
196#
197# Networking options
198#
199CONFIG_PACKET=y
200CONFIG_PACKET_MMAP=y
201CONFIG_UNIX=y
202CONFIG_XFRM=y
203# CONFIG_XFRM_USER is not set
204# CONFIG_NET_KEY is not set
205CONFIG_INET=y
206# CONFIG_IP_MULTICAST is not set
207# CONFIG_IP_ADVANCED_ROUTER is not set
208CONFIG_IP_FIB_HASH=y
209# CONFIG_IP_PNP is not set
210# CONFIG_NET_IPIP is not set
211# CONFIG_NET_IPGRE is not set
212# CONFIG_ARPD is not set
213CONFIG_SYN_COOKIES=y
214# CONFIG_INET_AH is not set
215# CONFIG_INET_ESP is not set
216# CONFIG_INET_IPCOMP is not set
217# CONFIG_INET_TUNNEL is not set
218CONFIG_INET_DIAG=y
219CONFIG_INET_TCP_DIAG=y
220# CONFIG_TCP_CONG_ADVANCED is not set
221CONFIG_TCP_CONG_BIC=y
222
223#
224# IP: Virtual Server Configuration
225#
226# CONFIG_IP_VS is not set
227CONFIG_IPV6=m
228# CONFIG_IPV6_PRIVACY is not set
229CONFIG_INET6_AH=m
230CONFIG_INET6_ESP=m
231CONFIG_INET6_IPCOMP=m
232CONFIG_INET6_TUNNEL=m
233CONFIG_IPV6_TUNNEL=m
234CONFIG_NETFILTER=y
235# CONFIG_NETFILTER_DEBUG is not set
236# CONFIG_NETFILTER_NETLINK is not set
237
238#
239# IP: Netfilter Configuration
240#
241CONFIG_IP_NF_CONNTRACK=m
242# CONFIG_IP_NF_CT_ACCT is not set
243# CONFIG_IP_NF_CONNTRACK_MARK is not set
244# CONFIG_IP_NF_CONNTRACK_EVENTS is not set
245CONFIG_IP_NF_CT_PROTO_SCTP=m
246CONFIG_IP_NF_FTP=m
247CONFIG_IP_NF_IRC=m
248# CONFIG_IP_NF_NETBIOS_NS is not set
249CONFIG_IP_NF_TFTP=m
250CONFIG_IP_NF_AMANDA=m
251# CONFIG_IP_NF_PPTP is not set
252CONFIG_IP_NF_QUEUE=m
253CONFIG_IP_NF_IPTABLES=m
254CONFIG_IP_NF_MATCH_LIMIT=m
255CONFIG_IP_NF_MATCH_IPRANGE=m
256CONFIG_IP_NF_MATCH_MAC=m
257CONFIG_IP_NF_MATCH_PKTTYPE=m
258CONFIG_IP_NF_MATCH_MARK=m
259CONFIG_IP_NF_MATCH_MULTIPORT=m
260CONFIG_IP_NF_MATCH_TOS=m
261CONFIG_IP_NF_MATCH_RECENT=m
262CONFIG_IP_NF_MATCH_ECN=m
263CONFIG_IP_NF_MATCH_DSCP=m
264CONFIG_IP_NF_MATCH_AH_ESP=m
265CONFIG_IP_NF_MATCH_LENGTH=m
266CONFIG_IP_NF_MATCH_TTL=m
267CONFIG_IP_NF_MATCH_TCPMSS=m
268CONFIG_IP_NF_MATCH_HELPER=m
269CONFIG_IP_NF_MATCH_STATE=m
270CONFIG_IP_NF_MATCH_CONNTRACK=m
271CONFIG_IP_NF_MATCH_OWNER=m
272CONFIG_IP_NF_MATCH_ADDRTYPE=m
273CONFIG_IP_NF_MATCH_REALM=m
274CONFIG_IP_NF_MATCH_SCTP=m
275# CONFIG_IP_NF_MATCH_DCCP is not set
276CONFIG_IP_NF_MATCH_COMMENT=m
277CONFIG_IP_NF_MATCH_HASHLIMIT=m
278# CONFIG_IP_NF_MATCH_STRING is not set
279CONFIG_IP_NF_FILTER=m
280# CONFIG_IP_NF_TARGET_REJECT is not set
281CONFIG_IP_NF_TARGET_LOG=m
282CONFIG_IP_NF_TARGET_ULOG=m
283CONFIG_IP_NF_TARGET_TCPMSS=m
284# CONFIG_IP_NF_TARGET_NFQUEUE is not set
285CONFIG_IP_NF_NAT=m
286CONFIG_IP_NF_NAT_NEEDED=y
287# CONFIG_IP_NF_TARGET_MASQUERADE is not set
288# CONFIG_IP_NF_TARGET_REDIRECT is not set
289# CONFIG_IP_NF_TARGET_NETMAP is not set
290# CONFIG_IP_NF_TARGET_SAME is not set
291# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
292CONFIG_IP_NF_NAT_IRC=m
293CONFIG_IP_NF_NAT_FTP=m
294CONFIG_IP_NF_NAT_TFTP=m
295CONFIG_IP_NF_NAT_AMANDA=m
296CONFIG_IP_NF_MANGLE=m
297# CONFIG_IP_NF_TARGET_TOS is not set
298# CONFIG_IP_NF_TARGET_ECN is not set
299# CONFIG_IP_NF_TARGET_DSCP is not set
300# CONFIG_IP_NF_TARGET_MARK is not set
301# CONFIG_IP_NF_TARGET_CLASSIFY is not set
302# CONFIG_IP_NF_TARGET_TTL is not set
303CONFIG_IP_NF_RAW=m
304# CONFIG_IP_NF_TARGET_NOTRACK is not set
305CONFIG_IP_NF_ARPTABLES=m
306CONFIG_IP_NF_ARPFILTER=m
307CONFIG_IP_NF_ARP_MANGLE=m
308
309#
310# IPv6: Netfilter Configuration (EXPERIMENTAL)
311#
312CONFIG_IP6_NF_QUEUE=m
313CONFIG_IP6_NF_IPTABLES=m
314CONFIG_IP6_NF_MATCH_LIMIT=m
315CONFIG_IP6_NF_MATCH_MAC=m
316CONFIG_IP6_NF_MATCH_RT=m
317CONFIG_IP6_NF_MATCH_OPTS=m
318CONFIG_IP6_NF_MATCH_FRAG=m
319CONFIG_IP6_NF_MATCH_HL=m
320CONFIG_IP6_NF_MATCH_MULTIPORT=m
321CONFIG_IP6_NF_MATCH_OWNER=m
322CONFIG_IP6_NF_MATCH_MARK=m
323CONFIG_IP6_NF_MATCH_IPV6HEADER=m
324CONFIG_IP6_NF_MATCH_AHESP=m
325CONFIG_IP6_NF_MATCH_LENGTH=m
326CONFIG_IP6_NF_MATCH_EUI64=m
327CONFIG_IP6_NF_FILTER=m
328# CONFIG_IP6_NF_TARGET_LOG is not set
329# CONFIG_IP6_NF_TARGET_REJECT is not set
330# CONFIG_IP6_NF_TARGET_NFQUEUE is not set
331CONFIG_IP6_NF_MANGLE=m
332# CONFIG_IP6_NF_TARGET_MARK is not set
333# CONFIG_IP6_NF_TARGET_HL is not set
334CONFIG_IP6_NF_RAW=m
335
336#
337# DCCP Configuration (EXPERIMENTAL)
338#
339# CONFIG_IP_DCCP is not set
340
341#
342# SCTP Configuration (EXPERIMENTAL)
343#
344# CONFIG_IP_SCTP is not set
345# CONFIG_ATM is not set
346# CONFIG_BRIDGE is not set
347# CONFIG_VLAN_8021Q is not set
348# CONFIG_DECNET is not set
349# CONFIG_LLC2 is not set
350# CONFIG_IPX is not set
351# CONFIG_ATALK is not set
352# CONFIG_X25 is not set
353# CONFIG_LAPB is not set
354# CONFIG_NET_DIVERT is not set
355# CONFIG_ECONET is not set
356# CONFIG_WAN_ROUTER is not set
357# CONFIG_NET_SCHED is not set
358CONFIG_NET_CLS_ROUTE=y
359
360#
361# Network testing
362#
363# CONFIG_NET_PKTGEN is not set
364# CONFIG_HAMRADIO is not set
365CONFIG_IRDA=m
366
367#
368# IrDA protocols
369#
370CONFIG_IRLAN=m
371CONFIG_IRNET=m
372CONFIG_IRCOMM=m
373# CONFIG_IRDA_ULTRA is not set
374
375#
376# IrDA options
377#
378# CONFIG_IRDA_CACHE_LAST_LSAP is not set
379# CONFIG_IRDA_FAST_RR is not set
380# CONFIG_IRDA_DEBUG is not set
381
382#
383# Infrared-port device drivers
384#
385
386#
387# SIR device drivers
388#
389# CONFIG_IRTTY_SIR is not set
390
391#
392# Dongle support
393#
394
395#
396# Old SIR device drivers
397#
398# CONFIG_IRPORT_SIR is not set
399
400#
401# Old Serial dongle support
402#
403
404#
405# FIR device drivers
406#
407# CONFIG_USB_IRDA is not set
408# CONFIG_SIGMATEL_FIR is not set
409# CONFIG_NSC_FIR is not set
410# CONFIG_WINBOND_FIR is not set
411# CONFIG_SMC_IRCC_FIR is not set
412# CONFIG_ALI_FIR is not set
413# CONFIG_VIA_FIR is not set
414CONFIG_BT=m
415CONFIG_BT_L2CAP=m
416CONFIG_BT_SCO=m
417CONFIG_BT_RFCOMM=m
418CONFIG_BT_RFCOMM_TTY=y
419CONFIG_BT_BNEP=m
420CONFIG_BT_BNEP_MC_FILTER=y
421CONFIG_BT_BNEP_PROTO_FILTER=y
422CONFIG_BT_HIDP=m
423
424#
425# Bluetooth device drivers
426#
427CONFIG_BT_HCIUSB=m
428# CONFIG_BT_HCIUSB_SCO is not set
429CONFIG_BT_HCIUART=m
430CONFIG_BT_HCIUART_H4=y
431CONFIG_BT_HCIUART_BCSP=y
432CONFIG_BT_HCIUART_BCSP_TXCRC=y
433CONFIG_BT_HCIBCM203X=m
434CONFIG_BT_HCIBPA10X=m
435CONFIG_BT_HCIBFUSB=m
436CONFIG_BT_HCIDTL1=m
437CONFIG_BT_HCIBT3C=m
438CONFIG_BT_HCIBLUECARD=m
439CONFIG_BT_HCIBTUART=m
440CONFIG_BT_HCIVHCI=m
441CONFIG_IEEE80211=m
442# CONFIG_IEEE80211_DEBUG is not set
443CONFIG_IEEE80211_CRYPT_WEP=m
444# CONFIG_IEEE80211_CRYPT_CCMP is not set
445# CONFIG_IEEE80211_CRYPT_TKIP is not set
446
447#
448# Device Drivers
449#
450
451#
452# Generic Driver Options
453#
454CONFIG_STANDALONE=y
455CONFIG_PREVENT_FIRMWARE_BUILD=y
456CONFIG_FW_LOADER=y
457# CONFIG_DEBUG_DRIVER is not set
458
459#
460# Memory Technology Devices (MTD)
461#
462CONFIG_MTD=y
463# CONFIG_MTD_DEBUG is not set
464# CONFIG_MTD_CONCAT is not set
465CONFIG_MTD_PARTITIONS=y
466# CONFIG_MTD_REDBOOT_PARTS is not set
467CONFIG_MTD_CMDLINE_PARTS=y
468# CONFIG_MTD_AFS_PARTS is not set
469
470#
471# User Modules And Translation Layers
472#
473CONFIG_MTD_CHAR=y
474CONFIG_MTD_BLOCK=y
475# CONFIG_FTL is not set
476# CONFIG_NFTL is not set
477# CONFIG_INFTL is not set
478
479#
480# RAM/ROM/Flash chip drivers
481#
482# CONFIG_MTD_CFI is not set
483# CONFIG_MTD_JEDECPROBE is not set
484CONFIG_MTD_MAP_BANK_WIDTH_1=y
485CONFIG_MTD_MAP_BANK_WIDTH_2=y
486CONFIG_MTD_MAP_BANK_WIDTH_4=y
487# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
488# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
489# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
490CONFIG_MTD_CFI_I1=y
491CONFIG_MTD_CFI_I2=y
492# CONFIG_MTD_CFI_I4 is not set
493# CONFIG_MTD_CFI_I8 is not set
494# CONFIG_MTD_RAM is not set
495CONFIG_MTD_ROM=y
496# CONFIG_MTD_ABSENT is not set
497
498#
499# Mapping drivers for chip access
500#
501CONFIG_MTD_COMPLEX_MAPPINGS=y
502CONFIG_MTD_SHARP_SL=y
503# CONFIG_MTD_PLATRAM is not set
504
505#
506# Self-contained MTD device drivers
507#
508# CONFIG_MTD_SLRAM is not set
509# CONFIG_MTD_PHRAM is not set
510# CONFIG_MTD_MTDRAM is not set
511# CONFIG_MTD_BLKMTD is not set
512# CONFIG_MTD_BLOCK2MTD is not set
513
514#
515# Disk-On-Chip Device Drivers
516#
517# CONFIG_MTD_DOC2000 is not set
518# CONFIG_MTD_DOC2001 is not set
519# CONFIG_MTD_DOC2001PLUS is not set
520
521#
522# NAND Flash Device Drivers
523#
524CONFIG_MTD_NAND=y
525CONFIG_MTD_NAND_VERIFY_WRITE=y
526# CONFIG_MTD_NAND_H1900 is not set
527CONFIG_MTD_NAND_IDS=y
528# CONFIG_MTD_NAND_DISKONCHIP is not set
529CONFIG_MTD_NAND_SHARPSL=y
530# CONFIG_MTD_NAND_NANDSIM is not set
531
532#
533# Parallel port support
534#
535# CONFIG_PARPORT is not set
536
537#
538# Plug and Play support
539#
540
541#
542# Block devices
543#
544# CONFIG_BLK_DEV_COW_COMMON is not set
545CONFIG_BLK_DEV_LOOP=y
546# CONFIG_BLK_DEV_CRYPTOLOOP is not set
547# CONFIG_BLK_DEV_NBD is not set
548# CONFIG_BLK_DEV_UB is not set
549# CONFIG_BLK_DEV_RAM is not set
550CONFIG_BLK_DEV_RAM_COUNT=16
551# CONFIG_CDROM_PKTCDVD is not set
552
553#
554# IO Schedulers
555#
556CONFIG_IOSCHED_NOOP=y
557CONFIG_IOSCHED_AS=y
558CONFIG_IOSCHED_DEADLINE=y
559CONFIG_IOSCHED_CFQ=y
560# CONFIG_ATA_OVER_ETH is not set
561
562#
563# ATA/ATAPI/MFM/RLL support
564#
565CONFIG_IDE=y
566CONFIG_BLK_DEV_IDE=y
567
568#
569# Please see Documentation/ide.txt for help/info on IDE drives
570#
571# CONFIG_BLK_DEV_IDE_SATA is not set
572CONFIG_BLK_DEV_IDEDISK=y
573# CONFIG_IDEDISK_MULTI_MODE is not set
574CONFIG_BLK_DEV_IDECS=y
575# CONFIG_BLK_DEV_IDECD is not set
576# CONFIG_BLK_DEV_IDETAPE is not set
577# CONFIG_BLK_DEV_IDEFLOPPY is not set
578# CONFIG_BLK_DEV_IDESCSI is not set
579# CONFIG_IDE_TASK_IOCTL is not set
580
581#
582# IDE chipset support/bugfixes
583#
584CONFIG_IDE_GENERIC=y
585# CONFIG_IDE_ARM is not set
586# CONFIG_BLK_DEV_IDEDMA is not set
587# CONFIG_IDEDMA_AUTO is not set
588# CONFIG_BLK_DEV_HD is not set
589
590#
591# SCSI device support
592#
593# CONFIG_RAID_ATTRS is not set
594CONFIG_SCSI=m
595CONFIG_SCSI_PROC_FS=y
596
597#
598# SCSI support type (disk, tape, CD-ROM)
599#
600CONFIG_BLK_DEV_SD=m
601CONFIG_CHR_DEV_ST=m
602CONFIG_CHR_DEV_OSST=m
603CONFIG_BLK_DEV_SR=m
604# CONFIG_BLK_DEV_SR_VENDOR is not set
605CONFIG_CHR_DEV_SG=m
606# CONFIG_CHR_DEV_SCH is not set
607
608#
609# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
610#
611CONFIG_SCSI_MULTI_LUN=y
612# CONFIG_SCSI_CONSTANTS is not set
613# CONFIG_SCSI_LOGGING is not set
614
615#
616# SCSI Transport Attributes
617#
618# CONFIG_SCSI_SPI_ATTRS is not set
619# CONFIG_SCSI_FC_ATTRS is not set
620# CONFIG_SCSI_ISCSI_ATTRS is not set
621# CONFIG_SCSI_SAS_ATTRS is not set
622
623#
624# SCSI low-level drivers
625#
626# CONFIG_SCSI_SATA is not set
627# CONFIG_SCSI_DEBUG is not set
628
629#
630# PCMCIA SCSI adapter support
631#
632# CONFIG_PCMCIA_AHA152X is not set
633# CONFIG_PCMCIA_FDOMAIN is not set
634# CONFIG_PCMCIA_NINJA_SCSI is not set
635# CONFIG_PCMCIA_QLOGIC is not set
636# CONFIG_PCMCIA_SYM53C500 is not set
637
638#
639# Multi-device support (RAID and LVM)
640#
641# CONFIG_MD is not set
642
643#
644# Fusion MPT device support
645#
646# CONFIG_FUSION is not set
647
648#
649# IEEE 1394 (FireWire) support
650#
651
652#
653# I2O device support
654#
655
656#
657# Network device support
658#
659CONFIG_NETDEVICES=y
660# CONFIG_DUMMY is not set
661# CONFIG_BONDING is not set
662# CONFIG_EQUALIZER is not set
663# CONFIG_TUN is not set
664
665#
666# PHY device support
667#
668# CONFIG_PHYLIB is not set
669
670#
671# Ethernet (10 or 100Mbit)
672#
673CONFIG_NET_ETHERNET=y
674CONFIG_MII=m
675# CONFIG_SMC91X is not set
676# CONFIG_DM9000 is not set
677
678#
679# Ethernet (1000 Mbit)
680#
681
682#
683# Ethernet (10000 Mbit)
684#
685
686#
687# Token Ring devices
688#
689
690#
691# Wireless LAN (non-hamradio)
692#
693CONFIG_NET_RADIO=y
694
695#
696# Obsolete Wireless cards support (pre-802.11)
697#
698# CONFIG_STRIP is not set
699# CONFIG_PCMCIA_WAVELAN is not set
700# CONFIG_PCMCIA_NETWAVE is not set
701
702#
703# Wireless 802.11 Frequency Hopping cards support
704#
705# CONFIG_PCMCIA_RAYCS is not set
706
707#
708# Wireless 802.11b ISA/PCI cards support
709#
710CONFIG_HERMES=m
711# CONFIG_ATMEL is not set
712
713#
714# Wireless 802.11b Pcmcia/Cardbus cards support
715#
716CONFIG_PCMCIA_HERMES=m
717CONFIG_PCMCIA_SPECTRUM=m
718# CONFIG_AIRO_CS is not set
719# CONFIG_PCMCIA_WL3501 is not set
720CONFIG_HOSTAP=m
721CONFIG_HOSTAP_FIRMWARE=y
722CONFIG_HOSTAP_CS=m
723CONFIG_NET_WIRELESS=y
724
725#
726# PCMCIA network device support
727#
728CONFIG_NET_PCMCIA=y
729# CONFIG_PCMCIA_3C589 is not set
730# CONFIG_PCMCIA_3C574 is not set
731# CONFIG_PCMCIA_FMVJ18X is not set
732CONFIG_PCMCIA_PCNET=m
733# CONFIG_PCMCIA_NMCLAN is not set
734# CONFIG_PCMCIA_SMC91C92 is not set
735# CONFIG_PCMCIA_XIRC2PS is not set
736# CONFIG_PCMCIA_AXNET is not set
737
738#
739# Wan interfaces
740#
741# CONFIG_WAN is not set
742CONFIG_PPP=m
743# CONFIG_PPP_MULTILINK is not set
744# CONFIG_PPP_FILTER is not set
745CONFIG_PPP_ASYNC=m
746# CONFIG_PPP_SYNC_TTY is not set
747# CONFIG_PPP_DEFLATE is not set
748CONFIG_PPP_BSDCOMP=m
749# CONFIG_PPPOE is not set
750# CONFIG_SLIP is not set
751# CONFIG_SHAPER is not set
752# CONFIG_NETCONSOLE is not set
753# CONFIG_NETPOLL is not set
754# CONFIG_NET_POLL_CONTROLLER is not set
755
756#
757# ISDN subsystem
758#
759# CONFIG_ISDN is not set
760
761#
762# Input device support
763#
764CONFIG_INPUT=y
765
766#
767# Userland interfaces
768#
769# CONFIG_INPUT_MOUSEDEV is not set
770# CONFIG_INPUT_JOYDEV is not set
771# CONFIG_INPUT_TSDEV is not set
772CONFIG_INPUT_EVDEV=y
773# CONFIG_INPUT_EVBUG is not set
774
775#
776# Input Device Drivers
777#
778CONFIG_INPUT_KEYBOARD=y
779# CONFIG_KEYBOARD_ATKBD is not set
780# CONFIG_KEYBOARD_SUNKBD is not set
781# CONFIG_KEYBOARD_LKKBD is not set
782# CONFIG_KEYBOARD_XTKBD is not set
783# CONFIG_KEYBOARD_NEWTON is not set
784# CONFIG_KEYBOARD_CORGI is not set
785CONFIG_KEYBOARD_SPITZ=y
786# CONFIG_INPUT_MOUSE is not set
787# CONFIG_INPUT_JOYSTICK is not set
788CONFIG_INPUT_TOUCHSCREEN=y
789CONFIG_TOUCHSCREEN_CORGI=y
790# CONFIG_TOUCHSCREEN_GUNZE is not set
791# CONFIG_TOUCHSCREEN_ELO is not set
792# CONFIG_TOUCHSCREEN_MTOUCH is not set
793# CONFIG_TOUCHSCREEN_MK712 is not set
794CONFIG_INPUT_MISC=y
795CONFIG_INPUT_UINPUT=m
796
797#
798# Hardware I/O ports
799#
800# CONFIG_SERIO is not set
801# CONFIG_GAMEPORT is not set
802
803#
804# Character devices
805#
806CONFIG_VT=y
807CONFIG_VT_CONSOLE=y
808CONFIG_HW_CONSOLE=y
809# CONFIG_SERIAL_NONSTANDARD is not set
810
811#
812# Serial drivers
813#
814CONFIG_SERIAL_8250=m
815CONFIG_SERIAL_8250_CS=m
816CONFIG_SERIAL_8250_NR_UARTS=4
817# CONFIG_SERIAL_8250_EXTENDED is not set
818
819#
820# Non-8250 serial port support
821#
822CONFIG_SERIAL_PXA=y
823CONFIG_SERIAL_PXA_CONSOLE=y
824CONFIG_SERIAL_CORE=y
825CONFIG_SERIAL_CORE_CONSOLE=y
826CONFIG_UNIX98_PTYS=y
827# CONFIG_LEGACY_PTYS is not set
828
829#
830# IPMI
831#
832# CONFIG_IPMI_HANDLER is not set
833
834#
835# Watchdog Cards
836#
837# CONFIG_WATCHDOG is not set
838# CONFIG_NVRAM is not set
839# CONFIG_RTC is not set
840# CONFIG_DTLK is not set
841# CONFIG_R3964 is not set
842
843#
844# Ftape, the floppy tape device driver
845#
846
847#
848# PCMCIA character devices
849#
850# CONFIG_SYNCLINK_CS is not set
851# CONFIG_RAW_DRIVER is not set
852
853#
854# TPM devices
855#
856
857#
858# I2C support
859#
860# CONFIG_I2C is not set
861
862#
863# Hardware Monitoring support
864#
865CONFIG_HWMON=y
866# CONFIG_HWMON_VID is not set
867# CONFIG_HWMON_DEBUG_CHIP is not set
868
869#
870# Misc devices
871#
872
873#
874# Multimedia Capabilities Port drivers
875#
876
877#
878# Multimedia devices
879#
880# CONFIG_VIDEO_DEV is not set
881
882#
883# Digital Video Broadcasting Devices
884#
885# CONFIG_DVB is not set
886
887#
888# Graphics support
889#
890CONFIG_FB=y
891CONFIG_FB_CFB_FILLRECT=y
892CONFIG_FB_CFB_COPYAREA=y
893CONFIG_FB_CFB_IMAGEBLIT=y
894CONFIG_FB_SOFT_CURSOR=y
895# CONFIG_FB_MACMODES is not set
896# CONFIG_FB_MODE_HELPERS is not set
897# CONFIG_FB_TILEBLITTING is not set
898CONFIG_FB_PXA=y
899# CONFIG_FB_W100 is not set
900# CONFIG_FB_PXA_PARAMETERS is not set
901# CONFIG_FB_S1D13XXX is not set
902# CONFIG_FB_VIRTUAL is not set
903
904#
905# Console display driver support
906#
907# CONFIG_VGA_CONSOLE is not set
908CONFIG_DUMMY_CONSOLE=y
909CONFIG_FRAMEBUFFER_CONSOLE=y
910CONFIG_FONTS=y
911CONFIG_FONT_8x8=y
912CONFIG_FONT_8x16=y
913# CONFIG_FONT_6x11 is not set
914# CONFIG_FONT_7x14 is not set
915# CONFIG_FONT_PEARL_8x8 is not set
916# CONFIG_FONT_ACORN_8x8 is not set
917# CONFIG_FONT_MINI_4x6 is not set
918# CONFIG_FONT_SUN8x16 is not set
919# CONFIG_FONT_SUN12x22 is not set
920# CONFIG_FONT_10x18 is not set
921
922#
923# Logo configuration
924#
925# CONFIG_LOGO is not set
926CONFIG_BACKLIGHT_LCD_SUPPORT=y
927CONFIG_BACKLIGHT_CLASS_DEVICE=y
928CONFIG_BACKLIGHT_DEVICE=y
929CONFIG_LCD_CLASS_DEVICE=y
930CONFIG_LCD_DEVICE=y
931CONFIG_BACKLIGHT_CORGI=y
932
933#
934# Sound
935#
936# CONFIG_SOUND is not set
937
938#
939# USB support
940#
941CONFIG_USB_ARCH_HAS_HCD=y
942CONFIG_USB_ARCH_HAS_OHCI=y
943CONFIG_USB=m
944# CONFIG_USB_DEBUG is not set
945
946#
947# Miscellaneous USB options
948#
949CONFIG_USB_DEVICEFS=y
950# CONFIG_USB_BANDWIDTH is not set
951# CONFIG_USB_DYNAMIC_MINORS is not set
952# CONFIG_USB_SUSPEND is not set
953# CONFIG_USB_OTG is not set
954
955#
956# USB Host Controller Drivers
957#
958# CONFIG_USB_ISP116X_HCD is not set
959CONFIG_USB_OHCI_HCD=m
960# CONFIG_USB_OHCI_BIG_ENDIAN is not set
961CONFIG_USB_OHCI_LITTLE_ENDIAN=y
962CONFIG_USB_SL811_HCD=m
963CONFIG_USB_SL811_CS=m
964
965#
966# USB Device Class drivers
967#
968
969#
970# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
971#
972CONFIG_USB_ACM=m
973CONFIG_USB_PRINTER=m
974
975#
976# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
977#
978CONFIG_USB_STORAGE=m
979# CONFIG_USB_STORAGE_DEBUG is not set
980# CONFIG_USB_STORAGE_DATAFAB is not set
981# CONFIG_USB_STORAGE_FREECOM is not set
982# CONFIG_USB_STORAGE_ISD200 is not set
983# CONFIG_USB_STORAGE_DPCM is not set
984# CONFIG_USB_STORAGE_USBAT is not set
985# CONFIG_USB_STORAGE_SDDR09 is not set
986# CONFIG_USB_STORAGE_SDDR55 is not set
987# CONFIG_USB_STORAGE_JUMPSHOT is not set
988# CONFIG_USB_STORAGE_ONETOUCH is not set
989
990#
991# USB Input Devices
992#
993CONFIG_USB_HID=m
994CONFIG_USB_HIDINPUT=y
995# CONFIG_HID_FF is not set
996# CONFIG_USB_HIDDEV is not set
997
998#
999# USB HID Boot Protocol drivers
1000#
1001CONFIG_USB_KBD=m
1002CONFIG_USB_MOUSE=m
1003CONFIG_USB_AIPTEK=m
1004CONFIG_USB_WACOM=m
1005# CONFIG_USB_ACECAD is not set
1006CONFIG_USB_KBTAB=m
1007CONFIG_USB_POWERMATE=m
1008CONFIG_USB_MTOUCH=m
1009# CONFIG_USB_ITMTOUCH is not set
1010CONFIG_USB_EGALAX=m
1011# CONFIG_USB_YEALINK is not set
1012CONFIG_USB_XPAD=m
1013CONFIG_USB_ATI_REMOTE=m
1014# CONFIG_USB_KEYSPAN_REMOTE is not set
1015# CONFIG_USB_APPLETOUCH is not set
1016
1017#
1018# USB Imaging devices
1019#
1020CONFIG_USB_MDC800=m
1021CONFIG_USB_MICROTEK=m
1022
1023#
1024# USB Multimedia devices
1025#
1026CONFIG_USB_DABUSB=m
1027
1028#
1029# Video4Linux support is needed for USB Multimedia device support
1030#
1031
1032#
1033# USB Network Adapters
1034#
1035CONFIG_USB_CATC=m
1036CONFIG_USB_KAWETH=m
1037CONFIG_USB_PEGASUS=m
1038CONFIG_USB_RTL8150=m
1039CONFIG_USB_USBNET=m
1040CONFIG_USB_NET_AX8817X=m
1041CONFIG_USB_NET_CDCETHER=m
1042# CONFIG_USB_NET_GL620A is not set
1043CONFIG_USB_NET_NET1080=m
1044# CONFIG_USB_NET_PLUSB is not set
1045# CONFIG_USB_NET_RNDIS_HOST is not set
1046# CONFIG_USB_NET_CDC_SUBSET is not set
1047CONFIG_USB_NET_ZAURUS=m
1048# CONFIG_USB_ZD1201 is not set
1049CONFIG_USB_MON=y
1050
1051#
1052# USB port drivers
1053#
1054
1055#
1056# USB Serial Converter support
1057#
1058CONFIG_USB_SERIAL=m
1059CONFIG_USB_SERIAL_GENERIC=y
1060# CONFIG_USB_SERIAL_AIRPRIME is not set
1061CONFIG_USB_SERIAL_BELKIN=m
1062# CONFIG_USB_SERIAL_WHITEHEAT is not set
1063CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1064# CONFIG_USB_SERIAL_CP2101 is not set
1065CONFIG_USB_SERIAL_CYPRESS_M8=m
1066CONFIG_USB_SERIAL_EMPEG=m
1067CONFIG_USB_SERIAL_FTDI_SIO=m
1068CONFIG_USB_SERIAL_VISOR=m
1069CONFIG_USB_SERIAL_IPAQ=m
1070CONFIG_USB_SERIAL_IR=m
1071CONFIG_USB_SERIAL_EDGEPORT=m
1072CONFIG_USB_SERIAL_EDGEPORT_TI=m
1073CONFIG_USB_SERIAL_GARMIN=m
1074CONFIG_USB_SERIAL_IPW=m
1075CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1076CONFIG_USB_SERIAL_KEYSPAN=m
1077# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set
1078# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set
1079# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set
1080# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set
1081# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set
1082# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set
1083# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set
1084# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set
1085# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set
1086# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set
1087# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set
1088# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set
1089CONFIG_USB_SERIAL_KLSI=m
1090CONFIG_USB_SERIAL_KOBIL_SCT=m
1091CONFIG_USB_SERIAL_MCT_U232=m
1092CONFIG_USB_SERIAL_PL2303=m
1093# CONFIG_USB_SERIAL_HP4X is not set
1094CONFIG_USB_SERIAL_SAFE=m
1095# CONFIG_USB_SERIAL_SAFE_PADDED is not set
1096CONFIG_USB_SERIAL_TI=m
1097CONFIG_USB_SERIAL_CYBERJACK=m
1098CONFIG_USB_SERIAL_XIRCOM=m
1099# CONFIG_USB_SERIAL_OPTION is not set
1100CONFIG_USB_SERIAL_OMNINET=m
1101CONFIG_USB_EZUSB=y
1102
1103#
1104# USB Miscellaneous drivers
1105#
1106CONFIG_USB_EMI62=m
1107CONFIG_USB_EMI26=m
1108CONFIG_USB_AUERSWALD=m
1109CONFIG_USB_RIO500=m
1110CONFIG_USB_LEGOTOWER=m
1111CONFIG_USB_LCD=m
1112CONFIG_USB_LED=m
1113CONFIG_USB_CYTHERM=m
1114CONFIG_USB_PHIDGETKIT=m
1115CONFIG_USB_PHIDGETSERVO=m
1116CONFIG_USB_IDMOUSE=m
1117# CONFIG_USB_LD is not set
1118# CONFIG_USB_TEST is not set
1119
1120#
1121# USB DSL modem support
1122#
1123
1124#
1125# USB Gadget Support
1126#
1127CONFIG_USB_GADGET=m
1128# CONFIG_USB_GADGET_DEBUG_FILES is not set
1129CONFIG_USB_GADGET_SELECTED=y
1130# CONFIG_USB_GADGET_NET2280 is not set
1131# CONFIG_USB_GADGET_PXA2XX is not set
1132# CONFIG_USB_GADGET_GOKU is not set
1133# CONFIG_USB_GADGET_LH7A40X is not set
1134# CONFIG_USB_GADGET_OMAP is not set
1135CONFIG_USB_GADGET_DUMMY_HCD=y
1136CONFIG_USB_DUMMY_HCD=m
1137CONFIG_USB_GADGET_DUALSPEED=y
1138CONFIG_USB_ZERO=m
1139CONFIG_USB_ETH=m
1140CONFIG_USB_ETH_RNDIS=y
1141CONFIG_USB_GADGETFS=m
1142CONFIG_USB_FILE_STORAGE=m
1143# CONFIG_USB_FILE_STORAGE_TEST is not set
1144CONFIG_USB_G_SERIAL=m
1145
1146#
1147# MMC/SD Card support
1148#
1149CONFIG_MMC=y
1150# CONFIG_MMC_DEBUG is not set
1151CONFIG_MMC_BLOCK=y
1152CONFIG_MMC_PXA=y
1153# CONFIG_MMC_WBSD is not set
1154
1155#
1156# File systems
1157#
1158CONFIG_EXT2_FS=y
1159CONFIG_EXT2_FS_XATTR=y
1160CONFIG_EXT2_FS_POSIX_ACL=y
1161CONFIG_EXT2_FS_SECURITY=y
1162# CONFIG_EXT2_FS_XIP is not set
1163CONFIG_EXT3_FS=y
1164# CONFIG_EXT3_FS_XATTR is not set
1165CONFIG_JBD=y
1166# CONFIG_JBD_DEBUG is not set
1167CONFIG_FS_MBCACHE=y
1168# CONFIG_REISERFS_FS is not set
1169# CONFIG_JFS_FS is not set
1170CONFIG_FS_POSIX_ACL=y
1171# CONFIG_XFS_FS is not set
1172# CONFIG_MINIX_FS is not set
1173# CONFIG_ROMFS_FS is not set
1174CONFIG_INOTIFY=y
1175# CONFIG_QUOTA is not set
1176CONFIG_DNOTIFY=y
1177# CONFIG_AUTOFS_FS is not set
1178# CONFIG_AUTOFS4_FS is not set
1179# CONFIG_FUSE_FS is not set
1180
1181#
1182# CD-ROM/DVD Filesystems
1183#
1184# CONFIG_ISO9660_FS is not set
1185# CONFIG_UDF_FS is not set
1186
1187#
1188# DOS/FAT/NT Filesystems
1189#
1190CONFIG_FAT_FS=y
1191CONFIG_MSDOS_FS=y
1192CONFIG_VFAT_FS=y
1193CONFIG_FAT_DEFAULT_CODEPAGE=437
1194CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1195# CONFIG_NTFS_FS is not set
1196
1197#
1198# Pseudo filesystems
1199#
1200CONFIG_PROC_FS=y
1201CONFIG_SYSFS=y
1202CONFIG_TMPFS=y
1203# CONFIG_HUGETLB_PAGE is not set
1204CONFIG_RAMFS=y
1205# CONFIG_RELAYFS_FS is not set
1206
1207#
1208# Miscellaneous filesystems
1209#
1210# CONFIG_ADFS_FS is not set
1211# CONFIG_AFFS_FS is not set
1212# CONFIG_HFS_FS is not set
1213# CONFIG_HFSPLUS_FS is not set
1214# CONFIG_BEFS_FS is not set
1215# CONFIG_BFS_FS is not set
1216# CONFIG_EFS_FS is not set
1217# CONFIG_JFFS_FS is not set
1218CONFIG_JFFS2_FS=y
1219CONFIG_JFFS2_FS_DEBUG=0
1220CONFIG_JFFS2_FS_WRITEBUFFER=y
1221CONFIG_JFFS2_COMPRESSION_OPTIONS=y
1222CONFIG_JFFS2_ZLIB=y
1223CONFIG_JFFS2_RTIME=y
1224CONFIG_JFFS2_RUBIN=y
1225# CONFIG_JFFS2_CMODE_NONE is not set
1226CONFIG_JFFS2_CMODE_PRIORITY=y
1227# CONFIG_JFFS2_CMODE_SIZE is not set
1228CONFIG_CRAMFS=m
1229# CONFIG_VXFS_FS is not set
1230# CONFIG_HPFS_FS is not set
1231# CONFIG_QNX4FS_FS is not set
1232# CONFIG_SYSV_FS is not set
1233# CONFIG_UFS_FS is not set
1234
1235#
1236# Network File Systems
1237#
1238CONFIG_NFS_FS=m
1239CONFIG_NFS_V3=y
1240# CONFIG_NFS_V3_ACL is not set
1241CONFIG_NFS_V4=y
1242# CONFIG_NFS_DIRECTIO is not set
1243# CONFIG_NFSD is not set
1244CONFIG_LOCKD=m
1245CONFIG_LOCKD_V4=y
1246CONFIG_NFS_COMMON=y
1247CONFIG_SUNRPC=m
1248CONFIG_SUNRPC_GSS=m
1249CONFIG_RPCSEC_GSS_KRB5=m
1250# CONFIG_RPCSEC_GSS_SPKM3 is not set
1251CONFIG_SMB_FS=m
1252CONFIG_SMB_NLS_DEFAULT=y
1253CONFIG_SMB_NLS_REMOTE="cp437"
1254# CONFIG_CIFS is not set
1255# CONFIG_NCP_FS is not set
1256# CONFIG_CODA_FS is not set
1257# CONFIG_AFS_FS is not set
1258# CONFIG_9P_FS is not set
1259
1260#
1261# Partition Types
1262#
1263CONFIG_PARTITION_ADVANCED=y
1264# CONFIG_ACORN_PARTITION is not set
1265# CONFIG_OSF_PARTITION is not set
1266# CONFIG_AMIGA_PARTITION is not set
1267# CONFIG_ATARI_PARTITION is not set
1268# CONFIG_MAC_PARTITION is not set
1269CONFIG_MSDOS_PARTITION=y
1270# CONFIG_BSD_DISKLABEL is not set
1271# CONFIG_MINIX_SUBPARTITION is not set
1272# CONFIG_SOLARIS_X86_PARTITION is not set
1273# CONFIG_UNIXWARE_DISKLABEL is not set
1274# CONFIG_LDM_PARTITION is not set
1275# CONFIG_SGI_PARTITION is not set
1276# CONFIG_ULTRIX_PARTITION is not set
1277# CONFIG_SUN_PARTITION is not set
1278# CONFIG_EFI_PARTITION is not set
1279
1280#
1281# Native Language Support
1282#
1283CONFIG_NLS=y
1284CONFIG_NLS_DEFAULT="cp437"
1285CONFIG_NLS_CODEPAGE_437=y
1286# CONFIG_NLS_CODEPAGE_737 is not set
1287# CONFIG_NLS_CODEPAGE_775 is not set
1288# CONFIG_NLS_CODEPAGE_850 is not set
1289# CONFIG_NLS_CODEPAGE_852 is not set
1290# CONFIG_NLS_CODEPAGE_855 is not set
1291# CONFIG_NLS_CODEPAGE_857 is not set
1292# CONFIG_NLS_CODEPAGE_860 is not set
1293# CONFIG_NLS_CODEPAGE_861 is not set
1294# CONFIG_NLS_CODEPAGE_862 is not set
1295# CONFIG_NLS_CODEPAGE_863 is not set
1296# CONFIG_NLS_CODEPAGE_864 is not set
1297# CONFIG_NLS_CODEPAGE_865 is not set
1298# CONFIG_NLS_CODEPAGE_866 is not set
1299# CONFIG_NLS_CODEPAGE_869 is not set
1300# CONFIG_NLS_CODEPAGE_936 is not set
1301# CONFIG_NLS_CODEPAGE_950 is not set
1302# CONFIG_NLS_CODEPAGE_932 is not set
1303# CONFIG_NLS_CODEPAGE_949 is not set
1304# CONFIG_NLS_CODEPAGE_874 is not set
1305# CONFIG_NLS_ISO8859_8 is not set
1306# CONFIG_NLS_CODEPAGE_1250 is not set
1307# CONFIG_NLS_CODEPAGE_1251 is not set
1308# CONFIG_NLS_ASCII is not set
1309CONFIG_NLS_ISO8859_1=y
1310# CONFIG_NLS_ISO8859_2 is not set
1311# CONFIG_NLS_ISO8859_3 is not set
1312# CONFIG_NLS_ISO8859_4 is not set
1313# CONFIG_NLS_ISO8859_5 is not set
1314# CONFIG_NLS_ISO8859_6 is not set
1315# CONFIG_NLS_ISO8859_7 is not set
1316# CONFIG_NLS_ISO8859_9 is not set
1317# CONFIG_NLS_ISO8859_13 is not set
1318# CONFIG_NLS_ISO8859_14 is not set
1319# CONFIG_NLS_ISO8859_15 is not set
1320# CONFIG_NLS_KOI8_R is not set
1321# CONFIG_NLS_KOI8_U is not set
1322CONFIG_NLS_UTF8=y
1323
1324#
1325# Profiling support
1326#
1327CONFIG_PROFILING=y
1328CONFIG_OPROFILE=m
1329
1330#
1331# Kernel hacking
1332#
1333# CONFIG_PRINTK_TIME is not set
1334CONFIG_DEBUG_KERNEL=y
1335CONFIG_MAGIC_SYSRQ=y
1336CONFIG_LOG_BUF_SHIFT=14
1337CONFIG_DETECT_SOFTLOCKUP=y
1338# CONFIG_SCHEDSTATS is not set
1339# CONFIG_DEBUG_SLAB is not set
1340# CONFIG_DEBUG_PREEMPT is not set
1341# CONFIG_DEBUG_SPINLOCK is not set
1342# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1343# CONFIG_DEBUG_KOBJECT is not set
1344CONFIG_DEBUG_BUGVERBOSE=y
1345# CONFIG_DEBUG_INFO is not set
1346# CONFIG_DEBUG_FS is not set
1347CONFIG_FRAME_POINTER=y
1348# CONFIG_DEBUG_USER is not set
1349# CONFIG_DEBUG_WAITQ is not set
1350CONFIG_DEBUG_ERRORS=y
1351CONFIG_DEBUG_LL=y
1352# CONFIG_DEBUG_ICEDCC is not set
1353
1354#
1355# Security options
1356#
1357# CONFIG_KEYS is not set
1358# CONFIG_SECURITY is not set
1359
1360#
1361# Cryptographic options
1362#
1363CONFIG_CRYPTO=y
1364CONFIG_CRYPTO_HMAC=y
1365CONFIG_CRYPTO_NULL=m
1366CONFIG_CRYPTO_MD4=m
1367CONFIG_CRYPTO_MD5=m
1368CONFIG_CRYPTO_SHA1=m
1369CONFIG_CRYPTO_SHA256=m
1370CONFIG_CRYPTO_SHA512=m
1371CONFIG_CRYPTO_WP512=m
1372# CONFIG_CRYPTO_TGR192 is not set
1373CONFIG_CRYPTO_DES=m
1374CONFIG_CRYPTO_BLOWFISH=m
1375CONFIG_CRYPTO_TWOFISH=m
1376CONFIG_CRYPTO_SERPENT=m
1377CONFIG_CRYPTO_AES=m
1378CONFIG_CRYPTO_CAST5=m
1379CONFIG_CRYPTO_CAST6=m
1380CONFIG_CRYPTO_TEA=m
1381CONFIG_CRYPTO_ARC4=m
1382CONFIG_CRYPTO_KHAZAD=m
1383CONFIG_CRYPTO_ANUBIS=m
1384CONFIG_CRYPTO_DEFLATE=m
1385CONFIG_CRYPTO_MICHAEL_MIC=m
1386CONFIG_CRYPTO_CRC32C=m
1387CONFIG_CRYPTO_TEST=m
1388
1389#
1390# Hardware crypto devices
1391#
1392
1393#
1394# Library routines
1395#
1396CONFIG_CRC_CCITT=y
1397# CONFIG_CRC16 is not set
1398CONFIG_CRC32=y
1399CONFIG_LIBCRC32C=m
1400CONFIG_ZLIB_INFLATE=y
1401CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 42629ff84f5a..ea569ba482b1 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -305,7 +305,7 @@ long execve(const char *filename, char **argv, char **envp)
305 "Ir" (THREAD_START_SP - sizeof(regs)), 305 "Ir" (THREAD_START_SP - sizeof(regs)),
306 "r" (&regs), 306 "r" (&regs),
307 "Ir" (sizeof(regs)) 307 "Ir" (sizeof(regs))
308 : "r0", "r1", "r2", "r3", "ip", "memory"); 308 : "r0", "r1", "r2", "r3", "ip", "lr", "memory");
309 309
310 out: 310 out:
311 return ret; 311 return ret;
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index e7d22dbcb691..f6de76e0a45d 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -504,7 +504,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
504 504
505 bad_access: 505 bad_access:
506 spin_unlock(&mm->page_table_lock); 506 spin_unlock(&mm->page_table_lock);
507 /* simulate a read access fault */ 507 /* simulate a write access fault */
508 do_DataAbort(addr, 15 + (1 << 11), regs); 508 do_DataAbort(addr, 15 + (1 << 11), regs);
509 return -1; 509 return -1;
510 } 510 }
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index f83a59761e02..3d88da0c287b 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -31,6 +31,8 @@
31 31
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33 33
34#include <asm/memory.h>
35
34#include "common.h" 36#include "common.h"
35 37
36struct meminfo memmap = { 38struct meminfo memmap = {
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c
index 41e5849ae8da..f8a742bb2d5b 100644
--- a/arch/arm/mach-imx/generic.c
+++ b/arch/arm/mach-imx/generic.c
@@ -28,14 +28,15 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <asm/arch/imxfb.h> 29#include <asm/arch/imxfb.h>
30#include <asm/hardware.h> 30#include <asm/hardware.h>
31#include <asm/arch/imx-regs.h>
31 32
32#include <asm/mach/map.h> 33#include <asm/mach/map.h>
33 34
34void imx_gpio_mode(int gpio_mode) 35void imx_gpio_mode(int gpio_mode)
35{ 36{
36 unsigned int pin = gpio_mode & GPIO_PIN_MASK; 37 unsigned int pin = gpio_mode & GPIO_PIN_MASK;
37 unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> 5; 38 unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
38 unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> 10; 39 unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
39 unsigned int tmp; 40 unsigned int tmp;
40 41
41 /* Pullup enable */ 42 /* Pullup enable */
@@ -57,7 +58,7 @@ void imx_gpio_mode(int gpio_mode)
57 GPR(port) &= ~(1<<pin); 58 GPR(port) &= ~(1<<pin);
58 59
59 /* use as gpio? */ 60 /* use as gpio? */
60 if( ocr == 3 ) 61 if(gpio_mode & GPIO_GIUS)
61 GIUS(port) |= (1<<pin); 62 GIUS(port) |= (1<<pin);
62 else 63 else
63 GIUS(port) &= ~(1<<pin); 64 GIUS(port) &= ~(1<<pin);
@@ -72,20 +73,20 @@ void imx_gpio_mode(int gpio_mode)
72 tmp |= (ocr << (pin*2)); 73 tmp |= (ocr << (pin*2));
73 OCR1(port) = tmp; 74 OCR1(port) = tmp;
74 75
75 if( gpio_mode & GPIO_AOUT ) 76 ICONFA1(port) &= ~( 3<<(pin*2));
76 ICONFA1(port) &= ~( 3<<(pin*2)); 77 ICONFA1(port) |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << (pin * 2);
77 if( gpio_mode & GPIO_BOUT ) 78 ICONFB1(port) &= ~( 3<<(pin*2));
78 ICONFB1(port) &= ~( 3<<(pin*2)); 79 ICONFB1(port) |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2);
79 } else { 80 } else {
80 tmp = OCR2(port); 81 tmp = OCR2(port);
81 tmp &= ~( 3<<((pin-16)*2)); 82 tmp &= ~( 3<<((pin-16)*2));
82 tmp |= (ocr << ((pin-16)*2)); 83 tmp |= (ocr << ((pin-16)*2));
83 OCR2(port) = tmp; 84 OCR2(port) = tmp;
84 85
85 if( gpio_mode & GPIO_AOUT ) 86 ICONFA2(port) &= ~( 3<<((pin-16)*2));
86 ICONFA2(port) &= ~( 3<<((pin-16)*2)); 87 ICONFA2(port) |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << ((pin-16) * 2);
87 if( gpio_mode & GPIO_BOUT ) 88 ICONFB2(port) &= ~( 3<<((pin-16)*2));
88 ICONFB2(port) &= ~( 3<<((pin-16)*2)); 89 ICONFB2(port) |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << ((pin-16) * 2);
89 } 90 }
90} 91}
91 92
diff --git a/arch/arm/mach-imx/leds-mx1ads.c b/arch/arm/mach-imx/leds-mx1ads.c
index e6399b06e4a4..79236404aec2 100644
--- a/arch/arm/mach-imx/leds-mx1ads.c
+++ b/arch/arm/mach-imx/leds-mx1ads.c
@@ -17,7 +17,6 @@
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/leds.h> 19#include <asm/leds.h>
20#include <asm/mach-types.h>
21#include "leds.h" 20#include "leds.h"
22 21
23/* 22/*
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index 5d25434d332c..a7511ddfe364 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -55,7 +55,7 @@ static void __init
55mx1ads_init(void) 55mx1ads_init(void)
56{ 56{
57#ifdef CONFIG_LEDS 57#ifdef CONFIG_LEDS
58 imx_gpio_mode(GPIO_PORTA | GPIO_OUT | GPIO_GPIO | 2); 58 imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2);
59#endif 59#endif
60 platform_add_devices(devices, ARRAY_SIZE(devices)); 60 platform_add_devices(devices, ARRAY_SIZE(devices));
61} 61}
diff --git a/arch/arm/mach-iop3xx/common.c b/arch/arm/mach-iop3xx/common.c
index bda7394ec06c..fdeeef489a73 100644
--- a/arch/arm/mach-iop3xx/common.c
+++ b/arch/arm/mach-iop3xx/common.c
@@ -27,7 +27,6 @@ unsigned long iop3xx_pcibios_min_mem = 0;
27/* 27/*
28 * Default power-off for EP80219 28 * Default power-off for EP80219
29 */ 29 */
30#include <asm/mach-types.h>
31 30
32static inline void ep80219_send_to_pic(__u8 c) { 31static inline void ep80219_send_to_pic(__u8 c) {
33} 32}
diff --git a/arch/arm/mach-iop3xx/iop321-time.c b/arch/arm/mach-iop3xx/iop321-time.c
index 0039793b694a..d67ac0e5d438 100644
--- a/arch/arm/mach-iop3xx/iop321-time.c
+++ b/arch/arm/mach-iop3xx/iop321-time.c
@@ -23,7 +23,6 @@
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/mach-types.h>
27#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
28#include <asm/mach/time.h> 27#include <asm/mach/time.h>
29 28
diff --git a/arch/arm/mach-iop3xx/iop331-time.c b/arch/arm/mach-iop3xx/iop331-time.c
index 8eddfac7e2b0..3c1f0ebbd636 100644
--- a/arch/arm/mach-iop3xx/iop331-time.c
+++ b/arch/arm/mach-iop3xx/iop331-time.c
@@ -23,7 +23,6 @@
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/mach-types.h>
27#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
28#include <asm/mach/time.h> 27#include <asm/mach/time.h>
29 28
diff --git a/arch/arm/mach-iop3xx/iq31244-mm.c b/arch/arm/mach-iop3xx/iq31244-mm.c
index b01042f7de71..55992ab586ba 100644
--- a/arch/arm/mach-iop3xx/iq31244-mm.c
+++ b/arch/arm/mach-iop3xx/iq31244-mm.c
@@ -21,7 +21,6 @@
21#include <asm/page.h> 21#include <asm/page.h>
22 22
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24#include <asm/mach-types.h>
25 24
26 25
27/* 26/*
diff --git a/arch/arm/mach-iop3xx/iq80321-mm.c b/arch/arm/mach-iop3xx/iq80321-mm.c
index 1580c7ed2b9d..bb3e9e5a9aff 100644
--- a/arch/arm/mach-iop3xx/iq80321-mm.c
+++ b/arch/arm/mach-iop3xx/iq80321-mm.c
@@ -21,7 +21,6 @@
21#include <asm/page.h> 21#include <asm/page.h>
22 22
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24#include <asm/mach-types.h>
25 24
26 25
27/* 26/*
diff --git a/arch/arm/mach-iop3xx/iq80331-mm.c b/arch/arm/mach-iop3xx/iq80331-mm.c
index ee8c333e115f..129eb49b0670 100644
--- a/arch/arm/mach-iop3xx/iq80331-mm.c
+++ b/arch/arm/mach-iop3xx/iq80331-mm.c
@@ -21,7 +21,6 @@
21#include <asm/page.h> 21#include <asm/page.h>
22 22
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24#include <asm/mach-types.h>
25 24
26 25
27/* 26/*
diff --git a/arch/arm/mach-iop3xx/iq80332-mm.c b/arch/arm/mach-iop3xx/iq80332-mm.c
index 084afcdfb1eb..2feaf7591f53 100644
--- a/arch/arm/mach-iop3xx/iq80332-mm.c
+++ b/arch/arm/mach-iop3xx/iq80332-mm.c
@@ -21,7 +21,6 @@
21#include <asm/page.h> 21#include <asm/page.h>
22 22
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24#include <asm/mach-types.h>
25 24
26 25
27/* 26/*
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 74bd2fd602d4..f4d7f1f6ef85 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -30,7 +30,6 @@
30#include <asm/setup.h> 30#include <asm/setup.h>
31#include <asm/memory.h> 31#include <asm/memory.h>
32#include <asm/hardware.h> 32#include <asm/hardware.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h> 33#include <asm/irq.h>
35#include <asm/system.h> 34#include <asm/system.h>
36#include <asm/tlbflush.h> 35#include <asm/tlbflush.h>
@@ -168,7 +167,7 @@ static struct plat_serial8250_port ixp2000_serial_port[] = {
168 167
169static struct resource ixp2000_uart_resource = { 168static struct resource ixp2000_uart_resource = {
170 .start = IXP2000_UART_PHYS_BASE, 169 .start = IXP2000_UART_PHYS_BASE,
171 .end = IXP2000_UART_PHYS_BASE + 0xffff, 170 .end = IXP2000_UART_PHYS_BASE + 0x1f,
172 .flags = IORESOURCE_MEM, 171 .flags = IORESOURCE_MEM,
173}; 172};
174 173
diff --git a/arch/arm/mach-ixp2000/pci.c b/arch/arm/mach-ixp2000/pci.c
index 0788fb2b5c10..522205acb316 100644
--- a/arch/arm/mach-ixp2000/pci.c
+++ b/arch/arm/mach-ixp2000/pci.c
@@ -28,7 +28,6 @@
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/mach-types.h>
32#include <asm/hardware.h> 31#include <asm/hardware.h>
33 32
34#include <asm/mach/pci.h> 33#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 39b06ed80646..0a41080d2266 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -123,7 +123,7 @@ static void __init ixdp425_init(void)
123 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices)); 123 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
124} 124}
125 125
126#ifdef CONFIG_ARCH_IXDP465 126#ifdef CONFIG_ARCH_IXDP425
127MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") 127MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
128 /* Maintainer: MontaVista Software, Inc. */ 128 /* Maintainer: MontaVista Software, Inc. */
129 .phys_ram = PHYS_OFFSET, 129 .phys_ram = PHYS_OFFSET,
diff --git a/arch/arm/mach-l7200/core.c b/arch/arm/mach-l7200/core.c
index 2a7fee2a7635..5fd8c9f97f9a 100644
--- a/arch/arm/mach-l7200/core.c
+++ b/arch/arm/mach-l7200/core.c
@@ -12,7 +12,6 @@
12#include <asm/page.h> 12#include <asm/page.h>
13 13
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15#include <asm/arch/hardware.h>
16 15
17/* 16/*
18 * IRQ base register 17 * IRQ base register
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index be37586cb1b0..60c8b9d8bb9c 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -36,6 +36,7 @@
36#include <asm/arch/mmc.h> 36#include <asm/arch/mmc.h>
37#include <asm/arch/udc.h> 37#include <asm/arch/udc.h>
38#include <asm/arch/corgi.h> 38#include <asm/arch/corgi.h>
39#include <asm/arch/sharpsl.h>
39 40
40#include <asm/mach/sharpsl_param.h> 41#include <asm/mach/sharpsl_param.h>
41#include <asm/hardware/scoop.h> 42#include <asm/hardware/scoop.h>
diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c
index c5efcd04fcbc..c02ef7c0f7ef 100644
--- a/arch/arm/mach-pxa/corgi_lcd.c
+++ b/arch/arm/mach-pxa/corgi_lcd.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <asm/mach-types.h>
23#include <asm/arch/akita.h> 22#include <asm/arch/akita.h>
24#include <asm/arch/corgi.h> 23#include <asm/arch/corgi.h>
25#include <asm/arch/hardware.h> 24#include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index a45aaa115a76..d0660a8c4b70 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -34,6 +34,7 @@
34#include <asm/arch/udc.h> 34#include <asm/arch/udc.h>
35#include <asm/arch/pxafb.h> 35#include <asm/arch/pxafb.h>
36#include <asm/arch/mmc.h> 36#include <asm/arch/mmc.h>
37#include <asm/arch/i2c.h>
37 38
38#include "generic.h" 39#include "generic.h"
39 40
diff --git a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c2410/usb-simtec.c
index f021fd82be52..5098b50158a3 100644
--- a/arch/arm/mach-s3c2410/usb-simtec.c
+++ b/arch/arm/mach-s3c2410/usb-simtec.c
@@ -40,7 +40,6 @@
40#include <asm/hardware.h> 40#include <asm/hardware.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/mach-types.h>
44 43
45#include "devs.h" 44#include "devs.h"
46#include "usb-simtec.h" 45#include "usb-simtec.h"
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 25d6a4e27533..6ecab7e2c238 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -111,11 +111,11 @@ static struct mtd_partition collie_partitions[] = {
111 111
112static void collie_set_vpp(int vpp) 112static void collie_set_vpp(int vpp)
113{ 113{
114 write_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR, read_scoop_reg(SCOOP_GPCR) | COLLIE_SCP_VPEN); 114 write_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR) | COLLIE_SCP_VPEN);
115 if (vpp) 115 if (vpp)
116 write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(SCOOP_GPWR) | COLLIE_SCP_VPEN); 116 write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR) | COLLIE_SCP_VPEN);
117 else 117 else
118 write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(SCOOP_GPWR) & ~COLLIE_SCP_VPEN); 118 write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR) & ~COLLIE_SCP_VPEN);
119} 119}
120 120
121static struct flash_platform_data collie_flash_data = { 121static struct flash_platform_data collie_flash_data = {
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 3c8862fde51a..a30e0451df72 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -30,7 +30,6 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/leds.h> 32#include <asm/leds.h>
33#include <asm/mach-types.h>
34#include <asm/hardware/amba.h> 33#include <asm/hardware/amba.h>
35#include <asm/hardware/amba_clcd.h> 34#include <asm/hardware/amba_clcd.h>
36#include <asm/hardware/arm_timer.h> 35#include <asm/hardware/arm_timer.h>
@@ -52,8 +51,9 @@
52 * 51 *
53 * Setup a VA for the Versatile Vectored Interrupt Controller. 52 * Setup a VA for the Versatile Vectored Interrupt Controller.
54 */ 53 */
55#define VA_VIC_BASE IO_ADDRESS(VERSATILE_VIC_BASE) 54#define __io_address(n) __io(IO_ADDRESS(n))
56#define VA_SIC_BASE IO_ADDRESS(VERSATILE_SIC_BASE) 55#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)
56#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)
57 57
58static void vic_mask_irq(unsigned int irq) 58static void vic_mask_irq(unsigned int irq)
59{ 59{
@@ -214,7 +214,7 @@ void __init versatile_map_io(void)
214 iotable_init(versatile_io_desc, ARRAY_SIZE(versatile_io_desc)); 214 iotable_init(versatile_io_desc, ARRAY_SIZE(versatile_io_desc));
215} 215}
216 216
217#define VERSATILE_REFCOUNTER (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_24MHz_OFFSET) 217#define VERSATILE_REFCOUNTER (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_24MHz_OFFSET)
218 218
219/* 219/*
220 * This is the Versatile sched_clock implementation. This has 220 * This is the Versatile sched_clock implementation. This has
@@ -231,7 +231,7 @@ unsigned long long sched_clock(void)
231} 231}
232 232
233 233
234#define VERSATILE_FLASHCTRL (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET) 234#define VERSATILE_FLASHCTRL (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET)
235 235
236static int versatile_flash_init(void) 236static int versatile_flash_init(void)
237{ 237{
@@ -309,7 +309,7 @@ static struct platform_device smc91x_device = {
309 .resource = smc91x_resources, 309 .resource = smc91x_resources,
310}; 310};
311 311
312#define VERSATILE_SYSMCI (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET) 312#define VERSATILE_SYSMCI (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET)
313 313
314unsigned int mmc_status(struct device *dev) 314unsigned int mmc_status(struct device *dev)
315{ 315{
@@ -343,11 +343,11 @@ static const struct icst307_params versatile_oscvco_params = {
343 343
344static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco) 344static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco)
345{ 345{
346 unsigned long sys_lock = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET; 346 void __iomem *sys_lock = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET;
347#if defined(CONFIG_ARCH_VERSATILE_PB) 347#if defined(CONFIG_ARCH_VERSATILE_PB)
348 unsigned long sys_osc = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC4_OFFSET; 348 void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC4_OFFSET;
349#elif defined(CONFIG_MACH_VERSATILE_AB) 349#elif defined(CONFIG_MACH_VERSATILE_AB)
350 unsigned long sys_osc = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC1_OFFSET; 350 void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC1_OFFSET;
351#endif 351#endif
352 u32 val; 352 u32 val;
353 353
@@ -483,7 +483,7 @@ static struct clcd_panel epson_2_2_in = {
483 */ 483 */
484static struct clcd_panel *versatile_clcd_panel(void) 484static struct clcd_panel *versatile_clcd_panel(void)
485{ 485{
486 unsigned long sys_clcd = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; 486 void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET;
487 struct clcd_panel *panel = &vga; 487 struct clcd_panel *panel = &vga;
488 u32 val; 488 u32 val;
489 489
@@ -510,7 +510,7 @@ static struct clcd_panel *versatile_clcd_panel(void)
510 */ 510 */
511static void versatile_clcd_disable(struct clcd_fb *fb) 511static void versatile_clcd_disable(struct clcd_fb *fb)
512{ 512{
513 unsigned long sys_clcd = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; 513 void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET;
514 u32 val; 514 u32 val;
515 515
516 val = readl(sys_clcd); 516 val = readl(sys_clcd);
@@ -522,7 +522,7 @@ static void versatile_clcd_disable(struct clcd_fb *fb)
522 * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light off 522 * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light off
523 */ 523 */
524 if (fb->panel == &sanyo_2_5_in) { 524 if (fb->panel == &sanyo_2_5_in) {
525 unsigned long versatile_ib2_ctrl = IO_ADDRESS(VERSATILE_IB2_CTRL); 525 void __iomem *versatile_ib2_ctrl = __io_address(VERSATILE_IB2_CTRL);
526 unsigned long ctrl; 526 unsigned long ctrl;
527 527
528 ctrl = readl(versatile_ib2_ctrl); 528 ctrl = readl(versatile_ib2_ctrl);
@@ -537,7 +537,7 @@ static void versatile_clcd_disable(struct clcd_fb *fb)
537 */ 537 */
538static void versatile_clcd_enable(struct clcd_fb *fb) 538static void versatile_clcd_enable(struct clcd_fb *fb)
539{ 539{
540 unsigned long sys_clcd = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; 540 void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET;
541 u32 val; 541 u32 val;
542 542
543 val = readl(sys_clcd); 543 val = readl(sys_clcd);
@@ -571,7 +571,7 @@ static void versatile_clcd_enable(struct clcd_fb *fb)
571 * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light on 571 * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light on
572 */ 572 */
573 if (fb->panel == &sanyo_2_5_in) { 573 if (fb->panel == &sanyo_2_5_in) {
574 unsigned long versatile_ib2_ctrl = IO_ADDRESS(VERSATILE_IB2_CTRL); 574 void __iomem *versatile_ib2_ctrl = __io_address(VERSATILE_IB2_CTRL);
575 unsigned long ctrl; 575 unsigned long ctrl;
576 576
577 ctrl = readl(versatile_ib2_ctrl); 577 ctrl = readl(versatile_ib2_ctrl);
@@ -720,7 +720,7 @@ static struct amba_device *amba_devs[] __initdata = {
720}; 720};
721 721
722#ifdef CONFIG_LEDS 722#ifdef CONFIG_LEDS
723#define VA_LEDS_BASE (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET) 723#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
724 724
725static void versatile_leds_event(led_event_t ledevt) 725static void versatile_leds_event(led_event_t ledevt)
726{ 726{
@@ -778,11 +778,11 @@ void __init versatile_init(void)
778/* 778/*
779 * Where is the timer (VA)? 779 * Where is the timer (VA)?
780 */ 780 */
781#define TIMER0_VA_BASE IO_ADDRESS(VERSATILE_TIMER0_1_BASE) 781#define TIMER0_VA_BASE __io_address(VERSATILE_TIMER0_1_BASE)
782#define TIMER1_VA_BASE (IO_ADDRESS(VERSATILE_TIMER0_1_BASE) + 0x20) 782#define TIMER1_VA_BASE (__io_address(VERSATILE_TIMER0_1_BASE) + 0x20)
783#define TIMER2_VA_BASE IO_ADDRESS(VERSATILE_TIMER2_3_BASE) 783#define TIMER2_VA_BASE __io_address(VERSATILE_TIMER2_3_BASE)
784#define TIMER3_VA_BASE (IO_ADDRESS(VERSATILE_TIMER2_3_BASE) + 0x20) 784#define TIMER3_VA_BASE (__io_address(VERSATILE_TIMER2_3_BASE) + 0x20)
785#define VA_IC_BASE IO_ADDRESS(VERSATILE_VIC_BASE) 785#define VA_IC_BASE __io_address(VERSATILE_VIC_BASE)
786 786
787/* 787/*
788 * How long is the timer interval? 788 * How long is the timer interval?
@@ -877,12 +877,12 @@ static void __init versatile_timer_init(void)
877 * VERSATILE_REFCLK is 32KHz 877 * VERSATILE_REFCLK is 32KHz
878 * VERSATILE_TIMCLK is 1MHz 878 * VERSATILE_TIMCLK is 1MHz
879 */ 879 */
880 val = readl(IO_ADDRESS(VERSATILE_SCTL_BASE)); 880 val = readl(__io_address(VERSATILE_SCTL_BASE));
881 writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | 881 writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) |
882 (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | 882 (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) |
883 (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | 883 (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) |
884 (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val, 884 (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val,
885 IO_ADDRESS(VERSATILE_SCTL_BASE)); 885 __io_address(VERSATILE_SCTL_BASE));
886 886
887 /* 887 /*
888 * Initialise to a known state (all timers off) 888 * Initialise to a known state (all timers off)
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index d1565e851f0e..b80d57d51699 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -29,7 +29,6 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/mach/pci.h> 31#include <asm/mach/pci.h>
32#include <asm/mach-types.h>
33 32
34/* 33/*
35 * these spaces are mapped using the following base registers: 34 * these spaces are mapped using the following base registers:
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index db5e47dfc303..c54e04c995ee 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -370,21 +370,21 @@ config CPU_BIG_ENDIAN
370 370
371config CPU_ICACHE_DISABLE 371config CPU_ICACHE_DISABLE
372 bool "Disable I-Cache" 372 bool "Disable I-Cache"
373 depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 373 depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6
374 help 374 help
375 Say Y here to disable the processor instruction cache. Unless 375 Say Y here to disable the processor instruction cache. Unless
376 you have a reason not to or are unsure, say N. 376 you have a reason not to or are unsure, say N.
377 377
378config CPU_DCACHE_DISABLE 378config CPU_DCACHE_DISABLE
379 bool "Disable D-Cache" 379 bool "Disable D-Cache"
380 depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 380 depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6
381 help 381 help
382 Say Y here to disable the processor data cache. Unless 382 Say Y here to disable the processor data cache. Unless
383 you have a reason not to or are unsure, say N. 383 you have a reason not to or are unsure, say N.
384 384
385config CPU_DCACHE_WRITETHROUGH 385config CPU_DCACHE_WRITETHROUGH
386 bool "Force write through D-cache" 386 bool "Force write through D-cache"
387 depends on (CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020) && !CPU_DCACHE_DISABLE 387 depends on (CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6) && !CPU_DCACHE_DISABLE
388 default y if CPU_ARM925T 388 default y if CPU_ARM925T
389 help 389 help
390 Say Y here to use the data cache in writethrough mode. Unless you 390 Say Y here to use the data cache in writethrough mode. Unless you
@@ -399,7 +399,7 @@ config CPU_CACHE_ROUND_ROBIN
399 399
400config CPU_BPREDICT_DISABLE 400config CPU_BPREDICT_DISABLE
401 bool "Disable branch prediction" 401 bool "Disable branch prediction"
402 depends on CPU_ARM1020 402 depends on CPU_ARM1020 || CPU_V6
403 help 403 help
404 Say Y here to disable branch prediction. If unsure, say N. 404 Say Y here to disable branch prediction. If unsure, say N.
405 405
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index 8f76f3df7b4c..dbd346033122 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -20,6 +20,11 @@
20 */ 20 */
21 .align 5 21 .align 5
22ENTRY(v6_early_abort) 22ENTRY(v6_early_abort)
23#ifdef CONFIG_CPU_MPCORE
24 clrex
25#else
26 strex r0, r1, [sp] @ Clear the exclusive monitor
27#endif
23 mrc p15, 0, r1, c5, c0, 0 @ get FSR 28 mrc p15, 0, r1, c5, c0, 0 @ get FSR
24 mrc p15, 0, r0, c6, c0, 0 @ get FAR 29 mrc p15, 0, r0, c6, c0, 0 @ get FAR
25/* 30/*
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 4b39d867ac14..f35e69e9c65c 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -330,6 +330,9 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr,
330{ 330{
331 unsigned int rd = RD_BITS(instr); 331 unsigned int rd = RD_BITS(instr);
332 332
333 if (((rd & 1) == 1) || (rd == 14))
334 goto bad;
335
333 ai_dword += 1; 336 ai_dword += 1;
334 337
335 if (user_mode(regs)) 338 if (user_mode(regs))
@@ -361,7 +364,8 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr,
361 } 364 }
362 365
363 return TYPE_LDST; 366 return TYPE_LDST;
364 367 bad:
368 return TYPE_ERROR;
365 fault: 369 fault:
366 return TYPE_FAULT; 370 return TYPE_FAULT;
367} 371}
@@ -663,6 +667,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
663 else if ((instr & 0x001000f0) == 0x000000d0 || /* LDRD */ 667 else if ((instr & 0x001000f0) == 0x000000d0 || /* LDRD */
664 (instr & 0x001000f0) == 0x000000f0) /* STRD */ 668 (instr & 0x001000f0) == 0x000000f0) /* STRD */
665 handler = do_alignment_ldrdstrd; 669 handler = do_alignment_ldrdstrd;
670 else if ((instr & 0x01f00ff0) == 0x01000090) /* SWP */
671 goto swp;
666 else 672 else
667 goto bad; 673 goto bad;
668 break; 674 break;
@@ -733,6 +739,9 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
733 do_bad_area(current, current->mm, addr, fsr, regs); 739 do_bad_area(current, current->mm, addr, fsr, regs);
734 return 0; 740 return 0;
735 741
742 swp:
743 printk(KERN_ERR "Alignment trap: not handling swp instruction\n");
744
736 bad: 745 bad:
737 /* 746 /*
738 * Oops, we didn't handle the instruction. 747 * Oops, we didn't handle the instruction.
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index 85c10a71e7c6..72966d90e956 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -18,6 +18,7 @@
18#define HARVARD_CACHE 18#define HARVARD_CACHE
19#define CACHE_LINE_SIZE 32 19#define CACHE_LINE_SIZE 32
20#define D_CACHE_LINE_SIZE 32 20#define D_CACHE_LINE_SIZE 32
21#define BTB_FLUSH_SIZE 8
21 22
22/* 23/*
23 * v6_flush_cache_all() 24 * v6_flush_cache_all()
@@ -98,7 +99,13 @@ ENTRY(v6_coherent_user_range)
98 mcr p15, 0, r0, c7, c5, 1 @ invalidate I line 99 mcr p15, 0, r0, c7, c5, 1 @ invalidate I line
99#endif 100#endif
100 mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry 101 mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry
101 add r0, r0, #CACHE_LINE_SIZE 102 add r0, r0, #BTB_FLUSH_SIZE
103 mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry
104 add r0, r0, #BTB_FLUSH_SIZE
105 mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry
106 add r0, r0, #BTB_FLUSH_SIZE
107 mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry
108 add r0, r0, #BTB_FLUSH_SIZE
102 cmp r0, r1 109 cmp r0, r1
103 blo 1b 110 blo 1b
104#ifdef HARVARD_CACHE 111#ifdef HARVARD_CACHE
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index b0208c992576..c9a03981b785 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -17,6 +17,24 @@
17 17
18#ifdef CONFIG_CPU_CACHE_VIPT 18#ifdef CONFIG_CPU_CACHE_VIPT
19 19
20#define ALIAS_FLUSH_START 0xffff4000
21
22#define TOP_PTE(x) pte_offset_kernel(top_pmd, x)
23
24static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr)
25{
26 unsigned long to = ALIAS_FLUSH_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT);
27
28 set_pte(TOP_PTE(to), pfn_pte(pfn, PAGE_KERNEL));
29 flush_tlb_kernel_page(to);
30
31 asm( "mcrr p15, 0, %1, %0, c14\n"
32 " mcrr p15, 0, %1, %0, c5\n"
33 :
34 : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES)
35 : "cc");
36}
37
20void flush_cache_mm(struct mm_struct *mm) 38void flush_cache_mm(struct mm_struct *mm)
21{ 39{
22 if (cache_is_vivt()) { 40 if (cache_is_vivt()) {
@@ -67,24 +85,6 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsig
67 if (cache_is_vipt_aliasing()) 85 if (cache_is_vipt_aliasing())
68 flush_pfn_alias(pfn, user_addr); 86 flush_pfn_alias(pfn, user_addr);
69} 87}
70
71#define ALIAS_FLUSH_START 0xffff4000
72
73#define TOP_PTE(x) pte_offset_kernel(top_pmd, x)
74
75static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr)
76{
77 unsigned long to = ALIAS_FLUSH_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT);
78
79 set_pte(TOP_PTE(to), pfn_pte(pfn, PAGE_KERNEL));
80 flush_tlb_kernel_page(to);
81
82 asm( "mcrr p15, 0, %1, %0, c14\n"
83 " mcrr p15, 0, %1, %0, c5\n"
84 :
85 : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES)
86 : "cc");
87}
88#else 88#else
89#define flush_pfn_alias(pfn,vaddr) do { } while (0) 89#define flush_pfn_alias(pfn,vaddr) do { } while (0)
90#endif 90#endif
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 6cb20aea7f51..02bcc6c1cd1b 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -25,7 +25,6 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/hardware/clock.h> 26#include <asm/hardware/clock.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/mach-types.h>
29#include <asm/setup.h> 28#include <asm/setup.h>
30 29
31#include <asm/arch/board.h> 30#include <asm/arch/board.h>
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index 409aac2c4b9d..fd894bb00107 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -21,7 +21,6 @@
21#include <linux/err.h> 21#include <linux/err.h>
22 22
23#include <asm/hardware.h> 23#include <asm/hardware.h>
24#include <asm/mach-types.h>
25#include <asm/io.h> 24#include <asm/io.h>
26#include <asm/system.h> 25#include <asm/system.h>
27 26
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index 98f1c76f8660..14a836d7ac25 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -33,7 +33,6 @@
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/hardware.h> 35#include <asm/hardware.h>
36#include <asm/mach-types.h>
37 36
38#include <asm/arch/mux.h> 37#include <asm/arch/mux.h>
39#include <asm/arch/usb.h> 38#include <asm/arch/usb.h>
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 6d3a79e5fef8..ae7c64b8cec3 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -2,11 +2,17 @@
2# 2#
3# This file is linux/arch/arm/tools/mach-types 3# This file is linux/arch/arm/tools/mach-types
4# 4#
5# Up to date versions of this file can be obtained from:
6#
7# http://www.arm.linux.org.uk/developer/machines/?action=download
8#
5# Please do not send patches to this file; it is automatically generated! 9# Please do not send patches to this file; it is automatically generated!
6# To add an entry into this database, please see Documentation/arm/README, 10# To add an entry into this database, please see Documentation/arm/README,
7# or contact rmk@arm.linux.org.uk 11# or visit:
12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new
8# 14#
9# Last update: Thu Jun 23 20:19:33 2005 15# Last update: Mon Oct 10 09:46:25 2005
10# 16#
11# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
12# 18#
@@ -421,7 +427,7 @@ mt02 MACH_MT02 MT02 410
421mport3s MACH_MPORT3S MPORT3S 411 427mport3s MACH_MPORT3S MPORT3S 411
422ra_alpha MACH_RA_ALPHA RA_ALPHA 412 428ra_alpha MACH_RA_ALPHA RA_ALPHA 412
423xcep MACH_XCEP XCEP 413 429xcep MACH_XCEP XCEP 413
424arcom_mercury MACH_ARCOM_MERCURY ARCOM_MERCURY 414 430arcom_vulcan MACH_ARCOM_VULCAN ARCOM_VULCAN 414
425stargate MACH_STARGATE STARGATE 415 431stargate MACH_STARGATE STARGATE 415
426armadilloj MACH_ARMADILLOJ ARMADILLOJ 416 432armadilloj MACH_ARMADILLOJ ARMADILLOJ 416
427elroy_jack MACH_ELROY_JACK ELROY_JACK 417 433elroy_jack MACH_ELROY_JACK ELROY_JACK 417
@@ -454,7 +460,7 @@ esl_sarva MACH_ESL_SARVA ESL_SARVA 443
454xm250 MACH_XM250 XM250 444 460xm250 MACH_XM250 XM250 444
455t6tc1xb MACH_T6TC1XB T6TC1XB 445 461t6tc1xb MACH_T6TC1XB T6TC1XB 445
456ess710 MACH_ESS710 ESS710 446 462ess710 MACH_ESS710 ESS710 446
457mx3ads MACH_MX3ADS MX3ADS 447 463mx31ads MACH_MX3ADS MX3ADS 447
458himalaya MACH_HIMALAYA HIMALAYA 448 464himalaya MACH_HIMALAYA HIMALAYA 448
459bolfenk MACH_BOLFENK BOLFENK 449 465bolfenk MACH_BOLFENK BOLFENK 449
460at91rm9200kr MACH_AT91RM9200KR AT91RM9200KR 450 466at91rm9200kr MACH_AT91RM9200KR AT91RM9200KR 450
@@ -787,3 +793,79 @@ ez_ixp42x MACH_EZ_IXP42X EZ_IXP42X 778
787tapwave_zodiac MACH_TAPWAVE_ZODIAC TAPWAVE_ZODIAC 779 793tapwave_zodiac MACH_TAPWAVE_ZODIAC TAPWAVE_ZODIAC 779
788universalmeter MACH_UNIVERSALMETER UNIVERSALMETER 780 794universalmeter MACH_UNIVERSALMETER UNIVERSALMETER 780
789hicoarm9 MACH_HICOARM9 HICOARM9 781 795hicoarm9 MACH_HICOARM9 HICOARM9 781
796pnx4008 MACH_PNX4008 PNX4008 782
797kws6000 MACH_KWS6000 KWS6000 783
798portux920t MACH_PORTUX920T PORTUX920T 784
799ez_x5 MACH_EZ_X5 EZ_X5 785
800omap_rudolph MACH_OMAP_RUDOLPH OMAP_RUDOLPH 786
801cpuat91 MACH_CPUAT91 CPUAT91 787
802rea9200 MACH_REA9200 REA9200 788
803acts_pune_sa1110 MACH_ACTS_PUNE_SA1110 ACTS_PUNE_SA1110 789
804ixp425 MACH_IXP425 IXP425 790
805argonplusodyssey MACH_ODYSSEY ODYSSEY 791
806perch MACH_PERCH PERCH 792
807eis05r1 MACH_EIS05R1 EIS05R1 793
808pepperpad MACH_PEPPERPAD PEPPERPAD 794
809sb3010 MACH_SB3010 SB3010 795
810rm9200 MACH_RM9200 RM9200 796
811dma03 MACH_DMA03 DMA03 797
812road_s101 MACH_ROAD_S101 ROAD_S101 798
813iq_nextgen_a MACH_IQ_NEXTGEN_A IQ_NEXTGEN_A 799
814iq_nextgen_b MACH_IQ_NEXTGEN_B IQ_NEXTGEN_B 800
815iq_nextgen_c MACH_IQ_NEXTGEN_C IQ_NEXTGEN_C 801
816iq_nextgen_d MACH_IQ_NEXTGEN_D IQ_NEXTGEN_D 802
817iq_nextgen_e MACH_IQ_NEXTGEN_E IQ_NEXTGEN_E 803
818mallow_at91 MACH_MALLOW_AT91 MALLOW_AT91 804
819cybertracker MACH_CYBERTRACKER CYBERTRACKER 805
820gesbc931x MACH_GESBC931X GESBC931X 806
821centipad MACH_CENTIPAD CENTIPAD 807
822armsoc MACH_ARMSOC ARMSOC 808
823se4200 MACH_SE4200 SE4200 809
824ems197a MACH_EMS197A EMS197A 810
825micro9 MACH_MICRO9 MICRO9 811
826micro9l MACH_MICRO9L MICRO9L 812
827uc5471dsp MACH_UC5471DSP UC5471DSP 813
828sj5471eng MACH_SJ5471ENG SJ5471ENG 814
829none MACH_CMPXA26X CMPXA26X 815
830nc MACH_NC NC 816
831omap_palmte MACH_OMAP_PALMTE OMAP_PALMTE 817
832ajax52x MACH_AJAX52X AJAX52X 818
833siriustar MACH_SIRIUSTAR SIRIUSTAR 819
834iodata_hdlg MACH_IODATA_HDLG IODATA_HDLG 820
835at91rm9200utl MACH_AT91RM9200UTL AT91RM9200UTL 821
836biosafe MACH_BIOSAFE BIOSAFE 822
837mp1000 MACH_MP1000 MP1000 823
838parsy MACH_PARSY PARSY 824
839ccxp270 MACH_CCXP CCXP 825
840omap_gsample MACH_OMAP_GSAMPLE OMAP_GSAMPLE 826
841realview_eb MACH_REALVIEW_EB REALVIEW_EB 827
842samoa MACH_SAMOA SAMOA 828
843t3xscale MACH_T3XSCALE T3XSCALE 829
844i878 MACH_I878 I878 830
845borzoi MACH_BORZOI BORZOI 831
846gecko MACH_GECKO GECKO 832
847ds101 MACH_DS101 DS101 833
848omap_palmtt2 MACH_OMAP_PALMTT2 OMAP_PALMTT2 834
849xscale_palmld MACH_XSCALE_PALMLD XSCALE_PALMLD 835
850cc9c MACH_CC9C CC9C 836
851sbc1670 MACH_SBC1670 SBC1670 837
852ixdp28x5 MACH_IXDP28X5 IXDP28X5 838
853omap_palmtt MACH_OMAP_PALMTT OMAP_PALMTT 839
854ml696k MACH_ML696K ML696K 840
855arcom_zeus MACH_ARCOM_ZEUS ARCOM_ZEUS 841
856osiris MACH_OSIRIS OSIRIS 842
857maestro MACH_MAESTRO MAESTRO 843
858tunge2 MACH_TUNGE2 TUNGE2 844
859ixbbm MACH_IXBBM IXBBM 845
860mx27 MACH_MX27 MX27 846
861ax8004 MACH_AX8004 AX8004 847
862at91sam9261ek MACH_AT91SAM9261EK AT91SAM9261EK 848
863loft MACH_LOFT LOFT 849
864magpie MACH_MAGPIE MAGPIE 850
865mx21 MACH_MX21 MX21 851
866mb87m3400 MACH_MB87M3400 MB87M3400 852
867mguard_delta MACH_MGUARD_DELTA MGUARD_DELTA 853
868davinci_dvdp MACH_DAVINCI_DVDP DAVINCI_DVDP 854
869htcuniversal MACH_HTCUNIVERSAL HTCUNIVERSAL 855
870tpad MACH_TPAD TPAD 856
871roverp3 MACH_ROVERP3 ROVERP3 857
diff --git a/arch/cris/arch-v32/drivers/pci/dma.c b/arch/cris/arch-v32/drivers/pci/dma.c
index 10329306d23c..426b09878a05 100644
--- a/arch/cris/arch-v32/drivers/pci/dma.c
+++ b/arch/cris/arch-v32/drivers/pci/dma.c
@@ -24,7 +24,7 @@ struct dma_coherent_mem {
24}; 24};
25 25
26void *dma_alloc_coherent(struct device *dev, size_t size, 26void *dma_alloc_coherent(struct device *dev, size_t size,
27 dma_addr_t *dma_handle, unsigned int __nocast gfp) 27 dma_addr_t *dma_handle, gfp_t gfp)
28{ 28{
29 void *ret; 29 void *ret;
30 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; 30 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 838437b2d241..b66c13c0cc0f 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -29,12 +29,12 @@
29#include <linux/efi.h> 29#include <linux/efi.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/dmi.h> 31#include <linux/dmi.h>
32#include <linux/irq.h>
32 33
33#include <asm/pgtable.h> 34#include <asm/pgtable.h>
34#include <asm/io_apic.h> 35#include <asm/io_apic.h>
35#include <asm/apic.h> 36#include <asm/apic.h>
36#include <asm/io.h> 37#include <asm/io.h>
37#include <asm/irq.h>
38#include <asm/mpspec.h> 38#include <asm/mpspec.h>
39 39
40#ifdef CONFIG_X86_64 40#ifdef CONFIG_X86_64
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index 73aeaf5a9d4e..53a1681cd964 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -28,6 +28,22 @@ static void __init init_amd(struct cpuinfo_x86 *c)
28 int mbytes = num_physpages >> (20-PAGE_SHIFT); 28 int mbytes = num_physpages >> (20-PAGE_SHIFT);
29 int r; 29 int r;
30 30
31#ifdef CONFIG_SMP
32 unsigned long long value;
33
34 /* Disable TLB flush filter by setting HWCR.FFDIS on K8
35 * bit 6 of msr C001_0015
36 *
37 * Errata 63 for SH-B3 steppings
38 * Errata 122 for all steppings (F+ have it disabled by default)
39 */
40 if (c->x86 == 15) {
41 rdmsrl(MSR_K7_HWCR, value);
42 value |= 1 << 6;
43 wrmsrl(MSR_K7_HWCR, value);
44 }
45#endif
46
31 /* 47 /*
32 * FIXME: We should handle the K5 here. Set up the write 48 * FIXME: We should handle the K5 here. Set up the write
33 * range and also turn on MSR 83 bits 4 and 31 (write alloc, 49 * range and also turn on MSR 83 bits 4 and 31 (write alloc,
diff --git a/arch/i386/kernel/pci-dma.c b/arch/i386/kernel/pci-dma.c
index 1e51427cc9eb..25fe66853934 100644
--- a/arch/i386/kernel/pci-dma.c
+++ b/arch/i386/kernel/pci-dma.c
@@ -23,7 +23,7 @@ struct dma_coherent_mem {
23}; 23};
24 24
25void *dma_alloc_coherent(struct device *dev, size_t size, 25void *dma_alloc_coherent(struct device *dev, size_t size,
26 dma_addr_t *dma_handle, unsigned int __nocast gfp) 26 dma_addr_t *dma_handle, gfp_t gfp)
27{ 27{
28 void *ret; 28 void *ret;
29 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; 29 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index 61eb0c8a6e47..adcd069db91e 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -338,7 +338,11 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
338 esp = (unsigned long) ka->sa.sa_restorer; 338 esp = (unsigned long) ka->sa.sa_restorer;
339 } 339 }
340 340
341 return (void __user *)((esp - frame_size) & -8ul); 341 esp -= frame_size;
342 /* Align the stack pointer according to the i386 ABI,
343 * i.e. so that on function entry ((sp + 4) & 15) == 0. */
344 esp = ((esp + 4) & -16ul) - 4;
345 return (void __user *) esp;
342} 346}
343 347
344/* These symbols are defined with the addresses in the vsyscall page. 348/* These symbols are defined with the addresses in the vsyscall page.
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
index 7e7a202df3c8..4c4522b43be5 100644
--- a/arch/i386/pci/acpi.c
+++ b/arch/i386/pci/acpi.c
@@ -1,7 +1,7 @@
1#include <linux/pci.h> 1#include <linux/pci.h>
2#include <linux/acpi.h> 2#include <linux/acpi.h>
3#include <linux/init.h> 3#include <linux/init.h>
4#include <asm/hw_irq.h> 4#include <linux/irq.h>
5#include <asm/numa.h> 5#include <asm/numa.h>
6#include "pci.h" 6#include "pci.h"
7 7
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 281ed8ab347a..cddafe33ff7c 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -15,7 +15,7 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/smp.h> 16#include <asm/smp.h>
17#include <asm/io_apic.h> 17#include <asm/io_apic.h>
18#include <asm/hw_irq.h> 18#include <linux/irq.h>
19#include <linux/acpi.h> 19#include <linux/acpi.h>
20 20
21#include "pci.h" 21#include "pci.h"
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 6dc726ad7137..d0a5106fba24 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1016,6 +1016,11 @@ ia64_mca_cmc_int_handler(int cmc_irq, void *arg, struct pt_regs *ptregs)
1016 1016
1017 cmc_polling_enabled = 1; 1017 cmc_polling_enabled = 1;
1018 spin_unlock(&cmc_history_lock); 1018 spin_unlock(&cmc_history_lock);
1019 /* If we're being hit with CMC interrupts, we won't
1020 * ever execute the schedule_work() below. Need to
1021 * disable CMC interrupts on this processor now.
1022 */
1023 ia64_mca_cmc_vector_disable(NULL);
1019 schedule_work(&cmc_disable_work); 1024 schedule_work(&cmc_disable_work);
1020 1025
1021 /* 1026 /*
diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S
index dddbf6b5ed2c..85920fb8d08c 100644
--- a/arch/m32r/kernel/entry.S
+++ b/arch/m32r/kernel/entry.S
@@ -681,6 +681,15 @@ ENTRY(debug_trap)
681 bl do_debug_trap 681 bl do_debug_trap
682 bra error_code 682 bra error_code
683 683
684ENTRY(ill_trap)
685 /* void ill_trap(void) */
686 SWITCH_TO_KERNEL_STACK
687 SAVE_ALL
688 ldi r1, #0 ; error_code ; FIXME
689 mv r0, sp ; pt_regs
690 bl do_ill_trap
691 bra error_code
692
684 693
685/* Cache flushing handler */ 694/* Cache flushing handler */
686ENTRY(cache_flushing_handler) 695ENTRY(cache_flushing_handler)
diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c
index 01922271d17e..5fe8ed6d62dc 100644
--- a/arch/m32r/kernel/traps.c
+++ b/arch/m32r/kernel/traps.c
@@ -5,8 +5,6 @@
5 * Hitoshi Yamamoto 5 * Hitoshi Yamamoto
6 */ 6 */
7 7
8/* $Id$ */
9
10/* 8/*
11 * 'traps.c' handles hardware traps and faults after we have saved some 9 * 'traps.c' handles hardware traps and faults after we have saved some
12 * state in 'entry.S'. 10 * state in 'entry.S'.
@@ -35,6 +33,7 @@ asmlinkage void ei_handler(void);
35asmlinkage void rie_handler(void); 33asmlinkage void rie_handler(void);
36asmlinkage void debug_trap(void); 34asmlinkage void debug_trap(void);
37asmlinkage void cache_flushing_handler(void); 35asmlinkage void cache_flushing_handler(void);
36asmlinkage void ill_trap(void);
38 37
39#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
40extern void smp_reschedule_interrupt(void); 39extern void smp_reschedule_interrupt(void);
@@ -77,22 +76,22 @@ void set_eit_vector_entries(void)
77 eit_vector[5] = BRA_INSN(default_eit_handler, 5); 76 eit_vector[5] = BRA_INSN(default_eit_handler, 5);
78 eit_vector[8] = BRA_INSN(rie_handler, 8); 77 eit_vector[8] = BRA_INSN(rie_handler, 8);
79 eit_vector[12] = BRA_INSN(alignment_check, 12); 78 eit_vector[12] = BRA_INSN(alignment_check, 12);
80 eit_vector[16] = 0xff000000UL; 79 eit_vector[16] = BRA_INSN(ill_trap, 16);
81 eit_vector[17] = BRA_INSN(debug_trap, 17); 80 eit_vector[17] = BRA_INSN(debug_trap, 17);
82 eit_vector[18] = BRA_INSN(system_call, 18); 81 eit_vector[18] = BRA_INSN(system_call, 18);
83 eit_vector[19] = 0xff000000UL; 82 eit_vector[19] = BRA_INSN(ill_trap, 19);
84 eit_vector[20] = 0xff000000UL; 83 eit_vector[20] = BRA_INSN(ill_trap, 20);
85 eit_vector[21] = 0xff000000UL; 84 eit_vector[21] = BRA_INSN(ill_trap, 21);
86 eit_vector[22] = 0xff000000UL; 85 eit_vector[22] = BRA_INSN(ill_trap, 22);
87 eit_vector[23] = 0xff000000UL; 86 eit_vector[23] = BRA_INSN(ill_trap, 23);
88 eit_vector[24] = 0xff000000UL; 87 eit_vector[24] = BRA_INSN(ill_trap, 24);
89 eit_vector[25] = 0xff000000UL; 88 eit_vector[25] = BRA_INSN(ill_trap, 25);
90 eit_vector[26] = 0xff000000UL; 89 eit_vector[26] = BRA_INSN(ill_trap, 26);
91 eit_vector[27] = 0xff000000UL; 90 eit_vector[27] = BRA_INSN(ill_trap, 27);
92 eit_vector[28] = BRA_INSN(cache_flushing_handler, 28); 91 eit_vector[28] = BRA_INSN(cache_flushing_handler, 28);
93 eit_vector[29] = 0xff000000UL; 92 eit_vector[29] = BRA_INSN(ill_trap, 29);
94 eit_vector[30] = 0xff000000UL; 93 eit_vector[30] = BRA_INSN(ill_trap, 30);
95 eit_vector[31] = 0xff000000UL; 94 eit_vector[31] = BRA_INSN(ill_trap, 31);
96 eit_vector[32] = BRA_INSN(ei_handler, 32); 95 eit_vector[32] = BRA_INSN(ei_handler, 32);
97 eit_vector[64] = BRA_INSN(pie_handler, 64); 96 eit_vector[64] = BRA_INSN(pie_handler, 64);
98#ifdef CONFIG_MMU 97#ifdef CONFIG_MMU
@@ -286,7 +285,8 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
286 285
287DO_ERROR( 1, SIGTRAP, "debug trap", debug_trap) 286DO_ERROR( 1, SIGTRAP, "debug trap", debug_trap)
288DO_ERROR_INFO(0x20, SIGILL, "reserved instruction ", rie_handler, ILL_ILLOPC, regs->bpc) 287DO_ERROR_INFO(0x20, SIGILL, "reserved instruction ", rie_handler, ILL_ILLOPC, regs->bpc)
289DO_ERROR_INFO(0x100, SIGILL, "privilege instruction", pie_handler, ILL_PRVOPC, regs->bpc) 288DO_ERROR_INFO(0x100, SIGILL, "privileged instruction", pie_handler, ILL_PRVOPC, regs->bpc)
289DO_ERROR_INFO(-1, SIGILL, "illegal trap", ill_trap, ILL_ILLTRP, regs->bpc)
290 290
291extern int handle_unaligned_access(unsigned long, struct pt_regs *); 291extern int handle_unaligned_access(unsigned long, struct pt_regs *);
292 292
@@ -329,4 +329,3 @@ asmlinkage void do_alignment_check(struct pt_regs *regs, long error_code)
329 set_fs(oldfs); 329 set_fs(oldfs);
330 } 330 }
331} 331}
332
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 2dd477eb1c53..c198656a3bb5 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -31,7 +31,7 @@
31#include <asm/prom.h> 31#include <asm/prom.h>
32#include <asm/ppc-pci.h> 32#include <asm/ppc-pci.h>
33 33
34static int __initdata s7a_workaround = -1; 34static int __devinitdata s7a_workaround = -1;
35 35
36#if 0 36#if 0
37void pcibios_name_device(struct pci_dev *dev) 37void pcibios_name_device(struct pci_dev *dev)
@@ -59,7 +59,7 @@ void pcibios_name_device(struct pci_dev *dev)
59DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device); 59DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device);
60#endif 60#endif
61 61
62static void __init check_s7a(void) 62static void __devinit check_s7a(void)
63{ 63{
64 struct device_node *root; 64 struct device_node *root;
65 char *model; 65 char *model;
diff --git a/arch/ppc/boot/ld.script b/arch/ppc/boot/ld.script
index 9362193742ac..d4dd8f15395e 100644
--- a/arch/ppc/boot/ld.script
+++ b/arch/ppc/boot/ld.script
@@ -1,4 +1,4 @@
1OUTPUT_ARCH(powerpc) 1OUTPUT_ARCH(powerpc:common)
2SECTIONS 2SECTIONS
3{ 3{
4 /* Read-only sections, merged into text segment: */ 4 /* Read-only sections, merged into text segment: */
diff --git a/arch/ppc/kernel/dma-mapping.c b/arch/ppc/kernel/dma-mapping.c
index b566d982806c..8edee806dae7 100644
--- a/arch/ppc/kernel/dma-mapping.c
+++ b/arch/ppc/kernel/dma-mapping.c
@@ -401,10 +401,10 @@ EXPORT_SYMBOL(__dma_sync);
401static inline void __dma_sync_page_highmem(struct page *page, 401static inline void __dma_sync_page_highmem(struct page *page,
402 unsigned long offset, size_t size, int direction) 402 unsigned long offset, size_t size, int direction)
403{ 403{
404 size_t seg_size = min((size_t)PAGE_SIZE, size) - offset; 404 size_t seg_size = min((size_t)(PAGE_SIZE - offset), size);
405 size_t cur_size = seg_size; 405 size_t cur_size = seg_size;
406 unsigned long flags, start, seg_offset = offset; 406 unsigned long flags, start, seg_offset = offset;
407 int nr_segs = PAGE_ALIGN(size + (PAGE_SIZE - offset))/PAGE_SIZE; 407 int nr_segs = 1 + ((size - seg_size) + PAGE_SIZE - 1)/PAGE_SIZE;
408 int seg_nr = 0; 408 int seg_nr = 0;
409 409
410 local_irq_save(flags); 410 local_irq_save(flags);
diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c
index ac391d463d78..78a403b48dba 100644
--- a/arch/ppc/platforms/4xx/bamboo.c
+++ b/arch/ppc/platforms/4xx/bamboo.c
@@ -27,7 +27,6 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/ide.h> 28#include <linux/ide.h>
29#include <linux/initrd.h> 29#include <linux/initrd.h>
30#include <linux/irq.h>
31#include <linux/seq_file.h> 30#include <linux/seq_file.h>
32#include <linux/root_dev.h> 31#include <linux/root_dev.h>
33#include <linux/tty.h> 32#include <linux/tty.h>
diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
index 9decb72e7aaf..d32ae112f639 100644
--- a/arch/ppc/platforms/4xx/ebony.c
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -30,7 +30,6 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/ide.h> 31#include <linux/ide.h>
32#include <linux/initrd.h> 32#include <linux/initrd.h>
33#include <linux/irq.h>
34#include <linux/seq_file.h> 33#include <linux/seq_file.h>
35#include <linux/root_dev.h> 34#include <linux/root_dev.h>
36#include <linux/tty.h> 35#include <linux/tty.h>
diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c
index a38e6f9ef858..16d953bda22c 100644
--- a/arch/ppc/platforms/4xx/luan.c
+++ b/arch/ppc/platforms/4xx/luan.c
@@ -28,7 +28,6 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/ide.h> 29#include <linux/ide.h>
30#include <linux/initrd.h> 30#include <linux/initrd.h>
31#include <linux/irq.h>
32#include <linux/seq_file.h> 31#include <linux/seq_file.h>
33#include <linux/root_dev.h> 32#include <linux/root_dev.h>
34#include <linux/tty.h> 33#include <linux/tty.h>
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
index 80028df1b445..506949c5dd29 100644
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -28,7 +28,6 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/ide.h> 29#include <linux/ide.h>
30#include <linux/initrd.h> 30#include <linux/initrd.h>
31#include <linux/irq.h>
32#include <linux/seq_file.h> 31#include <linux/seq_file.h>
33#include <linux/root_dev.h> 32#include <linux/root_dev.h>
34#include <linux/tty.h> 33#include <linux/tty.h>
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index b38a851a64ec..79b3f533d0a3 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -24,7 +24,6 @@
24#include <linux/major.h> 24#include <linux/major.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h> 27#include <linux/seq_file.h>
29#include <linux/root_dev.h> 28#include <linux/root_dev.h>
30#include <linux/serial.h> 29#include <linux/serial.h>
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index f761fdf160db..7dc8a68acfd0 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -24,7 +24,6 @@
24#include <linux/major.h> 24#include <linux/major.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h> 27#include <linux/seq_file.h>
29#include <linux/root_dev.h> 28#include <linux/root_dev.h>
30#include <linux/serial.h> 29#include <linux/serial.h>
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index f2748c88665a..8841fd7da6ee 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -24,7 +24,6 @@
24#include <linux/major.h> 24#include <linux/major.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h> 27#include <linux/seq_file.h>
29#include <linux/root_dev.h> 28#include <linux/root_dev.h>
30#include <linux/serial.h> 29#include <linux/serial.h>
diff --git a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
index 18e952d1767c..bd3ac0136756 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
@@ -24,7 +24,6 @@
24#include <linux/major.h> 24#include <linux/major.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h> 27#include <linux/seq_file.h>
29#include <linux/serial.h> 28#include <linux/serial.h>
30#include <linux/module.h> 29#include <linux/module.h>
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index 6267b294f704..9f9039498ae5 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -24,7 +24,6 @@
24#include <linux/major.h> 24#include <linux/major.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h> 27#include <linux/seq_file.h>
29#include <linux/serial.h> 28#include <linux/serial.h>
30#include <linux/module.h> 29#include <linux/module.h>
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index 165df94d4aa6..c76760a781c1 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -24,7 +24,6 @@
24#include <linux/major.h> 24#include <linux/major.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h> 27#include <linux/seq_file.h>
29#include <linux/root_dev.h> 28#include <linux/root_dev.h>
30#include <linux/serial.h> 29#include <linux/serial.h>
diff --git a/arch/ppc/platforms/85xx/sbc85xx.c b/arch/ppc/platforms/85xx/sbc85xx.c
index 4f6d1ddd6fb8..c02f110219f5 100644
--- a/arch/ppc/platforms/85xx/sbc85xx.c
+++ b/arch/ppc/platforms/85xx/sbc85xx.c
@@ -23,7 +23,6 @@
23#include <linux/major.h> 23#include <linux/major.h>
24#include <linux/console.h> 24#include <linux/console.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/irq.h>
27#include <linux/seq_file.h> 26#include <linux/seq_file.h>
28#include <linux/serial.h> 27#include <linux/serial.h>
29#include <linux/module.h> 28#include <linux/module.h>
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
index c99b365d6110..20940f4044f4 100644
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -30,7 +30,6 @@
30#include <linux/blkdev.h> 30#include <linux/blkdev.h>
31#include <linux/console.h> 31#include <linux/console.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/irq.h>
34#include <linux/root_dev.h> 33#include <linux/root_dev.h>
35#include <linux/seq_file.h> 34#include <linux/seq_file.h>
36#include <linux/serial.h> 35#include <linux/serial.h>
diff --git a/arch/ppc/platforms/chestnut.c b/arch/ppc/platforms/chestnut.c
index b3d3bdb3936b..48a4a510d598 100644
--- a/arch/ppc/platforms/chestnut.c
+++ b/arch/ppc/platforms/chestnut.c
@@ -35,7 +35,6 @@
35#include <asm/time.h> 35#include <asm/time.h>
36#include <asm/dma.h> 36#include <asm/dma.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <linux/irq.h>
39#include <asm/hw_irq.h> 38#include <asm/hw_irq.h>
40#include <asm/machdep.h> 39#include <asm/machdep.h>
41#include <asm/kgdb.h> 40#include <asm/kgdb.h>
diff --git a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c
index a0cf1b6fdbfe..8c874e957a4b 100644
--- a/arch/ppc/platforms/chrp_setup.c
+++ b/arch/ppc/platforms/chrp_setup.c
@@ -32,7 +32,6 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/ide.h> 34#include <linux/ide.h>
35#include <linux/irq.h>
36#include <linux/console.h> 35#include <linux/console.h>
37#include <linux/seq_file.h> 36#include <linux/seq_file.h>
38#include <linux/root_dev.h> 37#include <linux/root_dev.h>
diff --git a/arch/ppc/platforms/gemini_setup.c b/arch/ppc/platforms/gemini_setup.c
index a2a09dc4b5e2..ec6aa04d001e 100644
--- a/arch/ppc/platforms/gemini_setup.c
+++ b/arch/ppc/platforms/gemini_setup.c
@@ -21,7 +21,6 @@
21#include <linux/major.h> 21#include <linux/major.h>
22#include <linux/initrd.h> 22#include <linux/initrd.h>
23#include <linux/console.h> 23#include <linux/console.h>
24#include <linux/irq.h>
25#include <linux/seq_file.h> 24#include <linux/seq_file.h>
26#include <linux/root_dev.h> 25#include <linux/root_dev.h>
27#include <linux/bcd.h> 26#include <linux/bcd.h>
diff --git a/arch/ppc/platforms/mvme5100.c b/arch/ppc/platforms/mvme5100.c
index b292b44b760c..ce2ce88c8033 100644
--- a/arch/ppc/platforms/mvme5100.c
+++ b/arch/ppc/platforms/mvme5100.c
@@ -20,7 +20,6 @@
20#include <linux/initrd.h> 20#include <linux/initrd.h>
21#include <linux/console.h> 21#include <linux/console.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/irq.h>
24#include <linux/ide.h> 23#include <linux/ide.h>
25#include <linux/seq_file.h> 24#include <linux/seq_file.h>
26#include <linux/kdev_t.h> 25#include <linux/kdev_t.h>
diff --git a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c
index ebb8be9bf8aa..fba7e4d7c0bf 100644
--- a/arch/ppc/platforms/pmac_cpufreq.c
+++ b/arch/ppc/platforms/pmac_cpufreq.c
@@ -695,6 +695,13 @@ static int __init pmac_cpufreq_setup(void)
695 set_speed_proc = pmu_set_cpu_speed; 695 set_speed_proc = pmu_set_cpu_speed;
696 is_pmu_based = 1; 696 is_pmu_based = 1;
697 } 697 }
698 /* Else check for TiPb 550 */
699 else if (machine_is_compatible("PowerBook3,3") && cur_freq == 550000) {
700 hi_freq = cur_freq;
701 low_freq = 500000;
702 set_speed_proc = pmu_set_cpu_speed;
703 is_pmu_based = 1;
704 }
698 /* Else check for TiPb 400 & 500 */ 705 /* Else check for TiPb 400 & 500 */
699 else if (machine_is_compatible("PowerBook3,2")) { 706 else if (machine_is_compatible("PowerBook3,2")) {
700 /* We only know about the 400 MHz and the 500Mhz model 707 /* We only know about the 400 MHz and the 500Mhz model
diff --git a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c
index e8cd0a8b6a76..58884a63ebdb 100644
--- a/arch/ppc/platforms/pmac_feature.c
+++ b/arch/ppc/platforms/pmac_feature.c
@@ -2337,6 +2337,10 @@ static struct pmac_mb_def pmac_mb_defs[] = {
2337 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2337 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2338 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, 2338 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2339 }, 2339 },
2340 { "PowerBook6,7", "iBook G4",
2341 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2342 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2343 },
2340 { "PowerBook6,8", "PowerBook G4 12\"", 2344 { "PowerBook6,8", "PowerBook G4 12\"",
2341 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2345 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2342 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, 2346 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c
index 8e7b79b110e7..74165684552a 100644
--- a/arch/ppc/platforms/pmac_setup.c
+++ b/arch/ppc/platforms/pmac_setup.c
@@ -48,7 +48,6 @@
48#include <linux/adb.h> 48#include <linux/adb.h>
49#include <linux/cuda.h> 49#include <linux/cuda.h>
50#include <linux/pmu.h> 50#include <linux/pmu.h>
51#include <linux/irq.h>
52#include <linux/seq_file.h> 51#include <linux/seq_file.h>
53#include <linux/root_dev.h> 52#include <linux/root_dev.h>
54#include <linux/bitops.h> 53#include <linux/bitops.h>
diff --git a/arch/ppc/platforms/pmac_time.c b/arch/ppc/platforms/pmac_time.c
index ff6adff36cb8..edb9fcc64790 100644
--- a/arch/ppc/platforms/pmac_time.c
+++ b/arch/ppc/platforms/pmac_time.c
@@ -195,7 +195,7 @@ via_calibrate_decr(void)
195 ; 195 ;
196 dend = get_dec(); 196 dend = get_dec();
197 197
198 tb_ticks_per_jiffy = (dstart - dend) / (6 * (HZ/100)); 198 tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100);
199 tb_to_us = mulhwu_scale_factor(dstart - dend, 60000); 199 tb_to_us = mulhwu_scale_factor(dstart - dend, 60000);
200 200
201 printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n", 201 printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n",
diff --git a/arch/ppc/platforms/powerpmc250.c b/arch/ppc/platforms/powerpmc250.c
index 0abe15159e6c..e6b520e6e13f 100644
--- a/arch/ppc/platforms/powerpmc250.c
+++ b/arch/ppc/platforms/powerpmc250.c
@@ -26,7 +26,6 @@
26#include <linux/initrd.h> 26#include <linux/initrd.h>
27#include <linux/console.h> 27#include <linux/console.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/irq.h>
30#include <linux/slab.h> 29#include <linux/slab.h>
31#include <linux/seq_file.h> 30#include <linux/seq_file.h>
32#include <linux/ide.h> 31#include <linux/ide.h>
diff --git a/arch/ppc/platforms/pplus.c b/arch/ppc/platforms/pplus.c
index 93e9c7b889f7..c8803214405d 100644
--- a/arch/ppc/platforms/pplus.c
+++ b/arch/ppc/platforms/pplus.c
@@ -22,7 +22,6 @@
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/console.h> 23#include <linux/console.h>
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/irq.h>
26#include <linux/ide.h> 25#include <linux/ide.h>
27#include <linux/seq_file.h> 26#include <linux/seq_file.h>
28#include <linux/root_dev.h> 27#include <linux/root_dev.h>
diff --git a/arch/ppc/platforms/prpmc750.c b/arch/ppc/platforms/prpmc750.c
index 24ae1caafc61..0bb14a5e824c 100644
--- a/arch/ppc/platforms/prpmc750.c
+++ b/arch/ppc/platforms/prpmc750.c
@@ -24,7 +24,6 @@
24#include <linux/initrd.h> 24#include <linux/initrd.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h>
28#include <linux/seq_file.h> 27#include <linux/seq_file.h>
29#include <linux/ide.h> 28#include <linux/ide.h>
30#include <linux/root_dev.h> 29#include <linux/root_dev.h>
diff --git a/arch/ppc/platforms/prpmc800.c b/arch/ppc/platforms/prpmc800.c
index 8b09fa69b35b..de7baefacd3a 100644
--- a/arch/ppc/platforms/prpmc800.c
+++ b/arch/ppc/platforms/prpmc800.c
@@ -22,7 +22,6 @@
22#include <linux/initrd.h> 22#include <linux/initrd.h>
23#include <linux/console.h> 23#include <linux/console.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/irq.h>
26#include <linux/seq_file.h> 25#include <linux/seq_file.h>
27#include <linux/ide.h> 26#include <linux/ide.h>
28#include <linux/root_dev.h> 27#include <linux/root_dev.h>
diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c
index 3cf74aa5fed0..5058568c13ec 100644
--- a/arch/ppc/platforms/radstone_ppc7d.c
+++ b/arch/ppc/platforms/radstone_ppc7d.c
@@ -32,7 +32,6 @@
32#include <linux/initrd.h> 32#include <linux/initrd.h>
33#include <linux/console.h> 33#include <linux/console.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/irq.h>
36#include <linux/ide.h> 35#include <linux/ide.h>
37#include <linux/seq_file.h> 36#include <linux/seq_file.h>
38#include <linux/root_dev.h> 37#include <linux/root_dev.h>
@@ -59,7 +58,6 @@
59#include <asm/mpc10x.h> 58#include <asm/mpc10x.h>
60#include <asm/pci-bridge.h> 59#include <asm/pci-bridge.h>
61#include <asm/mv64x60.h> 60#include <asm/mv64x60.h>
62#include <asm/i8259.h>
63 61
64#include "radstone_ppc7d.h" 62#include "radstone_ppc7d.h"
65 63
diff --git a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c
index 84c96cb9ac2b..d4c9781989fb 100644
--- a/arch/ppc/platforms/sandpoint.c
+++ b/arch/ppc/platforms/sandpoint.c
@@ -74,7 +74,6 @@
74#include <linux/initrd.h> 74#include <linux/initrd.h>
75#include <linux/console.h> 75#include <linux/console.h>
76#include <linux/delay.h> 76#include <linux/delay.h>
77#include <linux/irq.h>
78#include <linux/ide.h> 77#include <linux/ide.h>
79#include <linux/seq_file.h> 78#include <linux/seq_file.h>
80#include <linux/root_dev.h> 79#include <linux/root_dev.h>
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
index 839f8872826f..4849850a59ed 100644
--- a/arch/ppc/syslib/mv64x60.c
+++ b/arch/ppc/syslib/mv64x60.c
@@ -34,7 +34,7 @@ u8 mv64x60_pci_exclude_bridge = 1;
34DEFINE_SPINLOCK(mv64x60_lock); 34DEFINE_SPINLOCK(mv64x60_lock);
35 35
36static phys_addr_t mv64x60_bridge_pbase; 36static phys_addr_t mv64x60_bridge_pbase;
37static void *mv64x60_bridge_vbase; 37static void __iomem *mv64x60_bridge_vbase;
38static u32 mv64x60_bridge_type = MV64x60_TYPE_INVALID; 38static u32 mv64x60_bridge_type = MV64x60_TYPE_INVALID;
39static u32 mv64x60_bridge_rev; 39static u32 mv64x60_bridge_rev;
40#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) 40#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
@@ -938,7 +938,7 @@ mv64x60_setup_for_chip(struct mv64x60_handle *bh)
938 * 938 *
939 * Return the virtual address of the bridge's registers. 939 * Return the virtual address of the bridge's registers.
940 */ 940 */
941void * 941void __iomem *
942mv64x60_get_bridge_vbase(void) 942mv64x60_get_bridge_vbase(void)
943{ 943{
944 return mv64x60_bridge_vbase; 944 return mv64x60_bridge_vbase;
diff --git a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c
index df0f76dc0ce3..361f113260d7 100644
--- a/arch/ppc/syslib/open_pic.c
+++ b/arch/ppc/syslib/open_pic.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/interrupt.h> 16#include <linux/interrupt.h>
18#include <linux/sysdev.h> 17#include <linux/sysdev.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
diff --git a/arch/ppc/syslib/open_pic2.c b/arch/ppc/syslib/open_pic2.c
index ef365cc04bd9..1c40049b9a45 100644
--- a/arch/ppc/syslib/open_pic2.c
+++ b/arch/ppc/syslib/open_pic2.c
@@ -17,7 +17,6 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/irq.h>
21#include <linux/interrupt.h> 20#include <linux/interrupt.h>
22#include <linux/sysdev.h> 21#include <linux/sysdev.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
diff --git a/arch/ppc/syslib/ppc4xx_setup.c b/arch/ppc/syslib/ppc4xx_setup.c
index def724b6e1c9..e83a83fd95e1 100644
--- a/arch/ppc/syslib/ppc4xx_setup.c
+++ b/arch/ppc/syslib/ppc4xx_setup.c
@@ -18,7 +18,6 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/threads.h> 19#include <linux/threads.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/irq.h>
22#include <linux/reboot.h> 21#include <linux/reboot.h>
23#include <linux/param.h> 22#include <linux/param.h>
24#include <linux/string.h> 23#include <linux/string.h>
diff --git a/arch/ppc64/kernel/bpa_iommu.c b/arch/ppc64/kernel/bpa_iommu.c
index 45ebe5486c40..da1b4b7a3269 100644
--- a/arch/ppc64/kernel/bpa_iommu.c
+++ b/arch/ppc64/kernel/bpa_iommu.c
@@ -99,7 +99,11 @@ get_iost_entry(unsigned long iopt_base, unsigned long io_address, unsigned page_
99 break; 99 break;
100 100
101 default: /* not a known compile time constant */ 101 default: /* not a known compile time constant */
102 BUG_ON(1); 102 {
103 /* BUILD_BUG_ON() is not usable here */
104 extern void __get_iost_entry_bad_page_size(void);
105 __get_iost_entry_bad_page_size();
106 }
103 break; 107 break;
104 } 108 }
105 109
@@ -306,7 +310,7 @@ static void bpa_map_iommu(void)
306 310
307 311
308static void *bpa_alloc_coherent(struct device *hwdev, size_t size, 312static void *bpa_alloc_coherent(struct device *hwdev, size_t size,
309 dma_addr_t *dma_handle, unsigned int __nocast flag) 313 dma_addr_t *dma_handle, gfp_t flag)
310{ 314{
311 void *ret; 315 void *ret;
312 316
diff --git a/arch/ppc64/kernel/dma.c b/arch/ppc64/kernel/dma.c
index 4da8e31b2b61..7c3419656ccc 100644
--- a/arch/ppc64/kernel/dma.c
+++ b/arch/ppc64/kernel/dma.c
@@ -53,7 +53,7 @@ int dma_set_mask(struct device *dev, u64 dma_mask)
53EXPORT_SYMBOL(dma_set_mask); 53EXPORT_SYMBOL(dma_set_mask);
54 54
55void *dma_alloc_coherent(struct device *dev, size_t size, 55void *dma_alloc_coherent(struct device *dev, size_t size,
56 dma_addr_t *dma_handle, unsigned int __nocast flag) 56 dma_addr_t *dma_handle, gfp_t flag)
57{ 57{
58 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 58 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
59 59
diff --git a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c
index 9032b6bfe036..4d9b4388918b 100644
--- a/arch/ppc64/kernel/iommu.c
+++ b/arch/ppc64/kernel/iommu.c
@@ -519,7 +519,7 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
519 * to the dma address (mapping) of the first page. 519 * to the dma address (mapping) of the first page.
520 */ 520 */
521void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, 521void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
522 dma_addr_t *dma_handle, unsigned int __nocast flag) 522 dma_addr_t *dma_handle, gfp_t flag)
523{ 523{
524 void *ret = NULL; 524 void *ret = NULL;
525 dma_addr_t mapping; 525 dma_addr_t mapping;
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c
index abb90e67534a..ed876a5178ae 100644
--- a/arch/ppc64/kernel/kprobes.c
+++ b/arch/ppc64/kernel/kprobes.c
@@ -59,9 +59,9 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
59 59
60 /* insn must be on a special executable page on ppc64 */ 60 /* insn must be on a special executable page on ppc64 */
61 if (!ret) { 61 if (!ret) {
62 up(&kprobe_mutex);
63 p->ainsn.insn = get_insn_slot();
64 down(&kprobe_mutex); 62 down(&kprobe_mutex);
63 p->ainsn.insn = get_insn_slot();
64 up(&kprobe_mutex);
65 if (!p->ainsn.insn) 65 if (!p->ainsn.insn)
66 ret = -ENOMEM; 66 ret = -ENOMEM;
67 } 67 }
@@ -90,9 +90,9 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
90 90
91void __kprobes arch_remove_kprobe(struct kprobe *p) 91void __kprobes arch_remove_kprobe(struct kprobe *p)
92{ 92{
93 up(&kprobe_mutex);
94 free_insn_slot(p->ainsn.insn);
95 down(&kprobe_mutex); 93 down(&kprobe_mutex);
94 free_insn_slot(p->ainsn.insn);
95 up(&kprobe_mutex);
96} 96}
97 97
98static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 98static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
diff --git a/arch/ppc64/kernel/module.c b/arch/ppc64/kernel/module.c
index c683bf88e690..928b8581fcb0 100644
--- a/arch/ppc64/kernel/module.c
+++ b/arch/ppc64/kernel/module.c
@@ -341,6 +341,19 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
341 *(unsigned long *)location = my_r2(sechdrs, me); 341 *(unsigned long *)location = my_r2(sechdrs, me);
342 break; 342 break;
343 343
344 case R_PPC64_TOC16:
345 /* Subtact TOC pointer */
346 value -= my_r2(sechdrs, me);
347 if (value + 0x8000 > 0xffff) {
348 printk("%s: bad TOC16 relocation (%lu)\n",
349 me->name, value);
350 return -ENOEXEC;
351 }
352 *((uint16_t *) location)
353 = (*((uint16_t *) location) & ~0xffff)
354 | (value & 0xffff);
355 break;
356
344 case R_PPC64_TOC16_DS: 357 case R_PPC64_TOC16_DS:
345 /* Subtact TOC pointer */ 358 /* Subtact TOC pointer */
346 value -= my_r2(sechdrs, me); 359 value -= my_r2(sechdrs, me);
diff --git a/arch/ppc64/kernel/pci_direct_iommu.c b/arch/ppc64/kernel/pci_direct_iommu.c
index 57980a5674d7..e1a32f802c0b 100644
--- a/arch/ppc64/kernel/pci_direct_iommu.c
+++ b/arch/ppc64/kernel/pci_direct_iommu.c
@@ -30,7 +30,7 @@
30#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
31 31
32static void *pci_direct_alloc_coherent(struct device *hwdev, size_t size, 32static void *pci_direct_alloc_coherent(struct device *hwdev, size_t size,
33 dma_addr_t *dma_handle, unsigned int __nocast flag) 33 dma_addr_t *dma_handle, gfp_t flag)
34{ 34{
35 void *ret; 35 void *ret;
36 36
diff --git a/arch/ppc64/kernel/pci_iommu.c b/arch/ppc64/kernel/pci_iommu.c
index 6c9dc67f59d8..2114dc9c59b5 100644
--- a/arch/ppc64/kernel/pci_iommu.c
+++ b/arch/ppc64/kernel/pci_iommu.c
@@ -70,7 +70,7 @@ static inline struct iommu_table *devnode_table(struct device *dev)
70 * to the dma address (mapping) of the first page. 70 * to the dma address (mapping) of the first page.
71 */ 71 */
72static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size, 72static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size,
73 dma_addr_t *dma_handle, unsigned int __nocast flag) 73 dma_addr_t *dma_handle, gfp_t flag)
74{ 74{
75 return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle, 75 return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle,
76 flag); 76 flag);
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c
index c90e1dd875ce..0e555b7a6587 100644
--- a/arch/ppc64/kernel/vio.c
+++ b/arch/ppc64/kernel/vio.c
@@ -218,7 +218,7 @@ static void vio_unmap_sg(struct device *dev, struct scatterlist *sglist,
218} 218}
219 219
220static void *vio_alloc_coherent(struct device *dev, size_t size, 220static void *vio_alloc_coherent(struct device *dev, size_t size,
221 dma_addr_t *dma_handle, unsigned int __nocast flag) 221 dma_addr_t *dma_handle, gfp_t flag)
222{ 222{
223 return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size, 223 return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size,
224 dma_handle, flag); 224 dma_handle, flag);
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 7358cdb8441f..4ff6808456ea 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -143,7 +143,7 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
143 break; 143 break;
144 case __SI_FAULT >> 16: 144 case __SI_FAULT >> 16:
145 err |= __get_user(tmp, &from->si_addr); 145 err |= __get_user(tmp, &from->si_addr);
146 to->si_addr = (void *)(u64) (tmp & PSW32_ADDR_INSN); 146 to->si_addr = (void __user *)(u64) (tmp & PSW32_ADDR_INSN);
147 break; 147 break;
148 case __SI_POLL >> 16: 148 case __SI_POLL >> 16:
149 err |= __get_user(to->si_band, &from->si_band); 149 err |= __get_user(to->si_band, &from->si_band);
@@ -338,7 +338,7 @@ sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss,
338 err |= __get_user(kss.ss_flags, &uss->ss_flags); 338 err |= __get_user(kss.ss_flags, &uss->ss_flags);
339 if (err) 339 if (err)
340 return -EFAULT; 340 return -EFAULT;
341 kss.ss_sp = (void *) ss_sp; 341 kss.ss_sp = (void __user *) ss_sp;
342 } 342 }
343 343
344 set_fs (KERNEL_DS); 344 set_fs (KERNEL_DS);
@@ -461,7 +461,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
461 goto badframe; 461 goto badframe;
462 462
463 err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); 463 err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp);
464 st.ss_sp = (void *) A((unsigned long)ss_sp); 464 st.ss_sp = compat_ptr(ss_sp);
465 err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); 465 err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size);
466 err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); 466 err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags);
467 if (err) 467 if (err)
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 6a3f5b7473a9..6e0110d71191 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -376,8 +376,8 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
376 376
377 /* Create the ucontext. */ 377 /* Create the ucontext. */
378 err |= __put_user(0, &frame->uc.uc_flags); 378 err |= __put_user(0, &frame->uc.uc_flags);
379 err |= __put_user(0, &frame->uc.uc_link); 379 err |= __put_user(NULL, &frame->uc.uc_link);
380 err |= __put_user((void *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 380 err |= __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
381 err |= __put_user(sas_ss_flags(regs->gprs[15]), 381 err |= __put_user(sas_ss_flags(regs->gprs[15]),
382 &frame->uc.uc_stack.ss_flags); 382 &frame->uc.uc_stack.ss_flags);
383 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); 383 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index aba05394d30a..6537445dac0e 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -25,62 +25,6 @@ source "init/Kconfig"
25 25
26menu "General machine setup" 26menu "General machine setup"
27 27
28config VT
29 bool
30 select INPUT
31 default y
32 ---help---
33 If you say Y here, you will get support for terminal devices with
34 display and keyboard devices. These are called "virtual" because you
35 can run several virtual terminals (also called virtual consoles) on
36 one physical terminal. This is rather useful, for example one
37 virtual terminal can collect system messages and warnings, another
38 one can be used for a text-mode user session, and a third could run
39 an X session, all in parallel. Switching between virtual terminals
40 is done with certain key combinations, usually Alt-<function key>.
41
42 The setterm command ("man setterm") can be used to change the
43 properties (such as colors or beeping) of a virtual terminal. The
44 man page console_codes(4) ("man console_codes") contains the special
45 character sequences that can be used to change those properties
46 directly. The fonts used on virtual terminals can be changed with
47 the setfont ("man setfont") command and the key bindings are defined
48 with the loadkeys ("man loadkeys") command.
49
50 You need at least one virtual terminal device in order to make use
51 of your keyboard and monitor. Therefore, only people configuring an
52 embedded system would want to say N here in order to save some
53 memory; the only way to log into such a system is then via a serial
54 or network connection.
55
56 If unsure, say Y, or else you won't be able to do much with your new
57 shiny Linux system :-)
58
59config VT_CONSOLE
60 bool
61 default y
62 ---help---
63 The system console is the device which receives all kernel messages
64 and warnings and which allows logins in single user mode. If you
65 answer Y here, a virtual terminal (the device used to interact with
66 a physical terminal) can be used as system console. This is the most
67 common mode of operations, so you should say Y here unless you want
68 the kernel messages be output only to a serial port (in which case
69 you should say Y to "Console on serial port", below).
70
71 If you do say Y here, by default the currently visible virtual
72 terminal (/dev/tty0) will be used as system console. You can change
73 that with a kernel command line option such as "console=tty3" which
74 would use the third virtual terminal as system console. (Try "man
75 bootparam" or see the documentation of your boot loader (lilo or
76 loadlin) about how to pass options to the kernel at boot time.)
77
78 If unsure, say Y.
79
80config HW_CONSOLE
81 bool
82 default y
83
84config SMP 28config SMP
85 bool "Symmetric multi-processing support (does not work on sun4/sun4c)" 29 bool "Symmetric multi-processing support (does not work on sun4/sun4c)"
86 depends on BROKEN 30 depends on BROKEN
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 53c192a4982f..3509e4305532 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -249,8 +249,6 @@ struct tt_entry *sparc_ttable;
249 249
250struct pt_regs fake_swapper_regs; 250struct pt_regs fake_swapper_regs;
251 251
252extern void paging_init(void);
253
254void __init setup_arch(char **cmdline_p) 252void __init setup_arch(char **cmdline_p)
255{ 253{
256 int i; 254 int i;
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index bc015e980341..279a62627c10 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -457,7 +457,7 @@ void __init time_init(void)
457 sbus_time_init(); 457 sbus_time_init();
458} 458}
459 459
460extern __inline__ unsigned long do_gettimeoffset(void) 460static inline unsigned long do_gettimeoffset(void)
461{ 461{
462 return (*master_l10_counter >> 10) & 0x1fffff; 462 return (*master_l10_counter >> 10) & 0x1fffff;
463} 463}
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index c89a803cbc20..c664b962987c 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -260,7 +260,7 @@ static inline pte_t srmmu_pte_modify(pte_t pte, pgprot_t newprot)
260{ return __pte((pte_val(pte) & SRMMU_CHG_MASK) | pgprot_val(newprot)); } 260{ return __pte((pte_val(pte) & SRMMU_CHG_MASK) | pgprot_val(newprot)); }
261 261
262/* to find an entry in a top-level page table... */ 262/* to find an entry in a top-level page table... */
263extern inline pgd_t *srmmu_pgd_offset(struct mm_struct * mm, unsigned long address) 263static inline pgd_t *srmmu_pgd_offset(struct mm_struct * mm, unsigned long address)
264{ return mm->pgd + (address >> SRMMU_PGDIR_SHIFT); } 264{ return mm->pgd + (address >> SRMMU_PGDIR_SHIFT); }
265 265
266/* Find an entry in the second-level page table.. */ 266/* Find an entry in the second-level page table.. */
diff --git a/arch/sparc64/kernel/cpu.c b/arch/sparc64/kernel/cpu.c
index 48756958116b..77ef5df4e5a7 100644
--- a/arch/sparc64/kernel/cpu.c
+++ b/arch/sparc64/kernel/cpu.c
@@ -39,6 +39,8 @@ struct cpu_fp_info linux_sparc_fpu[] = {
39 { 0x3e, 0x15, 0, "UltraSparc III+ integrated FPU"}, 39 { 0x3e, 0x15, 0, "UltraSparc III+ integrated FPU"},
40 { 0x3e, 0x16, 0, "UltraSparc IIIi integrated FPU"}, 40 { 0x3e, 0x16, 0, "UltraSparc IIIi integrated FPU"},
41 { 0x3e, 0x18, 0, "UltraSparc IV integrated FPU"}, 41 { 0x3e, 0x18, 0, "UltraSparc IV integrated FPU"},
42 { 0x3e, 0x19, 0, "UltraSparc IV+ integrated FPU"},
43 { 0x3e, 0x22, 0, "UltraSparc IIIi+ integrated FPU"},
42}; 44};
43 45
44#define NSPARCFPU (sizeof(linux_sparc_fpu)/sizeof(struct cpu_fp_info)) 46#define NSPARCFPU (sizeof(linux_sparc_fpu)/sizeof(struct cpu_fp_info))
@@ -53,6 +55,8 @@ struct cpu_iu_info linux_sparc_chips[] = {
53 { 0x3e, 0x15, "TI UltraSparc III+ (Cheetah+)"}, 55 { 0x3e, 0x15, "TI UltraSparc III+ (Cheetah+)"},
54 { 0x3e, 0x16, "TI UltraSparc IIIi (Jalapeno)"}, 56 { 0x3e, 0x16, "TI UltraSparc IIIi (Jalapeno)"},
55 { 0x3e, 0x18, "TI UltraSparc IV (Jaguar)"}, 57 { 0x3e, 0x18, "TI UltraSparc IV (Jaguar)"},
58 { 0x3e, 0x19, "TI UltraSparc IV+ (Panther)"},
59 { 0x3e, 0x22, "TI UltraSparc IIIi+ (Serrano)"},
56}; 60};
57 61
58#define NSPARCCHIPS (sizeof(linux_sparc_chips)/sizeof(struct cpu_iu_info)) 62#define NSPARCCHIPS (sizeof(linux_sparc_chips)/sizeof(struct cpu_iu_info))
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index 2879b1072921..11a848402fb1 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -33,7 +33,7 @@
33 /* This is trivial with the new code... */ 33 /* This is trivial with the new code... */
34 .globl do_fpdis 34 .globl do_fpdis
35do_fpdis: 35do_fpdis:
36 sethi %hi(TSTATE_PEF), %g4 ! IEU0 36 sethi %hi(TSTATE_PEF), %g4
37 rdpr %tstate, %g5 37 rdpr %tstate, %g5
38 andcc %g5, %g4, %g0 38 andcc %g5, %g4, %g0
39 be,pt %xcc, 1f 39 be,pt %xcc, 1f
@@ -50,18 +50,18 @@ do_fpdis:
50 add %g0, %g0, %g0 50 add %g0, %g0, %g0
51 ba,a,pt %xcc, rtrap_clr_l6 51 ba,a,pt %xcc, rtrap_clr_l6
52 52
531: ldub [%g6 + TI_FPSAVED], %g5 ! Load Group 531: ldub [%g6 + TI_FPSAVED], %g5
54 wr %g0, FPRS_FEF, %fprs ! LSU Group+4bubbles 54 wr %g0, FPRS_FEF, %fprs
55 andcc %g5, FPRS_FEF, %g0 ! IEU1 Group 55 andcc %g5, FPRS_FEF, %g0
56 be,a,pt %icc, 1f ! CTI 56 be,a,pt %icc, 1f
57 clr %g7 ! IEU0 57 clr %g7
58 ldx [%g6 + TI_GSR], %g7 ! Load Group 58 ldx [%g6 + TI_GSR], %g7
591: andcc %g5, FPRS_DL, %g0 ! IEU1 591: andcc %g5, FPRS_DL, %g0
60 bne,pn %icc, 2f ! CTI 60 bne,pn %icc, 2f
61 fzero %f0 ! FPA 61 fzero %f0
62 andcc %g5, FPRS_DU, %g0 ! IEU1 Group 62 andcc %g5, FPRS_DU, %g0
63 bne,pn %icc, 1f ! CTI 63 bne,pn %icc, 1f
64 fzero %f2 ! FPA 64 fzero %f2
65 faddd %f0, %f2, %f4 65 faddd %f0, %f2, %f4
66 fmuld %f0, %f2, %f6 66 fmuld %f0, %f2, %f6
67 faddd %f0, %f2, %f8 67 faddd %f0, %f2, %f8
@@ -97,15 +97,17 @@ do_fpdis:
97 faddd %f0, %f2, %f4 97 faddd %f0, %f2, %f4
98 fmuld %f0, %f2, %f6 98 fmuld %f0, %f2, %f6
99 ldxa [%g3] ASI_DMMU, %g5 99 ldxa [%g3] ASI_DMMU, %g5
100cplus_fptrap_insn_1: 100 sethi %hi(sparc64_kern_sec_context), %g2
101 sethi %hi(0), %g2 101 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
102 stxa %g2, [%g3] ASI_DMMU 102 stxa %g2, [%g3] ASI_DMMU
103 membar #Sync 103 membar #Sync
104 add %g6, TI_FPREGS + 0xc0, %g2 104 add %g6, TI_FPREGS + 0xc0, %g2
105 faddd %f0, %f2, %f8 105 faddd %f0, %f2, %f8
106 fmuld %f0, %f2, %f10 106 fmuld %f0, %f2, %f10
107 ldda [%g1] ASI_BLK_S, %f32 ! grrr, where is ASI_BLK_NUCLEUS 8-( 107 membar #Sync
108 ldda [%g1] ASI_BLK_S, %f32
108 ldda [%g2] ASI_BLK_S, %f48 109 ldda [%g2] ASI_BLK_S, %f48
110 membar #Sync
109 faddd %f0, %f2, %f12 111 faddd %f0, %f2, %f12
110 fmuld %f0, %f2, %f14 112 fmuld %f0, %f2, %f14
111 faddd %f0, %f2, %f16 113 faddd %f0, %f2, %f16
@@ -116,7 +118,6 @@ cplus_fptrap_insn_1:
116 fmuld %f0, %f2, %f26 118 fmuld %f0, %f2, %f26
117 faddd %f0, %f2, %f28 119 faddd %f0, %f2, %f28
118 fmuld %f0, %f2, %f30 120 fmuld %f0, %f2, %f30
119 membar #Sync
120 b,pt %xcc, fpdis_exit 121 b,pt %xcc, fpdis_exit
121 nop 122 nop
1222: andcc %g5, FPRS_DU, %g0 1232: andcc %g5, FPRS_DU, %g0
@@ -126,15 +127,17 @@ cplus_fptrap_insn_1:
126 fzero %f34 127 fzero %f34
127 ldxa [%g3] ASI_DMMU, %g5 128 ldxa [%g3] ASI_DMMU, %g5
128 add %g6, TI_FPREGS, %g1 129 add %g6, TI_FPREGS, %g1
129cplus_fptrap_insn_2: 130 sethi %hi(sparc64_kern_sec_context), %g2
130 sethi %hi(0), %g2 131 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
131 stxa %g2, [%g3] ASI_DMMU 132 stxa %g2, [%g3] ASI_DMMU
132 membar #Sync 133 membar #Sync
133 add %g6, TI_FPREGS + 0x40, %g2 134 add %g6, TI_FPREGS + 0x40, %g2
134 faddd %f32, %f34, %f36 135 faddd %f32, %f34, %f36
135 fmuld %f32, %f34, %f38 136 fmuld %f32, %f34, %f38
136 ldda [%g1] ASI_BLK_S, %f0 ! grrr, where is ASI_BLK_NUCLEUS 8-( 137 membar #Sync
138 ldda [%g1] ASI_BLK_S, %f0
137 ldda [%g2] ASI_BLK_S, %f16 139 ldda [%g2] ASI_BLK_S, %f16
140 membar #Sync
138 faddd %f32, %f34, %f40 141 faddd %f32, %f34, %f40
139 fmuld %f32, %f34, %f42 142 fmuld %f32, %f34, %f42
140 faddd %f32, %f34, %f44 143 faddd %f32, %f34, %f44
@@ -147,18 +150,18 @@ cplus_fptrap_insn_2:
147 fmuld %f32, %f34, %f58 150 fmuld %f32, %f34, %f58
148 faddd %f32, %f34, %f60 151 faddd %f32, %f34, %f60
149 fmuld %f32, %f34, %f62 152 fmuld %f32, %f34, %f62
150 membar #Sync
151 ba,pt %xcc, fpdis_exit 153 ba,pt %xcc, fpdis_exit
152 nop 154 nop
1533: mov SECONDARY_CONTEXT, %g3 1553: mov SECONDARY_CONTEXT, %g3
154 add %g6, TI_FPREGS, %g1 156 add %g6, TI_FPREGS, %g1
155 ldxa [%g3] ASI_DMMU, %g5 157 ldxa [%g3] ASI_DMMU, %g5
156cplus_fptrap_insn_3: 158 sethi %hi(sparc64_kern_sec_context), %g2
157 sethi %hi(0), %g2 159 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
158 stxa %g2, [%g3] ASI_DMMU 160 stxa %g2, [%g3] ASI_DMMU
159 membar #Sync 161 membar #Sync
160 mov 0x40, %g2 162 mov 0x40, %g2
161 ldda [%g1] ASI_BLK_S, %f0 ! grrr, where is ASI_BLK_NUCLEUS 8-( 163 membar #Sync
164 ldda [%g1] ASI_BLK_S, %f0
162 ldda [%g1 + %g2] ASI_BLK_S, %f16 165 ldda [%g1 + %g2] ASI_BLK_S, %f16
163 add %g1, 0x80, %g1 166 add %g1, 0x80, %g1
164 ldda [%g1] ASI_BLK_S, %f32 167 ldda [%g1] ASI_BLK_S, %f32
@@ -319,8 +322,8 @@ do_fptrap_after_fsr:
319 stx %g3, [%g6 + TI_GSR] 322 stx %g3, [%g6 + TI_GSR]
320 mov SECONDARY_CONTEXT, %g3 323 mov SECONDARY_CONTEXT, %g3
321 ldxa [%g3] ASI_DMMU, %g5 324 ldxa [%g3] ASI_DMMU, %g5
322cplus_fptrap_insn_4: 325 sethi %hi(sparc64_kern_sec_context), %g2
323 sethi %hi(0), %g2 326 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
324 stxa %g2, [%g3] ASI_DMMU 327 stxa %g2, [%g3] ASI_DMMU
325 membar #Sync 328 membar #Sync
326 add %g6, TI_FPREGS, %g2 329 add %g6, TI_FPREGS, %g2
@@ -341,33 +344,6 @@ cplus_fptrap_insn_4:
341 ba,pt %xcc, etrap 344 ba,pt %xcc, etrap
342 wr %g0, 0, %fprs 345 wr %g0, 0, %fprs
343 346
344cplus_fptrap_1:
345 sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2
346
347 .globl cheetah_plus_patch_fpdis
348cheetah_plus_patch_fpdis:
349 /* We configure the dTLB512_0 for 4MB pages and the
350 * dTLB512_1 for 8K pages when in context zero.
351 */
352 sethi %hi(cplus_fptrap_1), %o0
353 lduw [%o0 + %lo(cplus_fptrap_1)], %o1
354
355 set cplus_fptrap_insn_1, %o2
356 stw %o1, [%o2]
357 flush %o2
358 set cplus_fptrap_insn_2, %o2
359 stw %o1, [%o2]
360 flush %o2
361 set cplus_fptrap_insn_3, %o2
362 stw %o1, [%o2]
363 flush %o2
364 set cplus_fptrap_insn_4, %o2
365 stw %o1, [%o2]
366 flush %o2
367
368 retl
369 nop
370
371 /* The registers for cross calls will be: 347 /* The registers for cross calls will be:
372 * 348 *
373 * DATA 0: [low 32-bits] Address of function to call, jmp to this 349 * DATA 0: [low 32-bits] Address of function to call, jmp to this
diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S
index 50d2af1d98ae..0d8eba21111b 100644
--- a/arch/sparc64/kernel/etrap.S
+++ b/arch/sparc64/kernel/etrap.S
@@ -68,12 +68,8 @@ etrap_irq:
68 68
69 wrpr %g3, 0, %otherwin 69 wrpr %g3, 0, %otherwin
70 wrpr %g2, 0, %wstate 70 wrpr %g2, 0, %wstate
71cplus_etrap_insn_1: 71 sethi %hi(sparc64_kern_pri_context), %g2
72 sethi %hi(0), %g3 72 ldx [%g2 + %lo(sparc64_kern_pri_context)], %g3
73 sllx %g3, 32, %g3
74cplus_etrap_insn_2:
75 sethi %hi(0), %g2
76 or %g3, %g2, %g3
77 stxa %g3, [%l4] ASI_DMMU 73 stxa %g3, [%l4] ASI_DMMU
78 flush %l6 74 flush %l6
79 wr %g0, ASI_AIUS, %asi 75 wr %g0, ASI_AIUS, %asi
@@ -215,12 +211,8 @@ scetrap: rdpr %pil, %g2
215 mov PRIMARY_CONTEXT, %l4 211 mov PRIMARY_CONTEXT, %l4
216 wrpr %g3, 0, %otherwin 212 wrpr %g3, 0, %otherwin
217 wrpr %g2, 0, %wstate 213 wrpr %g2, 0, %wstate
218cplus_etrap_insn_3: 214 sethi %hi(sparc64_kern_pri_context), %g2
219 sethi %hi(0), %g3 215 ldx [%g2 + %lo(sparc64_kern_pri_context)], %g3
220 sllx %g3, 32, %g3
221cplus_etrap_insn_4:
222 sethi %hi(0), %g2
223 or %g3, %g2, %g3
224 stxa %g3, [%l4] ASI_DMMU 216 stxa %g3, [%l4] ASI_DMMU
225 flush %l6 217 flush %l6
226 218
@@ -264,38 +256,3 @@ cplus_etrap_insn_4:
264 256
265#undef TASK_REGOFF 257#undef TASK_REGOFF
266#undef ETRAP_PSTATE1 258#undef ETRAP_PSTATE1
267
268cplus_einsn_1:
269 sethi %uhi(CTX_CHEETAH_PLUS_NUC), %g3
270cplus_einsn_2:
271 sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2
272
273 .globl cheetah_plus_patch_etrap
274cheetah_plus_patch_etrap:
275 /* We configure the dTLB512_0 for 4MB pages and the
276 * dTLB512_1 for 8K pages when in context zero.
277 */
278 sethi %hi(cplus_einsn_1), %o0
279 sethi %hi(cplus_etrap_insn_1), %o2
280 lduw [%o0 + %lo(cplus_einsn_1)], %o1
281 or %o2, %lo(cplus_etrap_insn_1), %o2
282 stw %o1, [%o2]
283 flush %o2
284 sethi %hi(cplus_etrap_insn_3), %o2
285 or %o2, %lo(cplus_etrap_insn_3), %o2
286 stw %o1, [%o2]
287 flush %o2
288
289 sethi %hi(cplus_einsn_2), %o0
290 sethi %hi(cplus_etrap_insn_2), %o2
291 lduw [%o0 + %lo(cplus_einsn_2)], %o1
292 or %o2, %lo(cplus_etrap_insn_2), %o2
293 stw %o1, [%o2]
294 flush %o2
295 sethi %hi(cplus_etrap_insn_4), %o2
296 or %o2, %lo(cplus_etrap_insn_4), %o2
297 stw %o1, [%o2]
298 flush %o2
299
300 retl
301 nop
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
index ecc748fb9ad7..4c942f71184d 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc64/kernel/head.S
@@ -191,8 +191,9 @@ prom_boot_mapping_phys_low:
191 stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 5 191 stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 5
192 stx %l2, [%sp + 2047 + 128 + 0x18] ! arg1: "translate" 192 stx %l2, [%sp + 2047 + 128 + 0x18] ! arg1: "translate"
193 stx %l5, [%sp + 2047 + 128 + 0x20] ! arg2: prom_mmu_ihandle_cache 193 stx %l5, [%sp + 2047 + 128 + 0x20] ! arg2: prom_mmu_ihandle_cache
194 srlx %l0, 22, %l3 194 /* PAGE align */
195 sllx %l3, 22, %l3 195 srlx %l0, 13, %l3
196 sllx %l3, 13, %l3
196 stx %l3, [%sp + 2047 + 128 + 0x28] ! arg3: vaddr, our PC 197 stx %l3, [%sp + 2047 + 128 + 0x28] ! arg3: vaddr, our PC
197 stx %g0, [%sp + 2047 + 128 + 0x30] ! res1 198 stx %g0, [%sp + 2047 + 128 + 0x30] ! res1
198 stx %g0, [%sp + 2047 + 128 + 0x38] ! res2 199 stx %g0, [%sp + 2047 + 128 + 0x38] ! res2
@@ -211,6 +212,9 @@ prom_boot_mapping_phys_low:
211 ldx [%sp + 2047 + 128 + 0x48], %l2 ! physaddr high 212 ldx [%sp + 2047 + 128 + 0x48], %l2 ! physaddr high
212 stx %l2, [%l4 + 0x0] 213 stx %l2, [%l4 + 0x0]
213 ldx [%sp + 2047 + 128 + 0x50], %l3 ! physaddr low 214 ldx [%sp + 2047 + 128 + 0x50], %l3 ! physaddr low
215 /* 4MB align */
216 srlx %l3, 22, %l3
217 sllx %l3, 22, %l3
214 stx %l3, [%l4 + 0x8] 218 stx %l3, [%l4 + 0x8]
215 219
216 /* Leave service as-is, "call-method" */ 220 /* Leave service as-is, "call-method" */
@@ -325,23 +329,7 @@ cheetah_tlb_fixup:
3251: sethi %hi(tlb_type), %g1 3291: sethi %hi(tlb_type), %g1
326 stw %g2, [%g1 + %lo(tlb_type)] 330 stw %g2, [%g1 + %lo(tlb_type)]
327 331
328 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,1f) 332 /* Patch copy/page operations to cheetah optimized versions. */
329 ba,pt %xcc, 2f
330 nop
331
3321: /* Patch context register writes to support nucleus page
333 * size correctly.
334 */
335 call cheetah_plus_patch_etrap
336 nop
337 call cheetah_plus_patch_rtrap
338 nop
339 call cheetah_plus_patch_fpdis
340 nop
341 call cheetah_plus_patch_winfixup
342 nop
343
3442: /* Patch copy/page operations to cheetah optimized versions. */
345 call cheetah_patch_copyops 333 call cheetah_patch_copyops
346 nop 334 nop
347 call cheetah_patch_copy_page 335 call cheetah_patch_copy_page
@@ -398,32 +386,79 @@ tlb_fixup_done:
398 nop 386 nop
399 /* Not reached... */ 387 /* Not reached... */
400 388
401/* IMPORTANT NOTE: Whenever making changes here, check 389 /* This is meant to allow the sharing of this code between
402 * trampoline.S as well. -jj */ 390 * boot processor invocation (via setup_tba() below) and
403 .globl setup_tba 391 * secondary processor startup (via trampoline.S). The
404setup_tba: /* i0 = is_starfire */ 392 * former does use this code, the latter does not yet due
405 save %sp, -160, %sp 393 * to some complexities. That should be fixed up at some
394 * point.
395 */
396 .globl setup_trap_table
397setup_trap_table:
398 save %sp, -192, %sp
399
400 /* Force interrupts to be disabled. Transferring over to
401 * the Linux trap table is a very delicate operation.
402 * Until we are actually on the Linux trap table, we cannot
403 * get the PAGE_OFFSET linear mappings translated. We need
404 * that mapping to be setup in order to initialize the firmware
405 * page tables.
406 *
407 * So there is this window of time, from the return from
408 * prom_set_trap_table() until inherit_prom_mappings_post()
409 * (in arch/sparc64/mm/init.c) completes, during which no
410 * firmware address space accesses can be made.
411 */
412 rdpr %pstate, %o1
413 andn %o1, PSTATE_IE, %o1
414 wrpr %o1, 0x0, %pstate
415 wrpr %g0, 15, %pil
406 416
407 rdpr %tba, %g7 417 /* Ok, now make the final valid firmware call to jump over
408 sethi %hi(prom_tba), %o1 418 * to the Linux trap table.
409 or %o1, %lo(prom_tba), %o1 419 */
410 stx %g7, [%o1] 420 call prom_set_trap_table
421 sethi %hi(sparc64_ttable_tl0), %o0
422
423 /* Start using proper page size encodings in ctx register. */
424 sethi %hi(sparc64_kern_pri_context), %g3
425 ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2
426 mov PRIMARY_CONTEXT, %g1
427 stxa %g2, [%g1] ASI_DMMU
428 membar #Sync
429
430 /* The Linux trap handlers expect various trap global registers
431 * to be setup with some fixed values. So here we set these
432 * up very carefully. These globals are:
433 *
434 * Alternate Globals (PSTATE_AG):
435 *
436 * %g6 --> current_thread_info()
437 *
438 * MMU Globals (PSTATE_MG):
439 *
440 * %g1 --> TLB_SFSR
441 * %g2 --> ((_PAGE_VALID | _PAGE_SZ4MB |
442 * _PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W)
443 * ^ 0xfffff80000000000)
444 * (this %g2 value is used for computing the PAGE_OFFSET kernel
445 * TLB entries quickly, the virtual address of the fault XOR'd
446 * with this %g2 value is the PTE to load into the TLB)
447 * %g3 --> VPTE_BASE_CHEETAH or VPTE_BASE_SPITFIRE
448 *
449 * Interrupt Globals (PSTATE_IG, setup by init_irqwork_curcpu()):
450 *
451 * %g6 --> __irq_work[smp_processor_id()]
452 */
411 453
412 /* Setup "Linux" globals 8-) */
413 rdpr %pstate, %o1 454 rdpr %pstate, %o1
414 mov %g6, %o2 455 mov %g6, %o2
415 wrpr %o1, (PSTATE_AG|PSTATE_IE), %pstate 456 wrpr %o1, PSTATE_AG, %pstate
416 sethi %hi(sparc64_ttable_tl0), %g1
417 wrpr %g1, %tba
418 mov %o2, %g6 457 mov %o2, %g6
419 458
420 /* Set up MMU globals */
421 wrpr %o1, (PSTATE_MG|PSTATE_IE), %pstate
422
423 /* Set fixed globals used by dTLB miss handler. */
424#define KERN_HIGHBITS ((_PAGE_VALID|_PAGE_SZ4MB)^0xfffff80000000000) 459#define KERN_HIGHBITS ((_PAGE_VALID|_PAGE_SZ4MB)^0xfffff80000000000)
425#define KERN_LOWBITS (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W) 460#define KERN_LOWBITS (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W)
426 461 wrpr %o1, PSTATE_MG, %pstate
427 mov TSB_REG, %g1 462 mov TSB_REG, %g1
428 stxa %g0, [%g1] ASI_DMMU 463 stxa %g0, [%g1] ASI_DMMU
429 membar #Sync 464 membar #Sync
@@ -435,17 +470,17 @@ setup_tba: /* i0 = is_starfire */
435 sllx %g2, 32, %g2 470 sllx %g2, 32, %g2
436 or %g2, KERN_LOWBITS, %g2 471 or %g2, KERN_LOWBITS, %g2
437 472
438 BRANCH_IF_ANY_CHEETAH(g3,g7,cheetah_vpte_base) 473 BRANCH_IF_ANY_CHEETAH(g3,g7,8f)
439 ba,pt %xcc, spitfire_vpte_base 474 ba,pt %xcc, 9f
440 nop 475 nop
441 476
442cheetah_vpte_base: 4778:
443 sethi %uhi(VPTE_BASE_CHEETAH), %g3 478 sethi %uhi(VPTE_BASE_CHEETAH), %g3
444 or %g3, %ulo(VPTE_BASE_CHEETAH), %g3 479 or %g3, %ulo(VPTE_BASE_CHEETAH), %g3
445 ba,pt %xcc, 2f 480 ba,pt %xcc, 2f
446 sllx %g3, 32, %g3 481 sllx %g3, 32, %g3
447 482
448spitfire_vpte_base: 4839:
449 sethi %uhi(VPTE_BASE_SPITFIRE), %g3 484 sethi %uhi(VPTE_BASE_SPITFIRE), %g3
450 or %g3, %ulo(VPTE_BASE_SPITFIRE), %g3 485 or %g3, %ulo(VPTE_BASE_SPITFIRE), %g3
451 sllx %g3, 32, %g3 486 sllx %g3, 32, %g3
@@ -471,36 +506,37 @@ spitfire_vpte_base:
471 sllx %o2, 32, %o2 506 sllx %o2, 32, %o2
472 wr %o2, %asr25 507 wr %o2, %asr25
473 508
474 /* Ok, we're done setting up all the state our trap mechanims needs,
475 * now get back into normal globals and let the PROM know what is up.
476 */
4772: 5092:
478 wrpr %g0, %g0, %wstate 510 wrpr %g0, %g0, %wstate
479 wrpr %o1, PSTATE_IE, %pstate 511 wrpr %o1, 0x0, %pstate
480 512
481 call init_irqwork_curcpu 513 call init_irqwork_curcpu
482 nop 514 nop
483 515
484 call prom_set_trap_table 516 /* Now we can turn interrupts back on. */
485 sethi %hi(sparc64_ttable_tl0), %o0
486
487 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g2,g3,1f)
488 ba,pt %xcc, 2f
489 nop
490
4911: /* Start using proper page size encodings in ctx register. */
492 sethi %uhi(CTX_CHEETAH_PLUS_NUC), %g3
493 mov PRIMARY_CONTEXT, %g1
494 sllx %g3, 32, %g3
495 sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2
496 or %g3, %g2, %g3
497 stxa %g3, [%g1] ASI_DMMU
498 membar #Sync
499
5002:
501 rdpr %pstate, %o1 517 rdpr %pstate, %o1
502 or %o1, PSTATE_IE, %o1 518 or %o1, PSTATE_IE, %o1
503 wrpr %o1, 0, %pstate 519 wrpr %o1, 0, %pstate
520 wrpr %g0, 0x0, %pil
521
522 ret
523 restore
524
525 .globl setup_tba
526setup_tba: /* i0 = is_starfire */
527 save %sp, -192, %sp
528
529 /* The boot processor is the only cpu which invokes this
530 * routine, the other cpus set things up via trampoline.S.
531 * So save the OBP trap table address here.
532 */
533 rdpr %tba, %g7
534 sethi %hi(prom_tba), %o1
535 or %o1, %lo(prom_tba), %o1
536 stx %g7, [%o1]
537
538 call setup_trap_table
539 nop
504 540
505 ret 541 ret
506 restore 542 restore
@@ -540,8 +576,11 @@ bootup_user_stack_end:
540prom_tba: .xword 0 576prom_tba: .xword 0
541tlb_type: .word 0 /* Must NOT end up in BSS */ 577tlb_type: .word 0 /* Must NOT end up in BSS */
542 .section ".fixup",#alloc,#execinstr 578 .section ".fixup",#alloc,#execinstr
543 .globl __ret_efault 579
580 .globl __ret_efault, __retl_efault
544__ret_efault: 581__ret_efault:
545 ret 582 ret
546 restore %g0, -EFAULT, %o0 583 restore %g0, -EFAULT, %o0
547 584__retl_efault:
585 retl
586 mov -EFAULT, %o0
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index c9b69167632a..233526ba3abe 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -27,6 +27,7 @@
27#include <asm/atomic.h> 27#include <asm/atomic.h>
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/io.h>
30#include <asm/sbus.h> 31#include <asm/sbus.h>
31#include <asm/iommu.h> 32#include <asm/iommu.h>
32#include <asm/upa.h> 33#include <asm/upa.h>
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 946cee0257ea..9e8362ea3104 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/ebus.h> 19#include <asm/ebus.h>
20#include <asm/isa.h>
20#include <asm/auxio.h> 21#include <asm/auxio.h>
21 22
22#include <linux/unistd.h> 23#include <linux/unistd.h>
@@ -100,46 +101,83 @@ again:
100 return 0; 101 return 0;
101} 102}
102 103
103static int __init has_button_interrupt(struct linux_ebus_device *edev) 104static int __init has_button_interrupt(unsigned int irq, int prom_node)
104{ 105{
105 if (edev->irqs[0] == PCI_IRQ_NONE) 106 if (irq == PCI_IRQ_NONE)
106 return 0; 107 return 0;
107 if (!prom_node_has_property(edev->prom_node, "button")) 108 if (!prom_node_has_property(prom_node, "button"))
108 return 0; 109 return 0;
109 110
110 return 1; 111 return 1;
111} 112}
112 113
113void __init power_init(void) 114static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p, int *prom_node_p)
114{ 115{
115 struct linux_ebus *ebus; 116 struct linux_ebus *ebus;
116 struct linux_ebus_device *edev; 117 struct linux_ebus_device *edev;
118
119 for_each_ebus(ebus) {
120 for_each_ebusdev(edev, ebus) {
121 if (!strcmp(edev->prom_name, "power")) {
122 *resp = &edev->resource[0];
123 *irq_p = edev->irqs[0];
124 *prom_node_p = edev->prom_node;
125 return 0;
126 }
127 }
128 }
129 return -ENODEV;
130}
131
132static int __init power_probe_isa(struct resource **resp, unsigned int *irq_p, int *prom_node_p)
133{
134 struct sparc_isa_bridge *isa_bus;
135 struct sparc_isa_device *isa_dev;
136
137 for_each_isa(isa_bus) {
138 for_each_isadev(isa_dev, isa_bus) {
139 if (!strcmp(isa_dev->prom_name, "power")) {
140 *resp = &isa_dev->resource;
141 *irq_p = isa_dev->irq;
142 *prom_node_p = isa_dev->prom_node;
143 return 0;
144 }
145 }
146 }
147 return -ENODEV;
148}
149
150void __init power_init(void)
151{
152 struct resource *res = NULL;
153 unsigned int irq;
154 int prom_node;
117 static int invoked; 155 static int invoked;
118 156
119 if (invoked) 157 if (invoked)
120 return; 158 return;
121 invoked = 1; 159 invoked = 1;
122 160
123 for_each_ebus(ebus) { 161 if (!power_probe_ebus(&res, &irq, &prom_node))
124 for_each_ebusdev(edev, ebus) { 162 goto found;
125 if (!strcmp(edev->prom_name, "power")) 163
126 goto found; 164 if (!power_probe_isa(&res, &irq, &prom_node))
127 } 165 goto found;
128 } 166
129 return; 167 return;
130 168
131found: 169found:
132 power_reg = ioremap(edev->resource[0].start, 0x4); 170 power_reg = ioremap(res->start, 0x4);
133 printk("power: Control reg at %p ... ", power_reg); 171 printk("power: Control reg at %p ... ", power_reg);
134 poweroff_method = machine_halt; /* able to use the standard halt */ 172 poweroff_method = machine_halt; /* able to use the standard halt */
135 if (has_button_interrupt(edev)) { 173 if (has_button_interrupt(irq, prom_node)) {
136 if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { 174 if (kernel_thread(powerd, NULL, CLONE_FS) < 0) {
137 printk("Failed to start power daemon.\n"); 175 printk("Failed to start power daemon.\n");
138 return; 176 return;
139 } 177 }
140 printk("powerd running.\n"); 178 printk("powerd running.\n");
141 179
142 if (request_irq(edev->irqs[0], 180 if (request_irq(irq,
143 power_handler, SA_SHIRQ, "power", NULL) < 0) 181 power_handler, SA_SHIRQ, "power", NULL) < 0)
144 printk("power: Error, cannot register IRQ handler.\n"); 182 printk("power: Error, cannot register IRQ handler.\n");
145 } else { 183 } else {
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index 5efbff90d668..774ecbb8a031 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -31,6 +31,7 @@
31#include <asm/visasm.h> 31#include <asm/visasm.h>
32#include <asm/spitfire.h> 32#include <asm/spitfire.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/cpudata.h>
34 35
35/* Returning from ptrace is a bit tricky because the syscall return 36/* Returning from ptrace is a bit tricky because the syscall return
36 * low level code assumes any value returned which is negative and 37 * low level code assumes any value returned which is negative and
@@ -132,12 +133,16 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
132 if ((uaddr ^ (unsigned long) kaddr) & (1UL << 13)) { 133 if ((uaddr ^ (unsigned long) kaddr) & (1UL << 13)) {
133 unsigned long start = __pa(kaddr); 134 unsigned long start = __pa(kaddr);
134 unsigned long end = start + len; 135 unsigned long end = start + len;
136 unsigned long dcache_line_size;
137
138 dcache_line_size = local_cpu_data().dcache_line_size;
135 139
136 if (tlb_type == spitfire) { 140 if (tlb_type == spitfire) {
137 for (; start < end; start += 32) 141 for (; start < end; start += dcache_line_size)
138 spitfire_put_dcache_tag(start & 0x3fe0, 0x0); 142 spitfire_put_dcache_tag(start & 0x3fe0, 0x0);
139 } else { 143 } else {
140 for (; start < end; start += 32) 144 start &= ~(dcache_line_size - 1);
145 for (; start < end; start += dcache_line_size)
141 __asm__ __volatile__( 146 __asm__ __volatile__(
142 "stxa %%g0, [%0] %1\n\t" 147 "stxa %%g0, [%0] %1\n\t"
143 "membar #Sync" 148 "membar #Sync"
@@ -150,8 +155,11 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
150 if (write && tlb_type == spitfire) { 155 if (write && tlb_type == spitfire) {
151 unsigned long start = (unsigned long) kaddr; 156 unsigned long start = (unsigned long) kaddr;
152 unsigned long end = start + len; 157 unsigned long end = start + len;
158 unsigned long icache_line_size;
159
160 icache_line_size = local_cpu_data().icache_line_size;
153 161
154 for (; start < end; start += 32) 162 for (; start < end; start += icache_line_size)
155 flushi(start); 163 flushi(start);
156 } 164 }
157} 165}
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S
index fafd227735fa..090dcca00d2a 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc64/kernel/rtrap.S
@@ -256,9 +256,8 @@ rt_continue: ldx [%sp + PTREGS_OFF + PT_V9_G1], %g1
256 brnz,pn %l3, kern_rtt 256 brnz,pn %l3, kern_rtt
257 mov PRIMARY_CONTEXT, %l7 257 mov PRIMARY_CONTEXT, %l7
258 ldxa [%l7 + %l7] ASI_DMMU, %l0 258 ldxa [%l7 + %l7] ASI_DMMU, %l0
259cplus_rtrap_insn_1: 259 sethi %hi(sparc64_kern_pri_nuc_bits), %l1
260 sethi %hi(0), %l1 260 ldx [%l1 + %lo(sparc64_kern_pri_nuc_bits)], %l1
261 sllx %l1, 32, %l1
262 or %l0, %l1, %l0 261 or %l0, %l1, %l0
263 stxa %l0, [%l7] ASI_DMMU 262 stxa %l0, [%l7] ASI_DMMU
264 flush %g6 263 flush %g6
@@ -313,53 +312,36 @@ kern_fpucheck: ldub [%g6 + TI_FPDEPTH], %l5
313 wr %g1, FPRS_FEF, %fprs 312 wr %g1, FPRS_FEF, %fprs
314 ldx [%o1 + %o5], %g1 313 ldx [%o1 + %o5], %g1
315 add %g6, TI_XFSR, %o1 314 add %g6, TI_XFSR, %o1
316 membar #StoreLoad | #LoadLoad
317 sll %o0, 8, %o2 315 sll %o0, 8, %o2
318 add %g6, TI_FPREGS, %o3 316 add %g6, TI_FPREGS, %o3
319 brz,pn %l6, 1f 317 brz,pn %l6, 1f
320 add %g6, TI_FPREGS+0x40, %o4 318 add %g6, TI_FPREGS+0x40, %o4
321 319
320 membar #Sync
322 ldda [%o3 + %o2] ASI_BLK_P, %f0 321 ldda [%o3 + %o2] ASI_BLK_P, %f0
323 ldda [%o4 + %o2] ASI_BLK_P, %f16 322 ldda [%o4 + %o2] ASI_BLK_P, %f16
323 membar #Sync
3241: andcc %l2, FPRS_DU, %g0 3241: andcc %l2, FPRS_DU, %g0
325 be,pn %icc, 1f 325 be,pn %icc, 1f
326 wr %g1, 0, %gsr 326 wr %g1, 0, %gsr
327 add %o2, 0x80, %o2 327 add %o2, 0x80, %o2
328 membar #Sync
328 ldda [%o3 + %o2] ASI_BLK_P, %f32 329 ldda [%o3 + %o2] ASI_BLK_P, %f32
329 ldda [%o4 + %o2] ASI_BLK_P, %f48 330 ldda [%o4 + %o2] ASI_BLK_P, %f48
330
3311: membar #Sync 3311: membar #Sync
332 ldx [%o1 + %o5], %fsr 332 ldx [%o1 + %o5], %fsr
3332: stb %l5, [%g6 + TI_FPDEPTH] 3332: stb %l5, [%g6 + TI_FPDEPTH]
334 ba,pt %xcc, rt_continue 334 ba,pt %xcc, rt_continue
335 nop 335 nop
3365: wr %g0, FPRS_FEF, %fprs 3365: wr %g0, FPRS_FEF, %fprs
337 membar #StoreLoad | #LoadLoad
338 sll %o0, 8, %o2 337 sll %o0, 8, %o2
339 338
340 add %g6, TI_FPREGS+0x80, %o3 339 add %g6, TI_FPREGS+0x80, %o3
341 add %g6, TI_FPREGS+0xc0, %o4 340 add %g6, TI_FPREGS+0xc0, %o4
341 membar #Sync
342 ldda [%o3 + %o2] ASI_BLK_P, %f32 342 ldda [%o3 + %o2] ASI_BLK_P, %f32
343 ldda [%o4 + %o2] ASI_BLK_P, %f48 343 ldda [%o4 + %o2] ASI_BLK_P, %f48
344 membar #Sync 344 membar #Sync
345 wr %g0, FPRS_DU, %fprs 345 wr %g0, FPRS_DU, %fprs
346 ba,pt %xcc, rt_continue 346 ba,pt %xcc, rt_continue
347 stb %l5, [%g6 + TI_FPDEPTH] 347 stb %l5, [%g6 + TI_FPDEPTH]
348
349cplus_rinsn_1:
350 sethi %uhi(CTX_CHEETAH_PLUS_NUC), %l1
351
352 .globl cheetah_plus_patch_rtrap
353cheetah_plus_patch_rtrap:
354 /* We configure the dTLB512_0 for 4MB pages and the
355 * dTLB512_1 for 8K pages when in context zero.
356 */
357 sethi %hi(cplus_rinsn_1), %o0
358 sethi %hi(cplus_rtrap_insn_1), %o2
359 lduw [%o0 + %lo(cplus_rinsn_1)], %o1
360 or %o2, %lo(cplus_rtrap_insn_1), %o2
361 stw %o1, [%o2]
362 flush %o2
363
364 retl
365 nop
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 8e8baf2354df..c1f34237cdf2 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -187,17 +187,13 @@ int prom_callback(long *args)
187 } 187 }
188 188
189 if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) { 189 if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) {
190 unsigned long kernel_pctx = 0; 190 extern unsigned long sparc64_kern_pri_context;
191
192 if (tlb_type == cheetah_plus)
193 kernel_pctx |= (CTX_CHEETAH_PLUS_NUC |
194 CTX_CHEETAH_PLUS_CTX0);
195 191
196 /* Spitfire Errata #32 workaround */ 192 /* Spitfire Errata #32 workaround */
197 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 193 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
198 "flush %%g6" 194 "flush %%g6"
199 : /* No outputs */ 195 : /* No outputs */
200 : "r" (kernel_pctx), 196 : "r" (sparc64_kern_pri_context),
201 "r" (PRIMARY_CONTEXT), 197 "r" (PRIMARY_CONTEXT),
202 "i" (ASI_DMMU)); 198 "i" (ASI_DMMU));
203 199
@@ -464,8 +460,6 @@ static void __init boot_flags_init(char *commands)
464 } 460 }
465} 461}
466 462
467extern int prom_probe_memory(void);
468extern unsigned long start, end;
469extern void panic_setup(char *, int *); 463extern void panic_setup(char *, int *);
470 464
471extern unsigned short root_flags; 465extern unsigned short root_flags;
@@ -492,12 +486,8 @@ void register_prom_callbacks(void)
492 "' linux-.soft2 to .soft2"); 486 "' linux-.soft2 to .soft2");
493} 487}
494 488
495extern void paging_init(void);
496
497void __init setup_arch(char **cmdline_p) 489void __init setup_arch(char **cmdline_p)
498{ 490{
499 int i;
500
501 /* Initialize PROM console and command line. */ 491 /* Initialize PROM console and command line. */
502 *cmdline_p = prom_getbootargs(); 492 *cmdline_p = prom_getbootargs();
503 strcpy(saved_command_line, *cmdline_p); 493 strcpy(saved_command_line, *cmdline_p);
@@ -516,21 +506,6 @@ void __init setup_arch(char **cmdline_p)
516 boot_flags_init(*cmdline_p); 506 boot_flags_init(*cmdline_p);
517 507
518 idprom_init(); 508 idprom_init();
519 (void) prom_probe_memory();
520
521 phys_base = 0xffffffffffffffffUL;
522 for (i = 0; sp_banks[i].num_bytes != 0; i++) {
523 unsigned long top;
524
525 if (sp_banks[i].base_addr < phys_base)
526 phys_base = sp_banks[i].base_addr;
527 top = sp_banks[i].base_addr +
528 sp_banks[i].num_bytes;
529 }
530 pfn_base = phys_base >> PAGE_SHIFT;
531
532 kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL;
533 kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
534 509
535 if (!root_flags) 510 if (!root_flags)
536 root_mountflags &= ~MS_RDONLY; 511 root_mountflags &= ~MS_RDONLY;
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S
index 5f9e4fae612e..9cd272ac3ac1 100644
--- a/arch/sparc64/kernel/sys32.S
+++ b/arch/sparc64/kernel/sys32.S
@@ -157,173 +157,199 @@ sys32_socketcall: /* %o0=call, %o1=args */
157 or %g2, %lo(__socketcall_table_begin), %g2 157 or %g2, %lo(__socketcall_table_begin), %g2
158 jmpl %g2 + %o0, %g0 158 jmpl %g2 + %o0, %g0
159 nop 159 nop
160do_einval:
161 retl
162 mov -EINVAL, %o0
160 163
161 /* Each entry is exactly 32 bytes. */
162 .align 32 164 .align 32
163__socketcall_table_begin: 165__socketcall_table_begin:
166
167 /* Each entry is exactly 32 bytes. */
164do_sys_socket: /* sys_socket(int, int, int) */ 168do_sys_socket: /* sys_socket(int, int, int) */
165 ldswa [%o1 + 0x0] %asi, %o0 1691: ldswa [%o1 + 0x0] %asi, %o0
166 sethi %hi(sys_socket), %g1 170 sethi %hi(sys_socket), %g1
167 ldswa [%o1 + 0x8] %asi, %o2 1712: ldswa [%o1 + 0x8] %asi, %o2
168 jmpl %g1 + %lo(sys_socket), %g0 172 jmpl %g1 + %lo(sys_socket), %g0
169 ldswa [%o1 + 0x4] %asi, %o1 1733: ldswa [%o1 + 0x4] %asi, %o1
170 nop 174 nop
171 nop 175 nop
172 nop 176 nop
173do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */ 177do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */
174 ldswa [%o1 + 0x0] %asi, %o0 1784: ldswa [%o1 + 0x0] %asi, %o0
175 sethi %hi(sys_bind), %g1 179 sethi %hi(sys_bind), %g1
176 ldswa [%o1 + 0x8] %asi, %o2 1805: ldswa [%o1 + 0x8] %asi, %o2
177 jmpl %g1 + %lo(sys_bind), %g0 181 jmpl %g1 + %lo(sys_bind), %g0
178 lduwa [%o1 + 0x4] %asi, %o1 1826: lduwa [%o1 + 0x4] %asi, %o1
179 nop 183 nop
180 nop 184 nop
181 nop 185 nop
182do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */ 186do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */
183 ldswa [%o1 + 0x0] %asi, %o0 1877: ldswa [%o1 + 0x0] %asi, %o0
184 sethi %hi(sys_connect), %g1 188 sethi %hi(sys_connect), %g1
185 ldswa [%o1 + 0x8] %asi, %o2 1898: ldswa [%o1 + 0x8] %asi, %o2
186 jmpl %g1 + %lo(sys_connect), %g0 190 jmpl %g1 + %lo(sys_connect), %g0
187 lduwa [%o1 + 0x4] %asi, %o1 1919: lduwa [%o1 + 0x4] %asi, %o1
188 nop 192 nop
189 nop 193 nop
190 nop 194 nop
191do_sys_listen: /* sys_listen(int, int) */ 195do_sys_listen: /* sys_listen(int, int) */
192 ldswa [%o1 + 0x0] %asi, %o0 19610: ldswa [%o1 + 0x0] %asi, %o0
193 sethi %hi(sys_listen), %g1 197 sethi %hi(sys_listen), %g1
194 jmpl %g1 + %lo(sys_listen), %g0 198 jmpl %g1 + %lo(sys_listen), %g0
195 ldswa [%o1 + 0x4] %asi, %o1 19911: ldswa [%o1 + 0x4] %asi, %o1
196 nop 200 nop
197 nop 201 nop
198 nop 202 nop
199 nop 203 nop
200do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */ 204do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */
201 ldswa [%o1 + 0x0] %asi, %o0 20512: ldswa [%o1 + 0x0] %asi, %o0
202 sethi %hi(sys_accept), %g1 206 sethi %hi(sys_accept), %g1
203 lduwa [%o1 + 0x8] %asi, %o2 20713: lduwa [%o1 + 0x8] %asi, %o2
204 jmpl %g1 + %lo(sys_accept), %g0 208 jmpl %g1 + %lo(sys_accept), %g0
205 lduwa [%o1 + 0x4] %asi, %o1 20914: lduwa [%o1 + 0x4] %asi, %o1
206 nop 210 nop
207 nop 211 nop
208 nop 212 nop
209do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */ 213do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */
210 ldswa [%o1 + 0x0] %asi, %o0 21415: ldswa [%o1 + 0x0] %asi, %o0
211 sethi %hi(sys_getsockname), %g1 215 sethi %hi(sys_getsockname), %g1
212 lduwa [%o1 + 0x8] %asi, %o2 21616: lduwa [%o1 + 0x8] %asi, %o2
213 jmpl %g1 + %lo(sys_getsockname), %g0 217 jmpl %g1 + %lo(sys_getsockname), %g0
214 lduwa [%o1 + 0x4] %asi, %o1 21817: lduwa [%o1 + 0x4] %asi, %o1
215 nop 219 nop
216 nop 220 nop
217 nop 221 nop
218do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */ 222do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */
219 ldswa [%o1 + 0x0] %asi, %o0 22318: ldswa [%o1 + 0x0] %asi, %o0
220 sethi %hi(sys_getpeername), %g1 224 sethi %hi(sys_getpeername), %g1
221 lduwa [%o1 + 0x8] %asi, %o2 22519: lduwa [%o1 + 0x8] %asi, %o2
222 jmpl %g1 + %lo(sys_getpeername), %g0 226 jmpl %g1 + %lo(sys_getpeername), %g0
223 lduwa [%o1 + 0x4] %asi, %o1 22720: lduwa [%o1 + 0x4] %asi, %o1
224 nop 228 nop
225 nop 229 nop
226 nop 230 nop
227do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */ 231do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */
228 ldswa [%o1 + 0x0] %asi, %o0 23221: ldswa [%o1 + 0x0] %asi, %o0
229 sethi %hi(sys_socketpair), %g1 233 sethi %hi(sys_socketpair), %g1
230 ldswa [%o1 + 0x8] %asi, %o2 23422: ldswa [%o1 + 0x8] %asi, %o2
231 lduwa [%o1 + 0xc] %asi, %o3 23523: lduwa [%o1 + 0xc] %asi, %o3
232 jmpl %g1 + %lo(sys_socketpair), %g0 236 jmpl %g1 + %lo(sys_socketpair), %g0
233 ldswa [%o1 + 0x4] %asi, %o1 23724: ldswa [%o1 + 0x4] %asi, %o1
234 nop 238 nop
235 nop 239 nop
236do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */ 240do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */
237 ldswa [%o1 + 0x0] %asi, %o0 24125: ldswa [%o1 + 0x0] %asi, %o0
238 sethi %hi(sys_send), %g1 242 sethi %hi(sys_send), %g1
239 lduwa [%o1 + 0x8] %asi, %o2 24326: lduwa [%o1 + 0x8] %asi, %o2
240 lduwa [%o1 + 0xc] %asi, %o3 24427: lduwa [%o1 + 0xc] %asi, %o3
241 jmpl %g1 + %lo(sys_send), %g0 245 jmpl %g1 + %lo(sys_send), %g0
242 lduwa [%o1 + 0x4] %asi, %o1 24628: lduwa [%o1 + 0x4] %asi, %o1
243 nop 247 nop
244 nop 248 nop
245do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ 249do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */
246 ldswa [%o1 + 0x0] %asi, %o0 25029: ldswa [%o1 + 0x0] %asi, %o0
247 sethi %hi(sys_recv), %g1 251 sethi %hi(sys_recv), %g1
248 lduwa [%o1 + 0x8] %asi, %o2 25230: lduwa [%o1 + 0x8] %asi, %o2
249 lduwa [%o1 + 0xc] %asi, %o3 25331: lduwa [%o1 + 0xc] %asi, %o3
250 jmpl %g1 + %lo(sys_recv), %g0 254 jmpl %g1 + %lo(sys_recv), %g0
251 lduwa [%o1 + 0x4] %asi, %o1 25532: lduwa [%o1 + 0x4] %asi, %o1
252 nop 256 nop
253 nop 257 nop
254do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ 258do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
255 ldswa [%o1 + 0x0] %asi, %o0 25933: ldswa [%o1 + 0x0] %asi, %o0
256 sethi %hi(sys_sendto), %g1 260 sethi %hi(sys_sendto), %g1
257 lduwa [%o1 + 0x8] %asi, %o2 26134: lduwa [%o1 + 0x8] %asi, %o2
258 lduwa [%o1 + 0xc] %asi, %o3 26235: lduwa [%o1 + 0xc] %asi, %o3
259 lduwa [%o1 + 0x10] %asi, %o4 26336: lduwa [%o1 + 0x10] %asi, %o4
260 ldswa [%o1 + 0x14] %asi, %o5 26437: ldswa [%o1 + 0x14] %asi, %o5
261 jmpl %g1 + %lo(sys_sendto), %g0 265 jmpl %g1 + %lo(sys_sendto), %g0
262 lduwa [%o1 + 0x4] %asi, %o1 26638: lduwa [%o1 + 0x4] %asi, %o1
263do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ 267do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
264 ldswa [%o1 + 0x0] %asi, %o0 26839: ldswa [%o1 + 0x0] %asi, %o0
265 sethi %hi(sys_recvfrom), %g1 269 sethi %hi(sys_recvfrom), %g1
266 lduwa [%o1 + 0x8] %asi, %o2 27040: lduwa [%o1 + 0x8] %asi, %o2
267 lduwa [%o1 + 0xc] %asi, %o3 27141: lduwa [%o1 + 0xc] %asi, %o3
268 lduwa [%o1 + 0x10] %asi, %o4 27242: lduwa [%o1 + 0x10] %asi, %o4
269 lduwa [%o1 + 0x14] %asi, %o5 27343: lduwa [%o1 + 0x14] %asi, %o5
270 jmpl %g1 + %lo(sys_recvfrom), %g0 274 jmpl %g1 + %lo(sys_recvfrom), %g0
271 lduwa [%o1 + 0x4] %asi, %o1 27544: lduwa [%o1 + 0x4] %asi, %o1
272do_sys_shutdown: /* sys_shutdown(int, int) */ 276do_sys_shutdown: /* sys_shutdown(int, int) */
273 ldswa [%o1 + 0x0] %asi, %o0 27745: ldswa [%o1 + 0x0] %asi, %o0
274 sethi %hi(sys_shutdown), %g1 278 sethi %hi(sys_shutdown), %g1
275 jmpl %g1 + %lo(sys_shutdown), %g0 279 jmpl %g1 + %lo(sys_shutdown), %g0
276 ldswa [%o1 + 0x4] %asi, %o1 28046: ldswa [%o1 + 0x4] %asi, %o1
277 nop 281 nop
278 nop 282 nop
279 nop 283 nop
280 nop 284 nop
281do_sys_setsockopt: /* compat_sys_setsockopt(int, int, int, char *, int) */ 285do_sys_setsockopt: /* compat_sys_setsockopt(int, int, int, char *, int) */
282 ldswa [%o1 + 0x0] %asi, %o0 28647: ldswa [%o1 + 0x0] %asi, %o0
283 sethi %hi(compat_sys_setsockopt), %g1 287 sethi %hi(compat_sys_setsockopt), %g1
284 ldswa [%o1 + 0x8] %asi, %o2 28848: ldswa [%o1 + 0x8] %asi, %o2
285 lduwa [%o1 + 0xc] %asi, %o3 28949: lduwa [%o1 + 0xc] %asi, %o3
286 ldswa [%o1 + 0x10] %asi, %o4 29050: ldswa [%o1 + 0x10] %asi, %o4
287 jmpl %g1 + %lo(compat_sys_setsockopt), %g0 291 jmpl %g1 + %lo(compat_sys_setsockopt), %g0
288 ldswa [%o1 + 0x4] %asi, %o1 29251: ldswa [%o1 + 0x4] %asi, %o1
289 nop 293 nop
290do_sys_getsockopt: /* compat_sys_getsockopt(int, int, int, u32, u32) */ 294do_sys_getsockopt: /* compat_sys_getsockopt(int, int, int, u32, u32) */
291 ldswa [%o1 + 0x0] %asi, %o0 29552: ldswa [%o1 + 0x0] %asi, %o0
292 sethi %hi(compat_sys_getsockopt), %g1 296 sethi %hi(compat_sys_getsockopt), %g1
293 ldswa [%o1 + 0x8] %asi, %o2 29753: ldswa [%o1 + 0x8] %asi, %o2
294 lduwa [%o1 + 0xc] %asi, %o3 29854: lduwa [%o1 + 0xc] %asi, %o3
295 lduwa [%o1 + 0x10] %asi, %o4 29955: lduwa [%o1 + 0x10] %asi, %o4
296 jmpl %g1 + %lo(compat_sys_getsockopt), %g0 300 jmpl %g1 + %lo(compat_sys_getsockopt), %g0
297 ldswa [%o1 + 0x4] %asi, %o1 30156: ldswa [%o1 + 0x4] %asi, %o1
298 nop 302 nop
299do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */ 303do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */
300 ldswa [%o1 + 0x0] %asi, %o0 30457: ldswa [%o1 + 0x0] %asi, %o0
301 sethi %hi(compat_sys_sendmsg), %g1 305 sethi %hi(compat_sys_sendmsg), %g1
302 lduwa [%o1 + 0x8] %asi, %o2 30658: lduwa [%o1 + 0x8] %asi, %o2
303 jmpl %g1 + %lo(compat_sys_sendmsg), %g0 307 jmpl %g1 + %lo(compat_sys_sendmsg), %g0
304 lduwa [%o1 + 0x4] %asi, %o1 30859: lduwa [%o1 + 0x4] %asi, %o1
305 nop 309 nop
306 nop 310 nop
307 nop 311 nop
308do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */ 312do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */
309 ldswa [%o1 + 0x0] %asi, %o0 31360: ldswa [%o1 + 0x0] %asi, %o0
310 sethi %hi(compat_sys_recvmsg), %g1 314 sethi %hi(compat_sys_recvmsg), %g1
311 lduwa [%o1 + 0x8] %asi, %o2 31561: lduwa [%o1 + 0x8] %asi, %o2
312 jmpl %g1 + %lo(compat_sys_recvmsg), %g0 316 jmpl %g1 + %lo(compat_sys_recvmsg), %g0
313 lduwa [%o1 + 0x4] %asi, %o1 31762: lduwa [%o1 + 0x4] %asi, %o1
314 nop 318 nop
315 nop 319 nop
316 nop 320 nop
317__socketcall_table_end:
318
319do_einval:
320 retl
321 mov -EINVAL, %o0
322do_efault:
323 retl
324 mov -EFAULT, %o0
325 321
326 .section __ex_table 322 .section __ex_table
327 .align 4 323 .align 4
328 .word __socketcall_table_begin, 0, __socketcall_table_end, do_efault 324 .word 1b, __retl_efault, 2b, __retl_efault
325 .word 3b, __retl_efault, 4b, __retl_efault
326 .word 5b, __retl_efault, 6b, __retl_efault
327 .word 7b, __retl_efault, 8b, __retl_efault
328 .word 9b, __retl_efault, 10b, __retl_efault
329 .word 11b, __retl_efault, 12b, __retl_efault
330 .word 13b, __retl_efault, 14b, __retl_efault
331 .word 15b, __retl_efault, 16b, __retl_efault
332 .word 17b, __retl_efault, 18b, __retl_efault
333 .word 19b, __retl_efault, 20b, __retl_efault
334 .word 21b, __retl_efault, 22b, __retl_efault
335 .word 23b, __retl_efault, 24b, __retl_efault
336 .word 25b, __retl_efault, 26b, __retl_efault
337 .word 27b, __retl_efault, 28b, __retl_efault
338 .word 29b, __retl_efault, 30b, __retl_efault
339 .word 31b, __retl_efault, 32b, __retl_efault
340 .word 33b, __retl_efault, 34b, __retl_efault
341 .word 35b, __retl_efault, 36b, __retl_efault
342 .word 37b, __retl_efault, 38b, __retl_efault
343 .word 39b, __retl_efault, 40b, __retl_efault
344 .word 41b, __retl_efault, 42b, __retl_efault
345 .word 43b, __retl_efault, 44b, __retl_efault
346 .word 45b, __retl_efault, 46b, __retl_efault
347 .word 47b, __retl_efault, 48b, __retl_efault
348 .word 49b, __retl_efault, 50b, __retl_efault
349 .word 51b, __retl_efault, 52b, __retl_efault
350 .word 53b, __retl_efault, 54b, __retl_efault
351 .word 55b, __retl_efault, 56b, __retl_efault
352 .word 57b, __retl_efault, 58b, __retl_efault
353 .word 59b, __retl_efault, 60b, __retl_efault
354 .word 61b, __retl_efault, 62b, __retl_efault
329 .previous 355 .previous
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
index 89f2fcfcd662..9478551cb020 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc64/kernel/trampoline.S
@@ -336,20 +336,13 @@ do_unlock:
336 call init_irqwork_curcpu 336 call init_irqwork_curcpu
337 nop 337 nop
338 338
339 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g2,g3,1f) 339 /* Start using proper page size encodings in ctx register. */
340 ba,pt %xcc, 2f 340 sethi %hi(sparc64_kern_pri_context), %g3
341 nop 341 ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2
342
3431: /* Start using proper page size encodings in ctx register. */
344 sethi %uhi(CTX_CHEETAH_PLUS_NUC), %g3
345 mov PRIMARY_CONTEXT, %g1 342 mov PRIMARY_CONTEXT, %g1
346 sllx %g3, 32, %g3 343 stxa %g2, [%g1] ASI_DMMU
347 sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2
348 or %g3, %g2, %g3
349 stxa %g3, [%g1] ASI_DMMU
350 membar #Sync 344 membar #Sync
351 345
3522:
353 rdpr %pstate, %o1 346 rdpr %pstate, %o1
354 or %o1, PSTATE_IE, %o1 347 or %o1, PSTATE_IE, %o1
355 wrpr %o1, 0, %pstate 348 wrpr %o1, 0, %pstate
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index f8e7005fede9..5570e7bb22bb 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -189,19 +189,18 @@ void spitfire_data_access_exception(struct pt_regs *regs, unsigned long sfsr, un
189 189
190 if (regs->tstate & TSTATE_PRIV) { 190 if (regs->tstate & TSTATE_PRIV) {
191 /* Test if this comes from uaccess places. */ 191 /* Test if this comes from uaccess places. */
192 unsigned long fixup; 192 const struct exception_table_entry *entry;
193 unsigned long g2 = regs->u_regs[UREG_G2];
194 193
195 if ((fixup = search_extables_range(regs->tpc, &g2))) { 194 entry = search_exception_tables(regs->tpc);
196 /* Ouch, somebody is trying ugly VM hole tricks on us... */ 195 if (entry) {
196 /* Ouch, somebody is trying VM hole tricks on us... */
197#ifdef DEBUG_EXCEPTIONS 197#ifdef DEBUG_EXCEPTIONS
198 printk("Exception: PC<%016lx> faddr<UNKNOWN>\n", regs->tpc); 198 printk("Exception: PC<%016lx> faddr<UNKNOWN>\n", regs->tpc);
199 printk("EX_TABLE: insn<%016lx> fixup<%016lx> " 199 printk("EX_TABLE: insn<%016lx> fixup<%016lx>\n",
200 "g2<%016lx>\n", regs->tpc, fixup, g2); 200 regs->tpc, entry->fixup);
201#endif 201#endif
202 regs->tpc = fixup; 202 regs->tpc = entry->fixup;
203 regs->tnpc = regs->tpc + 4; 203 regs->tnpc = regs->tpc + 4;
204 regs->u_regs[UREG_G2] = g2;
205 return; 204 return;
206 } 205 }
207 /* Shit... */ 206 /* Shit... */
@@ -758,26 +757,12 @@ void __init cheetah_ecache_flush_init(void)
758 ecache_flush_size = (2 * largest_size); 757 ecache_flush_size = (2 * largest_size);
759 ecache_flush_linesize = smallest_linesize; 758 ecache_flush_linesize = smallest_linesize;
760 759
761 /* Discover a physically contiguous chunk of physical 760 ecache_flush_physbase = find_ecache_flush_span(ecache_flush_size);
762 * memory in 'sp_banks' of size ecache_flush_size calculated
763 * above. Store the physical base of this area at
764 * ecache_flush_physbase.
765 */
766 for (node = 0; ; node++) {
767 if (sp_banks[node].num_bytes == 0)
768 break;
769 if (sp_banks[node].num_bytes >= ecache_flush_size) {
770 ecache_flush_physbase = sp_banks[node].base_addr;
771 break;
772 }
773 }
774 761
775 /* Note: Zero would be a valid value of ecache_flush_physbase so 762 if (ecache_flush_physbase == ~0UL) {
776 * don't use that as the success test. :-)
777 */
778 if (sp_banks[node].num_bytes == 0) {
779 prom_printf("cheetah_ecache_flush_init: Cannot find %d byte " 763 prom_printf("cheetah_ecache_flush_init: Cannot find %d byte "
780 "contiguous physical memory.\n", ecache_flush_size); 764 "contiguous physical memory.\n",
765 ecache_flush_size);
781 prom_halt(); 766 prom_halt();
782 } 767 }
783 768
@@ -1346,16 +1331,12 @@ static int cheetah_fix_ce(unsigned long physaddr)
1346/* Return non-zero if PADDR is a valid physical memory address. */ 1331/* Return non-zero if PADDR is a valid physical memory address. */
1347static int cheetah_check_main_memory(unsigned long paddr) 1332static int cheetah_check_main_memory(unsigned long paddr)
1348{ 1333{
1349 int i; 1334 unsigned long vaddr = PAGE_OFFSET + paddr;
1350 1335
1351 for (i = 0; ; i++) { 1336 if (vaddr > (unsigned long) high_memory)
1352 if (sp_banks[i].num_bytes == 0) 1337 return 0;
1353 break; 1338
1354 if (paddr >= sp_banks[i].base_addr && 1339 return kern_addr_valid(vaddr);
1355 paddr < (sp_banks[i].base_addr + sp_banks[i].num_bytes))
1356 return 1;
1357 }
1358 return 0;
1359} 1340}
1360 1341
1361void cheetah_cee_handler(struct pt_regs *regs, unsigned long afsr, unsigned long afar) 1342void cheetah_cee_handler(struct pt_regs *regs, unsigned long afsr, unsigned long afar)
@@ -1610,10 +1591,10 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned
1610 /* OK, usermode access. */ 1591 /* OK, usermode access. */
1611 recoverable = 1; 1592 recoverable = 1;
1612 } else { 1593 } else {
1613 unsigned long g2 = regs->u_regs[UREG_G2]; 1594 const struct exception_table_entry *entry;
1614 unsigned long fixup = search_extables_range(regs->tpc, &g2);
1615 1595
1616 if (fixup != 0UL) { 1596 entry = search_exception_tables(regs->tpc);
1597 if (entry) {
1617 /* OK, kernel access to userspace. */ 1598 /* OK, kernel access to userspace. */
1618 recoverable = 1; 1599 recoverable = 1;
1619 1600
@@ -1632,9 +1613,8 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned
1632 * recoverable condition. 1613 * recoverable condition.
1633 */ 1614 */
1634 if (recoverable) { 1615 if (recoverable) {
1635 regs->tpc = fixup; 1616 regs->tpc = entry->fixup;
1636 regs->tnpc = regs->tpc + 4; 1617 regs->tnpc = regs->tpc + 4;
1637 regs->u_regs[UREG_G2] = g2;
1638 } 1618 }
1639 } 1619 }
1640 } 1620 }
diff --git a/arch/sparc64/kernel/una_asm.S b/arch/sparc64/kernel/una_asm.S
index da48400bcc95..1f5b5b708ce7 100644
--- a/arch/sparc64/kernel/una_asm.S
+++ b/arch/sparc64/kernel/una_asm.S
@@ -6,13 +6,6 @@
6 6
7 .text 7 .text
8 8
9kernel_unaligned_trap_fault:
10 call kernel_mna_trap_fault
11 nop
12 retl
13 nop
14 .size kern_unaligned_trap_fault, .-kern_unaligned_trap_fault
15
16 .globl __do_int_store 9 .globl __do_int_store
17__do_int_store: 10__do_int_store:
18 rd %asi, %o4 11 rd %asi, %o4
@@ -51,24 +44,24 @@ __do_int_store:
510: 440:
52 wr %o4, 0x0, %asi 45 wr %o4, 0x0, %asi
53 retl 46 retl
54 nop 47 mov 0, %o0
55 .size __do_int_store, .-__do_int_store 48 .size __do_int_store, .-__do_int_store
56 49
57 .section __ex_table 50 .section __ex_table
58 .word 4b, kernel_unaligned_trap_fault 51 .word 4b, __retl_efault
59 .word 5b, kernel_unaligned_trap_fault 52 .word 5b, __retl_efault
60 .word 6b, kernel_unaligned_trap_fault 53 .word 6b, __retl_efault
61 .word 7b, kernel_unaligned_trap_fault 54 .word 7b, __retl_efault
62 .word 8b, kernel_unaligned_trap_fault 55 .word 8b, __retl_efault
63 .word 9b, kernel_unaligned_trap_fault 56 .word 9b, __retl_efault
64 .word 10b, kernel_unaligned_trap_fault 57 .word 10b, __retl_efault
65 .word 11b, kernel_unaligned_trap_fault 58 .word 11b, __retl_efault
66 .word 12b, kernel_unaligned_trap_fault 59 .word 12b, __retl_efault
67 .word 13b, kernel_unaligned_trap_fault 60 .word 13b, __retl_efault
68 .word 14b, kernel_unaligned_trap_fault 61 .word 14b, __retl_efault
69 .word 15b, kernel_unaligned_trap_fault 62 .word 15b, __retl_efault
70 .word 16b, kernel_unaligned_trap_fault 63 .word 16b, __retl_efault
71 .word 17b, kernel_unaligned_trap_fault 64 .word 17b, __retl_efault
72 .previous 65 .previous
73 66
74 .globl do_int_load 67 .globl do_int_load
@@ -133,21 +126,21 @@ do_int_load:
1330: 1260:
134 wr %o5, 0x0, %asi 127 wr %o5, 0x0, %asi
135 retl 128 retl
136 nop 129 mov 0, %o0
137 .size __do_int_load, .-__do_int_load 130 .size __do_int_load, .-__do_int_load
138 131
139 .section __ex_table 132 .section __ex_table
140 .word 4b, kernel_unaligned_trap_fault 133 .word 4b, __retl_efault
141 .word 5b, kernel_unaligned_trap_fault 134 .word 5b, __retl_efault
142 .word 6b, kernel_unaligned_trap_fault 135 .word 6b, __retl_efault
143 .word 7b, kernel_unaligned_trap_fault 136 .word 7b, __retl_efault
144 .word 8b, kernel_unaligned_trap_fault 137 .word 8b, __retl_efault
145 .word 9b, kernel_unaligned_trap_fault 138 .word 9b, __retl_efault
146 .word 10b, kernel_unaligned_trap_fault 139 .word 10b, __retl_efault
147 .word 11b, kernel_unaligned_trap_fault 140 .word 11b, __retl_efault
148 .word 12b, kernel_unaligned_trap_fault 141 .word 12b, __retl_efault
149 .word 13b, kernel_unaligned_trap_fault 142 .word 13b, __retl_efault
150 .word 14b, kernel_unaligned_trap_fault 143 .word 14b, __retl_efault
151 .word 15b, kernel_unaligned_trap_fault 144 .word 15b, __retl_efault
152 .word 16b, kernel_unaligned_trap_fault 145 .word 16b, __retl_efault
153 .previous 146 .previous
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index 42718f6a7d36..70faf630603b 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -180,14 +180,14 @@ static void __attribute_used__ unaligned_panic(char *str, struct pt_regs *regs)
180 die_if_kernel(str, regs); 180 die_if_kernel(str, regs);
181} 181}
182 182
183extern void do_int_load(unsigned long *dest_reg, int size, 183extern int do_int_load(unsigned long *dest_reg, int size,
184 unsigned long *saddr, int is_signed, int asi); 184 unsigned long *saddr, int is_signed, int asi);
185 185
186extern void __do_int_store(unsigned long *dst_addr, int size, 186extern int __do_int_store(unsigned long *dst_addr, int size,
187 unsigned long src_val, int asi); 187 unsigned long src_val, int asi);
188 188
189static inline void do_int_store(int reg_num, int size, unsigned long *dst_addr, 189static inline int do_int_store(int reg_num, int size, unsigned long *dst_addr,
190 struct pt_regs *regs, int asi, int orig_asi) 190 struct pt_regs *regs, int asi, int orig_asi)
191{ 191{
192 unsigned long zero = 0; 192 unsigned long zero = 0;
193 unsigned long *src_val_p = &zero; 193 unsigned long *src_val_p = &zero;
@@ -219,7 +219,7 @@ static inline void do_int_store(int reg_num, int size, unsigned long *dst_addr,
219 break; 219 break;
220 }; 220 };
221 } 221 }
222 __do_int_store(dst_addr, size, src_val, asi); 222 return __do_int_store(dst_addr, size, src_val, asi);
223} 223}
224 224
225static inline void advance(struct pt_regs *regs) 225static inline void advance(struct pt_regs *regs)
@@ -242,14 +242,14 @@ static inline int ok_for_kernel(unsigned int insn)
242 return !floating_point_load_or_store_p(insn); 242 return !floating_point_load_or_store_p(insn);
243} 243}
244 244
245void kernel_mna_trap_fault(void) 245static void kernel_mna_trap_fault(void)
246{ 246{
247 struct pt_regs *regs = current_thread_info()->kern_una_regs; 247 struct pt_regs *regs = current_thread_info()->kern_una_regs;
248 unsigned int insn = current_thread_info()->kern_una_insn; 248 unsigned int insn = current_thread_info()->kern_una_insn;
249 unsigned long g2 = regs->u_regs[UREG_G2]; 249 const struct exception_table_entry *entry;
250 unsigned long fixup = search_extables_range(regs->tpc, &g2);
251 250
252 if (!fixup) { 251 entry = search_exception_tables(regs->tpc);
252 if (!entry) {
253 unsigned long address; 253 unsigned long address;
254 254
255 address = compute_effective_address(regs, insn, 255 address = compute_effective_address(regs, insn,
@@ -270,9 +270,8 @@ void kernel_mna_trap_fault(void)
270 die_if_kernel("Oops", regs); 270 die_if_kernel("Oops", regs);
271 /* Not reached */ 271 /* Not reached */
272 } 272 }
273 regs->tpc = fixup; 273 regs->tpc = entry->fixup;
274 regs->tnpc = regs->tpc + 4; 274 regs->tnpc = regs->tpc + 4;
275 regs->u_regs [UREG_G2] = g2;
276 275
277 regs->tstate &= ~TSTATE_ASI; 276 regs->tstate &= ~TSTATE_ASI;
278 regs->tstate |= (ASI_AIUS << 24UL); 277 regs->tstate |= (ASI_AIUS << 24UL);
@@ -294,8 +293,8 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
294 293
295 kernel_mna_trap_fault(); 294 kernel_mna_trap_fault();
296 } else { 295 } else {
297 unsigned long addr; 296 unsigned long addr, *reg_addr;
298 int orig_asi, asi; 297 int orig_asi, asi, err;
299 298
300 addr = compute_effective_address(regs, insn, 299 addr = compute_effective_address(regs, insn,
301 ((insn >> 25) & 0x1f)); 300 ((insn >> 25) & 0x1f));
@@ -319,11 +318,12 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
319 }; 318 };
320 switch (dir) { 319 switch (dir) {
321 case load: 320 case load:
322 do_int_load(fetch_reg_addr(((insn>>25)&0x1f), regs), 321 reg_addr = fetch_reg_addr(((insn>>25)&0x1f), regs);
323 size, (unsigned long *) addr, 322 err = do_int_load(reg_addr, size,
324 decode_signedness(insn), asi); 323 (unsigned long *) addr,
325 if (unlikely(asi != orig_asi)) { 324 decode_signedness(insn), asi);
326 unsigned long val_in = *(unsigned long *) addr; 325 if (likely(!err) && unlikely(asi != orig_asi)) {
326 unsigned long val_in = *reg_addr;
327 switch (size) { 327 switch (size) {
328 case 2: 328 case 2:
329 val_in = swab16(val_in); 329 val_in = swab16(val_in);
@@ -339,21 +339,24 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u
339 BUG(); 339 BUG();
340 break; 340 break;
341 }; 341 };
342 *(unsigned long *) addr = val_in; 342 *reg_addr = val_in;
343 } 343 }
344 break; 344 break;
345 345
346 case store: 346 case store:
347 do_int_store(((insn>>25)&0x1f), size, 347 err = do_int_store(((insn>>25)&0x1f), size,
348 (unsigned long *) addr, regs, 348 (unsigned long *) addr, regs,
349 asi, orig_asi); 349 asi, orig_asi);
350 break; 350 break;
351 351
352 default: 352 default:
353 panic("Impossible kernel unaligned trap."); 353 panic("Impossible kernel unaligned trap.");
354 /* Not reached... */ 354 /* Not reached... */
355 } 355 }
356 advance(regs); 356 if (unlikely(err))
357 kernel_mna_trap_fault();
358 else
359 advance(regs);
357 } 360 }
358} 361}
359 362
diff --git a/arch/sparc64/kernel/us3_cpufreq.c b/arch/sparc64/kernel/us3_cpufreq.c
index 9080e7cd4bb0..0340041f6143 100644
--- a/arch/sparc64/kernel/us3_cpufreq.c
+++ b/arch/sparc64/kernel/us3_cpufreq.c
@@ -208,7 +208,10 @@ static int __init us3_freq_init(void)
208 impl = ((ver >> 32) & 0xffff); 208 impl = ((ver >> 32) & 0xffff);
209 209
210 if (manuf == CHEETAH_MANUF && 210 if (manuf == CHEETAH_MANUF &&
211 (impl == CHEETAH_IMPL || impl == CHEETAH_PLUS_IMPL)) { 211 (impl == CHEETAH_IMPL ||
212 impl == CHEETAH_PLUS_IMPL ||
213 impl == JAGUAR_IMPL ||
214 impl == PANTHER_IMPL)) {
212 struct cpufreq_driver *driver; 215 struct cpufreq_driver *driver;
213 216
214 ret = -ENOMEM; 217 ret = -ENOMEM;
diff --git a/arch/sparc64/kernel/winfixup.S b/arch/sparc64/kernel/winfixup.S
index 99c809a1e5ac..39160926267b 100644
--- a/arch/sparc64/kernel/winfixup.S
+++ b/arch/sparc64/kernel/winfixup.S
@@ -16,23 +16,14 @@
16 .text 16 .text
17 17
18set_pcontext: 18set_pcontext:
19cplus_winfixup_insn_1: 19 sethi %hi(sparc64_kern_pri_context), %l1
20 sethi %hi(0), %l1 20 ldx [%l1 + %lo(sparc64_kern_pri_context)], %l1
21 mov PRIMARY_CONTEXT, %g1 21 mov PRIMARY_CONTEXT, %g1
22 sllx %l1, 32, %l1
23cplus_winfixup_insn_2:
24 sethi %hi(0), %g2
25 or %l1, %g2, %l1
26 stxa %l1, [%g1] ASI_DMMU 22 stxa %l1, [%g1] ASI_DMMU
27 flush %g6 23 flush %g6
28 retl 24 retl
29 nop 25 nop
30 26
31cplus_wfinsn_1:
32 sethi %uhi(CTX_CHEETAH_PLUS_NUC), %l1
33cplus_wfinsn_2:
34 sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2
35
36 .align 32 27 .align 32
37 28
38 /* Here are the rules, pay attention. 29 /* Here are the rules, pay attention.
@@ -395,23 +386,3 @@ window_dax_from_user_common:
395 add %sp, PTREGS_OFF, %o0 386 add %sp, PTREGS_OFF, %o0
396 ba,pt %xcc, rtrap 387 ba,pt %xcc, rtrap
397 clr %l6 388 clr %l6
398
399
400 .globl cheetah_plus_patch_winfixup
401cheetah_plus_patch_winfixup:
402 sethi %hi(cplus_wfinsn_1), %o0
403 sethi %hi(cplus_winfixup_insn_1), %o2
404 lduw [%o0 + %lo(cplus_wfinsn_1)], %o1
405 or %o2, %lo(cplus_winfixup_insn_1), %o2
406 stw %o1, [%o2]
407 flush %o2
408
409 sethi %hi(cplus_wfinsn_2), %o0
410 sethi %hi(cplus_winfixup_insn_2), %o2
411 lduw [%o0 + %lo(cplus_wfinsn_2)], %o1
412 or %o2, %lo(cplus_winfixup_insn_2), %o2
413 stw %o1, [%o2]
414 flush %o2
415
416 retl
417 nop
diff --git a/arch/sparc64/lib/VISsave.S b/arch/sparc64/lib/VISsave.S
index 4e18989bd602..a0ded5c5aa5c 100644
--- a/arch/sparc64/lib/VISsave.S
+++ b/arch/sparc64/lib/VISsave.S
@@ -59,15 +59,17 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3
59 be,pn %icc, 9b 59 be,pn %icc, 9b
60 add %g6, TI_FPREGS, %g2 60 add %g6, TI_FPREGS, %g2
61 andcc %o5, FPRS_DL, %g0 61 andcc %o5, FPRS_DL, %g0
62 membar #StoreStore | #LoadStore
63 62
64 be,pn %icc, 4f 63 be,pn %icc, 4f
65 add %g6, TI_FPREGS+0x40, %g3 64 add %g6, TI_FPREGS+0x40, %g3
65 membar #Sync
66 stda %f0, [%g2 + %g1] ASI_BLK_P 66 stda %f0, [%g2 + %g1] ASI_BLK_P
67 stda %f16, [%g3 + %g1] ASI_BLK_P 67 stda %f16, [%g3 + %g1] ASI_BLK_P
68 membar #Sync
68 andcc %o5, FPRS_DU, %g0 69 andcc %o5, FPRS_DU, %g0
69 be,pn %icc, 5f 70 be,pn %icc, 5f
704: add %g1, 128, %g1 714: add %g1, 128, %g1
72 membar #Sync
71 stda %f32, [%g2 + %g1] ASI_BLK_P 73 stda %f32, [%g2 + %g1] ASI_BLK_P
72 74
73 stda %f48, [%g3 + %g1] ASI_BLK_P 75 stda %f48, [%g3 + %g1] ASI_BLK_P
@@ -87,7 +89,7 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3
87 sll %g1, 5, %g1 89 sll %g1, 5, %g1
88 add %g6, TI_FPREGS+0xc0, %g3 90 add %g6, TI_FPREGS+0xc0, %g3
89 wr %g0, FPRS_FEF, %fprs 91 wr %g0, FPRS_FEF, %fprs
90 membar #StoreStore | #LoadStore 92 membar #Sync
91 stda %f32, [%g2 + %g1] ASI_BLK_P 93 stda %f32, [%g2 + %g1] ASI_BLK_P
92 stda %f48, [%g3 + %g1] ASI_BLK_P 94 stda %f48, [%g3 + %g1] ASI_BLK_P
93 membar #Sync 95 membar #Sync
@@ -128,8 +130,8 @@ VISenterhalf:
128 be,pn %icc, 4f 130 be,pn %icc, 4f
129 add %g6, TI_FPREGS, %g2 131 add %g6, TI_FPREGS, %g2
130 132
131 membar #StoreStore | #LoadStore
132 add %g6, TI_FPREGS+0x40, %g3 133 add %g6, TI_FPREGS+0x40, %g3
134 membar #Sync
133 stda %f0, [%g2 + %g1] ASI_BLK_P 135 stda %f0, [%g2 + %g1] ASI_BLK_P
134 stda %f16, [%g3 + %g1] ASI_BLK_P 136 stda %f16, [%g3 + %g1] ASI_BLK_P
135 membar #Sync 137 membar #Sync
diff --git a/arch/sparc64/lib/strncpy_from_user.S b/arch/sparc64/lib/strncpy_from_user.S
index 09cbbaa0ebf4..e1264650ca7a 100644
--- a/arch/sparc64/lib/strncpy_from_user.S
+++ b/arch/sparc64/lib/strncpy_from_user.S
@@ -125,15 +125,11 @@ __strncpy_from_user:
125 add %o2, %o3, %o0 125 add %o2, %o3, %o0
126 .size __strncpy_from_user, .-__strncpy_from_user 126 .size __strncpy_from_user, .-__strncpy_from_user
127 127
128 .section .fixup,#alloc,#execinstr
129 .align 4
1304: retl
131 mov -EFAULT, %o0
132
133 .section __ex_table,#alloc 128 .section __ex_table,#alloc
134 .align 4 129 .align 4
135 .word 60b, 4b 130 .word 60b, __retl_efault
136 .word 61b, 4b 131 .word 61b, __retl_efault
137 .word 62b, 4b 132 .word 62b, __retl_efault
138 .word 63b, 4b 133 .word 63b, __retl_efault
139 .word 64b, 4b 134 .word 64b, __retl_efault
135 .previous
diff --git a/arch/sparc64/lib/user_fixup.c b/arch/sparc64/lib/user_fixup.c
index 0278e34125db..19d1fdb17d0e 100644
--- a/arch/sparc64/lib/user_fixup.c
+++ b/arch/sparc64/lib/user_fixup.c
@@ -11,61 +11,56 @@
11 11
12/* Calculating the exact fault address when using 12/* Calculating the exact fault address when using
13 * block loads and stores can be very complicated. 13 * block loads and stores can be very complicated.
14 *
14 * Instead of trying to be clever and handling all 15 * Instead of trying to be clever and handling all
15 * of the cases, just fix things up simply here. 16 * of the cases, just fix things up simply here.
16 */ 17 */
17 18
18unsigned long copy_from_user_fixup(void *to, const void __user *from, unsigned long size) 19static unsigned long compute_size(unsigned long start, unsigned long size, unsigned long *offset)
19{ 20{
20 char *dst = to; 21 unsigned long fault_addr = current_thread_info()->fault_address;
21 const char __user *src = from; 22 unsigned long end = start + size;
22 23
23 while (size) { 24 if (fault_addr < start || fault_addr >= end) {
24 if (__get_user(*dst, src)) 25 *offset = 0;
25 break; 26 } else {
26 dst++; 27 *offset = start - fault_addr;
27 src++; 28 size = end - fault_addr;
28 size--;
29 } 29 }
30 return size;
31}
30 32
31 if (size) 33unsigned long copy_from_user_fixup(void *to, const void __user *from, unsigned long size)
32 memset(dst, 0, size); 34{
35 unsigned long offset;
36
37 size = compute_size((unsigned long) from, size, &offset);
38 if (likely(size))
39 memset(to + offset, 0, size);
33 40
34 return size; 41 return size;
35} 42}
36 43
37unsigned long copy_to_user_fixup(void __user *to, const void *from, unsigned long size) 44unsigned long copy_to_user_fixup(void __user *to, const void *from, unsigned long size)
38{ 45{
39 char __user *dst = to; 46 unsigned long offset;
40 const char *src = from;
41
42 while (size) {
43 if (__put_user(*src, dst))
44 break;
45 dst++;
46 src++;
47 size--;
48 }
49 47
50 return size; 48 return compute_size((unsigned long) to, size, &offset);
51} 49}
52 50
53unsigned long copy_in_user_fixup(void __user *to, void __user *from, unsigned long size) 51unsigned long copy_in_user_fixup(void __user *to, void __user *from, unsigned long size)
54{ 52{
55 char __user *dst = to; 53 unsigned long fault_addr = current_thread_info()->fault_address;
56 char __user *src = from; 54 unsigned long start = (unsigned long) to;
55 unsigned long end = start + size;
57 56
58 while (size) { 57 if (fault_addr >= start && fault_addr < end)
59 char tmp; 58 return end - fault_addr;
60 59
61 if (__get_user(tmp, src)) 60 start = (unsigned long) from;
62 break; 61 end = start + size;
63 if (__put_user(tmp, dst)) 62 if (fault_addr >= start && fault_addr < end)
64 break; 63 return end - fault_addr;
65 dst++;
66 src++;
67 size--;
68 }
69 64
70 return size; 65 return size;
71} 66}
diff --git a/arch/sparc64/mm/Makefile b/arch/sparc64/mm/Makefile
index cda87333a77b..9d0960e69f48 100644
--- a/arch/sparc64/mm/Makefile
+++ b/arch/sparc64/mm/Makefile
@@ -5,6 +5,6 @@
5EXTRA_AFLAGS := -ansi 5EXTRA_AFLAGS := -ansi
6EXTRA_CFLAGS := -Werror 6EXTRA_CFLAGS := -Werror
7 7
8obj-y := ultra.o tlb.o fault.o init.o generic.o extable.o 8obj-y := ultra.o tlb.o fault.o init.o generic.o
9 9
10obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 10obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/sparc64/mm/extable.c b/arch/sparc64/mm/extable.c
deleted file mode 100644
index ec334297ff4f..000000000000
--- a/arch/sparc64/mm/extable.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * linux/arch/sparc64/mm/extable.c
3 */
4
5#include <linux/config.h>
6#include <linux/module.h>
7#include <asm/uaccess.h>
8
9extern const struct exception_table_entry __start___ex_table[];
10extern const struct exception_table_entry __stop___ex_table[];
11
12void sort_extable(struct exception_table_entry *start,
13 struct exception_table_entry *finish)
14{
15}
16
17/* Caller knows they are in a range if ret->fixup == 0 */
18const struct exception_table_entry *
19search_extable(const struct exception_table_entry *start,
20 const struct exception_table_entry *last,
21 unsigned long value)
22{
23 const struct exception_table_entry *walk;
24
25 /* Single insn entries are encoded as:
26 * word 1: insn address
27 * word 2: fixup code address
28 *
29 * Range entries are encoded as:
30 * word 1: first insn address
31 * word 2: 0
32 * word 3: last insn address + 4 bytes
33 * word 4: fixup code address
34 *
35 * See asm/uaccess.h for more details.
36 */
37
38 /* 1. Try to find an exact match. */
39 for (walk = start; walk <= last; walk++) {
40 if (walk->fixup == 0) {
41 /* A range entry, skip both parts. */
42 walk++;
43 continue;
44 }
45
46 if (walk->insn == value)
47 return walk;
48 }
49
50 /* 2. Try to find a range match. */
51 for (walk = start; walk <= (last - 1); walk++) {
52 if (walk->fixup)
53 continue;
54
55 if (walk[0].insn <= value && walk[1].insn > value)
56 return walk;
57
58 walk++;
59 }
60
61 return NULL;
62}
63
64/* Special extable search, which handles ranges. Returns fixup */
65unsigned long search_extables_range(unsigned long addr, unsigned long *g2)
66{
67 const struct exception_table_entry *entry;
68
69 entry = search_exception_tables(addr);
70 if (!entry)
71 return 0;
72
73 /* Inside range? Fix g2 and return correct fixup */
74 if (!entry->fixup) {
75 *g2 = (addr - entry->insn) / 4;
76 return (entry + 1)->fixup;
77 }
78
79 return entry->fixup;
80}
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index db1e3310e907..31fbc67719a1 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -32,8 +32,6 @@
32 32
33#define ELEMENTS(arr) (sizeof (arr)/sizeof (arr[0])) 33#define ELEMENTS(arr) (sizeof (arr)/sizeof (arr[0]))
34 34
35extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
36
37/* 35/*
38 * To debug kernel to catch accesses to certain virtual/physical addresses. 36 * To debug kernel to catch accesses to certain virtual/physical addresses.
39 * Mode = 0 selects physical watchpoints, mode = 1 selects virtual watchpoints. 37 * Mode = 0 selects physical watchpoints, mode = 1 selects virtual watchpoints.
@@ -71,53 +69,6 @@ void set_brkpt(unsigned long addr, unsigned char mask, int flags, int mode)
71 : "memory"); 69 : "memory");
72} 70}
73 71
74/* Nice, simple, prom library does all the sweating for us. ;) */
75unsigned long __init prom_probe_memory (void)
76{
77 register struct linux_mlist_p1275 *mlist;
78 register unsigned long bytes, base_paddr, tally;
79 register int i;
80
81 i = 0;
82 mlist = *prom_meminfo()->p1275_available;
83 bytes = tally = mlist->num_bytes;
84 base_paddr = mlist->start_adr;
85
86 sp_banks[0].base_addr = base_paddr;
87 sp_banks[0].num_bytes = bytes;
88
89 while (mlist->theres_more != (void *) 0) {
90 i++;
91 mlist = mlist->theres_more;
92 bytes = mlist->num_bytes;
93 tally += bytes;
94 if (i >= SPARC_PHYS_BANKS-1) {
95 printk ("The machine has more banks than "
96 "this kernel can support\n"
97 "Increase the SPARC_PHYS_BANKS "
98 "setting (currently %d)\n",
99 SPARC_PHYS_BANKS);
100 i = SPARC_PHYS_BANKS-1;
101 break;
102 }
103
104 sp_banks[i].base_addr = mlist->start_adr;
105 sp_banks[i].num_bytes = mlist->num_bytes;
106 }
107
108 i++;
109 sp_banks[i].base_addr = 0xdeadbeefbeefdeadUL;
110 sp_banks[i].num_bytes = 0;
111
112 /* Now mask all bank sizes on a page boundary, it is all we can
113 * use anyways.
114 */
115 for (i = 0; sp_banks[i].num_bytes != 0; i++)
116 sp_banks[i].num_bytes &= PAGE_MASK;
117
118 return tally;
119}
120
121static void __kprobes unhandled_fault(unsigned long address, 72static void __kprobes unhandled_fault(unsigned long address,
122 struct task_struct *tsk, 73 struct task_struct *tsk,
123 struct pt_regs *regs) 74 struct pt_regs *regs)
@@ -242,7 +193,6 @@ static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn)
242static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code, 193static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code,
243 unsigned int insn, unsigned long address) 194 unsigned int insn, unsigned long address)
244{ 195{
245 unsigned long g2;
246 unsigned char asi = ASI_P; 196 unsigned char asi = ASI_P;
247 197
248 if ((!insn) && (regs->tstate & TSTATE_PRIV)) 198 if ((!insn) && (regs->tstate & TSTATE_PRIV))
@@ -273,11 +223,9 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code,
273 } 223 }
274 } 224 }
275 225
276 g2 = regs->u_regs[UREG_G2];
277
278 /* Is this in ex_table? */ 226 /* Is this in ex_table? */
279 if (regs->tstate & TSTATE_PRIV) { 227 if (regs->tstate & TSTATE_PRIV) {
280 unsigned long fixup; 228 const struct exception_table_entry *entry;
281 229
282 if (asi == ASI_P && (insn & 0xc0800000) == 0xc0800000) { 230 if (asi == ASI_P && (insn & 0xc0800000) == 0xc0800000) {
283 if (insn & 0x2000) 231 if (insn & 0x2000)
@@ -288,10 +236,9 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code,
288 236
289 /* Look in asi.h: All _S asis have LS bit set */ 237 /* Look in asi.h: All _S asis have LS bit set */
290 if ((asi & 0x1) && 238 if ((asi & 0x1) &&
291 (fixup = search_extables_range(regs->tpc, &g2))) { 239 (entry = search_exception_tables(regs->tpc))) {
292 regs->tpc = fixup; 240 regs->tpc = entry->fixup;
293 regs->tnpc = regs->tpc + 4; 241 regs->tnpc = regs->tpc + 4;
294 regs->u_regs[UREG_G2] = g2;
295 return; 242 return;
296 } 243 }
297 } else { 244 } else {
@@ -461,7 +408,7 @@ good_area:
461 } 408 }
462 409
463 up_read(&mm->mmap_sem); 410 up_read(&mm->mmap_sem);
464 goto fault_done; 411 return;
465 412
466 /* 413 /*
467 * Something tried to access memory that isn't in our memory map.. 414 * Something tried to access memory that isn't in our memory map..
@@ -473,8 +420,7 @@ bad_area:
473 420
474handle_kernel_fault: 421handle_kernel_fault:
475 do_kernel_fault(regs, si_code, fault_code, insn, address); 422 do_kernel_fault(regs, si_code, fault_code, insn, address);
476 423 return;
477 goto fault_done;
478 424
479/* 425/*
480 * We ran out of memory, or some other thing happened to us that made 426 * We ran out of memory, or some other thing happened to us that made
@@ -505,9 +451,4 @@ do_sigbus:
505 /* Kernel mode? Handle exceptions or die */ 451 /* Kernel mode? Handle exceptions or die */
506 if (regs->tstate & TSTATE_PRIV) 452 if (regs->tstate & TSTATE_PRIV)
507 goto handle_kernel_fault; 453 goto handle_kernel_fault;
508
509fault_done:
510 /* These values are no longer needed, clear them. */
511 set_thread_fault_code(0);
512 current_thread_info()->fault_address = 0;
513} 454}
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 9f6ca624892d..0d2e967c7200 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -21,6 +21,7 @@
21#include <linux/seq_file.h> 21#include <linux/seq_file.h>
22#include <linux/kprobes.h> 22#include <linux/kprobes.h>
23#include <linux/cache.h> 23#include <linux/cache.h>
24#include <linux/sort.h>
24 25
25#include <asm/head.h> 26#include <asm/head.h>
26#include <asm/system.h> 27#include <asm/system.h>
@@ -41,7 +42,72 @@
41 42
42extern void device_scan(void); 43extern void device_scan(void);
43 44
44struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; 45#define MAX_BANKS 32
46
47static struct linux_prom64_registers pavail[MAX_BANKS] __initdata;
48static struct linux_prom64_registers pavail_rescan[MAX_BANKS] __initdata;
49static int pavail_ents __initdata;
50static int pavail_rescan_ents __initdata;
51
52static int cmp_p64(const void *a, const void *b)
53{
54 const struct linux_prom64_registers *x = a, *y = b;
55
56 if (x->phys_addr > y->phys_addr)
57 return 1;
58 if (x->phys_addr < y->phys_addr)
59 return -1;
60 return 0;
61}
62
63static void __init read_obp_memory(const char *property,
64 struct linux_prom64_registers *regs,
65 int *num_ents)
66{
67 int node = prom_finddevice("/memory");
68 int prop_size = prom_getproplen(node, property);
69 int ents, ret, i;
70
71 ents = prop_size / sizeof(struct linux_prom64_registers);
72 if (ents > MAX_BANKS) {
73 prom_printf("The machine has more %s property entries than "
74 "this kernel can support (%d).\n",
75 property, MAX_BANKS);
76 prom_halt();
77 }
78
79 ret = prom_getproperty(node, property, (char *) regs, prop_size);
80 if (ret == -1) {
81 prom_printf("Couldn't get %s property from /memory.\n");
82 prom_halt();
83 }
84
85 *num_ents = ents;
86
87 /* Sanitize what we got from the firmware, by page aligning
88 * everything.
89 */
90 for (i = 0; i < ents; i++) {
91 unsigned long base, size;
92
93 base = regs[i].phys_addr;
94 size = regs[i].reg_size;
95
96 size &= PAGE_MASK;
97 if (base & ~PAGE_MASK) {
98 unsigned long new_base = PAGE_ALIGN(base);
99
100 size -= new_base - base;
101 if ((long) size < 0L)
102 size = 0UL;
103 base = new_base;
104 }
105 regs[i].phys_addr = base;
106 regs[i].reg_size = size;
107 }
108 sort(regs, ents, sizeof(struct linux_prom64_registers),
109 cmp_p64, NULL);
110}
45 111
46unsigned long *sparc64_valid_addr_bitmap __read_mostly; 112unsigned long *sparc64_valid_addr_bitmap __read_mostly;
47 113
@@ -67,6 +133,12 @@ extern unsigned int sparc_ramdisk_size;
67 133
68struct page *mem_map_zero __read_mostly; 134struct page *mem_map_zero __read_mostly;
69 135
136unsigned int sparc64_highest_unlocked_tlb_ent __read_mostly;
137
138unsigned long sparc64_kern_pri_context __read_mostly;
139unsigned long sparc64_kern_pri_nuc_bits __read_mostly;
140unsigned long sparc64_kern_sec_context __read_mostly;
141
70int bigkernel = 0; 142int bigkernel = 0;
71 143
72/* XXX Tune this... */ 144/* XXX Tune this... */
@@ -296,6 +368,7 @@ struct linux_prom_translation {
296 unsigned long data; 368 unsigned long data;
297}; 369};
298static struct linux_prom_translation prom_trans[512] __initdata; 370static struct linux_prom_translation prom_trans[512] __initdata;
371static unsigned int prom_trans_ents __initdata;
299 372
300extern unsigned long prom_boot_page; 373extern unsigned long prom_boot_page;
301extern void prom_remap(unsigned long physpage, unsigned long virtpage, int mmu_ihandle); 374extern void prom_remap(unsigned long physpage, unsigned long virtpage, int mmu_ihandle);
@@ -309,57 +382,7 @@ unsigned long kern_locked_tte_data;
309unsigned long prom_pmd_phys __read_mostly; 382unsigned long prom_pmd_phys __read_mostly;
310unsigned int swapper_pgd_zero __read_mostly; 383unsigned int swapper_pgd_zero __read_mostly;
311 384
312/* Allocate power-of-2 aligned chunks from the end of the 385static pmd_t *prompmd __read_mostly;
313 * kernel image. Return physical address.
314 */
315static inline unsigned long early_alloc_phys(unsigned long size)
316{
317 unsigned long base;
318
319 BUILD_BUG_ON(size & (size - 1));
320
321 kern_size = (kern_size + (size - 1)) & ~(size - 1);
322 base = kern_base + kern_size;
323 kern_size += size;
324
325 return base;
326}
327
328static inline unsigned long load_phys32(unsigned long pa)
329{
330 unsigned long val;
331
332 __asm__ __volatile__("lduwa [%1] %2, %0"
333 : "=&r" (val)
334 : "r" (pa), "i" (ASI_PHYS_USE_EC));
335
336 return val;
337}
338
339static inline unsigned long load_phys64(unsigned long pa)
340{
341 unsigned long val;
342
343 __asm__ __volatile__("ldxa [%1] %2, %0"
344 : "=&r" (val)
345 : "r" (pa), "i" (ASI_PHYS_USE_EC));
346
347 return val;
348}
349
350static inline void store_phys32(unsigned long pa, unsigned long val)
351{
352 __asm__ __volatile__("stwa %0, [%1] %2"
353 : /* no outputs */
354 : "r" (val), "r" (pa), "i" (ASI_PHYS_USE_EC));
355}
356
357static inline void store_phys64(unsigned long pa, unsigned long val)
358{
359 __asm__ __volatile__("stxa %0, [%1] %2"
360 : /* no outputs */
361 : "r" (val), "r" (pa), "i" (ASI_PHYS_USE_EC));
362}
363 386
364#define BASE_PAGE_SIZE 8192 387#define BASE_PAGE_SIZE 8192
365 388
@@ -369,34 +392,28 @@ static inline void store_phys64(unsigned long pa, unsigned long val)
369 */ 392 */
370unsigned long prom_virt_to_phys(unsigned long promva, int *error) 393unsigned long prom_virt_to_phys(unsigned long promva, int *error)
371{ 394{
372 unsigned long pmd_phys = (prom_pmd_phys + 395 pmd_t *pmdp = prompmd + ((promva >> 23) & 0x7ff);
373 ((promva >> 23) & 0x7ff) * sizeof(pmd_t)); 396 pte_t *ptep;
374 unsigned long pte_phys;
375 pmd_t pmd_ent;
376 pte_t pte_ent;
377 unsigned long base; 397 unsigned long base;
378 398
379 pmd_val(pmd_ent) = load_phys32(pmd_phys); 399 if (pmd_none(*pmdp)) {
380 if (pmd_none(pmd_ent)) {
381 if (error) 400 if (error)
382 *error = 1; 401 *error = 1;
383 return 0; 402 return 0;
384 } 403 }
385 404 ptep = (pte_t *)__pmd_page(*pmdp) + ((promva >> 13) & 0x3ff);
386 pte_phys = (unsigned long)pmd_val(pmd_ent) << 11UL; 405 if (!pte_present(*ptep)) {
387 pte_phys += ((promva >> 13) & 0x3ff) * sizeof(pte_t);
388 pte_val(pte_ent) = load_phys64(pte_phys);
389 if (!pte_present(pte_ent)) {
390 if (error) 406 if (error)
391 *error = 1; 407 *error = 1;
392 return 0; 408 return 0;
393 } 409 }
394 if (error) { 410 if (error) {
395 *error = 0; 411 *error = 0;
396 return pte_val(pte_ent); 412 return pte_val(*ptep);
397 } 413 }
398 base = pte_val(pte_ent) & _PAGE_PADDR; 414 base = pte_val(*ptep) & _PAGE_PADDR;
399 return (base + (promva & (BASE_PAGE_SIZE - 1))); 415
416 return base + (promva & (BASE_PAGE_SIZE - 1));
400} 417}
401 418
402/* The obp translations are saved based on 8k pagesize, since obp can 419/* The obp translations are saved based on 8k pagesize, since obp can
@@ -409,25 +426,20 @@ static void __init build_obp_range(unsigned long start, unsigned long end, unsig
409 unsigned long vaddr; 426 unsigned long vaddr;
410 427
411 for (vaddr = start; vaddr < end; vaddr += BASE_PAGE_SIZE) { 428 for (vaddr = start; vaddr < end; vaddr += BASE_PAGE_SIZE) {
412 unsigned long val, pte_phys, pmd_phys; 429 unsigned long val;
413 pmd_t pmd_ent; 430 pmd_t *pmd;
414 int i; 431 pte_t *pte;
415
416 pmd_phys = (prom_pmd_phys +
417 (((vaddr >> 23) & 0x7ff) * sizeof(pmd_t)));
418 pmd_val(pmd_ent) = load_phys32(pmd_phys);
419 if (pmd_none(pmd_ent)) {
420 pte_phys = early_alloc_phys(BASE_PAGE_SIZE);
421
422 for (i = 0; i < BASE_PAGE_SIZE / sizeof(pte_t); i++)
423 store_phys64(pte_phys+i*sizeof(pte_t),0);
424 432
425 pmd_val(pmd_ent) = pte_phys >> 11UL; 433 pmd = prompmd + ((vaddr >> 23) & 0x7ff);
426 store_phys32(pmd_phys, pmd_val(pmd_ent)); 434 if (pmd_none(*pmd)) {
435 pte = __alloc_bootmem(BASE_PAGE_SIZE, BASE_PAGE_SIZE,
436 PAGE_SIZE);
437 if (!pte)
438 prom_halt();
439 memset(pte, 0, BASE_PAGE_SIZE);
440 pmd_set(pmd, pte);
427 } 441 }
428 442 pte = (pte_t *) __pmd_page(*pmd) + ((vaddr >> 13) & 0x3ff);
429 pte_phys = (unsigned long)pmd_val(pmd_ent) << 11UL;
430 pte_phys += (((vaddr >> 13) & 0x3ff) * sizeof(pte_t));
431 443
432 val = data; 444 val = data;
433 445
@@ -435,7 +447,8 @@ static void __init build_obp_range(unsigned long start, unsigned long end, unsig
435 if (tlb_type == spitfire) 447 if (tlb_type == spitfire)
436 val &= ~0x0003fe0000000000UL; 448 val &= ~0x0003fe0000000000UL;
437 449
438 store_phys64(pte_phys, val | _PAGE_MODIFIED); 450 set_pte_at(&init_mm, vaddr, pte,
451 __pte(val | _PAGE_MODIFIED));
439 452
440 data += BASE_PAGE_SIZE; 453 data += BASE_PAGE_SIZE;
441 } 454 }
@@ -448,13 +461,17 @@ static inline int in_obp_range(unsigned long vaddr)
448} 461}
449 462
450#define OBP_PMD_SIZE 2048 463#define OBP_PMD_SIZE 2048
451static void __init build_obp_pgtable(int prom_trans_ents) 464static void __init build_obp_pgtable(void)
452{ 465{
453 unsigned long i; 466 unsigned long i;
454 467
455 prom_pmd_phys = early_alloc_phys(OBP_PMD_SIZE); 468 prompmd = __alloc_bootmem(OBP_PMD_SIZE, OBP_PMD_SIZE, PAGE_SIZE);
456 for (i = 0; i < OBP_PMD_SIZE; i += 4) 469 if (!prompmd)
457 store_phys32(prom_pmd_phys + i, 0); 470 prom_halt();
471
472 memset(prompmd, 0, OBP_PMD_SIZE);
473
474 prom_pmd_phys = __pa(prompmd);
458 475
459 for (i = 0; i < prom_trans_ents; i++) { 476 for (i = 0; i < prom_trans_ents; i++) {
460 unsigned long start, end; 477 unsigned long start, end;
@@ -474,7 +491,7 @@ static void __init build_obp_pgtable(int prom_trans_ents)
474/* Read OBP translations property into 'prom_trans[]'. 491/* Read OBP translations property into 'prom_trans[]'.
475 * Return the number of entries. 492 * Return the number of entries.
476 */ 493 */
477static int __init read_obp_translations(void) 494static void __init read_obp_translations(void)
478{ 495{
479 int n, node; 496 int n, node;
480 497
@@ -495,8 +512,10 @@ static int __init read_obp_translations(void)
495 prom_printf("prom_mappings: Couldn't get property.\n"); 512 prom_printf("prom_mappings: Couldn't get property.\n");
496 prom_halt(); 513 prom_halt();
497 } 514 }
515
498 n = n / sizeof(struct linux_prom_translation); 516 n = n / sizeof(struct linux_prom_translation);
499 return n; 517
518 prom_trans_ents = n;
500} 519}
501 520
502static void __init remap_kernel(void) 521static void __init remap_kernel(void)
@@ -516,28 +535,38 @@ static void __init remap_kernel(void)
516 prom_dtlb_load(tlb_ent, tte_data, tte_vaddr); 535 prom_dtlb_load(tlb_ent, tte_data, tte_vaddr);
517 prom_itlb_load(tlb_ent, tte_data, tte_vaddr); 536 prom_itlb_load(tlb_ent, tte_data, tte_vaddr);
518 if (bigkernel) { 537 if (bigkernel) {
519 prom_dtlb_load(tlb_ent - 1, 538 tlb_ent -= 1;
539 prom_dtlb_load(tlb_ent,
520 tte_data + 0x400000, 540 tte_data + 0x400000,
521 tte_vaddr + 0x400000); 541 tte_vaddr + 0x400000);
522 prom_itlb_load(tlb_ent - 1, 542 prom_itlb_load(tlb_ent,
523 tte_data + 0x400000, 543 tte_data + 0x400000,
524 tte_vaddr + 0x400000); 544 tte_vaddr + 0x400000);
525 } 545 }
546 sparc64_highest_unlocked_tlb_ent = tlb_ent - 1;
547 if (tlb_type == cheetah_plus) {
548 sparc64_kern_pri_context = (CTX_CHEETAH_PLUS_CTX0 |
549 CTX_CHEETAH_PLUS_NUC);
550 sparc64_kern_pri_nuc_bits = CTX_CHEETAH_PLUS_NUC;
551 sparc64_kern_sec_context = CTX_CHEETAH_PLUS_CTX0;
552 }
526} 553}
527 554
528static void __init inherit_prom_mappings(void)
529{
530 int n;
531 555
532 n = read_obp_translations(); 556static void __init inherit_prom_mappings_pre(void)
533 build_obp_pgtable(n); 557{
558 read_obp_translations();
534 559
535 /* Now fixup OBP's idea about where we really are mapped. */ 560 /* Now fixup OBP's idea about where we really are mapped. */
536 prom_printf("Remapping the kernel... "); 561 prom_printf("Remapping the kernel... ");
537 remap_kernel(); 562 remap_kernel();
538 563
539 prom_printf("done.\n"); 564 prom_printf("done.\n");
565}
540 566
567static void __init inherit_prom_mappings_post(void)
568{
569 build_obp_pgtable();
541 register_prom_callbacks(); 570 register_prom_callbacks();
542} 571}
543 572
@@ -722,8 +751,8 @@ void inherit_locked_prom_mappings(int save_p)
722 } 751 }
723 } 752 }
724 if (tlb_type == spitfire) { 753 if (tlb_type == spitfire) {
725 int high = SPITFIRE_HIGHEST_LOCKED_TLBENT - bigkernel; 754 int high = sparc64_highest_unlocked_tlb_ent;
726 for (i = 0; i < high; i++) { 755 for (i = 0; i <= high; i++) {
727 unsigned long data; 756 unsigned long data;
728 757
729 /* Spitfire Errata #32 workaround */ 758 /* Spitfire Errata #32 workaround */
@@ -811,9 +840,9 @@ void inherit_locked_prom_mappings(int save_p)
811 } 840 }
812 } 841 }
813 } else if (tlb_type == cheetah || tlb_type == cheetah_plus) { 842 } else if (tlb_type == cheetah || tlb_type == cheetah_plus) {
814 int high = CHEETAH_HIGHEST_LOCKED_TLBENT - bigkernel; 843 int high = sparc64_highest_unlocked_tlb_ent;
815 844
816 for (i = 0; i < high; i++) { 845 for (i = 0; i <= high; i++) {
817 unsigned long data; 846 unsigned long data;
818 847
819 data = cheetah_get_ldtlb_data(i); 848 data = cheetah_get_ldtlb_data(i);
@@ -1206,14 +1235,14 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
1206 int i; 1235 int i;
1207 1236
1208#ifdef CONFIG_DEBUG_BOOTMEM 1237#ifdef CONFIG_DEBUG_BOOTMEM
1209 prom_printf("bootmem_init: Scan sp_banks, "); 1238 prom_printf("bootmem_init: Scan pavail, ");
1210#endif 1239#endif
1211 1240
1212 bytes_avail = 0UL; 1241 bytes_avail = 0UL;
1213 for (i = 0; sp_banks[i].num_bytes != 0; i++) { 1242 for (i = 0; i < pavail_ents; i++) {
1214 end_of_phys_memory = sp_banks[i].base_addr + 1243 end_of_phys_memory = pavail[i].phys_addr +
1215 sp_banks[i].num_bytes; 1244 pavail[i].reg_size;
1216 bytes_avail += sp_banks[i].num_bytes; 1245 bytes_avail += pavail[i].reg_size;
1217 if (cmdline_memory_size) { 1246 if (cmdline_memory_size) {
1218 if (bytes_avail > cmdline_memory_size) { 1247 if (bytes_avail > cmdline_memory_size) {
1219 unsigned long slack = bytes_avail - cmdline_memory_size; 1248 unsigned long slack = bytes_avail - cmdline_memory_size;
@@ -1221,12 +1250,15 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
1221 bytes_avail -= slack; 1250 bytes_avail -= slack;
1222 end_of_phys_memory -= slack; 1251 end_of_phys_memory -= slack;
1223 1252
1224 sp_banks[i].num_bytes -= slack; 1253 pavail[i].reg_size -= slack;
1225 if (sp_banks[i].num_bytes == 0) { 1254 if ((long)pavail[i].reg_size <= 0L) {
1226 sp_banks[i].base_addr = 0xdeadbeef; 1255 pavail[i].phys_addr = 0xdeadbeefUL;
1256 pavail[i].reg_size = 0UL;
1257 pavail_ents = i;
1227 } else { 1258 } else {
1228 sp_banks[i+1].num_bytes = 0; 1259 pavail[i+1].reg_size = 0Ul;
1229 sp_banks[i+1].base_addr = 0xdeadbeef; 1260 pavail[i+1].phys_addr = 0xdeadbeefUL;
1261 pavail_ents = i + 1;
1230 } 1262 }
1231 break; 1263 break;
1232 } 1264 }
@@ -1280,12 +1312,12 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
1280 /* Now register the available physical memory with the 1312 /* Now register the available physical memory with the
1281 * allocator. 1313 * allocator.
1282 */ 1314 */
1283 for (i = 0; sp_banks[i].num_bytes != 0; i++) { 1315 for (i = 0; i < pavail_ents; i++) {
1284#ifdef CONFIG_DEBUG_BOOTMEM 1316#ifdef CONFIG_DEBUG_BOOTMEM
1285 prom_printf("free_bootmem(sp_banks:%d): base[%lx] size[%lx]\n", 1317 prom_printf("free_bootmem(pavail:%d): base[%lx] size[%lx]\n",
1286 i, sp_banks[i].base_addr, sp_banks[i].num_bytes); 1318 i, pavail[i].phys_addr, pavail[i].reg_size);
1287#endif 1319#endif
1288 free_bootmem(sp_banks[i].base_addr, sp_banks[i].num_bytes); 1320 free_bootmem(pavail[i].phys_addr, pavail[i].reg_size);
1289 } 1321 }
1290 1322
1291#ifdef CONFIG_BLK_DEV_INITRD 1323#ifdef CONFIG_BLK_DEV_INITRD
@@ -1334,7 +1366,7 @@ static unsigned long kernel_map_range(unsigned long pstart, unsigned long pend,
1334 unsigned long alloc_bytes = 0UL; 1366 unsigned long alloc_bytes = 0UL;
1335 1367
1336 if ((vstart & ~PAGE_MASK) || (vend & ~PAGE_MASK)) { 1368 if ((vstart & ~PAGE_MASK) || (vend & ~PAGE_MASK)) {
1337 prom_printf("kernel_map: Unaligned sp_banks[%lx:%lx]\n", 1369 prom_printf("kernel_map: Unaligned physmem[%lx:%lx]\n",
1338 vstart, vend); 1370 vstart, vend);
1339 prom_halt(); 1371 prom_halt();
1340 } 1372 }
@@ -1381,23 +1413,24 @@ static unsigned long kernel_map_range(unsigned long pstart, unsigned long pend,
1381 return alloc_bytes; 1413 return alloc_bytes;
1382} 1414}
1383 1415
1384extern struct linux_mlist_p1275 *prom_ptot_ptr; 1416static struct linux_prom64_registers pall[MAX_BANKS] __initdata;
1417static int pall_ents __initdata;
1418
1385extern unsigned int kvmap_linear_patch[1]; 1419extern unsigned int kvmap_linear_patch[1];
1386 1420
1387static void __init kernel_physical_mapping_init(void) 1421static void __init kernel_physical_mapping_init(void)
1388{ 1422{
1389 struct linux_mlist_p1275 *p = prom_ptot_ptr; 1423 unsigned long i, mem_alloced = 0UL;
1390 unsigned long mem_alloced = 0UL; 1424
1425 read_obp_memory("reg", &pall[0], &pall_ents);
1391 1426
1392 while (p) { 1427 for (i = 0; i < pall_ents; i++) {
1393 unsigned long phys_start, phys_end; 1428 unsigned long phys_start, phys_end;
1394 1429
1395 phys_start = p->start_adr; 1430 phys_start = pall[i].phys_addr;
1396 phys_end = phys_start + p->num_bytes; 1431 phys_end = phys_start + pall[i].reg_size;
1397 mem_alloced += kernel_map_range(phys_start, phys_end, 1432 mem_alloced += kernel_map_range(phys_start, phys_end,
1398 PAGE_KERNEL); 1433 PAGE_KERNEL);
1399
1400 p = p->theres_more;
1401 } 1434 }
1402 1435
1403 printk("Allocated %ld bytes for kernel page tables.\n", 1436 printk("Allocated %ld bytes for kernel page tables.\n",
@@ -1425,6 +1458,18 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
1425} 1458}
1426#endif 1459#endif
1427 1460
1461unsigned long __init find_ecache_flush_span(unsigned long size)
1462{
1463 int i;
1464
1465 for (i = 0; i < pavail_ents; i++) {
1466 if (pavail[i].reg_size >= size)
1467 return pavail[i].phys_addr;
1468 }
1469
1470 return ~0UL;
1471}
1472
1428/* paging_init() sets up the page tables */ 1473/* paging_init() sets up the page tables */
1429 1474
1430extern void cheetah_ecache_flush_init(void); 1475extern void cheetah_ecache_flush_init(void);
@@ -1435,7 +1480,19 @@ pgd_t swapper_pg_dir[2048];
1435void __init paging_init(void) 1480void __init paging_init(void)
1436{ 1481{
1437 unsigned long end_pfn, pages_avail, shift; 1482 unsigned long end_pfn, pages_avail, shift;
1438 unsigned long real_end; 1483 unsigned long real_end, i;
1484
1485 /* Find available physical memory... */
1486 read_obp_memory("available", &pavail[0], &pavail_ents);
1487
1488 phys_base = 0xffffffffffffffffUL;
1489 for (i = 0; i < pavail_ents; i++)
1490 phys_base = min(phys_base, pavail[i].phys_addr);
1491
1492 pfn_base = phys_base >> PAGE_SHIFT;
1493
1494 kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL;
1495 kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
1439 1496
1440 set_bit(0, mmu_context_bmap); 1497 set_bit(0, mmu_context_bmap);
1441 1498
@@ -1462,8 +1519,7 @@ void __init paging_init(void)
1462 1519
1463 swapper_pgd_zero = pgd_val(swapper_pg_dir[0]); 1520 swapper_pgd_zero = pgd_val(swapper_pg_dir[0]);
1464 1521
1465 /* Inherit non-locked OBP mappings. */ 1522 inherit_prom_mappings_pre();
1466 inherit_prom_mappings();
1467 1523
1468 /* Ok, we can use our TLB miss and window trap handlers safely. 1524 /* Ok, we can use our TLB miss and window trap handlers safely.
1469 * We need to do a quick peek here to see if we are on StarFire 1525 * We need to do a quick peek here to see if we are on StarFire
@@ -1474,15 +1530,23 @@ void __init paging_init(void)
1474 extern void setup_tba(int); 1530 extern void setup_tba(int);
1475 setup_tba(this_is_starfire); 1531 setup_tba(this_is_starfire);
1476 } 1532 }
1477
1478 inherit_locked_prom_mappings(1);
1479
1480 __flush_tlb_all(); 1533 __flush_tlb_all();
1481 1534
1535 /* Everything from this point forward, until we are done with
1536 * inherit_prom_mappings_post(), must complete successfully
1537 * without calling into the firmware. The firwmare page tables
1538 * have not been built, but we are running on the Linux kernel's
1539 * trap table.
1540 */
1541
1482 /* Setup bootmem... */ 1542 /* Setup bootmem... */
1483 pages_avail = 0; 1543 pages_avail = 0;
1484 last_valid_pfn = end_pfn = bootmem_init(&pages_avail); 1544 last_valid_pfn = end_pfn = bootmem_init(&pages_avail);
1485 1545
1546 inherit_prom_mappings_post();
1547
1548 inherit_locked_prom_mappings(1);
1549
1486#ifdef CONFIG_DEBUG_PAGEALLOC 1550#ifdef CONFIG_DEBUG_PAGEALLOC
1487 kernel_physical_mapping_init(); 1551 kernel_physical_mapping_init();
1488#endif 1552#endif
@@ -1507,128 +1571,35 @@ void __init paging_init(void)
1507 device_scan(); 1571 device_scan();
1508} 1572}
1509 1573
1510/* Ok, it seems that the prom can allocate some more memory chunks
1511 * as a side effect of some prom calls we perform during the
1512 * boot sequence. My most likely theory is that it is from the
1513 * prom_set_traptable() call, and OBP is allocating a scratchpad
1514 * for saving client program register state etc.
1515 */
1516static void __init sort_memlist(struct linux_mlist_p1275 *thislist)
1517{
1518 int swapi = 0;
1519 int i, mitr;
1520 unsigned long tmpaddr, tmpsize;
1521 unsigned long lowest;
1522
1523 for (i = 0; thislist[i].theres_more != 0; i++) {
1524 lowest = thislist[i].start_adr;
1525 for (mitr = i+1; thislist[mitr-1].theres_more != 0; mitr++)
1526 if (thislist[mitr].start_adr < lowest) {
1527 lowest = thislist[mitr].start_adr;
1528 swapi = mitr;
1529 }
1530 if (lowest == thislist[i].start_adr)
1531 continue;
1532 tmpaddr = thislist[swapi].start_adr;
1533 tmpsize = thislist[swapi].num_bytes;
1534 for (mitr = swapi; mitr > i; mitr--) {
1535 thislist[mitr].start_adr = thislist[mitr-1].start_adr;
1536 thislist[mitr].num_bytes = thislist[mitr-1].num_bytes;
1537 }
1538 thislist[i].start_adr = tmpaddr;
1539 thislist[i].num_bytes = tmpsize;
1540 }
1541}
1542
1543void __init rescan_sp_banks(void)
1544{
1545 struct linux_prom64_registers memlist[64];
1546 struct linux_mlist_p1275 avail[64], *mlist;
1547 unsigned long bytes, base_paddr;
1548 int num_regs, node = prom_finddevice("/memory");
1549 int i;
1550
1551 num_regs = prom_getproperty(node, "available",
1552 (char *) memlist, sizeof(memlist));
1553 num_regs = (num_regs / sizeof(struct linux_prom64_registers));
1554 for (i = 0; i < num_regs; i++) {
1555 avail[i].start_adr = memlist[i].phys_addr;
1556 avail[i].num_bytes = memlist[i].reg_size;
1557 avail[i].theres_more = &avail[i + 1];
1558 }
1559 avail[i - 1].theres_more = NULL;
1560 sort_memlist(avail);
1561
1562 mlist = &avail[0];
1563 i = 0;
1564 bytes = mlist->num_bytes;
1565 base_paddr = mlist->start_adr;
1566
1567 sp_banks[0].base_addr = base_paddr;
1568 sp_banks[0].num_bytes = bytes;
1569
1570 while (mlist->theres_more != NULL){
1571 i++;
1572 mlist = mlist->theres_more;
1573 bytes = mlist->num_bytes;
1574 if (i >= SPARC_PHYS_BANKS-1) {
1575 printk ("The machine has more banks than "
1576 "this kernel can support\n"
1577 "Increase the SPARC_PHYS_BANKS "
1578 "setting (currently %d)\n",
1579 SPARC_PHYS_BANKS);
1580 i = SPARC_PHYS_BANKS-1;
1581 break;
1582 }
1583
1584 sp_banks[i].base_addr = mlist->start_adr;
1585 sp_banks[i].num_bytes = mlist->num_bytes;
1586 }
1587
1588 i++;
1589 sp_banks[i].base_addr = 0xdeadbeefbeefdeadUL;
1590 sp_banks[i].num_bytes = 0;
1591
1592 for (i = 0; sp_banks[i].num_bytes != 0; i++)
1593 sp_banks[i].num_bytes &= PAGE_MASK;
1594}
1595
1596static void __init taint_real_pages(void) 1574static void __init taint_real_pages(void)
1597{ 1575{
1598 struct sparc_phys_banks saved_sp_banks[SPARC_PHYS_BANKS];
1599 int i; 1576 int i;
1600 1577
1601 for (i = 0; i < SPARC_PHYS_BANKS; i++) { 1578 read_obp_memory("available", &pavail_rescan[0], &pavail_rescan_ents);
1602 saved_sp_banks[i].base_addr =
1603 sp_banks[i].base_addr;
1604 saved_sp_banks[i].num_bytes =
1605 sp_banks[i].num_bytes;
1606 }
1607
1608 rescan_sp_banks();
1609 1579
1610 /* Find changes discovered in the sp_bank rescan and 1580 /* Find changes discovered in the physmem available rescan and
1611 * reserve the lost portions in the bootmem maps. 1581 * reserve the lost portions in the bootmem maps.
1612 */ 1582 */
1613 for (i = 0; saved_sp_banks[i].num_bytes; i++) { 1583 for (i = 0; i < pavail_ents; i++) {
1614 unsigned long old_start, old_end; 1584 unsigned long old_start, old_end;
1615 1585
1616 old_start = saved_sp_banks[i].base_addr; 1586 old_start = pavail[i].phys_addr;
1617 old_end = old_start + 1587 old_end = old_start +
1618 saved_sp_banks[i].num_bytes; 1588 pavail[i].reg_size;
1619 while (old_start < old_end) { 1589 while (old_start < old_end) {
1620 int n; 1590 int n;
1621 1591
1622 for (n = 0; sp_banks[n].num_bytes; n++) { 1592 for (n = 0; pavail_rescan_ents; n++) {
1623 unsigned long new_start, new_end; 1593 unsigned long new_start, new_end;
1624 1594
1625 new_start = sp_banks[n].base_addr; 1595 new_start = pavail_rescan[n].phys_addr;
1626 new_end = new_start + sp_banks[n].num_bytes; 1596 new_end = new_start +
1597 pavail_rescan[n].reg_size;
1627 1598
1628 if (new_start <= old_start && 1599 if (new_start <= old_start &&
1629 new_end >= (old_start + PAGE_SIZE)) { 1600 new_end >= (old_start + PAGE_SIZE)) {
1630 set_bit (old_start >> 22, 1601 set_bit(old_start >> 22,
1631 sparc64_valid_addr_bitmap); 1602 sparc64_valid_addr_bitmap);
1632 goto do_next_page; 1603 goto do_next_page;
1633 } 1604 }
1634 } 1605 }
diff --git a/arch/sparc64/prom/Makefile b/arch/sparc64/prom/Makefile
index c7898a5ee456..3d33ed27bc27 100644
--- a/arch/sparc64/prom/Makefile
+++ b/arch/sparc64/prom/Makefile
@@ -6,5 +6,5 @@
6EXTRA_AFLAGS := -ansi 6EXTRA_AFLAGS := -ansi
7EXTRA_CFLAGS := -Werror 7EXTRA_CFLAGS := -Werror
8 8
9lib-y := bootstr.o devops.o init.o memory.o misc.o \ 9lib-y := bootstr.o devops.o init.o misc.o \
10 tree.o console.o printf.o p1275.o cif.o 10 tree.o console.o printf.o p1275.o cif.o
diff --git a/arch/sparc64/prom/init.c b/arch/sparc64/prom/init.c
index 8b4b622d0909..f3cc2d8578b2 100644
--- a/arch/sparc64/prom/init.c
+++ b/arch/sparc64/prom/init.c
@@ -27,7 +27,6 @@ int prom_chosen_node;
27 * failure. It gets passed the pointer to the PROM vector. 27 * failure. It gets passed the pointer to the PROM vector.
28 */ 28 */
29 29
30extern void prom_meminit(void);
31extern void prom_cif_init(void *, void *); 30extern void prom_cif_init(void *, void *);
32 31
33void __init prom_init(void *cif_handler, void *cif_stack) 32void __init prom_init(void *cif_handler, void *cif_stack)
@@ -90,8 +89,6 @@ void __init prom_init(void *cif_handler, void *cif_stack)
90 89
91 printk ("PROMLIB: Sun IEEE Boot Prom %s\n", buffer + bufadjust); 90 printk ("PROMLIB: Sun IEEE Boot Prom %s\n", buffer + bufadjust);
92 91
93 prom_meminit();
94
95 /* Initialization successful. */ 92 /* Initialization successful. */
96 return; 93 return;
97 94
diff --git a/arch/sparc64/prom/memory.c b/arch/sparc64/prom/memory.c
deleted file mode 100644
index f4a8143e052c..000000000000
--- a/arch/sparc64/prom/memory.c
+++ /dev/null
@@ -1,152 +0,0 @@
1/* $Id: memory.c,v 1.5 1999/08/31 06:55:04 davem Exp $
2 * memory.c: Prom routine for acquiring various bits of information
3 * about RAM on the machine, both virtual and physical.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 */
8
9#include <linux/kernel.h>
10#include <linux/init.h>
11
12#include <asm/openprom.h>
13#include <asm/oplib.h>
14
15/* This routine, for consistency, returns the ram parameters in the
16 * V0 prom memory descriptor format. I choose this format because I
17 * think it was the easiest to work with. I feel the religious
18 * arguments now... ;) Also, I return the linked lists sorted to
19 * prevent paging_init() upset stomach as I have not yet written
20 * the pepto-bismol kernel module yet.
21 */
22
23struct linux_prom64_registers prom_reg_memlist[64];
24struct linux_prom64_registers prom_reg_tmp[64];
25
26struct linux_mlist_p1275 prom_phys_total[64];
27struct linux_mlist_p1275 prom_prom_taken[64];
28struct linux_mlist_p1275 prom_phys_avail[64];
29
30struct linux_mlist_p1275 *prom_ptot_ptr = prom_phys_total;
31struct linux_mlist_p1275 *prom_ptak_ptr = prom_prom_taken;
32struct linux_mlist_p1275 *prom_pavl_ptr = prom_phys_avail;
33
34struct linux_mem_p1275 prom_memlist;
35
36
37/* Internal Prom library routine to sort a linux_mlist_p1275 memory
38 * list. Used below in initialization.
39 */
40static void __init
41prom_sortmemlist(struct linux_mlist_p1275 *thislist)
42{
43 int swapi = 0;
44 int i, mitr;
45 unsigned long tmpaddr, tmpsize;
46 unsigned long lowest;
47
48 for(i=0; thislist[i].theres_more; i++) {
49 lowest = thislist[i].start_adr;
50 for(mitr = i+1; thislist[mitr-1].theres_more; mitr++)
51 if(thislist[mitr].start_adr < lowest) {
52 lowest = thislist[mitr].start_adr;
53 swapi = mitr;
54 }
55 if(lowest == thislist[i].start_adr) continue;
56 tmpaddr = thislist[swapi].start_adr;
57 tmpsize = thislist[swapi].num_bytes;
58 for(mitr = swapi; mitr > i; mitr--) {
59 thislist[mitr].start_adr = thislist[mitr-1].start_adr;
60 thislist[mitr].num_bytes = thislist[mitr-1].num_bytes;
61 }
62 thislist[i].start_adr = tmpaddr;
63 thislist[i].num_bytes = tmpsize;
64 }
65}
66
67/* Initialize the memory lists based upon the prom version. */
68void __init prom_meminit(void)
69{
70 int node = 0;
71 unsigned int iter, num_regs;
72
73 node = prom_finddevice("/memory");
74 num_regs = prom_getproperty(node, "available",
75 (char *) prom_reg_memlist,
76 sizeof(prom_reg_memlist));
77 num_regs = (num_regs/sizeof(struct linux_prom64_registers));
78 for(iter=0; iter<num_regs; iter++) {
79 prom_phys_avail[iter].start_adr =
80 prom_reg_memlist[iter].phys_addr;
81 prom_phys_avail[iter].num_bytes =
82 prom_reg_memlist[iter].reg_size;
83 prom_phys_avail[iter].theres_more =
84 &prom_phys_avail[iter+1];
85 }
86 prom_phys_avail[iter-1].theres_more = NULL;
87
88 num_regs = prom_getproperty(node, "reg",
89 (char *) prom_reg_memlist,
90 sizeof(prom_reg_memlist));
91 num_regs = (num_regs/sizeof(struct linux_prom64_registers));
92 for(iter=0; iter<num_regs; iter++) {
93 prom_phys_total[iter].start_adr =
94 prom_reg_memlist[iter].phys_addr;
95 prom_phys_total[iter].num_bytes =
96 prom_reg_memlist[iter].reg_size;
97 prom_phys_total[iter].theres_more =
98 &prom_phys_total[iter+1];
99 }
100 prom_phys_total[iter-1].theres_more = NULL;
101
102 node = prom_finddevice("/virtual-memory");
103 num_regs = prom_getproperty(node, "available",
104 (char *) prom_reg_memlist,
105 sizeof(prom_reg_memlist));
106 num_regs = (num_regs/sizeof(struct linux_prom64_registers));
107
108 /* Convert available virtual areas to taken virtual
109 * areas. First sort, then convert.
110 */
111 for(iter=0; iter<num_regs; iter++) {
112 prom_prom_taken[iter].start_adr =
113 prom_reg_memlist[iter].phys_addr;
114 prom_prom_taken[iter].num_bytes =
115 prom_reg_memlist[iter].reg_size;
116 prom_prom_taken[iter].theres_more =
117 &prom_prom_taken[iter+1];
118 }
119 prom_prom_taken[iter-1].theres_more = NULL;
120
121 prom_sortmemlist(prom_prom_taken);
122
123 /* Finally, convert. */
124 for(iter=0; iter<num_regs; iter++) {
125 prom_prom_taken[iter].start_adr =
126 prom_prom_taken[iter].start_adr +
127 prom_prom_taken[iter].num_bytes;
128 prom_prom_taken[iter].num_bytes =
129 prom_prom_taken[iter+1].start_adr -
130 prom_prom_taken[iter].start_adr;
131 }
132 prom_prom_taken[iter-1].num_bytes =
133 -1UL - prom_prom_taken[iter-1].start_adr;
134
135 /* Sort the other two lists. */
136 prom_sortmemlist(prom_phys_total);
137 prom_sortmemlist(prom_phys_avail);
138
139 /* Link all the lists into the top-level descriptor. */
140 prom_memlist.p1275_totphys=&prom_ptot_ptr;
141 prom_memlist.p1275_prommap=&prom_ptak_ptr;
142 prom_memlist.p1275_available=&prom_pavl_ptr;
143}
144
145/* This returns a pointer to our libraries internal p1275 format
146 * memory descriptor.
147 */
148struct linux_mem_p1275 *
149prom_meminfo(void)
150{
151 return &prom_memlist;
152}
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 5b5af95721ab..e1ffad224605 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -28,8 +28,6 @@ SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header))
28ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \ 28ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \
29 $(SYMLINK_HEADERS) $(ARCH_DIR)/include/uml-config.h 29 $(SYMLINK_HEADERS) $(ARCH_DIR)/include/uml-config.h
30 30
31GEN_HEADERS += $(ARCH_DIR)/include/task.h $(ARCH_DIR)/include/kern_constants.h
32
33um-modes-$(CONFIG_MODE_TT) += tt 31um-modes-$(CONFIG_MODE_TT) += tt
34um-modes-$(CONFIG_MODE_SKAS) += skas 32um-modes-$(CONFIG_MODE_SKAS) += skas
35 33
@@ -45,9 +43,7 @@ endif
45 43
46ARCH_INCLUDE := -I$(ARCH_DIR)/include 44ARCH_INCLUDE := -I$(ARCH_DIR)/include
47ifneq ($(KBUILD_SRC),) 45ifneq ($(KBUILD_SRC),)
48ARCH_INCLUDE += -I$(ARCH_DIR)/include2
49ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include 46ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include
50MRPROPER_DIRS += $(ARCH_DIR)/include2
51endif 47endif
52SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH) 48SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
53 49
@@ -87,10 +83,6 @@ CONFIG_KERNEL_HALF_GIGS ?= 0
87 83
88SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000) 84SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)
89 85
90ifeq ($(CONFIG_MODE_SKAS), y)
91$(SYS_HEADERS) : $(ARCH_DIR)/include/skas_ptregs.h
92endif
93
94.PHONY: linux 86.PHONY: linux
95 87
96all: linux 88all: linux
@@ -111,7 +103,8 @@ else
111$(shell cd $(ARCH_DIR) && ln -sf Kconfig.$(SUBARCH) Kconfig.arch) 103$(shell cd $(ARCH_DIR) && ln -sf Kconfig.$(SUBARCH) Kconfig.arch)
112endif 104endif
113 105
114archprepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) 106archprepare: $(ARCH_SYMLINKS) $(ARCH_DIR)/include/user_constants.h
107prepare: $(ARCH_DIR)/include/kern_constants.h
115 108
116LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static 109LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
117LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib 110LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
@@ -146,22 +139,20 @@ endef
146#When cleaning we don't include .config, so we don't include 139#When cleaning we don't include .config, so we don't include
147#TT or skas makefiles and don't clean skas_ptregs.h. 140#TT or skas makefiles and don't clean skas_ptregs.h.
148CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ 141CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
149 $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h \ 142 $(ARCH_DIR)/include/user_constants.h \
150 $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/Kconfig.arch 143 $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch
151 144
152MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \ 145MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
153 $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os 146 $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os
154 147
155archclean: 148archclean:
156 $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/util
157 $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/os-$(OS)/util
158 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ 149 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
159 -o -name '*.gcov' \) -type f -print | xargs rm -f 150 -o -name '*.gcov' \) -type f -print | xargs rm -f
160 151
161$(SYMLINK_HEADERS): 152$(SYMLINK_HEADERS):
162 @echo ' SYMLINK $@' 153 @echo ' SYMLINK $@'
163ifneq ($(KBUILD_SRC),) 154ifneq ($(KBUILD_SRC),)
164 ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@ 155 $(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@
165else 156else
166 $(Q)cd $(TOPDIR)/$(dir $@) ; \ 157 $(Q)cd $(TOPDIR)/$(dir $@) ; \
167 ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@) 158 ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@)
@@ -180,9 +171,7 @@ $(ARCH_DIR)/include/sysdep:
180 @echo ' SYMLINK $@' 171 @echo ' SYMLINK $@'
181ifneq ($(KBUILD_SRC),) 172ifneq ($(KBUILD_SRC),)
182 $(Q)mkdir -p $(ARCH_DIR)/include 173 $(Q)mkdir -p $(ARCH_DIR)/include
183 $(Q)mkdir -p $(ARCH_DIR)/include2 174 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep
184 $(Q)ln -fsn sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep
185 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include2/sysdep
186else 175else
187 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep 176 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep
188endif 177endif
@@ -202,8 +191,6 @@ endef
202 191
203define filechk_gen-asm-offsets 192define filechk_gen-asm-offsets
204 (set -e; \ 193 (set -e; \
205 echo "#ifndef __ASM_OFFSETS_H__"; \
206 echo "#define __ASM_OFFSETS_H__"; \
207 echo "/*"; \ 194 echo "/*"; \
208 echo " * DO NOT MODIFY."; \ 195 echo " * DO NOT MODIFY."; \
209 echo " *"; \ 196 echo " *"; \
@@ -212,8 +199,7 @@ define filechk_gen-asm-offsets
212 echo " */"; \ 199 echo " */"; \
213 echo ""; \ 200 echo ""; \
214 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \ 201 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
215 echo ""; \ 202 echo ""; )
216 echo "#endif" )
217endef 203endef
218 204
219$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h 205$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
@@ -222,50 +208,18 @@ $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
222$(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c 208$(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c
223 $(CC) $(USER_CFLAGS) -S -o $@ $< 209 $(CC) $(USER_CFLAGS) -S -o $@ $<
224 210
225$(ARCH_DIR)/user-offsets.h: $(ARCH_DIR)/user-offsets.s 211$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s
226 $(call filechk,gen-asm-offsets) 212 $(call filechk,gen-asm-offsets)
227 213
228CLEAN_FILES += $(ARCH_DIR)/user-offsets.s $(ARCH_DIR)/user-offsets.h 214CLEAN_FILES += $(ARCH_DIR)/user-offsets.s
229 215
230$(ARCH_DIR)/kernel-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/kernel-offsets.c \ 216$(ARCH_DIR)/kernel-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/kernel-offsets.c \
231 $(ARCH_SYMLINKS) \ 217 archprepare
232 $(SYS_DIR)/sc.h \
233 include/asm include/linux/version.h \
234 include/config/MARKER \
235 $(ARCH_DIR)/include/user_constants.h
236 $(CC) $(CFLAGS) $(NOSTDINC_FLAGS) $(CPPFLAGS) -S -o $@ $< 218 $(CC) $(CFLAGS) $(NOSTDINC_FLAGS) $(CPPFLAGS) -S -o $@ $<
237 219
238$(ARCH_DIR)/kernel-offsets.h: $(ARCH_DIR)/kernel-offsets.s 220$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/kernel-offsets.s
239 $(call filechk,gen-asm-offsets) 221 $(call filechk,gen-asm-offsets)
240 222
241CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s $(ARCH_DIR)/kernel-offsets.h 223CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s
242
243$(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task
244 $(call filechk,gen_header)
245
246$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/os-$(OS)/util/mk_user_constants
247 $(call filechk,gen_header)
248
249$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants
250 $(call filechk,gen_header)
251
252$(ARCH_DIR)/include/skas_ptregs.h: $(ARCH_DIR)/kernel/skas/util/mk_ptregs
253 $(call filechk,gen_header)
254
255$(ARCH_DIR)/os-$(OS)/util/mk_user_constants: $(ARCH_DIR)/os-$(OS)/util FORCE ;
256
257$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants: $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/util \
258 FORCE ;
259
260$(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ;
261
262$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h $(ARCH_DIR)/kernel-offsets.h FORCE
263 $(Q)$(MAKE) $(build)=$@
264
265$(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
266 $(Q)$(MAKE) $(build)=$@
267
268$(ARCH_DIR)/os-$(OS)/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
269 $(Q)$(MAKE) $(build)=$@
270 224
271export SUBARCH USER_CFLAGS OS 225export SUBARCH USER_CFLAGS OS
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 1ab431a53ac3..2ee8a2858117 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -32,25 +32,3 @@ CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH)
32ifneq ($(CONFIG_GPROF),y) 32ifneq ($(CONFIG_GPROF),y)
33ARCH_CFLAGS += -DUM_FASTCALL 33ARCH_CFLAGS += -DUM_FASTCALL
34endif 34endif
35
36SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util
37SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
38
39prepare: $(SYS_HEADERS)
40
41$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc
42 $(call filechk,gen_header)
43
44$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
45 $(call filechk,gen_header)
46
47$(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
48 $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
49
50$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_DIR)/kernel-offsets.h FORCE
51 $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
52
53$(SYS_UTIL_DIR): scripts_basic include/asm FORCE
54 $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR)
55
56CLEAN_FILES += $(SYS_HEADERS)
diff --git a/arch/um/Makefile-skas b/arch/um/Makefile-skas
index fd18ec572271..ac35de5316a6 100644
--- a/arch/um/Makefile-skas
+++ b/arch/um/Makefile-skas
@@ -10,5 +10,3 @@ CFLAGS-$(CONFIG_GCOV) += $(GCOV_OPT)
10CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT) 10CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT)
11LINK-$(CONFIG_GCOV) += $(GCOV_OPT) 11LINK-$(CONFIG_GCOV) += $(GCOV_OPT)
12LINK-$(CONFIG_GPROF) += $(GPROF_OPT) 12LINK-$(CONFIG_GPROF) += $(GPROF_OPT)
13
14GEN_HEADERS += $(ARCH_DIR)/include/skas_ptregs.h
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index 436abbba409b..4f118d5cc2ee 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -12,24 +12,3 @@ CHECKFLAGS += -m64
12 12
13ELF_ARCH := i386:x86-64 13ELF_ARCH := i386:x86-64
14ELF_FORMAT := elf64-x86-64 14ELF_FORMAT := elf64-x86-64
15
16SYS_UTIL_DIR := $(ARCH_DIR)/sys-x86_64/util
17SYS_DIR := $(ARCH_DIR)/include/sysdep-x86_64
18
19SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
20
21prepare: $(SYS_HEADERS)
22
23$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc
24 $(call filechk,gen_header)
25
26$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
27 $(call filechk,gen_header)
28
29$(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
30 $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
31
32$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(GEN_HEADERS) $(ARCH_DIR)/kernel-offsets.h FORCE
33 $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
34
35CLEAN_FILES += $(SYS_HEADERS)
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h
index 4fcf3a8d13f4..dc36b222100b 100644
--- a/arch/um/drivers/cow.h
+++ b/arch/um/drivers/cow.h
@@ -3,15 +3,40 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6#if defined(__BIG_ENDIAN) 6#if defined(__KERNEL__)
7# define ntohll(x) (x) 7
8# define htonll(x) (x) 8# include <asm/byteorder.h>
9#elif defined(__LITTLE_ENDIAN) 9
10# define ntohll(x) bswap_64(x) 10# if defined(__BIG_ENDIAN)
11# define htonll(x) bswap_64(x) 11# define ntohll(x) (x)
12# define htonll(x) (x)
13# elif defined(__LITTLE_ENDIAN)
14# define ntohll(x) be64_to_cpu(x)
15# define htonll(x) cpu_to_be64(x)
16# else
17# error "Could not determine byte order"
18# endif
19
12#else 20#else
13#error "__BYTE_ORDER not defined" 21/* For the definition of ntohl, htonl and __BYTE_ORDER */
22#include <endian.h>
23#include <netinet/in.h>
24#if defined(__BYTE_ORDER)
25
26# if __BYTE_ORDER == __BIG_ENDIAN
27# define ntohll(x) (x)
28# define htonll(x) (x)
29# elif __BYTE_ORDER == __LITTLE_ENDIAN
30# define ntohll(x) bswap_64(x)
31# define htonll(x) bswap_64(x)
32# else
33# error "Could not determine byte order: __BYTE_ORDER uncorrectly defined"
34# endif
35
36#else /* ! defined(__BYTE_ORDER) */
37# error "Could not determine byte order: __BYTE_ORDER not defined"
14#endif 38#endif
39#endif /* ! defined(__KERNEL__) */
15 40
16extern int init_cow_file(int fd, char *cow_file, char *backing_file, 41extern int init_cow_file(int fd, char *cow_file, char *backing_file,
17 int sectorsize, int alignment, int *bitmap_offset_out, 42 int sectorsize, int alignment, int *bitmap_offset_out,
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
index a8ce6fc3ef26..fbe2217db5dd 100644
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -9,7 +9,6 @@
9#include <sys/time.h> 9#include <sys/time.h>
10#include <sys/param.h> 10#include <sys/param.h>
11#include <sys/user.h> 11#include <sys/user.h>
12#include <netinet/in.h>
13 12
14#include "os.h" 13#include "os.h"
15 14
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c
index 04383f98f4d5..310c1f823f26 100644
--- a/arch/um/drivers/mconsole_user.c
+++ b/arch/um/drivers/mconsole_user.c
@@ -23,7 +23,7 @@ static struct mconsole_command commands[] = {
23 { "reboot", mconsole_reboot, MCONSOLE_PROC }, 23 { "reboot", mconsole_reboot, MCONSOLE_PROC },
24 { "config", mconsole_config, MCONSOLE_PROC }, 24 { "config", mconsole_config, MCONSOLE_PROC },
25 { "remove", mconsole_remove, MCONSOLE_PROC }, 25 { "remove", mconsole_remove, MCONSOLE_PROC },
26 { "sysrq", mconsole_sysrq, MCONSOLE_PROC }, 26 { "sysrq", mconsole_sysrq, MCONSOLE_INTR },
27 { "help", mconsole_help, MCONSOLE_INTR }, 27 { "help", mconsole_help, MCONSOLE_INTR },
28 { "cad", mconsole_cad, MCONSOLE_INTR }, 28 { "cad", mconsole_cad, MCONSOLE_INTR },
29 { "stop", mconsole_stop, MCONSOLE_PROC }, 29 { "stop", mconsole_stop, MCONSOLE_PROC },
diff --git a/arch/um/drivers/port_kern.c b/arch/um/drivers/port_kern.c
index c41efd207fcc..189839e4f1d4 100644
--- a/arch/um/drivers/port_kern.c
+++ b/arch/um/drivers/port_kern.c
@@ -7,7 +7,6 @@
7#include "linux/sched.h" 7#include "linux/sched.h"
8#include "linux/slab.h" 8#include "linux/slab.h"
9#include "linux/interrupt.h" 9#include "linux/interrupt.h"
10#include "linux/irq.h"
11#include "linux/spinlock.h" 10#include "linux/spinlock.h"
12#include "linux/errno.h" 11#include "linux/errno.h"
13#include "asm/atomic.h" 12#include "asm/atomic.h"
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h
index 782ac3a3baf9..356390d1f8b9 100644
--- a/arch/um/include/common-offsets.h
+++ b/arch/um/include/common-offsets.h
@@ -1,7 +1,7 @@
1/* for use by sys-$SUBARCH/kernel-offsets.c */ 1/* for use by sys-$SUBARCH/kernel-offsets.c */
2 2
3OFFSET(TASK_REGS, task_struct, thread.regs); 3OFFSET(HOST_TASK_REGS, task_struct, thread.regs);
4OFFSET(TASK_PID, task_struct, pid); 4OFFSET(HOST_TASK_PID, task_struct, pid);
5DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); 5DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE);
6DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); 6DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
7DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); 7DEFINE_STR(UM_KERN_EMERG, KERN_EMERG);
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 583329d0a539..6f766e1faecc 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -157,6 +157,10 @@ extern int os_lock_file(int fd, int excl);
157extern void os_early_checks(void); 157extern void os_early_checks(void);
158extern int can_do_skas(void); 158extern int can_do_skas(void);
159 159
160/* Make sure they are clear when running in TT mode. Required by
161 * SEGV_MAYBE_FIXABLE */
162#define clear_can_do_skas() do { ptrace_faultinfo = proc_mm = 0; } while (0)
163
160/* mem.c */ 164/* mem.c */
161extern int create_mem_file(unsigned long len); 165extern int create_mem_file(unsigned long len);
162 166
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h
index 0a35e6d0baa0..4892e5fcef07 100644
--- a/arch/um/include/registers.h
+++ b/arch/um/include/registers.h
@@ -15,16 +15,6 @@ extern void save_registers(int pid, union uml_pt_regs *regs);
15extern void restore_registers(int pid, union uml_pt_regs *regs); 15extern void restore_registers(int pid, union uml_pt_regs *regs);
16extern void init_registers(int pid); 16extern void init_registers(int pid);
17extern void get_safe_registers(unsigned long * regs); 17extern void get_safe_registers(unsigned long * regs);
18extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer);
18 19
19#endif 20#endif
20
21/*
22 * Overrides for Emacs so that we follow Linus's tabbing style.
23 * Emacs will notice this stuff at the end of the file and automatically
24 * adjust the settings for this buffer only. This must remain at the end
25 * of the file.
26 * ---------------------------------------------------------------------------
27 * Local variables:
28 * c-file-style: "linux"
29 * End:
30 */
diff --git a/arch/um/include/skas_ptregs.h b/arch/um/include/skas_ptregs.h
new file mode 100644
index 000000000000..73db19e9c077
--- /dev/null
+++ b/arch/um/include/skas_ptregs.h
@@ -0,0 +1,6 @@
1#ifndef __SKAS_PT_REGS_
2#define __SKAS_PT_REGS_
3
4#include <user_constants.h>
5
6#endif
diff --git a/arch/um/include/sysdep-i386/sc.h b/arch/um/include/sysdep-i386/sc.h
new file mode 100644
index 000000000000..c57d1780ad37
--- /dev/null
+++ b/arch/um/include/sysdep-i386/sc.h
@@ -0,0 +1,44 @@
1#ifndef __SYSDEP_I386_SC_H
2#define __SYSDEP_I386_SC_H
3
4#include <user_constants.h>
5
6#define SC_OFFSET(sc, field) \
7 *((unsigned long *) &(((char *) (sc))[HOST_##field]))
8#define SC_FP_OFFSET(sc, field) \
9 *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field]))
10#define SC_FP_OFFSET_PTR(sc, field, type) \
11 ((type *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field]))
12
13#define SC_IP(sc) SC_OFFSET(sc, SC_IP)
14#define SC_SP(sc) SC_OFFSET(sc, SC_SP)
15#define SC_FS(sc) SC_OFFSET(sc, SC_FS)
16#define SC_GS(sc) SC_OFFSET(sc, SC_GS)
17#define SC_DS(sc) SC_OFFSET(sc, SC_DS)
18#define SC_ES(sc) SC_OFFSET(sc, SC_ES)
19#define SC_SS(sc) SC_OFFSET(sc, SC_SS)
20#define SC_CS(sc) SC_OFFSET(sc, SC_CS)
21#define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS)
22#define SC_EAX(sc) SC_OFFSET(sc, SC_EAX)
23#define SC_EBX(sc) SC_OFFSET(sc, SC_EBX)
24#define SC_ECX(sc) SC_OFFSET(sc, SC_ECX)
25#define SC_EDX(sc) SC_OFFSET(sc, SC_EDX)
26#define SC_EDI(sc) SC_OFFSET(sc, SC_EDI)
27#define SC_ESI(sc) SC_OFFSET(sc, SC_ESI)
28#define SC_EBP(sc) SC_OFFSET(sc, SC_EBP)
29#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO)
30#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR)
31#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2)
32#define SC_FPSTATE(sc) SC_OFFSET(sc, SC_FPSTATE)
33#define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK)
34#define SC_FP_CW(sc) SC_FP_OFFSET(sc, SC_FP_CW)
35#define SC_FP_SW(sc) SC_FP_OFFSET(sc, SC_FP_SW)
36#define SC_FP_TAG(sc) SC_FP_OFFSET(sc, SC_FP_TAG)
37#define SC_FP_IPOFF(sc) SC_FP_OFFSET(sc, SC_FP_IPOFF)
38#define SC_FP_CSSEL(sc) SC_FP_OFFSET(sc, SC_FP_CSSEL)
39#define SC_FP_DATAOFF(sc) SC_FP_OFFSET(sc, SC_FP_DATAOFF)
40#define SC_FP_DATASEL(sc) SC_FP_OFFSET(sc, SC_FP_DATASEL)
41#define SC_FP_ST(sc) SC_FP_OFFSET_PTR(sc, SC_FP_ST, struct _fpstate)
42#define SC_FXSR_ENV(sc) SC_FP_OFFSET_PTR(sc, SC_FXSR_ENV, void)
43
44#endif
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h
index 1fe729265167..23fd2644d7ed 100644
--- a/arch/um/include/sysdep-i386/sigcontext.h
+++ b/arch/um/include/sysdep-i386/sigcontext.h
@@ -6,6 +6,7 @@
6#ifndef __SYS_SIGCONTEXT_I386_H 6#ifndef __SYS_SIGCONTEXT_I386_H
7#define __SYS_SIGCONTEXT_I386_H 7#define __SYS_SIGCONTEXT_I386_H
8 8
9#include "uml-config.h"
9#include <sysdep/sc.h> 10#include <sysdep/sc.h>
10 11
11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2) 12#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
@@ -26,7 +27,14 @@
26#define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0) 27#define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0)
27 28
28/* This is Page Fault */ 29/* This is Page Fault */
29#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) 30#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
31
32/* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */
33#ifdef UML_CONFIG_MODE_SKAS
34#define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo)
35#else
36#define SEGV_MAYBE_FIXABLE(fi) 0
37#endif
30 38
31extern unsigned long *sc_sigmask(void *sc_ptr); 39extern unsigned long *sc_sigmask(void *sc_ptr);
32extern int sc_get_fpregs(unsigned long buf, void *sc_ptr); 40extern int sc_get_fpregs(unsigned long buf, void *sc_ptr);
diff --git a/arch/um/include/sysdep-i386/thread.h b/arch/um/include/sysdep-i386/thread.h
new file mode 100644
index 000000000000..e2bd6bae8b8a
--- /dev/null
+++ b/arch/um/include/sysdep-i386/thread.h
@@ -0,0 +1,11 @@
1#ifndef __UM_THREAD_H
2#define __UM_THREAD_H
3
4#include <kern_constants.h>
5
6#define TASK_DEBUGREGS(task) ((unsigned long *) &(((char *) (task))[HOST_TASK_DEBUGREGS]))
7#ifdef CONFIG_MODE_TT
8#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID]))
9#endif
10
11#endif
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h
index 331aa2d1f3f5..8f0656766c21 100644
--- a/arch/um/include/sysdep-x86_64/ptrace.h
+++ b/arch/um/include/sysdep-x86_64/ptrace.h
@@ -218,10 +218,6 @@ struct syscall_args {
218 case RBP: UPT_RBP(regs) = __upt_val; break; \ 218 case RBP: UPT_RBP(regs) = __upt_val; break; \
219 case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \ 219 case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \
220 case CS: UPT_CS(regs) = __upt_val; break; \ 220 case CS: UPT_CS(regs) = __upt_val; break; \
221 case DS: UPT_DS(regs) = __upt_val; break; \
222 case ES: UPT_ES(regs) = __upt_val; break; \
223 case FS: UPT_FS(regs) = __upt_val; break; \
224 case GS: UPT_GS(regs) = __upt_val; break; \
225 case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \ 221 case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \
226 default : \ 222 default : \
227 panic("Bad register in UPT_SET : %d\n", reg); \ 223 panic("Bad register in UPT_SET : %d\n", reg); \
diff --git a/arch/um/include/sysdep-x86_64/sc.h b/arch/um/include/sysdep-x86_64/sc.h
new file mode 100644
index 000000000000..a160d9fcc596
--- /dev/null
+++ b/arch/um/include/sysdep-x86_64/sc.h
@@ -0,0 +1,45 @@
1#ifndef __SYSDEP_X86_64_SC_H
2#define __SYSDEP_X86_64_SC_H
3
4/* Copyright (C) 2003 - 2004 PathScale, Inc
5 * Released under the GPL
6 */
7
8#include <user_constants.h>
9
10#define SC_OFFSET(sc, field) \
11 *((unsigned long *) &(((char *) (sc))[HOST_##field]))
12
13#define SC_RBX(sc) SC_OFFSET(sc, SC_RBX)
14#define SC_RCX(sc) SC_OFFSET(sc, SC_RCX)
15#define SC_RDX(sc) SC_OFFSET(sc, SC_RDX)
16#define SC_RSI(sc) SC_OFFSET(sc, SC_RSI)
17#define SC_RDI(sc) SC_OFFSET(sc, SC_RDI)
18#define SC_RBP(sc) SC_OFFSET(sc, SC_RBP)
19#define SC_RAX(sc) SC_OFFSET(sc, SC_RAX)
20#define SC_R8(sc) SC_OFFSET(sc, SC_R8)
21#define SC_R9(sc) SC_OFFSET(sc, SC_R9)
22#define SC_R10(sc) SC_OFFSET(sc, SC_R10)
23#define SC_R11(sc) SC_OFFSET(sc, SC_R11)
24#define SC_R12(sc) SC_OFFSET(sc, SC_R12)
25#define SC_R13(sc) SC_OFFSET(sc, SC_R13)
26#define SC_R14(sc) SC_OFFSET(sc, SC_R14)
27#define SC_R15(sc) SC_OFFSET(sc, SC_R15)
28#define SC_IP(sc) SC_OFFSET(sc, SC_IP)
29#define SC_SP(sc) SC_OFFSET(sc, SC_SP)
30#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2)
31#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR)
32#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO)
33#define SC_CS(sc) SC_OFFSET(sc, SC_CS)
34#define SC_FS(sc) SC_OFFSET(sc, SC_FS)
35#define SC_GS(sc) SC_OFFSET(sc, SC_GS)
36#define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS)
37#define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK)
38#if 0
39#define SC_ORIG_RAX(sc) SC_OFFSET(sc, SC_ORIG_RAX)
40#define SC_DS(sc) SC_OFFSET(sc, SC_DS)
41#define SC_ES(sc) SC_OFFSET(sc, SC_ES)
42#define SC_SS(sc) SC_OFFSET(sc, SC_SS)
43#endif
44
45#endif
diff --git a/arch/um/include/sysdep-x86_64/sigcontext.h b/arch/um/include/sysdep-x86_64/sigcontext.h
index 2a78260d15a0..41073235e7ad 100644
--- a/arch/um/include/sysdep-x86_64/sigcontext.h
+++ b/arch/um/include/sysdep-x86_64/sigcontext.h
@@ -31,7 +31,10 @@
31#define SC_START_SYSCALL(sc) do SC_RAX(sc) = -ENOSYS; while(0) 31#define SC_START_SYSCALL(sc) do SC_RAX(sc) = -ENOSYS; while(0)
32 32
33/* This is Page Fault */ 33/* This is Page Fault */
34#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) 34#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
35
36/* No broken SKAS API, which doesn't pass trap_no, here. */
37#define SEGV_MAYBE_FIXABLE(fi) 0
35 38
36extern unsigned long *sc_sigmask(void *sc_ptr); 39extern unsigned long *sc_sigmask(void *sc_ptr);
37 40
diff --git a/arch/um/include/sysdep-x86_64/thread.h b/arch/um/include/sysdep-x86_64/thread.h
new file mode 100644
index 000000000000..6a76a7f3683f
--- /dev/null
+++ b/arch/um/include/sysdep-x86_64/thread.h
@@ -0,0 +1,10 @@
1#ifndef __UM_THREAD_H
2#define __UM_THREAD_H
3
4#include <kern_constants.h>
5
6#ifdef CONFIG_MODE_TT
7#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID]))
8#endif
9
10#endif
diff --git a/arch/um/include/task.h b/arch/um/include/task.h
new file mode 100644
index 000000000000..6375ba7203c9
--- /dev/null
+++ b/arch/um/include/task.h
@@ -0,0 +1,9 @@
1#ifndef __TASK_H
2#define __TASK_H
3
4#include <kern_constants.h>
5
6#define TASK_REGS(task) ((union uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS]))
7#define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID]))
8
9#endif
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index dcd814971995..bbf94bf2921e 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -9,7 +9,6 @@
9#include "linux/kernel.h" 9#include "linux/kernel.h"
10#include "linux/module.h" 10#include "linux/module.h"
11#include "linux/smp.h" 11#include "linux/smp.h"
12#include "linux/irq.h"
13#include "linux/kernel_stat.h" 12#include "linux/kernel_stat.h"
14#include "linux/interrupt.h" 13#include "linux/interrupt.h"
15#include "linux/random.h" 14#include "linux/random.h"
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile
index db36c7c95940..8de471b59c1c 100644
--- a/arch/um/kernel/skas/Makefile
+++ b/arch/um/kernel/skas/Makefile
@@ -6,8 +6,6 @@
6obj-y := clone.o exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ 6obj-y := clone.o exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \
7 syscall.o tlb.o trap_user.o uaccess.o 7 syscall.o tlb.o trap_user.o uaccess.o
8 8
9subdir- := util
10
11USER_OBJS := process.o clone.o 9USER_OBJS := process.o clone.o
12 10
13include arch/um/scripts/Makefile.rules 11include arch/um/scripts/Makefile.rules
diff --git a/arch/um/kernel/skas/util/Makefile b/arch/um/kernel/skas/util/Makefile
deleted file mode 100644
index f7b7eba83340..000000000000
--- a/arch/um/kernel/skas/util/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1hostprogs-y := mk_ptregs
2always := $(hostprogs-y)
3
4mk_ptregs-objs := mk_ptregs-$(SUBARCH).o
5HOSTCFLAGS_mk_ptregs-$(SUBARCH).o := -I$(objtree)/arch/um
diff --git a/arch/um/kernel/skas/util/mk_ptregs-i386.c b/arch/um/kernel/skas/util/mk_ptregs-i386.c
deleted file mode 100644
index 1f96e1eeb8a7..000000000000
--- a/arch/um/kernel/skas/util/mk_ptregs-i386.c
+++ /dev/null
@@ -1,49 +0,0 @@
1#include <stdio.h>
2#include <user-offsets.h>
3
4#define SHOW(name) printf("#define %s %d\n", #name, name)
5
6int main(int argc, char **argv)
7{
8 printf("/* Automatically generated by "
9 "arch/um/kernel/skas/util/mk_ptregs */\n");
10 printf("\n");
11 printf("#ifndef __SKAS_PT_REGS_\n");
12 printf("#define __SKAS_PT_REGS_\n");
13 printf("\n");
14 SHOW(HOST_FRAME_SIZE);
15 SHOW(HOST_FP_SIZE);
16 SHOW(HOST_XFP_SIZE);
17
18 SHOW(HOST_IP);
19 SHOW(HOST_SP);
20 SHOW(HOST_EFLAGS);
21 SHOW(HOST_EAX);
22 SHOW(HOST_EBX);
23 SHOW(HOST_ECX);
24 SHOW(HOST_EDX);
25 SHOW(HOST_ESI);
26 SHOW(HOST_EDI);
27 SHOW(HOST_EBP);
28 SHOW(HOST_CS);
29 SHOW(HOST_SS);
30 SHOW(HOST_DS);
31 SHOW(HOST_FS);
32 SHOW(HOST_ES);
33 SHOW(HOST_GS);
34
35 printf("\n");
36 printf("#endif\n");
37 return(0);
38}
39
40/*
41 * Overrides for Emacs so that we follow Linus's tabbing style.
42 * Emacs will notice this stuff at the end of the file and automatically
43 * adjust the settings for this buffer only. This must remain at the end
44 * of the file.
45 * ---------------------------------------------------------------------------
46 * Local variables:
47 * c-file-style: "linux"
48 * End:
49 */
diff --git a/arch/um/kernel/skas/util/mk_ptregs-x86_64.c b/arch/um/kernel/skas/util/mk_ptregs-x86_64.c
deleted file mode 100644
index 5fccbfe35f78..000000000000
--- a/arch/um/kernel/skas/util/mk_ptregs-x86_64.c
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#include <stdio.h>
8#include <user-offsets.h>
9
10#define SHOW(name) \
11 printf("#define %s (%d / sizeof(unsigned long))\n", #name, name)
12
13int main(int argc, char **argv)
14{
15 printf("/* Automatically generated by "
16 "arch/um/kernel/skas/util/mk_ptregs */\n");
17 printf("\n");
18 printf("#ifndef __SKAS_PT_REGS_\n");
19 printf("#define __SKAS_PT_REGS_\n");
20 SHOW(HOST_FRAME_SIZE);
21 SHOW(HOST_RBX);
22 SHOW(HOST_RCX);
23 SHOW(HOST_RDI);
24 SHOW(HOST_RSI);
25 SHOW(HOST_RDX);
26 SHOW(HOST_RBP);
27 SHOW(HOST_RAX);
28 SHOW(HOST_R8);
29 SHOW(HOST_R9);
30 SHOW(HOST_R10);
31 SHOW(HOST_R11);
32 SHOW(HOST_R12);
33 SHOW(HOST_R13);
34 SHOW(HOST_R14);
35 SHOW(HOST_R15);
36 SHOW(HOST_ORIG_RAX);
37 SHOW(HOST_CS);
38 SHOW(HOST_SS);
39 SHOW(HOST_EFLAGS);
40#if 0
41 SHOW(HOST_FS);
42 SHOW(HOST_GS);
43 SHOW(HOST_DS);
44 SHOW(HOST_ES);
45#endif
46
47 SHOW(HOST_IP);
48 SHOW(HOST_SP);
49 printf("#define HOST_FP_SIZE 0\n");
50 printf("#define HOST_XFP_SIZE 0\n");
51 printf("\n");
52 printf("\n");
53 printf("#endif\n");
54 return(0);
55}
56
57/*
58 * Overrides for Emacs so that we follow Linus's tabbing style.
59 * Emacs will notice this stuff at the end of the file and automatically
60 * adjust the settings for this buffer only. This must remain at the end
61 * of the file.
62 * ---------------------------------------------------------------------------
63 * Local variables:
64 * c-file-style: "linux"
65 * End:
66 */
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index f80850091e79..b331e970002f 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -62,13 +62,7 @@ void show_stack(struct task_struct *task, unsigned long *esp)
62 62
63 if (esp == NULL) { 63 if (esp == NULL) {
64 if (task != current && task != NULL) { 64 if (task != current && task != NULL) {
65 /* XXX: Isn't this bogus? I.e. isn't this the
66 * *userspace* stack of this task? If not so, use this
67 * even when task == current (as in i386).
68 */
69 esp = (unsigned long *) KSTK_ESP(task); 65 esp = (unsigned long *) KSTK_ESP(task);
70 /* Which one? No actual difference - just coding style.*/
71 //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs);
72 } else { 66 } else {
73 esp = (unsigned long *) &esp; 67 esp = (unsigned long *) &esp;
74 } 68 }
@@ -84,5 +78,5 @@ void show_stack(struct task_struct *task, unsigned long *esp)
84 } 78 }
85 79
86 printk("Call Trace: \n"); 80 printk("Call Trace: \n");
87 show_trace(current, esp); 81 show_trace(task, esp);
88} 82}
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c
index d297429ac360..95c8f8733baf 100644
--- a/arch/um/kernel/trap_kern.c
+++ b/arch/um/kernel/trap_kern.c
@@ -26,6 +26,9 @@
26#include "mconsole_kern.h" 26#include "mconsole_kern.h"
27#include "mem.h" 27#include "mem.h"
28#include "mem_kern.h" 28#include "mem_kern.h"
29#ifdef CONFIG_MODE_SKAS
30#include "skas.h"
31#endif
29 32
30/* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ 33/* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */
31int handle_page_fault(unsigned long address, unsigned long ip, 34int handle_page_fault(unsigned long address, unsigned long ip,
@@ -134,7 +137,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc)
134 else if(current->mm == NULL) 137 else if(current->mm == NULL)
135 panic("Segfault with no mm"); 138 panic("Segfault with no mm");
136 139
137 if (SEGV_IS_FIXABLE(&fi)) 140 if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi))
138 err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); 141 err = handle_page_fault(address, ip, is_write, is_user, &si.si_code);
139 else { 142 else {
140 err = -EFAULT; 143 err = -EFAULT;
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index f0a275947d34..93dc782dc1cc 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -334,6 +334,8 @@ int linux_main(int argc, char **argv)
334 add_arg(DEFAULT_COMMAND_LINE); 334 add_arg(DEFAULT_COMMAND_LINE);
335 335
336 os_early_checks(); 336 os_early_checks();
337 if (force_tt)
338 clear_can_do_skas();
337 mode_tt = force_tt ? 1 : !can_do_skas(); 339 mode_tt = force_tt ? 1 : !can_do_skas();
338#ifndef CONFIG_MODE_TT 340#ifndef CONFIG_MODE_TT
339 if (mode_tt) { 341 if (mode_tt) {
diff --git a/arch/um/os-Linux/elf_aux.c b/arch/um/os-Linux/elf_aux.c
index ab33cb3c74ec..5a99dd3fbed0 100644
--- a/arch/um/os-Linux/elf_aux.c
+++ b/arch/um/os-Linux/elf_aux.c
@@ -12,7 +12,7 @@
12#include "init.h" 12#include "init.h"
13#include "elf_user.h" 13#include "elf_user.h"
14#include "mem_user.h" 14#include "mem_user.h"
15#include <kernel-offsets.h> 15#include <kern_constants.h>
16 16
17/* Use the one from the kernel - the host may miss it, if having old headers. */ 17/* Use the one from the kernel - the host may miss it, if having old headers. */
18#if UM_ELF_CLASS == UM_ELFCLASS32 18#if UM_ELF_CLASS == UM_ELFCLASS32
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 6af83171ca4e..b99ab414542f 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -143,11 +143,22 @@ static int __init skas0_cmd_param(char *str, int* add)
143 return 0; 143 return 0;
144} 144}
145 145
146/* The two __uml_setup would conflict, without this stupid alias. */
147
148static int __init mode_skas0_cmd_param(char *str, int* add)
149 __attribute__((alias("skas0_cmd_param")));
150
146__uml_setup("skas0", skas0_cmd_param, 151__uml_setup("skas0", skas0_cmd_param,
147 "skas0\n" 152 "skas0\n"
148 " Disables SKAS3 usage, so that SKAS0 is used, unless \n" 153 " Disables SKAS3 usage, so that SKAS0 is used, unless \n"
149 " you specify mode=tt.\n\n"); 154 " you specify mode=tt.\n\n");
150 155
156__uml_setup("mode=skas0", mode_skas0_cmd_param,
157 "mode=skas0\n"
158 " Disables SKAS3 usage, so that SKAS0 is used, unless you \n"
159 " specify mode=tt. Note that this was recently added - on \n"
160 " older kernels you must use simply \"skas0\".\n\n");
161
151static int force_sysemu_disabled = 0; 162static int force_sysemu_disabled = 0;
152 163
153static int __init nosysemu_cmd_param(char *str, int* add) 164static int __init nosysemu_cmd_param(char *str, int* add)
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index 3125d320722c..aee4812333c6 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -5,6 +5,7 @@
5 5
6#include <errno.h> 6#include <errno.h>
7#include <string.h> 7#include <string.h>
8#include <setjmp.h>
8#include "sysdep/ptrace_user.h" 9#include "sysdep/ptrace_user.h"
9#include "sysdep/ptrace.h" 10#include "sysdep/ptrace.h"
10#include "uml-config.h" 11#include "uml-config.h"
@@ -126,13 +127,11 @@ void get_safe_registers(unsigned long *regs)
126 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
127} 128}
128 129
129/* 130void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
130 * Overrides for Emacs so that we follow Linus's tabbing style. 131{
131 * Emacs will notice this stuff at the end of the file and automatically 132 struct __jmp_buf_tag *jmpbuf = buffer;
132 * adjust the settings for this buffer only. This must remain at the end 133
133 * of the file. 134 UPT_SET(uml_regs, EIP, jmpbuf->__jmpbuf[JB_PC]);
134 * --------------------------------------------------------------------------- 135 UPT_SET(uml_regs, UESP, jmpbuf->__jmpbuf[JB_SP]);
135 * Local variables: 136 UPT_SET(uml_regs, EBP, jmpbuf->__jmpbuf[JB_BP]);
136 * c-file-style: "linux" 137}
137 * End:
138 */
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index 44438d15c3d6..4b638dfb52b0 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -5,6 +5,7 @@
5 5
6#include <errno.h> 6#include <errno.h>
7#include <string.h> 7#include <string.h>
8#include <setjmp.h>
8#include "ptrace_user.h" 9#include "ptrace_user.h"
9#include "uml-config.h" 10#include "uml-config.h"
10#include "skas_ptregs.h" 11#include "skas_ptregs.h"
@@ -74,13 +75,11 @@ void get_safe_registers(unsigned long *regs)
74 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
75} 76}
76 77
77/* 78void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
78 * Overrides for Emacs so that we follow Linus's tabbing style. 79{
79 * Emacs will notice this stuff at the end of the file and automatically 80 struct __jmp_buf_tag *jmpbuf = buffer;
80 * adjust the settings for this buffer only. This must remain at the end 81
81 * of the file. 82 UPT_SET(uml_regs, RIP, jmpbuf->__jmpbuf[JB_PC]);
82 * --------------------------------------------------------------------------- 83 UPT_SET(uml_regs, RSP, jmpbuf->__jmpbuf[JB_RSP]);
83 * Local variables: 84 UPT_SET(uml_regs, RBP, jmpbuf->__jmpbuf[JB_RBP]);
84 * c-file-style: "linux" 85}
85 * End:
86 */
diff --git a/arch/um/os-Linux/util/Makefile b/arch/um/os-Linux/util/Makefile
deleted file mode 100644
index 9778aed0c314..000000000000
--- a/arch/um/os-Linux/util/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
1hostprogs-y := mk_user_constants
2always := $(hostprogs-y)
3
4HOSTCFLAGS_mk_user_constants.o := -I$(objtree)/arch/um
diff --git a/arch/um/os-Linux/util/mk_user_constants.c b/arch/um/os-Linux/util/mk_user_constants.c
deleted file mode 100644
index 4838f30eecf0..000000000000
--- a/arch/um/os-Linux/util/mk_user_constants.c
+++ /dev/null
@@ -1,23 +0,0 @@
1#include <stdio.h>
2#include <user-offsets.h>
3
4int main(int argc, char **argv)
5{
6 printf("/*\n");
7 printf(" * Generated by mk_user_constants\n");
8 printf(" */\n");
9 printf("\n");
10 printf("#ifndef __UM_USER_CONSTANTS_H\n");
11 printf("#define __UM_USER_CONSTANTS_H\n");
12 printf("\n");
13 /* I'd like to use FRAME_SIZE from ptrace.h here, but that's wrong on
14 * x86_64 (216 vs 168 bytes). user_regs_struct is the correct size on
15 * both x86_64 and i386.
16 */
17 printf("#define UM_FRAME_SIZE %d\n", __UM_FRAME_SIZE);
18
19 printf("\n");
20 printf("#endif\n");
21
22 return(0);
23}
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index 59a1291f477e..651d9d88b656 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -7,8 +7,8 @@ USER_SINGLE_OBJS := \
7USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS)) 7USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS))
8USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) 8USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
9 9
10$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \ 10$(USER_OBJS) $(USER_OBJS:.o=.i) $(USER_OBJS:.o=.s) $(USER_OBJS:.o=.lst): \
11 $(CFLAGS_$(notdir $@)) 11 c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@))
12$(USER_OBJS): cmd_checksrc = 12$(USER_OBJS): cmd_checksrc =
13$(USER_OBJS): quiet_cmd_checksrc = 13$(USER_OBJS): quiet_cmd_checksrc =
14$(USER_OBJS): cmd_force_checksrc = 14$(USER_OBJS): cmd_force_checksrc =
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 4ca2a229da49..6dfeb70f6957 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -18,6 +18,4 @@ module.c-dir = kernel
18 18
19$(obj)/stub_segv.o : _c_flags = $(call unprofile,$(CFLAGS)) 19$(obj)/stub_segv.o : _c_flags = $(call unprofile,$(CFLAGS))
20 20
21subdir- := util
22
23include arch/um/scripts/Makefile.unmap 21include arch/um/scripts/Makefile.unmap
diff --git a/arch/um/sys-i386/kernel-offsets.c b/arch/um/sys-i386/kernel-offsets.c
index a1070af2bcd8..35db85057506 100644
--- a/arch/um/sys-i386/kernel-offsets.c
+++ b/arch/um/sys-i386/kernel-offsets.c
@@ -18,9 +18,9 @@
18 18
19void foo(void) 19void foo(void)
20{ 20{
21 OFFSET(TASK_DEBUGREGS, task_struct, thread.arch.debugregs); 21 OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs);
22#ifdef CONFIG_MODE_TT 22#ifdef CONFIG_MODE_TT
23 OFFSET(TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); 23 OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid);
24#endif 24#endif
25#include <common-offsets.h> 25#include <common-offsets.h>
26} 26}
diff --git a/arch/um/sys-i386/sysrq.c b/arch/um/sys-i386/sysrq.c
index e3706d15c4f5..d5244f070539 100644
--- a/arch/um/sys-i386/sysrq.c
+++ b/arch/um/sys-i386/sysrq.c
@@ -88,9 +88,7 @@ void show_trace(struct task_struct* task, unsigned long * stack)
88 task = current; 88 task = current;
89 89
90 if (task != current) { 90 if (task != current) {
91 //ebp = (unsigned long) KSTK_EBP(task); 91 ebp = (unsigned long) KSTK_EBP(task);
92 /* Which one? No actual difference - just coding style.*/
93 ebp = (unsigned long) PT_REGS_EBP(&task->thread.regs);
94 } else { 92 } else {
95 asm ("movl %%ebp, %0" : "=r" (ebp) : ); 93 asm ("movl %%ebp, %0" : "=r" (ebp) : );
96 } 94 }
@@ -99,15 +97,6 @@ void show_trace(struct task_struct* task, unsigned long * stack)
99 ((unsigned long)stack & (~(THREAD_SIZE - 1))); 97 ((unsigned long)stack & (~(THREAD_SIZE - 1)));
100 print_context_stack(context, stack, ebp); 98 print_context_stack(context, stack, ebp);
101 99
102 /*while (((long) stack & (THREAD_SIZE-1)) != 0) {
103 addr = *stack;
104 if (__kernel_text_address(addr)) {
105 printk("%08lx: [<%08lx>]", (unsigned long) stack, addr);
106 print_symbol(" %s", addr);
107 printk("\n");
108 }
109 stack++;
110 }*/
111 printk("\n"); 100 printk("\n");
112} 101}
113 102
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 3ceaabceb3d7..26b68675053d 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -7,47 +7,48 @@
7#define DEFINE(sym, val) \ 7#define DEFINE(sym, val) \
8 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 8 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
9 9
10#define DEFINE_LONGS(sym, val) \
11 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
12
10#define OFFSET(sym, str, mem) \ 13#define OFFSET(sym, str, mem) \
11 DEFINE(sym, offsetof(struct str, mem)); 14 DEFINE(sym, offsetof(struct str, mem));
12 15
13void foo(void) 16void foo(void)
14{ 17{
15 OFFSET(SC_IP, sigcontext, eip); 18 OFFSET(HOST_SC_IP, sigcontext, eip);
16 OFFSET(SC_SP, sigcontext, esp); 19 OFFSET(HOST_SC_SP, sigcontext, esp);
17 OFFSET(SC_FS, sigcontext, fs); 20 OFFSET(HOST_SC_FS, sigcontext, fs);
18 OFFSET(SC_GS, sigcontext, gs); 21 OFFSET(HOST_SC_GS, sigcontext, gs);
19 OFFSET(SC_DS, sigcontext, ds); 22 OFFSET(HOST_SC_DS, sigcontext, ds);
20 OFFSET(SC_ES, sigcontext, es); 23 OFFSET(HOST_SC_ES, sigcontext, es);
21 OFFSET(SC_SS, sigcontext, ss); 24 OFFSET(HOST_SC_SS, sigcontext, ss);
22 OFFSET(SC_CS, sigcontext, cs); 25 OFFSET(HOST_SC_CS, sigcontext, cs);
23 OFFSET(SC_EFLAGS, sigcontext, eflags); 26 OFFSET(HOST_SC_EFLAGS, sigcontext, eflags);
24 OFFSET(SC_EAX, sigcontext, eax); 27 OFFSET(HOST_SC_EAX, sigcontext, eax);
25 OFFSET(SC_EBX, sigcontext, ebx); 28 OFFSET(HOST_SC_EBX, sigcontext, ebx);
26 OFFSET(SC_ECX, sigcontext, ecx); 29 OFFSET(HOST_SC_ECX, sigcontext, ecx);
27 OFFSET(SC_EDX, sigcontext, edx); 30 OFFSET(HOST_SC_EDX, sigcontext, edx);
28 OFFSET(SC_EDI, sigcontext, edi); 31 OFFSET(HOST_SC_EDI, sigcontext, edi);
29 OFFSET(SC_ESI, sigcontext, esi); 32 OFFSET(HOST_SC_ESI, sigcontext, esi);
30 OFFSET(SC_EBP, sigcontext, ebp); 33 OFFSET(HOST_SC_EBP, sigcontext, ebp);
31 OFFSET(SC_TRAPNO, sigcontext, trapno); 34 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
32 OFFSET(SC_ERR, sigcontext, err); 35 OFFSET(HOST_SC_ERR, sigcontext, err);
33 OFFSET(SC_CR2, sigcontext, cr2); 36 OFFSET(HOST_SC_CR2, sigcontext, cr2);
34 OFFSET(SC_FPSTATE, sigcontext, fpstate); 37 OFFSET(HOST_SC_FPSTATE, sigcontext, fpstate);
35 OFFSET(SC_SIGMASK, sigcontext, oldmask); 38 OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask);
36 OFFSET(SC_FP_CW, _fpstate, cw); 39 OFFSET(HOST_SC_FP_CW, _fpstate, cw);
37 OFFSET(SC_FP_SW, _fpstate, sw); 40 OFFSET(HOST_SC_FP_SW, _fpstate, sw);
38 OFFSET(SC_FP_TAG, _fpstate, tag); 41 OFFSET(HOST_SC_FP_TAG, _fpstate, tag);
39 OFFSET(SC_FP_IPOFF, _fpstate, ipoff); 42 OFFSET(HOST_SC_FP_IPOFF, _fpstate, ipoff);
40 OFFSET(SC_FP_CSSEL, _fpstate, cssel); 43 OFFSET(HOST_SC_FP_CSSEL, _fpstate, cssel);
41 OFFSET(SC_FP_DATAOFF, _fpstate, dataoff); 44 OFFSET(HOST_SC_FP_DATAOFF, _fpstate, dataoff);
42 OFFSET(SC_FP_DATASEL, _fpstate, datasel); 45 OFFSET(HOST_SC_FP_DATASEL, _fpstate, datasel);
43 OFFSET(SC_FP_ST, _fpstate, _st); 46 OFFSET(HOST_SC_FP_ST, _fpstate, _st);
44 OFFSET(SC_FXSR_ENV, _fpstate, _fxsr_env); 47 OFFSET(HOST_SC_FXSR_ENV, _fpstate, _fxsr_env);
45 48
46 DEFINE(HOST_FRAME_SIZE, FRAME_SIZE); 49 DEFINE(HOST_FRAME_SIZE, FRAME_SIZE);
47 DEFINE(HOST_FP_SIZE, 50 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_i387_struct));
48 sizeof(struct user_i387_struct) / sizeof(unsigned long)); 51 DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fxsr_struct));
49 DEFINE(HOST_XFP_SIZE,
50 sizeof(struct user_fxsr_struct) / sizeof(unsigned long));
51 52
52 DEFINE(HOST_IP, EIP); 53 DEFINE(HOST_IP, EIP);
53 DEFINE(HOST_SP, UESP); 54 DEFINE(HOST_SP, UESP);
@@ -65,5 +66,5 @@ void foo(void)
65 DEFINE(HOST_FS, FS); 66 DEFINE(HOST_FS, FS);
66 DEFINE(HOST_ES, ES); 67 DEFINE(HOST_ES, ES);
67 DEFINE(HOST_GS, GS); 68 DEFINE(HOST_GS, GS);
68 DEFINE(__UM_FRAME_SIZE, sizeof(struct user_regs_struct)); 69 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
69} 70}
diff --git a/arch/um/sys-i386/util/Makefile b/arch/um/sys-i386/util/Makefile
deleted file mode 100644
index bf61afd0b045..000000000000
--- a/arch/um/sys-i386/util/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1hostprogs-y := mk_sc mk_thread
2always := $(hostprogs-y)
3
4HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um
5HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um
diff --git a/arch/um/sys-i386/util/mk_sc.c b/arch/um/sys-i386/util/mk_sc.c
deleted file mode 100644
index 04c0d73433aa..000000000000
--- a/arch/um/sys-i386/util/mk_sc.c
+++ /dev/null
@@ -1,51 +0,0 @@
1#include <stdio.h>
2#include <user-offsets.h>
3
4#define SC_OFFSET(name, field) \
5 printf("#define " #name "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\
6 name)
7
8#define SC_FP_OFFSET(name, field) \
9 printf("#define " #name \
10 "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\
11 name)
12
13#define SC_FP_OFFSET_PTR(name, field, type) \
14 printf("#define " #name \
15 "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\
16 name)
17
18int main(int argc, char **argv)
19{
20 SC_OFFSET(SC_IP, eip);
21 SC_OFFSET(SC_SP, esp);
22 SC_OFFSET(SC_FS, fs);
23 SC_OFFSET(SC_GS, gs);
24 SC_OFFSET(SC_DS, ds);
25 SC_OFFSET(SC_ES, es);
26 SC_OFFSET(SC_SS, ss);
27 SC_OFFSET(SC_CS, cs);
28 SC_OFFSET(SC_EFLAGS, eflags);
29 SC_OFFSET(SC_EAX, eax);
30 SC_OFFSET(SC_EBX, ebx);
31 SC_OFFSET(SC_ECX, ecx);
32 SC_OFFSET(SC_EDX, edx);
33 SC_OFFSET(SC_EDI, edi);
34 SC_OFFSET(SC_ESI, esi);
35 SC_OFFSET(SC_EBP, ebp);
36 SC_OFFSET(SC_TRAPNO, trapno);
37 SC_OFFSET(SC_ERR, err);
38 SC_OFFSET(SC_CR2, cr2);
39 SC_OFFSET(SC_FPSTATE, fpstate);
40 SC_OFFSET(SC_SIGMASK, oldmask);
41 SC_FP_OFFSET(SC_FP_CW, cw);
42 SC_FP_OFFSET(SC_FP_SW, sw);
43 SC_FP_OFFSET(SC_FP_TAG, tag);
44 SC_FP_OFFSET(SC_FP_IPOFF, ipoff);
45 SC_FP_OFFSET(SC_FP_CSSEL, cssel);
46 SC_FP_OFFSET(SC_FP_DATAOFF, dataoff);
47 SC_FP_OFFSET(SC_FP_DATASEL, datasel);
48 SC_FP_OFFSET_PTR(SC_FP_ST, _st, "struct _fpstate");
49 SC_FP_OFFSET_PTR(SC_FXSR_ENV, _fxsr_env, "void");
50 return(0);
51}
diff --git a/arch/um/sys-i386/util/mk_thread.c b/arch/um/sys-i386/util/mk_thread.c
deleted file mode 100644
index 7470d0dda67e..000000000000
--- a/arch/um/sys-i386/util/mk_thread.c
+++ /dev/null
@@ -1,22 +0,0 @@
1#include <stdio.h>
2#include <kernel-offsets.h>
3
4int main(int argc, char **argv)
5{
6 printf("/*\n");
7 printf(" * Generated by mk_thread\n");
8 printf(" */\n");
9 printf("\n");
10 printf("#ifndef __UM_THREAD_H\n");
11 printf("#define __UM_THREAD_H\n");
12 printf("\n");
13 printf("#define TASK_DEBUGREGS(task) ((unsigned long *) "
14 "&(((char *) (task))[%d]))\n", TASK_DEBUGREGS);
15#ifdef TASK_EXTERN_PID
16 printf("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n",
17 TASK_EXTERN_PID);
18#endif
19 printf("\n");
20 printf("#endif\n");
21 return(0);
22}
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index f0ab574d1e95..06c3633457a2 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -29,6 +29,4 @@ module.c-dir = kernel
29 29
30$(obj)/stub_segv.o: _c_flags = $(call unprofile,$(CFLAGS)) 30$(obj)/stub_segv.o: _c_flags = $(call unprofile,$(CFLAGS))
31 31
32subdir- := util
33
34include arch/um/scripts/Makefile.unmap 32include arch/um/scripts/Makefile.unmap
diff --git a/arch/um/sys-x86_64/kernel-offsets.c b/arch/um/sys-x86_64/kernel-offsets.c
index 998541eade41..bfcb104b846e 100644
--- a/arch/um/sys-x86_64/kernel-offsets.c
+++ b/arch/um/sys-x86_64/kernel-offsets.c
@@ -19,7 +19,7 @@
19void foo(void) 19void foo(void)
20{ 20{
21#ifdef CONFIG_MODE_TT 21#ifdef CONFIG_MODE_TT
22 OFFSET(TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); 22 OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid);
23#endif 23#endif
24#include <common-offsets.h> 24#include <common-offsets.h>
25} 25}
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c
index 65a131b362b6..d1e53bdf2e85 100644
--- a/arch/um/sys-x86_64/stub_segv.c
+++ b/arch/um/sys-x86_64/stub_segv.c
@@ -10,6 +10,22 @@
10#include "uml-config.h" 10#include "uml-config.h"
11#include "sysdep/sigcontext.h" 11#include "sysdep/sigcontext.h"
12#include "sysdep/faultinfo.h" 12#include "sysdep/faultinfo.h"
13#include <stddef.h>
14
15/* Copied from sys-x86_64/signal.c - Can't find an equivalent definition
16 * in the libc headers anywhere.
17 */
18struct rt_sigframe
19{
20 char *pretcode;
21 struct ucontext uc;
22 struct siginfo info;
23};
24
25/* Copied here from <linux/kernel.h> - we're userspace. */
26#define container_of(ptr, type, member) ({ \
27 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
28 (type *)( (char *)__mptr - offsetof(type,member) );})
13 29
14void __attribute__ ((__section__ (".__syscall_stub"))) 30void __attribute__ ((__section__ (".__syscall_stub")))
15stub_segv_handler(int sig) 31stub_segv_handler(int sig)
@@ -17,16 +33,19 @@ stub_segv_handler(int sig)
17 struct ucontext *uc; 33 struct ucontext *uc;
18 34
19 __asm__("movq %%rdx, %0" : "=g" (uc) :); 35 __asm__("movq %%rdx, %0" : "=g" (uc) :);
20 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), 36 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
21 &uc->uc_mcontext); 37 &uc->uc_mcontext);
22 38
23 __asm__("movq %0, %%rax ; syscall": : "g" (__NR_getpid)); 39 __asm__("movq %0, %%rax ; syscall": : "g" (__NR_getpid));
24 __asm__("movq %%rax, %%rdi ; movq %0, %%rax ; movq %1, %%rsi ;" 40 __asm__("movq %%rax, %%rdi ; movq %0, %%rax ; movq %1, %%rsi ;"
25 "syscall": : "g" (__NR_kill), "g" (SIGUSR1)); 41 "syscall": : "g" (__NR_kill), "g" (SIGUSR1) :
26 /* Two popqs to restore the stack to the state just before entering 42 "%rdi", "%rax", "%rsi");
27 * the handler, one pops the return address, the other pops the frame 43 /* sys_sigreturn expects that the stack pointer will be 8 bytes into
28 * pointer. 44 * the signal frame. So, we use the ucontext pointer, which we know
45 * already, to get the signal frame pointer, and add 8 to that.
29 */ 46 */
30 __asm__("popq %%rax ; popq %%rax ; movq %0, %%rax ; syscall" : : "g" 47 __asm__("movq %0, %%rsp": :
31 (__NR_rt_sigreturn)); 48 "g" ((unsigned long) container_of(uc, struct rt_sigframe,
49 uc) + 8));
50 __asm__("movq %0, %%rax ; syscall" : : "g" (__NR_rt_sigreturn));
32} 51}
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 513d17ceafd4..5a585bfbb8c2 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -16,71 +16,76 @@ typedef __u32 u32;
16#define DEFINE(sym, val) \ 16#define DEFINE(sym, val) \
17 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 17 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
18 18
19#define DEFINE_LONGS(sym, val) \
20 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
21
19#define OFFSET(sym, str, mem) \ 22#define OFFSET(sym, str, mem) \
20 DEFINE(sym, offsetof(struct str, mem)); 23 DEFINE(sym, offsetof(struct str, mem));
21 24
22void foo(void) 25void foo(void)
23{ 26{
24 OFFSET(SC_RBX, sigcontext, rbx); 27 OFFSET(HOST_SC_RBX, sigcontext, rbx);
25 OFFSET(SC_RCX, sigcontext, rcx); 28 OFFSET(HOST_SC_RCX, sigcontext, rcx);
26 OFFSET(SC_RDX, sigcontext, rdx); 29 OFFSET(HOST_SC_RDX, sigcontext, rdx);
27 OFFSET(SC_RSI, sigcontext, rsi); 30 OFFSET(HOST_SC_RSI, sigcontext, rsi);
28 OFFSET(SC_RDI, sigcontext, rdi); 31 OFFSET(HOST_SC_RDI, sigcontext, rdi);
29 OFFSET(SC_RBP, sigcontext, rbp); 32 OFFSET(HOST_SC_RBP, sigcontext, rbp);
30 OFFSET(SC_RAX, sigcontext, rax); 33 OFFSET(HOST_SC_RAX, sigcontext, rax);
31 OFFSET(SC_R8, sigcontext, r8); 34 OFFSET(HOST_SC_R8, sigcontext, r8);
32 OFFSET(SC_R9, sigcontext, r9); 35 OFFSET(HOST_SC_R9, sigcontext, r9);
33 OFFSET(SC_R10, sigcontext, r10); 36 OFFSET(HOST_SC_R10, sigcontext, r10);
34 OFFSET(SC_R11, sigcontext, r11); 37 OFFSET(HOST_SC_R11, sigcontext, r11);
35 OFFSET(SC_R12, sigcontext, r12); 38 OFFSET(HOST_SC_R12, sigcontext, r12);
36 OFFSET(SC_R13, sigcontext, r13); 39 OFFSET(HOST_SC_R13, sigcontext, r13);
37 OFFSET(SC_R14, sigcontext, r14); 40 OFFSET(HOST_SC_R14, sigcontext, r14);
38 OFFSET(SC_R15, sigcontext, r15); 41 OFFSET(HOST_SC_R15, sigcontext, r15);
39 OFFSET(SC_IP, sigcontext, rip); 42 OFFSET(HOST_SC_IP, sigcontext, rip);
40 OFFSET(SC_SP, sigcontext, rsp); 43 OFFSET(HOST_SC_SP, sigcontext, rsp);
41 OFFSET(SC_CR2, sigcontext, cr2); 44 OFFSET(HOST_SC_CR2, sigcontext, cr2);
42 OFFSET(SC_ERR, sigcontext, err); 45 OFFSET(HOST_SC_ERR, sigcontext, err);
43 OFFSET(SC_TRAPNO, sigcontext, trapno); 46 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
44 OFFSET(SC_CS, sigcontext, cs); 47 OFFSET(HOST_SC_CS, sigcontext, cs);
45 OFFSET(SC_FS, sigcontext, fs); 48 OFFSET(HOST_SC_FS, sigcontext, fs);
46 OFFSET(SC_GS, sigcontext, gs); 49 OFFSET(HOST_SC_GS, sigcontext, gs);
47 OFFSET(SC_EFLAGS, sigcontext, eflags); 50 OFFSET(HOST_SC_EFLAGS, sigcontext, eflags);
48 OFFSET(SC_SIGMASK, sigcontext, oldmask); 51 OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask);
49#if 0 52#if 0
50 OFFSET(SC_ORIG_RAX, sigcontext, orig_rax); 53 OFFSET(HOST_SC_ORIG_RAX, sigcontext, orig_rax);
51 OFFSET(SC_DS, sigcontext, ds); 54 OFFSET(HOST_SC_DS, sigcontext, ds);
52 OFFSET(SC_ES, sigcontext, es); 55 OFFSET(HOST_SC_ES, sigcontext, es);
53 OFFSET(SC_SS, sigcontext, ss); 56 OFFSET(HOST_SC_SS, sigcontext, ss);
54#endif 57#endif
55 58
56 DEFINE(HOST_FRAME_SIZE, FRAME_SIZE); 59 DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE);
57 DEFINE(HOST_RBX, RBX); 60 DEFINE(HOST_FP_SIZE, 0);
58 DEFINE(HOST_RCX, RCX); 61 DEFINE(HOST_XFP_SIZE, 0);
59 DEFINE(HOST_RDI, RDI); 62 DEFINE_LONGS(HOST_RBX, RBX);
60 DEFINE(HOST_RSI, RSI); 63 DEFINE_LONGS(HOST_RCX, RCX);
61 DEFINE(HOST_RDX, RDX); 64 DEFINE_LONGS(HOST_RDI, RDI);
62 DEFINE(HOST_RBP, RBP); 65 DEFINE_LONGS(HOST_RSI, RSI);
63 DEFINE(HOST_RAX, RAX); 66 DEFINE_LONGS(HOST_RDX, RDX);
64 DEFINE(HOST_R8, R8); 67 DEFINE_LONGS(HOST_RBP, RBP);
65 DEFINE(HOST_R9, R9); 68 DEFINE_LONGS(HOST_RAX, RAX);
66 DEFINE(HOST_R10, R10); 69 DEFINE_LONGS(HOST_R8, R8);
67 DEFINE(HOST_R11, R11); 70 DEFINE_LONGS(HOST_R9, R9);
68 DEFINE(HOST_R12, R12); 71 DEFINE_LONGS(HOST_R10, R10);
69 DEFINE(HOST_R13, R13); 72 DEFINE_LONGS(HOST_R11, R11);
70 DEFINE(HOST_R14, R14); 73 DEFINE_LONGS(HOST_R12, R12);
71 DEFINE(HOST_R15, R15); 74 DEFINE_LONGS(HOST_R13, R13);
72 DEFINE(HOST_ORIG_RAX, ORIG_RAX); 75 DEFINE_LONGS(HOST_R14, R14);
73 DEFINE(HOST_CS, CS); 76 DEFINE_LONGS(HOST_R15, R15);
74 DEFINE(HOST_SS, SS); 77 DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX);
75 DEFINE(HOST_EFLAGS, EFLAGS); 78 DEFINE_LONGS(HOST_CS, CS);
79 DEFINE_LONGS(HOST_SS, SS);
80 DEFINE_LONGS(HOST_EFLAGS, EFLAGS);
76#if 0 81#if 0
77 DEFINE(HOST_FS, FS); 82 DEFINE_LONGS(HOST_FS, FS);
78 DEFINE(HOST_GS, GS); 83 DEFINE_LONGS(HOST_GS, GS);
79 DEFINE(HOST_DS, DS); 84 DEFINE_LONGS(HOST_DS, DS);
80 DEFINE(HOST_ES, ES); 85 DEFINE_LONGS(HOST_ES, ES);
81#endif 86#endif
82 87
83 DEFINE(HOST_IP, RIP); 88 DEFINE_LONGS(HOST_IP, RIP);
84 DEFINE(HOST_SP, RSP); 89 DEFINE_LONGS(HOST_SP, RSP);
85 DEFINE(__UM_FRAME_SIZE, sizeof(struct user_regs_struct)); 90 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
86} 91}
diff --git a/arch/um/sys-x86_64/util/Makefile b/arch/um/sys-x86_64/util/Makefile
deleted file mode 100644
index 75b052cfc206..000000000000
--- a/arch/um/sys-x86_64/util/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
1# Copyright 2003 - 2004 Pathscale, Inc
2# Released under the GPL
3
4hostprogs-y := mk_sc mk_thread
5always := $(hostprogs-y)
6
7HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um
8HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um
diff --git a/arch/um/sys-x86_64/util/mk_sc.c b/arch/um/sys-x86_64/util/mk_sc.c
deleted file mode 100644
index 7619bc377c1f..000000000000
--- a/arch/um/sys-x86_64/util/mk_sc.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/* Copyright (C) 2003 - 2004 PathScale, Inc
2 * Released under the GPL
3 */
4
5#include <stdio.h>
6#include <user-offsets.h>
7
8#define SC_OFFSET(name) \
9 printf("#define " #name \
10 "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\
11 name)
12
13int main(int argc, char **argv)
14{
15 SC_OFFSET(SC_RBX);
16 SC_OFFSET(SC_RCX);
17 SC_OFFSET(SC_RDX);
18 SC_OFFSET(SC_RSI);
19 SC_OFFSET(SC_RDI);
20 SC_OFFSET(SC_RBP);
21 SC_OFFSET(SC_RAX);
22 SC_OFFSET(SC_R8);
23 SC_OFFSET(SC_R9);
24 SC_OFFSET(SC_R10);
25 SC_OFFSET(SC_R11);
26 SC_OFFSET(SC_R12);
27 SC_OFFSET(SC_R13);
28 SC_OFFSET(SC_R14);
29 SC_OFFSET(SC_R15);
30 SC_OFFSET(SC_IP);
31 SC_OFFSET(SC_SP);
32 SC_OFFSET(SC_CR2);
33 SC_OFFSET(SC_ERR);
34 SC_OFFSET(SC_TRAPNO);
35 SC_OFFSET(SC_CS);
36 SC_OFFSET(SC_FS);
37 SC_OFFSET(SC_GS);
38 SC_OFFSET(SC_EFLAGS);
39 SC_OFFSET(SC_SIGMASK);
40#if 0
41 SC_OFFSET(SC_ORIG_RAX);
42 SC_OFFSET(SC_DS);
43 SC_OFFSET(SC_ES);
44 SC_OFFSET(SC_SS);
45#endif
46 return(0);
47}
diff --git a/arch/um/sys-x86_64/util/mk_thread.c b/arch/um/sys-x86_64/util/mk_thread.c
deleted file mode 100644
index 15517396e9cf..000000000000
--- a/arch/um/sys-x86_64/util/mk_thread.c
+++ /dev/null
@@ -1,20 +0,0 @@
1#include <stdio.h>
2#include <kernel-offsets.h>
3
4int main(int argc, char **argv)
5{
6 printf("/*\n");
7 printf(" * Generated by mk_thread\n");
8 printf(" */\n");
9 printf("\n");
10 printf("#ifndef __UM_THREAD_H\n");
11 printf("#define __UM_THREAD_H\n");
12 printf("\n");
13#ifdef TASK_EXTERN_PID
14 printf("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n",
15 TASK_EXTERN_PID);
16#endif
17 printf("\n");
18 printf("#endif\n");
19 return(0);
20}
diff --git a/arch/um/util/Makefile b/arch/um/util/Makefile
deleted file mode 100644
index 4c7551c28033..000000000000
--- a/arch/um/util/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1hostprogs-y := mk_task mk_constants
2always := $(hostprogs-y)
3
4HOSTCFLAGS_mk_task.o := -I$(objtree)/arch/um
5HOSTCFLAGS_mk_constants.o := -I$(objtree)/arch/um
diff --git a/arch/um/util/mk_constants.c b/arch/um/util/mk_constants.c
deleted file mode 100644
index ab217becc36a..000000000000
--- a/arch/um/util/mk_constants.c
+++ /dev/null
@@ -1,32 +0,0 @@
1#include <stdio.h>
2#include <kernel-offsets.h>
3
4#define SHOW_INT(sym) printf("#define %s %d\n", #sym, sym)
5#define SHOW_STR(sym) printf("#define %s %s\n", #sym, sym)
6
7int main(int argc, char **argv)
8{
9 printf("/*\n");
10 printf(" * Generated by mk_constants\n");
11 printf(" */\n");
12 printf("\n");
13 printf("#ifndef __UM_CONSTANTS_H\n");
14 printf("#define __UM_CONSTANTS_H\n");
15 printf("\n");
16
17 SHOW_INT(UM_KERN_PAGE_SIZE);
18
19 SHOW_STR(UM_KERN_EMERG);
20 SHOW_STR(UM_KERN_ALERT);
21 SHOW_STR(UM_KERN_CRIT);
22 SHOW_STR(UM_KERN_ERR);
23 SHOW_STR(UM_KERN_WARNING);
24 SHOW_STR(UM_KERN_NOTICE);
25 SHOW_STR(UM_KERN_INFO);
26 SHOW_STR(UM_KERN_DEBUG);
27
28 SHOW_INT(UM_NSEC_PER_SEC);
29 printf("\n");
30 printf("#endif\n");
31 return(0);
32}
diff --git a/arch/um/util/mk_task.c b/arch/um/util/mk_task.c
deleted file mode 100644
index 36c9606505e2..000000000000
--- a/arch/um/util/mk_task.c
+++ /dev/null
@@ -1,30 +0,0 @@
1#include <stdio.h>
2#include <kernel-offsets.h>
3
4void print_ptr(char *name, char *type, int offset)
5{
6 printf("#define %s(task) ((%s *) &(((char *) (task))[%d]))\n", name, type,
7 offset);
8}
9
10void print(char *name, char *type, int offset)
11{
12 printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
13 offset);
14}
15
16int main(int argc, char **argv)
17{
18 printf("/*\n");
19 printf(" * Generated by mk_task\n");
20 printf(" */\n");
21 printf("\n");
22 printf("#ifndef __TASK_H\n");
23 printf("#define __TASK_H\n");
24 printf("\n");
25 print_ptr("TASK_REGS", "union uml_pt_regs", TASK_REGS);
26 print("TASK_PID", "int", TASK_PID);
27 printf("\n");
28 printf("#endif\n");
29 return(0);
30}
diff --git a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c
index 66e2821533db..0903cc1faef2 100644
--- a/arch/x86_64/ia32/ia32_signal.c
+++ b/arch/x86_64/ia32/ia32_signal.c
@@ -425,7 +425,11 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
425 rsp = (unsigned long) ka->sa.sa_restorer; 425 rsp = (unsigned long) ka->sa.sa_restorer;
426 } 426 }
427 427
428 return (void __user *)((rsp - frame_size) & -8UL); 428 rsp -= frame_size;
429 /* Align the stack pointer according to the i386 ABI,
430 * i.e. so that on function entry ((sp + 4) & 15) == 0. */
431 rsp = ((rsp + 4) & -16ul) - 4;
432 return (void __user *) rsp;
429} 433}
430 434
431int ia32_setup_frame(int sig, struct k_sigaction *ka, 435int ia32_setup_frame(int sig, struct k_sigaction *ka,
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 4592bf21fcaf..b92e5f45ed46 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -270,26 +270,26 @@ ENTRY(level3_kernel_pgt)
270.org 0x4000 270.org 0x4000
271ENTRY(level2_ident_pgt) 271ENTRY(level2_ident_pgt)
272 /* 40MB for bootup. */ 272 /* 40MB for bootup. */
273 .quad 0x0000000000000183 273 .quad 0x0000000000000083
274 .quad 0x0000000000200183 274 .quad 0x0000000000200083
275 .quad 0x0000000000400183 275 .quad 0x0000000000400083
276 .quad 0x0000000000600183 276 .quad 0x0000000000600083
277 .quad 0x0000000000800183 277 .quad 0x0000000000800083
278 .quad 0x0000000000A00183 278 .quad 0x0000000000A00083
279 .quad 0x0000000000C00183 279 .quad 0x0000000000C00083
280 .quad 0x0000000000E00183 280 .quad 0x0000000000E00083
281 .quad 0x0000000001000183 281 .quad 0x0000000001000083
282 .quad 0x0000000001200183 282 .quad 0x0000000001200083
283 .quad 0x0000000001400183 283 .quad 0x0000000001400083
284 .quad 0x0000000001600183 284 .quad 0x0000000001600083
285 .quad 0x0000000001800183 285 .quad 0x0000000001800083
286 .quad 0x0000000001A00183 286 .quad 0x0000000001A00083
287 .quad 0x0000000001C00183 287 .quad 0x0000000001C00083
288 .quad 0x0000000001E00183 288 .quad 0x0000000001E00083
289 .quad 0x0000000002000183 289 .quad 0x0000000002000083
290 .quad 0x0000000002200183 290 .quad 0x0000000002200083
291 .quad 0x0000000002400183 291 .quad 0x0000000002400083
292 .quad 0x0000000002600183 292 .quad 0x0000000002600083
293 /* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */ 293 /* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */
294 .globl temp_boot_pmds 294 .globl temp_boot_pmds
295temp_boot_pmds: 295temp_boot_pmds:
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c
index df08c43276a0..76a28b007be9 100644
--- a/arch/x86_64/kernel/kprobes.c
+++ b/arch/x86_64/kernel/kprobes.c
@@ -77,9 +77,9 @@ static inline int is_IF_modifier(kprobe_opcode_t *insn)
77int __kprobes arch_prepare_kprobe(struct kprobe *p) 77int __kprobes arch_prepare_kprobe(struct kprobe *p)
78{ 78{
79 /* insn: must be on special executable page on x86_64. */ 79 /* insn: must be on special executable page on x86_64. */
80 up(&kprobe_mutex);
81 p->ainsn.insn = get_insn_slot();
82 down(&kprobe_mutex); 80 down(&kprobe_mutex);
81 p->ainsn.insn = get_insn_slot();
82 up(&kprobe_mutex);
83 if (!p->ainsn.insn) { 83 if (!p->ainsn.insn) {
84 return -ENOMEM; 84 return -ENOMEM;
85 } 85 }
@@ -231,9 +231,9 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
231 231
232void __kprobes arch_remove_kprobe(struct kprobe *p) 232void __kprobes arch_remove_kprobe(struct kprobe *p)
233{ 233{
234 up(&kprobe_mutex);
235 free_insn_slot(p->ainsn.insn);
236 down(&kprobe_mutex); 234 down(&kprobe_mutex);
235 free_insn_slot(p->ainsn.insn);
236 up(&kprobe_mutex);
237} 237}
238 238
239static inline void save_previous_kprobe(void) 239static inline void save_previous_kprobe(void)
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 08203b07f4bd..69541db5ff2c 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -54,9 +54,12 @@ void mce_log(struct mce *mce)
54{ 54{
55 unsigned next, entry; 55 unsigned next, entry;
56 mce->finished = 0; 56 mce->finished = 0;
57 smp_wmb(); 57 wmb();
58 for (;;) { 58 for (;;) {
59 entry = rcu_dereference(mcelog.next); 59 entry = rcu_dereference(mcelog.next);
60 /* The rmb forces the compiler to reload next in each
61 iteration */
62 rmb();
60 for (;;) { 63 for (;;) {
61 /* When the buffer fills up discard new entries. Assume 64 /* When the buffer fills up discard new entries. Assume
62 that the earlier errors are the more interesting. */ 65 that the earlier errors are the more interesting. */
@@ -69,6 +72,7 @@ void mce_log(struct mce *mce)
69 entry++; 72 entry++;
70 continue; 73 continue;
71 } 74 }
75 break;
72 } 76 }
73 smp_rmb(); 77 smp_rmb();
74 next = entry + 1; 78 next = entry + 1;
@@ -76,9 +80,9 @@ void mce_log(struct mce *mce)
76 break; 80 break;
77 } 81 }
78 memcpy(mcelog.entry + entry, mce, sizeof(struct mce)); 82 memcpy(mcelog.entry + entry, mce, sizeof(struct mce));
79 smp_wmb(); 83 wmb();
80 mcelog.entry[entry].finished = 1; 84 mcelog.entry[entry].finished = 1;
81 smp_wmb(); 85 wmb();
82 86
83 if (!test_and_set_bit(0, &console_logged)) 87 if (!test_and_set_bit(0, &console_logged))
84 notify_user = 1; 88 notify_user = 1;
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 238f73e1a834..cb28df14ff6f 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -831,8 +831,6 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
831#endif 831#endif
832} 832}
833 833
834#define HWCR 0xc0010015
835
836static int __init init_amd(struct cpuinfo_x86 *c) 834static int __init init_amd(struct cpuinfo_x86 *c)
837{ 835{
838 int r; 836 int r;
@@ -841,14 +839,18 @@ static int __init init_amd(struct cpuinfo_x86 *c)
841#ifdef CONFIG_SMP 839#ifdef CONFIG_SMP
842 unsigned long value; 840 unsigned long value;
843 841
844 // Disable TLB flush filter by setting HWCR.FFDIS: 842 /*
845 // bit 6 of msr C001_0015 843 * Disable TLB flush filter by setting HWCR.FFDIS on K8
846 // 844 * bit 6 of msr C001_0015
847 // Errata 63 for SH-B3 steppings 845 *
848 // Errata 122 for all(?) steppings 846 * Errata 63 for SH-B3 steppings
849 rdmsrl(HWCR, value); 847 * Errata 122 for all steppings (F+ have it disabled by default)
850 value |= 1 << 6; 848 */
851 wrmsrl(HWCR, value); 849 if (c->x86 == 15) {
850 rdmsrl(MSR_K8_HWCR, value);
851 value |= 1 << 6;
852 wrmsrl(MSR_K8_HWCR, value);
853 }
852#endif 854#endif
853 855
854 /* Bit 31 in normal CPUID used for nonstandard 3DNow ID; 856 /* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
@@ -965,13 +967,12 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
965static void srat_detect_node(void) 967static void srat_detect_node(void)
966{ 968{
967#ifdef CONFIG_NUMA 969#ifdef CONFIG_NUMA
968 unsigned apicid, node; 970 unsigned node;
969 int cpu = smp_processor_id(); 971 int cpu = smp_processor_id();
970 972
971 /* Don't do the funky fallback heuristics the AMD version employs 973 /* Don't do the funky fallback heuristics the AMD version employs
972 for now. */ 974 for now. */
973 apicid = phys_proc_id[cpu]; 975 node = apicid_to_node[hard_smp_processor_id()];
974 node = apicid_to_node[apicid];
975 if (node == NUMA_NO_NODE) 976 if (node == NUMA_NO_NODE)
976 node = 0; 977 node = 0;
977 cpu_to_node[cpu] = node; 978 cpu_to_node[cpu] = node;
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index bd33be24a386..79190891fbc5 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -87,6 +87,10 @@ void __init setup_per_cpu_areas(void)
87 int i; 87 int i;
88 unsigned long size; 88 unsigned long size;
89 89
90#ifdef CONFIG_HOTPLUG_CPU
91 prefill_possible_map();
92#endif
93
90 /* Copy section for each CPU (we discard the original) */ 94 /* Copy section for each CPU (we discard the original) */
91 size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); 95 size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
92#ifdef CONFIG_MODULES 96#ifdef CONFIG_MODULES
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index e12d7baeb33e..658a81b33f3b 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -892,7 +892,7 @@ static __init void disable_smp(void)
892 * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range. 892 * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range.
893 * - Ashok Raj 893 * - Ashok Raj
894 */ 894 */
895static void prefill_possible_map(void) 895__init void prefill_possible_map(void)
896{ 896{
897 int i; 897 int i;
898 for (i = 0; i < NR_CPUS; i++) 898 for (i = 0; i < NR_CPUS; i++)
@@ -967,10 +967,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
967 current_cpu_data = boot_cpu_data; 967 current_cpu_data = boot_cpu_data;
968 current_thread_info()->cpu = 0; /* needed? */ 968 current_thread_info()->cpu = 0; /* needed? */
969 969
970#ifdef CONFIG_HOTPLUG_CPU
971 prefill_possible_map();
972#endif
973
974 if (smp_sanity_check(max_cpus) < 0) { 970 if (smp_sanity_check(max_cpus) < 0) {
975 printk(KERN_INFO "SMP disabled\n"); 971 printk(KERN_INFO "SMP disabled\n");
976 disable_smp(); 972 disable_smp();
diff --git a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c
index ebb9abf3ce6d..f066c6ab3618 100644
--- a/arch/x86_64/kernel/suspend.c
+++ b/arch/x86_64/kernel/suspend.c
@@ -11,6 +11,8 @@
11#include <linux/smp.h> 11#include <linux/smp.h>
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <asm/proto.h> 13#include <asm/proto.h>
14#include <asm/page.h>
15#include <asm/pgtable.h>
14 16
15struct saved_context saved_context; 17struct saved_context saved_context;
16 18
@@ -140,4 +142,129 @@ void fix_processor_context(void)
140 142
141} 143}
142 144
145#ifdef CONFIG_SOFTWARE_SUSPEND
146/* Defined in arch/x86_64/kernel/suspend_asm.S */
147extern int restore_image(void);
143 148
149pgd_t *temp_level4_pgt;
150
151static void **pages;
152
153static inline void *__add_page(void)
154{
155 void **c;
156
157 c = (void **)get_usable_page(GFP_ATOMIC);
158 if (c) {
159 *c = pages;
160 pages = c;
161 }
162 return c;
163}
164
165static inline void *__next_page(void)
166{
167 void **c;
168
169 c = pages;
170 if (c) {
171 pages = *c;
172 *c = NULL;
173 }
174 return c;
175}
176
177/*
178 * Try to allocate as many usable pages as needed and daisy chain them.
179 * If one allocation fails, free the pages allocated so far
180 */
181static int alloc_usable_pages(unsigned long n)
182{
183 void *p;
184
185 pages = NULL;
186 do
187 if (!__add_page())
188 break;
189 while (--n);
190 if (n) {
191 p = __next_page();
192 while (p) {
193 free_page((unsigned long)p);
194 p = __next_page();
195 }
196 return -ENOMEM;
197 }
198 return 0;
199}
200
201static void res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
202{
203 long i, j;
204
205 i = pud_index(address);
206 pud = pud + i;
207 for (; i < PTRS_PER_PUD; pud++, i++) {
208 unsigned long paddr;
209 pmd_t *pmd;
210
211 paddr = address + i*PUD_SIZE;
212 if (paddr >= end)
213 break;
214
215 pmd = (pmd_t *)__next_page();
216 set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE));
217 for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) {
218 unsigned long pe;
219
220 if (paddr >= end)
221 break;
222 pe = _PAGE_NX | _PAGE_PSE | _KERNPG_TABLE | paddr;
223 pe &= __supported_pte_mask;
224 set_pmd(pmd, __pmd(pe));
225 }
226 }
227}
228
229static void set_up_temporary_mappings(void)
230{
231 unsigned long start, end, next;
232
233 temp_level4_pgt = (pgd_t *)__next_page();
234
235 /* It is safe to reuse the original kernel mapping */
236 set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
237 init_level4_pgt[pgd_index(__START_KERNEL_map)]);
238
239 /* Set up the direct mapping from scratch */
240 start = (unsigned long)pfn_to_kaddr(0);
241 end = (unsigned long)pfn_to_kaddr(end_pfn);
242
243 for (; start < end; start = next) {
244 pud_t *pud = (pud_t *)__next_page();
245 next = start + PGDIR_SIZE;
246 if (next > end)
247 next = end;
248 res_phys_pud_init(pud, __pa(start), __pa(next));
249 set_pgd(temp_level4_pgt + pgd_index(start),
250 mk_kernel_pgd(__pa(pud)));
251 }
252}
253
254int swsusp_arch_resume(void)
255{
256 unsigned long n;
257
258 n = ((end_pfn << PAGE_SHIFT) + PUD_SIZE - 1) >> PUD_SHIFT;
259 n += (n + PTRS_PER_PUD - 1) / PTRS_PER_PUD + 1;
260 pr_debug("swsusp_arch_resume(): pages needed = %lu\n", n);
261 if (alloc_usable_pages(n)) {
262 free_eaten_memory();
263 return -ENOMEM;
264 }
265 /* We have got enough memory and from now on we cannot recover */
266 set_up_temporary_mappings();
267 restore_image();
268 return 0;
269}
270#endif /* CONFIG_SOFTWARE_SUSPEND */
diff --git a/arch/x86_64/kernel/suspend_asm.S b/arch/x86_64/kernel/suspend_asm.S
index 4d659e97df10..320b6fb00cca 100644
--- a/arch/x86_64/kernel/suspend_asm.S
+++ b/arch/x86_64/kernel/suspend_asm.S
@@ -39,12 +39,13 @@ ENTRY(swsusp_arch_suspend)
39 call swsusp_save 39 call swsusp_save
40 ret 40 ret
41 41
42ENTRY(swsusp_arch_resume) 42ENTRY(restore_image)
43 /* set up cr3 */ 43 /* switch to temporary page tables */
44 leaq init_level4_pgt(%rip),%rax 44 movq $__PAGE_OFFSET, %rdx
45 subq $__START_KERNEL_map,%rax 45 movq temp_level4_pgt(%rip), %rax
46 movq %rax,%cr3 46 subq %rdx, %rax
47 47 movq %rax, %cr3
48 /* Flush TLB */
48 movq mmu_cr4_features(%rip), %rax 49 movq mmu_cr4_features(%rip), %rax
49 movq %rax, %rdx 50 movq %rax, %rdx
50 andq $~(1<<7), %rdx # PGE 51 andq $~(1<<7), %rdx # PGE
@@ -69,6 +70,10 @@ loop:
69 movq pbe_next(%rdx), %rdx 70 movq pbe_next(%rdx), %rdx
70 jmp loop 71 jmp loop
71done: 72done:
73 /* go back to the original page tables */
74 leaq init_level4_pgt(%rip), %rax
75 subq $__START_KERNEL_map, %rax
76 movq %rax, %cr3
72 /* Flush TLB, including "global" things (vmalloc) */ 77 /* Flush TLB, including "global" things (vmalloc) */
73 movq mmu_cr4_features(%rip), %rax 78 movq mmu_cr4_features(%rip), %rax
74 movq %rax, %rdx 79 movq %rax, %rdx
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 80a49d9bd8a7..214803821001 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -167,18 +167,16 @@ void __init numa_init_array(void)
167 mapping. To avoid this fill in the mapping for all possible 167 mapping. To avoid this fill in the mapping for all possible
168 CPUs, as the number of CPUs is not known yet. 168 CPUs, as the number of CPUs is not known yet.
169 We round robin the existing nodes. */ 169 We round robin the existing nodes. */
170 rr = 0; 170 rr = first_node(node_online_map);
171 for (i = 0; i < NR_CPUS; i++) { 171 for (i = 0; i < NR_CPUS; i++) {
172 if (cpu_to_node[i] != NUMA_NO_NODE) 172 if (cpu_to_node[i] != NUMA_NO_NODE)
173 continue; 173 continue;
174 cpu_to_node[i] = rr;
174 rr = next_node(rr, node_online_map); 175 rr = next_node(rr, node_online_map);
175 if (rr == MAX_NUMNODES) 176 if (rr == MAX_NUMNODES)
176 rr = first_node(node_online_map); 177 rr = first_node(node_online_map);
177 cpu_to_node[i] = rr;
178 rr++;
179 } 178 }
180 179
181 set_bit(0, &node_to_cpumask[cpu_to_node(0)]);
182} 180}
183 181
184#ifdef CONFIG_NUMA_EMU 182#ifdef CONFIG_NUMA_EMU
@@ -266,9 +264,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
266 264
267__cpuinit void numa_add_cpu(int cpu) 265__cpuinit void numa_add_cpu(int cpu)
268{ 266{
269 /* BP is initialized elsewhere */ 267 set_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
270 if (cpu)
271 set_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
272} 268}
273 269
274unsigned long __init numa_free_all_bootmem(void) 270unsigned long __init numa_free_all_bootmem(void)
diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
index 94862e1ec032..b90e8fe9eeb0 100644
--- a/arch/x86_64/mm/pageattr.c
+++ b/arch/x86_64/mm/pageattr.c
@@ -220,8 +220,6 @@ void global_flush_tlb(void)
220 down_read(&init_mm.mmap_sem); 220 down_read(&init_mm.mmap_sem);
221 df = xchg(&df_list, NULL); 221 df = xchg(&df_list, NULL);
222 up_read(&init_mm.mmap_sem); 222 up_read(&init_mm.mmap_sem);
223 if (!df)
224 return;
225 flush_map((df && !df->next) ? df->address : 0); 223 flush_map((df && !df->next) ? df->address : 0);
226 for (; df; df = next_df) { 224 for (; df; df = next_df) {
227 next_df = df->next; 225 next_df = df->next;
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index d74a7c5e75dd..4b6bf19c39c0 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -795,7 +795,7 @@ static void drain_rx_pools (amb_dev * dev) {
795} 795}
796 796
797static inline void fill_rx_pool (amb_dev * dev, unsigned char pool, 797static inline void fill_rx_pool (amb_dev * dev, unsigned char pool,
798 unsigned int __nocast priority) 798 gfp_t priority)
799{ 799{
800 rx_in rx; 800 rx_in rx;
801 amb_rxq * rxq; 801 amb_rxq * rxq;
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 58219744f5db..7f7ec288824d 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1374,8 +1374,7 @@ static void reset_chip (struct fs_dev *dev)
1374 } 1374 }
1375} 1375}
1376 1376
1377static void __devinit *aligned_kmalloc (int size, unsigned int __nocast flags, 1377static void __devinit *aligned_kmalloc (int size, gfp_t flags, int alignment)
1378 int alignment)
1379{ 1378{
1380 void *t; 1379 void *t;
1381 1380
@@ -1466,7 +1465,7 @@ static inline int nr_buffers_in_freepool (struct fs_dev *dev, struct freepool *f
1466 working again after that... -- REW */ 1465 working again after that... -- REW */
1467 1466
1468static void top_off_fp (struct fs_dev *dev, struct freepool *fp, 1467static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
1469 unsigned int __nocast gfp_flags) 1468 gfp_t gfp_flags)
1470{ 1469{
1471 struct FS_BPENTRY *qe, *ne; 1470 struct FS_BPENTRY *qe, *ne;
1472 struct sk_buff *skb; 1471 struct sk_buff *skb;
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 2bf723a7b6e6..14f6a6201da3 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -178,14 +178,12 @@ fore200e_irq_itoa(int irq)
178 178
179 179
180static void* 180static void*
181fore200e_kmalloc(int size, int flags) 181fore200e_kmalloc(int size, gfp_t flags)
182{ 182{
183 void* chunk = kmalloc(size, flags); 183 void *chunk = kzalloc(size, flags);
184 184
185 if (chunk) 185 if (!chunk)
186 memset(chunk, 0x00, size); 186 printk(FORE200E "kmalloc() failed, requested size = %d, flags = 0x%x\n", size, flags);
187 else
188 printk(FORE200E "kmalloc() failed, requested size = %d, flags = 0x%x\n", size, flags);
189 187
190 return chunk; 188 return chunk;
191} 189}
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index 60a7ef6a201b..e2f64f91ed05 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -156,7 +156,7 @@ dma_pool_create (const char *name, struct device *dev,
156 156
157 157
158static struct dma_page * 158static struct dma_page *
159pool_alloc_page (struct dma_pool *pool, unsigned int __nocast mem_flags) 159pool_alloc_page (struct dma_pool *pool, gfp_t mem_flags)
160{ 160{
161 struct dma_page *page; 161 struct dma_page *page;
162 int mapsize; 162 int mapsize;
@@ -262,8 +262,7 @@ dma_pool_destroy (struct dma_pool *pool)
262 * If such a memory block can't be allocated, null is returned. 262 * If such a memory block can't be allocated, null is returned.
263 */ 263 */
264void * 264void *
265dma_pool_alloc (struct dma_pool *pool, unsigned int __nocast mem_flags, 265dma_pool_alloc (struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle)
266 dma_addr_t *handle)
267{ 266{
268 unsigned long flags; 267 unsigned long flags;
269 struct dma_page *page; 268 struct dma_page *page;
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 7e22a58926b8..a280e679b1ca 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -229,7 +229,7 @@ static int pkt_grow_pktlist(struct pktcdvd_device *pd, int nr_packets)
229 return 1; 229 return 1;
230} 230}
231 231
232static void *pkt_rb_alloc(unsigned int __nocast gfp_mask, void *data) 232static void *pkt_rb_alloc(gfp_t gfp_mask, void *data)
233{ 233{
234 return kmalloc(sizeof(struct pkt_rb_node), gfp_mask); 234 return kmalloc(sizeof(struct pkt_rb_node), gfp_mask);
235} 235}
@@ -2082,7 +2082,7 @@ static int pkt_close(struct inode *inode, struct file *file)
2082} 2082}
2083 2083
2084 2084
2085static void *psd_pool_alloc(unsigned int __nocast gfp_mask, void *data) 2085static void *psd_pool_alloc(gfp_t gfp_mask, void *data)
2086{ 2086{
2087 return kmalloc(sizeof(struct packet_stacked_data), gfp_mask); 2087 return kmalloc(sizeof(struct packet_stacked_data), gfp_mask);
2088} 2088}
diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
index 079ec344eb47..382dea7b224c 100644
--- a/drivers/block/scsi_ioctl.c
+++ b/drivers/block/scsi_ioctl.c
@@ -201,15 +201,15 @@ static int verify_command(struct file *file, unsigned char *cmd)
201 return 0; 201 return 0;
202 } 202 }
203 203
204 /* And root can do any command.. */
205 if (capable(CAP_SYS_RAWIO))
206 return 0;
207
204 if (!type) { 208 if (!type) {
205 cmd_type[cmd[0]] = CMD_WARNED; 209 cmd_type[cmd[0]] = CMD_WARNED;
206 printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]); 210 printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]);
207 } 211 }
208 212
209 /* And root can do any command.. */
210 if (capable(CAP_SYS_RAWIO))
211 return 0;
212
213 /* Otherwise fail it with an "Operation not permitted" */ 213 /* Otherwise fail it with an "Operation not permitted" */
214 return -EPERM; 214 return -EPERM;
215} 215}
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index a1bf8f066c88..4fa85234d8b5 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -308,7 +308,7 @@ unlock:
308} 308}
309 309
310static inline struct urb *bpa10x_alloc_urb(struct usb_device *udev, unsigned int pipe, 310static inline struct urb *bpa10x_alloc_urb(struct usb_device *udev, unsigned int pipe,
311 size_t size, unsigned int __nocast flags, void *data) 311 size_t size, gfp_t flags, void *data)
312{ 312{
313 struct urb *urb; 313 struct urb *urb;
314 struct usb_ctrlrequest *cr; 314 struct usb_ctrlrequest *cr;
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index 57c48bbf6fe6..6756cb20b753 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -132,7 +132,7 @@ static struct usb_device_id blacklist_ids[] = {
132 { } /* Terminating entry */ 132 { } /* Terminating entry */
133}; 133};
134 134
135static struct _urb *_urb_alloc(int isoc, unsigned int __nocast gfp) 135static struct _urb *_urb_alloc(int isoc, gfp_t gfp)
136{ 136{
137 struct _urb *_urb = kmalloc(sizeof(struct _urb) + 137 struct _urb *_urb = kmalloc(sizeof(struct _urb) +
138 sizeof(struct usb_iso_packet_descriptor) * isoc, gfp); 138 sizeof(struct usb_iso_packet_descriptor) * isoc, gfp);
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index 6ba48f346fcf..041bb47b5c39 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -376,7 +376,7 @@ static int __init drm_core_init(void)
376 goto err_p2; 376 goto err_p2;
377 } 377 }
378 378
379 drm_proc_root = create_proc_entry("dri", S_IFDIR, NULL); 379 drm_proc_root = proc_mkdir("dri", NULL);
380 if (!drm_proc_root) { 380 if (!drm_proc_root) {
381 DRM_ERROR("Cannot create /proc/dri\n"); 381 DRM_ERROR("Cannot create /proc/dri\n");
382 ret = -1; 382 ret = -1;
diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c
index 32d2bb99462c..977961002488 100644
--- a/drivers/char/drm/drm_proc.c
+++ b/drivers/char/drm/drm_proc.c
@@ -95,7 +95,7 @@ int drm_proc_init(drm_device_t *dev, int minor,
95 char name[64]; 95 char name[64];
96 96
97 sprintf(name, "%d", minor); 97 sprintf(name, "%d", minor);
98 *dev_root = create_proc_entry(name, S_IFDIR, root); 98 *dev_root = proc_mkdir(name, root);
99 if (!*dev_root) { 99 if (!*dev_root) {
100 DRM_ERROR("Cannot create /proc/dri/%s\n", name); 100 DRM_ERROR("Cannot create /proc/dri/%s\n", name);
101 return -1; 101 return -1;
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
index 95a976c96eb8..70458cb061c6 100644
--- a/drivers/char/drm/drm_stub.c
+++ b/drivers/char/drm/drm_stub.c
@@ -47,7 +47,7 @@ MODULE_PARM_DESC(cards_limit, "Maximum number of graphics cards");
47MODULE_PARM_DESC(debug, "Enable debug output"); 47MODULE_PARM_DESC(debug, "Enable debug output");
48 48
49module_param_named(cards_limit, drm_cards_limit, int, 0444); 49module_param_named(cards_limit, drm_cards_limit, int, 0444);
50module_param_named(debug, drm_debug, int, 0666); 50module_param_named(debug, drm_debug, int, 0600);
51 51
52drm_head_t **drm_heads; 52drm_head_t **drm_heads;
53struct drm_sysfs_class *drm_class; 53struct drm_sysfs_class *drm_class;
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
index 2291a87e8ada..97d6dc24b800 100644
--- a/drivers/char/n_r3964.c
+++ b/drivers/char/n_r3964.c
@@ -229,8 +229,8 @@ static int __init r3964_init(void)
229 TRACE_L("line discipline %d registered", N_R3964); 229 TRACE_L("line discipline %d registered", N_R3964);
230 TRACE_L("flags=%x num=%x", tty_ldisc_N_R3964.flags, 230 TRACE_L("flags=%x num=%x", tty_ldisc_N_R3964.flags,
231 tty_ldisc_N_R3964.num); 231 tty_ldisc_N_R3964.num);
232 TRACE_L("open=%x", (int)tty_ldisc_N_R3964.open); 232 TRACE_L("open=%p", tty_ldisc_N_R3964.open);
233 TRACE_L("tty_ldisc_N_R3964 = %x", (int)&tty_ldisc_N_R3964); 233 TRACE_L("tty_ldisc_N_R3964 = %p", &tty_ldisc_N_R3964);
234 } 234 }
235 else 235 else
236 { 236 {
@@ -267,8 +267,8 @@ static void add_tx_queue(struct r3964_info *pInfo, struct r3964_block_header *pH
267 267
268 spin_unlock_irqrestore(&pInfo->lock, flags); 268 spin_unlock_irqrestore(&pInfo->lock, flags);
269 269
270 TRACE_Q("add_tx_queue %x, length %d, tx_first = %x", 270 TRACE_Q("add_tx_queue %p, length %d, tx_first = %p",
271 (int)pHeader, pHeader->length, (int)pInfo->tx_first ); 271 pHeader, pHeader->length, pInfo->tx_first );
272} 272}
273 273
274static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code) 274static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
@@ -285,10 +285,10 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
285 return; 285 return;
286 286
287#ifdef DEBUG_QUEUE 287#ifdef DEBUG_QUEUE
288 printk("r3964: remove_from_tx_queue: %x, length %d - ", 288 printk("r3964: remove_from_tx_queue: %p, length %u - ",
289 (int)pHeader, (int)pHeader->length ); 289 pHeader, pHeader->length );
290 for(pDump=pHeader;pDump;pDump=pDump->next) 290 for(pDump=pHeader;pDump;pDump=pDump->next)
291 printk("%x ", (int)pDump); 291 printk("%p ", pDump);
292 printk("\n"); 292 printk("\n");
293#endif 293#endif
294 294
@@ -319,10 +319,10 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
319 spin_unlock_irqrestore(&pInfo->lock, flags); 319 spin_unlock_irqrestore(&pInfo->lock, flags);
320 320
321 kfree(pHeader); 321 kfree(pHeader);
322 TRACE_M("remove_from_tx_queue - kfree %x",(int)pHeader); 322 TRACE_M("remove_from_tx_queue - kfree %p",pHeader);
323 323
324 TRACE_Q("remove_from_tx_queue: tx_first = %x, tx_last = %x", 324 TRACE_Q("remove_from_tx_queue: tx_first = %p, tx_last = %p",
325 (int)pInfo->tx_first, (int)pInfo->tx_last ); 325 pInfo->tx_first, pInfo->tx_last );
326} 326}
327 327
328static void add_rx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader) 328static void add_rx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader)
@@ -346,9 +346,9 @@ static void add_rx_queue(struct r3964_info *pInfo, struct r3964_block_header *pH
346 346
347 spin_unlock_irqrestore(&pInfo->lock, flags); 347 spin_unlock_irqrestore(&pInfo->lock, flags);
348 348
349 TRACE_Q("add_rx_queue: %x, length = %d, rx_first = %x, count = %d", 349 TRACE_Q("add_rx_queue: %p, length = %d, rx_first = %p, count = %d",
350 (int)pHeader, pHeader->length, 350 pHeader, pHeader->length,
351 (int)pInfo->rx_first, pInfo->blocks_in_rx_queue); 351 pInfo->rx_first, pInfo->blocks_in_rx_queue);
352} 352}
353 353
354static void remove_from_rx_queue(struct r3964_info *pInfo, 354static void remove_from_rx_queue(struct r3964_info *pInfo,
@@ -360,10 +360,10 @@ static void remove_from_rx_queue(struct r3964_info *pInfo,
360 if(pHeader==NULL) 360 if(pHeader==NULL)
361 return; 361 return;
362 362
363 TRACE_Q("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d", 363 TRACE_Q("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d",
364 (int)pInfo->rx_first, (int)pInfo->rx_last, pInfo->blocks_in_rx_queue ); 364 pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue );
365 TRACE_Q("remove_from_rx_queue: %x, length %d", 365 TRACE_Q("remove_from_rx_queue: %p, length %u",
366 (int)pHeader, (int)pHeader->length ); 366 pHeader, pHeader->length );
367 367
368 spin_lock_irqsave(&pInfo->lock, flags); 368 spin_lock_irqsave(&pInfo->lock, flags);
369 369
@@ -401,10 +401,10 @@ static void remove_from_rx_queue(struct r3964_info *pInfo,
401 spin_unlock_irqrestore(&pInfo->lock, flags); 401 spin_unlock_irqrestore(&pInfo->lock, flags);
402 402
403 kfree(pHeader); 403 kfree(pHeader);
404 TRACE_M("remove_from_rx_queue - kfree %x",(int)pHeader); 404 TRACE_M("remove_from_rx_queue - kfree %p",pHeader);
405 405
406 TRACE_Q("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d", 406 TRACE_Q("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d",
407 (int)pInfo->rx_first, (int)pInfo->rx_last, pInfo->blocks_in_rx_queue ); 407 pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue );
408} 408}
409 409
410static void put_char(struct r3964_info *pInfo, unsigned char ch) 410static void put_char(struct r3964_info *pInfo, unsigned char ch)
@@ -506,8 +506,8 @@ static void transmit_block(struct r3964_info *pInfo)
506 if(tty->driver->write_room) 506 if(tty->driver->write_room)
507 room=tty->driver->write_room(tty); 507 room=tty->driver->write_room(tty);
508 508
509 TRACE_PS("transmit_block %x, room %d, length %d", 509 TRACE_PS("transmit_block %p, room %d, length %d",
510 (int)pBlock, room, pBlock->length); 510 pBlock, room, pBlock->length);
511 511
512 while(pInfo->tx_position < pBlock->length) 512 while(pInfo->tx_position < pBlock->length)
513 { 513 {
@@ -588,7 +588,7 @@ static void on_receive_block(struct r3964_info *pInfo)
588 588
589 /* prepare struct r3964_block_header: */ 589 /* prepare struct r3964_block_header: */
590 pBlock = kmalloc(length+sizeof(struct r3964_block_header), GFP_KERNEL); 590 pBlock = kmalloc(length+sizeof(struct r3964_block_header), GFP_KERNEL);
591 TRACE_M("on_receive_block - kmalloc %x",(int)pBlock); 591 TRACE_M("on_receive_block - kmalloc %p",pBlock);
592 592
593 if(pBlock==NULL) 593 if(pBlock==NULL)
594 return; 594 return;
@@ -868,11 +868,11 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg)
868 if(pMsg) 868 if(pMsg)
869 { 869 {
870 kfree(pMsg); 870 kfree(pMsg);
871 TRACE_M("enable_signals - msg kfree %x",(int)pMsg); 871 TRACE_M("enable_signals - msg kfree %p",pMsg);
872 } 872 }
873 } 873 }
874 kfree(pClient); 874 kfree(pClient);
875 TRACE_M("enable_signals - kfree %x",(int)pClient); 875 TRACE_M("enable_signals - kfree %p",pClient);
876 return 0; 876 return 0;
877 } 877 }
878 } 878 }
@@ -890,7 +890,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg)
890 { 890 {
891 /* add client to client list */ 891 /* add client to client list */
892 pClient=kmalloc(sizeof(struct r3964_client_info), GFP_KERNEL); 892 pClient=kmalloc(sizeof(struct r3964_client_info), GFP_KERNEL);
893 TRACE_M("enable_signals - kmalloc %x",(int)pClient); 893 TRACE_M("enable_signals - kmalloc %p",pClient);
894 if(pClient==NULL) 894 if(pClient==NULL)
895 return -ENOMEM; 895 return -ENOMEM;
896 896
@@ -954,7 +954,7 @@ static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
954queue_the_message: 954queue_the_message:
955 955
956 pMsg = kmalloc(sizeof(struct r3964_message), GFP_KERNEL); 956 pMsg = kmalloc(sizeof(struct r3964_message), GFP_KERNEL);
957 TRACE_M("add_msg - kmalloc %x",(int)pMsg); 957 TRACE_M("add_msg - kmalloc %p",pMsg);
958 if(pMsg==NULL) { 958 if(pMsg==NULL) {
959 return; 959 return;
960 } 960 }
@@ -1067,11 +1067,11 @@ static int r3964_open(struct tty_struct *tty)
1067 struct r3964_info *pInfo; 1067 struct r3964_info *pInfo;
1068 1068
1069 TRACE_L("open"); 1069 TRACE_L("open");
1070 TRACE_L("tty=%x, PID=%d, disc_data=%x", 1070 TRACE_L("tty=%p, PID=%d, disc_data=%p",
1071 (int)tty, current->pid, (int)tty->disc_data); 1071 tty, current->pid, tty->disc_data);
1072 1072
1073 pInfo=kmalloc(sizeof(struct r3964_info), GFP_KERNEL); 1073 pInfo=kmalloc(sizeof(struct r3964_info), GFP_KERNEL);
1074 TRACE_M("r3964_open - info kmalloc %x",(int)pInfo); 1074 TRACE_M("r3964_open - info kmalloc %p",pInfo);
1075 1075
1076 if(!pInfo) 1076 if(!pInfo)
1077 { 1077 {
@@ -1080,26 +1080,26 @@ static int r3964_open(struct tty_struct *tty)
1080 } 1080 }
1081 1081
1082 pInfo->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL); 1082 pInfo->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL);
1083 TRACE_M("r3964_open - rx_buf kmalloc %x",(int)pInfo->rx_buf); 1083 TRACE_M("r3964_open - rx_buf kmalloc %p",pInfo->rx_buf);
1084 1084
1085 if(!pInfo->rx_buf) 1085 if(!pInfo->rx_buf)
1086 { 1086 {
1087 printk(KERN_ERR "r3964: failed to alloc receive buffer\n"); 1087 printk(KERN_ERR "r3964: failed to alloc receive buffer\n");
1088 kfree(pInfo); 1088 kfree(pInfo);
1089 TRACE_M("r3964_open - info kfree %x",(int)pInfo); 1089 TRACE_M("r3964_open - info kfree %p",pInfo);
1090 return -ENOMEM; 1090 return -ENOMEM;
1091 } 1091 }
1092 1092
1093 pInfo->tx_buf = kmalloc(TX_BUF_SIZE, GFP_KERNEL); 1093 pInfo->tx_buf = kmalloc(TX_BUF_SIZE, GFP_KERNEL);
1094 TRACE_M("r3964_open - tx_buf kmalloc %x",(int)pInfo->tx_buf); 1094 TRACE_M("r3964_open - tx_buf kmalloc %p",pInfo->tx_buf);
1095 1095
1096 if(!pInfo->tx_buf) 1096 if(!pInfo->tx_buf)
1097 { 1097 {
1098 printk(KERN_ERR "r3964: failed to alloc transmit buffer\n"); 1098 printk(KERN_ERR "r3964: failed to alloc transmit buffer\n");
1099 kfree(pInfo->rx_buf); 1099 kfree(pInfo->rx_buf);
1100 TRACE_M("r3964_open - rx_buf kfree %x",(int)pInfo->rx_buf); 1100 TRACE_M("r3964_open - rx_buf kfree %p",pInfo->rx_buf);
1101 kfree(pInfo); 1101 kfree(pInfo);
1102 TRACE_M("r3964_open - info kfree %x",(int)pInfo); 1102 TRACE_M("r3964_open - info kfree %p",pInfo);
1103 return -ENOMEM; 1103 return -ENOMEM;
1104 } 1104 }
1105 1105
@@ -1154,11 +1154,11 @@ static void r3964_close(struct tty_struct *tty)
1154 if(pMsg) 1154 if(pMsg)
1155 { 1155 {
1156 kfree(pMsg); 1156 kfree(pMsg);
1157 TRACE_M("r3964_close - msg kfree %x",(int)pMsg); 1157 TRACE_M("r3964_close - msg kfree %p",pMsg);
1158 } 1158 }
1159 } 1159 }
1160 kfree(pClient); 1160 kfree(pClient);
1161 TRACE_M("r3964_close - client kfree %x",(int)pClient); 1161 TRACE_M("r3964_close - client kfree %p",pClient);
1162 pClient=pNext; 1162 pClient=pNext;
1163 } 1163 }
1164 /* Remove jobs from tx_queue: */ 1164 /* Remove jobs from tx_queue: */
@@ -1177,11 +1177,11 @@ static void r3964_close(struct tty_struct *tty)
1177 /* Free buffers: */ 1177 /* Free buffers: */
1178 wake_up_interruptible(&pInfo->read_wait); 1178 wake_up_interruptible(&pInfo->read_wait);
1179 kfree(pInfo->rx_buf); 1179 kfree(pInfo->rx_buf);
1180 TRACE_M("r3964_close - rx_buf kfree %x",(int)pInfo->rx_buf); 1180 TRACE_M("r3964_close - rx_buf kfree %p",pInfo->rx_buf);
1181 kfree(pInfo->tx_buf); 1181 kfree(pInfo->tx_buf);
1182 TRACE_M("r3964_close - tx_buf kfree %x",(int)pInfo->tx_buf); 1182 TRACE_M("r3964_close - tx_buf kfree %p",pInfo->tx_buf);
1183 kfree(pInfo); 1183 kfree(pInfo);
1184 TRACE_M("r3964_close - info kfree %x",(int)pInfo); 1184 TRACE_M("r3964_close - info kfree %p",pInfo);
1185} 1185}
1186 1186
1187static ssize_t r3964_read(struct tty_struct *tty, struct file *file, 1187static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
@@ -1234,7 +1234,7 @@ repeat:
1234 count = sizeof(struct r3964_client_message); 1234 count = sizeof(struct r3964_client_message);
1235 1235
1236 kfree(pMsg); 1236 kfree(pMsg);
1237 TRACE_M("r3964_read - msg kfree %x",(int)pMsg); 1237 TRACE_M("r3964_read - msg kfree %p",pMsg);
1238 1238
1239 if (copy_to_user(buf,&theMsg, count)) 1239 if (copy_to_user(buf,&theMsg, count))
1240 return -EFAULT; 1240 return -EFAULT;
@@ -1279,7 +1279,7 @@ static ssize_t r3964_write(struct tty_struct * tty, struct file * file,
1279 * Allocate a buffer for the data and copy it from the buffer with header prepended 1279 * Allocate a buffer for the data and copy it from the buffer with header prepended
1280 */ 1280 */
1281 new_data = kmalloc (count+sizeof(struct r3964_block_header), GFP_KERNEL); 1281 new_data = kmalloc (count+sizeof(struct r3964_block_header), GFP_KERNEL);
1282 TRACE_M("r3964_write - kmalloc %x",(int)new_data); 1282 TRACE_M("r3964_write - kmalloc %p",new_data);
1283 if (new_data == NULL) { 1283 if (new_data == NULL) {
1284 if (pInfo->flags & R3964_DEBUG) 1284 if (pInfo->flags & R3964_DEBUG)
1285 { 1285 {
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c
index ed867db550a9..e1a90d9a8756 100644
--- a/drivers/char/s3c2410-rtc.c
+++ b/drivers/char/s3c2410-rtc.c
@@ -564,6 +564,7 @@ static int s3c2410_rtc_resume(struct device *dev, u32 level)
564 564
565static struct device_driver s3c2410_rtcdrv = { 565static struct device_driver s3c2410_rtcdrv = {
566 .name = "s3c2410-rtc", 566 .name = "s3c2410-rtc",
567 .owner = THIS_MODULE,
567 .bus = &platform_bus_type, 568 .bus = &platform_bus_type,
568 .probe = s3c2410_rtc_probe, 569 .probe = s3c2410_rtc_probe,
569 .remove = s3c2410_rtc_remove, 570 .remove = s3c2410_rtc_remove,
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c
index 1436aea3b28f..6d3ff0836c44 100644
--- a/drivers/char/watchdog/mv64x60_wdt.c
+++ b/drivers/char/watchdog/mv64x60_wdt.c
@@ -87,6 +87,8 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file)
87 mv64x60_wdt_service(); 87 mv64x60_wdt_service();
88 mv64x60_wdt_handler_enable(); 88 mv64x60_wdt_handler_enable();
89 89
90 nonseekable_open(inode, file);
91
90 return 0; 92 return 0;
91} 93}
92 94
@@ -103,12 +105,9 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file)
103 return 0; 105 return 0;
104} 106}
105 107
106static ssize_t mv64x60_wdt_write(struct file *file, const char *data, 108static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data,
107 size_t len, loff_t * ppos) 109 size_t len, loff_t * ppos)
108{ 110{
109 if (*ppos != file->f_pos)
110 return -ESPIPE;
111
112 if (len) 111 if (len)
113 mv64x60_wdt_service(); 112 mv64x60_wdt_service();
114 113
@@ -119,6 +118,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
119 unsigned int cmd, unsigned long arg) 118 unsigned int cmd, unsigned long arg)
120{ 119{
121 int timeout; 120 int timeout;
121 void __user *argp = (void __user *)arg;
122 static struct watchdog_info info = { 122 static struct watchdog_info info = {
123 .options = WDIOF_KEEPALIVEPING, 123 .options = WDIOF_KEEPALIVEPING,
124 .firmware_version = 0, 124 .firmware_version = 0,
@@ -127,13 +127,13 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
127 127
128 switch (cmd) { 128 switch (cmd) {
129 case WDIOC_GETSUPPORT: 129 case WDIOC_GETSUPPORT:
130 if (copy_to_user((void *)arg, &info, sizeof(info))) 130 if (copy_to_user(argp, &info, sizeof(info)))
131 return -EFAULT; 131 return -EFAULT;
132 break; 132 break;
133 133
134 case WDIOC_GETSTATUS: 134 case WDIOC_GETSTATUS:
135 case WDIOC_GETBOOTSTATUS: 135 case WDIOC_GETBOOTSTATUS:
136 if (put_user(wdt_status, (int *)arg)) 136 if (put_user(wdt_status, (int __user *)argp))
137 return -EFAULT; 137 return -EFAULT;
138 wdt_status &= ~WDIOF_KEEPALIVEPING; 138 wdt_status &= ~WDIOF_KEEPALIVEPING;
139 break; 139 break;
@@ -154,7 +154,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
154 154
155 case WDIOC_GETTIMEOUT: 155 case WDIOC_GETTIMEOUT:
156 timeout = mv64x60_wdt_timeout * HZ; 156 timeout = mv64x60_wdt_timeout * HZ;
157 if (put_user(timeout, (int *)arg)) 157 if (put_user(timeout, (int __user *)argp))
158 return -EFAULT; 158 return -EFAULT;
159 break; 159 break;
160 160
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c
index 5a80adbf8032..0b8e493be045 100644
--- a/drivers/char/watchdog/pcwd_pci.c
+++ b/drivers/char/watchdog/pcwd_pci.c
@@ -50,8 +50,8 @@
50#include <asm/io.h> /* For inb/outb/... */ 50#include <asm/io.h> /* For inb/outb/... */
51 51
52/* Module and version information */ 52/* Module and version information */
53#define WATCHDOG_VERSION "1.01" 53#define WATCHDOG_VERSION "1.02"
54#define WATCHDOG_DATE "02 Sep 2005" 54#define WATCHDOG_DATE "03 Sep 2005"
55#define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" 55#define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog"
56#define WATCHDOG_NAME "pcwd_pci" 56#define WATCHDOG_NAME "pcwd_pci"
57#define PFX WATCHDOG_NAME ": " 57#define PFX WATCHDOG_NAME ": "
@@ -70,19 +70,30 @@
70 * These are the defines that describe the control status bits for the 70 * These are the defines that describe the control status bits for the
71 * PCI-PC Watchdog card. 71 * PCI-PC Watchdog card.
72 */ 72 */
73#define WD_PCI_WTRP 0x01 /* Watchdog Trip status */ 73/* Port 1 : Control Status #1 */
74#define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */ 74#define WD_PCI_WTRP 0x01 /* Watchdog Trip status */
75#define WD_PCI_TTRP 0x04 /* Temperature Trip status */ 75#define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */
76#define WD_PCI_TTRP 0x04 /* Temperature Trip status */
77#define WD_PCI_RL2A 0x08 /* Relay 2 Active */
78#define WD_PCI_RL1A 0x10 /* Relay 1 Active */
79#define WD_PCI_R2DS 0x40 /* Relay 2 Disable Temperature-trip/reset */
80#define WD_PCI_RLY2 0x80 /* Activate Relay 2 on the board */
81/* Port 2 : Control Status #2 */
82#define WD_PCI_WDIS 0x10 /* Watchdog Disable */
83#define WD_PCI_ENTP 0x20 /* Enable Temperature Trip Reset */
84#define WD_PCI_WRSP 0x40 /* Watchdog wrote response */
85#define WD_PCI_PCMD 0x80 /* PC has sent command */
76 86
77/* according to documentation max. time to process a command for the pci 87/* according to documentation max. time to process a command for the pci
78 * watchdog card is 100 ms, so we give it 150 ms to do it's job */ 88 * watchdog card is 100 ms, so we give it 150 ms to do it's job */
79#define PCI_COMMAND_TIMEOUT 150 89#define PCI_COMMAND_TIMEOUT 150
80 90
81/* Watchdog's internal commands */ 91/* Watchdog's internal commands */
82#define CMD_GET_STATUS 0x04 92#define CMD_GET_STATUS 0x04
83#define CMD_GET_FIRMWARE_VERSION 0x08 93#define CMD_GET_FIRMWARE_VERSION 0x08
84#define CMD_READ_WATCHDOG_TIMEOUT 0x18 94#define CMD_READ_WATCHDOG_TIMEOUT 0x18
85#define CMD_WRITE_WATCHDOG_TIMEOUT 0x19 95#define CMD_WRITE_WATCHDOG_TIMEOUT 0x19
96#define CMD_GET_CLEAR_RESET_COUNT 0x84
86 97
87/* We can only use 1 card due to the /dev/watchdog restriction */ 98/* We can only use 1 card due to the /dev/watchdog restriction */
88static int cards_found; 99static int cards_found;
@@ -91,15 +102,22 @@ static int cards_found;
91static int temp_panic; 102static int temp_panic;
92static unsigned long is_active; 103static unsigned long is_active;
93static char expect_release; 104static char expect_release;
94static struct { 105static struct { /* this is private data for each PCI-PC watchdog card */
95 int supports_temp; /* Wether or not the card has a temperature device */ 106 int supports_temp; /* Wether or not the card has a temperature device */
96 int boot_status; /* The card's boot status */ 107 int boot_status; /* The card's boot status */
97 unsigned long io_addr; /* The cards I/O address */ 108 unsigned long io_addr; /* The cards I/O address */
98 spinlock_t io_lock; 109 spinlock_t io_lock; /* the lock for io operations */
99 struct pci_dev *pdev; 110 struct pci_dev *pdev; /* the PCI-device */
100} pcipcwd_private; 111} pcipcwd_private;
101 112
102/* module parameters */ 113/* module parameters */
114#define QUIET 0 /* Default */
115#define VERBOSE 1 /* Verbose */
116#define DEBUG 2 /* print fancy stuff too */
117static int debug = QUIET;
118module_param(debug, int, 0);
119MODULE_PARM_DESC(debug, "Debug level: 0=Quiet, 1=Verbose, 2=Debug (default=0)");
120
103#define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */ 121#define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */
104static int heartbeat = WATCHDOG_HEARTBEAT; 122static int heartbeat = WATCHDOG_HEARTBEAT;
105module_param(heartbeat, int, 0); 123module_param(heartbeat, int, 0);
@@ -117,6 +135,10 @@ static int send_command(int cmd, int *msb, int *lsb)
117{ 135{
118 int got_response, count; 136 int got_response, count;
119 137
138 if (debug >= DEBUG)
139 printk(KERN_DEBUG PFX "sending following data cmd=0x%02x msb=0x%02x lsb=0x%02x\n",
140 cmd, *msb, *lsb);
141
120 spin_lock(&pcipcwd_private.io_lock); 142 spin_lock(&pcipcwd_private.io_lock);
121 /* If a command requires data it should be written first. 143 /* If a command requires data it should be written first.
122 * Data for commands with 8 bits of data should be written to port 4. 144 * Data for commands with 8 bits of data should be written to port 4.
@@ -131,10 +153,19 @@ static int send_command(int cmd, int *msb, int *lsb)
131 /* wait till the pci card processed the command, signaled by 153 /* wait till the pci card processed the command, signaled by
132 * the WRSP bit in port 2 and give it a max. timeout of 154 * the WRSP bit in port 2 and give it a max. timeout of
133 * PCI_COMMAND_TIMEOUT to process */ 155 * PCI_COMMAND_TIMEOUT to process */
134 got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40; 156 got_response = inb_p(pcipcwd_private.io_addr + 2) & WD_PCI_WRSP;
135 for (count = 0; (count < PCI_COMMAND_TIMEOUT) && (!got_response); count++) { 157 for (count = 0; (count < PCI_COMMAND_TIMEOUT) && (!got_response); count++) {
136 mdelay(1); 158 mdelay(1);
137 got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40; 159 got_response = inb_p(pcipcwd_private.io_addr + 2) & WD_PCI_WRSP;
160 }
161
162 if (debug >= DEBUG) {
163 if (got_response) {
164 printk(KERN_DEBUG PFX "time to process command was: %d ms\n",
165 count);
166 } else {
167 printk(KERN_DEBUG PFX "card did not respond on command!\n");
168 }
138 } 169 }
139 170
140 if (got_response) { 171 if (got_response) {
@@ -144,12 +175,66 @@ static int send_command(int cmd, int *msb, int *lsb)
144 175
145 /* clear WRSP bit */ 176 /* clear WRSP bit */
146 inb_p(pcipcwd_private.io_addr + 6); 177 inb_p(pcipcwd_private.io_addr + 6);
178
179 if (debug >= DEBUG)
180 printk(KERN_DEBUG PFX "received following data for cmd=0x%02x: msb=0x%02x lsb=0x%02x\n",
181 cmd, *msb, *lsb);
147 } 182 }
183
148 spin_unlock(&pcipcwd_private.io_lock); 184 spin_unlock(&pcipcwd_private.io_lock);
149 185
150 return got_response; 186 return got_response;
151} 187}
152 188
189static inline void pcipcwd_check_temperature_support(void)
190{
191 if (inb_p(pcipcwd_private.io_addr) != 0xF0)
192 pcipcwd_private.supports_temp = 1;
193}
194
195static int pcipcwd_get_option_switches(void)
196{
197 int option_switches;
198
199 option_switches = inb_p(pcipcwd_private.io_addr + 3);
200 return option_switches;
201}
202
203static void pcipcwd_show_card_info(void)
204{
205 int got_fw_rev, fw_rev_major, fw_rev_minor;
206 char fw_ver_str[20]; /* The cards firmware version */
207 int option_switches;
208
209 got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor);
210 if (got_fw_rev) {
211 sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor);
212 } else {
213 sprintf(fw_ver_str, "<card no answer>");
214 }
215
216 /* Get switch settings */
217 option_switches = pcipcwd_get_option_switches();
218
219 printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n",
220 (int) pcipcwd_private.io_addr, fw_ver_str,
221 (pcipcwd_private.supports_temp ? "with" : "without"));
222
223 printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
224 option_switches,
225 ((option_switches & 0x10) ? "ON" : "OFF"),
226 ((option_switches & 0x08) ? "ON" : "OFF"));
227
228 if (pcipcwd_private.boot_status & WDIOF_CARDRESET)
229 printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n");
230
231 if (pcipcwd_private.boot_status & WDIOF_OVERHEAT)
232 printk(KERN_INFO PFX "Card sensed a CPU Overheat\n");
233
234 if (pcipcwd_private.boot_status == 0)
235 printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
236}
237
153static int pcipcwd_start(void) 238static int pcipcwd_start(void)
154{ 239{
155 int stat_reg; 240 int stat_reg;
@@ -161,11 +246,14 @@ static int pcipcwd_start(void)
161 stat_reg = inb_p(pcipcwd_private.io_addr + 2); 246 stat_reg = inb_p(pcipcwd_private.io_addr + 2);
162 spin_unlock(&pcipcwd_private.io_lock); 247 spin_unlock(&pcipcwd_private.io_lock);
163 248
164 if (stat_reg & 0x10) { 249 if (stat_reg & WD_PCI_WDIS) {
165 printk(KERN_ERR PFX "Card timer not enabled\n"); 250 printk(KERN_ERR PFX "Card timer not enabled\n");
166 return -1; 251 return -1;
167 } 252 }
168 253
254 if (debug >= VERBOSE)
255 printk(KERN_DEBUG PFX "Watchdog started\n");
256
169 return 0; 257 return 0;
170} 258}
171 259
@@ -183,18 +271,25 @@ static int pcipcwd_stop(void)
183 stat_reg = inb_p(pcipcwd_private.io_addr + 2); 271 stat_reg = inb_p(pcipcwd_private.io_addr + 2);
184 spin_unlock(&pcipcwd_private.io_lock); 272 spin_unlock(&pcipcwd_private.io_lock);
185 273
186 if (!(stat_reg & 0x10)) { 274 if (!(stat_reg & WD_PCI_WDIS)) {
187 printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n"); 275 printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n");
188 return -1; 276 return -1;
189 } 277 }
190 278
279 if (debug >= VERBOSE)
280 printk(KERN_DEBUG PFX "Watchdog stopped\n");
281
191 return 0; 282 return 0;
192} 283}
193 284
194static int pcipcwd_keepalive(void) 285static int pcipcwd_keepalive(void)
195{ 286{
196 /* Re-trigger watchdog by writing to port 0 */ 287 /* Re-trigger watchdog by writing to port 0 */
197 outb_p(0x42, pcipcwd_private.io_addr); 288 outb_p(0x42, pcipcwd_private.io_addr); /* send out any data */
289
290 if (debug >= DEBUG)
291 printk(KERN_DEBUG PFX "Watchdog keepalive signal send\n");
292
198 return 0; 293 return 0;
199} 294}
200 295
@@ -210,29 +305,64 @@ static int pcipcwd_set_heartbeat(int t)
210 send_command(CMD_WRITE_WATCHDOG_TIMEOUT, &t_msb, &t_lsb); 305 send_command(CMD_WRITE_WATCHDOG_TIMEOUT, &t_msb, &t_lsb);
211 306
212 heartbeat = t; 307 heartbeat = t;
308 if (debug >= VERBOSE)
309 printk(KERN_DEBUG PFX "New heartbeat: %d\n",
310 heartbeat);
311
213 return 0; 312 return 0;
214} 313}
215 314
216static int pcipcwd_get_status(int *status) 315static int pcipcwd_get_status(int *status)
217{ 316{
218 int new_status; 317 int control_status;
219 318
220 *status=0; 319 *status=0;
221 new_status = inb_p(pcipcwd_private.io_addr + 1); 320 control_status = inb_p(pcipcwd_private.io_addr + 1);
222 if (new_status & WD_PCI_WTRP) 321 if (control_status & WD_PCI_WTRP)
223 *status |= WDIOF_CARDRESET; 322 *status |= WDIOF_CARDRESET;
224 if (new_status & WD_PCI_TTRP) { 323 if (control_status & WD_PCI_TTRP) {
225 *status |= WDIOF_OVERHEAT; 324 *status |= WDIOF_OVERHEAT;
226 if (temp_panic) 325 if (temp_panic)
227 panic(PFX "Temperature overheat trip!\n"); 326 panic(PFX "Temperature overheat trip!\n");
228 } 327 }
229 328
329 if (debug >= DEBUG)
330 printk(KERN_DEBUG PFX "Control Status #1: 0x%02x\n",
331 control_status);
332
230 return 0; 333 return 0;
231} 334}
232 335
233static int pcipcwd_clear_status(void) 336static int pcipcwd_clear_status(void)
234{ 337{
235 outb_p(0x01, pcipcwd_private.io_addr + 1); 338 int control_status;
339 int msb;
340 int reset_counter;
341
342 if (debug >= VERBOSE)
343 printk(KERN_INFO PFX "clearing watchdog trip status & LED\n");
344
345 control_status = inb_p(pcipcwd_private.io_addr + 1);
346
347 if (debug >= DEBUG) {
348 printk(KERN_DEBUG PFX "status was: 0x%02x\n", control_status);
349 printk(KERN_DEBUG PFX "sending: 0x%02x\n",
350 (control_status & WD_PCI_R2DS) | WD_PCI_WTRP);
351 }
352
353 /* clear trip status & LED and keep mode of relay 2 */
354 outb_p((control_status & WD_PCI_R2DS) | WD_PCI_WTRP, pcipcwd_private.io_addr + 1);
355
356 /* clear reset counter */
357 msb=0;
358 reset_counter=0xff;
359 send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter);
360
361 if (debug >= DEBUG) {
362 printk(KERN_DEBUG PFX "reset count was: 0x%02x\n",
363 reset_counter);
364 }
365
236 return 0; 366 return 0;
237} 367}
238 368
@@ -242,11 +372,18 @@ static int pcipcwd_get_temperature(int *temperature)
242 if (!pcipcwd_private.supports_temp) 372 if (!pcipcwd_private.supports_temp)
243 return -ENODEV; 373 return -ENODEV;
244 374
375 *temperature = inb_p(pcipcwd_private.io_addr);
376
245 /* 377 /*
246 * Convert celsius to fahrenheit, since this was 378 * Convert celsius to fahrenheit, since this was
247 * the decided 'standard' for this return value. 379 * the decided 'standard' for this return value.
248 */ 380 */
249 *temperature = ((inb_p(pcipcwd_private.io_addr)) * 9 / 5) + 32; 381 *temperature = (*temperature * 9 / 5) + 32;
382
383 if (debug >= DEBUG) {
384 printk(KERN_DEBUG PFX "temperature is: %d F\n",
385 *temperature);
386 }
250 387
251 return 0; 388 return 0;
252} 389}
@@ -256,7 +393,7 @@ static int pcipcwd_get_temperature(int *temperature)
256 */ 393 */
257 394
258static ssize_t pcipcwd_write(struct file *file, const char __user *data, 395static ssize_t pcipcwd_write(struct file *file, const char __user *data,
259 size_t len, loff_t *ppos) 396 size_t len, loff_t *ppos)
260{ 397{
261 /* See if we got the magic character 'V' and reload the timer */ 398 /* See if we got the magic character 'V' and reload the timer */
262 if (len) { 399 if (len) {
@@ -381,8 +518,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
381static int pcipcwd_open(struct inode *inode, struct file *file) 518static int pcipcwd_open(struct inode *inode, struct file *file)
382{ 519{
383 /* /dev/watchdog can only be opened once */ 520 /* /dev/watchdog can only be opened once */
384 if (test_and_set_bit(0, &is_active)) 521 if (test_and_set_bit(0, &is_active)) {
522 if (debug >= VERBOSE)
523 printk(KERN_ERR PFX "Attempt to open already opened device.\n");
385 return -EBUSY; 524 return -EBUSY;
525 }
386 526
387 /* Activate */ 527 /* Activate */
388 pcipcwd_start(); 528 pcipcwd_start();
@@ -492,19 +632,10 @@ static struct notifier_block pcipcwd_notifier = {
492 * Init & exit routines 632 * Init & exit routines
493 */ 633 */
494 634
495static inline void check_temperature_support(void)
496{
497 if (inb_p(pcipcwd_private.io_addr) != 0xF0)
498 pcipcwd_private.supports_temp = 1;
499}
500
501static int __devinit pcipcwd_card_init(struct pci_dev *pdev, 635static int __devinit pcipcwd_card_init(struct pci_dev *pdev,
502 const struct pci_device_id *ent) 636 const struct pci_device_id *ent)
503{ 637{
504 int ret = -EIO; 638 int ret = -EIO;
505 int got_fw_rev, fw_rev_major, fw_rev_minor;
506 char fw_ver_str[20];
507 char option_switches;
508 639
509 cards_found++; 640 cards_found++;
510 if (cards_found == 1) 641 if (cards_found == 1)
@@ -546,36 +677,10 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev,
546 pcipcwd_stop(); 677 pcipcwd_stop();
547 678
548 /* Check whether or not the card supports the temperature device */ 679 /* Check whether or not the card supports the temperature device */
549 check_temperature_support(); 680 pcipcwd_check_temperature_support();
550
551 /* Get the Firmware Version */
552 got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor);
553 if (got_fw_rev) {
554 sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor);
555 } else {
556 sprintf(fw_ver_str, "<card no answer>");
557 }
558 681
559 /* Get switch settings */ 682 /* Show info about the card itself */
560 option_switches = inb_p(pcipcwd_private.io_addr + 3); 683 pcipcwd_show_card_info();
561
562 printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n",
563 (int) pcipcwd_private.io_addr, fw_ver_str,
564 (pcipcwd_private.supports_temp ? "with" : "without"));
565
566 printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
567 option_switches,
568 ((option_switches & 0x10) ? "ON" : "OFF"),
569 ((option_switches & 0x08) ? "ON" : "OFF"));
570
571 if (pcipcwd_private.boot_status & WDIOF_CARDRESET)
572 printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n");
573
574 if (pcipcwd_private.boot_status & WDIOF_OVERHEAT)
575 printk(KERN_INFO PFX "Card sensed a CPU Overheat\n");
576
577 if (pcipcwd_private.boot_status == 0)
578 printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
579 684
580 /* Check that the heartbeat value is within it's range ; if not reset to the default */ 685 /* Check that the heartbeat value is within it's range ; if not reset to the default */
581 if (pcipcwd_set_heartbeat(heartbeat)) { 686 if (pcipcwd_set_heartbeat(heartbeat)) {
@@ -656,7 +761,7 @@ static struct pci_driver pcipcwd_driver = {
656 761
657static int __init pcipcwd_init_module(void) 762static int __init pcipcwd_init_module(void)
658{ 763{
659 spin_lock_init (&pcipcwd_private.io_lock); 764 spin_lock_init(&pcipcwd_private.io_lock);
660 765
661 return pci_register_driver(&pcipcwd_driver); 766 return pci_register_driver(&pcipcwd_driver);
662} 767}
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index bb0b3a8de14b..505677fb3157 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -69,7 +69,7 @@ int cn_already_initialized = 0;
69 * a new message. 69 * a new message.
70 * 70 *
71 */ 71 */
72int cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask) 72int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
73{ 73{
74 struct cn_callback_entry *__cbq; 74 struct cn_callback_entry *__cbq;
75 unsigned int size; 75 unsigned int size;
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
index b66782398258..4f4ba9b6d182 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/firmware/dell_rbu.c
@@ -50,7 +50,7 @@
50MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>"); 50MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>");
51MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); 51MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems");
52MODULE_LICENSE("GPL"); 52MODULE_LICENSE("GPL");
53MODULE_VERSION("2.0"); 53MODULE_VERSION("3.0");
54 54
55#define BIOS_SCAN_LIMIT 0xffffffff 55#define BIOS_SCAN_LIMIT 0xffffffff
56#define MAX_IMAGE_LENGTH 16 56#define MAX_IMAGE_LENGTH 16
@@ -62,15 +62,16 @@ static struct _rbu_data {
62 int dma_alloc; 62 int dma_alloc;
63 spinlock_t lock; 63 spinlock_t lock;
64 unsigned long packet_read_count; 64 unsigned long packet_read_count;
65 unsigned long packet_write_count;
66 unsigned long num_packets; 65 unsigned long num_packets;
67 unsigned long packetsize; 66 unsigned long packetsize;
67 unsigned long imagesize;
68 int entry_created; 68 int entry_created;
69} rbu_data; 69} rbu_data;
70 70
71static char image_type[MAX_IMAGE_LENGTH + 1] = "mono"; 71static char image_type[MAX_IMAGE_LENGTH + 1] = "mono";
72module_param_string(image_type, image_type, sizeof (image_type), 0); 72module_param_string(image_type, image_type, sizeof (image_type), 0);
73MODULE_PARM_DESC(image_type, "BIOS image type. choose- mono or packet"); 73MODULE_PARM_DESC(image_type,
74 "BIOS image type. choose- mono or packet or init");
74 75
75struct packet_data { 76struct packet_data {
76 struct list_head list; 77 struct list_head list;
@@ -88,55 +89,13 @@ static dma_addr_t dell_rbu_dmaaddr;
88static void init_packet_head(void) 89static void init_packet_head(void)
89{ 90{
90 INIT_LIST_HEAD(&packet_data_head.list); 91 INIT_LIST_HEAD(&packet_data_head.list);
91 rbu_data.packet_write_count = 0;
92 rbu_data.packet_read_count = 0; 92 rbu_data.packet_read_count = 0;
93 rbu_data.num_packets = 0; 93 rbu_data.num_packets = 0;
94 rbu_data.packetsize = 0; 94 rbu_data.packetsize = 0;
95 rbu_data.imagesize = 0;
95} 96}
96 97
97static int fill_last_packet(void *data, size_t length) 98static int create_packet(void *data, size_t length)
98{
99 struct list_head *ptemp_list;
100 struct packet_data *packet = NULL;
101 int packet_count = 0;
102
103 pr_debug("fill_last_packet: entry \n");
104
105 if (!rbu_data.num_packets) {
106 pr_debug("fill_last_packet: num_packets=0\n");
107 return -ENOMEM;
108 }
109
110 packet_count = rbu_data.num_packets;
111
112 ptemp_list = (&packet_data_head.list)->prev;
113
114 packet = list_entry(ptemp_list, struct packet_data, list);
115
116 if ((rbu_data.packet_write_count + length) > rbu_data.packetsize) {
117 pr_debug("dell_rbu:%s: packet size data "
118 "overrun\n", __FUNCTION__);
119 return -EINVAL;
120 }
121
122 pr_debug("fill_last_packet : buffer = %p\n", packet->data);
123
124 memcpy((packet->data + rbu_data.packet_write_count), data, length);
125
126 if ((rbu_data.packet_write_count + length) == rbu_data.packetsize) {
127 /*
128 * this was the last data chunk in the packet
129 * so reinitialize the packet data counter to zero
130 */
131 rbu_data.packet_write_count = 0;
132 } else
133 rbu_data.packet_write_count += length;
134
135 pr_debug("fill_last_packet: exit \n");
136 return 0;
137}
138
139static int create_packet(size_t length)
140{ 99{
141 struct packet_data *newpacket; 100 struct packet_data *newpacket;
142 int ordernum = 0; 101 int ordernum = 0;
@@ -186,9 +145,11 @@ static int create_packet(size_t length)
186 INIT_LIST_HEAD(&newpacket->list); 145 INIT_LIST_HEAD(&newpacket->list);
187 list_add_tail(&newpacket->list, &packet_data_head.list); 146 list_add_tail(&newpacket->list, &packet_data_head.list);
188 /* 147 /*
189 * packets have fixed size 148 * packets may not have fixed size
190 */ 149 */
191 newpacket->length = rbu_data.packetsize; 150 newpacket->length = length;
151
152 memcpy(newpacket->data, data, length);
192 153
193 pr_debug("create_packet: exit \n"); 154 pr_debug("create_packet: exit \n");
194 155
@@ -198,13 +159,37 @@ static int create_packet(size_t length)
198static int packetize_data(void *data, size_t length) 159static int packetize_data(void *data, size_t length)
199{ 160{
200 int rc = 0; 161 int rc = 0;
162 int done = 0;
163 int packet_length;
164 u8 *temp;
165 u8 *end = (u8 *) data + length;
166 pr_debug("packetize_data: data length %d\n", length);
167 if (!rbu_data.packetsize) {
168 printk(KERN_WARNING
169 "dell_rbu: packetsize not specified\n");
170 return -EIO;
171 }
201 172
202 if (!rbu_data.packet_write_count) { 173 temp = (u8 *) data;
203 if ((rc = create_packet(length))) 174
175 /* packetize the hunk */
176 while (!done) {
177 if ((temp + rbu_data.packetsize) < end)
178 packet_length = rbu_data.packetsize;
179 else {
180 /* this is the last packet */
181 packet_length = end - temp;
182 done = 1;
183 }
184
185 if ((rc = create_packet(temp, packet_length)))
204 return rc; 186 return rc;
187
188 pr_debug("%lu:%lu\n", temp, (end - temp));
189 temp += packet_length;
205 } 190 }
206 if ((rc = fill_last_packet(data, length))) 191
207 return rc; 192 rbu_data.imagesize = length;
208 193
209 return rc; 194 return rc;
210} 195}
@@ -243,7 +228,7 @@ static int do_packet_read(char *data, struct list_head *ptemp_list,
243 return bytes_copied; 228 return bytes_copied;
244} 229}
245 230
246static int packet_read_list(char *data, size_t *pread_length) 231static int packet_read_list(char *data, size_t * pread_length)
247{ 232{
248 struct list_head *ptemp_list; 233 struct list_head *ptemp_list;
249 int temp_count = 0; 234 int temp_count = 0;
@@ -303,10 +288,9 @@ static void packet_empty_list(void)
303 newpacket->ordernum); 288 newpacket->ordernum);
304 kfree(newpacket); 289 kfree(newpacket);
305 } 290 }
306 rbu_data.packet_write_count = 0;
307 rbu_data.packet_read_count = 0; 291 rbu_data.packet_read_count = 0;
308 rbu_data.num_packets = 0; 292 rbu_data.num_packets = 0;
309 rbu_data.packetsize = 0; 293 rbu_data.imagesize = 0;
310} 294}
311 295
312/* 296/*
@@ -425,7 +409,6 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
425 size_t bytes_left; 409 size_t bytes_left;
426 size_t data_length; 410 size_t data_length;
427 char *ptempBuf = buffer; 411 char *ptempBuf = buffer;
428 unsigned long imagesize;
429 412
430 /* check to see if we have something to return */ 413 /* check to see if we have something to return */
431 if (rbu_data.num_packets == 0) { 414 if (rbu_data.num_packets == 0) {
@@ -434,22 +417,20 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
434 goto read_rbu_data_exit; 417 goto read_rbu_data_exit;
435 } 418 }
436 419
437 imagesize = rbu_data.num_packets * rbu_data.packetsize; 420 if (pos > rbu_data.imagesize) {
438
439 if (pos > imagesize) {
440 retval = 0; 421 retval = 0;
441 printk(KERN_WARNING "dell_rbu:read_packet_data: " 422 printk(KERN_WARNING "dell_rbu:read_packet_data: "
442 "data underrun\n"); 423 "data underrun\n");
443 goto read_rbu_data_exit; 424 goto read_rbu_data_exit;
444 } 425 }
445 426
446 bytes_left = imagesize - pos; 427 bytes_left = rbu_data.imagesize - pos;
447 data_length = min(bytes_left, count); 428 data_length = min(bytes_left, count);
448 429
449 if ((retval = packet_read_list(ptempBuf, &data_length)) < 0) 430 if ((retval = packet_read_list(ptempBuf, &data_length)) < 0)
450 goto read_rbu_data_exit; 431 goto read_rbu_data_exit;
451 432
452 if ((pos + count) > imagesize) { 433 if ((pos + count) > rbu_data.imagesize) {
453 rbu_data.packet_read_count = 0; 434 rbu_data.packet_read_count = 0;
454 /* this was the last copy */ 435 /* this was the last copy */
455 retval = bytes_left; 436 retval = bytes_left;
@@ -499,7 +480,7 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
499} 480}
500 481
501static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, 482static ssize_t read_rbu_data(struct kobject *kobj, char *buffer,
502 loff_t pos, size_t count) 483 loff_t pos, size_t count)
503{ 484{
504 ssize_t ret_count = 0; 485 ssize_t ret_count = 0;
505 486
@@ -531,13 +512,18 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
531 memcpy(rbu_data.image_update_buffer, 512 memcpy(rbu_data.image_update_buffer,
532 fw->data, fw->size); 513 fw->data, fw->size);
533 } else if (!strcmp(image_type, "packet")) { 514 } else if (!strcmp(image_type, "packet")) {
534 if (!rbu_data.packetsize) 515 /*
535 rbu_data.packetsize = fw->size; 516 * we need to free previous packets if a
536 else if (rbu_data.packetsize != fw->size) { 517 * new hunk of packets needs to be downloaded
518 */
519 packet_empty_list();
520 if (packetize_data(fw->data, fw->size))
521 /* Incase something goes wrong when we are
522 * in middle of packetizing the data, we
523 * need to free up whatever packets might
524 * have been created before we quit.
525 */
537 packet_empty_list(); 526 packet_empty_list();
538 rbu_data.packetsize = fw->size;
539 }
540 packetize_data(fw->data, fw->size);
541 } else 527 } else
542 pr_debug("invalid image type specified.\n"); 528 pr_debug("invalid image type specified.\n");
543 spin_unlock(&rbu_data.lock); 529 spin_unlock(&rbu_data.lock);
@@ -553,7 +539,7 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
553} 539}
554 540
555static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, 541static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer,
556 loff_t pos, size_t count) 542 loff_t pos, size_t count)
557{ 543{
558 int size = 0; 544 int size = 0;
559 if (!pos) 545 if (!pos)
@@ -562,7 +548,7 @@ static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer,
562} 548}
563 549
564static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, 550static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer,
565 loff_t pos, size_t count) 551 loff_t pos, size_t count)
566{ 552{
567 int rc = count; 553 int rc = count;
568 int req_firm_rc = 0; 554 int req_firm_rc = 0;
@@ -621,25 +607,49 @@ static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer,
621 return rc; 607 return rc;
622} 608}
623 609
610static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer,
611 loff_t pos, size_t count)
612{
613 int size = 0;
614 if (!pos) {
615 spin_lock(&rbu_data.lock);
616 size = sprintf(buffer, "%lu\n", rbu_data.packetsize);
617 spin_unlock(&rbu_data.lock);
618 }
619 return size;
620}
621
622static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer,
623 loff_t pos, size_t count)
624{
625 unsigned long temp;
626 spin_lock(&rbu_data.lock);
627 packet_empty_list();
628 sscanf(buffer, "%lu", &temp);
629 if (temp < 0xffffffff)
630 rbu_data.packetsize = temp;
631
632 spin_unlock(&rbu_data.lock);
633 return count;
634}
635
624static struct bin_attribute rbu_data_attr = { 636static struct bin_attribute rbu_data_attr = {
625 .attr = { 637 .attr = {.name = "data",.owner = THIS_MODULE,.mode = 0444},
626 .name = "data",
627 .owner = THIS_MODULE,
628 .mode = 0444,
629 },
630 .read = read_rbu_data, 638 .read = read_rbu_data,
631}; 639};
632 640
633static struct bin_attribute rbu_image_type_attr = { 641static struct bin_attribute rbu_image_type_attr = {
634 .attr = { 642 .attr = {.name = "image_type",.owner = THIS_MODULE,.mode = 0644},
635 .name = "image_type",
636 .owner = THIS_MODULE,
637 .mode = 0644,
638 },
639 .read = read_rbu_image_type, 643 .read = read_rbu_image_type,
640 .write = write_rbu_image_type, 644 .write = write_rbu_image_type,
641}; 645};
642 646
647static struct bin_attribute rbu_packet_size_attr = {
648 .attr = {.name = "packet_size",.owner = THIS_MODULE,.mode = 0644},
649 .read = read_rbu_packet_size,
650 .write = write_rbu_packet_size,
651};
652
643static int __init dcdrbu_init(void) 653static int __init dcdrbu_init(void)
644{ 654{
645 int rc = 0; 655 int rc = 0;
@@ -657,6 +667,8 @@ static int __init dcdrbu_init(void)
657 667
658 sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr); 668 sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr);
659 sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr); 669 sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr);
670 sysfs_create_bin_file(&rbu_device->dev.kobj,
671 &rbu_packet_size_attr);
660 672
661 rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, 673 rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG,
662 "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); 674 "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu);
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 9e9cf1407311..5275cbb1afe9 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -1101,6 +1101,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1101 ide_hwif_t *hwif; 1101 ide_hwif_t *hwif;
1102 struct request *rq; 1102 struct request *rq;
1103 ide_startstop_t startstop; 1103 ide_startstop_t startstop;
1104 int loops = 0;
1104 1105
1105 /* for atari only: POSSIBLY BROKEN HERE(?) */ 1106 /* for atari only: POSSIBLY BROKEN HERE(?) */
1106 ide_get_lock(ide_intr, hwgroup); 1107 ide_get_lock(ide_intr, hwgroup);
@@ -1153,6 +1154,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1153 /* no more work for this hwgroup (for now) */ 1154 /* no more work for this hwgroup (for now) */
1154 return; 1155 return;
1155 } 1156 }
1157 again:
1156 hwif = HWIF(drive); 1158 hwif = HWIF(drive);
1157 if (hwgroup->hwif->sharing_irq && 1159 if (hwgroup->hwif->sharing_irq &&
1158 hwif != hwgroup->hwif && 1160 hwif != hwgroup->hwif &&
@@ -1192,8 +1194,14 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1192 * though. I hope that doesn't happen too much, hopefully not 1194 * though. I hope that doesn't happen too much, hopefully not
1193 * unless the subdriver triggers such a thing in its own PM 1195 * unless the subdriver triggers such a thing in its own PM
1194 * state machine. 1196 * state machine.
1197 *
1198 * We count how many times we loop here to make sure we service
1199 * all drives in the hwgroup without looping for ever
1195 */ 1200 */
1196 if (drive->blocked && !blk_pm_request(rq) && !(rq->flags & REQ_PREEMPT)) { 1201 if (drive->blocked && !blk_pm_request(rq) && !(rq->flags & REQ_PREEMPT)) {
1202 drive = drive->next ? drive->next : hwgroup->drive;
1203 if (loops++ < 4 && !blk_queue_plugged(drive->queue))
1204 goto again;
1197 /* We clear busy, there should be no pending ATA command at this point. */ 1205 /* We clear busy, there should be no pending ATA command at this point. */
1198 hwgroup->busy = 0; 1206 hwgroup->busy = 0;
1199 break; 1207 break;
diff --git a/drivers/ieee1394/amdtp.c b/drivers/ieee1394/amdtp.c
index 84ae027b021a..e8e28569a668 100644
--- a/drivers/ieee1394/amdtp.c
+++ b/drivers/ieee1394/amdtp.c
@@ -1297,4 +1297,3 @@ static void __exit amdtp_exit_module (void)
1297 1297
1298module_init(amdtp_init_module); 1298module_init(amdtp_init_module);
1299module_exit(amdtp_exit_module); 1299module_exit(amdtp_exit_module);
1300MODULE_ALIAS_CHARDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_AMDTP * 16);
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h
index e6734263a1d3..28c5f4b726e2 100644
--- a/drivers/ieee1394/csr1212.h
+++ b/drivers/ieee1394/csr1212.h
@@ -37,7 +37,6 @@
37#include <linux/types.h> 37#include <linux/types.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/interrupt.h> 39#include <linux/interrupt.h>
40#include <linux/sched.h>
41#include <linux/vmalloc.h> 40#include <linux/vmalloc.h>
42#include <asm/pgalloc.h> 41#include <asm/pgalloc.h>
43 42
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index 4538b0235ca3..e34730c7a874 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -2660,4 +2660,3 @@ static int __init dv1394_init_module(void)
2660 2660
2661module_init(dv1394_init_module); 2661module_init(dv1394_init_module);
2662module_exit(dv1394_exit_module); 2662module_exit(dv1394_exit_module);
2663MODULE_ALIAS_CHARDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16);
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index cd53c174ced1..4802bbbb6dc9 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -89,7 +89,7 @@
89#define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__) 89#define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
90 90
91static char version[] __devinitdata = 91static char version[] __devinitdata =
92 "$Rev: 1264 $ Ben Collins <bcollins@debian.org>"; 92 "$Rev: 1312 $ Ben Collins <bcollins@debian.org>";
93 93
94struct fragment_info { 94struct fragment_info {
95 struct list_head list; 95 struct list_head list;
@@ -221,9 +221,7 @@ static int ether1394_open (struct net_device *dev)
221 if (priv->bc_state == ETHER1394_BC_ERROR) { 221 if (priv->bc_state == ETHER1394_BC_ERROR) {
222 /* we'll try again */ 222 /* we'll try again */
223 priv->iso = hpsb_iso_recv_init(priv->host, 223 priv->iso = hpsb_iso_recv_init(priv->host,
224 ETHER1394_GASP_BUFFERS * 2 * 224 ETHER1394_ISO_BUF_SIZE,
225 (1 << (priv->host->csr.max_rec +
226 1)),
227 ETHER1394_GASP_BUFFERS, 225 ETHER1394_GASP_BUFFERS,
228 priv->broadcast_channel, 226 priv->broadcast_channel,
229 HPSB_ISO_DMA_PACKET_PER_BUFFER, 227 HPSB_ISO_DMA_PACKET_PER_BUFFER,
@@ -635,8 +633,8 @@ static void ether1394_add_host (struct hpsb_host *host)
635 * be checked when the eth device is opened. */ 633 * be checked when the eth device is opened. */
636 priv->broadcast_channel = host->csr.broadcast_channel & 0x3f; 634 priv->broadcast_channel = host->csr.broadcast_channel & 0x3f;
637 635
638 priv->iso = hpsb_iso_recv_init(host, (ETHER1394_GASP_BUFFERS * 2 * 636 priv->iso = hpsb_iso_recv_init(host,
639 (1 << (host->csr.max_rec + 1))), 637 ETHER1394_ISO_BUF_SIZE,
640 ETHER1394_GASP_BUFFERS, 638 ETHER1394_GASP_BUFFERS,
641 priv->broadcast_channel, 639 priv->broadcast_channel,
642 HPSB_ISO_DMA_PACKET_PER_BUFFER, 640 HPSB_ISO_DMA_PACKET_PER_BUFFER,
@@ -1770,7 +1768,7 @@ fail:
1770static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 1768static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1771{ 1769{
1772 strcpy (info->driver, driver_name); 1770 strcpy (info->driver, driver_name);
1773 strcpy (info->version, "$Rev: 1264 $"); 1771 strcpy (info->version, "$Rev: 1312 $");
1774 /* FIXME XXX provide sane businfo */ 1772 /* FIXME XXX provide sane businfo */
1775 strcpy (info->bus_info, "ieee1394"); 1773 strcpy (info->bus_info, "ieee1394");
1776} 1774}
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h
index ed8f1c4b7fd8..a77213cfc483 100644
--- a/drivers/ieee1394/eth1394.h
+++ b/drivers/ieee1394/eth1394.h
@@ -44,6 +44,12 @@
44 44
45#define ETHER1394_GASP_BUFFERS 16 45#define ETHER1394_GASP_BUFFERS 16
46 46
47/* rawiso buffer size - due to a limitation in rawiso, we must limit each
48 * GASP buffer to be less than PAGE_SIZE. */
49#define ETHER1394_ISO_BUF_SIZE ETHER1394_GASP_BUFFERS * \
50 min((unsigned int)PAGE_SIZE, \
51 2 * (1U << (priv->host->csr.max_rec + 1)))
52
47/* Node set == 64 */ 53/* Node set == 64 */
48#define NODE_SET (ALL_NODES + 1) 54#define NODE_SET (ALL_NODES + 1)
49 55
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c
index c502c6e9c440..aeeaeb670d03 100644
--- a/drivers/ieee1394/hosts.c
+++ b/drivers/ieee1394/hosts.c
@@ -18,6 +18,7 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/timer.h> 20#include <linux/timer.h>
21#include <linux/jiffies.h>
21 22
22#include "csr1212.h" 23#include "csr1212.h"
23#include "ieee1394.h" 24#include "ieee1394.h"
@@ -217,7 +218,7 @@ int hpsb_update_config_rom_image(struct hpsb_host *host)
217 218
218 /* IEEE 1394a-2000 prohibits using the same generation number 219 /* IEEE 1394a-2000 prohibits using the same generation number
219 * twice in a 60 second period. */ 220 * twice in a 60 second period. */
220 if (jiffies - host->csr.gen_timestamp[next_gen] < 60 * HZ) 221 if (time_before(jiffies, host->csr.gen_timestamp[next_gen] + 60 * HZ))
221 /* Wait 60 seconds from the last time this generation number was 222 /* Wait 60 seconds from the last time this generation number was
222 * used. */ 223 * used. */
223 reset_delay = (60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies; 224 reset_delay = (60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies;
diff --git a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h
index 739e76840d51..38f42112dff0 100644
--- a/drivers/ieee1394/hosts.h
+++ b/drivers/ieee1394/hosts.h
@@ -135,17 +135,17 @@ enum isoctl_cmd {
135 135
136enum reset_types { 136enum reset_types {
137 /* 166 microsecond reset -- only type of reset available on 137 /* 166 microsecond reset -- only type of reset available on
138 non-1394a capable IEEE 1394 controllers */ 138 non-1394a capable controllers */
139 LONG_RESET, 139 LONG_RESET,
140 140
141 /* Short (arbitrated) reset -- only available on 1394a capable 141 /* Short (arbitrated) reset -- only available on 1394a capable
142 IEEE 1394 capable controllers */ 142 controllers */
143 SHORT_RESET, 143 SHORT_RESET,
144 144
145 /* Variants, that set force_root before issueing the bus reset */ 145 /* Variants that set force_root before issueing the bus reset */
146 LONG_RESET_FORCE_ROOT, SHORT_RESET_FORCE_ROOT, 146 LONG_RESET_FORCE_ROOT, SHORT_RESET_FORCE_ROOT,
147 147
148 /* Variants, that clear force_root before issueing the bus reset */ 148 /* Variants that clear force_root before issueing the bus reset */
149 LONG_RESET_NO_FORCE_ROOT, SHORT_RESET_NO_FORCE_ROOT 149 LONG_RESET_NO_FORCE_ROOT, SHORT_RESET_NO_FORCE_ROOT
150}; 150};
151 151
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
index d633770fac8e..32a1e016c85e 100644
--- a/drivers/ieee1394/ieee1394_core.c
+++ b/drivers/ieee1394/ieee1394_core.c
@@ -70,7 +70,7 @@ const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S32
70struct class *hpsb_protocol_class; 70struct class *hpsb_protocol_class;
71 71
72#ifdef CONFIG_IEEE1394_VERBOSEDEBUG 72#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
73static void dump_packet(const char *text, quadlet_t *data, int size) 73static void dump_packet(const char *text, quadlet_t *data, int size, int speed)
74{ 74{
75 int i; 75 int i;
76 76
@@ -78,12 +78,15 @@ static void dump_packet(const char *text, quadlet_t *data, int size)
78 size = (size > 4 ? 4 : size); 78 size = (size > 4 ? 4 : size);
79 79
80 printk(KERN_DEBUG "ieee1394: %s", text); 80 printk(KERN_DEBUG "ieee1394: %s", text);
81 if (speed > -1 && speed < 6)
82 printk(" at %s", hpsb_speedto_str[speed]);
83 printk(":");
81 for (i = 0; i < size; i++) 84 for (i = 0; i < size; i++)
82 printk(" %08x", data[i]); 85 printk(" %08x", data[i]);
83 printk("\n"); 86 printk("\n");
84} 87}
85#else 88#else
86#define dump_packet(x,y,z) 89#define dump_packet(a,b,c,d)
87#endif 90#endif
88 91
89static void abort_requests(struct hpsb_host *host); 92static void abort_requests(struct hpsb_host *host);
@@ -544,8 +547,7 @@ int hpsb_send_packet(struct hpsb_packet *packet)
544 if (packet->data_size) 547 if (packet->data_size)
545 memcpy(((u8*)data) + packet->header_size, packet->data, packet->data_size); 548 memcpy(((u8*)data) + packet->header_size, packet->data, packet->data_size);
546 549
547 dump_packet("send packet local:", packet->header, 550 dump_packet("send packet local", packet->header, packet->header_size, -1);
548 packet->header_size);
549 551
550 hpsb_packet_sent(host, packet, packet->expect_response ? ACK_PENDING : ACK_COMPLETE); 552 hpsb_packet_sent(host, packet, packet->expect_response ? ACK_PENDING : ACK_COMPLETE);
551 hpsb_packet_received(host, data, size, 0); 553 hpsb_packet_received(host, data, size, 0);
@@ -561,21 +563,7 @@ int hpsb_send_packet(struct hpsb_packet *packet)
561 + NODEID_TO_NODE(packet->node_id)]; 563 + NODEID_TO_NODE(packet->node_id)];
562 } 564 }
563 565
564#ifdef CONFIG_IEEE1394_VERBOSEDEBUG 566 dump_packet("send packet", packet->header, packet->header_size, packet->speed_code);
565 switch (packet->speed_code) {
566 case 2:
567 dump_packet("send packet 400:", packet->header,
568 packet->header_size);
569 break;
570 case 1:
571 dump_packet("send packet 200:", packet->header,
572 packet->header_size);
573 break;
574 default:
575 dump_packet("send packet 100:", packet->header,
576 packet->header_size);
577 }
578#endif
579 567
580 return host->driver->transmit_packet(host, packet); 568 return host->driver->transmit_packet(host, packet);
581} 569}
@@ -636,7 +624,7 @@ static void handle_packet_response(struct hpsb_host *host, int tcode,
636 624
637 if (packet == NULL) { 625 if (packet == NULL) {
638 HPSB_DEBUG("unsolicited response packet received - no tlabel match"); 626 HPSB_DEBUG("unsolicited response packet received - no tlabel match");
639 dump_packet("contents:", data, 16); 627 dump_packet("contents", data, 16, -1);
640 spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags); 628 spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
641 return; 629 return;
642 } 630 }
@@ -677,7 +665,7 @@ static void handle_packet_response(struct hpsb_host *host, int tcode,
677 if (!tcode_match) { 665 if (!tcode_match) {
678 spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags); 666 spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
679 HPSB_INFO("unsolicited response packet received - tcode mismatch"); 667 HPSB_INFO("unsolicited response packet received - tcode mismatch");
680 dump_packet("contents:", data, 16); 668 dump_packet("contents", data, 16, -1);
681 return; 669 return;
682 } 670 }
683 671
@@ -914,7 +902,7 @@ void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,
914 return; 902 return;
915 } 903 }
916 904
917 dump_packet("received packet:", data, size); 905 dump_packet("received packet", data, size, -1);
918 906
919 tcode = (data[0] >> 4) & 0xf; 907 tcode = (data[0] >> 4) & 0xf;
920 908
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index b23322523ef5..347ece6b583c 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -64,10 +64,10 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
64 struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci; 64 struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci;
65 int i, ret = 0; 65 int i, ret = 0;
66 66
67 for (i = 0; i < 3; i++) { 67 for (i = 1; ; i++) {
68 ret = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, 68 ret = hpsb_read(ci->host, ci->nodeid, ci->generation, addr,
69 buffer, length); 69 buffer, length);
70 if (!ret) 70 if (!ret || i == 3)
71 break; 71 break;
72 72
73 if (msleep_interruptible(334)) 73 if (msleep_interruptible(334))
@@ -1438,9 +1438,13 @@ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)
1438 if (host->busmgr_id == 0xffff && host->node_count > 1) 1438 if (host->busmgr_id == 0xffff && host->node_count > 1)
1439 { 1439 {
1440 u16 root_node = host->node_count - 1; 1440 u16 root_node = host->node_count - 1;
1441 struct node_entry *ne = find_entry_by_nodeid(host, root_node | LOCAL_BUS);
1442 1441
1443 if (ne && ne->busopt.cmc) 1442 /* get cycle master capability flag from root node */
1443 if (host->is_cycmst ||
1444 (!hpsb_read(host, LOCAL_BUS | root_node, get_hpsb_generation(host),
1445 (CSR_REGISTER_BASE + CSR_CONFIG_ROM + 2 * sizeof(quadlet_t)),
1446 &bc, sizeof(quadlet_t)) &&
1447 be32_to_cpu(bc) & 1 << CSR_CMC_SHIFT))
1444 hpsb_send_phy_config(host, root_node, -1); 1448 hpsb_send_phy_config(host, root_node, -1);
1445 else { 1449 else {
1446 HPSB_DEBUG("The root node is not cycle master capable; " 1450 HPSB_DEBUG("The root node is not cycle master capable; "
@@ -1557,24 +1561,19 @@ static int nodemgr_host_thread(void *__hi)
1557 } 1561 }
1558 } 1562 }
1559 1563
1560 if (!nodemgr_check_irm_capability(host, reset_cycles)) { 1564 if (!nodemgr_check_irm_capability(host, reset_cycles) ||
1565 !nodemgr_do_irm_duties(host, reset_cycles)) {
1561 reset_cycles++; 1566 reset_cycles++;
1562 up(&nodemgr_serialize); 1567 up(&nodemgr_serialize);
1563 continue; 1568 continue;
1564 } 1569 }
1570 reset_cycles = 0;
1565 1571
1566 /* Scan our nodes to get the bus options and create node 1572 /* Scan our nodes to get the bus options and create node
1567 * entries. This does not do the sysfs stuff, since that 1573 * entries. This does not do the sysfs stuff, since that
1568 * would trigger hotplug callbacks and such, which is a 1574 * would trigger hotplug callbacks and such, which is a
1569 * bad idea at this point. */ 1575 * bad idea at this point. */
1570 nodemgr_node_scan(hi, generation); 1576 nodemgr_node_scan(hi, generation);
1571 if (!nodemgr_do_irm_duties(host, reset_cycles)) {
1572 reset_cycles++;
1573 up(&nodemgr_serialize);
1574 continue;
1575 }
1576
1577 reset_cycles = 0;
1578 1577
1579 /* This actually does the full probe, with sysfs 1578 /* This actually does the full probe, with sysfs
1580 * registration. */ 1579 * registration. */
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 27018c8efc24..6a6acbd80af4 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -162,7 +162,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
162printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) 162printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args)
163 163
164static char version[] __devinitdata = 164static char version[] __devinitdata =
165 "$Rev: 1299 $ Ben Collins <bcollins@debian.org>"; 165 "$Rev: 1313 $ Ben Collins <bcollins@debian.org>";
166 166
167/* Module Parameters */ 167/* Module Parameters */
168static int phys_dma = 1; 168static int phys_dma = 1;
@@ -1084,7 +1084,7 @@ static int ohci_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg)
1084 initialize_dma_rcv_ctx(&ohci->ir_legacy_context, 1); 1084 initialize_dma_rcv_ctx(&ohci->ir_legacy_context, 1);
1085 1085
1086 if (printk_ratelimit()) 1086 if (printk_ratelimit())
1087 PRINT(KERN_ERR, "IR legacy activated"); 1087 DBGMSG("IR legacy activated");
1088 } 1088 }
1089 1089
1090 spin_lock_irqsave(&ohci->IR_channel_lock, flags); 1090 spin_lock_irqsave(&ohci->IR_channel_lock, flags);
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index b4fa14793fe5..315f5ca8bedb 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -98,7 +98,7 @@ static struct hpsb_address_ops arm_ops = {
98 98
99static void queue_complete_cb(struct pending_request *req); 99static void queue_complete_cb(struct pending_request *req);
100 100
101static struct pending_request *__alloc_pending_request(unsigned int __nocast flags) 101static struct pending_request *__alloc_pending_request(gfp_t flags)
102{ 102{
103 struct pending_request *req; 103 struct pending_request *req;
104 104
@@ -2958,4 +2958,3 @@ static void __exit cleanup_raw1394(void)
2958module_init(init_raw1394); 2958module_init(init_raw1394);
2959module_exit(cleanup_raw1394); 2959module_exit(cleanup_raw1394);
2960MODULE_LICENSE("GPL"); 2960MODULE_LICENSE("GPL");
2961MODULE_ALIAS_CHARDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16);
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index de88218ef7cc..12cec7c4a342 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -97,16 +97,18 @@ static char version[] __devinitdata =
97 */ 97 */
98static int max_speed = IEEE1394_SPEED_MAX; 98static int max_speed = IEEE1394_SPEED_MAX;
99module_param(max_speed, int, 0644); 99module_param(max_speed, int, 0644);
100MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb default, 1 = 200mb, 0 = 100mb)"); 100MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb, 1 = 200mb, 0 = 100mb)");
101 101
102/* 102/*
103 * Set serialize_io to 1 if you'd like only one scsi command sent 103 * Set serialize_io to 1 if you'd like only one scsi command sent
104 * down to us at a time (debugging). This might be necessary for very 104 * down to us at a time (debugging). This might be necessary for very
105 * badly behaved sbp2 devices. 105 * badly behaved sbp2 devices.
106 *
107 * TODO: Make this configurable per device.
106 */ 108 */
107static int serialize_io; 109static int serialize_io = 1;
108module_param(serialize_io, int, 0444); 110module_param(serialize_io, int, 0444);
109MODULE_PARM_DESC(serialize_io, "Serialize all I/O coming down from the scsi drivers (default = 0)"); 111MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers (default = 1, faster = 0)");
110 112
111/* 113/*
112 * Bump up max_sectors if you'd like to support very large sized 114 * Bump up max_sectors if you'd like to support very large sized
@@ -596,6 +598,14 @@ static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_i
596 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 598 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
597} 599}
598 600
601/*
602 * Is scsi_id valid? Is the 1394 node still present?
603 */
604static inline int sbp2util_node_is_available(struct scsi_id_instance_data *scsi_id)
605{
606 return scsi_id && scsi_id->ne && !scsi_id->ne->in_limbo;
607}
608
599 609
600 610
601/********************************************* 611/*********************************************
@@ -631,11 +641,23 @@ static int sbp2_remove(struct device *dev)
631{ 641{
632 struct unit_directory *ud; 642 struct unit_directory *ud;
633 struct scsi_id_instance_data *scsi_id; 643 struct scsi_id_instance_data *scsi_id;
644 struct scsi_device *sdev;
634 645
635 SBP2_DEBUG("sbp2_remove"); 646 SBP2_DEBUG("sbp2_remove");
636 647
637 ud = container_of(dev, struct unit_directory, device); 648 ud = container_of(dev, struct unit_directory, device);
638 scsi_id = ud->device.driver_data; 649 scsi_id = ud->device.driver_data;
650 if (!scsi_id)
651 return 0;
652
653 /* Trigger shutdown functions in scsi's highlevel. */
654 if (scsi_id->scsi_host)
655 scsi_unblock_requests(scsi_id->scsi_host);
656 sdev = scsi_id->sdev;
657 if (sdev) {
658 scsi_id->sdev = NULL;
659 scsi_remove_device(sdev);
660 }
639 661
640 sbp2_logout_device(scsi_id); 662 sbp2_logout_device(scsi_id);
641 sbp2_remove_device(scsi_id); 663 sbp2_remove_device(scsi_id);
@@ -2473,37 +2495,26 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
2473 struct scsi_id_instance_data *scsi_id = 2495 struct scsi_id_instance_data *scsi_id =
2474 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; 2496 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
2475 struct sbp2scsi_host_info *hi; 2497 struct sbp2scsi_host_info *hi;
2498 int result = DID_NO_CONNECT << 16;
2476 2499
2477 SBP2_DEBUG("sbp2scsi_queuecommand"); 2500 SBP2_DEBUG("sbp2scsi_queuecommand");
2478 2501
2479 /* 2502 if (!sbp2util_node_is_available(scsi_id))
2480 * If scsi_id is null, it means there is no device in this slot, 2503 goto done;
2481 * so we should return selection timeout.
2482 */
2483 if (!scsi_id) {
2484 SCpnt->result = DID_NO_CONNECT << 16;
2485 done (SCpnt);
2486 return 0;
2487 }
2488 2504
2489 hi = scsi_id->hi; 2505 hi = scsi_id->hi;
2490 2506
2491 if (!hi) { 2507 if (!hi) {
2492 SBP2_ERR("sbp2scsi_host_info is NULL - this is bad!"); 2508 SBP2_ERR("sbp2scsi_host_info is NULL - this is bad!");
2493 SCpnt->result = DID_NO_CONNECT << 16; 2509 goto done;
2494 done (SCpnt);
2495 return(0);
2496 } 2510 }
2497 2511
2498 /* 2512 /*
2499 * Until we handle multiple luns, just return selection time-out 2513 * Until we handle multiple luns, just return selection time-out
2500 * to any IO directed at non-zero LUNs 2514 * to any IO directed at non-zero LUNs
2501 */ 2515 */
2502 if (SCpnt->device->lun) { 2516 if (SCpnt->device->lun)
2503 SCpnt->result = DID_NO_CONNECT << 16; 2517 goto done;
2504 done (SCpnt);
2505 return(0);
2506 }
2507 2518
2508 /* 2519 /*
2509 * Check for request sense command, and handle it here 2520 * Check for request sense command, and handle it here
@@ -2514,7 +2525,7 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
2514 memcpy(SCpnt->request_buffer, SCpnt->sense_buffer, SCpnt->request_bufflen); 2525 memcpy(SCpnt->request_buffer, SCpnt->sense_buffer, SCpnt->request_bufflen);
2515 memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer)); 2526 memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer));
2516 sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_GOOD, SCpnt, done); 2527 sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_GOOD, SCpnt, done);
2517 return(0); 2528 return 0;
2518 } 2529 }
2519 2530
2520 /* 2531 /*
@@ -2522,9 +2533,8 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
2522 */ 2533 */
2523 if (!hpsb_node_entry_valid(scsi_id->ne)) { 2534 if (!hpsb_node_entry_valid(scsi_id->ne)) {
2524 SBP2_ERR("Bus reset in progress - rejecting command"); 2535 SBP2_ERR("Bus reset in progress - rejecting command");
2525 SCpnt->result = DID_BUS_BUSY << 16; 2536 result = DID_BUS_BUSY << 16;
2526 done (SCpnt); 2537 goto done;
2527 return(0);
2528 } 2538 }
2529 2539
2530 /* 2540 /*
@@ -2535,8 +2545,12 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
2535 sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_SELECTION_TIMEOUT, 2545 sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_SELECTION_TIMEOUT,
2536 SCpnt, done); 2546 SCpnt, done);
2537 } 2547 }
2548 return 0;
2538 2549
2539 return(0); 2550done:
2551 SCpnt->result = result;
2552 done(SCpnt);
2553 return 0;
2540} 2554}
2541 2555
2542/* 2556/*
@@ -2683,14 +2697,27 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2683} 2697}
2684 2698
2685 2699
2686static int sbp2scsi_slave_configure (struct scsi_device *sdev) 2700static int sbp2scsi_slave_alloc(struct scsi_device *sdev)
2687{ 2701{
2688 blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); 2702 ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = sdev;
2703 return 0;
2704}
2705
2689 2706
2707static int sbp2scsi_slave_configure(struct scsi_device *sdev)
2708{
2709 blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
2690 return 0; 2710 return 0;
2691} 2711}
2692 2712
2693 2713
2714static void sbp2scsi_slave_destroy(struct scsi_device *sdev)
2715{
2716 ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = NULL;
2717 return;
2718}
2719
2720
2694/* 2721/*
2695 * Called by scsi stack when something has really gone wrong. Usually 2722 * Called by scsi stack when something has really gone wrong. Usually
2696 * called when a command has timed-out for some reason. 2723 * called when a command has timed-out for some reason.
@@ -2705,7 +2732,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2705 SBP2_ERR("aborting sbp2 command"); 2732 SBP2_ERR("aborting sbp2 command");
2706 scsi_print_command(SCpnt); 2733 scsi_print_command(SCpnt);
2707 2734
2708 if (scsi_id) { 2735 if (sbp2util_node_is_available(scsi_id)) {
2709 2736
2710 /* 2737 /*
2711 * Right now, just return any matching command structures 2738 * Right now, just return any matching command structures
@@ -2742,31 +2769,24 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2742/* 2769/*
2743 * Called by scsi stack when something has really gone wrong. 2770 * Called by scsi stack when something has really gone wrong.
2744 */ 2771 */
2745static int __sbp2scsi_reset(struct scsi_cmnd *SCpnt) 2772static int sbp2scsi_reset(struct scsi_cmnd *SCpnt)
2746{ 2773{
2747 struct scsi_id_instance_data *scsi_id = 2774 struct scsi_id_instance_data *scsi_id =
2748 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; 2775 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
2776 unsigned long flags;
2749 2777
2750 SBP2_ERR("reset requested"); 2778 SBP2_ERR("reset requested");
2751 2779
2752 if (scsi_id) { 2780 spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
2781
2782 if (sbp2util_node_is_available(scsi_id)) {
2753 SBP2_ERR("Generating sbp2 fetch agent reset"); 2783 SBP2_ERR("Generating sbp2 fetch agent reset");
2754 sbp2_agent_reset(scsi_id, 0); 2784 sbp2_agent_reset(scsi_id, 0);
2755 } 2785 }
2756 2786
2757 return(SUCCESS);
2758}
2759
2760static int sbp2scsi_reset(struct scsi_cmnd *SCpnt)
2761{
2762 unsigned long flags;
2763 int rc;
2764
2765 spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
2766 rc = __sbp2scsi_reset(SCpnt);
2767 spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); 2787 spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags);
2768 2788
2769 return rc; 2789 return SUCCESS;
2770} 2790}
2771 2791
2772static const char *sbp2scsi_info (struct Scsi_Host *host) 2792static const char *sbp2scsi_info (struct Scsi_Host *host)
@@ -2817,7 +2837,9 @@ static struct scsi_host_template scsi_driver_template = {
2817 .eh_device_reset_handler = sbp2scsi_reset, 2837 .eh_device_reset_handler = sbp2scsi_reset,
2818 .eh_bus_reset_handler = sbp2scsi_reset, 2838 .eh_bus_reset_handler = sbp2scsi_reset,
2819 .eh_host_reset_handler = sbp2scsi_reset, 2839 .eh_host_reset_handler = sbp2scsi_reset,
2840 .slave_alloc = sbp2scsi_slave_alloc,
2820 .slave_configure = sbp2scsi_slave_configure, 2841 .slave_configure = sbp2scsi_slave_configure,
2842 .slave_destroy = sbp2scsi_slave_destroy,
2821 .this_id = -1, 2843 .this_id = -1,
2822 .sg_tablesize = SG_ALL, 2844 .sg_tablesize = SG_ALL,
2823 .use_clustering = ENABLE_CLUSTERING, 2845 .use_clustering = ENABLE_CLUSTERING,
@@ -2837,7 +2859,8 @@ static int sbp2_module_init(void)
2837 2859
2838 /* Module load debug option to force one command at a time (serializing I/O) */ 2860 /* Module load debug option to force one command at a time (serializing I/O) */
2839 if (serialize_io) { 2861 if (serialize_io) {
2840 SBP2_ERR("Driver forced to serialize I/O (serialize_io = 1)"); 2862 SBP2_INFO("Driver forced to serialize I/O (serialize_io=1)");
2863 SBP2_INFO("Try serialize_io=0 for better performance");
2841 scsi_driver_template.can_queue = 1; 2864 scsi_driver_template.can_queue = 1;
2842 scsi_driver_template.cmd_per_lun = 1; 2865 scsi_driver_template.cmd_per_lun = 1;
2843 } 2866 }
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index 9d6facf2f78f..11be9c9c82a8 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -1571,4 +1571,3 @@ static int __init video1394_init_module (void)
1571 1571
1572module_init(video1394_init_module); 1572module_init(video1394_init_module);
1573module_exit(video1394_exit_module); 1573module_exit(video1394_exit_module);
1574MODULE_ALIAS_CHARDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_VIDEO1394 * 16);
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index a4a4d9c1eef3..a14ca87fda18 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -783,7 +783,7 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
783 u32 remote_qpn, u16 pkey_index, 783 u32 remote_qpn, u16 pkey_index,
784 struct ib_ah *ah, int rmpp_active, 784 struct ib_ah *ah, int rmpp_active,
785 int hdr_len, int data_len, 785 int hdr_len, int data_len,
786 unsigned int __nocast gfp_mask) 786 gfp_t gfp_mask)
787{ 787{
788 struct ib_mad_agent_private *mad_agent_priv; 788 struct ib_mad_agent_private *mad_agent_priv;
789 struct ib_mad_send_buf *send_buf; 789 struct ib_mad_send_buf *send_buf;
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 78de2dd1a4f2..262618210c1c 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -574,7 +574,7 @@ static void ib_sa_path_rec_release(struct ib_sa_query *sa_query)
574int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, 574int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
575 struct ib_sa_path_rec *rec, 575 struct ib_sa_path_rec *rec,
576 ib_sa_comp_mask comp_mask, 576 ib_sa_comp_mask comp_mask,
577 int timeout_ms, unsigned int __nocast gfp_mask, 577 int timeout_ms, gfp_t gfp_mask,
578 void (*callback)(int status, 578 void (*callback)(int status,
579 struct ib_sa_path_rec *resp, 579 struct ib_sa_path_rec *resp,
580 void *context), 580 void *context),
@@ -676,7 +676,7 @@ static void ib_sa_service_rec_release(struct ib_sa_query *sa_query)
676int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method, 676int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method,
677 struct ib_sa_service_rec *rec, 677 struct ib_sa_service_rec *rec,
678 ib_sa_comp_mask comp_mask, 678 ib_sa_comp_mask comp_mask,
679 int timeout_ms, unsigned int __nocast gfp_mask, 679 int timeout_ms, gfp_t gfp_mask,
680 void (*callback)(int status, 680 void (*callback)(int status,
681 struct ib_sa_service_rec *resp, 681 struct ib_sa_service_rec *resp,
682 void *context), 682 void *context),
@@ -759,7 +759,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
759 u8 method, 759 u8 method,
760 struct ib_sa_mcmember_rec *rec, 760 struct ib_sa_mcmember_rec *rec,
761 ib_sa_comp_mask comp_mask, 761 ib_sa_comp_mask comp_mask,
762 int timeout_ms, unsigned int __nocast gfp_mask, 762 int timeout_ms, gfp_t gfp_mask,
763 void (*callback)(int status, 763 void (*callback)(int status,
764 struct ib_sa_mcmember_rec *resp, 764 struct ib_sa_mcmember_rec *resp,
765 void *context), 765 void *context),
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
index ffbcd40418d5..23a3f56c7899 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -503,6 +503,25 @@ err_free_aux:
503 return err; 503 return err;
504} 504}
505 505
506static void mthca_free_icms(struct mthca_dev *mdev)
507{
508 u8 status;
509
510 mthca_free_icm_table(mdev, mdev->mcg_table.table);
511 if (mdev->mthca_flags & MTHCA_FLAG_SRQ)
512 mthca_free_icm_table(mdev, mdev->srq_table.table);
513 mthca_free_icm_table(mdev, mdev->cq_table.table);
514 mthca_free_icm_table(mdev, mdev->qp_table.rdb_table);
515 mthca_free_icm_table(mdev, mdev->qp_table.eqp_table);
516 mthca_free_icm_table(mdev, mdev->qp_table.qp_table);
517 mthca_free_icm_table(mdev, mdev->mr_table.mpt_table);
518 mthca_free_icm_table(mdev, mdev->mr_table.mtt_table);
519 mthca_unmap_eq_icm(mdev);
520
521 mthca_UNMAP_ICM_AUX(mdev, &status);
522 mthca_free_icm(mdev, mdev->fw.arbel.aux_icm);
523}
524
506static int __devinit mthca_init_arbel(struct mthca_dev *mdev) 525static int __devinit mthca_init_arbel(struct mthca_dev *mdev)
507{ 526{
508 struct mthca_dev_lim dev_lim; 527 struct mthca_dev_lim dev_lim;
@@ -580,18 +599,7 @@ static int __devinit mthca_init_arbel(struct mthca_dev *mdev)
580 return 0; 599 return 0;
581 600
582err_free_icm: 601err_free_icm:
583 if (mdev->mthca_flags & MTHCA_FLAG_SRQ) 602 mthca_free_icms(mdev);
584 mthca_free_icm_table(mdev, mdev->srq_table.table);
585 mthca_free_icm_table(mdev, mdev->cq_table.table);
586 mthca_free_icm_table(mdev, mdev->qp_table.rdb_table);
587 mthca_free_icm_table(mdev, mdev->qp_table.eqp_table);
588 mthca_free_icm_table(mdev, mdev->qp_table.qp_table);
589 mthca_free_icm_table(mdev, mdev->mr_table.mpt_table);
590 mthca_free_icm_table(mdev, mdev->mr_table.mtt_table);
591 mthca_unmap_eq_icm(mdev);
592
593 mthca_UNMAP_ICM_AUX(mdev, &status);
594 mthca_free_icm(mdev, mdev->fw.arbel.aux_icm);
595 603
596err_stop_fw: 604err_stop_fw:
597 mthca_UNMAP_FA(mdev, &status); 605 mthca_UNMAP_FA(mdev, &status);
@@ -611,18 +619,7 @@ static void mthca_close_hca(struct mthca_dev *mdev)
611 mthca_CLOSE_HCA(mdev, 0, &status); 619 mthca_CLOSE_HCA(mdev, 0, &status);
612 620
613 if (mthca_is_memfree(mdev)) { 621 if (mthca_is_memfree(mdev)) {
614 if (mdev->mthca_flags & MTHCA_FLAG_SRQ) 622 mthca_free_icms(mdev);
615 mthca_free_icm_table(mdev, mdev->srq_table.table);
616 mthca_free_icm_table(mdev, mdev->cq_table.table);
617 mthca_free_icm_table(mdev, mdev->qp_table.rdb_table);
618 mthca_free_icm_table(mdev, mdev->qp_table.eqp_table);
619 mthca_free_icm_table(mdev, mdev->qp_table.qp_table);
620 mthca_free_icm_table(mdev, mdev->mr_table.mpt_table);
621 mthca_free_icm_table(mdev, mdev->mr_table.mtt_table);
622 mthca_unmap_eq_icm(mdev);
623
624 mthca_UNMAP_ICM_AUX(mdev, &status);
625 mthca_free_icm(mdev, mdev->fw.arbel.aux_icm);
626 623
627 mthca_UNMAP_FA(mdev, &status); 624 mthca_UNMAP_FA(mdev, &status);
628 mthca_free_icm(mdev, mdev->fw.arbel.fw_icm); 625 mthca_free_icm(mdev, mdev->fw.arbel.fw_icm);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 704f48e0b6a7..6c5bf07489f4 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -474,7 +474,7 @@ err:
474 spin_unlock(&priv->lock); 474 spin_unlock(&priv->lock);
475} 475}
476 476
477static void path_lookup(struct sk_buff *skb, struct net_device *dev) 477static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev)
478{ 478{
479 struct ipoib_dev_priv *priv = netdev_priv(skb->dev); 479 struct ipoib_dev_priv *priv = netdev_priv(skb->dev);
480 480
@@ -569,7 +569,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
569 569
570 if (skb->dst && skb->dst->neighbour) { 570 if (skb->dst && skb->dst->neighbour) {
571 if (unlikely(!*to_ipoib_neigh(skb->dst->neighbour))) { 571 if (unlikely(!*to_ipoib_neigh(skb->dst->neighbour))) {
572 path_lookup(skb, dev); 572 ipoib_path_lookup(skb, dev);
573 goto out; 573 goto out;
574 } 574 }
575 575
diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c
index e1f0d87de0eb..0b0ea26023e5 100644
--- a/drivers/isdn/divert/divert_procfs.c
+++ b/drivers/isdn/divert/divert_procfs.c
@@ -287,12 +287,12 @@ divert_dev_init(void)
287 init_waitqueue_head(&rd_queue); 287 init_waitqueue_head(&rd_queue);
288 288
289#ifdef CONFIG_PROC_FS 289#ifdef CONFIG_PROC_FS
290 isdn_proc_entry = create_proc_entry("isdn", S_IFDIR | S_IRUGO | S_IXUGO, proc_net); 290 isdn_proc_entry = proc_mkdir("net/isdn", NULL);
291 if (!isdn_proc_entry) 291 if (!isdn_proc_entry)
292 return (-1); 292 return (-1);
293 isdn_divert_entry = create_proc_entry("divert", S_IFREG | S_IRUGO, isdn_proc_entry); 293 isdn_divert_entry = create_proc_entry("divert", S_IFREG | S_IRUGO, isdn_proc_entry);
294 if (!isdn_divert_entry) { 294 if (!isdn_divert_entry) {
295 remove_proc_entry("isdn", proc_net); 295 remove_proc_entry("net/isdn", NULL);
296 return (-1); 296 return (-1);
297 } 297 }
298 isdn_divert_entry->proc_fops = &isdn_fops; 298 isdn_divert_entry->proc_fops = &isdn_fops;
@@ -312,7 +312,7 @@ divert_dev_deinit(void)
312 312
313#ifdef CONFIG_PROC_FS 313#ifdef CONFIG_PROC_FS
314 remove_proc_entry("divert", isdn_proc_entry); 314 remove_proc_entry("divert", isdn_proc_entry);
315 remove_proc_entry("isdn", proc_net); 315 remove_proc_entry("net/isdn", NULL);
316#endif /* CONFIG_PROC_FS */ 316#endif /* CONFIG_PROC_FS */
317 317
318 return (0); 318 return (0);
diff --git a/drivers/isdn/hardware/eicon/diva_didd.c b/drivers/isdn/hardware/eicon/diva_didd.c
index 7fdf8ae5be52..27204f4b111a 100644
--- a/drivers/isdn/hardware/eicon/diva_didd.c
+++ b/drivers/isdn/hardware/eicon/diva_didd.c
@@ -30,8 +30,6 @@ static char *DRIVERNAME =
30static char *DRIVERLNAME = "divadidd"; 30static char *DRIVERLNAME = "divadidd";
31char *DRIVERRELEASE_DIDD = "2.0"; 31char *DRIVERRELEASE_DIDD = "2.0";
32 32
33static char *main_proc_dir = "eicon";
34
35MODULE_DESCRIPTION("DIDD table driver for diva drivers"); 33MODULE_DESCRIPTION("DIDD table driver for diva drivers");
36MODULE_AUTHOR("Cytronics & Melware, Eicon Networks"); 34MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
37MODULE_SUPPORTED_DEVICE("Eicon diva drivers"); 35MODULE_SUPPORTED_DEVICE("Eicon diva drivers");
@@ -89,7 +87,7 @@ proc_read(char *page, char **start, off_t off, int count, int *eof,
89 87
90static int DIVA_INIT_FUNCTION create_proc(void) 88static int DIVA_INIT_FUNCTION create_proc(void)
91{ 89{
92 proc_net_eicon = create_proc_entry(main_proc_dir, S_IFDIR, proc_net); 90 proc_net_eicon = proc_mkdir("net/eicon", NULL);
93 91
94 if (proc_net_eicon) { 92 if (proc_net_eicon) {
95 if ((proc_didd = 93 if ((proc_didd =
@@ -105,7 +103,7 @@ static int DIVA_INIT_FUNCTION create_proc(void)
105static void DIVA_EXIT_FUNCTION remove_proc(void) 103static void DIVA_EXIT_FUNCTION remove_proc(void)
106{ 104{
107 remove_proc_entry(DRIVERLNAME, proc_net_eicon); 105 remove_proc_entry(DRIVERLNAME, proc_net_eicon);
108 remove_proc_entry(main_proc_dir, proc_net); 106 remove_proc_entry("net/eicon", NULL);
109} 107}
110 108
111static int DIVA_INIT_FUNCTION divadidd_init(void) 109static int DIVA_INIT_FUNCTION divadidd_init(void)
diff --git a/drivers/isdn/hardware/eicon/divasproc.c b/drivers/isdn/hardware/eicon/divasproc.c
index b6435589d459..c12efa6f8429 100644
--- a/drivers/isdn/hardware/eicon/divasproc.c
+++ b/drivers/isdn/hardware/eicon/divasproc.c
@@ -381,7 +381,7 @@ int create_adapter_proc(diva_os_xdi_adapter_t * a)
381 char tmp[16]; 381 char tmp[16];
382 382
383 sprintf(tmp, "%s%d", adapter_dir_name, a->controller); 383 sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
384 if (!(de = create_proc_entry(tmp, S_IFDIR, proc_net_eicon))) 384 if (!(de = proc_mkdir(tmp, proc_net_eicon)))
385 return (0); 385 return (0);
386 a->proc_adapter_dir = (void *) de; 386 a->proc_adapter_dir = (void *) de;
387 387
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c
index 5da507e532fc..639582f61f41 100644
--- a/drivers/isdn/hysdn/hysdn_procconf.c
+++ b/drivers/isdn/hysdn/hysdn_procconf.c
@@ -394,7 +394,7 @@ hysdn_procconf_init(void)
394 hysdn_card *card; 394 hysdn_card *card;
395 uchar conf_name[20]; 395 uchar conf_name[20];
396 396
397 hysdn_proc_entry = create_proc_entry(PROC_SUBDIR_NAME, S_IFDIR | S_IRUGO | S_IXUGO, proc_net); 397 hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net);
398 if (!hysdn_proc_entry) { 398 if (!hysdn_proc_entry) {
399 printk(KERN_ERR "HYSDN: unable to create hysdn subdir\n"); 399 printk(KERN_ERR "HYSDN: unable to create hysdn subdir\n");
400 return (-1); 400 return (-1);
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 5f283529620b..34f3c7e2d832 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -153,8 +153,10 @@ static irqreturn_t smu_db_intr(int irq, void *arg, struct pt_regs *regs)
153 spin_lock_irqsave(&smu->lock, flags); 153 spin_lock_irqsave(&smu->lock, flags);
154 154
155 gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, smu->doorbell); 155 gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, smu->doorbell);
156 if ((gpio & 7) != 7) 156 if ((gpio & 7) != 7) {
157 spin_unlock_irqrestore(&smu->lock, flags);
157 return IRQ_HANDLED; 158 return IRQ_HANDLED;
159 }
158 160
159 cmd = smu->cmd_cur; 161 cmd = smu->cmd_cur;
160 smu->cmd_cur = NULL; 162 smu->cmd_cur = NULL;
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index b82bc3150476..b6148f6f7836 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -96,7 +96,7 @@ static kmem_cache_t *_crypt_io_pool;
96/* 96/*
97 * Mempool alloc and free functions for the page 97 * Mempool alloc and free functions for the page
98 */ 98 */
99static void *mempool_alloc_page(unsigned int __nocast gfp_mask, void *data) 99static void *mempool_alloc_page(gfp_t gfp_mask, void *data)
100{ 100{
101 return alloc_page(gfp_mask); 101 return alloc_page(gfp_mask);
102} 102}
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index 9de000131a8a..4809b209fbb1 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -32,7 +32,7 @@ struct io {
32static unsigned _num_ios; 32static unsigned _num_ios;
33static mempool_t *_io_pool; 33static mempool_t *_io_pool;
34 34
35static void *alloc_io(unsigned int __nocast gfp_mask, void *pool_data) 35static void *alloc_io(gfp_t gfp_mask, void *pool_data)
36{ 36{
37 return kmalloc(sizeof(struct io), gfp_mask); 37 return kmalloc(sizeof(struct io), gfp_mask);
38} 38}
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 863282513753..2375709a392c 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -122,7 +122,7 @@ static inline sector_t region_to_sector(struct region_hash *rh, region_t region)
122/* FIXME move this */ 122/* FIXME move this */
123static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw); 123static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw);
124 124
125static void *region_alloc(unsigned int __nocast gfp_mask, void *pool_data) 125static void *region_alloc(gfp_t gfp_mask, void *pool_data)
126{ 126{
127 return kmalloc(sizeof(struct region), gfp_mask); 127 return kmalloc(sizeof(struct region), gfp_mask);
128} 128}
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 286342375fb7..1151c3ed3006 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -38,7 +38,7 @@
38static mdk_personality_t multipath_personality; 38static mdk_personality_t multipath_personality;
39 39
40 40
41static void *mp_pool_alloc(unsigned int __nocast gfp_flags, void *data) 41static void *mp_pool_alloc(gfp_t gfp_flags, void *data)
42{ 42{
43 struct multipath_bh *mpb; 43 struct multipath_bh *mpb;
44 mpb = kmalloc(sizeof(*mpb), gfp_flags); 44 mpb = kmalloc(sizeof(*mpb), gfp_flags);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index a93ca478142a..0e1f148dd41d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -52,7 +52,7 @@ static mdk_personality_t raid1_personality;
52static void unplug_slaves(mddev_t *mddev); 52static void unplug_slaves(mddev_t *mddev);
53 53
54 54
55static void * r1bio_pool_alloc(unsigned int __nocast gfp_flags, void *data) 55static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data)
56{ 56{
57 struct pool_info *pi = data; 57 struct pool_info *pi = data;
58 r1bio_t *r1_bio; 58 r1bio_t *r1_bio;
@@ -79,7 +79,7 @@ static void r1bio_pool_free(void *r1_bio, void *data)
79#define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) 79#define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE)
80#define RESYNC_WINDOW (2048*1024) 80#define RESYNC_WINDOW (2048*1024)
81 81
82static void * r1buf_pool_alloc(unsigned int __nocast gfp_flags, void *data) 82static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data)
83{ 83{
84 struct pool_info *pi = data; 84 struct pool_info *pi = data;
85 struct page *page; 85 struct page *page;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 5bd1e9ec899d..28dd028415e4 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -47,7 +47,7 @@
47 47
48static void unplug_slaves(mddev_t *mddev); 48static void unplug_slaves(mddev_t *mddev);
49 49
50static void * r10bio_pool_alloc(unsigned int __nocast gfp_flags, void *data) 50static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
51{ 51{
52 conf_t *conf = data; 52 conf_t *conf = data;
53 r10bio_t *r10_bio; 53 r10bio_t *r10_bio;
@@ -81,7 +81,7 @@ static void r10bio_pool_free(void *r10_bio, void *data)
81 * one for write (we recover only one drive per r10buf) 81 * one for write (we recover only one drive per r10buf)
82 * 82 *
83 */ 83 */
84static void * r10buf_pool_alloc(unsigned int __nocast gfp_flags, void *data) 84static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data)
85{ 85{
86 conf_t *conf = data; 86 conf_t *conf = data;
87 struct page *page; 87 struct page *page;
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 190977a1e549..0881a17d5226 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -2393,12 +2393,12 @@ struct tvcard bttv_tvcards[] = {
2393 .tuner = 0, 2393 .tuner = 0,
2394 .tuner_type = TUNER_LG_TDVS_H062F, 2394 .tuner_type = TUNER_LG_TDVS_H062F,
2395 .tuner_addr = ADDR_UNSET, 2395 .tuner_addr = ADDR_UNSET,
2396 .video_inputs = 2, 2396 .video_inputs = 3,
2397 .audio_inputs = 1, 2397 .audio_inputs = 1,
2398 .svhs = 2, 2398 .svhs = 2,
2399 .muxsel = { 2, 3 }, 2399 .muxsel = { 2, 3, 1 },
2400 .gpiomask = 0x00e00007, 2400 .gpiomask = 0x00e00007,
2401 .audiomux = { 0x00400005, 0, 0, 0, 0, 0 }, 2401 .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 },
2402 .no_msp34xx = 1, 2402 .no_msp34xx = 1,
2403 .no_tda9875 = 1, 2403 .no_tda9875 = 1,
2404 .no_tda7432 = 1, 2404 .no_tda7432 = 1,
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index 8c08b7f1ad23..b7ec9bf45085 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -1397,7 +1397,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam)
1397 1397
1398static void proc_cpia_create(void) 1398static void proc_cpia_create(void)
1399{ 1399{
1400 cpia_proc_root = create_proc_entry("cpia", S_IFDIR, NULL); 1400 cpia_proc_root = proc_mkdir("cpia", NULL);
1401 1401
1402 if (cpia_proc_root) 1402 if (cpia_proc_root)
1403 cpia_proc_root->owner = THIS_MODULE; 1403 cpia_proc_root->owner = THIS_MODULE;
diff --git a/drivers/media/video/rds.h b/drivers/media/video/rds.h
index 30337d0f1a87..0d30eb744e61 100644
--- a/drivers/media/video/rds.h
+++ b/drivers/media/video/rds.h
@@ -31,7 +31,7 @@
31struct rds_command { 31struct rds_command {
32 unsigned int block_count; 32 unsigned int block_count;
33 int result; 33 int result;
34 unsigned char *buffer; 34 unsigned char __user *buffer;
35 struct file *instance; 35 struct file *instance;
36 poll_table *event_list; 36 poll_table *event_list;
37}; 37};
diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c
index 1a657a70ff43..72b70eb5da1d 100644
--- a/drivers/media/video/saa6588.c
+++ b/drivers/media/video/saa6588.c
@@ -157,7 +157,7 @@ static struct i2c_client client_template;
157 157
158/* ---------------------------------------------------------------------- */ 158/* ---------------------------------------------------------------------- */
159 159
160static int block_to_user_buf(struct saa6588 *s, unsigned char *user_buf) 160static int block_to_user_buf(struct saa6588 *s, unsigned char __user *user_buf)
161{ 161{
162 int i; 162 int i;
163 163
@@ -191,7 +191,7 @@ static void read_from_buf(struct saa6588 *s, struct rds_command *a)
191{ 191{
192 unsigned long flags; 192 unsigned long flags;
193 193
194 unsigned char *buf_ptr = a->buffer; /* This is a user space buffer! */ 194 unsigned char __user *buf_ptr = a->buffer;
195 unsigned int i; 195 unsigned int i;
196 unsigned int rd_blocks; 196 unsigned int rd_blocks;
197 197
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index 10f6ce1bc0ab..e335d54c4659 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -457,6 +457,17 @@ static int ucb1x00_detect_irq(struct ucb1x00 *ucb)
457 return probe_irq_off(mask); 457 return probe_irq_off(mask);
458} 458}
459 459
460static void ucb1x00_release(struct class_device *dev)
461{
462 struct ucb1x00 *ucb = classdev_to_ucb1x00(dev);
463 kfree(ucb);
464}
465
466static struct class ucb1x00_class = {
467 .name = "ucb1x00",
468 .release = ucb1x00_release,
469};
470
460static int ucb1x00_probe(struct mcp *mcp) 471static int ucb1x00_probe(struct mcp *mcp)
461{ 472{
462 struct ucb1x00 *ucb; 473 struct ucb1x00 *ucb;
@@ -546,17 +557,6 @@ static void ucb1x00_remove(struct mcp *mcp)
546 class_device_unregister(&ucb->cdev); 557 class_device_unregister(&ucb->cdev);
547} 558}
548 559
549static void ucb1x00_release(struct class_device *dev)
550{
551 struct ucb1x00 *ucb = classdev_to_ucb1x00(dev);
552 kfree(ucb);
553}
554
555static struct class ucb1x00_class = {
556 .name = "ucb1x00",
557 .release = ucb1x00_release,
558};
559
560int ucb1x00_register_driver(struct ucb1x00_driver *drv) 560int ucb1x00_register_driver(struct ucb1x00_driver *drv)
561{ 561{
562 struct ucb1x00 *ucb; 562 struct ucb1x00 *ucb;
@@ -642,8 +642,6 @@ static void __exit ucb1x00_exit(void)
642module_init(ucb1x00_init); 642module_init(ucb1x00_init);
643module_exit(ucb1x00_exit); 643module_exit(ucb1x00_exit);
644 644
645EXPORT_SYMBOL(ucb1x00_class);
646
647EXPORT_SYMBOL(ucb1x00_io_set_dir); 645EXPORT_SYMBOL(ucb1x00_io_set_dir);
648EXPORT_SYMBOL(ucb1x00_io_write); 646EXPORT_SYMBOL(ucb1x00_io_write);
649EXPORT_SYMBOL(ucb1x00_io_read); 647EXPORT_SYMBOL(ucb1x00_io_read);
diff --git a/drivers/mfd/ucb1x00.h b/drivers/mfd/ucb1x00.h
index 6b632644f59a..9c9a647d8b7b 100644
--- a/drivers/mfd/ucb1x00.h
+++ b/drivers/mfd/ucb1x00.h
@@ -106,8 +106,6 @@ struct ucb1x00_irq {
106 void (*fn)(int, void *); 106 void (*fn)(int, void *);
107}; 107};
108 108
109extern struct class ucb1x00_class;
110
111struct ucb1x00 { 109struct ucb1x00 {
112 spinlock_t lock; 110 spinlock_t lock;
113 struct mcp *mcp; 111 struct mcp *mcp;
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c
index 0c45464e3f7b..0ba0ff7d43b9 100644
--- a/drivers/mtd/maps/bast-flash.c
+++ b/drivers/mtd/maps/bast-flash.c
@@ -39,7 +39,6 @@
39#include <linux/mtd/partitions.h> 39#include <linux/mtd/partitions.h>
40 40
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/mach-types.h>
43#include <asm/mach/flash.h> 42#include <asm/mach/flash.h>
44 43
45#include <asm/arch/map.h> 44#include <asm/arch/map.h>
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index 3e94b616743d..a9f86c7fbd52 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -30,7 +30,6 @@
30 30
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/hardware.h> 32#include <asm/hardware.h>
33#include <asm/mach-types.h>
34#include <asm/mach/flash.h> 33#include <asm/mach/flash.h>
35 34
36#include <linux/reboot.h> 35#include <linux/reboot.h>
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 5afe660aa2c4..3fcc32884074 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -26,7 +26,6 @@
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/mach-types.h>
30#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
31 30
32#include <linux/reboot.h> 31#include <linux/reboot.h>
@@ -254,6 +253,6 @@ module_init(ixp4xx_flash_init);
254module_exit(ixp4xx_flash_exit); 253module_exit(ixp4xx_flash_exit);
255 254
256MODULE_LICENSE("GPL"); 255MODULE_LICENSE("GPL");
257MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems") 256MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems");
258MODULE_AUTHOR("Deepak Saxena"); 257MODULE_AUTHOR("Deepak Saxena");
259 258
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
index 8cc71409a328..b17bca657daf 100644
--- a/drivers/mtd/maps/omap_nor.c
+++ b/drivers/mtd/maps/omap_nor.c
@@ -42,7 +42,6 @@
42 42
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/hardware.h> 44#include <asm/hardware.h>
45#include <asm/mach-types.h>
46#include <asm/mach/flash.h> 45#include <asm/mach/flash.h>
47#include <asm/arch/tc.h> 46#include <asm/arch/tc.h>
48 47
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 52385705da09..8dcaa357b4bb 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -21,7 +21,6 @@
21#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
22#include <linux/mtd/concat.h> 22#include <linux/mtd/concat.h>
23 23
24#include <asm/mach-types.h>
25#include <asm/io.h> 24#include <asm/io.h>
26#include <asm/sizes.h> 25#include <asm/sizes.h>
27#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 891e3a1b9110..b47ebcb31e0f 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -58,7 +58,6 @@
58#include <linux/mtd/partitions.h> 58#include <linux/mtd/partitions.h>
59 59
60#include <asm/io.h> 60#include <asm/io.h>
61#include <asm/mach-types.h>
62#include <asm/hardware/clock.h> 61#include <asm/hardware/clock.h>
63 62
64#include <asm/arch/regs-nand.h> 63#include <asm/arch/regs-nand.h>
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 96f14ab1c1f5..c748b0e16419 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -548,6 +548,14 @@ config SUNGEM
548 Support for the Sun GEM chip, aka Sun GigabitEthernet/P 2.0. See also 548 Support for the Sun GEM chip, aka Sun GigabitEthernet/P 2.0. See also
549 <http://www.sun.com/products-n-solutions/hardware/docs/pdf/806-3985-10.pdf>. 549 <http://www.sun.com/products-n-solutions/hardware/docs/pdf/806-3985-10.pdf>.
550 550
551config CASSINI
552 tristate "Sun Cassini support"
553 depends on NET_ETHERNET && PCI
554 select CRC32
555 help
556 Support for the Sun Cassini chip, aka Sun GigaSwift Ethernet. See also
557 <http://www.sun.com/products-n-solutions/hardware/docs/pdf/817-4341-10.pdf>
558
551config NET_VENDOR_3COM 559config NET_VENDOR_3COM
552 bool "3COM cards" 560 bool "3COM cards"
553 depends on NET_ETHERNET && (ISA || EISA || MCA || PCI) 561 depends on NET_ETHERNET && (ISA || EISA || MCA || PCI)
@@ -1647,7 +1655,7 @@ config LAN_SAA9730
1647 1655
1648config NET_POCKET 1656config NET_POCKET
1649 bool "Pocket and portable adapters" 1657 bool "Pocket and portable adapters"
1650 depends on NET_ETHERNET && ISA 1658 depends on NET_ETHERNET && PARPORT
1651 ---help--- 1659 ---help---
1652 Cute little network (Ethernet) devices which attach to the parallel 1660 Cute little network (Ethernet) devices which attach to the parallel
1653 port ("pocket adapters"), commonly used with laptops. If you have 1661 port ("pocket adapters"), commonly used with laptops. If you have
@@ -1671,7 +1679,7 @@ config NET_POCKET
1671 1679
1672config ATP 1680config ATP
1673 tristate "AT-LAN-TEC/RealTek pocket adapter support" 1681 tristate "AT-LAN-TEC/RealTek pocket adapter support"
1674 depends on NET_POCKET && ISA && X86 1682 depends on NET_POCKET && PARPORT && X86
1675 select CRC32 1683 select CRC32
1676 ---help--- 1684 ---help---
1677 This is a network (Ethernet) device which attaches to your parallel 1685 This is a network (Ethernet) device which attaches to your parallel
@@ -1686,7 +1694,7 @@ config ATP
1686 1694
1687config DE600 1695config DE600
1688 tristate "D-Link DE600 pocket adapter support" 1696 tristate "D-Link DE600 pocket adapter support"
1689 depends on NET_POCKET && ISA 1697 depends on NET_POCKET && PARPORT
1690 ---help--- 1698 ---help---
1691 This is a network (Ethernet) device which attaches to your parallel 1699 This is a network (Ethernet) device which attaches to your parallel
1692 port. Read <file:Documentation/networking/DLINK.txt> as well as the 1700 port. Read <file:Documentation/networking/DLINK.txt> as well as the
@@ -1701,7 +1709,7 @@ config DE600
1701 1709
1702config DE620 1710config DE620
1703 tristate "D-Link DE620 pocket adapter support" 1711 tristate "D-Link DE620 pocket adapter support"
1704 depends on NET_POCKET && ISA 1712 depends on NET_POCKET && PARPORT
1705 ---help--- 1713 ---help---
1706 This is a network (Ethernet) device which attaches to your parallel 1714 This is a network (Ethernet) device which attaches to your parallel
1707 port. Read <file:Documentation/networking/DLINK.txt> as well as the 1715 port. Read <file:Documentation/networking/DLINK.txt> as well as the
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 8645c843cf4d..8aeec9f2495b 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_SUNQE) += sunqe.o
28obj-$(CONFIG_SUNBMAC) += sunbmac.o 28obj-$(CONFIG_SUNBMAC) += sunbmac.o
29obj-$(CONFIG_MYRI_SBUS) += myri_sbus.o 29obj-$(CONFIG_MYRI_SBUS) += myri_sbus.o
30obj-$(CONFIG_SUNGEM) += sungem.o sungem_phy.o 30obj-$(CONFIG_SUNGEM) += sungem.o sungem_phy.o
31obj-$(CONFIG_CASSINI) += cassini.o
31 32
32obj-$(CONFIG_MACE) += mace.o 33obj-$(CONFIG_MACE) += mace.o
33obj-$(CONFIG_BMAC) += bmac.o 34obj-$(CONFIG_BMAC) += bmac.o
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 9b659e3c8d67..c56d86d371a9 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -15,16 +15,13 @@
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/fcntl.h>
19#include <linux/interrupt.h> 18#include <linux/interrupt.h>
20#include <linux/ioport.h> 19#include <linux/ioport.h>
21#include <linux/in.h>
22#include <linux/slab.h> 20#include <linux/slab.h>
23#include <linux/string.h> 21#include <linux/string.h>
24#include <linux/errno.h> 22#include <linux/errno.h>
25#include <linux/netdevice.h> 23#include <linux/netdevice.h>
26#include <linux/etherdevice.h> 24#include <linux/etherdevice.h>
27#include <linux/skbuff.h>
28#include <linux/delay.h> 25#include <linux/delay.h>
29#include <linux/init.h> 26#include <linux/init.h>
30#include <linux/crc32.h> 27#include <linux/crc32.h>
@@ -33,7 +30,6 @@
33#include <asm/system.h> 30#include <asm/system.h>
34#include <asm/irq.h> 31#include <asm/irq.h>
35#include <asm/io.h> 32#include <asm/io.h>
36#include <asm/dma.h>
37 33
38#define TX_BUFFERS 15 34#define TX_BUFFERS 15
39#define RX_BUFFERS 25 35#define RX_BUFFERS 25
@@ -85,7 +81,7 @@ static inline unsigned short read_ireg(u_long base_addr, u_int reg)
85 u_short v; 81 u_short v;
86 __asm__( 82 __asm__(
87 "str%?h %1, [%2] @ NAT_RAP\n\t" 83 "str%?h %1, [%2] @ NAT_RAP\n\t"
88 "str%?h %0, [%2, #8] @ NET_IDP\n\t" 84 "ldr%?h %0, [%2, #8] @ NET_IDP\n\t"
89 : "=r" (v) 85 : "=r" (v)
90 : "r" (reg), "r" (ISAIO_BASE + 0x0464)); 86 : "r" (reg), "r" (ISAIO_BASE + 0x0464));
91 return v; 87 return v;
@@ -288,7 +284,7 @@ static void am79c961_timer(unsigned long data)
288 else if (!lnkstat && carrier) 284 else if (!lnkstat && carrier)
289 netif_carrier_off(dev); 285 netif_carrier_off(dev);
290 286
291 mod_timer(&priv->timer, jiffies + 5*HZ); 287 mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500));
292} 288}
293 289
294/* 290/*
@@ -709,13 +705,9 @@ static int __init am79c961_init(void)
709 goto release; 705 goto release;
710 706
711 am79c961_banner(); 707 am79c961_banner();
712 printk(KERN_INFO "%s: ether address ", dev->name);
713 708
714 /* Retrive and print the ethernet address. */ 709 for (i = 0; i < 6; i++)
715 for (i = 0; i < 6; i++) {
716 dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff; 710 dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff;
717 printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]);
718 }
719 711
720 spin_lock_init(&priv->chip_lock); 712 spin_lock_init(&priv->chip_lock);
721 init_timer(&priv->timer); 713 init_timer(&priv->timer);
@@ -736,8 +728,14 @@ static int __init am79c961_init(void)
736#endif 728#endif
737 729
738 ret = register_netdev(dev); 730 ret = register_netdev(dev);
739 if (ret == 0) 731 if (ret == 0) {
732 printk(KERN_INFO "%s: ether address ", dev->name);
733
734 for (i = 0; i < 6; i++)
735 printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]);
736
740 return 0; 737 return 0;
738 }
741 739
742release: 740release:
743 release_region(dev->base_addr, 0x18); 741 release_region(dev->base_addr, 0x18);
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 8dc657fc8afb..60dba4a1ca5c 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -218,7 +218,7 @@ void bmwrite(struct net_device *dev, unsigned long reg_offset, unsigned data )
218 218
219 219
220static inline 220static inline
221volatile unsigned short bmread(struct net_device *dev, unsigned long reg_offset ) 221unsigned short bmread(struct net_device *dev, unsigned long reg_offset )
222{ 222{
223 return in_le16((void __iomem *)dev->base_addr + reg_offset); 223 return in_le16((void __iomem *)dev->base_addr + reg_offset);
224} 224}
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6d00c3de1a83..f264ff162979 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -487,6 +487,8 @@
487 * * Added xmit_hash_policy_layer34() 487 * * Added xmit_hash_policy_layer34()
488 * - Modified by Jay Vosburgh <fubar@us.ibm.com> to also support mode 4. 488 * - Modified by Jay Vosburgh <fubar@us.ibm.com> to also support mode 4.
489 * Set version to 2.6.3. 489 * Set version to 2.6.3.
490 * 2005/09/26 - Jay Vosburgh <fubar@us.ibm.com>
491 * - Removed backwards compatibility for old ifenslaves. Version 2.6.4.
490 */ 492 */
491 493
492//#define BONDING_DEBUG 1 494//#define BONDING_DEBUG 1
@@ -595,14 +597,7 @@ static int arp_ip_count = 0;
595static int bond_mode = BOND_MODE_ROUNDROBIN; 597static int bond_mode = BOND_MODE_ROUNDROBIN;
596static int xmit_hashtype= BOND_XMIT_POLICY_LAYER2; 598static int xmit_hashtype= BOND_XMIT_POLICY_LAYER2;
597static int lacp_fast = 0; 599static int lacp_fast = 0;
598static int app_abi_ver = 0; 600
599static int orig_app_abi_ver = -1; /* This is used to save the first ABI version
600 * we receive from the application. Once set,
601 * it won't be changed, and the module will
602 * refuse to enslave/release interfaces if the
603 * command comes from an application using
604 * another ABI version.
605 */
606struct bond_parm_tbl { 601struct bond_parm_tbl {
607 char *modename; 602 char *modename;
608 int mode; 603 int mode;
@@ -1294,12 +1289,13 @@ static void bond_mc_list_destroy(struct bonding *bond)
1294/* 1289/*
1295 * Copy all the Multicast addresses from src to the bonding device dst 1290 * Copy all the Multicast addresses from src to the bonding device dst
1296 */ 1291 */
1297static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, int gpf_flag) 1292static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond,
1293 gfp_t gfp_flag)
1298{ 1294{
1299 struct dev_mc_list *dmi, *new_dmi; 1295 struct dev_mc_list *dmi, *new_dmi;
1300 1296
1301 for (dmi = mc_list; dmi; dmi = dmi->next) { 1297 for (dmi = mc_list; dmi; dmi = dmi->next) {
1302 new_dmi = kmalloc(sizeof(struct dev_mc_list), gpf_flag); 1298 new_dmi = kmalloc(sizeof(struct dev_mc_list), gfp_flag);
1303 1299
1304 if (!new_dmi) { 1300 if (!new_dmi) {
1305 /* FIXME: Potential memory leak !!! */ 1301 /* FIXME: Potential memory leak !!! */
@@ -1702,51 +1698,29 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de
1702 } 1698 }
1703 } 1699 }
1704 1700
1705 if (app_abi_ver >= 1) { 1701 /*
1706 /* The application is using an ABI, which requires the 1702 * Old ifenslave binaries are no longer supported. These can
1707 * slave interface to be closed. 1703 * be identified with moderate accurary by the state of the slave:
1708 */ 1704 * the current ifenslave will set the interface down prior to
1709 if ((slave_dev->flags & IFF_UP)) { 1705 * enslaving it; the old ifenslave will not.
1710 printk(KERN_ERR DRV_NAME 1706 */
1711 ": Error: %s is up\n", 1707 if ((slave_dev->flags & IFF_UP)) {
1712 slave_dev->name); 1708 printk(KERN_ERR DRV_NAME ": %s is up. "
1713 res = -EPERM; 1709 "This may be due to an out of date ifenslave.\n",
1714 goto err_undo_flags; 1710 slave_dev->name);
1715 } 1711 res = -EPERM;
1716 1712 goto err_undo_flags;
1717 if (slave_dev->set_mac_address == NULL) { 1713 }
1718 printk(KERN_ERR DRV_NAME
1719 ": Error: The slave device you specified does "
1720 "not support setting the MAC address.\n");
1721 printk(KERN_ERR
1722 "Your kernel likely does not support slave "
1723 "devices.\n");
1724 1714
1725 res = -EOPNOTSUPP; 1715 if (slave_dev->set_mac_address == NULL) {
1726 goto err_undo_flags; 1716 printk(KERN_ERR DRV_NAME
1727 } 1717 ": Error: The slave device you specified does "
1728 } else { 1718 "not support setting the MAC address.\n");
1729 /* The application is not using an ABI, which requires the 1719 printk(KERN_ERR
1730 * slave interface to be open. 1720 "Your kernel likely does not support slave devices.\n");
1731 */
1732 if (!(slave_dev->flags & IFF_UP)) {
1733 printk(KERN_ERR DRV_NAME
1734 ": Error: %s is not running\n",
1735 slave_dev->name);
1736 res = -EINVAL;
1737 goto err_undo_flags;
1738 }
1739 1721
1740 if ((bond->params.mode == BOND_MODE_8023AD) || 1722 res = -EOPNOTSUPP;
1741 (bond->params.mode == BOND_MODE_TLB) || 1723 goto err_undo_flags;
1742 (bond->params.mode == BOND_MODE_ALB)) {
1743 printk(KERN_ERR DRV_NAME
1744 ": Error: to use %s mode, you must upgrade "
1745 "ifenslave.\n",
1746 bond_mode_name(bond->params.mode));
1747 res = -EOPNOTSUPP;
1748 goto err_undo_flags;
1749 }
1750 } 1724 }
1751 1725
1752 new_slave = kmalloc(sizeof(struct slave), GFP_KERNEL); 1726 new_slave = kmalloc(sizeof(struct slave), GFP_KERNEL);
@@ -1762,41 +1736,36 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de
1762 */ 1736 */
1763 new_slave->original_flags = slave_dev->flags; 1737 new_slave->original_flags = slave_dev->flags;
1764 1738
1765 if (app_abi_ver >= 1) { 1739 /*
1766 /* save slave's original ("permanent") mac address for 1740 * Save slave's original ("permanent") mac address for modes
1767 * modes that needs it, and for restoring it upon release, 1741 * that need it, and for restoring it upon release, and then
1768 * and then set it to the master's address 1742 * set it to the master's address
1769 */ 1743 */
1770 memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN); 1744 memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN);
1771 1745
1772 /* set slave to master's mac address 1746 /*
1773 * The application already set the master's 1747 * Set slave to master's mac address. The application already
1774 * mac address to that of the first slave 1748 * set the master's mac address to that of the first slave
1775 */ 1749 */
1776 memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); 1750 memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len);
1777 addr.sa_family = slave_dev->type; 1751 addr.sa_family = slave_dev->type;
1778 res = dev_set_mac_address(slave_dev, &addr); 1752 res = dev_set_mac_address(slave_dev, &addr);
1779 if (res) { 1753 if (res) {
1780 dprintk("Error %d calling set_mac_address\n", res); 1754 dprintk("Error %d calling set_mac_address\n", res);
1781 goto err_free; 1755 goto err_free;
1782 } 1756 }
1783 1757
1784 /* open the slave since the application closed it */ 1758 /* open the slave since the application closed it */
1785 res = dev_open(slave_dev); 1759 res = dev_open(slave_dev);
1786 if (res) { 1760 if (res) {
1787 dprintk("Openning slave %s failed\n", slave_dev->name); 1761 dprintk("Openning slave %s failed\n", slave_dev->name);
1788 goto err_restore_mac; 1762 goto err_restore_mac;
1789 }
1790 } 1763 }
1791 1764
1792 res = netdev_set_master(slave_dev, bond_dev); 1765 res = netdev_set_master(slave_dev, bond_dev);
1793 if (res) { 1766 if (res) {
1794 dprintk("Error %d calling netdev_set_master\n", res); 1767 dprintk("Error %d calling netdev_set_master\n", res);
1795 if (app_abi_ver < 1) { 1768 goto err_close;
1796 goto err_free;
1797 } else {
1798 goto err_close;
1799 }
1800 } 1769 }
1801 1770
1802 new_slave->dev = slave_dev; 1771 new_slave->dev = slave_dev;
@@ -1997,39 +1966,6 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de
1997 1966
1998 write_unlock_bh(&bond->lock); 1967 write_unlock_bh(&bond->lock);
1999 1968
2000 if (app_abi_ver < 1) {
2001 /*
2002 * !!! This is to support old versions of ifenslave.
2003 * We can remove this in 2.5 because our ifenslave takes
2004 * care of this for us.
2005 * We check to see if the master has a mac address yet.
2006 * If not, we'll give it the mac address of our slave device.
2007 */
2008 int ndx = 0;
2009
2010 for (ndx = 0; ndx < bond_dev->addr_len; ndx++) {
2011 dprintk("Checking ndx=%d of bond_dev->dev_addr\n",
2012 ndx);
2013 if (bond_dev->dev_addr[ndx] != 0) {
2014 dprintk("Found non-zero byte at ndx=%d\n",
2015 ndx);
2016 break;
2017 }
2018 }
2019
2020 if (ndx == bond_dev->addr_len) {
2021 /*
2022 * We got all the way through the address and it was
2023 * all 0's.
2024 */
2025 dprintk("%s doesn't have a MAC address yet. \n",
2026 bond_dev->name);
2027 dprintk("Going to give assign it from %s.\n",
2028 slave_dev->name);
2029 bond_sethwaddr(bond_dev, slave_dev);
2030 }
2031 }
2032
2033 printk(KERN_INFO DRV_NAME 1969 printk(KERN_INFO DRV_NAME
2034 ": %s: enslaving %s as a%s interface with a%s link.\n", 1970 ": %s: enslaving %s as a%s interface with a%s link.\n",
2035 bond_dev->name, slave_dev->name, 1971 bond_dev->name, slave_dev->name,
@@ -2227,12 +2163,10 @@ static int bond_release(struct net_device *bond_dev, struct net_device *slave_de
2227 /* close slave before restoring its mac address */ 2163 /* close slave before restoring its mac address */
2228 dev_close(slave_dev); 2164 dev_close(slave_dev);
2229 2165
2230 if (app_abi_ver >= 1) { 2166 /* restore original ("permanent") mac address */
2231 /* restore original ("permanent") mac address */ 2167 memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
2232 memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); 2168 addr.sa_family = slave_dev->type;
2233 addr.sa_family = slave_dev->type; 2169 dev_set_mac_address(slave_dev, &addr);
2234 dev_set_mac_address(slave_dev, &addr);
2235 }
2236 2170
2237 /* restore the original state of the 2171 /* restore the original state of the
2238 * IFF_NOARP flag that might have been 2172 * IFF_NOARP flag that might have been
@@ -2320,12 +2254,10 @@ static int bond_release_all(struct net_device *bond_dev)
2320 /* close slave before restoring its mac address */ 2254 /* close slave before restoring its mac address */
2321 dev_close(slave_dev); 2255 dev_close(slave_dev);
2322 2256
2323 if (app_abi_ver >= 1) { 2257 /* restore original ("permanent") mac address*/
2324 /* restore original ("permanent") mac address*/ 2258 memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
2325 memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); 2259 addr.sa_family = slave_dev->type;
2326 addr.sa_family = slave_dev->type; 2260 dev_set_mac_address(slave_dev, &addr);
2327 dev_set_mac_address(slave_dev, &addr);
2328 }
2329 2261
2330 /* restore the original state of the IFF_NOARP flag that might have 2262 /* restore the original state of the IFF_NOARP flag that might have
2331 * been set by bond_set_slave_inactive_flags() 2263 * been set by bond_set_slave_inactive_flags()
@@ -2423,57 +2355,6 @@ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_devi
2423 return res; 2355 return res;
2424} 2356}
2425 2357
2426static int bond_ethtool_ioctl(struct net_device *bond_dev, struct ifreq *ifr)
2427{
2428 struct ethtool_drvinfo info;
2429 void __user *addr = ifr->ifr_data;
2430 uint32_t cmd;
2431
2432 if (get_user(cmd, (uint32_t __user *)addr)) {
2433 return -EFAULT;
2434 }
2435
2436 switch (cmd) {
2437 case ETHTOOL_GDRVINFO:
2438 if (copy_from_user(&info, addr, sizeof(info))) {
2439 return -EFAULT;
2440 }
2441
2442 if (strcmp(info.driver, "ifenslave") == 0) {
2443 int new_abi_ver;
2444 char *endptr;
2445
2446 new_abi_ver = simple_strtoul(info.fw_version,
2447 &endptr, 0);
2448 if (*endptr) {
2449 printk(KERN_ERR DRV_NAME
2450 ": Error: got invalid ABI "
2451 "version from application\n");
2452
2453 return -EINVAL;
2454 }
2455
2456 if (orig_app_abi_ver == -1) {
2457 orig_app_abi_ver = new_abi_ver;
2458 }
2459
2460 app_abi_ver = new_abi_ver;
2461 }
2462
2463 strncpy(info.driver, DRV_NAME, 32);
2464 strncpy(info.version, DRV_VERSION, 32);
2465 snprintf(info.fw_version, 32, "%d", BOND_ABI_VERSION);
2466
2467 if (copy_to_user(addr, &info, sizeof(info))) {
2468 return -EFAULT;
2469 }
2470
2471 return 0;
2472 default:
2473 return -EOPNOTSUPP;
2474 }
2475}
2476
2477static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) 2358static int bond_info_query(struct net_device *bond_dev, struct ifbond *info)
2478{ 2359{
2479 struct bonding *bond = bond_dev->priv; 2360 struct bonding *bond = bond_dev->priv;
@@ -2776,7 +2657,7 @@ static u32 bond_glean_dev_ip(struct net_device *dev)
2776 return 0; 2657 return 0;
2777 2658
2778 rcu_read_lock(); 2659 rcu_read_lock();
2779 idev = __in_dev_get(dev); 2660 idev = __in_dev_get_rcu(dev);
2780 if (!idev) 2661 if (!idev)
2781 goto out; 2662 goto out;
2782 2663
@@ -3442,16 +3323,11 @@ static void bond_info_show_slave(struct seq_file *seq, const struct slave *slave
3442 seq_printf(seq, "Link Failure Count: %d\n", 3323 seq_printf(seq, "Link Failure Count: %d\n",
3443 slave->link_failure_count); 3324 slave->link_failure_count);
3444 3325
3445 if (app_abi_ver >= 1) { 3326 seq_printf(seq,
3446 seq_printf(seq, 3327 "Permanent HW addr: %02x:%02x:%02x:%02x:%02x:%02x\n",
3447 "Permanent HW addr: %02x:%02x:%02x:%02x:%02x:%02x\n", 3328 slave->perm_hwaddr[0], slave->perm_hwaddr[1],
3448 slave->perm_hwaddr[0], 3329 slave->perm_hwaddr[2], slave->perm_hwaddr[3],
3449 slave->perm_hwaddr[1], 3330 slave->perm_hwaddr[4], slave->perm_hwaddr[5]);
3450 slave->perm_hwaddr[2],
3451 slave->perm_hwaddr[3],
3452 slave->perm_hwaddr[4],
3453 slave->perm_hwaddr[5]);
3454 }
3455 3331
3456 if (bond->params.mode == BOND_MODE_8023AD) { 3332 if (bond->params.mode == BOND_MODE_8023AD) {
3457 const struct aggregator *agg 3333 const struct aggregator *agg
@@ -4010,15 +3886,12 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
4010 struct ifslave k_sinfo; 3886 struct ifslave k_sinfo;
4011 struct ifslave __user *u_sinfo = NULL; 3887 struct ifslave __user *u_sinfo = NULL;
4012 struct mii_ioctl_data *mii = NULL; 3888 struct mii_ioctl_data *mii = NULL;
4013 int prev_abi_ver = orig_app_abi_ver;
4014 int res = 0; 3889 int res = 0;
4015 3890
4016 dprintk("bond_ioctl: master=%s, cmd=%d\n", 3891 dprintk("bond_ioctl: master=%s, cmd=%d\n",
4017 bond_dev->name, cmd); 3892 bond_dev->name, cmd);
4018 3893
4019 switch (cmd) { 3894 switch (cmd) {
4020 case SIOCETHTOOL:
4021 return bond_ethtool_ioctl(bond_dev, ifr);
4022 case SIOCGMIIPHY: 3895 case SIOCGMIIPHY:
4023 mii = if_mii(ifr); 3896 mii = if_mii(ifr);
4024 if (!mii) { 3897 if (!mii) {
@@ -4090,21 +3963,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
4090 return -EPERM; 3963 return -EPERM;
4091 } 3964 }
4092 3965
4093 if (orig_app_abi_ver == -1) {
4094 /* no orig_app_abi_ver was provided yet, so we'll use the
4095 * current one from now on, even if it's 0
4096 */
4097 orig_app_abi_ver = app_abi_ver;
4098
4099 } else if (orig_app_abi_ver != app_abi_ver) {
4100 printk(KERN_ERR DRV_NAME
4101 ": Error: already using ifenslave ABI version %d; to "
4102 "upgrade ifenslave to version %d, you must first "
4103 "reload bonding.\n",
4104 orig_app_abi_ver, app_abi_ver);
4105 return -EINVAL;
4106 }
4107
4108 slave_dev = dev_get_by_name(ifr->ifr_slave); 3966 slave_dev = dev_get_by_name(ifr->ifr_slave);
4109 3967
4110 dprintk("slave_dev=%p: \n", slave_dev); 3968 dprintk("slave_dev=%p: \n", slave_dev);
@@ -4137,14 +3995,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
4137 dev_put(slave_dev); 3995 dev_put(slave_dev);
4138 } 3996 }
4139 3997
4140 if (res < 0) {
4141 /* The ioctl failed, so there's no point in changing the
4142 * orig_app_abi_ver. We'll restore it's value just in case
4143 * we've changed it earlier in this function.
4144 */
4145 orig_app_abi_ver = prev_abi_ver;
4146 }
4147
4148 return res; 3998 return res;
4149} 3999}
4150 4000
@@ -4578,9 +4428,18 @@ static inline void bond_set_mode_ops(struct bonding *bond, int mode)
4578 } 4428 }
4579} 4429}
4580 4430
4431static void bond_ethtool_get_drvinfo(struct net_device *bond_dev,
4432 struct ethtool_drvinfo *drvinfo)
4433{
4434 strncpy(drvinfo->driver, DRV_NAME, 32);
4435 strncpy(drvinfo->version, DRV_VERSION, 32);
4436 snprintf(drvinfo->fw_version, 32, "%d", BOND_ABI_VERSION);
4437}
4438
4581static struct ethtool_ops bond_ethtool_ops = { 4439static struct ethtool_ops bond_ethtool_ops = {
4582 .get_tx_csum = ethtool_op_get_tx_csum, 4440 .get_tx_csum = ethtool_op_get_tx_csum,
4583 .get_sg = ethtool_op_get_sg, 4441 .get_sg = ethtool_op_get_sg,
4442 .get_drvinfo = bond_ethtool_get_drvinfo,
4584}; 4443};
4585 4444
4586/* 4445/*
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 388196980862..bbf9da8af624 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -40,8 +40,8 @@
40#include "bond_3ad.h" 40#include "bond_3ad.h"
41#include "bond_alb.h" 41#include "bond_alb.h"
42 42
43#define DRV_VERSION "2.6.3" 43#define DRV_VERSION "2.6.4"
44#define DRV_RELDATE "June 8, 2005" 44#define DRV_RELDATE "September 26, 2005"
45#define DRV_NAME "bonding" 45#define DRV_NAME "bonding"
46#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" 46#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
47 47
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
new file mode 100644
index 000000000000..2e617424d3fb
--- /dev/null
+++ b/drivers/net/cassini.c
@@ -0,0 +1,5237 @@
1/* cassini.c: Sun Microsystems Cassini(+) ethernet driver.
2 *
3 * Copyright (C) 2004 Sun Microsystems Inc.
4 * Copyright (C) 2003 Adrian Sun (asun@darksunrising.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 * 02111-1307, USA.
20 *
21 * This driver uses the sungem driver (c) David Miller
22 * (davem@redhat.com) as its basis.
23 *
24 * The cassini chip has a number of features that distinguish it from
25 * the gem chip:
26 * 4 transmit descriptor rings that are used for either QoS (VLAN) or
27 * load balancing (non-VLAN mode)
28 * batching of multiple packets
29 * multiple CPU dispatching
30 * page-based RX descriptor engine with separate completion rings
31 * Gigabit support (GMII and PCS interface)
32 * MIF link up/down detection works
33 *
34 * RX is handled by page sized buffers that are attached as fragments to
35 * the skb. here's what's done:
36 * -- driver allocates pages at a time and keeps reference counts
37 * on them.
38 * -- the upper protocol layers assume that the header is in the skb
39 * itself. as a result, cassini will copy a small amount (64 bytes)
40 * to make them happy.
41 * -- driver appends the rest of the data pages as frags to skbuffs
42 * and increments the reference count
43 * -- on page reclamation, the driver swaps the page with a spare page.
44 * if that page is still in use, it frees its reference to that page,
45 * and allocates a new page for use. otherwise, it just recycles the
46 * the page.
47 *
48 * NOTE: cassini can parse the header. however, it's not worth it
49 * as long as the network stack requires a header copy.
50 *
51 * TX has 4 queues. currently these queues are used in a round-robin
52 * fashion for load balancing. They can also be used for QoS. for that
53 * to work, however, QoS information needs to be exposed down to the driver
54 * level so that subqueues get targetted to particular transmit rings.
55 * alternatively, the queues can be configured via use of the all-purpose
56 * ioctl.
57 *
58 * RX DATA: the rx completion ring has all the info, but the rx desc
59 * ring has all of the data. RX can conceivably come in under multiple
60 * interrupts, but the INT# assignment needs to be set up properly by
61 * the BIOS and conveyed to the driver. PCI BIOSes don't know how to do
62 * that. also, the two descriptor rings are designed to distinguish between
63 * encrypted and non-encrypted packets, but we use them for buffering
64 * instead.
65 *
66 * by default, the selective clear mask is set up to process rx packets.
67 */
68
69#include <linux/config.h>
70#include <linux/version.h>
71
72#include <linux/module.h>
73#include <linux/kernel.h>
74#include <linux/types.h>
75#include <linux/compiler.h>
76#include <linux/slab.h>
77#include <linux/delay.h>
78#include <linux/init.h>
79#include <linux/ioport.h>
80#include <linux/pci.h>
81#include <linux/mm.h>
82#include <linux/highmem.h>
83#include <linux/list.h>
84#include <linux/dma-mapping.h>
85
86#include <linux/netdevice.h>
87#include <linux/etherdevice.h>
88#include <linux/skbuff.h>
89#include <linux/ethtool.h>
90#include <linux/crc32.h>
91#include <linux/random.h>
92#include <linux/mii.h>
93#include <linux/ip.h>
94#include <linux/tcp.h>
95
96#include <net/checksum.h>
97
98#include <asm/atomic.h>
99#include <asm/system.h>
100#include <asm/io.h>
101#include <asm/byteorder.h>
102#include <asm/uaccess.h>
103
104#define cas_page_map(x) kmap_atomic((x), KM_SKB_DATA_SOFTIRQ)
105#define cas_page_unmap(x) kunmap_atomic((x), KM_SKB_DATA_SOFTIRQ)
106#define CAS_NCPUS num_online_cpus()
107
108#if defined(CONFIG_CASSINI_NAPI) && defined(HAVE_NETDEV_POLL)
109#define USE_NAPI
110#define cas_skb_release(x) netif_receive_skb(x)
111#else
112#define cas_skb_release(x) netif_rx(x)
113#endif
114
115/* select which firmware to use */
116#define USE_HP_WORKAROUND
117#define HP_WORKAROUND_DEFAULT /* select which firmware to use as default */
118#define CAS_HP_ALT_FIRMWARE cas_prog_null /* alternate firmware */
119
120#include "cassini.h"
121
122#define USE_TX_COMPWB /* use completion writeback registers */
123#define USE_CSMA_CD_PROTO /* standard CSMA/CD */
124#define USE_RX_BLANK /* hw interrupt mitigation */
125#undef USE_ENTROPY_DEV /* don't test for entropy device */
126
127/* NOTE: these aren't useable unless PCI interrupts can be assigned.
128 * also, we need to make cp->lock finer-grained.
129 */
130#undef USE_PCI_INTB
131#undef USE_PCI_INTC
132#undef USE_PCI_INTD
133#undef USE_QOS
134
135#undef USE_VPD_DEBUG /* debug vpd information if defined */
136
137/* rx processing options */
138#define USE_PAGE_ORDER /* specify to allocate large rx pages */
139#define RX_DONT_BATCH 0 /* if 1, don't batch flows */
140#define RX_COPY_ALWAYS 0 /* if 0, use frags */
141#define RX_COPY_MIN 64 /* copy a little to make upper layers happy */
142#undef RX_COUNT_BUFFERS /* define to calculate RX buffer stats */
143
144#define DRV_MODULE_NAME "cassini"
145#define PFX DRV_MODULE_NAME ": "
146#define DRV_MODULE_VERSION "1.4"
147#define DRV_MODULE_RELDATE "1 July 2004"
148
149#define CAS_DEF_MSG_ENABLE \
150 (NETIF_MSG_DRV | \
151 NETIF_MSG_PROBE | \
152 NETIF_MSG_LINK | \
153 NETIF_MSG_TIMER | \
154 NETIF_MSG_IFDOWN | \
155 NETIF_MSG_IFUP | \
156 NETIF_MSG_RX_ERR | \
157 NETIF_MSG_TX_ERR)
158
159/* length of time before we decide the hardware is borked,
160 * and dev->tx_timeout() should be called to fix the problem
161 */
162#define CAS_TX_TIMEOUT (HZ)
163#define CAS_LINK_TIMEOUT (22*HZ/10)
164#define CAS_LINK_FAST_TIMEOUT (1)
165
166/* timeout values for state changing. these specify the number
167 * of 10us delays to be used before giving up.
168 */
169#define STOP_TRIES_PHY 1000
170#define STOP_TRIES 5000
171
172/* specify a minimum frame size to deal with some fifo issues
173 * max mtu == 2 * page size - ethernet header - 64 - swivel =
174 * 2 * page_size - 0x50
175 */
176#define CAS_MIN_FRAME 97
177#define CAS_1000MB_MIN_FRAME 255
178#define CAS_MIN_MTU 60
179#define CAS_MAX_MTU min(((cp->page_size << 1) - 0x50), 9000)
180
181#if 1
182/*
183 * Eliminate these and use separate atomic counters for each, to
184 * avoid a race condition.
185 */
186#else
187#define CAS_RESET_MTU 1
188#define CAS_RESET_ALL 2
189#define CAS_RESET_SPARE 3
190#endif
191
192static char version[] __devinitdata =
193 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
194
195MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)");
196MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver");
197MODULE_LICENSE("GPL");
198MODULE_PARM(cassini_debug, "i");
199MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value");
200MODULE_PARM(link_mode, "i");
201MODULE_PARM_DESC(link_mode, "default link mode");
202
203/*
204 * Work around for a PCS bug in which the link goes down due to the chip
205 * being confused and never showing a link status of "up."
206 */
207#define DEFAULT_LINKDOWN_TIMEOUT 5
208/*
209 * Value in seconds, for user input.
210 */
211static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT;
212MODULE_PARM(linkdown_timeout, "i");
213MODULE_PARM_DESC(linkdown_timeout,
214"min reset interval in sec. for PCS linkdown issue; disabled if not positive");
215
216/*
217 * value in 'ticks' (units used by jiffies). Set when we init the
218 * module because 'HZ' in actually a function call on some flavors of
219 * Linux. This will default to DEFAULT_LINKDOWN_TIMEOUT * HZ.
220 */
221static int link_transition_timeout;
222
223
224static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */
225static int link_mode;
226
227static u16 link_modes[] __devinitdata = {
228 BMCR_ANENABLE, /* 0 : autoneg */
229 0, /* 1 : 10bt half duplex */
230 BMCR_SPEED100, /* 2 : 100bt half duplex */
231 BMCR_FULLDPLX, /* 3 : 10bt full duplex */
232 BMCR_SPEED100|BMCR_FULLDPLX, /* 4 : 100bt full duplex */
233 CAS_BMCR_SPEED1000|BMCR_FULLDPLX /* 5 : 1000bt full duplex */
234};
235
236static struct pci_device_id cas_pci_tbl[] __devinitdata = {
237 { PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_CASSINI,
238 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
239 { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SATURN,
240 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
241 { 0, }
242};
243
244MODULE_DEVICE_TABLE(pci, cas_pci_tbl);
245
246static void cas_set_link_modes(struct cas *cp);
247
248static inline void cas_lock_tx(struct cas *cp)
249{
250 int i;
251
252 for (i = 0; i < N_TX_RINGS; i++)
253 spin_lock(&cp->tx_lock[i]);
254}
255
256static inline void cas_lock_all(struct cas *cp)
257{
258 spin_lock_irq(&cp->lock);
259 cas_lock_tx(cp);
260}
261
262/* WTZ: QA was finding deadlock problems with the previous
263 * versions after long test runs with multiple cards per machine.
264 * See if replacing cas_lock_all with safer versions helps. The
265 * symptoms QA is reporting match those we'd expect if interrupts
266 * aren't being properly restored, and we fixed a previous deadlock
267 * with similar symptoms by using save/restore versions in other
268 * places.
269 */
270#define cas_lock_all_save(cp, flags) \
271do { \
272 struct cas *xxxcp = (cp); \
273 spin_lock_irqsave(&xxxcp->lock, flags); \
274 cas_lock_tx(xxxcp); \
275} while (0)
276
277static inline void cas_unlock_tx(struct cas *cp)
278{
279 int i;
280
281 for (i = N_TX_RINGS; i > 0; i--)
282 spin_unlock(&cp->tx_lock[i - 1]);
283}
284
285static inline void cas_unlock_all(struct cas *cp)
286{
287 cas_unlock_tx(cp);
288 spin_unlock_irq(&cp->lock);
289}
290
291#define cas_unlock_all_restore(cp, flags) \
292do { \
293 struct cas *xxxcp = (cp); \
294 cas_unlock_tx(xxxcp); \
295 spin_unlock_irqrestore(&xxxcp->lock, flags); \
296} while (0)
297
298static void cas_disable_irq(struct cas *cp, const int ring)
299{
300 /* Make sure we won't get any more interrupts */
301 if (ring == 0) {
302 writel(0xFFFFFFFF, cp->regs + REG_INTR_MASK);
303 return;
304 }
305
306 /* disable completion interrupts and selectively mask */
307 if (cp->cas_flags & CAS_FLAG_REG_PLUS) {
308 switch (ring) {
309#if defined (USE_PCI_INTB) || defined(USE_PCI_INTC) || defined(USE_PCI_INTD)
310#ifdef USE_PCI_INTB
311 case 1:
312#endif
313#ifdef USE_PCI_INTC
314 case 2:
315#endif
316#ifdef USE_PCI_INTD
317 case 3:
318#endif
319 writel(INTRN_MASK_CLEAR_ALL | INTRN_MASK_RX_EN,
320 cp->regs + REG_PLUS_INTRN_MASK(ring));
321 break;
322#endif
323 default:
324 writel(INTRN_MASK_CLEAR_ALL, cp->regs +
325 REG_PLUS_INTRN_MASK(ring));
326 break;
327 }
328 }
329}
330
331static inline void cas_mask_intr(struct cas *cp)
332{
333 int i;
334
335 for (i = 0; i < N_RX_COMP_RINGS; i++)
336 cas_disable_irq(cp, i);
337}
338
339static void cas_enable_irq(struct cas *cp, const int ring)
340{
341 if (ring == 0) { /* all but TX_DONE */
342 writel(INTR_TX_DONE, cp->regs + REG_INTR_MASK);
343 return;
344 }
345
346 if (cp->cas_flags & CAS_FLAG_REG_PLUS) {
347 switch (ring) {
348#if defined (USE_PCI_INTB) || defined(USE_PCI_INTC) || defined(USE_PCI_INTD)
349#ifdef USE_PCI_INTB
350 case 1:
351#endif
352#ifdef USE_PCI_INTC
353 case 2:
354#endif
355#ifdef USE_PCI_INTD
356 case 3:
357#endif
358 writel(INTRN_MASK_RX_EN, cp->regs +
359 REG_PLUS_INTRN_MASK(ring));
360 break;
361#endif
362 default:
363 break;
364 }
365 }
366}
367
368static inline void cas_unmask_intr(struct cas *cp)
369{
370 int i;
371
372 for (i = 0; i < N_RX_COMP_RINGS; i++)
373 cas_enable_irq(cp, i);
374}
375
376static inline void cas_entropy_gather(struct cas *cp)
377{
378#ifdef USE_ENTROPY_DEV
379 if ((cp->cas_flags & CAS_FLAG_ENTROPY_DEV) == 0)
380 return;
381
382 batch_entropy_store(readl(cp->regs + REG_ENTROPY_IV),
383 readl(cp->regs + REG_ENTROPY_IV),
384 sizeof(uint64_t)*8);
385#endif
386}
387
388static inline void cas_entropy_reset(struct cas *cp)
389{
390#ifdef USE_ENTROPY_DEV
391 if ((cp->cas_flags & CAS_FLAG_ENTROPY_DEV) == 0)
392 return;
393
394 writel(BIM_LOCAL_DEV_PAD | BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_EXT,
395 cp->regs + REG_BIM_LOCAL_DEV_EN);
396 writeb(ENTROPY_RESET_STC_MODE, cp->regs + REG_ENTROPY_RESET);
397 writeb(0x55, cp->regs + REG_ENTROPY_RAND_REG);
398
399 /* if we read back 0x0, we don't have an entropy device */
400 if (readb(cp->regs + REG_ENTROPY_RAND_REG) == 0)
401 cp->cas_flags &= ~CAS_FLAG_ENTROPY_DEV;
402#endif
403}
404
405/* access to the phy. the following assumes that we've initialized the MIF to
406 * be in frame rather than bit-bang mode
407 */
408static u16 cas_phy_read(struct cas *cp, int reg)
409{
410 u32 cmd;
411 int limit = STOP_TRIES_PHY;
412
413 cmd = MIF_FRAME_ST | MIF_FRAME_OP_READ;
414 cmd |= CAS_BASE(MIF_FRAME_PHY_ADDR, cp->phy_addr);
415 cmd |= CAS_BASE(MIF_FRAME_REG_ADDR, reg);
416 cmd |= MIF_FRAME_TURN_AROUND_MSB;
417 writel(cmd, cp->regs + REG_MIF_FRAME);
418
419 /* poll for completion */
420 while (limit-- > 0) {
421 udelay(10);
422 cmd = readl(cp->regs + REG_MIF_FRAME);
423 if (cmd & MIF_FRAME_TURN_AROUND_LSB)
424 return (cmd & MIF_FRAME_DATA_MASK);
425 }
426 return 0xFFFF; /* -1 */
427}
428
429static int cas_phy_write(struct cas *cp, int reg, u16 val)
430{
431 int limit = STOP_TRIES_PHY;
432 u32 cmd;
433
434 cmd = MIF_FRAME_ST | MIF_FRAME_OP_WRITE;
435 cmd |= CAS_BASE(MIF_FRAME_PHY_ADDR, cp->phy_addr);
436 cmd |= CAS_BASE(MIF_FRAME_REG_ADDR, reg);
437 cmd |= MIF_FRAME_TURN_AROUND_MSB;
438 cmd |= val & MIF_FRAME_DATA_MASK;
439 writel(cmd, cp->regs + REG_MIF_FRAME);
440
441 /* poll for completion */
442 while (limit-- > 0) {
443 udelay(10);
444 cmd = readl(cp->regs + REG_MIF_FRAME);
445 if (cmd & MIF_FRAME_TURN_AROUND_LSB)
446 return 0;
447 }
448 return -1;
449}
450
451static void cas_phy_powerup(struct cas *cp)
452{
453 u16 ctl = cas_phy_read(cp, MII_BMCR);
454
455 if ((ctl & BMCR_PDOWN) == 0)
456 return;
457 ctl &= ~BMCR_PDOWN;
458 cas_phy_write(cp, MII_BMCR, ctl);
459}
460
461static void cas_phy_powerdown(struct cas *cp)
462{
463 u16 ctl = cas_phy_read(cp, MII_BMCR);
464
465 if (ctl & BMCR_PDOWN)
466 return;
467 ctl |= BMCR_PDOWN;
468 cas_phy_write(cp, MII_BMCR, ctl);
469}
470
471/* cp->lock held. note: the last put_page will free the buffer */
472static int cas_page_free(struct cas *cp, cas_page_t *page)
473{
474 pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size,
475 PCI_DMA_FROMDEVICE);
476 __free_pages(page->buffer, cp->page_order);
477 kfree(page);
478 return 0;
479}
480
481#ifdef RX_COUNT_BUFFERS
482#define RX_USED_ADD(x, y) ((x)->used += (y))
483#define RX_USED_SET(x, y) ((x)->used = (y))
484#else
485#define RX_USED_ADD(x, y)
486#define RX_USED_SET(x, y)
487#endif
488
489/* local page allocation routines for the receive buffers. jumbo pages
490 * require at least 8K contiguous and 8K aligned buffers.
491 */
492static cas_page_t *cas_page_alloc(struct cas *cp, const int flags)
493{
494 cas_page_t *page;
495
496 page = kmalloc(sizeof(cas_page_t), flags);
497 if (!page)
498 return NULL;
499
500 INIT_LIST_HEAD(&page->list);
501 RX_USED_SET(page, 0);
502 page->buffer = alloc_pages(flags, cp->page_order);
503 if (!page->buffer)
504 goto page_err;
505 page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0,
506 cp->page_size, PCI_DMA_FROMDEVICE);
507 return page;
508
509page_err:
510 kfree(page);
511 return NULL;
512}
513
514/* initialize spare pool of rx buffers, but allocate during the open */
515static void cas_spare_init(struct cas *cp)
516{
517 spin_lock(&cp->rx_inuse_lock);
518 INIT_LIST_HEAD(&cp->rx_inuse_list);
519 spin_unlock(&cp->rx_inuse_lock);
520
521 spin_lock(&cp->rx_spare_lock);
522 INIT_LIST_HEAD(&cp->rx_spare_list);
523 cp->rx_spares_needed = RX_SPARE_COUNT;
524 spin_unlock(&cp->rx_spare_lock);
525}
526
527/* used on close. free all the spare buffers. */
528static void cas_spare_free(struct cas *cp)
529{
530 struct list_head list, *elem, *tmp;
531
532 /* free spare buffers */
533 INIT_LIST_HEAD(&list);
534 spin_lock(&cp->rx_spare_lock);
535 list_splice(&cp->rx_spare_list, &list);
536 INIT_LIST_HEAD(&cp->rx_spare_list);
537 spin_unlock(&cp->rx_spare_lock);
538 list_for_each_safe(elem, tmp, &list) {
539 cas_page_free(cp, list_entry(elem, cas_page_t, list));
540 }
541
542 INIT_LIST_HEAD(&list);
543#if 1
544 /*
545 * Looks like Adrian had protected this with a different
546 * lock than used everywhere else to manipulate this list.
547 */
548 spin_lock(&cp->rx_inuse_lock);
549 list_splice(&cp->rx_inuse_list, &list);
550 INIT_LIST_HEAD(&cp->rx_inuse_list);
551 spin_unlock(&cp->rx_inuse_lock);
552#else
553 spin_lock(&cp->rx_spare_lock);
554 list_splice(&cp->rx_inuse_list, &list);
555 INIT_LIST_HEAD(&cp->rx_inuse_list);
556 spin_unlock(&cp->rx_spare_lock);
557#endif
558 list_for_each_safe(elem, tmp, &list) {
559 cas_page_free(cp, list_entry(elem, cas_page_t, list));
560 }
561}
562
563/* replenish spares if needed */
564static void cas_spare_recover(struct cas *cp, const int flags)
565{
566 struct list_head list, *elem, *tmp;
567 int needed, i;
568
569 /* check inuse list. if we don't need any more free buffers,
570 * just free it
571 */
572
573 /* make a local copy of the list */
574 INIT_LIST_HEAD(&list);
575 spin_lock(&cp->rx_inuse_lock);
576 list_splice(&cp->rx_inuse_list, &list);
577 INIT_LIST_HEAD(&cp->rx_inuse_list);
578 spin_unlock(&cp->rx_inuse_lock);
579
580 list_for_each_safe(elem, tmp, &list) {
581 cas_page_t *page = list_entry(elem, cas_page_t, list);
582
583 if (page_count(page->buffer) > 1)
584 continue;
585
586 list_del(elem);
587 spin_lock(&cp->rx_spare_lock);
588 if (cp->rx_spares_needed > 0) {
589 list_add(elem, &cp->rx_spare_list);
590 cp->rx_spares_needed--;
591 spin_unlock(&cp->rx_spare_lock);
592 } else {
593 spin_unlock(&cp->rx_spare_lock);
594 cas_page_free(cp, page);
595 }
596 }
597
598 /* put any inuse buffers back on the list */
599 if (!list_empty(&list)) {
600 spin_lock(&cp->rx_inuse_lock);
601 list_splice(&list, &cp->rx_inuse_list);
602 spin_unlock(&cp->rx_inuse_lock);
603 }
604
605 spin_lock(&cp->rx_spare_lock);
606 needed = cp->rx_spares_needed;
607 spin_unlock(&cp->rx_spare_lock);
608 if (!needed)
609 return;
610
611 /* we still need spares, so try to allocate some */
612 INIT_LIST_HEAD(&list);
613 i = 0;
614 while (i < needed) {
615 cas_page_t *spare = cas_page_alloc(cp, flags);
616 if (!spare)
617 break;
618 list_add(&spare->list, &list);
619 i++;
620 }
621
622 spin_lock(&cp->rx_spare_lock);
623 list_splice(&list, &cp->rx_spare_list);
624 cp->rx_spares_needed -= i;
625 spin_unlock(&cp->rx_spare_lock);
626}
627
628/* pull a page from the list. */
629static cas_page_t *cas_page_dequeue(struct cas *cp)
630{
631 struct list_head *entry;
632 int recover;
633
634 spin_lock(&cp->rx_spare_lock);
635 if (list_empty(&cp->rx_spare_list)) {
636 /* try to do a quick recovery */
637 spin_unlock(&cp->rx_spare_lock);
638 cas_spare_recover(cp, GFP_ATOMIC);
639 spin_lock(&cp->rx_spare_lock);
640 if (list_empty(&cp->rx_spare_list)) {
641 if (netif_msg_rx_err(cp))
642 printk(KERN_ERR "%s: no spare buffers "
643 "available.\n", cp->dev->name);
644 spin_unlock(&cp->rx_spare_lock);
645 return NULL;
646 }
647 }
648
649 entry = cp->rx_spare_list.next;
650 list_del(entry);
651 recover = ++cp->rx_spares_needed;
652 spin_unlock(&cp->rx_spare_lock);
653
654 /* trigger the timer to do the recovery */
655 if ((recover & (RX_SPARE_RECOVER_VAL - 1)) == 0) {
656#if 1
657 atomic_inc(&cp->reset_task_pending);
658 atomic_inc(&cp->reset_task_pending_spare);
659 schedule_work(&cp->reset_task);
660#else
661 atomic_set(&cp->reset_task_pending, CAS_RESET_SPARE);
662 schedule_work(&cp->reset_task);
663#endif
664 }
665 return list_entry(entry, cas_page_t, list);
666}
667
668
669static void cas_mif_poll(struct cas *cp, const int enable)
670{
671 u32 cfg;
672
673 cfg = readl(cp->regs + REG_MIF_CFG);
674 cfg &= (MIF_CFG_MDIO_0 | MIF_CFG_MDIO_1);
675
676 if (cp->phy_type & CAS_PHY_MII_MDIO1)
677 cfg |= MIF_CFG_PHY_SELECT;
678
679 /* poll and interrupt on link status change. */
680 if (enable) {
681 cfg |= MIF_CFG_POLL_EN;
682 cfg |= CAS_BASE(MIF_CFG_POLL_REG, MII_BMSR);
683 cfg |= CAS_BASE(MIF_CFG_POLL_PHY, cp->phy_addr);
684 }
685 writel((enable) ? ~(BMSR_LSTATUS | BMSR_ANEGCOMPLETE) : 0xFFFF,
686 cp->regs + REG_MIF_MASK);
687 writel(cfg, cp->regs + REG_MIF_CFG);
688}
689
690/* Must be invoked under cp->lock */
691static void cas_begin_auto_negotiation(struct cas *cp, struct ethtool_cmd *ep)
692{
693 u16 ctl;
694#if 1
695 int lcntl;
696 int changed = 0;
697 int oldstate = cp->lstate;
698 int link_was_not_down = !(oldstate == link_down);
699#endif
700 /* Setup link parameters */
701 if (!ep)
702 goto start_aneg;
703 lcntl = cp->link_cntl;
704 if (ep->autoneg == AUTONEG_ENABLE)
705 cp->link_cntl = BMCR_ANENABLE;
706 else {
707 cp->link_cntl = 0;
708 if (ep->speed == SPEED_100)
709 cp->link_cntl |= BMCR_SPEED100;
710 else if (ep->speed == SPEED_1000)
711 cp->link_cntl |= CAS_BMCR_SPEED1000;
712 if (ep->duplex == DUPLEX_FULL)
713 cp->link_cntl |= BMCR_FULLDPLX;
714 }
715#if 1
716 changed = (lcntl != cp->link_cntl);
717#endif
718start_aneg:
719 if (cp->lstate == link_up) {
720 printk(KERN_INFO "%s: PCS link down.\n",
721 cp->dev->name);
722 } else {
723 if (changed) {
724 printk(KERN_INFO "%s: link configuration changed\n",
725 cp->dev->name);
726 }
727 }
728 cp->lstate = link_down;
729 cp->link_transition = LINK_TRANSITION_LINK_DOWN;
730 if (!cp->hw_running)
731 return;
732#if 1
733 /*
734 * WTZ: If the old state was link_up, we turn off the carrier
735 * to replicate everything we do elsewhere on a link-down
736 * event when we were already in a link-up state..
737 */
738 if (oldstate == link_up)
739 netif_carrier_off(cp->dev);
740 if (changed && link_was_not_down) {
741 /*
742 * WTZ: This branch will simply schedule a full reset after
743 * we explicitly changed link modes in an ioctl. See if this
744 * fixes the link-problems we were having for forced mode.
745 */
746 atomic_inc(&cp->reset_task_pending);
747 atomic_inc(&cp->reset_task_pending_all);
748 schedule_work(&cp->reset_task);
749 cp->timer_ticks = 0;
750 mod_timer(&cp->link_timer, jiffies + CAS_LINK_TIMEOUT);
751 return;
752 }
753#endif
754 if (cp->phy_type & CAS_PHY_SERDES) {
755 u32 val = readl(cp->regs + REG_PCS_MII_CTRL);
756
757 if (cp->link_cntl & BMCR_ANENABLE) {
758 val |= (PCS_MII_RESTART_AUTONEG | PCS_MII_AUTONEG_EN);
759 cp->lstate = link_aneg;
760 } else {
761 if (cp->link_cntl & BMCR_FULLDPLX)
762 val |= PCS_MII_CTRL_DUPLEX;
763 val &= ~PCS_MII_AUTONEG_EN;
764 cp->lstate = link_force_ok;
765 }
766 cp->link_transition = LINK_TRANSITION_LINK_CONFIG;
767 writel(val, cp->regs + REG_PCS_MII_CTRL);
768
769 } else {
770 cas_mif_poll(cp, 0);
771 ctl = cas_phy_read(cp, MII_BMCR);
772 ctl &= ~(BMCR_FULLDPLX | BMCR_SPEED100 |
773 CAS_BMCR_SPEED1000 | BMCR_ANENABLE);
774 ctl |= cp->link_cntl;
775 if (ctl & BMCR_ANENABLE) {
776 ctl |= BMCR_ANRESTART;
777 cp->lstate = link_aneg;
778 } else {
779 cp->lstate = link_force_ok;
780 }
781 cp->link_transition = LINK_TRANSITION_LINK_CONFIG;
782 cas_phy_write(cp, MII_BMCR, ctl);
783 cas_mif_poll(cp, 1);
784 }
785
786 cp->timer_ticks = 0;
787 mod_timer(&cp->link_timer, jiffies + CAS_LINK_TIMEOUT);
788}
789
790/* Must be invoked under cp->lock. */
791static int cas_reset_mii_phy(struct cas *cp)
792{
793 int limit = STOP_TRIES_PHY;
794 u16 val;
795
796 cas_phy_write(cp, MII_BMCR, BMCR_RESET);
797 udelay(100);
798 while (limit--) {
799 val = cas_phy_read(cp, MII_BMCR);
800 if ((val & BMCR_RESET) == 0)
801 break;
802 udelay(10);
803 }
804 return (limit <= 0);
805}
806
807static void cas_saturn_firmware_load(struct cas *cp)
808{
809 cas_saturn_patch_t *patch = cas_saturn_patch;
810
811 cas_phy_powerdown(cp);
812
813 /* expanded memory access mode */
814 cas_phy_write(cp, DP83065_MII_MEM, 0x0);
815
816 /* pointer configuration for new firmware */
817 cas_phy_write(cp, DP83065_MII_REGE, 0x8ff9);
818 cas_phy_write(cp, DP83065_MII_REGD, 0xbd);
819 cas_phy_write(cp, DP83065_MII_REGE, 0x8ffa);
820 cas_phy_write(cp, DP83065_MII_REGD, 0x82);
821 cas_phy_write(cp, DP83065_MII_REGE, 0x8ffb);
822 cas_phy_write(cp, DP83065_MII_REGD, 0x0);
823 cas_phy_write(cp, DP83065_MII_REGE, 0x8ffc);
824 cas_phy_write(cp, DP83065_MII_REGD, 0x39);
825
826 /* download new firmware */
827 cas_phy_write(cp, DP83065_MII_MEM, 0x1);
828 cas_phy_write(cp, DP83065_MII_REGE, patch->addr);
829 while (patch->addr) {
830 cas_phy_write(cp, DP83065_MII_REGD, patch->val);
831 patch++;
832 }
833
834 /* enable firmware */
835 cas_phy_write(cp, DP83065_MII_REGE, 0x8ff8);
836 cas_phy_write(cp, DP83065_MII_REGD, 0x1);
837}
838
839
840/* phy initialization */
841static void cas_phy_init(struct cas *cp)
842{
843 u16 val;
844
845 /* if we're in MII/GMII mode, set up phy */
846 if (CAS_PHY_MII(cp->phy_type)) {
847 writel(PCS_DATAPATH_MODE_MII,
848 cp->regs + REG_PCS_DATAPATH_MODE);
849
850 cas_mif_poll(cp, 0);
851 cas_reset_mii_phy(cp); /* take out of isolate mode */
852
853 if (PHY_LUCENT_B0 == cp->phy_id) {
854 /* workaround link up/down issue with lucent */
855 cas_phy_write(cp, LUCENT_MII_REG, 0x8000);
856 cas_phy_write(cp, MII_BMCR, 0x00f1);
857 cas_phy_write(cp, LUCENT_MII_REG, 0x0);
858
859 } else if (PHY_BROADCOM_B0 == (cp->phy_id & 0xFFFFFFFC)) {
860 /* workarounds for broadcom phy */
861 cas_phy_write(cp, BROADCOM_MII_REG8, 0x0C20);
862 cas_phy_write(cp, BROADCOM_MII_REG7, 0x0012);
863 cas_phy_write(cp, BROADCOM_MII_REG5, 0x1804);
864 cas_phy_write(cp, BROADCOM_MII_REG7, 0x0013);
865 cas_phy_write(cp, BROADCOM_MII_REG5, 0x1204);
866 cas_phy_write(cp, BROADCOM_MII_REG7, 0x8006);
867 cas_phy_write(cp, BROADCOM_MII_REG5, 0x0132);
868 cas_phy_write(cp, BROADCOM_MII_REG7, 0x8006);
869 cas_phy_write(cp, BROADCOM_MII_REG5, 0x0232);
870 cas_phy_write(cp, BROADCOM_MII_REG7, 0x201F);
871 cas_phy_write(cp, BROADCOM_MII_REG5, 0x0A20);
872
873 } else if (PHY_BROADCOM_5411 == cp->phy_id) {
874 val = cas_phy_read(cp, BROADCOM_MII_REG4);
875 val = cas_phy_read(cp, BROADCOM_MII_REG4);
876 if (val & 0x0080) {
877 /* link workaround */
878 cas_phy_write(cp, BROADCOM_MII_REG4,
879 val & ~0x0080);
880 }
881
882 } else if (cp->cas_flags & CAS_FLAG_SATURN) {
883 writel((cp->phy_type & CAS_PHY_MII_MDIO0) ?
884 SATURN_PCFG_FSI : 0x0,
885 cp->regs + REG_SATURN_PCFG);
886
887 /* load firmware to address 10Mbps auto-negotiation
888 * issue. NOTE: this will need to be changed if the
889 * default firmware gets fixed.
890 */
891 if (PHY_NS_DP83065 == cp->phy_id) {
892 cas_saturn_firmware_load(cp);
893 }
894 cas_phy_powerup(cp);
895 }
896
897 /* advertise capabilities */
898 val = cas_phy_read(cp, MII_BMCR);
899 val &= ~BMCR_ANENABLE;
900 cas_phy_write(cp, MII_BMCR, val);
901 udelay(10);
902
903 cas_phy_write(cp, MII_ADVERTISE,
904 cas_phy_read(cp, MII_ADVERTISE) |
905 (ADVERTISE_10HALF | ADVERTISE_10FULL |
906 ADVERTISE_100HALF | ADVERTISE_100FULL |
907 CAS_ADVERTISE_PAUSE |
908 CAS_ADVERTISE_ASYM_PAUSE));
909
910 if (cp->cas_flags & CAS_FLAG_1000MB_CAP) {
911 /* make sure that we don't advertise half
912 * duplex to avoid a chip issue
913 */
914 val = cas_phy_read(cp, CAS_MII_1000_CTRL);
915 val &= ~CAS_ADVERTISE_1000HALF;
916 val |= CAS_ADVERTISE_1000FULL;
917 cas_phy_write(cp, CAS_MII_1000_CTRL, val);
918 }
919
920 } else {
921 /* reset pcs for serdes */
922 u32 val;
923 int limit;
924
925 writel(PCS_DATAPATH_MODE_SERDES,
926 cp->regs + REG_PCS_DATAPATH_MODE);
927
928 /* enable serdes pins on saturn */
929 if (cp->cas_flags & CAS_FLAG_SATURN)
930 writel(0, cp->regs + REG_SATURN_PCFG);
931
932 /* Reset PCS unit. */
933 val = readl(cp->regs + REG_PCS_MII_CTRL);
934 val |= PCS_MII_RESET;
935 writel(val, cp->regs + REG_PCS_MII_CTRL);
936
937 limit = STOP_TRIES;
938 while (limit-- > 0) {
939 udelay(10);
940 if ((readl(cp->regs + REG_PCS_MII_CTRL) &
941 PCS_MII_RESET) == 0)
942 break;
943 }
944 if (limit <= 0)
945 printk(KERN_WARNING "%s: PCS reset bit would not "
946 "clear [%08x].\n", cp->dev->name,
947 readl(cp->regs + REG_PCS_STATE_MACHINE));
948
949 /* Make sure PCS is disabled while changing advertisement
950 * configuration.
951 */
952 writel(0x0, cp->regs + REG_PCS_CFG);
953
954 /* Advertise all capabilities except half-duplex. */
955 val = readl(cp->regs + REG_PCS_MII_ADVERT);
956 val &= ~PCS_MII_ADVERT_HD;
957 val |= (PCS_MII_ADVERT_FD | PCS_MII_ADVERT_SYM_PAUSE |
958 PCS_MII_ADVERT_ASYM_PAUSE);
959 writel(val, cp->regs + REG_PCS_MII_ADVERT);
960
961 /* enable PCS */
962 writel(PCS_CFG_EN, cp->regs + REG_PCS_CFG);
963
964 /* pcs workaround: enable sync detect */
965 writel(PCS_SERDES_CTRL_SYNCD_EN,
966 cp->regs + REG_PCS_SERDES_CTRL);
967 }
968}
969
970
971static int cas_pcs_link_check(struct cas *cp)
972{
973 u32 stat, state_machine;
974 int retval = 0;
975
976 /* The link status bit latches on zero, so you must
977 * read it twice in such a case to see a transition
978 * to the link being up.
979 */
980 stat = readl(cp->regs + REG_PCS_MII_STATUS);
981 if ((stat & PCS_MII_STATUS_LINK_STATUS) == 0)
982 stat = readl(cp->regs + REG_PCS_MII_STATUS);
983
984 /* The remote-fault indication is only valid
985 * when autoneg has completed.
986 */
987 if ((stat & (PCS_MII_STATUS_AUTONEG_COMP |
988 PCS_MII_STATUS_REMOTE_FAULT)) ==
989 (PCS_MII_STATUS_AUTONEG_COMP | PCS_MII_STATUS_REMOTE_FAULT)) {
990 if (netif_msg_link(cp))
991 printk(KERN_INFO "%s: PCS RemoteFault\n",
992 cp->dev->name);
993 }
994
995 /* work around link detection issue by querying the PCS state
996 * machine directly.
997 */
998 state_machine = readl(cp->regs + REG_PCS_STATE_MACHINE);
999 if ((state_machine & PCS_SM_LINK_STATE_MASK) != SM_LINK_STATE_UP) {
1000 stat &= ~PCS_MII_STATUS_LINK_STATUS;
1001 } else if (state_machine & PCS_SM_WORD_SYNC_STATE_MASK) {
1002 stat |= PCS_MII_STATUS_LINK_STATUS;
1003 }
1004
1005 if (stat & PCS_MII_STATUS_LINK_STATUS) {
1006 if (cp->lstate != link_up) {
1007 if (cp->opened) {
1008 cp->lstate = link_up;
1009 cp->link_transition = LINK_TRANSITION_LINK_UP;
1010
1011 cas_set_link_modes(cp);
1012 netif_carrier_on(cp->dev);
1013 }
1014 }
1015 } else if (cp->lstate == link_up) {
1016 cp->lstate = link_down;
1017 if (link_transition_timeout != 0 &&
1018 cp->link_transition != LINK_TRANSITION_REQUESTED_RESET &&
1019 !cp->link_transition_jiffies_valid) {
1020 /*
1021 * force a reset, as a workaround for the
1022 * link-failure problem. May want to move this to a
1023 * point a bit earlier in the sequence. If we had
1024 * generated a reset a short time ago, we'll wait for
1025 * the link timer to check the status until a
1026 * timer expires (link_transistion_jiffies_valid is
1027 * true when the timer is running.) Instead of using
1028 * a system timer, we just do a check whenever the
1029 * link timer is running - this clears the flag after
1030 * a suitable delay.
1031 */
1032 retval = 1;
1033 cp->link_transition = LINK_TRANSITION_REQUESTED_RESET;
1034 cp->link_transition_jiffies = jiffies;
1035 cp->link_transition_jiffies_valid = 1;
1036 } else {
1037 cp->link_transition = LINK_TRANSITION_ON_FAILURE;
1038 }
1039 netif_carrier_off(cp->dev);
1040 if (cp->opened && netif_msg_link(cp)) {
1041 printk(KERN_INFO "%s: PCS link down.\n",
1042 cp->dev->name);
1043 }
1044
1045 /* Cassini only: if you force a mode, there can be
1046 * sync problems on link down. to fix that, the following
1047 * things need to be checked:
1048 * 1) read serialink state register
1049 * 2) read pcs status register to verify link down.
1050 * 3) if link down and serial link == 0x03, then you need
1051 * to global reset the chip.
1052 */
1053 if ((cp->cas_flags & CAS_FLAG_REG_PLUS) == 0) {
1054 /* should check to see if we're in a forced mode */
1055 stat = readl(cp->regs + REG_PCS_SERDES_STATE);
1056 if (stat == 0x03)
1057 return 1;
1058 }
1059 } else if (cp->lstate == link_down) {
1060 if (link_transition_timeout != 0 &&
1061 cp->link_transition != LINK_TRANSITION_REQUESTED_RESET &&
1062 !cp->link_transition_jiffies_valid) {
1063 /* force a reset, as a workaround for the
1064 * link-failure problem. May want to move
1065 * this to a point a bit earlier in the
1066 * sequence.
1067 */
1068 retval = 1;
1069 cp->link_transition = LINK_TRANSITION_REQUESTED_RESET;
1070 cp->link_transition_jiffies = jiffies;
1071 cp->link_transition_jiffies_valid = 1;
1072 } else {
1073 cp->link_transition = LINK_TRANSITION_STILL_FAILED;
1074 }
1075 }
1076
1077 return retval;
1078}
1079
1080static int cas_pcs_interrupt(struct net_device *dev,
1081 struct cas *cp, u32 status)
1082{
1083 u32 stat = readl(cp->regs + REG_PCS_INTR_STATUS);
1084
1085 if ((stat & PCS_INTR_STATUS_LINK_CHANGE) == 0)
1086 return 0;
1087 return cas_pcs_link_check(cp);
1088}
1089
1090static int cas_txmac_interrupt(struct net_device *dev,
1091 struct cas *cp, u32 status)
1092{
1093 u32 txmac_stat = readl(cp->regs + REG_MAC_TX_STATUS);
1094
1095 if (!txmac_stat)
1096 return 0;
1097
1098 if (netif_msg_intr(cp))
1099 printk(KERN_DEBUG "%s: txmac interrupt, txmac_stat: 0x%x\n",
1100 cp->dev->name, txmac_stat);
1101
1102 /* Defer timer expiration is quite normal,
1103 * don't even log the event.
1104 */
1105 if ((txmac_stat & MAC_TX_DEFER_TIMER) &&
1106 !(txmac_stat & ~MAC_TX_DEFER_TIMER))
1107 return 0;
1108
1109 spin_lock(&cp->stat_lock[0]);
1110 if (txmac_stat & MAC_TX_UNDERRUN) {
1111 printk(KERN_ERR "%s: TX MAC xmit underrun.\n",
1112 dev->name);
1113 cp->net_stats[0].tx_fifo_errors++;
1114 }
1115
1116 if (txmac_stat & MAC_TX_MAX_PACKET_ERR) {
1117 printk(KERN_ERR "%s: TX MAC max packet size error.\n",
1118 dev->name);
1119 cp->net_stats[0].tx_errors++;
1120 }
1121
1122 /* The rest are all cases of one of the 16-bit TX
1123 * counters expiring.
1124 */
1125 if (txmac_stat & MAC_TX_COLL_NORMAL)
1126 cp->net_stats[0].collisions += 0x10000;
1127
1128 if (txmac_stat & MAC_TX_COLL_EXCESS) {
1129 cp->net_stats[0].tx_aborted_errors += 0x10000;
1130 cp->net_stats[0].collisions += 0x10000;
1131 }
1132
1133 if (txmac_stat & MAC_TX_COLL_LATE) {
1134 cp->net_stats[0].tx_aborted_errors += 0x10000;
1135 cp->net_stats[0].collisions += 0x10000;
1136 }
1137 spin_unlock(&cp->stat_lock[0]);
1138
1139 /* We do not keep track of MAC_TX_COLL_FIRST and
1140 * MAC_TX_PEAK_ATTEMPTS events.
1141 */
1142 return 0;
1143}
1144
1145static void cas_load_firmware(struct cas *cp, cas_hp_inst_t *firmware)
1146{
1147 cas_hp_inst_t *inst;
1148 u32 val;
1149 int i;
1150
1151 i = 0;
1152 while ((inst = firmware) && inst->note) {
1153 writel(i, cp->regs + REG_HP_INSTR_RAM_ADDR);
1154
1155 val = CAS_BASE(HP_INSTR_RAM_HI_VAL, inst->val);
1156 val |= CAS_BASE(HP_INSTR_RAM_HI_MASK, inst->mask);
1157 writel(val, cp->regs + REG_HP_INSTR_RAM_DATA_HI);
1158
1159 val = CAS_BASE(HP_INSTR_RAM_MID_OUTARG, inst->outarg >> 10);
1160 val |= CAS_BASE(HP_INSTR_RAM_MID_OUTOP, inst->outop);
1161 val |= CAS_BASE(HP_INSTR_RAM_MID_FNEXT, inst->fnext);
1162 val |= CAS_BASE(HP_INSTR_RAM_MID_FOFF, inst->foff);
1163 val |= CAS_BASE(HP_INSTR_RAM_MID_SNEXT, inst->snext);
1164 val |= CAS_BASE(HP_INSTR_RAM_MID_SOFF, inst->soff);
1165 val |= CAS_BASE(HP_INSTR_RAM_MID_OP, inst->op);
1166 writel(val, cp->regs + REG_HP_INSTR_RAM_DATA_MID);
1167
1168 val = CAS_BASE(HP_INSTR_RAM_LOW_OUTMASK, inst->outmask);
1169 val |= CAS_BASE(HP_INSTR_RAM_LOW_OUTSHIFT, inst->outshift);
1170 val |= CAS_BASE(HP_INSTR_RAM_LOW_OUTEN, inst->outenab);
1171 val |= CAS_BASE(HP_INSTR_RAM_LOW_OUTARG, inst->outarg);
1172 writel(val, cp->regs + REG_HP_INSTR_RAM_DATA_LOW);
1173 ++firmware;
1174 ++i;
1175 }
1176}
1177
1178static void cas_init_rx_dma(struct cas *cp)
1179{
1180 u64 desc_dma = cp->block_dvma;
1181 u32 val;
1182 int i, size;
1183
1184 /* rx free descriptors */
1185 val = CAS_BASE(RX_CFG_SWIVEL, RX_SWIVEL_OFF_VAL);
1186 val |= CAS_BASE(RX_CFG_DESC_RING, RX_DESC_RINGN_INDEX(0));
1187 val |= CAS_BASE(RX_CFG_COMP_RING, RX_COMP_RINGN_INDEX(0));
1188 if ((N_RX_DESC_RINGS > 1) &&
1189 (cp->cas_flags & CAS_FLAG_REG_PLUS)) /* do desc 2 */
1190 val |= CAS_BASE(RX_CFG_DESC_RING1, RX_DESC_RINGN_INDEX(1));
1191 writel(val, cp->regs + REG_RX_CFG);
1192
1193 val = (unsigned long) cp->init_rxds[0] -
1194 (unsigned long) cp->init_block;
1195 writel((desc_dma + val) >> 32, cp->regs + REG_RX_DB_HI);
1196 writel((desc_dma + val) & 0xffffffff, cp->regs + REG_RX_DB_LOW);
1197 writel(RX_DESC_RINGN_SIZE(0) - 4, cp->regs + REG_RX_KICK);
1198
1199 if (cp->cas_flags & CAS_FLAG_REG_PLUS) {
1200 /* rx desc 2 is for IPSEC packets. however,
1201 * we don't it that for that purpose.
1202 */
1203 val = (unsigned long) cp->init_rxds[1] -
1204 (unsigned long) cp->init_block;
1205 writel((desc_dma + val) >> 32, cp->regs + REG_PLUS_RX_DB1_HI);
1206 writel((desc_dma + val) & 0xffffffff, cp->regs +
1207 REG_PLUS_RX_DB1_LOW);
1208 writel(RX_DESC_RINGN_SIZE(1) - 4, cp->regs +
1209 REG_PLUS_RX_KICK1);
1210 }
1211
1212 /* rx completion registers */
1213 val = (unsigned long) cp->init_rxcs[0] -
1214 (unsigned long) cp->init_block;
1215 writel((desc_dma + val) >> 32, cp->regs + REG_RX_CB_HI);
1216 writel((desc_dma + val) & 0xffffffff, cp->regs + REG_RX_CB_LOW);
1217
1218 if (cp->cas_flags & CAS_FLAG_REG_PLUS) {
1219 /* rx comp 2-4 */
1220 for (i = 1; i < MAX_RX_COMP_RINGS; i++) {
1221 val = (unsigned long) cp->init_rxcs[i] -
1222 (unsigned long) cp->init_block;
1223 writel((desc_dma + val) >> 32, cp->regs +
1224 REG_PLUS_RX_CBN_HI(i));
1225 writel((desc_dma + val) & 0xffffffff, cp->regs +
1226 REG_PLUS_RX_CBN_LOW(i));
1227 }
1228 }
1229
1230 /* read selective clear regs to prevent spurious interrupts
1231 * on reset because complete == kick.
1232 * selective clear set up to prevent interrupts on resets
1233 */
1234 readl(cp->regs + REG_INTR_STATUS_ALIAS);
1235 writel(INTR_RX_DONE | INTR_RX_BUF_UNAVAIL, cp->regs + REG_ALIAS_CLEAR);
1236 if (cp->cas_flags & CAS_FLAG_REG_PLUS) {
1237 for (i = 1; i < N_RX_COMP_RINGS; i++)
1238 readl(cp->regs + REG_PLUS_INTRN_STATUS_ALIAS(i));
1239
1240 /* 2 is different from 3 and 4 */
1241 if (N_RX_COMP_RINGS > 1)
1242 writel(INTR_RX_DONE_ALT | INTR_RX_BUF_UNAVAIL_1,
1243 cp->regs + REG_PLUS_ALIASN_CLEAR(1));
1244
1245 for (i = 2; i < N_RX_COMP_RINGS; i++)
1246 writel(INTR_RX_DONE_ALT,
1247 cp->regs + REG_PLUS_ALIASN_CLEAR(i));
1248 }
1249
1250 /* set up pause thresholds */
1251 val = CAS_BASE(RX_PAUSE_THRESH_OFF,
1252 cp->rx_pause_off / RX_PAUSE_THRESH_QUANTUM);
1253 val |= CAS_BASE(RX_PAUSE_THRESH_ON,
1254 cp->rx_pause_on / RX_PAUSE_THRESH_QUANTUM);
1255 writel(val, cp->regs + REG_RX_PAUSE_THRESH);
1256
1257 /* zero out dma reassembly buffers */
1258 for (i = 0; i < 64; i++) {
1259 writel(i, cp->regs + REG_RX_TABLE_ADDR);
1260 writel(0x0, cp->regs + REG_RX_TABLE_DATA_LOW);
1261 writel(0x0, cp->regs + REG_RX_TABLE_DATA_MID);
1262 writel(0x0, cp->regs + REG_RX_TABLE_DATA_HI);
1263 }
1264
1265 /* make sure address register is 0 for normal operation */
1266 writel(0x0, cp->regs + REG_RX_CTRL_FIFO_ADDR);
1267 writel(0x0, cp->regs + REG_RX_IPP_FIFO_ADDR);
1268
1269 /* interrupt mitigation */
1270#ifdef USE_RX_BLANK
1271 val = CAS_BASE(RX_BLANK_INTR_TIME, RX_BLANK_INTR_TIME_VAL);
1272 val |= CAS_BASE(RX_BLANK_INTR_PKT, RX_BLANK_INTR_PKT_VAL);
1273 writel(val, cp->regs + REG_RX_BLANK);
1274#else
1275 writel(0x0, cp->regs + REG_RX_BLANK);
1276#endif
1277
1278 /* interrupt generation as a function of low water marks for
1279 * free desc and completion entries. these are used to trigger
1280 * housekeeping for rx descs. we don't use the free interrupt
1281 * as it's not very useful
1282 */
1283 /* val = CAS_BASE(RX_AE_THRESH_FREE, RX_AE_FREEN_VAL(0)); */
1284 val = CAS_BASE(RX_AE_THRESH_COMP, RX_AE_COMP_VAL);
1285 writel(val, cp->regs + REG_RX_AE_THRESH);
1286 if (cp->cas_flags & CAS_FLAG_REG_PLUS) {
1287 val = CAS_BASE(RX_AE1_THRESH_FREE, RX_AE_FREEN_VAL(1));
1288 writel(val, cp->regs + REG_PLUS_RX_AE1_THRESH);
1289 }
1290
1291 /* Random early detect registers. useful for congestion avoidance.
1292 * this should be tunable.
1293 */
1294 writel(0x0, cp->regs + REG_RX_RED);
1295
1296 /* receive page sizes. default == 2K (0x800) */
1297 val = 0;
1298 if (cp->page_size == 0x1000)
1299 val = 0x1;
1300 else if (cp->page_size == 0x2000)
1301 val = 0x2;
1302 else if (cp->page_size == 0x4000)
1303 val = 0x3;
1304
1305 /* round mtu + offset. constrain to page size. */
1306 size = cp->dev->mtu + 64;
1307 if (size > cp->page_size)
1308 size = cp->page_size;
1309
1310 if (size <= 0x400)
1311 i = 0x0;
1312 else if (size <= 0x800)
1313 i = 0x1;
1314 else if (size <= 0x1000)
1315 i = 0x2;
1316 else
1317 i = 0x3;
1318
1319 cp->mtu_stride = 1 << (i + 10);
1320 val = CAS_BASE(RX_PAGE_SIZE, val);
1321 val |= CAS_BASE(RX_PAGE_SIZE_MTU_STRIDE, i);
1322 val |= CAS_BASE(RX_PAGE_SIZE_MTU_COUNT, cp->page_size >> (i + 10));
1323 val |= CAS_BASE(RX_PAGE_SIZE_MTU_OFF, 0x1);
1324 writel(val, cp->regs + REG_RX_PAGE_SIZE);
1325
1326 /* enable the header parser if desired */
1327 if (CAS_HP_FIRMWARE == cas_prog_null)
1328 return;
1329
1330 val = CAS_BASE(HP_CFG_NUM_CPU, CAS_NCPUS > 63 ? 0 : CAS_NCPUS);
1331 val |= HP_CFG_PARSE_EN | HP_CFG_SYN_INC_MASK;
1332 val |= CAS_BASE(HP_CFG_TCP_THRESH, HP_TCP_THRESH_VAL);
1333 writel(val, cp->regs + REG_HP_CFG);
1334}
1335
1336static inline void cas_rxc_init(struct cas_rx_comp *rxc)
1337{
1338 memset(rxc, 0, sizeof(*rxc));
1339 rxc->word4 = cpu_to_le64(RX_COMP4_ZERO);
1340}
1341
1342/* NOTE: we use the ENC RX DESC ring for spares. the rx_page[0,1]
1343 * flipping is protected by the fact that the chip will not
1344 * hand back the same page index while it's being processed.
1345 */
1346static inline cas_page_t *cas_page_spare(struct cas *cp, const int index)
1347{
1348 cas_page_t *page = cp->rx_pages[1][index];
1349 cas_page_t *new;
1350
1351 if (page_count(page->buffer) == 1)
1352 return page;
1353
1354 new = cas_page_dequeue(cp);
1355 if (new) {
1356 spin_lock(&cp->rx_inuse_lock);
1357 list_add(&page->list, &cp->rx_inuse_list);
1358 spin_unlock(&cp->rx_inuse_lock);
1359 }
1360 return new;
1361}
1362
1363/* this needs to be changed if we actually use the ENC RX DESC ring */
1364static cas_page_t *cas_page_swap(struct cas *cp, const int ring,
1365 const int index)
1366{
1367 cas_page_t **page0 = cp->rx_pages[0];
1368 cas_page_t **page1 = cp->rx_pages[1];
1369
1370 /* swap if buffer is in use */
1371 if (page_count(page0[index]->buffer) > 1) {
1372 cas_page_t *new = cas_page_spare(cp, index);
1373 if (new) {
1374 page1[index] = page0[index];
1375 page0[index] = new;
1376 }
1377 }
1378 RX_USED_SET(page0[index], 0);
1379 return page0[index];
1380}
1381
1382static void cas_clean_rxds(struct cas *cp)
1383{
1384 /* only clean ring 0 as ring 1 is used for spare buffers */
1385 struct cas_rx_desc *rxd = cp->init_rxds[0];
1386 int i, size;
1387
1388 /* release all rx flows */
1389 for (i = 0; i < N_RX_FLOWS; i++) {
1390 struct sk_buff *skb;
1391 while ((skb = __skb_dequeue(&cp->rx_flows[i]))) {
1392 cas_skb_release(skb);
1393 }
1394 }
1395
1396 /* initialize descriptors */
1397 size = RX_DESC_RINGN_SIZE(0);
1398 for (i = 0; i < size; i++) {
1399 cas_page_t *page = cas_page_swap(cp, 0, i);
1400 rxd[i].buffer = cpu_to_le64(page->dma_addr);
1401 rxd[i].index = cpu_to_le64(CAS_BASE(RX_INDEX_NUM, i) |
1402 CAS_BASE(RX_INDEX_RING, 0));
1403 }
1404
1405 cp->rx_old[0] = RX_DESC_RINGN_SIZE(0) - 4;
1406 cp->rx_last[0] = 0;
1407 cp->cas_flags &= ~CAS_FLAG_RXD_POST(0);
1408}
1409
1410static void cas_clean_rxcs(struct cas *cp)
1411{
1412 int i, j;
1413
1414 /* take ownership of rx comp descriptors */
1415 memset(cp->rx_cur, 0, sizeof(*cp->rx_cur)*N_RX_COMP_RINGS);
1416 memset(cp->rx_new, 0, sizeof(*cp->rx_new)*N_RX_COMP_RINGS);
1417 for (i = 0; i < N_RX_COMP_RINGS; i++) {
1418 struct cas_rx_comp *rxc = cp->init_rxcs[i];
1419 for (j = 0; j < RX_COMP_RINGN_SIZE(i); j++) {
1420 cas_rxc_init(rxc + j);
1421 }
1422 }
1423}
1424
1425#if 0
1426/* When we get a RX fifo overflow, the RX unit is probably hung
1427 * so we do the following.
1428 *
1429 * If any part of the reset goes wrong, we return 1 and that causes the
1430 * whole chip to be reset.
1431 */
1432static int cas_rxmac_reset(struct cas *cp)
1433{
1434 struct net_device *dev = cp->dev;
1435 int limit;
1436 u32 val;
1437
1438 /* First, reset MAC RX. */
1439 writel(cp->mac_rx_cfg & ~MAC_RX_CFG_EN, cp->regs + REG_MAC_RX_CFG);
1440 for (limit = 0; limit < STOP_TRIES; limit++) {
1441 if (!(readl(cp->regs + REG_MAC_RX_CFG) & MAC_RX_CFG_EN))
1442 break;
1443 udelay(10);
1444 }
1445 if (limit == STOP_TRIES) {
1446 printk(KERN_ERR "%s: RX MAC will not disable, resetting whole "
1447 "chip.\n", dev->name);
1448 return 1;
1449 }
1450
1451 /* Second, disable RX DMA. */
1452 writel(0, cp->regs + REG_RX_CFG);
1453 for (limit = 0; limit < STOP_TRIES; limit++) {
1454 if (!(readl(cp->regs + REG_RX_CFG) & RX_CFG_DMA_EN))
1455 break;
1456 udelay(10);
1457 }
1458 if (limit == STOP_TRIES) {
1459 printk(KERN_ERR "%s: RX DMA will not disable, resetting whole "
1460 "chip.\n", dev->name);
1461 return 1;
1462 }
1463
1464 mdelay(5);
1465
1466 /* Execute RX reset command. */
1467 writel(SW_RESET_RX, cp->regs + REG_SW_RESET);
1468 for (limit = 0; limit < STOP_TRIES; limit++) {
1469 if (!(readl(cp->regs + REG_SW_RESET) & SW_RESET_RX))
1470 break;
1471 udelay(10);
1472 }
1473 if (limit == STOP_TRIES) {
1474 printk(KERN_ERR "%s: RX reset command will not execute, "
1475 "resetting whole chip.\n", dev->name);
1476 return 1;
1477 }
1478
1479 /* reset driver rx state */
1480 cas_clean_rxds(cp);
1481 cas_clean_rxcs(cp);
1482
1483 /* Now, reprogram the rest of RX unit. */
1484 cas_init_rx_dma(cp);
1485
1486 /* re-enable */
1487 val = readl(cp->regs + REG_RX_CFG);
1488 writel(val | RX_CFG_DMA_EN, cp->regs + REG_RX_CFG);
1489 writel(MAC_RX_FRAME_RECV, cp->regs + REG_MAC_RX_MASK);
1490 val = readl(cp->regs + REG_MAC_RX_CFG);
1491 writel(val | MAC_RX_CFG_EN, cp->regs + REG_MAC_RX_CFG);
1492 return 0;
1493}
1494#endif
1495
1496static int cas_rxmac_interrupt(struct net_device *dev, struct cas *cp,
1497 u32 status)
1498{
1499 u32 stat = readl(cp->regs + REG_MAC_RX_STATUS);
1500
1501 if (!stat)
1502 return 0;
1503
1504 if (netif_msg_intr(cp))
1505 printk(KERN_DEBUG "%s: rxmac interrupt, stat: 0x%x\n",
1506 cp->dev->name, stat);
1507
1508 /* these are all rollovers */
1509 spin_lock(&cp->stat_lock[0]);
1510 if (stat & MAC_RX_ALIGN_ERR)
1511 cp->net_stats[0].rx_frame_errors += 0x10000;
1512
1513 if (stat & MAC_RX_CRC_ERR)
1514 cp->net_stats[0].rx_crc_errors += 0x10000;
1515
1516 if (stat & MAC_RX_LEN_ERR)
1517 cp->net_stats[0].rx_length_errors += 0x10000;
1518
1519 if (stat & MAC_RX_OVERFLOW) {
1520 cp->net_stats[0].rx_over_errors++;
1521 cp->net_stats[0].rx_fifo_errors++;
1522 }
1523
1524 /* We do not track MAC_RX_FRAME_COUNT and MAC_RX_VIOL_ERR
1525 * events.
1526 */
1527 spin_unlock(&cp->stat_lock[0]);
1528 return 0;
1529}
1530
1531static int cas_mac_interrupt(struct net_device *dev, struct cas *cp,
1532 u32 status)
1533{
1534 u32 stat = readl(cp->regs + REG_MAC_CTRL_STATUS);
1535
1536 if (!stat)
1537 return 0;
1538
1539 if (netif_msg_intr(cp))
1540 printk(KERN_DEBUG "%s: mac interrupt, stat: 0x%x\n",
1541 cp->dev->name, stat);
1542
1543 /* This interrupt is just for pause frame and pause
1544 * tracking. It is useful for diagnostics and debug
1545 * but probably by default we will mask these events.
1546 */
1547 if (stat & MAC_CTRL_PAUSE_STATE)
1548 cp->pause_entered++;
1549
1550 if (stat & MAC_CTRL_PAUSE_RECEIVED)
1551 cp->pause_last_time_recvd = (stat >> 16);
1552
1553 return 0;
1554}
1555
1556
1557/* Must be invoked under cp->lock. */
1558static inline int cas_mdio_link_not_up(struct cas *cp)
1559{
1560 u16 val;
1561
1562 switch (cp->lstate) {
1563 case link_force_ret:
1564 if (netif_msg_link(cp))
1565 printk(KERN_INFO "%s: Autoneg failed again, keeping"
1566 " forced mode\n", cp->dev->name);
1567 cas_phy_write(cp, MII_BMCR, cp->link_fcntl);
1568 cp->timer_ticks = 5;
1569 cp->lstate = link_force_ok;
1570 cp->link_transition = LINK_TRANSITION_LINK_CONFIG;
1571 break;
1572
1573 case link_aneg:
1574 val = cas_phy_read(cp, MII_BMCR);
1575
1576 /* Try forced modes. we try things in the following order:
1577 * 1000 full -> 100 full/half -> 10 half
1578 */
1579 val &= ~(BMCR_ANRESTART | BMCR_ANENABLE);
1580 val |= BMCR_FULLDPLX;
1581 val |= (cp->cas_flags & CAS_FLAG_1000MB_CAP) ?
1582 CAS_BMCR_SPEED1000 : BMCR_SPEED100;
1583 cas_phy_write(cp, MII_BMCR, val);
1584 cp->timer_ticks = 5;
1585 cp->lstate = link_force_try;
1586 cp->link_transition = LINK_TRANSITION_LINK_CONFIG;
1587 break;
1588
1589 case link_force_try:
1590 /* Downgrade from 1000 to 100 to 10 Mbps if necessary. */
1591 val = cas_phy_read(cp, MII_BMCR);
1592 cp->timer_ticks = 5;
1593 if (val & CAS_BMCR_SPEED1000) { /* gigabit */
1594 val &= ~CAS_BMCR_SPEED1000;
1595 val |= (BMCR_SPEED100 | BMCR_FULLDPLX);
1596 cas_phy_write(cp, MII_BMCR, val);
1597 break;
1598 }
1599
1600 if (val & BMCR_SPEED100) {
1601 if (val & BMCR_FULLDPLX) /* fd failed */
1602 val &= ~BMCR_FULLDPLX;
1603 else { /* 100Mbps failed */
1604 val &= ~BMCR_SPEED100;
1605 }
1606 cas_phy_write(cp, MII_BMCR, val);
1607 break;
1608 }
1609 default:
1610 break;
1611 }
1612 return 0;
1613}
1614
1615
1616/* must be invoked with cp->lock held */
1617static int cas_mii_link_check(struct cas *cp, const u16 bmsr)
1618{
1619 int restart;
1620
1621 if (bmsr & BMSR_LSTATUS) {
1622 /* Ok, here we got a link. If we had it due to a forced
1623 * fallback, and we were configured for autoneg, we
1624 * retry a short autoneg pass. If you know your hub is
1625 * broken, use ethtool ;)
1626 */
1627 if ((cp->lstate == link_force_try) &&
1628 (cp->link_cntl & BMCR_ANENABLE)) {
1629 cp->lstate = link_force_ret;
1630 cp->link_transition = LINK_TRANSITION_LINK_CONFIG;
1631 cas_mif_poll(cp, 0);
1632 cp->link_fcntl = cas_phy_read(cp, MII_BMCR);
1633 cp->timer_ticks = 5;
1634 if (cp->opened && netif_msg_link(cp))
1635 printk(KERN_INFO "%s: Got link after fallback, retrying"
1636 " autoneg once...\n", cp->dev->name);
1637 cas_phy_write(cp, MII_BMCR,
1638 cp->link_fcntl | BMCR_ANENABLE |
1639 BMCR_ANRESTART);
1640 cas_mif_poll(cp, 1);
1641
1642 } else if (cp->lstate != link_up) {
1643 cp->lstate = link_up;
1644 cp->link_transition = LINK_TRANSITION_LINK_UP;
1645
1646 if (cp->opened) {
1647 cas_set_link_modes(cp);
1648 netif_carrier_on(cp->dev);
1649 }
1650 }
1651 return 0;
1652 }
1653
1654 /* link not up. if the link was previously up, we restart the
1655 * whole process
1656 */
1657 restart = 0;
1658 if (cp->lstate == link_up) {
1659 cp->lstate = link_down;
1660 cp->link_transition = LINK_TRANSITION_LINK_DOWN;
1661
1662 netif_carrier_off(cp->dev);
1663 if (cp->opened && netif_msg_link(cp))
1664 printk(KERN_INFO "%s: Link down\n",
1665 cp->dev->name);
1666 restart = 1;
1667
1668 } else if (++cp->timer_ticks > 10)
1669 cas_mdio_link_not_up(cp);
1670
1671 return restart;
1672}
1673
1674static int cas_mif_interrupt(struct net_device *dev, struct cas *cp,
1675 u32 status)
1676{
1677 u32 stat = readl(cp->regs + REG_MIF_STATUS);
1678 u16 bmsr;
1679
1680 /* check for a link change */
1681 if (CAS_VAL(MIF_STATUS_POLL_STATUS, stat) == 0)
1682 return 0;
1683
1684 bmsr = CAS_VAL(MIF_STATUS_POLL_DATA, stat);
1685 return cas_mii_link_check(cp, bmsr);
1686}
1687
1688static int cas_pci_interrupt(struct net_device *dev, struct cas *cp,
1689 u32 status)
1690{
1691 u32 stat = readl(cp->regs + REG_PCI_ERR_STATUS);
1692
1693 if (!stat)
1694 return 0;
1695
1696 printk(KERN_ERR "%s: PCI error [%04x:%04x] ", dev->name, stat,
1697 readl(cp->regs + REG_BIM_DIAG));
1698
1699 /* cassini+ has this reserved */
1700 if ((stat & PCI_ERR_BADACK) &&
1701 ((cp->cas_flags & CAS_FLAG_REG_PLUS) == 0))
1702 printk("<No ACK64# during ABS64 cycle> ");
1703
1704 if (stat & PCI_ERR_DTRTO)
1705 printk("<Delayed transaction timeout> ");
1706 if (stat & PCI_ERR_OTHER)
1707 printk("<other> ");
1708 if (stat & PCI_ERR_BIM_DMA_WRITE)
1709 printk("<BIM DMA 0 write req> ");
1710 if (stat & PCI_ERR_BIM_DMA_READ)
1711 printk("<BIM DMA 0 read req> ");
1712 printk("\n");
1713
1714 if (stat & PCI_ERR_OTHER) {
1715 u16 cfg;
1716
1717 /* Interrogate PCI config space for the
1718 * true cause.
1719 */
1720 pci_read_config_word(cp->pdev, PCI_STATUS, &cfg);
1721 printk(KERN_ERR "%s: Read PCI cfg space status [%04x]\n",
1722 dev->name, cfg);
1723 if (cfg & PCI_STATUS_PARITY)
1724 printk(KERN_ERR "%s: PCI parity error detected.\n",
1725 dev->name);
1726 if (cfg & PCI_STATUS_SIG_TARGET_ABORT)
1727 printk(KERN_ERR "%s: PCI target abort.\n",
1728 dev->name);
1729 if (cfg & PCI_STATUS_REC_TARGET_ABORT)
1730 printk(KERN_ERR "%s: PCI master acks target abort.\n",
1731 dev->name);
1732 if (cfg & PCI_STATUS_REC_MASTER_ABORT)
1733 printk(KERN_ERR "%s: PCI master abort.\n", dev->name);
1734 if (cfg & PCI_STATUS_SIG_SYSTEM_ERROR)
1735 printk(KERN_ERR "%s: PCI system error SERR#.\n",
1736 dev->name);
1737 if (cfg & PCI_STATUS_DETECTED_PARITY)
1738 printk(KERN_ERR "%s: PCI parity error.\n",
1739 dev->name);
1740
1741 /* Write the error bits back to clear them. */
1742 cfg &= (PCI_STATUS_PARITY |
1743 PCI_STATUS_SIG_TARGET_ABORT |
1744 PCI_STATUS_REC_TARGET_ABORT |
1745 PCI_STATUS_REC_MASTER_ABORT |
1746 PCI_STATUS_SIG_SYSTEM_ERROR |
1747 PCI_STATUS_DETECTED_PARITY);
1748 pci_write_config_word(cp->pdev, PCI_STATUS, cfg);
1749 }
1750
1751 /* For all PCI errors, we should reset the chip. */
1752 return 1;
1753}
1754
1755/* All non-normal interrupt conditions get serviced here.
1756 * Returns non-zero if we should just exit the interrupt
1757 * handler right now (ie. if we reset the card which invalidates
1758 * all of the other original irq status bits).
1759 */
1760static int cas_abnormal_irq(struct net_device *dev, struct cas *cp,
1761 u32 status)
1762{
1763 if (status & INTR_RX_TAG_ERROR) {
1764 /* corrupt RX tag framing */
1765 if (netif_msg_rx_err(cp))
1766 printk(KERN_DEBUG "%s: corrupt rx tag framing\n",
1767 cp->dev->name);
1768 spin_lock(&cp->stat_lock[0]);
1769 cp->net_stats[0].rx_errors++;
1770 spin_unlock(&cp->stat_lock[0]);
1771 goto do_reset;
1772 }
1773
1774 if (status & INTR_RX_LEN_MISMATCH) {
1775 /* length mismatch. */
1776 if (netif_msg_rx_err(cp))
1777 printk(KERN_DEBUG "%s: length mismatch for rx frame\n",
1778 cp->dev->name);
1779 spin_lock(&cp->stat_lock[0]);
1780 cp->net_stats[0].rx_errors++;
1781 spin_unlock(&cp->stat_lock[0]);
1782 goto do_reset;
1783 }
1784
1785 if (status & INTR_PCS_STATUS) {
1786 if (cas_pcs_interrupt(dev, cp, status))
1787 goto do_reset;
1788 }
1789
1790 if (status & INTR_TX_MAC_STATUS) {
1791 if (cas_txmac_interrupt(dev, cp, status))
1792 goto do_reset;
1793 }
1794
1795 if (status & INTR_RX_MAC_STATUS) {
1796 if (cas_rxmac_interrupt(dev, cp, status))
1797 goto do_reset;
1798 }
1799
1800 if (status & INTR_MAC_CTRL_STATUS) {
1801 if (cas_mac_interrupt(dev, cp, status))
1802 goto do_reset;
1803 }
1804
1805 if (status & INTR_MIF_STATUS) {
1806 if (cas_mif_interrupt(dev, cp, status))
1807 goto do_reset;
1808 }
1809
1810 if (status & INTR_PCI_ERROR_STATUS) {
1811 if (cas_pci_interrupt(dev, cp, status))
1812 goto do_reset;
1813 }
1814 return 0;
1815
1816do_reset:
1817#if 1
1818 atomic_inc(&cp->reset_task_pending);
1819 atomic_inc(&cp->reset_task_pending_all);
1820 printk(KERN_ERR "%s:reset called in cas_abnormal_irq [0x%x]\n",
1821 dev->name, status);
1822 schedule_work(&cp->reset_task);
1823#else
1824 atomic_set(&cp->reset_task_pending, CAS_RESET_ALL);
1825 printk(KERN_ERR "reset called in cas_abnormal_irq\n");
1826 schedule_work(&cp->reset_task);
1827#endif
1828 return 1;
1829}
1830
1831/* NOTE: CAS_TABORT returns 1 or 2 so that it can be used when
1832 * determining whether to do a netif_stop/wakeup
1833 */
1834#define CAS_TABORT(x) (((x)->cas_flags & CAS_FLAG_TARGET_ABORT) ? 2 : 1)
1835#define CAS_ROUND_PAGE(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
1836static inline int cas_calc_tabort(struct cas *cp, const unsigned long addr,
1837 const int len)
1838{
1839 unsigned long off = addr + len;
1840
1841 if (CAS_TABORT(cp) == 1)
1842 return 0;
1843 if ((CAS_ROUND_PAGE(off) - off) > TX_TARGET_ABORT_LEN)
1844 return 0;
1845 return TX_TARGET_ABORT_LEN;
1846}
1847
1848static inline void cas_tx_ringN(struct cas *cp, int ring, int limit)
1849{
1850 struct cas_tx_desc *txds;
1851 struct sk_buff **skbs;
1852 struct net_device *dev = cp->dev;
1853 int entry, count;
1854
1855 spin_lock(&cp->tx_lock[ring]);
1856 txds = cp->init_txds[ring];
1857 skbs = cp->tx_skbs[ring];
1858 entry = cp->tx_old[ring];
1859
1860 count = TX_BUFF_COUNT(ring, entry, limit);
1861 while (entry != limit) {
1862 struct sk_buff *skb = skbs[entry];
1863 dma_addr_t daddr;
1864 u32 dlen;
1865 int frag;
1866
1867 if (!skb) {
1868 /* this should never occur */
1869 entry = TX_DESC_NEXT(ring, entry);
1870 continue;
1871 }
1872
1873 /* however, we might get only a partial skb release. */
1874 count -= skb_shinfo(skb)->nr_frags +
1875 + cp->tx_tiny_use[ring][entry].nbufs + 1;
1876 if (count < 0)
1877 break;
1878
1879 if (netif_msg_tx_done(cp))
1880 printk(KERN_DEBUG "%s: tx[%d] done, slot %d\n",
1881 cp->dev->name, ring, entry);
1882
1883 skbs[entry] = NULL;
1884 cp->tx_tiny_use[ring][entry].nbufs = 0;
1885
1886 for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) {
1887 struct cas_tx_desc *txd = txds + entry;
1888
1889 daddr = le64_to_cpu(txd->buffer);
1890 dlen = CAS_VAL(TX_DESC_BUFLEN,
1891 le64_to_cpu(txd->control));
1892 pci_unmap_page(cp->pdev, daddr, dlen,
1893 PCI_DMA_TODEVICE);
1894 entry = TX_DESC_NEXT(ring, entry);
1895
1896 /* tiny buffer may follow */
1897 if (cp->tx_tiny_use[ring][entry].used) {
1898 cp->tx_tiny_use[ring][entry].used = 0;
1899 entry = TX_DESC_NEXT(ring, entry);
1900 }
1901 }
1902
1903 spin_lock(&cp->stat_lock[ring]);
1904 cp->net_stats[ring].tx_packets++;
1905 cp->net_stats[ring].tx_bytes += skb->len;
1906 spin_unlock(&cp->stat_lock[ring]);
1907 dev_kfree_skb_irq(skb);
1908 }
1909 cp->tx_old[ring] = entry;
1910
1911 /* this is wrong for multiple tx rings. the net device needs
1912 * multiple queues for this to do the right thing. we wait
1913 * for 2*packets to be available when using tiny buffers
1914 */
1915 if (netif_queue_stopped(dev) &&
1916 (TX_BUFFS_AVAIL(cp, ring) > CAS_TABORT(cp)*(MAX_SKB_FRAGS + 1)))
1917 netif_wake_queue(dev);
1918 spin_unlock(&cp->tx_lock[ring]);
1919}
1920
1921static void cas_tx(struct net_device *dev, struct cas *cp,
1922 u32 status)
1923{
1924 int limit, ring;
1925#ifdef USE_TX_COMPWB
1926 u64 compwb = le64_to_cpu(cp->init_block->tx_compwb);
1927#endif
1928 if (netif_msg_intr(cp))
1929 printk(KERN_DEBUG "%s: tx interrupt, status: 0x%x, %lx\n",
1930 cp->dev->name, status, compwb);
1931 /* process all the rings */
1932 for (ring = 0; ring < N_TX_RINGS; ring++) {
1933#ifdef USE_TX_COMPWB
1934 /* use the completion writeback registers */
1935 limit = (CAS_VAL(TX_COMPWB_MSB, compwb) << 8) |
1936 CAS_VAL(TX_COMPWB_LSB, compwb);
1937 compwb = TX_COMPWB_NEXT(compwb);
1938#else
1939 limit = readl(cp->regs + REG_TX_COMPN(ring));
1940#endif
1941 if (cp->tx_old[ring] != limit)
1942 cas_tx_ringN(cp, ring, limit);
1943 }
1944}
1945
1946
1947static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
1948 int entry, const u64 *words,
1949 struct sk_buff **skbref)
1950{
1951 int dlen, hlen, len, i, alloclen;
1952 int off, swivel = RX_SWIVEL_OFF_VAL;
1953 struct cas_page *page;
1954 struct sk_buff *skb;
1955 void *addr, *crcaddr;
1956 char *p;
1957
1958 hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]);
1959 dlen = CAS_VAL(RX_COMP1_DATA_SIZE, words[0]);
1960 len = hlen + dlen;
1961
1962 if (RX_COPY_ALWAYS || (words[2] & RX_COMP3_SMALL_PKT))
1963 alloclen = len;
1964 else
1965 alloclen = max(hlen, RX_COPY_MIN);
1966
1967 skb = dev_alloc_skb(alloclen + swivel + cp->crc_size);
1968 if (skb == NULL)
1969 return -1;
1970
1971 *skbref = skb;
1972 skb->dev = cp->dev;
1973 skb_reserve(skb, swivel);
1974
1975 p = skb->data;
1976 addr = crcaddr = NULL;
1977 if (hlen) { /* always copy header pages */
1978 i = CAS_VAL(RX_COMP2_HDR_INDEX, words[1]);
1979 page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)];
1980 off = CAS_VAL(RX_COMP2_HDR_OFF, words[1]) * 0x100 +
1981 swivel;
1982
1983 i = hlen;
1984 if (!dlen) /* attach FCS */
1985 i += cp->crc_size;
1986 pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr + off, i,
1987 PCI_DMA_FROMDEVICE);
1988 addr = cas_page_map(page->buffer);
1989 memcpy(p, addr + off, i);
1990 pci_dma_sync_single_for_device(cp->pdev, page->dma_addr + off, i,
1991 PCI_DMA_FROMDEVICE);
1992 cas_page_unmap(addr);
1993 RX_USED_ADD(page, 0x100);
1994 p += hlen;
1995 swivel = 0;
1996 }
1997
1998
1999 if (alloclen < (hlen + dlen)) {
2000 skb_frag_t *frag = skb_shinfo(skb)->frags;
2001
2002 /* normal or jumbo packets. we use frags */
2003 i = CAS_VAL(RX_COMP1_DATA_INDEX, words[0]);
2004 page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)];
2005 off = CAS_VAL(RX_COMP1_DATA_OFF, words[0]) + swivel;
2006
2007 hlen = min(cp->page_size - off, dlen);
2008 if (hlen < 0) {
2009 if (netif_msg_rx_err(cp)) {
2010 printk(KERN_DEBUG "%s: rx page overflow: "
2011 "%d\n", cp->dev->name, hlen);
2012 }
2013 dev_kfree_skb_irq(skb);
2014 return -1;
2015 }
2016 i = hlen;
2017 if (i == dlen) /* attach FCS */
2018 i += cp->crc_size;
2019 pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr + off, i,
2020 PCI_DMA_FROMDEVICE);
2021
2022 /* make sure we always copy a header */
2023 swivel = 0;
2024 if (p == (char *) skb->data) { /* not split */
2025 addr = cas_page_map(page->buffer);
2026 memcpy(p, addr + off, RX_COPY_MIN);
2027 pci_dma_sync_single_for_device(cp->pdev, page->dma_addr + off, i,
2028 PCI_DMA_FROMDEVICE);
2029 cas_page_unmap(addr);
2030 off += RX_COPY_MIN;
2031 swivel = RX_COPY_MIN;
2032 RX_USED_ADD(page, cp->mtu_stride);
2033 } else {
2034 RX_USED_ADD(page, hlen);
2035 }
2036 skb_put(skb, alloclen);
2037
2038 skb_shinfo(skb)->nr_frags++;
2039 skb->data_len += hlen - swivel;
2040 skb->len += hlen - swivel;
2041
2042 get_page(page->buffer);
2043 frag->page = page->buffer;
2044 frag->page_offset = off;
2045 frag->size = hlen - swivel;
2046
2047 /* any more data? */
2048 if ((words[0] & RX_COMP1_SPLIT_PKT) && ((dlen -= hlen) > 0)) {
2049 hlen = dlen;
2050 off = 0;
2051
2052 i = CAS_VAL(RX_COMP2_NEXT_INDEX, words[1]);
2053 page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)];
2054 pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr,
2055 hlen + cp->crc_size,
2056 PCI_DMA_FROMDEVICE);
2057 pci_dma_sync_single_for_device(cp->pdev, page->dma_addr,
2058 hlen + cp->crc_size,
2059 PCI_DMA_FROMDEVICE);
2060
2061 skb_shinfo(skb)->nr_frags++;
2062 skb->data_len += hlen;
2063 skb->len += hlen;
2064 frag++;
2065
2066 get_page(page->buffer);
2067 frag->page = page->buffer;
2068 frag->page_offset = 0;
2069 frag->size = hlen;
2070 RX_USED_ADD(page, hlen + cp->crc_size);
2071 }
2072
2073 if (cp->crc_size) {
2074 addr = cas_page_map(page->buffer);
2075 crcaddr = addr + off + hlen;
2076 }
2077
2078 } else {
2079 /* copying packet */
2080 if (!dlen)
2081 goto end_copy_pkt;
2082
2083 i = CAS_VAL(RX_COMP1_DATA_INDEX, words[0]);
2084 page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)];
2085 off = CAS_VAL(RX_COMP1_DATA_OFF, words[0]) + swivel;
2086 hlen = min(cp->page_size - off, dlen);
2087 if (hlen < 0) {
2088 if (netif_msg_rx_err(cp)) {
2089 printk(KERN_DEBUG "%s: rx page overflow: "
2090 "%d\n", cp->dev->name, hlen);
2091 }
2092 dev_kfree_skb_irq(skb);
2093 return -1;
2094 }
2095 i = hlen;
2096 if (i == dlen) /* attach FCS */
2097 i += cp->crc_size;
2098 pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr + off, i,
2099 PCI_DMA_FROMDEVICE);
2100 addr = cas_page_map(page->buffer);
2101 memcpy(p, addr + off, i);
2102 pci_dma_sync_single_for_device(cp->pdev, page->dma_addr + off, i,
2103 PCI_DMA_FROMDEVICE);
2104 cas_page_unmap(addr);
2105 if (p == (char *) skb->data) /* not split */
2106 RX_USED_ADD(page, cp->mtu_stride);
2107 else
2108 RX_USED_ADD(page, i);
2109
2110 /* any more data? */
2111 if ((words[0] & RX_COMP1_SPLIT_PKT) && ((dlen -= hlen) > 0)) {
2112 p += hlen;
2113 i = CAS_VAL(RX_COMP2_NEXT_INDEX, words[1]);
2114 page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)];
2115 pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr,
2116 dlen + cp->crc_size,
2117 PCI_DMA_FROMDEVICE);
2118 addr = cas_page_map(page->buffer);
2119 memcpy(p, addr, dlen + cp->crc_size);
2120 pci_dma_sync_single_for_device(cp->pdev, page->dma_addr,
2121 dlen + cp->crc_size,
2122 PCI_DMA_FROMDEVICE);
2123 cas_page_unmap(addr);
2124 RX_USED_ADD(page, dlen + cp->crc_size);
2125 }
2126end_copy_pkt:
2127 if (cp->crc_size) {
2128 addr = NULL;
2129 crcaddr = skb->data + alloclen;
2130 }
2131 skb_put(skb, alloclen);
2132 }
2133
2134 i = CAS_VAL(RX_COMP4_TCP_CSUM, words[3]);
2135 if (cp->crc_size) {
2136 /* checksum includes FCS. strip it out. */
2137 i = csum_fold(csum_partial(crcaddr, cp->crc_size, i));
2138 if (addr)
2139 cas_page_unmap(addr);
2140 }
2141 skb->csum = ntohs(i ^ 0xffff);
2142 skb->ip_summed = CHECKSUM_HW;
2143 skb->protocol = eth_type_trans(skb, cp->dev);
2144 return len;
2145}
2146
2147
2148/* we can handle up to 64 rx flows at a time. we do the same thing
2149 * as nonreassm except that we batch up the buffers.
2150 * NOTE: we currently just treat each flow as a bunch of packets that
2151 * we pass up. a better way would be to coalesce the packets
2152 * into a jumbo packet. to do that, we need to do the following:
2153 * 1) the first packet will have a clean split between header and
2154 * data. save both.
2155 * 2) each time the next flow packet comes in, extend the
2156 * data length and merge the checksums.
2157 * 3) on flow release, fix up the header.
2158 * 4) make sure the higher layer doesn't care.
2159 * because packets get coalesced, we shouldn't run into fragment count
2160 * issues.
2161 */
2162static inline void cas_rx_flow_pkt(struct cas *cp, const u64 *words,
2163 struct sk_buff *skb)
2164{
2165 int flowid = CAS_VAL(RX_COMP3_FLOWID, words[2]) & (N_RX_FLOWS - 1);
2166 struct sk_buff_head *flow = &cp->rx_flows[flowid];
2167
2168 /* this is protected at a higher layer, so no need to
2169 * do any additional locking here. stick the buffer
2170 * at the end.
2171 */
2172 __skb_insert(skb, flow->prev, (struct sk_buff *) flow, flow);
2173 if (words[0] & RX_COMP1_RELEASE_FLOW) {
2174 while ((skb = __skb_dequeue(flow))) {
2175 cas_skb_release(skb);
2176 }
2177 }
2178}
2179
2180/* put rx descriptor back on ring. if a buffer is in use by a higher
2181 * layer, this will need to put in a replacement.
2182 */
2183static void cas_post_page(struct cas *cp, const int ring, const int index)
2184{
2185 cas_page_t *new;
2186 int entry;
2187
2188 entry = cp->rx_old[ring];
2189
2190 new = cas_page_swap(cp, ring, index);
2191 cp->init_rxds[ring][entry].buffer = cpu_to_le64(new->dma_addr);
2192 cp->init_rxds[ring][entry].index =
2193 cpu_to_le64(CAS_BASE(RX_INDEX_NUM, index) |
2194 CAS_BASE(RX_INDEX_RING, ring));
2195
2196 entry = RX_DESC_ENTRY(ring, entry + 1);
2197 cp->rx_old[ring] = entry;
2198
2199 if (entry % 4)
2200 return;
2201
2202 if (ring == 0)
2203 writel(entry, cp->regs + REG_RX_KICK);
2204 else if ((N_RX_DESC_RINGS > 1) &&
2205 (cp->cas_flags & CAS_FLAG_REG_PLUS))
2206 writel(entry, cp->regs + REG_PLUS_RX_KICK1);
2207}
2208
2209
2210/* only when things are bad */
2211static int cas_post_rxds_ringN(struct cas *cp, int ring, int num)
2212{
2213 unsigned int entry, last, count, released;
2214 int cluster;
2215 cas_page_t **page = cp->rx_pages[ring];
2216
2217 entry = cp->rx_old[ring];
2218
2219 if (netif_msg_intr(cp))
2220 printk(KERN_DEBUG "%s: rxd[%d] interrupt, done: %d\n",
2221 cp->dev->name, ring, entry);
2222
2223 cluster = -1;
2224 count = entry & 0x3;
2225 last = RX_DESC_ENTRY(ring, num ? entry + num - 4: entry - 4);
2226 released = 0;
2227 while (entry != last) {
2228 /* make a new buffer if it's still in use */
2229 if (page_count(page[entry]->buffer) > 1) {
2230 cas_page_t *new = cas_page_dequeue(cp);
2231 if (!new) {
2232 /* let the timer know that we need to
2233 * do this again
2234 */
2235 cp->cas_flags |= CAS_FLAG_RXD_POST(ring);
2236 if (!timer_pending(&cp->link_timer))
2237 mod_timer(&cp->link_timer, jiffies +
2238 CAS_LINK_FAST_TIMEOUT);
2239 cp->rx_old[ring] = entry;
2240 cp->rx_last[ring] = num ? num - released : 0;
2241 return -ENOMEM;
2242 }
2243 spin_lock(&cp->rx_inuse_lock);
2244 list_add(&page[entry]->list, &cp->rx_inuse_list);
2245 spin_unlock(&cp->rx_inuse_lock);
2246 cp->init_rxds[ring][entry].buffer =
2247 cpu_to_le64(new->dma_addr);
2248 page[entry] = new;
2249
2250 }
2251
2252 if (++count == 4) {
2253 cluster = entry;
2254 count = 0;
2255 }
2256 released++;
2257 entry = RX_DESC_ENTRY(ring, entry + 1);
2258 }
2259 cp->rx_old[ring] = entry;
2260
2261 if (cluster < 0)
2262 return 0;
2263
2264 if (ring == 0)
2265 writel(cluster, cp->regs + REG_RX_KICK);
2266 else if ((N_RX_DESC_RINGS > 1) &&
2267 (cp->cas_flags & CAS_FLAG_REG_PLUS))
2268 writel(cluster, cp->regs + REG_PLUS_RX_KICK1);
2269 return 0;
2270}
2271
2272
2273/* process a completion ring. packets are set up in three basic ways:
2274 * small packets: should be copied header + data in single buffer.
2275 * large packets: header and data in a single buffer.
2276 * split packets: header in a separate buffer from data.
2277 * data may be in multiple pages. data may be > 256
2278 * bytes but in a single page.
2279 *
2280 * NOTE: RX page posting is done in this routine as well. while there's
2281 * the capability of using multiple RX completion rings, it isn't
2282 * really worthwhile due to the fact that the page posting will
2283 * force serialization on the single descriptor ring.
2284 */
2285static int cas_rx_ringN(struct cas *cp, int ring, int budget)
2286{
2287 struct cas_rx_comp *rxcs = cp->init_rxcs[ring];
2288 int entry, drops;
2289 int npackets = 0;
2290
2291 if (netif_msg_intr(cp))
2292 printk(KERN_DEBUG "%s: rx[%d] interrupt, done: %d/%d\n",
2293 cp->dev->name, ring,
2294 readl(cp->regs + REG_RX_COMP_HEAD),
2295 cp->rx_new[ring]);
2296
2297 entry = cp->rx_new[ring];
2298 drops = 0;
2299 while (1) {
2300 struct cas_rx_comp *rxc = rxcs + entry;
2301 struct sk_buff *skb;
2302 int type, len;
2303 u64 words[4];
2304 int i, dring;
2305
2306 words[0] = le64_to_cpu(rxc->word1);
2307 words[1] = le64_to_cpu(rxc->word2);
2308 words[2] = le64_to_cpu(rxc->word3);
2309 words[3] = le64_to_cpu(rxc->word4);
2310
2311 /* don't touch if still owned by hw */
2312 type = CAS_VAL(RX_COMP1_TYPE, words[0]);
2313 if (type == 0)
2314 break;
2315
2316 /* hw hasn't cleared the zero bit yet */
2317 if (words[3] & RX_COMP4_ZERO) {
2318 break;
2319 }
2320
2321 /* get info on the packet */
2322 if (words[3] & (RX_COMP4_LEN_MISMATCH | RX_COMP4_BAD)) {
2323 spin_lock(&cp->stat_lock[ring]);
2324 cp->net_stats[ring].rx_errors++;
2325 if (words[3] & RX_COMP4_LEN_MISMATCH)
2326 cp->net_stats[ring].rx_length_errors++;
2327 if (words[3] & RX_COMP4_BAD)
2328 cp->net_stats[ring].rx_crc_errors++;
2329 spin_unlock(&cp->stat_lock[ring]);
2330
2331 /* We'll just return it to Cassini. */
2332 drop_it:
2333 spin_lock(&cp->stat_lock[ring]);
2334 ++cp->net_stats[ring].rx_dropped;
2335 spin_unlock(&cp->stat_lock[ring]);
2336 goto next;
2337 }
2338
2339 len = cas_rx_process_pkt(cp, rxc, entry, words, &skb);
2340 if (len < 0) {
2341 ++drops;
2342 goto drop_it;
2343 }
2344
2345 /* see if it's a flow re-assembly or not. the driver
2346 * itself handles release back up.
2347 */
2348 if (RX_DONT_BATCH || (type == 0x2)) {
2349 /* non-reassm: these always get released */
2350 cas_skb_release(skb);
2351 } else {
2352 cas_rx_flow_pkt(cp, words, skb);
2353 }
2354
2355 spin_lock(&cp->stat_lock[ring]);
2356 cp->net_stats[ring].rx_packets++;
2357 cp->net_stats[ring].rx_bytes += len;
2358 spin_unlock(&cp->stat_lock[ring]);
2359 cp->dev->last_rx = jiffies;
2360
2361 next:
2362 npackets++;
2363
2364 /* should it be released? */
2365 if (words[0] & RX_COMP1_RELEASE_HDR) {
2366 i = CAS_VAL(RX_COMP2_HDR_INDEX, words[1]);
2367 dring = CAS_VAL(RX_INDEX_RING, i);
2368 i = CAS_VAL(RX_INDEX_NUM, i);
2369 cas_post_page(cp, dring, i);
2370 }
2371
2372 if (words[0] & RX_COMP1_RELEASE_DATA) {
2373 i = CAS_VAL(RX_COMP1_DATA_INDEX, words[0]);
2374 dring = CAS_VAL(RX_INDEX_RING, i);
2375 i = CAS_VAL(RX_INDEX_NUM, i);
2376 cas_post_page(cp, dring, i);
2377 }
2378
2379 if (words[0] & RX_COMP1_RELEASE_NEXT) {
2380 i = CAS_VAL(RX_COMP2_NEXT_INDEX, words[1]);
2381 dring = CAS_VAL(RX_INDEX_RING, i);
2382 i = CAS_VAL(RX_INDEX_NUM, i);
2383 cas_post_page(cp, dring, i);
2384 }
2385
2386 /* skip to the next entry */
2387 entry = RX_COMP_ENTRY(ring, entry + 1 +
2388 CAS_VAL(RX_COMP1_SKIP, words[0]));
2389#ifdef USE_NAPI
2390 if (budget && (npackets >= budget))
2391 break;
2392#endif
2393 }
2394 cp->rx_new[ring] = entry;
2395
2396 if (drops)
2397 printk(KERN_INFO "%s: Memory squeeze, deferring packet.\n",
2398 cp->dev->name);
2399 return npackets;
2400}
2401
2402
2403/* put completion entries back on the ring */
2404static void cas_post_rxcs_ringN(struct net_device *dev,
2405 struct cas *cp, int ring)
2406{
2407 struct cas_rx_comp *rxc = cp->init_rxcs[ring];
2408 int last, entry;
2409
2410 last = cp->rx_cur[ring];
2411 entry = cp->rx_new[ring];
2412 if (netif_msg_intr(cp))
2413 printk(KERN_DEBUG "%s: rxc[%d] interrupt, done: %d/%d\n",
2414 dev->name, ring, readl(cp->regs + REG_RX_COMP_HEAD),
2415 entry);
2416
2417 /* zero and re-mark descriptors */
2418 while (last != entry) {
2419 cas_rxc_init(rxc + last);
2420 last = RX_COMP_ENTRY(ring, last + 1);
2421 }
2422 cp->rx_cur[ring] = last;
2423
2424 if (ring == 0)
2425 writel(last, cp->regs + REG_RX_COMP_TAIL);
2426 else if (cp->cas_flags & CAS_FLAG_REG_PLUS)
2427 writel(last, cp->regs + REG_PLUS_RX_COMPN_TAIL(ring));
2428}
2429
2430
2431
2432/* cassini can use all four PCI interrupts for the completion ring.
2433 * rings 3 and 4 are identical
2434 */
2435#if defined(USE_PCI_INTC) || defined(USE_PCI_INTD)
2436static inline void cas_handle_irqN(struct net_device *dev,
2437 struct cas *cp, const u32 status,
2438 const int ring)
2439{
2440 if (status & (INTR_RX_COMP_FULL_ALT | INTR_RX_COMP_AF_ALT))
2441 cas_post_rxcs_ringN(dev, cp, ring);
2442}
2443
2444static irqreturn_t cas_interruptN(int irq, void *dev_id, struct pt_regs *regs)
2445{
2446 struct net_device *dev = dev_id;
2447 struct cas *cp = netdev_priv(dev);
2448 unsigned long flags;
2449 int ring;
2450 u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(ring));
2451
2452 /* check for shared irq */
2453 if (status == 0)
2454 return IRQ_NONE;
2455
2456 ring = (irq == cp->pci_irq_INTC) ? 2 : 3;
2457 spin_lock_irqsave(&cp->lock, flags);
2458 if (status & INTR_RX_DONE_ALT) { /* handle rx separately */
2459#ifdef USE_NAPI
2460 cas_mask_intr(cp);
2461 netif_rx_schedule(dev);
2462#else
2463 cas_rx_ringN(cp, ring, 0);
2464#endif
2465 status &= ~INTR_RX_DONE_ALT;
2466 }
2467
2468 if (status)
2469 cas_handle_irqN(dev, cp, status, ring);
2470 spin_unlock_irqrestore(&cp->lock, flags);
2471 return IRQ_HANDLED;
2472}
2473#endif
2474
2475#ifdef USE_PCI_INTB
2476/* everything but rx packets */
2477static inline void cas_handle_irq1(struct cas *cp, const u32 status)
2478{
2479 if (status & INTR_RX_BUF_UNAVAIL_1) {
2480 /* Frame arrived, no free RX buffers available.
2481 * NOTE: we can get this on a link transition. */
2482 cas_post_rxds_ringN(cp, 1, 0);
2483 spin_lock(&cp->stat_lock[1]);
2484 cp->net_stats[1].rx_dropped++;
2485 spin_unlock(&cp->stat_lock[1]);
2486 }
2487
2488 if (status & INTR_RX_BUF_AE_1)
2489 cas_post_rxds_ringN(cp, 1, RX_DESC_RINGN_SIZE(1) -
2490 RX_AE_FREEN_VAL(1));
2491
2492 if (status & (INTR_RX_COMP_AF | INTR_RX_COMP_FULL))
2493 cas_post_rxcs_ringN(cp, 1);
2494}
2495
2496/* ring 2 handles a few more events than 3 and 4 */
2497static irqreturn_t cas_interrupt1(int irq, void *dev_id, struct pt_regs *regs)
2498{
2499 struct net_device *dev = dev_id;
2500 struct cas *cp = netdev_priv(dev);
2501 unsigned long flags;
2502 u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(1));
2503
2504 /* check for shared interrupt */
2505 if (status == 0)
2506 return IRQ_NONE;
2507
2508 spin_lock_irqsave(&cp->lock, flags);
2509 if (status & INTR_RX_DONE_ALT) { /* handle rx separately */
2510#ifdef USE_NAPI
2511 cas_mask_intr(cp);
2512 netif_rx_schedule(dev);
2513#else
2514 cas_rx_ringN(cp, 1, 0);
2515#endif
2516 status &= ~INTR_RX_DONE_ALT;
2517 }
2518 if (status)
2519 cas_handle_irq1(cp, status);
2520 spin_unlock_irqrestore(&cp->lock, flags);
2521 return IRQ_HANDLED;
2522}
2523#endif
2524
2525static inline void cas_handle_irq(struct net_device *dev,
2526 struct cas *cp, const u32 status)
2527{
2528 /* housekeeping interrupts */
2529 if (status & INTR_ERROR_MASK)
2530 cas_abnormal_irq(dev, cp, status);
2531
2532 if (status & INTR_RX_BUF_UNAVAIL) {
2533 /* Frame arrived, no free RX buffers available.
2534 * NOTE: we can get this on a link transition.
2535 */
2536 cas_post_rxds_ringN(cp, 0, 0);
2537 spin_lock(&cp->stat_lock[0]);
2538 cp->net_stats[0].rx_dropped++;
2539 spin_unlock(&cp->stat_lock[0]);
2540 } else if (status & INTR_RX_BUF_AE) {
2541 cas_post_rxds_ringN(cp, 0, RX_DESC_RINGN_SIZE(0) -
2542 RX_AE_FREEN_VAL(0));
2543 }
2544
2545 if (status & (INTR_RX_COMP_AF | INTR_RX_COMP_FULL))
2546 cas_post_rxcs_ringN(dev, cp, 0);
2547}
2548
2549static irqreturn_t cas_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2550{
2551 struct net_device *dev = dev_id;
2552 struct cas *cp = netdev_priv(dev);
2553 unsigned long flags;
2554 u32 status = readl(cp->regs + REG_INTR_STATUS);
2555
2556 if (status == 0)
2557 return IRQ_NONE;
2558
2559 spin_lock_irqsave(&cp->lock, flags);
2560 if (status & (INTR_TX_ALL | INTR_TX_INTME)) {
2561 cas_tx(dev, cp, status);
2562 status &= ~(INTR_TX_ALL | INTR_TX_INTME);
2563 }
2564
2565 if (status & INTR_RX_DONE) {
2566#ifdef USE_NAPI
2567 cas_mask_intr(cp);
2568 netif_rx_schedule(dev);
2569#else
2570 cas_rx_ringN(cp, 0, 0);
2571#endif
2572 status &= ~INTR_RX_DONE;
2573 }
2574
2575 if (status)
2576 cas_handle_irq(dev, cp, status);
2577 spin_unlock_irqrestore(&cp->lock, flags);
2578 return IRQ_HANDLED;
2579}
2580
2581
2582#ifdef USE_NAPI
2583static int cas_poll(struct net_device *dev, int *budget)
2584{
2585 struct cas *cp = netdev_priv(dev);
2586 int i, enable_intr, todo, credits;
2587 u32 status = readl(cp->regs + REG_INTR_STATUS);
2588 unsigned long flags;
2589
2590 spin_lock_irqsave(&cp->lock, flags);
2591 cas_tx(dev, cp, status);
2592 spin_unlock_irqrestore(&cp->lock, flags);
2593
2594 /* NAPI rx packets. we spread the credits across all of the
2595 * rxc rings
2596 */
2597 todo = min(*budget, dev->quota);
2598
2599 /* to make sure we're fair with the work we loop through each
2600 * ring N_RX_COMP_RING times with a request of
2601 * todo / N_RX_COMP_RINGS
2602 */
2603 enable_intr = 1;
2604 credits = 0;
2605 for (i = 0; i < N_RX_COMP_RINGS; i++) {
2606 int j;
2607 for (j = 0; j < N_RX_COMP_RINGS; j++) {
2608 credits += cas_rx_ringN(cp, j, todo / N_RX_COMP_RINGS);
2609 if (credits >= todo) {
2610 enable_intr = 0;
2611 goto rx_comp;
2612 }
2613 }
2614 }
2615
2616rx_comp:
2617 *budget -= credits;
2618 dev->quota -= credits;
2619
2620 /* final rx completion */
2621 spin_lock_irqsave(&cp->lock, flags);
2622 if (status)
2623 cas_handle_irq(dev, cp, status);
2624
2625#ifdef USE_PCI_INTB
2626 if (N_RX_COMP_RINGS > 1) {
2627 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(1));
2628 if (status)
2629 cas_handle_irq1(dev, cp, status);
2630 }
2631#endif
2632
2633#ifdef USE_PCI_INTC
2634 if (N_RX_COMP_RINGS > 2) {
2635 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(2));
2636 if (status)
2637 cas_handle_irqN(dev, cp, status, 2);
2638 }
2639#endif
2640
2641#ifdef USE_PCI_INTD
2642 if (N_RX_COMP_RINGS > 3) {
2643 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(3));
2644 if (status)
2645 cas_handle_irqN(dev, cp, status, 3);
2646 }
2647#endif
2648 spin_unlock_irqrestore(&cp->lock, flags);
2649 if (enable_intr) {
2650 netif_rx_complete(dev);
2651 cas_unmask_intr(cp);
2652 return 0;
2653 }
2654 return 1;
2655}
2656#endif
2657
2658#ifdef CONFIG_NET_POLL_CONTROLLER
2659static void cas_netpoll(struct net_device *dev)
2660{
2661 struct cas *cp = netdev_priv(dev);
2662
2663 cas_disable_irq(cp, 0);
2664 cas_interrupt(cp->pdev->irq, dev, NULL);
2665 cas_enable_irq(cp, 0);
2666
2667#ifdef USE_PCI_INTB
2668 if (N_RX_COMP_RINGS > 1) {
2669 /* cas_interrupt1(); */
2670 }
2671#endif
2672#ifdef USE_PCI_INTC
2673 if (N_RX_COMP_RINGS > 2) {
2674 /* cas_interruptN(); */
2675 }
2676#endif
2677#ifdef USE_PCI_INTD
2678 if (N_RX_COMP_RINGS > 3) {
2679 /* cas_interruptN(); */
2680 }
2681#endif
2682}
2683#endif
2684
2685static void cas_tx_timeout(struct net_device *dev)
2686{
2687 struct cas *cp = netdev_priv(dev);
2688
2689 printk(KERN_ERR "%s: transmit timed out, resetting\n", dev->name);
2690 if (!cp->hw_running) {
2691 printk("%s: hrm.. hw not running!\n", dev->name);
2692 return;
2693 }
2694
2695 printk(KERN_ERR "%s: MIF_STATE[%08x]\n",
2696 dev->name, readl(cp->regs + REG_MIF_STATE_MACHINE));
2697
2698 printk(KERN_ERR "%s: MAC_STATE[%08x]\n",
2699 dev->name, readl(cp->regs + REG_MAC_STATE_MACHINE));
2700
2701 printk(KERN_ERR "%s: TX_STATE[%08x:%08x:%08x] "
2702 "FIFO[%08x:%08x:%08x] SM1[%08x] SM2[%08x]\n",
2703 dev->name,
2704 readl(cp->regs + REG_TX_CFG),
2705 readl(cp->regs + REG_MAC_TX_STATUS),
2706 readl(cp->regs + REG_MAC_TX_CFG),
2707 readl(cp->regs + REG_TX_FIFO_PKT_CNT),
2708 readl(cp->regs + REG_TX_FIFO_WRITE_PTR),
2709 readl(cp->regs + REG_TX_FIFO_READ_PTR),
2710 readl(cp->regs + REG_TX_SM_1),
2711 readl(cp->regs + REG_TX_SM_2));
2712
2713 printk(KERN_ERR "%s: RX_STATE[%08x:%08x:%08x]\n",
2714 dev->name,
2715 readl(cp->regs + REG_RX_CFG),
2716 readl(cp->regs + REG_MAC_RX_STATUS),
2717 readl(cp->regs + REG_MAC_RX_CFG));
2718
2719 printk(KERN_ERR "%s: HP_STATE[%08x:%08x:%08x:%08x]\n",
2720 dev->name,
2721 readl(cp->regs + REG_HP_STATE_MACHINE),
2722 readl(cp->regs + REG_HP_STATUS0),
2723 readl(cp->regs + REG_HP_STATUS1),
2724 readl(cp->regs + REG_HP_STATUS2));
2725
2726#if 1
2727 atomic_inc(&cp->reset_task_pending);
2728 atomic_inc(&cp->reset_task_pending_all);
2729 schedule_work(&cp->reset_task);
2730#else
2731 atomic_set(&cp->reset_task_pending, CAS_RESET_ALL);
2732 schedule_work(&cp->reset_task);
2733#endif
2734}
2735
2736static inline int cas_intme(int ring, int entry)
2737{
2738 /* Algorithm: IRQ every 1/2 of descriptors. */
2739 if (!(entry & ((TX_DESC_RINGN_SIZE(ring) >> 1) - 1)))
2740 return 1;
2741 return 0;
2742}
2743
2744
2745static void cas_write_txd(struct cas *cp, int ring, int entry,
2746 dma_addr_t mapping, int len, u64 ctrl, int last)
2747{
2748 struct cas_tx_desc *txd = cp->init_txds[ring] + entry;
2749
2750 ctrl |= CAS_BASE(TX_DESC_BUFLEN, len);
2751 if (cas_intme(ring, entry))
2752 ctrl |= TX_DESC_INTME;
2753 if (last)
2754 ctrl |= TX_DESC_EOF;
2755 txd->control = cpu_to_le64(ctrl);
2756 txd->buffer = cpu_to_le64(mapping);
2757}
2758
2759static inline void *tx_tiny_buf(struct cas *cp, const int ring,
2760 const int entry)
2761{
2762 return cp->tx_tiny_bufs[ring] + TX_TINY_BUF_LEN*entry;
2763}
2764
2765static inline dma_addr_t tx_tiny_map(struct cas *cp, const int ring,
2766 const int entry, const int tentry)
2767{
2768 cp->tx_tiny_use[ring][tentry].nbufs++;
2769 cp->tx_tiny_use[ring][entry].used = 1;
2770 return cp->tx_tiny_dvma[ring] + TX_TINY_BUF_LEN*entry;
2771}
2772
2773static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
2774 struct sk_buff *skb)
2775{
2776 struct net_device *dev = cp->dev;
2777 int entry, nr_frags, frag, tabort, tentry;
2778 dma_addr_t mapping;
2779 unsigned long flags;
2780 u64 ctrl;
2781 u32 len;
2782
2783 spin_lock_irqsave(&cp->tx_lock[ring], flags);
2784
2785 /* This is a hard error, log it. */
2786 if (TX_BUFFS_AVAIL(cp, ring) <=
2787 CAS_TABORT(cp)*(skb_shinfo(skb)->nr_frags + 1)) {
2788 netif_stop_queue(dev);
2789 spin_unlock_irqrestore(&cp->tx_lock[ring], flags);
2790 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
2791 "queue awake!\n", dev->name);
2792 return 1;
2793 }
2794
2795 ctrl = 0;
2796 if (skb->ip_summed == CHECKSUM_HW) {
2797 u64 csum_start_off, csum_stuff_off;
2798
2799 csum_start_off = (u64) (skb->h.raw - skb->data);
2800 csum_stuff_off = (u64) ((skb->h.raw + skb->csum) - skb->data);
2801
2802 ctrl = TX_DESC_CSUM_EN |
2803 CAS_BASE(TX_DESC_CSUM_START, csum_start_off) |
2804 CAS_BASE(TX_DESC_CSUM_STUFF, csum_stuff_off);
2805 }
2806
2807 entry = cp->tx_new[ring];
2808 cp->tx_skbs[ring][entry] = skb;
2809
2810 nr_frags = skb_shinfo(skb)->nr_frags;
2811 len = skb_headlen(skb);
2812 mapping = pci_map_page(cp->pdev, virt_to_page(skb->data),
2813 offset_in_page(skb->data), len,
2814 PCI_DMA_TODEVICE);
2815
2816 tentry = entry;
2817 tabort = cas_calc_tabort(cp, (unsigned long) skb->data, len);
2818 if (unlikely(tabort)) {
2819 /* NOTE: len is always > tabort */
2820 cas_write_txd(cp, ring, entry, mapping, len - tabort,
2821 ctrl | TX_DESC_SOF, 0);
2822 entry = TX_DESC_NEXT(ring, entry);
2823
2824 memcpy(tx_tiny_buf(cp, ring, entry), skb->data +
2825 len - tabort, tabort);
2826 mapping = tx_tiny_map(cp, ring, entry, tentry);
2827 cas_write_txd(cp, ring, entry, mapping, tabort, ctrl,
2828 (nr_frags == 0));
2829 } else {
2830 cas_write_txd(cp, ring, entry, mapping, len, ctrl |
2831 TX_DESC_SOF, (nr_frags == 0));
2832 }
2833 entry = TX_DESC_NEXT(ring, entry);
2834
2835 for (frag = 0; frag < nr_frags; frag++) {
2836 skb_frag_t *fragp = &skb_shinfo(skb)->frags[frag];
2837
2838 len = fragp->size;
2839 mapping = pci_map_page(cp->pdev, fragp->page,
2840 fragp->page_offset, len,
2841 PCI_DMA_TODEVICE);
2842
2843 tabort = cas_calc_tabort(cp, fragp->page_offset, len);
2844 if (unlikely(tabort)) {
2845 void *addr;
2846
2847 /* NOTE: len is always > tabort */
2848 cas_write_txd(cp, ring, entry, mapping, len - tabort,
2849 ctrl, 0);
2850 entry = TX_DESC_NEXT(ring, entry);
2851
2852 addr = cas_page_map(fragp->page);
2853 memcpy(tx_tiny_buf(cp, ring, entry),
2854 addr + fragp->page_offset + len - tabort,
2855 tabort);
2856 cas_page_unmap(addr);
2857 mapping = tx_tiny_map(cp, ring, entry, tentry);
2858 len = tabort;
2859 }
2860
2861 cas_write_txd(cp, ring, entry, mapping, len, ctrl,
2862 (frag + 1 == nr_frags));
2863 entry = TX_DESC_NEXT(ring, entry);
2864 }
2865
2866 cp->tx_new[ring] = entry;
2867 if (TX_BUFFS_AVAIL(cp, ring) <= CAS_TABORT(cp)*(MAX_SKB_FRAGS + 1))
2868 netif_stop_queue(dev);
2869
2870 if (netif_msg_tx_queued(cp))
2871 printk(KERN_DEBUG "%s: tx[%d] queued, slot %d, skblen %d, "
2872 "avail %d\n",
2873 dev->name, ring, entry, skb->len,
2874 TX_BUFFS_AVAIL(cp, ring));
2875 writel(entry, cp->regs + REG_TX_KICKN(ring));
2876 spin_unlock_irqrestore(&cp->tx_lock[ring], flags);
2877 return 0;
2878}
2879
2880static int cas_start_xmit(struct sk_buff *skb, struct net_device *dev)
2881{
2882 struct cas *cp = netdev_priv(dev);
2883
2884 /* this is only used as a load-balancing hint, so it doesn't
2885 * need to be SMP safe
2886 */
2887 static int ring;
2888
2889 skb = skb_padto(skb, cp->min_frame_size);
2890 if (!skb)
2891 return 0;
2892
2893 /* XXX: we need some higher-level QoS hooks to steer packets to
2894 * individual queues.
2895 */
2896 if (cas_xmit_tx_ringN(cp, ring++ & N_TX_RINGS_MASK, skb))
2897 return 1;
2898 dev->trans_start = jiffies;
2899 return 0;
2900}
2901
2902static void cas_init_tx_dma(struct cas *cp)
2903{
2904 u64 desc_dma = cp->block_dvma;
2905 unsigned long off;
2906 u32 val;
2907 int i;
2908
2909 /* set up tx completion writeback registers. must be 8-byte aligned */
2910#ifdef USE_TX_COMPWB
2911 off = offsetof(struct cas_init_block, tx_compwb);
2912 writel((desc_dma + off) >> 32, cp->regs + REG_TX_COMPWB_DB_HI);
2913 writel((desc_dma + off) & 0xffffffff, cp->regs + REG_TX_COMPWB_DB_LOW);
2914#endif
2915
2916 /* enable completion writebacks, enable paced mode,
2917 * disable read pipe, and disable pre-interrupt compwbs
2918 */
2919 val = TX_CFG_COMPWB_Q1 | TX_CFG_COMPWB_Q2 |
2920 TX_CFG_COMPWB_Q3 | TX_CFG_COMPWB_Q4 |
2921 TX_CFG_DMA_RDPIPE_DIS | TX_CFG_PACED_MODE |
2922 TX_CFG_INTR_COMPWB_DIS;
2923
2924 /* write out tx ring info and tx desc bases */
2925 for (i = 0; i < MAX_TX_RINGS; i++) {
2926 off = (unsigned long) cp->init_txds[i] -
2927 (unsigned long) cp->init_block;
2928
2929 val |= CAS_TX_RINGN_BASE(i);
2930 writel((desc_dma + off) >> 32, cp->regs + REG_TX_DBN_HI(i));
2931 writel((desc_dma + off) & 0xffffffff, cp->regs +
2932 REG_TX_DBN_LOW(i));
2933 /* don't zero out the kick register here as the system
2934 * will wedge
2935 */
2936 }
2937 writel(val, cp->regs + REG_TX_CFG);
2938
2939 /* program max burst sizes. these numbers should be different
2940 * if doing QoS.
2941 */
2942#ifdef USE_QOS
2943 writel(0x800, cp->regs + REG_TX_MAXBURST_0);
2944 writel(0x1600, cp->regs + REG_TX_MAXBURST_1);
2945 writel(0x2400, cp->regs + REG_TX_MAXBURST_2);
2946 writel(0x4800, cp->regs + REG_TX_MAXBURST_3);
2947#else
2948 writel(0x800, cp->regs + REG_TX_MAXBURST_0);
2949 writel(0x800, cp->regs + REG_TX_MAXBURST_1);
2950 writel(0x800, cp->regs + REG_TX_MAXBURST_2);
2951 writel(0x800, cp->regs + REG_TX_MAXBURST_3);
2952#endif
2953}
2954
2955/* Must be invoked under cp->lock. */
2956static inline void cas_init_dma(struct cas *cp)
2957{
2958 cas_init_tx_dma(cp);
2959 cas_init_rx_dma(cp);
2960}
2961
2962/* Must be invoked under cp->lock. */
2963static u32 cas_setup_multicast(struct cas *cp)
2964{
2965 u32 rxcfg = 0;
2966 int i;
2967
2968 if (cp->dev->flags & IFF_PROMISC) {
2969 rxcfg |= MAC_RX_CFG_PROMISC_EN;
2970
2971 } else if (cp->dev->flags & IFF_ALLMULTI) {
2972 for (i=0; i < 16; i++)
2973 writel(0xFFFF, cp->regs + REG_MAC_HASH_TABLEN(i));
2974 rxcfg |= MAC_RX_CFG_HASH_FILTER_EN;
2975
2976 } else {
2977 u16 hash_table[16];
2978 u32 crc;
2979 struct dev_mc_list *dmi = cp->dev->mc_list;
2980 int i;
2981
2982 /* use the alternate mac address registers for the
2983 * first 15 multicast addresses
2984 */
2985 for (i = 1; i <= CAS_MC_EXACT_MATCH_SIZE; i++) {
2986 if (!dmi) {
2987 writel(0x0, cp->regs + REG_MAC_ADDRN(i*3 + 0));
2988 writel(0x0, cp->regs + REG_MAC_ADDRN(i*3 + 1));
2989 writel(0x0, cp->regs + REG_MAC_ADDRN(i*3 + 2));
2990 continue;
2991 }
2992 writel((dmi->dmi_addr[4] << 8) | dmi->dmi_addr[5],
2993 cp->regs + REG_MAC_ADDRN(i*3 + 0));
2994 writel((dmi->dmi_addr[2] << 8) | dmi->dmi_addr[3],
2995 cp->regs + REG_MAC_ADDRN(i*3 + 1));
2996 writel((dmi->dmi_addr[0] << 8) | dmi->dmi_addr[1],
2997 cp->regs + REG_MAC_ADDRN(i*3 + 2));
2998 dmi = dmi->next;
2999 }
3000
3001 /* use hw hash table for the next series of
3002 * multicast addresses
3003 */
3004 memset(hash_table, 0, sizeof(hash_table));
3005 while (dmi) {
3006 crc = ether_crc_le(ETH_ALEN, dmi->dmi_addr);
3007 crc >>= 24;
3008 hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
3009 dmi = dmi->next;
3010 }
3011 for (i=0; i < 16; i++)
3012 writel(hash_table[i], cp->regs +
3013 REG_MAC_HASH_TABLEN(i));
3014 rxcfg |= MAC_RX_CFG_HASH_FILTER_EN;
3015 }
3016
3017 return rxcfg;
3018}
3019
3020/* must be invoked under cp->stat_lock[N_TX_RINGS] */
3021static void cas_clear_mac_err(struct cas *cp)
3022{
3023 writel(0, cp->regs + REG_MAC_COLL_NORMAL);
3024 writel(0, cp->regs + REG_MAC_COLL_FIRST);
3025 writel(0, cp->regs + REG_MAC_COLL_EXCESS);
3026 writel(0, cp->regs + REG_MAC_COLL_LATE);
3027 writel(0, cp->regs + REG_MAC_TIMER_DEFER);
3028 writel(0, cp->regs + REG_MAC_ATTEMPTS_PEAK);
3029 writel(0, cp->regs + REG_MAC_RECV_FRAME);
3030 writel(0, cp->regs + REG_MAC_LEN_ERR);
3031 writel(0, cp->regs + REG_MAC_ALIGN_ERR);
3032 writel(0, cp->regs + REG_MAC_FCS_ERR);
3033 writel(0, cp->regs + REG_MAC_RX_CODE_ERR);
3034}
3035
3036
3037static void cas_mac_reset(struct cas *cp)
3038{
3039 int i;
3040
3041 /* do both TX and RX reset */
3042 writel(0x1, cp->regs + REG_MAC_TX_RESET);
3043 writel(0x1, cp->regs + REG_MAC_RX_RESET);
3044
3045 /* wait for TX */
3046 i = STOP_TRIES;
3047 while (i-- > 0) {
3048 if (readl(cp->regs + REG_MAC_TX_RESET) == 0)
3049 break;
3050 udelay(10);
3051 }
3052
3053 /* wait for RX */
3054 i = STOP_TRIES;
3055 while (i-- > 0) {
3056 if (readl(cp->regs + REG_MAC_RX_RESET) == 0)
3057 break;
3058 udelay(10);
3059 }
3060
3061 if (readl(cp->regs + REG_MAC_TX_RESET) |
3062 readl(cp->regs + REG_MAC_RX_RESET))
3063 printk(KERN_ERR "%s: mac tx[%d]/rx[%d] reset failed [%08x]\n",
3064 cp->dev->name, readl(cp->regs + REG_MAC_TX_RESET),
3065 readl(cp->regs + REG_MAC_RX_RESET),
3066 readl(cp->regs + REG_MAC_STATE_MACHINE));
3067}
3068
3069
3070/* Must be invoked under cp->lock. */
3071static void cas_init_mac(struct cas *cp)
3072{
3073 unsigned char *e = &cp->dev->dev_addr[0];
3074 int i;
3075#ifdef CONFIG_CASSINI_MULTICAST_REG_WRITE
3076 u32 rxcfg;
3077#endif
3078 cas_mac_reset(cp);
3079
3080 /* setup core arbitration weight register */
3081 writel(CAWR_RR_DIS, cp->regs + REG_CAWR);
3082
3083 /* XXX Use pci_dma_burst_advice() */
3084#if !defined(CONFIG_SPARC64) && !defined(CONFIG_ALPHA)
3085 /* set the infinite burst register for chips that don't have
3086 * pci issues.
3087 */
3088 if ((cp->cas_flags & CAS_FLAG_TARGET_ABORT) == 0)
3089 writel(INF_BURST_EN, cp->regs + REG_INF_BURST);
3090#endif
3091
3092 writel(0x1BF0, cp->regs + REG_MAC_SEND_PAUSE);
3093
3094 writel(0x00, cp->regs + REG_MAC_IPG0);
3095 writel(0x08, cp->regs + REG_MAC_IPG1);
3096 writel(0x04, cp->regs + REG_MAC_IPG2);
3097
3098 /* change later for 802.3z */
3099 writel(0x40, cp->regs + REG_MAC_SLOT_TIME);
3100
3101 /* min frame + FCS */
3102 writel(ETH_ZLEN + 4, cp->regs + REG_MAC_FRAMESIZE_MIN);
3103
3104 /* Ethernet payload + header + FCS + optional VLAN tag. NOTE: we
3105 * specify the maximum frame size to prevent RX tag errors on
3106 * oversized frames.
3107 */
3108 writel(CAS_BASE(MAC_FRAMESIZE_MAX_BURST, 0x2000) |
3109 CAS_BASE(MAC_FRAMESIZE_MAX_FRAME,
3110 (CAS_MAX_MTU + ETH_HLEN + 4 + 4)),
3111 cp->regs + REG_MAC_FRAMESIZE_MAX);
3112
3113 /* NOTE: crc_size is used as a surrogate for half-duplex.
3114 * workaround saturn half-duplex issue by increasing preamble
3115 * size to 65 bytes.
3116 */
3117 if ((cp->cas_flags & CAS_FLAG_SATURN) && cp->crc_size)
3118 writel(0x41, cp->regs + REG_MAC_PA_SIZE);
3119 else
3120 writel(0x07, cp->regs + REG_MAC_PA_SIZE);
3121 writel(0x04, cp->regs + REG_MAC_JAM_SIZE);
3122 writel(0x10, cp->regs + REG_MAC_ATTEMPT_LIMIT);
3123 writel(0x8808, cp->regs + REG_MAC_CTRL_TYPE);
3124
3125 writel((e[5] | (e[4] << 8)) & 0x3ff, cp->regs + REG_MAC_RANDOM_SEED);
3126
3127 writel(0, cp->regs + REG_MAC_ADDR_FILTER0);
3128 writel(0, cp->regs + REG_MAC_ADDR_FILTER1);
3129 writel(0, cp->regs + REG_MAC_ADDR_FILTER2);
3130 writel(0, cp->regs + REG_MAC_ADDR_FILTER2_1_MASK);
3131 writel(0, cp->regs + REG_MAC_ADDR_FILTER0_MASK);
3132
3133 /* setup mac address in perfect filter array */
3134 for (i = 0; i < 45; i++)
3135 writel(0x0, cp->regs + REG_MAC_ADDRN(i));
3136
3137 writel((e[4] << 8) | e[5], cp->regs + REG_MAC_ADDRN(0));
3138 writel((e[2] << 8) | e[3], cp->regs + REG_MAC_ADDRN(1));
3139 writel((e[0] << 8) | e[1], cp->regs + REG_MAC_ADDRN(2));
3140
3141 writel(0x0001, cp->regs + REG_MAC_ADDRN(42));
3142 writel(0xc200, cp->regs + REG_MAC_ADDRN(43));
3143 writel(0x0180, cp->regs + REG_MAC_ADDRN(44));
3144
3145#ifndef CONFIG_CASSINI_MULTICAST_REG_WRITE
3146 cp->mac_rx_cfg = cas_setup_multicast(cp);
3147#else
3148 /* WTZ: Do what Adrian did in cas_set_multicast. Doing
3149 * a writel does not seem to be necessary because Cassini
3150 * seems to preserve the configuration when we do the reset.
3151 * If the chip is in trouble, though, it is not clear if we
3152 * can really count on this behavior. cas_set_multicast uses
3153 * spin_lock_irqsave, but we are called only in cas_init_hw and
3154 * cas_init_hw is protected by cas_lock_all, which calls
3155 * spin_lock_irq (so it doesn't need to save the flags, and
3156 * we should be OK for the writel, as that is the only
3157 * difference).
3158 */
3159 cp->mac_rx_cfg = rxcfg = cas_setup_multicast(cp);
3160 writel(rxcfg, cp->regs + REG_MAC_RX_CFG);
3161#endif
3162 spin_lock(&cp->stat_lock[N_TX_RINGS]);
3163 cas_clear_mac_err(cp);
3164 spin_unlock(&cp->stat_lock[N_TX_RINGS]);
3165
3166 /* Setup MAC interrupts. We want to get all of the interesting
3167 * counter expiration events, but we do not want to hear about
3168 * normal rx/tx as the DMA engine tells us that.
3169 */
3170 writel(MAC_TX_FRAME_XMIT, cp->regs + REG_MAC_TX_MASK);
3171 writel(MAC_RX_FRAME_RECV, cp->regs + REG_MAC_RX_MASK);
3172
3173 /* Don't enable even the PAUSE interrupts for now, we
3174 * make no use of those events other than to record them.
3175 */
3176 writel(0xffffffff, cp->regs + REG_MAC_CTRL_MASK);
3177}
3178
3179/* Must be invoked under cp->lock. */
3180static void cas_init_pause_thresholds(struct cas *cp)
3181{
3182 /* Calculate pause thresholds. Setting the OFF threshold to the
3183 * full RX fifo size effectively disables PAUSE generation
3184 */
3185 if (cp->rx_fifo_size <= (2 * 1024)) {
3186 cp->rx_pause_off = cp->rx_pause_on = cp->rx_fifo_size;
3187 } else {
3188 int max_frame = (cp->dev->mtu + ETH_HLEN + 4 + 4 + 64) & ~63;
3189 if (max_frame * 3 > cp->rx_fifo_size) {
3190 cp->rx_pause_off = 7104;
3191 cp->rx_pause_on = 960;
3192 } else {
3193 int off = (cp->rx_fifo_size - (max_frame * 2));
3194 int on = off - max_frame;
3195 cp->rx_pause_off = off;
3196 cp->rx_pause_on = on;
3197 }
3198 }
3199}
3200
3201static int cas_vpd_match(const void __iomem *p, const char *str)
3202{
3203 int len = strlen(str) + 1;
3204 int i;
3205
3206 for (i = 0; i < len; i++) {
3207 if (readb(p + i) != str[i])
3208 return 0;
3209 }
3210 return 1;
3211}
3212
3213
3214/* get the mac address by reading the vpd information in the rom.
3215 * also get the phy type and determine if there's an entropy generator.
3216 * NOTE: this is a bit convoluted for the following reasons:
3217 * 1) vpd info has order-dependent mac addresses for multinic cards
3218 * 2) the only way to determine the nic order is to use the slot
3219 * number.
3220 * 3) fiber cards don't have bridges, so their slot numbers don't
3221 * mean anything.
3222 * 4) we don't actually know we have a fiber card until after
3223 * the mac addresses are parsed.
3224 */
3225static int cas_get_vpd_info(struct cas *cp, unsigned char *dev_addr,
3226 const int offset)
3227{
3228 void __iomem *p = cp->regs + REG_EXPANSION_ROM_RUN_START;
3229 void __iomem *base, *kstart;
3230 int i, len;
3231 int found = 0;
3232#define VPD_FOUND_MAC 0x01
3233#define VPD_FOUND_PHY 0x02
3234
3235 int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */
3236 int mac_off = 0;
3237
3238 /* give us access to the PROM */
3239 writel(BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_PAD,
3240 cp->regs + REG_BIM_LOCAL_DEV_EN);
3241
3242 /* check for an expansion rom */
3243 if (readb(p) != 0x55 || readb(p + 1) != 0xaa)
3244 goto use_random_mac_addr;
3245
3246 /* search for beginning of vpd */
3247 base = NULL;
3248 for (i = 2; i < EXPANSION_ROM_SIZE; i++) {
3249 /* check for PCIR */
3250 if ((readb(p + i + 0) == 0x50) &&
3251 (readb(p + i + 1) == 0x43) &&
3252 (readb(p + i + 2) == 0x49) &&
3253 (readb(p + i + 3) == 0x52)) {
3254 base = p + (readb(p + i + 8) |
3255 (readb(p + i + 9) << 8));
3256 break;
3257 }
3258 }
3259
3260 if (!base || (readb(base) != 0x82))
3261 goto use_random_mac_addr;
3262
3263 i = (readb(base + 1) | (readb(base + 2) << 8)) + 3;
3264 while (i < EXPANSION_ROM_SIZE) {
3265 if (readb(base + i) != 0x90) /* no vpd found */
3266 goto use_random_mac_addr;
3267
3268 /* found a vpd field */
3269 len = readb(base + i + 1) | (readb(base + i + 2) << 8);
3270
3271 /* extract keywords */
3272 kstart = base + i + 3;
3273 p = kstart;
3274 while ((p - kstart) < len) {
3275 int klen = readb(p + 2);
3276 int j;
3277 char type;
3278
3279 p += 3;
3280
3281 /* look for the following things:
3282 * -- correct length == 29
3283 * 3 (type) + 2 (size) +
3284 * 18 (strlen("local-mac-address") + 1) +
3285 * 6 (mac addr)
3286 * -- VPD Instance 'I'
3287 * -- VPD Type Bytes 'B'
3288 * -- VPD data length == 6
3289 * -- property string == local-mac-address
3290 *
3291 * -- correct length == 24
3292 * 3 (type) + 2 (size) +
3293 * 12 (strlen("entropy-dev") + 1) +
3294 * 7 (strlen("vms110") + 1)
3295 * -- VPD Instance 'I'
3296 * -- VPD Type String 'B'
3297 * -- VPD data length == 7
3298 * -- property string == entropy-dev
3299 *
3300 * -- correct length == 18
3301 * 3 (type) + 2 (size) +
3302 * 9 (strlen("phy-type") + 1) +
3303 * 4 (strlen("pcs") + 1)
3304 * -- VPD Instance 'I'
3305 * -- VPD Type String 'S'
3306 * -- VPD data length == 4
3307 * -- property string == phy-type
3308 *
3309 * -- correct length == 23
3310 * 3 (type) + 2 (size) +
3311 * 14 (strlen("phy-interface") + 1) +
3312 * 4 (strlen("pcs") + 1)
3313 * -- VPD Instance 'I'
3314 * -- VPD Type String 'S'
3315 * -- VPD data length == 4
3316 * -- property string == phy-interface
3317 */
3318 if (readb(p) != 'I')
3319 goto next;
3320
3321 /* finally, check string and length */
3322 type = readb(p + 3);
3323 if (type == 'B') {
3324 if ((klen == 29) && readb(p + 4) == 6 &&
3325 cas_vpd_match(p + 5,
3326 "local-mac-address")) {
3327 if (mac_off++ > offset)
3328 goto next;
3329
3330 /* set mac address */
3331 for (j = 0; j < 6; j++)
3332 dev_addr[j] =
3333 readb(p + 23 + j);
3334 goto found_mac;
3335 }
3336 }
3337
3338 if (type != 'S')
3339 goto next;
3340
3341#ifdef USE_ENTROPY_DEV
3342 if ((klen == 24) &&
3343 cas_vpd_match(p + 5, "entropy-dev") &&
3344 cas_vpd_match(p + 17, "vms110")) {
3345 cp->cas_flags |= CAS_FLAG_ENTROPY_DEV;
3346 goto next;
3347 }
3348#endif
3349
3350 if (found & VPD_FOUND_PHY)
3351 goto next;
3352
3353 if ((klen == 18) && readb(p + 4) == 4 &&
3354 cas_vpd_match(p + 5, "phy-type")) {
3355 if (cas_vpd_match(p + 14, "pcs")) {
3356 phy_type = CAS_PHY_SERDES;
3357 goto found_phy;
3358 }
3359 }
3360
3361 if ((klen == 23) && readb(p + 4) == 4 &&
3362 cas_vpd_match(p + 5, "phy-interface")) {
3363 if (cas_vpd_match(p + 19, "pcs")) {
3364 phy_type = CAS_PHY_SERDES;
3365 goto found_phy;
3366 }
3367 }
3368found_mac:
3369 found |= VPD_FOUND_MAC;
3370 goto next;
3371
3372found_phy:
3373 found |= VPD_FOUND_PHY;
3374
3375next:
3376 p += klen;
3377 }
3378 i += len + 3;
3379 }
3380
3381use_random_mac_addr:
3382 if (found & VPD_FOUND_MAC)
3383 goto done;
3384
3385 /* Sun MAC prefix then 3 random bytes. */
3386 printk(PFX "MAC address not found in ROM VPD\n");
3387 dev_addr[0] = 0x08;
3388 dev_addr[1] = 0x00;
3389 dev_addr[2] = 0x20;
3390 get_random_bytes(dev_addr + 3, 3);
3391
3392done:
3393 writel(0, cp->regs + REG_BIM_LOCAL_DEV_EN);
3394 return phy_type;
3395}
3396
3397/* check pci invariants */
3398static void cas_check_pci_invariants(struct cas *cp)
3399{
3400 struct pci_dev *pdev = cp->pdev;
3401 u8 rev;
3402
3403 cp->cas_flags = 0;
3404 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
3405 if ((pdev->vendor == PCI_VENDOR_ID_SUN) &&
3406 (pdev->device == PCI_DEVICE_ID_SUN_CASSINI)) {
3407 if (rev >= CAS_ID_REVPLUS)
3408 cp->cas_flags |= CAS_FLAG_REG_PLUS;
3409 if (rev < CAS_ID_REVPLUS02u)
3410 cp->cas_flags |= CAS_FLAG_TARGET_ABORT;
3411
3412 /* Original Cassini supports HW CSUM, but it's not
3413 * enabled by default as it can trigger TX hangs.
3414 */
3415 if (rev < CAS_ID_REV2)
3416 cp->cas_flags |= CAS_FLAG_NO_HW_CSUM;
3417 } else {
3418 /* Only sun has original cassini chips. */
3419 cp->cas_flags |= CAS_FLAG_REG_PLUS;
3420
3421 /* We use a flag because the same phy might be externally
3422 * connected.
3423 */
3424 if ((pdev->vendor == PCI_VENDOR_ID_NS) &&
3425 (pdev->device == PCI_DEVICE_ID_NS_SATURN))
3426 cp->cas_flags |= CAS_FLAG_SATURN;
3427 }
3428}
3429
3430
3431static int cas_check_invariants(struct cas *cp)
3432{
3433 struct pci_dev *pdev = cp->pdev;
3434 u32 cfg;
3435 int i;
3436
3437 /* get page size for rx buffers. */
3438 cp->page_order = 0;
3439#ifdef USE_PAGE_ORDER
3440 if (PAGE_SHIFT < CAS_JUMBO_PAGE_SHIFT) {
3441 /* see if we can allocate larger pages */
3442 struct page *page = alloc_pages(GFP_ATOMIC,
3443 CAS_JUMBO_PAGE_SHIFT -
3444 PAGE_SHIFT);
3445 if (page) {
3446 __free_pages(page, CAS_JUMBO_PAGE_SHIFT - PAGE_SHIFT);
3447 cp->page_order = CAS_JUMBO_PAGE_SHIFT - PAGE_SHIFT;
3448 } else {
3449 printk(PFX "MTU limited to %d bytes\n", CAS_MAX_MTU);
3450 }
3451 }
3452#endif
3453 cp->page_size = (PAGE_SIZE << cp->page_order);
3454
3455 /* Fetch the FIFO configurations. */
3456 cp->tx_fifo_size = readl(cp->regs + REG_TX_FIFO_SIZE) * 64;
3457 cp->rx_fifo_size = RX_FIFO_SIZE;
3458
3459 /* finish phy determination. MDIO1 takes precedence over MDIO0 if
3460 * they're both connected.
3461 */
3462 cp->phy_type = cas_get_vpd_info(cp, cp->dev->dev_addr,
3463 PCI_SLOT(pdev->devfn));
3464 if (cp->phy_type & CAS_PHY_SERDES) {
3465 cp->cas_flags |= CAS_FLAG_1000MB_CAP;
3466 return 0; /* no more checking needed */
3467 }
3468
3469 /* MII */
3470 cfg = readl(cp->regs + REG_MIF_CFG);
3471 if (cfg & MIF_CFG_MDIO_1) {
3472 cp->phy_type = CAS_PHY_MII_MDIO1;
3473 } else if (cfg & MIF_CFG_MDIO_0) {
3474 cp->phy_type = CAS_PHY_MII_MDIO0;
3475 }
3476
3477 cas_mif_poll(cp, 0);
3478 writel(PCS_DATAPATH_MODE_MII, cp->regs + REG_PCS_DATAPATH_MODE);
3479
3480 for (i = 0; i < 32; i++) {
3481 u32 phy_id;
3482 int j;
3483
3484 for (j = 0; j < 3; j++) {
3485 cp->phy_addr = i;
3486 phy_id = cas_phy_read(cp, MII_PHYSID1) << 16;
3487 phy_id |= cas_phy_read(cp, MII_PHYSID2);
3488 if (phy_id && (phy_id != 0xFFFFFFFF)) {
3489 cp->phy_id = phy_id;
3490 goto done;
3491 }
3492 }
3493 }
3494 printk(KERN_ERR PFX "MII phy did not respond [%08x]\n",
3495 readl(cp->regs + REG_MIF_STATE_MACHINE));
3496 return -1;
3497
3498done:
3499 /* see if we can do gigabit */
3500 cfg = cas_phy_read(cp, MII_BMSR);
3501 if ((cfg & CAS_BMSR_1000_EXTEND) &&
3502 cas_phy_read(cp, CAS_MII_1000_EXTEND))
3503 cp->cas_flags |= CAS_FLAG_1000MB_CAP;
3504 return 0;
3505}
3506
3507/* Must be invoked under cp->lock. */
3508static inline void cas_start_dma(struct cas *cp)
3509{
3510 int i;
3511 u32 val;
3512 int txfailed = 0;
3513
3514 /* enable dma */
3515 val = readl(cp->regs + REG_TX_CFG) | TX_CFG_DMA_EN;
3516 writel(val, cp->regs + REG_TX_CFG);
3517 val = readl(cp->regs + REG_RX_CFG) | RX_CFG_DMA_EN;
3518 writel(val, cp->regs + REG_RX_CFG);
3519
3520 /* enable the mac */
3521 val = readl(cp->regs + REG_MAC_TX_CFG) | MAC_TX_CFG_EN;
3522 writel(val, cp->regs + REG_MAC_TX_CFG);
3523 val = readl(cp->regs + REG_MAC_RX_CFG) | MAC_RX_CFG_EN;
3524 writel(val, cp->regs + REG_MAC_RX_CFG);
3525
3526 i = STOP_TRIES;
3527 while (i-- > 0) {
3528 val = readl(cp->regs + REG_MAC_TX_CFG);
3529 if ((val & MAC_TX_CFG_EN))
3530 break;
3531 udelay(10);
3532 }
3533 if (i < 0) txfailed = 1;
3534 i = STOP_TRIES;
3535 while (i-- > 0) {
3536 val = readl(cp->regs + REG_MAC_RX_CFG);
3537 if ((val & MAC_RX_CFG_EN)) {
3538 if (txfailed) {
3539 printk(KERN_ERR
3540 "%s: enabling mac failed [tx:%08x:%08x].\n",
3541 cp->dev->name,
3542 readl(cp->regs + REG_MIF_STATE_MACHINE),
3543 readl(cp->regs + REG_MAC_STATE_MACHINE));
3544 }
3545 goto enable_rx_done;
3546 }
3547 udelay(10);
3548 }
3549 printk(KERN_ERR "%s: enabling mac failed [%s:%08x:%08x].\n",
3550 cp->dev->name,
3551 (txfailed? "tx,rx":"rx"),
3552 readl(cp->regs + REG_MIF_STATE_MACHINE),
3553 readl(cp->regs + REG_MAC_STATE_MACHINE));
3554
3555enable_rx_done:
3556 cas_unmask_intr(cp); /* enable interrupts */
3557 writel(RX_DESC_RINGN_SIZE(0) - 4, cp->regs + REG_RX_KICK);
3558 writel(0, cp->regs + REG_RX_COMP_TAIL);
3559
3560 if (cp->cas_flags & CAS_FLAG_REG_PLUS) {
3561 if (N_RX_DESC_RINGS > 1)
3562 writel(RX_DESC_RINGN_SIZE(1) - 4,
3563 cp->regs + REG_PLUS_RX_KICK1);
3564
3565 for (i = 1; i < N_RX_COMP_RINGS; i++)
3566 writel(0, cp->regs + REG_PLUS_RX_COMPN_TAIL(i));
3567 }
3568}
3569
3570/* Must be invoked under cp->lock. */
3571static void cas_read_pcs_link_mode(struct cas *cp, int *fd, int *spd,
3572 int *pause)
3573{
3574 u32 val = readl(cp->regs + REG_PCS_MII_LPA);
3575 *fd = (val & PCS_MII_LPA_FD) ? 1 : 0;
3576 *pause = (val & PCS_MII_LPA_SYM_PAUSE) ? 0x01 : 0x00;
3577 if (val & PCS_MII_LPA_ASYM_PAUSE)
3578 *pause |= 0x10;
3579 *spd = 1000;
3580}
3581
3582/* Must be invoked under cp->lock. */
3583static void cas_read_mii_link_mode(struct cas *cp, int *fd, int *spd,
3584 int *pause)
3585{
3586 u32 val;
3587
3588 *fd = 0;
3589 *spd = 10;
3590 *pause = 0;
3591
3592 /* use GMII registers */
3593 val = cas_phy_read(cp, MII_LPA);
3594 if (val & CAS_LPA_PAUSE)
3595 *pause = 0x01;
3596
3597 if (val & CAS_LPA_ASYM_PAUSE)
3598 *pause |= 0x10;
3599
3600 if (val & LPA_DUPLEX)
3601 *fd = 1;
3602 if (val & LPA_100)
3603 *spd = 100;
3604
3605 if (cp->cas_flags & CAS_FLAG_1000MB_CAP) {
3606 val = cas_phy_read(cp, CAS_MII_1000_STATUS);
3607 if (val & (CAS_LPA_1000FULL | CAS_LPA_1000HALF))
3608 *spd = 1000;
3609 if (val & CAS_LPA_1000FULL)
3610 *fd = 1;
3611 }
3612}
3613
3614/* A link-up condition has occurred, initialize and enable the
3615 * rest of the chip.
3616 *
3617 * Must be invoked under cp->lock.
3618 */
3619static void cas_set_link_modes(struct cas *cp)
3620{
3621 u32 val;
3622 int full_duplex, speed, pause;
3623
3624 full_duplex = 0;
3625 speed = 10;
3626 pause = 0;
3627
3628 if (CAS_PHY_MII(cp->phy_type)) {
3629 cas_mif_poll(cp, 0);
3630 val = cas_phy_read(cp, MII_BMCR);
3631 if (val & BMCR_ANENABLE) {
3632 cas_read_mii_link_mode(cp, &full_duplex, &speed,
3633 &pause);
3634 } else {
3635 if (val & BMCR_FULLDPLX)
3636 full_duplex = 1;
3637
3638 if (val & BMCR_SPEED100)
3639 speed = 100;
3640 else if (val & CAS_BMCR_SPEED1000)
3641 speed = (cp->cas_flags & CAS_FLAG_1000MB_CAP) ?
3642 1000 : 100;
3643 }
3644 cas_mif_poll(cp, 1);
3645
3646 } else {
3647 val = readl(cp->regs + REG_PCS_MII_CTRL);
3648 cas_read_pcs_link_mode(cp, &full_duplex, &speed, &pause);
3649 if ((val & PCS_MII_AUTONEG_EN) == 0) {
3650 if (val & PCS_MII_CTRL_DUPLEX)
3651 full_duplex = 1;
3652 }
3653 }
3654
3655 if (netif_msg_link(cp))
3656 printk(KERN_INFO "%s: Link up at %d Mbps, %s-duplex.\n",
3657 cp->dev->name, speed, (full_duplex ? "full" : "half"));
3658
3659 val = MAC_XIF_TX_MII_OUTPUT_EN | MAC_XIF_LINK_LED;
3660 if (CAS_PHY_MII(cp->phy_type)) {
3661 val |= MAC_XIF_MII_BUFFER_OUTPUT_EN;
3662 if (!full_duplex)
3663 val |= MAC_XIF_DISABLE_ECHO;
3664 }
3665 if (full_duplex)
3666 val |= MAC_XIF_FDPLX_LED;
3667 if (speed == 1000)
3668 val |= MAC_XIF_GMII_MODE;
3669 writel(val, cp->regs + REG_MAC_XIF_CFG);
3670
3671 /* deal with carrier and collision detect. */
3672 val = MAC_TX_CFG_IPG_EN;
3673 if (full_duplex) {
3674 val |= MAC_TX_CFG_IGNORE_CARRIER;
3675 val |= MAC_TX_CFG_IGNORE_COLL;
3676 } else {
3677#ifndef USE_CSMA_CD_PROTO
3678 val |= MAC_TX_CFG_NEVER_GIVE_UP_EN;
3679 val |= MAC_TX_CFG_NEVER_GIVE_UP_LIM;
3680#endif
3681 }
3682 /* val now set up for REG_MAC_TX_CFG */
3683
3684 /* If gigabit and half-duplex, enable carrier extension
3685 * mode. increase slot time to 512 bytes as well.
3686 * else, disable it and make sure slot time is 64 bytes.
3687 * also activate checksum bug workaround
3688 */
3689 if ((speed == 1000) && !full_duplex) {
3690 writel(val | MAC_TX_CFG_CARRIER_EXTEND,
3691 cp->regs + REG_MAC_TX_CFG);
3692
3693 val = readl(cp->regs + REG_MAC_RX_CFG);
3694 val &= ~MAC_RX_CFG_STRIP_FCS; /* checksum workaround */
3695 writel(val | MAC_RX_CFG_CARRIER_EXTEND,
3696 cp->regs + REG_MAC_RX_CFG);
3697
3698 writel(0x200, cp->regs + REG_MAC_SLOT_TIME);
3699
3700 cp->crc_size = 4;
3701 /* minimum size gigabit frame at half duplex */
3702 cp->min_frame_size = CAS_1000MB_MIN_FRAME;
3703
3704 } else {
3705 writel(val, cp->regs + REG_MAC_TX_CFG);
3706
3707 /* checksum bug workaround. don't strip FCS when in
3708 * half-duplex mode
3709 */
3710 val = readl(cp->regs + REG_MAC_RX_CFG);
3711 if (full_duplex) {
3712 val |= MAC_RX_CFG_STRIP_FCS;
3713 cp->crc_size = 0;
3714 cp->min_frame_size = CAS_MIN_MTU;
3715 } else {
3716 val &= ~MAC_RX_CFG_STRIP_FCS;
3717 cp->crc_size = 4;
3718 cp->min_frame_size = CAS_MIN_FRAME;
3719 }
3720 writel(val & ~MAC_RX_CFG_CARRIER_EXTEND,
3721 cp->regs + REG_MAC_RX_CFG);
3722 writel(0x40, cp->regs + REG_MAC_SLOT_TIME);
3723 }
3724
3725 if (netif_msg_link(cp)) {
3726 if (pause & 0x01) {
3727 printk(KERN_INFO "%s: Pause is enabled "
3728 "(rxfifo: %d off: %d on: %d)\n",
3729 cp->dev->name,
3730 cp->rx_fifo_size,
3731 cp->rx_pause_off,
3732 cp->rx_pause_on);
3733 } else if (pause & 0x10) {
3734 printk(KERN_INFO "%s: TX pause enabled\n",
3735 cp->dev->name);
3736 } else {
3737 printk(KERN_INFO "%s: Pause is disabled\n",
3738 cp->dev->name);
3739 }
3740 }
3741
3742 val = readl(cp->regs + REG_MAC_CTRL_CFG);
3743 val &= ~(MAC_CTRL_CFG_SEND_PAUSE_EN | MAC_CTRL_CFG_RECV_PAUSE_EN);
3744 if (pause) { /* symmetric or asymmetric pause */
3745 val |= MAC_CTRL_CFG_SEND_PAUSE_EN;
3746 if (pause & 0x01) { /* symmetric pause */
3747 val |= MAC_CTRL_CFG_RECV_PAUSE_EN;
3748 }
3749 }
3750 writel(val, cp->regs + REG_MAC_CTRL_CFG);
3751 cas_start_dma(cp);
3752}
3753
3754/* Must be invoked under cp->lock. */
3755static void cas_init_hw(struct cas *cp, int restart_link)
3756{
3757 if (restart_link)
3758 cas_phy_init(cp);
3759
3760 cas_init_pause_thresholds(cp);
3761 cas_init_mac(cp);
3762 cas_init_dma(cp);
3763
3764 if (restart_link) {
3765 /* Default aneg parameters */
3766 cp->timer_ticks = 0;
3767 cas_begin_auto_negotiation(cp, NULL);
3768 } else if (cp->lstate == link_up) {
3769 cas_set_link_modes(cp);
3770 netif_carrier_on(cp->dev);
3771 }
3772}
3773
3774/* Must be invoked under cp->lock. on earlier cassini boards,
3775 * SOFT_0 is tied to PCI reset. we use this to force a pci reset,
3776 * let it settle out, and then restore pci state.
3777 */
3778static void cas_hard_reset(struct cas *cp)
3779{
3780 writel(BIM_LOCAL_DEV_SOFT_0, cp->regs + REG_BIM_LOCAL_DEV_EN);
3781 udelay(20);
3782 pci_restore_state(cp->pdev);
3783}
3784
3785
3786static void cas_global_reset(struct cas *cp, int blkflag)
3787{
3788 int limit;
3789
3790 /* issue a global reset. don't use RSTOUT. */
3791 if (blkflag && !CAS_PHY_MII(cp->phy_type)) {
3792 /* For PCS, when the blkflag is set, we should set the
3793 * SW_REST_BLOCK_PCS_SLINK bit to prevent the results of
3794 * the last autonegotiation from being cleared. We'll
3795 * need some special handling if the chip is set into a
3796 * loopback mode.
3797 */
3798 writel((SW_RESET_TX | SW_RESET_RX | SW_RESET_BLOCK_PCS_SLINK),
3799 cp->regs + REG_SW_RESET);
3800 } else {
3801 writel(SW_RESET_TX | SW_RESET_RX, cp->regs + REG_SW_RESET);
3802 }
3803
3804 /* need to wait at least 3ms before polling register */
3805 mdelay(3);
3806
3807 limit = STOP_TRIES;
3808 while (limit-- > 0) {
3809 u32 val = readl(cp->regs + REG_SW_RESET);
3810 if ((val & (SW_RESET_TX | SW_RESET_RX)) == 0)
3811 goto done;
3812 udelay(10);
3813 }
3814 printk(KERN_ERR "%s: sw reset failed.\n", cp->dev->name);
3815
3816done:
3817 /* enable various BIM interrupts */
3818 writel(BIM_CFG_DPAR_INTR_ENABLE | BIM_CFG_RMA_INTR_ENABLE |
3819 BIM_CFG_RTA_INTR_ENABLE, cp->regs + REG_BIM_CFG);
3820
3821 /* clear out pci error status mask for handled errors.
3822 * we don't deal with DMA counter overflows as they happen
3823 * all the time.
3824 */
3825 writel(0xFFFFFFFFU & ~(PCI_ERR_BADACK | PCI_ERR_DTRTO |
3826 PCI_ERR_OTHER | PCI_ERR_BIM_DMA_WRITE |
3827 PCI_ERR_BIM_DMA_READ), cp->regs +
3828 REG_PCI_ERR_STATUS_MASK);
3829
3830 /* set up for MII by default to address mac rx reset timeout
3831 * issue
3832 */
3833 writel(PCS_DATAPATH_MODE_MII, cp->regs + REG_PCS_DATAPATH_MODE);
3834}
3835
3836static void cas_reset(struct cas *cp, int blkflag)
3837{
3838 u32 val;
3839
3840 cas_mask_intr(cp);
3841 cas_global_reset(cp, blkflag);
3842 cas_mac_reset(cp);
3843 cas_entropy_reset(cp);
3844
3845 /* disable dma engines. */
3846 val = readl(cp->regs + REG_TX_CFG);
3847 val &= ~TX_CFG_DMA_EN;
3848 writel(val, cp->regs + REG_TX_CFG);
3849
3850 val = readl(cp->regs + REG_RX_CFG);
3851 val &= ~RX_CFG_DMA_EN;
3852 writel(val, cp->regs + REG_RX_CFG);
3853
3854 /* program header parser */
3855 if ((cp->cas_flags & CAS_FLAG_TARGET_ABORT) ||
3856 (CAS_HP_ALT_FIRMWARE == cas_prog_null)) {
3857 cas_load_firmware(cp, CAS_HP_FIRMWARE);
3858 } else {
3859 cas_load_firmware(cp, CAS_HP_ALT_FIRMWARE);
3860 }
3861
3862 /* clear out error registers */
3863 spin_lock(&cp->stat_lock[N_TX_RINGS]);
3864 cas_clear_mac_err(cp);
3865 spin_unlock(&cp->stat_lock[N_TX_RINGS]);
3866}
3867
3868/* Shut down the chip, must be called with pm_sem held. */
3869static void cas_shutdown(struct cas *cp)
3870{
3871 unsigned long flags;
3872
3873 /* Make us not-running to avoid timers respawning */
3874 cp->hw_running = 0;
3875
3876 del_timer_sync(&cp->link_timer);
3877
3878 /* Stop the reset task */
3879#if 0
3880 while (atomic_read(&cp->reset_task_pending_mtu) ||
3881 atomic_read(&cp->reset_task_pending_spare) ||
3882 atomic_read(&cp->reset_task_pending_all))
3883 schedule();
3884
3885#else
3886 while (atomic_read(&cp->reset_task_pending))
3887 schedule();
3888#endif
3889 /* Actually stop the chip */
3890 cas_lock_all_save(cp, flags);
3891 cas_reset(cp, 0);
3892 if (cp->cas_flags & CAS_FLAG_SATURN)
3893 cas_phy_powerdown(cp);
3894 cas_unlock_all_restore(cp, flags);
3895}
3896
3897static int cas_change_mtu(struct net_device *dev, int new_mtu)
3898{
3899 struct cas *cp = netdev_priv(dev);
3900
3901 if (new_mtu < CAS_MIN_MTU || new_mtu > CAS_MAX_MTU)
3902 return -EINVAL;
3903
3904 dev->mtu = new_mtu;
3905 if (!netif_running(dev) || !netif_device_present(dev))
3906 return 0;
3907
3908 /* let the reset task handle it */
3909#if 1
3910 atomic_inc(&cp->reset_task_pending);
3911 if ((cp->phy_type & CAS_PHY_SERDES)) {
3912 atomic_inc(&cp->reset_task_pending_all);
3913 } else {
3914 atomic_inc(&cp->reset_task_pending_mtu);
3915 }
3916 schedule_work(&cp->reset_task);
3917#else
3918 atomic_set(&cp->reset_task_pending, (cp->phy_type & CAS_PHY_SERDES) ?
3919 CAS_RESET_ALL : CAS_RESET_MTU);
3920 printk(KERN_ERR "reset called in cas_change_mtu\n");
3921 schedule_work(&cp->reset_task);
3922#endif
3923
3924 flush_scheduled_work();
3925 return 0;
3926}
3927
3928static void cas_clean_txd(struct cas *cp, int ring)
3929{
3930 struct cas_tx_desc *txd = cp->init_txds[ring];
3931 struct sk_buff *skb, **skbs = cp->tx_skbs[ring];
3932 u64 daddr, dlen;
3933 int i, size;
3934
3935 size = TX_DESC_RINGN_SIZE(ring);
3936 for (i = 0; i < size; i++) {
3937 int frag;
3938
3939 if (skbs[i] == NULL)
3940 continue;
3941
3942 skb = skbs[i];
3943 skbs[i] = NULL;
3944
3945 for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) {
3946 int ent = i & (size - 1);
3947
3948 /* first buffer is never a tiny buffer and so
3949 * needs to be unmapped.
3950 */
3951 daddr = le64_to_cpu(txd[ent].buffer);
3952 dlen = CAS_VAL(TX_DESC_BUFLEN,
3953 le64_to_cpu(txd[ent].control));
3954 pci_unmap_page(cp->pdev, daddr, dlen,
3955 PCI_DMA_TODEVICE);
3956
3957 if (frag != skb_shinfo(skb)->nr_frags) {
3958 i++;
3959
3960 /* next buffer might by a tiny buffer.
3961 * skip past it.
3962 */
3963 ent = i & (size - 1);
3964 if (cp->tx_tiny_use[ring][ent].used)
3965 i++;
3966 }
3967 }
3968 dev_kfree_skb_any(skb);
3969 }
3970
3971 /* zero out tiny buf usage */
3972 memset(cp->tx_tiny_use[ring], 0, size*sizeof(*cp->tx_tiny_use[ring]));
3973}
3974
3975/* freed on close */
3976static inline void cas_free_rx_desc(struct cas *cp, int ring)
3977{
3978 cas_page_t **page = cp->rx_pages[ring];
3979 int i, size;
3980
3981 size = RX_DESC_RINGN_SIZE(ring);
3982 for (i = 0; i < size; i++) {
3983 if (page[i]) {
3984 cas_page_free(cp, page[i]);
3985 page[i] = NULL;
3986 }
3987 }
3988}
3989
3990static void cas_free_rxds(struct cas *cp)
3991{
3992 int i;
3993
3994 for (i = 0; i < N_RX_DESC_RINGS; i++)
3995 cas_free_rx_desc(cp, i);
3996}
3997
3998/* Must be invoked under cp->lock. */
3999static void cas_clean_rings(struct cas *cp)
4000{
4001 int i;
4002
4003 /* need to clean all tx rings */
4004 memset(cp->tx_old, 0, sizeof(*cp->tx_old)*N_TX_RINGS);
4005 memset(cp->tx_new, 0, sizeof(*cp->tx_new)*N_TX_RINGS);
4006 for (i = 0; i < N_TX_RINGS; i++)
4007 cas_clean_txd(cp, i);
4008
4009 /* zero out init block */
4010 memset(cp->init_block, 0, sizeof(struct cas_init_block));
4011 cas_clean_rxds(cp);
4012 cas_clean_rxcs(cp);
4013}
4014
4015/* allocated on open */
4016static inline int cas_alloc_rx_desc(struct cas *cp, int ring)
4017{
4018 cas_page_t **page = cp->rx_pages[ring];
4019 int size, i = 0;
4020
4021 size = RX_DESC_RINGN_SIZE(ring);
4022 for (i = 0; i < size; i++) {
4023 if ((page[i] = cas_page_alloc(cp, GFP_KERNEL)) == NULL)
4024 return -1;
4025 }
4026 return 0;
4027}
4028
4029static int cas_alloc_rxds(struct cas *cp)
4030{
4031 int i;
4032
4033 for (i = 0; i < N_RX_DESC_RINGS; i++) {
4034 if (cas_alloc_rx_desc(cp, i) < 0) {
4035 cas_free_rxds(cp);
4036 return -1;
4037 }
4038 }
4039 return 0;
4040}
4041
4042static void cas_reset_task(void *data)
4043{
4044 struct cas *cp = (struct cas *) data;
4045#if 0
4046 int pending = atomic_read(&cp->reset_task_pending);
4047#else
4048 int pending_all = atomic_read(&cp->reset_task_pending_all);
4049 int pending_spare = atomic_read(&cp->reset_task_pending_spare);
4050 int pending_mtu = atomic_read(&cp->reset_task_pending_mtu);
4051
4052 if (pending_all == 0 && pending_spare == 0 && pending_mtu == 0) {
4053 /* We can have more tasks scheduled than actually
4054 * needed.
4055 */
4056 atomic_dec(&cp->reset_task_pending);
4057 return;
4058 }
4059#endif
4060 /* The link went down, we reset the ring, but keep
4061 * DMA stopped. Use this function for reset
4062 * on error as well.
4063 */
4064 if (cp->hw_running) {
4065 unsigned long flags;
4066
4067 /* Make sure we don't get interrupts or tx packets */
4068 netif_device_detach(cp->dev);
4069 cas_lock_all_save(cp, flags);
4070
4071 if (cp->opened) {
4072 /* We call cas_spare_recover when we call cas_open.
4073 * but we do not initialize the lists cas_spare_recover
4074 * uses until cas_open is called.
4075 */
4076 cas_spare_recover(cp, GFP_ATOMIC);
4077 }
4078#if 1
4079 /* test => only pending_spare set */
4080 if (!pending_all && !pending_mtu)
4081 goto done;
4082#else
4083 if (pending == CAS_RESET_SPARE)
4084 goto done;
4085#endif
4086 /* when pending == CAS_RESET_ALL, the following
4087 * call to cas_init_hw will restart auto negotiation.
4088 * Setting the second argument of cas_reset to
4089 * !(pending == CAS_RESET_ALL) will set this argument
4090 * to 1 (avoiding reinitializing the PHY for the normal
4091 * PCS case) when auto negotiation is not restarted.
4092 */
4093#if 1
4094 cas_reset(cp, !(pending_all > 0));
4095 if (cp->opened)
4096 cas_clean_rings(cp);
4097 cas_init_hw(cp, (pending_all > 0));
4098#else
4099 cas_reset(cp, !(pending == CAS_RESET_ALL));
4100 if (cp->opened)
4101 cas_clean_rings(cp);
4102 cas_init_hw(cp, pending == CAS_RESET_ALL);
4103#endif
4104
4105done:
4106 cas_unlock_all_restore(cp, flags);
4107 netif_device_attach(cp->dev);
4108 }
4109#if 1
4110 atomic_sub(pending_all, &cp->reset_task_pending_all);
4111 atomic_sub(pending_spare, &cp->reset_task_pending_spare);
4112 atomic_sub(pending_mtu, &cp->reset_task_pending_mtu);
4113 atomic_dec(&cp->reset_task_pending);
4114#else
4115 atomic_set(&cp->reset_task_pending, 0);
4116#endif
4117}
4118
4119static void cas_link_timer(unsigned long data)
4120{
4121 struct cas *cp = (struct cas *) data;
4122 int mask, pending = 0, reset = 0;
4123 unsigned long flags;
4124
4125 if (link_transition_timeout != 0 &&
4126 cp->link_transition_jiffies_valid &&
4127 ((jiffies - cp->link_transition_jiffies) >
4128 (link_transition_timeout))) {
4129 /* One-second counter so link-down workaround doesn't
4130 * cause resets to occur so fast as to fool the switch
4131 * into thinking the link is down.
4132 */
4133 cp->link_transition_jiffies_valid = 0;
4134 }
4135
4136 if (!cp->hw_running)
4137 return;
4138
4139 spin_lock_irqsave(&cp->lock, flags);
4140 cas_lock_tx(cp);
4141 cas_entropy_gather(cp);
4142
4143 /* If the link task is still pending, we just
4144 * reschedule the link timer
4145 */
4146#if 1
4147 if (atomic_read(&cp->reset_task_pending_all) ||
4148 atomic_read(&cp->reset_task_pending_spare) ||
4149 atomic_read(&cp->reset_task_pending_mtu))
4150 goto done;
4151#else
4152 if (atomic_read(&cp->reset_task_pending))
4153 goto done;
4154#endif
4155
4156 /* check for rx cleaning */
4157 if ((mask = (cp->cas_flags & CAS_FLAG_RXD_POST_MASK))) {
4158 int i, rmask;
4159
4160 for (i = 0; i < MAX_RX_DESC_RINGS; i++) {
4161 rmask = CAS_FLAG_RXD_POST(i);
4162 if ((mask & rmask) == 0)
4163 continue;
4164
4165 /* post_rxds will do a mod_timer */
4166 if (cas_post_rxds_ringN(cp, i, cp->rx_last[i]) < 0) {
4167 pending = 1;
4168 continue;
4169 }
4170 cp->cas_flags &= ~rmask;
4171 }
4172 }
4173
4174 if (CAS_PHY_MII(cp->phy_type)) {
4175 u16 bmsr;
4176 cas_mif_poll(cp, 0);
4177 bmsr = cas_phy_read(cp, MII_BMSR);
4178 /* WTZ: Solaris driver reads this twice, but that
4179 * may be due to the PCS case and the use of a
4180 * common implementation. Read it twice here to be
4181 * safe.
4182 */
4183 bmsr = cas_phy_read(cp, MII_BMSR);
4184 cas_mif_poll(cp, 1);
4185 readl(cp->regs + REG_MIF_STATUS); /* avoid dups */
4186 reset = cas_mii_link_check(cp, bmsr);
4187 } else {
4188 reset = cas_pcs_link_check(cp);
4189 }
4190
4191 if (reset)
4192 goto done;
4193
4194 /* check for tx state machine confusion */
4195 if ((readl(cp->regs + REG_MAC_TX_STATUS) & MAC_TX_FRAME_XMIT) == 0) {
4196 u32 val = readl(cp->regs + REG_MAC_STATE_MACHINE);
4197 u32 wptr, rptr;
4198 int tlm = CAS_VAL(MAC_SM_TLM, val);
4199
4200 if (((tlm == 0x5) || (tlm == 0x3)) &&
4201 (CAS_VAL(MAC_SM_ENCAP_SM, val) == 0)) {
4202 if (netif_msg_tx_err(cp))
4203 printk(KERN_DEBUG "%s: tx err: "
4204 "MAC_STATE[%08x]\n",
4205 cp->dev->name, val);
4206 reset = 1;
4207 goto done;
4208 }
4209
4210 val = readl(cp->regs + REG_TX_FIFO_PKT_CNT);
4211 wptr = readl(cp->regs + REG_TX_FIFO_WRITE_PTR);
4212 rptr = readl(cp->regs + REG_TX_FIFO_READ_PTR);
4213 if ((val == 0) && (wptr != rptr)) {
4214 if (netif_msg_tx_err(cp))
4215 printk(KERN_DEBUG "%s: tx err: "
4216 "TX_FIFO[%08x:%08x:%08x]\n",
4217 cp->dev->name, val, wptr, rptr);
4218 reset = 1;
4219 }
4220
4221 if (reset)
4222 cas_hard_reset(cp);
4223 }
4224
4225done:
4226 if (reset) {
4227#if 1
4228 atomic_inc(&cp->reset_task_pending);
4229 atomic_inc(&cp->reset_task_pending_all);
4230 schedule_work(&cp->reset_task);
4231#else
4232 atomic_set(&cp->reset_task_pending, CAS_RESET_ALL);
4233 printk(KERN_ERR "reset called in cas_link_timer\n");
4234 schedule_work(&cp->reset_task);
4235#endif
4236 }
4237
4238 if (!pending)
4239 mod_timer(&cp->link_timer, jiffies + CAS_LINK_TIMEOUT);
4240 cas_unlock_tx(cp);
4241 spin_unlock_irqrestore(&cp->lock, flags);
4242}
4243
4244/* tiny buffers are used to avoid target abort issues with
4245 * older cassini's
4246 */
4247static void cas_tx_tiny_free(struct cas *cp)
4248{
4249 struct pci_dev *pdev = cp->pdev;
4250 int i;
4251
4252 for (i = 0; i < N_TX_RINGS; i++) {
4253 if (!cp->tx_tiny_bufs[i])
4254 continue;
4255
4256 pci_free_consistent(pdev, TX_TINY_BUF_BLOCK,
4257 cp->tx_tiny_bufs[i],
4258 cp->tx_tiny_dvma[i]);
4259 cp->tx_tiny_bufs[i] = NULL;
4260 }
4261}
4262
4263static int cas_tx_tiny_alloc(struct cas *cp)
4264{
4265 struct pci_dev *pdev = cp->pdev;
4266 int i;
4267
4268 for (i = 0; i < N_TX_RINGS; i++) {
4269 cp->tx_tiny_bufs[i] =
4270 pci_alloc_consistent(pdev, TX_TINY_BUF_BLOCK,
4271 &cp->tx_tiny_dvma[i]);
4272 if (!cp->tx_tiny_bufs[i]) {
4273 cas_tx_tiny_free(cp);
4274 return -1;
4275 }
4276 }
4277 return 0;
4278}
4279
4280
4281static int cas_open(struct net_device *dev)
4282{
4283 struct cas *cp = netdev_priv(dev);
4284 int hw_was_up, err;
4285 unsigned long flags;
4286
4287 down(&cp->pm_sem);
4288
4289 hw_was_up = cp->hw_running;
4290
4291 /* The power-management semaphore protects the hw_running
4292 * etc. state so it is safe to do this bit without cp->lock
4293 */
4294 if (!cp->hw_running) {
4295 /* Reset the chip */
4296 cas_lock_all_save(cp, flags);
4297 /* We set the second arg to cas_reset to zero
4298 * because cas_init_hw below will have its second
4299 * argument set to non-zero, which will force
4300 * autonegotiation to start.
4301 */
4302 cas_reset(cp, 0);
4303 cp->hw_running = 1;
4304 cas_unlock_all_restore(cp, flags);
4305 }
4306
4307 if (cas_tx_tiny_alloc(cp) < 0)
4308 return -ENOMEM;
4309
4310 /* alloc rx descriptors */
4311 err = -ENOMEM;
4312 if (cas_alloc_rxds(cp) < 0)
4313 goto err_tx_tiny;
4314
4315 /* allocate spares */
4316 cas_spare_init(cp);
4317 cas_spare_recover(cp, GFP_KERNEL);
4318
4319 /* We can now request the interrupt as we know it's masked
4320 * on the controller. cassini+ has up to 4 interrupts
4321 * that can be used, but you need to do explicit pci interrupt
4322 * mapping to expose them
4323 */
4324 if (request_irq(cp->pdev->irq, cas_interrupt,
4325 SA_SHIRQ, dev->name, (void *) dev)) {
4326 printk(KERN_ERR "%s: failed to request irq !\n",
4327 cp->dev->name);
4328 err = -EAGAIN;
4329 goto err_spare;
4330 }
4331
4332 /* init hw */
4333 cas_lock_all_save(cp, flags);
4334 cas_clean_rings(cp);
4335 cas_init_hw(cp, !hw_was_up);
4336 cp->opened = 1;
4337 cas_unlock_all_restore(cp, flags);
4338
4339 netif_start_queue(dev);
4340 up(&cp->pm_sem);
4341 return 0;
4342
4343err_spare:
4344 cas_spare_free(cp);
4345 cas_free_rxds(cp);
4346err_tx_tiny:
4347 cas_tx_tiny_free(cp);
4348 up(&cp->pm_sem);
4349 return err;
4350}
4351
4352static int cas_close(struct net_device *dev)
4353{
4354 unsigned long flags;
4355 struct cas *cp = netdev_priv(dev);
4356
4357 /* Make sure we don't get distracted by suspend/resume */
4358 down(&cp->pm_sem);
4359
4360 netif_stop_queue(dev);
4361
4362 /* Stop traffic, mark us closed */
4363 cas_lock_all_save(cp, flags);
4364 cp->opened = 0;
4365 cas_reset(cp, 0);
4366 cas_phy_init(cp);
4367 cas_begin_auto_negotiation(cp, NULL);
4368 cas_clean_rings(cp);
4369 cas_unlock_all_restore(cp, flags);
4370
4371 free_irq(cp->pdev->irq, (void *) dev);
4372 cas_spare_free(cp);
4373 cas_free_rxds(cp);
4374 cas_tx_tiny_free(cp);
4375 up(&cp->pm_sem);
4376 return 0;
4377}
4378
4379static struct {
4380 const char name[ETH_GSTRING_LEN];
4381} ethtool_cassini_statnames[] = {
4382 {"collisions"},
4383 {"rx_bytes"},
4384 {"rx_crc_errors"},
4385 {"rx_dropped"},
4386 {"rx_errors"},
4387 {"rx_fifo_errors"},
4388 {"rx_frame_errors"},
4389 {"rx_length_errors"},
4390 {"rx_over_errors"},
4391 {"rx_packets"},
4392 {"tx_aborted_errors"},
4393 {"tx_bytes"},
4394 {"tx_dropped"},
4395 {"tx_errors"},
4396 {"tx_fifo_errors"},
4397 {"tx_packets"}
4398};
4399#define CAS_NUM_STAT_KEYS (sizeof(ethtool_cassini_statnames)/ETH_GSTRING_LEN)
4400
4401static struct {
4402 const int offsets; /* neg. values for 2nd arg to cas_read_phy */
4403} ethtool_register_table[] = {
4404 {-MII_BMSR},
4405 {-MII_BMCR},
4406 {REG_CAWR},
4407 {REG_INF_BURST},
4408 {REG_BIM_CFG},
4409 {REG_RX_CFG},
4410 {REG_HP_CFG},
4411 {REG_MAC_TX_CFG},
4412 {REG_MAC_RX_CFG},
4413 {REG_MAC_CTRL_CFG},
4414 {REG_MAC_XIF_CFG},
4415 {REG_MIF_CFG},
4416 {REG_PCS_CFG},
4417 {REG_SATURN_PCFG},
4418 {REG_PCS_MII_STATUS},
4419 {REG_PCS_STATE_MACHINE},
4420 {REG_MAC_COLL_EXCESS},
4421 {REG_MAC_COLL_LATE}
4422};
4423#define CAS_REG_LEN (sizeof(ethtool_register_table)/sizeof(int))
4424#define CAS_MAX_REGS (sizeof (u32)*CAS_REG_LEN)
4425
4426static void cas_read_regs(struct cas *cp, u8 *ptr, int len)
4427{
4428 u8 *p;
4429 int i;
4430 unsigned long flags;
4431
4432 spin_lock_irqsave(&cp->lock, flags);
4433 for (i = 0, p = ptr; i < len ; i ++, p += sizeof(u32)) {
4434 u16 hval;
4435 u32 val;
4436 if (ethtool_register_table[i].offsets < 0) {
4437 hval = cas_phy_read(cp,
4438 -ethtool_register_table[i].offsets);
4439 val = hval;
4440 } else {
4441 val= readl(cp->regs+ethtool_register_table[i].offsets);
4442 }
4443 memcpy(p, (u8 *)&val, sizeof(u32));
4444 }
4445 spin_unlock_irqrestore(&cp->lock, flags);
4446}
4447
4448static struct net_device_stats *cas_get_stats(struct net_device *dev)
4449{
4450 struct cas *cp = netdev_priv(dev);
4451 struct net_device_stats *stats = cp->net_stats;
4452 unsigned long flags;
4453 int i;
4454 unsigned long tmp;
4455
4456 /* we collate all of the stats into net_stats[N_TX_RING] */
4457 if (!cp->hw_running)
4458 return stats + N_TX_RINGS;
4459
4460 /* collect outstanding stats */
4461 /* WTZ: the Cassini spec gives these as 16 bit counters but
4462 * stored in 32-bit words. Added a mask of 0xffff to be safe,
4463 * in case the chip somehow puts any garbage in the other bits.
4464 * Also, counter usage didn't seem to mach what Adrian did
4465 * in the parts of the code that set these quantities. Made
4466 * that consistent.
4467 */
4468 spin_lock_irqsave(&cp->stat_lock[N_TX_RINGS], flags);
4469 stats[N_TX_RINGS].rx_crc_errors +=
4470 readl(cp->regs + REG_MAC_FCS_ERR) & 0xffff;
4471 stats[N_TX_RINGS].rx_frame_errors +=
4472 readl(cp->regs + REG_MAC_ALIGN_ERR) &0xffff;
4473 stats[N_TX_RINGS].rx_length_errors +=
4474 readl(cp->regs + REG_MAC_LEN_ERR) & 0xffff;
4475#if 1
4476 tmp = (readl(cp->regs + REG_MAC_COLL_EXCESS) & 0xffff) +
4477 (readl(cp->regs + REG_MAC_COLL_LATE) & 0xffff);
4478 stats[N_TX_RINGS].tx_aborted_errors += tmp;
4479 stats[N_TX_RINGS].collisions +=
4480 tmp + (readl(cp->regs + REG_MAC_COLL_NORMAL) & 0xffff);
4481#else
4482 stats[N_TX_RINGS].tx_aborted_errors +=
4483 readl(cp->regs + REG_MAC_COLL_EXCESS);
4484 stats[N_TX_RINGS].collisions += readl(cp->regs + REG_MAC_COLL_EXCESS) +
4485 readl(cp->regs + REG_MAC_COLL_LATE);
4486#endif
4487 cas_clear_mac_err(cp);
4488
4489 /* saved bits that are unique to ring 0 */
4490 spin_lock(&cp->stat_lock[0]);
4491 stats[N_TX_RINGS].collisions += stats[0].collisions;
4492 stats[N_TX_RINGS].rx_over_errors += stats[0].rx_over_errors;
4493 stats[N_TX_RINGS].rx_frame_errors += stats[0].rx_frame_errors;
4494 stats[N_TX_RINGS].rx_fifo_errors += stats[0].rx_fifo_errors;
4495 stats[N_TX_RINGS].tx_aborted_errors += stats[0].tx_aborted_errors;
4496 stats[N_TX_RINGS].tx_fifo_errors += stats[0].tx_fifo_errors;
4497 spin_unlock(&cp->stat_lock[0]);
4498
4499 for (i = 0; i < N_TX_RINGS; i++) {
4500 spin_lock(&cp->stat_lock[i]);
4501 stats[N_TX_RINGS].rx_length_errors +=
4502 stats[i].rx_length_errors;
4503 stats[N_TX_RINGS].rx_crc_errors += stats[i].rx_crc_errors;
4504 stats[N_TX_RINGS].rx_packets += stats[i].rx_packets;
4505 stats[N_TX_RINGS].tx_packets += stats[i].tx_packets;
4506 stats[N_TX_RINGS].rx_bytes += stats[i].rx_bytes;
4507 stats[N_TX_RINGS].tx_bytes += stats[i].tx_bytes;
4508 stats[N_TX_RINGS].rx_errors += stats[i].rx_errors;
4509 stats[N_TX_RINGS].tx_errors += stats[i].tx_errors;
4510 stats[N_TX_RINGS].rx_dropped += stats[i].rx_dropped;
4511 stats[N_TX_RINGS].tx_dropped += stats[i].tx_dropped;
4512 memset(stats + i, 0, sizeof(struct net_device_stats));
4513 spin_unlock(&cp->stat_lock[i]);
4514 }
4515 spin_unlock_irqrestore(&cp->stat_lock[N_TX_RINGS], flags);
4516 return stats + N_TX_RINGS;
4517}
4518
4519
4520static void cas_set_multicast(struct net_device *dev)
4521{
4522 struct cas *cp = netdev_priv(dev);
4523 u32 rxcfg, rxcfg_new;
4524 unsigned long flags;
4525 int limit = STOP_TRIES;
4526
4527 if (!cp->hw_running)
4528 return;
4529
4530 spin_lock_irqsave(&cp->lock, flags);
4531 rxcfg = readl(cp->regs + REG_MAC_RX_CFG);
4532
4533 /* disable RX MAC and wait for completion */
4534 writel(rxcfg & ~MAC_RX_CFG_EN, cp->regs + REG_MAC_RX_CFG);
4535 while (readl(cp->regs + REG_MAC_RX_CFG) & MAC_RX_CFG_EN) {
4536 if (!limit--)
4537 break;
4538 udelay(10);
4539 }
4540
4541 /* disable hash filter and wait for completion */
4542 limit = STOP_TRIES;
4543 rxcfg &= ~(MAC_RX_CFG_PROMISC_EN | MAC_RX_CFG_HASH_FILTER_EN);
4544 writel(rxcfg & ~MAC_RX_CFG_EN, cp->regs + REG_MAC_RX_CFG);
4545 while (readl(cp->regs + REG_MAC_RX_CFG) & MAC_RX_CFG_HASH_FILTER_EN) {
4546 if (!limit--)
4547 break;
4548 udelay(10);
4549 }
4550
4551 /* program hash filters */
4552 cp->mac_rx_cfg = rxcfg_new = cas_setup_multicast(cp);
4553 rxcfg |= rxcfg_new;
4554 writel(rxcfg, cp->regs + REG_MAC_RX_CFG);
4555 spin_unlock_irqrestore(&cp->lock, flags);
4556}
4557
4558static void cas_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
4559{
4560 struct cas *cp = netdev_priv(dev);
4561 strncpy(info->driver, DRV_MODULE_NAME, ETHTOOL_BUSINFO_LEN);
4562 strncpy(info->version, DRV_MODULE_VERSION, ETHTOOL_BUSINFO_LEN);
4563 info->fw_version[0] = '\0';
4564 strncpy(info->bus_info, pci_name(cp->pdev), ETHTOOL_BUSINFO_LEN);
4565 info->regdump_len = cp->casreg_len < CAS_MAX_REGS ?
4566 cp->casreg_len : CAS_MAX_REGS;
4567 info->n_stats = CAS_NUM_STAT_KEYS;
4568}
4569
4570static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4571{
4572 struct cas *cp = netdev_priv(dev);
4573 u16 bmcr;
4574 int full_duplex, speed, pause;
4575 unsigned long flags;
4576 enum link_state linkstate = link_up;
4577
4578 cmd->advertising = 0;
4579 cmd->supported = SUPPORTED_Autoneg;
4580 if (cp->cas_flags & CAS_FLAG_1000MB_CAP) {
4581 cmd->supported |= SUPPORTED_1000baseT_Full;
4582 cmd->advertising |= ADVERTISED_1000baseT_Full;
4583 }
4584
4585 /* Record PHY settings if HW is on. */
4586 spin_lock_irqsave(&cp->lock, flags);
4587 bmcr = 0;
4588 linkstate = cp->lstate;
4589 if (CAS_PHY_MII(cp->phy_type)) {
4590 cmd->port = PORT_MII;
4591 cmd->transceiver = (cp->cas_flags & CAS_FLAG_SATURN) ?
4592 XCVR_INTERNAL : XCVR_EXTERNAL;
4593 cmd->phy_address = cp->phy_addr;
4594 cmd->advertising |= ADVERTISED_TP | ADVERTISED_MII |
4595 ADVERTISED_10baseT_Half |
4596 ADVERTISED_10baseT_Full |
4597 ADVERTISED_100baseT_Half |
4598 ADVERTISED_100baseT_Full;
4599
4600 cmd->supported |=
4601 (SUPPORTED_10baseT_Half |
4602 SUPPORTED_10baseT_Full |
4603 SUPPORTED_100baseT_Half |
4604 SUPPORTED_100baseT_Full |
4605 SUPPORTED_TP | SUPPORTED_MII);
4606
4607 if (cp->hw_running) {
4608 cas_mif_poll(cp, 0);
4609 bmcr = cas_phy_read(cp, MII_BMCR);
4610 cas_read_mii_link_mode(cp, &full_duplex,
4611 &speed, &pause);
4612 cas_mif_poll(cp, 1);
4613 }
4614
4615 } else {
4616 cmd->port = PORT_FIBRE;
4617 cmd->transceiver = XCVR_INTERNAL;
4618 cmd->phy_address = 0;
4619 cmd->supported |= SUPPORTED_FIBRE;
4620 cmd->advertising |= ADVERTISED_FIBRE;
4621
4622 if (cp->hw_running) {
4623 /* pcs uses the same bits as mii */
4624 bmcr = readl(cp->regs + REG_PCS_MII_CTRL);
4625 cas_read_pcs_link_mode(cp, &full_duplex,
4626 &speed, &pause);
4627 }
4628 }
4629 spin_unlock_irqrestore(&cp->lock, flags);
4630
4631 if (bmcr & BMCR_ANENABLE) {
4632 cmd->advertising |= ADVERTISED_Autoneg;
4633 cmd->autoneg = AUTONEG_ENABLE;
4634 cmd->speed = ((speed == 10) ?
4635 SPEED_10 :
4636 ((speed == 1000) ?
4637 SPEED_1000 : SPEED_100));
4638 cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
4639 } else {
4640 cmd->autoneg = AUTONEG_DISABLE;
4641 cmd->speed =
4642 (bmcr & CAS_BMCR_SPEED1000) ?
4643 SPEED_1000 :
4644 ((bmcr & BMCR_SPEED100) ? SPEED_100:
4645 SPEED_10);
4646 cmd->duplex =
4647 (bmcr & BMCR_FULLDPLX) ?
4648 DUPLEX_FULL : DUPLEX_HALF;
4649 }
4650 if (linkstate != link_up) {
4651 /* Force these to "unknown" if the link is not up and
4652 * autonogotiation in enabled. We can set the link
4653 * speed to 0, but not cmd->duplex,
4654 * because its legal values are 0 and 1. Ethtool will
4655 * print the value reported in parentheses after the
4656 * word "Unknown" for unrecognized values.
4657 *
4658 * If in forced mode, we report the speed and duplex
4659 * settings that we configured.
4660 */
4661 if (cp->link_cntl & BMCR_ANENABLE) {
4662 cmd->speed = 0;
4663 cmd->duplex = 0xff;
4664 } else {
4665 cmd->speed = SPEED_10;
4666 if (cp->link_cntl & BMCR_SPEED100) {
4667 cmd->speed = SPEED_100;
4668 } else if (cp->link_cntl & CAS_BMCR_SPEED1000) {
4669 cmd->speed = SPEED_1000;
4670 }
4671 cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)?
4672 DUPLEX_FULL : DUPLEX_HALF;
4673 }
4674 }
4675 return 0;
4676}
4677
4678static int cas_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4679{
4680 struct cas *cp = netdev_priv(dev);
4681 unsigned long flags;
4682
4683 /* Verify the settings we care about. */
4684 if (cmd->autoneg != AUTONEG_ENABLE &&
4685 cmd->autoneg != AUTONEG_DISABLE)
4686 return -EINVAL;
4687
4688 if (cmd->autoneg == AUTONEG_DISABLE &&
4689 ((cmd->speed != SPEED_1000 &&
4690 cmd->speed != SPEED_100 &&
4691 cmd->speed != SPEED_10) ||
4692 (cmd->duplex != DUPLEX_HALF &&
4693 cmd->duplex != DUPLEX_FULL)))
4694 return -EINVAL;
4695
4696 /* Apply settings and restart link process. */
4697 spin_lock_irqsave(&cp->lock, flags);
4698 cas_begin_auto_negotiation(cp, cmd);
4699 spin_unlock_irqrestore(&cp->lock, flags);
4700 return 0;
4701}
4702
4703static int cas_nway_reset(struct net_device *dev)
4704{
4705 struct cas *cp = netdev_priv(dev);
4706 unsigned long flags;
4707
4708 if ((cp->link_cntl & BMCR_ANENABLE) == 0)
4709 return -EINVAL;
4710
4711 /* Restart link process. */
4712 spin_lock_irqsave(&cp->lock, flags);
4713 cas_begin_auto_negotiation(cp, NULL);
4714 spin_unlock_irqrestore(&cp->lock, flags);
4715
4716 return 0;
4717}
4718
4719static u32 cas_get_link(struct net_device *dev)
4720{
4721 struct cas *cp = netdev_priv(dev);
4722 return cp->lstate == link_up;
4723}
4724
4725static u32 cas_get_msglevel(struct net_device *dev)
4726{
4727 struct cas *cp = netdev_priv(dev);
4728 return cp->msg_enable;
4729}
4730
4731static void cas_set_msglevel(struct net_device *dev, u32 value)
4732{
4733 struct cas *cp = netdev_priv(dev);
4734 cp->msg_enable = value;
4735}
4736
4737static int cas_get_regs_len(struct net_device *dev)
4738{
4739 struct cas *cp = netdev_priv(dev);
4740 return cp->casreg_len < CAS_MAX_REGS ? cp->casreg_len: CAS_MAX_REGS;
4741}
4742
4743static void cas_get_regs(struct net_device *dev, struct ethtool_regs *regs,
4744 void *p)
4745{
4746 struct cas *cp = netdev_priv(dev);
4747 regs->version = 0;
4748 /* cas_read_regs handles locks (cp->lock). */
4749 cas_read_regs(cp, p, regs->len / sizeof(u32));
4750}
4751
4752static int cas_get_stats_count(struct net_device *dev)
4753{
4754 return CAS_NUM_STAT_KEYS;
4755}
4756
4757static void cas_get_strings(struct net_device *dev, u32 stringset, u8 *data)
4758{
4759 memcpy(data, &ethtool_cassini_statnames,
4760 CAS_NUM_STAT_KEYS * ETH_GSTRING_LEN);
4761}
4762
4763static void cas_get_ethtool_stats(struct net_device *dev,
4764 struct ethtool_stats *estats, u64 *data)
4765{
4766 struct cas *cp = netdev_priv(dev);
4767 struct net_device_stats *stats = cas_get_stats(cp->dev);
4768 int i = 0;
4769 data[i++] = stats->collisions;
4770 data[i++] = stats->rx_bytes;
4771 data[i++] = stats->rx_crc_errors;
4772 data[i++] = stats->rx_dropped;
4773 data[i++] = stats->rx_errors;
4774 data[i++] = stats->rx_fifo_errors;
4775 data[i++] = stats->rx_frame_errors;
4776 data[i++] = stats->rx_length_errors;
4777 data[i++] = stats->rx_over_errors;
4778 data[i++] = stats->rx_packets;
4779 data[i++] = stats->tx_aborted_errors;
4780 data[i++] = stats->tx_bytes;
4781 data[i++] = stats->tx_dropped;
4782 data[i++] = stats->tx_errors;
4783 data[i++] = stats->tx_fifo_errors;
4784 data[i++] = stats->tx_packets;
4785 BUG_ON(i != CAS_NUM_STAT_KEYS);
4786}
4787
4788static struct ethtool_ops cas_ethtool_ops = {
4789 .get_drvinfo = cas_get_drvinfo,
4790 .get_settings = cas_get_settings,
4791 .set_settings = cas_set_settings,
4792 .nway_reset = cas_nway_reset,
4793 .get_link = cas_get_link,
4794 .get_msglevel = cas_get_msglevel,
4795 .set_msglevel = cas_set_msglevel,
4796 .get_regs_len = cas_get_regs_len,
4797 .get_regs = cas_get_regs,
4798 .get_stats_count = cas_get_stats_count,
4799 .get_strings = cas_get_strings,
4800 .get_ethtool_stats = cas_get_ethtool_stats,
4801};
4802
4803static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
4804{
4805 struct cas *cp = netdev_priv(dev);
4806 struct mii_ioctl_data *data = if_mii(ifr);
4807 unsigned long flags;
4808 int rc = -EOPNOTSUPP;
4809
4810 /* Hold the PM semaphore while doing ioctl's or we may collide
4811 * with open/close and power management and oops.
4812 */
4813 down(&cp->pm_sem);
4814 switch (cmd) {
4815 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
4816 data->phy_id = cp->phy_addr;
4817 /* Fallthrough... */
4818
4819 case SIOCGMIIREG: /* Read MII PHY register. */
4820 spin_lock_irqsave(&cp->lock, flags);
4821 cas_mif_poll(cp, 0);
4822 data->val_out = cas_phy_read(cp, data->reg_num & 0x1f);
4823 cas_mif_poll(cp, 1);
4824 spin_unlock_irqrestore(&cp->lock, flags);
4825 rc = 0;
4826 break;
4827
4828 case SIOCSMIIREG: /* Write MII PHY register. */
4829 if (!capable(CAP_NET_ADMIN)) {
4830 rc = -EPERM;
4831 break;
4832 }
4833 spin_lock_irqsave(&cp->lock, flags);
4834 cas_mif_poll(cp, 0);
4835 rc = cas_phy_write(cp, data->reg_num & 0x1f, data->val_in);
4836 cas_mif_poll(cp, 1);
4837 spin_unlock_irqrestore(&cp->lock, flags);
4838 break;
4839 default:
4840 break;
4841 };
4842
4843 up(&cp->pm_sem);
4844 return rc;
4845}
4846
4847static int __devinit cas_init_one(struct pci_dev *pdev,
4848 const struct pci_device_id *ent)
4849{
4850 static int cas_version_printed = 0;
4851 unsigned long casreg_base, casreg_len;
4852 struct net_device *dev;
4853 struct cas *cp;
4854 int i, err, pci_using_dac;
4855 u16 pci_cmd;
4856 u8 orig_cacheline_size = 0, cas_cacheline_size = 0;
4857
4858 if (cas_version_printed++ == 0)
4859 printk(KERN_INFO "%s", version);
4860
4861 err = pci_enable_device(pdev);
4862 if (err) {
4863 printk(KERN_ERR PFX "Cannot enable PCI device, "
4864 "aborting.\n");
4865 return err;
4866 }
4867
4868 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
4869 printk(KERN_ERR PFX "Cannot find proper PCI device "
4870 "base address, aborting.\n");
4871 err = -ENODEV;
4872 goto err_out_disable_pdev;
4873 }
4874
4875 dev = alloc_etherdev(sizeof(*cp));
4876 if (!dev) {
4877 printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n");
4878 err = -ENOMEM;
4879 goto err_out_disable_pdev;
4880 }
4881 SET_MODULE_OWNER(dev);
4882 SET_NETDEV_DEV(dev, &pdev->dev);
4883
4884 err = pci_request_regions(pdev, dev->name);
4885 if (err) {
4886 printk(KERN_ERR PFX "Cannot obtain PCI resources, "
4887 "aborting.\n");
4888 goto err_out_free_netdev;
4889 }
4890 pci_set_master(pdev);
4891
4892 /* we must always turn on parity response or else parity
4893 * doesn't get generated properly. disable SERR/PERR as well.
4894 * in addition, we want to turn MWI on.
4895 */
4896 pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd);
4897 pci_cmd &= ~PCI_COMMAND_SERR;
4898 pci_cmd |= PCI_COMMAND_PARITY;
4899 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
4900 pci_set_mwi(pdev);
4901 /*
4902 * On some architectures, the default cache line size set
4903 * by pci_set_mwi reduces perforamnce. We have to increase
4904 * it for this case. To start, we'll print some configuration
4905 * data.
4906 */
4907#if 1
4908 pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE,
4909 &orig_cacheline_size);
4910 if (orig_cacheline_size < CAS_PREF_CACHELINE_SIZE) {
4911 cas_cacheline_size =
4912 (CAS_PREF_CACHELINE_SIZE < SMP_CACHE_BYTES) ?
4913 CAS_PREF_CACHELINE_SIZE : SMP_CACHE_BYTES;
4914 if (pci_write_config_byte(pdev,
4915 PCI_CACHE_LINE_SIZE,
4916 cas_cacheline_size)) {
4917 printk(KERN_ERR PFX "Could not set PCI cache "
4918 "line size\n");
4919 goto err_write_cacheline;
4920 }
4921 }
4922#endif
4923
4924
4925 /* Configure DMA attributes. */
4926 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
4927 pci_using_dac = 1;
4928 err = pci_set_consistent_dma_mask(pdev,
4929 DMA_64BIT_MASK);
4930 if (err < 0) {
4931 printk(KERN_ERR PFX "Unable to obtain 64-bit DMA "
4932 "for consistent allocations\n");
4933 goto err_out_free_res;
4934 }
4935
4936 } else {
4937 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
4938 if (err) {
4939 printk(KERN_ERR PFX "No usable DMA configuration, "
4940 "aborting.\n");
4941 goto err_out_free_res;
4942 }
4943 pci_using_dac = 0;
4944 }
4945
4946 casreg_base = pci_resource_start(pdev, 0);
4947 casreg_len = pci_resource_len(pdev, 0);
4948
4949 cp = netdev_priv(dev);
4950 cp->pdev = pdev;
4951#if 1
4952 /* A value of 0 indicates we never explicitly set it */
4953 cp->orig_cacheline_size = cas_cacheline_size ? orig_cacheline_size: 0;
4954#endif
4955 cp->dev = dev;
4956 cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE :
4957 cassini_debug;
4958
4959 cp->link_transition = LINK_TRANSITION_UNKNOWN;
4960 cp->link_transition_jiffies_valid = 0;
4961
4962 spin_lock_init(&cp->lock);
4963 spin_lock_init(&cp->rx_inuse_lock);
4964 spin_lock_init(&cp->rx_spare_lock);
4965 for (i = 0; i < N_TX_RINGS; i++) {
4966 spin_lock_init(&cp->stat_lock[i]);
4967 spin_lock_init(&cp->tx_lock[i]);
4968 }
4969 spin_lock_init(&cp->stat_lock[N_TX_RINGS]);
4970 init_MUTEX(&cp->pm_sem);
4971
4972 init_timer(&cp->link_timer);
4973 cp->link_timer.function = cas_link_timer;
4974 cp->link_timer.data = (unsigned long) cp;
4975
4976#if 1
4977 /* Just in case the implementation of atomic operations
4978 * change so that an explicit initialization is necessary.
4979 */
4980 atomic_set(&cp->reset_task_pending, 0);
4981 atomic_set(&cp->reset_task_pending_all, 0);
4982 atomic_set(&cp->reset_task_pending_spare, 0);
4983 atomic_set(&cp->reset_task_pending_mtu, 0);
4984#endif
4985 INIT_WORK(&cp->reset_task, cas_reset_task, cp);
4986
4987 /* Default link parameters */
4988 if (link_mode >= 0 && link_mode <= 6)
4989 cp->link_cntl = link_modes[link_mode];
4990 else
4991 cp->link_cntl = BMCR_ANENABLE;
4992 cp->lstate = link_down;
4993 cp->link_transition = LINK_TRANSITION_LINK_DOWN;
4994 netif_carrier_off(cp->dev);
4995 cp->timer_ticks = 0;
4996
4997 /* give us access to cassini registers */
4998 cp->regs = ioremap(casreg_base, casreg_len);
4999 if (cp->regs == 0UL) {
5000 printk(KERN_ERR PFX "Cannot map device registers, "
5001 "aborting.\n");
5002 goto err_out_free_res;
5003 }
5004 cp->casreg_len = casreg_len;
5005
5006 pci_save_state(pdev);
5007 cas_check_pci_invariants(cp);
5008 cas_hard_reset(cp);
5009 cas_reset(cp, 0);
5010 if (cas_check_invariants(cp))
5011 goto err_out_iounmap;
5012
5013 cp->init_block = (struct cas_init_block *)
5014 pci_alloc_consistent(pdev, sizeof(struct cas_init_block),
5015 &cp->block_dvma);
5016 if (!cp->init_block) {
5017 printk(KERN_ERR PFX "Cannot allocate init block, "
5018 "aborting.\n");
5019 goto err_out_iounmap;
5020 }
5021
5022 for (i = 0; i < N_TX_RINGS; i++)
5023 cp->init_txds[i] = cp->init_block->txds[i];
5024
5025 for (i = 0; i < N_RX_DESC_RINGS; i++)
5026 cp->init_rxds[i] = cp->init_block->rxds[i];
5027
5028 for (i = 0; i < N_RX_COMP_RINGS; i++)
5029 cp->init_rxcs[i] = cp->init_block->rxcs[i];
5030
5031 for (i = 0; i < N_RX_FLOWS; i++)
5032 skb_queue_head_init(&cp->rx_flows[i]);
5033
5034 dev->open = cas_open;
5035 dev->stop = cas_close;
5036 dev->hard_start_xmit = cas_start_xmit;
5037 dev->get_stats = cas_get_stats;
5038 dev->set_multicast_list = cas_set_multicast;
5039 dev->do_ioctl = cas_ioctl;
5040 dev->ethtool_ops = &cas_ethtool_ops;
5041 dev->tx_timeout = cas_tx_timeout;
5042 dev->watchdog_timeo = CAS_TX_TIMEOUT;
5043 dev->change_mtu = cas_change_mtu;
5044#ifdef USE_NAPI
5045 dev->poll = cas_poll;
5046 dev->weight = 64;
5047#endif
5048#ifdef CONFIG_NET_POLL_CONTROLLER
5049 dev->poll_controller = cas_netpoll;
5050#endif
5051 dev->irq = pdev->irq;
5052 dev->dma = 0;
5053
5054 /* Cassini features. */
5055 if ((cp->cas_flags & CAS_FLAG_NO_HW_CSUM) == 0)
5056 dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
5057
5058 if (pci_using_dac)
5059 dev->features |= NETIF_F_HIGHDMA;
5060
5061 if (register_netdev(dev)) {
5062 printk(KERN_ERR PFX "Cannot register net device, "
5063 "aborting.\n");
5064 goto err_out_free_consistent;
5065 }
5066
5067 i = readl(cp->regs + REG_BIM_CFG);
5068 printk(KERN_INFO "%s: Sun Cassini%s (%sbit/%sMHz PCI/%s) "
5069 "Ethernet[%d] ", dev->name,
5070 (cp->cas_flags & CAS_FLAG_REG_PLUS) ? "+" : "",
5071 (i & BIM_CFG_32BIT) ? "32" : "64",
5072 (i & BIM_CFG_66MHZ) ? "66" : "33",
5073 (cp->phy_type == CAS_PHY_SERDES) ? "Fi" : "Cu", pdev->irq);
5074
5075 for (i = 0; i < 6; i++)
5076 printk("%2.2x%c", dev->dev_addr[i],
5077 i == 5 ? ' ' : ':');
5078 printk("\n");
5079
5080 pci_set_drvdata(pdev, dev);
5081 cp->hw_running = 1;
5082 cas_entropy_reset(cp);
5083 cas_phy_init(cp);
5084 cas_begin_auto_negotiation(cp, NULL);
5085 return 0;
5086
5087err_out_free_consistent:
5088 pci_free_consistent(pdev, sizeof(struct cas_init_block),
5089 cp->init_block, cp->block_dvma);
5090
5091err_out_iounmap:
5092 down(&cp->pm_sem);
5093 if (cp->hw_running)
5094 cas_shutdown(cp);
5095 up(&cp->pm_sem);
5096
5097 iounmap(cp->regs);
5098
5099
5100err_out_free_res:
5101 pci_release_regions(pdev);
5102
5103err_write_cacheline:
5104 /* Try to restore it in case the error occured after we
5105 * set it.
5106 */
5107 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, orig_cacheline_size);
5108
5109err_out_free_netdev:
5110 free_netdev(dev);
5111
5112err_out_disable_pdev:
5113 pci_disable_device(pdev);
5114 pci_set_drvdata(pdev, NULL);
5115 return -ENODEV;
5116}
5117
5118static void __devexit cas_remove_one(struct pci_dev *pdev)
5119{
5120 struct net_device *dev = pci_get_drvdata(pdev);
5121 struct cas *cp;
5122 if (!dev)
5123 return;
5124
5125 cp = netdev_priv(dev);
5126 unregister_netdev(dev);
5127
5128 down(&cp->pm_sem);
5129 flush_scheduled_work();
5130 if (cp->hw_running)
5131 cas_shutdown(cp);
5132 up(&cp->pm_sem);
5133
5134#if 1
5135 if (cp->orig_cacheline_size) {
5136 /* Restore the cache line size if we had modified
5137 * it.
5138 */
5139 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE,
5140 cp->orig_cacheline_size);
5141 }
5142#endif
5143 pci_free_consistent(pdev, sizeof(struct cas_init_block),
5144 cp->init_block, cp->block_dvma);
5145 iounmap(cp->regs);
5146 free_netdev(dev);
5147 pci_release_regions(pdev);
5148 pci_disable_device(pdev);
5149 pci_set_drvdata(pdev, NULL);
5150}
5151
5152#ifdef CONFIG_PM
5153static int cas_suspend(struct pci_dev *pdev, pm_message_t state)
5154{
5155 struct net_device *dev = pci_get_drvdata(pdev);
5156 struct cas *cp = netdev_priv(dev);
5157 unsigned long flags;
5158
5159 /* We hold the PM semaphore during entire driver
5160 * sleep time
5161 */
5162 down(&cp->pm_sem);
5163
5164 /* If the driver is opened, we stop the DMA */
5165 if (cp->opened) {
5166 netif_device_detach(dev);
5167
5168 cas_lock_all_save(cp, flags);
5169
5170 /* We can set the second arg of cas_reset to 0
5171 * because on resume, we'll call cas_init_hw with
5172 * its second arg set so that autonegotiation is
5173 * restarted.
5174 */
5175 cas_reset(cp, 0);
5176 cas_clean_rings(cp);
5177 cas_unlock_all_restore(cp, flags);
5178 }
5179
5180 if (cp->hw_running)
5181 cas_shutdown(cp);
5182
5183 return 0;
5184}
5185
5186static int cas_resume(struct pci_dev *pdev)
5187{
5188 struct net_device *dev = pci_get_drvdata(pdev);
5189 struct cas *cp = netdev_priv(dev);
5190
5191 printk(KERN_INFO "%s: resuming\n", dev->name);
5192
5193 cas_hard_reset(cp);
5194 if (cp->opened) {
5195 unsigned long flags;
5196 cas_lock_all_save(cp, flags);
5197 cas_reset(cp, 0);
5198 cp->hw_running = 1;
5199 cas_clean_rings(cp);
5200 cas_init_hw(cp, 1);
5201 cas_unlock_all_restore(cp, flags);
5202
5203 netif_device_attach(dev);
5204 }
5205 up(&cp->pm_sem);
5206 return 0;
5207}
5208#endif /* CONFIG_PM */
5209
5210static struct pci_driver cas_driver = {
5211 .name = DRV_MODULE_NAME,
5212 .id_table = cas_pci_tbl,
5213 .probe = cas_init_one,
5214 .remove = __devexit_p(cas_remove_one),
5215#ifdef CONFIG_PM
5216 .suspend = cas_suspend,
5217 .resume = cas_resume
5218#endif
5219};
5220
5221static int __init cas_init(void)
5222{
5223 if (linkdown_timeout > 0)
5224 link_transition_timeout = linkdown_timeout * HZ;
5225 else
5226 link_transition_timeout = 0;
5227
5228 return pci_module_init(&cas_driver);
5229}
5230
5231static void __exit cas_cleanup(void)
5232{
5233 pci_unregister_driver(&cas_driver);
5234}
5235
5236module_init(cas_init);
5237module_exit(cas_cleanup);
diff --git a/drivers/net/cassini.h b/drivers/net/cassini.h
new file mode 100644
index 000000000000..88063ef16cf6
--- /dev/null
+++ b/drivers/net/cassini.h
@@ -0,0 +1,4425 @@
1/* $Id: cassini.h,v 1.16 2004/08/17 21:15:16 zaumen Exp $
2 * cassini.h: Definitions for Sun Microsystems Cassini(+) ethernet driver.
3 *
4 * Copyright (C) 2004 Sun Microsystems Inc.
5 * Copyright (c) 2003 Adrian Sun (asun@darksunrising.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 *
22 * vendor id: 0x108E (Sun Microsystems, Inc.)
23 * device id: 0xabba (Cassini)
24 * revision ids: 0x01 = Cassini
25 * 0x02 = Cassini rev 2
26 * 0x10 = Cassini+
27 * 0x11 = Cassini+ 0.2u
28 *
29 * vendor id: 0x100b (National Semiconductor)
30 * device id: 0x0035 (DP83065/Saturn)
31 * revision ids: 0x30 = Saturn B2
32 *
33 * rings are all offset from 0.
34 *
35 * there are two clock domains:
36 * PCI: 33/66MHz clock
37 * chip: 125MHz clock
38 */
39
40#ifndef _CASSINI_H
41#define _CASSINI_H
42
43/* cassini register map: 2M memory mapped in 32-bit memory space accessible as
44 * 32-bit words. there is no i/o port access. REG_ addresses are
45 * shared between cassini and cassini+. REG_PLUS_ addresses only
46 * appear in cassini+. REG_MINUS_ addresses only appear in cassini.
47 */
48#define CAS_ID_REV2 0x02
49#define CAS_ID_REVPLUS 0x10
50#define CAS_ID_REVPLUS02u 0x11
51#define CAS_ID_REVSATURNB2 0x30
52
53/** global resources **/
54
55/* this register sets the weights for the weighted round robin arbiter. e.g.,
56 * if rx weight == 1 and tx weight == 0, rx == 2x tx transfer credit
57 * for its next turn to access the pci bus.
58 * map: 0x0 = x1, 0x1 = x2, 0x2 = x4, 0x3 = x8
59 * DEFAULT: 0x0, SIZE: 5 bits
60 */
61#define REG_CAWR 0x0004 /* core arbitration weight */
62#define CAWR_RX_DMA_WEIGHT_SHIFT 0
63#define CAWR_RX_DMA_WEIGHT_MASK 0x03 /* [0:1] */
64#define CAWR_TX_DMA_WEIGHT_SHIFT 2
65#define CAWR_TX_DMA_WEIGHT_MASK 0x0C /* [3:2] */
66#define CAWR_RR_DIS 0x10 /* [4] */
67
68/* if enabled, BIM can send bursts across PCI bus > cacheline size. burst
69 * sizes determined by length of packet or descriptor transfer and the
70 * max length allowed by the target.
71 * DEFAULT: 0x0, SIZE: 1 bit
72 */
73#define REG_INF_BURST 0x0008 /* infinite burst enable reg */
74#define INF_BURST_EN 0x1 /* enable */
75
76/* top level interrupts [0-9] are auto-cleared to 0 when the status
77 * register is read. second level interrupts [13 - 18] are cleared at
78 * the source. tx completion register 3 is replicated in [19 - 31]
79 * DEFAULT: 0x00000000, SIZE: 29 bits
80 */
81#define REG_INTR_STATUS 0x000C /* interrupt status register */
82#define INTR_TX_INTME 0x00000001 /* frame w/ INT ME desc bit set
83 xferred from host queue to
84 TX FIFO */
85#define INTR_TX_ALL 0x00000002 /* all xmit frames xferred into
86 TX FIFO. i.e.,
87 TX Kick == TX complete. if
88 PACED_MODE set, then TX FIFO
89 also empty */
90#define INTR_TX_DONE 0x00000004 /* any frame xferred into tx
91 FIFO */
92#define INTR_TX_TAG_ERROR 0x00000008 /* TX FIFO tag framing
93 corrupted. FATAL ERROR */
94#define INTR_RX_DONE 0x00000010 /* at least 1 frame xferred
95 from RX FIFO to host mem.
96 RX completion reg updated.
97 may be delayed by recv
98 intr blanking. */
99#define INTR_RX_BUF_UNAVAIL 0x00000020 /* no more receive buffers.
100 RX Kick == RX complete */
101#define INTR_RX_TAG_ERROR 0x00000040 /* RX FIFO tag framing
102 corrupted. FATAL ERROR */
103#define INTR_RX_COMP_FULL 0x00000080 /* no more room in completion
104 ring to post descriptors.
105 RX complete head incr to
106 almost reach RX complete
107 tail */
108#define INTR_RX_BUF_AE 0x00000100 /* less than the
109 programmable threshold #
110 of free descr avail for
111 hw use */
112#define INTR_RX_COMP_AF 0x00000200 /* less than the
113 programmable threshold #
114 of descr spaces for hw
115 use in completion descr
116 ring */
117#define INTR_RX_LEN_MISMATCH 0x00000400 /* len field from MAC !=
118 len of non-reassembly pkt
119 from fifo during DMA or
120 header parser provides TCP
121 header and payload size >
122 MAC packet size.
123 FATAL ERROR */
124#define INTR_SUMMARY 0x00001000 /* summary interrupt bit. this
125 bit will be set if an interrupt
126 generated on the pci bus. useful
127 when driver is polling for
128 interrupts */
129#define INTR_PCS_STATUS 0x00002000 /* PCS interrupt status register */
130#define INTR_TX_MAC_STATUS 0x00004000 /* TX MAC status register has at
131 least 1 unmasked interrupt set */
132#define INTR_RX_MAC_STATUS 0x00008000 /* RX MAC status register has at
133 least 1 unmasked interrupt set */
134#define INTR_MAC_CTRL_STATUS 0x00010000 /* MAC control status register has
135 at least 1 unmasked interrupt
136 set */
137#define INTR_MIF_STATUS 0x00020000 /* MIF status register has at least
138 1 unmasked interrupt set */
139#define INTR_PCI_ERROR_STATUS 0x00040000 /* PCI error status register in the
140 BIF has at least 1 unmasked
141 interrupt set */
142#define INTR_TX_COMP_3_MASK 0xFFF80000 /* mask for TX completion
143 3 reg data */
144#define INTR_TX_COMP_3_SHIFT 19
145#define INTR_ERROR_MASK (INTR_MIF_STATUS | INTR_PCI_ERROR_STATUS | \
146 INTR_PCS_STATUS | INTR_RX_LEN_MISMATCH | \
147 INTR_TX_MAC_STATUS | INTR_RX_MAC_STATUS | \
148 INTR_TX_TAG_ERROR | INTR_RX_TAG_ERROR | \
149 INTR_MAC_CTRL_STATUS)
150
151/* determines which status events will cause an interrupt. layout same
152 * as REG_INTR_STATUS.
153 * DEFAULT: 0xFFFFFFFF, SIZE: 16 bits
154 */
155#define REG_INTR_MASK 0x0010 /* Interrupt mask */
156
157/* top level interrupt bits that are cleared during read of REG_INTR_STATUS_ALIAS.
158 * useful when driver is polling for interrupts. layout same as REG_INTR_MASK.
159 * DEFAULT: 0x00000000, SIZE: 12 bits
160 */
161#define REG_ALIAS_CLEAR 0x0014 /* alias clear mask
162 (used w/ status alias) */
163/* same as REG_INTR_STATUS except that only bits cleared are those selected by
164 * REG_ALIAS_CLEAR
165 * DEFAULT: 0x00000000, SIZE: 29 bits
166 */
167#define REG_INTR_STATUS_ALIAS 0x001C /* interrupt status alias
168 (selective clear) */
169
170/* DEFAULT: 0x0, SIZE: 3 bits */
171#define REG_PCI_ERR_STATUS 0x1000 /* PCI error status */
172#define PCI_ERR_BADACK 0x01 /* reserved in Cassini+.
173 set if no ACK64# during ABS64 cycle
174 in Cassini. */
175#define PCI_ERR_DTRTO 0x02 /* delayed xaction timeout. set if
176 no read retry after 2^15 clocks */
177#define PCI_ERR_OTHER 0x04 /* other PCI errors */
178#define PCI_ERR_BIM_DMA_WRITE 0x08 /* BIM received 0 count DMA write req.
179 unused in Cassini. */
180#define PCI_ERR_BIM_DMA_READ 0x10 /* BIM received 0 count DMA read req.
181 unused in Cassini. */
182#define PCI_ERR_BIM_DMA_TIMEOUT 0x20 /* BIM received 255 retries during
183 DMA. unused in cassini. */
184
185/* mask for PCI status events that will set PCI_ERR_STATUS. if cleared, event
186 * causes an interrupt to be generated.
187 * DEFAULT: 0x7, SIZE: 3 bits
188 */
189#define REG_PCI_ERR_STATUS_MASK 0x1004 /* PCI Error status mask */
190
191/* used to configure PCI related parameters that are not in PCI config space.
192 * DEFAULT: 0bxx000, SIZE: 5 bits
193 */
194#define REG_BIM_CFG 0x1008 /* BIM Configuration */
195#define BIM_CFG_RESERVED0 0x001 /* reserved */
196#define BIM_CFG_RESERVED1 0x002 /* reserved */
197#define BIM_CFG_64BIT_DISABLE 0x004 /* disable 64-bit mode */
198#define BIM_CFG_66MHZ 0x008 /* (ro) 1 = 66MHz, 0 = < 66MHz */
199#define BIM_CFG_32BIT 0x010 /* (ro) 1 = 32-bit slot, 0 = 64-bit */
200#define BIM_CFG_DPAR_INTR_ENABLE 0x020 /* detected parity err enable */
201#define BIM_CFG_RMA_INTR_ENABLE 0x040 /* master abort intr enable */
202#define BIM_CFG_RTA_INTR_ENABLE 0x080 /* target abort intr enable */
203#define BIM_CFG_RESERVED2 0x100 /* reserved */
204#define BIM_CFG_BIM_DISABLE 0x200 /* stop BIM DMA. use before global
205 reset. reserved in Cassini. */
206#define BIM_CFG_BIM_STATUS 0x400 /* (ro) 1 = BIM DMA suspended.
207 reserved in Cassini. */
208#define BIM_CFG_PERROR_BLOCK 0x800 /* block PERR# to pci bus. def: 0.
209 reserved in Cassini. */
210
211/* DEFAULT: 0x00000000, SIZE: 32 bits */
212#define REG_BIM_DIAG 0x100C /* BIM Diagnostic */
213#define BIM_DIAG_MSTR_SM_MASK 0x3FFFFF00 /* PCI master controller state
214 machine bits [21:0] */
215#define BIM_DIAG_BRST_SM_MASK 0x7F /* PCI burst controller state
216 machine bits [6:0] */
217
218/* writing to SW_RESET_TX and SW_RESET_RX will issue a global
219 * reset. poll until TX and RX read back as 0's for completion.
220 */
221#define REG_SW_RESET 0x1010 /* Software reset */
222#define SW_RESET_TX 0x00000001 /* reset TX DMA engine. poll until
223 cleared to 0. */
224#define SW_RESET_RX 0x00000002 /* reset RX DMA engine. poll until
225 cleared to 0. */
226#define SW_RESET_RSTOUT 0x00000004 /* force RSTOUT# pin active (low).
227 resets PHY and anything else
228 connected to RSTOUT#. RSTOUT#
229 is also activated by local PCI
230 reset when hot-swap is being
231 done. */
232#define SW_RESET_BLOCK_PCS_SLINK 0x00000008 /* if a global reset is done with
233 this bit set, PCS and SLINK
234 modules won't be reset.
235 i.e., link won't drop. */
236#define SW_RESET_BREQ_SM_MASK 0x00007F00 /* breq state machine [6:0] */
237#define SW_RESET_PCIARB_SM_MASK 0x00070000 /* pci arbitration state bits:
238 0b000: ARB_IDLE1
239 0b001: ARB_IDLE2
240 0b010: ARB_WB_ACK
241 0b011: ARB_WB_WAT
242 0b100: ARB_RB_ACK
243 0b101: ARB_RB_WAT
244 0b110: ARB_RB_END
245 0b111: ARB_WB_END */
246#define SW_RESET_RDPCI_SM_MASK 0x00300000 /* read pci state bits:
247 0b00: RD_PCI_WAT
248 0b01: RD_PCI_RDY
249 0b11: RD_PCI_ACK */
250#define SW_RESET_RDARB_SM_MASK 0x00C00000 /* read arbitration state bits:
251 0b00: AD_IDL_RX
252 0b01: AD_ACK_RX
253 0b10: AD_ACK_TX
254 0b11: AD_IDL_TX */
255#define SW_RESET_WRPCI_SM_MASK 0x06000000 /* write pci state bits
256 0b00: WR_PCI_WAT
257 0b01: WR_PCI_RDY
258 0b11: WR_PCI_ACK */
259#define SW_RESET_WRARB_SM_MASK 0x38000000 /* write arbitration state bits:
260 0b000: ARB_IDLE1
261 0b001: ARB_IDLE2
262 0b010: ARB_TX_ACK
263 0b011: ARB_TX_WAT
264 0b100: ARB_RX_ACK
265 0b110: ARB_RX_WAT */
266
267/* Cassini only. 64-bit register used to check PCI datapath. when read,
268 * value written has both lower and upper 32-bit halves rotated to the right
269 * one bit position. e.g., FFFFFFFF FFFFFFFF -> 7FFFFFFF 7FFFFFFF
270 */
271#define REG_MINUS_BIM_DATAPATH_TEST 0x1018 /* Cassini: BIM datapath test
272 Cassini+: reserved */
273
274/* output enables are provided for each device's chip select and for the rest
275 * of the outputs from cassini to its local bus devices. two sw programmable
276 * bits are connected to general purpus control/status bits.
277 * DEFAULT: 0x7
278 */
279#define REG_BIM_LOCAL_DEV_EN 0x1020 /* BIM local device
280 output EN. default: 0x7 */
281#define BIM_LOCAL_DEV_PAD 0x01 /* address bus, RW signal, and
282 OE signal output enable on the
283 local bus interface. these
284 are shared between both local
285 bus devices. tristate when 0. */
286#define BIM_LOCAL_DEV_PROM 0x02 /* PROM chip select */
287#define BIM_LOCAL_DEV_EXT 0x04 /* secondary local bus device chip
288 select output enable */
289#define BIM_LOCAL_DEV_SOFT_0 0x08 /* sw programmable ctrl bit 0 */
290#define BIM_LOCAL_DEV_SOFT_1 0x10 /* sw programmable ctrl bit 1 */
291#define BIM_LOCAL_DEV_HW_RESET 0x20 /* internal hw reset. Cassini+ only. */
292
293/* access 24 entry BIM read and write buffers. put address in REG_BIM_BUFFER_ADDR
294 * and read/write from/to it REG_BIM_BUFFER_DATA_LOW and _DATA_HI.
295 * _DATA_HI should be the last access of the sequence.
296 * DEFAULT: undefined
297 */
298#define REG_BIM_BUFFER_ADDR 0x1024 /* BIM buffer address. for
299 purposes. */
300#define BIM_BUFFER_ADDR_MASK 0x3F /* index (0 - 23) of buffer */
301#define BIM_BUFFER_WR_SELECT 0x40 /* write buffer access = 1
302 read buffer access = 0 */
303/* DEFAULT: undefined */
304#define REG_BIM_BUFFER_DATA_LOW 0x1028 /* BIM buffer data low */
305#define REG_BIM_BUFFER_DATA_HI 0x102C /* BIM buffer data high */
306
307/* set BIM_RAM_BIST_START to start built-in self test for BIM read buffer.
308 * bit auto-clears when done with status read from _SUMMARY and _PASS bits.
309 */
310#define REG_BIM_RAM_BIST 0x102C /* BIM RAM (read buffer) BIST
311 control/status */
312#define BIM_RAM_BIST_RD_START 0x01 /* start BIST for BIM read buffer */
313#define BIM_RAM_BIST_WR_START 0x02 /* start BIST for BIM write buffer.
314 Cassini only. reserved in
315 Cassini+. */
316#define BIM_RAM_BIST_RD_PASS 0x04 /* summary BIST pass status for read
317 buffer. */
318#define BIM_RAM_BIST_WR_PASS 0x08 /* summary BIST pass status for write
319 buffer. Cassini only. reserved
320 in Cassini+. */
321#define BIM_RAM_BIST_RD_LOW_PASS 0x10 /* read low bank passes BIST */
322#define BIM_RAM_BIST_RD_HI_PASS 0x20 /* read high bank passes BIST */
323#define BIM_RAM_BIST_WR_LOW_PASS 0x40 /* write low bank passes BIST.
324 Cassini only. reserved in
325 Cassini+. */
326#define BIM_RAM_BIST_WR_HI_PASS 0x80 /* write high bank passes BIST.
327 Cassini only. reserved in
328 Cassini+. */
329
330/* ASUN: i'm not sure what this does as it's not in the spec.
331 * DEFAULT: 0xFC
332 */
333#define REG_BIM_DIAG_MUX 0x1030 /* BIM diagnostic probe mux
334 select register */
335
336/* enable probe monitoring mode and select data appearing on the P_A* bus. bit
337 * values for _SEL_HI_MASK and _SEL_LOW_MASK:
338 * 0x0: internal probe[7:0] (pci arb state, wtc empty w, wtc full w, wtc empty w,
339 * wtc empty r, post pci)
340 * 0x1: internal probe[15:8] (pci wbuf comp, pci wpkt comp, pci rbuf comp,
341 * pci rpkt comp, txdma wr req, txdma wr ack,
342 * txdma wr rdy, txdma wr xfr done)
343 * 0x2: internal probe[23:16] (txdma rd req, txdma rd ack, txdma rd rdy, rxdma rd,
344 * rd arb state, rd pci state)
345 * 0x3: internal probe[31:24] (rxdma req, rxdma ack, rxdma rdy, wrarb state,
346 * wrpci state)
347 * 0x4: pci io probe[7:0] 0x5: pci io probe[15:8]
348 * 0x6: pci io probe[23:16] 0x7: pci io probe[31:24]
349 * 0x8: pci io probe[39:32] 0x9: pci io probe[47:40]
350 * 0xa: pci io probe[55:48] 0xb: pci io probe[63:56]
351 * the following are not available in Cassini:
352 * 0xc: rx probe[7:0] 0xd: tx probe[7:0]
353 * 0xe: hp probe[7:0] 0xf: mac probe[7:0]
354 */
355#define REG_PLUS_PROBE_MUX_SELECT 0x1034 /* Cassini+: PROBE MUX SELECT */
356#define PROBE_MUX_EN 0x80000000 /* allow probe signals to be
357 driven on local bus P_A[15:0]
358 for debugging */
359#define PROBE_MUX_SUB_MUX_MASK 0x0000FF00 /* select sub module probe signals:
360 0x03 = mac[1:0]
361 0x0C = rx[1:0]
362 0x30 = tx[1:0]
363 0xC0 = hp[1:0] */
364#define PROBE_MUX_SEL_HI_MASK 0x000000F0 /* select which module to appear
365 on P_A[15:8]. see above for
366 values. */
367#define PROBE_MUX_SEL_LOW_MASK 0x0000000F /* select which module to appear
368 on P_A[7:0]. see above for
369 values. */
370
371/* values mean the same thing as REG_INTR_MASK excep that it's for INTB.
372 DEFAULT: 0x1F */
373#define REG_PLUS_INTR_MASK_1 0x1038 /* Cassini+: interrupt mask
374 register 2 for INTB */
375#define REG_PLUS_INTRN_MASK(x) (REG_PLUS_INTR_MASK_1 + ((x) - 1)*16)
376/* bits correspond to both _MASK and _STATUS registers. _ALT corresponds to
377 * all of the alternate (2-4) INTR registers while _1 corresponds to only
378 * _MASK_1 and _STATUS_1 registers.
379 * DEFAULT: 0x7 for MASK registers, 0x0 for ALIAS_CLEAR registers
380 */
381#define INTR_RX_DONE_ALT 0x01
382#define INTR_RX_COMP_FULL_ALT 0x02
383#define INTR_RX_COMP_AF_ALT 0x04
384#define INTR_RX_BUF_UNAVAIL_1 0x08
385#define INTR_RX_BUF_AE_1 0x10 /* almost empty */
386#define INTRN_MASK_RX_EN 0x80
387#define INTRN_MASK_CLEAR_ALL (INTR_RX_DONE_ALT | \
388 INTR_RX_COMP_FULL_ALT | \
389 INTR_RX_COMP_AF_ALT | \
390 INTR_RX_BUF_UNAVAIL_1 | \
391 INTR_RX_BUF_AE_1)
392#define REG_PLUS_INTR_STATUS_1 0x103C /* Cassini+: interrupt status
393 register 2 for INTB. default: 0x1F */
394#define REG_PLUS_INTRN_STATUS(x) (REG_PLUS_INTR_STATUS_1 + ((x) - 1)*16)
395#define INTR_STATUS_ALT_INTX_EN 0x80 /* generate INTX when one of the
396 flags are set. enables desc ring. */
397
398#define REG_PLUS_ALIAS_CLEAR_1 0x1040 /* Cassini+: alias clear mask
399 register 2 for INTB */
400#define REG_PLUS_ALIASN_CLEAR(x) (REG_PLUS_ALIAS_CLEAR_1 + ((x) - 1)*16)
401
402#define REG_PLUS_INTR_STATUS_ALIAS_1 0x1044 /* Cassini+: interrupt status
403 register alias 2 for INTB */
404#define REG_PLUS_INTRN_STATUS_ALIAS(x) (REG_PLUS_INTR_STATUS_ALIAS_1 + ((x) - 1)*16)
405
406#define REG_SATURN_PCFG 0x106c /* pin configuration register for
407 integrated macphy */
408
409#define SATURN_PCFG_TLA 0x00000001 /* 1 = phy actled */
410#define SATURN_PCFG_FLA 0x00000002 /* 1 = phy link10led */
411#define SATURN_PCFG_CLA 0x00000004 /* 1 = phy link100led */
412#define SATURN_PCFG_LLA 0x00000008 /* 1 = phy link1000led */
413#define SATURN_PCFG_RLA 0x00000010 /* 1 = phy duplexled */
414#define SATURN_PCFG_PDS 0x00000020 /* phy debug mode.
415 0 = normal */
416#define SATURN_PCFG_MTP 0x00000080 /* test point select */
417#define SATURN_PCFG_GMO 0x00000100 /* GMII observe. 1 =
418 GMII on SERDES pins for
419 monitoring. */
420#define SATURN_PCFG_FSI 0x00000200 /* 1 = freeze serdes/gmii. all
421 pins configed as outputs.
422 for power saving when using
423 internal phy. */
424#define SATURN_PCFG_LAD 0x00000800 /* 0 = mac core led ctrl
425 polarity from strapping
426 value.
427 1 = mac core led ctrl
428 polarity active low. */
429
430
431/** transmit dma registers **/
432#define MAX_TX_RINGS_SHIFT 2
433#define MAX_TX_RINGS (1 << MAX_TX_RINGS_SHIFT)
434#define MAX_TX_RINGS_MASK (MAX_TX_RINGS - 1)
435
436/* TX configuration.
437 * descr ring sizes size = 32 * (1 << n), n < 9. e.g., 0x8 = 8k. default: 0x8
438 * DEFAULT: 0x3F000001
439 */
440#define REG_TX_CFG 0x2004 /* TX config */
441#define TX_CFG_DMA_EN 0x00000001 /* enable TX DMA. if cleared, DMA
442 will stop after xfer of current
443 buffer has been completed. */
444#define TX_CFG_FIFO_PIO_SEL 0x00000002 /* TX DMA FIFO can be
445 accessed w/ FIFO addr
446 and data registers.
447 TX DMA should be
448 disabled. */
449#define TX_CFG_DESC_RING0_MASK 0x0000003C /* # desc entries in
450 ring 1. */
451#define TX_CFG_DESC_RING0_SHIFT 2
452#define TX_CFG_DESC_RINGN_MASK(a) (TX_CFG_DESC_RING0_MASK << (a)*4)
453#define TX_CFG_DESC_RINGN_SHIFT(a) (TX_CFG_DESC_RING0_SHIFT + (a)*4)
454#define TX_CFG_PACED_MODE 0x00100000 /* TX_ALL only set after
455 TX FIFO becomes empty.
456 if 0, TX_ALL set
457 if descr queue empty. */
458#define TX_CFG_DMA_RDPIPE_DIS 0x01000000 /* always set to 1 */
459#define TX_CFG_COMPWB_Q1 0x02000000 /* completion writeback happens at
460 the end of every packet kicked
461 through Q1. */
462#define TX_CFG_COMPWB_Q2 0x04000000 /* completion writeback happens at
463 the end of every packet kicked
464 through Q2. */
465#define TX_CFG_COMPWB_Q3 0x08000000 /* completion writeback happens at
466 the end of every packet kicked
467 through Q3 */
468#define TX_CFG_COMPWB_Q4 0x10000000 /* completion writeback happens at
469 the end of every packet kicked
470 through Q4 */
471#define TX_CFG_INTR_COMPWB_DIS 0x20000000 /* disable pre-interrupt completion
472 writeback */
473#define TX_CFG_CTX_SEL_MASK 0xC0000000 /* selects tx test port
474 connection
475 0b00: tx mac req,
476 tx mac retry req,
477 tx ack and tx tag.
478 0b01: txdma rd req,
479 txdma rd ack,
480 txdma rd rdy,
481 txdma rd type0
482 0b11: txdma wr req,
483 txdma wr ack,
484 txdma wr rdy,
485 txdma wr xfr done. */
486#define TX_CFG_CTX_SEL_SHIFT 30
487
488/* 11-bit counters that point to next location in FIFO to be loaded/retrieved.
489 * used for diagnostics only.
490 */
491#define REG_TX_FIFO_WRITE_PTR 0x2014 /* TX FIFO write pointer */
492#define REG_TX_FIFO_SHADOW_WRITE_PTR 0x2018 /* TX FIFO shadow write
493 pointer. temp hold reg.
494 diagnostics only. */
495#define REG_TX_FIFO_READ_PTR 0x201C /* TX FIFO read pointer */
496#define REG_TX_FIFO_SHADOW_READ_PTR 0x2020 /* TX FIFO shadow read
497 pointer */
498
499/* (ro) 11-bit up/down counter w/ # of frames currently in TX FIFO */
500#define REG_TX_FIFO_PKT_CNT 0x2024 /* TX FIFO packet counter */
501
502/* current state of all state machines in TX */
503#define REG_TX_SM_1 0x2028 /* TX state machine reg #1 */
504#define TX_SM_1_CHAIN_MASK 0x000003FF /* chaining state machine */
505#define TX_SM_1_CSUM_MASK 0x00000C00 /* checksum state machine */
506#define TX_SM_1_FIFO_LOAD_MASK 0x0003F000 /* FIFO load state machine.
507 = 0x01 when TX disabled. */
508#define TX_SM_1_FIFO_UNLOAD_MASK 0x003C0000 /* FIFO unload state machine */
509#define TX_SM_1_CACHE_MASK 0x03C00000 /* desc. prefetch cache controller
510 state machine */
511#define TX_SM_1_CBQ_ARB_MASK 0xF8000000 /* CBQ arbiter state machine */
512
513#define REG_TX_SM_2 0x202C /* TX state machine reg #2 */
514#define TX_SM_2_COMP_WB_MASK 0x07 /* completion writeback sm */
515#define TX_SM_2_SUB_LOAD_MASK 0x38 /* sub load state machine */
516#define TX_SM_2_KICK_MASK 0xC0 /* kick state machine */
517
518/* 64-bit pointer to the transmit data buffer. only the 50 LSB are incremented
519 * while the upper 23 bits are taken from the TX descriptor
520 */
521#define REG_TX_DATA_PTR_LOW 0x2030 /* TX data pointer low */
522#define REG_TX_DATA_PTR_HI 0x2034 /* TX data pointer high */
523
524/* 13 bit registers written by driver w/ descriptor value that follows
525 * last valid xmit descriptor. kick # and complete # values are used by
526 * the xmit dma engine to control tx descr fetching. if > 1 valid
527 * tx descr is available within the cache line being read, cassini will
528 * internally cache up to 4 of them. 0 on reset. _KICK = rw, _COMP = ro.
529 */
530#define REG_TX_KICK0 0x2038 /* TX kick reg #1 */
531#define REG_TX_KICKN(x) (REG_TX_KICK0 + (x)*4)
532#define REG_TX_COMP0 0x2048 /* TX completion reg #1 */
533#define REG_TX_COMPN(x) (REG_TX_COMP0 + (x)*4)
534
535/* values of TX_COMPLETE_1-4 are written. each completion register
536 * is 2bytes in size and contiguous. 8B allocation w/ 8B alignment.
537 * NOTE: completion reg values are only written back prior to TX_INTME and
538 * TX_ALL interrupts. at all other times, the most up-to-date index values
539 * should be obtained from the REG_TX_COMPLETE_# registers.
540 * here's the layout:
541 * offset from base addr completion # byte
542 * 0 TX_COMPLETE_1_MSB
543 * 1 TX_COMPLETE_1_LSB
544 * 2 TX_COMPLETE_2_MSB
545 * 3 TX_COMPLETE_2_LSB
546 * 4 TX_COMPLETE_3_MSB
547 * 5 TX_COMPLETE_3_LSB
548 * 6 TX_COMPLETE_4_MSB
549 * 7 TX_COMPLETE_4_LSB
550 */
551#define TX_COMPWB_SIZE 8
552#define REG_TX_COMPWB_DB_LOW 0x2058 /* TX completion write back
553 base low */
554#define REG_TX_COMPWB_DB_HI 0x205C /* TX completion write back
555 base high */
556#define TX_COMPWB_MSB_MASK 0x00000000000000FFULL
557#define TX_COMPWB_MSB_SHIFT 0
558#define TX_COMPWB_LSB_MASK 0x000000000000FF00ULL
559#define TX_COMPWB_LSB_SHIFT 8
560#define TX_COMPWB_NEXT(x) ((x) >> 16)
561
562/* 53 MSB used as base address. 11 LSB assumed to be 0. TX desc pointer must
563 * be 2KB-aligned. */
564#define REG_TX_DB0_LOW 0x2060 /* TX descriptor base low #1 */
565#define REG_TX_DB0_HI 0x2064 /* TX descriptor base hi #1 */
566#define REG_TX_DBN_LOW(x) (REG_TX_DB0_LOW + (x)*8)
567#define REG_TX_DBN_HI(x) (REG_TX_DB0_HI + (x)*8)
568
569/* 16-bit registers hold weights for the weighted round-robin of the
570 * four CBQ TX descr rings. weights correspond to # bytes xferred from
571 * host to TXFIFO in a round of WRR arbitration. can be set
572 * dynamically with new weights set upon completion of the current
573 * packet transfer from host memory to TXFIFO. a dummy write to any of
574 * these registers causes a queue1 pre-emption with all historical bw
575 * deficit data reset to 0 (useful when congestion requires a
576 * pre-emption/re-allocation of network bandwidth
577 */
578#define REG_TX_MAXBURST_0 0x2080 /* TX MaxBurst #1 */
579#define REG_TX_MAXBURST_1 0x2084 /* TX MaxBurst #2 */
580#define REG_TX_MAXBURST_2 0x2088 /* TX MaxBurst #3 */
581#define REG_TX_MAXBURST_3 0x208C /* TX MaxBurst #4 */
582
583/* diagnostics access to any TX FIFO location. every access is 65
584 * bits. _DATA_LOW = 32 LSB, _DATA_HI_T1/T0 = 32 MSB. _TAG = tag bit.
585 * writing _DATA_HI_T0 sets tag bit low, writing _DATA_HI_T1 sets tag
586 * bit high. TX_FIFO_PIO_SEL must be set for TX FIFO PIO access. if
587 * TX FIFO data integrity is desired, TX DMA should be
588 * disabled. _DATA_HI_Tx should be the last access of the sequence.
589 */
590#define REG_TX_FIFO_ADDR 0x2104 /* TX FIFO address */
591#define REG_TX_FIFO_TAG 0x2108 /* TX FIFO tag */
592#define REG_TX_FIFO_DATA_LOW 0x210C /* TX FIFO data low */
593#define REG_TX_FIFO_DATA_HI_T1 0x2110 /* TX FIFO data high t1 */
594#define REG_TX_FIFO_DATA_HI_T0 0x2114 /* TX FIFO data high t0 */
595#define REG_TX_FIFO_SIZE 0x2118 /* (ro) TX FIFO size = 0x090 = 9KB */
596
597/* 9-bit register controls BIST of TX FIFO. bit set indicates that the BIST
598 * passed for the specified memory
599 */
600#define REG_TX_RAMBIST 0x211C /* TX RAMBIST control/status */
601#define TX_RAMBIST_STATE 0x01C0 /* progress state of RAMBIST
602 controller state machine */
603#define TX_RAMBIST_RAM33A_PASS 0x0020 /* RAM33A passed */
604#define TX_RAMBIST_RAM32A_PASS 0x0010 /* RAM32A passed */
605#define TX_RAMBIST_RAM33B_PASS 0x0008 /* RAM33B passed */
606#define TX_RAMBIST_RAM32B_PASS 0x0004 /* RAM32B passed */
607#define TX_RAMBIST_SUMMARY 0x0002 /* all RAM passed */
608#define TX_RAMBIST_START 0x0001 /* write 1 to start BIST. self
609 clears on completion. */
610
611/** receive dma registers **/
612#define MAX_RX_DESC_RINGS 2
613#define MAX_RX_COMP_RINGS 4
614
615/* receive DMA channel configuration. default: 0x80910
616 * free ring size = (1 << n)*32 -> [32 - 8k]
617 * completion ring size = (1 << n)*128 -> [128 - 32k], n < 9
618 * DEFAULT: 0x80910
619 */
620#define REG_RX_CFG 0x4000 /* RX config */
621#define RX_CFG_DMA_EN 0x00000001 /* enable RX DMA. 0 stops
622 channel as soon as current
623 frame xfer has completed.
624 driver should disable MAC
625 for 200ms before disabling
626 RX */
627#define RX_CFG_DESC_RING_MASK 0x0000001E /* # desc entries in RX
628 free desc ring.
629 def: 0x8 = 8k */
630#define RX_CFG_DESC_RING_SHIFT 1
631#define RX_CFG_COMP_RING_MASK 0x000001E0 /* # desc entries in RX complete
632 ring. def: 0x8 = 32k */
633#define RX_CFG_COMP_RING_SHIFT 5
634#define RX_CFG_BATCH_DIS 0x00000200 /* disable receive desc
635 batching. def: 0x0 =
636 enabled */
637#define RX_CFG_SWIVEL_MASK 0x00001C00 /* byte offset of the 1st
638 data byte of the packet
639 w/in 8 byte boundares.
640 this swivels the data
641 DMA'ed to header
642 buffers, jumbo buffers
643 when header split is not
644 requested and MTU sized
645 buffers. def: 0x2 */
646#define RX_CFG_SWIVEL_SHIFT 10
647
648/* cassini+ only */
649#define RX_CFG_DESC_RING1_MASK 0x000F0000 /* # of desc entries in
650 RX free desc ring 2.
651 def: 0x8 = 8k */
652#define RX_CFG_DESC_RING1_SHIFT 16
653
654
655/* the page size register allows cassini chips to do the following with
656 * received data:
657 * [--------------------------------------------------------------] page
658 * [off][buf1][pad][off][buf2][pad][off][buf3][pad][off][buf4][pad]
659 * |--------------| = PAGE_SIZE_BUFFER_STRIDE
660 * page = PAGE_SIZE
661 * offset = PAGE_SIZE_MTU_OFF
662 * for the above example, MTU_BUFFER_COUNT = 4.
663 * NOTE: as is apparent, you need to ensure that the following holds:
664 * MTU_BUFFER_COUNT <= PAGE_SIZE/PAGE_SIZE_BUFFER_STRIDE
665 * DEFAULT: 0x48002002 (8k pages)
666 */
667#define REG_RX_PAGE_SIZE 0x4004 /* RX page size */
668#define RX_PAGE_SIZE_MASK 0x00000003 /* size of pages pointed to
669 by receive descriptors.
670 if jumbo buffers are
671 supported the page size
672 should not be < 8k.
673 0b00 = 2k, 0b01 = 4k
674 0b10 = 8k, 0b11 = 16k
675 DEFAULT: 8k */
676#define RX_PAGE_SIZE_SHIFT 0
677#define RX_PAGE_SIZE_MTU_COUNT_MASK 0x00007800 /* # of MTU buffers the hw
678 packs into a page.
679 DEFAULT: 4 */
680#define RX_PAGE_SIZE_MTU_COUNT_SHIFT 11
681#define RX_PAGE_SIZE_MTU_STRIDE_MASK 0x18000000 /* # of bytes that separate
682 each MTU buffer +
683 offset from each
684 other.
685 0b00 = 1k, 0b01 = 2k
686 0b10 = 4k, 0b11 = 8k
687 DEFAULT: 0x1 */
688#define RX_PAGE_SIZE_MTU_STRIDE_SHIFT 27
689#define RX_PAGE_SIZE_MTU_OFF_MASK 0xC0000000 /* offset in each page that
690 hw writes the MTU buffer
691 into.
692 0b00 = 0,
693 0b01 = 64 bytes
694 0b10 = 96, 0b11 = 128
695 DEFAULT: 0x1 */
696#define RX_PAGE_SIZE_MTU_OFF_SHIFT 30
697
698/* 11-bit counter points to next location in RX FIFO to be loaded/read.
699 * shadow write pointers enable retries in case of early receive aborts.
700 * DEFAULT: 0x0. generated on 64-bit boundaries.
701 */
702#define REG_RX_FIFO_WRITE_PTR 0x4008 /* RX FIFO write pointer */
703#define REG_RX_FIFO_READ_PTR 0x400C /* RX FIFO read pointer */
704#define REG_RX_IPP_FIFO_SHADOW_WRITE_PTR 0x4010 /* RX IPP FIFO shadow write
705 pointer */
706#define REG_RX_IPP_FIFO_SHADOW_READ_PTR 0x4014 /* RX IPP FIFO shadow read
707 pointer */
708#define REG_RX_IPP_FIFO_READ_PTR 0x400C /* RX IPP FIFO read
709 pointer. (8-bit counter) */
710
711/* current state of RX DMA state engines + other info
712 * DEFAULT: 0x0
713 */
714#define REG_RX_DEBUG 0x401C /* RX debug */
715#define RX_DEBUG_LOAD_STATE_MASK 0x0000000F /* load state machine w/ MAC:
716 0x0 = idle, 0x1 = load_bop
717 0x2 = load 1, 0x3 = load 2
718 0x4 = load 3, 0x5 = load 4
719 0x6 = last detect
720 0x7 = wait req
721 0x8 = wait req statuss 1st
722 0x9 = load st
723 0xa = bubble mac
724 0xb = error */
725#define RX_DEBUG_LM_STATE_MASK 0x00000070 /* load state machine w/ HP and
726 RX FIFO:
727 0x0 = idle, 0x1 = hp xfr
728 0x2 = wait hp ready
729 0x3 = wait flow code
730 0x4 = fifo xfer
731 0x5 = make status
732 0x6 = csum ready
733 0x7 = error */
734#define RX_DEBUG_FC_STATE_MASK 0x000000180 /* flow control state machine
735 w/ MAC:
736 0x0 = idle
737 0x1 = wait xoff ack
738 0x2 = wait xon
739 0x3 = wait xon ack */
740#define RX_DEBUG_DATA_STATE_MASK 0x000001E00 /* unload data state machine
741 states:
742 0x0 = idle data
743 0x1 = header begin
744 0x2 = xfer header
745 0x3 = xfer header ld
746 0x4 = mtu begin
747 0x5 = xfer mtu
748 0x6 = xfer mtu ld
749 0x7 = jumbo begin
750 0x8 = xfer jumbo
751 0x9 = xfer jumbo ld
752 0xa = reas begin
753 0xb = xfer reas
754 0xc = flush tag
755 0xd = xfer reas ld
756 0xe = error
757 0xf = bubble idle */
758#define RX_DEBUG_DESC_STATE_MASK 0x0001E000 /* unload desc state machine
759 states:
760 0x0 = idle desc
761 0x1 = wait ack
762 0x9 = wait ack 2
763 0x2 = fetch desc 1
764 0xa = fetch desc 2
765 0x3 = load ptrs
766 0x4 = wait dma
767 0x5 = wait ack batch
768 0x6 = post batch
769 0x7 = xfr done */
770#define RX_DEBUG_INTR_READ_PTR_MASK 0x30000000 /* interrupt read ptr of the
771 interrupt queue */
772#define RX_DEBUG_INTR_WRITE_PTR_MASK 0xC0000000 /* interrupt write pointer
773 of the interrupt queue */
774
775/* flow control frames are emmitted using two PAUSE thresholds:
776 * XOFF PAUSE uses pause time value pre-programmed in the Send PAUSE MAC reg
777 * XON PAUSE uses a pause time of 0. granularity of threshold is 64bytes.
778 * PAUSE thresholds defined in terms of FIFO occupancy and may be translated
779 * into FIFO vacancy using RX_FIFO_SIZE. setting ON will trigger XON frames
780 * when FIFO reaches 0. OFF threshold should not be > size of RX FIFO. max
781 * value is is 0x6F.
782 * DEFAULT: 0x00078
783 */
784#define REG_RX_PAUSE_THRESH 0x4020 /* RX pause thresholds */
785#define RX_PAUSE_THRESH_QUANTUM 64
786#define RX_PAUSE_THRESH_OFF_MASK 0x000001FF /* XOFF PAUSE emitted when
787 RX FIFO occupancy >
788 value*64B */
789#define RX_PAUSE_THRESH_OFF_SHIFT 0
790#define RX_PAUSE_THRESH_ON_MASK 0x001FF000 /* XON PAUSE emitted after
791 emitting XOFF PAUSE when RX
792 FIFO occupancy falls below
793 this value*64B. must be
794 < XOFF threshold. if =
795 RX_FIFO_SIZE< XON frames are
796 never emitted. */
797#define RX_PAUSE_THRESH_ON_SHIFT 12
798
799/* 13-bit register used to control RX desc fetching and intr generation. if 4+
800 * valid RX descriptors are available, Cassini will read 4 at a time.
801 * writing N means that all desc up to *but* excluding N are available. N must
802 * be a multiple of 4 (N % 4 = 0). first desc should be cache-line aligned.
803 * DEFAULT: 0 on reset
804 */
805#define REG_RX_KICK 0x4024 /* RX kick reg */
806
807/* 8KB aligned 64-bit pointer to the base of the RX free/completion rings.
808 * lower 13 bits of the low register are hard-wired to 0.
809 */
810#define REG_RX_DB_LOW 0x4028 /* RX descriptor ring
811 base low */
812#define REG_RX_DB_HI 0x402C /* RX descriptor ring
813 base hi */
814#define REG_RX_CB_LOW 0x4030 /* RX completion ring
815 base low */
816#define REG_RX_CB_HI 0x4034 /* RX completion ring
817 base hi */
818/* 13-bit register indicate desc used by cassini for receive frames. used
819 * for diagnostic purposes.
820 * DEFAULT: 0 on reset
821 */
822#define REG_RX_COMP 0x4038 /* (ro) RX completion */
823
824/* HEAD and TAIL are used to control RX desc posting and interrupt
825 * generation. hw moves the head register to pass ownership to sw. sw
826 * moves the tail register to pass ownership back to hw. to give all
827 * entries to hw, set TAIL = HEAD. if HEAD and TAIL indicate that no
828 * more entries are available, DMA will pause and an interrupt will be
829 * generated to indicate no more entries are available. sw can use
830 * this interrupt to reduce the # of times it must update the
831 * completion tail register.
832 * DEFAULT: 0 on reset
833 */
834#define REG_RX_COMP_HEAD 0x403C /* RX completion head */
835#define REG_RX_COMP_TAIL 0x4040 /* RX completion tail */
836
837/* values used for receive interrupt blanking. loaded each time the ISR is read
838 * DEFAULT: 0x00000000
839 */
840#define REG_RX_BLANK 0x4044 /* RX blanking register
841 for ISR read */
842#define RX_BLANK_INTR_PKT_MASK 0x000001FF /* RX_DONE intr asserted if
843 this many sets of completion
844 writebacks (up to 2 packets)
845 occur since the last time
846 the ISR was read. 0 = no
847 packet blanking */
848#define RX_BLANK_INTR_PKT_SHIFT 0
849#define RX_BLANK_INTR_TIME_MASK 0x3FFFF000 /* RX_DONE interrupt asserted
850 if that many clocks were
851 counted since last time the
852 ISR was read.
853 each count is 512 core
854 clocks (125MHz). 0 = no
855 time blanking */
856#define RX_BLANK_INTR_TIME_SHIFT 12
857
858/* values used for interrupt generation based on threshold values of how
859 * many free desc and completion entries are available for hw use.
860 * DEFAULT: 0x00000000
861 */
862#define REG_RX_AE_THRESH 0x4048 /* RX almost empty
863 thresholds */
864#define RX_AE_THRESH_FREE_MASK 0x00001FFF /* RX_BUF_AE will be
865 generated if # desc
866 avail for hw use <=
867 # */
868#define RX_AE_THRESH_FREE_SHIFT 0
869#define RX_AE_THRESH_COMP_MASK 0x0FFFE000 /* RX_COMP_AE will be
870 generated if # of
871 completion entries
872 avail for hw use <=
873 # */
874#define RX_AE_THRESH_COMP_SHIFT 13
875
876/* probabilities for random early drop (RED) thresholds on a FIFO threshold
877 * basis. probability should increase when the FIFO level increases. control
878 * packets are never dropped and not counted in stats. probability programmed
879 * on a 12.5% granularity. e.g., 0x1 = 1/8 packets dropped.
880 * DEFAULT: 0x00000000
881 */
882#define REG_RX_RED 0x404C /* RX random early detect enable */
883#define RX_RED_4K_6K_FIFO_MASK 0x000000FF /* 4KB < FIFO thresh < 6KB */
884#define RX_RED_6K_8K_FIFO_MASK 0x0000FF00 /* 6KB < FIFO thresh < 8KB */
885#define RX_RED_8K_10K_FIFO_MASK 0x00FF0000 /* 8KB < FIFO thresh < 10KB */
886#define RX_RED_10K_12K_FIFO_MASK 0xFF000000 /* 10KB < FIFO thresh < 12KB */
887
888/* FIFO fullness levels for RX FIFO, RX control FIFO, and RX IPP FIFO.
889 * RX control FIFO = # of packets in RX FIFO.
890 * DEFAULT: 0x0
891 */
892#define REG_RX_FIFO_FULLNESS 0x4050 /* (ro) RX FIFO fullness */
893#define RX_FIFO_FULLNESS_RX_FIFO_MASK 0x3FF80000 /* level w/ 8B granularity */
894#define RX_FIFO_FULLNESS_IPP_FIFO_MASK 0x0007FF00 /* level w/ 8B granularity */
895#define RX_FIFO_FULLNESS_RX_PKT_MASK 0x000000FF /* # packets in RX FIFO */
896#define REG_RX_IPP_PACKET_COUNT 0x4054 /* RX IPP packet counter */
897#define REG_RX_WORK_DMA_PTR_LOW 0x4058 /* RX working DMA ptr low */
898#define REG_RX_WORK_DMA_PTR_HI 0x405C /* RX working DMA ptr
899 high */
900
901/* BIST testing ro RX FIFO, RX control FIFO, and RX IPP FIFO. only RX BIST
902 * START/COMPLETE is writeable. START will clear when the BIST has completed
903 * checking all 17 RAMS.
904 * DEFAULT: 0bxxxx xxxxx xxxx xxxx xxxx x000 0000 0000 00x0
905 */
906#define REG_RX_BIST 0x4060 /* (ro) RX BIST */
907#define RX_BIST_32A_PASS 0x80000000 /* RX FIFO 32A passed */
908#define RX_BIST_33A_PASS 0x40000000 /* RX FIFO 33A passed */
909#define RX_BIST_32B_PASS 0x20000000 /* RX FIFO 32B passed */
910#define RX_BIST_33B_PASS 0x10000000 /* RX FIFO 33B passed */
911#define RX_BIST_32C_PASS 0x08000000 /* RX FIFO 32C passed */
912#define RX_BIST_33C_PASS 0x04000000 /* RX FIFO 33C passed */
913#define RX_BIST_IPP_32A_PASS 0x02000000 /* RX IPP FIFO 33B passed */
914#define RX_BIST_IPP_33A_PASS 0x01000000 /* RX IPP FIFO 33A passed */
915#define RX_BIST_IPP_32B_PASS 0x00800000 /* RX IPP FIFO 32B passed */
916#define RX_BIST_IPP_33B_PASS 0x00400000 /* RX IPP FIFO 33B passed */
917#define RX_BIST_IPP_32C_PASS 0x00200000 /* RX IPP FIFO 32C passed */
918#define RX_BIST_IPP_33C_PASS 0x00100000 /* RX IPP FIFO 33C passed */
919#define RX_BIST_CTRL_32_PASS 0x00800000 /* RX CTRL FIFO 32 passed */
920#define RX_BIST_CTRL_33_PASS 0x00400000 /* RX CTRL FIFO 33 passed */
921#define RX_BIST_REAS_26A_PASS 0x00200000 /* RX Reas 26A passed */
922#define RX_BIST_REAS_26B_PASS 0x00100000 /* RX Reas 26B passed */
923#define RX_BIST_REAS_27_PASS 0x00080000 /* RX Reas 27 passed */
924#define RX_BIST_STATE_MASK 0x00078000 /* BIST state machine */
925#define RX_BIST_SUMMARY 0x00000002 /* when BIST complete,
926 summary pass bit
927 contains AND of BIST
928 results of all 16
929 RAMS */
930#define RX_BIST_START 0x00000001 /* write 1 to start
931 BIST. self clears
932 on completion. */
933
934/* next location in RX CTRL FIFO that will be loaded w/ data from RX IPP/read
935 * from to retrieve packet control info.
936 * DEFAULT: 0
937 */
938#define REG_RX_CTRL_FIFO_WRITE_PTR 0x4064 /* (ro) RX control FIFO
939 write ptr */
940#define REG_RX_CTRL_FIFO_READ_PTR 0x4068 /* (ro) RX control FIFO read
941 ptr */
942
943/* receive interrupt blanking. loaded each time interrupt alias register is
944 * read.
945 * DEFAULT: 0x0
946 */
947#define REG_RX_BLANK_ALIAS_READ 0x406C /* RX blanking register for
948 alias read */
949#define RX_BAR_INTR_PACKET_MASK 0x000001FF /* assert RX_DONE if #
950 completion writebacks
951 > # since last ISR
952 read. 0 = no
953 blanking. up to 2
954 packets per
955 completion wb. */
956#define RX_BAR_INTR_TIME_MASK 0x3FFFF000 /* assert RX_DONE if #
957 clocks > # since last
958 ISR read. each count
959 is 512 core clocks
960 (125MHz). 0 = no
961 blanking. */
962
963/* diagnostic access to RX FIFO. 32 LSB accessed via DATA_LOW. 32 MSB accessed
964 * via DATA_HI_T0 or DATA_HI_T1. TAG reads the tag bit. writing HI_T0
965 * will unset the tag bit while writing HI_T1 will set the tag bit. to reset
966 * to normal operation after diagnostics, write to address location 0x0.
967 * RX_DMA_EN bit must be set to 0x0 for RX FIFO PIO access. DATA_HI should
968 * be the last write access of a write sequence.
969 * DEFAULT: undefined
970 */
971#define REG_RX_FIFO_ADDR 0x4080 /* RX FIFO address */
972#define REG_RX_FIFO_TAG 0x4084 /* RX FIFO tag */
973#define REG_RX_FIFO_DATA_LOW 0x4088 /* RX FIFO data low */
974#define REG_RX_FIFO_DATA_HI_T0 0x408C /* RX FIFO data high T0 */
975#define REG_RX_FIFO_DATA_HI_T1 0x4090 /* RX FIFO data high T1 */
976
977/* diagnostic assess to RX CTRL FIFO. 8-bit FIFO_ADDR holds address of
978 * 81 bit control entry and 6 bit flow id. LOW and MID are both 32-bit
979 * accesses. HI is 7-bits with 6-bit flow id and 1 bit control
980 * word. RX_DMA_EN must be 0 for RX CTRL FIFO PIO access. DATA_HI
981 * should be last write access of the write sequence.
982 * DEFAULT: undefined
983 */
984#define REG_RX_CTRL_FIFO_ADDR 0x4094 /* RX Control FIFO and
985 Batching FIFO addr */
986#define REG_RX_CTRL_FIFO_DATA_LOW 0x4098 /* RX Control FIFO data
987 low */
988#define REG_RX_CTRL_FIFO_DATA_MID 0x409C /* RX Control FIFO data
989 mid */
990#define REG_RX_CTRL_FIFO_DATA_HI 0x4100 /* RX Control FIFO data
991 hi and flow id */
992#define RX_CTRL_FIFO_DATA_HI_CTRL 0x0001 /* upper bit of ctrl word */
993#define RX_CTRL_FIFO_DATA_HI_FLOW_MASK 0x007E /* flow id */
994
995/* diagnostic access to RX IPP FIFO. same semantics as RX_FIFO.
996 * DEFAULT: undefined
997 */
998#define REG_RX_IPP_FIFO_ADDR 0x4104 /* RX IPP FIFO address */
999#define REG_RX_IPP_FIFO_TAG 0x4108 /* RX IPP FIFO tag */
1000#define REG_RX_IPP_FIFO_DATA_LOW 0x410C /* RX IPP FIFO data low */
1001#define REG_RX_IPP_FIFO_DATA_HI_T0 0x4110 /* RX IPP FIFO data high
1002 T0 */
1003#define REG_RX_IPP_FIFO_DATA_HI_T1 0x4114 /* RX IPP FIFO data high
1004 T1 */
1005
1006/* 64-bit pointer to receive data buffer in host memory used for headers and
1007 * small packets. MSB in high register. loaded by DMA state machine and
1008 * increments as DMA writes receive data. only 50 LSB are incremented. top
1009 * 13 bits taken from RX descriptor.
1010 * DEFAULT: undefined
1011 */
1012#define REG_RX_HEADER_PAGE_PTR_LOW 0x4118 /* (ro) RX header page ptr
1013 low */
1014#define REG_RX_HEADER_PAGE_PTR_HI 0x411C /* (ro) RX header page ptr
1015 high */
1016#define REG_RX_MTU_PAGE_PTR_LOW 0x4120 /* (ro) RX MTU page pointer
1017 low */
1018#define REG_RX_MTU_PAGE_PTR_HI 0x4124 /* (ro) RX MTU page pointer
1019 high */
1020
1021/* PIO diagnostic access to RX reassembly DMA Table RAM. 6-bit register holds
1022 * one of 64 79-bit locations in the RX Reassembly DMA table and the addr of
1023 * one of the 64 byte locations in the Batching table. LOW holds 32 LSB.
1024 * MID holds the next 32 LSB. HIGH holds the 15 MSB. RX_DMA_EN must be set
1025 * to 0 for PIO access. DATA_HIGH should be last write of write sequence.
1026 * layout:
1027 * reassmbl ptr [78:15] | reassmbl index [14:1] | reassmbl entry valid [0]
1028 * DEFAULT: undefined
1029 */
1030#define REG_RX_TABLE_ADDR 0x4128 /* RX reassembly DMA table
1031 address */
1032#define RX_TABLE_ADDR_MASK 0x0000003F /* address mask */
1033
1034#define REG_RX_TABLE_DATA_LOW 0x412C /* RX reassembly DMA table
1035 data low */
1036#define REG_RX_TABLE_DATA_MID 0x4130 /* RX reassembly DMA table
1037 data mid */
1038#define REG_RX_TABLE_DATA_HI 0x4134 /* RX reassembly DMA table
1039 data high */
1040
1041/* cassini+ only */
1042/* 8KB aligned 64-bit pointer to base of RX rings. lower 13 bits hardwired to
1043 * 0. same semantics as primary desc/complete rings.
1044 */
1045#define REG_PLUS_RX_DB1_LOW 0x4200 /* RX descriptor ring
1046 2 base low */
1047#define REG_PLUS_RX_DB1_HI 0x4204 /* RX descriptor ring
1048 2 base high */
1049#define REG_PLUS_RX_CB1_LOW 0x4208 /* RX completion ring
1050 2 base low. 4 total */
1051#define REG_PLUS_RX_CB1_HI 0x420C /* RX completion ring
1052 2 base high. 4 total */
1053#define REG_PLUS_RX_CBN_LOW(x) (REG_PLUS_RX_CB1_LOW + 8*((x) - 1))
1054#define REG_PLUS_RX_CBN_HI(x) (REG_PLUS_RX_CB1_HI + 8*((x) - 1))
1055#define REG_PLUS_RX_KICK1 0x4220 /* RX Kick 2 register */
1056#define REG_PLUS_RX_COMP1 0x4224 /* (ro) RX completion 2
1057 reg */
1058#define REG_PLUS_RX_COMP1_HEAD 0x4228 /* (ro) RX completion 2
1059 head reg. 4 total. */
1060#define REG_PLUS_RX_COMP1_TAIL 0x422C /* RX completion 2
1061 tail reg. 4 total. */
1062#define REG_PLUS_RX_COMPN_HEAD(x) (REG_PLUS_RX_COMP1_HEAD + 8*((x) - 1))
1063#define REG_PLUS_RX_COMPN_TAIL(x) (REG_PLUS_RX_COMP1_TAIL + 8*((x) - 1))
1064#define REG_PLUS_RX_AE1_THRESH 0x4240 /* RX almost empty 2
1065 thresholds */
1066#define RX_AE1_THRESH_FREE_MASK RX_AE_THRESH_FREE_MASK
1067#define RX_AE1_THRESH_FREE_SHIFT RX_AE_THRESH_FREE_SHIFT
1068
1069/** header parser registers **/
1070
1071/* RX parser configuration register.
1072 * DEFAULT: 0x1651004
1073 */
1074#define REG_HP_CFG 0x4140 /* header parser
1075 configuration reg */
1076#define HP_CFG_PARSE_EN 0x00000001 /* enab header parsing */
1077#define HP_CFG_NUM_CPU_MASK 0x000000FC /* # processors
1078 0 = 64. 0x3f = 63 */
1079#define HP_CFG_NUM_CPU_SHIFT 2
1080#define HP_CFG_SYN_INC_MASK 0x00000100 /* SYN bit won't increment
1081 TCP seq # by one when
1082 stored in FDBM */
1083#define HP_CFG_TCP_THRESH_MASK 0x000FFE00 /* # bytes of TCP data
1084 needed to be considered
1085 for reassembly */
1086#define HP_CFG_TCP_THRESH_SHIFT 9
1087
1088/* access to RX Instruction RAM. 5-bit register/counter holds addr
1089 * of 39 bit entry to be read/written. 32 LSB in _DATA_LOW. 7 MSB in _DATA_HI.
1090 * RX_DMA_EN must be 0 for RX instr PIO access. DATA_HI should be last access
1091 * of sequence.
1092 * DEFAULT: undefined
1093 */
1094#define REG_HP_INSTR_RAM_ADDR 0x4144 /* HP instruction RAM
1095 address */
1096#define HP_INSTR_RAM_ADDR_MASK 0x01F /* 5-bit mask */
1097#define REG_HP_INSTR_RAM_DATA_LOW 0x4148 /* HP instruction RAM
1098 data low */
1099#define HP_INSTR_RAM_LOW_OUTMASK_MASK 0x0000FFFF
1100#define HP_INSTR_RAM_LOW_OUTMASK_SHIFT 0
1101#define HP_INSTR_RAM_LOW_OUTSHIFT_MASK 0x000F0000
1102#define HP_INSTR_RAM_LOW_OUTSHIFT_SHIFT 16
1103#define HP_INSTR_RAM_LOW_OUTEN_MASK 0x00300000
1104#define HP_INSTR_RAM_LOW_OUTEN_SHIFT 20
1105#define HP_INSTR_RAM_LOW_OUTARG_MASK 0xFFC00000
1106#define HP_INSTR_RAM_LOW_OUTARG_SHIFT 22
1107#define REG_HP_INSTR_RAM_DATA_MID 0x414C /* HP instruction RAM
1108 data mid */
1109#define HP_INSTR_RAM_MID_OUTARG_MASK 0x00000003
1110#define HP_INSTR_RAM_MID_OUTARG_SHIFT 0
1111#define HP_INSTR_RAM_MID_OUTOP_MASK 0x0000003C
1112#define HP_INSTR_RAM_MID_OUTOP_SHIFT 2
1113#define HP_INSTR_RAM_MID_FNEXT_MASK 0x000007C0
1114#define HP_INSTR_RAM_MID_FNEXT_SHIFT 6
1115#define HP_INSTR_RAM_MID_FOFF_MASK 0x0003F800
1116#define HP_INSTR_RAM_MID_FOFF_SHIFT 11
1117#define HP_INSTR_RAM_MID_SNEXT_MASK 0x007C0000
1118#define HP_INSTR_RAM_MID_SNEXT_SHIFT 18
1119#define HP_INSTR_RAM_MID_SOFF_MASK 0x3F800000
1120#define HP_INSTR_RAM_MID_SOFF_SHIFT 23
1121#define HP_INSTR_RAM_MID_OP_MASK 0xC0000000
1122#define HP_INSTR_RAM_MID_OP_SHIFT 30
1123#define REG_HP_INSTR_RAM_DATA_HI 0x4150 /* HP instruction RAM
1124 data high */
1125#define HP_INSTR_RAM_HI_VAL_MASK 0x0000FFFF
1126#define HP_INSTR_RAM_HI_VAL_SHIFT 0
1127#define HP_INSTR_RAM_HI_MASK_MASK 0xFFFF0000
1128#define HP_INSTR_RAM_HI_MASK_SHIFT 16
1129
1130/* PIO access into RX Header parser data RAM and flow database.
1131 * 11-bit register. Data fills the LSB portion of bus if less than 32 bits.
1132 * DATA_RAM: write RAM_FDB_DATA with index to access DATA_RAM.
1133 * RAM bytes = 4*(x - 1) + [3:0]. e.g., 0 -> [3:0], 31 -> [123:120]
1134 * FLOWDB: write DATA_RAM_FDB register and then read/write FDB1-12 to access
1135 * flow database.
1136 * RX_DMA_EN must be 0 for RX parser RAM PIO access. RX Parser RAM data reg
1137 * should be the last write access of the write sequence.
1138 * DEFAULT: undefined
1139 */
1140#define REG_HP_DATA_RAM_FDB_ADDR 0x4154 /* HP data and FDB
1141 RAM address */
1142#define HP_DATA_RAM_FDB_DATA_MASK 0x001F /* select 1 of 86 byte
1143 locations in header
1144 parser data ram to
1145 read/write */
1146#define HP_DATA_RAM_FDB_FDB_MASK 0x3F00 /* 1 of 64 353-bit locations
1147 in the flow database */
1148#define REG_HP_DATA_RAM_DATA 0x4158 /* HP data RAM data */
1149
1150/* HP flow database registers: 1 - 12, 0x415C - 0x4188, 4 8-bit bytes
1151 * FLOW_DB(1) = IP_SA[127:96], FLOW_DB(2) = IP_SA[95:64]
1152 * FLOW_DB(3) = IP_SA[63:32], FLOW_DB(4) = IP_SA[31:0]
1153 * FLOW_DB(5) = IP_DA[127:96], FLOW_DB(6) = IP_DA[95:64]
1154 * FLOW_DB(7) = IP_DA[63:32], FLOW_DB(8) = IP_DA[31:0]
1155 * FLOW_DB(9) = {TCP_SP[15:0],TCP_DP[15:0]}
1156 * FLOW_DB(10) = bit 0 has value for flow valid
1157 * FLOW_DB(11) = TCP_SEQ[63:32], FLOW_DB(12) = TCP_SEQ[31:0]
1158 */
1159#define REG_HP_FLOW_DB0 0x415C /* HP flow database 1 reg */
1160#define REG_HP_FLOW_DBN(x) (REG_HP_FLOW_DB0 + (x)*4)
1161
1162/* diagnostics for RX Header Parser block.
1163 * ASUN: the header parser state machine register is used for diagnostics
1164 * purposes. however, the spec doesn't have any details on it.
1165 */
1166#define REG_HP_STATE_MACHINE 0x418C /* (ro) HP state machine */
1167#define REG_HP_STATUS0 0x4190 /* (ro) HP status 1 */
1168#define HP_STATUS0_SAP_MASK 0xFFFF0000 /* SAP */
1169#define HP_STATUS0_L3_OFF_MASK 0x0000FE00 /* L3 offset */
1170#define HP_STATUS0_LB_CPUNUM_MASK 0x000001F8 /* load balancing CPU
1171 number */
1172#define HP_STATUS0_HRP_OPCODE_MASK 0x00000007 /* HRP opcode */
1173
1174#define REG_HP_STATUS1 0x4194 /* (ro) HP status 2 */
1175#define HP_STATUS1_ACCUR2_MASK 0xE0000000 /* accu R2[6:4] */
1176#define HP_STATUS1_FLOWID_MASK 0x1F800000 /* flow id */
1177#define HP_STATUS1_TCP_OFF_MASK 0x007F0000 /* tcp payload offset */
1178#define HP_STATUS1_TCP_SIZE_MASK 0x0000FFFF /* tcp payload size */
1179
1180#define REG_HP_STATUS2 0x4198 /* (ro) HP status 3 */
1181#define HP_STATUS2_ACCUR2_MASK 0xF0000000 /* accu R2[3:0] */
1182#define HP_STATUS2_CSUM_OFF_MASK 0x07F00000 /* checksum start
1183 start offset */
1184#define HP_STATUS2_ACCUR1_MASK 0x000FE000 /* accu R1 */
1185#define HP_STATUS2_FORCE_DROP 0x00001000 /* force drop */
1186#define HP_STATUS2_BWO_REASSM 0x00000800 /* batching w/o
1187 reassembly */
1188#define HP_STATUS2_JH_SPLIT_EN 0x00000400 /* jumbo header split
1189 enable */
1190#define HP_STATUS2_FORCE_TCP_NOCHECK 0x00000200 /* force tcp no payload
1191 check */
1192#define HP_STATUS2_DATA_MASK_ZERO 0x00000100 /* mask of data length
1193 equal to zero */
1194#define HP_STATUS2_FORCE_TCP_CHECK 0x00000080 /* force tcp payload
1195 chk */
1196#define HP_STATUS2_MASK_TCP_THRESH 0x00000040 /* mask of payload
1197 threshold */
1198#define HP_STATUS2_NO_ASSIST 0x00000020 /* no assist */
1199#define HP_STATUS2_CTRL_PACKET_FLAG 0x00000010 /* control packet flag */
1200#define HP_STATUS2_TCP_FLAG_CHECK 0x00000008 /* tcp flag check */
1201#define HP_STATUS2_SYN_FLAG 0x00000004 /* syn flag */
1202#define HP_STATUS2_TCP_CHECK 0x00000002 /* tcp payload chk */
1203#define HP_STATUS2_TCP_NOCHECK 0x00000001 /* tcp no payload chk */
1204
1205/* BIST for header parser(HP) and flow database memories (FDBM). set _START
1206 * to start BIST. controller clears _START on completion. _START can also
1207 * be cleared to force termination of BIST. a bit set indicates that that
1208 * memory passed its BIST.
1209 */
1210#define REG_HP_RAM_BIST 0x419C /* HP RAM BIST reg */
1211#define HP_RAM_BIST_HP_DATA_PASS 0x80000000 /* HP data ram */
1212#define HP_RAM_BIST_HP_INSTR0_PASS 0x40000000 /* HP instr ram 0 */
1213#define HP_RAM_BIST_HP_INSTR1_PASS 0x20000000 /* HP instr ram 1 */
1214#define HP_RAM_BIST_HP_INSTR2_PASS 0x10000000 /* HP instr ram 2 */
1215#define HP_RAM_BIST_FDBM_AGE0_PASS 0x08000000 /* FDBM aging RAM0 */
1216#define HP_RAM_BIST_FDBM_AGE1_PASS 0x04000000 /* FDBM aging RAM1 */
1217#define HP_RAM_BIST_FDBM_FLOWID00_PASS 0x02000000 /* FDBM flowid RAM0
1218 bank 0 */
1219#define HP_RAM_BIST_FDBM_FLOWID10_PASS 0x01000000 /* FDBM flowid RAM1
1220 bank 0 */
1221#define HP_RAM_BIST_FDBM_FLOWID20_PASS 0x00800000 /* FDBM flowid RAM2
1222 bank 0 */
1223#define HP_RAM_BIST_FDBM_FLOWID30_PASS 0x00400000 /* FDBM flowid RAM3
1224 bank 0 */
1225#define HP_RAM_BIST_FDBM_FLOWID01_PASS 0x00200000 /* FDBM flowid RAM0
1226 bank 1 */
1227#define HP_RAM_BIST_FDBM_FLOWID11_PASS 0x00100000 /* FDBM flowid RAM1
1228 bank 2 */
1229#define HP_RAM_BIST_FDBM_FLOWID21_PASS 0x00080000 /* FDBM flowid RAM2
1230 bank 1 */
1231#define HP_RAM_BIST_FDBM_FLOWID31_PASS 0x00040000 /* FDBM flowid RAM3
1232 bank 1 */
1233#define HP_RAM_BIST_FDBM_TCPSEQ_PASS 0x00020000 /* FDBM tcp sequence
1234 RAM */
1235#define HP_RAM_BIST_SUMMARY 0x00000002 /* all BIST tests */
1236#define HP_RAM_BIST_START 0x00000001 /* start/stop BIST */
1237
1238
1239/** MAC registers. **/
1240/* reset bits are set using a PIO write and self-cleared after the command
1241 * execution has completed.
1242 */
1243#define REG_MAC_TX_RESET 0x6000 /* TX MAC software reset
1244 command (default: 0x0) */
1245#define REG_MAC_RX_RESET 0x6004 /* RX MAC software reset
1246 command (default: 0x0) */
1247/* execute a pause flow control frame transmission
1248 DEFAULT: 0x0XXXX */
1249#define REG_MAC_SEND_PAUSE 0x6008 /* send pause command reg */
1250#define MAC_SEND_PAUSE_TIME_MASK 0x0000FFFF /* value of pause time
1251 to be sent on network
1252 in units of slot
1253 times */
1254#define MAC_SEND_PAUSE_SEND 0x00010000 /* send pause flow ctrl
1255 frame on network */
1256
1257/* bit set indicates that event occurred. auto-cleared when status register
1258 * is read and have corresponding mask bits in mask register. events will
1259 * trigger an interrupt if the corresponding mask bit is 0.
1260 * status register default: 0x00000000
1261 * mask register default = 0xFFFFFFFF on reset
1262 */
1263#define REG_MAC_TX_STATUS 0x6010 /* TX MAC status reg */
1264#define MAC_TX_FRAME_XMIT 0x0001 /* successful frame
1265 transmision */
1266#define MAC_TX_UNDERRUN 0x0002 /* terminated frame
1267 transmission due to
1268 data starvation in the
1269 xmit data path */
1270#define MAC_TX_MAX_PACKET_ERR 0x0004 /* frame exceeds max allowed
1271 length passed to TX MAC
1272 by the DMA engine */
1273#define MAC_TX_COLL_NORMAL 0x0008 /* rollover of the normal
1274 collision counter */
1275#define MAC_TX_COLL_EXCESS 0x0010 /* rollover of the excessive
1276 collision counter */
1277#define MAC_TX_COLL_LATE 0x0020 /* rollover of the late
1278 collision counter */
1279#define MAC_TX_COLL_FIRST 0x0040 /* rollover of the first
1280 collision counter */
1281#define MAC_TX_DEFER_TIMER 0x0080 /* rollover of the defer
1282 timer */
1283#define MAC_TX_PEAK_ATTEMPTS 0x0100 /* rollover of the peak
1284 attempts counter */
1285
1286#define REG_MAC_RX_STATUS 0x6014 /* RX MAC status reg */
1287#define MAC_RX_FRAME_RECV 0x0001 /* successful receipt of
1288 a frame */
1289#define MAC_RX_OVERFLOW 0x0002 /* dropped frame due to
1290 RX FIFO overflow */
1291#define MAC_RX_FRAME_COUNT 0x0004 /* rollover of receive frame
1292 counter */
1293#define MAC_RX_ALIGN_ERR 0x0008 /* rollover of alignment
1294 error counter */
1295#define MAC_RX_CRC_ERR 0x0010 /* rollover of crc error
1296 counter */
1297#define MAC_RX_LEN_ERR 0x0020 /* rollover of length
1298 error counter */
1299#define MAC_RX_VIOL_ERR 0x0040 /* rollover of code
1300 violation error */
1301
1302/* DEFAULT: 0xXXXX0000 on reset */
1303#define REG_MAC_CTRL_STATUS 0x6018 /* MAC control status reg */
1304#define MAC_CTRL_PAUSE_RECEIVED 0x00000001 /* successful
1305 reception of a
1306 pause control
1307 frame */
1308#define MAC_CTRL_PAUSE_STATE 0x00000002 /* MAC has made a
1309 transition from
1310 "not paused" to
1311 "paused" */
1312#define MAC_CTRL_NOPAUSE_STATE 0x00000004 /* MAC has made a
1313 transition from
1314 "paused" to "not
1315 paused" */
1316#define MAC_CTRL_PAUSE_TIME_MASK 0xFFFF0000 /* value of pause time
1317 operand that was
1318 received in the last
1319 pause flow control
1320 frame */
1321
1322/* layout identical to TX MAC[8:0] */
1323#define REG_MAC_TX_MASK 0x6020 /* TX MAC mask reg */
1324/* layout identical to RX MAC[6:0] */
1325#define REG_MAC_RX_MASK 0x6024 /* RX MAC mask reg */
1326/* layout identical to CTRL MAC[2:0] */
1327#define REG_MAC_CTRL_MASK 0x6028 /* MAC control mask reg */
1328
1329/* to ensure proper operation, CFG_EN must be cleared to 0 and a delay
1330 * imposed before writes to other bits in the TX_MAC_CFG register or any of
1331 * the MAC parameters is performed. delay dependent upon time required to
1332 * transmit a maximum size frame (= MAC_FRAMESIZE_MAX*8/Mbps). e.g.,
1333 * the delay for a 1518-byte frame on a 100Mbps network is 125us.
1334 * alternatively, just poll TX_CFG_EN until it reads back as 0.
1335 * NOTE: on half-duplex 1Gbps, TX_CFG_CARRIER_EXTEND and
1336 * RX_CFG_CARRIER_EXTEND should be set and the SLOT_TIME register should
1337 * be 0x200 (slot time of 512 bytes)
1338 */
1339#define REG_MAC_TX_CFG 0x6030 /* TX MAC config reg */
1340#define MAC_TX_CFG_EN 0x0001 /* enable TX MAC. 0 will
1341 force TXMAC state
1342 machine to remain in
1343 idle state or to
1344 transition to idle state
1345 on completion of an
1346 ongoing packet. */
1347#define MAC_TX_CFG_IGNORE_CARRIER 0x0002 /* disable CSMA/CD deferral
1348 process. set to 1 when
1349 full duplex and 0 when
1350 half duplex */
1351#define MAC_TX_CFG_IGNORE_COLL 0x0004 /* disable CSMA/CD backoff
1352 algorithm. set to 1 when
1353 full duplex and 0 when
1354 half duplex */
1355#define MAC_TX_CFG_IPG_EN 0x0008 /* enable extension of the
1356 Rx-to-TX IPG. after
1357 receiving a frame, TX
1358 MAC will reset its
1359 deferral process to
1360 carrier sense for the
1361 amount of time = IPG0 +
1362 IPG1 and commit to
1363 transmission for time
1364 specified in IPG2. when
1365 0 or when xmitting frames
1366 back-to-pack (Tx-to-Tx
1367 IPG), TX MAC ignores
1368 IPG0 and will only use
1369 IPG1 for deferral time.
1370 IPG2 still used. */
1371#define MAC_TX_CFG_NEVER_GIVE_UP_EN 0x0010 /* TX MAC will not easily
1372 give up on frame
1373 xmission. if backoff
1374 algorithm reaches the
1375 ATTEMPT_LIMIT, it will
1376 clear attempts counter
1377 and continue trying to
1378 send the frame as
1379 specified by
1380 GIVE_UP_LIM. when 0,
1381 TX MAC will execute
1382 standard CSMA/CD prot. */
1383#define MAC_TX_CFG_NEVER_GIVE_UP_LIM 0x0020 /* when set, TX MAC will
1384 continue to try to xmit
1385 until successful. when
1386 0, TX MAC will continue
1387 to try xmitting until
1388 successful or backoff
1389 algorithm reaches
1390 ATTEMPT_LIMIT*16 */
1391#define MAC_TX_CFG_NO_BACKOFF 0x0040 /* modify CSMA/CD to disable
1392 backoff algorithm. TX
1393 MAC will not back off
1394 after a xmission attempt
1395 that resulted in a
1396 collision. */
1397#define MAC_TX_CFG_SLOW_DOWN 0x0080 /* modify CSMA/CD so that
1398 deferral process is reset
1399 in response to carrier
1400 sense during the entire
1401 duration of IPG. TX MAC
1402 will only commit to frame
1403 xmission after frame
1404 xmission has actually
1405 begun. */
1406#define MAC_TX_CFG_NO_FCS 0x0100 /* TX MAC will not generate
1407 CRC for all xmitted
1408 packets. when clear, CRC
1409 generation is dependent
1410 upon NO_CRC bit in the
1411 xmit control word from
1412 TX DMA */
1413#define MAC_TX_CFG_CARRIER_EXTEND 0x0200 /* enables xmit part of the
1414 carrier extension
1415 feature. this allows for
1416 longer collision domains
1417 by extending the carrier
1418 and collision window
1419 from the end of FCS until
1420 the end of the slot time
1421 if necessary. Required
1422 for half-duplex at 1Gbps,
1423 clear otherwise. */
1424
1425/* when CRC is not stripped, reassembly packets will not contain the CRC.
1426 * these will be stripped by HRP because it reassembles layer 4 data, and the
1427 * CRC is layer 2. however, non-reassembly packets will still contain the CRC
1428 * when passed to the host. to ensure proper operation, need to wait 3.2ms
1429 * after clearing RX_CFG_EN before writing to any other RX MAC registers
1430 * or other MAC parameters. alternatively, poll RX_CFG_EN until it clears
1431 * to 0. similary, HASH_FILTER_EN and ADDR_FILTER_EN have the same
1432 * restrictions as CFG_EN.
1433 */
1434#define REG_MAC_RX_CFG 0x6034 /* RX MAC config reg */
1435#define MAC_RX_CFG_EN 0x0001 /* enable RX MAC */
1436#define MAC_RX_CFG_STRIP_PAD 0x0002 /* always program to 0.
1437 feature not supported */
1438#define MAC_RX_CFG_STRIP_FCS 0x0004 /* RX MAC will strip the
1439 last 4 bytes of a
1440 received frame. */
1441#define MAC_RX_CFG_PROMISC_EN 0x0008 /* promiscuous mode */
1442#define MAC_RX_CFG_PROMISC_GROUP_EN 0x0010 /* accept all valid
1443 multicast frames (group
1444 bit in DA field set) */
1445#define MAC_RX_CFG_HASH_FILTER_EN 0x0020 /* use hash table to filter
1446 multicast addresses */
1447#define MAC_RX_CFG_ADDR_FILTER_EN 0x0040 /* cause RX MAC to use
1448 address filtering regs
1449 to filter both unicast
1450 and multicast
1451 addresses */
1452#define MAC_RX_CFG_DISABLE_DISCARD 0x0080 /* pass errored frames to
1453 RX DMA by setting BAD
1454 bit but not Abort bit
1455 in the status. CRC,
1456 framing, and length errs
1457 will not increment
1458 error counters. frames
1459 which don't match dest
1460 addr will be passed up
1461 w/ BAD bit set. */
1462#define MAC_RX_CFG_CARRIER_EXTEND 0x0100 /* enable reception of
1463 packet bursts generated
1464 by carrier extension
1465 with packet bursting
1466 senders. only applies
1467 to half-duplex 1Gbps */
1468
1469/* DEFAULT: 0x0 */
1470#define REG_MAC_CTRL_CFG 0x6038 /* MAC control config reg */
1471#define MAC_CTRL_CFG_SEND_PAUSE_EN 0x0001 /* respond to requests for
1472 sending pause flow ctrl
1473 frames */
1474#define MAC_CTRL_CFG_RECV_PAUSE_EN 0x0002 /* respond to received
1475 pause flow ctrl frames */
1476#define MAC_CTRL_CFG_PASS_CTRL 0x0004 /* pass valid MAC ctrl
1477 packets to RX DMA */
1478
1479/* to ensure proper operation, a global initialization sequence should be
1480 * performed when a loopback config is entered or exited. if programmed after
1481 * a hw or global sw reset, RX/TX MAC software reset and initialization
1482 * should be done to ensure stable clocking.
1483 * DEFAULT: 0x0
1484 */
1485#define REG_MAC_XIF_CFG 0x603C /* XIF config reg */
1486#define MAC_XIF_TX_MII_OUTPUT_EN 0x0001 /* enable output drivers
1487 on MII xmit bus */
1488#define MAC_XIF_MII_INT_LOOPBACK 0x0002 /* loopback GMII xmit data
1489 path to GMII recv data
1490 path. phy mode register
1491 clock selection must be
1492 set to GMII mode and
1493 GMII_MODE should be set
1494 to 1. in loopback mode,
1495 REFCLK will drive the
1496 entire mac core. 0 for
1497 normal operation. */
1498#define MAC_XIF_DISABLE_ECHO 0x0004 /* disables receive data
1499 path during packet
1500 xmission. clear to 0
1501 in any full duplex mode,
1502 in any loopback mode,
1503 or in half-duplex SERDES
1504 or SLINK modes. set when
1505 in half-duplex when
1506 using external phy. */
1507#define MAC_XIF_GMII_MODE 0x0008 /* MAC operates with GMII
1508 clocks and datapath */
1509#define MAC_XIF_MII_BUFFER_OUTPUT_EN 0x0010 /* MII_BUF_EN pin. enable
1510 external tristate buffer
1511 on the MII receive
1512 bus. */
1513#define MAC_XIF_LINK_LED 0x0020 /* LINKLED# active (low) */
1514#define MAC_XIF_FDPLX_LED 0x0040 /* FDPLXLED# active (low) */
1515
1516#define REG_MAC_IPG0 0x6040 /* inter-packet gap0 reg.
1517 recommended: 0x00 */
1518#define REG_MAC_IPG1 0x6044 /* inter-packet gap1 reg
1519 recommended: 0x08 */
1520#define REG_MAC_IPG2 0x6048 /* inter-packet gap2 reg
1521 recommended: 0x04 */
1522#define REG_MAC_SLOT_TIME 0x604C /* slot time reg
1523 recommended: 0x40 */
1524#define REG_MAC_FRAMESIZE_MIN 0x6050 /* min frame size reg
1525 recommended: 0x40 */
1526
1527/* FRAMESIZE_MAX holds both the max frame size as well as the max burst size.
1528 * recommended value: 0x2000.05EE
1529 */
1530#define REG_MAC_FRAMESIZE_MAX 0x6054 /* max frame size reg */
1531#define MAC_FRAMESIZE_MAX_BURST_MASK 0x3FFF0000 /* max burst size */
1532#define MAC_FRAMESIZE_MAX_BURST_SHIFT 16
1533#define MAC_FRAMESIZE_MAX_FRAME_MASK 0x00007FFF /* max frame size */
1534#define MAC_FRAMESIZE_MAX_FRAME_SHIFT 0
1535#define REG_MAC_PA_SIZE 0x6058 /* PA size reg. number of
1536 preamble bytes that the
1537 TX MAC will xmit at the
1538 beginning of each frame
1539 value should be 2 or
1540 greater. recommended
1541 value: 0x07 */
1542#define REG_MAC_JAM_SIZE 0x605C /* jam size reg. duration
1543 of jam in units of media
1544 byte time. recommended
1545 value: 0x04 */
1546#define REG_MAC_ATTEMPT_LIMIT 0x6060 /* attempt limit reg. #
1547 of attempts TX MAC will
1548 make to xmit a frame
1549 before it resets its
1550 attempts counter. after
1551 the limit has been
1552 reached, TX MAC may or
1553 may not drop the frame
1554 dependent upon value
1555 in TX_MAC_CFG.
1556 recommended
1557 value: 0x10 */
1558#define REG_MAC_CTRL_TYPE 0x6064 /* MAC control type reg.
1559 type field of a MAC
1560 ctrl frame. recommended
1561 value: 0x8808 */
1562
1563/* mac address registers: 0 - 44, 0x6080 - 0x6130, 4 8-bit bytes.
1564 * register contains comparison
1565 * 0 16 MSB of primary MAC addr [47:32] of DA field
1566 * 1 16 middle bits "" [31:16] of DA field
1567 * 2 16 LSB "" [15:0] of DA field
1568 * 3*x 16MSB of alt MAC addr 1-15 [47:32] of DA field
1569 * 4*x 16 middle bits "" [31:16]
1570 * 5*x 16 LSB "" [15:0]
1571 * 42 16 MSB of MAC CTRL addr [47:32] of DA.
1572 * 43 16 middle bits "" [31:16]
1573 * 44 16 LSB "" [15:0]
1574 * MAC CTRL addr must be the reserved multicast addr for MAC CTRL frames.
1575 * if there is a match, MAC will set the bit for alternative address
1576 * filter pass [15]
1577
1578 * here is the map of registers given MAC address notation: a:b:c:d:e:f
1579 * ab cd ef
1580 * primary addr reg 2 reg 1 reg 0
1581 * alt addr 1 reg 5 reg 4 reg 3
1582 * alt addr x reg 5*x reg 4*x reg 3*x
1583 * ctrl addr reg 44 reg 43 reg 42
1584 */
1585#define REG_MAC_ADDR0 0x6080 /* MAC address 0 reg */
1586#define REG_MAC_ADDRN(x) (REG_MAC_ADDR0 + (x)*4)
1587#define REG_MAC_ADDR_FILTER0 0x614C /* address filter 0 reg
1588 [47:32] */
1589#define REG_MAC_ADDR_FILTER1 0x6150 /* address filter 1 reg
1590 [31:16] */
1591#define REG_MAC_ADDR_FILTER2 0x6154 /* address filter 2 reg
1592 [15:0] */
1593#define REG_MAC_ADDR_FILTER2_1_MASK 0x6158 /* address filter 2 and 1
1594 mask reg. 8-bit reg
1595 contains nibble mask for
1596 reg 2 and 1. */
1597#define REG_MAC_ADDR_FILTER0_MASK 0x615C /* address filter 0 mask
1598 reg */
1599
1600/* hash table registers: 0 - 15, 0x6160 - 0x619C, 4 8-bit bytes
1601 * 16-bit registers contain bits of the hash table.
1602 * reg x -> [16*(15 - x) + 15 : 16*(15 - x)].
1603 * e.g., 15 -> [15:0], 0 -> [255:240]
1604 */
1605#define REG_MAC_HASH_TABLE0 0x6160 /* hash table 0 reg */
1606#define REG_MAC_HASH_TABLEN(x) (REG_MAC_HASH_TABLE0 + (x)*4)
1607
1608/* statistics registers. these registers generate an interrupt on
1609 * overflow. recommended initialization: 0x0000. most are 16-bits except
1610 * for PEAK_ATTEMPTS register which is 8 bits.
1611 */
1612#define REG_MAC_COLL_NORMAL 0x61A0 /* normal collision
1613 counter. */
1614#define REG_MAC_COLL_FIRST 0x61A4 /* first attempt
1615 successful collision
1616 counter */
1617#define REG_MAC_COLL_EXCESS 0x61A8 /* excessive collision
1618 counter */
1619#define REG_MAC_COLL_LATE 0x61AC /* late collision counter */
1620#define REG_MAC_TIMER_DEFER 0x61B0 /* defer timer. time base
1621 is the media byte
1622 clock/256 */
1623#define REG_MAC_ATTEMPTS_PEAK 0x61B4 /* peak attempts reg */
1624#define REG_MAC_RECV_FRAME 0x61B8 /* receive frame counter */
1625#define REG_MAC_LEN_ERR 0x61BC /* length error counter */
1626#define REG_MAC_ALIGN_ERR 0x61C0 /* alignment error counter */
1627#define REG_MAC_FCS_ERR 0x61C4 /* FCS error counter */
1628#define REG_MAC_RX_CODE_ERR 0x61C8 /* RX code violation
1629 error counter */
1630
1631/* misc registers */
1632#define REG_MAC_RANDOM_SEED 0x61CC /* random number seed reg.
1633 10-bit register used as a
1634 seed for the random number
1635 generator for the CSMA/CD
1636 backoff algorithm. only
1637 programmed after power-on
1638 reset and should be a
1639 random value which has a
1640 high likelihood of being
1641 unique for each MAC
1642 attached to a network
1643 segment (e.g., 10 LSB of
1644 MAC address) */
1645
1646/* ASUN: there's a PAUSE_TIMER (ro) described, but it's not in the address
1647 * map
1648 */
1649
1650/* 27-bit register has the current state for key state machines in the MAC */
1651#define REG_MAC_STATE_MACHINE 0x61D0 /* (ro) state machine reg */
1652#define MAC_SM_RLM_MASK 0x07800000
1653#define MAC_SM_RLM_SHIFT 23
1654#define MAC_SM_RX_FC_MASK 0x00700000
1655#define MAC_SM_RX_FC_SHIFT 20
1656#define MAC_SM_TLM_MASK 0x000F0000
1657#define MAC_SM_TLM_SHIFT 16
1658#define MAC_SM_ENCAP_SM_MASK 0x0000F000
1659#define MAC_SM_ENCAP_SM_SHIFT 12
1660#define MAC_SM_TX_REQ_MASK 0x00000C00
1661#define MAC_SM_TX_REQ_SHIFT 10
1662#define MAC_SM_TX_FC_MASK 0x000003C0
1663#define MAC_SM_TX_FC_SHIFT 6
1664#define MAC_SM_FIFO_WRITE_SEL_MASK 0x00000038
1665#define MAC_SM_FIFO_WRITE_SEL_SHIFT 3
1666#define MAC_SM_TX_FIFO_EMPTY_MASK 0x00000007
1667#define MAC_SM_TX_FIFO_EMPTY_SHIFT 0
1668
1669/** MIF registers. the MIF can be programmed in either bit-bang or
1670 * frame mode.
1671 **/
1672#define REG_MIF_BIT_BANG_CLOCK 0x6200 /* MIF bit-bang clock.
1673 1 -> 0 will generate a
1674 rising edge. 0 -> 1 will
1675 generate a falling edge. */
1676#define REG_MIF_BIT_BANG_DATA 0x6204 /* MIF bit-bang data. 1-bit
1677 register generates data */
1678#define REG_MIF_BIT_BANG_OUTPUT_EN 0x6208 /* MIF bit-bang output
1679 enable. enable when
1680 xmitting data from MIF to
1681 transceiver. */
1682
1683/* 32-bit register serves as an instruction register when the MIF is
1684 * programmed in frame mode. load this register w/ a valid instruction
1685 * (as per IEEE 802.3u MII spec). poll this register to check for instruction
1686 * execution completion. during a read operation, this register will also
1687 * contain the 16-bit data returned by the tranceiver. unless specified
1688 * otherwise, fields are considered "don't care" when polling for
1689 * completion.
1690 */
1691#define REG_MIF_FRAME 0x620C /* MIF frame/output reg */
1692#define MIF_FRAME_START_MASK 0xC0000000 /* start of frame.
1693 load w/ 01 when
1694 issuing an instr */
1695#define MIF_FRAME_ST 0x40000000 /* STart of frame */
1696#define MIF_FRAME_OPCODE_MASK 0x30000000 /* opcode. 01 for a
1697 write. 10 for a
1698 read */
1699#define MIF_FRAME_OP_READ 0x20000000 /* read OPcode */
1700#define MIF_FRAME_OP_WRITE 0x10000000 /* write OPcode */
1701#define MIF_FRAME_PHY_ADDR_MASK 0x0F800000 /* phy address. when
1702 issuing an instr,
1703 this field should be
1704 loaded w/ the XCVR
1705 addr */
1706#define MIF_FRAME_PHY_ADDR_SHIFT 23
1707#define MIF_FRAME_REG_ADDR_MASK 0x007C0000 /* register address.
1708 when issuing an instr,
1709 addr of register
1710 to be read/written */
1711#define MIF_FRAME_REG_ADDR_SHIFT 18
1712#define MIF_FRAME_TURN_AROUND_MSB 0x00020000 /* turn around, MSB.
1713 when issuing an instr,
1714 set this bit to 1 */
1715#define MIF_FRAME_TURN_AROUND_LSB 0x00010000 /* turn around, LSB.
1716 when issuing an instr,
1717 set this bit to 0.
1718 when polling for
1719 completion, 1 means
1720 that instr execution
1721 has been completed */
1722#define MIF_FRAME_DATA_MASK 0x0000FFFF /* instruction payload
1723 load with 16-bit data
1724 to be written in
1725 transceiver reg for a
1726 write. doesn't matter
1727 in a read. when
1728 polling for
1729 completion, field is
1730 "don't care" for write
1731 and 16-bit data
1732 returned by the
1733 transceiver for a
1734 read (if valid bit
1735 is set) */
1736#define REG_MIF_CFG 0x6210 /* MIF config reg */
1737#define MIF_CFG_PHY_SELECT 0x0001 /* 1 -> select MDIO_1
1738 0 -> select MDIO_0 */
1739#define MIF_CFG_POLL_EN 0x0002 /* enable polling
1740 mechanism. if set,
1741 BB_MODE should be 0 */
1742#define MIF_CFG_BB_MODE 0x0004 /* 1 -> bit-bang mode
1743 0 -> frame mode */
1744#define MIF_CFG_POLL_REG_MASK 0x00F8 /* register address to be
1745 used by polling mode.
1746 only meaningful if POLL_EN
1747 is set to 1 */
1748#define MIF_CFG_POLL_REG_SHIFT 3
1749#define MIF_CFG_MDIO_0 0x0100 /* (ro) dual purpose.
1750 when MDIO_0 is idle,
1751 1 -> tranceiver is
1752 connected to MDIO_0.
1753 when MIF is communicating
1754 w/ MDIO_0 in bit-bang
1755 mode, this bit indicates
1756 the incoming bit stream
1757 during a read op */
1758#define MIF_CFG_MDIO_1 0x0200 /* (ro) dual purpose.
1759 when MDIO_1 is idle,
1760 1 -> transceiver is
1761 connected to MDIO_1.
1762 when MIF is communicating
1763 w/ MDIO_1 in bit-bang
1764 mode, this bit indicates
1765 the incoming bit stream
1766 during a read op */
1767#define MIF_CFG_POLL_PHY_MASK 0x7C00 /* tranceiver address to
1768 be polled */
1769#define MIF_CFG_POLL_PHY_SHIFT 10
1770
1771/* 16-bit register used to determine which bits in the POLL_STATUS portion of
1772 * the MIF_STATUS register will cause an interrupt. if a mask bit is 0,
1773 * corresponding bit of the POLL_STATUS will generate a MIF interrupt when
1774 * set. DEFAULT: 0xFFFF
1775 */
1776#define REG_MIF_MASK 0x6214 /* MIF mask reg */
1777
1778/* 32-bit register used when in poll mode. auto-cleared after being read */
1779#define REG_MIF_STATUS 0x6218 /* MIF status reg */
1780#define MIF_STATUS_POLL_DATA_MASK 0xFFFF0000 /* poll data contains
1781 the "latest image"
1782 update of the XCVR
1783 reg being read */
1784#define MIF_STATUS_POLL_DATA_SHIFT 16
1785#define MIF_STATUS_POLL_STATUS_MASK 0x0000FFFF /* poll status indicates
1786 which bits in the
1787 POLL_DATA field have
1788 changed since the
1789 MIF_STATUS reg was
1790 last read */
1791#define MIF_STATUS_POLL_STATUS_SHIFT 0
1792
1793/* 7-bit register has current state for all state machines in the MIF */
1794#define REG_MIF_STATE_MACHINE 0x621C /* MIF state machine reg */
1795#define MIF_SM_CONTROL_MASK 0x07 /* control state machine
1796 state */
1797#define MIF_SM_EXECUTION_MASK 0x60 /* execution state machine
1798 state */
1799
1800/** PCS/Serialink. the following registers are equivalent to the standard
1801 * MII management registers except that they're directly mapped in
1802 * Cassini's register space.
1803 **/
1804
1805/* the auto-negotiation enable bit should be programmed the same at
1806 * the link partner as in the local device to enable auto-negotiation to
1807 * complete. when that bit is reprogrammed, auto-neg/manual config is
1808 * restarted automatically.
1809 * DEFAULT: 0x1040
1810 */
1811#define REG_PCS_MII_CTRL 0x9000 /* PCS MII control reg */
1812#define PCS_MII_CTRL_1000_SEL 0x0040 /* reads 1. ignored on
1813 writes */
1814#define PCS_MII_CTRL_COLLISION_TEST 0x0080 /* COL signal at the PCS
1815 to MAC interface is
1816 activated regardless
1817 of activity */
1818#define PCS_MII_CTRL_DUPLEX 0x0100 /* forced 0x0. PCS
1819 behaviour same for
1820 half and full dplx */
1821#define PCS_MII_RESTART_AUTONEG 0x0200 /* self clearing.
1822 restart auto-
1823 negotiation */
1824#define PCS_MII_ISOLATE 0x0400 /* read as 0. ignored
1825 on writes */
1826#define PCS_MII_POWER_DOWN 0x0800 /* read as 0. ignored
1827 on writes */
1828#define PCS_MII_AUTONEG_EN 0x1000 /* default 1. PCS goes
1829 through automatic
1830 link config before it
1831 can be used. when 0,
1832 link can be used
1833 w/out any link config
1834 phase */
1835#define PCS_MII_10_100_SEL 0x2000 /* read as 0. ignored on
1836 writes */
1837#define PCS_MII_RESET 0x8000 /* reset PCS. self-clears
1838 when done */
1839
1840/* DEFAULT: 0x0108 */
1841#define REG_PCS_MII_STATUS 0x9004 /* PCS MII status reg */
1842#define PCS_MII_STATUS_EXTEND_CAP 0x0001 /* reads 0 */
1843#define PCS_MII_STATUS_JABBER_DETECT 0x0002 /* reads 0 */
1844#define PCS_MII_STATUS_LINK_STATUS 0x0004 /* 1 -> link up.
1845 0 -> link down. 0 is
1846 latched so that 0 is
1847 kept until read. read
1848 2x to determine if the
1849 link has gone up again */
1850#define PCS_MII_STATUS_AUTONEG_ABLE 0x0008 /* reads 1 (able to perform
1851 auto-neg) */
1852#define PCS_MII_STATUS_REMOTE_FAULT 0x0010 /* 1 -> remote fault detected
1853 from received link code
1854 word. only valid after
1855 auto-neg completed */
1856#define PCS_MII_STATUS_AUTONEG_COMP 0x0020 /* 1 -> auto-negotiation
1857 completed
1858 0 -> auto-negotiation not
1859 completed */
1860#define PCS_MII_STATUS_EXTEND_STATUS 0x0100 /* reads as 1. used as an
1861 indication that this is
1862 a 1000 Base-X PHY. writes
1863 to it are ignored */
1864
1865/* used during auto-negotiation.
1866 * DEFAULT: 0x00E0
1867 */
1868#define REG_PCS_MII_ADVERT 0x9008 /* PCS MII advertisement
1869 reg */
1870#define PCS_MII_ADVERT_FD 0x0020 /* advertise full duplex
1871 1000 Base-X */
1872#define PCS_MII_ADVERT_HD 0x0040 /* advertise half-duplex
1873 1000 Base-X */
1874#define PCS_MII_ADVERT_SYM_PAUSE 0x0080 /* advertise PAUSE
1875 symmetric capability */
1876#define PCS_MII_ADVERT_ASYM_PAUSE 0x0100 /* advertises PAUSE
1877 asymmetric capability */
1878#define PCS_MII_ADVERT_RF_MASK 0x3000 /* remote fault. write bit13
1879 to optionally indicate to
1880 link partner that chip is
1881 going off-line. bit12 will
1882 get set when signal
1883 detect == FAIL and will
1884 remain set until
1885 successful negotiation */
1886#define PCS_MII_ADVERT_ACK 0x4000 /* (ro) */
1887#define PCS_MII_ADVERT_NEXT_PAGE 0x8000 /* (ro) forced 0x0 */
1888
1889/* contents updated as a result of autonegotiation. layout and definitions
1890 * identical to PCS_MII_ADVERT
1891 */
1892#define REG_PCS_MII_LPA 0x900C /* PCS MII link partner
1893 ability reg */
1894#define PCS_MII_LPA_FD PCS_MII_ADVERT_FD
1895#define PCS_MII_LPA_HD PCS_MII_ADVERT_HD
1896#define PCS_MII_LPA_SYM_PAUSE PCS_MII_ADVERT_SYM_PAUSE
1897#define PCS_MII_LPA_ASYM_PAUSE PCS_MII_ADVERT_ASYM_PAUSE
1898#define PCS_MII_LPA_RF_MASK PCS_MII_ADVERT_RF_MASK
1899#define PCS_MII_LPA_ACK PCS_MII_ADVERT_ACK
1900#define PCS_MII_LPA_NEXT_PAGE PCS_MII_ADVERT_NEXT_PAGE
1901
1902/* DEFAULT: 0x0 */
1903#define REG_PCS_CFG 0x9010 /* PCS config reg */
1904#define PCS_CFG_EN 0x01 /* enable PCS. must be
1905 0 when modifying
1906 PCS_MII_ADVERT */
1907#define PCS_CFG_SD_OVERRIDE 0x02 /* sets signal detect to
1908 OK. bit is
1909 non-resettable */
1910#define PCS_CFG_SD_ACTIVE_LOW 0x04 /* changes interpretation
1911 of optical signal to make
1912 signal detect okay when
1913 signal is low */
1914#define PCS_CFG_JITTER_STUDY_MASK 0x18 /* used to make jitter
1915 measurements. a single
1916 code group is xmitted
1917 regularly.
1918 0x0 = normal operation
1919 0x1 = high freq test
1920 pattern, D21.5
1921 0x2 = low freq test
1922 pattern, K28.7
1923 0x3 = reserved */
1924#define PCS_CFG_10MS_TIMER_OVERRIDE 0x20 /* shortens 10-20ms auto-
1925 negotiation timer to
1926 a few cycles for test
1927 purposes */
1928
1929/* used for diagnostic purposes. bits 20-22 autoclear on read */
1930#define REG_PCS_STATE_MACHINE 0x9014 /* (ro) PCS state machine
1931 and diagnostic reg */
1932#define PCS_SM_TX_STATE_MASK 0x0000000F /* 0 and 1 indicate
1933 xmission of idle.
1934 otherwise, xmission of
1935 a packet */
1936#define PCS_SM_RX_STATE_MASK 0x000000F0 /* 0 indicates reception
1937 of idle. otherwise,
1938 reception of packet */
1939#define PCS_SM_WORD_SYNC_STATE_MASK 0x00000700 /* 0 indicates loss of
1940 sync */
1941#define PCS_SM_SEQ_DETECT_STATE_MASK 0x00001800 /* cycling through 0-3
1942 indicates reception of
1943 Config codes. cycling
1944 through 0-1 indicates
1945 reception of idles */
1946#define PCS_SM_LINK_STATE_MASK 0x0001E000
1947#define SM_LINK_STATE_UP 0x00016000 /* link state is up */
1948
1949#define PCS_SM_LOSS_LINK_C 0x00100000 /* loss of link due to
1950 recept of Config
1951 codes */
1952#define PCS_SM_LOSS_LINK_SYNC 0x00200000 /* loss of link due to
1953 loss of sync */
1954#define PCS_SM_LOSS_SIGNAL_DETECT 0x00400000 /* signal detect goes
1955 from OK to FAIL. bit29
1956 will also be set if
1957 this is set */
1958#define PCS_SM_NO_LINK_BREAKLINK 0x01000000 /* link not up due to
1959 receipt of breaklink
1960 C codes from partner.
1961 C codes w/ 0 content
1962 received triggering
1963 start/restart of
1964 autonegotiation.
1965 should be sent for
1966 no longer than 20ms */
1967#define PCS_SM_NO_LINK_SERDES 0x02000000 /* serdes being
1968 initialized. see serdes
1969 state reg */
1970#define PCS_SM_NO_LINK_C 0x04000000 /* C codes not stable or
1971 not received */
1972#define PCS_SM_NO_LINK_SYNC 0x08000000 /* word sync not
1973 achieved */
1974#define PCS_SM_NO_LINK_WAIT_C 0x10000000 /* waiting for C codes
1975 w/ ack bit set */
1976#define PCS_SM_NO_LINK_NO_IDLE 0x20000000 /* link partner continues
1977 to send C codes
1978 instead of idle
1979 symbols or pkt data */
1980
1981/* this register indicates interrupt changes in specific PCS MII status bits.
1982 * PCS_INT may be masked at the ISR level. only a single bit is implemented
1983 * for link status change.
1984 */
1985#define REG_PCS_INTR_STATUS 0x9018 /* PCS interrupt status */
1986#define PCS_INTR_STATUS_LINK_CHANGE 0x04 /* link status has changed
1987 since last read */
1988
1989/* control which network interface is used. no more than one bit should
1990 * be set.
1991 * DEFAULT: none
1992 */
1993#define REG_PCS_DATAPATH_MODE 0x9050 /* datapath mode reg */
1994#define PCS_DATAPATH_MODE_MII 0x00 /* PCS is not used and
1995 MII/GMII is selected.
1996 selection between MII and
1997 GMII is controlled by
1998 XIF_CFG */
1999#define PCS_DATAPATH_MODE_SERDES 0x02 /* PCS is used via the
2000 10-bit interface */
2001
2002/* input to serdes chip or serialink block */
2003#define REG_PCS_SERDES_CTRL 0x9054 /* serdes control reg */
2004#define PCS_SERDES_CTRL_LOOPBACK 0x01 /* enable loopback on
2005 serdes interface */
2006#define PCS_SERDES_CTRL_SYNCD_EN 0x02 /* enable sync carrier
2007 detection. should be
2008 0x0 for normal
2009 operation */
2010#define PCS_SERDES_CTRL_LOCKREF 0x04 /* frequency-lock RBC[0:1]
2011 to REFCLK when set.
2012 when clear, receiver
2013 clock locks to incoming
2014 serial data */
2015
2016/* multiplex test outputs into the PROM address (PA_3 through PA_0) pins.
2017 * should be 0x0 for normal operations.
2018 * 0b000 normal operation, PROM address[3:0] selected
2019 * 0b001 rxdma req, rxdma ack, rxdma ready, rxdma read
2020 * 0b010 rxmac req, rx ack, rx tag, rx clk shared
2021 * 0b011 txmac req, tx ack, tx tag, tx retry req
2022 * 0b100 tx tp3, tx tp2, tx tp1, tx tp0
2023 * 0b101 R period RX, R period TX, R period HP, R period BIM
2024 * DEFAULT: 0x0
2025 */
2026#define REG_PCS_SHARED_OUTPUT_SEL 0x9058 /* shared output select */
2027#define PCS_SOS_PROM_ADDR_MASK 0x0007
2028
2029/* used for diagnostics. this register indicates progress of the SERDES
2030 * boot up.
2031 * 0b00 undergoing reset
2032 * 0b01 waiting 500us while lockrefn is asserted
2033 * 0b10 waiting for comma detect
2034 * 0b11 receive data is synchronized
2035 * DEFAULT: 0x0
2036 */
2037#define REG_PCS_SERDES_STATE 0x905C /* (ro) serdes state */
2038#define PCS_SERDES_STATE_MASK 0x03
2039
2040/* used for diagnostics. indicates number of packets transmitted or received.
2041 * counters rollover w/out generating an interrupt.
2042 * DEFAULT: 0x0
2043 */
2044#define REG_PCS_PACKET_COUNT 0x9060 /* (ro) PCS packet counter */
2045#define PCS_PACKET_COUNT_TX 0x000007FF /* pkts xmitted by PCS */
2046#define PCS_PACKET_COUNT_RX 0x07FF0000 /* pkts recvd by PCS
2047 whether they
2048 encountered an error
2049 or not */
2050
2051/** LocalBus Devices. the following provides run-time access to the
2052 * Cassini's PROM
2053 ***/
2054#define REG_EXPANSION_ROM_RUN_START 0x100000 /* expansion rom run time
2055 access */
2056#define REG_EXPANSION_ROM_RUN_END 0x17FFFF
2057
2058#define REG_SECOND_LOCALBUS_START 0x180000 /* secondary local bus
2059 device */
2060#define REG_SECOND_LOCALBUS_END 0x1FFFFF
2061
2062/* entropy device */
2063#define REG_ENTROPY_START REG_SECOND_LOCALBUS_START
2064#define REG_ENTROPY_DATA (REG_ENTROPY_START + 0x00)
2065#define REG_ENTROPY_STATUS (REG_ENTROPY_START + 0x04)
2066#define ENTROPY_STATUS_DRDY 0x01
2067#define ENTROPY_STATUS_BUSY 0x02
2068#define ENTROPY_STATUS_CIPHER 0x04
2069#define ENTROPY_STATUS_BYPASS_MASK 0x18
2070#define REG_ENTROPY_MODE (REG_ENTROPY_START + 0x05)
2071#define ENTROPY_MODE_KEY_MASK 0x07
2072#define ENTROPY_MODE_ENCRYPT 0x40
2073#define REG_ENTROPY_RAND_REG (REG_ENTROPY_START + 0x06)
2074#define REG_ENTROPY_RESET (REG_ENTROPY_START + 0x07)
2075#define ENTROPY_RESET_DES_IO 0x01
2076#define ENTROPY_RESET_STC_MODE 0x02
2077#define ENTROPY_RESET_KEY_CACHE 0x04
2078#define ENTROPY_RESET_IV 0x08
2079#define REG_ENTROPY_IV (REG_ENTROPY_START + 0x08)
2080#define REG_ENTROPY_KEY0 (REG_ENTROPY_START + 0x10)
2081#define REG_ENTROPY_KEYN(x) (REG_ENTROPY_KEY0 + 4*(x))
2082
2083/* phys of interest w/ their special mii registers */
2084#define PHY_LUCENT_B0 0x00437421
2085#define LUCENT_MII_REG 0x1F
2086
2087#define PHY_NS_DP83065 0x20005c78
2088#define DP83065_MII_MEM 0x16
2089#define DP83065_MII_REGD 0x1D
2090#define DP83065_MII_REGE 0x1E
2091
2092#define PHY_BROADCOM_5411 0x00206071
2093#define PHY_BROADCOM_B0 0x00206050
2094#define BROADCOM_MII_REG4 0x14
2095#define BROADCOM_MII_REG5 0x15
2096#define BROADCOM_MII_REG7 0x17
2097#define BROADCOM_MII_REG8 0x18
2098
2099#define CAS_MII_ANNPTR 0x07
2100#define CAS_MII_ANNPRR 0x08
2101#define CAS_MII_1000_CTRL 0x09
2102#define CAS_MII_1000_STATUS 0x0A
2103#define CAS_MII_1000_EXTEND 0x0F
2104
2105#define CAS_BMSR_1000_EXTEND 0x0100 /* supports 1000Base-T extended status */
2106/*
2107 * if autoneg is disabled, here's the table:
2108 * BMCR_SPEED100 = 100Mbps
2109 * BMCR_SPEED1000 = 1000Mbps
2110 * ~(BMCR_SPEED100 | BMCR_SPEED1000) = 10Mbps
2111 */
2112#define CAS_BMCR_SPEED1000 0x0040 /* Select 1000Mbps */
2113
2114#define CAS_ADVERTISE_1000HALF 0x0100
2115#define CAS_ADVERTISE_1000FULL 0x0200
2116#define CAS_ADVERTISE_PAUSE 0x0400
2117#define CAS_ADVERTISE_ASYM_PAUSE 0x0800
2118
2119/* regular lpa register */
2120#define CAS_LPA_PAUSE CAS_ADVERTISE_PAUSE
2121#define CAS_LPA_ASYM_PAUSE CAS_ADVERTISE_ASYM_PAUSE
2122
2123/* 1000_STATUS register */
2124#define CAS_LPA_1000HALF 0x0400
2125#define CAS_LPA_1000FULL 0x0800
2126
2127#define CAS_EXTEND_1000XFULL 0x8000
2128#define CAS_EXTEND_1000XHALF 0x4000
2129#define CAS_EXTEND_1000TFULL 0x2000
2130#define CAS_EXTEND_1000THALF 0x1000
2131
2132/* cassini header parser firmware */
2133typedef struct cas_hp_inst {
2134 const char *note;
2135
2136 u16 mask, val;
2137
2138 u8 op;
2139 u8 soff, snext; /* if match succeeds, new offset and match */
2140 u8 foff, fnext; /* if match fails, new offset and match */
2141 /* output info */
2142 u8 outop; /* output opcode */
2143
2144 u16 outarg; /* output argument */
2145 u8 outenab; /* output enable: 0 = not, 1 = if match
2146 2 = if !match, 3 = always */
2147 u8 outshift; /* barrel shift right, 4 bits */
2148 u16 outmask;
2149} cas_hp_inst_t;
2150
2151/* comparison */
2152#define OP_EQ 0 /* packet == value */
2153#define OP_LT 1 /* packet < value */
2154#define OP_GT 2 /* packet > value */
2155#define OP_NP 3 /* new packet */
2156
2157/* output opcodes */
2158#define CL_REG 0
2159#define LD_FID 1
2160#define LD_SEQ 2
2161#define LD_CTL 3
2162#define LD_SAP 4
2163#define LD_R1 5
2164#define LD_L3 6
2165#define LD_SUM 7
2166#define LD_HDR 8
2167#define IM_FID 9
2168#define IM_SEQ 10
2169#define IM_SAP 11
2170#define IM_R1 12
2171#define IM_CTL 13
2172#define LD_LEN 14
2173#define ST_FLG 15
2174
2175/* match setp #s for IP4TCP4 */
2176#define S1_PCKT 0
2177#define S1_VLAN 1
2178#define S1_CFI 2
2179#define S1_8023 3
2180#define S1_LLC 4
2181#define S1_LLCc 5
2182#define S1_IPV4 6
2183#define S1_IPV4c 7
2184#define S1_IPV4F 8
2185#define S1_TCP44 9
2186#define S1_IPV6 10
2187#define S1_IPV6L 11
2188#define S1_IPV6c 12
2189#define S1_TCP64 13
2190#define S1_TCPSQ 14
2191#define S1_TCPFG 15
2192#define S1_TCPHL 16
2193#define S1_TCPHc 17
2194#define S1_CLNP 18
2195#define S1_CLNP2 19
2196#define S1_DROP 20
2197#define S2_HTTP 21
2198#define S1_ESP4 22
2199#define S1_AH4 23
2200#define S1_ESP6 24
2201#define S1_AH6 25
2202
2203#define CAS_PROG_IP46TCP4_PREAMBLE \
2204{ "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT, \
2205 CL_REG, 0x3ff, 1, 0x0, 0x0000}, \
2206{ "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, \
2207 IM_CTL, 0x00a, 3, 0x0, 0xffff}, \
2208{ "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, \
2209 CL_REG, 0x000, 0, 0x0, 0x0000}, \
2210{ "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, \
2211 CL_REG, 0x000, 0, 0x0, 0x0000}, \
2212{ "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, \
2213 CL_REG, 0x000, 0, 0x0, 0x0000}, \
2214{ "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, \
2215 CL_REG, 0x000, 0, 0x0, 0x0000}, \
2216{ "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, \
2217 LD_SAP, 0x100, 3, 0x0, 0xffff}, \
2218{ "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, \
2219 LD_SUM, 0x00a, 1, 0x0, 0x0000}, \
2220{ "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, \
2221 LD_LEN, 0x03e, 1, 0x0, 0xffff}, \
2222{ "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP, \
2223 LD_FID, 0x182, 1, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ \
2224{ "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, \
2225 LD_SUM, 0x015, 1, 0x0, 0x0000}, \
2226{ "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, \
2227 IM_R1, 0x128, 1, 0x0, 0xffff}, \
2228{ "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, \
2229 LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ \
2230{ "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP, \
2231 LD_LEN, 0x03f, 1, 0x0, 0xffff}
2232
2233#ifdef USE_HP_IP46TCP4
2234static cas_hp_inst_t cas_prog_ip46tcp4tab[] = {
2235 CAS_PROG_IP46TCP4_PREAMBLE,
2236 { "TCP seq", /* DADDR should point to dest port */
2237 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ,
2238 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
2239 { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
2240 S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */
2241 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0,
2242 S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000},
2243 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2244 S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2245 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
2246 IM_CTL, 0x001, 3, 0x0, 0x0001},
2247 { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2248 IM_CTL, 0x000, 0, 0x0, 0x0000},
2249 { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2250 IM_CTL, 0x080, 3, 0x0, 0xffff},
2251 { NULL },
2252};
2253#ifdef HP_IP46TCP4_DEFAULT
2254#define CAS_HP_FIRMWARE cas_prog_ip46tcp4tab
2255#endif
2256#endif
2257
2258/*
2259 * Alternate table load which excludes HTTP server traffic from reassembly.
2260 * It is substantially similar to the basic table, with one extra state
2261 * and a few extra compares. */
2262#ifdef USE_HP_IP46TCP4NOHTTP
2263static cas_hp_inst_t cas_prog_ip46tcp4nohttptab[] = {
2264 CAS_PROG_IP46TCP4_PREAMBLE,
2265 { "TCP seq", /* DADDR should point to dest port */
2266 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ,
2267 0x081, 3, 0x0, 0xffff} , /* Load TCP seq # */
2268 { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0,
2269 S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f, }, /* Load TCP flags */
2270 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
2271 LD_R1, 0x205, 3, 0xB, 0xf000},
2272 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2273 LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2274 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
2275 IM_CTL, 0x001, 3, 0x0, 0x0001},
2276 { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2277 CL_REG, 0x002, 3, 0x0, 0x0000},
2278 { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2279 IM_CTL, 0x080, 3, 0x0, 0xffff},
2280 { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2281 IM_CTL, 0x044, 3, 0x0, 0xffff},
2282 { NULL },
2283};
2284#ifdef HP_IP46TCP4NOHTTP_DEFAULT
2285#define CAS_HP_FIRMWARE cas_prog_ip46tcp4nohttptab
2286#endif
2287#endif
2288
2289/* match step #s for IP4FRAG */
2290#define S3_IPV6c 11
2291#define S3_TCP64 12
2292#define S3_TCPSQ 13
2293#define S3_TCPFG 14
2294#define S3_TCPHL 15
2295#define S3_TCPHc 16
2296#define S3_FRAG 17
2297#define S3_FOFF 18
2298#define S3_CLNP 19
2299
2300#ifdef USE_HP_IP4FRAG
2301static cas_hp_inst_t cas_prog_ip4fragtab[] = {
2302 { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT,
2303 CL_REG, 0x3ff, 1, 0x0, 0x0000},
2304 { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
2305 IM_CTL, 0x00a, 3, 0x0, 0xffff},
2306 { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S3_CLNP, 1, S1_8023,
2307 CL_REG, 0x000, 0, 0x0, 0x0000},
2308 { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
2309 CL_REG, 0x000, 0, 0x0, 0x0000},
2310 { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S3_CLNP,
2311 CL_REG, 0x000, 0, 0x0, 0x0000},
2312 { "LLCc?",0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S3_CLNP,
2313 CL_REG, 0x000, 0, 0x0, 0x0000},
2314 { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
2315 LD_SAP, 0x100, 3, 0x0, 0xffff},
2316 { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S3_CLNP,
2317 LD_SUM, 0x00a, 1, 0x0, 0x0000},
2318 { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S3_FRAG,
2319 LD_LEN, 0x03e, 3, 0x0, 0xffff},
2320 { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S3_TCPSQ, 0, S3_CLNP,
2321 LD_FID, 0x182, 3, 0x0, 0xffff}, /* FID IP4&TCP src+dst */
2322 { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S3_IPV6c, 0, S3_CLNP,
2323 LD_SUM, 0x015, 1, 0x0, 0x0000},
2324 { "IPV6 cont?", 0xf000, 0x6000, OP_EQ, 3, S3_TCP64, 0, S3_CLNP,
2325 LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */
2326 { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S3_TCPSQ, 0, S3_CLNP,
2327 LD_LEN, 0x03f, 1, 0x0, 0xffff},
2328 { "TCP seq", /* DADDR should point to dest port */
2329 0x0000, 0x0000, OP_EQ, 0, S3_TCPFG, 4, S3_TCPFG, LD_SEQ,
2330 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
2331 { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHL, 0,
2332 S3_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */
2333 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHc, 0, S3_TCPHc,
2334 LD_R1, 0x205, 3, 0xB, 0xf000},
2335 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2336 LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2337 { "IP4 Fragment", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF,
2338 LD_FID, 0x103, 3, 0x0, 0xffff}, /* FID IP4 src+dst */
2339 { "IP4 frag offset", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF,
2340 LD_SEQ, 0x040, 1, 0xD, 0xfff8},
2341 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2342 IM_CTL, 0x001, 3, 0x0, 0x0001},
2343 { NULL },
2344};
2345#ifdef HP_IP4FRAG_DEFAULT
2346#define CAS_HP_FIRMWARE cas_prog_ip4fragtab
2347#endif
2348#endif
2349
2350/*
2351 * Alternate table which does batching without reassembly
2352 */
2353#ifdef USE_HP_IP46TCP4BATCH
2354static cas_hp_inst_t cas_prog_ip46tcp4batchtab[] = {
2355 CAS_PROG_IP46TCP4_PREAMBLE,
2356 { "TCP seq", /* DADDR should point to dest port */
2357 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 0, S1_TCPFG, LD_SEQ,
2358 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
2359 { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
2360 S1_TCPHL, ST_FLG, 0x000, 3, 0x0, 0x0000}, /* Load TCP flags */
2361 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0,
2362 S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000},
2363 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2364 S1_PCKT, IM_CTL, 0x040, 3, 0x0, 0xffff}, /* set batch bit */
2365 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2366 IM_CTL, 0x001, 3, 0x0, 0x0001},
2367 { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2368 S1_PCKT, IM_CTL, 0x080, 3, 0x0, 0xffff},
2369 { NULL },
2370};
2371#ifdef HP_IP46TCP4BATCH_DEFAULT
2372#define CAS_HP_FIRMWARE cas_prog_ip46tcp4batchtab
2373#endif
2374#endif
2375
2376/* Workaround for Cassini rev2 descriptor corruption problem.
2377 * Does batching without reassembly, and sets the SAP to a known
2378 * data pattern for all packets.
2379 */
2380#ifdef USE_HP_WORKAROUND
2381static cas_hp_inst_t cas_prog_workaroundtab[] = {
2382 { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0,
2383 S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000} ,
2384 { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
2385 IM_CTL, 0x04a, 3, 0x0, 0xffff},
2386 { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023,
2387 CL_REG, 0x000, 0, 0x0, 0x0000},
2388 { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
2389 CL_REG, 0x000, 0, 0x0, 0x0000},
2390 { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP,
2391 CL_REG, 0x000, 0, 0x0, 0x0000},
2392 { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP,
2393 CL_REG, 0x000, 0, 0x0, 0x0000},
2394 { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
2395 IM_SAP, 0x6AE, 3, 0x0, 0xffff},
2396 { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP,
2397 LD_SUM, 0x00a, 1, 0x0, 0x0000},
2398 { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP,
2399 LD_LEN, 0x03e, 1, 0x0, 0xffff},
2400 { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP,
2401 LD_FID, 0x182, 3, 0x0, 0xffff}, /* FID IP4&TCP src+dst */
2402 { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP,
2403 LD_SUM, 0x015, 1, 0x0, 0x0000},
2404 { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP,
2405 IM_R1, 0x128, 1, 0x0, 0xffff},
2406 { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP,
2407 LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */
2408 { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP,
2409 LD_LEN, 0x03f, 1, 0x0, 0xffff},
2410 { "TCP seq", /* DADDR should point to dest port */
2411 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ,
2412 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
2413 { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
2414 S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */
2415 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
2416 LD_R1, 0x205, 3, 0xB, 0xf000},
2417 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2418 S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2419 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
2420 IM_SAP, 0x6AE, 3, 0x0, 0xffff} ,
2421 { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2422 IM_CTL, 0x001, 3, 0x0, 0x0001},
2423 { NULL },
2424};
2425#ifdef HP_WORKAROUND_DEFAULT
2426#define CAS_HP_FIRMWARE cas_prog_workaroundtab
2427#endif
2428#endif
2429
2430#ifdef USE_HP_ENCRYPT
2431static cas_hp_inst_t cas_prog_encryptiontab[] = {
2432 { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0,
2433 S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000},
2434 { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
2435 IM_CTL, 0x00a, 3, 0x0, 0xffff},
2436#if 0
2437//"CFI?", /* 02 FIND CFI and If FIND go to S1_DROP */
2438//0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, CL_REG, 0x000, 0, 0x0, 0x00
2439 00,
2440#endif
2441 { "CFI?", /* FIND CFI and If FIND go to CleanUP1 (ignore and send to host) */
2442 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023,
2443 CL_REG, 0x000, 0, 0x0, 0x0000},
2444 { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
2445 CL_REG, 0x000, 0, 0x0, 0x0000},
2446 { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP,
2447 CL_REG, 0x000, 0, 0x0, 0x0000},
2448 { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP,
2449 CL_REG, 0x000, 0, 0x0, 0x0000},
2450 { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
2451 LD_SAP, 0x100, 3, 0x0, 0xffff},
2452 { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP,
2453 LD_SUM, 0x00a, 1, 0x0, 0x0000},
2454 { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP,
2455 LD_LEN, 0x03e, 1, 0x0, 0xffff},
2456 { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_ESP4,
2457 LD_FID, 0x182, 1, 0x0, 0xffff}, /* FID IP4&TCP src+dst */
2458 { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP,
2459 LD_SUM, 0x015, 1, 0x0, 0x0000},
2460 { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP,
2461 IM_R1, 0x128, 1, 0x0, 0xffff},
2462 { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP,
2463 LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */
2464 { "TCP64?",
2465#if 0
2466//@@@0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_ESP6, LD_LEN, 0x03f, 1, 0x0, 0xffff,
2467#endif
2468 0xff00, 0x0600, OP_EQ, 12, S1_TCPSQ, 0, S1_ESP6, LD_LEN,
2469 0x03f, 1, 0x0, 0xffff},
2470 { "TCP seq", /* 14:DADDR should point to dest port */
2471 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ,
2472 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
2473 { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0,
2474 S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f}, /* Load TCP flags */
2475 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
2476 LD_R1, 0x205, 3, 0xB, 0xf000} ,
2477 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2478 S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2479 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
2480 IM_CTL, 0x001, 3, 0x0, 0x0001},
2481 { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2482 CL_REG, 0x002, 3, 0x0, 0x0000},
2483 { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2484 IM_CTL, 0x080, 3, 0x0, 0xffff},
2485 { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2486 IM_CTL, 0x044, 3, 0x0, 0xffff},
2487 { "IPV4 ESP encrypted?", /* S1_ESP4 */
2488 0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH4, IM_CTL,
2489 0x021, 1, 0x0, 0xffff},
2490 { "IPV4 AH encrypted?", /* S1_AH4 */
2491 0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL,
2492 0x021, 1, 0x0, 0xffff},
2493 { "IPV6 ESP encrypted?", /* S1_ESP6 */
2494#if 0
2495//@@@0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL, 0x021, 1, 0x0, 0xffff,
2496#endif
2497 0xff00, 0x3200, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL,
2498 0x021, 1, 0x0, 0xffff},
2499 { "IPV6 AH encrypted?", /* S1_AH6 */
2500#if 0
2501//@@@0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL, 0x021, 1, 0x0, 0xffff,
2502#endif
2503 0xff00, 0x3300, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL,
2504 0x021, 1, 0x0, 0xffff},
2505 { NULL },
2506};
2507#ifdef HP_ENCRYPT_DEFAULT
2508#define CAS_HP_FIRMWARE cas_prog_encryptiontab
2509#endif
2510#endif
2511
2512static cas_hp_inst_t cas_prog_null[] = { {NULL} };
2513#ifdef HP_NULL_DEFAULT
2514#define CAS_HP_FIRMWARE cas_prog_null
2515#endif
2516
2517/* firmware patch for NS_DP83065 */
2518typedef struct cas_saturn_patch {
2519 u16 addr;
2520 u16 val;
2521} cas_saturn_patch_t;
2522
2523#if 1
2524cas_saturn_patch_t cas_saturn_patch[] = {
2525{0x8200, 0x007e}, {0x8201, 0x0082}, {0x8202, 0x0009},
2526{0x8203, 0x0000}, {0x8204, 0x0000}, {0x8205, 0x0000},
2527{0x8206, 0x0000}, {0x8207, 0x0000}, {0x8208, 0x0000},
2528{0x8209, 0x008e}, {0x820a, 0x008e}, {0x820b, 0x00ff},
2529{0x820c, 0x00ce}, {0x820d, 0x0082}, {0x820e, 0x0025},
2530{0x820f, 0x00ff}, {0x8210, 0x0001}, {0x8211, 0x000f},
2531{0x8212, 0x00ce}, {0x8213, 0x0084}, {0x8214, 0x0026},
2532{0x8215, 0x00ff}, {0x8216, 0x0001}, {0x8217, 0x0011},
2533{0x8218, 0x00ce}, {0x8219, 0x0085}, {0x821a, 0x003d},
2534{0x821b, 0x00df}, {0x821c, 0x00e5}, {0x821d, 0x0086},
2535{0x821e, 0x0039}, {0x821f, 0x00b7}, {0x8220, 0x008f},
2536{0x8221, 0x00f8}, {0x8222, 0x007e}, {0x8223, 0x00c3},
2537{0x8224, 0x00c2}, {0x8225, 0x0096}, {0x8226, 0x0047},
2538{0x8227, 0x0084}, {0x8228, 0x00f3}, {0x8229, 0x008a},
2539{0x822a, 0x0000}, {0x822b, 0x0097}, {0x822c, 0x0047},
2540{0x822d, 0x00ce}, {0x822e, 0x0082}, {0x822f, 0x0033},
2541{0x8230, 0x00ff}, {0x8231, 0x0001}, {0x8232, 0x000f},
2542{0x8233, 0x0096}, {0x8234, 0x0046}, {0x8235, 0x0084},
2543{0x8236, 0x000c}, {0x8237, 0x0081}, {0x8238, 0x0004},
2544{0x8239, 0x0027}, {0x823a, 0x000b}, {0x823b, 0x0096},
2545{0x823c, 0x0046}, {0x823d, 0x0084}, {0x823e, 0x000c},
2546{0x823f, 0x0081}, {0x8240, 0x0008}, {0x8241, 0x0027},
2547{0x8242, 0x0057}, {0x8243, 0x007e}, {0x8244, 0x0084},
2548{0x8245, 0x0025}, {0x8246, 0x0096}, {0x8247, 0x0047},
2549{0x8248, 0x0084}, {0x8249, 0x00f3}, {0x824a, 0x008a},
2550{0x824b, 0x0004}, {0x824c, 0x0097}, {0x824d, 0x0047},
2551{0x824e, 0x00ce}, {0x824f, 0x0082}, {0x8250, 0x0054},
2552{0x8251, 0x00ff}, {0x8252, 0x0001}, {0x8253, 0x000f},
2553{0x8254, 0x0096}, {0x8255, 0x0046}, {0x8256, 0x0084},
2554{0x8257, 0x000c}, {0x8258, 0x0081}, {0x8259, 0x0004},
2555{0x825a, 0x0026}, {0x825b, 0x0038}, {0x825c, 0x00b6},
2556{0x825d, 0x0012}, {0x825e, 0x0020}, {0x825f, 0x0084},
2557{0x8260, 0x0020}, {0x8261, 0x0026}, {0x8262, 0x0003},
2558{0x8263, 0x007e}, {0x8264, 0x0084}, {0x8265, 0x0025},
2559{0x8266, 0x0096}, {0x8267, 0x007b}, {0x8268, 0x00d6},
2560{0x8269, 0x007c}, {0x826a, 0x00fe}, {0x826b, 0x008f},
2561{0x826c, 0x0056}, {0x826d, 0x00bd}, {0x826e, 0x00f7},
2562{0x826f, 0x00b6}, {0x8270, 0x00fe}, {0x8271, 0x008f},
2563{0x8272, 0x004e}, {0x8273, 0x00bd}, {0x8274, 0x00ec},
2564{0x8275, 0x008e}, {0x8276, 0x00bd}, {0x8277, 0x00fa},
2565{0x8278, 0x00f7}, {0x8279, 0x00bd}, {0x827a, 0x00f7},
2566{0x827b, 0x0028}, {0x827c, 0x00ce}, {0x827d, 0x0082},
2567{0x827e, 0x0082}, {0x827f, 0x00ff}, {0x8280, 0x0001},
2568{0x8281, 0x000f}, {0x8282, 0x0096}, {0x8283, 0x0046},
2569{0x8284, 0x0084}, {0x8285, 0x000c}, {0x8286, 0x0081},
2570{0x8287, 0x0004}, {0x8288, 0x0026}, {0x8289, 0x000a},
2571{0x828a, 0x00b6}, {0x828b, 0x0012}, {0x828c, 0x0020},
2572{0x828d, 0x0084}, {0x828e, 0x0020}, {0x828f, 0x0027},
2573{0x8290, 0x00b5}, {0x8291, 0x007e}, {0x8292, 0x0084},
2574{0x8293, 0x0025}, {0x8294, 0x00bd}, {0x8295, 0x00f7},
2575{0x8296, 0x001f}, {0x8297, 0x007e}, {0x8298, 0x0084},
2576{0x8299, 0x001f}, {0x829a, 0x0096}, {0x829b, 0x0047},
2577{0x829c, 0x0084}, {0x829d, 0x00f3}, {0x829e, 0x008a},
2578{0x829f, 0x0008}, {0x82a0, 0x0097}, {0x82a1, 0x0047},
2579{0x82a2, 0x00de}, {0x82a3, 0x00e1}, {0x82a4, 0x00ad},
2580{0x82a5, 0x0000}, {0x82a6, 0x00ce}, {0x82a7, 0x0082},
2581{0x82a8, 0x00af}, {0x82a9, 0x00ff}, {0x82aa, 0x0001},
2582{0x82ab, 0x000f}, {0x82ac, 0x007e}, {0x82ad, 0x0084},
2583{0x82ae, 0x0025}, {0x82af, 0x0096}, {0x82b0, 0x0041},
2584{0x82b1, 0x0085}, {0x82b2, 0x0010}, {0x82b3, 0x0026},
2585{0x82b4, 0x0006}, {0x82b5, 0x0096}, {0x82b6, 0x0023},
2586{0x82b7, 0x0085}, {0x82b8, 0x0040}, {0x82b9, 0x0027},
2587{0x82ba, 0x0006}, {0x82bb, 0x00bd}, {0x82bc, 0x00ed},
2588{0x82bd, 0x0000}, {0x82be, 0x007e}, {0x82bf, 0x0083},
2589{0x82c0, 0x00a2}, {0x82c1, 0x00de}, {0x82c2, 0x0042},
2590{0x82c3, 0x00bd}, {0x82c4, 0x00eb}, {0x82c5, 0x008e},
2591{0x82c6, 0x0096}, {0x82c7, 0x0024}, {0x82c8, 0x0084},
2592{0x82c9, 0x0008}, {0x82ca, 0x0027}, {0x82cb, 0x0003},
2593{0x82cc, 0x007e}, {0x82cd, 0x0083}, {0x82ce, 0x00df},
2594{0x82cf, 0x0096}, {0x82d0, 0x007b}, {0x82d1, 0x00d6},
2595{0x82d2, 0x007c}, {0x82d3, 0x00fe}, {0x82d4, 0x008f},
2596{0x82d5, 0x0056}, {0x82d6, 0x00bd}, {0x82d7, 0x00f7},
2597{0x82d8, 0x00b6}, {0x82d9, 0x00fe}, {0x82da, 0x008f},
2598{0x82db, 0x0050}, {0x82dc, 0x00bd}, {0x82dd, 0x00ec},
2599{0x82de, 0x008e}, {0x82df, 0x00bd}, {0x82e0, 0x00fa},
2600{0x82e1, 0x00f7}, {0x82e2, 0x0086}, {0x82e3, 0x0011},
2601{0x82e4, 0x00c6}, {0x82e5, 0x0049}, {0x82e6, 0x00bd},
2602{0x82e7, 0x00e4}, {0x82e8, 0x0012}, {0x82e9, 0x00ce},
2603{0x82ea, 0x0082}, {0x82eb, 0x00ef}, {0x82ec, 0x00ff},
2604{0x82ed, 0x0001}, {0x82ee, 0x000f}, {0x82ef, 0x0096},
2605{0x82f0, 0x0046}, {0x82f1, 0x0084}, {0x82f2, 0x000c},
2606{0x82f3, 0x0081}, {0x82f4, 0x0000}, {0x82f5, 0x0027},
2607{0x82f6, 0x0017}, {0x82f7, 0x00c6}, {0x82f8, 0x0049},
2608{0x82f9, 0x00bd}, {0x82fa, 0x00e4}, {0x82fb, 0x0091},
2609{0x82fc, 0x0024}, {0x82fd, 0x000d}, {0x82fe, 0x00b6},
2610{0x82ff, 0x0012}, {0x8300, 0x0020}, {0x8301, 0x0085},
2611{0x8302, 0x0020}, {0x8303, 0x0026}, {0x8304, 0x000c},
2612{0x8305, 0x00ce}, {0x8306, 0x0082}, {0x8307, 0x00c1},
2613{0x8308, 0x00ff}, {0x8309, 0x0001}, {0x830a, 0x000f},
2614{0x830b, 0x007e}, {0x830c, 0x0084}, {0x830d, 0x0025},
2615{0x830e, 0x007e}, {0x830f, 0x0084}, {0x8310, 0x0016},
2616{0x8311, 0x00fe}, {0x8312, 0x008f}, {0x8313, 0x0052},
2617{0x8314, 0x00bd}, {0x8315, 0x00ec}, {0x8316, 0x008e},
2618{0x8317, 0x00bd}, {0x8318, 0x00fa}, {0x8319, 0x00f7},
2619{0x831a, 0x0086}, {0x831b, 0x006a}, {0x831c, 0x00c6},
2620{0x831d, 0x0049}, {0x831e, 0x00bd}, {0x831f, 0x00e4},
2621{0x8320, 0x0012}, {0x8321, 0x00ce}, {0x8322, 0x0083},
2622{0x8323, 0x0027}, {0x8324, 0x00ff}, {0x8325, 0x0001},
2623{0x8326, 0x000f}, {0x8327, 0x0096}, {0x8328, 0x0046},
2624{0x8329, 0x0084}, {0x832a, 0x000c}, {0x832b, 0x0081},
2625{0x832c, 0x0000}, {0x832d, 0x0027}, {0x832e, 0x000a},
2626{0x832f, 0x00c6}, {0x8330, 0x0049}, {0x8331, 0x00bd},
2627{0x8332, 0x00e4}, {0x8333, 0x0091}, {0x8334, 0x0025},
2628{0x8335, 0x0006}, {0x8336, 0x007e}, {0x8337, 0x0084},
2629{0x8338, 0x0025}, {0x8339, 0x007e}, {0x833a, 0x0084},
2630{0x833b, 0x0016}, {0x833c, 0x00b6}, {0x833d, 0x0018},
2631{0x833e, 0x0070}, {0x833f, 0x00bb}, {0x8340, 0x0019},
2632{0x8341, 0x0070}, {0x8342, 0x002a}, {0x8343, 0x0004},
2633{0x8344, 0x0081}, {0x8345, 0x00af}, {0x8346, 0x002e},
2634{0x8347, 0x0019}, {0x8348, 0x0096}, {0x8349, 0x007b},
2635{0x834a, 0x00f6}, {0x834b, 0x0020}, {0x834c, 0x0007},
2636{0x834d, 0x00fa}, {0x834e, 0x0020}, {0x834f, 0x0027},
2637{0x8350, 0x00c4}, {0x8351, 0x0038}, {0x8352, 0x0081},
2638{0x8353, 0x0038}, {0x8354, 0x0027}, {0x8355, 0x000b},
2639{0x8356, 0x00f6}, {0x8357, 0x0020}, {0x8358, 0x0007},
2640{0x8359, 0x00fa}, {0x835a, 0x0020}, {0x835b, 0x0027},
2641{0x835c, 0x00cb}, {0x835d, 0x0008}, {0x835e, 0x007e},
2642{0x835f, 0x0082}, {0x8360, 0x00d3}, {0x8361, 0x00bd},
2643{0x8362, 0x00f7}, {0x8363, 0x0066}, {0x8364, 0x0086},
2644{0x8365, 0x0074}, {0x8366, 0x00c6}, {0x8367, 0x0049},
2645{0x8368, 0x00bd}, {0x8369, 0x00e4}, {0x836a, 0x0012},
2646{0x836b, 0x00ce}, {0x836c, 0x0083}, {0x836d, 0x0071},
2647{0x836e, 0x00ff}, {0x836f, 0x0001}, {0x8370, 0x000f},
2648{0x8371, 0x0096}, {0x8372, 0x0046}, {0x8373, 0x0084},
2649{0x8374, 0x000c}, {0x8375, 0x0081}, {0x8376, 0x0008},
2650{0x8377, 0x0026}, {0x8378, 0x000a}, {0x8379, 0x00c6},
2651{0x837a, 0x0049}, {0x837b, 0x00bd}, {0x837c, 0x00e4},
2652{0x837d, 0x0091}, {0x837e, 0x0025}, {0x837f, 0x0006},
2653{0x8380, 0x007e}, {0x8381, 0x0084}, {0x8382, 0x0025},
2654{0x8383, 0x007e}, {0x8384, 0x0084}, {0x8385, 0x0016},
2655{0x8386, 0x00bd}, {0x8387, 0x00f7}, {0x8388, 0x003e},
2656{0x8389, 0x0026}, {0x838a, 0x000e}, {0x838b, 0x00bd},
2657{0x838c, 0x00e5}, {0x838d, 0x0009}, {0x838e, 0x0026},
2658{0x838f, 0x0006}, {0x8390, 0x00ce}, {0x8391, 0x0082},
2659{0x8392, 0x00c1}, {0x8393, 0x00ff}, {0x8394, 0x0001},
2660{0x8395, 0x000f}, {0x8396, 0x007e}, {0x8397, 0x0084},
2661{0x8398, 0x0025}, {0x8399, 0x00fe}, {0x839a, 0x008f},
2662{0x839b, 0x0054}, {0x839c, 0x00bd}, {0x839d, 0x00ec},
2663{0x839e, 0x008e}, {0x839f, 0x00bd}, {0x83a0, 0x00fa},
2664{0x83a1, 0x00f7}, {0x83a2, 0x00bd}, {0x83a3, 0x00f7},
2665{0x83a4, 0x0033}, {0x83a5, 0x0086}, {0x83a6, 0x000f},
2666{0x83a7, 0x00c6}, {0x83a8, 0x0051}, {0x83a9, 0x00bd},
2667{0x83aa, 0x00e4}, {0x83ab, 0x0012}, {0x83ac, 0x00ce},
2668{0x83ad, 0x0083}, {0x83ae, 0x00b2}, {0x83af, 0x00ff},
2669{0x83b0, 0x0001}, {0x83b1, 0x000f}, {0x83b2, 0x0096},
2670{0x83b3, 0x0046}, {0x83b4, 0x0084}, {0x83b5, 0x000c},
2671{0x83b6, 0x0081}, {0x83b7, 0x0008}, {0x83b8, 0x0026},
2672{0x83b9, 0x005c}, {0x83ba, 0x00b6}, {0x83bb, 0x0012},
2673{0x83bc, 0x0020}, {0x83bd, 0x0084}, {0x83be, 0x003f},
2674{0x83bf, 0x0081}, {0x83c0, 0x003a}, {0x83c1, 0x0027},
2675{0x83c2, 0x001c}, {0x83c3, 0x0096}, {0x83c4, 0x0023},
2676{0x83c5, 0x0085}, {0x83c6, 0x0040}, {0x83c7, 0x0027},
2677{0x83c8, 0x0003}, {0x83c9, 0x007e}, {0x83ca, 0x0084},
2678{0x83cb, 0x0025}, {0x83cc, 0x00c6}, {0x83cd, 0x0051},
2679{0x83ce, 0x00bd}, {0x83cf, 0x00e4}, {0x83d0, 0x0091},
2680{0x83d1, 0x0025}, {0x83d2, 0x0003}, {0x83d3, 0x007e},
2681{0x83d4, 0x0084}, {0x83d5, 0x0025}, {0x83d6, 0x00ce},
2682{0x83d7, 0x0082}, {0x83d8, 0x00c1}, {0x83d9, 0x00ff},
2683{0x83da, 0x0001}, {0x83db, 0x000f}, {0x83dc, 0x007e},
2684{0x83dd, 0x0084}, {0x83de, 0x0025}, {0x83df, 0x00bd},
2685{0x83e0, 0x00f8}, {0x83e1, 0x0037}, {0x83e2, 0x007c},
2686{0x83e3, 0x0000}, {0x83e4, 0x007a}, {0x83e5, 0x00ce},
2687{0x83e6, 0x0083}, {0x83e7, 0x00ee}, {0x83e8, 0x00ff},
2688{0x83e9, 0x0001}, {0x83ea, 0x000f}, {0x83eb, 0x007e},
2689{0x83ec, 0x0084}, {0x83ed, 0x0025}, {0x83ee, 0x0096},
2690{0x83ef, 0x0046}, {0x83f0, 0x0084}, {0x83f1, 0x000c},
2691{0x83f2, 0x0081}, {0x83f3, 0x0008}, {0x83f4, 0x0026},
2692{0x83f5, 0x0020}, {0x83f6, 0x0096}, {0x83f7, 0x0024},
2693{0x83f8, 0x0084}, {0x83f9, 0x0008}, {0x83fa, 0x0026},
2694{0x83fb, 0x0029}, {0x83fc, 0x00b6}, {0x83fd, 0x0018},
2695{0x83fe, 0x0082}, {0x83ff, 0x00bb}, {0x8400, 0x0019},
2696{0x8401, 0x0082}, {0x8402, 0x00b1}, {0x8403, 0x0001},
2697{0x8404, 0x003b}, {0x8405, 0x0022}, {0x8406, 0x0009},
2698{0x8407, 0x00b6}, {0x8408, 0x0012}, {0x8409, 0x0020},
2699{0x840a, 0x0084}, {0x840b, 0x0037}, {0x840c, 0x0081},
2700{0x840d, 0x0032}, {0x840e, 0x0027}, {0x840f, 0x0015},
2701{0x8410, 0x00bd}, {0x8411, 0x00f8}, {0x8412, 0x0044},
2702{0x8413, 0x007e}, {0x8414, 0x0082}, {0x8415, 0x00c1},
2703{0x8416, 0x00bd}, {0x8417, 0x00f7}, {0x8418, 0x001f},
2704{0x8419, 0x00bd}, {0x841a, 0x00f8}, {0x841b, 0x0044},
2705{0x841c, 0x00bd}, {0x841d, 0x00fc}, {0x841e, 0x0029},
2706{0x841f, 0x00ce}, {0x8420, 0x0082}, {0x8421, 0x0025},
2707{0x8422, 0x00ff}, {0x8423, 0x0001}, {0x8424, 0x000f},
2708{0x8425, 0x0039}, {0x8426, 0x0096}, {0x8427, 0x0047},
2709{0x8428, 0x0084}, {0x8429, 0x00fc}, {0x842a, 0x008a},
2710{0x842b, 0x0000}, {0x842c, 0x0097}, {0x842d, 0x0047},
2711{0x842e, 0x00ce}, {0x842f, 0x0084}, {0x8430, 0x0034},
2712{0x8431, 0x00ff}, {0x8432, 0x0001}, {0x8433, 0x0011},
2713{0x8434, 0x0096}, {0x8435, 0x0046}, {0x8436, 0x0084},
2714{0x8437, 0x0003}, {0x8438, 0x0081}, {0x8439, 0x0002},
2715{0x843a, 0x0027}, {0x843b, 0x0003}, {0x843c, 0x007e},
2716{0x843d, 0x0085}, {0x843e, 0x001e}, {0x843f, 0x0096},
2717{0x8440, 0x0047}, {0x8441, 0x0084}, {0x8442, 0x00fc},
2718{0x8443, 0x008a}, {0x8444, 0x0002}, {0x8445, 0x0097},
2719{0x8446, 0x0047}, {0x8447, 0x00de}, {0x8448, 0x00e1},
2720{0x8449, 0x00ad}, {0x844a, 0x0000}, {0x844b, 0x0086},
2721{0x844c, 0x0001}, {0x844d, 0x00b7}, {0x844e, 0x0012},
2722{0x844f, 0x0051}, {0x8450, 0x00bd}, {0x8451, 0x00f7},
2723{0x8452, 0x0014}, {0x8453, 0x00b6}, {0x8454, 0x0010},
2724{0x8455, 0x0031}, {0x8456, 0x0084}, {0x8457, 0x00fd},
2725{0x8458, 0x00b7}, {0x8459, 0x0010}, {0x845a, 0x0031},
2726{0x845b, 0x00bd}, {0x845c, 0x00f8}, {0x845d, 0x001e},
2727{0x845e, 0x0096}, {0x845f, 0x0081}, {0x8460, 0x00d6},
2728{0x8461, 0x0082}, {0x8462, 0x00fe}, {0x8463, 0x008f},
2729{0x8464, 0x005a}, {0x8465, 0x00bd}, {0x8466, 0x00f7},
2730{0x8467, 0x00b6}, {0x8468, 0x00fe}, {0x8469, 0x008f},
2731{0x846a, 0x005c}, {0x846b, 0x00bd}, {0x846c, 0x00ec},
2732{0x846d, 0x008e}, {0x846e, 0x00bd}, {0x846f, 0x00fa},
2733{0x8470, 0x00f7}, {0x8471, 0x0086}, {0x8472, 0x0008},
2734{0x8473, 0x00d6}, {0x8474, 0x0000}, {0x8475, 0x00c5},
2735{0x8476, 0x0010}, {0x8477, 0x0026}, {0x8478, 0x0002},
2736{0x8479, 0x008b}, {0x847a, 0x0020}, {0x847b, 0x00c6},
2737{0x847c, 0x0051}, {0x847d, 0x00bd}, {0x847e, 0x00e4},
2738{0x847f, 0x0012}, {0x8480, 0x00ce}, {0x8481, 0x0084},
2739{0x8482, 0x0086}, {0x8483, 0x00ff}, {0x8484, 0x0001},
2740{0x8485, 0x0011}, {0x8486, 0x0096}, {0x8487, 0x0046},
2741{0x8488, 0x0084}, {0x8489, 0x0003}, {0x848a, 0x0081},
2742{0x848b, 0x0002}, {0x848c, 0x0027}, {0x848d, 0x0003},
2743{0x848e, 0x007e}, {0x848f, 0x0085}, {0x8490, 0x000f},
2744{0x8491, 0x00c6}, {0x8492, 0x0051}, {0x8493, 0x00bd},
2745{0x8494, 0x00e4}, {0x8495, 0x0091}, {0x8496, 0x0025},
2746{0x8497, 0x0003}, {0x8498, 0x007e}, {0x8499, 0x0085},
2747{0x849a, 0x001e}, {0x849b, 0x0096}, {0x849c, 0x0044},
2748{0x849d, 0x0085}, {0x849e, 0x0010}, {0x849f, 0x0026},
2749{0x84a0, 0x000a}, {0x84a1, 0x00b6}, {0x84a2, 0x0012},
2750{0x84a3, 0x0050}, {0x84a4, 0x00ba}, {0x84a5, 0x0001},
2751{0x84a6, 0x003c}, {0x84a7, 0x0085}, {0x84a8, 0x0010},
2752{0x84a9, 0x0027}, {0x84aa, 0x00a8}, {0x84ab, 0x00bd},
2753{0x84ac, 0x00f7}, {0x84ad, 0x0066}, {0x84ae, 0x00ce},
2754{0x84af, 0x0084}, {0x84b0, 0x00b7}, {0x84b1, 0x00ff},
2755{0x84b2, 0x0001}, {0x84b3, 0x0011}, {0x84b4, 0x007e},
2756{0x84b5, 0x0085}, {0x84b6, 0x001e}, {0x84b7, 0x0096},
2757{0x84b8, 0x0046}, {0x84b9, 0x0084}, {0x84ba, 0x0003},
2758{0x84bb, 0x0081}, {0x84bc, 0x0002}, {0x84bd, 0x0026},
2759{0x84be, 0x0050}, {0x84bf, 0x00b6}, {0x84c0, 0x0012},
2760{0x84c1, 0x0030}, {0x84c2, 0x0084}, {0x84c3, 0x0003},
2761{0x84c4, 0x0081}, {0x84c5, 0x0001}, {0x84c6, 0x0027},
2762{0x84c7, 0x0003}, {0x84c8, 0x007e}, {0x84c9, 0x0085},
2763{0x84ca, 0x001e}, {0x84cb, 0x0096}, {0x84cc, 0x0044},
2764{0x84cd, 0x0085}, {0x84ce, 0x0010}, {0x84cf, 0x0026},
2765{0x84d0, 0x0013}, {0x84d1, 0x00b6}, {0x84d2, 0x0012},
2766{0x84d3, 0x0050}, {0x84d4, 0x00ba}, {0x84d5, 0x0001},
2767{0x84d6, 0x003c}, {0x84d7, 0x0085}, {0x84d8, 0x0010},
2768{0x84d9, 0x0026}, {0x84da, 0x0009}, {0x84db, 0x00ce},
2769{0x84dc, 0x0084}, {0x84dd, 0x0053}, {0x84de, 0x00ff},
2770{0x84df, 0x0001}, {0x84e0, 0x0011}, {0x84e1, 0x007e},
2771{0x84e2, 0x0085}, {0x84e3, 0x001e}, {0x84e4, 0x00b6},
2772{0x84e5, 0x0010}, {0x84e6, 0x0031}, {0x84e7, 0x008a},
2773{0x84e8, 0x0002}, {0x84e9, 0x00b7}, {0x84ea, 0x0010},
2774{0x84eb, 0x0031}, {0x84ec, 0x00bd}, {0x84ed, 0x0085},
2775{0x84ee, 0x001f}, {0x84ef, 0x00bd}, {0x84f0, 0x00f8},
2776{0x84f1, 0x0037}, {0x84f2, 0x007c}, {0x84f3, 0x0000},
2777{0x84f4, 0x0080}, {0x84f5, 0x00ce}, {0x84f6, 0x0084},
2778{0x84f7, 0x00fe}, {0x84f8, 0x00ff}, {0x84f9, 0x0001},
2779{0x84fa, 0x0011}, {0x84fb, 0x007e}, {0x84fc, 0x0085},
2780{0x84fd, 0x001e}, {0x84fe, 0x0096}, {0x84ff, 0x0046},
2781{0x8500, 0x0084}, {0x8501, 0x0003}, {0x8502, 0x0081},
2782{0x8503, 0x0002}, {0x8504, 0x0026}, {0x8505, 0x0009},
2783{0x8506, 0x00b6}, {0x8507, 0x0012}, {0x8508, 0x0030},
2784{0x8509, 0x0084}, {0x850a, 0x0003}, {0x850b, 0x0081},
2785{0x850c, 0x0001}, {0x850d, 0x0027}, {0x850e, 0x000f},
2786{0x850f, 0x00bd}, {0x8510, 0x00f8}, {0x8511, 0x0044},
2787{0x8512, 0x00bd}, {0x8513, 0x00f7}, {0x8514, 0x000b},
2788{0x8515, 0x00bd}, {0x8516, 0x00fc}, {0x8517, 0x0029},
2789{0x8518, 0x00ce}, {0x8519, 0x0084}, {0x851a, 0x0026},
2790{0x851b, 0x00ff}, {0x851c, 0x0001}, {0x851d, 0x0011},
2791{0x851e, 0x0039}, {0x851f, 0x00d6}, {0x8520, 0x0022},
2792{0x8521, 0x00c4}, {0x8522, 0x000f}, {0x8523, 0x00b6},
2793{0x8524, 0x0012}, {0x8525, 0x0030}, {0x8526, 0x00ba},
2794{0x8527, 0x0012}, {0x8528, 0x0032}, {0x8529, 0x0084},
2795{0x852a, 0x0004}, {0x852b, 0x0027}, {0x852c, 0x000d},
2796{0x852d, 0x0096}, {0x852e, 0x0022}, {0x852f, 0x0085},
2797{0x8530, 0x0004}, {0x8531, 0x0027}, {0x8532, 0x0005},
2798{0x8533, 0x00ca}, {0x8534, 0x0010}, {0x8535, 0x007e},
2799{0x8536, 0x0085}, {0x8537, 0x003a}, {0x8538, 0x00ca},
2800{0x8539, 0x0020}, {0x853a, 0x00d7}, {0x853b, 0x0022},
2801{0x853c, 0x0039}, {0x853d, 0x0086}, {0x853e, 0x0000},
2802{0x853f, 0x0097}, {0x8540, 0x0083}, {0x8541, 0x0018},
2803{0x8542, 0x00ce}, {0x8543, 0x001c}, {0x8544, 0x0000},
2804{0x8545, 0x00bd}, {0x8546, 0x00eb}, {0x8547, 0x0046},
2805{0x8548, 0x0096}, {0x8549, 0x0057}, {0x854a, 0x0085},
2806{0x854b, 0x0001}, {0x854c, 0x0027}, {0x854d, 0x0002},
2807{0x854e, 0x004f}, {0x854f, 0x0039}, {0x8550, 0x0085},
2808{0x8551, 0x0002}, {0x8552, 0x0027}, {0x8553, 0x0001},
2809{0x8554, 0x0039}, {0x8555, 0x007f}, {0x8556, 0x008f},
2810{0x8557, 0x007d}, {0x8558, 0x0086}, {0x8559, 0x0004},
2811{0x855a, 0x00b7}, {0x855b, 0x0012}, {0x855c, 0x0004},
2812{0x855d, 0x0086}, {0x855e, 0x0008}, {0x855f, 0x00b7},
2813{0x8560, 0x0012}, {0x8561, 0x0007}, {0x8562, 0x0086},
2814{0x8563, 0x0010}, {0x8564, 0x00b7}, {0x8565, 0x0012},
2815{0x8566, 0x000c}, {0x8567, 0x0086}, {0x8568, 0x0007},
2816{0x8569, 0x00b7}, {0x856a, 0x0012}, {0x856b, 0x0006},
2817{0x856c, 0x00b6}, {0x856d, 0x008f}, {0x856e, 0x007d},
2818{0x856f, 0x00b7}, {0x8570, 0x0012}, {0x8571, 0x0070},
2819{0x8572, 0x0086}, {0x8573, 0x0001}, {0x8574, 0x00ba},
2820{0x8575, 0x0012}, {0x8576, 0x0004}, {0x8577, 0x00b7},
2821{0x8578, 0x0012}, {0x8579, 0x0004}, {0x857a, 0x0001},
2822{0x857b, 0x0001}, {0x857c, 0x0001}, {0x857d, 0x0001},
2823{0x857e, 0x0001}, {0x857f, 0x0001}, {0x8580, 0x00b6},
2824{0x8581, 0x0012}, {0x8582, 0x0004}, {0x8583, 0x0084},
2825{0x8584, 0x00fe}, {0x8585, 0x008a}, {0x8586, 0x0002},
2826{0x8587, 0x00b7}, {0x8588, 0x0012}, {0x8589, 0x0004},
2827{0x858a, 0x0001}, {0x858b, 0x0001}, {0x858c, 0x0001},
2828{0x858d, 0x0001}, {0x858e, 0x0001}, {0x858f, 0x0001},
2829{0x8590, 0x0086}, {0x8591, 0x00fd}, {0x8592, 0x00b4},
2830{0x8593, 0x0012}, {0x8594, 0x0004}, {0x8595, 0x00b7},
2831{0x8596, 0x0012}, {0x8597, 0x0004}, {0x8598, 0x00b6},
2832{0x8599, 0x0012}, {0x859a, 0x0000}, {0x859b, 0x0084},
2833{0x859c, 0x0008}, {0x859d, 0x0081}, {0x859e, 0x0008},
2834{0x859f, 0x0027}, {0x85a0, 0x0016}, {0x85a1, 0x00b6},
2835{0x85a2, 0x008f}, {0x85a3, 0x007d}, {0x85a4, 0x0081},
2836{0x85a5, 0x000c}, {0x85a6, 0x0027}, {0x85a7, 0x0008},
2837{0x85a8, 0x008b}, {0x85a9, 0x0004}, {0x85aa, 0x00b7},
2838{0x85ab, 0x008f}, {0x85ac, 0x007d}, {0x85ad, 0x007e},
2839{0x85ae, 0x0085}, {0x85af, 0x006c}, {0x85b0, 0x0086},
2840{0x85b1, 0x0003}, {0x85b2, 0x0097}, {0x85b3, 0x0040},
2841{0x85b4, 0x007e}, {0x85b5, 0x0089}, {0x85b6, 0x006e},
2842{0x85b7, 0x0086}, {0x85b8, 0x0007}, {0x85b9, 0x00b7},
2843{0x85ba, 0x0012}, {0x85bb, 0x0006}, {0x85bc, 0x005f},
2844{0x85bd, 0x00f7}, {0x85be, 0x008f}, {0x85bf, 0x0082},
2845{0x85c0, 0x005f}, {0x85c1, 0x00f7}, {0x85c2, 0x008f},
2846{0x85c3, 0x007f}, {0x85c4, 0x00f7}, {0x85c5, 0x008f},
2847{0x85c6, 0x0070}, {0x85c7, 0x00f7}, {0x85c8, 0x008f},
2848{0x85c9, 0x0071}, {0x85ca, 0x00f7}, {0x85cb, 0x008f},
2849{0x85cc, 0x0072}, {0x85cd, 0x00f7}, {0x85ce, 0x008f},
2850{0x85cf, 0x0073}, {0x85d0, 0x00f7}, {0x85d1, 0x008f},
2851{0x85d2, 0x0074}, {0x85d3, 0x00f7}, {0x85d4, 0x008f},
2852{0x85d5, 0x0075}, {0x85d6, 0x00f7}, {0x85d7, 0x008f},
2853{0x85d8, 0x0076}, {0x85d9, 0x00f7}, {0x85da, 0x008f},
2854{0x85db, 0x0077}, {0x85dc, 0x00f7}, {0x85dd, 0x008f},
2855{0x85de, 0x0078}, {0x85df, 0x00f7}, {0x85e0, 0x008f},
2856{0x85e1, 0x0079}, {0x85e2, 0x00f7}, {0x85e3, 0x008f},
2857{0x85e4, 0x007a}, {0x85e5, 0x00f7}, {0x85e6, 0x008f},
2858{0x85e7, 0x007b}, {0x85e8, 0x00b6}, {0x85e9, 0x0012},
2859{0x85ea, 0x0004}, {0x85eb, 0x008a}, {0x85ec, 0x0010},
2860{0x85ed, 0x00b7}, {0x85ee, 0x0012}, {0x85ef, 0x0004},
2861{0x85f0, 0x0086}, {0x85f1, 0x00e4}, {0x85f2, 0x00b7},
2862{0x85f3, 0x0012}, {0x85f4, 0x0070}, {0x85f5, 0x00b7},
2863{0x85f6, 0x0012}, {0x85f7, 0x0007}, {0x85f8, 0x00f7},
2864{0x85f9, 0x0012}, {0x85fa, 0x0005}, {0x85fb, 0x00f7},
2865{0x85fc, 0x0012}, {0x85fd, 0x0009}, {0x85fe, 0x0086},
2866{0x85ff, 0x0008}, {0x8600, 0x00ba}, {0x8601, 0x0012},
2867{0x8602, 0x0004}, {0x8603, 0x00b7}, {0x8604, 0x0012},
2868{0x8605, 0x0004}, {0x8606, 0x0086}, {0x8607, 0x00f7},
2869{0x8608, 0x00b4}, {0x8609, 0x0012}, {0x860a, 0x0004},
2870{0x860b, 0x00b7}, {0x860c, 0x0012}, {0x860d, 0x0004},
2871{0x860e, 0x0001}, {0x860f, 0x0001}, {0x8610, 0x0001},
2872{0x8611, 0x0001}, {0x8612, 0x0001}, {0x8613, 0x0001},
2873{0x8614, 0x00b6}, {0x8615, 0x0012}, {0x8616, 0x0008},
2874{0x8617, 0x0027}, {0x8618, 0x007f}, {0x8619, 0x0081},
2875{0x861a, 0x0080}, {0x861b, 0x0026}, {0x861c, 0x000b},
2876{0x861d, 0x0086}, {0x861e, 0x0008}, {0x861f, 0x00ce},
2877{0x8620, 0x008f}, {0x8621, 0x0079}, {0x8622, 0x00bd},
2878{0x8623, 0x0089}, {0x8624, 0x007b}, {0x8625, 0x007e},
2879{0x8626, 0x0086}, {0x8627, 0x008e}, {0x8628, 0x0081},
2880{0x8629, 0x0040}, {0x862a, 0x0026}, {0x862b, 0x000b},
2881{0x862c, 0x0086}, {0x862d, 0x0004}, {0x862e, 0x00ce},
2882{0x862f, 0x008f}, {0x8630, 0x0076}, {0x8631, 0x00bd},
2883{0x8632, 0x0089}, {0x8633, 0x007b}, {0x8634, 0x007e},
2884{0x8635, 0x0086}, {0x8636, 0x008e}, {0x8637, 0x0081},
2885{0x8638, 0x0020}, {0x8639, 0x0026}, {0x863a, 0x000b},
2886{0x863b, 0x0086}, {0x863c, 0x0002}, {0x863d, 0x00ce},
2887{0x863e, 0x008f}, {0x863f, 0x0073}, {0x8640, 0x00bd},
2888{0x8641, 0x0089}, {0x8642, 0x007b}, {0x8643, 0x007e},
2889{0x8644, 0x0086}, {0x8645, 0x008e}, {0x8646, 0x0081},
2890{0x8647, 0x0010}, {0x8648, 0x0026}, {0x8649, 0x000b},
2891{0x864a, 0x0086}, {0x864b, 0x0001}, {0x864c, 0x00ce},
2892{0x864d, 0x008f}, {0x864e, 0x0070}, {0x864f, 0x00bd},
2893{0x8650, 0x0089}, {0x8651, 0x007b}, {0x8652, 0x007e},
2894{0x8653, 0x0086}, {0x8654, 0x008e}, {0x8655, 0x0081},
2895{0x8656, 0x0008}, {0x8657, 0x0026}, {0x8658, 0x000b},
2896{0x8659, 0x0086}, {0x865a, 0x0008}, {0x865b, 0x00ce},
2897{0x865c, 0x008f}, {0x865d, 0x0079}, {0x865e, 0x00bd},
2898{0x865f, 0x0089}, {0x8660, 0x007f}, {0x8661, 0x007e},
2899{0x8662, 0x0086}, {0x8663, 0x008e}, {0x8664, 0x0081},
2900{0x8665, 0x0004}, {0x8666, 0x0026}, {0x8667, 0x000b},
2901{0x8668, 0x0086}, {0x8669, 0x0004}, {0x866a, 0x00ce},
2902{0x866b, 0x008f}, {0x866c, 0x0076}, {0x866d, 0x00bd},
2903{0x866e, 0x0089}, {0x866f, 0x007f}, {0x8670, 0x007e},
2904{0x8671, 0x0086}, {0x8672, 0x008e}, {0x8673, 0x0081},
2905{0x8674, 0x0002}, {0x8675, 0x0026}, {0x8676, 0x000b},
2906{0x8677, 0x008a}, {0x8678, 0x0002}, {0x8679, 0x00ce},
2907{0x867a, 0x008f}, {0x867b, 0x0073}, {0x867c, 0x00bd},
2908{0x867d, 0x0089}, {0x867e, 0x007f}, {0x867f, 0x007e},
2909{0x8680, 0x0086}, {0x8681, 0x008e}, {0x8682, 0x0081},
2910{0x8683, 0x0001}, {0x8684, 0x0026}, {0x8685, 0x0008},
2911{0x8686, 0x0086}, {0x8687, 0x0001}, {0x8688, 0x00ce},
2912{0x8689, 0x008f}, {0x868a, 0x0070}, {0x868b, 0x00bd},
2913{0x868c, 0x0089}, {0x868d, 0x007f}, {0x868e, 0x00b6},
2914{0x868f, 0x008f}, {0x8690, 0x007f}, {0x8691, 0x0081},
2915{0x8692, 0x000f}, {0x8693, 0x0026}, {0x8694, 0x0003},
2916{0x8695, 0x007e}, {0x8696, 0x0087}, {0x8697, 0x0047},
2917{0x8698, 0x00b6}, {0x8699, 0x0012}, {0x869a, 0x0009},
2918{0x869b, 0x0084}, {0x869c, 0x0003}, {0x869d, 0x0081},
2919{0x869e, 0x0003}, {0x869f, 0x0027}, {0x86a0, 0x0006},
2920{0x86a1, 0x007c}, {0x86a2, 0x0012}, {0x86a3, 0x0009},
2921{0x86a4, 0x007e}, {0x86a5, 0x0085}, {0x86a6, 0x00fe},
2922{0x86a7, 0x00b6}, {0x86a8, 0x0012}, {0x86a9, 0x0006},
2923{0x86aa, 0x0084}, {0x86ab, 0x0007}, {0x86ac, 0x0081},
2924{0x86ad, 0x0007}, {0x86ae, 0x0027}, {0x86af, 0x0008},
2925{0x86b0, 0x008b}, {0x86b1, 0x0001}, {0x86b2, 0x00b7},
2926{0x86b3, 0x0012}, {0x86b4, 0x0006}, {0x86b5, 0x007e},
2927{0x86b6, 0x0086}, {0x86b7, 0x00d5}, {0x86b8, 0x00b6},
2928{0x86b9, 0x008f}, {0x86ba, 0x0082}, {0x86bb, 0x0026},
2929{0x86bc, 0x000a}, {0x86bd, 0x007c}, {0x86be, 0x008f},
2930{0x86bf, 0x0082}, {0x86c0, 0x004f}, {0x86c1, 0x00b7},
2931{0x86c2, 0x0012}, {0x86c3, 0x0006}, {0x86c4, 0x007e},
2932{0x86c5, 0x0085}, {0x86c6, 0x00c0}, {0x86c7, 0x00b6},
2933{0x86c8, 0x0012}, {0x86c9, 0x0006}, {0x86ca, 0x0084},
2934{0x86cb, 0x003f}, {0x86cc, 0x0081}, {0x86cd, 0x003f},
2935{0x86ce, 0x0027}, {0x86cf, 0x0010}, {0x86d0, 0x008b},
2936{0x86d1, 0x0008}, {0x86d2, 0x00b7}, {0x86d3, 0x0012},
2937{0x86d4, 0x0006}, {0x86d5, 0x00b6}, {0x86d6, 0x0012},
2938{0x86d7, 0x0009}, {0x86d8, 0x0084}, {0x86d9, 0x00fc},
2939{0x86da, 0x00b7}, {0x86db, 0x0012}, {0x86dc, 0x0009},
2940{0x86dd, 0x007e}, {0x86de, 0x0085}, {0x86df, 0x00fe},
2941{0x86e0, 0x00ce}, {0x86e1, 0x008f}, {0x86e2, 0x0070},
2942{0x86e3, 0x0018}, {0x86e4, 0x00ce}, {0x86e5, 0x008f},
2943{0x86e6, 0x0084}, {0x86e7, 0x00c6}, {0x86e8, 0x000c},
2944{0x86e9, 0x00bd}, {0x86ea, 0x0089}, {0x86eb, 0x006f},
2945{0x86ec, 0x00ce}, {0x86ed, 0x008f}, {0x86ee, 0x0084},
2946{0x86ef, 0x0018}, {0x86f0, 0x00ce}, {0x86f1, 0x008f},
2947{0x86f2, 0x0070}, {0x86f3, 0x00c6}, {0x86f4, 0x000c},
2948{0x86f5, 0x00bd}, {0x86f6, 0x0089}, {0x86f7, 0x006f},
2949{0x86f8, 0x00d6}, {0x86f9, 0x0083}, {0x86fa, 0x00c1},
2950{0x86fb, 0x004f}, {0x86fc, 0x002d}, {0x86fd, 0x0003},
2951{0x86fe, 0x007e}, {0x86ff, 0x0087}, {0x8700, 0x0040},
2952{0x8701, 0x00b6}, {0x8702, 0x008f}, {0x8703, 0x007f},
2953{0x8704, 0x0081}, {0x8705, 0x0007}, {0x8706, 0x0027},
2954{0x8707, 0x000f}, {0x8708, 0x0081}, {0x8709, 0x000b},
2955{0x870a, 0x0027}, {0x870b, 0x0015}, {0x870c, 0x0081},
2956{0x870d, 0x000d}, {0x870e, 0x0027}, {0x870f, 0x001b},
2957{0x8710, 0x0081}, {0x8711, 0x000e}, {0x8712, 0x0027},
2958{0x8713, 0x0021}, {0x8714, 0x007e}, {0x8715, 0x0087},
2959{0x8716, 0x0040}, {0x8717, 0x00f7}, {0x8718, 0x008f},
2960{0x8719, 0x007b}, {0x871a, 0x0086}, {0x871b, 0x0002},
2961{0x871c, 0x00b7}, {0x871d, 0x008f}, {0x871e, 0x007a},
2962{0x871f, 0x0020}, {0x8720, 0x001c}, {0x8721, 0x00f7},
2963{0x8722, 0x008f}, {0x8723, 0x0078}, {0x8724, 0x0086},
2964{0x8725, 0x0002}, {0x8726, 0x00b7}, {0x8727, 0x008f},
2965{0x8728, 0x0077}, {0x8729, 0x0020}, {0x872a, 0x0012},
2966{0x872b, 0x00f7}, {0x872c, 0x008f}, {0x872d, 0x0075},
2967{0x872e, 0x0086}, {0x872f, 0x0002}, {0x8730, 0x00b7},
2968{0x8731, 0x008f}, {0x8732, 0x0074}, {0x8733, 0x0020},
2969{0x8734, 0x0008}, {0x8735, 0x00f7}, {0x8736, 0x008f},
2970{0x8737, 0x0072}, {0x8738, 0x0086}, {0x8739, 0x0002},
2971{0x873a, 0x00b7}, {0x873b, 0x008f}, {0x873c, 0x0071},
2972{0x873d, 0x007e}, {0x873e, 0x0087}, {0x873f, 0x0047},
2973{0x8740, 0x0086}, {0x8741, 0x0004}, {0x8742, 0x0097},
2974{0x8743, 0x0040}, {0x8744, 0x007e}, {0x8745, 0x0089},
2975{0x8746, 0x006e}, {0x8747, 0x00ce}, {0x8748, 0x008f},
2976{0x8749, 0x0072}, {0x874a, 0x00bd}, {0x874b, 0x0089},
2977{0x874c, 0x00f7}, {0x874d, 0x00ce}, {0x874e, 0x008f},
2978{0x874f, 0x0075}, {0x8750, 0x00bd}, {0x8751, 0x0089},
2979{0x8752, 0x00f7}, {0x8753, 0x00ce}, {0x8754, 0x008f},
2980{0x8755, 0x0078}, {0x8756, 0x00bd}, {0x8757, 0x0089},
2981{0x8758, 0x00f7}, {0x8759, 0x00ce}, {0x875a, 0x008f},
2982{0x875b, 0x007b}, {0x875c, 0x00bd}, {0x875d, 0x0089},
2983{0x875e, 0x00f7}, {0x875f, 0x004f}, {0x8760, 0x00b7},
2984{0x8761, 0x008f}, {0x8762, 0x007d}, {0x8763, 0x00b7},
2985{0x8764, 0x008f}, {0x8765, 0x0081}, {0x8766, 0x00b6},
2986{0x8767, 0x008f}, {0x8768, 0x0072}, {0x8769, 0x0027},
2987{0x876a, 0x0047}, {0x876b, 0x007c}, {0x876c, 0x008f},
2988{0x876d, 0x007d}, {0x876e, 0x00b6}, {0x876f, 0x008f},
2989{0x8770, 0x0075}, {0x8771, 0x0027}, {0x8772, 0x003f},
2990{0x8773, 0x007c}, {0x8774, 0x008f}, {0x8775, 0x007d},
2991{0x8776, 0x00b6}, {0x8777, 0x008f}, {0x8778, 0x0078},
2992{0x8779, 0x0027}, {0x877a, 0x0037}, {0x877b, 0x007c},
2993{0x877c, 0x008f}, {0x877d, 0x007d}, {0x877e, 0x00b6},
2994{0x877f, 0x008f}, {0x8780, 0x007b}, {0x8781, 0x0027},
2995{0x8782, 0x002f}, {0x8783, 0x007f}, {0x8784, 0x008f},
2996{0x8785, 0x007d}, {0x8786, 0x007c}, {0x8787, 0x008f},
2997{0x8788, 0x0081}, {0x8789, 0x007a}, {0x878a, 0x008f},
2998{0x878b, 0x0072}, {0x878c, 0x0027}, {0x878d, 0x001b},
2999{0x878e, 0x007c}, {0x878f, 0x008f}, {0x8790, 0x007d},
3000{0x8791, 0x007a}, {0x8792, 0x008f}, {0x8793, 0x0075},
3001{0x8794, 0x0027}, {0x8795, 0x0016}, {0x8796, 0x007c},
3002{0x8797, 0x008f}, {0x8798, 0x007d}, {0x8799, 0x007a},
3003{0x879a, 0x008f}, {0x879b, 0x0078}, {0x879c, 0x0027},
3004{0x879d, 0x0011}, {0x879e, 0x007c}, {0x879f, 0x008f},
3005{0x87a0, 0x007d}, {0x87a1, 0x007a}, {0x87a2, 0x008f},
3006{0x87a3, 0x007b}, {0x87a4, 0x0027}, {0x87a5, 0x000c},
3007{0x87a6, 0x007e}, {0x87a7, 0x0087}, {0x87a8, 0x0083},
3008{0x87a9, 0x007a}, {0x87aa, 0x008f}, {0x87ab, 0x0075},
3009{0x87ac, 0x007a}, {0x87ad, 0x008f}, {0x87ae, 0x0078},
3010{0x87af, 0x007a}, {0x87b0, 0x008f}, {0x87b1, 0x007b},
3011{0x87b2, 0x00ce}, {0x87b3, 0x00c1}, {0x87b4, 0x00fc},
3012{0x87b5, 0x00f6}, {0x87b6, 0x008f}, {0x87b7, 0x007d},
3013{0x87b8, 0x003a}, {0x87b9, 0x00a6}, {0x87ba, 0x0000},
3014{0x87bb, 0x00b7}, {0x87bc, 0x0012}, {0x87bd, 0x0070},
3015{0x87be, 0x00b6}, {0x87bf, 0x008f}, {0x87c0, 0x0072},
3016{0x87c1, 0x0026}, {0x87c2, 0x0003}, {0x87c3, 0x007e},
3017{0x87c4, 0x0087}, {0x87c5, 0x00fa}, {0x87c6, 0x00b6},
3018{0x87c7, 0x008f}, {0x87c8, 0x0075}, {0x87c9, 0x0026},
3019{0x87ca, 0x000a}, {0x87cb, 0x0018}, {0x87cc, 0x00ce},
3020{0x87cd, 0x008f}, {0x87ce, 0x0073}, {0x87cf, 0x00bd},
3021{0x87d0, 0x0089}, {0x87d1, 0x00d5}, {0x87d2, 0x007e},
3022{0x87d3, 0x0087}, {0x87d4, 0x00fa}, {0x87d5, 0x00b6},
3023{0x87d6, 0x008f}, {0x87d7, 0x0078}, {0x87d8, 0x0026},
3024{0x87d9, 0x000a}, {0x87da, 0x0018}, {0x87db, 0x00ce},
3025{0x87dc, 0x008f}, {0x87dd, 0x0076}, {0x87de, 0x00bd},
3026{0x87df, 0x0089}, {0x87e0, 0x00d5}, {0x87e1, 0x007e},
3027{0x87e2, 0x0087}, {0x87e3, 0x00fa}, {0x87e4, 0x00b6},
3028{0x87e5, 0x008f}, {0x87e6, 0x007b}, {0x87e7, 0x0026},
3029{0x87e8, 0x000a}, {0x87e9, 0x0018}, {0x87ea, 0x00ce},
3030{0x87eb, 0x008f}, {0x87ec, 0x0079}, {0x87ed, 0x00bd},
3031{0x87ee, 0x0089}, {0x87ef, 0x00d5}, {0x87f0, 0x007e},
3032{0x87f1, 0x0087}, {0x87f2, 0x00fa}, {0x87f3, 0x0086},
3033{0x87f4, 0x0005}, {0x87f5, 0x0097}, {0x87f6, 0x0040},
3034{0x87f7, 0x007e}, {0x87f8, 0x0089}, {0x87f9, 0x0000},
3035{0x87fa, 0x00b6}, {0x87fb, 0x008f}, {0x87fc, 0x0075},
3036{0x87fd, 0x0081}, {0x87fe, 0x0007}, {0x87ff, 0x002e},
3037{0x8800, 0x00f2}, {0x8801, 0x00f6}, {0x8802, 0x0012},
3038{0x8803, 0x0006}, {0x8804, 0x00c4}, {0x8805, 0x00f8},
3039{0x8806, 0x001b}, {0x8807, 0x00b7}, {0x8808, 0x0012},
3040{0x8809, 0x0006}, {0x880a, 0x00b6}, {0x880b, 0x008f},
3041{0x880c, 0x0078}, {0x880d, 0x0081}, {0x880e, 0x0007},
3042{0x880f, 0x002e}, {0x8810, 0x00e2}, {0x8811, 0x0048},
3043{0x8812, 0x0048}, {0x8813, 0x0048}, {0x8814, 0x00f6},
3044{0x8815, 0x0012}, {0x8816, 0x0006}, {0x8817, 0x00c4},
3045{0x8818, 0x00c7}, {0x8819, 0x001b}, {0x881a, 0x00b7},
3046{0x881b, 0x0012}, {0x881c, 0x0006}, {0x881d, 0x00b6},
3047{0x881e, 0x008f}, {0x881f, 0x007b}, {0x8820, 0x0081},
3048{0x8821, 0x0007}, {0x8822, 0x002e}, {0x8823, 0x00cf},
3049{0x8824, 0x00f6}, {0x8825, 0x0012}, {0x8826, 0x0005},
3050{0x8827, 0x00c4}, {0x8828, 0x00f8}, {0x8829, 0x001b},
3051{0x882a, 0x00b7}, {0x882b, 0x0012}, {0x882c, 0x0005},
3052{0x882d, 0x0086}, {0x882e, 0x0000}, {0x882f, 0x00f6},
3053{0x8830, 0x008f}, {0x8831, 0x0071}, {0x8832, 0x00bd},
3054{0x8833, 0x0089}, {0x8834, 0x0094}, {0x8835, 0x0086},
3055{0x8836, 0x0001}, {0x8837, 0x00f6}, {0x8838, 0x008f},
3056{0x8839, 0x0074}, {0x883a, 0x00bd}, {0x883b, 0x0089},
3057{0x883c, 0x0094}, {0x883d, 0x0086}, {0x883e, 0x0002},
3058{0x883f, 0x00f6}, {0x8840, 0x008f}, {0x8841, 0x0077},
3059{0x8842, 0x00bd}, {0x8843, 0x0089}, {0x8844, 0x0094},
3060{0x8845, 0x0086}, {0x8846, 0x0003}, {0x8847, 0x00f6},
3061{0x8848, 0x008f}, {0x8849, 0x007a}, {0x884a, 0x00bd},
3062{0x884b, 0x0089}, {0x884c, 0x0094}, {0x884d, 0x00ce},
3063{0x884e, 0x008f}, {0x884f, 0x0070}, {0x8850, 0x00a6},
3064{0x8851, 0x0001}, {0x8852, 0x0081}, {0x8853, 0x0001},
3065{0x8854, 0x0027}, {0x8855, 0x0007}, {0x8856, 0x0081},
3066{0x8857, 0x0003}, {0x8858, 0x0027}, {0x8859, 0x0003},
3067{0x885a, 0x007e}, {0x885b, 0x0088}, {0x885c, 0x0066},
3068{0x885d, 0x00a6}, {0x885e, 0x0000}, {0x885f, 0x00b8},
3069{0x8860, 0x008f}, {0x8861, 0x0081}, {0x8862, 0x0084},
3070{0x8863, 0x0001}, {0x8864, 0x0026}, {0x8865, 0x000b},
3071{0x8866, 0x008c}, {0x8867, 0x008f}, {0x8868, 0x0079},
3072{0x8869, 0x002c}, {0x886a, 0x000e}, {0x886b, 0x0008},
3073{0x886c, 0x0008}, {0x886d, 0x0008}, {0x886e, 0x007e},
3074{0x886f, 0x0088}, {0x8870, 0x0050}, {0x8871, 0x00b6},
3075{0x8872, 0x0012}, {0x8873, 0x0004}, {0x8874, 0x008a},
3076{0x8875, 0x0040}, {0x8876, 0x00b7}, {0x8877, 0x0012},
3077{0x8878, 0x0004}, {0x8879, 0x00b6}, {0x887a, 0x0012},
3078{0x887b, 0x0004}, {0x887c, 0x0084}, {0x887d, 0x00fb},
3079{0x887e, 0x0084}, {0x887f, 0x00ef}, {0x8880, 0x00b7},
3080{0x8881, 0x0012}, {0x8882, 0x0004}, {0x8883, 0x00b6},
3081{0x8884, 0x0012}, {0x8885, 0x0007}, {0x8886, 0x0036},
3082{0x8887, 0x00b6}, {0x8888, 0x008f}, {0x8889, 0x007c},
3083{0x888a, 0x0048}, {0x888b, 0x0048}, {0x888c, 0x00b7},
3084{0x888d, 0x0012}, {0x888e, 0x0007}, {0x888f, 0x0086},
3085{0x8890, 0x0001}, {0x8891, 0x00ba}, {0x8892, 0x0012},
3086{0x8893, 0x0004}, {0x8894, 0x00b7}, {0x8895, 0x0012},
3087{0x8896, 0x0004}, {0x8897, 0x0001}, {0x8898, 0x0001},
3088{0x8899, 0x0001}, {0x889a, 0x0001}, {0x889b, 0x0001},
3089{0x889c, 0x0001}, {0x889d, 0x0086}, {0x889e, 0x00fe},
3090{0x889f, 0x00b4}, {0x88a0, 0x0012}, {0x88a1, 0x0004},
3091{0x88a2, 0x00b7}, {0x88a3, 0x0012}, {0x88a4, 0x0004},
3092{0x88a5, 0x0086}, {0x88a6, 0x0002}, {0x88a7, 0x00ba},
3093{0x88a8, 0x0012}, {0x88a9, 0x0004}, {0x88aa, 0x00b7},
3094{0x88ab, 0x0012}, {0x88ac, 0x0004}, {0x88ad, 0x0086},
3095{0x88ae, 0x00fd}, {0x88af, 0x00b4}, {0x88b0, 0x0012},
3096{0x88b1, 0x0004}, {0x88b2, 0x00b7}, {0x88b3, 0x0012},
3097{0x88b4, 0x0004}, {0x88b5, 0x0032}, {0x88b6, 0x00b7},
3098{0x88b7, 0x0012}, {0x88b8, 0x0007}, {0x88b9, 0x00b6},
3099{0x88ba, 0x0012}, {0x88bb, 0x0000}, {0x88bc, 0x0084},
3100{0x88bd, 0x0008}, {0x88be, 0x0081}, {0x88bf, 0x0008},
3101{0x88c0, 0x0027}, {0x88c1, 0x000f}, {0x88c2, 0x007c},
3102{0x88c3, 0x0082}, {0x88c4, 0x0008}, {0x88c5, 0x0026},
3103{0x88c6, 0x0007}, {0x88c7, 0x0086}, {0x88c8, 0x0076},
3104{0x88c9, 0x0097}, {0x88ca, 0x0040}, {0x88cb, 0x007e},
3105{0x88cc, 0x0089}, {0x88cd, 0x006e}, {0x88ce, 0x007e},
3106{0x88cf, 0x0086}, {0x88d0, 0x00ec}, {0x88d1, 0x00b6},
3107{0x88d2, 0x008f}, {0x88d3, 0x007f}, {0x88d4, 0x0081},
3108{0x88d5, 0x000f}, {0x88d6, 0x0027}, {0x88d7, 0x003c},
3109{0x88d8, 0x00bd}, {0x88d9, 0x00e6}, {0x88da, 0x00c7},
3110{0x88db, 0x00b7}, {0x88dc, 0x0012}, {0x88dd, 0x000d},
3111{0x88de, 0x00bd}, {0x88df, 0x00e6}, {0x88e0, 0x00cb},
3112{0x88e1, 0x00b6}, {0x88e2, 0x0012}, {0x88e3, 0x0004},
3113{0x88e4, 0x008a}, {0x88e5, 0x0020}, {0x88e6, 0x00b7},
3114{0x88e7, 0x0012}, {0x88e8, 0x0004}, {0x88e9, 0x00ce},
3115{0x88ea, 0x00ff}, {0x88eb, 0x00ff}, {0x88ec, 0x00b6},
3116{0x88ed, 0x0012}, {0x88ee, 0x0000}, {0x88ef, 0x0081},
3117{0x88f0, 0x000c}, {0x88f1, 0x0026}, {0x88f2, 0x0005},
3118{0x88f3, 0x0009}, {0x88f4, 0x0026}, {0x88f5, 0x00f6},
3119{0x88f6, 0x0027}, {0x88f7, 0x001c}, {0x88f8, 0x00b6},
3120{0x88f9, 0x0012}, {0x88fa, 0x0004}, {0x88fb, 0x0084},
3121{0x88fc, 0x00df}, {0x88fd, 0x00b7}, {0x88fe, 0x0012},
3122{0x88ff, 0x0004}, {0x8900, 0x0096}, {0x8901, 0x0083},
3123{0x8902, 0x0081}, {0x8903, 0x0007}, {0x8904, 0x002c},
3124{0x8905, 0x0005}, {0x8906, 0x007c}, {0x8907, 0x0000},
3125{0x8908, 0x0083}, {0x8909, 0x0020}, {0x890a, 0x0006},
3126{0x890b, 0x0096}, {0x890c, 0x0083}, {0x890d, 0x008b},
3127{0x890e, 0x0008}, {0x890f, 0x0097}, {0x8910, 0x0083},
3128{0x8911, 0x007e}, {0x8912, 0x0085}, {0x8913, 0x0041},
3129{0x8914, 0x007f}, {0x8915, 0x008f}, {0x8916, 0x007e},
3130{0x8917, 0x0086}, {0x8918, 0x0080}, {0x8919, 0x00b7},
3131{0x891a, 0x0012}, {0x891b, 0x000c}, {0x891c, 0x0086},
3132{0x891d, 0x0001}, {0x891e, 0x00b7}, {0x891f, 0x008f},
3133{0x8920, 0x007d}, {0x8921, 0x00b6}, {0x8922, 0x0012},
3134{0x8923, 0x000c}, {0x8924, 0x0084}, {0x8925, 0x007f},
3135{0x8926, 0x00b7}, {0x8927, 0x0012}, {0x8928, 0x000c},
3136{0x8929, 0x008a}, {0x892a, 0x0080}, {0x892b, 0x00b7},
3137{0x892c, 0x0012}, {0x892d, 0x000c}, {0x892e, 0x0086},
3138{0x892f, 0x000a}, {0x8930, 0x00bd}, {0x8931, 0x008a},
3139{0x8932, 0x0006}, {0x8933, 0x00b6}, {0x8934, 0x0012},
3140{0x8935, 0x000a}, {0x8936, 0x002a}, {0x8937, 0x0009},
3141{0x8938, 0x00b6}, {0x8939, 0x0012}, {0x893a, 0x000c},
3142{0x893b, 0x00ba}, {0x893c, 0x008f}, {0x893d, 0x007d},
3143{0x893e, 0x00b7}, {0x893f, 0x0012}, {0x8940, 0x000c},
3144{0x8941, 0x00b6}, {0x8942, 0x008f}, {0x8943, 0x007e},
3145{0x8944, 0x0081}, {0x8945, 0x0060}, {0x8946, 0x0027},
3146{0x8947, 0x001a}, {0x8948, 0x008b}, {0x8949, 0x0020},
3147{0x894a, 0x00b7}, {0x894b, 0x008f}, {0x894c, 0x007e},
3148{0x894d, 0x00b6}, {0x894e, 0x0012}, {0x894f, 0x000c},
3149{0x8950, 0x0084}, {0x8951, 0x009f}, {0x8952, 0x00ba},
3150{0x8953, 0x008f}, {0x8954, 0x007e}, {0x8955, 0x00b7},
3151{0x8956, 0x0012}, {0x8957, 0x000c}, {0x8958, 0x00b6},
3152{0x8959, 0x008f}, {0x895a, 0x007d}, {0x895b, 0x0048},
3153{0x895c, 0x00b7}, {0x895d, 0x008f}, {0x895e, 0x007d},
3154{0x895f, 0x007e}, {0x8960, 0x0089}, {0x8961, 0x0021},
3155{0x8962, 0x00b6}, {0x8963, 0x0012}, {0x8964, 0x0004},
3156{0x8965, 0x008a}, {0x8966, 0x0020}, {0x8967, 0x00b7},
3157{0x8968, 0x0012}, {0x8969, 0x0004}, {0x896a, 0x00bd},
3158{0x896b, 0x008a}, {0x896c, 0x000a}, {0x896d, 0x004f},
3159{0x896e, 0x0039}, {0x896f, 0x00a6}, {0x8970, 0x0000},
3160{0x8971, 0x0018}, {0x8972, 0x00a7}, {0x8973, 0x0000},
3161{0x8974, 0x0008}, {0x8975, 0x0018}, {0x8976, 0x0008},
3162{0x8977, 0x005a}, {0x8978, 0x0026}, {0x8979, 0x00f5},
3163{0x897a, 0x0039}, {0x897b, 0x0036}, {0x897c, 0x006c},
3164{0x897d, 0x0000}, {0x897e, 0x0032}, {0x897f, 0x00ba},
3165{0x8980, 0x008f}, {0x8981, 0x007f}, {0x8982, 0x00b7},
3166{0x8983, 0x008f}, {0x8984, 0x007f}, {0x8985, 0x00b6},
3167{0x8986, 0x0012}, {0x8987, 0x0009}, {0x8988, 0x0084},
3168{0x8989, 0x0003}, {0x898a, 0x00a7}, {0x898b, 0x0001},
3169{0x898c, 0x00b6}, {0x898d, 0x0012}, {0x898e, 0x0006},
3170{0x898f, 0x0084}, {0x8990, 0x003f}, {0x8991, 0x00a7},
3171{0x8992, 0x0002}, {0x8993, 0x0039}, {0x8994, 0x0036},
3172{0x8995, 0x0086}, {0x8996, 0x0003}, {0x8997, 0x00b7},
3173{0x8998, 0x008f}, {0x8999, 0x0080}, {0x899a, 0x0032},
3174{0x899b, 0x00c1}, {0x899c, 0x0000}, {0x899d, 0x0026},
3175{0x899e, 0x0006}, {0x899f, 0x00b7}, {0x89a0, 0x008f},
3176{0x89a1, 0x007c}, {0x89a2, 0x007e}, {0x89a3, 0x0089},
3177{0x89a4, 0x00c9}, {0x89a5, 0x00c1}, {0x89a6, 0x0001},
3178{0x89a7, 0x0027}, {0x89a8, 0x0018}, {0x89a9, 0x00c1},
3179{0x89aa, 0x0002}, {0x89ab, 0x0027}, {0x89ac, 0x000c},
3180{0x89ad, 0x00c1}, {0x89ae, 0x0003}, {0x89af, 0x0027},
3181{0x89b0, 0x0000}, {0x89b1, 0x00f6}, {0x89b2, 0x008f},
3182{0x89b3, 0x0080}, {0x89b4, 0x0005}, {0x89b5, 0x0005},
3183{0x89b6, 0x00f7}, {0x89b7, 0x008f}, {0x89b8, 0x0080},
3184{0x89b9, 0x00f6}, {0x89ba, 0x008f}, {0x89bb, 0x0080},
3185{0x89bc, 0x0005}, {0x89bd, 0x0005}, {0x89be, 0x00f7},
3186{0x89bf, 0x008f}, {0x89c0, 0x0080}, {0x89c1, 0x00f6},
3187{0x89c2, 0x008f}, {0x89c3, 0x0080}, {0x89c4, 0x0005},
3188{0x89c5, 0x0005}, {0x89c6, 0x00f7}, {0x89c7, 0x008f},
3189{0x89c8, 0x0080}, {0x89c9, 0x00f6}, {0x89ca, 0x008f},
3190{0x89cb, 0x0080}, {0x89cc, 0x0053}, {0x89cd, 0x00f4},
3191{0x89ce, 0x0012}, {0x89cf, 0x0007}, {0x89d0, 0x001b},
3192{0x89d1, 0x00b7}, {0x89d2, 0x0012}, {0x89d3, 0x0007},
3193{0x89d4, 0x0039}, {0x89d5, 0x00ce}, {0x89d6, 0x008f},
3194{0x89d7, 0x0070}, {0x89d8, 0x00a6}, {0x89d9, 0x0000},
3195{0x89da, 0x0018}, {0x89db, 0x00e6}, {0x89dc, 0x0000},
3196{0x89dd, 0x0018}, {0x89de, 0x00a7}, {0x89df, 0x0000},
3197{0x89e0, 0x00e7}, {0x89e1, 0x0000}, {0x89e2, 0x00a6},
3198{0x89e3, 0x0001}, {0x89e4, 0x0018}, {0x89e5, 0x00e6},
3199{0x89e6, 0x0001}, {0x89e7, 0x0018}, {0x89e8, 0x00a7},
3200{0x89e9, 0x0001}, {0x89ea, 0x00e7}, {0x89eb, 0x0001},
3201{0x89ec, 0x00a6}, {0x89ed, 0x0002}, {0x89ee, 0x0018},
3202{0x89ef, 0x00e6}, {0x89f0, 0x0002}, {0x89f1, 0x0018},
3203{0x89f2, 0x00a7}, {0x89f3, 0x0002}, {0x89f4, 0x00e7},
3204{0x89f5, 0x0002}, {0x89f6, 0x0039}, {0x89f7, 0x00a6},
3205{0x89f8, 0x0000}, {0x89f9, 0x0084}, {0x89fa, 0x0007},
3206{0x89fb, 0x00e6}, {0x89fc, 0x0000}, {0x89fd, 0x00c4},
3207{0x89fe, 0x0038}, {0x89ff, 0x0054}, {0x8a00, 0x0054},
3208{0x8a01, 0x0054}, {0x8a02, 0x001b}, {0x8a03, 0x00a7},
3209{0x8a04, 0x0000}, {0x8a05, 0x0039}, {0x8a06, 0x004a},
3210{0x8a07, 0x0026}, {0x8a08, 0x00fd}, {0x8a09, 0x0039},
3211{0x8a0a, 0x0096}, {0x8a0b, 0x0022}, {0x8a0c, 0x0084},
3212{0x8a0d, 0x000f}, {0x8a0e, 0x0097}, {0x8a0f, 0x0022},
3213{0x8a10, 0x0086}, {0x8a11, 0x0001}, {0x8a12, 0x00b7},
3214{0x8a13, 0x008f}, {0x8a14, 0x0070}, {0x8a15, 0x00b6},
3215{0x8a16, 0x0012}, {0x8a17, 0x0007}, {0x8a18, 0x00b7},
3216{0x8a19, 0x008f}, {0x8a1a, 0x0071}, {0x8a1b, 0x00f6},
3217{0x8a1c, 0x0012}, {0x8a1d, 0x000c}, {0x8a1e, 0x00c4},
3218{0x8a1f, 0x000f}, {0x8a20, 0x00c8}, {0x8a21, 0x000f},
3219{0x8a22, 0x00f7}, {0x8a23, 0x008f}, {0x8a24, 0x0072},
3220{0x8a25, 0x00f6}, {0x8a26, 0x008f}, {0x8a27, 0x0072},
3221{0x8a28, 0x00b6}, {0x8a29, 0x008f}, {0x8a2a, 0x0071},
3222{0x8a2b, 0x0084}, {0x8a2c, 0x0003}, {0x8a2d, 0x0027},
3223{0x8a2e, 0x0014}, {0x8a2f, 0x0081}, {0x8a30, 0x0001},
3224{0x8a31, 0x0027}, {0x8a32, 0x001c}, {0x8a33, 0x0081},
3225{0x8a34, 0x0002}, {0x8a35, 0x0027}, {0x8a36, 0x0024},
3226{0x8a37, 0x00f4}, {0x8a38, 0x008f}, {0x8a39, 0x0070},
3227{0x8a3a, 0x0027}, {0x8a3b, 0x002a}, {0x8a3c, 0x0096},
3228{0x8a3d, 0x0022}, {0x8a3e, 0x008a}, {0x8a3f, 0x0080},
3229{0x8a40, 0x007e}, {0x8a41, 0x008a}, {0x8a42, 0x0064},
3230{0x8a43, 0x00f4}, {0x8a44, 0x008f}, {0x8a45, 0x0070},
3231{0x8a46, 0x0027}, {0x8a47, 0x001e}, {0x8a48, 0x0096},
3232{0x8a49, 0x0022}, {0x8a4a, 0x008a}, {0x8a4b, 0x0010},
3233{0x8a4c, 0x007e}, {0x8a4d, 0x008a}, {0x8a4e, 0x0064},
3234{0x8a4f, 0x00f4}, {0x8a50, 0x008f}, {0x8a51, 0x0070},
3235{0x8a52, 0x0027}, {0x8a53, 0x0012}, {0x8a54, 0x0096},
3236{0x8a55, 0x0022}, {0x8a56, 0x008a}, {0x8a57, 0x0020},
3237{0x8a58, 0x007e}, {0x8a59, 0x008a}, {0x8a5a, 0x0064},
3238{0x8a5b, 0x00f4}, {0x8a5c, 0x008f}, {0x8a5d, 0x0070},
3239{0x8a5e, 0x0027}, {0x8a5f, 0x0006}, {0x8a60, 0x0096},
3240{0x8a61, 0x0022}, {0x8a62, 0x008a}, {0x8a63, 0x0040},
3241{0x8a64, 0x0097}, {0x8a65, 0x0022}, {0x8a66, 0x0074},
3242{0x8a67, 0x008f}, {0x8a68, 0x0071}, {0x8a69, 0x0074},
3243{0x8a6a, 0x008f}, {0x8a6b, 0x0071}, {0x8a6c, 0x0078},
3244{0x8a6d, 0x008f}, {0x8a6e, 0x0070}, {0x8a6f, 0x00b6},
3245{0x8a70, 0x008f}, {0x8a71, 0x0070}, {0x8a72, 0x0085},
3246{0x8a73, 0x0010}, {0x8a74, 0x0027}, {0x8a75, 0x00af},
3247{0x8a76, 0x00d6}, {0x8a77, 0x0022}, {0x8a78, 0x00c4},
3248{0x8a79, 0x0010}, {0x8a7a, 0x0058}, {0x8a7b, 0x00b6},
3249{0x8a7c, 0x0012}, {0x8a7d, 0x0070}, {0x8a7e, 0x0081},
3250{0x8a7f, 0x00e4}, {0x8a80, 0x0027}, {0x8a81, 0x0036},
3251{0x8a82, 0x0081}, {0x8a83, 0x00e1}, {0x8a84, 0x0026},
3252{0x8a85, 0x000c}, {0x8a86, 0x0096}, {0x8a87, 0x0022},
3253{0x8a88, 0x0084}, {0x8a89, 0x0020}, {0x8a8a, 0x0044},
3254{0x8a8b, 0x001b}, {0x8a8c, 0x00d6}, {0x8a8d, 0x0022},
3255{0x8a8e, 0x00c4}, {0x8a8f, 0x00cf}, {0x8a90, 0x0020},
3256{0x8a91, 0x0023}, {0x8a92, 0x0058}, {0x8a93, 0x0081},
3257{0x8a94, 0x00c6}, {0x8a95, 0x0026}, {0x8a96, 0x000d},
3258{0x8a97, 0x0096}, {0x8a98, 0x0022}, {0x8a99, 0x0084},
3259{0x8a9a, 0x0040}, {0x8a9b, 0x0044}, {0x8a9c, 0x0044},
3260{0x8a9d, 0x001b}, {0x8a9e, 0x00d6}, {0x8a9f, 0x0022},
3261{0x8aa0, 0x00c4}, {0x8aa1, 0x00af}, {0x8aa2, 0x0020},
3262{0x8aa3, 0x0011}, {0x8aa4, 0x0058}, {0x8aa5, 0x0081},
3263{0x8aa6, 0x0027}, {0x8aa7, 0x0026}, {0x8aa8, 0x000f},
3264{0x8aa9, 0x0096}, {0x8aaa, 0x0022}, {0x8aab, 0x0084},
3265{0x8aac, 0x0080}, {0x8aad, 0x0044}, {0x8aae, 0x0044},
3266{0x8aaf, 0x0044}, {0x8ab0, 0x001b}, {0x8ab1, 0x00d6},
3267{0x8ab2, 0x0022}, {0x8ab3, 0x00c4}, {0x8ab4, 0x006f},
3268{0x8ab5, 0x001b}, {0x8ab6, 0x0097}, {0x8ab7, 0x0022},
3269{0x8ab8, 0x0039}, {0x8ab9, 0x0027}, {0x8aba, 0x000c},
3270{0x8abb, 0x007c}, {0x8abc, 0x0082}, {0x8abd, 0x0006},
3271{0x8abe, 0x00bd}, {0x8abf, 0x00d9}, {0x8ac0, 0x00ed},
3272{0x8ac1, 0x00b6}, {0x8ac2, 0x0082}, {0x8ac3, 0x0007},
3273{0x8ac4, 0x007e}, {0x8ac5, 0x008a}, {0x8ac6, 0x00b9},
3274{0x8ac7, 0x007f}, {0x8ac8, 0x0082}, {0x8ac9, 0x0006},
3275{0x8aca, 0x0039}, { 0x0, 0x0 }
3276};
3277#else
3278cas_saturn_patch_t cas_saturn_patch[] = {
3279{0x8200, 0x007e}, {0x8201, 0x0082}, {0x8202, 0x0009},
3280{0x8203, 0x0000}, {0x8204, 0x0000}, {0x8205, 0x0000},
3281{0x8206, 0x0000}, {0x8207, 0x0000}, {0x8208, 0x0000},
3282{0x8209, 0x008e}, {0x820a, 0x008e}, {0x820b, 0x00ff},
3283{0x820c, 0x00ce}, {0x820d, 0x0082}, {0x820e, 0x0025},
3284{0x820f, 0x00ff}, {0x8210, 0x0001}, {0x8211, 0x000f},
3285{0x8212, 0x00ce}, {0x8213, 0x0084}, {0x8214, 0x0026},
3286{0x8215, 0x00ff}, {0x8216, 0x0001}, {0x8217, 0x0011},
3287{0x8218, 0x00ce}, {0x8219, 0x0085}, {0x821a, 0x003d},
3288{0x821b, 0x00df}, {0x821c, 0x00e5}, {0x821d, 0x0086},
3289{0x821e, 0x0039}, {0x821f, 0x00b7}, {0x8220, 0x008f},
3290{0x8221, 0x00f8}, {0x8222, 0x007e}, {0x8223, 0x00c3},
3291{0x8224, 0x00c2}, {0x8225, 0x0096}, {0x8226, 0x0047},
3292{0x8227, 0x0084}, {0x8228, 0x00f3}, {0x8229, 0x008a},
3293{0x822a, 0x0000}, {0x822b, 0x0097}, {0x822c, 0x0047},
3294{0x822d, 0x00ce}, {0x822e, 0x0082}, {0x822f, 0x0033},
3295{0x8230, 0x00ff}, {0x8231, 0x0001}, {0x8232, 0x000f},
3296{0x8233, 0x0096}, {0x8234, 0x0046}, {0x8235, 0x0084},
3297{0x8236, 0x000c}, {0x8237, 0x0081}, {0x8238, 0x0004},
3298{0x8239, 0x0027}, {0x823a, 0x000b}, {0x823b, 0x0096},
3299{0x823c, 0x0046}, {0x823d, 0x0084}, {0x823e, 0x000c},
3300{0x823f, 0x0081}, {0x8240, 0x0008}, {0x8241, 0x0027},
3301{0x8242, 0x0057}, {0x8243, 0x007e}, {0x8244, 0x0084},
3302{0x8245, 0x0025}, {0x8246, 0x0096}, {0x8247, 0x0047},
3303{0x8248, 0x0084}, {0x8249, 0x00f3}, {0x824a, 0x008a},
3304{0x824b, 0x0004}, {0x824c, 0x0097}, {0x824d, 0x0047},
3305{0x824e, 0x00ce}, {0x824f, 0x0082}, {0x8250, 0x0054},
3306{0x8251, 0x00ff}, {0x8252, 0x0001}, {0x8253, 0x000f},
3307{0x8254, 0x0096}, {0x8255, 0x0046}, {0x8256, 0x0084},
3308{0x8257, 0x000c}, {0x8258, 0x0081}, {0x8259, 0x0004},
3309{0x825a, 0x0026}, {0x825b, 0x0038}, {0x825c, 0x00b6},
3310{0x825d, 0x0012}, {0x825e, 0x0020}, {0x825f, 0x0084},
3311{0x8260, 0x0020}, {0x8261, 0x0026}, {0x8262, 0x0003},
3312{0x8263, 0x007e}, {0x8264, 0x0084}, {0x8265, 0x0025},
3313{0x8266, 0x0096}, {0x8267, 0x007b}, {0x8268, 0x00d6},
3314{0x8269, 0x007c}, {0x826a, 0x00fe}, {0x826b, 0x008f},
3315{0x826c, 0x0056}, {0x826d, 0x00bd}, {0x826e, 0x00f7},
3316{0x826f, 0x00b6}, {0x8270, 0x00fe}, {0x8271, 0x008f},
3317{0x8272, 0x004e}, {0x8273, 0x00bd}, {0x8274, 0x00ec},
3318{0x8275, 0x008e}, {0x8276, 0x00bd}, {0x8277, 0x00fa},
3319{0x8278, 0x00f7}, {0x8279, 0x00bd}, {0x827a, 0x00f7},
3320{0x827b, 0x0028}, {0x827c, 0x00ce}, {0x827d, 0x0082},
3321{0x827e, 0x0082}, {0x827f, 0x00ff}, {0x8280, 0x0001},
3322{0x8281, 0x000f}, {0x8282, 0x0096}, {0x8283, 0x0046},
3323{0x8284, 0x0084}, {0x8285, 0x000c}, {0x8286, 0x0081},
3324{0x8287, 0x0004}, {0x8288, 0x0026}, {0x8289, 0x000a},
3325{0x828a, 0x00b6}, {0x828b, 0x0012}, {0x828c, 0x0020},
3326{0x828d, 0x0084}, {0x828e, 0x0020}, {0x828f, 0x0027},
3327{0x8290, 0x00b5}, {0x8291, 0x007e}, {0x8292, 0x0084},
3328{0x8293, 0x0025}, {0x8294, 0x00bd}, {0x8295, 0x00f7},
3329{0x8296, 0x001f}, {0x8297, 0x007e}, {0x8298, 0x0084},
3330{0x8299, 0x001f}, {0x829a, 0x0096}, {0x829b, 0x0047},
3331{0x829c, 0x0084}, {0x829d, 0x00f3}, {0x829e, 0x008a},
3332{0x829f, 0x0008}, {0x82a0, 0x0097}, {0x82a1, 0x0047},
3333{0x82a2, 0x00de}, {0x82a3, 0x00e1}, {0x82a4, 0x00ad},
3334{0x82a5, 0x0000}, {0x82a6, 0x00ce}, {0x82a7, 0x0082},
3335{0x82a8, 0x00af}, {0x82a9, 0x00ff}, {0x82aa, 0x0001},
3336{0x82ab, 0x000f}, {0x82ac, 0x007e}, {0x82ad, 0x0084},
3337{0x82ae, 0x0025}, {0x82af, 0x0096}, {0x82b0, 0x0041},
3338{0x82b1, 0x0085}, {0x82b2, 0x0010}, {0x82b3, 0x0026},
3339{0x82b4, 0x0006}, {0x82b5, 0x0096}, {0x82b6, 0x0023},
3340{0x82b7, 0x0085}, {0x82b8, 0x0040}, {0x82b9, 0x0027},
3341{0x82ba, 0x0006}, {0x82bb, 0x00bd}, {0x82bc, 0x00ed},
3342{0x82bd, 0x0000}, {0x82be, 0x007e}, {0x82bf, 0x0083},
3343{0x82c0, 0x00a2}, {0x82c1, 0x00de}, {0x82c2, 0x0042},
3344{0x82c3, 0x00bd}, {0x82c4, 0x00eb}, {0x82c5, 0x008e},
3345{0x82c6, 0x0096}, {0x82c7, 0x0024}, {0x82c8, 0x0084},
3346{0x82c9, 0x0008}, {0x82ca, 0x0027}, {0x82cb, 0x0003},
3347{0x82cc, 0x007e}, {0x82cd, 0x0083}, {0x82ce, 0x00df},
3348{0x82cf, 0x0096}, {0x82d0, 0x007b}, {0x82d1, 0x00d6},
3349{0x82d2, 0x007c}, {0x82d3, 0x00fe}, {0x82d4, 0x008f},
3350{0x82d5, 0x0056}, {0x82d6, 0x00bd}, {0x82d7, 0x00f7},
3351{0x82d8, 0x00b6}, {0x82d9, 0x00fe}, {0x82da, 0x008f},
3352{0x82db, 0x0050}, {0x82dc, 0x00bd}, {0x82dd, 0x00ec},
3353{0x82de, 0x008e}, {0x82df, 0x00bd}, {0x82e0, 0x00fa},
3354{0x82e1, 0x00f7}, {0x82e2, 0x0086}, {0x82e3, 0x0011},
3355{0x82e4, 0x00c6}, {0x82e5, 0x0049}, {0x82e6, 0x00bd},
3356{0x82e7, 0x00e4}, {0x82e8, 0x0012}, {0x82e9, 0x00ce},
3357{0x82ea, 0x0082}, {0x82eb, 0x00ef}, {0x82ec, 0x00ff},
3358{0x82ed, 0x0001}, {0x82ee, 0x000f}, {0x82ef, 0x0096},
3359{0x82f0, 0x0046}, {0x82f1, 0x0084}, {0x82f2, 0x000c},
3360{0x82f3, 0x0081}, {0x82f4, 0x0000}, {0x82f5, 0x0027},
3361{0x82f6, 0x0017}, {0x82f7, 0x00c6}, {0x82f8, 0x0049},
3362{0x82f9, 0x00bd}, {0x82fa, 0x00e4}, {0x82fb, 0x0091},
3363{0x82fc, 0x0024}, {0x82fd, 0x000d}, {0x82fe, 0x00b6},
3364{0x82ff, 0x0012}, {0x8300, 0x0020}, {0x8301, 0x0085},
3365{0x8302, 0x0020}, {0x8303, 0x0026}, {0x8304, 0x000c},
3366{0x8305, 0x00ce}, {0x8306, 0x0082}, {0x8307, 0x00c1},
3367{0x8308, 0x00ff}, {0x8309, 0x0001}, {0x830a, 0x000f},
3368{0x830b, 0x007e}, {0x830c, 0x0084}, {0x830d, 0x0025},
3369{0x830e, 0x007e}, {0x830f, 0x0084}, {0x8310, 0x0016},
3370{0x8311, 0x00fe}, {0x8312, 0x008f}, {0x8313, 0x0052},
3371{0x8314, 0x00bd}, {0x8315, 0x00ec}, {0x8316, 0x008e},
3372{0x8317, 0x00bd}, {0x8318, 0x00fa}, {0x8319, 0x00f7},
3373{0x831a, 0x0086}, {0x831b, 0x006a}, {0x831c, 0x00c6},
3374{0x831d, 0x0049}, {0x831e, 0x00bd}, {0x831f, 0x00e4},
3375{0x8320, 0x0012}, {0x8321, 0x00ce}, {0x8322, 0x0083},
3376{0x8323, 0x0027}, {0x8324, 0x00ff}, {0x8325, 0x0001},
3377{0x8326, 0x000f}, {0x8327, 0x0096}, {0x8328, 0x0046},
3378{0x8329, 0x0084}, {0x832a, 0x000c}, {0x832b, 0x0081},
3379{0x832c, 0x0000}, {0x832d, 0x0027}, {0x832e, 0x000a},
3380{0x832f, 0x00c6}, {0x8330, 0x0049}, {0x8331, 0x00bd},
3381{0x8332, 0x00e4}, {0x8333, 0x0091}, {0x8334, 0x0025},
3382{0x8335, 0x0006}, {0x8336, 0x007e}, {0x8337, 0x0084},
3383{0x8338, 0x0025}, {0x8339, 0x007e}, {0x833a, 0x0084},
3384{0x833b, 0x0016}, {0x833c, 0x00b6}, {0x833d, 0x0018},
3385{0x833e, 0x0070}, {0x833f, 0x00bb}, {0x8340, 0x0019},
3386{0x8341, 0x0070}, {0x8342, 0x002a}, {0x8343, 0x0004},
3387{0x8344, 0x0081}, {0x8345, 0x00af}, {0x8346, 0x002e},
3388{0x8347, 0x0019}, {0x8348, 0x0096}, {0x8349, 0x007b},
3389{0x834a, 0x00f6}, {0x834b, 0x0020}, {0x834c, 0x0007},
3390{0x834d, 0x00fa}, {0x834e, 0x0020}, {0x834f, 0x0027},
3391{0x8350, 0x00c4}, {0x8351, 0x0038}, {0x8352, 0x0081},
3392{0x8353, 0x0038}, {0x8354, 0x0027}, {0x8355, 0x000b},
3393{0x8356, 0x00f6}, {0x8357, 0x0020}, {0x8358, 0x0007},
3394{0x8359, 0x00fa}, {0x835a, 0x0020}, {0x835b, 0x0027},
3395{0x835c, 0x00cb}, {0x835d, 0x0008}, {0x835e, 0x007e},
3396{0x835f, 0x0082}, {0x8360, 0x00d3}, {0x8361, 0x00bd},
3397{0x8362, 0x00f7}, {0x8363, 0x0066}, {0x8364, 0x0086},
3398{0x8365, 0x0074}, {0x8366, 0x00c6}, {0x8367, 0x0049},
3399{0x8368, 0x00bd}, {0x8369, 0x00e4}, {0x836a, 0x0012},
3400{0x836b, 0x00ce}, {0x836c, 0x0083}, {0x836d, 0x0071},
3401{0x836e, 0x00ff}, {0x836f, 0x0001}, {0x8370, 0x000f},
3402{0x8371, 0x0096}, {0x8372, 0x0046}, {0x8373, 0x0084},
3403{0x8374, 0x000c}, {0x8375, 0x0081}, {0x8376, 0x0008},
3404{0x8377, 0x0026}, {0x8378, 0x000a}, {0x8379, 0x00c6},
3405{0x837a, 0x0049}, {0x837b, 0x00bd}, {0x837c, 0x00e4},
3406{0x837d, 0x0091}, {0x837e, 0x0025}, {0x837f, 0x0006},
3407{0x8380, 0x007e}, {0x8381, 0x0084}, {0x8382, 0x0025},
3408{0x8383, 0x007e}, {0x8384, 0x0084}, {0x8385, 0x0016},
3409{0x8386, 0x00bd}, {0x8387, 0x00f7}, {0x8388, 0x003e},
3410{0x8389, 0x0026}, {0x838a, 0x000e}, {0x838b, 0x00bd},
3411{0x838c, 0x00e5}, {0x838d, 0x0009}, {0x838e, 0x0026},
3412{0x838f, 0x0006}, {0x8390, 0x00ce}, {0x8391, 0x0082},
3413{0x8392, 0x00c1}, {0x8393, 0x00ff}, {0x8394, 0x0001},
3414{0x8395, 0x000f}, {0x8396, 0x007e}, {0x8397, 0x0084},
3415{0x8398, 0x0025}, {0x8399, 0x00fe}, {0x839a, 0x008f},
3416{0x839b, 0x0054}, {0x839c, 0x00bd}, {0x839d, 0x00ec},
3417{0x839e, 0x008e}, {0x839f, 0x00bd}, {0x83a0, 0x00fa},
3418{0x83a1, 0x00f7}, {0x83a2, 0x00bd}, {0x83a3, 0x00f7},
3419{0x83a4, 0x0033}, {0x83a5, 0x0086}, {0x83a6, 0x000f},
3420{0x83a7, 0x00c6}, {0x83a8, 0x0051}, {0x83a9, 0x00bd},
3421{0x83aa, 0x00e4}, {0x83ab, 0x0012}, {0x83ac, 0x00ce},
3422{0x83ad, 0x0083}, {0x83ae, 0x00b2}, {0x83af, 0x00ff},
3423{0x83b0, 0x0001}, {0x83b1, 0x000f}, {0x83b2, 0x0096},
3424{0x83b3, 0x0046}, {0x83b4, 0x0084}, {0x83b5, 0x000c},
3425{0x83b6, 0x0081}, {0x83b7, 0x0008}, {0x83b8, 0x0026},
3426{0x83b9, 0x005c}, {0x83ba, 0x00b6}, {0x83bb, 0x0012},
3427{0x83bc, 0x0020}, {0x83bd, 0x0084}, {0x83be, 0x003f},
3428{0x83bf, 0x0081}, {0x83c0, 0x003a}, {0x83c1, 0x0027},
3429{0x83c2, 0x001c}, {0x83c3, 0x0096}, {0x83c4, 0x0023},
3430{0x83c5, 0x0085}, {0x83c6, 0x0040}, {0x83c7, 0x0027},
3431{0x83c8, 0x0003}, {0x83c9, 0x007e}, {0x83ca, 0x0084},
3432{0x83cb, 0x0025}, {0x83cc, 0x00c6}, {0x83cd, 0x0051},
3433{0x83ce, 0x00bd}, {0x83cf, 0x00e4}, {0x83d0, 0x0091},
3434{0x83d1, 0x0025}, {0x83d2, 0x0003}, {0x83d3, 0x007e},
3435{0x83d4, 0x0084}, {0x83d5, 0x0025}, {0x83d6, 0x00ce},
3436{0x83d7, 0x0082}, {0x83d8, 0x00c1}, {0x83d9, 0x00ff},
3437{0x83da, 0x0001}, {0x83db, 0x000f}, {0x83dc, 0x007e},
3438{0x83dd, 0x0084}, {0x83de, 0x0025}, {0x83df, 0x00bd},
3439{0x83e0, 0x00f8}, {0x83e1, 0x0037}, {0x83e2, 0x007c},
3440{0x83e3, 0x0000}, {0x83e4, 0x007a}, {0x83e5, 0x00ce},
3441{0x83e6, 0x0083}, {0x83e7, 0x00ee}, {0x83e8, 0x00ff},
3442{0x83e9, 0x0001}, {0x83ea, 0x000f}, {0x83eb, 0x007e},
3443{0x83ec, 0x0084}, {0x83ed, 0x0025}, {0x83ee, 0x0096},
3444{0x83ef, 0x0046}, {0x83f0, 0x0084}, {0x83f1, 0x000c},
3445{0x83f2, 0x0081}, {0x83f3, 0x0008}, {0x83f4, 0x0026},
3446{0x83f5, 0x0020}, {0x83f6, 0x0096}, {0x83f7, 0x0024},
3447{0x83f8, 0x0084}, {0x83f9, 0x0008}, {0x83fa, 0x0026},
3448{0x83fb, 0x0029}, {0x83fc, 0x00b6}, {0x83fd, 0x0018},
3449{0x83fe, 0x0082}, {0x83ff, 0x00bb}, {0x8400, 0x0019},
3450{0x8401, 0x0082}, {0x8402, 0x00b1}, {0x8403, 0x0001},
3451{0x8404, 0x003b}, {0x8405, 0x0022}, {0x8406, 0x0009},
3452{0x8407, 0x00b6}, {0x8408, 0x0012}, {0x8409, 0x0020},
3453{0x840a, 0x0084}, {0x840b, 0x0037}, {0x840c, 0x0081},
3454{0x840d, 0x0032}, {0x840e, 0x0027}, {0x840f, 0x0015},
3455{0x8410, 0x00bd}, {0x8411, 0x00f8}, {0x8412, 0x0044},
3456{0x8413, 0x007e}, {0x8414, 0x0082}, {0x8415, 0x00c1},
3457{0x8416, 0x00bd}, {0x8417, 0x00f7}, {0x8418, 0x001f},
3458{0x8419, 0x00bd}, {0x841a, 0x00f8}, {0x841b, 0x0044},
3459{0x841c, 0x00bd}, {0x841d, 0x00fc}, {0x841e, 0x0029},
3460{0x841f, 0x00ce}, {0x8420, 0x0082}, {0x8421, 0x0025},
3461{0x8422, 0x00ff}, {0x8423, 0x0001}, {0x8424, 0x000f},
3462{0x8425, 0x0039}, {0x8426, 0x0096}, {0x8427, 0x0047},
3463{0x8428, 0x0084}, {0x8429, 0x00fc}, {0x842a, 0x008a},
3464{0x842b, 0x0000}, {0x842c, 0x0097}, {0x842d, 0x0047},
3465{0x842e, 0x00ce}, {0x842f, 0x0084}, {0x8430, 0x0034},
3466{0x8431, 0x00ff}, {0x8432, 0x0001}, {0x8433, 0x0011},
3467{0x8434, 0x0096}, {0x8435, 0x0046}, {0x8436, 0x0084},
3468{0x8437, 0x0003}, {0x8438, 0x0081}, {0x8439, 0x0002},
3469{0x843a, 0x0027}, {0x843b, 0x0003}, {0x843c, 0x007e},
3470{0x843d, 0x0085}, {0x843e, 0x001e}, {0x843f, 0x0096},
3471{0x8440, 0x0047}, {0x8441, 0x0084}, {0x8442, 0x00fc},
3472{0x8443, 0x008a}, {0x8444, 0x0002}, {0x8445, 0x0097},
3473{0x8446, 0x0047}, {0x8447, 0x00de}, {0x8448, 0x00e1},
3474{0x8449, 0x00ad}, {0x844a, 0x0000}, {0x844b, 0x0086},
3475{0x844c, 0x0001}, {0x844d, 0x00b7}, {0x844e, 0x0012},
3476{0x844f, 0x0051}, {0x8450, 0x00bd}, {0x8451, 0x00f7},
3477{0x8452, 0x0014}, {0x8453, 0x00b6}, {0x8454, 0x0010},
3478{0x8455, 0x0031}, {0x8456, 0x0084}, {0x8457, 0x00fd},
3479{0x8458, 0x00b7}, {0x8459, 0x0010}, {0x845a, 0x0031},
3480{0x845b, 0x00bd}, {0x845c, 0x00f8}, {0x845d, 0x001e},
3481{0x845e, 0x0096}, {0x845f, 0x0081}, {0x8460, 0x00d6},
3482{0x8461, 0x0082}, {0x8462, 0x00fe}, {0x8463, 0x008f},
3483{0x8464, 0x005a}, {0x8465, 0x00bd}, {0x8466, 0x00f7},
3484{0x8467, 0x00b6}, {0x8468, 0x00fe}, {0x8469, 0x008f},
3485{0x846a, 0x005c}, {0x846b, 0x00bd}, {0x846c, 0x00ec},
3486{0x846d, 0x008e}, {0x846e, 0x00bd}, {0x846f, 0x00fa},
3487{0x8470, 0x00f7}, {0x8471, 0x0086}, {0x8472, 0x0008},
3488{0x8473, 0x00d6}, {0x8474, 0x0000}, {0x8475, 0x00c5},
3489{0x8476, 0x0010}, {0x8477, 0x0026}, {0x8478, 0x0002},
3490{0x8479, 0x008b}, {0x847a, 0x0020}, {0x847b, 0x00c6},
3491{0x847c, 0x0051}, {0x847d, 0x00bd}, {0x847e, 0x00e4},
3492{0x847f, 0x0012}, {0x8480, 0x00ce}, {0x8481, 0x0084},
3493{0x8482, 0x0086}, {0x8483, 0x00ff}, {0x8484, 0x0001},
3494{0x8485, 0x0011}, {0x8486, 0x0096}, {0x8487, 0x0046},
3495{0x8488, 0x0084}, {0x8489, 0x0003}, {0x848a, 0x0081},
3496{0x848b, 0x0002}, {0x848c, 0x0027}, {0x848d, 0x0003},
3497{0x848e, 0x007e}, {0x848f, 0x0085}, {0x8490, 0x000f},
3498{0x8491, 0x00c6}, {0x8492, 0x0051}, {0x8493, 0x00bd},
3499{0x8494, 0x00e4}, {0x8495, 0x0091}, {0x8496, 0x0025},
3500{0x8497, 0x0003}, {0x8498, 0x007e}, {0x8499, 0x0085},
3501{0x849a, 0x001e}, {0x849b, 0x0096}, {0x849c, 0x0044},
3502{0x849d, 0x0085}, {0x849e, 0x0010}, {0x849f, 0x0026},
3503{0x84a0, 0x000a}, {0x84a1, 0x00b6}, {0x84a2, 0x0012},
3504{0x84a3, 0x0050}, {0x84a4, 0x00ba}, {0x84a5, 0x0001},
3505{0x84a6, 0x003c}, {0x84a7, 0x0085}, {0x84a8, 0x0010},
3506{0x84a9, 0x0027}, {0x84aa, 0x00a8}, {0x84ab, 0x00bd},
3507{0x84ac, 0x00f7}, {0x84ad, 0x0066}, {0x84ae, 0x00ce},
3508{0x84af, 0x0084}, {0x84b0, 0x00b7}, {0x84b1, 0x00ff},
3509{0x84b2, 0x0001}, {0x84b3, 0x0011}, {0x84b4, 0x007e},
3510{0x84b5, 0x0085}, {0x84b6, 0x001e}, {0x84b7, 0x0096},
3511{0x84b8, 0x0046}, {0x84b9, 0x0084}, {0x84ba, 0x0003},
3512{0x84bb, 0x0081}, {0x84bc, 0x0002}, {0x84bd, 0x0026},
3513{0x84be, 0x0050}, {0x84bf, 0x00b6}, {0x84c0, 0x0012},
3514{0x84c1, 0x0030}, {0x84c2, 0x0084}, {0x84c3, 0x0003},
3515{0x84c4, 0x0081}, {0x84c5, 0x0001}, {0x84c6, 0x0027},
3516{0x84c7, 0x0003}, {0x84c8, 0x007e}, {0x84c9, 0x0085},
3517{0x84ca, 0x001e}, {0x84cb, 0x0096}, {0x84cc, 0x0044},
3518{0x84cd, 0x0085}, {0x84ce, 0x0010}, {0x84cf, 0x0026},
3519{0x84d0, 0x0013}, {0x84d1, 0x00b6}, {0x84d2, 0x0012},
3520{0x84d3, 0x0050}, {0x84d4, 0x00ba}, {0x84d5, 0x0001},
3521{0x84d6, 0x003c}, {0x84d7, 0x0085}, {0x84d8, 0x0010},
3522{0x84d9, 0x0026}, {0x84da, 0x0009}, {0x84db, 0x00ce},
3523{0x84dc, 0x0084}, {0x84dd, 0x0053}, {0x84de, 0x00ff},
3524{0x84df, 0x0001}, {0x84e0, 0x0011}, {0x84e1, 0x007e},
3525{0x84e2, 0x0085}, {0x84e3, 0x001e}, {0x84e4, 0x00b6},
3526{0x84e5, 0x0010}, {0x84e6, 0x0031}, {0x84e7, 0x008a},
3527{0x84e8, 0x0002}, {0x84e9, 0x00b7}, {0x84ea, 0x0010},
3528{0x84eb, 0x0031}, {0x84ec, 0x00bd}, {0x84ed, 0x0085},
3529{0x84ee, 0x001f}, {0x84ef, 0x00bd}, {0x84f0, 0x00f8},
3530{0x84f1, 0x0037}, {0x84f2, 0x007c}, {0x84f3, 0x0000},
3531{0x84f4, 0x0080}, {0x84f5, 0x00ce}, {0x84f6, 0x0084},
3532{0x84f7, 0x00fe}, {0x84f8, 0x00ff}, {0x84f9, 0x0001},
3533{0x84fa, 0x0011}, {0x84fb, 0x007e}, {0x84fc, 0x0085},
3534{0x84fd, 0x001e}, {0x84fe, 0x0096}, {0x84ff, 0x0046},
3535{0x8500, 0x0084}, {0x8501, 0x0003}, {0x8502, 0x0081},
3536{0x8503, 0x0002}, {0x8504, 0x0026}, {0x8505, 0x0009},
3537{0x8506, 0x00b6}, {0x8507, 0x0012}, {0x8508, 0x0030},
3538{0x8509, 0x0084}, {0x850a, 0x0003}, {0x850b, 0x0081},
3539{0x850c, 0x0001}, {0x850d, 0x0027}, {0x850e, 0x000f},
3540{0x850f, 0x00bd}, {0x8510, 0x00f8}, {0x8511, 0x0044},
3541{0x8512, 0x00bd}, {0x8513, 0x00f7}, {0x8514, 0x000b},
3542{0x8515, 0x00bd}, {0x8516, 0x00fc}, {0x8517, 0x0029},
3543{0x8518, 0x00ce}, {0x8519, 0x0084}, {0x851a, 0x0026},
3544{0x851b, 0x00ff}, {0x851c, 0x0001}, {0x851d, 0x0011},
3545{0x851e, 0x0039}, {0x851f, 0x00d6}, {0x8520, 0x0022},
3546{0x8521, 0x00c4}, {0x8522, 0x000f}, {0x8523, 0x00b6},
3547{0x8524, 0x0012}, {0x8525, 0x0030}, {0x8526, 0x00ba},
3548{0x8527, 0x0012}, {0x8528, 0x0032}, {0x8529, 0x0084},
3549{0x852a, 0x0004}, {0x852b, 0x0027}, {0x852c, 0x000d},
3550{0x852d, 0x0096}, {0x852e, 0x0022}, {0x852f, 0x0085},
3551{0x8530, 0x0004}, {0x8531, 0x0027}, {0x8532, 0x0005},
3552{0x8533, 0x00ca}, {0x8534, 0x0010}, {0x8535, 0x007e},
3553{0x8536, 0x0085}, {0x8537, 0x003a}, {0x8538, 0x00ca},
3554{0x8539, 0x0020}, {0x853a, 0x00d7}, {0x853b, 0x0022},
3555{0x853c, 0x0039}, {0x853d, 0x0086}, {0x853e, 0x0000},
3556{0x853f, 0x0097}, {0x8540, 0x0083}, {0x8541, 0x0018},
3557{0x8542, 0x00ce}, {0x8543, 0x001c}, {0x8544, 0x0000},
3558{0x8545, 0x00bd}, {0x8546, 0x00eb}, {0x8547, 0x0046},
3559{0x8548, 0x0096}, {0x8549, 0x0057}, {0x854a, 0x0085},
3560{0x854b, 0x0001}, {0x854c, 0x0027}, {0x854d, 0x0002},
3561{0x854e, 0x004f}, {0x854f, 0x0039}, {0x8550, 0x0085},
3562{0x8551, 0x0002}, {0x8552, 0x0027}, {0x8553, 0x0001},
3563{0x8554, 0x0039}, {0x8555, 0x007f}, {0x8556, 0x008f},
3564{0x8557, 0x007d}, {0x8558, 0x0086}, {0x8559, 0x0004},
3565{0x855a, 0x00b7}, {0x855b, 0x0012}, {0x855c, 0x0004},
3566{0x855d, 0x0086}, {0x855e, 0x0008}, {0x855f, 0x00b7},
3567{0x8560, 0x0012}, {0x8561, 0x0007}, {0x8562, 0x0086},
3568{0x8563, 0x0010}, {0x8564, 0x00b7}, {0x8565, 0x0012},
3569{0x8566, 0x000c}, {0x8567, 0x0086}, {0x8568, 0x0007},
3570{0x8569, 0x00b7}, {0x856a, 0x0012}, {0x856b, 0x0006},
3571{0x856c, 0x00b6}, {0x856d, 0x008f}, {0x856e, 0x007d},
3572{0x856f, 0x00b7}, {0x8570, 0x0012}, {0x8571, 0x0070},
3573{0x8572, 0x0086}, {0x8573, 0x0001}, {0x8574, 0x00ba},
3574{0x8575, 0x0012}, {0x8576, 0x0004}, {0x8577, 0x00b7},
3575{0x8578, 0x0012}, {0x8579, 0x0004}, {0x857a, 0x0001},
3576{0x857b, 0x0001}, {0x857c, 0x0001}, {0x857d, 0x0001},
3577{0x857e, 0x0001}, {0x857f, 0x0001}, {0x8580, 0x00b6},
3578{0x8581, 0x0012}, {0x8582, 0x0004}, {0x8583, 0x0084},
3579{0x8584, 0x00fe}, {0x8585, 0x008a}, {0x8586, 0x0002},
3580{0x8587, 0x00b7}, {0x8588, 0x0012}, {0x8589, 0x0004},
3581{0x858a, 0x0001}, {0x858b, 0x0001}, {0x858c, 0x0001},
3582{0x858d, 0x0001}, {0x858e, 0x0001}, {0x858f, 0x0001},
3583{0x8590, 0x0086}, {0x8591, 0x00fd}, {0x8592, 0x00b4},
3584{0x8593, 0x0012}, {0x8594, 0x0004}, {0x8595, 0x00b7},
3585{0x8596, 0x0012}, {0x8597, 0x0004}, {0x8598, 0x00b6},
3586{0x8599, 0x0012}, {0x859a, 0x0000}, {0x859b, 0x0084},
3587{0x859c, 0x0008}, {0x859d, 0x0081}, {0x859e, 0x0008},
3588{0x859f, 0x0027}, {0x85a0, 0x0016}, {0x85a1, 0x00b6},
3589{0x85a2, 0x008f}, {0x85a3, 0x007d}, {0x85a4, 0x0081},
3590{0x85a5, 0x000c}, {0x85a6, 0x0027}, {0x85a7, 0x0008},
3591{0x85a8, 0x008b}, {0x85a9, 0x0004}, {0x85aa, 0x00b7},
3592{0x85ab, 0x008f}, {0x85ac, 0x007d}, {0x85ad, 0x007e},
3593{0x85ae, 0x0085}, {0x85af, 0x006c}, {0x85b0, 0x0086},
3594{0x85b1, 0x0003}, {0x85b2, 0x0097}, {0x85b3, 0x0040},
3595{0x85b4, 0x007e}, {0x85b5, 0x0089}, {0x85b6, 0x006e},
3596{0x85b7, 0x0086}, {0x85b8, 0x0007}, {0x85b9, 0x00b7},
3597{0x85ba, 0x0012}, {0x85bb, 0x0006}, {0x85bc, 0x005f},
3598{0x85bd, 0x00f7}, {0x85be, 0x008f}, {0x85bf, 0x0082},
3599{0x85c0, 0x005f}, {0x85c1, 0x00f7}, {0x85c2, 0x008f},
3600{0x85c3, 0x007f}, {0x85c4, 0x00f7}, {0x85c5, 0x008f},
3601{0x85c6, 0x0070}, {0x85c7, 0x00f7}, {0x85c8, 0x008f},
3602{0x85c9, 0x0071}, {0x85ca, 0x00f7}, {0x85cb, 0x008f},
3603{0x85cc, 0x0072}, {0x85cd, 0x00f7}, {0x85ce, 0x008f},
3604{0x85cf, 0x0073}, {0x85d0, 0x00f7}, {0x85d1, 0x008f},
3605{0x85d2, 0x0074}, {0x85d3, 0x00f7}, {0x85d4, 0x008f},
3606{0x85d5, 0x0075}, {0x85d6, 0x00f7}, {0x85d7, 0x008f},
3607{0x85d8, 0x0076}, {0x85d9, 0x00f7}, {0x85da, 0x008f},
3608{0x85db, 0x0077}, {0x85dc, 0x00f7}, {0x85dd, 0x008f},
3609{0x85de, 0x0078}, {0x85df, 0x00f7}, {0x85e0, 0x008f},
3610{0x85e1, 0x0079}, {0x85e2, 0x00f7}, {0x85e3, 0x008f},
3611{0x85e4, 0x007a}, {0x85e5, 0x00f7}, {0x85e6, 0x008f},
3612{0x85e7, 0x007b}, {0x85e8, 0x00b6}, {0x85e9, 0x0012},
3613{0x85ea, 0x0004}, {0x85eb, 0x008a}, {0x85ec, 0x0010},
3614{0x85ed, 0x00b7}, {0x85ee, 0x0012}, {0x85ef, 0x0004},
3615{0x85f0, 0x0086}, {0x85f1, 0x00e4}, {0x85f2, 0x00b7},
3616{0x85f3, 0x0012}, {0x85f4, 0x0070}, {0x85f5, 0x00b7},
3617{0x85f6, 0x0012}, {0x85f7, 0x0007}, {0x85f8, 0x00f7},
3618{0x85f9, 0x0012}, {0x85fa, 0x0005}, {0x85fb, 0x00f7},
3619{0x85fc, 0x0012}, {0x85fd, 0x0009}, {0x85fe, 0x0086},
3620{0x85ff, 0x0008}, {0x8600, 0x00ba}, {0x8601, 0x0012},
3621{0x8602, 0x0004}, {0x8603, 0x00b7}, {0x8604, 0x0012},
3622{0x8605, 0x0004}, {0x8606, 0x0086}, {0x8607, 0x00f7},
3623{0x8608, 0x00b4}, {0x8609, 0x0012}, {0x860a, 0x0004},
3624{0x860b, 0x00b7}, {0x860c, 0x0012}, {0x860d, 0x0004},
3625{0x860e, 0x0001}, {0x860f, 0x0001}, {0x8610, 0x0001},
3626{0x8611, 0x0001}, {0x8612, 0x0001}, {0x8613, 0x0001},
3627{0x8614, 0x00b6}, {0x8615, 0x0012}, {0x8616, 0x0008},
3628{0x8617, 0x0027}, {0x8618, 0x007f}, {0x8619, 0x0081},
3629{0x861a, 0x0080}, {0x861b, 0x0026}, {0x861c, 0x000b},
3630{0x861d, 0x0086}, {0x861e, 0x0008}, {0x861f, 0x00ce},
3631{0x8620, 0x008f}, {0x8621, 0x0079}, {0x8622, 0x00bd},
3632{0x8623, 0x0089}, {0x8624, 0x007b}, {0x8625, 0x007e},
3633{0x8626, 0x0086}, {0x8627, 0x008e}, {0x8628, 0x0081},
3634{0x8629, 0x0040}, {0x862a, 0x0026}, {0x862b, 0x000b},
3635{0x862c, 0x0086}, {0x862d, 0x0004}, {0x862e, 0x00ce},
3636{0x862f, 0x008f}, {0x8630, 0x0076}, {0x8631, 0x00bd},
3637{0x8632, 0x0089}, {0x8633, 0x007b}, {0x8634, 0x007e},
3638{0x8635, 0x0086}, {0x8636, 0x008e}, {0x8637, 0x0081},
3639{0x8638, 0x0020}, {0x8639, 0x0026}, {0x863a, 0x000b},
3640{0x863b, 0x0086}, {0x863c, 0x0002}, {0x863d, 0x00ce},
3641{0x863e, 0x008f}, {0x863f, 0x0073}, {0x8640, 0x00bd},
3642{0x8641, 0x0089}, {0x8642, 0x007b}, {0x8643, 0x007e},
3643{0x8644, 0x0086}, {0x8645, 0x008e}, {0x8646, 0x0081},
3644{0x8647, 0x0010}, {0x8648, 0x0026}, {0x8649, 0x000b},
3645{0x864a, 0x0086}, {0x864b, 0x0001}, {0x864c, 0x00ce},
3646{0x864d, 0x008f}, {0x864e, 0x0070}, {0x864f, 0x00bd},
3647{0x8650, 0x0089}, {0x8651, 0x007b}, {0x8652, 0x007e},
3648{0x8653, 0x0086}, {0x8654, 0x008e}, {0x8655, 0x0081},
3649{0x8656, 0x0008}, {0x8657, 0x0026}, {0x8658, 0x000b},
3650{0x8659, 0x0086}, {0x865a, 0x0008}, {0x865b, 0x00ce},
3651{0x865c, 0x008f}, {0x865d, 0x0079}, {0x865e, 0x00bd},
3652{0x865f, 0x0089}, {0x8660, 0x007f}, {0x8661, 0x007e},
3653{0x8662, 0x0086}, {0x8663, 0x008e}, {0x8664, 0x0081},
3654{0x8665, 0x0004}, {0x8666, 0x0026}, {0x8667, 0x000b},
3655{0x8668, 0x0086}, {0x8669, 0x0004}, {0x866a, 0x00ce},
3656{0x866b, 0x008f}, {0x866c, 0x0076}, {0x866d, 0x00bd},
3657{0x866e, 0x0089}, {0x866f, 0x007f}, {0x8670, 0x007e},
3658{0x8671, 0x0086}, {0x8672, 0x008e}, {0x8673, 0x0081},
3659{0x8674, 0x0002}, {0x8675, 0x0026}, {0x8676, 0x000b},
3660{0x8677, 0x008a}, {0x8678, 0x0002}, {0x8679, 0x00ce},
3661{0x867a, 0x008f}, {0x867b, 0x0073}, {0x867c, 0x00bd},
3662{0x867d, 0x0089}, {0x867e, 0x007f}, {0x867f, 0x007e},
3663{0x8680, 0x0086}, {0x8681, 0x008e}, {0x8682, 0x0081},
3664{0x8683, 0x0001}, {0x8684, 0x0026}, {0x8685, 0x0008},
3665{0x8686, 0x0086}, {0x8687, 0x0001}, {0x8688, 0x00ce},
3666{0x8689, 0x008f}, {0x868a, 0x0070}, {0x868b, 0x00bd},
3667{0x868c, 0x0089}, {0x868d, 0x007f}, {0x868e, 0x00b6},
3668{0x868f, 0x008f}, {0x8690, 0x007f}, {0x8691, 0x0081},
3669{0x8692, 0x000f}, {0x8693, 0x0026}, {0x8694, 0x0003},
3670{0x8695, 0x007e}, {0x8696, 0x0087}, {0x8697, 0x0047},
3671{0x8698, 0x00b6}, {0x8699, 0x0012}, {0x869a, 0x0009},
3672{0x869b, 0x0084}, {0x869c, 0x0003}, {0x869d, 0x0081},
3673{0x869e, 0x0003}, {0x869f, 0x0027}, {0x86a0, 0x0006},
3674{0x86a1, 0x007c}, {0x86a2, 0x0012}, {0x86a3, 0x0009},
3675{0x86a4, 0x007e}, {0x86a5, 0x0085}, {0x86a6, 0x00fe},
3676{0x86a7, 0x00b6}, {0x86a8, 0x0012}, {0x86a9, 0x0006},
3677{0x86aa, 0x0084}, {0x86ab, 0x0007}, {0x86ac, 0x0081},
3678{0x86ad, 0x0007}, {0x86ae, 0x0027}, {0x86af, 0x0008},
3679{0x86b0, 0x008b}, {0x86b1, 0x0001}, {0x86b2, 0x00b7},
3680{0x86b3, 0x0012}, {0x86b4, 0x0006}, {0x86b5, 0x007e},
3681{0x86b6, 0x0086}, {0x86b7, 0x00d5}, {0x86b8, 0x00b6},
3682{0x86b9, 0x008f}, {0x86ba, 0x0082}, {0x86bb, 0x0026},
3683{0x86bc, 0x000a}, {0x86bd, 0x007c}, {0x86be, 0x008f},
3684{0x86bf, 0x0082}, {0x86c0, 0x004f}, {0x86c1, 0x00b7},
3685{0x86c2, 0x0012}, {0x86c3, 0x0006}, {0x86c4, 0x007e},
3686{0x86c5, 0x0085}, {0x86c6, 0x00c0}, {0x86c7, 0x00b6},
3687{0x86c8, 0x0012}, {0x86c9, 0x0006}, {0x86ca, 0x0084},
3688{0x86cb, 0x003f}, {0x86cc, 0x0081}, {0x86cd, 0x003f},
3689{0x86ce, 0x0027}, {0x86cf, 0x0010}, {0x86d0, 0x008b},
3690{0x86d1, 0x0008}, {0x86d2, 0x00b7}, {0x86d3, 0x0012},
3691{0x86d4, 0x0006}, {0x86d5, 0x00b6}, {0x86d6, 0x0012},
3692{0x86d7, 0x0009}, {0x86d8, 0x0084}, {0x86d9, 0x00fc},
3693{0x86da, 0x00b7}, {0x86db, 0x0012}, {0x86dc, 0x0009},
3694{0x86dd, 0x007e}, {0x86de, 0x0085}, {0x86df, 0x00fe},
3695{0x86e0, 0x00ce}, {0x86e1, 0x008f}, {0x86e2, 0x0070},
3696{0x86e3, 0x0018}, {0x86e4, 0x00ce}, {0x86e5, 0x008f},
3697{0x86e6, 0x0084}, {0x86e7, 0x00c6}, {0x86e8, 0x000c},
3698{0x86e9, 0x00bd}, {0x86ea, 0x0089}, {0x86eb, 0x006f},
3699{0x86ec, 0x00ce}, {0x86ed, 0x008f}, {0x86ee, 0x0084},
3700{0x86ef, 0x0018}, {0x86f0, 0x00ce}, {0x86f1, 0x008f},
3701{0x86f2, 0x0070}, {0x86f3, 0x00c6}, {0x86f4, 0x000c},
3702{0x86f5, 0x00bd}, {0x86f6, 0x0089}, {0x86f7, 0x006f},
3703{0x86f8, 0x00d6}, {0x86f9, 0x0083}, {0x86fa, 0x00c1},
3704{0x86fb, 0x004f}, {0x86fc, 0x002d}, {0x86fd, 0x0003},
3705{0x86fe, 0x007e}, {0x86ff, 0x0087}, {0x8700, 0x0040},
3706{0x8701, 0x00b6}, {0x8702, 0x008f}, {0x8703, 0x007f},
3707{0x8704, 0x0081}, {0x8705, 0x0007}, {0x8706, 0x0027},
3708{0x8707, 0x000f}, {0x8708, 0x0081}, {0x8709, 0x000b},
3709{0x870a, 0x0027}, {0x870b, 0x0015}, {0x870c, 0x0081},
3710{0x870d, 0x000d}, {0x870e, 0x0027}, {0x870f, 0x001b},
3711{0x8710, 0x0081}, {0x8711, 0x000e}, {0x8712, 0x0027},
3712{0x8713, 0x0021}, {0x8714, 0x007e}, {0x8715, 0x0087},
3713{0x8716, 0x0040}, {0x8717, 0x00f7}, {0x8718, 0x008f},
3714{0x8719, 0x007b}, {0x871a, 0x0086}, {0x871b, 0x0002},
3715{0x871c, 0x00b7}, {0x871d, 0x008f}, {0x871e, 0x007a},
3716{0x871f, 0x0020}, {0x8720, 0x001c}, {0x8721, 0x00f7},
3717{0x8722, 0x008f}, {0x8723, 0x0078}, {0x8724, 0x0086},
3718{0x8725, 0x0002}, {0x8726, 0x00b7}, {0x8727, 0x008f},
3719{0x8728, 0x0077}, {0x8729, 0x0020}, {0x872a, 0x0012},
3720{0x872b, 0x00f7}, {0x872c, 0x008f}, {0x872d, 0x0075},
3721{0x872e, 0x0086}, {0x872f, 0x0002}, {0x8730, 0x00b7},
3722{0x8731, 0x008f}, {0x8732, 0x0074}, {0x8733, 0x0020},
3723{0x8734, 0x0008}, {0x8735, 0x00f7}, {0x8736, 0x008f},
3724{0x8737, 0x0072}, {0x8738, 0x0086}, {0x8739, 0x0002},
3725{0x873a, 0x00b7}, {0x873b, 0x008f}, {0x873c, 0x0071},
3726{0x873d, 0x007e}, {0x873e, 0x0087}, {0x873f, 0x0047},
3727{0x8740, 0x0086}, {0x8741, 0x0004}, {0x8742, 0x0097},
3728{0x8743, 0x0040}, {0x8744, 0x007e}, {0x8745, 0x0089},
3729{0x8746, 0x006e}, {0x8747, 0x00ce}, {0x8748, 0x008f},
3730{0x8749, 0x0072}, {0x874a, 0x00bd}, {0x874b, 0x0089},
3731{0x874c, 0x00f7}, {0x874d, 0x00ce}, {0x874e, 0x008f},
3732{0x874f, 0x0075}, {0x8750, 0x00bd}, {0x8751, 0x0089},
3733{0x8752, 0x00f7}, {0x8753, 0x00ce}, {0x8754, 0x008f},
3734{0x8755, 0x0078}, {0x8756, 0x00bd}, {0x8757, 0x0089},
3735{0x8758, 0x00f7}, {0x8759, 0x00ce}, {0x875a, 0x008f},
3736{0x875b, 0x007b}, {0x875c, 0x00bd}, {0x875d, 0x0089},
3737{0x875e, 0x00f7}, {0x875f, 0x004f}, {0x8760, 0x00b7},
3738{0x8761, 0x008f}, {0x8762, 0x007d}, {0x8763, 0x00b7},
3739{0x8764, 0x008f}, {0x8765, 0x0081}, {0x8766, 0x00b6},
3740{0x8767, 0x008f}, {0x8768, 0x0072}, {0x8769, 0x0027},
3741{0x876a, 0x0047}, {0x876b, 0x007c}, {0x876c, 0x008f},
3742{0x876d, 0x007d}, {0x876e, 0x00b6}, {0x876f, 0x008f},
3743{0x8770, 0x0075}, {0x8771, 0x0027}, {0x8772, 0x003f},
3744{0x8773, 0x007c}, {0x8774, 0x008f}, {0x8775, 0x007d},
3745{0x8776, 0x00b6}, {0x8777, 0x008f}, {0x8778, 0x0078},
3746{0x8779, 0x0027}, {0x877a, 0x0037}, {0x877b, 0x007c},
3747{0x877c, 0x008f}, {0x877d, 0x007d}, {0x877e, 0x00b6},
3748{0x877f, 0x008f}, {0x8780, 0x007b}, {0x8781, 0x0027},
3749{0x8782, 0x002f}, {0x8783, 0x007f}, {0x8784, 0x008f},
3750{0x8785, 0x007d}, {0x8786, 0x007c}, {0x8787, 0x008f},
3751{0x8788, 0x0081}, {0x8789, 0x007a}, {0x878a, 0x008f},
3752{0x878b, 0x0072}, {0x878c, 0x0027}, {0x878d, 0x001b},
3753{0x878e, 0x007c}, {0x878f, 0x008f}, {0x8790, 0x007d},
3754{0x8791, 0x007a}, {0x8792, 0x008f}, {0x8793, 0x0075},
3755{0x8794, 0x0027}, {0x8795, 0x0016}, {0x8796, 0x007c},
3756{0x8797, 0x008f}, {0x8798, 0x007d}, {0x8799, 0x007a},
3757{0x879a, 0x008f}, {0x879b, 0x0078}, {0x879c, 0x0027},
3758{0x879d, 0x0011}, {0x879e, 0x007c}, {0x879f, 0x008f},
3759{0x87a0, 0x007d}, {0x87a1, 0x007a}, {0x87a2, 0x008f},
3760{0x87a3, 0x007b}, {0x87a4, 0x0027}, {0x87a5, 0x000c},
3761{0x87a6, 0x007e}, {0x87a7, 0x0087}, {0x87a8, 0x0083},
3762{0x87a9, 0x007a}, {0x87aa, 0x008f}, {0x87ab, 0x0075},
3763{0x87ac, 0x007a}, {0x87ad, 0x008f}, {0x87ae, 0x0078},
3764{0x87af, 0x007a}, {0x87b0, 0x008f}, {0x87b1, 0x007b},
3765{0x87b2, 0x00ce}, {0x87b3, 0x00c1}, {0x87b4, 0x00fc},
3766{0x87b5, 0x00f6}, {0x87b6, 0x008f}, {0x87b7, 0x007d},
3767{0x87b8, 0x003a}, {0x87b9, 0x00a6}, {0x87ba, 0x0000},
3768{0x87bb, 0x00b7}, {0x87bc, 0x0012}, {0x87bd, 0x0070},
3769{0x87be, 0x00b6}, {0x87bf, 0x008f}, {0x87c0, 0x0072},
3770{0x87c1, 0x0026}, {0x87c2, 0x0003}, {0x87c3, 0x007e},
3771{0x87c4, 0x0087}, {0x87c5, 0x00fa}, {0x87c6, 0x00b6},
3772{0x87c7, 0x008f}, {0x87c8, 0x0075}, {0x87c9, 0x0026},
3773{0x87ca, 0x000a}, {0x87cb, 0x0018}, {0x87cc, 0x00ce},
3774{0x87cd, 0x008f}, {0x87ce, 0x0073}, {0x87cf, 0x00bd},
3775{0x87d0, 0x0089}, {0x87d1, 0x00d5}, {0x87d2, 0x007e},
3776{0x87d3, 0x0087}, {0x87d4, 0x00fa}, {0x87d5, 0x00b6},
3777{0x87d6, 0x008f}, {0x87d7, 0x0078}, {0x87d8, 0x0026},
3778{0x87d9, 0x000a}, {0x87da, 0x0018}, {0x87db, 0x00ce},
3779{0x87dc, 0x008f}, {0x87dd, 0x0076}, {0x87de, 0x00bd},
3780{0x87df, 0x0089}, {0x87e0, 0x00d5}, {0x87e1, 0x007e},
3781{0x87e2, 0x0087}, {0x87e3, 0x00fa}, {0x87e4, 0x00b6},
3782{0x87e5, 0x008f}, {0x87e6, 0x007b}, {0x87e7, 0x0026},
3783{0x87e8, 0x000a}, {0x87e9, 0x0018}, {0x87ea, 0x00ce},
3784{0x87eb, 0x008f}, {0x87ec, 0x0079}, {0x87ed, 0x00bd},
3785{0x87ee, 0x0089}, {0x87ef, 0x00d5}, {0x87f0, 0x007e},
3786{0x87f1, 0x0087}, {0x87f2, 0x00fa}, {0x87f3, 0x0086},
3787{0x87f4, 0x0005}, {0x87f5, 0x0097}, {0x87f6, 0x0040},
3788{0x87f7, 0x007e}, {0x87f8, 0x0089}, {0x87f9, 0x006e},
3789{0x87fa, 0x00b6}, {0x87fb, 0x008f}, {0x87fc, 0x0075},
3790{0x87fd, 0x0081}, {0x87fe, 0x0007}, {0x87ff, 0x002e},
3791{0x8800, 0x00f2}, {0x8801, 0x00f6}, {0x8802, 0x0012},
3792{0x8803, 0x0006}, {0x8804, 0x00c4}, {0x8805, 0x00f8},
3793{0x8806, 0x001b}, {0x8807, 0x00b7}, {0x8808, 0x0012},
3794{0x8809, 0x0006}, {0x880a, 0x00b6}, {0x880b, 0x008f},
3795{0x880c, 0x0078}, {0x880d, 0x0081}, {0x880e, 0x0007},
3796{0x880f, 0x002e}, {0x8810, 0x00e2}, {0x8811, 0x0048},
3797{0x8812, 0x0048}, {0x8813, 0x0048}, {0x8814, 0x00f6},
3798{0x8815, 0x0012}, {0x8816, 0x0006}, {0x8817, 0x00c4},
3799{0x8818, 0x00c7}, {0x8819, 0x001b}, {0x881a, 0x00b7},
3800{0x881b, 0x0012}, {0x881c, 0x0006}, {0x881d, 0x00b6},
3801{0x881e, 0x008f}, {0x881f, 0x007b}, {0x8820, 0x0081},
3802{0x8821, 0x0007}, {0x8822, 0x002e}, {0x8823, 0x00cf},
3803{0x8824, 0x00f6}, {0x8825, 0x0012}, {0x8826, 0x0005},
3804{0x8827, 0x00c4}, {0x8828, 0x00f8}, {0x8829, 0x001b},
3805{0x882a, 0x00b7}, {0x882b, 0x0012}, {0x882c, 0x0005},
3806{0x882d, 0x0086}, {0x882e, 0x0000}, {0x882f, 0x00f6},
3807{0x8830, 0x008f}, {0x8831, 0x0071}, {0x8832, 0x00bd},
3808{0x8833, 0x0089}, {0x8834, 0x0094}, {0x8835, 0x0086},
3809{0x8836, 0x0001}, {0x8837, 0x00f6}, {0x8838, 0x008f},
3810{0x8839, 0x0074}, {0x883a, 0x00bd}, {0x883b, 0x0089},
3811{0x883c, 0x0094}, {0x883d, 0x0086}, {0x883e, 0x0002},
3812{0x883f, 0x00f6}, {0x8840, 0x008f}, {0x8841, 0x0077},
3813{0x8842, 0x00bd}, {0x8843, 0x0089}, {0x8844, 0x0094},
3814{0x8845, 0x0086}, {0x8846, 0x0003}, {0x8847, 0x00f6},
3815{0x8848, 0x008f}, {0x8849, 0x007a}, {0x884a, 0x00bd},
3816{0x884b, 0x0089}, {0x884c, 0x0094}, {0x884d, 0x00ce},
3817{0x884e, 0x008f}, {0x884f, 0x0070}, {0x8850, 0x00a6},
3818{0x8851, 0x0001}, {0x8852, 0x0081}, {0x8853, 0x0001},
3819{0x8854, 0x0027}, {0x8855, 0x0007}, {0x8856, 0x0081},
3820{0x8857, 0x0003}, {0x8858, 0x0027}, {0x8859, 0x0003},
3821{0x885a, 0x007e}, {0x885b, 0x0088}, {0x885c, 0x0066},
3822{0x885d, 0x00a6}, {0x885e, 0x0000}, {0x885f, 0x00b8},
3823{0x8860, 0x008f}, {0x8861, 0x0081}, {0x8862, 0x0084},
3824{0x8863, 0x0001}, {0x8864, 0x0026}, {0x8865, 0x000b},
3825{0x8866, 0x008c}, {0x8867, 0x008f}, {0x8868, 0x0079},
3826{0x8869, 0x002c}, {0x886a, 0x000e}, {0x886b, 0x0008},
3827{0x886c, 0x0008}, {0x886d, 0x0008}, {0x886e, 0x007e},
3828{0x886f, 0x0088}, {0x8870, 0x0050}, {0x8871, 0x00b6},
3829{0x8872, 0x0012}, {0x8873, 0x0004}, {0x8874, 0x008a},
3830{0x8875, 0x0040}, {0x8876, 0x00b7}, {0x8877, 0x0012},
3831{0x8878, 0x0004}, {0x8879, 0x00b6}, {0x887a, 0x0012},
3832{0x887b, 0x0004}, {0x887c, 0x0084}, {0x887d, 0x00fb},
3833{0x887e, 0x0084}, {0x887f, 0x00ef}, {0x8880, 0x00b7},
3834{0x8881, 0x0012}, {0x8882, 0x0004}, {0x8883, 0x00b6},
3835{0x8884, 0x0012}, {0x8885, 0x0007}, {0x8886, 0x0036},
3836{0x8887, 0x00b6}, {0x8888, 0x008f}, {0x8889, 0x007c},
3837{0x888a, 0x0048}, {0x888b, 0x0048}, {0x888c, 0x00b7},
3838{0x888d, 0x0012}, {0x888e, 0x0007}, {0x888f, 0x0086},
3839{0x8890, 0x0001}, {0x8891, 0x00ba}, {0x8892, 0x0012},
3840{0x8893, 0x0004}, {0x8894, 0x00b7}, {0x8895, 0x0012},
3841{0x8896, 0x0004}, {0x8897, 0x0001}, {0x8898, 0x0001},
3842{0x8899, 0x0001}, {0x889a, 0x0001}, {0x889b, 0x0001},
3843{0x889c, 0x0001}, {0x889d, 0x0086}, {0x889e, 0x00fe},
3844{0x889f, 0x00b4}, {0x88a0, 0x0012}, {0x88a1, 0x0004},
3845{0x88a2, 0x00b7}, {0x88a3, 0x0012}, {0x88a4, 0x0004},
3846{0x88a5, 0x0086}, {0x88a6, 0x0002}, {0x88a7, 0x00ba},
3847{0x88a8, 0x0012}, {0x88a9, 0x0004}, {0x88aa, 0x00b7},
3848{0x88ab, 0x0012}, {0x88ac, 0x0004}, {0x88ad, 0x0086},
3849{0x88ae, 0x00fd}, {0x88af, 0x00b4}, {0x88b0, 0x0012},
3850{0x88b1, 0x0004}, {0x88b2, 0x00b7}, {0x88b3, 0x0012},
3851{0x88b4, 0x0004}, {0x88b5, 0x0032}, {0x88b6, 0x00b7},
3852{0x88b7, 0x0012}, {0x88b8, 0x0007}, {0x88b9, 0x00b6},
3853{0x88ba, 0x0012}, {0x88bb, 0x0000}, {0x88bc, 0x0084},
3854{0x88bd, 0x0008}, {0x88be, 0x0081}, {0x88bf, 0x0008},
3855{0x88c0, 0x0027}, {0x88c1, 0x000f}, {0x88c2, 0x007c},
3856{0x88c3, 0x0082}, {0x88c4, 0x0008}, {0x88c5, 0x0026},
3857{0x88c6, 0x0007}, {0x88c7, 0x0086}, {0x88c8, 0x0076},
3858{0x88c9, 0x0097}, {0x88ca, 0x0040}, {0x88cb, 0x007e},
3859{0x88cc, 0x0089}, {0x88cd, 0x006e}, {0x88ce, 0x007e},
3860{0x88cf, 0x0086}, {0x88d0, 0x00ec}, {0x88d1, 0x00b6},
3861{0x88d2, 0x008f}, {0x88d3, 0x007f}, {0x88d4, 0x0081},
3862{0x88d5, 0x000f}, {0x88d6, 0x0027}, {0x88d7, 0x003c},
3863{0x88d8, 0x00bd}, {0x88d9, 0x00e6}, {0x88da, 0x00c7},
3864{0x88db, 0x00b7}, {0x88dc, 0x0012}, {0x88dd, 0x000d},
3865{0x88de, 0x00bd}, {0x88df, 0x00e6}, {0x88e0, 0x00cb},
3866{0x88e1, 0x00b6}, {0x88e2, 0x0012}, {0x88e3, 0x0004},
3867{0x88e4, 0x008a}, {0x88e5, 0x0020}, {0x88e6, 0x00b7},
3868{0x88e7, 0x0012}, {0x88e8, 0x0004}, {0x88e9, 0x00ce},
3869{0x88ea, 0x00ff}, {0x88eb, 0x00ff}, {0x88ec, 0x00b6},
3870{0x88ed, 0x0012}, {0x88ee, 0x0000}, {0x88ef, 0x0081},
3871{0x88f0, 0x000c}, {0x88f1, 0x0026}, {0x88f2, 0x0005},
3872{0x88f3, 0x0009}, {0x88f4, 0x0026}, {0x88f5, 0x00f6},
3873{0x88f6, 0x0027}, {0x88f7, 0x001c}, {0x88f8, 0x00b6},
3874{0x88f9, 0x0012}, {0x88fa, 0x0004}, {0x88fb, 0x0084},
3875{0x88fc, 0x00df}, {0x88fd, 0x00b7}, {0x88fe, 0x0012},
3876{0x88ff, 0x0004}, {0x8900, 0x0096}, {0x8901, 0x0083},
3877{0x8902, 0x0081}, {0x8903, 0x0007}, {0x8904, 0x002c},
3878{0x8905, 0x0005}, {0x8906, 0x007c}, {0x8907, 0x0000},
3879{0x8908, 0x0083}, {0x8909, 0x0020}, {0x890a, 0x0006},
3880{0x890b, 0x0096}, {0x890c, 0x0083}, {0x890d, 0x008b},
3881{0x890e, 0x0008}, {0x890f, 0x0097}, {0x8910, 0x0083},
3882{0x8911, 0x007e}, {0x8912, 0x0085}, {0x8913, 0x0041},
3883{0x8914, 0x007f}, {0x8915, 0x008f}, {0x8916, 0x007e},
3884{0x8917, 0x0086}, {0x8918, 0x0080}, {0x8919, 0x00b7},
3885{0x891a, 0x0012}, {0x891b, 0x000c}, {0x891c, 0x0086},
3886{0x891d, 0x0001}, {0x891e, 0x00b7}, {0x891f, 0x008f},
3887{0x8920, 0x007d}, {0x8921, 0x00b6}, {0x8922, 0x0012},
3888{0x8923, 0x000c}, {0x8924, 0x0084}, {0x8925, 0x007f},
3889{0x8926, 0x00b7}, {0x8927, 0x0012}, {0x8928, 0x000c},
3890{0x8929, 0x008a}, {0x892a, 0x0080}, {0x892b, 0x00b7},
3891{0x892c, 0x0012}, {0x892d, 0x000c}, {0x892e, 0x0086},
3892{0x892f, 0x000a}, {0x8930, 0x00bd}, {0x8931, 0x008a},
3893{0x8932, 0x0006}, {0x8933, 0x00b6}, {0x8934, 0x0012},
3894{0x8935, 0x000a}, {0x8936, 0x002a}, {0x8937, 0x0009},
3895{0x8938, 0x00b6}, {0x8939, 0x0012}, {0x893a, 0x000c},
3896{0x893b, 0x00ba}, {0x893c, 0x008f}, {0x893d, 0x007d},
3897{0x893e, 0x00b7}, {0x893f, 0x0012}, {0x8940, 0x000c},
3898{0x8941, 0x00b6}, {0x8942, 0x008f}, {0x8943, 0x007e},
3899{0x8944, 0x0081}, {0x8945, 0x0060}, {0x8946, 0x0027},
3900{0x8947, 0x001a}, {0x8948, 0x008b}, {0x8949, 0x0020},
3901{0x894a, 0x00b7}, {0x894b, 0x008f}, {0x894c, 0x007e},
3902{0x894d, 0x00b6}, {0x894e, 0x0012}, {0x894f, 0x000c},
3903{0x8950, 0x0084}, {0x8951, 0x009f}, {0x8952, 0x00ba},
3904{0x8953, 0x008f}, {0x8954, 0x007e}, {0x8955, 0x00b7},
3905{0x8956, 0x0012}, {0x8957, 0x000c}, {0x8958, 0x00b6},
3906{0x8959, 0x008f}, {0x895a, 0x007d}, {0x895b, 0x0048},
3907{0x895c, 0x00b7}, {0x895d, 0x008f}, {0x895e, 0x007d},
3908{0x895f, 0x007e}, {0x8960, 0x0089}, {0x8961, 0x0021},
3909{0x8962, 0x00b6}, {0x8963, 0x0012}, {0x8964, 0x0004},
3910{0x8965, 0x008a}, {0x8966, 0x0020}, {0x8967, 0x00b7},
3911{0x8968, 0x0012}, {0x8969, 0x0004}, {0x896a, 0x00bd},
3912{0x896b, 0x008a}, {0x896c, 0x000a}, {0x896d, 0x004f},
3913{0x896e, 0x0039}, {0x896f, 0x00a6}, {0x8970, 0x0000},
3914{0x8971, 0x0018}, {0x8972, 0x00a7}, {0x8973, 0x0000},
3915{0x8974, 0x0008}, {0x8975, 0x0018}, {0x8976, 0x0008},
3916{0x8977, 0x005a}, {0x8978, 0x0026}, {0x8979, 0x00f5},
3917{0x897a, 0x0039}, {0x897b, 0x0036}, {0x897c, 0x006c},
3918{0x897d, 0x0000}, {0x897e, 0x0032}, {0x897f, 0x00ba},
3919{0x8980, 0x008f}, {0x8981, 0x007f}, {0x8982, 0x00b7},
3920{0x8983, 0x008f}, {0x8984, 0x007f}, {0x8985, 0x00b6},
3921{0x8986, 0x0012}, {0x8987, 0x0009}, {0x8988, 0x0084},
3922{0x8989, 0x0003}, {0x898a, 0x00a7}, {0x898b, 0x0001},
3923{0x898c, 0x00b6}, {0x898d, 0x0012}, {0x898e, 0x0006},
3924{0x898f, 0x0084}, {0x8990, 0x003f}, {0x8991, 0x00a7},
3925{0x8992, 0x0002}, {0x8993, 0x0039}, {0x8994, 0x0036},
3926{0x8995, 0x0086}, {0x8996, 0x0003}, {0x8997, 0x00b7},
3927{0x8998, 0x008f}, {0x8999, 0x0080}, {0x899a, 0x0032},
3928{0x899b, 0x00c1}, {0x899c, 0x0000}, {0x899d, 0x0026},
3929{0x899e, 0x0006}, {0x899f, 0x00b7}, {0x89a0, 0x008f},
3930{0x89a1, 0x007c}, {0x89a2, 0x007e}, {0x89a3, 0x0089},
3931{0x89a4, 0x00c9}, {0x89a5, 0x00c1}, {0x89a6, 0x0001},
3932{0x89a7, 0x0027}, {0x89a8, 0x0018}, {0x89a9, 0x00c1},
3933{0x89aa, 0x0002}, {0x89ab, 0x0027}, {0x89ac, 0x000c},
3934{0x89ad, 0x00c1}, {0x89ae, 0x0003}, {0x89af, 0x0027},
3935{0x89b0, 0x0000}, {0x89b1, 0x00f6}, {0x89b2, 0x008f},
3936{0x89b3, 0x0080}, {0x89b4, 0x0005}, {0x89b5, 0x0005},
3937{0x89b6, 0x00f7}, {0x89b7, 0x008f}, {0x89b8, 0x0080},
3938{0x89b9, 0x00f6}, {0x89ba, 0x008f}, {0x89bb, 0x0080},
3939{0x89bc, 0x0005}, {0x89bd, 0x0005}, {0x89be, 0x00f7},
3940{0x89bf, 0x008f}, {0x89c0, 0x0080}, {0x89c1, 0x00f6},
3941{0x89c2, 0x008f}, {0x89c3, 0x0080}, {0x89c4, 0x0005},
3942{0x89c5, 0x0005}, {0x89c6, 0x00f7}, {0x89c7, 0x008f},
3943{0x89c8, 0x0080}, {0x89c9, 0x00f6}, {0x89ca, 0x008f},
3944{0x89cb, 0x0080}, {0x89cc, 0x0053}, {0x89cd, 0x00f4},
3945{0x89ce, 0x0012}, {0x89cf, 0x0007}, {0x89d0, 0x001b},
3946{0x89d1, 0x00b7}, {0x89d2, 0x0012}, {0x89d3, 0x0007},
3947{0x89d4, 0x0039}, {0x89d5, 0x00ce}, {0x89d6, 0x008f},
3948{0x89d7, 0x0070}, {0x89d8, 0x00a6}, {0x89d9, 0x0000},
3949{0x89da, 0x0018}, {0x89db, 0x00e6}, {0x89dc, 0x0000},
3950{0x89dd, 0x0018}, {0x89de, 0x00a7}, {0x89df, 0x0000},
3951{0x89e0, 0x00e7}, {0x89e1, 0x0000}, {0x89e2, 0x00a6},
3952{0x89e3, 0x0001}, {0x89e4, 0x0018}, {0x89e5, 0x00e6},
3953{0x89e6, 0x0001}, {0x89e7, 0x0018}, {0x89e8, 0x00a7},
3954{0x89e9, 0x0001}, {0x89ea, 0x00e7}, {0x89eb, 0x0001},
3955{0x89ec, 0x00a6}, {0x89ed, 0x0002}, {0x89ee, 0x0018},
3956{0x89ef, 0x00e6}, {0x89f0, 0x0002}, {0x89f1, 0x0018},
3957{0x89f2, 0x00a7}, {0x89f3, 0x0002}, {0x89f4, 0x00e7},
3958{0x89f5, 0x0002}, {0x89f6, 0x0039}, {0x89f7, 0x00a6},
3959{0x89f8, 0x0000}, {0x89f9, 0x0084}, {0x89fa, 0x0007},
3960{0x89fb, 0x00e6}, {0x89fc, 0x0000}, {0x89fd, 0x00c4},
3961{0x89fe, 0x0038}, {0x89ff, 0x0054}, {0x8a00, 0x0054},
3962{0x8a01, 0x0054}, {0x8a02, 0x001b}, {0x8a03, 0x00a7},
3963{0x8a04, 0x0000}, {0x8a05, 0x0039}, {0x8a06, 0x004a},
3964{0x8a07, 0x0026}, {0x8a08, 0x00fd}, {0x8a09, 0x0039},
3965{0x8a0a, 0x0096}, {0x8a0b, 0x0022}, {0x8a0c, 0x0084},
3966{0x8a0d, 0x000f}, {0x8a0e, 0x0097}, {0x8a0f, 0x0022},
3967{0x8a10, 0x0086}, {0x8a11, 0x0001}, {0x8a12, 0x00b7},
3968{0x8a13, 0x008f}, {0x8a14, 0x0070}, {0x8a15, 0x00b6},
3969{0x8a16, 0x0012}, {0x8a17, 0x0007}, {0x8a18, 0x00b7},
3970{0x8a19, 0x008f}, {0x8a1a, 0x0071}, {0x8a1b, 0x00f6},
3971{0x8a1c, 0x0012}, {0x8a1d, 0x000c}, {0x8a1e, 0x00c4},
3972{0x8a1f, 0x000f}, {0x8a20, 0x00c8}, {0x8a21, 0x000f},
3973{0x8a22, 0x00f7}, {0x8a23, 0x008f}, {0x8a24, 0x0072},
3974{0x8a25, 0x00f6}, {0x8a26, 0x008f}, {0x8a27, 0x0072},
3975{0x8a28, 0x00b6}, {0x8a29, 0x008f}, {0x8a2a, 0x0071},
3976{0x8a2b, 0x0084}, {0x8a2c, 0x0003}, {0x8a2d, 0x0027},
3977{0x8a2e, 0x0014}, {0x8a2f, 0x0081}, {0x8a30, 0x0001},
3978{0x8a31, 0x0027}, {0x8a32, 0x001c}, {0x8a33, 0x0081},
3979{0x8a34, 0x0002}, {0x8a35, 0x0027}, {0x8a36, 0x0024},
3980{0x8a37, 0x00f4}, {0x8a38, 0x008f}, {0x8a39, 0x0070},
3981{0x8a3a, 0x0027}, {0x8a3b, 0x002a}, {0x8a3c, 0x0096},
3982{0x8a3d, 0x0022}, {0x8a3e, 0x008a}, {0x8a3f, 0x0080},
3983{0x8a40, 0x007e}, {0x8a41, 0x008a}, {0x8a42, 0x0064},
3984{0x8a43, 0x00f4}, {0x8a44, 0x008f}, {0x8a45, 0x0070},
3985{0x8a46, 0x0027}, {0x8a47, 0x001e}, {0x8a48, 0x0096},
3986{0x8a49, 0x0022}, {0x8a4a, 0x008a}, {0x8a4b, 0x0010},
3987{0x8a4c, 0x007e}, {0x8a4d, 0x008a}, {0x8a4e, 0x0064},
3988{0x8a4f, 0x00f4}, {0x8a50, 0x008f}, {0x8a51, 0x0070},
3989{0x8a52, 0x0027}, {0x8a53, 0x0012}, {0x8a54, 0x0096},
3990{0x8a55, 0x0022}, {0x8a56, 0x008a}, {0x8a57, 0x0020},
3991{0x8a58, 0x007e}, {0x8a59, 0x008a}, {0x8a5a, 0x0064},
3992{0x8a5b, 0x00f4}, {0x8a5c, 0x008f}, {0x8a5d, 0x0070},
3993{0x8a5e, 0x0027}, {0x8a5f, 0x0006}, {0x8a60, 0x0096},
3994{0x8a61, 0x0022}, {0x8a62, 0x008a}, {0x8a63, 0x0040},
3995{0x8a64, 0x0097}, {0x8a65, 0x0022}, {0x8a66, 0x0074},
3996{0x8a67, 0x008f}, {0x8a68, 0x0071}, {0x8a69, 0x0074},
3997{0x8a6a, 0x008f}, {0x8a6b, 0x0071}, {0x8a6c, 0x0078},
3998{0x8a6d, 0x008f}, {0x8a6e, 0x0070}, {0x8a6f, 0x00b6},
3999{0x8a70, 0x008f}, {0x8a71, 0x0070}, {0x8a72, 0x0085},
4000{0x8a73, 0x0010}, {0x8a74, 0x0027}, {0x8a75, 0x00af},
4001{0x8a76, 0x00d6}, {0x8a77, 0x0022}, {0x8a78, 0x00c4},
4002{0x8a79, 0x0010}, {0x8a7a, 0x0058}, {0x8a7b, 0x00b6},
4003{0x8a7c, 0x0012}, {0x8a7d, 0x0070}, {0x8a7e, 0x0081},
4004{0x8a7f, 0x00e4}, {0x8a80, 0x0027}, {0x8a81, 0x0036},
4005{0x8a82, 0x0081}, {0x8a83, 0x00e1}, {0x8a84, 0x0026},
4006{0x8a85, 0x000c}, {0x8a86, 0x0096}, {0x8a87, 0x0022},
4007{0x8a88, 0x0084}, {0x8a89, 0x0020}, {0x8a8a, 0x0044},
4008{0x8a8b, 0x001b}, {0x8a8c, 0x00d6}, {0x8a8d, 0x0022},
4009{0x8a8e, 0x00c4}, {0x8a8f, 0x00cf}, {0x8a90, 0x0020},
4010{0x8a91, 0x0023}, {0x8a92, 0x0058}, {0x8a93, 0x0081},
4011{0x8a94, 0x00c6}, {0x8a95, 0x0026}, {0x8a96, 0x000d},
4012{0x8a97, 0x0096}, {0x8a98, 0x0022}, {0x8a99, 0x0084},
4013{0x8a9a, 0x0040}, {0x8a9b, 0x0044}, {0x8a9c, 0x0044},
4014{0x8a9d, 0x001b}, {0x8a9e, 0x00d6}, {0x8a9f, 0x0022},
4015{0x8aa0, 0x00c4}, {0x8aa1, 0x00af}, {0x8aa2, 0x0020},
4016{0x8aa3, 0x0011}, {0x8aa4, 0x0058}, {0x8aa5, 0x0081},
4017{0x8aa6, 0x0027}, {0x8aa7, 0x0026}, {0x8aa8, 0x000f},
4018{0x8aa9, 0x0096}, {0x8aaa, 0x0022}, {0x8aab, 0x0084},
4019{0x8aac, 0x0080}, {0x8aad, 0x0044}, {0x8aae, 0x0044},
4020{0x8aaf, 0x0044}, {0x8ab0, 0x001b}, {0x8ab1, 0x00d6},
4021{0x8ab2, 0x0022}, {0x8ab3, 0x00c4}, {0x8ab4, 0x006f},
4022{0x8ab5, 0x001b}, {0x8ab6, 0x0097}, {0x8ab7, 0x0022},
4023{0x8ab8, 0x0039}, {0x8ab9, 0x0027}, {0x8aba, 0x000c},
4024{0x8abb, 0x007c}, {0x8abc, 0x0082}, {0x8abd, 0x0006},
4025{0x8abe, 0x00bd}, {0x8abf, 0x00d9}, {0x8ac0, 0x00ed},
4026{0x8ac1, 0x00b6}, {0x8ac2, 0x0082}, {0x8ac3, 0x0007},
4027{0x8ac4, 0x007e}, {0x8ac5, 0x008a}, {0x8ac6, 0x00b9},
4028{0x8ac7, 0x007f}, {0x8ac8, 0x0082}, {0x8ac9, 0x0006},
4029{0x8aca, 0x0039}, { 0x0, 0x0 }
4030};
4031#endif
4032
4033
4034/* phy types */
4035#define CAS_PHY_UNKNOWN 0x00
4036#define CAS_PHY_SERDES 0x01
4037#define CAS_PHY_MII_MDIO0 0x02
4038#define CAS_PHY_MII_MDIO1 0x04
4039#define CAS_PHY_MII(x) ((x) & (CAS_PHY_MII_MDIO0 | CAS_PHY_MII_MDIO1))
4040
4041/* _RING_INDEX is the index for the ring sizes to be used. _RING_SIZE
4042 * is the actual size. the default index for the various rings is
4043 * 8. NOTE: there a bunch of alignment constraints for the rings. to
4044 * deal with that, i just allocate rings to create the desired
4045 * alignment. here are the constraints:
4046 * RX DESC and COMP rings must be 8KB aligned
4047 * TX DESC must be 2KB aligned.
4048 * if you change the numbers, be cognizant of how the alignment will change
4049 * in INIT_BLOCK as well.
4050 */
4051
4052#define DESC_RING_I_TO_S(x) (32*(1 << (x)))
4053#define COMP_RING_I_TO_S(x) (128*(1 << (x)))
4054#define TX_DESC_RING_INDEX 4 /* 512 = 8k */
4055#define RX_DESC_RING_INDEX 4 /* 512 = 8k */
4056#define RX_COMP_RING_INDEX 4 /* 2048 = 64k: should be 4x rx ring size */
4057
4058#if (TX_DESC_RING_INDEX > 8) || (TX_DESC_RING_INDEX < 0)
4059#error TX_DESC_RING_INDEX must be between 0 and 8
4060#endif
4061
4062#if (RX_DESC_RING_INDEX > 8) || (RX_DESC_RING_INDEX < 0)
4063#error RX_DESC_RING_INDEX must be between 0 and 8
4064#endif
4065
4066#if (RX_COMP_RING_INDEX > 8) || (RX_COMP_RING_INDEX < 0)
4067#error RX_COMP_RING_INDEX must be between 0 and 8
4068#endif
4069
4070#define N_TX_RINGS MAX_TX_RINGS /* for QoS */
4071#define N_TX_RINGS_MASK MAX_TX_RINGS_MASK
4072#define N_RX_DESC_RINGS MAX_RX_DESC_RINGS /* 1 for ipsec */
4073#define N_RX_COMP_RINGS 0x1 /* for mult. PCI interrupts */
4074
4075/* number of flows that can go through re-assembly */
4076#define N_RX_FLOWS 64
4077
4078#define TX_DESC_RING_SIZE DESC_RING_I_TO_S(TX_DESC_RING_INDEX)
4079#define RX_DESC_RING_SIZE DESC_RING_I_TO_S(RX_DESC_RING_INDEX)
4080#define RX_COMP_RING_SIZE COMP_RING_I_TO_S(RX_COMP_RING_INDEX)
4081#define TX_DESC_RINGN_INDEX(x) TX_DESC_RING_INDEX
4082#define RX_DESC_RINGN_INDEX(x) RX_DESC_RING_INDEX
4083#define RX_COMP_RINGN_INDEX(x) RX_COMP_RING_INDEX
4084#define TX_DESC_RINGN_SIZE(x) TX_DESC_RING_SIZE
4085#define RX_DESC_RINGN_SIZE(x) RX_DESC_RING_SIZE
4086#define RX_COMP_RINGN_SIZE(x) RX_COMP_RING_SIZE
4087
4088/* convert values */
4089#define CAS_BASE(x, y) (((y) << (x ## _SHIFT)) & (x ## _MASK))
4090#define CAS_VAL(x, y) (((y) & (x ## _MASK)) >> (x ## _SHIFT))
4091#define CAS_TX_RINGN_BASE(y) ((TX_DESC_RINGN_INDEX(y) << \
4092 TX_CFG_DESC_RINGN_SHIFT(y)) & \
4093 TX_CFG_DESC_RINGN_MASK(y))
4094
4095/* min is 2k, but we can't do jumbo frames unless it's at least 8k */
4096#define CAS_MIN_PAGE_SHIFT 11 /* 2048 */
4097#define CAS_JUMBO_PAGE_SHIFT 13 /* 8192 */
4098#define CAS_MAX_PAGE_SHIFT 14 /* 16384 */
4099
4100#define TX_DESC_BUFLEN_MASK 0x0000000000003FFFULL /* buffer length in
4101 bytes. 0 - 9256 */
4102#define TX_DESC_BUFLEN_SHIFT 0
4103#define TX_DESC_CSUM_START_MASK 0x00000000001F8000ULL /* checksum start. #
4104 of bytes to be
4105 skipped before
4106 csum calc begins.
4107 value must be
4108 even */
4109#define TX_DESC_CSUM_START_SHIFT 15
4110#define TX_DESC_CSUM_STUFF_MASK 0x000000001FE00000ULL /* checksum stuff.
4111 byte offset w/in
4112 the pkt for the
4113 1st csum byte.
4114 must be > 8 */
4115#define TX_DESC_CSUM_STUFF_SHIFT 21
4116#define TX_DESC_CSUM_EN 0x0000000020000000ULL /* enable checksum */
4117#define TX_DESC_EOF 0x0000000040000000ULL /* end of frame */
4118#define TX_DESC_SOF 0x0000000080000000ULL /* start of frame */
4119#define TX_DESC_INTME 0x0000000100000000ULL /* interrupt me */
4120#define TX_DESC_NO_CRC 0x0000000200000000ULL /* debugging only.
4121 CRC will not be
4122 inserted into
4123 outgoing frame. */
4124struct cas_tx_desc {
4125 u64 control;
4126 u64 buffer;
4127};
4128
4129/* descriptor ring for free buffers contains page-sized buffers. the index
4130 * value is not used by the hw in any way. it's just stored and returned in
4131 * the completion ring.
4132 */
4133struct cas_rx_desc {
4134 u64 index;
4135 u64 buffer;
4136};
4137
4138/* received packets are put on the completion ring. */
4139/* word 1 */
4140#define RX_COMP1_DATA_SIZE_MASK 0x0000000007FFE000ULL
4141#define RX_COMP1_DATA_SIZE_SHIFT 13
4142#define RX_COMP1_DATA_OFF_MASK 0x000001FFF8000000ULL
4143#define RX_COMP1_DATA_OFF_SHIFT 27
4144#define RX_COMP1_DATA_INDEX_MASK 0x007FFE0000000000ULL
4145#define RX_COMP1_DATA_INDEX_SHIFT 41
4146#define RX_COMP1_SKIP_MASK 0x0180000000000000ULL
4147#define RX_COMP1_SKIP_SHIFT 55
4148#define RX_COMP1_RELEASE_NEXT 0x0200000000000000ULL
4149#define RX_COMP1_SPLIT_PKT 0x0400000000000000ULL
4150#define RX_COMP1_RELEASE_FLOW 0x0800000000000000ULL
4151#define RX_COMP1_RELEASE_DATA 0x1000000000000000ULL
4152#define RX_COMP1_RELEASE_HDR 0x2000000000000000ULL
4153#define RX_COMP1_TYPE_MASK 0xC000000000000000ULL
4154#define RX_COMP1_TYPE_SHIFT 62
4155
4156/* word 2 */
4157#define RX_COMP2_NEXT_INDEX_MASK 0x00000007FFE00000ULL
4158#define RX_COMP2_NEXT_INDEX_SHIFT 21
4159#define RX_COMP2_HDR_SIZE_MASK 0x00000FF800000000ULL
4160#define RX_COMP2_HDR_SIZE_SHIFT 35
4161#define RX_COMP2_HDR_OFF_MASK 0x0003F00000000000ULL
4162#define RX_COMP2_HDR_OFF_SHIFT 44
4163#define RX_COMP2_HDR_INDEX_MASK 0xFFFC000000000000ULL
4164#define RX_COMP2_HDR_INDEX_SHIFT 50
4165
4166/* word 3 */
4167#define RX_COMP3_SMALL_PKT 0x0000000000000001ULL
4168#define RX_COMP3_JUMBO_PKT 0x0000000000000002ULL
4169#define RX_COMP3_JUMBO_HDR_SPLIT_EN 0x0000000000000004ULL
4170#define RX_COMP3_CSUM_START_MASK 0x000000000007F000ULL
4171#define RX_COMP3_CSUM_START_SHIFT 12
4172#define RX_COMP3_FLOWID_MASK 0x0000000001F80000ULL
4173#define RX_COMP3_FLOWID_SHIFT 19
4174#define RX_COMP3_OPCODE_MASK 0x000000000E000000ULL
4175#define RX_COMP3_OPCODE_SHIFT 25
4176#define RX_COMP3_FORCE_FLAG 0x0000000010000000ULL
4177#define RX_COMP3_NO_ASSIST 0x0000000020000000ULL
4178#define RX_COMP3_LOAD_BAL_MASK 0x000001F800000000ULL
4179#define RX_COMP3_LOAD_BAL_SHIFT 35
4180#define RX_PLUS_COMP3_ENC_PKT 0x0000020000000000ULL /* cas+ */
4181#define RX_COMP3_L3_HEAD_OFF_MASK 0x0000FE0000000000ULL /* cas */
4182#define RX_COMP3_L3_HEAD_OFF_SHIFT 41
4183#define RX_PLUS_COMP_L3_HEAD_OFF_MASK 0x0000FC0000000000ULL /* cas+ */
4184#define RX_PLUS_COMP_L3_HEAD_OFF_SHIFT 42
4185#define RX_COMP3_SAP_MASK 0xFFFF000000000000ULL
4186#define RX_COMP3_SAP_SHIFT 48
4187
4188/* word 4 */
4189#define RX_COMP4_TCP_CSUM_MASK 0x000000000000FFFFULL
4190#define RX_COMP4_TCP_CSUM_SHIFT 0
4191#define RX_COMP4_PKT_LEN_MASK 0x000000003FFF0000ULL
4192#define RX_COMP4_PKT_LEN_SHIFT 16
4193#define RX_COMP4_PERFECT_MATCH_MASK 0x00000003C0000000ULL
4194#define RX_COMP4_PERFECT_MATCH_SHIFT 30
4195#define RX_COMP4_ZERO 0x0000080000000000ULL
4196#define RX_COMP4_HASH_VAL_MASK 0x0FFFF00000000000ULL
4197#define RX_COMP4_HASH_VAL_SHIFT 44
4198#define RX_COMP4_HASH_PASS 0x1000000000000000ULL
4199#define RX_COMP4_BAD 0x4000000000000000ULL
4200#define RX_COMP4_LEN_MISMATCH 0x8000000000000000ULL
4201
4202/* we encode the following: ring/index/release. only 14 bits
4203 * are usable.
4204 * NOTE: the encoding is dependent upon RX_DESC_RING_SIZE and
4205 * MAX_RX_DESC_RINGS. */
4206#define RX_INDEX_NUM_MASK 0x0000000000000FFFULL
4207#define RX_INDEX_NUM_SHIFT 0
4208#define RX_INDEX_RING_MASK 0x0000000000001000ULL
4209#define RX_INDEX_RING_SHIFT 12
4210#define RX_INDEX_RELEASE 0x0000000000002000ULL
4211
4212struct cas_rx_comp {
4213 u64 word1;
4214 u64 word2;
4215 u64 word3;
4216 u64 word4;
4217};
4218
4219enum link_state {
4220 link_down = 0, /* No link, will retry */
4221 link_aneg, /* Autoneg in progress */
4222 link_force_try, /* Try Forced link speed */
4223 link_force_ret, /* Forced mode worked, retrying autoneg */
4224 link_force_ok, /* Stay in forced mode */
4225 link_up /* Link is up */
4226};
4227
4228typedef struct cas_page {
4229 struct list_head list;
4230 struct page *buffer;
4231 dma_addr_t dma_addr;
4232 int used;
4233} cas_page_t;
4234
4235
4236/* some alignment constraints:
4237 * TX DESC, RX DESC, and RX COMP must each be 8K aligned.
4238 * TX COMPWB must be 8-byte aligned.
4239 * to accomplish this, here's what we do:
4240 *
4241 * INIT_BLOCK_RX_COMP = 64k (already aligned)
4242 * INIT_BLOCK_RX_DESC = 8k
4243 * INIT_BLOCK_TX = 8k
4244 * INIT_BLOCK_RX1_DESC = 8k
4245 * TX COMPWB
4246 */
4247#define INIT_BLOCK_TX (TX_DESC_RING_SIZE)
4248#define INIT_BLOCK_RX_DESC (RX_DESC_RING_SIZE)
4249#define INIT_BLOCK_RX_COMP (RX_COMP_RING_SIZE)
4250
4251struct cas_init_block {
4252 struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP];
4253 struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC];
4254 struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX];
4255 u64 tx_compwb;
4256};
4257
4258/* tiny buffers to deal with target abort issue. we allocate a bit
4259 * over so that we don't have target abort issues with these buffers
4260 * as well.
4261 */
4262#define TX_TINY_BUF_LEN 0x100
4263#define TX_TINY_BUF_BLOCK ((INIT_BLOCK_TX + 1)*TX_TINY_BUF_LEN)
4264
4265struct cas_tiny_count {
4266 int nbufs;
4267 int used;
4268};
4269
4270struct cas {
4271 spinlock_t lock; /* for most bits */
4272 spinlock_t tx_lock[N_TX_RINGS]; /* tx bits */
4273 spinlock_t stat_lock[N_TX_RINGS + 1]; /* for stat gathering */
4274 spinlock_t rx_inuse_lock; /* rx inuse list */
4275 spinlock_t rx_spare_lock; /* rx spare list */
4276
4277 void __iomem *regs;
4278 int tx_new[N_TX_RINGS], tx_old[N_TX_RINGS];
4279 int rx_old[N_RX_DESC_RINGS];
4280 int rx_cur[N_RX_COMP_RINGS], rx_new[N_RX_COMP_RINGS];
4281 int rx_last[N_RX_DESC_RINGS];
4282
4283 /* Set when chip is actually in operational state
4284 * (ie. not power managed) */
4285 int hw_running;
4286 int opened;
4287 struct semaphore pm_sem; /* open/close/suspend/resume */
4288
4289 struct cas_init_block *init_block;
4290 struct cas_tx_desc *init_txds[MAX_TX_RINGS];
4291 struct cas_rx_desc *init_rxds[MAX_RX_DESC_RINGS];
4292 struct cas_rx_comp *init_rxcs[MAX_RX_COMP_RINGS];
4293
4294 /* we use sk_buffs for tx and pages for rx. the rx skbuffs
4295 * are there for flow re-assembly. */
4296 struct sk_buff *tx_skbs[N_TX_RINGS][TX_DESC_RING_SIZE];
4297 struct sk_buff_head rx_flows[N_RX_FLOWS];
4298 cas_page_t *rx_pages[N_RX_DESC_RINGS][RX_DESC_RING_SIZE];
4299 struct list_head rx_spare_list, rx_inuse_list;
4300 int rx_spares_needed;
4301
4302 /* for small packets when copying would be quicker than
4303 mapping */
4304 struct cas_tiny_count tx_tiny_use[N_TX_RINGS][TX_DESC_RING_SIZE];
4305 u8 *tx_tiny_bufs[N_TX_RINGS];
4306
4307 u32 msg_enable;
4308
4309 /* N_TX_RINGS must be >= N_RX_DESC_RINGS */
4310 struct net_device_stats net_stats[N_TX_RINGS + 1];
4311
4312 u32 pci_cfg[64 >> 2];
4313 u8 pci_revision;
4314
4315 int phy_type;
4316 int phy_addr;
4317 u32 phy_id;
4318#define CAS_FLAG_1000MB_CAP 0x00000001
4319#define CAS_FLAG_REG_PLUS 0x00000002
4320#define CAS_FLAG_TARGET_ABORT 0x00000004
4321#define CAS_FLAG_SATURN 0x00000008
4322#define CAS_FLAG_RXD_POST_MASK 0x000000F0
4323#define CAS_FLAG_RXD_POST_SHIFT 4
4324#define CAS_FLAG_RXD_POST(x) ((1 << (CAS_FLAG_RXD_POST_SHIFT + (x))) & \
4325 CAS_FLAG_RXD_POST_MASK)
4326#define CAS_FLAG_ENTROPY_DEV 0x00000100
4327#define CAS_FLAG_NO_HW_CSUM 0x00000200
4328 u32 cas_flags;
4329 int packet_min; /* minimum packet size */
4330 int tx_fifo_size;
4331 int rx_fifo_size;
4332 int rx_pause_off;
4333 int rx_pause_on;
4334 int crc_size; /* 4 if half-duplex */
4335
4336 int pci_irq_INTC;
4337 int min_frame_size; /* for tx fifo workaround */
4338
4339 /* page size allocation */
4340 int page_size;
4341 int page_order;
4342 int mtu_stride;
4343
4344 u32 mac_rx_cfg;
4345
4346 /* Autoneg & PHY control */
4347 int link_cntl;
4348 int link_fcntl;
4349 enum link_state lstate;
4350 struct timer_list link_timer;
4351 int timer_ticks;
4352 struct work_struct reset_task;
4353#if 0
4354 atomic_t reset_task_pending;
4355#else
4356 atomic_t reset_task_pending;
4357 atomic_t reset_task_pending_mtu;
4358 atomic_t reset_task_pending_spare;
4359 atomic_t reset_task_pending_all;
4360#endif
4361
4362#ifdef CONFIG_CASSINI_QGE_DEBUG
4363 atomic_t interrupt_seen; /* 1 if any interrupts are getting through */
4364#endif
4365
4366 /* Link-down problem workaround */
4367#define LINK_TRANSITION_UNKNOWN 0
4368#define LINK_TRANSITION_ON_FAILURE 1
4369#define LINK_TRANSITION_STILL_FAILED 2
4370#define LINK_TRANSITION_LINK_UP 3
4371#define LINK_TRANSITION_LINK_CONFIG 4
4372#define LINK_TRANSITION_LINK_DOWN 5
4373#define LINK_TRANSITION_REQUESTED_RESET 6
4374 int link_transition;
4375 int link_transition_jiffies_valid;
4376 unsigned long link_transition_jiffies;
4377
4378 /* Tuning */
4379 u8 orig_cacheline_size; /* value when loaded */
4380#define CAS_PREF_CACHELINE_SIZE 0x20 /* Minimum desired */
4381
4382 /* Diagnostic counters and state. */
4383 int casreg_len; /* reg-space size for dumping */
4384 u64 pause_entered;
4385 u16 pause_last_time_recvd;
4386
4387 dma_addr_t block_dvma, tx_tiny_dvma[N_TX_RINGS];
4388 struct pci_dev *pdev;
4389 struct net_device *dev;
4390};
4391
4392#define TX_DESC_NEXT(r, x) (((x) + 1) & (TX_DESC_RINGN_SIZE(r) - 1))
4393#define RX_DESC_ENTRY(r, x) ((x) & (RX_DESC_RINGN_SIZE(r) - 1))
4394#define RX_COMP_ENTRY(r, x) ((x) & (RX_COMP_RINGN_SIZE(r) - 1))
4395
4396#define TX_BUFF_COUNT(r, x, y) ((x) <= (y) ? ((y) - (x)) : \
4397 (TX_DESC_RINGN_SIZE(r) - (x) + (y)))
4398
4399#define TX_BUFFS_AVAIL(cp, i) ((cp)->tx_old[(i)] <= (cp)->tx_new[(i)] ? \
4400 (cp)->tx_old[(i)] + (TX_DESC_RINGN_SIZE(i) - 1) - (cp)->tx_new[(i)] : \
4401 (cp)->tx_old[(i)] - (cp)->tx_new[(i)] - 1)
4402
4403#define CAS_ALIGN(addr, align) \
4404 (((unsigned long) (addr) + ((align) - 1UL)) & ~((align) - 1))
4405
4406#define RX_FIFO_SIZE 16384
4407#define EXPANSION_ROM_SIZE 65536
4408
4409#define CAS_MC_EXACT_MATCH_SIZE 15
4410#define CAS_MC_HASH_SIZE 256
4411#define CAS_MC_HASH_MAX (CAS_MC_EXACT_MATCH_SIZE + \
4412 CAS_MC_HASH_SIZE)
4413
4414#define TX_TARGET_ABORT_LEN 0x20
4415#define RX_SWIVEL_OFF_VAL 0x2
4416#define RX_AE_FREEN_VAL(x) (RX_DESC_RINGN_SIZE(x) >> 1)
4417#define RX_AE_COMP_VAL (RX_COMP_RING_SIZE >> 1)
4418#define RX_BLANK_INTR_PKT_VAL 0x05
4419#define RX_BLANK_INTR_TIME_VAL 0x0F
4420#define HP_TCP_THRESH_VAL 1530 /* reduce to enable reassembly */
4421
4422#define RX_SPARE_COUNT (RX_DESC_RING_SIZE >> 1)
4423#define RX_SPARE_RECOVER_VAL (RX_SPARE_COUNT >> 2)
4424
4425#endif /* _CASSINI_H */
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index 0de3bb906174..14e9b6315f20 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -1875,6 +1875,9 @@ static int emac_init_device(struct ocp_device *ocpdev, struct ibm_ocp_mal *mal)
1875 rc = -ENODEV; 1875 rc = -ENODEV;
1876 goto bail; 1876 goto bail;
1877 } 1877 }
1878
1879 /* Disable any PHY features not supported by the platform */
1880 ep->phy_mii.def->features &= ~emacdata->phy_feat_exc;
1878 1881
1879 /* Setup initial PHY config & startup aneg */ 1882 /* Setup initial PHY config & startup aneg */
1880 if (ep->phy_mii.def->ops->init) 1883 if (ep->phy_mii.def->ops->init)
@@ -1882,6 +1885,34 @@ static int emac_init_device(struct ocp_device *ocpdev, struct ibm_ocp_mal *mal)
1882 netif_carrier_off(ndev); 1885 netif_carrier_off(ndev);
1883 if (ep->phy_mii.def->features & SUPPORTED_Autoneg) 1886 if (ep->phy_mii.def->features & SUPPORTED_Autoneg)
1884 ep->want_autoneg = 1; 1887 ep->want_autoneg = 1;
1888 else {
1889 ep->want_autoneg = 0;
1890
1891 /* Select highest supported speed/duplex */
1892 if (ep->phy_mii.def->features & SUPPORTED_1000baseT_Full) {
1893 ep->phy_mii.speed = SPEED_1000;
1894 ep->phy_mii.duplex = DUPLEX_FULL;
1895 } else if (ep->phy_mii.def->features &
1896 SUPPORTED_1000baseT_Half) {
1897 ep->phy_mii.speed = SPEED_1000;
1898 ep->phy_mii.duplex = DUPLEX_HALF;
1899 } else if (ep->phy_mii.def->features &
1900 SUPPORTED_100baseT_Full) {
1901 ep->phy_mii.speed = SPEED_100;
1902 ep->phy_mii.duplex = DUPLEX_FULL;
1903 } else if (ep->phy_mii.def->features &
1904 SUPPORTED_100baseT_Half) {
1905 ep->phy_mii.speed = SPEED_100;
1906 ep->phy_mii.duplex = DUPLEX_HALF;
1907 } else if (ep->phy_mii.def->features &
1908 SUPPORTED_10baseT_Full) {
1909 ep->phy_mii.speed = SPEED_10;
1910 ep->phy_mii.duplex = DUPLEX_FULL;
1911 } else {
1912 ep->phy_mii.speed = SPEED_10;
1913 ep->phy_mii.duplex = DUPLEX_HALF;
1914 }
1915 }
1885 emac_start_link(ep, NULL); 1916 emac_start_link(ep, NULL);
1886 1917
1887 /* read the MAC Address */ 1918 /* read the MAC Address */
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 32d5fabd4b10..a2c4dd4fb221 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -99,7 +99,7 @@ static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance, struct pt_regs
99static inline void ibmveth_schedule_replenishing(struct ibmveth_adapter*); 99static inline void ibmveth_schedule_replenishing(struct ibmveth_adapter*);
100 100
101#ifdef CONFIG_PROC_FS 101#ifdef CONFIG_PROC_FS
102#define IBMVETH_PROC_DIR "ibmveth" 102#define IBMVETH_PROC_DIR "net/ibmveth"
103static struct proc_dir_entry *ibmveth_proc_dir; 103static struct proc_dir_entry *ibmveth_proc_dir;
104#endif 104#endif
105 105
@@ -1010,7 +1010,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev)
1010#ifdef CONFIG_PROC_FS 1010#ifdef CONFIG_PROC_FS
1011static void ibmveth_proc_register_driver(void) 1011static void ibmveth_proc_register_driver(void)
1012{ 1012{
1013 ibmveth_proc_dir = create_proc_entry(IBMVETH_PROC_DIR, S_IFDIR, proc_net); 1013 ibmveth_proc_dir = proc_mkdir(IBMVETH_PROC_DIR, NULL);
1014 if (ibmveth_proc_dir) { 1014 if (ibmveth_proc_dir) {
1015 SET_MODULE_OWNER(ibmveth_proc_dir); 1015 SET_MODULE_OWNER(ibmveth_proc_dir);
1016 } 1016 }
@@ -1018,7 +1018,7 @@ static void ibmveth_proc_register_driver(void)
1018 1018
1019static void ibmveth_proc_unregister_driver(void) 1019static void ibmveth_proc_unregister_driver(void)
1020{ 1020{
1021 remove_proc_entry(IBMVETH_PROC_DIR, proc_net); 1021 remove_proc_entry(IBMVETH_PROC_DIR, NULL);
1022} 1022}
1023 1023
1024static void *ibmveth_seq_start(struct seq_file *seq, loff_t *pos) 1024static void *ibmveth_seq_start(struct seq_file *seq, loff_t *pos)
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 6d9de626c967..651c5a6578fd 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1875,11 +1875,11 @@ static int __init vlsi_mod_init(void)
1875 1875
1876 sirpulse = !!sirpulse; 1876 sirpulse = !!sirpulse;
1877 1877
1878 /* create_proc_entry returns NULL if !CONFIG_PROC_FS. 1878 /* proc_mkdir returns NULL if !CONFIG_PROC_FS.
1879 * Failure to create the procfs entry is handled like running 1879 * Failure to create the procfs entry is handled like running
1880 * without procfs - it's not required for the driver to work. 1880 * without procfs - it's not required for the driver to work.
1881 */ 1881 */
1882 vlsi_proc_root = create_proc_entry(PROC_DIR, S_IFDIR, NULL); 1882 vlsi_proc_root = proc_mkdir(PROC_DIR, NULL);
1883 if (vlsi_proc_root) { 1883 if (vlsi_proc_root) {
1884 /* protect registered procdir against module removal. 1884 /* protect registered procdir against module removal.
1885 * Because we are in the module init path there's no race 1885 * Because we are in the module init path there's no race
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index e64df4d0800b..e4811b42a6b7 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -584,7 +584,7 @@ static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb)
584 return 0; 584 return 0;
585} 585}
586 586
587static inline int rx_refill(struct net_device *ndev, int gfp) 587static inline int rx_refill(struct net_device *ndev, gfp_t gfp)
588{ 588{
589 struct ns83820 *dev = PRIV(ndev); 589 struct ns83820 *dev = PRIV(ndev);
590 unsigned i; 590 unsigned i;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index d652e1eddb45..c7cca842e5ee 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -1832,7 +1832,7 @@ static void fill_multicast_tbl(int count, struct dev_mc_list *addrs,
1832{ 1832{
1833 struct dev_mc_list *mc_addr; 1833 struct dev_mc_list *mc_addr;
1834 1834
1835 for (mc_addr = addrs; mc_addr && --count > 0; mc_addr = mc_addr->next) { 1835 for (mc_addr = addrs; mc_addr && count-- > 0; mc_addr = mc_addr->next) {
1836 u_int position = ether_crc(6, mc_addr->dmi_addr); 1836 u_int position = ether_crc(6, mc_addr->dmi_addr);
1837#ifndef final_version /* Verify multicast address. */ 1837#ifndef final_version /* Verify multicast address. */
1838 if ((mc_addr->dmi_addr[0] & 1) == 0) 1838 if ((mc_addr->dmi_addr[0] & 1) == 0)
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 82f236cc3b9b..a842ecc60a34 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -1070,7 +1070,7 @@ static int __init pppoe_proc_init(void)
1070{ 1070{
1071 struct proc_dir_entry *p; 1071 struct proc_dir_entry *p;
1072 1072
1073 p = create_proc_entry("pppoe", S_IRUGO, proc_net); 1073 p = create_proc_entry("net/pppoe", S_IRUGO, NULL);
1074 if (!p) 1074 if (!p)
1075 return -ENOMEM; 1075 return -ENOMEM;
1076 1076
@@ -1142,7 +1142,7 @@ static void __exit pppoe_exit(void)
1142 dev_remove_pack(&pppoes_ptype); 1142 dev_remove_pack(&pppoes_ptype);
1143 dev_remove_pack(&pppoed_ptype); 1143 dev_remove_pack(&pppoed_ptype);
1144 unregister_netdevice_notifier(&pppoe_notifier); 1144 unregister_netdevice_notifier(&pppoe_notifier);
1145 remove_proc_entry("pppoe", proc_net); 1145 remove_proc_entry("net/pppoe", NULL);
1146 proto_unregister(&pppoe_sk_proto); 1146 proto_unregister(&pppoe_sk_proto);
1147} 1147}
1148 1148
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index f9223c1c5aa4..afb3f186b884 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -92,8 +92,7 @@ VERSION 2.2LK <2005/01/25>
92#endif /* RTL8169_DEBUG */ 92#endif /* RTL8169_DEBUG */
93 93
94#define R8169_MSG_DEFAULT \ 94#define R8169_MSG_DEFAULT \
95 (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK | NETIF_MSG_IFUP | \ 95 (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN)
96 NETIF_MSG_IFDOWN)
97 96
98#define TX_BUFFS_AVAIL(tp) \ 97#define TX_BUFFS_AVAIL(tp) \
99 (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1) 98 (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1)
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 2e72d79a143c..b18c92cb629e 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -235,7 +235,7 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr);
235 * Extern Function Prototypes 235 * Extern Function Prototypes
236 * 236 *
237 ******************************************************************************/ 237 ******************************************************************************/
238static const char SKRootName[] = "sk98lin"; 238static const char SKRootName[] = "net/sk98lin";
239static struct proc_dir_entry *pSkRootDir; 239static struct proc_dir_entry *pSkRootDir;
240extern struct file_operations sk_proc_fops; 240extern struct file_operations sk_proc_fops;
241 241
@@ -5242,20 +5242,20 @@ static int __init skge_init(void)
5242{ 5242{
5243 int error; 5243 int error;
5244 5244
5245 pSkRootDir = proc_mkdir(SKRootName, proc_net); 5245 pSkRootDir = proc_mkdir(SKRootName, NULL);
5246 if (pSkRootDir) 5246 if (pSkRootDir)
5247 pSkRootDir->owner = THIS_MODULE; 5247 pSkRootDir->owner = THIS_MODULE;
5248 5248
5249 error = pci_register_driver(&skge_driver); 5249 error = pci_register_driver(&skge_driver);
5250 if (error) 5250 if (error)
5251 proc_net_remove(SKRootName); 5251 remove_proc_entry(SKRootName, NULL);
5252 return error; 5252 return error;
5253} 5253}
5254 5254
5255static void __exit skge_exit(void) 5255static void __exit skge_exit(void)
5256{ 5256{
5257 pci_unregister_driver(&skge_driver); 5257 pci_unregister_driver(&skge_driver);
5258 proc_net_remove(SKRootName); 5258 remove_proc_entry(SKRootName, NULL);
5259 5259
5260} 5260}
5261 5261
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index fd398da4993b..c2e6484ef138 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2837,21 +2837,29 @@ static void skge_netpoll(struct net_device *dev)
2837static int skge_set_mac_address(struct net_device *dev, void *p) 2837static int skge_set_mac_address(struct net_device *dev, void *p)
2838{ 2838{
2839 struct skge_port *skge = netdev_priv(dev); 2839 struct skge_port *skge = netdev_priv(dev);
2840 struct sockaddr *addr = p; 2840 struct skge_hw *hw = skge->hw;
2841 int err = 0; 2841 unsigned port = skge->port;
2842 const struct sockaddr *addr = p;
2842 2843
2843 if (!is_valid_ether_addr(addr->sa_data)) 2844 if (!is_valid_ether_addr(addr->sa_data))
2844 return -EADDRNOTAVAIL; 2845 return -EADDRNOTAVAIL;
2845 2846
2846 skge_down(dev); 2847 spin_lock_bh(&hw->phy_lock);
2847 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 2848 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
2848 memcpy_toio(skge->hw->regs + B2_MAC_1 + skge->port*8, 2849 memcpy_toio(hw->regs + B2_MAC_1 + port*8,
2849 dev->dev_addr, ETH_ALEN); 2850 dev->dev_addr, ETH_ALEN);
2850 memcpy_toio(skge->hw->regs + B2_MAC_2 + skge->port*8, 2851 memcpy_toio(hw->regs + B2_MAC_2 + port*8,
2851 dev->dev_addr, ETH_ALEN); 2852 dev->dev_addr, ETH_ALEN);
2852 if (dev->flags & IFF_UP) 2853
2853 err = skge_up(dev); 2854 if (hw->chip_id == CHIP_ID_GENESIS)
2854 return err; 2855 xm_outaddr(hw, port, XM_SA, dev->dev_addr);
2856 else {
2857 gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr);
2858 gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr);
2859 }
2860 spin_unlock_bh(&hw->phy_lock);
2861
2862 return 0;
2855} 2863}
2856 2864
2857static const struct { 2865static const struct {
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 88b89dc95c77..efdb179ecc8c 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -133,14 +133,18 @@
133 - finally added firmware (GPL'ed by Adaptec) 133 - finally added firmware (GPL'ed by Adaptec)
134 - removed compatibility code for 2.2.x 134 - removed compatibility code for 2.2.x
135 135
136 LK1.4.2.1 (Ion Badulescu)
137 - fixed 32/64 bit issues on i386 + CONFIG_HIGHMEM
138 - added 32-bit padding to outgoing skb's, removed previous workaround
139
136TODO: - fix forced speed/duplexing code (broken a long time ago, when 140TODO: - fix forced speed/duplexing code (broken a long time ago, when
137 somebody converted the driver to use the generic MII code) 141 somebody converted the driver to use the generic MII code)
138 - fix VLAN support 142 - fix VLAN support
139*/ 143*/
140 144
141#define DRV_NAME "starfire" 145#define DRV_NAME "starfire"
142#define DRV_VERSION "1.03+LK1.4.2" 146#define DRV_VERSION "1.03+LK1.4.2.1"
143#define DRV_RELDATE "January 19, 2005" 147#define DRV_RELDATE "October 3, 2005"
144 148
145#include <linux/config.h> 149#include <linux/config.h>
146#include <linux/version.h> 150#include <linux/version.h>
@@ -165,6 +169,14 @@ TODO: - fix forced speed/duplexing code (broken a long time ago, when
165 * of length 1. If and when this is fixed, the #define below can be removed. 169 * of length 1. If and when this is fixed, the #define below can be removed.
166 */ 170 */
167#define HAS_BROKEN_FIRMWARE 171#define HAS_BROKEN_FIRMWARE
172
173/*
174 * If using the broken firmware, data must be padded to the next 32-bit boundary.
175 */
176#ifdef HAS_BROKEN_FIRMWARE
177#define PADDING_MASK 3
178#endif
179
168/* 180/*
169 * Define this if using the driver with the zero-copy patch 181 * Define this if using the driver with the zero-copy patch
170 */ 182 */
@@ -257,9 +269,10 @@ static int full_duplex[MAX_UNITS] = {0, };
257 * This SUCKS. 269 * This SUCKS.
258 * We need a much better method to determine if dma_addr_t is 64-bit. 270 * We need a much better method to determine if dma_addr_t is 64-bit.
259 */ 271 */
260#if (defined(__i386__) && defined(CONFIG_HIGHMEM) && (LINUX_VERSION_CODE > 0x20500 || defined(CONFIG_HIGHMEM64G))) || defined(__x86_64__) || defined (__ia64__) || defined(__mips64__) || (defined(__mips__) && defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) 272#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__mips64__) || (defined(__mips__) && defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR))
261/* 64-bit dma_addr_t */ 273/* 64-bit dma_addr_t */
262#define ADDR_64BITS /* This chip uses 64 bit addresses. */ 274#define ADDR_64BITS /* This chip uses 64 bit addresses. */
275#define netdrv_addr_t u64
263#define cpu_to_dma(x) cpu_to_le64(x) 276#define cpu_to_dma(x) cpu_to_le64(x)
264#define dma_to_cpu(x) le64_to_cpu(x) 277#define dma_to_cpu(x) le64_to_cpu(x)
265#define RX_DESC_Q_ADDR_SIZE RxDescQAddr64bit 278#define RX_DESC_Q_ADDR_SIZE RxDescQAddr64bit
@@ -268,6 +281,7 @@ static int full_duplex[MAX_UNITS] = {0, };
268#define TX_COMPL_Q_ADDR_SIZE TxComplQAddr64bit 281#define TX_COMPL_Q_ADDR_SIZE TxComplQAddr64bit
269#define RX_DESC_ADDR_SIZE RxDescAddr64bit 282#define RX_DESC_ADDR_SIZE RxDescAddr64bit
270#else /* 32-bit dma_addr_t */ 283#else /* 32-bit dma_addr_t */
284#define netdrv_addr_t u32
271#define cpu_to_dma(x) cpu_to_le32(x) 285#define cpu_to_dma(x) cpu_to_le32(x)
272#define dma_to_cpu(x) le32_to_cpu(x) 286#define dma_to_cpu(x) le32_to_cpu(x)
273#define RX_DESC_Q_ADDR_SIZE RxDescQAddr32bit 287#define RX_DESC_Q_ADDR_SIZE RxDescQAddr32bit
@@ -1333,21 +1347,10 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
1333 } 1347 }
1334 1348
1335#if defined(ZEROCOPY) && defined(HAS_BROKEN_FIRMWARE) 1349#if defined(ZEROCOPY) && defined(HAS_BROKEN_FIRMWARE)
1336 { 1350 if (skb->ip_summed == CHECKSUM_HW) {
1337 int has_bad_length = 0; 1351 skb = skb_padto(skb, (skb->len + PADDING_MASK) & ~PADDING_MASK);
1338 1352 if (skb == NULL)
1339 if (skb_first_frag_len(skb) == 1) 1353 return NETDEV_TX_OK;
1340 has_bad_length = 1;
1341 else {
1342 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
1343 if (skb_shinfo(skb)->frags[i].size == 1) {
1344 has_bad_length = 1;
1345 break;
1346 }
1347 }
1348
1349 if (has_bad_length)
1350 skb_checksum_help(skb, 0);
1351 } 1354 }
1352#endif /* ZEROCOPY && HAS_BROKEN_FIRMWARE */ 1355#endif /* ZEROCOPY && HAS_BROKEN_FIRMWARE */
1353 1356
@@ -2127,13 +2130,12 @@ static int __init starfire_init (void)
2127#endif 2130#endif
2128#endif 2131#endif
2129 2132
2130#ifndef ADDR_64BITS
2131 /* we can do this test only at run-time... sigh */ 2133 /* we can do this test only at run-time... sigh */
2132 if (sizeof(dma_addr_t) == sizeof(u64)) { 2134 if (sizeof(dma_addr_t) != sizeof(netdrv_addr_t)) {
2133 printk("This driver has not been ported to this 64-bit architecture yet\n"); 2135 printk("This driver has dma_addr_t issues, please send email to maintainer\n");
2134 return -ENODEV; 2136 return -ENODEV;
2135 } 2137 }
2136#endif /* not ADDR_64BITS */ 2138
2137 return pci_module_init (&starfire_driver); 2139 return pci_module_init (&starfire_driver);
2138} 2140}
2139 2141
diff --git a/drivers/net/sungem.h b/drivers/net/sungem.h
index ff8ae5f79970..13006d759ad8 100644
--- a/drivers/net/sungem.h
+++ b/drivers/net/sungem.h
@@ -1035,7 +1035,8 @@ struct gem {
1035 1035
1036#define ALIGNED_RX_SKB_ADDR(addr) \ 1036#define ALIGNED_RX_SKB_ADDR(addr) \
1037 ((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr)) 1037 ((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr))
1038static __inline__ struct sk_buff *gem_alloc_skb(int size, int gfp_flags) 1038static __inline__ struct sk_buff *gem_alloc_skb(int size,
1039 gfp_t gfp_flags)
1039{ 1040{
1040 struct sk_buff *skb = alloc_skb(size + 64, gfp_flags); 1041 struct sk_buff *skb = alloc_skb(size + 64, gfp_flags);
1041 1042
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 25f85fb9df46..1802c3b48799 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -67,8 +67,8 @@
67 67
68#define DRV_MODULE_NAME "tg3" 68#define DRV_MODULE_NAME "tg3"
69#define PFX DRV_MODULE_NAME ": " 69#define PFX DRV_MODULE_NAME ": "
70#define DRV_MODULE_VERSION "3.41" 70#define DRV_MODULE_VERSION "3.42"
71#define DRV_MODULE_RELDATE "September 27, 2005" 71#define DRV_MODULE_RELDATE "Oct 3, 2005"
72 72
73#define TG3_DEF_MAC_MODE 0 73#define TG3_DEF_MAC_MODE 0
74#define TG3_DEF_RX_MODE 0 74#define TG3_DEF_RX_MODE 0
@@ -9284,8 +9284,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
9284 static struct pci_device_id write_reorder_chipsets[] = { 9284 static struct pci_device_id write_reorder_chipsets[] = {
9285 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 9285 { PCI_DEVICE(PCI_VENDOR_ID_AMD,
9286 PCI_DEVICE_ID_AMD_FE_GATE_700C) }, 9286 PCI_DEVICE_ID_AMD_FE_GATE_700C) },
9287 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 9287 { PCI_DEVICE(PCI_VENDOR_ID_VIA,
9288 PCI_DEVICE_ID_AMD_K8_NB) }, 9288 PCI_DEVICE_ID_VIA_8385_0) },
9289 { }, 9289 { },
9290 }; 9290 };
9291 u32 misc_ctrl_reg; 9291 u32 misc_ctrl_reg;
@@ -9300,15 +9300,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
9300 tp->tg3_flags2 |= TG3_FLG2_SUN_570X; 9300 tp->tg3_flags2 |= TG3_FLG2_SUN_570X;
9301#endif 9301#endif
9302 9302
9303 /* If we have an AMD 762 or K8 chipset, write
9304 * reordering to the mailbox registers done by the host
9305 * controller can cause major troubles. We read back from
9306 * every mailbox register write to force the writes to be
9307 * posted to the chip in order.
9308 */
9309 if (pci_dev_present(write_reorder_chipsets))
9310 tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER;
9311
9312 /* Force memory write invalidate off. If we leave it on, 9303 /* Force memory write invalidate off. If we leave it on,
9313 * then on 5700_BX chips we have to enable a workaround. 9304 * then on 5700_BX chips we have to enable a workaround.
9314 * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary 9305 * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary
@@ -9439,6 +9430,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
9439 if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0) 9430 if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0)
9440 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; 9431 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS;
9441 9432
9433 /* If we have an AMD 762 or VIA K8T800 chipset, write
9434 * reordering to the mailbox registers done by the host
9435 * controller can cause major troubles. We read back from
9436 * every mailbox register write to force the writes to be
9437 * posted to the chip in order.
9438 */
9439 if (pci_dev_present(write_reorder_chipsets) &&
9440 !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS))
9441 tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER;
9442
9442 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && 9443 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 &&
9443 tp->pci_lat_timer < 64) { 9444 tp->pci_lat_timer < 64) {
9444 tp->pci_lat_timer = 64; 9445 tp->pci_lat_timer = 64;
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index e7b001017b9a..32057e65808b 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -531,7 +531,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
531 if (!time_after(jiffies, timeout)) continue; 531 if (!time_after(jiffies, timeout)) continue;
532 DPRINTK( "Hardware timeout during initialization.\n"); 532 DPRINTK( "Hardware timeout during initialization.\n");
533 iounmap(t_mmio); 533 iounmap(t_mmio);
534 kfree(ti);
535 return -ENODEV; 534 return -ENODEV;
536 } 535 }
537 ti->sram_phys = 536 ti->sram_phys =
@@ -645,7 +644,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
645 DPRINTK("Unknown shared ram paging info %01X\n", 644 DPRINTK("Unknown shared ram paging info %01X\n",
646 ti->shared_ram_paging); 645 ti->shared_ram_paging);
647 iounmap(t_mmio); 646 iounmap(t_mmio);
648 kfree(ti);
649 return -ENODEV; 647 return -ENODEV;
650 break; 648 break;
651 } /*end switch shared_ram_paging */ 649 } /*end switch shared_ram_paging */
@@ -675,7 +673,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
675 "driver limit (%05x), adapter not started.\n", 673 "driver limit (%05x), adapter not started.\n",
676 chk_base, ibmtr_mem_base + IBMTR_SHARED_RAM_SIZE); 674 chk_base, ibmtr_mem_base + IBMTR_SHARED_RAM_SIZE);
677 iounmap(t_mmio); 675 iounmap(t_mmio);
678 kfree(ti);
679 return -ENODEV; 676 return -ENODEV;
680 } else { /* seems cool, record what we have figured out */ 677 } else { /* seems cool, record what we have figured out */
681 ti->sram_base = new_base >> 12; 678 ti->sram_base = new_base >> 12;
@@ -690,7 +687,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
690 DPRINTK("Could not grab irq %d. Halting Token Ring driver.\n", 687 DPRINTK("Could not grab irq %d. Halting Token Ring driver.\n",
691 irq); 688 irq);
692 iounmap(t_mmio); 689 iounmap(t_mmio);
693 kfree(ti);
694 return -ENODEV; 690 return -ENODEV;
695 } 691 }
696 /*?? Now, allocate some of the PIO PORTs for this driver.. */ 692 /*?? Now, allocate some of the PIO PORTs for this driver.. */
@@ -699,7 +695,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
699 DPRINTK("Could not grab PIO range. Halting driver.\n"); 695 DPRINTK("Could not grab PIO range. Halting driver.\n");
700 free_irq(dev->irq, dev); 696 free_irq(dev->irq, dev);
701 iounmap(t_mmio); 697 iounmap(t_mmio);
702 kfree(ti);
703 return -EBUSY; 698 return -EBUSY;
704 } 699 }
705 700
diff --git a/drivers/net/tulip/21142.c b/drivers/net/tulip/21142.c
index 5db694c4eb02..683f14b01c06 100644
--- a/drivers/net/tulip/21142.c
+++ b/drivers/net/tulip/21142.c
@@ -172,7 +172,7 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
172 int i; 172 int i;
173 for (i = 0; i < tp->mtable->leafcount; i++) 173 for (i = 0; i < tp->mtable->leafcount; i++)
174 if (tp->mtable->mleaf[i].media == dev->if_port) { 174 if (tp->mtable->mleaf[i].media == dev->if_port) {
175 int startup = ! ((tp->chip_id == DC21143 && tp->revision == 65)); 175 int startup = ! ((tp->chip_id == DC21143 && (tp->revision == 48 || tp->revision == 65)));
176 tp->cur_index = i; 176 tp->cur_index = i;
177 tulip_select_media(dev, startup); 177 tulip_select_media(dev, startup);
178 setup_done = 1; 178 setup_done = 1;
diff --git a/drivers/net/wan/sdlamain.c b/drivers/net/wan/sdlamain.c
index 74e151acef3e..7a8b22a7ea31 100644
--- a/drivers/net/wan/sdlamain.c
+++ b/drivers/net/wan/sdlamain.c
@@ -57,6 +57,7 @@
57#include <linux/ioport.h> /* request_region(), release_region() */ 57#include <linux/ioport.h> /* request_region(), release_region() */
58#include <linux/wanrouter.h> /* WAN router definitions */ 58#include <linux/wanrouter.h> /* WAN router definitions */
59#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ 59#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
60#include <linux/rcupdate.h>
60 61
61#include <linux/in.h> 62#include <linux/in.h>
62#include <asm/io.h> /* phys_to_virt() */ 63#include <asm/io.h> /* phys_to_virt() */
@@ -1268,37 +1269,41 @@ unsigned long get_ip_address(struct net_device *dev, int option)
1268 1269
1269 struct in_ifaddr *ifaddr; 1270 struct in_ifaddr *ifaddr;
1270 struct in_device *in_dev; 1271 struct in_device *in_dev;
1272 unsigned long addr = 0;
1271 1273
1272 if ((in_dev = __in_dev_get(dev)) == NULL){ 1274 rcu_read_lock();
1273 return 0; 1275 if ((in_dev = __in_dev_get_rcu(dev)) == NULL){
1276 goto out;
1274 } 1277 }
1275 1278
1276 if ((ifaddr = in_dev->ifa_list)== NULL ){ 1279 if ((ifaddr = in_dev->ifa_list)== NULL ){
1277 return 0; 1280 goto out;
1278 } 1281 }
1279 1282
1280 switch (option){ 1283 switch (option){
1281 1284
1282 case WAN_LOCAL_IP: 1285 case WAN_LOCAL_IP:
1283 return ifaddr->ifa_local; 1286 addr = ifaddr->ifa_local;
1284 break; 1287 break;
1285 1288
1286 case WAN_POINTOPOINT_IP: 1289 case WAN_POINTOPOINT_IP:
1287 return ifaddr->ifa_address; 1290 addr = ifaddr->ifa_address;
1288 break; 1291 break;
1289 1292
1290 case WAN_NETMASK_IP: 1293 case WAN_NETMASK_IP:
1291 return ifaddr->ifa_mask; 1294 addr = ifaddr->ifa_mask;
1292 break; 1295 break;
1293 1296
1294 case WAN_BROADCAST_IP: 1297 case WAN_BROADCAST_IP:
1295 return ifaddr->ifa_broadcast; 1298 addr = ifaddr->ifa_broadcast;
1296 break; 1299 break;
1297 default: 1300 default:
1298 return 0; 1301 break;
1299 } 1302 }
1300 1303
1301 return 0; 1304out:
1305 rcu_read_unlock();
1306 return addr;
1302} 1307}
1303 1308
1304void add_gateway(sdla_t *card, struct net_device *dev) 1309void add_gateway(sdla_t *card, struct net_device *dev)
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index b56a7b516d24..a6d3b55013a5 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -769,7 +769,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
769 u32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ 769 u32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */
770#ifdef CONFIG_INET 770#ifdef CONFIG_INET
771 rcu_read_lock(); 771 rcu_read_lock();
772 if ((in_dev = __in_dev_get(dev)) != NULL) 772 if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
773 { 773 {
774 for (ifa=in_dev->ifa_list; ifa != NULL; 774 for (ifa=in_dev->ifa_list; ifa != NULL;
775 ifa=ifa->ifa_next) { 775 ifa=ifa->ifa_next) {
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 6deb7cc810cc..cf3daaa1b369 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -503,9 +503,14 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
503 return 0; 503 return 0;
504 } 504 }
505 505
506 /* Length of the packet body */ 506 /* Check packet length, pad short packets, round up odd length */
507 /* FIXME: what if the skb is smaller than this? */ 507 len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN);
508 len = max_t(int,skb->len - ETH_HLEN, ETH_ZLEN - ETH_HLEN); 508 if (skb->len < len) {
509 skb = skb_padto(skb, len);
510 if (skb == NULL)
511 goto fail;
512 }
513 len -= ETH_HLEN;
509 514
510 eh = (struct ethhdr *)skb->data; 515 eh = (struct ethhdr *)skb->data;
511 516
@@ -557,8 +562,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
557 p = skb->data; 562 p = skb->data;
558 } 563 }
559 564
560 /* Round up for odd length packets */ 565 err = hermes_bap_pwrite(hw, USER_BAP, p, data_len,
561 err = hermes_bap_pwrite(hw, USER_BAP, p, ALIGN(data_len, 2),
562 txfid, data_off); 566 txfid, data_off);
563 if (err) { 567 if (err) {
564 printk(KERN_ERR "%s: Error %d writing packet to BAP\n", 568 printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 4b0acae22b0d..7bc7fc823128 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -1352,7 +1352,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer,
1352 struct in_device *in_dev; 1352 struct in_device *in_dev;
1353 1353
1354 rcu_read_lock(); 1354 rcu_read_lock();
1355 in_dev = __in_dev_get(strip_info->dev); 1355 in_dev = __in_dev_get_rcu(strip_info->dev);
1356 if (in_dev == NULL) { 1356 if (in_dev == NULL) {
1357 rcu_read_unlock(); 1357 rcu_read_unlock();
1358 return NULL; 1358 return NULL;
@@ -1508,7 +1508,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
1508 1508
1509 brd = addr = 0; 1509 brd = addr = 0;
1510 rcu_read_lock(); 1510 rcu_read_lock();
1511 in_dev = __in_dev_get(strip_info->dev); 1511 in_dev = __in_dev_get_rcu(strip_info->dev);
1512 if (in_dev) { 1512 if (in_dev) {
1513 if (in_dev->ifa_list) { 1513 if (in_dev->ifa_list) {
1514 brd = in_dev->ifa_list->ifa_broadcast; 1514 brd = in_dev->ifa_list->ifa_broadcast;
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index e90fb72a6962..286902298e33 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -37,6 +37,7 @@
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/ctype.h> 38#include <linux/ctype.h>
39#include <linux/blkdev.h> 39#include <linux/blkdev.h>
40#include <linux/rcupdate.h>
40#include <asm/io.h> 41#include <asm/io.h>
41#include <asm/processor.h> 42#include <asm/processor.h>
42#include <asm/hardware.h> 43#include <asm/hardware.h>
@@ -358,9 +359,10 @@ static __inline__ int led_get_net_activity(void)
358 /* we are running as tasklet, so locking dev_base 359 /* we are running as tasklet, so locking dev_base
359 * for reading should be OK */ 360 * for reading should be OK */
360 read_lock(&dev_base_lock); 361 read_lock(&dev_base_lock);
362 rcu_read_lock();
361 for (dev = dev_base; dev; dev = dev->next) { 363 for (dev = dev_base; dev; dev = dev->next) {
362 struct net_device_stats *stats; 364 struct net_device_stats *stats;
363 struct in_device *in_dev = __in_dev_get(dev); 365 struct in_device *in_dev = __in_dev_get_rcu(dev);
364 if (!in_dev || !in_dev->ifa_list) 366 if (!in_dev || !in_dev->ifa_list)
365 continue; 367 continue;
366 if (LOOPBACK(in_dev->ifa_list->ifa_local)) 368 if (LOOPBACK(in_dev->ifa_list->ifa_local))
@@ -371,6 +373,7 @@ static __inline__ int led_get_net_activity(void)
371 rx_total += stats->rx_packets; 373 rx_total += stats->rx_packets;
372 tx_total += stats->tx_packets; 374 tx_total += stats->tx_packets;
373 } 375 }
376 rcu_read_unlock();
374 read_unlock(&dev_base_lock); 377 read_unlock(&dev_base_lock);
375 378
376 retval = 0; 379 retval = 0;
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index fabd3529cebc..d5e76423a0ee 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -689,6 +689,9 @@ static int pccardd(void *__skt)
689 schedule(); 689 schedule();
690 try_to_freeze(); 690 try_to_freeze();
691 } 691 }
692 /* make sure we are running before we exit */
693 set_current_state(TASK_RUNNING);
694
692 remove_wait_queue(&skt->thread_wait, &wait); 695 remove_wait_queue(&skt->thread_wait, &wait);
693 696
694 /* remove from the device core */ 697 /* remove from the device core */
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index 08d1c9288264..94be9e51654e 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -22,7 +22,6 @@
22 22
23#include <asm/hardware.h> 23#include <asm/hardware.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/mach-types.h>
26#include <asm/sizes.h> 25#include <asm/sizes.h>
27 26
28#include <asm/arch/mux.h> 27#include <asm/arch/mux.h>
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index c42455d20eb6..f9a5c70284b5 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -691,7 +691,7 @@ static int adjust_memory(struct pcmcia_socket *s, unsigned int action, unsigned
691 unsigned long size = end - start + 1; 691 unsigned long size = end - start + 1;
692 int ret = 0; 692 int ret = 0;
693 693
694 if (end <= start) 694 if (end < start)
695 return -EINVAL; 695 return -EINVAL;
696 696
697 down(&rsrc_sem); 697 down(&rsrc_sem);
@@ -724,7 +724,7 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
724 unsigned long size = end - start + 1; 724 unsigned long size = end - start + 1;
725 int ret = 0; 725 int ret = 0;
726 726
727 if (end <= start) 727 if (end < start)
728 return -EINVAL; 728 return -EINVAL;
729 729
730 if (end > IO_SPACE_LIMIT) 730 if (end > IO_SPACE_LIMIT)
@@ -817,7 +817,7 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
817 817
818 /* if we got at least one of IO, and one of MEM, we can be glad and 818 /* if we got at least one of IO, and one of MEM, we can be glad and
819 * activate the PCMCIA subsystem */ 819 * activate the PCMCIA subsystem */
820 if (done & (IORESOURCE_MEM | IORESOURCE_IO)) 820 if (done == (IORESOURCE_MEM | IORESOURCE_IO))
821 s->resource_setup_done = 1; 821 s->resource_setup_done = 1;
822 822
823 return 0; 823 return 0;
@@ -925,7 +925,7 @@ static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size
925 return -EINVAL; 925 return -EINVAL;
926 } 926 }
927 } 927 }
928 if (end_addr <= start_addr) 928 if (end_addr < start_addr)
929 return -EINVAL; 929 return -EINVAL;
930 930
931 ret = adjust_io(s, add, start_addr, end_addr); 931 ret = adjust_io(s, add, start_addr, end_addr);
@@ -977,7 +977,7 @@ static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, siz
977 return -EINVAL; 977 return -EINVAL;
978 } 978 }
979 } 979 }
980 if (end_addr <= start_addr) 980 if (end_addr < start_addr)
981 return -EINVAL; 981 return -EINVAL;
982 982
983 ret = adjust_memory(s, add, start_addr, end_addr); 983 ret = adjust_memory(s, add, start_addr, end_addr);
diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h
index da0b404561c9..539b5cd1a598 100644
--- a/drivers/pcmcia/ti113x.h
+++ b/drivers/pcmcia/ti113x.h
@@ -873,6 +873,7 @@ static int ti1250_override(struct yenta_socket *socket)
873 * Some fixup code to make everybody happy (TM). 873 * Some fixup code to make everybody happy (TM).
874 */ 874 */
875 875
876#ifdef CONFIG_CARDBUS
876/** 877/**
877 * set/clear various test bits: 878 * set/clear various test bits:
878 * Defaults to clear the bit. 879 * Defaults to clear the bit.
@@ -927,7 +928,6 @@ static void ene_tune_bridge(struct pcmcia_socket *sock, struct pci_bus *bus)
927 config_writeb(socket, ENE_TEST_C9, test_c9); 928 config_writeb(socket, ENE_TEST_C9, test_c9);
928} 929}
929 930
930
931static int ene_override(struct yenta_socket *socket) 931static int ene_override(struct yenta_socket *socket)
932{ 932{
933 /* install tune_bridge() function */ 933 /* install tune_bridge() function */
@@ -935,6 +935,9 @@ static int ene_override(struct yenta_socket *socket)
935 935
936 return ti1250_override(socket); 936 return ti1250_override(socket);
937} 937}
938#else
939# define ene_override ti1250_override
940#endif
938 941
939#endif /* _LINUX_TI113X_H */ 942#endif /* _LINUX_TI113X_H */
940 943
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 14c76f5e4177..9adc11e8b8bc 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -544,7 +544,7 @@ get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling)
544 .sibling = sibling, 544 .sibling = sibling,
545 }; 545 };
546 546
547 dev = bus_find_device(&css_bus_type, NULL, &data, match_devno); 547 dev = bus_find_device(&ccw_bus_type, NULL, &data, match_devno);
548 548
549 return dev ? to_ccwdev(dev) : NULL; 549 return dev ? to_ccwdev(dev) : NULL;
550} 550}
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index 2ad4797ce024..9963479ba89f 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -686,6 +686,7 @@ struct qeth_seqno {
686 __u32 pdu_hdr; 686 __u32 pdu_hdr;
687 __u32 pdu_hdr_ack; 687 __u32 pdu_hdr_ack;
688 __u16 ipa; 688 __u16 ipa;
689 __u32 pkt_seqno;
689}; 690};
690 691
691struct qeth_reply { 692struct qeth_reply {
@@ -848,6 +849,7 @@ qeth_realloc_headroom(struct qeth_card *card, struct sk_buff **skb, int size)
848 "on interface %s", QETH_CARD_IFNAME(card)); 849 "on interface %s", QETH_CARD_IFNAME(card));
849 return -ENOMEM; 850 return -ENOMEM;
850 } 851 }
852 kfree_skb(*skb);
851 *skb = new_skb; 853 *skb = new_skb;
852 } 854 }
853 return 0; 855 return 0;
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 86582cf1e19e..bd28e2438d7f 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -511,7 +511,7 @@ static int
511__qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) 511__qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode)
512{ 512{
513 struct qeth_card *card = (struct qeth_card *) cgdev->dev.driver_data; 513 struct qeth_card *card = (struct qeth_card *) cgdev->dev.driver_data;
514 int rc = 0; 514 int rc = 0, rc2 = 0, rc3 = 0;
515 enum qeth_card_states recover_flag; 515 enum qeth_card_states recover_flag;
516 516
517 QETH_DBF_TEXT(setup, 3, "setoffl"); 517 QETH_DBF_TEXT(setup, 3, "setoffl");
@@ -523,11 +523,13 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode)
523 CARD_BUS_ID(card)); 523 CARD_BUS_ID(card));
524 return -ERESTARTSYS; 524 return -ERESTARTSYS;
525 } 525 }
526 if ((rc = ccw_device_set_offline(CARD_DDEV(card))) || 526 rc = ccw_device_set_offline(CARD_DDEV(card));
527 (rc = ccw_device_set_offline(CARD_WDEV(card))) || 527 rc2 = ccw_device_set_offline(CARD_WDEV(card));
528 (rc = ccw_device_set_offline(CARD_RDEV(card)))) { 528 rc3 = ccw_device_set_offline(CARD_RDEV(card));
529 if (!rc)
530 rc = (rc2) ? rc2 : rc3;
531 if (rc)
529 QETH_DBF_TEXT_(setup, 2, "1err%d", rc); 532 QETH_DBF_TEXT_(setup, 2, "1err%d", rc);
530 }
531 if (recover_flag == CARD_STATE_UP) 533 if (recover_flag == CARD_STATE_UP)
532 card->state = CARD_STATE_RECOVER; 534 card->state = CARD_STATE_RECOVER;
533 qeth_notify_processes(); 535 qeth_notify_processes();
@@ -1046,6 +1048,7 @@ qeth_setup_card(struct qeth_card *card)
1046 spin_lock_init(&card->vlanlock); 1048 spin_lock_init(&card->vlanlock);
1047 card->vlangrp = NULL; 1049 card->vlangrp = NULL;
1048#endif 1050#endif
1051 spin_lock_init(&card->lock);
1049 spin_lock_init(&card->ip_lock); 1052 spin_lock_init(&card->ip_lock);
1050 spin_lock_init(&card->thread_mask_lock); 1053 spin_lock_init(&card->thread_mask_lock);
1051 card->thread_start_mask = 0; 1054 card->thread_start_mask = 0;
@@ -1626,16 +1629,6 @@ qeth_cmd_timeout(unsigned long data)
1626 spin_unlock_irqrestore(&reply->card->lock, flags); 1629 spin_unlock_irqrestore(&reply->card->lock, flags);
1627} 1630}
1628 1631
1629static void
1630qeth_reset_ip_addresses(struct qeth_card *card)
1631{
1632 QETH_DBF_TEXT(trace, 2, "rstipadd");
1633
1634 qeth_clear_ip_list(card, 0, 1);
1635 /* this function will also schedule the SET_IP_THREAD */
1636 qeth_set_multicast_list(card->dev);
1637}
1638
1639static struct qeth_ipa_cmd * 1632static struct qeth_ipa_cmd *
1640qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) 1633qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
1641{ 1634{
@@ -1664,9 +1657,8 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
1664 "IP address reset.\n", 1657 "IP address reset.\n",
1665 QETH_CARD_IFNAME(card), 1658 QETH_CARD_IFNAME(card),
1666 card->info.chpid); 1659 card->info.chpid);
1667 card->lan_online = 1;
1668 netif_carrier_on(card->dev); 1660 netif_carrier_on(card->dev);
1669 qeth_reset_ip_addresses(card); 1661 qeth_schedule_recovery(card);
1670 return NULL; 1662 return NULL;
1671 case IPA_CMD_REGISTER_LOCAL_ADDR: 1663 case IPA_CMD_REGISTER_LOCAL_ADDR:
1672 QETH_DBF_TEXT(trace,3, "irla"); 1664 QETH_DBF_TEXT(trace,3, "irla");
@@ -2387,6 +2379,7 @@ qeth_layer2_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
2387 skb_pull(skb, VLAN_HLEN); 2379 skb_pull(skb, VLAN_HLEN);
2388 } 2380 }
2389#endif 2381#endif
2382 *((__u32 *)skb->cb) = ++card->seqno.pkt_seqno;
2390 return vlan_id; 2383 return vlan_id;
2391} 2384}
2392 2385
@@ -3014,7 +3007,7 @@ qeth_alloc_buffer_pool(struct qeth_card *card)
3014 return -ENOMEM; 3007 return -ENOMEM;
3015 } 3008 }
3016 for(j = 0; j < QETH_MAX_BUFFER_ELEMENTS(card); ++j){ 3009 for(j = 0; j < QETH_MAX_BUFFER_ELEMENTS(card); ++j){
3017 ptr = (void *) __get_free_page(GFP_KERNEL); 3010 ptr = (void *) __get_free_page(GFP_KERNEL|GFP_DMA);
3018 if (!ptr) { 3011 if (!ptr) {
3019 while (j > 0) 3012 while (j > 0)
3020 free_page((unsigned long) 3013 free_page((unsigned long)
@@ -3058,7 +3051,8 @@ qeth_alloc_qdio_buffers(struct qeth_card *card)
3058 if (card->qdio.state == QETH_QDIO_ALLOCATED) 3051 if (card->qdio.state == QETH_QDIO_ALLOCATED)
3059 return 0; 3052 return 0;
3060 3053
3061 card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q), GFP_KERNEL); 3054 card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q),
3055 GFP_KERNEL|GFP_DMA);
3062 if (!card->qdio.in_q) 3056 if (!card->qdio.in_q)
3063 return - ENOMEM; 3057 return - ENOMEM;
3064 QETH_DBF_TEXT(setup, 2, "inq"); 3058 QETH_DBF_TEXT(setup, 2, "inq");
@@ -3083,7 +3077,7 @@ qeth_alloc_qdio_buffers(struct qeth_card *card)
3083 } 3077 }
3084 for (i = 0; i < card->qdio.no_out_queues; ++i){ 3078 for (i = 0; i < card->qdio.no_out_queues; ++i){
3085 card->qdio.out_qs[i] = kmalloc(sizeof(struct qeth_qdio_out_q), 3079 card->qdio.out_qs[i] = kmalloc(sizeof(struct qeth_qdio_out_q),
3086 GFP_KERNEL); 3080 GFP_KERNEL|GFP_DMA);
3087 if (!card->qdio.out_qs[i]){ 3081 if (!card->qdio.out_qs[i]){
3088 while (i > 0) 3082 while (i > 0)
3089 kfree(card->qdio.out_qs[--i]); 3083 kfree(card->qdio.out_qs[--i]);
@@ -5200,7 +5194,7 @@ qeth_free_vlan_addresses4(struct qeth_card *card, unsigned short vid)
5200 if (!card->vlangrp) 5194 if (!card->vlangrp)
5201 return; 5195 return;
5202 rcu_read_lock(); 5196 rcu_read_lock();
5203 in_dev = __in_dev_get(card->vlangrp->vlan_devices[vid]); 5197 in_dev = __in_dev_get_rcu(card->vlangrp->vlan_devices[vid]);
5204 if (!in_dev) 5198 if (!in_dev)
5205 goto out; 5199 goto out;
5206 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { 5200 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
@@ -6470,6 +6464,9 @@ qeth_query_ipassists_cb(struct qeth_card *card, struct qeth_reply *reply,
6470 if (cmd->hdr.prot_version == QETH_PROT_IPV4) { 6464 if (cmd->hdr.prot_version == QETH_PROT_IPV4) {
6471 card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported; 6465 card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported;
6472 card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled; 6466 card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled;
6467 /* Disable IPV6 support hard coded for Hipersockets */
6468 if(card->info.type == QETH_CARD_TYPE_IQD)
6469 card->options.ipa4.supported_funcs &= ~IPA_IPV6;
6473 } else { 6470 } else {
6474#ifdef CONFIG_QETH_IPV6 6471#ifdef CONFIG_QETH_IPV6
6475 card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported; 6472 card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported;
@@ -7725,7 +7722,7 @@ qeth_arp_constructor(struct neighbour *neigh)
7725 goto out; 7722 goto out;
7726 7723
7727 rcu_read_lock(); 7724 rcu_read_lock();
7728 in_dev = rcu_dereference(__in_dev_get(dev)); 7725 in_dev = __in_dev_get_rcu(dev);
7729 if (in_dev == NULL) { 7726 if (in_dev == NULL) {
7730 rcu_read_unlock(); 7727 rcu_read_unlock();
7731 return -EINVAL; 7728 return -EINVAL;
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 0b5087f7cabc..cab098556b44 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -833,7 +833,7 @@ zfcp_unit_dequeue(struct zfcp_unit *unit)
833} 833}
834 834
835static void * 835static void *
836zfcp_mempool_alloc(unsigned int __nocast gfp_mask, void *size) 836zfcp_mempool_alloc(gfp_t gfp_mask, void *size)
837{ 837{
838 return kmalloc((size_t) size, gfp_mask); 838 return kmalloc((size_t) size, gfp_mask);
839} 839}
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index a6ac61611f35..a748fbfb6692 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -60,6 +60,7 @@
60 Remove un-needed eh_abort handler. 60 Remove un-needed eh_abort handler.
61 Add support for embedded firmware error strings. 61 Add support for embedded firmware error strings.
62 2.26.02.003 - Correctly handle single sgl's with use_sg=1. 62 2.26.02.003 - Correctly handle single sgl's with use_sg=1.
63 2.26.02.004 - Add support for 9550SX controllers.
63*/ 64*/
64 65
65#include <linux/module.h> 66#include <linux/module.h>
@@ -82,7 +83,7 @@
82#include "3w-9xxx.h" 83#include "3w-9xxx.h"
83 84
84/* Globals */ 85/* Globals */
85#define TW_DRIVER_VERSION "2.26.02.003" 86#define TW_DRIVER_VERSION "2.26.02.004"
86static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; 87static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
87static unsigned int twa_device_extension_count; 88static unsigned int twa_device_extension_count;
88static int twa_major = -1; 89static int twa_major = -1;
@@ -892,11 +893,6 @@ static int twa_decode_bits(TW_Device_Extension *tw_dev, u32 status_reg_value)
892 writel(TW_CONTROL_CLEAR_QUEUE_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); 893 writel(TW_CONTROL_CLEAR_QUEUE_ERROR, TW_CONTROL_REG_ADDR(tw_dev));
893 } 894 }
894 895
895 if (status_reg_value & TW_STATUS_SBUF_WRITE_ERROR) {
896 TW_PRINTK(tw_dev->host, TW_DRIVER, 0xf, "SBUF Write Error: clearing");
897 writel(TW_CONTROL_CLEAR_SBUF_WRITE_ERROR, TW_CONTROL_REG_ADDR(tw_dev));
898 }
899
900 if (status_reg_value & TW_STATUS_MICROCONTROLLER_ERROR) { 896 if (status_reg_value & TW_STATUS_MICROCONTROLLER_ERROR) {
901 if (tw_dev->reset_print == 0) { 897 if (tw_dev->reset_print == 0) {
902 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x10, "Microcontroller Error: clearing"); 898 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x10, "Microcontroller Error: clearing");
@@ -930,6 +926,36 @@ out:
930 return retval; 926 return retval;
931} /* End twa_empty_response_queue() */ 927} /* End twa_empty_response_queue() */
932 928
929/* This function will clear the pchip/response queue on 9550SX */
930static int twa_empty_response_queue_large(TW_Device_Extension *tw_dev)
931{
932 u32 status_reg_value, response_que_value;
933 int count = 0, retval = 1;
934
935 if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9550SX) {
936 status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev));
937
938 while (((status_reg_value & TW_STATUS_RESPONSE_QUEUE_EMPTY) == 0) && (count < TW_MAX_RESPONSE_DRAIN)) {
939 response_que_value = readl(TW_RESPONSE_QUEUE_REG_ADDR_LARGE(tw_dev));
940 if ((response_que_value & TW_9550SX_DRAIN_COMPLETED) == TW_9550SX_DRAIN_COMPLETED) {
941 /* P-chip settle time */
942 msleep(500);
943 retval = 0;
944 goto out;
945 }
946 status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev));
947 count++;
948 }
949 if (count == TW_MAX_RESPONSE_DRAIN)
950 goto out;
951
952 retval = 0;
953 } else
954 retval = 0;
955out:
956 return retval;
957} /* End twa_empty_response_queue_large() */
958
933/* This function passes sense keys from firmware to scsi layer */ 959/* This function passes sense keys from firmware to scsi layer */
934static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host) 960static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host)
935{ 961{
@@ -1613,8 +1639,16 @@ static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset)
1613 int tries = 0, retval = 1, flashed = 0, do_soft_reset = soft_reset; 1639 int tries = 0, retval = 1, flashed = 0, do_soft_reset = soft_reset;
1614 1640
1615 while (tries < TW_MAX_RESET_TRIES) { 1641 while (tries < TW_MAX_RESET_TRIES) {
1616 if (do_soft_reset) 1642 if (do_soft_reset) {
1617 TW_SOFT_RESET(tw_dev); 1643 TW_SOFT_RESET(tw_dev);
1644 /* Clear pchip/response queue on 9550SX */
1645 if (twa_empty_response_queue_large(tw_dev)) {
1646 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x36, "Response queue (large) empty failed during reset sequence");
1647 do_soft_reset = 1;
1648 tries++;
1649 continue;
1650 }
1651 }
1618 1652
1619 /* Make sure controller is in a good state */ 1653 /* Make sure controller is in a good state */
1620 if (twa_poll_status(tw_dev, TW_STATUS_MICROCONTROLLER_READY | (do_soft_reset == 1 ? TW_STATUS_ATTENTION_INTERRUPT : 0), 60)) { 1654 if (twa_poll_status(tw_dev, TW_STATUS_MICROCONTROLLER_READY | (do_soft_reset == 1 ? TW_STATUS_ATTENTION_INTERRUPT : 0), 60)) {
@@ -2034,7 +2068,10 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id
2034 goto out_free_device_extension; 2068 goto out_free_device_extension;
2035 } 2069 }
2036 2070
2037 mem_addr = pci_resource_start(pdev, 1); 2071 if (pdev->device == PCI_DEVICE_ID_3WARE_9000)
2072 mem_addr = pci_resource_start(pdev, 1);
2073 else
2074 mem_addr = pci_resource_start(pdev, 2);
2038 2075
2039 /* Save base address */ 2076 /* Save base address */
2040 tw_dev->base_addr = ioremap(mem_addr, PAGE_SIZE); 2077 tw_dev->base_addr = ioremap(mem_addr, PAGE_SIZE);
@@ -2148,6 +2185,8 @@ static void twa_remove(struct pci_dev *pdev)
2148static struct pci_device_id twa_pci_tbl[] __devinitdata = { 2185static struct pci_device_id twa_pci_tbl[] __devinitdata = {
2149 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9000, 2186 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9000,
2150 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 2187 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
2188 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX,
2189 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
2151 { } 2190 { }
2152}; 2191};
2153MODULE_DEVICE_TABLE(pci, twa_pci_tbl); 2192MODULE_DEVICE_TABLE(pci, twa_pci_tbl);
diff --git a/drivers/scsi/3w-9xxx.h b/drivers/scsi/3w-9xxx.h
index 8c8ecbed3b58..46f22cdc8298 100644
--- a/drivers/scsi/3w-9xxx.h
+++ b/drivers/scsi/3w-9xxx.h
@@ -267,7 +267,6 @@ static twa_message_type twa_error_table[] = {
267#define TW_CONTROL_CLEAR_PARITY_ERROR 0x00800000 267#define TW_CONTROL_CLEAR_PARITY_ERROR 0x00800000
268#define TW_CONTROL_CLEAR_QUEUE_ERROR 0x00400000 268#define TW_CONTROL_CLEAR_QUEUE_ERROR 0x00400000
269#define TW_CONTROL_CLEAR_PCI_ABORT 0x00100000 269#define TW_CONTROL_CLEAR_PCI_ABORT 0x00100000
270#define TW_CONTROL_CLEAR_SBUF_WRITE_ERROR 0x00000008
271 270
272/* Status register bit definitions */ 271/* Status register bit definitions */
273#define TW_STATUS_MAJOR_VERSION_MASK 0xF0000000 272#define TW_STATUS_MAJOR_VERSION_MASK 0xF0000000
@@ -285,9 +284,8 @@ static twa_message_type twa_error_table[] = {
285#define TW_STATUS_MICROCONTROLLER_READY 0x00002000 284#define TW_STATUS_MICROCONTROLLER_READY 0x00002000
286#define TW_STATUS_COMMAND_QUEUE_EMPTY 0x00001000 285#define TW_STATUS_COMMAND_QUEUE_EMPTY 0x00001000
287#define TW_STATUS_EXPECTED_BITS 0x00002000 286#define TW_STATUS_EXPECTED_BITS 0x00002000
288#define TW_STATUS_UNEXPECTED_BITS 0x00F00008 287#define TW_STATUS_UNEXPECTED_BITS 0x00F00000
289#define TW_STATUS_SBUF_WRITE_ERROR 0x00000008 288#define TW_STATUS_VALID_INTERRUPT 0x00DF0000
290#define TW_STATUS_VALID_INTERRUPT 0x00DF0008
291 289
292/* RESPONSE QUEUE BIT DEFINITIONS */ 290/* RESPONSE QUEUE BIT DEFINITIONS */
293#define TW_RESPONSE_ID_MASK 0x00000FF0 291#define TW_RESPONSE_ID_MASK 0x00000FF0
@@ -324,9 +322,9 @@ static twa_message_type twa_error_table[] = {
324 322
325/* Compatibility defines */ 323/* Compatibility defines */
326#define TW_9000_ARCH_ID 0x5 324#define TW_9000_ARCH_ID 0x5
327#define TW_CURRENT_DRIVER_SRL 28 325#define TW_CURRENT_DRIVER_SRL 30
328#define TW_CURRENT_DRIVER_BUILD 9 326#define TW_CURRENT_DRIVER_BUILD 80
329#define TW_CURRENT_DRIVER_BRANCH 4 327#define TW_CURRENT_DRIVER_BRANCH 0
330 328
331/* Phase defines */ 329/* Phase defines */
332#define TW_PHASE_INITIAL 0 330#define TW_PHASE_INITIAL 0
@@ -334,6 +332,7 @@ static twa_message_type twa_error_table[] = {
334#define TW_PHASE_SGLIST 2 332#define TW_PHASE_SGLIST 2
335 333
336/* Misc defines */ 334/* Misc defines */
335#define TW_9550SX_DRAIN_COMPLETED 0xFFFF
337#define TW_SECTOR_SIZE 512 336#define TW_SECTOR_SIZE 512
338#define TW_ALIGNMENT_9000 4 /* 4 bytes */ 337#define TW_ALIGNMENT_9000 4 /* 4 bytes */
339#define TW_ALIGNMENT_9000_SGL 0x3 338#define TW_ALIGNMENT_9000_SGL 0x3
@@ -417,6 +416,9 @@ static twa_message_type twa_error_table[] = {
417#ifndef PCI_DEVICE_ID_3WARE_9000 416#ifndef PCI_DEVICE_ID_3WARE_9000
418#define PCI_DEVICE_ID_3WARE_9000 0x1002 417#define PCI_DEVICE_ID_3WARE_9000 0x1002
419#endif 418#endif
419#ifndef PCI_DEVICE_ID_3WARE_9550SX
420#define PCI_DEVICE_ID_3WARE_9550SX 0x1003
421#endif
420 422
421/* Bitmask macros to eliminate bitfields */ 423/* Bitmask macros to eliminate bitfields */
422 424
@@ -443,6 +445,7 @@ static twa_message_type twa_error_table[] = {
443#define TW_STATUS_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0x4) 445#define TW_STATUS_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0x4)
444#define TW_COMMAND_QUEUE_REG_ADDR(x) (sizeof(dma_addr_t) > 4 ? ((unsigned char __iomem *)x->base_addr + 0x20) : ((unsigned char __iomem *)x->base_addr + 0x8)) 446#define TW_COMMAND_QUEUE_REG_ADDR(x) (sizeof(dma_addr_t) > 4 ? ((unsigned char __iomem *)x->base_addr + 0x20) : ((unsigned char __iomem *)x->base_addr + 0x8))
445#define TW_RESPONSE_QUEUE_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0xC) 447#define TW_RESPONSE_QUEUE_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0xC)
448#define TW_RESPONSE_QUEUE_REG_ADDR_LARGE(x) ((unsigned char __iomem *)x->base_addr + 0x30)
446#define TW_CLEAR_ALL_INTERRUPTS(x) (writel(TW_STATUS_VALID_INTERRUPT, TW_CONTROL_REG_ADDR(x))) 449#define TW_CLEAR_ALL_INTERRUPTS(x) (writel(TW_STATUS_VALID_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
447#define TW_CLEAR_ATTENTION_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_ATTENTION_INTERRUPT, TW_CONTROL_REG_ADDR(x))) 450#define TW_CLEAR_ATTENTION_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_ATTENTION_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
448#define TW_CLEAR_HOST_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_HOST_INTERRUPT, TW_CONTROL_REG_ADDR(x))) 451#define TW_CLEAR_HOST_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_HOST_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 1e4edbdf2730..48529d180ca8 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -99,6 +99,7 @@ obj-$(CONFIG_SCSI_DC395x) += dc395x.o
99obj-$(CONFIG_SCSI_DC390T) += tmscsim.o 99obj-$(CONFIG_SCSI_DC390T) += tmscsim.o
100obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o 100obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o
101obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ 101obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/
102obj-$(CONFIG_MEGARAID_SAS) += megaraid/
102obj-$(CONFIG_SCSI_ACARD) += atp870u.o 103obj-$(CONFIG_SCSI_ACARD) += atp870u.o
103obj-$(CONFIG_SCSI_SUNESP) += esp.o 104obj-$(CONFIG_SCSI_SUNESP) += esp.o
104obj-$(CONFIG_SCSI_GDTH) += gdth.o 105obj-$(CONFIG_SCSI_GDTH) += gdth.o
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index a8e3dfcd0dc7..93416f760e5a 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -313,18 +313,37 @@ int aac_get_containers(struct aac_dev *dev)
313 } 313 }
314 dresp = (struct aac_mount *)fib_data(fibptr); 314 dresp = (struct aac_mount *)fib_data(fibptr);
315 315
316 if ((le32_to_cpu(dresp->status) == ST_OK) &&
317 (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) {
318 dinfo->command = cpu_to_le32(VM_NameServe64);
319 dinfo->count = cpu_to_le32(index);
320 dinfo->type = cpu_to_le32(FT_FILESYS);
321
322 if (fib_send(ContainerCommand,
323 fibptr,
324 sizeof(struct aac_query_mount),
325 FsaNormal,
326 1, 1,
327 NULL, NULL) < 0)
328 continue;
329 } else
330 dresp->mnt[0].capacityhigh = 0;
331
316 dprintk ((KERN_DEBUG 332 dprintk ((KERN_DEBUG
317 "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%u\n", 333 "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%llu\n",
318 (int)index, (int)le32_to_cpu(dresp->status), 334 (int)index, (int)le32_to_cpu(dresp->status),
319 (int)le32_to_cpu(dresp->mnt[0].vol), 335 (int)le32_to_cpu(dresp->mnt[0].vol),
320 (int)le32_to_cpu(dresp->mnt[0].state), 336 (int)le32_to_cpu(dresp->mnt[0].state),
321 (unsigned)le32_to_cpu(dresp->mnt[0].capacity))); 337 ((u64)le32_to_cpu(dresp->mnt[0].capacity)) +
338 (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32)));
322 if ((le32_to_cpu(dresp->status) == ST_OK) && 339 if ((le32_to_cpu(dresp->status) == ST_OK) &&
323 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && 340 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) &&
324 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) { 341 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) {
325 fsa_dev_ptr[index].valid = 1; 342 fsa_dev_ptr[index].valid = 1;
326 fsa_dev_ptr[index].type = le32_to_cpu(dresp->mnt[0].vol); 343 fsa_dev_ptr[index].type = le32_to_cpu(dresp->mnt[0].vol);
327 fsa_dev_ptr[index].size = le32_to_cpu(dresp->mnt[0].capacity); 344 fsa_dev_ptr[index].size
345 = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) +
346 (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32);
328 if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) 347 if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY)
329 fsa_dev_ptr[index].ro = 1; 348 fsa_dev_ptr[index].ro = 1;
330 } 349 }
@@ -460,7 +479,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid)
460 * is updated in the struct fsa_dev_info structure rather than returned. 479 * is updated in the struct fsa_dev_info structure rather than returned.
461 */ 480 */
462 481
463static int probe_container(struct aac_dev *dev, int cid) 482int probe_container(struct aac_dev *dev, int cid)
464{ 483{
465 struct fsa_dev_info *fsa_dev_ptr; 484 struct fsa_dev_info *fsa_dev_ptr;
466 int status; 485 int status;
@@ -497,11 +516,29 @@ static int probe_container(struct aac_dev *dev, int cid)
497 dresp = (struct aac_mount *) fib_data(fibptr); 516 dresp = (struct aac_mount *) fib_data(fibptr);
498 517
499 if ((le32_to_cpu(dresp->status) == ST_OK) && 518 if ((le32_to_cpu(dresp->status) == ST_OK) &&
519 (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) {
520 dinfo->command = cpu_to_le32(VM_NameServe64);
521 dinfo->count = cpu_to_le32(cid);
522 dinfo->type = cpu_to_le32(FT_FILESYS);
523
524 if (fib_send(ContainerCommand,
525 fibptr,
526 sizeof(struct aac_query_mount),
527 FsaNormal,
528 1, 1,
529 NULL, NULL) < 0)
530 goto error;
531 } else
532 dresp->mnt[0].capacityhigh = 0;
533
534 if ((le32_to_cpu(dresp->status) == ST_OK) &&
500 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && 535 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) &&
501 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) { 536 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) {
502 fsa_dev_ptr[cid].valid = 1; 537 fsa_dev_ptr[cid].valid = 1;
503 fsa_dev_ptr[cid].type = le32_to_cpu(dresp->mnt[0].vol); 538 fsa_dev_ptr[cid].type = le32_to_cpu(dresp->mnt[0].vol);
504 fsa_dev_ptr[cid].size = le32_to_cpu(dresp->mnt[0].capacity); 539 fsa_dev_ptr[cid].size
540 = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) +
541 (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32);
505 if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) 542 if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY)
506 fsa_dev_ptr[cid].ro = 1; 543 fsa_dev_ptr[cid].ro = 1;
507 } 544 }
@@ -655,7 +692,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
655 fibptr, 692 fibptr,
656 sizeof(*info), 693 sizeof(*info),
657 FsaNormal, 694 FsaNormal,
658 1, 1, 695 -1, 1, /* First `interrupt' command uses special wait */
659 NULL, 696 NULL,
660 NULL); 697 NULL);
661 698
@@ -806,8 +843,8 @@ int aac_get_adapter_info(struct aac_dev* dev)
806 if (!(dev->raw_io_interface)) { 843 if (!(dev->raw_io_interface)) {
807 dev->scsi_host_ptr->sg_tablesize = (dev->max_fib_size - 844 dev->scsi_host_ptr->sg_tablesize = (dev->max_fib_size -
808 sizeof(struct aac_fibhdr) - 845 sizeof(struct aac_fibhdr) -
809 sizeof(struct aac_write) + sizeof(struct sgmap)) / 846 sizeof(struct aac_write) + sizeof(struct sgentry)) /
810 sizeof(struct sgmap); 847 sizeof(struct sgentry);
811 if (dev->dac_support) { 848 if (dev->dac_support) {
812 /* 849 /*
813 * 38 scatter gather elements 850 * 38 scatter gather elements
@@ -816,8 +853,8 @@ int aac_get_adapter_info(struct aac_dev* dev)
816 (dev->max_fib_size - 853 (dev->max_fib_size -
817 sizeof(struct aac_fibhdr) - 854 sizeof(struct aac_fibhdr) -
818 sizeof(struct aac_write64) + 855 sizeof(struct aac_write64) +
819 sizeof(struct sgmap64)) / 856 sizeof(struct sgentry64)) /
820 sizeof(struct sgmap64); 857 sizeof(struct sgentry64);
821 } 858 }
822 dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT; 859 dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT;
823 if(!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) { 860 if(!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) {
@@ -854,7 +891,40 @@ static void io_callback(void *context, struct fib * fibptr)
854 dev = (struct aac_dev *)scsicmd->device->host->hostdata; 891 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
855 cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); 892 cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
856 893
857 dprintk((KERN_DEBUG "io_callback[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3], jiffies)); 894 if (nblank(dprintk(x))) {
895 u64 lba;
896 switch (scsicmd->cmnd[0]) {
897 case WRITE_6:
898 case READ_6:
899 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) |
900 (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
901 break;
902 case WRITE_16:
903 case READ_16:
904 lba = ((u64)scsicmd->cmnd[2] << 56) |
905 ((u64)scsicmd->cmnd[3] << 48) |
906 ((u64)scsicmd->cmnd[4] << 40) |
907 ((u64)scsicmd->cmnd[5] << 32) |
908 ((u64)scsicmd->cmnd[6] << 24) |
909 (scsicmd->cmnd[7] << 16) |
910 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
911 break;
912 case WRITE_12:
913 case READ_12:
914 lba = ((u64)scsicmd->cmnd[2] << 24) |
915 (scsicmd->cmnd[3] << 16) |
916 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
917 break;
918 default:
919 lba = ((u64)scsicmd->cmnd[2] << 24) |
920 (scsicmd->cmnd[3] << 16) |
921 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
922 break;
923 }
924 printk(KERN_DEBUG
925 "io_callback[cpu %d]: lba = %llu, t = %ld.\n",
926 smp_processor_id(), (unsigned long long)lba, jiffies);
927 }
858 928
859 if (fibptr == NULL) 929 if (fibptr == NULL)
860 BUG(); 930 BUG();
@@ -895,7 +965,7 @@ static void io_callback(void *context, struct fib * fibptr)
895 965
896static int aac_read(struct scsi_cmnd * scsicmd, int cid) 966static int aac_read(struct scsi_cmnd * scsicmd, int cid)
897{ 967{
898 u32 lba; 968 u64 lba;
899 u32 count; 969 u32 count;
900 int status; 970 int status;
901 971
@@ -907,23 +977,69 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
907 /* 977 /*
908 * Get block address and transfer length 978 * Get block address and transfer length
909 */ 979 */
910 if (scsicmd->cmnd[0] == READ_6) /* 6 byte command */ 980 switch (scsicmd->cmnd[0]) {
911 { 981 case READ_6:
912 dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", cid)); 982 dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", cid));
913 983
914 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; 984 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) |
985 (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
915 count = scsicmd->cmnd[4]; 986 count = scsicmd->cmnd[4];
916 987
917 if (count == 0) 988 if (count == 0)
918 count = 256; 989 count = 256;
919 } else { 990 break;
991 case READ_16:
992 dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", cid));
993
994 lba = ((u64)scsicmd->cmnd[2] << 56) |
995 ((u64)scsicmd->cmnd[3] << 48) |
996 ((u64)scsicmd->cmnd[4] << 40) |
997 ((u64)scsicmd->cmnd[5] << 32) |
998 ((u64)scsicmd->cmnd[6] << 24) |
999 (scsicmd->cmnd[7] << 16) |
1000 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1001 count = (scsicmd->cmnd[10] << 24) |
1002 (scsicmd->cmnd[11] << 16) |
1003 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13];
1004 break;
1005 case READ_12:
1006 dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", cid));
1007
1008 lba = ((u64)scsicmd->cmnd[2] << 24) |
1009 (scsicmd->cmnd[3] << 16) |
1010 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
1011 count = (scsicmd->cmnd[6] << 24) |
1012 (scsicmd->cmnd[7] << 16) |
1013 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1014 break;
1015 default:
920 dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", cid)); 1016 dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", cid));
921 1017
922 lba = (scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; 1018 lba = ((u64)scsicmd->cmnd[2] << 24) |
1019 (scsicmd->cmnd[3] << 16) |
1020 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
923 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; 1021 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
1022 break;
924 } 1023 }
925 dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %u, t = %ld.\n", 1024 dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %llu, t = %ld.\n",
926 smp_processor_id(), (unsigned long long)lba, jiffies)); 1025 smp_processor_id(), (unsigned long long)lba, jiffies));
1026 if ((!(dev->raw_io_interface) || !(dev->raw_io_64)) &&
1027 (lba & 0xffffffff00000000LL)) {
1028 dprintk((KERN_DEBUG "aac_read: Illegal lba\n"));
1029 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 |
1030 SAM_STAT_CHECK_CONDITION;
1031 set_sense((u8 *) &dev->fsa_dev[cid].sense_data,
1032 HARDWARE_ERROR,
1033 SENCODE_INTERNAL_TARGET_FAILURE,
1034 ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
1035 0, 0);
1036 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
1037 (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer))
1038 ? sizeof(scsicmd->sense_buffer)
1039 : sizeof(dev->fsa_dev[cid].sense_data));
1040 scsicmd->scsi_done(scsicmd);
1041 return 0;
1042 }
927 /* 1043 /*
928 * Alocate and initialize a Fib 1044 * Alocate and initialize a Fib
929 */ 1045 */
@@ -936,8 +1052,8 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
936 if (dev->raw_io_interface) { 1052 if (dev->raw_io_interface) {
937 struct aac_raw_io *readcmd; 1053 struct aac_raw_io *readcmd;
938 readcmd = (struct aac_raw_io *) fib_data(cmd_fibcontext); 1054 readcmd = (struct aac_raw_io *) fib_data(cmd_fibcontext);
939 readcmd->block[0] = cpu_to_le32(lba); 1055 readcmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff));
940 readcmd->block[1] = 0; 1056 readcmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32));
941 readcmd->count = cpu_to_le32(count<<9); 1057 readcmd->count = cpu_to_le32(count<<9);
942 readcmd->cid = cpu_to_le16(cid); 1058 readcmd->cid = cpu_to_le16(cid);
943 readcmd->flags = cpu_to_le16(1); 1059 readcmd->flags = cpu_to_le16(1);
@@ -964,7 +1080,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
964 readcmd->command = cpu_to_le32(VM_CtHostRead64); 1080 readcmd->command = cpu_to_le32(VM_CtHostRead64);
965 readcmd->cid = cpu_to_le16(cid); 1081 readcmd->cid = cpu_to_le16(cid);
966 readcmd->sector_count = cpu_to_le16(count); 1082 readcmd->sector_count = cpu_to_le16(count);
967 readcmd->block = cpu_to_le32(lba); 1083 readcmd->block = cpu_to_le32((u32)(lba&0xffffffff));
968 readcmd->pad = 0; 1084 readcmd->pad = 0;
969 readcmd->flags = 0; 1085 readcmd->flags = 0;
970 1086
@@ -989,7 +1105,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
989 readcmd = (struct aac_read *) fib_data(cmd_fibcontext); 1105 readcmd = (struct aac_read *) fib_data(cmd_fibcontext);
990 readcmd->command = cpu_to_le32(VM_CtBlockRead); 1106 readcmd->command = cpu_to_le32(VM_CtBlockRead);
991 readcmd->cid = cpu_to_le32(cid); 1107 readcmd->cid = cpu_to_le32(cid);
992 readcmd->block = cpu_to_le32(lba); 1108 readcmd->block = cpu_to_le32((u32)(lba&0xffffffff));
993 readcmd->count = cpu_to_le32(count * 512); 1109 readcmd->count = cpu_to_le32(count * 512);
994 1110
995 aac_build_sg(scsicmd, &readcmd->sg); 1111 aac_build_sg(scsicmd, &readcmd->sg);
@@ -1031,7 +1147,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1031 1147
1032static int aac_write(struct scsi_cmnd * scsicmd, int cid) 1148static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1033{ 1149{
1034 u32 lba; 1150 u64 lba;
1035 u32 count; 1151 u32 count;
1036 int status; 1152 int status;
1037 u16 fibsize; 1153 u16 fibsize;
@@ -1048,13 +1164,48 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1048 count = scsicmd->cmnd[4]; 1164 count = scsicmd->cmnd[4];
1049 if (count == 0) 1165 if (count == 0)
1050 count = 256; 1166 count = 256;
1167 } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */
1168 dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", cid));
1169
1170 lba = ((u64)scsicmd->cmnd[2] << 56) |
1171 ((u64)scsicmd->cmnd[3] << 48) |
1172 ((u64)scsicmd->cmnd[4] << 40) |
1173 ((u64)scsicmd->cmnd[5] << 32) |
1174 ((u64)scsicmd->cmnd[6] << 24) |
1175 (scsicmd->cmnd[7] << 16) |
1176 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1177 count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) |
1178 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13];
1179 } else if (scsicmd->cmnd[0] == WRITE_12) { /* 12 byte command */
1180 dprintk((KERN_DEBUG "aachba: received a write(12) command on id %d.\n", cid));
1181
1182 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16)
1183 | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
1184 count = (scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16)
1185 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1051 } else { 1186 } else {
1052 dprintk((KERN_DEBUG "aachba: received a write(10) command on id %d.\n", cid)); 1187 dprintk((KERN_DEBUG "aachba: received a write(10) command on id %d.\n", cid));
1053 lba = (scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; 1188 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
1054 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; 1189 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
1055 } 1190 }
1056 dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %u, t = %ld.\n", 1191 dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %llu, t = %ld.\n",
1057 smp_processor_id(), (unsigned long long)lba, jiffies)); 1192 smp_processor_id(), (unsigned long long)lba, jiffies));
1193 if ((!(dev->raw_io_interface) || !(dev->raw_io_64))
1194 && (lba & 0xffffffff00000000LL)) {
1195 dprintk((KERN_DEBUG "aac_write: Illegal lba\n"));
1196 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
1197 set_sense((u8 *) &dev->fsa_dev[cid].sense_data,
1198 HARDWARE_ERROR,
1199 SENCODE_INTERNAL_TARGET_FAILURE,
1200 ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
1201 0, 0);
1202 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
1203 (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer))
1204 ? sizeof(scsicmd->sense_buffer)
1205 : sizeof(dev->fsa_dev[cid].sense_data));
1206 scsicmd->scsi_done(scsicmd);
1207 return 0;
1208 }
1058 /* 1209 /*
1059 * Allocate and initialize a Fib then setup a BlockWrite command 1210 * Allocate and initialize a Fib then setup a BlockWrite command
1060 */ 1211 */
@@ -1068,8 +1219,8 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1068 if (dev->raw_io_interface) { 1219 if (dev->raw_io_interface) {
1069 struct aac_raw_io *writecmd; 1220 struct aac_raw_io *writecmd;
1070 writecmd = (struct aac_raw_io *) fib_data(cmd_fibcontext); 1221 writecmd = (struct aac_raw_io *) fib_data(cmd_fibcontext);
1071 writecmd->block[0] = cpu_to_le32(lba); 1222 writecmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff));
1072 writecmd->block[1] = 0; 1223 writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32));
1073 writecmd->count = cpu_to_le32(count<<9); 1224 writecmd->count = cpu_to_le32(count<<9);
1074 writecmd->cid = cpu_to_le16(cid); 1225 writecmd->cid = cpu_to_le16(cid);
1075 writecmd->flags = 0; 1226 writecmd->flags = 0;
@@ -1096,7 +1247,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1096 writecmd->command = cpu_to_le32(VM_CtHostWrite64); 1247 writecmd->command = cpu_to_le32(VM_CtHostWrite64);
1097 writecmd->cid = cpu_to_le16(cid); 1248 writecmd->cid = cpu_to_le16(cid);
1098 writecmd->sector_count = cpu_to_le16(count); 1249 writecmd->sector_count = cpu_to_le16(count);
1099 writecmd->block = cpu_to_le32(lba); 1250 writecmd->block = cpu_to_le32((u32)(lba&0xffffffff));
1100 writecmd->pad = 0; 1251 writecmd->pad = 0;
1101 writecmd->flags = 0; 1252 writecmd->flags = 0;
1102 1253
@@ -1121,7 +1272,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1121 writecmd = (struct aac_write *) fib_data(cmd_fibcontext); 1272 writecmd = (struct aac_write *) fib_data(cmd_fibcontext);
1122 writecmd->command = cpu_to_le32(VM_CtBlockWrite); 1273 writecmd->command = cpu_to_le32(VM_CtBlockWrite);
1123 writecmd->cid = cpu_to_le32(cid); 1274 writecmd->cid = cpu_to_le32(cid);
1124 writecmd->block = cpu_to_le32(lba); 1275 writecmd->block = cpu_to_le32((u32)(lba&0xffffffff));
1125 writecmd->count = cpu_to_le32(count * 512); 1276 writecmd->count = cpu_to_le32(count * 512);
1126 writecmd->sg.count = cpu_to_le32(1); 1277 writecmd->sg.count = cpu_to_le32(1);
1127 /* ->stable is not used - it did mean which type of write */ 1278 /* ->stable is not used - it did mean which type of write */
@@ -1310,11 +1461,18 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1310 */ 1461 */
1311 if ((fsa_dev_ptr[cid].valid & 1) == 0) { 1462 if ((fsa_dev_ptr[cid].valid & 1) == 0) {
1312 switch (scsicmd->cmnd[0]) { 1463 switch (scsicmd->cmnd[0]) {
1464 case SERVICE_ACTION_IN:
1465 if (!(dev->raw_io_interface) ||
1466 !(dev->raw_io_64) ||
1467 ((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
1468 break;
1313 case INQUIRY: 1469 case INQUIRY:
1314 case READ_CAPACITY: 1470 case READ_CAPACITY:
1315 case TEST_UNIT_READY: 1471 case TEST_UNIT_READY:
1316 spin_unlock_irq(host->host_lock); 1472 spin_unlock_irq(host->host_lock);
1317 probe_container(dev, cid); 1473 probe_container(dev, cid);
1474 if ((fsa_dev_ptr[cid].valid & 1) == 0)
1475 fsa_dev_ptr[cid].valid = 0;
1318 spin_lock_irq(host->host_lock); 1476 spin_lock_irq(host->host_lock);
1319 if (fsa_dev_ptr[cid].valid == 0) { 1477 if (fsa_dev_ptr[cid].valid == 0) {
1320 scsicmd->result = DID_NO_CONNECT << 16; 1478 scsicmd->result = DID_NO_CONNECT << 16;
@@ -1375,7 +1533,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1375 memset(&inq_data, 0, sizeof (struct inquiry_data)); 1533 memset(&inq_data, 0, sizeof (struct inquiry_data));
1376 1534
1377 inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */ 1535 inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */
1378 inq_data.inqd_dtq = 0x80; /* set RMB bit to one indicating that the medium is removable */
1379 inq_data.inqd_rdf = 2; /* A response data format value of two indicates that the data shall be in the format specified in SCSI-2 */ 1536 inq_data.inqd_rdf = 2; /* A response data format value of two indicates that the data shall be in the format specified in SCSI-2 */
1380 inq_data.inqd_len = 31; 1537 inq_data.inqd_len = 31;
1381 /*Format for "pad2" is RelAdr | WBus32 | WBus16 | Sync | Linked |Reserved| CmdQue | SftRe */ 1538 /*Format for "pad2" is RelAdr | WBus32 | WBus16 | Sync | Linked |Reserved| CmdQue | SftRe */
@@ -1397,13 +1554,55 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1397 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1554 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
1398 return aac_get_container_name(scsicmd, cid); 1555 return aac_get_container_name(scsicmd, cid);
1399 } 1556 }
1557 case SERVICE_ACTION_IN:
1558 if (!(dev->raw_io_interface) ||
1559 !(dev->raw_io_64) ||
1560 ((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
1561 break;
1562 {
1563 u64 capacity;
1564 char cp[12];
1565 unsigned int offset = 0;
1566
1567 dprintk((KERN_DEBUG "READ CAPACITY_16 command.\n"));
1568 capacity = fsa_dev_ptr[cid].size - 1;
1569 if (scsicmd->cmnd[13] > 12) {
1570 offset = scsicmd->cmnd[13] - 12;
1571 if (offset > sizeof(cp))
1572 break;
1573 memset(cp, 0, offset);
1574 aac_internal_transfer(scsicmd, cp, 0, offset);
1575 }
1576 cp[0] = (capacity >> 56) & 0xff;
1577 cp[1] = (capacity >> 48) & 0xff;
1578 cp[2] = (capacity >> 40) & 0xff;
1579 cp[3] = (capacity >> 32) & 0xff;
1580 cp[4] = (capacity >> 24) & 0xff;
1581 cp[5] = (capacity >> 16) & 0xff;
1582 cp[6] = (capacity >> 8) & 0xff;
1583 cp[7] = (capacity >> 0) & 0xff;
1584 cp[8] = 0;
1585 cp[9] = 0;
1586 cp[10] = 2;
1587 cp[11] = 0;
1588 aac_internal_transfer(scsicmd, cp, offset, sizeof(cp));
1589
1590 /* Do not cache partition table for arrays */
1591 scsicmd->device->removable = 1;
1592
1593 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
1594 scsicmd->scsi_done(scsicmd);
1595
1596 return 0;
1597 }
1598
1400 case READ_CAPACITY: 1599 case READ_CAPACITY:
1401 { 1600 {
1402 u32 capacity; 1601 u32 capacity;
1403 char cp[8]; 1602 char cp[8];
1404 1603
1405 dprintk((KERN_DEBUG "READ CAPACITY command.\n")); 1604 dprintk((KERN_DEBUG "READ CAPACITY command.\n"));
1406 if (fsa_dev_ptr[cid].size <= 0x100000000LL) 1605 if (fsa_dev_ptr[cid].size <= 0x100000000ULL)
1407 capacity = fsa_dev_ptr[cid].size - 1; 1606 capacity = fsa_dev_ptr[cid].size - 1;
1408 else 1607 else
1409 capacity = (u32)-1; 1608 capacity = (u32)-1;
@@ -1417,6 +1616,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1417 cp[6] = 2; 1616 cp[6] = 2;
1418 cp[7] = 0; 1617 cp[7] = 0;
1419 aac_internal_transfer(scsicmd, cp, 0, sizeof(cp)); 1618 aac_internal_transfer(scsicmd, cp, 0, sizeof(cp));
1619 /* Do not cache partition table for arrays */
1620 scsicmd->device->removable = 1;
1420 1621
1421 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; 1622 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
1422 scsicmd->scsi_done(scsicmd); 1623 scsicmd->scsi_done(scsicmd);
@@ -1497,6 +1698,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1497 { 1698 {
1498 case READ_6: 1699 case READ_6:
1499 case READ_10: 1700 case READ_10:
1701 case READ_12:
1702 case READ_16:
1500 /* 1703 /*
1501 * Hack to keep track of ordinal number of the device that 1704 * Hack to keep track of ordinal number of the device that
1502 * corresponds to a container. Needed to convert 1705 * corresponds to a container. Needed to convert
@@ -1504,17 +1707,19 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1504 */ 1707 */
1505 1708
1506 spin_unlock_irq(host->host_lock); 1709 spin_unlock_irq(host->host_lock);
1507 if (scsicmd->request->rq_disk) 1710 if (scsicmd->request->rq_disk)
1508 memcpy(fsa_dev_ptr[cid].devname, 1711 strlcpy(fsa_dev_ptr[cid].devname,
1509 scsicmd->request->rq_disk->disk_name, 1712 scsicmd->request->rq_disk->disk_name,
1510 8); 1713 min(sizeof(fsa_dev_ptr[cid].devname),
1511 1714 sizeof(scsicmd->request->rq_disk->disk_name) + 1));
1512 ret = aac_read(scsicmd, cid); 1715 ret = aac_read(scsicmd, cid);
1513 spin_lock_irq(host->host_lock); 1716 spin_lock_irq(host->host_lock);
1514 return ret; 1717 return ret;
1515 1718
1516 case WRITE_6: 1719 case WRITE_6:
1517 case WRITE_10: 1720 case WRITE_10:
1721 case WRITE_12:
1722 case WRITE_16:
1518 spin_unlock_irq(host->host_lock); 1723 spin_unlock_irq(host->host_lock);
1519 ret = aac_write(scsicmd, cid); 1724 ret = aac_write(scsicmd, cid);
1520 spin_lock_irq(host->host_lock); 1725 spin_lock_irq(host->host_lock);
@@ -1745,6 +1950,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1745 case WRITE_10: 1950 case WRITE_10:
1746 case READ_12: 1951 case READ_12:
1747 case WRITE_12: 1952 case WRITE_12:
1953 case READ_16:
1954 case WRITE_16:
1748 if(le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow ) { 1955 if(le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow ) {
1749 printk(KERN_WARNING"aacraid: SCSI CMD underflow\n"); 1956 printk(KERN_WARNING"aacraid: SCSI CMD underflow\n");
1750 } else { 1957 } else {
@@ -1850,8 +2057,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1850 sizeof(scsicmd->sense_buffer) : 2057 sizeof(scsicmd->sense_buffer) :
1851 le32_to_cpu(srbreply->sense_data_size); 2058 le32_to_cpu(srbreply->sense_data_size);
1852#ifdef AAC_DETAILED_STATUS_INFO 2059#ifdef AAC_DETAILED_STATUS_INFO
1853 dprintk((KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n", 2060 printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
1854 le32_to_cpu(srbreply->status), len)); 2061 le32_to_cpu(srbreply->status), len);
1855#endif 2062#endif
1856 memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); 2063 memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
1857 2064
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index e40528185d48..4a99d2f000f4 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1,6 +1,10 @@
1#if (!defined(dprintk)) 1#if (!defined(dprintk))
2# define dprintk(x) 2# define dprintk(x)
3#endif 3#endif
4/* eg: if (nblank(dprintk(x))) */
5#define _nblank(x) #x
6#define nblank(x) _nblank(x)[0]
7
4 8
5/*------------------------------------------------------------------------------ 9/*------------------------------------------------------------------------------
6 * D E F I N E S 10 * D E F I N E S
@@ -302,7 +306,6 @@ enum aac_queue_types {
302 */ 306 */
303 307
304#define FsaNormal 1 308#define FsaNormal 1
305#define FsaHigh 2
306 309
307/* 310/*
308 * Define the FIB. The FIB is the where all the requested data and 311 * Define the FIB. The FIB is the where all the requested data and
@@ -546,8 +549,6 @@ struct aac_queue {
546 /* This is only valid for adapter to host command queues. */ 549 /* This is only valid for adapter to host command queues. */
547 spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ 550 spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */
548 spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */ 551 spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */
549 unsigned long SavedIrql; /* Previous IRQL when the spin lock is taken */
550 u32 padding; /* Padding - FIXME - can remove I believe */
551 struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ 552 struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */
552 /* only valid for command queues which receive entries from the adapter. */ 553 /* only valid for command queues which receive entries from the adapter. */
553 struct list_head pendingq; /* A queue of outstanding fib's to the adapter. */ 554 struct list_head pendingq; /* A queue of outstanding fib's to the adapter. */
@@ -776,7 +777,9 @@ struct fsa_dev_info {
776 u64 last; 777 u64 last;
777 u64 size; 778 u64 size;
778 u32 type; 779 u32 type;
780 u32 config_waiting_on;
779 u16 queue_depth; 781 u16 queue_depth;
782 u8 config_needed;
780 u8 valid; 783 u8 valid;
781 u8 ro; 784 u8 ro;
782 u8 locked; 785 u8 locked;
@@ -1012,6 +1015,7 @@ struct aac_dev
1012 /* macro side-effects BEWARE */ 1015 /* macro side-effects BEWARE */
1013# define raw_io_interface \ 1016# define raw_io_interface \
1014 init->InitStructRevision==cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_4) 1017 init->InitStructRevision==cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_4)
1018 u8 raw_io_64;
1015 u8 printf_enabled; 1019 u8 printf_enabled;
1016}; 1020};
1017 1021
@@ -1362,8 +1366,10 @@ struct aac_srb_reply
1362#define VM_CtBlockVerify64 18 1366#define VM_CtBlockVerify64 18
1363#define VM_CtHostRead64 19 1367#define VM_CtHostRead64 19
1364#define VM_CtHostWrite64 20 1368#define VM_CtHostWrite64 20
1369#define VM_DrvErrTblLog 21
1370#define VM_NameServe64 22
1365 1371
1366#define MAX_VMCOMMAND_NUM 21 /* used for sizing stats array - leave last */ 1372#define MAX_VMCOMMAND_NUM 23 /* used for sizing stats array - leave last */
1367 1373
1368/* 1374/*
1369 * Descriptive information (eg, vital stats) 1375 * Descriptive information (eg, vital stats)
@@ -1472,6 +1478,7 @@ struct aac_mntent {
1472 manager (eg, filesystem) */ 1478 manager (eg, filesystem) */
1473 __le32 altoid; /* != oid <==> snapshot or 1479 __le32 altoid; /* != oid <==> snapshot or
1474 broken mirror exists */ 1480 broken mirror exists */
1481 __le32 capacityhigh;
1475}; 1482};
1476 1483
1477#define FSCS_NOTCLEAN 0x0001 /* fsck is neccessary before mounting */ 1484#define FSCS_NOTCLEAN 0x0001 /* fsck is neccessary before mounting */
@@ -1707,6 +1714,7 @@ extern struct aac_common aac_config;
1707#define AifCmdJobProgress 2 /* Progress report */ 1714#define AifCmdJobProgress 2 /* Progress report */
1708#define AifJobCtrZero 101 /* Array Zero progress */ 1715#define AifJobCtrZero 101 /* Array Zero progress */
1709#define AifJobStsSuccess 1 /* Job completes */ 1716#define AifJobStsSuccess 1 /* Job completes */
1717#define AifJobStsRunning 102 /* Job running */
1710#define AifCmdAPIReport 3 /* Report from other user of API */ 1718#define AifCmdAPIReport 3 /* Report from other user of API */
1711#define AifCmdDriverNotify 4 /* Notify host driver of event */ 1719#define AifCmdDriverNotify 4 /* Notify host driver of event */
1712#define AifDenMorphComplete 200 /* A morph operation completed */ 1720#define AifDenMorphComplete 200 /* A morph operation completed */
@@ -1777,6 +1785,7 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size);
1777struct aac_driver_ident* aac_get_driver_ident(int devtype); 1785struct aac_driver_ident* aac_get_driver_ident(int devtype);
1778int aac_get_adapter_info(struct aac_dev* dev); 1786int aac_get_adapter_info(struct aac_dev* dev);
1779int aac_send_shutdown(struct aac_dev *dev); 1787int aac_send_shutdown(struct aac_dev *dev);
1788int probe_container(struct aac_dev *dev, int cid);
1780extern int numacb; 1789extern int numacb;
1781extern int acbsize; 1790extern int acbsize;
1782extern char aac_driver_version[]; 1791extern char aac_driver_version[];
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 75abd0453289..59a341b2aedc 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -195,7 +195,7 @@ int aac_send_shutdown(struct aac_dev * dev)
195 fibctx, 195 fibctx,
196 sizeof(struct aac_close), 196 sizeof(struct aac_close),
197 FsaNormal, 197 FsaNormal,
198 1, 1, 198 -2 /* Timeout silently */, 1,
199 NULL, NULL); 199 NULL, NULL);
200 200
201 if (status == 0) 201 if (status == 0)
@@ -313,8 +313,15 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
313 dev->max_fib_size = sizeof(struct hw_fib); 313 dev->max_fib_size = sizeof(struct hw_fib);
314 dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size 314 dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
315 - sizeof(struct aac_fibhdr) 315 - sizeof(struct aac_fibhdr)
316 - sizeof(struct aac_write) + sizeof(struct sgmap)) 316 - sizeof(struct aac_write) + sizeof(struct sgentry))
317 / sizeof(struct sgmap); 317 / sizeof(struct sgentry);
318 dev->raw_io_64 = 0;
319 if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES,
320 0, 0, 0, 0, 0, 0, status+0, status+1, status+2, NULL, NULL)) &&
321 (status[0] == 0x00000001)) {
322 if (status[1] & AAC_OPT_NEW_COMM_64)
323 dev->raw_io_64 = 1;
324 }
318 if ((!aac_adapter_sync_cmd(dev, GET_COMM_PREFERRED_SETTINGS, 325 if ((!aac_adapter_sync_cmd(dev, GET_COMM_PREFERRED_SETTINGS,
319 0, 0, 0, 0, 0, 0, 326 0, 0, 0, 0, 0, 0,
320 status+0, status+1, status+2, status+3, status+4)) 327 status+0, status+1, status+2, status+3, status+4))
@@ -342,8 +349,8 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
342 dev->max_fib_size = 512; 349 dev->max_fib_size = 512;
343 dev->sg_tablesize = host->sg_tablesize 350 dev->sg_tablesize = host->sg_tablesize
344 = (512 - sizeof(struct aac_fibhdr) 351 = (512 - sizeof(struct aac_fibhdr)
345 - sizeof(struct aac_write) + sizeof(struct sgmap)) 352 - sizeof(struct aac_write) + sizeof(struct sgentry))
346 / sizeof(struct sgmap); 353 / sizeof(struct sgentry);
347 host->can_queue = AAC_NUM_IO_FIB; 354 host->can_queue = AAC_NUM_IO_FIB;
348 } else if (acbsize == 2048) { 355 } else if (acbsize == 2048) {
349 host->max_sectors = 512; 356 host->max_sectors = 512;
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index a1d303f03480..e4d543a474ae 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -39,7 +39,9 @@
39#include <linux/completion.h> 39#include <linux/completion.h>
40#include <linux/blkdev.h> 40#include <linux/blkdev.h>
41#include <scsi/scsi_host.h> 41#include <scsi/scsi_host.h>
42#include <scsi/scsi_device.h>
42#include <asm/semaphore.h> 43#include <asm/semaphore.h>
44#include <asm/delay.h>
43 45
44#include "aacraid.h" 46#include "aacraid.h"
45 47
@@ -269,40 +271,22 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entr
269 /* Interrupt Moderation, only interrupt for first two entries */ 271 /* Interrupt Moderation, only interrupt for first two entries */
270 if (idx != le32_to_cpu(*(q->headers.consumer))) { 272 if (idx != le32_to_cpu(*(q->headers.consumer))) {
271 if (--idx == 0) { 273 if (--idx == 0) {
272 if (qid == AdapHighCmdQueue) 274 if (qid == AdapNormCmdQueue)
273 idx = ADAP_HIGH_CMD_ENTRIES;
274 else if (qid == AdapNormCmdQueue)
275 idx = ADAP_NORM_CMD_ENTRIES; 275 idx = ADAP_NORM_CMD_ENTRIES;
276 else if (qid == AdapHighRespQueue) 276 else
277 idx = ADAP_HIGH_RESP_ENTRIES;
278 else if (qid == AdapNormRespQueue)
279 idx = ADAP_NORM_RESP_ENTRIES; 277 idx = ADAP_NORM_RESP_ENTRIES;
280 } 278 }
281 if (idx != le32_to_cpu(*(q->headers.consumer))) 279 if (idx != le32_to_cpu(*(q->headers.consumer)))
282 *nonotify = 1; 280 *nonotify = 1;
283 } 281 }
284 282
285 if (qid == AdapHighCmdQueue) { 283 if (qid == AdapNormCmdQueue) {
286 if (*index >= ADAP_HIGH_CMD_ENTRIES)
287 *index = 0;
288 } else if (qid == AdapNormCmdQueue) {
289 if (*index >= ADAP_NORM_CMD_ENTRIES) 284 if (*index >= ADAP_NORM_CMD_ENTRIES)
290 *index = 0; /* Wrap to front of the Producer Queue. */ 285 *index = 0; /* Wrap to front of the Producer Queue. */
291 } 286 } else {
292 else if (qid == AdapHighRespQueue)
293 {
294 if (*index >= ADAP_HIGH_RESP_ENTRIES)
295 *index = 0;
296 }
297 else if (qid == AdapNormRespQueue)
298 {
299 if (*index >= ADAP_NORM_RESP_ENTRIES) 287 if (*index >= ADAP_NORM_RESP_ENTRIES)
300 *index = 0; /* Wrap to front of the Producer Queue. */ 288 *index = 0; /* Wrap to front of the Producer Queue. */
301 } 289 }
302 else {
303 printk("aacraid: invalid qid\n");
304 BUG();
305 }
306 290
307 if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { /* Queue is full */ 291 if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { /* Queue is full */
308 printk(KERN_WARNING "Queue %d full, %u outstanding.\n", 292 printk(KERN_WARNING "Queue %d full, %u outstanding.\n",
@@ -334,12 +318,8 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f
334{ 318{
335 struct aac_entry * entry = NULL; 319 struct aac_entry * entry = NULL;
336 int map = 0; 320 int map = 0;
337 struct aac_queue * q = &dev->queues->queue[qid];
338
339 spin_lock_irqsave(q->lock, q->SavedIrql);
340 321
341 if (qid == AdapHighCmdQueue || qid == AdapNormCmdQueue) 322 if (qid == AdapNormCmdQueue) {
342 {
343 /* if no entries wait for some if caller wants to */ 323 /* if no entries wait for some if caller wants to */
344 while (!aac_get_entry(dev, qid, &entry, index, nonotify)) 324 while (!aac_get_entry(dev, qid, &entry, index, nonotify))
345 { 325 {
@@ -350,9 +330,7 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f
350 */ 330 */
351 entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); 331 entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size));
352 map = 1; 332 map = 1;
353 } 333 } else {
354 else if (qid == AdapHighRespQueue || qid == AdapNormRespQueue)
355 {
356 while(!aac_get_entry(dev, qid, &entry, index, nonotify)) 334 while(!aac_get_entry(dev, qid, &entry, index, nonotify))
357 { 335 {
358 /* if no entries wait for some if caller wants to */ 336 /* if no entries wait for some if caller wants to */
@@ -375,42 +353,6 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f
375 return 0; 353 return 0;
376} 354}
377 355
378
379/**
380 * aac_insert_entry - insert a queue entry
381 * @dev: Adapter
382 * @index: Index of entry to insert
383 * @qid: Queue number
384 * @nonotify: Suppress adapter notification
385 *
386 * Gets the next free QE off the requested priorty adapter command
387 * queue and associates the Fib with the QE. The QE represented by
388 * index is ready to insert on the queue when this routine returns
389 * success.
390 */
391
392static int aac_insert_entry(struct aac_dev * dev, u32 index, u32 qid, unsigned long nonotify)
393{
394 struct aac_queue * q = &dev->queues->queue[qid];
395
396 if(q == NULL)
397 BUG();
398 *(q->headers.producer) = cpu_to_le32(index + 1);
399 spin_unlock_irqrestore(q->lock, q->SavedIrql);
400
401 if (qid == AdapHighCmdQueue ||
402 qid == AdapNormCmdQueue ||
403 qid == AdapHighRespQueue ||
404 qid == AdapNormRespQueue)
405 {
406 if (!nonotify)
407 aac_adapter_notify(dev, qid);
408 }
409 else
410 printk("Suprise insert!\n");
411 return 0;
412}
413
414/* 356/*
415 * Define the highest level of host to adapter communication routines. 357 * Define the highest level of host to adapter communication routines.
416 * These routines will support host to adapter FS commuication. These 358 * These routines will support host to adapter FS commuication. These
@@ -439,12 +381,13 @@ static int aac_insert_entry(struct aac_dev * dev, u32 index, u32 qid, unsigned l
439int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority, int wait, int reply, fib_callback callback, void * callback_data) 381int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority, int wait, int reply, fib_callback callback, void * callback_data)
440{ 382{
441 u32 index; 383 u32 index;
442 u32 qid;
443 struct aac_dev * dev = fibptr->dev; 384 struct aac_dev * dev = fibptr->dev;
444 unsigned long nointr = 0; 385 unsigned long nointr = 0;
445 struct hw_fib * hw_fib = fibptr->hw_fib; 386 struct hw_fib * hw_fib = fibptr->hw_fib;
446 struct aac_queue * q; 387 struct aac_queue * q;
447 unsigned long flags = 0; 388 unsigned long flags = 0;
389 unsigned long qflags;
390
448 if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned))) 391 if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned)))
449 return -EBUSY; 392 return -EBUSY;
450 /* 393 /*
@@ -497,26 +440,8 @@ int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority
497 * Get a queue entry connect the FIB to it and send an notify 440 * Get a queue entry connect the FIB to it and send an notify
498 * the adapter a command is ready. 441 * the adapter a command is ready.
499 */ 442 */
500 if (priority == FsaHigh) { 443 hw_fib->header.XferState |= cpu_to_le32(NormalPriority);
501 hw_fib->header.XferState |= cpu_to_le32(HighPriority);
502 qid = AdapHighCmdQueue;
503 } else {
504 hw_fib->header.XferState |= cpu_to_le32(NormalPriority);
505 qid = AdapNormCmdQueue;
506 }
507 q = &dev->queues->queue[qid];
508 444
509 if(wait)
510 spin_lock_irqsave(&fibptr->event_lock, flags);
511 if(aac_queue_get( dev, &index, qid, hw_fib, 1, fibptr, &nointr)<0)
512 return -EWOULDBLOCK;
513 dprintk((KERN_DEBUG "fib_send: inserting a queue entry at index %d.\n",index));
514 dprintk((KERN_DEBUG "Fib contents:.\n"));
515 dprintk((KERN_DEBUG " Command = %d.\n", hw_fib->header.Command));
516 dprintk((KERN_DEBUG " XferState = %x.\n", hw_fib->header.XferState));
517 dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib));
518 dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa));
519 dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr));
520 /* 445 /*
521 * Fill in the Callback and CallbackContext if we are not 446 * Fill in the Callback and CallbackContext if we are not
522 * going to wait. 447 * going to wait.
@@ -525,22 +450,67 @@ int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority
525 fibptr->callback = callback; 450 fibptr->callback = callback;
526 fibptr->callback_data = callback_data; 451 fibptr->callback_data = callback_data;
527 } 452 }
528 FIB_COUNTER_INCREMENT(aac_config.FibsSent);
529 list_add_tail(&fibptr->queue, &q->pendingq);
530 q->numpending++;
531 453
532 fibptr->done = 0; 454 fibptr->done = 0;
533 fibptr->flags = 0; 455 fibptr->flags = 0;
534 456
535 if(aac_insert_entry(dev, index, qid, (nointr & aac_config.irq_mod)) < 0) 457 FIB_COUNTER_INCREMENT(aac_config.FibsSent);
536 return -EWOULDBLOCK; 458
459 dprintk((KERN_DEBUG "fib_send: inserting a queue entry at index %d.\n",index));
460 dprintk((KERN_DEBUG "Fib contents:.\n"));
461 dprintk((KERN_DEBUG " Command = %d.\n", hw_fib->header.Command));
462 dprintk((KERN_DEBUG " XferState = %x.\n", hw_fib->header.XferState));
463 dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib));
464 dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa));
465 dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr));
466
467 q = &dev->queues->queue[AdapNormCmdQueue];
468
469 if(wait)
470 spin_lock_irqsave(&fibptr->event_lock, flags);
471 spin_lock_irqsave(q->lock, qflags);
472 aac_queue_get( dev, &index, AdapNormCmdQueue, hw_fib, 1, fibptr, &nointr);
473
474 list_add_tail(&fibptr->queue, &q->pendingq);
475 q->numpending++;
476 *(q->headers.producer) = cpu_to_le32(index + 1);
477 spin_unlock_irqrestore(q->lock, qflags);
478 if (!(nointr & aac_config.irq_mod))
479 aac_adapter_notify(dev, AdapNormCmdQueue);
537 /* 480 /*
538 * If the caller wanted us to wait for response wait now. 481 * If the caller wanted us to wait for response wait now.
539 */ 482 */
540 483
541 if (wait) { 484 if (wait) {
542 spin_unlock_irqrestore(&fibptr->event_lock, flags); 485 spin_unlock_irqrestore(&fibptr->event_lock, flags);
543 down(&fibptr->event_wait); 486 /* Only set for first known interruptable command */
487 if (wait < 0) {
488 /*
489 * *VERY* Dangerous to time out a command, the
490 * assumption is made that we have no hope of
491 * functioning because an interrupt routing or other
492 * hardware failure has occurred.
493 */
494 unsigned long count = 36000000L; /* 3 minutes */
495 unsigned long qflags;
496 while (down_trylock(&fibptr->event_wait)) {
497 if (--count == 0) {
498 spin_lock_irqsave(q->lock, qflags);
499 q->numpending--;
500 list_del(&fibptr->queue);
501 spin_unlock_irqrestore(q->lock, qflags);
502 if (wait == -1) {
503 printk(KERN_ERR "aacraid: fib_send: first asynchronous command timed out.\n"
504 "Usually a result of a PCI interrupt routing problem;\n"
505 "update mother board BIOS or consider utilizing one of\n"
506 "the SAFE mode kernel options (acpi, apic etc)\n");
507 }
508 return -ETIMEDOUT;
509 }
510 udelay(5);
511 }
512 } else
513 down(&fibptr->event_wait);
544 if(fibptr->done == 0) 514 if(fibptr->done == 0)
545 BUG(); 515 BUG();
546 516
@@ -622,15 +592,9 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid)
622 case HostNormCmdQueue: 592 case HostNormCmdQueue:
623 notify = HostNormCmdNotFull; 593 notify = HostNormCmdNotFull;
624 break; 594 break;
625 case HostHighCmdQueue:
626 notify = HostHighCmdNotFull;
627 break;
628 case HostNormRespQueue: 595 case HostNormRespQueue:
629 notify = HostNormRespNotFull; 596 notify = HostNormRespNotFull;
630 break; 597 break;
631 case HostHighRespQueue:
632 notify = HostHighRespNotFull;
633 break;
634 default: 598 default:
635 BUG(); 599 BUG();
636 return; 600 return;
@@ -652,9 +616,13 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size)
652{ 616{
653 struct hw_fib * hw_fib = fibptr->hw_fib; 617 struct hw_fib * hw_fib = fibptr->hw_fib;
654 struct aac_dev * dev = fibptr->dev; 618 struct aac_dev * dev = fibptr->dev;
619 struct aac_queue * q;
655 unsigned long nointr = 0; 620 unsigned long nointr = 0;
656 if (hw_fib->header.XferState == 0) 621 unsigned long qflags;
622
623 if (hw_fib->header.XferState == 0) {
657 return 0; 624 return 0;
625 }
658 /* 626 /*
659 * If we plan to do anything check the structure type first. 627 * If we plan to do anything check the structure type first.
660 */ 628 */
@@ -669,37 +637,21 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size)
669 * send the completed cdb to the adapter. 637 * send the completed cdb to the adapter.
670 */ 638 */
671 if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) { 639 if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) {
640 u32 index;
672 hw_fib->header.XferState |= cpu_to_le32(HostProcessed); 641 hw_fib->header.XferState |= cpu_to_le32(HostProcessed);
673 if (hw_fib->header.XferState & cpu_to_le32(HighPriority)) { 642 if (size) {
674 u32 index; 643 size += sizeof(struct aac_fibhdr);
675 if (size) 644 if (size > le16_to_cpu(hw_fib->header.SenderSize))
676 { 645 return -EMSGSIZE;
677 size += sizeof(struct aac_fibhdr); 646 hw_fib->header.Size = cpu_to_le16(size);
678 if (size > le16_to_cpu(hw_fib->header.SenderSize))
679 return -EMSGSIZE;
680 hw_fib->header.Size = cpu_to_le16(size);
681 }
682 if(aac_queue_get(dev, &index, AdapHighRespQueue, hw_fib, 1, NULL, &nointr) < 0) {
683 return -EWOULDBLOCK;
684 }
685 if (aac_insert_entry(dev, index, AdapHighRespQueue, (nointr & (int)aac_config.irq_mod)) != 0) {
686 }
687 } else if (hw_fib->header.XferState &
688 cpu_to_le32(NormalPriority)) {
689 u32 index;
690
691 if (size) {
692 size += sizeof(struct aac_fibhdr);
693 if (size > le16_to_cpu(hw_fib->header.SenderSize))
694 return -EMSGSIZE;
695 hw_fib->header.Size = cpu_to_le16(size);
696 }
697 if (aac_queue_get(dev, &index, AdapNormRespQueue, hw_fib, 1, NULL, &nointr) < 0)
698 return -EWOULDBLOCK;
699 if (aac_insert_entry(dev, index, AdapNormRespQueue, (nointr & (int)aac_config.irq_mod)) != 0)
700 {
701 }
702 } 647 }
648 q = &dev->queues->queue[AdapNormRespQueue];
649 spin_lock_irqsave(q->lock, qflags);
650 aac_queue_get(dev, &index, AdapNormRespQueue, hw_fib, 1, NULL, &nointr);
651 *(q->headers.producer) = cpu_to_le32(index + 1);
652 spin_unlock_irqrestore(q->lock, qflags);
653 if (!(nointr & (int)aac_config.irq_mod))
654 aac_adapter_notify(dev, AdapNormRespQueue);
703 } 655 }
704 else 656 else
705 { 657 {
@@ -791,6 +743,268 @@ void aac_printf(struct aac_dev *dev, u32 val)
791 memset(cp, 0, 256); 743 memset(cp, 0, 256);
792} 744}
793 745
746
747/**
748 * aac_handle_aif - Handle a message from the firmware
749 * @dev: Which adapter this fib is from
750 * @fibptr: Pointer to fibptr from adapter
751 *
752 * This routine handles a driver notify fib from the adapter and
753 * dispatches it to the appropriate routine for handling.
754 */
755
756static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
757{
758 struct hw_fib * hw_fib = fibptr->hw_fib;
759 struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data;
760 int busy;
761 u32 container;
762 struct scsi_device *device;
763 enum {
764 NOTHING,
765 DELETE,
766 ADD,
767 CHANGE
768 } device_config_needed;
769
770 /* Sniff for container changes */
771
772 if (!dev)
773 return;
774 container = (u32)-1;
775
776 /*
777 * We have set this up to try and minimize the number of
778 * re-configures that take place. As a result of this when
779 * certain AIF's come in we will set a flag waiting for another
780 * type of AIF before setting the re-config flag.
781 */
782 switch (le32_to_cpu(aifcmd->command)) {
783 case AifCmdDriverNotify:
784 switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) {
785 /*
786 * Morph or Expand complete
787 */
788 case AifDenMorphComplete:
789 case AifDenVolumeExtendComplete:
790 container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
791 if (container >= dev->maximum_num_containers)
792 break;
793
794 /*
795 * Find the Scsi_Device associated with the SCSI
796 * address. Make sure we have the right array, and if
797 * so set the flag to initiate a new re-config once we
798 * see an AifEnConfigChange AIF come through.
799 */
800
801 if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) {
802 device = scsi_device_lookup(dev->scsi_host_ptr,
803 CONTAINER_TO_CHANNEL(container),
804 CONTAINER_TO_ID(container),
805 CONTAINER_TO_LUN(container));
806 if (device) {
807 dev->fsa_dev[container].config_needed = CHANGE;
808 dev->fsa_dev[container].config_waiting_on = AifEnConfigChange;
809 scsi_device_put(device);
810 }
811 }
812 }
813
814 /*
815 * If we are waiting on something and this happens to be
816 * that thing then set the re-configure flag.
817 */
818 if (container != (u32)-1) {
819 if (container >= dev->maximum_num_containers)
820 break;
821 if (dev->fsa_dev[container].config_waiting_on ==
822 le32_to_cpu(*(u32 *)aifcmd->data))
823 dev->fsa_dev[container].config_waiting_on = 0;
824 } else for (container = 0;
825 container < dev->maximum_num_containers; ++container) {
826 if (dev->fsa_dev[container].config_waiting_on ==
827 le32_to_cpu(*(u32 *)aifcmd->data))
828 dev->fsa_dev[container].config_waiting_on = 0;
829 }
830 break;
831
832 case AifCmdEventNotify:
833 switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) {
834 /*
835 * Add an Array.
836 */
837 case AifEnAddContainer:
838 container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
839 if (container >= dev->maximum_num_containers)
840 break;
841 dev->fsa_dev[container].config_needed = ADD;
842 dev->fsa_dev[container].config_waiting_on =
843 AifEnConfigChange;
844 break;
845
846 /*
847 * Delete an Array.
848 */
849 case AifEnDeleteContainer:
850 container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
851 if (container >= dev->maximum_num_containers)
852 break;
853 dev->fsa_dev[container].config_needed = DELETE;
854 dev->fsa_dev[container].config_waiting_on =
855 AifEnConfigChange;
856 break;
857
858 /*
859 * Container change detected. If we currently are not
860 * waiting on something else, setup to wait on a Config Change.
861 */
862 case AifEnContainerChange:
863 container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
864 if (container >= dev->maximum_num_containers)
865 break;
866 if (dev->fsa_dev[container].config_waiting_on)
867 break;
868 dev->fsa_dev[container].config_needed = CHANGE;
869 dev->fsa_dev[container].config_waiting_on =
870 AifEnConfigChange;
871 break;
872
873 case AifEnConfigChange:
874 break;
875
876 }
877
878 /*
879 * If we are waiting on something and this happens to be
880 * that thing then set the re-configure flag.
881 */
882 if (container != (u32)-1) {
883 if (container >= dev->maximum_num_containers)
884 break;
885 if (dev->fsa_dev[container].config_waiting_on ==
886 le32_to_cpu(*(u32 *)aifcmd->data))
887 dev->fsa_dev[container].config_waiting_on = 0;
888 } else for (container = 0;
889 container < dev->maximum_num_containers; ++container) {
890 if (dev->fsa_dev[container].config_waiting_on ==
891 le32_to_cpu(*(u32 *)aifcmd->data))
892 dev->fsa_dev[container].config_waiting_on = 0;
893 }
894 break;
895
896 case AifCmdJobProgress:
897 /*
898 * These are job progress AIF's. When a Clear is being
899 * done on a container it is initially created then hidden from
900 * the OS. When the clear completes we don't get a config
901 * change so we monitor the job status complete on a clear then
902 * wait for a container change.
903 */
904
905 if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero))
906 && ((((u32 *)aifcmd->data)[6] == ((u32 *)aifcmd->data)[5])
907 || (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess)))) {
908 for (container = 0;
909 container < dev->maximum_num_containers;
910 ++container) {
911 /*
912 * Stomp on all config sequencing for all
913 * containers?
914 */
915 dev->fsa_dev[container].config_waiting_on =
916 AifEnContainerChange;
917 dev->fsa_dev[container].config_needed = ADD;
918 }
919 }
920 if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero))
921 && (((u32 *)aifcmd->data)[6] == 0)
922 && (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning))) {
923 for (container = 0;
924 container < dev->maximum_num_containers;
925 ++container) {
926 /*
927 * Stomp on all config sequencing for all
928 * containers?
929 */
930 dev->fsa_dev[container].config_waiting_on =
931 AifEnContainerChange;
932 dev->fsa_dev[container].config_needed = DELETE;
933 }
934 }
935 break;
936 }
937
938 device_config_needed = NOTHING;
939 for (container = 0; container < dev->maximum_num_containers;
940 ++container) {
941 if ((dev->fsa_dev[container].config_waiting_on == 0)
942 && (dev->fsa_dev[container].config_needed != NOTHING)) {
943 device_config_needed =
944 dev->fsa_dev[container].config_needed;
945 dev->fsa_dev[container].config_needed = NOTHING;
946 break;
947 }
948 }
949 if (device_config_needed == NOTHING)
950 return;
951
952 /*
953 * If we decided that a re-configuration needs to be done,
954 * schedule it here on the way out the door, please close the door
955 * behind you.
956 */
957
958 busy = 0;
959
960
961 /*
962 * Find the Scsi_Device associated with the SCSI address,
963 * and mark it as changed, invalidating the cache. This deals
964 * with changes to existing device IDs.
965 */
966
967 if (!dev || !dev->scsi_host_ptr)
968 return;
969 /*
970 * force reload of disk info via probe_container
971 */
972 if ((device_config_needed == CHANGE)
973 && (dev->fsa_dev[container].valid == 1))
974 dev->fsa_dev[container].valid = 2;
975 if ((device_config_needed == CHANGE) ||
976 (device_config_needed == ADD))
977 probe_container(dev, container);
978 device = scsi_device_lookup(dev->scsi_host_ptr,
979 CONTAINER_TO_CHANNEL(container),
980 CONTAINER_TO_ID(container),
981 CONTAINER_TO_LUN(container));
982 if (device) {
983 switch (device_config_needed) {
984 case DELETE:
985 scsi_remove_device(device);
986 break;
987 case CHANGE:
988 if (!dev->fsa_dev[container].valid) {
989 scsi_remove_device(device);
990 break;
991 }
992 scsi_rescan_device(&device->sdev_gendev);
993
994 default:
995 break;
996 }
997 scsi_device_put(device);
998 }
999 if (device_config_needed == ADD) {
1000 scsi_add_device(dev->scsi_host_ptr,
1001 CONTAINER_TO_CHANNEL(container),
1002 CONTAINER_TO_ID(container),
1003 CONTAINER_TO_LUN(container));
1004 }
1005
1006}
1007
794/** 1008/**
795 * aac_command_thread - command processing thread 1009 * aac_command_thread - command processing thread
796 * @dev: Adapter to monitor 1010 * @dev: Adapter to monitor
@@ -805,7 +1019,6 @@ int aac_command_thread(struct aac_dev * dev)
805{ 1019{
806 struct hw_fib *hw_fib, *hw_newfib; 1020 struct hw_fib *hw_fib, *hw_newfib;
807 struct fib *fib, *newfib; 1021 struct fib *fib, *newfib;
808 struct aac_queue_block *queues = dev->queues;
809 struct aac_fib_context *fibctx; 1022 struct aac_fib_context *fibctx;
810 unsigned long flags; 1023 unsigned long flags;
811 DECLARE_WAITQUEUE(wait, current); 1024 DECLARE_WAITQUEUE(wait, current);
@@ -825,21 +1038,22 @@ int aac_command_thread(struct aac_dev * dev)
825 * Let the DPC know it has a place to send the AIF's to. 1038 * Let the DPC know it has a place to send the AIF's to.
826 */ 1039 */
827 dev->aif_thread = 1; 1040 dev->aif_thread = 1;
828 add_wait_queue(&queues->queue[HostNormCmdQueue].cmdready, &wait); 1041 add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait);
829 set_current_state(TASK_INTERRUPTIBLE); 1042 set_current_state(TASK_INTERRUPTIBLE);
1043 dprintk ((KERN_INFO "aac_command_thread start\n"));
830 while(1) 1044 while(1)
831 { 1045 {
832 spin_lock_irqsave(queues->queue[HostNormCmdQueue].lock, flags); 1046 spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags);
833 while(!list_empty(&(queues->queue[HostNormCmdQueue].cmdq))) { 1047 while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) {
834 struct list_head *entry; 1048 struct list_head *entry;
835 struct aac_aifcmd * aifcmd; 1049 struct aac_aifcmd * aifcmd;
836 1050
837 set_current_state(TASK_RUNNING); 1051 set_current_state(TASK_RUNNING);
838 1052
839 entry = queues->queue[HostNormCmdQueue].cmdq.next; 1053 entry = dev->queues->queue[HostNormCmdQueue].cmdq.next;
840 list_del(entry); 1054 list_del(entry);
841 1055
842 spin_unlock_irqrestore(queues->queue[HostNormCmdQueue].lock, flags); 1056 spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags);
843 fib = list_entry(entry, struct fib, fiblink); 1057 fib = list_entry(entry, struct fib, fiblink);
844 /* 1058 /*
845 * We will process the FIB here or pass it to a 1059 * We will process the FIB here or pass it to a
@@ -860,6 +1074,7 @@ int aac_command_thread(struct aac_dev * dev)
860 aifcmd = (struct aac_aifcmd *) hw_fib->data; 1074 aifcmd = (struct aac_aifcmd *) hw_fib->data;
861 if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) { 1075 if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) {
862 /* Handle Driver Notify Events */ 1076 /* Handle Driver Notify Events */
1077 aac_handle_aif(dev, fib);
863 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); 1078 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK);
864 fib_adapter_complete(fib, (u16)sizeof(u32)); 1079 fib_adapter_complete(fib, (u16)sizeof(u32));
865 } else { 1080 } else {
@@ -869,9 +1084,62 @@ int aac_command_thread(struct aac_dev * dev)
869 1084
870 u32 time_now, time_last; 1085 u32 time_now, time_last;
871 unsigned long flagv; 1086 unsigned long flagv;
872 1087 unsigned num;
1088 struct hw_fib ** hw_fib_pool, ** hw_fib_p;
1089 struct fib ** fib_pool, ** fib_p;
1090
1091 /* Sniff events */
1092 if ((aifcmd->command ==
1093 cpu_to_le32(AifCmdEventNotify)) ||
1094 (aifcmd->command ==
1095 cpu_to_le32(AifCmdJobProgress))) {
1096 aac_handle_aif(dev, fib);
1097 }
1098
873 time_now = jiffies/HZ; 1099 time_now = jiffies/HZ;
874 1100
1101 /*
1102 * Warning: no sleep allowed while
1103 * holding spinlock. We take the estimate
1104 * and pre-allocate a set of fibs outside the
1105 * lock.
1106 */
1107 num = le32_to_cpu(dev->init->AdapterFibsSize)
1108 / sizeof(struct hw_fib); /* some extra */
1109 spin_lock_irqsave(&dev->fib_lock, flagv);
1110 entry = dev->fib_list.next;
1111 while (entry != &dev->fib_list) {
1112 entry = entry->next;
1113 ++num;
1114 }
1115 spin_unlock_irqrestore(&dev->fib_lock, flagv);
1116 hw_fib_pool = NULL;
1117 fib_pool = NULL;
1118 if (num
1119 && ((hw_fib_pool = kmalloc(sizeof(struct hw_fib *) * num, GFP_KERNEL)))
1120 && ((fib_pool = kmalloc(sizeof(struct fib *) * num, GFP_KERNEL)))) {
1121 hw_fib_p = hw_fib_pool;
1122 fib_p = fib_pool;
1123 while (hw_fib_p < &hw_fib_pool[num]) {
1124 if (!(*(hw_fib_p++) = kmalloc(sizeof(struct hw_fib), GFP_KERNEL))) {
1125 --hw_fib_p;
1126 break;
1127 }
1128 if (!(*(fib_p++) = kmalloc(sizeof(struct fib), GFP_KERNEL))) {
1129 kfree(*(--hw_fib_p));
1130 break;
1131 }
1132 }
1133 if ((num = hw_fib_p - hw_fib_pool) == 0) {
1134 kfree(fib_pool);
1135 fib_pool = NULL;
1136 kfree(hw_fib_pool);
1137 hw_fib_pool = NULL;
1138 }
1139 } else if (hw_fib_pool) {
1140 kfree(hw_fib_pool);
1141 hw_fib_pool = NULL;
1142 }
875 spin_lock_irqsave(&dev->fib_lock, flagv); 1143 spin_lock_irqsave(&dev->fib_lock, flagv);
876 entry = dev->fib_list.next; 1144 entry = dev->fib_list.next;
877 /* 1145 /*
@@ -880,6 +1148,8 @@ int aac_command_thread(struct aac_dev * dev)
880 * fib, and then set the event to wake up the 1148 * fib, and then set the event to wake up the
881 * thread that is waiting for it. 1149 * thread that is waiting for it.
882 */ 1150 */
1151 hw_fib_p = hw_fib_pool;
1152 fib_p = fib_pool;
883 while (entry != &dev->fib_list) { 1153 while (entry != &dev->fib_list) {
884 /* 1154 /*
885 * Extract the fibctx 1155 * Extract the fibctx
@@ -912,9 +1182,11 @@ int aac_command_thread(struct aac_dev * dev)
912 * Warning: no sleep allowed while 1182 * Warning: no sleep allowed while
913 * holding spinlock 1183 * holding spinlock
914 */ 1184 */
915 hw_newfib = kmalloc(sizeof(struct hw_fib), GFP_ATOMIC); 1185 if (hw_fib_p < &hw_fib_pool[num]) {
916 newfib = kmalloc(sizeof(struct fib), GFP_ATOMIC); 1186 hw_newfib = *hw_fib_p;
917 if (newfib && hw_newfib) { 1187 *(hw_fib_p++) = NULL;
1188 newfib = *fib_p;
1189 *(fib_p++) = NULL;
918 /* 1190 /*
919 * Make the copy of the FIB 1191 * Make the copy of the FIB
920 */ 1192 */
@@ -929,15 +1201,11 @@ int aac_command_thread(struct aac_dev * dev)
929 fibctx->count++; 1201 fibctx->count++;
930 /* 1202 /*
931 * Set the event to wake up the 1203 * Set the event to wake up the
932 * thread that will waiting. 1204 * thread that is waiting.
933 */ 1205 */
934 up(&fibctx->wait_sem); 1206 up(&fibctx->wait_sem);
935 } else { 1207 } else {
936 printk(KERN_WARNING "aifd: didn't allocate NewFib.\n"); 1208 printk(KERN_WARNING "aifd: didn't allocate NewFib.\n");
937 if(newfib)
938 kfree(newfib);
939 if(hw_newfib)
940 kfree(hw_newfib);
941 } 1209 }
942 entry = entry->next; 1210 entry = entry->next;
943 } 1211 }
@@ -947,21 +1215,38 @@ int aac_command_thread(struct aac_dev * dev)
947 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); 1215 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK);
948 fib_adapter_complete(fib, sizeof(u32)); 1216 fib_adapter_complete(fib, sizeof(u32));
949 spin_unlock_irqrestore(&dev->fib_lock, flagv); 1217 spin_unlock_irqrestore(&dev->fib_lock, flagv);
1218 /* Free up the remaining resources */
1219 hw_fib_p = hw_fib_pool;
1220 fib_p = fib_pool;
1221 while (hw_fib_p < &hw_fib_pool[num]) {
1222 if (*hw_fib_p)
1223 kfree(*hw_fib_p);
1224 if (*fib_p)
1225 kfree(*fib_p);
1226 ++fib_p;
1227 ++hw_fib_p;
1228 }
1229 if (hw_fib_pool)
1230 kfree(hw_fib_pool);
1231 if (fib_pool)
1232 kfree(fib_pool);
950 } 1233 }
951 spin_lock_irqsave(queues->queue[HostNormCmdQueue].lock, flags);
952 kfree(fib); 1234 kfree(fib);
1235 spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags);
953 } 1236 }
954 /* 1237 /*
955 * There are no more AIF's 1238 * There are no more AIF's
956 */ 1239 */
957 spin_unlock_irqrestore(queues->queue[HostNormCmdQueue].lock, flags); 1240 spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags);
958 schedule(); 1241 schedule();
959 1242
960 if(signal_pending(current)) 1243 if(signal_pending(current))
961 break; 1244 break;
962 set_current_state(TASK_INTERRUPTIBLE); 1245 set_current_state(TASK_INTERRUPTIBLE);
963 } 1246 }
964 remove_wait_queue(&queues->queue[HostNormCmdQueue].cmdready, &wait); 1247 if (dev->queues)
1248 remove_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait);
965 dev->aif_thread = 0; 1249 dev->aif_thread = 0;
966 complete_and_exit(&dev->aif_completion, 0); 1250 complete_and_exit(&dev->aif_completion, 0);
1251 return 0;
967} 1252}
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 4ff29d7f5825..de8490a92831 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -748,7 +748,8 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
748 unique_id++; 748 unique_id++;
749 } 749 }
750 750
751 if (pci_enable_device(pdev)) 751 error = pci_enable_device(pdev);
752 if (error)
752 goto out; 753 goto out;
753 754
754 if (pci_set_dma_mask(pdev, 0xFFFFFFFFULL) || 755 if (pci_set_dma_mask(pdev, 0xFFFFFFFFULL) ||
@@ -772,6 +773,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
772 shost->irq = pdev->irq; 773 shost->irq = pdev->irq;
773 shost->base = pci_resource_start(pdev, 0); 774 shost->base = pci_resource_start(pdev, 0);
774 shost->unique_id = unique_id; 775 shost->unique_id = unique_id;
776 shost->max_cmd_len = 16;
775 777
776 aac = (struct aac_dev *)shost->hostdata; 778 aac = (struct aac_dev *)shost->hostdata;
777 aac->scsi_host_ptr = shost; 779 aac->scsi_host_ptr = shost;
@@ -799,7 +801,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
799 goto out_free_fibs; 801 goto out_free_fibs;
800 802
801 aac->maximum_num_channels = aac_drivers[index].channels; 803 aac->maximum_num_channels = aac_drivers[index].channels;
802 aac_get_adapter_info(aac); 804 error = aac_get_adapter_info(aac);
805 if (error < 0)
806 goto out_deinit;
803 807
804 /* 808 /*
805 * Lets override negotiations and drop the maximum SG limit to 34 809 * Lets override negotiations and drop the maximum SG limit to 34
@@ -927,8 +931,8 @@ static int __init aac_init(void)
927 printk(KERN_INFO "Adaptec %s driver (%s)\n", 931 printk(KERN_INFO "Adaptec %s driver (%s)\n",
928 AAC_DRIVERNAME, aac_driver_version); 932 AAC_DRIVERNAME, aac_driver_version);
929 933
930 error = pci_module_init(&aac_pci_driver); 934 error = pci_register_driver(&aac_pci_driver);
931 if (error) 935 if (error < 0)
932 return error; 936 return error;
933 937
934 aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops); 938 aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops);
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c
index 70c5fb59c9ea..d754b3267863 100644
--- a/drivers/scsi/aic7xxx/aic7770_osm.c
+++ b/drivers/scsi/aic7xxx/aic7770_osm.c
@@ -112,6 +112,9 @@ aic7770_remove(struct device *dev)
112 struct ahc_softc *ahc = dev_get_drvdata(dev); 112 struct ahc_softc *ahc = dev_get_drvdata(dev);
113 u_long s; 113 u_long s;
114 114
115 if (ahc->platform_data && ahc->platform_data->host)
116 scsi_remove_host(ahc->platform_data->host);
117
115 ahc_lock(ahc, &s); 118 ahc_lock(ahc, &s);
116 ahc_intr_enable(ahc, FALSE); 119 ahc_intr_enable(ahc, FALSE);
117 ahc_unlock(ahc, &s); 120 ahc_unlock(ahc, &s);
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 6b6d4e287793..95c285cc83e4 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1192,11 +1192,6 @@ ahd_platform_free(struct ahd_softc *ahd)
1192 int i, j; 1192 int i, j;
1193 1193
1194 if (ahd->platform_data != NULL) { 1194 if (ahd->platform_data != NULL) {
1195 if (ahd->platform_data->host != NULL) {
1196 scsi_remove_host(ahd->platform_data->host);
1197 scsi_host_put(ahd->platform_data->host);
1198 }
1199
1200 /* destroy all of the device and target objects */ 1195 /* destroy all of the device and target objects */
1201 for (i = 0; i < AHD_NUM_TARGETS; i++) { 1196 for (i = 0; i < AHD_NUM_TARGETS; i++) {
1202 starget = ahd->platform_data->starget[i]; 1197 starget = ahd->platform_data->starget[i];
@@ -1226,6 +1221,9 @@ ahd_platform_free(struct ahd_softc *ahd)
1226 release_mem_region(ahd->platform_data->mem_busaddr, 1221 release_mem_region(ahd->platform_data->mem_busaddr,
1227 0x1000); 1222 0x1000);
1228 } 1223 }
1224 if (ahd->platform_data->host)
1225 scsi_host_put(ahd->platform_data->host);
1226
1229 free(ahd->platform_data, M_DEVBUF); 1227 free(ahd->platform_data, M_DEVBUF);
1230 } 1228 }
1231} 1229}
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
index 390b53852d4b..bf360ae021ab 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -95,6 +95,9 @@ ahd_linux_pci_dev_remove(struct pci_dev *pdev)
95 struct ahd_softc *ahd = pci_get_drvdata(pdev); 95 struct ahd_softc *ahd = pci_get_drvdata(pdev);
96 u_long s; 96 u_long s;
97 97
98 if (ahd->platform_data && ahd->platform_data->host)
99 scsi_remove_host(ahd->platform_data->host);
100
98 ahd_lock(ahd, &s); 101 ahd_lock(ahd, &s);
99 ahd_intr_enable(ahd, FALSE); 102 ahd_intr_enable(ahd, FALSE);
100 ahd_unlock(ahd, &s); 103 ahd_unlock(ahd, &s);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 876d1de8480d..6ee1435d37fa 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1209,11 +1209,6 @@ ahc_platform_free(struct ahc_softc *ahc)
1209 int i, j; 1209 int i, j;
1210 1210
1211 if (ahc->platform_data != NULL) { 1211 if (ahc->platform_data != NULL) {
1212 if (ahc->platform_data->host != NULL) {
1213 scsi_remove_host(ahc->platform_data->host);
1214 scsi_host_put(ahc->platform_data->host);
1215 }
1216
1217 /* destroy all of the device and target objects */ 1212 /* destroy all of the device and target objects */
1218 for (i = 0; i < AHC_NUM_TARGETS; i++) { 1213 for (i = 0; i < AHC_NUM_TARGETS; i++) {
1219 starget = ahc->platform_data->starget[i]; 1214 starget = ahc->platform_data->starget[i];
@@ -1242,6 +1237,9 @@ ahc_platform_free(struct ahc_softc *ahc)
1242 0x1000); 1237 0x1000);
1243 } 1238 }
1244 1239
1240 if (ahc->platform_data->host)
1241 scsi_host_put(ahc->platform_data->host);
1242
1245 free(ahc->platform_data, M_DEVBUF); 1243 free(ahc->platform_data, M_DEVBUF);
1246 } 1244 }
1247} 1245}
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index 3ce77ddc889e..cb30d9c1153d 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -143,6 +143,9 @@ ahc_linux_pci_dev_remove(struct pci_dev *pdev)
143 struct ahc_softc *ahc = pci_get_drvdata(pdev); 143 struct ahc_softc *ahc = pci_get_drvdata(pdev);
144 u_long s; 144 u_long s;
145 145
146 if (ahc->platform_data && ahc->platform_data->host)
147 scsi_remove_host(ahc->platform_data->host);
148
146 ahc_lock(ahc, &s); 149 ahc_lock(ahc, &s);
147 ahc_intr_enable(ahc, FALSE); 150 ahc_intr_enable(ahc, FALSE);
148 ahc_unlock(ahc, &s); 151 ahc_unlock(ahc, &s);
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index f2a72d33132c..02fe371b0ab8 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -176,6 +176,7 @@ void scsi_remove_host(struct Scsi_Host *shost)
176 transport_unregister_device(&shost->shost_gendev); 176 transport_unregister_device(&shost->shost_gendev);
177 class_device_unregister(&shost->shost_classdev); 177 class_device_unregister(&shost->shost_classdev);
178 device_del(&shost->shost_gendev); 178 device_del(&shost->shost_gendev);
179 scsi_proc_hostdir_rm(shost->hostt);
179} 180}
180EXPORT_SYMBOL(scsi_remove_host); 181EXPORT_SYMBOL(scsi_remove_host);
181 182
@@ -262,7 +263,6 @@ static void scsi_host_dev_release(struct device *dev)
262 if (shost->work_q) 263 if (shost->work_q)
263 destroy_workqueue(shost->work_q); 264 destroy_workqueue(shost->work_q);
264 265
265 scsi_proc_hostdir_rm(shost->hostt);
266 scsi_destroy_command_freelist(shost); 266 scsi_destroy_command_freelist(shost);
267 kfree(shost->shost_data); 267 kfree(shost->shost_data);
268 268
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 86eaf6d408d5..acae7c48ef7d 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -973,10 +973,10 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost)
973 if ((phba->fc_flag & FC_FABRIC) || 973 if ((phba->fc_flag & FC_FABRIC) ||
974 ((phba->fc_topology == TOPOLOGY_LOOP) && 974 ((phba->fc_topology == TOPOLOGY_LOOP) &&
975 (phba->fc_flag & FC_PUBLIC_LOOP))) 975 (phba->fc_flag & FC_PUBLIC_LOOP)))
976 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.wwn); 976 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn);
977 else 977 else
978 /* fabric is local port if there is no F/FL_Port */ 978 /* fabric is local port if there is no F/FL_Port */
979 node_name = wwn_to_u64(phba->fc_nodename.wwn); 979 node_name = wwn_to_u64(phba->fc_nodename.u.wwn);
980 980
981 spin_unlock_irq(shost->host_lock); 981 spin_unlock_irq(shost->host_lock);
982 982
@@ -1110,7 +1110,7 @@ lpfc_get_starget_node_name(struct scsi_target *starget)
1110 /* Search the mapped list for this target ID */ 1110 /* Search the mapped list for this target ID */
1111 list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { 1111 list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
1112 if (starget->id == ndlp->nlp_sid) { 1112 if (starget->id == ndlp->nlp_sid) {
1113 node_name = wwn_to_u64(ndlp->nlp_nodename.wwn); 1113 node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn);
1114 break; 1114 break;
1115 } 1115 }
1116 } 1116 }
@@ -1131,7 +1131,7 @@ lpfc_get_starget_port_name(struct scsi_target *starget)
1131 /* Search the mapped list for this target ID */ 1131 /* Search the mapped list for this target ID */
1132 list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { 1132 list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
1133 if (starget->id == ndlp->nlp_sid) { 1133 if (starget->id == ndlp->nlp_sid) {
1134 port_name = wwn_to_u64(ndlp->nlp_portname.wwn); 1134 port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn);
1135 break; 1135 break;
1136 } 1136 }
1137 } 1137 }
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 4fb8eb0c84cf..56052f4510c3 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1019,8 +1019,8 @@ lpfc_register_remote_port(struct lpfc_hba * phba,
1019 struct fc_rport_identifiers rport_ids; 1019 struct fc_rport_identifiers rport_ids;
1020 1020
1021 /* Remote port has reappeared. Re-register w/ FC transport */ 1021 /* Remote port has reappeared. Re-register w/ FC transport */
1022 rport_ids.node_name = wwn_to_u64(ndlp->nlp_nodename.wwn); 1022 rport_ids.node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn);
1023 rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.wwn); 1023 rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn);
1024 rport_ids.port_id = ndlp->nlp_DID; 1024 rport_ids.port_id = ndlp->nlp_DID;
1025 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; 1025 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
1026 if (ndlp->nlp_type & NLP_FCP_TARGET) 1026 if (ndlp->nlp_type & NLP_FCP_TARGET)
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 047a87c26cc0..86c41981188b 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -280,9 +280,9 @@ struct lpfc_name {
280#define NAME_CCITT_GR_TYPE 0xE 280#define NAME_CCITT_GR_TYPE 0xE
281 uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */ 281 uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */
282 uint8_t IEEE[6]; /* FC IEEE address */ 282 uint8_t IEEE[6]; /* FC IEEE address */
283 }; 283 } s;
284 uint8_t wwn[8]; 284 uint8_t wwn[8];
285 }; 285 } u;
286}; 286};
287 287
288struct csp { 288struct csp {
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 454058f655db..0856ff7d3b33 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -285,7 +285,7 @@ lpfc_config_port_post(struct lpfc_hba * phba)
285 if (phba->SerialNumber[0] == 0) { 285 if (phba->SerialNumber[0] == 0) {
286 uint8_t *outptr; 286 uint8_t *outptr;
287 287
288 outptr = (uint8_t *) & phba->fc_nodename.IEEE[0]; 288 outptr = &phba->fc_nodename.u.s.IEEE[0];
289 for (i = 0; i < 12; i++) { 289 for (i = 0; i < 12; i++) {
290 status = *outptr++; 290 status = *outptr++;
291 j = ((status & 0xf0) >> 4); 291 j = ((status & 0xf0) >> 4);
@@ -1523,8 +1523,8 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1523 * Must done after lpfc_sli_hba_setup() 1523 * Must done after lpfc_sli_hba_setup()
1524 */ 1524 */
1525 1525
1526 fc_host_node_name(host) = wwn_to_u64(phba->fc_nodename.wwn); 1526 fc_host_node_name(host) = wwn_to_u64(phba->fc_nodename.u.wwn);
1527 fc_host_port_name(host) = wwn_to_u64(phba->fc_portname.wwn); 1527 fc_host_port_name(host) = wwn_to_u64(phba->fc_portname.u.wwn);
1528 fc_host_supported_classes(host) = FC_COS_CLASS3; 1528 fc_host_supported_classes(host) = FC_COS_CLASS3;
1529 1529
1530 memset(fc_host_supported_fc4s(host), 0, 1530 memset(fc_host_supported_fc4s(host), 0,
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 6f308ebe3e79..61a6fd810bb4 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -621,8 +621,6 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
621 if(islogical) { 621 if(islogical) {
622 switch (cmd->cmnd[0]) { 622 switch (cmd->cmnd[0]) {
623 case TEST_UNIT_READY: 623 case TEST_UNIT_READY:
624 memset(cmd->request_buffer, 0, cmd->request_bufflen);
625
626#if MEGA_HAVE_CLUSTERING 624#if MEGA_HAVE_CLUSTERING
627 /* 625 /*
628 * Do we support clustering and is the support enabled 626 * Do we support clustering and is the support enabled
@@ -652,11 +650,28 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
652 return NULL; 650 return NULL;
653#endif 651#endif
654 652
655 case MODE_SENSE: 653 case MODE_SENSE: {
654 char *buf;
655
656 if (cmd->use_sg) {
657 struct scatterlist *sg;
658
659 sg = (struct scatterlist *)cmd->request_buffer;
660 buf = kmap_atomic(sg->page, KM_IRQ0) +
661 sg->offset;
662 } else
663 buf = cmd->request_buffer;
656 memset(cmd->request_buffer, 0, cmd->cmnd[4]); 664 memset(cmd->request_buffer, 0, cmd->cmnd[4]);
665 if (cmd->use_sg) {
666 struct scatterlist *sg;
667
668 sg = (struct scatterlist *)cmd->request_buffer;
669 kunmap_atomic(buf - sg->offset, KM_IRQ0);
670 }
657 cmd->result = (DID_OK << 16); 671 cmd->result = (DID_OK << 16);
658 cmd->scsi_done(cmd); 672 cmd->scsi_done(cmd);
659 return NULL; 673 return NULL;
674 }
660 675
661 case READ_CAPACITY: 676 case READ_CAPACITY:
662 case INQUIRY: 677 case INQUIRY:
@@ -1685,14 +1700,23 @@ mega_rundoneq (adapter_t *adapter)
1685static void 1700static void
1686mega_free_scb(adapter_t *adapter, scb_t *scb) 1701mega_free_scb(adapter_t *adapter, scb_t *scb)
1687{ 1702{
1703 unsigned long length;
1704
1688 switch( scb->dma_type ) { 1705 switch( scb->dma_type ) {
1689 1706
1690 case MEGA_DMA_TYPE_NONE: 1707 case MEGA_DMA_TYPE_NONE:
1691 break; 1708 break;
1692 1709
1693 case MEGA_BULK_DATA: 1710 case MEGA_BULK_DATA:
1711 if (scb->cmd->use_sg == 0)
1712 length = scb->cmd->request_bufflen;
1713 else {
1714 struct scatterlist *sgl =
1715 (struct scatterlist *)scb->cmd->request_buffer;
1716 length = sgl->length;
1717 }
1694 pci_unmap_page(adapter->dev, scb->dma_h_bulkdata, 1718 pci_unmap_page(adapter->dev, scb->dma_h_bulkdata,
1695 scb->cmd->request_bufflen, scb->dma_direction); 1719 length, scb->dma_direction);
1696 break; 1720 break;
1697 1721
1698 case MEGA_SGLIST: 1722 case MEGA_SGLIST:
@@ -1741,6 +1765,7 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len)
1741 struct scatterlist *sgl; 1765 struct scatterlist *sgl;
1742 struct page *page; 1766 struct page *page;
1743 unsigned long offset; 1767 unsigned long offset;
1768 unsigned int length;
1744 Scsi_Cmnd *cmd; 1769 Scsi_Cmnd *cmd;
1745 int sgcnt; 1770 int sgcnt;
1746 int idx; 1771 int idx;
@@ -1748,14 +1773,23 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len)
1748 cmd = scb->cmd; 1773 cmd = scb->cmd;
1749 1774
1750 /* Scatter-gather not used */ 1775 /* Scatter-gather not used */
1751 if( !cmd->use_sg ) { 1776 if( cmd->use_sg == 0 || (cmd->use_sg == 1 &&
1752 1777 !adapter->has_64bit_addr)) {
1753 page = virt_to_page(cmd->request_buffer); 1778
1754 offset = offset_in_page(cmd->request_buffer); 1779 if (cmd->use_sg == 0) {
1780 page = virt_to_page(cmd->request_buffer);
1781 offset = offset_in_page(cmd->request_buffer);
1782 length = cmd->request_bufflen;
1783 } else {
1784 sgl = (struct scatterlist *)cmd->request_buffer;
1785 page = sgl->page;
1786 offset = sgl->offset;
1787 length = sgl->length;
1788 }
1755 1789
1756 scb->dma_h_bulkdata = pci_map_page(adapter->dev, 1790 scb->dma_h_bulkdata = pci_map_page(adapter->dev,
1757 page, offset, 1791 page, offset,
1758 cmd->request_bufflen, 1792 length,
1759 scb->dma_direction); 1793 scb->dma_direction);
1760 scb->dma_type = MEGA_BULK_DATA; 1794 scb->dma_type = MEGA_BULK_DATA;
1761 1795
@@ -1765,14 +1799,14 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len)
1765 */ 1799 */
1766 if( adapter->has_64bit_addr ) { 1800 if( adapter->has_64bit_addr ) {
1767 scb->sgl64[0].address = scb->dma_h_bulkdata; 1801 scb->sgl64[0].address = scb->dma_h_bulkdata;
1768 scb->sgl64[0].length = cmd->request_bufflen; 1802 scb->sgl64[0].length = length;
1769 *buf = (u32)scb->sgl_dma_addr; 1803 *buf = (u32)scb->sgl_dma_addr;
1770 *len = (u32)cmd->request_bufflen; 1804 *len = (u32)length;
1771 return 1; 1805 return 1;
1772 } 1806 }
1773 else { 1807 else {
1774 *buf = (u32)scb->dma_h_bulkdata; 1808 *buf = (u32)scb->dma_h_bulkdata;
1775 *len = (u32)cmd->request_bufflen; 1809 *len = (u32)length;
1776 } 1810 }
1777 return 0; 1811 return 0;
1778 } 1812 }
@@ -1791,27 +1825,23 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len)
1791 1825
1792 if( sgcnt > adapter->sglen ) BUG(); 1826 if( sgcnt > adapter->sglen ) BUG();
1793 1827
1828 *len = 0;
1829
1794 for( idx = 0; idx < sgcnt; idx++, sgl++ ) { 1830 for( idx = 0; idx < sgcnt; idx++, sgl++ ) {
1795 1831
1796 if( adapter->has_64bit_addr ) { 1832 if( adapter->has_64bit_addr ) {
1797 scb->sgl64[idx].address = sg_dma_address(sgl); 1833 scb->sgl64[idx].address = sg_dma_address(sgl);
1798 scb->sgl64[idx].length = sg_dma_len(sgl); 1834 *len += scb->sgl64[idx].length = sg_dma_len(sgl);
1799 } 1835 }
1800 else { 1836 else {
1801 scb->sgl[idx].address = sg_dma_address(sgl); 1837 scb->sgl[idx].address = sg_dma_address(sgl);
1802 scb->sgl[idx].length = sg_dma_len(sgl); 1838 *len += scb->sgl[idx].length = sg_dma_len(sgl);
1803 } 1839 }
1804 } 1840 }
1805 1841
1806 /* Reset pointer and length fields */ 1842 /* Reset pointer and length fields */
1807 *buf = scb->sgl_dma_addr; 1843 *buf = scb->sgl_dma_addr;
1808 1844
1809 /*
1810 * For passthru command, dataxferlen must be set, even for commands
1811 * with a sg list
1812 */
1813 *len = (u32)cmd->request_bufflen;
1814
1815 /* Return count of SG requests */ 1845 /* Return count of SG requests */
1816 return sgcnt; 1846 return sgcnt;
1817} 1847}
diff --git a/drivers/scsi/megaraid/Kconfig.megaraid b/drivers/scsi/megaraid/Kconfig.megaraid
index 917d591d90b2..7363e12663ac 100644
--- a/drivers/scsi/megaraid/Kconfig.megaraid
+++ b/drivers/scsi/megaraid/Kconfig.megaraid
@@ -76,3 +76,12 @@ config MEGARAID_LEGACY
76 To compile this driver as a module, choose M here: the 76 To compile this driver as a module, choose M here: the
77 module will be called megaraid 77 module will be called megaraid
78endif 78endif
79
80config MEGARAID_SAS
81 tristate "LSI Logic MegaRAID SAS RAID Module"
82 depends on PCI && SCSI
83 help
84 Module for LSI Logic's SAS based RAID controllers.
85 To compile this driver as a module, choose 'm' here.
86 Module will be called megaraid_sas
87
diff --git a/drivers/scsi/megaraid/Makefile b/drivers/scsi/megaraid/Makefile
index 6dd99f275722..f469915b97c3 100644
--- a/drivers/scsi/megaraid/Makefile
+++ b/drivers/scsi/megaraid/Makefile
@@ -1,2 +1,3 @@
1obj-$(CONFIG_MEGARAID_MM) += megaraid_mm.o 1obj-$(CONFIG_MEGARAID_MM) += megaraid_mm.o
2obj-$(CONFIG_MEGARAID_MAILBOX) += megaraid_mbox.o 2obj-$(CONFIG_MEGARAID_MAILBOX) += megaraid_mbox.o
3obj-$(CONFIG_MEGARAID_SAS) += megaraid_sas.o
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
new file mode 100644
index 000000000000..c3f637395734
--- /dev/null
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -0,0 +1,2806 @@
1/*
2 *
3 * Linux MegaRAID driver for SAS based RAID controllers
4 *
5 * Copyright (c) 2003-2005 LSI Logic Corporation.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * FILE : megaraid_sas.c
13 * Version : v00.00.02.00-rc4
14 *
15 * Authors:
16 * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com>
17 * Sumant Patro <Sumant.Patro@lsil.com>
18 *
19 * List of supported controllers
20 *
21 * OEM Product Name VID DID SSVID SSID
22 * --- ------------ --- --- ---- ----
23 */
24
25#include <linux/kernel.h>
26#include <linux/types.h>
27#include <linux/pci.h>
28#include <linux/list.h>
29#include <linux/version.h>
30#include <linux/moduleparam.h>
31#include <linux/module.h>
32#include <linux/spinlock.h>
33#include <linux/interrupt.h>
34#include <linux/delay.h>
35#include <linux/uio.h>
36#include <asm/uaccess.h>
37#include <linux/fs.h>
38#include <linux/compat.h>
39
40#include <scsi/scsi.h>
41#include <scsi/scsi_cmnd.h>
42#include <scsi/scsi_device.h>
43#include <scsi/scsi_host.h>
44#include "megaraid_sas.h"
45
46MODULE_LICENSE("GPL");
47MODULE_VERSION(MEGASAS_VERSION);
48MODULE_AUTHOR("sreenivas.bagalkote@lsil.com");
49MODULE_DESCRIPTION("LSI Logic MegaRAID SAS Driver");
50
51/*
52 * PCI ID table for all supported controllers
53 */
54static struct pci_device_id megasas_pci_table[] = {
55
56 {
57 PCI_VENDOR_ID_LSI_LOGIC,
58 PCI_DEVICE_ID_LSI_SAS1064R,
59 PCI_ANY_ID,
60 PCI_ANY_ID,
61 },
62 {
63 PCI_VENDOR_ID_DELL,
64 PCI_DEVICE_ID_DELL_PERC5,
65 PCI_ANY_ID,
66 PCI_ANY_ID,
67 },
68 {0} /* Terminating entry */
69};
70
71MODULE_DEVICE_TABLE(pci, megasas_pci_table);
72
73static int megasas_mgmt_majorno;
74static struct megasas_mgmt_info megasas_mgmt_info;
75static struct fasync_struct *megasas_async_queue;
76static DECLARE_MUTEX(megasas_async_queue_mutex);
77
78/**
79 * megasas_get_cmd - Get a command from the free pool
80 * @instance: Adapter soft state
81 *
82 * Returns a free command from the pool
83 */
84static inline struct megasas_cmd *megasas_get_cmd(struct megasas_instance
85 *instance)
86{
87 unsigned long flags;
88 struct megasas_cmd *cmd = NULL;
89
90 spin_lock_irqsave(&instance->cmd_pool_lock, flags);
91
92 if (!list_empty(&instance->cmd_pool)) {
93 cmd = list_entry((&instance->cmd_pool)->next,
94 struct megasas_cmd, list);
95 list_del_init(&cmd->list);
96 } else {
97 printk(KERN_ERR "megasas: Command pool empty!\n");
98 }
99
100 spin_unlock_irqrestore(&instance->cmd_pool_lock, flags);
101 return cmd;
102}
103
104/**
105 * megasas_return_cmd - Return a cmd to free command pool
106 * @instance: Adapter soft state
107 * @cmd: Command packet to be returned to free command pool
108 */
109static inline void
110megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd)
111{
112 unsigned long flags;
113
114 spin_lock_irqsave(&instance->cmd_pool_lock, flags);
115
116 cmd->scmd = NULL;
117 list_add_tail(&cmd->list, &instance->cmd_pool);
118
119 spin_unlock_irqrestore(&instance->cmd_pool_lock, flags);
120}
121
122/**
123 * megasas_enable_intr - Enables interrupts
124 * @regs: MFI register set
125 */
126static inline void
127megasas_enable_intr(struct megasas_register_set __iomem * regs)
128{
129 writel(1, &(regs)->outbound_intr_mask);
130
131 /* Dummy readl to force pci flush */
132 readl(&regs->outbound_intr_mask);
133}
134
135/**
136 * megasas_disable_intr - Disables interrupts
137 * @regs: MFI register set
138 */
139static inline void
140megasas_disable_intr(struct megasas_register_set __iomem * regs)
141{
142 u32 mask = readl(&regs->outbound_intr_mask) & (~0x00000001);
143 writel(mask, &regs->outbound_intr_mask);
144
145 /* Dummy readl to force pci flush */
146 readl(&regs->outbound_intr_mask);
147}
148
149/**
150 * megasas_issue_polled - Issues a polling command
151 * @instance: Adapter soft state
152 * @cmd: Command packet to be issued
153 *
154 * For polling, MFI requires the cmd_status to be set to 0xFF before posting.
155 */
156static int
157megasas_issue_polled(struct megasas_instance *instance, struct megasas_cmd *cmd)
158{
159 int i;
160 u32 msecs = MFI_POLL_TIMEOUT_SECS * 1000;
161
162 struct megasas_header *frame_hdr = &cmd->frame->hdr;
163
164 frame_hdr->cmd_status = 0xFF;
165 frame_hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE;
166
167 /*
168 * Issue the frame using inbound queue port
169 */
170 writel(cmd->frame_phys_addr >> 3,
171 &instance->reg_set->inbound_queue_port);
172
173 /*
174 * Wait for cmd_status to change
175 */
176 for (i = 0; (i < msecs) && (frame_hdr->cmd_status == 0xff); i++) {
177 rmb();
178 msleep(1);
179 }
180
181 if (frame_hdr->cmd_status == 0xff)
182 return -ETIME;
183
184 return 0;
185}
186
187/**
188 * megasas_issue_blocked_cmd - Synchronous wrapper around regular FW cmds
189 * @instance: Adapter soft state
190 * @cmd: Command to be issued
191 *
192 * This function waits on an event for the command to be returned from ISR.
193 * Used to issue ioctl commands.
194 */
195static int
196megasas_issue_blocked_cmd(struct megasas_instance *instance,
197 struct megasas_cmd *cmd)
198{
199 cmd->cmd_status = ENODATA;
200
201 writel(cmd->frame_phys_addr >> 3,
202 &instance->reg_set->inbound_queue_port);
203
204 wait_event(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA));
205
206 return 0;
207}
208
209/**
210 * megasas_issue_blocked_abort_cmd - Aborts previously issued cmd
211 * @instance: Adapter soft state
212 * @cmd_to_abort: Previously issued cmd to be aborted
213 *
214 * MFI firmware can abort previously issued AEN comamnd (automatic event
215 * notification). The megasas_issue_blocked_abort_cmd() issues such abort
216 * cmd and blocks till it is completed.
217 */
218static int
219megasas_issue_blocked_abort_cmd(struct megasas_instance *instance,
220 struct megasas_cmd *cmd_to_abort)
221{
222 struct megasas_cmd *cmd;
223 struct megasas_abort_frame *abort_fr;
224
225 cmd = megasas_get_cmd(instance);
226
227 if (!cmd)
228 return -1;
229
230 abort_fr = &cmd->frame->abort;
231
232 /*
233 * Prepare and issue the abort frame
234 */
235 abort_fr->cmd = MFI_CMD_ABORT;
236 abort_fr->cmd_status = 0xFF;
237 abort_fr->flags = 0;
238 abort_fr->abort_context = cmd_to_abort->index;
239 abort_fr->abort_mfi_phys_addr_lo = cmd_to_abort->frame_phys_addr;
240 abort_fr->abort_mfi_phys_addr_hi = 0;
241
242 cmd->sync_cmd = 1;
243 cmd->cmd_status = 0xFF;
244
245 writel(cmd->frame_phys_addr >> 3,
246 &instance->reg_set->inbound_queue_port);
247
248 /*
249 * Wait for this cmd to complete
250 */
251 wait_event(instance->abort_cmd_wait_q, (cmd->cmd_status != 0xFF));
252
253 megasas_return_cmd(instance, cmd);
254 return 0;
255}
256
257/**
258 * megasas_make_sgl32 - Prepares 32-bit SGL
259 * @instance: Adapter soft state
260 * @scp: SCSI command from the mid-layer
261 * @mfi_sgl: SGL to be filled in
262 *
263 * If successful, this function returns the number of SG elements. Otherwise,
264 * it returnes -1.
265 */
266static inline int
267megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp,
268 union megasas_sgl *mfi_sgl)
269{
270 int i;
271 int sge_count;
272 struct scatterlist *os_sgl;
273
274 /*
275 * Return 0 if there is no data transfer
276 */
277 if (!scp->request_buffer || !scp->request_bufflen)
278 return 0;
279
280 if (!scp->use_sg) {
281 mfi_sgl->sge32[0].phys_addr = pci_map_single(instance->pdev,
282 scp->
283 request_buffer,
284 scp->
285 request_bufflen,
286 scp->
287 sc_data_direction);
288 mfi_sgl->sge32[0].length = scp->request_bufflen;
289
290 return 1;
291 }
292
293 os_sgl = (struct scatterlist *)scp->request_buffer;
294 sge_count = pci_map_sg(instance->pdev, os_sgl, scp->use_sg,
295 scp->sc_data_direction);
296
297 for (i = 0; i < sge_count; i++, os_sgl++) {
298 mfi_sgl->sge32[i].length = sg_dma_len(os_sgl);
299 mfi_sgl->sge32[i].phys_addr = sg_dma_address(os_sgl);
300 }
301
302 return sge_count;
303}
304
305/**
306 * megasas_make_sgl64 - Prepares 64-bit SGL
307 * @instance: Adapter soft state
308 * @scp: SCSI command from the mid-layer
309 * @mfi_sgl: SGL to be filled in
310 *
311 * If successful, this function returns the number of SG elements. Otherwise,
312 * it returnes -1.
313 */
314static inline int
315megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp,
316 union megasas_sgl *mfi_sgl)
317{
318 int i;
319 int sge_count;
320 struct scatterlist *os_sgl;
321
322 /*
323 * Return 0 if there is no data transfer
324 */
325 if (!scp->request_buffer || !scp->request_bufflen)
326 return 0;
327
328 if (!scp->use_sg) {
329 mfi_sgl->sge64[0].phys_addr = pci_map_single(instance->pdev,
330 scp->
331 request_buffer,
332 scp->
333 request_bufflen,
334 scp->
335 sc_data_direction);
336
337 mfi_sgl->sge64[0].length = scp->request_bufflen;
338
339 return 1;
340 }
341
342 os_sgl = (struct scatterlist *)scp->request_buffer;
343 sge_count = pci_map_sg(instance->pdev, os_sgl, scp->use_sg,
344 scp->sc_data_direction);
345
346 for (i = 0; i < sge_count; i++, os_sgl++) {
347 mfi_sgl->sge64[i].length = sg_dma_len(os_sgl);
348 mfi_sgl->sge64[i].phys_addr = sg_dma_address(os_sgl);
349 }
350
351 return sge_count;
352}
353
354/**
355 * megasas_build_dcdb - Prepares a direct cdb (DCDB) command
356 * @instance: Adapter soft state
357 * @scp: SCSI command
358 * @cmd: Command to be prepared in
359 *
360 * This function prepares CDB commands. These are typcially pass-through
361 * commands to the devices.
362 */
363static inline int
364megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
365 struct megasas_cmd *cmd)
366{
367 u32 sge_sz;
368 int sge_bytes;
369 u32 is_logical;
370 u32 device_id;
371 u16 flags = 0;
372 struct megasas_pthru_frame *pthru;
373
374 is_logical = MEGASAS_IS_LOGICAL(scp);
375 device_id = MEGASAS_DEV_INDEX(instance, scp);
376 pthru = (struct megasas_pthru_frame *)cmd->frame;
377
378 if (scp->sc_data_direction == PCI_DMA_TODEVICE)
379 flags = MFI_FRAME_DIR_WRITE;
380 else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)
381 flags = MFI_FRAME_DIR_READ;
382 else if (scp->sc_data_direction == PCI_DMA_NONE)
383 flags = MFI_FRAME_DIR_NONE;
384
385 /*
386 * Prepare the DCDB frame
387 */
388 pthru->cmd = (is_logical) ? MFI_CMD_LD_SCSI_IO : MFI_CMD_PD_SCSI_IO;
389 pthru->cmd_status = 0x0;
390 pthru->scsi_status = 0x0;
391 pthru->target_id = device_id;
392 pthru->lun = scp->device->lun;
393 pthru->cdb_len = scp->cmd_len;
394 pthru->timeout = 0;
395 pthru->flags = flags;
396 pthru->data_xfer_len = scp->request_bufflen;
397
398 memcpy(pthru->cdb, scp->cmnd, scp->cmd_len);
399
400 /*
401 * Construct SGL
402 */
403 sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) :
404 sizeof(struct megasas_sge32);
405
406 if (IS_DMA64) {
407 pthru->flags |= MFI_FRAME_SGL64;
408 pthru->sge_count = megasas_make_sgl64(instance, scp,
409 &pthru->sgl);
410 } else
411 pthru->sge_count = megasas_make_sgl32(instance, scp,
412 &pthru->sgl);
413
414 /*
415 * Sense info specific
416 */
417 pthru->sense_len = SCSI_SENSE_BUFFERSIZE;
418 pthru->sense_buf_phys_addr_hi = 0;
419 pthru->sense_buf_phys_addr_lo = cmd->sense_phys_addr;
420
421 sge_bytes = sge_sz * pthru->sge_count;
422
423 /*
424 * Compute the total number of frames this command consumes. FW uses
425 * this number to pull sufficient number of frames from host memory.
426 */
427 cmd->frame_count = (sge_bytes / MEGAMFI_FRAME_SIZE) +
428 ((sge_bytes % MEGAMFI_FRAME_SIZE) ? 1 : 0) + 1;
429
430 if (cmd->frame_count > 7)
431 cmd->frame_count = 8;
432
433 return cmd->frame_count;
434}
435
436/**
437 * megasas_build_ldio - Prepares IOs to logical devices
438 * @instance: Adapter soft state
439 * @scp: SCSI command
440 * @cmd: Command to to be prepared
441 *
442 * Frames (and accompanying SGLs) for regular SCSI IOs use this function.
443 */
444static inline int
445megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp,
446 struct megasas_cmd *cmd)
447{
448 u32 sge_sz;
449 int sge_bytes;
450 u32 device_id;
451 u8 sc = scp->cmnd[0];
452 u16 flags = 0;
453 struct megasas_io_frame *ldio;
454
455 device_id = MEGASAS_DEV_INDEX(instance, scp);
456 ldio = (struct megasas_io_frame *)cmd->frame;
457
458 if (scp->sc_data_direction == PCI_DMA_TODEVICE)
459 flags = MFI_FRAME_DIR_WRITE;
460 else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)
461 flags = MFI_FRAME_DIR_READ;
462
463 /*
464 * Preare the Logical IO frame: 2nd bit is zero for all read cmds
465 */
466 ldio->cmd = (sc & 0x02) ? MFI_CMD_LD_WRITE : MFI_CMD_LD_READ;
467 ldio->cmd_status = 0x0;
468 ldio->scsi_status = 0x0;
469 ldio->target_id = device_id;
470 ldio->timeout = 0;
471 ldio->reserved_0 = 0;
472 ldio->pad_0 = 0;
473 ldio->flags = flags;
474 ldio->start_lba_hi = 0;
475 ldio->access_byte = (scp->cmd_len != 6) ? scp->cmnd[1] : 0;
476
477 /*
478 * 6-byte READ(0x08) or WRITE(0x0A) cdb
479 */
480 if (scp->cmd_len == 6) {
481 ldio->lba_count = (u32) scp->cmnd[4];
482 ldio->start_lba_lo = ((u32) scp->cmnd[1] << 16) |
483 ((u32) scp->cmnd[2] << 8) | (u32) scp->cmnd[3];
484
485 ldio->start_lba_lo &= 0x1FFFFF;
486 }
487
488 /*
489 * 10-byte READ(0x28) or WRITE(0x2A) cdb
490 */
491 else if (scp->cmd_len == 10) {
492 ldio->lba_count = (u32) scp->cmnd[8] |
493 ((u32) scp->cmnd[7] << 8);
494 ldio->start_lba_lo = ((u32) scp->cmnd[2] << 24) |
495 ((u32) scp->cmnd[3] << 16) |
496 ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5];
497 }
498
499 /*
500 * 12-byte READ(0xA8) or WRITE(0xAA) cdb
501 */
502 else if (scp->cmd_len == 12) {
503 ldio->lba_count = ((u32) scp->cmnd[6] << 24) |
504 ((u32) scp->cmnd[7] << 16) |
505 ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9];
506
507 ldio->start_lba_lo = ((u32) scp->cmnd[2] << 24) |
508 ((u32) scp->cmnd[3] << 16) |
509 ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5];
510 }
511
512 /*
513 * 16-byte READ(0x88) or WRITE(0x8A) cdb
514 */
515 else if (scp->cmd_len == 16) {
516 ldio->lba_count = ((u32) scp->cmnd[10] << 24) |
517 ((u32) scp->cmnd[11] << 16) |
518 ((u32) scp->cmnd[12] << 8) | (u32) scp->cmnd[13];
519
520 ldio->start_lba_lo = ((u32) scp->cmnd[6] << 24) |
521 ((u32) scp->cmnd[7] << 16) |
522 ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9];
523
524 ldio->start_lba_hi = ((u32) scp->cmnd[2] << 24) |
525 ((u32) scp->cmnd[3] << 16) |
526 ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5];
527
528 }
529
530 /*
531 * Construct SGL
532 */
533 sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) :
534 sizeof(struct megasas_sge32);
535
536 if (IS_DMA64) {
537 ldio->flags |= MFI_FRAME_SGL64;
538 ldio->sge_count = megasas_make_sgl64(instance, scp, &ldio->sgl);
539 } else
540 ldio->sge_count = megasas_make_sgl32(instance, scp, &ldio->sgl);
541
542 /*
543 * Sense info specific
544 */
545 ldio->sense_len = SCSI_SENSE_BUFFERSIZE;
546 ldio->sense_buf_phys_addr_hi = 0;
547 ldio->sense_buf_phys_addr_lo = cmd->sense_phys_addr;
548
549 sge_bytes = sge_sz * ldio->sge_count;
550
551 cmd->frame_count = (sge_bytes / MEGAMFI_FRAME_SIZE) +
552 ((sge_bytes % MEGAMFI_FRAME_SIZE) ? 1 : 0) + 1;
553
554 if (cmd->frame_count > 7)
555 cmd->frame_count = 8;
556
557 return cmd->frame_count;
558}
559
560/**
561 * megasas_build_cmd - Prepares a command packet
562 * @instance: Adapter soft state
563 * @scp: SCSI command
564 * @frame_count: [OUT] Number of frames used to prepare this command
565 */
566static inline struct megasas_cmd *megasas_build_cmd(struct megasas_instance
567 *instance,
568 struct scsi_cmnd *scp,
569 int *frame_count)
570{
571 u32 logical_cmd;
572 struct megasas_cmd *cmd;
573
574 /*
575 * Find out if this is logical or physical drive command.
576 */
577 logical_cmd = MEGASAS_IS_LOGICAL(scp);
578
579 /*
580 * Logical drive command
581 */
582 if (logical_cmd) {
583
584 if (scp->device->id >= MEGASAS_MAX_LD) {
585 scp->result = DID_BAD_TARGET << 16;
586 return NULL;
587 }
588
589 switch (scp->cmnd[0]) {
590
591 case READ_10:
592 case WRITE_10:
593 case READ_12:
594 case WRITE_12:
595 case READ_6:
596 case WRITE_6:
597 case READ_16:
598 case WRITE_16:
599 /*
600 * Fail for LUN > 0
601 */
602 if (scp->device->lun) {
603 scp->result = DID_BAD_TARGET << 16;
604 return NULL;
605 }
606
607 cmd = megasas_get_cmd(instance);
608
609 if (!cmd) {
610 scp->result = DID_IMM_RETRY << 16;
611 return NULL;
612 }
613
614 *frame_count = megasas_build_ldio(instance, scp, cmd);
615
616 if (!(*frame_count)) {
617 megasas_return_cmd(instance, cmd);
618 return NULL;
619 }
620
621 return cmd;
622
623 default:
624 /*
625 * Fail for LUN > 0
626 */
627 if (scp->device->lun) {
628 scp->result = DID_BAD_TARGET << 16;
629 return NULL;
630 }
631
632 cmd = megasas_get_cmd(instance);
633
634 if (!cmd) {
635 scp->result = DID_IMM_RETRY << 16;
636 return NULL;
637 }
638
639 *frame_count = megasas_build_dcdb(instance, scp, cmd);
640
641 if (!(*frame_count)) {
642 megasas_return_cmd(instance, cmd);
643 return NULL;
644 }
645
646 return cmd;
647 }
648 } else {
649 cmd = megasas_get_cmd(instance);
650
651 if (!cmd) {
652 scp->result = DID_IMM_RETRY << 16;
653 return NULL;
654 }
655
656 *frame_count = megasas_build_dcdb(instance, scp, cmd);
657
658 if (!(*frame_count)) {
659 megasas_return_cmd(instance, cmd);
660 return NULL;
661 }
662
663 return cmd;
664 }
665
666 return NULL;
667}
668
669/**
670 * megasas_queue_command - Queue entry point
671 * @scmd: SCSI command to be queued
672 * @done: Callback entry point
673 */
674static int
675megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
676{
677 u32 frame_count;
678 unsigned long flags;
679 struct megasas_cmd *cmd;
680 struct megasas_instance *instance;
681
682 instance = (struct megasas_instance *)
683 scmd->device->host->hostdata;
684 scmd->scsi_done = done;
685 scmd->result = 0;
686
687 cmd = megasas_build_cmd(instance, scmd, &frame_count);
688
689 if (!cmd) {
690 done(scmd);
691 return 0;
692 }
693
694 cmd->scmd = scmd;
695 scmd->SCp.ptr = (char *)cmd;
696 scmd->SCp.sent_command = jiffies;
697
698 /*
699 * Issue the command to the FW
700 */
701 spin_lock_irqsave(&instance->instance_lock, flags);
702 instance->fw_outstanding++;
703 spin_unlock_irqrestore(&instance->instance_lock, flags);
704
705 writel(((cmd->frame_phys_addr >> 3) | (cmd->frame_count - 1)),
706 &instance->reg_set->inbound_queue_port);
707
708 return 0;
709}
710
711/**
712 * megasas_wait_for_outstanding - Wait for all outstanding cmds
713 * @instance: Adapter soft state
714 *
715 * This function waits for upto MEGASAS_RESET_WAIT_TIME seconds for FW to
716 * complete all its outstanding commands. Returns error if one or more IOs
717 * are pending after this time period. It also marks the controller dead.
718 */
719static int megasas_wait_for_outstanding(struct megasas_instance *instance)
720{
721 int i;
722 u32 wait_time = MEGASAS_RESET_WAIT_TIME;
723
724 for (i = 0; i < wait_time; i++) {
725
726 if (!instance->fw_outstanding)
727 break;
728
729 if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
730 printk(KERN_NOTICE "megasas: [%2d]waiting for %d "
731 "commands to complete\n", i,
732 instance->fw_outstanding);
733 }
734
735 msleep(1000);
736 }
737
738 if (instance->fw_outstanding) {
739 instance->hw_crit_error = 1;
740 return FAILED;
741 }
742
743 return SUCCESS;
744}
745
746/**
747 * megasas_generic_reset - Generic reset routine
748 * @scmd: Mid-layer SCSI command
749 *
750 * This routine implements a generic reset handler for device, bus and host
751 * reset requests. Device, bus and host specific reset handlers can use this
752 * function after they do their specific tasks.
753 */
754static int megasas_generic_reset(struct scsi_cmnd *scmd)
755{
756 int ret_val;
757 struct megasas_instance *instance;
758
759 instance = (struct megasas_instance *)scmd->device->host->hostdata;
760
761 printk(KERN_NOTICE "megasas: RESET -%ld cmd=%x <c=%d t=%d l=%d>\n",
762 scmd->serial_number, scmd->cmnd[0], scmd->device->channel,
763 scmd->device->id, scmd->device->lun);
764
765 if (instance->hw_crit_error) {
766 printk(KERN_ERR "megasas: cannot recover from previous reset "
767 "failures\n");
768 return FAILED;
769 }
770
771 spin_unlock(scmd->device->host->host_lock);
772
773 ret_val = megasas_wait_for_outstanding(instance);
774
775 if (ret_val == SUCCESS)
776 printk(KERN_NOTICE "megasas: reset successful \n");
777 else
778 printk(KERN_ERR "megasas: failed to do reset\n");
779
780 spin_lock(scmd->device->host->host_lock);
781
782 return ret_val;
783}
784
785static enum scsi_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
786{
787 unsigned long seconds;
788
789 if (scmd->SCp.ptr) {
790 seconds = (jiffies - scmd->SCp.sent_command) / HZ;
791
792 if (seconds < 90) {
793 return EH_RESET_TIMER;
794 } else {
795 return EH_NOT_HANDLED;
796 }
797 }
798
799 return EH_HANDLED;
800}
801
802/**
803 * megasas_reset_device - Device reset handler entry point
804 */
805static int megasas_reset_device(struct scsi_cmnd *scmd)
806{
807 int ret;
808
809 /*
810 * First wait for all commands to complete
811 */
812 ret = megasas_generic_reset(scmd);
813
814 return ret;
815}
816
817/**
818 * megasas_reset_bus_host - Bus & host reset handler entry point
819 */
820static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
821{
822 int ret;
823
824 /*
825 * Frist wait for all commands to complete
826 */
827 ret = megasas_generic_reset(scmd);
828
829 return ret;
830}
831
832/**
833 * megasas_service_aen - Processes an event notification
834 * @instance: Adapter soft state
835 * @cmd: AEN command completed by the ISR
836 *
837 * For AEN, driver sends a command down to FW that is held by the FW till an
838 * event occurs. When an event of interest occurs, FW completes the command
839 * that it was previously holding.
840 *
841 * This routines sends SIGIO signal to processes that have registered with the
842 * driver for AEN.
843 */
844static void
845megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd)
846{
847 /*
848 * Don't signal app if it is just an aborted previously registered aen
849 */
850 if (!cmd->abort_aen)
851 kill_fasync(&megasas_async_queue, SIGIO, POLL_IN);
852 else
853 cmd->abort_aen = 0;
854
855 instance->aen_cmd = NULL;
856 megasas_return_cmd(instance, cmd);
857}
858
859/*
860 * Scsi host template for megaraid_sas driver
861 */
862static struct scsi_host_template megasas_template = {
863
864 .module = THIS_MODULE,
865 .name = "LSI Logic SAS based MegaRAID driver",
866 .proc_name = "megaraid_sas",
867 .queuecommand = megasas_queue_command,
868 .eh_device_reset_handler = megasas_reset_device,
869 .eh_bus_reset_handler = megasas_reset_bus_host,
870 .eh_host_reset_handler = megasas_reset_bus_host,
871 .eh_timed_out = megasas_reset_timer,
872 .use_clustering = ENABLE_CLUSTERING,
873};
874
875/**
876 * megasas_complete_int_cmd - Completes an internal command
877 * @instance: Adapter soft state
878 * @cmd: Command to be completed
879 *
880 * The megasas_issue_blocked_cmd() function waits for a command to complete
881 * after it issues a command. This function wakes up that waiting routine by
882 * calling wake_up() on the wait queue.
883 */
884static void
885megasas_complete_int_cmd(struct megasas_instance *instance,
886 struct megasas_cmd *cmd)
887{
888 cmd->cmd_status = cmd->frame->io.cmd_status;
889
890 if (cmd->cmd_status == ENODATA) {
891 cmd->cmd_status = 0;
892 }
893 wake_up(&instance->int_cmd_wait_q);
894}
895
896/**
897 * megasas_complete_abort - Completes aborting a command
898 * @instance: Adapter soft state
899 * @cmd: Cmd that was issued to abort another cmd
900 *
901 * The megasas_issue_blocked_abort_cmd() function waits on abort_cmd_wait_q
902 * after it issues an abort on a previously issued command. This function
903 * wakes up all functions waiting on the same wait queue.
904 */
905static void
906megasas_complete_abort(struct megasas_instance *instance,
907 struct megasas_cmd *cmd)
908{
909 if (cmd->sync_cmd) {
910 cmd->sync_cmd = 0;
911 cmd->cmd_status = 0;
912 wake_up(&instance->abort_cmd_wait_q);
913 }
914
915 return;
916}
917
918/**
919 * megasas_unmap_sgbuf - Unmap SG buffers
920 * @instance: Adapter soft state
921 * @cmd: Completed command
922 */
923static inline void
924megasas_unmap_sgbuf(struct megasas_instance *instance, struct megasas_cmd *cmd)
925{
926 dma_addr_t buf_h;
927 u8 opcode;
928
929 if (cmd->scmd->use_sg) {
930 pci_unmap_sg(instance->pdev, cmd->scmd->request_buffer,
931 cmd->scmd->use_sg, cmd->scmd->sc_data_direction);
932 return;
933 }
934
935 if (!cmd->scmd->request_bufflen)
936 return;
937
938 opcode = cmd->frame->hdr.cmd;
939
940 if ((opcode == MFI_CMD_LD_READ) || (opcode == MFI_CMD_LD_WRITE)) {
941 if (IS_DMA64)
942 buf_h = cmd->frame->io.sgl.sge64[0].phys_addr;
943 else
944 buf_h = cmd->frame->io.sgl.sge32[0].phys_addr;
945 } else {
946 if (IS_DMA64)
947 buf_h = cmd->frame->pthru.sgl.sge64[0].phys_addr;
948 else
949 buf_h = cmd->frame->pthru.sgl.sge32[0].phys_addr;
950 }
951
952 pci_unmap_single(instance->pdev, buf_h, cmd->scmd->request_bufflen,
953 cmd->scmd->sc_data_direction);
954 return;
955}
956
957/**
958 * megasas_complete_cmd - Completes a command
959 * @instance: Adapter soft state
960 * @cmd: Command to be completed
961 * @alt_status: If non-zero, use this value as status to
962 * SCSI mid-layer instead of the value returned
963 * by the FW. This should be used if caller wants
964 * an alternate status (as in the case of aborted
965 * commands)
966 */
967static inline void
968megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
969 u8 alt_status)
970{
971 int exception = 0;
972 struct megasas_header *hdr = &cmd->frame->hdr;
973 unsigned long flags;
974
975 if (cmd->scmd) {
976 cmd->scmd->SCp.ptr = (char *)0;
977 }
978
979 switch (hdr->cmd) {
980
981 case MFI_CMD_PD_SCSI_IO:
982 case MFI_CMD_LD_SCSI_IO:
983
984 /*
985 * MFI_CMD_PD_SCSI_IO and MFI_CMD_LD_SCSI_IO could have been
986 * issued either through an IO path or an IOCTL path. If it
987 * was via IOCTL, we will send it to internal completion.
988 */
989 if (cmd->sync_cmd) {
990 cmd->sync_cmd = 0;
991 megasas_complete_int_cmd(instance, cmd);
992 break;
993 }
994
995 /*
996 * Don't export physical disk devices to mid-layer.
997 */
998 if (!MEGASAS_IS_LOGICAL(cmd->scmd) &&
999 (hdr->cmd_status == MFI_STAT_OK) &&
1000 (cmd->scmd->cmnd[0] == INQUIRY)) {
1001
1002 if (((*(u8 *) cmd->scmd->request_buffer) & 0x1F) ==
1003 TYPE_DISK) {
1004 cmd->scmd->result = DID_BAD_TARGET << 16;
1005 exception = 1;
1006 }
1007 }
1008
1009 case MFI_CMD_LD_READ:
1010 case MFI_CMD_LD_WRITE:
1011
1012 if (alt_status) {
1013 cmd->scmd->result = alt_status << 16;
1014 exception = 1;
1015 }
1016
1017 if (exception) {
1018
1019 spin_lock_irqsave(&instance->instance_lock, flags);
1020 instance->fw_outstanding--;
1021 spin_unlock_irqrestore(&instance->instance_lock, flags);
1022
1023 megasas_unmap_sgbuf(instance, cmd);
1024 cmd->scmd->scsi_done(cmd->scmd);
1025 megasas_return_cmd(instance, cmd);
1026
1027 break;
1028 }
1029
1030 switch (hdr->cmd_status) {
1031
1032 case MFI_STAT_OK:
1033 cmd->scmd->result = DID_OK << 16;
1034 break;
1035
1036 case MFI_STAT_SCSI_IO_FAILED:
1037 case MFI_STAT_LD_INIT_IN_PROGRESS:
1038 cmd->scmd->result =
1039 (DID_ERROR << 16) | hdr->scsi_status;
1040 break;
1041
1042 case MFI_STAT_SCSI_DONE_WITH_ERROR:
1043
1044 cmd->scmd->result = (DID_OK << 16) | hdr->scsi_status;
1045
1046 if (hdr->scsi_status == SAM_STAT_CHECK_CONDITION) {
1047 memset(cmd->scmd->sense_buffer, 0,
1048 SCSI_SENSE_BUFFERSIZE);
1049 memcpy(cmd->scmd->sense_buffer, cmd->sense,
1050 hdr->sense_len);
1051
1052 cmd->scmd->result |= DRIVER_SENSE << 24;
1053 }
1054
1055 break;
1056
1057 case MFI_STAT_LD_OFFLINE:
1058 case MFI_STAT_DEVICE_NOT_FOUND:
1059 cmd->scmd->result = DID_BAD_TARGET << 16;
1060 break;
1061
1062 default:
1063 printk(KERN_DEBUG "megasas: MFI FW status %#x\n",
1064 hdr->cmd_status);
1065 cmd->scmd->result = DID_ERROR << 16;
1066 break;
1067 }
1068
1069 spin_lock_irqsave(&instance->instance_lock, flags);
1070 instance->fw_outstanding--;
1071 spin_unlock_irqrestore(&instance->instance_lock, flags);
1072
1073 megasas_unmap_sgbuf(instance, cmd);
1074 cmd->scmd->scsi_done(cmd->scmd);
1075 megasas_return_cmd(instance, cmd);
1076
1077 break;
1078
1079 case MFI_CMD_SMP:
1080 case MFI_CMD_STP:
1081 case MFI_CMD_DCMD:
1082
1083 /*
1084 * See if got an event notification
1085 */
1086 if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT)
1087 megasas_service_aen(instance, cmd);
1088 else
1089 megasas_complete_int_cmd(instance, cmd);
1090
1091 break;
1092
1093 case MFI_CMD_ABORT:
1094 /*
1095 * Cmd issued to abort another cmd returned
1096 */
1097 megasas_complete_abort(instance, cmd);
1098 break;
1099
1100 default:
1101 printk("megasas: Unknown command completed! [0x%X]\n",
1102 hdr->cmd);
1103 break;
1104 }
1105}
1106
1107/**
1108 * megasas_deplete_reply_queue - Processes all completed commands
1109 * @instance: Adapter soft state
1110 * @alt_status: Alternate status to be returned to
1111 * SCSI mid-layer instead of the status
1112 * returned by the FW
1113 */
1114static inline int
1115megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status)
1116{
1117 u32 status;
1118 u32 producer;
1119 u32 consumer;
1120 u32 context;
1121 struct megasas_cmd *cmd;
1122
1123 /*
1124 * Check if it is our interrupt
1125 */
1126 status = readl(&instance->reg_set->outbound_intr_status);
1127
1128 if (!(status & MFI_OB_INTR_STATUS_MASK)) {
1129 return IRQ_NONE;
1130 }
1131
1132 /*
1133 * Clear the interrupt by writing back the same value
1134 */
1135 writel(status, &instance->reg_set->outbound_intr_status);
1136
1137 producer = *instance->producer;
1138 consumer = *instance->consumer;
1139
1140 while (consumer != producer) {
1141 context = instance->reply_queue[consumer];
1142
1143 cmd = instance->cmd_list[context];
1144
1145 megasas_complete_cmd(instance, cmd, alt_status);
1146
1147 consumer++;
1148 if (consumer == (instance->max_fw_cmds + 1)) {
1149 consumer = 0;
1150 }
1151 }
1152
1153 *instance->consumer = producer;
1154
1155 return IRQ_HANDLED;
1156}
1157
1158/**
1159 * megasas_isr - isr entry point
1160 */
1161static irqreturn_t megasas_isr(int irq, void *devp, struct pt_regs *regs)
1162{
1163 return megasas_deplete_reply_queue((struct megasas_instance *)devp,
1164 DID_OK);
1165}
1166
1167/**
1168 * megasas_transition_to_ready - Move the FW to READY state
1169 * @reg_set: MFI register set
1170 *
1171 * During the initialization, FW passes can potentially be in any one of
1172 * several possible states. If the FW in operational, waiting-for-handshake
1173 * states, driver must take steps to bring it to ready state. Otherwise, it
1174 * has to wait for the ready state.
1175 */
1176static int
1177megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set)
1178{
1179 int i;
1180 u8 max_wait;
1181 u32 fw_state;
1182 u32 cur_state;
1183
1184 fw_state = readl(&reg_set->outbound_msg_0) & MFI_STATE_MASK;
1185
1186 while (fw_state != MFI_STATE_READY) {
1187
1188 printk(KERN_INFO "megasas: Waiting for FW to come to ready"
1189 " state\n");
1190 switch (fw_state) {
1191
1192 case MFI_STATE_FAULT:
1193
1194 printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
1195 return -ENODEV;
1196
1197 case MFI_STATE_WAIT_HANDSHAKE:
1198 /*
1199 * Set the CLR bit in inbound doorbell
1200 */
1201 writel(MFI_INIT_CLEAR_HANDSHAKE,
1202 &reg_set->inbound_doorbell);
1203
1204 max_wait = 2;
1205 cur_state = MFI_STATE_WAIT_HANDSHAKE;
1206 break;
1207
1208 case MFI_STATE_OPERATIONAL:
1209 /*
1210 * Bring it to READY state; assuming max wait 2 secs
1211 */
1212 megasas_disable_intr(reg_set);
1213 writel(MFI_INIT_READY, &reg_set->inbound_doorbell);
1214
1215 max_wait = 10;
1216 cur_state = MFI_STATE_OPERATIONAL;
1217 break;
1218
1219 case MFI_STATE_UNDEFINED:
1220 /*
1221 * This state should not last for more than 2 seconds
1222 */
1223 max_wait = 2;
1224 cur_state = MFI_STATE_UNDEFINED;
1225 break;
1226
1227 case MFI_STATE_BB_INIT:
1228 max_wait = 2;
1229 cur_state = MFI_STATE_BB_INIT;
1230 break;
1231
1232 case MFI_STATE_FW_INIT:
1233 max_wait = 20;
1234 cur_state = MFI_STATE_FW_INIT;
1235 break;
1236
1237 case MFI_STATE_FW_INIT_2:
1238 max_wait = 20;
1239 cur_state = MFI_STATE_FW_INIT_2;
1240 break;
1241
1242 case MFI_STATE_DEVICE_SCAN:
1243 max_wait = 20;
1244 cur_state = MFI_STATE_DEVICE_SCAN;
1245 break;
1246
1247 case MFI_STATE_FLUSH_CACHE:
1248 max_wait = 20;
1249 cur_state = MFI_STATE_FLUSH_CACHE;
1250 break;
1251
1252 default:
1253 printk(KERN_DEBUG "megasas: Unknown state 0x%x\n",
1254 fw_state);
1255 return -ENODEV;
1256 }
1257
1258 /*
1259 * The cur_state should not last for more than max_wait secs
1260 */
1261 for (i = 0; i < (max_wait * 1000); i++) {
1262 fw_state = MFI_STATE_MASK &
1263 readl(&reg_set->outbound_msg_0);
1264
1265 if (fw_state == cur_state) {
1266 msleep(1);
1267 } else
1268 break;
1269 }
1270
1271 /*
1272 * Return error if fw_state hasn't changed after max_wait
1273 */
1274 if (fw_state == cur_state) {
1275 printk(KERN_DEBUG "FW state [%d] hasn't changed "
1276 "in %d secs\n", fw_state, max_wait);
1277 return -ENODEV;
1278 }
1279 };
1280
1281 return 0;
1282}
1283
1284/**
1285 * megasas_teardown_frame_pool - Destroy the cmd frame DMA pool
1286 * @instance: Adapter soft state
1287 */
1288static void megasas_teardown_frame_pool(struct megasas_instance *instance)
1289{
1290 int i;
1291 u32 max_cmd = instance->max_fw_cmds;
1292 struct megasas_cmd *cmd;
1293
1294 if (!instance->frame_dma_pool)
1295 return;
1296
1297 /*
1298 * Return all frames to pool
1299 */
1300 for (i = 0; i < max_cmd; i++) {
1301
1302 cmd = instance->cmd_list[i];
1303
1304 if (cmd->frame)
1305 pci_pool_free(instance->frame_dma_pool, cmd->frame,
1306 cmd->frame_phys_addr);
1307
1308 if (cmd->sense)
1309 pci_pool_free(instance->sense_dma_pool, cmd->frame,
1310 cmd->sense_phys_addr);
1311 }
1312
1313 /*
1314 * Now destroy the pool itself
1315 */
1316 pci_pool_destroy(instance->frame_dma_pool);
1317 pci_pool_destroy(instance->sense_dma_pool);
1318
1319 instance->frame_dma_pool = NULL;
1320 instance->sense_dma_pool = NULL;
1321}
1322
1323/**
1324 * megasas_create_frame_pool - Creates DMA pool for cmd frames
1325 * @instance: Adapter soft state
1326 *
1327 * Each command packet has an embedded DMA memory buffer that is used for
1328 * filling MFI frame and the SG list that immediately follows the frame. This
1329 * function creates those DMA memory buffers for each command packet by using
1330 * PCI pool facility.
1331 */
1332static int megasas_create_frame_pool(struct megasas_instance *instance)
1333{
1334 int i;
1335 u32 max_cmd;
1336 u32 sge_sz;
1337 u32 sgl_sz;
1338 u32 total_sz;
1339 u32 frame_count;
1340 struct megasas_cmd *cmd;
1341
1342 max_cmd = instance->max_fw_cmds;
1343
1344 /*
1345 * Size of our frame is 64 bytes for MFI frame, followed by max SG
1346 * elements and finally SCSI_SENSE_BUFFERSIZE bytes for sense buffer
1347 */
1348 sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) :
1349 sizeof(struct megasas_sge32);
1350
1351 /*
1352 * Calculated the number of 64byte frames required for SGL
1353 */
1354 sgl_sz = sge_sz * instance->max_num_sge;
1355 frame_count = (sgl_sz + MEGAMFI_FRAME_SIZE - 1) / MEGAMFI_FRAME_SIZE;
1356
1357 /*
1358 * We need one extra frame for the MFI command
1359 */
1360 frame_count++;
1361
1362 total_sz = MEGAMFI_FRAME_SIZE * frame_count;
1363 /*
1364 * Use DMA pool facility provided by PCI layer
1365 */
1366 instance->frame_dma_pool = pci_pool_create("megasas frame pool",
1367 instance->pdev, total_sz, 64,
1368 0);
1369
1370 if (!instance->frame_dma_pool) {
1371 printk(KERN_DEBUG "megasas: failed to setup frame pool\n");
1372 return -ENOMEM;
1373 }
1374
1375 instance->sense_dma_pool = pci_pool_create("megasas sense pool",
1376 instance->pdev, 128, 4, 0);
1377
1378 if (!instance->sense_dma_pool) {
1379 printk(KERN_DEBUG "megasas: failed to setup sense pool\n");
1380
1381 pci_pool_destroy(instance->frame_dma_pool);
1382 instance->frame_dma_pool = NULL;
1383
1384 return -ENOMEM;
1385 }
1386
1387 /*
1388 * Allocate and attach a frame to each of the commands in cmd_list.
1389 * By making cmd->index as the context instead of the &cmd, we can
1390 * always use 32bit context regardless of the architecture
1391 */
1392 for (i = 0; i < max_cmd; i++) {
1393
1394 cmd = instance->cmd_list[i];
1395
1396 cmd->frame = pci_pool_alloc(instance->frame_dma_pool,
1397 GFP_KERNEL, &cmd->frame_phys_addr);
1398
1399 cmd->sense = pci_pool_alloc(instance->sense_dma_pool,
1400 GFP_KERNEL, &cmd->sense_phys_addr);
1401
1402 /*
1403 * megasas_teardown_frame_pool() takes care of freeing
1404 * whatever has been allocated
1405 */
1406 if (!cmd->frame || !cmd->sense) {
1407 printk(KERN_DEBUG "megasas: pci_pool_alloc failed \n");
1408 megasas_teardown_frame_pool(instance);
1409 return -ENOMEM;
1410 }
1411
1412 cmd->frame->io.context = cmd->index;
1413 }
1414
1415 return 0;
1416}
1417
1418/**
1419 * megasas_free_cmds - Free all the cmds in the free cmd pool
1420 * @instance: Adapter soft state
1421 */
1422static void megasas_free_cmds(struct megasas_instance *instance)
1423{
1424 int i;
1425 /* First free the MFI frame pool */
1426 megasas_teardown_frame_pool(instance);
1427
1428 /* Free all the commands in the cmd_list */
1429 for (i = 0; i < instance->max_fw_cmds; i++)
1430 kfree(instance->cmd_list[i]);
1431
1432 /* Free the cmd_list buffer itself */
1433 kfree(instance->cmd_list);
1434 instance->cmd_list = NULL;
1435
1436 INIT_LIST_HEAD(&instance->cmd_pool);
1437}
1438
1439/**
1440 * megasas_alloc_cmds - Allocates the command packets
1441 * @instance: Adapter soft state
1442 *
1443 * Each command that is issued to the FW, whether IO commands from the OS or
1444 * internal commands like IOCTLs, are wrapped in local data structure called
1445 * megasas_cmd. The frame embedded in this megasas_cmd is actually issued to
1446 * the FW.
1447 *
1448 * Each frame has a 32-bit field called context (tag). This context is used
1449 * to get back the megasas_cmd from the frame when a frame gets completed in
1450 * the ISR. Typically the address of the megasas_cmd itself would be used as
1451 * the context. But we wanted to keep the differences between 32 and 64 bit
1452 * systems to the mininum. We always use 32 bit integers for the context. In
1453 * this driver, the 32 bit values are the indices into an array cmd_list.
1454 * This array is used only to look up the megasas_cmd given the context. The
1455 * free commands themselves are maintained in a linked list called cmd_pool.
1456 */
1457static int megasas_alloc_cmds(struct megasas_instance *instance)
1458{
1459 int i;
1460 int j;
1461 u32 max_cmd;
1462 struct megasas_cmd *cmd;
1463
1464 max_cmd = instance->max_fw_cmds;
1465
1466 /*
1467 * instance->cmd_list is an array of struct megasas_cmd pointers.
1468 * Allocate the dynamic array first and then allocate individual
1469 * commands.
1470 */
1471 instance->cmd_list = kmalloc(sizeof(struct megasas_cmd *) * max_cmd,
1472 GFP_KERNEL);
1473
1474 if (!instance->cmd_list) {
1475 printk(KERN_DEBUG "megasas: out of memory\n");
1476 return -ENOMEM;
1477 }
1478
1479 memset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) * max_cmd);
1480
1481 for (i = 0; i < max_cmd; i++) {
1482 instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),
1483 GFP_KERNEL);
1484
1485 if (!instance->cmd_list[i]) {
1486
1487 for (j = 0; j < i; j++)
1488 kfree(instance->cmd_list[j]);
1489
1490 kfree(instance->cmd_list);
1491 instance->cmd_list = NULL;
1492
1493 return -ENOMEM;
1494 }
1495 }
1496
1497 /*
1498 * Add all the commands to command pool (instance->cmd_pool)
1499 */
1500 for (i = 0; i < max_cmd; i++) {
1501 cmd = instance->cmd_list[i];
1502 memset(cmd, 0, sizeof(struct megasas_cmd));
1503 cmd->index = i;
1504 cmd->instance = instance;
1505
1506 list_add_tail(&cmd->list, &instance->cmd_pool);
1507 }
1508
1509 /*
1510 * Create a frame pool and assign one frame to each cmd
1511 */
1512 if (megasas_create_frame_pool(instance)) {
1513 printk(KERN_DEBUG "megasas: Error creating frame DMA pool\n");
1514 megasas_free_cmds(instance);
1515 }
1516
1517 return 0;
1518}
1519
1520/**
1521 * megasas_get_controller_info - Returns FW's controller structure
1522 * @instance: Adapter soft state
1523 * @ctrl_info: Controller information structure
1524 *
1525 * Issues an internal command (DCMD) to get the FW's controller structure.
1526 * This information is mainly used to find out the maximum IO transfer per
1527 * command supported by the FW.
1528 */
1529static int
1530megasas_get_ctrl_info(struct megasas_instance *instance,
1531 struct megasas_ctrl_info *ctrl_info)
1532{
1533 int ret = 0;
1534 struct megasas_cmd *cmd;
1535 struct megasas_dcmd_frame *dcmd;
1536 struct megasas_ctrl_info *ci;
1537 dma_addr_t ci_h = 0;
1538
1539 cmd = megasas_get_cmd(instance);
1540
1541 if (!cmd) {
1542 printk(KERN_DEBUG "megasas: Failed to get a free cmd\n");
1543 return -ENOMEM;
1544 }
1545
1546 dcmd = &cmd->frame->dcmd;
1547
1548 ci = pci_alloc_consistent(instance->pdev,
1549 sizeof(struct megasas_ctrl_info), &ci_h);
1550
1551 if (!ci) {
1552 printk(KERN_DEBUG "Failed to alloc mem for ctrl info\n");
1553 megasas_return_cmd(instance, cmd);
1554 return -ENOMEM;
1555 }
1556
1557 memset(ci, 0, sizeof(*ci));
1558 memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
1559
1560 dcmd->cmd = MFI_CMD_DCMD;
1561 dcmd->cmd_status = 0xFF;
1562 dcmd->sge_count = 1;
1563 dcmd->flags = MFI_FRAME_DIR_READ;
1564 dcmd->timeout = 0;
1565 dcmd->data_xfer_len = sizeof(struct megasas_ctrl_info);
1566 dcmd->opcode = MR_DCMD_CTRL_GET_INFO;
1567 dcmd->sgl.sge32[0].phys_addr = ci_h;
1568 dcmd->sgl.sge32[0].length = sizeof(struct megasas_ctrl_info);
1569
1570 if (!megasas_issue_polled(instance, cmd)) {
1571 ret = 0;
1572 memcpy(ctrl_info, ci, sizeof(struct megasas_ctrl_info));
1573 } else {
1574 ret = -1;
1575 }
1576
1577 pci_free_consistent(instance->pdev, sizeof(struct megasas_ctrl_info),
1578 ci, ci_h);
1579
1580 megasas_return_cmd(instance, cmd);
1581 return ret;
1582}
1583
1584/**
1585 * megasas_init_mfi - Initializes the FW
1586 * @instance: Adapter soft state
1587 *
1588 * This is the main function for initializing MFI firmware.
1589 */
1590static int megasas_init_mfi(struct megasas_instance *instance)
1591{
1592 u32 context_sz;
1593 u32 reply_q_sz;
1594 u32 max_sectors_1;
1595 u32 max_sectors_2;
1596 struct megasas_register_set __iomem *reg_set;
1597
1598 struct megasas_cmd *cmd;
1599 struct megasas_ctrl_info *ctrl_info;
1600
1601 struct megasas_init_frame *init_frame;
1602 struct megasas_init_queue_info *initq_info;
1603 dma_addr_t init_frame_h;
1604 dma_addr_t initq_info_h;
1605
1606 /*
1607 * Map the message registers
1608 */
1609 instance->base_addr = pci_resource_start(instance->pdev, 0);
1610
1611 if (pci_request_regions(instance->pdev, "megasas: LSI Logic")) {
1612 printk(KERN_DEBUG "megasas: IO memory region busy!\n");
1613 return -EBUSY;
1614 }
1615
1616 instance->reg_set = ioremap_nocache(instance->base_addr, 8192);
1617
1618 if (!instance->reg_set) {
1619 printk(KERN_DEBUG "megasas: Failed to map IO mem\n");
1620 goto fail_ioremap;
1621 }
1622
1623 reg_set = instance->reg_set;
1624
1625 /*
1626 * We expect the FW state to be READY
1627 */
1628 if (megasas_transition_to_ready(instance->reg_set))
1629 goto fail_ready_state;
1630
1631 /*
1632 * Get various operational parameters from status register
1633 */
1634 instance->max_fw_cmds = readl(&reg_set->outbound_msg_0) & 0x00FFFF;
1635 instance->max_num_sge = (readl(&reg_set->outbound_msg_0) & 0xFF0000) >>
1636 0x10;
1637 /*
1638 * Create a pool of commands
1639 */
1640 if (megasas_alloc_cmds(instance))
1641 goto fail_alloc_cmds;
1642
1643 /*
1644 * Allocate memory for reply queue. Length of reply queue should
1645 * be _one_ more than the maximum commands handled by the firmware.
1646 *
1647 * Note: When FW completes commands, it places corresponding contex
1648 * values in this circular reply queue. This circular queue is a fairly
1649 * typical producer-consumer queue. FW is the producer (of completed
1650 * commands) and the driver is the consumer.
1651 */
1652 context_sz = sizeof(u32);
1653 reply_q_sz = context_sz * (instance->max_fw_cmds + 1);
1654
1655 instance->reply_queue = pci_alloc_consistent(instance->pdev,
1656 reply_q_sz,
1657 &instance->reply_queue_h);
1658
1659 if (!instance->reply_queue) {
1660 printk(KERN_DEBUG "megasas: Out of DMA mem for reply queue\n");
1661 goto fail_reply_queue;
1662 }
1663
1664 /*
1665 * Prepare a init frame. Note the init frame points to queue info
1666 * structure. Each frame has SGL allocated after first 64 bytes. For
1667 * this frame - since we don't need any SGL - we use SGL's space as
1668 * queue info structure
1669 *
1670 * We will not get a NULL command below. We just created the pool.
1671 */
1672 cmd = megasas_get_cmd(instance);
1673
1674 init_frame = (struct megasas_init_frame *)cmd->frame;
1675 initq_info = (struct megasas_init_queue_info *)
1676 ((unsigned long)init_frame + 64);
1677
1678 init_frame_h = cmd->frame_phys_addr;
1679 initq_info_h = init_frame_h + 64;
1680
1681 memset(init_frame, 0, MEGAMFI_FRAME_SIZE);
1682 memset(initq_info, 0, sizeof(struct megasas_init_queue_info));
1683
1684 initq_info->reply_queue_entries = instance->max_fw_cmds + 1;
1685 initq_info->reply_queue_start_phys_addr_lo = instance->reply_queue_h;
1686
1687 initq_info->producer_index_phys_addr_lo = instance->producer_h;
1688 initq_info->consumer_index_phys_addr_lo = instance->consumer_h;
1689
1690 init_frame->cmd = MFI_CMD_INIT;
1691 init_frame->cmd_status = 0xFF;
1692 init_frame->queue_info_new_phys_addr_lo = initq_info_h;
1693
1694 init_frame->data_xfer_len = sizeof(struct megasas_init_queue_info);
1695
1696 /*
1697 * Issue the init frame in polled mode
1698 */
1699 if (megasas_issue_polled(instance, cmd)) {
1700 printk(KERN_DEBUG "megasas: Failed to init firmware\n");
1701 goto fail_fw_init;
1702 }
1703
1704 megasas_return_cmd(instance, cmd);
1705
1706 ctrl_info = kmalloc(sizeof(struct megasas_ctrl_info), GFP_KERNEL);
1707
1708 /*
1709 * Compute the max allowed sectors per IO: The controller info has two
1710 * limits on max sectors. Driver should use the minimum of these two.
1711 *
1712 * 1 << stripe_sz_ops.min = max sectors per strip
1713 *
1714 * Note that older firmwares ( < FW ver 30) didn't report information
1715 * to calculate max_sectors_1. So the number ended up as zero always.
1716 */
1717 if (ctrl_info && !megasas_get_ctrl_info(instance, ctrl_info)) {
1718
1719 max_sectors_1 = (1 << ctrl_info->stripe_sz_ops.min) *
1720 ctrl_info->max_strips_per_io;
1721 max_sectors_2 = ctrl_info->max_request_size;
1722
1723 instance->max_sectors_per_req = (max_sectors_1 < max_sectors_2)
1724 ? max_sectors_1 : max_sectors_2;
1725 } else
1726 instance->max_sectors_per_req = instance->max_num_sge *
1727 PAGE_SIZE / 512;
1728
1729 kfree(ctrl_info);
1730
1731 return 0;
1732
1733 fail_fw_init:
1734 megasas_return_cmd(instance, cmd);
1735
1736 pci_free_consistent(instance->pdev, reply_q_sz,
1737 instance->reply_queue, instance->reply_queue_h);
1738 fail_reply_queue:
1739 megasas_free_cmds(instance);
1740
1741 fail_alloc_cmds:
1742 fail_ready_state:
1743 iounmap(instance->reg_set);
1744
1745 fail_ioremap:
1746 pci_release_regions(instance->pdev);
1747
1748 return -EINVAL;
1749}
1750
1751/**
1752 * megasas_release_mfi - Reverses the FW initialization
1753 * @intance: Adapter soft state
1754 */
1755static void megasas_release_mfi(struct megasas_instance *instance)
1756{
1757 u32 reply_q_sz = sizeof(u32) * (instance->max_fw_cmds + 1);
1758
1759 pci_free_consistent(instance->pdev, reply_q_sz,
1760 instance->reply_queue, instance->reply_queue_h);
1761
1762 megasas_free_cmds(instance);
1763
1764 iounmap(instance->reg_set);
1765
1766 pci_release_regions(instance->pdev);
1767}
1768
1769/**
1770 * megasas_get_seq_num - Gets latest event sequence numbers
1771 * @instance: Adapter soft state
1772 * @eli: FW event log sequence numbers information
1773 *
1774 * FW maintains a log of all events in a non-volatile area. Upper layers would
1775 * usually find out the latest sequence number of the events, the seq number at
1776 * the boot etc. They would "read" all the events below the latest seq number
1777 * by issuing a direct fw cmd (DCMD). For the future events (beyond latest seq
1778 * number), they would subsribe to AEN (asynchronous event notification) and
1779 * wait for the events to happen.
1780 */
1781static int
1782megasas_get_seq_num(struct megasas_instance *instance,
1783 struct megasas_evt_log_info *eli)
1784{
1785 struct megasas_cmd *cmd;
1786 struct megasas_dcmd_frame *dcmd;
1787 struct megasas_evt_log_info *el_info;
1788 dma_addr_t el_info_h = 0;
1789
1790 cmd = megasas_get_cmd(instance);
1791
1792 if (!cmd) {
1793 return -ENOMEM;
1794 }
1795
1796 dcmd = &cmd->frame->dcmd;
1797 el_info = pci_alloc_consistent(instance->pdev,
1798 sizeof(struct megasas_evt_log_info),
1799 &el_info_h);
1800
1801 if (!el_info) {
1802 megasas_return_cmd(instance, cmd);
1803 return -ENOMEM;
1804 }
1805
1806 memset(el_info, 0, sizeof(*el_info));
1807 memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
1808
1809 dcmd->cmd = MFI_CMD_DCMD;
1810 dcmd->cmd_status = 0x0;
1811 dcmd->sge_count = 1;
1812 dcmd->flags = MFI_FRAME_DIR_READ;
1813 dcmd->timeout = 0;
1814 dcmd->data_xfer_len = sizeof(struct megasas_evt_log_info);
1815 dcmd->opcode = MR_DCMD_CTRL_EVENT_GET_INFO;
1816 dcmd->sgl.sge32[0].phys_addr = el_info_h;
1817 dcmd->sgl.sge32[0].length = sizeof(struct megasas_evt_log_info);
1818
1819 megasas_issue_blocked_cmd(instance, cmd);
1820
1821 /*
1822 * Copy the data back into callers buffer
1823 */
1824 memcpy(eli, el_info, sizeof(struct megasas_evt_log_info));
1825
1826 pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info),
1827 el_info, el_info_h);
1828
1829 megasas_return_cmd(instance, cmd);
1830
1831 return 0;
1832}
1833
1834/**
1835 * megasas_register_aen - Registers for asynchronous event notification
1836 * @instance: Adapter soft state
1837 * @seq_num: The starting sequence number
1838 * @class_locale: Class of the event
1839 *
1840 * This function subscribes for AEN for events beyond the @seq_num. It requests
1841 * to be notified if and only if the event is of type @class_locale
1842 */
1843static int
1844megasas_register_aen(struct megasas_instance *instance, u32 seq_num,
1845 u32 class_locale_word)
1846{
1847 int ret_val;
1848 struct megasas_cmd *cmd;
1849 struct megasas_dcmd_frame *dcmd;
1850 union megasas_evt_class_locale curr_aen;
1851 union megasas_evt_class_locale prev_aen;
1852
1853 /*
1854 * If there an AEN pending already (aen_cmd), check if the
1855 * class_locale of that pending AEN is inclusive of the new
1856 * AEN request we currently have. If it is, then we don't have
1857 * to do anything. In other words, whichever events the current
1858 * AEN request is subscribing to, have already been subscribed
1859 * to.
1860 *
1861 * If the old_cmd is _not_ inclusive, then we have to abort
1862 * that command, form a class_locale that is superset of both
1863 * old and current and re-issue to the FW
1864 */
1865
1866 curr_aen.word = class_locale_word;
1867
1868 if (instance->aen_cmd) {
1869
1870 prev_aen.word = instance->aen_cmd->frame->dcmd.mbox.w[1];
1871
1872 /*
1873 * A class whose enum value is smaller is inclusive of all
1874 * higher values. If a PROGRESS (= -1) was previously
1875 * registered, then a new registration requests for higher
1876 * classes need not be sent to FW. They are automatically
1877 * included.
1878 *
1879 * Locale numbers don't have such hierarchy. They are bitmap
1880 * values
1881 */
1882 if ((prev_aen.members.class <= curr_aen.members.class) &&
1883 !((prev_aen.members.locale & curr_aen.members.locale) ^
1884 curr_aen.members.locale)) {
1885 /*
1886 * Previously issued event registration includes
1887 * current request. Nothing to do.
1888 */
1889 return 0;
1890 } else {
1891 curr_aen.members.locale |= prev_aen.members.locale;
1892
1893 if (prev_aen.members.class < curr_aen.members.class)
1894 curr_aen.members.class = prev_aen.members.class;
1895
1896 instance->aen_cmd->abort_aen = 1;
1897 ret_val = megasas_issue_blocked_abort_cmd(instance,
1898 instance->
1899 aen_cmd);
1900
1901 if (ret_val) {
1902 printk(KERN_DEBUG "megasas: Failed to abort "
1903 "previous AEN command\n");
1904 return ret_val;
1905 }
1906 }
1907 }
1908
1909 cmd = megasas_get_cmd(instance);
1910
1911 if (!cmd)
1912 return -ENOMEM;
1913
1914 dcmd = &cmd->frame->dcmd;
1915
1916 memset(instance->evt_detail, 0, sizeof(struct megasas_evt_detail));
1917
1918 /*
1919 * Prepare DCMD for aen registration
1920 */
1921 memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
1922
1923 dcmd->cmd = MFI_CMD_DCMD;
1924 dcmd->cmd_status = 0x0;
1925 dcmd->sge_count = 1;
1926 dcmd->flags = MFI_FRAME_DIR_READ;
1927 dcmd->timeout = 0;
1928 dcmd->data_xfer_len = sizeof(struct megasas_evt_detail);
1929 dcmd->opcode = MR_DCMD_CTRL_EVENT_WAIT;
1930 dcmd->mbox.w[0] = seq_num;
1931 dcmd->mbox.w[1] = curr_aen.word;
1932 dcmd->sgl.sge32[0].phys_addr = (u32) instance->evt_detail_h;
1933 dcmd->sgl.sge32[0].length = sizeof(struct megasas_evt_detail);
1934
1935 /*
1936 * Store reference to the cmd used to register for AEN. When an
1937 * application wants us to register for AEN, we have to abort this
1938 * cmd and re-register with a new EVENT LOCALE supplied by that app
1939 */
1940 instance->aen_cmd = cmd;
1941
1942 /*
1943 * Issue the aen registration frame
1944 */
1945 writel(cmd->frame_phys_addr >> 3,
1946 &instance->reg_set->inbound_queue_port);
1947
1948 return 0;
1949}
1950
1951/**
1952 * megasas_start_aen - Subscribes to AEN during driver load time
1953 * @instance: Adapter soft state
1954 */
1955static int megasas_start_aen(struct megasas_instance *instance)
1956{
1957 struct megasas_evt_log_info eli;
1958 union megasas_evt_class_locale class_locale;
1959
1960 /*
1961 * Get the latest sequence number from FW
1962 */
1963 memset(&eli, 0, sizeof(eli));
1964
1965 if (megasas_get_seq_num(instance, &eli))
1966 return -1;
1967
1968 /*
1969 * Register AEN with FW for latest sequence number plus 1
1970 */
1971 class_locale.members.reserved = 0;
1972 class_locale.members.locale = MR_EVT_LOCALE_ALL;
1973 class_locale.members.class = MR_EVT_CLASS_DEBUG;
1974
1975 return megasas_register_aen(instance, eli.newest_seq_num + 1,
1976 class_locale.word);
1977}
1978
1979/**
1980 * megasas_io_attach - Attaches this driver to SCSI mid-layer
1981 * @instance: Adapter soft state
1982 */
1983static int megasas_io_attach(struct megasas_instance *instance)
1984{
1985 struct Scsi_Host *host = instance->host;
1986
1987 /*
1988 * Export parameters required by SCSI mid-layer
1989 */
1990 host->irq = instance->pdev->irq;
1991 host->unique_id = instance->unique_id;
1992 host->can_queue = instance->max_fw_cmds - MEGASAS_INT_CMDS;
1993 host->this_id = instance->init_id;
1994 host->sg_tablesize = instance->max_num_sge;
1995 host->max_sectors = instance->max_sectors_per_req;
1996 host->cmd_per_lun = 128;
1997 host->max_channel = MEGASAS_MAX_CHANNELS - 1;
1998 host->max_id = MEGASAS_MAX_DEV_PER_CHANNEL;
1999 host->max_lun = MEGASAS_MAX_LUN;
2000
2001 /*
2002 * Notify the mid-layer about the new controller
2003 */
2004 if (scsi_add_host(host, &instance->pdev->dev)) {
2005 printk(KERN_DEBUG "megasas: scsi_add_host failed\n");
2006 return -ENODEV;
2007 }
2008
2009 /*
2010 * Trigger SCSI to scan our drives
2011 */
2012 scsi_scan_host(host);
2013 return 0;
2014}
2015
2016/**
2017 * megasas_probe_one - PCI hotplug entry point
2018 * @pdev: PCI device structure
2019 * @id: PCI ids of supported hotplugged adapter
2020 */
2021static int __devinit
2022megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2023{
2024 int rval;
2025 struct Scsi_Host *host;
2026 struct megasas_instance *instance;
2027
2028 /*
2029 * Announce PCI information
2030 */
2031 printk(KERN_INFO "megasas: %#4.04x:%#4.04x:%#4.04x:%#4.04x: ",
2032 pdev->vendor, pdev->device, pdev->subsystem_vendor,
2033 pdev->subsystem_device);
2034
2035 printk("bus %d:slot %d:func %d\n",
2036 pdev->bus->number, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
2037
2038 /*
2039 * PCI prepping: enable device set bus mastering and dma mask
2040 */
2041 rval = pci_enable_device(pdev);
2042
2043 if (rval) {
2044 return rval;
2045 }
2046
2047 pci_set_master(pdev);
2048
2049 /*
2050 * All our contollers are capable of performing 64-bit DMA
2051 */
2052 if (IS_DMA64) {
2053 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) != 0) {
2054
2055 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0)
2056 goto fail_set_dma_mask;
2057 }
2058 } else {
2059 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0)
2060 goto fail_set_dma_mask;
2061 }
2062
2063 host = scsi_host_alloc(&megasas_template,
2064 sizeof(struct megasas_instance));
2065
2066 if (!host) {
2067 printk(KERN_DEBUG "megasas: scsi_host_alloc failed\n");
2068 goto fail_alloc_instance;
2069 }
2070
2071 instance = (struct megasas_instance *)host->hostdata;
2072 memset(instance, 0, sizeof(*instance));
2073
2074 instance->producer = pci_alloc_consistent(pdev, sizeof(u32),
2075 &instance->producer_h);
2076 instance->consumer = pci_alloc_consistent(pdev, sizeof(u32),
2077 &instance->consumer_h);
2078
2079 if (!instance->producer || !instance->consumer) {
2080 printk(KERN_DEBUG "megasas: Failed to allocate memory for "
2081 "producer, consumer\n");
2082 goto fail_alloc_dma_buf;
2083 }
2084
2085 *instance->producer = 0;
2086 *instance->consumer = 0;
2087
2088 instance->evt_detail = pci_alloc_consistent(pdev,
2089 sizeof(struct
2090 megasas_evt_detail),
2091 &instance->evt_detail_h);
2092
2093 if (!instance->evt_detail) {
2094 printk(KERN_DEBUG "megasas: Failed to allocate memory for "
2095 "event detail structure\n");
2096 goto fail_alloc_dma_buf;
2097 }
2098
2099 /*
2100 * Initialize locks and queues
2101 */
2102 INIT_LIST_HEAD(&instance->cmd_pool);
2103
2104 init_waitqueue_head(&instance->int_cmd_wait_q);
2105 init_waitqueue_head(&instance->abort_cmd_wait_q);
2106
2107 spin_lock_init(&instance->cmd_pool_lock);
2108 spin_lock_init(&instance->instance_lock);
2109
2110 sema_init(&instance->aen_mutex, 1);
2111 sema_init(&instance->ioctl_sem, MEGASAS_INT_CMDS);
2112
2113 /*
2114 * Initialize PCI related and misc parameters
2115 */
2116 instance->pdev = pdev;
2117 instance->host = host;
2118 instance->unique_id = pdev->bus->number << 8 | pdev->devfn;
2119 instance->init_id = MEGASAS_DEFAULT_INIT_ID;
2120
2121 /*
2122 * Initialize MFI Firmware
2123 */
2124 if (megasas_init_mfi(instance))
2125 goto fail_init_mfi;
2126
2127 /*
2128 * Register IRQ
2129 */
2130 if (request_irq(pdev->irq, megasas_isr, SA_SHIRQ, "megasas", instance)) {
2131 printk(KERN_DEBUG "megasas: Failed to register IRQ\n");
2132 goto fail_irq;
2133 }
2134
2135 megasas_enable_intr(instance->reg_set);
2136
2137 /*
2138 * Store instance in PCI softstate
2139 */
2140 pci_set_drvdata(pdev, instance);
2141
2142 /*
2143 * Add this controller to megasas_mgmt_info structure so that it
2144 * can be exported to management applications
2145 */
2146 megasas_mgmt_info.count++;
2147 megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = instance;
2148 megasas_mgmt_info.max_index++;
2149
2150 /*
2151 * Initiate AEN (Asynchronous Event Notification)
2152 */
2153 if (megasas_start_aen(instance)) {
2154 printk(KERN_DEBUG "megasas: start aen failed\n");
2155 goto fail_start_aen;
2156 }
2157
2158 /*
2159 * Register with SCSI mid-layer
2160 */
2161 if (megasas_io_attach(instance))
2162 goto fail_io_attach;
2163
2164 return 0;
2165
2166 fail_start_aen:
2167 fail_io_attach:
2168 megasas_mgmt_info.count--;
2169 megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
2170 megasas_mgmt_info.max_index--;
2171
2172 pci_set_drvdata(pdev, NULL);
2173 megasas_disable_intr(instance->reg_set);
2174 free_irq(instance->pdev->irq, instance);
2175
2176 megasas_release_mfi(instance);
2177
2178 fail_irq:
2179 fail_init_mfi:
2180 fail_alloc_dma_buf:
2181 if (instance->evt_detail)
2182 pci_free_consistent(pdev, sizeof(struct megasas_evt_detail),
2183 instance->evt_detail,
2184 instance->evt_detail_h);
2185
2186 if (instance->producer)
2187 pci_free_consistent(pdev, sizeof(u32), instance->producer,
2188 instance->producer_h);
2189 if (instance->consumer)
2190 pci_free_consistent(pdev, sizeof(u32), instance->consumer,
2191 instance->consumer_h);
2192 scsi_host_put(host);
2193
2194 fail_alloc_instance:
2195 fail_set_dma_mask:
2196 pci_disable_device(pdev);
2197
2198 return -ENODEV;
2199}
2200
2201/**
2202 * megasas_flush_cache - Requests FW to flush all its caches
2203 * @instance: Adapter soft state
2204 */
2205static void megasas_flush_cache(struct megasas_instance *instance)
2206{
2207 struct megasas_cmd *cmd;
2208 struct megasas_dcmd_frame *dcmd;
2209
2210 cmd = megasas_get_cmd(instance);
2211
2212 if (!cmd)
2213 return;
2214
2215 dcmd = &cmd->frame->dcmd;
2216
2217 memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
2218
2219 dcmd->cmd = MFI_CMD_DCMD;
2220 dcmd->cmd_status = 0x0;
2221 dcmd->sge_count = 0;
2222 dcmd->flags = MFI_FRAME_DIR_NONE;
2223 dcmd->timeout = 0;
2224 dcmd->data_xfer_len = 0;
2225 dcmd->opcode = MR_DCMD_CTRL_CACHE_FLUSH;
2226 dcmd->mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
2227
2228 megasas_issue_blocked_cmd(instance, cmd);
2229
2230 megasas_return_cmd(instance, cmd);
2231
2232 return;
2233}
2234
2235/**
2236 * megasas_shutdown_controller - Instructs FW to shutdown the controller
2237 * @instance: Adapter soft state
2238 */
2239static void megasas_shutdown_controller(struct megasas_instance *instance)
2240{
2241 struct megasas_cmd *cmd;
2242 struct megasas_dcmd_frame *dcmd;
2243
2244 cmd = megasas_get_cmd(instance);
2245
2246 if (!cmd)
2247 return;
2248
2249 if (instance->aen_cmd)
2250 megasas_issue_blocked_abort_cmd(instance, instance->aen_cmd);
2251
2252 dcmd = &cmd->frame->dcmd;
2253
2254 memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
2255
2256 dcmd->cmd = MFI_CMD_DCMD;
2257 dcmd->cmd_status = 0x0;
2258 dcmd->sge_count = 0;
2259 dcmd->flags = MFI_FRAME_DIR_NONE;
2260 dcmd->timeout = 0;
2261 dcmd->data_xfer_len = 0;
2262 dcmd->opcode = MR_DCMD_CTRL_SHUTDOWN;
2263
2264 megasas_issue_blocked_cmd(instance, cmd);
2265
2266 megasas_return_cmd(instance, cmd);
2267
2268 return;
2269}
2270
2271/**
2272 * megasas_detach_one - PCI hot"un"plug entry point
2273 * @pdev: PCI device structure
2274 */
2275static void megasas_detach_one(struct pci_dev *pdev)
2276{
2277 int i;
2278 struct Scsi_Host *host;
2279 struct megasas_instance *instance;
2280
2281 instance = pci_get_drvdata(pdev);
2282 host = instance->host;
2283
2284 scsi_remove_host(instance->host);
2285 megasas_flush_cache(instance);
2286 megasas_shutdown_controller(instance);
2287
2288 /*
2289 * Take the instance off the instance array. Note that we will not
2290 * decrement the max_index. We let this array be sparse array
2291 */
2292 for (i = 0; i < megasas_mgmt_info.max_index; i++) {
2293 if (megasas_mgmt_info.instance[i] == instance) {
2294 megasas_mgmt_info.count--;
2295 megasas_mgmt_info.instance[i] = NULL;
2296
2297 break;
2298 }
2299 }
2300
2301 pci_set_drvdata(instance->pdev, NULL);
2302
2303 megasas_disable_intr(instance->reg_set);
2304
2305 free_irq(instance->pdev->irq, instance);
2306
2307 megasas_release_mfi(instance);
2308
2309 pci_free_consistent(pdev, sizeof(struct megasas_evt_detail),
2310 instance->evt_detail, instance->evt_detail_h);
2311
2312 pci_free_consistent(pdev, sizeof(u32), instance->producer,
2313 instance->producer_h);
2314
2315 pci_free_consistent(pdev, sizeof(u32), instance->consumer,
2316 instance->consumer_h);
2317
2318 scsi_host_put(host);
2319
2320 pci_set_drvdata(pdev, NULL);
2321
2322 pci_disable_device(pdev);
2323
2324 return;
2325}
2326
2327/**
2328 * megasas_shutdown - Shutdown entry point
2329 * @device: Generic device structure
2330 */
2331static void megasas_shutdown(struct pci_dev *pdev)
2332{
2333 struct megasas_instance *instance = pci_get_drvdata(pdev);
2334 megasas_flush_cache(instance);
2335}
2336
2337/**
2338 * megasas_mgmt_open - char node "open" entry point
2339 */
2340static int megasas_mgmt_open(struct inode *inode, struct file *filep)
2341{
2342 /*
2343 * Allow only those users with admin rights
2344 */
2345 if (!capable(CAP_SYS_ADMIN))
2346 return -EACCES;
2347
2348 return 0;
2349}
2350
2351/**
2352 * megasas_mgmt_release - char node "release" entry point
2353 */
2354static int megasas_mgmt_release(struct inode *inode, struct file *filep)
2355{
2356 filep->private_data = NULL;
2357 fasync_helper(-1, filep, 0, &megasas_async_queue);
2358
2359 return 0;
2360}
2361
2362/**
2363 * megasas_mgmt_fasync - Async notifier registration from applications
2364 *
2365 * This function adds the calling process to a driver global queue. When an
2366 * event occurs, SIGIO will be sent to all processes in this queue.
2367 */
2368static int megasas_mgmt_fasync(int fd, struct file *filep, int mode)
2369{
2370 int rc;
2371
2372 down(&megasas_async_queue_mutex);
2373
2374 rc = fasync_helper(fd, filep, mode, &megasas_async_queue);
2375
2376 up(&megasas_async_queue_mutex);
2377
2378 if (rc >= 0) {
2379 /* For sanity check when we get ioctl */
2380 filep->private_data = filep;
2381 return 0;
2382 }
2383
2384 printk(KERN_DEBUG "megasas: fasync_helper failed [%d]\n", rc);
2385
2386 return rc;
2387}
2388
2389/**
2390 * megasas_mgmt_fw_ioctl - Issues management ioctls to FW
2391 * @instance: Adapter soft state
2392 * @argp: User's ioctl packet
2393 */
2394static int
2395megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
2396 struct megasas_iocpacket __user * user_ioc,
2397 struct megasas_iocpacket *ioc)
2398{
2399 struct megasas_sge32 *kern_sge32;
2400 struct megasas_cmd *cmd;
2401 void *kbuff_arr[MAX_IOCTL_SGE];
2402 dma_addr_t buf_handle = 0;
2403 int error = 0, i;
2404 void *sense = NULL;
2405 dma_addr_t sense_handle;
2406 u32 *sense_ptr;
2407
2408 memset(kbuff_arr, 0, sizeof(kbuff_arr));
2409
2410 if (ioc->sge_count > MAX_IOCTL_SGE) {
2411 printk(KERN_DEBUG "megasas: SGE count [%d] > max limit [%d]\n",
2412 ioc->sge_count, MAX_IOCTL_SGE);
2413 return -EINVAL;
2414 }
2415
2416 cmd = megasas_get_cmd(instance);
2417 if (!cmd) {
2418 printk(KERN_DEBUG "megasas: Failed to get a cmd packet\n");
2419 return -ENOMEM;
2420 }
2421
2422 /*
2423 * User's IOCTL packet has 2 frames (maximum). Copy those two
2424 * frames into our cmd's frames. cmd->frame's context will get
2425 * overwritten when we copy from user's frames. So set that value
2426 * alone separately
2427 */
2428 memcpy(cmd->frame, ioc->frame.raw, 2 * MEGAMFI_FRAME_SIZE);
2429 cmd->frame->hdr.context = cmd->index;
2430
2431 /*
2432 * The management interface between applications and the fw uses
2433 * MFI frames. E.g, RAID configuration changes, LD property changes
2434 * etc are accomplishes through different kinds of MFI frames. The
2435 * driver needs to care only about substituting user buffers with
2436 * kernel buffers in SGLs. The location of SGL is embedded in the
2437 * struct iocpacket itself.
2438 */
2439 kern_sge32 = (struct megasas_sge32 *)
2440 ((unsigned long)cmd->frame + ioc->sgl_off);
2441
2442 /*
2443 * For each user buffer, create a mirror buffer and copy in
2444 */
2445 for (i = 0; i < ioc->sge_count; i++) {
2446 kbuff_arr[i] = pci_alloc_consistent(instance->pdev,
2447 ioc->sgl[i].iov_len,
2448 &buf_handle);
2449 if (!kbuff_arr[i]) {
2450 printk(KERN_DEBUG "megasas: Failed to alloc "
2451 "kernel SGL buffer for IOCTL \n");
2452 error = -ENOMEM;
2453 goto out;
2454 }
2455
2456 /*
2457 * We don't change the dma_coherent_mask, so
2458 * pci_alloc_consistent only returns 32bit addresses
2459 */
2460 kern_sge32[i].phys_addr = (u32) buf_handle;
2461 kern_sge32[i].length = ioc->sgl[i].iov_len;
2462
2463 /*
2464 * We created a kernel buffer corresponding to the
2465 * user buffer. Now copy in from the user buffer
2466 */
2467 if (copy_from_user(kbuff_arr[i], ioc->sgl[i].iov_base,
2468 (u32) (ioc->sgl[i].iov_len))) {
2469 error = -EFAULT;
2470 goto out;
2471 }
2472 }
2473
2474 if (ioc->sense_len) {
2475 sense = pci_alloc_consistent(instance->pdev, ioc->sense_len,
2476 &sense_handle);
2477 if (!sense) {
2478 error = -ENOMEM;
2479 goto out;
2480 }
2481
2482 sense_ptr =
2483 (u32 *) ((unsigned long)cmd->frame + ioc->sense_off);
2484 *sense_ptr = sense_handle;
2485 }
2486
2487 /*
2488 * Set the sync_cmd flag so that the ISR knows not to complete this
2489 * cmd to the SCSI mid-layer
2490 */
2491 cmd->sync_cmd = 1;
2492 megasas_issue_blocked_cmd(instance, cmd);
2493 cmd->sync_cmd = 0;
2494
2495 /*
2496 * copy out the kernel buffers to user buffers
2497 */
2498 for (i = 0; i < ioc->sge_count; i++) {
2499 if (copy_to_user(ioc->sgl[i].iov_base, kbuff_arr[i],
2500 ioc->sgl[i].iov_len)) {
2501 error = -EFAULT;
2502 goto out;
2503 }
2504 }
2505
2506 /*
2507 * copy out the sense
2508 */
2509 if (ioc->sense_len) {
2510 /*
2511 * sense_ptr points to the location that has the user
2512 * sense buffer address
2513 */
2514 sense_ptr = (u32 *) ((unsigned long)ioc->frame.raw +
2515 ioc->sense_off);
2516
2517 if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)),
2518 sense, ioc->sense_len)) {
2519 error = -EFAULT;
2520 goto out;
2521 }
2522 }
2523
2524 /*
2525 * copy the status codes returned by the fw
2526 */
2527 if (copy_to_user(&user_ioc->frame.hdr.cmd_status,
2528 &cmd->frame->hdr.cmd_status, sizeof(u8))) {
2529 printk(KERN_DEBUG "megasas: Error copying out cmd_status\n");
2530 error = -EFAULT;
2531 }
2532
2533 out:
2534 if (sense) {
2535 pci_free_consistent(instance->pdev, ioc->sense_len,
2536 sense, sense_handle);
2537 }
2538
2539 for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
2540 pci_free_consistent(instance->pdev,
2541 kern_sge32[i].length,
2542 kbuff_arr[i], kern_sge32[i].phys_addr);
2543 }
2544
2545 megasas_return_cmd(instance, cmd);
2546 return error;
2547}
2548
2549static struct megasas_instance *megasas_lookup_instance(u16 host_no)
2550{
2551 int i;
2552
2553 for (i = 0; i < megasas_mgmt_info.max_index; i++) {
2554
2555 if ((megasas_mgmt_info.instance[i]) &&
2556 (megasas_mgmt_info.instance[i]->host->host_no == host_no))
2557 return megasas_mgmt_info.instance[i];
2558 }
2559
2560 return NULL;
2561}
2562
2563static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
2564{
2565 struct megasas_iocpacket __user *user_ioc =
2566 (struct megasas_iocpacket __user *)arg;
2567 struct megasas_iocpacket *ioc;
2568 struct megasas_instance *instance;
2569 int error;
2570
2571 ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
2572 if (!ioc)
2573 return -ENOMEM;
2574
2575 if (copy_from_user(ioc, user_ioc, sizeof(*ioc))) {
2576 error = -EFAULT;
2577 goto out_kfree_ioc;
2578 }
2579
2580 instance = megasas_lookup_instance(ioc->host_no);
2581 if (!instance) {
2582 error = -ENODEV;
2583 goto out_kfree_ioc;
2584 }
2585
2586 /*
2587 * We will allow only MEGASAS_INT_CMDS number of parallel ioctl cmds
2588 */
2589 if (down_interruptible(&instance->ioctl_sem)) {
2590 error = -ERESTARTSYS;
2591 goto out_kfree_ioc;
2592 }
2593 error = megasas_mgmt_fw_ioctl(instance, user_ioc, ioc);
2594 up(&instance->ioctl_sem);
2595
2596 out_kfree_ioc:
2597 kfree(ioc);
2598 return error;
2599}
2600
2601static int megasas_mgmt_ioctl_aen(struct file *file, unsigned long arg)
2602{
2603 struct megasas_instance *instance;
2604 struct megasas_aen aen;
2605 int error;
2606
2607 if (file->private_data != file) {
2608 printk(KERN_DEBUG "megasas: fasync_helper was not "
2609 "called first\n");
2610 return -EINVAL;
2611 }
2612
2613 if (copy_from_user(&aen, (void __user *)arg, sizeof(aen)))
2614 return -EFAULT;
2615
2616 instance = megasas_lookup_instance(aen.host_no);
2617
2618 if (!instance)
2619 return -ENODEV;
2620
2621 down(&instance->aen_mutex);
2622 error = megasas_register_aen(instance, aen.seq_num,
2623 aen.class_locale_word);
2624 up(&instance->aen_mutex);
2625 return error;
2626}
2627
2628/**
2629 * megasas_mgmt_ioctl - char node ioctl entry point
2630 */
2631static long
2632megasas_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2633{
2634 switch (cmd) {
2635 case MEGASAS_IOC_FIRMWARE:
2636 return megasas_mgmt_ioctl_fw(file, arg);
2637
2638 case MEGASAS_IOC_GET_AEN:
2639 return megasas_mgmt_ioctl_aen(file, arg);
2640 }
2641
2642 return -ENOTTY;
2643}
2644
2645#ifdef CONFIG_COMPAT
2646static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
2647{
2648 struct compat_megasas_iocpacket __user *cioc =
2649 (struct compat_megasas_iocpacket __user *)arg;
2650 struct megasas_iocpacket __user *ioc =
2651 compat_alloc_user_space(sizeof(struct megasas_iocpacket));
2652 int i;
2653 int error = 0;
2654
2655 clear_user(ioc, sizeof(*ioc));
2656
2657 if (copy_in_user(&ioc->host_no, &cioc->host_no, sizeof(u16)) ||
2658 copy_in_user(&ioc->sgl_off, &cioc->sgl_off, sizeof(u32)) ||
2659 copy_in_user(&ioc->sense_off, &cioc->sense_off, sizeof(u32)) ||
2660 copy_in_user(&ioc->sense_len, &cioc->sense_len, sizeof(u32)) ||
2661 copy_in_user(ioc->frame.raw, cioc->frame.raw, 128) ||
2662 copy_in_user(&ioc->sge_count, &cioc->sge_count, sizeof(u32)))
2663 return -EFAULT;
2664
2665 for (i = 0; i < MAX_IOCTL_SGE; i++) {
2666 compat_uptr_t ptr;
2667
2668 if (get_user(ptr, &cioc->sgl[i].iov_base) ||
2669 put_user(compat_ptr(ptr), &ioc->sgl[i].iov_base) ||
2670 copy_in_user(&ioc->sgl[i].iov_len,
2671 &cioc->sgl[i].iov_len, sizeof(compat_size_t)))
2672 return -EFAULT;
2673 }
2674
2675 error = megasas_mgmt_ioctl_fw(file, (unsigned long)ioc);
2676
2677 if (copy_in_user(&cioc->frame.hdr.cmd_status,
2678 &ioc->frame.hdr.cmd_status, sizeof(u8))) {
2679 printk(KERN_DEBUG "megasas: error copy_in_user cmd_status\n");
2680 return -EFAULT;
2681 }
2682 return error;
2683}
2684
2685static long
2686megasas_mgmt_compat_ioctl(struct file *file, unsigned int cmd,
2687 unsigned long arg)
2688{
2689 switch (cmd) {
2690 case MEGASAS_IOC_FIRMWARE:{
2691 return megasas_mgmt_compat_ioctl_fw(file, arg);
2692 }
2693 case MEGASAS_IOC_GET_AEN:
2694 return megasas_mgmt_ioctl_aen(file, arg);
2695 }
2696
2697 return -ENOTTY;
2698}
2699#endif
2700
2701/*
2702 * File operations structure for management interface
2703 */
2704static struct file_operations megasas_mgmt_fops = {
2705 .owner = THIS_MODULE,
2706 .open = megasas_mgmt_open,
2707 .release = megasas_mgmt_release,
2708 .fasync = megasas_mgmt_fasync,
2709 .unlocked_ioctl = megasas_mgmt_ioctl,
2710#ifdef CONFIG_COMPAT
2711 .compat_ioctl = megasas_mgmt_compat_ioctl,
2712#endif
2713};
2714
2715/*
2716 * PCI hotplug support registration structure
2717 */
2718static struct pci_driver megasas_pci_driver = {
2719
2720 .name = "megaraid_sas",
2721 .id_table = megasas_pci_table,
2722 .probe = megasas_probe_one,
2723 .remove = __devexit_p(megasas_detach_one),
2724 .shutdown = megasas_shutdown,
2725};
2726
2727/*
2728 * Sysfs driver attributes
2729 */
2730static ssize_t megasas_sysfs_show_version(struct device_driver *dd, char *buf)
2731{
2732 return snprintf(buf, strlen(MEGASAS_VERSION) + 2, "%s\n",
2733 MEGASAS_VERSION);
2734}
2735
2736static DRIVER_ATTR(version, S_IRUGO, megasas_sysfs_show_version, NULL);
2737
2738static ssize_t
2739megasas_sysfs_show_release_date(struct device_driver *dd, char *buf)
2740{
2741 return snprintf(buf, strlen(MEGASAS_RELDATE) + 2, "%s\n",
2742 MEGASAS_RELDATE);
2743}
2744
2745static DRIVER_ATTR(release_date, S_IRUGO, megasas_sysfs_show_release_date,
2746 NULL);
2747
2748/**
2749 * megasas_init - Driver load entry point
2750 */
2751static int __init megasas_init(void)
2752{
2753 int rval;
2754
2755 /*
2756 * Announce driver version and other information
2757 */
2758 printk(KERN_INFO "megasas: %s %s\n", MEGASAS_VERSION,
2759 MEGASAS_EXT_VERSION);
2760
2761 memset(&megasas_mgmt_info, 0, sizeof(megasas_mgmt_info));
2762
2763 /*
2764 * Register character device node
2765 */
2766 rval = register_chrdev(0, "megaraid_sas_ioctl", &megasas_mgmt_fops);
2767
2768 if (rval < 0) {
2769 printk(KERN_DEBUG "megasas: failed to open device node\n");
2770 return rval;
2771 }
2772
2773 megasas_mgmt_majorno = rval;
2774
2775 /*
2776 * Register ourselves as PCI hotplug module
2777 */
2778 rval = pci_module_init(&megasas_pci_driver);
2779
2780 if (rval) {
2781 printk(KERN_DEBUG "megasas: PCI hotplug regisration failed \n");
2782 unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl");
2783 }
2784
2785 driver_create_file(&megasas_pci_driver.driver, &driver_attr_version);
2786 driver_create_file(&megasas_pci_driver.driver,
2787 &driver_attr_release_date);
2788
2789 return rval;
2790}
2791
2792/**
2793 * megasas_exit - Driver unload entry point
2794 */
2795static void __exit megasas_exit(void)
2796{
2797 driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
2798 driver_remove_file(&megasas_pci_driver.driver,
2799 &driver_attr_release_date);
2800
2801 pci_unregister_driver(&megasas_pci_driver);
2802 unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl");
2803}
2804
2805module_init(megasas_init);
2806module_exit(megasas_exit);
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
new file mode 100644
index 000000000000..eaec9d531424
--- /dev/null
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -0,0 +1,1142 @@
1/*
2 *
3 * Linux MegaRAID driver for SAS based RAID controllers
4 *
5 * Copyright (c) 2003-2005 LSI Logic Corporation.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * FILE : megaraid_sas.h
13 */
14
15#ifndef LSI_MEGARAID_SAS_H
16#define LSI_MEGARAID_SAS_H
17
18/**
19 * MegaRAID SAS Driver meta data
20 */
21#define MEGASAS_VERSION "00.00.02.00-rc4"
22#define MEGASAS_RELDATE "Sep 16, 2005"
23#define MEGASAS_EXT_VERSION "Fri Sep 16 12:37:08 EDT 2005"
24
25/*
26 * =====================================
27 * MegaRAID SAS MFI firmware definitions
28 * =====================================
29 */
30
31/*
32 * MFI stands for MegaRAID SAS FW Interface. This is just a moniker for
33 * protocol between the software and firmware. Commands are issued using
34 * "message frames"
35 */
36
37/**
38 * FW posts its state in upper 4 bits of outbound_msg_0 register
39 */
40#define MFI_STATE_MASK 0xF0000000
41#define MFI_STATE_UNDEFINED 0x00000000
42#define MFI_STATE_BB_INIT 0x10000000
43#define MFI_STATE_FW_INIT 0x40000000
44#define MFI_STATE_WAIT_HANDSHAKE 0x60000000
45#define MFI_STATE_FW_INIT_2 0x70000000
46#define MFI_STATE_DEVICE_SCAN 0x80000000
47#define MFI_STATE_FLUSH_CACHE 0xA0000000
48#define MFI_STATE_READY 0xB0000000
49#define MFI_STATE_OPERATIONAL 0xC0000000
50#define MFI_STATE_FAULT 0xF0000000
51
52#define MEGAMFI_FRAME_SIZE 64
53
54/**
55 * During FW init, clear pending cmds & reset state using inbound_msg_0
56 *
57 * ABORT : Abort all pending cmds
58 * READY : Move from OPERATIONAL to READY state; discard queue info
59 * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??)
60 * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver
61 */
62#define MFI_INIT_ABORT 0x00000000
63#define MFI_INIT_READY 0x00000002
64#define MFI_INIT_MFIMODE 0x00000004
65#define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
66#define MFI_RESET_FLAGS MFI_INIT_READY|MFI_INIT_MFIMODE
67
68/**
69 * MFI frame flags
70 */
71#define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000
72#define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001
73#define MFI_FRAME_SGL32 0x0000
74#define MFI_FRAME_SGL64 0x0002
75#define MFI_FRAME_SENSE32 0x0000
76#define MFI_FRAME_SENSE64 0x0004
77#define MFI_FRAME_DIR_NONE 0x0000
78#define MFI_FRAME_DIR_WRITE 0x0008
79#define MFI_FRAME_DIR_READ 0x0010
80#define MFI_FRAME_DIR_BOTH 0x0018
81
82/**
83 * Definition for cmd_status
84 */
85#define MFI_CMD_STATUS_POLL_MODE 0xFF
86
87/**
88 * MFI command opcodes
89 */
90#define MFI_CMD_INIT 0x00
91#define MFI_CMD_LD_READ 0x01
92#define MFI_CMD_LD_WRITE 0x02
93#define MFI_CMD_LD_SCSI_IO 0x03
94#define MFI_CMD_PD_SCSI_IO 0x04
95#define MFI_CMD_DCMD 0x05
96#define MFI_CMD_ABORT 0x06
97#define MFI_CMD_SMP 0x07
98#define MFI_CMD_STP 0x08
99
100#define MR_DCMD_CTRL_GET_INFO 0x01010000
101
102#define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000
103#define MR_FLUSH_CTRL_CACHE 0x01
104#define MR_FLUSH_DISK_CACHE 0x02
105
106#define MR_DCMD_CTRL_SHUTDOWN 0x01050000
107#define MR_ENABLE_DRIVE_SPINDOWN 0x01
108
109#define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100
110#define MR_DCMD_CTRL_EVENT_GET 0x01040300
111#define MR_DCMD_CTRL_EVENT_WAIT 0x01040500
112#define MR_DCMD_LD_GET_PROPERTIES 0x03030000
113
114#define MR_DCMD_CLUSTER 0x08000000
115#define MR_DCMD_CLUSTER_RESET_ALL 0x08010100
116#define MR_DCMD_CLUSTER_RESET_LD 0x08010200
117
118/**
119 * MFI command completion codes
120 */
121enum MFI_STAT {
122 MFI_STAT_OK = 0x00,
123 MFI_STAT_INVALID_CMD = 0x01,
124 MFI_STAT_INVALID_DCMD = 0x02,
125 MFI_STAT_INVALID_PARAMETER = 0x03,
126 MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04,
127 MFI_STAT_ABORT_NOT_POSSIBLE = 0x05,
128 MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06,
129 MFI_STAT_APP_IN_USE = 0x07,
130 MFI_STAT_APP_NOT_INITIALIZED = 0x08,
131 MFI_STAT_ARRAY_INDEX_INVALID = 0x09,
132 MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a,
133 MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b,
134 MFI_STAT_DEVICE_NOT_FOUND = 0x0c,
135 MFI_STAT_DRIVE_TOO_SMALL = 0x0d,
136 MFI_STAT_FLASH_ALLOC_FAIL = 0x0e,
137 MFI_STAT_FLASH_BUSY = 0x0f,
138 MFI_STAT_FLASH_ERROR = 0x10,
139 MFI_STAT_FLASH_IMAGE_BAD = 0x11,
140 MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12,
141 MFI_STAT_FLASH_NOT_OPEN = 0x13,
142 MFI_STAT_FLASH_NOT_STARTED = 0x14,
143 MFI_STAT_FLUSH_FAILED = 0x15,
144 MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16,
145 MFI_STAT_LD_CC_IN_PROGRESS = 0x17,
146 MFI_STAT_LD_INIT_IN_PROGRESS = 0x18,
147 MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19,
148 MFI_STAT_LD_MAX_CONFIGURED = 0x1a,
149 MFI_STAT_LD_NOT_OPTIMAL = 0x1b,
150 MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c,
151 MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d,
152 MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e,
153 MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f,
154 MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20,
155 MFI_STAT_MFC_HW_ERROR = 0x21,
156 MFI_STAT_NO_HW_PRESENT = 0x22,
157 MFI_STAT_NOT_FOUND = 0x23,
158 MFI_STAT_NOT_IN_ENCL = 0x24,
159 MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25,
160 MFI_STAT_PD_TYPE_WRONG = 0x26,
161 MFI_STAT_PR_DISABLED = 0x27,
162 MFI_STAT_ROW_INDEX_INVALID = 0x28,
163 MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29,
164 MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a,
165 MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b,
166 MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c,
167 MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d,
168 MFI_STAT_SCSI_IO_FAILED = 0x2e,
169 MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f,
170 MFI_STAT_SHUTDOWN_FAILED = 0x30,
171 MFI_STAT_TIME_NOT_SET = 0x31,
172 MFI_STAT_WRONG_STATE = 0x32,
173 MFI_STAT_LD_OFFLINE = 0x33,
174 MFI_STAT_PEER_NOTIFICATION_REJECTED = 0x34,
175 MFI_STAT_PEER_NOTIFICATION_FAILED = 0x35,
176 MFI_STAT_RESERVATION_IN_PROGRESS = 0x36,
177 MFI_STAT_I2C_ERRORS_DETECTED = 0x37,
178 MFI_STAT_PCI_ERRORS_DETECTED = 0x38,
179
180 MFI_STAT_INVALID_STATUS = 0xFF
181};
182
183/*
184 * Number of mailbox bytes in DCMD message frame
185 */
186#define MFI_MBOX_SIZE 12
187
188enum MR_EVT_CLASS {
189
190 MR_EVT_CLASS_DEBUG = -2,
191 MR_EVT_CLASS_PROGRESS = -1,
192 MR_EVT_CLASS_INFO = 0,
193 MR_EVT_CLASS_WARNING = 1,
194 MR_EVT_CLASS_CRITICAL = 2,
195 MR_EVT_CLASS_FATAL = 3,
196 MR_EVT_CLASS_DEAD = 4,
197
198};
199
200enum MR_EVT_LOCALE {
201
202 MR_EVT_LOCALE_LD = 0x0001,
203 MR_EVT_LOCALE_PD = 0x0002,
204 MR_EVT_LOCALE_ENCL = 0x0004,
205 MR_EVT_LOCALE_BBU = 0x0008,
206 MR_EVT_LOCALE_SAS = 0x0010,
207 MR_EVT_LOCALE_CTRL = 0x0020,
208 MR_EVT_LOCALE_CONFIG = 0x0040,
209 MR_EVT_LOCALE_CLUSTER = 0x0080,
210 MR_EVT_LOCALE_ALL = 0xffff,
211
212};
213
214enum MR_EVT_ARGS {
215
216 MR_EVT_ARGS_NONE,
217 MR_EVT_ARGS_CDB_SENSE,
218 MR_EVT_ARGS_LD,
219 MR_EVT_ARGS_LD_COUNT,
220 MR_EVT_ARGS_LD_LBA,
221 MR_EVT_ARGS_LD_OWNER,
222 MR_EVT_ARGS_LD_LBA_PD_LBA,
223 MR_EVT_ARGS_LD_PROG,
224 MR_EVT_ARGS_LD_STATE,
225 MR_EVT_ARGS_LD_STRIP,
226 MR_EVT_ARGS_PD,
227 MR_EVT_ARGS_PD_ERR,
228 MR_EVT_ARGS_PD_LBA,
229 MR_EVT_ARGS_PD_LBA_LD,
230 MR_EVT_ARGS_PD_PROG,
231 MR_EVT_ARGS_PD_STATE,
232 MR_EVT_ARGS_PCI,
233 MR_EVT_ARGS_RATE,
234 MR_EVT_ARGS_STR,
235 MR_EVT_ARGS_TIME,
236 MR_EVT_ARGS_ECC,
237
238};
239
240/*
241 * SAS controller properties
242 */
243struct megasas_ctrl_prop {
244
245 u16 seq_num;
246 u16 pred_fail_poll_interval;
247 u16 intr_throttle_count;
248 u16 intr_throttle_timeouts;
249 u8 rebuild_rate;
250 u8 patrol_read_rate;
251 u8 bgi_rate;
252 u8 cc_rate;
253 u8 recon_rate;
254 u8 cache_flush_interval;
255 u8 spinup_drv_count;
256 u8 spinup_delay;
257 u8 cluster_enable;
258 u8 coercion_mode;
259 u8 alarm_enable;
260 u8 disable_auto_rebuild;
261 u8 disable_battery_warn;
262 u8 ecc_bucket_size;
263 u16 ecc_bucket_leak_rate;
264 u8 restore_hotspare_on_insertion;
265 u8 expose_encl_devices;
266 u8 reserved[38];
267
268} __attribute__ ((packed));
269
270/*
271 * SAS controller information
272 */
273struct megasas_ctrl_info {
274
275 /*
276 * PCI device information
277 */
278 struct {
279
280 u16 vendor_id;
281 u16 device_id;
282 u16 sub_vendor_id;
283 u16 sub_device_id;
284 u8 reserved[24];
285
286 } __attribute__ ((packed)) pci;
287
288 /*
289 * Host interface information
290 */
291 struct {
292
293 u8 PCIX:1;
294 u8 PCIE:1;
295 u8 iSCSI:1;
296 u8 SAS_3G:1;
297 u8 reserved_0:4;
298 u8 reserved_1[6];
299 u8 port_count;
300 u64 port_addr[8];
301
302 } __attribute__ ((packed)) host_interface;
303
304 /*
305 * Device (backend) interface information
306 */
307 struct {
308
309 u8 SPI:1;
310 u8 SAS_3G:1;
311 u8 SATA_1_5G:1;
312 u8 SATA_3G:1;
313 u8 reserved_0:4;
314 u8 reserved_1[6];
315 u8 port_count;
316 u64 port_addr[8];
317
318 } __attribute__ ((packed)) device_interface;
319
320 /*
321 * List of components residing in flash. All str are null terminated
322 */
323 u32 image_check_word;
324 u32 image_component_count;
325
326 struct {
327
328 char name[8];
329 char version[32];
330 char build_date[16];
331 char built_time[16];
332
333 } __attribute__ ((packed)) image_component[8];
334
335 /*
336 * List of flash components that have been flashed on the card, but
337 * are not in use, pending reset of the adapter. This list will be
338 * empty if a flash operation has not occurred. All stings are null
339 * terminated
340 */
341 u32 pending_image_component_count;
342
343 struct {
344
345 char name[8];
346 char version[32];
347 char build_date[16];
348 char build_time[16];
349
350 } __attribute__ ((packed)) pending_image_component[8];
351
352 u8 max_arms;
353 u8 max_spans;
354 u8 max_arrays;
355 u8 max_lds;
356
357 char product_name[80];
358 char serial_no[32];
359
360 /*
361 * Other physical/controller/operation information. Indicates the
362 * presence of the hardware
363 */
364 struct {
365
366 u32 bbu:1;
367 u32 alarm:1;
368 u32 nvram:1;
369 u32 uart:1;
370 u32 reserved:28;
371
372 } __attribute__ ((packed)) hw_present;
373
374 u32 current_fw_time;
375
376 /*
377 * Maximum data transfer sizes
378 */
379 u16 max_concurrent_cmds;
380 u16 max_sge_count;
381 u32 max_request_size;
382
383 /*
384 * Logical and physical device counts
385 */
386 u16 ld_present_count;
387 u16 ld_degraded_count;
388 u16 ld_offline_count;
389
390 u16 pd_present_count;
391 u16 pd_disk_present_count;
392 u16 pd_disk_pred_failure_count;
393 u16 pd_disk_failed_count;
394
395 /*
396 * Memory size information
397 */
398 u16 nvram_size;
399 u16 memory_size;
400 u16 flash_size;
401
402 /*
403 * Error counters
404 */
405 u16 mem_correctable_error_count;
406 u16 mem_uncorrectable_error_count;
407
408 /*
409 * Cluster information
410 */
411 u8 cluster_permitted;
412 u8 cluster_active;
413
414 /*
415 * Additional max data transfer sizes
416 */
417 u16 max_strips_per_io;
418
419 /*
420 * Controller capabilities structures
421 */
422 struct {
423
424 u32 raid_level_0:1;
425 u32 raid_level_1:1;
426 u32 raid_level_5:1;
427 u32 raid_level_1E:1;
428 u32 raid_level_6:1;
429 u32 reserved:27;
430
431 } __attribute__ ((packed)) raid_levels;
432
433 struct {
434
435 u32 rbld_rate:1;
436 u32 cc_rate:1;
437 u32 bgi_rate:1;
438 u32 recon_rate:1;
439 u32 patrol_rate:1;
440 u32 alarm_control:1;
441 u32 cluster_supported:1;
442 u32 bbu:1;
443 u32 spanning_allowed:1;
444 u32 dedicated_hotspares:1;
445 u32 revertible_hotspares:1;
446 u32 foreign_config_import:1;
447 u32 self_diagnostic:1;
448 u32 mixed_redundancy_arr:1;
449 u32 global_hot_spares:1;
450 u32 reserved:17;
451
452 } __attribute__ ((packed)) adapter_operations;
453
454 struct {
455
456 u32 read_policy:1;
457 u32 write_policy:1;
458 u32 io_policy:1;
459 u32 access_policy:1;
460 u32 disk_cache_policy:1;
461 u32 reserved:27;
462
463 } __attribute__ ((packed)) ld_operations;
464
465 struct {
466
467 u8 min;
468 u8 max;
469 u8 reserved[2];
470
471 } __attribute__ ((packed)) stripe_sz_ops;
472
473 struct {
474
475 u32 force_online:1;
476 u32 force_offline:1;
477 u32 force_rebuild:1;
478 u32 reserved:29;
479
480 } __attribute__ ((packed)) pd_operations;
481
482 struct {
483
484 u32 ctrl_supports_sas:1;
485 u32 ctrl_supports_sata:1;
486 u32 allow_mix_in_encl:1;
487 u32 allow_mix_in_ld:1;
488 u32 allow_sata_in_cluster:1;
489 u32 reserved:27;
490
491 } __attribute__ ((packed)) pd_mix_support;
492
493 /*
494 * Define ECC single-bit-error bucket information
495 */
496 u8 ecc_bucket_count;
497 u8 reserved_2[11];
498
499 /*
500 * Include the controller properties (changeable items)
501 */
502 struct megasas_ctrl_prop properties;
503
504 /*
505 * Define FW pkg version (set in envt v'bles on OEM basis)
506 */
507 char package_version[0x60];
508
509 u8 pad[0x800 - 0x6a0];
510
511} __attribute__ ((packed));
512
513/*
514 * ===============================
515 * MegaRAID SAS driver definitions
516 * ===============================
517 */
518#define MEGASAS_MAX_PD_CHANNELS 2
519#define MEGASAS_MAX_LD_CHANNELS 2
520#define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \
521 MEGASAS_MAX_LD_CHANNELS)
522#define MEGASAS_MAX_DEV_PER_CHANNEL 128
523#define MEGASAS_DEFAULT_INIT_ID -1
524#define MEGASAS_MAX_LUN 8
525#define MEGASAS_MAX_LD 64
526
527/*
528 * When SCSI mid-layer calls driver's reset routine, driver waits for
529 * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note
530 * that the driver cannot _actually_ abort or reset pending commands. While
531 * it is waiting for the commands to complete, it prints a diagnostic message
532 * every MEGASAS_RESET_NOTICE_INTERVAL seconds
533 */
534#define MEGASAS_RESET_WAIT_TIME 180
535#define MEGASAS_RESET_NOTICE_INTERVAL 5
536
537#define MEGASAS_IOCTL_CMD 0
538
539/*
540 * FW reports the maximum of number of commands that it can accept (maximum
541 * commands that can be outstanding) at any time. The driver must report a
542 * lower number to the mid layer because it can issue a few internal commands
543 * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs
544 * is shown below
545 */
546#define MEGASAS_INT_CMDS 32
547
548/*
549 * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit
550 * SGLs based on the size of dma_addr_t
551 */
552#define IS_DMA64 (sizeof(dma_addr_t) == 8)
553
554#define MFI_OB_INTR_STATUS_MASK 0x00000002
555#define MFI_POLL_TIMEOUT_SECS 10
556
557struct megasas_register_set {
558
559 u32 reserved_0[4]; /*0000h */
560
561 u32 inbound_msg_0; /*0010h */
562 u32 inbound_msg_1; /*0014h */
563 u32 outbound_msg_0; /*0018h */
564 u32 outbound_msg_1; /*001Ch */
565
566 u32 inbound_doorbell; /*0020h */
567 u32 inbound_intr_status; /*0024h */
568 u32 inbound_intr_mask; /*0028h */
569
570 u32 outbound_doorbell; /*002Ch */
571 u32 outbound_intr_status; /*0030h */
572 u32 outbound_intr_mask; /*0034h */
573
574 u32 reserved_1[2]; /*0038h */
575
576 u32 inbound_queue_port; /*0040h */
577 u32 outbound_queue_port; /*0044h */
578
579 u32 reserved_2; /*004Ch */
580
581 u32 index_registers[1004]; /*0050h */
582
583} __attribute__ ((packed));
584
585struct megasas_sge32 {
586
587 u32 phys_addr;
588 u32 length;
589
590} __attribute__ ((packed));
591
592struct megasas_sge64 {
593
594 u64 phys_addr;
595 u32 length;
596
597} __attribute__ ((packed));
598
599union megasas_sgl {
600
601 struct megasas_sge32 sge32[1];
602 struct megasas_sge64 sge64[1];
603
604} __attribute__ ((packed));
605
606struct megasas_header {
607
608 u8 cmd; /*00h */
609 u8 sense_len; /*01h */
610 u8 cmd_status; /*02h */
611 u8 scsi_status; /*03h */
612
613 u8 target_id; /*04h */
614 u8 lun; /*05h */
615 u8 cdb_len; /*06h */
616 u8 sge_count; /*07h */
617
618 u32 context; /*08h */
619 u32 pad_0; /*0Ch */
620
621 u16 flags; /*10h */
622 u16 timeout; /*12h */
623 u32 data_xferlen; /*14h */
624
625} __attribute__ ((packed));
626
627union megasas_sgl_frame {
628
629 struct megasas_sge32 sge32[8];
630 struct megasas_sge64 sge64[5];
631
632} __attribute__ ((packed));
633
634struct megasas_init_frame {
635
636 u8 cmd; /*00h */
637 u8 reserved_0; /*01h */
638 u8 cmd_status; /*02h */
639
640 u8 reserved_1; /*03h */
641 u32 reserved_2; /*04h */
642
643 u32 context; /*08h */
644 u32 pad_0; /*0Ch */
645
646 u16 flags; /*10h */
647 u16 reserved_3; /*12h */
648 u32 data_xfer_len; /*14h */
649
650 u32 queue_info_new_phys_addr_lo; /*18h */
651 u32 queue_info_new_phys_addr_hi; /*1Ch */
652 u32 queue_info_old_phys_addr_lo; /*20h */
653 u32 queue_info_old_phys_addr_hi; /*24h */
654
655 u32 reserved_4[6]; /*28h */
656
657} __attribute__ ((packed));
658
659struct megasas_init_queue_info {
660
661 u32 init_flags; /*00h */
662 u32 reply_queue_entries; /*04h */
663
664 u32 reply_queue_start_phys_addr_lo; /*08h */
665 u32 reply_queue_start_phys_addr_hi; /*0Ch */
666 u32 producer_index_phys_addr_lo; /*10h */
667 u32 producer_index_phys_addr_hi; /*14h */
668 u32 consumer_index_phys_addr_lo; /*18h */
669 u32 consumer_index_phys_addr_hi; /*1Ch */
670
671} __attribute__ ((packed));
672
673struct megasas_io_frame {
674
675 u8 cmd; /*00h */
676 u8 sense_len; /*01h */
677 u8 cmd_status; /*02h */
678 u8 scsi_status; /*03h */
679
680 u8 target_id; /*04h */
681 u8 access_byte; /*05h */
682 u8 reserved_0; /*06h */
683 u8 sge_count; /*07h */
684
685 u32 context; /*08h */
686 u32 pad_0; /*0Ch */
687
688 u16 flags; /*10h */
689 u16 timeout; /*12h */
690 u32 lba_count; /*14h */
691
692 u32 sense_buf_phys_addr_lo; /*18h */
693 u32 sense_buf_phys_addr_hi; /*1Ch */
694
695 u32 start_lba_lo; /*20h */
696 u32 start_lba_hi; /*24h */
697
698 union megasas_sgl sgl; /*28h */
699
700} __attribute__ ((packed));
701
702struct megasas_pthru_frame {
703
704 u8 cmd; /*00h */
705 u8 sense_len; /*01h */
706 u8 cmd_status; /*02h */
707 u8 scsi_status; /*03h */
708
709 u8 target_id; /*04h */
710 u8 lun; /*05h */
711 u8 cdb_len; /*06h */
712 u8 sge_count; /*07h */
713
714 u32 context; /*08h */
715 u32 pad_0; /*0Ch */
716
717 u16 flags; /*10h */
718 u16 timeout; /*12h */
719 u32 data_xfer_len; /*14h */
720
721 u32 sense_buf_phys_addr_lo; /*18h */
722 u32 sense_buf_phys_addr_hi; /*1Ch */
723
724 u8 cdb[16]; /*20h */
725 union megasas_sgl sgl; /*30h */
726
727} __attribute__ ((packed));
728
729struct megasas_dcmd_frame {
730
731 u8 cmd; /*00h */
732 u8 reserved_0; /*01h */
733 u8 cmd_status; /*02h */
734 u8 reserved_1[4]; /*03h */
735 u8 sge_count; /*07h */
736
737 u32 context; /*08h */
738 u32 pad_0; /*0Ch */
739
740 u16 flags; /*10h */
741 u16 timeout; /*12h */
742
743 u32 data_xfer_len; /*14h */
744 u32 opcode; /*18h */
745
746 union { /*1Ch */
747 u8 b[12];
748 u16 s[6];
749 u32 w[3];
750 } mbox;
751
752 union megasas_sgl sgl; /*28h */
753
754} __attribute__ ((packed));
755
756struct megasas_abort_frame {
757
758 u8 cmd; /*00h */
759 u8 reserved_0; /*01h */
760 u8 cmd_status; /*02h */
761
762 u8 reserved_1; /*03h */
763 u32 reserved_2; /*04h */
764
765 u32 context; /*08h */
766 u32 pad_0; /*0Ch */
767
768 u16 flags; /*10h */
769 u16 reserved_3; /*12h */
770 u32 reserved_4; /*14h */
771
772 u32 abort_context; /*18h */
773 u32 pad_1; /*1Ch */
774
775 u32 abort_mfi_phys_addr_lo; /*20h */
776 u32 abort_mfi_phys_addr_hi; /*24h */
777
778 u32 reserved_5[6]; /*28h */
779
780} __attribute__ ((packed));
781
782struct megasas_smp_frame {
783
784 u8 cmd; /*00h */
785 u8 reserved_1; /*01h */
786 u8 cmd_status; /*02h */
787 u8 connection_status; /*03h */
788
789 u8 reserved_2[3]; /*04h */
790 u8 sge_count; /*07h */
791
792 u32 context; /*08h */
793 u32 pad_0; /*0Ch */
794
795 u16 flags; /*10h */
796 u16 timeout; /*12h */
797
798 u32 data_xfer_len; /*14h */
799 u64 sas_addr; /*18h */
800
801 union {
802 struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */
803 struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */
804 } sgl;
805
806} __attribute__ ((packed));
807
808struct megasas_stp_frame {
809
810 u8 cmd; /*00h */
811 u8 reserved_1; /*01h */
812 u8 cmd_status; /*02h */
813 u8 reserved_2; /*03h */
814
815 u8 target_id; /*04h */
816 u8 reserved_3[2]; /*05h */
817 u8 sge_count; /*07h */
818
819 u32 context; /*08h */
820 u32 pad_0; /*0Ch */
821
822 u16 flags; /*10h */
823 u16 timeout; /*12h */
824
825 u32 data_xfer_len; /*14h */
826
827 u16 fis[10]; /*18h */
828 u32 stp_flags;
829
830 union {
831 struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */
832 struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */
833 } sgl;
834
835} __attribute__ ((packed));
836
837union megasas_frame {
838
839 struct megasas_header hdr;
840 struct megasas_init_frame init;
841 struct megasas_io_frame io;
842 struct megasas_pthru_frame pthru;
843 struct megasas_dcmd_frame dcmd;
844 struct megasas_abort_frame abort;
845 struct megasas_smp_frame smp;
846 struct megasas_stp_frame stp;
847
848 u8 raw_bytes[64];
849};
850
851struct megasas_cmd;
852
853union megasas_evt_class_locale {
854
855 struct {
856 u16 locale;
857 u8 reserved;
858 s8 class;
859 } __attribute__ ((packed)) members;
860
861 u32 word;
862
863} __attribute__ ((packed));
864
865struct megasas_evt_log_info {
866 u32 newest_seq_num;
867 u32 oldest_seq_num;
868 u32 clear_seq_num;
869 u32 shutdown_seq_num;
870 u32 boot_seq_num;
871
872} __attribute__ ((packed));
873
874struct megasas_progress {
875
876 u16 progress;
877 u16 elapsed_seconds;
878
879} __attribute__ ((packed));
880
881struct megasas_evtarg_ld {
882
883 u16 target_id;
884 u8 ld_index;
885 u8 reserved;
886
887} __attribute__ ((packed));
888
889struct megasas_evtarg_pd {
890 u16 device_id;
891 u8 encl_index;
892 u8 slot_number;
893
894} __attribute__ ((packed));
895
896struct megasas_evt_detail {
897
898 u32 seq_num;
899 u32 time_stamp;
900 u32 code;
901 union megasas_evt_class_locale cl;
902 u8 arg_type;
903 u8 reserved1[15];
904
905 union {
906 struct {
907 struct megasas_evtarg_pd pd;
908 u8 cdb_length;
909 u8 sense_length;
910 u8 reserved[2];
911 u8 cdb[16];
912 u8 sense[64];
913 } __attribute__ ((packed)) cdbSense;
914
915 struct megasas_evtarg_ld ld;
916
917 struct {
918 struct megasas_evtarg_ld ld;
919 u64 count;
920 } __attribute__ ((packed)) ld_count;
921
922 struct {
923 u64 lba;
924 struct megasas_evtarg_ld ld;
925 } __attribute__ ((packed)) ld_lba;
926
927 struct {
928 struct megasas_evtarg_ld ld;
929 u32 prevOwner;
930 u32 newOwner;
931 } __attribute__ ((packed)) ld_owner;
932
933 struct {
934 u64 ld_lba;
935 u64 pd_lba;
936 struct megasas_evtarg_ld ld;
937 struct megasas_evtarg_pd pd;
938 } __attribute__ ((packed)) ld_lba_pd_lba;
939
940 struct {
941 struct megasas_evtarg_ld ld;
942 struct megasas_progress prog;
943 } __attribute__ ((packed)) ld_prog;
944
945 struct {
946 struct megasas_evtarg_ld ld;
947 u32 prev_state;
948 u32 new_state;
949 } __attribute__ ((packed)) ld_state;
950
951 struct {
952 u64 strip;
953 struct megasas_evtarg_ld ld;
954 } __attribute__ ((packed)) ld_strip;
955
956 struct megasas_evtarg_pd pd;
957
958 struct {
959 struct megasas_evtarg_pd pd;
960 u32 err;
961 } __attribute__ ((packed)) pd_err;
962
963 struct {
964 u64 lba;
965 struct megasas_evtarg_pd pd;
966 } __attribute__ ((packed)) pd_lba;
967
968 struct {
969 u64 lba;
970 struct megasas_evtarg_pd pd;
971 struct megasas_evtarg_ld ld;
972 } __attribute__ ((packed)) pd_lba_ld;
973
974 struct {
975 struct megasas_evtarg_pd pd;
976 struct megasas_progress prog;
977 } __attribute__ ((packed)) pd_prog;
978
979 struct {
980 struct megasas_evtarg_pd pd;
981 u32 prevState;
982 u32 newState;
983 } __attribute__ ((packed)) pd_state;
984
985 struct {
986 u16 vendorId;
987 u16 deviceId;
988 u16 subVendorId;
989 u16 subDeviceId;
990 } __attribute__ ((packed)) pci;
991
992 u32 rate;
993 char str[96];
994
995 struct {
996 u32 rtc;
997 u32 elapsedSeconds;
998 } __attribute__ ((packed)) time;
999
1000 struct {
1001 u32 ecar;
1002 u32 elog;
1003 char str[64];
1004 } __attribute__ ((packed)) ecc;
1005
1006 u8 b[96];
1007 u16 s[48];
1008 u32 w[24];
1009 u64 d[12];
1010 } args;
1011
1012 char description[128];
1013
1014} __attribute__ ((packed));
1015
1016struct megasas_instance {
1017
1018 u32 *producer;
1019 dma_addr_t producer_h;
1020 u32 *consumer;
1021 dma_addr_t consumer_h;
1022
1023 u32 *reply_queue;
1024 dma_addr_t reply_queue_h;
1025
1026 unsigned long base_addr;
1027 struct megasas_register_set __iomem *reg_set;
1028
1029 s8 init_id;
1030 u8 reserved[3];
1031
1032 u16 max_num_sge;
1033 u16 max_fw_cmds;
1034 u32 max_sectors_per_req;
1035
1036 struct megasas_cmd **cmd_list;
1037 struct list_head cmd_pool;
1038 spinlock_t cmd_pool_lock;
1039 struct dma_pool *frame_dma_pool;
1040 struct dma_pool *sense_dma_pool;
1041
1042 struct megasas_evt_detail *evt_detail;
1043 dma_addr_t evt_detail_h;
1044 struct megasas_cmd *aen_cmd;
1045 struct semaphore aen_mutex;
1046 struct semaphore ioctl_sem;
1047
1048 struct Scsi_Host *host;
1049
1050 wait_queue_head_t int_cmd_wait_q;
1051 wait_queue_head_t abort_cmd_wait_q;
1052
1053 struct pci_dev *pdev;
1054 u32 unique_id;
1055
1056 u32 fw_outstanding;
1057 u32 hw_crit_error;
1058 spinlock_t instance_lock;
1059};
1060
1061#define MEGASAS_IS_LOGICAL(scp) \
1062 (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
1063
1064#define MEGASAS_DEV_INDEX(inst, scp) \
1065 ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
1066 scp->device->id
1067
1068struct megasas_cmd {
1069
1070 union megasas_frame *frame;
1071 dma_addr_t frame_phys_addr;
1072 u8 *sense;
1073 dma_addr_t sense_phys_addr;
1074
1075 u32 index;
1076 u8 sync_cmd;
1077 u8 cmd_status;
1078 u16 abort_aen;
1079
1080 struct list_head list;
1081 struct scsi_cmnd *scmd;
1082 struct megasas_instance *instance;
1083 u32 frame_count;
1084};
1085
1086#define MAX_MGMT_ADAPTERS 1024
1087#define MAX_IOCTL_SGE 16
1088
1089struct megasas_iocpacket {
1090
1091 u16 host_no;
1092 u16 __pad1;
1093 u32 sgl_off;
1094 u32 sge_count;
1095 u32 sense_off;
1096 u32 sense_len;
1097 union {
1098 u8 raw[128];
1099 struct megasas_header hdr;
1100 } frame;
1101
1102 struct iovec sgl[MAX_IOCTL_SGE];
1103
1104} __attribute__ ((packed));
1105
1106struct megasas_aen {
1107 u16 host_no;
1108 u16 __pad1;
1109 u32 seq_num;
1110 u32 class_locale_word;
1111} __attribute__ ((packed));
1112
1113#ifdef CONFIG_COMPAT
1114struct compat_megasas_iocpacket {
1115 u16 host_no;
1116 u16 __pad1;
1117 u32 sgl_off;
1118 u32 sge_count;
1119 u32 sense_off;
1120 u32 sense_len;
1121 union {
1122 u8 raw[128];
1123 struct megasas_header hdr;
1124 } frame;
1125 struct compat_iovec sgl[MAX_IOCTL_SGE];
1126} __attribute__ ((packed));
1127
1128#define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct compat_megasas_iocpacket)
1129#else
1130#define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket)
1131#endif
1132
1133#define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen)
1134
1135struct megasas_mgmt_info {
1136
1137 u16 count;
1138 struct megasas_instance *instance[MAX_MGMT_ADAPTERS];
1139 int max_index;
1140};
1141
1142#endif /*LSI_MEGARAID_SAS_H */
diff --git a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c
index bdc3bc74bbe1..1eba98828636 100644
--- a/drivers/scsi/qla2xxx/qla_rscn.c
+++ b/drivers/scsi/qla2xxx/qla_rscn.c
@@ -330,6 +330,8 @@ qla2x00_update_login_fcport(scsi_qla_host_t *ha, struct mbx_entry *mbxstat,
330 fcport->flags &= ~FCF_FAILOVER_NEEDED; 330 fcport->flags &= ~FCF_FAILOVER_NEEDED;
331 fcport->iodesc_idx_sent = IODESC_INVALID_INDEX; 331 fcport->iodesc_idx_sent = IODESC_INVALID_INDEX;
332 atomic_set(&fcport->state, FCS_ONLINE); 332 atomic_set(&fcport->state, FCS_ONLINE);
333 if (fcport->rport)
334 fc_remote_port_unblock(fcport->rport);
333} 335}
334 336
335 337
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index fcf9f6cbb142..327c5d7e5bd2 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -587,6 +587,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result,
587 if (sdev->scsi_level >= 2 || 587 if (sdev->scsi_level >= 2 ||
588 (sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1)) 588 (sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1))
589 sdev->scsi_level++; 589 sdev->scsi_level++;
590 sdev->sdev_target->scsi_level = sdev->scsi_level;
590 591
591 return 0; 592 return 0;
592} 593}
@@ -771,6 +772,15 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
771 return SCSI_SCAN_LUN_PRESENT; 772 return SCSI_SCAN_LUN_PRESENT;
772} 773}
773 774
775static inline void scsi_destroy_sdev(struct scsi_device *sdev)
776{
777 if (sdev->host->hostt->slave_destroy)
778 sdev->host->hostt->slave_destroy(sdev);
779 transport_destroy_device(&sdev->sdev_gendev);
780 put_device(&sdev->sdev_gendev);
781}
782
783
774/** 784/**
775 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it 785 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
776 * @starget: pointer to target device structure 786 * @starget: pointer to target device structure
@@ -803,9 +813,9 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
803 * The rescan flag is used as an optimization, the first scan of a 813 * The rescan flag is used as an optimization, the first scan of a
804 * host adapter calls into here with rescan == 0. 814 * host adapter calls into here with rescan == 0.
805 */ 815 */
806 if (rescan) { 816 sdev = scsi_device_lookup_by_target(starget, lun);
807 sdev = scsi_device_lookup_by_target(starget, lun); 817 if (sdev) {
808 if (sdev) { 818 if (rescan || sdev->sdev_state != SDEV_CREATED) {
809 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO 819 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
810 "scsi scan: device exists on %s\n", 820 "scsi scan: device exists on %s\n",
811 sdev->sdev_gendev.bus_id)); 821 sdev->sdev_gendev.bus_id));
@@ -820,9 +830,9 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
820 sdev->model); 830 sdev->model);
821 return SCSI_SCAN_LUN_PRESENT; 831 return SCSI_SCAN_LUN_PRESENT;
822 } 832 }
823 } 833 scsi_device_put(sdev);
824 834 } else
825 sdev = scsi_alloc_sdev(starget, lun, hostdata); 835 sdev = scsi_alloc_sdev(starget, lun, hostdata);
826 if (!sdev) 836 if (!sdev)
827 goto out; 837 goto out;
828 838
@@ -877,12 +887,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
877 res = SCSI_SCAN_NO_RESPONSE; 887 res = SCSI_SCAN_NO_RESPONSE;
878 } 888 }
879 } 889 }
880 } else { 890 } else
881 if (sdev->host->hostt->slave_destroy) 891 scsi_destroy_sdev(sdev);
882 sdev->host->hostt->slave_destroy(sdev);
883 transport_destroy_device(&sdev->sdev_gendev);
884 put_device(&sdev->sdev_gendev);
885 }
886 out: 892 out:
887 return res; 893 return res;
888} 894}
@@ -1054,7 +1060,7 @@ EXPORT_SYMBOL(int_to_scsilun);
1054 * 0: scan completed (or no memory, so further scanning is futile) 1060 * 0: scan completed (or no memory, so further scanning is futile)
1055 * 1: no report lun scan, or not configured 1061 * 1: no report lun scan, or not configured
1056 **/ 1062 **/
1057static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, 1063static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1058 int rescan) 1064 int rescan)
1059{ 1065{
1060 char devname[64]; 1066 char devname[64];
@@ -1067,7 +1073,8 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
1067 struct scsi_lun *lunp, *lun_data; 1073 struct scsi_lun *lunp, *lun_data;
1068 u8 *data; 1074 u8 *data;
1069 struct scsi_sense_hdr sshdr; 1075 struct scsi_sense_hdr sshdr;
1070 struct scsi_target *starget = scsi_target(sdev); 1076 struct scsi_device *sdev;
1077 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
1071 1078
1072 /* 1079 /*
1073 * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. 1080 * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set.
@@ -1075,15 +1082,23 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
1075 * support more than 8 LUNs. 1082 * support more than 8 LUNs.
1076 */ 1083 */
1077 if ((bflags & BLIST_NOREPORTLUN) || 1084 if ((bflags & BLIST_NOREPORTLUN) ||
1078 sdev->scsi_level < SCSI_2 || 1085 starget->scsi_level < SCSI_2 ||
1079 (sdev->scsi_level < SCSI_3 && 1086 (starget->scsi_level < SCSI_3 &&
1080 (!(bflags & BLIST_REPORTLUN2) || sdev->host->max_lun <= 8)) ) 1087 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8)) )
1081 return 1; 1088 return 1;
1082 if (bflags & BLIST_NOLUN) 1089 if (bflags & BLIST_NOLUN)
1083 return 0; 1090 return 0;
1084 1091
1092 if (!(sdev = scsi_device_lookup_by_target(starget, 0))) {
1093 sdev = scsi_alloc_sdev(starget, 0, NULL);
1094 if (!sdev)
1095 return 0;
1096 if (scsi_device_get(sdev))
1097 return 0;
1098 }
1099
1085 sprintf(devname, "host %d channel %d id %d", 1100 sprintf(devname, "host %d channel %d id %d",
1086 sdev->host->host_no, sdev->channel, sdev->id); 1101 shost->host_no, sdev->channel, sdev->id);
1087 1102
1088 /* 1103 /*
1089 * Allocate enough to hold the header (the same size as one scsi_lun) 1104 * Allocate enough to hold the header (the same size as one scsi_lun)
@@ -1098,8 +1113,10 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
1098 length = (max_scsi_report_luns + 1) * sizeof(struct scsi_lun); 1113 length = (max_scsi_report_luns + 1) * sizeof(struct scsi_lun);
1099 lun_data = kmalloc(length, GFP_ATOMIC | 1114 lun_data = kmalloc(length, GFP_ATOMIC |
1100 (sdev->host->unchecked_isa_dma ? __GFP_DMA : 0)); 1115 (sdev->host->unchecked_isa_dma ? __GFP_DMA : 0));
1101 if (!lun_data) 1116 if (!lun_data) {
1117 printk(ALLOC_FAILURE_MSG, __FUNCTION__);
1102 goto out; 1118 goto out;
1119 }
1103 1120
1104 scsi_cmd[0] = REPORT_LUNS; 1121 scsi_cmd[0] = REPORT_LUNS;
1105 1122
@@ -1201,10 +1218,6 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
1201 for (i = 0; i < sizeof(struct scsi_lun); i++) 1218 for (i = 0; i < sizeof(struct scsi_lun); i++)
1202 printk("%02x", data[i]); 1219 printk("%02x", data[i]);
1203 printk(" has a LUN larger than currently supported.\n"); 1220 printk(" has a LUN larger than currently supported.\n");
1204 } else if (lun == 0) {
1205 /*
1206 * LUN 0 has already been scanned.
1207 */
1208 } else if (lun > sdev->host->max_lun) { 1221 } else if (lun > sdev->host->max_lun) {
1209 printk(KERN_WARNING "scsi: %s lun%d has a LUN larger" 1222 printk(KERN_WARNING "scsi: %s lun%d has a LUN larger"
1210 " than allowed by the host adapter\n", 1223 " than allowed by the host adapter\n",
@@ -1227,13 +1240,13 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
1227 } 1240 }
1228 1241
1229 kfree(lun_data); 1242 kfree(lun_data);
1230 return 0;
1231
1232 out: 1243 out:
1233 /* 1244 scsi_device_put(sdev);
1234 * We are out of memory, don't try scanning any further. 1245 if (sdev->sdev_state == SDEV_CREATED)
1235 */ 1246 /*
1236 printk(ALLOC_FAILURE_MSG, __FUNCTION__); 1247 * the sdev we used didn't appear in the report luns scan
1248 */
1249 scsi_destroy_sdev(sdev);
1237 return 0; 1250 return 0;
1238} 1251}
1239 1252
@@ -1299,7 +1312,6 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel,
1299 struct Scsi_Host *shost = dev_to_shost(parent); 1312 struct Scsi_Host *shost = dev_to_shost(parent);
1300 int bflags = 0; 1313 int bflags = 0;
1301 int res; 1314 int res;
1302 struct scsi_device *sdev = NULL;
1303 struct scsi_target *starget; 1315 struct scsi_target *starget;
1304 1316
1305 if (shost->this_id == id) 1317 if (shost->this_id == id)
@@ -1325,27 +1337,16 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel,
1325 * Scan LUN 0, if there is some response, scan further. Ideally, we 1337 * Scan LUN 0, if there is some response, scan further. Ideally, we
1326 * would not configure LUN 0 until all LUNs are scanned. 1338 * would not configure LUN 0 until all LUNs are scanned.
1327 */ 1339 */
1328 res = scsi_probe_and_add_lun(starget, 0, &bflags, &sdev, rescan, NULL); 1340 res = scsi_probe_and_add_lun(starget, 0, &bflags, NULL, rescan, NULL);
1329 if (res == SCSI_SCAN_LUN_PRESENT) { 1341 if (res == SCSI_SCAN_LUN_PRESENT || res == SCSI_SCAN_TARGET_PRESENT) {
1330 if (scsi_report_lun_scan(sdev, bflags, rescan) != 0) 1342 if (scsi_report_lun_scan(starget, bflags, rescan) != 0)
1331 /* 1343 /*
1332 * The REPORT LUN did not scan the target, 1344 * The REPORT LUN did not scan the target,
1333 * do a sequential scan. 1345 * do a sequential scan.
1334 */ 1346 */
1335 scsi_sequential_lun_scan(starget, bflags, 1347 scsi_sequential_lun_scan(starget, bflags,
1336 res, sdev->scsi_level, rescan); 1348 res, starget->scsi_level, rescan);
1337 } else if (res == SCSI_SCAN_TARGET_PRESENT) {
1338 /*
1339 * There's a target here, but lun 0 is offline so we
1340 * can't use the report_lun scan. Fall back to a
1341 * sequential lun scan with a bflags of SPARSELUN and
1342 * a default scsi level of SCSI_2
1343 */
1344 scsi_sequential_lun_scan(starget, BLIST_SPARSELUN,
1345 SCSI_SCAN_TARGET_PRESENT, SCSI_2, rescan);
1346 } 1349 }
1347 if (sdev)
1348 scsi_device_put(sdev);
1349 1350
1350 out_reap: 1351 out_reap:
1351 /* now determine if the target has any children at all 1352 /* now determine if the target has any children at all
@@ -1542,10 +1543,7 @@ void scsi_free_host_dev(struct scsi_device *sdev)
1542{ 1543{
1543 BUG_ON(sdev->id != sdev->host->this_id); 1544 BUG_ON(sdev->id != sdev->host->this_id);
1544 1545
1545 if (sdev->host->hostt->slave_destroy) 1546 scsi_destroy_sdev(sdev);
1546 sdev->host->hostt->slave_destroy(sdev);
1547 transport_destroy_device(&sdev->sdev_gendev);
1548 put_device(&sdev->sdev_gendev);
1549} 1547}
1550EXPORT_SYMBOL(scsi_free_host_dev); 1548EXPORT_SYMBOL(scsi_free_host_dev);
1551 1549
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index ff724bbe6611..1d145d2f9a38 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -628,17 +628,16 @@ sas_rphy_delete(struct sas_rphy *rphy)
628 struct Scsi_Host *shost = dev_to_shost(parent->dev.parent); 628 struct Scsi_Host *shost = dev_to_shost(parent->dev.parent);
629 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); 629 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost);
630 630
631 transport_destroy_device(&rphy->dev); 631 scsi_remove_target(dev);
632 632
633 scsi_remove_target(&rphy->dev); 633 transport_remove_device(dev);
634 device_del(dev);
635 transport_destroy_device(dev);
634 636
635 spin_lock(&sas_host->lock); 637 spin_lock(&sas_host->lock);
636 list_del(&rphy->list); 638 list_del(&rphy->list);
637 spin_unlock(&sas_host->lock); 639 spin_unlock(&sas_host->lock);
638 640
639 transport_remove_device(dev);
640 device_del(dev);
641 transport_destroy_device(dev);
642 put_device(&parent->dev); 641 put_device(&parent->dev);
643} 642}
644EXPORT_SYMBOL(sas_rphy_delete); 643EXPORT_SYMBOL(sas_rphy_delete);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 4d09a6e4dd2e..ad94367df430 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2849,8 +2849,7 @@ sg_proc_init(void)
2849 struct proc_dir_entry *pdep; 2849 struct proc_dir_entry *pdep;
2850 struct sg_proc_leaf * leaf; 2850 struct sg_proc_leaf * leaf;
2851 2851
2852 sg_proc_sgp = create_proc_entry(sg_proc_sg_dirname, 2852 sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL);
2853 S_IFDIR | S_IRUGO | S_IXUGO, NULL);
2854 if (!sg_proc_sgp) 2853 if (!sg_proc_sgp)
2855 return 1; 2854 return 1;
2856 for (k = 0; k < num_leaves; ++k) { 2855 for (k = 0; k < num_leaves; ++k) {
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 4c985e6b3784..53e0323d4b83 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -383,11 +383,11 @@ static int imx_startup(struct uart_port *port)
383 */ 383 */
384 retval = request_irq(sport->rxirq, imx_rxint, 0, 384 retval = request_irq(sport->rxirq, imx_rxint, 0,
385 DRIVER_NAME, sport); 385 DRIVER_NAME, sport);
386 if (retval) goto error_out2; 386 if (retval) goto error_out1;
387 387
388 retval = request_irq(sport->txirq, imx_txint, 0, 388 retval = request_irq(sport->txirq, imx_txint, 0,
389 "imx-uart", sport); 389 "imx-uart", sport);
390 if (retval) goto error_out1; 390 if (retval) goto error_out2;
391 391
392 /* 392 /*
393 * Finally, clear and enable interrupts 393 * Finally, clear and enable interrupts
@@ -406,10 +406,9 @@ static int imx_startup(struct uart_port *port)
406 406
407 return 0; 407 return 0;
408 408
409error_out1:
410 free_irq(sport->rxirq, sport);
411error_out2: 409error_out2:
412 free_irq(sport->txirq, sport); 410 free_irq(sport->rxirq, sport);
411error_out1:
413 return retval; 412 return retval;
414} 413}
415 414
@@ -860,7 +859,7 @@ imx_console_setup(struct console *co, char *options)
860 return uart_set_options(&sport->port, co, baud, parity, bits, flow); 859 return uart_set_options(&sport->port, co, baud, parity, bits, flow);
861} 860}
862 861
863extern struct uart_driver imx_reg; 862static struct uart_driver imx_reg;
864static struct console imx_console = { 863static struct console imx_console = {
865 .name = "ttySMX", 864 .name = "ttySMX",
866 .write = imx_console_write, 865 .write = imx_console_write,
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 0c5c96a582b3..f88fdd480685 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -973,18 +973,6 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
973 this_ir &= ~this_mir; 973 this_ir &= ~this_mir;
974 } 974 }
975 } 975 }
976 if (this_ir) {
977 printk(KERN_ERR
978 "unknown IOC4 %s interrupt 0x%x, sio_ir = 0x%x,"
979 " sio_ies = 0x%x, other_ir = 0x%x :"
980 "other_ies = 0x%x\n",
981 (intr_type == IOC4_SIO_INTR_TYPE) ? "sio" :
982 "other", this_ir,
983 readl(&soft->is_ioc4_misc_addr->sio_ir.raw),
984 readl(&soft->is_ioc4_misc_addr->sio_ies.raw),
985 readl(&soft->is_ioc4_misc_addr->other_ir.raw),
986 readl(&soft->is_ioc4_misc_addr->other_ies.raw));
987 }
988 } 976 }
989#ifdef DEBUG_INTERRUPTS 977#ifdef DEBUG_INTERRUPTS
990 { 978 {
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index c361c6fb0809..eff2158024c8 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -82,8 +82,6 @@
82#include <asm/arch/regs-serial.h> 82#include <asm/arch/regs-serial.h>
83#include <asm/arch/regs-gpio.h> 83#include <asm/arch/regs-gpio.h>
84 84
85#include <asm/mach-types.h>
86
87/* structures */ 85/* structures */
88 86
89struct s3c24xx_uart_info { 87struct s3c24xx_uart_info {
@@ -753,8 +751,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
753{ 751{
754 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port); 752 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
755 struct s3c24xx_uart_port *ourport = to_ourport(port); 753 struct s3c24xx_uart_port *ourport = to_ourport(port);
756 struct s3c24xx_uart_clksrc *clksrc; 754 struct s3c24xx_uart_clksrc *clksrc = NULL;
757 struct clk *clk; 755 struct clk *clk = NULL;
758 unsigned long flags; 756 unsigned long flags;
759 unsigned int baud, quot; 757 unsigned int baud, quot;
760 unsigned int ulcon; 758 unsigned int ulcon;
@@ -1237,6 +1235,7 @@ static int s3c2400_serial_probe(struct device *dev)
1237 1235
1238static struct device_driver s3c2400_serial_drv = { 1236static struct device_driver s3c2400_serial_drv = {
1239 .name = "s3c2400-uart", 1237 .name = "s3c2400-uart",
1238 .owner = THIS_MODULE,
1240 .bus = &platform_bus_type, 1239 .bus = &platform_bus_type,
1241 .probe = s3c2400_serial_probe, 1240 .probe = s3c2400_serial_probe,
1242 .remove = s3c24xx_serial_remove, 1241 .remove = s3c24xx_serial_remove,
@@ -1340,6 +1339,7 @@ static int s3c2410_serial_probe(struct device *dev)
1340 1339
1341static struct device_driver s3c2410_serial_drv = { 1340static struct device_driver s3c2410_serial_drv = {
1342 .name = "s3c2410-uart", 1341 .name = "s3c2410-uart",
1342 .owner = THIS_MODULE,
1343 .bus = &platform_bus_type, 1343 .bus = &platform_bus_type,
1344 .probe = s3c2410_serial_probe, 1344 .probe = s3c2410_serial_probe,
1345 .remove = s3c24xx_serial_remove, 1345 .remove = s3c24xx_serial_remove,
@@ -1501,6 +1501,7 @@ static int s3c2440_serial_probe(struct device *dev)
1501 1501
1502static struct device_driver s3c2440_serial_drv = { 1502static struct device_driver s3c2440_serial_drv = {
1503 .name = "s3c2440-uart", 1503 .name = "s3c2440-uart",
1504 .owner = THIS_MODULE,
1504 .bus = &platform_bus_type, 1505 .bus = &platform_bus_type,
1505 .probe = s3c2440_serial_probe, 1506 .probe = s3c2440_serial_probe,
1506 .remove = s3c24xx_serial_remove, 1507 .remove = s3c24xx_serial_remove,
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index e971156daa60..ba9381fd3f2d 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -274,7 +274,6 @@ static void transmit_chars(struct uart_sunsab_port *up,
274 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { 274 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
275 up->interrupt_mask1 |= SAB82532_IMR1_XPR; 275 up->interrupt_mask1 |= SAB82532_IMR1_XPR;
276 writeb(up->interrupt_mask1, &up->regs->w.imr1); 276 writeb(up->interrupt_mask1, &up->regs->w.imr1);
277 uart_write_wakeup(&up->port);
278 return; 277 return;
279 } 278 }
280 279
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 5959e6755a81..656c0e8d160e 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -518,11 +518,7 @@ static void sunsu_change_mouse_baud(struct uart_sunsu_port *up)
518 518
519 quot = up->port.uartclk / (16 * new_baud); 519 quot = up->port.uartclk / (16 * new_baud);
520 520
521 spin_unlock(&up->port.lock);
522
523 sunsu_change_speed(&up->port, up->cflag, 0, quot); 521 sunsu_change_speed(&up->port, up->cflag, 0, quot);
524
525 spin_lock(&up->port.lock);
526} 522}
527 523
528static void receive_kbd_ms_chars(struct uart_sunsu_port *up, struct pt_regs *regs, int is_break) 524static void receive_kbd_ms_chars(struct uart_sunsu_port *up, struct pt_regs *regs, int is_break)
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index d75445738c88..7653d6cf05af 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -517,10 +517,9 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up,
517 if (up->port.info == NULL) 517 if (up->port.info == NULL)
518 goto ack_tx_int; 518 goto ack_tx_int;
519 xmit = &up->port.info->xmit; 519 xmit = &up->port.info->xmit;
520 if (uart_circ_empty(xmit)) { 520 if (uart_circ_empty(xmit))
521 uart_write_wakeup(&up->port);
522 goto ack_tx_int; 521 goto ack_tx_int;
523 } 522
524 if (uart_tx_stopped(&up->port)) 523 if (uart_tx_stopped(&up->port))
525 goto ack_tx_int; 524 goto ack_tx_int;
526 525
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index b4265aa7d45e..487ff672b104 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -30,6 +30,8 @@
30 * Revision history 30 * Revision history
31 * 22.12.1999 0.1 Initial release (split from proc_usb.c) 31 * 22.12.1999 0.1 Initial release (split from proc_usb.c)
32 * 04.01.2000 0.2 Turned into its own filesystem 32 * 04.01.2000 0.2 Turned into its own filesystem
33 * 30.09.2005 0.3 Fix user-triggerable oops in async URB delivery
34 * (CAN-2005-3055)
33 */ 35 */
34 36
35/*****************************************************************************/ 37/*****************************************************************************/
@@ -58,7 +60,8 @@ static struct class *usb_device_class;
58struct async { 60struct async {
59 struct list_head asynclist; 61 struct list_head asynclist;
60 struct dev_state *ps; 62 struct dev_state *ps;
61 struct task_struct *task; 63 pid_t pid;
64 uid_t uid, euid;
62 unsigned int signr; 65 unsigned int signr;
63 unsigned int ifnum; 66 unsigned int ifnum;
64 void __user *userbuffer; 67 void __user *userbuffer;
@@ -290,7 +293,8 @@ static void async_completed(struct urb *urb, struct pt_regs *regs)
290 sinfo.si_errno = as->urb->status; 293 sinfo.si_errno = as->urb->status;
291 sinfo.si_code = SI_ASYNCIO; 294 sinfo.si_code = SI_ASYNCIO;
292 sinfo.si_addr = as->userurb; 295 sinfo.si_addr = as->userurb;
293 send_sig_info(as->signr, &sinfo, as->task); 296 kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid,
297 as->euid);
294 } 298 }
295 wake_up(&ps->wait); 299 wake_up(&ps->wait);
296} 300}
@@ -526,7 +530,9 @@ static int usbdev_open(struct inode *inode, struct file *file)
526 INIT_LIST_HEAD(&ps->async_completed); 530 INIT_LIST_HEAD(&ps->async_completed);
527 init_waitqueue_head(&ps->wait); 531 init_waitqueue_head(&ps->wait);
528 ps->discsignr = 0; 532 ps->discsignr = 0;
529 ps->disctask = current; 533 ps->disc_pid = current->pid;
534 ps->disc_uid = current->uid;
535 ps->disc_euid = current->euid;
530 ps->disccontext = NULL; 536 ps->disccontext = NULL;
531 ps->ifclaimed = 0; 537 ps->ifclaimed = 0;
532 wmb(); 538 wmb();
@@ -988,7 +994,9 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
988 as->userbuffer = NULL; 994 as->userbuffer = NULL;
989 as->signr = uurb->signr; 995 as->signr = uurb->signr;
990 as->ifnum = ifnum; 996 as->ifnum = ifnum;
991 as->task = current; 997 as->pid = current->pid;
998 as->uid = current->uid;
999 as->euid = current->euid;
992 if (!(uurb->endpoint & USB_DIR_IN)) { 1000 if (!(uurb->endpoint & USB_DIR_IN)) {
993 if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) { 1001 if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) {
994 free_async(as); 1002 free_async(as);
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index cbb451d227d2..6385d1a99b60 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -242,7 +242,6 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
242 case HC_STATE_SUSPENDED: 242 case HC_STATE_SUSPENDED:
243 /* no DMA or IRQs except when HC is active */ 243 /* no DMA or IRQs except when HC is active */
244 if (dev->current_state == PCI_D0) { 244 if (dev->current_state == PCI_D0) {
245 free_irq (hcd->irq, hcd);
246 pci_save_state (dev); 245 pci_save_state (dev);
247 pci_disable_device (dev); 246 pci_disable_device (dev);
248 } 247 }
@@ -374,14 +373,6 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
374 373
375 hcd->state = HC_STATE_RESUMING; 374 hcd->state = HC_STATE_RESUMING;
376 hcd->saw_irq = 0; 375 hcd->saw_irq = 0;
377 retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
378 hcd->irq_descr, hcd);
379 if (retval < 0) {
380 dev_err (hcd->self.controller,
381 "can't restore IRQ after resume!\n");
382 usb_hc_died (hcd);
383 return retval;
384 }
385 376
386 retval = hcd->driver->resume (hcd); 377 retval = hcd->driver->resume (hcd);
387 if (!HC_IS_RUNNING (hcd->state)) { 378 if (!HC_IS_RUNNING (hcd->state)) {
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 640f41e47029..d07bba01995b 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -713,7 +713,7 @@ void usbfs_remove_device(struct usb_device *dev)
713 sinfo.si_errno = EPIPE; 713 sinfo.si_errno = EPIPE;
714 sinfo.si_code = SI_ASYNCIO; 714 sinfo.si_code = SI_ASYNCIO;
715 sinfo.si_addr = ds->disccontext; 715 sinfo.si_addr = ds->disccontext;
716 send_sig_info(ds->discsignr, &sinfo, ds->disctask); 716 kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid);
717 } 717 }
718 } 718 }
719 usbfs_update_special(); 719 usbfs_update_special();
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 83d48c8133af..e6504f3370ad 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -52,7 +52,8 @@ struct dev_state {
52 struct list_head async_completed; 52 struct list_head async_completed;
53 wait_queue_head_t wait; /* wake up if a request completed */ 53 wait_queue_head_t wait; /* wake up if a request completed */
54 unsigned int discsignr; 54 unsigned int discsignr;
55 struct task_struct *disctask; 55 pid_t disc_pid;
56 uid_t disc_uid, disc_euid;
56 void __user *disccontext; 57 void __user *disccontext;
57 unsigned long ifclaimed; 58 unsigned long ifclaimed;
58}; 59};
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 817620d73841..859aca7be753 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -17,8 +17,6 @@
17 */ 17 */
18 18
19#include <asm/hardware.h> 19#include <asm/hardware.h>
20#include <asm/mach-types.h>
21#include <asm/arch/hardware.h>
22 20
23 21
24extern int usb_disabled(void); 22extern int usb_disabled(void);
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 5cde76faab93..d8f3ba7ad52e 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -18,7 +18,6 @@
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20 20
21#include <asm/arch/hardware.h>
22#include <asm/arch/mux.h> 21#include <asm/arch/mux.h>
23#include <asm/arch/irqs.h> 22#include <asm/arch/irqs.h>
24#include <asm/arch/gpio.h> 23#include <asm/arch/gpio.h>
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 3d9bcf78a9a4..da7d5478f74d 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -20,7 +20,6 @@
20*/ 20*/
21 21
22#include <asm/hardware.h> 22#include <asm/hardware.h>
23#include <asm/mach-types.h>
24#include <asm/hardware/clock.h> 23#include <asm/hardware/clock.h>
25#include <asm/arch/usb-control.h> 24#include <asm/arch/usb-control.h>
26 25
diff --git a/drivers/usb/media/vicam.c b/drivers/usb/media/vicam.c
index 4a5857c53f11..0bc0b1247a6b 100644
--- a/drivers/usb/media/vicam.c
+++ b/drivers/usb/media/vicam.c
@@ -1148,7 +1148,7 @@ vicam_write_proc_gain(struct file *file, const char *buffer,
1148static void 1148static void
1149vicam_create_proc_root(void) 1149vicam_create_proc_root(void)
1150{ 1150{
1151 vicam_proc_root = create_proc_entry("video/vicam", S_IFDIR, 0); 1151 vicam_proc_root = proc_mkdir("video/vicam", NULL);
1152 1152
1153 if (vicam_proc_root) 1153 if (vicam_proc_root)
1154 vicam_proc_root->owner = THIS_MODULE; 1154 vicam_proc_root->owner = THIS_MODULE;
@@ -1181,7 +1181,7 @@ vicam_create_proc_entry(struct vicam_camera *cam)
1181 1181
1182 sprintf(name, "video%d", cam->vdev.minor); 1182 sprintf(name, "video%d", cam->vdev.minor);
1183 1183
1184 cam->proc_dir = create_proc_entry(name, S_IFDIR, vicam_proc_root); 1184 cam->proc_dir = proc_mkdir(name, vicam_proc_root);
1185 1185
1186 if ( !cam->proc_dir ) 1186 if ( !cam->proc_dir )
1187 return; // FIXME: We should probably return an error here 1187 return; // FIXME: We should probably return an error here
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 773ae11b4a19..1cd942abb580 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -768,6 +768,7 @@ config FB_INTEL
768 select FB_CFB_FILLRECT 768 select FB_CFB_FILLRECT
769 select FB_CFB_COPYAREA 769 select FB_CFB_COPYAREA
770 select FB_CFB_IMAGEBLIT 770 select FB_CFB_IMAGEBLIT
771 select FB_SOFT_CURSOR
771 help 772 help
772 This driver supports the on-board graphics built in to the Intel 773 This driver supports the on-board graphics built in to the Intel
773 830M/845G/852GM/855GM/865G chipsets. 774 830M/845G/852GM/855GM/865G chipsets.
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 046b47860266..8a24a66d9ba8 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -475,7 +475,7 @@ static int __devinit radeon_probe_pll_params(struct radeonfb_info *rinfo)
475 */ 475 */
476 476
477 /* Flush PCI buffers ? */ 477 /* Flush PCI buffers ? */
478 tmp = INREG(DEVICE_ID); 478 tmp = INREG16(DEVICE_ID);
479 479
480 local_irq_disable(); 480 local_irq_disable();
481 481
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index 59a1b6f85067..097d668c4fe5 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -62,9 +62,9 @@ static void radeon_pm_disable_dynamic_mode(struct radeonfb_info *rinfo)
62 OUTPLL(pllSCLK_CNTL, tmp); 62 OUTPLL(pllSCLK_CNTL, tmp);
63 return; 63 return;
64 } 64 }
65 /* RV350 (M10) */ 65 /* RV350 (M10/M11) */
66 if (rinfo->family == CHIP_FAMILY_RV350) { 66 if (rinfo->family == CHIP_FAMILY_RV350) {
67 /* for RV350/M10, no delays are required. */ 67 /* for RV350/M10/M11, no delays are required. */
68 tmp = INPLL(pllSCLK_CNTL2); 68 tmp = INPLL(pllSCLK_CNTL2);
69 tmp |= (SCLK_CNTL2__R300_FORCE_TCL | 69 tmp |= (SCLK_CNTL2__R300_FORCE_TCL |
70 SCLK_CNTL2__R300_FORCE_GA | 70 SCLK_CNTL2__R300_FORCE_GA |
@@ -248,7 +248,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
248 return; 248 return;
249 } 249 }
250 250
251 /* M10 */ 251 /* M10/M11 */
252 if (rinfo->family == CHIP_FAMILY_RV350) { 252 if (rinfo->family == CHIP_FAMILY_RV350) {
253 tmp = INPLL(pllSCLK_CNTL2); 253 tmp = INPLL(pllSCLK_CNTL2);
254 tmp &= ~(SCLK_CNTL2__R300_FORCE_TCL | 254 tmp &= ~(SCLK_CNTL2__R300_FORCE_TCL |
@@ -1155,7 +1155,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo)
1155 OUTREG( CRTC_GEN_CNTL, (crtcGenCntl | CRTC_GEN_CNTL__CRTC_DISP_REQ_EN_B) ); 1155 OUTREG( CRTC_GEN_CNTL, (crtcGenCntl | CRTC_GEN_CNTL__CRTC_DISP_REQ_EN_B) );
1156 OUTREG( CRTC2_GEN_CNTL, (crtcGenCntl2 | CRTC2_GEN_CNTL__CRTC2_DISP_REQ_EN_B) ); 1156 OUTREG( CRTC2_GEN_CNTL, (crtcGenCntl2 | CRTC2_GEN_CNTL__CRTC2_DISP_REQ_EN_B) );
1157 1157
1158 /* This is the code for the Aluminium PowerBooks M10 */ 1158 /* This is the code for the Aluminium PowerBooks M10 / iBooks M11 */
1159 if (rinfo->family == CHIP_FAMILY_RV350) { 1159 if (rinfo->family == CHIP_FAMILY_RV350) {
1160 u32 sdram_mode_reg = rinfo->save_regs[35]; 1160 u32 sdram_mode_reg = rinfo->save_regs[35];
1161 static u32 default_mrtable[] = 1161 static u32 default_mrtable[] =
@@ -2741,9 +2741,11 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk)
2741 rinfo->pm_mode |= radeon_pm_d2; 2741 rinfo->pm_mode |= radeon_pm_d2;
2742 2742
2743 /* We can restart Jasper (M10 chip in albooks), BlueStone (7500 chip 2743 /* We can restart Jasper (M10 chip in albooks), BlueStone (7500 chip
2744 * in some desktop G4s), and Via (M9+ chip on iBook G4) 2744 * in some desktop G4s), Via (M9+ chip on iBook G4) and
2745 * Snowy (M11 chip on iBook G4 manufactured after July 2005)
2745 */ 2746 */
2746 if (!strcmp(rinfo->of_node->name, "ATY,JasperParent")) { 2747 if (!strcmp(rinfo->of_node->name, "ATY,JasperParent") ||
2748 !strcmp(rinfo->of_node->name, "ATY,SnowyParent")) {
2747 rinfo->reinit_func = radeon_reinitialize_M10; 2749 rinfo->reinit_func = radeon_reinitialize_M10;
2748 rinfo->pm_mode |= radeon_pm_off; 2750 rinfo->pm_mode |= radeon_pm_off;
2749 } 2751 }
diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h
index 659bc9f62244..01b8b2f78514 100644
--- a/drivers/video/aty/radeonfb.h
+++ b/drivers/video/aty/radeonfb.h
@@ -395,6 +395,8 @@ static inline void _radeon_msleep(struct radeonfb_info *rinfo, unsigned long ms)
395 395
396#define INREG8(addr) readb((rinfo->mmio_base)+addr) 396#define INREG8(addr) readb((rinfo->mmio_base)+addr)
397#define OUTREG8(addr,val) writeb(val, (rinfo->mmio_base)+addr) 397#define OUTREG8(addr,val) writeb(val, (rinfo->mmio_base)+addr)
398#define INREG16(addr) readw((rinfo->mmio_base)+addr)
399#define OUTREG16(addr,val) writew(val, (rinfo->mmio_base)+addr)
398#define INREG(addr) readl((rinfo->mmio_base)+addr) 400#define INREG(addr) readl((rinfo->mmio_base)+addr)
399#define OUTREG(addr,val) writel(val, (rinfo->mmio_base)+addr) 401#define OUTREG(addr,val) writel(val, (rinfo->mmio_base)+addr)
400 402
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
index 630f2dfa9699..3c72c627e65e 100644
--- a/drivers/video/backlight/corgi_bl.c
+++ b/drivers/video/backlight/corgi_bl.c
@@ -19,7 +19,6 @@
19#include <linux/fb.h> 19#include <linux/fb.h>
20#include <linux/backlight.h> 20#include <linux/backlight.h>
21 21
22#include <asm/mach-types.h>
23#include <asm/arch/sharpsl.h> 22#include <asm/arch/sharpsl.h>
24 23
25#define CORGI_DEFAULT_INTENSITY 0x1f 24#define CORGI_DEFAULT_INTENSITY 0x1f
diff --git a/drivers/video/cyblafb.c b/drivers/video/cyblafb.c
index ae2762cb5608..6992100a508c 100644
--- a/drivers/video/cyblafb.c
+++ b/drivers/video/cyblafb.c
@@ -410,20 +410,21 @@ static void cyblafb_imageblit(struct fb_info *info,
410 out32(GE0C,point(image->dx+image->width-1,image->dy+image->height-1)); 410 out32(GE0C,point(image->dx+image->width-1,image->dy+image->height-1));
411 411
412 while(index < index_end) { 412 while(index < index_end) {
413 const char *p = image->data + index;
413 for(i=0;i<width_dds;i++) { 414 for(i=0;i<width_dds;i++) {
414 out32(GE9C,*((u32*) ((u32)image->data + index))); 415 out32(GE9C,*(u32*)p);
416 p+=4;
415 index+=4; 417 index+=4;
416 } 418 }
417 switch(width_dbs) { 419 switch(width_dbs) {
418 case 0: break; 420 case 0: break;
419 case 8: out32(GE9C,*((u8*)((u32)image->data+index))); 421 case 8: out32(GE9C,*(u8*)p);
420 index+=1; 422 index+=1;
421 break; 423 break;
422 case 16: out32(GE9C,*((u16*)((u32)image->data+index))); 424 case 16: out32(GE9C,*(u16*)p);
423 index+=2; 425 index+=2;
424 break; 426 break;
425 case 24: out32(GE9C,(u32)(*((u16*)((u32)image->data+index))) | 427 case 24: out32(GE9C,*(u16*)p | *(u8*)(p+2)<<16);
426 (u32)(*((u8*)((u32)image->data+index+2)))<<16);
427 index+=3; 428 index+=3;
428 break; 429 break;
429 } 430 }
diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/i810/i810-i2c.c
index fda53aac1fc1..689d2586366d 100644
--- a/drivers/video/i810/i810-i2c.c
+++ b/drivers/video/i810/i810-i2c.c
@@ -44,7 +44,7 @@ static void i810i2c_setscl(void *data, int state)
44{ 44{
45 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; 45 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data;
46 struct i810fb_par *par = chan->par; 46 struct i810fb_par *par = chan->par;
47 u8 *mmio = par->mmio_start_virtual; 47 u8 __iomem *mmio = par->mmio_start_virtual;
48 48
49 i810_writel(mmio, GPIOB, (state ? SCL_VAL_OUT : 0) | SCL_DIR | 49 i810_writel(mmio, GPIOB, (state ? SCL_VAL_OUT : 0) | SCL_DIR |
50 SCL_DIR_MASK | SCL_VAL_MASK); 50 SCL_DIR_MASK | SCL_VAL_MASK);
@@ -55,7 +55,7 @@ static void i810i2c_setsda(void *data, int state)
55{ 55{
56 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; 56 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data;
57 struct i810fb_par *par = chan->par; 57 struct i810fb_par *par = chan->par;
58 u8 *mmio = par->mmio_start_virtual; 58 u8 __iomem *mmio = par->mmio_start_virtual;
59 59
60 i810_writel(mmio, GPIOB, (state ? SDA_VAL_OUT : 0) | SDA_DIR | 60 i810_writel(mmio, GPIOB, (state ? SDA_VAL_OUT : 0) | SDA_DIR |
61 SDA_DIR_MASK | SDA_VAL_MASK); 61 SDA_DIR_MASK | SDA_VAL_MASK);
@@ -66,7 +66,7 @@ static int i810i2c_getscl(void *data)
66{ 66{
67 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; 67 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data;
68 struct i810fb_par *par = chan->par; 68 struct i810fb_par *par = chan->par;
69 u8 *mmio = par->mmio_start_virtual; 69 u8 __iomem *mmio = par->mmio_start_virtual;
70 70
71 i810_writel(mmio, GPIOB, SCL_DIR_MASK); 71 i810_writel(mmio, GPIOB, SCL_DIR_MASK);
72 i810_writel(mmio, GPIOB, 0); 72 i810_writel(mmio, GPIOB, 0);
@@ -77,7 +77,7 @@ static int i810i2c_getsda(void *data)
77{ 77{
78 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; 78 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data;
79 struct i810fb_par *par = chan->par; 79 struct i810fb_par *par = chan->par;
80 u8 *mmio = par->mmio_start_virtual; 80 u8 __iomem *mmio = par->mmio_start_virtual;
81 81
82 i810_writel(mmio, GPIOB, SDA_DIR_MASK); 82 i810_writel(mmio, GPIOB, SDA_DIR_MASK);
83 i810_writel(mmio, GPIOB, 0); 83 i810_writel(mmio, GPIOB, 0);
@@ -88,7 +88,7 @@ static void i810ddc_setscl(void *data, int state)
88{ 88{
89 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; 89 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data;
90 struct i810fb_par *par = chan->par; 90 struct i810fb_par *par = chan->par;
91 u8 *mmio = par->mmio_start_virtual; 91 u8 __iomem *mmio = par->mmio_start_virtual;
92 92
93 i810_writel(mmio, GPIOA, (state ? SCL_VAL_OUT : 0) | SCL_DIR | 93 i810_writel(mmio, GPIOA, (state ? SCL_VAL_OUT : 0) | SCL_DIR |
94 SCL_DIR_MASK | SCL_VAL_MASK); 94 SCL_DIR_MASK | SCL_VAL_MASK);
@@ -99,7 +99,7 @@ static void i810ddc_setsda(void *data, int state)
99{ 99{
100 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; 100 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data;
101 struct i810fb_par *par = chan->par; 101 struct i810fb_par *par = chan->par;
102 u8 *mmio = par->mmio_start_virtual; 102 u8 __iomem *mmio = par->mmio_start_virtual;
103 103
104 i810_writel(mmio, GPIOA, (state ? SDA_VAL_OUT : 0) | SDA_DIR | 104 i810_writel(mmio, GPIOA, (state ? SDA_VAL_OUT : 0) | SDA_DIR |
105 SDA_DIR_MASK | SDA_VAL_MASK); 105 SDA_DIR_MASK | SDA_VAL_MASK);
@@ -110,7 +110,7 @@ static int i810ddc_getscl(void *data)
110{ 110{
111 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; 111 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data;
112 struct i810fb_par *par = chan->par; 112 struct i810fb_par *par = chan->par;
113 u8 *mmio = par->mmio_start_virtual; 113 u8 __iomem *mmio = par->mmio_start_virtual;
114 114
115 i810_writel(mmio, GPIOA, SCL_DIR_MASK); 115 i810_writel(mmio, GPIOA, SCL_DIR_MASK);
116 i810_writel(mmio, GPIOA, 0); 116 i810_writel(mmio, GPIOA, 0);
@@ -121,7 +121,7 @@ static int i810ddc_getsda(void *data)
121{ 121{
122 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; 122 struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data;
123 struct i810fb_par *par = chan->par; 123 struct i810fb_par *par = chan->par;
124 u8 *mmio = par->mmio_start_virtual; 124 u8 __iomem *mmio = par->mmio_start_virtual;
125 125
126 i810_writel(mmio, GPIOA, SDA_DIR_MASK); 126 i810_writel(mmio, GPIOA, SDA_DIR_MASK);
127 i810_writel(mmio, GPIOA, 0); 127 i810_writel(mmio, GPIOA, 0);
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 6c2244cf0e74..1d54d3d6960b 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -36,7 +36,6 @@
36 36
37#include <asm/hardware.h> 37#include <asm/hardware.h>
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/mach-types.h>
40#include <asm/uaccess.h> 39#include <asm/uaccess.h>
41#include <asm/arch/imxfb.h> 40#include <asm/arch/imxfb.h>
42 41
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index bf62e6ed0382..80a09344f1aa 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -226,7 +226,7 @@ MODULE_DEVICE_TABLE(pci, intelfb_pci_table);
226 226
227static int accel = 1; 227static int accel = 1;
228static int vram = 4; 228static int vram = 4;
229static int hwcursor = 1; 229static int hwcursor = 0;
230static int mtrr = 1; 230static int mtrr = 1;
231static int fixed = 0; 231static int fixed = 0;
232static int noinit = 0; 232static int noinit = 0;
@@ -609,15 +609,9 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
609 dinfo->accel = 0; 609 dinfo->accel = 0;
610 } 610 }
611 611
612 if (MB(voffset) < stolen_size)
613 offset = (stolen_size >> 12);
614 else
615 offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
616
617 /* Framebuffer parameters - Use all the stolen memory if >= vram */ 612 /* Framebuffer parameters - Use all the stolen memory if >= vram */
618 if (ROUND_UP_TO_PAGE(stolen_size) >= ((offset << 12) + MB(vram))) { 613 if (ROUND_UP_TO_PAGE(stolen_size) >= MB(vram)) {
619 dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size); 614 dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size);
620 dinfo->fb.offset = 0;
621 dinfo->fbmem_gart = 0; 615 dinfo->fbmem_gart = 0;
622 } else { 616 } else {
623 dinfo->fb.size = MB(vram); 617 dinfo->fb.size = MB(vram);
@@ -648,6 +642,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
648 return -ENODEV; 642 return -ENODEV;
649 } 643 }
650 644
645 if (MB(voffset) < stolen_size)
646 offset = (stolen_size >> 12);
647 else
648 offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
649
651 /* set the mem offsets - set them after the already used pages */ 650 /* set the mem offsets - set them after the already used pages */
652 if (dinfo->accel) { 651 if (dinfo->accel) {
653 dinfo->ring.offset = offset + gtt_info.current_memory; 652 dinfo->ring.offset = offset + gtt_info.current_memory;
@@ -662,10 +661,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
662 + (dinfo->cursor.size >> 12); 661 + (dinfo->cursor.size >> 12);
663 } 662 }
664 663
664 /* Allocate memories (which aren't stolen) */
665 /* Map the fb and MMIO regions */ 665 /* Map the fb and MMIO regions */
666 /* ioremap only up to the end of used aperture */ 666 /* ioremap only up to the end of used aperture */
667 dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache 667 dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
668 (dinfo->aperture.physical, (dinfo->fb.offset << 12) 668 (dinfo->aperture.physical, ((offset + dinfo->fb.offset) << 12)
669 + dinfo->fb.size); 669 + dinfo->fb.size);
670 if (!dinfo->aperture.virtual) { 670 if (!dinfo->aperture.virtual) {
671 ERR_MSG("Cannot remap FB region.\n"); 671 ERR_MSG("Cannot remap FB region.\n");
@@ -682,7 +682,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
682 return -ENODEV; 682 return -ENODEV;
683 } 683 }
684 684
685 /* Allocate memories (which aren't stolen) */
686 if (dinfo->accel) { 685 if (dinfo->accel) {
687 if (!(dinfo->gtt_ring_mem = 686 if (!(dinfo->gtt_ring_mem =
688 agp_allocate_memory(bridge, dinfo->ring.size >> 12, 687 agp_allocate_memory(bridge, dinfo->ring.size >> 12,
@@ -1484,7 +1483,7 @@ intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1484#endif 1483#endif
1485 1484
1486 if (!dinfo->hwcursor) 1485 if (!dinfo->hwcursor)
1487 return -ENXIO; 1486 return soft_cursor(info, cursor);
1488 1487
1489 intelfbhw_cursor_hide(dinfo); 1488 intelfbhw_cursor_hide(dinfo);
1490 1489
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c
index 7808a01493ad..b76a5a9a125b 100644
--- a/drivers/video/p9100.c
+++ b/drivers/video/p9100.c
@@ -288,6 +288,9 @@ static void p9100_init_one(struct sbus_dev *sdev)
288 all->par.physbase = sdev->reg_addrs[2].phys_addr; 288 all->par.physbase = sdev->reg_addrs[2].phys_addr;
289 289
290 sbusfb_fill_var(&all->info.var, sdev->prom_node, 8); 290 sbusfb_fill_var(&all->info.var, sdev->prom_node, 8);
291 all->info.var.red.length = 8;
292 all->info.var.green.length = 8;
293 all->info.var.blue.length = 8;
291 294
292 linebytes = prom_getintdefault(sdev->prom_node, "linebytes", 295 linebytes = prom_getintdefault(sdev->prom_node, "linebytes",
293 all->info.var.xres); 296 all->info.var.xres);
@@ -323,6 +326,7 @@ static void p9100_init_one(struct sbus_dev *sdev)
323 kfree(all); 326 kfree(all);
324 return; 327 return;
325 } 328 }
329 fb_set_cmap(&all->info.cmap, &all->info);
326 330
327 list_add(&all->list, &p9100_list); 331 list_add(&all->list, &p9100_list);
328 332
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 34d4dcc0320a..194eed0a238c 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -260,9 +260,9 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
260 } 260 }
261 261
262#ifdef CONFIG_CPU_FREQ 262#ifdef CONFIG_CPU_FREQ
263 DPRINTK("dma period = %d ps, clock = %d kHz\n", 263 pr_debug("pxafb: dma period = %d ps, clock = %d kHz\n",
264 pxafb_display_dma_period(var), 264 pxafb_display_dma_period(var),
265 get_clk_frequency_khz(0)); 265 get_clk_frequency_khz(0));
266#endif 266#endif
267 267
268 return 0; 268 return 0;
@@ -270,7 +270,7 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
270 270
271static inline void pxafb_set_truecolor(u_int is_true_color) 271static inline void pxafb_set_truecolor(u_int is_true_color)
272{ 272{
273 DPRINTK("true_color = %d\n", is_true_color); 273 pr_debug("pxafb: true_color = %d\n", is_true_color);
274 // do your machine-specific setup if needed 274 // do your machine-specific setup if needed
275} 275}
276 276
@@ -284,7 +284,7 @@ static int pxafb_set_par(struct fb_info *info)
284 struct fb_var_screeninfo *var = &info->var; 284 struct fb_var_screeninfo *var = &info->var;
285 unsigned long palette_mem_size; 285 unsigned long palette_mem_size;
286 286
287 DPRINTK("set_par\n"); 287 pr_debug("pxafb: set_par\n");
288 288
289 if (var->bits_per_pixel == 16) 289 if (var->bits_per_pixel == 16)
290 fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR; 290 fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR;
@@ -308,7 +308,7 @@ static int pxafb_set_par(struct fb_info *info)
308 308
309 palette_mem_size = fbi->palette_size * sizeof(u16); 309 palette_mem_size = fbi->palette_size * sizeof(u16);
310 310
311 DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size); 311 pr_debug("pxafb: palette_mem_size = 0x%08lx\n", palette_mem_size);
312 312
313 fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size); 313 fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size);
314 fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size; 314 fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size;
@@ -369,7 +369,7 @@ static int pxafb_blank(int blank, struct fb_info *info)
369 struct pxafb_info *fbi = (struct pxafb_info *)info; 369 struct pxafb_info *fbi = (struct pxafb_info *)info;
370 int i; 370 int i;
371 371
372 DPRINTK("pxafb_blank: blank=%d\n", blank); 372 pr_debug("pxafb: blank=%d\n", blank);
373 373
374 switch (blank) { 374 switch (blank) {
375 case FB_BLANK_POWERDOWN: 375 case FB_BLANK_POWERDOWN:
@@ -508,15 +508,15 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *
508 u_long flags; 508 u_long flags;
509 u_int lines_per_panel, pcd = get_pcd(var->pixclock); 509 u_int lines_per_panel, pcd = get_pcd(var->pixclock);
510 510
511 DPRINTK("Configuring PXA LCD\n"); 511 pr_debug("pxafb: Configuring PXA LCD\n");
512 512
513 DPRINTK("var: xres=%d hslen=%d lm=%d rm=%d\n", 513 pr_debug("var: xres=%d hslen=%d lm=%d rm=%d\n",
514 var->xres, var->hsync_len, 514 var->xres, var->hsync_len,
515 var->left_margin, var->right_margin); 515 var->left_margin, var->right_margin);
516 DPRINTK("var: yres=%d vslen=%d um=%d bm=%d\n", 516 pr_debug("var: yres=%d vslen=%d um=%d bm=%d\n",
517 var->yres, var->vsync_len, 517 var->yres, var->vsync_len,
518 var->upper_margin, var->lower_margin); 518 var->upper_margin, var->lower_margin);
519 DPRINTK("var: pixclock=%d pcd=%d\n", var->pixclock, pcd); 519 pr_debug("var: pixclock=%d pcd=%d\n", var->pixclock, pcd);
520 520
521#if DEBUG_VAR 521#if DEBUG_VAR
522 if (var->xres < 16 || var->xres > 1024) 522 if (var->xres < 16 || var->xres > 1024)
@@ -589,10 +589,10 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *
589 if (pcd) 589 if (pcd)
590 new_regs.lccr3 |= LCCR3_PixClkDiv(pcd); 590 new_regs.lccr3 |= LCCR3_PixClkDiv(pcd);
591 591
592 DPRINTK("nlccr0 = 0x%08x\n", new_regs.lccr0); 592 pr_debug("nlccr0 = 0x%08x\n", new_regs.lccr0);
593 DPRINTK("nlccr1 = 0x%08x\n", new_regs.lccr1); 593 pr_debug("nlccr1 = 0x%08x\n", new_regs.lccr1);
594 DPRINTK("nlccr2 = 0x%08x\n", new_regs.lccr2); 594 pr_debug("nlccr2 = 0x%08x\n", new_regs.lccr2);
595 DPRINTK("nlccr3 = 0x%08x\n", new_regs.lccr3); 595 pr_debug("nlccr3 = 0x%08x\n", new_regs.lccr3);
596 596
597 /* Update shadow copy atomically */ 597 /* Update shadow copy atomically */
598 local_irq_save(flags); 598 local_irq_save(flags);
@@ -637,24 +637,24 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *
637 } 637 }
638 638
639#if 0 639#if 0
640 DPRINTK("fbi->dmadesc_fblow_cpu = 0x%p\n", fbi->dmadesc_fblow_cpu); 640 pr_debug("fbi->dmadesc_fblow_cpu = 0x%p\n", fbi->dmadesc_fblow_cpu);
641 DPRINTK("fbi->dmadesc_fbhigh_cpu = 0x%p\n", fbi->dmadesc_fbhigh_cpu); 641 pr_debug("fbi->dmadesc_fbhigh_cpu = 0x%p\n", fbi->dmadesc_fbhigh_cpu);
642 DPRINTK("fbi->dmadesc_palette_cpu = 0x%p\n", fbi->dmadesc_palette_cpu); 642 pr_debug("fbi->dmadesc_palette_cpu = 0x%p\n", fbi->dmadesc_palette_cpu);
643 DPRINTK("fbi->dmadesc_fblow_dma = 0x%x\n", fbi->dmadesc_fblow_dma); 643 pr_debug("fbi->dmadesc_fblow_dma = 0x%x\n", fbi->dmadesc_fblow_dma);
644 DPRINTK("fbi->dmadesc_fbhigh_dma = 0x%x\n", fbi->dmadesc_fbhigh_dma); 644 pr_debug("fbi->dmadesc_fbhigh_dma = 0x%x\n", fbi->dmadesc_fbhigh_dma);
645 DPRINTK("fbi->dmadesc_palette_dma = 0x%x\n", fbi->dmadesc_palette_dma); 645 pr_debug("fbi->dmadesc_palette_dma = 0x%x\n", fbi->dmadesc_palette_dma);
646 646
647 DPRINTK("fbi->dmadesc_fblow_cpu->fdadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fdadr); 647 pr_debug("fbi->dmadesc_fblow_cpu->fdadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fdadr);
648 DPRINTK("fbi->dmadesc_fbhigh_cpu->fdadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fdadr); 648 pr_debug("fbi->dmadesc_fbhigh_cpu->fdadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fdadr);
649 DPRINTK("fbi->dmadesc_palette_cpu->fdadr = 0x%x\n", fbi->dmadesc_palette_cpu->fdadr); 649 pr_debug("fbi->dmadesc_palette_cpu->fdadr = 0x%x\n", fbi->dmadesc_palette_cpu->fdadr);
650 650
651 DPRINTK("fbi->dmadesc_fblow_cpu->fsadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fsadr); 651 pr_debug("fbi->dmadesc_fblow_cpu->fsadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fsadr);
652 DPRINTK("fbi->dmadesc_fbhigh_cpu->fsadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fsadr); 652 pr_debug("fbi->dmadesc_fbhigh_cpu->fsadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fsadr);
653 DPRINTK("fbi->dmadesc_palette_cpu->fsadr = 0x%x\n", fbi->dmadesc_palette_cpu->fsadr); 653 pr_debug("fbi->dmadesc_palette_cpu->fsadr = 0x%x\n", fbi->dmadesc_palette_cpu->fsadr);
654 654
655 DPRINTK("fbi->dmadesc_fblow_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fblow_cpu->ldcmd); 655 pr_debug("fbi->dmadesc_fblow_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fblow_cpu->ldcmd);
656 DPRINTK("fbi->dmadesc_fbhigh_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fbhigh_cpu->ldcmd); 656 pr_debug("fbi->dmadesc_fbhigh_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fbhigh_cpu->ldcmd);
657 DPRINTK("fbi->dmadesc_palette_cpu->ldcmd = 0x%x\n", fbi->dmadesc_palette_cpu->ldcmd); 657 pr_debug("fbi->dmadesc_palette_cpu->ldcmd = 0x%x\n", fbi->dmadesc_palette_cpu->ldcmd);
658#endif 658#endif
659 659
660 fbi->reg_lccr0 = new_regs.lccr0; 660 fbi->reg_lccr0 = new_regs.lccr0;
@@ -684,7 +684,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *
684 */ 684 */
685static inline void __pxafb_backlight_power(struct pxafb_info *fbi, int on) 685static inline void __pxafb_backlight_power(struct pxafb_info *fbi, int on)
686{ 686{
687 DPRINTK("backlight o%s\n", on ? "n" : "ff"); 687 pr_debug("pxafb: backlight o%s\n", on ? "n" : "ff");
688 688
689 if (pxafb_backlight_power) 689 if (pxafb_backlight_power)
690 pxafb_backlight_power(on); 690 pxafb_backlight_power(on);
@@ -692,7 +692,7 @@ static inline void __pxafb_backlight_power(struct pxafb_info *fbi, int on)
692 692
693static inline void __pxafb_lcd_power(struct pxafb_info *fbi, int on) 693static inline void __pxafb_lcd_power(struct pxafb_info *fbi, int on)
694{ 694{
695 DPRINTK("LCD power o%s\n", on ? "n" : "ff"); 695 pr_debug("pxafb: LCD power o%s\n", on ? "n" : "ff");
696 696
697 if (pxafb_lcd_power) 697 if (pxafb_lcd_power)
698 pxafb_lcd_power(on); 698 pxafb_lcd_power(on);
@@ -740,13 +740,13 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi)
740 740
741static void pxafb_enable_controller(struct pxafb_info *fbi) 741static void pxafb_enable_controller(struct pxafb_info *fbi)
742{ 742{
743 DPRINTK("Enabling LCD controller\n"); 743 pr_debug("pxafb: Enabling LCD controller\n");
744 DPRINTK("fdadr0 0x%08x\n", (unsigned int) fbi->fdadr0); 744 pr_debug("fdadr0 0x%08x\n", (unsigned int) fbi->fdadr0);
745 DPRINTK("fdadr1 0x%08x\n", (unsigned int) fbi->fdadr1); 745 pr_debug("fdadr1 0x%08x\n", (unsigned int) fbi->fdadr1);
746 DPRINTK("reg_lccr0 0x%08x\n", (unsigned int) fbi->reg_lccr0); 746 pr_debug("reg_lccr0 0x%08x\n", (unsigned int) fbi->reg_lccr0);
747 DPRINTK("reg_lccr1 0x%08x\n", (unsigned int) fbi->reg_lccr1); 747 pr_debug("reg_lccr1 0x%08x\n", (unsigned int) fbi->reg_lccr1);
748 DPRINTK("reg_lccr2 0x%08x\n", (unsigned int) fbi->reg_lccr2); 748 pr_debug("reg_lccr2 0x%08x\n", (unsigned int) fbi->reg_lccr2);
749 DPRINTK("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3); 749 pr_debug("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3);
750 750
751 /* enable LCD controller clock */ 751 /* enable LCD controller clock */
752 pxa_set_cken(CKEN16_LCD, 1); 752 pxa_set_cken(CKEN16_LCD, 1);
@@ -761,19 +761,19 @@ static void pxafb_enable_controller(struct pxafb_info *fbi)
761 FDADR1 = fbi->fdadr1; 761 FDADR1 = fbi->fdadr1;
762 LCCR0 |= LCCR0_ENB; 762 LCCR0 |= LCCR0_ENB;
763 763
764 DPRINTK("FDADR0 0x%08x\n", (unsigned int) FDADR0); 764 pr_debug("FDADR0 0x%08x\n", (unsigned int) FDADR0);
765 DPRINTK("FDADR1 0x%08x\n", (unsigned int) FDADR1); 765 pr_debug("FDADR1 0x%08x\n", (unsigned int) FDADR1);
766 DPRINTK("LCCR0 0x%08x\n", (unsigned int) LCCR0); 766 pr_debug("LCCR0 0x%08x\n", (unsigned int) LCCR0);
767 DPRINTK("LCCR1 0x%08x\n", (unsigned int) LCCR1); 767 pr_debug("LCCR1 0x%08x\n", (unsigned int) LCCR1);
768 DPRINTK("LCCR2 0x%08x\n", (unsigned int) LCCR2); 768 pr_debug("LCCR2 0x%08x\n", (unsigned int) LCCR2);
769 DPRINTK("LCCR3 0x%08x\n", (unsigned int) LCCR3); 769 pr_debug("LCCR3 0x%08x\n", (unsigned int) LCCR3);
770} 770}
771 771
772static void pxafb_disable_controller(struct pxafb_info *fbi) 772static void pxafb_disable_controller(struct pxafb_info *fbi)
773{ 773{
774 DECLARE_WAITQUEUE(wait, current); 774 DECLARE_WAITQUEUE(wait, current);
775 775
776 DPRINTK("Disabling LCD controller\n"); 776 pr_debug("pxafb: disabling LCD controller\n");
777 777
778 set_current_state(TASK_UNINTERRUPTIBLE); 778 set_current_state(TASK_UNINTERRUPTIBLE);
779 add_wait_queue(&fbi->ctrlr_wait, &wait); 779 add_wait_queue(&fbi->ctrlr_wait, &wait);
@@ -1039,7 +1039,7 @@ static int __init pxafb_map_video_memory(struct pxafb_info *fbi)
1039 fbi->palette_size = fbi->fb.var.bits_per_pixel == 8 ? 256 : 16; 1039 fbi->palette_size = fbi->fb.var.bits_per_pixel == 8 ? 256 : 16;
1040 1040
1041 palette_mem_size = fbi->palette_size * sizeof(u16); 1041 palette_mem_size = fbi->palette_size * sizeof(u16);
1042 DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size); 1042 pr_debug("pxafb: palette_mem_size = 0x%08lx\n", palette_mem_size);
1043 1043
1044 fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size); 1044 fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size);
1045 fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size; 1045 fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size;
diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h
index 22c00be786a8..47f41f70db7a 100644
--- a/drivers/video/pxafb.h
+++ b/drivers/video/pxafb.h
@@ -114,15 +114,6 @@ struct pxafb_info {
114#define PXA_NAME "PXA" 114#define PXA_NAME "PXA"
115 115
116/* 116/*
117 * Debug macros
118 */
119#if DEBUG
120# define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
121#else
122# define DPRINTK(fmt, args...)
123#endif
124
125/*
126 * Minimum X and Y resolutions 117 * Minimum X and Y resolutions
127 */ 118 */
128#define MIN_XRES 64 119#define MIN_XRES 64
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 00c0223a352e..5ab79afb53b7 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -228,8 +228,8 @@ static int s3c2410fb_check_var(struct fb_var_screeninfo *var,
228 * information 228 * information
229*/ 229*/
230 230
231static int s3c2410fb_activate_var(struct s3c2410fb_info *fbi, 231static void s3c2410fb_activate_var(struct s3c2410fb_info *fbi,
232 struct fb_var_screeninfo *var) 232 struct fb_var_screeninfo *var)
233{ 233{
234 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_MODEMASK; 234 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_MODEMASK;
235 235
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index a4799e971d1c..bbc3cc63854f 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -175,16 +175,16 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
175} 175}
176 176
177/** 177/**
178 * v9fs_read - read from a file (internal) 178 * v9fs_file_read - read from a file
179 * @filep: file pointer to read 179 * @filep: file pointer to read
180 * @data: data buffer to read data into 180 * @data: data buffer to read data into
181 * @count: size of buffer 181 * @count: size of buffer
182 * @offset: offset at which to read data 182 * @offset: offset at which to read data
183 * 183 *
184 */ 184 */
185
186static ssize_t 185static ssize_t
187v9fs_read(struct file *filp, char *buffer, size_t count, loff_t * offset) 186v9fs_file_read(struct file *filp, char __user * data, size_t count,
187 loff_t * offset)
188{ 188{
189 struct inode *inode = filp->f_dentry->d_inode; 189 struct inode *inode = filp->f_dentry->d_inode;
190 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); 190 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
@@ -194,6 +194,7 @@ v9fs_read(struct file *filp, char *buffer, size_t count, loff_t * offset)
194 int rsize = 0; 194 int rsize = 0;
195 int result = 0; 195 int result = 0;
196 int total = 0; 196 int total = 0;
197 int n;
197 198
198 dprintk(DEBUG_VFS, "\n"); 199 dprintk(DEBUG_VFS, "\n");
199 200
@@ -216,10 +217,15 @@ v9fs_read(struct file *filp, char *buffer, size_t count, loff_t * offset)
216 } else 217 } else
217 *offset += result; 218 *offset += result;
218 219
219 /* XXX - extra copy */ 220 n = copy_to_user(data, fcall->params.rread.data, result);
220 memcpy(buffer, fcall->params.rread.data, result); 221 if (n) {
222 dprintk(DEBUG_ERROR, "Problem copying to user %d\n", n);
223 kfree(fcall);
224 return -EFAULT;
225 }
226
221 count -= result; 227 count -= result;
222 buffer += result; 228 data += result;
223 total += result; 229 total += result;
224 230
225 kfree(fcall); 231 kfree(fcall);
@@ -232,42 +238,7 @@ v9fs_read(struct file *filp, char *buffer, size_t count, loff_t * offset)
232} 238}
233 239
234/** 240/**
235 * v9fs_file_read - read from a file 241 * v9fs_file_write - write to a file
236 * @filep: file pointer to read
237 * @data: data buffer to read data into
238 * @count: size of buffer
239 * @offset: offset at which to read data
240 *
241 */
242
243static ssize_t
244v9fs_file_read(struct file *filp, char __user * data, size_t count,
245 loff_t * offset)
246{
247 int retval = -1;
248 int ret = 0;
249 char *buffer;
250
251 buffer = kmalloc(count, GFP_KERNEL);
252 if (!buffer)
253 return -ENOMEM;
254
255 retval = v9fs_read(filp, buffer, count, offset);
256 if (retval > 0) {
257 if ((ret = copy_to_user(data, buffer, retval)) != 0) {
258 dprintk(DEBUG_ERROR, "Problem copying to user %d\n",
259 ret);
260 retval = ret;
261 }
262 }
263
264 kfree(buffer);
265
266 return retval;
267}
268
269/**
270 * v9fs_write - write to a file
271 * @filep: file pointer to write 242 * @filep: file pointer to write
272 * @data: data buffer to write data from 243 * @data: data buffer to write data from
273 * @count: size of buffer 244 * @count: size of buffer
@@ -276,7 +247,8 @@ v9fs_file_read(struct file *filp, char __user * data, size_t count,
276 */ 247 */
277 248
278static ssize_t 249static ssize_t
279v9fs_write(struct file *filp, char *buffer, size_t count, loff_t * offset) 250v9fs_file_write(struct file *filp, const char __user * data,
251 size_t count, loff_t * offset)
280{ 252{
281 struct inode *inode = filp->f_dentry->d_inode; 253 struct inode *inode = filp->f_dentry->d_inode;
282 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); 254 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
@@ -286,30 +258,42 @@ v9fs_write(struct file *filp, char *buffer, size_t count, loff_t * offset)
286 int result = -EIO; 258 int result = -EIO;
287 int rsize = 0; 259 int rsize = 0;
288 int total = 0; 260 int total = 0;
261 char *buf;
289 262
290 dprintk(DEBUG_VFS, "data %p count %d offset %x\n", buffer, (int)count, 263 dprintk(DEBUG_VFS, "data %p count %d offset %x\n", data, (int)count,
291 (int)*offset); 264 (int)*offset);
292 rsize = v9ses->maxdata - V9FS_IOHDRSZ; 265 rsize = v9ses->maxdata - V9FS_IOHDRSZ;
293 if (v9fid->iounit != 0 && rsize > v9fid->iounit) 266 if (v9fid->iounit != 0 && rsize > v9fid->iounit)
294 rsize = v9fid->iounit; 267 rsize = v9fid->iounit;
295 268
296 dump_data(buffer, count); 269 buf = kmalloc(v9ses->maxdata - V9FS_IOHDRSZ, GFP_KERNEL);
270 if (!buf)
271 return -ENOMEM;
297 272
298 do { 273 do {
299 if (count < rsize) 274 if (count < rsize)
300 rsize = count; 275 rsize = count;
301 276
302 result = 277 result = copy_from_user(buf, data, rsize);
303 v9fs_t_write(v9ses, fid, *offset, rsize, buffer, &fcall); 278 if (result) {
279 dprintk(DEBUG_ERROR, "Problem copying from user\n");
280 kfree(buf);
281 return -EFAULT;
282 }
283
284 dump_data(buf, rsize);
285 result = v9fs_t_write(v9ses, fid, *offset, rsize, buf, &fcall);
304 if (result < 0) { 286 if (result < 0) {
305 eprintk(KERN_ERR, "error while writing: %s(%d)\n", 287 eprintk(KERN_ERR, "error while writing: %s(%d)\n",
306 FCALL_ERROR(fcall), result); 288 FCALL_ERROR(fcall), result);
307 kfree(fcall); 289 kfree(fcall);
290 kfree(buf);
308 return result; 291 return result;
309 } else 292 } else
310 *offset += result; 293 *offset += result;
311 294
312 kfree(fcall); 295 kfree(fcall);
296 fcall = NULL;
313 297
314 if (result != rsize) { 298 if (result != rsize) {
315 eprintk(KERN_ERR, 299 eprintk(KERN_ERR,
@@ -319,46 +303,14 @@ v9fs_write(struct file *filp, char *buffer, size_t count, loff_t * offset)
319 } 303 }
320 304
321 count -= result; 305 count -= result;
322 buffer += result; 306 data += result;
323 total += result; 307 total += result;
324 } while (count); 308 } while (count);
325 309
310 kfree(buf);
326 return total; 311 return total;
327} 312}
328 313
329/**
330 * v9fs_file_write - write to a file
331 * @filep: file pointer to write
332 * @data: data buffer to write data from
333 * @count: size of buffer
334 * @offset: offset at which to write data
335 *
336 */
337
338static ssize_t
339v9fs_file_write(struct file *filp, const char __user * data,
340 size_t count, loff_t * offset)
341{
342 int ret = -1;
343 char *buffer;
344
345 buffer = kmalloc(count, GFP_KERNEL);
346 if (buffer == NULL)
347 return -ENOMEM;
348
349 ret = copy_from_user(buffer, data, count);
350 if (ret) {
351 dprintk(DEBUG_ERROR, "Problem copying from user\n");
352 ret = -EFAULT;
353 } else {
354 ret = v9fs_write(filp, buffer, count, offset);
355 }
356
357 kfree(buffer);
358
359 return ret;
360}
361
362struct file_operations v9fs_file_operations = { 314struct file_operations v9fs_file_operations = {
363 .llseek = generic_file_llseek, 315 .llseek = generic_file_llseek,
364 .read = v9fs_file_read, 316 .read = v9fs_file_read,
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 0957f4da91d4..82c5b0084079 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -129,7 +129,7 @@ static struct super_block *v9fs_get_sb(struct file_system_type
129 129
130 if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { 130 if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) {
131 dprintk(DEBUG_ERROR, "problem initiating session\n"); 131 dprintk(DEBUG_ERROR, "problem initiating session\n");
132 return newfid; 132 return ERR_PTR(newfid);
133 } 133 }
134 134
135 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 135 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
diff --git a/fs/aio.c b/fs/aio.c
index 0e11e31dbb77..d6b1551342b7 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -741,19 +741,9 @@ static ssize_t aio_run_iocb(struct kiocb *iocb)
741 ret = retry(iocb); 741 ret = retry(iocb);
742 current->io_wait = NULL; 742 current->io_wait = NULL;
743 743
744 if (-EIOCBRETRY != ret) { 744 if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED) {
745 if (-EIOCBQUEUED != ret) { 745 BUG_ON(!list_empty(&iocb->ki_wait.task_list));
746 BUG_ON(!list_empty(&iocb->ki_wait.task_list)); 746 aio_complete(iocb, ret, 0);
747 aio_complete(iocb, ret, 0);
748 /* must not access the iocb after this */
749 }
750 } else {
751 /*
752 * Issue an additional retry to avoid waiting forever if
753 * no waits were queued (e.g. in case of a short read).
754 */
755 if (list_empty(&iocb->ki_wait.task_list))
756 kiocbSetKicked(iocb);
757 } 747 }
758out: 748out:
759 spin_lock_irq(&ctx->ctx_lock); 749 spin_lock_irq(&ctx->ctx_lock);
@@ -899,16 +889,24 @@ static void aio_kick_handler(void *data)
899 * and if required activate the aio work queue to process 889 * and if required activate the aio work queue to process
900 * it 890 * it
901 */ 891 */
902static void queue_kicked_iocb(struct kiocb *iocb) 892static void try_queue_kicked_iocb(struct kiocb *iocb)
903{ 893{
904 struct kioctx *ctx = iocb->ki_ctx; 894 struct kioctx *ctx = iocb->ki_ctx;
905 unsigned long flags; 895 unsigned long flags;
906 int run = 0; 896 int run = 0;
907 897
908 WARN_ON((!list_empty(&iocb->ki_wait.task_list))); 898 /* We're supposed to be the only path putting the iocb back on the run
899 * list. If we find that the iocb is *back* on a wait queue already
900 * than retry has happened before we could queue the iocb. This also
901 * means that the retry could have completed and freed our iocb, no
902 * good. */
903 BUG_ON((!list_empty(&iocb->ki_wait.task_list)));
909 904
910 spin_lock_irqsave(&ctx->ctx_lock, flags); 905 spin_lock_irqsave(&ctx->ctx_lock, flags);
911 run = __queue_kicked_iocb(iocb); 906 /* set this inside the lock so that we can't race with aio_run_iocb()
907 * testing it and putting the iocb on the run list under the lock */
908 if (!kiocbTryKick(iocb))
909 run = __queue_kicked_iocb(iocb);
912 spin_unlock_irqrestore(&ctx->ctx_lock, flags); 910 spin_unlock_irqrestore(&ctx->ctx_lock, flags);
913 if (run) 911 if (run)
914 aio_queue_work(ctx); 912 aio_queue_work(ctx);
@@ -931,10 +929,7 @@ void fastcall kick_iocb(struct kiocb *iocb)
931 return; 929 return;
932 } 930 }
933 931
934 /* If its already kicked we shouldn't queue it again */ 932 try_queue_kicked_iocb(iocb);
935 if (!kiocbTryKick(iocb)) {
936 queue_kicked_iocb(iocb);
937 }
938} 933}
939EXPORT_SYMBOL(kick_iocb); 934EXPORT_SYMBOL(kick_iocb);
940 935
@@ -1322,8 +1317,11 @@ asmlinkage long sys_io_destroy(aio_context_t ctx)
1322} 1317}
1323 1318
1324/* 1319/*
1325 * Default retry method for aio_read (also used for first time submit) 1320 * aio_p{read,write} are the default ki_retry methods for
1326 * Responsible for updating iocb state as retries progress 1321 * IO_CMD_P{READ,WRITE}. They maintains kiocb retry state around potentially
1322 * multiple calls to f_op->aio_read(). They loop around partial progress
1323 * instead of returning -EIOCBRETRY because they don't have the means to call
1324 * kick_iocb().
1327 */ 1325 */
1328static ssize_t aio_pread(struct kiocb *iocb) 1326static ssize_t aio_pread(struct kiocb *iocb)
1329{ 1327{
@@ -1332,25 +1330,25 @@ static ssize_t aio_pread(struct kiocb *iocb)
1332 struct inode *inode = mapping->host; 1330 struct inode *inode = mapping->host;
1333 ssize_t ret = 0; 1331 ssize_t ret = 0;
1334 1332
1335 ret = file->f_op->aio_read(iocb, iocb->ki_buf, 1333 do {
1336 iocb->ki_left, iocb->ki_pos); 1334 ret = file->f_op->aio_read(iocb, iocb->ki_buf,
1335 iocb->ki_left, iocb->ki_pos);
1336 /*
1337 * Can't just depend on iocb->ki_left to determine
1338 * whether we are done. This may have been a short read.
1339 */
1340 if (ret > 0) {
1341 iocb->ki_buf += ret;
1342 iocb->ki_left -= ret;
1343 }
1337 1344
1338 /*
1339 * Can't just depend on iocb->ki_left to determine
1340 * whether we are done. This may have been a short read.
1341 */
1342 if (ret > 0) {
1343 iocb->ki_buf += ret;
1344 iocb->ki_left -= ret;
1345 /* 1345 /*
1346 * For pipes and sockets we return once we have 1346 * For pipes and sockets we return once we have some data; for
1347 * some data; for regular files we retry till we 1347 * regular files we retry till we complete the entire read or
1348 * complete the entire read or find that we can't 1348 * find that we can't read any more data (e.g short reads).
1349 * read any more data (e.g short reads).
1350 */ 1349 */
1351 if (!S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)) 1350 } while (ret > 0 && iocb->ki_left > 0 &&
1352 ret = -EIOCBRETRY; 1351 !S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode));
1353 }
1354 1352
1355 /* This means we must have transferred all that we could */ 1353 /* This means we must have transferred all that we could */
1356 /* No need to retry anymore */ 1354 /* No need to retry anymore */
@@ -1360,27 +1358,21 @@ static ssize_t aio_pread(struct kiocb *iocb)
1360 return ret; 1358 return ret;
1361} 1359}
1362 1360
1363/* 1361/* see aio_pread() */
1364 * Default retry method for aio_write (also used for first time submit)
1365 * Responsible for updating iocb state as retries progress
1366 */
1367static ssize_t aio_pwrite(struct kiocb *iocb) 1362static ssize_t aio_pwrite(struct kiocb *iocb)
1368{ 1363{
1369 struct file *file = iocb->ki_filp; 1364 struct file *file = iocb->ki_filp;
1370 ssize_t ret = 0; 1365 ssize_t ret = 0;
1371 1366
1372 ret = file->f_op->aio_write(iocb, iocb->ki_buf, 1367 do {
1373 iocb->ki_left, iocb->ki_pos); 1368 ret = file->f_op->aio_write(iocb, iocb->ki_buf,
1374 1369 iocb->ki_left, iocb->ki_pos);
1375 if (ret > 0) { 1370 if (ret > 0) {
1376 iocb->ki_buf += ret; 1371 iocb->ki_buf += ret;
1377 iocb->ki_left -= ret; 1372 iocb->ki_left -= ret;
1378 1373 }
1379 ret = -EIOCBRETRY; 1374 } while (ret > 0 && iocb->ki_left > 0);
1380 }
1381 1375
1382 /* This means we must have transferred all that we could */
1383 /* No need to retry anymore */
1384 if ((ret == 0) || (iocb->ki_left == 0)) 1376 if ((ret == 0) || (iocb->ki_left == 0))
1385 ret = iocb->ki_nbytes - iocb->ki_left; 1377 ret = iocb->ki_nbytes - iocb->ki_left;
1386 1378
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index e240c335eb23..5af928fa0449 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -108,7 +108,7 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode,
108 inode->i_mapping->a_ops = &bfs_aops; 108 inode->i_mapping->a_ops = &bfs_aops;
109 inode->i_mode = mode; 109 inode->i_mode = mode;
110 inode->i_ino = ino; 110 inode->i_ino = ino;
111 BFS_I(inode)->i_dsk_ino = cpu_to_le16(ino); 111 BFS_I(inode)->i_dsk_ino = ino;
112 BFS_I(inode)->i_sblock = 0; 112 BFS_I(inode)->i_sblock = 0;
113 BFS_I(inode)->i_eblock = 0; 113 BFS_I(inode)->i_eblock = 0;
114 insert_inode_hash(inode); 114 insert_inode_hash(inode);
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index c7b39aa279d7..3af6c73c5b5a 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -357,28 +357,46 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
357 } 357 }
358 358
359 info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1)>>BFS_BSIZE_BITS; /* for statfs(2) */ 359 info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1)>>BFS_BSIZE_BITS; /* for statfs(2) */
360 info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - cpu_to_le32(bfs_sb->s_start))>>BFS_BSIZE_BITS; 360 info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - le32_to_cpu(bfs_sb->s_start))>>BFS_BSIZE_BITS;
361 info->si_freei = 0; 361 info->si_freei = 0;
362 info->si_lf_eblk = 0; 362 info->si_lf_eblk = 0;
363 info->si_lf_sblk = 0; 363 info->si_lf_sblk = 0;
364 info->si_lf_ioff = 0; 364 info->si_lf_ioff = 0;
365 bh = NULL;
365 for (i=BFS_ROOT_INO; i<=info->si_lasti; i++) { 366 for (i=BFS_ROOT_INO; i<=info->si_lasti; i++) {
366 inode = iget(s,i); 367 struct bfs_inode *di;
367 if (BFS_I(inode)->i_dsk_ino == 0) 368 int block = (i - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
369 int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
370 unsigned long sblock, eblock;
371
372 if (!off) {
373 brelse(bh);
374 bh = sb_bread(s, block);
375 }
376
377 if (!bh)
378 continue;
379
380 di = (struct bfs_inode *)bh->b_data + off;
381
382 if (!di->i_ino) {
368 info->si_freei++; 383 info->si_freei++;
369 else { 384 continue;
370 set_bit(i, info->si_imap); 385 }
371 info->si_freeb -= inode->i_blocks; 386 set_bit(i, info->si_imap);
372 if (BFS_I(inode)->i_eblock > info->si_lf_eblk) { 387 info->si_freeb -= BFS_FILEBLOCKS(di);
373 info->si_lf_eblk = BFS_I(inode)->i_eblock; 388
374 info->si_lf_sblk = BFS_I(inode)->i_sblock; 389 sblock = le32_to_cpu(di->i_sblock);
375 info->si_lf_ioff = BFS_INO2OFF(i); 390 eblock = le32_to_cpu(di->i_eblock);
376 } 391 if (eblock > info->si_lf_eblk) {
392 info->si_lf_eblk = eblock;
393 info->si_lf_sblk = sblock;
394 info->si_lf_ioff = BFS_INO2OFF(i);
377 } 395 }
378 iput(inode);
379 } 396 }
397 brelse(bh);
380 if (!(s->s_flags & MS_RDONLY)) { 398 if (!(s->s_flags & MS_RDONLY)) {
381 mark_buffer_dirty(bh); 399 mark_buffer_dirty(info->si_sbh);
382 s->s_dirt = 1; 400 s->s_dirt = 1;
383 } 401 }
384 dump_imap("read_super", s); 402 dump_imap("read_super", s);
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 7976a238f0a3..d4b15576e584 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -905,7 +905,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
905 send_sig(SIGKILL, current, 0); 905 send_sig(SIGKILL, current, 0);
906 goto out_free_dentry; 906 goto out_free_dentry;
907 } 907 }
908 if (padzero(elf_bss)) { 908 if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) {
909 send_sig(SIGSEGV, current, 0); 909 send_sig(SIGSEGV, current, 0);
910 retval = -EFAULT; /* Nobody gets to see this, but.. */ 910 retval = -EFAULT; /* Nobody gets to see this, but.. */
911 goto out_free_dentry; 911 goto out_free_dentry;
diff --git a/fs/bio.c b/fs/bio.c
index 83a349574567..7d81a93afd48 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -75,7 +75,7 @@ struct bio_set {
75 */ 75 */
76static struct bio_set *fs_bio_set; 76static struct bio_set *fs_bio_set;
77 77
78static inline struct bio_vec *bvec_alloc_bs(unsigned int __nocast gfp_mask, int nr, unsigned long *idx, struct bio_set *bs) 78static inline struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct bio_set *bs)
79{ 79{
80 struct bio_vec *bvl; 80 struct bio_vec *bvl;
81 struct biovec_slab *bp; 81 struct biovec_slab *bp;
@@ -155,7 +155,7 @@ inline void bio_init(struct bio *bio)
155 * allocate bio and iovecs from the memory pools specified by the 155 * allocate bio and iovecs from the memory pools specified by the
156 * bio_set structure. 156 * bio_set structure.
157 **/ 157 **/
158struct bio *bio_alloc_bioset(unsigned int __nocast gfp_mask, int nr_iovecs, struct bio_set *bs) 158struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
159{ 159{
160 struct bio *bio = mempool_alloc(bs->bio_pool, gfp_mask); 160 struct bio *bio = mempool_alloc(bs->bio_pool, gfp_mask);
161 161
@@ -181,7 +181,7 @@ out:
181 return bio; 181 return bio;
182} 182}
183 183
184struct bio *bio_alloc(unsigned int __nocast gfp_mask, int nr_iovecs) 184struct bio *bio_alloc(gfp_t gfp_mask, int nr_iovecs)
185{ 185{
186 struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); 186 struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set);
187 187
@@ -277,7 +277,7 @@ inline void __bio_clone(struct bio *bio, struct bio *bio_src)
277 * 277 *
278 * Like __bio_clone, only also allocates the returned bio 278 * Like __bio_clone, only also allocates the returned bio
279 */ 279 */
280struct bio *bio_clone(struct bio *bio, unsigned int __nocast gfp_mask) 280struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
281{ 281{
282 struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set); 282 struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set);
283 283
@@ -1078,7 +1078,7 @@ struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, int first_sectors)
1078 return bp; 1078 return bp;
1079} 1079}
1080 1080
1081static void *bio_pair_alloc(unsigned int __nocast gfp_flags, void *data) 1081static void *bio_pair_alloc(gfp_t gfp_flags, void *data)
1082{ 1082{
1083 return kmalloc(sizeof(struct bio_pair), gfp_flags); 1083 return kmalloc(sizeof(struct bio_pair), gfp_flags);
1084} 1084}
diff --git a/fs/buffer.c b/fs/buffer.c
index 6cbfceabd95d..1216c0d3c8ce 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3045,7 +3045,7 @@ static void recalc_bh_state(void)
3045 buffer_heads_over_limit = (tot > max_buffer_heads); 3045 buffer_heads_over_limit = (tot > max_buffer_heads);
3046} 3046}
3047 3047
3048struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags) 3048struct buffer_head *alloc_buffer_head(gfp_t gfp_flags)
3049{ 3049{
3050 struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags); 3050 struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags);
3051 if (ret) { 3051 if (ret) {
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6454022b0536..657ab11c173b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -23,6 +23,10 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir)
23 struct fuse_file *ff; 23 struct fuse_file *ff;
24 int err; 24 int err;
25 25
26 /* VFS checks this, but only _after_ ->open() */
27 if (file->f_flags & O_DIRECT)
28 return -EINVAL;
29
26 err = generic_file_open(inode, file); 30 err = generic_file_open(inode, file);
27 if (err) 31 if (err)
28 return err; 32 return err;
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 59c5062cd63f..dd7113106269 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -793,11 +793,6 @@ int hostfs_rename(struct inode *from_ino, struct dentry *from,
793 return(err); 793 return(err);
794} 794}
795 795
796void hostfs_truncate(struct inode *ino)
797{
798 not_implemented();
799}
800
801int hostfs_permission(struct inode *ino, int desired, struct nameidata *nd) 796int hostfs_permission(struct inode *ino, int desired, struct nameidata *nd)
802{ 797{
803 char *name; 798 char *name;
@@ -894,7 +889,6 @@ static struct inode_operations hostfs_iops = {
894 .rmdir = hostfs_rmdir, 889 .rmdir = hostfs_rmdir,
895 .mknod = hostfs_mknod, 890 .mknod = hostfs_mknod,
896 .rename = hostfs_rename, 891 .rename = hostfs_rename,
897 .truncate = hostfs_truncate,
898 .permission = hostfs_permission, 892 .permission = hostfs_permission,
899 .setattr = hostfs_setattr, 893 .setattr = hostfs_setattr,
900 .getattr = hostfs_getattr, 894 .getattr = hostfs_getattr,
@@ -910,7 +904,6 @@ static struct inode_operations hostfs_dir_iops = {
910 .rmdir = hostfs_rmdir, 904 .rmdir = hostfs_rmdir,
911 .mknod = hostfs_mknod, 905 .mknod = hostfs_mknod,
912 .rename = hostfs_rename, 906 .rename = hostfs_rename,
913 .truncate = hostfs_truncate,
914 .permission = hostfs_permission, 907 .permission = hostfs_permission,
915 .setattr = hostfs_setattr, 908 .setattr = hostfs_setattr,
916 .getattr = hostfs_getattr, 909 .getattr = hostfs_getattr,
diff --git a/fs/mpage.c b/fs/mpage.c
index bb9aebe93862..c5adcdddf3cc 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -102,7 +102,7 @@ static struct bio *mpage_bio_submit(int rw, struct bio *bio)
102static struct bio * 102static struct bio *
103mpage_alloc(struct block_device *bdev, 103mpage_alloc(struct block_device *bdev,
104 sector_t first_sector, int nr_vecs, 104 sector_t first_sector, int nr_vecs,
105 unsigned int __nocast gfp_flags) 105 gfp_t gfp_flags)
106{ 106{
107 struct bio *bio; 107 struct bio *bio;
108 108
diff --git a/fs/namei.c b/fs/namei.c
index 043d587216b5..aa62dbda93ac 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1551,19 +1551,19 @@ do_link:
1551 if (nd->last_type != LAST_NORM) 1551 if (nd->last_type != LAST_NORM)
1552 goto exit; 1552 goto exit;
1553 if (nd->last.name[nd->last.len]) { 1553 if (nd->last.name[nd->last.len]) {
1554 putname(nd->last.name); 1554 __putname(nd->last.name);
1555 goto exit; 1555 goto exit;
1556 } 1556 }
1557 error = -ELOOP; 1557 error = -ELOOP;
1558 if (count++==32) { 1558 if (count++==32) {
1559 putname(nd->last.name); 1559 __putname(nd->last.name);
1560 goto exit; 1560 goto exit;
1561 } 1561 }
1562 dir = nd->dentry; 1562 dir = nd->dentry;
1563 down(&dir->d_inode->i_sem); 1563 down(&dir->d_inode->i_sem);
1564 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd); 1564 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
1565 path.mnt = nd->mnt; 1565 path.mnt = nd->mnt;
1566 putname(nd->last.name); 1566 __putname(nd->last.name);
1567 goto do_last; 1567 goto do_last;
1568} 1568}
1569 1569
diff --git a/fs/nfs_common/nfsacl.c b/fs/nfs_common/nfsacl.c
index 251e5a1bb1c4..0c2be8c0307d 100644
--- a/fs/nfs_common/nfsacl.c
+++ b/fs/nfs_common/nfsacl.c
@@ -48,43 +48,26 @@ xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem)
48 (struct nfsacl_encode_desc *) desc; 48 (struct nfsacl_encode_desc *) desc;
49 u32 *p = (u32 *) elem; 49 u32 *p = (u32 *) elem;
50 50
51 if (nfsacl_desc->count < nfsacl_desc->acl->a_count) { 51 struct posix_acl_entry *entry =
52 struct posix_acl_entry *entry = 52 &nfsacl_desc->acl->a_entries[nfsacl_desc->count++];
53 &nfsacl_desc->acl->a_entries[nfsacl_desc->count++];
54 53
55 *p++ = htonl(entry->e_tag | nfsacl_desc->typeflag); 54 *p++ = htonl(entry->e_tag | nfsacl_desc->typeflag);
56 switch(entry->e_tag) { 55 switch(entry->e_tag) {
57 case ACL_USER_OBJ: 56 case ACL_USER_OBJ:
58 *p++ = htonl(nfsacl_desc->uid); 57 *p++ = htonl(nfsacl_desc->uid);
59 break; 58 break;
60 case ACL_GROUP_OBJ: 59 case ACL_GROUP_OBJ:
61 *p++ = htonl(nfsacl_desc->gid); 60 *p++ = htonl(nfsacl_desc->gid);
62 break; 61 break;
63 case ACL_USER: 62 case ACL_USER:
64 case ACL_GROUP: 63 case ACL_GROUP:
65 *p++ = htonl(entry->e_id); 64 *p++ = htonl(entry->e_id);
66 break; 65 break;
67 default: /* Solaris depends on that! */ 66 default: /* Solaris depends on that! */
68 *p++ = 0; 67 *p++ = 0;
69 break; 68 break;
70 }
71 *p++ = htonl(entry->e_perm & S_IRWXO);
72 } else {
73 const struct posix_acl_entry *pa, *pe;
74 int group_obj_perm = ACL_READ|ACL_WRITE|ACL_EXECUTE;
75
76 FOREACH_ACL_ENTRY(pa, nfsacl_desc->acl, pe) {
77 if (pa->e_tag == ACL_GROUP_OBJ) {
78 group_obj_perm = pa->e_perm & S_IRWXO;
79 break;
80 }
81 }
82 /* fake up ACL_MASK entry */
83 *p++ = htonl(ACL_MASK | nfsacl_desc->typeflag);
84 *p++ = htonl(0);
85 *p++ = htonl(group_obj_perm);
86 } 69 }
87 70 *p++ = htonl(entry->e_perm & S_IRWXO);
88 return 0; 71 return 0;
89} 72}
90 73
@@ -105,11 +88,28 @@ nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode,
105 .gid = inode->i_gid, 88 .gid = inode->i_gid,
106 }; 89 };
107 int err; 90 int err;
91 struct posix_acl *acl2 = NULL;
108 92
109 if (entries > NFS_ACL_MAX_ENTRIES || 93 if (entries > NFS_ACL_MAX_ENTRIES ||
110 xdr_encode_word(buf, base, entries)) 94 xdr_encode_word(buf, base, entries))
111 return -EINVAL; 95 return -EINVAL;
96 if (encode_entries && acl && acl->a_count == 3) {
97 /* Fake up an ACL_MASK entry. */
98 acl2 = posix_acl_alloc(4, GFP_KERNEL);
99 if (!acl2)
100 return -ENOMEM;
101 /* Insert entries in canonical order: other orders seem
102 to confuse Solaris VxFS. */
103 acl2->a_entries[0] = acl->a_entries[0]; /* ACL_USER_OBJ */
104 acl2->a_entries[1] = acl->a_entries[1]; /* ACL_GROUP_OBJ */
105 acl2->a_entries[2] = acl->a_entries[1]; /* ACL_MASK */
106 acl2->a_entries[2].e_tag = ACL_MASK;
107 acl2->a_entries[3] = acl->a_entries[2]; /* ACL_OTHER */
108 nfsacl_desc.acl = acl2;
109 }
112 err = xdr_encode_array2(buf, base + 4, &nfsacl_desc.desc); 110 err = xdr_encode_array2(buf, base + 4, &nfsacl_desc.desc);
111 if (acl2)
112 posix_acl_release(acl2);
113 if (!err) 113 if (!err)
114 err = 8 + nfsacl_desc.desc.elem_size * 114 err = 8 + nfsacl_desc.desc.elem_size *
115 nfsacl_desc.desc.array_len; 115 nfsacl_desc.desc.array_len;
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 83f3322765cd..de58579a1d0e 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -102,6 +102,9 @@ ToDo/Notes:
102 inode instead of a vfs inode as parameter. 102 inode instead of a vfs inode as parameter.
103 - Fix the definition of the CHKD ntfs record magic. It had an off by 103 - Fix the definition of the CHKD ntfs record magic. It had an off by
104 two error causing it to be CHKB instead of CHKD. 104 two error causing it to be CHKB instead of CHKD.
105 - Fix a stupid bug in __ntfs_bitmap_set_bits_in_run() which caused the
106 count to become negative and hence we had a wild memset() scribbling
107 all over the system's ram.
105 108
1062.1.23 - Implement extension of resident files and make writing safe as well as 1092.1.23 - Implement extension of resident files and make writing safe as well as
107 many bug fixes, cleanups, and enhancements... 110 many bug fixes, cleanups, and enhancements...
diff --git a/fs/ntfs/bitmap.c b/fs/ntfs/bitmap.c
index 12cf2e30c7dd..7a190cdc60e2 100644
--- a/fs/ntfs/bitmap.c
+++ b/fs/ntfs/bitmap.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * bitmap.c - NTFS kernel bitmap handling. Part of the Linux-NTFS project. 2 * bitmap.c - NTFS kernel bitmap handling. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2004 Anton Altaparmakov 4 * Copyright (c) 2004-2005 Anton Altaparmakov
5 * 5 *
6 * This program/include file is free software; you can redistribute it and/or 6 * This program/include file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published 7 * modify it under the terms of the GNU General Public License as published
@@ -90,7 +90,8 @@ int __ntfs_bitmap_set_bits_in_run(struct inode *vi, const s64 start_bit,
90 /* If the first byte is partial, modify the appropriate bits in it. */ 90 /* If the first byte is partial, modify the appropriate bits in it. */
91 if (bit) { 91 if (bit) {
92 u8 *byte = kaddr + pos; 92 u8 *byte = kaddr + pos;
93 while ((bit & 7) && cnt--) { 93 while ((bit & 7) && cnt) {
94 cnt--;
94 if (value) 95 if (value)
95 *byte |= 1 << bit++; 96 *byte |= 1 << bit++;
96 else 97 else
diff --git a/fs/ntfs/layout.h b/fs/ntfs/layout.h
index 01f2dfa39cec..5c248d404f05 100644
--- a/fs/ntfs/layout.h
+++ b/fs/ntfs/layout.h
@@ -309,7 +309,7 @@ typedef le16 MFT_RECORD_FLAGS;
309 * Note: The _LE versions will return a CPU endian formatted value! 309 * Note: The _LE versions will return a CPU endian formatted value!
310 */ 310 */
311#define MFT_REF_MASK_CPU 0x0000ffffffffffffULL 311#define MFT_REF_MASK_CPU 0x0000ffffffffffffULL
312#define MFT_REF_MASK_LE const_cpu_to_le64(0x0000ffffffffffffULL) 312#define MFT_REF_MASK_LE const_cpu_to_le64(MFT_REF_MASK_CPU)
313 313
314typedef u64 MFT_REF; 314typedef u64 MFT_REF;
315typedef le64 leMFT_REF; 315typedef le64 leMFT_REF;
diff --git a/fs/ntfs/malloc.h b/fs/ntfs/malloc.h
index 006946efca8c..590887b943f5 100644
--- a/fs/ntfs/malloc.h
+++ b/fs/ntfs/malloc.h
@@ -40,7 +40,7 @@
40 * Depending on @gfp_mask the allocation may be guaranteed to succeed. 40 * Depending on @gfp_mask the allocation may be guaranteed to succeed.
41 */ 41 */
42static inline void *__ntfs_malloc(unsigned long size, 42static inline void *__ntfs_malloc(unsigned long size,
43 unsigned int __nocast gfp_mask) 43 gfp_t gfp_mask)
44{ 44{
45 if (likely(size <= PAGE_SIZE)) { 45 if (likely(size <= PAGE_SIZE)) {
46 BUG_ON(!size); 46 BUG_ON(!size);
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 247586d1d5dc..b011369b5956 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -58,7 +58,8 @@ static inline MFT_RECORD *map_mft_record_page(ntfs_inode *ni)
58 * overflowing the unsigned long, but I don't think we would ever get 58 * overflowing the unsigned long, but I don't think we would ever get
59 * here if the volume was that big... 59 * here if the volume was that big...
60 */ 60 */
61 index = ni->mft_no << vol->mft_record_size_bits >> PAGE_CACHE_SHIFT; 61 index = (u64)ni->mft_no << vol->mft_record_size_bits >>
62 PAGE_CACHE_SHIFT;
62 ofs = (ni->mft_no << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK; 63 ofs = (ni->mft_no << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK;
63 64
64 i_size = i_size_read(mft_vi); 65 i_size = i_size_read(mft_vi);
diff --git a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c
index a389a5a16c84..0ea887fc859c 100644
--- a/fs/ntfs/unistr.c
+++ b/fs/ntfs/unistr.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * unistr.c - NTFS Unicode string handling. Part of the Linux-NTFS project. 2 * unistr.c - NTFS Unicode string handling. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2001-2004 Anton Altaparmakov 4 * Copyright (c) 2001-2005 Anton Altaparmakov
5 * 5 *
6 * This program/include file is free software; you can redistribute it and/or 6 * This program/include file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published 7 * modify it under the terms of the GNU General Public License as published
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 296480e96dd5..6c8dcf7613fd 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -35,7 +35,7 @@ EXPORT_SYMBOL(posix_acl_permission);
35 * Allocate a new ACL with the specified number of entries. 35 * Allocate a new ACL with the specified number of entries.
36 */ 36 */
37struct posix_acl * 37struct posix_acl *
38posix_acl_alloc(int count, unsigned int __nocast flags) 38posix_acl_alloc(int count, gfp_t flags)
39{ 39{
40 const size_t size = sizeof(struct posix_acl) + 40 const size_t size = sizeof(struct posix_acl) +
41 count * sizeof(struct posix_acl_entry); 41 count * sizeof(struct posix_acl_entry);
@@ -51,7 +51,7 @@ posix_acl_alloc(int count, unsigned int __nocast flags)
51 * Clone an ACL. 51 * Clone an ACL.
52 */ 52 */
53struct posix_acl * 53struct posix_acl *
54posix_acl_clone(const struct posix_acl *acl, unsigned int __nocast flags) 54posix_acl_clone(const struct posix_acl *acl, gfp_t flags)
55{ 55{
56 struct posix_acl *clone = NULL; 56 struct posix_acl *clone = NULL;
57 57
@@ -185,7 +185,7 @@ posix_acl_equiv_mode(const struct posix_acl *acl, mode_t *mode_p)
185 * Create an ACL representing the file mode permission bits of an inode. 185 * Create an ACL representing the file mode permission bits of an inode.
186 */ 186 */
187struct posix_acl * 187struct posix_acl *
188posix_acl_from_mode(mode_t mode, unsigned int __nocast flags) 188posix_acl_from_mode(mode_t mode, gfp_t flags)
189{ 189{
190 struct posix_acl *acl = posix_acl_alloc(3, flags); 190 struct posix_acl *acl = posix_acl_alloc(3, flags);
191 if (!acl) 191 if (!acl)
diff --git a/fs/read_write.c b/fs/read_write.c
index b60324aaa2b6..a091ee4f430d 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -499,6 +499,9 @@ static ssize_t do_readv_writev(int type, struct file *file,
499 ret = rw_verify_area(type, file, pos, tot_len); 499 ret = rw_verify_area(type, file, pos, tot_len);
500 if (ret) 500 if (ret)
501 goto out; 501 goto out;
502 ret = security_file_permission(file, type == READ ? MAY_READ : MAY_WRITE);
503 if (ret)
504 goto out;
502 505
503 fnv = NULL; 506 fnv = NULL;
504 if (type == READ) { 507 if (type == READ) {
diff --git a/fs/relayfs/buffers.c b/fs/relayfs/buffers.c
index 2aa8e2719999..84e21ffa5ca8 100644
--- a/fs/relayfs/buffers.c
+++ b/fs/relayfs/buffers.c
@@ -109,7 +109,7 @@ static void *relay_alloc_buf(struct rchan_buf *buf, unsigned long size)
109 if (unlikely(!buf->page_array[i])) 109 if (unlikely(!buf->page_array[i]))
110 goto depopulate; 110 goto depopulate;
111 } 111 }
112 mem = vmap(buf->page_array, n_pages, GFP_KERNEL, PAGE_KERNEL); 112 mem = vmap(buf->page_array, n_pages, VM_MAP, PAGE_KERNEL);
113 if (!mem) 113 if (!mem)
114 goto depopulate; 114 goto depopulate;
115 115
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c
index 4b184559f231..d2653b589b1c 100644
--- a/fs/xfs/linux-2.6/kmem.c
+++ b/fs/xfs/linux-2.6/kmem.c
@@ -45,7 +45,7 @@
45 45
46 46
47void * 47void *
48kmem_alloc(size_t size, unsigned int __nocast flags) 48kmem_alloc(size_t size, gfp_t flags)
49{ 49{
50 int retries = 0; 50 int retries = 0;
51 unsigned int lflags = kmem_flags_convert(flags); 51 unsigned int lflags = kmem_flags_convert(flags);
@@ -67,7 +67,7 @@ kmem_alloc(size_t size, unsigned int __nocast flags)
67} 67}
68 68
69void * 69void *
70kmem_zalloc(size_t size, unsigned int __nocast flags) 70kmem_zalloc(size_t size, gfp_t flags)
71{ 71{
72 void *ptr; 72 void *ptr;
73 73
@@ -90,7 +90,7 @@ kmem_free(void *ptr, size_t size)
90 90
91void * 91void *
92kmem_realloc(void *ptr, size_t newsize, size_t oldsize, 92kmem_realloc(void *ptr, size_t newsize, size_t oldsize,
93 unsigned int __nocast flags) 93 gfp_t flags)
94{ 94{
95 void *new; 95 void *new;
96 96
@@ -105,7 +105,7 @@ kmem_realloc(void *ptr, size_t newsize, size_t oldsize,
105} 105}
106 106
107void * 107void *
108kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags) 108kmem_zone_alloc(kmem_zone_t *zone, gfp_t flags)
109{ 109{
110 int retries = 0; 110 int retries = 0;
111 unsigned int lflags = kmem_flags_convert(flags); 111 unsigned int lflags = kmem_flags_convert(flags);
@@ -124,7 +124,7 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)
124} 124}
125 125
126void * 126void *
127kmem_zone_zalloc(kmem_zone_t *zone, unsigned int __nocast flags) 127kmem_zone_zalloc(kmem_zone_t *zone, gfp_t flags)
128{ 128{
129 void *ptr; 129 void *ptr;
130 130
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
index 109fcf27e256..ee7010f085bc 100644
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/linux-2.6/kmem.h
@@ -81,7 +81,7 @@ typedef unsigned long xfs_pflags_t;
81 *(NSTATEP) = *(OSTATEP); \ 81 *(NSTATEP) = *(OSTATEP); \
82} while (0) 82} while (0)
83 83
84static __inline unsigned int kmem_flags_convert(unsigned int __nocast flags) 84static __inline unsigned int kmem_flags_convert(gfp_t flags)
85{ 85{
86 unsigned int lflags = __GFP_NOWARN; /* we'll report problems, if need be */ 86 unsigned int lflags = __GFP_NOWARN; /* we'll report problems, if need be */
87 87
@@ -125,13 +125,12 @@ kmem_zone_destroy(kmem_zone_t *zone)
125 BUG(); 125 BUG();
126} 126}
127 127
128extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast); 128extern void *kmem_zone_zalloc(kmem_zone_t *, gfp_t);
129extern void *kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast); 129extern void *kmem_zone_alloc(kmem_zone_t *, gfp_t);
130 130
131extern void *kmem_alloc(size_t, unsigned int __nocast); 131extern void *kmem_alloc(size_t, gfp_t);
132extern void *kmem_realloc(void *, size_t, size_t, 132extern void *kmem_realloc(void *, size_t, size_t, gfp_t);
133 unsigned int __nocast); 133extern void *kmem_zalloc(size_t, gfp_t);
134extern void *kmem_zalloc(size_t, unsigned int __nocast);
135extern void kmem_free(void *, size_t); 134extern void kmem_free(void *, size_t);
136 135
137typedef struct shrinker *kmem_shaker_t; 136typedef struct shrinker *kmem_shaker_t;
diff --git a/include/asm-arm/arch-h720x/system.h b/include/asm-arm/arch-h720x/system.h
index 0b025e227ec2..09eda84592ff 100644
--- a/include/asm-arm/arch-h720x/system.h
+++ b/include/asm-arm/arch-h720x/system.h
@@ -17,9 +17,11 @@
17static void arch_idle(void) 17static void arch_idle(void)
18{ 18{
19 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_IDLE; 19 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_IDLE;
20 __asm__ __volatile__( 20 nop();
21 "mov r0, r0\n\t" 21 nop();
22 "mov r0, r0"); 22 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_RUN;
23 nop();
24 nop();
23} 25}
24 26
25 27
diff --git a/include/asm-arm/arch-imx/imx-regs.h b/include/asm-arm/arch-imx/imx-regs.h
index 93b840e8fa60..a6912b3d8671 100644
--- a/include/asm-arm/arch-imx/imx-regs.h
+++ b/include/asm-arm/arch-imx/imx-regs.h
@@ -76,6 +76,7 @@
76#define GPIO_PIN_MASK 0x1f 76#define GPIO_PIN_MASK 0x1f
77#define GPIO_PORT_MASK (0x3 << 5) 77#define GPIO_PORT_MASK (0x3 << 5)
78 78
79#define GPIO_PORT_SHIFT 5
79#define GPIO_PORTA (0<<5) 80#define GPIO_PORTA (0<<5)
80#define GPIO_PORTB (1<<5) 81#define GPIO_PORTB (1<<5)
81#define GPIO_PORTC (2<<5) 82#define GPIO_PORTC (2<<5)
@@ -88,24 +89,37 @@
88#define GPIO_PF (0<<9) 89#define GPIO_PF (0<<9)
89#define GPIO_AF (1<<9) 90#define GPIO_AF (1<<9)
90 91
92#define GPIO_OCR_SHIFT 10
91#define GPIO_OCR_MASK (3<<10) 93#define GPIO_OCR_MASK (3<<10)
92#define GPIO_AIN (0<<10) 94#define GPIO_AIN (0<<10)
93#define GPIO_BIN (1<<10) 95#define GPIO_BIN (1<<10)
94#define GPIO_CIN (2<<10) 96#define GPIO_CIN (2<<10)
95#define GPIO_GPIO (3<<10) 97#define GPIO_DR (3<<10)
96 98
97#define GPIO_AOUT (1<<12) 99#define GPIO_AOUT_SHIFT 12
98#define GPIO_BOUT (1<<13) 100#define GPIO_AOUT_MASK (3<<12)
101#define GPIO_AOUT (0<<12)
102#define GPIO_AOUT_ISR (1<<12)
103#define GPIO_AOUT_0 (2<<12)
104#define GPIO_AOUT_1 (3<<12)
105
106#define GPIO_BOUT_SHIFT 14
107#define GPIO_BOUT_MASK (3<<14)
108#define GPIO_BOUT (0<<14)
109#define GPIO_BOUT_ISR (1<<14)
110#define GPIO_BOUT_0 (2<<14)
111#define GPIO_BOUT_1 (3<<14)
112
113#define GPIO_GIUS (1<<16)
99 114
100/* assignements for GPIO alternate/primary functions */ 115/* assignements for GPIO alternate/primary functions */
101 116
102/* FIXME: This list is not completed. The correct directions are 117/* FIXME: This list is not completed. The correct directions are
103 * missing on some (many) pins 118 * missing on some (many) pins
104 */ 119 */
105#define PA0_PF_A24 ( GPIO_PORTA | GPIO_PF | 0 ) 120#define PA0_AIN_SPI2_CLK ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 0 )
106#define PA0_AIN_SPI2_CLK ( GPIO_PORTA | GPIO_OUT | GPIO_AIN | 0 )
107#define PA0_AF_ETMTRACESYNC ( GPIO_PORTA | GPIO_AF | 0 ) 121#define PA0_AF_ETMTRACESYNC ( GPIO_PORTA | GPIO_AF | 0 )
108#define PA1_AOUT_SPI2_RXD ( GPIO_PORTA | GPIO_IN | GPIO_AOUT | 1 ) 122#define PA1_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTA | GPIO_IN | 1 )
109#define PA1_PF_TIN ( GPIO_PORTA | GPIO_PF | 1 ) 123#define PA1_PF_TIN ( GPIO_PORTA | GPIO_PF | 1 )
110#define PA2_PF_PWM0 ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 2 ) 124#define PA2_PF_PWM0 ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 2 )
111#define PA3_PF_CSI_MCLK ( GPIO_PORTA | GPIO_PF | 3 ) 125#define PA3_PF_CSI_MCLK ( GPIO_PORTA | GPIO_PF | 3 )
@@ -123,7 +137,7 @@
123#define PA15_PF_I2C_SDA ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 15 ) 137#define PA15_PF_I2C_SDA ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 15 )
124#define PA16_PF_I2C_SCL ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 16 ) 138#define PA16_PF_I2C_SCL ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 16 )
125#define PA17_AF_ETMTRACEPKT4 ( GPIO_PORTA | GPIO_AF | 17 ) 139#define PA17_AF_ETMTRACEPKT4 ( GPIO_PORTA | GPIO_AF | 17 )
126#define PA17_AIN_SPI2_SS ( GPIO_PORTA | GPIO_AIN | 17 ) 140#define PA17_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 17 )
127#define PA18_AF_ETMTRACEPKT5 ( GPIO_PORTA | GPIO_AF | 18 ) 141#define PA18_AF_ETMTRACEPKT5 ( GPIO_PORTA | GPIO_AF | 18 )
128#define PA19_AF_ETMTRACEPKT6 ( GPIO_PORTA | GPIO_AF | 19 ) 142#define PA19_AF_ETMTRACEPKT6 ( GPIO_PORTA | GPIO_AF | 19 )
129#define PA20_AF_ETMTRACEPKT7 ( GPIO_PORTA | GPIO_AF | 20 ) 143#define PA20_AF_ETMTRACEPKT7 ( GPIO_PORTA | GPIO_AF | 20 )
@@ -191,19 +205,27 @@
191#define PC15_PF_SPI1_SS ( GPIO_PORTC | GPIO_PF | 15 ) 205#define PC15_PF_SPI1_SS ( GPIO_PORTC | GPIO_PF | 15 )
192#define PC16_PF_SPI1_MISO ( GPIO_PORTC | GPIO_PF | 16 ) 206#define PC16_PF_SPI1_MISO ( GPIO_PORTC | GPIO_PF | 16 )
193#define PC17_PF_SPI1_MOSI ( GPIO_PORTC | GPIO_PF | 17 ) 207#define PC17_PF_SPI1_MOSI ( GPIO_PORTC | GPIO_PF | 17 )
208#define PC24_BIN_UART3_RI ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24 )
209#define PC25_BIN_UART3_DSR ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25 )
210#define PC26_AOUT_UART3_DTR ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 26 )
211#define PC27_BIN_UART3_DCD ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27 )
212#define PC28_BIN_UART3_CTS ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28 )
213#define PC29_AOUT_UART3_RTS ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 29 )
214#define PC30_BIN_UART3_TX ( GPIO_GIUS | GPIO_PORTC | GPIO_BIN | 30 )
215#define PC31_AOUT_UART3_RX ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 31)
194#define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 ) 216#define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 )
195#define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 ) 217#define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 )
196#define PD7_AF_UART2_DTR ( GPIO_PORTD | GPIO_IN | GPIO_AF | 7 ) 218#define PD7_AF_UART2_DTR ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7 )
197#define PD7_AIN_SPI2_SCLK ( GPIO_PORTD | GPIO_AIN | 7 ) 219#define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7 )
198#define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 ) 220#define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 )
199#define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 ) 221#define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 )
200#define PD8_AIN_SPI2_SS ( GPIO_PORTD | GPIO_AIN | 8 ) 222#define PD8_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8 )
201#define PD9_PF_PS ( GPIO_PORTD | GPIO_PF | 9 ) 223#define PD9_PF_PS ( GPIO_PORTD | GPIO_PF | 9 )
202#define PD9_AF_UART2_RI ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 9 ) 224#define PD9_AF_UART2_RI ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 9 )
203#define PD9_AOUT_SPI2_RXD ( GPIO_PORTD | GPIO_IN | GPIO_AOUT | 9 ) 225#define PD9_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | 9 )
204#define PD10_PF_SPL_SPR ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 10 ) 226#define PD10_PF_SPL_SPR ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 10 )
205#define PD10_AF_UART2_DSR ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 10 ) 227#define PD10_AF_UART2_DSR ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 10 )
206#define PD10_AIN_SPI2_TXD ( GPIO_PORTD | GPIO_OUT | GPIO_AIN | 10 ) 228#define PD10_AIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_OUT | 10 )
207#define PD11_PF_CONTRAST ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 11 ) 229#define PD11_PF_CONTRAST ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 11 )
208#define PD12_PF_ACD_OE ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 12 ) 230#define PD12_PF_ACD_OE ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 12 )
209#define PD13_PF_LP_HSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 13 ) 231#define PD13_PF_LP_HSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 13 )
@@ -225,7 +247,7 @@
225#define PD29_PF_LD14 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 29 ) 247#define PD29_PF_LD14 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 29 )
226#define PD30_PF_LD15 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 30 ) 248#define PD30_PF_LD15 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 30 )
227#define PD31_PF_TMR2OUT ( GPIO_PORTD | GPIO_PF | 31 ) 249#define PD31_PF_TMR2OUT ( GPIO_PORTD | GPIO_PF | 31 )
228#define PD31_BIN_SPI2_TXD ( GPIO_PORTD | GPIO_BIN | 31 ) 250#define PD31_BIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_BIN | 31 )
229 251
230/* 252/*
231 * PWM controller 253 * PWM controller
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index d13ee7f78c70..f14ed63590c3 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -93,7 +93,7 @@ extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
93 93
94static inline void gpio_line_config(u8 line, u32 direction) 94static inline void gpio_line_config(u8 line, u32 direction)
95{ 95{
96 if (direction == IXP4XX_GPIO_OUT) 96 if (direction == IXP4XX_GPIO_IN)
97 *IXP4XX_GPIO_GPOER |= (1 << line); 97 *IXP4XX_GPIO_GPOER |= (1 << line);
98 else 98 else
99 *IXP4XX_GPIO_GPOER &= ~(1 << line); 99 *IXP4XX_GPIO_GPOER &= ~(1 << line);
diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h
index be9754a05c19..9d7f87375aa7 100644
--- a/include/asm-arm/arch-rpc/hardware.h
+++ b/include/asm-arm/arch-rpc/hardware.h
@@ -15,7 +15,7 @@
15#include <asm/arch/memory.h> 15#include <asm/arch/memory.h>
16 16
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18#define IOMEM(x) ((void __iomem *)(x)) 18#define IOMEM(x) ((void __iomem *)(unsigned long)(x))
19#else 19#else
20#define IOMEM(x) x 20#define IOMEM(x) x
21#endif /* __ASSEMBLY__ */ 21#endif /* __ASSEMBLY__ */
@@ -52,7 +52,7 @@
52/* 52/*
53 * IO Addresses 53 * IO Addresses
54 */ 54 */
55#define VIDC_BASE (void __iomem *)0xe0400000 55#define VIDC_BASE IOMEM(0xe0400000)
56#define EXPMASK_BASE 0xe0360000 56#define EXPMASK_BASE 0xe0360000
57#define IOMD_BASE IOMEM(0xe0200000) 57#define IOMD_BASE IOMEM(0xe0200000)
58#define IOC_BASE IOMEM(0xe0200000) 58#define IOC_BASE IOMEM(0xe0200000)
diff --git a/include/asm-arm/arch-versatile/io.h b/include/asm-arm/arch-versatile/io.h
index 9f895bf61494..47e904cf25c7 100644
--- a/include/asm-arm/arch-versatile/io.h
+++ b/include/asm-arm/arch-versatile/io.h
@@ -22,7 +22,11 @@
22 22
23#define IO_SPACE_LIMIT 0xffffffff 23#define IO_SPACE_LIMIT 0xffffffff
24 24
25#define __io(a) ((void __iomem *)(a)) 25static inline void __iomem *__io(unsigned long addr)
26{
27 return (void __iomem *)addr;
28}
29#define __io(a) __io(a)
26#define __mem_pci(a) (a) 30#define __mem_pci(a) (a)
27#define __mem_isa(a) (a) 31#define __mem_isa(a) (a)
28 32
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index a1696ba238d3..7da97a937548 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -124,6 +124,8 @@ do { \
124 if (((ex).e_flags & EF_ARM_EABI_MASK) || \ 124 if (((ex).e_flags & EF_ARM_EABI_MASK) || \
125 ((ex).e_flags & EF_ARM_SOFT_FLOAT)) \ 125 ((ex).e_flags & EF_ARM_SOFT_FLOAT)) \
126 set_thread_flag(TIF_USING_IWMMXT); \ 126 set_thread_flag(TIF_USING_IWMMXT); \
127 else \
128 clear_thread_flag(TIF_USING_IWMMXT); \
127} while (0) 129} while (0)
128 130
129#endif 131#endif
diff --git a/include/asm-arm/hardware/scoop.h b/include/asm-arm/hardware/scoop.h
index 527404b5a8df..a8f1013930e3 100644
--- a/include/asm-arm/hardware/scoop.h
+++ b/include/asm-arm/hardware/scoop.h
@@ -38,6 +38,8 @@
38struct scoop_config { 38struct scoop_config {
39 unsigned short io_out; 39 unsigned short io_out;
40 unsigned short io_dir; 40 unsigned short io_dir;
41 unsigned short suspend_clr;
42 unsigned short suspend_set;
41}; 43};
42 44
43/* Structure for linking scoop devices to PCMCIA sockets */ 45/* Structure for linking scoop devices to PCMCIA sockets */
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 8cef663c5cd9..747d790295f3 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -35,7 +35,7 @@ dma_set_mask(struct device *dev, u64 dma_mask)
35 35
36static inline void * 36static inline void *
37dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 37dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
38 unsigned int __nocast flag) 38 gfp_t flag)
39{ 39{
40 BUG_ON(dev->bus != &pci_bus_type); 40 BUG_ON(dev->bus != &pci_bus_type);
41 41
@@ -168,7 +168,7 @@ dma_set_mask(struct device *dev, u64 dma_mask)
168 168
169static inline void * 169static inline void *
170dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 170dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
171 unsigned int __nocast flag) 171 gfp_t flag)
172{ 172{
173 BUG(); 173 BUG();
174 return NULL; 174 return NULL;
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
index 563964b2995b..e56c335f8ef9 100644
--- a/include/asm-i386/dma-mapping.h
+++ b/include/asm-i386/dma-mapping.h
@@ -11,7 +11,7 @@
11#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 11#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
12 12
13void *dma_alloc_coherent(struct device *dev, size_t size, 13void *dma_alloc_coherent(struct device *dev, size_t size,
14 dma_addr_t *dma_handle, unsigned int __nocast flag); 14 dma_addr_t *dma_handle, gfp_t flag);
15 15
16void dma_free_coherent(struct device *dev, size_t size, 16void dma_free_coherent(struct device *dev, size_t size,
17 void *vaddr, dma_addr_t dma_handle); 17 void *vaddr, dma_addr_t dma_handle);
diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
index 4ac84cc6f01a..622815bf3243 100644
--- a/include/asm-i386/hw_irq.h
+++ b/include/asm-i386/hw_irq.h
@@ -18,6 +18,8 @@
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/sections.h> 19#include <asm/sections.h>
20 20
21struct hw_interrupt_type;
22
21/* 23/*
22 * Various low-level irq details needed by irq.c, process.c, 24 * Various low-level irq details needed by irq.c, process.c,
23 * time.c, io_apic.c and smp.c 25 * time.c, io_apic.c and smp.c
diff --git a/include/asm-ia64/uaccess.h b/include/asm-ia64/uaccess.h
index 3a7829bb5954..9adb51211c22 100644
--- a/include/asm-ia64/uaccess.h
+++ b/include/asm-ia64/uaccess.h
@@ -187,8 +187,8 @@ extern void __get_user_unknown (void);
187({ \ 187({ \
188 const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ 188 const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \
189 __typeof__ (size) __gu_size = (size); \ 189 __typeof__ (size) __gu_size = (size); \
190 long __gu_err = -EFAULT, __gu_val = 0; \ 190 long __gu_err = -EFAULT; \
191 \ 191 unsigned long __gu_val = 0; \
192 if (!check || __access_ok(__gu_ptr, size, segment)) \ 192 if (!check || __access_ok(__gu_ptr, size, segment)) \
193 switch (__gu_size) { \ 193 switch (__gu_size) { \
194 case 1: __get_user_size(__gu_val, __gu_ptr, 1, __gu_err); break; \ 194 case 1: __get_user_size(__gu_val, __gu_ptr, 1, __gu_err); break; \
@@ -240,13 +240,13 @@ extern unsigned long __must_check __copy_user (void __user *to, const void __use
240static inline unsigned long 240static inline unsigned long
241__copy_to_user (void __user *to, const void *from, unsigned long count) 241__copy_to_user (void __user *to, const void *from, unsigned long count)
242{ 242{
243 return __copy_user(to, (void __user *) from, count); 243 return __copy_user(to, (__force void __user *) from, count);
244} 244}
245 245
246static inline unsigned long 246static inline unsigned long
247__copy_from_user (void *to, const void __user *from, unsigned long count) 247__copy_from_user (void *to, const void __user *from, unsigned long count)
248{ 248{
249 return __copy_user((void __user *) to, from, count); 249 return __copy_user((__force void __user *) to, from, count);
250} 250}
251 251
252#define __copy_to_user_inatomic __copy_to_user 252#define __copy_to_user_inatomic __copy_to_user
@@ -258,7 +258,7 @@ __copy_from_user (void *to, const void __user *from, unsigned long count)
258 long __cu_len = (n); \ 258 long __cu_len = (n); \
259 \ 259 \
260 if (__access_ok(__cu_to, __cu_len, get_fs())) \ 260 if (__access_ok(__cu_to, __cu_len, get_fs())) \
261 __cu_len = __copy_user(__cu_to, (void __user *) __cu_from, __cu_len); \ 261 __cu_len = __copy_user(__cu_to, (__force void __user *) __cu_from, __cu_len); \
262 __cu_len; \ 262 __cu_len; \
263}) 263})
264 264
@@ -270,7 +270,7 @@ __copy_from_user (void *to, const void __user *from, unsigned long count)
270 \ 270 \
271 __chk_user_ptr(__cu_from); \ 271 __chk_user_ptr(__cu_from); \
272 if (__access_ok(__cu_from, __cu_len, get_fs())) \ 272 if (__access_ok(__cu_from, __cu_len, get_fs())) \
273 __cu_len = __copy_user((void __user *) __cu_to, __cu_from, __cu_len); \ 273 __cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len); \
274 __cu_len; \ 274 __cu_len; \
275}) 275})
276 276
diff --git a/include/asm-ppc/dma-mapping.h b/include/asm-ppc/dma-mapping.h
index 92b8ee78dcc2..061bfcac1bf1 100644
--- a/include/asm-ppc/dma-mapping.h
+++ b/include/asm-ppc/dma-mapping.h
@@ -61,7 +61,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
61 61
62static inline void *dma_alloc_coherent(struct device *dev, size_t size, 62static inline void *dma_alloc_coherent(struct device *dev, size_t size,
63 dma_addr_t * dma_handle, 63 dma_addr_t * dma_handle,
64 unsigned int __nocast gfp) 64 gfp_t gfp)
65{ 65{
66#ifdef CONFIG_NOT_COHERENT_CACHE 66#ifdef CONFIG_NOT_COHERENT_CACHE
67 return __dma_alloc_coherent(size, dma_handle, gfp); 67 return __dma_alloc_coherent(size, dma_handle, gfp);
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 39caf067a31b..f7f614dfc648 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -57,7 +57,7 @@ extern unsigned long pci_dram_offset;
57 * is actually performed (i.e. the data has come back) before we start 57 * is actually performed (i.e. the data has come back) before we start
58 * executing any following instructions. 58 * executing any following instructions.
59 */ 59 */
60extern inline int in_8(volatile unsigned char __iomem *addr) 60extern inline int in_8(const volatile unsigned char __iomem *addr)
61{ 61{
62 int ret; 62 int ret;
63 63
@@ -73,7 +73,7 @@ extern inline void out_8(volatile unsigned char __iomem *addr, int val)
73 __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); 73 __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
74} 74}
75 75
76extern inline int in_le16(volatile unsigned short __iomem *addr) 76extern inline int in_le16(const volatile unsigned short __iomem *addr)
77{ 77{
78 int ret; 78 int ret;
79 79
@@ -84,7 +84,7 @@ extern inline int in_le16(volatile unsigned short __iomem *addr)
84 return ret; 84 return ret;
85} 85}
86 86
87extern inline int in_be16(volatile unsigned short __iomem *addr) 87extern inline int in_be16(const volatile unsigned short __iomem *addr)
88{ 88{
89 int ret; 89 int ret;
90 90
@@ -105,7 +105,7 @@ extern inline void out_be16(volatile unsigned short __iomem *addr, int val)
105 __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); 105 __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
106} 106}
107 107
108extern inline unsigned in_le32(volatile unsigned __iomem *addr) 108extern inline unsigned in_le32(const volatile unsigned __iomem *addr)
109{ 109{
110 unsigned ret; 110 unsigned ret;
111 111
@@ -116,7 +116,7 @@ extern inline unsigned in_le32(volatile unsigned __iomem *addr)
116 return ret; 116 return ret;
117} 117}
118 118
119extern inline unsigned in_be32(volatile unsigned __iomem *addr) 119extern inline unsigned in_be32(const volatile unsigned __iomem *addr)
120{ 120{
121 unsigned ret; 121 unsigned ret;
122 122
@@ -140,7 +140,7 @@ extern inline void out_be32(volatile unsigned __iomem *addr, int val)
140#define readb(addr) in_8((volatile u8 *)(addr)) 140#define readb(addr) in_8((volatile u8 *)(addr))
141#define writeb(b,addr) out_8((volatile u8 *)(addr), (b)) 141#define writeb(b,addr) out_8((volatile u8 *)(addr), (b))
142#else 142#else
143static inline __u8 readb(volatile void __iomem *addr) 143static inline __u8 readb(const volatile void __iomem *addr)
144{ 144{
145 return in_8(addr); 145 return in_8(addr);
146} 146}
@@ -151,11 +151,11 @@ static inline void writeb(__u8 b, volatile void __iomem *addr)
151#endif 151#endif
152 152
153#if defined(CONFIG_APUS) 153#if defined(CONFIG_APUS)
154static inline __u16 readw(volatile void __iomem *addr) 154static inline __u16 readw(const volatile void __iomem *addr)
155{ 155{
156 return *(__force volatile __u16 *)(addr); 156 return *(__force volatile __u16 *)(addr);
157} 157}
158static inline __u32 readl(volatile void __iomem *addr) 158static inline __u32 readl(const volatile void __iomem *addr)
159{ 159{
160 return *(__force volatile __u32 *)(addr); 160 return *(__force volatile __u32 *)(addr);
161} 161}
@@ -174,11 +174,11 @@ static inline void writel(__u32 b, volatile void __iomem *addr)
174#define writew(b,addr) out_le16((volatile u16 *)(addr),(b)) 174#define writew(b,addr) out_le16((volatile u16 *)(addr),(b))
175#define writel(b,addr) out_le32((volatile u32 *)(addr),(b)) 175#define writel(b,addr) out_le32((volatile u32 *)(addr),(b))
176#else 176#else
177static inline __u16 readw(volatile void __iomem *addr) 177static inline __u16 readw(const volatile void __iomem *addr)
178{ 178{
179 return in_le16(addr); 179 return in_le16(addr);
180} 180}
181static inline __u32 readl(volatile void __iomem *addr) 181static inline __u32 readl(const volatile void __iomem *addr)
182{ 182{
183 return in_le32(addr); 183 return in_le32(addr);
184} 184}
diff --git a/include/asm-ppc/mv64x60.h b/include/asm-ppc/mv64x60.h
index 75c2ffa26b26..ee2f9188cc64 100644
--- a/include/asm-ppc/mv64x60.h
+++ b/include/asm-ppc/mv64x60.h
@@ -233,7 +233,7 @@ struct mv64x60_chip_info {
233struct mv64x60_handle { 233struct mv64x60_handle {
234 u32 type; /* type of bridge */ 234 u32 type; /* type of bridge */
235 u32 rev; /* revision of bridge */ 235 u32 rev; /* revision of bridge */
236 void *v_base; /* virtual base addr of bridge regs */ 236 void __iomem *v_base;/* virtual base addr of bridge regs */
237 phys_addr_t p_base; /* physical base addr of bridge regs */ 237 phys_addr_t p_base; /* physical base addr of bridge regs */
238 238
239 u32 pci_mode_a; /* pci 0 mode: conventional pci, pci-x*/ 239 u32 pci_mode_a; /* pci 0 mode: conventional pci, pci-x*/
@@ -303,7 +303,7 @@ void mv64x60_alloc_hose(struct mv64x60_handle *bh, u32 cfg_addr,
303 u32 cfg_data, struct pci_controller **hose); 303 u32 cfg_data, struct pci_controller **hose);
304int mv64x60_get_type(struct mv64x60_handle *bh); 304int mv64x60_get_type(struct mv64x60_handle *bh);
305int mv64x60_setup_for_chip(struct mv64x60_handle *bh); 305int mv64x60_setup_for_chip(struct mv64x60_handle *bh);
306void *mv64x60_get_bridge_vbase(void); 306void __iomem *mv64x60_get_bridge_vbase(void);
307u32 mv64x60_get_bridge_type(void); 307u32 mv64x60_get_bridge_type(void);
308u32 mv64x60_get_bridge_rev(void); 308u32 mv64x60_get_bridge_rev(void);
309void mv64x60_get_mem_windows(struct mv64x60_handle *bh, 309void mv64x60_get_mem_windows(struct mv64x60_handle *bh,
diff --git a/include/asm-ppc64/dma-mapping.h b/include/asm-ppc64/dma-mapping.h
index 9ad8adee0067..fb68fa23bea8 100644
--- a/include/asm-ppc64/dma-mapping.h
+++ b/include/asm-ppc64/dma-mapping.h
@@ -19,7 +19,7 @@
19extern int dma_supported(struct device *dev, u64 mask); 19extern int dma_supported(struct device *dev, u64 mask);
20extern int dma_set_mask(struct device *dev, u64 dma_mask); 20extern int dma_set_mask(struct device *dev, u64 dma_mask);
21extern void *dma_alloc_coherent(struct device *dev, size_t size, 21extern void *dma_alloc_coherent(struct device *dev, size_t size,
22 dma_addr_t *dma_handle, unsigned int __nocast flag); 22 dma_addr_t *dma_handle, gfp_t flag);
23extern void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, 23extern void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
24 dma_addr_t dma_handle); 24 dma_addr_t dma_handle);
25extern dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, 25extern dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
@@ -118,7 +118,7 @@ dma_cache_sync(void *vaddr, size_t size,
118 */ 118 */
119struct dma_mapping_ops { 119struct dma_mapping_ops {
120 void * (*alloc_coherent)(struct device *dev, size_t size, 120 void * (*alloc_coherent)(struct device *dev, size_t size,
121 dma_addr_t *dma_handle, unsigned int __nocast flag); 121 dma_addr_t *dma_handle, gfp_t flag);
122 void (*free_coherent)(struct device *dev, size_t size, 122 void (*free_coherent)(struct device *dev, size_t size,
123 void *vaddr, dma_addr_t dma_handle); 123 void *vaddr, dma_addr_t dma_handle);
124 dma_addr_t (*map_single)(struct device *dev, void *ptr, 124 dma_addr_t (*map_single)(struct device *dev, void *ptr,
diff --git a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h
index d096faf4191e..f80ec8daf122 100644
--- a/include/asm-ppc64/iommu.h
+++ b/include/asm-ppc64/iommu.h
@@ -88,7 +88,7 @@ extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
88 int nelems, enum dma_data_direction direction); 88 int nelems, enum dma_data_direction direction);
89 89
90extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, 90extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
91 dma_addr_t *dma_handle, unsigned int __nocast flag); 91 dma_addr_t *dma_handle, gfp_t flag);
92extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, 92extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
93 void *vaddr, dma_addr_t dma_handle); 93 void *vaddr, dma_addr_t dma_handle);
94extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, 94extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
diff --git a/include/asm-ppc64/uaccess.h b/include/asm-ppc64/uaccess.h
index c181a60d868c..132c1276547b 100644
--- a/include/asm-ppc64/uaccess.h
+++ b/include/asm-ppc64/uaccess.h
@@ -164,7 +164,8 @@ do { \
164 164
165#define __get_user_nocheck(x,ptr,size) \ 165#define __get_user_nocheck(x,ptr,size) \
166({ \ 166({ \
167 long __gu_err, __gu_val; \ 167 long __gu_err; \
168 unsigned long __gu_val; \
168 might_sleep(); \ 169 might_sleep(); \
169 __get_user_size(__gu_val,(ptr),(size),__gu_err,-EFAULT);\ 170 __get_user_size(__gu_val,(ptr),(size),__gu_err,-EFAULT);\
170 (x) = (__typeof__(*(ptr)))__gu_val; \ 171 (x) = (__typeof__(*(ptr)))__gu_val; \
@@ -173,7 +174,8 @@ do { \
173 174
174#define __get_user_check(x,ptr,size) \ 175#define __get_user_check(x,ptr,size) \
175({ \ 176({ \
176 long __gu_err = -EFAULT, __gu_val = 0; \ 177 long __gu_err = -EFAULT; \
178 unsigned long __gu_val = 0; \
177 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ 179 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
178 might_sleep(); \ 180 might_sleep(); \
179 if (access_ok(VERIFY_READ,__gu_addr,size)) \ 181 if (access_ok(VERIFY_READ,__gu_addr,size)) \
diff --git a/include/asm-s390/sigcontext.h b/include/asm-s390/sigcontext.h
index d57bc0cebdce..803545351dd8 100644
--- a/include/asm-s390/sigcontext.h
+++ b/include/asm-s390/sigcontext.h
@@ -61,7 +61,7 @@ typedef struct
61struct sigcontext 61struct sigcontext
62{ 62{
63 unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS]; 63 unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS];
64 _sigregs *sregs; 64 _sigregs __user *sregs;
65}; 65};
66 66
67 67
diff --git a/include/asm-s390/signal.h b/include/asm-s390/signal.h
index 3d6e11c6c1fd..7084626de215 100644
--- a/include/asm-s390/signal.h
+++ b/include/asm-s390/signal.h
@@ -165,7 +165,7 @@ struct sigaction {
165#endif /* __KERNEL__ */ 165#endif /* __KERNEL__ */
166 166
167typedef struct sigaltstack { 167typedef struct sigaltstack {
168 void *ss_sp; 168 void __user *ss_sp;
169 int ss_flags; 169 int ss_flags;
170 size_t ss_size; 170 size_t ss_size;
171} stack_t; 171} stack_t;
diff --git a/include/asm-sparc/btfixup.h b/include/asm-sparc/btfixup.h
index b84c96c89581..c2868d0f60b6 100644
--- a/include/asm-sparc/btfixup.h
+++ b/include/asm-sparc/btfixup.h
@@ -49,17 +49,17 @@ extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void);
49/* Put bottom 13bits into some register variable */ 49/* Put bottom 13bits into some register variable */
50 50
51#define BTFIXUPDEF_SIMM13(__name) \ 51#define BTFIXUPDEF_SIMM13(__name) \
52 extern unsigned int ___sf_##__name(void) __attribute_const__; \ 52 static inline unsigned int ___sf_##__name(void) __attribute_const__; \
53 extern unsigned ___ss_##__name[2]; \ 53 extern unsigned ___ss_##__name[2]; \
54 extern __inline__ unsigned int ___sf_##__name(void) { \ 54 static inline unsigned int ___sf_##__name(void) { \
55 unsigned int ret; \ 55 unsigned int ret; \
56 __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \ 56 __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \
57 return ret; \ 57 return ret; \
58 } 58 }
59#define BTFIXUPDEF_SIMM13_INIT(__name,__val) \ 59#define BTFIXUPDEF_SIMM13_INIT(__name,__val) \
60 extern unsigned int ___sf_##__name(void) __attribute_const__; \ 60 static inline unsigned int ___sf_##__name(void) __attribute_const__; \
61 extern unsigned ___ss_##__name[2]; \ 61 extern unsigned ___ss_##__name[2]; \
62 extern __inline__ unsigned int ___sf_##__name(void) { \ 62 static inline unsigned int ___sf_##__name(void) { \
63 unsigned int ret; \ 63 unsigned int ret; \
64 __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ 64 __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\
65 return ret; \ 65 return ret; \
@@ -71,17 +71,17 @@ extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void);
71 */ 71 */
72 72
73#define BTFIXUPDEF_HALF(__name) \ 73#define BTFIXUPDEF_HALF(__name) \
74 extern unsigned int ___af_##__name(void) __attribute_const__; \ 74 static inline unsigned int ___af_##__name(void) __attribute_const__; \
75 extern unsigned ___as_##__name[2]; \ 75 extern unsigned ___as_##__name[2]; \
76 extern __inline__ unsigned int ___af_##__name(void) { \ 76 static inline unsigned int ___af_##__name(void) { \
77 unsigned int ret; \ 77 unsigned int ret; \
78 __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \ 78 __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \
79 return ret; \ 79 return ret; \
80 } 80 }
81#define BTFIXUPDEF_HALF_INIT(__name,__val) \ 81#define BTFIXUPDEF_HALF_INIT(__name,__val) \
82 extern unsigned int ___af_##__name(void) __attribute_const__; \ 82 static inline unsigned int ___af_##__name(void) __attribute_const__; \
83 extern unsigned ___as_##__name[2]; \ 83 extern unsigned ___as_##__name[2]; \
84 extern __inline__ unsigned int ___af_##__name(void) { \ 84 static inline unsigned int ___af_##__name(void) { \
85 unsigned int ret; \ 85 unsigned int ret; \
86 __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ 86 __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\
87 return ret; \ 87 return ret; \
@@ -90,17 +90,17 @@ extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void);
90/* Put upper 22 bits into some register variable */ 90/* Put upper 22 bits into some register variable */
91 91
92#define BTFIXUPDEF_SETHI(__name) \ 92#define BTFIXUPDEF_SETHI(__name) \
93 extern unsigned int ___hf_##__name(void) __attribute_const__; \ 93 static inline unsigned int ___hf_##__name(void) __attribute_const__; \
94 extern unsigned ___hs_##__name[2]; \ 94 extern unsigned ___hs_##__name[2]; \
95 extern __inline__ unsigned int ___hf_##__name(void) { \ 95 static inline unsigned int ___hf_##__name(void) { \
96 unsigned int ret; \ 96 unsigned int ret; \
97 __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \ 97 __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \
98 return ret; \ 98 return ret; \
99 } 99 }
100#define BTFIXUPDEF_SETHI_INIT(__name,__val) \ 100#define BTFIXUPDEF_SETHI_INIT(__name,__val) \
101 extern unsigned int ___hf_##__name(void) __attribute_const__; \ 101 static inline unsigned int ___hf_##__name(void) __attribute_const__; \
102 extern unsigned ___hs_##__name[2]; \ 102 extern unsigned ___hs_##__name[2]; \
103 extern __inline__ unsigned int ___hf_##__name(void) { \ 103 static inline unsigned int ___hf_##__name(void) { \
104 unsigned int ret; \ 104 unsigned int ret; \
105 __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \ 105 __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \
106 "=r"(ret)); \ 106 "=r"(ret)); \
diff --git a/include/asm-sparc/cache.h b/include/asm-sparc/cache.h
index e6316fd7e1a4..a10522cb21b7 100644
--- a/include/asm-sparc/cache.h
+++ b/include/asm-sparc/cache.h
@@ -27,7 +27,7 @@
27 */ 27 */
28 28
29/* First, cache-tag access. */ 29/* First, cache-tag access. */
30extern __inline__ unsigned int get_icache_tag(int setnum, int tagnum) 30static inline unsigned int get_icache_tag(int setnum, int tagnum)
31{ 31{
32 unsigned int vaddr, retval; 32 unsigned int vaddr, retval;
33 33
@@ -38,7 +38,7 @@ extern __inline__ unsigned int get_icache_tag(int setnum, int tagnum)
38 return retval; 38 return retval;
39} 39}
40 40
41extern __inline__ void put_icache_tag(int setnum, int tagnum, unsigned int entry) 41static inline void put_icache_tag(int setnum, int tagnum, unsigned int entry)
42{ 42{
43 unsigned int vaddr; 43 unsigned int vaddr;
44 44
@@ -51,7 +51,7 @@ extern __inline__ void put_icache_tag(int setnum, int tagnum, unsigned int entry
51/* Second cache-data access. The data is returned two-32bit quantities 51/* Second cache-data access. The data is returned two-32bit quantities
52 * at a time. 52 * at a time.
53 */ 53 */
54extern __inline__ void get_icache_data(int setnum, int tagnum, int subblock, 54static inline void get_icache_data(int setnum, int tagnum, int subblock,
55 unsigned int *data) 55 unsigned int *data)
56{ 56{
57 unsigned int value1, value2, vaddr; 57 unsigned int value1, value2, vaddr;
@@ -67,7 +67,7 @@ extern __inline__ void get_icache_data(int setnum, int tagnum, int subblock,
67 data[0] = value1; data[1] = value2; 67 data[0] = value1; data[1] = value2;
68} 68}
69 69
70extern __inline__ void put_icache_data(int setnum, int tagnum, int subblock, 70static inline void put_icache_data(int setnum, int tagnum, int subblock,
71 unsigned int *data) 71 unsigned int *data)
72{ 72{
73 unsigned int value1, value2, vaddr; 73 unsigned int value1, value2, vaddr;
@@ -92,35 +92,35 @@ extern __inline__ void put_icache_data(int setnum, int tagnum, int subblock,
92 */ 92 */
93 93
94/* Flushes which clear out both the on-chip and external caches */ 94/* Flushes which clear out both the on-chip and external caches */
95extern __inline__ void flush_ei_page(unsigned int addr) 95static inline void flush_ei_page(unsigned int addr)
96{ 96{
97 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : 97 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
98 "r" (addr), "i" (ASI_M_FLUSH_PAGE) : 98 "r" (addr), "i" (ASI_M_FLUSH_PAGE) :
99 "memory"); 99 "memory");
100} 100}
101 101
102extern __inline__ void flush_ei_seg(unsigned int addr) 102static inline void flush_ei_seg(unsigned int addr)
103{ 103{
104 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : 104 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
105 "r" (addr), "i" (ASI_M_FLUSH_SEG) : 105 "r" (addr), "i" (ASI_M_FLUSH_SEG) :
106 "memory"); 106 "memory");
107} 107}
108 108
109extern __inline__ void flush_ei_region(unsigned int addr) 109static inline void flush_ei_region(unsigned int addr)
110{ 110{
111 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : 111 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
112 "r" (addr), "i" (ASI_M_FLUSH_REGION) : 112 "r" (addr), "i" (ASI_M_FLUSH_REGION) :
113 "memory"); 113 "memory");
114} 114}
115 115
116extern __inline__ void flush_ei_ctx(unsigned int addr) 116static inline void flush_ei_ctx(unsigned int addr)
117{ 117{
118 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : 118 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
119 "r" (addr), "i" (ASI_M_FLUSH_CTX) : 119 "r" (addr), "i" (ASI_M_FLUSH_CTX) :
120 "memory"); 120 "memory");
121} 121}
122 122
123extern __inline__ void flush_ei_user(unsigned int addr) 123static inline void flush_ei_user(unsigned int addr)
124{ 124{
125 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : 125 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
126 "r" (addr), "i" (ASI_M_FLUSH_USER) : 126 "r" (addr), "i" (ASI_M_FLUSH_USER) :
diff --git a/include/asm-sparc/cypress.h b/include/asm-sparc/cypress.h
index fc92fc839c3f..99599533efbc 100644
--- a/include/asm-sparc/cypress.h
+++ b/include/asm-sparc/cypress.h
@@ -48,25 +48,25 @@
48#define CYPRESS_NFAULT 0x00000002 48#define CYPRESS_NFAULT 0x00000002
49#define CYPRESS_MENABLE 0x00000001 49#define CYPRESS_MENABLE 0x00000001
50 50
51extern __inline__ void cypress_flush_page(unsigned long page) 51static inline void cypress_flush_page(unsigned long page)
52{ 52{
53 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : 53 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
54 "r" (page), "i" (ASI_M_FLUSH_PAGE)); 54 "r" (page), "i" (ASI_M_FLUSH_PAGE));
55} 55}
56 56
57extern __inline__ void cypress_flush_segment(unsigned long addr) 57static inline void cypress_flush_segment(unsigned long addr)
58{ 58{
59 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : 59 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
60 "r" (addr), "i" (ASI_M_FLUSH_SEG)); 60 "r" (addr), "i" (ASI_M_FLUSH_SEG));
61} 61}
62 62
63extern __inline__ void cypress_flush_region(unsigned long addr) 63static inline void cypress_flush_region(unsigned long addr)
64{ 64{
65 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : 65 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
66 "r" (addr), "i" (ASI_M_FLUSH_REGION)); 66 "r" (addr), "i" (ASI_M_FLUSH_REGION));
67} 67}
68 68
69extern __inline__ void cypress_flush_context(void) 69static inline void cypress_flush_context(void)
70{ 70{
71 __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : : 71 __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : :
72 "i" (ASI_M_FLUSH_CTX)); 72 "i" (ASI_M_FLUSH_CTX));
diff --git a/include/asm-sparc/delay.h b/include/asm-sparc/delay.h
index 6edf2cbb246b..7ec8e9f7ad4f 100644
--- a/include/asm-sparc/delay.h
+++ b/include/asm-sparc/delay.h
@@ -10,7 +10,7 @@
10#include <linux/config.h> 10#include <linux/config.h>
11#include <asm/cpudata.h> 11#include <asm/cpudata.h>
12 12
13extern __inline__ void __delay(unsigned long loops) 13static inline void __delay(unsigned long loops)
14{ 14{
15 __asm__ __volatile__("cmp %0, 0\n\t" 15 __asm__ __volatile__("cmp %0, 0\n\t"
16 "1: bne 1b\n\t" 16 "1: bne 1b\n\t"
diff --git a/include/asm-sparc/dma.h b/include/asm-sparc/dma.h
index 07e6368a2521..8ec206aa5f2e 100644
--- a/include/asm-sparc/dma.h
+++ b/include/asm-sparc/dma.h
@@ -198,7 +198,7 @@ extern void dvma_init(struct sbus_bus *);
198/* Pause until counter runs out or BIT isn't set in the DMA condition 198/* Pause until counter runs out or BIT isn't set in the DMA condition
199 * register. 199 * register.
200 */ 200 */
201extern __inline__ void sparc_dma_pause(struct sparc_dma_registers *regs, 201static inline void sparc_dma_pause(struct sparc_dma_registers *regs,
202 unsigned long bit) 202 unsigned long bit)
203{ 203{
204 int ctr = 50000; /* Let's find some bugs ;) */ 204 int ctr = 50000; /* Let's find some bugs ;) */
diff --git a/include/asm-sparc/iommu.h b/include/asm-sparc/iommu.h
index 8171362d56b9..70c589c05a10 100644
--- a/include/asm-sparc/iommu.h
+++ b/include/asm-sparc/iommu.h
@@ -108,12 +108,12 @@ struct iommu_struct {
108 struct bit_map usemap; 108 struct bit_map usemap;
109}; 109};
110 110
111extern __inline__ void iommu_invalidate(struct iommu_regs *regs) 111static inline void iommu_invalidate(struct iommu_regs *regs)
112{ 112{
113 regs->tlbflush = 0; 113 regs->tlbflush = 0;
114} 114}
115 115
116extern __inline__ void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) 116static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba)
117{ 117{
118 regs->pageflush = (ba & PAGE_MASK); 118 regs->pageflush = (ba & PAGE_MASK);
119} 119}
diff --git a/include/asm-sparc/kdebug.h b/include/asm-sparc/kdebug.h
index 3ea4916635ee..fba92485fdba 100644
--- a/include/asm-sparc/kdebug.h
+++ b/include/asm-sparc/kdebug.h
@@ -46,7 +46,7 @@ struct kernel_debug {
46extern struct kernel_debug *linux_dbvec; 46extern struct kernel_debug *linux_dbvec;
47 47
48/* Use this macro in C-code to enter the debugger. */ 48/* Use this macro in C-code to enter the debugger. */
49extern __inline__ void sp_enter_debugger(void) 49static inline void sp_enter_debugger(void)
50{ 50{
51 __asm__ __volatile__("jmpl %0, %%o7\n\t" 51 __asm__ __volatile__("jmpl %0, %%o7\n\t"
52 "nop\n\t" : : 52 "nop\n\t" : :
diff --git a/include/asm-sparc/mbus.h b/include/asm-sparc/mbus.h
index 5f2749015342..ecacdf4075d7 100644
--- a/include/asm-sparc/mbus.h
+++ b/include/asm-sparc/mbus.h
@@ -83,7 +83,7 @@ extern unsigned int hwbug_bitmask;
83 */ 83 */
84#define TBR_ID_SHIFT 20 84#define TBR_ID_SHIFT 20
85 85
86extern __inline__ int get_cpuid(void) 86static inline int get_cpuid(void)
87{ 87{
88 register int retval; 88 register int retval;
89 __asm__ __volatile__("rd %%tbr, %0\n\t" 89 __asm__ __volatile__("rd %%tbr, %0\n\t"
@@ -93,7 +93,7 @@ extern __inline__ int get_cpuid(void)
93 return (retval & 3); 93 return (retval & 3);
94} 94}
95 95
96extern __inline__ int get_modid(void) 96static inline int get_modid(void)
97{ 97{
98 return (get_cpuid() | 0x8); 98 return (get_cpuid() | 0x8);
99} 99}
diff --git a/include/asm-sparc/msi.h b/include/asm-sparc/msi.h
index b69543dd3b46..ff72cbd946a4 100644
--- a/include/asm-sparc/msi.h
+++ b/include/asm-sparc/msi.h
@@ -19,7 +19,7 @@
19#define MSI_ASYNC_MODE 0x80000000 /* Operate the MSI asynchronously */ 19#define MSI_ASYNC_MODE 0x80000000 /* Operate the MSI asynchronously */
20 20
21 21
22extern __inline__ void msi_set_sync(void) 22static inline void msi_set_sync(void)
23{ 23{
24 __asm__ __volatile__ ("lda [%0] %1, %%g3\n\t" 24 __asm__ __volatile__ ("lda [%0] %1, %%g3\n\t"
25 "andn %%g3, %2, %%g3\n\t" 25 "andn %%g3, %2, %%g3\n\t"
diff --git a/include/asm-sparc/mxcc.h b/include/asm-sparc/mxcc.h
index 60ef9d6fe7bc..128fe9708135 100644
--- a/include/asm-sparc/mxcc.h
+++ b/include/asm-sparc/mxcc.h
@@ -85,7 +85,7 @@
85 85
86#ifndef __ASSEMBLY__ 86#ifndef __ASSEMBLY__
87 87
88extern __inline__ void mxcc_set_stream_src(unsigned long *paddr) 88static inline void mxcc_set_stream_src(unsigned long *paddr)
89{ 89{
90 unsigned long data0 = paddr[0]; 90 unsigned long data0 = paddr[0];
91 unsigned long data1 = paddr[1]; 91 unsigned long data1 = paddr[1];
@@ -98,7 +98,7 @@ extern __inline__ void mxcc_set_stream_src(unsigned long *paddr)
98 "i" (ASI_M_MXCC) : "g2", "g3"); 98 "i" (ASI_M_MXCC) : "g2", "g3");
99} 99}
100 100
101extern __inline__ void mxcc_set_stream_dst(unsigned long *paddr) 101static inline void mxcc_set_stream_dst(unsigned long *paddr)
102{ 102{
103 unsigned long data0 = paddr[0]; 103 unsigned long data0 = paddr[0];
104 unsigned long data1 = paddr[1]; 104 unsigned long data1 = paddr[1];
@@ -111,7 +111,7 @@ extern __inline__ void mxcc_set_stream_dst(unsigned long *paddr)
111 "i" (ASI_M_MXCC) : "g2", "g3"); 111 "i" (ASI_M_MXCC) : "g2", "g3");
112} 112}
113 113
114extern __inline__ unsigned long mxcc_get_creg(void) 114static inline unsigned long mxcc_get_creg(void)
115{ 115{
116 unsigned long mxcc_control; 116 unsigned long mxcc_control;
117 117
@@ -125,7 +125,7 @@ extern __inline__ unsigned long mxcc_get_creg(void)
125 return mxcc_control; 125 return mxcc_control;
126} 126}
127 127
128extern __inline__ void mxcc_set_creg(unsigned long mxcc_control) 128static inline void mxcc_set_creg(unsigned long mxcc_control)
129{ 129{
130 __asm__ __volatile__("sta %0, [%1] %2\n\t" : : 130 __asm__ __volatile__("sta %0, [%1] %2\n\t" : :
131 "r" (mxcc_control), "r" (MXCC_CREG), 131 "r" (mxcc_control), "r" (MXCC_CREG),
diff --git a/include/asm-sparc/obio.h b/include/asm-sparc/obio.h
index 62e1d77965f3..47854a2a12cf 100644
--- a/include/asm-sparc/obio.h
+++ b/include/asm-sparc/obio.h
@@ -98,7 +98,7 @@
98 98
99#ifndef __ASSEMBLY__ 99#ifndef __ASSEMBLY__
100 100
101extern __inline__ int bw_get_intr_mask(int sbus_level) 101static inline int bw_get_intr_mask(int sbus_level)
102{ 102{
103 int mask; 103 int mask;
104 104
@@ -109,7 +109,7 @@ extern __inline__ int bw_get_intr_mask(int sbus_level)
109 return mask; 109 return mask;
110} 110}
111 111
112extern __inline__ void bw_clear_intr_mask(int sbus_level, int mask) 112static inline void bw_clear_intr_mask(int sbus_level, int mask)
113{ 113{
114 __asm__ __volatile__ ("stha %0, [%1] %2" : : 114 __asm__ __volatile__ ("stha %0, [%1] %2" : :
115 "r" (mask), 115 "r" (mask),
@@ -117,7 +117,7 @@ extern __inline__ void bw_clear_intr_mask(int sbus_level, int mask)
117 "i" (ASI_M_CTL)); 117 "i" (ASI_M_CTL));
118} 118}
119 119
120extern __inline__ unsigned bw_get_prof_limit(int cpu) 120static inline unsigned bw_get_prof_limit(int cpu)
121{ 121{
122 unsigned limit; 122 unsigned limit;
123 123
@@ -128,7 +128,7 @@ extern __inline__ unsigned bw_get_prof_limit(int cpu)
128 return limit; 128 return limit;
129} 129}
130 130
131extern __inline__ void bw_set_prof_limit(int cpu, unsigned limit) 131static inline void bw_set_prof_limit(int cpu, unsigned limit)
132{ 132{
133 __asm__ __volatile__ ("sta %0, [%1] %2" : : 133 __asm__ __volatile__ ("sta %0, [%1] %2" : :
134 "r" (limit), 134 "r" (limit),
@@ -136,7 +136,7 @@ extern __inline__ void bw_set_prof_limit(int cpu, unsigned limit)
136 "i" (ASI_M_CTL)); 136 "i" (ASI_M_CTL));
137} 137}
138 138
139extern __inline__ unsigned bw_get_ctrl(int cpu) 139static inline unsigned bw_get_ctrl(int cpu)
140{ 140{
141 unsigned ctrl; 141 unsigned ctrl;
142 142
@@ -147,7 +147,7 @@ extern __inline__ unsigned bw_get_ctrl(int cpu)
147 return ctrl; 147 return ctrl;
148} 148}
149 149
150extern __inline__ void bw_set_ctrl(int cpu, unsigned ctrl) 150static inline void bw_set_ctrl(int cpu, unsigned ctrl)
151{ 151{
152 __asm__ __volatile__ ("sta %0, [%1] %2" : : 152 __asm__ __volatile__ ("sta %0, [%1] %2" : :
153 "r" (ctrl), 153 "r" (ctrl),
@@ -157,7 +157,7 @@ extern __inline__ void bw_set_ctrl(int cpu, unsigned ctrl)
157 157
158extern unsigned char cpu_leds[32]; 158extern unsigned char cpu_leds[32];
159 159
160extern __inline__ void show_leds(int cpuid) 160static inline void show_leds(int cpuid)
161{ 161{
162 cpuid &= 0x1e; 162 cpuid &= 0x1e;
163 __asm__ __volatile__ ("stba %0, [%1] %2" : : 163 __asm__ __volatile__ ("stba %0, [%1] %2" : :
@@ -166,7 +166,7 @@ extern __inline__ void show_leds(int cpuid)
166 "i" (ASI_M_CTL)); 166 "i" (ASI_M_CTL));
167} 167}
168 168
169extern __inline__ unsigned cc_get_ipen(void) 169static inline unsigned cc_get_ipen(void)
170{ 170{
171 unsigned pending; 171 unsigned pending;
172 172
@@ -177,7 +177,7 @@ extern __inline__ unsigned cc_get_ipen(void)
177 return pending; 177 return pending;
178} 178}
179 179
180extern __inline__ void cc_set_iclr(unsigned clear) 180static inline void cc_set_iclr(unsigned clear)
181{ 181{
182 __asm__ __volatile__ ("stha %0, [%1] %2" : : 182 __asm__ __volatile__ ("stha %0, [%1] %2" : :
183 "r" (clear), 183 "r" (clear),
@@ -185,7 +185,7 @@ extern __inline__ void cc_set_iclr(unsigned clear)
185 "i" (ASI_M_MXCC)); 185 "i" (ASI_M_MXCC));
186} 186}
187 187
188extern __inline__ unsigned cc_get_imsk(void) 188static inline unsigned cc_get_imsk(void)
189{ 189{
190 unsigned mask; 190 unsigned mask;
191 191
@@ -196,7 +196,7 @@ extern __inline__ unsigned cc_get_imsk(void)
196 return mask; 196 return mask;
197} 197}
198 198
199extern __inline__ void cc_set_imsk(unsigned mask) 199static inline void cc_set_imsk(unsigned mask)
200{ 200{
201 __asm__ __volatile__ ("stha %0, [%1] %2" : : 201 __asm__ __volatile__ ("stha %0, [%1] %2" : :
202 "r" (mask), 202 "r" (mask),
@@ -204,7 +204,7 @@ extern __inline__ void cc_set_imsk(unsigned mask)
204 "i" (ASI_M_MXCC)); 204 "i" (ASI_M_MXCC));
205} 205}
206 206
207extern __inline__ unsigned cc_get_imsk_other(int cpuid) 207static inline unsigned cc_get_imsk_other(int cpuid)
208{ 208{
209 unsigned mask; 209 unsigned mask;
210 210
@@ -215,7 +215,7 @@ extern __inline__ unsigned cc_get_imsk_other(int cpuid)
215 return mask; 215 return mask;
216} 216}
217 217
218extern __inline__ void cc_set_imsk_other(int cpuid, unsigned mask) 218static inline void cc_set_imsk_other(int cpuid, unsigned mask)
219{ 219{
220 __asm__ __volatile__ ("stha %0, [%1] %2" : : 220 __asm__ __volatile__ ("stha %0, [%1] %2" : :
221 "r" (mask), 221 "r" (mask),
@@ -223,7 +223,7 @@ extern __inline__ void cc_set_imsk_other(int cpuid, unsigned mask)
223 "i" (ASI_M_CTL)); 223 "i" (ASI_M_CTL));
224} 224}
225 225
226extern __inline__ void cc_set_igen(unsigned gen) 226static inline void cc_set_igen(unsigned gen)
227{ 227{
228 __asm__ __volatile__ ("sta %0, [%1] %2" : : 228 __asm__ __volatile__ ("sta %0, [%1] %2" : :
229 "r" (gen), 229 "r" (gen),
@@ -239,7 +239,7 @@ extern __inline__ void cc_set_igen(unsigned gen)
239#define IGEN_MESSAGE(bcast, devid, sid, levels) \ 239#define IGEN_MESSAGE(bcast, devid, sid, levels) \
240 (((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels)) 240 (((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels))
241 241
242extern __inline__ void sun4d_send_ipi(int cpu, int level) 242static inline void sun4d_send_ipi(int cpu, int level)
243{ 243{
244 cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1))); 244 cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1)));
245} 245}
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
index 97052baf90c1..38644742f011 100644
--- a/include/asm-sparc/pci.h
+++ b/include/asm-sparc/pci.h
@@ -15,12 +15,12 @@
15 15
16#define PCI_IRQ_NONE 0xffffffff 16#define PCI_IRQ_NONE 0xffffffff
17 17
18extern inline void pcibios_set_master(struct pci_dev *dev) 18static inline void pcibios_set_master(struct pci_dev *dev)
19{ 19{
20 /* No special bus mastering setup handling */ 20 /* No special bus mastering setup handling */
21} 21}
22 22
23extern inline void pcibios_penalize_isa_irq(int irq, int active) 23static inline void pcibios_penalize_isa_irq(int irq, int active)
24{ 24{
25 /* We don't do dynamic PCI IRQ allocation */ 25 /* We don't do dynamic PCI IRQ allocation */
26} 26}
@@ -137,7 +137,7 @@ extern void pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist
137 * only drive the low 24-bits during PCI bus mastering, then 137 * only drive the low 24-bits during PCI bus mastering, then
138 * you would pass 0x00ffffff as the mask to this function. 138 * you would pass 0x00ffffff as the mask to this function.
139 */ 139 */
140extern inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) 140static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
141{ 141{
142 return 1; 142 return 1;
143} 143}
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index 8f4f6a959651..a14e98677500 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -82,6 +82,8 @@ extern unsigned long page_kernel;
82/* Top-level page directory */ 82/* Top-level page directory */
83extern pgd_t swapper_pg_dir[1024]; 83extern pgd_t swapper_pg_dir[1024];
84 84
85extern void paging_init(void);
86
85/* Page table for 0-4MB for everybody, on the Sparc this 87/* Page table for 0-4MB for everybody, on the Sparc this
86 * holds the same as on the i386. 88 * holds the same as on the i386.
87 */ 89 */
@@ -152,7 +154,7 @@ BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
152BTFIXUPDEF_CALL(void, pte_clear, pte_t *) 154BTFIXUPDEF_CALL(void, pte_clear, pte_t *)
153BTFIXUPDEF_CALL(int, pte_read, pte_t) 155BTFIXUPDEF_CALL(int, pte_read, pte_t)
154 156
155extern __inline__ int pte_none(pte_t pte) 157static inline int pte_none(pte_t pte)
156{ 158{
157 return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask)); 159 return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask));
158} 160}
@@ -165,7 +167,7 @@ BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t)
165BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) 167BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t)
166BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *) 168BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *)
167 169
168extern __inline__ int pmd_none(pmd_t pmd) 170static inline int pmd_none(pmd_t pmd)
169{ 171{
170 return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask)); 172 return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask));
171} 173}
@@ -192,20 +194,20 @@ BTFIXUPDEF_HALF(pte_writei)
192BTFIXUPDEF_HALF(pte_dirtyi) 194BTFIXUPDEF_HALF(pte_dirtyi)
193BTFIXUPDEF_HALF(pte_youngi) 195BTFIXUPDEF_HALF(pte_youngi)
194 196
195extern int pte_write(pte_t pte) __attribute_const__; 197static int pte_write(pte_t pte) __attribute_const__;
196extern __inline__ int pte_write(pte_t pte) 198static inline int pte_write(pte_t pte)
197{ 199{
198 return pte_val(pte) & BTFIXUP_HALF(pte_writei); 200 return pte_val(pte) & BTFIXUP_HALF(pte_writei);
199} 201}
200 202
201extern int pte_dirty(pte_t pte) __attribute_const__; 203static int pte_dirty(pte_t pte) __attribute_const__;
202extern __inline__ int pte_dirty(pte_t pte) 204static inline int pte_dirty(pte_t pte)
203{ 205{
204 return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi); 206 return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi);
205} 207}
206 208
207extern int pte_young(pte_t pte) __attribute_const__; 209static int pte_young(pte_t pte) __attribute_const__;
208extern __inline__ int pte_young(pte_t pte) 210static inline int pte_young(pte_t pte)
209{ 211{
210 return pte_val(pte) & BTFIXUP_HALF(pte_youngi); 212 return pte_val(pte) & BTFIXUP_HALF(pte_youngi);
211} 213}
@@ -215,8 +217,8 @@ extern __inline__ int pte_young(pte_t pte)
215 */ 217 */
216BTFIXUPDEF_HALF(pte_filei) 218BTFIXUPDEF_HALF(pte_filei)
217 219
218extern int pte_file(pte_t pte) __attribute_const__; 220static int pte_file(pte_t pte) __attribute_const__;
219extern __inline__ int pte_file(pte_t pte) 221static inline int pte_file(pte_t pte)
220{ 222{
221 return pte_val(pte) & BTFIXUP_HALF(pte_filei); 223 return pte_val(pte) & BTFIXUP_HALF(pte_filei);
222} 224}
@@ -227,20 +229,20 @@ BTFIXUPDEF_HALF(pte_wrprotecti)
227BTFIXUPDEF_HALF(pte_mkcleani) 229BTFIXUPDEF_HALF(pte_mkcleani)
228BTFIXUPDEF_HALF(pte_mkoldi) 230BTFIXUPDEF_HALF(pte_mkoldi)
229 231
230extern pte_t pte_wrprotect(pte_t pte) __attribute_const__; 232static pte_t pte_wrprotect(pte_t pte) __attribute_const__;
231extern __inline__ pte_t pte_wrprotect(pte_t pte) 233static inline pte_t pte_wrprotect(pte_t pte)
232{ 234{
233 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti)); 235 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti));
234} 236}
235 237
236extern pte_t pte_mkclean(pte_t pte) __attribute_const__; 238static pte_t pte_mkclean(pte_t pte) __attribute_const__;
237extern __inline__ pte_t pte_mkclean(pte_t pte) 239static inline pte_t pte_mkclean(pte_t pte)
238{ 240{
239 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani)); 241 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani));
240} 242}
241 243
242extern pte_t pte_mkold(pte_t pte) __attribute_const__; 244static pte_t pte_mkold(pte_t pte) __attribute_const__;
243extern __inline__ pte_t pte_mkold(pte_t pte) 245static inline pte_t pte_mkold(pte_t pte)
244{ 246{
245 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi)); 247 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi));
246} 248}
@@ -276,8 +278,8 @@ BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int)
276 278
277BTFIXUPDEF_INT(pte_modify_mask) 279BTFIXUPDEF_INT(pte_modify_mask)
278 280
279extern pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__; 281static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__;
280extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) 282static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
281{ 283{
282 return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) | 284 return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) |
283 pgprot_val(newprot)); 285 pgprot_val(newprot));
@@ -384,13 +386,13 @@ extern struct ctx_list ctx_used; /* Head of used contexts list */
384 386
385#define NO_CONTEXT -1 387#define NO_CONTEXT -1
386 388
387extern __inline__ void remove_from_ctx_list(struct ctx_list *entry) 389static inline void remove_from_ctx_list(struct ctx_list *entry)
388{ 390{
389 entry->next->prev = entry->prev; 391 entry->next->prev = entry->prev;
390 entry->prev->next = entry->next; 392 entry->prev->next = entry->next;
391} 393}
392 394
393extern __inline__ void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry) 395static inline void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry)
394{ 396{
395 entry->next = head; 397 entry->next = head;
396 (entry->prev = head->prev)->next = entry; 398 (entry->prev = head->prev)->next = entry;
@@ -399,7 +401,7 @@ extern __inline__ void add_to_ctx_list(struct ctx_list *head, struct ctx_list *e
399#define add_to_free_ctxlist(entry) add_to_ctx_list(&ctx_free, entry) 401#define add_to_free_ctxlist(entry) add_to_ctx_list(&ctx_free, entry)
400#define add_to_used_ctxlist(entry) add_to_ctx_list(&ctx_used, entry) 402#define add_to_used_ctxlist(entry) add_to_ctx_list(&ctx_used, entry)
401 403
402extern __inline__ unsigned long 404static inline unsigned long
403__get_phys (unsigned long addr) 405__get_phys (unsigned long addr)
404{ 406{
405 switch (sparc_cpu_model){ 407 switch (sparc_cpu_model){
@@ -414,7 +416,7 @@ __get_phys (unsigned long addr)
414 } 416 }
415} 417}
416 418
417extern __inline__ int 419static inline int
418__get_iospace (unsigned long addr) 420__get_iospace (unsigned long addr)
419{ 421{
420 switch (sparc_cpu_model){ 422 switch (sparc_cpu_model){
diff --git a/include/asm-sparc/pgtsrmmu.h b/include/asm-sparc/pgtsrmmu.h
index ee3b9d93187c..edeb9811e728 100644
--- a/include/asm-sparc/pgtsrmmu.h
+++ b/include/asm-sparc/pgtsrmmu.h
@@ -148,7 +148,7 @@ extern void *srmmu_nocache_pool;
148#define __nocache_fix(VADDR) __va(__nocache_pa(VADDR)) 148#define __nocache_fix(VADDR) __va(__nocache_pa(VADDR))
149 149
150/* Accessing the MMU control register. */ 150/* Accessing the MMU control register. */
151extern __inline__ unsigned int srmmu_get_mmureg(void) 151static inline unsigned int srmmu_get_mmureg(void)
152{ 152{
153 unsigned int retval; 153 unsigned int retval;
154 __asm__ __volatile__("lda [%%g0] %1, %0\n\t" : 154 __asm__ __volatile__("lda [%%g0] %1, %0\n\t" :
@@ -157,14 +157,14 @@ extern __inline__ unsigned int srmmu_get_mmureg(void)
157 return retval; 157 return retval;
158} 158}
159 159
160extern __inline__ void srmmu_set_mmureg(unsigned long regval) 160static inline void srmmu_set_mmureg(unsigned long regval)
161{ 161{
162 __asm__ __volatile__("sta %0, [%%g0] %1\n\t" : : 162 __asm__ __volatile__("sta %0, [%%g0] %1\n\t" : :
163 "r" (regval), "i" (ASI_M_MMUREGS) : "memory"); 163 "r" (regval), "i" (ASI_M_MMUREGS) : "memory");
164 164
165} 165}
166 166
167extern __inline__ void srmmu_set_ctable_ptr(unsigned long paddr) 167static inline void srmmu_set_ctable_ptr(unsigned long paddr)
168{ 168{
169 paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); 169 paddr = ((paddr >> 4) & SRMMU_CTX_PMASK);
170 __asm__ __volatile__("sta %0, [%1] %2\n\t" : : 170 __asm__ __volatile__("sta %0, [%1] %2\n\t" : :
@@ -173,7 +173,7 @@ extern __inline__ void srmmu_set_ctable_ptr(unsigned long paddr)
173 "memory"); 173 "memory");
174} 174}
175 175
176extern __inline__ unsigned long srmmu_get_ctable_ptr(void) 176static inline unsigned long srmmu_get_ctable_ptr(void)
177{ 177{
178 unsigned int retval; 178 unsigned int retval;
179 179
@@ -184,14 +184,14 @@ extern __inline__ unsigned long srmmu_get_ctable_ptr(void)
184 return (retval & SRMMU_CTX_PMASK) << 4; 184 return (retval & SRMMU_CTX_PMASK) << 4;
185} 185}
186 186
187extern __inline__ void srmmu_set_context(int context) 187static inline void srmmu_set_context(int context)
188{ 188{
189 __asm__ __volatile__("sta %0, [%1] %2\n\t" : : 189 __asm__ __volatile__("sta %0, [%1] %2\n\t" : :
190 "r" (context), "r" (SRMMU_CTX_REG), 190 "r" (context), "r" (SRMMU_CTX_REG),
191 "i" (ASI_M_MMUREGS) : "memory"); 191 "i" (ASI_M_MMUREGS) : "memory");
192} 192}
193 193
194extern __inline__ int srmmu_get_context(void) 194static inline int srmmu_get_context(void)
195{ 195{
196 register int retval; 196 register int retval;
197 __asm__ __volatile__("lda [%1] %2, %0\n\t" : 197 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
@@ -201,7 +201,7 @@ extern __inline__ int srmmu_get_context(void)
201 return retval; 201 return retval;
202} 202}
203 203
204extern __inline__ unsigned int srmmu_get_fstatus(void) 204static inline unsigned int srmmu_get_fstatus(void)
205{ 205{
206 unsigned int retval; 206 unsigned int retval;
207 207
@@ -211,7 +211,7 @@ extern __inline__ unsigned int srmmu_get_fstatus(void)
211 return retval; 211 return retval;
212} 212}
213 213
214extern __inline__ unsigned int srmmu_get_faddr(void) 214static inline unsigned int srmmu_get_faddr(void)
215{ 215{
216 unsigned int retval; 216 unsigned int retval;
217 217
@@ -222,7 +222,7 @@ extern __inline__ unsigned int srmmu_get_faddr(void)
222} 222}
223 223
224/* This is guaranteed on all SRMMU's. */ 224/* This is guaranteed on all SRMMU's. */
225extern __inline__ void srmmu_flush_whole_tlb(void) 225static inline void srmmu_flush_whole_tlb(void)
226{ 226{
227 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : 227 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
228 "r" (0x400), /* Flush entire TLB!! */ 228 "r" (0x400), /* Flush entire TLB!! */
@@ -231,7 +231,7 @@ extern __inline__ void srmmu_flush_whole_tlb(void)
231} 231}
232 232
233/* These flush types are not available on all chips... */ 233/* These flush types are not available on all chips... */
234extern __inline__ void srmmu_flush_tlb_ctx(void) 234static inline void srmmu_flush_tlb_ctx(void)
235{ 235{
236 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : 236 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
237 "r" (0x300), /* Flush TLB ctx.. */ 237 "r" (0x300), /* Flush TLB ctx.. */
@@ -239,7 +239,7 @@ extern __inline__ void srmmu_flush_tlb_ctx(void)
239 239
240} 240}
241 241
242extern __inline__ void srmmu_flush_tlb_region(unsigned long addr) 242static inline void srmmu_flush_tlb_region(unsigned long addr)
243{ 243{
244 addr &= SRMMU_PGDIR_MASK; 244 addr &= SRMMU_PGDIR_MASK;
245 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : 245 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
@@ -249,7 +249,7 @@ extern __inline__ void srmmu_flush_tlb_region(unsigned long addr)
249} 249}
250 250
251 251
252extern __inline__ void srmmu_flush_tlb_segment(unsigned long addr) 252static inline void srmmu_flush_tlb_segment(unsigned long addr)
253{ 253{
254 addr &= SRMMU_REAL_PMD_MASK; 254 addr &= SRMMU_REAL_PMD_MASK;
255 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : 255 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
@@ -258,7 +258,7 @@ extern __inline__ void srmmu_flush_tlb_segment(unsigned long addr)
258 258
259} 259}
260 260
261extern __inline__ void srmmu_flush_tlb_page(unsigned long page) 261static inline void srmmu_flush_tlb_page(unsigned long page)
262{ 262{
263 page &= PAGE_MASK; 263 page &= PAGE_MASK;
264 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : 264 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
@@ -267,7 +267,7 @@ extern __inline__ void srmmu_flush_tlb_page(unsigned long page)
267 267
268} 268}
269 269
270extern __inline__ unsigned long srmmu_hwprobe(unsigned long vaddr) 270static inline unsigned long srmmu_hwprobe(unsigned long vaddr)
271{ 271{
272 unsigned long retval; 272 unsigned long retval;
273 273
@@ -279,7 +279,7 @@ extern __inline__ unsigned long srmmu_hwprobe(unsigned long vaddr)
279 return retval; 279 return retval;
280} 280}
281 281
282extern __inline__ int 282static inline int
283srmmu_get_pte (unsigned long addr) 283srmmu_get_pte (unsigned long addr)
284{ 284{
285 register unsigned long entry; 285 register unsigned long entry;
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h
index 5a7a1a8d29ac..6fbb3f0af8d8 100644
--- a/include/asm-sparc/processor.h
+++ b/include/asm-sparc/processor.h
@@ -79,7 +79,7 @@ struct thread_struct {
79extern unsigned long thread_saved_pc(struct task_struct *t); 79extern unsigned long thread_saved_pc(struct task_struct *t);
80 80
81/* Do necessary setup to start up a newly executed thread. */ 81/* Do necessary setup to start up a newly executed thread. */
82extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, 82static inline void start_thread(struct pt_regs * regs, unsigned long pc,
83 unsigned long sp) 83 unsigned long sp)
84{ 84{
85 register unsigned long zero asm("g1"); 85 register unsigned long zero asm("g1");
diff --git a/include/asm-sparc/psr.h b/include/asm-sparc/psr.h
index 9778b8c8b15b..19c978051118 100644
--- a/include/asm-sparc/psr.h
+++ b/include/asm-sparc/psr.h
@@ -38,7 +38,7 @@
38 38
39#ifndef __ASSEMBLY__ 39#ifndef __ASSEMBLY__
40/* Get the %psr register. */ 40/* Get the %psr register. */
41extern __inline__ unsigned int get_psr(void) 41static inline unsigned int get_psr(void)
42{ 42{
43 unsigned int psr; 43 unsigned int psr;
44 __asm__ __volatile__( 44 __asm__ __volatile__(
@@ -53,7 +53,7 @@ extern __inline__ unsigned int get_psr(void)
53 return psr; 53 return psr;
54} 54}
55 55
56extern __inline__ void put_psr(unsigned int new_psr) 56static inline void put_psr(unsigned int new_psr)
57{ 57{
58 __asm__ __volatile__( 58 __asm__ __volatile__(
59 "wr %0, 0x0, %%psr\n\t" 59 "wr %0, 0x0, %%psr\n\t"
@@ -72,7 +72,7 @@ extern __inline__ void put_psr(unsigned int new_psr)
72 72
73extern unsigned int fsr_storage; 73extern unsigned int fsr_storage;
74 74
75extern __inline__ unsigned int get_fsr(void) 75static inline unsigned int get_fsr(void)
76{ 76{
77 unsigned int fsr = 0; 77 unsigned int fsr = 0;
78 78
diff --git a/include/asm-sparc/sbi.h b/include/asm-sparc/sbi.h
index 739ccac5dcf2..86a603ac7b20 100644
--- a/include/asm-sparc/sbi.h
+++ b/include/asm-sparc/sbi.h
@@ -65,7 +65,7 @@ struct sbi_regs {
65 65
66#ifndef __ASSEMBLY__ 66#ifndef __ASSEMBLY__
67 67
68extern __inline__ int acquire_sbi(int devid, int mask) 68static inline int acquire_sbi(int devid, int mask)
69{ 69{
70 __asm__ __volatile__ ("swapa [%2] %3, %0" : 70 __asm__ __volatile__ ("swapa [%2] %3, %0" :
71 "=r" (mask) : 71 "=r" (mask) :
@@ -75,7 +75,7 @@ extern __inline__ int acquire_sbi(int devid, int mask)
75 return mask; 75 return mask;
76} 76}
77 77
78extern __inline__ void release_sbi(int devid, int mask) 78static inline void release_sbi(int devid, int mask)
79{ 79{
80 __asm__ __volatile__ ("sta %0, [%1] %2" : : 80 __asm__ __volatile__ ("sta %0, [%1] %2" : :
81 "r" (mask), 81 "r" (mask),
@@ -83,7 +83,7 @@ extern __inline__ void release_sbi(int devid, int mask)
83 "i" (ASI_M_CTL)); 83 "i" (ASI_M_CTL));
84} 84}
85 85
86extern __inline__ void set_sbi_tid(int devid, int targetid) 86static inline void set_sbi_tid(int devid, int targetid)
87{ 87{
88 __asm__ __volatile__ ("sta %0, [%1] %2" : : 88 __asm__ __volatile__ ("sta %0, [%1] %2" : :
89 "r" (targetid), 89 "r" (targetid),
@@ -91,7 +91,7 @@ extern __inline__ void set_sbi_tid(int devid, int targetid)
91 "i" (ASI_M_CTL)); 91 "i" (ASI_M_CTL));
92} 92}
93 93
94extern __inline__ int get_sbi_ctl(int devid, int cfgno) 94static inline int get_sbi_ctl(int devid, int cfgno)
95{ 95{
96 int cfg; 96 int cfg;
97 97
@@ -102,7 +102,7 @@ extern __inline__ int get_sbi_ctl(int devid, int cfgno)
102 return cfg; 102 return cfg;
103} 103}
104 104
105extern __inline__ void set_sbi_ctl(int devid, int cfgno, int cfg) 105static inline void set_sbi_ctl(int devid, int cfgno, int cfg)
106{ 106{
107 __asm__ __volatile__ ("sta %0, [%1] %2" : : 107 __asm__ __volatile__ ("sta %0, [%1] %2" : :
108 "r" (cfg), 108 "r" (cfg),
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
index 3a8b3908728a..a13cddcecec5 100644
--- a/include/asm-sparc/sbus.h
+++ b/include/asm-sparc/sbus.h
@@ -28,12 +28,12 @@
28 * numbers + offsets, and vice versa. 28 * numbers + offsets, and vice versa.
29 */ 29 */
30 30
31extern __inline__ unsigned long sbus_devaddr(int slotnum, unsigned long offset) 31static inline unsigned long sbus_devaddr(int slotnum, unsigned long offset)
32{ 32{
33 return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<25)+(offset)); 33 return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<25)+(offset));
34} 34}
35 35
36extern __inline__ int sbus_dev_slot(unsigned long dev_addr) 36static inline int sbus_dev_slot(unsigned long dev_addr)
37{ 37{
38 return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>25); 38 return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>25);
39} 39}
@@ -80,7 +80,7 @@ struct sbus_bus {
80 80
81extern struct sbus_bus *sbus_root; 81extern struct sbus_bus *sbus_root;
82 82
83extern __inline__ int 83static inline int
84sbus_is_slave(struct sbus_dev *dev) 84sbus_is_slave(struct sbus_dev *dev)
85{ 85{
86 /* XXX Have to write this for sun4c's */ 86 /* XXX Have to write this for sun4c's */
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index 4f96d8333a12..580c51d011df 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -60,22 +60,22 @@ BTFIXUPDEF_BLACKBOX(load_current)
60#define smp_cross_call(func,arg1,arg2,arg3,arg4,arg5) BTFIXUP_CALL(smp_cross_call)(func,arg1,arg2,arg3,arg4,arg5) 60#define smp_cross_call(func,arg1,arg2,arg3,arg4,arg5) BTFIXUP_CALL(smp_cross_call)(func,arg1,arg2,arg3,arg4,arg5)
61#define smp_message_pass(target,msg,data,wait) BTFIXUP_CALL(smp_message_pass)(target,msg,data,wait) 61#define smp_message_pass(target,msg,data,wait) BTFIXUP_CALL(smp_message_pass)(target,msg,data,wait)
62 62
63extern __inline__ void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); } 63static inline void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); }
64extern __inline__ void xc1(smpfunc_t func, unsigned long arg1) 64static inline void xc1(smpfunc_t func, unsigned long arg1)
65{ smp_cross_call(func, arg1, 0, 0, 0, 0); } 65{ smp_cross_call(func, arg1, 0, 0, 0, 0); }
66extern __inline__ void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2) 66static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2)
67{ smp_cross_call(func, arg1, arg2, 0, 0, 0); } 67{ smp_cross_call(func, arg1, arg2, 0, 0, 0); }
68extern __inline__ void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2, 68static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2,
69 unsigned long arg3) 69 unsigned long arg3)
70{ smp_cross_call(func, arg1, arg2, arg3, 0, 0); } 70{ smp_cross_call(func, arg1, arg2, arg3, 0, 0); }
71extern __inline__ void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, 71static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
72 unsigned long arg3, unsigned long arg4) 72 unsigned long arg3, unsigned long arg4)
73{ smp_cross_call(func, arg1, arg2, arg3, arg4, 0); } 73{ smp_cross_call(func, arg1, arg2, arg3, arg4, 0); }
74extern __inline__ void xc5(smpfunc_t func, unsigned long arg1, unsigned long arg2, 74static inline void xc5(smpfunc_t func, unsigned long arg1, unsigned long arg2,
75 unsigned long arg3, unsigned long arg4, unsigned long arg5) 75 unsigned long arg3, unsigned long arg4, unsigned long arg5)
76{ smp_cross_call(func, arg1, arg2, arg3, arg4, arg5); } 76{ smp_cross_call(func, arg1, arg2, arg3, arg4, arg5); }
77 77
78extern __inline__ int smp_call_function(void (*func)(void *info), void *info, int nonatomic, int wait) 78static inline int smp_call_function(void (*func)(void *info), void *info, int nonatomic, int wait)
79{ 79{
80 xc1((smpfunc_t)func, (unsigned long)info); 80 xc1((smpfunc_t)func, (unsigned long)info);
81 return 0; 81 return 0;
@@ -84,16 +84,16 @@ extern __inline__ int smp_call_function(void (*func)(void *info), void *info, in
84extern __volatile__ int __cpu_number_map[NR_CPUS]; 84extern __volatile__ int __cpu_number_map[NR_CPUS];
85extern __volatile__ int __cpu_logical_map[NR_CPUS]; 85extern __volatile__ int __cpu_logical_map[NR_CPUS];
86 86
87extern __inline__ int cpu_logical_map(int cpu) 87static inline int cpu_logical_map(int cpu)
88{ 88{
89 return __cpu_logical_map[cpu]; 89 return __cpu_logical_map[cpu];
90} 90}
91extern __inline__ int cpu_number_map(int cpu) 91static inline int cpu_number_map(int cpu)
92{ 92{
93 return __cpu_number_map[cpu]; 93 return __cpu_number_map[cpu];
94} 94}
95 95
96extern __inline__ int hard_smp4m_processor_id(void) 96static inline int hard_smp4m_processor_id(void)
97{ 97{
98 int cpuid; 98 int cpuid;
99 99
@@ -104,7 +104,7 @@ extern __inline__ int hard_smp4m_processor_id(void)
104 return cpuid; 104 return cpuid;
105} 105}
106 106
107extern __inline__ int hard_smp4d_processor_id(void) 107static inline int hard_smp4d_processor_id(void)
108{ 108{
109 int cpuid; 109 int cpuid;
110 110
@@ -114,7 +114,7 @@ extern __inline__ int hard_smp4d_processor_id(void)
114} 114}
115 115
116#ifndef MODULE 116#ifndef MODULE
117extern __inline__ int hard_smp_processor_id(void) 117static inline int hard_smp_processor_id(void)
118{ 118{
119 int cpuid; 119 int cpuid;
120 120
@@ -136,7 +136,7 @@ extern __inline__ int hard_smp_processor_id(void)
136 return cpuid; 136 return cpuid;
137} 137}
138#else 138#else
139extern __inline__ int hard_smp_processor_id(void) 139static inline int hard_smp_processor_id(void)
140{ 140{
141 int cpuid; 141 int cpuid;
142 142
diff --git a/include/asm-sparc/smpprim.h b/include/asm-sparc/smpprim.h
index 9b9c28ed748e..e7b6d346ae10 100644
--- a/include/asm-sparc/smpprim.h
+++ b/include/asm-sparc/smpprim.h
@@ -15,7 +15,7 @@
15 * atomic. 15 * atomic.
16 */ 16 */
17 17
18extern __inline__ __volatile__ char test_and_set(void *addr) 18static inline __volatile__ char test_and_set(void *addr)
19{ 19{
20 char state = 0; 20 char state = 0;
21 21
@@ -27,7 +27,7 @@ extern __inline__ __volatile__ char test_and_set(void *addr)
27} 27}
28 28
29/* Initialize a spin-lock. */ 29/* Initialize a spin-lock. */
30extern __inline__ __volatile__ smp_initlock(void *spinlock) 30static inline __volatile__ smp_initlock(void *spinlock)
31{ 31{
32 /* Unset the lock. */ 32 /* Unset the lock. */
33 *((unsigned char *) spinlock) = 0; 33 *((unsigned char *) spinlock) = 0;
@@ -36,7 +36,7 @@ extern __inline__ __volatile__ smp_initlock(void *spinlock)
36} 36}
37 37
38/* This routine spins until it acquires the lock at ADDR. */ 38/* This routine spins until it acquires the lock at ADDR. */
39extern __inline__ __volatile__ smp_lock(void *addr) 39static inline __volatile__ smp_lock(void *addr)
40{ 40{
41 while(test_and_set(addr) == 0xff) 41 while(test_and_set(addr) == 0xff)
42 ; 42 ;
@@ -46,7 +46,7 @@ extern __inline__ __volatile__ smp_lock(void *addr)
46} 46}
47 47
48/* This routine releases the lock at ADDR. */ 48/* This routine releases the lock at ADDR. */
49extern __inline__ __volatile__ smp_unlock(void *addr) 49static inline __volatile__ smp_unlock(void *addr)
50{ 50{
51 *((unsigned char *) addr) = 0; 51 *((unsigned char *) addr) = 0;
52} 52}
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index 111727a2bb4e..e344c98a6f5f 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -17,7 +17,7 @@
17#define __raw_spin_unlock_wait(lock) \ 17#define __raw_spin_unlock_wait(lock) \
18 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 18 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
19 19
20extern __inline__ void __raw_spin_lock(raw_spinlock_t *lock) 20static inline void __raw_spin_lock(raw_spinlock_t *lock)
21{ 21{
22 __asm__ __volatile__( 22 __asm__ __volatile__(
23 "\n1:\n\t" 23 "\n1:\n\t"
@@ -37,7 +37,7 @@ extern __inline__ void __raw_spin_lock(raw_spinlock_t *lock)
37 : "g2", "memory", "cc"); 37 : "g2", "memory", "cc");
38} 38}
39 39
40extern __inline__ int __raw_spin_trylock(raw_spinlock_t *lock) 40static inline int __raw_spin_trylock(raw_spinlock_t *lock)
41{ 41{
42 unsigned int result; 42 unsigned int result;
43 __asm__ __volatile__("ldstub [%1], %0" 43 __asm__ __volatile__("ldstub [%1], %0"
@@ -47,7 +47,7 @@ extern __inline__ int __raw_spin_trylock(raw_spinlock_t *lock)
47 return (result == 0); 47 return (result == 0);
48} 48}
49 49
50extern __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) 50static inline void __raw_spin_unlock(raw_spinlock_t *lock)
51{ 51{
52 __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); 52 __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory");
53} 53}
@@ -78,7 +78,7 @@ extern __inline__ void __raw_spin_unlock(raw_spinlock_t *lock)
78 * 78 *
79 * Unfortunately this scheme limits us to ~16,000,000 cpus. 79 * Unfortunately this scheme limits us to ~16,000,000 cpus.
80 */ 80 */
81extern __inline__ void __read_lock(raw_rwlock_t *rw) 81static inline void __read_lock(raw_rwlock_t *rw)
82{ 82{
83 register raw_rwlock_t *lp asm("g1"); 83 register raw_rwlock_t *lp asm("g1");
84 lp = rw; 84 lp = rw;
@@ -98,7 +98,7 @@ do { unsigned long flags; \
98 local_irq_restore(flags); \ 98 local_irq_restore(flags); \
99} while(0) 99} while(0)
100 100
101extern __inline__ void __read_unlock(raw_rwlock_t *rw) 101static inline void __read_unlock(raw_rwlock_t *rw)
102{ 102{
103 register raw_rwlock_t *lp asm("g1"); 103 register raw_rwlock_t *lp asm("g1");
104 lp = rw; 104 lp = rw;
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 3557781a4bfd..1f6b71f9e1b6 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -204,7 +204,7 @@ static inline unsigned long getipl(void)
204BTFIXUPDEF_CALL(void, ___xchg32, void) 204BTFIXUPDEF_CALL(void, ___xchg32, void)
205#endif 205#endif
206 206
207extern __inline__ unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) 207static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val)
208{ 208{
209#ifdef CONFIG_SMP 209#ifdef CONFIG_SMP
210 __asm__ __volatile__("swap [%2], %0" 210 __asm__ __volatile__("swap [%2], %0"
diff --git a/include/asm-sparc/traps.h b/include/asm-sparc/traps.h
index 6690ab956ea6..f62c7f878ee1 100644
--- a/include/asm-sparc/traps.h
+++ b/include/asm-sparc/traps.h
@@ -22,7 +22,7 @@ struct tt_entry {
22/* We set this to _start in system setup. */ 22/* We set this to _start in system setup. */
23extern struct tt_entry *sparc_ttable; 23extern struct tt_entry *sparc_ttable;
24 24
25extern __inline__ unsigned long get_tbr(void) 25static inline unsigned long get_tbr(void)
26{ 26{
27 unsigned long tbr; 27 unsigned long tbr;
28 28
diff --git a/include/asm-sparc64/head.h b/include/asm-sparc64/head.h
index b63a33cf4971..0abd3a674e8f 100644
--- a/include/asm-sparc64/head.h
+++ b/include/asm-sparc64/head.h
@@ -12,9 +12,12 @@
12#define __JALAPENO_ID 0x003e0016 12#define __JALAPENO_ID 0x003e0016
13 13
14#define CHEETAH_MANUF 0x003e 14#define CHEETAH_MANUF 0x003e
15#define CHEETAH_IMPL 0x0014 15#define CHEETAH_IMPL 0x0014 /* Ultra-III */
16#define CHEETAH_PLUS_IMPL 0x0015 16#define CHEETAH_PLUS_IMPL 0x0015 /* Ultra-III+ */
17#define JALAPENO_IMPL 0x0016 17#define JALAPENO_IMPL 0x0016 /* Ultra-IIIi */
18#define JAGUAR_IMPL 0x0018 /* Ultra-IV */
19#define PANTHER_IMPL 0x0019 /* Ultra-IV+ */
20#define SERRANO_IMPL 0x0022 /* Ultra-IIIi+ */
18 21
19#define BRANCH_IF_CHEETAH_BASE(tmp1,tmp2,label) \ 22#define BRANCH_IF_CHEETAH_BASE(tmp1,tmp2,label) \
20 rdpr %ver, %tmp1; \ 23 rdpr %ver, %tmp1; \
diff --git a/include/asm-sparc64/openprom.h b/include/asm-sparc64/openprom.h
index 0a336901d585..b4959d2b0d99 100644
--- a/include/asm-sparc64/openprom.h
+++ b/include/asm-sparc64/openprom.h
@@ -186,8 +186,8 @@ struct linux_prom_registers {
186}; 186};
187 187
188struct linux_prom64_registers { 188struct linux_prom64_registers {
189 long phys_addr; 189 unsigned long phys_addr;
190 long reg_size; 190 unsigned long reg_size;
191}; 191};
192 192
193struct linux_prom_irqs { 193struct linux_prom_irqs {
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index c628189b6c89..d02f1e8ae1a6 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -95,20 +95,6 @@ extern int prom_devclose(int device_handle);
95extern void prom_seek(int device_handle, unsigned int seek_hival, 95extern void prom_seek(int device_handle, unsigned int seek_hival,
96 unsigned int seek_lowval); 96 unsigned int seek_lowval);
97 97
98/* Machine memory configuration routine. */
99
100/* This function returns a V0 format memory descriptor table, it has three
101 * entries. One for the total amount of physical ram on the machine, one
102 * for the amount of physical ram available, and one describing the virtual
103 * areas which are allocated by the prom. So, in a sense the physical
104 * available is a calculation of the total physical minus the physical mapped
105 * by the prom with virtual mappings.
106 *
107 * These lists are returned pre-sorted, this should make your life easier
108 * since the prom itself is way too lazy to do such nice things.
109 */
110extern struct linux_mem_p1275 *prom_meminfo(void);
111
112/* Miscellaneous routines, don't really fit in any category per se. */ 98/* Miscellaneous routines, don't really fit in any category per se. */
113 99
114/* Reboot the machine with the command line passed. */ 100/* Reboot the machine with the command line passed. */
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index 7f8d764abc47..5426bb28a993 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -140,23 +140,6 @@ extern unsigned long page_to_pfn(struct page *);
140#define virt_to_phys __pa 140#define virt_to_phys __pa
141#define phys_to_virt __va 141#define phys_to_virt __va
142 142
143/* The following structure is used to hold the physical
144 * memory configuration of the machine. This is filled in
145 * probe_memory() and is later used by mem_init() to set up
146 * mem_map[]. We statically allocate SPARC_PHYS_BANKS of
147 * these structs, this is arbitrary. The entry after the
148 * last valid one has num_bytes==0.
149 */
150
151struct sparc_phys_banks {
152 unsigned long base_addr;
153 unsigned long num_bytes;
154};
155
156#define SPARC_PHYS_BANKS 32
157
158extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
159
160#endif /* !(__ASSEMBLY__) */ 143#endif /* !(__ASSEMBLY__) */
161 144
162#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 145#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 43cbb089cde2..8c6dfc6c7af6 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -98,7 +98,9 @@
98#define _PAGE_NFO _AC(0x1000000000000000,UL) /* No Fault Only */ 98#define _PAGE_NFO _AC(0x1000000000000000,UL) /* No Fault Only */
99#define _PAGE_IE _AC(0x0800000000000000,UL) /* Invert Endianness */ 99#define _PAGE_IE _AC(0x0800000000000000,UL) /* Invert Endianness */
100#define _PAGE_SOFT2 _AC(0x07FC000000000000,UL) /* Software bits, set 2 */ 100#define _PAGE_SOFT2 _AC(0x07FC000000000000,UL) /* Software bits, set 2 */
101#define _PAGE_RES1 _AC(0x0003000000000000,UL) /* Reserved */ 101#define _PAGE_RES1 _AC(0x0002000000000000,UL) /* Reserved */
102#define _PAGE_SZ32MB _AC(0x0001000000000000,UL) /* (Panther) 32MB page */
103#define _PAGE_SZ256MB _AC(0x2001000000000000,UL) /* (Panther) 256MB page */
102#define _PAGE_SN _AC(0x0000800000000000,UL) /* (Cheetah) Snoop */ 104#define _PAGE_SN _AC(0x0000800000000000,UL) /* (Cheetah) Snoop */
103#define _PAGE_RES2 _AC(0x0000780000000000,UL) /* Reserved */ 105#define _PAGE_RES2 _AC(0x0000780000000000,UL) /* Reserved */
104#define _PAGE_PADDR_SF _AC(0x000001FFFFFFE000,UL) /* (Spitfire) paddr[40:13]*/ 106#define _PAGE_PADDR_SF _AC(0x000001FFFFFFE000,UL) /* (Spitfire) paddr[40:13]*/
@@ -339,6 +341,9 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p
339extern pgd_t swapper_pg_dir[2048]; 341extern pgd_t swapper_pg_dir[2048];
340extern pmd_t swapper_low_pmd_dir[2048]; 342extern pmd_t swapper_low_pmd_dir[2048];
341 343
344extern void paging_init(void);
345extern unsigned long find_ecache_flush_span(unsigned long size);
346
342/* These do nothing with the way I have things setup. */ 347/* These do nothing with the way I have things setup. */
343#define mmu_lockarea(vaddr, len) (vaddr) 348#define mmu_lockarea(vaddr, len) (vaddr)
344#define mmu_unlockarea(vaddr, len) do { } while(0) 349#define mmu_unlockarea(vaddr, len) do { } while(0)
diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
index 80a65d7e3dbf..203e8eee6351 100644
--- a/include/asm-sparc64/uaccess.h
+++ b/include/asm-sparc64/uaccess.h
@@ -70,26 +70,14 @@ static inline int access_ok(int type, const void __user * addr, unsigned long si
70 * with the main instruction path. This means when everything is well, 70 * with the main instruction path. This means when everything is well,
71 * we don't even have to jump over them. Further, they do not intrude 71 * we don't even have to jump over them. Further, they do not intrude
72 * on our cache or tlb entries. 72 * on our cache or tlb entries.
73 *
74 * There is a special way how to put a range of potentially faulting
75 * insns (like twenty ldd/std's with now intervening other instructions)
76 * You specify address of first in insn and 0 in fixup and in the next
77 * exception_table_entry you specify last potentially faulting insn + 1
78 * and in fixup the routine which should handle the fault.
79 * That fixup code will get
80 * (faulting_insn_address - first_insn_in_the_range_address)/4
81 * in %g2 (ie. index of the faulting instruction in the range).
82 */ 73 */
83 74
84struct exception_table_entry 75struct exception_table_entry {
85{ 76 unsigned int insn, fixup;
86 unsigned insn, fixup;
87}; 77};
88 78
89/* Special exable search, which handles ranges. Returns fixup */
90unsigned long search_extables_range(unsigned long addr, unsigned long *g2);
91
92extern void __ret_efault(void); 79extern void __ret_efault(void);
80extern void __retl_efault(void);
93 81
94/* Uh, these should become the main single-value transfer routines.. 82/* Uh, these should become the main single-value transfer routines..
95 * They automatically use the right size if we just have the right 83 * They automatically use the right size if we just have the right
@@ -263,7 +251,7 @@ copy_from_user(void *to, const void __user *from, unsigned long size)
263{ 251{
264 unsigned long ret = ___copy_from_user(to, from, size); 252 unsigned long ret = ___copy_from_user(to, from, size);
265 253
266 if (ret) 254 if (unlikely(ret))
267 ret = copy_from_user_fixup(to, from, size); 255 ret = copy_from_user_fixup(to, from, size);
268 return ret; 256 return ret;
269} 257}
@@ -279,7 +267,7 @@ copy_to_user(void __user *to, const void *from, unsigned long size)
279{ 267{
280 unsigned long ret = ___copy_to_user(to, from, size); 268 unsigned long ret = ___copy_to_user(to, from, size);
281 269
282 if (ret) 270 if (unlikely(ret))
283 ret = copy_to_user_fixup(to, from, size); 271 ret = copy_to_user_fixup(to, from, size);
284 return ret; 272 return ret;
285} 273}
@@ -295,7 +283,7 @@ copy_in_user(void __user *to, void __user *from, unsigned long size)
295{ 283{
296 unsigned long ret = ___copy_in_user(to, from, size); 284 unsigned long ret = ___copy_in_user(to, from, size);
297 285
298 if (ret) 286 if (unlikely(ret))
299 ret = copy_in_user_fixup(to, from, size); 287 ret = copy_in_user_fixup(to, from, size);
300 return ret; 288 return ret;
301} 289}
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h
index 2d242360c3d6..075771c371f6 100644
--- a/include/asm-um/processor-generic.h
+++ b/include/asm-um/processor-generic.h
@@ -13,6 +13,7 @@ struct task_struct;
13#include "linux/config.h" 13#include "linux/config.h"
14#include "asm/ptrace.h" 14#include "asm/ptrace.h"
15#include "choose-mode.h" 15#include "choose-mode.h"
16#include "registers.h"
16 17
17struct mm_struct; 18struct mm_struct;
18 19
@@ -136,19 +137,15 @@ extern struct cpuinfo_um cpu_data[];
136#define current_cpu_data boot_cpu_data 137#define current_cpu_data boot_cpu_data
137#endif 138#endif
138 139
139#define KSTK_EIP(tsk) (PT_REGS_IP(&tsk->thread.regs))
140#define KSTK_ESP(tsk) (PT_REGS_SP(&tsk->thread.regs))
141#define get_wchan(p) (0)
142 140
141#ifdef CONFIG_MODE_SKAS
142#define KSTK_REG(tsk, reg) \
143 ({ union uml_pt_regs regs; \
144 get_thread_regs(&regs, tsk->thread.mode.skas.switch_buf); \
145 UPT_REG(&regs, reg); })
146#else
147#define KSTK_REG(tsk, reg) (0xbadbabe)
143#endif 148#endif
149#define get_wchan(p) (0)
144 150
145/* 151#endif
146 * Overrides for Emacs so that we follow Linus's tabbing style.
147 * Emacs will notice this stuff at the end of the file and automatically
148 * adjust the settings for this buffer only. This must remain at the end
149 * of the file.
150 * ---------------------------------------------------------------------------
151 * Local variables:
152 * c-file-style: "linux"
153 * End:
154 */
diff --git a/include/asm-um/processor-i386.h b/include/asm-um/processor-i386.h
index 431bad3ae9d7..4108a579eb92 100644
--- a/include/asm-um/processor-i386.h
+++ b/include/asm-um/processor-i386.h
@@ -43,17 +43,10 @@ static inline void rep_nop(void)
43#define ARCH_IS_STACKGROW(address) \ 43#define ARCH_IS_STACKGROW(address) \
44 (address + 32 >= UPT_SP(&current->thread.regs.regs)) 44 (address + 32 >= UPT_SP(&current->thread.regs.regs))
45 45
46#define KSTK_EIP(tsk) KSTK_REG(tsk, EIP)
47#define KSTK_ESP(tsk) KSTK_REG(tsk, UESP)
48#define KSTK_EBP(tsk) KSTK_REG(tsk, EBP)
49
46#include "asm/processor-generic.h" 50#include "asm/processor-generic.h"
47 51
48#endif 52#endif
49
50/*
51 * Overrides for Emacs so that we follow Linus's tabbing style.
52 * Emacs will notice this stuff at the end of the file and automatically
53 * adjust the settings for this buffer only. This must remain at the end
54 * of the file.
55 * ---------------------------------------------------------------------------
56 * Local variables:
57 * c-file-style: "linux"
58 * End:
59 */
diff --git a/include/asm-um/processor-x86_64.h b/include/asm-um/processor-x86_64.h
index 0beb9a42ae05..e1e1255a1d36 100644
--- a/include/asm-um/processor-x86_64.h
+++ b/include/asm-um/processor-x86_64.h
@@ -36,17 +36,9 @@ extern inline void rep_nop(void)
36#define ARCH_IS_STACKGROW(address) \ 36#define ARCH_IS_STACKGROW(address) \
37 (address + 128 >= UPT_SP(&current->thread.regs.regs)) 37 (address + 128 >= UPT_SP(&current->thread.regs.regs))
38 38
39#define KSTK_EIP(tsk) KSTK_REG(tsk, RIP)
40#define KSTK_ESP(tsk) KSTK_REG(tsk, RSP)
41
39#include "asm/processor-generic.h" 42#include "asm/processor-generic.h"
40 43
41#endif 44#endif
42
43/*
44 * Overrides for Emacs so that we follow Linus's tabbing style.
45 * Emacs will notice this stuff at the end of the file and automatically
46 * adjust the settings for this buffer only. This must remain at the end
47 * of the file.
48 * ---------------------------------------------------------------------------
49 * Local variables:
50 * c-file-style: "linux"
51 * End:
52 */
diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h
index 801710d00a40..2ee028b8de9d 100644
--- a/include/asm-um/uaccess.h
+++ b/include/asm-um/uaccess.h
@@ -44,7 +44,7 @@
44 const __typeof__(ptr) __private_ptr = ptr; \ 44 const __typeof__(ptr) __private_ptr = ptr; \
45 __typeof__(*(__private_ptr)) __private_val; \ 45 __typeof__(*(__private_ptr)) __private_val; \
46 int __private_ret = -EFAULT; \ 46 int __private_ret = -EFAULT; \
47 (x) = 0; \ 47 (x) = (__typeof__(*(__private_ptr)))0; \
48 if (__copy_from_user(&__private_val, (__private_ptr), \ 48 if (__copy_from_user(&__private_val, (__private_ptr), \
49 sizeof(*(__private_ptr))) == 0) {\ 49 sizeof(*(__private_ptr))) == 0) {\
50 (x) = (__typeof__(*(__private_ptr))) __private_val; \ 50 (x) = (__typeof__(*(__private_ptr))) __private_val; \
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
index 4d727f3f5550..5a7fe3c6c3d8 100644
--- a/include/asm-x86_64/msr.h
+++ b/include/asm-x86_64/msr.h
@@ -234,6 +234,7 @@ static inline unsigned int cpuid_edx(unsigned int op)
234#define MSR_K8_TOP_MEM1 0xC001001A 234#define MSR_K8_TOP_MEM1 0xC001001A
235#define MSR_K8_TOP_MEM2 0xC001001D 235#define MSR_K8_TOP_MEM2 0xC001001D
236#define MSR_K8_SYSCFG 0xC0010010 236#define MSR_K8_SYSCFG 0xC0010010
237#define MSR_K8_HWCR 0xC0010015
237 238
238/* K6 MSRs */ 239/* K6 MSRs */
239#define MSR_K6_EFER 0xC0000080 240#define MSR_K6_EFER 0xC0000080
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 2cb483516459..dd8711ecaf2f 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -384,7 +384,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
384} 384}
385 385
386#define pte_index(address) \ 386#define pte_index(address) \
387 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 387 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
388#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ 388#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \
389 pte_index(address)) 389 pte_index(address))
390 390
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index 24e32611f0bf..c57ce4071342 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -81,6 +81,7 @@ static inline int hard_smp_processor_id(void)
81extern int safe_smp_processor_id(void); 81extern int safe_smp_processor_id(void);
82extern int __cpu_disable(void); 82extern int __cpu_disable(void);
83extern void __cpu_die(unsigned int cpu); 83extern void __cpu_die(unsigned int cpu);
84extern void prefill_possible_map(void);
84 85
85#endif /* !ASSEMBLY */ 86#endif /* !ASSEMBLY */
86 87
diff --git a/include/linux/aio.h b/include/linux/aio.h
index a4d5af907f90..60def658b246 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -43,6 +43,40 @@ struct kioctx;
43#define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags) 43#define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags)
44#define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags) 44#define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags)
45 45
46/* is there a better place to document function pointer methods? */
47/**
48 * ki_retry - iocb forward progress callback
49 * @kiocb: The kiocb struct to advance by performing an operation.
50 *
51 * This callback is called when the AIO core wants a given AIO operation
52 * to make forward progress. The kiocb argument describes the operation
53 * that is to be performed. As the operation proceeds, perhaps partially,
54 * ki_retry is expected to update the kiocb with progress made. Typically
55 * ki_retry is set in the AIO core and it itself calls file_operations
56 * helpers.
57 *
58 * ki_retry's return value determines when the AIO operation is completed
59 * and an event is generated in the AIO event ring. Except the special
60 * return values described below, the value that is returned from ki_retry
61 * is transferred directly into the completion ring as the operation's
62 * resulting status. Once this has happened ki_retry *MUST NOT* reference
63 * the kiocb pointer again.
64 *
65 * If ki_retry returns -EIOCBQUEUED it has made a promise that aio_complete()
66 * will be called on the kiocb pointer in the future. The AIO core will
67 * not ask the method again -- ki_retry must ensure forward progress.
68 * aio_complete() must be called once and only once in the future, multiple
69 * calls may result in undefined behaviour.
70 *
71 * If ki_retry returns -EIOCBRETRY it has made a promise that kick_iocb()
72 * will be called on the kiocb pointer in the future. This may happen
73 * through generic helpers that associate kiocb->ki_wait with a wait
74 * queue head that ki_retry uses via current->io_wait. It can also happen
75 * with custom tracking and manual calls to kick_iocb(), though that is
76 * discouraged. In either case, kick_iocb() must be called once and only
77 * once. ki_retry must ensure forward progress, the AIO core will wait
78 * indefinitely for kick_iocb() to be called.
79 */
46struct kiocb { 80struct kiocb {
47 struct list_head ki_run_list; 81 struct list_head ki_run_list;
48 long ki_flags; 82 long ki_flags;
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 9f374cfa1b05..e7d0593bb576 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -76,6 +76,13 @@ struct atm_dev_stats {
76 /* set interface ESI */ 76 /* set interface ESI */
77#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) 77#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
78 /* force interface ESI */ 78 /* force interface ESI */
79#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc)
80 /* register a LECS address */
81#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc)
82 /* unregister a LECS address */
83#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc)
84 /* retrieve LECS address(es) */
85
79#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) 86#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
80 /* get AAL layer statistics */ 87 /* get AAL layer statistics */
81#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) 88#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
@@ -328,6 +335,8 @@ struct atm_dev_addr {
328 struct list_head entry; /* next address */ 335 struct list_head entry; /* next address */
329}; 336};
330 337
338enum atm_addr_type_t { ATM_ADDR_LOCAL, ATM_ADDR_LECS };
339
331struct atm_dev { 340struct atm_dev {
332 const struct atmdev_ops *ops; /* device operations; NULL if unused */ 341 const struct atmdev_ops *ops; /* device operations; NULL if unused */
333 const struct atmphy_ops *phy; /* PHY operations, may be undefined */ 342 const struct atmphy_ops *phy; /* PHY operations, may be undefined */
@@ -338,6 +347,7 @@ struct atm_dev {
338 void *phy_data; /* private PHY date */ 347 void *phy_data; /* private PHY date */
339 unsigned long flags; /* device flags (ATM_DF_*) */ 348 unsigned long flags; /* device flags (ATM_DF_*) */
340 struct list_head local; /* local ATM addresses */ 349 struct list_head local; /* local ATM addresses */
350 struct list_head lecs; /* LECS ATM addresses learned via ILMI */
341 unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */ 351 unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */
342 struct atm_cirange ci_range; /* VPI/VCI range */ 352 struct atm_cirange ci_range; /* VPI/VCI range */
343 struct k_atm_dev_stats stats; /* statistics */ 353 struct k_atm_dev_stats stats; /* statistics */
@@ -457,7 +467,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
457 467
458int atm_charge(struct atm_vcc *vcc,int truesize); 468int atm_charge(struct atm_vcc *vcc,int truesize);
459struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, 469struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
460 int gfp_flags); 470 gfp_t gfp_flags);
461int atm_pcr_goal(struct atm_trafprm *tp); 471int atm_pcr_goal(struct atm_trafprm *tp);
462 472
463void vcc_release_async(struct atm_vcc *vcc, int reply); 473void vcc_release_async(struct atm_vcc *vcc, int reply);
diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h
index c1237aa92e38..8ed6dfdcd783 100644
--- a/include/linux/bfs_fs.h
+++ b/include/linux/bfs_fs.h
@@ -20,19 +20,19 @@
20 20
21/* BFS inode layout on disk */ 21/* BFS inode layout on disk */
22struct bfs_inode { 22struct bfs_inode {
23 __u16 i_ino; 23 __le16 i_ino;
24 __u16 i_unused; 24 __u16 i_unused;
25 __u32 i_sblock; 25 __le32 i_sblock;
26 __u32 i_eblock; 26 __le32 i_eblock;
27 __u32 i_eoffset; 27 __le32 i_eoffset;
28 __u32 i_vtype; 28 __le32 i_vtype;
29 __u32 i_mode; 29 __le32 i_mode;
30 __s32 i_uid; 30 __le32 i_uid;
31 __s32 i_gid; 31 __le32 i_gid;
32 __u32 i_nlink; 32 __le32 i_nlink;
33 __u32 i_atime; 33 __le32 i_atime;
34 __u32 i_mtime; 34 __le32 i_mtime;
35 __u32 i_ctime; 35 __le32 i_ctime;
36 __u32 i_padding[4]; 36 __u32 i_padding[4];
37}; 37};
38 38
@@ -41,17 +41,17 @@ struct bfs_inode {
41#define BFS_DIRS_PER_BLOCK 32 41#define BFS_DIRS_PER_BLOCK 32
42 42
43struct bfs_dirent { 43struct bfs_dirent {
44 __u16 ino; 44 __le16 ino;
45 char name[BFS_NAMELEN]; 45 char name[BFS_NAMELEN];
46}; 46};
47 47
48/* BFS superblock layout on disk */ 48/* BFS superblock layout on disk */
49struct bfs_super_block { 49struct bfs_super_block {
50 __u32 s_magic; 50 __le32 s_magic;
51 __u32 s_start; 51 __le32 s_start;
52 __u32 s_end; 52 __le32 s_end;
53 __s32 s_from; 53 __le32 s_from;
54 __s32 s_to; 54 __le32 s_to;
55 __s32 s_bfrom; 55 __s32 s_bfrom;
56 __s32 s_bto; 56 __s32 s_bto;
57 char s_fsname[6]; 57 char s_fsname[6];
@@ -66,15 +66,15 @@ struct bfs_super_block {
66#define BFS_INO2OFF(ino) \ 66#define BFS_INO2OFF(ino) \
67 ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) 67 ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
68#define BFS_NZFILESIZE(ip) \ 68#define BFS_NZFILESIZE(ip) \
69 ((cpu_to_le32((ip)->i_eoffset) + 1) - cpu_to_le32((ip)->i_sblock) * BFS_BSIZE) 69 ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE)
70 70
71#define BFS_FILESIZE(ip) \ 71#define BFS_FILESIZE(ip) \
72 ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) 72 ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
73 73
74#define BFS_FILEBLOCKS(ip) \ 74#define BFS_FILEBLOCKS(ip) \
75 ((ip)->i_sblock == 0 ? 0 : (cpu_to_le32((ip)->i_eblock) + 1) - cpu_to_le32((ip)->i_sblock)) 75 ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock))
76#define BFS_UNCLEAN(bfs_sb, sb) \ 76#define BFS_UNCLEAN(bfs_sb, sb) \
77 ((cpu_to_le32(bfs_sb->s_from) != -1) && (cpu_to_le32(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) 77 ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY))
78 78
79 79
80#endif /* _LINUX_BFS_FS_H */ 80#endif /* _LINUX_BFS_FS_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 6e1c79c8b6bf..3344b4e8e43a 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -276,8 +276,8 @@ extern void bio_pair_release(struct bio_pair *dbio);
276extern struct bio_set *bioset_create(int, int, int); 276extern struct bio_set *bioset_create(int, int, int);
277extern void bioset_free(struct bio_set *); 277extern void bioset_free(struct bio_set *);
278 278
279extern struct bio *bio_alloc(unsigned int __nocast, int); 279extern struct bio *bio_alloc(gfp_t, int);
280extern struct bio *bio_alloc_bioset(unsigned int __nocast, int, struct bio_set *); 280extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
281extern void bio_put(struct bio *); 281extern void bio_put(struct bio *);
282extern void bio_free(struct bio *, struct bio_set *); 282extern void bio_free(struct bio *, struct bio_set *);
283 283
@@ -287,7 +287,7 @@ extern int bio_phys_segments(struct request_queue *, struct bio *);
287extern int bio_hw_segments(struct request_queue *, struct bio *); 287extern int bio_hw_segments(struct request_queue *, struct bio *);
288 288
289extern void __bio_clone(struct bio *, struct bio *); 289extern void __bio_clone(struct bio *, struct bio *);
290extern struct bio *bio_clone(struct bio *, unsigned int __nocast); 290extern struct bio *bio_clone(struct bio *, gfp_t);
291 291
292extern void bio_init(struct bio *); 292extern void bio_init(struct bio *);
293 293
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 90828493791f..6a1d154c0825 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -172,7 +172,7 @@ void __brelse(struct buffer_head *);
172void __bforget(struct buffer_head *); 172void __bforget(struct buffer_head *);
173void __breadahead(struct block_device *, sector_t block, int size); 173void __breadahead(struct block_device *, sector_t block, int size);
174struct buffer_head *__bread(struct block_device *, sector_t block, int size); 174struct buffer_head *__bread(struct block_device *, sector_t block, int size);
175struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags); 175struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
176void free_buffer_head(struct buffer_head * bh); 176void free_buffer_head(struct buffer_head * bh);
177void FASTCALL(unlock_buffer(struct buffer_head *bh)); 177void FASTCALL(unlock_buffer(struct buffer_head *bh));
178void FASTCALL(__lock_buffer(struct buffer_head *bh)); 178void FASTCALL(__lock_buffer(struct buffer_head *bh));
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 86d4b0a81713..95952cc1f525 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -149,7 +149,7 @@ struct cn_dev {
149 149
150int cn_add_callback(struct cb_id *, char *, void (*callback) (void *)); 150int cn_add_callback(struct cb_id *, char *, void (*callback) (void *));
151void cn_del_callback(struct cb_id *); 151void cn_del_callback(struct cb_id *);
152int cn_netlink_send(struct cn_msg *, u32, int); 152int cn_netlink_send(struct cn_msg *, u32, gfp_t);
153 153
154int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)); 154int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
155void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 155void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 24062a1dbf61..6e2deef96b34 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -23,7 +23,7 @@ void cpuset_init_current_mems_allowed(void);
23void cpuset_update_current_mems_allowed(void); 23void cpuset_update_current_mems_allowed(void);
24void cpuset_restrict_to_mems_allowed(unsigned long *nodes); 24void cpuset_restrict_to_mems_allowed(unsigned long *nodes);
25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
26extern int cpuset_zone_allowed(struct zone *z, unsigned int __nocast gfp_mask); 26extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
27extern int cpuset_excl_nodes_overlap(const struct task_struct *p); 27extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
28extern struct file_operations proc_cpuset_operations; 28extern struct file_operations proc_cpuset_operations;
29extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 29extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
@@ -49,8 +49,7 @@ static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
49 return 1; 49 return 1;
50} 50}
51 51
52static inline int cpuset_zone_allowed(struct zone *z, 52static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
53 unsigned int __nocast gfp_mask)
54{ 53{
55 return 1; 54 return 1;
56} 55}
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h
index 4932ee5c77f0..76f12f46db7f 100644
--- a/include/linux/dmapool.h
+++ b/include/linux/dmapool.h
@@ -19,7 +19,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
19 19
20void dma_pool_destroy(struct dma_pool *pool); 20void dma_pool_destroy(struct dma_pool *pool);
21 21
22void *dma_pool_alloc(struct dma_pool *pool, unsigned int __nocast mem_flags, 22void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
23 dma_addr_t *handle); 23 dma_addr_t *handle);
24 24
25void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); 25void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 4dc990f3b5cc..3010e172394d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -85,9 +85,9 @@ static inline void arch_free_page(struct page *page, int order) { }
85#endif 85#endif
86 86
87extern struct page * 87extern struct page *
88FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *)); 88FASTCALL(__alloc_pages(gfp_t, unsigned int, struct zonelist *));
89 89
90static inline struct page *alloc_pages_node(int nid, unsigned int __nocast gfp_mask, 90static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
91 unsigned int order) 91 unsigned int order)
92{ 92{
93 if (unlikely(order >= MAX_ORDER)) 93 if (unlikely(order >= MAX_ORDER))
@@ -98,17 +98,17 @@ static inline struct page *alloc_pages_node(int nid, unsigned int __nocast gfp_m
98} 98}
99 99
100#ifdef CONFIG_NUMA 100#ifdef CONFIG_NUMA
101extern struct page *alloc_pages_current(unsigned int __nocast gfp_mask, unsigned order); 101extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
102 102
103static inline struct page * 103static inline struct page *
104alloc_pages(unsigned int __nocast gfp_mask, unsigned int order) 104alloc_pages(gfp_t gfp_mask, unsigned int order)
105{ 105{
106 if (unlikely(order >= MAX_ORDER)) 106 if (unlikely(order >= MAX_ORDER))
107 return NULL; 107 return NULL;
108 108
109 return alloc_pages_current(gfp_mask, order); 109 return alloc_pages_current(gfp_mask, order);
110} 110}
111extern struct page *alloc_page_vma(unsigned __nocast gfp_mask, 111extern struct page *alloc_page_vma(gfp_t gfp_mask,
112 struct vm_area_struct *vma, unsigned long addr); 112 struct vm_area_struct *vma, unsigned long addr);
113#else 113#else
114#define alloc_pages(gfp_mask, order) \ 114#define alloc_pages(gfp_mask, order) \
@@ -117,8 +117,8 @@ extern struct page *alloc_page_vma(unsigned __nocast gfp_mask,
117#endif 117#endif
118#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) 118#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
119 119
120extern unsigned long FASTCALL(__get_free_pages(unsigned int __nocast gfp_mask, unsigned int order)); 120extern unsigned long FASTCALL(__get_free_pages(gfp_t gfp_mask, unsigned int order));
121extern unsigned long FASTCALL(get_zeroed_page(unsigned int __nocast gfp_mask)); 121extern unsigned long FASTCALL(get_zeroed_page(gfp_t gfp_mask));
122 122
123#define __get_free_page(gfp_mask) \ 123#define __get_free_page(gfp_mask) \
124 __get_free_pages((gfp_mask),0) 124 __get_free_pages((gfp_mask),0)
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index fc2d4c8225aa..d21c305c6c64 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -111,7 +111,9 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
111 return (struct ethhdr *)skb->mac.raw; 111 return (struct ethhdr *)skb->mac.raw;
112} 112}
113 113
114#ifdef CONFIG_SYSCTL
114extern struct ctl_table ether_table[]; 115extern struct ctl_table ether_table[];
115#endif 116#endif
117#endif
116 118
117#endif /* _LINUX_IF_ETHER_H */ 119#endif /* _LINUX_IF_ETHER_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 7e1e15f934f3..fd7af86151b1 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -142,13 +142,21 @@ static __inline__ int bad_mask(u32 mask, u32 addr)
142 142
143#define endfor_ifa(in_dev) } 143#define endfor_ifa(in_dev) }
144 144
145static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev)
146{
147 struct in_device *in_dev = dev->ip_ptr;
148 if (in_dev)
149 in_dev = rcu_dereference(in_dev);
150 return in_dev;
151}
152
145static __inline__ struct in_device * 153static __inline__ struct in_device *
146in_dev_get(const struct net_device *dev) 154in_dev_get(const struct net_device *dev)
147{ 155{
148 struct in_device *in_dev; 156 struct in_device *in_dev;
149 157
150 rcu_read_lock(); 158 rcu_read_lock();
151 in_dev = dev->ip_ptr; 159 in_dev = __in_dev_get_rcu(dev);
152 if (in_dev) 160 if (in_dev)
153 atomic_inc(&in_dev->refcnt); 161 atomic_inc(&in_dev->refcnt);
154 rcu_read_unlock(); 162 rcu_read_unlock();
@@ -156,7 +164,7 @@ in_dev_get(const struct net_device *dev)
156} 164}
157 165
158static __inline__ struct in_device * 166static __inline__ struct in_device *
159__in_dev_get(const struct net_device *dev) 167__in_dev_get_rtnl(const struct net_device *dev)
160{ 168{
161 return (struct in_device*)dev->ip_ptr; 169 return (struct in_device*)dev->ip_ptr;
162} 170}
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index bb6f88e14061..e0b922785d98 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -372,8 +372,9 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
372#define inet_v6_ipv6only(__sk) 0 372#define inet_v6_ipv6only(__sk) 0
373#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 373#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
374 374
375#define INET6_MATCH(__sk, __saddr, __daddr, __ports, __dif) \ 375#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\
376 (((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 376 (((__sk)->sk_hash == (__hash)) && \
377 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \
377 ((__sk)->sk_family == AF_INET6) && \ 378 ((__sk)->sk_family == AF_INET6) && \
378 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 379 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
379 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 380 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index de097269bd7f..ff853b3173c6 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -935,7 +935,7 @@ void journal_put_journal_head(struct journal_head *jh);
935 */ 935 */
936extern kmem_cache_t *jbd_handle_cache; 936extern kmem_cache_t *jbd_handle_cache;
937 937
938static inline handle_t *jbd_alloc_handle(unsigned int __nocast gfp_flags) 938static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
939{ 939{
940 return kmem_cache_alloc(jbd_handle_cache, gfp_flags); 940 return kmem_cache_alloc(jbd_handle_cache, gfp_flags);
941} 941}
diff --git a/include/linux/key-ui.h b/include/linux/key-ui.h
index 918c34a8347e..7a2e332067c3 100644
--- a/include/linux/key-ui.h
+++ b/include/linux/key-ui.h
@@ -38,97 +38,16 @@ struct keyring_list {
38 struct key *keys[0]; 38 struct key *keys[0];
39}; 39};
40 40
41
42/* 41/*
43 * check to see whether permission is granted to use a key in the desired way 42 * check to see whether permission is granted to use a key in the desired way
44 */ 43 */
45static inline int key_permission(const key_ref_t key_ref, key_perm_t perm) 44extern int key_task_permission(const key_ref_t key_ref,
46{ 45 struct task_struct *context,
47 struct key *key = key_ref_to_ptr(key_ref); 46 key_perm_t perm);
48 key_perm_t kperm;
49
50 if (is_key_possessed(key_ref))
51 kperm = key->perm >> 24;
52 else if (key->uid == current->fsuid)
53 kperm = key->perm >> 16;
54 else if (key->gid != -1 &&
55 key->perm & KEY_GRP_ALL &&
56 in_group_p(key->gid)
57 )
58 kperm = key->perm >> 8;
59 else
60 kperm = key->perm;
61
62 kperm = kperm & perm & KEY_ALL;
63
64 return kperm == perm;
65}
66
67/*
68 * check to see whether permission is granted to use a key in at least one of
69 * the desired ways
70 */
71static inline int key_any_permission(const key_ref_t key_ref, key_perm_t perm)
72{
73 struct key *key = key_ref_to_ptr(key_ref);
74 key_perm_t kperm;
75
76 if (is_key_possessed(key_ref))
77 kperm = key->perm >> 24;
78 else if (key->uid == current->fsuid)
79 kperm = key->perm >> 16;
80 else if (key->gid != -1 &&
81 key->perm & KEY_GRP_ALL &&
82 in_group_p(key->gid)
83 )
84 kperm = key->perm >> 8;
85 else
86 kperm = key->perm;
87 47
88 kperm = kperm & perm & KEY_ALL; 48static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
89
90 return kperm != 0;
91}
92
93static inline int key_task_groups_search(struct task_struct *tsk, gid_t gid)
94{
95 int ret;
96
97 task_lock(tsk);
98 ret = groups_search(tsk->group_info, gid);
99 task_unlock(tsk);
100 return ret;
101}
102
103static inline int key_task_permission(const key_ref_t key_ref,
104 struct task_struct *context,
105 key_perm_t perm)
106{ 49{
107 struct key *key = key_ref_to_ptr(key_ref); 50 return key_task_permission(key_ref, current, perm);
108 key_perm_t kperm;
109
110 if (is_key_possessed(key_ref)) {
111 kperm = key->perm >> 24;
112 }
113 else if (key->uid == context->fsuid) {
114 kperm = key->perm >> 16;
115 }
116 else if (key->gid != -1 &&
117 key->perm & KEY_GRP_ALL && (
118 key->gid == context->fsgid ||
119 key_task_groups_search(context, key->gid)
120 )
121 ) {
122 kperm = key->perm >> 8;
123 }
124 else {
125 kperm = key->perm;
126 }
127
128 kperm = kperm & perm & KEY_ALL;
129
130 return kperm == perm;
131
132} 51}
133 52
134extern key_ref_t lookup_user_key(struct task_struct *context, 53extern key_ref_t lookup_user_key(struct task_struct *context,
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index c27cd428d269..48eccd865bd8 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -35,8 +35,8 @@ struct kfifo {
35}; 35};
36 36
37extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, 37extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,
38 unsigned int __nocast gfp_mask, spinlock_t *lock); 38 gfp_t gfp_mask, spinlock_t *lock);
39extern struct kfifo *kfifo_alloc(unsigned int size, unsigned int __nocast gfp_mask, 39extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask,
40 spinlock_t *lock); 40 spinlock_t *lock);
41extern void kfifo_free(struct kfifo *fifo); 41extern void kfifo_free(struct kfifo *fifo);
42extern unsigned int __kfifo_put(struct kfifo *fifo, 42extern unsigned int __kfifo_put(struct kfifo *fifo,
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 796220ce47cc..f2427d7394b0 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -6,7 +6,7 @@
6 6
7#include <linux/wait.h> 7#include <linux/wait.h>
8 8
9typedef void * (mempool_alloc_t)(unsigned int __nocast gfp_mask, void *pool_data); 9typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data);
10typedef void (mempool_free_t)(void *element, void *pool_data); 10typedef void (mempool_free_t)(void *element, void *pool_data);
11 11
12typedef struct mempool_s { 12typedef struct mempool_s {
@@ -26,17 +26,16 @@ extern mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
26extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn, 26extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
27 mempool_free_t *free_fn, void *pool_data, int nid); 27 mempool_free_t *free_fn, void *pool_data, int nid);
28 28
29extern int mempool_resize(mempool_t *pool, int new_min_nr, 29extern int mempool_resize(mempool_t *pool, int new_min_nr, gfp_t gfp_mask);
30 unsigned int __nocast gfp_mask);
31extern void mempool_destroy(mempool_t *pool); 30extern void mempool_destroy(mempool_t *pool);
32extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask); 31extern void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask);
33extern void mempool_free(void *element, mempool_t *pool); 32extern void mempool_free(void *element, mempool_t *pool);
34 33
35/* 34/*
36 * A mempool_alloc_t and mempool_free_t that get the memory from 35 * A mempool_alloc_t and mempool_free_t that get the memory from
37 * a slab that is passed in through pool_data. 36 * a slab that is passed in through pool_data.
38 */ 37 */
39void *mempool_alloc_slab(unsigned int __nocast gfp_mask, void *pool_data); 38void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data);
40void mempool_free_slab(void *element, void *pool_data); 39void mempool_free_slab(void *element, void *pool_data);
41 40
42#endif /* _LINUX_MEMPOOL_H */ 41#endif /* _LINUX_MEMPOOL_H */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 4ed2107bc020..2f0299a448f6 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -183,7 +183,7 @@ struct of_device_id
183 char name[32]; 183 char name[32];
184 char type[32]; 184 char type[32];
185 char compatible[128]; 185 char compatible[128];
186#if __KERNEL__ 186#ifdef __KERNEL__
187 void *data; 187 void *data;
188#else 188#else
189 kernel_ulong_t data; 189 kernel_ulong_t data;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7c717907896d..368e4c825ff1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -265,6 +265,8 @@ struct net_device
265 * the interface. 265 * the interface.
266 */ 266 */
267 char name[IFNAMSIZ]; 267 char name[IFNAMSIZ];
268 /* device name hash chain */
269 struct hlist_node name_hlist;
268 270
269 /* 271 /*
270 * I/O specific fields 272 * I/O specific fields
@@ -292,6 +294,21 @@ struct net_device
292 294
293 /* ------- Fields preinitialized in Space.c finish here ------- */ 295 /* ------- Fields preinitialized in Space.c finish here ------- */
294 296
297 /* Net device features */
298 unsigned long features;
299#define NETIF_F_SG 1 /* Scatter/gather IO. */
300#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */
301#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
302#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
303#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
304#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
305#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
306#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
307#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
308#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
309#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */
310#define NETIF_F_LLTX 4096 /* LockLess TX */
311
295 struct net_device *next_sched; 312 struct net_device *next_sched;
296 313
297 /* Interface index. Unique device identifier */ 314 /* Interface index. Unique device identifier */
@@ -316,9 +333,6 @@ struct net_device
316 * will (read: may be cleaned up at will). 333 * will (read: may be cleaned up at will).
317 */ 334 */
318 335
319 /* These may be needed for future network-power-down code. */
320 unsigned long trans_start; /* Time (in jiffies) of last Tx */
321 unsigned long last_rx; /* Time of last Rx */
322 336
323 unsigned short flags; /* interface flags (a la BSD) */ 337 unsigned short flags; /* interface flags (a la BSD) */
324 unsigned short gflags; 338 unsigned short gflags;
@@ -328,15 +342,12 @@ struct net_device
328 unsigned mtu; /* interface MTU value */ 342 unsigned mtu; /* interface MTU value */
329 unsigned short type; /* interface hardware type */ 343 unsigned short type; /* interface hardware type */
330 unsigned short hard_header_len; /* hardware hdr length */ 344 unsigned short hard_header_len; /* hardware hdr length */
331 void *priv; /* pointer to private data */
332 345
333 struct net_device *master; /* Pointer to master device of a group, 346 struct net_device *master; /* Pointer to master device of a group,
334 * which this device is member of. 347 * which this device is member of.
335 */ 348 */
336 349
337 /* Interface address info. */ 350 /* Interface address info. */
338 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
339 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */
340 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 351 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
341 unsigned char addr_len; /* hardware address length */ 352 unsigned char addr_len; /* hardware address length */
342 unsigned short dev_id; /* for shared network cards */ 353 unsigned short dev_id; /* for shared network cards */
@@ -346,8 +357,6 @@ struct net_device
346 int promiscuity; 357 int promiscuity;
347 int allmulti; 358 int allmulti;
348 359
349 int watchdog_timeo;
350 struct timer_list watchdog_timer;
351 360
352 /* Protocol specific pointers */ 361 /* Protocol specific pointers */
353 362
@@ -358,32 +367,62 @@ struct net_device
358 void *ec_ptr; /* Econet specific data */ 367 void *ec_ptr; /* Econet specific data */
359 void *ax25_ptr; /* AX.25 specific data */ 368 void *ax25_ptr; /* AX.25 specific data */
360 369
361 struct list_head poll_list; /* Link to poll list */ 370/*
371 * Cache line mostly used on receive path (including eth_type_trans())
372 */
373 struct list_head poll_list ____cacheline_aligned_in_smp;
374 /* Link to poll list */
375
376 int (*poll) (struct net_device *dev, int *quota);
362 int quota; 377 int quota;
363 int weight; 378 int weight;
379 unsigned long last_rx; /* Time of last Rx */
380 /* Interface address info used in eth_type_trans() */
381 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
382 because most packets are unicast) */
383
384 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
364 385
386/*
387 * Cache line mostly used on queue transmit path (qdisc)
388 */
389 /* device queue lock */
390 spinlock_t queue_lock ____cacheline_aligned_in_smp;
365 struct Qdisc *qdisc; 391 struct Qdisc *qdisc;
366 struct Qdisc *qdisc_sleeping; 392 struct Qdisc *qdisc_sleeping;
367 struct Qdisc *qdisc_ingress;
368 struct list_head qdisc_list; 393 struct list_head qdisc_list;
369 unsigned long tx_queue_len; /* Max frames per queue allowed */ 394 unsigned long tx_queue_len; /* Max frames per queue allowed */
370 395
371 /* ingress path synchronizer */ 396 /* ingress path synchronizer */
372 spinlock_t ingress_lock; 397 spinlock_t ingress_lock;
398 struct Qdisc *qdisc_ingress;
399
400/*
401 * One part is mostly used on xmit path (device)
402 */
373 /* hard_start_xmit synchronizer */ 403 /* hard_start_xmit synchronizer */
374 spinlock_t xmit_lock; 404 spinlock_t xmit_lock ____cacheline_aligned_in_smp;
375 /* cpu id of processor entered to hard_start_xmit or -1, 405 /* cpu id of processor entered to hard_start_xmit or -1,
376 if nobody entered there. 406 if nobody entered there.
377 */ 407 */
378 int xmit_lock_owner; 408 int xmit_lock_owner;
379 /* device queue lock */ 409 void *priv; /* pointer to private data */
380 spinlock_t queue_lock; 410 int (*hard_start_xmit) (struct sk_buff *skb,
411 struct net_device *dev);
412 /* These may be needed for future network-power-down code. */
413 unsigned long trans_start; /* Time (in jiffies) of last Tx */
414
415 int watchdog_timeo; /* used by dev_watchdog() */
416 struct timer_list watchdog_timer;
417
418/*
419 * refcnt is a very hot point, so align it on SMP
420 */
381 /* Number of references to this device */ 421 /* Number of references to this device */
382 atomic_t refcnt; 422 atomic_t refcnt ____cacheline_aligned_in_smp;
423
383 /* delayed register/unregister */ 424 /* delayed register/unregister */
384 struct list_head todo_list; 425 struct list_head todo_list;
385 /* device name hash chain */
386 struct hlist_node name_hlist;
387 /* device index hash chain */ 426 /* device index hash chain */
388 struct hlist_node index_hlist; 427 struct hlist_node index_hlist;
389 428
@@ -396,21 +435,6 @@ struct net_device
396 NETREG_RELEASED, /* called free_netdev */ 435 NETREG_RELEASED, /* called free_netdev */
397 } reg_state; 436 } reg_state;
398 437
399 /* Net device features */
400 unsigned long features;
401#define NETIF_F_SG 1 /* Scatter/gather IO. */
402#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */
403#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
404#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
405#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
406#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
407#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
408#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
409#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
410#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
411#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */
412#define NETIF_F_LLTX 4096 /* LockLess TX */
413
414 /* Called after device is detached from network. */ 438 /* Called after device is detached from network. */
415 void (*uninit)(struct net_device *dev); 439 void (*uninit)(struct net_device *dev);
416 /* Called after last user reference disappears. */ 440 /* Called after last user reference disappears. */
@@ -419,10 +443,7 @@ struct net_device
419 /* Pointers to interface service routines. */ 443 /* Pointers to interface service routines. */
420 int (*open)(struct net_device *dev); 444 int (*open)(struct net_device *dev);
421 int (*stop)(struct net_device *dev); 445 int (*stop)(struct net_device *dev);
422 int (*hard_start_xmit) (struct sk_buff *skb,
423 struct net_device *dev);
424#define HAVE_NETDEV_POLL 446#define HAVE_NETDEV_POLL
425 int (*poll) (struct net_device *dev, int *quota);
426 int (*hard_header) (struct sk_buff *skb, 447 int (*hard_header) (struct sk_buff *skb,
427 struct net_device *dev, 448 struct net_device *dev,
428 unsigned short type, 449 unsigned short type,
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index bdebdc564506..ba25ca874c20 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -131,7 +131,7 @@ extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*
131extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 131extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
132extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 132extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
133extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 133extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
134 __u32 group, unsigned int __nocast allocation); 134 __u32 group, gfp_t allocation);
135extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 135extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code);
136extern int netlink_register_notifier(struct notifier_block *nb); 136extern int netlink_register_notifier(struct notifier_block *nb);
137extern int netlink_unregister_notifier(struct notifier_block *nb); 137extern int netlink_unregister_notifier(struct notifier_block *nb);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index d9a25647a295..acbf31c154f8 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -19,7 +19,7 @@
19#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ 19#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */
20#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ 20#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */
21 21
22static inline unsigned int __nocast mapping_gfp_mask(struct address_space * mapping) 22static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
23{ 23{
24 return mapping->flags & __GFP_BITS_MASK; 24 return mapping->flags & __GFP_BITS_MASK;
25} 25}
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 68f11ac1a314..f74ed9462475 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -185,6 +185,7 @@
185#define PCI_DEVICE_ID_LSI_61C102 0x0901 185#define PCI_DEVICE_ID_LSI_61C102 0x0901
186#define PCI_DEVICE_ID_LSI_63C815 0x1000 186#define PCI_DEVICE_ID_LSI_63C815 0x1000
187#define PCI_DEVICE_ID_LSI_SAS1064 0x0050 187#define PCI_DEVICE_ID_LSI_SAS1064 0x0050
188#define PCI_DEVICE_ID_LSI_SAS1064R 0x0411
188#define PCI_DEVICE_ID_LSI_SAS1066 0x005E 189#define PCI_DEVICE_ID_LSI_SAS1066 0x005E
189#define PCI_DEVICE_ID_LSI_SAS1068 0x0054 190#define PCI_DEVICE_ID_LSI_SAS1068 0x0054
190#define PCI_DEVICE_ID_LSI_SAS1064A 0x005C 191#define PCI_DEVICE_ID_LSI_SAS1064A 0x005C
@@ -392,6 +393,7 @@
392#define PCI_DEVICE_ID_NS_87560_USB 0x0012 393#define PCI_DEVICE_ID_NS_87560_USB 0x0012
393#define PCI_DEVICE_ID_NS_83815 0x0020 394#define PCI_DEVICE_ID_NS_83815 0x0020
394#define PCI_DEVICE_ID_NS_83820 0x0022 395#define PCI_DEVICE_ID_NS_83820 0x0022
396#define PCI_DEVICE_ID_NS_SATURN 0x0035
395#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 397#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500
396#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 398#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501
397#define PCI_DEVICE_ID_NS_SCx200_IDE 0x0502 399#define PCI_DEVICE_ID_NS_SCx200_IDE 0x0502
@@ -559,6 +561,7 @@
559#define PCI_VENDOR_ID_DELL 0x1028 561#define PCI_VENDOR_ID_DELL 0x1028
560#define PCI_DEVICE_ID_DELL_RACIII 0x0008 562#define PCI_DEVICE_ID_DELL_RACIII 0x0008
561#define PCI_DEVICE_ID_DELL_RAC4 0x0012 563#define PCI_DEVICE_ID_DELL_RAC4 0x0012
564#define PCI_DEVICE_ID_DELL_PERC5 0x0015
562 565
563#define PCI_VENDOR_ID_MATROX 0x102B 566#define PCI_VENDOR_ID_MATROX 0x102B
564#define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 567#define PCI_DEVICE_ID_MATROX_MGA_2 0x0518
@@ -983,6 +986,7 @@
983#define PCI_DEVICE_ID_SUN_SABRE 0xa000 986#define PCI_DEVICE_ID_SUN_SABRE 0xa000
984#define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001 987#define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001
985#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 988#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801
989#define PCI_DEVICE_ID_SUN_CASSINI 0xabba
986 990
987#define PCI_VENDOR_ID_CMD 0x1095 991#define PCI_VENDOR_ID_CMD 0x1095
988#define PCI_DEVICE_ID_CMD_640 0x0640 992#define PCI_DEVICE_ID_CMD_640 0x0640
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index 4caedddaa033..4bc241290c24 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -71,11 +71,11 @@ posix_acl_release(struct posix_acl *acl)
71 71
72/* posix_acl.c */ 72/* posix_acl.c */
73 73
74extern struct posix_acl *posix_acl_alloc(int, unsigned int __nocast); 74extern struct posix_acl *posix_acl_alloc(int, gfp_t);
75extern struct posix_acl *posix_acl_clone(const struct posix_acl *, unsigned int __nocast); 75extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t);
76extern int posix_acl_valid(const struct posix_acl *); 76extern int posix_acl_valid(const struct posix_acl *);
77extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); 77extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
78extern struct posix_acl *posix_acl_from_mode(mode_t, unsigned int __nocast); 78extern struct posix_acl *posix_acl_from_mode(mode_t, gfp_t);
79extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *); 79extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *);
80extern int posix_acl_create_masq(struct posix_acl *, mode_t *); 80extern int posix_acl_create_masq(struct posix_acl *, mode_t *);
81extern int posix_acl_chmod_masq(struct posix_acl *, mode_t); 81extern int posix_acl_chmod_masq(struct posix_acl *, mode_t);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9c51917b1cce..045d4761febc 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -50,7 +50,7 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long);
50unsigned int 50unsigned int
51radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 51radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
52 unsigned long first_index, unsigned int max_items); 52 unsigned long first_index, unsigned int max_items);
53int radix_tree_preload(unsigned int __nocast gfp_mask); 53int radix_tree_preload(gfp_t gfp_mask);
54void radix_tree_init(void); 54void radix_tree_init(void);
55void *radix_tree_tag_set(struct radix_tree_root *root, 55void *radix_tree_tag_set(struct radix_tree_root *root,
56 unsigned long index, int tag); 56 unsigned long index, int tag);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 49e617fa0f66..27519df0f987 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -107,13 +107,25 @@ extern unsigned long nr_iowait(void);
107 107
108#include <asm/processor.h> 108#include <asm/processor.h>
109 109
110/*
111 * Task state bitmask. NOTE! These bits are also
112 * encoded in fs/proc/array.c: get_task_state().
113 *
114 * We have two separate sets of flags: task->state
115 * is about runnability, while task->exit_state are
116 * about the task exiting. Confusing, but this way
117 * modifying one set can't modify the other one by
118 * mistake.
119 */
110#define TASK_RUNNING 0 120#define TASK_RUNNING 0
111#define TASK_INTERRUPTIBLE 1 121#define TASK_INTERRUPTIBLE 1
112#define TASK_UNINTERRUPTIBLE 2 122#define TASK_UNINTERRUPTIBLE 2
113#define TASK_STOPPED 4 123#define TASK_STOPPED 4
114#define TASK_TRACED 8 124#define TASK_TRACED 8
125/* in tsk->exit_state */
115#define EXIT_ZOMBIE 16 126#define EXIT_ZOMBIE 16
116#define EXIT_DEAD 32 127#define EXIT_DEAD 32
128/* in tsk->state again */
117#define TASK_NONINTERACTIVE 64 129#define TASK_NONINTERACTIVE 64
118 130
119#define __set_task_state(tsk, state_value) \ 131#define __set_task_state(tsk, state_value) \
@@ -1006,6 +1018,7 @@ extern int force_sig_info(int, struct siginfo *, struct task_struct *);
1006extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); 1018extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp);
1007extern int kill_pg_info(int, struct siginfo *, pid_t); 1019extern int kill_pg_info(int, struct siginfo *, pid_t);
1008extern int kill_proc_info(int, struct siginfo *, pid_t); 1020extern int kill_proc_info(int, struct siginfo *, pid_t);
1021extern int kill_proc_info_as_uid(int, struct siginfo *, pid_t, uid_t, uid_t);
1009extern void do_notify_parent(struct task_struct *, int); 1022extern void do_notify_parent(struct task_struct *, int);
1010extern void force_sig(int, struct task_struct *); 1023extern void force_sig(int, struct task_struct *);
1011extern void force_sig_specific(int, struct task_struct *); 1024extern void force_sig_specific(int, struct task_struct *);
diff --git a/include/linux/security.h b/include/linux/security.h
index 0e43460d374e..627382e74057 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -2634,8 +2634,7 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o
2634 return security_ops->socket_getpeersec(sock, optval, optlen, len); 2634 return security_ops->socket_getpeersec(sock, optval, optlen, len);
2635} 2635}
2636 2636
2637static inline int security_sk_alloc(struct sock *sk, int family, 2637static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2638 unsigned int __nocast priority)
2639{ 2638{
2640 return security_ops->sk_alloc_security(sk, family, priority); 2639 return security_ops->sk_alloc_security(sk, family, priority);
2641} 2640}
@@ -2752,8 +2751,7 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o
2752 return -ENOPROTOOPT; 2751 return -ENOPROTOOPT;
2753} 2752}
2754 2753
2755static inline int security_sk_alloc(struct sock *sk, int family, 2754static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2756 unsigned int __nocast priority)
2757{ 2755{
2758 return 0; 2756 return 0;
2759} 2757}
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2741c0c55e83..8f5d9e7f8734 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -155,8 +155,6 @@ struct skb_shared_info {
155#define SKB_DATAREF_SHIFT 16 155#define SKB_DATAREF_SHIFT 16
156#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) 156#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
157 157
158extern struct timeval skb_tv_base;
159
160struct skb_timeval { 158struct skb_timeval {
161 u32 off_sec; 159 u32 off_sec;
162 u32 off_usec; 160 u32 off_usec;
@@ -175,7 +173,7 @@ enum {
175 * @prev: Previous buffer in list 173 * @prev: Previous buffer in list
176 * @list: List we are on 174 * @list: List we are on
177 * @sk: Socket we are owned by 175 * @sk: Socket we are owned by
178 * @tstamp: Time we arrived stored as offset to skb_tv_base 176 * @tstamp: Time we arrived
179 * @dev: Device we arrived on/are leaving by 177 * @dev: Device we arrived on/are leaving by
180 * @input_dev: Device we arrived on 178 * @input_dev: Device we arrived on
181 * @h: Transport layer header 179 * @h: Transport layer header
@@ -304,37 +302,37 @@ struct sk_buff {
304 302
305extern void __kfree_skb(struct sk_buff *skb); 303extern void __kfree_skb(struct sk_buff *skb);
306extern struct sk_buff *__alloc_skb(unsigned int size, 304extern struct sk_buff *__alloc_skb(unsigned int size,
307 unsigned int __nocast priority, int fclone); 305 gfp_t priority, int fclone);
308static inline struct sk_buff *alloc_skb(unsigned int size, 306static inline struct sk_buff *alloc_skb(unsigned int size,
309 unsigned int __nocast priority) 307 gfp_t priority)
310{ 308{
311 return __alloc_skb(size, priority, 0); 309 return __alloc_skb(size, priority, 0);
312} 310}
313 311
314static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 312static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
315 unsigned int __nocast priority) 313 gfp_t priority)
316{ 314{
317 return __alloc_skb(size, priority, 1); 315 return __alloc_skb(size, priority, 1);
318} 316}
319 317
320extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 318extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
321 unsigned int size, 319 unsigned int size,
322 unsigned int __nocast priority); 320 gfp_t priority);
323extern void kfree_skbmem(struct sk_buff *skb); 321extern void kfree_skbmem(struct sk_buff *skb);
324extern struct sk_buff *skb_clone(struct sk_buff *skb, 322extern struct sk_buff *skb_clone(struct sk_buff *skb,
325 unsigned int __nocast priority); 323 gfp_t priority);
326extern struct sk_buff *skb_copy(const struct sk_buff *skb, 324extern struct sk_buff *skb_copy(const struct sk_buff *skb,
327 unsigned int __nocast priority); 325 gfp_t priority);
328extern struct sk_buff *pskb_copy(struct sk_buff *skb, 326extern struct sk_buff *pskb_copy(struct sk_buff *skb,
329 unsigned int __nocast gfp_mask); 327 gfp_t gfp_mask);
330extern int pskb_expand_head(struct sk_buff *skb, 328extern int pskb_expand_head(struct sk_buff *skb,
331 int nhead, int ntail, 329 int nhead, int ntail,
332 unsigned int __nocast gfp_mask); 330 gfp_t gfp_mask);
333extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 331extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
334 unsigned int headroom); 332 unsigned int headroom);
335extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 333extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
336 int newheadroom, int newtailroom, 334 int newheadroom, int newtailroom,
337 unsigned int __nocast priority); 335 gfp_t priority);
338extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); 336extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad);
339#define dev_kfree_skb(a) kfree_skb(a) 337#define dev_kfree_skb(a) kfree_skb(a)
340extern void skb_over_panic(struct sk_buff *skb, int len, 338extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -486,7 +484,7 @@ static inline int skb_shared(const struct sk_buff *skb)
486 * NULL is returned on a memory allocation failure. 484 * NULL is returned on a memory allocation failure.
487 */ 485 */
488static inline struct sk_buff *skb_share_check(struct sk_buff *skb, 486static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
489 unsigned int __nocast pri) 487 gfp_t pri)
490{ 488{
491 might_sleep_if(pri & __GFP_WAIT); 489 might_sleep_if(pri & __GFP_WAIT);
492 if (skb_shared(skb)) { 490 if (skb_shared(skb)) {
@@ -518,7 +516,7 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
518 * %NULL is returned on a memory allocation failure. 516 * %NULL is returned on a memory allocation failure.
519 */ 517 */
520static inline struct sk_buff *skb_unshare(struct sk_buff *skb, 518static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
521 unsigned int __nocast pri) 519 gfp_t pri)
522{ 520{
523 might_sleep_if(pri & __GFP_WAIT); 521 might_sleep_if(pri & __GFP_WAIT);
524 if (skb_cloned(skb)) { 522 if (skb_cloned(skb)) {
@@ -1019,7 +1017,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1019 * %NULL is returned in there is no free memory. 1017 * %NULL is returned in there is no free memory.
1020 */ 1018 */
1021static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1019static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1022 unsigned int __nocast gfp_mask) 1020 gfp_t gfp_mask)
1023{ 1021{
1024 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); 1022 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
1025 if (likely(skb)) 1023 if (likely(skb))
@@ -1132,8 +1130,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1132 * If there is no free memory -ENOMEM is returned, otherwise zero 1130 * If there is no free memory -ENOMEM is returned, otherwise zero
1133 * is returned and the old skb data released. 1131 * is returned and the old skb data released.
1134 */ 1132 */
1135extern int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp); 1133extern int __skb_linearize(struct sk_buff *skb, gfp_t gfp);
1136static inline int skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp) 1134static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp)
1137{ 1135{
1138 return __skb_linearize(skb, gfp); 1136 return __skb_linearize(skb, gfp);
1139} 1137}
@@ -1255,10 +1253,6 @@ static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *
1255{ 1253{
1256 stamp->tv_sec = skb->tstamp.off_sec; 1254 stamp->tv_sec = skb->tstamp.off_sec;
1257 stamp->tv_usec = skb->tstamp.off_usec; 1255 stamp->tv_usec = skb->tstamp.off_usec;
1258 if (skb->tstamp.off_sec) {
1259 stamp->tv_sec += skb_tv_base.tv_sec;
1260 stamp->tv_usec += skb_tv_base.tv_usec;
1261 }
1262} 1256}
1263 1257
1264/** 1258/**
@@ -1272,8 +1266,8 @@ static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *
1272 */ 1266 */
1273static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp) 1267static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp)
1274{ 1268{
1275 skb->tstamp.off_sec = stamp->tv_sec - skb_tv_base.tv_sec; 1269 skb->tstamp.off_sec = stamp->tv_sec;
1276 skb->tstamp.off_usec = stamp->tv_usec - skb_tv_base.tv_usec; 1270 skb->tstamp.off_usec = stamp->tv_usec;
1277} 1271}
1278 1272
1279extern void __net_timestamp(struct sk_buff *skb); 1273extern void __net_timestamp(struct sk_buff *skb);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1f356f3bbc64..5fc04a16ecb0 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -61,11 +61,11 @@ extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned lo
61 void (*)(void *, kmem_cache_t *, unsigned long)); 61 void (*)(void *, kmem_cache_t *, unsigned long));
62extern int kmem_cache_destroy(kmem_cache_t *); 62extern int kmem_cache_destroy(kmem_cache_t *);
63extern int kmem_cache_shrink(kmem_cache_t *); 63extern int kmem_cache_shrink(kmem_cache_t *);
64extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast); 64extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t);
65extern void kmem_cache_free(kmem_cache_t *, void *); 65extern void kmem_cache_free(kmem_cache_t *, void *);
66extern unsigned int kmem_cache_size(kmem_cache_t *); 66extern unsigned int kmem_cache_size(kmem_cache_t *);
67extern const char *kmem_cache_name(kmem_cache_t *); 67extern const char *kmem_cache_name(kmem_cache_t *);
68extern kmem_cache_t *kmem_find_general_cachep(size_t size, unsigned int __nocast gfpflags); 68extern kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags);
69 69
70/* Size description struct for general caches. */ 70/* Size description struct for general caches. */
71struct cache_sizes { 71struct cache_sizes {
@@ -74,9 +74,9 @@ struct cache_sizes {
74 kmem_cache_t *cs_dmacachep; 74 kmem_cache_t *cs_dmacachep;
75}; 75};
76extern struct cache_sizes malloc_sizes[]; 76extern struct cache_sizes malloc_sizes[];
77extern void *__kmalloc(size_t, unsigned int __nocast); 77extern void *__kmalloc(size_t, gfp_t);
78 78
79static inline void *kmalloc(size_t size, unsigned int __nocast flags) 79static inline void *kmalloc(size_t size, gfp_t flags)
80{ 80{
81 if (__builtin_constant_p(size)) { 81 if (__builtin_constant_p(size)) {
82 int i = 0; 82 int i = 0;
@@ -99,7 +99,7 @@ found:
99 return __kmalloc(size, flags); 99 return __kmalloc(size, flags);
100} 100}
101 101
102extern void *kzalloc(size_t, unsigned int __nocast); 102extern void *kzalloc(size_t, gfp_t);
103 103
104/** 104/**
105 * kcalloc - allocate memory for an array. The memory is set to zero. 105 * kcalloc - allocate memory for an array. The memory is set to zero.
@@ -107,7 +107,7 @@ extern void *kzalloc(size_t, unsigned int __nocast);
107 * @size: element size. 107 * @size: element size.
108 * @flags: the type of memory to allocate. 108 * @flags: the type of memory to allocate.
109 */ 109 */
110static inline void *kcalloc(size_t n, size_t size, unsigned int __nocast flags) 110static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
111{ 111{
112 if (n != 0 && size > INT_MAX / n) 112 if (n != 0 && size > INT_MAX / n)
113 return NULL; 113 return NULL;
@@ -118,15 +118,14 @@ extern void kfree(const void *);
118extern unsigned int ksize(const void *); 118extern unsigned int ksize(const void *);
119 119
120#ifdef CONFIG_NUMA 120#ifdef CONFIG_NUMA
121extern void *kmem_cache_alloc_node(kmem_cache_t *, 121extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
122 unsigned int __nocast flags, int node); 122extern void *kmalloc_node(size_t size, gfp_t flags, int node);
123extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node);
124#else 123#else
125static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) 124static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node)
126{ 125{
127 return kmem_cache_alloc(cachep, flags); 126 return kmem_cache_alloc(cachep, flags);
128} 127}
129static inline void *kmalloc_node(size_t size, unsigned int __nocast flags, int node) 128static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
130{ 129{
131 return kmalloc(size, flags); 130 return kmalloc(size, flags);
132} 131}
diff --git a/include/linux/string.h b/include/linux/string.h
index dab2652acbd8..369be3264a55 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -88,7 +88,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
88extern void * memchr(const void *,int,__kernel_size_t); 88extern void * memchr(const void *,int,__kernel_size_t);
89#endif 89#endif
90 90
91extern char *kstrdup(const char *s, unsigned int __nocast gfp); 91extern char *kstrdup(const char *s, gfp_t gfp);
92 92
93#ifdef __cplusplus 93#ifdef __cplusplus
94} 94}
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index f2e96fdfaae0..ad15a54806d8 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -71,5 +71,7 @@ void restore_processor_state(void);
71struct saved_context; 71struct saved_context;
72void __save_processor_state(struct saved_context *ctxt); 72void __save_processor_state(struct saved_context *ctxt);
73void __restore_processor_state(struct saved_context *ctxt); 73void __restore_processor_state(struct saved_context *ctxt);
74extern unsigned long get_usable_page(unsigned gfp_mask);
75extern void free_eaten_memory(void);
74 76
75#endif /* _LINUX_SWSUSP_H */ 77#endif /* _LINUX_SWSUSP_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 3c9ff0048153..a7bf1a3b1496 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -147,7 +147,7 @@ struct swap_list_t {
147#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) 147#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
148 148
149/* linux/mm/oom_kill.c */ 149/* linux/mm/oom_kill.c */
150extern void out_of_memory(unsigned int __nocast gfp_mask, int order); 150extern void out_of_memory(gfp_t gfp_mask, int order);
151 151
152/* linux/mm/memory.c */ 152/* linux/mm/memory.c */
153extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 153extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h
index 081b1ee8516e..e21937cf91d0 100644
--- a/include/linux/tc_ematch/tc_em_meta.h
+++ b/include/linux/tc_ematch/tc_em_meta.h
@@ -71,7 +71,7 @@ enum
71 TCF_META_ID_SK_SNDBUF, 71 TCF_META_ID_SK_SNDBUF,
72 TCF_META_ID_SK_ALLOCS, 72 TCF_META_ID_SK_ALLOCS,
73 TCF_META_ID_SK_ROUTE_CAPS, 73 TCF_META_ID_SK_ROUTE_CAPS,
74 TCF_META_ID_SK_HASHENT, 74 TCF_META_ID_SK_HASH,
75 TCF_META_ID_SK_LINGERTIME, 75 TCF_META_ID_SK_LINGERTIME,
76 TCF_META_ID_SK_ACK_BACKLOG, 76 TCF_META_ID_SK_ACK_BACKLOG,
77 TCF_META_ID_SK_MAX_ACK_BACKLOG, 77 TCF_META_ID_SK_MAX_ACK_BACKLOG,
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
index 941f45ac117a..515046d1b2f4 100644
--- a/include/linux/textsearch.h
+++ b/include/linux/textsearch.h
@@ -158,7 +158,8 @@ extern unsigned int textsearch_find_continuous(struct ts_config *,
158#define TS_PRIV_ALIGNTO 8 158#define TS_PRIV_ALIGNTO 8
159#define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) 159#define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1))
160 160
161static inline struct ts_config *alloc_ts_config(size_t payload, int gfp_mask) 161static inline struct ts_config *alloc_ts_config(size_t payload,
162 gfp_t gfp_mask)
162{ 163{
163 struct ts_config *conf; 164 struct ts_config *conf;
164 165
diff --git a/include/linux/types.h b/include/linux/types.h
index 2b678c22ca4a..0aee34f9da9f 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -165,6 +165,10 @@ typedef __u64 __bitwise __le64;
165typedef __u64 __bitwise __be64; 165typedef __u64 __bitwise __be64;
166#endif 166#endif
167 167
168#ifdef __KERNEL__
169typedef unsigned __nocast gfp_t;
170#endif
171
168struct ustat { 172struct ustat {
169 __kernel_daddr_t f_tfree; 173 __kernel_daddr_t f_tfree;
170 __kernel_ino_t f_tinode; 174 __kernel_ino_t f_tinode;
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index b244f69ef682..3701a0673d2c 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -34,8 +34,8 @@ struct vm_struct {
34extern void *vmalloc(unsigned long size); 34extern void *vmalloc(unsigned long size);
35extern void *vmalloc_exec(unsigned long size); 35extern void *vmalloc_exec(unsigned long size);
36extern void *vmalloc_32(unsigned long size); 36extern void *vmalloc_32(unsigned long size);
37extern void *__vmalloc(unsigned long size, unsigned int __nocast gfp_mask, pgprot_t prot); 37extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
38extern void *__vmalloc_area(struct vm_struct *area, unsigned int __nocast gfp_mask, pgprot_t prot); 38extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot);
39extern void vfree(void *addr); 39extern void vfree(void *addr);
40 40
41extern void *vmap(struct page **pages, unsigned int count, 41extern void *vmap(struct page **pages, unsigned int count,
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 6dfa4a61ffd0..210458624840 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -136,7 +136,7 @@ struct bt_skb_cb {
136}; 136};
137#define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) 137#define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb))
138 138
139static inline struct sk_buff *bt_skb_alloc(unsigned int len, unsigned int __nocast how) 139static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
140{ 140{
141 struct sk_buff *skb; 141 struct sk_buff *skb;
142 142
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index ffea9d54071f..fbe557f7ea1d 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -230,7 +230,7 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
230 u8 xon_char, u8 xoff_char, u16 param_mask); 230 u8 xon_char, u8 xoff_char, u16 param_mask);
231 231
232/* ---- RFCOMM DLCs (channels) ---- */ 232/* ---- RFCOMM DLCs (channels) ---- */
233struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio); 233struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio);
234void rfcomm_dlc_free(struct rfcomm_dlc *d); 234void rfcomm_dlc_free(struct rfcomm_dlc *d);
235int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel); 235int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel);
236int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); 236int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index 6bbeafa73e8b..1ba03be0af3a 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -19,9 +19,9 @@ extern void dn_nsp_send_data_ack(struct sock *sk);
19extern void dn_nsp_send_oth_ack(struct sock *sk); 19extern void dn_nsp_send_oth_ack(struct sock *sk);
20extern void dn_nsp_delayed_ack(struct sock *sk); 20extern void dn_nsp_delayed_ack(struct sock *sk);
21extern void dn_send_conn_ack(struct sock *sk); 21extern void dn_send_conn_ack(struct sock *sk);
22extern void dn_send_conn_conf(struct sock *sk, int gfp); 22extern void dn_send_conn_conf(struct sock *sk, gfp_t gfp);
23extern void dn_nsp_send_disc(struct sock *sk, unsigned char type, 23extern void dn_nsp_send_disc(struct sock *sk, unsigned char type,
24 unsigned short reason, int gfp); 24 unsigned short reason, gfp_t gfp);
25extern void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type, 25extern void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type,
26 unsigned short reason); 26 unsigned short reason);
27extern void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval); 27extern void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval);
@@ -29,14 +29,14 @@ extern void dn_nsp_send_conninit(struct sock *sk, unsigned char flags);
29 29
30extern void dn_nsp_output(struct sock *sk); 30extern void dn_nsp_output(struct sock *sk);
31extern int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum); 31extern int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum);
32extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, int gfp, int oob); 32extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp, int oob);
33extern unsigned long dn_nsp_persist(struct sock *sk); 33extern unsigned long dn_nsp_persist(struct sock *sk);
34extern int dn_nsp_xmit_timeout(struct sock *sk); 34extern int dn_nsp_xmit_timeout(struct sock *sk);
35 35
36extern int dn_nsp_rx(struct sk_buff *); 36extern int dn_nsp_rx(struct sk_buff *);
37extern int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 37extern int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
38 38
39extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri); 39extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
40extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock, long timeo, int *err); 40extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock, long timeo, int *err);
41 41
42#define NSP_REASON_OK 0 /* No error */ 42#define NSP_REASON_OK 0 /* No error */
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index d084721db198..5122da3f2eb3 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -15,7 +15,7 @@
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16*******************************************************************************/ 16*******************************************************************************/
17 17
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri); 18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); 19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags);
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
21extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); 21extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 03df3b157960..5a2beed5a770 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -26,19 +26,18 @@
26struct inet_hashinfo; 26struct inet_hashinfo;
27 27
28/* I have no idea if this is a good hash for v6 or not. -DaveM */ 28/* I have no idea if this is a good hash for v6 or not. -DaveM */
29static inline int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, 29static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport,
30 const struct in6_addr *faddr, const u16 fport, 30 const struct in6_addr *faddr, const u16 fport)
31 const int ehash_size)
32{ 31{
33 int hashent = (lport ^ fport); 32 unsigned int hashent = (lport ^ fport);
34 33
35 hashent ^= (laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); 34 hashent ^= (laddr->s6_addr32[3] ^ faddr->s6_addr32[3]);
36 hashent ^= hashent >> 16; 35 hashent ^= hashent >> 16;
37 hashent ^= hashent >> 8; 36 hashent ^= hashent >> 8;
38 return (hashent & (ehash_size - 1)); 37 return hashent;
39} 38}
40 39
41static inline int inet6_sk_ehashfn(const struct sock *sk, const int ehash_size) 40static inline int inet6_sk_ehashfn(const struct sock *sk)
42{ 41{
43 const struct inet_sock *inet = inet_sk(sk); 42 const struct inet_sock *inet = inet_sk(sk);
44 const struct ipv6_pinfo *np = inet6_sk(sk); 43 const struct ipv6_pinfo *np = inet6_sk(sk);
@@ -46,7 +45,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk, const int ehash_size)
46 const struct in6_addr *faddr = &np->daddr; 45 const struct in6_addr *faddr = &np->daddr;
47 const __u16 lport = inet->num; 46 const __u16 lport = inet->num;
48 const __u16 fport = inet->dport; 47 const __u16 fport = inet->dport;
49 return inet6_ehashfn(laddr, lport, faddr, fport, ehash_size); 48 return inet6_ehashfn(laddr, lport, faddr, fport);
50} 49}
51 50
52/* 51/*
@@ -69,14 +68,14 @@ static inline struct sock *
69 /* Optimize here for direct hit, only listening connections can 68 /* Optimize here for direct hit, only listening connections can
70 * have wildcards anyways. 69 * have wildcards anyways.
71 */ 70 */
72 const int hash = inet6_ehashfn(daddr, hnum, saddr, sport, 71 unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport);
73 hashinfo->ehash_size); 72 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
74 struct inet_ehash_bucket *head = &hashinfo->ehash[hash];
75 73
74 prefetch(head->chain.first);
76 read_lock(&head->lock); 75 read_lock(&head->lock);
77 sk_for_each(sk, node, &head->chain) { 76 sk_for_each(sk, node, &head->chain) {
78 /* For IPV6 do the cheaper port and family tests first. */ 77 /* For IPV6 do the cheaper port and family tests first. */
79 if (INET6_MATCH(sk, saddr, daddr, ports, dif)) 78 if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif))
80 goto hit; /* You sunk my battleship! */ 79 goto hit; /* You sunk my battleship! */
81 } 80 }
82 /* Must check for a TIME_WAIT'er before going to listener hash. */ 81 /* Must check for a TIME_WAIT'er before going to listener hash. */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 651f824c1008..b0c99060b78d 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -94,7 +94,7 @@ static inline void *inet_csk_ca(const struct sock *sk)
94 94
95extern struct sock *inet_csk_clone(struct sock *sk, 95extern struct sock *inet_csk_clone(struct sock *sk,
96 const struct request_sock *req, 96 const struct request_sock *req,
97 const unsigned int __nocast priority); 97 const gfp_t priority);
98 98
99enum inet_csk_ack_state_t { 99enum inet_csk_ack_state_t {
100 ICSK_ACK_SCHED = 1, 100 ICSK_ACK_SCHED = 1,
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 646b6ea7fe26..f50f95968340 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -40,7 +40,7 @@
40struct inet_ehash_bucket { 40struct inet_ehash_bucket {
41 rwlock_t lock; 41 rwlock_t lock;
42 struct hlist_head chain; 42 struct hlist_head chain;
43} __attribute__((__aligned__(8))); 43};
44 44
45/* There are a few simple rules, which allow for local port reuse by 45/* There are a few simple rules, which allow for local port reuse by
46 * an application. In essence: 46 * an application. In essence:
@@ -108,7 +108,7 @@ struct inet_hashinfo {
108 struct inet_bind_hashbucket *bhash; 108 struct inet_bind_hashbucket *bhash;
109 109
110 int bhash_size; 110 int bhash_size;
111 int ehash_size; 111 unsigned int ehash_size;
112 112
113 /* All sockets in TCP_LISTEN state will be in here. This is the only 113 /* All sockets in TCP_LISTEN state will be in here. This is the only
114 * table where wildcard'd TCP sockets can exist. Hash function here 114 * table where wildcard'd TCP sockets can exist. Hash function here
@@ -130,17 +130,16 @@ struct inet_hashinfo {
130 int port_rover; 130 int port_rover;
131}; 131};
132 132
133static inline int inet_ehashfn(const __u32 laddr, const __u16 lport, 133static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
134 const __u32 faddr, const __u16 fport, 134 const __u32 faddr, const __u16 fport)
135 const int ehash_size)
136{ 135{
137 int h = (laddr ^ lport) ^ (faddr ^ fport); 136 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport);
138 h ^= h >> 16; 137 h ^= h >> 16;
139 h ^= h >> 8; 138 h ^= h >> 8;
140 return h & (ehash_size - 1); 139 return h;
141} 140}
142 141
143static inline int inet_sk_ehashfn(const struct sock *sk, const int ehash_size) 142static inline int inet_sk_ehashfn(const struct sock *sk)
144{ 143{
145 const struct inet_sock *inet = inet_sk(sk); 144 const struct inet_sock *inet = inet_sk(sk);
146 const __u32 laddr = inet->rcv_saddr; 145 const __u32 laddr = inet->rcv_saddr;
@@ -148,7 +147,14 @@ static inline int inet_sk_ehashfn(const struct sock *sk, const int ehash_size)
148 const __u32 faddr = inet->daddr; 147 const __u32 faddr = inet->daddr;
149 const __u16 fport = inet->dport; 148 const __u16 fport = inet->dport;
150 149
151 return inet_ehashfn(laddr, lport, faddr, fport, ehash_size); 150 return inet_ehashfn(laddr, lport, faddr, fport);
151}
152
153static inline struct inet_ehash_bucket *inet_ehash_bucket(
154 struct inet_hashinfo *hashinfo,
155 unsigned int hash)
156{
157 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)];
152} 158}
153 159
154extern struct inet_bind_bucket * 160extern struct inet_bind_bucket *
@@ -235,9 +241,11 @@ static inline void __inet_hash(struct inet_hashinfo *hashinfo,
235 lock = &hashinfo->lhash_lock; 241 lock = &hashinfo->lhash_lock;
236 inet_listen_wlock(hashinfo); 242 inet_listen_wlock(hashinfo);
237 } else { 243 } else {
238 sk->sk_hashent = inet_sk_ehashfn(sk, hashinfo->ehash_size); 244 struct inet_ehash_bucket *head;
239 list = &hashinfo->ehash[sk->sk_hashent].chain; 245 sk->sk_hash = inet_sk_ehashfn(sk);
240 lock = &hashinfo->ehash[sk->sk_hashent].lock; 246 head = inet_ehash_bucket(hashinfo, sk->sk_hash);
247 list = &head->chain;
248 lock = &head->lock;
241 write_lock(lock); 249 write_lock(lock);
242 } 250 }
243 __sk_add_node(sk, list); 251 __sk_add_node(sk, list);
@@ -268,9 +276,8 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk)
268 inet_listen_wlock(hashinfo); 276 inet_listen_wlock(hashinfo);
269 lock = &hashinfo->lhash_lock; 277 lock = &hashinfo->lhash_lock;
270 } else { 278 } else {
271 struct inet_ehash_bucket *head = &hashinfo->ehash[sk->sk_hashent]; 279 lock = &inet_ehash_bucket(hashinfo, sk->sk_hash)->lock;
272 lock = &head->lock; 280 write_lock_bh(lock);
273 write_lock_bh(&head->lock);
274 } 281 }
275 282
276 if (__sk_del_node_init(sk)) 283 if (__sk_del_node_init(sk))
@@ -337,23 +344,27 @@ sherry_cache:
337#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 344#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
338 const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr)); 345 const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr));
339#endif /* __BIG_ENDIAN */ 346#endif /* __BIG_ENDIAN */
340#define INET_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\ 347#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
341 (((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 348 (((__sk)->sk_hash == (__hash)) && \
349 ((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
342 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 350 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \
343 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 351 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
344#define INET_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\ 352#define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
345 (((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 353 (((__sk)->sk_hash == (__hash)) && \
354 ((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
346 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 355 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
347 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 356 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
348#else /* 32-bit arch */ 357#else /* 32-bit arch */
349#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 358#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
350#define INET_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif) \ 359#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
351 ((inet_sk(__sk)->daddr == (__saddr)) && \ 360 (((__sk)->sk_hash == (__hash)) && \
361 (inet_sk(__sk)->daddr == (__saddr)) && \
352 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 362 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
353 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 363 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \
354 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 364 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
355#define INET_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif) \ 365#define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
356 ((inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 366 (((__sk)->sk_hash == (__hash)) && \
367 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
357 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 368 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
358 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 369 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
359 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 370 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
@@ -378,18 +389,19 @@ static inline struct sock *
378 /* Optimize here for direct hit, only listening connections can 389 /* Optimize here for direct hit, only listening connections can
379 * have wildcards anyways. 390 * have wildcards anyways.
380 */ 391 */
381 const int hash = inet_ehashfn(daddr, hnum, saddr, sport, hashinfo->ehash_size); 392 unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport);
382 struct inet_ehash_bucket *head = &hashinfo->ehash[hash]; 393 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
383 394
395 prefetch(head->chain.first);
384 read_lock(&head->lock); 396 read_lock(&head->lock);
385 sk_for_each(sk, node, &head->chain) { 397 sk_for_each(sk, node, &head->chain) {
386 if (INET_MATCH(sk, acookie, saddr, daddr, ports, dif)) 398 if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
387 goto hit; /* You sunk my battleship! */ 399 goto hit; /* You sunk my battleship! */
388 } 400 }
389 401
390 /* Must check for a TIME_WAIT'er before going to listener hash. */ 402 /* Must check for a TIME_WAIT'er before going to listener hash. */
391 sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) { 403 sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) {
392 if (INET_TW_MATCH(sk, acookie, saddr, daddr, ports, dif)) 404 if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
393 goto hit; 405 goto hit;
394 } 406 }
395 sk = NULL; 407 sk = NULL;
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 3b070352e869..4ade56ef3a4d 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -112,6 +112,7 @@ struct inet_timewait_sock {
112#define tw_node __tw_common.skc_node 112#define tw_node __tw_common.skc_node
113#define tw_bind_node __tw_common.skc_bind_node 113#define tw_bind_node __tw_common.skc_bind_node
114#define tw_refcnt __tw_common.skc_refcnt 114#define tw_refcnt __tw_common.skc_refcnt
115#define tw_hash __tw_common.skc_hash
115#define tw_prot __tw_common.skc_prot 116#define tw_prot __tw_common.skc_prot
116 volatile unsigned char tw_substate; 117 volatile unsigned char tw_substate;
117 /* 3 bits hole, try to pack */ 118 /* 3 bits hole, try to pack */
@@ -126,7 +127,6 @@ struct inet_timewait_sock {
126 /* And these are ours. */ 127 /* And these are ours. */
127 __u8 tw_ipv6only:1; 128 __u8 tw_ipv6only:1;
128 /* 31 bits hole, try to pack */ 129 /* 31 bits hole, try to pack */
129 int tw_hashent;
130 int tw_timeout; 130 int tw_timeout;
131 unsigned long tw_ttd; 131 unsigned long tw_ttd;
132 struct inet_bind_bucket *tw_tb; 132 struct inet_bind_bucket *tw_tb;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 06b4235aa016..3b5559a023a4 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -832,7 +832,7 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
832 832
833extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff **pskb); 833extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff **pskb);
834extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff **pskb); 834extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff **pskb);
835extern int ip_vs_skb_replace(struct sk_buff *skb, int pri, 835extern int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
836 char *o_buf, int o_len, char *n_buf, int n_len); 836 char *o_buf, int o_len, char *n_buf, int n_len);
837extern int ip_vs_app_init(void); 837extern int ip_vs_app_init(void);
838extern void ip_vs_app_cleanup(void); 838extern void ip_vs_app_cleanup(void);
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index 54852ff6033b..00730d21b522 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -93,7 +93,7 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb)
93 return skb->cb[sizeof(skb->cb) - 1]; 93 return skb->cb[sizeof(skb->cb) - 1];
94} 94}
95 95
96extern struct sock *llc_sk_alloc(int family, unsigned int __nocast priority, 96extern struct sock *llc_sk_alloc(int family, gfp_t priority,
97 struct proto *prot); 97 struct proto *prot);
98extern void llc_sk_free(struct sock *sk); 98extern void llc_sk_free(struct sock *sk);
99 99
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index e1d5ec1c23c0..8f241216f46b 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -125,7 +125,7 @@
125 */ 125 */
126extern struct sock *sctp_get_ctl_sock(void); 126extern struct sock *sctp_get_ctl_sock(void);
127extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, 127extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
128 sctp_scope_t, unsigned int __nocast gfp, 128 sctp_scope_t, gfp_t gfp,
129 int flags); 129 int flags);
130extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 130extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
131extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 131extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 58462164d960..1eac3d0eb7a9 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -181,17 +181,17 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t,
181int sctp_chunk_iif(const struct sctp_chunk *); 181int sctp_chunk_iif(const struct sctp_chunk *);
182struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *, 182struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *,
183 struct sctp_chunk *, 183 struct sctp_chunk *,
184 unsigned int __nocast gfp); 184 gfp_t gfp);
185__u32 sctp_generate_verification_tag(void); 185__u32 sctp_generate_verification_tag(void);
186void sctp_populate_tie_tags(__u8 *cookie, __u32 curTag, __u32 hisTag); 186void sctp_populate_tie_tags(__u8 *cookie, __u32 curTag, __u32 hisTag);
187 187
188/* Prototypes for chunk-building functions. */ 188/* Prototypes for chunk-building functions. */
189struct sctp_chunk *sctp_make_init(const struct sctp_association *, 189struct sctp_chunk *sctp_make_init(const struct sctp_association *,
190 const struct sctp_bind_addr *, 190 const struct sctp_bind_addr *,
191 unsigned int __nocast gfp, int vparam_len); 191 gfp_t gfp, int vparam_len);
192struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *, 192struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *,
193 const struct sctp_chunk *, 193 const struct sctp_chunk *,
194 const unsigned int __nocast gfp, 194 const gfp_t gfp,
195 const int unkparam_len); 195 const int unkparam_len);
196struct sctp_chunk *sctp_make_cookie_echo(const struct sctp_association *, 196struct sctp_chunk *sctp_make_cookie_echo(const struct sctp_association *,
197 const struct sctp_chunk *); 197 const struct sctp_chunk *);
@@ -265,7 +265,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
265 struct sctp_endpoint *, 265 struct sctp_endpoint *,
266 struct sctp_association *asoc, 266 struct sctp_association *asoc,
267 void *event_arg, 267 void *event_arg,
268 unsigned int __nocast gfp); 268 gfp_t gfp);
269 269
270/* 2nd level prototypes */ 270/* 2nd level prototypes */
271void sctp_generate_t3_rtx_event(unsigned long peer); 271void sctp_generate_t3_rtx_event(unsigned long peer);
@@ -276,7 +276,7 @@ void sctp_ootb_pkt_free(struct sctp_packet *);
276struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *, 276struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *,
277 const struct sctp_association *, 277 const struct sctp_association *,
278 struct sctp_chunk *, 278 struct sctp_chunk *,
279 unsigned int __nocast gfp, int *err, 279 gfp_t gfp, int *err,
280 struct sctp_chunk **err_chk_p); 280 struct sctp_chunk **err_chk_p);
281int sctp_addip_addr_config(struct sctp_association *, sctp_param_t, 281int sctp_addip_addr_config(struct sctp_association *, sctp_param_t,
282 struct sockaddr_storage*, int); 282 struct sockaddr_storage*, int);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 994009bbe3b4..9c385b6417c7 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -446,7 +446,7 @@ struct sctp_ssnmap {
446}; 446};
447 447
448struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, 448struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
449 unsigned int __nocast gfp); 449 gfp_t gfp);
450void sctp_ssnmap_free(struct sctp_ssnmap *map); 450void sctp_ssnmap_free(struct sctp_ssnmap *map);
451void sctp_ssnmap_clear(struct sctp_ssnmap *map); 451void sctp_ssnmap_clear(struct sctp_ssnmap *map);
452 452
@@ -947,7 +947,7 @@ struct sctp_transport {
947}; 947};
948 948
949struct sctp_transport *sctp_transport_new(const union sctp_addr *, 949struct sctp_transport *sctp_transport_new(const union sctp_addr *,
950 unsigned int __nocast); 950 gfp_t);
951void sctp_transport_set_owner(struct sctp_transport *, 951void sctp_transport_set_owner(struct sctp_transport *,
952 struct sctp_association *); 952 struct sctp_association *);
953void sctp_transport_route(struct sctp_transport *, union sctp_addr *, 953void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
@@ -1095,10 +1095,10 @@ void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
1095void sctp_bind_addr_free(struct sctp_bind_addr *); 1095void sctp_bind_addr_free(struct sctp_bind_addr *);
1096int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 1096int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
1097 const struct sctp_bind_addr *src, 1097 const struct sctp_bind_addr *src,
1098 sctp_scope_t scope, unsigned int __nocast gfp, 1098 sctp_scope_t scope, gfp_t gfp,
1099 int flags); 1099 int flags);
1100int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, 1100int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
1101 unsigned int __nocast gfp); 1101 gfp_t gfp);
1102int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); 1102int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
1103int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, 1103int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
1104 struct sctp_sock *); 1104 struct sctp_sock *);
@@ -1108,9 +1108,9 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
1108 struct sctp_sock *opt); 1108 struct sctp_sock *opt);
1109union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, 1109union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
1110 int *addrs_len, 1110 int *addrs_len,
1111 unsigned int __nocast gfp); 1111 gfp_t gfp);
1112int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len, 1112int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
1113 __u16 port, unsigned int __nocast gfp); 1113 __u16 port, gfp_t gfp);
1114 1114
1115sctp_scope_t sctp_scope(const union sctp_addr *); 1115sctp_scope_t sctp_scope(const union sctp_addr *);
1116int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); 1116int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope);
@@ -1239,7 +1239,7 @@ static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
1239} 1239}
1240 1240
1241/* These are function signatures for manipulating endpoints. */ 1241/* These are function signatures for manipulating endpoints. */
1242struct sctp_endpoint *sctp_endpoint_new(struct sock *, unsigned int __nocast); 1242struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t);
1243void sctp_endpoint_free(struct sctp_endpoint *); 1243void sctp_endpoint_free(struct sctp_endpoint *);
1244void sctp_endpoint_put(struct sctp_endpoint *); 1244void sctp_endpoint_put(struct sctp_endpoint *);
1245void sctp_endpoint_hold(struct sctp_endpoint *); 1245void sctp_endpoint_hold(struct sctp_endpoint *);
@@ -1260,7 +1260,7 @@ int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t,
1260 struct sctp_chunk **err_chunk); 1260 struct sctp_chunk **err_chunk);
1261int sctp_process_init(struct sctp_association *, sctp_cid_t cid, 1261int sctp_process_init(struct sctp_association *, sctp_cid_t cid,
1262 const union sctp_addr *peer, 1262 const union sctp_addr *peer,
1263 sctp_init_chunk_t *init, unsigned int __nocast gfp); 1263 sctp_init_chunk_t *init, gfp_t gfp);
1264__u32 sctp_generate_tag(const struct sctp_endpoint *); 1264__u32 sctp_generate_tag(const struct sctp_endpoint *);
1265__u32 sctp_generate_tsn(const struct sctp_endpoint *); 1265__u32 sctp_generate_tsn(const struct sctp_endpoint *);
1266 1266
@@ -1723,7 +1723,7 @@ static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)
1723 1723
1724struct sctp_association * 1724struct sctp_association *
1725sctp_association_new(const struct sctp_endpoint *, const struct sock *, 1725sctp_association_new(const struct sctp_endpoint *, const struct sock *,
1726 sctp_scope_t scope, unsigned int __nocast gfp); 1726 sctp_scope_t scope, gfp_t gfp);
1727void sctp_association_free(struct sctp_association *); 1727void sctp_association_free(struct sctp_association *);
1728void sctp_association_put(struct sctp_association *); 1728void sctp_association_put(struct sctp_association *);
1729void sctp_association_hold(struct sctp_association *); 1729void sctp_association_hold(struct sctp_association *);
@@ -1739,7 +1739,7 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
1739 const union sctp_addr *laddr); 1739 const union sctp_addr *laddr);
1740struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, 1740struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
1741 const union sctp_addr *address, 1741 const union sctp_addr *address,
1742 const unsigned int __nocast gfp, 1742 const gfp_t gfp,
1743 const int peer_state); 1743 const int peer_state);
1744void sctp_assoc_del_peer(struct sctp_association *asoc, 1744void sctp_assoc_del_peer(struct sctp_association *asoc,
1745 const union sctp_addr *addr); 1745 const union sctp_addr *addr);
@@ -1764,10 +1764,10 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned);
1764void sctp_assoc_set_primary(struct sctp_association *, 1764void sctp_assoc_set_primary(struct sctp_association *,
1765 struct sctp_transport *); 1765 struct sctp_transport *);
1766int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, 1766int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *,
1767 unsigned int __nocast); 1767 gfp_t);
1768int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, 1768int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
1769 struct sctp_cookie*, 1769 struct sctp_cookie*,
1770 unsigned int __nocast gfp); 1770 gfp_t gfp);
1771 1771
1772int sctp_cmp_addr_exact(const union sctp_addr *ss1, 1772int sctp_cmp_addr_exact(const union sctp_addr *ss1,
1773 const union sctp_addr *ss2); 1773 const union sctp_addr *ss2);
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 90fe4bf6754f..6c40cfc4832d 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -88,7 +88,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
88 __u16 error, 88 __u16 error,
89 __u16 outbound, 89 __u16 outbound,
90 __u16 inbound, 90 __u16 inbound,
91 unsigned int __nocast gfp); 91 gfp_t gfp);
92 92
93struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( 93struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
94 const struct sctp_association *asoc, 94 const struct sctp_association *asoc,
@@ -96,35 +96,35 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
96 int flags, 96 int flags,
97 int state, 97 int state,
98 int error, 98 int error,
99 unsigned int __nocast gfp); 99 gfp_t gfp);
100 100
101struct sctp_ulpevent *sctp_ulpevent_make_remote_error( 101struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
102 const struct sctp_association *asoc, 102 const struct sctp_association *asoc,
103 struct sctp_chunk *chunk, 103 struct sctp_chunk *chunk,
104 __u16 flags, 104 __u16 flags,
105 unsigned int __nocast gfp); 105 gfp_t gfp);
106struct sctp_ulpevent *sctp_ulpevent_make_send_failed( 106struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
107 const struct sctp_association *asoc, 107 const struct sctp_association *asoc,
108 struct sctp_chunk *chunk, 108 struct sctp_chunk *chunk,
109 __u16 flags, 109 __u16 flags,
110 __u32 error, 110 __u32 error,
111 unsigned int __nocast gfp); 111 gfp_t gfp);
112 112
113struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( 113struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
114 const struct sctp_association *asoc, 114 const struct sctp_association *asoc,
115 __u16 flags, 115 __u16 flags,
116 unsigned int __nocast gfp); 116 gfp_t gfp);
117 117
118struct sctp_ulpevent *sctp_ulpevent_make_pdapi( 118struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
119 const struct sctp_association *asoc, 119 const struct sctp_association *asoc,
120 __u32 indication, unsigned int __nocast gfp); 120 __u32 indication, gfp_t gfp);
121 121
122struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication( 122struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication(
123 const struct sctp_association *asoc, unsigned int __nocast gfp); 123 const struct sctp_association *asoc, gfp_t gfp);
124 124
125struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, 125struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
126 struct sctp_chunk *chunk, 126 struct sctp_chunk *chunk,
127 unsigned int __nocast gfp); 127 gfp_t gfp);
128 128
129void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, 129void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
130 struct msghdr *); 130 struct msghdr *);
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index 1a60c6d943c1..a43c8788b650 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -62,22 +62,19 @@ struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *,
62void sctp_ulpq_free(struct sctp_ulpq *); 62void sctp_ulpq_free(struct sctp_ulpq *);
63 63
64/* Add a new DATA chunk for processing. */ 64/* Add a new DATA chunk for processing. */
65int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, 65int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
66 unsigned int __nocast);
67 66
68/* Add a new event for propagation to the ULP. */ 67/* Add a new event for propagation to the ULP. */
69int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev); 68int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev);
70 69
71/* Renege previously received chunks. */ 70/* Renege previously received chunks. */
72void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, 71void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
73 unsigned int __nocast);
74 72
75/* Perform partial delivery. */ 73/* Perform partial delivery. */
76void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, 74void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
77 unsigned int __nocast);
78 75
79/* Abort the partial delivery. */ 76/* Abort the partial delivery. */
80void sctp_ulpq_abort_pd(struct sctp_ulpq *, unsigned int __nocast); 77void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t);
81 78
82/* Clear the partial data delivery condition on this socket. */ 79/* Clear the partial data delivery condition on this socket. */
83int sctp_clear_pd(struct sock *sk); 80int sctp_clear_pd(struct sock *sk);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index f6328aeddcce..1c5f19f995ad 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -103,16 +103,20 @@ enum sctp_optname {
103#define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM 103#define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM
104 SCTP_SOCKOPT_PEELOFF, /* peel off association. */ 104 SCTP_SOCKOPT_PEELOFF, /* peel off association. */
105#define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF 105#define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF
106 SCTP_GET_PEER_ADDRS_NUM, /* Get number of peer addresss. */ 106 SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */
107#define SCTP_GET_PEER_ADDRS_NUM SCTP_GET_PEER_ADDRS_NUM 107#define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD
108 SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */
109#define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD
110 SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */
111#define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD
112 SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */
113#define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD
114 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
115#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
108 SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */ 116 SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */
109#define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS 117#define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS
110 SCTP_GET_LOCAL_ADDRS_NUM, /* Get number of local addresss. */
111#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM
112 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ 118 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */
113#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS 119#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
114 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
115#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
116}; 120};
117 121
118/* 122/*
@@ -239,7 +243,7 @@ struct sctp_paddr_change {
239 int spc_state; 243 int spc_state;
240 int spc_error; 244 int spc_error;
241 sctp_assoc_t spc_assoc_id; 245 sctp_assoc_t spc_assoc_id;
242}; 246} __attribute__((packed, aligned(4)));
243 247
244/* 248/*
245 * spc_state: 32 bits (signed integer) 249 * spc_state: 32 bits (signed integer)
@@ -464,7 +468,7 @@ struct sctp_assocparams {
464struct sctp_setpeerprim { 468struct sctp_setpeerprim {
465 sctp_assoc_t sspp_assoc_id; 469 sctp_assoc_t sspp_assoc_id;
466 struct sockaddr_storage sspp_addr; 470 struct sockaddr_storage sspp_addr;
467}; 471} __attribute__((packed, aligned(4)));
468 472
469/* 473/*
470 * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) 474 * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
@@ -477,7 +481,7 @@ struct sctp_setpeerprim {
477struct sctp_prim { 481struct sctp_prim {
478 sctp_assoc_t ssp_assoc_id; 482 sctp_assoc_t ssp_assoc_id;
479 struct sockaddr_storage ssp_addr; 483 struct sockaddr_storage ssp_addr;
480}; 484} __attribute__((packed, aligned(4)));
481 485
482/* 486/*
483 * 7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER) 487 * 7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER)
@@ -504,7 +508,7 @@ struct sctp_paddrparams {
504 struct sockaddr_storage spp_address; 508 struct sockaddr_storage spp_address;
505 __u32 spp_hbinterval; 509 __u32 spp_hbinterval;
506 __u16 spp_pathmaxrxt; 510 __u16 spp_pathmaxrxt;
507}; 511} __attribute__((packed, aligned(4)));
508 512
509/* 513/*
510 * 7.2.2 Peer Address Information 514 * 7.2.2 Peer Address Information
@@ -523,7 +527,7 @@ struct sctp_paddrinfo {
523 __u32 spinfo_srtt; 527 __u32 spinfo_srtt;
524 __u32 spinfo_rto; 528 __u32 spinfo_rto;
525 __u32 spinfo_mtu; 529 __u32 spinfo_mtu;
526}; 530} __attribute__((packed, aligned(4)));
527 531
528/* Peer addresses's state. */ 532/* Peer addresses's state. */
529enum sctp_spinfo_state { 533enum sctp_spinfo_state {
@@ -559,11 +563,16 @@ struct sctp_status {
559 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement 563 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
560 * sctp_getpaddrs() and sctp_getladdrs() API. 564 * sctp_getpaddrs() and sctp_getladdrs() API.
561 */ 565 */
562struct sctp_getaddrs { 566struct sctp_getaddrs_old {
563 sctp_assoc_t assoc_id; 567 sctp_assoc_t assoc_id;
564 int addr_num; 568 int addr_num;
565 struct sockaddr __user *addrs; 569 struct sockaddr __user *addrs;
566}; 570};
571struct sctp_getaddrs {
572 sctp_assoc_t assoc_id; /*input*/
573 __u32 addr_num; /*output*/
574 __u8 addrs[0]; /*output, variable size*/
575};
567 576
568/* These are bit fields for msghdr->msg_flags. See section 5.1. */ 577/* These are bit fields for msghdr->msg_flags. See section 5.1. */
569/* On user space Linux, these live in <bits/socket.h> as an enum. */ 578/* On user space Linux, these live in <bits/socket.h> as an enum. */
diff --git a/include/net/sock.h b/include/net/sock.h
index 8c48fbecb7cf..ecb75526cba0 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -99,6 +99,7 @@ struct proto;
99 * @skc_node: main hash linkage for various protocol lookup tables 99 * @skc_node: main hash linkage for various protocol lookup tables
100 * @skc_bind_node: bind hash linkage for various protocol lookup tables 100 * @skc_bind_node: bind hash linkage for various protocol lookup tables
101 * @skc_refcnt: reference count 101 * @skc_refcnt: reference count
102 * @skc_hash: hash value used with various protocol lookup tables
102 * @skc_prot: protocol handlers inside a network family 103 * @skc_prot: protocol handlers inside a network family
103 * 104 *
104 * This is the minimal network layer representation of sockets, the header 105 * This is the minimal network layer representation of sockets, the header
@@ -112,6 +113,7 @@ struct sock_common {
112 struct hlist_node skc_node; 113 struct hlist_node skc_node;
113 struct hlist_node skc_bind_node; 114 struct hlist_node skc_bind_node;
114 atomic_t skc_refcnt; 115 atomic_t skc_refcnt;
116 unsigned int skc_hash;
115 struct proto *skc_prot; 117 struct proto *skc_prot;
116}; 118};
117 119
@@ -139,7 +141,6 @@ struct sock_common {
139 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 141 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
140 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 142 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
141 * @sk_lingertime: %SO_LINGER l_linger setting 143 * @sk_lingertime: %SO_LINGER l_linger setting
142 * @sk_hashent: hash entry in several tables (e.g. inet_hashinfo.ehash)
143 * @sk_backlog: always used with the per-socket spinlock held 144 * @sk_backlog: always used with the per-socket spinlock held
144 * @sk_callback_lock: used with the callbacks in the end of this struct 145 * @sk_callback_lock: used with the callbacks in the end of this struct
145 * @sk_error_queue: rarely used 146 * @sk_error_queue: rarely used
@@ -186,6 +187,7 @@ struct sock {
186#define sk_node __sk_common.skc_node 187#define sk_node __sk_common.skc_node
187#define sk_bind_node __sk_common.skc_bind_node 188#define sk_bind_node __sk_common.skc_bind_node
188#define sk_refcnt __sk_common.skc_refcnt 189#define sk_refcnt __sk_common.skc_refcnt
190#define sk_hash __sk_common.skc_hash
189#define sk_prot __sk_common.skc_prot 191#define sk_prot __sk_common.skc_prot
190 unsigned char sk_shutdown : 2, 192 unsigned char sk_shutdown : 2,
191 sk_no_check : 2, 193 sk_no_check : 2,
@@ -208,7 +210,6 @@ struct sock {
208 unsigned int sk_allocation; 210 unsigned int sk_allocation;
209 int sk_sndbuf; 211 int sk_sndbuf;
210 int sk_route_caps; 212 int sk_route_caps;
211 int sk_hashent;
212 unsigned long sk_flags; 213 unsigned long sk_flags;
213 unsigned long sk_lingertime; 214 unsigned long sk_lingertime;
214 /* 215 /*
@@ -738,18 +739,18 @@ extern void FASTCALL(release_sock(struct sock *sk));
738#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 739#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
739 740
740extern struct sock *sk_alloc(int family, 741extern struct sock *sk_alloc(int family,
741 unsigned int __nocast priority, 742 gfp_t priority,
742 struct proto *prot, int zero_it); 743 struct proto *prot, int zero_it);
743extern void sk_free(struct sock *sk); 744extern void sk_free(struct sock *sk);
744extern struct sock *sk_clone(const struct sock *sk, 745extern struct sock *sk_clone(const struct sock *sk,
745 const unsigned int __nocast priority); 746 const gfp_t priority);
746 747
747extern struct sk_buff *sock_wmalloc(struct sock *sk, 748extern struct sk_buff *sock_wmalloc(struct sock *sk,
748 unsigned long size, int force, 749 unsigned long size, int force,
749 unsigned int __nocast priority); 750 gfp_t priority);
750extern struct sk_buff *sock_rmalloc(struct sock *sk, 751extern struct sk_buff *sock_rmalloc(struct sock *sk,
751 unsigned long size, int force, 752 unsigned long size, int force,
752 unsigned int __nocast priority); 753 gfp_t priority);
753extern void sock_wfree(struct sk_buff *skb); 754extern void sock_wfree(struct sk_buff *skb);
754extern void sock_rfree(struct sk_buff *skb); 755extern void sock_rfree(struct sk_buff *skb);
755 756
@@ -765,7 +766,7 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk,
765 int noblock, 766 int noblock,
766 int *errcode); 767 int *errcode);
767extern void *sock_kmalloc(struct sock *sk, int size, 768extern void *sock_kmalloc(struct sock *sk, int size,
768 unsigned int __nocast priority); 769 gfp_t priority);
769extern void sock_kfree_s(struct sock *sk, void *mem, int size); 770extern void sock_kfree_s(struct sock *sk, void *mem, int size);
770extern void sk_send_sigurg(struct sock *sk); 771extern void sk_send_sigurg(struct sock *sk);
771 772
@@ -1200,7 +1201,7 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
1200 1201
1201static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, 1202static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1202 int size, int mem, 1203 int size, int mem,
1203 unsigned int __nocast gfp) 1204 gfp_t gfp)
1204{ 1205{
1205 struct sk_buff *skb; 1206 struct sk_buff *skb;
1206 int hdr_len; 1207 int hdr_len;
@@ -1223,7 +1224,7 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1223 1224
1224static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk, 1225static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk,
1225 int size, 1226 int size,
1226 unsigned int __nocast gfp) 1227 gfp_t gfp)
1227{ 1228{
1228 return sk_stream_alloc_pskb(sk, size, 0, gfp); 1229 return sk_stream_alloc_pskb(sk, size, 0, gfp);
1229} 1230}
@@ -1254,7 +1255,7 @@ static inline int sock_writeable(const struct sock *sk)
1254 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2); 1255 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2);
1255} 1256}
1256 1257
1257static inline unsigned int __nocast gfp_any(void) 1258static inline gfp_t gfp_any(void)
1258{ 1259{
1259 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; 1260 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
1260} 1261}
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 97af77c4d096..c24339c4e310 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -460,8 +460,7 @@ extern void tcp_send_probe0(struct sock *);
460extern void tcp_send_partial(struct sock *); 460extern void tcp_send_partial(struct sock *);
461extern int tcp_write_wakeup(struct sock *); 461extern int tcp_write_wakeup(struct sock *);
462extern void tcp_send_fin(struct sock *sk); 462extern void tcp_send_fin(struct sock *sk);
463extern void tcp_send_active_reset(struct sock *sk, 463extern void tcp_send_active_reset(struct sock *sk, gfp_t priority);
464 unsigned int __nocast priority);
465extern int tcp_send_synack(struct sock *); 464extern int tcp_send_synack(struct sock *);
466extern void tcp_push_one(struct sock *, unsigned int mss_now); 465extern void tcp_push_one(struct sock *, unsigned int mss_now);
467extern void tcp_send_ack(struct sock *sk); 466extern void tcp_send_ack(struct sock *sk);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index a9d0d8c5dfbf..5beae1ccd574 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -875,7 +875,7 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig
875} 875}
876#endif 876#endif
877 877
878struct xfrm_policy *xfrm_policy_alloc(int gfp); 878struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
879extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); 879extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *);
880int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 880int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
881struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel, 881struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel,
@@ -931,4 +931,9 @@ static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,
931 } 931 }
932} 932}
933 933
934static inline int xfrm_policy_id2dir(u32 index)
935{
936 return index & 7;
937}
938
934#endif /* _NET_XFRM_H */ 939#endif /* _NET_XFRM_H */
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 0e293fe733b0..4172e6841e3d 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -596,7 +596,7 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
596 u32 remote_qpn, u16 pkey_index, 596 u32 remote_qpn, u16 pkey_index,
597 struct ib_ah *ah, int rmpp_active, 597 struct ib_ah *ah, int rmpp_active,
598 int hdr_len, int data_len, 598 int hdr_len, int data_len,
599 unsigned int __nocast gfp_mask); 599 gfp_t gfp_mask);
600 600
601/** 601/**
602 * ib_free_send_mad - Returns data buffers used to send a MAD. 602 * ib_free_send_mad - Returns data buffers used to send a MAD.
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index a7555c800ecf..f404fe21cc21 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -285,7 +285,7 @@ void ib_sa_cancel_query(int id, struct ib_sa_query *query);
285int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, 285int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
286 struct ib_sa_path_rec *rec, 286 struct ib_sa_path_rec *rec,
287 ib_sa_comp_mask comp_mask, 287 ib_sa_comp_mask comp_mask,
288 int timeout_ms, unsigned int __nocast gfp_mask, 288 int timeout_ms, gfp_t gfp_mask,
289 void (*callback)(int status, 289 void (*callback)(int status,
290 struct ib_sa_path_rec *resp, 290 struct ib_sa_path_rec *resp,
291 void *context), 291 void *context),
@@ -296,7 +296,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
296 u8 method, 296 u8 method,
297 struct ib_sa_mcmember_rec *rec, 297 struct ib_sa_mcmember_rec *rec,
298 ib_sa_comp_mask comp_mask, 298 ib_sa_comp_mask comp_mask,
299 int timeout_ms, unsigned int __nocast gfp_mask, 299 int timeout_ms, gfp_t gfp_mask,
300 void (*callback)(int status, 300 void (*callback)(int status,
301 struct ib_sa_mcmember_rec *resp, 301 struct ib_sa_mcmember_rec *resp,
302 void *context), 302 void *context),
@@ -307,7 +307,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num,
307 u8 method, 307 u8 method,
308 struct ib_sa_service_rec *rec, 308 struct ib_sa_service_rec *rec,
309 ib_sa_comp_mask comp_mask, 309 ib_sa_comp_mask comp_mask,
310 int timeout_ms, unsigned int __nocast gfp_mask, 310 int timeout_ms, gfp_t gfp_mask,
311 void (*callback)(int status, 311 void (*callback)(int status,
312 struct ib_sa_service_rec *resp, 312 struct ib_sa_service_rec *resp,
313 void *context), 313 void *context),
@@ -342,7 +342,7 @@ static inline int
342ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, 342ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
343 struct ib_sa_mcmember_rec *rec, 343 struct ib_sa_mcmember_rec *rec,
344 ib_sa_comp_mask comp_mask, 344 ib_sa_comp_mask comp_mask,
345 int timeout_ms, unsigned int __nocast gfp_mask, 345 int timeout_ms, gfp_t gfp_mask,
346 void (*callback)(int status, 346 void (*callback)(int status,
347 struct ib_sa_mcmember_rec *resp, 347 struct ib_sa_mcmember_rec *resp,
348 void *context), 348 void *context),
@@ -384,7 +384,7 @@ static inline int
384ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, 384ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num,
385 struct ib_sa_mcmember_rec *rec, 385 struct ib_sa_mcmember_rec *rec,
386 ib_sa_comp_mask comp_mask, 386 ib_sa_comp_mask comp_mask,
387 int timeout_ms, unsigned int __nocast gfp_mask, 387 int timeout_ms, gfp_t gfp_mask,
388 void (*callback)(int status, 388 void (*callback)(int status,
389 struct ib_sa_mcmember_rec *resp, 389 struct ib_sa_mcmember_rec *resp,
390 void *context), 390 void *context),
diff --git a/include/rxrpc/call.h b/include/rxrpc/call.h
index f48f27e9e0ab..b86f83743510 100644
--- a/include/rxrpc/call.h
+++ b/include/rxrpc/call.h
@@ -203,7 +203,7 @@ extern int rxrpc_call_write_data(struct rxrpc_call *call,
203 size_t sioc, 203 size_t sioc,
204 struct kvec *siov, 204 struct kvec *siov,
205 uint8_t rxhdr_flags, 205 uint8_t rxhdr_flags,
206 int alloc_flags, 206 gfp_t alloc_flags,
207 int dup_data, 207 int dup_data,
208 size_t *size_sent); 208 size_t *size_sent);
209 209
diff --git a/include/rxrpc/message.h b/include/rxrpc/message.h
index 3a59df6870b2..b318f273d4f2 100644
--- a/include/rxrpc/message.h
+++ b/include/rxrpc/message.h
@@ -63,7 +63,7 @@ extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
63 uint8_t type, 63 uint8_t type,
64 int count, 64 int count,
65 struct kvec *diov, 65 struct kvec *diov,
66 int alloc_flags, 66 gfp_t alloc_flags,
67 struct rxrpc_message **_msg); 67 struct rxrpc_message **_msg);
68 68
69extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg); 69extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index c0e4c67d836f..7ece05666feb 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -163,6 +163,7 @@ struct scsi_target {
163 unsigned int id; /* target id ... replace 163 unsigned int id; /* target id ... replace
164 * scsi_device.id eventually */ 164 * scsi_device.id eventually */
165 unsigned long create:1; /* signal that it needs to be added */ 165 unsigned long create:1; /* signal that it needs to be added */
166 char scsi_level;
166 void *hostdata; /* available to low-level driver */ 167 void *hostdata; /* available to low-level driver */
167 unsigned long starget_data[0]; /* for the transport */ 168 unsigned long starget_data[0]; /* for the transport */
168 /* starget_data must be the last element!!!! */ 169 /* starget_data must be the last element!!!! */
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 2857cf0472df..d11f34832a97 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -527,6 +527,8 @@ struct _snd_ac97 {
527 struct device dev; 527 struct device dev;
528}; 528};
529 529
530#define to_ac97_t(d) container_of(d, struct _snd_ac97, dev)
531
530/* conditions */ 532/* conditions */
531static inline int ac97_is_audio(ac97_t * ac97) 533static inline int ac97_is_audio(ac97_t * ac97)
532{ 534{
diff --git a/include/sound/core.h b/include/sound/core.h
index 26160adcdffc..6d971a4c4ca0 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -290,13 +290,13 @@ void snd_memory_init(void);
290void snd_memory_done(void); 290void snd_memory_done(void);
291int snd_memory_info_init(void); 291int snd_memory_info_init(void);
292int snd_memory_info_done(void); 292int snd_memory_info_done(void);
293void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags); 293void *snd_hidden_kmalloc(size_t size, gfp_t flags);
294void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags); 294void *snd_hidden_kzalloc(size_t size, gfp_t flags);
295void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags); 295void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags);
296void snd_hidden_kfree(const void *obj); 296void snd_hidden_kfree(const void *obj);
297void *snd_hidden_vmalloc(unsigned long size); 297void *snd_hidden_vmalloc(unsigned long size);
298void snd_hidden_vfree(void *obj); 298void snd_hidden_vfree(void *obj);
299char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags); 299char *snd_hidden_kstrdup(const char *s, gfp_t flags);
300#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) 300#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
301#define kzalloc(size, flags) snd_hidden_kzalloc(size, flags) 301#define kzalloc(size, flags) snd_hidden_kzalloc(size, flags)
302#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) 302#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
diff --git a/include/sound/driver.h b/include/sound/driver.h
index 0d12456ec3ae..1ec2fae050a6 100644
--- a/include/sound/driver.h
+++ b/include/sound/driver.h
@@ -51,7 +51,7 @@
51#ifdef CONFIG_SND_DEBUG_MEMORY 51#ifdef CONFIG_SND_DEBUG_MEMORY
52#include <linux/slab.h> 52#include <linux/slab.h>
53#include <linux/vmalloc.h> 53#include <linux/vmalloc.h>
54void *snd_wrapper_kmalloc(size_t, unsigned int __nocast); 54void *snd_wrapper_kmalloc(size_t, gfp_t);
55#undef kmalloc 55#undef kmalloc
56void snd_wrapper_kfree(const void *); 56void snd_wrapper_kfree(const void *);
57#undef kfree 57#undef kfree
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 67bf3f18e96a..14cb2718cb77 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1059,7 +1059,7 @@ typedef struct {
1059 unsigned char spk71; /* Has 7.1 speakers */ 1059 unsigned char spk71; /* Has 7.1 speakers */
1060 unsigned char sblive51; /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */ 1060 unsigned char sblive51; /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */
1061 unsigned char spdif_bug; /* Has Spdif phasing bug */ 1061 unsigned char spdif_bug; /* Has Spdif phasing bug */
1062 unsigned char ac97_chip; /* Has an AC97 chip */ 1062 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */
1063 unsigned char ecard; /* APS EEPROM */ 1063 unsigned char ecard; /* APS EEPROM */
1064 const char *driver; 1064 const char *driver;
1065 const char *name; 1065 const char *name;
diff --git a/kernel/audit.c b/kernel/audit.c
index 83096b67510a..aefa73a8a586 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -560,7 +560,7 @@ static void audit_buffer_free(struct audit_buffer *ab)
560} 560}
561 561
562static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx, 562static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx,
563 unsigned int __nocast gfp_mask, int type) 563 gfp_t gfp_mask, int type)
564{ 564{
565 unsigned long flags; 565 unsigned long flags;
566 struct audit_buffer *ab = NULL; 566 struct audit_buffer *ab = NULL;
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 6a6e87b2f2fd..28176d083f7b 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -968,8 +968,6 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
968 char *page; 968 char *page;
969 ssize_t retval = 0; 969 ssize_t retval = 0;
970 char *s; 970 char *s;
971 char *start;
972 ssize_t n;
973 971
974 if (!(page = (char *)__get_free_page(GFP_KERNEL))) 972 if (!(page = (char *)__get_free_page(GFP_KERNEL)))
975 return -ENOMEM; 973 return -ENOMEM;
@@ -999,15 +997,7 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
999 *s++ = '\n'; 997 *s++ = '\n';
1000 *s = '\0'; 998 *s = '\0';
1001 999
1002 start = page + *ppos; 1000 retval = simple_read_from_buffer(buf, nbytes, ppos, page, s - page);
1003 n = s - start;
1004
1005 /* Do nothing if *ppos is at the eof or beyond the eof. */
1006 if (n <= 0)
1007 goto out;
1008
1009 retval = n - copy_to_user(buf, start, min(n, nbytes));
1010 *ppos += retval;
1011out: 1001out:
1012 free_page((unsigned long)page); 1002 free_page((unsigned long)page);
1013 return retval; 1003 return retval;
@@ -1680,7 +1670,7 @@ static const struct cpuset *nearest_exclusive_ancestor(const struct cpuset *cs)
1680 * GFP_USER - only nodes in current tasks mems allowed ok. 1670 * GFP_USER - only nodes in current tasks mems allowed ok.
1681 **/ 1671 **/
1682 1672
1683int cpuset_zone_allowed(struct zone *z, unsigned int __nocast gfp_mask) 1673int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
1684{ 1674{
1685 int node; /* node that zone z is on */ 1675 int node; /* node that zone z is on */
1686 const struct cpuset *cs; /* current cpuset ancestors */ 1676 const struct cpuset *cs; /* current cpuset ancestors */
diff --git a/kernel/exit.c b/kernel/exit.c
index ee6d8b8abef5..43077732619b 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1203,7 +1203,7 @@ static int wait_task_stopped(task_t *p, int delayed_group_leader, int noreap,
1203 1203
1204 exit_code = p->exit_code; 1204 exit_code = p->exit_code;
1205 if (unlikely(!exit_code) || 1205 if (unlikely(!exit_code) ||
1206 unlikely(p->state > TASK_STOPPED)) 1206 unlikely(p->state & TASK_TRACED))
1207 goto bail_ref; 1207 goto bail_ref;
1208 return wait_noreap_copyout(p, pid, uid, 1208 return wait_noreap_copyout(p, pid, uid,
1209 why, (exit_code << 8) | 0x7f, 1209 why, (exit_code << 8) | 0x7f,
diff --git a/kernel/kfifo.c b/kernel/kfifo.c
index 179baafcdd96..64ab045c3d9d 100644
--- a/kernel/kfifo.c
+++ b/kernel/kfifo.c
@@ -36,7 +36,7 @@
36 * struct kfifo with kfree(). 36 * struct kfifo with kfree().
37 */ 37 */
38struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, 38struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,
39 unsigned int __nocast gfp_mask, spinlock_t *lock) 39 gfp_t gfp_mask, spinlock_t *lock)
40{ 40{
41 struct kfifo *fifo; 41 struct kfifo *fifo;
42 42
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(kfifo_init);
64 * 64 *
65 * The size will be rounded-up to a power of 2. 65 * The size will be rounded-up to a power of 2.
66 */ 66 */
67struct kfifo *kfifo_alloc(unsigned int size, unsigned int __nocast gfp_mask, spinlock_t *lock) 67struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock)
68{ 68{
69 unsigned char *buffer; 69 unsigned char *buffer;
70 struct kfifo *ret; 70 struct kfifo *ret;
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index acf79ac1cb6d..2d5c45676442 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -1095,7 +1095,7 @@ static inline void eat_page(void *page)
1095 *eaten_memory = c; 1095 *eaten_memory = c;
1096} 1096}
1097 1097
1098static unsigned long get_usable_page(unsigned gfp_mask) 1098unsigned long get_usable_page(unsigned gfp_mask)
1099{ 1099{
1100 unsigned long m; 1100 unsigned long m;
1101 1101
@@ -1109,7 +1109,7 @@ static unsigned long get_usable_page(unsigned gfp_mask)
1109 return m; 1109 return m;
1110} 1110}
1111 1111
1112static void free_eaten_memory(void) 1112void free_eaten_memory(void)
1113{ 1113{
1114 unsigned long m; 1114 unsigned long m;
1115 void **c; 1115 void **c;
@@ -1481,11 +1481,12 @@ static int read_suspend_image(void)
1481 /* Allocate memory for the image and read the data from swap */ 1481 /* Allocate memory for the image and read the data from swap */
1482 1482
1483 error = check_pagedir(pagedir_nosave); 1483 error = check_pagedir(pagedir_nosave);
1484 free_eaten_memory(); 1484
1485 if (!error) 1485 if (!error)
1486 error = data_read(pagedir_nosave); 1486 error = data_read(pagedir_nosave);
1487 1487
1488 if (error) { /* We fail cleanly */ 1488 if (error) { /* We fail cleanly */
1489 free_eaten_memory();
1489 for_each_pbe (p, pagedir_nosave) 1490 for_each_pbe (p, pagedir_nosave)
1490 if (p->address) { 1491 if (p->address) {
1491 free_page(p->address); 1492 free_page(p->address);
diff --git a/kernel/signal.c b/kernel/signal.c
index 5a274705ba19..50c992643771 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -262,7 +262,7 @@ next_signal(struct sigpending *pending, sigset_t *mask)
262 return sig; 262 return sig;
263} 263}
264 264
265static struct sigqueue *__sigqueue_alloc(struct task_struct *t, unsigned int __nocast flags, 265static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags,
266 int override_rlimit) 266 int override_rlimit)
267{ 267{
268 struct sigqueue *q = NULL; 268 struct sigqueue *q = NULL;
@@ -578,7 +578,8 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
578 * is to alert stop-signal processing code when another 578 * is to alert stop-signal processing code when another
579 * processor has come along and cleared the flag. 579 * processor has come along and cleared the flag.
580 */ 580 */
581 tsk->signal->flags |= SIGNAL_STOP_DEQUEUED; 581 if (!(tsk->signal->flags & SIGNAL_GROUP_EXIT))
582 tsk->signal->flags |= SIGNAL_STOP_DEQUEUED;
582 } 583 }
583 if ( signr && 584 if ( signr &&
584 ((info->si_code & __SI_MASK) == __SI_TIMER) && 585 ((info->si_code & __SI_MASK) == __SI_TIMER) &&
@@ -1192,6 +1193,40 @@ kill_proc_info(int sig, struct siginfo *info, pid_t pid)
1192 return error; 1193 return error;
1193} 1194}
1194 1195
1196/* like kill_proc_info(), but doesn't use uid/euid of "current" */
1197int kill_proc_info_as_uid(int sig, struct siginfo *info, pid_t pid,
1198 uid_t uid, uid_t euid)
1199{
1200 int ret = -EINVAL;
1201 struct task_struct *p;
1202
1203 if (!valid_signal(sig))
1204 return ret;
1205
1206 read_lock(&tasklist_lock);
1207 p = find_task_by_pid(pid);
1208 if (!p) {
1209 ret = -ESRCH;
1210 goto out_unlock;
1211 }
1212 if ((!info || ((unsigned long)info != 1 &&
1213 (unsigned long)info != 2 && SI_FROMUSER(info)))
1214 && (euid != p->suid) && (euid != p->uid)
1215 && (uid != p->suid) && (uid != p->uid)) {
1216 ret = -EPERM;
1217 goto out_unlock;
1218 }
1219 if (sig && p->sighand) {
1220 unsigned long flags;
1221 spin_lock_irqsave(&p->sighand->siglock, flags);
1222 ret = __group_send_sig_info(sig, info, p);
1223 spin_unlock_irqrestore(&p->sighand->siglock, flags);
1224 }
1225out_unlock:
1226 read_unlock(&tasklist_lock);
1227 return ret;
1228}
1229EXPORT_SYMBOL_GPL(kill_proc_info_as_uid);
1195 1230
1196/* 1231/*
1197 * kill_something_info() interprets pid in interesting ways just like kill(2). 1232 * kill_something_info() interprets pid in interesting ways just like kill(2).
@@ -1763,7 +1798,8 @@ do_signal_stop(int signr)
1763 * stop is always done with the siglock held, 1798 * stop is always done with the siglock held,
1764 * so this check has no races. 1799 * so this check has no races.
1765 */ 1800 */
1766 if (t->state < TASK_STOPPED) { 1801 if (!t->exit_state &&
1802 !(t->state & (TASK_STOPPED|TASK_TRACED))) {
1767 stop_count++; 1803 stop_count++;
1768 signal_wake_up(t, 0); 1804 signal_wake_up(t, 0);
1769 } 1805 }
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 6a8bc6e06431..d1c057e71b68 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -110,7 +110,7 @@ radix_tree_node_free(struct radix_tree_node *node)
110 * success, return zero, with preemption disabled. On error, return -ENOMEM 110 * success, return zero, with preemption disabled. On error, return -ENOMEM
111 * with preemption not disabled. 111 * with preemption not disabled.
112 */ 112 */
113int radix_tree_preload(unsigned int __nocast gfp_mask) 113int radix_tree_preload(gfp_t gfp_mask)
114{ 114{
115 struct radix_tree_preload *rtp; 115 struct radix_tree_preload *rtp;
116 struct radix_tree_node *node; 116 struct radix_tree_node *node;
diff --git a/lib/ts_bm.c b/lib/ts_bm.c
index 2cc79112ecc3..8a8b3a16133e 100644
--- a/lib/ts_bm.c
+++ b/lib/ts_bm.c
@@ -127,7 +127,7 @@ static void compute_prefix_tbl(struct ts_bm *bm, const u8 *pattern,
127} 127}
128 128
129static struct ts_config *bm_init(const void *pattern, unsigned int len, 129static struct ts_config *bm_init(const void *pattern, unsigned int len,
130 int gfp_mask) 130 gfp_t gfp_mask)
131{ 131{
132 struct ts_config *conf; 132 struct ts_config *conf;
133 struct ts_bm *bm; 133 struct ts_bm *bm;
diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
index d27c0a072940..ca3211206eef 100644
--- a/lib/ts_fsm.c
+++ b/lib/ts_fsm.c
@@ -258,7 +258,7 @@ found_match:
258} 258}
259 259
260static struct ts_config *fsm_init(const void *pattern, unsigned int len, 260static struct ts_config *fsm_init(const void *pattern, unsigned int len,
261 int gfp_mask) 261 gfp_t gfp_mask)
262{ 262{
263 int i, err = -EINVAL; 263 int i, err = -EINVAL;
264 struct ts_config *conf; 264 struct ts_config *conf;
diff --git a/lib/ts_kmp.c b/lib/ts_kmp.c
index 73266b975585..7fd45451b44a 100644
--- a/lib/ts_kmp.c
+++ b/lib/ts_kmp.c
@@ -87,7 +87,7 @@ static inline void compute_prefix_tbl(const u8 *pattern, unsigned int len,
87} 87}
88 88
89static struct ts_config *kmp_init(const void *pattern, unsigned int len, 89static struct ts_config *kmp_init(const void *pattern, unsigned int len,
90 int gfp_mask) 90 gfp_t gfp_mask)
91{ 91{
92 struct ts_config *conf; 92 struct ts_config *conf;
93 struct ts_kmp *kmp; 93 struct ts_kmp *kmp;
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 8ec4e4c2a179..c1330cc19783 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -61,17 +61,9 @@ static unsigned long __init init_bootmem_core (pg_data_t *pgdat,
61{ 61{
62 bootmem_data_t *bdata = pgdat->bdata; 62 bootmem_data_t *bdata = pgdat->bdata;
63 unsigned long mapsize = ((end - start)+7)/8; 63 unsigned long mapsize = ((end - start)+7)/8;
64 static struct pglist_data *pgdat_last; 64
65 65 pgdat->pgdat_next = pgdat_list;
66 pgdat->pgdat_next = NULL; 66 pgdat_list = pgdat;
67 /* Add new nodes last so that bootmem always starts
68 searching in the first nodes, not the last ones */
69 if (pgdat_last)
70 pgdat_last->pgdat_next = pgdat;
71 else {
72 pgdat_list = pgdat;
73 pgdat_last = pgdat;
74 }
75 67
76 mapsize = ALIGN(mapsize, sizeof(long)); 68 mapsize = ALIGN(mapsize, sizeof(long));
77 bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); 69 bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT);
diff --git a/mm/fremap.c b/mm/fremap.c
index 3235fb77c133..ab23a0673c35 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -89,6 +89,9 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
89 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 89 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
90 if (!page->mapping || page->index >= size) 90 if (!page->mapping || page->index >= size)
91 goto err_unlock; 91 goto err_unlock;
92 err = -ENOMEM;
93 if (page_mapcount(page) > INT_MAX/2)
94 goto err_unlock;
92 95
93 zap_pte(mm, vma, addr, pte); 96 zap_pte(mm, vma, addr, pte);
94 97
diff --git a/mm/highmem.c b/mm/highmem.c
index 400911599468..90e1861e2da0 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -30,7 +30,7 @@
30 30
31static mempool_t *page_pool, *isa_page_pool; 31static mempool_t *page_pool, *isa_page_pool;
32 32
33static void *page_pool_alloc(unsigned int __nocast gfp_mask, void *data) 33static void *page_pool_alloc(gfp_t gfp_mask, void *data)
34{ 34{
35 unsigned int gfp = gfp_mask | (unsigned int) (long) data; 35 unsigned int gfp = gfp_mask | (unsigned int) (long) data;
36 36
diff --git a/mm/madvise.c b/mm/madvise.c
index 4454936f87d1..20e075d1c64c 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -83,6 +83,9 @@ static long madvise_willneed(struct vm_area_struct * vma,
83{ 83{
84 struct file *file = vma->vm_file; 84 struct file *file = vma->vm_file;
85 85
86 if (!file)
87 return -EBADF;
88
86 if (file->f_mapping->a_ops->get_xip_page) { 89 if (file->f_mapping->a_ops->get_xip_page) {
87 /* no bad return value, but ignore advice */ 90 /* no bad return value, but ignore advice */
88 return 0; 91 return 0;
@@ -141,11 +144,7 @@ static long
141madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, 144madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
142 unsigned long start, unsigned long end, int behavior) 145 unsigned long start, unsigned long end, int behavior)
143{ 146{
144 struct file *filp = vma->vm_file; 147 long error;
145 long error = -EBADF;
146
147 if (!filp)
148 goto out;
149 148
150 switch (behavior) { 149 switch (behavior) {
151 case MADV_NORMAL: 150 case MADV_NORMAL:
@@ -166,8 +165,6 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
166 error = -EINVAL; 165 error = -EINVAL;
167 break; 166 break;
168 } 167 }
169
170out:
171 return error; 168 return error;
172} 169}
173 170
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 9033f0859aa8..37af443eb094 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -687,7 +687,7 @@ get_vma_policy(struct task_struct *task, struct vm_area_struct *vma, unsigned lo
687} 687}
688 688
689/* Return a zonelist representing a mempolicy */ 689/* Return a zonelist representing a mempolicy */
690static struct zonelist *zonelist_policy(unsigned int __nocast gfp, struct mempolicy *policy) 690static struct zonelist *zonelist_policy(gfp_t gfp, struct mempolicy *policy)
691{ 691{
692 int nd; 692 int nd;
693 693
@@ -751,7 +751,7 @@ static unsigned offset_il_node(struct mempolicy *pol,
751 751
752/* Allocate a page in interleaved policy. 752/* Allocate a page in interleaved policy.
753 Own path because it needs to do special accounting. */ 753 Own path because it needs to do special accounting. */
754static struct page *alloc_page_interleave(unsigned int __nocast gfp, unsigned order, unsigned nid) 754static struct page *alloc_page_interleave(gfp_t gfp, unsigned order, unsigned nid)
755{ 755{
756 struct zonelist *zl; 756 struct zonelist *zl;
757 struct page *page; 757 struct page *page;
@@ -789,7 +789,7 @@ static struct page *alloc_page_interleave(unsigned int __nocast gfp, unsigned or
789 * Should be called with the mm_sem of the vma hold. 789 * Should be called with the mm_sem of the vma hold.
790 */ 790 */
791struct page * 791struct page *
792alloc_page_vma(unsigned int __nocast gfp, struct vm_area_struct *vma, unsigned long addr) 792alloc_page_vma(gfp_t gfp, struct vm_area_struct *vma, unsigned long addr)
793{ 793{
794 struct mempolicy *pol = get_vma_policy(current, vma, addr); 794 struct mempolicy *pol = get_vma_policy(current, vma, addr);
795 795
@@ -832,7 +832,7 @@ alloc_page_vma(unsigned int __nocast gfp, struct vm_area_struct *vma, unsigned l
832 * 1) it's ok to take cpuset_sem (can WAIT), and 832 * 1) it's ok to take cpuset_sem (can WAIT), and
833 * 2) allocating for current task (not interrupt). 833 * 2) allocating for current task (not interrupt).
834 */ 834 */
835struct page *alloc_pages_current(unsigned int __nocast gfp, unsigned order) 835struct page *alloc_pages_current(gfp_t gfp, unsigned order)
836{ 836{
837 struct mempolicy *pol = current->mempolicy; 837 struct mempolicy *pol = current->mempolicy;
838 838
diff --git a/mm/mempool.c b/mm/mempool.c
index 65f2957b8d51..9e377ea700b2 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -112,7 +112,7 @@ EXPORT_SYMBOL(mempool_create_node);
112 * while this function is running. mempool_alloc() & mempool_free() 112 * while this function is running. mempool_alloc() & mempool_free()
113 * might be called (eg. from IRQ contexts) while this function executes. 113 * might be called (eg. from IRQ contexts) while this function executes.
114 */ 114 */
115int mempool_resize(mempool_t *pool, int new_min_nr, unsigned int __nocast gfp_mask) 115int mempool_resize(mempool_t *pool, int new_min_nr, gfp_t gfp_mask)
116{ 116{
117 void *element; 117 void *element;
118 void **new_elements; 118 void **new_elements;
@@ -200,7 +200,7 @@ EXPORT_SYMBOL(mempool_destroy);
200 * *never* fails when called from process contexts. (it might 200 * *never* fails when called from process contexts. (it might
201 * fail if called from an IRQ context.) 201 * fail if called from an IRQ context.)
202 */ 202 */
203void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask) 203void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask)
204{ 204{
205 void *element; 205 void *element;
206 unsigned long flags; 206 unsigned long flags;
@@ -276,7 +276,7 @@ EXPORT_SYMBOL(mempool_free);
276/* 276/*
277 * A commonly used alloc and free fn. 277 * A commonly used alloc and free fn.
278 */ 278 */
279void *mempool_alloc_slab(unsigned int __nocast gfp_mask, void *pool_data) 279void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data)
280{ 280{
281 kmem_cache_t *mem = (kmem_cache_t *) pool_data; 281 kmem_cache_t *mem = (kmem_cache_t *) pool_data;
282 return kmem_cache_alloc(mem, gfp_mask); 282 return kmem_cache_alloc(mem, gfp_mask);
diff --git a/mm/nommu.c b/mm/nommu.c
index 064d70442895..0ef241ae3763 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -157,8 +157,7 @@ void vfree(void *addr)
157 kfree(addr); 157 kfree(addr);
158} 158}
159 159
160void *__vmalloc(unsigned long size, unsigned int __nocast gfp_mask, 160void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
161 pgprot_t prot)
162{ 161{
163 /* 162 /*
164 * kmalloc doesn't like __GFP_HIGHMEM for some reason 163 * kmalloc doesn't like __GFP_HIGHMEM for some reason
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index ac3bf33e5370..d348b9035955 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -263,7 +263,7 @@ static struct mm_struct *oom_kill_process(struct task_struct *p)
263 * OR try to be smart about which process to kill. Note that we 263 * OR try to be smart about which process to kill. Note that we
264 * don't have to be perfect here, we just have to be good. 264 * don't have to be perfect here, we just have to be good.
265 */ 265 */
266void out_of_memory(unsigned int __nocast gfp_mask, int order) 266void out_of_memory(gfp_t gfp_mask, int order)
267{ 267{
268 struct mm_struct *mm = NULL; 268 struct mm_struct *mm = NULL;
269 task_t * p; 269 task_t * p;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ae2903339e71..cc1fe2672a31 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -671,7 +671,7 @@ void fastcall free_cold_page(struct page *page)
671 free_hot_cold_page(page, 1); 671 free_hot_cold_page(page, 1);
672} 672}
673 673
674static inline void prep_zero_page(struct page *page, int order, unsigned int __nocast gfp_flags) 674static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags)
675{ 675{
676 int i; 676 int i;
677 677
@@ -686,7 +686,7 @@ static inline void prep_zero_page(struct page *page, int order, unsigned int __n
686 * or two. 686 * or two.
687 */ 687 */
688static struct page * 688static struct page *
689buffered_rmqueue(struct zone *zone, int order, unsigned int __nocast gfp_flags) 689buffered_rmqueue(struct zone *zone, int order, gfp_t gfp_flags)
690{ 690{
691 unsigned long flags; 691 unsigned long flags;
692 struct page *page = NULL; 692 struct page *page = NULL;
@@ -761,7 +761,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
761} 761}
762 762
763static inline int 763static inline int
764should_reclaim_zone(struct zone *z, unsigned int gfp_mask) 764should_reclaim_zone(struct zone *z, gfp_t gfp_mask)
765{ 765{
766 if (!z->reclaim_pages) 766 if (!z->reclaim_pages)
767 return 0; 767 return 0;
@@ -774,7 +774,7 @@ should_reclaim_zone(struct zone *z, unsigned int gfp_mask)
774 * This is the 'heart' of the zoned buddy allocator. 774 * This is the 'heart' of the zoned buddy allocator.
775 */ 775 */
776struct page * fastcall 776struct page * fastcall
777__alloc_pages(unsigned int __nocast gfp_mask, unsigned int order, 777__alloc_pages(gfp_t gfp_mask, unsigned int order,
778 struct zonelist *zonelist) 778 struct zonelist *zonelist)
779{ 779{
780 const int wait = gfp_mask & __GFP_WAIT; 780 const int wait = gfp_mask & __GFP_WAIT;
@@ -977,7 +977,7 @@ EXPORT_SYMBOL(__alloc_pages);
977/* 977/*
978 * Common helper functions. 978 * Common helper functions.
979 */ 979 */
980fastcall unsigned long __get_free_pages(unsigned int __nocast gfp_mask, unsigned int order) 980fastcall unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order)
981{ 981{
982 struct page * page; 982 struct page * page;
983 page = alloc_pages(gfp_mask, order); 983 page = alloc_pages(gfp_mask, order);
@@ -988,7 +988,7 @@ fastcall unsigned long __get_free_pages(unsigned int __nocast gfp_mask, unsigned
988 988
989EXPORT_SYMBOL(__get_free_pages); 989EXPORT_SYMBOL(__get_free_pages);
990 990
991fastcall unsigned long get_zeroed_page(unsigned int __nocast gfp_mask) 991fastcall unsigned long get_zeroed_page(gfp_t gfp_mask)
992{ 992{
993 struct page * page; 993 struct page * page;
994 994
diff --git a/mm/page_io.c b/mm/page_io.c
index 2e605a19ce57..330e00d6db00 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -19,7 +19,7 @@
19#include <linux/writeback.h> 19#include <linux/writeback.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21 21
22static struct bio *get_swap_bio(unsigned int __nocast gfp_flags, pgoff_t index, 22static struct bio *get_swap_bio(gfp_t gfp_flags, pgoff_t index,
23 struct page *page, bio_end_io_t end_io) 23 struct page *page, bio_end_io_t end_io)
24{ 24{
25 struct bio *bio; 25 struct bio *bio;
diff --git a/mm/shmem.c b/mm/shmem.c
index 1f7aeb210c7b..ea064d89cda9 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -921,8 +921,7 @@ shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx)
921} 921}
922 922
923static inline struct page * 923static inline struct page *
924shmem_alloc_page(unsigned int __nocast gfp,struct shmem_inode_info *info, 924shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)
925 unsigned long idx)
926{ 925{
927 return alloc_page(gfp | __GFP_ZERO); 926 return alloc_page(gfp | __GFP_ZERO);
928} 927}
diff --git a/mm/slab.c b/mm/slab.c
index 5cbbdfa6dd0e..d05c678bceb3 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -650,8 +650,7 @@ static inline struct array_cache *ac_data(kmem_cache_t *cachep)
650 return cachep->array[smp_processor_id()]; 650 return cachep->array[smp_processor_id()];
651} 651}
652 652
653static inline kmem_cache_t *__find_general_cachep(size_t size, 653static inline kmem_cache_t *__find_general_cachep(size_t size, gfp_t gfpflags)
654 unsigned int __nocast gfpflags)
655{ 654{
656 struct cache_sizes *csizep = malloc_sizes; 655 struct cache_sizes *csizep = malloc_sizes;
657 656
@@ -675,8 +674,7 @@ static inline kmem_cache_t *__find_general_cachep(size_t size,
675 return csizep->cs_cachep; 674 return csizep->cs_cachep;
676} 675}
677 676
678kmem_cache_t *kmem_find_general_cachep(size_t size, 677kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags)
679 unsigned int __nocast gfpflags)
680{ 678{
681 return __find_general_cachep(size, gfpflags); 679 return __find_general_cachep(size, gfpflags);
682} 680}
@@ -1185,7 +1183,7 @@ __initcall(cpucache_init);
1185 * did not request dmaable memory, we might get it, but that 1183 * did not request dmaable memory, we might get it, but that
1186 * would be relatively rare and ignorable. 1184 * would be relatively rare and ignorable.
1187 */ 1185 */
1188static void *kmem_getpages(kmem_cache_t *cachep, unsigned int __nocast flags, int nodeid) 1186static void *kmem_getpages(kmem_cache_t *cachep, gfp_t flags, int nodeid)
1189{ 1187{
1190 struct page *page; 1188 struct page *page;
1191 void *addr; 1189 void *addr;
@@ -2048,7 +2046,7 @@ EXPORT_SYMBOL(kmem_cache_destroy);
2048 2046
2049/* Get the memory for a slab management obj. */ 2047/* Get the memory for a slab management obj. */
2050static struct slab* alloc_slabmgmt(kmem_cache_t *cachep, void *objp, 2048static struct slab* alloc_slabmgmt(kmem_cache_t *cachep, void *objp,
2051 int colour_off, unsigned int __nocast local_flags) 2049 int colour_off, gfp_t local_flags)
2052{ 2050{
2053 struct slab *slabp; 2051 struct slab *slabp;
2054 2052
@@ -2149,7 +2147,7 @@ static void set_slab_attr(kmem_cache_t *cachep, struct slab *slabp, void *objp)
2149 * Grow (by 1) the number of slabs within a cache. This is called by 2147 * Grow (by 1) the number of slabs within a cache. This is called by
2150 * kmem_cache_alloc() when there are no active objs left in a cache. 2148 * kmem_cache_alloc() when there are no active objs left in a cache.
2151 */ 2149 */
2152static int cache_grow(kmem_cache_t *cachep, unsigned int __nocast flags, int nodeid) 2150static int cache_grow(kmem_cache_t *cachep, gfp_t flags, int nodeid)
2153{ 2151{
2154 struct slab *slabp; 2152 struct slab *slabp;
2155 void *objp; 2153 void *objp;
@@ -2356,7 +2354,7 @@ bad:
2356#define check_slabp(x,y) do { } while(0) 2354#define check_slabp(x,y) do { } while(0)
2357#endif 2355#endif
2358 2356
2359static void *cache_alloc_refill(kmem_cache_t *cachep, unsigned int __nocast flags) 2357static void *cache_alloc_refill(kmem_cache_t *cachep, gfp_t flags)
2360{ 2358{
2361 int batchcount; 2359 int batchcount;
2362 struct kmem_list3 *l3; 2360 struct kmem_list3 *l3;
@@ -2456,7 +2454,7 @@ alloc_done:
2456} 2454}
2457 2455
2458static inline void 2456static inline void
2459cache_alloc_debugcheck_before(kmem_cache_t *cachep, unsigned int __nocast flags) 2457cache_alloc_debugcheck_before(kmem_cache_t *cachep, gfp_t flags)
2460{ 2458{
2461 might_sleep_if(flags & __GFP_WAIT); 2459 might_sleep_if(flags & __GFP_WAIT);
2462#if DEBUG 2460#if DEBUG
@@ -2467,7 +2465,7 @@ cache_alloc_debugcheck_before(kmem_cache_t *cachep, unsigned int __nocast flags)
2467#if DEBUG 2465#if DEBUG
2468static void * 2466static void *
2469cache_alloc_debugcheck_after(kmem_cache_t *cachep, 2467cache_alloc_debugcheck_after(kmem_cache_t *cachep,
2470 unsigned int __nocast flags, void *objp, void *caller) 2468 gfp_t flags, void *objp, void *caller)
2471{ 2469{
2472 if (!objp) 2470 if (!objp)
2473 return objp; 2471 return objp;
@@ -2510,7 +2508,7 @@ cache_alloc_debugcheck_after(kmem_cache_t *cachep,
2510#define cache_alloc_debugcheck_after(a,b,objp,d) (objp) 2508#define cache_alloc_debugcheck_after(a,b,objp,d) (objp)
2511#endif 2509#endif
2512 2510
2513static inline void *____cache_alloc(kmem_cache_t *cachep, unsigned int __nocast flags) 2511static inline void *____cache_alloc(kmem_cache_t *cachep, gfp_t flags)
2514{ 2512{
2515 void* objp; 2513 void* objp;
2516 struct array_cache *ac; 2514 struct array_cache *ac;
@@ -2528,7 +2526,7 @@ static inline void *____cache_alloc(kmem_cache_t *cachep, unsigned int __nocast
2528 return objp; 2526 return objp;
2529} 2527}
2530 2528
2531static inline void *__cache_alloc(kmem_cache_t *cachep, unsigned int __nocast flags) 2529static inline void *__cache_alloc(kmem_cache_t *cachep, gfp_t flags)
2532{ 2530{
2533 unsigned long save_flags; 2531 unsigned long save_flags;
2534 void* objp; 2532 void* objp;
@@ -2787,7 +2785,7 @@ static inline void __cache_free(kmem_cache_t *cachep, void *objp)
2787 * Allocate an object from this cache. The flags are only relevant 2785 * Allocate an object from this cache. The flags are only relevant
2788 * if the cache has no available objects. 2786 * if the cache has no available objects.
2789 */ 2787 */
2790void *kmem_cache_alloc(kmem_cache_t *cachep, unsigned int __nocast flags) 2788void *kmem_cache_alloc(kmem_cache_t *cachep, gfp_t flags)
2791{ 2789{
2792 return __cache_alloc(cachep, flags); 2790 return __cache_alloc(cachep, flags);
2793} 2791}
@@ -2848,7 +2846,7 @@ out:
2848 * New and improved: it will now make sure that the object gets 2846 * New and improved: it will now make sure that the object gets
2849 * put on the correct node list so that there is no false sharing. 2847 * put on the correct node list so that there is no false sharing.
2850 */ 2848 */
2851void *kmem_cache_alloc_node(kmem_cache_t *cachep, unsigned int __nocast flags, int nodeid) 2849void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int nodeid)
2852{ 2850{
2853 unsigned long save_flags; 2851 unsigned long save_flags;
2854 void *ptr; 2852 void *ptr;
@@ -2875,7 +2873,7 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, unsigned int __nocast flags, i
2875} 2873}
2876EXPORT_SYMBOL(kmem_cache_alloc_node); 2874EXPORT_SYMBOL(kmem_cache_alloc_node);
2877 2875
2878void *kmalloc_node(size_t size, unsigned int __nocast flags, int node) 2876void *kmalloc_node(size_t size, gfp_t flags, int node)
2879{ 2877{
2880 kmem_cache_t *cachep; 2878 kmem_cache_t *cachep;
2881 2879
@@ -2908,7 +2906,7 @@ EXPORT_SYMBOL(kmalloc_node);
2908 * platforms. For example, on i386, it means that the memory must come 2906 * platforms. For example, on i386, it means that the memory must come
2909 * from the first 16MB. 2907 * from the first 16MB.
2910 */ 2908 */
2911void *__kmalloc(size_t size, unsigned int __nocast flags) 2909void *__kmalloc(size_t size, gfp_t flags)
2912{ 2910{
2913 kmem_cache_t *cachep; 2911 kmem_cache_t *cachep;
2914 2912
@@ -2997,7 +2995,7 @@ EXPORT_SYMBOL(kmem_cache_free);
2997 * @size: how many bytes of memory are required. 2995 * @size: how many bytes of memory are required.
2998 * @flags: the type of memory to allocate. 2996 * @flags: the type of memory to allocate.
2999 */ 2997 */
3000void *kzalloc(size_t size, unsigned int __nocast flags) 2998void *kzalloc(size_t size, gfp_t flags)
3001{ 2999{
3002 void *ret = kmalloc(size, flags); 3000 void *ret = kmalloc(size, flags);
3003 if (ret) 3001 if (ret)
@@ -3603,7 +3601,7 @@ unsigned int ksize(const void *objp)
3603 * @s: the string to duplicate 3601 * @s: the string to duplicate
3604 * @gfp: the GFP mask used in the kmalloc() call when allocating memory 3602 * @gfp: the GFP mask used in the kmalloc() call when allocating memory
3605 */ 3603 */
3606char *kstrdup(const char *s, unsigned int __nocast gfp) 3604char *kstrdup(const char *s, gfp_t gfp)
3607{ 3605{
3608 size_t len; 3606 size_t len;
3609 char *buf; 3607 char *buf;
diff --git a/mm/swap_state.c b/mm/swap_state.c
index adbc2b426c2f..132164f7d0a7 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -68,7 +68,7 @@ void show_swap_cache_info(void)
68 * but sets SwapCache flag and private instead of mapping and index. 68 * but sets SwapCache flag and private instead of mapping and index.
69 */ 69 */
70static int __add_to_swap_cache(struct page *page, swp_entry_t entry, 70static int __add_to_swap_cache(struct page *page, swp_entry_t entry,
71 unsigned int __nocast gfp_mask) 71 gfp_t gfp_mask)
72{ 72{
73 int error; 73 int error;
74 74
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 13c3d82968ae..1150229b6366 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -395,7 +395,7 @@ void *vmap(struct page **pages, unsigned int count,
395 395
396EXPORT_SYMBOL(vmap); 396EXPORT_SYMBOL(vmap);
397 397
398void *__vmalloc_area(struct vm_struct *area, unsigned int __nocast gfp_mask, pgprot_t prot) 398void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot)
399{ 399{
400 struct page **pages; 400 struct page **pages;
401 unsigned int nr_pages, array_size, i; 401 unsigned int nr_pages, array_size, i;
@@ -446,7 +446,7 @@ fail:
446 * allocator with @gfp_mask flags. Map them into contiguous 446 * allocator with @gfp_mask flags. Map them into contiguous
447 * kernel virtual space, using a pagetable protection of @prot. 447 * kernel virtual space, using a pagetable protection of @prot.
448 */ 448 */
449void *__vmalloc(unsigned long size, unsigned int __nocast gfp_mask, pgprot_t prot) 449void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
450{ 450{
451 struct vm_struct *area; 451 struct vm_struct *area;
452 452
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 1d31b3a3f1e5..7982656b9c83 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -100,8 +100,7 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to,
100 continue; 100 continue;
101 101
102 if (to->sat_addr.s_net == ATADDR_ANYNET && 102 if (to->sat_addr.s_net == ATADDR_ANYNET &&
103 to->sat_addr.s_node == ATADDR_BCAST && 103 to->sat_addr.s_node == ATADDR_BCAST)
104 at->src_net == atif->address.s_net)
105 goto found; 104 goto found;
106 105
107 if (to->sat_addr.s_net == at->src_net && 106 if (to->sat_addr.s_net == at->src_net &&
@@ -1443,8 +1442,10 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
1443 else 1442 else
1444 atif = atalk_find_interface(ddp->deh_dnet, ddp->deh_dnode); 1443 atif = atalk_find_interface(ddp->deh_dnet, ddp->deh_dnode);
1445 1444
1446 /* Not ours, so we route the packet via the correct AppleTalk iface */
1447 if (!atif) { 1445 if (!atif) {
1446 /* Not ours, so we route the packet via the correct
1447 * AppleTalk iface
1448 */
1448 atalk_route_packet(skb, dev, ddp, &ddphv, origlen); 1449 atalk_route_packet(skb, dev, ddp, &ddphv, origlen);
1449 goto out; 1450 goto out;
1450 } 1451 }
@@ -1592,9 +1593,6 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1592 1593
1593 if (usat->sat_addr.s_net || usat->sat_addr.s_node == ATADDR_ANYNODE) { 1594 if (usat->sat_addr.s_net || usat->sat_addr.s_node == ATADDR_ANYNODE) {
1594 rt = atrtr_find(&usat->sat_addr); 1595 rt = atrtr_find(&usat->sat_addr);
1595 if (!rt)
1596 return -ENETUNREACH;
1597
1598 dev = rt->dev; 1596 dev = rt->dev;
1599 } else { 1597 } else {
1600 struct atalk_addr at_hint; 1598 struct atalk_addr at_hint;
@@ -1603,11 +1601,12 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1603 at_hint.s_net = at->src_net; 1601 at_hint.s_net = at->src_net;
1604 1602
1605 rt = atrtr_find(&at_hint); 1603 rt = atrtr_find(&at_hint);
1606 if (!rt)
1607 return -ENETUNREACH;
1608
1609 dev = rt->dev; 1604 dev = rt->dev;
1610 } 1605 }
1606 if (!rt)
1607 return -ENETUNREACH;
1608
1609 dev = rt->dev;
1611 1610
1612 SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n", 1611 SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n",
1613 sk, size, dev->name); 1612 sk, size, dev->name);
@@ -1677,6 +1676,20 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1677 SOCK_DEBUG(sk, "SK %p: Loop back.\n", sk); 1676 SOCK_DEBUG(sk, "SK %p: Loop back.\n", sk);
1678 /* loop back */ 1677 /* loop back */
1679 skb_orphan(skb); 1678 skb_orphan(skb);
1679 if (ddp->deh_dnode == ATADDR_BCAST) {
1680 struct atalk_addr at_lo;
1681
1682 at_lo.s_node = 0;
1683 at_lo.s_net = 0;
1684
1685 rt = atrtr_find(&at_lo);
1686 if (!rt) {
1687 kfree_skb(skb);
1688 return -ENETUNREACH;
1689 }
1690 dev = rt->dev;
1691 skb->dev = dev;
1692 }
1680 ddp_dl->request(ddp_dl, skb, dev->dev_addr); 1693 ddp_dl->request(ddp_dl, skb, dev->dev_addr);
1681 } else { 1694 } else {
1682 SOCK_DEBUG(sk, "SK %p: send out.\n", sk); 1695 SOCK_DEBUG(sk, "SK %p: send out.\n", sk);
diff --git a/net/atm/addr.c b/net/atm/addr.c
index 1c8867f7f54a..3060fd0ba4b9 100644
--- a/net/atm/addr.c
+++ b/net/atm/addr.c
@@ -44,29 +44,43 @@ static void notify_sigd(struct atm_dev *dev)
44 sigd_enq(NULL, as_itf_notify, NULL, &pvc, NULL); 44 sigd_enq(NULL, as_itf_notify, NULL, &pvc, NULL);
45} 45}
46 46
47void atm_reset_addr(struct atm_dev *dev) 47void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t atype)
48{ 48{
49 unsigned long flags; 49 unsigned long flags;
50 struct atm_dev_addr *this, *p; 50 struct atm_dev_addr *this, *p;
51 struct list_head *head;
51 52
52 spin_lock_irqsave(&dev->lock, flags); 53 spin_lock_irqsave(&dev->lock, flags);
53 list_for_each_entry_safe(this, p, &dev->local, entry) 54 if (atype == ATM_ADDR_LECS)
54 kfree(this); 55 head = &dev->lecs;
56 else
57 head = &dev->local;
58 list_for_each_entry_safe(this, p, head, entry) {
59 list_del(&this->entry);
60 kfree(this);
61 }
55 spin_unlock_irqrestore(&dev->lock, flags); 62 spin_unlock_irqrestore(&dev->lock, flags);
56 notify_sigd(dev); 63 if (head == &dev->local)
64 notify_sigd(dev);
57} 65}
58 66
59int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr) 67int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
68 enum atm_addr_type_t atype)
60{ 69{
61 unsigned long flags; 70 unsigned long flags;
62 struct atm_dev_addr *this; 71 struct atm_dev_addr *this;
72 struct list_head *head;
63 int error; 73 int error;
64 74
65 error = check_addr(addr); 75 error = check_addr(addr);
66 if (error) 76 if (error)
67 return error; 77 return error;
68 spin_lock_irqsave(&dev->lock, flags); 78 spin_lock_irqsave(&dev->lock, flags);
69 list_for_each_entry(this, &dev->local, entry) { 79 if (atype == ATM_ADDR_LECS)
80 head = &dev->lecs;
81 else
82 head = &dev->local;
83 list_for_each_entry(this, head, entry) {
70 if (identical(&this->addr, addr)) { 84 if (identical(&this->addr, addr)) {
71 spin_unlock_irqrestore(&dev->lock, flags); 85 spin_unlock_irqrestore(&dev->lock, flags);
72 return -EEXIST; 86 return -EEXIST;
@@ -78,28 +92,36 @@ int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr)
78 return -ENOMEM; 92 return -ENOMEM;
79 } 93 }
80 this->addr = *addr; 94 this->addr = *addr;
81 list_add(&this->entry, &dev->local); 95 list_add(&this->entry, head);
82 spin_unlock_irqrestore(&dev->lock, flags); 96 spin_unlock_irqrestore(&dev->lock, flags);
83 notify_sigd(dev); 97 if (head == &dev->local)
98 notify_sigd(dev);
84 return 0; 99 return 0;
85} 100}
86 101
87int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr) 102int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
103 enum atm_addr_type_t atype)
88{ 104{
89 unsigned long flags; 105 unsigned long flags;
90 struct atm_dev_addr *this; 106 struct atm_dev_addr *this;
107 struct list_head *head;
91 int error; 108 int error;
92 109
93 error = check_addr(addr); 110 error = check_addr(addr);
94 if (error) 111 if (error)
95 return error; 112 return error;
96 spin_lock_irqsave(&dev->lock, flags); 113 spin_lock_irqsave(&dev->lock, flags);
97 list_for_each_entry(this, &dev->local, entry) { 114 if (atype == ATM_ADDR_LECS)
115 head = &dev->lecs;
116 else
117 head = &dev->local;
118 list_for_each_entry(this, head, entry) {
98 if (identical(&this->addr, addr)) { 119 if (identical(&this->addr, addr)) {
99 list_del(&this->entry); 120 list_del(&this->entry);
100 spin_unlock_irqrestore(&dev->lock, flags); 121 spin_unlock_irqrestore(&dev->lock, flags);
101 kfree(this); 122 kfree(this);
102 notify_sigd(dev); 123 if (head == &dev->local)
124 notify_sigd(dev);
103 return 0; 125 return 0;
104 } 126 }
105 } 127 }
@@ -108,22 +130,27 @@ int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr)
108} 130}
109 131
110int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user * buf, 132int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user * buf,
111 size_t size) 133 size_t size, enum atm_addr_type_t atype)
112{ 134{
113 unsigned long flags; 135 unsigned long flags;
114 struct atm_dev_addr *this; 136 struct atm_dev_addr *this;
137 struct list_head *head;
115 int total = 0, error; 138 int total = 0, error;
116 struct sockaddr_atmsvc *tmp_buf, *tmp_bufp; 139 struct sockaddr_atmsvc *tmp_buf, *tmp_bufp;
117 140
118 spin_lock_irqsave(&dev->lock, flags); 141 spin_lock_irqsave(&dev->lock, flags);
119 list_for_each_entry(this, &dev->local, entry) 142 if (atype == ATM_ADDR_LECS)
143 head = &dev->lecs;
144 else
145 head = &dev->local;
146 list_for_each_entry(this, head, entry)
120 total += sizeof(struct sockaddr_atmsvc); 147 total += sizeof(struct sockaddr_atmsvc);
121 tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC); 148 tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC);
122 if (!tmp_buf) { 149 if (!tmp_buf) {
123 spin_unlock_irqrestore(&dev->lock, flags); 150 spin_unlock_irqrestore(&dev->lock, flags);
124 return -ENOMEM; 151 return -ENOMEM;
125 } 152 }
126 list_for_each_entry(this, &dev->local, entry) 153 list_for_each_entry(this, head, entry)
127 memcpy(tmp_bufp++, &this->addr, sizeof(struct sockaddr_atmsvc)); 154 memcpy(tmp_bufp++, &this->addr, sizeof(struct sockaddr_atmsvc));
128 spin_unlock_irqrestore(&dev->lock, flags); 155 spin_unlock_irqrestore(&dev->lock, flags);
129 error = total > size ? -E2BIG : total; 156 error = total > size ? -E2BIG : total;
diff --git a/net/atm/addr.h b/net/atm/addr.h
index 3099d21feeaa..f39433ad45da 100644
--- a/net/atm/addr.h
+++ b/net/atm/addr.h
@@ -9,10 +9,12 @@
9#include <linux/atm.h> 9#include <linux/atm.h>
10#include <linux/atmdev.h> 10#include <linux/atmdev.h>
11 11
12 12void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t type);
13void atm_reset_addr(struct atm_dev *dev); 13int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
14int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); 14 enum atm_addr_type_t type);
15int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); 15int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
16int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,size_t size); 16 enum atm_addr_type_t type);
17int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user *buf,
18 size_t size, enum atm_addr_type_t type);
17 19
18#endif 20#endif
diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c
index b2113c3454ae..223c7ad5bd0f 100644
--- a/net/atm/atm_misc.c
+++ b/net/atm/atm_misc.c
@@ -25,7 +25,7 @@ int atm_charge(struct atm_vcc *vcc,int truesize)
25 25
26 26
27struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, 27struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
28 int gfp_flags) 28 gfp_t gfp_flags)
29{ 29{
30 struct sock *sk = sk_atm(vcc); 30 struct sock *sk = sk_atm(vcc);
31 int guess = atm_guess_pdu2truesize(pdu_size); 31 int guess = atm_guess_pdu2truesize(pdu_size);
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 289956c4dd3e..72f3f7b8de80 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -220,7 +220,7 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
220 /* netif_stop_queue(dev); */ 220 /* netif_stop_queue(dev); */
221 dev_kfree_skb(skb); 221 dev_kfree_skb(skb);
222 read_unlock(&devs_lock); 222 read_unlock(&devs_lock);
223 return -EUNATCH; 223 return 0;
224 } 224 }
225 if (!br2684_xmit_vcc(skb, brdev, brvcc)) { 225 if (!br2684_xmit_vcc(skb, brdev, brvcc)) {
226 /* 226 /*
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 28dab55a4387..4f54c9a5e84a 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -310,7 +310,7 @@ static int clip_constructor(struct neighbour *neigh)
310 if (neigh->type != RTN_UNICAST) return -EINVAL; 310 if (neigh->type != RTN_UNICAST) return -EINVAL;
311 311
312 rcu_read_lock(); 312 rcu_read_lock();
313 in_dev = rcu_dereference(__in_dev_get(dev)); 313 in_dev = __in_dev_get_rcu(dev);
314 if (!in_dev) { 314 if (!in_dev) {
315 rcu_read_unlock(); 315 rcu_read_unlock();
316 return -EINVAL; 316 return -EINVAL;
diff --git a/net/atm/common.c b/net/atm/common.c
index e93e838069e8..63feea49fb13 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -46,7 +46,7 @@ static void __vcc_insert_socket(struct sock *sk)
46 struct atm_vcc *vcc = atm_sk(sk); 46 struct atm_vcc *vcc = atm_sk(sk);
47 struct hlist_head *head = &vcc_hash[vcc->vci & 47 struct hlist_head *head = &vcc_hash[vcc->vci &
48 (VCC_HTABLE_SIZE - 1)]; 48 (VCC_HTABLE_SIZE - 1)];
49 sk->sk_hashent = vcc->vci & (VCC_HTABLE_SIZE - 1); 49 sk->sk_hash = vcc->vci & (VCC_HTABLE_SIZE - 1);
50 sk_add_node(sk, head); 50 sk_add_node(sk, head);
51} 51}
52 52
@@ -178,8 +178,6 @@ static void vcc_destroy_socket(struct sock *sk)
178 if (vcc->push) 178 if (vcc->push)
179 vcc->push(vcc, NULL); /* atmarpd has no push */ 179 vcc->push(vcc, NULL); /* atmarpd has no push */
180 180
181 vcc_remove_socket(sk); /* no more receive */
182
183 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { 181 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
184 atm_return(vcc,skb->truesize); 182 atm_return(vcc,skb->truesize);
185 kfree_skb(skb); 183 kfree_skb(skb);
@@ -188,6 +186,8 @@ static void vcc_destroy_socket(struct sock *sk)
188 module_put(vcc->dev->ops->owner); 186 module_put(vcc->dev->ops->owner);
189 atm_dev_put(vcc->dev); 187 atm_dev_put(vcc->dev);
190 } 188 }
189
190 vcc_remove_socket(sk);
191} 191}
192 192
193 193
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c
index d89056ec44d4..a150198b05a3 100644
--- a/net/atm/ioctl.c
+++ b/net/atm/ioctl.c
@@ -105,17 +105,35 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
105 if (!error) 105 if (!error)
106 sock->state = SS_CONNECTED; 106 sock->state = SS_CONNECTED;
107 goto done; 107 goto done;
108 default: 108 case ATM_SETBACKEND:
109 case ATM_NEWBACKENDIF:
110 {
111 atm_backend_t backend;
112 error = get_user(backend, (atm_backend_t __user *) argp);
113 if (error)
114 goto done;
115 switch (backend) {
116 case ATM_BACKEND_PPP:
117 request_module("pppoatm");
118 break;
119 case ATM_BACKEND_BR2684:
120 request_module("br2684");
121 break;
122 }
123 }
124 break;
125 case ATMMPC_CTRL:
126 case ATMMPC_DATA:
127 request_module("mpoa");
128 break;
129 case ATMARPD_CTRL:
130 request_module("clip");
131 break;
132 case ATMLEC_CTRL:
133 request_module("lec");
109 break; 134 break;
110 } 135 }
111 136
112 if (cmd == ATMMPC_CTRL || cmd == ATMMPC_DATA)
113 request_module("mpoa");
114 if (cmd == ATMARPD_CTRL)
115 request_module("clip");
116 if (cmd == ATMLEC_CTRL)
117 request_module("lec");
118
119 error = -ENOIOCTLCMD; 137 error = -ENOIOCTLCMD;
120 138
121 down(&ioctl_mutex); 139 down(&ioctl_mutex);
diff --git a/net/atm/lec.c b/net/atm/lec.c
index a0752487026d..ad840b9afba8 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -686,9 +686,19 @@ static unsigned char lec_ctrl_magic[] = {
686 0x01, 686 0x01,
687 0x01 }; 687 0x01 };
688 688
689#define LEC_DATA_DIRECT_8023 2
690#define LEC_DATA_DIRECT_8025 3
691
692static int lec_is_data_direct(struct atm_vcc *vcc)
693{
694 return ((vcc->sap.blli[0].l3.tr9577.snap[4] == LEC_DATA_DIRECT_8023) ||
695 (vcc->sap.blli[0].l3.tr9577.snap[4] == LEC_DATA_DIRECT_8025));
696}
697
689static void 698static void
690lec_push(struct atm_vcc *vcc, struct sk_buff *skb) 699lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
691{ 700{
701 unsigned long flags;
692 struct net_device *dev = (struct net_device *)vcc->proto_data; 702 struct net_device *dev = (struct net_device *)vcc->proto_data;
693 struct lec_priv *priv = (struct lec_priv *)dev->priv; 703 struct lec_priv *priv = (struct lec_priv *)dev->priv;
694 704
@@ -728,7 +738,8 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
728 skb_queue_tail(&sk->sk_receive_queue, skb); 738 skb_queue_tail(&sk->sk_receive_queue, skb);
729 sk->sk_data_ready(sk, skb->len); 739 sk->sk_data_ready(sk, skb->len);
730 } else { /* Data frame, queue to protocol handlers */ 740 } else { /* Data frame, queue to protocol handlers */
731 unsigned char *dst; 741 struct lec_arp_table *entry;
742 unsigned char *src, *dst;
732 743
733 atm_return(vcc,skb->truesize); 744 atm_return(vcc,skb->truesize);
734 if (*(uint16_t *)skb->data == htons(priv->lecid) || 745 if (*(uint16_t *)skb->data == htons(priv->lecid) ||
@@ -741,10 +752,30 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
741 return; 752 return;
742 } 753 }
743#ifdef CONFIG_TR 754#ifdef CONFIG_TR
744 if (priv->is_trdev) dst = ((struct lecdatahdr_8025 *)skb->data)->h_dest; 755 if (priv->is_trdev)
756 dst = ((struct lecdatahdr_8025 *) skb->data)->h_dest;
745 else 757 else
746#endif 758#endif
747 dst = ((struct lecdatahdr_8023 *)skb->data)->h_dest; 759 dst = ((struct lecdatahdr_8023 *) skb->data)->h_dest;
760
761 /* If this is a Data Direct VCC, and the VCC does not match
762 * the LE_ARP cache entry, delete the LE_ARP cache entry.
763 */
764 spin_lock_irqsave(&priv->lec_arp_lock, flags);
765 if (lec_is_data_direct(vcc)) {
766#ifdef CONFIG_TR
767 if (priv->is_trdev)
768 src = ((struct lecdatahdr_8025 *) skb->data)->h_source;
769 else
770#endif
771 src = ((struct lecdatahdr_8023 *) skb->data)->h_source;
772 entry = lec_arp_find(priv, src);
773 if (entry && entry->vcc != vcc) {
774 lec_arp_remove(priv, entry);
775 kfree(entry);
776 }
777 }
778 spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
748 779
749 if (!(dst[0]&0x01) && /* Never filter Multi/Broadcast */ 780 if (!(dst[0]&0x01) && /* Never filter Multi/Broadcast */
750 !priv->is_proxy && /* Proxy wants all the packets */ 781 !priv->is_proxy && /* Proxy wants all the packets */
@@ -1990,6 +2021,12 @@ lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find,
1990 found = entry->vcc; 2021 found = entry->vcc;
1991 goto out; 2022 goto out;
1992 } 2023 }
2024 /* If the LE_ARP cache entry is still pending, reset count to 0
2025 * so another LE_ARP request can be made for this frame.
2026 */
2027 if (entry->status == ESI_ARP_PENDING) {
2028 entry->no_tries = 0;
2029 }
1993 /* Data direct VC not yet set up, check to see if the unknown 2030 /* Data direct VC not yet set up, check to see if the unknown
1994 frame count is greater than the limit. If the limit has 2031 frame count is greater than the limit. If the limit has
1995 not been reached, allow the caller to send packet to 2032 not been reached, allow the caller to send packet to
diff --git a/net/atm/resources.c b/net/atm/resources.c
index a57a9268bd24..415d2615d475 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -40,6 +40,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
40 dev->link_rate = ATM_OC3_PCR; 40 dev->link_rate = ATM_OC3_PCR;
41 spin_lock_init(&dev->lock); 41 spin_lock_init(&dev->lock);
42 INIT_LIST_HEAD(&dev->local); 42 INIT_LIST_HEAD(&dev->local);
43 INIT_LIST_HEAD(&dev->lecs);
43 44
44 return dev; 45 return dev;
45} 46}
@@ -320,10 +321,12 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
320 error = -EPERM; 321 error = -EPERM;
321 goto done; 322 goto done;
322 } 323 }
323 atm_reset_addr(dev); 324 atm_reset_addr(dev, ATM_ADDR_LOCAL);
324 break; 325 break;
325 case ATM_ADDADDR: 326 case ATM_ADDADDR:
326 case ATM_DELADDR: 327 case ATM_DELADDR:
328 case ATM_ADDLECSADDR:
329 case ATM_DELLECSADDR:
327 if (!capable(CAP_NET_ADMIN)) { 330 if (!capable(CAP_NET_ADMIN)) {
328 error = -EPERM; 331 error = -EPERM;
329 goto done; 332 goto done;
@@ -335,14 +338,21 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
335 error = -EFAULT; 338 error = -EFAULT;
336 goto done; 339 goto done;
337 } 340 }
338 if (cmd == ATM_ADDADDR) 341 if (cmd == ATM_ADDADDR || cmd == ATM_ADDLECSADDR)
339 error = atm_add_addr(dev, &addr); 342 error = atm_add_addr(dev, &addr,
343 (cmd == ATM_ADDADDR ?
344 ATM_ADDR_LOCAL : ATM_ADDR_LECS));
340 else 345 else
341 error = atm_del_addr(dev, &addr); 346 error = atm_del_addr(dev, &addr,
347 (cmd == ATM_DELADDR ?
348 ATM_ADDR_LOCAL : ATM_ADDR_LECS));
342 goto done; 349 goto done;
343 } 350 }
344 case ATM_GETADDR: 351 case ATM_GETADDR:
345 error = atm_get_addr(dev, buf, len); 352 case ATM_GETLECSADDR:
353 error = atm_get_addr(dev, buf, len,
354 (cmd == ATM_GETADDR ?
355 ATM_ADDR_LOCAL : ATM_ADDR_LECS));
346 if (error < 0) 356 if (error < 0)
347 goto done; 357 goto done;
348 size = error; 358 size = error;
diff --git a/net/atm/signaling.c b/net/atm/signaling.c
index f7c449ac1800..e7211a7f382c 100644
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -217,8 +217,9 @@ void sigd_enq(struct atm_vcc *vcc,enum atmsvc_msg_type type,
217static void purge_vcc(struct atm_vcc *vcc) 217static void purge_vcc(struct atm_vcc *vcc)
218{ 218{
219 if (sk_atm(vcc)->sk_family == PF_ATMSVC && 219 if (sk_atm(vcc)->sk_family == PF_ATMSVC &&
220 !test_bit(ATM_VF_META,&vcc->flags)) { 220 !test_bit(ATM_VF_META, &vcc->flags)) {
221 set_bit(ATM_VF_RELEASED,&vcc->flags); 221 set_bit(ATM_VF_RELEASED, &vcc->flags);
222 clear_bit(ATM_VF_REGIS, &vcc->flags);
222 vcc_release_async(vcc, -EUNATCH); 223 vcc_release_async(vcc, -EUNATCH);
223 } 224 }
224} 225}
@@ -243,8 +244,7 @@ static void sigd_close(struct atm_vcc *vcc)
243 sk_for_each(s, node, head) { 244 sk_for_each(s, node, head) {
244 struct atm_vcc *vcc = atm_sk(s); 245 struct atm_vcc *vcc = atm_sk(s);
245 246
246 if (vcc->dev) 247 purge_vcc(vcc);
247 purge_vcc(vcc);
248 } 248 }
249 } 249 }
250 read_unlock(&vcc_sklist_lock); 250 read_unlock(&vcc_sklist_lock);
diff --git a/net/atm/svc.c b/net/atm/svc.c
index 08e46052a3e4..d7b266136bf6 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -302,6 +302,7 @@ static int svc_listen(struct socket *sock,int backlog)
302 error = -EINVAL; 302 error = -EINVAL;
303 goto out; 303 goto out;
304 } 304 }
305 vcc_insert_socket(sk);
305 set_bit(ATM_VF_WAITING, &vcc->flags); 306 set_bit(ATM_VF_WAITING, &vcc->flags);
306 prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); 307 prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
307 sigd_enq(vcc,as_listen,NULL,NULL,&vcc->local); 308 sigd_enq(vcc,as_listen,NULL,NULL,&vcc->local);
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 810c9c76c2e0..73cfc3411c46 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -123,7 +123,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
123 } 123 }
124 124
125 skb_pull(skb, 1); /* Remove PID */ 125 skb_pull(skb, 1); /* Remove PID */
126 skb->h.raw = skb->data; 126 skb->mac.raw = skb->nh.raw;
127 skb->nh.raw = skb->data; 127 skb->nh.raw = skb->data;
128 skb->dev = ax25->ax25_dev->dev; 128 skb->dev = ax25->ax25_dev->dev;
129 skb->pkt_type = PACKET_HOST; 129 skb->pkt_type = PACKET_HOST;
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index d3d6bc547212..59b2dd36baa7 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -372,7 +372,7 @@ static struct proto l2cap_proto = {
372 .obj_size = sizeof(struct l2cap_pinfo) 372 .obj_size = sizeof(struct l2cap_pinfo)
373}; 373};
374 374
375static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) 375static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, gfp_t prio)
376{ 376{
377 struct sock *sk; 377 struct sock *sk;
378 378
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 173f46e8cdae..35adce6482b6 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -229,7 +229,7 @@ static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d)
229 d->rx_credits = RFCOMM_DEFAULT_CREDITS; 229 d->rx_credits = RFCOMM_DEFAULT_CREDITS;
230} 230}
231 231
232struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio) 232struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio)
233{ 233{
234 struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio); 234 struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio);
235 if (!d) 235 if (!d)
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index f49e7e938bfb..a2b30f0aedb7 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -284,7 +284,7 @@ static struct proto rfcomm_proto = {
284 .obj_size = sizeof(struct rfcomm_pinfo) 284 .obj_size = sizeof(struct rfcomm_pinfo)
285}; 285};
286 286
287static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) 287static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, gfp_t prio)
288{ 288{
289 struct rfcomm_dlc *d; 289 struct rfcomm_dlc *d;
290 struct sock *sk; 290 struct sock *sk;
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 1bca860a6109..158a9c46d863 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -286,7 +286,7 @@ static inline void rfcomm_set_owner_w(struct sk_buff *skb, struct rfcomm_dev *de
286 skb->destructor = rfcomm_wfree; 286 skb->destructor = rfcomm_wfree;
287} 287}
288 288
289static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, unsigned int __nocast priority) 289static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, gfp_t priority)
290{ 290{
291 if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) { 291 if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) {
292 struct sk_buff *skb = alloc_skb(size, priority); 292 struct sk_buff *skb = alloc_skb(size, priority);
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index ce7ab7dfa0b2..997e42df115c 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -418,7 +418,7 @@ static struct proto sco_proto = {
418 .obj_size = sizeof(struct sco_pinfo) 418 .obj_size = sizeof(struct sco_pinfo)
419}; 419};
420 420
421static struct sock *sco_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) 421static struct sock *sco_sock_alloc(struct socket *sock, int proto, gfp_t prio)
422{ 422{
423 struct sock *sk; 423 struct sock *sk;
424 424
diff --git a/net/core/datagram.c b/net/core/datagram.c
index da9bf71421a7..81987df536eb 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -211,74 +211,45 @@ void skb_free_datagram(struct sock *sk, struct sk_buff *skb)
211int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset, 211int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset,
212 struct iovec *to, int len) 212 struct iovec *to, int len)
213{ 213{
214 int start = skb_headlen(skb); 214 int i, err, fraglen, end = 0;
215 int i, copy = start - offset; 215 struct sk_buff *next = skb_shinfo(skb)->frag_list;
216 216next_skb:
217 /* Copy header. */ 217 fraglen = skb_headlen(skb);
218 if (copy > 0) { 218 i = -1;
219 if (copy > len)
220 copy = len;
221 if (memcpy_toiovec(to, skb->data + offset, copy))
222 goto fault;
223 if ((len -= copy) == 0)
224 return 0;
225 offset += copy;
226 }
227 219
228 /* Copy paged appendix. Hmm... why does this look so complicated? */ 220 while (1) {
229 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 221 int start = end;
230 int end;
231
232 BUG_TRAP(start <= offset + len);
233 222
234 end = start + skb_shinfo(skb)->frags[i].size; 223 if ((end += fraglen) > offset) {
235 if ((copy = end - offset) > 0) { 224 int copy = end - offset, o = offset - start;
236 int err;
237 u8 *vaddr;
238 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
239 struct page *page = frag->page;
240 225
241 if (copy > len) 226 if (copy > len)
242 copy = len; 227 copy = len;
243 vaddr = kmap(page); 228 if (i == -1)
244 err = memcpy_toiovec(to, vaddr + frag->page_offset + 229 err = memcpy_toiovec(to, skb->data + o, copy);
245 offset - start, copy); 230 else {
246 kunmap(page); 231 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
232 struct page *page = frag->page;
233 void *p = kmap(page) + frag->page_offset + o;
234 err = memcpy_toiovec(to, p, copy);
235 kunmap(page);
236 }
247 if (err) 237 if (err)
248 goto fault; 238 goto fault;
249 if (!(len -= copy)) 239 if (!(len -= copy))
250 return 0; 240 return 0;
251 offset += copy; 241 offset += copy;
252 } 242 }
253 start = end; 243 if (++i >= skb_shinfo(skb)->nr_frags)
244 break;
245 fraglen = skb_shinfo(skb)->frags[i].size;
254 } 246 }
255 247 if (next) {
256 if (skb_shinfo(skb)->frag_list) { 248 skb = next;
257 struct sk_buff *list = skb_shinfo(skb)->frag_list; 249 BUG_ON(skb_shinfo(skb)->frag_list);
258 250 next = skb->next;
259 for (; list; list = list->next) { 251 goto next_skb;
260 int end;
261
262 BUG_TRAP(start <= offset + len);
263
264 end = start + list->len;
265 if ((copy = end - offset) > 0) {
266 if (copy > len)
267 copy = len;
268 if (skb_copy_datagram_iovec(list,
269 offset - start,
270 to, copy))
271 goto fault;
272 if ((len -= copy) == 0)
273 return 0;
274 offset += copy;
275 }
276 start = end;
277 }
278 } 252 }
279 if (!len)
280 return 0;
281
282fault: 253fault:
283 return -EFAULT; 254 return -EFAULT;
284} 255}
diff --git a/net/core/dev.c b/net/core/dev.c
index 37c881070963..a44eeef24edf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1132,7 +1132,7 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
1132#endif 1132#endif
1133 1133
1134/* Keep head the same: replace data */ 1134/* Keep head the same: replace data */
1135int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp_mask) 1135int __skb_linearize(struct sk_buff *skb, gfp_t gfp_mask)
1136{ 1136{
1137 unsigned int size; 1137 unsigned int size;
1138 u8 *data; 1138 u8 *data;
@@ -1259,6 +1259,8 @@ int dev_queue_xmit(struct sk_buff *skb)
1259 if (skb_checksum_help(skb, 0)) 1259 if (skb_checksum_help(skb, 0))
1260 goto out_kfree_skb; 1260 goto out_kfree_skb;
1261 1261
1262 spin_lock_prefetch(&dev->queue_lock);
1263
1262 /* Disable soft irqs for various locks below. Also 1264 /* Disable soft irqs for various locks below. Also
1263 * stops preemption for RCU. 1265 * stops preemption for RCU.
1264 */ 1266 */
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 5265dfd69928..802fe11efad0 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -703,7 +703,7 @@ int netpoll_setup(struct netpoll *np)
703 703
704 if (!np->local_ip) { 704 if (!np->local_ip) {
705 rcu_read_lock(); 705 rcu_read_lock();
706 in_dev = __in_dev_get(ndev); 706 in_dev = __in_dev_get_rcu(ndev);
707 707
708 if (!in_dev || !in_dev->ifa_list) { 708 if (!in_dev || !in_dev->ifa_list) {
709 rcu_read_unlock(); 709 rcu_read_unlock();
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index ef430b1e8e42..5f043d346694 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -186,7 +186,7 @@
186 186
187/* Used to help with determining the pkts on receive */ 187/* Used to help with determining the pkts on receive */
188#define PKTGEN_MAGIC 0xbe9be955 188#define PKTGEN_MAGIC 0xbe9be955
189#define PG_PROC_DIR "pktgen" 189#define PG_PROC_DIR "net/pktgen"
190 190
191#define MAX_CFLOWS 65536 191#define MAX_CFLOWS 65536
192 192
@@ -1476,18 +1476,7 @@ static int proc_thread_write(struct file *file, const char __user *user_buffer,
1476 1476
1477static int create_proc_dir(void) 1477static int create_proc_dir(void)
1478{ 1478{
1479 int len; 1479 pg_proc_dir = proc_mkdir(PG_PROC_DIR, NULL);
1480 /* does proc_dir already exists */
1481 len = strlen(PG_PROC_DIR);
1482
1483 for (pg_proc_dir = proc_net->subdir; pg_proc_dir; pg_proc_dir=pg_proc_dir->next) {
1484 if ((pg_proc_dir->namelen == len) &&
1485 (! memcmp(pg_proc_dir->name, PG_PROC_DIR, len)))
1486 break;
1487 }
1488
1489 if (!pg_proc_dir)
1490 pg_proc_dir = create_proc_entry(PG_PROC_DIR, S_IFDIR, proc_net);
1491 1480
1492 if (!pg_proc_dir) 1481 if (!pg_proc_dir)
1493 return -ENODEV; 1482 return -ENODEV;
@@ -1497,7 +1486,7 @@ static int create_proc_dir(void)
1497 1486
1498static int remove_proc_dir(void) 1487static int remove_proc_dir(void)
1499{ 1488{
1500 remove_proc_entry(PG_PROC_DIR, proc_net); 1489 remove_proc_entry(PG_PROC_DIR, NULL);
1501 return 0; 1490 return 0;
1502} 1491}
1503 1492
@@ -1678,13 +1667,12 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
1678 struct in_device *in_dev; 1667 struct in_device *in_dev;
1679 1668
1680 rcu_read_lock(); 1669 rcu_read_lock();
1681 in_dev = __in_dev_get(pkt_dev->odev); 1670 in_dev = __in_dev_get_rcu(pkt_dev->odev);
1682 if (in_dev) { 1671 if (in_dev) {
1683 if (in_dev->ifa_list) { 1672 if (in_dev->ifa_list) {
1684 pkt_dev->saddr_min = in_dev->ifa_list->ifa_address; 1673 pkt_dev->saddr_min = in_dev->ifa_list->ifa_address;
1685 pkt_dev->saddr_max = pkt_dev->saddr_min; 1674 pkt_dev->saddr_max = pkt_dev->saddr_min;
1686 } 1675 }
1687 __in_dev_put(in_dev);
1688 } 1676 }
1689 rcu_read_unlock(); 1677 rcu_read_unlock();
1690 } 1678 }
@@ -2908,7 +2896,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char* ifname)
2908 pkt_dev->udp_dst_max = 9; 2896 pkt_dev->udp_dst_max = 9;
2909 2897
2910 strncpy(pkt_dev->ifname, ifname, 31); 2898 strncpy(pkt_dev->ifname, ifname, 31);
2911 sprintf(pkt_dev->fname, "net/%s/%s", PG_PROC_DIR, ifname); 2899 sprintf(pkt_dev->fname, "%s/%s", PG_PROC_DIR, ifname);
2912 2900
2913 if (! pktgen_setup_dev(pkt_dev)) { 2901 if (! pktgen_setup_dev(pkt_dev)) {
2914 printk("pktgen: ERROR: pktgen_setup_dev failed.\n"); 2902 printk("pktgen: ERROR: pktgen_setup_dev failed.\n");
@@ -2981,7 +2969,7 @@ static int pktgen_create_thread(const char* name, int cpu)
2981 spin_lock_init(&t->if_lock); 2969 spin_lock_init(&t->if_lock);
2982 t->cpu = cpu; 2970 t->cpu = cpu;
2983 2971
2984 sprintf(t->fname, "net/%s/%s", PG_PROC_DIR, t->name); 2972 sprintf(t->fname, "%s/%s", PG_PROC_DIR, t->name);
2985 t->proc_ent = create_proc_entry(t->fname, 0600, NULL); 2973 t->proc_ent = create_proc_entry(t->fname, 0600, NULL);
2986 if (!t->proc_ent) { 2974 if (!t->proc_ent) {
2987 printk("pktgen: cannot create %s procfs entry.\n", t->fname); 2975 printk("pktgen: cannot create %s procfs entry.\n", t->fname);
@@ -3064,7 +3052,7 @@ static int __init pg_init(void)
3064 3052
3065 create_proc_dir(); 3053 create_proc_dir();
3066 3054
3067 sprintf(module_fname, "net/%s/pgctrl", PG_PROC_DIR); 3055 sprintf(module_fname, "%s/pgctrl", PG_PROC_DIR);
3068 module_proc_ent = create_proc_entry(module_fname, 0600, NULL); 3056 module_proc_ent = create_proc_entry(module_fname, 0600, NULL);
3069 if (!module_proc_ent) { 3057 if (!module_proc_ent) {
3070 printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname); 3058 printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f80a28785610..af9b1516e21f 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -71,8 +71,6 @@
71static kmem_cache_t *skbuff_head_cache __read_mostly; 71static kmem_cache_t *skbuff_head_cache __read_mostly;
72static kmem_cache_t *skbuff_fclone_cache __read_mostly; 72static kmem_cache_t *skbuff_fclone_cache __read_mostly;
73 73
74struct timeval __read_mostly skb_tv_base;
75
76/* 74/*
77 * Keep out-of-line to prevent kernel bloat. 75 * Keep out-of-line to prevent kernel bloat.
78 * __builtin_return_address is not used because it is not always 76 * __builtin_return_address is not used because it is not always
@@ -132,7 +130,7 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
132 * Buffers may only be allocated from interrupts using a @gfp_mask of 130 * Buffers may only be allocated from interrupts using a @gfp_mask of
133 * %GFP_ATOMIC. 131 * %GFP_ATOMIC.
134 */ 132 */
135struct sk_buff *__alloc_skb(unsigned int size, unsigned int __nocast gfp_mask, 133struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
136 int fclone) 134 int fclone)
137{ 135{
138 struct sk_buff *skb; 136 struct sk_buff *skb;
@@ -200,7 +198,7 @@ nodata:
200 */ 198 */
201struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 199struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
202 unsigned int size, 200 unsigned int size,
203 unsigned int __nocast gfp_mask) 201 gfp_t gfp_mask)
204{ 202{
205 struct sk_buff *skb; 203 struct sk_buff *skb;
206 u8 *data; 204 u8 *data;
@@ -363,7 +361,7 @@ void __kfree_skb(struct sk_buff *skb)
363 * %GFP_ATOMIC. 361 * %GFP_ATOMIC.
364 */ 362 */
365 363
366struct sk_buff *skb_clone(struct sk_buff *skb, unsigned int __nocast gfp_mask) 364struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
367{ 365{
368 struct sk_buff *n; 366 struct sk_buff *n;
369 367
@@ -502,7 +500,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
502 * header is going to be modified. Use pskb_copy() instead. 500 * header is going to be modified. Use pskb_copy() instead.
503 */ 501 */
504 502
505struct sk_buff *skb_copy(const struct sk_buff *skb, unsigned int __nocast gfp_mask) 503struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
506{ 504{
507 int headerlen = skb->data - skb->head; 505 int headerlen = skb->data - skb->head;
508 /* 506 /*
@@ -541,7 +539,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, unsigned int __nocast gfp_ma
541 * The returned buffer has a reference count of 1. 539 * The returned buffer has a reference count of 1.
542 */ 540 */
543 541
544struct sk_buff *pskb_copy(struct sk_buff *skb, unsigned int __nocast gfp_mask) 542struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask)
545{ 543{
546 /* 544 /*
547 * Allocate the copy buffer 545 * Allocate the copy buffer
@@ -600,7 +598,7 @@ out:
600 */ 598 */
601 599
602int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, 600int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
603 unsigned int __nocast gfp_mask) 601 gfp_t gfp_mask)
604{ 602{
605 int i; 603 int i;
606 u8 *data; 604 u8 *data;
@@ -691,7 +689,7 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
691 */ 689 */
692struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 690struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
693 int newheadroom, int newtailroom, 691 int newheadroom, int newtailroom,
694 unsigned int __nocast gfp_mask) 692 gfp_t gfp_mask)
695{ 693{
696 /* 694 /*
697 * Allocate the copy buffer 695 * Allocate the copy buffer
@@ -1708,8 +1706,6 @@ void __init skb_init(void)
1708 NULL, NULL); 1706 NULL, NULL);
1709 if (!skbuff_fclone_cache) 1707 if (!skbuff_fclone_cache)
1710 panic("cannot create skbuff cache"); 1708 panic("cannot create skbuff cache");
1711
1712 do_gettimeofday(&skb_tv_base);
1713} 1709}
1714 1710
1715EXPORT_SYMBOL(___pskb_trim); 1711EXPORT_SYMBOL(___pskb_trim);
@@ -1743,4 +1739,3 @@ EXPORT_SYMBOL(skb_prepare_seq_read);
1743EXPORT_SYMBOL(skb_seq_read); 1739EXPORT_SYMBOL(skb_seq_read);
1744EXPORT_SYMBOL(skb_abort_seq_read); 1740EXPORT_SYMBOL(skb_abort_seq_read);
1745EXPORT_SYMBOL(skb_find_text); 1741EXPORT_SYMBOL(skb_find_text);
1746EXPORT_SYMBOL(skb_tv_base);
diff --git a/net/core/sock.c b/net/core/sock.c
index ac63b56e23b2..1c52fe809eda 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -637,7 +637,7 @@ lenout:
637 * @prot: struct proto associated with this new sock instance 637 * @prot: struct proto associated with this new sock instance
638 * @zero_it: if we should zero the newly allocated sock 638 * @zero_it: if we should zero the newly allocated sock
639 */ 639 */
640struct sock *sk_alloc(int family, unsigned int __nocast priority, 640struct sock *sk_alloc(int family, gfp_t priority,
641 struct proto *prot, int zero_it) 641 struct proto *prot, int zero_it)
642{ 642{
643 struct sock *sk = NULL; 643 struct sock *sk = NULL;
@@ -660,16 +660,20 @@ struct sock *sk_alloc(int family, unsigned int __nocast priority,
660 sock_lock_init(sk); 660 sock_lock_init(sk);
661 } 661 }
662 662
663 if (security_sk_alloc(sk, family, priority)) { 663 if (security_sk_alloc(sk, family, priority))
664 if (slab != NULL) 664 goto out_free;
665 kmem_cache_free(slab, sk); 665
666 else 666 if (!try_module_get(prot->owner))
667 kfree(sk); 667 goto out_free;
668 sk = NULL;
669 } else
670 __module_get(prot->owner);
671 } 668 }
672 return sk; 669 return sk;
670
671out_free:
672 if (slab != NULL)
673 kmem_cache_free(slab, sk);
674 else
675 kfree(sk);
676 return NULL;
673} 677}
674 678
675void sk_free(struct sock *sk) 679void sk_free(struct sock *sk)
@@ -700,7 +704,7 @@ void sk_free(struct sock *sk)
700 module_put(owner); 704 module_put(owner);
701} 705}
702 706
703struct sock *sk_clone(const struct sock *sk, const unsigned int __nocast priority) 707struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
704{ 708{
705 struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0); 709 struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0);
706 710
@@ -841,7 +845,7 @@ unsigned long sock_i_ino(struct sock *sk)
841 * Allocate a skb from the socket's send buffer. 845 * Allocate a skb from the socket's send buffer.
842 */ 846 */
843struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, 847struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
844 unsigned int __nocast priority) 848 gfp_t priority)
845{ 849{
846 if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { 850 if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
847 struct sk_buff * skb = alloc_skb(size, priority); 851 struct sk_buff * skb = alloc_skb(size, priority);
@@ -857,7 +861,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
857 * Allocate a skb from the socket's receive buffer. 861 * Allocate a skb from the socket's receive buffer.
858 */ 862 */
859struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, 863struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
860 unsigned int __nocast priority) 864 gfp_t priority)
861{ 865{
862 if (force || atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf) { 866 if (force || atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf) {
863 struct sk_buff *skb = alloc_skb(size, priority); 867 struct sk_buff *skb = alloc_skb(size, priority);
@@ -872,7 +876,7 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
872/* 876/*
873 * Allocate a memory block from the socket's option memory buffer. 877 * Allocate a memory block from the socket's option memory buffer.
874 */ 878 */
875void *sock_kmalloc(struct sock *sk, int size, unsigned int __nocast priority) 879void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
876{ 880{
877 if ((unsigned)size <= sysctl_optmem_max && 881 if ((unsigned)size <= sysctl_optmem_max &&
878 atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { 882 atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) {
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index 6530283eafca..c9a62cca22fc 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -91,7 +91,7 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb)
91} 91}
92 92
93struct dccp_ackvec *dccp_ackvec_alloc(const unsigned int len, 93struct dccp_ackvec *dccp_ackvec_alloc(const unsigned int len,
94 const unsigned int __nocast priority) 94 const gfp_t priority)
95{ 95{
96 struct dccp_ackvec *av = kmalloc(sizeof(*av) + len, priority); 96 struct dccp_ackvec *av = kmalloc(sizeof(*av) + len, priority);
97 97
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h
index 8ca51c9191f7..d0fd6c60c574 100644
--- a/net/dccp/ackvec.h
+++ b/net/dccp/ackvec.h
@@ -74,7 +74,7 @@ struct sk_buff;
74 74
75#ifdef CONFIG_IP_DCCP_ACKVEC 75#ifdef CONFIG_IP_DCCP_ACKVEC
76extern struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len, 76extern struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len,
77 const unsigned int __nocast priority); 77 const gfp_t priority);
78extern void dccp_ackvec_free(struct dccp_ackvec *av); 78extern void dccp_ackvec_free(struct dccp_ackvec *av);
79 79
80extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, 80extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
@@ -93,7 +93,7 @@ static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
93} 93}
94#else /* CONFIG_IP_DCCP_ACKVEC */ 94#else /* CONFIG_IP_DCCP_ACKVEC */
95static inline struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len, 95static inline struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len,
96 const unsigned int __nocast priority) 96 const gfp_t priority)
97{ 97{
98 return NULL; 98 return NULL;
99} 99}
diff --git a/net/dccp/ccids/lib/loss_interval.h b/net/dccp/ccids/lib/loss_interval.h
index 13ad47ba1420..417d9d82df3e 100644
--- a/net/dccp/ccids/lib/loss_interval.h
+++ b/net/dccp/ccids/lib/loss_interval.h
@@ -36,7 +36,7 @@ struct dccp_li_hist_entry {
36 36
37static inline struct dccp_li_hist_entry * 37static inline struct dccp_li_hist_entry *
38 dccp_li_hist_entry_new(struct dccp_li_hist *hist, 38 dccp_li_hist_entry_new(struct dccp_li_hist *hist,
39 const unsigned int __nocast prio) 39 const gfp_t prio)
40{ 40{
41 return kmem_cache_alloc(hist->dccplih_slab, prio); 41 return kmem_cache_alloc(hist->dccplih_slab, prio);
42} 42}
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h
index b375ebdb7dcf..122e96737ff6 100644
--- a/net/dccp/ccids/lib/packet_history.h
+++ b/net/dccp/ccids/lib/packet_history.h
@@ -86,7 +86,7 @@ extern struct dccp_rx_hist_entry *
86 86
87static inline struct dccp_tx_hist_entry * 87static inline struct dccp_tx_hist_entry *
88 dccp_tx_hist_entry_new(struct dccp_tx_hist *hist, 88 dccp_tx_hist_entry_new(struct dccp_tx_hist *hist,
89 const unsigned int __nocast prio) 89 const gfp_t prio)
90{ 90{
91 struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab, 91 struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab,
92 prio); 92 prio);
@@ -137,7 +137,7 @@ static inline struct dccp_rx_hist_entry *
137 const struct sock *sk, 137 const struct sock *sk,
138 const u32 ndp, 138 const u32 ndp,
139 const struct sk_buff *skb, 139 const struct sk_buff *skb,
140 const unsigned int __nocast prio) 140 const gfp_t prio)
141{ 141{
142 struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab, 142 struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab,
143 prio); 143 prio);
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 40fe6afacde6..ae088d1347af 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -62,27 +62,27 @@ static int __dccp_v4_check_established(struct sock *sk, const __u16 lport,
62 const int dif = sk->sk_bound_dev_if; 62 const int dif = sk->sk_bound_dev_if;
63 INET_ADDR_COOKIE(acookie, saddr, daddr) 63 INET_ADDR_COOKIE(acookie, saddr, daddr)
64 const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport); 64 const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport);
65 const int hash = inet_ehashfn(daddr, lport, saddr, inet->dport, 65 unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport);
66 dccp_hashinfo.ehash_size); 66 struct inet_ehash_bucket *head = inet_ehash_bucket(&dccp_hashinfo, hash);
67 struct inet_ehash_bucket *head = &dccp_hashinfo.ehash[hash];
68 const struct sock *sk2; 67 const struct sock *sk2;
69 const struct hlist_node *node; 68 const struct hlist_node *node;
70 struct inet_timewait_sock *tw; 69 struct inet_timewait_sock *tw;
71 70
71 prefetch(head->chain.first);
72 write_lock(&head->lock); 72 write_lock(&head->lock);
73 73
74 /* Check TIME-WAIT sockets first. */ 74 /* Check TIME-WAIT sockets first. */
75 sk_for_each(sk2, node, &(head + dccp_hashinfo.ehash_size)->chain) { 75 sk_for_each(sk2, node, &(head + dccp_hashinfo.ehash_size)->chain) {
76 tw = inet_twsk(sk2); 76 tw = inet_twsk(sk2);
77 77
78 if (INET_TW_MATCH(sk2, acookie, saddr, daddr, ports, dif)) 78 if (INET_TW_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif))
79 goto not_unique; 79 goto not_unique;
80 } 80 }
81 tw = NULL; 81 tw = NULL;
82 82
83 /* And established part... */ 83 /* And established part... */
84 sk_for_each(sk2, node, &head->chain) { 84 sk_for_each(sk2, node, &head->chain) {
85 if (INET_MATCH(sk2, acookie, saddr, daddr, ports, dif)) 85 if (INET_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif))
86 goto not_unique; 86 goto not_unique;
87 } 87 }
88 88
@@ -90,7 +90,7 @@ static int __dccp_v4_check_established(struct sock *sk, const __u16 lport,
90 * in hash table socket with a funny identity. */ 90 * in hash table socket with a funny identity. */
91 inet->num = lport; 91 inet->num = lport;
92 inet->sport = htons(lport); 92 inet->sport = htons(lport);
93 sk->sk_hashent = hash; 93 sk->sk_hash = hash;
94 BUG_TRAP(sk_unhashed(sk)); 94 BUG_TRAP(sk_unhashed(sk));
95 __sk_add_node(sk, &head->chain); 95 __sk_add_node(sk, &head->chain);
96 sock_prot_inc_use(sk->sk_prot); 96 sock_prot_inc_use(sk->sk_prot);
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 348f36b529f7..1186dc44cdff 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -452,7 +452,7 @@ static struct proto dn_proto = {
452 .obj_size = sizeof(struct dn_sock), 452 .obj_size = sizeof(struct dn_sock),
453}; 453};
454 454
455static struct sock *dn_alloc_sock(struct socket *sock, int gfp) 455static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp)
456{ 456{
457 struct dn_scp *scp; 457 struct dn_scp *scp;
458 struct sock *sk = sk_alloc(PF_DECnet, gfp, &dn_proto, 1); 458 struct sock *sk = sk_alloc(PF_DECnet, gfp, &dn_proto, 1);
@@ -804,7 +804,7 @@ static int dn_auto_bind(struct socket *sock)
804 return rv; 804 return rv;
805} 805}
806 806
807static int dn_confirm_accept(struct sock *sk, long *timeo, int allocation) 807static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
808{ 808{
809 struct dn_scp *scp = DN_SK(sk); 809 struct dn_scp *scp = DN_SK(sk);
810 DEFINE_WAIT(wait); 810 DEFINE_WAIT(wait);
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index 53633d352868..c96c767b1f74 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -117,7 +117,7 @@ try_again:
117 * The eventual aim is for each socket to have a cached header size 117 * The eventual aim is for each socket to have a cached header size
118 * for its outgoing packets, and to set hdr from this when sk != NULL. 118 * for its outgoing packets, and to set hdr from this when sk != NULL.
119 */ 119 */
120struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri) 120struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri)
121{ 121{
122 struct sk_buff *skb; 122 struct sk_buff *skb;
123 int hdr = 64; 123 int hdr = 64;
@@ -210,7 +210,8 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)
210 * 210 *
211 * Returns: The number of times the packet has been sent previously 211 * Returns: The number of times the packet has been sent previously
212 */ 212 */
213static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb, int gfp) 213static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb,
214 gfp_t gfp)
214{ 215{
215 struct dn_skb_cb *cb = DN_SKB_CB(skb); 216 struct dn_skb_cb *cb = DN_SKB_CB(skb);
216 struct sk_buff *skb2; 217 struct sk_buff *skb2;
@@ -350,7 +351,8 @@ static unsigned short *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *sk
350 return ptr; 351 return ptr;
351} 352}
352 353
353void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, int gfp, int oth) 354void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb,
355 gfp_t gfp, int oth)
354{ 356{
355 struct dn_scp *scp = DN_SK(sk); 357 struct dn_scp *scp = DN_SK(sk);
356 struct dn_skb_cb *cb = DN_SKB_CB(skb); 358 struct dn_skb_cb *cb = DN_SKB_CB(skb);
@@ -517,7 +519,7 @@ static int dn_nsp_retrans_conn_conf(struct sock *sk)
517 return 0; 519 return 0;
518} 520}
519 521
520void dn_send_conn_conf(struct sock *sk, int gfp) 522void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
521{ 523{
522 struct dn_scp *scp = DN_SK(sk); 524 struct dn_scp *scp = DN_SK(sk);
523 struct sk_buff *skb = NULL; 525 struct sk_buff *skb = NULL;
@@ -549,7 +551,8 @@ void dn_send_conn_conf(struct sock *sk, int gfp)
549 551
550 552
551static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, 553static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
552 unsigned short reason, int gfp, struct dst_entry *dst, 554 unsigned short reason, gfp_t gfp,
555 struct dst_entry *dst,
553 int ddl, unsigned char *dd, __u16 rem, __u16 loc) 556 int ddl, unsigned char *dd, __u16 rem, __u16 loc)
554{ 557{
555 struct sk_buff *skb = NULL; 558 struct sk_buff *skb = NULL;
@@ -591,7 +594,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
591 594
592 595
593void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, 596void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
594 unsigned short reason, int gfp) 597 unsigned short reason, gfp_t gfp)
595{ 598{
596 struct dn_scp *scp = DN_SK(sk); 599 struct dn_scp *scp = DN_SK(sk);
597 int ddl = 0; 600 int ddl = 0;
@@ -612,7 +615,7 @@ void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg,
612{ 615{
613 struct dn_skb_cb *cb = DN_SKB_CB(skb); 616 struct dn_skb_cb *cb = DN_SKB_CB(skb);
614 int ddl = 0; 617 int ddl = 0;
615 int gfp = GFP_ATOMIC; 618 gfp_t gfp = GFP_ATOMIC;
616 619
617 dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, 620 dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl,
618 NULL, cb->src_port, cb->dst_port); 621 NULL, cb->src_port, cb->dst_port);
@@ -624,7 +627,7 @@ void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval)
624 struct dn_scp *scp = DN_SK(sk); 627 struct dn_scp *scp = DN_SK(sk);
625 struct sk_buff *skb; 628 struct sk_buff *skb;
626 unsigned char *ptr; 629 unsigned char *ptr;
627 int gfp = GFP_ATOMIC; 630 gfp_t gfp = GFP_ATOMIC;
628 631
629 if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL) 632 if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL)
630 return; 633 return;
@@ -659,7 +662,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
659 unsigned char menuver; 662 unsigned char menuver;
660 struct dn_skb_cb *cb; 663 struct dn_skb_cb *cb;
661 unsigned char type = 1; 664 unsigned char type = 1;
662 int allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC; 665 gfp_t allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC;
663 struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation); 666 struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation);
664 667
665 if (!skb) 668 if (!skb)
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 4a62093eb343..34fdac51df96 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -406,7 +406,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
406 unsigned long network = 0; 406 unsigned long network = 0;
407 407
408 rcu_read_lock(); 408 rcu_read_lock();
409 idev = __in_dev_get(dev); 409 idev = __in_dev_get_rcu(dev);
410 if (idev) { 410 if (idev) {
411 if (idev->ifa_list) 411 if (idev->ifa_list)
412 network = ntohl(idev->ifa_list->ifa_address) & 412 network = ntohl(idev->ifa_list->ifa_address) &
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 87a052a9a84f..68a5ca866442 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -146,6 +146,19 @@ int eth_rebuild_header(struct sk_buff *skb)
146 return 0; 146 return 0;
147} 147}
148 148
149static inline unsigned int compare_eth_addr(const unsigned char *__a, const unsigned char *__b)
150{
151 const unsigned short *dest = (unsigned short *) __a;
152 const unsigned short *devaddr = (unsigned short *) __b;
153 unsigned int res;
154
155 BUILD_BUG_ON(ETH_ALEN != 6);
156 res = ((dest[0] ^ devaddr[0]) |
157 (dest[1] ^ devaddr[1]) |
158 (dest[2] ^ devaddr[2])) != 0;
159
160 return res;
161}
149 162
150/* 163/*
151 * Determine the packet's protocol ID. The rule here is that we 164 * Determine the packet's protocol ID. The rule here is that we
@@ -158,16 +171,15 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
158 struct ethhdr *eth; 171 struct ethhdr *eth;
159 unsigned char *rawp; 172 unsigned char *rawp;
160 173
161 skb->mac.raw=skb->data; 174 skb->mac.raw = skb->data;
162 skb_pull(skb,ETH_HLEN); 175 skb_pull(skb,ETH_HLEN);
163 eth = eth_hdr(skb); 176 eth = eth_hdr(skb);
164 177
165 if(*eth->h_dest&1) 178 if (*eth->h_dest&1) {
166 { 179 if (!compare_eth_addr(eth->h_dest, dev->broadcast))
167 if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0) 180 skb->pkt_type = PACKET_BROADCAST;
168 skb->pkt_type=PACKET_BROADCAST;
169 else 181 else
170 skb->pkt_type=PACKET_MULTICAST; 182 skb->pkt_type = PACKET_MULTICAST;
171 } 183 }
172 184
173 /* 185 /*
@@ -178,10 +190,9 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
178 * seems to set IFF_PROMISC. 190 * seems to set IFF_PROMISC.
179 */ 191 */
180 192
181 else if(1 /*dev->flags&IFF_PROMISC*/) 193 else if(1 /*dev->flags&IFF_PROMISC*/) {
182 { 194 if (unlikely(compare_eth_addr(eth->h_dest, dev->dev_addr)))
183 if(memcmp(eth->h_dest,dev->dev_addr, ETH_ALEN)) 195 skb->pkt_type = PACKET_OTHERHOST;
184 skb->pkt_type=PACKET_OTHERHOST;
185 } 196 }
186 197
187 if (ntohs(eth->h_proto) >= 1536) 198 if (ntohs(eth->h_proto) >= 1536)
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c
index 03a47343ddc7..6059e9e37123 100644
--- a/net/ieee80211/ieee80211_module.c
+++ b/net/ieee80211/ieee80211_module.c
@@ -230,7 +230,7 @@ static int __init ieee80211_init(void)
230 struct proc_dir_entry *e; 230 struct proc_dir_entry *e;
231 231
232 ieee80211_debug_level = debug; 232 ieee80211_debug_level = debug;
233 ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net); 233 ieee80211_proc = proc_mkdir(DRV_NAME, proc_net);
234 if (ieee80211_proc == NULL) { 234 if (ieee80211_proc == NULL) {
235 IEEE80211_ERROR("Unable to create " DRV_NAME 235 IEEE80211_ERROR("Unable to create " DRV_NAME
236 " proc directory\n"); 236 " proc directory\n");
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index c9aaff3fea1e..eed07bbbe6b6 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -207,7 +207,7 @@ void ieee80211_txb_free(struct ieee80211_txb *txb)
207} 207}
208 208
209static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, 209static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
210 int gfp_mask) 210 gfp_t gfp_mask)
211{ 211{
212 struct ieee80211_txb *txb; 212 struct ieee80211_txb *txb;
213 int i; 213 int i;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 8bf312bdea13..b425748f02d7 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -241,7 +241,7 @@ static int arp_constructor(struct neighbour *neigh)
241 neigh->type = inet_addr_type(addr); 241 neigh->type = inet_addr_type(addr);
242 242
243 rcu_read_lock(); 243 rcu_read_lock();
244 in_dev = rcu_dereference(__in_dev_get(dev)); 244 in_dev = __in_dev_get_rcu(dev);
245 if (in_dev == NULL) { 245 if (in_dev == NULL) {
246 rcu_read_unlock(); 246 rcu_read_unlock();
247 return -EINVAL; 247 return -EINVAL;
@@ -697,12 +697,6 @@ void arp_send(int type, int ptype, u32 dest_ip,
697 arp_xmit(skb); 697 arp_xmit(skb);
698} 698}
699 699
700static void parp_redo(struct sk_buff *skb)
701{
702 nf_reset(skb);
703 arp_rcv(skb, skb->dev, NULL, skb->dev);
704}
705
706/* 700/*
707 * Process an arp request. 701 * Process an arp request.
708 */ 702 */
@@ -922,6 +916,11 @@ out:
922 return 0; 916 return 0;
923} 917}
924 918
919static void parp_redo(struct sk_buff *skb)
920{
921 arp_process(skb);
922}
923
925 924
926/* 925/*
927 * Receive an arp request from the device layer. 926 * Receive an arp request from the device layer.
@@ -990,8 +989,8 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev)
990 ipv4_devconf.proxy_arp = 1; 989 ipv4_devconf.proxy_arp = 1;
991 return 0; 990 return 0;
992 } 991 }
993 if (__in_dev_get(dev)) { 992 if (__in_dev_get_rtnl(dev)) {
994 __in_dev_get(dev)->cnf.proxy_arp = 1; 993 __in_dev_get_rtnl(dev)->cnf.proxy_arp = 1;
995 return 0; 994 return 0;
996 } 995 }
997 return -ENXIO; 996 return -ENXIO;
@@ -1096,8 +1095,8 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev)
1096 ipv4_devconf.proxy_arp = 0; 1095 ipv4_devconf.proxy_arp = 0;
1097 return 0; 1096 return 0;
1098 } 1097 }
1099 if (__in_dev_get(dev)) { 1098 if (__in_dev_get_rtnl(dev)) {
1100 __in_dev_get(dev)->cnf.proxy_arp = 0; 1099 __in_dev_get_rtnl(dev)->cnf.proxy_arp = 0;
1101 return 0; 1100 return 0;
1102 } 1101 }
1103 return -ENXIO; 1102 return -ENXIO;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index ba2895ae8151..74f2207e131a 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -351,7 +351,7 @@ static int inet_insert_ifa(struct in_ifaddr *ifa)
351 351
352static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) 352static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
353{ 353{
354 struct in_device *in_dev = __in_dev_get(dev); 354 struct in_device *in_dev = __in_dev_get_rtnl(dev);
355 355
356 ASSERT_RTNL(); 356 ASSERT_RTNL();
357 357
@@ -449,7 +449,7 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg
449 goto out; 449 goto out;
450 450
451 rc = -ENOBUFS; 451 rc = -ENOBUFS;
452 if ((in_dev = __in_dev_get(dev)) == NULL) { 452 if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) {
453 in_dev = inetdev_init(dev); 453 in_dev = inetdev_init(dev);
454 if (!in_dev) 454 if (!in_dev)
455 goto out; 455 goto out;
@@ -584,7 +584,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
584 if (colon) 584 if (colon)
585 *colon = ':'; 585 *colon = ':';
586 586
587 if ((in_dev = __in_dev_get(dev)) != NULL) { 587 if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) {
588 if (tryaddrmatch) { 588 if (tryaddrmatch) {
589 /* Matthias Andree */ 589 /* Matthias Andree */
590 /* compare label and address (4.4BSD style) */ 590 /* compare label and address (4.4BSD style) */
@@ -748,7 +748,7 @@ rarok:
748 748
749static int inet_gifconf(struct net_device *dev, char __user *buf, int len) 749static int inet_gifconf(struct net_device *dev, char __user *buf, int len)
750{ 750{
751 struct in_device *in_dev = __in_dev_get(dev); 751 struct in_device *in_dev = __in_dev_get_rtnl(dev);
752 struct in_ifaddr *ifa; 752 struct in_ifaddr *ifa;
753 struct ifreq ifr; 753 struct ifreq ifr;
754 int done = 0; 754 int done = 0;
@@ -791,7 +791,7 @@ u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope)
791 struct in_device *in_dev; 791 struct in_device *in_dev;
792 792
793 rcu_read_lock(); 793 rcu_read_lock();
794 in_dev = __in_dev_get(dev); 794 in_dev = __in_dev_get_rcu(dev);
795 if (!in_dev) 795 if (!in_dev)
796 goto no_in_dev; 796 goto no_in_dev;
797 797
@@ -818,7 +818,7 @@ no_in_dev:
818 read_lock(&dev_base_lock); 818 read_lock(&dev_base_lock);
819 rcu_read_lock(); 819 rcu_read_lock();
820 for (dev = dev_base; dev; dev = dev->next) { 820 for (dev = dev_base; dev; dev = dev->next) {
821 if ((in_dev = __in_dev_get(dev)) == NULL) 821 if ((in_dev = __in_dev_get_rcu(dev)) == NULL)
822 continue; 822 continue;
823 823
824 for_primary_ifa(in_dev) { 824 for_primary_ifa(in_dev) {
@@ -887,7 +887,7 @@ u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scop
887 887
888 if (dev) { 888 if (dev) {
889 rcu_read_lock(); 889 rcu_read_lock();
890 if ((in_dev = __in_dev_get(dev))) 890 if ((in_dev = __in_dev_get_rcu(dev)))
891 addr = confirm_addr_indev(in_dev, dst, local, scope); 891 addr = confirm_addr_indev(in_dev, dst, local, scope);
892 rcu_read_unlock(); 892 rcu_read_unlock();
893 893
@@ -897,7 +897,7 @@ u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scop
897 read_lock(&dev_base_lock); 897 read_lock(&dev_base_lock);
898 rcu_read_lock(); 898 rcu_read_lock();
899 for (dev = dev_base; dev; dev = dev->next) { 899 for (dev = dev_base; dev; dev = dev->next) {
900 if ((in_dev = __in_dev_get(dev))) { 900 if ((in_dev = __in_dev_get_rcu(dev))) {
901 addr = confirm_addr_indev(in_dev, dst, local, scope); 901 addr = confirm_addr_indev(in_dev, dst, local, scope);
902 if (addr) 902 if (addr)
903 break; 903 break;
@@ -957,7 +957,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
957 void *ptr) 957 void *ptr)
958{ 958{
959 struct net_device *dev = ptr; 959 struct net_device *dev = ptr;
960 struct in_device *in_dev = __in_dev_get(dev); 960 struct in_device *in_dev = __in_dev_get_rtnl(dev);
961 961
962 ASSERT_RTNL(); 962 ASSERT_RTNL();
963 963
@@ -1078,7 +1078,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
1078 if (idx > s_idx) 1078 if (idx > s_idx)
1079 s_ip_idx = 0; 1079 s_ip_idx = 0;
1080 rcu_read_lock(); 1080 rcu_read_lock();
1081 if ((in_dev = __in_dev_get(dev)) == NULL) { 1081 if ((in_dev = __in_dev_get_rcu(dev)) == NULL) {
1082 rcu_read_unlock(); 1082 rcu_read_unlock();
1083 continue; 1083 continue;
1084 } 1084 }
@@ -1149,7 +1149,7 @@ void inet_forward_change(void)
1149 for (dev = dev_base; dev; dev = dev->next) { 1149 for (dev = dev_base; dev; dev = dev->next) {
1150 struct in_device *in_dev; 1150 struct in_device *in_dev;
1151 rcu_read_lock(); 1151 rcu_read_lock();
1152 in_dev = __in_dev_get(dev); 1152 in_dev = __in_dev_get_rcu(dev);
1153 if (in_dev) 1153 if (in_dev)
1154 in_dev->cnf.forwarding = on; 1154 in_dev->cnf.forwarding = on;
1155 rcu_read_unlock(); 1155 rcu_read_unlock();
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4e1379f71269..e61bc7177eb1 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -173,7 +173,7 @@ int fib_validate_source(u32 src, u32 dst, u8 tos, int oif,
173 173
174 no_addr = rpf = 0; 174 no_addr = rpf = 0;
175 rcu_read_lock(); 175 rcu_read_lock();
176 in_dev = __in_dev_get(dev); 176 in_dev = __in_dev_get_rcu(dev);
177 if (in_dev) { 177 if (in_dev) {
178 no_addr = in_dev->ifa_list == NULL; 178 no_addr = in_dev->ifa_list == NULL;
179 rpf = IN_DEV_RPFILTER(in_dev); 179 rpf = IN_DEV_RPFILTER(in_dev);
@@ -607,7 +607,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
607static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) 607static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr)
608{ 608{
609 struct net_device *dev = ptr; 609 struct net_device *dev = ptr;
610 struct in_device *in_dev = __in_dev_get(dev); 610 struct in_device *in_dev = __in_dev_get_rtnl(dev);
611 611
612 if (event == NETDEV_UNREGISTER) { 612 if (event == NETDEV_UNREGISTER) {
613 fib_disable_ip(dev, 2); 613 fib_disable_ip(dev, 2);
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index d41219e8037c..186f20c4a45e 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1087,7 +1087,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm,
1087 rta->rta_oif = &dev->ifindex; 1087 rta->rta_oif = &dev->ifindex;
1088 if (colon) { 1088 if (colon) {
1089 struct in_ifaddr *ifa; 1089 struct in_ifaddr *ifa;
1090 struct in_device *in_dev = __in_dev_get(dev); 1090 struct in_device *in_dev = __in_dev_get_rtnl(dev);
1091 if (!in_dev) 1091 if (!in_dev)
1092 return -ENODEV; 1092 return -ENODEV;
1093 *colon = ':'; 1093 *colon = ':';
@@ -1268,7 +1268,7 @@ int fib_sync_up(struct net_device *dev)
1268 } 1268 }
1269 if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) 1269 if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP))
1270 continue; 1270 continue;
1271 if (nh->nh_dev != dev || __in_dev_get(dev) == NULL) 1271 if (nh->nh_dev != dev || !__in_dev_get_rtnl(dev))
1272 continue; 1272 continue;
1273 alive++; 1273 alive++;
1274 spin_lock_bh(&fib_multipath_lock); 1274 spin_lock_bh(&fib_multipath_lock);
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 50c0519cd70d..0093ea08c7f5 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -286,6 +286,8 @@ static inline void check_tnode(const struct tnode *tn)
286 286
287static int halve_threshold = 25; 287static int halve_threshold = 25;
288static int inflate_threshold = 50; 288static int inflate_threshold = 50;
289static int halve_threshold_root = 15;
290static int inflate_threshold_root = 25;
289 291
290 292
291static void __alias_free_mem(struct rcu_head *head) 293static void __alias_free_mem(struct rcu_head *head)
@@ -449,6 +451,8 @@ static struct node *resize(struct trie *t, struct tnode *tn)
449 int i; 451 int i;
450 int err = 0; 452 int err = 0;
451 struct tnode *old_tn; 453 struct tnode *old_tn;
454 int inflate_threshold_use;
455 int halve_threshold_use;
452 456
453 if (!tn) 457 if (!tn)
454 return NULL; 458 return NULL;
@@ -541,10 +545,17 @@ static struct node *resize(struct trie *t, struct tnode *tn)
541 545
542 check_tnode(tn); 546 check_tnode(tn);
543 547
548 /* Keep root node larger */
549
550 if(!tn->parent)
551 inflate_threshold_use = inflate_threshold_root;
552 else
553 inflate_threshold_use = inflate_threshold;
554
544 err = 0; 555 err = 0;
545 while ((tn->full_children > 0 && 556 while ((tn->full_children > 0 &&
546 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >= 557 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >=
547 inflate_threshold * tnode_child_length(tn))) { 558 inflate_threshold_use * tnode_child_length(tn))) {
548 559
549 old_tn = tn; 560 old_tn = tn;
550 tn = inflate(t, tn); 561 tn = inflate(t, tn);
@@ -564,10 +575,18 @@ static struct node *resize(struct trie *t, struct tnode *tn)
564 * node is above threshold. 575 * node is above threshold.
565 */ 576 */
566 577
578
579 /* Keep root node larger */
580
581 if(!tn->parent)
582 halve_threshold_use = halve_threshold_root;
583 else
584 halve_threshold_use = halve_threshold;
585
567 err = 0; 586 err = 0;
568 while (tn->bits > 1 && 587 while (tn->bits > 1 &&
569 100 * (tnode_child_length(tn) - tn->empty_children) < 588 100 * (tnode_child_length(tn) - tn->empty_children) <
570 halve_threshold * tnode_child_length(tn)) { 589 halve_threshold_use * tnode_child_length(tn)) {
571 590
572 old_tn = tn; 591 old_tn = tn;
573 tn = halve(t, tn); 592 tn = halve(t, tn);
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 24eb56ae1b5a..90dca711ac9f 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -188,7 +188,7 @@ struct icmp_err icmp_err_convert[] = {
188 188
189/* Control parameters for ECHO replies. */ 189/* Control parameters for ECHO replies. */
190int sysctl_icmp_echo_ignore_all; 190int sysctl_icmp_echo_ignore_all;
191int sysctl_icmp_echo_ignore_broadcasts; 191int sysctl_icmp_echo_ignore_broadcasts = 1;
192 192
193/* Control parameter - ignore bogus broadcast responses? */ 193/* Control parameter - ignore bogus broadcast responses? */
194int sysctl_icmp_ignore_bogus_error_responses; 194int sysctl_icmp_ignore_bogus_error_responses;
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 70c44e4c3ceb..8b6d3939e1e6 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1323,7 +1323,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr)
1323 } 1323 }
1324 if (dev) { 1324 if (dev) {
1325 imr->imr_ifindex = dev->ifindex; 1325 imr->imr_ifindex = dev->ifindex;
1326 idev = __in_dev_get(dev); 1326 idev = __in_dev_get_rtnl(dev);
1327 } 1327 }
1328 return idev; 1328 return idev;
1329} 1329}
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index fe3c6d3d0c91..94468a76c5b4 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -494,7 +494,7 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
494EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_prune); 494EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_prune);
495 495
496struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req, 496struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req,
497 const unsigned int __nocast priority) 497 const gfp_t priority)
498{ 498{
499 struct sock *newsk = sk_clone(sk, priority); 499 struct sock *newsk = sk_clone(sk, priority);
500 500
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 4d1502a49852..f9076ef3a1a8 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -20,7 +20,7 @@ void __inet_twsk_kill(struct inet_timewait_sock *tw, struct inet_hashinfo *hashi
20 struct inet_bind_hashbucket *bhead; 20 struct inet_bind_hashbucket *bhead;
21 struct inet_bind_bucket *tb; 21 struct inet_bind_bucket *tb;
22 /* Unlink from established hashes. */ 22 /* Unlink from established hashes. */
23 struct inet_ehash_bucket *ehead = &hashinfo->ehash[tw->tw_hashent]; 23 struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, tw->tw_hash);
24 24
25 write_lock(&ehead->lock); 25 write_lock(&ehead->lock);
26 if (hlist_unhashed(&tw->tw_node)) { 26 if (hlist_unhashed(&tw->tw_node)) {
@@ -60,7 +60,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
60{ 60{
61 const struct inet_sock *inet = inet_sk(sk); 61 const struct inet_sock *inet = inet_sk(sk);
62 const struct inet_connection_sock *icsk = inet_csk(sk); 62 const struct inet_connection_sock *icsk = inet_csk(sk);
63 struct inet_ehash_bucket *ehead = &hashinfo->ehash[sk->sk_hashent]; 63 struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, sk->sk_hash);
64 struct inet_bind_hashbucket *bhead; 64 struct inet_bind_hashbucket *bhead;
65 /* Step 1: Put TW into bind hash. Original socket stays there too. 65 /* Step 1: Put TW into bind hash. Original socket stays there too.
66 Note, that any socket with inet->num != 0 MUST be bound in 66 Note, that any socket with inet->num != 0 MUST be bound in
@@ -106,7 +106,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat
106 tw->tw_dport = inet->dport; 106 tw->tw_dport = inet->dport;
107 tw->tw_family = sk->sk_family; 107 tw->tw_family = sk->sk_family;
108 tw->tw_reuse = sk->sk_reuse; 108 tw->tw_reuse = sk->sk_reuse;
109 tw->tw_hashent = sk->sk_hashent; 109 tw->tw_hash = sk->sk_hash;
110 tw->tw_ipv6only = 0; 110 tw->tw_ipv6only = 0;
111 tw->tw_prot = sk->sk_prot_creator; 111 tw->tw_prot = sk->sk_prot_creator;
112 atomic_set(&tw->tw_refcnt, 1); 112 atomic_set(&tw->tw_refcnt, 1);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index f0d5740d7e22..896ce3f8f53a 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1104,10 +1104,10 @@ static int ipgre_open(struct net_device *dev)
1104 return -EADDRNOTAVAIL; 1104 return -EADDRNOTAVAIL;
1105 dev = rt->u.dst.dev; 1105 dev = rt->u.dst.dev;
1106 ip_rt_put(rt); 1106 ip_rt_put(rt);
1107 if (__in_dev_get(dev) == NULL) 1107 if (__in_dev_get_rtnl(dev) == NULL)
1108 return -EADDRNOTAVAIL; 1108 return -EADDRNOTAVAIL;
1109 t->mlink = dev->ifindex; 1109 t->mlink = dev->ifindex;
1110 ip_mc_inc_group(__in_dev_get(dev), t->parms.iph.daddr); 1110 ip_mc_inc_group(__in_dev_get_rtnl(dev), t->parms.iph.daddr);
1111 } 1111 }
1112 return 0; 1112 return 0;
1113} 1113}
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 9dbf5909f3a6..302b7eb507c9 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -149,7 +149,7 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v)
149 if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) { 149 if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) {
150 dev->flags |= IFF_MULTICAST; 150 dev->flags |= IFF_MULTICAST;
151 151
152 in_dev = __in_dev_get(dev); 152 in_dev = __in_dev_get_rtnl(dev);
153 if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL) 153 if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL)
154 goto failure; 154 goto failure;
155 in_dev->cnf.rp_filter = 0; 155 in_dev->cnf.rp_filter = 0;
@@ -278,7 +278,7 @@ static int vif_delete(int vifi)
278 278
279 dev_set_allmulti(dev, -1); 279 dev_set_allmulti(dev, -1);
280 280
281 if ((in_dev = __in_dev_get(dev)) != NULL) { 281 if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) {
282 in_dev->cnf.mc_forwarding--; 282 in_dev->cnf.mc_forwarding--;
283 ip_rt_multicast_event(in_dev); 283 ip_rt_multicast_event(in_dev);
284 } 284 }
@@ -421,7 +421,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
421 return -EINVAL; 421 return -EINVAL;
422 } 422 }
423 423
424 if ((in_dev = __in_dev_get(dev)) == NULL) 424 if ((in_dev = __in_dev_get_rtnl(dev)) == NULL)
425 return -EADDRNOTAVAIL; 425 return -EADDRNOTAVAIL;
426 in_dev->cnf.mc_forwarding++; 426 in_dev->cnf.mc_forwarding++;
427 dev_set_allmulti(dev, +1); 427 dev_set_allmulti(dev, +1);
diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c
index 6e092dadb388..fc6f95aaa969 100644
--- a/net/ipv4/ipvs/ip_vs_app.c
+++ b/net/ipv4/ipvs/ip_vs_app.c
@@ -604,7 +604,7 @@ static struct file_operations ip_vs_app_fops = {
604/* 604/*
605 * Replace a segment of data with a new segment 605 * Replace a segment of data with a new segment
606 */ 606 */
607int ip_vs_skb_replace(struct sk_buff *skb, int pri, 607int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
608 char *o_buf, int o_len, char *n_buf, int n_len) 608 char *o_buf, int o_len, char *n_buf, int n_len)
609{ 609{
610 struct iphdr *iph; 610 struct iphdr *iph;
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 2cd7e7d1ac90..a7659728e7a0 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -141,7 +141,7 @@ config IP_NF_PPTP
141 tristate 'PPTP protocol support' 141 tristate 'PPTP protocol support'
142 help 142 help
143 This module adds support for PPTP (Point to Point Tunnelling 143 This module adds support for PPTP (Point to Point Tunnelling
144 Protocol, RFC2637) conncection tracking and NAT. 144 Protocol, RFC2637) connection tracking and NAT.
145 145
146 If you are running PPTP sessions over a stateful firewall or NAT 146 If you are running PPTP sessions over a stateful firewall or NAT
147 box, you may want to enable this feature. 147 box, you may want to enable this feature.
diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
index 577bac22dcc6..186646eb249f 100644
--- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
+++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
@@ -58,7 +58,7 @@ static int help(struct sk_buff **pskb,
58 goto out; 58 goto out;
59 59
60 rcu_read_lock(); 60 rcu_read_lock();
61 in_dev = __in_dev_get(rt->u.dst.dev); 61 in_dev = __in_dev_get_rcu(rt->u.dst.dev);
62 if (in_dev != NULL) { 62 if (in_dev != NULL) {
63 for_primary_ifa(in_dev) { 63 for_primary_ifa(in_dev) {
64 if (ifa->ifa_broadcast == iph->daddr) { 64 if (ifa->ifa_broadcast == iph->daddr) {
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index d54f14d926f6..36339eb39e17 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -240,8 +240,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
240 240
241 pmsg->packet_id = (unsigned long )entry; 241 pmsg->packet_id = (unsigned long )entry;
242 pmsg->data_len = data_len; 242 pmsg->data_len = data_len;
243 pmsg->timestamp_sec = skb_tv_base.tv_sec + entry->skb->tstamp.off_sec; 243 pmsg->timestamp_sec = entry->skb->tstamp.off_sec;
244 pmsg->timestamp_usec = skb_tv_base.tv_usec + entry->skb->tstamp.off_usec; 244 pmsg->timestamp_usec = entry->skb->tstamp.off_usec;
245 pmsg->mark = entry->skb->nfmark; 245 pmsg->mark = entry->skb->nfmark;
246 pmsg->hook = entry->info->hook; 246 pmsg->hook = entry->info->hook;
247 pmsg->hw_protocol = entry->skb->protocol; 247 pmsg->hw_protocol = entry->skb->protocol;
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c
index 715cb613405c..5245bfd33d52 100644
--- a/net/ipv4/netfilter/ipt_REDIRECT.c
+++ b/net/ipv4/netfilter/ipt_REDIRECT.c
@@ -93,7 +93,7 @@ redirect_target(struct sk_buff **pskb,
93 newdst = 0; 93 newdst = 0;
94 94
95 rcu_read_lock(); 95 rcu_read_lock();
96 indev = __in_dev_get((*pskb)->dev); 96 indev = __in_dev_get_rcu((*pskb)->dev);
97 if (indev && (ifa = indev->ifa_list)) 97 if (indev && (ifa = indev->ifa_list))
98 newdst = ifa->ifa_local; 98 newdst = ifa->ifa_local;
99 rcu_read_unlock(); 99 rcu_read_unlock();
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index e2c14f3cb2fc..2883ccd8a91d 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -225,8 +225,8 @@ static void ipt_ulog_packet(unsigned int hooknum,
225 225
226 /* copy hook, prefix, timestamp, payload, etc. */ 226 /* copy hook, prefix, timestamp, payload, etc. */
227 pm->data_len = copy_len; 227 pm->data_len = copy_len;
228 pm->timestamp_sec = skb_tv_base.tv_sec + skb->tstamp.off_sec; 228 pm->timestamp_sec = skb->tstamp.off_sec;
229 pm->timestamp_usec = skb_tv_base.tv_usec + skb->tstamp.off_usec; 229 pm->timestamp_usec = skb->tstamp.off_usec;
230 pm->mark = skb->nfmark; 230 pm->mark = skb->nfmark;
231 pm->hook = hooknum; 231 pm->hook = hooknum;
232 if (prefix != NULL) 232 if (prefix != NULL)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 8549f26e2495..381dd6a6aebb 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2128,7 +2128,7 @@ int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr,
2128 struct in_device *in_dev; 2128 struct in_device *in_dev;
2129 2129
2130 rcu_read_lock(); 2130 rcu_read_lock();
2131 if ((in_dev = __in_dev_get(dev)) != NULL) { 2131 if ((in_dev = __in_dev_get_rcu(dev)) != NULL) {
2132 int our = ip_check_mc(in_dev, daddr, saddr, 2132 int our = ip_check_mc(in_dev, daddr, saddr,
2133 skb->nh.iph->protocol); 2133 skb->nh.iph->protocol);
2134 if (our 2134 if (our
@@ -2443,7 +2443,9 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2443 err = -ENODEV; 2443 err = -ENODEV;
2444 if (dev_out == NULL) 2444 if (dev_out == NULL)
2445 goto out; 2445 goto out;
2446 if (__in_dev_get(dev_out) == NULL) { 2446
2447 /* RACE: Check return value of inet_select_addr instead. */
2448 if (__in_dev_get_rtnl(dev_out) == NULL) {
2447 dev_put(dev_out); 2449 dev_put(dev_out);
2448 goto out; /* Wrong error code */ 2450 goto out; /* Wrong error code */
2449 } 2451 }
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c
index b940346de4e7..6d80e063c187 100644
--- a/net/ipv4/tcp_bic.c
+++ b/net/ipv4/tcp_bic.c
@@ -136,7 +136,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
136 else if (cwnd < ca->last_max_cwnd + max_increment*(BICTCP_B-1)) 136 else if (cwnd < ca->last_max_cwnd + max_increment*(BICTCP_B-1))
137 /* slow start */ 137 /* slow start */
138 ca->cnt = (cwnd * (BICTCP_B-1)) 138 ca->cnt = (cwnd * (BICTCP_B-1))
139 / cwnd-ca->last_max_cwnd; 139 / (cwnd - ca->last_max_cwnd);
140 else 140 else
141 /* linear increase */ 141 /* linear increase */
142 ca->cnt = cwnd / max_increment; 142 ca->cnt = cwnd / max_increment;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a7537c7bbd06..677419d0c9ad 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -355,8 +355,6 @@ static void tcp_clamp_window(struct sock *sk, struct tcp_sock *tp)
355 app_win -= icsk->icsk_ack.rcv_mss; 355 app_win -= icsk->icsk_ack.rcv_mss;
356 app_win = max(app_win, 2U*tp->advmss); 356 app_win = max(app_win, 2U*tp->advmss);
357 357
358 if (!ofo_win)
359 tp->window_clamp = min(tp->window_clamp, app_win);
360 tp->rcv_ssthresh = min(tp->window_clamp, 2U*tp->advmss); 358 tp->rcv_ssthresh = min(tp->window_clamp, 2U*tp->advmss);
361 } 359 }
362} 360}
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 13dfb391cdf1..c85819d8474b 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -130,19 +130,20 @@ static int __tcp_v4_check_established(struct sock *sk, __u16 lport,
130 int dif = sk->sk_bound_dev_if; 130 int dif = sk->sk_bound_dev_if;
131 INET_ADDR_COOKIE(acookie, saddr, daddr) 131 INET_ADDR_COOKIE(acookie, saddr, daddr)
132 const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport); 132 const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport);
133 const int hash = inet_ehashfn(daddr, lport, saddr, inet->dport, tcp_hashinfo.ehash_size); 133 unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport);
134 struct inet_ehash_bucket *head = &tcp_hashinfo.ehash[hash]; 134 struct inet_ehash_bucket *head = inet_ehash_bucket(&tcp_hashinfo, hash);
135 struct sock *sk2; 135 struct sock *sk2;
136 const struct hlist_node *node; 136 const struct hlist_node *node;
137 struct inet_timewait_sock *tw; 137 struct inet_timewait_sock *tw;
138 138
139 prefetch(head->chain.first);
139 write_lock(&head->lock); 140 write_lock(&head->lock);
140 141
141 /* Check TIME-WAIT sockets first. */ 142 /* Check TIME-WAIT sockets first. */
142 sk_for_each(sk2, node, &(head + tcp_hashinfo.ehash_size)->chain) { 143 sk_for_each(sk2, node, &(head + tcp_hashinfo.ehash_size)->chain) {
143 tw = inet_twsk(sk2); 144 tw = inet_twsk(sk2);
144 145
145 if (INET_TW_MATCH(sk2, acookie, saddr, daddr, ports, dif)) { 146 if (INET_TW_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif)) {
146 const struct tcp_timewait_sock *tcptw = tcp_twsk(sk2); 147 const struct tcp_timewait_sock *tcptw = tcp_twsk(sk2);
147 struct tcp_sock *tp = tcp_sk(sk); 148 struct tcp_sock *tp = tcp_sk(sk);
148 149
@@ -179,7 +180,7 @@ static int __tcp_v4_check_established(struct sock *sk, __u16 lport,
179 180
180 /* And established part... */ 181 /* And established part... */
181 sk_for_each(sk2, node, &head->chain) { 182 sk_for_each(sk2, node, &head->chain) {
182 if (INET_MATCH(sk2, acookie, saddr, daddr, ports, dif)) 183 if (INET_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif))
183 goto not_unique; 184 goto not_unique;
184 } 185 }
185 186
@@ -188,7 +189,7 @@ unique:
188 * in hash table socket with a funny identity. */ 189 * in hash table socket with a funny identity. */
189 inet->num = lport; 190 inet->num = lport;
190 inet->sport = htons(lport); 191 inet->sport = htons(lport);
191 sk->sk_hashent = hash; 192 sk->sk_hash = hash;
192 BUG_TRAP(sk_unhashed(sk)); 193 BUG_TRAP(sk_unhashed(sk));
193 __sk_add_node(sk, &head->chain); 194 __sk_add_node(sk, &head->chain);
194 sock_prot_inc_use(sk->sk_prot); 195 sock_prot_inc_use(sk->sk_prot);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index d6e3d269e906..8225e4257258 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -190,7 +190,7 @@ void tcp_select_initial_window(int __space, __u32 mss,
190 } 190 }
191 191
192 /* Set initial window to value enough for senders, 192 /* Set initial window to value enough for senders,
193 * following RFC1414. Senders, not following this RFC, 193 * following RFC2414. Senders, not following this RFC,
194 * will be satisfied with 2. 194 * will be satisfied with 2.
195 */ 195 */
196 if (mss > (1<<*rcv_wscale)) { 196 if (mss > (1<<*rcv_wscale)) {
@@ -1610,7 +1610,7 @@ void tcp_send_fin(struct sock *sk)
1610 * was unread data in the receive queue. This behavior is recommended 1610 * was unread data in the receive queue. This behavior is recommended
1611 * by draft-ietf-tcpimpl-prob-03.txt section 3.10. -DaveM 1611 * by draft-ietf-tcpimpl-prob-03.txt section 3.10. -DaveM
1612 */ 1612 */
1613void tcp_send_active_reset(struct sock *sk, unsigned int __nocast priority) 1613void tcp_send_active_reset(struct sock *sk, gfp_t priority)
1614{ 1614{
1615 struct tcp_sock *tp = tcp_sk(sk); 1615 struct tcp_sock *tp = tcp_sk(sk);
1616 struct sk_buff *skb; 1616 struct sk_buff *skb;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 4e509e52fbc1..a970b4727ce8 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1806,7 +1806,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
1806 } 1806 }
1807 1807
1808 for (dev = dev_base; dev != NULL; dev = dev->next) { 1808 for (dev = dev_base; dev != NULL; dev = dev->next) {
1809 struct in_device * in_dev = __in_dev_get(dev); 1809 struct in_device * in_dev = __in_dev_get_rtnl(dev);
1810 if (in_dev && (dev->flags & IFF_UP)) { 1810 if (in_dev && (dev->flags & IFF_UP)) {
1811 struct in_ifaddr * ifa; 1811 struct in_ifaddr * ifa;
1812 1812
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 2f589f24c093..563b442ffab8 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -666,7 +666,7 @@ slow_path:
666 */ 666 */
667 fh->nexthdr = nexthdr; 667 fh->nexthdr = nexthdr;
668 fh->reserved = 0; 668 fh->reserved = 0;
669 if (frag_id) { 669 if (!frag_id) {
670 ipv6_select_ident(skb, fh); 670 ipv6_select_ident(skb, fh);
671 frag_id = fh->identification; 671 frag_id = fh->identification;
672 } else 672 } else
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 519899fb11d5..39a96c768102 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1393,7 +1393,7 @@ static void mld_sendpack(struct sk_buff *skb)
1393 1393
1394static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel) 1394static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel)
1395{ 1395{
1396 return sizeof(struct mld2_grec) + 4*mld_scount(pmc,type,gdel,sdel); 1396 return sizeof(struct mld2_grec) + 16 * mld_scount(pmc,type,gdel,sdel);
1397} 1397}
1398 1398
1399static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, 1399static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc,
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 555a31347eda..305d9ee6d7db 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1450,7 +1450,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1450 1450
1451static void pndisc_redo(struct sk_buff *skb) 1451static void pndisc_redo(struct sk_buff *skb)
1452{ 1452{
1453 ndisc_rcv(skb); 1453 ndisc_recv_ns(skb);
1454 kfree_skb(skb); 1454 kfree_skb(skb);
1455} 1455}
1456 1456
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index aa11cf366efa..5027bbe6415e 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -238,8 +238,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
238 238
239 pmsg->packet_id = (unsigned long )entry; 239 pmsg->packet_id = (unsigned long )entry;
240 pmsg->data_len = data_len; 240 pmsg->data_len = data_len;
241 pmsg->timestamp_sec = skb_tv_base.tv_sec + entry->skb->tstamp.off_sec; 241 pmsg->timestamp_sec = entry->skb->tstamp.off_sec;
242 pmsg->timestamp_usec = skb_tv_base.tv_usec + entry->skb->tstamp.off_usec; 242 pmsg->timestamp_usec = entry->skb->tstamp.off_usec;
243 pmsg->mark = entry->skb->nfmark; 243 pmsg->mark = entry->skb->nfmark;
244 pmsg->hook = entry->info->hook; 244 pmsg->hook = entry->info->hook;
245 pmsg->hw_protocol = entry->skb->protocol; 245 pmsg->hw_protocol = entry->skb->protocol;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 80643e6b346b..d693cb988b78 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -209,9 +209,11 @@ static __inline__ void __tcp_v6_hash(struct sock *sk)
209 lock = &tcp_hashinfo.lhash_lock; 209 lock = &tcp_hashinfo.lhash_lock;
210 inet_listen_wlock(&tcp_hashinfo); 210 inet_listen_wlock(&tcp_hashinfo);
211 } else { 211 } else {
212 sk->sk_hashent = inet6_sk_ehashfn(sk, tcp_hashinfo.ehash_size); 212 unsigned int hash;
213 list = &tcp_hashinfo.ehash[sk->sk_hashent].chain; 213 sk->sk_hash = hash = inet6_sk_ehashfn(sk);
214 lock = &tcp_hashinfo.ehash[sk->sk_hashent].lock; 214 hash &= (tcp_hashinfo.ehash_size - 1);
215 list = &tcp_hashinfo.ehash[hash].chain;
216 lock = &tcp_hashinfo.ehash[hash].lock;
215 write_lock(lock); 217 write_lock(lock);
216 } 218 }
217 219
@@ -322,13 +324,13 @@ static int __tcp_v6_check_established(struct sock *sk, const __u16 lport,
322 const struct in6_addr *saddr = &np->daddr; 324 const struct in6_addr *saddr = &np->daddr;
323 const int dif = sk->sk_bound_dev_if; 325 const int dif = sk->sk_bound_dev_if;
324 const u32 ports = INET_COMBINED_PORTS(inet->dport, lport); 326 const u32 ports = INET_COMBINED_PORTS(inet->dport, lport);
325 const int hash = inet6_ehashfn(daddr, inet->num, saddr, inet->dport, 327 unsigned int hash = inet6_ehashfn(daddr, inet->num, saddr, inet->dport);
326 tcp_hashinfo.ehash_size); 328 struct inet_ehash_bucket *head = inet_ehash_bucket(&tcp_hashinfo, hash);
327 struct inet_ehash_bucket *head = &tcp_hashinfo.ehash[hash];
328 struct sock *sk2; 329 struct sock *sk2;
329 const struct hlist_node *node; 330 const struct hlist_node *node;
330 struct inet_timewait_sock *tw; 331 struct inet_timewait_sock *tw;
331 332
333 prefetch(head->chain.first);
332 write_lock(&head->lock); 334 write_lock(&head->lock);
333 335
334 /* Check TIME-WAIT sockets first. */ 336 /* Check TIME-WAIT sockets first. */
@@ -365,14 +367,14 @@ static int __tcp_v6_check_established(struct sock *sk, const __u16 lport,
365 367
366 /* And established part... */ 368 /* And established part... */
367 sk_for_each(sk2, node, &head->chain) { 369 sk_for_each(sk2, node, &head->chain) {
368 if (INET6_MATCH(sk2, saddr, daddr, ports, dif)) 370 if (INET6_MATCH(sk2, hash, saddr, daddr, ports, dif))
369 goto not_unique; 371 goto not_unique;
370 } 372 }
371 373
372unique: 374unique:
373 BUG_TRAP(sk_unhashed(sk)); 375 BUG_TRAP(sk_unhashed(sk));
374 __sk_add_node(sk, &head->chain); 376 __sk_add_node(sk, &head->chain);
375 sk->sk_hashent = hash; 377 sk->sk_hash = hash;
376 sock_prot_inc_use(sk->sk_prot); 378 sock_prot_inc_use(sk->sk_prot);
377 write_unlock(&head->lock); 379 write_unlock(&head->lock);
378 380
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 6001948600f3..bf9519341fd3 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -99,7 +99,7 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum)
99 next:; 99 next:;
100 } 100 }
101 result = best; 101 result = best;
102 for(;; result += UDP_HTABLE_SIZE) { 102 for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) {
103 if (result > sysctl_local_port_range[1]) 103 if (result > sysctl_local_port_range[1])
104 result = sysctl_local_port_range[0] 104 result = sysctl_local_port_range[0]
105 + ((result - sysctl_local_port_range[0]) & 105 + ((result - sysctl_local_port_range[0]) &
@@ -107,6 +107,8 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum)
107 if (!udp_lport_inuse(result)) 107 if (!udp_lport_inuse(result))
108 break; 108 break;
109 } 109 }
110 if (i >= (1 << 16) / UDP_HTABLE_SIZE)
111 goto fail;
110gotit: 112gotit:
111 udp_port_rover = snum = result; 113 udp_port_rover = snum = result;
112 } else { 114 } else {
@@ -852,10 +854,16 @@ do_append_data:
852 else if (!corkreq) 854 else if (!corkreq)
853 err = udp_v6_push_pending_frames(sk, up); 855 err = udp_v6_push_pending_frames(sk, up);
854 856
855 if (dst && connected) 857 if (dst) {
856 ip6_dst_store(sk, dst, 858 if (connected) {
857 ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ? 859 ip6_dst_store(sk, dst,
858 &np->daddr : NULL); 860 ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ?
861 &np->daddr : NULL);
862 } else {
863 dst_release(dst);
864 }
865 }
866
859 if (err > 0) 867 if (err > 0)
860 err = np->recverr ? net_xmit_errno(err) : 0; 868 err = np->recverr ? net_xmit_errno(err) : 0;
861 release_sock(sk); 869 release_sock(sk);
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index 071cd2cefd8a..953e255d2bc8 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -310,7 +310,7 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev)
310#ifdef CONFIG_INET 310#ifdef CONFIG_INET
311 IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); 311 IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n");
312 rcu_read_lock(); 312 rcu_read_lock();
313 in_dev = __in_dev_get(dev); 313 in_dev = __in_dev_get_rcu(dev);
314 if (in_dev == NULL) 314 if (in_dev == NULL)
315 goto out; 315 goto out;
316 if (in_dev->ifa_list) 316 if (in_dev->ifa_list)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 4879743b945a..39031684b65c 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -185,7 +185,7 @@ static int pfkey_release(struct socket *sock)
185} 185}
186 186
187static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, 187static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
188 int allocation, struct sock *sk) 188 gfp_t allocation, struct sock *sk)
189{ 189{
190 int err = -ENOBUFS; 190 int err = -ENOBUFS;
191 191
@@ -217,7 +217,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
217#define BROADCAST_ONE 1 217#define BROADCAST_ONE 1
218#define BROADCAST_REGISTERED 2 218#define BROADCAST_REGISTERED 2
219#define BROADCAST_PROMISC_ONLY 4 219#define BROADCAST_PROMISC_ONLY 4
220static int pfkey_broadcast(struct sk_buff *skb, int allocation, 220static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,
221 int broadcast_flags, struct sock *one_sk) 221 int broadcast_flags, struct sock *one_sk)
222{ 222{
223 struct sock *sk; 223 struct sock *sk;
@@ -1416,7 +1416,8 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
1416 return 0; 1416 return 0;
1417} 1417}
1418 1418
1419static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, int allocation) 1419static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig,
1420 gfp_t allocation)
1420{ 1421{
1421 struct sk_buff *skb; 1422 struct sk_buff *skb;
1422 struct sadb_msg *hdr; 1423 struct sadb_msg *hdr;
@@ -2153,6 +2154,7 @@ out:
2153 2154
2154static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs) 2155static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
2155{ 2156{
2157 unsigned int dir;
2156 int err; 2158 int err;
2157 struct sadb_x_policy *pol; 2159 struct sadb_x_policy *pol;
2158 struct xfrm_policy *xp; 2160 struct xfrm_policy *xp;
@@ -2161,7 +2163,11 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2161 if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL) 2163 if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL)
2162 return -EINVAL; 2164 return -EINVAL;
2163 2165
2164 xp = xfrm_policy_byid(0, pol->sadb_x_policy_id, 2166 dir = xfrm_policy_id2dir(pol->sadb_x_policy_id);
2167 if (dir >= XFRM_POLICY_MAX)
2168 return -EINVAL;
2169
2170 xp = xfrm_policy_byid(dir, pol->sadb_x_policy_id,
2165 hdr->sadb_msg_type == SADB_X_SPDDELETE2); 2171 hdr->sadb_msg_type == SADB_X_SPDDELETE2);
2166 if (xp == NULL) 2172 if (xp == NULL)
2167 return -ENOENT; 2173 return -ENOENT;
@@ -2173,9 +2179,9 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2173 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) { 2179 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) {
2174 c.data.byid = 1; 2180 c.data.byid = 1;
2175 c.event = XFRM_MSG_DELPOLICY; 2181 c.event = XFRM_MSG_DELPOLICY;
2176 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); 2182 km_policy_notify(xp, dir, &c);
2177 } else { 2183 } else {
2178 err = key_pol_get_resp(sk, xp, hdr, pol->sadb_x_policy_dir-1); 2184 err = key_pol_get_resp(sk, xp, hdr, dir);
2179 } 2185 }
2180 2186
2181 xfrm_pol_put(xp); 2187 xfrm_pol_put(xp);
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 042b24a8ca4c..c761c15da421 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -867,8 +867,7 @@ static void llc_sk_init(struct sock* sk)
867 * Allocates a LLC sock and initializes it. Returns the new LLC sock 867 * Allocates a LLC sock and initializes it. Returns the new LLC sock
868 * or %NULL if there's no memory available for one 868 * or %NULL if there's no memory available for one
869 */ 869 */
870struct sock *llc_sk_alloc(int family, unsigned int __nocast priority, 870struct sock *llc_sk_alloc(int family, gfp_t priority, struct proto *prot)
871 struct proto *prot)
872{ 871{
873 struct sock *sk = sk_alloc(family, priority, prot, 1); 872 struct sock *sk = sk_alloc(family, priority, prot, 1);
874 873
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 49a3900e3d32..1caaca06f698 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -195,7 +195,7 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,
195 195
196int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo) 196int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)
197{ 197{
198 int allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; 198 gfp_t allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
199 int err = 0; 199 int err = 0;
200 200
201 NETLINK_CB(skb).dst_group = group; 201 NETLINK_CB(skb).dst_group = group;
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index ff5601ceedcb..efcd10f996ba 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -494,8 +494,8 @@ __build_packet_message(struct nfulnl_instance *inst,
494 if (skb->tstamp.off_sec) { 494 if (skb->tstamp.off_sec) {
495 struct nfulnl_msg_packet_timestamp ts; 495 struct nfulnl_msg_packet_timestamp ts;
496 496
497 ts.sec = cpu_to_be64(skb_tv_base.tv_sec + skb->tstamp.off_sec); 497 ts.sec = cpu_to_be64(skb->tstamp.off_sec);
498 ts.usec = cpu_to_be64(skb_tv_base.tv_usec + skb->tstamp.off_usec); 498 ts.usec = cpu_to_be64(skb->tstamp.off_usec);
499 499
500 NFA_PUT(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts); 500 NFA_PUT(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts);
501 } 501 }
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index f81fe8c52e99..eaa44c49567b 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -492,8 +492,8 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
492 if (entry->skb->tstamp.off_sec) { 492 if (entry->skb->tstamp.off_sec) {
493 struct nfqnl_msg_packet_timestamp ts; 493 struct nfqnl_msg_packet_timestamp ts;
494 494
495 ts.sec = cpu_to_be64(skb_tv_base.tv_sec + entry->skb->tstamp.off_sec); 495 ts.sec = cpu_to_be64(entry->skb->tstamp.off_sec);
496 ts.usec = cpu_to_be64(skb_tv_base.tv_usec + entry->skb->tstamp.off_usec); 496 ts.usec = cpu_to_be64(entry->skb->tstamp.off_usec);
497 497
498 NFA_PUT(skb, NFQA_TIMESTAMP, sizeof(ts), &ts); 498 NFA_PUT(skb, NFQA_TIMESTAMP, sizeof(ts), &ts);
499 } 499 }
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a64e1d5ce3ca..678c3f2c0d0b 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -758,7 +758,7 @@ void netlink_detachskb(struct sock *sk, struct sk_buff *skb)
758} 758}
759 759
760static inline struct sk_buff *netlink_trim(struct sk_buff *skb, 760static inline struct sk_buff *netlink_trim(struct sk_buff *skb,
761 unsigned int __nocast allocation) 761 gfp_t allocation)
762{ 762{
763 int delta; 763 int delta;
764 764
@@ -880,7 +880,7 @@ out:
880} 880}
881 881
882int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid, 882int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid,
883 u32 group, unsigned int __nocast allocation) 883 u32 group, gfp_t allocation)
884{ 884{
885 struct netlink_broadcast_data info; 885 struct netlink_broadcast_data info;
886 struct hlist_node *node; 886 struct hlist_node *node;
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 4e66eef9a034..509afddae569 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -58,7 +58,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
58 58
59 /* Spoof incoming device */ 59 /* Spoof incoming device */
60 skb->dev = dev; 60 skb->dev = dev;
61 skb->h.raw = skb->data; 61 skb->mac.raw = skb->nh.raw;
62 skb->nh.raw = skb->data; 62 skb->nh.raw = skb->data;
63 skb->pkt_type = PACKET_HOST; 63 skb->pkt_type = PACKET_HOST;
64 64
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 6a67a87384cc..499ae3df4a44 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -654,8 +654,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
654 __net_timestamp(skb); 654 __net_timestamp(skb);
655 sock_enable_timestamp(sk); 655 sock_enable_timestamp(sk);
656 } 656 }
657 h->tp_sec = skb_tv_base.tv_sec + skb->tstamp.off_sec; 657 h->tp_sec = skb->tstamp.off_sec;
658 h->tp_usec = skb_tv_base.tv_usec + skb->tstamp.off_usec; 658 h->tp_usec = skb->tstamp.off_usec;
659 659
660 sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h))); 660 sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h)));
661 sll->sll_halen = 0; 661 sll->sll_halen = 0;
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 5acb1680524a..829fdbc4400b 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1472,22 +1472,25 @@ static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62
1472static int __init rose_proto_init(void) 1472static int __init rose_proto_init(void)
1473{ 1473{
1474 int i; 1474 int i;
1475 int rc = proto_register(&rose_proto, 0); 1475 int rc;
1476 1476
1477 if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) {
1478 printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n");
1479 rc = -EINVAL;
1480 goto out;
1481 }
1482
1483 rc = proto_register(&rose_proto, 0);
1477 if (rc != 0) 1484 if (rc != 0)
1478 goto out; 1485 goto out;
1479 1486
1480 rose_callsign = null_ax25_address; 1487 rose_callsign = null_ax25_address;
1481 1488
1482 if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) {
1483 printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n");
1484 return -1;
1485 }
1486
1487 dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); 1489 dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);
1488 if (dev_rose == NULL) { 1490 if (dev_rose == NULL) {
1489 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); 1491 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");
1490 return -1; 1492 rc = -ENOMEM;
1493 goto out_proto_unregister;
1491 } 1494 }
1492 1495
1493 memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*)); 1496 memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*));
@@ -1500,10 +1503,12 @@ static int __init rose_proto_init(void)
1500 name, rose_setup); 1503 name, rose_setup);
1501 if (!dev) { 1504 if (!dev) {
1502 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n"); 1505 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n");
1506 rc = -ENOMEM;
1503 goto fail; 1507 goto fail;
1504 } 1508 }
1505 if (register_netdev(dev)) { 1509 rc = register_netdev(dev);
1506 printk(KERN_ERR "ROSE: netdevice regeistration failed\n"); 1510 if (rc) {
1511 printk(KERN_ERR "ROSE: netdevice registration failed\n");
1507 free_netdev(dev); 1512 free_netdev(dev);
1508 goto fail; 1513 goto fail;
1509 } 1514 }
@@ -1536,8 +1541,9 @@ fail:
1536 free_netdev(dev_rose[i]); 1541 free_netdev(dev_rose[i]);
1537 } 1542 }
1538 kfree(dev_rose); 1543 kfree(dev_rose);
1544out_proto_unregister:
1539 proto_unregister(&rose_proto); 1545 proto_unregister(&rose_proto);
1540 return -ENOMEM; 1546 goto out;
1541} 1547}
1542module_init(rose_proto_init); 1548module_init(rose_proto_init);
1543 1549
diff --git a/net/rxrpc/call.c b/net/rxrpc/call.c
index 5cfd4cadee42..c4aeb7d40266 100644
--- a/net/rxrpc/call.c
+++ b/net/rxrpc/call.c
@@ -1923,7 +1923,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,
1923 size_t sioc, 1923 size_t sioc,
1924 struct kvec *siov, 1924 struct kvec *siov,
1925 u8 rxhdr_flags, 1925 u8 rxhdr_flags,
1926 int alloc_flags, 1926 gfp_t alloc_flags,
1927 int dup_data, 1927 int dup_data,
1928 size_t *size_sent) 1928 size_t *size_sent)
1929{ 1929{
diff --git a/net/rxrpc/connection.c b/net/rxrpc/connection.c
index 61463c74f8cc..2ba14a75dbbe 100644
--- a/net/rxrpc/connection.c
+++ b/net/rxrpc/connection.c
@@ -522,7 +522,7 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
522 uint8_t type, 522 uint8_t type,
523 int dcount, 523 int dcount,
524 struct kvec diov[], 524 struct kvec diov[],
525 int alloc_flags, 525 gfp_t alloc_flags,
526 struct rxrpc_message **_msg) 526 struct rxrpc_message **_msg)
527{ 527{
528 struct rxrpc_message *msg; 528 struct rxrpc_message *msg;
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index 00eae5f9a01a..cf68a59fdc5a 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -393,10 +393,10 @@ META_COLLECTOR(int_sk_route_caps)
393 dst->value = skb->sk->sk_route_caps; 393 dst->value = skb->sk->sk_route_caps;
394} 394}
395 395
396META_COLLECTOR(int_sk_hashent) 396META_COLLECTOR(int_sk_hash)
397{ 397{
398 SKIP_NONLOCAL(skb); 398 SKIP_NONLOCAL(skb);
399 dst->value = skb->sk->sk_hashent; 399 dst->value = skb->sk->sk_hash;
400} 400}
401 401
402META_COLLECTOR(int_sk_lingertime) 402META_COLLECTOR(int_sk_lingertime)
@@ -515,7 +515,7 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = {
515 [META_ID(SK_FORWARD_ALLOCS)] = META_FUNC(int_sk_fwd_alloc), 515 [META_ID(SK_FORWARD_ALLOCS)] = META_FUNC(int_sk_fwd_alloc),
516 [META_ID(SK_ALLOCS)] = META_FUNC(int_sk_alloc), 516 [META_ID(SK_ALLOCS)] = META_FUNC(int_sk_alloc),
517 [META_ID(SK_ROUTE_CAPS)] = META_FUNC(int_sk_route_caps), 517 [META_ID(SK_ROUTE_CAPS)] = META_FUNC(int_sk_route_caps),
518 [META_ID(SK_HASHENT)] = META_FUNC(int_sk_hashent), 518 [META_ID(SK_HASH)] = META_FUNC(int_sk_hash),
519 [META_ID(SK_LINGERTIME)] = META_FUNC(int_sk_lingertime), 519 [META_ID(SK_LINGERTIME)] = META_FUNC(int_sk_lingertime),
520 [META_ID(SK_ACK_BACKLOG)] = META_FUNC(int_sk_ack_bl), 520 [META_ID(SK_ACK_BACKLOG)] = META_FUNC(int_sk_ack_bl),
521 [META_ID(SK_MAX_ACK_BACKLOG)] = META_FUNC(int_sk_max_ack_bl), 521 [META_ID(SK_MAX_ACK_BACKLOG)] = META_FUNC(int_sk_max_ack_bl),
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 5b24ae0650d3..12b0f582a66b 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -71,7 +71,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
71 const struct sctp_endpoint *ep, 71 const struct sctp_endpoint *ep,
72 const struct sock *sk, 72 const struct sock *sk,
73 sctp_scope_t scope, 73 sctp_scope_t scope,
74 unsigned int __nocast gfp) 74 gfp_t gfp)
75{ 75{
76 struct sctp_sock *sp; 76 struct sctp_sock *sp;
77 int i; 77 int i;
@@ -273,7 +273,7 @@ fail_init:
273struct sctp_association *sctp_association_new(const struct sctp_endpoint *ep, 273struct sctp_association *sctp_association_new(const struct sctp_endpoint *ep,
274 const struct sock *sk, 274 const struct sock *sk,
275 sctp_scope_t scope, 275 sctp_scope_t scope,
276 unsigned int __nocast gfp) 276 gfp_t gfp)
277{ 277{
278 struct sctp_association *asoc; 278 struct sctp_association *asoc;
279 279
@@ -479,7 +479,7 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
479/* Add a transport address to an association. */ 479/* Add a transport address to an association. */
480struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, 480struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
481 const union sctp_addr *addr, 481 const union sctp_addr *addr,
482 const unsigned int __nocast gfp, 482 const gfp_t gfp,
483 const int peer_state) 483 const int peer_state)
484{ 484{
485 struct sctp_transport *peer; 485 struct sctp_transport *peer;
@@ -1231,7 +1231,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned len)
1231 * local endpoint and the remote peer. 1231 * local endpoint and the remote peer.
1232 */ 1232 */
1233int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc, 1233int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
1234 unsigned int __nocast gfp) 1234 gfp_t gfp)
1235{ 1235{
1236 sctp_scope_t scope; 1236 sctp_scope_t scope;
1237 int flags; 1237 int flags;
@@ -1254,7 +1254,7 @@ int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
1254/* Build the association's bind address list from the cookie. */ 1254/* Build the association's bind address list from the cookie. */
1255int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc, 1255int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc,
1256 struct sctp_cookie *cookie, 1256 struct sctp_cookie *cookie,
1257 unsigned int __nocast gfp) 1257 gfp_t gfp)
1258{ 1258{
1259 int var_size2 = ntohs(cookie->peer_init->chunk_hdr.length); 1259 int var_size2 = ntohs(cookie->peer_init->chunk_hdr.length);
1260 int var_size3 = cookie->raw_addr_list_len; 1260 int var_size3 = cookie->raw_addr_list_len;
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index f71549710f2e..2b962627f631 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -53,7 +53,7 @@
53 53
54/* Forward declarations for internal helpers. */ 54/* Forward declarations for internal helpers. */
55static int sctp_copy_one_addr(struct sctp_bind_addr *, union sctp_addr *, 55static int sctp_copy_one_addr(struct sctp_bind_addr *, union sctp_addr *,
56 sctp_scope_t scope, unsigned int __nocast gfp, 56 sctp_scope_t scope, gfp_t gfp,
57 int flags); 57 int flags);
58static void sctp_bind_addr_clean(struct sctp_bind_addr *); 58static void sctp_bind_addr_clean(struct sctp_bind_addr *);
59 59
@@ -64,7 +64,7 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *);
64 */ 64 */
65int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 65int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
66 const struct sctp_bind_addr *src, 66 const struct sctp_bind_addr *src,
67 sctp_scope_t scope, unsigned int __nocast gfp, 67 sctp_scope_t scope, gfp_t gfp,
68 int flags) 68 int flags)
69{ 69{
70 struct sctp_sockaddr_entry *addr; 70 struct sctp_sockaddr_entry *addr;
@@ -146,7 +146,7 @@ void sctp_bind_addr_free(struct sctp_bind_addr *bp)
146 146
147/* Add an address to the bind address list in the SCTP_bind_addr structure. */ 147/* Add an address to the bind address list in the SCTP_bind_addr structure. */
148int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new, 148int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
149 unsigned int __nocast gfp) 149 gfp_t gfp)
150{ 150{
151 struct sctp_sockaddr_entry *addr; 151 struct sctp_sockaddr_entry *addr;
152 152
@@ -200,7 +200,7 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
200 */ 200 */
201union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, 201union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
202 int *addrs_len, 202 int *addrs_len,
203 unsigned int __nocast gfp) 203 gfp_t gfp)
204{ 204{
205 union sctp_params addrparms; 205 union sctp_params addrparms;
206 union sctp_params retval; 206 union sctp_params retval;
@@ -252,7 +252,7 @@ end_raw:
252 * address parameters). 252 * address parameters).
253 */ 253 */
254int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, 254int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
255 int addrs_len, __u16 port, unsigned int __nocast gfp) 255 int addrs_len, __u16 port, gfp_t gfp)
256{ 256{
257 union sctp_addr_param *rawaddr; 257 union sctp_addr_param *rawaddr;
258 struct sctp_paramhdr *param; 258 struct sctp_paramhdr *param;
@@ -350,7 +350,7 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
350/* Copy out addresses from the global local address list. */ 350/* Copy out addresses from the global local address list. */
351static int sctp_copy_one_addr(struct sctp_bind_addr *dest, 351static int sctp_copy_one_addr(struct sctp_bind_addr *dest,
352 union sctp_addr *addr, 352 union sctp_addr *addr,
353 sctp_scope_t scope, unsigned int __nocast gfp, 353 sctp_scope_t scope, gfp_t gfp,
354 int flags) 354 int flags)
355{ 355{
356 int error = 0; 356 int error = 0;
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 61da2937e641..83ef411772f4 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -62,7 +62,7 @@ static void sctp_datamsg_init(struct sctp_datamsg *msg)
62} 62}
63 63
64/* Allocate and initialize datamsg. */ 64/* Allocate and initialize datamsg. */
65SCTP_STATIC struct sctp_datamsg *sctp_datamsg_new(unsigned int __nocast gfp) 65SCTP_STATIC struct sctp_datamsg *sctp_datamsg_new(gfp_t gfp)
66{ 66{
67 struct sctp_datamsg *msg; 67 struct sctp_datamsg *msg;
68 msg = kmalloc(sizeof(struct sctp_datamsg), gfp); 68 msg = kmalloc(sizeof(struct sctp_datamsg), gfp);
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index e22ccd655965..96984f7a2d69 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -68,7 +68,7 @@ static void sctp_endpoint_bh_rcv(struct sctp_endpoint *ep);
68 */ 68 */
69static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, 69static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
70 struct sock *sk, 70 struct sock *sk,
71 unsigned int __nocast gfp) 71 gfp_t gfp)
72{ 72{
73 struct sctp_sock *sp = sctp_sk(sk); 73 struct sctp_sock *sp = sctp_sk(sk);
74 memset(ep, 0, sizeof(struct sctp_endpoint)); 74 memset(ep, 0, sizeof(struct sctp_endpoint));
@@ -138,8 +138,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
138/* Create a sctp_endpoint with all that boring stuff initialized. 138/* Create a sctp_endpoint with all that boring stuff initialized.
139 * Returns NULL if there isn't enough memory. 139 * Returns NULL if there isn't enough memory.
140 */ 140 */
141struct sctp_endpoint *sctp_endpoint_new(struct sock *sk, 141struct sctp_endpoint *sctp_endpoint_new(struct sock *sk, gfp_t gfp)
142 unsigned int __nocast gfp)
143{ 142{
144 struct sctp_endpoint *ep; 143 struct sctp_endpoint *ep;
145 144
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index e7025be77691..26de4d3e1bd9 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -147,7 +147,7 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist,
147 struct sctp_sockaddr_entry *addr; 147 struct sctp_sockaddr_entry *addr;
148 148
149 rcu_read_lock(); 149 rcu_read_lock();
150 if ((in_dev = __in_dev_get(dev)) == NULL) { 150 if ((in_dev = __in_dev_get_rcu(dev)) == NULL) {
151 rcu_read_unlock(); 151 rcu_read_unlock();
152 return; 152 return;
153 } 153 }
@@ -219,7 +219,7 @@ static void sctp_free_local_addr_list(void)
219 219
220/* Copy the local addresses which are valid for 'scope' into 'bp'. */ 220/* Copy the local addresses which are valid for 'scope' into 'bp'. */
221int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope, 221int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope,
222 unsigned int __nocast gfp, int copy_flags) 222 gfp_t gfp, int copy_flags)
223{ 223{
224 struct sctp_sockaddr_entry *addr; 224 struct sctp_sockaddr_entry *addr;
225 int error = 0; 225 int error = 0;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 3868a8d70cc0..10e82ec2ebd3 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -78,7 +78,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
78static int sctp_process_param(struct sctp_association *asoc, 78static int sctp_process_param(struct sctp_association *asoc,
79 union sctp_params param, 79 union sctp_params param,
80 const union sctp_addr *peer_addr, 80 const union sctp_addr *peer_addr,
81 unsigned int __nocast gfp); 81 gfp_t gfp);
82 82
83/* What was the inbound interface for this chunk? */ 83/* What was the inbound interface for this chunk? */
84int sctp_chunk_iif(const struct sctp_chunk *chunk) 84int sctp_chunk_iif(const struct sctp_chunk *chunk)
@@ -174,7 +174,7 @@ void sctp_init_cause(struct sctp_chunk *chunk, __u16 cause_code,
174 */ 174 */
175struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, 175struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
176 const struct sctp_bind_addr *bp, 176 const struct sctp_bind_addr *bp,
177 unsigned int __nocast gfp, int vparam_len) 177 gfp_t gfp, int vparam_len)
178{ 178{
179 sctp_inithdr_t init; 179 sctp_inithdr_t init;
180 union sctp_params addrs; 180 union sctp_params addrs;
@@ -261,7 +261,7 @@ nodata:
261 261
262struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, 262struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
263 const struct sctp_chunk *chunk, 263 const struct sctp_chunk *chunk,
264 unsigned int __nocast gfp, int unkparam_len) 264 gfp_t gfp, int unkparam_len)
265{ 265{
266 sctp_inithdr_t initack; 266 sctp_inithdr_t initack;
267 struct sctp_chunk *retval; 267 struct sctp_chunk *retval;
@@ -1234,7 +1234,7 @@ void sctp_chunk_assign_tsn(struct sctp_chunk *chunk)
1234/* Create a CLOSED association to use with an incoming packet. */ 1234/* Create a CLOSED association to use with an incoming packet. */
1235struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep, 1235struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep,
1236 struct sctp_chunk *chunk, 1236 struct sctp_chunk *chunk,
1237 unsigned int __nocast gfp) 1237 gfp_t gfp)
1238{ 1238{
1239 struct sctp_association *asoc; 1239 struct sctp_association *asoc;
1240 struct sk_buff *skb; 1240 struct sk_buff *skb;
@@ -1349,7 +1349,7 @@ nodata:
1349struct sctp_association *sctp_unpack_cookie( 1349struct sctp_association *sctp_unpack_cookie(
1350 const struct sctp_endpoint *ep, 1350 const struct sctp_endpoint *ep,
1351 const struct sctp_association *asoc, 1351 const struct sctp_association *asoc,
1352 struct sctp_chunk *chunk, unsigned int __nocast gfp, 1352 struct sctp_chunk *chunk, gfp_t gfp,
1353 int *error, struct sctp_chunk **errp) 1353 int *error, struct sctp_chunk **errp)
1354{ 1354{
1355 struct sctp_association *retval = NULL; 1355 struct sctp_association *retval = NULL;
@@ -1814,7 +1814,7 @@ int sctp_verify_init(const struct sctp_association *asoc,
1814 */ 1814 */
1815int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, 1815int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid,
1816 const union sctp_addr *peer_addr, 1816 const union sctp_addr *peer_addr,
1817 sctp_init_chunk_t *peer_init, unsigned int __nocast gfp) 1817 sctp_init_chunk_t *peer_init, gfp_t gfp)
1818{ 1818{
1819 union sctp_params param; 1819 union sctp_params param;
1820 struct sctp_transport *transport; 1820 struct sctp_transport *transport;
@@ -1985,7 +1985,7 @@ nomem:
1985static int sctp_process_param(struct sctp_association *asoc, 1985static int sctp_process_param(struct sctp_association *asoc,
1986 union sctp_params param, 1986 union sctp_params param,
1987 const union sctp_addr *peer_addr, 1987 const union sctp_addr *peer_addr,
1988 unsigned int __nocast gfp) 1988 gfp_t gfp)
1989{ 1989{
1990 union sctp_addr addr; 1990 union sctp_addr addr;
1991 int i; 1991 int i;
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 39c970b5b198..f84173ea8ec1 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -63,7 +63,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
63 void *event_arg, 63 void *event_arg,
64 sctp_disposition_t status, 64 sctp_disposition_t status,
65 sctp_cmd_seq_t *commands, 65 sctp_cmd_seq_t *commands,
66 unsigned int __nocast gfp); 66 gfp_t gfp);
67static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, 67static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
68 sctp_state_t state, 68 sctp_state_t state,
69 struct sctp_endpoint *ep, 69 struct sctp_endpoint *ep,
@@ -71,7 +71,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
71 void *event_arg, 71 void *event_arg,
72 sctp_disposition_t status, 72 sctp_disposition_t status,
73 sctp_cmd_seq_t *commands, 73 sctp_cmd_seq_t *commands,
74 unsigned int __nocast gfp); 74 gfp_t gfp);
75 75
76/******************************************************************** 76/********************************************************************
77 * Helper functions 77 * Helper functions
@@ -498,7 +498,7 @@ static int sctp_cmd_process_init(sctp_cmd_seq_t *commands,
498 struct sctp_association *asoc, 498 struct sctp_association *asoc,
499 struct sctp_chunk *chunk, 499 struct sctp_chunk *chunk,
500 sctp_init_chunk_t *peer_init, 500 sctp_init_chunk_t *peer_init,
501 unsigned int __nocast gfp) 501 gfp_t gfp)
502{ 502{
503 int error; 503 int error;
504 504
@@ -853,7 +853,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
853 struct sctp_endpoint *ep, 853 struct sctp_endpoint *ep,
854 struct sctp_association *asoc, 854 struct sctp_association *asoc,
855 void *event_arg, 855 void *event_arg,
856 unsigned int __nocast gfp) 856 gfp_t gfp)
857{ 857{
858 sctp_cmd_seq_t commands; 858 sctp_cmd_seq_t commands;
859 const sctp_sm_table_entry_t *state_fn; 859 const sctp_sm_table_entry_t *state_fn;
@@ -898,7 +898,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
898 void *event_arg, 898 void *event_arg,
899 sctp_disposition_t status, 899 sctp_disposition_t status,
900 sctp_cmd_seq_t *commands, 900 sctp_cmd_seq_t *commands,
901 unsigned int __nocast gfp) 901 gfp_t gfp)
902{ 902{
903 int error; 903 int error;
904 904
@@ -986,7 +986,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
986 void *event_arg, 986 void *event_arg,
987 sctp_disposition_t status, 987 sctp_disposition_t status,
988 sctp_cmd_seq_t *commands, 988 sctp_cmd_seq_t *commands,
989 unsigned int __nocast gfp) 989 gfp_t gfp)
990{ 990{
991 int error = 0; 991 int error = 0;
992 int force; 992 int force;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 91ec8c936913..02e068d3450d 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3159,8 +3159,9 @@ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval
3159 return 0; 3159 return 0;
3160} 3160}
3161 3161
3162static int sctp_getsockopt_peer_addrs_num(struct sock *sk, int len, 3162static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len,
3163 char __user *optval, int __user *optlen) 3163 char __user *optval,
3164 int __user *optlen)
3164{ 3165{
3165 sctp_assoc_t id; 3166 sctp_assoc_t id;
3166 struct sctp_association *asoc; 3167 struct sctp_association *asoc;
@@ -3185,23 +3186,28 @@ static int sctp_getsockopt_peer_addrs_num(struct sock *sk, int len,
3185 return cnt; 3186 return cnt;
3186} 3187}
3187 3188
3188static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, 3189/*
3189 char __user *optval, int __user *optlen) 3190 * Old API for getting list of peer addresses. Does not work for 32-bit
3191 * programs running on a 64-bit kernel
3192 */
3193static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len,
3194 char __user *optval,
3195 int __user *optlen)
3190{ 3196{
3191 struct sctp_association *asoc; 3197 struct sctp_association *asoc;
3192 struct list_head *pos; 3198 struct list_head *pos;
3193 int cnt = 0; 3199 int cnt = 0;
3194 struct sctp_getaddrs getaddrs; 3200 struct sctp_getaddrs_old getaddrs;
3195 struct sctp_transport *from; 3201 struct sctp_transport *from;
3196 void __user *to; 3202 void __user *to;
3197 union sctp_addr temp; 3203 union sctp_addr temp;
3198 struct sctp_sock *sp = sctp_sk(sk); 3204 struct sctp_sock *sp = sctp_sk(sk);
3199 int addrlen; 3205 int addrlen;
3200 3206
3201 if (len != sizeof(struct sctp_getaddrs)) 3207 if (len != sizeof(struct sctp_getaddrs_old))
3202 return -EINVAL; 3208 return -EINVAL;
3203 3209
3204 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) 3210 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs_old)))
3205 return -EFAULT; 3211 return -EFAULT;
3206 3212
3207 if (getaddrs.addr_num <= 0) return -EINVAL; 3213 if (getaddrs.addr_num <= 0) return -EINVAL;
@@ -3225,15 +3231,69 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
3225 if (cnt >= getaddrs.addr_num) break; 3231 if (cnt >= getaddrs.addr_num) break;
3226 } 3232 }
3227 getaddrs.addr_num = cnt; 3233 getaddrs.addr_num = cnt;
3228 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs))) 3234 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs_old)))
3235 return -EFAULT;
3236
3237 return 0;
3238}
3239
3240static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
3241 char __user *optval, int __user *optlen)
3242{
3243 struct sctp_association *asoc;
3244 struct list_head *pos;
3245 int cnt = 0;
3246 struct sctp_getaddrs getaddrs;
3247 struct sctp_transport *from;
3248 void __user *to;
3249 union sctp_addr temp;
3250 struct sctp_sock *sp = sctp_sk(sk);
3251 int addrlen;
3252 size_t space_left;
3253 int bytes_copied;
3254
3255 if (len < sizeof(struct sctp_getaddrs))
3256 return -EINVAL;
3257
3258 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs)))
3259 return -EFAULT;
3260
3261 /* For UDP-style sockets, id specifies the association to query. */
3262 asoc = sctp_id2assoc(sk, getaddrs.assoc_id);
3263 if (!asoc)
3264 return -EINVAL;
3265
3266 to = optval + offsetof(struct sctp_getaddrs,addrs);
3267 space_left = len - sizeof(struct sctp_getaddrs) -
3268 offsetof(struct sctp_getaddrs,addrs);
3269
3270 list_for_each(pos, &asoc->peer.transport_addr_list) {
3271 from = list_entry(pos, struct sctp_transport, transports);
3272 memcpy(&temp, &from->ipaddr, sizeof(temp));
3273 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
3274 addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len;
3275 if(space_left < addrlen)
3276 return -ENOMEM;
3277 temp.v4.sin_port = htons(temp.v4.sin_port);
3278 if (copy_to_user(to, &temp, addrlen))
3279 return -EFAULT;
3280 to += addrlen;
3281 cnt++;
3282 space_left -= addrlen;
3283 }
3284
3285 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num))
3286 return -EFAULT;
3287 bytes_copied = ((char __user *)to) - optval;
3288 if (put_user(bytes_copied, optlen))
3229 return -EFAULT; 3289 return -EFAULT;
3230 3290
3231 return 0; 3291 return 0;
3232} 3292}
3233 3293
3234static int sctp_getsockopt_local_addrs_num(struct sock *sk, int len, 3294static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len,
3235 char __user *optval, 3295 char __user *optval,
3236 int __user *optlen) 3296 int __user *optlen)
3237{ 3297{
3238 sctp_assoc_t id; 3298 sctp_assoc_t id;
3239 struct sctp_bind_addr *bp; 3299 struct sctp_bind_addr *bp;
@@ -3306,8 +3366,8 @@ done:
3306/* Helper function that copies local addresses to user and returns the number 3366/* Helper function that copies local addresses to user and returns the number
3307 * of addresses copied. 3367 * of addresses copied.
3308 */ 3368 */
3309static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, int max_addrs, 3369static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_addrs,
3310 void __user *to) 3370 void __user *to)
3311{ 3371{
3312 struct list_head *pos; 3372 struct list_head *pos;
3313 struct sctp_sockaddr_entry *addr; 3373 struct sctp_sockaddr_entry *addr;
@@ -3341,14 +3401,54 @@ static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, int max_addrs,
3341 return cnt; 3401 return cnt;
3342} 3402}
3343 3403
3344static int sctp_getsockopt_local_addrs(struct sock *sk, int len, 3404static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port,
3345 char __user *optval, int __user *optlen) 3405 void * __user *to, size_t space_left)
3406{
3407 struct list_head *pos;
3408 struct sctp_sockaddr_entry *addr;
3409 unsigned long flags;
3410 union sctp_addr temp;
3411 int cnt = 0;
3412 int addrlen;
3413
3414 sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags);
3415 list_for_each(pos, &sctp_local_addr_list) {
3416 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
3417 if ((PF_INET == sk->sk_family) &&
3418 (AF_INET6 == addr->a.sa.sa_family))
3419 continue;
3420 memcpy(&temp, &addr->a, sizeof(temp));
3421 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk),
3422 &temp);
3423 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
3424 if(space_left<addrlen)
3425 return -ENOMEM;
3426 temp.v4.sin_port = htons(port);
3427 if (copy_to_user(*to, &temp, addrlen)) {
3428 sctp_spin_unlock_irqrestore(&sctp_local_addr_lock,
3429 flags);
3430 return -EFAULT;
3431 }
3432 *to += addrlen;
3433 cnt ++;
3434 space_left -= addrlen;
3435 }
3436 sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, flags);
3437
3438 return cnt;
3439}
3440
3441/* Old API for getting list of local addresses. Does not work for 32-bit
3442 * programs running on a 64-bit kernel
3443 */
3444static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
3445 char __user *optval, int __user *optlen)
3346{ 3446{
3347 struct sctp_bind_addr *bp; 3447 struct sctp_bind_addr *bp;
3348 struct sctp_association *asoc; 3448 struct sctp_association *asoc;
3349 struct list_head *pos; 3449 struct list_head *pos;
3350 int cnt = 0; 3450 int cnt = 0;
3351 struct sctp_getaddrs getaddrs; 3451 struct sctp_getaddrs_old getaddrs;
3352 struct sctp_sockaddr_entry *addr; 3452 struct sctp_sockaddr_entry *addr;
3353 void __user *to; 3453 void __user *to;
3354 union sctp_addr temp; 3454 union sctp_addr temp;
@@ -3357,10 +3457,10 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
3357 rwlock_t *addr_lock; 3457 rwlock_t *addr_lock;
3358 int err = 0; 3458 int err = 0;
3359 3459
3360 if (len != sizeof(struct sctp_getaddrs)) 3460 if (len != sizeof(struct sctp_getaddrs_old))
3361 return -EINVAL; 3461 return -EINVAL;
3362 3462
3363 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) 3463 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs_old)))
3364 return -EFAULT; 3464 return -EFAULT;
3365 3465
3366 if (getaddrs.addr_num <= 0) return -EINVAL; 3466 if (getaddrs.addr_num <= 0) return -EINVAL;
@@ -3392,8 +3492,9 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
3392 addr = list_entry(bp->address_list.next, 3492 addr = list_entry(bp->address_list.next,
3393 struct sctp_sockaddr_entry, list); 3493 struct sctp_sockaddr_entry, list);
3394 if (sctp_is_any(&addr->a)) { 3494 if (sctp_is_any(&addr->a)) {
3395 cnt = sctp_copy_laddrs_to_user(sk, bp->port, 3495 cnt = sctp_copy_laddrs_to_user_old(sk, bp->port,
3396 getaddrs.addr_num, to); 3496 getaddrs.addr_num,
3497 to);
3397 if (cnt < 0) { 3498 if (cnt < 0) {
3398 err = cnt; 3499 err = cnt;
3399 goto unlock; 3500 goto unlock;
@@ -3419,7 +3520,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
3419 3520
3420copy_getaddrs: 3521copy_getaddrs:
3421 getaddrs.addr_num = cnt; 3522 getaddrs.addr_num = cnt;
3422 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs))) 3523 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs_old)))
3423 err = -EFAULT; 3524 err = -EFAULT;
3424 3525
3425unlock: 3526unlock:
@@ -3427,6 +3528,99 @@ unlock:
3427 return err; 3528 return err;
3428} 3529}
3429 3530
3531static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
3532 char __user *optval, int __user *optlen)
3533{
3534 struct sctp_bind_addr *bp;
3535 struct sctp_association *asoc;
3536 struct list_head *pos;
3537 int cnt = 0;
3538 struct sctp_getaddrs getaddrs;
3539 struct sctp_sockaddr_entry *addr;
3540 void __user *to;
3541 union sctp_addr temp;
3542 struct sctp_sock *sp = sctp_sk(sk);
3543 int addrlen;
3544 rwlock_t *addr_lock;
3545 int err = 0;
3546 size_t space_left;
3547 int bytes_copied;
3548
3549 if (len <= sizeof(struct sctp_getaddrs))
3550 return -EINVAL;
3551
3552 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs)))
3553 return -EFAULT;
3554
3555 /*
3556 * For UDP-style sockets, id specifies the association to query.
3557 * If the id field is set to the value '0' then the locally bound
3558 * addresses are returned without regard to any particular
3559 * association.
3560 */
3561 if (0 == getaddrs.assoc_id) {
3562 bp = &sctp_sk(sk)->ep->base.bind_addr;
3563 addr_lock = &sctp_sk(sk)->ep->base.addr_lock;
3564 } else {
3565 asoc = sctp_id2assoc(sk, getaddrs.assoc_id);
3566 if (!asoc)
3567 return -EINVAL;
3568 bp = &asoc->base.bind_addr;
3569 addr_lock = &asoc->base.addr_lock;
3570 }
3571
3572 to = optval + offsetof(struct sctp_getaddrs,addrs);
3573 space_left = len - sizeof(struct sctp_getaddrs) -
3574 offsetof(struct sctp_getaddrs,addrs);
3575
3576 sctp_read_lock(addr_lock);
3577
3578 /* If the endpoint is bound to 0.0.0.0 or ::0, get the valid
3579 * addresses from the global local address list.
3580 */
3581 if (sctp_list_single_entry(&bp->address_list)) {
3582 addr = list_entry(bp->address_list.next,
3583 struct sctp_sockaddr_entry, list);
3584 if (sctp_is_any(&addr->a)) {
3585 cnt = sctp_copy_laddrs_to_user(sk, bp->port,
3586 &to, space_left);
3587 if (cnt < 0) {
3588 err = cnt;
3589 goto unlock;
3590 }
3591 goto copy_getaddrs;
3592 }
3593 }
3594
3595 list_for_each(pos, &bp->address_list) {
3596 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
3597 memcpy(&temp, &addr->a, sizeof(temp));
3598 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
3599 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
3600 if(space_left < addrlen)
3601 return -ENOMEM; /*fixme: right error?*/
3602 temp.v4.sin_port = htons(temp.v4.sin_port);
3603 if (copy_to_user(to, &temp, addrlen)) {
3604 err = -EFAULT;
3605 goto unlock;
3606 }
3607 to += addrlen;
3608 cnt ++;
3609 space_left -= addrlen;
3610 }
3611
3612copy_getaddrs:
3613 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num))
3614 return -EFAULT;
3615 bytes_copied = ((char __user *)to) - optval;
3616 if (put_user(bytes_copied, optlen))
3617 return -EFAULT;
3618
3619unlock:
3620 sctp_read_unlock(addr_lock);
3621 return err;
3622}
3623
3430/* 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) 3624/* 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
3431 * 3625 *
3432 * Requests that the local SCTP stack use the enclosed peer address as 3626 * Requests that the local SCTP stack use the enclosed peer address as
@@ -3807,12 +4001,20 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
3807 case SCTP_INITMSG: 4001 case SCTP_INITMSG:
3808 retval = sctp_getsockopt_initmsg(sk, len, optval, optlen); 4002 retval = sctp_getsockopt_initmsg(sk, len, optval, optlen);
3809 break; 4003 break;
3810 case SCTP_GET_PEER_ADDRS_NUM: 4004 case SCTP_GET_PEER_ADDRS_NUM_OLD:
3811 retval = sctp_getsockopt_peer_addrs_num(sk, len, optval, 4005 retval = sctp_getsockopt_peer_addrs_num_old(sk, len, optval,
4006 optlen);
4007 break;
4008 case SCTP_GET_LOCAL_ADDRS_NUM_OLD:
4009 retval = sctp_getsockopt_local_addrs_num_old(sk, len, optval,
4010 optlen);
4011 break;
4012 case SCTP_GET_PEER_ADDRS_OLD:
4013 retval = sctp_getsockopt_peer_addrs_old(sk, len, optval,
3812 optlen); 4014 optlen);
3813 break; 4015 break;
3814 case SCTP_GET_LOCAL_ADDRS_NUM: 4016 case SCTP_GET_LOCAL_ADDRS_OLD:
3815 retval = sctp_getsockopt_local_addrs_num(sk, len, optval, 4017 retval = sctp_getsockopt_local_addrs_old(sk, len, optval,
3816 optlen); 4018 optlen);
3817 break; 4019 break;
3818 case SCTP_GET_PEER_ADDRS: 4020 case SCTP_GET_PEER_ADDRS:
diff --git a/net/sctp/ssnmap.c b/net/sctp/ssnmap.c
index 25037daf3fa0..cbe2513d2822 100644
--- a/net/sctp/ssnmap.c
+++ b/net/sctp/ssnmap.c
@@ -58,7 +58,7 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
58 * Allocate room to store at least 'len' contiguous TSNs. 58 * Allocate room to store at least 'len' contiguous TSNs.
59 */ 59 */
60struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, 60struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
61 unsigned int __nocast gfp) 61 gfp_t gfp)
62{ 62{
63 struct sctp_ssnmap *retval; 63 struct sctp_ssnmap *retval;
64 int size; 64 int size;
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index d2f04ebe5081..6bc27200e6ca 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -57,7 +57,7 @@
57/* Initialize a new transport from provided memory. */ 57/* Initialize a new transport from provided memory. */
58static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, 58static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
59 const union sctp_addr *addr, 59 const union sctp_addr *addr,
60 unsigned int __nocast gfp) 60 gfp_t gfp)
61{ 61{
62 /* Copy in the address. */ 62 /* Copy in the address. */
63 peer->ipaddr = *addr; 63 peer->ipaddr = *addr;
@@ -122,7 +122,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
122 122
123/* Allocate and initialize a new transport. */ 123/* Allocate and initialize a new transport. */
124struct sctp_transport *sctp_transport_new(const union sctp_addr *addr, 124struct sctp_transport *sctp_transport_new(const union sctp_addr *addr,
125 unsigned int __nocast gfp) 125 gfp_t gfp)
126{ 126{
127 struct sctp_transport *transport; 127 struct sctp_transport *transport;
128 128
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index 0abd5101107c..057e7fac3af0 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -74,7 +74,7 @@ SCTP_STATIC void sctp_ulpevent_init(struct sctp_ulpevent *event, int msg_flags)
74 74
75/* Create a new sctp_ulpevent. */ 75/* Create a new sctp_ulpevent. */
76SCTP_STATIC struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags, 76SCTP_STATIC struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags,
77 unsigned int __nocast gfp) 77 gfp_t gfp)
78{ 78{
79 struct sctp_ulpevent *event; 79 struct sctp_ulpevent *event;
80 struct sk_buff *skb; 80 struct sk_buff *skb;
@@ -136,7 +136,7 @@ static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event)
136struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( 136struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
137 const struct sctp_association *asoc, 137 const struct sctp_association *asoc,
138 __u16 flags, __u16 state, __u16 error, __u16 outbound, 138 __u16 flags, __u16 state, __u16 error, __u16 outbound,
139 __u16 inbound, unsigned int __nocast gfp) 139 __u16 inbound, gfp_t gfp)
140{ 140{
141 struct sctp_ulpevent *event; 141 struct sctp_ulpevent *event;
142 struct sctp_assoc_change *sac; 142 struct sctp_assoc_change *sac;
@@ -237,7 +237,7 @@ fail:
237struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( 237struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
238 const struct sctp_association *asoc, 238 const struct sctp_association *asoc,
239 const struct sockaddr_storage *aaddr, 239 const struct sockaddr_storage *aaddr,
240 int flags, int state, int error, unsigned int __nocast gfp) 240 int flags, int state, int error, gfp_t gfp)
241{ 241{
242 struct sctp_ulpevent *event; 242 struct sctp_ulpevent *event;
243 struct sctp_paddr_change *spc; 243 struct sctp_paddr_change *spc;
@@ -350,7 +350,7 @@ fail:
350 */ 350 */
351struct sctp_ulpevent *sctp_ulpevent_make_remote_error( 351struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
352 const struct sctp_association *asoc, struct sctp_chunk *chunk, 352 const struct sctp_association *asoc, struct sctp_chunk *chunk,
353 __u16 flags, unsigned int __nocast gfp) 353 __u16 flags, gfp_t gfp)
354{ 354{
355 struct sctp_ulpevent *event; 355 struct sctp_ulpevent *event;
356 struct sctp_remote_error *sre; 356 struct sctp_remote_error *sre;
@@ -448,7 +448,7 @@ fail:
448 */ 448 */
449struct sctp_ulpevent *sctp_ulpevent_make_send_failed( 449struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
450 const struct sctp_association *asoc, struct sctp_chunk *chunk, 450 const struct sctp_association *asoc, struct sctp_chunk *chunk,
451 __u16 flags, __u32 error, unsigned int __nocast gfp) 451 __u16 flags, __u32 error, gfp_t gfp)
452{ 452{
453 struct sctp_ulpevent *event; 453 struct sctp_ulpevent *event;
454 struct sctp_send_failed *ssf; 454 struct sctp_send_failed *ssf;
@@ -557,7 +557,7 @@ fail:
557 */ 557 */
558struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( 558struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
559 const struct sctp_association *asoc, 559 const struct sctp_association *asoc,
560 __u16 flags, unsigned int __nocast gfp) 560 __u16 flags, gfp_t gfp)
561{ 561{
562 struct sctp_ulpevent *event; 562 struct sctp_ulpevent *event;
563 struct sctp_shutdown_event *sse; 563 struct sctp_shutdown_event *sse;
@@ -620,7 +620,7 @@ fail:
620 * 5.3.1.6 SCTP_ADAPTION_INDICATION 620 * 5.3.1.6 SCTP_ADAPTION_INDICATION
621 */ 621 */
622struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication( 622struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication(
623 const struct sctp_association *asoc, unsigned int __nocast gfp) 623 const struct sctp_association *asoc, gfp_t gfp)
624{ 624{
625 struct sctp_ulpevent *event; 625 struct sctp_ulpevent *event;
626 struct sctp_adaption_event *sai; 626 struct sctp_adaption_event *sai;
@@ -657,7 +657,7 @@ fail:
657 */ 657 */
658struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, 658struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
659 struct sctp_chunk *chunk, 659 struct sctp_chunk *chunk,
660 unsigned int __nocast gfp) 660 gfp_t gfp)
661{ 661{
662 struct sctp_ulpevent *event = NULL; 662 struct sctp_ulpevent *event = NULL;
663 struct sk_buff *skb; 663 struct sk_buff *skb;
@@ -719,7 +719,7 @@ fail:
719 */ 719 */
720struct sctp_ulpevent *sctp_ulpevent_make_pdapi( 720struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
721 const struct sctp_association *asoc, __u32 indication, 721 const struct sctp_association *asoc, __u32 indication,
722 unsigned int __nocast gfp) 722 gfp_t gfp)
723{ 723{
724 struct sctp_ulpevent *event; 724 struct sctp_ulpevent *event;
725 struct sctp_pdapi_event *pd; 725 struct sctp_pdapi_event *pd;
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index ec2c857eae7f..2080b2d28c98 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -100,7 +100,7 @@ void sctp_ulpq_free(struct sctp_ulpq *ulpq)
100 100
101/* Process an incoming DATA chunk. */ 101/* Process an incoming DATA chunk. */
102int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, 102int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
103 unsigned int __nocast gfp) 103 gfp_t gfp)
104{ 104{
105 struct sk_buff_head temp; 105 struct sk_buff_head temp;
106 sctp_data_chunk_t *hdr; 106 sctp_data_chunk_t *hdr;
@@ -792,7 +792,7 @@ static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed)
792/* Partial deliver the first message as there is pressure on rwnd. */ 792/* Partial deliver the first message as there is pressure on rwnd. */
793void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq, 793void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
794 struct sctp_chunk *chunk, 794 struct sctp_chunk *chunk,
795 unsigned int __nocast gfp) 795 gfp_t gfp)
796{ 796{
797 struct sctp_ulpevent *event; 797 struct sctp_ulpevent *event;
798 struct sctp_association *asoc; 798 struct sctp_association *asoc;
@@ -816,7 +816,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
816 816
817/* Renege some packets to make room for an incoming chunk. */ 817/* Renege some packets to make room for an incoming chunk. */
818void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, 818void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
819 unsigned int __nocast gfp) 819 gfp_t gfp)
820{ 820{
821 struct sctp_association *asoc; 821 struct sctp_association *asoc;
822 __u16 needed, freed; 822 __u16 needed, freed;
@@ -855,7 +855,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
855/* Notify the application if an association is aborted and in 855/* Notify the application if an association is aborted and in
856 * partial delivery mode. Send up any pending received messages. 856 * partial delivery mode. Send up any pending received messages.
857 */ 857 */
858void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, unsigned int __nocast gfp) 858void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp)
859{ 859{
860 struct sctp_ulpevent *ev = NULL; 860 struct sctp_ulpevent *ev = NULL;
861 struct sock *sk; 861 struct sock *sk;
diff --git a/net/socket.c b/net/socket.c
index dbd1a6851edd..3145103cdf54 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1145,8 +1145,11 @@ static int __sock_create(int family, int type, int protocol, struct socket **res
1145 if (!try_module_get(net_families[family]->owner)) 1145 if (!try_module_get(net_families[family]->owner))
1146 goto out_release; 1146 goto out_release;
1147 1147
1148 if ((err = net_families[family]->create(sock, protocol)) < 0) 1148 if ((err = net_families[family]->create(sock, protocol)) < 0) {
1149 sock->ops = NULL;
1149 goto out_module_put; 1150 goto out_module_put;
1151 }
1152
1150 /* 1153 /*
1151 * Now to bump the refcnt of the [loadable] module that owns this 1154 * Now to bump the refcnt of the [loadable] module that owns this
1152 * socket at sock_release time we decrement its refcnt. 1155 * socket at sock_release time we decrement its refcnt.
@@ -1360,16 +1363,16 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int _
1360 newsock->type = sock->type; 1363 newsock->type = sock->type;
1361 newsock->ops = sock->ops; 1364 newsock->ops = sock->ops;
1362 1365
1363 err = security_socket_accept(sock, newsock);
1364 if (err)
1365 goto out_release;
1366
1367 /* 1366 /*
1368 * We don't need try_module_get here, as the listening socket (sock) 1367 * We don't need try_module_get here, as the listening socket (sock)
1369 * has the protocol module (sock->ops->owner) held. 1368 * has the protocol module (sock->ops->owner) held.
1370 */ 1369 */
1371 __module_get(newsock->ops->owner); 1370 __module_get(newsock->ops->owner);
1372 1371
1372 err = security_socket_accept(sock, newsock);
1373 if (err)
1374 goto out_release;
1375
1373 err = sock->ops->accept(sock, newsock, sock->file->f_flags); 1376 err = sock->ops->accept(sock, newsock, sock->file->f_flags);
1374 if (err < 0) 1377 if (err < 0)
1375 goto out_release; 1378 goto out_release;
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index f3104035e35d..54e60a657500 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -719,7 +719,7 @@ static void rpc_async_schedule(void *arg)
719void * 719void *
720rpc_malloc(struct rpc_task *task, size_t size) 720rpc_malloc(struct rpc_task *task, size_t size)
721{ 721{
722 int gfp; 722 gfp_t gfp;
723 723
724 if (task->tk_flags & RPC_TASK_SWAPPER) 724 if (task->tk_flags & RPC_TASK_SWAPPER)
725 gfp = GFP_ATOMIC; 725 gfp = GFP_ATOMIC;
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index c5241fcbb966..55538f6b60ff 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -16,6 +16,8 @@
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/sysctl.h> 17#include <linux/sysctl.h>
18 18
19#include <net/sock.h>
20
19#ifdef CONFIG_INET 21#ifdef CONFIG_INET
20#include <net/ip.h> 22#include <net/ip.h>
21#endif 23#endif
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index fda737d77edc..cbb0ba34a600 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -163,7 +163,7 @@ static void xfrm_policy_timer(unsigned long data)
163 if (xp->dead) 163 if (xp->dead)
164 goto out; 164 goto out;
165 165
166 dir = xp->index & 7; 166 dir = xfrm_policy_id2dir(xp->index);
167 167
168 if (xp->lft.hard_add_expires_seconds) { 168 if (xp->lft.hard_add_expires_seconds) {
169 long tmo = xp->lft.hard_add_expires_seconds + 169 long tmo = xp->lft.hard_add_expires_seconds +
@@ -225,7 +225,7 @@ expired:
225 * SPD calls. 225 * SPD calls.
226 */ 226 */
227 227
228struct xfrm_policy *xfrm_policy_alloc(int gfp) 228struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp)
229{ 229{
230 struct xfrm_policy *policy; 230 struct xfrm_policy *policy;
231 231
@@ -417,7 +417,7 @@ struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete)
417 struct xfrm_policy *pol, **p; 417 struct xfrm_policy *pol, **p;
418 418
419 write_lock_bh(&xfrm_policy_lock); 419 write_lock_bh(&xfrm_policy_lock);
420 for (p = &xfrm_policy_list[id & 7]; (pol=*p)!=NULL; p = &pol->next) { 420 for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL; p = &pol->next) {
421 if (pol->index == id) { 421 if (pol->index == id) {
422 xfrm_pol_hold(pol); 422 xfrm_pol_hold(pol);
423 if (delete) 423 if (delete)
diff --git a/security/keys/Makefile b/security/keys/Makefile
index c392d750b208..5145adfb6a05 100644
--- a/security/keys/Makefile
+++ b/security/keys/Makefile
@@ -6,6 +6,7 @@ obj-y := \
6 key.o \ 6 key.o \
7 keyring.o \ 7 keyring.o \
8 keyctl.o \ 8 keyctl.o \
9 permission.o \
9 process_keys.o \ 10 process_keys.o \
10 request_key.o \ 11 request_key.o \
11 request_key_auth.o \ 12 request_key_auth.o \
diff --git a/security/keys/permission.c b/security/keys/permission.c
new file mode 100644
index 000000000000..03db073ba45c
--- /dev/null
+++ b/security/keys/permission.c
@@ -0,0 +1,70 @@
1/* permission.c: key permission determination
2 *
3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/module.h>
13#include "internal.h"
14
15/*****************************************************************************/
16/*
17 * check to see whether permission is granted to use a key in the desired way,
18 * but permit the security modules to override
19 */
20int key_task_permission(const key_ref_t key_ref,
21 struct task_struct *context,
22 key_perm_t perm)
23{
24 struct key *key;
25 key_perm_t kperm;
26 int ret;
27
28 key = key_ref_to_ptr(key_ref);
29
30 /* use the second 8-bits of permissions for keys the caller owns */
31 if (key->uid == context->fsuid) {
32 kperm = key->perm >> 16;
33 goto use_these_perms;
34 }
35
36 /* use the third 8-bits of permissions for keys the caller has a group
37 * membership in common with */
38 if (key->gid != -1 && key->perm & KEY_GRP_ALL) {
39 if (key->gid == context->fsgid) {
40 kperm = key->perm >> 8;
41 goto use_these_perms;
42 }
43
44 task_lock(context);
45 ret = groups_search(context->group_info, key->gid);
46 task_unlock(context);
47
48 if (ret) {
49 kperm = key->perm >> 8;
50 goto use_these_perms;
51 }
52 }
53
54 /* otherwise use the least-significant 8-bits */
55 kperm = key->perm;
56
57use_these_perms:
58 /* use the top 8-bits of permissions for keys the caller possesses
59 * - possessor permissions are additive with other permissions
60 */
61 if (is_key_possessed(key_ref))
62 kperm |= key->perm >> 24;
63
64 kperm = kperm & perm & KEY_ALL;
65
66 return kperm == perm;
67
68} /* end key_task_permission() */
69
70EXPORT_SYMBOL(key_task_permission);
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index e6dd366d43a3..5cc4bba70db6 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -7,6 +7,8 @@
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 *
11 * See Documentation/keys-request-key.txt
10 */ 12 */
11 13
12#include <linux/module.h> 14#include <linux/module.h>
diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
index 1ecd3d3fa9f8..a8e4069d48cb 100644
--- a/security/keys/request_key_auth.c
+++ b/security/keys/request_key_auth.c
@@ -7,6 +7,8 @@
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 *
11 * See Documentation/keys-request-key.txt
10 */ 12 */
11 13
12#include <linux/module.h> 14#include <linux/module.h>
@@ -96,6 +98,7 @@ static void request_key_auth_destroy(struct key *key)
96 kenter("{%d}", key->serial); 98 kenter("{%d}", key->serial);
97 99
98 key_put(rka->target_key); 100 key_put(rka->target_key);
101 kfree(rka);
99 102
100} /* end request_key_auth_destroy() */ 103} /* end request_key_auth_destroy() */
101 104
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 6e4937fe062b..b13be15165f5 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -630,6 +630,16 @@ static inline u16 inode_mode_to_security_class(umode_t mode)
630 return SECCLASS_FILE; 630 return SECCLASS_FILE;
631} 631}
632 632
633static inline int default_protocol_stream(int protocol)
634{
635 return (protocol == IPPROTO_IP || protocol == IPPROTO_TCP);
636}
637
638static inline int default_protocol_dgram(int protocol)
639{
640 return (protocol == IPPROTO_IP || protocol == IPPROTO_UDP);
641}
642
633static inline u16 socket_type_to_security_class(int family, int type, int protocol) 643static inline u16 socket_type_to_security_class(int family, int type, int protocol)
634{ 644{
635 switch (family) { 645 switch (family) {
@@ -646,10 +656,16 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
646 case PF_INET6: 656 case PF_INET6:
647 switch (type) { 657 switch (type) {
648 case SOCK_STREAM: 658 case SOCK_STREAM:
649 return SECCLASS_TCP_SOCKET; 659 if (default_protocol_stream(protocol))
660 return SECCLASS_TCP_SOCKET;
661 else
662 return SECCLASS_RAWIP_SOCKET;
650 case SOCK_DGRAM: 663 case SOCK_DGRAM:
651 return SECCLASS_UDP_SOCKET; 664 if (default_protocol_dgram(protocol))
652 case SOCK_RAW: 665 return SECCLASS_UDP_SOCKET;
666 else
667 return SECCLASS_RAWIP_SOCKET;
668 default:
653 return SECCLASS_RAWIP_SOCKET; 669 return SECCLASS_RAWIP_SOCKET;
654 } 670 }
655 break; 671 break;
@@ -2970,6 +2986,8 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in
2970 2986
2971 /* 2987 /*
2972 * If PF_INET or PF_INET6, check name_bind permission for the port. 2988 * If PF_INET or PF_INET6, check name_bind permission for the port.
2989 * Multiple address binding for SCTP is not supported yet: we just
2990 * check the first address now.
2973 */ 2991 */
2974 family = sock->sk->sk_family; 2992 family = sock->sk->sk_family;
2975 if (family == PF_INET || family == PF_INET6) { 2993 if (family == PF_INET || family == PF_INET6) {
@@ -3014,12 +3032,12 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in
3014 goto out; 3032 goto out;
3015 } 3033 }
3016 3034
3017 switch(sk->sk_protocol) { 3035 switch(isec->sclass) {
3018 case IPPROTO_TCP: 3036 case SECCLASS_TCP_SOCKET:
3019 node_perm = TCP_SOCKET__NODE_BIND; 3037 node_perm = TCP_SOCKET__NODE_BIND;
3020 break; 3038 break;
3021 3039
3022 case IPPROTO_UDP: 3040 case SECCLASS_UDP_SOCKET:
3023 node_perm = UDP_SOCKET__NODE_BIND; 3041 node_perm = UDP_SOCKET__NODE_BIND;
3024 break; 3042 break;
3025 3043
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 29450befb5da..38b20efc9c0b 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -245,7 +245,7 @@ static pxa2xx_pcm_client_t pxa2xx_ac97_pcm_client = {
245 245
246#ifdef CONFIG_PM 246#ifdef CONFIG_PM
247 247
248static int pxa2xx_ac97_do_suspend(snd_card_t *card, unsigned int state) 248static int pxa2xx_ac97_do_suspend(snd_card_t *card, pm_message_t state)
249{ 249{
250 if (card->power_state != SNDRV_CTL_POWER_D3cold) { 250 if (card->power_state != SNDRV_CTL_POWER_D3cold) {
251 pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; 251 pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 91124ddbdda9..e72cec77f0db 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -106,7 +106,7 @@ struct snd_mem_list {
106 106
107static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, 107static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size,
108 dma_addr_t *dma_handle, 108 dma_addr_t *dma_handle,
109 unsigned int __nocast flags) 109 gfp_t flags)
110{ 110{
111 void *ret; 111 void *ret;
112 u64 dma_mask, coherent_dma_mask; 112 u64 dma_mask, coherent_dma_mask;
diff --git a/sound/core/memory.c b/sound/core/memory.c
index 8fa888fc53a0..7d8e2eebba51 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -89,7 +89,7 @@ void snd_memory_done(void)
89 } 89 }
90} 90}
91 91
92static void *__snd_kmalloc(size_t size, unsigned int __nocast flags, void *caller) 92static void *__snd_kmalloc(size_t size, gfp_t flags, void *caller)
93{ 93{
94 unsigned long cpu_flags; 94 unsigned long cpu_flags;
95 struct snd_alloc_track *t; 95 struct snd_alloc_track *t;
@@ -111,12 +111,12 @@ static void *__snd_kmalloc(size_t size, unsigned int __nocast flags, void *calle
111} 111}
112 112
113#define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0)); 113#define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0));
114void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags) 114void *snd_hidden_kmalloc(size_t size, gfp_t flags)
115{ 115{
116 return _snd_kmalloc(size, flags); 116 return _snd_kmalloc(size, flags);
117} 117}
118 118
119void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags) 119void *snd_hidden_kzalloc(size_t size, gfp_t flags)
120{ 120{
121 void *ret = _snd_kmalloc(size, flags); 121 void *ret = _snd_kmalloc(size, flags);
122 if (ret) 122 if (ret)
@@ -125,7 +125,7 @@ void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags)
125} 125}
126EXPORT_SYMBOL(snd_hidden_kzalloc); 126EXPORT_SYMBOL(snd_hidden_kzalloc);
127 127
128void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags) 128void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags)
129{ 129{
130 void *ret = NULL; 130 void *ret = NULL;
131 if (n != 0 && size > INT_MAX / n) 131 if (n != 0 && size > INT_MAX / n)
@@ -190,7 +190,7 @@ void snd_hidden_vfree(void *obj)
190 snd_wrapper_vfree(obj); 190 snd_wrapper_vfree(obj);
191} 191}
192 192
193char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags) 193char *snd_hidden_kstrdup(const char *s, gfp_t flags)
194{ 194{
195 int len; 195 int len;
196 char *buf; 196 char *buf;
diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c
index b3cee092b1a4..67c24c8e8e7b 100644
--- a/sound/core/seq/instr/ainstr_iw.c
+++ b/sound/core/seq/instr/ainstr_iw.c
@@ -58,7 +58,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
58 iwffff_xenv_t *ex, 58 iwffff_xenv_t *ex,
59 char __user **data, 59 char __user **data,
60 long *len, 60 long *len,
61 unsigned int __nocast gfp_mask) 61 gfp_t gfp_mask)
62{ 62{
63 __u32 stype; 63 __u32 stype;
64 iwffff_env_record_t *rp, *rp_last; 64 iwffff_env_record_t *rp, *rp_last;
diff --git a/sound/core/wrappers.c b/sound/core/wrappers.c
index 508e6d67ee19..296b716f1376 100644
--- a/sound/core/wrappers.c
+++ b/sound/core/wrappers.c
@@ -27,7 +27,7 @@
27#include <linux/fs.h> 27#include <linux/fs.h>
28 28
29#ifdef CONFIG_SND_DEBUG_MEMORY 29#ifdef CONFIG_SND_DEBUG_MEMORY
30void *snd_wrapper_kmalloc(size_t size, unsigned int __nocast flags) 30void *snd_wrapper_kmalloc(size_t size, gfp_t flags)
31{ 31{
32 return kmalloc(size, flags); 32 return kmalloc(size, flags);
33} 33}
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index e2d2babcd20b..4ba268f251e3 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -914,6 +914,7 @@ static int __init alsa_card_opl3sa2_init(void)
914#endif 914#endif
915#ifdef CONFIG_PNP 915#ifdef CONFIG_PNP
916 pnp_unregister_card_driver(&opl3sa2_pnpc_driver); 916 pnp_unregister_card_driver(&opl3sa2_pnpc_driver);
917 pnp_unregister_driver(&opl3sa2_pnp_driver);
917#endif 918#endif
918 return -ENODEV; 919 return -ENODEV;
919 } 920 }
@@ -927,6 +928,7 @@ static void __exit alsa_card_opl3sa2_exit(void)
927#ifdef CONFIG_PNP 928#ifdef CONFIG_PNP
928 /* PnP cards first */ 929 /* PnP cards first */
929 pnp_unregister_card_driver(&opl3sa2_pnpc_driver); 930 pnp_unregister_card_driver(&opl3sa2_pnpc_driver);
931 pnp_unregister_driver(&opl3sa2_pnp_driver);
930#endif 932#endif
931 for (idx = 0; idx < SNDRV_CARDS; idx++) 933 for (idx = 0; idx < SNDRV_CARDS; idx++)
932 snd_card_free(snd_opl3sa2_legacy[idx]); 934 snd_card_free(snd_opl3sa2_legacy[idx]);
diff --git a/sound/pci/ac97/ac97_bus.c b/sound/pci/ac97/ac97_bus.c
index 227f8b9f67ce..becbc420ba41 100644
--- a/sound/pci/ac97/ac97_bus.c
+++ b/sound/pci/ac97/ac97_bus.c
@@ -17,25 +17,21 @@
17#include <linux/string.h> 17#include <linux/string.h>
18 18
19/* 19/*
20 * Codec families have names seperated by commas, so we search for an 20 * Let drivers decide whether they want to support given codec from their
21 * individual codec name within the family string. 21 * probe method. Drivers have direct access to the ac97_t structure and may
22 * decide based on the id field amongst other things.
22 */ 23 */
23static int ac97_bus_match(struct device *dev, struct device_driver *drv) 24static int ac97_bus_match(struct device *dev, struct device_driver *drv)
24{ 25{
25 return (strstr(dev->bus_id, drv->name) != NULL); 26 return 1;
26} 27}
27 28
28static int ac97_bus_suspend(struct device *dev, pm_message_t state) 29static int ac97_bus_suspend(struct device *dev, pm_message_t state)
29{ 30{
30 int ret = 0; 31 int ret = 0;
31 32
32 if (dev->driver && dev->driver->suspend) { 33 if (dev->driver && dev->driver->suspend)
33 ret = dev->driver->suspend(dev, state, SUSPEND_DISABLE); 34 ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN);
34 if (ret == 0)
35 ret = dev->driver->suspend(dev, state, SUSPEND_SAVE_STATE);
36 if (ret == 0)
37 ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN);
38 }
39 return ret; 35 return ret;
40} 36}
41 37
@@ -43,13 +39,8 @@ static int ac97_bus_resume(struct device *dev)
43{ 39{
44 int ret = 0; 40 int ret = 0;
45 41
46 if (dev->driver && dev->driver->resume) { 42 if (dev->driver && dev->driver->resume)
47 ret = dev->driver->resume(dev, RESUME_POWER_ON); 43 ret = dev->driver->resume(dev, RESUME_POWER_ON);
48 if (ret == 0)
49 ret = dev->driver->resume(dev, RESUME_RESTORE_STATE);
50 if (ret == 0)
51 ret = dev->driver->resume(dev, RESUME_ENABLE);
52 }
53 return ret; 44 return ret;
54} 45}
55 46
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index e64cb07a39c2..41fc290149ed 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1557,7 +1557,7 @@ static int snd_ac97_modem_build(snd_card_t * card, ac97_t * ac97)
1557 1557
1558 /* build modem switches */ 1558 /* build modem switches */
1559 for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++) 1559 for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++)
1560 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_modem_switches[idx], ac97))) < 0) 1560 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ac97_controls_modem_switches[idx], ac97))) < 0)
1561 return err; 1561 return err;
1562 1562
1563 /* build chip specific controls */ 1563 /* build chip specific controls */
@@ -1828,7 +1828,6 @@ static int snd_ac97_dev_register(snd_device_t *device)
1828 1828
1829 ac97->dev.bus = &ac97_bus_type; 1829 ac97->dev.bus = &ac97_bus_type;
1830 ac97->dev.parent = ac97->bus->card->dev; 1830 ac97->dev.parent = ac97->bus->card->dev;
1831 ac97->dev.platform_data = ac97;
1832 ac97->dev.release = ac97_device_release; 1831 ac97->dev.release = ac97_device_release;
1833 snprintf(ac97->dev.bus_id, BUS_ID_SIZE, "card%d-%d", ac97->bus->card->number, ac97->num); 1832 snprintf(ac97->dev.bus_id, BUS_ID_SIZE, "card%d-%d", ac97->bus->card->number, ac97->num);
1834 if ((err = device_register(&ac97->dev)) < 0) { 1833 if ((err = device_register(&ac97->dev)) < 0) {
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 045ddc743edc..0238cc65d32a 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -2752,7 +2752,11 @@ AC97_DOUBLE("Modem Speaker Volume", 0x5c, 14, 12, 3, 1)
2752 2752
2753static int patch_si3036_specific(ac97_t * ac97) 2753static int patch_si3036_specific(ac97_t * ac97)
2754{ 2754{
2755 return patch_build_controls(ac97, snd_ac97_controls_si3036, ARRAY_SIZE(snd_ac97_controls_si3036)); 2755 int idx, err;
2756 for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_si3036); idx++)
2757 if ((err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97))) < 0)
2758 return err;
2759 return 0;
2756} 2760}
2757 2761
2758static struct snd_ac97_build_ops patch_si3036_ops = { 2762static struct snd_ac97_build_ops patch_si3036_ops = {
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index d683f7736a63..f35b558c29b2 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -1993,8 +1993,10 @@ static int __devinit snd_ali_mixer(ali_t * codec)
1993 if ((err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i])) < 0) { 1993 if ((err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i])) < 0) {
1994 snd_printk("ali mixer %d creating error.\n", i); 1994 snd_printk("ali mixer %d creating error.\n", i);
1995 if(i == 0) 1995 if(i == 0)
1996 return err; 1996 return err;
1997 } 1997 codec->num_of_codecs = 1;
1998 break;
1999 }
1998 } 2000 }
1999 2001
2000 if (codec->spdif_support) { 2002 if (codec->spdif_support) {
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index e87e8427f25f..e9cd8e054f25 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -756,9 +756,12 @@ static emu_chip_details_t emu_chip_details[] = {
756 .sblive51 = 1} , 756 .sblive51 = 1} ,
757 /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */ 757 /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */
758 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, 758 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
759 .driver = "EMU10K1", .name = "SBLive! Platinum 5.1 [SB0060]", 759 .driver = "EMU10K1", .name = "SBLive 5.1 [SB0060]",
760 .id = "Live", 760 .id = "Live",
761 .emu10k1_chip = 1, 761 .emu10k1_chip = 1,
762 .ac97_chip = 2, /* ac97 is optional; both SBLive 5.1 and platinum
763 * share the same IDs!
764 */
762 .sblive51 = 1} , 765 .sblive51 = 1} ,
763 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, 766 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
764 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", 767 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]",
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index d71a72e84bcc..7cc831ccd0cb 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -810,8 +810,14 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu,
810 ac97.private_data = emu; 810 ac97.private_data = emu;
811 ac97.private_free = snd_emu10k1_mixer_free_ac97; 811 ac97.private_free = snd_emu10k1_mixer_free_ac97;
812 ac97.scaps = AC97_SCAP_NO_SPDIF; 812 ac97.scaps = AC97_SCAP_NO_SPDIF;
813 if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) 813 if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) {
814 return err; 814 if (emu->card_capabilities->ac97_chip == 1)
815 return err;
816 snd_printd(KERN_INFO "emu10k1: AC97 is optional on this board\n");
817 snd_printd(KERN_INFO" Proceeding without ac97 mixers...\n");
818 snd_device_free(emu->card, pbus);
819 goto no_ac97; /* FIXME: get rid of ugly gotos.. */
820 }
815 if (emu->audigy) { 821 if (emu->audigy) {
816 /* set master volume to 0 dB */ 822 /* set master volume to 0 dB */
817 snd_ac97_write(emu->ac97, AC97_MASTER, 0x0000); 823 snd_ac97_write(emu->ac97, AC97_MASTER, 0x0000);
@@ -836,6 +842,7 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu,
836 for (; *c; c++) 842 for (; *c; c++)
837 remove_ctl(card, *c); 843 remove_ctl(card, *c);
838 } else { 844 } else {
845 no_ac97:
839 if (emu->card_capabilities->ecard) 846 if (emu->card_capabilities->ecard)
840 strcpy(emu->card->mixername, "EMU APS"); 847 strcpy(emu->card->mixername, "EMU APS");
841 else if (emu->audigy) 848 else if (emu->audigy)
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 5b829a1a4c60..d0eb9f2250aa 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -881,10 +881,8 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
881 struct hda_gspec *spec; 881 struct hda_gspec *spec;
882 int err; 882 int err;
883 883
884 if(!codec->afg) { 884 if(!codec->afg)
885 snd_printdd("hda_generic: no generic modem yet\n"); 885 return 0;
886 return -ENODEV;
887 }
888 886
889 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 887 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
890 if (spec == NULL) { 888 if (spec == NULL) {
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9590ece2099d..6fe696e53ea6 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1137,6 +1137,7 @@ static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream)
1137 pos = azx_sd_readl(azx_dev, SD_LPIB); 1137 pos = azx_sd_readl(azx_dev, SD_LPIB);
1138 if (chip->position_fix == POS_FIX_FIFO) 1138 if (chip->position_fix == POS_FIX_FIFO)
1139 pos += azx_dev->fifo_size; 1139 pos += azx_dev->fifo_size;
1140#if 0 /* disabled temprarily, auto-correction doesn't work well... */
1140 else if (chip->position_fix == POS_FIX_AUTO && azx_dev->period_updating) { 1141 else if (chip->position_fix == POS_FIX_AUTO && azx_dev->period_updating) {
1141 /* check the validity of DMA position */ 1142 /* check the validity of DMA position */
1142 unsigned int diff = 0; 1143 unsigned int diff = 0;
@@ -1157,6 +1158,10 @@ static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream)
1157 } 1158 }
1158 azx_dev->period_updating = 0; 1159 azx_dev->period_updating = 0;
1159 } 1160 }
1161#else
1162 else if (chip->position_fix == POS_FIX_AUTO)
1163 pos += azx_dev->fifo_size;
1164#endif
1160 } 1165 }
1161 if (pos >= azx_dev->bufsize) 1166 if (pos >= azx_dev->bufsize)
1162 pos = 0; 1167 pos = 0;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 849b5b50c921..7327deb6df9f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1385,8 +1385,8 @@ static snd_kcontrol_new_t alc880_test_mixer[] = {
1385 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 1385 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1386 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 1386 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1387 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 1387 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1388 ALC_BIND_MUTE("CLFE Playback Volume", 0x0e, 2, HDA_INPUT), 1388 ALC_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
1389 ALC_BIND_MUTE("Side Playback Volume", 0x0f, 2, HDA_INPUT), 1389 ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1390 PIN_CTL_TEST("Front Pin Mode", 0x14), 1390 PIN_CTL_TEST("Front Pin Mode", 0x14),
1391 PIN_CTL_TEST("Surround Pin Mode", 0x15), 1391 PIN_CTL_TEST("Surround Pin Mode", 0x15),
1392 PIN_CTL_TEST("CLFE Pin Mode", 0x16), 1392 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
@@ -1409,18 +1409,6 @@ static snd_kcontrol_new_t alc880_test_mixer[] = {
1409 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), 1409 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
1410 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), 1410 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
1411 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), 1411 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
1412 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1413 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1414 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1415 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1416 {
1417 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1418 .name = "Input Source",
1419 .count = 2,
1420 .info = alc_mux_enum_info,
1421 .get = alc_mux_enum_get,
1422 .put = alc_mux_enum_put,
1423 },
1424 { 1412 {
1425 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1413 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1426 .name = "Channel Mode", 1414 .name = "Channel Mode",
@@ -2243,7 +2231,7 @@ static snd_kcontrol_new_t alc260_base_mixer[] = {
2243 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), 2231 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
2244 ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), 2232 ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
2245 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 2233 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
2246 ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_OUTPUT), 2234 ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
2247 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), 2235 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
2248 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), 2236 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
2249 { 2237 {
@@ -2270,7 +2258,7 @@ static snd_kcontrol_new_t alc260_hp_mixer[] = {
2270 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), 2258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
2271 ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), 2259 ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
2272 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 2260 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
2273 ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_OUTPUT), 2261 ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), 2262 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
2275 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), 2263 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
2276 { 2264 {
@@ -2501,7 +2489,7 @@ static snd_kcontrol_new_t alc882_base_mixer[] = {
2501 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 2489 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2502 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 2490 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2503 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 2491 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2504 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_OUTPUT), 2492 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2505 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 2493 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2506 ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 2494 ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2507 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 2495 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 09f9cbe116a3..5561fd4091e8 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -442,7 +442,7 @@ static char* stateName[] = {
442 "Setup for play", 442 "Setup for play",
443 "Playing", 443 "Playing",
444 "Monitor mode on", 444 "Monitor mode on",
445 "Calibrating" 445 "Calibrating",
446 "Invalid" 446 "Invalid"
447}; 447};
448 448
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 6db7de6b9719..3c0205b91e10 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2147,11 +2147,13 @@ static int __devinit check_dxs_list(struct pci_dev *pci)
2147 { .subvendor = 0x1019, .subdevice = 0x0996, .action = VIA_DXS_48K }, 2147 { .subvendor = 0x1019, .subdevice = 0x0996, .action = VIA_DXS_48K },
2148 { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */ 2148 { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */
2149 { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */ 2149 { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */
2150 { .subvendor = 0x1019, .subdevice = 0xa101, .action = VIA_DXS_SRC },
2150 { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */ 2151 { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */
2151 { .subvendor = 0x1025, .subdevice = 0x0046, .action = VIA_DXS_SRC }, /* Acer Aspire 1524 WLMi */ 2152 { .subvendor = 0x1025, .subdevice = 0x0046, .action = VIA_DXS_SRC }, /* Acer Aspire 1524 WLMi */
2152 { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/ 2153 { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/
2153 { .subvendor = 0x1043, .subdevice = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */ 2154 { .subvendor = 0x1043, .subdevice = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */
2154 { .subvendor = 0x1043, .subdevice = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/ 2155 { .subvendor = 0x1043, .subdevice = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/
2156 { .subvendor = 0x1043, .subdevice = 0x810d, .action = VIA_DXS_SRC }, /* ASUS */
2155 { .subvendor = 0x1043, .subdevice = 0x812a, .action = VIA_DXS_SRC }, /* ASUS A8V Deluxe */ 2157 { .subvendor = 0x1043, .subdevice = 0x812a, .action = VIA_DXS_SRC }, /* ASUS A8V Deluxe */
2156 { .subvendor = 0x1071, .subdevice = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */ 2158 { .subvendor = 0x1071, .subdevice = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */
2157 { .subvendor = 0x1071, .subdevice = 0x8399, .action = VIA_DXS_NO_VRA }, /* Umax AB 595T (VIA K8N800A - VT8237) */ 2159 { .subvendor = 0x1071, .subdevice = 0x8399, .action = VIA_DXS_NO_VRA }, /* Umax AB 595T (VIA K8N800A - VT8237) */
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index e35b48d29c45..392b2abd9f13 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -988,6 +988,7 @@ static int __init snd_pmac_detect(pmac_t *chip)
988 case 0x33: 988 case 0x33:
989 case 0x29: 989 case 0x29:
990 case 0x24: 990 case 0x24:
991 case 0x50:
991 case 0x5c: 992 case 0x5c:
992 chip->num_freqs = ARRAY_SIZE(tumbler_freqs); 993 chip->num_freqs = ARRAY_SIZE(tumbler_freqs);
993 chip->model = PMAC_SNAPPER; 994 chip->model = PMAC_SNAPPER;
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index d5ae2055b896..2ead878bcb8f 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1444,9 +1444,9 @@ static snd_pcm_hardware_t snd_usb_playback =
1444 SNDRV_PCM_INFO_BATCH | 1444 SNDRV_PCM_INFO_BATCH |
1445 SNDRV_PCM_INFO_INTERLEAVED | 1445 SNDRV_PCM_INFO_INTERLEAVED |
1446 SNDRV_PCM_INFO_BLOCK_TRANSFER, 1446 SNDRV_PCM_INFO_BLOCK_TRANSFER,
1447 .buffer_bytes_max = (256*1024), 1447 .buffer_bytes_max = 1024 * 1024,
1448 .period_bytes_min = 64, 1448 .period_bytes_min = 64,
1449 .period_bytes_max = (128*1024), 1449 .period_bytes_max = 512 * 1024,
1450 .periods_min = 2, 1450 .periods_min = 2,
1451 .periods_max = 1024, 1451 .periods_max = 1024,
1452}; 1452};
@@ -1458,9 +1458,9 @@ static snd_pcm_hardware_t snd_usb_capture =
1458 SNDRV_PCM_INFO_BATCH | 1458 SNDRV_PCM_INFO_BATCH |
1459 SNDRV_PCM_INFO_INTERLEAVED | 1459 SNDRV_PCM_INFO_INTERLEAVED |
1460 SNDRV_PCM_INFO_BLOCK_TRANSFER, 1460 SNDRV_PCM_INFO_BLOCK_TRANSFER,
1461 .buffer_bytes_max = (256*1024), 1461 .buffer_bytes_max = 1024 * 1024,
1462 .period_bytes_min = 64, 1462 .period_bytes_min = 64,
1463 .period_bytes_max = (128*1024), 1463 .period_bytes_max = 512 * 1024,
1464 .periods_min = 2, 1464 .periods_min = 2,
1465 .periods_max = 1024, 1465 .periods_max = 1024,
1466}; 1466};
diff --git a/sound/usb/usbmixer_maps.c b/sound/usb/usbmixer_maps.c
index f05500b05ec0..c1264434e50a 100644
--- a/sound/usb/usbmixer_maps.c
+++ b/sound/usb/usbmixer_maps.c
@@ -238,6 +238,16 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
238 .selector_map = audigy2nx_selectors, 238 .selector_map = audigy2nx_selectors,
239 }, 239 },
240 { 240 {
241 /* Hercules DJ Console (Windows Edition) */
242 .id = USB_ID(0x06f8, 0xb000),
243 .ignore_ctl_error = 1,
244 },
245 {
246 /* Hercules DJ Console (Macintosh Edition) */
247 .id = USB_ID(0x06f8, 0xd002),
248 .ignore_ctl_error = 1,
249 },
250 {
241 .id = USB_ID(0x08bb, 0x2702), 251 .id = USB_ID(0x08bb, 0x2702),
242 .map = linex_map, 252 .map = linex_map,
243 .ignore_ctl_error = 1, 253 .ignore_ctl_error = 1,
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index f74e652a1e51..948759da6563 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -117,6 +117,10 @@ YAMAHA_DEVICE(0x103a, NULL),
117YAMAHA_DEVICE(0x103b, NULL), 117YAMAHA_DEVICE(0x103b, NULL),
118YAMAHA_DEVICE(0x103c, NULL), 118YAMAHA_DEVICE(0x103c, NULL),
119YAMAHA_DEVICE(0x103d, NULL), 119YAMAHA_DEVICE(0x103d, NULL),
120YAMAHA_DEVICE(0x103e, NULL),
121YAMAHA_DEVICE(0x103f, NULL),
122YAMAHA_DEVICE(0x1040, NULL),
123YAMAHA_DEVICE(0x1041, NULL),
120YAMAHA_DEVICE(0x2000, "DGP-7"), 124YAMAHA_DEVICE(0x2000, "DGP-7"),
121YAMAHA_DEVICE(0x2001, "DGP-5"), 125YAMAHA_DEVICE(0x2001, "DGP-5"),
122YAMAHA_DEVICE(0x2002, NULL), 126YAMAHA_DEVICE(0x2002, NULL),
@@ -1010,6 +1014,40 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1010 } 1014 }
1011 } 1015 }
1012}, 1016},
1017{
1018 USB_DEVICE_VENDOR_SPEC(0x0582, 0x007a),
1019 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
1020 .vendor_name = "Roland",
1021 /* RD-700SX, RD-300SX */
1022 .ifnum = 0,
1023 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1024 .data = & (const snd_usb_midi_endpoint_info_t) {
1025 .out_cables = 0x0003,
1026 .in_cables = 0x0003
1027 }
1028 }
1029},
1030
1031/* Guillemot devices */
1032{
1033 /*
1034 * This is for the "Windows Edition" where the external MIDI ports are
1035 * the only MIDI ports; the control data is reported through HID
1036 * interfaces. The "Macintosh Edition" has ID 0xd002 and uses standard
1037 * compliant USB MIDI ports for external MIDI and controls.
1038 */
1039 USB_DEVICE_VENDOR_SPEC(0x06f8, 0xb000),
1040 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
1041 .vendor_name = "Hercules",
1042 .product_name = "DJ Console (WE)",
1043 .ifnum = 4,
1044 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1045 .data = & (const snd_usb_midi_endpoint_info_t) {
1046 .out_cables = 0x0001,
1047 .in_cables = 0x0001
1048 }
1049 }
1050},
1013 1051
1014/* Midiman/M-Audio devices */ 1052/* Midiman/M-Audio devices */
1015{ 1053{
@@ -1339,10 +1377,20 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1339 } 1377 }
1340}, 1378},
1341 1379
1380/* TerraTec devices */
1381{
1382 USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012),
1383 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
1384 .vendor_name = "TerraTec",
1385 .product_name = "PHASE 26",
1386 .ifnum = 3,
1387 .type = QUIRK_MIDI_STANDARD_INTERFACE
1388 }
1389},
1342{ 1390{
1343 USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0013), 1391 USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0013),
1344 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { 1392 .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
1345 .vendor_name = "Terratec", 1393 .vendor_name = "TerraTec",
1346 .product_name = "PHASE 26", 1394 .product_name = "PHASE 26",
1347 .ifnum = 3, 1395 .ifnum = 3,
1348 .type = QUIRK_MIDI_STANDARD_INTERFACE 1396 .type = QUIRK_MIDI_STANDARD_INTERFACE