From 6b4d24963ef83bd92af7a22acf53e0a88fad3148 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Thu, 25 Aug 2005 16:25:34 -0700 Subject: [PATCH] --- yaml --- r: 9927 b: refs/heads/master c: 20509f1bc553ed7fafa88fa8d01c6212d1876d9f h: refs/heads/master i: 9925: 5b92e3d4b4a6e16d84a31eb671fbb7c024efb55a 9923: 3b5f5b9b543d1b712881b202305d6fdac1b4d795 9919: f02f2377ebbbcb2cb14f0784ffe670682ccfb928 v: v3 --- [refs] | 2 +- trunk/Documentation/Changes | 10 - trunk/Documentation/DocBook/libata.tmpl | 1072 ---- trunk/Documentation/SubmittingPatches | 86 +- trunk/Documentation/connector/connector.txt | 44 - trunk/Documentation/dell_rbu.txt | 38 +- trunk/Documentation/keys-request-key.txt | 161 - trunk/Documentation/keys.txt | 92 +- trunk/Documentation/networking/ip-sysctl.txt | 10 +- trunk/Documentation/sparse.txt | 4 +- trunk/MAINTAINERS | 40 +- trunk/Makefile | 6 +- trunk/arch/alpha/kernel/entry.S | 1 - trunk/arch/alpha/kernel/traps.c | 15 +- trunk/arch/arm/Makefile | 6 +- trunk/arch/arm/common/gic.c | 2 - trunk/arch/arm/common/locomo.c | 1 + trunk/arch/arm/common/scoop.c | 20 +- trunk/arch/arm/configs/collie_defconfig | 888 --- trunk/arch/arm/configs/corgi_defconfig | 1523 ----- trunk/arch/arm/configs/ixp4xx_defconfig | 577 +- trunk/arch/arm/configs/poodle_defconfig | 1015 ---- trunk/arch/arm/configs/spitz_defconfig | 1401 ----- trunk/arch/arm/kernel/armksyms.c | 4 +- trunk/arch/arm/kernel/entry-armv.S | 2 +- trunk/arch/arm/kernel/entry-common.S | 7 +- trunk/arch/arm/kernel/io.c | 6 +- trunk/arch/arm/kernel/sys_arm.c | 2 +- trunk/arch/arm/kernel/traps.c | 2 +- trunk/arch/arm/kernel/vmlinux.lds.S | 15 +- trunk/arch/arm/mach-clps711x/fortunet.c | 2 - trunk/arch/arm/mach-imx/generic.c | 23 +- trunk/arch/arm/mach-imx/leds-mx1ads.c | 1 + trunk/arch/arm/mach-imx/mx1ads.c | 2 +- trunk/arch/arm/mach-iop3xx/common.c | 1 + trunk/arch/arm/mach-iop3xx/iop321-time.c | 1 + trunk/arch/arm/mach-iop3xx/iop331-time.c | 1 + trunk/arch/arm/mach-iop3xx/iq31244-mm.c | 1 + trunk/arch/arm/mach-iop3xx/iq80321-mm.c | 1 + trunk/arch/arm/mach-iop3xx/iq80331-mm.c | 1 + trunk/arch/arm/mach-iop3xx/iq80332-mm.c | 1 + trunk/arch/arm/mach-ixp2000/core.c | 3 +- trunk/arch/arm/mach-ixp2000/pci.c | 1 + trunk/arch/arm/mach-ixp4xx/common.c | 5 +- trunk/arch/arm/mach-ixp4xx/ixdp425-setup.c | 2 +- trunk/arch/arm/mach-l7200/core.c | 21 +- trunk/arch/arm/mach-pxa/corgi.c | 1 - trunk/arch/arm/mach-pxa/corgi_lcd.c | 21 +- trunk/arch/arm/mach-pxa/generic.c | 6 - trunk/arch/arm/mach-pxa/spitz.c | 4 +- trunk/arch/arm/mach-s3c2410/Kconfig | 1 - trunk/arch/arm/mach-s3c2410/mach-anubis.c | 2 +- trunk/arch/arm/mach-s3c2410/mach-bast.c | 4 +- trunk/arch/arm/mach-s3c2410/mach-vr1000.c | 2 +- trunk/arch/arm/mach-s3c2410/s3c2410.c | 3 + trunk/arch/arm/mach-s3c2410/s3c2440.c | 4 +- trunk/arch/arm/mach-s3c2410/time.c | 1 - trunk/arch/arm/mach-s3c2410/usb-simtec.c | 1 + trunk/arch/arm/mach-sa1100/collie.c | 6 +- trunk/arch/arm/mach-versatile/core.c | 44 +- trunk/arch/arm/mach-versatile/pci.c | 1 + trunk/arch/arm/mm/Kconfig | 8 +- trunk/arch/arm/mm/abort-ev6.S | 5 - trunk/arch/arm/mm/alignment.c | 55 +- trunk/arch/arm/mm/cache-v6.S | 9 +- trunk/arch/arm/mm/flush.c | 36 +- trunk/arch/arm/nwfpe/fpa11.c | 5 + trunk/arch/arm/nwfpe/fpa11.h | 20 - trunk/arch/arm/nwfpe/fpa11_cprt.c | 3 +- trunk/arch/arm/nwfpe/fpopcode.h | 6 - trunk/arch/arm/nwfpe/softfloat.h | 3 - trunk/arch/arm/plat-omap/common.c | 1 + trunk/arch/arm/plat-omap/cpu-omap.c | 1 + trunk/arch/arm/plat-omap/usb.c | 1 + trunk/arch/arm/tools/mach-types | 90 +- trunk/arch/cris/arch-v32/drivers/pci/dma.c | 2 +- trunk/arch/cris/arch-v32/kernel/smp.c | 2 - trunk/arch/i386/kernel/acpi/boot.c | 3 +- trunk/arch/i386/kernel/apic.c | 1 + trunk/arch/i386/kernel/cpu/amd.c | 16 - trunk/arch/i386/kernel/cpu/mcheck/k7.c | 1 + trunk/arch/i386/kernel/cpu/mcheck/non-fatal.c | 1 + trunk/arch/i386/kernel/cpu/mcheck/p4.c | 1 + trunk/arch/i386/kernel/cpu/mcheck/p5.c | 1 + trunk/arch/i386/kernel/cpu/mcheck/p6.c | 1 + trunk/arch/i386/kernel/cpu/mcheck/winchip.c | 1 + trunk/arch/i386/kernel/crash.c | 2 + trunk/arch/i386/kernel/i8259.c | 3 + trunk/arch/i386/kernel/io_apic.c | 1 + trunk/arch/i386/kernel/mpparse.c | 1 + trunk/arch/i386/kernel/nmi.c | 1 + trunk/arch/i386/kernel/pci-dma.c | 2 +- trunk/arch/i386/kernel/process.c | 2 + trunk/arch/i386/kernel/signal.c | 6 +- trunk/arch/i386/kernel/smp.c | 1 + trunk/arch/i386/kernel/smpboot.c | 1 + trunk/arch/i386/kernel/timers/timer_pit.c | 1 + trunk/arch/i386/kernel/traps.c | 1 + trunk/arch/i386/mach-default/setup.c | 1 + trunk/arch/i386/mach-visws/setup.c | 1 + trunk/arch/i386/mach-visws/visws_apic.c | 1 + trunk/arch/i386/mach-voyager/setup.c | 1 + trunk/arch/i386/mach-voyager/voyager_basic.c | 1 + trunk/arch/i386/mach-voyager/voyager_smp.c | 2 + trunk/arch/i386/mach-voyager/voyager_thread.c | 2 + trunk/arch/i386/oprofile/nmi_timer_int.c | 2 +- trunk/arch/i386/pci/acpi.c | 1 + trunk/arch/i386/pci/irq.c | 3 +- trunk/arch/i386/power/cpu.c | 17 + trunk/arch/ia64/kernel/mca.c | 5 - trunk/arch/m32r/Makefile | 2 +- trunk/arch/m32r/kernel/entry.S | 9 - trunk/arch/m32r/kernel/smp.c | 12 +- trunk/arch/m32r/kernel/traps.c | 33 +- trunk/arch/m32r/lib/usercopy.c | 16 +- trunk/arch/mips/pci/fixup-tb0226.c | 33 +- trunk/arch/ppc/boot/ld.script | 2 +- trunk/arch/ppc/kernel/cputable.c | 5 +- trunk/arch/ppc/kernel/dma-mapping.c | 4 +- trunk/arch/ppc/kernel/perfmon.c | 3 +- trunk/arch/ppc/platforms/4xx/bamboo.c | 1 + trunk/arch/ppc/platforms/4xx/ebony.c | 1 + trunk/arch/ppc/platforms/4xx/luan.c | 1 + trunk/arch/ppc/platforms/4xx/ocotea.c | 1 + trunk/arch/ppc/platforms/83xx/mpc834x_sys.c | 1 + trunk/arch/ppc/platforms/85xx/mpc8540_ads.c | 1 + trunk/arch/ppc/platforms/85xx/mpc8560_ads.c | 1 + .../ppc/platforms/85xx/mpc85xx_ads_common.c | 1 + .../ppc/platforms/85xx/mpc85xx_cds_common.c | 1 + trunk/arch/ppc/platforms/85xx/sbc8560.c | 1 + trunk/arch/ppc/platforms/85xx/sbc85xx.c | 1 + trunk/arch/ppc/platforms/85xx/stx_gp3.c | 1 + trunk/arch/ppc/platforms/chestnut.c | 1 + trunk/arch/ppc/platforms/chrp_setup.c | 1 + trunk/arch/ppc/platforms/gemini_setup.c | 1 + trunk/arch/ppc/platforms/mvme5100.c | 1 + trunk/arch/ppc/platforms/pmac_cpufreq.c | 7 - trunk/arch/ppc/platforms/pmac_feature.c | 4 - trunk/arch/ppc/platforms/pmac_setup.c | 1 + trunk/arch/ppc/platforms/pmac_time.c | 2 +- trunk/arch/ppc/platforms/powerpmc250.c | 1 + trunk/arch/ppc/platforms/pplus.c | 1 + trunk/arch/ppc/platforms/prpmc750.c | 1 + trunk/arch/ppc/platforms/prpmc800.c | 1 + trunk/arch/ppc/platforms/radstone_ppc7d.c | 2 + trunk/arch/ppc/platforms/sandpoint.c | 1 + trunk/arch/ppc/syslib/mv64x60.c | 4 +- trunk/arch/ppc/syslib/open_pic.c | 1 + trunk/arch/ppc/syslib/open_pic2.c | 1 + trunk/arch/ppc/syslib/ppc4xx_setup.c | 1 + trunk/arch/ppc64/kernel/bpa_iommu.c | 8 +- trunk/arch/ppc64/kernel/dma.c | 2 +- trunk/arch/ppc64/kernel/iommu.c | 2 +- trunk/arch/ppc64/kernel/kprobes.c | 8 +- trunk/arch/ppc64/kernel/machine_kexec.c | 1 - trunk/arch/ppc64/kernel/module.c | 13 - trunk/arch/ppc64/kernel/pSeries_pci.c | 4 +- trunk/arch/ppc64/kernel/pci_direct_iommu.c | 2 +- trunk/arch/ppc64/kernel/pci_iommu.c | 2 +- trunk/arch/ppc64/kernel/pmac_setup.c | 3 +- trunk/arch/ppc64/kernel/vio.c | 2 +- trunk/arch/ppc64/mm/hash_native.c | 6 +- trunk/arch/ppc64/mm/hugetlbpage.c | 7 +- trunk/arch/ppc64/mm/tlb.c | 4 +- trunk/arch/s390/kernel/compat_signal.c | 6 +- trunk/arch/s390/kernel/signal.c | 4 +- trunk/arch/sh/kernel/smp.c | 3 - trunk/arch/sparc/Kconfig | 56 + trunk/arch/sparc/kernel/setup.c | 2 + trunk/arch/sparc/kernel/time.c | 2 +- trunk/arch/sparc/mm/srmmu.c | 2 +- trunk/arch/sparc64/Kconfig.debug | 8 - trunk/arch/sparc64/kernel/cpu.c | 4 - trunk/arch/sparc64/kernel/devices.c | 22 - trunk/arch/sparc64/kernel/dtlb_backend.S | 13 +- trunk/arch/sparc64/kernel/dtlb_base.S | 18 +- trunk/arch/sparc64/kernel/dtlb_prot.S | 12 +- trunk/arch/sparc64/kernel/entry.S | 262 +- trunk/arch/sparc64/kernel/etrap.S | 51 +- trunk/arch/sparc64/kernel/head.S | 748 ++- trunk/arch/sparc64/kernel/irq.c | 1 - trunk/arch/sparc64/kernel/itlb_base.S | 26 +- trunk/arch/sparc64/kernel/ktlb.S | 194 - trunk/arch/sparc64/kernel/pci_iommu.c | 363 +- trunk/arch/sparc64/kernel/pci_psycho.c | 44 +- trunk/arch/sparc64/kernel/pci_sabre.c | 39 +- trunk/arch/sparc64/kernel/pci_schizo.c | 59 +- trunk/arch/sparc64/kernel/power.c | 64 +- trunk/arch/sparc64/kernel/ptrace.c | 14 +- trunk/arch/sparc64/kernel/rtrap.S | 30 +- trunk/arch/sparc64/kernel/setup.c | 58 +- trunk/arch/sparc64/kernel/smp.c | 28 +- trunk/arch/sparc64/kernel/sys32.S | 170 +- trunk/arch/sparc64/kernel/trampoline.S | 31 +- trunk/arch/sparc64/kernel/traps.c | 100 +- trunk/arch/sparc64/kernel/una_asm.S | 65 +- trunk/arch/sparc64/kernel/unaligned.c | 53 +- trunk/arch/sparc64/kernel/us3_cpufreq.c | 5 +- trunk/arch/sparc64/kernel/vmlinux.lds.S | 3 +- trunk/arch/sparc64/kernel/winfixup.S | 33 +- trunk/arch/sparc64/lib/VISsave.S | 8 +- trunk/arch/sparc64/lib/strncpy_from_user.S | 16 +- trunk/arch/sparc64/lib/user_fixup.c | 63 +- trunk/arch/sparc64/mm/Makefile | 2 +- trunk/arch/sparc64/mm/extable.c | 80 + trunk/arch/sparc64/mm/fault.c | 69 +- trunk/arch/sparc64/mm/init.c | 868 +-- trunk/arch/sparc64/mm/ultra.S | 112 +- trunk/arch/sparc64/prom/Makefile | 4 +- trunk/arch/sparc64/prom/console.c | 2 +- trunk/arch/sparc64/prom/devops.c | 2 +- trunk/arch/sparc64/prom/init.c | 5 +- trunk/arch/sparc64/prom/map.S | 72 + trunk/arch/sparc64/prom/memory.c | 152 + trunk/arch/sparc64/prom/misc.c | 46 +- trunk/arch/sparc64/prom/p1275.c | 2 +- trunk/arch/sparc64/prom/printf.c | 2 +- trunk/arch/sparc64/prom/tree.c | 50 +- trunk/arch/um/Makefile | 70 +- trunk/arch/um/Makefile-i386 | 22 + trunk/arch/um/Makefile-skas | 2 + trunk/arch/um/Makefile-x86_64 | 21 + trunk/arch/um/drivers/Makefile | 2 +- trunk/arch/um/drivers/cow.h | 39 +- trunk/arch/um/drivers/cow_user.c | 1 + trunk/arch/um/drivers/mconsole_user.c | 2 +- trunk/arch/um/drivers/port_kern.c | 1 + trunk/arch/um/drivers/ubd_kern.c | 556 +- trunk/arch/um/drivers/ubd_user.c | 75 - trunk/arch/um/include/aio.h | 18 +- trunk/arch/um/include/common-offsets.h | 4 +- trunk/arch/um/include/os.h | 9 - trunk/arch/um/include/registers.h | 12 +- trunk/arch/um/include/skas_ptregs.h | 6 - trunk/arch/um/include/sysdep-i386/sc.h | 44 - .../arch/um/include/sysdep-i386/sigcontext.h | 10 +- trunk/arch/um/include/sysdep-i386/thread.h | 11 - trunk/arch/um/include/sysdep-x86_64/ptrace.h | 4 + trunk/arch/um/include/sysdep-x86_64/sc.h | 45 - .../um/include/sysdep-x86_64/sigcontext.h | 5 +- trunk/arch/um/include/sysdep-x86_64/thread.h | 10 - trunk/arch/um/include/task.h | 9 - trunk/arch/um/kernel/irq.c | 1 + trunk/arch/um/kernel/skas/Makefile | 2 + trunk/arch/um/kernel/skas/util/Makefile | 5 + .../arch/um/kernel/skas/util/mk_ptregs-i386.c | 49 + .../um/kernel/skas/util/mk_ptregs-x86_64.c | 66 + trunk/arch/um/kernel/sysrq.c | 8 +- trunk/arch/um/kernel/trap_kern.c | 5 +- trunk/arch/um/kernel/um_arch.c | 2 - trunk/arch/um/os-Linux/aio.c | 205 +- trunk/arch/um/os-Linux/elf_aux.c | 2 +- trunk/arch/um/os-Linux/start_up.c | 11 - trunk/arch/um/os-Linux/sys-i386/registers.c | 19 +- trunk/arch/um/os-Linux/sys-x86_64/registers.c | 19 +- trunk/arch/um/os-Linux/util/Makefile | 4 + .../arch/um/os-Linux/util/mk_user_constants.c | 23 + trunk/arch/um/scripts/Makefile.rules | 4 +- trunk/arch/um/sys-i386/Makefile | 2 + trunk/arch/um/sys-i386/kernel-offsets.c | 4 +- trunk/arch/um/sys-i386/sysrq.c | 13 +- trunk/arch/um/sys-i386/user-offsets.c | 71 +- trunk/arch/um/sys-i386/util/Makefile | 5 + trunk/arch/um/sys-i386/util/mk_sc.c | 51 + trunk/arch/um/sys-i386/util/mk_thread.c | 22 + trunk/arch/um/sys-x86_64/Makefile | 2 + trunk/arch/um/sys-x86_64/kernel-offsets.c | 2 +- trunk/arch/um/sys-x86_64/stub_segv.c | 37 +- trunk/arch/um/sys-x86_64/user-offsets.c | 117 +- trunk/arch/um/sys-x86_64/util/Makefile | 8 + trunk/arch/um/sys-x86_64/util/mk_sc.c | 47 + trunk/arch/um/sys-x86_64/util/mk_thread.c | 20 + trunk/arch/um/util/Makefile | 5 + trunk/arch/um/util/mk_constants.c | 32 + trunk/arch/um/util/mk_task.c | 30 + trunk/arch/x86_64/ia32/ia32_signal.c | 6 +- trunk/arch/x86_64/kernel/head.S | 40 +- trunk/arch/x86_64/kernel/kprobes.c | 8 +- trunk/arch/x86_64/kernel/mce.c | 10 +- trunk/arch/x86_64/kernel/setup.c | 27 +- trunk/arch/x86_64/kernel/setup64.c | 4 - trunk/arch/x86_64/kernel/smpboot.c | 6 +- trunk/arch/x86_64/kernel/suspend.c | 127 - trunk/arch/x86_64/kernel/suspend_asm.S | 17 +- trunk/arch/x86_64/kernel/time.c | 3 + trunk/arch/x86_64/mm/numa.c | 10 +- trunk/arch/x86_64/mm/pageattr.c | 2 + trunk/drivers/acpi/event.c | 5 +- trunk/drivers/atm/ambassador.c | 2 +- trunk/drivers/atm/firestream.c | 5 +- trunk/drivers/atm/fore200e.c | 10 +- trunk/drivers/base/dmapool.c | 5 +- trunk/drivers/block/pktcdvd.c | 4 +- trunk/drivers/block/scsi_ioctl.c | 8 +- trunk/drivers/bluetooth/bpa10x.c | 2 +- trunk/drivers/bluetooth/hci_usb.c | 2 +- trunk/drivers/char/drm/drm_drv.c | 2 +- trunk/drivers/char/drm/drm_proc.c | 2 +- trunk/drivers/char/drm/drm_stub.c | 2 +- trunk/drivers/char/ipmi/ipmi_msghandler.c | 6 +- trunk/drivers/char/ipmi/ipmi_poweroff.c | 2 +- trunk/drivers/char/mbcs.c | 3 - trunk/drivers/char/n_r3964.c | 92 +- trunk/drivers/char/s3c2410-rtc.c | 1 - trunk/drivers/char/watchdog/mv64x60_wdt.c | 14 +- trunk/drivers/char/watchdog/pcwd_pci.c | 239 +- trunk/drivers/connector/cn_queue.c | 32 +- trunk/drivers/connector/connector.c | 76 +- trunk/drivers/firmware/dell_rbu.c | 174 +- trunk/drivers/ide/ide-io.c | 8 - trunk/drivers/ide/legacy/ide-cs.c | 2 +- trunk/drivers/ieee1394/amdtp.c | 1 + trunk/drivers/ieee1394/csr1212.h | 1 + trunk/drivers/ieee1394/dv1394.c | 1 + trunk/drivers/ieee1394/eth1394.c | 12 +- trunk/drivers/ieee1394/eth1394.h | 6 - trunk/drivers/ieee1394/hosts.c | 3 +- trunk/drivers/ieee1394/hosts.h | 8 +- trunk/drivers/ieee1394/ieee1394_core.c | 32 +- trunk/drivers/ieee1394/nodemgr.c | 23 +- trunk/drivers/ieee1394/ohci1394.c | 4 +- trunk/drivers/ieee1394/raw1394.c | 3 +- trunk/drivers/ieee1394/sbp2.c | 107 +- trunk/drivers/ieee1394/video1394.c | 1 + trunk/drivers/infiniband/core/mad.c | 2 +- trunk/drivers/infiniband/core/sa_query.c | 6 +- trunk/drivers/infiniband/core/uverbs.h | 1 - trunk/drivers/infiniband/core/uverbs_cmd.c | 120 +- trunk/drivers/infiniband/core/uverbs_main.c | 27 +- trunk/drivers/infiniband/hw/mthca/mthca_cmd.c | 4 +- trunk/drivers/infiniband/hw/mthca/mthca_eq.c | 2 +- .../drivers/infiniband/hw/mthca/mthca_main.c | 45 +- .../infiniband/hw/mthca/mthca_memfree.c | 19 +- .../infiniband/hw/mthca/mthca_provider.c | 2 +- .../drivers/infiniband/ulp/ipoib/ipoib_main.c | 4 +- trunk/drivers/input/input.c | 1 - trunk/drivers/input/keyboard/Kconfig | 2 +- trunk/drivers/input/keyboard/spitzkbd.c | 2 +- trunk/drivers/input/misc/uinput.c | 4 +- trunk/drivers/isdn/divert/divert_procfs.c | 6 +- trunk/drivers/isdn/hardware/eicon/diva_didd.c | 6 +- trunk/drivers/isdn/hardware/eicon/divasproc.c | 2 +- trunk/drivers/isdn/hisax/st5481_b.c | 2 + trunk/drivers/isdn/hisax/st5481_usb.c | 2 + trunk/drivers/isdn/hysdn/hysdn_procconf.c | 2 +- trunk/drivers/macintosh/smu.c | 4 +- trunk/drivers/md/dm-crypt.c | 2 +- trunk/drivers/md/dm-io.c | 2 +- trunk/drivers/md/dm-ioctl.c | 9 - trunk/drivers/md/dm-mpath.c | 16 +- trunk/drivers/md/dm-raid1.c | 2 +- trunk/drivers/md/multipath.c | 2 +- trunk/drivers/md/raid1.c | 4 +- trunk/drivers/md/raid10.c | 4 +- trunk/drivers/media/dvb/frontends/tda10021.c | 4 +- trunk/drivers/media/radio/radio-cadet.c | 2 +- trunk/drivers/media/video/bttv-cards.c | 6 +- trunk/drivers/media/video/cpia.c | 2 +- trunk/drivers/media/video/rds.h | 2 +- trunk/drivers/media/video/saa6588.c | 4 +- trunk/drivers/media/video/vpx3220.c | 32 +- trunk/drivers/mfd/ucb1x00-core.c | 24 +- trunk/drivers/mfd/ucb1x00-ts.c | 4 +- trunk/drivers/mfd/ucb1x00.h | 2 + trunk/drivers/mtd/maps/bast-flash.c | 1 + trunk/drivers/mtd/maps/ixp2000.c | 1 + trunk/drivers/mtd/maps/ixp4xx.c | 3 +- trunk/drivers/mtd/maps/omap_nor.c | 1 + trunk/drivers/mtd/maps/sa1100-flash.c | 1 + trunk/drivers/mtd/nand/s3c2410.c | 1 + trunk/drivers/net/8390.c | 2 +- trunk/drivers/net/Kconfig | 16 +- trunk/drivers/net/Makefile | 1 - trunk/drivers/net/arm/am79c961a.c | 22 +- trunk/drivers/net/bmac.c | 2 +- trunk/drivers/net/bonding/bond_main.c | 287 +- trunk/drivers/net/bonding/bonding.h | 4 +- trunk/drivers/net/cassini.c | 5237 ----------------- trunk/drivers/net/cassini.h | 4425 -------------- trunk/drivers/net/cs89x0.c | 1 - trunk/drivers/net/e100.c | 224 +- trunk/drivers/net/ibm_emac/ibm_emac_core.c | 31 - trunk/drivers/net/ibmveth.c | 6 +- trunk/drivers/net/irda/vlsi_ir.c | 4 +- trunk/drivers/net/ns83820.c | 2 +- trunk/drivers/net/pcmcia/smc91c92_cs.c | 2 +- trunk/drivers/net/pppoe.c | 4 +- trunk/drivers/net/r8169.c | 3 +- trunk/drivers/net/sk98lin/skge.c | 8 +- trunk/drivers/net/skge.c | 46 +- trunk/drivers/net/starfire.c | 46 +- trunk/drivers/net/sungem.h | 3 +- trunk/drivers/net/tg3.c | 117 +- trunk/drivers/net/tg3.h | 1 - trunk/drivers/net/tokenring/ibmtr.c | 5 + trunk/drivers/net/tulip/21142.c | 2 +- trunk/drivers/net/wan/sdlamain.c | 23 +- trunk/drivers/net/wan/syncppp.c | 2 +- trunk/drivers/net/wireless/Kconfig | 2 +- trunk/drivers/net/wireless/orinoco.c | 16 +- trunk/drivers/net/wireless/strip.c | 4 +- trunk/drivers/parisc/led.c | 5 +- trunk/drivers/pci/quirks.c | 4 +- trunk/drivers/pcmcia/Kconfig | 2 +- trunk/drivers/pcmcia/cardbus.c | 5 - trunk/drivers/pcmcia/cs.c | 3 - trunk/drivers/pcmcia/omap_cf.c | 1 + trunk/drivers/pcmcia/rsrc_nonstatic.c | 10 +- trunk/drivers/pcmcia/soc_common.c | 14 +- trunk/drivers/pcmcia/ti113x.h | 118 +- trunk/drivers/pcmcia/yenta_socket.c | 62 +- trunk/drivers/s390/cio/device.c | 2 +- trunk/drivers/s390/net/qeth.h | 2 - trunk/drivers/s390/net/qeth_main.c | 41 +- trunk/drivers/s390/scsi/zfcp_aux.c | 2 +- trunk/drivers/scsi/3w-9xxx.c | 55 +- trunk/drivers/scsi/3w-9xxx.h | 17 +- trunk/drivers/scsi/Kconfig | 27 +- trunk/drivers/scsi/Makefile | 3 - trunk/drivers/scsi/aacraid/aachba.c | 283 +- trunk/drivers/scsi/aacraid/aacraid.h | 17 +- trunk/drivers/scsi/aacraid/comminit.c | 17 +- trunk/drivers/scsi/aacraid/commsup.c | 581 +- trunk/drivers/scsi/aacraid/linit.c | 14 +- trunk/drivers/scsi/ahci.c | 61 +- trunk/drivers/scsi/aic7xxx/aic7770_osm.c | 3 - trunk/drivers/scsi/aic7xxx/aic79xx_osm.c | 8 +- trunk/drivers/scsi/aic7xxx/aic79xx_osm_pci.c | 3 - trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c | 8 +- trunk/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 3 - trunk/drivers/scsi/ata_piix.c | 1 + trunk/drivers/scsi/hosts.c | 2 +- trunk/drivers/scsi/libata-core.c | 798 +-- trunk/drivers/scsi/libata-scsi.c | 726 +-- trunk/drivers/scsi/libata.h | 17 +- trunk/drivers/scsi/lpfc/lpfc_attr.c | 8 +- trunk/drivers/scsi/lpfc/lpfc_hbadisc.c | 4 +- trunk/drivers/scsi/lpfc/lpfc_hw.h | 4 +- trunk/drivers/scsi/lpfc/lpfc_init.c | 6 +- trunk/drivers/scsi/megaraid.c | 70 +- trunk/drivers/scsi/megaraid/Kconfig.megaraid | 9 - trunk/drivers/scsi/megaraid/Makefile | 1 - trunk/drivers/scsi/megaraid/megaraid_sas.c | 2806 --------- trunk/drivers/scsi/megaraid/megaraid_sas.h | 1142 ---- trunk/drivers/scsi/pdc_adma.c | 739 --- trunk/drivers/scsi/qla2xxx/qla_rscn.c | 2 - trunk/drivers/scsi/qlogicpti.c | 39 +- trunk/drivers/scsi/sata_mv.c | 1144 +--- trunk/drivers/scsi/sata_nv.c | 16 +- trunk/drivers/scsi/sata_promise.c | 6 +- trunk/drivers/scsi/sata_qstor.c | 8 +- trunk/drivers/scsi/sata_sil24.c | 880 --- trunk/drivers/scsi/sata_sis.c | 2 +- trunk/drivers/scsi/sata_sx4.c | 13 +- trunk/drivers/scsi/sata_uli.c | 2 +- trunk/drivers/scsi/sata_via.c | 2 +- trunk/drivers/scsi/scsi_scan.c | 96 +- trunk/drivers/scsi/scsi_transport_sas.c | 9 +- trunk/drivers/scsi/sg.c | 3 +- trunk/drivers/serial/8250_pnp.c | 2 - trunk/drivers/serial/clps711x.c | 2 +- trunk/drivers/serial/imx.c | 50 +- trunk/drivers/serial/ioc4_serial.c | 12 + trunk/drivers/serial/pxa.c | 2 +- trunk/drivers/serial/s3c2410.c | 24 +- trunk/drivers/serial/serial_cs.c | 1 - trunk/drivers/serial/sh-sci.c | 2 +- trunk/drivers/serial/sunsab.c | 1 + trunk/drivers/serial/sunsu.c | 4 + trunk/drivers/serial/sunzilog.c | 5 +- trunk/drivers/usb/core/devio.c | 16 +- trunk/drivers/usb/core/hcd-pci.c | 9 + trunk/drivers/usb/core/inode.c | 2 +- trunk/drivers/usb/core/usb.h | 3 +- trunk/drivers/usb/host/isp116x-hcd.c | 3 +- trunk/drivers/usb/host/ohci-lh7a404.c | 2 + trunk/drivers/usb/host/ohci-omap.c | 1 + trunk/drivers/usb/host/ohci-s3c2410.c | 1 + trunk/drivers/usb/input/hid-core.c | 3 + trunk/drivers/usb/media/vicam.c | 4 +- trunk/drivers/usb/serial/generic.c | 2 +- trunk/drivers/video/Kconfig | 1 - trunk/drivers/video/aty/radeon_base.c | 2 +- trunk/drivers/video/aty/radeon_pm.c | 14 +- trunk/drivers/video/aty/radeonfb.h | 2 - trunk/drivers/video/aty/xlinit.c | 8 +- trunk/drivers/video/backlight/corgi_bl.c | 1 + trunk/drivers/video/console/vgacon.c | 9 +- trunk/drivers/video/cyblafb.c | 11 +- trunk/drivers/video/i810/i810-i2c.c | 16 +- trunk/drivers/video/imxfb.c | 1 + trunk/drivers/video/intelfb/intelfbdrv.c | 21 +- trunk/drivers/video/p9100.c | 4 - trunk/drivers/video/pxafb.c | 108 +- trunk/drivers/video/pxafb.h | 9 + trunk/drivers/video/s3c2410fb.c | 4 +- trunk/drivers/video/sa1100fb.c | 2 - trunk/drivers/w1/w1.c | 3 +- trunk/fs/9p/fid.c | 176 +- trunk/fs/9p/fid.h | 7 +- trunk/fs/9p/vfs_dentry.c | 2 +- trunk/fs/9p/vfs_dir.c | 11 +- trunk/fs/9p/vfs_file.c | 202 +- trunk/fs/9p/vfs_inode.c | 91 +- trunk/fs/9p/vfs_super.c | 19 +- trunk/fs/Kconfig | 3 - trunk/fs/aio.c | 124 +- trunk/fs/bfs/dir.c | 2 +- trunk/fs/bfs/inode.c | 44 +- trunk/fs/binfmt_elf.c | 2 +- trunk/fs/bio.c | 10 +- trunk/fs/buffer.c | 2 +- trunk/fs/cifs/cifsfs.c | 2 - trunk/fs/cifs/connect.c | 2 - trunk/fs/eventpoll.c | 8 +- trunk/fs/ext2/ialloc.c | 25 +- trunk/fs/ext3/ialloc.c | 29 +- trunk/fs/fuse/dir.c | 6 - trunk/fs/fuse/file.c | 4 - trunk/fs/hostfs/hostfs_kern.c | 7 + trunk/fs/mpage.c | 2 +- trunk/fs/namei.c | 6 +- trunk/fs/nfs/delegation.c | 4 - trunk/fs/nfs/dir.c | 3 +- trunk/fs/nfs/file.c | 3 +- trunk/fs/nfs/inode.c | 9 +- trunk/fs/nfs_common/nfsacl.c | 70 +- trunk/fs/ntfs/ChangeLog | 13 +- trunk/fs/ntfs/bitmap.c | 5 +- trunk/fs/ntfs/layout.h | 8 +- trunk/fs/ntfs/lcnalloc.c | 31 +- trunk/fs/ntfs/lcnalloc.h | 27 +- trunk/fs/ntfs/logfile.c | 30 +- trunk/fs/ntfs/logfile.h | 2 +- trunk/fs/ntfs/malloc.h | 2 +- trunk/fs/ntfs/mft.c | 5 +- trunk/fs/ntfs/unistr.c | 2 +- trunk/fs/posix_acl.c | 6 +- trunk/fs/proc/base.c | 12 - trunk/fs/proc/nommu.c | 1 - trunk/fs/read_write.c | 3 - trunk/fs/relayfs/buffers.c | 2 +- trunk/fs/xfs/linux-2.6/kmem.c | 10 +- trunk/fs/xfs/linux-2.6/kmem.h | 13 +- trunk/include/asm-arm/arch-h720x/system.h | 8 +- trunk/include/asm-arm/arch-imx/imx-regs.h | 48 +- trunk/include/asm-arm/arch-ixp4xx/platform.h | 2 +- trunk/include/asm-arm/arch-pxa/pxa-regs.h | 7 +- trunk/include/asm-arm/arch-pxa/pxafb.h | 1 - trunk/include/asm-arm/arch-rpc/hardware.h | 4 +- .../include/asm-arm/arch-s3c2410/anubis-map.h | 10 +- trunk/include/asm-arm/arch-s3c2410/hardware.h | 7 - trunk/include/asm-arm/arch-s3c2410/io.h | 58 +- trunk/include/asm-arm/arch-versatile/io.h | 6 +- trunk/include/asm-arm/elf.h | 2 - trunk/include/asm-arm/hardware/scoop.h | 2 - trunk/include/asm-arm/io.h | 6 +- trunk/include/asm-arm/signal.h | 1 + trunk/include/asm-generic/dma-mapping.h | 4 +- trunk/include/asm-generic/pgtable.h | 13 - trunk/include/asm-i386/dma-mapping.h | 2 +- trunk/include/asm-i386/hw_irq.h | 2 - trunk/include/asm-ia64/uaccess.h | 12 +- trunk/include/asm-m32r/io.h | 2 +- trunk/include/asm-m32r/uaccess.h | 10 +- trunk/include/asm-mips/pgtable.h | 2 - trunk/include/asm-powerpc/timex.h | 2 +- trunk/include/asm-ppc/cputable.h | 1 - trunk/include/asm-ppc/dma-mapping.h | 2 +- trunk/include/asm-ppc/io.h | 20 +- trunk/include/asm-ppc/mv64x60.h | 4 +- trunk/include/asm-ppc64/dma-mapping.h | 4 +- trunk/include/asm-ppc64/iommu.h | 2 +- trunk/include/asm-ppc64/tlbflush.h | 1 - trunk/include/asm-ppc64/uaccess.h | 6 +- trunk/include/asm-s390/sigcontext.h | 2 +- trunk/include/asm-s390/signal.h | 2 +- trunk/include/asm-sparc/btfixup.h | 24 +- trunk/include/asm-sparc/cache.h | 18 +- trunk/include/asm-sparc/cypress.h | 8 +- trunk/include/asm-sparc/delay.h | 2 +- trunk/include/asm-sparc/dma.h | 2 +- trunk/include/asm-sparc/iommu.h | 4 +- trunk/include/asm-sparc/kdebug.h | 2 +- trunk/include/asm-sparc/mbus.h | 4 +- trunk/include/asm-sparc/msi.h | 2 +- trunk/include/asm-sparc/mxcc.h | 8 +- trunk/include/asm-sparc/obio.h | 30 +- trunk/include/asm-sparc/pci.h | 6 +- trunk/include/asm-sparc/pgtable.h | 46 +- trunk/include/asm-sparc/pgtsrmmu.h | 30 +- trunk/include/asm-sparc/processor.h | 2 +- trunk/include/asm-sparc/psr.h | 6 +- trunk/include/asm-sparc/sbi.h | 10 +- trunk/include/asm-sparc/sbus.h | 6 +- trunk/include/asm-sparc/smp.h | 26 +- trunk/include/asm-sparc/smpprim.h | 8 +- trunk/include/asm-sparc/spinlock.h | 10 +- trunk/include/asm-sparc/system.h | 2 +- trunk/include/asm-sparc/traps.h | 2 +- trunk/include/asm-sparc64/cacheflush.h | 5 - trunk/include/asm-sparc64/cpudata.h | 10 - trunk/include/asm-sparc64/head.h | 9 +- trunk/include/asm-sparc64/openprom.h | 4 +- trunk/include/asm-sparc64/oplib.h | 66 +- trunk/include/asm-sparc64/page.h | 17 + trunk/include/asm-sparc64/pbm.h | 30 +- trunk/include/asm-sparc64/pgtable.h | 14 +- trunk/include/asm-sparc64/uaccess.h | 24 +- trunk/include/asm-um/processor-generic.h | 23 +- trunk/include/asm-um/processor-i386.h | 15 +- trunk/include/asm-um/processor-x86_64.h | 14 +- trunk/include/asm-um/uaccess.h | 2 +- trunk/include/asm-x86_64/msr.h | 1 - trunk/include/asm-x86_64/pgtable.h | 2 +- trunk/include/asm-x86_64/smp.h | 1 - trunk/include/linux/acct.h | 4 +- trunk/include/linux/aio.h | 41 +- trunk/include/linux/ata.h | 24 +- trunk/include/linux/atmdev.h | 12 +- trunk/include/linux/bfs_fs.h | 42 +- trunk/include/linux/bio.h | 6 +- trunk/include/linux/buffer_head.h | 2 +- trunk/include/linux/connector.h | 23 +- trunk/include/linux/cpumask.h | 10 - trunk/include/linux/cpuset.h | 5 +- trunk/include/linux/dmapool.h | 2 +- trunk/include/linux/gfp.h | 14 +- trunk/include/linux/if_ether.h | 2 - trunk/include/linux/inetdevice.h | 12 +- trunk/include/linux/ipv6.h | 5 +- trunk/include/linux/jbd.h | 2 +- trunk/include/linux/key-ui.h | 87 +- trunk/include/linux/key.h | 78 +- trunk/include/linux/kfifo.h | 4 +- trunk/include/linux/libata.h | 80 +- trunk/include/linux/list.h | 39 +- trunk/include/linux/mempool.h | 9 +- trunk/include/linux/mod_devicetable.h | 7 +- trunk/include/linux/netdevice.h | 89 +- trunk/include/linux/netfilter/nfnetlink.h | 12 +- .../linux/netfilter/nfnetlink_conntrack.h | 15 +- .../linux/netfilter_ipv4/ip_conntrack.h | 8 +- .../netfilter_ipv4/ip_conntrack_protocol.h | 3 - .../linux/netfilter_ipv4/ip_conntrack_tuple.h | 2 - trunk/include/linux/netfilter_ipv4/ip_nat.h | 4 + .../linux/netfilter_ipv4/ip_nat_core.h | 12 +- trunk/include/linux/netlink.h | 2 +- trunk/include/linux/netpoll.h | 2 +- trunk/include/linux/pagemap.h | 2 +- trunk/include/linux/pci_ids.h | 19 +- trunk/include/linux/posix_acl.h | 6 +- trunk/include/linux/radix-tree.h | 2 +- trunk/include/linux/rcupdate.h | 1 - trunk/include/linux/sched.h | 13 - trunk/include/linux/security.h | 6 +- trunk/include/linux/skbuff.h | 40 +- trunk/include/linux/slab.h | 19 +- trunk/include/linux/string.h | 2 +- trunk/include/linux/suspend.h | 2 - trunk/include/linux/swap.h | 2 +- trunk/include/linux/sysctl.h | 26 +- trunk/include/linux/tc_ematch/tc_em_meta.h | 2 +- trunk/include/linux/textsearch.h | 3 +- trunk/include/linux/types.h | 4 - trunk/include/linux/vmalloc.h | 4 +- trunk/include/net/bluetooth/bluetooth.h | 2 +- trunk/include/net/bluetooth/rfcomm.h | 2 +- trunk/include/net/dn_nsp.h | 8 +- trunk/include/net/dn_route.h | 2 +- trunk/include/net/inet6_hashtables.h | 21 +- trunk/include/net/inet_connection_sock.h | 2 +- trunk/include/net/inet_hashtables.h | 66 +- trunk/include/net/inet_timewait_sock.h | 5 +- trunk/include/net/ip_vs.h | 2 +- trunk/include/net/llc.h | 30 - trunk/include/net/llc_conn.h | 15 +- trunk/include/net/llc_sap.h | 8 +- trunk/include/net/sctp/sctp.h | 2 +- trunk/include/net/sctp/sm.h | 10 +- trunk/include/net/sctp/structs.h | 24 +- trunk/include/net/sctp/ulpevent.h | 16 +- trunk/include/net/sctp/ulpqueue.h | 11 +- trunk/include/net/sctp/user.h | 33 +- trunk/include/net/sock.h | 21 +- trunk/include/net/tcp.h | 3 +- trunk/include/net/xfrm.h | 7 +- trunk/include/pcmcia/ss.h | 9 +- trunk/include/rdma/ib_mad.h | 2 +- trunk/include/rdma/ib_sa.h | 10 +- trunk/include/rdma/ib_verbs.h | 1 + trunk/include/rxrpc/call.h | 2 +- trunk/include/rxrpc/message.h | 2 +- trunk/include/scsi/scsi_device.h | 1 - trunk/include/sound/ac97_codec.h | 2 - trunk/include/sound/core.h | 8 +- trunk/include/sound/driver.h | 2 +- trunk/include/sound/emu10k1.h | 2 +- trunk/ipc/mqueue.c | 1 - trunk/kernel/audit.c | 2 +- trunk/kernel/cpuset.c | 13 +- trunk/kernel/exit.c | 2 +- trunk/kernel/kfifo.c | 4 +- trunk/kernel/params.c | 10 +- trunk/kernel/posix-cpu-timers.c | 3 - trunk/kernel/power/power.h | 5 +- trunk/kernel/power/swsusp.c | 24 +- trunk/kernel/rcupdate.c | 13 +- trunk/kernel/signal.c | 73 +- trunk/kernel/time.c | 1 - trunk/lib/radix-tree.c | 2 +- trunk/lib/ts_bm.c | 2 +- trunk/lib/ts_fsm.c | 2 +- trunk/lib/ts_kmp.c | 2 +- trunk/mm/bootmem.c | 14 +- trunk/mm/fremap.c | 3 - trunk/mm/highmem.c | 2 +- trunk/mm/madvise.c | 11 +- trunk/mm/mempolicy.c | 8 +- trunk/mm/mempool.c | 6 +- trunk/mm/mremap.c | 6 +- trunk/mm/nommu.c | 3 +- trunk/mm/oom_kill.c | 2 +- trunk/mm/page_alloc.c | 12 +- trunk/mm/page_io.c | 2 +- trunk/mm/shmem.c | 3 +- trunk/mm/slab.c | 58 +- trunk/mm/swap_state.c | 2 +- trunk/mm/vmalloc.c | 4 +- trunk/mm/vmscan.c | 13 +- trunk/net/802/p8022.c | 2 +- trunk/net/802/psnap.c | 2 +- trunk/net/802/tr.c | 2 +- trunk/net/appletalk/ddp.c | 31 +- trunk/net/atm/addr.c | 55 +- trunk/net/atm/addr.h | 12 +- trunk/net/atm/atm_misc.c | 2 +- trunk/net/atm/br2684.c | 2 +- trunk/net/atm/clip.c | 2 +- trunk/net/atm/common.c | 6 +- trunk/net/atm/ioctl.c | 34 +- trunk/net/atm/lec.c | 43 +- trunk/net/atm/resources.c | 20 +- trunk/net/atm/signaling.c | 8 +- trunk/net/atm/svc.c | 1 - trunk/net/ax25/ax25_in.c | 2 +- trunk/net/bluetooth/l2cap.c | 2 +- trunk/net/bluetooth/rfcomm/core.c | 2 +- trunk/net/bluetooth/rfcomm/sock.c | 2 +- trunk/net/bluetooth/rfcomm/tty.c | 2 +- trunk/net/bluetooth/sco.c | 2 +- trunk/net/bridge/br_if.c | 2 +- trunk/net/bridge/netfilter/ebtables.c | 27 +- trunk/net/core/datagram.c | 81 +- trunk/net/core/dev.c | 6 +- trunk/net/core/neighbour.c | 25 +- trunk/net/core/netpoll.c | 2 +- trunk/net/core/pktgen.c | 26 +- trunk/net/core/skbuff.c | 19 +- trunk/net/core/sock.c | 30 +- trunk/net/dccp/ackvec.c | 2 +- trunk/net/dccp/ackvec.h | 4 +- trunk/net/dccp/ccid.h | 4 +- trunk/net/dccp/ccids/lib/loss_interval.h | 2 +- trunk/net/dccp/ccids/lib/packet_history.h | 4 +- trunk/net/dccp/input.c | 6 +- trunk/net/dccp/ipv4.c | 12 +- trunk/net/decnet/af_decnet.c | 4 +- trunk/net/decnet/dn_nsp_out.c | 21 +- trunk/net/econet/af_econet.c | 2 +- trunk/net/ethernet/eth.c | 31 +- trunk/net/ieee80211/ieee80211_module.c | 2 +- trunk/net/ieee80211/ieee80211_tx.c | 2 +- trunk/net/ipv4/arp.c | 21 +- trunk/net/ipv4/devinet.c | 22 +- trunk/net/ipv4/esp4.c | 17 +- trunk/net/ipv4/fib_frontend.c | 4 +- trunk/net/ipv4/fib_semantics.c | 4 +- trunk/net/ipv4/fib_trie.c | 23 +- trunk/net/ipv4/icmp.c | 2 +- trunk/net/ipv4/igmp.c | 2 +- trunk/net/ipv4/inet_connection_sock.c | 2 +- trunk/net/ipv4/inet_timewait_sock.c | 7 +- trunk/net/ipv4/ip_gre.c | 4 +- trunk/net/ipv4/ipmr.c | 6 +- trunk/net/ipv4/ipvs/ip_vs_app.c | 2 +- trunk/net/ipv4/netfilter/Kconfig | 21 +- trunk/net/ipv4/netfilter/Makefile | 7 +- trunk/net/ipv4/netfilter/arp_tables.c | 14 +- trunk/net/ipv4/netfilter/ip_conntrack_core.c | 13 +- .../ipv4/netfilter/ip_conntrack_netbios_ns.c | 2 +- .../net/ipv4/netfilter/ip_conntrack_netlink.c | 48 +- .../ipv4/netfilter/ip_conntrack_proto_gre.c | 1 - .../ipv4/netfilter/ip_conntrack_proto_icmp.c | 3 +- .../ipv4/netfilter/ip_conntrack_proto_sctp.c | 1 - .../ipv4/netfilter/ip_conntrack_proto_tcp.c | 30 +- trunk/net/ipv4/netfilter/ip_nat_core.c | 35 +- trunk/net/ipv4/netfilter/ip_nat_helper.c | 4 - trunk/net/ipv4/netfilter/ip_nat_standalone.c | 25 +- trunk/net/ipv4/netfilter/ip_queue.c | 4 +- trunk/net/ipv4/netfilter/ip_tables.c | 17 +- trunk/net/ipv4/netfilter/ipt_REDIRECT.c | 2 +- trunk/net/ipv4/netfilter/ipt_ULOG.c | 4 +- trunk/net/ipv4/route.c | 6 +- trunk/net/ipv4/tcp_bic.c | 2 +- trunk/net/ipv4/tcp_input.c | 2 + trunk/net/ipv4/tcp_ipv4.c | 11 +- trunk/net/ipv4/tcp_output.c | 15 +- trunk/net/ipv6/addrconf.c | 4 +- trunk/net/ipv6/esp6.c | 18 +- trunk/net/ipv6/ip6_output.c | 2 +- trunk/net/ipv6/mcast.c | 2 +- trunk/net/ipv6/ndisc.c | 2 +- trunk/net/ipv6/netfilter/Kconfig | 11 - trunk/net/ipv6/netfilter/Makefile | 2 +- trunk/net/ipv6/netfilter/ip6_queue.c | 4 +- trunk/net/ipv6/netfilter/ip6_tables.c | 17 +- trunk/net/ipv6/tcp_ipv6.c | 18 +- trunk/net/ipv6/udp.c | 18 +- trunk/net/irda/irlan/irlan_eth.c | 2 +- trunk/net/irda/irttp.c | 16 +- trunk/net/key/af_key.c | 18 +- trunk/net/llc/Makefile | 1 - trunk/net/llc/af_llc.c | 501 +- trunk/net/llc/llc_c_ac.c | 271 +- trunk/net/llc/llc_c_ev.c | 157 +- trunk/net/llc/llc_conn.c | 211 +- trunk/net/llc/llc_core.c | 34 +- trunk/net/llc/llc_if.c | 11 +- trunk/net/llc/llc_input.c | 19 +- trunk/net/llc/llc_output.c | 2 +- trunk/net/llc/llc_proc.c | 2 +- trunk/net/llc/llc_s_ac.c | 16 +- trunk/net/llc/llc_sap.c | 20 +- trunk/net/llc/llc_station.c | 25 +- trunk/net/llc/sysctl_net_llc.c | 131 - trunk/net/netfilter/nfnetlink.c | 6 +- trunk/net/netfilter/nfnetlink_log.c | 4 +- trunk/net/netfilter/nfnetlink_queue.c | 4 +- trunk/net/netlink/af_netlink.c | 4 +- trunk/net/netrom/nr_dev.c | 2 +- trunk/net/packet/af_packet.c | 10 +- trunk/net/rose/af_rose.c | 26 +- trunk/net/rxrpc/call.c | 2 +- trunk/net/rxrpc/connection.c | 2 +- trunk/net/sched/Kconfig | 4 +- trunk/net/sched/em_meta.c | 6 +- trunk/net/sctp/associola.c | 10 +- trunk/net/sctp/bind_addr.c | 12 +- trunk/net/sctp/chunk.c | 2 +- trunk/net/sctp/endpointola.c | 5 +- trunk/net/sctp/protocol.c | 4 +- trunk/net/sctp/sm_make_chunk.c | 14 +- trunk/net/sctp/sm_sideeffect.c | 12 +- trunk/net/sctp/socket.c | 252 +- trunk/net/sctp/ssnmap.c | 2 +- trunk/net/sctp/transport.c | 4 +- trunk/net/sctp/ulpevent.c | 18 +- trunk/net/sctp/ulpqueue.c | 8 +- trunk/net/socket.c | 17 +- trunk/net/sunrpc/sched.c | 2 +- trunk/net/sysctl_net.c | 2 - trunk/net/xfrm/xfrm_policy.c | 6 +- trunk/scripts/mod/file2alias.c | 2 - trunk/security/keys/Makefile | 1 - trunk/security/keys/internal.h | 26 +- trunk/security/keys/key.c | 81 +- trunk/security/keys/keyctl.c | 301 +- trunk/security/keys/keyring.c | 86 +- trunk/security/keys/permission.c | 70 - trunk/security/keys/proc.c | 2 +- trunk/security/keys/process_keys.c | 164 +- trunk/security/keys/request_key.c | 38 +- trunk/security/keys/request_key_auth.c | 5 +- trunk/security/selinux/hooks.c | 30 +- trunk/sound/arm/pxa2xx-ac97.c | 2 +- trunk/sound/core/memalloc.c | 2 +- trunk/sound/core/memory.c | 10 +- trunk/sound/core/seq/instr/ainstr_iw.c | 2 +- trunk/sound/core/wrappers.c | 2 +- trunk/sound/isa/opl3sa2.c | 2 - trunk/sound/pci/ac97/ac97_bus.c | 23 +- trunk/sound/pci/ac97/ac97_codec.c | 3 +- trunk/sound/pci/ac97/ac97_patch.c | 6 +- trunk/sound/pci/ali5451/ali5451.c | 6 +- trunk/sound/pci/emu10k1/emu10k1_main.c | 5 +- trunk/sound/pci/emu10k1/emumixer.c | 11 +- trunk/sound/pci/hda/hda_generic.c | 6 +- trunk/sound/pci/hda/hda_intel.c | 5 - trunk/sound/pci/hda/patch_realtek.c | 22 +- trunk/sound/pci/korg1212/korg1212.c | 2 +- trunk/sound/pci/via82xx.c | 2 - trunk/sound/ppc/pmac.c | 1 - trunk/sound/usb/usbaudio.c | 8 +- trunk/sound/usb/usbmixer_maps.c | 10 - trunk/sound/usb/usbquirks.h | 50 +- 896 files changed, 9627 insertions(+), 33708 deletions(-) delete mode 100644 trunk/Documentation/keys-request-key.txt delete mode 100644 trunk/arch/arm/configs/collie_defconfig delete mode 100644 trunk/arch/arm/configs/corgi_defconfig delete mode 100644 trunk/arch/arm/configs/poodle_defconfig delete mode 100644 trunk/arch/arm/configs/spitz_defconfig delete mode 100644 trunk/arch/sparc64/kernel/ktlb.S create mode 100644 trunk/arch/sparc64/mm/extable.c create mode 100644 trunk/arch/sparc64/prom/map.S create mode 100644 trunk/arch/sparc64/prom/memory.c delete mode 100644 trunk/arch/um/drivers/ubd_user.c delete mode 100644 trunk/arch/um/include/skas_ptregs.h delete mode 100644 trunk/arch/um/include/sysdep-i386/sc.h delete mode 100644 trunk/arch/um/include/sysdep-i386/thread.h delete mode 100644 trunk/arch/um/include/sysdep-x86_64/sc.h delete mode 100644 trunk/arch/um/include/sysdep-x86_64/thread.h delete mode 100644 trunk/arch/um/include/task.h create mode 100644 trunk/arch/um/kernel/skas/util/Makefile create mode 100644 trunk/arch/um/kernel/skas/util/mk_ptregs-i386.c create mode 100644 trunk/arch/um/kernel/skas/util/mk_ptregs-x86_64.c create mode 100644 trunk/arch/um/os-Linux/util/Makefile create mode 100644 trunk/arch/um/os-Linux/util/mk_user_constants.c create mode 100644 trunk/arch/um/sys-i386/util/Makefile create mode 100644 trunk/arch/um/sys-i386/util/mk_sc.c create mode 100644 trunk/arch/um/sys-i386/util/mk_thread.c create mode 100644 trunk/arch/um/sys-x86_64/util/Makefile create mode 100644 trunk/arch/um/sys-x86_64/util/mk_sc.c create mode 100644 trunk/arch/um/sys-x86_64/util/mk_thread.c create mode 100644 trunk/arch/um/util/Makefile create mode 100644 trunk/arch/um/util/mk_constants.c create mode 100644 trunk/arch/um/util/mk_task.c delete mode 100644 trunk/drivers/net/cassini.c delete mode 100644 trunk/drivers/net/cassini.h delete mode 100644 trunk/drivers/scsi/megaraid/megaraid_sas.c delete mode 100644 trunk/drivers/scsi/megaraid/megaraid_sas.h delete mode 100644 trunk/drivers/scsi/pdc_adma.c delete mode 100644 trunk/drivers/scsi/sata_sil24.c delete mode 100644 trunk/net/llc/sysctl_net_llc.c delete mode 100644 trunk/security/keys/permission.c diff --git a/[refs] b/[refs] index b903d495670b..2bd229abaee4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 972c26bdd6b58e7534473c4f7928584578cf43f4 +refs/heads/master: 20509f1bc553ed7fafa88fa8d01c6212d1876d9f diff --git a/trunk/Documentation/Changes b/trunk/Documentation/Changes index 27232be26e1a..5eaab0441d76 100644 --- a/trunk/Documentation/Changes +++ b/trunk/Documentation/Changes @@ -237,12 +237,6 @@ udev udev is a userspace application for populating /dev dynamically with only entries for devices actually present. udev replaces devfs. -FUSE ----- - -Needs libfuse 2.4.0 or later. Absolute minimum is 2.3.0 but mount -options 'direct_io' and 'kernel_cache' won't work. - Networking ========== @@ -396,10 +390,6 @@ udev ---- o -FUSE ----- -o - Networking ********** diff --git a/trunk/Documentation/DocBook/libata.tmpl b/trunk/Documentation/DocBook/libata.tmpl index d260d92089ad..375ae760dc1e 100644 --- a/trunk/Documentation/DocBook/libata.tmpl +++ b/trunk/Documentation/DocBook/libata.tmpl @@ -415,362 +415,6 @@ and other resources, etc. - - Error handling - - - This chapter describes how errors are handled under libata. - Readers are advised to read SCSI EH - (Documentation/scsi/scsi_eh.txt) and ATA exceptions doc first. - - - Origins of commands - - In libata, a command is represented with struct ata_queued_cmd - or qc. qc's are preallocated during port initialization and - repetitively used for command executions. Currently only one - qc is allocated per port but yet-to-be-merged NCQ branch - allocates one for each tag and maps each qc to NCQ tag 1-to-1. - - - libata commands can originate from two sources - libata itself - and SCSI midlayer. libata internal commands are used for - initialization and error handling. All normal blk requests - and commands for SCSI emulation are passed as SCSI commands - through queuecommand callback of SCSI host template. - - - - How commands are issued - - - - Internal commands - - - First, qc is allocated and initialized using - ata_qc_new_init(). Although ata_qc_new_init() doesn't - implement any wait or retry mechanism when qc is not - available, internal commands are currently issued only during - initialization and error recovery, so no other command is - active and allocation is guaranteed to succeed. - - - Once allocated qc's taskfile is initialized for the command to - be executed. qc currently has two mechanisms to notify - completion. One is via qc->complete_fn() callback and the - other is completion qc->waiting. qc->complete_fn() callback - is the asynchronous path used by normal SCSI translated - commands and qc->waiting is the synchronous (issuer sleeps in - process context) path used by internal commands. - - - Once initialization is complete, host_set lock is acquired - and the qc is issued. - - - - - SCSI commands - - - All libata drivers use ata_scsi_queuecmd() as - hostt->queuecommand callback. scmds can either be simulated - or translated. No qc is involved in processing a simulated - scmd. The result is computed right away and the scmd is - completed. - - - For a translated scmd, ata_qc_new_init() is invoked to - allocate a qc and the scmd is translated into the qc. SCSI - midlayer's completion notification function pointer is stored - into qc->scsidone. - - - qc->complete_fn() callback is used for completion - notification. ATA commands use ata_scsi_qc_complete() while - ATAPI commands use atapi_qc_complete(). Both functions end up - calling qc->scsidone to notify upper layer when the qc is - finished. After translation is completed, the qc is issued - with ata_qc_issue(). - - - Note that SCSI midlayer invokes hostt->queuecommand while - holding host_set lock, so all above occur while holding - host_set lock. - - - - - - - - How commands are processed - - Depending on which protocol and which controller are used, - commands are processed differently. For the purpose of - discussion, a controller which uses taskfile interface and all - standard callbacks is assumed. - - - Currently 6 ATA command protocols are used. They can be - sorted into the following four categories according to how - they are processed. - - - - ATA NO DATA or DMA - - - ATA_PROT_NODATA and ATA_PROT_DMA fall into this category. - These types of commands don't require any software - intervention once issued. Device will raise interrupt on - completion. - - - - - ATA PIO - - - ATA_PROT_PIO is in this category. libata currently - implements PIO with polling. ATA_NIEN bit is set to turn - off interrupt and pio_task on ata_wq performs polling and - IO. - - - - - ATAPI NODATA or DMA - - - ATA_PROT_ATAPI_NODATA and ATA_PROT_ATAPI_DMA are in this - category. packet_task is used to poll BSY bit after - issuing PACKET command. Once BSY is turned off by the - device, packet_task transfers CDB and hands off processing - to interrupt handler. - - - - - ATAPI PIO - - - ATA_PROT_ATAPI is in this category. ATA_NIEN bit is set - and, as in ATAPI NODATA or DMA, packet_task submits cdb. - However, after submitting cdb, further processing (data - transfer) is handed off to pio_task. - - - - - - - How commands are completed - - Once issued, all qc's are either completed with - ata_qc_complete() or time out. For commands which are handled - by interrupts, ata_host_intr() invokes ata_qc_complete(), and, - for PIO tasks, pio_task invokes ata_qc_complete(). In error - cases, packet_task may also complete commands. - - - ata_qc_complete() does the following. - - - - - - - DMA memory is unmapped. - - - - - - ATA_QCFLAG_ACTIVE is clared from qc->flags. - - - - - - qc->complete_fn() callback is invoked. If the return value of - the callback is not zero. Completion is short circuited and - ata_qc_complete() returns. - - - - - - __ata_qc_complete() is called, which does - - - - - qc->flags is cleared to zero. - - - - - - ap->active_tag and qc->tag are poisoned. - - - - - - qc->waiting is claread & completed (in that order). - - - - - - qc is deallocated by clearing appropriate bit in ap->qactive. - - - - - - - - - - - So, it basically notifies upper layer and deallocates qc. One - exception is short-circuit path in #3 which is used by - atapi_qc_complete(). - - - For all non-ATAPI commands, whether it fails or not, almost - the same code path is taken and very little error handling - takes place. A qc is completed with success status if it - succeeded, with failed status otherwise. - - - However, failed ATAPI commands require more handling as - REQUEST SENSE is needed to acquire sense data. If an ATAPI - command fails, ata_qc_complete() is invoked with error status, - which in turn invokes atapi_qc_complete() via - qc->complete_fn() callback. - - - This makes atapi_qc_complete() set scmd->result to - SAM_STAT_CHECK_CONDITION, complete the scmd and return 1. As - the sense data is empty but scmd->result is CHECK CONDITION, - SCSI midlayer will invoke EH for the scmd, and returning 1 - makes ata_qc_complete() to return without deallocating the qc. - This leads us to ata_scsi_error() with partially completed qc. - - - - - ata_scsi_error() - - ata_scsi_error() is the current hostt->eh_strategy_handler() - for libata. As discussed above, this will be entered in two - cases - timeout and ATAPI error completion. This function - calls low level libata driver's eng_timeout() callback, the - standard callback for which is ata_eng_timeout(). It checks - if a qc is active and calls ata_qc_timeout() on the qc if so. - Actual error handling occurs in ata_qc_timeout(). - - - If EH is invoked for timeout, ata_qc_timeout() stops BMDMA and - completes the qc. Note that as we're currently in EH, we - cannot call scsi_done. As described in SCSI EH doc, a - recovered scmd should be either retried with - scsi_queue_insert() or finished with scsi_finish_command(). - Here, we override qc->scsidone with scsi_finish_command() and - calls ata_qc_complete(). - - - If EH is invoked due to a failed ATAPI qc, the qc here is - completed but not deallocated. The purpose of this - half-completion is to use the qc as place holder to make EH - code reach this place. This is a bit hackish, but it works. - - - Once control reaches here, the qc is deallocated by invoking - __ata_qc_complete() explicitly. Then, internal qc for REQUEST - SENSE is issued. Once sense data is acquired, scmd is - finished by directly invoking scsi_finish_command() on the - scmd. Note that as we already have completed and deallocated - the qc which was associated with the scmd, we don't need - to/cannot call ata_qc_complete() again. - - - - - Problems with the current EH - - - - - - Error representation is too crude. Currently any and all - error conditions are represented with ATA STATUS and ERROR - registers. Errors which aren't ATA device errors are treated - as ATA device errors by setting ATA_ERR bit. Better error - descriptor which can properly represent ATA and other - errors/exceptions is needed. - - - - - - When handling timeouts, no action is taken to make device - forget about the timed out command and ready for new commands. - - - - - - EH handling via ata_scsi_error() is not properly protected - from usual command processing. On EH entrance, the device is - not in quiescent state. Timed out commands may succeed or - fail any time. pio_task and atapi_task may still be running. - - - - - - Too weak error recovery. Devices / controllers causing HSM - mismatch errors and other errors quite often require reset to - return to known state. Also, advanced error handling is - necessary to support features like NCQ and hotplug. - - - - - - ATA errors are directly handled in the interrupt handler and - PIO errors in pio_task. This is problematic for advanced - error handling for the following reasons. - - - First, advanced error handling often requires context and - internal qc execution. - - - Second, even a simple failure (say, CRC error) needs - information gathering and could trigger complex error handling - (say, resetting & reconfiguring). Having multiple code - paths to gather information, enter EH and trigger actions - makes life painful. - - - Third, scattered EH code makes implementing low level drivers - difficult. Low level drivers override libata callbacks. If - EH is scattered over several places, each affected callbacks - should perform its part of error handling. This can be error - prone and painful. - - - - - - - libata Library !Edrivers/scsi/libata-core.c @@ -787,722 +431,6 @@ and other resources, etc. !Idrivers/scsi/libata-scsi.c - - ATA errors & exceptions - - - This chapter tries to identify what error/exception conditions exist - for ATA/ATAPI devices and describe how they should be handled in - implementation-neutral way. - - - - The term 'error' is used to describe conditions where either an - explicit error condition is reported from device or a command has - timed out. - - - - The term 'exception' is either used to describe exceptional - conditions which are not errors (say, power or hotplug events), or - to describe both errors and non-error exceptional conditions. Where - explicit distinction between error and exception is necessary, the - term 'non-error exception' is used. - - - - Exception categories - - Exceptions are described primarily with respect to legacy - taskfile + bus master IDE interface. If a controller provides - other better mechanism for error reporting, mapping those into - categories described below shouldn't be difficult. - - - - In the following sections, two recovery actions - reset and - reconfiguring transport - are mentioned. These are described - further in . - - - - HSM violation - - This error is indicated when STATUS value doesn't match HSM - requirement during issuing or excution any ATA/ATAPI command. - - - - Examples - - - - ATA_STATUS doesn't contain !BSY && DRDY && !DRQ while trying - to issue a command. - - - - - - !BSY && !DRQ during PIO data transfer. - - - - - - DRQ on command completion. - - - - - - !BSY && ERR after CDB tranfer starts but before the - last byte of CDB is transferred. ATA/ATAPI standard states - that "The device shall not terminate the PACKET command - with an error before the last byte of the command packet has - been written" in the error outputs description of PACKET - command and the state diagram doesn't include such - transitions. - - - - - - - In these cases, HSM is violated and not much information - regarding the error can be acquired from STATUS or ERROR - register. IOW, this error can be anything - driver bug, - faulty device, controller and/or cable. - - - - As HSM is violated, reset is necessary to restore known state. - Reconfiguring transport for lower speed might be helpful too - as transmission errors sometimes cause this kind of errors. - - - - - ATA/ATAPI device error (non-NCQ / non-CHECK CONDITION) - - - These are errors detected and reported by ATA/ATAPI devices - indicating device problems. For this type of errors, STATUS - and ERROR register values are valid and describe error - condition. Note that some of ATA bus errors are detected by - ATA/ATAPI devices and reported using the same mechanism as - device errors. Those cases are described later in this - section. - - - - For ATA commands, this type of errors are indicated by !BSY - && ERR during command execution and on completion. - - - For ATAPI commands, - - - - - - !BSY && ERR && ABRT right after issuing PACKET - indicates that PACKET command is not supported and falls in - this category. - - - - - - !BSY && ERR(==CHK) && !ABRT after the last - byte of CDB is transferred indicates CHECK CONDITION and - doesn't fall in this category. - - - - - - !BSY && ERR(==CHK) && ABRT after the last byte - of CDB is transferred *probably* indicates CHECK CONDITION and - doesn't fall in this category. - - - - - - - Of errors detected as above, the followings are not ATA/ATAPI - device errors but ATA bus errors and should be handled - according to . - - - - - - CRC error during data transfer - - - This is indicated by ICRC bit in the ERROR register and - means that corruption occurred during data transfer. Upto - ATA/ATAPI-7, the standard specifies that this bit is only - applicable to UDMA transfers but ATA/ATAPI-8 draft revision - 1f says that the bit may be applicable to multiword DMA and - PIO. - - - - - - ABRT error during data transfer or on completion - - - Upto ATA/ATAPI-7, the standard specifies that ABRT could be - set on ICRC errors and on cases where a device is not able - to complete a command. Combined with the fact that MWDMA - and PIO transfer errors aren't allowed to use ICRC bit upto - ATA/ATAPI-7, it seems to imply that ABRT bit alone could - indicate tranfer errors. - - - However, ATA/ATAPI-8 draft revision 1f removes the part - that ICRC errors can turn on ABRT. So, this is kind of - gray area. Some heuristics are needed here. - - - - - - - - ATA/ATAPI device errors can be further categorized as follows. - - - - - - Media errors - - - This is indicated by UNC bit in the ERROR register. ATA - devices reports UNC error only after certain number of - retries cannot recover the data, so there's nothing much - else to do other than notifying upper layer. - - - READ and WRITE commands report CHS or LBA of the first - failed sector but ATA/ATAPI standard specifies that the - amount of transferred data on error completion is - indeterminate, so we cannot assume that sectors preceding - the failed sector have been transferred and thus cannot - complete those sectors successfully as SCSI does. - - - - - - Media changed / media change requested error - - - <<TODO: fill here>> - - - - - Address error - - - This is indicated by IDNF bit in the ERROR register. - Report to upper layer. - - - - - Other errors - - - This can be invalid command or parameter indicated by ABRT - ERROR bit or some other error condition. Note that ABRT - bit can indicate a lot of things including ICRC and Address - errors. Heuristics needed. - - - - - - - - Depending on commands, not all STATUS/ERROR bits are - applicable. These non-applicable bits are marked with - "na" in the output descriptions but upto ATA/ATAPI-7 - no definition of "na" can be found. However, - ATA/ATAPI-8 draft revision 1f describes "N/A" as - follows. - - -
- - 3.2.3.3a N/A - - - A keyword the indicates a field has no defined value in - this standard and should not be checked by the host or - device. N/A fields should be cleared to zero. - - - - -
- - - So, it seems reasonable to assume that "na" bits are - cleared to zero by devices and thus need no explicit masking. - - -
- - - ATAPI device CHECK CONDITION - - - ATAPI device CHECK CONDITION error is indicated by set CHK bit - (ERR bit) in the STATUS register after the last byte of CDB is - transferred for a PACKET command. For this kind of errors, - sense data should be acquired to gather information regarding - the errors. REQUEST SENSE packet command should be used to - acquire sense data. - - - - Once sense data is acquired, this type of errors can be - handled similary to other SCSI errors. Note that sense data - may indicate ATA bus error (e.g. Sense Key 04h HARDWARE ERROR - && ASC/ASCQ 47h/00h SCSI PARITY ERROR). In such - cases, the error should be considered as an ATA bus error and - handled according to . - - - - - - ATA device error (NCQ) - - - NCQ command error is indicated by cleared BSY and set ERR bit - during NCQ command phase (one or more NCQ commands - outstanding). Although STATUS and ERROR registers will - contain valid values describing the error, READ LOG EXT is - required to clear the error condition, determine which command - has failed and acquire more information. - - - - READ LOG EXT Log Page 10h reports which tag has failed and - taskfile register values describing the error. With this - information the failed command can be handled as a normal ATA - command error as in and all - other in-flight commands must be retried. Note that this - retry should not be counted - it's likely that commands - retried this way would have completed normally if it were not - for the failed command. - - - - Note that ATA bus errors can be reported as ATA device NCQ - errors. This should be handled as described in . - - - - If READ LOG EXT Log Page 10h fails or reports NQ, we're - thoroughly screwed. This condition should be treated - according to . - - - - - - ATA bus error - - - ATA bus error means that data corruption occurred during - transmission over ATA bus (SATA or PATA). This type of errors - can be indicated by - - - - - - - ICRC or ABRT error as described in . - - - - - - Controller-specific error completion with error information - indicating transmission error. - - - - - - On some controllers, command timeout. In this case, there may - be a mechanism to determine that the timeout is due to - transmission error. - - - - - - Unknown/random errors, timeouts and all sorts of weirdities. - - - - - - - As described above, transmission errors can cause wide variety - of symptoms ranging from device ICRC error to random device - lockup, and, for many cases, there is no way to tell if an - error condition is due to transmission error or not; - therefore, it's necessary to employ some kind of heuristic - when dealing with errors and timeouts. For example, - encountering repetitive ABRT errors for known supported - command is likely to indicate ATA bus error. - - - - Once it's determined that ATA bus errors have possibly - occurred, lowering ATA bus transmission speed is one of - actions which may alleviate the problem. See for more information. - - - - - - PCI bus error - - - Data corruption or other failures during transmission over PCI - (or other system bus). For standard BMDMA, this is indicated - by Error bit in the BMDMA Status register. This type of - errors must be logged as it indicates something is very wrong - with the system. Resetting host controller is recommended. - - - - - - Late completion - - - This occurs when timeout occurs and the timeout handler finds - out that the timed out command has completed successfully or - with error. This is usually caused by lost interrupts. This - type of errors must be logged. Resetting host controller is - recommended. - - - - - - Unknown error (timeout) - - - This is when timeout occurs and the command is still - processing or the host and device are in unknown state. When - this occurs, HSM could be in any valid or invalid state. To - bring the device to known state and make it forget about the - timed out command, resetting is necessary. The timed out - command may be retried. - - - - Timeouts can also be caused by transmission errors. Refer to - for more details. - - - - - - Hotplug and power management exceptions - - - <<TODO: fill here>> - - - - -
- - - EH recovery actions - - - This section discusses several important recovery actions. - - - - Clearing error condition - - - Many controllers require its error registers to be cleared by - error handler. Different controllers may have different - requirements. - - - - For SATA, it's strongly recommended to clear at least SError - register during error handling. - - - - - Reset - - - During EH, resetting is necessary in the following cases. - - - - - - - HSM is in unknown or invalid state - - - - - - HBA is in unknown or invalid state - - - - - - EH needs to make HBA/device forget about in-flight commands - - - - - - HBA/device behaves weirdly - - - - - - - Resetting during EH might be a good idea regardless of error - condition to improve EH robustness. Whether to reset both or - either one of HBA and device depends on situation but the - following scheme is recommended. - - - - - - - When it's known that HBA is in ready state but ATA/ATAPI - device in in unknown state, reset only device. - - - - - - If HBA is in unknown state, reset both HBA and device. - - - - - - - HBA resetting is implementation specific. For a controller - complying to taskfile/BMDMA PCI IDE, stopping active DMA - transaction may be sufficient iff BMDMA state is the only HBA - context. But even mostly taskfile/BMDMA PCI IDE complying - controllers may have implementation specific requirements and - mechanism to reset themselves. This must be addressed by - specific drivers. - - - - OTOH, ATA/ATAPI standard describes in detail ways to reset - ATA/ATAPI devices. - - - - - PATA hardware reset - - - This is hardware initiated device reset signalled with - asserted PATA RESET- signal. There is no standard way to - initiate hardware reset from software although some - hardware provides registers that allow driver to directly - tweak the RESET- signal. - - - - - Software reset - - - This is achieved by turning CONTROL SRST bit on for at - least 5us. Both PATA and SATA support it but, in case of - SATA, this may require controller-specific support as the - second Register FIS to clear SRST should be transmitted - while BSY bit is still set. Note that on PATA, this resets - both master and slave devices on a channel. - - - - - EXECUTE DEVICE DIAGNOSTIC command - - - Although ATA/ATAPI standard doesn't describe exactly, EDD - implies some level of resetting, possibly similar level - with software reset. Host-side EDD protocol can be handled - with normal command processing and most SATA controllers - should be able to handle EDD's just like other commands. - As in software reset, EDD affects both devices on a PATA - bus. - - - Although EDD does reset devices, this doesn't suit error - handling as EDD cannot be issued while BSY is set and it's - unclear how it will act when device is in unknown/weird - state. - - - - - ATAPI DEVICE RESET command - - - This is very similar to software reset except that reset - can be restricted to the selected device without affecting - the other device sharing the cable. - - - - - SATA phy reset - - - This is the preferred way of resetting a SATA device. In - effect, it's identical to PATA hardware reset. Note that - this can be done with the standard SCR Control register. - As such, it's usually easier to implement than software - reset. - - - - - - - - One more thing to consider when resetting devices is that - resetting clears certain configuration parameters and they - need to be set to their previous or newly adjusted values - after reset. - - - - Parameters affected are. - - - - - - - CHS set up with INITIALIZE DEVICE PARAMETERS (seldomly used) - - - - - - Parameters set with SET FEATURES including transfer mode setting - - - - - - Block count set with SET MULTIPLE MODE - - - - - - Other parameters (SET MAX, MEDIA LOCK...) - - - - - - - ATA/ATAPI standard specifies that some parameters must be - maintained across hardware or software reset, but doesn't - strictly specify all of them. Always reconfiguring needed - parameters after reset is required for robustness. Note that - this also applies when resuming from deep sleep (power-off). - - - - Also, ATA/ATAPI standard requires that IDENTIFY DEVICE / - IDENTIFY PACKET DEVICE is issued after any configuration - parameter is updated or a hardware reset and the result used - for further operation. OS driver is required to implement - revalidation mechanism to support this. - - - - - - Reconfigure transport - - - For both PATA and SATA, a lot of corners are cut for cheap - connectors, cables or controllers and it's quite common to see - high transmission error rate. This can be mitigated by - lowering transmission speed. - - - - The following is a possible scheme Jeff Garzik suggested. - - -
- - If more than $N (3?) transmission errors happen in 15 minutes, - - - - - if SATA, decrease SATA PHY speed. if speed cannot be decreased, - - - - - decrease UDMA xfer speed. if at UDMA0, switch to PIO4, - - - - - decrease PIO xfer speed. if at PIO3, complain, but continue - - - -
- -
- -
- -
- ata_piix Internals !Idrivers/scsi/ata_piix.c diff --git a/trunk/Documentation/SubmittingPatches b/trunk/Documentation/SubmittingPatches index 237d54c44bc5..7f43b040311e 100644 --- a/trunk/Documentation/SubmittingPatches +++ b/trunk/Documentation/SubmittingPatches @@ -301,84 +301,8 @@ now, but you can do this to mark internal company procedures or just point out some special detail about the sign-off. -12) The canonical patch format -The canonical patch subject line is: - - Subject: [PATCH 001/123] subsystem: summary phrase - -The canonical patch message body contains the following: - - - A "from" line specifying the patch author. - - - An empty line. - - - The body of the explanation, which will be copied to the - permanent changelog to describe this patch. - - - The "Signed-off-by:" lines, described above, which will - also go in the changelog. - - - A marker line containing simply "---". - - - Any additional comments not suitable for the changelog. - - - The actual patch (diff output). - -The Subject line format makes it very easy to sort the emails -alphabetically by subject line - pretty much any email reader will -support that - since because the sequence number is zero-padded, -the numerical and alphabetic sort is the same. - -The "subsystem" in the email's Subject should identify which -area or subsystem of the kernel is being patched. - -The "summary phrase" in the email's Subject should concisely -describe the patch which that email contains. The "summary -phrase" should not be a filename. Do not use the same "summary -phrase" for every patch in a whole patch series. - -Bear in mind that the "summary phrase" of your email becomes -a globally-unique identifier for that patch. It propagates -all the way into the git changelog. The "summary phrase" may -later be used in developer discussions which refer to the patch. -People will want to google for the "summary phrase" to read -discussion regarding that patch. - -A couple of example Subjects: - - Subject: [patch 2/5] ext2: improve scalability of bitmap searching - Subject: [PATCHv2 001/207] x86: fix eflags tracking - -The "from" line must be the very first line in the message body, -and has the form: - - From: Original Author - -The "from" line specifies who will be credited as the author of the -patch in the permanent changelog. If the "from" line is missing, -then the "From:" line from the email header will be used to determine -the patch author in the changelog. - -The explanation body will be committed to the permanent source -changelog, so should make sense to a competent reader who has long -since forgotten the immediate details of the discussion that might -have led to this patch. - -The "---" marker line serves the essential purpose of marking for patch -handling tools where the changelog message ends. - -One good use for the additional comments after the "---" marker is for -a diffstat, to show what files have changed, and the number of inserted -and deleted lines per file. A diffstat is especially useful on bigger -patches. Other comments relevant only to the moment or the maintainer, -not suitable for the permanent changelog, should also go here. - -See more details on the proper patch format in the following -references. - - -13) More references for submitting patches +12) More references for submitting patches Andrew Morton, "The perfect patch" (tpp). @@ -386,14 +310,6 @@ Andrew Morton, "The perfect patch" (tpp). Jeff Garzik, "Linux kernel patch submission format." -Greg KH, "How to piss off a kernel subsystem maintainer" - - -Kernel Documentation/CodingStyle - - -Linus Torvald's mail on the canonical patch format: - ----------------------------------- diff --git a/trunk/Documentation/connector/connector.txt b/trunk/Documentation/connector/connector.txt index 57a314b14cf8..54a0a14bfbe3 100644 --- a/trunk/Documentation/connector/connector.txt +++ b/trunk/Documentation/connector/connector.txt @@ -131,47 +131,3 @@ Netlink itself is not reliable protocol, that means that messages can be lost due to memory pressure or process' receiving queue overflowed, so caller is warned must be prepared. That is why struct cn_msg [main connector's message header] contains u32 seq and u32 ack fields. - -/*****************************************/ -Userspace usage. -/*****************************************/ -2.6.14 has a new netlink socket implementation, which by default does not -allow to send data to netlink groups other than 1. -So, if to use netlink socket (for example using connector) -with different group number userspace application must subscribe to -that group. It can be achieved by following pseudocode: - -s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); - -l_local.nl_family = AF_NETLINK; -l_local.nl_groups = 12345; -l_local.nl_pid = 0; - -if (bind(s, (struct sockaddr *)&l_local, sizeof(struct sockaddr_nl)) == -1) { - perror("bind"); - close(s); - return -1; -} - -{ - int on = l_local.nl_groups; - setsockopt(s, 270, 1, &on, sizeof(on)); -} - -Where 270 above is SOL_NETLINK, and 1 is a NETLINK_ADD_MEMBERSHIP socket -option. To drop multicast subscription one should call above socket option -with NETLINK_DROP_MEMBERSHIP parameter which is defined as 0. - -2.6.14 netlink code only allows to select a group which is less or equal to -the maximum group number, which is used at netlink_kernel_create() time. -In case of connector it is CN_NETLINK_USERS + 0xf, so if you want to use -group number 12345, you must increment CN_NETLINK_USERS to that number. -Additional 0xf numbers are allocated to be used by non-in-kernel users. - -Due to this limitation, group 0xffffffff does not work now, so one can -not use add/remove connector's group notifications, but as far as I know, -only cn_test.c test module used it. - -Some work in netlink area is still being done, so things can be changed in -2.6.15 timeframe, if it will happen, documentation will be updated for that -kernel. diff --git a/trunk/Documentation/dell_rbu.txt b/trunk/Documentation/dell_rbu.txt index 941343a7a265..95d7f62e4dbc 100644 --- a/trunk/Documentation/dell_rbu.txt +++ b/trunk/Documentation/dell_rbu.txt @@ -35,7 +35,6 @@ The driver load creates the following directories under the /sys file system. /sys/class/firmware/dell_rbu/data /sys/devices/platform/dell_rbu/image_type /sys/devices/platform/dell_rbu/data -/sys/devices/platform/dell_rbu/packet_size The driver supports two types of update mechanism; monolithic and packetized. These update mechanism depends upon the BIOS currently running on the system. @@ -48,26 +47,8 @@ By default the driver uses monolithic memory for the update type. This can be changed to packets during the driver load time by specifying the load parameter image_type=packet. This can also be changed later as below echo packet > /sys/devices/platform/dell_rbu/image_type - -In packet update mode the packet size has to be given before any packets can -be downloaded. It is done as below -echo XXXX > /sys/devices/platform/dell_rbu/packet_size -In the packet update mechanism, the user neesd to create a new file having -packets of data arranged back to back. It can be done as follows -The user creates packets header, gets the chunk of the BIOS image and -placs it next to the packetheader; now, the packetheader + BIOS image chunk -added to geather should match the specified packet_size. This makes one -packet, the user needs to create more such packets out of the entire BIOS -image file and then arrange all these packets back to back in to one single -file. -This file is then copied to /sys/class/firmware/dell_rbu/data. -Once this file gets to the driver, the driver extracts packet_size data from -the file and spreads it accross the physical memory in contiguous packet_sized -space. -This method makes sure that all the packets get to the driver in a single operation. - -In monolithic update the user simply get the BIOS image (.hdr file) and copies -to the data file as is without any change to the BIOS image itself. +Also echoing either mono ,packet or init in to image_type will free up the +memory allocated by the driver. Do the steps below to download the BIOS image. 1) echo 1 > /sys/class/firmware/dell_rbu/loading @@ -77,10 +58,7 @@ Do the steps below to download the BIOS image. The /sys/class/firmware/dell_rbu/ entries will remain till the following is done. echo -1 > /sys/class/firmware/dell_rbu/loading. -Until this step is completed the driver cannot be unloaded. -Also echoing either mono ,packet or init in to image_type will free up the -memory allocated by the driver. - +Until this step is completed the drivr cannot be unloaded. If an user by accident executes steps 1 and 3 above without executing step 2; it will make the /sys/class/firmware/dell_rbu/ entries to disappear. The entries can be recreated by doing the following @@ -88,11 +66,15 @@ echo init > /sys/devices/platform/dell_rbu/image_type NOTE: echoing init in image_type does not change it original value. Also the driver provides /sys/devices/platform/dell_rbu/data readonly file to -read back the image downloaded. +read back the image downloaded. This is useful in case of packet update +mechanism where the above steps 1,2,3 will repeated for every packet. +By reading the /sys/devices/platform/dell_rbu/data file all packet data +downloaded can be verified in a single file. +The packets are arranged in this file one after the other in a FIFO order. NOTE: -This driver requires a patch for firmware_class.c which has the modified -request_firmware_nowait function. +This driver requires a patch for firmware_class.c which has the addition +of request_firmware_nowait_nohotplug function to wortk Also after updating the BIOS image an user mdoe application neeeds to execute code which message the BIOS update request to the BIOS. So on the next reboot the BIOS knows about the new image downloaded and it updates it self. diff --git a/trunk/Documentation/keys-request-key.txt b/trunk/Documentation/keys-request-key.txt deleted file mode 100644 index 5f2b9c5edbb5..000000000000 --- a/trunk/Documentation/keys-request-key.txt +++ /dev/null @@ -1,161 +0,0 @@ - =================== - KEY REQUEST SERVICE - =================== - -The key request service is part of the key retention service (refer to -Documentation/keys.txt). This document explains more fully how that the -requesting algorithm works. - -The process starts by either the kernel requesting a service by calling -request_key(): - - struct key *request_key(const struct key_type *type, - const char *description, - const char *callout_string); - -Or by userspace invoking the request_key system call: - - key_serial_t request_key(const char *type, - const char *description, - const char *callout_info, - key_serial_t dest_keyring); - -The main difference between the two access points is that the in-kernel -interface does not need to link the key to a keyring to prevent it from being -immediately destroyed. The kernel interface returns a pointer directly to the -key, and it's up to the caller to destroy the key. - -The userspace interface links the key to a keyring associated with the process -to prevent the key from going away, and returns the serial number of the key to -the caller. - - -=========== -THE PROCESS -=========== - -A request proceeds in the following manner: - - (1) Process A calls request_key() [the userspace syscall calls the kernel - interface]. - - (2) request_key() searches the process's subscribed keyrings to see if there's - a suitable key there. If there is, it returns the key. If there isn't, and - callout_info is not set, an error is returned. Otherwise the process - proceeds to the next step. - - (3) request_key() sees that A doesn't have the desired key yet, so it creates - two things: - - (a) An uninstantiated key U of requested type and description. - - (b) An authorisation key V that refers to key U and notes that process A - is the context in which key U should be instantiated and secured, and - from which associated key requests may be satisfied. - - (4) request_key() then forks and executes /sbin/request-key with a new session - keyring that contains a link to auth key V. - - (5) /sbin/request-key execs an appropriate program to perform the actual - instantiation. - - (6) The program may want to access another key from A's context (say a - Kerberos TGT key). It just requests the appropriate key, and the keyring - search notes that the session keyring has auth key V in its bottom level. - - This will permit it to then search the keyrings of process A with the - UID, GID, groups and security info of process A as if it was process A, - and come up with key W. - - (7) The program then does what it must to get the data with which to - instantiate key U, using key W as a reference (perhaps it contacts a - Kerberos server using the TGT) and then instantiates key U. - - (8) Upon instantiating key U, auth key V is automatically revoked so that it - may not be used again. - - (9) The program then exits 0 and request_key() deletes key V and returns key - U to the caller. - -This also extends further. If key W (step 5 above) didn't exist, key W would be -created uninstantiated, another auth key (X) would be created [as per step 3] -and another copy of /sbin/request-key spawned [as per step 4]; but the context -specified by auth key X will still be process A, as it was in auth key V. - -This is because process A's keyrings can't simply be attached to -/sbin/request-key at the appropriate places because (a) execve will discard two -of them, and (b) it requires the same UID/GID/Groups all the way through. - - -====================== -NEGATIVE INSTANTIATION -====================== - -Rather than instantiating a key, it is possible for the possessor of an -authorisation key to negatively instantiate a key that's under construction. -This is a short duration placeholder that causes any attempt at re-requesting -the key whilst it exists to fail with error ENOKEY. - -This is provided to prevent excessive repeated spawning of /sbin/request-key -processes for a key that will never be obtainable. - -Should the /sbin/request-key process exit anything other than 0 or die on a -signal, the key under construction will be automatically negatively -instantiated for a short amount of time. - - -==================== -THE SEARCH ALGORITHM -==================== - -A search of any particular keyring proceeds in the following fashion: - - (1) When the key management code searches for a key (keyring_search_aux) it - firstly calls key_permission(SEARCH) on the keyring it's starting with, - if this denies permission, it doesn't search further. - - (2) It considers all the non-keyring keys within that keyring and, if any key - matches the criteria specified, calls key_permission(SEARCH) on it to see - if the key is allowed to be found. If it is, that key is returned; if - not, the search continues, and the error code is retained if of higher - priority than the one currently set. - - (3) It then considers all the keyring-type keys in the keyring it's currently - searching. It calls key_permission(SEARCH) on each keyring, and if this - grants permission, it recurses, executing steps (2) and (3) on that - keyring. - -The process stops immediately a valid key is found with permission granted to -use it. Any error from a previous match attempt is discarded and the key is -returned. - -When search_process_keyrings() is invoked, it performs the following searches -until one succeeds: - - (1) If extant, the process's thread keyring is searched. - - (2) If extant, the process's process keyring is searched. - - (3) The process's session keyring is searched. - - (4) If the process has a request_key() authorisation key in its session - keyring then: - - (a) If extant, the calling process's thread keyring is searched. - - (b) If extant, the calling process's process keyring is searched. - - (c) The calling process's session keyring is searched. - -The moment one succeeds, all pending errors are discarded and the found key is -returned. - -Only if all these fail does the whole thing fail with the highest priority -error. Note that several errors may have come from LSM. - -The error priority is: - - EKEYREVOKED > EKEYEXPIRED > ENOKEY - -EACCES/EPERM are only returned on a direct search of a specific keyring where -the basal keyring does not grant Search permission. diff --git a/trunk/Documentation/keys.txt b/trunk/Documentation/keys.txt index 4afe03a58c5b..0321ded4b9ae 100644 --- a/trunk/Documentation/keys.txt +++ b/trunk/Documentation/keys.txt @@ -195,8 +195,8 @@ KEY ACCESS PERMISSIONS ====================== Keys have an owner user ID, a group access ID, and a permissions mask. The mask -has up to eight bits each for possessor, user, group and other access. Only -five of each set of eight bits are defined. These permissions granted are: +has up to eight bits each for user, group and other access. Only five of each +set of eight bits are defined. These permissions granted are: (*) View @@ -241,16 +241,16 @@ about the status of the key service: type, description and permissions. The payload of the key is not available this way: - SERIAL FLAGS USAGE EXPY PERM UID GID TYPE DESCRIPTION: SUMMARY - 00000001 I----- 39 perm 1f1f0000 0 0 keyring _uid_ses.0: 1/4 - 00000002 I----- 2 perm 1f1f0000 0 0 keyring _uid.0: empty - 00000007 I----- 1 perm 1f1f0000 0 0 keyring _pid.1: empty - 0000018d I----- 1 perm 1f1f0000 0 0 keyring _pid.412: empty - 000004d2 I--Q-- 1 perm 1f1f0000 32 -1 keyring _uid.32: 1/4 - 000004d3 I--Q-- 3 perm 1f1f0000 32 -1 keyring _uid_ses.32: empty - 00000892 I--QU- 1 perm 1f000000 0 0 user metal:copper: 0 - 00000893 I--Q-N 1 35s 1f1f0000 0 0 user metal:silver: 0 - 00000894 I--Q-- 1 10h 001f0000 0 0 user metal:gold: 0 + SERIAL FLAGS USAGE EXPY PERM UID GID TYPE DESCRIPTION: SUMMARY + 00000001 I----- 39 perm 1f0000 0 0 keyring _uid_ses.0: 1/4 + 00000002 I----- 2 perm 1f0000 0 0 keyring _uid.0: empty + 00000007 I----- 1 perm 1f0000 0 0 keyring _pid.1: empty + 0000018d I----- 1 perm 1f0000 0 0 keyring _pid.412: empty + 000004d2 I--Q-- 1 perm 1f0000 32 -1 keyring _uid.32: 1/4 + 000004d3 I--Q-- 3 perm 1f0000 32 -1 keyring _uid_ses.32: empty + 00000892 I--QU- 1 perm 1f0000 0 0 user metal:copper: 0 + 00000893 I--Q-N 1 35s 1f0000 0 0 user metal:silver: 0 + 00000894 I--Q-- 1 10h 1f0000 0 0 user metal:gold: 0 The flags are: @@ -361,8 +361,6 @@ The main syscalls are: /sbin/request-key will be invoked in an attempt to obtain a key. The callout_info string will be passed as an argument to the program. - See also Documentation/keys-request-key.txt. - The keyctl syscall functions are: @@ -535,8 +533,8 @@ The keyctl syscall functions are: (*) Read the payload data from a key: - long keyctl(KEYCTL_READ, key_serial_t keyring, char *buffer, - size_t buflen); + key_serial_t keyctl(KEYCTL_READ, key_serial_t keyring, char *buffer, + size_t buflen); This function attempts to read the payload data from the specified key into the buffer. The process must have read permission on the key to @@ -557,9 +555,9 @@ The keyctl syscall functions are: (*) Instantiate a partially constructed key. - long keyctl(KEYCTL_INSTANTIATE, key_serial_t key, - const void *payload, size_t plen, - key_serial_t keyring); + key_serial_t keyctl(KEYCTL_INSTANTIATE, key_serial_t key, + const void *payload, size_t plen, + key_serial_t keyring); If the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call to supply data for the key before the @@ -578,8 +576,8 @@ The keyctl syscall functions are: (*) Negatively instantiate a partially constructed key. - long keyctl(KEYCTL_NEGATE, key_serial_t key, - unsigned timeout, key_serial_t keyring); + key_serial_t keyctl(KEYCTL_NEGATE, key_serial_t key, + unsigned timeout, key_serial_t keyring); If the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call mark the key as negative before the @@ -639,34 +637,6 @@ call, and the key released upon close. How to deal with conflicting keys due to two different users opening the same file is left to the filesystem author to solve. -Note that there are two different types of pointers to keys that may be -encountered: - - (*) struct key * - - This simply points to the key structure itself. Key structures will be at - least four-byte aligned. - - (*) key_ref_t - - This is equivalent to a struct key *, but the least significant bit is set - if the caller "possesses" the key. By "possession" it is meant that the - calling processes has a searchable link to the key from one of its - keyrings. There are three functions for dealing with these: - - key_ref_t make_key_ref(const struct key *key, - unsigned long possession); - - struct key *key_ref_to_ptr(const key_ref_t key_ref); - - unsigned long is_key_possessed(const key_ref_t key_ref); - - The first function constructs a key reference from a key pointer and - possession information (which must be 0 or 1 and not any other value). - - The second function retrieves the key pointer from a reference and the - third retrieves the possession flag. - When accessing a key's payload contents, certain precautions must be taken to prevent access vs modification races. See the section "Notes on accessing payload contents" for more information. @@ -690,18 +660,12 @@ payload contents" for more information. If successful, the key will have been attached to the default keyring for implicitly obtained request-key keys, as set by KEYCTL_SET_REQKEY_KEYRING. - See also Documentation/keys-request-key.txt. - (*) When it is no longer required, the key should be released using: void key_put(struct key *key); - Or: - - void key_ref_put(key_ref_t key_ref); - - These can be called from interrupt context. If CONFIG_KEYS is not set then + This can be called from interrupt context. If CONFIG_KEYS is not set then the argument will not be parsed. @@ -725,17 +689,13 @@ payload contents" for more information. (*) If a keyring was found in the search, this can be further searched by: - key_ref_t keyring_search(key_ref_t keyring_ref, - const struct key_type *type, - const char *description) + struct key *keyring_search(struct key *keyring, + const struct key_type *type, + const char *description) This searches the keyring tree specified for a matching key. Error ENOKEY - is returned upon failure (use IS_ERR/PTR_ERR to determine). If successful, - the returned key will need to be released. - - The possession attribute from the keyring reference is used to control - access through the permissions mask and is propagated to the returned key - reference pointer if successful. + is returned upon failure. If successful, the returned key will need to be + released. (*) To check the validity of a key, this function can be called: @@ -772,7 +732,7 @@ More complex payload contents must be allocated and a pointer to them set in key->payload.data. One of the following ways must be selected to access the data: - (1) Unmodifiable key type. + (1) Unmodifyable key type. If the key type does not have a modify method, then the key's payload can be accessed without any form of locking, provided that it's known to be diff --git a/trunk/Documentation/networking/ip-sysctl.txt b/trunk/Documentation/networking/ip-sysctl.txt index b433c8a27e2d..ab65714d95fc 100644 --- a/trunk/Documentation/networking/ip-sysctl.txt +++ b/trunk/Documentation/networking/ip-sysctl.txt @@ -355,14 +355,10 @@ ip_dynaddr - BOOLEAN Default: 0 icmp_echo_ignore_all - BOOLEAN - If set non-zero, then the kernel will ignore all ICMP ECHO - requests sent to it. - Default: 0 - icmp_echo_ignore_broadcasts - BOOLEAN - If set non-zero, then the kernel will ignore all ICMP ECHO and - TIMESTAMP requests sent to it via broadcast/multicast. - Default: 1 + If either is set to true, then the kernel will ignore either all + ICMP ECHO requests sent to it or just those to broadcast/multicast + addresses, respectively. icmp_ratelimit - INTEGER Limit the maximal rates for sending ICMP packets whose type matches diff --git a/trunk/Documentation/sparse.txt b/trunk/Documentation/sparse.txt index 1829009db771..5df44dc894e5 100644 --- a/trunk/Documentation/sparse.txt +++ b/trunk/Documentation/sparse.txt @@ -51,9 +51,9 @@ or you don't get any checking at all. Where to get sparse ~~~~~~~~~~~~~~~~~~~ -With git, you can just get it from +With BK, you can just get it from - rsync://rsync.kernel.org/pub/scm/devel/sparse/sparse.git + bk://sparse.bkbits.net/sparse and DaveJ has tar-balls at diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 767fb610963e..7d1dd5bad39a 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -604,15 +604,6 @@ P: H. Peter Anvin M: hpa@zytor.com S: Maintained -CPUSETS -P: Paul Jackson -P: Simon Derr -M: pj@sgi.com -M: simon.derr@bull.net -L: linux-kernel@vger.kernel.org -W: http://www.bullopensource.org/cpuset/ -S: Supported - CRAMFS FILESYSTEM W: http://sourceforge.net/projects/cramfs/ S: Orphan @@ -1168,6 +1159,11 @@ L: linux1394-devel@lists.sourceforge.net W: http://www.linux1394.org/ S: Orphan +IEEE 1394 SBP2 +L: linux1394-devel@lists.sourceforge.net +W: http://www.linux1394.org/ +S: Orphan + IEEE 1394 SUBSYSTEM P: Ben Collins M: bcollins@debian.org @@ -1202,15 +1198,6 @@ L: linux1394-devel@lists.sourceforge.net W: http://www.linux1394.org/ S: Maintained -IEEE 1394 SBP2 -P: Ben Collins -M: bcollins@debian.org -P: Stefan Richter -M: stefanr@s5r6.in-berlin.de -L: linux1394-devel@lists.sourceforge.net -W: http://www.linux1394.org/ -S: Maintained - IMS TWINTURBO FRAMEBUFFER DRIVER P: Paul Mundt M: lethal@chaoticdreams.org @@ -1618,13 +1605,6 @@ M: vandrove@vc.cvut.cz L: linux-fbdev-devel@lists.sourceforge.net S: Maintained -MEGARAID SCSI DRIVERS -P: Neela Syam Kolli -M: Neela.Kolli@engenio.com -S: linux-scsi@vger.kernel.org -W: http://megaraid.lsilogic.com -S: Maintained - MEMORY TECHNOLOGY DEVICES P: David Woodhouse M: dwmw2@infradead.org @@ -1754,11 +1734,8 @@ S: Maintained IPVS P: Wensong Zhang M: wensong@linux-vs.org -P: Simon Horman -M: horms@verge.net.au P: Julian Anastasov M: ja@ssi.bg -L: netdev@vger.kernel.org S: Maintained NFS CLIENT @@ -1929,13 +1906,6 @@ M: joern@wh.fh-wedel.de L: linux-mtd@lists.infradead.org S: Maintained -PKTCDVD DRIVER -P: Peter Osterlund -M: petero2@telia.com -L: linux-kernel@vger.kernel.org -L: packet-writing@suse.com -S: Maintained - POSIX CLOCKS and TIMERS P: George Anzinger M: george@mvista.com diff --git a/trunk/Makefile b/trunk/Makefile index be33d758c0fe..8cf6becf68dc 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 14 -EXTRAVERSION =-rc4 +EXTRAVERSION =-rc2 NAME=Affluent Albatross # *DOCUMENTATION* @@ -660,10 +660,8 @@ quiet_cmd_sysmap = SYSMAP # Link of vmlinux # If CONFIG_KALLSYMS is set .version is already updated # Generate System.map and verify that the content is consistent -# Use + in front of the vmlinux_version rule to silent warning with make -j2 -# First command is ':' to allow us to use + in front of the rule + define rule_vmlinux__ - : $(if $(CONFIG_KALLSYMS),,+$(call cmd,vmlinux_version)) $(call cmd,vmlinux__) diff --git a/trunk/arch/alpha/kernel/entry.S b/trunk/arch/alpha/kernel/entry.S index e38671c922bc..76cc0cb5fc2e 100644 --- a/trunk/arch/alpha/kernel/entry.S +++ b/trunk/arch/alpha/kernel/entry.S @@ -196,7 +196,6 @@ entUna: stq $26, 208($sp) stq $27, 216($sp) stq $28, 224($sp) - mov $sp, $19 stq $gp, 232($sp) lda $8, 0x3fff stq $31, 248($sp) diff --git a/trunk/arch/alpha/kernel/traps.c b/trunk/arch/alpha/kernel/traps.c index f9d12319e0fb..6f509a644bdd 100644 --- a/trunk/arch/alpha/kernel/traps.c +++ b/trunk/arch/alpha/kernel/traps.c @@ -446,15 +446,16 @@ struct unaligned_stat { /* Macro for exception fixup code to access integer registers. */ -#define una_reg(r) (regs->regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)]) +#define una_reg(r) (regs.regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)]) asmlinkage void do_entUna(void * va, unsigned long opcode, unsigned long reg, - struct allregs *regs) + unsigned long a3, unsigned long a4, unsigned long a5, + struct allregs regs) { long error, tmp1, tmp2, tmp3, tmp4; - unsigned long pc = regs->pc - 4; + unsigned long pc = regs.pc - 4; const struct exception_table_entry *fixup; unaligned[0].count++; @@ -635,7 +636,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg, printk("Forwarding unaligned exception at %lx (%lx)\n", pc, newpc); - regs->pc = newpc; + (®s)->pc = newpc; return; } @@ -649,7 +650,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg, current->comm, current->pid); printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n", - pc, una_reg(26), regs->ps); + pc, una_reg(26), regs.ps); printk("r0 = %016lx r1 = %016lx r2 = %016lx\n", una_reg(0), una_reg(1), una_reg(2)); printk("r3 = %016lx r4 = %016lx r5 = %016lx\n", @@ -669,10 +670,10 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg, una_reg(22), una_reg(23), una_reg(24)); printk("r25= %016lx r27= %016lx r28= %016lx\n", una_reg(25), una_reg(27), una_reg(28)); - printk("gp = %016lx sp = %p\n", regs->gp, regs+1); + printk("gp = %016lx sp = %p\n", regs.gp, ®s+1); dik_show_code((unsigned int *)pc); - dik_show_trace((unsigned long *)(regs+1)); + dik_show_trace((unsigned long *)(®s+1)); if (test_and_set_thread_flag (TIF_DIE_IF_KERNEL)) { printk("die_if_kernel recursion detected.\n"); diff --git a/trunk/arch/arm/Makefile b/trunk/arch/arm/Makefile index 299bc0468702..130e6228b587 100644 --- a/trunk/arch/arm/Makefile +++ b/trunk/arch/arm/Makefile @@ -53,7 +53,7 @@ tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110 tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100 tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale -tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) +tune-$(CONFIG_CPU_V6) :=-mtune=strongarm # Need -Uarm for gcc < 3.x CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) @@ -175,10 +175,10 @@ else endif @touch $@ -archprepare: maketools +archprepare: maketools include/asm-arm/.arch .PHONY: maketools FORCE -maketools: include/linux/version.h include/asm-arm/.arch FORCE +maketools: include/linux/version.h FORCE $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h # Convert bzImage to zImage diff --git a/trunk/arch/arm/common/gic.c b/trunk/arch/arm/common/gic.c index c02dc8116a18..d74990717559 100644 --- a/trunk/arch/arm/common/gic.c +++ b/trunk/arch/arm/common/gic.c @@ -68,7 +68,6 @@ static void gic_unmask_irq(unsigned int irq) writel(mask, gic_dist_base + GIC_DIST_ENABLE_SET + (irq / 32) * 4); } -#ifdef CONFIG_SMP static void gic_set_cpu(struct irqdesc *desc, unsigned int irq, unsigned int cpu) { void __iomem *reg = gic_dist_base + GIC_DIST_TARGET + (irq & ~3); @@ -79,7 +78,6 @@ static void gic_set_cpu(struct irqdesc *desc, unsigned int irq, unsigned int cpu val |= 1 << (cpu + shift); writel(val, reg); } -#endif static struct irqchip gic_chip = { .ack = gic_ack_irq, diff --git a/trunk/arch/arm/common/locomo.c b/trunk/arch/arm/common/locomo.c index e8053d16829b..a7bd85700152 100644 --- a/trunk/arch/arm/common/locomo.c +++ b/trunk/arch/arm/common/locomo.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/trunk/arch/arm/common/scoop.c b/trunk/arch/arm/common/scoop.c index 9e5245c702de..d3a04c2a2c85 100644 --- a/trunk/arch/arm/common/scoop.c +++ b/trunk/arch/arm/common/scoop.c @@ -26,8 +26,6 @@ struct scoop_pcmcia_dev *scoop_devs; struct scoop_dev { void *base; spinlock_t scoop_lock; - unsigned short suspend_clr; - unsigned short suspend_set; u32 scoop_gpwr; }; @@ -92,24 +90,14 @@ EXPORT_SYMBOL(reset_scoop); EXPORT_SYMBOL(read_scoop_reg); EXPORT_SYMBOL(write_scoop_reg); -static void check_scoop_reg(struct scoop_dev *sdev) -{ - unsigned short mcr; - - mcr = SCOOP_REG(sdev->base, SCOOP_MCR); - if ((mcr & 0x100) == 0) - SCOOP_REG(sdev->base, SCOOP_MCR) = 0x0101; -} - #ifdef CONFIG_PM static int scoop_suspend(struct device *dev, pm_message_t state, uint32_t level) { if (level == SUSPEND_POWER_DOWN) { struct scoop_dev *sdev = dev_get_drvdata(dev); - check_scoop_reg(sdev); - sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR); - SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set; + sdev->scoop_gpwr = SCOOP_REG(sdev->base,SCOOP_GPWR); + SCOOP_REG(sdev->base,SCOOP_GPWR) = 0; } return 0; } @@ -119,7 +107,6 @@ static int scoop_resume(struct device *dev, uint32_t level) if (level == RESUME_POWER_ON) { struct scoop_dev *sdev = dev_get_drvdata(dev); - check_scoop_reg(sdev); SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr; } return 0; @@ -164,9 +151,6 @@ int __init scoop_probe(struct device *dev) SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff; SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff; - devptr->suspend_clr = inf->suspend_clr; - devptr->suspend_set = inf->suspend_set; - return 0; } diff --git a/trunk/arch/arm/configs/collie_defconfig b/trunk/arch/arm/configs/collie_defconfig deleted file mode 100644 index 40dfe07a8bce..000000000000 --- a/trunk/arch/arm/configs/collie_defconfig +++ /dev/null @@ -1,888 +0,0 @@ -# -# Automatically generated make config: don't edit -# Linux kernel version: 2.6.14-rc3 -# Sun Oct 9 16:55:14 2005 -# -CONFIG_ARM=y -CONFIG_MMU=y -CONFIG_UID16=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_CALIBRATE_DELAY=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -# CONFIG_CLEAN_COMPILE is not set -CONFIG_BROKEN=y -CONFIG_BROKEN_ON_SMP=y -CONFIG_LOCK_KERNEL=y -CONFIG_INIT_ENV_ARG_LIMIT=32 - -# -# General setup -# -CONFIG_LOCALVERSION="" -CONFIG_LOCALVERSION_AUTO=y -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_POSIX_MQUEUE is not set -CONFIG_BSD_PROCESS_ACCT=y -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -CONFIG_SYSCTL=y -# CONFIG_AUDIT is not set -CONFIG_HOTPLUG=y -CONFIG_KOBJECT_UEVENT=y -# CONFIG_IKCONFIG is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_EMBEDDED=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -# CONFIG_KALLSYMS_EXTRA_PASS is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 -# CONFIG_TINY_SHMEM is not set -CONFIG_BASE_SMALL=0 - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_OBSOLETE_MODPARM=y -CONFIG_MODVERSIONS=y -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_KMOD=y - -# -# System Type -# -# CONFIG_ARCH_CLPS7500 is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_CO285 is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_CAMELOT is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_IOP3XX is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_IXP2000 is not set -# CONFIG_ARCH_L7200 is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_RPC is not set -CONFIG_ARCH_SA1100=y -# CONFIG_ARCH_S3C2410 is not set -# CONFIG_ARCH_SHARK is not set -# CONFIG_ARCH_LH7A40X is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_IMX is not set -# CONFIG_ARCH_H720X is not set -# CONFIG_ARCH_AAEC2000 is not set - -# -# SA11x0 Implementations -# -# CONFIG_SA1100_ASSABET is not set -# CONFIG_SA1100_CERF is not set -CONFIG_SA1100_COLLIE=y -# CONFIG_SA1100_H3100 is not set -# CONFIG_SA1100_H3600 is not set -# CONFIG_SA1100_H3800 is not set -# CONFIG_SA1100_BADGE4 is not set -# CONFIG_SA1100_JORNADA720 is not set -# CONFIG_SA1100_HACKKIT is not set -# CONFIG_SA1100_LART is not set -# CONFIG_SA1100_PLEB is not set -# CONFIG_SA1100_SHANNON is not set -# CONFIG_SA1100_SIMPAD is not set -# CONFIG_SA1100_SSP is not set - -# -# Processor Type -# -CONFIG_CPU_32=y -CONFIG_CPU_SA1100=y -CONFIG_CPU_32v4=y -CONFIG_CPU_ABRT_EV4=y -CONFIG_CPU_CACHE_V4WB=y -CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_TLB_V4WB=y - -# -# Processor Features -# -CONFIG_SHARP_LOCOMO=y -CONFIG_SHARP_PARAM=y -CONFIG_SHARP_SCOOP=y - -# -# Bus support -# -CONFIG_ISA=y -CONFIG_ISA_DMA_API=y - -# -# PCCARD (PCMCIA/CardBus) support -# -# CONFIG_PCCARD is not set - -# -# Kernel Features -# -# CONFIG_SMP is not set -CONFIG_PREEMPT=y -# CONFIG_NO_IDLE_HZ is not set -CONFIG_ARCH_DISCONTIGMEM_ENABLE=y -CONFIG_SELECT_MEMORY_MODEL=y -# CONFIG_FLATMEM_MANUAL is not set -CONFIG_DISCONTIGMEM_MANUAL=y -# CONFIG_SPARSEMEM_MANUAL is not set -CONFIG_DISCONTIGMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -CONFIG_NEED_MULTIPLE_NODES=y -# CONFIG_SPARSEMEM_STATIC is not set -# CONFIG_LEDS is not set -CONFIG_ALIGNMENT_TRAP=y - -# -# Boot options -# -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug" -# CONFIG_XIP_KERNEL is not set - -# -# CPU Frequency scaling -# -# CONFIG_CPU_FREQ is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -CONFIG_FPE_NWFPE=y -# CONFIG_FPE_NWFPE_XP is not set -# CONFIG_FPE_FASTFPE is not set - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_BINFMT_AOUT=m -CONFIG_BINFMT_MISC=m -# CONFIG_ARTHUR is not set - -# -# Power management options -# -CONFIG_PM=y -CONFIG_APM=y - -# -# Networking -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -CONFIG_PACKET_MMAP=y -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -# CONFIG_IP_MULTICAST is not set -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_FIB_HASH=y -# CONFIG_IP_PNP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_TUNNEL is not set -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_BIC=y -# CONFIG_IPV6 is not set -# CONFIG_NETFILTER is not set - -# -# DCCP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_DCCP is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_BRIDGE is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_DECNET is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_SCHED is not set -# CONFIG_NET_CLS_ROUTE is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -# CONFIG_IRDA is not set -# CONFIG_BT is not set -# CONFIG_IEEE80211 is not set - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=m -# CONFIG_DEBUG_DRIVER is not set - -# -# Memory Technology Devices (MTD) -# -CONFIG_MTD=y -# CONFIG_MTD_DEBUG is not set -# CONFIG_MTD_CONCAT is not set -CONFIG_MTD_PARTITIONS=y -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_CMDLINE_PARTS is not set -# CONFIG_MTD_AFS_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_CHAR=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set - -# -# RAM/ROM/Flash chip drivers -# -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set -CONFIG_MTD_OBSOLETE_CHIPS=y -# CONFIG_MTD_AMDSTD is not set -CONFIG_MTD_SHARP=y -# CONFIG_MTD_JEDEC is not set - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLKMTD is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOC2001PLUS is not set - -# -# NAND Flash Device Drivers -# -# CONFIG_MTD_NAND is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Plug and Play support -# -# CONFIG_PNP is not set - -# -# Block devices -# -# CONFIG_BLK_DEV_XD is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_NBD is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=1024 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_CDROM_PKTCDVD is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -CONFIG_ATA_OVER_ETH=m - -# -# ATA/ATAPI/MFM/RLL support -# -# CONFIG_IDE is not set - -# -# SCSI device support -# -# CONFIG_RAID_ATTRS is not set -# CONFIG_SCSI is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# Fusion MPT device support -# -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_IEEE1394 is not set - -# -# I2O device support -# - -# -# Network device support -# -# CONFIG_NETDEVICES is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set -CONFIG_INPUT_TSDEV=y -CONFIG_INPUT_TSDEV_SCREEN_X=240 -CONFIG_INPUT_TSDEV_SCREEN_Y=320 -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_EVBUG=y - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_LKKBD is not set -CONFIG_KEYBOARD_LOCOMO=y -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_MISC is not set - -# -# Hardware I/O ports -# -CONFIG_SERIO=y -# CONFIG_SERIO_SERPORT is not set -# CONFIG_SERIO_LIBPS2 is not set -# CONFIG_SERIO_RAW is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -# CONFIG_SERIAL_8250 is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_SA1100=y -CONFIG_SERIAL_SA1100_CONSOLE=y -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -# CONFIG_RTC is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_RAW_DRIVER is not set - -# -# TPM devices -# - -# -# I2C support -# -CONFIG_I2C=m -# CONFIG_I2C_CHARDEV is not set - -# -# I2C Algorithms -# -CONFIG_I2C_ALGOBIT=m -# CONFIG_I2C_ALGOPCF is not set -# CONFIG_I2C_ALGOPCA is not set - -# -# I2C Hardware Bus support -# -# CONFIG_I2C_ELEKTOR is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_PCA_ISA is not set - -# -# Miscellaneous I2C Chip support -# -# CONFIG_SENSORS_DS1337 is not set -# CONFIG_SENSORS_DS1374 is not set -# CONFIG_SENSORS_EEPROM is not set -# CONFIG_SENSORS_PCF8574 is not set -# CONFIG_SENSORS_PCA9539 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set -# CONFIG_SENSORS_MAX6875 is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CHIP is not set - -# -# Hardware Monitoring support -# -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_FSCHER is not set -# CONFIG_SENSORS_FSCPOS is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Misc devices -# - -# -# Multimedia Capabilities Port drivers -# -# CONFIG_MCP_SA11X0 is not set - -# -# Multimedia devices -# -CONFIG_VIDEO_DEV=m - -# -# Video For Linux -# - -# -# Video Adapters -# -# CONFIG_VIDEO_PMS is not set -# CONFIG_VIDEO_CPIA is not set -# CONFIG_VIDEO_SAA5246A is not set -# CONFIG_VIDEO_SAA5249 is not set -# CONFIG_TUNER_3036 is not set -# CONFIG_VIDEO_OVCAMCHIP is not set - -# -# Radio Adapters -# -# CONFIG_RADIO_CADET is not set -# CONFIG_RADIO_RTRACK is not set -# CONFIG_RADIO_RTRACK2 is not set -# CONFIG_RADIO_AZTECH is not set -# CONFIG_RADIO_GEMTEK is not set -# CONFIG_RADIO_MAESTRO is not set -# CONFIG_RADIO_SF16FMI is not set -# CONFIG_RADIO_SF16FMR2 is not set -# CONFIG_RADIO_TERRATEC is not set -# CONFIG_RADIO_TRUST is not set -# CONFIG_RADIO_TYPHOON is not set -# CONFIG_RADIO_ZOLTRIX is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# Graphics support -# -CONFIG_FB=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_SOFT_CURSOR=y -# CONFIG_FB_MACMODES is not set -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_TILEBLITTING is not set -CONFIG_FB_SA1100=y -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_VIRTUAL is not set - -# -# Console display driver support -# -# CONFIG_VGA_CONSOLE is not set -# CONFIG_MDA_CONSOLE is not set -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FONTS=y -CONFIG_FONT_8x8=y -# CONFIG_FONT_8x16 is not set -# CONFIG_FONT_6x11 is not set -# CONFIG_FONT_7x14 is not set -# CONFIG_FONT_PEARL_8x8 is not set -# CONFIG_FONT_ACORN_8x8 is not set -# CONFIG_FONT_MINI_4x6 is not set -# CONFIG_FONT_SUN8x16 is not set -# CONFIG_FONT_SUN12x22 is not set -# CONFIG_FONT_10x18 is not set - -# -# Logo configuration -# -# CONFIG_LOGO is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# USB support -# -CONFIG_USB_ARCH_HAS_HCD=y -# CONFIG_USB_ARCH_HAS_OHCI is not set -# CONFIG_USB is not set - -# -# USB Gadget Support -# -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG_FILES is not set -# CONFIG_USB_GADGET_NET2280 is not set -# CONFIG_USB_GADGET_PXA2XX is not set -# CONFIG_USB_GADGET_GOKU is not set -# CONFIG_USB_GADGET_LH7A40X is not set -# CONFIG_USB_GADGET_OMAP is not set -# CONFIG_USB_GADGET_DUMMY_HCD is not set -# CONFIG_USB_GADGET_DUALSPEED is not set - -# -# MMC/SD Card support -# -# CONFIG_MMC is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -# CONFIG_EXT2_FS_XIP is not set -# CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -CONFIG_FS_POSIX_ACL=y -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -CONFIG_ROMFS_FS=y -CONFIG_INOTIFY=y -# CONFIG_QUOTA is not set -# CONFIG_DNOTIFY is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_FUSE_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -CONFIG_MSDOS_FS=y -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -# CONFIG_HUGETLBFS is not set -# CONFIG_HUGETLB_PAGE is not set -CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS_FS is not set -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_WRITEBUFFER=y -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set -CONFIG_JFFS2_ZLIB=y -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_CRAMFS=y -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -# CONFIG_NFS_FS is not set -# CONFIG_NFSD is not set -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_9P_FS is not set - -# -# Partition Types -# -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y - -# -# Native Language Support -# -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="cp437" -CONFIG_NLS_CODEPAGE_437=m -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ASCII is not set -CONFIG_NLS_ISO8859_1=m -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -CONFIG_NLS_UTF8=m - -# -# Profiling support -# -# CONFIG_PROFILING is not set - -# -# Kernel hacking -# -# CONFIG_PRINTK_TIME is not set -CONFIG_DEBUG_KERNEL=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_DETECT_SOFTLOCKUP=y -# CONFIG_SCHEDSTATS is not set -# CONFIG_DEBUG_SLAB is not set -CONFIG_DEBUG_PREEMPT=y -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_SPINLOCK_SLEEP is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_FS is not set -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_USER is not set -# CONFIG_DEBUG_WAITQ is not set -CONFIG_DEBUG_ERRORS=y -# CONFIG_DEBUG_LL is not set - -# -# Security options -# -# CONFIG_KEYS is not set -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -# CONFIG_CRYPTO is not set - -# -# Hardware crypto devices -# - -# -# Library routines -# -# CONFIG_CRC_CCITT is not set -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -# CONFIG_LIBCRC32C is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y diff --git a/trunk/arch/arm/configs/corgi_defconfig b/trunk/arch/arm/configs/corgi_defconfig deleted file mode 100644 index 24987c89609a..000000000000 --- a/trunk/arch/arm/configs/corgi_defconfig +++ /dev/null @@ -1,1523 +0,0 @@ -# -# Automatically generated make config: don't edit -# Linux kernel version: 2.6.14-rc3 -# Sun Oct 9 15:46:42 2005 -# -CONFIG_ARM=y -CONFIG_MMU=y -CONFIG_UID16=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_CALIBRATE_DELAY=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y -CONFIG_BROKEN_ON_SMP=y -CONFIG_LOCK_KERNEL=y -CONFIG_INIT_ENV_ARG_LIMIT=32 - -# -# General setup -# -CONFIG_LOCALVERSION="" -CONFIG_LOCALVERSION_AUTO=y -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_POSIX_MQUEUE is not set -CONFIG_BSD_PROCESS_ACCT=y -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -CONFIG_SYSCTL=y -# CONFIG_AUDIT is not set -CONFIG_HOTPLUG=y -CONFIG_KOBJECT_UEVENT=y -# CONFIG_IKCONFIG is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_EMBEDDED=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -# CONFIG_KALLSYMS_EXTRA_PASS is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 -# CONFIG_TINY_SHMEM is not set -CONFIG_BASE_SMALL=0 - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_KMOD=y - -# -# System Type -# -# CONFIG_ARCH_CLPS7500 is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_CO285 is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_CAMELOT is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_IOP3XX is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_IXP2000 is not set -# CONFIG_ARCH_L7200 is not set -CONFIG_ARCH_PXA=y -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_S3C2410 is not set -# CONFIG_ARCH_SHARK is not set -# CONFIG_ARCH_LH7A40X is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_IMX is not set -# CONFIG_ARCH_H720X is not set -# CONFIG_ARCH_AAEC2000 is not set - -# -# Intel PXA2xx Implementations -# -# CONFIG_ARCH_LUBBOCK is not set -# CONFIG_MACH_MAINSTONE is not set -# CONFIG_ARCH_PXA_IDP is not set -CONFIG_PXA_SHARPSL=y -CONFIG_PXA_SHARPSL_25x=y -# CONFIG_PXA_SHARPSL_27x is not set -# CONFIG_MACH_POODLE is not set -CONFIG_MACH_CORGI=y -CONFIG_MACH_SHEPHERD=y -CONFIG_MACH_HUSKY=y -CONFIG_PXA25x=y -CONFIG_PXA_SHARP_C7xx=y - -# -# Processor Type -# -CONFIG_CPU_32=y -CONFIG_CPU_XSCALE=y -CONFIG_CPU_32v5=y -CONFIG_CPU_ABRT_EV5T=y -CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_TLB_V4WBI=y - -# -# Processor Features -# -CONFIG_ARM_THUMB=y -CONFIG_XSCALE_PMU=y -CONFIG_SHARP_PARAM=y -CONFIG_SHARP_SCOOP=y - -# -# Bus support -# -CONFIG_ISA_DMA_API=y - -# -# PCCARD (PCMCIA/CardBus) support -# -CONFIG_PCCARD=y -# CONFIG_PCMCIA_DEBUG is not set -CONFIG_PCMCIA=y -CONFIG_PCMCIA_LOAD_CIS=y -CONFIG_PCMCIA_IOCTL=y - -# -# PC-card bridges -# -CONFIG_PCMCIA_PXA2XX=y - -# -# Kernel Features -# -CONFIG_PREEMPT=y -# CONFIG_NO_IDLE_HZ is not set -# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_FLATMEM_MANUAL=y -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_SPARSEMEM_MANUAL is not set -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_SPARSEMEM_STATIC is not set -CONFIG_ALIGNMENT_TRAP=y - -# -# Boot options -# -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug" -# CONFIG_XIP_KERNEL is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -CONFIG_FPE_NWFPE=y -# CONFIG_FPE_NWFPE_XP is not set -# CONFIG_FPE_FASTFPE is not set - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_BINFMT_AOUT=m -CONFIG_BINFMT_MISC=m -# CONFIG_ARTHUR is not set - -# -# Power management options -# -CONFIG_PM=y -CONFIG_APM=y - -# -# Networking -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -CONFIG_PACKET_MMAP=y -CONFIG_UNIX=y -CONFIG_XFRM=y -CONFIG_XFRM_USER=m -# CONFIG_NET_KEY is not set -CONFIG_INET=y -# CONFIG_IP_MULTICAST is not set -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_FIB_HASH=y -# CONFIG_IP_PNP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_TUNNEL is not set -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_BIC=y - -# -# IP: Virtual Server Configuration -# -# CONFIG_IP_VS is not set -CONFIG_IPV6=m -# CONFIG_IPV6_PRIVACY is not set -CONFIG_INET6_AH=m -CONFIG_INET6_ESP=m -CONFIG_INET6_IPCOMP=m -CONFIG_INET6_TUNNEL=m -CONFIG_IPV6_TUNNEL=m -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_NETFILTER_NETLINK is not set - -# -# IP: Netfilter Configuration -# -CONFIG_IP_NF_CONNTRACK=m -# CONFIG_IP_NF_CT_ACCT is not set -# CONFIG_IP_NF_CONNTRACK_MARK is not set -# CONFIG_IP_NF_CONNTRACK_EVENTS is not set -CONFIG_IP_NF_CT_PROTO_SCTP=m -CONFIG_IP_NF_FTP=m -CONFIG_IP_NF_IRC=m -# CONFIG_IP_NF_NETBIOS_NS is not set -CONFIG_IP_NF_TFTP=m -CONFIG_IP_NF_AMANDA=m -# CONFIG_IP_NF_PPTP is not set -CONFIG_IP_NF_QUEUE=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_LIMIT=m -CONFIG_IP_NF_MATCH_IPRANGE=m -CONFIG_IP_NF_MATCH_MAC=m -CONFIG_IP_NF_MATCH_PKTTYPE=m -CONFIG_IP_NF_MATCH_MARK=m -CONFIG_IP_NF_MATCH_MULTIPORT=m -CONFIG_IP_NF_MATCH_TOS=m -CONFIG_IP_NF_MATCH_RECENT=m -CONFIG_IP_NF_MATCH_ECN=m -CONFIG_IP_NF_MATCH_DSCP=m -CONFIG_IP_NF_MATCH_AH_ESP=m -CONFIG_IP_NF_MATCH_LENGTH=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_MATCH_TCPMSS=m -CONFIG_IP_NF_MATCH_HELPER=m -CONFIG_IP_NF_MATCH_STATE=m -CONFIG_IP_NF_MATCH_CONNTRACK=m -CONFIG_IP_NF_MATCH_OWNER=m -CONFIG_IP_NF_MATCH_ADDRTYPE=m -CONFIG_IP_NF_MATCH_REALM=m -CONFIG_IP_NF_MATCH_SCTP=m -# CONFIG_IP_NF_MATCH_DCCP is not set -CONFIG_IP_NF_MATCH_COMMENT=m -CONFIG_IP_NF_MATCH_HASHLIMIT=m -# CONFIG_IP_NF_MATCH_STRING is not set -CONFIG_IP_NF_FILTER=m -# CONFIG_IP_NF_TARGET_REJECT is not set -CONFIG_IP_NF_TARGET_LOG=m -CONFIG_IP_NF_TARGET_ULOG=m -CONFIG_IP_NF_TARGET_TCPMSS=m -# CONFIG_IP_NF_TARGET_NFQUEUE is not set -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_NAT_NEEDED=y -# CONFIG_IP_NF_TARGET_MASQUERADE is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_SAME is not set -# CONFIG_IP_NF_NAT_SNMP_BASIC is not set -CONFIG_IP_NF_NAT_IRC=m -CONFIG_IP_NF_NAT_FTP=m -CONFIG_IP_NF_NAT_TFTP=m -CONFIG_IP_NF_NAT_AMANDA=m -CONFIG_IP_NF_MANGLE=m -# CONFIG_IP_NF_TARGET_TOS is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_DSCP is not set -# CONFIG_IP_NF_TARGET_MARK is not set -# CONFIG_IP_NF_TARGET_CLASSIFY is not set -# CONFIG_IP_NF_TARGET_TTL is not set -CONFIG_IP_NF_RAW=m -# CONFIG_IP_NF_TARGET_NOTRACK is not set -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARP_MANGLE=m - -# -# IPv6: Netfilter Configuration (EXPERIMENTAL) -# -CONFIG_IP6_NF_QUEUE=m -CONFIG_IP6_NF_IPTABLES=m -CONFIG_IP6_NF_MATCH_LIMIT=m -CONFIG_IP6_NF_MATCH_MAC=m -CONFIG_IP6_NF_MATCH_RT=m -CONFIG_IP6_NF_MATCH_OPTS=m -CONFIG_IP6_NF_MATCH_FRAG=m -CONFIG_IP6_NF_MATCH_HL=m -CONFIG_IP6_NF_MATCH_MULTIPORT=m -CONFIG_IP6_NF_MATCH_OWNER=m -CONFIG_IP6_NF_MATCH_MARK=m -CONFIG_IP6_NF_MATCH_IPV6HEADER=m -CONFIG_IP6_NF_MATCH_AHESP=m -CONFIG_IP6_NF_MATCH_LENGTH=m -CONFIG_IP6_NF_MATCH_EUI64=m -CONFIG_IP6_NF_FILTER=m -# CONFIG_IP6_NF_TARGET_LOG is not set -# CONFIG_IP6_NF_TARGET_REJECT is not set -# CONFIG_IP6_NF_TARGET_NFQUEUE is not set -CONFIG_IP6_NF_MANGLE=m -# CONFIG_IP6_NF_TARGET_MARK is not set -# CONFIG_IP6_NF_TARGET_HL is not set -CONFIG_IP6_NF_RAW=m - -# -# DCCP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_DCCP is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_BRIDGE is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_DECNET is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_SCHED is not set -CONFIG_NET_CLS_ROUTE=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -CONFIG_IRDA=m - -# -# IrDA protocols -# -CONFIG_IRLAN=m -CONFIG_IRNET=m -CONFIG_IRCOMM=m -# CONFIG_IRDA_ULTRA is not set - -# -# IrDA options -# -# CONFIG_IRDA_CACHE_LAST_LSAP is not set -# CONFIG_IRDA_FAST_RR is not set -# CONFIG_IRDA_DEBUG is not set - -# -# Infrared-port device drivers -# - -# -# SIR device drivers -# -# CONFIG_IRTTY_SIR is not set - -# -# Dongle support -# - -# -# Old SIR device drivers -# -# CONFIG_IRPORT_SIR is not set - -# -# Old Serial dongle support -# - -# -# FIR device drivers -# -# CONFIG_USB_IRDA is not set -# CONFIG_SIGMATEL_FIR is not set -# CONFIG_NSC_FIR is not set -# CONFIG_WINBOND_FIR is not set -# CONFIG_SMC_IRCC_FIR is not set -# CONFIG_ALI_FIR is not set -# CONFIG_VIA_FIR is not set -CONFIG_BT=m -CONFIG_BT_L2CAP=m -CONFIG_BT_SCO=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=m -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_HIDP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIUSB=m -# CONFIG_BT_HCIUSB_SCO is not set -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_BCSP_TXCRC=y -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBPA10X=m -CONFIG_BT_HCIBFUSB=m -CONFIG_BT_HCIDTL1=m -CONFIG_BT_HCIBT3C=m -CONFIG_BT_HCIBLUECARD=m -CONFIG_BT_HCIBTUART=m -CONFIG_BT_HCIVHCI=m -CONFIG_IEEE80211=m -# CONFIG_IEEE80211_DEBUG is not set -CONFIG_IEEE80211_CRYPT_WEP=m -# CONFIG_IEEE80211_CRYPT_CCMP is not set -# CONFIG_IEEE80211_CRYPT_TKIP is not set - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -# CONFIG_DEBUG_DRIVER is not set - -# -# Memory Technology Devices (MTD) -# -CONFIG_MTD=y -# CONFIG_MTD_DEBUG is not set -# CONFIG_MTD_CONCAT is not set -CONFIG_MTD_PARTITIONS=y -# CONFIG_MTD_REDBOOT_PARTS is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_AFS_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_CHAR=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set - -# -# RAM/ROM/Flash chip drivers -# -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -# CONFIG_MTD_RAM is not set -CONFIG_MTD_ROM=y -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -CONFIG_MTD_COMPLEX_MAPPINGS=y -CONFIG_MTD_SHARP_SL=y -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLKMTD is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOC2001PLUS is not set - -# -# NAND Flash Device Drivers -# -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_VERIFY_WRITE=y -# CONFIG_MTD_NAND_H1900 is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_DISKONCHIP is not set -CONFIG_MTD_NAND_SHARPSL=y -# CONFIG_MTD_NAND_NANDSIM is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Plug and Play support -# - -# -# Block devices -# -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_UB is not set -# CONFIG_BLK_DEV_RAM is not set -CONFIG_BLK_DEV_RAM_COUNT=16 -# CONFIG_CDROM_PKTCDVD is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_ATA_OVER_ETH is not set - -# -# ATA/ATAPI/MFM/RLL support -# -CONFIG_IDE=y -CONFIG_BLK_DEV_IDE=y - -# -# Please see Documentation/ide.txt for help/info on IDE drives -# -# CONFIG_BLK_DEV_IDE_SATA is not set -CONFIG_BLK_DEV_IDEDISK=y -# CONFIG_IDEDISK_MULTI_MODE is not set -CONFIG_BLK_DEV_IDECS=y -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set -# CONFIG_BLK_DEV_IDESCSI is not set -# CONFIG_IDE_TASK_IOCTL is not set - -# -# IDE chipset support/bugfixes -# -CONFIG_IDE_GENERIC=y -# CONFIG_IDE_ARM is not set -# CONFIG_BLK_DEV_IDEDMA is not set -# CONFIG_IDEDMA_AUTO is not set -# CONFIG_BLK_DEV_HD is not set - -# -# SCSI device support -# -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=m -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=m -CONFIG_CHR_DEV_ST=m -CONFIG_CHR_DEV_OSST=m -CONFIG_BLK_DEV_SR=m -# CONFIG_BLK_DEV_SR_VENDOR is not set -CONFIG_CHR_DEV_SG=m -# CONFIG_CHR_DEV_SCH is not set - -# -# Some SCSI devices (e.g. CD jukebox) support multiple LUNs -# -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set - -# -# SCSI Transport Attributes -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_SAS_ATTRS is not set - -# -# SCSI low-level drivers -# -# CONFIG_SCSI_SATA is not set -# CONFIG_SCSI_DEBUG is not set - -# -# PCMCIA SCSI adapter support -# -# CONFIG_PCMCIA_AHA152X is not set -# CONFIG_PCMCIA_FDOMAIN is not set -# CONFIG_PCMCIA_NINJA_SCSI is not set -# CONFIG_PCMCIA_QLOGIC is not set -# CONFIG_PCMCIA_SYM53C500 is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# Fusion MPT device support -# -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# - -# -# I2O device support -# - -# -# Network device support -# -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set - -# -# PHY device support -# -# CONFIG_PHYLIB is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -CONFIG_MII=m -# CONFIG_SMC91X is not set -# CONFIG_DM9000 is not set - -# -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# - -# -# Token Ring devices -# - -# -# Wireless LAN (non-hamradio) -# -CONFIG_NET_RADIO=y - -# -# Obsolete Wireless cards support (pre-802.11) -# -# CONFIG_STRIP is not set -# CONFIG_PCMCIA_WAVELAN is not set -# CONFIG_PCMCIA_NETWAVE is not set - -# -# Wireless 802.11 Frequency Hopping cards support -# -# CONFIG_PCMCIA_RAYCS is not set - -# -# Wireless 802.11b ISA/PCI cards support -# -CONFIG_HERMES=m -# CONFIG_ATMEL is not set - -# -# Wireless 802.11b Pcmcia/Cardbus cards support -# -CONFIG_PCMCIA_HERMES=m -CONFIG_PCMCIA_SPECTRUM=m -# CONFIG_AIRO_CS is not set -# CONFIG_PCMCIA_WL3501 is not set -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y -CONFIG_HOSTAP_CS=m -CONFIG_NET_WIRELESS=y - -# -# PCMCIA network device support -# -CONFIG_NET_PCMCIA=y -# CONFIG_PCMCIA_3C589 is not set -# CONFIG_PCMCIA_3C574 is not set -# CONFIG_PCMCIA_FMVJ18X is not set -CONFIG_PCMCIA_PCNET=m -# CONFIG_PCMCIA_NMCLAN is not set -# CONFIG_PCMCIA_SMC91C92 is not set -# CONFIG_PCMCIA_XIRC2PS is not set -# CONFIG_PCMCIA_AXNET is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set -CONFIG_PPP=m -# CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPP_DEFLATE is not set -CONFIG_PPP_BSDCOMP=m -# CONFIG_PPPOE is not set -# CONFIG_SLIP is not set -# CONFIG_SHAPER is not set -# CONFIG_NETCONSOLE is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_TSDEV is not set -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -CONFIG_KEYBOARD_CORGI=y -CONFIG_KEYBOARD_SPITZ=y -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_JOYSTICK is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_CORGI=y -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -CONFIG_INPUT_MISC=y -CONFIG_INPUT_UINPUT=m - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -CONFIG_SERIAL_8250=m -CONFIG_SERIAL_8250_CS=m -CONFIG_SERIAL_8250_NR_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_PXA=y -CONFIG_SERIAL_PXA_CONSOLE=y -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -# CONFIG_RTC is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set - -# -# Ftape, the floppy tape device driver -# - -# -# PCMCIA character devices -# -# CONFIG_SYNCLINK_CS is not set -# CONFIG_RAW_DRIVER is not set - -# -# TPM devices -# - -# -# I2C support -# -CONFIG_I2C=y -# CONFIG_I2C_CHARDEV is not set - -# -# I2C Algorithms -# -CONFIG_I2C_ALGOBIT=y -# CONFIG_I2C_ALGOPCF is not set -# CONFIG_I2C_ALGOPCA is not set - -# -# I2C Hardware Bus support -# -CONFIG_I2C_PXA=y -# CONFIG_I2C_PXA_SLAVE is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_PCA_ISA is not set - -# -# Miscellaneous I2C Chip support -# -# CONFIG_SENSORS_DS1337 is not set -# CONFIG_SENSORS_DS1374 is not set -# CONFIG_SENSORS_EEPROM is not set -# CONFIG_SENSORS_PCF8574 is not set -# CONFIG_SENSORS_PCA9539 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set -# CONFIG_SENSORS_MAX6875 is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CHIP is not set - -# -# Hardware Monitoring support -# -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_FSCHER is not set -# CONFIG_SENSORS_FSCPOS is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Misc devices -# - -# -# Multimedia Capabilities Port drivers -# - -# -# Multimedia devices -# -CONFIG_VIDEO_DEV=m - -# -# Video For Linux -# - -# -# Video Adapters -# -# CONFIG_VIDEO_CPIA is not set -# CONFIG_VIDEO_SAA5246A is not set -# CONFIG_VIDEO_SAA5249 is not set -# CONFIG_TUNER_3036 is not set -# CONFIG_VIDEO_OVCAMCHIP is not set - -# -# Radio Adapters -# -# CONFIG_RADIO_MAESTRO is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# Graphics support -# -CONFIG_FB=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_SOFT_CURSOR=y -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set -# CONFIG_FB_PXA is not set -CONFIG_FB_W100=y -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_VIRTUAL is not set - -# -# Console display driver support -# -# CONFIG_VGA_CONSOLE is not set -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FONTS=y -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -# CONFIG_FONT_6x11 is not set -# CONFIG_FONT_7x14 is not set -# CONFIG_FONT_PEARL_8x8 is not set -# CONFIG_FONT_ACORN_8x8 is not set -# CONFIG_FONT_MINI_4x6 is not set -# CONFIG_FONT_SUN8x16 is not set -# CONFIG_FONT_SUN12x22 is not set -# CONFIG_FONT_10x18 is not set - -# -# Logo configuration -# -# CONFIG_LOGO is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_DEVICE=y -# CONFIG_LCD_CLASS_DEVICE is not set -CONFIG_BACKLIGHT_CORGI=y - -# -# Sound -# -CONFIG_SOUND=y - -# -# Advanced Linux Sound Architecture -# -# CONFIG_SND is not set - -# -# Open Sound System -# -CONFIG_SOUND_PRIME=y -# CONFIG_SOUND_MSNDCLAS is not set -# CONFIG_SOUND_MSNDPIN is not set -CONFIG_SOUND_OSS=y -# CONFIG_SOUND_TRACEINIT is not set -# CONFIG_SOUND_DMAP is not set -# CONFIG_SOUND_AD1816 is not set -# CONFIG_SOUND_SGALAXY is not set -# CONFIG_SOUND_ADLIB is not set -# CONFIG_SOUND_ACI_MIXER is not set -# CONFIG_SOUND_CS4232 is not set -# CONFIG_SOUND_SSCAPE is not set -# CONFIG_SOUND_GUS is not set -# CONFIG_SOUND_VMIDI is not set -# CONFIG_SOUND_TRIX is not set -# CONFIG_SOUND_MSS is not set -# CONFIG_SOUND_MPU401 is not set -# CONFIG_SOUND_NM256 is not set -# CONFIG_SOUND_MAD16 is not set -# CONFIG_SOUND_PAS is not set -# CONFIG_SOUND_PSS is not set -# CONFIG_SOUND_SB is not set -# CONFIG_SOUND_AWE32_SYNTH is not set -# CONFIG_SOUND_WAVEFRONT is not set -# CONFIG_SOUND_MAUI is not set -# CONFIG_SOUND_YM3812 is not set -# CONFIG_SOUND_OPL3SA1 is not set -# CONFIG_SOUND_OPL3SA2 is not set -# CONFIG_SOUND_UART6850 is not set -# CONFIG_SOUND_AEDSP16 is not set -# CONFIG_SOUND_TVMIXER is not set -# CONFIG_SOUND_AD1980 is not set - -# -# USB support -# -CONFIG_USB_ARCH_HAS_HCD=y -# CONFIG_USB_ARCH_HAS_OHCI is not set -CONFIG_USB=m -# CONFIG_USB_DEBUG is not set - -# -# Miscellaneous USB options -# -CONFIG_USB_DEVICEFS=y -# CONFIG_USB_BANDWIDTH is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_SUSPEND is not set -# CONFIG_USB_OTG is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_ISP116X_HCD is not set -CONFIG_USB_SL811_HCD=m -CONFIG_USB_SL811_CS=m - -# -# USB Device Class drivers -# -# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set - -# -# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem -# -CONFIG_USB_ACM=m -CONFIG_USB_PRINTER=m - -# -# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information -# -CONFIG_USB_STORAGE=m -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_DPCM is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set - -# -# USB Input Devices -# -CONFIG_USB_HID=m -CONFIG_USB_HIDINPUT=y -# CONFIG_HID_FF is not set -# CONFIG_USB_HIDDEV is not set - -# -# USB HID Boot Protocol drivers -# -CONFIG_USB_KBD=m -CONFIG_USB_MOUSE=m -CONFIG_USB_AIPTEK=m -CONFIG_USB_WACOM=m -# CONFIG_USB_ACECAD is not set -CONFIG_USB_KBTAB=m -CONFIG_USB_POWERMATE=m -CONFIG_USB_MTOUCH=m -# CONFIG_USB_ITMTOUCH is not set -CONFIG_USB_EGALAX=m -# CONFIG_USB_YEALINK is not set -CONFIG_USB_XPAD=m -CONFIG_USB_ATI_REMOTE=m -# CONFIG_USB_KEYSPAN_REMOTE is not set -# CONFIG_USB_APPLETOUCH is not set - -# -# USB Imaging devices -# -CONFIG_USB_MDC800=m -CONFIG_USB_MICROTEK=m - -# -# USB Multimedia devices -# -CONFIG_USB_DABUSB=m -CONFIG_USB_VICAM=m -CONFIG_USB_DSBR=m -CONFIG_USB_IBMCAM=m -CONFIG_USB_KONICAWC=m -CONFIG_USB_OV511=m -CONFIG_USB_SE401=m -CONFIG_USB_SN9C102=m -CONFIG_USB_STV680=m -# CONFIG_USB_PWC is not set - -# -# USB Network Adapters -# -CONFIG_USB_CATC=m -CONFIG_USB_KAWETH=m -CONFIG_USB_PEGASUS=m -CONFIG_USB_RTL8150=m -CONFIG_USB_USBNET=m -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_GL620A is not set -CONFIG_USB_NET_NET1080=m -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_RNDIS_HOST is not set -# CONFIG_USB_NET_CDC_SUBSET is not set -CONFIG_USB_NET_ZAURUS=m -# CONFIG_USB_ZD1201 is not set -CONFIG_USB_MON=y - -# -# USB port drivers -# - -# -# USB Serial Converter support -# -CONFIG_USB_SERIAL=m -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_AIRPRIME is not set -CONFIG_USB_SERIAL_BELKIN=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -# CONFIG_USB_SERIAL_CP2101 is not set -CONFIG_USB_SERIAL_CYPRESS_M8=m -CONFIG_USB_SERIAL_EMPEG=m -CONFIG_USB_SERIAL_FTDI_SIO=m -CONFIG_USB_SERIAL_VISOR=m -CONFIG_USB_SERIAL_IPAQ=m -CONFIG_USB_SERIAL_IR=m -CONFIG_USB_SERIAL_EDGEPORT=m -CONFIG_USB_SERIAL_EDGEPORT_TI=m -CONFIG_USB_SERIAL_GARMIN=m -CONFIG_USB_SERIAL_IPW=m -CONFIG_USB_SERIAL_KEYSPAN_PDA=m -CONFIG_USB_SERIAL_KEYSPAN=m -# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set -CONFIG_USB_SERIAL_KLSI=m -CONFIG_USB_SERIAL_KOBIL_SCT=m -CONFIG_USB_SERIAL_MCT_U232=m -CONFIG_USB_SERIAL_PL2303=m -# CONFIG_USB_SERIAL_HP4X is not set -CONFIG_USB_SERIAL_SAFE=m -# CONFIG_USB_SERIAL_SAFE_PADDED is not set -CONFIG_USB_SERIAL_TI=m -CONFIG_USB_SERIAL_CYBERJACK=m -CONFIG_USB_SERIAL_XIRCOM=m -CONFIG_USB_SERIAL_OMNINET=m -CONFIG_USB_EZUSB=y - -# -# USB Miscellaneous drivers -# -CONFIG_USB_EMI62=m -CONFIG_USB_EMI26=m -CONFIG_USB_AUERSWALD=m -CONFIG_USB_RIO500=m -CONFIG_USB_LEGOTOWER=m -CONFIG_USB_LCD=m -CONFIG_USB_LED=m -CONFIG_USB_CYTHERM=m -CONFIG_USB_PHIDGETKIT=m -CONFIG_USB_PHIDGETSERVO=m -CONFIG_USB_IDMOUSE=m -# CONFIG_USB_LD is not set -# CONFIG_USB_TEST is not set - -# -# USB DSL modem support -# - -# -# USB Gadget Support -# -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG_FILES is not set -CONFIG_USB_GADGET_SELECTED=y -# CONFIG_USB_GADGET_NET2280 is not set -CONFIG_USB_GADGET_PXA2XX=y -CONFIG_USB_PXA2XX=y -# CONFIG_USB_PXA2XX_SMALL is not set -# CONFIG_USB_GADGET_GOKU is not set -# CONFIG_USB_GADGET_LH7A40X is not set -# CONFIG_USB_GADGET_OMAP is not set -# CONFIG_USB_GADGET_DUMMY_HCD is not set -# CONFIG_USB_GADGET_DUALSPEED is not set -CONFIG_USB_ZERO=m -CONFIG_USB_ETH=m -CONFIG_USB_ETH_RNDIS=y -CONFIG_USB_GADGETFS=m -CONFIG_USB_FILE_STORAGE=m -# CONFIG_USB_FILE_STORAGE_TEST is not set -CONFIG_USB_G_SERIAL=m - -# -# MMC/SD Card support -# -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -CONFIG_MMC_BLOCK=y -CONFIG_MMC_PXA=y -# CONFIG_MMC_WBSD is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT2_FS_XIP is not set -# CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_FS_POSIX_ACL is not set -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -CONFIG_INOTIFY=y -# CONFIG_QUOTA is not set -CONFIG_DNOTIFY=y -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_FUSE_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -CONFIG_MSDOS_FS=y -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS_FS is not set -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_WRITEBUFFER=y -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_ZLIB=y -CONFIG_JFFS2_RTIME=y -CONFIG_JFFS2_RUBIN=y -# CONFIG_JFFS2_CMODE_NONE is not set -CONFIG_JFFS2_CMODE_PRIORITY=y -# CONFIG_JFFS2_CMODE_SIZE is not set -CONFIG_CRAMFS=m -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=m -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -# CONFIG_NFS_DIRECTIO is not set -# CONFIG_NFSD is not set -CONFIG_LOCKD=m -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=m -CONFIG_SUNRPC_GSS=m -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_RPCSEC_GSS_SPKM3 is not set -CONFIG_SMB_FS=m -CONFIG_SMB_NLS_DEFAULT=y -CONFIG_SMB_NLS_REMOTE="cp437" -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_9P_FS is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_MAC_PARTITION is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_EFI_PARTITION is not set - -# -# Native Language Support -# -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="cp437" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ASCII is not set -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -CONFIG_NLS_UTF8=y - -# -# Profiling support -# -CONFIG_PROFILING=y -CONFIG_OPROFILE=m - -# -# Kernel hacking -# -# CONFIG_PRINTK_TIME is not set -CONFIG_DEBUG_KERNEL=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_DETECT_SOFTLOCKUP=y -# CONFIG_SCHEDSTATS is not set -# CONFIG_DEBUG_SLAB is not set -# CONFIG_DEBUG_PREEMPT is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_SPINLOCK_SLEEP is not set -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_FS is not set -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_USER is not set -# CONFIG_DEBUG_WAITQ is not set -CONFIG_DEBUG_ERRORS=y -CONFIG_DEBUG_LL=y -# CONFIG_DEBUG_ICEDCC is not set - -# -# Security options -# -# CONFIG_KEYS is not set -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -CONFIG_CRYPTO=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=m -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=m -CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_WP512=m -# CONFIG_CRYPTO_TGR192 is not set -CONFIG_CRYPTO_DES=m -CONFIG_CRYPTO_BLOWFISH=m -CONFIG_CRYPTO_TWOFISH=m -CONFIG_CRYPTO_SERPENT=m -CONFIG_CRYPTO_AES=m -CONFIG_CRYPTO_CAST5=m -CONFIG_CRYPTO_CAST6=m -CONFIG_CRYPTO_TEA=m -CONFIG_CRYPTO_ARC4=m -CONFIG_CRYPTO_KHAZAD=m -CONFIG_CRYPTO_ANUBIS=m -CONFIG_CRYPTO_DEFLATE=m -CONFIG_CRYPTO_MICHAEL_MIC=m -CONFIG_CRYPTO_CRC32C=m -CONFIG_CRYPTO_TEST=m - -# -# Hardware crypto devices -# - -# -# Library routines -# -CONFIG_CRC_CCITT=y -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -CONFIG_LIBCRC32C=m -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y diff --git a/trunk/arch/arm/configs/ixp4xx_defconfig b/trunk/arch/arm/configs/ixp4xx_defconfig index c279e41ed10e..94aafec5fb46 100644 --- a/trunk/arch/arm/configs/ixp4xx_defconfig +++ b/trunk/arch/arm/configs/ixp4xx_defconfig @@ -1,13 +1,14 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.14-rc1-git5 -# Tue Sep 20 17:26:28 2005 +# Linux kernel version: 2.6.12-rc1-bk2 +# Sun Mar 27 22:53:40 2005 # CONFIG_ARM=y CONFIG_MMU=y CONFIG_UID16=y CONFIG_RWSEM_GENERIC_SPINLOCK=y CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_IOMAP=y # # Code maturity level options @@ -15,13 +16,11 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y CONFIG_BROKEN_ON_SMP=y -CONFIG_INIT_ENV_ARG_LIMIT=32 # # General setup # CONFIG_LOCALVERSION="" -CONFIG_LOCALVERSION_AUTO=y CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_POSIX_MQUEUE is not set @@ -32,13 +31,10 @@ CONFIG_SYSCTL=y # CONFIG_HOTPLUG is not set CONFIG_KOBJECT_UEVENT=y # CONFIG_IKCONFIG is not set -CONFIG_INITRAMFS_SOURCE="" CONFIG_EMBEDDED=y CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set # CONFIG_KALLSYMS_EXTRA_PASS is not set -CONFIG_PRINTK=y -CONFIG_BUG=y CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y @@ -85,7 +81,6 @@ CONFIG_ARCH_IXP4XX=y # CONFIG_ARCH_VERSATILE is not set # CONFIG_ARCH_IMX is not set # CONFIG_ARCH_H720X is not set -# CONFIG_ARCH_AAEC2000 is not set CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y # @@ -95,16 +90,15 @@ CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y # # IXP4xx Platforms # -CONFIG_ARCH_AVILA=y +# CONFIG_ARCH_AVILA is not set CONFIG_ARCH_ADI_COYOTE=y CONFIG_ARCH_IXDP425=y -CONFIG_MACH_IXDPG425=y -CONFIG_MACH_IXDP465=y +# CONFIG_MACH_IXDPG425 is not set +# CONFIG_MACH_IXDP465 is not set CONFIG_ARCH_IXCDP1100=y CONFIG_ARCH_PRPMC1100=y CONFIG_ARCH_IXDP4XX=y -CONFIG_CPU_IXP46X=y -CONFIG_MACH_GTWX5715=y +# CONFIG_MACH_GTWX5715 is not set # # IXP4xx Options @@ -120,6 +114,7 @@ CONFIG_CPU_32v5=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_CACHE_VIVT=y CONFIG_CPU_TLB_V4WBI=y +CONFIG_CPU_MINICACHE=y # # Processor Features @@ -132,10 +127,9 @@ CONFIG_DMABOUNCE=y # # Bus support # -CONFIG_ISA_DMA_API=y CONFIG_PCI=y CONFIG_PCI_LEGACY_PROC=y -# CONFIG_PCI_DEBUG is not set +CONFIG_PCI_NAMES=y # # PCCARD (PCMCIA/CardBus) support @@ -146,15 +140,6 @@ CONFIG_PCI_LEGACY_PROC=y # Kernel Features # # CONFIG_PREEMPT is not set -# CONFIG_NO_IDLE_HZ is not set -# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_FLATMEM_MANUAL=y -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_SPARSEMEM_MANUAL is not set -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_SPARSEMEM_STATIC is not set CONFIG_ALIGNMENT_TRAP=y # @@ -189,241 +174,6 @@ CONFIG_BINFMT_ELF=y CONFIG_PM=y CONFIG_APM=y -# -# Networking -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=m -CONFIG_PACKET_MMAP=y -CONFIG_UNIX=y -CONFIG_XFRM=y -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -CONFIG_ASK_IP_FIB_HASH=y -# CONFIG_IP_FIB_TRIE is not set -CONFIG_IP_FIB_HASH=y -CONFIG_IP_MULTIPLE_TABLES=y -CONFIG_IP_ROUTE_FWMARK=y -CONFIG_IP_ROUTE_MULTIPATH=y -# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set -CONFIG_IP_ROUTE_VERBOSE=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -CONFIG_NET_IPGRE=m -CONFIG_NET_IPGRE_BROADCAST=y -CONFIG_IP_MROUTE=y -CONFIG_IP_PIMSM_V1=y -CONFIG_IP_PIMSM_V2=y -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -CONFIG_INET_TUNNEL=m -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_BIC=y - -# -# IP: Virtual Server Configuration -# -CONFIG_IP_VS=m -CONFIG_IP_VS_DEBUG=y -CONFIG_IP_VS_TAB_BITS=12 - -# -# IPVS transport protocol load balancing support -# -# CONFIG_IP_VS_PROTO_TCP is not set -# CONFIG_IP_VS_PROTO_UDP is not set -# CONFIG_IP_VS_PROTO_ESP is not set -# CONFIG_IP_VS_PROTO_AH is not set - -# -# IPVS scheduler -# -CONFIG_IP_VS_RR=m -CONFIG_IP_VS_WRR=m -CONFIG_IP_VS_LC=m -CONFIG_IP_VS_WLC=m -CONFIG_IP_VS_LBLC=m -CONFIG_IP_VS_LBLCR=m -CONFIG_IP_VS_DH=m -CONFIG_IP_VS_SH=m -# CONFIG_IP_VS_SED is not set -# CONFIG_IP_VS_NQ is not set - -# -# IPVS application helper -# -# CONFIG_IPV6 is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_BRIDGE_NETFILTER=y -# CONFIG_NETFILTER_NETLINK is not set - -# -# IP: Netfilter Configuration -# -CONFIG_IP_NF_CONNTRACK=m -# CONFIG_IP_NF_CT_ACCT is not set -# CONFIG_IP_NF_CONNTRACK_MARK is not set -# CONFIG_IP_NF_CONNTRACK_EVENTS is not set -# CONFIG_IP_NF_CT_PROTO_SCTP is not set -CONFIG_IP_NF_FTP=m -CONFIG_IP_NF_IRC=m -# CONFIG_IP_NF_NETBIOS_NS is not set -# CONFIG_IP_NF_TFTP is not set -# CONFIG_IP_NF_AMANDA is not set -CONFIG_IP_NF_QUEUE=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_LIMIT=m -# CONFIG_IP_NF_MATCH_IPRANGE is not set -CONFIG_IP_NF_MATCH_MAC=m -# CONFIG_IP_NF_MATCH_PKTTYPE is not set -CONFIG_IP_NF_MATCH_MARK=m -CONFIG_IP_NF_MATCH_MULTIPORT=m -CONFIG_IP_NF_MATCH_TOS=m -# CONFIG_IP_NF_MATCH_RECENT is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_DSCP is not set -CONFIG_IP_NF_MATCH_AH_ESP=m -CONFIG_IP_NF_MATCH_LENGTH=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_MATCH_TCPMSS=m -# CONFIG_IP_NF_MATCH_HELPER is not set -CONFIG_IP_NF_MATCH_STATE=m -# CONFIG_IP_NF_MATCH_CONNTRACK is not set -CONFIG_IP_NF_MATCH_OWNER=m -# CONFIG_IP_NF_MATCH_PHYSDEV is not set -# CONFIG_IP_NF_MATCH_ADDRTYPE is not set -# CONFIG_IP_NF_MATCH_REALM is not set -# CONFIG_IP_NF_MATCH_SCTP is not set -# CONFIG_IP_NF_MATCH_DCCP is not set -# CONFIG_IP_NF_MATCH_COMMENT is not set -# CONFIG_IP_NF_MATCH_HASHLIMIT is not set -# CONFIG_IP_NF_MATCH_STRING is not set -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -CONFIG_IP_NF_TARGET_LOG=m -CONFIG_IP_NF_TARGET_ULOG=m -CONFIG_IP_NF_TARGET_TCPMSS=m -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_NAT_NEEDED=y -CONFIG_IP_NF_TARGET_MASQUERADE=m -CONFIG_IP_NF_TARGET_REDIRECT=m -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_SAME is not set -CONFIG_IP_NF_NAT_SNMP_BASIC=m -CONFIG_IP_NF_NAT_IRC=m -CONFIG_IP_NF_NAT_FTP=m -CONFIG_IP_NF_MANGLE=m -CONFIG_IP_NF_TARGET_TOS=m -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_DSCP is not set -CONFIG_IP_NF_TARGET_MARK=m -# CONFIG_IP_NF_TARGET_CLASSIFY is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_RAW is not set -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -# CONFIG_IP_NF_ARP_MANGLE is not set - -# -# Bridge: Netfilter Configuration -# -# CONFIG_BRIDGE_NF_EBTABLES is not set - -# -# DCCP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_DCCP is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_SCTP is not set -CONFIG_ATM=y -CONFIG_ATM_CLIP=y -# CONFIG_ATM_CLIP_NO_ICMP is not set -CONFIG_ATM_LANE=m -CONFIG_ATM_MPOA=m -CONFIG_ATM_BR2684=m -# CONFIG_ATM_BR2684_IPFILTER is not set -CONFIG_BRIDGE=m -CONFIG_VLAN_8021Q=m -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -CONFIG_IPX=m -# CONFIG_IPX_INTERN is not set -CONFIG_ATALK=m -CONFIG_DEV_APPLETALK=y -CONFIG_IPDDP=m -CONFIG_IPDDP_ENCAP=y -CONFIG_IPDDP_DECAP=y -CONFIG_X25=m -CONFIG_LAPB=m -# CONFIG_NET_DIVERT is not set -CONFIG_ECONET=m -CONFIG_ECONET_AUNUDP=y -CONFIG_ECONET_NATIVE=y -CONFIG_WAN_ROUTER=m -CONFIG_NET_SCHED=y -CONFIG_NET_SCH_CLK_JIFFIES=y -# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set -# CONFIG_NET_SCH_CLK_CPU is not set -CONFIG_NET_SCH_CBQ=m -CONFIG_NET_SCH_HTB=m -# CONFIG_NET_SCH_HFSC is not set -# CONFIG_NET_SCH_ATM is not set -CONFIG_NET_SCH_PRIO=m -CONFIG_NET_SCH_RED=m -CONFIG_NET_SCH_SFQ=m -CONFIG_NET_SCH_TEQL=m -CONFIG_NET_SCH_TBF=m -CONFIG_NET_SCH_GRED=m -CONFIG_NET_SCH_DSMARK=m -# CONFIG_NET_SCH_NETEM is not set -CONFIG_NET_SCH_INGRESS=m -CONFIG_NET_QOS=y -CONFIG_NET_ESTIMATOR=y -CONFIG_NET_CLS=y -# CONFIG_NET_CLS_BASIC is not set -CONFIG_NET_CLS_TCINDEX=m -CONFIG_NET_CLS_ROUTE4=m -CONFIG_NET_CLS_ROUTE=y -CONFIG_NET_CLS_FW=m -CONFIG_NET_CLS_U32=m -# CONFIG_CLS_U32_PERF is not set -# CONFIG_NET_CLS_IND is not set -# CONFIG_CLS_U32_MARK is not set -CONFIG_NET_CLS_RSVP=m -CONFIG_NET_CLS_RSVP6=m -# CONFIG_NET_EMATCH is not set -# CONFIG_NET_CLS_ACT is not set -CONFIG_NET_CLS_POLICE=y - -# -# Network testing -# -CONFIG_NET_PKTGEN=m -# CONFIG_HAMRADIO is not set -# CONFIG_IRDA is not set -# CONFIG_BT is not set -# CONFIG_IEEE80211 is not set - # # Device Drivers # @@ -494,7 +244,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y CONFIG_MTD_IXP4XX=y # CONFIG_MTD_EDB7312 is not set # CONFIG_MTD_PCI is not set -# CONFIG_MTD_PLATRAM is not set # # Self-contained MTD device drivers @@ -534,6 +283,7 @@ CONFIG_MTD_NAND_IDS=m # # Block devices # +# CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_DEV_DAC960 is not set @@ -547,6 +297,7 @@ CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=8192 CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" # CONFIG_CDROM_PKTCDVD is not set # @@ -600,7 +351,6 @@ CONFIG_BLK_DEV_CMD64X=y CONFIG_BLK_DEV_HPT366=y # CONFIG_BLK_DEV_SC1200 is not set # CONFIG_BLK_DEV_PIIX is not set -# CONFIG_BLK_DEV_IT821X is not set # CONFIG_BLK_DEV_NS87415 is not set # CONFIG_BLK_DEV_PDC202XX_OLD is not set CONFIG_BLK_DEV_PDC202XX_NEW=y @@ -619,7 +369,6 @@ CONFIG_BLK_DEV_IDEDMA=y # # SCSI device support # -# CONFIG_RAID_ATTRS is not set # CONFIG_SCSI is not set # @@ -630,7 +379,6 @@ CONFIG_BLK_DEV_IDEDMA=y # # Fusion MPT device support # -# CONFIG_FUSION is not set # # IEEE 1394 (FireWire) support @@ -643,24 +391,241 @@ CONFIG_BLK_DEV_IDEDMA=y # CONFIG_I2O is not set # -# Network device support +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=m +CONFIG_PACKET_MMAP=y +CONFIG_NETLINK_DEV=m +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_ROUTE_FWMARK=y +CONFIG_IP_ROUTE_MULTIPATH=y +# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set +CONFIG_IP_ROUTE_VERBOSE=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +CONFIG_NET_IPGRE=m +CONFIG_NET_IPGRE_BROADCAST=y +CONFIG_IP_MROUTE=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +# CONFIG_ARPD is not set +CONFIG_SYN_COOKIES=y +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +CONFIG_INET_TUNNEL=m +# CONFIG_IP_TCPDIAG is not set +# CONFIG_IP_TCPDIAG_IPV6 is not set + +# +# IP: Virtual Server Configuration +# +CONFIG_IP_VS=m +CONFIG_IP_VS_DEBUG=y +CONFIG_IP_VS_TAB_BITS=12 + +# +# IPVS transport protocol load balancing support +# +# CONFIG_IP_VS_PROTO_TCP is not set +# CONFIG_IP_VS_PROTO_UDP is not set +# CONFIG_IP_VS_PROTO_ESP is not set +# CONFIG_IP_VS_PROTO_AH is not set + +# +# IPVS scheduler +# +CONFIG_IP_VS_RR=m +CONFIG_IP_VS_WRR=m +CONFIG_IP_VS_LC=m +CONFIG_IP_VS_WLC=m +CONFIG_IP_VS_LBLC=m +CONFIG_IP_VS_LBLCR=m +CONFIG_IP_VS_DH=m +CONFIG_IP_VS_SH=m +# CONFIG_IP_VS_SED is not set +# CONFIG_IP_VS_NQ is not set + +# +# IPVS application helper +# +# CONFIG_IPV6 is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_BRIDGE_NETFILTER=y + +# +# IP: Netfilter Configuration # +CONFIG_IP_NF_CONNTRACK=m +# CONFIG_IP_NF_CT_ACCT is not set +# CONFIG_IP_NF_CONNTRACK_MARK is not set +# CONFIG_IP_NF_CT_PROTO_SCTP is not set +CONFIG_IP_NF_FTP=m +CONFIG_IP_NF_IRC=m +# CONFIG_IP_NF_TFTP is not set +# CONFIG_IP_NF_AMANDA is not set +CONFIG_IP_NF_QUEUE=m +CONFIG_IP_NF_IPTABLES=m +CONFIG_IP_NF_MATCH_LIMIT=m +# CONFIG_IP_NF_MATCH_IPRANGE is not set +CONFIG_IP_NF_MATCH_MAC=m +# CONFIG_IP_NF_MATCH_PKTTYPE is not set +CONFIG_IP_NF_MATCH_MARK=m +CONFIG_IP_NF_MATCH_MULTIPORT=m +CONFIG_IP_NF_MATCH_TOS=m +# CONFIG_IP_NF_MATCH_RECENT is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_DSCP is not set +CONFIG_IP_NF_MATCH_AH_ESP=m +CONFIG_IP_NF_MATCH_LENGTH=m +CONFIG_IP_NF_MATCH_TTL=m +CONFIG_IP_NF_MATCH_TCPMSS=m +# CONFIG_IP_NF_MATCH_HELPER is not set +CONFIG_IP_NF_MATCH_STATE=m +# CONFIG_IP_NF_MATCH_CONNTRACK is not set +CONFIG_IP_NF_MATCH_OWNER=m +# CONFIG_IP_NF_MATCH_PHYSDEV is not set +# CONFIG_IP_NF_MATCH_ADDRTYPE is not set +# CONFIG_IP_NF_MATCH_REALM is not set +# CONFIG_IP_NF_MATCH_SCTP is not set +# CONFIG_IP_NF_MATCH_COMMENT is not set +# CONFIG_IP_NF_MATCH_HASHLIMIT is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +CONFIG_IP_NF_TARGET_LOG=m +CONFIG_IP_NF_TARGET_ULOG=m +CONFIG_IP_NF_TARGET_TCPMSS=m +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_NAT_NEEDED=y +CONFIG_IP_NF_TARGET_MASQUERADE=m +CONFIG_IP_NF_TARGET_REDIRECT=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_SAME is not set +CONFIG_IP_NF_NAT_SNMP_BASIC=m +CONFIG_IP_NF_NAT_IRC=m +CONFIG_IP_NF_NAT_FTP=m +CONFIG_IP_NF_MANGLE=m +CONFIG_IP_NF_TARGET_TOS=m +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_DSCP is not set +CONFIG_IP_NF_TARGET_MARK=m +# CONFIG_IP_NF_TARGET_CLASSIFY is not set +# CONFIG_IP_NF_RAW is not set +CONFIG_IP_NF_ARPTABLES=m +CONFIG_IP_NF_ARPFILTER=m +# CONFIG_IP_NF_ARP_MANGLE is not set + +# +# Bridge: Netfilter Configuration +# +# CONFIG_BRIDGE_NF_EBTABLES is not set +CONFIG_XFRM=y +# CONFIG_XFRM_USER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +CONFIG_ATM=y +CONFIG_ATM_CLIP=y +# CONFIG_ATM_CLIP_NO_ICMP is not set +CONFIG_ATM_LANE=m +CONFIG_ATM_MPOA=m +CONFIG_ATM_BR2684=m +# CONFIG_ATM_BR2684_IPFILTER is not set +CONFIG_BRIDGE=m +CONFIG_VLAN_8021Q=m +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +CONFIG_IPX=m +# CONFIG_IPX_INTERN is not set +CONFIG_ATALK=m +CONFIG_DEV_APPLETALK=y +CONFIG_IPDDP=m +CONFIG_IPDDP_ENCAP=y +CONFIG_IPDDP_DECAP=y +CONFIG_X25=m +CONFIG_LAPB=m +# CONFIG_NET_DIVERT is not set +CONFIG_ECONET=m +CONFIG_ECONET_AUNUDP=y +CONFIG_ECONET_NATIVE=y +CONFIG_WAN_ROUTER=m + +# +# QoS and/or fair queueing +# +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_CLK_JIFFIES=y +# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set +# CONFIG_NET_SCH_CLK_CPU is not set +CONFIG_NET_SCH_CBQ=m +CONFIG_NET_SCH_HTB=m +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_ATM is not set +CONFIG_NET_SCH_PRIO=m +CONFIG_NET_SCH_RED=m +CONFIG_NET_SCH_SFQ=m +CONFIG_NET_SCH_TEQL=m +CONFIG_NET_SCH_TBF=m +CONFIG_NET_SCH_GRED=m +CONFIG_NET_SCH_DSMARK=m +# CONFIG_NET_SCH_NETEM is not set +CONFIG_NET_SCH_INGRESS=m +CONFIG_NET_QOS=y +CONFIG_NET_ESTIMATOR=y +CONFIG_NET_CLS=y +# CONFIG_NET_CLS_BASIC is not set +CONFIG_NET_CLS_TCINDEX=m +CONFIG_NET_CLS_ROUTE4=m +CONFIG_NET_CLS_ROUTE=y +CONFIG_NET_CLS_FW=m +CONFIG_NET_CLS_U32=m +# CONFIG_CLS_U32_PERF is not set +# CONFIG_NET_CLS_IND is not set +# CONFIG_CLS_U32_MARK is not set +CONFIG_NET_CLS_RSVP=m +CONFIG_NET_CLS_RSVP6=m +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_CLS_ACT is not set +CONFIG_NET_CLS_POLICE=y + +# +# Network testing +# +CONFIG_NET_PKTGEN=m +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set CONFIG_NETDEVICES=y CONFIG_DUMMY=y # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set # CONFIG_TUN is not set +# CONFIG_ETHERTAP is not set # # ARCnet devices # # CONFIG_ARCNET is not set -# -# PHY device support -# -# CONFIG_PHYLIB is not set - # # Ethernet (10 or 100Mbit) # @@ -670,7 +635,6 @@ CONFIG_MII=y # CONFIG_SUNGEM is not set # CONFIG_NET_VENDOR_3COM is not set # CONFIG_SMC91X is not set -# CONFIG_DM9000 is not set # # Tulip family network device support @@ -707,17 +671,13 @@ CONFIG_EEPRO100=y # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set # CONFIG_R8169 is not set -# CONFIG_SIS190 is not set -# CONFIG_SKGE is not set # CONFIG_SK98LIN is not set # CONFIG_VIA_VELOCITY is not set # CONFIG_TIGON3 is not set -# CONFIG_BNX2 is not set # # Ethernet (10000 Mbit) # -# CONFIG_CHELSIO_T1 is not set # CONFIG_IXGB is not set # CONFIG_S2IO is not set @@ -742,7 +702,6 @@ CONFIG_NET_RADIO=y CONFIG_HERMES=y # CONFIG_PLX_HERMES is not set # CONFIG_TMD_HERMES is not set -# CONFIG_NORTEL_HERMES is not set CONFIG_PCI_HERMES=y # CONFIG_ATMEL is not set @@ -750,7 +709,6 @@ CONFIG_PCI_HERMES=y # Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support # # CONFIG_PRISM54 is not set -# CONFIG_HOSTAP is not set CONFIG_NET_WIRELESS=y # @@ -800,8 +758,6 @@ CONFIG_ATM_TCP=m # CONFIG_SLIP is not set # CONFIG_SHAPER is not set # CONFIG_NETCONSOLE is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set # # ISDN subsystem @@ -839,6 +795,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 # # CONFIG_SERIO is not set # CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y # # Character devices @@ -859,7 +816,6 @@ CONFIG_SERIAL_8250_NR_UARTS=2 # CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 @@ -926,11 +882,12 @@ CONFIG_I2C_ALGOBIT=y # CONFIG_I2C_AMD8111 is not set # CONFIG_I2C_I801 is not set # CONFIG_I2C_I810 is not set -# CONFIG_I2C_PIIX4 is not set # CONFIG_I2C_IOP3XX is not set +# CONFIG_I2C_ISA is not set CONFIG_I2C_IXP4XX=y # CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_PIIX4 is not set # CONFIG_I2C_PROSAVAGE is not set # CONFIG_I2C_SAVAGE4 is not set # CONFIG_SCx200_ACB is not set @@ -944,33 +901,14 @@ CONFIG_I2C_IXP4XX=y # CONFIG_I2C_PCA_ISA is not set # -# Miscellaneous I2C Chip support +# Hardware Sensors Chip support # -# CONFIG_SENSORS_DS1337 is not set -# CONFIG_SENSORS_DS1374 is not set -CONFIG_SENSORS_EEPROM=y -# CONFIG_SENSORS_PCF8574 is not set -# CONFIG_SENSORS_PCA9539 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set -# CONFIG_SENSORS_MAX6875 is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CHIP is not set - -# -# Hardware Monitoring support -# -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set +CONFIG_I2C_SENSOR=y # CONFIG_SENSORS_ADM1021 is not set # CONFIG_SENSORS_ADM1025 is not set # CONFIG_SENSORS_ADM1026 is not set # CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set # CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ATXP1 is not set # CONFIG_SENSORS_DS1621 is not set # CONFIG_SENSORS_FSCHER is not set # CONFIG_SENSORS_FSCPOS is not set @@ -986,26 +924,30 @@ CONFIG_HWMON=y # CONFIG_SENSORS_LM85 is not set # CONFIG_SENSORS_LM87 is not set # CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set # CONFIG_SENSORS_MAX1619 is not set # CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_SMSC47B397 is not set # CONFIG_SENSORS_SIS5595 is not set # CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47B397 is not set # CONFIG_SENSORS_VIA686A is not set # CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83792D is not set # CONFIG_SENSORS_W83L785TS is not set # CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_HWMON_DEBUG_CHIP is not set # -# Misc devices +# Other I2C Chip support # +CONFIG_SENSORS_EEPROM=y +# CONFIG_SENSORS_PCF8574 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_SENSORS_RTC8564 is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_I2C_DEBUG_CHIP is not set # -# Multimedia Capabilities Port drivers +# Misc devices # # @@ -1052,7 +994,6 @@ CONFIG_EXT2_FS=y CONFIG_EXT2_FS_XATTR=y CONFIG_EXT2_FS_POSIX_ACL=y # CONFIG_EXT2_FS_SECURITY is not set -# CONFIG_EXT2_FS_XIP is not set CONFIG_EXT3_FS=y CONFIG_EXT3_FS_XATTR=y CONFIG_EXT3_FS_POSIX_ACL=y @@ -1063,15 +1004,17 @@ CONFIG_FS_MBCACHE=y # CONFIG_REISERFS_FS is not set # CONFIG_JFS_FS is not set CONFIG_FS_POSIX_ACL=y + +# +# XFS support +# # CONFIG_XFS_FS is not set # CONFIG_MINIX_FS is not set # CONFIG_ROMFS_FS is not set -CONFIG_INOTIFY=y # CONFIG_QUOTA is not set CONFIG_DNOTIFY=y # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set -# CONFIG_FUSE_FS is not set # # CD-ROM/DVD Filesystems @@ -1091,10 +1034,12 @@ CONFIG_DNOTIFY=y # CONFIG_PROC_FS=y CONFIG_SYSFS=y +# CONFIG_DEVFS_FS is not set +# CONFIG_DEVPTS_FS_XATTR is not set CONFIG_TMPFS=y +# CONFIG_TMPFS_XATTR is not set # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set # # Miscellaneous filesystems @@ -1109,7 +1054,8 @@ CONFIG_RAMFS=y # CONFIG_JFFS_FS is not set CONFIG_JFFS2_FS=y CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_NAND is not set +# CONFIG_JFFS2_FS_NOR_ECC is not set # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set CONFIG_JFFS2_ZLIB=y CONFIG_JFFS2_RTIME=y @@ -1126,14 +1072,12 @@ CONFIG_JFFS2_RTIME=y # CONFIG_NFS_FS=y CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set # CONFIG_NFS_V4 is not set # CONFIG_NFS_DIRECTIO is not set # CONFIG_NFSD is not set CONFIG_ROOT_NFS=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y CONFIG_SUNRPC=y # CONFIG_RPCSEC_GSS_KRB5 is not set # CONFIG_RPCSEC_GSS_SPKM3 is not set @@ -1142,7 +1086,6 @@ CONFIG_SUNRPC=y # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set -# CONFIG_9P_FS is not set # # Partition Types @@ -1181,7 +1124,6 @@ CONFIG_MSDOS_PARTITION=y CONFIG_DEBUG_KERNEL=y CONFIG_MAGIC_SYSRQ=y CONFIG_LOG_BUF_SHIFT=14 -CONFIG_DETECT_SOFTLOCKUP=y # CONFIG_SCHEDSTATS is not set # CONFIG_DEBUG_SLAB is not set # CONFIG_DEBUG_SPINLOCK is not set @@ -1216,7 +1158,6 @@ CONFIG_DEBUG_LL=y # Library routines # # CONFIG_CRC_CCITT is not set -# CONFIG_CRC16 is not set CONFIG_CRC32=y # CONFIG_LIBCRC32C is not set CONFIG_ZLIB_INFLATE=y diff --git a/trunk/arch/arm/configs/poodle_defconfig b/trunk/arch/arm/configs/poodle_defconfig deleted file mode 100644 index 72822907759f..000000000000 --- a/trunk/arch/arm/configs/poodle_defconfig +++ /dev/null @@ -1,1015 +0,0 @@ -# -# Automatically generated make config: don't edit -# Linux kernel version: 2.6.14-rc3 -# Sun Oct 9 17:04:29 2005 -# -CONFIG_ARM=y -CONFIG_MMU=y -CONFIG_UID16=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_CALIBRATE_DELAY=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y -CONFIG_BROKEN_ON_SMP=y -CONFIG_LOCK_KERNEL=y -CONFIG_INIT_ENV_ARG_LIMIT=32 - -# -# General setup -# -CONFIG_LOCALVERSION="" -CONFIG_LOCALVERSION_AUTO=y -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_POSIX_MQUEUE is not set -CONFIG_BSD_PROCESS_ACCT=y -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -CONFIG_SYSCTL=y -# CONFIG_AUDIT is not set -CONFIG_HOTPLUG=y -CONFIG_KOBJECT_UEVENT=y -# CONFIG_IKCONFIG is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_EMBEDDED=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -# CONFIG_KALLSYMS_EXTRA_PASS is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 -# CONFIG_TINY_SHMEM is not set -CONFIG_BASE_SMALL=0 - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_OBSOLETE_MODPARM=y -CONFIG_MODVERSIONS=y -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_KMOD=y - -# -# System Type -# -# CONFIG_ARCH_CLPS7500 is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_CO285 is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_CAMELOT is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_IOP3XX is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_IXP2000 is not set -# CONFIG_ARCH_L7200 is not set -CONFIG_ARCH_PXA=y -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_S3C2410 is not set -# CONFIG_ARCH_SHARK is not set -# CONFIG_ARCH_LH7A40X is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_IMX is not set -# CONFIG_ARCH_H720X is not set -# CONFIG_ARCH_AAEC2000 is not set - -# -# Intel PXA2xx Implementations -# -# CONFIG_ARCH_LUBBOCK is not set -# CONFIG_MACH_MAINSTONE is not set -# CONFIG_ARCH_PXA_IDP is not set -CONFIG_PXA_SHARPSL=y -CONFIG_PXA_SHARPSL_25x=y -# CONFIG_PXA_SHARPSL_27x is not set -CONFIG_MACH_POODLE=y -# CONFIG_MACH_CORGI is not set -# CONFIG_MACH_SHEPHERD is not set -# CONFIG_MACH_HUSKY is not set -CONFIG_PXA25x=y - -# -# Processor Type -# -CONFIG_CPU_32=y -CONFIG_CPU_XSCALE=y -CONFIG_CPU_32v5=y -CONFIG_CPU_ABRT_EV5T=y -CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_TLB_V4WBI=y - -# -# Processor Features -# -CONFIG_ARM_THUMB=y -CONFIG_XSCALE_PMU=y -CONFIG_SHARP_LOCOMO=y -CONFIG_SHARP_PARAM=y -CONFIG_SHARP_SCOOP=y - -# -# Bus support -# -CONFIG_ISA_DMA_API=y - -# -# PCCARD (PCMCIA/CardBus) support -# -CONFIG_PCCARD=y -# CONFIG_PCMCIA_DEBUG is not set -CONFIG_PCMCIA=y -CONFIG_PCMCIA_LOAD_CIS=y -CONFIG_PCMCIA_IOCTL=y - -# -# PC-card bridges -# -CONFIG_PCMCIA_PXA2XX=y - -# -# Kernel Features -# -CONFIG_PREEMPT=y -# CONFIG_NO_IDLE_HZ is not set -# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_FLATMEM_MANUAL=y -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_SPARSEMEM_MANUAL is not set -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_SPARSEMEM_STATIC is not set -CONFIG_ALIGNMENT_TRAP=y - -# -# Boot options -# -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug" -# CONFIG_XIP_KERNEL is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -CONFIG_FPE_NWFPE=y -# CONFIG_FPE_NWFPE_XP is not set -# CONFIG_FPE_FASTFPE is not set - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_BINFMT_AOUT=m -CONFIG_BINFMT_MISC=m -# CONFIG_ARTHUR is not set - -# -# Power management options -# -CONFIG_PM=y -CONFIG_APM=y - -# -# Networking -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -CONFIG_PACKET_MMAP=y -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -# CONFIG_IP_MULTICAST is not set -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_FIB_HASH=y -# CONFIG_IP_PNP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_TUNNEL is not set -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_BIC=y -# CONFIG_IPV6 is not set -# CONFIG_NETFILTER is not set - -# -# DCCP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_DCCP is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_BRIDGE is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_DECNET is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_SCHED is not set -# CONFIG_NET_CLS_ROUTE is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -# CONFIG_IRDA is not set -# CONFIG_BT is not set -# CONFIG_IEEE80211 is not set - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -# CONFIG_DEBUG_DRIVER is not set - -# -# Memory Technology Devices (MTD) -# -CONFIG_MTD=y -# CONFIG_MTD_DEBUG is not set -# CONFIG_MTD_CONCAT is not set -CONFIG_MTD_PARTITIONS=y -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_CMDLINE_PARTS is not set -# CONFIG_MTD_AFS_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_CHAR=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set - -# -# RAM/ROM/Flash chip drivers -# -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -CONFIG_MTD_COMPLEX_MAPPINGS=y -CONFIG_MTD_SHARP_SL=y -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLKMTD is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOC2001PLUS is not set - -# -# NAND Flash Device Drivers -# -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_VERIFY_WRITE=y -# CONFIG_MTD_NAND_H1900 is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_DISKONCHIP is not set -CONFIG_MTD_NAND_SHARPSL=y -# CONFIG_MTD_NAND_NANDSIM is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Plug and Play support -# - -# -# Block devices -# -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_RAM is not set -CONFIG_BLK_DEV_RAM_COUNT=16 -# CONFIG_CDROM_PKTCDVD is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_ATA_OVER_ETH is not set - -# -# ATA/ATAPI/MFM/RLL support -# -CONFIG_IDE=y -CONFIG_BLK_DEV_IDE=y - -# -# Please see Documentation/ide.txt for help/info on IDE drives -# -# CONFIG_BLK_DEV_IDE_SATA is not set -CONFIG_BLK_DEV_IDEDISK=y -# CONFIG_IDEDISK_MULTI_MODE is not set -CONFIG_BLK_DEV_IDECS=y -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set -# CONFIG_IDE_TASK_IOCTL is not set - -# -# IDE chipset support/bugfixes -# -CONFIG_IDE_GENERIC=y -# CONFIG_IDE_ARM is not set -# CONFIG_BLK_DEV_IDEDMA is not set -# CONFIG_IDEDMA_AUTO is not set -# CONFIG_BLK_DEV_HD is not set - -# -# SCSI device support -# -# CONFIG_RAID_ATTRS is not set -# CONFIG_SCSI is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# Fusion MPT device support -# -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# - -# -# I2O device support -# - -# -# Network device support -# -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set - -# -# PHY device support -# -# CONFIG_PHYLIB is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -# CONFIG_MII is not set -# CONFIG_SMC91X is not set -# CONFIG_DM9000 is not set - -# -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# - -# -# Token Ring devices -# - -# -# Wireless LAN (non-hamradio) -# -CONFIG_NET_RADIO=y - -# -# Obsolete Wireless cards support (pre-802.11) -# -# CONFIG_STRIP is not set -# CONFIG_PCMCIA_WAVELAN is not set -# CONFIG_PCMCIA_NETWAVE is not set - -# -# Wireless 802.11 Frequency Hopping cards support -# -# CONFIG_PCMCIA_RAYCS is not set - -# -# Wireless 802.11b ISA/PCI cards support -# -# CONFIG_HERMES is not set -# CONFIG_ATMEL is not set - -# -# Wireless 802.11b Pcmcia/Cardbus cards support -# -# CONFIG_AIRO_CS is not set -# CONFIG_PCMCIA_WL3501 is not set -# CONFIG_HOSTAP is not set -CONFIG_NET_WIRELESS=y - -# -# PCMCIA network device support -# -CONFIG_NET_PCMCIA=y -# CONFIG_PCMCIA_3C589 is not set -# CONFIG_PCMCIA_3C574 is not set -# CONFIG_PCMCIA_FMVJ18X is not set -CONFIG_PCMCIA_PCNET=y -# CONFIG_PCMCIA_NMCLAN is not set -# CONFIG_PCMCIA_SMC91C92 is not set -# CONFIG_PCMCIA_XIRC2PS is not set -# CONFIG_PCMCIA_AXNET is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set -CONFIG_PPP=m -# CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPP_DEFLATE is not set -CONFIG_PPP_BSDCOMP=m -# CONFIG_PPPOE is not set -# CONFIG_SLIP is not set -# CONFIG_SHAPER is not set -# CONFIG_NETCONSOLE is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set -CONFIG_INPUT_TSDEV=y -CONFIG_INPUT_TSDEV_SCREEN_X=240 -CONFIG_INPUT_TSDEV_SCREEN_Y=320 -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_EVBUG=y - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_LKKBD is not set -CONFIG_KEYBOARD_LOCOMO=y -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_CORGI is not set -CONFIG_KEYBOARD_SPITZ=y -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_MISC is not set - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -# CONFIG_SERIAL_8250 is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_PXA=y -CONFIG_SERIAL_PXA_CONSOLE=y -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -# CONFIG_RTC is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set - -# -# Ftape, the floppy tape device driver -# - -# -# PCMCIA character devices -# -# CONFIG_SYNCLINK_CS is not set -# CONFIG_RAW_DRIVER is not set - -# -# TPM devices -# - -# -# I2C support -# -CONFIG_I2C=y -# CONFIG_I2C_CHARDEV is not set - -# -# I2C Algorithms -# -CONFIG_I2C_ALGOBIT=y -# CONFIG_I2C_ALGOPCF is not set -# CONFIG_I2C_ALGOPCA is not set - -# -# I2C Hardware Bus support -# -# CONFIG_I2C_PXA is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_PCA_ISA is not set - -# -# Miscellaneous I2C Chip support -# -# CONFIG_SENSORS_DS1337 is not set -# CONFIG_SENSORS_DS1374 is not set -# CONFIG_SENSORS_EEPROM is not set -# CONFIG_SENSORS_PCF8574 is not set -# CONFIG_SENSORS_PCA9539 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set -# CONFIG_SENSORS_MAX6875 is not set -CONFIG_I2C_DEBUG_CORE=y -CONFIG_I2C_DEBUG_ALGO=y -CONFIG_I2C_DEBUG_BUS=y -# CONFIG_I2C_DEBUG_CHIP is not set - -# -# Hardware Monitoring support -# -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_FSCHER is not set -# CONFIG_SENSORS_FSCPOS is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Misc devices -# - -# -# Multimedia Capabilities Port drivers -# - -# -# Multimedia devices -# -CONFIG_VIDEO_DEV=m - -# -# Video For Linux -# - -# -# Video Adapters -# -# CONFIG_VIDEO_CPIA is not set -# CONFIG_VIDEO_SAA5246A is not set -# CONFIG_VIDEO_SAA5249 is not set -# CONFIG_TUNER_3036 is not set -# CONFIG_VIDEO_OVCAMCHIP is not set - -# -# Radio Adapters -# -# CONFIG_RADIO_MAESTRO is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# Graphics support -# -CONFIG_FB=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_SOFT_CURSOR=y -# CONFIG_FB_MACMODES is not set -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_TILEBLITTING is not set -CONFIG_FB_PXA=y -# CONFIG_FB_W100 is not set -# CONFIG_FB_PXA_PARAMETERS is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_VIRTUAL is not set - -# -# Console display driver support -# -# CONFIG_VGA_CONSOLE is not set -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FONTS=y -CONFIG_FONT_8x8=y -# CONFIG_FONT_8x16 is not set -# CONFIG_FONT_6x11 is not set -# CONFIG_FONT_7x14 is not set -# CONFIG_FONT_PEARL_8x8 is not set -# CONFIG_FONT_ACORN_8x8 is not set -# CONFIG_FONT_MINI_4x6 is not set -# CONFIG_FONT_SUN8x16 is not set -# CONFIG_FONT_SUN12x22 is not set -# CONFIG_FONT_10x18 is not set - -# -# Logo configuration -# -# CONFIG_LOGO is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# USB support -# -CONFIG_USB_ARCH_HAS_HCD=y -# CONFIG_USB_ARCH_HAS_OHCI is not set -# CONFIG_USB is not set - -# -# USB Gadget Support -# -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG_FILES is not set -CONFIG_USB_GADGET_SELECTED=y -# CONFIG_USB_GADGET_NET2280 is not set -CONFIG_USB_GADGET_PXA2XX=y -CONFIG_USB_PXA2XX=y -# CONFIG_USB_PXA2XX_SMALL is not set -# CONFIG_USB_GADGET_GOKU is not set -# CONFIG_USB_GADGET_LH7A40X is not set -# CONFIG_USB_GADGET_OMAP is not set -# CONFIG_USB_GADGET_DUMMY_HCD is not set -# CONFIG_USB_GADGET_DUALSPEED is not set -# CONFIG_USB_ZERO is not set -CONFIG_USB_ETH=y -CONFIG_USB_ETH_RNDIS=y -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_FILE_STORAGE is not set -# CONFIG_USB_G_SERIAL is not set - -# -# MMC/SD Card support -# -CONFIG_MMC=y -CONFIG_MMC_DEBUG=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_PXA=y -# CONFIG_MMC_WBSD is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -# CONFIG_EXT2_FS_XIP is not set -# CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -CONFIG_FS_POSIX_ACL=y -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -CONFIG_INOTIFY=y -# CONFIG_QUOTA is not set -CONFIG_DNOTIFY=y -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_FUSE_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -CONFIG_MSDOS_FS=y -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS_FS is not set -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_WRITEBUFFER=y -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_ZLIB=y -CONFIG_JFFS2_RTIME=y -CONFIG_JFFS2_RUBIN=y -# CONFIG_JFFS2_CMODE_NONE is not set -CONFIG_JFFS2_CMODE_PRIORITY=y -# CONFIG_JFFS2_CMODE_SIZE is not set -CONFIG_CRAMFS=m -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -# CONFIG_NFS_FS is not set -# CONFIG_NFSD is not set -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_9P_FS is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_MAC_PARTITION is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_EFI_PARTITION is not set - -# -# Native Language Support -# -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="cp437" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -CONFIG_NLS_UTF8=y - -# -# Profiling support -# -# CONFIG_PROFILING is not set - -# -# Kernel hacking -# -# CONFIG_PRINTK_TIME is not set -CONFIG_DEBUG_KERNEL=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_DETECT_SOFTLOCKUP=y -# CONFIG_SCHEDSTATS is not set -# CONFIG_DEBUG_SLAB is not set -CONFIG_DEBUG_PREEMPT=y -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_SPINLOCK_SLEEP is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_FS is not set -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_USER is not set -# CONFIG_DEBUG_WAITQ is not set -CONFIG_DEBUG_ERRORS=y -# CONFIG_DEBUG_LL is not set - -# -# Security options -# -# CONFIG_KEYS is not set -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -# CONFIG_CRYPTO is not set - -# -# Hardware crypto devices -# - -# -# Library routines -# -CONFIG_CRC_CCITT=y -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -# CONFIG_LIBCRC32C is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y diff --git a/trunk/arch/arm/configs/spitz_defconfig b/trunk/arch/arm/configs/spitz_defconfig deleted file mode 100644 index 900e04f8e38c..000000000000 --- a/trunk/arch/arm/configs/spitz_defconfig +++ /dev/null @@ -1,1401 +0,0 @@ -# -# Automatically generated make config: don't edit -# Linux kernel version: 2.6.14-rc3 -# Sun Oct 9 17:11:19 2005 -# -CONFIG_ARM=y -CONFIG_MMU=y -CONFIG_UID16=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_CALIBRATE_DELAY=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y -CONFIG_BROKEN_ON_SMP=y -CONFIG_LOCK_KERNEL=y -CONFIG_INIT_ENV_ARG_LIMIT=32 - -# -# General setup -# -CONFIG_LOCALVERSION="" -CONFIG_LOCALVERSION_AUTO=y -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -# CONFIG_POSIX_MQUEUE is not set -CONFIG_BSD_PROCESS_ACCT=y -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -CONFIG_SYSCTL=y -# CONFIG_AUDIT is not set -CONFIG_HOTPLUG=y -CONFIG_KOBJECT_UEVENT=y -# CONFIG_IKCONFIG is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_EMBEDDED=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -# CONFIG_KALLSYMS_EXTRA_PASS is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 -# CONFIG_TINY_SHMEM is not set -CONFIG_BASE_SMALL=0 - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_KMOD=y - -# -# System Type -# -# CONFIG_ARCH_CLPS7500 is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_CO285 is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_CAMELOT is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_IOP3XX is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_IXP2000 is not set -# CONFIG_ARCH_L7200 is not set -CONFIG_ARCH_PXA=y -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_S3C2410 is not set -# CONFIG_ARCH_SHARK is not set -# CONFIG_ARCH_LH7A40X is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_IMX is not set -# CONFIG_ARCH_H720X is not set -# CONFIG_ARCH_AAEC2000 is not set - -# -# Intel PXA2xx Implementations -# -# CONFIG_ARCH_LUBBOCK is not set -# CONFIG_MACH_MAINSTONE is not set -# CONFIG_ARCH_PXA_IDP is not set -CONFIG_PXA_SHARPSL=y -# CONFIG_PXA_SHARPSL_25x is not set -CONFIG_PXA_SHARPSL_27x=y -CONFIG_MACH_SPITZ=y -CONFIG_MACH_BORZOI=y -CONFIG_PXA27x=y -CONFIG_PXA_SHARP_Cxx00=y - -# -# Processor Type -# -CONFIG_CPU_32=y -CONFIG_CPU_XSCALE=y -CONFIG_CPU_32v5=y -CONFIG_CPU_ABRT_EV5T=y -CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_TLB_V4WBI=y - -# -# Processor Features -# -CONFIG_ARM_THUMB=y -CONFIG_XSCALE_PMU=y -CONFIG_SHARP_PARAM=y -CONFIG_SHARP_SCOOP=y - -# -# Bus support -# -CONFIG_ISA_DMA_API=y - -# -# PCCARD (PCMCIA/CardBus) support -# -CONFIG_PCCARD=y -# CONFIG_PCMCIA_DEBUG is not set -CONFIG_PCMCIA=y -CONFIG_PCMCIA_LOAD_CIS=y -CONFIG_PCMCIA_IOCTL=y - -# -# PC-card bridges -# -CONFIG_PCMCIA_PXA2XX=y - -# -# Kernel Features -# -CONFIG_PREEMPT=y -# CONFIG_NO_IDLE_HZ is not set -# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_FLATMEM_MANUAL=y -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_SPARSEMEM_MANUAL is not set -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_SPARSEMEM_STATIC is not set -CONFIG_ALIGNMENT_TRAP=y - -# -# Boot options -# -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug" -# CONFIG_XIP_KERNEL is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -CONFIG_FPE_NWFPE=y -# CONFIG_FPE_NWFPE_XP is not set -# CONFIG_FPE_FASTFPE is not set - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_BINFMT_AOUT=m -CONFIG_BINFMT_MISC=m -# CONFIG_ARTHUR is not set - -# -# Power management options -# -CONFIG_PM=y -CONFIG_APM=y - -# -# Networking -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -CONFIG_PACKET_MMAP=y -CONFIG_UNIX=y -CONFIG_XFRM=y -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -# CONFIG_IP_MULTICAST is not set -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_FIB_HASH=y -# CONFIG_IP_PNP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_TUNNEL is not set -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_BIC=y - -# -# IP: Virtual Server Configuration -# -# CONFIG_IP_VS is not set -CONFIG_IPV6=m -# CONFIG_IPV6_PRIVACY is not set -CONFIG_INET6_AH=m -CONFIG_INET6_ESP=m -CONFIG_INET6_IPCOMP=m -CONFIG_INET6_TUNNEL=m -CONFIG_IPV6_TUNNEL=m -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_NETFILTER_NETLINK is not set - -# -# IP: Netfilter Configuration -# -CONFIG_IP_NF_CONNTRACK=m -# CONFIG_IP_NF_CT_ACCT is not set -# CONFIG_IP_NF_CONNTRACK_MARK is not set -# CONFIG_IP_NF_CONNTRACK_EVENTS is not set -CONFIG_IP_NF_CT_PROTO_SCTP=m -CONFIG_IP_NF_FTP=m -CONFIG_IP_NF_IRC=m -# CONFIG_IP_NF_NETBIOS_NS is not set -CONFIG_IP_NF_TFTP=m -CONFIG_IP_NF_AMANDA=m -# CONFIG_IP_NF_PPTP is not set -CONFIG_IP_NF_QUEUE=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_LIMIT=m -CONFIG_IP_NF_MATCH_IPRANGE=m -CONFIG_IP_NF_MATCH_MAC=m -CONFIG_IP_NF_MATCH_PKTTYPE=m -CONFIG_IP_NF_MATCH_MARK=m -CONFIG_IP_NF_MATCH_MULTIPORT=m -CONFIG_IP_NF_MATCH_TOS=m -CONFIG_IP_NF_MATCH_RECENT=m -CONFIG_IP_NF_MATCH_ECN=m -CONFIG_IP_NF_MATCH_DSCP=m -CONFIG_IP_NF_MATCH_AH_ESP=m -CONFIG_IP_NF_MATCH_LENGTH=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_MATCH_TCPMSS=m -CONFIG_IP_NF_MATCH_HELPER=m -CONFIG_IP_NF_MATCH_STATE=m -CONFIG_IP_NF_MATCH_CONNTRACK=m -CONFIG_IP_NF_MATCH_OWNER=m -CONFIG_IP_NF_MATCH_ADDRTYPE=m -CONFIG_IP_NF_MATCH_REALM=m -CONFIG_IP_NF_MATCH_SCTP=m -# CONFIG_IP_NF_MATCH_DCCP is not set -CONFIG_IP_NF_MATCH_COMMENT=m -CONFIG_IP_NF_MATCH_HASHLIMIT=m -# CONFIG_IP_NF_MATCH_STRING is not set -CONFIG_IP_NF_FILTER=m -# CONFIG_IP_NF_TARGET_REJECT is not set -CONFIG_IP_NF_TARGET_LOG=m -CONFIG_IP_NF_TARGET_ULOG=m -CONFIG_IP_NF_TARGET_TCPMSS=m -# CONFIG_IP_NF_TARGET_NFQUEUE is not set -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_NAT_NEEDED=y -# CONFIG_IP_NF_TARGET_MASQUERADE is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_SAME is not set -# CONFIG_IP_NF_NAT_SNMP_BASIC is not set -CONFIG_IP_NF_NAT_IRC=m -CONFIG_IP_NF_NAT_FTP=m -CONFIG_IP_NF_NAT_TFTP=m -CONFIG_IP_NF_NAT_AMANDA=m -CONFIG_IP_NF_MANGLE=m -# CONFIG_IP_NF_TARGET_TOS is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_DSCP is not set -# CONFIG_IP_NF_TARGET_MARK is not set -# CONFIG_IP_NF_TARGET_CLASSIFY is not set -# CONFIG_IP_NF_TARGET_TTL is not set -CONFIG_IP_NF_RAW=m -# CONFIG_IP_NF_TARGET_NOTRACK is not set -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARP_MANGLE=m - -# -# IPv6: Netfilter Configuration (EXPERIMENTAL) -# -CONFIG_IP6_NF_QUEUE=m -CONFIG_IP6_NF_IPTABLES=m -CONFIG_IP6_NF_MATCH_LIMIT=m -CONFIG_IP6_NF_MATCH_MAC=m -CONFIG_IP6_NF_MATCH_RT=m -CONFIG_IP6_NF_MATCH_OPTS=m -CONFIG_IP6_NF_MATCH_FRAG=m -CONFIG_IP6_NF_MATCH_HL=m -CONFIG_IP6_NF_MATCH_MULTIPORT=m -CONFIG_IP6_NF_MATCH_OWNER=m -CONFIG_IP6_NF_MATCH_MARK=m -CONFIG_IP6_NF_MATCH_IPV6HEADER=m -CONFIG_IP6_NF_MATCH_AHESP=m -CONFIG_IP6_NF_MATCH_LENGTH=m -CONFIG_IP6_NF_MATCH_EUI64=m -CONFIG_IP6_NF_FILTER=m -# CONFIG_IP6_NF_TARGET_LOG is not set -# CONFIG_IP6_NF_TARGET_REJECT is not set -# CONFIG_IP6_NF_TARGET_NFQUEUE is not set -CONFIG_IP6_NF_MANGLE=m -# CONFIG_IP6_NF_TARGET_MARK is not set -# CONFIG_IP6_NF_TARGET_HL is not set -CONFIG_IP6_NF_RAW=m - -# -# DCCP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_DCCP is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_BRIDGE is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_DECNET is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_SCHED is not set -CONFIG_NET_CLS_ROUTE=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -CONFIG_IRDA=m - -# -# IrDA protocols -# -CONFIG_IRLAN=m -CONFIG_IRNET=m -CONFIG_IRCOMM=m -# CONFIG_IRDA_ULTRA is not set - -# -# IrDA options -# -# CONFIG_IRDA_CACHE_LAST_LSAP is not set -# CONFIG_IRDA_FAST_RR is not set -# CONFIG_IRDA_DEBUG is not set - -# -# Infrared-port device drivers -# - -# -# SIR device drivers -# -# CONFIG_IRTTY_SIR is not set - -# -# Dongle support -# - -# -# Old SIR device drivers -# -# CONFIG_IRPORT_SIR is not set - -# -# Old Serial dongle support -# - -# -# FIR device drivers -# -# CONFIG_USB_IRDA is not set -# CONFIG_SIGMATEL_FIR is not set -# CONFIG_NSC_FIR is not set -# CONFIG_WINBOND_FIR is not set -# CONFIG_SMC_IRCC_FIR is not set -# CONFIG_ALI_FIR is not set -# CONFIG_VIA_FIR is not set -CONFIG_BT=m -CONFIG_BT_L2CAP=m -CONFIG_BT_SCO=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=m -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_HIDP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIUSB=m -# CONFIG_BT_HCIUSB_SCO is not set -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_BCSP_TXCRC=y -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBPA10X=m -CONFIG_BT_HCIBFUSB=m -CONFIG_BT_HCIDTL1=m -CONFIG_BT_HCIBT3C=m -CONFIG_BT_HCIBLUECARD=m -CONFIG_BT_HCIBTUART=m -CONFIG_BT_HCIVHCI=m -CONFIG_IEEE80211=m -# CONFIG_IEEE80211_DEBUG is not set -CONFIG_IEEE80211_CRYPT_WEP=m -# CONFIG_IEEE80211_CRYPT_CCMP is not set -# CONFIG_IEEE80211_CRYPT_TKIP is not set - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -# CONFIG_DEBUG_DRIVER is not set - -# -# Memory Technology Devices (MTD) -# -CONFIG_MTD=y -# CONFIG_MTD_DEBUG is not set -# CONFIG_MTD_CONCAT is not set -CONFIG_MTD_PARTITIONS=y -# CONFIG_MTD_REDBOOT_PARTS is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_AFS_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_CHAR=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set - -# -# RAM/ROM/Flash chip drivers -# -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -# CONFIG_MTD_RAM is not set -CONFIG_MTD_ROM=y -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -CONFIG_MTD_COMPLEX_MAPPINGS=y -CONFIG_MTD_SHARP_SL=y -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLKMTD is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOC2001PLUS is not set - -# -# NAND Flash Device Drivers -# -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_VERIFY_WRITE=y -# CONFIG_MTD_NAND_H1900 is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_DISKONCHIP is not set -CONFIG_MTD_NAND_SHARPSL=y -# CONFIG_MTD_NAND_NANDSIM is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Plug and Play support -# - -# -# Block devices -# -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_UB is not set -# CONFIG_BLK_DEV_RAM is not set -CONFIG_BLK_DEV_RAM_COUNT=16 -# CONFIG_CDROM_PKTCDVD is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_ATA_OVER_ETH is not set - -# -# ATA/ATAPI/MFM/RLL support -# -CONFIG_IDE=y -CONFIG_BLK_DEV_IDE=y - -# -# Please see Documentation/ide.txt for help/info on IDE drives -# -# CONFIG_BLK_DEV_IDE_SATA is not set -CONFIG_BLK_DEV_IDEDISK=y -# CONFIG_IDEDISK_MULTI_MODE is not set -CONFIG_BLK_DEV_IDECS=y -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set -# CONFIG_BLK_DEV_IDESCSI is not set -# CONFIG_IDE_TASK_IOCTL is not set - -# -# IDE chipset support/bugfixes -# -CONFIG_IDE_GENERIC=y -# CONFIG_IDE_ARM is not set -# CONFIG_BLK_DEV_IDEDMA is not set -# CONFIG_IDEDMA_AUTO is not set -# CONFIG_BLK_DEV_HD is not set - -# -# SCSI device support -# -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=m -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=m -CONFIG_CHR_DEV_ST=m -CONFIG_CHR_DEV_OSST=m -CONFIG_BLK_DEV_SR=m -# CONFIG_BLK_DEV_SR_VENDOR is not set -CONFIG_CHR_DEV_SG=m -# CONFIG_CHR_DEV_SCH is not set - -# -# Some SCSI devices (e.g. CD jukebox) support multiple LUNs -# -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set - -# -# SCSI Transport Attributes -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_SAS_ATTRS is not set - -# -# SCSI low-level drivers -# -# CONFIG_SCSI_SATA is not set -# CONFIG_SCSI_DEBUG is not set - -# -# PCMCIA SCSI adapter support -# -# CONFIG_PCMCIA_AHA152X is not set -# CONFIG_PCMCIA_FDOMAIN is not set -# CONFIG_PCMCIA_NINJA_SCSI is not set -# CONFIG_PCMCIA_QLOGIC is not set -# CONFIG_PCMCIA_SYM53C500 is not set - -# -# Multi-device support (RAID and LVM) -# -# CONFIG_MD is not set - -# -# Fusion MPT device support -# -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# - -# -# I2O device support -# - -# -# Network device support -# -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set - -# -# PHY device support -# -# CONFIG_PHYLIB is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -CONFIG_MII=m -# CONFIG_SMC91X is not set -# CONFIG_DM9000 is not set - -# -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# - -# -# Token Ring devices -# - -# -# Wireless LAN (non-hamradio) -# -CONFIG_NET_RADIO=y - -# -# Obsolete Wireless cards support (pre-802.11) -# -# CONFIG_STRIP is not set -# CONFIG_PCMCIA_WAVELAN is not set -# CONFIG_PCMCIA_NETWAVE is not set - -# -# Wireless 802.11 Frequency Hopping cards support -# -# CONFIG_PCMCIA_RAYCS is not set - -# -# Wireless 802.11b ISA/PCI cards support -# -CONFIG_HERMES=m -# CONFIG_ATMEL is not set - -# -# Wireless 802.11b Pcmcia/Cardbus cards support -# -CONFIG_PCMCIA_HERMES=m -CONFIG_PCMCIA_SPECTRUM=m -# CONFIG_AIRO_CS is not set -# CONFIG_PCMCIA_WL3501 is not set -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y -CONFIG_HOSTAP_CS=m -CONFIG_NET_WIRELESS=y - -# -# PCMCIA network device support -# -CONFIG_NET_PCMCIA=y -# CONFIG_PCMCIA_3C589 is not set -# CONFIG_PCMCIA_3C574 is not set -# CONFIG_PCMCIA_FMVJ18X is not set -CONFIG_PCMCIA_PCNET=m -# CONFIG_PCMCIA_NMCLAN is not set -# CONFIG_PCMCIA_SMC91C92 is not set -# CONFIG_PCMCIA_XIRC2PS is not set -# CONFIG_PCMCIA_AXNET is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set -CONFIG_PPP=m -# CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPP_DEFLATE is not set -CONFIG_PPP_BSDCOMP=m -# CONFIG_PPPOE is not set -# CONFIG_SLIP is not set -# CONFIG_SHAPER is not set -# CONFIG_NETCONSOLE is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set - -# -# ISDN subsystem -# -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_TSDEV is not set -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_CORGI is not set -CONFIG_KEYBOARD_SPITZ=y -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_JOYSTICK is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_CORGI=y -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -CONFIG_INPUT_MISC=y -CONFIG_INPUT_UINPUT=m - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -# CONFIG_SERIAL_NONSTANDARD is not set - -# -# Serial drivers -# -CONFIG_SERIAL_8250=m -CONFIG_SERIAL_8250_CS=m -CONFIG_SERIAL_8250_NR_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_PXA=y -CONFIG_SERIAL_PXA_CONSOLE=y -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set - -# -# IPMI -# -# CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -# CONFIG_RTC is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set - -# -# Ftape, the floppy tape device driver -# - -# -# PCMCIA character devices -# -# CONFIG_SYNCLINK_CS is not set -# CONFIG_RAW_DRIVER is not set - -# -# TPM devices -# - -# -# I2C support -# -# CONFIG_I2C is not set - -# -# Hardware Monitoring support -# -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Misc devices -# - -# -# Multimedia Capabilities Port drivers -# - -# -# Multimedia devices -# -# CONFIG_VIDEO_DEV is not set - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set - -# -# Graphics support -# -CONFIG_FB=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_SOFT_CURSOR=y -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set -CONFIG_FB_PXA=y -# CONFIG_FB_W100 is not set -# CONFIG_FB_PXA_PARAMETERS is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_VIRTUAL is not set - -# -# Console display driver support -# -# CONFIG_VGA_CONSOLE is not set -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FONTS=y -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -# CONFIG_FONT_6x11 is not set -# CONFIG_FONT_7x14 is not set -# CONFIG_FONT_PEARL_8x8 is not set -# CONFIG_FONT_ACORN_8x8 is not set -# CONFIG_FONT_MINI_4x6 is not set -# CONFIG_FONT_SUN8x16 is not set -# CONFIG_FONT_SUN12x22 is not set -# CONFIG_FONT_10x18 is not set - -# -# Logo configuration -# -# CONFIG_LOGO is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_DEVICE=y -CONFIG_LCD_CLASS_DEVICE=y -CONFIG_LCD_DEVICE=y -CONFIG_BACKLIGHT_CORGI=y - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# USB support -# -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB=m -# CONFIG_USB_DEBUG is not set - -# -# Miscellaneous USB options -# -CONFIG_USB_DEVICEFS=y -# CONFIG_USB_BANDWIDTH is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_SUSPEND is not set -# CONFIG_USB_OTG is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_ISP116X_HCD is not set -CONFIG_USB_OHCI_HCD=m -# CONFIG_USB_OHCI_BIG_ENDIAN is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SL811_HCD=m -CONFIG_USB_SL811_CS=m - -# -# USB Device Class drivers -# - -# -# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem -# -CONFIG_USB_ACM=m -CONFIG_USB_PRINTER=m - -# -# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information -# -CONFIG_USB_STORAGE=m -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_DPCM is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set - -# -# USB Input Devices -# -CONFIG_USB_HID=m -CONFIG_USB_HIDINPUT=y -# CONFIG_HID_FF is not set -# CONFIG_USB_HIDDEV is not set - -# -# USB HID Boot Protocol drivers -# -CONFIG_USB_KBD=m -CONFIG_USB_MOUSE=m -CONFIG_USB_AIPTEK=m -CONFIG_USB_WACOM=m -# CONFIG_USB_ACECAD is not set -CONFIG_USB_KBTAB=m -CONFIG_USB_POWERMATE=m -CONFIG_USB_MTOUCH=m -# CONFIG_USB_ITMTOUCH is not set -CONFIG_USB_EGALAX=m -# CONFIG_USB_YEALINK is not set -CONFIG_USB_XPAD=m -CONFIG_USB_ATI_REMOTE=m -# CONFIG_USB_KEYSPAN_REMOTE is not set -# CONFIG_USB_APPLETOUCH is not set - -# -# USB Imaging devices -# -CONFIG_USB_MDC800=m -CONFIG_USB_MICROTEK=m - -# -# USB Multimedia devices -# -CONFIG_USB_DABUSB=m - -# -# Video4Linux support is needed for USB Multimedia device support -# - -# -# USB Network Adapters -# -CONFIG_USB_CATC=m -CONFIG_USB_KAWETH=m -CONFIG_USB_PEGASUS=m -CONFIG_USB_RTL8150=m -CONFIG_USB_USBNET=m -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_GL620A is not set -CONFIG_USB_NET_NET1080=m -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_RNDIS_HOST is not set -# CONFIG_USB_NET_CDC_SUBSET is not set -CONFIG_USB_NET_ZAURUS=m -# CONFIG_USB_ZD1201 is not set -CONFIG_USB_MON=y - -# -# USB port drivers -# - -# -# USB Serial Converter support -# -CONFIG_USB_SERIAL=m -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_AIRPRIME is not set -CONFIG_USB_SERIAL_BELKIN=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -# CONFIG_USB_SERIAL_CP2101 is not set -CONFIG_USB_SERIAL_CYPRESS_M8=m -CONFIG_USB_SERIAL_EMPEG=m -CONFIG_USB_SERIAL_FTDI_SIO=m -CONFIG_USB_SERIAL_VISOR=m -CONFIG_USB_SERIAL_IPAQ=m -CONFIG_USB_SERIAL_IR=m -CONFIG_USB_SERIAL_EDGEPORT=m -CONFIG_USB_SERIAL_EDGEPORT_TI=m -CONFIG_USB_SERIAL_GARMIN=m -CONFIG_USB_SERIAL_IPW=m -CONFIG_USB_SERIAL_KEYSPAN_PDA=m -CONFIG_USB_SERIAL_KEYSPAN=m -# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set -CONFIG_USB_SERIAL_KLSI=m -CONFIG_USB_SERIAL_KOBIL_SCT=m -CONFIG_USB_SERIAL_MCT_U232=m -CONFIG_USB_SERIAL_PL2303=m -# CONFIG_USB_SERIAL_HP4X is not set -CONFIG_USB_SERIAL_SAFE=m -# CONFIG_USB_SERIAL_SAFE_PADDED is not set -CONFIG_USB_SERIAL_TI=m -CONFIG_USB_SERIAL_CYBERJACK=m -CONFIG_USB_SERIAL_XIRCOM=m -# CONFIG_USB_SERIAL_OPTION is not set -CONFIG_USB_SERIAL_OMNINET=m -CONFIG_USB_EZUSB=y - -# -# USB Miscellaneous drivers -# -CONFIG_USB_EMI62=m -CONFIG_USB_EMI26=m -CONFIG_USB_AUERSWALD=m -CONFIG_USB_RIO500=m -CONFIG_USB_LEGOTOWER=m -CONFIG_USB_LCD=m -CONFIG_USB_LED=m -CONFIG_USB_CYTHERM=m -CONFIG_USB_PHIDGETKIT=m -CONFIG_USB_PHIDGETSERVO=m -CONFIG_USB_IDMOUSE=m -# CONFIG_USB_LD is not set -# CONFIG_USB_TEST is not set - -# -# USB DSL modem support -# - -# -# USB Gadget Support -# -CONFIG_USB_GADGET=m -# CONFIG_USB_GADGET_DEBUG_FILES is not set -CONFIG_USB_GADGET_SELECTED=y -# CONFIG_USB_GADGET_NET2280 is not set -# CONFIG_USB_GADGET_PXA2XX is not set -# CONFIG_USB_GADGET_GOKU is not set -# CONFIG_USB_GADGET_LH7A40X is not set -# CONFIG_USB_GADGET_OMAP is not set -CONFIG_USB_GADGET_DUMMY_HCD=y -CONFIG_USB_DUMMY_HCD=m -CONFIG_USB_GADGET_DUALSPEED=y -CONFIG_USB_ZERO=m -CONFIG_USB_ETH=m -CONFIG_USB_ETH_RNDIS=y -CONFIG_USB_GADGETFS=m -CONFIG_USB_FILE_STORAGE=m -# CONFIG_USB_FILE_STORAGE_TEST is not set -CONFIG_USB_G_SERIAL=m - -# -# MMC/SD Card support -# -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -CONFIG_MMC_BLOCK=y -CONFIG_MMC_PXA=y -# CONFIG_MMC_WBSD is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -# CONFIG_EXT2_FS_XIP is not set -CONFIG_EXT3_FS=y -# CONFIG_EXT3_FS_XATTR is not set -CONFIG_JBD=y -# CONFIG_JBD_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -CONFIG_FS_POSIX_ACL=y -# CONFIG_XFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_ROMFS_FS is not set -CONFIG_INOTIFY=y -# CONFIG_QUOTA is not set -CONFIG_DNOTIFY=y -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_FUSE_FS is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -CONFIG_MSDOS_FS=y -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS_FS is not set -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_WRITEBUFFER=y -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_ZLIB=y -CONFIG_JFFS2_RTIME=y -CONFIG_JFFS2_RUBIN=y -# CONFIG_JFFS2_CMODE_NONE is not set -CONFIG_JFFS2_CMODE_PRIORITY=y -# CONFIG_JFFS2_CMODE_SIZE is not set -CONFIG_CRAMFS=m -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=m -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -# CONFIG_NFS_DIRECTIO is not set -# CONFIG_NFSD is not set -CONFIG_LOCKD=m -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=m -CONFIG_SUNRPC_GSS=m -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_RPCSEC_GSS_SPKM3 is not set -CONFIG_SMB_FS=m -CONFIG_SMB_NLS_DEFAULT=y -CONFIG_SMB_NLS_REMOTE="cp437" -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_9P_FS is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_MAC_PARTITION is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_EFI_PARTITION is not set - -# -# Native Language Support -# -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="cp437" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ASCII is not set -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -CONFIG_NLS_UTF8=y - -# -# Profiling support -# -CONFIG_PROFILING=y -CONFIG_OPROFILE=m - -# -# Kernel hacking -# -# CONFIG_PRINTK_TIME is not set -CONFIG_DEBUG_KERNEL=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_DETECT_SOFTLOCKUP=y -# CONFIG_SCHEDSTATS is not set -# CONFIG_DEBUG_SLAB is not set -# CONFIG_DEBUG_PREEMPT is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_SPINLOCK_SLEEP is not set -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_FS is not set -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_USER is not set -# CONFIG_DEBUG_WAITQ is not set -CONFIG_DEBUG_ERRORS=y -CONFIG_DEBUG_LL=y -# CONFIG_DEBUG_ICEDCC is not set - -# -# Security options -# -# CONFIG_KEYS is not set -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -CONFIG_CRYPTO=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=m -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=m -CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_WP512=m -# CONFIG_CRYPTO_TGR192 is not set -CONFIG_CRYPTO_DES=m -CONFIG_CRYPTO_BLOWFISH=m -CONFIG_CRYPTO_TWOFISH=m -CONFIG_CRYPTO_SERPENT=m -CONFIG_CRYPTO_AES=m -CONFIG_CRYPTO_CAST5=m -CONFIG_CRYPTO_CAST6=m -CONFIG_CRYPTO_TEA=m -CONFIG_CRYPTO_ARC4=m -CONFIG_CRYPTO_KHAZAD=m -CONFIG_CRYPTO_ANUBIS=m -CONFIG_CRYPTO_DEFLATE=m -CONFIG_CRYPTO_MICHAEL_MIC=m -CONFIG_CRYPTO_CRC32C=m -CONFIG_CRYPTO_TEST=m - -# -# Hardware crypto devices -# - -# -# Library routines -# -CONFIG_CRC_CCITT=y -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -CONFIG_LIBCRC32C=m -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y diff --git a/trunk/arch/arm/kernel/armksyms.c b/trunk/arch/arm/kernel/armksyms.c index 7b17a87a3311..835d450797a1 100644 --- a/trunk/arch/arm/kernel/armksyms.c +++ b/trunk/arch/arm/kernel/armksyms.c @@ -45,8 +45,8 @@ extern void fp_enter(void); #define EXPORT_SYMBOL_ALIAS(sym,orig) \ EXPORT_CRC_ALIAS(sym) \ - static const struct kernel_symbol __ksymtab_##sym \ - __attribute_used__ __attribute__((section("__ksymtab"))) = \ + const struct kernel_symbol __ksymtab_##sym \ + __attribute__((section("__ksymtab"))) = \ { (unsigned long)&orig, #sym }; /* diff --git a/trunk/arch/arm/kernel/entry-armv.S b/trunk/arch/arm/kernel/entry-armv.S index 93b5e8e5292e..7152bfbee581 100644 --- a/trunk/arch/arm/kernel/entry-armv.S +++ b/trunk/arch/arm/kernel/entry-armv.S @@ -537,7 +537,7 @@ ENTRY(__switch_to) #ifdef CONFIG_CPU_MPCORE clrex #else - strex r5, r4, [ip] @ Clear exclusive monitor + strex r3, r4, [ip] @ Clear exclusive monitor #endif #endif #if defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_IWMMXT) diff --git a/trunk/arch/arm/kernel/entry-common.S b/trunk/arch/arm/kernel/entry-common.S index 066597f4345a..81d450ac3fab 100644 --- a/trunk/arch/arm/kernel/entry-common.S +++ b/trunk/arch/arm/kernel/entry-common.S @@ -106,10 +106,15 @@ ENTRY(ret_from_fork) .endm .Larm700bug: + ldr r0, [sp, #S_PSR] @ Get calling cpsr + sub lr, lr, #4 + str lr, [r8] + msr spsr_cxsf, r0 ldmia sp, {r0 - lr}^ @ Get calling r0 - lr mov r0, r0 + ldr lr, [sp, #S_PC] @ Get PC add sp, sp, #S_FRAME_SIZE - subs pc, lr, #4 + movs pc, lr #else .macro arm710_bug_check, instr, temp .endm diff --git a/trunk/arch/arm/kernel/io.c b/trunk/arch/arm/kernel/io.c index 1f6822dfae74..6c20c1188b60 100644 --- a/trunk/arch/arm/kernel/io.c +++ b/trunk/arch/arm/kernel/io.c @@ -7,7 +7,7 @@ * Copy data from IO memory space to "real" memory space. * This needs to be optimized. */ -void _memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) +void _memcpy_fromio(void *to, void __iomem *from, size_t count) { unsigned char *t = to; while (count) { @@ -22,7 +22,7 @@ void _memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) * Copy data from "real" memory space to IO memory space. * This needs to be optimized. */ -void _memcpy_toio(volatile void __iomem *to, const void *from, size_t count) +void _memcpy_toio(void __iomem *to, const void *from, size_t count) { const unsigned char *f = from; while (count) { @@ -37,7 +37,7 @@ void _memcpy_toio(volatile void __iomem *to, const void *from, size_t count) * "memset" on IO memory space. * This needs to be optimized. */ -void _memset_io(volatile void __iomem *dst, int c, size_t count) +void _memset_io(void __iomem *dst, int c, size_t count) { while (count) { count--; diff --git a/trunk/arch/arm/kernel/sys_arm.c b/trunk/arch/arm/kernel/sys_arm.c index ea569ba482b1..42629ff84f5a 100644 --- a/trunk/arch/arm/kernel/sys_arm.c +++ b/trunk/arch/arm/kernel/sys_arm.c @@ -305,7 +305,7 @@ long execve(const char *filename, char **argv, char **envp) "Ir" (THREAD_START_SP - sizeof(regs)), "r" (®s), "Ir" (sizeof(regs)) - : "r0", "r1", "r2", "r3", "ip", "lr", "memory"); + : "r0", "r1", "r2", "r3", "ip", "memory"); out: return ret; diff --git a/trunk/arch/arm/kernel/traps.c b/trunk/arch/arm/kernel/traps.c index f6de76e0a45d..e7d22dbcb691 100644 --- a/trunk/arch/arm/kernel/traps.c +++ b/trunk/arch/arm/kernel/traps.c @@ -504,7 +504,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) bad_access: spin_unlock(&mm->page_table_lock); - /* simulate a write access fault */ + /* simulate a read access fault */ do_DataAbort(addr, 15 + (1 << 11), regs); return -1; } diff --git a/trunk/arch/arm/kernel/vmlinux.lds.S b/trunk/arch/arm/kernel/vmlinux.lds.S index 0d5db5279c5c..08e58ecd44be 100644 --- a/trunk/arch/arm/kernel/vmlinux.lds.S +++ b/trunk/arch/arm/kernel/vmlinux.lds.S @@ -89,6 +89,13 @@ SECTIONS *(.got) /* Global offset table */ } + . = ALIGN(16); + __ex_table : { /* Exception table */ + __start___ex_table = .; + *(__ex_table) + __stop___ex_table = .; + } + RODATA _etext = .; /* End of text and rodata section */ @@ -130,14 +137,6 @@ SECTIONS . = ALIGN(32); *(.data.cacheline_aligned) - /* - * The exception fixup table (might need resorting at runtime) - */ - . = ALIGN(32); - __start___ex_table = .; - *(__ex_table) - __stop___ex_table = .; - /* * and the usual data section */ diff --git a/trunk/arch/arm/mach-clps711x/fortunet.c b/trunk/arch/arm/mach-clps711x/fortunet.c index 3d88da0c287b..f83a59761e02 100644 --- a/trunk/arch/arm/mach-clps711x/fortunet.c +++ b/trunk/arch/arm/mach-clps711x/fortunet.c @@ -31,8 +31,6 @@ #include -#include - #include "common.h" struct meminfo memmap = { diff --git a/trunk/arch/arm/mach-imx/generic.c b/trunk/arch/arm/mach-imx/generic.c index f8a742bb2d5b..41e5849ae8da 100644 --- a/trunk/arch/arm/mach-imx/generic.c +++ b/trunk/arch/arm/mach-imx/generic.c @@ -28,15 +28,14 @@ #include #include #include -#include #include void imx_gpio_mode(int gpio_mode) { unsigned int pin = gpio_mode & GPIO_PIN_MASK; - unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT; - unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT; + unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> 5; + unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> 10; unsigned int tmp; /* Pullup enable */ @@ -58,7 +57,7 @@ void imx_gpio_mode(int gpio_mode) GPR(port) &= ~(1<> GPIO_AOUT_SHIFT) & 3) << (pin * 2); - ICONFB1(port) &= ~( 3<<(pin*2)); - ICONFB1(port) |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2); + if( gpio_mode & GPIO_AOUT ) + ICONFA1(port) &= ~( 3<<(pin*2)); + if( gpio_mode & GPIO_BOUT ) + ICONFB1(port) &= ~( 3<<(pin*2)); } else { tmp = OCR2(port); tmp &= ~( 3<<((pin-16)*2)); tmp |= (ocr << ((pin-16)*2)); OCR2(port) = tmp; - ICONFA2(port) &= ~( 3<<((pin-16)*2)); - ICONFA2(port) |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << ((pin-16) * 2); - ICONFB2(port) &= ~( 3<<((pin-16)*2)); - ICONFB2(port) |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << ((pin-16) * 2); + if( gpio_mode & GPIO_AOUT ) + ICONFA2(port) &= ~( 3<<((pin-16)*2)); + if( gpio_mode & GPIO_BOUT ) + ICONFB2(port) &= ~( 3<<((pin-16)*2)); } } diff --git a/trunk/arch/arm/mach-imx/leds-mx1ads.c b/trunk/arch/arm/mach-imx/leds-mx1ads.c index 79236404aec2..e6399b06e4a4 100644 --- a/trunk/arch/arm/mach-imx/leds-mx1ads.c +++ b/trunk/arch/arm/mach-imx/leds-mx1ads.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "leds.h" /* diff --git a/trunk/arch/arm/mach-imx/mx1ads.c b/trunk/arch/arm/mach-imx/mx1ads.c index a7511ddfe364..5d25434d332c 100644 --- a/trunk/arch/arm/mach-imx/mx1ads.c +++ b/trunk/arch/arm/mach-imx/mx1ads.c @@ -55,7 +55,7 @@ static void __init mx1ads_init(void) { #ifdef CONFIG_LEDS - imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2); + imx_gpio_mode(GPIO_PORTA | GPIO_OUT | GPIO_GPIO | 2); #endif platform_add_devices(devices, ARRAY_SIZE(devices)); } diff --git a/trunk/arch/arm/mach-iop3xx/common.c b/trunk/arch/arm/mach-iop3xx/common.c index fdeeef489a73..bda7394ec06c 100644 --- a/trunk/arch/arm/mach-iop3xx/common.c +++ b/trunk/arch/arm/mach-iop3xx/common.c @@ -27,6 +27,7 @@ unsigned long iop3xx_pcibios_min_mem = 0; /* * Default power-off for EP80219 */ +#include static inline void ep80219_send_to_pic(__u8 c) { } diff --git a/trunk/arch/arm/mach-iop3xx/iop321-time.c b/trunk/arch/arm/mach-iop3xx/iop321-time.c index d67ac0e5d438..0039793b694a 100644 --- a/trunk/arch/arm/mach-iop3xx/iop321-time.c +++ b/trunk/arch/arm/mach-iop3xx/iop321-time.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/arm/mach-iop3xx/iop331-time.c b/trunk/arch/arm/mach-iop3xx/iop331-time.c index 3c1f0ebbd636..8eddfac7e2b0 100644 --- a/trunk/arch/arm/mach-iop3xx/iop331-time.c +++ b/trunk/arch/arm/mach-iop3xx/iop331-time.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/arm/mach-iop3xx/iq31244-mm.c b/trunk/arch/arm/mach-iop3xx/iq31244-mm.c index 55992ab586ba..b01042f7de71 100644 --- a/trunk/arch/arm/mach-iop3xx/iq31244-mm.c +++ b/trunk/arch/arm/mach-iop3xx/iq31244-mm.c @@ -21,6 +21,7 @@ #include #include +#include /* diff --git a/trunk/arch/arm/mach-iop3xx/iq80321-mm.c b/trunk/arch/arm/mach-iop3xx/iq80321-mm.c index bb3e9e5a9aff..1580c7ed2b9d 100644 --- a/trunk/arch/arm/mach-iop3xx/iq80321-mm.c +++ b/trunk/arch/arm/mach-iop3xx/iq80321-mm.c @@ -21,6 +21,7 @@ #include #include +#include /* diff --git a/trunk/arch/arm/mach-iop3xx/iq80331-mm.c b/trunk/arch/arm/mach-iop3xx/iq80331-mm.c index 129eb49b0670..ee8c333e115f 100644 --- a/trunk/arch/arm/mach-iop3xx/iq80331-mm.c +++ b/trunk/arch/arm/mach-iop3xx/iq80331-mm.c @@ -21,6 +21,7 @@ #include #include +#include /* diff --git a/trunk/arch/arm/mach-iop3xx/iq80332-mm.c b/trunk/arch/arm/mach-iop3xx/iq80332-mm.c index 2feaf7591f53..084afcdfb1eb 100644 --- a/trunk/arch/arm/mach-iop3xx/iq80332-mm.c +++ b/trunk/arch/arm/mach-iop3xx/iq80332-mm.c @@ -21,6 +21,7 @@ #include #include +#include /* diff --git a/trunk/arch/arm/mach-ixp2000/core.c b/trunk/arch/arm/mach-ixp2000/core.c index f4d7f1f6ef85..74bd2fd602d4 100644 --- a/trunk/arch/arm/mach-ixp2000/core.c +++ b/trunk/arch/arm/mach-ixp2000/core.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -167,7 +168,7 @@ static struct plat_serial8250_port ixp2000_serial_port[] = { static struct resource ixp2000_uart_resource = { .start = IXP2000_UART_PHYS_BASE, - .end = IXP2000_UART_PHYS_BASE + 0x1f, + .end = IXP2000_UART_PHYS_BASE + 0xffff, .flags = IORESOURCE_MEM, }; diff --git a/trunk/arch/arm/mach-ixp2000/pci.c b/trunk/arch/arm/mach-ixp2000/pci.c index 522205acb316..0788fb2b5c10 100644 --- a/trunk/arch/arm/mach-ixp2000/pci.c +++ b/trunk/arch/arm/mach-ixp2000/pci.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/arm/mach-ixp4xx/common.c b/trunk/arch/arm/mach-ixp4xx/common.c index 36b6045213ee..52ad11328e96 100644 --- a/trunk/arch/arm/mach-ixp4xx/common.c +++ b/trunk/arch/arm/mach-ixp4xx/common.c @@ -125,8 +125,7 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type) } else if (type & IRQT_LOW) { int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW; irq_type = IXP4XX_IRQ_LEVEL; - } else - return -EINVAL; + } ixp4xx_config_irq(irq, irq_type); @@ -143,8 +142,6 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type) /* Set the new style */ *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE)); - - return 0; } static void ixp4xx_irq_mask(unsigned int irq) diff --git a/trunk/arch/arm/mach-ixp4xx/ixdp425-setup.c b/trunk/arch/arm/mach-ixp4xx/ixdp425-setup.c index 0a41080d2266..39b06ed80646 100644 --- a/trunk/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/trunk/arch/arm/mach-ixp4xx/ixdp425-setup.c @@ -123,7 +123,7 @@ static void __init ixdp425_init(void) platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices)); } -#ifdef CONFIG_ARCH_IXDP425 +#ifdef CONFIG_ARCH_IXDP465 MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") /* Maintainer: MontaVista Software, Inc. */ .phys_ram = PHYS_OFFSET, diff --git a/trunk/arch/arm/mach-l7200/core.c b/trunk/arch/arm/mach-l7200/core.c index 03ed742ae2be..2a7fee2a7635 100644 --- a/trunk/arch/arm/mach-l7200/core.c +++ b/trunk/arch/arm/mach-l7200/core.c @@ -7,17 +7,12 @@ */ #include #include -#include -#include -#include -#include #include #include -#include #include -#include +#include /* * IRQ base register @@ -53,12 +48,6 @@ static void l7200_unmask_irq(unsigned int irq) { IRQ_ENABLE = 1 << irq; } - -static struct irqchip l7200_irq_chip = { - .ack = l7200_mask_irq, - .mask = l7200_mask_irq, - .unmask = l7200_unmask_irq -}; static void __init l7200_init_irq(void) { @@ -68,9 +57,11 @@ static void __init l7200_init_irq(void) FIQ_ENABLECLEAR = 0xffffffff; /* clear all fast interrupt enables */ for (irq = 0; irq < NR_IRQS; irq++) { - set_irq_chip(irq, &l7200_irq_chip); - set_irq_flags(irq, IRQF_VALID); - set_irq_handler(irq, do_level_IRQ); + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = l7200_mask_irq; + irq_desc[irq].mask = l7200_mask_irq; + irq_desc[irq].unmask = l7200_unmask_irq; } init_FIQ(); diff --git a/trunk/arch/arm/mach-pxa/corgi.c b/trunk/arch/arm/mach-pxa/corgi.c index 60c8b9d8bb9c..be37586cb1b0 100644 --- a/trunk/arch/arm/mach-pxa/corgi.c +++ b/trunk/arch/arm/mach-pxa/corgi.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include diff --git a/trunk/arch/arm/mach-pxa/corgi_lcd.c b/trunk/arch/arm/mach-pxa/corgi_lcd.c index 850538fadece..c5efcd04fcbc 100644 --- a/trunk/arch/arm/mach-pxa/corgi_lcd.c +++ b/trunk/arch/arm/mach-pxa/corgi_lcd.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -467,7 +468,6 @@ void corgi_put_hsync(void) { if (get_hsync_time) symbol_put(w100fb_get_hsynclen); - get_hsync_time = NULL; } void corgi_wait_hsync(void) @@ -477,37 +477,20 @@ void corgi_wait_hsync(void) #endif #ifdef CONFIG_PXA_SHARP_Cxx00 -static struct device *spitz_pxafb_dev; - -static int is_pxafb_device(struct device * dev, void * data) -{ - struct platform_device *pdev = container_of(dev, struct platform_device, dev); - - return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0); -} - unsigned long spitz_get_hsync_len(void) { - if (!spitz_pxafb_dev) { - spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device); - if (!spitz_pxafb_dev) - return 0; - } if (!get_hsync_time) get_hsync_time = symbol_get(pxafb_get_hsync_time); if (!get_hsync_time) return 0; - return pxafb_get_hsync_time(spitz_pxafb_dev); + return pxafb_get_hsync_time(&pxafb_device.dev); } void spitz_put_hsync(void) { - put_device(spitz_pxafb_dev); if (get_hsync_time) symbol_put(pxafb_get_hsync_time); - spitz_pxafb_dev = NULL; - get_hsync_time = NULL; } void spitz_wait_hsync(void) diff --git a/trunk/arch/arm/mach-pxa/generic.c b/trunk/arch/arm/mach-pxa/generic.c index d327c127eddb..a45aaa115a76 100644 --- a/trunk/arch/arm/mach-pxa/generic.c +++ b/trunk/arch/arm/mach-pxa/generic.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "generic.h" @@ -208,11 +207,6 @@ static struct platform_device pxafb_device = { .resource = pxafb_resources, }; -void __init set_pxa_fb_parent(struct device *parent_dev) -{ - pxafb_device.dev.parent = parent_dev; -} - static struct platform_device ffuart_device = { .name = "pxa2xx-uart", .id = 0, diff --git a/trunk/arch/arm/mach-pxa/spitz.c b/trunk/arch/arm/mach-pxa/spitz.c index d0ab428c2d7d..568afe3d6e1a 100644 --- a/trunk/arch/arm/mach-pxa/spitz.c +++ b/trunk/arch/arm/mach-pxa/spitz.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -303,6 +304,7 @@ static struct platform_device *devices[] __initdata = { &spitzkbd_device, &spitzts_device, &spitzbl_device, + &spitzbattery_device, }; static void __init common_init(void) @@ -326,7 +328,7 @@ static void __init common_init(void) platform_add_devices(devices, ARRAY_SIZE(devices)); pxa_set_mci_info(&spitz_mci_platform_data); - set_pxa_fb_parent(&spitzssp_device.dev); + pxafb_device.dev.parent = &spitzssp_device.dev; set_pxa_fb_info(&spitz_pxafb_info); } diff --git a/trunk/arch/arm/mach-s3c2410/Kconfig b/trunk/arch/arm/mach-s3c2410/Kconfig index c796bcdd6158..06807c6ee68a 100644 --- a/trunk/arch/arm/mach-s3c2410/Kconfig +++ b/trunk/arch/arm/mach-s3c2410/Kconfig @@ -12,7 +12,6 @@ config MACH_ANUBIS config ARCH_BAST bool "Simtec Electronics BAST (EB2410ITX)" select CPU_S3C2410 - select ISA help Say Y here if you are using the Simtec Electronics EB2410ITX development board (also known as BAST) diff --git a/trunk/arch/arm/mach-s3c2410/mach-anubis.c b/trunk/arch/arm/mach-s3c2410/mach-anubis.c index 5ae80f4e3e67..7c05f27fe1d6 100644 --- a/trunk/arch/arm/mach-s3c2410/mach-anubis.c +++ b/trunk/arch/arm/mach-s3c2410/mach-anubis.c @@ -125,7 +125,7 @@ static int external_map[] = { 2 }; static int chip0_map[] = { 0 }; static int chip1_map[] = { 1 }; -static struct mtd_partition anubis_default_nand_part[] = { +struct mtd_partition anubis_default_nand_part[] = { [0] = { .name = "Boot Agent", .size = SZ_16K, diff --git a/trunk/arch/arm/mach-s3c2410/mach-bast.c b/trunk/arch/arm/mach-s3c2410/mach-bast.c index 8ca955984645..ed1f07d7252f 100644 --- a/trunk/arch/arm/mach-s3c2410/mach-bast.c +++ b/trunk/arch/arm/mach-s3c2410/mach-bast.c @@ -230,7 +230,7 @@ static int chip0_map[] = { 1 }; static int chip1_map[] = { 2 }; static int chip2_map[] = { 3 }; -static struct mtd_partition bast_default_nand_part[] = { +struct mtd_partition bast_default_nand_part[] = { [0] = { .name = "Boot Agent", .size = SZ_16K, @@ -340,7 +340,7 @@ static struct resource bast_dm9k_resource[] = { * better IO routines can be written and tested */ -static struct dm9000_plat_data bast_dm9k_platdata = { +struct dm9000_plat_data bast_dm9k_platdata = { .flags = DM9000_PLATF_16BITONLY }; diff --git a/trunk/arch/arm/mach-s3c2410/mach-vr1000.c b/trunk/arch/arm/mach-s3c2410/mach-vr1000.c index 46b259673c18..663a7f98fc0b 100644 --- a/trunk/arch/arm/mach-s3c2410/mach-vr1000.c +++ b/trunk/arch/arm/mach-s3c2410/mach-vr1000.c @@ -288,7 +288,7 @@ static struct resource vr1000_dm9k1_resource[] = { * better IO routines can be written and tested */ -static struct dm9000_plat_data vr1000_dm9k_platdata = { +struct dm9000_plat_data vr1000_dm9k_platdata = { .flags = DM9000_PLATF_16BITONLY, }; diff --git a/trunk/arch/arm/mach-s3c2410/s3c2410.c b/trunk/arch/arm/mach-s3c2410/s3c2410.c index a8bf5ec82602..0b88993dfd27 100644 --- a/trunk/arch/arm/mach-s3c2410/s3c2410.c +++ b/trunk/arch/arm/mach-s3c2410/s3c2410.c @@ -125,6 +125,9 @@ static struct platform_device *uart_devices[] __initdata = { &s3c_uart2 }; +/* store our uart devices for the serial driver console */ +struct platform_device *s3c2410_uart_devices[3]; + static int s3c2410_uart_count = 0; /* uart registration process */ diff --git a/trunk/arch/arm/mach-s3c2410/s3c2440.c b/trunk/arch/arm/mach-s3c2410/s3c2440.c index 833fa36bce05..d4c8281b55f6 100644 --- a/trunk/arch/arm/mach-s3c2410/s3c2440.c +++ b/trunk/arch/arm/mach-s3c2410/s3c2440.c @@ -151,7 +151,7 @@ void __init s3c2440_init_uarts(struct s3c2410_uartcfg *cfg, int no) #ifdef CONFIG_PM -static struct sleep_save s3c2440_sleep[] = { +struct sleep_save s3c2440_sleep[] = { SAVE_ITEM(S3C2440_DSC0), SAVE_ITEM(S3C2440_DSC1), SAVE_ITEM(S3C2440_GPJDAT), @@ -260,7 +260,7 @@ void __init s3c2440_init_clocks(int xtal) * as a driver which may support both 2410 and 2440 may try and use it. */ -static int __init s3c2440_core_init(void) +int __init s3c2440_core_init(void) { return sysdev_class_register(&s3c2440_sysclass); } diff --git a/trunk/arch/arm/mach-s3c2410/time.c b/trunk/arch/arm/mach-s3c2410/time.c index 8a00e3c3cd08..c0acfb2ad790 100644 --- a/trunk/arch/arm/mach-s3c2410/time.c +++ b/trunk/arch/arm/mach-s3c2410/time.c @@ -38,7 +38,6 @@ #include #include "clock.h" -#include "cpu.h" static unsigned long timer_startval; static unsigned long timer_usec_ticks; diff --git a/trunk/arch/arm/mach-s3c2410/usb-simtec.c b/trunk/arch/arm/mach-s3c2410/usb-simtec.c index 5098b50158a3..f021fd82be52 100644 --- a/trunk/arch/arm/mach-s3c2410/usb-simtec.c +++ b/trunk/arch/arm/mach-s3c2410/usb-simtec.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "devs.h" #include "usb-simtec.h" diff --git a/trunk/arch/arm/mach-sa1100/collie.c b/trunk/arch/arm/mach-sa1100/collie.c index 6ecab7e2c238..25d6a4e27533 100644 --- a/trunk/arch/arm/mach-sa1100/collie.c +++ b/trunk/arch/arm/mach-sa1100/collie.c @@ -111,11 +111,11 @@ static struct mtd_partition collie_partitions[] = { static void collie_set_vpp(int vpp) { - write_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR) | COLLIE_SCP_VPEN); + write_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR, read_scoop_reg(SCOOP_GPCR) | COLLIE_SCP_VPEN); if (vpp) - write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR) | COLLIE_SCP_VPEN); + write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(SCOOP_GPWR) | COLLIE_SCP_VPEN); else - write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR) & ~COLLIE_SCP_VPEN); + write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(SCOOP_GPWR) & ~COLLIE_SCP_VPEN); } static struct flash_platform_data collie_flash_data = { diff --git a/trunk/arch/arm/mach-versatile/core.c b/trunk/arch/arm/mach-versatile/core.c index a30e0451df72..3c8862fde51a 100644 --- a/trunk/arch/arm/mach-versatile/core.c +++ b/trunk/arch/arm/mach-versatile/core.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -51,9 +52,8 @@ * * Setup a VA for the Versatile Vectored Interrupt Controller. */ -#define __io_address(n) __io(IO_ADDRESS(n)) -#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) -#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) +#define VA_VIC_BASE IO_ADDRESS(VERSATILE_VIC_BASE) +#define VA_SIC_BASE IO_ADDRESS(VERSATILE_SIC_BASE) static void vic_mask_irq(unsigned int irq) { @@ -214,7 +214,7 @@ void __init versatile_map_io(void) iotable_init(versatile_io_desc, ARRAY_SIZE(versatile_io_desc)); } -#define VERSATILE_REFCOUNTER (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_24MHz_OFFSET) +#define VERSATILE_REFCOUNTER (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_24MHz_OFFSET) /* * This is the Versatile sched_clock implementation. This has @@ -231,7 +231,7 @@ unsigned long long sched_clock(void) } -#define VERSATILE_FLASHCTRL (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET) +#define VERSATILE_FLASHCTRL (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET) static int versatile_flash_init(void) { @@ -309,7 +309,7 @@ static struct platform_device smc91x_device = { .resource = smc91x_resources, }; -#define VERSATILE_SYSMCI (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET) +#define VERSATILE_SYSMCI (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET) unsigned int mmc_status(struct device *dev) { @@ -343,11 +343,11 @@ static const struct icst307_params versatile_oscvco_params = { static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco) { - void __iomem *sys_lock = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET; + unsigned long sys_lock = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET; #if defined(CONFIG_ARCH_VERSATILE_PB) - void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC4_OFFSET; + unsigned long sys_osc = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC4_OFFSET; #elif defined(CONFIG_MACH_VERSATILE_AB) - void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC1_OFFSET; + unsigned long sys_osc = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC1_OFFSET; #endif u32 val; @@ -483,7 +483,7 @@ static struct clcd_panel epson_2_2_in = { */ static struct clcd_panel *versatile_clcd_panel(void) { - void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; + unsigned long sys_clcd = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; struct clcd_panel *panel = &vga; u32 val; @@ -510,7 +510,7 @@ static struct clcd_panel *versatile_clcd_panel(void) */ static void versatile_clcd_disable(struct clcd_fb *fb) { - void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; + unsigned long sys_clcd = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; u32 val; val = readl(sys_clcd); @@ -522,7 +522,7 @@ static void versatile_clcd_disable(struct clcd_fb *fb) * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light off */ if (fb->panel == &sanyo_2_5_in) { - void __iomem *versatile_ib2_ctrl = __io_address(VERSATILE_IB2_CTRL); + unsigned long versatile_ib2_ctrl = IO_ADDRESS(VERSATILE_IB2_CTRL); unsigned long ctrl; ctrl = readl(versatile_ib2_ctrl); @@ -537,7 +537,7 @@ static void versatile_clcd_disable(struct clcd_fb *fb) */ static void versatile_clcd_enable(struct clcd_fb *fb) { - void __iomem *sys_clcd = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; + unsigned long sys_clcd = IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_CLCD_OFFSET; u32 val; val = readl(sys_clcd); @@ -571,7 +571,7 @@ static void versatile_clcd_enable(struct clcd_fb *fb) * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light on */ if (fb->panel == &sanyo_2_5_in) { - void __iomem *versatile_ib2_ctrl = __io_address(VERSATILE_IB2_CTRL); + unsigned long versatile_ib2_ctrl = IO_ADDRESS(VERSATILE_IB2_CTRL); unsigned long ctrl; ctrl = readl(versatile_ib2_ctrl); @@ -720,7 +720,7 @@ static struct amba_device *amba_devs[] __initdata = { }; #ifdef CONFIG_LEDS -#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET) +#define VA_LEDS_BASE (IO_ADDRESS(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET) static void versatile_leds_event(led_event_t ledevt) { @@ -778,11 +778,11 @@ void __init versatile_init(void) /* * Where is the timer (VA)? */ -#define TIMER0_VA_BASE __io_address(VERSATILE_TIMER0_1_BASE) -#define TIMER1_VA_BASE (__io_address(VERSATILE_TIMER0_1_BASE) + 0x20) -#define TIMER2_VA_BASE __io_address(VERSATILE_TIMER2_3_BASE) -#define TIMER3_VA_BASE (__io_address(VERSATILE_TIMER2_3_BASE) + 0x20) -#define VA_IC_BASE __io_address(VERSATILE_VIC_BASE) +#define TIMER0_VA_BASE IO_ADDRESS(VERSATILE_TIMER0_1_BASE) +#define TIMER1_VA_BASE (IO_ADDRESS(VERSATILE_TIMER0_1_BASE) + 0x20) +#define TIMER2_VA_BASE IO_ADDRESS(VERSATILE_TIMER2_3_BASE) +#define TIMER3_VA_BASE (IO_ADDRESS(VERSATILE_TIMER2_3_BASE) + 0x20) +#define VA_IC_BASE IO_ADDRESS(VERSATILE_VIC_BASE) /* * How long is the timer interval? @@ -877,12 +877,12 @@ static void __init versatile_timer_init(void) * VERSATILE_REFCLK is 32KHz * VERSATILE_TIMCLK is 1MHz */ - val = readl(__io_address(VERSATILE_SCTL_BASE)); + val = readl(IO_ADDRESS(VERSATILE_SCTL_BASE)); writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val, - __io_address(VERSATILE_SCTL_BASE)); + IO_ADDRESS(VERSATILE_SCTL_BASE)); /* * Initialise to a known state (all timers off) diff --git a/trunk/arch/arm/mach-versatile/pci.c b/trunk/arch/arm/mach-versatile/pci.c index b80d57d51699..d1565e851f0e 100644 --- a/trunk/arch/arm/mach-versatile/pci.c +++ b/trunk/arch/arm/mach-versatile/pci.c @@ -29,6 +29,7 @@ #include #include #include +#include /* * these spaces are mapped using the following base registers: diff --git a/trunk/arch/arm/mm/Kconfig b/trunk/arch/arm/mm/Kconfig index c54e04c995ee..db5e47dfc303 100644 --- a/trunk/arch/arm/mm/Kconfig +++ b/trunk/arch/arm/mm/Kconfig @@ -370,21 +370,21 @@ config CPU_BIG_ENDIAN config CPU_ICACHE_DISABLE bool "Disable I-Cache" - depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6 + depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 help Say Y here to disable the processor instruction cache. Unless you have a reason not to or are unsure, say N. config CPU_DCACHE_DISABLE bool "Disable D-Cache" - depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6 + depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 help Say Y here to disable the processor data cache. Unless you have a reason not to or are unsure, say N. config CPU_DCACHE_WRITETHROUGH bool "Force write through D-cache" - depends on (CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6) && !CPU_DCACHE_DISABLE + depends on (CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020) && !CPU_DCACHE_DISABLE default y if CPU_ARM925T help Say Y here to use the data cache in writethrough mode. Unless you @@ -399,7 +399,7 @@ config CPU_CACHE_ROUND_ROBIN config CPU_BPREDICT_DISABLE bool "Disable branch prediction" - depends on CPU_ARM1020 || CPU_V6 + depends on CPU_ARM1020 help Say Y here to disable branch prediction. If unsure, say N. diff --git a/trunk/arch/arm/mm/abort-ev6.S b/trunk/arch/arm/mm/abort-ev6.S index dbd346033122..8f76f3df7b4c 100644 --- a/trunk/arch/arm/mm/abort-ev6.S +++ b/trunk/arch/arm/mm/abort-ev6.S @@ -20,11 +20,6 @@ */ .align 5 ENTRY(v6_early_abort) -#ifdef CONFIG_CPU_MPCORE - clrex -#else - strex r0, r1, [sp] @ Clear the exclusive monitor -#endif mrc p15, 0, r1, c5, c0, 0 @ get FSR mrc p15, 0, r0, c6, c0, 0 @ get FAR /* diff --git a/trunk/arch/arm/mm/alignment.c b/trunk/arch/arm/mm/alignment.c index 705c98921c37..4b39d867ac14 100644 --- a/trunk/arch/arm/mm/alignment.c +++ b/trunk/arch/arm/mm/alignment.c @@ -111,7 +111,7 @@ proc_alignment_read(char *page, char **start, off_t off, int count, int *eof, } static int proc_alignment_write(struct file *file, const char __user *buffer, - unsigned long count, void *data) + unsigned long count, void *data) { char mode; @@ -119,7 +119,7 @@ static int proc_alignment_write(struct file *file, const char __user *buffer, if (get_user(mode, buffer)) return -EFAULT; if (mode >= '0' && mode <= '5') - ai_usermode = mode - '0'; + ai_usermode = mode - '0'; } return count; } @@ -262,7 +262,7 @@ union offset_union { goto fault; \ } while (0) -#define put32_unaligned_check(val,addr) \ +#define put32_unaligned_check(val,addr) \ __put32_unaligned_check("strb", val, addr) #define put32t_unaligned_check(val,addr) \ @@ -306,19 +306,19 @@ do_alignment_ldrhstrh(unsigned long addr, unsigned long instr, struct pt_regs *r return TYPE_LDST; user: - if (LDST_L_BIT(instr)) { - unsigned long val; - get16t_unaligned_check(val, addr); + if (LDST_L_BIT(instr)) { + unsigned long val; + get16t_unaligned_check(val, addr); - /* signed half-word? */ - if (instr & 0x40) - val = (signed long)((signed short) val); + /* signed half-word? */ + if (instr & 0x40) + val = (signed long)((signed short) val); - regs->uregs[rd] = val; - } else - put16t_unaligned_check(regs->uregs[rd], addr); + regs->uregs[rd] = val; + } else + put16t_unaligned_check(regs->uregs[rd], addr); - return TYPE_LDST; + return TYPE_LDST; fault: return TYPE_FAULT; @@ -330,9 +330,6 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, { unsigned int rd = RD_BITS(instr); - if (((rd & 1) == 1) || (rd == 14)) - goto bad; - ai_dword += 1; if (user_mode(regs)) @@ -342,11 +339,11 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, unsigned long val; get32_unaligned_check(val, addr); regs->uregs[rd] = val; - get32_unaligned_check(val, addr + 4); - regs->uregs[rd + 1] = val; + get32_unaligned_check(val, addr+4); + regs->uregs[rd+1] = val; } else { put32_unaligned_check(regs->uregs[rd], addr); - put32_unaligned_check(regs->uregs[rd + 1], addr + 4); + put32_unaligned_check(regs->uregs[rd+1], addr+4); } return TYPE_LDST; @@ -356,16 +353,15 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, unsigned long val; get32t_unaligned_check(val, addr); regs->uregs[rd] = val; - get32t_unaligned_check(val, addr + 4); - regs->uregs[rd + 1] = val; + get32t_unaligned_check(val, addr+4); + regs->uregs[rd+1] = val; } else { put32t_unaligned_check(regs->uregs[rd], addr); - put32t_unaligned_check(regs->uregs[rd + 1], addr + 4); + put32t_unaligned_check(regs->uregs[rd+1], addr+4); } return TYPE_LDST; - bad: - return TYPE_ERROR; + fault: return TYPE_FAULT; } @@ -443,7 +439,7 @@ do_alignment_ldmstm(unsigned long addr, unsigned long instr, struct pt_regs *reg if (LDST_P_EQ_U(instr)) /* U = P */ eaddr += 4; - /* + /* * For alignment faults on the ARM922T/ARM920T the MMU makes * the FSR (and hence addr) equal to the updated base address * of the multiple access rather than the restored value. @@ -570,7 +566,7 @@ thumb2arm(u16 tinstr) /* 6.5.1 Format 3: */ case 0x4800 >> 11: /* 7.1.28 LDR(3) */ /* NOTE: This case is not technically possible. We're - * loading 32-bit memory data via PC relative + * loading 32-bit memory data via PC relative * addressing mode. So we can and should eliminate * this case. But I'll leave it here for now. */ @@ -642,7 +638,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) if (fault) { type = TYPE_FAULT; - goto bad_or_fault; + goto bad_or_fault; } if (user_mode(regs)) @@ -667,8 +663,6 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) else if ((instr & 0x001000f0) == 0x000000d0 || /* LDRD */ (instr & 0x001000f0) == 0x000000f0) /* STRD */ handler = do_alignment_ldrdstrd; - else if ((instr & 0x01f00ff0) == 0x01000090) /* SWP */ - goto swp; else goto bad; break; @@ -739,9 +733,6 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) do_bad_area(current, current->mm, addr, fsr, regs); return 0; - swp: - printk(KERN_ERR "Alignment trap: not handling swp instruction\n"); - bad: /* * Oops, we didn't handle the instruction. diff --git a/trunk/arch/arm/mm/cache-v6.S b/trunk/arch/arm/mm/cache-v6.S index 72966d90e956..85c10a71e7c6 100644 --- a/trunk/arch/arm/mm/cache-v6.S +++ b/trunk/arch/arm/mm/cache-v6.S @@ -18,7 +18,6 @@ #define HARVARD_CACHE #define CACHE_LINE_SIZE 32 #define D_CACHE_LINE_SIZE 32 -#define BTB_FLUSH_SIZE 8 /* * v6_flush_cache_all() @@ -99,13 +98,7 @@ ENTRY(v6_coherent_user_range) mcr p15, 0, r0, c7, c5, 1 @ invalidate I line #endif mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry - add r0, r0, #BTB_FLUSH_SIZE - mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry - add r0, r0, #BTB_FLUSH_SIZE - mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry - add r0, r0, #BTB_FLUSH_SIZE - mcr p15, 0, r0, c7, c5, 7 @ invalidate BTB entry - add r0, r0, #BTB_FLUSH_SIZE + add r0, r0, #CACHE_LINE_SIZE cmp r0, r1 blo 1b #ifdef HARVARD_CACHE diff --git a/trunk/arch/arm/mm/flush.c b/trunk/arch/arm/mm/flush.c index c9a03981b785..b0208c992576 100644 --- a/trunk/arch/arm/mm/flush.c +++ b/trunk/arch/arm/mm/flush.c @@ -17,24 +17,6 @@ #ifdef CONFIG_CPU_CACHE_VIPT -#define ALIAS_FLUSH_START 0xffff4000 - -#define TOP_PTE(x) pte_offset_kernel(top_pmd, x) - -static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) -{ - unsigned long to = ALIAS_FLUSH_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); - - set_pte(TOP_PTE(to), pfn_pte(pfn, PAGE_KERNEL)); - flush_tlb_kernel_page(to); - - asm( "mcrr p15, 0, %1, %0, c14\n" - " mcrr p15, 0, %1, %0, c5\n" - : - : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES) - : "cc"); -} - void flush_cache_mm(struct mm_struct *mm) { if (cache_is_vivt()) { @@ -85,6 +67,24 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsig if (cache_is_vipt_aliasing()) flush_pfn_alias(pfn, user_addr); } + +#define ALIAS_FLUSH_START 0xffff4000 + +#define TOP_PTE(x) pte_offset_kernel(top_pmd, x) + +static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) +{ + unsigned long to = ALIAS_FLUSH_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); + + set_pte(TOP_PTE(to), pfn_pte(pfn, PAGE_KERNEL)); + flush_tlb_kernel_page(to); + + asm( "mcrr p15, 0, %1, %0, c14\n" + " mcrr p15, 0, %1, %0, c5\n" + : + : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES) + : "cc"); +} #else #define flush_pfn_alias(pfn,vaddr) do { } while (0) #endif diff --git a/trunk/arch/arm/nwfpe/fpa11.c b/trunk/arch/arm/nwfpe/fpa11.c index 7b3d74d73c80..7690f731ee87 100644 --- a/trunk/arch/arm/nwfpe/fpa11.c +++ b/trunk/arch/arm/nwfpe/fpa11.c @@ -31,6 +31,11 @@ #include #include +/* forward declarations */ +unsigned int EmulateCPDO(const unsigned int); +unsigned int EmulateCPDT(const unsigned int); +unsigned int EmulateCPRT(const unsigned int); + /* Reset the FPA11 chip. Called to initialize and reset the emulator. */ static void resetFPA11(void) { diff --git a/trunk/arch/arm/nwfpe/fpa11.h b/trunk/arch/arm/nwfpe/fpa11.h index 9677ae8448e8..93523ae4b7a1 100644 --- a/trunk/arch/arm/nwfpe/fpa11.h +++ b/trunk/arch/arm/nwfpe/fpa11.h @@ -95,24 +95,4 @@ extern int8 SetRoundingMode(const unsigned int); extern int8 SetRoundingPrecision(const unsigned int); extern void nwfpe_init_fpa(union fp_state *fp); -extern unsigned int EmulateAll(unsigned int opcode); - -extern unsigned int EmulateCPDT(const unsigned int opcode); -extern unsigned int EmulateCPDO(const unsigned int opcode); -extern unsigned int EmulateCPRT(const unsigned int opcode); - -/* fpa11_cpdt.c */ -extern unsigned int PerformLDF(const unsigned int opcode); -extern unsigned int PerformSTF(const unsigned int opcode); -extern unsigned int PerformLFM(const unsigned int opcode); -extern unsigned int PerformSFM(const unsigned int opcode); - -/* single_cpdo.c */ - -extern unsigned int SingleCPDO(struct roundingData *roundData, - const unsigned int opcode, FPREG * rFd); -/* double_cpdo.c */ -extern unsigned int DoubleCPDO(struct roundingData *roundData, - const unsigned int opcode, FPREG * rFd); - #endif diff --git a/trunk/arch/arm/nwfpe/fpa11_cprt.c b/trunk/arch/arm/nwfpe/fpa11_cprt.c index 7c67023655e4..adf8d3000540 100644 --- a/trunk/arch/arm/nwfpe/fpa11_cprt.c +++ b/trunk/arch/arm/nwfpe/fpa11_cprt.c @@ -26,11 +26,12 @@ #include "fpa11.inl" #include "fpmodule.h" #include "fpmodule.inl" -#include "softfloat.h" #ifdef CONFIG_FPE_NWFPE_XP extern flag floatx80_is_nan(floatx80); #endif +extern flag float64_is_nan(float64); +extern flag float32_is_nan(float32); unsigned int PerformFLT(const unsigned int opcode); unsigned int PerformFIX(const unsigned int opcode); diff --git a/trunk/arch/arm/nwfpe/fpopcode.h b/trunk/arch/arm/nwfpe/fpopcode.h index 6528e081c83f..1777e92a88e6 100644 --- a/trunk/arch/arm/nwfpe/fpopcode.h +++ b/trunk/arch/arm/nwfpe/fpopcode.h @@ -476,10 +476,4 @@ static inline unsigned int getDestinationSize(const unsigned int opcode) return (nRc); } -extern unsigned int checkCondition(const unsigned int opcode, - const unsigned int ccodes); - -extern const float64 float64Constant[]; -extern const float32 float32Constant[]; - #endif diff --git a/trunk/arch/arm/nwfpe/softfloat.h b/trunk/arch/arm/nwfpe/softfloat.h index 14151700b6b2..1c8799b9ee4d 100644 --- a/trunk/arch/arm/nwfpe/softfloat.h +++ b/trunk/arch/arm/nwfpe/softfloat.h @@ -265,7 +265,4 @@ static inline flag float64_lt_nocheck(float64 a, float64 b) return (a != b) && (aSign ^ (a < b)); } -extern flag float32_is_nan( float32 a ); -extern flag float64_is_nan( float64 a ); - #endif diff --git a/trunk/arch/arm/plat-omap/common.c b/trunk/arch/arm/plat-omap/common.c index 02bcc6c1cd1b..6cb20aea7f51 100644 --- a/trunk/arch/arm/plat-omap/common.c +++ b/trunk/arch/arm/plat-omap/common.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/arm/plat-omap/cpu-omap.c b/trunk/arch/arm/plat-omap/cpu-omap.c index fd894bb00107..409aac2c4b9d 100644 --- a/trunk/arch/arm/plat-omap/cpu-omap.c +++ b/trunk/arch/arm/plat-omap/cpu-omap.c @@ -21,6 +21,7 @@ #include #include +#include #include #include diff --git a/trunk/arch/arm/plat-omap/usb.c b/trunk/arch/arm/plat-omap/usb.c index 14a836d7ac25..98f1c76f8660 100644 --- a/trunk/arch/arm/plat-omap/usb.c +++ b/trunk/arch/arm/plat-omap/usb.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/arm/tools/mach-types b/trunk/arch/arm/tools/mach-types index ae7c64b8cec3..6d3a79e5fef8 100644 --- a/trunk/arch/arm/tools/mach-types +++ b/trunk/arch/arm/tools/mach-types @@ -2,17 +2,11 @@ # # This file is linux/arch/arm/tools/mach-types # -# Up to date versions of this file can be obtained from: -# -# http://www.arm.linux.org.uk/developer/machines/?action=download -# # Please do not send patches to this file; it is automatically generated! # To add an entry into this database, please see Documentation/arm/README, -# or visit: -# -# http://www.arm.linux.org.uk/developer/machines/?action=new +# or contact rmk@arm.linux.org.uk # -# Last update: Mon Oct 10 09:46:25 2005 +# Last update: Thu Jun 23 20:19:33 2005 # # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number # @@ -427,7 +421,7 @@ mt02 MACH_MT02 MT02 410 mport3s MACH_MPORT3S MPORT3S 411 ra_alpha MACH_RA_ALPHA RA_ALPHA 412 xcep MACH_XCEP XCEP 413 -arcom_vulcan MACH_ARCOM_VULCAN ARCOM_VULCAN 414 +arcom_mercury MACH_ARCOM_MERCURY ARCOM_MERCURY 414 stargate MACH_STARGATE STARGATE 415 armadilloj MACH_ARMADILLOJ ARMADILLOJ 416 elroy_jack MACH_ELROY_JACK ELROY_JACK 417 @@ -460,7 +454,7 @@ esl_sarva MACH_ESL_SARVA ESL_SARVA 443 xm250 MACH_XM250 XM250 444 t6tc1xb MACH_T6TC1XB T6TC1XB 445 ess710 MACH_ESS710 ESS710 446 -mx31ads MACH_MX3ADS MX3ADS 447 +mx3ads MACH_MX3ADS MX3ADS 447 himalaya MACH_HIMALAYA HIMALAYA 448 bolfenk MACH_BOLFENK BOLFENK 449 at91rm9200kr MACH_AT91RM9200KR AT91RM9200KR 450 @@ -793,79 +787,3 @@ ez_ixp42x MACH_EZ_IXP42X EZ_IXP42X 778 tapwave_zodiac MACH_TAPWAVE_ZODIAC TAPWAVE_ZODIAC 779 universalmeter MACH_UNIVERSALMETER UNIVERSALMETER 780 hicoarm9 MACH_HICOARM9 HICOARM9 781 -pnx4008 MACH_PNX4008 PNX4008 782 -kws6000 MACH_KWS6000 KWS6000 783 -portux920t MACH_PORTUX920T PORTUX920T 784 -ez_x5 MACH_EZ_X5 EZ_X5 785 -omap_rudolph MACH_OMAP_RUDOLPH OMAP_RUDOLPH 786 -cpuat91 MACH_CPUAT91 CPUAT91 787 -rea9200 MACH_REA9200 REA9200 788 -acts_pune_sa1110 MACH_ACTS_PUNE_SA1110 ACTS_PUNE_SA1110 789 -ixp425 MACH_IXP425 IXP425 790 -argonplusodyssey MACH_ODYSSEY ODYSSEY 791 -perch MACH_PERCH PERCH 792 -eis05r1 MACH_EIS05R1 EIS05R1 793 -pepperpad MACH_PEPPERPAD PEPPERPAD 794 -sb3010 MACH_SB3010 SB3010 795 -rm9200 MACH_RM9200 RM9200 796 -dma03 MACH_DMA03 DMA03 797 -road_s101 MACH_ROAD_S101 ROAD_S101 798 -iq_nextgen_a MACH_IQ_NEXTGEN_A IQ_NEXTGEN_A 799 -iq_nextgen_b MACH_IQ_NEXTGEN_B IQ_NEXTGEN_B 800 -iq_nextgen_c MACH_IQ_NEXTGEN_C IQ_NEXTGEN_C 801 -iq_nextgen_d MACH_IQ_NEXTGEN_D IQ_NEXTGEN_D 802 -iq_nextgen_e MACH_IQ_NEXTGEN_E IQ_NEXTGEN_E 803 -mallow_at91 MACH_MALLOW_AT91 MALLOW_AT91 804 -cybertracker MACH_CYBERTRACKER CYBERTRACKER 805 -gesbc931x MACH_GESBC931X GESBC931X 806 -centipad MACH_CENTIPAD CENTIPAD 807 -armsoc MACH_ARMSOC ARMSOC 808 -se4200 MACH_SE4200 SE4200 809 -ems197a MACH_EMS197A EMS197A 810 -micro9 MACH_MICRO9 MICRO9 811 -micro9l MACH_MICRO9L MICRO9L 812 -uc5471dsp MACH_UC5471DSP UC5471DSP 813 -sj5471eng MACH_SJ5471ENG SJ5471ENG 814 -none MACH_CMPXA26X CMPXA26X 815 -nc MACH_NC NC 816 -omap_palmte MACH_OMAP_PALMTE OMAP_PALMTE 817 -ajax52x MACH_AJAX52X AJAX52X 818 -siriustar MACH_SIRIUSTAR SIRIUSTAR 819 -iodata_hdlg MACH_IODATA_HDLG IODATA_HDLG 820 -at91rm9200utl MACH_AT91RM9200UTL AT91RM9200UTL 821 -biosafe MACH_BIOSAFE BIOSAFE 822 -mp1000 MACH_MP1000 MP1000 823 -parsy MACH_PARSY PARSY 824 -ccxp270 MACH_CCXP CCXP 825 -omap_gsample MACH_OMAP_GSAMPLE OMAP_GSAMPLE 826 -realview_eb MACH_REALVIEW_EB REALVIEW_EB 827 -samoa MACH_SAMOA SAMOA 828 -t3xscale MACH_T3XSCALE T3XSCALE 829 -i878 MACH_I878 I878 830 -borzoi MACH_BORZOI BORZOI 831 -gecko MACH_GECKO GECKO 832 -ds101 MACH_DS101 DS101 833 -omap_palmtt2 MACH_OMAP_PALMTT2 OMAP_PALMTT2 834 -xscale_palmld MACH_XSCALE_PALMLD XSCALE_PALMLD 835 -cc9c MACH_CC9C CC9C 836 -sbc1670 MACH_SBC1670 SBC1670 837 -ixdp28x5 MACH_IXDP28X5 IXDP28X5 838 -omap_palmtt MACH_OMAP_PALMTT OMAP_PALMTT 839 -ml696k MACH_ML696K ML696K 840 -arcom_zeus MACH_ARCOM_ZEUS ARCOM_ZEUS 841 -osiris MACH_OSIRIS OSIRIS 842 -maestro MACH_MAESTRO MAESTRO 843 -tunge2 MACH_TUNGE2 TUNGE2 844 -ixbbm MACH_IXBBM IXBBM 845 -mx27 MACH_MX27 MX27 846 -ax8004 MACH_AX8004 AX8004 847 -at91sam9261ek MACH_AT91SAM9261EK AT91SAM9261EK 848 -loft MACH_LOFT LOFT 849 -magpie MACH_MAGPIE MAGPIE 850 -mx21 MACH_MX21 MX21 851 -mb87m3400 MACH_MB87M3400 MB87M3400 852 -mguard_delta MACH_MGUARD_DELTA MGUARD_DELTA 853 -davinci_dvdp MACH_DAVINCI_DVDP DAVINCI_DVDP 854 -htcuniversal MACH_HTCUNIVERSAL HTCUNIVERSAL 855 -tpad MACH_TPAD TPAD 856 -roverp3 MACH_ROVERP3 ROVERP3 857 diff --git a/trunk/arch/cris/arch-v32/drivers/pci/dma.c b/trunk/arch/cris/arch-v32/drivers/pci/dma.c index 426b09878a05..10329306d23c 100644 --- a/trunk/arch/cris/arch-v32/drivers/pci/dma.c +++ b/trunk/arch/cris/arch-v32/drivers/pci/dma.c @@ -24,7 +24,7 @@ struct dma_coherent_mem { }; void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp) + dma_addr_t *dma_handle, unsigned int __nocast gfp) { void *ret; struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; diff --git a/trunk/arch/cris/arch-v32/kernel/smp.c b/trunk/arch/cris/arch-v32/kernel/smp.c index 957f551ba5ce..2c5cae04a95c 100644 --- a/trunk/arch/cris/arch-v32/kernel/smp.c +++ b/trunk/arch/cris/arch-v32/kernel/smp.c @@ -15,7 +15,6 @@ #include #include #include -#include #define IPI_SCHEDULE 1 #define IPI_CALL 2 @@ -29,7 +28,6 @@ spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED}; /* CPU masks */ cpumask_t cpu_online_map = CPU_MASK_NONE; cpumask_t phys_cpu_present_map = CPU_MASK_NONE; -EXPORT_SYMBOL(phys_cpu_present_map); /* Variables used during SMP boot */ volatile int cpu_now_booting = 0; diff --git a/trunk/arch/i386/kernel/acpi/boot.c b/trunk/arch/i386/kernel/acpi/boot.c index b66c13c0cc0f..a63351c085c6 100644 --- a/trunk/arch/i386/kernel/acpi/boot.c +++ b/trunk/arch/i386/kernel/acpi/boot.c @@ -27,14 +27,15 @@ #include #include #include +#include #include #include -#include #include #include #include #include +#include #include #ifdef CONFIG_X86_64 diff --git a/trunk/arch/i386/kernel/apic.c b/trunk/arch/i386/kernel/apic.c index 5546ddebec33..a22a866de8f9 100644 --- a/trunk/arch/i386/kernel/apic.c +++ b/trunk/arch/i386/kernel/apic.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/cpu/amd.c b/trunk/arch/i386/kernel/cpu/amd.c index 53a1681cd964..73aeaf5a9d4e 100644 --- a/trunk/arch/i386/kernel/cpu/amd.c +++ b/trunk/arch/i386/kernel/cpu/amd.c @@ -28,22 +28,6 @@ static void __init init_amd(struct cpuinfo_x86 *c) int mbytes = num_physpages >> (20-PAGE_SHIFT); int r; -#ifdef CONFIG_SMP - unsigned long long value; - - /* Disable TLB flush filter by setting HWCR.FFDIS on K8 - * bit 6 of msr C001_0015 - * - * Errata 63 for SH-B3 steppings - * Errata 122 for all steppings (F+ have it disabled by default) - */ - if (c->x86 == 15) { - rdmsrl(MSR_K7_HWCR, value); - value |= 1 << 6; - wrmsrl(MSR_K7_HWCR, value); - } -#endif - /* * FIXME: We should handle the K5 here. Set up the write * range and also turn on MSR 83 bits 4 and 31 (write alloc, diff --git a/trunk/arch/i386/kernel/cpu/mcheck/k7.c b/trunk/arch/i386/kernel/cpu/mcheck/k7.c index 7c6b9c73522f..c4abe7657397 100644 --- a/trunk/arch/i386/kernel/cpu/mcheck/k7.c +++ b/trunk/arch/i386/kernel/cpu/mcheck/k7.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/i386/kernel/cpu/mcheck/non-fatal.c b/trunk/arch/i386/kernel/cpu/mcheck/non-fatal.c index 82dffe0d4954..7864ddfccf07 100644 --- a/trunk/arch/i386/kernel/cpu/mcheck/non-fatal.c +++ b/trunk/arch/i386/kernel/cpu/mcheck/non-fatal.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/cpu/mcheck/p4.c b/trunk/arch/i386/kernel/cpu/mcheck/p4.c index 1d1e885f500a..0abccb6fdf9e 100644 --- a/trunk/arch/i386/kernel/cpu/mcheck/p4.c +++ b/trunk/arch/i386/kernel/cpu/mcheck/p4.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/i386/kernel/cpu/mcheck/p5.c b/trunk/arch/i386/kernel/cpu/mcheck/p5.c index 3a2e24baddc7..ec0614cd2925 100644 --- a/trunk/arch/i386/kernel/cpu/mcheck/p5.c +++ b/trunk/arch/i386/kernel/cpu/mcheck/p5.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/i386/kernel/cpu/mcheck/p6.c b/trunk/arch/i386/kernel/cpu/mcheck/p6.c index 3c035b8fa3d9..f01b73f947e1 100644 --- a/trunk/arch/i386/kernel/cpu/mcheck/p6.c +++ b/trunk/arch/i386/kernel/cpu/mcheck/p6.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/i386/kernel/cpu/mcheck/winchip.c b/trunk/arch/i386/kernel/cpu/mcheck/winchip.c index 5b9d2dd411d3..7bae68fa168f 100644 --- a/trunk/arch/i386/kernel/cpu/mcheck/winchip.c +++ b/trunk/arch/i386/kernel/cpu/mcheck/winchip.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/i386/kernel/crash.c b/trunk/arch/i386/kernel/crash.c index 0248e084017c..913be77bb844 100644 --- a/trunk/arch/i386/kernel/crash.c +++ b/trunk/arch/i386/kernel/crash.c @@ -11,8 +11,10 @@ #include #include #include +#include #include #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/i8259.c b/trunk/arch/i386/kernel/i8259.c index 323ef8ab3244..178f4e9bac9d 100644 --- a/trunk/arch/i386/kernel/i8259.c +++ b/trunk/arch/i386/kernel/i8259.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -24,6 +25,8 @@ #include #include +#include + #include /* diff --git a/trunk/arch/i386/kernel/io_apic.c b/trunk/arch/i386/kernel/io_apic.c index fb3991e8229e..378313b0cce9 100644 --- a/trunk/arch/i386/kernel/io_apic.c +++ b/trunk/arch/i386/kernel/io_apic.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/mpparse.c b/trunk/arch/i386/kernel/mpparse.c index 27aabfceb67e..15949fd08109 100644 --- a/trunk/arch/i386/kernel/mpparse.c +++ b/trunk/arch/i386/kernel/mpparse.c @@ -14,6 +14,7 @@ */ #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/nmi.c b/trunk/arch/i386/kernel/nmi.c index 72515b8a1b12..0178457db721 100644 --- a/trunk/arch/i386/kernel/nmi.c +++ b/trunk/arch/i386/kernel/nmi.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/pci-dma.c b/trunk/arch/i386/kernel/pci-dma.c index 25fe66853934..1e51427cc9eb 100644 --- a/trunk/arch/i386/kernel/pci-dma.c +++ b/trunk/arch/i386/kernel/pci-dma.c @@ -23,7 +23,7 @@ struct dma_coherent_mem { }; void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp) + dma_addr_t *dma_handle, unsigned int __nocast gfp) { void *ret; struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; diff --git a/trunk/arch/i386/kernel/process.c b/trunk/arch/i386/kernel/process.c index 7a14fdfd3af9..b45cbf93d439 100644 --- a/trunk/arch/i386/kernel/process.c +++ b/trunk/arch/i386/kernel/process.c @@ -47,11 +47,13 @@ #include #include #include +#include #include #ifdef CONFIG_MATH_EMULATION #include #endif +#include #include #include diff --git a/trunk/arch/i386/kernel/signal.c b/trunk/arch/i386/kernel/signal.c index adcd069db91e..61eb0c8a6e47 100644 --- a/trunk/arch/i386/kernel/signal.c +++ b/trunk/arch/i386/kernel/signal.c @@ -338,11 +338,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) esp = (unsigned long) ka->sa.sa_restorer; } - esp -= frame_size; - /* Align the stack pointer according to the i386 ABI, - * i.e. so that on function entry ((sp + 4) & 15) == 0. */ - esp = ((esp + 4) & -16ul) - 4; - return (void __user *) esp; + return (void __user *)((esp - frame_size) & -8ul); } /* These symbols are defined with the addresses in the vsyscall page. diff --git a/trunk/arch/i386/kernel/smp.c b/trunk/arch/i386/kernel/smp.c index 218d725a5a1e..48b55db3680f 100644 --- a/trunk/arch/i386/kernel/smp.c +++ b/trunk/arch/i386/kernel/smp.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/smpboot.c b/trunk/arch/i386/kernel/smpboot.c index 1fb26d0e30b6..5f0a95d76a4f 100644 --- a/trunk/arch/i386/kernel/smpboot.c +++ b/trunk/arch/i386/kernel/smpboot.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/timers/timer_pit.c b/trunk/arch/i386/kernel/timers/timer_pit.c index e42e46d35159..eddb64038234 100644 --- a/trunk/arch/i386/kernel/timers/timer_pit.c +++ b/trunk/arch/i386/kernel/timers/timer_pit.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/i386/kernel/traps.c b/trunk/arch/i386/kernel/traps.c index 19e90bdd84ea..431a551e46ea 100644 --- a/trunk/arch/i386/kernel/traps.c +++ b/trunk/arch/i386/kernel/traps.c @@ -52,6 +52,7 @@ #include #include +#include #include #include "mach_traps.h" diff --git a/trunk/arch/i386/mach-default/setup.c b/trunk/arch/i386/mach-default/setup.c index b4a7455c6993..e5a1a83d09ef 100644 --- a/trunk/arch/i386/mach-default/setup.c +++ b/trunk/arch/i386/mach-default/setup.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/i386/mach-visws/setup.c b/trunk/arch/i386/mach-visws/setup.c index 07fac7e749c7..26ada6fc0d77 100644 --- a/trunk/arch/i386/mach-visws/setup.c +++ b/trunk/arch/i386/mach-visws/setup.c @@ -5,6 +5,7 @@ #include #include +#include #include #include diff --git a/trunk/arch/i386/mach-visws/visws_apic.c b/trunk/arch/i386/mach-visws/visws_apic.c index 3e64fb721291..04e6585849a2 100644 --- a/trunk/arch/i386/mach-visws/visws_apic.c +++ b/trunk/arch/i386/mach-visws/visws_apic.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/i386/mach-voyager/setup.c b/trunk/arch/i386/mach-voyager/setup.c index 7d8a3acb9441..df123fc487bb 100644 --- a/trunk/arch/i386/mach-voyager/setup.c +++ b/trunk/arch/i386/mach-voyager/setup.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include diff --git a/trunk/arch/i386/mach-voyager/voyager_basic.c b/trunk/arch/i386/mach-voyager/voyager_basic.c index aa49a33a572c..cc69875d979b 100644 --- a/trunk/arch/i386/mach-voyager/voyager_basic.c +++ b/trunk/arch/i386/mach-voyager/voyager_basic.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/i386/mach-voyager/voyager_smp.c b/trunk/arch/i386/mach-voyager/voyager_smp.c index 72a1b9cae2e4..46b0cf4a31e0 100644 --- a/trunk/arch/i386/mach-voyager/voyager_smp.c +++ b/trunk/arch/i386/mach-voyager/voyager_smp.c @@ -30,6 +30,8 @@ #include #include +#include + /* TLB state -- visible externally, indexed physically */ DEFINE_PER_CPU(struct tlb_state, cpu_tlbstate) ____cacheline_aligned = { &init_mm, 0 }; diff --git a/trunk/arch/i386/mach-voyager/voyager_thread.c b/trunk/arch/i386/mach-voyager/voyager_thread.c index 2b03884fdb2a..a9341b0eebff 100644 --- a/trunk/arch/i386/mach-voyager/voyager_thread.c +++ b/trunk/arch/i386/mach-voyager/voyager_thread.c @@ -31,6 +31,8 @@ #include #include +#include + #define THREAD_NAME "kvoyagerd" /* external variables */ diff --git a/trunk/arch/i386/oprofile/nmi_timer_int.c b/trunk/arch/i386/oprofile/nmi_timer_int.c index 930a1127bb30..ad93cdd55d63 100644 --- a/trunk/arch/i386/oprofile/nmi_timer_int.c +++ b/trunk/arch/i386/oprofile/nmi_timer_int.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/trunk/arch/i386/pci/acpi.c b/trunk/arch/i386/pci/acpi.c index 4c4522b43be5..2941674f35eb 100644 --- a/trunk/arch/i386/pci/acpi.c +++ b/trunk/arch/i386/pci/acpi.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "pci.h" diff --git a/trunk/arch/i386/pci/irq.c b/trunk/arch/i386/pci/irq.c index cddafe33ff7c..326a2edc3834 100644 --- a/trunk/arch/i386/pci/irq.c +++ b/trunk/arch/i386/pci/irq.c @@ -11,11 +11,12 @@ #include #include #include +#include #include #include #include #include -#include +#include #include #include "pci.h" diff --git a/trunk/arch/i386/power/cpu.c b/trunk/arch/i386/power/cpu.c index b27c5acc79d0..7b0b9ad848e5 100644 --- a/trunk/arch/i386/power/cpu.c +++ b/trunk/arch/i386/power/cpu.c @@ -8,8 +8,25 @@ */ #include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include + +#include +#include +#include +#include static struct saved_context saved_context; diff --git a/trunk/arch/ia64/kernel/mca.c b/trunk/arch/ia64/kernel/mca.c index d0a5106fba24..6dc726ad7137 100644 --- a/trunk/arch/ia64/kernel/mca.c +++ b/trunk/arch/ia64/kernel/mca.c @@ -1016,11 +1016,6 @@ ia64_mca_cmc_int_handler(int cmc_irq, void *arg, struct pt_regs *ptregs) cmc_polling_enabled = 1; spin_unlock(&cmc_history_lock); - /* If we're being hit with CMC interrupts, we won't - * ever execute the schedule_work() below. Need to - * disable CMC interrupts on this processor now. - */ - ia64_mca_cmc_vector_disable(NULL); schedule_work(&cmc_disable_work); /* diff --git a/trunk/arch/m32r/Makefile b/trunk/arch/m32r/Makefile index 983d438b14b6..dd4418d846e9 100644 --- a/trunk/arch/m32r/Makefile +++ b/trunk/arch/m32r/Makefile @@ -24,7 +24,7 @@ aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -Wa,-no-bitinst CFLAGS += $(cflags-y) AFLAGS += $(aflags-y) -CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 +CHECKFLAGS := $(CHECK) -D__m32r__ head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o diff --git a/trunk/arch/m32r/kernel/entry.S b/trunk/arch/m32r/kernel/entry.S index 85920fb8d08c..dddbf6b5ed2c 100644 --- a/trunk/arch/m32r/kernel/entry.S +++ b/trunk/arch/m32r/kernel/entry.S @@ -681,15 +681,6 @@ ENTRY(debug_trap) bl do_debug_trap bra error_code -ENTRY(ill_trap) - /* void ill_trap(void) */ - SWITCH_TO_KERNEL_STACK - SAVE_ALL - ldi r1, #0 ; error_code ; FIXME - mv r0, sp ; pt_regs - bl do_ill_trap - bra error_code - /* Cache flushing handler */ ENTRY(cache_flushing_handler) diff --git a/trunk/arch/m32r/kernel/smp.c b/trunk/arch/m32r/kernel/smp.c index 8b1f6eb76870..a4576ac7e870 100644 --- a/trunk/arch/m32r/kernel/smp.c +++ b/trunk/arch/m32r/kernel/smp.c @@ -275,14 +275,12 @@ static void flush_tlb_all_ipi(void *info) *==========================================================================*/ void smp_flush_tlb_mm(struct mm_struct *mm) { - int cpu_id; + int cpu_id = smp_processor_id(); cpumask_t cpu_mask; - unsigned long *mmc; + unsigned long *mmc = &mm->context[cpu_id]; unsigned long flags; preempt_disable(); - cpu_id = smp_processor_id(); - mmc = &mm->context[cpu_id]; cpu_mask = mm->cpu_vm_mask; cpu_clear(cpu_id, cpu_mask); @@ -345,14 +343,12 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) { struct mm_struct *mm = vma->vm_mm; - int cpu_id; + int cpu_id = smp_processor_id(); cpumask_t cpu_mask; - unsigned long *mmc; + unsigned long *mmc = &mm->context[cpu_id]; unsigned long flags; preempt_disable(); - cpu_id = smp_processor_id(); - mmc = &mm->context[cpu_id]; cpu_mask = mm->cpu_vm_mask; cpu_clear(cpu_id, cpu_mask); diff --git a/trunk/arch/m32r/kernel/traps.c b/trunk/arch/m32r/kernel/traps.c index 5fe8ed6d62dc..01922271d17e 100644 --- a/trunk/arch/m32r/kernel/traps.c +++ b/trunk/arch/m32r/kernel/traps.c @@ -5,6 +5,8 @@ * Hitoshi Yamamoto */ +/* $Id$ */ + /* * 'traps.c' handles hardware traps and faults after we have saved some * state in 'entry.S'. @@ -33,7 +35,6 @@ asmlinkage void ei_handler(void); asmlinkage void rie_handler(void); asmlinkage void debug_trap(void); asmlinkage void cache_flushing_handler(void); -asmlinkage void ill_trap(void); #ifdef CONFIG_SMP extern void smp_reschedule_interrupt(void); @@ -76,22 +77,22 @@ void set_eit_vector_entries(void) eit_vector[5] = BRA_INSN(default_eit_handler, 5); eit_vector[8] = BRA_INSN(rie_handler, 8); eit_vector[12] = BRA_INSN(alignment_check, 12); - eit_vector[16] = BRA_INSN(ill_trap, 16); + eit_vector[16] = 0xff000000UL; eit_vector[17] = BRA_INSN(debug_trap, 17); eit_vector[18] = BRA_INSN(system_call, 18); - eit_vector[19] = BRA_INSN(ill_trap, 19); - eit_vector[20] = BRA_INSN(ill_trap, 20); - eit_vector[21] = BRA_INSN(ill_trap, 21); - eit_vector[22] = BRA_INSN(ill_trap, 22); - eit_vector[23] = BRA_INSN(ill_trap, 23); - eit_vector[24] = BRA_INSN(ill_trap, 24); - eit_vector[25] = BRA_INSN(ill_trap, 25); - eit_vector[26] = BRA_INSN(ill_trap, 26); - eit_vector[27] = BRA_INSN(ill_trap, 27); + eit_vector[19] = 0xff000000UL; + eit_vector[20] = 0xff000000UL; + eit_vector[21] = 0xff000000UL; + eit_vector[22] = 0xff000000UL; + eit_vector[23] = 0xff000000UL; + eit_vector[24] = 0xff000000UL; + eit_vector[25] = 0xff000000UL; + eit_vector[26] = 0xff000000UL; + eit_vector[27] = 0xff000000UL; eit_vector[28] = BRA_INSN(cache_flushing_handler, 28); - eit_vector[29] = BRA_INSN(ill_trap, 29); - eit_vector[30] = BRA_INSN(ill_trap, 30); - eit_vector[31] = BRA_INSN(ill_trap, 31); + eit_vector[29] = 0xff000000UL; + eit_vector[30] = 0xff000000UL; + eit_vector[31] = 0xff000000UL; eit_vector[32] = BRA_INSN(ei_handler, 32); eit_vector[64] = BRA_INSN(pie_handler, 64); #ifdef CONFIG_MMU @@ -285,8 +286,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ DO_ERROR( 1, SIGTRAP, "debug trap", debug_trap) DO_ERROR_INFO(0x20, SIGILL, "reserved instruction ", rie_handler, ILL_ILLOPC, regs->bpc) -DO_ERROR_INFO(0x100, SIGILL, "privileged instruction", pie_handler, ILL_PRVOPC, regs->bpc) -DO_ERROR_INFO(-1, SIGILL, "illegal trap", ill_trap, ILL_ILLTRP, regs->bpc) +DO_ERROR_INFO(0x100, SIGILL, "privilege instruction", pie_handler, ILL_PRVOPC, regs->bpc) extern int handle_unaligned_access(unsigned long, struct pt_regs *); @@ -329,3 +329,4 @@ asmlinkage void do_alignment_check(struct pt_regs *regs, long error_code) set_fs(oldfs); } } + diff --git a/trunk/arch/m32r/lib/usercopy.c b/trunk/arch/m32r/lib/usercopy.c index ce16bbe26a52..6c6855f1aa05 100644 --- a/trunk/arch/m32r/lib/usercopy.c +++ b/trunk/arch/m32r/lib/usercopy.c @@ -13,7 +13,7 @@ #include unsigned long -__generic_copy_to_user(void __user *to, const void *from, unsigned long n) +__generic_copy_to_user(void *to, const void *from, unsigned long n) { prefetch(from); if (access_ok(VERIFY_WRITE, to, n)) @@ -22,7 +22,7 @@ __generic_copy_to_user(void __user *to, const void *from, unsigned long n) } unsigned long -__generic_copy_from_user(void *to, const void __user *from, unsigned long n) +__generic_copy_from_user(void *to, const void *from, unsigned long n) { prefetchw(to); if (access_ok(VERIFY_READ, from, n)) @@ -111,7 +111,7 @@ do { \ #endif /* CONFIG_ISA_DUAL_ISSUE */ long -__strncpy_from_user(char *dst, const char __user *src, long count) +__strncpy_from_user(char *dst, const char *src, long count) { long res; __do_strncpy_from_user(dst, src, count, res); @@ -119,7 +119,7 @@ __strncpy_from_user(char *dst, const char __user *src, long count) } long -strncpy_from_user(char *dst, const char __user *src, long count) +strncpy_from_user(char *dst, const char *src, long count) { long res = -EFAULT; if (access_ok(VERIFY_READ, src, 1)) @@ -222,7 +222,7 @@ do { \ #endif /* not CONFIG_ISA_DUAL_ISSUE */ unsigned long -clear_user(void __user *to, unsigned long n) +clear_user(void *to, unsigned long n) { if (access_ok(VERIFY_WRITE, to, n)) __do_clear_user(to, n); @@ -230,7 +230,7 @@ clear_user(void __user *to, unsigned long n) } unsigned long -__clear_user(void __user *to, unsigned long n) +__clear_user(void *to, unsigned long n) { __do_clear_user(to, n); return n; @@ -244,7 +244,7 @@ __clear_user(void __user *to, unsigned long n) #ifdef CONFIG_ISA_DUAL_ISSUE -long strnlen_user(const char __user *s, long n) +long strnlen_user(const char *s, long n) { unsigned long mask = -__addr_ok(s); unsigned long res; @@ -313,7 +313,7 @@ long strnlen_user(const char __user *s, long n) #else /* not CONFIG_ISA_DUAL_ISSUE */ -long strnlen_user(const char __user *s, long n) +long strnlen_user(const char *s, long n) { unsigned long mask = -__addr_ok(s); unsigned long res; diff --git a/trunk/arch/mips/pci/fixup-tb0226.c b/trunk/arch/mips/pci/fixup-tb0226.c index b5d42b12de10..61513d5d97da 100644 --- a/trunk/arch/mips/pci/fixup-tb0226.c +++ b/trunk/arch/mips/pci/fixup-tb0226.c @@ -1,7 +1,7 @@ /* * fixup-tb0226.c, The TANBAC TB0226 specific PCI fixups. * - * Copyright (C) 2002-2005 Yoichi Yuasa + * Copyright (C) 2002-2004 Yoichi Yuasa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,6 @@ #include #include -#include #include int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) @@ -30,42 +29,42 @@ int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) switch (slot) { case 12: vr41xx_set_irq_trigger(GD82559_1_PIN, - IRQ_TRIGGER_LEVEL, - IRQ_SIGNAL_THROUGH); - vr41xx_set_irq_level(GD82559_1_PIN, IRQ_LEVEL_LOW); + TRIGGER_LEVEL, + SIGNAL_THROUGH); + vr41xx_set_irq_level(GD82559_1_PIN, LEVEL_LOW); irq = GD82559_1_IRQ; break; case 13: vr41xx_set_irq_trigger(GD82559_2_PIN, - IRQ_TRIGGER_LEVEL, - IRQ_SIGNAL_THROUGH); - vr41xx_set_irq_level(GD82559_2_PIN, IRQ_LEVEL_LOW); + TRIGGER_LEVEL, + SIGNAL_THROUGH); + vr41xx_set_irq_level(GD82559_2_PIN, LEVEL_LOW); irq = GD82559_2_IRQ; break; case 14: switch (pin) { case 1: vr41xx_set_irq_trigger(UPD720100_INTA_PIN, - IRQ_TRIGGER_LEVEL, - IRQ_SIGNAL_THROUGH); + TRIGGER_LEVEL, + SIGNAL_THROUGH); vr41xx_set_irq_level(UPD720100_INTA_PIN, - IRQ_LEVEL_LOW); + LEVEL_LOW); irq = UPD720100_INTA_IRQ; break; case 2: vr41xx_set_irq_trigger(UPD720100_INTB_PIN, - IRQ_TRIGGER_LEVEL, - IRQ_SIGNAL_THROUGH); + TRIGGER_LEVEL, + SIGNAL_THROUGH); vr41xx_set_irq_level(UPD720100_INTB_PIN, - IRQ_LEVEL_LOW); + LEVEL_LOW); irq = UPD720100_INTB_IRQ; break; case 3: vr41xx_set_irq_trigger(UPD720100_INTC_PIN, - IRQ_TRIGGER_LEVEL, - IRQ_SIGNAL_THROUGH); + TRIGGER_LEVEL, + SIGNAL_THROUGH); vr41xx_set_irq_level(UPD720100_INTC_PIN, - IRQ_LEVEL_LOW); + LEVEL_LOW); irq = UPD720100_INTC_IRQ; break; default: diff --git a/trunk/arch/ppc/boot/ld.script b/trunk/arch/ppc/boot/ld.script index d4dd8f15395e..9362193742ac 100644 --- a/trunk/arch/ppc/boot/ld.script +++ b/trunk/arch/ppc/boot/ld.script @@ -1,4 +1,4 @@ -OUTPUT_ARCH(powerpc:common) +OUTPUT_ARCH(powerpc) SECTIONS { /* Read-only sections, merged into text segment: */ diff --git a/trunk/arch/ppc/kernel/cputable.c b/trunk/arch/ppc/kernel/cputable.c index 6b76cf58d9e0..546e1ea4cafa 100644 --- a/trunk/arch/ppc/kernel/cputable.c +++ b/trunk/arch/ppc/kernel/cputable.c @@ -91,7 +91,7 @@ struct cpu_spec cpu_specs[] = { .cpu_features = CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE, .cpu_user_features = COMMON_PPC | PPC_FEATURE_601_INSTR | - PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB, + PPC_FEATURE_UNIFIED_CACHE, .icache_bsize = 32, .dcache_bsize = 32, .cpu_setup = __setup_cpu_601 @@ -745,8 +745,7 @@ struct cpu_spec cpu_specs[] = { .cpu_name = "403GCX", .cpu_features = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB, - .cpu_user_features = PPC_FEATURE_32 | - PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB, + .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, .icache_bsize = 16, .dcache_bsize = 16, }, diff --git a/trunk/arch/ppc/kernel/dma-mapping.c b/trunk/arch/ppc/kernel/dma-mapping.c index 8edee806dae7..b566d982806c 100644 --- a/trunk/arch/ppc/kernel/dma-mapping.c +++ b/trunk/arch/ppc/kernel/dma-mapping.c @@ -401,10 +401,10 @@ EXPORT_SYMBOL(__dma_sync); static inline void __dma_sync_page_highmem(struct page *page, unsigned long offset, size_t size, int direction) { - size_t seg_size = min((size_t)(PAGE_SIZE - offset), size); + size_t seg_size = min((size_t)PAGE_SIZE, size) - offset; size_t cur_size = seg_size; unsigned long flags, start, seg_offset = offset; - int nr_segs = 1 + ((size - seg_size) + PAGE_SIZE - 1)/PAGE_SIZE; + int nr_segs = PAGE_ALIGN(size + (PAGE_SIZE - offset))/PAGE_SIZE; int seg_nr = 0; local_irq_save(flags); diff --git a/trunk/arch/ppc/kernel/perfmon.c b/trunk/arch/ppc/kernel/perfmon.c index 22df9a596a0f..04c18788e85f 100644 --- a/trunk/arch/ppc/kernel/perfmon.c +++ b/trunk/arch/ppc/kernel/perfmon.c @@ -45,8 +45,9 @@ static void dummy_perf(struct pt_regs *regs) mtpmr(PMRN_PMGC0, pmgc0); } -#elif defined(CONFIG_6xx) +#elif CONFIG_6xx /* Ensure exceptions are disabled */ + static void dummy_perf(struct pt_regs *regs) { unsigned int mmcr0 = mfspr(SPRN_MMCR0); diff --git a/trunk/arch/ppc/platforms/4xx/bamboo.c b/trunk/arch/ppc/platforms/4xx/bamboo.c index 78a403b48dba..ac391d463d78 100644 --- a/trunk/arch/ppc/platforms/4xx/bamboo.c +++ b/trunk/arch/ppc/platforms/4xx/bamboo.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/4xx/ebony.c b/trunk/arch/ppc/platforms/4xx/ebony.c index 27b778ab903b..d6b2b1965dcb 100644 --- a/trunk/arch/ppc/platforms/4xx/ebony.c +++ b/trunk/arch/ppc/platforms/4xx/ebony.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/4xx/luan.c b/trunk/arch/ppc/platforms/4xx/luan.c index 16d953bda22c..a38e6f9ef858 100644 --- a/trunk/arch/ppc/platforms/4xx/luan.c +++ b/trunk/arch/ppc/platforms/4xx/luan.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/4xx/ocotea.c b/trunk/arch/ppc/platforms/4xx/ocotea.c index 506949c5dd29..80028df1b445 100644 --- a/trunk/arch/ppc/platforms/4xx/ocotea.c +++ b/trunk/arch/ppc/platforms/4xx/ocotea.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/83xx/mpc834x_sys.c b/trunk/arch/ppc/platforms/83xx/mpc834x_sys.c index 79b3f533d0a3..b38a851a64ec 100644 --- a/trunk/arch/ppc/platforms/83xx/mpc834x_sys.c +++ b/trunk/arch/ppc/platforms/83xx/mpc834x_sys.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/85xx/mpc8540_ads.c b/trunk/arch/ppc/platforms/85xx/mpc8540_ads.c index 7dc8a68acfd0..f761fdf160db 100644 --- a/trunk/arch/ppc/platforms/85xx/mpc8540_ads.c +++ b/trunk/arch/ppc/platforms/85xx/mpc8540_ads.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/85xx/mpc8560_ads.c b/trunk/arch/ppc/platforms/85xx/mpc8560_ads.c index 8841fd7da6ee..f2748c88665a 100644 --- a/trunk/arch/ppc/platforms/85xx/mpc8560_ads.c +++ b/trunk/arch/ppc/platforms/85xx/mpc8560_ads.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/85xx/mpc85xx_ads_common.c b/trunk/arch/ppc/platforms/85xx/mpc85xx_ads_common.c index bd3ac0136756..18e952d1767c 100644 --- a/trunk/arch/ppc/platforms/85xx/mpc85xx_ads_common.c +++ b/trunk/arch/ppc/platforms/85xx/mpc85xx_ads_common.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/trunk/arch/ppc/platforms/85xx/mpc85xx_cds_common.c index 9f9039498ae5..6267b294f704 100644 --- a/trunk/arch/ppc/platforms/85xx/mpc85xx_cds_common.c +++ b/trunk/arch/ppc/platforms/85xx/mpc85xx_cds_common.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/85xx/sbc8560.c b/trunk/arch/ppc/platforms/85xx/sbc8560.c index c76760a781c1..165df94d4aa6 100644 --- a/trunk/arch/ppc/platforms/85xx/sbc8560.c +++ b/trunk/arch/ppc/platforms/85xx/sbc8560.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/85xx/sbc85xx.c b/trunk/arch/ppc/platforms/85xx/sbc85xx.c index c02f110219f5..4f6d1ddd6fb8 100644 --- a/trunk/arch/ppc/platforms/85xx/sbc85xx.c +++ b/trunk/arch/ppc/platforms/85xx/sbc85xx.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/85xx/stx_gp3.c b/trunk/arch/ppc/platforms/85xx/stx_gp3.c index 20940f4044f4..c99b365d6110 100644 --- a/trunk/arch/ppc/platforms/85xx/stx_gp3.c +++ b/trunk/arch/ppc/platforms/85xx/stx_gp3.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/chestnut.c b/trunk/arch/ppc/platforms/chestnut.c index df6ff98c023a..7786818bd9d0 100644 --- a/trunk/arch/ppc/platforms/chestnut.c +++ b/trunk/arch/ppc/platforms/chestnut.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/chrp_setup.c b/trunk/arch/ppc/platforms/chrp_setup.c index 66346f0de7ec..57f29ab29bda 100644 --- a/trunk/arch/ppc/platforms/chrp_setup.c +++ b/trunk/arch/ppc/platforms/chrp_setup.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/gemini_setup.c b/trunk/arch/ppc/platforms/gemini_setup.c index 3a5ff9fb71d6..e391e52383c7 100644 --- a/trunk/arch/ppc/platforms/gemini_setup.c +++ b/trunk/arch/ppc/platforms/gemini_setup.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/mvme5100.c b/trunk/arch/ppc/platforms/mvme5100.c index ce2ce88c8033..b292b44b760c 100644 --- a/trunk/arch/ppc/platforms/mvme5100.c +++ b/trunk/arch/ppc/platforms/mvme5100.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/pmac_cpufreq.c b/trunk/arch/ppc/platforms/pmac_cpufreq.c index d4bc5f67ec53..c0605244edda 100644 --- a/trunk/arch/ppc/platforms/pmac_cpufreq.c +++ b/trunk/arch/ppc/platforms/pmac_cpufreq.c @@ -695,13 +695,6 @@ static int __init pmac_cpufreq_setup(void) set_speed_proc = pmu_set_cpu_speed; is_pmu_based = 1; } - /* Else check for TiPb 550 */ - else if (machine_is_compatible("PowerBook3,3") && cur_freq == 550000) { - hi_freq = cur_freq; - low_freq = 500000; - set_speed_proc = pmu_set_cpu_speed; - is_pmu_based = 1; - } /* Else check for TiPb 400 & 500 */ else if (machine_is_compatible("PowerBook3,2")) { /* We only know about the 400 MHz and the 500Mhz model diff --git a/trunk/arch/ppc/platforms/pmac_feature.c b/trunk/arch/ppc/platforms/pmac_feature.c index dd6d45ae0501..867336ad5d36 100644 --- a/trunk/arch/ppc/platforms/pmac_feature.c +++ b/trunk/arch/ppc/platforms/pmac_feature.c @@ -2337,10 +2337,6 @@ static struct pmac_mb_def pmac_mb_defs[] __pmacdata = { PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, }, - { "PowerBook6,7", "iBook G4", - PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, - PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, - }, { "PowerBook6,8", "PowerBook G4 12\"", PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, diff --git a/trunk/arch/ppc/platforms/pmac_setup.c b/trunk/arch/ppc/platforms/pmac_setup.c index d6356f480d90..4c56a4734aec 100644 --- a/trunk/arch/ppc/platforms/pmac_setup.c +++ b/trunk/arch/ppc/platforms/pmac_setup.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/pmac_time.c b/trunk/arch/ppc/platforms/pmac_time.c index efb819f9490d..778ce4fec368 100644 --- a/trunk/arch/ppc/platforms/pmac_time.c +++ b/trunk/arch/ppc/platforms/pmac_time.c @@ -195,7 +195,7 @@ via_calibrate_decr(void) ; dend = get_dec(); - tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100); + tb_ticks_per_jiffy = (dstart - dend) / (6 * (HZ/100)); tb_to_us = mulhwu_scale_factor(dstart - dend, 60000); printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n", diff --git a/trunk/arch/ppc/platforms/powerpmc250.c b/trunk/arch/ppc/platforms/powerpmc250.c index e6b520e6e13f..0abe15159e6c 100644 --- a/trunk/arch/ppc/platforms/powerpmc250.c +++ b/trunk/arch/ppc/platforms/powerpmc250.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/pplus.c b/trunk/arch/ppc/platforms/pplus.c index e70aae20d6f9..65705c911795 100644 --- a/trunk/arch/ppc/platforms/pplus.c +++ b/trunk/arch/ppc/platforms/pplus.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/prpmc750.c b/trunk/arch/ppc/platforms/prpmc750.c index 0bb14a5e824c..24ae1caafc61 100644 --- a/trunk/arch/ppc/platforms/prpmc750.c +++ b/trunk/arch/ppc/platforms/prpmc750.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/prpmc800.c b/trunk/arch/ppc/platforms/prpmc800.c index de7baefacd3a..8b09fa69b35b 100644 --- a/trunk/arch/ppc/platforms/prpmc800.c +++ b/trunk/arch/ppc/platforms/prpmc800.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/platforms/radstone_ppc7d.c b/trunk/arch/ppc/platforms/radstone_ppc7d.c index 0376c8cff5d1..c30607a972d8 100644 --- a/trunk/arch/ppc/platforms/radstone_ppc7d.c +++ b/trunk/arch/ppc/platforms/radstone_ppc7d.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,7 @@ #include #include #include +#include #include "radstone_ppc7d.h" diff --git a/trunk/arch/ppc/platforms/sandpoint.c b/trunk/arch/ppc/platforms/sandpoint.c index 5232283c1974..21e31346b12b 100644 --- a/trunk/arch/ppc/platforms/sandpoint.c +++ b/trunk/arch/ppc/platforms/sandpoint.c @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/syslib/mv64x60.c b/trunk/arch/ppc/syslib/mv64x60.c index 4849850a59ed..839f8872826f 100644 --- a/trunk/arch/ppc/syslib/mv64x60.c +++ b/trunk/arch/ppc/syslib/mv64x60.c @@ -34,7 +34,7 @@ u8 mv64x60_pci_exclude_bridge = 1; DEFINE_SPINLOCK(mv64x60_lock); static phys_addr_t mv64x60_bridge_pbase; -static void __iomem *mv64x60_bridge_vbase; +static void *mv64x60_bridge_vbase; static u32 mv64x60_bridge_type = MV64x60_TYPE_INVALID; static u32 mv64x60_bridge_rev; #if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) @@ -938,7 +938,7 @@ mv64x60_setup_for_chip(struct mv64x60_handle *bh) * * Return the virtual address of the bridge's registers. */ -void __iomem * +void * mv64x60_get_bridge_vbase(void) { return mv64x60_bridge_vbase; diff --git a/trunk/arch/ppc/syslib/open_pic.c b/trunk/arch/ppc/syslib/open_pic.c index 1cf5de21a3fd..53da58523e39 100644 --- a/trunk/arch/ppc/syslib/open_pic.c +++ b/trunk/arch/ppc/syslib/open_pic.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/syslib/open_pic2.c b/trunk/arch/ppc/syslib/open_pic2.c index 16cff91d9f41..9a7e8748e2b2 100644 --- a/trunk/arch/ppc/syslib/open_pic2.c +++ b/trunk/arch/ppc/syslib/open_pic2.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc/syslib/ppc4xx_setup.c b/trunk/arch/ppc/syslib/ppc4xx_setup.c index bf83240689dc..b843c4fef25e 100644 --- a/trunk/arch/ppc/syslib/ppc4xx_setup.c +++ b/trunk/arch/ppc/syslib/ppc4xx_setup.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/ppc64/kernel/bpa_iommu.c b/trunk/arch/ppc64/kernel/bpa_iommu.c index 5f2460090e03..f33a7bccb0d7 100644 --- a/trunk/arch/ppc64/kernel/bpa_iommu.c +++ b/trunk/arch/ppc64/kernel/bpa_iommu.c @@ -99,11 +99,7 @@ get_iost_entry(unsigned long iopt_base, unsigned long io_address, unsigned page_ break; default: /* not a known compile time constant */ - { - /* BUILD_BUG_ON() is not usable here */ - extern void __get_iost_entry_bad_page_size(void); - __get_iost_entry_bad_page_size(); - } + BUILD_BUG_ON(1); break; } @@ -310,7 +306,7 @@ static void bpa_map_iommu(void) static void *bpa_alloc_coherent(struct device *hwdev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) + dma_addr_t *dma_handle, unsigned int __nocast flag) { void *ret; diff --git a/trunk/arch/ppc64/kernel/dma.c b/trunk/arch/ppc64/kernel/dma.c index 7c3419656ccc..4da8e31b2b61 100644 --- a/trunk/arch/ppc64/kernel/dma.c +++ b/trunk/arch/ppc64/kernel/dma.c @@ -53,7 +53,7 @@ int dma_set_mask(struct device *dev, u64 dma_mask) EXPORT_SYMBOL(dma_set_mask); void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) + dma_addr_t *dma_handle, unsigned int __nocast flag) { struct dma_mapping_ops *dma_ops = get_dma_ops(dev); diff --git a/trunk/arch/ppc64/kernel/iommu.c b/trunk/arch/ppc64/kernel/iommu.c index 4d9b4388918b..9032b6bfe036 100644 --- a/trunk/arch/ppc64/kernel/iommu.c +++ b/trunk/arch/ppc64/kernel/iommu.c @@ -519,7 +519,7 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, * to the dma address (mapping) of the first page. */ void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, - dma_addr_t *dma_handle, gfp_t flag) + dma_addr_t *dma_handle, unsigned int __nocast flag) { void *ret = NULL; dma_addr_t mapping; diff --git a/trunk/arch/ppc64/kernel/kprobes.c b/trunk/arch/ppc64/kernel/kprobes.c index 9c6facc24f70..7e80d49c589a 100644 --- a/trunk/arch/ppc64/kernel/kprobes.c +++ b/trunk/arch/ppc64/kernel/kprobes.c @@ -59,9 +59,9 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) /* insn must be on a special executable page on ppc64 */ if (!ret) { - down(&kprobe_mutex); - p->ainsn.insn = get_insn_slot(); up(&kprobe_mutex); + p->ainsn.insn = get_insn_slot(); + down(&kprobe_mutex); if (!p->ainsn.insn) ret = -ENOMEM; } @@ -90,9 +90,9 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) void __kprobes arch_remove_kprobe(struct kprobe *p) { - down(&kprobe_mutex); - free_insn_slot(p->ainsn.insn); up(&kprobe_mutex); + free_insn_slot(p->ainsn.insn); + down(&kprobe_mutex); } static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) diff --git a/trunk/arch/ppc64/kernel/machine_kexec.c b/trunk/arch/ppc64/kernel/machine_kexec.c index bf7cc4f8210f..4775f12a013c 100644 --- a/trunk/arch/ppc64/kernel/machine_kexec.c +++ b/trunk/arch/ppc64/kernel/machine_kexec.c @@ -205,7 +205,6 @@ static void kexec_prepare_cpus(void) continue; while (paca[i].hw_cpu_id != -1) { - barrier(); if (!cpu_possible(i)) { printk("kexec: cpu %d hw_cpu_id %d is not" " possible, ignoring\n", diff --git a/trunk/arch/ppc64/kernel/module.c b/trunk/arch/ppc64/kernel/module.c index 928b8581fcb0..c683bf88e690 100644 --- a/trunk/arch/ppc64/kernel/module.c +++ b/trunk/arch/ppc64/kernel/module.c @@ -341,19 +341,6 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, *(unsigned long *)location = my_r2(sechdrs, me); break; - case R_PPC64_TOC16: - /* Subtact TOC pointer */ - value -= my_r2(sechdrs, me); - if (value + 0x8000 > 0xffff) { - printk("%s: bad TOC16 relocation (%lu)\n", - me->name, value); - return -ENOEXEC; - } - *((uint16_t *) location) - = (*((uint16_t *) location) & ~0xffff) - | (value & 0xffff); - break; - case R_PPC64_TOC16_DS: /* Subtact TOC pointer */ value -= my_r2(sechdrs, me); diff --git a/trunk/arch/ppc64/kernel/pSeries_pci.c b/trunk/arch/ppc64/kernel/pSeries_pci.c index 928f8febdb3b..1f5f141fb7a1 100644 --- a/trunk/arch/ppc64/kernel/pSeries_pci.c +++ b/trunk/arch/ppc64/kernel/pSeries_pci.c @@ -32,7 +32,7 @@ #include "pci.h" -static int __devinitdata s7a_workaround = -1; +static int __initdata s7a_workaround = -1; #if 0 void pcibios_name_device(struct pci_dev *dev) @@ -60,7 +60,7 @@ void pcibios_name_device(struct pci_dev *dev) DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device); #endif -static void __devinit check_s7a(void) +static void __init check_s7a(void) { struct device_node *root; char *model; diff --git a/trunk/arch/ppc64/kernel/pci_direct_iommu.c b/trunk/arch/ppc64/kernel/pci_direct_iommu.c index 54055c81017a..b8f7f58824f4 100644 --- a/trunk/arch/ppc64/kernel/pci_direct_iommu.c +++ b/trunk/arch/ppc64/kernel/pci_direct_iommu.c @@ -31,7 +31,7 @@ #include "pci.h" static void *pci_direct_alloc_coherent(struct device *hwdev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) + dma_addr_t *dma_handle, unsigned int __nocast flag) { void *ret; diff --git a/trunk/arch/ppc64/kernel/pci_iommu.c b/trunk/arch/ppc64/kernel/pci_iommu.c index d9e33b7d4203..14647e09c9cd 100644 --- a/trunk/arch/ppc64/kernel/pci_iommu.c +++ b/trunk/arch/ppc64/kernel/pci_iommu.c @@ -76,7 +76,7 @@ static inline struct iommu_table *devnode_table(struct device *dev) * to the dma address (mapping) of the first page. */ static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) + dma_addr_t *dma_handle, unsigned int __nocast flag) { return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle, flag); diff --git a/trunk/arch/ppc64/kernel/pmac_setup.c b/trunk/arch/ppc64/kernel/pmac_setup.c index fa8121d53b89..25755252067a 100644 --- a/trunk/arch/ppc64/kernel/pmac_setup.c +++ b/trunk/arch/ppc64/kernel/pmac_setup.c @@ -115,7 +115,7 @@ static void __pmac pmac_show_cpuinfo(struct seq_file *m) /* find motherboard type */ seq_printf(m, "machine\t\t: "); - np = of_find_node_by_path("/"); + np = find_devices("device-tree"); if (np != NULL) { pp = (char *) get_property(np, "model", NULL); if (pp != NULL) @@ -133,7 +133,6 @@ static void __pmac pmac_show_cpuinfo(struct seq_file *m) } seq_printf(m, "\n"); } - of_node_put(np); } else seq_printf(m, "PowerMac\n"); diff --git a/trunk/arch/ppc64/kernel/vio.c b/trunk/arch/ppc64/kernel/vio.c index 0e555b7a6587..c90e1dd875ce 100644 --- a/trunk/arch/ppc64/kernel/vio.c +++ b/trunk/arch/ppc64/kernel/vio.c @@ -218,7 +218,7 @@ static void vio_unmap_sg(struct device *dev, struct scatterlist *sglist, } static void *vio_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) + dma_addr_t *dma_handle, unsigned int __nocast flag) { return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size, dma_handle, flag); diff --git a/trunk/arch/ppc64/mm/hash_native.c b/trunk/arch/ppc64/mm/hash_native.c index bfd385b7713c..7626bb59954d 100644 --- a/trunk/arch/ppc64/mm/hash_native.c +++ b/trunk/arch/ppc64/mm/hash_native.c @@ -343,7 +343,9 @@ static void native_flush_hash_range(unsigned long context, hpte_t *hptep; unsigned long hpte_v; struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); - unsigned long large = batch->large; + + /* XXX fix for large ptes */ + unsigned long large = 0; local_irq_save(flags); @@ -405,7 +407,7 @@ static void native_flush_hash_range(unsigned long context, asm volatile("ptesync":::"memory"); for (i = 0; i < j; i++) - __tlbie(batch->vaddr[i], large); + __tlbie(batch->vaddr[i], 0); asm volatile("eieio; tlbsync; ptesync":::"memory"); diff --git a/trunk/arch/ppc64/mm/hugetlbpage.c b/trunk/arch/ppc64/mm/hugetlbpage.c index 0ea0994ed974..338771ec70d7 100644 --- a/trunk/arch/ppc64/mm/hugetlbpage.c +++ b/trunk/arch/ppc64/mm/hugetlbpage.c @@ -710,13 +710,10 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access, hpte_group = ((~hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL; slot = ppc_md.hpte_insert(hpte_group, va, prpn, - HPTE_V_LARGE | - HPTE_V_SECONDARY, - rflags); + HPTE_V_LARGE, rflags); if (slot == -1) { if (mftb() & 0x1) - hpte_group = ((hash & htab_hash_mask) * - HPTES_PER_GROUP)&~0x7UL; + hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL; ppc_md.hpte_remove(hpte_group); goto repeat; diff --git a/trunk/arch/ppc64/mm/tlb.c b/trunk/arch/ppc64/mm/tlb.c index 21fbffb23a43..d8a6593a13f0 100644 --- a/trunk/arch/ppc64/mm/tlb.c +++ b/trunk/arch/ppc64/mm/tlb.c @@ -143,8 +143,7 @@ void hpte_update(struct mm_struct *mm, unsigned long addr, * up scanning and resetting referenced bits then our batch context * will change mid stream. */ - if (i != 0 && (context != batch->context || - batch->large != pte_huge(pte))) { + if (unlikely(i != 0 && context != batch->context)) { flush_tlb_pending(); i = 0; } @@ -152,7 +151,6 @@ void hpte_update(struct mm_struct *mm, unsigned long addr, if (i == 0) { batch->context = context; batch->mm = mm; - batch->large = pte_huge(pte); } batch->pte[i] = __pte(pte); batch->addr[i] = addr; diff --git a/trunk/arch/s390/kernel/compat_signal.c b/trunk/arch/s390/kernel/compat_signal.c index 4ff6808456ea..7358cdb8441f 100644 --- a/trunk/arch/s390/kernel/compat_signal.c +++ b/trunk/arch/s390/kernel/compat_signal.c @@ -143,7 +143,7 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) break; case __SI_FAULT >> 16: err |= __get_user(tmp, &from->si_addr); - to->si_addr = (void __user *)(u64) (tmp & PSW32_ADDR_INSN); + to->si_addr = (void *)(u64) (tmp & PSW32_ADDR_INSN); break; case __SI_POLL >> 16: err |= __get_user(to->si_band, &from->si_band); @@ -338,7 +338,7 @@ sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss, err |= __get_user(kss.ss_flags, &uss->ss_flags); if (err) return -EFAULT; - kss.ss_sp = (void __user *) ss_sp; + kss.ss_sp = (void *) ss_sp; } set_fs (KERNEL_DS); @@ -461,7 +461,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) goto badframe; err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); - st.ss_sp = compat_ptr(ss_sp); + st.ss_sp = (void *) A((unsigned long)ss_sp); err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); if (err) diff --git a/trunk/arch/s390/kernel/signal.c b/trunk/arch/s390/kernel/signal.c index 6e0110d71191..6a3f5b7473a9 100644 --- a/trunk/arch/s390/kernel/signal.c +++ b/trunk/arch/s390/kernel/signal.c @@ -376,8 +376,8 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, /* Create the ucontext. */ err |= __put_user(0, &frame->uc.uc_flags); - err |= __put_user(NULL, &frame->uc.uc_link); - err |= __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); + err |= __put_user(0, &frame->uc.uc_link); + err |= __put_user((void *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); err |= __put_user(sas_ss_flags(regs->gprs[15]), &frame->uc.uc_stack.ss_flags); err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); diff --git a/trunk/arch/sh/kernel/smp.c b/trunk/arch/sh/kernel/smp.c index 5ecefc02896a..56a39d69e080 100644 --- a/trunk/arch/sh/kernel/smp.c +++ b/trunk/arch/sh/kernel/smp.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -40,8 +39,6 @@ struct sh_cpuinfo cpu_data[NR_CPUS]; extern void per_cpu_trap_init(void); cpumask_t cpu_possible_map; -EXPORT_SYMBOL(cpu_possible_map); - cpumask_t cpu_online_map; static atomic_t cpus_booted = ATOMIC_INIT(0); diff --git a/trunk/arch/sparc/Kconfig b/trunk/arch/sparc/Kconfig index 6537445dac0e..aba05394d30a 100644 --- a/trunk/arch/sparc/Kconfig +++ b/trunk/arch/sparc/Kconfig @@ -25,6 +25,62 @@ source "init/Kconfig" menu "General machine setup" +config VT + bool + select INPUT + default y + ---help--- + If you say Y here, you will get support for terminal devices with + display and keyboard devices. These are called "virtual" because you + can run several virtual terminals (also called virtual consoles) on + one physical terminal. This is rather useful, for example one + virtual terminal can collect system messages and warnings, another + one can be used for a text-mode user session, and a third could run + an X session, all in parallel. Switching between virtual terminals + is done with certain key combinations, usually Alt-. + + The setterm command ("man setterm") can be used to change the + properties (such as colors or beeping) of a virtual terminal. The + man page console_codes(4) ("man console_codes") contains the special + character sequences that can be used to change those properties + directly. The fonts used on virtual terminals can be changed with + the setfont ("man setfont") command and the key bindings are defined + with the loadkeys ("man loadkeys") command. + + You need at least one virtual terminal device in order to make use + of your keyboard and monitor. Therefore, only people configuring an + embedded system would want to say N here in order to save some + memory; the only way to log into such a system is then via a serial + or network connection. + + If unsure, say Y, or else you won't be able to do much with your new + shiny Linux system :-) + +config VT_CONSOLE + bool + default y + ---help--- + The system console is the device which receives all kernel messages + and warnings and which allows logins in single user mode. If you + answer Y here, a virtual terminal (the device used to interact with + a physical terminal) can be used as system console. This is the most + common mode of operations, so you should say Y here unless you want + the kernel messages be output only to a serial port (in which case + you should say Y to "Console on serial port", below). + + If you do say Y here, by default the currently visible virtual + terminal (/dev/tty0) will be used as system console. You can change + that with a kernel command line option such as "console=tty3" which + would use the third virtual terminal as system console. (Try "man + bootparam" or see the documentation of your boot loader (lilo or + loadlin) about how to pass options to the kernel at boot time.) + + If unsure, say Y. + +config HW_CONSOLE + bool + default y + config SMP bool "Symmetric multi-processing support (does not work on sun4/sun4c)" depends on BROKEN diff --git a/trunk/arch/sparc/kernel/setup.c b/trunk/arch/sparc/kernel/setup.c index 3509e4305532..53c192a4982f 100644 --- a/trunk/arch/sparc/kernel/setup.c +++ b/trunk/arch/sparc/kernel/setup.c @@ -249,6 +249,8 @@ struct tt_entry *sparc_ttable; struct pt_regs fake_swapper_regs; +extern void paging_init(void); + void __init setup_arch(char **cmdline_p) { int i; diff --git a/trunk/arch/sparc/kernel/time.c b/trunk/arch/sparc/kernel/time.c index 279a62627c10..bc015e980341 100644 --- a/trunk/arch/sparc/kernel/time.c +++ b/trunk/arch/sparc/kernel/time.c @@ -457,7 +457,7 @@ void __init time_init(void) sbus_time_init(); } -static inline unsigned long do_gettimeoffset(void) +extern __inline__ unsigned long do_gettimeoffset(void) { return (*master_l10_counter >> 10) & 0x1fffff; } diff --git a/trunk/arch/sparc/mm/srmmu.c b/trunk/arch/sparc/mm/srmmu.c index c664b962987c..c89a803cbc20 100644 --- a/trunk/arch/sparc/mm/srmmu.c +++ b/trunk/arch/sparc/mm/srmmu.c @@ -260,7 +260,7 @@ static inline pte_t srmmu_pte_modify(pte_t pte, pgprot_t newprot) { return __pte((pte_val(pte) & SRMMU_CHG_MASK) | pgprot_val(newprot)); } /* to find an entry in a top-level page table... */ -static inline pgd_t *srmmu_pgd_offset(struct mm_struct * mm, unsigned long address) +extern inline pgd_t *srmmu_pgd_offset(struct mm_struct * mm, unsigned long address) { return mm->pgd + (address >> SRMMU_PGDIR_SHIFT); } /* Find an entry in the second-level page table.. */ diff --git a/trunk/arch/sparc64/Kconfig.debug b/trunk/arch/sparc64/Kconfig.debug index fa06ea04837b..af0e9411b83e 100644 --- a/trunk/arch/sparc64/Kconfig.debug +++ b/trunk/arch/sparc64/Kconfig.debug @@ -33,14 +33,6 @@ config DEBUG_BOOTMEM depends on DEBUG_KERNEL bool "Debug BOOTMEM initialization" -config DEBUG_PAGEALLOC - bool "Page alloc debugging" - depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND - help - Unmap pages from the kernel linear mapping after free_pages(). - This results in a large slowdown, but helps to find certain types - of memory corruptions. - config MCOUNT bool depends on STACK_DEBUG diff --git a/trunk/arch/sparc64/kernel/cpu.c b/trunk/arch/sparc64/kernel/cpu.c index 77ef5df4e5a7..48756958116b 100644 --- a/trunk/arch/sparc64/kernel/cpu.c +++ b/trunk/arch/sparc64/kernel/cpu.c @@ -39,8 +39,6 @@ struct cpu_fp_info linux_sparc_fpu[] = { { 0x3e, 0x15, 0, "UltraSparc III+ integrated FPU"}, { 0x3e, 0x16, 0, "UltraSparc IIIi integrated FPU"}, { 0x3e, 0x18, 0, "UltraSparc IV integrated FPU"}, - { 0x3e, 0x19, 0, "UltraSparc IV+ integrated FPU"}, - { 0x3e, 0x22, 0, "UltraSparc IIIi+ integrated FPU"}, }; #define NSPARCFPU (sizeof(linux_sparc_fpu)/sizeof(struct cpu_fp_info)) @@ -55,8 +53,6 @@ struct cpu_iu_info linux_sparc_chips[] = { { 0x3e, 0x15, "TI UltraSparc III+ (Cheetah+)"}, { 0x3e, 0x16, "TI UltraSparc IIIi (Jalapeno)"}, { 0x3e, 0x18, "TI UltraSparc IV (Jaguar)"}, - { 0x3e, 0x19, "TI UltraSparc IV+ (Panther)"}, - { 0x3e, 0x22, "TI UltraSparc IIIi+ (Serrano)"}, }; #define NSPARCCHIPS (sizeof(linux_sparc_chips)/sizeof(struct cpu_iu_info)) diff --git a/trunk/arch/sparc64/kernel/devices.c b/trunk/arch/sparc64/kernel/devices.c index df9a1ca8fd77..d710274e516b 100644 --- a/trunk/arch/sparc64/kernel/devices.c +++ b/trunk/arch/sparc64/kernel/devices.c @@ -135,28 +135,6 @@ void __init device_scan(void) cpu_data(0).clock_tick = prom_getintdefault(cpu_node, "clock-frequency", 0); - cpu_data(0).dcache_size = prom_getintdefault(cpu_node, - "dcache-size", - 16 * 1024); - cpu_data(0).dcache_line_size = - prom_getintdefault(cpu_node, "dcache-line-size", 32); - cpu_data(0).icache_size = prom_getintdefault(cpu_node, - "icache-size", - 16 * 1024); - cpu_data(0).icache_line_size = - prom_getintdefault(cpu_node, "icache-line-size", 32); - cpu_data(0).ecache_size = prom_getintdefault(cpu_node, - "ecache-size", - 4 * 1024 * 1024); - cpu_data(0).ecache_line_size = - prom_getintdefault(cpu_node, "ecache-line-size", 64); - printk("CPU[0]: Caches " - "D[sz(%d):line_sz(%d)] " - "I[sz(%d):line_sz(%d)] " - "E[sz(%d):line_sz(%d)]\n", - cpu_data(0).dcache_size, cpu_data(0).dcache_line_size, - cpu_data(0).icache_size, cpu_data(0).icache_line_size, - cpu_data(0).ecache_size, cpu_data(0).ecache_line_size); } #endif diff --git a/trunk/arch/sparc64/kernel/dtlb_backend.S b/trunk/arch/sparc64/kernel/dtlb_backend.S index acc889a7f9c1..538522848ad4 100644 --- a/trunk/arch/sparc64/kernel/dtlb_backend.S +++ b/trunk/arch/sparc64/kernel/dtlb_backend.S @@ -9,7 +9,17 @@ #include #include -#define VALID_SZ_BITS (_PAGE_VALID | _PAGE_SZBITS) +#if PAGE_SHIFT == 13 +#define SZ_BITS _PAGE_SZ8K +#elif PAGE_SHIFT == 16 +#define SZ_BITS _PAGE_SZ64K +#elif PAGE_SHIFT == 19 +#define SZ_BITS _PAGE_SZ512K +#elif PAGE_SHIFT == 22 +#define SZ_BITS _PAGE_SZ4MB +#endif + +#define VALID_SZ_BITS (_PAGE_VALID | SZ_BITS) #define VPTE_BITS (_PAGE_CP | _PAGE_CV | _PAGE_P ) #define VPTE_SHIFT (PAGE_SHIFT - 3) @@ -153,6 +163,7 @@ sparc64_vpte_continue: stxa %g4, [%g1 + %g1] ASI_DMMU ! Restore previous TAG_ACCESS retry ! Load PTE once again +#undef SZ_BITS #undef VALID_SZ_BITS #undef VPTE_SHIFT #undef VPTE_BITS diff --git a/trunk/arch/sparc64/kernel/dtlb_base.S b/trunk/arch/sparc64/kernel/dtlb_base.S index 6528786840c0..ded2fed23fcc 100644 --- a/trunk/arch/sparc64/kernel/dtlb_base.S +++ b/trunk/arch/sparc64/kernel/dtlb_base.S @@ -53,36 +53,39 @@ * be guaranteed to be 0 ... mmu_context.h does guarantee this * by only using 10 bits in the hwcontext value. */ -#define CREATE_VPTE_OFFSET1(r1, r2) nop +#define CREATE_VPTE_OFFSET1(r1, r2) #define CREATE_VPTE_OFFSET2(r1, r2) \ srax r1, 10, r2 +#define CREATE_VPTE_NOP nop #else #define CREATE_VPTE_OFFSET1(r1, r2) \ srax r1, PAGE_SHIFT, r2 #define CREATE_VPTE_OFFSET2(r1, r2) \ sllx r2, 3, r2 +#define CREATE_VPTE_NOP #endif /* DTLB ** ICACHE line 1: Quick user TLB misses */ - mov TLB_SFSR, %g1 ldxa [%g1 + %g1] ASI_DMMU, %g4 ! Get TAG_ACCESS andcc %g4, TAG_CONTEXT_BITS, %g0 ! From Nucleus? from_tl1_trap: rdpr %tl, %g5 ! For TL==3 test CREATE_VPTE_OFFSET1(%g4, %g6) ! Create VPTE offset - be,pn %xcc, kvmap ! Yep, special processing + be,pn %xcc, 3f ! Yep, special processing CREATE_VPTE_OFFSET2(%g4, %g6) ! Create VPTE offset cmp %g5, 4 ! Last trap level? - -/* DTLB ** ICACHE line 2: User finish + quick kernel TLB misses */ be,pn %xcc, longpath ! Yep, cannot risk VPTE miss nop ! delay slot + +/* DTLB ** ICACHE line 2: User finish + quick kernel TLB misses */ ldxa [%g3 + %g6] ASI_S, %g5 ! Load VPTE 1: brgez,pn %g5, longpath ! Invalid, branch out nop ! Delay-slot 9: stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB retry ! Trap return - nop +3: brlz,pt %g4, 9b ! Kernel virtual map? + xor %g2, %g4, %g5 ! Finish bit twiddles + ba,a,pt %xcc, kvmap ! Yep, go check for obp/vmalloc /* DTLB ** ICACHE line 3: winfixups+real_faults */ longpath: @@ -103,7 +106,8 @@ longpath: nop nop nop - nop + CREATE_VPTE_NOP #undef CREATE_VPTE_OFFSET1 #undef CREATE_VPTE_OFFSET2 +#undef CREATE_VPTE_NOP diff --git a/trunk/arch/sparc64/kernel/dtlb_prot.S b/trunk/arch/sparc64/kernel/dtlb_prot.S index e0a920162604..d848bb7374bb 100644 --- a/trunk/arch/sparc64/kernel/dtlb_prot.S +++ b/trunk/arch/sparc64/kernel/dtlb_prot.S @@ -14,14 +14,14 @@ */ /* PROT ** ICACHE line 1: User DTLB protection trap */ - mov TLB_SFSR, %g1 - stxa %g0, [%g1] ASI_DMMU ! Clear FaultValid bit - membar #Sync ! Synchronize stores - rdpr %pstate, %g5 ! Move into alt-globals + stxa %g0, [%g1] ASI_DMMU ! Clear SFSR FaultValid bit + membar #Sync ! Synchronize ASI stores + rdpr %pstate, %g5 ! Move into alternate globals wrpr %g5, PSTATE_AG|PSTATE_MG, %pstate - rdpr %tl, %g1 ! Need a winfixup? + rdpr %tl, %g1 ! Need to do a winfixup? cmp %g1, 1 ! Trap level >1? - mov TLB_TAG_ACCESS, %g4 ! For reload of vaddr + mov TLB_TAG_ACCESS, %g4 ! Prepare reload of vaddr + nop /* PROT ** ICACHE line 2: More real fault processing */ bgu,pn %xcc, winfix_trampoline ! Yes, perform winfixup diff --git a/trunk/arch/sparc64/kernel/entry.S b/trunk/arch/sparc64/kernel/entry.S index 11a848402fb1..b48349527853 100644 --- a/trunk/arch/sparc64/kernel/entry.S +++ b/trunk/arch/sparc64/kernel/entry.S @@ -30,10 +30,163 @@ .text .align 32 + .globl sparc64_vpte_patchme1 + .globl sparc64_vpte_patchme2 +/* + * On a second level vpte miss, check whether the original fault is to the OBP + * range (note that this is only possible for instruction miss, data misses to + * obp range do not use vpte). If so, go back directly to the faulting address. + * This is because we want to read the tpc, otherwise we have no way of knowing + * the 8k aligned faulting address if we are using >8k kernel pagesize. This + * also ensures no vpte range addresses are dropped into tlb while obp is + * executing (see inherit_locked_prom_mappings() rant). + */ +sparc64_vpte_nucleus: + /* Note that kvmap below has verified that the address is + * in the range MODULES_VADDR --> VMALLOC_END already. So + * here we need only check if it is an OBP address or not. + */ + sethi %hi(LOW_OBP_ADDRESS), %g5 + cmp %g4, %g5 + blu,pn %xcc, sparc64_vpte_patchme1 + mov 0x1, %g5 + sllx %g5, 32, %g5 + cmp %g4, %g5 + blu,pn %xcc, obp_iaddr_patch + nop + + /* These two instructions are patched by paginig_init(). */ +sparc64_vpte_patchme1: + sethi %hi(0), %g5 +sparc64_vpte_patchme2: + or %g5, %lo(0), %g5 + + /* With kernel PGD in %g5, branch back into dtlb_backend. */ + ba,pt %xcc, sparc64_kpte_continue + andn %g1, 0x3, %g1 /* Finish PMD offset adjustment. */ + +vpte_noent: + /* Restore previous TAG_ACCESS, %g5 is zero, and we will + * skip over the trap instruction so that the top level + * TLB miss handler will thing this %g5 value is just an + * invalid PTE, thus branching to full fault processing. + */ + mov TLB_SFSR, %g1 + stxa %g4, [%g1 + %g1] ASI_DMMU + done + + .globl obp_iaddr_patch +obp_iaddr_patch: + /* These two instructions patched by inherit_prom_mappings(). */ + sethi %hi(0), %g5 + or %g5, %lo(0), %g5 + + /* Behave as if we are at TL0. */ + wrpr %g0, 1, %tl + rdpr %tpc, %g4 /* Find original faulting iaddr */ + srlx %g4, 13, %g4 /* Throw out context bits */ + sllx %g4, 13, %g4 /* g4 has vpn + ctx0 now */ + + /* Restore previous TAG_ACCESS. */ + mov TLB_SFSR, %g1 + stxa %g4, [%g1 + %g1] ASI_IMMU + + /* Get PMD offset. */ + srlx %g4, 23, %g6 + and %g6, 0x7ff, %g6 + sllx %g6, 2, %g6 + + /* Load PMD, is it valid? */ + lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 + brz,pn %g5, longpath + sllx %g5, 11, %g5 + + /* Get PTE offset. */ + srlx %g4, 13, %g6 + and %g6, 0x3ff, %g6 + sllx %g6, 3, %g6 + + /* Load PTE. */ + ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 + brgez,pn %g5, longpath + nop + + /* TLB load and return from trap. */ + stxa %g5, [%g0] ASI_ITLB_DATA_IN + retry + + .globl obp_daddr_patch +obp_daddr_patch: + /* These two instructions patched by inherit_prom_mappings(). */ + sethi %hi(0), %g5 + or %g5, %lo(0), %g5 + + /* Get PMD offset. */ + srlx %g4, 23, %g6 + and %g6, 0x7ff, %g6 + sllx %g6, 2, %g6 + + /* Load PMD, is it valid? */ + lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 + brz,pn %g5, longpath + sllx %g5, 11, %g5 + + /* Get PTE offset. */ + srlx %g4, 13, %g6 + and %g6, 0x3ff, %g6 + sllx %g6, 3, %g6 + + /* Load PTE. */ + ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 + brgez,pn %g5, longpath + nop + + /* TLB load and return from trap. */ + stxa %g5, [%g0] ASI_DTLB_DATA_IN + retry + +/* + * On a first level data miss, check whether this is to the OBP range (note + * that such accesses can be made by prom, as well as by kernel using + * prom_getproperty on "address"), and if so, do not use vpte access ... + * rather, use information saved during inherit_prom_mappings() using 8k + * pagesize. + */ + .align 32 +kvmap: + sethi %hi(MODULES_VADDR), %g5 + cmp %g4, %g5 + blu,pn %xcc, longpath + mov (VMALLOC_END >> 24), %g5 + sllx %g5, 24, %g5 + cmp %g4, %g5 + bgeu,pn %xcc, longpath + nop + +kvmap_check_obp: + sethi %hi(LOW_OBP_ADDRESS), %g5 + cmp %g4, %g5 + blu,pn %xcc, kvmap_vmalloc_addr + mov 0x1, %g5 + sllx %g5, 32, %g5 + cmp %g4, %g5 + blu,pn %xcc, obp_daddr_patch + nop + +kvmap_vmalloc_addr: + /* If we get here, a vmalloc addr was accessed, load kernel VPTE. */ + ldxa [%g3 + %g6] ASI_N, %g5 + brgez,pn %g5, longpath + nop + + /* PTE is valid, load into TLB and return from trap. */ + stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB + retry + /* This is trivial with the new code... */ .globl do_fpdis do_fpdis: - sethi %hi(TSTATE_PEF), %g4 + sethi %hi(TSTATE_PEF), %g4 ! IEU0 rdpr %tstate, %g5 andcc %g5, %g4, %g0 be,pt %xcc, 1f @@ -50,18 +203,18 @@ do_fpdis: add %g0, %g0, %g0 ba,a,pt %xcc, rtrap_clr_l6 -1: ldub [%g6 + TI_FPSAVED], %g5 - wr %g0, FPRS_FEF, %fprs - andcc %g5, FPRS_FEF, %g0 - be,a,pt %icc, 1f - clr %g7 - ldx [%g6 + TI_GSR], %g7 -1: andcc %g5, FPRS_DL, %g0 - bne,pn %icc, 2f - fzero %f0 - andcc %g5, FPRS_DU, %g0 - bne,pn %icc, 1f - fzero %f2 +1: ldub [%g6 + TI_FPSAVED], %g5 ! Load Group + wr %g0, FPRS_FEF, %fprs ! LSU Group+4bubbles + andcc %g5, FPRS_FEF, %g0 ! IEU1 Group + be,a,pt %icc, 1f ! CTI + clr %g7 ! IEU0 + ldx [%g6 + TI_GSR], %g7 ! Load Group +1: andcc %g5, FPRS_DL, %g0 ! IEU1 + bne,pn %icc, 2f ! CTI + fzero %f0 ! FPA + andcc %g5, FPRS_DU, %g0 ! IEU1 Group + bne,pn %icc, 1f ! CTI + fzero %f2 ! FPA faddd %f0, %f2, %f4 fmuld %f0, %f2, %f6 faddd %f0, %f2, %f8 @@ -97,17 +250,15 @@ do_fpdis: faddd %f0, %f2, %f4 fmuld %f0, %f2, %f6 ldxa [%g3] ASI_DMMU, %g5 - sethi %hi(sparc64_kern_sec_context), %g2 - ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2 +cplus_fptrap_insn_1: + sethi %hi(0), %g2 stxa %g2, [%g3] ASI_DMMU membar #Sync add %g6, TI_FPREGS + 0xc0, %g2 faddd %f0, %f2, %f8 fmuld %f0, %f2, %f10 - membar #Sync - ldda [%g1] ASI_BLK_S, %f32 + ldda [%g1] ASI_BLK_S, %f32 ! grrr, where is ASI_BLK_NUCLEUS 8-( ldda [%g2] ASI_BLK_S, %f48 - membar #Sync faddd %f0, %f2, %f12 fmuld %f0, %f2, %f14 faddd %f0, %f2, %f16 @@ -118,6 +269,7 @@ do_fpdis: fmuld %f0, %f2, %f26 faddd %f0, %f2, %f28 fmuld %f0, %f2, %f30 + membar #Sync b,pt %xcc, fpdis_exit nop 2: andcc %g5, FPRS_DU, %g0 @@ -127,17 +279,15 @@ do_fpdis: fzero %f34 ldxa [%g3] ASI_DMMU, %g5 add %g6, TI_FPREGS, %g1 - sethi %hi(sparc64_kern_sec_context), %g2 - ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2 +cplus_fptrap_insn_2: + sethi %hi(0), %g2 stxa %g2, [%g3] ASI_DMMU membar #Sync add %g6, TI_FPREGS + 0x40, %g2 faddd %f32, %f34, %f36 fmuld %f32, %f34, %f38 - membar #Sync - ldda [%g1] ASI_BLK_S, %f0 + ldda [%g1] ASI_BLK_S, %f0 ! grrr, where is ASI_BLK_NUCLEUS 8-( ldda [%g2] ASI_BLK_S, %f16 - membar #Sync faddd %f32, %f34, %f40 fmuld %f32, %f34, %f42 faddd %f32, %f34, %f44 @@ -150,18 +300,18 @@ do_fpdis: fmuld %f32, %f34, %f58 faddd %f32, %f34, %f60 fmuld %f32, %f34, %f62 + membar #Sync ba,pt %xcc, fpdis_exit nop 3: mov SECONDARY_CONTEXT, %g3 add %g6, TI_FPREGS, %g1 ldxa [%g3] ASI_DMMU, %g5 - sethi %hi(sparc64_kern_sec_context), %g2 - ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2 +cplus_fptrap_insn_3: + sethi %hi(0), %g2 stxa %g2, [%g3] ASI_DMMU membar #Sync mov 0x40, %g2 - membar #Sync - ldda [%g1] ASI_BLK_S, %f0 + ldda [%g1] ASI_BLK_S, %f0 ! grrr, where is ASI_BLK_NUCLEUS 8-( ldda [%g1 + %g2] ASI_BLK_S, %f16 add %g1, 0x80, %g1 ldda [%g1] ASI_BLK_S, %f32 @@ -322,8 +472,8 @@ do_fptrap_after_fsr: stx %g3, [%g6 + TI_GSR] mov SECONDARY_CONTEXT, %g3 ldxa [%g3] ASI_DMMU, %g5 - sethi %hi(sparc64_kern_sec_context), %g2 - ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2 +cplus_fptrap_insn_4: + sethi %hi(0), %g2 stxa %g2, [%g3] ASI_DMMU membar #Sync add %g6, TI_FPREGS, %g2 @@ -344,17 +494,45 @@ do_fptrap_after_fsr: ba,pt %xcc, etrap wr %g0, 0, %fprs +cplus_fptrap_1: + sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2 + + .globl cheetah_plus_patch_fpdis +cheetah_plus_patch_fpdis: + /* We configure the dTLB512_0 for 4MB pages and the + * dTLB512_1 for 8K pages when in context zero. + */ + sethi %hi(cplus_fptrap_1), %o0 + lduw [%o0 + %lo(cplus_fptrap_1)], %o1 + + set cplus_fptrap_insn_1, %o2 + stw %o1, [%o2] + flush %o2 + set cplus_fptrap_insn_2, %o2 + stw %o1, [%o2] + flush %o2 + set cplus_fptrap_insn_3, %o2 + stw %o1, [%o2] + flush %o2 + set cplus_fptrap_insn_4, %o2 + stw %o1, [%o2] + flush %o2 + + retl + nop + /* The registers for cross calls will be: * * DATA 0: [low 32-bits] Address of function to call, jmp to this * [high 32-bits] MMU Context Argument 0, place in %g5 - * DATA 1: Address Argument 1, place in %g1 + * DATA 1: Address Argument 1, place in %g6 * DATA 2: Address Argument 2, place in %g7 * * With this method we can do most of the cross-call tlb/cache * flushing very quickly. * - * Current CPU's IRQ worklist table is locked into %g6, don't touch. + * Current CPU's IRQ worklist table is locked into %g1, + * don't touch. */ .text .align 32 @@ -828,14 +1006,13 @@ cheetah_plus_dcpe_trap_vector: nop do_cheetah_plus_data_parity: - rdpr %pil, %g2 - wrpr %g0, 15, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, etrap rd %pc, %g7 mov 0x0, %o0 call cheetah_plus_parity_error add %sp, PTREGS_OFF, %o1 - ba,a,pt %xcc, rtrap_irq + ba,pt %xcc, rtrap + clr %l6 cheetah_plus_dcpe_trap_vector_tl1: membar #Sync @@ -859,14 +1036,13 @@ cheetah_plus_icpe_trap_vector: nop do_cheetah_plus_insn_parity: - rdpr %pil, %g2 - wrpr %g0, 15, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, etrap rd %pc, %g7 mov 0x1, %o0 call cheetah_plus_parity_error add %sp, PTREGS_OFF, %o1 - ba,a,pt %xcc, rtrap_irq + ba,pt %xcc, rtrap + clr %l6 cheetah_plus_icpe_trap_vector_tl1: membar #Sync @@ -899,10 +1075,6 @@ do_dcpe_tl1: nop wrpr %g1, %tl ! Restore original trap level do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */ - sethi %hi(dcache_parity_tl1_occurred), %g2 - lduw [%g2 + %lo(dcache_parity_tl1_occurred)], %g1 - add %g1, 1, %g1 - stw %g1, [%g2 + %lo(dcache_parity_tl1_occurred)] /* Reset D-cache parity */ sethi %hi(1 << 16), %g1 ! D-cache size mov (1 << 5), %g2 ! D-cache line size @@ -949,10 +1121,6 @@ do_icpe_tl1: nop wrpr %g1, %tl ! Restore original trap level do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */ - sethi %hi(icache_parity_tl1_occurred), %g2 - lduw [%g2 + %lo(icache_parity_tl1_occurred)], %g1 - add %g1, 1, %g1 - stw %g1, [%g2 + %lo(icache_parity_tl1_occurred)] /* Flush I-cache */ sethi %hi(1 << 15), %g1 ! I-cache size mov (1 << 5), %g2 ! I-cache line size diff --git a/trunk/arch/sparc64/kernel/etrap.S b/trunk/arch/sparc64/kernel/etrap.S index 0d8eba21111b..50d2af1d98ae 100644 --- a/trunk/arch/sparc64/kernel/etrap.S +++ b/trunk/arch/sparc64/kernel/etrap.S @@ -68,8 +68,12 @@ etrap_irq: wrpr %g3, 0, %otherwin wrpr %g2, 0, %wstate - sethi %hi(sparc64_kern_pri_context), %g2 - ldx [%g2 + %lo(sparc64_kern_pri_context)], %g3 +cplus_etrap_insn_1: + sethi %hi(0), %g3 + sllx %g3, 32, %g3 +cplus_etrap_insn_2: + sethi %hi(0), %g2 + or %g3, %g2, %g3 stxa %g3, [%l4] ASI_DMMU flush %l6 wr %g0, ASI_AIUS, %asi @@ -211,8 +215,12 @@ scetrap: rdpr %pil, %g2 mov PRIMARY_CONTEXT, %l4 wrpr %g3, 0, %otherwin wrpr %g2, 0, %wstate - sethi %hi(sparc64_kern_pri_context), %g2 - ldx [%g2 + %lo(sparc64_kern_pri_context)], %g3 +cplus_etrap_insn_3: + sethi %hi(0), %g3 + sllx %g3, 32, %g3 +cplus_etrap_insn_4: + sethi %hi(0), %g2 + or %g3, %g2, %g3 stxa %g3, [%l4] ASI_DMMU flush %l6 @@ -256,3 +264,38 @@ scetrap: rdpr %pil, %g2 #undef TASK_REGOFF #undef ETRAP_PSTATE1 + +cplus_einsn_1: + sethi %uhi(CTX_CHEETAH_PLUS_NUC), %g3 +cplus_einsn_2: + sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2 + + .globl cheetah_plus_patch_etrap +cheetah_plus_patch_etrap: + /* We configure the dTLB512_0 for 4MB pages and the + * dTLB512_1 for 8K pages when in context zero. + */ + sethi %hi(cplus_einsn_1), %o0 + sethi %hi(cplus_etrap_insn_1), %o2 + lduw [%o0 + %lo(cplus_einsn_1)], %o1 + or %o2, %lo(cplus_etrap_insn_1), %o2 + stw %o1, [%o2] + flush %o2 + sethi %hi(cplus_etrap_insn_3), %o2 + or %o2, %lo(cplus_etrap_insn_3), %o2 + stw %o1, [%o2] + flush %o2 + + sethi %hi(cplus_einsn_2), %o0 + sethi %hi(cplus_etrap_insn_2), %o2 + lduw [%o0 + %lo(cplus_einsn_2)], %o1 + or %o2, %lo(cplus_etrap_insn_2), %o2 + stw %o1, [%o2] + flush %o2 + sethi %hi(cplus_etrap_insn_4), %o2 + or %o2, %lo(cplus_etrap_insn_4), %o2 + stw %o1, [%o2] + flush %o2 + + retl + nop diff --git a/trunk/arch/sparc64/kernel/head.S b/trunk/arch/sparc64/kernel/head.S index b49dcd4504b0..1fa06c4e3bdb 100644 --- a/trunk/arch/sparc64/kernel/head.S +++ b/trunk/arch/sparc64/kernel/head.S @@ -28,14 +28,19 @@ #include /* This section from from _start to sparc64_boot_end should fit into - * 0x0000000000404000 to 0x0000000000408000. + * 0x0000.0000.0040.4000 to 0x0000.0000.0040.8000 and will be sharing space + * with bootup_user_stack, which is from 0x0000.0000.0040.4000 to + * 0x0000.0000.0040.6000 and empty_bad_page, which is from + * 0x0000.0000.0040.6000 to 0x0000.0000.0040.8000. */ + .text .globl start, _start, stext, _stext _start: start: _stext: stext: +bootup_user_stack: ! 0x0000000000404000 b sparc64_boot flushw /* Flush register file. */ @@ -75,169 +80,15 @@ sparc_ramdisk_image64: .xword 0 .word _end - /* PROM cif handler code address is in %o4. */ -sparc64_boot: -1: rd %pc, %g7 - set 1b, %g1 - cmp %g1, %g7 - be,pn %xcc, sparc64_boot_after_remap - mov %o4, %l7 - - /* We need to remap the kernel. Use position independant - * code to remap us to KERNBASE. + /* We must be careful, 32-bit OpenBOOT will get confused if it + * tries to save away a register window to a 64-bit kernel + * stack address. Flush all windows, disable interrupts, + * remap if necessary, jump onto kernel trap table, then kernel + * stack, or else we die. * - * SILO can invoke us with 32-bit address masking enabled, - * so make sure that's clear. + * PROM entry point is on %o4 */ - rdpr %pstate, %g1 - andn %g1, PSTATE_AM, %g1 - wrpr %g1, 0x0, %pstate - ba,a,pt %xcc, 1f - - .globl prom_finddev_name, prom_chosen_path - .globl prom_getprop_name, prom_mmu_name - .globl prom_callmethod_name, prom_translate_name - .globl prom_map_name, prom_unmap_name, prom_mmu_ihandle_cache - .globl prom_boot_mapped_pc, prom_boot_mapping_mode - .globl prom_boot_mapping_phys_high, prom_boot_mapping_phys_low -prom_finddev_name: - .asciz "finddevice" -prom_chosen_path: - .asciz "/chosen" -prom_getprop_name: - .asciz "getprop" -prom_mmu_name: - .asciz "mmu" -prom_callmethod_name: - .asciz "call-method" -prom_translate_name: - .asciz "translate" -prom_map_name: - .asciz "map" -prom_unmap_name: - .asciz "unmap" - .align 4 -prom_mmu_ihandle_cache: - .word 0 -prom_boot_mapped_pc: - .word 0 -prom_boot_mapping_mode: - .word 0 - .align 8 -prom_boot_mapping_phys_high: - .xword 0 -prom_boot_mapping_phys_low: - .xword 0 -1: - rd %pc, %l0 - mov (1b - prom_finddev_name), %l1 - mov (1b - prom_chosen_path), %l2 - mov (1b - prom_boot_mapped_pc), %l3 - sub %l0, %l1, %l1 - sub %l0, %l2, %l2 - sub %l0, %l3, %l3 - stw %l0, [%l3] - sub %sp, (192 + 128), %sp - - /* chosen_node = prom_finddevice("/chosen") */ - stx %l1, [%sp + 2047 + 128 + 0x00] ! service, "finddevice" - mov 1, %l3 - stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 1 - stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 1 - stx %l2, [%sp + 2047 + 128 + 0x18] ! arg1, "/chosen" - stx %g0, [%sp + 2047 + 128 + 0x20] ! ret1 - call %l7 - add %sp, (2047 + 128), %o0 ! argument array - - ldx [%sp + 2047 + 128 + 0x20], %l4 ! chosen device node - - mov (1b - prom_getprop_name), %l1 - mov (1b - prom_mmu_name), %l2 - mov (1b - prom_mmu_ihandle_cache), %l5 - sub %l0, %l1, %l1 - sub %l0, %l2, %l2 - sub %l0, %l5, %l5 - - /* prom_mmu_ihandle_cache = prom_getint(chosen_node, "mmu") */ - stx %l1, [%sp + 2047 + 128 + 0x00] ! service, "getprop" - mov 4, %l3 - stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 4 - mov 1, %l3 - stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 1 - stx %l4, [%sp + 2047 + 128 + 0x18] ! arg1, chosen_node - stx %l2, [%sp + 2047 + 128 + 0x20] ! arg2, "mmu" - stx %l5, [%sp + 2047 + 128 + 0x28] ! arg3, &prom_mmu_ihandle_cache - mov 4, %l3 - stx %l3, [%sp + 2047 + 128 + 0x30] ! arg4, sizeof(arg3) - stx %g0, [%sp + 2047 + 128 + 0x38] ! ret1 - call %l7 - add %sp, (2047 + 128), %o0 ! argument array - - mov (1b - prom_callmethod_name), %l1 - mov (1b - prom_translate_name), %l2 - sub %l0, %l1, %l1 - sub %l0, %l2, %l2 - lduw [%l5], %l5 ! prom_mmu_ihandle_cache - - stx %l1, [%sp + 2047 + 128 + 0x00] ! service, "call-method" - mov 3, %l3 - stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 3 - mov 5, %l3 - stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 5 - stx %l2, [%sp + 2047 + 128 + 0x18] ! arg1: "translate" - stx %l5, [%sp + 2047 + 128 + 0x20] ! arg2: prom_mmu_ihandle_cache - /* PAGE align */ - srlx %l0, 13, %l3 - sllx %l3, 13, %l3 - stx %l3, [%sp + 2047 + 128 + 0x28] ! arg3: vaddr, our PC - stx %g0, [%sp + 2047 + 128 + 0x30] ! res1 - stx %g0, [%sp + 2047 + 128 + 0x38] ! res2 - stx %g0, [%sp + 2047 + 128 + 0x40] ! res3 - stx %g0, [%sp + 2047 + 128 + 0x48] ! res4 - stx %g0, [%sp + 2047 + 128 + 0x50] ! res5 - call %l7 - add %sp, (2047 + 128), %o0 ! argument array - - ldx [%sp + 2047 + 128 + 0x40], %l1 ! translation mode - mov (1b - prom_boot_mapping_mode), %l4 - sub %l0, %l4, %l4 - stw %l1, [%l4] - mov (1b - prom_boot_mapping_phys_high), %l4 - sub %l0, %l4, %l4 - ldx [%sp + 2047 + 128 + 0x48], %l2 ! physaddr high - stx %l2, [%l4 + 0x0] - ldx [%sp + 2047 + 128 + 0x50], %l3 ! physaddr low - /* 4MB align */ - srlx %l3, 22, %l3 - sllx %l3, 22, %l3 - stx %l3, [%l4 + 0x8] - - /* Leave service as-is, "call-method" */ - mov 7, %l3 - stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 7 - mov 1, %l3 - stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 1 - mov (1b - prom_map_name), %l3 - sub %l0, %l3, %l3 - stx %l3, [%sp + 2047 + 128 + 0x18] ! arg1: "map" - /* Leave arg2 as-is, prom_mmu_ihandle_cache */ - mov -1, %l3 - stx %l3, [%sp + 2047 + 128 + 0x28] ! arg3: mode (-1 default) - sethi %hi(8 * 1024 * 1024), %l3 - stx %l3, [%sp + 2047 + 128 + 0x30] ! arg4: size (8MB) - sethi %hi(KERNBASE), %l3 - stx %l3, [%sp + 2047 + 128 + 0x38] ! arg5: vaddr (KERNBASE) - stx %g0, [%sp + 2047 + 128 + 0x40] ! arg6: empty - mov (1b - prom_boot_mapping_phys_low), %l3 - sub %l0, %l3, %l3 - ldx [%l3], %l3 - stx %l3, [%sp + 2047 + 128 + 0x48] ! arg7: phys addr - call %l7 - add %sp, (2047 + 128), %o0 ! argument array - - add %sp, (192 + 128), %sp - -sparc64_boot_after_remap: +sparc64_boot: BRANCH_IF_CHEETAH_BASE(g1,g7,cheetah_boot) BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,cheetah_plus_boot) ba,pt %xcc, spitfire_boot @@ -274,7 +125,185 @@ cheetah_generic_boot: stxa %g0, [%g3] ASI_IMMU membar #Sync - ba,a,pt %xcc, jump_to_sun4u_init + wrpr %g0, (PSTATE_PRIV|PSTATE_PEF|PSTATE_IE), %pstate + wr %g0, 0, %fprs + + /* Just like for Spitfire, we probe itlb-2 for a mapping which + * matches our current %pc. We take the physical address in + * that mapping and use it to make our own. + */ + + /* %g5 holds the tlb data */ + sethi %uhi(_PAGE_VALID | _PAGE_SZ4MB), %g5 + sllx %g5, 32, %g5 + or %g5, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W | _PAGE_G), %g5 + + /* Put PADDR tlb data mask into %g3. */ + sethi %uhi(_PAGE_PADDR), %g3 + or %g3, %ulo(_PAGE_PADDR), %g3 + sllx %g3, 32, %g3 + sethi %hi(_PAGE_PADDR), %g7 + or %g7, %lo(_PAGE_PADDR), %g7 + or %g3, %g7, %g3 + + set 2 << 16, %l0 /* TLB entry walker. */ + set 0x1fff, %l2 /* Page mask. */ + rd %pc, %l3 + andn %l3, %l2, %g2 /* vaddr comparator */ + +1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1 + membar #Sync + andn %g1, %l2, %g1 + cmp %g1, %g2 + be,pn %xcc, cheetah_got_tlbentry + nop + and %l0, (127 << 3), %g1 + cmp %g1, (127 << 3) + blu,pt %xcc, 1b + add %l0, (1 << 3), %l0 + + /* Search the small TLB. OBP never maps us like that but + * newer SILO can. + */ + clr %l0 + +1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1 + membar #Sync + andn %g1, %l2, %g1 + cmp %g1, %g2 + be,pn %xcc, cheetah_got_tlbentry + nop + cmp %l0, (15 << 3) + blu,pt %xcc, 1b + add %l0, (1 << 3), %l0 + + /* BUG() if we get here... */ + ta 0x5 + +cheetah_got_tlbentry: + ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g0 + ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g1 + membar #Sync + and %g1, %g3, %g1 + set 0x5fff, %l0 + andn %g1, %l0, %g1 + or %g5, %g1, %g5 + + /* Clear out any KERNBASE area entries. */ + set 2 << 16, %l0 + sethi %hi(KERNBASE), %g3 + sethi %hi(KERNBASE<<1), %g7 + mov TLB_TAG_ACCESS, %l7 + + /* First, check ITLB */ +1: ldxa [%l0] ASI_ITLB_TAG_READ, %g1 + membar #Sync + andn %g1, %l2, %g1 + cmp %g1, %g3 + blu,pn %xcc, 2f + cmp %g1, %g7 + bgeu,pn %xcc, 2f + nop + stxa %g0, [%l7] ASI_IMMU + membar #Sync + stxa %g0, [%l0] ASI_ITLB_DATA_ACCESS + membar #Sync + +2: and %l0, (127 << 3), %g1 + cmp %g1, (127 << 3) + blu,pt %xcc, 1b + add %l0, (1 << 3), %l0 + + /* Next, check DTLB */ + set 2 << 16, %l0 +1: ldxa [%l0] ASI_DTLB_TAG_READ, %g1 + membar #Sync + andn %g1, %l2, %g1 + cmp %g1, %g3 + blu,pn %xcc, 2f + cmp %g1, %g7 + bgeu,pn %xcc, 2f + nop + stxa %g0, [%l7] ASI_DMMU + membar #Sync + stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS + membar #Sync + +2: and %l0, (511 << 3), %g1 + cmp %g1, (511 << 3) + blu,pt %xcc, 1b + add %l0, (1 << 3), %l0 + + /* On Cheetah+, have to check second DTLB. */ + BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,l0,2f) + ba,pt %xcc, 9f + nop + +2: set 3 << 16, %l0 +1: ldxa [%l0] ASI_DTLB_TAG_READ, %g1 + membar #Sync + andn %g1, %l2, %g1 + cmp %g1, %g3 + blu,pn %xcc, 2f + cmp %g1, %g7 + bgeu,pn %xcc, 2f + nop + stxa %g0, [%l7] ASI_DMMU + membar #Sync + stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS + membar #Sync + +2: and %l0, (511 << 3), %g1 + cmp %g1, (511 << 3) + blu,pt %xcc, 1b + add %l0, (1 << 3), %l0 + +9: + + /* Now lock the TTE we created into ITLB-0 and DTLB-0, + * entry 15 (and maybe 14 too). + */ + sethi %hi(KERNBASE), %g3 + set (0 << 16) | (15 << 3), %g7 + stxa %g3, [%l7] ASI_DMMU + membar #Sync + stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS + membar #Sync + stxa %g3, [%l7] ASI_IMMU + membar #Sync + stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS + membar #Sync + flush %g3 + membar #Sync + sethi %hi(_end), %g3 /* Check for bigkernel case */ + or %g3, %lo(_end), %g3 + srl %g3, 23, %g3 /* Check if _end > 8M */ + brz,pt %g3, 1f + sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */ + sethi %hi(0x400000), %g3 + or %g3, %lo(0x400000), %g3 + add %g5, %g3, %g5 /* New tte data */ + andn %g5, (_PAGE_G), %g5 + sethi %hi(KERNBASE+0x400000), %g3 + or %g3, %lo(KERNBASE+0x400000), %g3 + set (0 << 16) | (14 << 3), %g7 + stxa %g3, [%l7] ASI_DMMU + membar #Sync + stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS + membar #Sync + stxa %g3, [%l7] ASI_IMMU + membar #Sync + stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS + membar #Sync + flush %g3 + membar #Sync + sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */ + ba,pt %xcc, 1f + nop + +1: set sun4u_init, %g2 + jmpl %g2 + %g0, %g0 + nop spitfire_boot: /* Typically PROM has already enabled both MMU's and both on-chip @@ -284,7 +313,6 @@ spitfire_boot: stxa %g1, [%g0] ASI_LSU_CONTROL membar #Sync -jump_to_sun4u_init: /* * Make sure we are in privileged mode, have address masking, * using the ordinary globals and have enabled floating @@ -296,6 +324,151 @@ jump_to_sun4u_init: wrpr %g0, (PSTATE_PRIV|PSTATE_PEF|PSTATE_IE), %pstate wr %g0, 0, %fprs +spitfire_create_mappings: + /* %g5 holds the tlb data */ + sethi %uhi(_PAGE_VALID | _PAGE_SZ4MB), %g5 + sllx %g5, 32, %g5 + or %g5, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W | _PAGE_G), %g5 + + /* Base of physical memory cannot reliably be assumed to be + * at 0x0! Figure out where it happens to be. -DaveM + */ + + /* Put PADDR tlb data mask into %g3. */ + sethi %uhi(_PAGE_PADDR_SF), %g3 + or %g3, %ulo(_PAGE_PADDR_SF), %g3 + sllx %g3, 32, %g3 + sethi %hi(_PAGE_PADDR_SF), %g7 + or %g7, %lo(_PAGE_PADDR_SF), %g7 + or %g3, %g7, %g3 + + /* Walk through entire ITLB, looking for entry which maps + * our %pc currently, stick PADDR from there into %g5 tlb data. + */ + clr %l0 /* TLB entry walker. */ + set 0x1fff, %l2 /* Page mask. */ + rd %pc, %l3 + andn %l3, %l2, %g2 /* vaddr comparator */ +1: + /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */ + ldxa [%l0] ASI_ITLB_TAG_READ, %g1 + nop + nop + nop + andn %g1, %l2, %g1 /* Get vaddr */ + cmp %g1, %g2 + be,a,pn %xcc, spitfire_got_tlbentry + ldxa [%l0] ASI_ITLB_DATA_ACCESS, %g1 + cmp %l0, (63 << 3) + blu,pt %xcc, 1b + add %l0, (1 << 3), %l0 + + /* BUG() if we get here... */ + ta 0x5 + +spitfire_got_tlbentry: + /* Nops here again, perhaps Cheetah/Blackbird are better behaved... */ + nop + nop + nop + and %g1, %g3, %g1 /* Mask to just get paddr bits. */ + set 0x5fff, %l3 /* Mask offset to get phys base. */ + andn %g1, %l3, %g1 + + /* NOTE: We hold on to %g1 paddr base as we need it below to lock + * NOTE: the PROM cif code into the TLB. + */ + + or %g5, %g1, %g5 /* Or it into TAG being built. */ + + clr %l0 /* TLB entry walker. */ + sethi %hi(KERNBASE), %g3 /* 4M lower limit */ + sethi %hi(KERNBASE<<1), %g7 /* 8M upper limit */ + mov TLB_TAG_ACCESS, %l7 +1: + /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */ + ldxa [%l0] ASI_ITLB_TAG_READ, %g1 + nop + nop + nop + andn %g1, %l2, %g1 /* Get vaddr */ + cmp %g1, %g3 + blu,pn %xcc, 2f + cmp %g1, %g7 + bgeu,pn %xcc, 2f + nop + stxa %g0, [%l7] ASI_IMMU + stxa %g0, [%l0] ASI_ITLB_DATA_ACCESS + membar #Sync +2: + cmp %l0, (63 << 3) + blu,pt %xcc, 1b + add %l0, (1 << 3), %l0 + + nop; nop; nop + + clr %l0 /* TLB entry walker. */ +1: + /* Yes, the nops seem to be necessary for now, don't ask me why. -DaveM */ + ldxa [%l0] ASI_DTLB_TAG_READ, %g1 + nop + nop + nop + andn %g1, %l2, %g1 /* Get vaddr */ + cmp %g1, %g3 + blu,pn %xcc, 2f + cmp %g1, %g7 + bgeu,pn %xcc, 2f + nop + stxa %g0, [%l7] ASI_DMMU + stxa %g0, [%l0] ASI_DTLB_DATA_ACCESS + membar #Sync +2: + cmp %l0, (63 << 3) + blu,pt %xcc, 1b + add %l0, (1 << 3), %l0 + + nop; nop; nop + + + /* PROM never puts any TLB entries into the MMU with the lock bit + * set. So we gladly use tlb entry 63 for KERNBASE. And maybe 62 too. + */ + + sethi %hi(KERNBASE), %g3 + mov (63 << 3), %g7 + stxa %g3, [%l7] ASI_DMMU /* KERNBASE into TLB TAG */ + stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS /* TTE into TLB DATA */ + membar #Sync + stxa %g3, [%l7] ASI_IMMU /* KERNBASE into TLB TAG */ + stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS /* TTE into TLB DATA */ + membar #Sync + flush %g3 + membar #Sync + sethi %hi(_end), %g3 /* Check for bigkernel case */ + or %g3, %lo(_end), %g3 + srl %g3, 23, %g3 /* Check if _end > 8M */ + brz,pt %g3, 2f + sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */ + sethi %hi(0x400000), %g3 + or %g3, %lo(0x400000), %g3 + add %g5, %g3, %g5 /* New tte data */ + andn %g5, (_PAGE_G), %g5 + sethi %hi(KERNBASE+0x400000), %g3 + or %g3, %lo(KERNBASE+0x400000), %g3 + mov (62 << 3), %g7 + stxa %g3, [%l7] ASI_DMMU + stxa %g5, [%g7] ASI_DTLB_DATA_ACCESS + membar #Sync + stxa %g3, [%l7] ASI_IMMU + stxa %g5, [%g7] ASI_ITLB_DATA_ACCESS + membar #Sync + flush %g3 + membar #Sync + sethi %hi(KERNBASE), %g3 /* Restore for fixup code below */ +2: ba,pt %xcc, 1f + nop +1: set sun4u_init, %g2 jmpl %g2 + %g0, %g0 nop @@ -310,12 +483,38 @@ sun4u_init: stxa %g0, [%g7] ASI_DMMU membar #Sync + /* We are now safely (we hope) in Nucleus context (0), rewrite + * the KERNBASE TTE's so they no longer have the global bit set. + * Don't forget to setup TAG_ACCESS first 8-) + */ + mov TLB_TAG_ACCESS, %g2 + stxa %g3, [%g2] ASI_IMMU + stxa %g3, [%g2] ASI_DMMU + membar #Sync + BRANCH_IF_ANY_CHEETAH(g1,g7,cheetah_tlb_fixup) ba,pt %xcc, spitfire_tlb_fixup nop cheetah_tlb_fixup: + set (0 << 16) | (15 << 3), %g7 + ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g0 + ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g1 + andn %g1, (_PAGE_G), %g1 + stxa %g1, [%g7] ASI_ITLB_DATA_ACCESS + membar #Sync + + ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g0 + ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g1 + andn %g1, (_PAGE_G), %g1 + stxa %g1, [%g7] ASI_DTLB_DATA_ACCESS + membar #Sync + + /* Kill instruction prefetch queues. */ + flush %g3 + membar #Sync + mov 2, %g2 /* Set TLB type to cheetah+. */ BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,1f) @@ -324,7 +523,23 @@ cheetah_tlb_fixup: 1: sethi %hi(tlb_type), %g1 stw %g2, [%g1 + %lo(tlb_type)] - /* Patch copy/page operations to cheetah optimized versions. */ + BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,1f) + ba,pt %xcc, 2f + nop + +1: /* Patch context register writes to support nucleus page + * size correctly. + */ + call cheetah_plus_patch_etrap + nop + call cheetah_plus_patch_rtrap + nop + call cheetah_plus_patch_fpdis + nop + call cheetah_plus_patch_winfixup + nop + +2: /* Patch copy/page operations to cheetah optimized versions. */ call cheetah_patch_copyops nop call cheetah_patch_copy_page @@ -336,6 +551,21 @@ cheetah_tlb_fixup: nop spitfire_tlb_fixup: + mov (63 << 3), %g7 + ldxa [%g7] ASI_ITLB_DATA_ACCESS, %g1 + andn %g1, (_PAGE_G), %g1 + stxa %g1, [%g7] ASI_ITLB_DATA_ACCESS + membar #Sync + + ldxa [%g7] ASI_DTLB_DATA_ACCESS, %g1 + andn %g1, (_PAGE_G), %g1 + stxa %g1, [%g7] ASI_DTLB_DATA_ACCESS + membar #Sync + + /* Kill instruction prefetch queues. */ + flush %g3 + membar #Sync + /* Set TLB type to spitfire. */ mov 0, %g2 sethi %hi(tlb_type), %g1 @@ -348,6 +578,24 @@ tlb_fixup_done: mov %sp, %l6 mov %o4, %l7 +#if 0 /* We don't do it like this anymore, but for historical hack value + * I leave this snippet here to show how crazy we can be sometimes. 8-) + */ + + /* Setup "Linux Current Register", thanks Sun 8-) */ + wr %g0, 0x1, %pcr + + /* Blackbird errata workaround. See commentary in + * smp.c:smp_percpu_timer_interrupt() for more + * information. + */ + ba,pt %xcc, 99f + nop + .align 64 +99: wr %g6, %g0, %pic + rd %pic, %g0 +#endif + wr %g0, ASI_P, %asi mov 1, %g1 sllx %g1, THREAD_SHIFT, %g1 @@ -381,78 +629,32 @@ tlb_fixup_done: nop /* Not reached... */ - /* This is meant to allow the sharing of this code between - * boot processor invocation (via setup_tba() below) and - * secondary processor startup (via trampoline.S). The - * former does use this code, the latter does not yet due - * to some complexities. That should be fixed up at some - * point. - * - * There used to be enormous complexity wrt. transferring - * over from the firwmare's trap table to the Linux kernel's. - * For example, there was a chicken & egg problem wrt. building - * the OBP page tables, yet needing to be on the Linux kernel - * trap table (to translate PAGE_OFFSET addresses) in order to - * do that. - * - * We now handle OBP tlb misses differently, via linear lookups - * into the prom_trans[] array. So that specific problem no - * longer exists. Yet, unfortunately there are still some issues - * preventing trampoline.S from using this code... ho hum. - */ - .globl setup_trap_table -setup_trap_table: - save %sp, -192, %sp - - /* Force interrupts to be disabled. */ - rdpr %pstate, %o1 - andn %o1, PSTATE_IE, %o1 - wrpr %o1, 0x0, %pstate - wrpr %g0, 15, %pil - - /* Make the firmware call to jump over to the Linux trap table. */ - call prom_set_trap_table - sethi %hi(sparc64_ttable_tl0), %o0 - - /* Start using proper page size encodings in ctx register. */ - sethi %hi(sparc64_kern_pri_context), %g3 - ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2 - mov PRIMARY_CONTEXT, %g1 - stxa %g2, [%g1] ASI_DMMU - membar #Sync +/* IMPORTANT NOTE: Whenever making changes here, check + * trampoline.S as well. -jj */ + .globl setup_tba +setup_tba: /* i0 = is_starfire */ + save %sp, -160, %sp - /* The Linux trap handlers expect various trap global registers - * to be setup with some fixed values. So here we set these - * up very carefully. These globals are: - * - * Alternate Globals (PSTATE_AG): - * - * %g6 --> current_thread_info() - * - * MMU Globals (PSTATE_MG): - * - * %g1 --> TLB_SFSR - * %g2 --> ((_PAGE_VALID | _PAGE_SZ4MB | - * _PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W) - * ^ 0xfffff80000000000) - * (this %g2 value is used for computing the PAGE_OFFSET kernel - * TLB entries quickly, the virtual address of the fault XOR'd - * with this %g2 value is the PTE to load into the TLB) - * %g3 --> VPTE_BASE_CHEETAH or VPTE_BASE_SPITFIRE - * - * Interrupt Globals (PSTATE_IG, setup by init_irqwork_curcpu()): - * - * %g6 --> __irq_work[smp_processor_id()] - */ + rdpr %tba, %g7 + sethi %hi(prom_tba), %o1 + or %o1, %lo(prom_tba), %o1 + stx %g7, [%o1] + /* Setup "Linux" globals 8-) */ rdpr %pstate, %o1 mov %g6, %o2 - wrpr %o1, PSTATE_AG, %pstate + wrpr %o1, (PSTATE_AG|PSTATE_IE), %pstate + sethi %hi(sparc64_ttable_tl0), %g1 + wrpr %g1, %tba mov %o2, %g6 + /* Set up MMU globals */ + wrpr %o1, (PSTATE_MG|PSTATE_IE), %pstate + + /* Set fixed globals used by dTLB miss handler. */ #define KERN_HIGHBITS ((_PAGE_VALID|_PAGE_SZ4MB)^0xfffff80000000000) #define KERN_LOWBITS (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W) - wrpr %o1, PSTATE_MG, %pstate + mov TSB_REG, %g1 stxa %g0, [%g1] ASI_DMMU membar #Sync @@ -464,17 +666,17 @@ setup_trap_table: sllx %g2, 32, %g2 or %g2, KERN_LOWBITS, %g2 - BRANCH_IF_ANY_CHEETAH(g3,g7,8f) - ba,pt %xcc, 9f + BRANCH_IF_ANY_CHEETAH(g3,g7,cheetah_vpte_base) + ba,pt %xcc, spitfire_vpte_base nop -8: +cheetah_vpte_base: sethi %uhi(VPTE_BASE_CHEETAH), %g3 or %g3, %ulo(VPTE_BASE_CHEETAH), %g3 ba,pt %xcc, 2f sllx %g3, 32, %g3 -9: +spitfire_vpte_base: sethi %uhi(VPTE_BASE_SPITFIRE), %g3 or %g3, %ulo(VPTE_BASE_SPITFIRE), %g3 sllx %g3, 32, %g3 @@ -500,55 +702,48 @@ setup_trap_table: sllx %o2, 32, %o2 wr %o2, %asr25 + /* Ok, we're done setting up all the state our trap mechanims needs, + * now get back into normal globals and let the PROM know what is up. + */ 2: wrpr %g0, %g0, %wstate - wrpr %o1, 0x0, %pstate + wrpr %o1, PSTATE_IE, %pstate call init_irqwork_curcpu nop - /* Now we can turn interrupts back on. */ - rdpr %pstate, %o1 - or %o1, PSTATE_IE, %o1 - wrpr %o1, 0, %pstate - wrpr %g0, 0x0, %pil - - ret - restore + call prom_set_trap_table + sethi %hi(sparc64_ttable_tl0), %o0 - .globl setup_tba -setup_tba: /* i0 = is_starfire */ - save %sp, -192, %sp + BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g2,g3,1f) + ba,pt %xcc, 2f + nop - /* The boot processor is the only cpu which invokes this - * routine, the other cpus set things up via trampoline.S. - * So save the OBP trap table address here. - */ - rdpr %tba, %g7 - sethi %hi(prom_tba), %o1 - or %o1, %lo(prom_tba), %o1 - stx %g7, [%o1] +1: /* Start using proper page size encodings in ctx register. */ + sethi %uhi(CTX_CHEETAH_PLUS_NUC), %g3 + mov PRIMARY_CONTEXT, %g1 + sllx %g3, 32, %g3 + sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2 + or %g3, %g2, %g3 + stxa %g3, [%g1] ASI_DMMU + membar #Sync - call setup_trap_table - nop +2: + rdpr %pstate, %o1 + or %o1, PSTATE_IE, %o1 + wrpr %o1, 0, %pstate ret restore -sparc64_boot_end: - -#include "systbls.S" -#include "ktlb.S" -#include "etrap.S" -#include "rtrap.S" -#include "winfixup.S" -#include "entry.S" /* - * The following skip makes sure the trap table in ttable.S is aligned + * The following skips make sure the trap table in ttable.S is aligned * on a 32K boundary as required by the v9 specs for TBA register. */ -1: - .skip 0x4000 + _start - 1b +sparc64_boot_end: + .skip 0x2000 + _start - sparc64_boot_end +bootup_user_stack_end: + .skip 0x2000 #ifdef CONFIG_SBUS /* This is just a hack to fool make depend config.h discovering @@ -560,6 +755,20 @@ sparc64_boot_end: ! 0x0000000000408000 #include "ttable.S" +#include "systbls.S" + + .align 1024 + .globl swapper_pg_dir +swapper_pg_dir: + .word 0 + +#include "etrap.S" +#include "rtrap.S" +#include "winfixup.S" +#include "entry.S" + + /* This is just anal retentiveness on my part... */ + .align 16384 .data .align 8 @@ -567,11 +776,8 @@ sparc64_boot_end: prom_tba: .xword 0 tlb_type: .word 0 /* Must NOT end up in BSS */ .section ".fixup",#alloc,#execinstr - - .globl __ret_efault, __retl_efault + .globl __ret_efault __ret_efault: ret restore %g0, -EFAULT, %o0 -__retl_efault: - retl - mov -EFAULT, %o0 + diff --git a/trunk/arch/sparc64/kernel/irq.c b/trunk/arch/sparc64/kernel/irq.c index 233526ba3abe..c9b69167632a 100644 --- a/trunk/arch/sparc64/kernel/irq.c +++ b/trunk/arch/sparc64/kernel/irq.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/trunk/arch/sparc64/kernel/itlb_base.S b/trunk/arch/sparc64/kernel/itlb_base.S index 4951ff8f6877..b5e32dfa4fbc 100644 --- a/trunk/arch/sparc64/kernel/itlb_base.S +++ b/trunk/arch/sparc64/kernel/itlb_base.S @@ -15,12 +15,14 @@ */ #define CREATE_VPTE_OFFSET1(r1, r2) \ srax r1, 10, r2 -#define CREATE_VPTE_OFFSET2(r1, r2) nop +#define CREATE_VPTE_OFFSET2(r1, r2) +#define CREATE_VPTE_NOP nop #else /* PAGE_SHIFT */ #define CREATE_VPTE_OFFSET1(r1, r2) \ srax r1, PAGE_SHIFT, r2 #define CREATE_VPTE_OFFSET2(r1, r2) \ sllx r2, 3, r2 +#define CREATE_VPTE_NOP #endif /* PAGE_SHIFT */ @@ -34,7 +36,6 @@ */ /* ITLB ** ICACHE line 1: Quick user TLB misses */ - mov TLB_SFSR, %g1 ldxa [%g1 + %g1] ASI_IMMU, %g4 ! Get TAG_ACCESS CREATE_VPTE_OFFSET1(%g4, %g6) ! Create VPTE offset CREATE_VPTE_OFFSET2(%g4, %g6) ! Create VPTE offset @@ -42,38 +43,41 @@ 1: brgez,pn %g5, 3f ! Not valid, branch out sethi %hi(_PAGE_EXEC), %g4 ! Delay-slot andcc %g5, %g4, %g0 ! Executable? - -/* ITLB ** ICACHE line 2: Real faults */ be,pn %xcc, 3f ! Nope, branch. nop ! Delay-slot 2: stxa %g5, [%g0] ASI_ITLB_DATA_IN ! Load PTE into TLB retry ! Trap return -3: rdpr %pstate, %g4 ! Move into alt-globals +3: rdpr %pstate, %g4 ! Move into alternate globals + +/* ITLB ** ICACHE line 2: Real faults */ wrpr %g4, PSTATE_AG|PSTATE_MG, %pstate rdpr %tpc, %g5 ! And load faulting VA mov FAULT_CODE_ITLB, %g4 ! It was read from ITLB - -/* ITLB ** ICACHE line 3: Finish faults */ -sparc64_realfault_common: ! Called by dtlb_miss +sparc64_realfault_common: ! Called by TL0 dtlb_miss too stb %g4, [%g6 + TI_FAULT_CODE] stx %g5, [%g6 + TI_FAULT_ADDR] ba,pt %xcc, etrap ! Save state 1: rd %pc, %g7 ! ... + nop + +/* ITLB ** ICACHE line 3: Finish faults + window fixups */ call do_sparc64_fault ! Call fault handler add %sp, PTREGS_OFF, %o0! Compute pt_regs arg ba,pt %xcc, rtrap_clr_l6 ! Restore cpu state nop - -/* ITLB ** ICACHE line 4: Window fixups */ winfix_trampoline: rdpr %tpc, %g3 ! Prepare winfixup TNPC - or %g3, 0x7c, %g3 ! Compute branch offset + or %g3, 0x7c, %g3 ! Compute offset to branch wrpr %g3, %tnpc ! Write it into TNPC done ! Do it to it + +/* ITLB ** ICACHE line 4: Unused... */ nop nop nop nop + CREATE_VPTE_NOP #undef CREATE_VPTE_OFFSET1 #undef CREATE_VPTE_OFFSET2 +#undef CREATE_VPTE_NOP diff --git a/trunk/arch/sparc64/kernel/ktlb.S b/trunk/arch/sparc64/kernel/ktlb.S deleted file mode 100644 index d9244d3c9f73..000000000000 --- a/trunk/arch/sparc64/kernel/ktlb.S +++ /dev/null @@ -1,194 +0,0 @@ -/* arch/sparc64/kernel/ktlb.S: Kernel mapping TLB miss handling. - * - * Copyright (C) 1995, 1997, 2005 David S. Miller - * Copyright (C) 1996 Eddie C. Dost (ecd@brainaid.de) - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz) -*/ - -#include -#include -#include -#include -#include - - .text - .align 32 - -/* - * On a second level vpte miss, check whether the original fault is to the OBP - * range (note that this is only possible for instruction miss, data misses to - * obp range do not use vpte). If so, go back directly to the faulting address. - * This is because we want to read the tpc, otherwise we have no way of knowing - * the 8k aligned faulting address if we are using >8k kernel pagesize. This - * also ensures no vpte range addresses are dropped into tlb while obp is - * executing (see inherit_locked_prom_mappings() rant). - */ -sparc64_vpte_nucleus: - /* Note that kvmap below has verified that the address is - * in the range MODULES_VADDR --> VMALLOC_END already. So - * here we need only check if it is an OBP address or not. - */ - sethi %hi(LOW_OBP_ADDRESS), %g5 - cmp %g4, %g5 - blu,pn %xcc, kern_vpte - mov 0x1, %g5 - sllx %g5, 32, %g5 - cmp %g4, %g5 - blu,pn %xcc, vpte_insn_obp - nop - - /* These two instructions are patched by paginig_init(). */ -kern_vpte: - sethi %hi(swapper_pgd_zero), %g5 - lduw [%g5 + %lo(swapper_pgd_zero)], %g5 - - /* With kernel PGD in %g5, branch back into dtlb_backend. */ - ba,pt %xcc, sparc64_kpte_continue - andn %g1, 0x3, %g1 /* Finish PMD offset adjustment. */ - -vpte_noent: - /* Restore previous TAG_ACCESS, %g5 is zero, and we will - * skip over the trap instruction so that the top level - * TLB miss handler will thing this %g5 value is just an - * invalid PTE, thus branching to full fault processing. - */ - mov TLB_SFSR, %g1 - stxa %g4, [%g1 + %g1] ASI_DMMU - done - -vpte_insn_obp: - /* Behave as if we are at TL0. */ - wrpr %g0, 1, %tl - rdpr %tpc, %g4 /* Find original faulting iaddr */ - srlx %g4, 13, %g4 /* Throw out context bits */ - sllx %g4, 13, %g4 /* g4 has vpn + ctx0 now */ - - /* Restore previous TAG_ACCESS. */ - mov TLB_SFSR, %g1 - stxa %g4, [%g1 + %g1] ASI_IMMU - - sethi %hi(prom_trans), %g5 - or %g5, %lo(prom_trans), %g5 - -1: ldx [%g5 + 0x00], %g6 ! base - brz,a,pn %g6, longpath ! no more entries, fail - mov TLB_SFSR, %g1 ! and restore %g1 - ldx [%g5 + 0x08], %g1 ! len - add %g6, %g1, %g1 ! end - cmp %g6, %g4 - bgu,pt %xcc, 2f - cmp %g4, %g1 - bgeu,pt %xcc, 2f - ldx [%g5 + 0x10], %g1 ! PTE - - /* TLB load, restore %g1, and return from trap. */ - sub %g4, %g6, %g6 - add %g1, %g6, %g5 - mov TLB_SFSR, %g1 - stxa %g5, [%g0] ASI_ITLB_DATA_IN - retry - -2: ba,pt %xcc, 1b - add %g5, (3 * 8), %g5 ! next entry - -kvmap_do_obp: - sethi %hi(prom_trans), %g5 - or %g5, %lo(prom_trans), %g5 - srlx %g4, 13, %g4 - sllx %g4, 13, %g4 - -1: ldx [%g5 + 0x00], %g6 ! base - brz,a,pn %g6, longpath ! no more entries, fail - mov TLB_SFSR, %g1 ! and restore %g1 - ldx [%g5 + 0x08], %g1 ! len - add %g6, %g1, %g1 ! end - cmp %g6, %g4 - bgu,pt %xcc, 2f - cmp %g4, %g1 - bgeu,pt %xcc, 2f - ldx [%g5 + 0x10], %g1 ! PTE - - /* TLB load, restore %g1, and return from trap. */ - sub %g4, %g6, %g6 - add %g1, %g6, %g5 - mov TLB_SFSR, %g1 - stxa %g5, [%g0] ASI_DTLB_DATA_IN - retry - -2: ba,pt %xcc, 1b - add %g5, (3 * 8), %g5 ! next entry - -/* - * On a first level data miss, check whether this is to the OBP range (note - * that such accesses can be made by prom, as well as by kernel using - * prom_getproperty on "address"), and if so, do not use vpte access ... - * rather, use information saved during inherit_prom_mappings() using 8k - * pagesize. - */ - .align 32 -kvmap: - brgez,pn %g4, kvmap_nonlinear - nop - -#ifdef CONFIG_DEBUG_PAGEALLOC - .globl kvmap_linear_patch -kvmap_linear_patch: -#endif - ba,pt %xcc, kvmap_load - xor %g2, %g4, %g5 - -#ifdef CONFIG_DEBUG_PAGEALLOC - sethi %hi(swapper_pg_dir), %g5 - or %g5, %lo(swapper_pg_dir), %g5 - sllx %g4, 64 - (PGDIR_SHIFT + PGDIR_BITS), %g6 - srlx %g6, 64 - PAGE_SHIFT, %g6 - andn %g6, 0x3, %g6 - lduw [%g5 + %g6], %g5 - brz,pn %g5, longpath - sllx %g4, 64 - (PMD_SHIFT + PMD_BITS), %g6 - srlx %g6, 64 - PAGE_SHIFT, %g6 - sllx %g5, 11, %g5 - andn %g6, 0x3, %g6 - lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 - brz,pn %g5, longpath - sllx %g4, 64 - PMD_SHIFT, %g6 - srlx %g6, 64 - PAGE_SHIFT, %g6 - sllx %g5, 11, %g5 - andn %g6, 0x7, %g6 - ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5 - brz,pn %g5, longpath - nop - ba,a,pt %xcc, kvmap_load -#endif - -kvmap_nonlinear: - sethi %hi(MODULES_VADDR), %g5 - cmp %g4, %g5 - blu,pn %xcc, longpath - mov (VMALLOC_END >> 24), %g5 - sllx %g5, 24, %g5 - cmp %g4, %g5 - bgeu,pn %xcc, longpath - nop - -kvmap_check_obp: - sethi %hi(LOW_OBP_ADDRESS), %g5 - cmp %g4, %g5 - blu,pn %xcc, kvmap_vmalloc_addr - mov 0x1, %g5 - sllx %g5, 32, %g5 - cmp %g4, %g5 - blu,pn %xcc, kvmap_do_obp - nop - -kvmap_vmalloc_addr: - /* If we get here, a vmalloc addr was accessed, load kernel VPTE. */ - ldxa [%g3 + %g6] ASI_N, %g5 - brgez,pn %g5, longpath - nop - -kvmap_load: - /* PTE is valid, load into TLB and return from trap. */ - stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB - retry diff --git a/trunk/arch/sparc64/kernel/pci_iommu.c b/trunk/arch/sparc64/kernel/pci_iommu.c index a11910be1013..425c60cfea19 100644 --- a/trunk/arch/sparc64/kernel/pci_iommu.c +++ b/trunk/arch/sparc64/kernel/pci_iommu.c @@ -49,6 +49,12 @@ static void __iommu_flushall(struct pci_iommu *iommu) /* Ensure completion of previous PIO writes. */ (void) pci_iommu_read(iommu->write_complete_reg); + + /* Now update everyone's flush point. */ + for (entry = 0; entry < PBM_NCLUSTERS; entry++) { + iommu->alloc_info[entry].flush = + iommu->alloc_info[entry].next; + } } #define IOPTE_CONSISTENT(CTX) \ @@ -74,117 +80,120 @@ static void inline iopte_make_dummy(struct pci_iommu *iommu, iopte_t *iopte) iopte_val(*iopte) = val; } -/* Based largely upon the ppc64 iommu allocator. */ -static long pci_arena_alloc(struct pci_iommu *iommu, unsigned long npages) +void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize) { - struct pci_iommu_arena *arena = &iommu->arena; - unsigned long n, i, start, end, limit; - int pass; - - limit = arena->limit; - start = arena->hint; - pass = 0; - -again: - n = find_next_zero_bit(arena->map, limit, start); - end = n + npages; - if (unlikely(end >= limit)) { - if (likely(pass < 1)) { - limit = start; - start = 0; - __iommu_flushall(iommu); - pass++; - goto again; - } else { - /* Scanned the whole thing, give up. */ - return -1; - } - } + int i; + + tsbsize /= sizeof(iopte_t); + + for (i = 0; i < tsbsize; i++) + iopte_make_dummy(iommu, &iommu->page_table[i]); +} + +static iopte_t *alloc_streaming_cluster(struct pci_iommu *iommu, unsigned long npages) +{ + iopte_t *iopte, *limit, *first; + unsigned long cnum, ent, flush_point; + + cnum = 0; + while ((1UL << cnum) < npages) + cnum++; + iopte = (iommu->page_table + + (cnum << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS))); + + if (cnum == 0) + limit = (iommu->page_table + + iommu->lowest_consistent_map); + else + limit = (iopte + + (1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS))); - for (i = n; i < end; i++) { - if (test_bit(i, arena->map)) { - start = i + 1; - goto again; + iopte += ((ent = iommu->alloc_info[cnum].next) << cnum); + flush_point = iommu->alloc_info[cnum].flush; + + first = iopte; + for (;;) { + if (IOPTE_IS_DUMMY(iommu, iopte)) { + if ((iopte + (1 << cnum)) >= limit) + ent = 0; + else + ent = ent + 1; + iommu->alloc_info[cnum].next = ent; + if (ent == flush_point) + __iommu_flushall(iommu); + break; + } + iopte += (1 << cnum); + ent++; + if (iopte >= limit) { + iopte = (iommu->page_table + + (cnum << + (iommu->page_table_sz_bits - PBM_LOGCLUSTERS))); + ent = 0; } + if (ent == flush_point) + __iommu_flushall(iommu); + if (iopte == first) + goto bad; } - for (i = n; i < end; i++) - __set_bit(i, arena->map); - - arena->hint = end; + /* I've got your streaming cluster right here buddy boy... */ + return iopte; - return n; +bad: + printk(KERN_EMERG "pci_iommu: alloc_streaming_cluster of npages(%ld) failed!\n", + npages); + return NULL; } -static void pci_arena_free(struct pci_iommu_arena *arena, unsigned long base, unsigned long npages) +static void free_streaming_cluster(struct pci_iommu *iommu, dma_addr_t base, + unsigned long npages, unsigned long ctx) { - unsigned long i; + unsigned long cnum, ent; - for (i = base; i < (base + npages); i++) - __clear_bit(i, arena->map); -} + cnum = 0; + while ((1UL << cnum) < npages) + cnum++; -void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask) -{ - unsigned long i, tsbbase, order, sz, num_tsb_entries; - - num_tsb_entries = tsbsize / sizeof(iopte_t); - - /* Setup initial software IOMMU state. */ - spin_lock_init(&iommu->lock); - iommu->ctx_lowest_free = 1; - iommu->page_table_map_base = dma_offset; - iommu->dma_addr_mask = dma_addr_mask; - - /* Allocate and initialize the free area map. */ - sz = num_tsb_entries / 8; - sz = (sz + 7UL) & ~7UL; - iommu->arena.map = kmalloc(sz, GFP_KERNEL); - if (!iommu->arena.map) { - prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n"); - prom_halt(); - } - memset(iommu->arena.map, 0, sz); - iommu->arena.limit = num_tsb_entries; + ent = (base << (32 - IO_PAGE_SHIFT + PBM_LOGCLUSTERS - iommu->page_table_sz_bits)) + >> (32 + PBM_LOGCLUSTERS + cnum - iommu->page_table_sz_bits); - /* Allocate and initialize the dummy page which we - * set inactive IO PTEs to point to. + /* If the global flush might not have caught this entry, + * adjust the flush point such that we will flush before + * ever trying to reuse it. */ - iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); - if (!iommu->dummy_page) { - prom_printf("PCI_IOMMU: Error, gfp(dummy_page) failed.\n"); - prom_halt(); - } - memset((void *)iommu->dummy_page, 0, PAGE_SIZE); - iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page); - - /* Now allocate and setup the IOMMU page table itself. */ - order = get_order(tsbsize); - tsbbase = __get_free_pages(GFP_KERNEL, order); - if (!tsbbase) { - prom_printf("PCI_IOMMU: Error, gfp(tsb) failed.\n"); - prom_halt(); - } - iommu->page_table = (iopte_t *)tsbbase; - - for (i = 0; i < num_tsb_entries; i++) - iopte_make_dummy(iommu, &iommu->page_table[i]); +#define between(X,Y,Z) (((Z) - (Y)) >= ((X) - (Y))) + if (between(ent, iommu->alloc_info[cnum].next, iommu->alloc_info[cnum].flush)) + iommu->alloc_info[cnum].flush = ent; +#undef between } -static inline iopte_t *alloc_npages(struct pci_iommu *iommu, unsigned long npages) +/* We allocate consistent mappings from the end of cluster zero. */ +static iopte_t *alloc_consistent_cluster(struct pci_iommu *iommu, unsigned long npages) { - long entry; + iopte_t *iopte; - entry = pci_arena_alloc(iommu, npages); - if (unlikely(entry < 0)) - return NULL; + iopte = iommu->page_table + (1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS)); + while (iopte > iommu->page_table) { + iopte--; + if (IOPTE_IS_DUMMY(iommu, iopte)) { + unsigned long tmp = npages; - return iommu->page_table + entry; -} + while (--tmp) { + iopte--; + if (!IOPTE_IS_DUMMY(iommu, iopte)) + break; + } + if (tmp == 0) { + u32 entry = (iopte - iommu->page_table); -static inline void free_npages(struct pci_iommu *iommu, dma_addr_t base, unsigned long npages) -{ - pci_arena_free(&iommu->arena, base >> IO_PAGE_SHIFT, npages); + if (entry < iommu->lowest_consistent_map) + iommu->lowest_consistent_map = entry; + return iopte; + } + } + } + return NULL; } static int iommu_alloc_ctx(struct pci_iommu *iommu) @@ -224,7 +233,7 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_ad struct pcidev_cookie *pcp; struct pci_iommu *iommu; iopte_t *iopte; - unsigned long flags, order, first_page; + unsigned long flags, order, first_page, ctx; void *ret; int npages; @@ -242,10 +251,9 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_ad iommu = pcp->pbm->iommu; spin_lock_irqsave(&iommu->lock, flags); - iopte = alloc_npages(iommu, size >> IO_PAGE_SHIFT); - spin_unlock_irqrestore(&iommu->lock, flags); - - if (unlikely(iopte == NULL)) { + iopte = alloc_consistent_cluster(iommu, size >> IO_PAGE_SHIFT); + if (iopte == NULL) { + spin_unlock_irqrestore(&iommu->lock, flags); free_pages(first_page, order); return NULL; } @@ -254,15 +262,31 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_ad ((iopte - iommu->page_table) << IO_PAGE_SHIFT)); ret = (void *) first_page; npages = size >> IO_PAGE_SHIFT; + ctx = 0; + if (iommu->iommu_ctxflush) + ctx = iommu_alloc_ctx(iommu); first_page = __pa(first_page); while (npages--) { - iopte_val(*iopte) = (IOPTE_CONSISTENT(0UL) | + iopte_val(*iopte) = (IOPTE_CONSISTENT(ctx) | IOPTE_WRITE | (first_page & IOPTE_PAGE)); iopte++; first_page += IO_PAGE_SIZE; } + { + int i; + u32 daddr = *dma_addrp; + + npages = size >> IO_PAGE_SHIFT; + for (i = 0; i < npages; i++) { + pci_iommu_write(iommu->iommu_flush, daddr); + daddr += IO_PAGE_SIZE; + } + } + + spin_unlock_irqrestore(&iommu->lock, flags); + return ret; } @@ -272,7 +296,7 @@ void pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_ struct pcidev_cookie *pcp; struct pci_iommu *iommu; iopte_t *iopte; - unsigned long flags, order, npages; + unsigned long flags, order, npages, i, ctx; npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT; pcp = pdev->sysdata; @@ -282,7 +306,46 @@ void pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_ spin_lock_irqsave(&iommu->lock, flags); - free_npages(iommu, dvma, npages); + if ((iopte - iommu->page_table) == + iommu->lowest_consistent_map) { + iopte_t *walk = iopte + npages; + iopte_t *limit; + + limit = (iommu->page_table + + (1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS))); + while (walk < limit) { + if (!IOPTE_IS_DUMMY(iommu, walk)) + break; + walk++; + } + iommu->lowest_consistent_map = + (walk - iommu->page_table); + } + + /* Data for consistent mappings cannot enter the streaming + * buffers, so we only need to update the TSB. We flush + * the IOMMU here as well to prevent conflicts with the + * streaming mapping deferred tlb flush scheme. + */ + + ctx = 0; + if (iommu->iommu_ctxflush) + ctx = (iopte_val(*iopte) & IOPTE_CONTEXT) >> 47UL; + + for (i = 0; i < npages; i++, iopte++) + iopte_make_dummy(iommu, iopte); + + if (iommu->iommu_ctxflush) { + pci_iommu_write(iommu->iommu_ctxflush, ctx); + } else { + for (i = 0; i < npages; i++) { + u32 daddr = dvma + (i << IO_PAGE_SHIFT); + + pci_iommu_write(iommu->iommu_flush, daddr); + } + } + + iommu_free_ctx(iommu, ctx); spin_unlock_irqrestore(&iommu->lock, flags); @@ -309,27 +372,25 @@ dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direct iommu = pcp->pbm->iommu; strbuf = &pcp->pbm->stc; - if (unlikely(direction == PCI_DMA_NONE)) - goto bad_no_ctx; + if (direction == PCI_DMA_NONE) + BUG(); oaddr = (unsigned long)ptr; npages = IO_PAGE_ALIGN(oaddr + sz) - (oaddr & IO_PAGE_MASK); npages >>= IO_PAGE_SHIFT; spin_lock_irqsave(&iommu->lock, flags); - base = alloc_npages(iommu, npages); - ctx = 0; - if (iommu->iommu_ctxflush) - ctx = iommu_alloc_ctx(iommu); - spin_unlock_irqrestore(&iommu->lock, flags); - if (unlikely(!base)) + base = alloc_streaming_cluster(iommu, npages); + if (base == NULL) goto bad; - bus_addr = (iommu->page_table_map_base + ((base - iommu->page_table) << IO_PAGE_SHIFT)); ret = bus_addr | (oaddr & ~IO_PAGE_MASK); base_paddr = __pa(oaddr & IO_PAGE_MASK); + ctx = 0; + if (iommu->iommu_ctxflush) + ctx = iommu_alloc_ctx(iommu); if (strbuf->strbuf_enabled) iopte_protection = IOPTE_STREAMING(ctx); else @@ -340,13 +401,12 @@ dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direct for (i = 0; i < npages; i++, base++, base_paddr += IO_PAGE_SIZE) iopte_val(*base) = iopte_protection | base_paddr; + spin_unlock_irqrestore(&iommu->lock, flags); + return ret; bad: - iommu_free_ctx(iommu, ctx); -bad_no_ctx: - if (printk_ratelimit()) - WARN_ON(1); + spin_unlock_irqrestore(&iommu->lock, flags); return PCI_DMA_ERROR_CODE; } @@ -421,13 +481,10 @@ void pci_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int struct pci_iommu *iommu; struct pci_strbuf *strbuf; iopte_t *base; - unsigned long flags, npages, ctx, i; + unsigned long flags, npages, ctx; - if (unlikely(direction == PCI_DMA_NONE)) { - if (printk_ratelimit()) - WARN_ON(1); - return; - } + if (direction == PCI_DMA_NONE) + BUG(); pcp = pdev->sysdata; iommu = pcp->pbm->iommu; @@ -453,14 +510,13 @@ void pci_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int /* Step 1: Kick data out of streaming buffers if necessary. */ if (strbuf->strbuf_enabled) - pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, - npages, direction); + pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction); - /* Step 2: Clear out TSB entries. */ - for (i = 0; i < npages; i++) - iopte_make_dummy(iommu, base + i); + /* Step 2: Clear out first TSB entry. */ + iopte_make_dummy(iommu, base); - free_npages(iommu, bus_addr - iommu->page_table_map_base, npages); + free_streaming_cluster(iommu, bus_addr - iommu->page_table_map_base, + npages, ctx); iommu_free_ctx(iommu, ctx); @@ -565,8 +621,6 @@ int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int pci_map_single(pdev, (page_address(sglist->page) + sglist->offset), sglist->length, direction); - if (unlikely(sglist->dma_address == PCI_DMA_ERROR_CODE)) - return 0; sglist->dma_length = sglist->length; return 1; } @@ -575,29 +629,21 @@ int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int iommu = pcp->pbm->iommu; strbuf = &pcp->pbm->stc; - if (unlikely(direction == PCI_DMA_NONE)) - goto bad_no_ctx; + if (direction == PCI_DMA_NONE) + BUG(); /* Step 1: Prepare scatter list. */ npages = prepare_sg(sglist, nelems); - /* Step 2: Allocate a cluster and context, if necessary. */ + /* Step 2: Allocate a cluster. */ spin_lock_irqsave(&iommu->lock, flags); - base = alloc_npages(iommu, npages); - ctx = 0; - if (iommu->iommu_ctxflush) - ctx = iommu_alloc_ctx(iommu); - - spin_unlock_irqrestore(&iommu->lock, flags); - + base = alloc_streaming_cluster(iommu, npages); if (base == NULL) goto bad; - - dma_base = iommu->page_table_map_base + - ((base - iommu->page_table) << IO_PAGE_SHIFT); + dma_base = iommu->page_table_map_base + ((base - iommu->page_table) << IO_PAGE_SHIFT); /* Step 3: Normalize DMA addresses. */ used = nelems; @@ -610,28 +656,30 @@ int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int } used = nelems - used; - /* Step 4: Create the mappings. */ + /* Step 4: Choose a context if necessary. */ + ctx = 0; + if (iommu->iommu_ctxflush) + ctx = iommu_alloc_ctx(iommu); + + /* Step 5: Create the mappings. */ if (strbuf->strbuf_enabled) iopte_protection = IOPTE_STREAMING(ctx); else iopte_protection = IOPTE_CONSISTENT(ctx); if (direction != PCI_DMA_TODEVICE) iopte_protection |= IOPTE_WRITE; - - fill_sg(base, sglist, used, nelems, iopte_protection); - + fill_sg (base, sglist, used, nelems, iopte_protection); #ifdef VERIFY_SG verify_sglist(sglist, nelems, base, npages); #endif + spin_unlock_irqrestore(&iommu->lock, flags); + return used; bad: - iommu_free_ctx(iommu, ctx); -bad_no_ctx: - if (printk_ratelimit()) - WARN_ON(1); - return 0; + spin_unlock_irqrestore(&iommu->lock, flags); + return PCI_DMA_ERROR_CODE; } /* Unmap a set of streaming mode DMA translations. */ @@ -644,10 +692,8 @@ void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, unsigned long flags, ctx, i, npages; u32 bus_addr; - if (unlikely(direction == PCI_DMA_NONE)) { - if (printk_ratelimit()) - WARN_ON(1); - } + if (direction == PCI_DMA_NONE) + BUG(); pcp = pdev->sysdata; iommu = pcp->pbm->iommu; @@ -659,8 +705,7 @@ void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, if (sglist[i].dma_length == 0) break; i--; - npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) - - bus_addr) >> IO_PAGE_SHIFT; + npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) - bus_addr) >> IO_PAGE_SHIFT; base = iommu->page_table + ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); @@ -681,11 +726,11 @@ void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, if (strbuf->strbuf_enabled) pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction); - /* Step 2: Clear out the TSB entries. */ - for (i = 0; i < npages; i++) - iopte_make_dummy(iommu, base + i); + /* Step 2: Clear out first TSB entry. */ + iopte_make_dummy(iommu, base); - free_npages(iommu, bus_addr - iommu->page_table_map_base, npages); + free_streaming_cluster(iommu, bus_addr - iommu->page_table_map_base, + npages, ctx); iommu_free_ctx(iommu, ctx); diff --git a/trunk/arch/sparc64/kernel/pci_psycho.c b/trunk/arch/sparc64/kernel/pci_psycho.c index c03ed5f49d31..6ed1ef25e0ac 100644 --- a/trunk/arch/sparc64/kernel/pci_psycho.c +++ b/trunk/arch/sparc64/kernel/pci_psycho.c @@ -1207,9 +1207,13 @@ static void psycho_scan_bus(struct pci_controller_info *p) static void psycho_iommu_init(struct pci_controller_info *p) { struct pci_iommu *iommu = p->pbm_A.iommu; - unsigned long i; + unsigned long tsbbase, i; u64 control; + /* Setup initial software IOMMU state. */ + spin_lock_init(&iommu->lock); + iommu->ctx_lowest_free = 1; + /* Register addresses. */ iommu->iommu_control = p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL; iommu->iommu_tsbbase = p->pbm_A.controller_regs + PSYCHO_IOMMU_TSBBASE; @@ -1236,10 +1240,40 @@ static void psycho_iommu_init(struct pci_controller_info *p) /* Leave diag mode enabled for full-flushing done * in pci_iommu.c */ - pci_iommu_table_init(iommu, IO_TSB_SIZE, 0xc0000000, 0xffffffff); - psycho_write(p->pbm_A.controller_regs + PSYCHO_IOMMU_TSBBASE, - __pa(iommu->page_table)); + iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); + if (!iommu->dummy_page) { + prom_printf("PSYCHO_IOMMU: Error, gfp(dummy_page) failed.\n"); + prom_halt(); + } + memset((void *)iommu->dummy_page, 0, PAGE_SIZE); + iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page); + + /* Using assumed page size 8K with 128K entries we need 1MB iommu page + * table (128K ioptes * 8 bytes per iopte). This is + * page order 7 on UltraSparc. + */ + tsbbase = __get_free_pages(GFP_KERNEL, get_order(IO_TSB_SIZE)); + if (!tsbbase) { + prom_printf("PSYCHO_IOMMU: Error, gfp(tsb) failed.\n"); + prom_halt(); + } + iommu->page_table = (iopte_t *)tsbbase; + iommu->page_table_sz_bits = 17; + iommu->page_table_map_base = 0xc0000000; + iommu->dma_addr_mask = 0xffffffff; + pci_iommu_table_init(iommu, IO_TSB_SIZE); + + /* We start with no consistent mappings. */ + iommu->lowest_consistent_map = + 1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS); + + for (i = 0; i < PBM_NCLUSTERS; i++) { + iommu->alloc_info[i].flush = 0; + iommu->alloc_info[i].next = 0; + } + + psycho_write(p->pbm_A.controller_regs + PSYCHO_IOMMU_TSBBASE, __pa(tsbbase)); control = psycho_read(p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL); control &= ~(PSYCHO_IOMMU_CTRL_TSBSZ | PSYCHO_IOMMU_CTRL_TBWSZ); @@ -1247,7 +1281,7 @@ static void psycho_iommu_init(struct pci_controller_info *p) psycho_write(p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL, control); /* If necessary, hook us up for starfire IRQ translations. */ - if (this_is_starfire) + if(this_is_starfire) p->starfire_cookie = starfire_hookup(p->pbm_A.portid); else p->starfire_cookie = NULL; diff --git a/trunk/arch/sparc64/kernel/pci_sabre.c b/trunk/arch/sparc64/kernel/pci_sabre.c index da8e1364194f..0ee6bd5b9ac6 100644 --- a/trunk/arch/sparc64/kernel/pci_sabre.c +++ b/trunk/arch/sparc64/kernel/pci_sabre.c @@ -1267,9 +1267,13 @@ static void sabre_iommu_init(struct pci_controller_info *p, u32 dma_mask) { struct pci_iommu *iommu = p->pbm_A.iommu; - unsigned long i; + unsigned long tsbbase, i, order; u64 control; + /* Setup initial software IOMMU state. */ + spin_lock_init(&iommu->lock); + iommu->ctx_lowest_free = 1; + /* Register addresses. */ iommu->iommu_control = p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL; iommu->iommu_tsbbase = p->pbm_A.controller_regs + SABRE_IOMMU_TSBBASE; @@ -1291,10 +1295,26 @@ static void sabre_iommu_init(struct pci_controller_info *p, /* Leave diag mode enabled for full-flushing done * in pci_iommu.c */ - pci_iommu_table_init(iommu, tsbsize * 1024 * 8, dvma_offset, dma_mask); - sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_TSBBASE, - __pa(iommu->page_table)); + iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); + if (!iommu->dummy_page) { + prom_printf("PSYCHO_IOMMU: Error, gfp(dummy_page) failed.\n"); + prom_halt(); + } + memset((void *)iommu->dummy_page, 0, PAGE_SIZE); + iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page); + + tsbbase = __get_free_pages(GFP_KERNEL, order = get_order(tsbsize * 1024 * 8)); + if (!tsbbase) { + prom_printf("SABRE_IOMMU: Error, gfp(tsb) failed.\n"); + prom_halt(); + } + iommu->page_table = (iopte_t *)tsbbase; + iommu->page_table_map_base = dvma_offset; + iommu->dma_addr_mask = dma_mask; + pci_iommu_table_init(iommu, PAGE_SIZE << order); + + sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_TSBBASE, __pa(tsbbase)); control = sabre_read(p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL); control &= ~(SABRE_IOMMUCTRL_TSBSZ | SABRE_IOMMUCTRL_TBWSZ); @@ -1302,9 +1322,11 @@ static void sabre_iommu_init(struct pci_controller_info *p, switch(tsbsize) { case 64: control |= SABRE_IOMMU_TSBSZ_64K; + iommu->page_table_sz_bits = 16; break; case 128: control |= SABRE_IOMMU_TSBSZ_128K; + iommu->page_table_sz_bits = 17; break; default: prom_printf("iommu_init: Illegal TSB size %d\n", tsbsize); @@ -1312,6 +1334,15 @@ static void sabre_iommu_init(struct pci_controller_info *p, break; } sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL, control); + + /* We start with no consistent mappings. */ + iommu->lowest_consistent_map = + 1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS); + + for (i = 0; i < PBM_NCLUSTERS; i++) { + iommu->alloc_info[i].flush = 0; + iommu->alloc_info[i].next = 0; + } } static void pbm_register_toplevel_resources(struct pci_controller_info *p, diff --git a/trunk/arch/sparc64/kernel/pci_schizo.c b/trunk/arch/sparc64/kernel/pci_schizo.c index d8c4e0919b4e..331382e1a75d 100644 --- a/trunk/arch/sparc64/kernel/pci_schizo.c +++ b/trunk/arch/sparc64/kernel/pci_schizo.c @@ -330,7 +330,7 @@ static int schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino) static void tomatillo_wsync_handler(struct ino_bucket *bucket, void *_arg1, void *_arg2) { unsigned long sync_reg = (unsigned long) _arg2; - u64 mask = 1UL << (__irq_ino(__irq(bucket)) & IMAP_INO); + u64 mask = 1 << (__irq_ino(__irq(bucket)) & IMAP_INO); u64 val; int limit; @@ -1765,7 +1765,7 @@ static void schizo_pbm_strbuf_init(struct pci_pbm_info *pbm) static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm) { struct pci_iommu *iommu = pbm->iommu; - unsigned long i, tagbase, database; + unsigned long tsbbase, i, tagbase, database, order; u32 vdma[2], dma_mask; u64 control; int err, tsbsize; @@ -1800,6 +1800,10 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm) prom_halt(); }; + /* Setup initial software IOMMU state. */ + spin_lock_init(&iommu->lock); + iommu->ctx_lowest_free = 1; + /* Register addresses, SCHIZO has iommu ctx flushing. */ iommu->iommu_control = pbm->pbm_regs + SCHIZO_IOMMU_CONTROL; iommu->iommu_tsbbase = pbm->pbm_regs + SCHIZO_IOMMU_TSBBASE; @@ -1828,9 +1832,56 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm) /* Leave diag mode enabled for full-flushing done * in pci_iommu.c */ - pci_iommu_table_init(iommu, tsbsize * 8 * 1024, vdma[0], dma_mask); - schizo_write(iommu->iommu_tsbbase, __pa(iommu->page_table)); + iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); + if (!iommu->dummy_page) { + prom_printf("PSYCHO_IOMMU: Error, gfp(dummy_page) failed.\n"); + prom_halt(); + } + memset((void *)iommu->dummy_page, 0, PAGE_SIZE); + iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page); + + /* Using assumed page size 8K with 128K entries we need 1MB iommu page + * table (128K ioptes * 8 bytes per iopte). This is + * page order 7 on UltraSparc. + */ + order = get_order(tsbsize * 8 * 1024); + tsbbase = __get_free_pages(GFP_KERNEL, order); + if (!tsbbase) { + prom_printf("%s: Error, gfp(tsb) failed.\n", pbm->name); + prom_halt(); + } + + iommu->page_table = (iopte_t *)tsbbase; + iommu->page_table_map_base = vdma[0]; + iommu->dma_addr_mask = dma_mask; + pci_iommu_table_init(iommu, PAGE_SIZE << order); + + switch (tsbsize) { + case 64: + iommu->page_table_sz_bits = 16; + break; + + case 128: + iommu->page_table_sz_bits = 17; + break; + + default: + prom_printf("iommu_init: Illegal TSB size %d\n", tsbsize); + prom_halt(); + break; + }; + + /* We start with no consistent mappings. */ + iommu->lowest_consistent_map = + 1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS); + + for (i = 0; i < PBM_NCLUSTERS; i++) { + iommu->alloc_info[i].flush = 0; + iommu->alloc_info[i].next = 0; + } + + schizo_write(iommu->iommu_tsbbase, __pa(tsbbase)); control = schizo_read(iommu->iommu_control); control &= ~(SCHIZO_IOMMU_CTRL_TSBSZ | SCHIZO_IOMMU_CTRL_TBWSZ); diff --git a/trunk/arch/sparc64/kernel/power.c b/trunk/arch/sparc64/kernel/power.c index 9e8362ea3104..946cee0257ea 100644 --- a/trunk/arch/sparc64/kernel/power.c +++ b/trunk/arch/sparc64/kernel/power.c @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -101,83 +100,46 @@ static int powerd(void *__unused) return 0; } -static int __init has_button_interrupt(unsigned int irq, int prom_node) +static int __init has_button_interrupt(struct linux_ebus_device *edev) { - if (irq == PCI_IRQ_NONE) + if (edev->irqs[0] == PCI_IRQ_NONE) return 0; - if (!prom_node_has_property(prom_node, "button")) + if (!prom_node_has_property(edev->prom_node, "button")) return 0; return 1; } -static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p, int *prom_node_p) +void __init power_init(void) { struct linux_ebus *ebus; struct linux_ebus_device *edev; - - for_each_ebus(ebus) { - for_each_ebusdev(edev, ebus) { - if (!strcmp(edev->prom_name, "power")) { - *resp = &edev->resource[0]; - *irq_p = edev->irqs[0]; - *prom_node_p = edev->prom_node; - return 0; - } - } - } - return -ENODEV; -} - -static int __init power_probe_isa(struct resource **resp, unsigned int *irq_p, int *prom_node_p) -{ - struct sparc_isa_bridge *isa_bus; - struct sparc_isa_device *isa_dev; - - for_each_isa(isa_bus) { - for_each_isadev(isa_dev, isa_bus) { - if (!strcmp(isa_dev->prom_name, "power")) { - *resp = &isa_dev->resource; - *irq_p = isa_dev->irq; - *prom_node_p = isa_dev->prom_node; - return 0; - } - } - } - return -ENODEV; -} - -void __init power_init(void) -{ - struct resource *res = NULL; - unsigned int irq; - int prom_node; static int invoked; if (invoked) return; invoked = 1; - if (!power_probe_ebus(&res, &irq, &prom_node)) - goto found; - - if (!power_probe_isa(&res, &irq, &prom_node)) - goto found; - + for_each_ebus(ebus) { + for_each_ebusdev(edev, ebus) { + if (!strcmp(edev->prom_name, "power")) + goto found; + } + } return; found: - power_reg = ioremap(res->start, 0x4); + power_reg = ioremap(edev->resource[0].start, 0x4); printk("power: Control reg at %p ... ", power_reg); poweroff_method = machine_halt; /* able to use the standard halt */ - if (has_button_interrupt(irq, prom_node)) { + if (has_button_interrupt(edev)) { if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { printk("Failed to start power daemon.\n"); return; } printk("powerd running.\n"); - if (request_irq(irq, + if (request_irq(edev->irqs[0], power_handler, SA_SHIRQ, "power", NULL) < 0) printk("power: Error, cannot register IRQ handler.\n"); } else { diff --git a/trunk/arch/sparc64/kernel/ptrace.c b/trunk/arch/sparc64/kernel/ptrace.c index 774ecbb8a031..5efbff90d668 100644 --- a/trunk/arch/sparc64/kernel/ptrace.c +++ b/trunk/arch/sparc64/kernel/ptrace.c @@ -31,7 +31,6 @@ #include #include #include -#include /* Returning from ptrace is a bit tricky because the syscall return * low level code assumes any value returned which is negative and @@ -133,16 +132,12 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page, if ((uaddr ^ (unsigned long) kaddr) & (1UL << 13)) { unsigned long start = __pa(kaddr); unsigned long end = start + len; - unsigned long dcache_line_size; - - dcache_line_size = local_cpu_data().dcache_line_size; if (tlb_type == spitfire) { - for (; start < end; start += dcache_line_size) + for (; start < end; start += 32) spitfire_put_dcache_tag(start & 0x3fe0, 0x0); } else { - start &= ~(dcache_line_size - 1); - for (; start < end; start += dcache_line_size) + for (; start < end; start += 32) __asm__ __volatile__( "stxa %%g0, [%0] %1\n\t" "membar #Sync" @@ -155,11 +150,8 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page, if (write && tlb_type == spitfire) { unsigned long start = (unsigned long) kaddr; unsigned long end = start + len; - unsigned long icache_line_size; - - icache_line_size = local_cpu_data().icache_line_size; - for (; start < end; start += icache_line_size) + for (; start < end; start += 32) flushi(start); } } diff --git a/trunk/arch/sparc64/kernel/rtrap.S b/trunk/arch/sparc64/kernel/rtrap.S index 090dcca00d2a..fafd227735fa 100644 --- a/trunk/arch/sparc64/kernel/rtrap.S +++ b/trunk/arch/sparc64/kernel/rtrap.S @@ -256,8 +256,9 @@ rt_continue: ldx [%sp + PTREGS_OFF + PT_V9_G1], %g1 brnz,pn %l3, kern_rtt mov PRIMARY_CONTEXT, %l7 ldxa [%l7 + %l7] ASI_DMMU, %l0 - sethi %hi(sparc64_kern_pri_nuc_bits), %l1 - ldx [%l1 + %lo(sparc64_kern_pri_nuc_bits)], %l1 +cplus_rtrap_insn_1: + sethi %hi(0), %l1 + sllx %l1, 32, %l1 or %l0, %l1, %l0 stxa %l0, [%l7] ASI_DMMU flush %g6 @@ -312,36 +313,53 @@ kern_fpucheck: ldub [%g6 + TI_FPDEPTH], %l5 wr %g1, FPRS_FEF, %fprs ldx [%o1 + %o5], %g1 add %g6, TI_XFSR, %o1 + membar #StoreLoad | #LoadLoad sll %o0, 8, %o2 add %g6, TI_FPREGS, %o3 brz,pn %l6, 1f add %g6, TI_FPREGS+0x40, %o4 - membar #Sync ldda [%o3 + %o2] ASI_BLK_P, %f0 ldda [%o4 + %o2] ASI_BLK_P, %f16 - membar #Sync 1: andcc %l2, FPRS_DU, %g0 be,pn %icc, 1f wr %g1, 0, %gsr add %o2, 0x80, %o2 - membar #Sync ldda [%o3 + %o2] ASI_BLK_P, %f32 ldda [%o4 + %o2] ASI_BLK_P, %f48 + 1: membar #Sync ldx [%o1 + %o5], %fsr 2: stb %l5, [%g6 + TI_FPDEPTH] ba,pt %xcc, rt_continue nop 5: wr %g0, FPRS_FEF, %fprs + membar #StoreLoad | #LoadLoad sll %o0, 8, %o2 add %g6, TI_FPREGS+0x80, %o3 add %g6, TI_FPREGS+0xc0, %o4 - membar #Sync ldda [%o3 + %o2] ASI_BLK_P, %f32 ldda [%o4 + %o2] ASI_BLK_P, %f48 membar #Sync wr %g0, FPRS_DU, %fprs ba,pt %xcc, rt_continue stb %l5, [%g6 + TI_FPDEPTH] + +cplus_rinsn_1: + sethi %uhi(CTX_CHEETAH_PLUS_NUC), %l1 + + .globl cheetah_plus_patch_rtrap +cheetah_plus_patch_rtrap: + /* We configure the dTLB512_0 for 4MB pages and the + * dTLB512_1 for 8K pages when in context zero. + */ + sethi %hi(cplus_rinsn_1), %o0 + sethi %hi(cplus_rtrap_insn_1), %o2 + lduw [%o0 + %lo(cplus_rinsn_1)], %o1 + or %o2, %lo(cplus_rtrap_insn_1), %o2 + stw %o1, [%o2] + flush %o2 + + retl + nop diff --git a/trunk/arch/sparc64/kernel/setup.c b/trunk/arch/sparc64/kernel/setup.c index c1f34237cdf2..ddbed3341a23 100644 --- a/trunk/arch/sparc64/kernel/setup.c +++ b/trunk/arch/sparc64/kernel/setup.c @@ -187,13 +187,17 @@ int prom_callback(long *args) } if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) { - extern unsigned long sparc64_kern_pri_context; + unsigned long kernel_pctx = 0; + + if (tlb_type == cheetah_plus) + kernel_pctx |= (CTX_CHEETAH_PLUS_NUC | + CTX_CHEETAH_PLUS_CTX0); /* Spitfire Errata #32 workaround */ __asm__ __volatile__("stxa %0, [%1] %2\n\t" "flush %%g6" : /* No outputs */ - : "r" (sparc64_kern_pri_context), + : "r" (kernel_pctx), "r" (PRIMARY_CONTEXT), "i" (ASI_DMMU)); @@ -460,6 +464,8 @@ static void __init boot_flags_init(char *commands) } } +extern int prom_probe_memory(void); +extern unsigned long start, end; extern void panic_setup(char *, int *); extern unsigned short root_flags; @@ -486,8 +492,13 @@ void register_prom_callbacks(void) "' linux-.soft2 to .soft2"); } +extern void paging_init(void); + void __init setup_arch(char **cmdline_p) { + unsigned long highest_paddr; + int i; + /* Initialize PROM console and command line. */ *cmdline_p = prom_getbootargs(); strcpy(saved_command_line, *cmdline_p); @@ -506,6 +517,40 @@ void __init setup_arch(char **cmdline_p) boot_flags_init(*cmdline_p); idprom_init(); + (void) prom_probe_memory(); + + /* In paging_init() we tip off this value to see if we need + * to change init_mm.pgd to point to the real alias mapping. + */ + phys_base = 0xffffffffffffffffUL; + highest_paddr = 0UL; + for (i = 0; sp_banks[i].num_bytes != 0; i++) { + unsigned long top; + + if (sp_banks[i].base_addr < phys_base) + phys_base = sp_banks[i].base_addr; + top = sp_banks[i].base_addr + + sp_banks[i].num_bytes; + if (highest_paddr < top) + highest_paddr = top; + } + pfn_base = phys_base >> PAGE_SHIFT; + + switch (tlb_type) { + default: + case spitfire: + kern_base = spitfire_get_itlb_data(sparc64_highest_locked_tlbent()); + kern_base &= _PAGE_PADDR_SF; + break; + + case cheetah: + case cheetah_plus: + kern_base = cheetah_get_litlb_data(sparc64_highest_locked_tlbent()); + kern_base &= _PAGE_PADDR; + break; + }; + + kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; if (!root_flags) root_mountflags &= ~MS_RDONLY; @@ -580,9 +625,6 @@ extern void smp_info(struct seq_file *); extern void smp_bogo(struct seq_file *); extern void mmu_info(struct seq_file *); -unsigned int dcache_parity_tl1_occurred; -unsigned int icache_parity_tl1_occurred; - static int show_cpuinfo(struct seq_file *m, void *__unused) { seq_printf(m, @@ -593,8 +635,6 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) "type\t\t: sun4u\n" "ncpus probed\t: %ld\n" "ncpus active\t: %ld\n" - "D$ parity tl1\t: %u\n" - "I$ parity tl1\t: %u\n" #ifndef CONFIG_SMP "Cpu0Bogo\t: %lu.%02lu\n" "Cpu0ClkTck\t: %016lx\n" @@ -607,9 +647,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) (prom_prev >> 8) & 0xff, prom_prev & 0xff, (long)num_possible_cpus(), - (long)num_online_cpus(), - dcache_parity_tl1_occurred, - icache_parity_tl1_occurred + (long)num_online_cpus() #ifndef CONFIG_SMP , cpu_data(0).udelay_val/(500000/HZ), (cpu_data(0).udelay_val/(5000/HZ)) % 100, diff --git a/trunk/arch/sparc64/kernel/smp.c b/trunk/arch/sparc64/kernel/smp.c index b137fd63f5e1..b4fc6a5462b2 100644 --- a/trunk/arch/sparc64/kernel/smp.c +++ b/trunk/arch/sparc64/kernel/smp.c @@ -93,27 +93,6 @@ void __init smp_store_cpu_info(int id) cpu_data(id).pte_cache[1] = NULL; cpu_data(id).pgd_cache = NULL; cpu_data(id).idle_volume = 1; - - cpu_data(id).dcache_size = prom_getintdefault(cpu_node, "dcache-size", - 16 * 1024); - cpu_data(id).dcache_line_size = - prom_getintdefault(cpu_node, "dcache-line-size", 32); - cpu_data(id).icache_size = prom_getintdefault(cpu_node, "icache-size", - 16 * 1024); - cpu_data(id).icache_line_size = - prom_getintdefault(cpu_node, "icache-line-size", 32); - cpu_data(id).ecache_size = prom_getintdefault(cpu_node, "ecache-size", - 4 * 1024 * 1024); - cpu_data(id).ecache_line_size = - prom_getintdefault(cpu_node, "ecache-line-size", 64); - printk("CPU[%d]: Caches " - "D[sz(%d):line_sz(%d)] " - "I[sz(%d):line_sz(%d)] " - "E[sz(%d):line_sz(%d)]\n", - id, - cpu_data(id).dcache_size, cpu_data(id).dcache_line_size, - cpu_data(id).icache_size, cpu_data(id).icache_line_size, - cpu_data(id).ecache_size, cpu_data(id).ecache_line_size); } static void smp_setup_percpu_timer(void); @@ -1001,6 +980,13 @@ void smp_penguin_jailcell(int irq, struct pt_regs *regs) preempt_enable(); } +extern unsigned long xcall_promstop; + +void smp_promstop_others(void) +{ + smp_cross_call(&xcall_promstop, 0, 0, 0); +} + #define prof_multiplier(__cpu) cpu_data(__cpu).multiplier #define prof_counter(__cpu) cpu_data(__cpu).counter diff --git a/trunk/arch/sparc64/kernel/sys32.S b/trunk/arch/sparc64/kernel/sys32.S index 9cd272ac3ac1..5f9e4fae612e 100644 --- a/trunk/arch/sparc64/kernel/sys32.S +++ b/trunk/arch/sparc64/kernel/sys32.S @@ -157,199 +157,173 @@ sys32_socketcall: /* %o0=call, %o1=args */ or %g2, %lo(__socketcall_table_begin), %g2 jmpl %g2 + %o0, %g0 nop -do_einval: - retl - mov -EINVAL, %o0 + /* Each entry is exactly 32 bytes. */ .align 32 __socketcall_table_begin: - - /* Each entry is exactly 32 bytes. */ do_sys_socket: /* sys_socket(int, int, int) */ -1: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_socket), %g1 -2: ldswa [%o1 + 0x8] %asi, %o2 + ldswa [%o1 + 0x8] %asi, %o2 jmpl %g1 + %lo(sys_socket), %g0 -3: ldswa [%o1 + 0x4] %asi, %o1 + ldswa [%o1 + 0x4] %asi, %o1 nop nop nop do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */ -4: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_bind), %g1 -5: ldswa [%o1 + 0x8] %asi, %o2 + ldswa [%o1 + 0x8] %asi, %o2 jmpl %g1 + %lo(sys_bind), %g0 -6: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop nop do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */ -7: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_connect), %g1 -8: ldswa [%o1 + 0x8] %asi, %o2 + ldswa [%o1 + 0x8] %asi, %o2 jmpl %g1 + %lo(sys_connect), %g0 -9: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop nop do_sys_listen: /* sys_listen(int, int) */ -10: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_listen), %g1 jmpl %g1 + %lo(sys_listen), %g0 -11: ldswa [%o1 + 0x4] %asi, %o1 + ldswa [%o1 + 0x4] %asi, %o1 nop nop nop nop do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */ -12: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_accept), %g1 -13: lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0x8] %asi, %o2 jmpl %g1 + %lo(sys_accept), %g0 -14: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop nop do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */ -15: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_getsockname), %g1 -16: lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0x8] %asi, %o2 jmpl %g1 + %lo(sys_getsockname), %g0 -17: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop nop do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */ -18: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_getpeername), %g1 -19: lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0x8] %asi, %o2 jmpl %g1 + %lo(sys_getpeername), %g0 -20: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop nop do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */ -21: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_socketpair), %g1 -22: ldswa [%o1 + 0x8] %asi, %o2 -23: lduwa [%o1 + 0xc] %asi, %o3 + ldswa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0xc] %asi, %o3 jmpl %g1 + %lo(sys_socketpair), %g0 -24: ldswa [%o1 + 0x4] %asi, %o1 + ldswa [%o1 + 0x4] %asi, %o1 nop nop do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */ -25: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_send), %g1 -26: lduwa [%o1 + 0x8] %asi, %o2 -27: lduwa [%o1 + 0xc] %asi, %o3 + lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0xc] %asi, %o3 jmpl %g1 + %lo(sys_send), %g0 -28: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ -29: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_recv), %g1 -30: lduwa [%o1 + 0x8] %asi, %o2 -31: lduwa [%o1 + 0xc] %asi, %o3 + lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0xc] %asi, %o3 jmpl %g1 + %lo(sys_recv), %g0 -32: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ -33: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_sendto), %g1 -34: lduwa [%o1 + 0x8] %asi, %o2 -35: lduwa [%o1 + 0xc] %asi, %o3 -36: lduwa [%o1 + 0x10] %asi, %o4 -37: ldswa [%o1 + 0x14] %asi, %o5 + lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0xc] %asi, %o3 + lduwa [%o1 + 0x10] %asi, %o4 + ldswa [%o1 + 0x14] %asi, %o5 jmpl %g1 + %lo(sys_sendto), %g0 -38: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ -39: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_recvfrom), %g1 -40: lduwa [%o1 + 0x8] %asi, %o2 -41: lduwa [%o1 + 0xc] %asi, %o3 -42: lduwa [%o1 + 0x10] %asi, %o4 -43: lduwa [%o1 + 0x14] %asi, %o5 + lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0xc] %asi, %o3 + lduwa [%o1 + 0x10] %asi, %o4 + lduwa [%o1 + 0x14] %asi, %o5 jmpl %g1 + %lo(sys_recvfrom), %g0 -44: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 do_sys_shutdown: /* sys_shutdown(int, int) */ -45: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(sys_shutdown), %g1 jmpl %g1 + %lo(sys_shutdown), %g0 -46: ldswa [%o1 + 0x4] %asi, %o1 + ldswa [%o1 + 0x4] %asi, %o1 nop nop nop nop do_sys_setsockopt: /* compat_sys_setsockopt(int, int, int, char *, int) */ -47: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(compat_sys_setsockopt), %g1 -48: ldswa [%o1 + 0x8] %asi, %o2 -49: lduwa [%o1 + 0xc] %asi, %o3 -50: ldswa [%o1 + 0x10] %asi, %o4 + ldswa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0xc] %asi, %o3 + ldswa [%o1 + 0x10] %asi, %o4 jmpl %g1 + %lo(compat_sys_setsockopt), %g0 -51: ldswa [%o1 + 0x4] %asi, %o1 + ldswa [%o1 + 0x4] %asi, %o1 nop do_sys_getsockopt: /* compat_sys_getsockopt(int, int, int, u32, u32) */ -52: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(compat_sys_getsockopt), %g1 -53: ldswa [%o1 + 0x8] %asi, %o2 -54: lduwa [%o1 + 0xc] %asi, %o3 -55: lduwa [%o1 + 0x10] %asi, %o4 + ldswa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0xc] %asi, %o3 + lduwa [%o1 + 0x10] %asi, %o4 jmpl %g1 + %lo(compat_sys_getsockopt), %g0 -56: ldswa [%o1 + 0x4] %asi, %o1 + ldswa [%o1 + 0x4] %asi, %o1 nop do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */ -57: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(compat_sys_sendmsg), %g1 -58: lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0x8] %asi, %o2 jmpl %g1 + %lo(compat_sys_sendmsg), %g0 -59: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop nop do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */ -60: ldswa [%o1 + 0x0] %asi, %o0 + ldswa [%o1 + 0x0] %asi, %o0 sethi %hi(compat_sys_recvmsg), %g1 -61: lduwa [%o1 + 0x8] %asi, %o2 + lduwa [%o1 + 0x8] %asi, %o2 jmpl %g1 + %lo(compat_sys_recvmsg), %g0 -62: lduwa [%o1 + 0x4] %asi, %o1 + lduwa [%o1 + 0x4] %asi, %o1 nop nop nop +__socketcall_table_end: + +do_einval: + retl + mov -EINVAL, %o0 +do_efault: + retl + mov -EFAULT, %o0 .section __ex_table .align 4 - .word 1b, __retl_efault, 2b, __retl_efault - .word 3b, __retl_efault, 4b, __retl_efault - .word 5b, __retl_efault, 6b, __retl_efault - .word 7b, __retl_efault, 8b, __retl_efault - .word 9b, __retl_efault, 10b, __retl_efault - .word 11b, __retl_efault, 12b, __retl_efault - .word 13b, __retl_efault, 14b, __retl_efault - .word 15b, __retl_efault, 16b, __retl_efault - .word 17b, __retl_efault, 18b, __retl_efault - .word 19b, __retl_efault, 20b, __retl_efault - .word 21b, __retl_efault, 22b, __retl_efault - .word 23b, __retl_efault, 24b, __retl_efault - .word 25b, __retl_efault, 26b, __retl_efault - .word 27b, __retl_efault, 28b, __retl_efault - .word 29b, __retl_efault, 30b, __retl_efault - .word 31b, __retl_efault, 32b, __retl_efault - .word 33b, __retl_efault, 34b, __retl_efault - .word 35b, __retl_efault, 36b, __retl_efault - .word 37b, __retl_efault, 38b, __retl_efault - .word 39b, __retl_efault, 40b, __retl_efault - .word 41b, __retl_efault, 42b, __retl_efault - .word 43b, __retl_efault, 44b, __retl_efault - .word 45b, __retl_efault, 46b, __retl_efault - .word 47b, __retl_efault, 48b, __retl_efault - .word 49b, __retl_efault, 50b, __retl_efault - .word 51b, __retl_efault, 52b, __retl_efault - .word 53b, __retl_efault, 54b, __retl_efault - .word 55b, __retl_efault, 56b, __retl_efault - .word 57b, __retl_efault, 58b, __retl_efault - .word 59b, __retl_efault, 60b, __retl_efault - .word 61b, __retl_efault, 62b, __retl_efault + .word __socketcall_table_begin, 0, __socketcall_table_end, do_efault .previous diff --git a/trunk/arch/sparc64/kernel/trampoline.S b/trunk/arch/sparc64/kernel/trampoline.S index 9478551cb020..3a145fc39cf2 100644 --- a/trunk/arch/sparc64/kernel/trampoline.S +++ b/trunk/arch/sparc64/kernel/trampoline.S @@ -119,8 +119,8 @@ startup_continue: sethi %hi(itlb_load), %g2 or %g2, %lo(itlb_load), %g2 stx %g2, [%sp + 2047 + 128 + 0x18] - sethi %hi(prom_mmu_ihandle_cache), %g2 - lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2 + sethi %hi(mmu_ihandle_cache), %g2 + lduw [%g2 + %lo(mmu_ihandle_cache)], %g2 stx %g2, [%sp + 2047 + 128 + 0x20] sethi %hi(KERNBASE), %g2 stx %g2, [%sp + 2047 + 128 + 0x28] @@ -156,8 +156,8 @@ startup_continue: sethi %hi(itlb_load), %g2 or %g2, %lo(itlb_load), %g2 stx %g2, [%sp + 2047 + 128 + 0x18] - sethi %hi(prom_mmu_ihandle_cache), %g2 - lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2 + sethi %hi(mmu_ihandle_cache), %g2 + lduw [%g2 + %lo(mmu_ihandle_cache)], %g2 stx %g2, [%sp + 2047 + 128 + 0x20] sethi %hi(KERNBASE + 0x400000), %g2 stx %g2, [%sp + 2047 + 128 + 0x28] @@ -190,8 +190,8 @@ do_dtlb: sethi %hi(dtlb_load), %g2 or %g2, %lo(dtlb_load), %g2 stx %g2, [%sp + 2047 + 128 + 0x18] - sethi %hi(prom_mmu_ihandle_cache), %g2 - lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2 + sethi %hi(mmu_ihandle_cache), %g2 + lduw [%g2 + %lo(mmu_ihandle_cache)], %g2 stx %g2, [%sp + 2047 + 128 + 0x20] sethi %hi(KERNBASE), %g2 stx %g2, [%sp + 2047 + 128 + 0x28] @@ -228,8 +228,8 @@ do_dtlb: sethi %hi(dtlb_load), %g2 or %g2, %lo(dtlb_load), %g2 stx %g2, [%sp + 2047 + 128 + 0x18] - sethi %hi(prom_mmu_ihandle_cache), %g2 - lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2 + sethi %hi(mmu_ihandle_cache), %g2 + lduw [%g2 + %lo(mmu_ihandle_cache)], %g2 stx %g2, [%sp + 2047 + 128 + 0x20] sethi %hi(KERNBASE + 0x400000), %g2 stx %g2, [%sp + 2047 + 128 + 0x28] @@ -336,13 +336,20 @@ do_unlock: call init_irqwork_curcpu nop - /* Start using proper page size encodings in ctx register. */ - sethi %hi(sparc64_kern_pri_context), %g3 - ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2 + BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g2,g3,1f) + ba,pt %xcc, 2f + nop + +1: /* Start using proper page size encodings in ctx register. */ + sethi %uhi(CTX_CHEETAH_PLUS_NUC), %g3 mov PRIMARY_CONTEXT, %g1 - stxa %g2, [%g1] ASI_DMMU + sllx %g3, 32, %g3 + sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2 + or %g3, %g2, %g3 + stxa %g3, [%g1] ASI_DMMU membar #Sync +2: rdpr %pstate, %o1 or %o1, PSTATE_IE, %o1 wrpr %o1, 0, %pstate diff --git a/trunk/arch/sparc64/kernel/traps.c b/trunk/arch/sparc64/kernel/traps.c index 5570e7bb22bb..b280b2ef674f 100644 --- a/trunk/arch/sparc64/kernel/traps.c +++ b/trunk/arch/sparc64/kernel/traps.c @@ -189,18 +189,19 @@ void spitfire_data_access_exception(struct pt_regs *regs, unsigned long sfsr, un if (regs->tstate & TSTATE_PRIV) { /* Test if this comes from uaccess places. */ - const struct exception_table_entry *entry; + unsigned long fixup; + unsigned long g2 = regs->u_regs[UREG_G2]; - entry = search_exception_tables(regs->tpc); - if (entry) { - /* Ouch, somebody is trying VM hole tricks on us... */ + if ((fixup = search_extables_range(regs->tpc, &g2))) { + /* Ouch, somebody is trying ugly VM hole tricks on us... */ #ifdef DEBUG_EXCEPTIONS printk("Exception: PC<%016lx> faddr\n", regs->tpc); - printk("EX_TABLE: insn<%016lx> fixup<%016lx>\n", - regs->tpc, entry->fixup); + printk("EX_TABLE: insn<%016lx> fixup<%016lx> " + "g2<%016lx>\n", regs->tpc, fixup, g2); #endif - regs->tpc = entry->fixup; + regs->tpc = fixup; regs->tnpc = regs->tpc + 4; + regs->u_regs[UREG_G2] = g2; return; } /* Shit... */ @@ -757,12 +758,26 @@ void __init cheetah_ecache_flush_init(void) ecache_flush_size = (2 * largest_size); ecache_flush_linesize = smallest_linesize; - ecache_flush_physbase = find_ecache_flush_span(ecache_flush_size); + /* Discover a physically contiguous chunk of physical + * memory in 'sp_banks' of size ecache_flush_size calculated + * above. Store the physical base of this area at + * ecache_flush_physbase. + */ + for (node = 0; ; node++) { + if (sp_banks[node].num_bytes == 0) + break; + if (sp_banks[node].num_bytes >= ecache_flush_size) { + ecache_flush_physbase = sp_banks[node].base_addr; + break; + } + } - if (ecache_flush_physbase == ~0UL) { + /* Note: Zero would be a valid value of ecache_flush_physbase so + * don't use that as the success test. :-) + */ + if (sp_banks[node].num_bytes == 0) { prom_printf("cheetah_ecache_flush_init: Cannot find %d byte " - "contiguous physical memory.\n", - ecache_flush_size); + "contiguous physical memory.\n", ecache_flush_size); prom_halt(); } @@ -854,19 +869,14 @@ static void cheetah_flush_ecache_line(unsigned long physaddr) */ static void __cheetah_flush_icache(void) { - unsigned int icache_size, icache_line_size; - unsigned long addr; - - icache_size = local_cpu_data().icache_size; - icache_line_size = local_cpu_data().icache_line_size; + unsigned long i; /* Clear the valid bits in all the tags. */ - for (addr = 0; addr < icache_size; addr += icache_line_size) { + for (i = 0; i < (1 << 15); i += (1 << 5)) { __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" "membar #Sync" : /* no outputs */ - : "r" (addr | (2 << 3)), - "i" (ASI_IC_TAG)); + : "r" (i | (2 << 3)), "i" (ASI_IC_TAG)); } } @@ -894,17 +904,13 @@ static void cheetah_flush_icache(void) static void cheetah_flush_dcache(void) { - unsigned int dcache_size, dcache_line_size; - unsigned long addr; + unsigned long i; - dcache_size = local_cpu_data().dcache_size; - dcache_line_size = local_cpu_data().dcache_line_size; - - for (addr = 0; addr < dcache_size; addr += dcache_line_size) { + for (i = 0; i < (1 << 16); i += (1 << 5)) { __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" "membar #Sync" : /* no outputs */ - : "r" (addr), "i" (ASI_DCACHE_TAG)); + : "r" (i), "i" (ASI_DCACHE_TAG)); } } @@ -915,29 +921,24 @@ static void cheetah_flush_dcache(void) */ static void cheetah_plus_zap_dcache_parity(void) { - unsigned int dcache_size, dcache_line_size; - unsigned long addr; - - dcache_size = local_cpu_data().dcache_size; - dcache_line_size = local_cpu_data().dcache_line_size; + unsigned long i; - for (addr = 0; addr < dcache_size; addr += dcache_line_size) { - unsigned long tag = (addr >> 14); - unsigned long line; + for (i = 0; i < (1 << 16); i += (1 << 5)) { + unsigned long tag = (i >> 14); + unsigned long j; __asm__ __volatile__("membar #Sync\n\t" "stxa %0, [%1] %2\n\t" "membar #Sync" : /* no outputs */ - : "r" (tag), "r" (addr), + : "r" (tag), "r" (i), "i" (ASI_DCACHE_UTAG)); - for (line = addr; line < addr + dcache_line_size; line += 8) + for (j = i; j < i + (1 << 5); j += (1 << 3)) __asm__ __volatile__("membar #Sync\n\t" "stxa %%g0, [%0] %1\n\t" "membar #Sync" : /* no outputs */ - : "r" (line), - "i" (ASI_DCACHE_DATA)); + : "r" (j), "i" (ASI_DCACHE_DATA)); } } @@ -1331,12 +1332,16 @@ static int cheetah_fix_ce(unsigned long physaddr) /* Return non-zero if PADDR is a valid physical memory address. */ static int cheetah_check_main_memory(unsigned long paddr) { - unsigned long vaddr = PAGE_OFFSET + paddr; - - if (vaddr > (unsigned long) high_memory) - return 0; + int i; - return kern_addr_valid(vaddr); + for (i = 0; ; i++) { + if (sp_banks[i].num_bytes == 0) + break; + if (paddr >= sp_banks[i].base_addr && + paddr < (sp_banks[i].base_addr + sp_banks[i].num_bytes)) + return 1; + } + return 0; } void cheetah_cee_handler(struct pt_regs *regs, unsigned long afsr, unsigned long afar) @@ -1591,10 +1596,10 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned /* OK, usermode access. */ recoverable = 1; } else { - const struct exception_table_entry *entry; + unsigned long g2 = regs->u_regs[UREG_G2]; + unsigned long fixup = search_extables_range(regs->tpc, &g2); - entry = search_exception_tables(regs->tpc); - if (entry) { + if (fixup != 0UL) { /* OK, kernel access to userspace. */ recoverable = 1; @@ -1613,8 +1618,9 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned * recoverable condition. */ if (recoverable) { - regs->tpc = entry->fixup; + regs->tpc = fixup; regs->tnpc = regs->tpc + 4; + regs->u_regs[UREG_G2] = g2; } } } diff --git a/trunk/arch/sparc64/kernel/una_asm.S b/trunk/arch/sparc64/kernel/una_asm.S index 1f5b5b708ce7..da48400bcc95 100644 --- a/trunk/arch/sparc64/kernel/una_asm.S +++ b/trunk/arch/sparc64/kernel/una_asm.S @@ -6,6 +6,13 @@ .text +kernel_unaligned_trap_fault: + call kernel_mna_trap_fault + nop + retl + nop + .size kern_unaligned_trap_fault, .-kern_unaligned_trap_fault + .globl __do_int_store __do_int_store: rd %asi, %o4 @@ -44,24 +51,24 @@ __do_int_store: 0: wr %o4, 0x0, %asi retl - mov 0, %o0 + nop .size __do_int_store, .-__do_int_store .section __ex_table - .word 4b, __retl_efault - .word 5b, __retl_efault - .word 6b, __retl_efault - .word 7b, __retl_efault - .word 8b, __retl_efault - .word 9b, __retl_efault - .word 10b, __retl_efault - .word 11b, __retl_efault - .word 12b, __retl_efault - .word 13b, __retl_efault - .word 14b, __retl_efault - .word 15b, __retl_efault - .word 16b, __retl_efault - .word 17b, __retl_efault + .word 4b, kernel_unaligned_trap_fault + .word 5b, kernel_unaligned_trap_fault + .word 6b, kernel_unaligned_trap_fault + .word 7b, kernel_unaligned_trap_fault + .word 8b, kernel_unaligned_trap_fault + .word 9b, kernel_unaligned_trap_fault + .word 10b, kernel_unaligned_trap_fault + .word 11b, kernel_unaligned_trap_fault + .word 12b, kernel_unaligned_trap_fault + .word 13b, kernel_unaligned_trap_fault + .word 14b, kernel_unaligned_trap_fault + .word 15b, kernel_unaligned_trap_fault + .word 16b, kernel_unaligned_trap_fault + .word 17b, kernel_unaligned_trap_fault .previous .globl do_int_load @@ -126,21 +133,21 @@ do_int_load: 0: wr %o5, 0x0, %asi retl - mov 0, %o0 + nop .size __do_int_load, .-__do_int_load .section __ex_table - .word 4b, __retl_efault - .word 5b, __retl_efault - .word 6b, __retl_efault - .word 7b, __retl_efault - .word 8b, __retl_efault - .word 9b, __retl_efault - .word 10b, __retl_efault - .word 11b, __retl_efault - .word 12b, __retl_efault - .word 13b, __retl_efault - .word 14b, __retl_efault - .word 15b, __retl_efault - .word 16b, __retl_efault + .word 4b, kernel_unaligned_trap_fault + .word 5b, kernel_unaligned_trap_fault + .word 6b, kernel_unaligned_trap_fault + .word 7b, kernel_unaligned_trap_fault + .word 8b, kernel_unaligned_trap_fault + .word 9b, kernel_unaligned_trap_fault + .word 10b, kernel_unaligned_trap_fault + .word 11b, kernel_unaligned_trap_fault + .word 12b, kernel_unaligned_trap_fault + .word 13b, kernel_unaligned_trap_fault + .word 14b, kernel_unaligned_trap_fault + .word 15b, kernel_unaligned_trap_fault + .word 16b, kernel_unaligned_trap_fault .previous diff --git a/trunk/arch/sparc64/kernel/unaligned.c b/trunk/arch/sparc64/kernel/unaligned.c index 70faf630603b..42718f6a7d36 100644 --- a/trunk/arch/sparc64/kernel/unaligned.c +++ b/trunk/arch/sparc64/kernel/unaligned.c @@ -180,14 +180,14 @@ static void __attribute_used__ unaligned_panic(char *str, struct pt_regs *regs) die_if_kernel(str, regs); } -extern int do_int_load(unsigned long *dest_reg, int size, - unsigned long *saddr, int is_signed, int asi); +extern void do_int_load(unsigned long *dest_reg, int size, + unsigned long *saddr, int is_signed, int asi); -extern int __do_int_store(unsigned long *dst_addr, int size, - unsigned long src_val, int asi); +extern void __do_int_store(unsigned long *dst_addr, int size, + unsigned long src_val, int asi); -static inline int do_int_store(int reg_num, int size, unsigned long *dst_addr, - struct pt_regs *regs, int asi, int orig_asi) +static inline void do_int_store(int reg_num, int size, unsigned long *dst_addr, + struct pt_regs *regs, int asi, int orig_asi) { unsigned long zero = 0; unsigned long *src_val_p = &zero; @@ -219,7 +219,7 @@ static inline int do_int_store(int reg_num, int size, unsigned long *dst_addr, break; }; } - return __do_int_store(dst_addr, size, src_val, asi); + __do_int_store(dst_addr, size, src_val, asi); } static inline void advance(struct pt_regs *regs) @@ -242,14 +242,14 @@ static inline int ok_for_kernel(unsigned int insn) return !floating_point_load_or_store_p(insn); } -static void kernel_mna_trap_fault(void) +void kernel_mna_trap_fault(void) { struct pt_regs *regs = current_thread_info()->kern_una_regs; unsigned int insn = current_thread_info()->kern_una_insn; - const struct exception_table_entry *entry; + unsigned long g2 = regs->u_regs[UREG_G2]; + unsigned long fixup = search_extables_range(regs->tpc, &g2); - entry = search_exception_tables(regs->tpc); - if (!entry) { + if (!fixup) { unsigned long address; address = compute_effective_address(regs, insn, @@ -270,8 +270,9 @@ static void kernel_mna_trap_fault(void) die_if_kernel("Oops", regs); /* Not reached */ } - regs->tpc = entry->fixup; + regs->tpc = fixup; regs->tnpc = regs->tpc + 4; + regs->u_regs [UREG_G2] = g2; regs->tstate &= ~TSTATE_ASI; regs->tstate |= (ASI_AIUS << 24UL); @@ -293,8 +294,8 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u kernel_mna_trap_fault(); } else { - unsigned long addr, *reg_addr; - int orig_asi, asi, err; + unsigned long addr; + int orig_asi, asi; addr = compute_effective_address(regs, insn, ((insn >> 25) & 0x1f)); @@ -318,12 +319,11 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u }; switch (dir) { case load: - reg_addr = fetch_reg_addr(((insn>>25)&0x1f), regs); - err = do_int_load(reg_addr, size, - (unsigned long *) addr, - decode_signedness(insn), asi); - if (likely(!err) && unlikely(asi != orig_asi)) { - unsigned long val_in = *reg_addr; + do_int_load(fetch_reg_addr(((insn>>25)&0x1f), regs), + size, (unsigned long *) addr, + decode_signedness(insn), asi); + if (unlikely(asi != orig_asi)) { + unsigned long val_in = *(unsigned long *) addr; switch (size) { case 2: val_in = swab16(val_in); @@ -339,24 +339,21 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u BUG(); break; }; - *reg_addr = val_in; + *(unsigned long *) addr = val_in; } break; case store: - err = do_int_store(((insn>>25)&0x1f), size, - (unsigned long *) addr, regs, - asi, orig_asi); + do_int_store(((insn>>25)&0x1f), size, + (unsigned long *) addr, regs, + asi, orig_asi); break; default: panic("Impossible kernel unaligned trap."); /* Not reached... */ } - if (unlikely(err)) - kernel_mna_trap_fault(); - else - advance(regs); + advance(regs); } } diff --git a/trunk/arch/sparc64/kernel/us3_cpufreq.c b/trunk/arch/sparc64/kernel/us3_cpufreq.c index 0340041f6143..9080e7cd4bb0 100644 --- a/trunk/arch/sparc64/kernel/us3_cpufreq.c +++ b/trunk/arch/sparc64/kernel/us3_cpufreq.c @@ -208,10 +208,7 @@ static int __init us3_freq_init(void) impl = ((ver >> 32) & 0xffff); if (manuf == CHEETAH_MANUF && - (impl == CHEETAH_IMPL || - impl == CHEETAH_PLUS_IMPL || - impl == JAGUAR_IMPL || - impl == PANTHER_IMPL)) { + (impl == CHEETAH_IMPL || impl == CHEETAH_PLUS_IMPL)) { struct cpufreq_driver *driver; ret = -ENOMEM; diff --git a/trunk/arch/sparc64/kernel/vmlinux.lds.S b/trunk/arch/sparc64/kernel/vmlinux.lds.S index 2af0cf0a8640..f47d0be39378 100644 --- a/trunk/arch/sparc64/kernel/vmlinux.lds.S +++ b/trunk/arch/sparc64/kernel/vmlinux.lds.S @@ -9,7 +9,8 @@ ENTRY(_start) jiffies = jiffies_64; SECTIONS { - swapper_low_pmd_dir = 0x0000000000402000; + swapper_pmd_dir = 0x0000000000402000; + empty_pg_dir = 0x0000000000403000; . = 0x4000; .text 0x0000000000404000 : { diff --git a/trunk/arch/sparc64/kernel/winfixup.S b/trunk/arch/sparc64/kernel/winfixup.S index 39160926267b..99c809a1e5ac 100644 --- a/trunk/arch/sparc64/kernel/winfixup.S +++ b/trunk/arch/sparc64/kernel/winfixup.S @@ -16,14 +16,23 @@ .text set_pcontext: - sethi %hi(sparc64_kern_pri_context), %l1 - ldx [%l1 + %lo(sparc64_kern_pri_context)], %l1 +cplus_winfixup_insn_1: + sethi %hi(0), %l1 mov PRIMARY_CONTEXT, %g1 + sllx %l1, 32, %l1 +cplus_winfixup_insn_2: + sethi %hi(0), %g2 + or %l1, %g2, %l1 stxa %l1, [%g1] ASI_DMMU flush %g6 retl nop +cplus_wfinsn_1: + sethi %uhi(CTX_CHEETAH_PLUS_NUC), %l1 +cplus_wfinsn_2: + sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2 + .align 32 /* Here are the rules, pay attention. @@ -386,3 +395,23 @@ window_dax_from_user_common: add %sp, PTREGS_OFF, %o0 ba,pt %xcc, rtrap clr %l6 + + + .globl cheetah_plus_patch_winfixup +cheetah_plus_patch_winfixup: + sethi %hi(cplus_wfinsn_1), %o0 + sethi %hi(cplus_winfixup_insn_1), %o2 + lduw [%o0 + %lo(cplus_wfinsn_1)], %o1 + or %o2, %lo(cplus_winfixup_insn_1), %o2 + stw %o1, [%o2] + flush %o2 + + sethi %hi(cplus_wfinsn_2), %o0 + sethi %hi(cplus_winfixup_insn_2), %o2 + lduw [%o0 + %lo(cplus_wfinsn_2)], %o1 + or %o2, %lo(cplus_winfixup_insn_2), %o2 + stw %o1, [%o2] + flush %o2 + + retl + nop diff --git a/trunk/arch/sparc64/lib/VISsave.S b/trunk/arch/sparc64/lib/VISsave.S index a0ded5c5aa5c..4e18989bd602 100644 --- a/trunk/arch/sparc64/lib/VISsave.S +++ b/trunk/arch/sparc64/lib/VISsave.S @@ -59,17 +59,15 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 be,pn %icc, 9b add %g6, TI_FPREGS, %g2 andcc %o5, FPRS_DL, %g0 + membar #StoreStore | #LoadStore be,pn %icc, 4f add %g6, TI_FPREGS+0x40, %g3 - membar #Sync stda %f0, [%g2 + %g1] ASI_BLK_P stda %f16, [%g3 + %g1] ASI_BLK_P - membar #Sync andcc %o5, FPRS_DU, %g0 be,pn %icc, 5f 4: add %g1, 128, %g1 - membar #Sync stda %f32, [%g2 + %g1] ASI_BLK_P stda %f48, [%g3 + %g1] ASI_BLK_P @@ -89,7 +87,7 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 sll %g1, 5, %g1 add %g6, TI_FPREGS+0xc0, %g3 wr %g0, FPRS_FEF, %fprs - membar #Sync + membar #StoreStore | #LoadStore stda %f32, [%g2 + %g1] ASI_BLK_P stda %f48, [%g3 + %g1] ASI_BLK_P membar #Sync @@ -130,8 +128,8 @@ VISenterhalf: be,pn %icc, 4f add %g6, TI_FPREGS, %g2 + membar #StoreStore | #LoadStore add %g6, TI_FPREGS+0x40, %g3 - membar #Sync stda %f0, [%g2 + %g1] ASI_BLK_P stda %f16, [%g3 + %g1] ASI_BLK_P membar #Sync diff --git a/trunk/arch/sparc64/lib/strncpy_from_user.S b/trunk/arch/sparc64/lib/strncpy_from_user.S index e1264650ca7a..09cbbaa0ebf4 100644 --- a/trunk/arch/sparc64/lib/strncpy_from_user.S +++ b/trunk/arch/sparc64/lib/strncpy_from_user.S @@ -125,11 +125,15 @@ __strncpy_from_user: add %o2, %o3, %o0 .size __strncpy_from_user, .-__strncpy_from_user + .section .fixup,#alloc,#execinstr + .align 4 +4: retl + mov -EFAULT, %o0 + .section __ex_table,#alloc .align 4 - .word 60b, __retl_efault - .word 61b, __retl_efault - .word 62b, __retl_efault - .word 63b, __retl_efault - .word 64b, __retl_efault - .previous + .word 60b, 4b + .word 61b, 4b + .word 62b, 4b + .word 63b, 4b + .word 64b, 4b diff --git a/trunk/arch/sparc64/lib/user_fixup.c b/trunk/arch/sparc64/lib/user_fixup.c index 19d1fdb17d0e..0278e34125db 100644 --- a/trunk/arch/sparc64/lib/user_fixup.c +++ b/trunk/arch/sparc64/lib/user_fixup.c @@ -11,56 +11,61 @@ /* Calculating the exact fault address when using * block loads and stores can be very complicated. - * * Instead of trying to be clever and handling all * of the cases, just fix things up simply here. */ -static unsigned long compute_size(unsigned long start, unsigned long size, unsigned long *offset) +unsigned long copy_from_user_fixup(void *to, const void __user *from, unsigned long size) { - unsigned long fault_addr = current_thread_info()->fault_address; - unsigned long end = start + size; + char *dst = to; + const char __user *src = from; - if (fault_addr < start || fault_addr >= end) { - *offset = 0; - } else { - *offset = start - fault_addr; - size = end - fault_addr; + while (size) { + if (__get_user(*dst, src)) + break; + dst++; + src++; + size--; } - return size; -} -unsigned long copy_from_user_fixup(void *to, const void __user *from, unsigned long size) -{ - unsigned long offset; - - size = compute_size((unsigned long) from, size, &offset); - if (likely(size)) - memset(to + offset, 0, size); + if (size) + memset(dst, 0, size); return size; } unsigned long copy_to_user_fixup(void __user *to, const void *from, unsigned long size) { - unsigned long offset; + char __user *dst = to; + const char *src = from; + + while (size) { + if (__put_user(*src, dst)) + break; + dst++; + src++; + size--; + } - return compute_size((unsigned long) to, size, &offset); + return size; } unsigned long copy_in_user_fixup(void __user *to, void __user *from, unsigned long size) { - unsigned long fault_addr = current_thread_info()->fault_address; - unsigned long start = (unsigned long) to; - unsigned long end = start + size; + char __user *dst = to; + char __user *src = from; - if (fault_addr >= start && fault_addr < end) - return end - fault_addr; + while (size) { + char tmp; - start = (unsigned long) from; - end = start + size; - if (fault_addr >= start && fault_addr < end) - return end - fault_addr; + if (__get_user(tmp, src)) + break; + if (__put_user(tmp, dst)) + break; + dst++; + src++; + size--; + } return size; } diff --git a/trunk/arch/sparc64/mm/Makefile b/trunk/arch/sparc64/mm/Makefile index 9d0960e69f48..cda87333a77b 100644 --- a/trunk/arch/sparc64/mm/Makefile +++ b/trunk/arch/sparc64/mm/Makefile @@ -5,6 +5,6 @@ EXTRA_AFLAGS := -ansi EXTRA_CFLAGS := -Werror -obj-y := ultra.o tlb.o fault.o init.o generic.o +obj-y := ultra.o tlb.o fault.o init.o generic.o extable.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o diff --git a/trunk/arch/sparc64/mm/extable.c b/trunk/arch/sparc64/mm/extable.c new file mode 100644 index 000000000000..ec334297ff4f --- /dev/null +++ b/trunk/arch/sparc64/mm/extable.c @@ -0,0 +1,80 @@ +/* + * linux/arch/sparc64/mm/extable.c + */ + +#include +#include +#include + +extern const struct exception_table_entry __start___ex_table[]; +extern const struct exception_table_entry __stop___ex_table[]; + +void sort_extable(struct exception_table_entry *start, + struct exception_table_entry *finish) +{ +} + +/* Caller knows they are in a range if ret->fixup == 0 */ +const struct exception_table_entry * +search_extable(const struct exception_table_entry *start, + const struct exception_table_entry *last, + unsigned long value) +{ + const struct exception_table_entry *walk; + + /* Single insn entries are encoded as: + * word 1: insn address + * word 2: fixup code address + * + * Range entries are encoded as: + * word 1: first insn address + * word 2: 0 + * word 3: last insn address + 4 bytes + * word 4: fixup code address + * + * See asm/uaccess.h for more details. + */ + + /* 1. Try to find an exact match. */ + for (walk = start; walk <= last; walk++) { + if (walk->fixup == 0) { + /* A range entry, skip both parts. */ + walk++; + continue; + } + + if (walk->insn == value) + return walk; + } + + /* 2. Try to find a range match. */ + for (walk = start; walk <= (last - 1); walk++) { + if (walk->fixup) + continue; + + if (walk[0].insn <= value && walk[1].insn > value) + return walk; + + walk++; + } + + return NULL; +} + +/* Special extable search, which handles ranges. Returns fixup */ +unsigned long search_extables_range(unsigned long addr, unsigned long *g2) +{ + const struct exception_table_entry *entry; + + entry = search_exception_tables(addr); + if (!entry) + return 0; + + /* Inside range? Fix g2 and return correct fixup */ + if (!entry->fixup) { + *g2 = (addr - entry->insn) / 4; + return (entry + 1)->fixup; + } + + return entry->fixup; +} diff --git a/trunk/arch/sparc64/mm/fault.c b/trunk/arch/sparc64/mm/fault.c index 31fbc67719a1..db1e3310e907 100644 --- a/trunk/arch/sparc64/mm/fault.c +++ b/trunk/arch/sparc64/mm/fault.c @@ -32,6 +32,8 @@ #define ELEMENTS(arr) (sizeof (arr)/sizeof (arr[0])) +extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; + /* * To debug kernel to catch accesses to certain virtual/physical addresses. * Mode = 0 selects physical watchpoints, mode = 1 selects virtual watchpoints. @@ -69,6 +71,53 @@ void set_brkpt(unsigned long addr, unsigned char mask, int flags, int mode) : "memory"); } +/* Nice, simple, prom library does all the sweating for us. ;) */ +unsigned long __init prom_probe_memory (void) +{ + register struct linux_mlist_p1275 *mlist; + register unsigned long bytes, base_paddr, tally; + register int i; + + i = 0; + mlist = *prom_meminfo()->p1275_available; + bytes = tally = mlist->num_bytes; + base_paddr = mlist->start_adr; + + sp_banks[0].base_addr = base_paddr; + sp_banks[0].num_bytes = bytes; + + while (mlist->theres_more != (void *) 0) { + i++; + mlist = mlist->theres_more; + bytes = mlist->num_bytes; + tally += bytes; + if (i >= SPARC_PHYS_BANKS-1) { + printk ("The machine has more banks than " + "this kernel can support\n" + "Increase the SPARC_PHYS_BANKS " + "setting (currently %d)\n", + SPARC_PHYS_BANKS); + i = SPARC_PHYS_BANKS-1; + break; + } + + sp_banks[i].base_addr = mlist->start_adr; + sp_banks[i].num_bytes = mlist->num_bytes; + } + + i++; + sp_banks[i].base_addr = 0xdeadbeefbeefdeadUL; + sp_banks[i].num_bytes = 0; + + /* Now mask all bank sizes on a page boundary, it is all we can + * use anyways. + */ + for (i = 0; sp_banks[i].num_bytes != 0; i++) + sp_banks[i].num_bytes &= PAGE_MASK; + + return tally; +} + static void __kprobes unhandled_fault(unsigned long address, struct task_struct *tsk, struct pt_regs *regs) @@ -193,6 +242,7 @@ static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn) static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code, unsigned int insn, unsigned long address) { + unsigned long g2; unsigned char asi = ASI_P; if ((!insn) && (regs->tstate & TSTATE_PRIV)) @@ -223,9 +273,11 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code, } } + g2 = regs->u_regs[UREG_G2]; + /* Is this in ex_table? */ if (regs->tstate & TSTATE_PRIV) { - const struct exception_table_entry *entry; + unsigned long fixup; if (asi == ASI_P && (insn & 0xc0800000) == 0xc0800000) { if (insn & 0x2000) @@ -236,9 +288,10 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code, /* Look in asi.h: All _S asis have LS bit set */ if ((asi & 0x1) && - (entry = search_exception_tables(regs->tpc))) { - regs->tpc = entry->fixup; + (fixup = search_extables_range(regs->tpc, &g2))) { + regs->tpc = fixup; regs->tnpc = regs->tpc + 4; + regs->u_regs[UREG_G2] = g2; return; } } else { @@ -408,7 +461,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) } up_read(&mm->mmap_sem); - return; + goto fault_done; /* * Something tried to access memory that isn't in our memory map.. @@ -420,7 +473,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) handle_kernel_fault: do_kernel_fault(regs, si_code, fault_code, insn, address); - return; + + goto fault_done; /* * We ran out of memory, or some other thing happened to us that made @@ -451,4 +505,9 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) /* Kernel mode? Handle exceptions or die */ if (regs->tstate & TSTATE_PRIV) goto handle_kernel_fault; + +fault_done: + /* These values are no longer needed, clear them. */ + set_thread_fault_code(0); + current_thread_info()->fault_address = 0; } diff --git a/trunk/arch/sparc64/mm/init.c b/trunk/arch/sparc64/mm/init.c index 1e44ee26cee8..fdb1ebb308c9 100644 --- a/trunk/arch/sparc64/mm/init.c +++ b/trunk/arch/sparc64/mm/init.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include @@ -42,80 +40,24 @@ extern void device_scan(void); -#define MAX_BANKS 32 +struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; -static struct linux_prom64_registers pavail[MAX_BANKS] __initdata; -static struct linux_prom64_registers pavail_rescan[MAX_BANKS] __initdata; -static int pavail_ents __initdata; -static int pavail_rescan_ents __initdata; - -static int cmp_p64(const void *a, const void *b) -{ - const struct linux_prom64_registers *x = a, *y = b; - - if (x->phys_addr > y->phys_addr) - return 1; - if (x->phys_addr < y->phys_addr) - return -1; - return 0; -} - -static void __init read_obp_memory(const char *property, - struct linux_prom64_registers *regs, - int *num_ents) -{ - int node = prom_finddevice("/memory"); - int prop_size = prom_getproplen(node, property); - int ents, ret, i; - - ents = prop_size / sizeof(struct linux_prom64_registers); - if (ents > MAX_BANKS) { - prom_printf("The machine has more %s property entries than " - "this kernel can support (%d).\n", - property, MAX_BANKS); - prom_halt(); - } - - ret = prom_getproperty(node, property, (char *) regs, prop_size); - if (ret == -1) { - prom_printf("Couldn't get %s property from /memory.\n"); - prom_halt(); - } - - *num_ents = ents; - - /* Sanitize what we got from the firmware, by page aligning - * everything. - */ - for (i = 0; i < ents; i++) { - unsigned long base, size; - - base = regs[i].phys_addr; - size = regs[i].reg_size; - - size &= PAGE_MASK; - if (base & ~PAGE_MASK) { - unsigned long new_base = PAGE_ALIGN(base); - - size -= new_base - base; - if ((long) size < 0L) - size = 0UL; - base = new_base; - } - regs[i].phys_addr = base; - regs[i].reg_size = size; - } - sort(regs, ents, sizeof(struct linux_prom64_registers), - cmp_p64, NULL); -} - -unsigned long *sparc64_valid_addr_bitmap __read_mostly; +unsigned long *sparc64_valid_addr_bitmap; /* Ugly, but necessary... -DaveM */ -unsigned long phys_base __read_mostly; -unsigned long kern_base __read_mostly; -unsigned long kern_size __read_mostly; -unsigned long pfn_base __read_mostly; +unsigned long phys_base; +unsigned long kern_base; +unsigned long kern_size; +unsigned long pfn_base; + +/* This is even uglier. We have a problem where the kernel may not be + * located at phys_base. However, initial __alloc_bootmem() calls need to + * be adjusted to be within the 4-8Megs that the kernel is mapped to, else + * those page mappings wont work. Things are ok after inherit_prom_mappings + * is called though. Dave says he'll clean this up some other time. + * -- BenC + */ +static unsigned long bootmap_base; /* get_new_mmu_context() uses "cache + 1". */ DEFINE_SPINLOCK(ctx_alloc_lock); @@ -131,13 +73,7 @@ extern unsigned long sparc_ramdisk_image64; extern unsigned int sparc_ramdisk_image; extern unsigned int sparc_ramdisk_size; -struct page *mem_map_zero __read_mostly; - -unsigned int sparc64_highest_unlocked_tlb_ent __read_mostly; - -unsigned long sparc64_kern_pri_context __read_mostly; -unsigned long sparc64_kern_pri_nuc_bits __read_mostly; -unsigned long sparc64_kern_sec_context __read_mostly; +struct page *mem_map_zero; int bigkernel = 0; @@ -243,6 +179,8 @@ static __inline__ void clear_dcache_dirty_cpu(struct page *page, unsigned long c : "g1", "g7"); } +extern void __update_mmu_cache(unsigned long mmu_context_hw, unsigned long address, pte_t pte, int code); + void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) { struct page *page; @@ -269,6 +207,10 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t p put_cpu(); } + + if (get_thread_fault_code()) + __update_mmu_cache(CTX_NRBITS(vma->vm_mm->context), + address, pte, get_thread_fault_code()); } void flush_dcache_page(struct page *page) @@ -368,11 +310,6 @@ struct linux_prom_translation { unsigned long data; }; -/* Exported for kernel TLB miss handling in ktlb.S */ -struct linux_prom_translation prom_trans[512] __read_mostly; -unsigned int prom_trans_ents __read_mostly; -unsigned int swapper_pgd_zero __read_mostly; - extern unsigned long prom_boot_page; extern void prom_remap(unsigned long physpage, unsigned long virtpage, int mmu_ihandle); extern int prom_get_mmu_ihandle(void); @@ -381,162 +318,297 @@ extern void register_prom_callbacks(void); /* Exported for SMP bootup purposes. */ unsigned long kern_locked_tte_data; +void __init early_pgtable_allocfail(char *type) +{ + prom_printf("inherit_prom_mappings: Cannot alloc kernel %s.\n", type); + prom_halt(); +} + +#define BASE_PAGE_SIZE 8192 +static pmd_t *prompmd; + /* * Translate PROM's mapping we capture at boot time into physical address. * The second parameter is only set from prom_callback() invocations. */ unsigned long prom_virt_to_phys(unsigned long promva, int *error) { - int i; - - for (i = 0; i < prom_trans_ents; i++) { - struct linux_prom_translation *p = &prom_trans[i]; - - if (promva >= p->virt && - promva < (p->virt + p->size)) { - unsigned long base = p->data & _PAGE_PADDR; - - if (error) - *error = 0; - return base + (promva & (8192 - 1)); - } + pmd_t *pmdp = prompmd + ((promva >> 23) & 0x7ff); + pte_t *ptep; + unsigned long base; + + if (pmd_none(*pmdp)) { + if (error) + *error = 1; + return(0); } - if (error) - *error = 1; - return 0UL; -} - -/* The obp translations are saved based on 8k pagesize, since obp can - * use a mixture of pagesizes. Misses to the LOW_OBP_ADDRESS -> - * HI_OBP_ADDRESS range are handled in ktlb.S and do not use the vpte - * scheme (also, see rant in inherit_locked_prom_mappings()). - */ -static inline int in_obp_range(unsigned long vaddr) -{ - return (vaddr >= LOW_OBP_ADDRESS && - vaddr < HI_OBP_ADDRESS); -} - -static int cmp_ptrans(const void *a, const void *b) -{ - const struct linux_prom_translation *x = a, *y = b; - - if (x->virt > y->virt) - return 1; - if (x->virt < y->virt) - return -1; - return 0; + ptep = (pte_t *)__pmd_page(*pmdp) + ((promva >> 13) & 0x3ff); + if (!pte_present(*ptep)) { + if (error) + *error = 1; + return(0); + } + if (error) { + *error = 0; + return(pte_val(*ptep)); + } + base = pte_val(*ptep) & _PAGE_PADDR; + return(base + (promva & (BASE_PAGE_SIZE - 1))); } -/* Read OBP translations property into 'prom_trans[]'. */ -static void __init read_obp_translations(void) +static void inherit_prom_mappings(void) { - int n, node, ents, first, last, i; + struct linux_prom_translation *trans; + unsigned long phys_page, tte_vaddr, tte_data; + void (*remap_func)(unsigned long, unsigned long, int); + pmd_t *pmdp; + pte_t *ptep; + int node, n, i, tsz; + extern unsigned int obp_iaddr_patch[2], obp_daddr_patch[2]; node = prom_finddevice("/virtual-memory"); n = prom_getproplen(node, "translations"); - if (unlikely(n == 0 || n == -1)) { - prom_printf("prom_mappings: Couldn't get size.\n"); + if (n == 0 || n == -1) { + prom_printf("Couldn't get translation property\n"); prom_halt(); } - if (unlikely(n > sizeof(prom_trans))) { - prom_printf("prom_mappings: Size %Zd is too big.\n", n); + n += 5 * sizeof(struct linux_prom_translation); + for (tsz = 1; tsz < n; tsz <<= 1) + /* empty */; + trans = __alloc_bootmem(tsz, SMP_CACHE_BYTES, bootmap_base); + if (trans == NULL) { + prom_printf("inherit_prom_mappings: Cannot alloc translations.\n"); prom_halt(); } + memset(trans, 0, tsz); - if ((n = prom_getproperty(node, "translations", - (char *)&prom_trans[0], - sizeof(prom_trans))) == -1) { - prom_printf("prom_mappings: Couldn't get property.\n"); + if ((n = prom_getproperty(node, "translations", (char *)trans, tsz)) == -1) { + prom_printf("Couldn't get translation property\n"); prom_halt(); } + n = n / sizeof(*trans); - n = n / sizeof(struct linux_prom_translation); + /* + * The obp translations are saved based on 8k pagesize, since obp can + * use a mixture of pagesizes. Misses to the 0xf0000000 - 0x100000000, + * ie obp range, are handled in entry.S and do not use the vpte scheme + * (see rant in inherit_locked_prom_mappings()). + */ +#define OBP_PMD_SIZE 2048 + prompmd = __alloc_bootmem(OBP_PMD_SIZE, OBP_PMD_SIZE, bootmap_base); + if (prompmd == NULL) + early_pgtable_allocfail("pmd"); + memset(prompmd, 0, OBP_PMD_SIZE); + for (i = 0; i < n; i++) { + unsigned long vaddr; + + if (trans[i].virt >= LOW_OBP_ADDRESS && trans[i].virt < HI_OBP_ADDRESS) { + for (vaddr = trans[i].virt; + ((vaddr < trans[i].virt + trans[i].size) && + (vaddr < HI_OBP_ADDRESS)); + vaddr += BASE_PAGE_SIZE) { + unsigned long val; + + pmdp = prompmd + ((vaddr >> 23) & 0x7ff); + if (pmd_none(*pmdp)) { + ptep = __alloc_bootmem(BASE_PAGE_SIZE, + BASE_PAGE_SIZE, + bootmap_base); + if (ptep == NULL) + early_pgtable_allocfail("pte"); + memset(ptep, 0, BASE_PAGE_SIZE); + pmd_set(pmdp, ptep); + } + ptep = (pte_t *)__pmd_page(*pmdp) + + ((vaddr >> 13) & 0x3ff); - ents = n; + val = trans[i].data; - sort(prom_trans, ents, sizeof(struct linux_prom_translation), - cmp_ptrans, NULL); + /* Clear diag TTE bits. */ + if (tlb_type == spitfire) + val &= ~0x0003fe0000000000UL; - /* Now kick out all the non-OBP entries. */ - for (i = 0; i < ents; i++) { - if (in_obp_range(prom_trans[i].virt)) - break; - } - first = i; - for (; i < ents; i++) { - if (!in_obp_range(prom_trans[i].virt)) - break; + set_pte_at(&init_mm, vaddr, + ptep, __pte(val | _PAGE_MODIFIED)); + trans[i].data += BASE_PAGE_SIZE; + } + } } - last = i; + phys_page = __pa(prompmd); + obp_iaddr_patch[0] |= (phys_page >> 10); + obp_iaddr_patch[1] |= (phys_page & 0x3ff); + flushi((long)&obp_iaddr_patch[0]); + obp_daddr_patch[0] |= (phys_page >> 10); + obp_daddr_patch[1] |= (phys_page & 0x3ff); + flushi((long)&obp_daddr_patch[0]); - for (i = 0; i < (last - first); i++) { - struct linux_prom_translation *src = &prom_trans[i + first]; - struct linux_prom_translation *dest = &prom_trans[i]; - - *dest = *src; - } - for (; i < ents; i++) { - struct linux_prom_translation *dest = &prom_trans[i]; - dest->virt = dest->size = dest->data = 0x0UL; - } + /* Now fixup OBP's idea about where we really are mapped. */ + prom_printf("Remapping the kernel... "); - prom_trans_ents = last - first; + /* Spitfire Errata #32 workaround */ + /* NOTE: Using plain zero for the context value is + * correct here, we are not using the Linux trap + * tables yet so we should not use the special + * UltraSPARC-III+ page size encodings yet. + */ + __asm__ __volatile__("stxa %0, [%1] %2\n\t" + "flush %%g6" + : /* No outputs */ + : "r" (0), "r" (PRIMARY_CONTEXT), "i" (ASI_DMMU)); + + switch (tlb_type) { + default: + case spitfire: + phys_page = spitfire_get_dtlb_data(sparc64_highest_locked_tlbent()); + break; + + case cheetah: + case cheetah_plus: + phys_page = cheetah_get_litlb_data(sparc64_highest_locked_tlbent()); + break; + }; + + phys_page &= _PAGE_PADDR; + phys_page += ((unsigned long)&prom_boot_page - + (unsigned long)KERNBASE); if (tlb_type == spitfire) { - /* Clear diag TTE bits. */ - for (i = 0; i < prom_trans_ents; i++) - prom_trans[i].data &= ~0x0003fe0000000000UL; + /* Lock this into i/d tlb entry 59 */ + __asm__ __volatile__( + "stxa %%g0, [%2] %3\n\t" + "stxa %0, [%1] %4\n\t" + "membar #Sync\n\t" + "flush %%g6\n\t" + "stxa %%g0, [%2] %5\n\t" + "stxa %0, [%1] %6\n\t" + "membar #Sync\n\t" + "flush %%g6" + : : "r" (phys_page | _PAGE_VALID | _PAGE_SZ8K | _PAGE_CP | + _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W), + "r" (59 << 3), "r" (TLB_TAG_ACCESS), + "i" (ASI_DMMU), "i" (ASI_DTLB_DATA_ACCESS), + "i" (ASI_IMMU), "i" (ASI_ITLB_DATA_ACCESS) + : "memory"); + } else if (tlb_type == cheetah || tlb_type == cheetah_plus) { + /* Lock this into i/d tlb-0 entry 11 */ + __asm__ __volatile__( + "stxa %%g0, [%2] %3\n\t" + "stxa %0, [%1] %4\n\t" + "membar #Sync\n\t" + "flush %%g6\n\t" + "stxa %%g0, [%2] %5\n\t" + "stxa %0, [%1] %6\n\t" + "membar #Sync\n\t" + "flush %%g6" + : : "r" (phys_page | _PAGE_VALID | _PAGE_SZ8K | _PAGE_CP | + _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W), + "r" ((0 << 16) | (11 << 3)), "r" (TLB_TAG_ACCESS), + "i" (ASI_DMMU), "i" (ASI_DTLB_DATA_ACCESS), + "i" (ASI_IMMU), "i" (ASI_ITLB_DATA_ACCESS) + : "memory"); + } else { + /* Implement me :-) */ + BUG(); } -} - -static void __init remap_kernel(void) -{ - unsigned long phys_page, tte_vaddr, tte_data; - int tlb_ent = sparc64_highest_locked_tlbent(); tte_vaddr = (unsigned long) KERNBASE; - phys_page = (prom_boot_mapping_phys_low >> 22UL) << 22UL; - tte_data = (phys_page | (_PAGE_VALID | _PAGE_SZ4MB | - _PAGE_CP | _PAGE_CV | _PAGE_P | - _PAGE_L | _PAGE_W)); + + /* Spitfire Errata #32 workaround */ + /* NOTE: Using plain zero for the context value is + * correct here, we are not using the Linux trap + * tables yet so we should not use the special + * UltraSPARC-III+ page size encodings yet. + */ + __asm__ __volatile__("stxa %0, [%1] %2\n\t" + "flush %%g6" + : /* No outputs */ + : "r" (0), + "r" (PRIMARY_CONTEXT), "i" (ASI_DMMU)); + + if (tlb_type == spitfire) + tte_data = spitfire_get_dtlb_data(sparc64_highest_locked_tlbent()); + else + tte_data = cheetah_get_ldtlb_data(sparc64_highest_locked_tlbent()); kern_locked_tte_data = tte_data; - /* Now lock us into the TLBs via OBP. */ - prom_dtlb_load(tlb_ent, tte_data, tte_vaddr); - prom_itlb_load(tlb_ent, tte_data, tte_vaddr); + remap_func = (void *) ((unsigned long) &prom_remap - + (unsigned long) &prom_boot_page); + + + /* Spitfire Errata #32 workaround */ + /* NOTE: Using plain zero for the context value is + * correct here, we are not using the Linux trap + * tables yet so we should not use the special + * UltraSPARC-III+ page size encodings yet. + */ + __asm__ __volatile__("stxa %0, [%1] %2\n\t" + "flush %%g6" + : /* No outputs */ + : "r" (0), + "r" (PRIMARY_CONTEXT), "i" (ASI_DMMU)); + + remap_func((tlb_type == spitfire ? + (spitfire_get_dtlb_data(sparc64_highest_locked_tlbent()) & _PAGE_PADDR) : + (cheetah_get_litlb_data(sparc64_highest_locked_tlbent()) & _PAGE_PADDR)), + (unsigned long) KERNBASE, + prom_get_mmu_ihandle()); + + if (bigkernel) + remap_func(((tte_data + 0x400000) & _PAGE_PADDR), + (unsigned long) KERNBASE + 0x400000, prom_get_mmu_ihandle()); + + /* Flush out that temporary mapping. */ + spitfire_flush_dtlb_nucleus_page(0x0); + spitfire_flush_itlb_nucleus_page(0x0); + + /* Now lock us back into the TLBs via OBP. */ + prom_dtlb_load(sparc64_highest_locked_tlbent(), tte_data, tte_vaddr); + prom_itlb_load(sparc64_highest_locked_tlbent(), tte_data, tte_vaddr); if (bigkernel) { - tlb_ent -= 1; - prom_dtlb_load(tlb_ent, - tte_data + 0x400000, - tte_vaddr + 0x400000); - prom_itlb_load(tlb_ent, - tte_data + 0x400000, - tte_vaddr + 0x400000); + prom_dtlb_load(sparc64_highest_locked_tlbent()-1, tte_data + 0x400000, + tte_vaddr + 0x400000); + prom_itlb_load(sparc64_highest_locked_tlbent()-1, tte_data + 0x400000, + tte_vaddr + 0x400000); } - sparc64_highest_unlocked_tlb_ent = tlb_ent - 1; - if (tlb_type == cheetah_plus) { - sparc64_kern_pri_context = (CTX_CHEETAH_PLUS_CTX0 | - CTX_CHEETAH_PLUS_NUC); - sparc64_kern_pri_nuc_bits = CTX_CHEETAH_PLUS_NUC; - sparc64_kern_sec_context = CTX_CHEETAH_PLUS_CTX0; + + /* Re-read translations property. */ + if ((n = prom_getproperty(node, "translations", (char *)trans, tsz)) == -1) { + prom_printf("Couldn't get translation property\n"); + prom_halt(); } -} + n = n / sizeof(*trans); + for (i = 0; i < n; i++) { + unsigned long vaddr = trans[i].virt; + unsigned long size = trans[i].size; -static void __init inherit_prom_mappings(void) -{ - read_obp_translations(); + if (vaddr < 0xf0000000UL) { + unsigned long avoid_start = (unsigned long) KERNBASE; + unsigned long avoid_end = avoid_start + (4 * 1024 * 1024); + + if (bigkernel) + avoid_end += (4 * 1024 * 1024); + if (vaddr < avoid_start) { + unsigned long top = vaddr + size; + + if (top > avoid_start) + top = avoid_start; + prom_unmap(top - vaddr, vaddr); + } + if ((vaddr + size) > avoid_end) { + unsigned long bottom = vaddr; + + if (bottom < avoid_end) + bottom = avoid_end; + prom_unmap((vaddr + size) - bottom, bottom); + } + } + } - /* Now fixup OBP's idea about where we really are mapped. */ - prom_printf("Remapping the kernel... "); - remap_kernel(); prom_printf("done.\n"); - prom_printf("Registering callbacks... "); register_prom_callbacks(); - prom_printf("done.\n"); } /* The OBP specifications for sun4u mark 0xfffffffc00000000 and @@ -720,8 +792,8 @@ void inherit_locked_prom_mappings(int save_p) } } if (tlb_type == spitfire) { - int high = sparc64_highest_unlocked_tlb_ent; - for (i = 0; i <= high; i++) { + int high = SPITFIRE_HIGHEST_LOCKED_TLBENT - bigkernel; + for (i = 0; i < high; i++) { unsigned long data; /* Spitfire Errata #32 workaround */ @@ -809,9 +881,9 @@ void inherit_locked_prom_mappings(int save_p) } } } else if (tlb_type == cheetah || tlb_type == cheetah_plus) { - int high = sparc64_highest_unlocked_tlb_ent; + int high = CHEETAH_HIGHEST_LOCKED_TLBENT - bigkernel; - for (i = 0; i <= high; i++) { + for (i = 0; i < high; i++) { unsigned long data; data = cheetah_get_ldtlb_data(i); @@ -1204,14 +1276,14 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) int i; #ifdef CONFIG_DEBUG_BOOTMEM - prom_printf("bootmem_init: Scan pavail, "); + prom_printf("bootmem_init: Scan sp_banks, "); #endif bytes_avail = 0UL; - for (i = 0; i < pavail_ents; i++) { - end_of_phys_memory = pavail[i].phys_addr + - pavail[i].reg_size; - bytes_avail += pavail[i].reg_size; + for (i = 0; sp_banks[i].num_bytes != 0; i++) { + end_of_phys_memory = sp_banks[i].base_addr + + sp_banks[i].num_bytes; + bytes_avail += sp_banks[i].num_bytes; if (cmdline_memory_size) { if (bytes_avail > cmdline_memory_size) { unsigned long slack = bytes_avail - cmdline_memory_size; @@ -1219,15 +1291,12 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) bytes_avail -= slack; end_of_phys_memory -= slack; - pavail[i].reg_size -= slack; - if ((long)pavail[i].reg_size <= 0L) { - pavail[i].phys_addr = 0xdeadbeefUL; - pavail[i].reg_size = 0UL; - pavail_ents = i; + sp_banks[i].num_bytes -= slack; + if (sp_banks[i].num_bytes == 0) { + sp_banks[i].base_addr = 0xdeadbeef; } else { - pavail[i+1].reg_size = 0Ul; - pavail[i+1].phys_addr = 0xdeadbeefUL; - pavail_ents = i + 1; + sp_banks[i+1].num_bytes = 0; + sp_banks[i+1].base_addr = 0xdeadbeef; } break; } @@ -1278,15 +1347,17 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) #endif bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap_pfn, pfn_base, end_pfn); + bootmap_base = bootmap_pfn << PAGE_SHIFT; + /* Now register the available physical memory with the * allocator. */ - for (i = 0; i < pavail_ents; i++) { + for (i = 0; sp_banks[i].num_bytes != 0; i++) { #ifdef CONFIG_DEBUG_BOOTMEM - prom_printf("free_bootmem(pavail:%d): base[%lx] size[%lx]\n", - i, pavail[i].phys_addr, pavail[i].reg_size); + prom_printf("free_bootmem(sp_banks:%d): base[%lx] size[%lx]\n", + i, sp_banks[i].base_addr, sp_banks[i].num_bytes); #endif - free_bootmem(pavail[i].phys_addr, pavail[i].reg_size); + free_bootmem(sp_banks[i].base_addr, sp_banks[i].num_bytes); } #ifdef CONFIG_BLK_DEV_INITRD @@ -1327,167 +1398,121 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) return end_pfn; } -#ifdef CONFIG_DEBUG_PAGEALLOC -static unsigned long kernel_map_range(unsigned long pstart, unsigned long pend, pgprot_t prot) -{ - unsigned long vstart = PAGE_OFFSET + pstart; - unsigned long vend = PAGE_OFFSET + pend; - unsigned long alloc_bytes = 0UL; - - if ((vstart & ~PAGE_MASK) || (vend & ~PAGE_MASK)) { - prom_printf("kernel_map: Unaligned physmem[%lx:%lx]\n", - vstart, vend); - prom_halt(); - } - - while (vstart < vend) { - unsigned long this_end, paddr = __pa(vstart); - pgd_t *pgd = pgd_offset_k(vstart); - pud_t *pud; - pmd_t *pmd; - pte_t *pte; - - pud = pud_offset(pgd, vstart); - if (pud_none(*pud)) { - pmd_t *new; - - new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); - alloc_bytes += PAGE_SIZE; - pud_populate(&init_mm, pud, new); - } - - pmd = pmd_offset(pud, vstart); - if (!pmd_present(*pmd)) { - pte_t *new; - - new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); - alloc_bytes += PAGE_SIZE; - pmd_populate_kernel(&init_mm, pmd, new); - } - - pte = pte_offset_kernel(pmd, vstart); - this_end = (vstart + PMD_SIZE) & PMD_MASK; - if (this_end > vend) - this_end = vend; - - while (vstart < this_end) { - pte_val(*pte) = (paddr | pgprot_val(prot)); - - vstart += PAGE_SIZE; - paddr += PAGE_SIZE; - pte++; - } - } - - return alloc_bytes; -} - -static struct linux_prom64_registers pall[MAX_BANKS] __initdata; -static int pall_ents __initdata; - -extern unsigned int kvmap_linear_patch[1]; - -static void __init kernel_physical_mapping_init(void) -{ - unsigned long i, mem_alloced = 0UL; - - read_obp_memory("reg", &pall[0], &pall_ents); - - for (i = 0; i < pall_ents; i++) { - unsigned long phys_start, phys_end; - - phys_start = pall[i].phys_addr; - phys_end = phys_start + pall[i].reg_size; - mem_alloced += kernel_map_range(phys_start, phys_end, - PAGE_KERNEL); - } - - printk("Allocated %ld bytes for kernel page tables.\n", - mem_alloced); - - kvmap_linear_patch[0] = 0x01000000; /* nop */ - flushi(&kvmap_linear_patch[0]); - - __flush_tlb_all(); -} - -void kernel_map_pages(struct page *page, int numpages, int enable) -{ - unsigned long phys_start = page_to_pfn(page) << PAGE_SHIFT; - unsigned long phys_end = phys_start + (numpages * PAGE_SIZE); - - kernel_map_range(phys_start, phys_end, - (enable ? PAGE_KERNEL : __pgprot(0))); - - /* we should perform an IPI and flush all tlbs, - * but that can deadlock->flush only current cpu. - */ - __flush_tlb_kernel_range(PAGE_OFFSET + phys_start, - PAGE_OFFSET + phys_end); -} -#endif - -unsigned long __init find_ecache_flush_span(unsigned long size) -{ - int i; - - for (i = 0; i < pavail_ents; i++) { - if (pavail[i].reg_size >= size) - return pavail[i].phys_addr; - } - - return ~0UL; -} - /* paging_init() sets up the page tables */ extern void cheetah_ecache_flush_init(void); static unsigned long last_valid_pfn; -pgd_t swapper_pg_dir[2048]; void __init paging_init(void) { - unsigned long end_pfn, pages_avail, shift; - unsigned long real_end, i; - - /* Find available physical memory... */ - read_obp_memory("available", &pavail[0], &pavail_ents); - - phys_base = 0xffffffffffffffffUL; - for (i = 0; i < pavail_ents; i++) - phys_base = min(phys_base, pavail[i].phys_addr); - - pfn_base = phys_base >> PAGE_SHIFT; - - kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; - kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; + extern pmd_t swapper_pmd_dir[1024]; + extern unsigned int sparc64_vpte_patchme1[1]; + extern unsigned int sparc64_vpte_patchme2[1]; + unsigned long alias_base = kern_base + PAGE_OFFSET; + unsigned long second_alias_page = 0; + unsigned long pt, flags, end_pfn, pages_avail; + unsigned long shift = alias_base - ((unsigned long)KERNBASE); + unsigned long real_end; set_bit(0, mmu_context_bmap); - shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE); - real_end = (unsigned long)_end; if ((real_end > ((unsigned long)KERNBASE + 0x400000))) bigkernel = 1; - if ((real_end > ((unsigned long)KERNBASE + 0x800000))) { - prom_printf("paging_init: Kernel > 8MB, too large.\n"); - prom_halt(); - } +#ifdef CONFIG_BLK_DEV_INITRD + if (sparc_ramdisk_image || sparc_ramdisk_image64) + real_end = (PAGE_ALIGN(real_end) + PAGE_ALIGN(sparc_ramdisk_size)); +#endif - /* Set kernel pgd to upper alias so physical page computations + /* We assume physical memory starts at some 4mb multiple, + * if this were not true we wouldn't boot up to this point + * anyways. + */ + pt = kern_base | _PAGE_VALID | _PAGE_SZ4MB; + pt |= _PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W; + local_irq_save(flags); + if (tlb_type == spitfire) { + __asm__ __volatile__( + " stxa %1, [%0] %3\n" + " stxa %2, [%5] %4\n" + " membar #Sync\n" + " flush %%g6\n" + " nop\n" + " nop\n" + " nop\n" + : /* No outputs */ + : "r" (TLB_TAG_ACCESS), "r" (alias_base), "r" (pt), + "i" (ASI_DMMU), "i" (ASI_DTLB_DATA_ACCESS), "r" (61 << 3) + : "memory"); + if (real_end >= KERNBASE + 0x340000) { + second_alias_page = alias_base + 0x400000; + __asm__ __volatile__( + " stxa %1, [%0] %3\n" + " stxa %2, [%5] %4\n" + " membar #Sync\n" + " flush %%g6\n" + " nop\n" + " nop\n" + " nop\n" + : /* No outputs */ + : "r" (TLB_TAG_ACCESS), "r" (second_alias_page), "r" (pt + 0x400000), + "i" (ASI_DMMU), "i" (ASI_DTLB_DATA_ACCESS), "r" (60 << 3) + : "memory"); + } + } else if (tlb_type == cheetah || tlb_type == cheetah_plus) { + __asm__ __volatile__( + " stxa %1, [%0] %3\n" + " stxa %2, [%5] %4\n" + " membar #Sync\n" + " flush %%g6\n" + " nop\n" + " nop\n" + " nop\n" + : /* No outputs */ + : "r" (TLB_TAG_ACCESS), "r" (alias_base), "r" (pt), + "i" (ASI_DMMU), "i" (ASI_DTLB_DATA_ACCESS), "r" ((0<<16) | (13<<3)) + : "memory"); + if (real_end >= KERNBASE + 0x340000) { + second_alias_page = alias_base + 0x400000; + __asm__ __volatile__( + " stxa %1, [%0] %3\n" + " stxa %2, [%5] %4\n" + " membar #Sync\n" + " flush %%g6\n" + " nop\n" + " nop\n" + " nop\n" + : /* No outputs */ + : "r" (TLB_TAG_ACCESS), "r" (second_alias_page), "r" (pt + 0x400000), + "i" (ASI_DMMU), "i" (ASI_DTLB_DATA_ACCESS), "r" ((0<<16) | (12<<3)) + : "memory"); + } + } + local_irq_restore(flags); + + /* Now set kernel pgd to upper alias so physical page computations * work. */ init_mm.pgd += ((shift) / (sizeof(pgd_t))); - memset(swapper_low_pmd_dir, 0, sizeof(swapper_low_pmd_dir)); + memset(swapper_pmd_dir, 0, sizeof(swapper_pmd_dir)); /* Now can init the kernel/bad page tables. */ pud_set(pud_offset(&swapper_pg_dir[0], 0), - swapper_low_pmd_dir + (shift / sizeof(pgd_t))); + swapper_pmd_dir + (shift / sizeof(pgd_t))); - swapper_pgd_zero = pgd_val(swapper_pg_dir[0]); + sparc64_vpte_patchme1[0] |= + (((unsigned long)pgd_val(init_mm.pgd[0])) >> 10); + sparc64_vpte_patchme2[0] |= + (((unsigned long)pgd_val(init_mm.pgd[0])) & 0x3ff); + flushi((long)&sparc64_vpte_patchme1[0]); + /* Setup bootmem... */ + pages_avail = 0; + last_valid_pfn = end_pfn = bootmem_init(&pages_avail); + + /* Inherit non-locked OBP mappings. */ inherit_prom_mappings(); /* Ok, we can use our TLB miss and window trap handlers safely. @@ -1502,15 +1527,12 @@ void __init paging_init(void) inherit_locked_prom_mappings(1); - __flush_tlb_all(); - - /* Setup bootmem... */ - pages_avail = 0; - last_valid_pfn = end_pfn = bootmem_init(&pages_avail); + /* We only created DTLB mapping of this stuff. */ + spitfire_flush_dtlb_nucleus_page(alias_base); + if (second_alias_page) + spitfire_flush_dtlb_nucleus_page(second_alias_page); -#ifdef CONFIG_DEBUG_PAGEALLOC - kernel_physical_mapping_init(); -#endif + __flush_tlb_all(); { unsigned long zones_size[MAX_NR_ZONES]; @@ -1532,35 +1554,128 @@ void __init paging_init(void) device_scan(); } +/* Ok, it seems that the prom can allocate some more memory chunks + * as a side effect of some prom calls we perform during the + * boot sequence. My most likely theory is that it is from the + * prom_set_traptable() call, and OBP is allocating a scratchpad + * for saving client program register state etc. + */ +static void __init sort_memlist(struct linux_mlist_p1275 *thislist) +{ + int swapi = 0; + int i, mitr; + unsigned long tmpaddr, tmpsize; + unsigned long lowest; + + for (i = 0; thislist[i].theres_more != 0; i++) { + lowest = thislist[i].start_adr; + for (mitr = i+1; thislist[mitr-1].theres_more != 0; mitr++) + if (thislist[mitr].start_adr < lowest) { + lowest = thislist[mitr].start_adr; + swapi = mitr; + } + if (lowest == thislist[i].start_adr) + continue; + tmpaddr = thislist[swapi].start_adr; + tmpsize = thislist[swapi].num_bytes; + for (mitr = swapi; mitr > i; mitr--) { + thislist[mitr].start_adr = thislist[mitr-1].start_adr; + thislist[mitr].num_bytes = thislist[mitr-1].num_bytes; + } + thislist[i].start_adr = tmpaddr; + thislist[i].num_bytes = tmpsize; + } +} + +void __init rescan_sp_banks(void) +{ + struct linux_prom64_registers memlist[64]; + struct linux_mlist_p1275 avail[64], *mlist; + unsigned long bytes, base_paddr; + int num_regs, node = prom_finddevice("/memory"); + int i; + + num_regs = prom_getproperty(node, "available", + (char *) memlist, sizeof(memlist)); + num_regs = (num_regs / sizeof(struct linux_prom64_registers)); + for (i = 0; i < num_regs; i++) { + avail[i].start_adr = memlist[i].phys_addr; + avail[i].num_bytes = memlist[i].reg_size; + avail[i].theres_more = &avail[i + 1]; + } + avail[i - 1].theres_more = NULL; + sort_memlist(avail); + + mlist = &avail[0]; + i = 0; + bytes = mlist->num_bytes; + base_paddr = mlist->start_adr; + + sp_banks[0].base_addr = base_paddr; + sp_banks[0].num_bytes = bytes; + + while (mlist->theres_more != NULL){ + i++; + mlist = mlist->theres_more; + bytes = mlist->num_bytes; + if (i >= SPARC_PHYS_BANKS-1) { + printk ("The machine has more banks than " + "this kernel can support\n" + "Increase the SPARC_PHYS_BANKS " + "setting (currently %d)\n", + SPARC_PHYS_BANKS); + i = SPARC_PHYS_BANKS-1; + break; + } + + sp_banks[i].base_addr = mlist->start_adr; + sp_banks[i].num_bytes = mlist->num_bytes; + } + + i++; + sp_banks[i].base_addr = 0xdeadbeefbeefdeadUL; + sp_banks[i].num_bytes = 0; + + for (i = 0; sp_banks[i].num_bytes != 0; i++) + sp_banks[i].num_bytes &= PAGE_MASK; +} + static void __init taint_real_pages(void) { + struct sparc_phys_banks saved_sp_banks[SPARC_PHYS_BANKS]; int i; - read_obp_memory("available", &pavail_rescan[0], &pavail_rescan_ents); + for (i = 0; i < SPARC_PHYS_BANKS; i++) { + saved_sp_banks[i].base_addr = + sp_banks[i].base_addr; + saved_sp_banks[i].num_bytes = + sp_banks[i].num_bytes; + } + + rescan_sp_banks(); - /* Find changes discovered in the physmem available rescan and + /* Find changes discovered in the sp_bank rescan and * reserve the lost portions in the bootmem maps. */ - for (i = 0; i < pavail_ents; i++) { + for (i = 0; saved_sp_banks[i].num_bytes; i++) { unsigned long old_start, old_end; - old_start = pavail[i].phys_addr; + old_start = saved_sp_banks[i].base_addr; old_end = old_start + - pavail[i].reg_size; + saved_sp_banks[i].num_bytes; while (old_start < old_end) { int n; - for (n = 0; pavail_rescan_ents; n++) { + for (n = 0; sp_banks[n].num_bytes; n++) { unsigned long new_start, new_end; - new_start = pavail_rescan[n].phys_addr; - new_end = new_start + - pavail_rescan[n].reg_size; + new_start = sp_banks[n].base_addr; + new_end = new_start + sp_banks[n].num_bytes; if (new_start <= old_start && new_end >= (old_start + PAGE_SIZE)) { - set_bit(old_start >> 22, - sparc64_valid_addr_bitmap); + set_bit (old_start >> 22, + sparc64_valid_addr_bitmap); goto do_next_page; } } @@ -1580,7 +1695,8 @@ void __init mem_init(void) i = last_valid_pfn >> ((22 - PAGE_SHIFT) + 6); i += 1; - sparc64_valid_addr_bitmap = (unsigned long *) alloc_bootmem(i << 3); + sparc64_valid_addr_bitmap = (unsigned long *) + __alloc_bootmem(i << 3, SMP_CACHE_BYTES, bootmap_base); if (sparc64_valid_addr_bitmap == NULL) { prom_printf("mem_init: Cannot alloc valid_addr_bitmap.\n"); prom_halt(); @@ -1633,7 +1749,7 @@ void __init mem_init(void) cheetah_ecache_flush_init(); } -void free_initmem(void) +void free_initmem (void) { unsigned long addr, initend; diff --git a/trunk/arch/sparc64/mm/ultra.S b/trunk/arch/sparc64/mm/ultra.S index e4c9151fa116..b2ee9b53227f 100644 --- a/trunk/arch/sparc64/mm/ultra.S +++ b/trunk/arch/sparc64/mm/ultra.S @@ -144,29 +144,42 @@ __flush_icache_page: /* %o0 = phys_page */ #define DTAG_MASK 0x3 - /* This routine is Spitfire specific so the hardcoded - * D-cache size and line-size are OK. - */ .align 64 .globl __flush_dcache_page __flush_dcache_page: /* %o0=kaddr, %o1=flush_icache */ sethi %uhi(PAGE_OFFSET), %g1 sllx %g1, 32, %g1 - sub %o0, %g1, %o0 ! physical address - srlx %o0, 11, %o0 ! make D-cache TAG - sethi %hi(1 << 14), %o2 ! D-cache size - sub %o2, (1 << 5), %o2 ! D-cache line size -1: ldxa [%o2] ASI_DCACHE_TAG, %o3 ! load D-cache TAG - andcc %o3, DTAG_MASK, %g0 ! Valid? - be,pn %xcc, 2f ! Nope, branch - andn %o3, DTAG_MASK, %o3 ! Clear valid bits - cmp %o3, %o0 ! TAG match? - bne,pt %xcc, 2f ! Nope, branch - nop - stxa %g0, [%o2] ASI_DCACHE_TAG ! Invalidate TAG - membar #Sync -2: brnz,pt %o2, 1b - sub %o2, (1 << 5), %o2 ! D-cache line size + sub %o0, %g1, %o0 + clr %o4 + srlx %o0, 11, %o0 + sethi %hi(1 << 14), %o2 +1: ldxa [%o4] ASI_DCACHE_TAG, %o3 ! LSU Group + add %o4, (1 << 5), %o4 ! IEU0 + ldxa [%o4] ASI_DCACHE_TAG, %g1 ! LSU Group + add %o4, (1 << 5), %o4 ! IEU0 + ldxa [%o4] ASI_DCACHE_TAG, %g2 ! LSU Group o3 available + add %o4, (1 << 5), %o4 ! IEU0 + andn %o3, DTAG_MASK, %o3 ! IEU1 + ldxa [%o4] ASI_DCACHE_TAG, %g3 ! LSU Group + add %o4, (1 << 5), %o4 ! IEU0 + andn %g1, DTAG_MASK, %g1 ! IEU1 + cmp %o0, %o3 ! IEU1 Group + be,a,pn %xcc, dflush1 ! CTI + sub %o4, (4 << 5), %o4 ! IEU0 (Group) + cmp %o0, %g1 ! IEU1 Group + andn %g2, DTAG_MASK, %g2 ! IEU0 + be,a,pn %xcc, dflush2 ! CTI + sub %o4, (3 << 5), %o4 ! IEU0 (Group) + cmp %o0, %g2 ! IEU1 Group + andn %g3, DTAG_MASK, %g3 ! IEU0 + be,a,pn %xcc, dflush3 ! CTI + sub %o4, (2 << 5), %o4 ! IEU0 (Group) + cmp %o0, %g3 ! IEU1 Group + be,a,pn %xcc, dflush4 ! CTI + sub %o4, (1 << 5), %o4 ! IEU0 +2: cmp %o4, %o2 ! IEU1 Group + bne,pt %xcc, 1b ! CTI + nop ! IEU0 /* The I-cache does not snoop local stores so we * better flush that too when necessary. @@ -176,9 +189,48 @@ __flush_dcache_page: /* %o0=kaddr, %o1=flush_icache */ retl nop +dflush1:stxa %g0, [%o4] ASI_DCACHE_TAG + add %o4, (1 << 5), %o4 +dflush2:stxa %g0, [%o4] ASI_DCACHE_TAG + add %o4, (1 << 5), %o4 +dflush3:stxa %g0, [%o4] ASI_DCACHE_TAG + add %o4, (1 << 5), %o4 +dflush4:stxa %g0, [%o4] ASI_DCACHE_TAG + add %o4, (1 << 5), %o4 + membar #Sync + ba,pt %xcc, 2b + nop #endif /* DCACHE_ALIASING_POSSIBLE */ - .previous + .previous .text + .align 32 +__prefill_dtlb: + rdpr %pstate, %g7 + wrpr %g7, PSTATE_IE, %pstate + mov TLB_TAG_ACCESS, %g1 + stxa %o5, [%g1] ASI_DMMU + stxa %o2, [%g0] ASI_DTLB_DATA_IN + flush %g6 + retl + wrpr %g7, %pstate +__prefill_itlb: + rdpr %pstate, %g7 + wrpr %g7, PSTATE_IE, %pstate + mov TLB_TAG_ACCESS, %g1 + stxa %o5, [%g1] ASI_IMMU + stxa %o2, [%g0] ASI_ITLB_DATA_IN + flush %g6 + retl + wrpr %g7, %pstate + + .globl __update_mmu_cache +__update_mmu_cache: /* %o0=hw_context, %o1=address, %o2=pte, %o3=fault_code */ + srlx %o1, PAGE_SHIFT, %o1 + andcc %o3, FAULT_CODE_DTLB, %g0 + sllx %o1, PAGE_SHIFT, %o5 + bne,pt %xcc, __prefill_dtlb + or %o5, %o0, %o5 + ba,a,pt %xcc, __prefill_itlb /* Cheetah specific versions, patched at boot time. */ __cheetah_flush_tlb_mm: /* 18 insns */ @@ -231,7 +283,7 @@ __cheetah_flush_tlb_pending: /* 26 insns */ wrpr %g7, 0x0, %pstate #ifdef DCACHE_ALIASING_POSSIBLE -__cheetah_flush_dcache_page: /* 11 insns */ +flush_dcpage_cheetah: /* 11 insns */ sethi %uhi(PAGE_OFFSET), %g1 sllx %g1, 32, %g1 sub %o0, %g1, %o0 @@ -277,8 +329,8 @@ cheetah_patch_cachetlbops: #ifdef DCACHE_ALIASING_POSSIBLE sethi %hi(__flush_dcache_page), %o0 or %o0, %lo(__flush_dcache_page), %o0 - sethi %hi(__cheetah_flush_dcache_page), %o1 - or %o1, %lo(__cheetah_flush_dcache_page), %o1 + sethi %hi(flush_dcpage_cheetah), %o1 + or %o1, %lo(flush_dcpage_cheetah), %o1 call cheetah_patch_one mov 11, %o2 #endif /* DCACHE_ALIASING_POSSIBLE */ @@ -453,6 +505,22 @@ xcall_flush_dcache_page_spitfire: /* %g1 == physical page address nop nop + .globl xcall_promstop +xcall_promstop: + rdpr %pstate, %g2 + wrpr %g2, PSTATE_IG | PSTATE_AG, %pstate + rdpr %pil, %g2 + wrpr %g0, 15, %pil + sethi %hi(109f), %g7 + b,pt %xcc, etrap_irq +109: or %g7, %lo(109b), %g7 + flushw + call prom_stopself + nop + /* We should not return, just spin if we do... */ +1: b,a,pt %xcc, 1b + nop + .data errata32_hwbug: diff --git a/trunk/arch/sparc64/prom/Makefile b/trunk/arch/sparc64/prom/Makefile index 3d33ed27bc27..8f2420d9e9e6 100644 --- a/trunk/arch/sparc64/prom/Makefile +++ b/trunk/arch/sparc64/prom/Makefile @@ -6,5 +6,5 @@ EXTRA_AFLAGS := -ansi EXTRA_CFLAGS := -Werror -lib-y := bootstr.o devops.o init.o misc.o \ - tree.o console.o printf.o p1275.o cif.o +lib-y := bootstr.o devops.o init.o memory.o misc.o \ + tree.o console.o printf.o p1275.o map.o cif.o diff --git a/trunk/arch/sparc64/prom/console.c b/trunk/arch/sparc64/prom/console.c index eae5db8dda56..028a53fcb1ec 100644 --- a/trunk/arch/sparc64/prom/console.c +++ b/trunk/arch/sparc64/prom/console.c @@ -67,7 +67,7 @@ prom_putchar(char c) } void -prom_puts(const char *s, int len) +prom_puts(char *s, int len) { p1275_cmd("write", P1275_ARG(1,P1275_ARG_IN_BUF)| P1275_INOUT(3,1), diff --git a/trunk/arch/sparc64/prom/devops.c b/trunk/arch/sparc64/prom/devops.c index 4641839eb39a..2c99b21b6981 100644 --- a/trunk/arch/sparc64/prom/devops.c +++ b/trunk/arch/sparc64/prom/devops.c @@ -16,7 +16,7 @@ * Returns 0 on failure. */ int -prom_devopen(const char *dstr) +prom_devopen(char *dstr) { return p1275_cmd ("open", P1275_ARG(0,P1275_ARG_IN_STRING)| P1275_INOUT(1,1), diff --git a/trunk/arch/sparc64/prom/init.c b/trunk/arch/sparc64/prom/init.c index f3cc2d8578b2..817faae058cd 100644 --- a/trunk/arch/sparc64/prom/init.c +++ b/trunk/arch/sparc64/prom/init.c @@ -27,6 +27,7 @@ int prom_chosen_node; * failure. It gets passed the pointer to the PROM vector. */ +extern void prom_meminit(void); extern void prom_cif_init(void *, void *); void __init prom_init(void *cif_handler, void *cif_stack) @@ -45,7 +46,7 @@ void __init prom_init(void *cif_handler, void *cif_stack) if((prom_root_node == 0) || (prom_root_node == -1)) prom_halt(); - prom_chosen_node = prom_finddevice(prom_chosen_path); + prom_chosen_node = prom_finddevice("/chosen"); if (!prom_chosen_node || prom_chosen_node == -1) prom_halt(); @@ -89,6 +90,8 @@ void __init prom_init(void *cif_handler, void *cif_stack) printk ("PROMLIB: Sun IEEE Boot Prom %s\n", buffer + bufadjust); + prom_meminit(); + /* Initialization successful. */ return; diff --git a/trunk/arch/sparc64/prom/map.S b/trunk/arch/sparc64/prom/map.S new file mode 100644 index 000000000000..21b3f9c99ea7 --- /dev/null +++ b/trunk/arch/sparc64/prom/map.S @@ -0,0 +1,72 @@ +/* $Id: map.S,v 1.2 1999/11/19 05:53:02 davem Exp $ + * map.S: Tricky coding required to fixup the kernel OBP maps + * properly. + * + * Copyright (C) 1999 David S. Miller (davem@redhat.com) + */ + + .text + .align 8192 + .globl prom_boot_page +prom_boot_page: +call_method: + .asciz "call-method" + .align 8 +map: + .asciz "map" + .align 8 + + /* When we are invoked, our caller has remapped us to + * page zero, therefore we must use PC relative addressing + * for everything after we begin performing the unmap/map + * calls. + */ + .globl prom_remap +prom_remap: /* %o0 = physpage, %o1 = virtpage, %o2 = mmu_ihandle */ + rd %pc, %g1 + srl %o2, 0, %o2 ! kill sign extension + sethi %hi(p1275buf), %g2 + or %g2, %lo(p1275buf), %g2 + ldx [%g2 + 0x10], %g3 ! prom_cif_stack + save %g3, -(192 + 128), %sp + ldx [%g2 + 0x08], %l0 ! prom_cif_handler + mov %g6, %i3 + mov %g4, %i4 + mov %g5, %i5 + flushw + + sethi %hi(prom_remap - call_method), %g7 + or %g7, %lo(prom_remap - call_method), %g7 + sub %g1, %g7, %l2 ! call-method string + sethi %hi(prom_remap - map), %g7 + or %g7, %lo(prom_remap - map), %g7 + sub %g1, %g7, %l4 ! map string + + /* OK, map the 4MB region we really live at. */ + stx %l2, [%sp + 2047 + 128 + 0x00] ! call-method + mov 7, %l5 + stx %l5, [%sp + 2047 + 128 + 0x08] ! num_args + mov 1, %l5 + stx %l5, [%sp + 2047 + 128 + 0x10] ! num_rets + stx %l4, [%sp + 2047 + 128 + 0x18] ! map + stx %i2, [%sp + 2047 + 128 + 0x20] ! mmu_ihandle + mov -1, %l5 + stx %l5, [%sp + 2047 + 128 + 0x28] ! mode == default + sethi %hi(4 * 1024 * 1024), %l5 + stx %l5, [%sp + 2047 + 128 + 0x30] ! size + stx %i1, [%sp + 2047 + 128 + 0x38] ! vaddr + stx %g0, [%sp + 2047 + 128 + 0x40] ! filler + stx %i0, [%sp + 2047 + 128 + 0x48] ! paddr + call %l0 + add %sp, (2047 + 128), %o0 ! argument array + + /* Restore hard-coded globals. */ + mov %i3, %g6 + mov %i4, %g4 + mov %i5, %g5 + + /* Wheee.... we are done. */ + ret + restore + + .align 8192 diff --git a/trunk/arch/sparc64/prom/memory.c b/trunk/arch/sparc64/prom/memory.c new file mode 100644 index 000000000000..f4a8143e052c --- /dev/null +++ b/trunk/arch/sparc64/prom/memory.c @@ -0,0 +1,152 @@ +/* $Id: memory.c,v 1.5 1999/08/31 06:55:04 davem Exp $ + * memory.c: Prom routine for acquiring various bits of information + * about RAM on the machine, both virtual and physical. + * + * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) + * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + */ + +#include +#include + +#include +#include + +/* This routine, for consistency, returns the ram parameters in the + * V0 prom memory descriptor format. I choose this format because I + * think it was the easiest to work with. I feel the religious + * arguments now... ;) Also, I return the linked lists sorted to + * prevent paging_init() upset stomach as I have not yet written + * the pepto-bismol kernel module yet. + */ + +struct linux_prom64_registers prom_reg_memlist[64]; +struct linux_prom64_registers prom_reg_tmp[64]; + +struct linux_mlist_p1275 prom_phys_total[64]; +struct linux_mlist_p1275 prom_prom_taken[64]; +struct linux_mlist_p1275 prom_phys_avail[64]; + +struct linux_mlist_p1275 *prom_ptot_ptr = prom_phys_total; +struct linux_mlist_p1275 *prom_ptak_ptr = prom_prom_taken; +struct linux_mlist_p1275 *prom_pavl_ptr = prom_phys_avail; + +struct linux_mem_p1275 prom_memlist; + + +/* Internal Prom library routine to sort a linux_mlist_p1275 memory + * list. Used below in initialization. + */ +static void __init +prom_sortmemlist(struct linux_mlist_p1275 *thislist) +{ + int swapi = 0; + int i, mitr; + unsigned long tmpaddr, tmpsize; + unsigned long lowest; + + for(i=0; thislist[i].theres_more; i++) { + lowest = thislist[i].start_adr; + for(mitr = i+1; thislist[mitr-1].theres_more; mitr++) + if(thislist[mitr].start_adr < lowest) { + lowest = thislist[mitr].start_adr; + swapi = mitr; + } + if(lowest == thislist[i].start_adr) continue; + tmpaddr = thislist[swapi].start_adr; + tmpsize = thislist[swapi].num_bytes; + for(mitr = swapi; mitr > i; mitr--) { + thislist[mitr].start_adr = thislist[mitr-1].start_adr; + thislist[mitr].num_bytes = thislist[mitr-1].num_bytes; + } + thislist[i].start_adr = tmpaddr; + thislist[i].num_bytes = tmpsize; + } +} + +/* Initialize the memory lists based upon the prom version. */ +void __init prom_meminit(void) +{ + int node = 0; + unsigned int iter, num_regs; + + node = prom_finddevice("/memory"); + num_regs = prom_getproperty(node, "available", + (char *) prom_reg_memlist, + sizeof(prom_reg_memlist)); + num_regs = (num_regs/sizeof(struct linux_prom64_registers)); + for(iter=0; iter /* Reset and reboot the machine with the command 'bcommand'. */ -void prom_reboot(const char *bcommand) +void prom_reboot(char *bcommand) { p1275_cmd("boot", P1275_ARG(0, P1275_ARG_IN_STRING) | P1275_INOUT(1, 0), bcommand); } /* Forth evaluate the expression contained in 'fstring'. */ -void prom_feval(const char *fstring) +void prom_feval(char *fstring) { if (!fstring || fstring[0] == 0) return; @@ -68,11 +68,19 @@ void prom_cmdline(void) local_irq_restore(flags); } +#ifdef CONFIG_SMP +extern void smp_promstop_others(void); +#endif + /* Drop into the prom, but completely terminate the program. * No chance of continuing. */ void prom_halt(void) { +#ifdef CONFIG_SMP + smp_promstop_others(); + udelay(8000); +#endif again: p1275_cmd("exit", P1275_INOUT(0, 0)); goto again; /* PROM is out to get me -DaveM */ @@ -80,6 +88,10 @@ void prom_halt(void) void prom_halt_power_off(void) { +#ifdef CONFIG_SMP + smp_promstop_others(); + udelay(8000); +#endif p1275_cmd("SUNW,power-off", P1275_INOUT(0, 0)); /* if nothing else helps, we just halt */ @@ -136,19 +148,21 @@ void prom_set_trap_table(unsigned long tba) p1275_cmd("SUNW,set-trap-table", P1275_INOUT(1, 0), tba); } +int mmu_ihandle_cache = 0; + int prom_get_mmu_ihandle(void) { int node, ret; - if (prom_mmu_ihandle_cache != 0) - return prom_mmu_ihandle_cache; + if (mmu_ihandle_cache != 0) + return mmu_ihandle_cache; - node = prom_finddevice(prom_chosen_path); - ret = prom_getint(node, prom_mmu_name); + node = prom_finddevice("/chosen"); + ret = prom_getint(node, "mmu"); if (ret == -1 || ret == 0) - prom_mmu_ihandle_cache = -1; + mmu_ihandle_cache = -1; else - prom_mmu_ihandle_cache = ret; + mmu_ihandle_cache = ret; return ret; } @@ -176,7 +190,7 @@ long prom_itlb_load(unsigned long index, unsigned long tte_data, unsigned long vaddr) { - return p1275_cmd(prom_callmethod_name, + return p1275_cmd("call-method", (P1275_ARG(0, P1275_ARG_IN_STRING) | P1275_ARG(2, P1275_ARG_IN_64B) | P1275_ARG(3, P1275_ARG_IN_64B) | @@ -193,7 +207,7 @@ long prom_dtlb_load(unsigned long index, unsigned long tte_data, unsigned long vaddr) { - return p1275_cmd(prom_callmethod_name, + return p1275_cmd("call-method", (P1275_ARG(0, P1275_ARG_IN_STRING) | P1275_ARG(2, P1275_ARG_IN_64B) | P1275_ARG(3, P1275_ARG_IN_64B) | @@ -209,13 +223,13 @@ long prom_dtlb_load(unsigned long index, int prom_map(int mode, unsigned long size, unsigned long vaddr, unsigned long paddr) { - int ret = p1275_cmd(prom_callmethod_name, + int ret = p1275_cmd("call-method", (P1275_ARG(0, P1275_ARG_IN_STRING) | P1275_ARG(3, P1275_ARG_IN_64B) | P1275_ARG(4, P1275_ARG_IN_64B) | P1275_ARG(6, P1275_ARG_IN_64B) | P1275_INOUT(7, 1)), - prom_map_name, + "map", prom_get_mmu_ihandle(), mode, size, @@ -230,12 +244,12 @@ int prom_map(int mode, unsigned long size, void prom_unmap(unsigned long size, unsigned long vaddr) { - p1275_cmd(prom_callmethod_name, + p1275_cmd("call-method", (P1275_ARG(0, P1275_ARG_IN_STRING) | P1275_ARG(2, P1275_ARG_IN_64B) | P1275_ARG(3, P1275_ARG_IN_64B) | P1275_INOUT(4, 0)), - prom_unmap_name, + "unmap", prom_get_mmu_ihandle(), size, vaddr); @@ -244,7 +258,7 @@ void prom_unmap(unsigned long size, unsigned long vaddr) /* Set aside physical memory which is not touched or modified * across soft resets. */ -unsigned long prom_retain(const char *name, +unsigned long prom_retain(char *name, unsigned long pa_low, unsigned long pa_high, long size, long align) { @@ -276,7 +290,7 @@ int prom_getunumber(int syndrome_code, unsigned long phys_addr, char *buf, int buflen) { - return p1275_cmd(prom_callmethod_name, + return p1275_cmd("call-method", (P1275_ARG(0, P1275_ARG_IN_STRING) | P1275_ARG(3, P1275_ARG_OUT_BUF) | P1275_ARG(6, P1275_ARG_IN_64B) | diff --git a/trunk/arch/sparc64/prom/p1275.c b/trunk/arch/sparc64/prom/p1275.c index a5a7c5712028..59fe38bba39e 100644 --- a/trunk/arch/sparc64/prom/p1275.c +++ b/trunk/arch/sparc64/prom/p1275.c @@ -46,7 +46,7 @@ static inline unsigned long spitfire_get_primary_context(void) */ DEFINE_SPINLOCK(prom_entry_lock); -long p1275_cmd(const char *service, long fmt, ...) +long p1275_cmd (char *service, long fmt, ...) { char *p, *q; unsigned long flags; diff --git a/trunk/arch/sparc64/prom/printf.c b/trunk/arch/sparc64/prom/printf.c index 660943ee4c2a..a6df82cafa0d 100644 --- a/trunk/arch/sparc64/prom/printf.c +++ b/trunk/arch/sparc64/prom/printf.c @@ -34,7 +34,7 @@ prom_write(const char *buf, unsigned int n) } void -prom_printf(const char *fmt, ...) +prom_printf(char *fmt, ...) { va_list args; int i; diff --git a/trunk/arch/sparc64/prom/tree.c b/trunk/arch/sparc64/prom/tree.c index b1ff9e87dcc6..ccf73258ebf7 100644 --- a/trunk/arch/sparc64/prom/tree.c +++ b/trunk/arch/sparc64/prom/tree.c @@ -69,7 +69,7 @@ prom_getsibling(int node) * Return -1 on error. */ __inline__ int -prom_getproplen(int node, const char *prop) +prom_getproplen(int node, char *prop) { if((!node) || (!prop)) return -1; return p1275_cmd ("getproplen", @@ -83,20 +83,20 @@ prom_getproplen(int node, const char *prop) * was successful the length will be returned, else -1 is returned. */ __inline__ int -prom_getproperty(int node, const char *prop, char *buffer, int bufsize) +prom_getproperty(int node, char *prop, char *buffer, int bufsize) { int plen; plen = prom_getproplen(node, prop); - if ((plen > bufsize) || (plen == 0) || (plen == -1)) { + if((plen > bufsize) || (plen == 0) || (plen == -1)) return -1; - } else { + else { /* Ok, things seem all right. */ - return p1275_cmd(prom_getprop_name, - P1275_ARG(1,P1275_ARG_IN_STRING)| - P1275_ARG(2,P1275_ARG_OUT_BUF)| - P1275_INOUT(4, 1), - node, prop, buffer, P1275_SIZE(plen)); + return p1275_cmd ("getprop", + P1275_ARG(1,P1275_ARG_IN_STRING)| + P1275_ARG(2,P1275_ARG_OUT_BUF)| + P1275_INOUT(4, 1), + node, prop, buffer, P1275_SIZE(plen)); } } @@ -104,7 +104,7 @@ prom_getproperty(int node, const char *prop, char *buffer, int bufsize) * on failure. */ __inline__ int -prom_getint(int node, const char *prop) +prom_getint(int node, char *prop) { int intprop; @@ -119,7 +119,7 @@ prom_getint(int node, const char *prop) */ int -prom_getintdefault(int node, const char *property, int deflt) +prom_getintdefault(int node, char *property, int deflt) { int retval; @@ -131,7 +131,7 @@ prom_getintdefault(int node, const char *property, int deflt) /* Acquire a boolean property, 1=TRUE 0=FALSE. */ int -prom_getbool(int node, const char *prop) +prom_getbool(int node, char *prop) { int retval; @@ -145,7 +145,7 @@ prom_getbool(int node, const char *prop) * buffer. */ void -prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size) +prom_getstring(int node, char *prop, char *user_buf, int ubuf_size) { int len; @@ -160,7 +160,7 @@ prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size) * YES = 1 NO = 0 */ int -prom_nodematch(int node, const char *name) +prom_nodematch(int node, char *name) { char namebuf[128]; prom_getproperty(node, "name", namebuf, sizeof(namebuf)); @@ -172,7 +172,7 @@ prom_nodematch(int node, const char *name) * 'nodename'. Return node if successful, zero if not. */ int -prom_searchsiblings(int node_start, const char *nodename) +prom_searchsiblings(int node_start, char *nodename) { int thisnode, error; @@ -294,7 +294,7 @@ prom_firstprop(int node, char *buffer) * property types for this node. */ __inline__ char * -prom_nextprop(int node, const char *oprop, char *buffer) +prom_nextprop(int node, char *oprop, char *buffer) { char buf[32]; @@ -314,17 +314,15 @@ prom_nextprop(int node, const char *oprop, char *buffer) } int -prom_finddevice(const char *name) +prom_finddevice(char *name) { - if (!name) - return 0; - return p1275_cmd(prom_finddev_name, - P1275_ARG(0,P1275_ARG_IN_STRING)| - P1275_INOUT(1, 1), - name); + if(!name) return 0; + return p1275_cmd ("finddevice", P1275_ARG(0,P1275_ARG_IN_STRING)| + P1275_INOUT(1, 1), + name); } -int prom_node_has_property(int node, const char *prop) +int prom_node_has_property(int node, char *prop) { char buf [32]; @@ -341,7 +339,7 @@ int prom_node_has_property(int node, const char *prop) * of 'size' bytes. Return the number of bytes the prom accepted. */ int -prom_setprop(int node, const char *pname, char *value, int size) +prom_setprop(int node, char *pname, char *value, int size) { if(size == 0) return 0; if((pname == 0) || (value == 0)) return 0; @@ -366,7 +364,7 @@ prom_inst2pkg(int inst) * FIXME: Should work for v0 as well */ int -prom_pathtoinode(const char *path) +prom_pathtoinode(char *path) { int node, inst; diff --git a/trunk/arch/um/Makefile b/trunk/arch/um/Makefile index e1ffad224605..5b5af95721ab 100644 --- a/trunk/arch/um/Makefile +++ b/trunk/arch/um/Makefile @@ -28,6 +28,8 @@ SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header)) ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \ $(SYMLINK_HEADERS) $(ARCH_DIR)/include/uml-config.h +GEN_HEADERS += $(ARCH_DIR)/include/task.h $(ARCH_DIR)/include/kern_constants.h + um-modes-$(CONFIG_MODE_TT) += tt um-modes-$(CONFIG_MODE_SKAS) += skas @@ -43,7 +45,9 @@ endif ARCH_INCLUDE := -I$(ARCH_DIR)/include ifneq ($(KBUILD_SRC),) +ARCH_INCLUDE += -I$(ARCH_DIR)/include2 ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include +MRPROPER_DIRS += $(ARCH_DIR)/include2 endif SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH) @@ -83,6 +87,10 @@ CONFIG_KERNEL_HALF_GIGS ?= 0 SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000) +ifeq ($(CONFIG_MODE_SKAS), y) +$(SYS_HEADERS) : $(ARCH_DIR)/include/skas_ptregs.h +endif + .PHONY: linux all: linux @@ -103,8 +111,7 @@ else $(shell cd $(ARCH_DIR) && ln -sf Kconfig.$(SUBARCH) Kconfig.arch) endif -archprepare: $(ARCH_SYMLINKS) $(ARCH_DIR)/include/user_constants.h -prepare: $(ARCH_DIR)/include/kern_constants.h +archprepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib @@ -139,20 +146,22 @@ endef #When cleaning we don't include .config, so we don't include #TT or skas makefiles and don't clean skas_ptregs.h. CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ - $(ARCH_DIR)/include/user_constants.h \ - $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch + $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h \ + $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/Kconfig.arch MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \ $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os archclean: + $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/util + $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/os-$(OS)/util @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ -o -name '*.gcov' \) -type f -print | xargs rm -f $(SYMLINK_HEADERS): @echo ' SYMLINK $@' ifneq ($(KBUILD_SRC),) - $(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@ + ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@ else $(Q)cd $(TOPDIR)/$(dir $@) ; \ ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@) @@ -171,7 +180,9 @@ $(ARCH_DIR)/include/sysdep: @echo ' SYMLINK $@' ifneq ($(KBUILD_SRC),) $(Q)mkdir -p $(ARCH_DIR)/include - $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep + $(Q)mkdir -p $(ARCH_DIR)/include2 + $(Q)ln -fsn sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep + $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include2/sysdep else $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep endif @@ -191,6 +202,8 @@ endef define filechk_gen-asm-offsets (set -e; \ + echo "#ifndef __ASM_OFFSETS_H__"; \ + echo "#define __ASM_OFFSETS_H__"; \ echo "/*"; \ echo " * DO NOT MODIFY."; \ echo " *"; \ @@ -199,7 +212,8 @@ define filechk_gen-asm-offsets echo " */"; \ echo ""; \ sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \ - echo ""; ) + echo ""; \ + echo "#endif" ) endef $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h @@ -208,18 +222,50 @@ $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h $(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c $(CC) $(USER_CFLAGS) -S -o $@ $< -$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s +$(ARCH_DIR)/user-offsets.h: $(ARCH_DIR)/user-offsets.s $(call filechk,gen-asm-offsets) -CLEAN_FILES += $(ARCH_DIR)/user-offsets.s +CLEAN_FILES += $(ARCH_DIR)/user-offsets.s $(ARCH_DIR)/user-offsets.h $(ARCH_DIR)/kernel-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/kernel-offsets.c \ - archprepare + $(ARCH_SYMLINKS) \ + $(SYS_DIR)/sc.h \ + include/asm include/linux/version.h \ + include/config/MARKER \ + $(ARCH_DIR)/include/user_constants.h $(CC) $(CFLAGS) $(NOSTDINC_FLAGS) $(CPPFLAGS) -S -o $@ $< -$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/kernel-offsets.s +$(ARCH_DIR)/kernel-offsets.h: $(ARCH_DIR)/kernel-offsets.s $(call filechk,gen-asm-offsets) -CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s +CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s $(ARCH_DIR)/kernel-offsets.h + +$(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task + $(call filechk,gen_header) + +$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/os-$(OS)/util/mk_user_constants + $(call filechk,gen_header) + +$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants + $(call filechk,gen_header) + +$(ARCH_DIR)/include/skas_ptregs.h: $(ARCH_DIR)/kernel/skas/util/mk_ptregs + $(call filechk,gen_header) + +$(ARCH_DIR)/os-$(OS)/util/mk_user_constants: $(ARCH_DIR)/os-$(OS)/util FORCE ; + +$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants: $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/util \ + FORCE ; + +$(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ; + +$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h $(ARCH_DIR)/kernel-offsets.h FORCE + $(Q)$(MAKE) $(build)=$@ + +$(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE + $(Q)$(MAKE) $(build)=$@ + +$(ARCH_DIR)/os-$(OS)/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE + $(Q)$(MAKE) $(build)=$@ export SUBARCH USER_CFLAGS OS diff --git a/trunk/arch/um/Makefile-i386 b/trunk/arch/um/Makefile-i386 index 2ee8a2858117..1ab431a53ac3 100644 --- a/trunk/arch/um/Makefile-i386 +++ b/trunk/arch/um/Makefile-i386 @@ -32,3 +32,25 @@ CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) ifneq ($(CONFIG_GPROF),y) ARCH_CFLAGS += -DUM_FASTCALL endif + +SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util +SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h + +prepare: $(SYS_HEADERS) + +$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc + $(call filechk,gen_header) + +$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread + $(call filechk,gen_header) + +$(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE + $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ + +$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_DIR)/kernel-offsets.h FORCE + $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ + +$(SYS_UTIL_DIR): scripts_basic include/asm FORCE + $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) + +CLEAN_FILES += $(SYS_HEADERS) diff --git a/trunk/arch/um/Makefile-skas b/trunk/arch/um/Makefile-skas index ac35de5316a6..fd18ec572271 100644 --- a/trunk/arch/um/Makefile-skas +++ b/trunk/arch/um/Makefile-skas @@ -10,3 +10,5 @@ CFLAGS-$(CONFIG_GCOV) += $(GCOV_OPT) CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT) LINK-$(CONFIG_GCOV) += $(GCOV_OPT) LINK-$(CONFIG_GPROF) += $(GPROF_OPT) + +GEN_HEADERS += $(ARCH_DIR)/include/skas_ptregs.h diff --git a/trunk/arch/um/Makefile-x86_64 b/trunk/arch/um/Makefile-x86_64 index 4f118d5cc2ee..436abbba409b 100644 --- a/trunk/arch/um/Makefile-x86_64 +++ b/trunk/arch/um/Makefile-x86_64 @@ -12,3 +12,24 @@ CHECKFLAGS += -m64 ELF_ARCH := i386:x86-64 ELF_FORMAT := elf64-x86-64 + +SYS_UTIL_DIR := $(ARCH_DIR)/sys-x86_64/util +SYS_DIR := $(ARCH_DIR)/include/sysdep-x86_64 + +SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h + +prepare: $(SYS_HEADERS) + +$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc + $(call filechk,gen_header) + +$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread + $(call filechk,gen_header) + +$(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE + $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ + +$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(GEN_HEADERS) $(ARCH_DIR)/kernel-offsets.h FORCE + $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ + +CLEAN_FILES += $(SYS_HEADERS) diff --git a/trunk/arch/um/drivers/Makefile b/trunk/arch/um/drivers/Makefile index de17d4c6e02d..783e18cae090 100644 --- a/trunk/arch/um/drivers/Makefile +++ b/trunk/arch/um/drivers/Makefile @@ -13,7 +13,7 @@ mcast-objs := mcast_kern.o mcast_user.o net-objs := net_kern.o net_user.o mconsole-objs := mconsole_kern.o mconsole_user.o hostaudio-objs := hostaudio_kern.o -ubd-objs := ubd_kern.o ubd_user.o +ubd-objs := ubd_kern.o port-objs := port_kern.o port_user.o harddog-objs := harddog_kern.o harddog_user.o diff --git a/trunk/arch/um/drivers/cow.h b/trunk/arch/um/drivers/cow.h index dc36b222100b..4fcf3a8d13f4 100644 --- a/trunk/arch/um/drivers/cow.h +++ b/trunk/arch/um/drivers/cow.h @@ -3,40 +3,15 @@ #include -#if defined(__KERNEL__) - -# include - -# if defined(__BIG_ENDIAN) -# define ntohll(x) (x) -# define htonll(x) (x) -# elif defined(__LITTLE_ENDIAN) -# define ntohll(x) be64_to_cpu(x) -# define htonll(x) cpu_to_be64(x) -# else -# error "Could not determine byte order" -# endif - +#if defined(__BIG_ENDIAN) +# define ntohll(x) (x) +# define htonll(x) (x) +#elif defined(__LITTLE_ENDIAN) +# define ntohll(x) bswap_64(x) +# define htonll(x) bswap_64(x) #else -/* For the definition of ntohl, htonl and __BYTE_ORDER */ -#include -#include -#if defined(__BYTE_ORDER) - -# if __BYTE_ORDER == __BIG_ENDIAN -# define ntohll(x) (x) -# define htonll(x) (x) -# elif __BYTE_ORDER == __LITTLE_ENDIAN -# define ntohll(x) bswap_64(x) -# define htonll(x) bswap_64(x) -# else -# error "Could not determine byte order: __BYTE_ORDER uncorrectly defined" -# endif - -#else /* ! defined(__BYTE_ORDER) */ -# error "Could not determine byte order: __BYTE_ORDER not defined" +#error "__BYTE_ORDER not defined" #endif -#endif /* ! defined(__KERNEL__) */ extern int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize, int alignment, int *bitmap_offset_out, diff --git a/trunk/arch/um/drivers/cow_user.c b/trunk/arch/um/drivers/cow_user.c index fbe2217db5dd..a8ce6fc3ef26 100644 --- a/trunk/arch/um/drivers/cow_user.c +++ b/trunk/arch/um/drivers/cow_user.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "os.h" diff --git a/trunk/arch/um/drivers/mconsole_user.c b/trunk/arch/um/drivers/mconsole_user.c index 310c1f823f26..04383f98f4d5 100644 --- a/trunk/arch/um/drivers/mconsole_user.c +++ b/trunk/arch/um/drivers/mconsole_user.c @@ -23,7 +23,7 @@ static struct mconsole_command commands[] = { { "reboot", mconsole_reboot, MCONSOLE_PROC }, { "config", mconsole_config, MCONSOLE_PROC }, { "remove", mconsole_remove, MCONSOLE_PROC }, - { "sysrq", mconsole_sysrq, MCONSOLE_INTR }, + { "sysrq", mconsole_sysrq, MCONSOLE_PROC }, { "help", mconsole_help, MCONSOLE_INTR }, { "cad", mconsole_cad, MCONSOLE_INTR }, { "stop", mconsole_stop, MCONSOLE_PROC }, diff --git a/trunk/arch/um/drivers/port_kern.c b/trunk/arch/um/drivers/port_kern.c index 189839e4f1d4..c41efd207fcc 100644 --- a/trunk/arch/um/drivers/port_kern.c +++ b/trunk/arch/um/drivers/port_kern.c @@ -7,6 +7,7 @@ #include "linux/sched.h" #include "linux/slab.h" #include "linux/interrupt.h" +#include "linux/irq.h" #include "linux/spinlock.h" #include "linux/errno.h" #include "asm/atomic.h" diff --git a/trunk/arch/um/drivers/ubd_kern.c b/trunk/arch/um/drivers/ubd_kern.c index f73134333f64..e77a38da4350 100644 --- a/trunk/arch/um/drivers/ubd_kern.c +++ b/trunk/arch/um/drivers/ubd_kern.c @@ -35,6 +35,7 @@ #include "linux/blkpg.h" #include "linux/genhd.h" #include "linux/spinlock.h" +#include "asm/atomic.h" #include "asm/segment.h" #include "asm/uaccess.h" #include "asm/irq.h" @@ -53,20 +54,21 @@ #include "mem.h" #include "mem_kern.h" #include "cow.h" +#include "aio.h" enum ubd_req { UBD_READ, UBD_WRITE }; struct io_thread_req { - enum ubd_req op; + enum aio_type op; int fds[2]; unsigned long offsets[2]; unsigned long long offset; unsigned long length; char *buffer; int sectorsize; - unsigned long sector_mask; - unsigned long long cow_offset; - unsigned long bitmap_words[2]; + int bitmap_offset; + long bitmap_start; + long bitmap_end; int error; }; @@ -80,28 +82,31 @@ extern int create_cow_file(char *cow_file, char *backing_file, unsigned long *bitmap_len_out, int *data_offset_out); extern int read_cow_bitmap(int fd, void *buf, int offset, int len); -extern void do_io(struct io_thread_req *req); +extern void do_io(struct io_thread_req *req, struct request *r, + unsigned long *bitmap); -static inline int ubd_test_bit(__u64 bit, unsigned char *data) +static inline int ubd_test_bit(__u64 bit, void *data) { + unsigned char *buffer = data; __u64 n; int bits, off; - bits = sizeof(data[0]) * 8; + bits = sizeof(buffer[0]) * 8; n = bit / bits; off = bit % bits; - return((data[n] & (1 << off)) != 0); + return((buffer[n] & (1 << off)) != 0); } -static inline void ubd_set_bit(__u64 bit, unsigned char *data) +static inline void ubd_set_bit(__u64 bit, void *data) { + unsigned char *buffer = data; __u64 n; int bits, off; - bits = sizeof(data[0]) * 8; + bits = sizeof(buffer[0]) * 8; n = bit / bits; off = bit % bits; - data[n] |= (1 << off); + buffer[n] |= (1 << off); } /*End stuff from ubd_user.h*/ @@ -110,8 +115,6 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data) static DEFINE_SPINLOCK(ubd_io_lock); static DEFINE_SPINLOCK(ubd_lock); -static void (*do_ubd)(void); - static int ubd_open(struct inode * inode, struct file * filp); static int ubd_release(struct inode * inode, struct file * file); static int ubd_ioctl(struct inode * inode, struct file * file, @@ -158,6 +161,8 @@ struct cow { int data_offset; }; +#define MAX_SG 64 + struct ubd { char *file; int count; @@ -168,6 +173,7 @@ struct ubd { int no_cow; struct cow cow; struct platform_device pdev; + struct scatterlist sg[MAX_SG]; }; #define DEFAULT_COW { \ @@ -460,80 +466,113 @@ __uml_help(fakehd, ); static void do_ubd_request(request_queue_t * q); - -/* Only changed by ubd_init, which is an initcall. */ -int thread_fd = -1; +static int in_ubd; /* Changed by ubd_handler, which is serialized because interrupts only * happen on CPU 0. */ int intr_count = 0; -/* call ubd_finish if you need to serialize */ -static void __ubd_finish(struct request *req, int error) +static void ubd_end_request(struct request *req, int bytes, int uptodate) { - int nsect; - - if(error){ - end_request(req, 0); - return; + if (!end_that_request_first(req, uptodate, bytes >> 9)) { + add_disk_randomness(req->rq_disk); + end_that_request_last(req); } - nsect = req->current_nr_sectors; - req->sector += nsect; - req->buffer += nsect << 9; - req->errors = 0; - req->nr_sectors -= nsect; - req->current_nr_sectors = 0; - end_request(req, 1); } -static inline void ubd_finish(struct request *req, int error) +/* call ubd_finish if you need to serialize */ +static void __ubd_finish(struct request *req, int bytes) { - spin_lock(&ubd_io_lock); - __ubd_finish(req, error); - spin_unlock(&ubd_io_lock); + if(bytes < 0){ + ubd_end_request(req, 0, 0); + return; + } + + ubd_end_request(req, bytes, 1); } -/* Called without ubd_io_lock held */ -static void ubd_handler(void) +static inline void ubd_finish(struct request *req, int bytes) { - struct io_thread_req req; - struct request *rq = elv_next_request(ubd_queue); - int n; - - do_ubd = NULL; - intr_count++; - n = os_read_file(thread_fd, &req, sizeof(req)); - if(n != sizeof(req)){ - printk(KERN_ERR "Pid %d - spurious interrupt in ubd_handler, " - "err = %d\n", os_getpid(), -n); - spin_lock(&ubd_io_lock); - end_request(rq, 0); - spin_unlock(&ubd_io_lock); - return; - } - - ubd_finish(rq, req.error); - reactivate_fd(thread_fd, UBD_IRQ); - do_ubd_request(ubd_queue); + spin_lock(&ubd_io_lock); + __ubd_finish(req, bytes); + spin_unlock(&ubd_io_lock); } +struct bitmap_io { + atomic_t count; + struct aio_context aio; +}; + +struct ubd_aio { + struct aio_context aio; + struct request *req; + int len; + struct bitmap_io *bitmap; + void *bitmap_buf; +}; + +static int ubd_reply_fd = -1; + static irqreturn_t ubd_intr(int irq, void *dev, struct pt_regs *unused) { - ubd_handler(); - return(IRQ_HANDLED); -} + struct aio_thread_reply reply; + struct ubd_aio *aio; + struct request *req; + int err, n, fd = (int) (long) dev; -/* Only changed by ubd_init, which is an initcall. */ -static int io_pid = -1; + while(1){ + err = os_read_file(fd, &reply, sizeof(reply)); + if(err == -EAGAIN) + break; + if(err < 0){ + printk("ubd_aio_handler - read returned err %d\n", + -err); + break; + } -void kill_io_thread(void) -{ - if(io_pid != -1) - os_kill_process(io_pid, 1); -} + aio = container_of(reply.data, struct ubd_aio, aio); + n = reply.err; + + if(n == 0){ + req = aio->req; + req->nr_sectors -= aio->len >> 9; -__uml_exitcall(kill_io_thread); + if((aio->bitmap != NULL) && + (atomic_dec_and_test(&aio->bitmap->count))){ + aio->aio = aio->bitmap->aio; + aio->len = 0; + kfree(aio->bitmap); + aio->bitmap = NULL; + submit_aio(&aio->aio); + } + else { + if((req->nr_sectors == 0) && + (aio->bitmap == NULL)){ + int len = req->hard_nr_sectors << 9; + ubd_finish(req, len); + } + + if(aio->bitmap_buf != NULL) + kfree(aio->bitmap_buf); + kfree(aio); + } + } + else if(n < 0){ + ubd_finish(aio->req, n); + if(aio->bitmap != NULL) + kfree(aio->bitmap); + if(aio->bitmap_buf != NULL) + kfree(aio->bitmap_buf); + kfree(aio); + } + } + reactivate_fd(fd, UBD_IRQ); + + do_ubd_request(ubd_queue); + + return(IRQ_HANDLED); +} static int ubd_file_size(struct ubd *dev, __u64 *size_out) { @@ -569,7 +608,7 @@ static int ubd_open_dev(struct ubd *dev) &dev->cow.data_offset, create_ptr); if((dev->fd == -ENOENT) && create_cow){ - dev->fd = create_cow_file(dev->file, dev->cow.file, + dev->fd = create_cow_file(dev->file, dev->cow.file, dev->openflags, 1 << 9, PAGE_SIZE, &dev->cow.bitmap_offset, &dev->cow.bitmap_len, @@ -831,6 +870,10 @@ int ubd_init(void) { int i; + ubd_reply_fd = init_aio_irq(UBD_IRQ, "ubd", ubd_intr); + if(ubd_reply_fd < 0) + printk("Setting up ubd AIO failed, err = %d\n", ubd_reply_fd); + devfs_mk_dir("ubd"); if (register_blkdev(MAJOR_NR, "ubd")) return -1; @@ -841,6 +884,7 @@ int ubd_init(void) return -1; } + blk_queue_max_hw_segments(ubd_queue, MAX_SG); if (fake_major != MAJOR_NR) { char name[sizeof("ubd_nnn\0")]; @@ -852,40 +896,12 @@ int ubd_init(void) driver_register(&ubd_driver); for (i = 0; i < MAX_DEV; i++) ubd_add(i); + return 0; } late_initcall(ubd_init); -int ubd_driver_init(void){ - unsigned long stack; - int err; - - /* Set by CONFIG_BLK_DEV_UBD_SYNC or ubd=sync.*/ - if(global_openflags.s){ - printk(KERN_INFO "ubd: Synchronous mode\n"); - /* Letting ubd=sync be like using ubd#s= instead of ubd#= is - * enough. So use anyway the io thread. */ - } - stack = alloc_stack(0, 0); - io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *), - &thread_fd); - if(io_pid < 0){ - printk(KERN_ERR - "ubd : Failed to start I/O thread (errno = %d) - " - "falling back to synchronous I/O\n", -io_pid); - io_pid = -1; - return(0); - } - err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr, - SA_INTERRUPT, "ubd", ubd_dev); - if(err != 0) - printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err); - return(err); -} - -device_initcall(ubd_driver_init); - static int ubd_open(struct inode *inode, struct file *filp) { struct gendisk *disk = inode->i_bdev->bd_disk; @@ -923,105 +939,55 @@ static int ubd_release(struct inode * inode, struct file * file) return(0); } -static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask, - __u64 *cow_offset, unsigned long *bitmap, - __u64 bitmap_offset, unsigned long *bitmap_words, - __u64 bitmap_len) +static void cowify_bitmap(struct io_thread_req *req, unsigned long *bitmap) { - __u64 sector = io_offset >> 9; - int i, update_bitmap = 0; - - for(i = 0; i < length >> 9; i++){ - if(cow_mask != NULL) - ubd_set_bit(i, (unsigned char *) cow_mask); - if(ubd_test_bit(sector + i, (unsigned char *) bitmap)) - continue; - - update_bitmap = 1; - ubd_set_bit(sector + i, (unsigned char *) bitmap); - } - - if(!update_bitmap) - return; - - *cow_offset = sector / (sizeof(unsigned long) * 8); - - /* This takes care of the case where we're exactly at the end of the - * device, and *cow_offset + 1 is off the end. So, just back it up - * by one word. Thanks to Lynn Kerby for the fix and James McMechan - * for the original diagnosis. - */ - if(*cow_offset == ((bitmap_len + sizeof(unsigned long) - 1) / - sizeof(unsigned long) - 1)) - (*cow_offset)--; - - bitmap_words[0] = bitmap[*cow_offset]; - bitmap_words[1] = bitmap[*cow_offset + 1]; - - *cow_offset *= sizeof(unsigned long); - *cow_offset += bitmap_offset; -} + __u64 sector = req->offset / req->sectorsize; + int i; -static void cowify_req(struct io_thread_req *req, unsigned long *bitmap, - __u64 bitmap_offset, __u64 bitmap_len) -{ - __u64 sector = req->offset >> 9; - int i; + for(i = 0; i < req->length / req->sectorsize; i++){ + if(ubd_test_bit(sector + i, bitmap)) + continue; - if(req->length > (sizeof(req->sector_mask) * 8) << 9) - panic("Operation too long"); + if(req->bitmap_start == -1) + req->bitmap_start = sector + i; + req->bitmap_end = sector + i + 1; - if(req->op == UBD_READ) { - for(i = 0; i < req->length >> 9; i++){ - if(ubd_test_bit(sector + i, (unsigned char *) bitmap)) - ubd_set_bit(i, (unsigned char *) - &req->sector_mask); - } - } - else cowify_bitmap(req->offset, req->length, &req->sector_mask, - &req->cow_offset, bitmap, bitmap_offset, - req->bitmap_words, bitmap_len); + ubd_set_bit(sector + i, bitmap); + } } /* Called with ubd_io_lock held */ -static int prepare_request(struct request *req, struct io_thread_req *io_req) +static int prepare_request(struct request *req, struct io_thread_req *io_req, + unsigned long long offset, int page_offset, + int len, struct page *page) { struct gendisk *disk = req->rq_disk; struct ubd *dev = disk->private_data; - __u64 offset; - int len; - - if(req->rq_status == RQ_INACTIVE) return(1); /* This should be impossible now */ if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ printk("Write attempted on readonly ubd device %s\n", disk->disk_name); - end_request(req, 0); + ubd_end_request(req, 0, 0); return(1); } - offset = ((__u64) req->sector) << 9; - len = req->current_nr_sectors << 9; - io_req->fds[0] = (dev->cow.file != NULL) ? dev->cow.fd : dev->fd; io_req->fds[1] = dev->fd; - io_req->cow_offset = -1; io_req->offset = offset; io_req->length = len; io_req->error = 0; - io_req->sector_mask = 0; - - io_req->op = (rq_data_dir(req) == READ) ? UBD_READ : UBD_WRITE; + io_req->op = (rq_data_dir(req) == READ) ? AIO_READ : AIO_WRITE; io_req->offsets[0] = 0; io_req->offsets[1] = dev->cow.data_offset; - io_req->buffer = req->buffer; + io_req->buffer = page_address(page) + page_offset; io_req->sectorsize = 1 << 9; + io_req->bitmap_offset = dev->cow.bitmap_offset; + io_req->bitmap_start = -1; + io_req->bitmap_end = -1; - if(dev->cow.file != NULL) - cowify_req(io_req, dev->cow.bitmap, dev->cow.bitmap_offset, - dev->cow.bitmap_len); - + if((dev->cow.file != NULL) && (io_req->op == UBD_WRITE)) + cowify_bitmap(io_req, dev->cow.bitmap); return(0); } @@ -1030,30 +996,36 @@ static void do_ubd_request(request_queue_t *q) { struct io_thread_req io_req; struct request *req; - int err, n; - - if(thread_fd == -1){ - while((req = elv_next_request(q)) != NULL){ - err = prepare_request(req, &io_req); - if(!err){ - do_io(&io_req); - __ubd_finish(req, io_req.error); - } - } - } - else { - if(do_ubd || (req = elv_next_request(q)) == NULL) - return; - err = prepare_request(req, &io_req); - if(!err){ - do_ubd = ubd_handler; - n = os_write_file(thread_fd, (char *) &io_req, - sizeof(io_req)); - if(n != sizeof(io_req)) - printk("write to io thread failed, " - "errno = %d\n", -n); + __u64 sector; + int err; + + if(in_ubd) + return; + in_ubd = 1; + while((req = elv_next_request(q)) != NULL){ + struct gendisk *disk = req->rq_disk; + struct ubd *dev = disk->private_data; + int n, i; + + blkdev_dequeue_request(req); + + sector = req->sector; + n = blk_rq_map_sg(q, req, dev->sg); + + for(i = 0; i < n; i++){ + struct scatterlist *sg = &dev->sg[i]; + + err = prepare_request(req, &io_req, sector << 9, + sg->offset, sg->length, + sg->page); + if(err) + continue; + + sector += sg->length >> 9; + do_io(&io_req, req, dev->cow.bitmap); } } + in_ubd = 0; } static int ubd_ioctl(struct inode * inode, struct file * file, @@ -1269,131 +1241,95 @@ int create_cow_file(char *cow_file, char *backing_file, struct openflags flags, return(err); } -static int update_bitmap(struct io_thread_req *req) +void do_io(struct io_thread_req *req, struct request *r, unsigned long *bitmap) { - int n; - - if(req->cow_offset == -1) - return(0); - - n = os_seek_file(req->fds[1], req->cow_offset); - if(n < 0){ - printk("do_io - bitmap lseek failed : err = %d\n", -n); - return(1); - } - - n = os_write_file(req->fds[1], &req->bitmap_words, - sizeof(req->bitmap_words)); - if(n != sizeof(req->bitmap_words)){ - printk("do_io - bitmap update failed, err = %d fd = %d\n", -n, - req->fds[1]); - return(1); - } - - return(0); -} - -void do_io(struct io_thread_req *req) -{ - char *buf; - unsigned long len; - int n, nsectors, start, end, bit; - int err; - __u64 off; - - nsectors = req->length / req->sectorsize; - start = 0; - do { - bit = ubd_test_bit(start, (unsigned char *) &req->sector_mask); - end = start; - while((end < nsectors) && - (ubd_test_bit(end, (unsigned char *) - &req->sector_mask) == bit)) - end++; - - off = req->offset + req->offsets[bit] + - start * req->sectorsize; - len = (end - start) * req->sectorsize; - buf = &req->buffer[start * req->sectorsize]; - - err = os_seek_file(req->fds[bit], off); - if(err < 0){ - printk("do_io - lseek failed : err = %d\n", -err); - req->error = 1; - return; - } - if(req->op == UBD_READ){ - n = 0; - do { - buf = &buf[n]; - len -= n; - n = os_read_file(req->fds[bit], buf, len); - if (n < 0) { - printk("do_io - read failed, err = %d " - "fd = %d\n", -n, req->fds[bit]); - req->error = 1; - return; - } - } while((n < len) && (n != 0)); - if (n < len) memset(&buf[n], 0, len - n); - } else { - n = os_write_file(req->fds[bit], buf, len); - if(n != len){ - printk("do_io - write failed err = %d " - "fd = %d\n", -n, req->fds[bit]); - req->error = 1; - return; - } - } + struct ubd_aio *aio; + struct bitmap_io *bitmap_io = NULL; + char *buf; + void *bitmap_buf = NULL; + unsigned long len, sector; + int nsectors, start, end, bit, err; + __u64 off; + + if(req->bitmap_start != -1){ + /* Round up to the nearest word */ + int round = sizeof(unsigned long); + len = (req->bitmap_end - req->bitmap_start + + round * 8 - 1) / (round * 8); + len *= round; + + off = req->bitmap_start / (8 * round); + off *= round; + + bitmap_io = kmalloc(sizeof(*bitmap_io), GFP_KERNEL); + if(bitmap_io == NULL){ + printk("Failed to kmalloc bitmap IO\n"); + req->error = 1; + return; + } - start = end; - } while(start < nsectors); + bitmap_buf = kmalloc(len, GFP_KERNEL); + if(bitmap_buf == NULL){ + printk("do_io : kmalloc of bitmap chunk " + "failed\n"); + kfree(bitmap_io); + req->error = 1; + return; + } + memcpy(bitmap_buf, &bitmap[off / sizeof(bitmap[0])], len); + + *bitmap_io = ((struct bitmap_io) + { .count = ATOMIC_INIT(0), + .aio = INIT_AIO(AIO_WRITE, req->fds[1], + bitmap_buf, len, + req->bitmap_offset + off, + ubd_reply_fd) } ); + } - req->error = update_bitmap(req); -} + nsectors = req->length / req->sectorsize; + start = 0; + end = nsectors; + bit = 0; + do { + if(bitmap != NULL){ + sector = req->offset / req->sectorsize; + bit = ubd_test_bit(sector + start, bitmap); + end = start; + while((end < nsectors) && + (ubd_test_bit(sector + end, bitmap) == bit)) + end++; + } -/* Changed in start_io_thread, which is serialized by being called only - * from ubd_init, which is an initcall. - */ -int kernel_fd = -1; + off = req->offsets[bit] + req->offset + + start * req->sectorsize; + len = (end - start) * req->sectorsize; + buf = &req->buffer[start * req->sectorsize]; -/* Only changed by the io thread */ -int io_count = 0; + aio = kmalloc(sizeof(*aio), GFP_KERNEL); + if(aio == NULL){ + req->error = 1; + return; + } -int io_thread(void *arg) -{ - struct io_thread_req req; - int n; + *aio = ((struct ubd_aio) + { .aio = INIT_AIO(req->op, req->fds[bit], buf, + len, off, ubd_reply_fd), + .len = len, + .req = r, + .bitmap = bitmap_io, + .bitmap_buf = bitmap_buf }); + + if(aio->bitmap != NULL) + atomic_inc(&aio->bitmap->count); + + err = submit_aio(&aio->aio); + if(err){ + printk("do_io - submit_aio failed, " + "err = %d\n", err); + req->error = 1; + return; + } - ignore_sigwinch_sig(); - while(1){ - n = os_read_file(kernel_fd, &req, sizeof(req)); - if(n != sizeof(req)){ - if(n < 0) - printk("io_thread - read failed, fd = %d, " - "err = %d\n", kernel_fd, -n); - else { - printk("io_thread - short read, fd = %d, " - "length = %d\n", kernel_fd, n); - } - continue; - } - io_count++; - do_io(&req); - n = os_write_file(kernel_fd, &req, sizeof(req)); - if(n != sizeof(req)) - printk("io_thread - write failed, fd = %d, err = %d\n", - kernel_fd, -n); - } + start = end; + } while(start < nsectors); } - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/trunk/arch/um/drivers/ubd_user.c b/trunk/arch/um/drivers/ubd_user.c deleted file mode 100644 index b94d2bc4fe06..000000000000 --- a/trunk/arch/um/drivers/ubd_user.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) - * Copyright (C) 2001 Ridgerun,Inc (glonnon@ridgerun.com) - * Licensed under the GPL - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "asm/types.h" -#include "user_util.h" -#include "kern_util.h" -#include "user.h" -#include "ubd_user.h" -#include "os.h" -#include "cow.h" - -#include -#include - -void ignore_sigwinch_sig(void) -{ - signal(SIGWINCH, SIG_IGN); -} - -int start_io_thread(unsigned long sp, int *fd_out) -{ - int pid, fds[2], err; - - err = os_pipe(fds, 1, 1); - if(err < 0){ - printk("start_io_thread - os_pipe failed, err = %d\n", -err); - goto out; - } - - kernel_fd = fds[0]; - *fd_out = fds[1]; - - pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD, - NULL); - if(pid < 0){ - printk("start_io_thread - clone failed : errno = %d\n", errno); - err = -errno; - goto out_close; - } - - return(pid); - - out_close: - os_close_file(fds[0]); - os_close_file(fds[1]); - kernel_fd = -1; - *fd_out = -1; - out: - return(err); -} - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/trunk/arch/um/include/aio.h b/trunk/arch/um/include/aio.h index 423bae9153f8..83f16877ab08 100644 --- a/trunk/arch/um/include/aio.h +++ b/trunk/arch/um/include/aio.h @@ -14,15 +14,27 @@ struct aio_thread_reply { }; struct aio_context { + enum aio_type type; + int fd; + void *data; + int len; + unsigned long long offset; int reply_fd; struct aio_context *next; }; +#define INIT_AIO(aio_type, aio_fd, aio_data, aio_len, aio_offset, \ + aio_reply_fd) \ + { .type = aio_type, \ + .fd = aio_fd, \ + .data = aio_data, \ + .len = aio_len, \ + .offset = aio_offset, \ + .reply_fd = aio_reply_fd } + #define INIT_AIO_CONTEXT { .reply_fd = -1, \ .next = NULL } -extern int submit_aio(enum aio_type type, int fd, char *buf, int len, - unsigned long long offset, int reply_fd, - struct aio_context *aio); +extern int submit_aio(struct aio_context *aio); #endif diff --git a/trunk/arch/um/include/common-offsets.h b/trunk/arch/um/include/common-offsets.h index 356390d1f8b9..782ac3a3baf9 100644 --- a/trunk/arch/um/include/common-offsets.h +++ b/trunk/arch/um/include/common-offsets.h @@ -1,7 +1,7 @@ /* for use by sys-$SUBARCH/kernel-offsets.c */ -OFFSET(HOST_TASK_REGS, task_struct, thread.regs); -OFFSET(HOST_TASK_PID, task_struct, pid); +OFFSET(TASK_REGS, task_struct, thread.regs); +OFFSET(TASK_PID, task_struct, pid); DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); diff --git a/trunk/arch/um/include/os.h b/trunk/arch/um/include/os.h index 2e58e304b8be..583329d0a539 100644 --- a/trunk/arch/um/include/os.h +++ b/trunk/arch/um/include/os.h @@ -6,7 +6,6 @@ #ifndef __OS_H__ #define __OS_H__ -#include "uml-config.h" #include "asm/types.h" #include "../os/include/file.h" @@ -158,14 +157,6 @@ extern int os_lock_file(int fd, int excl); extern void os_early_checks(void); extern int can_do_skas(void); -/* Make sure they are clear when running in TT mode. Required by - * SEGV_MAYBE_FIXABLE */ -#ifdef UML_CONFIG_MODE_SKAS -#define clear_can_do_skas() do { ptrace_faultinfo = proc_mm = 0; } while (0) -#else -#define clear_can_do_skas() do {} while (0) -#endif - /* mem.c */ extern int create_mem_file(unsigned long len); diff --git a/trunk/arch/um/include/registers.h b/trunk/arch/um/include/registers.h index 4892e5fcef07..0a35e6d0baa0 100644 --- a/trunk/arch/um/include/registers.h +++ b/trunk/arch/um/include/registers.h @@ -15,6 +15,16 @@ extern void save_registers(int pid, union uml_pt_regs *regs); extern void restore_registers(int pid, union uml_pt_regs *regs); extern void init_registers(int pid); extern void get_safe_registers(unsigned long * regs); -extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer); #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/include/skas_ptregs.h b/trunk/arch/um/include/skas_ptregs.h deleted file mode 100644 index 73db19e9c077..000000000000 --- a/trunk/arch/um/include/skas_ptregs.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __SKAS_PT_REGS_ -#define __SKAS_PT_REGS_ - -#include - -#endif diff --git a/trunk/arch/um/include/sysdep-i386/sc.h b/trunk/arch/um/include/sysdep-i386/sc.h deleted file mode 100644 index c57d1780ad37..000000000000 --- a/trunk/arch/um/include/sysdep-i386/sc.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __SYSDEP_I386_SC_H -#define __SYSDEP_I386_SC_H - -#include - -#define SC_OFFSET(sc, field) \ - *((unsigned long *) &(((char *) (sc))[HOST_##field])) -#define SC_FP_OFFSET(sc, field) \ - *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field])) -#define SC_FP_OFFSET_PTR(sc, field, type) \ - ((type *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field])) - -#define SC_IP(sc) SC_OFFSET(sc, SC_IP) -#define SC_SP(sc) SC_OFFSET(sc, SC_SP) -#define SC_FS(sc) SC_OFFSET(sc, SC_FS) -#define SC_GS(sc) SC_OFFSET(sc, SC_GS) -#define SC_DS(sc) SC_OFFSET(sc, SC_DS) -#define SC_ES(sc) SC_OFFSET(sc, SC_ES) -#define SC_SS(sc) SC_OFFSET(sc, SC_SS) -#define SC_CS(sc) SC_OFFSET(sc, SC_CS) -#define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS) -#define SC_EAX(sc) SC_OFFSET(sc, SC_EAX) -#define SC_EBX(sc) SC_OFFSET(sc, SC_EBX) -#define SC_ECX(sc) SC_OFFSET(sc, SC_ECX) -#define SC_EDX(sc) SC_OFFSET(sc, SC_EDX) -#define SC_EDI(sc) SC_OFFSET(sc, SC_EDI) -#define SC_ESI(sc) SC_OFFSET(sc, SC_ESI) -#define SC_EBP(sc) SC_OFFSET(sc, SC_EBP) -#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO) -#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR) -#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2) -#define SC_FPSTATE(sc) SC_OFFSET(sc, SC_FPSTATE) -#define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK) -#define SC_FP_CW(sc) SC_FP_OFFSET(sc, SC_FP_CW) -#define SC_FP_SW(sc) SC_FP_OFFSET(sc, SC_FP_SW) -#define SC_FP_TAG(sc) SC_FP_OFFSET(sc, SC_FP_TAG) -#define SC_FP_IPOFF(sc) SC_FP_OFFSET(sc, SC_FP_IPOFF) -#define SC_FP_CSSEL(sc) SC_FP_OFFSET(sc, SC_FP_CSSEL) -#define SC_FP_DATAOFF(sc) SC_FP_OFFSET(sc, SC_FP_DATAOFF) -#define SC_FP_DATASEL(sc) SC_FP_OFFSET(sc, SC_FP_DATASEL) -#define SC_FP_ST(sc) SC_FP_OFFSET_PTR(sc, SC_FP_ST, struct _fpstate) -#define SC_FXSR_ENV(sc) SC_FP_OFFSET_PTR(sc, SC_FXSR_ENV, void) - -#endif diff --git a/trunk/arch/um/include/sysdep-i386/sigcontext.h b/trunk/arch/um/include/sysdep-i386/sigcontext.h index 23fd2644d7ed..1fe729265167 100644 --- a/trunk/arch/um/include/sysdep-i386/sigcontext.h +++ b/trunk/arch/um/include/sysdep-i386/sigcontext.h @@ -6,7 +6,6 @@ #ifndef __SYS_SIGCONTEXT_I386_H #define __SYS_SIGCONTEXT_I386_H -#include "uml-config.h" #include #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) @@ -27,14 +26,7 @@ #define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0) /* This is Page Fault */ -#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) - -/* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */ -#ifdef UML_CONFIG_MODE_SKAS -#define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo) -#else -#define SEGV_MAYBE_FIXABLE(fi) 0 -#endif +#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) extern unsigned long *sc_sigmask(void *sc_ptr); extern int sc_get_fpregs(unsigned long buf, void *sc_ptr); diff --git a/trunk/arch/um/include/sysdep-i386/thread.h b/trunk/arch/um/include/sysdep-i386/thread.h deleted file mode 100644 index e2bd6bae8b8a..000000000000 --- a/trunk/arch/um/include/sysdep-i386/thread.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __UM_THREAD_H -#define __UM_THREAD_H - -#include - -#define TASK_DEBUGREGS(task) ((unsigned long *) &(((char *) (task))[HOST_TASK_DEBUGREGS])) -#ifdef CONFIG_MODE_TT -#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID])) -#endif - -#endif diff --git a/trunk/arch/um/include/sysdep-x86_64/ptrace.h b/trunk/arch/um/include/sysdep-x86_64/ptrace.h index 8f0656766c21..331aa2d1f3f5 100644 --- a/trunk/arch/um/include/sysdep-x86_64/ptrace.h +++ b/trunk/arch/um/include/sysdep-x86_64/ptrace.h @@ -218,6 +218,10 @@ struct syscall_args { case RBP: UPT_RBP(regs) = __upt_val; break; \ case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \ case CS: UPT_CS(regs) = __upt_val; break; \ + case DS: UPT_DS(regs) = __upt_val; break; \ + case ES: UPT_ES(regs) = __upt_val; break; \ + case FS: UPT_FS(regs) = __upt_val; break; \ + case GS: UPT_GS(regs) = __upt_val; break; \ case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \ default : \ panic("Bad register in UPT_SET : %d\n", reg); \ diff --git a/trunk/arch/um/include/sysdep-x86_64/sc.h b/trunk/arch/um/include/sysdep-x86_64/sc.h deleted file mode 100644 index a160d9fcc596..000000000000 --- a/trunk/arch/um/include/sysdep-x86_64/sc.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef __SYSDEP_X86_64_SC_H -#define __SYSDEP_X86_64_SC_H - -/* Copyright (C) 2003 - 2004 PathScale, Inc - * Released under the GPL - */ - -#include - -#define SC_OFFSET(sc, field) \ - *((unsigned long *) &(((char *) (sc))[HOST_##field])) - -#define SC_RBX(sc) SC_OFFSET(sc, SC_RBX) -#define SC_RCX(sc) SC_OFFSET(sc, SC_RCX) -#define SC_RDX(sc) SC_OFFSET(sc, SC_RDX) -#define SC_RSI(sc) SC_OFFSET(sc, SC_RSI) -#define SC_RDI(sc) SC_OFFSET(sc, SC_RDI) -#define SC_RBP(sc) SC_OFFSET(sc, SC_RBP) -#define SC_RAX(sc) SC_OFFSET(sc, SC_RAX) -#define SC_R8(sc) SC_OFFSET(sc, SC_R8) -#define SC_R9(sc) SC_OFFSET(sc, SC_R9) -#define SC_R10(sc) SC_OFFSET(sc, SC_R10) -#define SC_R11(sc) SC_OFFSET(sc, SC_R11) -#define SC_R12(sc) SC_OFFSET(sc, SC_R12) -#define SC_R13(sc) SC_OFFSET(sc, SC_R13) -#define SC_R14(sc) SC_OFFSET(sc, SC_R14) -#define SC_R15(sc) SC_OFFSET(sc, SC_R15) -#define SC_IP(sc) SC_OFFSET(sc, SC_IP) -#define SC_SP(sc) SC_OFFSET(sc, SC_SP) -#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2) -#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR) -#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO) -#define SC_CS(sc) SC_OFFSET(sc, SC_CS) -#define SC_FS(sc) SC_OFFSET(sc, SC_FS) -#define SC_GS(sc) SC_OFFSET(sc, SC_GS) -#define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS) -#define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK) -#if 0 -#define SC_ORIG_RAX(sc) SC_OFFSET(sc, SC_ORIG_RAX) -#define SC_DS(sc) SC_OFFSET(sc, SC_DS) -#define SC_ES(sc) SC_OFFSET(sc, SC_ES) -#define SC_SS(sc) SC_OFFSET(sc, SC_SS) -#endif - -#endif diff --git a/trunk/arch/um/include/sysdep-x86_64/sigcontext.h b/trunk/arch/um/include/sysdep-x86_64/sigcontext.h index 41073235e7ad..2a78260d15a0 100644 --- a/trunk/arch/um/include/sysdep-x86_64/sigcontext.h +++ b/trunk/arch/um/include/sysdep-x86_64/sigcontext.h @@ -31,10 +31,7 @@ #define SC_START_SYSCALL(sc) do SC_RAX(sc) = -ENOSYS; while(0) /* This is Page Fault */ -#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) - -/* No broken SKAS API, which doesn't pass trap_no, here. */ -#define SEGV_MAYBE_FIXABLE(fi) 0 +#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) extern unsigned long *sc_sigmask(void *sc_ptr); diff --git a/trunk/arch/um/include/sysdep-x86_64/thread.h b/trunk/arch/um/include/sysdep-x86_64/thread.h deleted file mode 100644 index 6a76a7f3683f..000000000000 --- a/trunk/arch/um/include/sysdep-x86_64/thread.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __UM_THREAD_H -#define __UM_THREAD_H - -#include - -#ifdef CONFIG_MODE_TT -#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID])) -#endif - -#endif diff --git a/trunk/arch/um/include/task.h b/trunk/arch/um/include/task.h deleted file mode 100644 index 6375ba7203c9..000000000000 --- a/trunk/arch/um/include/task.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __TASK_H -#define __TASK_H - -#include - -#define TASK_REGS(task) ((union uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS])) -#define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID])) - -#endif diff --git a/trunk/arch/um/kernel/irq.c b/trunk/arch/um/kernel/irq.c index bbf94bf2921e..dcd814971995 100644 --- a/trunk/arch/um/kernel/irq.c +++ b/trunk/arch/um/kernel/irq.c @@ -9,6 +9,7 @@ #include "linux/kernel.h" #include "linux/module.h" #include "linux/smp.h" +#include "linux/irq.h" #include "linux/kernel_stat.h" #include "linux/interrupt.h" #include "linux/random.h" diff --git a/trunk/arch/um/kernel/skas/Makefile b/trunk/arch/um/kernel/skas/Makefile index 8de471b59c1c..db36c7c95940 100644 --- a/trunk/arch/um/kernel/skas/Makefile +++ b/trunk/arch/um/kernel/skas/Makefile @@ -6,6 +6,8 @@ obj-y := clone.o exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ syscall.o tlb.o trap_user.o uaccess.o +subdir- := util + USER_OBJS := process.o clone.o include arch/um/scripts/Makefile.rules diff --git a/trunk/arch/um/kernel/skas/util/Makefile b/trunk/arch/um/kernel/skas/util/Makefile new file mode 100644 index 000000000000..f7b7eba83340 --- /dev/null +++ b/trunk/arch/um/kernel/skas/util/Makefile @@ -0,0 +1,5 @@ +hostprogs-y := mk_ptregs +always := $(hostprogs-y) + +mk_ptregs-objs := mk_ptregs-$(SUBARCH).o +HOSTCFLAGS_mk_ptregs-$(SUBARCH).o := -I$(objtree)/arch/um diff --git a/trunk/arch/um/kernel/skas/util/mk_ptregs-i386.c b/trunk/arch/um/kernel/skas/util/mk_ptregs-i386.c new file mode 100644 index 000000000000..1f96e1eeb8a7 --- /dev/null +++ b/trunk/arch/um/kernel/skas/util/mk_ptregs-i386.c @@ -0,0 +1,49 @@ +#include +#include + +#define SHOW(name) printf("#define %s %d\n", #name, name) + +int main(int argc, char **argv) +{ + printf("/* Automatically generated by " + "arch/um/kernel/skas/util/mk_ptregs */\n"); + printf("\n"); + printf("#ifndef __SKAS_PT_REGS_\n"); + printf("#define __SKAS_PT_REGS_\n"); + printf("\n"); + SHOW(HOST_FRAME_SIZE); + SHOW(HOST_FP_SIZE); + SHOW(HOST_XFP_SIZE); + + SHOW(HOST_IP); + SHOW(HOST_SP); + SHOW(HOST_EFLAGS); + SHOW(HOST_EAX); + SHOW(HOST_EBX); + SHOW(HOST_ECX); + SHOW(HOST_EDX); + SHOW(HOST_ESI); + SHOW(HOST_EDI); + SHOW(HOST_EBP); + SHOW(HOST_CS); + SHOW(HOST_SS); + SHOW(HOST_DS); + SHOW(HOST_FS); + SHOW(HOST_ES); + SHOW(HOST_GS); + + printf("\n"); + printf("#endif\n"); + return(0); +} + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/kernel/skas/util/mk_ptregs-x86_64.c b/trunk/arch/um/kernel/skas/util/mk_ptregs-x86_64.c new file mode 100644 index 000000000000..5fccbfe35f78 --- /dev/null +++ b/trunk/arch/um/kernel/skas/util/mk_ptregs-x86_64.c @@ -0,0 +1,66 @@ +/* + * Copyright 2003 PathScale, Inc. + * + * Licensed under the GPL + */ + +#include +#include + +#define SHOW(name) \ + printf("#define %s (%d / sizeof(unsigned long))\n", #name, name) + +int main(int argc, char **argv) +{ + printf("/* Automatically generated by " + "arch/um/kernel/skas/util/mk_ptregs */\n"); + printf("\n"); + printf("#ifndef __SKAS_PT_REGS_\n"); + printf("#define __SKAS_PT_REGS_\n"); + SHOW(HOST_FRAME_SIZE); + SHOW(HOST_RBX); + SHOW(HOST_RCX); + SHOW(HOST_RDI); + SHOW(HOST_RSI); + SHOW(HOST_RDX); + SHOW(HOST_RBP); + SHOW(HOST_RAX); + SHOW(HOST_R8); + SHOW(HOST_R9); + SHOW(HOST_R10); + SHOW(HOST_R11); + SHOW(HOST_R12); + SHOW(HOST_R13); + SHOW(HOST_R14); + SHOW(HOST_R15); + SHOW(HOST_ORIG_RAX); + SHOW(HOST_CS); + SHOW(HOST_SS); + SHOW(HOST_EFLAGS); +#if 0 + SHOW(HOST_FS); + SHOW(HOST_GS); + SHOW(HOST_DS); + SHOW(HOST_ES); +#endif + + SHOW(HOST_IP); + SHOW(HOST_SP); + printf("#define HOST_FP_SIZE 0\n"); + printf("#define HOST_XFP_SIZE 0\n"); + printf("\n"); + printf("\n"); + printf("#endif\n"); + return(0); +} + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/kernel/sysrq.c b/trunk/arch/um/kernel/sysrq.c index b331e970002f..f80850091e79 100644 --- a/trunk/arch/um/kernel/sysrq.c +++ b/trunk/arch/um/kernel/sysrq.c @@ -62,7 +62,13 @@ void show_stack(struct task_struct *task, unsigned long *esp) if (esp == NULL) { if (task != current && task != NULL) { + /* XXX: Isn't this bogus? I.e. isn't this the + * *userspace* stack of this task? If not so, use this + * even when task == current (as in i386). + */ esp = (unsigned long *) KSTK_ESP(task); + /* Which one? No actual difference - just coding style.*/ + //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs); } else { esp = (unsigned long *) &esp; } @@ -78,5 +84,5 @@ void show_stack(struct task_struct *task, unsigned long *esp) } printk("Call Trace: \n"); - show_trace(task, esp); + show_trace(current, esp); } diff --git a/trunk/arch/um/kernel/trap_kern.c b/trunk/arch/um/kernel/trap_kern.c index 95c8f8733baf..d297429ac360 100644 --- a/trunk/arch/um/kernel/trap_kern.c +++ b/trunk/arch/um/kernel/trap_kern.c @@ -26,9 +26,6 @@ #include "mconsole_kern.h" #include "mem.h" #include "mem_kern.h" -#ifdef CONFIG_MODE_SKAS -#include "skas.h" -#endif /* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ int handle_page_fault(unsigned long address, unsigned long ip, @@ -137,7 +134,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc) else if(current->mm == NULL) panic("Segfault with no mm"); - if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi)) + if (SEGV_IS_FIXABLE(&fi)) err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); else { err = -EFAULT; diff --git a/trunk/arch/um/kernel/um_arch.c b/trunk/arch/um/kernel/um_arch.c index 93dc782dc1cc..f0a275947d34 100644 --- a/trunk/arch/um/kernel/um_arch.c +++ b/trunk/arch/um/kernel/um_arch.c @@ -334,8 +334,6 @@ int linux_main(int argc, char **argv) add_arg(DEFAULT_COMMAND_LINE); os_early_checks(); - if (force_tt) - clear_can_do_skas(); mode_tt = force_tt ? 1 : !can_do_skas(); #ifndef CONFIG_MODE_TT if (mode_tt) { diff --git a/trunk/arch/um/os-Linux/aio.c b/trunk/arch/um/os-Linux/aio.c index 41cfb0944201..f6e64026f995 100644 --- a/trunk/arch/um/os-Linux/aio.c +++ b/trunk/arch/um/os-Linux/aio.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -16,18 +17,31 @@ #include "user.h" #include "mode.h" -struct aio_thread_req { - enum aio_type type; - int io_fd; - unsigned long long offset; - char *buf; - int len; - struct aio_context *aio; -}; - static int aio_req_fd_r = -1; static int aio_req_fd_w = -1; +static int update_aio(struct aio_context *aio, int res) +{ + if(res < 0) + aio->len = res; + else if((res == 0) && (aio->type == AIO_READ)){ + /* This is the EOF case - we have hit the end of the file + * and it ends in a partial block, so we fill the end of + * the block with zeros and claim success. + */ + memset(aio->data, 0, aio->len); + aio->len = 0; + } + else if(res > 0){ + aio->len -= res; + aio->data += res; + aio->offset += res; + return aio->len; + } + + return 0; +} + #if defined(HAVE_AIO_ABI) #include @@ -66,8 +80,7 @@ static long io_getevents(aio_context_t ctx_id, long min_nr, long nr, * that it now backs the mmapped area. */ -static int do_aio(aio_context_t ctx, enum aio_type type, int fd, char *buf, - int len, unsigned long long offset, struct aio_context *aio) +static int do_aio(aio_context_t ctx, struct aio_context *aio) { struct iocb iocb, *iocbp = &iocb; char c; @@ -75,40 +88,39 @@ static int do_aio(aio_context_t ctx, enum aio_type type, int fd, char *buf, iocb = ((struct iocb) { .aio_data = (unsigned long) aio, .aio_reqprio = 0, - .aio_fildes = fd, - .aio_buf = (unsigned long) buf, - .aio_nbytes = len, - .aio_offset = offset, + .aio_fildes = aio->fd, + .aio_buf = (unsigned long) aio->data, + .aio_nbytes = aio->len, + .aio_offset = aio->offset, .aio_reserved1 = 0, .aio_reserved2 = 0, .aio_reserved3 = 0 }); - switch(type){ + switch(aio->type){ case AIO_READ: iocb.aio_lio_opcode = IOCB_CMD_PREAD; - err = io_submit(ctx, 1, &iocbp); break; case AIO_WRITE: iocb.aio_lio_opcode = IOCB_CMD_PWRITE; - err = io_submit(ctx, 1, &iocbp); break; case AIO_MMAP: iocb.aio_lio_opcode = IOCB_CMD_PREAD; iocb.aio_buf = (unsigned long) &c; iocb.aio_nbytes = sizeof(c); - err = io_submit(ctx, 1, &iocbp); break; default: - printk("Bogus op in do_aio - %d\n", type); + printk("Bogus op in do_aio - %d\n", aio->type); err = -EINVAL; - break; + goto out; } + err = io_submit(ctx, 1, &iocbp); if(err > 0) err = 0; else err = -errno; + out: return err; } @@ -117,8 +129,9 @@ static aio_context_t ctx = 0; static int aio_thread(void *arg) { struct aio_thread_reply reply; + struct aio_context *aio; struct io_event event; - int err, n, reply_fd; + int err, n; signal(SIGWINCH, SIG_IGN); @@ -131,14 +144,22 @@ static int aio_thread(void *arg) "errno = %d\n", errno); } else { + /* This is safe as we've just a pointer here. */ + aio = (struct aio_context *) (long) event.data; + if(update_aio(aio, event.res)){ + do_aio(ctx, aio); + continue; + } + reply = ((struct aio_thread_reply) - { .data = (void *) (long) event.data, - .err = event.res }); - reply_fd = ((struct aio_context *) reply.data)->reply_fd; - err = os_write_file(reply_fd, &reply, sizeof(reply)); + { .data = aio, + .err = aio->len }); + err = os_write_file(aio->reply_fd, &reply, + sizeof(reply)); if(err != sizeof(reply)) - printk("aio_thread - write failed, fd = %d, " - "err = %d\n", aio_req_fd_r, -err); + printk("aio_thread - write failed, " + "fd = %d, err = %d\n", aio->reply_fd, + -err); } } return 0; @@ -146,35 +167,35 @@ static int aio_thread(void *arg) #endif -static int do_not_aio(struct aio_thread_req *req) +static int do_not_aio(struct aio_context *aio) { char c; int err; - switch(req->type){ + switch(aio->type){ case AIO_READ: - err = os_seek_file(req->io_fd, req->offset); + err = os_seek_file(aio->fd, aio->offset); if(err) goto out; - err = os_read_file(req->io_fd, req->buf, req->len); + err = os_read_file(aio->fd, aio->data, aio->len); break; case AIO_WRITE: - err = os_seek_file(req->io_fd, req->offset); + err = os_seek_file(aio->fd, aio->offset); if(err) goto out; - err = os_write_file(req->io_fd, req->buf, req->len); + err = os_write_file(aio->fd, aio->data, aio->len); break; case AIO_MMAP: - err = os_seek_file(req->io_fd, req->offset); + err = os_seek_file(aio->fd, aio->offset); if(err) goto out; - err = os_read_file(req->io_fd, &c, sizeof(c)); + err = os_read_file(aio->fd, &c, sizeof(c)); break; default: - printk("do_not_aio - bad request type : %d\n", req->type); + printk("do_not_aio - bad request type : %d\n", aio->type); err = -EINVAL; break; } @@ -185,14 +206,14 @@ static int do_not_aio(struct aio_thread_req *req) static int not_aio_thread(void *arg) { - struct aio_thread_req req; + struct aio_context *aio; struct aio_thread_reply reply; int err; signal(SIGWINCH, SIG_IGN); while(1){ - err = os_read_file(aio_req_fd_r, &req, sizeof(req)); - if(err != sizeof(req)){ + err = os_read_file(aio_req_fd_r, &aio, sizeof(aio)); + if(err != sizeof(aio)){ if(err < 0) printk("not_aio_thread - read failed, " "fd = %d, err = %d\n", aio_req_fd_r, @@ -203,17 +224,34 @@ static int not_aio_thread(void *arg) } continue; } - err = do_not_aio(&req); - reply = ((struct aio_thread_reply) { .data = req.aio, - .err = err }); - err = os_write_file(req.aio->reply_fd, &reply, sizeof(reply)); + again: + err = do_not_aio(aio); + + if(update_aio(aio, err)) + goto again; + + reply = ((struct aio_thread_reply) { .data = aio, + .err = aio->len }); + err = os_write_file(aio->reply_fd, &reply, sizeof(reply)); if(err != sizeof(reply)) printk("not_aio_thread - write failed, fd = %d, " "err = %d\n", aio_req_fd_r, -err); } } +static int submit_aio_24(struct aio_context *aio) +{ + int err; + + err = os_write_file(aio_req_fd_w, &aio, sizeof(aio)); + if(err == sizeof(aio)) + err = 0; + + return err; +} + static int aio_pid = -1; +static int (*submit_proc)(struct aio_context *aio); static int init_aio_24(void) { @@ -245,11 +283,33 @@ static int init_aio_24(void) #endif printk("2.6 host AIO support not used - falling back to I/O " "thread\n"); + + submit_proc = submit_aio_24; + return 0; } #ifdef HAVE_AIO_ABI #define DEFAULT_24_AIO 0 +static int submit_aio_26(struct aio_context *aio) +{ + struct aio_thread_reply reply; + int err; + + err = do_aio(ctx, aio); + if(err){ + reply = ((struct aio_thread_reply) { .data = aio, + .err = err }); + err = os_write_file(aio->reply_fd, &reply, sizeof(reply)); + if(err != sizeof(reply)) + printk("submit_aio_26 - write failed, " + "fd = %d, err = %d\n", aio->reply_fd, -err); + else err = 0; + } + + return err; +} + static int init_aio_26(void) { unsigned long stack; @@ -270,39 +330,22 @@ static int init_aio_26(void) aio_pid = err; printk("Using 2.6 host AIO\n"); - return 0; -} - -static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len, - unsigned long long offset, struct aio_context *aio) -{ - struct aio_thread_reply reply; - int err; - err = do_aio(ctx, type, io_fd, buf, len, offset, aio); - if(err){ - reply = ((struct aio_thread_reply) { .data = aio, - .err = err }); - err = os_write_file(aio->reply_fd, &reply, sizeof(reply)); - if(err != sizeof(reply)) - printk("submit_aio_26 - write failed, " - "fd = %d, err = %d\n", aio->reply_fd, -err); - else err = 0; - } + submit_proc = submit_aio_26; - return err; + return 0; } #else #define DEFAULT_24_AIO 1 -static int init_aio_26(void) +static int submit_aio_26(struct aio_context *aio) { return -ENOSYS; } -static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len, - unsigned long long offset, struct aio_context *aio) +static int init_aio_26(void) { + submit_proc = submit_aio_26; return -ENOSYS; } #endif @@ -369,33 +412,7 @@ static void exit_aio(void) __uml_exitcall(exit_aio); -static int submit_aio_24(enum aio_type type, int io_fd, char *buf, int len, - unsigned long long offset, struct aio_context *aio) +int submit_aio(struct aio_context *aio) { - struct aio_thread_req req = { .type = type, - .io_fd = io_fd, - .offset = offset, - .buf = buf, - .len = len, - .aio = aio, - }; - int err; - - err = os_write_file(aio_req_fd_w, &req, sizeof(req)); - if(err == sizeof(req)) - err = 0; - - return err; -} - -int submit_aio(enum aio_type type, int io_fd, char *buf, int len, - unsigned long long offset, int reply_fd, - struct aio_context *aio) -{ - aio->reply_fd = reply_fd; - if(aio_24) - return submit_aio_24(type, io_fd, buf, len, offset, aio); - else { - return submit_aio_26(type, io_fd, buf, len, offset, aio); - } + return (*submit_proc)(aio); } diff --git a/trunk/arch/um/os-Linux/elf_aux.c b/trunk/arch/um/os-Linux/elf_aux.c index 5a99dd3fbed0..ab33cb3c74ec 100644 --- a/trunk/arch/um/os-Linux/elf_aux.c +++ b/trunk/arch/um/os-Linux/elf_aux.c @@ -12,7 +12,7 @@ #include "init.h" #include "elf_user.h" #include "mem_user.h" -#include +#include /* Use the one from the kernel - the host may miss it, if having old headers. */ #if UM_ELF_CLASS == UM_ELFCLASS32 diff --git a/trunk/arch/um/os-Linux/start_up.c b/trunk/arch/um/os-Linux/start_up.c index b99ab414542f..6af83171ca4e 100644 --- a/trunk/arch/um/os-Linux/start_up.c +++ b/trunk/arch/um/os-Linux/start_up.c @@ -143,22 +143,11 @@ static int __init skas0_cmd_param(char *str, int* add) return 0; } -/* The two __uml_setup would conflict, without this stupid alias. */ - -static int __init mode_skas0_cmd_param(char *str, int* add) - __attribute__((alias("skas0_cmd_param"))); - __uml_setup("skas0", skas0_cmd_param, "skas0\n" " Disables SKAS3 usage, so that SKAS0 is used, unless \n" " you specify mode=tt.\n\n"); -__uml_setup("mode=skas0", mode_skas0_cmd_param, - "mode=skas0\n" - " Disables SKAS3 usage, so that SKAS0 is used, unless you \n" - " specify mode=tt. Note that this was recently added - on \n" - " older kernels you must use simply \"skas0\".\n\n"); - static int force_sysemu_disabled = 0; static int __init nosysemu_cmd_param(char *str, int* add) diff --git a/trunk/arch/um/os-Linux/sys-i386/registers.c b/trunk/arch/um/os-Linux/sys-i386/registers.c index aee4812333c6..3125d320722c 100644 --- a/trunk/arch/um/os-Linux/sys-i386/registers.c +++ b/trunk/arch/um/os-Linux/sys-i386/registers.c @@ -5,7 +5,6 @@ #include #include -#include #include "sysdep/ptrace_user.h" #include "sysdep/ptrace.h" #include "uml-config.h" @@ -127,11 +126,13 @@ void get_safe_registers(unsigned long *regs) memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); } -void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) -{ - struct __jmp_buf_tag *jmpbuf = buffer; - - UPT_SET(uml_regs, EIP, jmpbuf->__jmpbuf[JB_PC]); - UPT_SET(uml_regs, UESP, jmpbuf->__jmpbuf[JB_SP]); - UPT_SET(uml_regs, EBP, jmpbuf->__jmpbuf[JB_BP]); -} +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/os-Linux/sys-x86_64/registers.c b/trunk/arch/um/os-Linux/sys-x86_64/registers.c index 4b638dfb52b0..44438d15c3d6 100644 --- a/trunk/arch/um/os-Linux/sys-x86_64/registers.c +++ b/trunk/arch/um/os-Linux/sys-x86_64/registers.c @@ -5,7 +5,6 @@ #include #include -#include #include "ptrace_user.h" #include "uml-config.h" #include "skas_ptregs.h" @@ -75,11 +74,13 @@ void get_safe_registers(unsigned long *regs) memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); } -void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) -{ - struct __jmp_buf_tag *jmpbuf = buffer; - - UPT_SET(uml_regs, RIP, jmpbuf->__jmpbuf[JB_PC]); - UPT_SET(uml_regs, RSP, jmpbuf->__jmpbuf[JB_RSP]); - UPT_SET(uml_regs, RBP, jmpbuf->__jmpbuf[JB_RBP]); -} +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/os-Linux/util/Makefile b/trunk/arch/um/os-Linux/util/Makefile new file mode 100644 index 000000000000..9778aed0c314 --- /dev/null +++ b/trunk/arch/um/os-Linux/util/Makefile @@ -0,0 +1,4 @@ +hostprogs-y := mk_user_constants +always := $(hostprogs-y) + +HOSTCFLAGS_mk_user_constants.o := -I$(objtree)/arch/um diff --git a/trunk/arch/um/os-Linux/util/mk_user_constants.c b/trunk/arch/um/os-Linux/util/mk_user_constants.c new file mode 100644 index 000000000000..4838f30eecf0 --- /dev/null +++ b/trunk/arch/um/os-Linux/util/mk_user_constants.c @@ -0,0 +1,23 @@ +#include +#include + +int main(int argc, char **argv) +{ + printf("/*\n"); + printf(" * Generated by mk_user_constants\n"); + printf(" */\n"); + printf("\n"); + printf("#ifndef __UM_USER_CONSTANTS_H\n"); + printf("#define __UM_USER_CONSTANTS_H\n"); + printf("\n"); + /* I'd like to use FRAME_SIZE from ptrace.h here, but that's wrong on + * x86_64 (216 vs 168 bytes). user_regs_struct is the correct size on + * both x86_64 and i386. + */ + printf("#define UM_FRAME_SIZE %d\n", __UM_FRAME_SIZE); + + printf("\n"); + printf("#endif\n"); + + return(0); +} diff --git a/trunk/arch/um/scripts/Makefile.rules b/trunk/arch/um/scripts/Makefile.rules index 651d9d88b656..59a1291f477e 100644 --- a/trunk/arch/um/scripts/Makefile.rules +++ b/trunk/arch/um/scripts/Makefile.rules @@ -7,8 +7,8 @@ USER_SINGLE_OBJS := \ USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) $(USER_OBJS:.o=.i) $(USER_OBJS:.o=.s) $(USER_OBJS:.o=.lst): \ - c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \ + $(CFLAGS_$(notdir $@)) $(USER_OBJS): cmd_checksrc = $(USER_OBJS): quiet_cmd_checksrc = $(USER_OBJS): cmd_force_checksrc = diff --git a/trunk/arch/um/sys-i386/Makefile b/trunk/arch/um/sys-i386/Makefile index 6dfeb70f6957..4ca2a229da49 100644 --- a/trunk/arch/um/sys-i386/Makefile +++ b/trunk/arch/um/sys-i386/Makefile @@ -18,4 +18,6 @@ module.c-dir = kernel $(obj)/stub_segv.o : _c_flags = $(call unprofile,$(CFLAGS)) +subdir- := util + include arch/um/scripts/Makefile.unmap diff --git a/trunk/arch/um/sys-i386/kernel-offsets.c b/trunk/arch/um/sys-i386/kernel-offsets.c index 35db85057506..a1070af2bcd8 100644 --- a/trunk/arch/um/sys-i386/kernel-offsets.c +++ b/trunk/arch/um/sys-i386/kernel-offsets.c @@ -18,9 +18,9 @@ void foo(void) { - OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs); + OFFSET(TASK_DEBUGREGS, task_struct, thread.arch.debugregs); #ifdef CONFIG_MODE_TT - OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); + OFFSET(TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); #endif #include } diff --git a/trunk/arch/um/sys-i386/sysrq.c b/trunk/arch/um/sys-i386/sysrq.c index d5244f070539..e3706d15c4f5 100644 --- a/trunk/arch/um/sys-i386/sysrq.c +++ b/trunk/arch/um/sys-i386/sysrq.c @@ -88,7 +88,9 @@ void show_trace(struct task_struct* task, unsigned long * stack) task = current; if (task != current) { - ebp = (unsigned long) KSTK_EBP(task); + //ebp = (unsigned long) KSTK_EBP(task); + /* Which one? No actual difference - just coding style.*/ + ebp = (unsigned long) PT_REGS_EBP(&task->thread.regs); } else { asm ("movl %%ebp, %0" : "=r" (ebp) : ); } @@ -97,6 +99,15 @@ void show_trace(struct task_struct* task, unsigned long * stack) ((unsigned long)stack & (~(THREAD_SIZE - 1))); print_context_stack(context, stack, ebp); + /*while (((long) stack & (THREAD_SIZE-1)) != 0) { + addr = *stack; + if (__kernel_text_address(addr)) { + printk("%08lx: [<%08lx>]", (unsigned long) stack, addr); + print_symbol(" %s", addr); + printk("\n"); + } + stack++; + }*/ printk("\n"); } diff --git a/trunk/arch/um/sys-i386/user-offsets.c b/trunk/arch/um/sys-i386/user-offsets.c index 26b68675053d..3ceaabceb3d7 100644 --- a/trunk/arch/um/sys-i386/user-offsets.c +++ b/trunk/arch/um/sys-i386/user-offsets.c @@ -7,48 +7,47 @@ #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) -#define DEFINE_LONGS(sym, val) \ - asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long))) - #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)); void foo(void) { - OFFSET(HOST_SC_IP, sigcontext, eip); - OFFSET(HOST_SC_SP, sigcontext, esp); - OFFSET(HOST_SC_FS, sigcontext, fs); - OFFSET(HOST_SC_GS, sigcontext, gs); - OFFSET(HOST_SC_DS, sigcontext, ds); - OFFSET(HOST_SC_ES, sigcontext, es); - OFFSET(HOST_SC_SS, sigcontext, ss); - OFFSET(HOST_SC_CS, sigcontext, cs); - OFFSET(HOST_SC_EFLAGS, sigcontext, eflags); - OFFSET(HOST_SC_EAX, sigcontext, eax); - OFFSET(HOST_SC_EBX, sigcontext, ebx); - OFFSET(HOST_SC_ECX, sigcontext, ecx); - OFFSET(HOST_SC_EDX, sigcontext, edx); - OFFSET(HOST_SC_EDI, sigcontext, edi); - OFFSET(HOST_SC_ESI, sigcontext, esi); - OFFSET(HOST_SC_EBP, sigcontext, ebp); - OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); - OFFSET(HOST_SC_ERR, sigcontext, err); - OFFSET(HOST_SC_CR2, sigcontext, cr2); - OFFSET(HOST_SC_FPSTATE, sigcontext, fpstate); - OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask); - OFFSET(HOST_SC_FP_CW, _fpstate, cw); - OFFSET(HOST_SC_FP_SW, _fpstate, sw); - OFFSET(HOST_SC_FP_TAG, _fpstate, tag); - OFFSET(HOST_SC_FP_IPOFF, _fpstate, ipoff); - OFFSET(HOST_SC_FP_CSSEL, _fpstate, cssel); - OFFSET(HOST_SC_FP_DATAOFF, _fpstate, dataoff); - OFFSET(HOST_SC_FP_DATASEL, _fpstate, datasel); - OFFSET(HOST_SC_FP_ST, _fpstate, _st); - OFFSET(HOST_SC_FXSR_ENV, _fpstate, _fxsr_env); + OFFSET(SC_IP, sigcontext, eip); + OFFSET(SC_SP, sigcontext, esp); + OFFSET(SC_FS, sigcontext, fs); + OFFSET(SC_GS, sigcontext, gs); + OFFSET(SC_DS, sigcontext, ds); + OFFSET(SC_ES, sigcontext, es); + OFFSET(SC_SS, sigcontext, ss); + OFFSET(SC_CS, sigcontext, cs); + OFFSET(SC_EFLAGS, sigcontext, eflags); + OFFSET(SC_EAX, sigcontext, eax); + OFFSET(SC_EBX, sigcontext, ebx); + OFFSET(SC_ECX, sigcontext, ecx); + OFFSET(SC_EDX, sigcontext, edx); + OFFSET(SC_EDI, sigcontext, edi); + OFFSET(SC_ESI, sigcontext, esi); + OFFSET(SC_EBP, sigcontext, ebp); + OFFSET(SC_TRAPNO, sigcontext, trapno); + OFFSET(SC_ERR, sigcontext, err); + OFFSET(SC_CR2, sigcontext, cr2); + OFFSET(SC_FPSTATE, sigcontext, fpstate); + OFFSET(SC_SIGMASK, sigcontext, oldmask); + OFFSET(SC_FP_CW, _fpstate, cw); + OFFSET(SC_FP_SW, _fpstate, sw); + OFFSET(SC_FP_TAG, _fpstate, tag); + OFFSET(SC_FP_IPOFF, _fpstate, ipoff); + OFFSET(SC_FP_CSSEL, _fpstate, cssel); + OFFSET(SC_FP_DATAOFF, _fpstate, dataoff); + OFFSET(SC_FP_DATASEL, _fpstate, datasel); + OFFSET(SC_FP_ST, _fpstate, _st); + OFFSET(SC_FXSR_ENV, _fpstate, _fxsr_env); DEFINE(HOST_FRAME_SIZE, FRAME_SIZE); - DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_i387_struct)); - DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fxsr_struct)); + DEFINE(HOST_FP_SIZE, + sizeof(struct user_i387_struct) / sizeof(unsigned long)); + DEFINE(HOST_XFP_SIZE, + sizeof(struct user_fxsr_struct) / sizeof(unsigned long)); DEFINE(HOST_IP, EIP); DEFINE(HOST_SP, UESP); @@ -66,5 +65,5 @@ void foo(void) DEFINE(HOST_FS, FS); DEFINE(HOST_ES, ES); DEFINE(HOST_GS, GS); - DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct)); + DEFINE(__UM_FRAME_SIZE, sizeof(struct user_regs_struct)); } diff --git a/trunk/arch/um/sys-i386/util/Makefile b/trunk/arch/um/sys-i386/util/Makefile new file mode 100644 index 000000000000..bf61afd0b045 --- /dev/null +++ b/trunk/arch/um/sys-i386/util/Makefile @@ -0,0 +1,5 @@ +hostprogs-y := mk_sc mk_thread +always := $(hostprogs-y) + +HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um +HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um diff --git a/trunk/arch/um/sys-i386/util/mk_sc.c b/trunk/arch/um/sys-i386/util/mk_sc.c new file mode 100644 index 000000000000..04c0d73433aa --- /dev/null +++ b/trunk/arch/um/sys-i386/util/mk_sc.c @@ -0,0 +1,51 @@ +#include +#include + +#define SC_OFFSET(name, field) \ + printf("#define " #name "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\ + name) + +#define SC_FP_OFFSET(name, field) \ + printf("#define " #name \ + "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\ + name) + +#define SC_FP_OFFSET_PTR(name, field, type) \ + printf("#define " #name \ + "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\ + name) + +int main(int argc, char **argv) +{ + SC_OFFSET(SC_IP, eip); + SC_OFFSET(SC_SP, esp); + SC_OFFSET(SC_FS, fs); + SC_OFFSET(SC_GS, gs); + SC_OFFSET(SC_DS, ds); + SC_OFFSET(SC_ES, es); + SC_OFFSET(SC_SS, ss); + SC_OFFSET(SC_CS, cs); + SC_OFFSET(SC_EFLAGS, eflags); + SC_OFFSET(SC_EAX, eax); + SC_OFFSET(SC_EBX, ebx); + SC_OFFSET(SC_ECX, ecx); + SC_OFFSET(SC_EDX, edx); + SC_OFFSET(SC_EDI, edi); + SC_OFFSET(SC_ESI, esi); + SC_OFFSET(SC_EBP, ebp); + SC_OFFSET(SC_TRAPNO, trapno); + SC_OFFSET(SC_ERR, err); + SC_OFFSET(SC_CR2, cr2); + SC_OFFSET(SC_FPSTATE, fpstate); + SC_OFFSET(SC_SIGMASK, oldmask); + SC_FP_OFFSET(SC_FP_CW, cw); + SC_FP_OFFSET(SC_FP_SW, sw); + SC_FP_OFFSET(SC_FP_TAG, tag); + SC_FP_OFFSET(SC_FP_IPOFF, ipoff); + SC_FP_OFFSET(SC_FP_CSSEL, cssel); + SC_FP_OFFSET(SC_FP_DATAOFF, dataoff); + SC_FP_OFFSET(SC_FP_DATASEL, datasel); + SC_FP_OFFSET_PTR(SC_FP_ST, _st, "struct _fpstate"); + SC_FP_OFFSET_PTR(SC_FXSR_ENV, _fxsr_env, "void"); + return(0); +} diff --git a/trunk/arch/um/sys-i386/util/mk_thread.c b/trunk/arch/um/sys-i386/util/mk_thread.c new file mode 100644 index 000000000000..7470d0dda67e --- /dev/null +++ b/trunk/arch/um/sys-i386/util/mk_thread.c @@ -0,0 +1,22 @@ +#include +#include + +int main(int argc, char **argv) +{ + printf("/*\n"); + printf(" * Generated by mk_thread\n"); + printf(" */\n"); + printf("\n"); + printf("#ifndef __UM_THREAD_H\n"); + printf("#define __UM_THREAD_H\n"); + printf("\n"); + printf("#define TASK_DEBUGREGS(task) ((unsigned long *) " + "&(((char *) (task))[%d]))\n", TASK_DEBUGREGS); +#ifdef TASK_EXTERN_PID + printf("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n", + TASK_EXTERN_PID); +#endif + printf("\n"); + printf("#endif\n"); + return(0); +} diff --git a/trunk/arch/um/sys-x86_64/Makefile b/trunk/arch/um/sys-x86_64/Makefile index 06c3633457a2..f0ab574d1e95 100644 --- a/trunk/arch/um/sys-x86_64/Makefile +++ b/trunk/arch/um/sys-x86_64/Makefile @@ -29,4 +29,6 @@ module.c-dir = kernel $(obj)/stub_segv.o: _c_flags = $(call unprofile,$(CFLAGS)) +subdir- := util + include arch/um/scripts/Makefile.unmap diff --git a/trunk/arch/um/sys-x86_64/kernel-offsets.c b/trunk/arch/um/sys-x86_64/kernel-offsets.c index bfcb104b846e..998541eade41 100644 --- a/trunk/arch/um/sys-x86_64/kernel-offsets.c +++ b/trunk/arch/um/sys-x86_64/kernel-offsets.c @@ -19,7 +19,7 @@ void foo(void) { #ifdef CONFIG_MODE_TT - OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); + OFFSET(TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); #endif #include } diff --git a/trunk/arch/um/sys-x86_64/stub_segv.c b/trunk/arch/um/sys-x86_64/stub_segv.c index d1e53bdf2e85..65a131b362b6 100644 --- a/trunk/arch/um/sys-x86_64/stub_segv.c +++ b/trunk/arch/um/sys-x86_64/stub_segv.c @@ -10,22 +10,6 @@ #include "uml-config.h" #include "sysdep/sigcontext.h" #include "sysdep/faultinfo.h" -#include - -/* Copied from sys-x86_64/signal.c - Can't find an equivalent definition - * in the libc headers anywhere. - */ -struct rt_sigframe -{ - char *pretcode; - struct ucontext uc; - struct siginfo info; -}; - -/* Copied here from - we're userspace. */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) void __attribute__ ((__section__ (".__syscall_stub"))) stub_segv_handler(int sig) @@ -33,19 +17,16 @@ stub_segv_handler(int sig) struct ucontext *uc; __asm__("movq %%rdx, %0" : "=g" (uc) :); - GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), - &uc->uc_mcontext); + GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), + &uc->uc_mcontext); - __asm__("movq %0, %%rax ; syscall": : "g" (__NR_getpid)); + __asm__("movq %0, %%rax ; syscall": : "g" (__NR_getpid)); __asm__("movq %%rax, %%rdi ; movq %0, %%rax ; movq %1, %%rsi ;" - "syscall": : "g" (__NR_kill), "g" (SIGUSR1) : - "%rdi", "%rax", "%rsi"); - /* sys_sigreturn expects that the stack pointer will be 8 bytes into - * the signal frame. So, we use the ucontext pointer, which we know - * already, to get the signal frame pointer, and add 8 to that. + "syscall": : "g" (__NR_kill), "g" (SIGUSR1)); + /* Two popqs to restore the stack to the state just before entering + * the handler, one pops the return address, the other pops the frame + * pointer. */ - __asm__("movq %0, %%rsp": : - "g" ((unsigned long) container_of(uc, struct rt_sigframe, - uc) + 8)); - __asm__("movq %0, %%rax ; syscall" : : "g" (__NR_rt_sigreturn)); + __asm__("popq %%rax ; popq %%rax ; movq %0, %%rax ; syscall" : : "g" + (__NR_rt_sigreturn)); } diff --git a/trunk/arch/um/sys-x86_64/user-offsets.c b/trunk/arch/um/sys-x86_64/user-offsets.c index 5a585bfbb8c2..513d17ceafd4 100644 --- a/trunk/arch/um/sys-x86_64/user-offsets.c +++ b/trunk/arch/um/sys-x86_64/user-offsets.c @@ -16,76 +16,71 @@ typedef __u32 u32; #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) -#define DEFINE_LONGS(sym, val) \ - asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long))) - #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)); void foo(void) { - OFFSET(HOST_SC_RBX, sigcontext, rbx); - OFFSET(HOST_SC_RCX, sigcontext, rcx); - OFFSET(HOST_SC_RDX, sigcontext, rdx); - OFFSET(HOST_SC_RSI, sigcontext, rsi); - OFFSET(HOST_SC_RDI, sigcontext, rdi); - OFFSET(HOST_SC_RBP, sigcontext, rbp); - OFFSET(HOST_SC_RAX, sigcontext, rax); - OFFSET(HOST_SC_R8, sigcontext, r8); - OFFSET(HOST_SC_R9, sigcontext, r9); - OFFSET(HOST_SC_R10, sigcontext, r10); - OFFSET(HOST_SC_R11, sigcontext, r11); - OFFSET(HOST_SC_R12, sigcontext, r12); - OFFSET(HOST_SC_R13, sigcontext, r13); - OFFSET(HOST_SC_R14, sigcontext, r14); - OFFSET(HOST_SC_R15, sigcontext, r15); - OFFSET(HOST_SC_IP, sigcontext, rip); - OFFSET(HOST_SC_SP, sigcontext, rsp); - OFFSET(HOST_SC_CR2, sigcontext, cr2); - OFFSET(HOST_SC_ERR, sigcontext, err); - OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); - OFFSET(HOST_SC_CS, sigcontext, cs); - OFFSET(HOST_SC_FS, sigcontext, fs); - OFFSET(HOST_SC_GS, sigcontext, gs); - OFFSET(HOST_SC_EFLAGS, sigcontext, eflags); - OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask); + OFFSET(SC_RBX, sigcontext, rbx); + OFFSET(SC_RCX, sigcontext, rcx); + OFFSET(SC_RDX, sigcontext, rdx); + OFFSET(SC_RSI, sigcontext, rsi); + OFFSET(SC_RDI, sigcontext, rdi); + OFFSET(SC_RBP, sigcontext, rbp); + OFFSET(SC_RAX, sigcontext, rax); + OFFSET(SC_R8, sigcontext, r8); + OFFSET(SC_R9, sigcontext, r9); + OFFSET(SC_R10, sigcontext, r10); + OFFSET(SC_R11, sigcontext, r11); + OFFSET(SC_R12, sigcontext, r12); + OFFSET(SC_R13, sigcontext, r13); + OFFSET(SC_R14, sigcontext, r14); + OFFSET(SC_R15, sigcontext, r15); + OFFSET(SC_IP, sigcontext, rip); + OFFSET(SC_SP, sigcontext, rsp); + OFFSET(SC_CR2, sigcontext, cr2); + OFFSET(SC_ERR, sigcontext, err); + OFFSET(SC_TRAPNO, sigcontext, trapno); + OFFSET(SC_CS, sigcontext, cs); + OFFSET(SC_FS, sigcontext, fs); + OFFSET(SC_GS, sigcontext, gs); + OFFSET(SC_EFLAGS, sigcontext, eflags); + OFFSET(SC_SIGMASK, sigcontext, oldmask); #if 0 - OFFSET(HOST_SC_ORIG_RAX, sigcontext, orig_rax); - OFFSET(HOST_SC_DS, sigcontext, ds); - OFFSET(HOST_SC_ES, sigcontext, es); - OFFSET(HOST_SC_SS, sigcontext, ss); + OFFSET(SC_ORIG_RAX, sigcontext, orig_rax); + OFFSET(SC_DS, sigcontext, ds); + OFFSET(SC_ES, sigcontext, es); + OFFSET(SC_SS, sigcontext, ss); #endif - DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE); - DEFINE(HOST_FP_SIZE, 0); - DEFINE(HOST_XFP_SIZE, 0); - DEFINE_LONGS(HOST_RBX, RBX); - DEFINE_LONGS(HOST_RCX, RCX); - DEFINE_LONGS(HOST_RDI, RDI); - DEFINE_LONGS(HOST_RSI, RSI); - DEFINE_LONGS(HOST_RDX, RDX); - DEFINE_LONGS(HOST_RBP, RBP); - DEFINE_LONGS(HOST_RAX, RAX); - DEFINE_LONGS(HOST_R8, R8); - DEFINE_LONGS(HOST_R9, R9); - DEFINE_LONGS(HOST_R10, R10); - DEFINE_LONGS(HOST_R11, R11); - DEFINE_LONGS(HOST_R12, R12); - DEFINE_LONGS(HOST_R13, R13); - DEFINE_LONGS(HOST_R14, R14); - DEFINE_LONGS(HOST_R15, R15); - DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX); - DEFINE_LONGS(HOST_CS, CS); - DEFINE_LONGS(HOST_SS, SS); - DEFINE_LONGS(HOST_EFLAGS, EFLAGS); + DEFINE(HOST_FRAME_SIZE, FRAME_SIZE); + DEFINE(HOST_RBX, RBX); + DEFINE(HOST_RCX, RCX); + DEFINE(HOST_RDI, RDI); + DEFINE(HOST_RSI, RSI); + DEFINE(HOST_RDX, RDX); + DEFINE(HOST_RBP, RBP); + DEFINE(HOST_RAX, RAX); + DEFINE(HOST_R8, R8); + DEFINE(HOST_R9, R9); + DEFINE(HOST_R10, R10); + DEFINE(HOST_R11, R11); + DEFINE(HOST_R12, R12); + DEFINE(HOST_R13, R13); + DEFINE(HOST_R14, R14); + DEFINE(HOST_R15, R15); + DEFINE(HOST_ORIG_RAX, ORIG_RAX); + DEFINE(HOST_CS, CS); + DEFINE(HOST_SS, SS); + DEFINE(HOST_EFLAGS, EFLAGS); #if 0 - DEFINE_LONGS(HOST_FS, FS); - DEFINE_LONGS(HOST_GS, GS); - DEFINE_LONGS(HOST_DS, DS); - DEFINE_LONGS(HOST_ES, ES); + DEFINE(HOST_FS, FS); + DEFINE(HOST_GS, GS); + DEFINE(HOST_DS, DS); + DEFINE(HOST_ES, ES); #endif - DEFINE_LONGS(HOST_IP, RIP); - DEFINE_LONGS(HOST_SP, RSP); - DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct)); + DEFINE(HOST_IP, RIP); + DEFINE(HOST_SP, RSP); + DEFINE(__UM_FRAME_SIZE, sizeof(struct user_regs_struct)); } diff --git a/trunk/arch/um/sys-x86_64/util/Makefile b/trunk/arch/um/sys-x86_64/util/Makefile new file mode 100644 index 000000000000..75b052cfc206 --- /dev/null +++ b/trunk/arch/um/sys-x86_64/util/Makefile @@ -0,0 +1,8 @@ +# Copyright 2003 - 2004 Pathscale, Inc +# Released under the GPL + +hostprogs-y := mk_sc mk_thread +always := $(hostprogs-y) + +HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um +HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um diff --git a/trunk/arch/um/sys-x86_64/util/mk_sc.c b/trunk/arch/um/sys-x86_64/util/mk_sc.c new file mode 100644 index 000000000000..7619bc377c1f --- /dev/null +++ b/trunk/arch/um/sys-x86_64/util/mk_sc.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2003 - 2004 PathScale, Inc + * Released under the GPL + */ + +#include +#include + +#define SC_OFFSET(name) \ + printf("#define " #name \ + "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\ + name) + +int main(int argc, char **argv) +{ + SC_OFFSET(SC_RBX); + SC_OFFSET(SC_RCX); + SC_OFFSET(SC_RDX); + SC_OFFSET(SC_RSI); + SC_OFFSET(SC_RDI); + SC_OFFSET(SC_RBP); + SC_OFFSET(SC_RAX); + SC_OFFSET(SC_R8); + SC_OFFSET(SC_R9); + SC_OFFSET(SC_R10); + SC_OFFSET(SC_R11); + SC_OFFSET(SC_R12); + SC_OFFSET(SC_R13); + SC_OFFSET(SC_R14); + SC_OFFSET(SC_R15); + SC_OFFSET(SC_IP); + SC_OFFSET(SC_SP); + SC_OFFSET(SC_CR2); + SC_OFFSET(SC_ERR); + SC_OFFSET(SC_TRAPNO); + SC_OFFSET(SC_CS); + SC_OFFSET(SC_FS); + SC_OFFSET(SC_GS); + SC_OFFSET(SC_EFLAGS); + SC_OFFSET(SC_SIGMASK); +#if 0 + SC_OFFSET(SC_ORIG_RAX); + SC_OFFSET(SC_DS); + SC_OFFSET(SC_ES); + SC_OFFSET(SC_SS); +#endif + return(0); +} diff --git a/trunk/arch/um/sys-x86_64/util/mk_thread.c b/trunk/arch/um/sys-x86_64/util/mk_thread.c new file mode 100644 index 000000000000..15517396e9cf --- /dev/null +++ b/trunk/arch/um/sys-x86_64/util/mk_thread.c @@ -0,0 +1,20 @@ +#include +#include + +int main(int argc, char **argv) +{ + printf("/*\n"); + printf(" * Generated by mk_thread\n"); + printf(" */\n"); + printf("\n"); + printf("#ifndef __UM_THREAD_H\n"); + printf("#define __UM_THREAD_H\n"); + printf("\n"); +#ifdef TASK_EXTERN_PID + printf("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n", + TASK_EXTERN_PID); +#endif + printf("\n"); + printf("#endif\n"); + return(0); +} diff --git a/trunk/arch/um/util/Makefile b/trunk/arch/um/util/Makefile new file mode 100644 index 000000000000..4c7551c28033 --- /dev/null +++ b/trunk/arch/um/util/Makefile @@ -0,0 +1,5 @@ +hostprogs-y := mk_task mk_constants +always := $(hostprogs-y) + +HOSTCFLAGS_mk_task.o := -I$(objtree)/arch/um +HOSTCFLAGS_mk_constants.o := -I$(objtree)/arch/um diff --git a/trunk/arch/um/util/mk_constants.c b/trunk/arch/um/util/mk_constants.c new file mode 100644 index 000000000000..ab217becc36a --- /dev/null +++ b/trunk/arch/um/util/mk_constants.c @@ -0,0 +1,32 @@ +#include +#include + +#define SHOW_INT(sym) printf("#define %s %d\n", #sym, sym) +#define SHOW_STR(sym) printf("#define %s %s\n", #sym, sym) + +int main(int argc, char **argv) +{ + printf("/*\n"); + printf(" * Generated by mk_constants\n"); + printf(" */\n"); + printf("\n"); + printf("#ifndef __UM_CONSTANTS_H\n"); + printf("#define __UM_CONSTANTS_H\n"); + printf("\n"); + + SHOW_INT(UM_KERN_PAGE_SIZE); + + SHOW_STR(UM_KERN_EMERG); + SHOW_STR(UM_KERN_ALERT); + SHOW_STR(UM_KERN_CRIT); + SHOW_STR(UM_KERN_ERR); + SHOW_STR(UM_KERN_WARNING); + SHOW_STR(UM_KERN_NOTICE); + SHOW_STR(UM_KERN_INFO); + SHOW_STR(UM_KERN_DEBUG); + + SHOW_INT(UM_NSEC_PER_SEC); + printf("\n"); + printf("#endif\n"); + return(0); +} diff --git a/trunk/arch/um/util/mk_task.c b/trunk/arch/um/util/mk_task.c new file mode 100644 index 000000000000..36c9606505e2 --- /dev/null +++ b/trunk/arch/um/util/mk_task.c @@ -0,0 +1,30 @@ +#include +#include + +void print_ptr(char *name, char *type, int offset) +{ + printf("#define %s(task) ((%s *) &(((char *) (task))[%d]))\n", name, type, + offset); +} + +void print(char *name, char *type, int offset) +{ + printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type, + offset); +} + +int main(int argc, char **argv) +{ + printf("/*\n"); + printf(" * Generated by mk_task\n"); + printf(" */\n"); + printf("\n"); + printf("#ifndef __TASK_H\n"); + printf("#define __TASK_H\n"); + printf("\n"); + print_ptr("TASK_REGS", "union uml_pt_regs", TASK_REGS); + print("TASK_PID", "int", TASK_PID); + printf("\n"); + printf("#endif\n"); + return(0); +} diff --git a/trunk/arch/x86_64/ia32/ia32_signal.c b/trunk/arch/x86_64/ia32/ia32_signal.c index 0903cc1faef2..66e2821533db 100644 --- a/trunk/arch/x86_64/ia32/ia32_signal.c +++ b/trunk/arch/x86_64/ia32/ia32_signal.c @@ -425,11 +425,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) rsp = (unsigned long) ka->sa.sa_restorer; } - rsp -= frame_size; - /* Align the stack pointer according to the i386 ABI, - * i.e. so that on function entry ((sp + 4) & 15) == 0. */ - rsp = ((rsp + 4) & -16ul) - 4; - return (void __user *) rsp; + return (void __user *)((rsp - frame_size) & -8UL); } int ia32_setup_frame(int sig, struct k_sigaction *ka, diff --git a/trunk/arch/x86_64/kernel/head.S b/trunk/arch/x86_64/kernel/head.S index b92e5f45ed46..4592bf21fcaf 100644 --- a/trunk/arch/x86_64/kernel/head.S +++ b/trunk/arch/x86_64/kernel/head.S @@ -270,26 +270,26 @@ ENTRY(level3_kernel_pgt) .org 0x4000 ENTRY(level2_ident_pgt) /* 40MB for bootup. */ - .quad 0x0000000000000083 - .quad 0x0000000000200083 - .quad 0x0000000000400083 - .quad 0x0000000000600083 - .quad 0x0000000000800083 - .quad 0x0000000000A00083 - .quad 0x0000000000C00083 - .quad 0x0000000000E00083 - .quad 0x0000000001000083 - .quad 0x0000000001200083 - .quad 0x0000000001400083 - .quad 0x0000000001600083 - .quad 0x0000000001800083 - .quad 0x0000000001A00083 - .quad 0x0000000001C00083 - .quad 0x0000000001E00083 - .quad 0x0000000002000083 - .quad 0x0000000002200083 - .quad 0x0000000002400083 - .quad 0x0000000002600083 + .quad 0x0000000000000183 + .quad 0x0000000000200183 + .quad 0x0000000000400183 + .quad 0x0000000000600183 + .quad 0x0000000000800183 + .quad 0x0000000000A00183 + .quad 0x0000000000C00183 + .quad 0x0000000000E00183 + .quad 0x0000000001000183 + .quad 0x0000000001200183 + .quad 0x0000000001400183 + .quad 0x0000000001600183 + .quad 0x0000000001800183 + .quad 0x0000000001A00183 + .quad 0x0000000001C00183 + .quad 0x0000000001E00183 + .quad 0x0000000002000183 + .quad 0x0000000002200183 + .quad 0x0000000002400183 + .quad 0x0000000002600183 /* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */ .globl temp_boot_pmds temp_boot_pmds: diff --git a/trunk/arch/x86_64/kernel/kprobes.c b/trunk/arch/x86_64/kernel/kprobes.c index 76a28b007be9..df08c43276a0 100644 --- a/trunk/arch/x86_64/kernel/kprobes.c +++ b/trunk/arch/x86_64/kernel/kprobes.c @@ -77,9 +77,9 @@ static inline int is_IF_modifier(kprobe_opcode_t *insn) int __kprobes arch_prepare_kprobe(struct kprobe *p) { /* insn: must be on special executable page on x86_64. */ - down(&kprobe_mutex); - p->ainsn.insn = get_insn_slot(); up(&kprobe_mutex); + p->ainsn.insn = get_insn_slot(); + down(&kprobe_mutex); if (!p->ainsn.insn) { return -ENOMEM; } @@ -231,9 +231,9 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) void __kprobes arch_remove_kprobe(struct kprobe *p) { - down(&kprobe_mutex); - free_insn_slot(p->ainsn.insn); up(&kprobe_mutex); + free_insn_slot(p->ainsn.insn); + down(&kprobe_mutex); } static inline void save_previous_kprobe(void) diff --git a/trunk/arch/x86_64/kernel/mce.c b/trunk/arch/x86_64/kernel/mce.c index 69541db5ff2c..08203b07f4bd 100644 --- a/trunk/arch/x86_64/kernel/mce.c +++ b/trunk/arch/x86_64/kernel/mce.c @@ -54,12 +54,9 @@ void mce_log(struct mce *mce) { unsigned next, entry; mce->finished = 0; - wmb(); + smp_wmb(); for (;;) { entry = rcu_dereference(mcelog.next); - /* The rmb forces the compiler to reload next in each - iteration */ - rmb(); for (;;) { /* When the buffer fills up discard new entries. Assume that the earlier errors are the more interesting. */ @@ -72,7 +69,6 @@ void mce_log(struct mce *mce) entry++; continue; } - break; } smp_rmb(); next = entry + 1; @@ -80,9 +76,9 @@ void mce_log(struct mce *mce) break; } memcpy(mcelog.entry + entry, mce, sizeof(struct mce)); - wmb(); + smp_wmb(); mcelog.entry[entry].finished = 1; - wmb(); + smp_wmb(); if (!test_and_set_bit(0, &console_logged)) notify_user = 1; diff --git a/trunk/arch/x86_64/kernel/setup.c b/trunk/arch/x86_64/kernel/setup.c index cb28df14ff6f..238f73e1a834 100644 --- a/trunk/arch/x86_64/kernel/setup.c +++ b/trunk/arch/x86_64/kernel/setup.c @@ -831,6 +831,8 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) #endif } +#define HWCR 0xc0010015 + static int __init init_amd(struct cpuinfo_x86 *c) { int r; @@ -839,18 +841,14 @@ static int __init init_amd(struct cpuinfo_x86 *c) #ifdef CONFIG_SMP unsigned long value; - /* - * Disable TLB flush filter by setting HWCR.FFDIS on K8 - * bit 6 of msr C001_0015 - * - * Errata 63 for SH-B3 steppings - * Errata 122 for all steppings (F+ have it disabled by default) - */ - if (c->x86 == 15) { - rdmsrl(MSR_K8_HWCR, value); - value |= 1 << 6; - wrmsrl(MSR_K8_HWCR, value); - } + // Disable TLB flush filter by setting HWCR.FFDIS: + // bit 6 of msr C001_0015 + // + // Errata 63 for SH-B3 steppings + // Errata 122 for all(?) steppings + rdmsrl(HWCR, value); + value |= 1 << 6; + wrmsrl(HWCR, value); #endif /* Bit 31 in normal CPUID used for nonstandard 3DNow ID; @@ -967,12 +965,13 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c) static void srat_detect_node(void) { #ifdef CONFIG_NUMA - unsigned node; + unsigned apicid, node; int cpu = smp_processor_id(); /* Don't do the funky fallback heuristics the AMD version employs for now. */ - node = apicid_to_node[hard_smp_processor_id()]; + apicid = phys_proc_id[cpu]; + node = apicid_to_node[apicid]; if (node == NUMA_NO_NODE) node = 0; cpu_to_node[cpu] = node; diff --git a/trunk/arch/x86_64/kernel/setup64.c b/trunk/arch/x86_64/kernel/setup64.c index 79190891fbc5..bd33be24a386 100644 --- a/trunk/arch/x86_64/kernel/setup64.c +++ b/trunk/arch/x86_64/kernel/setup64.c @@ -87,10 +87,6 @@ void __init setup_per_cpu_areas(void) int i; unsigned long size; -#ifdef CONFIG_HOTPLUG_CPU - prefill_possible_map(); -#endif - /* Copy section for each CPU (we discard the original) */ size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); #ifdef CONFIG_MODULES diff --git a/trunk/arch/x86_64/kernel/smpboot.c b/trunk/arch/x86_64/kernel/smpboot.c index 658a81b33f3b..e12d7baeb33e 100644 --- a/trunk/arch/x86_64/kernel/smpboot.c +++ b/trunk/arch/x86_64/kernel/smpboot.c @@ -892,7 +892,7 @@ static __init void disable_smp(void) * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range. * - Ashok Raj */ -__init void prefill_possible_map(void) +static void prefill_possible_map(void) { int i; for (i = 0; i < NR_CPUS; i++) @@ -967,6 +967,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus) current_cpu_data = boot_cpu_data; current_thread_info()->cpu = 0; /* needed? */ +#ifdef CONFIG_HOTPLUG_CPU + prefill_possible_map(); +#endif + if (smp_sanity_check(max_cpus) < 0) { printk(KERN_INFO "SMP disabled\n"); disable_smp(); diff --git a/trunk/arch/x86_64/kernel/suspend.c b/trunk/arch/x86_64/kernel/suspend.c index f066c6ab3618..ebb9abf3ce6d 100644 --- a/trunk/arch/x86_64/kernel/suspend.c +++ b/trunk/arch/x86_64/kernel/suspend.c @@ -11,8 +11,6 @@ #include #include #include -#include -#include struct saved_context saved_context; @@ -142,129 +140,4 @@ void fix_processor_context(void) } -#ifdef CONFIG_SOFTWARE_SUSPEND -/* Defined in arch/x86_64/kernel/suspend_asm.S */ -extern int restore_image(void); -pgd_t *temp_level4_pgt; - -static void **pages; - -static inline void *__add_page(void) -{ - void **c; - - c = (void **)get_usable_page(GFP_ATOMIC); - if (c) { - *c = pages; - pages = c; - } - return c; -} - -static inline void *__next_page(void) -{ - void **c; - - c = pages; - if (c) { - pages = *c; - *c = NULL; - } - return c; -} - -/* - * Try to allocate as many usable pages as needed and daisy chain them. - * If one allocation fails, free the pages allocated so far - */ -static int alloc_usable_pages(unsigned long n) -{ - void *p; - - pages = NULL; - do - if (!__add_page()) - break; - while (--n); - if (n) { - p = __next_page(); - while (p) { - free_page((unsigned long)p); - p = __next_page(); - } - return -ENOMEM; - } - return 0; -} - -static void res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) -{ - long i, j; - - i = pud_index(address); - pud = pud + i; - for (; i < PTRS_PER_PUD; pud++, i++) { - unsigned long paddr; - pmd_t *pmd; - - paddr = address + i*PUD_SIZE; - if (paddr >= end) - break; - - pmd = (pmd_t *)__next_page(); - set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE)); - for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) { - unsigned long pe; - - if (paddr >= end) - break; - pe = _PAGE_NX | _PAGE_PSE | _KERNPG_TABLE | paddr; - pe &= __supported_pte_mask; - set_pmd(pmd, __pmd(pe)); - } - } -} - -static void set_up_temporary_mappings(void) -{ - unsigned long start, end, next; - - temp_level4_pgt = (pgd_t *)__next_page(); - - /* It is safe to reuse the original kernel mapping */ - set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map), - init_level4_pgt[pgd_index(__START_KERNEL_map)]); - - /* Set up the direct mapping from scratch */ - start = (unsigned long)pfn_to_kaddr(0); - end = (unsigned long)pfn_to_kaddr(end_pfn); - - for (; start < end; start = next) { - pud_t *pud = (pud_t *)__next_page(); - next = start + PGDIR_SIZE; - if (next > end) - next = end; - res_phys_pud_init(pud, __pa(start), __pa(next)); - set_pgd(temp_level4_pgt + pgd_index(start), - mk_kernel_pgd(__pa(pud))); - } -} - -int swsusp_arch_resume(void) -{ - unsigned long n; - - n = ((end_pfn << PAGE_SHIFT) + PUD_SIZE - 1) >> PUD_SHIFT; - n += (n + PTRS_PER_PUD - 1) / PTRS_PER_PUD + 1; - pr_debug("swsusp_arch_resume(): pages needed = %lu\n", n); - if (alloc_usable_pages(n)) { - free_eaten_memory(); - return -ENOMEM; - } - /* We have got enough memory and from now on we cannot recover */ - set_up_temporary_mappings(); - restore_image(); - return 0; -} -#endif /* CONFIG_SOFTWARE_SUSPEND */ diff --git a/trunk/arch/x86_64/kernel/suspend_asm.S b/trunk/arch/x86_64/kernel/suspend_asm.S index 320b6fb00cca..4d659e97df10 100644 --- a/trunk/arch/x86_64/kernel/suspend_asm.S +++ b/trunk/arch/x86_64/kernel/suspend_asm.S @@ -39,13 +39,12 @@ ENTRY(swsusp_arch_suspend) call swsusp_save ret -ENTRY(restore_image) - /* switch to temporary page tables */ - movq $__PAGE_OFFSET, %rdx - movq temp_level4_pgt(%rip), %rax - subq %rdx, %rax - movq %rax, %cr3 - /* Flush TLB */ +ENTRY(swsusp_arch_resume) + /* set up cr3 */ + leaq init_level4_pgt(%rip),%rax + subq $__START_KERNEL_map,%rax + movq %rax,%cr3 + movq mmu_cr4_features(%rip), %rax movq %rax, %rdx andq $~(1<<7), %rdx # PGE @@ -70,10 +69,6 @@ loop: movq pbe_next(%rdx), %rdx jmp loop done: - /* go back to the original page tables */ - leaq init_level4_pgt(%rip), %rax - subq $__START_KERNEL_map, %rax - movq %rax, %cr3 /* Flush TLB, including "global" things (vmalloc) */ movq mmu_cr4_features(%rip), %rax movq %rax, %rdx diff --git a/trunk/arch/x86_64/kernel/time.c b/trunk/arch/x86_64/kernel/time.c index 703acde2a1a5..2373cb8b8625 100644 --- a/trunk/arch/x86_64/kernel/time.c +++ b/trunk/arch/x86_64/kernel/time.c @@ -959,6 +959,9 @@ static __init int unsynchronized_tsc(void) are handled in the OEM check above. */ if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) return 0; + /* All in a single socket - should be synchronized */ + if (cpus_weight(cpu_core_map[0]) == num_online_cpus()) + return 0; #endif /* Assume multi socket systems are not synchronized */ return num_online_cpus() > 1; diff --git a/trunk/arch/x86_64/mm/numa.c b/trunk/arch/x86_64/mm/numa.c index 214803821001..80a49d9bd8a7 100644 --- a/trunk/arch/x86_64/mm/numa.c +++ b/trunk/arch/x86_64/mm/numa.c @@ -167,16 +167,18 @@ void __init numa_init_array(void) mapping. To avoid this fill in the mapping for all possible CPUs, as the number of CPUs is not known yet. We round robin the existing nodes. */ - rr = first_node(node_online_map); + rr = 0; for (i = 0; i < NR_CPUS; i++) { if (cpu_to_node[i] != NUMA_NO_NODE) continue; - cpu_to_node[i] = rr; rr = next_node(rr, node_online_map); if (rr == MAX_NUMNODES) rr = first_node(node_online_map); + cpu_to_node[i] = rr; + rr++; } + set_bit(0, &node_to_cpumask[cpu_to_node(0)]); } #ifdef CONFIG_NUMA_EMU @@ -264,7 +266,9 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) __cpuinit void numa_add_cpu(int cpu) { - set_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]); + /* BP is initialized elsewhere */ + if (cpu) + set_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]); } unsigned long __init numa_free_all_bootmem(void) diff --git a/trunk/arch/x86_64/mm/pageattr.c b/trunk/arch/x86_64/mm/pageattr.c index b90e8fe9eeb0..94862e1ec032 100644 --- a/trunk/arch/x86_64/mm/pageattr.c +++ b/trunk/arch/x86_64/mm/pageattr.c @@ -220,6 +220,8 @@ void global_flush_tlb(void) down_read(&init_mm.mmap_sem); df = xchg(&df_list, NULL); up_read(&init_mm.mmap_sem); + if (!df) + return; flush_map((df && !df->next) ? df->address : 0); for (; df; df = next_df) { next_df = df->next; diff --git a/trunk/drivers/acpi/event.c b/trunk/drivers/acpi/event.c index 2dbb1b0f11d5..bfa8b76de403 100644 --- a/trunk/drivers/acpi/event.c +++ b/trunk/drivers/acpi/event.c @@ -58,8 +58,9 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, return_VALUE(-EAGAIN); result = acpi_bus_receive_event(&event); - if (result) - return_VALUE(result); + if (result) { + return_VALUE(-EIO); + } chars_remaining = sprintf(str, "%s %s %08x %08x\n", event.device_class ? event. diff --git a/trunk/drivers/atm/ambassador.c b/trunk/drivers/atm/ambassador.c index 4b6bf19c39c0..d74a7c5e75dd 100644 --- a/trunk/drivers/atm/ambassador.c +++ b/trunk/drivers/atm/ambassador.c @@ -795,7 +795,7 @@ static void drain_rx_pools (amb_dev * dev) { } static inline void fill_rx_pool (amb_dev * dev, unsigned char pool, - gfp_t priority) + unsigned int __nocast priority) { rx_in rx; amb_rxq * rxq; diff --git a/trunk/drivers/atm/firestream.c b/trunk/drivers/atm/firestream.c index 7f7ec288824d..58219744f5db 100644 --- a/trunk/drivers/atm/firestream.c +++ b/trunk/drivers/atm/firestream.c @@ -1374,7 +1374,8 @@ static void reset_chip (struct fs_dev *dev) } } -static void __devinit *aligned_kmalloc (int size, gfp_t flags, int alignment) +static void __devinit *aligned_kmalloc (int size, unsigned int __nocast flags, + int alignment) { void *t; @@ -1465,7 +1466,7 @@ static inline int nr_buffers_in_freepool (struct fs_dev *dev, struct freepool *f working again after that... -- REW */ static void top_off_fp (struct fs_dev *dev, struct freepool *fp, - gfp_t gfp_flags) + unsigned int __nocast gfp_flags) { struct FS_BPENTRY *qe, *ne; struct sk_buff *skb; diff --git a/trunk/drivers/atm/fore200e.c b/trunk/drivers/atm/fore200e.c index 14f6a6201da3..2bf723a7b6e6 100644 --- a/trunk/drivers/atm/fore200e.c +++ b/trunk/drivers/atm/fore200e.c @@ -178,12 +178,14 @@ fore200e_irq_itoa(int irq) static void* -fore200e_kmalloc(int size, gfp_t flags) +fore200e_kmalloc(int size, int flags) { - void *chunk = kzalloc(size, flags); + void* chunk = kmalloc(size, flags); - if (!chunk) - printk(FORE200E "kmalloc() failed, requested size = %d, flags = 0x%x\n", size, flags); + if (chunk) + memset(chunk, 0x00, size); + else + printk(FORE200E "kmalloc() failed, requested size = %d, flags = 0x%x\n", size, flags); return chunk; } diff --git a/trunk/drivers/base/dmapool.c b/trunk/drivers/base/dmapool.c index e2f64f91ed05..60a7ef6a201b 100644 --- a/trunk/drivers/base/dmapool.c +++ b/trunk/drivers/base/dmapool.c @@ -156,7 +156,7 @@ dma_pool_create (const char *name, struct device *dev, static struct dma_page * -pool_alloc_page (struct dma_pool *pool, gfp_t mem_flags) +pool_alloc_page (struct dma_pool *pool, unsigned int __nocast mem_flags) { struct dma_page *page; int mapsize; @@ -262,7 +262,8 @@ dma_pool_destroy (struct dma_pool *pool) * If such a memory block can't be allocated, null is returned. */ void * -dma_pool_alloc (struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle) +dma_pool_alloc (struct dma_pool *pool, unsigned int __nocast mem_flags, + dma_addr_t *handle) { unsigned long flags; struct dma_page *page; diff --git a/trunk/drivers/block/pktcdvd.c b/trunk/drivers/block/pktcdvd.c index a280e679b1ca..7e22a58926b8 100644 --- a/trunk/drivers/block/pktcdvd.c +++ b/trunk/drivers/block/pktcdvd.c @@ -229,7 +229,7 @@ static int pkt_grow_pktlist(struct pktcdvd_device *pd, int nr_packets) return 1; } -static void *pkt_rb_alloc(gfp_t gfp_mask, void *data) +static void *pkt_rb_alloc(unsigned int __nocast gfp_mask, void *data) { return kmalloc(sizeof(struct pkt_rb_node), gfp_mask); } @@ -2082,7 +2082,7 @@ static int pkt_close(struct inode *inode, struct file *file) } -static void *psd_pool_alloc(gfp_t gfp_mask, void *data) +static void *psd_pool_alloc(unsigned int __nocast gfp_mask, void *data) { return kmalloc(sizeof(struct packet_stacked_data), gfp_mask); } diff --git a/trunk/drivers/block/scsi_ioctl.c b/trunk/drivers/block/scsi_ioctl.c index 382dea7b224c..079ec344eb47 100644 --- a/trunk/drivers/block/scsi_ioctl.c +++ b/trunk/drivers/block/scsi_ioctl.c @@ -201,15 +201,15 @@ static int verify_command(struct file *file, unsigned char *cmd) return 0; } - /* And root can do any command.. */ - if (capable(CAP_SYS_RAWIO)) - return 0; - if (!type) { cmd_type[cmd[0]] = CMD_WARNED; printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]); } + /* And root can do any command.. */ + if (capable(CAP_SYS_RAWIO)) + return 0; + /* Otherwise fail it with an "Operation not permitted" */ return -EPERM; } diff --git a/trunk/drivers/bluetooth/bpa10x.c b/trunk/drivers/bluetooth/bpa10x.c index 4fa85234d8b5..a1bf8f066c88 100644 --- a/trunk/drivers/bluetooth/bpa10x.c +++ b/trunk/drivers/bluetooth/bpa10x.c @@ -308,7 +308,7 @@ static void bpa10x_complete(struct urb *urb, struct pt_regs *regs) } static inline struct urb *bpa10x_alloc_urb(struct usb_device *udev, unsigned int pipe, - size_t size, gfp_t flags, void *data) + size_t size, unsigned int __nocast flags, void *data) { struct urb *urb; struct usb_ctrlrequest *cr; diff --git a/trunk/drivers/bluetooth/hci_usb.c b/trunk/drivers/bluetooth/hci_usb.c index 6756cb20b753..57c48bbf6fe6 100644 --- a/trunk/drivers/bluetooth/hci_usb.c +++ b/trunk/drivers/bluetooth/hci_usb.c @@ -132,7 +132,7 @@ static struct usb_device_id blacklist_ids[] = { { } /* Terminating entry */ }; -static struct _urb *_urb_alloc(int isoc, gfp_t gfp) +static struct _urb *_urb_alloc(int isoc, unsigned int __nocast gfp) { struct _urb *_urb = kmalloc(sizeof(struct _urb) + sizeof(struct usb_iso_packet_descriptor) * isoc, gfp); diff --git a/trunk/drivers/char/drm/drm_drv.c b/trunk/drivers/char/drm/drm_drv.c index 041bb47b5c39..6ba48f346fcf 100644 --- a/trunk/drivers/char/drm/drm_drv.c +++ b/trunk/drivers/char/drm/drm_drv.c @@ -376,7 +376,7 @@ static int __init drm_core_init(void) goto err_p2; } - drm_proc_root = proc_mkdir("dri", NULL); + drm_proc_root = create_proc_entry("dri", S_IFDIR, NULL); if (!drm_proc_root) { DRM_ERROR("Cannot create /proc/dri\n"); ret = -1; diff --git a/trunk/drivers/char/drm/drm_proc.c b/trunk/drivers/char/drm/drm_proc.c index 977961002488..32d2bb99462c 100644 --- a/trunk/drivers/char/drm/drm_proc.c +++ b/trunk/drivers/char/drm/drm_proc.c @@ -95,7 +95,7 @@ int drm_proc_init(drm_device_t *dev, int minor, char name[64]; sprintf(name, "%d", minor); - *dev_root = proc_mkdir(name, root); + *dev_root = create_proc_entry(name, S_IFDIR, root); if (!*dev_root) { DRM_ERROR("Cannot create /proc/dri/%s\n", name); return -1; diff --git a/trunk/drivers/char/drm/drm_stub.c b/trunk/drivers/char/drm/drm_stub.c index 70458cb061c6..95a976c96eb8 100644 --- a/trunk/drivers/char/drm/drm_stub.c +++ b/trunk/drivers/char/drm/drm_stub.c @@ -47,7 +47,7 @@ MODULE_PARM_DESC(cards_limit, "Maximum number of graphics cards"); MODULE_PARM_DESC(debug, "Enable debug output"); module_param_named(cards_limit, drm_cards_limit, int, 0444); -module_param_named(debug, drm_debug, int, 0600); +module_param_named(debug, drm_debug, int, 0666); drm_head_t **drm_heads; struct drm_sysfs_class *drm_class; diff --git a/trunk/drivers/char/ipmi/ipmi_msghandler.c b/trunk/drivers/char/ipmi/ipmi_msghandler.c index 32fa82c78c73..463351d4f942 100644 --- a/trunk/drivers/char/ipmi/ipmi_msghandler.c +++ b/trunk/drivers/char/ipmi/ipmi_msghandler.c @@ -2620,7 +2620,7 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, spin_lock_irqsave(&(intf->waiting_msgs_lock), flags); if (!list_empty(&(intf->waiting_msgs))) { list_add_tail(&(msg->link), &(intf->waiting_msgs)); - spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags); + spin_unlock(&(intf->waiting_msgs_lock)); goto out_unlock; } spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags); @@ -2629,9 +2629,9 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, if (rv > 0) { /* Could not handle the message now, just add it to a list to handle later. */ - spin_lock_irqsave(&(intf->waiting_msgs_lock), flags); + spin_lock(&(intf->waiting_msgs_lock)); list_add_tail(&(msg->link), &(intf->waiting_msgs)); - spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags); + spin_unlock(&(intf->waiting_msgs_lock)); } else if (rv == 0) { ipmi_free_smi_msg(msg); } diff --git a/trunk/drivers/char/ipmi/ipmi_poweroff.c b/trunk/drivers/char/ipmi/ipmi_poweroff.c index f66947722e12..e82a96ba396b 100644 --- a/trunk/drivers/char/ipmi/ipmi_poweroff.c +++ b/trunk/drivers/char/ipmi/ipmi_poweroff.c @@ -55,7 +55,7 @@ extern void (*pm_power_off)(void); static int poweroff_powercycle; /* parameter definition to allow user to flag power cycle */ -module_param(poweroff_powercycle, int, 0644); +module_param(poweroff_powercycle, int, 0); MODULE_PARM_DESC(poweroff_powercycles, " Set to non-zero to enable power cycle instead of power down. Power cycle is contingent on hardware support, otherwise it defaults back to power down."); /* Stuff from the get device id command. */ diff --git a/trunk/drivers/char/mbcs.c b/trunk/drivers/char/mbcs.c index c268ee04b2aa..3fa64c631108 100644 --- a/trunk/drivers/char/mbcs.c +++ b/trunk/drivers/char/mbcs.c @@ -830,9 +830,6 @@ static int __init mbcs_init(void) { int rv; - if (!ia64_platform_is("sn2")) - return -ENODEV; - // Put driver into chrdevs[]. Get major number. rv = register_chrdev(mbcs_major, DEVICE_NAME, &mbcs_ops); if (rv < 0) { diff --git a/trunk/drivers/char/n_r3964.c b/trunk/drivers/char/n_r3964.c index 853c98cee64f..2291a87e8ada 100644 --- a/trunk/drivers/char/n_r3964.c +++ b/trunk/drivers/char/n_r3964.c @@ -229,8 +229,8 @@ static int __init r3964_init(void) TRACE_L("line discipline %d registered", N_R3964); TRACE_L("flags=%x num=%x", tty_ldisc_N_R3964.flags, tty_ldisc_N_R3964.num); - TRACE_L("open=%p", tty_ldisc_N_R3964.open); - TRACE_L("tty_ldisc_N_R3964 = %p", &tty_ldisc_N_R3964); + TRACE_L("open=%x", (int)tty_ldisc_N_R3964.open); + TRACE_L("tty_ldisc_N_R3964 = %x", (int)&tty_ldisc_N_R3964); } else { @@ -267,8 +267,8 @@ static void add_tx_queue(struct r3964_info *pInfo, struct r3964_block_header *pH spin_unlock_irqrestore(&pInfo->lock, flags); - TRACE_Q("add_tx_queue %p, length %d, tx_first = %p", - pHeader, pHeader->length, pInfo->tx_first ); + TRACE_Q("add_tx_queue %x, length %d, tx_first = %x", + (int)pHeader, pHeader->length, (int)pInfo->tx_first ); } static 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) return; #ifdef DEBUG_QUEUE - printk("r3964: remove_from_tx_queue: %p, length %u - ", - pHeader, pHeader->length ); + printk("r3964: remove_from_tx_queue: %x, length %d - ", + (int)pHeader, (int)pHeader->length ); for(pDump=pHeader;pDump;pDump=pDump->next) - printk("%p ", pDump); + printk("%x ", (int)pDump); printk("\n"); #endif @@ -319,10 +319,10 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code) spin_unlock_irqrestore(&pInfo->lock, flags); kfree(pHeader); - TRACE_M("remove_from_tx_queue - kfree %p",pHeader); + TRACE_M("remove_from_tx_queue - kfree %x",(int)pHeader); - TRACE_Q("remove_from_tx_queue: tx_first = %p, tx_last = %p", - pInfo->tx_first, pInfo->tx_last ); + TRACE_Q("remove_from_tx_queue: tx_first = %x, tx_last = %x", + (int)pInfo->tx_first, (int)pInfo->tx_last ); } static 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 spin_unlock_irqrestore(&pInfo->lock, flags); - TRACE_Q("add_rx_queue: %p, length = %d, rx_first = %p, count = %d", - pHeader, pHeader->length, - pInfo->rx_first, pInfo->blocks_in_rx_queue); + TRACE_Q("add_rx_queue: %x, length = %d, rx_first = %x, count = %d", + (int)pHeader, pHeader->length, + (int)pInfo->rx_first, pInfo->blocks_in_rx_queue); } static void remove_from_rx_queue(struct r3964_info *pInfo, @@ -360,10 +360,10 @@ static void remove_from_rx_queue(struct r3964_info *pInfo, if(pHeader==NULL) return; - TRACE_Q("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d", - pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue ); - TRACE_Q("remove_from_rx_queue: %p, length %u", - pHeader, pHeader->length ); + TRACE_Q("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d", + (int)pInfo->rx_first, (int)pInfo->rx_last, pInfo->blocks_in_rx_queue ); + TRACE_Q("remove_from_rx_queue: %x, length %d", + (int)pHeader, (int)pHeader->length ); spin_lock_irqsave(&pInfo->lock, flags); @@ -401,10 +401,10 @@ static void remove_from_rx_queue(struct r3964_info *pInfo, spin_unlock_irqrestore(&pInfo->lock, flags); kfree(pHeader); - TRACE_M("remove_from_rx_queue - kfree %p",pHeader); + TRACE_M("remove_from_rx_queue - kfree %x",(int)pHeader); - TRACE_Q("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d", - pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue ); + TRACE_Q("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d", + (int)pInfo->rx_first, (int)pInfo->rx_last, pInfo->blocks_in_rx_queue ); } static void put_char(struct r3964_info *pInfo, unsigned char ch) @@ -506,8 +506,8 @@ static void transmit_block(struct r3964_info *pInfo) if(tty->driver->write_room) room=tty->driver->write_room(tty); - TRACE_PS("transmit_block %p, room %d, length %d", - pBlock, room, pBlock->length); + TRACE_PS("transmit_block %x, room %d, length %d", + (int)pBlock, room, pBlock->length); while(pInfo->tx_position < pBlock->length) { @@ -588,7 +588,7 @@ static void on_receive_block(struct r3964_info *pInfo) /* prepare struct r3964_block_header: */ pBlock = kmalloc(length+sizeof(struct r3964_block_header), GFP_KERNEL); - TRACE_M("on_receive_block - kmalloc %p",pBlock); + TRACE_M("on_receive_block - kmalloc %x",(int)pBlock); if(pBlock==NULL) return; @@ -695,7 +695,7 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c) { TRACE_PE("IDLE - got STX but no space in rx_queue!"); pInfo->state=R3964_WAIT_FOR_RX_BUF; - mod_timer(&pInfo->tmr, jiffies + R3964_TO_NO_BUF); + mod_timer(&pInfo->tmr, R3964_TO_NO_BUF); break; } start_receiving: @@ -705,7 +705,7 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c) pInfo->last_rx = 0; pInfo->flags &= ~R3964_ERROR; pInfo->state=R3964_RECEIVING; - mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); + mod_timer(&pInfo->tmr, R3964_TO_ZVZ); pInfo->nRetry = 0; put_char(pInfo, DLE); flush(pInfo); @@ -732,7 +732,7 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c) if(pInfo->flags & R3964_BCC) { pInfo->state = R3964_WAIT_FOR_BCC; - mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); + mod_timer(&pInfo->tmr, R3964_TO_ZVZ); } else { @@ -744,7 +744,7 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c) pInfo->last_rx = c; char_to_buf: pInfo->rx_buf[pInfo->rx_position++] = c; - mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); + mod_timer(&pInfo->tmr, R3964_TO_ZVZ); } } /* else: overflow-msg? BUF_SIZE>MTU; should not happen? */ @@ -868,11 +868,11 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) if(pMsg) { kfree(pMsg); - TRACE_M("enable_signals - msg kfree %p",pMsg); + TRACE_M("enable_signals - msg kfree %x",(int)pMsg); } } kfree(pClient); - TRACE_M("enable_signals - kfree %p",pClient); + TRACE_M("enable_signals - kfree %x",(int)pClient); return 0; } } @@ -890,7 +890,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) { /* add client to client list */ pClient=kmalloc(sizeof(struct r3964_client_info), GFP_KERNEL); - TRACE_M("enable_signals - kmalloc %p",pClient); + TRACE_M("enable_signals - kmalloc %x",(int)pClient); if(pClient==NULL) return -ENOMEM; @@ -954,7 +954,7 @@ static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg, queue_the_message: pMsg = kmalloc(sizeof(struct r3964_message), GFP_KERNEL); - TRACE_M("add_msg - kmalloc %p",pMsg); + TRACE_M("add_msg - kmalloc %x",(int)pMsg); if(pMsg==NULL) { return; } @@ -1067,11 +1067,11 @@ static int r3964_open(struct tty_struct *tty) struct r3964_info *pInfo; TRACE_L("open"); - TRACE_L("tty=%p, PID=%d, disc_data=%p", - tty, current->pid, tty->disc_data); + TRACE_L("tty=%x, PID=%d, disc_data=%x", + (int)tty, current->pid, (int)tty->disc_data); pInfo=kmalloc(sizeof(struct r3964_info), GFP_KERNEL); - TRACE_M("r3964_open - info kmalloc %p",pInfo); + TRACE_M("r3964_open - info kmalloc %x",(int)pInfo); if(!pInfo) { @@ -1080,26 +1080,26 @@ static int r3964_open(struct tty_struct *tty) } pInfo->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL); - TRACE_M("r3964_open - rx_buf kmalloc %p",pInfo->rx_buf); + TRACE_M("r3964_open - rx_buf kmalloc %x",(int)pInfo->rx_buf); if(!pInfo->rx_buf) { printk(KERN_ERR "r3964: failed to alloc receive buffer\n"); kfree(pInfo); - TRACE_M("r3964_open - info kfree %p",pInfo); + TRACE_M("r3964_open - info kfree %x",(int)pInfo); return -ENOMEM; } pInfo->tx_buf = kmalloc(TX_BUF_SIZE, GFP_KERNEL); - TRACE_M("r3964_open - tx_buf kmalloc %p",pInfo->tx_buf); + TRACE_M("r3964_open - tx_buf kmalloc %x",(int)pInfo->tx_buf); if(!pInfo->tx_buf) { printk(KERN_ERR "r3964: failed to alloc transmit buffer\n"); kfree(pInfo->rx_buf); - TRACE_M("r3964_open - rx_buf kfree %p",pInfo->rx_buf); + TRACE_M("r3964_open - rx_buf kfree %x",(int)pInfo->rx_buf); kfree(pInfo); - TRACE_M("r3964_open - info kfree %p",pInfo); + TRACE_M("r3964_open - info kfree %x",(int)pInfo); return -ENOMEM; } @@ -1154,11 +1154,11 @@ static void r3964_close(struct tty_struct *tty) if(pMsg) { kfree(pMsg); - TRACE_M("r3964_close - msg kfree %p",pMsg); + TRACE_M("r3964_close - msg kfree %x",(int)pMsg); } } kfree(pClient); - TRACE_M("r3964_close - client kfree %p",pClient); + TRACE_M("r3964_close - client kfree %x",(int)pClient); pClient=pNext; } /* Remove jobs from tx_queue: */ @@ -1177,11 +1177,11 @@ static void r3964_close(struct tty_struct *tty) /* Free buffers: */ wake_up_interruptible(&pInfo->read_wait); kfree(pInfo->rx_buf); - TRACE_M("r3964_close - rx_buf kfree %p",pInfo->rx_buf); + TRACE_M("r3964_close - rx_buf kfree %x",(int)pInfo->rx_buf); kfree(pInfo->tx_buf); - TRACE_M("r3964_close - tx_buf kfree %p",pInfo->tx_buf); + TRACE_M("r3964_close - tx_buf kfree %x",(int)pInfo->tx_buf); kfree(pInfo); - TRACE_M("r3964_close - info kfree %p",pInfo); + TRACE_M("r3964_close - info kfree %x",(int)pInfo); } static ssize_t r3964_read(struct tty_struct *tty, struct file *file, @@ -1234,7 +1234,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file, count = sizeof(struct r3964_client_message); kfree(pMsg); - TRACE_M("r3964_read - msg kfree %p",pMsg); + TRACE_M("r3964_read - msg kfree %x",(int)pMsg); if (copy_to_user(buf,&theMsg, count)) return -EFAULT; @@ -1279,7 +1279,7 @@ static ssize_t r3964_write(struct tty_struct * tty, struct file * file, * Allocate a buffer for the data and copy it from the buffer with header prepended */ new_data = kmalloc (count+sizeof(struct r3964_block_header), GFP_KERNEL); - TRACE_M("r3964_write - kmalloc %p",new_data); + TRACE_M("r3964_write - kmalloc %x",(int)new_data); if (new_data == NULL) { if (pInfo->flags & R3964_DEBUG) { diff --git a/trunk/drivers/char/s3c2410-rtc.c b/trunk/drivers/char/s3c2410-rtc.c index e1a90d9a8756..ed867db550a9 100644 --- a/trunk/drivers/char/s3c2410-rtc.c +++ b/trunk/drivers/char/s3c2410-rtc.c @@ -564,7 +564,6 @@ static int s3c2410_rtc_resume(struct device *dev, u32 level) static struct device_driver s3c2410_rtcdrv = { .name = "s3c2410-rtc", - .owner = THIS_MODULE, .bus = &platform_bus_type, .probe = s3c2410_rtc_probe, .remove = s3c2410_rtc_remove, diff --git a/trunk/drivers/char/watchdog/mv64x60_wdt.c b/trunk/drivers/char/watchdog/mv64x60_wdt.c index 6d3ff0836c44..1436aea3b28f 100644 --- a/trunk/drivers/char/watchdog/mv64x60_wdt.c +++ b/trunk/drivers/char/watchdog/mv64x60_wdt.c @@ -87,8 +87,6 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file) mv64x60_wdt_service(); mv64x60_wdt_handler_enable(); - nonseekable_open(inode, file); - return 0; } @@ -105,9 +103,12 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file) return 0; } -static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data, +static ssize_t mv64x60_wdt_write(struct file *file, const char *data, size_t len, loff_t * ppos) { + if (*ppos != file->f_pos) + return -ESPIPE; + if (len) mv64x60_wdt_service(); @@ -118,7 +119,6 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int timeout; - void __user *argp = (void __user *)arg; static struct watchdog_info info = { .options = WDIOF_KEEPALIVEPING, .firmware_version = 0, @@ -127,13 +127,13 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, switch (cmd) { case WDIOC_GETSUPPORT: - if (copy_to_user(argp, &info, sizeof(info))) + if (copy_to_user((void *)arg, &info, sizeof(info))) return -EFAULT; break; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - if (put_user(wdt_status, (int __user *)argp)) + if (put_user(wdt_status, (int *)arg)) return -EFAULT; wdt_status &= ~WDIOF_KEEPALIVEPING; break; @@ -154,7 +154,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, case WDIOC_GETTIMEOUT: timeout = mv64x60_wdt_timeout * HZ; - if (put_user(timeout, (int __user *)argp)) + if (put_user(timeout, (int *)arg)) return -EFAULT; break; diff --git a/trunk/drivers/char/watchdog/pcwd_pci.c b/trunk/drivers/char/watchdog/pcwd_pci.c index 0b8e493be045..5a80adbf8032 100644 --- a/trunk/drivers/char/watchdog/pcwd_pci.c +++ b/trunk/drivers/char/watchdog/pcwd_pci.c @@ -50,8 +50,8 @@ #include /* For inb/outb/... */ /* Module and version information */ -#define WATCHDOG_VERSION "1.02" -#define WATCHDOG_DATE "03 Sep 2005" +#define WATCHDOG_VERSION "1.01" +#define WATCHDOG_DATE "02 Sep 2005" #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" #define WATCHDOG_NAME "pcwd_pci" #define PFX WATCHDOG_NAME ": " @@ -70,30 +70,19 @@ * These are the defines that describe the control status bits for the * PCI-PC Watchdog card. */ -/* Port 1 : Control Status #1 */ -#define WD_PCI_WTRP 0x01 /* Watchdog Trip status */ -#define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */ -#define WD_PCI_TTRP 0x04 /* Temperature Trip status */ -#define WD_PCI_RL2A 0x08 /* Relay 2 Active */ -#define WD_PCI_RL1A 0x10 /* Relay 1 Active */ -#define WD_PCI_R2DS 0x40 /* Relay 2 Disable Temperature-trip/reset */ -#define WD_PCI_RLY2 0x80 /* Activate Relay 2 on the board */ -/* Port 2 : Control Status #2 */ -#define WD_PCI_WDIS 0x10 /* Watchdog Disable */ -#define WD_PCI_ENTP 0x20 /* Enable Temperature Trip Reset */ -#define WD_PCI_WRSP 0x40 /* Watchdog wrote response */ -#define WD_PCI_PCMD 0x80 /* PC has sent command */ +#define WD_PCI_WTRP 0x01 /* Watchdog Trip status */ +#define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */ +#define WD_PCI_TTRP 0x04 /* Temperature Trip status */ /* according to documentation max. time to process a command for the pci * watchdog card is 100 ms, so we give it 150 ms to do it's job */ #define PCI_COMMAND_TIMEOUT 150 /* Watchdog's internal commands */ -#define CMD_GET_STATUS 0x04 -#define CMD_GET_FIRMWARE_VERSION 0x08 -#define CMD_READ_WATCHDOG_TIMEOUT 0x18 -#define CMD_WRITE_WATCHDOG_TIMEOUT 0x19 -#define CMD_GET_CLEAR_RESET_COUNT 0x84 +#define CMD_GET_STATUS 0x04 +#define CMD_GET_FIRMWARE_VERSION 0x08 +#define CMD_READ_WATCHDOG_TIMEOUT 0x18 +#define CMD_WRITE_WATCHDOG_TIMEOUT 0x19 /* We can only use 1 card due to the /dev/watchdog restriction */ static int cards_found; @@ -102,22 +91,15 @@ static int cards_found; static int temp_panic; static unsigned long is_active; static char expect_release; -static struct { /* this is private data for each PCI-PC watchdog card */ - int supports_temp; /* Wether or not the card has a temperature device */ - int boot_status; /* The card's boot status */ - unsigned long io_addr; /* The cards I/O address */ - spinlock_t io_lock; /* the lock for io operations */ - struct pci_dev *pdev; /* the PCI-device */ +static struct { + int supports_temp; /* Wether or not the card has a temperature device */ + int boot_status; /* The card's boot status */ + unsigned long io_addr; /* The cards I/O address */ + spinlock_t io_lock; + struct pci_dev *pdev; } pcipcwd_private; /* module parameters */ -#define QUIET 0 /* Default */ -#define VERBOSE 1 /* Verbose */ -#define DEBUG 2 /* print fancy stuff too */ -static int debug = QUIET; -module_param(debug, int, 0); -MODULE_PARM_DESC(debug, "Debug level: 0=Quiet, 1=Verbose, 2=Debug (default=0)"); - #define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */ static int heartbeat = WATCHDOG_HEARTBEAT; module_param(heartbeat, int, 0); @@ -135,10 +117,6 @@ static int send_command(int cmd, int *msb, int *lsb) { int got_response, count; - if (debug >= DEBUG) - printk(KERN_DEBUG PFX "sending following data cmd=0x%02x msb=0x%02x lsb=0x%02x\n", - cmd, *msb, *lsb); - spin_lock(&pcipcwd_private.io_lock); /* If a command requires data it should be written first. * Data for commands with 8 bits of data should be written to port 4. @@ -153,19 +131,10 @@ static int send_command(int cmd, int *msb, int *lsb) /* wait till the pci card processed the command, signaled by * the WRSP bit in port 2 and give it a max. timeout of * PCI_COMMAND_TIMEOUT to process */ - got_response = inb_p(pcipcwd_private.io_addr + 2) & WD_PCI_WRSP; + got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40; for (count = 0; (count < PCI_COMMAND_TIMEOUT) && (!got_response); count++) { mdelay(1); - got_response = inb_p(pcipcwd_private.io_addr + 2) & WD_PCI_WRSP; - } - - if (debug >= DEBUG) { - if (got_response) { - printk(KERN_DEBUG PFX "time to process command was: %d ms\n", - count); - } else { - printk(KERN_DEBUG PFX "card did not respond on command!\n"); - } + got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40; } if (got_response) { @@ -175,66 +144,12 @@ static int send_command(int cmd, int *msb, int *lsb) /* clear WRSP bit */ inb_p(pcipcwd_private.io_addr + 6); - - if (debug >= DEBUG) - printk(KERN_DEBUG PFX "received following data for cmd=0x%02x: msb=0x%02x lsb=0x%02x\n", - cmd, *msb, *lsb); } - spin_unlock(&pcipcwd_private.io_lock); return got_response; } -static inline void pcipcwd_check_temperature_support(void) -{ - if (inb_p(pcipcwd_private.io_addr) != 0xF0) - pcipcwd_private.supports_temp = 1; -} - -static int pcipcwd_get_option_switches(void) -{ - int option_switches; - - option_switches = inb_p(pcipcwd_private.io_addr + 3); - return option_switches; -} - -static void pcipcwd_show_card_info(void) -{ - int got_fw_rev, fw_rev_major, fw_rev_minor; - char fw_ver_str[20]; /* The cards firmware version */ - int option_switches; - - got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); - if (got_fw_rev) { - sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); - } else { - sprintf(fw_ver_str, ""); - } - - /* Get switch settings */ - option_switches = pcipcwd_get_option_switches(); - - printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n", - (int) pcipcwd_private.io_addr, fw_ver_str, - (pcipcwd_private.supports_temp ? "with" : "without")); - - printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", - option_switches, - ((option_switches & 0x10) ? "ON" : "OFF"), - ((option_switches & 0x08) ? "ON" : "OFF")); - - if (pcipcwd_private.boot_status & WDIOF_CARDRESET) - printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n"); - - if (pcipcwd_private.boot_status & WDIOF_OVERHEAT) - printk(KERN_INFO PFX "Card sensed a CPU Overheat\n"); - - if (pcipcwd_private.boot_status == 0) - printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); -} - static int pcipcwd_start(void) { int stat_reg; @@ -246,14 +161,11 @@ static int pcipcwd_start(void) stat_reg = inb_p(pcipcwd_private.io_addr + 2); spin_unlock(&pcipcwd_private.io_lock); - if (stat_reg & WD_PCI_WDIS) { + if (stat_reg & 0x10) { printk(KERN_ERR PFX "Card timer not enabled\n"); return -1; } - if (debug >= VERBOSE) - printk(KERN_DEBUG PFX "Watchdog started\n"); - return 0; } @@ -271,25 +183,18 @@ static int pcipcwd_stop(void) stat_reg = inb_p(pcipcwd_private.io_addr + 2); spin_unlock(&pcipcwd_private.io_lock); - if (!(stat_reg & WD_PCI_WDIS)) { + if (!(stat_reg & 0x10)) { printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n"); return -1; } - if (debug >= VERBOSE) - printk(KERN_DEBUG PFX "Watchdog stopped\n"); - return 0; } static int pcipcwd_keepalive(void) { /* Re-trigger watchdog by writing to port 0 */ - outb_p(0x42, pcipcwd_private.io_addr); /* send out any data */ - - if (debug >= DEBUG) - printk(KERN_DEBUG PFX "Watchdog keepalive signal send\n"); - + outb_p(0x42, pcipcwd_private.io_addr); return 0; } @@ -305,64 +210,29 @@ static int pcipcwd_set_heartbeat(int t) send_command(CMD_WRITE_WATCHDOG_TIMEOUT, &t_msb, &t_lsb); heartbeat = t; - if (debug >= VERBOSE) - printk(KERN_DEBUG PFX "New heartbeat: %d\n", - heartbeat); - return 0; } static int pcipcwd_get_status(int *status) { - int control_status; + int new_status; *status=0; - control_status = inb_p(pcipcwd_private.io_addr + 1); - if (control_status & WD_PCI_WTRP) + new_status = inb_p(pcipcwd_private.io_addr + 1); + if (new_status & WD_PCI_WTRP) *status |= WDIOF_CARDRESET; - if (control_status & WD_PCI_TTRP) { + if (new_status & WD_PCI_TTRP) { *status |= WDIOF_OVERHEAT; if (temp_panic) panic(PFX "Temperature overheat trip!\n"); } - if (debug >= DEBUG) - printk(KERN_DEBUG PFX "Control Status #1: 0x%02x\n", - control_status); - return 0; } static int pcipcwd_clear_status(void) { - int control_status; - int msb; - int reset_counter; - - if (debug >= VERBOSE) - printk(KERN_INFO PFX "clearing watchdog trip status & LED\n"); - - control_status = inb_p(pcipcwd_private.io_addr + 1); - - if (debug >= DEBUG) { - printk(KERN_DEBUG PFX "status was: 0x%02x\n", control_status); - printk(KERN_DEBUG PFX "sending: 0x%02x\n", - (control_status & WD_PCI_R2DS) | WD_PCI_WTRP); - } - - /* clear trip status & LED and keep mode of relay 2 */ - outb_p((control_status & WD_PCI_R2DS) | WD_PCI_WTRP, pcipcwd_private.io_addr + 1); - - /* clear reset counter */ - msb=0; - reset_counter=0xff; - send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter); - - if (debug >= DEBUG) { - printk(KERN_DEBUG PFX "reset count was: 0x%02x\n", - reset_counter); - } - + outb_p(0x01, pcipcwd_private.io_addr + 1); return 0; } @@ -372,18 +242,11 @@ static int pcipcwd_get_temperature(int *temperature) if (!pcipcwd_private.supports_temp) return -ENODEV; - *temperature = inb_p(pcipcwd_private.io_addr); - /* * Convert celsius to fahrenheit, since this was * the decided 'standard' for this return value. */ - *temperature = (*temperature * 9 / 5) + 32; - - if (debug >= DEBUG) { - printk(KERN_DEBUG PFX "temperature is: %d F\n", - *temperature); - } + *temperature = ((inb_p(pcipcwd_private.io_addr)) * 9 / 5) + 32; return 0; } @@ -393,7 +256,7 @@ static int pcipcwd_get_temperature(int *temperature) */ static ssize_t pcipcwd_write(struct file *file, const char __user *data, - size_t len, loff_t *ppos) + size_t len, loff_t *ppos) { /* See if we got the magic character 'V' and reload the timer */ if (len) { @@ -518,11 +381,8 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, static int pcipcwd_open(struct inode *inode, struct file *file) { /* /dev/watchdog can only be opened once */ - if (test_and_set_bit(0, &is_active)) { - if (debug >= VERBOSE) - printk(KERN_ERR PFX "Attempt to open already opened device.\n"); + if (test_and_set_bit(0, &is_active)) return -EBUSY; - } /* Activate */ pcipcwd_start(); @@ -632,10 +492,19 @@ static struct notifier_block pcipcwd_notifier = { * Init & exit routines */ +static inline void check_temperature_support(void) +{ + if (inb_p(pcipcwd_private.io_addr) != 0xF0) + pcipcwd_private.supports_temp = 1; +} + static int __devinit pcipcwd_card_init(struct pci_dev *pdev, const struct pci_device_id *ent) { int ret = -EIO; + int got_fw_rev, fw_rev_major, fw_rev_minor; + char fw_ver_str[20]; + char option_switches; cards_found++; if (cards_found == 1) @@ -677,10 +546,36 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, pcipcwd_stop(); /* Check whether or not the card supports the temperature device */ - pcipcwd_check_temperature_support(); + check_temperature_support(); + + /* Get the Firmware Version */ + got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); + if (got_fw_rev) { + sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); + } else { + sprintf(fw_ver_str, ""); + } - /* Show info about the card itself */ - pcipcwd_show_card_info(); + /* Get switch settings */ + option_switches = inb_p(pcipcwd_private.io_addr + 3); + + printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n", + (int) pcipcwd_private.io_addr, fw_ver_str, + (pcipcwd_private.supports_temp ? "with" : "without")); + + printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", + option_switches, + ((option_switches & 0x10) ? "ON" : "OFF"), + ((option_switches & 0x08) ? "ON" : "OFF")); + + if (pcipcwd_private.boot_status & WDIOF_CARDRESET) + printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n"); + + if (pcipcwd_private.boot_status & WDIOF_OVERHEAT) + printk(KERN_INFO PFX "Card sensed a CPU Overheat\n"); + + if (pcipcwd_private.boot_status == 0) + printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); /* Check that the heartbeat value is within it's range ; if not reset to the default */ if (pcipcwd_set_heartbeat(heartbeat)) { @@ -761,7 +656,7 @@ static struct pci_driver pcipcwd_driver = { static int __init pcipcwd_init_module(void) { - spin_lock_init(&pcipcwd_private.io_lock); + spin_lock_init (&pcipcwd_private.io_lock); return pci_register_driver(&pcipcwd_driver); } diff --git a/trunk/drivers/connector/cn_queue.c b/trunk/drivers/connector/cn_queue.c index 9f2f00d82917..966632182e2d 100644 --- a/trunk/drivers/connector/cn_queue.c +++ b/trunk/drivers/connector/cn_queue.c @@ -31,19 +31,16 @@ #include #include -void cn_queue_wrapper(void *data) +static void cn_queue_wrapper(void *data) { - struct cn_callback_data *d = data; + struct cn_callback_entry *cbq = data; - d->callback(d->callback_priv); - - d->destruct_data(d->ddata); - d->ddata = NULL; - - kfree(d->free); + cbq->cb->callback(cbq->cb->priv); + cbq->destruct_data(cbq->ddata); + cbq->ddata = NULL; } -static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struct cb_id *id, void (*callback)(void *)) +static struct cn_callback_entry *cn_queue_alloc_callback_entry(struct cn_callback *cb) { struct cn_callback_entry *cbq; @@ -53,11 +50,8 @@ static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struc return NULL; } - snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name); - memcpy(&cbq->id.id, id, sizeof(struct cb_id)); - cbq->data.callback = callback; - - INIT_WORK(&cbq->work, &cn_queue_wrapper, &cbq->data); + cbq->cb = cb; + INIT_WORK(&cbq->work, &cn_queue_wrapper, cbq); return cbq; } @@ -74,12 +68,12 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2) return ((i1->idx == i2->idx) && (i1->val == i2->val)); } -int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)) +int cn_queue_add_callback(struct cn_queue_dev *dev, struct cn_callback *cb) { struct cn_callback_entry *cbq, *__cbq; int found = 0; - cbq = cn_queue_alloc_callback_entry(name, id, callback); + cbq = cn_queue_alloc_callback_entry(cb); if (!cbq) return -ENOMEM; @@ -88,7 +82,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id spin_lock_bh(&dev->queue_lock); list_for_each_entry(__cbq, &dev->queue_list, callback_entry) { - if (cn_cb_equal(&__cbq->id.id, id)) { + if (cn_cb_equal(&__cbq->cb->id, &cb->id)) { found = 1; break; } @@ -105,7 +99,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id cbq->nls = dev->nls; cbq->seq = 0; - cbq->group = cbq->id.id.idx; + cbq->group = cbq->cb->id.idx; return 0; } @@ -117,7 +111,7 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id) spin_lock_bh(&dev->queue_lock); list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry) { - if (cn_cb_equal(&cbq->id.id, id)) { + if (cn_cb_equal(&cbq->cb->id, id)) { list_del(&cbq->callback_entry); found = 1; break; diff --git a/trunk/drivers/connector/connector.c b/trunk/drivers/connector/connector.c index 505677fb3157..aaf6d468a8b9 100644 --- a/trunk/drivers/connector/connector.c +++ b/trunk/drivers/connector/connector.c @@ -69,7 +69,7 @@ int cn_already_initialized = 0; * a new message. * */ -int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask) +int cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask) { struct cn_callback_entry *__cbq; unsigned int size; @@ -84,7 +84,7 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask) spin_lock_bh(&dev->cbdev->queue_lock); list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { - if (cn_cb_equal(&__cbq->id.id, &msg->id)) { + if (cn_cb_equal(&__cbq->cb->id, &msg->id)) { found = 1; group = __cbq->group; } @@ -127,56 +127,42 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v { struct cn_callback_entry *__cbq; struct cn_dev *dev = &cdev; - int err = -ENODEV; + int found = 0; spin_lock_bh(&dev->cbdev->queue_lock); list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { - if (cn_cb_equal(&__cbq->id.id, &msg->id)) { + if (cn_cb_equal(&__cbq->cb->id, &msg->id)) { + /* + * Let's scream if there is some magic and the + * data will arrive asynchronously here. + * [i.e. netlink messages will be queued]. + * After the first warning I will fix it + * quickly, but now I think it is + * impossible. --zbr (2004_04_27). + */ if (likely(!test_bit(0, &__cbq->work.pending) && - __cbq->data.ddata == NULL)) { - __cbq->data.callback_priv = msg; + __cbq->ddata == NULL)) { + __cbq->cb->priv = msg; - __cbq->data.ddata = data; - __cbq->data.destruct_data = destruct_data; + __cbq->ddata = data; + __cbq->destruct_data = destruct_data; if (queue_work(dev->cbdev->cn_queue, &__cbq->work)) - err = 0; + found = 1; } else { - struct work_struct *w; - struct cn_callback_data *d; - - w = kzalloc(sizeof(*w) + sizeof(*d), GFP_ATOMIC); - if (w) { - d = (struct cn_callback_data *)(w+1); - - d->callback_priv = msg; - d->callback = __cbq->data.callback; - d->ddata = data; - d->destruct_data = destruct_data; - d->free = w; - - INIT_LIST_HEAD(&w->entry); - w->pending = 0; - w->func = &cn_queue_wrapper; - w->data = d; - init_timer(&w->timer); - - if (queue_work(dev->cbdev->cn_queue, w)) - err = 0; - else { - kfree(w); - err = -EINVAL; - } - } else - err = -ENOMEM; + printk("%s: cbq->data=%p, " + "work->pending=%08lx.\n", + __func__, __cbq->ddata, + __cbq->work.pending); + WARN_ON(1); } break; } } spin_unlock_bh(&dev->cbdev->queue_lock); - return err; + return found ? 0 : -ENODEV; } /* @@ -305,10 +291,22 @@ int cn_add_callback(struct cb_id *id, char *name, void (*callback)(void *)) { int err; struct cn_dev *dev = &cdev; + struct cn_callback *cb; + + cb = kzalloc(sizeof(*cb), GFP_KERNEL); + if (!cb) + return -ENOMEM; + + scnprintf(cb->name, sizeof(cb->name), "%s", name); - err = cn_queue_add_callback(dev->cbdev, name, id, callback); - if (err) + memcpy(&cb->id, id, sizeof(cb->id)); + cb->callback = callback; + + err = cn_queue_add_callback(dev->cbdev, cb); + if (err) { + kfree(cb); return err; + } cn_notify(id, 0); diff --git a/trunk/drivers/firmware/dell_rbu.c b/trunk/drivers/firmware/dell_rbu.c index 4f4ba9b6d182..b66782398258 100644 --- a/trunk/drivers/firmware/dell_rbu.c +++ b/trunk/drivers/firmware/dell_rbu.c @@ -50,7 +50,7 @@ MODULE_AUTHOR("Abhay Salunke "); MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); MODULE_LICENSE("GPL"); -MODULE_VERSION("3.0"); +MODULE_VERSION("2.0"); #define BIOS_SCAN_LIMIT 0xffffffff #define MAX_IMAGE_LENGTH 16 @@ -62,16 +62,15 @@ static struct _rbu_data { int dma_alloc; spinlock_t lock; unsigned long packet_read_count; + unsigned long packet_write_count; unsigned long num_packets; unsigned long packetsize; - unsigned long imagesize; int entry_created; } rbu_data; static char image_type[MAX_IMAGE_LENGTH + 1] = "mono"; module_param_string(image_type, image_type, sizeof (image_type), 0); -MODULE_PARM_DESC(image_type, - "BIOS image type. choose- mono or packet or init"); +MODULE_PARM_DESC(image_type, "BIOS image type. choose- mono or packet"); struct packet_data { struct list_head list; @@ -89,13 +88,55 @@ static dma_addr_t dell_rbu_dmaaddr; static void init_packet_head(void) { INIT_LIST_HEAD(&packet_data_head.list); + rbu_data.packet_write_count = 0; rbu_data.packet_read_count = 0; rbu_data.num_packets = 0; rbu_data.packetsize = 0; - rbu_data.imagesize = 0; } -static int create_packet(void *data, size_t length) +static int fill_last_packet(void *data, size_t length) +{ + struct list_head *ptemp_list; + struct packet_data *packet = NULL; + int packet_count = 0; + + pr_debug("fill_last_packet: entry \n"); + + if (!rbu_data.num_packets) { + pr_debug("fill_last_packet: num_packets=0\n"); + return -ENOMEM; + } + + packet_count = rbu_data.num_packets; + + ptemp_list = (&packet_data_head.list)->prev; + + packet = list_entry(ptemp_list, struct packet_data, list); + + if ((rbu_data.packet_write_count + length) > rbu_data.packetsize) { + pr_debug("dell_rbu:%s: packet size data " + "overrun\n", __FUNCTION__); + return -EINVAL; + } + + pr_debug("fill_last_packet : buffer = %p\n", packet->data); + + memcpy((packet->data + rbu_data.packet_write_count), data, length); + + if ((rbu_data.packet_write_count + length) == rbu_data.packetsize) { + /* + * this was the last data chunk in the packet + * so reinitialize the packet data counter to zero + */ + rbu_data.packet_write_count = 0; + } else + rbu_data.packet_write_count += length; + + pr_debug("fill_last_packet: exit \n"); + return 0; +} + +static int create_packet(size_t length) { struct packet_data *newpacket; int ordernum = 0; @@ -145,11 +186,9 @@ static int create_packet(void *data, size_t length) INIT_LIST_HEAD(&newpacket->list); list_add_tail(&newpacket->list, &packet_data_head.list); /* - * packets may not have fixed size + * packets have fixed size */ - newpacket->length = length; - - memcpy(newpacket->data, data, length); + newpacket->length = rbu_data.packetsize; pr_debug("create_packet: exit \n"); @@ -159,37 +198,13 @@ static int create_packet(void *data, size_t length) static int packetize_data(void *data, size_t length) { int rc = 0; - int done = 0; - int packet_length; - u8 *temp; - u8 *end = (u8 *) data + length; - pr_debug("packetize_data: data length %d\n", length); - if (!rbu_data.packetsize) { - printk(KERN_WARNING - "dell_rbu: packetsize not specified\n"); - return -EIO; - } - temp = (u8 *) data; - - /* packetize the hunk */ - while (!done) { - if ((temp + rbu_data.packetsize) < end) - packet_length = rbu_data.packetsize; - else { - /* this is the last packet */ - packet_length = end - temp; - done = 1; - } - - if ((rc = create_packet(temp, packet_length))) + if (!rbu_data.packet_write_count) { + if ((rc = create_packet(length))) return rc; - - pr_debug("%lu:%lu\n", temp, (end - temp)); - temp += packet_length; } - - rbu_data.imagesize = length; + if ((rc = fill_last_packet(data, length))) + return rc; return rc; } @@ -228,7 +243,7 @@ static int do_packet_read(char *data, struct list_head *ptemp_list, return bytes_copied; } -static int packet_read_list(char *data, size_t * pread_length) +static int packet_read_list(char *data, size_t *pread_length) { struct list_head *ptemp_list; int temp_count = 0; @@ -288,9 +303,10 @@ static void packet_empty_list(void) newpacket->ordernum); kfree(newpacket); } + rbu_data.packet_write_count = 0; rbu_data.packet_read_count = 0; rbu_data.num_packets = 0; - rbu_data.imagesize = 0; + rbu_data.packetsize = 0; } /* @@ -409,6 +425,7 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count) size_t bytes_left; size_t data_length; char *ptempBuf = buffer; + unsigned long imagesize; /* check to see if we have something to return */ if (rbu_data.num_packets == 0) { @@ -417,20 +434,22 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count) goto read_rbu_data_exit; } - if (pos > rbu_data.imagesize) { + imagesize = rbu_data.num_packets * rbu_data.packetsize; + + if (pos > imagesize) { retval = 0; printk(KERN_WARNING "dell_rbu:read_packet_data: " "data underrun\n"); goto read_rbu_data_exit; } - bytes_left = rbu_data.imagesize - pos; + bytes_left = imagesize - pos; data_length = min(bytes_left, count); if ((retval = packet_read_list(ptempBuf, &data_length)) < 0) goto read_rbu_data_exit; - if ((pos + count) > rbu_data.imagesize) { + if ((pos + count) > imagesize) { rbu_data.packet_read_count = 0; /* this was the last copy */ retval = bytes_left; @@ -480,7 +499,7 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) } static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, - loff_t pos, size_t count) + loff_t pos, size_t count) { ssize_t ret_count = 0; @@ -512,18 +531,13 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) memcpy(rbu_data.image_update_buffer, fw->data, fw->size); } else if (!strcmp(image_type, "packet")) { - /* - * we need to free previous packets if a - * new hunk of packets needs to be downloaded - */ - packet_empty_list(); - if (packetize_data(fw->data, fw->size)) - /* Incase something goes wrong when we are - * in middle of packetizing the data, we - * need to free up whatever packets might - * have been created before we quit. - */ + if (!rbu_data.packetsize) + rbu_data.packetsize = fw->size; + else if (rbu_data.packetsize != fw->size) { packet_empty_list(); + rbu_data.packetsize = fw->size; + } + packetize_data(fw->data, fw->size); } else pr_debug("invalid image type specified.\n"); spin_unlock(&rbu_data.lock); @@ -539,7 +553,7 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) } static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, - loff_t pos, size_t count) + loff_t pos, size_t count) { int size = 0; if (!pos) @@ -548,7 +562,7 @@ static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, } static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, - loff_t pos, size_t count) + loff_t pos, size_t count) { int rc = count; int req_firm_rc = 0; @@ -607,49 +621,25 @@ static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, return rc; } -static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer, - loff_t pos, size_t count) -{ - int size = 0; - if (!pos) { - spin_lock(&rbu_data.lock); - size = sprintf(buffer, "%lu\n", rbu_data.packetsize); - spin_unlock(&rbu_data.lock); - } - return size; -} - -static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer, - loff_t pos, size_t count) -{ - unsigned long temp; - spin_lock(&rbu_data.lock); - packet_empty_list(); - sscanf(buffer, "%lu", &temp); - if (temp < 0xffffffff) - rbu_data.packetsize = temp; - - spin_unlock(&rbu_data.lock); - return count; -} - static struct bin_attribute rbu_data_attr = { - .attr = {.name = "data",.owner = THIS_MODULE,.mode = 0444}, + .attr = { + .name = "data", + .owner = THIS_MODULE, + .mode = 0444, + }, .read = read_rbu_data, }; static struct bin_attribute rbu_image_type_attr = { - .attr = {.name = "image_type",.owner = THIS_MODULE,.mode = 0644}, + .attr = { + .name = "image_type", + .owner = THIS_MODULE, + .mode = 0644, + }, .read = read_rbu_image_type, .write = write_rbu_image_type, }; -static struct bin_attribute rbu_packet_size_attr = { - .attr = {.name = "packet_size",.owner = THIS_MODULE,.mode = 0644}, - .read = read_rbu_packet_size, - .write = write_rbu_packet_size, -}; - static int __init dcdrbu_init(void) { int rc = 0; @@ -667,8 +657,6 @@ static int __init dcdrbu_init(void) sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr); sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr); - sysfs_create_bin_file(&rbu_device->dev.kobj, - &rbu_packet_size_attr); rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); diff --git a/trunk/drivers/ide/ide-io.c b/trunk/drivers/ide/ide-io.c index 5275cbb1afe9..9e9cf1407311 100644 --- a/trunk/drivers/ide/ide-io.c +++ b/trunk/drivers/ide/ide-io.c @@ -1101,7 +1101,6 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) ide_hwif_t *hwif; struct request *rq; ide_startstop_t startstop; - int loops = 0; /* for atari only: POSSIBLY BROKEN HERE(?) */ ide_get_lock(ide_intr, hwgroup); @@ -1154,7 +1153,6 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) /* no more work for this hwgroup (for now) */ return; } - again: hwif = HWIF(drive); if (hwgroup->hwif->sharing_irq && hwif != hwgroup->hwif && @@ -1194,14 +1192,8 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) * though. I hope that doesn't happen too much, hopefully not * unless the subdriver triggers such a thing in its own PM * state machine. - * - * We count how many times we loop here to make sure we service - * all drives in the hwgroup without looping for ever */ if (drive->blocked && !blk_pm_request(rq) && !(rq->flags & REQ_PREEMPT)) { - drive = drive->next ? drive->next : hwgroup->drive; - if (loops++ < 4 && !blk_queue_plugged(drive->queue)) - goto again; /* We clear busy, there should be no pending ATA command at this point. */ hwgroup->busy = 0; break; diff --git a/trunk/drivers/ide/legacy/ide-cs.c b/trunk/drivers/ide/legacy/ide-cs.c index a35a58bef1a4..0ccf85fcee34 100644 --- a/trunk/drivers/ide/legacy/ide-cs.c +++ b/trunk/drivers/ide/legacy/ide-cs.c @@ -477,7 +477,7 @@ static struct pcmcia_device_id ide_ids[] = { PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674), PCMCIA_DEVICE_PROD_ID12("LOOKMEET", "CBIDE2 ", 0xe37be2b5, 0x8671043b), - PCMCIA_DEVICE_PROD_ID2("NinjaATA-", 0xebe0bd79), + PCMCIA_DEVICE_PROD_ID12(" ", "NinjaATA-", 0x3b6e20c8, 0xebe0bd79), PCMCIA_DEVICE_PROD_ID12("PCMCIA", "CD-ROM", 0x281f1c5d, 0x66536591), PCMCIA_DEVICE_PROD_ID12("PCMCIA", "PnPIDE", 0x281f1c5d, 0x0c694728), PCMCIA_DEVICE_PROD_ID12("SHUTTLE TECHNOLOGY LTD.", "PCCARD-IDE/ATAPI Adapter", 0x4a3f0ba0, 0x322560e1), diff --git a/trunk/drivers/ieee1394/amdtp.c b/trunk/drivers/ieee1394/amdtp.c index e8e28569a668..84ae027b021a 100644 --- a/trunk/drivers/ieee1394/amdtp.c +++ b/trunk/drivers/ieee1394/amdtp.c @@ -1297,3 +1297,4 @@ static void __exit amdtp_exit_module (void) module_init(amdtp_init_module); module_exit(amdtp_exit_module); +MODULE_ALIAS_CHARDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_AMDTP * 16); diff --git a/trunk/drivers/ieee1394/csr1212.h b/trunk/drivers/ieee1394/csr1212.h index 28c5f4b726e2..e6734263a1d3 100644 --- a/trunk/drivers/ieee1394/csr1212.h +++ b/trunk/drivers/ieee1394/csr1212.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include diff --git a/trunk/drivers/ieee1394/dv1394.c b/trunk/drivers/ieee1394/dv1394.c index e34730c7a874..4538b0235ca3 100644 --- a/trunk/drivers/ieee1394/dv1394.c +++ b/trunk/drivers/ieee1394/dv1394.c @@ -2660,3 +2660,4 @@ static int __init dv1394_init_module(void) module_init(dv1394_init_module); module_exit(dv1394_exit_module); +MODULE_ALIAS_CHARDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16); diff --git a/trunk/drivers/ieee1394/eth1394.c b/trunk/drivers/ieee1394/eth1394.c index 4802bbbb6dc9..cd53c174ced1 100644 --- a/trunk/drivers/ieee1394/eth1394.c +++ b/trunk/drivers/ieee1394/eth1394.c @@ -89,7 +89,7 @@ #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__) static char version[] __devinitdata = - "$Rev: 1312 $ Ben Collins "; + "$Rev: 1264 $ Ben Collins "; struct fragment_info { struct list_head list; @@ -221,7 +221,9 @@ static int ether1394_open (struct net_device *dev) if (priv->bc_state == ETHER1394_BC_ERROR) { /* we'll try again */ priv->iso = hpsb_iso_recv_init(priv->host, - ETHER1394_ISO_BUF_SIZE, + ETHER1394_GASP_BUFFERS * 2 * + (1 << (priv->host->csr.max_rec + + 1)), ETHER1394_GASP_BUFFERS, priv->broadcast_channel, HPSB_ISO_DMA_PACKET_PER_BUFFER, @@ -633,8 +635,8 @@ static void ether1394_add_host (struct hpsb_host *host) * be checked when the eth device is opened. */ priv->broadcast_channel = host->csr.broadcast_channel & 0x3f; - priv->iso = hpsb_iso_recv_init(host, - ETHER1394_ISO_BUF_SIZE, + priv->iso = hpsb_iso_recv_init(host, (ETHER1394_GASP_BUFFERS * 2 * + (1 << (host->csr.max_rec + 1))), ETHER1394_GASP_BUFFERS, priv->broadcast_channel, HPSB_ISO_DMA_PACKET_PER_BUFFER, @@ -1768,7 +1770,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev) static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { strcpy (info->driver, driver_name); - strcpy (info->version, "$Rev: 1312 $"); + strcpy (info->version, "$Rev: 1264 $"); /* FIXME XXX provide sane businfo */ strcpy (info->bus_info, "ieee1394"); } diff --git a/trunk/drivers/ieee1394/eth1394.h b/trunk/drivers/ieee1394/eth1394.h index a77213cfc483..ed8f1c4b7fd8 100644 --- a/trunk/drivers/ieee1394/eth1394.h +++ b/trunk/drivers/ieee1394/eth1394.h @@ -44,12 +44,6 @@ #define ETHER1394_GASP_BUFFERS 16 -/* rawiso buffer size - due to a limitation in rawiso, we must limit each - * GASP buffer to be less than PAGE_SIZE. */ -#define ETHER1394_ISO_BUF_SIZE ETHER1394_GASP_BUFFERS * \ - min((unsigned int)PAGE_SIZE, \ - 2 * (1U << (priv->host->csr.max_rec + 1))) - /* Node set == 64 */ #define NODE_SET (ALL_NODES + 1) diff --git a/trunk/drivers/ieee1394/hosts.c b/trunk/drivers/ieee1394/hosts.c index aeeaeb670d03..c502c6e9c440 100644 --- a/trunk/drivers/ieee1394/hosts.c +++ b/trunk/drivers/ieee1394/hosts.c @@ -18,7 +18,6 @@ #include #include #include -#include #include "csr1212.h" #include "ieee1394.h" @@ -218,7 +217,7 @@ int hpsb_update_config_rom_image(struct hpsb_host *host) /* IEEE 1394a-2000 prohibits using the same generation number * twice in a 60 second period. */ - if (time_before(jiffies, host->csr.gen_timestamp[next_gen] + 60 * HZ)) + if (jiffies - host->csr.gen_timestamp[next_gen] < 60 * HZ) /* Wait 60 seconds from the last time this generation number was * used. */ reset_delay = (60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies; diff --git a/trunk/drivers/ieee1394/hosts.h b/trunk/drivers/ieee1394/hosts.h index 38f42112dff0..739e76840d51 100644 --- a/trunk/drivers/ieee1394/hosts.h +++ b/trunk/drivers/ieee1394/hosts.h @@ -135,17 +135,17 @@ enum isoctl_cmd { enum reset_types { /* 166 microsecond reset -- only type of reset available on - non-1394a capable controllers */ + non-1394a capable IEEE 1394 controllers */ LONG_RESET, /* Short (arbitrated) reset -- only available on 1394a capable - controllers */ + IEEE 1394 capable controllers */ SHORT_RESET, - /* Variants that set force_root before issueing the bus reset */ + /* Variants, that set force_root before issueing the bus reset */ LONG_RESET_FORCE_ROOT, SHORT_RESET_FORCE_ROOT, - /* Variants that clear force_root before issueing the bus reset */ + /* Variants, that clear force_root before issueing the bus reset */ LONG_RESET_NO_FORCE_ROOT, SHORT_RESET_NO_FORCE_ROOT }; diff --git a/trunk/drivers/ieee1394/ieee1394_core.c b/trunk/drivers/ieee1394/ieee1394_core.c index 32a1e016c85e..d633770fac8e 100644 --- a/trunk/drivers/ieee1394/ieee1394_core.c +++ b/trunk/drivers/ieee1394/ieee1394_core.c @@ -70,7 +70,7 @@ const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S32 struct class *hpsb_protocol_class; #ifdef CONFIG_IEEE1394_VERBOSEDEBUG -static void dump_packet(const char *text, quadlet_t *data, int size, int speed) +static void dump_packet(const char *text, quadlet_t *data, int size) { int i; @@ -78,15 +78,12 @@ static void dump_packet(const char *text, quadlet_t *data, int size, int speed) size = (size > 4 ? 4 : size); printk(KERN_DEBUG "ieee1394: %s", text); - if (speed > -1 && speed < 6) - printk(" at %s", hpsb_speedto_str[speed]); - printk(":"); for (i = 0; i < size; i++) printk(" %08x", data[i]); printk("\n"); } #else -#define dump_packet(a,b,c,d) +#define dump_packet(x,y,z) #endif static void abort_requests(struct hpsb_host *host); @@ -547,7 +544,8 @@ int hpsb_send_packet(struct hpsb_packet *packet) if (packet->data_size) memcpy(((u8*)data) + packet->header_size, packet->data, packet->data_size); - dump_packet("send packet local", packet->header, packet->header_size, -1); + dump_packet("send packet local:", packet->header, + packet->header_size); hpsb_packet_sent(host, packet, packet->expect_response ? ACK_PENDING : ACK_COMPLETE); hpsb_packet_received(host, data, size, 0); @@ -563,7 +561,21 @@ int hpsb_send_packet(struct hpsb_packet *packet) + NODEID_TO_NODE(packet->node_id)]; } - dump_packet("send packet", packet->header, packet->header_size, packet->speed_code); +#ifdef CONFIG_IEEE1394_VERBOSEDEBUG + switch (packet->speed_code) { + case 2: + dump_packet("send packet 400:", packet->header, + packet->header_size); + break; + case 1: + dump_packet("send packet 200:", packet->header, + packet->header_size); + break; + default: + dump_packet("send packet 100:", packet->header, + packet->header_size); + } +#endif return host->driver->transmit_packet(host, packet); } @@ -624,7 +636,7 @@ static void handle_packet_response(struct hpsb_host *host, int tcode, if (packet == NULL) { HPSB_DEBUG("unsolicited response packet received - no tlabel match"); - dump_packet("contents", data, 16, -1); + dump_packet("contents:", data, 16); spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags); return; } @@ -665,7 +677,7 @@ static void handle_packet_response(struct hpsb_host *host, int tcode, if (!tcode_match) { spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags); HPSB_INFO("unsolicited response packet received - tcode mismatch"); - dump_packet("contents", data, 16, -1); + dump_packet("contents:", data, 16); return; } @@ -902,7 +914,7 @@ void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size, return; } - dump_packet("received packet", data, size, -1); + dump_packet("received packet:", data, size); tcode = (data[0] >> 4) & 0xf; diff --git a/trunk/drivers/ieee1394/nodemgr.c b/trunk/drivers/ieee1394/nodemgr.c index 347ece6b583c..b23322523ef5 100644 --- a/trunk/drivers/ieee1394/nodemgr.c +++ b/trunk/drivers/ieee1394/nodemgr.c @@ -64,10 +64,10 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci; int i, ret = 0; - for (i = 1; ; i++) { + for (i = 0; i < 3; i++) { ret = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, buffer, length); - if (!ret || i == 3) + if (!ret) break; if (msleep_interruptible(334)) @@ -1438,13 +1438,9 @@ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles) if (host->busmgr_id == 0xffff && host->node_count > 1) { u16 root_node = host->node_count - 1; + struct node_entry *ne = find_entry_by_nodeid(host, root_node | LOCAL_BUS); - /* get cycle master capability flag from root node */ - if (host->is_cycmst || - (!hpsb_read(host, LOCAL_BUS | root_node, get_hpsb_generation(host), - (CSR_REGISTER_BASE + CSR_CONFIG_ROM + 2 * sizeof(quadlet_t)), - &bc, sizeof(quadlet_t)) && - be32_to_cpu(bc) & 1 << CSR_CMC_SHIFT)) + if (ne && ne->busopt.cmc) hpsb_send_phy_config(host, root_node, -1); else { HPSB_DEBUG("The root node is not cycle master capable; " @@ -1561,19 +1557,24 @@ static int nodemgr_host_thread(void *__hi) } } - if (!nodemgr_check_irm_capability(host, reset_cycles) || - !nodemgr_do_irm_duties(host, reset_cycles)) { + if (!nodemgr_check_irm_capability(host, reset_cycles)) { reset_cycles++; up(&nodemgr_serialize); continue; } - reset_cycles = 0; /* Scan our nodes to get the bus options and create node * entries. This does not do the sysfs stuff, since that * would trigger hotplug callbacks and such, which is a * bad idea at this point. */ nodemgr_node_scan(hi, generation); + if (!nodemgr_do_irm_duties(host, reset_cycles)) { + reset_cycles++; + up(&nodemgr_serialize); + continue; + } + + reset_cycles = 0; /* This actually does the full probe, with sysfs * registration. */ diff --git a/trunk/drivers/ieee1394/ohci1394.c b/trunk/drivers/ieee1394/ohci1394.c index 6a6acbd80af4..27018c8efc24 100644 --- a/trunk/drivers/ieee1394/ohci1394.c +++ b/trunk/drivers/ieee1394/ohci1394.c @@ -162,7 +162,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args) printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) static char version[] __devinitdata = - "$Rev: 1313 $ Ben Collins "; + "$Rev: 1299 $ Ben Collins "; /* Module Parameters */ static int phys_dma = 1; @@ -1084,7 +1084,7 @@ static int ohci_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg) initialize_dma_rcv_ctx(&ohci->ir_legacy_context, 1); if (printk_ratelimit()) - DBGMSG("IR legacy activated"); + PRINT(KERN_ERR, "IR legacy activated"); } spin_lock_irqsave(&ohci->IR_channel_lock, flags); diff --git a/trunk/drivers/ieee1394/raw1394.c b/trunk/drivers/ieee1394/raw1394.c index 315f5ca8bedb..b4fa14793fe5 100644 --- a/trunk/drivers/ieee1394/raw1394.c +++ b/trunk/drivers/ieee1394/raw1394.c @@ -98,7 +98,7 @@ static struct hpsb_address_ops arm_ops = { static void queue_complete_cb(struct pending_request *req); -static struct pending_request *__alloc_pending_request(gfp_t flags) +static struct pending_request *__alloc_pending_request(unsigned int __nocast flags) { struct pending_request *req; @@ -2958,3 +2958,4 @@ static void __exit cleanup_raw1394(void) module_init(init_raw1394); module_exit(cleanup_raw1394); MODULE_LICENSE("GPL"); +MODULE_ALIAS_CHARDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16); diff --git a/trunk/drivers/ieee1394/sbp2.c b/trunk/drivers/ieee1394/sbp2.c index 12cec7c4a342..de88218ef7cc 100644 --- a/trunk/drivers/ieee1394/sbp2.c +++ b/trunk/drivers/ieee1394/sbp2.c @@ -97,18 +97,16 @@ static char version[] __devinitdata = */ static int max_speed = IEEE1394_SPEED_MAX; module_param(max_speed, int, 0644); -MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb, 1 = 200mb, 0 = 100mb)"); +MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb default, 1 = 200mb, 0 = 100mb)"); /* * Set serialize_io to 1 if you'd like only one scsi command sent * down to us at a time (debugging). This might be necessary for very * badly behaved sbp2 devices. - * - * TODO: Make this configurable per device. */ -static int serialize_io = 1; +static int serialize_io; module_param(serialize_io, int, 0444); -MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers (default = 1, faster = 0)"); +MODULE_PARM_DESC(serialize_io, "Serialize all I/O coming down from the scsi drivers (default = 0)"); /* * Bump up max_sectors if you'd like to support very large sized @@ -598,14 +596,6 @@ static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_i spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); } -/* - * Is scsi_id valid? Is the 1394 node still present? - */ -static inline int sbp2util_node_is_available(struct scsi_id_instance_data *scsi_id) -{ - return scsi_id && scsi_id->ne && !scsi_id->ne->in_limbo; -} - /********************************************* @@ -641,23 +631,11 @@ static int sbp2_remove(struct device *dev) { struct unit_directory *ud; struct scsi_id_instance_data *scsi_id; - struct scsi_device *sdev; SBP2_DEBUG("sbp2_remove"); ud = container_of(dev, struct unit_directory, device); scsi_id = ud->device.driver_data; - if (!scsi_id) - return 0; - - /* Trigger shutdown functions in scsi's highlevel. */ - if (scsi_id->scsi_host) - scsi_unblock_requests(scsi_id->scsi_host); - sdev = scsi_id->sdev; - if (sdev) { - scsi_id->sdev = NULL; - scsi_remove_device(sdev); - } sbp2_logout_device(scsi_id); sbp2_remove_device(scsi_id); @@ -2495,26 +2473,37 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt, struct scsi_id_instance_data *scsi_id = (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; struct sbp2scsi_host_info *hi; - int result = DID_NO_CONNECT << 16; SBP2_DEBUG("sbp2scsi_queuecommand"); - if (!sbp2util_node_is_available(scsi_id)) - goto done; + /* + * If scsi_id is null, it means there is no device in this slot, + * so we should return selection timeout. + */ + if (!scsi_id) { + SCpnt->result = DID_NO_CONNECT << 16; + done (SCpnt); + return 0; + } hi = scsi_id->hi; if (!hi) { SBP2_ERR("sbp2scsi_host_info is NULL - this is bad!"); - goto done; + SCpnt->result = DID_NO_CONNECT << 16; + done (SCpnt); + return(0); } /* * Until we handle multiple luns, just return selection time-out * to any IO directed at non-zero LUNs */ - if (SCpnt->device->lun) - goto done; + if (SCpnt->device->lun) { + SCpnt->result = DID_NO_CONNECT << 16; + done (SCpnt); + return(0); + } /* * Check for request sense command, and handle it here @@ -2525,7 +2514,7 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt, memcpy(SCpnt->request_buffer, SCpnt->sense_buffer, SCpnt->request_bufflen); memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer)); sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_GOOD, SCpnt, done); - return 0; + return(0); } /* @@ -2533,8 +2522,9 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt, */ if (!hpsb_node_entry_valid(scsi_id->ne)) { SBP2_ERR("Bus reset in progress - rejecting command"); - result = DID_BUS_BUSY << 16; - goto done; + SCpnt->result = DID_BUS_BUSY << 16; + done (SCpnt); + return(0); } /* @@ -2545,12 +2535,8 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt, sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_SELECTION_TIMEOUT, SCpnt, done); } - return 0; -done: - SCpnt->result = result; - done(SCpnt); - return 0; + return(0); } /* @@ -2697,24 +2683,11 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, } -static int sbp2scsi_slave_alloc(struct scsi_device *sdev) -{ - ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = sdev; - return 0; -} - - -static int sbp2scsi_slave_configure(struct scsi_device *sdev) +static int sbp2scsi_slave_configure (struct scsi_device *sdev) { blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); - return 0; -} - -static void sbp2scsi_slave_destroy(struct scsi_device *sdev) -{ - ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = NULL; - return; + return 0; } @@ -2732,7 +2705,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt) SBP2_ERR("aborting sbp2 command"); scsi_print_command(SCpnt); - if (sbp2util_node_is_available(scsi_id)) { + if (scsi_id) { /* * Right now, just return any matching command structures @@ -2769,24 +2742,31 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt) /* * Called by scsi stack when something has really gone wrong. */ -static int sbp2scsi_reset(struct scsi_cmnd *SCpnt) +static int __sbp2scsi_reset(struct scsi_cmnd *SCpnt) { struct scsi_id_instance_data *scsi_id = (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; - unsigned long flags; SBP2_ERR("reset requested"); - spin_lock_irqsave(SCpnt->device->host->host_lock, flags); - - if (sbp2util_node_is_available(scsi_id)) { + if (scsi_id) { SBP2_ERR("Generating sbp2 fetch agent reset"); sbp2_agent_reset(scsi_id, 0); } + return(SUCCESS); +} + +static int sbp2scsi_reset(struct scsi_cmnd *SCpnt) +{ + unsigned long flags; + int rc; + + spin_lock_irqsave(SCpnt->device->host->host_lock, flags); + rc = __sbp2scsi_reset(SCpnt); spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); - return SUCCESS; + return rc; } static const char *sbp2scsi_info (struct Scsi_Host *host) @@ -2837,9 +2817,7 @@ static struct scsi_host_template scsi_driver_template = { .eh_device_reset_handler = sbp2scsi_reset, .eh_bus_reset_handler = sbp2scsi_reset, .eh_host_reset_handler = sbp2scsi_reset, - .slave_alloc = sbp2scsi_slave_alloc, .slave_configure = sbp2scsi_slave_configure, - .slave_destroy = sbp2scsi_slave_destroy, .this_id = -1, .sg_tablesize = SG_ALL, .use_clustering = ENABLE_CLUSTERING, @@ -2859,8 +2837,7 @@ static int sbp2_module_init(void) /* Module load debug option to force one command at a time (serializing I/O) */ if (serialize_io) { - SBP2_INFO("Driver forced to serialize I/O (serialize_io=1)"); - SBP2_INFO("Try serialize_io=0 for better performance"); + SBP2_ERR("Driver forced to serialize I/O (serialize_io = 1)"); scsi_driver_template.can_queue = 1; scsi_driver_template.cmd_per_lun = 1; } diff --git a/trunk/drivers/ieee1394/video1394.c b/trunk/drivers/ieee1394/video1394.c index 11be9c9c82a8..9d6facf2f78f 100644 --- a/trunk/drivers/ieee1394/video1394.c +++ b/trunk/drivers/ieee1394/video1394.c @@ -1571,3 +1571,4 @@ static int __init video1394_init_module (void) module_init(video1394_init_module); module_exit(video1394_exit_module); +MODULE_ALIAS_CHARDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_VIDEO1394 * 16); diff --git a/trunk/drivers/infiniband/core/mad.c b/trunk/drivers/infiniband/core/mad.c index a14ca87fda18..a4a4d9c1eef3 100644 --- a/trunk/drivers/infiniband/core/mad.c +++ b/trunk/drivers/infiniband/core/mad.c @@ -783,7 +783,7 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent, u32 remote_qpn, u16 pkey_index, struct ib_ah *ah, int rmpp_active, int hdr_len, int data_len, - gfp_t gfp_mask) + unsigned int __nocast gfp_mask) { struct ib_mad_agent_private *mad_agent_priv; struct ib_mad_send_buf *send_buf; diff --git a/trunk/drivers/infiniband/core/sa_query.c b/trunk/drivers/infiniband/core/sa_query.c index 262618210c1c..78de2dd1a4f2 100644 --- a/trunk/drivers/infiniband/core/sa_query.c +++ b/trunk/drivers/infiniband/core/sa_query.c @@ -574,7 +574,7 @@ static void ib_sa_path_rec_release(struct ib_sa_query *sa_query) int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, struct ib_sa_path_rec *rec, ib_sa_comp_mask comp_mask, - int timeout_ms, gfp_t gfp_mask, + int timeout_ms, unsigned int __nocast gfp_mask, void (*callback)(int status, struct ib_sa_path_rec *resp, void *context), @@ -676,7 +676,7 @@ static void ib_sa_service_rec_release(struct ib_sa_query *sa_query) int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method, struct ib_sa_service_rec *rec, ib_sa_comp_mask comp_mask, - int timeout_ms, gfp_t gfp_mask, + int timeout_ms, unsigned int __nocast gfp_mask, void (*callback)(int status, struct ib_sa_service_rec *resp, void *context), @@ -759,7 +759,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, u8 method, struct ib_sa_mcmember_rec *rec, ib_sa_comp_mask comp_mask, - int timeout_ms, gfp_t gfp_mask, + int timeout_ms, unsigned int __nocast gfp_mask, void (*callback)(int status, struct ib_sa_mcmember_rec *resp, void *context), diff --git a/trunk/drivers/infiniband/core/uverbs.h b/trunk/drivers/infiniband/core/uverbs.h index cc124344dd2c..b1897bed14ad 100644 --- a/trunk/drivers/infiniband/core/uverbs.h +++ b/trunk/drivers/infiniband/core/uverbs.h @@ -69,7 +69,6 @@ struct ib_uverbs_event_file { struct ib_uverbs_file { struct kref ref; - struct semaphore mutex; struct ib_uverbs_device *device; struct ib_ucontext *ucontext; struct ib_event_handler event_handler; diff --git a/trunk/drivers/infiniband/core/uverbs_cmd.c b/trunk/drivers/infiniband/core/uverbs_cmd.c index 562445165d2b..e91ebde46481 100644 --- a/trunk/drivers/infiniband/core/uverbs_cmd.c +++ b/trunk/drivers/infiniband/core/uverbs_cmd.c @@ -76,9 +76,8 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, struct ib_uverbs_get_context_resp resp; struct ib_udata udata; struct ib_device *ibdev = file->device->ib_dev; - struct ib_ucontext *ucontext; int i; - int ret; + int ret = in_len; if (out_len < sizeof resp) return -ENOSPC; @@ -86,56 +85,45 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - down(&file->mutex); - - if (file->ucontext) { - ret = -EINVAL; - goto err; - } - INIT_UDATA(&udata, buf + sizeof cmd, (unsigned long) cmd.response + sizeof resp, in_len - sizeof cmd, out_len - sizeof resp); - ucontext = ibdev->alloc_ucontext(ibdev, &udata); - if (IS_ERR(ucontext)) - return PTR_ERR(file->ucontext); + file->ucontext = ibdev->alloc_ucontext(ibdev, &udata); + if (IS_ERR(file->ucontext)) { + ret = PTR_ERR(file->ucontext); + file->ucontext = NULL; + return ret; + } - ucontext->device = ibdev; - INIT_LIST_HEAD(&ucontext->pd_list); - INIT_LIST_HEAD(&ucontext->mr_list); - INIT_LIST_HEAD(&ucontext->mw_list); - INIT_LIST_HEAD(&ucontext->cq_list); - INIT_LIST_HEAD(&ucontext->qp_list); - INIT_LIST_HEAD(&ucontext->srq_list); - INIT_LIST_HEAD(&ucontext->ah_list); + file->ucontext->device = ibdev; + INIT_LIST_HEAD(&file->ucontext->pd_list); + INIT_LIST_HEAD(&file->ucontext->mr_list); + INIT_LIST_HEAD(&file->ucontext->mw_list); + INIT_LIST_HEAD(&file->ucontext->cq_list); + INIT_LIST_HEAD(&file->ucontext->qp_list); + INIT_LIST_HEAD(&file->ucontext->srq_list); + INIT_LIST_HEAD(&file->ucontext->ah_list); + spin_lock_init(&file->ucontext->lock); resp.async_fd = file->async_file.fd; for (i = 0; i < file->device->num_comp; ++i) if (copy_to_user((void __user *) (unsigned long) cmd.cq_fd_tab + i * sizeof (__u32), - &file->comp_file[i].fd, sizeof (__u32))) { - ret = -EFAULT; - goto err_free; - } + &file->comp_file[i].fd, sizeof (__u32))) + goto err; if (copy_to_user((void __user *) (unsigned long) cmd.response, - &resp, sizeof resp)) { - ret = -EFAULT; - goto err_free; - } - - file->ucontext = ucontext; - up(&file->mutex); + &resp, sizeof resp)) + goto err; return in_len; -err_free: - ibdev->dealloc_ucontext(ucontext); - err: - up(&file->mutex); - return ret; + ibdev->dealloc_ucontext(file->ucontext); + file->ucontext = NULL; + + return -EFAULT; } ssize_t ib_uverbs_query_device(struct ib_uverbs_file *file, @@ -364,9 +352,9 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file, if (ret) goto err_pd; - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_add_tail(&uobj->list, &file->ucontext->pd_list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); memset(&resp, 0, sizeof resp); resp.pd_handle = uobj->id; @@ -380,9 +368,9 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file, return in_len; err_list: - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&uobj->list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); down(&ib_uverbs_idr_mutex); idr_remove(&ib_uverbs_pd_idr, uobj->id); @@ -422,9 +410,9 @@ ssize_t ib_uverbs_dealloc_pd(struct ib_uverbs_file *file, idr_remove(&ib_uverbs_pd_idr, cmd.pd_handle); - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&uobj->list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); kfree(uobj); @@ -524,9 +512,9 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, resp.mr_handle = obj->uobject.id; - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_add_tail(&obj->uobject.list, &file->ucontext->mr_list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); if (copy_to_user((void __user *) (unsigned long) cmd.response, &resp, sizeof resp)) { @@ -539,9 +527,9 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, return in_len; err_list: - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&obj->uobject.list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); err_unreg: ib_dereg_mr(mr); @@ -582,9 +570,9 @@ ssize_t ib_uverbs_dereg_mr(struct ib_uverbs_file *file, idr_remove(&ib_uverbs_mr_idr, cmd.mr_handle); - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&memobj->uobject.list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); ib_umem_release(file->device->ib_dev, &memobj->umem); kfree(memobj); @@ -659,9 +647,9 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file, if (ret) goto err_cq; - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_add_tail(&uobj->uobject.list, &file->ucontext->cq_list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); memset(&resp, 0, sizeof resp); resp.cq_handle = uobj->uobject.id; @@ -676,9 +664,9 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file, return in_len; err_list: - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&uobj->uobject.list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); down(&ib_uverbs_idr_mutex); idr_remove(&ib_uverbs_cq_idr, uobj->uobject.id); @@ -724,9 +712,9 @@ ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file, idr_remove(&ib_uverbs_cq_idr, cmd.cq_handle); - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&uobj->uobject.list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); spin_lock_irq(&file->comp_file[0].lock); list_for_each_entry_safe(evt, tmp, &uobj->comp_list, obj_list) { @@ -859,9 +847,9 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, resp.qp_handle = uobj->uobject.id; - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_add_tail(&uobj->uobject.list, &file->ucontext->qp_list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); if (copy_to_user((void __user *) (unsigned long) cmd.response, &resp, sizeof resp)) { @@ -874,9 +862,9 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, return in_len; err_list: - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&uobj->uobject.list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); err_destroy: ib_destroy_qp(qp); @@ -1001,9 +989,9 @@ ssize_t ib_uverbs_destroy_qp(struct ib_uverbs_file *file, idr_remove(&ib_uverbs_qp_idr, cmd.qp_handle); - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&uobj->uobject.list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); spin_lock_irq(&file->async_file.lock); list_for_each_entry_safe(evt, tmp, &uobj->event_list, obj_list) { @@ -1148,9 +1136,9 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, resp.srq_handle = uobj->uobject.id; - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_add_tail(&uobj->uobject.list, &file->ucontext->srq_list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); if (copy_to_user((void __user *) (unsigned long) cmd.response, &resp, sizeof resp)) { @@ -1163,9 +1151,9 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, return in_len; err_list: - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&uobj->uobject.list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); err_destroy: ib_destroy_srq(srq); @@ -1239,9 +1227,9 @@ ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file, idr_remove(&ib_uverbs_srq_idr, cmd.srq_handle); - down(&file->mutex); + spin_lock_irq(&file->ucontext->lock); list_del(&uobj->uobject.list); - up(&file->mutex); + spin_unlock_irq(&file->ucontext->lock); spin_lock_irq(&file->async_file.lock); list_for_each_entry_safe(evt, tmp, &uobj->event_list, obj_list) { diff --git a/trunk/drivers/infiniband/core/uverbs_main.c b/trunk/drivers/infiniband/core/uverbs_main.c index 12511808de21..ce5bdb7af306 100644 --- a/trunk/drivers/infiniband/core/uverbs_main.c +++ b/trunk/drivers/infiniband/core/uverbs_main.c @@ -448,9 +448,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, if (hdr.in_words * 4 != count) return -EINVAL; - if (hdr.command < 0 || - hdr.command >= ARRAY_SIZE(uverbs_cmd_table) || - !uverbs_cmd_table[hdr.command]) + if (hdr.command < 0 || hdr.command >= ARRAY_SIZE(uverbs_cmd_table)) return -EINVAL; if (!file->ucontext && @@ -486,29 +484,27 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) file = kmalloc(sizeof *file + (dev->num_comp - 1) * sizeof (struct ib_uverbs_event_file), GFP_KERNEL); - if (!file) { - ret = -ENOMEM; - goto err; - } + if (!file) + return -ENOMEM; file->device = dev; kref_init(&file->ref); - init_MUTEX(&file->mutex); file->ucontext = NULL; - kref_get(&file->ref); ret = ib_uverbs_event_init(&file->async_file, file); if (ret) - goto err_kref; + goto err; file->async_file.is_async = 1; + kref_get(&file->ref); + for (i = 0; i < dev->num_comp; ++i) { - kref_get(&file->ref); ret = ib_uverbs_event_init(&file->comp_file[i], file); if (ret) goto err_async; + kref_get(&file->ref); file->comp_file[i].is_async = 0; } @@ -528,16 +524,9 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) ib_uverbs_event_release(&file->async_file); -err_kref: - /* - * One extra kref_put() because we took a reference before the - * event file creation that failed and got us here. - */ - kref_put(&file->ref, ib_uverbs_release_file); +err: kref_put(&file->ref, ib_uverbs_release_file); -err: - module_put(dev->ib_dev->owner); return ret; } diff --git a/trunk/drivers/infiniband/hw/mthca/mthca_cmd.c b/trunk/drivers/infiniband/hw/mthca/mthca_cmd.c index f6a8ac026557..cc758a2d2bc6 100644 --- a/trunk/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/trunk/drivers/infiniband/hw/mthca/mthca_cmd.c @@ -605,7 +605,7 @@ static int mthca_map_cmd(struct mthca_dev *dev, u16 op, struct mthca_icm *icm, err = -EINVAL; goto out; } - for (i = 0; i < mthca_icm_size(&iter) / (1 << lg); ++i) { + for (i = 0; i < mthca_icm_size(&iter) / (1 << lg); ++i, ++nent) { if (virt != -1) { pages[nent * 2] = cpu_to_be64(virt); virt += 1 << lg; @@ -616,7 +616,7 @@ static int mthca_map_cmd(struct mthca_dev *dev, u16 op, struct mthca_icm *icm, ts += 1 << (lg - 10); ++tc; - if (++nent == MTHCA_MAILBOX_SIZE / 16) { + if (nent == MTHCA_MAILBOX_SIZE / 16) { err = mthca_cmd(dev, mailbox->dma, nent, 0, op, CMD_TIME_CLASS_B, status); if (err || *status) diff --git a/trunk/drivers/infiniband/hw/mthca/mthca_eq.c b/trunk/drivers/infiniband/hw/mthca/mthca_eq.c index c81fa8e975ef..78152a8ad17d 100644 --- a/trunk/drivers/infiniband/hw/mthca/mthca_eq.c +++ b/trunk/drivers/infiniband/hw/mthca/mthca_eq.c @@ -836,7 +836,7 @@ int __devinit mthca_init_eq_table(struct mthca_dev *dev) dev->eq_table.clr_mask = swab32(1 << (dev->eq_table.inta_pin & 31)); dev->eq_table.clr_int = dev->clr_base + - (dev->eq_table.inta_pin < 32 ? 4 : 0); + (dev->eq_table.inta_pin < 31 ? 4 : 0); } dev->eq_table.arm_mask = 0; diff --git a/trunk/drivers/infiniband/hw/mthca/mthca_main.c b/trunk/drivers/infiniband/hw/mthca/mthca_main.c index 23a3f56c7899..ffbcd40418d5 100644 --- a/trunk/drivers/infiniband/hw/mthca/mthca_main.c +++ b/trunk/drivers/infiniband/hw/mthca/mthca_main.c @@ -503,25 +503,6 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev, return err; } -static void mthca_free_icms(struct mthca_dev *mdev) -{ - u8 status; - - mthca_free_icm_table(mdev, mdev->mcg_table.table); - if (mdev->mthca_flags & MTHCA_FLAG_SRQ) - mthca_free_icm_table(mdev, mdev->srq_table.table); - mthca_free_icm_table(mdev, mdev->cq_table.table); - mthca_free_icm_table(mdev, mdev->qp_table.rdb_table); - mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); - mthca_free_icm_table(mdev, mdev->qp_table.qp_table); - mthca_free_icm_table(mdev, mdev->mr_table.mpt_table); - mthca_free_icm_table(mdev, mdev->mr_table.mtt_table); - mthca_unmap_eq_icm(mdev); - - mthca_UNMAP_ICM_AUX(mdev, &status); - mthca_free_icm(mdev, mdev->fw.arbel.aux_icm); -} - static int __devinit mthca_init_arbel(struct mthca_dev *mdev) { struct mthca_dev_lim dev_lim; @@ -599,7 +580,18 @@ static int __devinit mthca_init_arbel(struct mthca_dev *mdev) return 0; err_free_icm: - mthca_free_icms(mdev); + if (mdev->mthca_flags & MTHCA_FLAG_SRQ) + mthca_free_icm_table(mdev, mdev->srq_table.table); + mthca_free_icm_table(mdev, mdev->cq_table.table); + mthca_free_icm_table(mdev, mdev->qp_table.rdb_table); + mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); + mthca_free_icm_table(mdev, mdev->qp_table.qp_table); + mthca_free_icm_table(mdev, mdev->mr_table.mpt_table); + mthca_free_icm_table(mdev, mdev->mr_table.mtt_table); + mthca_unmap_eq_icm(mdev); + + mthca_UNMAP_ICM_AUX(mdev, &status); + mthca_free_icm(mdev, mdev->fw.arbel.aux_icm); err_stop_fw: mthca_UNMAP_FA(mdev, &status); @@ -619,7 +611,18 @@ static void mthca_close_hca(struct mthca_dev *mdev) mthca_CLOSE_HCA(mdev, 0, &status); if (mthca_is_memfree(mdev)) { - mthca_free_icms(mdev); + if (mdev->mthca_flags & MTHCA_FLAG_SRQ) + mthca_free_icm_table(mdev, mdev->srq_table.table); + mthca_free_icm_table(mdev, mdev->cq_table.table); + mthca_free_icm_table(mdev, mdev->qp_table.rdb_table); + mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); + mthca_free_icm_table(mdev, mdev->qp_table.qp_table); + mthca_free_icm_table(mdev, mdev->mr_table.mpt_table); + mthca_free_icm_table(mdev, mdev->mr_table.mtt_table); + mthca_unmap_eq_icm(mdev); + + mthca_UNMAP_ICM_AUX(mdev, &status); + mthca_free_icm(mdev, mdev->fw.arbel.aux_icm); mthca_UNMAP_FA(mdev, &status); mthca_free_icm(mdev, mdev->fw.arbel.fw_icm); diff --git a/trunk/drivers/infiniband/hw/mthca/mthca_memfree.c b/trunk/drivers/infiniband/hw/mthca/mthca_memfree.c index 7bd7a4bec7b4..1827400f189b 100644 --- a/trunk/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/trunk/drivers/infiniband/hw/mthca/mthca_memfree.c @@ -290,7 +290,7 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, int i; u8 status; - num_icm = (obj_size * nobj + MTHCA_TABLE_CHUNK_SIZE - 1) / MTHCA_TABLE_CHUNK_SIZE; + num_icm = obj_size * nobj / MTHCA_TABLE_CHUNK_SIZE; table = kmalloc(sizeof *table + num_icm * sizeof *table->icm, GFP_KERNEL); if (!table) @@ -529,25 +529,12 @@ int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, __be32 **db) goto found; } - for (i = start; i != end; i += dir) - if (!dev->db_tab->page[i].db_rec) { - page = dev->db_tab->page + i; - goto alloc; - } - if (dev->db_tab->max_group1 >= dev->db_tab->min_group2 - 1) { ret = -ENOMEM; goto out; } - if (group == 0) - ++dev->db_tab->max_group1; - else - --dev->db_tab->min_group2; - page = dev->db_tab->page + end; - -alloc: page->db_rec = dma_alloc_coherent(&dev->pdev->dev, 4096, &page->mapping, GFP_KERNEL); if (!page->db_rec) { @@ -567,6 +554,10 @@ int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, __be32 **db) } bitmap_zero(page->used, MTHCA_DB_REC_PER_PAGE); + if (group == 0) + ++dev->db_tab->max_group1; + else + --dev->db_tab->min_group2; found: j = find_first_zero_bit(page->used, MTHCA_DB_REC_PER_PAGE); diff --git a/trunk/drivers/infiniband/hw/mthca/mthca_provider.c b/trunk/drivers/infiniband/hw/mthca/mthca_provider.c index 3f5319a46577..1c1c2e230871 100644 --- a/trunk/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/trunk/drivers/infiniband/hw/mthca/mthca_provider.c @@ -84,7 +84,7 @@ static int mthca_query_device(struct ib_device *ibdev, props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) & 0xffffff; props->vendor_part_id = be16_to_cpup((__be16 *) (out_mad->data + 30)); - props->hw_ver = be32_to_cpup((__be32 *) (out_mad->data + 32)); + props->hw_ver = be16_to_cpup((__be16 *) (out_mad->data + 32)); memcpy(&props->sys_image_guid, out_mad->data + 4, 8); memcpy(&props->node_guid, out_mad->data + 12, 8); diff --git a/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c b/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c index 6c5bf07489f4..704f48e0b6a7 100644 --- a/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -474,7 +474,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) spin_unlock(&priv->lock); } -static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev) +static void path_lookup(struct sk_buff *skb, struct net_device *dev) { struct ipoib_dev_priv *priv = netdev_priv(skb->dev); @@ -569,7 +569,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) if (skb->dst && skb->dst->neighbour) { if (unlikely(!*to_ipoib_neigh(skb->dst->neighbour))) { - ipoib_path_lookup(skb, dev); + path_lookup(skb, dev); goto out; } diff --git a/trunk/drivers/input/input.c b/trunk/drivers/input/input.c index 14ae5583e198..88636a204525 100644 --- a/trunk/drivers/input/input.c +++ b/trunk/drivers/input/input.c @@ -308,7 +308,6 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st MATCH_BIT(ledbit, LED_MAX); MATCH_BIT(sndbit, SND_MAX); MATCH_BIT(ffbit, FF_MAX); - MATCH_BIT(swbit, SW_MAX); return id; } diff --git a/trunk/drivers/input/keyboard/Kconfig b/trunk/drivers/input/keyboard/Kconfig index 571a68691a4a..444f7756fee6 100644 --- a/trunk/drivers/input/keyboard/Kconfig +++ b/trunk/drivers/input/keyboard/Kconfig @@ -93,7 +93,7 @@ config KEYBOARD_LKKBD config KEYBOARD_LOCOMO tristate "LoCoMo Keyboard Support" - depends on SHARP_LOCOMO && INPUT_KEYBOARD + depends on SHARP_LOCOMO help Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA diff --git a/trunk/drivers/input/keyboard/spitzkbd.c b/trunk/drivers/input/keyboard/spitzkbd.c index 344f46005401..1714045a182b 100644 --- a/trunk/drivers/input/keyboard/spitzkbd.c +++ b/trunk/drivers/input/keyboard/spitzkbd.c @@ -53,7 +53,7 @@ static unsigned char spitzkbd_keycode[NR_SCANCODES] = { KEY_LEFTCTRL, KEY_1, KEY_3, KEY_5, KEY_6, KEY_7, KEY_9, KEY_0, KEY_BACKSPACE, SPITZ_KEY_EXOK, SPITZ_KEY_EXCANCEL, 0, 0, 0, 0, 0, /* 1-16 */ 0, KEY_2, KEY_4, KEY_R, KEY_Y, KEY_8, KEY_I, KEY_O, KEY_P, SPITZ_KEY_EXJOGDOWN, SPITZ_KEY_EXJOGUP, 0, 0, 0, 0, 0, /* 17-32 */ KEY_TAB, KEY_Q, KEY_E, KEY_T, KEY_G, KEY_U, KEY_J, KEY_K, 0, 0, 0, 0, 0, 0, 0, 0, /* 33-48 */ - SPITZ_KEY_CALENDER, KEY_W, KEY_S, KEY_F, KEY_V, KEY_H, KEY_M, KEY_L, 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, 0, /* 49-64 */ + SPITZ_KEY_CALENDER, KEY_W, KEY_S, KEY_F, KEY_V, KEY_H, KEY_M, KEY_L, 0, 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, /* 49-64 */ SPITZ_KEY_ADDRESS, KEY_A, KEY_D, KEY_C, KEY_B, KEY_N, KEY_DOT, 0, KEY_ENTER, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 65-80 */ SPITZ_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, SPITZ_KEY_FN, 0, 0, 0, 0, 0, /* 81-96 */ KEY_SYSRQ, SPITZ_KEY_JAP1, SPITZ_KEY_JAP2, SPITZ_KEY_CANCEL, SPITZ_KEY_OK, SPITZ_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0 /* 97-112 */ diff --git a/trunk/drivers/input/misc/uinput.c b/trunk/drivers/input/misc/uinput.c index 4015a91f4b6e..d5c5b32045af 100644 --- a/trunk/drivers/input/misc/uinput.c +++ b/trunk/drivers/input/misc/uinput.c @@ -90,11 +90,11 @@ static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request) { + complete(&request->done); + /* Mark slot as available */ udev->requests[request->id] = NULL; wake_up_interruptible(&udev->requests_waitq); - - complete(&request->done); } static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) diff --git a/trunk/drivers/isdn/divert/divert_procfs.c b/trunk/drivers/isdn/divert/divert_procfs.c index 0b0ea26023e5..e1f0d87de0eb 100644 --- a/trunk/drivers/isdn/divert/divert_procfs.c +++ b/trunk/drivers/isdn/divert/divert_procfs.c @@ -287,12 +287,12 @@ divert_dev_init(void) init_waitqueue_head(&rd_queue); #ifdef CONFIG_PROC_FS - isdn_proc_entry = proc_mkdir("net/isdn", NULL); + isdn_proc_entry = create_proc_entry("isdn", S_IFDIR | S_IRUGO | S_IXUGO, proc_net); if (!isdn_proc_entry) return (-1); isdn_divert_entry = create_proc_entry("divert", S_IFREG | S_IRUGO, isdn_proc_entry); if (!isdn_divert_entry) { - remove_proc_entry("net/isdn", NULL); + remove_proc_entry("isdn", proc_net); return (-1); } isdn_divert_entry->proc_fops = &isdn_fops; @@ -312,7 +312,7 @@ divert_dev_deinit(void) #ifdef CONFIG_PROC_FS remove_proc_entry("divert", isdn_proc_entry); - remove_proc_entry("net/isdn", NULL); + remove_proc_entry("isdn", proc_net); #endif /* CONFIG_PROC_FS */ return (0); diff --git a/trunk/drivers/isdn/hardware/eicon/diva_didd.c b/trunk/drivers/isdn/hardware/eicon/diva_didd.c index 27204f4b111a..7fdf8ae5be52 100644 --- a/trunk/drivers/isdn/hardware/eicon/diva_didd.c +++ b/trunk/drivers/isdn/hardware/eicon/diva_didd.c @@ -30,6 +30,8 @@ static char *DRIVERNAME = static char *DRIVERLNAME = "divadidd"; char *DRIVERRELEASE_DIDD = "2.0"; +static char *main_proc_dir = "eicon"; + MODULE_DESCRIPTION("DIDD table driver for diva drivers"); MODULE_AUTHOR("Cytronics & Melware, Eicon Networks"); MODULE_SUPPORTED_DEVICE("Eicon diva drivers"); @@ -87,7 +89,7 @@ proc_read(char *page, char **start, off_t off, int count, int *eof, static int DIVA_INIT_FUNCTION create_proc(void) { - proc_net_eicon = proc_mkdir("net/eicon", NULL); + proc_net_eicon = create_proc_entry(main_proc_dir, S_IFDIR, proc_net); if (proc_net_eicon) { if ((proc_didd = @@ -103,7 +105,7 @@ static int DIVA_INIT_FUNCTION create_proc(void) static void DIVA_EXIT_FUNCTION remove_proc(void) { remove_proc_entry(DRIVERLNAME, proc_net_eicon); - remove_proc_entry("net/eicon", NULL); + remove_proc_entry(main_proc_dir, proc_net); } static int DIVA_INIT_FUNCTION divadidd_init(void) diff --git a/trunk/drivers/isdn/hardware/eicon/divasproc.c b/trunk/drivers/isdn/hardware/eicon/divasproc.c index c12efa6f8429..b6435589d459 100644 --- a/trunk/drivers/isdn/hardware/eicon/divasproc.c +++ b/trunk/drivers/isdn/hardware/eicon/divasproc.c @@ -381,7 +381,7 @@ int create_adapter_proc(diva_os_xdi_adapter_t * a) char tmp[16]; sprintf(tmp, "%s%d", adapter_dir_name, a->controller); - if (!(de = proc_mkdir(tmp, proc_net_eicon))) + if (!(de = create_proc_entry(tmp, S_IFDIR, proc_net_eicon))) return (0); a->proc_adapter_dir = (void *) de; diff --git a/trunk/drivers/isdn/hisax/st5481_b.c b/trunk/drivers/isdn/hisax/st5481_b.c index 657817a591fe..0a2536d62402 100644 --- a/trunk/drivers/isdn/hisax/st5481_b.c +++ b/trunk/drivers/isdn/hisax/st5481_b.c @@ -209,7 +209,9 @@ static void st5481B_mode(struct st5481_bcs *bcs, int mode) bcs->mode = mode; // Cancel all USB transfers on this B channel + b_out->urb[0]->transfer_flags |= URB_ASYNC_UNLINK; usb_unlink_urb(b_out->urb[0]); + b_out->urb[1]->transfer_flags |= URB_ASYNC_UNLINK; usb_unlink_urb(b_out->urb[1]); b_out->busy = 0; diff --git a/trunk/drivers/isdn/hisax/st5481_usb.c b/trunk/drivers/isdn/hisax/st5481_usb.c index 89fbeb58485d..ffd5b2d45552 100644 --- a/trunk/drivers/isdn/hisax/st5481_usb.c +++ b/trunk/drivers/isdn/hisax/st5481_usb.c @@ -645,7 +645,9 @@ void st5481_in_mode(struct st5481_in *in, int mode) in->mode = mode; + in->urb[0]->transfer_flags |= URB_ASYNC_UNLINK; usb_unlink_urb(in->urb[0]); + in->urb[1]->transfer_flags |= URB_ASYNC_UNLINK; usb_unlink_urb(in->urb[1]); if (in->mode != L1_MODE_NULL) { diff --git a/trunk/drivers/isdn/hysdn/hysdn_procconf.c b/trunk/drivers/isdn/hysdn/hysdn_procconf.c index 639582f61f41..5da507e532fc 100644 --- a/trunk/drivers/isdn/hysdn/hysdn_procconf.c +++ b/trunk/drivers/isdn/hysdn/hysdn_procconf.c @@ -394,7 +394,7 @@ hysdn_procconf_init(void) hysdn_card *card; uchar conf_name[20]; - hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net); + hysdn_proc_entry = create_proc_entry(PROC_SUBDIR_NAME, S_IFDIR | S_IRUGO | S_IXUGO, proc_net); if (!hysdn_proc_entry) { printk(KERN_ERR "HYSDN: unable to create hysdn subdir\n"); return (-1); diff --git a/trunk/drivers/macintosh/smu.c b/trunk/drivers/macintosh/smu.c index 9b38674fbf75..a85ac18dd21d 100644 --- a/trunk/drivers/macintosh/smu.c +++ b/trunk/drivers/macintosh/smu.c @@ -153,10 +153,8 @@ static irqreturn_t smu_db_intr(int irq, void *arg, struct pt_regs *regs) spin_lock_irqsave(&smu->lock, flags); gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, smu->doorbell); - if ((gpio & 7) != 7) { - spin_unlock_irqrestore(&smu->lock, flags); + if ((gpio & 7) != 7) return IRQ_HANDLED; - } cmd = smu->cmd_cur; smu->cmd_cur = NULL; diff --git a/trunk/drivers/md/dm-crypt.c b/trunk/drivers/md/dm-crypt.c index b6148f6f7836..b82bc3150476 100644 --- a/trunk/drivers/md/dm-crypt.c +++ b/trunk/drivers/md/dm-crypt.c @@ -96,7 +96,7 @@ static kmem_cache_t *_crypt_io_pool; /* * Mempool alloc and free functions for the page */ -static void *mempool_alloc_page(gfp_t gfp_mask, void *data) +static void *mempool_alloc_page(unsigned int __nocast gfp_mask, void *data) { return alloc_page(gfp_mask); } diff --git a/trunk/drivers/md/dm-io.c b/trunk/drivers/md/dm-io.c index 4809b209fbb1..9de000131a8a 100644 --- a/trunk/drivers/md/dm-io.c +++ b/trunk/drivers/md/dm-io.c @@ -32,7 +32,7 @@ struct io { static unsigned _num_ios; static mempool_t *_io_pool; -static void *alloc_io(gfp_t gfp_mask, void *pool_data) +static void *alloc_io(unsigned int __nocast gfp_mask, void *pool_data) { return kmalloc(sizeof(struct io), gfp_mask); } diff --git a/trunk/drivers/md/dm-ioctl.c b/trunk/drivers/md/dm-ioctl.c index 54ec737195e0..200a0688f717 100644 --- a/trunk/drivers/md/dm-ioctl.c +++ b/trunk/drivers/md/dm-ioctl.c @@ -230,20 +230,11 @@ static int dm_hash_insert(const char *name, const char *uuid, struct mapped_devi static void __hash_remove(struct hash_cell *hc) { - struct dm_table *table; - /* remove from the dev hash */ list_del(&hc->uuid_list); list_del(&hc->name_list); unregister_with_devfs(hc); dm_set_mdptr(hc->md, NULL); - - table = dm_get_table(hc->md); - if (table) { - dm_table_event(table); - dm_table_put(table); - } - dm_put(hc->md); if (hc->new_map) dm_table_put(hc->new_map); diff --git a/trunk/drivers/md/dm-mpath.c b/trunk/drivers/md/dm-mpath.c index f9b7b32d5d5c..785806bdb248 100644 --- a/trunk/drivers/md/dm-mpath.c +++ b/trunk/drivers/md/dm-mpath.c @@ -329,17 +329,13 @@ static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio, /* * If we run out of usable paths, should we queue I/O or error it? */ -static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path, - unsigned save_old_value) +static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path) { unsigned long flags; spin_lock_irqsave(&m->lock, flags); - if (save_old_value) - m->saved_queue_if_no_path = m->queue_if_no_path; - else - m->saved_queue_if_no_path = queue_if_no_path; + m->saved_queue_if_no_path = m->queue_if_no_path; m->queue_if_no_path = queue_if_no_path; if (!m->queue_if_no_path && m->queue_size) queue_work(kmultipathd, &m->process_queued_ios); @@ -681,7 +677,7 @@ static int parse_features(struct arg_set *as, struct multipath *m, return 0; if (!strnicmp(shift(as), MESG_STR("queue_if_no_path"))) - return queue_if_no_path(m, 1, 0); + return queue_if_no_path(m, 1); else { ti->error = "Unrecognised multipath feature request"; return -EINVAL; @@ -1081,7 +1077,7 @@ static void multipath_presuspend(struct dm_target *ti) { struct multipath *m = (struct multipath *) ti->private; - queue_if_no_path(m, 0, 1); + queue_if_no_path(m, 0); } /* @@ -1226,9 +1222,9 @@ static int multipath_message(struct dm_target *ti, unsigned argc, char **argv) if (argc == 1) { if (!strnicmp(argv[0], MESG_STR("queue_if_no_path"))) - return queue_if_no_path(m, 1, 0); + return queue_if_no_path(m, 1); else if (!strnicmp(argv[0], MESG_STR("fail_if_no_path"))) - return queue_if_no_path(m, 0, 0); + return queue_if_no_path(m, 0); } if (argc != 2) diff --git a/trunk/drivers/md/dm-raid1.c b/trunk/drivers/md/dm-raid1.c index 2375709a392c..863282513753 100644 --- a/trunk/drivers/md/dm-raid1.c +++ b/trunk/drivers/md/dm-raid1.c @@ -122,7 +122,7 @@ static inline sector_t region_to_sector(struct region_hash *rh, region_t region) /* FIXME move this */ static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw); -static void *region_alloc(gfp_t gfp_mask, void *pool_data) +static void *region_alloc(unsigned int __nocast gfp_mask, void *pool_data) { return kmalloc(sizeof(struct region), gfp_mask); } diff --git a/trunk/drivers/md/multipath.c b/trunk/drivers/md/multipath.c index 1151c3ed3006..286342375fb7 100644 --- a/trunk/drivers/md/multipath.c +++ b/trunk/drivers/md/multipath.c @@ -38,7 +38,7 @@ static mdk_personality_t multipath_personality; -static void *mp_pool_alloc(gfp_t gfp_flags, void *data) +static void *mp_pool_alloc(unsigned int __nocast gfp_flags, void *data) { struct multipath_bh *mpb; mpb = kmalloc(sizeof(*mpb), gfp_flags); diff --git a/trunk/drivers/md/raid1.c b/trunk/drivers/md/raid1.c index 0e1f148dd41d..a93ca478142a 100644 --- a/trunk/drivers/md/raid1.c +++ b/trunk/drivers/md/raid1.c @@ -52,7 +52,7 @@ static mdk_personality_t raid1_personality; static void unplug_slaves(mddev_t *mddev); -static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data) +static void * r1bio_pool_alloc(unsigned int __nocast gfp_flags, void *data) { struct pool_info *pi = data; r1bio_t *r1_bio; @@ -79,7 +79,7 @@ static void r1bio_pool_free(void *r1_bio, void *data) #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) #define RESYNC_WINDOW (2048*1024) -static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) +static void * r1buf_pool_alloc(unsigned int __nocast gfp_flags, void *data) { struct pool_info *pi = data; struct page *page; diff --git a/trunk/drivers/md/raid10.c b/trunk/drivers/md/raid10.c index 28dd028415e4..5bd1e9ec899d 100644 --- a/trunk/drivers/md/raid10.c +++ b/trunk/drivers/md/raid10.c @@ -47,7 +47,7 @@ static void unplug_slaves(mddev_t *mddev); -static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data) +static void * r10bio_pool_alloc(unsigned int __nocast gfp_flags, void *data) { conf_t *conf = data; r10bio_t *r10_bio; @@ -81,7 +81,7 @@ static void r10bio_pool_free(void *r10_bio, void *data) * one for write (we recover only one drive per r10buf) * */ -static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data) +static void * r10buf_pool_alloc(unsigned int __nocast gfp_flags, void *data) { conf_t *conf = data; struct page *page; diff --git a/trunk/drivers/media/dvb/frontends/tda10021.c b/trunk/drivers/media/dvb/frontends/tda10021.c index eaf130e666d8..87d5f4d8790f 100644 --- a/trunk/drivers/media/dvb/frontends/tda10021.c +++ b/trunk/drivers/media/dvb/frontends/tda10021.c @@ -100,8 +100,8 @@ static u8 tda10021_readreg (struct tda10021_state* state, u8 reg) ret = i2c_transfer (state->i2c, msg, 2); if (ret != 2) - printk("DVB: TDA10021: %s: readreg error (ret == %i)\n", - __FUNCTION__, ret); + printk("DVB: TDA10021(%d): %s: readreg error (ret == %i)\n", + state->frontend.dvb->num, __FUNCTION__, ret); return b1[0]; } diff --git a/trunk/drivers/media/radio/radio-cadet.c b/trunk/drivers/media/radio/radio-cadet.c index 9b0406318f2d..022913da8c59 100644 --- a/trunk/drivers/media/radio/radio-cadet.c +++ b/trunk/drivers/media/radio/radio-cadet.c @@ -543,7 +543,7 @@ static int cadet_probe(void) for(i=0;i<8;i++) { io=iovals[i]; - if (request_region(io, 2, "cadet-probe")) { + if(request_region(io,2, "cadet-probe")>=0) { cadet_setfreq(1410); if(cadet_getfreq()==1410) { release_region(io, 2); diff --git a/trunk/drivers/media/video/bttv-cards.c b/trunk/drivers/media/video/bttv-cards.c index 0881a17d5226..190977a1e549 100644 --- a/trunk/drivers/media/video/bttv-cards.c +++ b/trunk/drivers/media/video/bttv-cards.c @@ -2393,12 +2393,12 @@ struct tvcard bttv_tvcards[] = { .tuner = 0, .tuner_type = TUNER_LG_TDVS_H062F, .tuner_addr = ADDR_UNSET, - .video_inputs = 3, + .video_inputs = 2, .audio_inputs = 1, .svhs = 2, - .muxsel = { 2, 3, 1 }, + .muxsel = { 2, 3 }, .gpiomask = 0x00e00007, - .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, + .audiomux = { 0x00400005, 0, 0, 0, 0, 0 }, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, diff --git a/trunk/drivers/media/video/cpia.c b/trunk/drivers/media/video/cpia.c index b7ec9bf45085..8c08b7f1ad23 100644 --- a/trunk/drivers/media/video/cpia.c +++ b/trunk/drivers/media/video/cpia.c @@ -1397,7 +1397,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam) static void proc_cpia_create(void) { - cpia_proc_root = proc_mkdir("cpia", NULL); + cpia_proc_root = create_proc_entry("cpia", S_IFDIR, NULL); if (cpia_proc_root) cpia_proc_root->owner = THIS_MODULE; diff --git a/trunk/drivers/media/video/rds.h b/trunk/drivers/media/video/rds.h index 0d30eb744e61..30337d0f1a87 100644 --- a/trunk/drivers/media/video/rds.h +++ b/trunk/drivers/media/video/rds.h @@ -31,7 +31,7 @@ struct rds_command { unsigned int block_count; int result; - unsigned char __user *buffer; + unsigned char *buffer; struct file *instance; poll_table *event_list; }; diff --git a/trunk/drivers/media/video/saa6588.c b/trunk/drivers/media/video/saa6588.c index 72b70eb5da1d..1a657a70ff43 100644 --- a/trunk/drivers/media/video/saa6588.c +++ b/trunk/drivers/media/video/saa6588.c @@ -157,7 +157,7 @@ static struct i2c_client client_template; /* ---------------------------------------------------------------------- */ -static int block_to_user_buf(struct saa6588 *s, unsigned char __user *user_buf) +static int block_to_user_buf(struct saa6588 *s, unsigned char *user_buf) { int i; @@ -191,7 +191,7 @@ static void read_from_buf(struct saa6588 *s, struct rds_command *a) { unsigned long flags; - unsigned char __user *buf_ptr = a->buffer; + unsigned char *buf_ptr = a->buffer; /* This is a user space buffer! */ unsigned int i; unsigned int rd_blocks; diff --git a/trunk/drivers/media/video/vpx3220.c b/trunk/drivers/media/video/vpx3220.c index 137b58f2c666..4437bdebe24f 100644 --- a/trunk/drivers/media/video/vpx3220.c +++ b/trunk/drivers/media/video/vpx3220.c @@ -203,7 +203,7 @@ static const unsigned short init_ntsc[] = { 0x8c, 640, /* Horizontal length */ 0x8d, 640, /* Number of pixels */ 0x8f, 0xc00, /* Disable window 2 */ - 0xf0, 0x73, /* 13.5 MHz transport, Forced + 0xf0, 0x173, /* 13.5 MHz transport, Forced * mode, latch windows */ 0xf2, 0x13, /* NTSC M, composite input */ 0xe7, 0x1e1, /* Enable vertical standard @@ -212,36 +212,38 @@ static const unsigned short init_ntsc[] = { static const unsigned short init_pal[] = { 0x88, 23, /* Window 1 vertical begin */ - 0x89, 288, /* Vertical lines in (16 lines + 0x89, 288 + 16, /* Vertical lines in (16 lines * skipped by the VFE) */ - 0x8a, 288, /* Vertical lines out (16 lines + 0x8a, 288 + 16, /* Vertical lines out (16 lines * skipped by the VFE) */ 0x8b, 16, /* Horizontal begin */ 0x8c, 768, /* Horizontal length */ 0x8d, 784, /* Number of pixels * Must be >= Horizontal begin + Horizontal length */ 0x8f, 0xc00, /* Disable window 2 */ - 0xf0, 0x77, /* 13.5 MHz transport, Forced + 0xf0, 0x177, /* 13.5 MHz transport, Forced * mode, latch windows */ 0xf2, 0x3d1, /* PAL B,G,H,I, composite input */ - 0xe7, 0x241, /* PAL/SECAM set to 288 lines */ + 0xe7, 0x261, /* PAL/SECAM set to 288 + 16 lines + * change to 0x241 for 288 lines */ }; static const unsigned short init_secam[] = { - 0x88, 23, /* Window 1 vertical begin */ - 0x89, 288, /* Vertical lines in (16 lines + 0x88, 23 - 16, /* Window 1 vertical begin */ + 0x89, 288 + 16, /* Vertical lines in (16 lines * skipped by the VFE) */ - 0x8a, 288, /* Vertical lines out (16 lines + 0x8a, 288 + 16, /* Vertical lines out (16 lines * skipped by the VFE) */ 0x8b, 16, /* Horizontal begin */ 0x8c, 768, /* Horizontal length */ 0x8d, 784, /* Number of pixels * Must be >= Horizontal begin + Horizontal length */ 0x8f, 0xc00, /* Disable window 2 */ - 0xf0, 0x77, /* 13.5 MHz transport, Forced + 0xf0, 0x177, /* 13.5 MHz transport, Forced * mode, latch windows */ 0xf2, 0x3d5, /* SECAM, composite input */ - 0xe7, 0x241, /* PAL/SECAM set to 288 lines */ + 0xe7, 0x261, /* PAL/SECAM set to 288 + 16 lines + * change to 0x241 for 288 lines */ }; static const unsigned char init_common[] = { @@ -408,12 +410,6 @@ vpx3220_command (struct i2c_client *client, case DECODER_SET_NORM: { int *iarg = arg, data; - int temp_input; - - /* Here we back up the input selection because it gets - overwritten when we fill the registers with the - choosen video norm */ - temp_input = vpx3220_fp_read(client, 0xf2); dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", I2C_NAME(client), *iarg); @@ -453,10 +449,6 @@ vpx3220_command (struct i2c_client *client, } decoder->norm = *iarg; - - /* And here we set the backed up video input again */ - vpx3220_fp_write(client, 0xf2, temp_input | 0x0010); - udelay(10); } break; diff --git a/trunk/drivers/mfd/ucb1x00-core.c b/trunk/drivers/mfd/ucb1x00-core.c index e335d54c4659..10f6ce1bc0ab 100644 --- a/trunk/drivers/mfd/ucb1x00-core.c +++ b/trunk/drivers/mfd/ucb1x00-core.c @@ -457,17 +457,6 @@ static int ucb1x00_detect_irq(struct ucb1x00 *ucb) return probe_irq_off(mask); } -static void ucb1x00_release(struct class_device *dev) -{ - struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); - kfree(ucb); -} - -static struct class ucb1x00_class = { - .name = "ucb1x00", - .release = ucb1x00_release, -}; - static int ucb1x00_probe(struct mcp *mcp) { struct ucb1x00 *ucb; @@ -557,6 +546,17 @@ static void ucb1x00_remove(struct mcp *mcp) class_device_unregister(&ucb->cdev); } +static void ucb1x00_release(struct class_device *dev) +{ + struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); + kfree(ucb); +} + +static struct class ucb1x00_class = { + .name = "ucb1x00", + .release = ucb1x00_release, +}; + int ucb1x00_register_driver(struct ucb1x00_driver *drv) { struct ucb1x00 *ucb; @@ -642,6 +642,8 @@ static void __exit ucb1x00_exit(void) module_init(ucb1x00_init); module_exit(ucb1x00_exit); +EXPORT_SYMBOL(ucb1x00_class); + EXPORT_SYMBOL(ucb1x00_io_set_dir); EXPORT_SYMBOL(ucb1x00_io_write); EXPORT_SYMBOL(ucb1x00_io_read); diff --git a/trunk/drivers/mfd/ucb1x00-ts.c b/trunk/drivers/mfd/ucb1x00-ts.c index a260f83bcb02..a851d65c7cfe 100644 --- a/trunk/drivers/mfd/ucb1x00-ts.c +++ b/trunk/drivers/mfd/ucb1x00-ts.c @@ -48,8 +48,8 @@ struct ucb1x00_ts { u16 x_res; u16 y_res; - unsigned int restart:1; - unsigned int adcsync:1; + int restart:1; + int adcsync:1; }; static int adcsync; diff --git a/trunk/drivers/mfd/ucb1x00.h b/trunk/drivers/mfd/ucb1x00.h index 9c9a647d8b7b..6b632644f59a 100644 --- a/trunk/drivers/mfd/ucb1x00.h +++ b/trunk/drivers/mfd/ucb1x00.h @@ -106,6 +106,8 @@ struct ucb1x00_irq { void (*fn)(int, void *); }; +extern struct class ucb1x00_class; + struct ucb1x00 { spinlock_t lock; struct mcp *mcp; diff --git a/trunk/drivers/mtd/maps/bast-flash.c b/trunk/drivers/mtd/maps/bast-flash.c index 0ba0ff7d43b9..0c45464e3f7b 100644 --- a/trunk/drivers/mtd/maps/bast-flash.c +++ b/trunk/drivers/mtd/maps/bast-flash.c @@ -39,6 +39,7 @@ #include #include +#include #include #include diff --git a/trunk/drivers/mtd/maps/ixp2000.c b/trunk/drivers/mtd/maps/ixp2000.c index a9f86c7fbd52..3e94b616743d 100644 --- a/trunk/drivers/mtd/maps/ixp2000.c +++ b/trunk/drivers/mtd/maps/ixp2000.c @@ -30,6 +30,7 @@ #include #include +#include #include #include diff --git a/trunk/drivers/mtd/maps/ixp4xx.c b/trunk/drivers/mtd/maps/ixp4xx.c index 3fcc32884074..5afe660aa2c4 100644 --- a/trunk/drivers/mtd/maps/ixp4xx.c +++ b/trunk/drivers/mtd/maps/ixp4xx.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -253,6 +254,6 @@ module_init(ixp4xx_flash_init); module_exit(ixp4xx_flash_exit); MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems"); +MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems") MODULE_AUTHOR("Deepak Saxena"); diff --git a/trunk/drivers/mtd/maps/omap_nor.c b/trunk/drivers/mtd/maps/omap_nor.c index b17bca657daf..8cc71409a328 100644 --- a/trunk/drivers/mtd/maps/omap_nor.c +++ b/trunk/drivers/mtd/maps/omap_nor.c @@ -42,6 +42,7 @@ #include #include +#include #include #include diff --git a/trunk/drivers/mtd/maps/sa1100-flash.c b/trunk/drivers/mtd/maps/sa1100-flash.c index 8dcaa357b4bb..52385705da09 100644 --- a/trunk/drivers/mtd/maps/sa1100-flash.c +++ b/trunk/drivers/mtd/maps/sa1100-flash.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/trunk/drivers/mtd/nand/s3c2410.c b/trunk/drivers/mtd/nand/s3c2410.c index b47ebcb31e0f..891e3a1b9110 100644 --- a/trunk/drivers/mtd/nand/s3c2410.c +++ b/trunk/drivers/mtd/nand/s3c2410.c @@ -58,6 +58,7 @@ #include #include +#include #include #include diff --git a/trunk/drivers/net/8390.c b/trunk/drivers/net/8390.c index f87027420081..6d76f3a99b17 100644 --- a/trunk/drivers/net/8390.c +++ b/trunk/drivers/net/8390.c @@ -1094,7 +1094,7 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length, outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD); - if (inb_p(e8390_base + E8390_CMD) & E8390_TRANS) + if (inb_p(e8390_base) & E8390_TRANS) { printk(KERN_WARNING "%s: trigger_send() called with the transmitter busy.\n", dev->name); diff --git a/trunk/drivers/net/Kconfig b/trunk/drivers/net/Kconfig index c748b0e16419..96f14ab1c1f5 100644 --- a/trunk/drivers/net/Kconfig +++ b/trunk/drivers/net/Kconfig @@ -548,14 +548,6 @@ config SUNGEM Support for the Sun GEM chip, aka Sun GigabitEthernet/P 2.0. See also . -config CASSINI - tristate "Sun Cassini support" - depends on NET_ETHERNET && PCI - select CRC32 - help - Support for the Sun Cassini chip, aka Sun GigaSwift Ethernet. See also - - config NET_VENDOR_3COM bool "3COM cards" depends on NET_ETHERNET && (ISA || EISA || MCA || PCI) @@ -1655,7 +1647,7 @@ config LAN_SAA9730 config NET_POCKET bool "Pocket and portable adapters" - depends on NET_ETHERNET && PARPORT + depends on NET_ETHERNET && ISA ---help--- Cute little network (Ethernet) devices which attach to the parallel port ("pocket adapters"), commonly used with laptops. If you have @@ -1679,7 +1671,7 @@ config NET_POCKET config ATP tristate "AT-LAN-TEC/RealTek pocket adapter support" - depends on NET_POCKET && PARPORT && X86 + depends on NET_POCKET && ISA && X86 select CRC32 ---help--- This is a network (Ethernet) device which attaches to your parallel @@ -1694,7 +1686,7 @@ config ATP config DE600 tristate "D-Link DE600 pocket adapter support" - depends on NET_POCKET && PARPORT + depends on NET_POCKET && ISA ---help--- This is a network (Ethernet) device which attaches to your parallel port. Read as well as the @@ -1709,7 +1701,7 @@ config DE600 config DE620 tristate "D-Link DE620 pocket adapter support" - depends on NET_POCKET && PARPORT + depends on NET_POCKET && ISA ---help--- This is a network (Ethernet) device which attaches to your parallel port. Read as well as the diff --git a/trunk/drivers/net/Makefile b/trunk/drivers/net/Makefile index 8aeec9f2495b..8645c843cf4d 100644 --- a/trunk/drivers/net/Makefile +++ b/trunk/drivers/net/Makefile @@ -28,7 +28,6 @@ obj-$(CONFIG_SUNQE) += sunqe.o obj-$(CONFIG_SUNBMAC) += sunbmac.o obj-$(CONFIG_MYRI_SBUS) += myri_sbus.o obj-$(CONFIG_SUNGEM) += sungem.o sungem_phy.o -obj-$(CONFIG_CASSINI) += cassini.o obj-$(CONFIG_MACE) += mace.o obj-$(CONFIG_BMAC) += bmac.o diff --git a/trunk/drivers/net/arm/am79c961a.c b/trunk/drivers/net/arm/am79c961a.c index c56d86d371a9..9b659e3c8d67 100644 --- a/trunk/drivers/net/arm/am79c961a.c +++ b/trunk/drivers/net/arm/am79c961a.c @@ -15,13 +15,16 @@ */ #include #include +#include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -30,6 +33,7 @@ #include #include #include +#include #define TX_BUFFERS 15 #define RX_BUFFERS 25 @@ -81,7 +85,7 @@ static inline unsigned short read_ireg(u_long base_addr, u_int reg) u_short v; __asm__( "str%?h %1, [%2] @ NAT_RAP\n\t" - "ldr%?h %0, [%2, #8] @ NET_IDP\n\t" + "str%?h %0, [%2, #8] @ NET_IDP\n\t" : "=r" (v) : "r" (reg), "r" (ISAIO_BASE + 0x0464)); return v; @@ -284,7 +288,7 @@ static void am79c961_timer(unsigned long data) else if (!lnkstat && carrier) netif_carrier_off(dev); - mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500)); + mod_timer(&priv->timer, jiffies + 5*HZ); } /* @@ -705,9 +709,13 @@ static int __init am79c961_init(void) goto release; am79c961_banner(); + printk(KERN_INFO "%s: ether address ", dev->name); - for (i = 0; i < 6; i++) + /* Retrive and print the ethernet address. */ + for (i = 0; i < 6; i++) { dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff; + printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]); + } spin_lock_init(&priv->chip_lock); init_timer(&priv->timer); @@ -728,14 +736,8 @@ static int __init am79c961_init(void) #endif ret = register_netdev(dev); - if (ret == 0) { - printk(KERN_INFO "%s: ether address ", dev->name); - - for (i = 0; i < 6; i++) - printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]); - + if (ret == 0) return 0; - } release: release_region(dev->base_addr, 0x18); diff --git a/trunk/drivers/net/bmac.c b/trunk/drivers/net/bmac.c index 60dba4a1ca5c..8dc657fc8afb 100644 --- a/trunk/drivers/net/bmac.c +++ b/trunk/drivers/net/bmac.c @@ -218,7 +218,7 @@ void bmwrite(struct net_device *dev, unsigned long reg_offset, unsigned data ) static inline -unsigned short bmread(struct net_device *dev, unsigned long reg_offset ) +volatile unsigned short bmread(struct net_device *dev, unsigned long reg_offset ) { return in_le16((void __iomem *)dev->base_addr + reg_offset); } diff --git a/trunk/drivers/net/bonding/bond_main.c b/trunk/drivers/net/bonding/bond_main.c index f264ff162979..6d00c3de1a83 100644 --- a/trunk/drivers/net/bonding/bond_main.c +++ b/trunk/drivers/net/bonding/bond_main.c @@ -487,8 +487,6 @@ * * Added xmit_hash_policy_layer34() * - Modified by Jay Vosburgh to also support mode 4. * Set version to 2.6.3. - * 2005/09/26 - Jay Vosburgh - * - Removed backwards compatibility for old ifenslaves. Version 2.6.4. */ //#define BONDING_DEBUG 1 @@ -597,7 +595,14 @@ static int arp_ip_count = 0; static int bond_mode = BOND_MODE_ROUNDROBIN; static int xmit_hashtype= BOND_XMIT_POLICY_LAYER2; static int lacp_fast = 0; - +static int app_abi_ver = 0; +static int orig_app_abi_ver = -1; /* This is used to save the first ABI version + * we receive from the application. Once set, + * it won't be changed, and the module will + * refuse to enslave/release interfaces if the + * command comes from an application using + * another ABI version. + */ struct bond_parm_tbl { char *modename; int mode; @@ -1289,13 +1294,12 @@ static void bond_mc_list_destroy(struct bonding *bond) /* * Copy all the Multicast addresses from src to the bonding device dst */ -static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, - gfp_t gfp_flag) +static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, int gpf_flag) { struct dev_mc_list *dmi, *new_dmi; for (dmi = mc_list; dmi; dmi = dmi->next) { - new_dmi = kmalloc(sizeof(struct dev_mc_list), gfp_flag); + new_dmi = kmalloc(sizeof(struct dev_mc_list), gpf_flag); if (!new_dmi) { /* FIXME: Potential memory leak !!! */ @@ -1698,29 +1702,51 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de } } - /* - * Old ifenslave binaries are no longer supported. These can - * be identified with moderate accurary by the state of the slave: - * the current ifenslave will set the interface down prior to - * enslaving it; the old ifenslave will not. - */ - if ((slave_dev->flags & IFF_UP)) { - printk(KERN_ERR DRV_NAME ": %s is up. " - "This may be due to an out of date ifenslave.\n", - slave_dev->name); - res = -EPERM; - goto err_undo_flags; - } + if (app_abi_ver >= 1) { + /* The application is using an ABI, which requires the + * slave interface to be closed. + */ + if ((slave_dev->flags & IFF_UP)) { + printk(KERN_ERR DRV_NAME + ": Error: %s is up\n", + slave_dev->name); + res = -EPERM; + goto err_undo_flags; + } - if (slave_dev->set_mac_address == NULL) { - printk(KERN_ERR DRV_NAME - ": Error: The slave device you specified does " - "not support setting the MAC address.\n"); - printk(KERN_ERR - "Your kernel likely does not support slave devices.\n"); + if (slave_dev->set_mac_address == NULL) { + printk(KERN_ERR DRV_NAME + ": Error: The slave device you specified does " + "not support setting the MAC address.\n"); + printk(KERN_ERR + "Your kernel likely does not support slave " + "devices.\n"); - res = -EOPNOTSUPP; - goto err_undo_flags; + res = -EOPNOTSUPP; + goto err_undo_flags; + } + } else { + /* The application is not using an ABI, which requires the + * slave interface to be open. + */ + if (!(slave_dev->flags & IFF_UP)) { + printk(KERN_ERR DRV_NAME + ": Error: %s is not running\n", + slave_dev->name); + res = -EINVAL; + goto err_undo_flags; + } + + if ((bond->params.mode == BOND_MODE_8023AD) || + (bond->params.mode == BOND_MODE_TLB) || + (bond->params.mode == BOND_MODE_ALB)) { + printk(KERN_ERR DRV_NAME + ": Error: to use %s mode, you must upgrade " + "ifenslave.\n", + bond_mode_name(bond->params.mode)); + res = -EOPNOTSUPP; + goto err_undo_flags; + } } new_slave = kmalloc(sizeof(struct slave), GFP_KERNEL); @@ -1736,36 +1762,41 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de */ new_slave->original_flags = slave_dev->flags; - /* - * Save slave's original ("permanent") mac address for modes - * that need it, and for restoring it upon release, and then - * set it to the master's address - */ - memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN); + if (app_abi_ver >= 1) { + /* save slave's original ("permanent") mac address for + * modes that needs it, and for restoring it upon release, + * and then set it to the master's address + */ + memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN); - /* - * Set slave to master's mac address. The application already - * set the master's mac address to that of the first slave - */ - memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); - addr.sa_family = slave_dev->type; - res = dev_set_mac_address(slave_dev, &addr); - if (res) { - dprintk("Error %d calling set_mac_address\n", res); - goto err_free; - } + /* set slave to master's mac address + * The application already set the master's + * mac address to that of the first slave + */ + memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); + addr.sa_family = slave_dev->type; + res = dev_set_mac_address(slave_dev, &addr); + if (res) { + dprintk("Error %d calling set_mac_address\n", res); + goto err_free; + } - /* open the slave since the application closed it */ - res = dev_open(slave_dev); - if (res) { - dprintk("Openning slave %s failed\n", slave_dev->name); - goto err_restore_mac; + /* open the slave since the application closed it */ + res = dev_open(slave_dev); + if (res) { + dprintk("Openning slave %s failed\n", slave_dev->name); + goto err_restore_mac; + } } res = netdev_set_master(slave_dev, bond_dev); if (res) { dprintk("Error %d calling netdev_set_master\n", res); - goto err_close; + if (app_abi_ver < 1) { + goto err_free; + } else { + goto err_close; + } } new_slave->dev = slave_dev; @@ -1966,6 +1997,39 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de write_unlock_bh(&bond->lock); + if (app_abi_ver < 1) { + /* + * !!! This is to support old versions of ifenslave. + * We can remove this in 2.5 because our ifenslave takes + * care of this for us. + * We check to see if the master has a mac address yet. + * If not, we'll give it the mac address of our slave device. + */ + int ndx = 0; + + for (ndx = 0; ndx < bond_dev->addr_len; ndx++) { + dprintk("Checking ndx=%d of bond_dev->dev_addr\n", + ndx); + if (bond_dev->dev_addr[ndx] != 0) { + dprintk("Found non-zero byte at ndx=%d\n", + ndx); + break; + } + } + + if (ndx == bond_dev->addr_len) { + /* + * We got all the way through the address and it was + * all 0's. + */ + dprintk("%s doesn't have a MAC address yet. \n", + bond_dev->name); + dprintk("Going to give assign it from %s.\n", + slave_dev->name); + bond_sethwaddr(bond_dev, slave_dev); + } + } + printk(KERN_INFO DRV_NAME ": %s: enslaving %s as a%s interface with a%s link.\n", bond_dev->name, slave_dev->name, @@ -2163,10 +2227,12 @@ static int bond_release(struct net_device *bond_dev, struct net_device *slave_de /* close slave before restoring its mac address */ dev_close(slave_dev); - /* restore original ("permanent") mac address */ - memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); - addr.sa_family = slave_dev->type; - dev_set_mac_address(slave_dev, &addr); + if (app_abi_ver >= 1) { + /* restore original ("permanent") mac address */ + memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); + addr.sa_family = slave_dev->type; + dev_set_mac_address(slave_dev, &addr); + } /* restore the original state of the * IFF_NOARP flag that might have been @@ -2254,10 +2320,12 @@ static int bond_release_all(struct net_device *bond_dev) /* close slave before restoring its mac address */ dev_close(slave_dev); - /* restore original ("permanent") mac address*/ - memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); - addr.sa_family = slave_dev->type; - dev_set_mac_address(slave_dev, &addr); + if (app_abi_ver >= 1) { + /* restore original ("permanent") mac address*/ + memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); + addr.sa_family = slave_dev->type; + dev_set_mac_address(slave_dev, &addr); + } /* restore the original state of the IFF_NOARP flag that might have * been set by bond_set_slave_inactive_flags() @@ -2355,6 +2423,57 @@ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_devi return res; } +static int bond_ethtool_ioctl(struct net_device *bond_dev, struct ifreq *ifr) +{ + struct ethtool_drvinfo info; + void __user *addr = ifr->ifr_data; + uint32_t cmd; + + if (get_user(cmd, (uint32_t __user *)addr)) { + return -EFAULT; + } + + switch (cmd) { + case ETHTOOL_GDRVINFO: + if (copy_from_user(&info, addr, sizeof(info))) { + return -EFAULT; + } + + if (strcmp(info.driver, "ifenslave") == 0) { + int new_abi_ver; + char *endptr; + + new_abi_ver = simple_strtoul(info.fw_version, + &endptr, 0); + if (*endptr) { + printk(KERN_ERR DRV_NAME + ": Error: got invalid ABI " + "version from application\n"); + + return -EINVAL; + } + + if (orig_app_abi_ver == -1) { + orig_app_abi_ver = new_abi_ver; + } + + app_abi_ver = new_abi_ver; + } + + strncpy(info.driver, DRV_NAME, 32); + strncpy(info.version, DRV_VERSION, 32); + snprintf(info.fw_version, 32, "%d", BOND_ABI_VERSION); + + if (copy_to_user(addr, &info, sizeof(info))) { + return -EFAULT; + } + + return 0; + default: + return -EOPNOTSUPP; + } +} + static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) { struct bonding *bond = bond_dev->priv; @@ -2657,7 +2776,7 @@ static u32 bond_glean_dev_ip(struct net_device *dev) return 0; rcu_read_lock(); - idev = __in_dev_get_rcu(dev); + idev = __in_dev_get(dev); if (!idev) goto out; @@ -3323,11 +3442,16 @@ static void bond_info_show_slave(struct seq_file *seq, const struct slave *slave seq_printf(seq, "Link Failure Count: %d\n", slave->link_failure_count); - seq_printf(seq, - "Permanent HW addr: %02x:%02x:%02x:%02x:%02x:%02x\n", - slave->perm_hwaddr[0], slave->perm_hwaddr[1], - slave->perm_hwaddr[2], slave->perm_hwaddr[3], - slave->perm_hwaddr[4], slave->perm_hwaddr[5]); + if (app_abi_ver >= 1) { + seq_printf(seq, + "Permanent HW addr: %02x:%02x:%02x:%02x:%02x:%02x\n", + slave->perm_hwaddr[0], + slave->perm_hwaddr[1], + slave->perm_hwaddr[2], + slave->perm_hwaddr[3], + slave->perm_hwaddr[4], + slave->perm_hwaddr[5]); + } if (bond->params.mode == BOND_MODE_8023AD) { const struct aggregator *agg @@ -3886,12 +4010,15 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd struct ifslave k_sinfo; struct ifslave __user *u_sinfo = NULL; struct mii_ioctl_data *mii = NULL; + int prev_abi_ver = orig_app_abi_ver; int res = 0; dprintk("bond_ioctl: master=%s, cmd=%d\n", bond_dev->name, cmd); switch (cmd) { + case SIOCETHTOOL: + return bond_ethtool_ioctl(bond_dev, ifr); case SIOCGMIIPHY: mii = if_mii(ifr); if (!mii) { @@ -3963,6 +4090,21 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd return -EPERM; } + if (orig_app_abi_ver == -1) { + /* no orig_app_abi_ver was provided yet, so we'll use the + * current one from now on, even if it's 0 + */ + orig_app_abi_ver = app_abi_ver; + + } else if (orig_app_abi_ver != app_abi_ver) { + printk(KERN_ERR DRV_NAME + ": Error: already using ifenslave ABI version %d; to " + "upgrade ifenslave to version %d, you must first " + "reload bonding.\n", + orig_app_abi_ver, app_abi_ver); + return -EINVAL; + } + slave_dev = dev_get_by_name(ifr->ifr_slave); dprintk("slave_dev=%p: \n", slave_dev); @@ -3995,6 +4137,14 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd dev_put(slave_dev); } + if (res < 0) { + /* The ioctl failed, so there's no point in changing the + * orig_app_abi_ver. We'll restore it's value just in case + * we've changed it earlier in this function. + */ + orig_app_abi_ver = prev_abi_ver; + } + return res; } @@ -4428,18 +4578,9 @@ static inline void bond_set_mode_ops(struct bonding *bond, int mode) } } -static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, - struct ethtool_drvinfo *drvinfo) -{ - strncpy(drvinfo->driver, DRV_NAME, 32); - strncpy(drvinfo->version, DRV_VERSION, 32); - snprintf(drvinfo->fw_version, 32, "%d", BOND_ABI_VERSION); -} - static struct ethtool_ops bond_ethtool_ops = { .get_tx_csum = ethtool_op_get_tx_csum, .get_sg = ethtool_op_get_sg, - .get_drvinfo = bond_ethtool_get_drvinfo, }; /* diff --git a/trunk/drivers/net/bonding/bonding.h b/trunk/drivers/net/bonding/bonding.h index bbf9da8af624..388196980862 100644 --- a/trunk/drivers/net/bonding/bonding.h +++ b/trunk/drivers/net/bonding/bonding.h @@ -40,8 +40,8 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION "2.6.4" -#define DRV_RELDATE "September 26, 2005" +#define DRV_VERSION "2.6.3" +#define DRV_RELDATE "June 8, 2005" #define DRV_NAME "bonding" #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" diff --git a/trunk/drivers/net/cassini.c b/trunk/drivers/net/cassini.c deleted file mode 100644 index 2e617424d3fb..000000000000 --- a/trunk/drivers/net/cassini.c +++ /dev/null @@ -1,5237 +0,0 @@ -/* cassini.c: Sun Microsystems Cassini(+) ethernet driver. - * - * Copyright (C) 2004 Sun Microsystems Inc. - * Copyright (C) 2003 Adrian Sun (asun@darksunrising.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * This driver uses the sungem driver (c) David Miller - * (davem@redhat.com) as its basis. - * - * The cassini chip has a number of features that distinguish it from - * the gem chip: - * 4 transmit descriptor rings that are used for either QoS (VLAN) or - * load balancing (non-VLAN mode) - * batching of multiple packets - * multiple CPU dispatching - * page-based RX descriptor engine with separate completion rings - * Gigabit support (GMII and PCS interface) - * MIF link up/down detection works - * - * RX is handled by page sized buffers that are attached as fragments to - * the skb. here's what's done: - * -- driver allocates pages at a time and keeps reference counts - * on them. - * -- the upper protocol layers assume that the header is in the skb - * itself. as a result, cassini will copy a small amount (64 bytes) - * to make them happy. - * -- driver appends the rest of the data pages as frags to skbuffs - * and increments the reference count - * -- on page reclamation, the driver swaps the page with a spare page. - * if that page is still in use, it frees its reference to that page, - * and allocates a new page for use. otherwise, it just recycles the - * the page. - * - * NOTE: cassini can parse the header. however, it's not worth it - * as long as the network stack requires a header copy. - * - * TX has 4 queues. currently these queues are used in a round-robin - * fashion for load balancing. They can also be used for QoS. for that - * to work, however, QoS information needs to be exposed down to the driver - * level so that subqueues get targetted to particular transmit rings. - * alternatively, the queues can be configured via use of the all-purpose - * ioctl. - * - * RX DATA: the rx completion ring has all the info, but the rx desc - * ring has all of the data. RX can conceivably come in under multiple - * interrupts, but the INT# assignment needs to be set up properly by - * the BIOS and conveyed to the driver. PCI BIOSes don't know how to do - * that. also, the two descriptor rings are designed to distinguish between - * encrypted and non-encrypted packets, but we use them for buffering - * instead. - * - * by default, the selective clear mask is set up to process rx packets. - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#define cas_page_map(x) kmap_atomic((x), KM_SKB_DATA_SOFTIRQ) -#define cas_page_unmap(x) kunmap_atomic((x), KM_SKB_DATA_SOFTIRQ) -#define CAS_NCPUS num_online_cpus() - -#if defined(CONFIG_CASSINI_NAPI) && defined(HAVE_NETDEV_POLL) -#define USE_NAPI -#define cas_skb_release(x) netif_receive_skb(x) -#else -#define cas_skb_release(x) netif_rx(x) -#endif - -/* select which firmware to use */ -#define USE_HP_WORKAROUND -#define HP_WORKAROUND_DEFAULT /* select which firmware to use as default */ -#define CAS_HP_ALT_FIRMWARE cas_prog_null /* alternate firmware */ - -#include "cassini.h" - -#define USE_TX_COMPWB /* use completion writeback registers */ -#define USE_CSMA_CD_PROTO /* standard CSMA/CD */ -#define USE_RX_BLANK /* hw interrupt mitigation */ -#undef USE_ENTROPY_DEV /* don't test for entropy device */ - -/* NOTE: these aren't useable unless PCI interrupts can be assigned. - * also, we need to make cp->lock finer-grained. - */ -#undef USE_PCI_INTB -#undef USE_PCI_INTC -#undef USE_PCI_INTD -#undef USE_QOS - -#undef USE_VPD_DEBUG /* debug vpd information if defined */ - -/* rx processing options */ -#define USE_PAGE_ORDER /* specify to allocate large rx pages */ -#define RX_DONT_BATCH 0 /* if 1, don't batch flows */ -#define RX_COPY_ALWAYS 0 /* if 0, use frags */ -#define RX_COPY_MIN 64 /* copy a little to make upper layers happy */ -#undef RX_COUNT_BUFFERS /* define to calculate RX buffer stats */ - -#define DRV_MODULE_NAME "cassini" -#define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "1.4" -#define DRV_MODULE_RELDATE "1 July 2004" - -#define CAS_DEF_MSG_ENABLE \ - (NETIF_MSG_DRV | \ - NETIF_MSG_PROBE | \ - NETIF_MSG_LINK | \ - NETIF_MSG_TIMER | \ - NETIF_MSG_IFDOWN | \ - NETIF_MSG_IFUP | \ - NETIF_MSG_RX_ERR | \ - NETIF_MSG_TX_ERR) - -/* length of time before we decide the hardware is borked, - * and dev->tx_timeout() should be called to fix the problem - */ -#define CAS_TX_TIMEOUT (HZ) -#define CAS_LINK_TIMEOUT (22*HZ/10) -#define CAS_LINK_FAST_TIMEOUT (1) - -/* timeout values for state changing. these specify the number - * of 10us delays to be used before giving up. - */ -#define STOP_TRIES_PHY 1000 -#define STOP_TRIES 5000 - -/* specify a minimum frame size to deal with some fifo issues - * max mtu == 2 * page size - ethernet header - 64 - swivel = - * 2 * page_size - 0x50 - */ -#define CAS_MIN_FRAME 97 -#define CAS_1000MB_MIN_FRAME 255 -#define CAS_MIN_MTU 60 -#define CAS_MAX_MTU min(((cp->page_size << 1) - 0x50), 9000) - -#if 1 -/* - * Eliminate these and use separate atomic counters for each, to - * avoid a race condition. - */ -#else -#define CAS_RESET_MTU 1 -#define CAS_RESET_ALL 2 -#define CAS_RESET_SPARE 3 -#endif - -static char version[] __devinitdata = - DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; - -MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)"); -MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver"); -MODULE_LICENSE("GPL"); -MODULE_PARM(cassini_debug, "i"); -MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value"); -MODULE_PARM(link_mode, "i"); -MODULE_PARM_DESC(link_mode, "default link mode"); - -/* - * Work around for a PCS bug in which the link goes down due to the chip - * being confused and never showing a link status of "up." - */ -#define DEFAULT_LINKDOWN_TIMEOUT 5 -/* - * Value in seconds, for user input. - */ -static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT; -MODULE_PARM(linkdown_timeout, "i"); -MODULE_PARM_DESC(linkdown_timeout, -"min reset interval in sec. for PCS linkdown issue; disabled if not positive"); - -/* - * value in 'ticks' (units used by jiffies). Set when we init the - * module because 'HZ' in actually a function call on some flavors of - * Linux. This will default to DEFAULT_LINKDOWN_TIMEOUT * HZ. - */ -static int link_transition_timeout; - - -static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */ -static int link_mode; - -static u16 link_modes[] __devinitdata = { - BMCR_ANENABLE, /* 0 : autoneg */ - 0, /* 1 : 10bt half duplex */ - BMCR_SPEED100, /* 2 : 100bt half duplex */ - BMCR_FULLDPLX, /* 3 : 10bt full duplex */ - BMCR_SPEED100|BMCR_FULLDPLX, /* 4 : 100bt full duplex */ - CAS_BMCR_SPEED1000|BMCR_FULLDPLX /* 5 : 1000bt full duplex */ -}; - -static struct pci_device_id cas_pci_tbl[] __devinitdata = { - { PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_CASSINI, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, - { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SATURN, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, - { 0, } -}; - -MODULE_DEVICE_TABLE(pci, cas_pci_tbl); - -static void cas_set_link_modes(struct cas *cp); - -static inline void cas_lock_tx(struct cas *cp) -{ - int i; - - for (i = 0; i < N_TX_RINGS; i++) - spin_lock(&cp->tx_lock[i]); -} - -static inline void cas_lock_all(struct cas *cp) -{ - spin_lock_irq(&cp->lock); - cas_lock_tx(cp); -} - -/* WTZ: QA was finding deadlock problems with the previous - * versions after long test runs with multiple cards per machine. - * See if replacing cas_lock_all with safer versions helps. The - * symptoms QA is reporting match those we'd expect if interrupts - * aren't being properly restored, and we fixed a previous deadlock - * with similar symptoms by using save/restore versions in other - * places. - */ -#define cas_lock_all_save(cp, flags) \ -do { \ - struct cas *xxxcp = (cp); \ - spin_lock_irqsave(&xxxcp->lock, flags); \ - cas_lock_tx(xxxcp); \ -} while (0) - -static inline void cas_unlock_tx(struct cas *cp) -{ - int i; - - for (i = N_TX_RINGS; i > 0; i--) - spin_unlock(&cp->tx_lock[i - 1]); -} - -static inline void cas_unlock_all(struct cas *cp) -{ - cas_unlock_tx(cp); - spin_unlock_irq(&cp->lock); -} - -#define cas_unlock_all_restore(cp, flags) \ -do { \ - struct cas *xxxcp = (cp); \ - cas_unlock_tx(xxxcp); \ - spin_unlock_irqrestore(&xxxcp->lock, flags); \ -} while (0) - -static void cas_disable_irq(struct cas *cp, const int ring) -{ - /* Make sure we won't get any more interrupts */ - if (ring == 0) { - writel(0xFFFFFFFF, cp->regs + REG_INTR_MASK); - return; - } - - /* disable completion interrupts and selectively mask */ - if (cp->cas_flags & CAS_FLAG_REG_PLUS) { - switch (ring) { -#if defined (USE_PCI_INTB) || defined(USE_PCI_INTC) || defined(USE_PCI_INTD) -#ifdef USE_PCI_INTB - case 1: -#endif -#ifdef USE_PCI_INTC - case 2: -#endif -#ifdef USE_PCI_INTD - case 3: -#endif - writel(INTRN_MASK_CLEAR_ALL | INTRN_MASK_RX_EN, - cp->regs + REG_PLUS_INTRN_MASK(ring)); - break; -#endif - default: - writel(INTRN_MASK_CLEAR_ALL, cp->regs + - REG_PLUS_INTRN_MASK(ring)); - break; - } - } -} - -static inline void cas_mask_intr(struct cas *cp) -{ - int i; - - for (i = 0; i < N_RX_COMP_RINGS; i++) - cas_disable_irq(cp, i); -} - -static void cas_enable_irq(struct cas *cp, const int ring) -{ - if (ring == 0) { /* all but TX_DONE */ - writel(INTR_TX_DONE, cp->regs + REG_INTR_MASK); - return; - } - - if (cp->cas_flags & CAS_FLAG_REG_PLUS) { - switch (ring) { -#if defined (USE_PCI_INTB) || defined(USE_PCI_INTC) || defined(USE_PCI_INTD) -#ifdef USE_PCI_INTB - case 1: -#endif -#ifdef USE_PCI_INTC - case 2: -#endif -#ifdef USE_PCI_INTD - case 3: -#endif - writel(INTRN_MASK_RX_EN, cp->regs + - REG_PLUS_INTRN_MASK(ring)); - break; -#endif - default: - break; - } - } -} - -static inline void cas_unmask_intr(struct cas *cp) -{ - int i; - - for (i = 0; i < N_RX_COMP_RINGS; i++) - cas_enable_irq(cp, i); -} - -static inline void cas_entropy_gather(struct cas *cp) -{ -#ifdef USE_ENTROPY_DEV - if ((cp->cas_flags & CAS_FLAG_ENTROPY_DEV) == 0) - return; - - batch_entropy_store(readl(cp->regs + REG_ENTROPY_IV), - readl(cp->regs + REG_ENTROPY_IV), - sizeof(uint64_t)*8); -#endif -} - -static inline void cas_entropy_reset(struct cas *cp) -{ -#ifdef USE_ENTROPY_DEV - if ((cp->cas_flags & CAS_FLAG_ENTROPY_DEV) == 0) - return; - - writel(BIM_LOCAL_DEV_PAD | BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_EXT, - cp->regs + REG_BIM_LOCAL_DEV_EN); - writeb(ENTROPY_RESET_STC_MODE, cp->regs + REG_ENTROPY_RESET); - writeb(0x55, cp->regs + REG_ENTROPY_RAND_REG); - - /* if we read back 0x0, we don't have an entropy device */ - if (readb(cp->regs + REG_ENTROPY_RAND_REG) == 0) - cp->cas_flags &= ~CAS_FLAG_ENTROPY_DEV; -#endif -} - -/* access to the phy. the following assumes that we've initialized the MIF to - * be in frame rather than bit-bang mode - */ -static u16 cas_phy_read(struct cas *cp, int reg) -{ - u32 cmd; - int limit = STOP_TRIES_PHY; - - cmd = MIF_FRAME_ST | MIF_FRAME_OP_READ; - cmd |= CAS_BASE(MIF_FRAME_PHY_ADDR, cp->phy_addr); - cmd |= CAS_BASE(MIF_FRAME_REG_ADDR, reg); - cmd |= MIF_FRAME_TURN_AROUND_MSB; - writel(cmd, cp->regs + REG_MIF_FRAME); - - /* poll for completion */ - while (limit-- > 0) { - udelay(10); - cmd = readl(cp->regs + REG_MIF_FRAME); - if (cmd & MIF_FRAME_TURN_AROUND_LSB) - return (cmd & MIF_FRAME_DATA_MASK); - } - return 0xFFFF; /* -1 */ -} - -static int cas_phy_write(struct cas *cp, int reg, u16 val) -{ - int limit = STOP_TRIES_PHY; - u32 cmd; - - cmd = MIF_FRAME_ST | MIF_FRAME_OP_WRITE; - cmd |= CAS_BASE(MIF_FRAME_PHY_ADDR, cp->phy_addr); - cmd |= CAS_BASE(MIF_FRAME_REG_ADDR, reg); - cmd |= MIF_FRAME_TURN_AROUND_MSB; - cmd |= val & MIF_FRAME_DATA_MASK; - writel(cmd, cp->regs + REG_MIF_FRAME); - - /* poll for completion */ - while (limit-- > 0) { - udelay(10); - cmd = readl(cp->regs + REG_MIF_FRAME); - if (cmd & MIF_FRAME_TURN_AROUND_LSB) - return 0; - } - return -1; -} - -static void cas_phy_powerup(struct cas *cp) -{ - u16 ctl = cas_phy_read(cp, MII_BMCR); - - if ((ctl & BMCR_PDOWN) == 0) - return; - ctl &= ~BMCR_PDOWN; - cas_phy_write(cp, MII_BMCR, ctl); -} - -static void cas_phy_powerdown(struct cas *cp) -{ - u16 ctl = cas_phy_read(cp, MII_BMCR); - - if (ctl & BMCR_PDOWN) - return; - ctl |= BMCR_PDOWN; - cas_phy_write(cp, MII_BMCR, ctl); -} - -/* cp->lock held. note: the last put_page will free the buffer */ -static int cas_page_free(struct cas *cp, cas_page_t *page) -{ - pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, - PCI_DMA_FROMDEVICE); - __free_pages(page->buffer, cp->page_order); - kfree(page); - return 0; -} - -#ifdef RX_COUNT_BUFFERS -#define RX_USED_ADD(x, y) ((x)->used += (y)) -#define RX_USED_SET(x, y) ((x)->used = (y)) -#else -#define RX_USED_ADD(x, y) -#define RX_USED_SET(x, y) -#endif - -/* local page allocation routines for the receive buffers. jumbo pages - * require at least 8K contiguous and 8K aligned buffers. - */ -static cas_page_t *cas_page_alloc(struct cas *cp, const int flags) -{ - cas_page_t *page; - - page = kmalloc(sizeof(cas_page_t), flags); - if (!page) - return NULL; - - INIT_LIST_HEAD(&page->list); - RX_USED_SET(page, 0); - page->buffer = alloc_pages(flags, cp->page_order); - if (!page->buffer) - goto page_err; - page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, - cp->page_size, PCI_DMA_FROMDEVICE); - return page; - -page_err: - kfree(page); - return NULL; -} - -/* initialize spare pool of rx buffers, but allocate during the open */ -static void cas_spare_init(struct cas *cp) -{ - spin_lock(&cp->rx_inuse_lock); - INIT_LIST_HEAD(&cp->rx_inuse_list); - spin_unlock(&cp->rx_inuse_lock); - - spin_lock(&cp->rx_spare_lock); - INIT_LIST_HEAD(&cp->rx_spare_list); - cp->rx_spares_needed = RX_SPARE_COUNT; - spin_unlock(&cp->rx_spare_lock); -} - -/* used on close. free all the spare buffers. */ -static void cas_spare_free(struct cas *cp) -{ - struct list_head list, *elem, *tmp; - - /* free spare buffers */ - INIT_LIST_HEAD(&list); - spin_lock(&cp->rx_spare_lock); - list_splice(&cp->rx_spare_list, &list); - INIT_LIST_HEAD(&cp->rx_spare_list); - spin_unlock(&cp->rx_spare_lock); - list_for_each_safe(elem, tmp, &list) { - cas_page_free(cp, list_entry(elem, cas_page_t, list)); - } - - INIT_LIST_HEAD(&list); -#if 1 - /* - * Looks like Adrian had protected this with a different - * lock than used everywhere else to manipulate this list. - */ - spin_lock(&cp->rx_inuse_lock); - list_splice(&cp->rx_inuse_list, &list); - INIT_LIST_HEAD(&cp->rx_inuse_list); - spin_unlock(&cp->rx_inuse_lock); -#else - spin_lock(&cp->rx_spare_lock); - list_splice(&cp->rx_inuse_list, &list); - INIT_LIST_HEAD(&cp->rx_inuse_list); - spin_unlock(&cp->rx_spare_lock); -#endif - list_for_each_safe(elem, tmp, &list) { - cas_page_free(cp, list_entry(elem, cas_page_t, list)); - } -} - -/* replenish spares if needed */ -static void cas_spare_recover(struct cas *cp, const int flags) -{ - struct list_head list, *elem, *tmp; - int needed, i; - - /* check inuse list. if we don't need any more free buffers, - * just free it - */ - - /* make a local copy of the list */ - INIT_LIST_HEAD(&list); - spin_lock(&cp->rx_inuse_lock); - list_splice(&cp->rx_inuse_list, &list); - INIT_LIST_HEAD(&cp->rx_inuse_list); - spin_unlock(&cp->rx_inuse_lock); - - list_for_each_safe(elem, tmp, &list) { - cas_page_t *page = list_entry(elem, cas_page_t, list); - - if (page_count(page->buffer) > 1) - continue; - - list_del(elem); - spin_lock(&cp->rx_spare_lock); - if (cp->rx_spares_needed > 0) { - list_add(elem, &cp->rx_spare_list); - cp->rx_spares_needed--; - spin_unlock(&cp->rx_spare_lock); - } else { - spin_unlock(&cp->rx_spare_lock); - cas_page_free(cp, page); - } - } - - /* put any inuse buffers back on the list */ - if (!list_empty(&list)) { - spin_lock(&cp->rx_inuse_lock); - list_splice(&list, &cp->rx_inuse_list); - spin_unlock(&cp->rx_inuse_lock); - } - - spin_lock(&cp->rx_spare_lock); - needed = cp->rx_spares_needed; - spin_unlock(&cp->rx_spare_lock); - if (!needed) - return; - - /* we still need spares, so try to allocate some */ - INIT_LIST_HEAD(&list); - i = 0; - while (i < needed) { - cas_page_t *spare = cas_page_alloc(cp, flags); - if (!spare) - break; - list_add(&spare->list, &list); - i++; - } - - spin_lock(&cp->rx_spare_lock); - list_splice(&list, &cp->rx_spare_list); - cp->rx_spares_needed -= i; - spin_unlock(&cp->rx_spare_lock); -} - -/* pull a page from the list. */ -static cas_page_t *cas_page_dequeue(struct cas *cp) -{ - struct list_head *entry; - int recover; - - spin_lock(&cp->rx_spare_lock); - if (list_empty(&cp->rx_spare_list)) { - /* try to do a quick recovery */ - spin_unlock(&cp->rx_spare_lock); - cas_spare_recover(cp, GFP_ATOMIC); - spin_lock(&cp->rx_spare_lock); - if (list_empty(&cp->rx_spare_list)) { - if (netif_msg_rx_err(cp)) - printk(KERN_ERR "%s: no spare buffers " - "available.\n", cp->dev->name); - spin_unlock(&cp->rx_spare_lock); - return NULL; - } - } - - entry = cp->rx_spare_list.next; - list_del(entry); - recover = ++cp->rx_spares_needed; - spin_unlock(&cp->rx_spare_lock); - - /* trigger the timer to do the recovery */ - if ((recover & (RX_SPARE_RECOVER_VAL - 1)) == 0) { -#if 1 - atomic_inc(&cp->reset_task_pending); - atomic_inc(&cp->reset_task_pending_spare); - schedule_work(&cp->reset_task); -#else - atomic_set(&cp->reset_task_pending, CAS_RESET_SPARE); - schedule_work(&cp->reset_task); -#endif - } - return list_entry(entry, cas_page_t, list); -} - - -static void cas_mif_poll(struct cas *cp, const int enable) -{ - u32 cfg; - - cfg = readl(cp->regs + REG_MIF_CFG); - cfg &= (MIF_CFG_MDIO_0 | MIF_CFG_MDIO_1); - - if (cp->phy_type & CAS_PHY_MII_MDIO1) - cfg |= MIF_CFG_PHY_SELECT; - - /* poll and interrupt on link status change. */ - if (enable) { - cfg |= MIF_CFG_POLL_EN; - cfg |= CAS_BASE(MIF_CFG_POLL_REG, MII_BMSR); - cfg |= CAS_BASE(MIF_CFG_POLL_PHY, cp->phy_addr); - } - writel((enable) ? ~(BMSR_LSTATUS | BMSR_ANEGCOMPLETE) : 0xFFFF, - cp->regs + REG_MIF_MASK); - writel(cfg, cp->regs + REG_MIF_CFG); -} - -/* Must be invoked under cp->lock */ -static void cas_begin_auto_negotiation(struct cas *cp, struct ethtool_cmd *ep) -{ - u16 ctl; -#if 1 - int lcntl; - int changed = 0; - int oldstate = cp->lstate; - int link_was_not_down = !(oldstate == link_down); -#endif - /* Setup link parameters */ - if (!ep) - goto start_aneg; - lcntl = cp->link_cntl; - if (ep->autoneg == AUTONEG_ENABLE) - cp->link_cntl = BMCR_ANENABLE; - else { - cp->link_cntl = 0; - if (ep->speed == SPEED_100) - cp->link_cntl |= BMCR_SPEED100; - else if (ep->speed == SPEED_1000) - cp->link_cntl |= CAS_BMCR_SPEED1000; - if (ep->duplex == DUPLEX_FULL) - cp->link_cntl |= BMCR_FULLDPLX; - } -#if 1 - changed = (lcntl != cp->link_cntl); -#endif -start_aneg: - if (cp->lstate == link_up) { - printk(KERN_INFO "%s: PCS link down.\n", - cp->dev->name); - } else { - if (changed) { - printk(KERN_INFO "%s: link configuration changed\n", - cp->dev->name); - } - } - cp->lstate = link_down; - cp->link_transition = LINK_TRANSITION_LINK_DOWN; - if (!cp->hw_running) - return; -#if 1 - /* - * WTZ: If the old state was link_up, we turn off the carrier - * to replicate everything we do elsewhere on a link-down - * event when we were already in a link-up state.. - */ - if (oldstate == link_up) - netif_carrier_off(cp->dev); - if (changed && link_was_not_down) { - /* - * WTZ: This branch will simply schedule a full reset after - * we explicitly changed link modes in an ioctl. See if this - * fixes the link-problems we were having for forced mode. - */ - atomic_inc(&cp->reset_task_pending); - atomic_inc(&cp->reset_task_pending_all); - schedule_work(&cp->reset_task); - cp->timer_ticks = 0; - mod_timer(&cp->link_timer, jiffies + CAS_LINK_TIMEOUT); - return; - } -#endif - if (cp->phy_type & CAS_PHY_SERDES) { - u32 val = readl(cp->regs + REG_PCS_MII_CTRL); - - if (cp->link_cntl & BMCR_ANENABLE) { - val |= (PCS_MII_RESTART_AUTONEG | PCS_MII_AUTONEG_EN); - cp->lstate = link_aneg; - } else { - if (cp->link_cntl & BMCR_FULLDPLX) - val |= PCS_MII_CTRL_DUPLEX; - val &= ~PCS_MII_AUTONEG_EN; - cp->lstate = link_force_ok; - } - cp->link_transition = LINK_TRANSITION_LINK_CONFIG; - writel(val, cp->regs + REG_PCS_MII_CTRL); - - } else { - cas_mif_poll(cp, 0); - ctl = cas_phy_read(cp, MII_BMCR); - ctl &= ~(BMCR_FULLDPLX | BMCR_SPEED100 | - CAS_BMCR_SPEED1000 | BMCR_ANENABLE); - ctl |= cp->link_cntl; - if (ctl & BMCR_ANENABLE) { - ctl |= BMCR_ANRESTART; - cp->lstate = link_aneg; - } else { - cp->lstate = link_force_ok; - } - cp->link_transition = LINK_TRANSITION_LINK_CONFIG; - cas_phy_write(cp, MII_BMCR, ctl); - cas_mif_poll(cp, 1); - } - - cp->timer_ticks = 0; - mod_timer(&cp->link_timer, jiffies + CAS_LINK_TIMEOUT); -} - -/* Must be invoked under cp->lock. */ -static int cas_reset_mii_phy(struct cas *cp) -{ - int limit = STOP_TRIES_PHY; - u16 val; - - cas_phy_write(cp, MII_BMCR, BMCR_RESET); - udelay(100); - while (limit--) { - val = cas_phy_read(cp, MII_BMCR); - if ((val & BMCR_RESET) == 0) - break; - udelay(10); - } - return (limit <= 0); -} - -static void cas_saturn_firmware_load(struct cas *cp) -{ - cas_saturn_patch_t *patch = cas_saturn_patch; - - cas_phy_powerdown(cp); - - /* expanded memory access mode */ - cas_phy_write(cp, DP83065_MII_MEM, 0x0); - - /* pointer configuration for new firmware */ - cas_phy_write(cp, DP83065_MII_REGE, 0x8ff9); - cas_phy_write(cp, DP83065_MII_REGD, 0xbd); - cas_phy_write(cp, DP83065_MII_REGE, 0x8ffa); - cas_phy_write(cp, DP83065_MII_REGD, 0x82); - cas_phy_write(cp, DP83065_MII_REGE, 0x8ffb); - cas_phy_write(cp, DP83065_MII_REGD, 0x0); - cas_phy_write(cp, DP83065_MII_REGE, 0x8ffc); - cas_phy_write(cp, DP83065_MII_REGD, 0x39); - - /* download new firmware */ - cas_phy_write(cp, DP83065_MII_MEM, 0x1); - cas_phy_write(cp, DP83065_MII_REGE, patch->addr); - while (patch->addr) { - cas_phy_write(cp, DP83065_MII_REGD, patch->val); - patch++; - } - - /* enable firmware */ - cas_phy_write(cp, DP83065_MII_REGE, 0x8ff8); - cas_phy_write(cp, DP83065_MII_REGD, 0x1); -} - - -/* phy initialization */ -static void cas_phy_init(struct cas *cp) -{ - u16 val; - - /* if we're in MII/GMII mode, set up phy */ - if (CAS_PHY_MII(cp->phy_type)) { - writel(PCS_DATAPATH_MODE_MII, - cp->regs + REG_PCS_DATAPATH_MODE); - - cas_mif_poll(cp, 0); - cas_reset_mii_phy(cp); /* take out of isolate mode */ - - if (PHY_LUCENT_B0 == cp->phy_id) { - /* workaround link up/down issue with lucent */ - cas_phy_write(cp, LUCENT_MII_REG, 0x8000); - cas_phy_write(cp, MII_BMCR, 0x00f1); - cas_phy_write(cp, LUCENT_MII_REG, 0x0); - - } else if (PHY_BROADCOM_B0 == (cp->phy_id & 0xFFFFFFFC)) { - /* workarounds for broadcom phy */ - cas_phy_write(cp, BROADCOM_MII_REG8, 0x0C20); - cas_phy_write(cp, BROADCOM_MII_REG7, 0x0012); - cas_phy_write(cp, BROADCOM_MII_REG5, 0x1804); - cas_phy_write(cp, BROADCOM_MII_REG7, 0x0013); - cas_phy_write(cp, BROADCOM_MII_REG5, 0x1204); - cas_phy_write(cp, BROADCOM_MII_REG7, 0x8006); - cas_phy_write(cp, BROADCOM_MII_REG5, 0x0132); - cas_phy_write(cp, BROADCOM_MII_REG7, 0x8006); - cas_phy_write(cp, BROADCOM_MII_REG5, 0x0232); - cas_phy_write(cp, BROADCOM_MII_REG7, 0x201F); - cas_phy_write(cp, BROADCOM_MII_REG5, 0x0A20); - - } else if (PHY_BROADCOM_5411 == cp->phy_id) { - val = cas_phy_read(cp, BROADCOM_MII_REG4); - val = cas_phy_read(cp, BROADCOM_MII_REG4); - if (val & 0x0080) { - /* link workaround */ - cas_phy_write(cp, BROADCOM_MII_REG4, - val & ~0x0080); - } - - } else if (cp->cas_flags & CAS_FLAG_SATURN) { - writel((cp->phy_type & CAS_PHY_MII_MDIO0) ? - SATURN_PCFG_FSI : 0x0, - cp->regs + REG_SATURN_PCFG); - - /* load firmware to address 10Mbps auto-negotiation - * issue. NOTE: this will need to be changed if the - * default firmware gets fixed. - */ - if (PHY_NS_DP83065 == cp->phy_id) { - cas_saturn_firmware_load(cp); - } - cas_phy_powerup(cp); - } - - /* advertise capabilities */ - val = cas_phy_read(cp, MII_BMCR); - val &= ~BMCR_ANENABLE; - cas_phy_write(cp, MII_BMCR, val); - udelay(10); - - cas_phy_write(cp, MII_ADVERTISE, - cas_phy_read(cp, MII_ADVERTISE) | - (ADVERTISE_10HALF | ADVERTISE_10FULL | - ADVERTISE_100HALF | ADVERTISE_100FULL | - CAS_ADVERTISE_PAUSE | - CAS_ADVERTISE_ASYM_PAUSE)); - - if (cp->cas_flags & CAS_FLAG_1000MB_CAP) { - /* make sure that we don't advertise half - * duplex to avoid a chip issue - */ - val = cas_phy_read(cp, CAS_MII_1000_CTRL); - val &= ~CAS_ADVERTISE_1000HALF; - val |= CAS_ADVERTISE_1000FULL; - cas_phy_write(cp, CAS_MII_1000_CTRL, val); - } - - } else { - /* reset pcs for serdes */ - u32 val; - int limit; - - writel(PCS_DATAPATH_MODE_SERDES, - cp->regs + REG_PCS_DATAPATH_MODE); - - /* enable serdes pins on saturn */ - if (cp->cas_flags & CAS_FLAG_SATURN) - writel(0, cp->regs + REG_SATURN_PCFG); - - /* Reset PCS unit. */ - val = readl(cp->regs + REG_PCS_MII_CTRL); - val |= PCS_MII_RESET; - writel(val, cp->regs + REG_PCS_MII_CTRL); - - limit = STOP_TRIES; - while (limit-- > 0) { - udelay(10); - if ((readl(cp->regs + REG_PCS_MII_CTRL) & - PCS_MII_RESET) == 0) - break; - } - if (limit <= 0) - printk(KERN_WARNING "%s: PCS reset bit would not " - "clear [%08x].\n", cp->dev->name, - readl(cp->regs + REG_PCS_STATE_MACHINE)); - - /* Make sure PCS is disabled while changing advertisement - * configuration. - */ - writel(0x0, cp->regs + REG_PCS_CFG); - - /* Advertise all capabilities except half-duplex. */ - val = readl(cp->regs + REG_PCS_MII_ADVERT); - val &= ~PCS_MII_ADVERT_HD; - val |= (PCS_MII_ADVERT_FD | PCS_MII_ADVERT_SYM_PAUSE | - PCS_MII_ADVERT_ASYM_PAUSE); - writel(val, cp->regs + REG_PCS_MII_ADVERT); - - /* enable PCS */ - writel(PCS_CFG_EN, cp->regs + REG_PCS_CFG); - - /* pcs workaround: enable sync detect */ - writel(PCS_SERDES_CTRL_SYNCD_EN, - cp->regs + REG_PCS_SERDES_CTRL); - } -} - - -static int cas_pcs_link_check(struct cas *cp) -{ - u32 stat, state_machine; - int retval = 0; - - /* The link status bit latches on zero, so you must - * read it twice in such a case to see a transition - * to the link being up. - */ - stat = readl(cp->regs + REG_PCS_MII_STATUS); - if ((stat & PCS_MII_STATUS_LINK_STATUS) == 0) - stat = readl(cp->regs + REG_PCS_MII_STATUS); - - /* The remote-fault indication is only valid - * when autoneg has completed. - */ - if ((stat & (PCS_MII_STATUS_AUTONEG_COMP | - PCS_MII_STATUS_REMOTE_FAULT)) == - (PCS_MII_STATUS_AUTONEG_COMP | PCS_MII_STATUS_REMOTE_FAULT)) { - if (netif_msg_link(cp)) - printk(KERN_INFO "%s: PCS RemoteFault\n", - cp->dev->name); - } - - /* work around link detection issue by querying the PCS state - * machine directly. - */ - state_machine = readl(cp->regs + REG_PCS_STATE_MACHINE); - if ((state_machine & PCS_SM_LINK_STATE_MASK) != SM_LINK_STATE_UP) { - stat &= ~PCS_MII_STATUS_LINK_STATUS; - } else if (state_machine & PCS_SM_WORD_SYNC_STATE_MASK) { - stat |= PCS_MII_STATUS_LINK_STATUS; - } - - if (stat & PCS_MII_STATUS_LINK_STATUS) { - if (cp->lstate != link_up) { - if (cp->opened) { - cp->lstate = link_up; - cp->link_transition = LINK_TRANSITION_LINK_UP; - - cas_set_link_modes(cp); - netif_carrier_on(cp->dev); - } - } - } else if (cp->lstate == link_up) { - cp->lstate = link_down; - if (link_transition_timeout != 0 && - cp->link_transition != LINK_TRANSITION_REQUESTED_RESET && - !cp->link_transition_jiffies_valid) { - /* - * force a reset, as a workaround for the - * link-failure problem. May want to move this to a - * point a bit earlier in the sequence. If we had - * generated a reset a short time ago, we'll wait for - * the link timer to check the status until a - * timer expires (link_transistion_jiffies_valid is - * true when the timer is running.) Instead of using - * a system timer, we just do a check whenever the - * link timer is running - this clears the flag after - * a suitable delay. - */ - retval = 1; - cp->link_transition = LINK_TRANSITION_REQUESTED_RESET; - cp->link_transition_jiffies = jiffies; - cp->link_transition_jiffies_valid = 1; - } else { - cp->link_transition = LINK_TRANSITION_ON_FAILURE; - } - netif_carrier_off(cp->dev); - if (cp->opened && netif_msg_link(cp)) { - printk(KERN_INFO "%s: PCS link down.\n", - cp->dev->name); - } - - /* Cassini only: if you force a mode, there can be - * sync problems on link down. to fix that, the following - * things need to be checked: - * 1) read serialink state register - * 2) read pcs status register to verify link down. - * 3) if link down and serial link == 0x03, then you need - * to global reset the chip. - */ - if ((cp->cas_flags & CAS_FLAG_REG_PLUS) == 0) { - /* should check to see if we're in a forced mode */ - stat = readl(cp->regs + REG_PCS_SERDES_STATE); - if (stat == 0x03) - return 1; - } - } else if (cp->lstate == link_down) { - if (link_transition_timeout != 0 && - cp->link_transition != LINK_TRANSITION_REQUESTED_RESET && - !cp->link_transition_jiffies_valid) { - /* force a reset, as a workaround for the - * link-failure problem. May want to move - * this to a point a bit earlier in the - * sequence. - */ - retval = 1; - cp->link_transition = LINK_TRANSITION_REQUESTED_RESET; - cp->link_transition_jiffies = jiffies; - cp->link_transition_jiffies_valid = 1; - } else { - cp->link_transition = LINK_TRANSITION_STILL_FAILED; - } - } - - return retval; -} - -static int cas_pcs_interrupt(struct net_device *dev, - struct cas *cp, u32 status) -{ - u32 stat = readl(cp->regs + REG_PCS_INTR_STATUS); - - if ((stat & PCS_INTR_STATUS_LINK_CHANGE) == 0) - return 0; - return cas_pcs_link_check(cp); -} - -static int cas_txmac_interrupt(struct net_device *dev, - struct cas *cp, u32 status) -{ - u32 txmac_stat = readl(cp->regs + REG_MAC_TX_STATUS); - - if (!txmac_stat) - return 0; - - if (netif_msg_intr(cp)) - printk(KERN_DEBUG "%s: txmac interrupt, txmac_stat: 0x%x\n", - cp->dev->name, txmac_stat); - - /* Defer timer expiration is quite normal, - * don't even log the event. - */ - if ((txmac_stat & MAC_TX_DEFER_TIMER) && - !(txmac_stat & ~MAC_TX_DEFER_TIMER)) - return 0; - - spin_lock(&cp->stat_lock[0]); - if (txmac_stat & MAC_TX_UNDERRUN) { - printk(KERN_ERR "%s: TX MAC xmit underrun.\n", - dev->name); - cp->net_stats[0].tx_fifo_errors++; - } - - if (txmac_stat & MAC_TX_MAX_PACKET_ERR) { - printk(KERN_ERR "%s: TX MAC max packet size error.\n", - dev->name); - cp->net_stats[0].tx_errors++; - } - - /* The rest are all cases of one of the 16-bit TX - * counters expiring. - */ - if (txmac_stat & MAC_TX_COLL_NORMAL) - cp->net_stats[0].collisions += 0x10000; - - if (txmac_stat & MAC_TX_COLL_EXCESS) { - cp->net_stats[0].tx_aborted_errors += 0x10000; - cp->net_stats[0].collisions += 0x10000; - } - - if (txmac_stat & MAC_TX_COLL_LATE) { - cp->net_stats[0].tx_aborted_errors += 0x10000; - cp->net_stats[0].collisions += 0x10000; - } - spin_unlock(&cp->stat_lock[0]); - - /* We do not keep track of MAC_TX_COLL_FIRST and - * MAC_TX_PEAK_ATTEMPTS events. - */ - return 0; -} - -static void cas_load_firmware(struct cas *cp, cas_hp_inst_t *firmware) -{ - cas_hp_inst_t *inst; - u32 val; - int i; - - i = 0; - while ((inst = firmware) && inst->note) { - writel(i, cp->regs + REG_HP_INSTR_RAM_ADDR); - - val = CAS_BASE(HP_INSTR_RAM_HI_VAL, inst->val); - val |= CAS_BASE(HP_INSTR_RAM_HI_MASK, inst->mask); - writel(val, cp->regs + REG_HP_INSTR_RAM_DATA_HI); - - val = CAS_BASE(HP_INSTR_RAM_MID_OUTARG, inst->outarg >> 10); - val |= CAS_BASE(HP_INSTR_RAM_MID_OUTOP, inst->outop); - val |= CAS_BASE(HP_INSTR_RAM_MID_FNEXT, inst->fnext); - val |= CAS_BASE(HP_INSTR_RAM_MID_FOFF, inst->foff); - val |= CAS_BASE(HP_INSTR_RAM_MID_SNEXT, inst->snext); - val |= CAS_BASE(HP_INSTR_RAM_MID_SOFF, inst->soff); - val |= CAS_BASE(HP_INSTR_RAM_MID_OP, inst->op); - writel(val, cp->regs + REG_HP_INSTR_RAM_DATA_MID); - - val = CAS_BASE(HP_INSTR_RAM_LOW_OUTMASK, inst->outmask); - val |= CAS_BASE(HP_INSTR_RAM_LOW_OUTSHIFT, inst->outshift); - val |= CAS_BASE(HP_INSTR_RAM_LOW_OUTEN, inst->outenab); - val |= CAS_BASE(HP_INSTR_RAM_LOW_OUTARG, inst->outarg); - writel(val, cp->regs + REG_HP_INSTR_RAM_DATA_LOW); - ++firmware; - ++i; - } -} - -static void cas_init_rx_dma(struct cas *cp) -{ - u64 desc_dma = cp->block_dvma; - u32 val; - int i, size; - - /* rx free descriptors */ - val = CAS_BASE(RX_CFG_SWIVEL, RX_SWIVEL_OFF_VAL); - val |= CAS_BASE(RX_CFG_DESC_RING, RX_DESC_RINGN_INDEX(0)); - val |= CAS_BASE(RX_CFG_COMP_RING, RX_COMP_RINGN_INDEX(0)); - if ((N_RX_DESC_RINGS > 1) && - (cp->cas_flags & CAS_FLAG_REG_PLUS)) /* do desc 2 */ - val |= CAS_BASE(RX_CFG_DESC_RING1, RX_DESC_RINGN_INDEX(1)); - writel(val, cp->regs + REG_RX_CFG); - - val = (unsigned long) cp->init_rxds[0] - - (unsigned long) cp->init_block; - writel((desc_dma + val) >> 32, cp->regs + REG_RX_DB_HI); - writel((desc_dma + val) & 0xffffffff, cp->regs + REG_RX_DB_LOW); - writel(RX_DESC_RINGN_SIZE(0) - 4, cp->regs + REG_RX_KICK); - - if (cp->cas_flags & CAS_FLAG_REG_PLUS) { - /* rx desc 2 is for IPSEC packets. however, - * we don't it that for that purpose. - */ - val = (unsigned long) cp->init_rxds[1] - - (unsigned long) cp->init_block; - writel((desc_dma + val) >> 32, cp->regs + REG_PLUS_RX_DB1_HI); - writel((desc_dma + val) & 0xffffffff, cp->regs + - REG_PLUS_RX_DB1_LOW); - writel(RX_DESC_RINGN_SIZE(1) - 4, cp->regs + - REG_PLUS_RX_KICK1); - } - - /* rx completion registers */ - val = (unsigned long) cp->init_rxcs[0] - - (unsigned long) cp->init_block; - writel((desc_dma + val) >> 32, cp->regs + REG_RX_CB_HI); - writel((desc_dma + val) & 0xffffffff, cp->regs + REG_RX_CB_LOW); - - if (cp->cas_flags & CAS_FLAG_REG_PLUS) { - /* rx comp 2-4 */ - for (i = 1; i < MAX_RX_COMP_RINGS; i++) { - val = (unsigned long) cp->init_rxcs[i] - - (unsigned long) cp->init_block; - writel((desc_dma + val) >> 32, cp->regs + - REG_PLUS_RX_CBN_HI(i)); - writel((desc_dma + val) & 0xffffffff, cp->regs + - REG_PLUS_RX_CBN_LOW(i)); - } - } - - /* read selective clear regs to prevent spurious interrupts - * on reset because complete == kick. - * selective clear set up to prevent interrupts on resets - */ - readl(cp->regs + REG_INTR_STATUS_ALIAS); - writel(INTR_RX_DONE | INTR_RX_BUF_UNAVAIL, cp->regs + REG_ALIAS_CLEAR); - if (cp->cas_flags & CAS_FLAG_REG_PLUS) { - for (i = 1; i < N_RX_COMP_RINGS; i++) - readl(cp->regs + REG_PLUS_INTRN_STATUS_ALIAS(i)); - - /* 2 is different from 3 and 4 */ - if (N_RX_COMP_RINGS > 1) - writel(INTR_RX_DONE_ALT | INTR_RX_BUF_UNAVAIL_1, - cp->regs + REG_PLUS_ALIASN_CLEAR(1)); - - for (i = 2; i < N_RX_COMP_RINGS; i++) - writel(INTR_RX_DONE_ALT, - cp->regs + REG_PLUS_ALIASN_CLEAR(i)); - } - - /* set up pause thresholds */ - val = CAS_BASE(RX_PAUSE_THRESH_OFF, - cp->rx_pause_off / RX_PAUSE_THRESH_QUANTUM); - val |= CAS_BASE(RX_PAUSE_THRESH_ON, - cp->rx_pause_on / RX_PAUSE_THRESH_QUANTUM); - writel(val, cp->regs + REG_RX_PAUSE_THRESH); - - /* zero out dma reassembly buffers */ - for (i = 0; i < 64; i++) { - writel(i, cp->regs + REG_RX_TABLE_ADDR); - writel(0x0, cp->regs + REG_RX_TABLE_DATA_LOW); - writel(0x0, cp->regs + REG_RX_TABLE_DATA_MID); - writel(0x0, cp->regs + REG_RX_TABLE_DATA_HI); - } - - /* make sure address register is 0 for normal operation */ - writel(0x0, cp->regs + REG_RX_CTRL_FIFO_ADDR); - writel(0x0, cp->regs + REG_RX_IPP_FIFO_ADDR); - - /* interrupt mitigation */ -#ifdef USE_RX_BLANK - val = CAS_BASE(RX_BLANK_INTR_TIME, RX_BLANK_INTR_TIME_VAL); - val |= CAS_BASE(RX_BLANK_INTR_PKT, RX_BLANK_INTR_PKT_VAL); - writel(val, cp->regs + REG_RX_BLANK); -#else - writel(0x0, cp->regs + REG_RX_BLANK); -#endif - - /* interrupt generation as a function of low water marks for - * free desc and completion entries. these are used to trigger - * housekeeping for rx descs. we don't use the free interrupt - * as it's not very useful - */ - /* val = CAS_BASE(RX_AE_THRESH_FREE, RX_AE_FREEN_VAL(0)); */ - val = CAS_BASE(RX_AE_THRESH_COMP, RX_AE_COMP_VAL); - writel(val, cp->regs + REG_RX_AE_THRESH); - if (cp->cas_flags & CAS_FLAG_REG_PLUS) { - val = CAS_BASE(RX_AE1_THRESH_FREE, RX_AE_FREEN_VAL(1)); - writel(val, cp->regs + REG_PLUS_RX_AE1_THRESH); - } - - /* Random early detect registers. useful for congestion avoidance. - * this should be tunable. - */ - writel(0x0, cp->regs + REG_RX_RED); - - /* receive page sizes. default == 2K (0x800) */ - val = 0; - if (cp->page_size == 0x1000) - val = 0x1; - else if (cp->page_size == 0x2000) - val = 0x2; - else if (cp->page_size == 0x4000) - val = 0x3; - - /* round mtu + offset. constrain to page size. */ - size = cp->dev->mtu + 64; - if (size > cp->page_size) - size = cp->page_size; - - if (size <= 0x400) - i = 0x0; - else if (size <= 0x800) - i = 0x1; - else if (size <= 0x1000) - i = 0x2; - else - i = 0x3; - - cp->mtu_stride = 1 << (i + 10); - val = CAS_BASE(RX_PAGE_SIZE, val); - val |= CAS_BASE(RX_PAGE_SIZE_MTU_STRIDE, i); - val |= CAS_BASE(RX_PAGE_SIZE_MTU_COUNT, cp->page_size >> (i + 10)); - val |= CAS_BASE(RX_PAGE_SIZE_MTU_OFF, 0x1); - writel(val, cp->regs + REG_RX_PAGE_SIZE); - - /* enable the header parser if desired */ - if (CAS_HP_FIRMWARE == cas_prog_null) - return; - - val = CAS_BASE(HP_CFG_NUM_CPU, CAS_NCPUS > 63 ? 0 : CAS_NCPUS); - val |= HP_CFG_PARSE_EN | HP_CFG_SYN_INC_MASK; - val |= CAS_BASE(HP_CFG_TCP_THRESH, HP_TCP_THRESH_VAL); - writel(val, cp->regs + REG_HP_CFG); -} - -static inline void cas_rxc_init(struct cas_rx_comp *rxc) -{ - memset(rxc, 0, sizeof(*rxc)); - rxc->word4 = cpu_to_le64(RX_COMP4_ZERO); -} - -/* NOTE: we use the ENC RX DESC ring for spares. the rx_page[0,1] - * flipping is protected by the fact that the chip will not - * hand back the same page index while it's being processed. - */ -static inline cas_page_t *cas_page_spare(struct cas *cp, const int index) -{ - cas_page_t *page = cp->rx_pages[1][index]; - cas_page_t *new; - - if (page_count(page->buffer) == 1) - return page; - - new = cas_page_dequeue(cp); - if (new) { - spin_lock(&cp->rx_inuse_lock); - list_add(&page->list, &cp->rx_inuse_list); - spin_unlock(&cp->rx_inuse_lock); - } - return new; -} - -/* this needs to be changed if we actually use the ENC RX DESC ring */ -static cas_page_t *cas_page_swap(struct cas *cp, const int ring, - const int index) -{ - cas_page_t **page0 = cp->rx_pages[0]; - cas_page_t **page1 = cp->rx_pages[1]; - - /* swap if buffer is in use */ - if (page_count(page0[index]->buffer) > 1) { - cas_page_t *new = cas_page_spare(cp, index); - if (new) { - page1[index] = page0[index]; - page0[index] = new; - } - } - RX_USED_SET(page0[index], 0); - return page0[index]; -} - -static void cas_clean_rxds(struct cas *cp) -{ - /* only clean ring 0 as ring 1 is used for spare buffers */ - struct cas_rx_desc *rxd = cp->init_rxds[0]; - int i, size; - - /* release all rx flows */ - for (i = 0; i < N_RX_FLOWS; i++) { - struct sk_buff *skb; - while ((skb = __skb_dequeue(&cp->rx_flows[i]))) { - cas_skb_release(skb); - } - } - - /* initialize descriptors */ - size = RX_DESC_RINGN_SIZE(0); - for (i = 0; i < size; i++) { - cas_page_t *page = cas_page_swap(cp, 0, i); - rxd[i].buffer = cpu_to_le64(page->dma_addr); - rxd[i].index = cpu_to_le64(CAS_BASE(RX_INDEX_NUM, i) | - CAS_BASE(RX_INDEX_RING, 0)); - } - - cp->rx_old[0] = RX_DESC_RINGN_SIZE(0) - 4; - cp->rx_last[0] = 0; - cp->cas_flags &= ~CAS_FLAG_RXD_POST(0); -} - -static void cas_clean_rxcs(struct cas *cp) -{ - int i, j; - - /* take ownership of rx comp descriptors */ - memset(cp->rx_cur, 0, sizeof(*cp->rx_cur)*N_RX_COMP_RINGS); - memset(cp->rx_new, 0, sizeof(*cp->rx_new)*N_RX_COMP_RINGS); - for (i = 0; i < N_RX_COMP_RINGS; i++) { - struct cas_rx_comp *rxc = cp->init_rxcs[i]; - for (j = 0; j < RX_COMP_RINGN_SIZE(i); j++) { - cas_rxc_init(rxc + j); - } - } -} - -#if 0 -/* When we get a RX fifo overflow, the RX unit is probably hung - * so we do the following. - * - * If any part of the reset goes wrong, we return 1 and that causes the - * whole chip to be reset. - */ -static int cas_rxmac_reset(struct cas *cp) -{ - struct net_device *dev = cp->dev; - int limit; - u32 val; - - /* First, reset MAC RX. */ - writel(cp->mac_rx_cfg & ~MAC_RX_CFG_EN, cp->regs + REG_MAC_RX_CFG); - for (limit = 0; limit < STOP_TRIES; limit++) { - if (!(readl(cp->regs + REG_MAC_RX_CFG) & MAC_RX_CFG_EN)) - break; - udelay(10); - } - if (limit == STOP_TRIES) { - printk(KERN_ERR "%s: RX MAC will not disable, resetting whole " - "chip.\n", dev->name); - return 1; - } - - /* Second, disable RX DMA. */ - writel(0, cp->regs + REG_RX_CFG); - for (limit = 0; limit < STOP_TRIES; limit++) { - if (!(readl(cp->regs + REG_RX_CFG) & RX_CFG_DMA_EN)) - break; - udelay(10); - } - if (limit == STOP_TRIES) { - printk(KERN_ERR "%s: RX DMA will not disable, resetting whole " - "chip.\n", dev->name); - return 1; - } - - mdelay(5); - - /* Execute RX reset command. */ - writel(SW_RESET_RX, cp->regs + REG_SW_RESET); - for (limit = 0; limit < STOP_TRIES; limit++) { - if (!(readl(cp->regs + REG_SW_RESET) & SW_RESET_RX)) - break; - udelay(10); - } - if (limit == STOP_TRIES) { - printk(KERN_ERR "%s: RX reset command will not execute, " - "resetting whole chip.\n", dev->name); - return 1; - } - - /* reset driver rx state */ - cas_clean_rxds(cp); - cas_clean_rxcs(cp); - - /* Now, reprogram the rest of RX unit. */ - cas_init_rx_dma(cp); - - /* re-enable */ - val = readl(cp->regs + REG_RX_CFG); - writel(val | RX_CFG_DMA_EN, cp->regs + REG_RX_CFG); - writel(MAC_RX_FRAME_RECV, cp->regs + REG_MAC_RX_MASK); - val = readl(cp->regs + REG_MAC_RX_CFG); - writel(val | MAC_RX_CFG_EN, cp->regs + REG_MAC_RX_CFG); - return 0; -} -#endif - -static int cas_rxmac_interrupt(struct net_device *dev, struct cas *cp, - u32 status) -{ - u32 stat = readl(cp->regs + REG_MAC_RX_STATUS); - - if (!stat) - return 0; - - if (netif_msg_intr(cp)) - printk(KERN_DEBUG "%s: rxmac interrupt, stat: 0x%x\n", - cp->dev->name, stat); - - /* these are all rollovers */ - spin_lock(&cp->stat_lock[0]); - if (stat & MAC_RX_ALIGN_ERR) - cp->net_stats[0].rx_frame_errors += 0x10000; - - if (stat & MAC_RX_CRC_ERR) - cp->net_stats[0].rx_crc_errors += 0x10000; - - if (stat & MAC_RX_LEN_ERR) - cp->net_stats[0].rx_length_errors += 0x10000; - - if (stat & MAC_RX_OVERFLOW) { - cp->net_stats[0].rx_over_errors++; - cp->net_stats[0].rx_fifo_errors++; - } - - /* We do not track MAC_RX_FRAME_COUNT and MAC_RX_VIOL_ERR - * events. - */ - spin_unlock(&cp->stat_lock[0]); - return 0; -} - -static int cas_mac_interrupt(struct net_device *dev, struct cas *cp, - u32 status) -{ - u32 stat = readl(cp->regs + REG_MAC_CTRL_STATUS); - - if (!stat) - return 0; - - if (netif_msg_intr(cp)) - printk(KERN_DEBUG "%s: mac interrupt, stat: 0x%x\n", - cp->dev->name, stat); - - /* This interrupt is just for pause frame and pause - * tracking. It is useful for diagnostics and debug - * but probably by default we will mask these events. - */ - if (stat & MAC_CTRL_PAUSE_STATE) - cp->pause_entered++; - - if (stat & MAC_CTRL_PAUSE_RECEIVED) - cp->pause_last_time_recvd = (stat >> 16); - - return 0; -} - - -/* Must be invoked under cp->lock. */ -static inline int cas_mdio_link_not_up(struct cas *cp) -{ - u16 val; - - switch (cp->lstate) { - case link_force_ret: - if (netif_msg_link(cp)) - printk(KERN_INFO "%s: Autoneg failed again, keeping" - " forced mode\n", cp->dev->name); - cas_phy_write(cp, MII_BMCR, cp->link_fcntl); - cp->timer_ticks = 5; - cp->lstate = link_force_ok; - cp->link_transition = LINK_TRANSITION_LINK_CONFIG; - break; - - case link_aneg: - val = cas_phy_read(cp, MII_BMCR); - - /* Try forced modes. we try things in the following order: - * 1000 full -> 100 full/half -> 10 half - */ - val &= ~(BMCR_ANRESTART | BMCR_ANENABLE); - val |= BMCR_FULLDPLX; - val |= (cp->cas_flags & CAS_FLAG_1000MB_CAP) ? - CAS_BMCR_SPEED1000 : BMCR_SPEED100; - cas_phy_write(cp, MII_BMCR, val); - cp->timer_ticks = 5; - cp->lstate = link_force_try; - cp->link_transition = LINK_TRANSITION_LINK_CONFIG; - break; - - case link_force_try: - /* Downgrade from 1000 to 100 to 10 Mbps if necessary. */ - val = cas_phy_read(cp, MII_BMCR); - cp->timer_ticks = 5; - if (val & CAS_BMCR_SPEED1000) { /* gigabit */ - val &= ~CAS_BMCR_SPEED1000; - val |= (BMCR_SPEED100 | BMCR_FULLDPLX); - cas_phy_write(cp, MII_BMCR, val); - break; - } - - if (val & BMCR_SPEED100) { - if (val & BMCR_FULLDPLX) /* fd failed */ - val &= ~BMCR_FULLDPLX; - else { /* 100Mbps failed */ - val &= ~BMCR_SPEED100; - } - cas_phy_write(cp, MII_BMCR, val); - break; - } - default: - break; - } - return 0; -} - - -/* must be invoked with cp->lock held */ -static int cas_mii_link_check(struct cas *cp, const u16 bmsr) -{ - int restart; - - if (bmsr & BMSR_LSTATUS) { - /* Ok, here we got a link. If we had it due to a forced - * fallback, and we were configured for autoneg, we - * retry a short autoneg pass. If you know your hub is - * broken, use ethtool ;) - */ - if ((cp->lstate == link_force_try) && - (cp->link_cntl & BMCR_ANENABLE)) { - cp->lstate = link_force_ret; - cp->link_transition = LINK_TRANSITION_LINK_CONFIG; - cas_mif_poll(cp, 0); - cp->link_fcntl = cas_phy_read(cp, MII_BMCR); - cp->timer_ticks = 5; - if (cp->opened && netif_msg_link(cp)) - printk(KERN_INFO "%s: Got link after fallback, retrying" - " autoneg once...\n", cp->dev->name); - cas_phy_write(cp, MII_BMCR, - cp->link_fcntl | BMCR_ANENABLE | - BMCR_ANRESTART); - cas_mif_poll(cp, 1); - - } else if (cp->lstate != link_up) { - cp->lstate = link_up; - cp->link_transition = LINK_TRANSITION_LINK_UP; - - if (cp->opened) { - cas_set_link_modes(cp); - netif_carrier_on(cp->dev); - } - } - return 0; - } - - /* link not up. if the link was previously up, we restart the - * whole process - */ - restart = 0; - if (cp->lstate == link_up) { - cp->lstate = link_down; - cp->link_transition = LINK_TRANSITION_LINK_DOWN; - - netif_carrier_off(cp->dev); - if (cp->opened && netif_msg_link(cp)) - printk(KERN_INFO "%s: Link down\n", - cp->dev->name); - restart = 1; - - } else if (++cp->timer_ticks > 10) - cas_mdio_link_not_up(cp); - - return restart; -} - -static int cas_mif_interrupt(struct net_device *dev, struct cas *cp, - u32 status) -{ - u32 stat = readl(cp->regs + REG_MIF_STATUS); - u16 bmsr; - - /* check for a link change */ - if (CAS_VAL(MIF_STATUS_POLL_STATUS, stat) == 0) - return 0; - - bmsr = CAS_VAL(MIF_STATUS_POLL_DATA, stat); - return cas_mii_link_check(cp, bmsr); -} - -static int cas_pci_interrupt(struct net_device *dev, struct cas *cp, - u32 status) -{ - u32 stat = readl(cp->regs + REG_PCI_ERR_STATUS); - - if (!stat) - return 0; - - printk(KERN_ERR "%s: PCI error [%04x:%04x] ", dev->name, stat, - readl(cp->regs + REG_BIM_DIAG)); - - /* cassini+ has this reserved */ - if ((stat & PCI_ERR_BADACK) && - ((cp->cas_flags & CAS_FLAG_REG_PLUS) == 0)) - printk(" "); - - if (stat & PCI_ERR_DTRTO) - printk(" "); - if (stat & PCI_ERR_OTHER) - printk(" "); - if (stat & PCI_ERR_BIM_DMA_WRITE) - printk(" "); - if (stat & PCI_ERR_BIM_DMA_READ) - printk(" "); - printk("\n"); - - if (stat & PCI_ERR_OTHER) { - u16 cfg; - - /* Interrogate PCI config space for the - * true cause. - */ - pci_read_config_word(cp->pdev, PCI_STATUS, &cfg); - printk(KERN_ERR "%s: Read PCI cfg space status [%04x]\n", - dev->name, cfg); - if (cfg & PCI_STATUS_PARITY) - printk(KERN_ERR "%s: PCI parity error detected.\n", - dev->name); - if (cfg & PCI_STATUS_SIG_TARGET_ABORT) - printk(KERN_ERR "%s: PCI target abort.\n", - dev->name); - if (cfg & PCI_STATUS_REC_TARGET_ABORT) - printk(KERN_ERR "%s: PCI master acks target abort.\n", - dev->name); - if (cfg & PCI_STATUS_REC_MASTER_ABORT) - printk(KERN_ERR "%s: PCI master abort.\n", dev->name); - if (cfg & PCI_STATUS_SIG_SYSTEM_ERROR) - printk(KERN_ERR "%s: PCI system error SERR#.\n", - dev->name); - if (cfg & PCI_STATUS_DETECTED_PARITY) - printk(KERN_ERR "%s: PCI parity error.\n", - dev->name); - - /* Write the error bits back to clear them. */ - cfg &= (PCI_STATUS_PARITY | - PCI_STATUS_SIG_TARGET_ABORT | - PCI_STATUS_REC_TARGET_ABORT | - PCI_STATUS_REC_MASTER_ABORT | - PCI_STATUS_SIG_SYSTEM_ERROR | - PCI_STATUS_DETECTED_PARITY); - pci_write_config_word(cp->pdev, PCI_STATUS, cfg); - } - - /* For all PCI errors, we should reset the chip. */ - return 1; -} - -/* All non-normal interrupt conditions get serviced here. - * Returns non-zero if we should just exit the interrupt - * handler right now (ie. if we reset the card which invalidates - * all of the other original irq status bits). - */ -static int cas_abnormal_irq(struct net_device *dev, struct cas *cp, - u32 status) -{ - if (status & INTR_RX_TAG_ERROR) { - /* corrupt RX tag framing */ - if (netif_msg_rx_err(cp)) - printk(KERN_DEBUG "%s: corrupt rx tag framing\n", - cp->dev->name); - spin_lock(&cp->stat_lock[0]); - cp->net_stats[0].rx_errors++; - spin_unlock(&cp->stat_lock[0]); - goto do_reset; - } - - if (status & INTR_RX_LEN_MISMATCH) { - /* length mismatch. */ - if (netif_msg_rx_err(cp)) - printk(KERN_DEBUG "%s: length mismatch for rx frame\n", - cp->dev->name); - spin_lock(&cp->stat_lock[0]); - cp->net_stats[0].rx_errors++; - spin_unlock(&cp->stat_lock[0]); - goto do_reset; - } - - if (status & INTR_PCS_STATUS) { - if (cas_pcs_interrupt(dev, cp, status)) - goto do_reset; - } - - if (status & INTR_TX_MAC_STATUS) { - if (cas_txmac_interrupt(dev, cp, status)) - goto do_reset; - } - - if (status & INTR_RX_MAC_STATUS) { - if (cas_rxmac_interrupt(dev, cp, status)) - goto do_reset; - } - - if (status & INTR_MAC_CTRL_STATUS) { - if (cas_mac_interrupt(dev, cp, status)) - goto do_reset; - } - - if (status & INTR_MIF_STATUS) { - if (cas_mif_interrupt(dev, cp, status)) - goto do_reset; - } - - if (status & INTR_PCI_ERROR_STATUS) { - if (cas_pci_interrupt(dev, cp, status)) - goto do_reset; - } - return 0; - -do_reset: -#if 1 - atomic_inc(&cp->reset_task_pending); - atomic_inc(&cp->reset_task_pending_all); - printk(KERN_ERR "%s:reset called in cas_abnormal_irq [0x%x]\n", - dev->name, status); - schedule_work(&cp->reset_task); -#else - atomic_set(&cp->reset_task_pending, CAS_RESET_ALL); - printk(KERN_ERR "reset called in cas_abnormal_irq\n"); - schedule_work(&cp->reset_task); -#endif - return 1; -} - -/* NOTE: CAS_TABORT returns 1 or 2 so that it can be used when - * determining whether to do a netif_stop/wakeup - */ -#define CAS_TABORT(x) (((x)->cas_flags & CAS_FLAG_TARGET_ABORT) ? 2 : 1) -#define CAS_ROUND_PAGE(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK) -static inline int cas_calc_tabort(struct cas *cp, const unsigned long addr, - const int len) -{ - unsigned long off = addr + len; - - if (CAS_TABORT(cp) == 1) - return 0; - if ((CAS_ROUND_PAGE(off) - off) > TX_TARGET_ABORT_LEN) - return 0; - return TX_TARGET_ABORT_LEN; -} - -static inline void cas_tx_ringN(struct cas *cp, int ring, int limit) -{ - struct cas_tx_desc *txds; - struct sk_buff **skbs; - struct net_device *dev = cp->dev; - int entry, count; - - spin_lock(&cp->tx_lock[ring]); - txds = cp->init_txds[ring]; - skbs = cp->tx_skbs[ring]; - entry = cp->tx_old[ring]; - - count = TX_BUFF_COUNT(ring, entry, limit); - while (entry != limit) { - struct sk_buff *skb = skbs[entry]; - dma_addr_t daddr; - u32 dlen; - int frag; - - if (!skb) { - /* this should never occur */ - entry = TX_DESC_NEXT(ring, entry); - continue; - } - - /* however, we might get only a partial skb release. */ - count -= skb_shinfo(skb)->nr_frags + - + cp->tx_tiny_use[ring][entry].nbufs + 1; - if (count < 0) - break; - - if (netif_msg_tx_done(cp)) - printk(KERN_DEBUG "%s: tx[%d] done, slot %d\n", - cp->dev->name, ring, entry); - - skbs[entry] = NULL; - cp->tx_tiny_use[ring][entry].nbufs = 0; - - for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) { - struct cas_tx_desc *txd = txds + entry; - - daddr = le64_to_cpu(txd->buffer); - dlen = CAS_VAL(TX_DESC_BUFLEN, - le64_to_cpu(txd->control)); - pci_unmap_page(cp->pdev, daddr, dlen, - PCI_DMA_TODEVICE); - entry = TX_DESC_NEXT(ring, entry); - - /* tiny buffer may follow */ - if (cp->tx_tiny_use[ring][entry].used) { - cp->tx_tiny_use[ring][entry].used = 0; - entry = TX_DESC_NEXT(ring, entry); - } - } - - spin_lock(&cp->stat_lock[ring]); - cp->net_stats[ring].tx_packets++; - cp->net_stats[ring].tx_bytes += skb->len; - spin_unlock(&cp->stat_lock[ring]); - dev_kfree_skb_irq(skb); - } - cp->tx_old[ring] = entry; - - /* this is wrong for multiple tx rings. the net device needs - * multiple queues for this to do the right thing. we wait - * for 2*packets to be available when using tiny buffers - */ - if (netif_queue_stopped(dev) && - (TX_BUFFS_AVAIL(cp, ring) > CAS_TABORT(cp)*(MAX_SKB_FRAGS + 1))) - netif_wake_queue(dev); - spin_unlock(&cp->tx_lock[ring]); -} - -static void cas_tx(struct net_device *dev, struct cas *cp, - u32 status) -{ - int limit, ring; -#ifdef USE_TX_COMPWB - u64 compwb = le64_to_cpu(cp->init_block->tx_compwb); -#endif - if (netif_msg_intr(cp)) - printk(KERN_DEBUG "%s: tx interrupt, status: 0x%x, %lx\n", - cp->dev->name, status, compwb); - /* process all the rings */ - for (ring = 0; ring < N_TX_RINGS; ring++) { -#ifdef USE_TX_COMPWB - /* use the completion writeback registers */ - limit = (CAS_VAL(TX_COMPWB_MSB, compwb) << 8) | - CAS_VAL(TX_COMPWB_LSB, compwb); - compwb = TX_COMPWB_NEXT(compwb); -#else - limit = readl(cp->regs + REG_TX_COMPN(ring)); -#endif - if (cp->tx_old[ring] != limit) - cas_tx_ringN(cp, ring, limit); - } -} - - -static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, - int entry, const u64 *words, - struct sk_buff **skbref) -{ - int dlen, hlen, len, i, alloclen; - int off, swivel = RX_SWIVEL_OFF_VAL; - struct cas_page *page; - struct sk_buff *skb; - void *addr, *crcaddr; - char *p; - - hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]); - dlen = CAS_VAL(RX_COMP1_DATA_SIZE, words[0]); - len = hlen + dlen; - - if (RX_COPY_ALWAYS || (words[2] & RX_COMP3_SMALL_PKT)) - alloclen = len; - else - alloclen = max(hlen, RX_COPY_MIN); - - skb = dev_alloc_skb(alloclen + swivel + cp->crc_size); - if (skb == NULL) - return -1; - - *skbref = skb; - skb->dev = cp->dev; - skb_reserve(skb, swivel); - - p = skb->data; - addr = crcaddr = NULL; - if (hlen) { /* always copy header pages */ - i = CAS_VAL(RX_COMP2_HDR_INDEX, words[1]); - page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)]; - off = CAS_VAL(RX_COMP2_HDR_OFF, words[1]) * 0x100 + - swivel; - - i = hlen; - if (!dlen) /* attach FCS */ - i += cp->crc_size; - pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr + off, i, - PCI_DMA_FROMDEVICE); - addr = cas_page_map(page->buffer); - memcpy(p, addr + off, i); - pci_dma_sync_single_for_device(cp->pdev, page->dma_addr + off, i, - PCI_DMA_FROMDEVICE); - cas_page_unmap(addr); - RX_USED_ADD(page, 0x100); - p += hlen; - swivel = 0; - } - - - if (alloclen < (hlen + dlen)) { - skb_frag_t *frag = skb_shinfo(skb)->frags; - - /* normal or jumbo packets. we use frags */ - i = CAS_VAL(RX_COMP1_DATA_INDEX, words[0]); - page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)]; - off = CAS_VAL(RX_COMP1_DATA_OFF, words[0]) + swivel; - - hlen = min(cp->page_size - off, dlen); - if (hlen < 0) { - if (netif_msg_rx_err(cp)) { - printk(KERN_DEBUG "%s: rx page overflow: " - "%d\n", cp->dev->name, hlen); - } - dev_kfree_skb_irq(skb); - return -1; - } - i = hlen; - if (i == dlen) /* attach FCS */ - i += cp->crc_size; - pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr + off, i, - PCI_DMA_FROMDEVICE); - - /* make sure we always copy a header */ - swivel = 0; - if (p == (char *) skb->data) { /* not split */ - addr = cas_page_map(page->buffer); - memcpy(p, addr + off, RX_COPY_MIN); - pci_dma_sync_single_for_device(cp->pdev, page->dma_addr + off, i, - PCI_DMA_FROMDEVICE); - cas_page_unmap(addr); - off += RX_COPY_MIN; - swivel = RX_COPY_MIN; - RX_USED_ADD(page, cp->mtu_stride); - } else { - RX_USED_ADD(page, hlen); - } - skb_put(skb, alloclen); - - skb_shinfo(skb)->nr_frags++; - skb->data_len += hlen - swivel; - skb->len += hlen - swivel; - - get_page(page->buffer); - frag->page = page->buffer; - frag->page_offset = off; - frag->size = hlen - swivel; - - /* any more data? */ - if ((words[0] & RX_COMP1_SPLIT_PKT) && ((dlen -= hlen) > 0)) { - hlen = dlen; - off = 0; - - i = CAS_VAL(RX_COMP2_NEXT_INDEX, words[1]); - page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)]; - pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr, - hlen + cp->crc_size, - PCI_DMA_FROMDEVICE); - pci_dma_sync_single_for_device(cp->pdev, page->dma_addr, - hlen + cp->crc_size, - PCI_DMA_FROMDEVICE); - - skb_shinfo(skb)->nr_frags++; - skb->data_len += hlen; - skb->len += hlen; - frag++; - - get_page(page->buffer); - frag->page = page->buffer; - frag->page_offset = 0; - frag->size = hlen; - RX_USED_ADD(page, hlen + cp->crc_size); - } - - if (cp->crc_size) { - addr = cas_page_map(page->buffer); - crcaddr = addr + off + hlen; - } - - } else { - /* copying packet */ - if (!dlen) - goto end_copy_pkt; - - i = CAS_VAL(RX_COMP1_DATA_INDEX, words[0]); - page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)]; - off = CAS_VAL(RX_COMP1_DATA_OFF, words[0]) + swivel; - hlen = min(cp->page_size - off, dlen); - if (hlen < 0) { - if (netif_msg_rx_err(cp)) { - printk(KERN_DEBUG "%s: rx page overflow: " - "%d\n", cp->dev->name, hlen); - } - dev_kfree_skb_irq(skb); - return -1; - } - i = hlen; - if (i == dlen) /* attach FCS */ - i += cp->crc_size; - pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr + off, i, - PCI_DMA_FROMDEVICE); - addr = cas_page_map(page->buffer); - memcpy(p, addr + off, i); - pci_dma_sync_single_for_device(cp->pdev, page->dma_addr + off, i, - PCI_DMA_FROMDEVICE); - cas_page_unmap(addr); - if (p == (char *) skb->data) /* not split */ - RX_USED_ADD(page, cp->mtu_stride); - else - RX_USED_ADD(page, i); - - /* any more data? */ - if ((words[0] & RX_COMP1_SPLIT_PKT) && ((dlen -= hlen) > 0)) { - p += hlen; - i = CAS_VAL(RX_COMP2_NEXT_INDEX, words[1]); - page = cp->rx_pages[CAS_VAL(RX_INDEX_RING, i)][CAS_VAL(RX_INDEX_NUM, i)]; - pci_dma_sync_single_for_cpu(cp->pdev, page->dma_addr, - dlen + cp->crc_size, - PCI_DMA_FROMDEVICE); - addr = cas_page_map(page->buffer); - memcpy(p, addr, dlen + cp->crc_size); - pci_dma_sync_single_for_device(cp->pdev, page->dma_addr, - dlen + cp->crc_size, - PCI_DMA_FROMDEVICE); - cas_page_unmap(addr); - RX_USED_ADD(page, dlen + cp->crc_size); - } -end_copy_pkt: - if (cp->crc_size) { - addr = NULL; - crcaddr = skb->data + alloclen; - } - skb_put(skb, alloclen); - } - - i = CAS_VAL(RX_COMP4_TCP_CSUM, words[3]); - if (cp->crc_size) { - /* checksum includes FCS. strip it out. */ - i = csum_fold(csum_partial(crcaddr, cp->crc_size, i)); - if (addr) - cas_page_unmap(addr); - } - skb->csum = ntohs(i ^ 0xffff); - skb->ip_summed = CHECKSUM_HW; - skb->protocol = eth_type_trans(skb, cp->dev); - return len; -} - - -/* we can handle up to 64 rx flows at a time. we do the same thing - * as nonreassm except that we batch up the buffers. - * NOTE: we currently just treat each flow as a bunch of packets that - * we pass up. a better way would be to coalesce the packets - * into a jumbo packet. to do that, we need to do the following: - * 1) the first packet will have a clean split between header and - * data. save both. - * 2) each time the next flow packet comes in, extend the - * data length and merge the checksums. - * 3) on flow release, fix up the header. - * 4) make sure the higher layer doesn't care. - * because packets get coalesced, we shouldn't run into fragment count - * issues. - */ -static inline void cas_rx_flow_pkt(struct cas *cp, const u64 *words, - struct sk_buff *skb) -{ - int flowid = CAS_VAL(RX_COMP3_FLOWID, words[2]) & (N_RX_FLOWS - 1); - struct sk_buff_head *flow = &cp->rx_flows[flowid]; - - /* this is protected at a higher layer, so no need to - * do any additional locking here. stick the buffer - * at the end. - */ - __skb_insert(skb, flow->prev, (struct sk_buff *) flow, flow); - if (words[0] & RX_COMP1_RELEASE_FLOW) { - while ((skb = __skb_dequeue(flow))) { - cas_skb_release(skb); - } - } -} - -/* put rx descriptor back on ring. if a buffer is in use by a higher - * layer, this will need to put in a replacement. - */ -static void cas_post_page(struct cas *cp, const int ring, const int index) -{ - cas_page_t *new; - int entry; - - entry = cp->rx_old[ring]; - - new = cas_page_swap(cp, ring, index); - cp->init_rxds[ring][entry].buffer = cpu_to_le64(new->dma_addr); - cp->init_rxds[ring][entry].index = - cpu_to_le64(CAS_BASE(RX_INDEX_NUM, index) | - CAS_BASE(RX_INDEX_RING, ring)); - - entry = RX_DESC_ENTRY(ring, entry + 1); - cp->rx_old[ring] = entry; - - if (entry % 4) - return; - - if (ring == 0) - writel(entry, cp->regs + REG_RX_KICK); - else if ((N_RX_DESC_RINGS > 1) && - (cp->cas_flags & CAS_FLAG_REG_PLUS)) - writel(entry, cp->regs + REG_PLUS_RX_KICK1); -} - - -/* only when things are bad */ -static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) -{ - unsigned int entry, last, count, released; - int cluster; - cas_page_t **page = cp->rx_pages[ring]; - - entry = cp->rx_old[ring]; - - if (netif_msg_intr(cp)) - printk(KERN_DEBUG "%s: rxd[%d] interrupt, done: %d\n", - cp->dev->name, ring, entry); - - cluster = -1; - count = entry & 0x3; - last = RX_DESC_ENTRY(ring, num ? entry + num - 4: entry - 4); - released = 0; - while (entry != last) { - /* make a new buffer if it's still in use */ - if (page_count(page[entry]->buffer) > 1) { - cas_page_t *new = cas_page_dequeue(cp); - if (!new) { - /* let the timer know that we need to - * do this again - */ - cp->cas_flags |= CAS_FLAG_RXD_POST(ring); - if (!timer_pending(&cp->link_timer)) - mod_timer(&cp->link_timer, jiffies + - CAS_LINK_FAST_TIMEOUT); - cp->rx_old[ring] = entry; - cp->rx_last[ring] = num ? num - released : 0; - return -ENOMEM; - } - spin_lock(&cp->rx_inuse_lock); - list_add(&page[entry]->list, &cp->rx_inuse_list); - spin_unlock(&cp->rx_inuse_lock); - cp->init_rxds[ring][entry].buffer = - cpu_to_le64(new->dma_addr); - page[entry] = new; - - } - - if (++count == 4) { - cluster = entry; - count = 0; - } - released++; - entry = RX_DESC_ENTRY(ring, entry + 1); - } - cp->rx_old[ring] = entry; - - if (cluster < 0) - return 0; - - if (ring == 0) - writel(cluster, cp->regs + REG_RX_KICK); - else if ((N_RX_DESC_RINGS > 1) && - (cp->cas_flags & CAS_FLAG_REG_PLUS)) - writel(cluster, cp->regs + REG_PLUS_RX_KICK1); - return 0; -} - - -/* process a completion ring. packets are set up in three basic ways: - * small packets: should be copied header + data in single buffer. - * large packets: header and data in a single buffer. - * split packets: header in a separate buffer from data. - * data may be in multiple pages. data may be > 256 - * bytes but in a single page. - * - * NOTE: RX page posting is done in this routine as well. while there's - * the capability of using multiple RX completion rings, it isn't - * really worthwhile due to the fact that the page posting will - * force serialization on the single descriptor ring. - */ -static int cas_rx_ringN(struct cas *cp, int ring, int budget) -{ - struct cas_rx_comp *rxcs = cp->init_rxcs[ring]; - int entry, drops; - int npackets = 0; - - if (netif_msg_intr(cp)) - printk(KERN_DEBUG "%s: rx[%d] interrupt, done: %d/%d\n", - cp->dev->name, ring, - readl(cp->regs + REG_RX_COMP_HEAD), - cp->rx_new[ring]); - - entry = cp->rx_new[ring]; - drops = 0; - while (1) { - struct cas_rx_comp *rxc = rxcs + entry; - struct sk_buff *skb; - int type, len; - u64 words[4]; - int i, dring; - - words[0] = le64_to_cpu(rxc->word1); - words[1] = le64_to_cpu(rxc->word2); - words[2] = le64_to_cpu(rxc->word3); - words[3] = le64_to_cpu(rxc->word4); - - /* don't touch if still owned by hw */ - type = CAS_VAL(RX_COMP1_TYPE, words[0]); - if (type == 0) - break; - - /* hw hasn't cleared the zero bit yet */ - if (words[3] & RX_COMP4_ZERO) { - break; - } - - /* get info on the packet */ - if (words[3] & (RX_COMP4_LEN_MISMATCH | RX_COMP4_BAD)) { - spin_lock(&cp->stat_lock[ring]); - cp->net_stats[ring].rx_errors++; - if (words[3] & RX_COMP4_LEN_MISMATCH) - cp->net_stats[ring].rx_length_errors++; - if (words[3] & RX_COMP4_BAD) - cp->net_stats[ring].rx_crc_errors++; - spin_unlock(&cp->stat_lock[ring]); - - /* We'll just return it to Cassini. */ - drop_it: - spin_lock(&cp->stat_lock[ring]); - ++cp->net_stats[ring].rx_dropped; - spin_unlock(&cp->stat_lock[ring]); - goto next; - } - - len = cas_rx_process_pkt(cp, rxc, entry, words, &skb); - if (len < 0) { - ++drops; - goto drop_it; - } - - /* see if it's a flow re-assembly or not. the driver - * itself handles release back up. - */ - if (RX_DONT_BATCH || (type == 0x2)) { - /* non-reassm: these always get released */ - cas_skb_release(skb); - } else { - cas_rx_flow_pkt(cp, words, skb); - } - - spin_lock(&cp->stat_lock[ring]); - cp->net_stats[ring].rx_packets++; - cp->net_stats[ring].rx_bytes += len; - spin_unlock(&cp->stat_lock[ring]); - cp->dev->last_rx = jiffies; - - next: - npackets++; - - /* should it be released? */ - if (words[0] & RX_COMP1_RELEASE_HDR) { - i = CAS_VAL(RX_COMP2_HDR_INDEX, words[1]); - dring = CAS_VAL(RX_INDEX_RING, i); - i = CAS_VAL(RX_INDEX_NUM, i); - cas_post_page(cp, dring, i); - } - - if (words[0] & RX_COMP1_RELEASE_DATA) { - i = CAS_VAL(RX_COMP1_DATA_INDEX, words[0]); - dring = CAS_VAL(RX_INDEX_RING, i); - i = CAS_VAL(RX_INDEX_NUM, i); - cas_post_page(cp, dring, i); - } - - if (words[0] & RX_COMP1_RELEASE_NEXT) { - i = CAS_VAL(RX_COMP2_NEXT_INDEX, words[1]); - dring = CAS_VAL(RX_INDEX_RING, i); - i = CAS_VAL(RX_INDEX_NUM, i); - cas_post_page(cp, dring, i); - } - - /* skip to the next entry */ - entry = RX_COMP_ENTRY(ring, entry + 1 + - CAS_VAL(RX_COMP1_SKIP, words[0])); -#ifdef USE_NAPI - if (budget && (npackets >= budget)) - break; -#endif - } - cp->rx_new[ring] = entry; - - if (drops) - printk(KERN_INFO "%s: Memory squeeze, deferring packet.\n", - cp->dev->name); - return npackets; -} - - -/* put completion entries back on the ring */ -static void cas_post_rxcs_ringN(struct net_device *dev, - struct cas *cp, int ring) -{ - struct cas_rx_comp *rxc = cp->init_rxcs[ring]; - int last, entry; - - last = cp->rx_cur[ring]; - entry = cp->rx_new[ring]; - if (netif_msg_intr(cp)) - printk(KERN_DEBUG "%s: rxc[%d] interrupt, done: %d/%d\n", - dev->name, ring, readl(cp->regs + REG_RX_COMP_HEAD), - entry); - - /* zero and re-mark descriptors */ - while (last != entry) { - cas_rxc_init(rxc + last); - last = RX_COMP_ENTRY(ring, last + 1); - } - cp->rx_cur[ring] = last; - - if (ring == 0) - writel(last, cp->regs + REG_RX_COMP_TAIL); - else if (cp->cas_flags & CAS_FLAG_REG_PLUS) - writel(last, cp->regs + REG_PLUS_RX_COMPN_TAIL(ring)); -} - - - -/* cassini can use all four PCI interrupts for the completion ring. - * rings 3 and 4 are identical - */ -#if defined(USE_PCI_INTC) || defined(USE_PCI_INTD) -static inline void cas_handle_irqN(struct net_device *dev, - struct cas *cp, const u32 status, - const int ring) -{ - if (status & (INTR_RX_COMP_FULL_ALT | INTR_RX_COMP_AF_ALT)) - cas_post_rxcs_ringN(dev, cp, ring); -} - -static irqreturn_t cas_interruptN(int irq, void *dev_id, struct pt_regs *regs) -{ - struct net_device *dev = dev_id; - struct cas *cp = netdev_priv(dev); - unsigned long flags; - int ring; - u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(ring)); - - /* check for shared irq */ - if (status == 0) - return IRQ_NONE; - - ring = (irq == cp->pci_irq_INTC) ? 2 : 3; - spin_lock_irqsave(&cp->lock, flags); - if (status & INTR_RX_DONE_ALT) { /* handle rx separately */ -#ifdef USE_NAPI - cas_mask_intr(cp); - netif_rx_schedule(dev); -#else - cas_rx_ringN(cp, ring, 0); -#endif - status &= ~INTR_RX_DONE_ALT; - } - - if (status) - cas_handle_irqN(dev, cp, status, ring); - spin_unlock_irqrestore(&cp->lock, flags); - return IRQ_HANDLED; -} -#endif - -#ifdef USE_PCI_INTB -/* everything but rx packets */ -static inline void cas_handle_irq1(struct cas *cp, const u32 status) -{ - if (status & INTR_RX_BUF_UNAVAIL_1) { - /* Frame arrived, no free RX buffers available. - * NOTE: we can get this on a link transition. */ - cas_post_rxds_ringN(cp, 1, 0); - spin_lock(&cp->stat_lock[1]); - cp->net_stats[1].rx_dropped++; - spin_unlock(&cp->stat_lock[1]); - } - - if (status & INTR_RX_BUF_AE_1) - cas_post_rxds_ringN(cp, 1, RX_DESC_RINGN_SIZE(1) - - RX_AE_FREEN_VAL(1)); - - if (status & (INTR_RX_COMP_AF | INTR_RX_COMP_FULL)) - cas_post_rxcs_ringN(cp, 1); -} - -/* ring 2 handles a few more events than 3 and 4 */ -static irqreturn_t cas_interrupt1(int irq, void *dev_id, struct pt_regs *regs) -{ - struct net_device *dev = dev_id; - struct cas *cp = netdev_priv(dev); - unsigned long flags; - u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(1)); - - /* check for shared interrupt */ - if (status == 0) - return IRQ_NONE; - - spin_lock_irqsave(&cp->lock, flags); - if (status & INTR_RX_DONE_ALT) { /* handle rx separately */ -#ifdef USE_NAPI - cas_mask_intr(cp); - netif_rx_schedule(dev); -#else - cas_rx_ringN(cp, 1, 0); -#endif - status &= ~INTR_RX_DONE_ALT; - } - if (status) - cas_handle_irq1(cp, status); - spin_unlock_irqrestore(&cp->lock, flags); - return IRQ_HANDLED; -} -#endif - -static inline void cas_handle_irq(struct net_device *dev, - struct cas *cp, const u32 status) -{ - /* housekeeping interrupts */ - if (status & INTR_ERROR_MASK) - cas_abnormal_irq(dev, cp, status); - - if (status & INTR_RX_BUF_UNAVAIL) { - /* Frame arrived, no free RX buffers available. - * NOTE: we can get this on a link transition. - */ - cas_post_rxds_ringN(cp, 0, 0); - spin_lock(&cp->stat_lock[0]); - cp->net_stats[0].rx_dropped++; - spin_unlock(&cp->stat_lock[0]); - } else if (status & INTR_RX_BUF_AE) { - cas_post_rxds_ringN(cp, 0, RX_DESC_RINGN_SIZE(0) - - RX_AE_FREEN_VAL(0)); - } - - if (status & (INTR_RX_COMP_AF | INTR_RX_COMP_FULL)) - cas_post_rxcs_ringN(dev, cp, 0); -} - -static irqreturn_t cas_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - struct net_device *dev = dev_id; - struct cas *cp = netdev_priv(dev); - unsigned long flags; - u32 status = readl(cp->regs + REG_INTR_STATUS); - - if (status == 0) - return IRQ_NONE; - - spin_lock_irqsave(&cp->lock, flags); - if (status & (INTR_TX_ALL | INTR_TX_INTME)) { - cas_tx(dev, cp, status); - status &= ~(INTR_TX_ALL | INTR_TX_INTME); - } - - if (status & INTR_RX_DONE) { -#ifdef USE_NAPI - cas_mask_intr(cp); - netif_rx_schedule(dev); -#else - cas_rx_ringN(cp, 0, 0); -#endif - status &= ~INTR_RX_DONE; - } - - if (status) - cas_handle_irq(dev, cp, status); - spin_unlock_irqrestore(&cp->lock, flags); - return IRQ_HANDLED; -} - - -#ifdef USE_NAPI -static int cas_poll(struct net_device *dev, int *budget) -{ - struct cas *cp = netdev_priv(dev); - int i, enable_intr, todo, credits; - u32 status = readl(cp->regs + REG_INTR_STATUS); - unsigned long flags; - - spin_lock_irqsave(&cp->lock, flags); - cas_tx(dev, cp, status); - spin_unlock_irqrestore(&cp->lock, flags); - - /* NAPI rx packets. we spread the credits across all of the - * rxc rings - */ - todo = min(*budget, dev->quota); - - /* to make sure we're fair with the work we loop through each - * ring N_RX_COMP_RING times with a request of - * todo / N_RX_COMP_RINGS - */ - enable_intr = 1; - credits = 0; - for (i = 0; i < N_RX_COMP_RINGS; i++) { - int j; - for (j = 0; j < N_RX_COMP_RINGS; j++) { - credits += cas_rx_ringN(cp, j, todo / N_RX_COMP_RINGS); - if (credits >= todo) { - enable_intr = 0; - goto rx_comp; - } - } - } - -rx_comp: - *budget -= credits; - dev->quota -= credits; - - /* final rx completion */ - spin_lock_irqsave(&cp->lock, flags); - if (status) - cas_handle_irq(dev, cp, status); - -#ifdef USE_PCI_INTB - if (N_RX_COMP_RINGS > 1) { - status = readl(cp->regs + REG_PLUS_INTRN_STATUS(1)); - if (status) - cas_handle_irq1(dev, cp, status); - } -#endif - -#ifdef USE_PCI_INTC - if (N_RX_COMP_RINGS > 2) { - status = readl(cp->regs + REG_PLUS_INTRN_STATUS(2)); - if (status) - cas_handle_irqN(dev, cp, status, 2); - } -#endif - -#ifdef USE_PCI_INTD - if (N_RX_COMP_RINGS > 3) { - status = readl(cp->regs + REG_PLUS_INTRN_STATUS(3)); - if (status) - cas_handle_irqN(dev, cp, status, 3); - } -#endif - spin_unlock_irqrestore(&cp->lock, flags); - if (enable_intr) { - netif_rx_complete(dev); - cas_unmask_intr(cp); - return 0; - } - return 1; -} -#endif - -#ifdef CONFIG_NET_POLL_CONTROLLER -static void cas_netpoll(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - - cas_disable_irq(cp, 0); - cas_interrupt(cp->pdev->irq, dev, NULL); - cas_enable_irq(cp, 0); - -#ifdef USE_PCI_INTB - if (N_RX_COMP_RINGS > 1) { - /* cas_interrupt1(); */ - } -#endif -#ifdef USE_PCI_INTC - if (N_RX_COMP_RINGS > 2) { - /* cas_interruptN(); */ - } -#endif -#ifdef USE_PCI_INTD - if (N_RX_COMP_RINGS > 3) { - /* cas_interruptN(); */ - } -#endif -} -#endif - -static void cas_tx_timeout(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - - printk(KERN_ERR "%s: transmit timed out, resetting\n", dev->name); - if (!cp->hw_running) { - printk("%s: hrm.. hw not running!\n", dev->name); - return; - } - - printk(KERN_ERR "%s: MIF_STATE[%08x]\n", - dev->name, readl(cp->regs + REG_MIF_STATE_MACHINE)); - - printk(KERN_ERR "%s: MAC_STATE[%08x]\n", - dev->name, readl(cp->regs + REG_MAC_STATE_MACHINE)); - - printk(KERN_ERR "%s: TX_STATE[%08x:%08x:%08x] " - "FIFO[%08x:%08x:%08x] SM1[%08x] SM2[%08x]\n", - dev->name, - readl(cp->regs + REG_TX_CFG), - readl(cp->regs + REG_MAC_TX_STATUS), - readl(cp->regs + REG_MAC_TX_CFG), - readl(cp->regs + REG_TX_FIFO_PKT_CNT), - readl(cp->regs + REG_TX_FIFO_WRITE_PTR), - readl(cp->regs + REG_TX_FIFO_READ_PTR), - readl(cp->regs + REG_TX_SM_1), - readl(cp->regs + REG_TX_SM_2)); - - printk(KERN_ERR "%s: RX_STATE[%08x:%08x:%08x]\n", - dev->name, - readl(cp->regs + REG_RX_CFG), - readl(cp->regs + REG_MAC_RX_STATUS), - readl(cp->regs + REG_MAC_RX_CFG)); - - printk(KERN_ERR "%s: HP_STATE[%08x:%08x:%08x:%08x]\n", - dev->name, - readl(cp->regs + REG_HP_STATE_MACHINE), - readl(cp->regs + REG_HP_STATUS0), - readl(cp->regs + REG_HP_STATUS1), - readl(cp->regs + REG_HP_STATUS2)); - -#if 1 - atomic_inc(&cp->reset_task_pending); - atomic_inc(&cp->reset_task_pending_all); - schedule_work(&cp->reset_task); -#else - atomic_set(&cp->reset_task_pending, CAS_RESET_ALL); - schedule_work(&cp->reset_task); -#endif -} - -static inline int cas_intme(int ring, int entry) -{ - /* Algorithm: IRQ every 1/2 of descriptors. */ - if (!(entry & ((TX_DESC_RINGN_SIZE(ring) >> 1) - 1))) - return 1; - return 0; -} - - -static void cas_write_txd(struct cas *cp, int ring, int entry, - dma_addr_t mapping, int len, u64 ctrl, int last) -{ - struct cas_tx_desc *txd = cp->init_txds[ring] + entry; - - ctrl |= CAS_BASE(TX_DESC_BUFLEN, len); - if (cas_intme(ring, entry)) - ctrl |= TX_DESC_INTME; - if (last) - ctrl |= TX_DESC_EOF; - txd->control = cpu_to_le64(ctrl); - txd->buffer = cpu_to_le64(mapping); -} - -static inline void *tx_tiny_buf(struct cas *cp, const int ring, - const int entry) -{ - return cp->tx_tiny_bufs[ring] + TX_TINY_BUF_LEN*entry; -} - -static inline dma_addr_t tx_tiny_map(struct cas *cp, const int ring, - const int entry, const int tentry) -{ - cp->tx_tiny_use[ring][tentry].nbufs++; - cp->tx_tiny_use[ring][entry].used = 1; - return cp->tx_tiny_dvma[ring] + TX_TINY_BUF_LEN*entry; -} - -static inline int cas_xmit_tx_ringN(struct cas *cp, int ring, - struct sk_buff *skb) -{ - struct net_device *dev = cp->dev; - int entry, nr_frags, frag, tabort, tentry; - dma_addr_t mapping; - unsigned long flags; - u64 ctrl; - u32 len; - - spin_lock_irqsave(&cp->tx_lock[ring], flags); - - /* This is a hard error, log it. */ - if (TX_BUFFS_AVAIL(cp, ring) <= - CAS_TABORT(cp)*(skb_shinfo(skb)->nr_frags + 1)) { - netif_stop_queue(dev); - spin_unlock_irqrestore(&cp->tx_lock[ring], flags); - printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " - "queue awake!\n", dev->name); - return 1; - } - - ctrl = 0; - if (skb->ip_summed == CHECKSUM_HW) { - u64 csum_start_off, csum_stuff_off; - - csum_start_off = (u64) (skb->h.raw - skb->data); - csum_stuff_off = (u64) ((skb->h.raw + skb->csum) - skb->data); - - ctrl = TX_DESC_CSUM_EN | - CAS_BASE(TX_DESC_CSUM_START, csum_start_off) | - CAS_BASE(TX_DESC_CSUM_STUFF, csum_stuff_off); - } - - entry = cp->tx_new[ring]; - cp->tx_skbs[ring][entry] = skb; - - nr_frags = skb_shinfo(skb)->nr_frags; - len = skb_headlen(skb); - mapping = pci_map_page(cp->pdev, virt_to_page(skb->data), - offset_in_page(skb->data), len, - PCI_DMA_TODEVICE); - - tentry = entry; - tabort = cas_calc_tabort(cp, (unsigned long) skb->data, len); - if (unlikely(tabort)) { - /* NOTE: len is always > tabort */ - cas_write_txd(cp, ring, entry, mapping, len - tabort, - ctrl | TX_DESC_SOF, 0); - entry = TX_DESC_NEXT(ring, entry); - - memcpy(tx_tiny_buf(cp, ring, entry), skb->data + - len - tabort, tabort); - mapping = tx_tiny_map(cp, ring, entry, tentry); - cas_write_txd(cp, ring, entry, mapping, tabort, ctrl, - (nr_frags == 0)); - } else { - cas_write_txd(cp, ring, entry, mapping, len, ctrl | - TX_DESC_SOF, (nr_frags == 0)); - } - entry = TX_DESC_NEXT(ring, entry); - - for (frag = 0; frag < nr_frags; frag++) { - skb_frag_t *fragp = &skb_shinfo(skb)->frags[frag]; - - len = fragp->size; - mapping = pci_map_page(cp->pdev, fragp->page, - fragp->page_offset, len, - PCI_DMA_TODEVICE); - - tabort = cas_calc_tabort(cp, fragp->page_offset, len); - if (unlikely(tabort)) { - void *addr; - - /* NOTE: len is always > tabort */ - cas_write_txd(cp, ring, entry, mapping, len - tabort, - ctrl, 0); - entry = TX_DESC_NEXT(ring, entry); - - addr = cas_page_map(fragp->page); - memcpy(tx_tiny_buf(cp, ring, entry), - addr + fragp->page_offset + len - tabort, - tabort); - cas_page_unmap(addr); - mapping = tx_tiny_map(cp, ring, entry, tentry); - len = tabort; - } - - cas_write_txd(cp, ring, entry, mapping, len, ctrl, - (frag + 1 == nr_frags)); - entry = TX_DESC_NEXT(ring, entry); - } - - cp->tx_new[ring] = entry; - if (TX_BUFFS_AVAIL(cp, ring) <= CAS_TABORT(cp)*(MAX_SKB_FRAGS + 1)) - netif_stop_queue(dev); - - if (netif_msg_tx_queued(cp)) - printk(KERN_DEBUG "%s: tx[%d] queued, slot %d, skblen %d, " - "avail %d\n", - dev->name, ring, entry, skb->len, - TX_BUFFS_AVAIL(cp, ring)); - writel(entry, cp->regs + REG_TX_KICKN(ring)); - spin_unlock_irqrestore(&cp->tx_lock[ring], flags); - return 0; -} - -static int cas_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - - /* this is only used as a load-balancing hint, so it doesn't - * need to be SMP safe - */ - static int ring; - - skb = skb_padto(skb, cp->min_frame_size); - if (!skb) - return 0; - - /* XXX: we need some higher-level QoS hooks to steer packets to - * individual queues. - */ - if (cas_xmit_tx_ringN(cp, ring++ & N_TX_RINGS_MASK, skb)) - return 1; - dev->trans_start = jiffies; - return 0; -} - -static void cas_init_tx_dma(struct cas *cp) -{ - u64 desc_dma = cp->block_dvma; - unsigned long off; - u32 val; - int i; - - /* set up tx completion writeback registers. must be 8-byte aligned */ -#ifdef USE_TX_COMPWB - off = offsetof(struct cas_init_block, tx_compwb); - writel((desc_dma + off) >> 32, cp->regs + REG_TX_COMPWB_DB_HI); - writel((desc_dma + off) & 0xffffffff, cp->regs + REG_TX_COMPWB_DB_LOW); -#endif - - /* enable completion writebacks, enable paced mode, - * disable read pipe, and disable pre-interrupt compwbs - */ - val = TX_CFG_COMPWB_Q1 | TX_CFG_COMPWB_Q2 | - TX_CFG_COMPWB_Q3 | TX_CFG_COMPWB_Q4 | - TX_CFG_DMA_RDPIPE_DIS | TX_CFG_PACED_MODE | - TX_CFG_INTR_COMPWB_DIS; - - /* write out tx ring info and tx desc bases */ - for (i = 0; i < MAX_TX_RINGS; i++) { - off = (unsigned long) cp->init_txds[i] - - (unsigned long) cp->init_block; - - val |= CAS_TX_RINGN_BASE(i); - writel((desc_dma + off) >> 32, cp->regs + REG_TX_DBN_HI(i)); - writel((desc_dma + off) & 0xffffffff, cp->regs + - REG_TX_DBN_LOW(i)); - /* don't zero out the kick register here as the system - * will wedge - */ - } - writel(val, cp->regs + REG_TX_CFG); - - /* program max burst sizes. these numbers should be different - * if doing QoS. - */ -#ifdef USE_QOS - writel(0x800, cp->regs + REG_TX_MAXBURST_0); - writel(0x1600, cp->regs + REG_TX_MAXBURST_1); - writel(0x2400, cp->regs + REG_TX_MAXBURST_2); - writel(0x4800, cp->regs + REG_TX_MAXBURST_3); -#else - writel(0x800, cp->regs + REG_TX_MAXBURST_0); - writel(0x800, cp->regs + REG_TX_MAXBURST_1); - writel(0x800, cp->regs + REG_TX_MAXBURST_2); - writel(0x800, cp->regs + REG_TX_MAXBURST_3); -#endif -} - -/* Must be invoked under cp->lock. */ -static inline void cas_init_dma(struct cas *cp) -{ - cas_init_tx_dma(cp); - cas_init_rx_dma(cp); -} - -/* Must be invoked under cp->lock. */ -static u32 cas_setup_multicast(struct cas *cp) -{ - u32 rxcfg = 0; - int i; - - if (cp->dev->flags & IFF_PROMISC) { - rxcfg |= MAC_RX_CFG_PROMISC_EN; - - } else if (cp->dev->flags & IFF_ALLMULTI) { - for (i=0; i < 16; i++) - writel(0xFFFF, cp->regs + REG_MAC_HASH_TABLEN(i)); - rxcfg |= MAC_RX_CFG_HASH_FILTER_EN; - - } else { - u16 hash_table[16]; - u32 crc; - struct dev_mc_list *dmi = cp->dev->mc_list; - int i; - - /* use the alternate mac address registers for the - * first 15 multicast addresses - */ - for (i = 1; i <= CAS_MC_EXACT_MATCH_SIZE; i++) { - if (!dmi) { - writel(0x0, cp->regs + REG_MAC_ADDRN(i*3 + 0)); - writel(0x0, cp->regs + REG_MAC_ADDRN(i*3 + 1)); - writel(0x0, cp->regs + REG_MAC_ADDRN(i*3 + 2)); - continue; - } - writel((dmi->dmi_addr[4] << 8) | dmi->dmi_addr[5], - cp->regs + REG_MAC_ADDRN(i*3 + 0)); - writel((dmi->dmi_addr[2] << 8) | dmi->dmi_addr[3], - cp->regs + REG_MAC_ADDRN(i*3 + 1)); - writel((dmi->dmi_addr[0] << 8) | dmi->dmi_addr[1], - cp->regs + REG_MAC_ADDRN(i*3 + 2)); - dmi = dmi->next; - } - - /* use hw hash table for the next series of - * multicast addresses - */ - memset(hash_table, 0, sizeof(hash_table)); - while (dmi) { - crc = ether_crc_le(ETH_ALEN, dmi->dmi_addr); - crc >>= 24; - hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf)); - dmi = dmi->next; - } - for (i=0; i < 16; i++) - writel(hash_table[i], cp->regs + - REG_MAC_HASH_TABLEN(i)); - rxcfg |= MAC_RX_CFG_HASH_FILTER_EN; - } - - return rxcfg; -} - -/* must be invoked under cp->stat_lock[N_TX_RINGS] */ -static void cas_clear_mac_err(struct cas *cp) -{ - writel(0, cp->regs + REG_MAC_COLL_NORMAL); - writel(0, cp->regs + REG_MAC_COLL_FIRST); - writel(0, cp->regs + REG_MAC_COLL_EXCESS); - writel(0, cp->regs + REG_MAC_COLL_LATE); - writel(0, cp->regs + REG_MAC_TIMER_DEFER); - writel(0, cp->regs + REG_MAC_ATTEMPTS_PEAK); - writel(0, cp->regs + REG_MAC_RECV_FRAME); - writel(0, cp->regs + REG_MAC_LEN_ERR); - writel(0, cp->regs + REG_MAC_ALIGN_ERR); - writel(0, cp->regs + REG_MAC_FCS_ERR); - writel(0, cp->regs + REG_MAC_RX_CODE_ERR); -} - - -static void cas_mac_reset(struct cas *cp) -{ - int i; - - /* do both TX and RX reset */ - writel(0x1, cp->regs + REG_MAC_TX_RESET); - writel(0x1, cp->regs + REG_MAC_RX_RESET); - - /* wait for TX */ - i = STOP_TRIES; - while (i-- > 0) { - if (readl(cp->regs + REG_MAC_TX_RESET) == 0) - break; - udelay(10); - } - - /* wait for RX */ - i = STOP_TRIES; - while (i-- > 0) { - if (readl(cp->regs + REG_MAC_RX_RESET) == 0) - break; - udelay(10); - } - - if (readl(cp->regs + REG_MAC_TX_RESET) | - readl(cp->regs + REG_MAC_RX_RESET)) - printk(KERN_ERR "%s: mac tx[%d]/rx[%d] reset failed [%08x]\n", - cp->dev->name, readl(cp->regs + REG_MAC_TX_RESET), - readl(cp->regs + REG_MAC_RX_RESET), - readl(cp->regs + REG_MAC_STATE_MACHINE)); -} - - -/* Must be invoked under cp->lock. */ -static void cas_init_mac(struct cas *cp) -{ - unsigned char *e = &cp->dev->dev_addr[0]; - int i; -#ifdef CONFIG_CASSINI_MULTICAST_REG_WRITE - u32 rxcfg; -#endif - cas_mac_reset(cp); - - /* setup core arbitration weight register */ - writel(CAWR_RR_DIS, cp->regs + REG_CAWR); - - /* XXX Use pci_dma_burst_advice() */ -#if !defined(CONFIG_SPARC64) && !defined(CONFIG_ALPHA) - /* set the infinite burst register for chips that don't have - * pci issues. - */ - if ((cp->cas_flags & CAS_FLAG_TARGET_ABORT) == 0) - writel(INF_BURST_EN, cp->regs + REG_INF_BURST); -#endif - - writel(0x1BF0, cp->regs + REG_MAC_SEND_PAUSE); - - writel(0x00, cp->regs + REG_MAC_IPG0); - writel(0x08, cp->regs + REG_MAC_IPG1); - writel(0x04, cp->regs + REG_MAC_IPG2); - - /* change later for 802.3z */ - writel(0x40, cp->regs + REG_MAC_SLOT_TIME); - - /* min frame + FCS */ - writel(ETH_ZLEN + 4, cp->regs + REG_MAC_FRAMESIZE_MIN); - - /* Ethernet payload + header + FCS + optional VLAN tag. NOTE: we - * specify the maximum frame size to prevent RX tag errors on - * oversized frames. - */ - writel(CAS_BASE(MAC_FRAMESIZE_MAX_BURST, 0x2000) | - CAS_BASE(MAC_FRAMESIZE_MAX_FRAME, - (CAS_MAX_MTU + ETH_HLEN + 4 + 4)), - cp->regs + REG_MAC_FRAMESIZE_MAX); - - /* NOTE: crc_size is used as a surrogate for half-duplex. - * workaround saturn half-duplex issue by increasing preamble - * size to 65 bytes. - */ - if ((cp->cas_flags & CAS_FLAG_SATURN) && cp->crc_size) - writel(0x41, cp->regs + REG_MAC_PA_SIZE); - else - writel(0x07, cp->regs + REG_MAC_PA_SIZE); - writel(0x04, cp->regs + REG_MAC_JAM_SIZE); - writel(0x10, cp->regs + REG_MAC_ATTEMPT_LIMIT); - writel(0x8808, cp->regs + REG_MAC_CTRL_TYPE); - - writel((e[5] | (e[4] << 8)) & 0x3ff, cp->regs + REG_MAC_RANDOM_SEED); - - writel(0, cp->regs + REG_MAC_ADDR_FILTER0); - writel(0, cp->regs + REG_MAC_ADDR_FILTER1); - writel(0, cp->regs + REG_MAC_ADDR_FILTER2); - writel(0, cp->regs + REG_MAC_ADDR_FILTER2_1_MASK); - writel(0, cp->regs + REG_MAC_ADDR_FILTER0_MASK); - - /* setup mac address in perfect filter array */ - for (i = 0; i < 45; i++) - writel(0x0, cp->regs + REG_MAC_ADDRN(i)); - - writel((e[4] << 8) | e[5], cp->regs + REG_MAC_ADDRN(0)); - writel((e[2] << 8) | e[3], cp->regs + REG_MAC_ADDRN(1)); - writel((e[0] << 8) | e[1], cp->regs + REG_MAC_ADDRN(2)); - - writel(0x0001, cp->regs + REG_MAC_ADDRN(42)); - writel(0xc200, cp->regs + REG_MAC_ADDRN(43)); - writel(0x0180, cp->regs + REG_MAC_ADDRN(44)); - -#ifndef CONFIG_CASSINI_MULTICAST_REG_WRITE - cp->mac_rx_cfg = cas_setup_multicast(cp); -#else - /* WTZ: Do what Adrian did in cas_set_multicast. Doing - * a writel does not seem to be necessary because Cassini - * seems to preserve the configuration when we do the reset. - * If the chip is in trouble, though, it is not clear if we - * can really count on this behavior. cas_set_multicast uses - * spin_lock_irqsave, but we are called only in cas_init_hw and - * cas_init_hw is protected by cas_lock_all, which calls - * spin_lock_irq (so it doesn't need to save the flags, and - * we should be OK for the writel, as that is the only - * difference). - */ - cp->mac_rx_cfg = rxcfg = cas_setup_multicast(cp); - writel(rxcfg, cp->regs + REG_MAC_RX_CFG); -#endif - spin_lock(&cp->stat_lock[N_TX_RINGS]); - cas_clear_mac_err(cp); - spin_unlock(&cp->stat_lock[N_TX_RINGS]); - - /* Setup MAC interrupts. We want to get all of the interesting - * counter expiration events, but we do not want to hear about - * normal rx/tx as the DMA engine tells us that. - */ - writel(MAC_TX_FRAME_XMIT, cp->regs + REG_MAC_TX_MASK); - writel(MAC_RX_FRAME_RECV, cp->regs + REG_MAC_RX_MASK); - - /* Don't enable even the PAUSE interrupts for now, we - * make no use of those events other than to record them. - */ - writel(0xffffffff, cp->regs + REG_MAC_CTRL_MASK); -} - -/* Must be invoked under cp->lock. */ -static void cas_init_pause_thresholds(struct cas *cp) -{ - /* Calculate pause thresholds. Setting the OFF threshold to the - * full RX fifo size effectively disables PAUSE generation - */ - if (cp->rx_fifo_size <= (2 * 1024)) { - cp->rx_pause_off = cp->rx_pause_on = cp->rx_fifo_size; - } else { - int max_frame = (cp->dev->mtu + ETH_HLEN + 4 + 4 + 64) & ~63; - if (max_frame * 3 > cp->rx_fifo_size) { - cp->rx_pause_off = 7104; - cp->rx_pause_on = 960; - } else { - int off = (cp->rx_fifo_size - (max_frame * 2)); - int on = off - max_frame; - cp->rx_pause_off = off; - cp->rx_pause_on = on; - } - } -} - -static int cas_vpd_match(const void __iomem *p, const char *str) -{ - int len = strlen(str) + 1; - int i; - - for (i = 0; i < len; i++) { - if (readb(p + i) != str[i]) - return 0; - } - return 1; -} - - -/* get the mac address by reading the vpd information in the rom. - * also get the phy type and determine if there's an entropy generator. - * NOTE: this is a bit convoluted for the following reasons: - * 1) vpd info has order-dependent mac addresses for multinic cards - * 2) the only way to determine the nic order is to use the slot - * number. - * 3) fiber cards don't have bridges, so their slot numbers don't - * mean anything. - * 4) we don't actually know we have a fiber card until after - * the mac addresses are parsed. - */ -static int cas_get_vpd_info(struct cas *cp, unsigned char *dev_addr, - const int offset) -{ - void __iomem *p = cp->regs + REG_EXPANSION_ROM_RUN_START; - void __iomem *base, *kstart; - int i, len; - int found = 0; -#define VPD_FOUND_MAC 0x01 -#define VPD_FOUND_PHY 0x02 - - int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */ - int mac_off = 0; - - /* give us access to the PROM */ - writel(BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_PAD, - cp->regs + REG_BIM_LOCAL_DEV_EN); - - /* check for an expansion rom */ - if (readb(p) != 0x55 || readb(p + 1) != 0xaa) - goto use_random_mac_addr; - - /* search for beginning of vpd */ - base = NULL; - for (i = 2; i < EXPANSION_ROM_SIZE; i++) { - /* check for PCIR */ - if ((readb(p + i + 0) == 0x50) && - (readb(p + i + 1) == 0x43) && - (readb(p + i + 2) == 0x49) && - (readb(p + i + 3) == 0x52)) { - base = p + (readb(p + i + 8) | - (readb(p + i + 9) << 8)); - break; - } - } - - if (!base || (readb(base) != 0x82)) - goto use_random_mac_addr; - - i = (readb(base + 1) | (readb(base + 2) << 8)) + 3; - while (i < EXPANSION_ROM_SIZE) { - if (readb(base + i) != 0x90) /* no vpd found */ - goto use_random_mac_addr; - - /* found a vpd field */ - len = readb(base + i + 1) | (readb(base + i + 2) << 8); - - /* extract keywords */ - kstart = base + i + 3; - p = kstart; - while ((p - kstart) < len) { - int klen = readb(p + 2); - int j; - char type; - - p += 3; - - /* look for the following things: - * -- correct length == 29 - * 3 (type) + 2 (size) + - * 18 (strlen("local-mac-address") + 1) + - * 6 (mac addr) - * -- VPD Instance 'I' - * -- VPD Type Bytes 'B' - * -- VPD data length == 6 - * -- property string == local-mac-address - * - * -- correct length == 24 - * 3 (type) + 2 (size) + - * 12 (strlen("entropy-dev") + 1) + - * 7 (strlen("vms110") + 1) - * -- VPD Instance 'I' - * -- VPD Type String 'B' - * -- VPD data length == 7 - * -- property string == entropy-dev - * - * -- correct length == 18 - * 3 (type) + 2 (size) + - * 9 (strlen("phy-type") + 1) + - * 4 (strlen("pcs") + 1) - * -- VPD Instance 'I' - * -- VPD Type String 'S' - * -- VPD data length == 4 - * -- property string == phy-type - * - * -- correct length == 23 - * 3 (type) + 2 (size) + - * 14 (strlen("phy-interface") + 1) + - * 4 (strlen("pcs") + 1) - * -- VPD Instance 'I' - * -- VPD Type String 'S' - * -- VPD data length == 4 - * -- property string == phy-interface - */ - if (readb(p) != 'I') - goto next; - - /* finally, check string and length */ - type = readb(p + 3); - if (type == 'B') { - if ((klen == 29) && readb(p + 4) == 6 && - cas_vpd_match(p + 5, - "local-mac-address")) { - if (mac_off++ > offset) - goto next; - - /* set mac address */ - for (j = 0; j < 6; j++) - dev_addr[j] = - readb(p + 23 + j); - goto found_mac; - } - } - - if (type != 'S') - goto next; - -#ifdef USE_ENTROPY_DEV - if ((klen == 24) && - cas_vpd_match(p + 5, "entropy-dev") && - cas_vpd_match(p + 17, "vms110")) { - cp->cas_flags |= CAS_FLAG_ENTROPY_DEV; - goto next; - } -#endif - - if (found & VPD_FOUND_PHY) - goto next; - - if ((klen == 18) && readb(p + 4) == 4 && - cas_vpd_match(p + 5, "phy-type")) { - if (cas_vpd_match(p + 14, "pcs")) { - phy_type = CAS_PHY_SERDES; - goto found_phy; - } - } - - if ((klen == 23) && readb(p + 4) == 4 && - cas_vpd_match(p + 5, "phy-interface")) { - if (cas_vpd_match(p + 19, "pcs")) { - phy_type = CAS_PHY_SERDES; - goto found_phy; - } - } -found_mac: - found |= VPD_FOUND_MAC; - goto next; - -found_phy: - found |= VPD_FOUND_PHY; - -next: - p += klen; - } - i += len + 3; - } - -use_random_mac_addr: - if (found & VPD_FOUND_MAC) - goto done; - - /* Sun MAC prefix then 3 random bytes. */ - printk(PFX "MAC address not found in ROM VPD\n"); - dev_addr[0] = 0x08; - dev_addr[1] = 0x00; - dev_addr[2] = 0x20; - get_random_bytes(dev_addr + 3, 3); - -done: - writel(0, cp->regs + REG_BIM_LOCAL_DEV_EN); - return phy_type; -} - -/* check pci invariants */ -static void cas_check_pci_invariants(struct cas *cp) -{ - struct pci_dev *pdev = cp->pdev; - u8 rev; - - cp->cas_flags = 0; - pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); - if ((pdev->vendor == PCI_VENDOR_ID_SUN) && - (pdev->device == PCI_DEVICE_ID_SUN_CASSINI)) { - if (rev >= CAS_ID_REVPLUS) - cp->cas_flags |= CAS_FLAG_REG_PLUS; - if (rev < CAS_ID_REVPLUS02u) - cp->cas_flags |= CAS_FLAG_TARGET_ABORT; - - /* Original Cassini supports HW CSUM, but it's not - * enabled by default as it can trigger TX hangs. - */ - if (rev < CAS_ID_REV2) - cp->cas_flags |= CAS_FLAG_NO_HW_CSUM; - } else { - /* Only sun has original cassini chips. */ - cp->cas_flags |= CAS_FLAG_REG_PLUS; - - /* We use a flag because the same phy might be externally - * connected. - */ - if ((pdev->vendor == PCI_VENDOR_ID_NS) && - (pdev->device == PCI_DEVICE_ID_NS_SATURN)) - cp->cas_flags |= CAS_FLAG_SATURN; - } -} - - -static int cas_check_invariants(struct cas *cp) -{ - struct pci_dev *pdev = cp->pdev; - u32 cfg; - int i; - - /* get page size for rx buffers. */ - cp->page_order = 0; -#ifdef USE_PAGE_ORDER - if (PAGE_SHIFT < CAS_JUMBO_PAGE_SHIFT) { - /* see if we can allocate larger pages */ - struct page *page = alloc_pages(GFP_ATOMIC, - CAS_JUMBO_PAGE_SHIFT - - PAGE_SHIFT); - if (page) { - __free_pages(page, CAS_JUMBO_PAGE_SHIFT - PAGE_SHIFT); - cp->page_order = CAS_JUMBO_PAGE_SHIFT - PAGE_SHIFT; - } else { - printk(PFX "MTU limited to %d bytes\n", CAS_MAX_MTU); - } - } -#endif - cp->page_size = (PAGE_SIZE << cp->page_order); - - /* Fetch the FIFO configurations. */ - cp->tx_fifo_size = readl(cp->regs + REG_TX_FIFO_SIZE) * 64; - cp->rx_fifo_size = RX_FIFO_SIZE; - - /* finish phy determination. MDIO1 takes precedence over MDIO0 if - * they're both connected. - */ - cp->phy_type = cas_get_vpd_info(cp, cp->dev->dev_addr, - PCI_SLOT(pdev->devfn)); - if (cp->phy_type & CAS_PHY_SERDES) { - cp->cas_flags |= CAS_FLAG_1000MB_CAP; - return 0; /* no more checking needed */ - } - - /* MII */ - cfg = readl(cp->regs + REG_MIF_CFG); - if (cfg & MIF_CFG_MDIO_1) { - cp->phy_type = CAS_PHY_MII_MDIO1; - } else if (cfg & MIF_CFG_MDIO_0) { - cp->phy_type = CAS_PHY_MII_MDIO0; - } - - cas_mif_poll(cp, 0); - writel(PCS_DATAPATH_MODE_MII, cp->regs + REG_PCS_DATAPATH_MODE); - - for (i = 0; i < 32; i++) { - u32 phy_id; - int j; - - for (j = 0; j < 3; j++) { - cp->phy_addr = i; - phy_id = cas_phy_read(cp, MII_PHYSID1) << 16; - phy_id |= cas_phy_read(cp, MII_PHYSID2); - if (phy_id && (phy_id != 0xFFFFFFFF)) { - cp->phy_id = phy_id; - goto done; - } - } - } - printk(KERN_ERR PFX "MII phy did not respond [%08x]\n", - readl(cp->regs + REG_MIF_STATE_MACHINE)); - return -1; - -done: - /* see if we can do gigabit */ - cfg = cas_phy_read(cp, MII_BMSR); - if ((cfg & CAS_BMSR_1000_EXTEND) && - cas_phy_read(cp, CAS_MII_1000_EXTEND)) - cp->cas_flags |= CAS_FLAG_1000MB_CAP; - return 0; -} - -/* Must be invoked under cp->lock. */ -static inline void cas_start_dma(struct cas *cp) -{ - int i; - u32 val; - int txfailed = 0; - - /* enable dma */ - val = readl(cp->regs + REG_TX_CFG) | TX_CFG_DMA_EN; - writel(val, cp->regs + REG_TX_CFG); - val = readl(cp->regs + REG_RX_CFG) | RX_CFG_DMA_EN; - writel(val, cp->regs + REG_RX_CFG); - - /* enable the mac */ - val = readl(cp->regs + REG_MAC_TX_CFG) | MAC_TX_CFG_EN; - writel(val, cp->regs + REG_MAC_TX_CFG); - val = readl(cp->regs + REG_MAC_RX_CFG) | MAC_RX_CFG_EN; - writel(val, cp->regs + REG_MAC_RX_CFG); - - i = STOP_TRIES; - while (i-- > 0) { - val = readl(cp->regs + REG_MAC_TX_CFG); - if ((val & MAC_TX_CFG_EN)) - break; - udelay(10); - } - if (i < 0) txfailed = 1; - i = STOP_TRIES; - while (i-- > 0) { - val = readl(cp->regs + REG_MAC_RX_CFG); - if ((val & MAC_RX_CFG_EN)) { - if (txfailed) { - printk(KERN_ERR - "%s: enabling mac failed [tx:%08x:%08x].\n", - cp->dev->name, - readl(cp->regs + REG_MIF_STATE_MACHINE), - readl(cp->regs + REG_MAC_STATE_MACHINE)); - } - goto enable_rx_done; - } - udelay(10); - } - printk(KERN_ERR "%s: enabling mac failed [%s:%08x:%08x].\n", - cp->dev->name, - (txfailed? "tx,rx":"rx"), - readl(cp->regs + REG_MIF_STATE_MACHINE), - readl(cp->regs + REG_MAC_STATE_MACHINE)); - -enable_rx_done: - cas_unmask_intr(cp); /* enable interrupts */ - writel(RX_DESC_RINGN_SIZE(0) - 4, cp->regs + REG_RX_KICK); - writel(0, cp->regs + REG_RX_COMP_TAIL); - - if (cp->cas_flags & CAS_FLAG_REG_PLUS) { - if (N_RX_DESC_RINGS > 1) - writel(RX_DESC_RINGN_SIZE(1) - 4, - cp->regs + REG_PLUS_RX_KICK1); - - for (i = 1; i < N_RX_COMP_RINGS; i++) - writel(0, cp->regs + REG_PLUS_RX_COMPN_TAIL(i)); - } -} - -/* Must be invoked under cp->lock. */ -static void cas_read_pcs_link_mode(struct cas *cp, int *fd, int *spd, - int *pause) -{ - u32 val = readl(cp->regs + REG_PCS_MII_LPA); - *fd = (val & PCS_MII_LPA_FD) ? 1 : 0; - *pause = (val & PCS_MII_LPA_SYM_PAUSE) ? 0x01 : 0x00; - if (val & PCS_MII_LPA_ASYM_PAUSE) - *pause |= 0x10; - *spd = 1000; -} - -/* Must be invoked under cp->lock. */ -static void cas_read_mii_link_mode(struct cas *cp, int *fd, int *spd, - int *pause) -{ - u32 val; - - *fd = 0; - *spd = 10; - *pause = 0; - - /* use GMII registers */ - val = cas_phy_read(cp, MII_LPA); - if (val & CAS_LPA_PAUSE) - *pause = 0x01; - - if (val & CAS_LPA_ASYM_PAUSE) - *pause |= 0x10; - - if (val & LPA_DUPLEX) - *fd = 1; - if (val & LPA_100) - *spd = 100; - - if (cp->cas_flags & CAS_FLAG_1000MB_CAP) { - val = cas_phy_read(cp, CAS_MII_1000_STATUS); - if (val & (CAS_LPA_1000FULL | CAS_LPA_1000HALF)) - *spd = 1000; - if (val & CAS_LPA_1000FULL) - *fd = 1; - } -} - -/* A link-up condition has occurred, initialize and enable the - * rest of the chip. - * - * Must be invoked under cp->lock. - */ -static void cas_set_link_modes(struct cas *cp) -{ - u32 val; - int full_duplex, speed, pause; - - full_duplex = 0; - speed = 10; - pause = 0; - - if (CAS_PHY_MII(cp->phy_type)) { - cas_mif_poll(cp, 0); - val = cas_phy_read(cp, MII_BMCR); - if (val & BMCR_ANENABLE) { - cas_read_mii_link_mode(cp, &full_duplex, &speed, - &pause); - } else { - if (val & BMCR_FULLDPLX) - full_duplex = 1; - - if (val & BMCR_SPEED100) - speed = 100; - else if (val & CAS_BMCR_SPEED1000) - speed = (cp->cas_flags & CAS_FLAG_1000MB_CAP) ? - 1000 : 100; - } - cas_mif_poll(cp, 1); - - } else { - val = readl(cp->regs + REG_PCS_MII_CTRL); - cas_read_pcs_link_mode(cp, &full_duplex, &speed, &pause); - if ((val & PCS_MII_AUTONEG_EN) == 0) { - if (val & PCS_MII_CTRL_DUPLEX) - full_duplex = 1; - } - } - - if (netif_msg_link(cp)) - printk(KERN_INFO "%s: Link up at %d Mbps, %s-duplex.\n", - cp->dev->name, speed, (full_duplex ? "full" : "half")); - - val = MAC_XIF_TX_MII_OUTPUT_EN | MAC_XIF_LINK_LED; - if (CAS_PHY_MII(cp->phy_type)) { - val |= MAC_XIF_MII_BUFFER_OUTPUT_EN; - if (!full_duplex) - val |= MAC_XIF_DISABLE_ECHO; - } - if (full_duplex) - val |= MAC_XIF_FDPLX_LED; - if (speed == 1000) - val |= MAC_XIF_GMII_MODE; - writel(val, cp->regs + REG_MAC_XIF_CFG); - - /* deal with carrier and collision detect. */ - val = MAC_TX_CFG_IPG_EN; - if (full_duplex) { - val |= MAC_TX_CFG_IGNORE_CARRIER; - val |= MAC_TX_CFG_IGNORE_COLL; - } else { -#ifndef USE_CSMA_CD_PROTO - val |= MAC_TX_CFG_NEVER_GIVE_UP_EN; - val |= MAC_TX_CFG_NEVER_GIVE_UP_LIM; -#endif - } - /* val now set up for REG_MAC_TX_CFG */ - - /* If gigabit and half-duplex, enable carrier extension - * mode. increase slot time to 512 bytes as well. - * else, disable it and make sure slot time is 64 bytes. - * also activate checksum bug workaround - */ - if ((speed == 1000) && !full_duplex) { - writel(val | MAC_TX_CFG_CARRIER_EXTEND, - cp->regs + REG_MAC_TX_CFG); - - val = readl(cp->regs + REG_MAC_RX_CFG); - val &= ~MAC_RX_CFG_STRIP_FCS; /* checksum workaround */ - writel(val | MAC_RX_CFG_CARRIER_EXTEND, - cp->regs + REG_MAC_RX_CFG); - - writel(0x200, cp->regs + REG_MAC_SLOT_TIME); - - cp->crc_size = 4; - /* minimum size gigabit frame at half duplex */ - cp->min_frame_size = CAS_1000MB_MIN_FRAME; - - } else { - writel(val, cp->regs + REG_MAC_TX_CFG); - - /* checksum bug workaround. don't strip FCS when in - * half-duplex mode - */ - val = readl(cp->regs + REG_MAC_RX_CFG); - if (full_duplex) { - val |= MAC_RX_CFG_STRIP_FCS; - cp->crc_size = 0; - cp->min_frame_size = CAS_MIN_MTU; - } else { - val &= ~MAC_RX_CFG_STRIP_FCS; - cp->crc_size = 4; - cp->min_frame_size = CAS_MIN_FRAME; - } - writel(val & ~MAC_RX_CFG_CARRIER_EXTEND, - cp->regs + REG_MAC_RX_CFG); - writel(0x40, cp->regs + REG_MAC_SLOT_TIME); - } - - if (netif_msg_link(cp)) { - if (pause & 0x01) { - printk(KERN_INFO "%s: Pause is enabled " - "(rxfifo: %d off: %d on: %d)\n", - cp->dev->name, - cp->rx_fifo_size, - cp->rx_pause_off, - cp->rx_pause_on); - } else if (pause & 0x10) { - printk(KERN_INFO "%s: TX pause enabled\n", - cp->dev->name); - } else { - printk(KERN_INFO "%s: Pause is disabled\n", - cp->dev->name); - } - } - - val = readl(cp->regs + REG_MAC_CTRL_CFG); - val &= ~(MAC_CTRL_CFG_SEND_PAUSE_EN | MAC_CTRL_CFG_RECV_PAUSE_EN); - if (pause) { /* symmetric or asymmetric pause */ - val |= MAC_CTRL_CFG_SEND_PAUSE_EN; - if (pause & 0x01) { /* symmetric pause */ - val |= MAC_CTRL_CFG_RECV_PAUSE_EN; - } - } - writel(val, cp->regs + REG_MAC_CTRL_CFG); - cas_start_dma(cp); -} - -/* Must be invoked under cp->lock. */ -static void cas_init_hw(struct cas *cp, int restart_link) -{ - if (restart_link) - cas_phy_init(cp); - - cas_init_pause_thresholds(cp); - cas_init_mac(cp); - cas_init_dma(cp); - - if (restart_link) { - /* Default aneg parameters */ - cp->timer_ticks = 0; - cas_begin_auto_negotiation(cp, NULL); - } else if (cp->lstate == link_up) { - cas_set_link_modes(cp); - netif_carrier_on(cp->dev); - } -} - -/* Must be invoked under cp->lock. on earlier cassini boards, - * SOFT_0 is tied to PCI reset. we use this to force a pci reset, - * let it settle out, and then restore pci state. - */ -static void cas_hard_reset(struct cas *cp) -{ - writel(BIM_LOCAL_DEV_SOFT_0, cp->regs + REG_BIM_LOCAL_DEV_EN); - udelay(20); - pci_restore_state(cp->pdev); -} - - -static void cas_global_reset(struct cas *cp, int blkflag) -{ - int limit; - - /* issue a global reset. don't use RSTOUT. */ - if (blkflag && !CAS_PHY_MII(cp->phy_type)) { - /* For PCS, when the blkflag is set, we should set the - * SW_REST_BLOCK_PCS_SLINK bit to prevent the results of - * the last autonegotiation from being cleared. We'll - * need some special handling if the chip is set into a - * loopback mode. - */ - writel((SW_RESET_TX | SW_RESET_RX | SW_RESET_BLOCK_PCS_SLINK), - cp->regs + REG_SW_RESET); - } else { - writel(SW_RESET_TX | SW_RESET_RX, cp->regs + REG_SW_RESET); - } - - /* need to wait at least 3ms before polling register */ - mdelay(3); - - limit = STOP_TRIES; - while (limit-- > 0) { - u32 val = readl(cp->regs + REG_SW_RESET); - if ((val & (SW_RESET_TX | SW_RESET_RX)) == 0) - goto done; - udelay(10); - } - printk(KERN_ERR "%s: sw reset failed.\n", cp->dev->name); - -done: - /* enable various BIM interrupts */ - writel(BIM_CFG_DPAR_INTR_ENABLE | BIM_CFG_RMA_INTR_ENABLE | - BIM_CFG_RTA_INTR_ENABLE, cp->regs + REG_BIM_CFG); - - /* clear out pci error status mask for handled errors. - * we don't deal with DMA counter overflows as they happen - * all the time. - */ - writel(0xFFFFFFFFU & ~(PCI_ERR_BADACK | PCI_ERR_DTRTO | - PCI_ERR_OTHER | PCI_ERR_BIM_DMA_WRITE | - PCI_ERR_BIM_DMA_READ), cp->regs + - REG_PCI_ERR_STATUS_MASK); - - /* set up for MII by default to address mac rx reset timeout - * issue - */ - writel(PCS_DATAPATH_MODE_MII, cp->regs + REG_PCS_DATAPATH_MODE); -} - -static void cas_reset(struct cas *cp, int blkflag) -{ - u32 val; - - cas_mask_intr(cp); - cas_global_reset(cp, blkflag); - cas_mac_reset(cp); - cas_entropy_reset(cp); - - /* disable dma engines. */ - val = readl(cp->regs + REG_TX_CFG); - val &= ~TX_CFG_DMA_EN; - writel(val, cp->regs + REG_TX_CFG); - - val = readl(cp->regs + REG_RX_CFG); - val &= ~RX_CFG_DMA_EN; - writel(val, cp->regs + REG_RX_CFG); - - /* program header parser */ - if ((cp->cas_flags & CAS_FLAG_TARGET_ABORT) || - (CAS_HP_ALT_FIRMWARE == cas_prog_null)) { - cas_load_firmware(cp, CAS_HP_FIRMWARE); - } else { - cas_load_firmware(cp, CAS_HP_ALT_FIRMWARE); - } - - /* clear out error registers */ - spin_lock(&cp->stat_lock[N_TX_RINGS]); - cas_clear_mac_err(cp); - spin_unlock(&cp->stat_lock[N_TX_RINGS]); -} - -/* Shut down the chip, must be called with pm_sem held. */ -static void cas_shutdown(struct cas *cp) -{ - unsigned long flags; - - /* Make us not-running to avoid timers respawning */ - cp->hw_running = 0; - - del_timer_sync(&cp->link_timer); - - /* Stop the reset task */ -#if 0 - while (atomic_read(&cp->reset_task_pending_mtu) || - atomic_read(&cp->reset_task_pending_spare) || - atomic_read(&cp->reset_task_pending_all)) - schedule(); - -#else - while (atomic_read(&cp->reset_task_pending)) - schedule(); -#endif - /* Actually stop the chip */ - cas_lock_all_save(cp, flags); - cas_reset(cp, 0); - if (cp->cas_flags & CAS_FLAG_SATURN) - cas_phy_powerdown(cp); - cas_unlock_all_restore(cp, flags); -} - -static int cas_change_mtu(struct net_device *dev, int new_mtu) -{ - struct cas *cp = netdev_priv(dev); - - if (new_mtu < CAS_MIN_MTU || new_mtu > CAS_MAX_MTU) - return -EINVAL; - - dev->mtu = new_mtu; - if (!netif_running(dev) || !netif_device_present(dev)) - return 0; - - /* let the reset task handle it */ -#if 1 - atomic_inc(&cp->reset_task_pending); - if ((cp->phy_type & CAS_PHY_SERDES)) { - atomic_inc(&cp->reset_task_pending_all); - } else { - atomic_inc(&cp->reset_task_pending_mtu); - } - schedule_work(&cp->reset_task); -#else - atomic_set(&cp->reset_task_pending, (cp->phy_type & CAS_PHY_SERDES) ? - CAS_RESET_ALL : CAS_RESET_MTU); - printk(KERN_ERR "reset called in cas_change_mtu\n"); - schedule_work(&cp->reset_task); -#endif - - flush_scheduled_work(); - return 0; -} - -static void cas_clean_txd(struct cas *cp, int ring) -{ - struct cas_tx_desc *txd = cp->init_txds[ring]; - struct sk_buff *skb, **skbs = cp->tx_skbs[ring]; - u64 daddr, dlen; - int i, size; - - size = TX_DESC_RINGN_SIZE(ring); - for (i = 0; i < size; i++) { - int frag; - - if (skbs[i] == NULL) - continue; - - skb = skbs[i]; - skbs[i] = NULL; - - for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) { - int ent = i & (size - 1); - - /* first buffer is never a tiny buffer and so - * needs to be unmapped. - */ - daddr = le64_to_cpu(txd[ent].buffer); - dlen = CAS_VAL(TX_DESC_BUFLEN, - le64_to_cpu(txd[ent].control)); - pci_unmap_page(cp->pdev, daddr, dlen, - PCI_DMA_TODEVICE); - - if (frag != skb_shinfo(skb)->nr_frags) { - i++; - - /* next buffer might by a tiny buffer. - * skip past it. - */ - ent = i & (size - 1); - if (cp->tx_tiny_use[ring][ent].used) - i++; - } - } - dev_kfree_skb_any(skb); - } - - /* zero out tiny buf usage */ - memset(cp->tx_tiny_use[ring], 0, size*sizeof(*cp->tx_tiny_use[ring])); -} - -/* freed on close */ -static inline void cas_free_rx_desc(struct cas *cp, int ring) -{ - cas_page_t **page = cp->rx_pages[ring]; - int i, size; - - size = RX_DESC_RINGN_SIZE(ring); - for (i = 0; i < size; i++) { - if (page[i]) { - cas_page_free(cp, page[i]); - page[i] = NULL; - } - } -} - -static void cas_free_rxds(struct cas *cp) -{ - int i; - - for (i = 0; i < N_RX_DESC_RINGS; i++) - cas_free_rx_desc(cp, i); -} - -/* Must be invoked under cp->lock. */ -static void cas_clean_rings(struct cas *cp) -{ - int i; - - /* need to clean all tx rings */ - memset(cp->tx_old, 0, sizeof(*cp->tx_old)*N_TX_RINGS); - memset(cp->tx_new, 0, sizeof(*cp->tx_new)*N_TX_RINGS); - for (i = 0; i < N_TX_RINGS; i++) - cas_clean_txd(cp, i); - - /* zero out init block */ - memset(cp->init_block, 0, sizeof(struct cas_init_block)); - cas_clean_rxds(cp); - cas_clean_rxcs(cp); -} - -/* allocated on open */ -static inline int cas_alloc_rx_desc(struct cas *cp, int ring) -{ - cas_page_t **page = cp->rx_pages[ring]; - int size, i = 0; - - size = RX_DESC_RINGN_SIZE(ring); - for (i = 0; i < size; i++) { - if ((page[i] = cas_page_alloc(cp, GFP_KERNEL)) == NULL) - return -1; - } - return 0; -} - -static int cas_alloc_rxds(struct cas *cp) -{ - int i; - - for (i = 0; i < N_RX_DESC_RINGS; i++) { - if (cas_alloc_rx_desc(cp, i) < 0) { - cas_free_rxds(cp); - return -1; - } - } - return 0; -} - -static void cas_reset_task(void *data) -{ - struct cas *cp = (struct cas *) data; -#if 0 - int pending = atomic_read(&cp->reset_task_pending); -#else - int pending_all = atomic_read(&cp->reset_task_pending_all); - int pending_spare = atomic_read(&cp->reset_task_pending_spare); - int pending_mtu = atomic_read(&cp->reset_task_pending_mtu); - - if (pending_all == 0 && pending_spare == 0 && pending_mtu == 0) { - /* We can have more tasks scheduled than actually - * needed. - */ - atomic_dec(&cp->reset_task_pending); - return; - } -#endif - /* The link went down, we reset the ring, but keep - * DMA stopped. Use this function for reset - * on error as well. - */ - if (cp->hw_running) { - unsigned long flags; - - /* Make sure we don't get interrupts or tx packets */ - netif_device_detach(cp->dev); - cas_lock_all_save(cp, flags); - - if (cp->opened) { - /* We call cas_spare_recover when we call cas_open. - * but we do not initialize the lists cas_spare_recover - * uses until cas_open is called. - */ - cas_spare_recover(cp, GFP_ATOMIC); - } -#if 1 - /* test => only pending_spare set */ - if (!pending_all && !pending_mtu) - goto done; -#else - if (pending == CAS_RESET_SPARE) - goto done; -#endif - /* when pending == CAS_RESET_ALL, the following - * call to cas_init_hw will restart auto negotiation. - * Setting the second argument of cas_reset to - * !(pending == CAS_RESET_ALL) will set this argument - * to 1 (avoiding reinitializing the PHY for the normal - * PCS case) when auto negotiation is not restarted. - */ -#if 1 - cas_reset(cp, !(pending_all > 0)); - if (cp->opened) - cas_clean_rings(cp); - cas_init_hw(cp, (pending_all > 0)); -#else - cas_reset(cp, !(pending == CAS_RESET_ALL)); - if (cp->opened) - cas_clean_rings(cp); - cas_init_hw(cp, pending == CAS_RESET_ALL); -#endif - -done: - cas_unlock_all_restore(cp, flags); - netif_device_attach(cp->dev); - } -#if 1 - atomic_sub(pending_all, &cp->reset_task_pending_all); - atomic_sub(pending_spare, &cp->reset_task_pending_spare); - atomic_sub(pending_mtu, &cp->reset_task_pending_mtu); - atomic_dec(&cp->reset_task_pending); -#else - atomic_set(&cp->reset_task_pending, 0); -#endif -} - -static void cas_link_timer(unsigned long data) -{ - struct cas *cp = (struct cas *) data; - int mask, pending = 0, reset = 0; - unsigned long flags; - - if (link_transition_timeout != 0 && - cp->link_transition_jiffies_valid && - ((jiffies - cp->link_transition_jiffies) > - (link_transition_timeout))) { - /* One-second counter so link-down workaround doesn't - * cause resets to occur so fast as to fool the switch - * into thinking the link is down. - */ - cp->link_transition_jiffies_valid = 0; - } - - if (!cp->hw_running) - return; - - spin_lock_irqsave(&cp->lock, flags); - cas_lock_tx(cp); - cas_entropy_gather(cp); - - /* If the link task is still pending, we just - * reschedule the link timer - */ -#if 1 - if (atomic_read(&cp->reset_task_pending_all) || - atomic_read(&cp->reset_task_pending_spare) || - atomic_read(&cp->reset_task_pending_mtu)) - goto done; -#else - if (atomic_read(&cp->reset_task_pending)) - goto done; -#endif - - /* check for rx cleaning */ - if ((mask = (cp->cas_flags & CAS_FLAG_RXD_POST_MASK))) { - int i, rmask; - - for (i = 0; i < MAX_RX_DESC_RINGS; i++) { - rmask = CAS_FLAG_RXD_POST(i); - if ((mask & rmask) == 0) - continue; - - /* post_rxds will do a mod_timer */ - if (cas_post_rxds_ringN(cp, i, cp->rx_last[i]) < 0) { - pending = 1; - continue; - } - cp->cas_flags &= ~rmask; - } - } - - if (CAS_PHY_MII(cp->phy_type)) { - u16 bmsr; - cas_mif_poll(cp, 0); - bmsr = cas_phy_read(cp, MII_BMSR); - /* WTZ: Solaris driver reads this twice, but that - * may be due to the PCS case and the use of a - * common implementation. Read it twice here to be - * safe. - */ - bmsr = cas_phy_read(cp, MII_BMSR); - cas_mif_poll(cp, 1); - readl(cp->regs + REG_MIF_STATUS); /* avoid dups */ - reset = cas_mii_link_check(cp, bmsr); - } else { - reset = cas_pcs_link_check(cp); - } - - if (reset) - goto done; - - /* check for tx state machine confusion */ - if ((readl(cp->regs + REG_MAC_TX_STATUS) & MAC_TX_FRAME_XMIT) == 0) { - u32 val = readl(cp->regs + REG_MAC_STATE_MACHINE); - u32 wptr, rptr; - int tlm = CAS_VAL(MAC_SM_TLM, val); - - if (((tlm == 0x5) || (tlm == 0x3)) && - (CAS_VAL(MAC_SM_ENCAP_SM, val) == 0)) { - if (netif_msg_tx_err(cp)) - printk(KERN_DEBUG "%s: tx err: " - "MAC_STATE[%08x]\n", - cp->dev->name, val); - reset = 1; - goto done; - } - - val = readl(cp->regs + REG_TX_FIFO_PKT_CNT); - wptr = readl(cp->regs + REG_TX_FIFO_WRITE_PTR); - rptr = readl(cp->regs + REG_TX_FIFO_READ_PTR); - if ((val == 0) && (wptr != rptr)) { - if (netif_msg_tx_err(cp)) - printk(KERN_DEBUG "%s: tx err: " - "TX_FIFO[%08x:%08x:%08x]\n", - cp->dev->name, val, wptr, rptr); - reset = 1; - } - - if (reset) - cas_hard_reset(cp); - } - -done: - if (reset) { -#if 1 - atomic_inc(&cp->reset_task_pending); - atomic_inc(&cp->reset_task_pending_all); - schedule_work(&cp->reset_task); -#else - atomic_set(&cp->reset_task_pending, CAS_RESET_ALL); - printk(KERN_ERR "reset called in cas_link_timer\n"); - schedule_work(&cp->reset_task); -#endif - } - - if (!pending) - mod_timer(&cp->link_timer, jiffies + CAS_LINK_TIMEOUT); - cas_unlock_tx(cp); - spin_unlock_irqrestore(&cp->lock, flags); -} - -/* tiny buffers are used to avoid target abort issues with - * older cassini's - */ -static void cas_tx_tiny_free(struct cas *cp) -{ - struct pci_dev *pdev = cp->pdev; - int i; - - for (i = 0; i < N_TX_RINGS; i++) { - if (!cp->tx_tiny_bufs[i]) - continue; - - pci_free_consistent(pdev, TX_TINY_BUF_BLOCK, - cp->tx_tiny_bufs[i], - cp->tx_tiny_dvma[i]); - cp->tx_tiny_bufs[i] = NULL; - } -} - -static int cas_tx_tiny_alloc(struct cas *cp) -{ - struct pci_dev *pdev = cp->pdev; - int i; - - for (i = 0; i < N_TX_RINGS; i++) { - cp->tx_tiny_bufs[i] = - pci_alloc_consistent(pdev, TX_TINY_BUF_BLOCK, - &cp->tx_tiny_dvma[i]); - if (!cp->tx_tiny_bufs[i]) { - cas_tx_tiny_free(cp); - return -1; - } - } - return 0; -} - - -static int cas_open(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - int hw_was_up, err; - unsigned long flags; - - down(&cp->pm_sem); - - hw_was_up = cp->hw_running; - - /* The power-management semaphore protects the hw_running - * etc. state so it is safe to do this bit without cp->lock - */ - if (!cp->hw_running) { - /* Reset the chip */ - cas_lock_all_save(cp, flags); - /* We set the second arg to cas_reset to zero - * because cas_init_hw below will have its second - * argument set to non-zero, which will force - * autonegotiation to start. - */ - cas_reset(cp, 0); - cp->hw_running = 1; - cas_unlock_all_restore(cp, flags); - } - - if (cas_tx_tiny_alloc(cp) < 0) - return -ENOMEM; - - /* alloc rx descriptors */ - err = -ENOMEM; - if (cas_alloc_rxds(cp) < 0) - goto err_tx_tiny; - - /* allocate spares */ - cas_spare_init(cp); - cas_spare_recover(cp, GFP_KERNEL); - - /* We can now request the interrupt as we know it's masked - * on the controller. cassini+ has up to 4 interrupts - * that can be used, but you need to do explicit pci interrupt - * mapping to expose them - */ - if (request_irq(cp->pdev->irq, cas_interrupt, - SA_SHIRQ, dev->name, (void *) dev)) { - printk(KERN_ERR "%s: failed to request irq !\n", - cp->dev->name); - err = -EAGAIN; - goto err_spare; - } - - /* init hw */ - cas_lock_all_save(cp, flags); - cas_clean_rings(cp); - cas_init_hw(cp, !hw_was_up); - cp->opened = 1; - cas_unlock_all_restore(cp, flags); - - netif_start_queue(dev); - up(&cp->pm_sem); - return 0; - -err_spare: - cas_spare_free(cp); - cas_free_rxds(cp); -err_tx_tiny: - cas_tx_tiny_free(cp); - up(&cp->pm_sem); - return err; -} - -static int cas_close(struct net_device *dev) -{ - unsigned long flags; - struct cas *cp = netdev_priv(dev); - - /* Make sure we don't get distracted by suspend/resume */ - down(&cp->pm_sem); - - netif_stop_queue(dev); - - /* Stop traffic, mark us closed */ - cas_lock_all_save(cp, flags); - cp->opened = 0; - cas_reset(cp, 0); - cas_phy_init(cp); - cas_begin_auto_negotiation(cp, NULL); - cas_clean_rings(cp); - cas_unlock_all_restore(cp, flags); - - free_irq(cp->pdev->irq, (void *) dev); - cas_spare_free(cp); - cas_free_rxds(cp); - cas_tx_tiny_free(cp); - up(&cp->pm_sem); - return 0; -} - -static struct { - const char name[ETH_GSTRING_LEN]; -} ethtool_cassini_statnames[] = { - {"collisions"}, - {"rx_bytes"}, - {"rx_crc_errors"}, - {"rx_dropped"}, - {"rx_errors"}, - {"rx_fifo_errors"}, - {"rx_frame_errors"}, - {"rx_length_errors"}, - {"rx_over_errors"}, - {"rx_packets"}, - {"tx_aborted_errors"}, - {"tx_bytes"}, - {"tx_dropped"}, - {"tx_errors"}, - {"tx_fifo_errors"}, - {"tx_packets"} -}; -#define CAS_NUM_STAT_KEYS (sizeof(ethtool_cassini_statnames)/ETH_GSTRING_LEN) - -static struct { - const int offsets; /* neg. values for 2nd arg to cas_read_phy */ -} ethtool_register_table[] = { - {-MII_BMSR}, - {-MII_BMCR}, - {REG_CAWR}, - {REG_INF_BURST}, - {REG_BIM_CFG}, - {REG_RX_CFG}, - {REG_HP_CFG}, - {REG_MAC_TX_CFG}, - {REG_MAC_RX_CFG}, - {REG_MAC_CTRL_CFG}, - {REG_MAC_XIF_CFG}, - {REG_MIF_CFG}, - {REG_PCS_CFG}, - {REG_SATURN_PCFG}, - {REG_PCS_MII_STATUS}, - {REG_PCS_STATE_MACHINE}, - {REG_MAC_COLL_EXCESS}, - {REG_MAC_COLL_LATE} -}; -#define CAS_REG_LEN (sizeof(ethtool_register_table)/sizeof(int)) -#define CAS_MAX_REGS (sizeof (u32)*CAS_REG_LEN) - -static void cas_read_regs(struct cas *cp, u8 *ptr, int len) -{ - u8 *p; - int i; - unsigned long flags; - - spin_lock_irqsave(&cp->lock, flags); - for (i = 0, p = ptr; i < len ; i ++, p += sizeof(u32)) { - u16 hval; - u32 val; - if (ethtool_register_table[i].offsets < 0) { - hval = cas_phy_read(cp, - -ethtool_register_table[i].offsets); - val = hval; - } else { - val= readl(cp->regs+ethtool_register_table[i].offsets); - } - memcpy(p, (u8 *)&val, sizeof(u32)); - } - spin_unlock_irqrestore(&cp->lock, flags); -} - -static struct net_device_stats *cas_get_stats(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - struct net_device_stats *stats = cp->net_stats; - unsigned long flags; - int i; - unsigned long tmp; - - /* we collate all of the stats into net_stats[N_TX_RING] */ - if (!cp->hw_running) - return stats + N_TX_RINGS; - - /* collect outstanding stats */ - /* WTZ: the Cassini spec gives these as 16 bit counters but - * stored in 32-bit words. Added a mask of 0xffff to be safe, - * in case the chip somehow puts any garbage in the other bits. - * Also, counter usage didn't seem to mach what Adrian did - * in the parts of the code that set these quantities. Made - * that consistent. - */ - spin_lock_irqsave(&cp->stat_lock[N_TX_RINGS], flags); - stats[N_TX_RINGS].rx_crc_errors += - readl(cp->regs + REG_MAC_FCS_ERR) & 0xffff; - stats[N_TX_RINGS].rx_frame_errors += - readl(cp->regs + REG_MAC_ALIGN_ERR) &0xffff; - stats[N_TX_RINGS].rx_length_errors += - readl(cp->regs + REG_MAC_LEN_ERR) & 0xffff; -#if 1 - tmp = (readl(cp->regs + REG_MAC_COLL_EXCESS) & 0xffff) + - (readl(cp->regs + REG_MAC_COLL_LATE) & 0xffff); - stats[N_TX_RINGS].tx_aborted_errors += tmp; - stats[N_TX_RINGS].collisions += - tmp + (readl(cp->regs + REG_MAC_COLL_NORMAL) & 0xffff); -#else - stats[N_TX_RINGS].tx_aborted_errors += - readl(cp->regs + REG_MAC_COLL_EXCESS); - stats[N_TX_RINGS].collisions += readl(cp->regs + REG_MAC_COLL_EXCESS) + - readl(cp->regs + REG_MAC_COLL_LATE); -#endif - cas_clear_mac_err(cp); - - /* saved bits that are unique to ring 0 */ - spin_lock(&cp->stat_lock[0]); - stats[N_TX_RINGS].collisions += stats[0].collisions; - stats[N_TX_RINGS].rx_over_errors += stats[0].rx_over_errors; - stats[N_TX_RINGS].rx_frame_errors += stats[0].rx_frame_errors; - stats[N_TX_RINGS].rx_fifo_errors += stats[0].rx_fifo_errors; - stats[N_TX_RINGS].tx_aborted_errors += stats[0].tx_aborted_errors; - stats[N_TX_RINGS].tx_fifo_errors += stats[0].tx_fifo_errors; - spin_unlock(&cp->stat_lock[0]); - - for (i = 0; i < N_TX_RINGS; i++) { - spin_lock(&cp->stat_lock[i]); - stats[N_TX_RINGS].rx_length_errors += - stats[i].rx_length_errors; - stats[N_TX_RINGS].rx_crc_errors += stats[i].rx_crc_errors; - stats[N_TX_RINGS].rx_packets += stats[i].rx_packets; - stats[N_TX_RINGS].tx_packets += stats[i].tx_packets; - stats[N_TX_RINGS].rx_bytes += stats[i].rx_bytes; - stats[N_TX_RINGS].tx_bytes += stats[i].tx_bytes; - stats[N_TX_RINGS].rx_errors += stats[i].rx_errors; - stats[N_TX_RINGS].tx_errors += stats[i].tx_errors; - stats[N_TX_RINGS].rx_dropped += stats[i].rx_dropped; - stats[N_TX_RINGS].tx_dropped += stats[i].tx_dropped; - memset(stats + i, 0, sizeof(struct net_device_stats)); - spin_unlock(&cp->stat_lock[i]); - } - spin_unlock_irqrestore(&cp->stat_lock[N_TX_RINGS], flags); - return stats + N_TX_RINGS; -} - - -static void cas_set_multicast(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - u32 rxcfg, rxcfg_new; - unsigned long flags; - int limit = STOP_TRIES; - - if (!cp->hw_running) - return; - - spin_lock_irqsave(&cp->lock, flags); - rxcfg = readl(cp->regs + REG_MAC_RX_CFG); - - /* disable RX MAC and wait for completion */ - writel(rxcfg & ~MAC_RX_CFG_EN, cp->regs + REG_MAC_RX_CFG); - while (readl(cp->regs + REG_MAC_RX_CFG) & MAC_RX_CFG_EN) { - if (!limit--) - break; - udelay(10); - } - - /* disable hash filter and wait for completion */ - limit = STOP_TRIES; - rxcfg &= ~(MAC_RX_CFG_PROMISC_EN | MAC_RX_CFG_HASH_FILTER_EN); - writel(rxcfg & ~MAC_RX_CFG_EN, cp->regs + REG_MAC_RX_CFG); - while (readl(cp->regs + REG_MAC_RX_CFG) & MAC_RX_CFG_HASH_FILTER_EN) { - if (!limit--) - break; - udelay(10); - } - - /* program hash filters */ - cp->mac_rx_cfg = rxcfg_new = cas_setup_multicast(cp); - rxcfg |= rxcfg_new; - writel(rxcfg, cp->regs + REG_MAC_RX_CFG); - spin_unlock_irqrestore(&cp->lock, flags); -} - -static void cas_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) -{ - struct cas *cp = netdev_priv(dev); - strncpy(info->driver, DRV_MODULE_NAME, ETHTOOL_BUSINFO_LEN); - strncpy(info->version, DRV_MODULE_VERSION, ETHTOOL_BUSINFO_LEN); - info->fw_version[0] = '\0'; - strncpy(info->bus_info, pci_name(cp->pdev), ETHTOOL_BUSINFO_LEN); - info->regdump_len = cp->casreg_len < CAS_MAX_REGS ? - cp->casreg_len : CAS_MAX_REGS; - info->n_stats = CAS_NUM_STAT_KEYS; -} - -static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) -{ - struct cas *cp = netdev_priv(dev); - u16 bmcr; - int full_duplex, speed, pause; - unsigned long flags; - enum link_state linkstate = link_up; - - cmd->advertising = 0; - cmd->supported = SUPPORTED_Autoneg; - if (cp->cas_flags & CAS_FLAG_1000MB_CAP) { - cmd->supported |= SUPPORTED_1000baseT_Full; - cmd->advertising |= ADVERTISED_1000baseT_Full; - } - - /* Record PHY settings if HW is on. */ - spin_lock_irqsave(&cp->lock, flags); - bmcr = 0; - linkstate = cp->lstate; - if (CAS_PHY_MII(cp->phy_type)) { - cmd->port = PORT_MII; - cmd->transceiver = (cp->cas_flags & CAS_FLAG_SATURN) ? - XCVR_INTERNAL : XCVR_EXTERNAL; - cmd->phy_address = cp->phy_addr; - cmd->advertising |= ADVERTISED_TP | ADVERTISED_MII | - ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full; - - cmd->supported |= - (SUPPORTED_10baseT_Half | - SUPPORTED_10baseT_Full | - SUPPORTED_100baseT_Half | - SUPPORTED_100baseT_Full | - SUPPORTED_TP | SUPPORTED_MII); - - if (cp->hw_running) { - cas_mif_poll(cp, 0); - bmcr = cas_phy_read(cp, MII_BMCR); - cas_read_mii_link_mode(cp, &full_duplex, - &speed, &pause); - cas_mif_poll(cp, 1); - } - - } else { - cmd->port = PORT_FIBRE; - cmd->transceiver = XCVR_INTERNAL; - cmd->phy_address = 0; - cmd->supported |= SUPPORTED_FIBRE; - cmd->advertising |= ADVERTISED_FIBRE; - - if (cp->hw_running) { - /* pcs uses the same bits as mii */ - bmcr = readl(cp->regs + REG_PCS_MII_CTRL); - cas_read_pcs_link_mode(cp, &full_duplex, - &speed, &pause); - } - } - spin_unlock_irqrestore(&cp->lock, flags); - - if (bmcr & BMCR_ANENABLE) { - cmd->advertising |= ADVERTISED_Autoneg; - cmd->autoneg = AUTONEG_ENABLE; - cmd->speed = ((speed == 10) ? - SPEED_10 : - ((speed == 1000) ? - SPEED_1000 : SPEED_100)); - cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; - } else { - cmd->autoneg = AUTONEG_DISABLE; - cmd->speed = - (bmcr & CAS_BMCR_SPEED1000) ? - SPEED_1000 : - ((bmcr & BMCR_SPEED100) ? SPEED_100: - SPEED_10); - cmd->duplex = - (bmcr & BMCR_FULLDPLX) ? - DUPLEX_FULL : DUPLEX_HALF; - } - if (linkstate != link_up) { - /* Force these to "unknown" if the link is not up and - * autonogotiation in enabled. We can set the link - * speed to 0, but not cmd->duplex, - * because its legal values are 0 and 1. Ethtool will - * print the value reported in parentheses after the - * word "Unknown" for unrecognized values. - * - * If in forced mode, we report the speed and duplex - * settings that we configured. - */ - if (cp->link_cntl & BMCR_ANENABLE) { - cmd->speed = 0; - cmd->duplex = 0xff; - } else { - cmd->speed = SPEED_10; - if (cp->link_cntl & BMCR_SPEED100) { - cmd->speed = SPEED_100; - } else if (cp->link_cntl & CAS_BMCR_SPEED1000) { - cmd->speed = SPEED_1000; - } - cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)? - DUPLEX_FULL : DUPLEX_HALF; - } - } - return 0; -} - -static int cas_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) -{ - struct cas *cp = netdev_priv(dev); - unsigned long flags; - - /* Verify the settings we care about. */ - if (cmd->autoneg != AUTONEG_ENABLE && - cmd->autoneg != AUTONEG_DISABLE) - return -EINVAL; - - if (cmd->autoneg == AUTONEG_DISABLE && - ((cmd->speed != SPEED_1000 && - cmd->speed != SPEED_100 && - cmd->speed != SPEED_10) || - (cmd->duplex != DUPLEX_HALF && - cmd->duplex != DUPLEX_FULL))) - return -EINVAL; - - /* Apply settings and restart link process. */ - spin_lock_irqsave(&cp->lock, flags); - cas_begin_auto_negotiation(cp, cmd); - spin_unlock_irqrestore(&cp->lock, flags); - return 0; -} - -static int cas_nway_reset(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - unsigned long flags; - - if ((cp->link_cntl & BMCR_ANENABLE) == 0) - return -EINVAL; - - /* Restart link process. */ - spin_lock_irqsave(&cp->lock, flags); - cas_begin_auto_negotiation(cp, NULL); - spin_unlock_irqrestore(&cp->lock, flags); - - return 0; -} - -static u32 cas_get_link(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - return cp->lstate == link_up; -} - -static u32 cas_get_msglevel(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - return cp->msg_enable; -} - -static void cas_set_msglevel(struct net_device *dev, u32 value) -{ - struct cas *cp = netdev_priv(dev); - cp->msg_enable = value; -} - -static int cas_get_regs_len(struct net_device *dev) -{ - struct cas *cp = netdev_priv(dev); - return cp->casreg_len < CAS_MAX_REGS ? cp->casreg_len: CAS_MAX_REGS; -} - -static void cas_get_regs(struct net_device *dev, struct ethtool_regs *regs, - void *p) -{ - struct cas *cp = netdev_priv(dev); - regs->version = 0; - /* cas_read_regs handles locks (cp->lock). */ - cas_read_regs(cp, p, regs->len / sizeof(u32)); -} - -static int cas_get_stats_count(struct net_device *dev) -{ - return CAS_NUM_STAT_KEYS; -} - -static void cas_get_strings(struct net_device *dev, u32 stringset, u8 *data) -{ - memcpy(data, ðtool_cassini_statnames, - CAS_NUM_STAT_KEYS * ETH_GSTRING_LEN); -} - -static void cas_get_ethtool_stats(struct net_device *dev, - struct ethtool_stats *estats, u64 *data) -{ - struct cas *cp = netdev_priv(dev); - struct net_device_stats *stats = cas_get_stats(cp->dev); - int i = 0; - data[i++] = stats->collisions; - data[i++] = stats->rx_bytes; - data[i++] = stats->rx_crc_errors; - data[i++] = stats->rx_dropped; - data[i++] = stats->rx_errors; - data[i++] = stats->rx_fifo_errors; - data[i++] = stats->rx_frame_errors; - data[i++] = stats->rx_length_errors; - data[i++] = stats->rx_over_errors; - data[i++] = stats->rx_packets; - data[i++] = stats->tx_aborted_errors; - data[i++] = stats->tx_bytes; - data[i++] = stats->tx_dropped; - data[i++] = stats->tx_errors; - data[i++] = stats->tx_fifo_errors; - data[i++] = stats->tx_packets; - BUG_ON(i != CAS_NUM_STAT_KEYS); -} - -static struct ethtool_ops cas_ethtool_ops = { - .get_drvinfo = cas_get_drvinfo, - .get_settings = cas_get_settings, - .set_settings = cas_set_settings, - .nway_reset = cas_nway_reset, - .get_link = cas_get_link, - .get_msglevel = cas_get_msglevel, - .set_msglevel = cas_set_msglevel, - .get_regs_len = cas_get_regs_len, - .get_regs = cas_get_regs, - .get_stats_count = cas_get_stats_count, - .get_strings = cas_get_strings, - .get_ethtool_stats = cas_get_ethtool_stats, -}; - -static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - struct cas *cp = netdev_priv(dev); - struct mii_ioctl_data *data = if_mii(ifr); - unsigned long flags; - int rc = -EOPNOTSUPP; - - /* Hold the PM semaphore while doing ioctl's or we may collide - * with open/close and power management and oops. - */ - down(&cp->pm_sem); - switch (cmd) { - case SIOCGMIIPHY: /* Get address of MII PHY in use. */ - data->phy_id = cp->phy_addr; - /* Fallthrough... */ - - case SIOCGMIIREG: /* Read MII PHY register. */ - spin_lock_irqsave(&cp->lock, flags); - cas_mif_poll(cp, 0); - data->val_out = cas_phy_read(cp, data->reg_num & 0x1f); - cas_mif_poll(cp, 1); - spin_unlock_irqrestore(&cp->lock, flags); - rc = 0; - break; - - case SIOCSMIIREG: /* Write MII PHY register. */ - if (!capable(CAP_NET_ADMIN)) { - rc = -EPERM; - break; - } - spin_lock_irqsave(&cp->lock, flags); - cas_mif_poll(cp, 0); - rc = cas_phy_write(cp, data->reg_num & 0x1f, data->val_in); - cas_mif_poll(cp, 1); - spin_unlock_irqrestore(&cp->lock, flags); - break; - default: - break; - }; - - up(&cp->pm_sem); - return rc; -} - -static int __devinit cas_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - static int cas_version_printed = 0; - unsigned long casreg_base, casreg_len; - struct net_device *dev; - struct cas *cp; - int i, err, pci_using_dac; - u16 pci_cmd; - u8 orig_cacheline_size = 0, cas_cacheline_size = 0; - - if (cas_version_printed++ == 0) - printk(KERN_INFO "%s", version); - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR PFX "Cannot enable PCI device, " - "aborting.\n"); - return err; - } - - if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { - printk(KERN_ERR PFX "Cannot find proper PCI device " - "base address, aborting.\n"); - err = -ENODEV; - goto err_out_disable_pdev; - } - - dev = alloc_etherdev(sizeof(*cp)); - if (!dev) { - printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); - err = -ENOMEM; - goto err_out_disable_pdev; - } - SET_MODULE_OWNER(dev); - SET_NETDEV_DEV(dev, &pdev->dev); - - err = pci_request_regions(pdev, dev->name); - if (err) { - printk(KERN_ERR PFX "Cannot obtain PCI resources, " - "aborting.\n"); - goto err_out_free_netdev; - } - pci_set_master(pdev); - - /* we must always turn on parity response or else parity - * doesn't get generated properly. disable SERR/PERR as well. - * in addition, we want to turn MWI on. - */ - pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); - pci_cmd &= ~PCI_COMMAND_SERR; - pci_cmd |= PCI_COMMAND_PARITY; - pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); - pci_set_mwi(pdev); - /* - * On some architectures, the default cache line size set - * by pci_set_mwi reduces perforamnce. We have to increase - * it for this case. To start, we'll print some configuration - * data. - */ -#if 1 - pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, - &orig_cacheline_size); - if (orig_cacheline_size < CAS_PREF_CACHELINE_SIZE) { - cas_cacheline_size = - (CAS_PREF_CACHELINE_SIZE < SMP_CACHE_BYTES) ? - CAS_PREF_CACHELINE_SIZE : SMP_CACHE_BYTES; - if (pci_write_config_byte(pdev, - PCI_CACHE_LINE_SIZE, - cas_cacheline_size)) { - printk(KERN_ERR PFX "Could not set PCI cache " - "line size\n"); - goto err_write_cacheline; - } - } -#endif - - - /* Configure DMA attributes. */ - if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { - pci_using_dac = 1; - err = pci_set_consistent_dma_mask(pdev, - DMA_64BIT_MASK); - if (err < 0) { - printk(KERN_ERR PFX "Unable to obtain 64-bit DMA " - "for consistent allocations\n"); - goto err_out_free_res; - } - - } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); - if (err) { - printk(KERN_ERR PFX "No usable DMA configuration, " - "aborting.\n"); - goto err_out_free_res; - } - pci_using_dac = 0; - } - - casreg_base = pci_resource_start(pdev, 0); - casreg_len = pci_resource_len(pdev, 0); - - cp = netdev_priv(dev); - cp->pdev = pdev; -#if 1 - /* A value of 0 indicates we never explicitly set it */ - cp->orig_cacheline_size = cas_cacheline_size ? orig_cacheline_size: 0; -#endif - cp->dev = dev; - cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE : - cassini_debug; - - cp->link_transition = LINK_TRANSITION_UNKNOWN; - cp->link_transition_jiffies_valid = 0; - - spin_lock_init(&cp->lock); - spin_lock_init(&cp->rx_inuse_lock); - spin_lock_init(&cp->rx_spare_lock); - for (i = 0; i < N_TX_RINGS; i++) { - spin_lock_init(&cp->stat_lock[i]); - spin_lock_init(&cp->tx_lock[i]); - } - spin_lock_init(&cp->stat_lock[N_TX_RINGS]); - init_MUTEX(&cp->pm_sem); - - init_timer(&cp->link_timer); - cp->link_timer.function = cas_link_timer; - cp->link_timer.data = (unsigned long) cp; - -#if 1 - /* Just in case the implementation of atomic operations - * change so that an explicit initialization is necessary. - */ - atomic_set(&cp->reset_task_pending, 0); - atomic_set(&cp->reset_task_pending_all, 0); - atomic_set(&cp->reset_task_pending_spare, 0); - atomic_set(&cp->reset_task_pending_mtu, 0); -#endif - INIT_WORK(&cp->reset_task, cas_reset_task, cp); - - /* Default link parameters */ - if (link_mode >= 0 && link_mode <= 6) - cp->link_cntl = link_modes[link_mode]; - else - cp->link_cntl = BMCR_ANENABLE; - cp->lstate = link_down; - cp->link_transition = LINK_TRANSITION_LINK_DOWN; - netif_carrier_off(cp->dev); - cp->timer_ticks = 0; - - /* give us access to cassini registers */ - cp->regs = ioremap(casreg_base, casreg_len); - if (cp->regs == 0UL) { - printk(KERN_ERR PFX "Cannot map device registers, " - "aborting.\n"); - goto err_out_free_res; - } - cp->casreg_len = casreg_len; - - pci_save_state(pdev); - cas_check_pci_invariants(cp); - cas_hard_reset(cp); - cas_reset(cp, 0); - if (cas_check_invariants(cp)) - goto err_out_iounmap; - - cp->init_block = (struct cas_init_block *) - pci_alloc_consistent(pdev, sizeof(struct cas_init_block), - &cp->block_dvma); - if (!cp->init_block) { - printk(KERN_ERR PFX "Cannot allocate init block, " - "aborting.\n"); - goto err_out_iounmap; - } - - for (i = 0; i < N_TX_RINGS; i++) - cp->init_txds[i] = cp->init_block->txds[i]; - - for (i = 0; i < N_RX_DESC_RINGS; i++) - cp->init_rxds[i] = cp->init_block->rxds[i]; - - for (i = 0; i < N_RX_COMP_RINGS; i++) - cp->init_rxcs[i] = cp->init_block->rxcs[i]; - - for (i = 0; i < N_RX_FLOWS; i++) - skb_queue_head_init(&cp->rx_flows[i]); - - dev->open = cas_open; - dev->stop = cas_close; - dev->hard_start_xmit = cas_start_xmit; - dev->get_stats = cas_get_stats; - dev->set_multicast_list = cas_set_multicast; - dev->do_ioctl = cas_ioctl; - dev->ethtool_ops = &cas_ethtool_ops; - dev->tx_timeout = cas_tx_timeout; - dev->watchdog_timeo = CAS_TX_TIMEOUT; - dev->change_mtu = cas_change_mtu; -#ifdef USE_NAPI - dev->poll = cas_poll; - dev->weight = 64; -#endif -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = cas_netpoll; -#endif - dev->irq = pdev->irq; - dev->dma = 0; - - /* Cassini features. */ - if ((cp->cas_flags & CAS_FLAG_NO_HW_CSUM) == 0) - dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; - - if (pci_using_dac) - dev->features |= NETIF_F_HIGHDMA; - - if (register_netdev(dev)) { - printk(KERN_ERR PFX "Cannot register net device, " - "aborting.\n"); - goto err_out_free_consistent; - } - - i = readl(cp->regs + REG_BIM_CFG); - printk(KERN_INFO "%s: Sun Cassini%s (%sbit/%sMHz PCI/%s) " - "Ethernet[%d] ", dev->name, - (cp->cas_flags & CAS_FLAG_REG_PLUS) ? "+" : "", - (i & BIM_CFG_32BIT) ? "32" : "64", - (i & BIM_CFG_66MHZ) ? "66" : "33", - (cp->phy_type == CAS_PHY_SERDES) ? "Fi" : "Cu", pdev->irq); - - for (i = 0; i < 6; i++) - printk("%2.2x%c", dev->dev_addr[i], - i == 5 ? ' ' : ':'); - printk("\n"); - - pci_set_drvdata(pdev, dev); - cp->hw_running = 1; - cas_entropy_reset(cp); - cas_phy_init(cp); - cas_begin_auto_negotiation(cp, NULL); - return 0; - -err_out_free_consistent: - pci_free_consistent(pdev, sizeof(struct cas_init_block), - cp->init_block, cp->block_dvma); - -err_out_iounmap: - down(&cp->pm_sem); - if (cp->hw_running) - cas_shutdown(cp); - up(&cp->pm_sem); - - iounmap(cp->regs); - - -err_out_free_res: - pci_release_regions(pdev); - -err_write_cacheline: - /* Try to restore it in case the error occured after we - * set it. - */ - pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, orig_cacheline_size); - -err_out_free_netdev: - free_netdev(dev); - -err_out_disable_pdev: - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - return -ENODEV; -} - -static void __devexit cas_remove_one(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct cas *cp; - if (!dev) - return; - - cp = netdev_priv(dev); - unregister_netdev(dev); - - down(&cp->pm_sem); - flush_scheduled_work(); - if (cp->hw_running) - cas_shutdown(cp); - up(&cp->pm_sem); - -#if 1 - if (cp->orig_cacheline_size) { - /* Restore the cache line size if we had modified - * it. - */ - pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, - cp->orig_cacheline_size); - } -#endif - pci_free_consistent(pdev, sizeof(struct cas_init_block), - cp->init_block, cp->block_dvma); - iounmap(cp->regs); - free_netdev(dev); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); -} - -#ifdef CONFIG_PM -static int cas_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct cas *cp = netdev_priv(dev); - unsigned long flags; - - /* We hold the PM semaphore during entire driver - * sleep time - */ - down(&cp->pm_sem); - - /* If the driver is opened, we stop the DMA */ - if (cp->opened) { - netif_device_detach(dev); - - cas_lock_all_save(cp, flags); - - /* We can set the second arg of cas_reset to 0 - * because on resume, we'll call cas_init_hw with - * its second arg set so that autonegotiation is - * restarted. - */ - cas_reset(cp, 0); - cas_clean_rings(cp); - cas_unlock_all_restore(cp, flags); - } - - if (cp->hw_running) - cas_shutdown(cp); - - return 0; -} - -static int cas_resume(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct cas *cp = netdev_priv(dev); - - printk(KERN_INFO "%s: resuming\n", dev->name); - - cas_hard_reset(cp); - if (cp->opened) { - unsigned long flags; - cas_lock_all_save(cp, flags); - cas_reset(cp, 0); - cp->hw_running = 1; - cas_clean_rings(cp); - cas_init_hw(cp, 1); - cas_unlock_all_restore(cp, flags); - - netif_device_attach(dev); - } - up(&cp->pm_sem); - return 0; -} -#endif /* CONFIG_PM */ - -static struct pci_driver cas_driver = { - .name = DRV_MODULE_NAME, - .id_table = cas_pci_tbl, - .probe = cas_init_one, - .remove = __devexit_p(cas_remove_one), -#ifdef CONFIG_PM - .suspend = cas_suspend, - .resume = cas_resume -#endif -}; - -static int __init cas_init(void) -{ - if (linkdown_timeout > 0) - link_transition_timeout = linkdown_timeout * HZ; - else - link_transition_timeout = 0; - - return pci_module_init(&cas_driver); -} - -static void __exit cas_cleanup(void) -{ - pci_unregister_driver(&cas_driver); -} - -module_init(cas_init); -module_exit(cas_cleanup); diff --git a/trunk/drivers/net/cassini.h b/trunk/drivers/net/cassini.h deleted file mode 100644 index 88063ef16cf6..000000000000 --- a/trunk/drivers/net/cassini.h +++ /dev/null @@ -1,4425 +0,0 @@ -/* $Id: cassini.h,v 1.16 2004/08/17 21:15:16 zaumen Exp $ - * cassini.h: Definitions for Sun Microsystems Cassini(+) ethernet driver. - * - * Copyright (C) 2004 Sun Microsystems Inc. - * Copyright (c) 2003 Adrian Sun (asun@darksunrising.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * vendor id: 0x108E (Sun Microsystems, Inc.) - * device id: 0xabba (Cassini) - * revision ids: 0x01 = Cassini - * 0x02 = Cassini rev 2 - * 0x10 = Cassini+ - * 0x11 = Cassini+ 0.2u - * - * vendor id: 0x100b (National Semiconductor) - * device id: 0x0035 (DP83065/Saturn) - * revision ids: 0x30 = Saturn B2 - * - * rings are all offset from 0. - * - * there are two clock domains: - * PCI: 33/66MHz clock - * chip: 125MHz clock - */ - -#ifndef _CASSINI_H -#define _CASSINI_H - -/* cassini register map: 2M memory mapped in 32-bit memory space accessible as - * 32-bit words. there is no i/o port access. REG_ addresses are - * shared between cassini and cassini+. REG_PLUS_ addresses only - * appear in cassini+. REG_MINUS_ addresses only appear in cassini. - */ -#define CAS_ID_REV2 0x02 -#define CAS_ID_REVPLUS 0x10 -#define CAS_ID_REVPLUS02u 0x11 -#define CAS_ID_REVSATURNB2 0x30 - -/** global resources **/ - -/* this register sets the weights for the weighted round robin arbiter. e.g., - * if rx weight == 1 and tx weight == 0, rx == 2x tx transfer credit - * for its next turn to access the pci bus. - * map: 0x0 = x1, 0x1 = x2, 0x2 = x4, 0x3 = x8 - * DEFAULT: 0x0, SIZE: 5 bits - */ -#define REG_CAWR 0x0004 /* core arbitration weight */ -#define CAWR_RX_DMA_WEIGHT_SHIFT 0 -#define CAWR_RX_DMA_WEIGHT_MASK 0x03 /* [0:1] */ -#define CAWR_TX_DMA_WEIGHT_SHIFT 2 -#define CAWR_TX_DMA_WEIGHT_MASK 0x0C /* [3:2] */ -#define CAWR_RR_DIS 0x10 /* [4] */ - -/* if enabled, BIM can send bursts across PCI bus > cacheline size. burst - * sizes determined by length of packet or descriptor transfer and the - * max length allowed by the target. - * DEFAULT: 0x0, SIZE: 1 bit - */ -#define REG_INF_BURST 0x0008 /* infinite burst enable reg */ -#define INF_BURST_EN 0x1 /* enable */ - -/* top level interrupts [0-9] are auto-cleared to 0 when the status - * register is read. second level interrupts [13 - 18] are cleared at - * the source. tx completion register 3 is replicated in [19 - 31] - * DEFAULT: 0x00000000, SIZE: 29 bits - */ -#define REG_INTR_STATUS 0x000C /* interrupt status register */ -#define INTR_TX_INTME 0x00000001 /* frame w/ INT ME desc bit set - xferred from host queue to - TX FIFO */ -#define INTR_TX_ALL 0x00000002 /* all xmit frames xferred into - TX FIFO. i.e., - TX Kick == TX complete. if - PACED_MODE set, then TX FIFO - also empty */ -#define INTR_TX_DONE 0x00000004 /* any frame xferred into tx - FIFO */ -#define INTR_TX_TAG_ERROR 0x00000008 /* TX FIFO tag framing - corrupted. FATAL ERROR */ -#define INTR_RX_DONE 0x00000010 /* at least 1 frame xferred - from RX FIFO to host mem. - RX completion reg updated. - may be delayed by recv - intr blanking. */ -#define INTR_RX_BUF_UNAVAIL 0x00000020 /* no more receive buffers. - RX Kick == RX complete */ -#define INTR_RX_TAG_ERROR 0x00000040 /* RX FIFO tag framing - corrupted. FATAL ERROR */ -#define INTR_RX_COMP_FULL 0x00000080 /* no more room in completion - ring to post descriptors. - RX complete head incr to - almost reach RX complete - tail */ -#define INTR_RX_BUF_AE 0x00000100 /* less than the - programmable threshold # - of free descr avail for - hw use */ -#define INTR_RX_COMP_AF 0x00000200 /* less than the - programmable threshold # - of descr spaces for hw - use in completion descr - ring */ -#define INTR_RX_LEN_MISMATCH 0x00000400 /* len field from MAC != - len of non-reassembly pkt - from fifo during DMA or - header parser provides TCP - header and payload size > - MAC packet size. - FATAL ERROR */ -#define INTR_SUMMARY 0x00001000 /* summary interrupt bit. this - bit will be set if an interrupt - generated on the pci bus. useful - when driver is polling for - interrupts */ -#define INTR_PCS_STATUS 0x00002000 /* PCS interrupt status register */ -#define INTR_TX_MAC_STATUS 0x00004000 /* TX MAC status register has at - least 1 unmasked interrupt set */ -#define INTR_RX_MAC_STATUS 0x00008000 /* RX MAC status register has at - least 1 unmasked interrupt set */ -#define INTR_MAC_CTRL_STATUS 0x00010000 /* MAC control status register has - at least 1 unmasked interrupt - set */ -#define INTR_MIF_STATUS 0x00020000 /* MIF status register has at least - 1 unmasked interrupt set */ -#define INTR_PCI_ERROR_STATUS 0x00040000 /* PCI error status register in the - BIF has at least 1 unmasked - interrupt set */ -#define INTR_TX_COMP_3_MASK 0xFFF80000 /* mask for TX completion - 3 reg data */ -#define INTR_TX_COMP_3_SHIFT 19 -#define INTR_ERROR_MASK (INTR_MIF_STATUS | INTR_PCI_ERROR_STATUS | \ - INTR_PCS_STATUS | INTR_RX_LEN_MISMATCH | \ - INTR_TX_MAC_STATUS | INTR_RX_MAC_STATUS | \ - INTR_TX_TAG_ERROR | INTR_RX_TAG_ERROR | \ - INTR_MAC_CTRL_STATUS) - -/* determines which status events will cause an interrupt. layout same - * as REG_INTR_STATUS. - * DEFAULT: 0xFFFFFFFF, SIZE: 16 bits - */ -#define REG_INTR_MASK 0x0010 /* Interrupt mask */ - -/* top level interrupt bits that are cleared during read of REG_INTR_STATUS_ALIAS. - * useful when driver is polling for interrupts. layout same as REG_INTR_MASK. - * DEFAULT: 0x00000000, SIZE: 12 bits - */ -#define REG_ALIAS_CLEAR 0x0014 /* alias clear mask - (used w/ status alias) */ -/* same as REG_INTR_STATUS except that only bits cleared are those selected by - * REG_ALIAS_CLEAR - * DEFAULT: 0x00000000, SIZE: 29 bits - */ -#define REG_INTR_STATUS_ALIAS 0x001C /* interrupt status alias - (selective clear) */ - -/* DEFAULT: 0x0, SIZE: 3 bits */ -#define REG_PCI_ERR_STATUS 0x1000 /* PCI error status */ -#define PCI_ERR_BADACK 0x01 /* reserved in Cassini+. - set if no ACK64# during ABS64 cycle - in Cassini. */ -#define PCI_ERR_DTRTO 0x02 /* delayed xaction timeout. set if - no read retry after 2^15 clocks */ -#define PCI_ERR_OTHER 0x04 /* other PCI errors */ -#define PCI_ERR_BIM_DMA_WRITE 0x08 /* BIM received 0 count DMA write req. - unused in Cassini. */ -#define PCI_ERR_BIM_DMA_READ 0x10 /* BIM received 0 count DMA read req. - unused in Cassini. */ -#define PCI_ERR_BIM_DMA_TIMEOUT 0x20 /* BIM received 255 retries during - DMA. unused in cassini. */ - -/* mask for PCI status events that will set PCI_ERR_STATUS. if cleared, event - * causes an interrupt to be generated. - * DEFAULT: 0x7, SIZE: 3 bits - */ -#define REG_PCI_ERR_STATUS_MASK 0x1004 /* PCI Error status mask */ - -/* used to configure PCI related parameters that are not in PCI config space. - * DEFAULT: 0bxx000, SIZE: 5 bits - */ -#define REG_BIM_CFG 0x1008 /* BIM Configuration */ -#define BIM_CFG_RESERVED0 0x001 /* reserved */ -#define BIM_CFG_RESERVED1 0x002 /* reserved */ -#define BIM_CFG_64BIT_DISABLE 0x004 /* disable 64-bit mode */ -#define BIM_CFG_66MHZ 0x008 /* (ro) 1 = 66MHz, 0 = < 66MHz */ -#define BIM_CFG_32BIT 0x010 /* (ro) 1 = 32-bit slot, 0 = 64-bit */ -#define BIM_CFG_DPAR_INTR_ENABLE 0x020 /* detected parity err enable */ -#define BIM_CFG_RMA_INTR_ENABLE 0x040 /* master abort intr enable */ -#define BIM_CFG_RTA_INTR_ENABLE 0x080 /* target abort intr enable */ -#define BIM_CFG_RESERVED2 0x100 /* reserved */ -#define BIM_CFG_BIM_DISABLE 0x200 /* stop BIM DMA. use before global - reset. reserved in Cassini. */ -#define BIM_CFG_BIM_STATUS 0x400 /* (ro) 1 = BIM DMA suspended. - reserved in Cassini. */ -#define BIM_CFG_PERROR_BLOCK 0x800 /* block PERR# to pci bus. def: 0. - reserved in Cassini. */ - -/* DEFAULT: 0x00000000, SIZE: 32 bits */ -#define REG_BIM_DIAG 0x100C /* BIM Diagnostic */ -#define BIM_DIAG_MSTR_SM_MASK 0x3FFFFF00 /* PCI master controller state - machine bits [21:0] */ -#define BIM_DIAG_BRST_SM_MASK 0x7F /* PCI burst controller state - machine bits [6:0] */ - -/* writing to SW_RESET_TX and SW_RESET_RX will issue a global - * reset. poll until TX and RX read back as 0's for completion. - */ -#define REG_SW_RESET 0x1010 /* Software reset */ -#define SW_RESET_TX 0x00000001 /* reset TX DMA engine. poll until - cleared to 0. */ -#define SW_RESET_RX 0x00000002 /* reset RX DMA engine. poll until - cleared to 0. */ -#define SW_RESET_RSTOUT 0x00000004 /* force RSTOUT# pin active (low). - resets PHY and anything else - connected to RSTOUT#. RSTOUT# - is also activated by local PCI - reset when hot-swap is being - done. */ -#define SW_RESET_BLOCK_PCS_SLINK 0x00000008 /* if a global reset is done with - this bit set, PCS and SLINK - modules won't be reset. - i.e., link won't drop. */ -#define SW_RESET_BREQ_SM_MASK 0x00007F00 /* breq state machine [6:0] */ -#define SW_RESET_PCIARB_SM_MASK 0x00070000 /* pci arbitration state bits: - 0b000: ARB_IDLE1 - 0b001: ARB_IDLE2 - 0b010: ARB_WB_ACK - 0b011: ARB_WB_WAT - 0b100: ARB_RB_ACK - 0b101: ARB_RB_WAT - 0b110: ARB_RB_END - 0b111: ARB_WB_END */ -#define SW_RESET_RDPCI_SM_MASK 0x00300000 /* read pci state bits: - 0b00: RD_PCI_WAT - 0b01: RD_PCI_RDY - 0b11: RD_PCI_ACK */ -#define SW_RESET_RDARB_SM_MASK 0x00C00000 /* read arbitration state bits: - 0b00: AD_IDL_RX - 0b01: AD_ACK_RX - 0b10: AD_ACK_TX - 0b11: AD_IDL_TX */ -#define SW_RESET_WRPCI_SM_MASK 0x06000000 /* write pci state bits - 0b00: WR_PCI_WAT - 0b01: WR_PCI_RDY - 0b11: WR_PCI_ACK */ -#define SW_RESET_WRARB_SM_MASK 0x38000000 /* write arbitration state bits: - 0b000: ARB_IDLE1 - 0b001: ARB_IDLE2 - 0b010: ARB_TX_ACK - 0b011: ARB_TX_WAT - 0b100: ARB_RX_ACK - 0b110: ARB_RX_WAT */ - -/* Cassini only. 64-bit register used to check PCI datapath. when read, - * value written has both lower and upper 32-bit halves rotated to the right - * one bit position. e.g., FFFFFFFF FFFFFFFF -> 7FFFFFFF 7FFFFFFF - */ -#define REG_MINUS_BIM_DATAPATH_TEST 0x1018 /* Cassini: BIM datapath test - Cassini+: reserved */ - -/* output enables are provided for each device's chip select and for the rest - * of the outputs from cassini to its local bus devices. two sw programmable - * bits are connected to general purpus control/status bits. - * DEFAULT: 0x7 - */ -#define REG_BIM_LOCAL_DEV_EN 0x1020 /* BIM local device - output EN. default: 0x7 */ -#define BIM_LOCAL_DEV_PAD 0x01 /* address bus, RW signal, and - OE signal output enable on the - local bus interface. these - are shared between both local - bus devices. tristate when 0. */ -#define BIM_LOCAL_DEV_PROM 0x02 /* PROM chip select */ -#define BIM_LOCAL_DEV_EXT 0x04 /* secondary local bus device chip - select output enable */ -#define BIM_LOCAL_DEV_SOFT_0 0x08 /* sw programmable ctrl bit 0 */ -#define BIM_LOCAL_DEV_SOFT_1 0x10 /* sw programmable ctrl bit 1 */ -#define BIM_LOCAL_DEV_HW_RESET 0x20 /* internal hw reset. Cassini+ only. */ - -/* access 24 entry BIM read and write buffers. put address in REG_BIM_BUFFER_ADDR - * and read/write from/to it REG_BIM_BUFFER_DATA_LOW and _DATA_HI. - * _DATA_HI should be the last access of the sequence. - * DEFAULT: undefined - */ -#define REG_BIM_BUFFER_ADDR 0x1024 /* BIM buffer address. for - purposes. */ -#define BIM_BUFFER_ADDR_MASK 0x3F /* index (0 - 23) of buffer */ -#define BIM_BUFFER_WR_SELECT 0x40 /* write buffer access = 1 - read buffer access = 0 */ -/* DEFAULT: undefined */ -#define REG_BIM_BUFFER_DATA_LOW 0x1028 /* BIM buffer data low */ -#define REG_BIM_BUFFER_DATA_HI 0x102C /* BIM buffer data high */ - -/* set BIM_RAM_BIST_START to start built-in self test for BIM read buffer. - * bit auto-clears when done with status read from _SUMMARY and _PASS bits. - */ -#define REG_BIM_RAM_BIST 0x102C /* BIM RAM (read buffer) BIST - control/status */ -#define BIM_RAM_BIST_RD_START 0x01 /* start BIST for BIM read buffer */ -#define BIM_RAM_BIST_WR_START 0x02 /* start BIST for BIM write buffer. - Cassini only. reserved in - Cassini+. */ -#define BIM_RAM_BIST_RD_PASS 0x04 /* summary BIST pass status for read - buffer. */ -#define BIM_RAM_BIST_WR_PASS 0x08 /* summary BIST pass status for write - buffer. Cassini only. reserved - in Cassini+. */ -#define BIM_RAM_BIST_RD_LOW_PASS 0x10 /* read low bank passes BIST */ -#define BIM_RAM_BIST_RD_HI_PASS 0x20 /* read high bank passes BIST */ -#define BIM_RAM_BIST_WR_LOW_PASS 0x40 /* write low bank passes BIST. - Cassini only. reserved in - Cassini+. */ -#define BIM_RAM_BIST_WR_HI_PASS 0x80 /* write high bank passes BIST. - Cassini only. reserved in - Cassini+. */ - -/* ASUN: i'm not sure what this does as it's not in the spec. - * DEFAULT: 0xFC - */ -#define REG_BIM_DIAG_MUX 0x1030 /* BIM diagnostic probe mux - select register */ - -/* enable probe monitoring mode and select data appearing on the P_A* bus. bit - * values for _SEL_HI_MASK and _SEL_LOW_MASK: - * 0x0: internal probe[7:0] (pci arb state, wtc empty w, wtc full w, wtc empty w, - * wtc empty r, post pci) - * 0x1: internal probe[15:8] (pci wbuf comp, pci wpkt comp, pci rbuf comp, - * pci rpkt comp, txdma wr req, txdma wr ack, - * txdma wr rdy, txdma wr xfr done) - * 0x2: internal probe[23:16] (txdma rd req, txdma rd ack, txdma rd rdy, rxdma rd, - * rd arb state, rd pci state) - * 0x3: internal probe[31:24] (rxdma req, rxdma ack, rxdma rdy, wrarb state, - * wrpci state) - * 0x4: pci io probe[7:0] 0x5: pci io probe[15:8] - * 0x6: pci io probe[23:16] 0x7: pci io probe[31:24] - * 0x8: pci io probe[39:32] 0x9: pci io probe[47:40] - * 0xa: pci io probe[55:48] 0xb: pci io probe[63:56] - * the following are not available in Cassini: - * 0xc: rx probe[7:0] 0xd: tx probe[7:0] - * 0xe: hp probe[7:0] 0xf: mac probe[7:0] - */ -#define REG_PLUS_PROBE_MUX_SELECT 0x1034 /* Cassini+: PROBE MUX SELECT */ -#define PROBE_MUX_EN 0x80000000 /* allow probe signals to be - driven on local bus P_A[15:0] - for debugging */ -#define PROBE_MUX_SUB_MUX_MASK 0x0000FF00 /* select sub module probe signals: - 0x03 = mac[1:0] - 0x0C = rx[1:0] - 0x30 = tx[1:0] - 0xC0 = hp[1:0] */ -#define PROBE_MUX_SEL_HI_MASK 0x000000F0 /* select which module to appear - on P_A[15:8]. see above for - values. */ -#define PROBE_MUX_SEL_LOW_MASK 0x0000000F /* select which module to appear - on P_A[7:0]. see above for - values. */ - -/* values mean the same thing as REG_INTR_MASK excep that it's for INTB. - DEFAULT: 0x1F */ -#define REG_PLUS_INTR_MASK_1 0x1038 /* Cassini+: interrupt mask - register 2 for INTB */ -#define REG_PLUS_INTRN_MASK(x) (REG_PLUS_INTR_MASK_1 + ((x) - 1)*16) -/* bits correspond to both _MASK and _STATUS registers. _ALT corresponds to - * all of the alternate (2-4) INTR registers while _1 corresponds to only - * _MASK_1 and _STATUS_1 registers. - * DEFAULT: 0x7 for MASK registers, 0x0 for ALIAS_CLEAR registers - */ -#define INTR_RX_DONE_ALT 0x01 -#define INTR_RX_COMP_FULL_ALT 0x02 -#define INTR_RX_COMP_AF_ALT 0x04 -#define INTR_RX_BUF_UNAVAIL_1 0x08 -#define INTR_RX_BUF_AE_1 0x10 /* almost empty */ -#define INTRN_MASK_RX_EN 0x80 -#define INTRN_MASK_CLEAR_ALL (INTR_RX_DONE_ALT | \ - INTR_RX_COMP_FULL_ALT | \ - INTR_RX_COMP_AF_ALT | \ - INTR_RX_BUF_UNAVAIL_1 | \ - INTR_RX_BUF_AE_1) -#define REG_PLUS_INTR_STATUS_1 0x103C /* Cassini+: interrupt status - register 2 for INTB. default: 0x1F */ -#define REG_PLUS_INTRN_STATUS(x) (REG_PLUS_INTR_STATUS_1 + ((x) - 1)*16) -#define INTR_STATUS_ALT_INTX_EN 0x80 /* generate INTX when one of the - flags are set. enables desc ring. */ - -#define REG_PLUS_ALIAS_CLEAR_1 0x1040 /* Cassini+: alias clear mask - register 2 for INTB */ -#define REG_PLUS_ALIASN_CLEAR(x) (REG_PLUS_ALIAS_CLEAR_1 + ((x) - 1)*16) - -#define REG_PLUS_INTR_STATUS_ALIAS_1 0x1044 /* Cassini+: interrupt status - register alias 2 for INTB */ -#define REG_PLUS_INTRN_STATUS_ALIAS(x) (REG_PLUS_INTR_STATUS_ALIAS_1 + ((x) - 1)*16) - -#define REG_SATURN_PCFG 0x106c /* pin configuration register for - integrated macphy */ - -#define SATURN_PCFG_TLA 0x00000001 /* 1 = phy actled */ -#define SATURN_PCFG_FLA 0x00000002 /* 1 = phy link10led */ -#define SATURN_PCFG_CLA 0x00000004 /* 1 = phy link100led */ -#define SATURN_PCFG_LLA 0x00000008 /* 1 = phy link1000led */ -#define SATURN_PCFG_RLA 0x00000010 /* 1 = phy duplexled */ -#define SATURN_PCFG_PDS 0x00000020 /* phy debug mode. - 0 = normal */ -#define SATURN_PCFG_MTP 0x00000080 /* test point select */ -#define SATURN_PCFG_GMO 0x00000100 /* GMII observe. 1 = - GMII on SERDES pins for - monitoring. */ -#define SATURN_PCFG_FSI 0x00000200 /* 1 = freeze serdes/gmii. all - pins configed as outputs. - for power saving when using - internal phy. */ -#define SATURN_PCFG_LAD 0x00000800 /* 0 = mac core led ctrl - polarity from strapping - value. - 1 = mac core led ctrl - polarity active low. */ - - -/** transmit dma registers **/ -#define MAX_TX_RINGS_SHIFT 2 -#define MAX_TX_RINGS (1 << MAX_TX_RINGS_SHIFT) -#define MAX_TX_RINGS_MASK (MAX_TX_RINGS - 1) - -/* TX configuration. - * descr ring sizes size = 32 * (1 << n), n < 9. e.g., 0x8 = 8k. default: 0x8 - * DEFAULT: 0x3F000001 - */ -#define REG_TX_CFG 0x2004 /* TX config */ -#define TX_CFG_DMA_EN 0x00000001 /* enable TX DMA. if cleared, DMA - will stop after xfer of current - buffer has been completed. */ -#define TX_CFG_FIFO_PIO_SEL 0x00000002 /* TX DMA FIFO can be - accessed w/ FIFO addr - and data registers. - TX DMA should be - disabled. */ -#define TX_CFG_DESC_RING0_MASK 0x0000003C /* # desc entries in - ring 1. */ -#define TX_CFG_DESC_RING0_SHIFT 2 -#define TX_CFG_DESC_RINGN_MASK(a) (TX_CFG_DESC_RING0_MASK << (a)*4) -#define TX_CFG_DESC_RINGN_SHIFT(a) (TX_CFG_DESC_RING0_SHIFT + (a)*4) -#define TX_CFG_PACED_MODE 0x00100000 /* TX_ALL only set after - TX FIFO becomes empty. - if 0, TX_ALL set - if descr queue empty. */ -#define TX_CFG_DMA_RDPIPE_DIS 0x01000000 /* always set to 1 */ -#define TX_CFG_COMPWB_Q1 0x02000000 /* completion writeback happens at - the end of every packet kicked - through Q1. */ -#define TX_CFG_COMPWB_Q2 0x04000000 /* completion writeback happens at - the end of every packet kicked - through Q2. */ -#define TX_CFG_COMPWB_Q3 0x08000000 /* completion writeback happens at - the end of every packet kicked - through Q3 */ -#define TX_CFG_COMPWB_Q4 0x10000000 /* completion writeback happens at - the end of every packet kicked - through Q4 */ -#define TX_CFG_INTR_COMPWB_DIS 0x20000000 /* disable pre-interrupt completion - writeback */ -#define TX_CFG_CTX_SEL_MASK 0xC0000000 /* selects tx test port - connection - 0b00: tx mac req, - tx mac retry req, - tx ack and tx tag. - 0b01: txdma rd req, - txdma rd ack, - txdma rd rdy, - txdma rd type0 - 0b11: txdma wr req, - txdma wr ack, - txdma wr rdy, - txdma wr xfr done. */ -#define TX_CFG_CTX_SEL_SHIFT 30 - -/* 11-bit counters that point to next location in FIFO to be loaded/retrieved. - * used for diagnostics only. - */ -#define REG_TX_FIFO_WRITE_PTR 0x2014 /* TX FIFO write pointer */ -#define REG_TX_FIFO_SHADOW_WRITE_PTR 0x2018 /* TX FIFO shadow write - pointer. temp hold reg. - diagnostics only. */ -#define REG_TX_FIFO_READ_PTR 0x201C /* TX FIFO read pointer */ -#define REG_TX_FIFO_SHADOW_READ_PTR 0x2020 /* TX FIFO shadow read - pointer */ - -/* (ro) 11-bit up/down counter w/ # of frames currently in TX FIFO */ -#define REG_TX_FIFO_PKT_CNT 0x2024 /* TX FIFO packet counter */ - -/* current state of all state machines in TX */ -#define REG_TX_SM_1 0x2028 /* TX state machine reg #1 */ -#define TX_SM_1_CHAIN_MASK 0x000003FF /* chaining state machine */ -#define TX_SM_1_CSUM_MASK 0x00000C00 /* checksum state machine */ -#define TX_SM_1_FIFO_LOAD_MASK 0x0003F000 /* FIFO load state machine. - = 0x01 when TX disabled. */ -#define TX_SM_1_FIFO_UNLOAD_MASK 0x003C0000 /* FIFO unload state machine */ -#define TX_SM_1_CACHE_MASK 0x03C00000 /* desc. prefetch cache controller - state machine */ -#define TX_SM_1_CBQ_ARB_MASK 0xF8000000 /* CBQ arbiter state machine */ - -#define REG_TX_SM_2 0x202C /* TX state machine reg #2 */ -#define TX_SM_2_COMP_WB_MASK 0x07 /* completion writeback sm */ -#define TX_SM_2_SUB_LOAD_MASK 0x38 /* sub load state machine */ -#define TX_SM_2_KICK_MASK 0xC0 /* kick state machine */ - -/* 64-bit pointer to the transmit data buffer. only the 50 LSB are incremented - * while the upper 23 bits are taken from the TX descriptor - */ -#define REG_TX_DATA_PTR_LOW 0x2030 /* TX data pointer low */ -#define REG_TX_DATA_PTR_HI 0x2034 /* TX data pointer high */ - -/* 13 bit registers written by driver w/ descriptor value that follows - * last valid xmit descriptor. kick # and complete # values are used by - * the xmit dma engine to control tx descr fetching. if > 1 valid - * tx descr is available within the cache line being read, cassini will - * internally cache up to 4 of them. 0 on reset. _KICK = rw, _COMP = ro. - */ -#define REG_TX_KICK0 0x2038 /* TX kick reg #1 */ -#define REG_TX_KICKN(x) (REG_TX_KICK0 + (x)*4) -#define REG_TX_COMP0 0x2048 /* TX completion reg #1 */ -#define REG_TX_COMPN(x) (REG_TX_COMP0 + (x)*4) - -/* values of TX_COMPLETE_1-4 are written. each completion register - * is 2bytes in size and contiguous. 8B allocation w/ 8B alignment. - * NOTE: completion reg values are only written back prior to TX_INTME and - * TX_ALL interrupts. at all other times, the most up-to-date index values - * should be obtained from the REG_TX_COMPLETE_# registers. - * here's the layout: - * offset from base addr completion # byte - * 0 TX_COMPLETE_1_MSB - * 1 TX_COMPLETE_1_LSB - * 2 TX_COMPLETE_2_MSB - * 3 TX_COMPLETE_2_LSB - * 4 TX_COMPLETE_3_MSB - * 5 TX_COMPLETE_3_LSB - * 6 TX_COMPLETE_4_MSB - * 7 TX_COMPLETE_4_LSB - */ -#define TX_COMPWB_SIZE 8 -#define REG_TX_COMPWB_DB_LOW 0x2058 /* TX completion write back - base low */ -#define REG_TX_COMPWB_DB_HI 0x205C /* TX completion write back - base high */ -#define TX_COMPWB_MSB_MASK 0x00000000000000FFULL -#define TX_COMPWB_MSB_SHIFT 0 -#define TX_COMPWB_LSB_MASK 0x000000000000FF00ULL -#define TX_COMPWB_LSB_SHIFT 8 -#define TX_COMPWB_NEXT(x) ((x) >> 16) - -/* 53 MSB used as base address. 11 LSB assumed to be 0. TX desc pointer must - * be 2KB-aligned. */ -#define REG_TX_DB0_LOW 0x2060 /* TX descriptor base low #1 */ -#define REG_TX_DB0_HI 0x2064 /* TX descriptor base hi #1 */ -#define REG_TX_DBN_LOW(x) (REG_TX_DB0_LOW + (x)*8) -#define REG_TX_DBN_HI(x) (REG_TX_DB0_HI + (x)*8) - -/* 16-bit registers hold weights for the weighted round-robin of the - * four CBQ TX descr rings. weights correspond to # bytes xferred from - * host to TXFIFO in a round of WRR arbitration. can be set - * dynamically with new weights set upon completion of the current - * packet transfer from host memory to TXFIFO. a dummy write to any of - * these registers causes a queue1 pre-emption with all historical bw - * deficit data reset to 0 (useful when congestion requires a - * pre-emption/re-allocation of network bandwidth - */ -#define REG_TX_MAXBURST_0 0x2080 /* TX MaxBurst #1 */ -#define REG_TX_MAXBURST_1 0x2084 /* TX MaxBurst #2 */ -#define REG_TX_MAXBURST_2 0x2088 /* TX MaxBurst #3 */ -#define REG_TX_MAXBURST_3 0x208C /* TX MaxBurst #4 */ - -/* diagnostics access to any TX FIFO location. every access is 65 - * bits. _DATA_LOW = 32 LSB, _DATA_HI_T1/T0 = 32 MSB. _TAG = tag bit. - * writing _DATA_HI_T0 sets tag bit low, writing _DATA_HI_T1 sets tag - * bit high. TX_FIFO_PIO_SEL must be set for TX FIFO PIO access. if - * TX FIFO data integrity is desired, TX DMA should be - * disabled. _DATA_HI_Tx should be the last access of the sequence. - */ -#define REG_TX_FIFO_ADDR 0x2104 /* TX FIFO address */ -#define REG_TX_FIFO_TAG 0x2108 /* TX FIFO tag */ -#define REG_TX_FIFO_DATA_LOW 0x210C /* TX FIFO data low */ -#define REG_TX_FIFO_DATA_HI_T1 0x2110 /* TX FIFO data high t1 */ -#define REG_TX_FIFO_DATA_HI_T0 0x2114 /* TX FIFO data high t0 */ -#define REG_TX_FIFO_SIZE 0x2118 /* (ro) TX FIFO size = 0x090 = 9KB */ - -/* 9-bit register controls BIST of TX FIFO. bit set indicates that the BIST - * passed for the specified memory - */ -#define REG_TX_RAMBIST 0x211C /* TX RAMBIST control/status */ -#define TX_RAMBIST_STATE 0x01C0 /* progress state of RAMBIST - controller state machine */ -#define TX_RAMBIST_RAM33A_PASS 0x0020 /* RAM33A passed */ -#define TX_RAMBIST_RAM32A_PASS 0x0010 /* RAM32A passed */ -#define TX_RAMBIST_RAM33B_PASS 0x0008 /* RAM33B passed */ -#define TX_RAMBIST_RAM32B_PASS 0x0004 /* RAM32B passed */ -#define TX_RAMBIST_SUMMARY 0x0002 /* all RAM passed */ -#define TX_RAMBIST_START 0x0001 /* write 1 to start BIST. self - clears on completion. */ - -/** receive dma registers **/ -#define MAX_RX_DESC_RINGS 2 -#define MAX_RX_COMP_RINGS 4 - -/* receive DMA channel configuration. default: 0x80910 - * free ring size = (1 << n)*32 -> [32 - 8k] - * completion ring size = (1 << n)*128 -> [128 - 32k], n < 9 - * DEFAULT: 0x80910 - */ -#define REG_RX_CFG 0x4000 /* RX config */ -#define RX_CFG_DMA_EN 0x00000001 /* enable RX DMA. 0 stops - channel as soon as current - frame xfer has completed. - driver should disable MAC - for 200ms before disabling - RX */ -#define RX_CFG_DESC_RING_MASK 0x0000001E /* # desc entries in RX - free desc ring. - def: 0x8 = 8k */ -#define RX_CFG_DESC_RING_SHIFT 1 -#define RX_CFG_COMP_RING_MASK 0x000001E0 /* # desc entries in RX complete - ring. def: 0x8 = 32k */ -#define RX_CFG_COMP_RING_SHIFT 5 -#define RX_CFG_BATCH_DIS 0x00000200 /* disable receive desc - batching. def: 0x0 = - enabled */ -#define RX_CFG_SWIVEL_MASK 0x00001C00 /* byte offset of the 1st - data byte of the packet - w/in 8 byte boundares. - this swivels the data - DMA'ed to header - buffers, jumbo buffers - when header split is not - requested and MTU sized - buffers. def: 0x2 */ -#define RX_CFG_SWIVEL_SHIFT 10 - -/* cassini+ only */ -#define RX_CFG_DESC_RING1_MASK 0x000F0000 /* # of desc entries in - RX free desc ring 2. - def: 0x8 = 8k */ -#define RX_CFG_DESC_RING1_SHIFT 16 - - -/* the page size register allows cassini chips to do the following with - * received data: - * [--------------------------------------------------------------] page - * [off][buf1][pad][off][buf2][pad][off][buf3][pad][off][buf4][pad] - * |--------------| = PAGE_SIZE_BUFFER_STRIDE - * page = PAGE_SIZE - * offset = PAGE_SIZE_MTU_OFF - * for the above example, MTU_BUFFER_COUNT = 4. - * NOTE: as is apparent, you need to ensure that the following holds: - * MTU_BUFFER_COUNT <= PAGE_SIZE/PAGE_SIZE_BUFFER_STRIDE - * DEFAULT: 0x48002002 (8k pages) - */ -#define REG_RX_PAGE_SIZE 0x4004 /* RX page size */ -#define RX_PAGE_SIZE_MASK 0x00000003 /* size of pages pointed to - by receive descriptors. - if jumbo buffers are - supported the page size - should not be < 8k. - 0b00 = 2k, 0b01 = 4k - 0b10 = 8k, 0b11 = 16k - DEFAULT: 8k */ -#define RX_PAGE_SIZE_SHIFT 0 -#define RX_PAGE_SIZE_MTU_COUNT_MASK 0x00007800 /* # of MTU buffers the hw - packs into a page. - DEFAULT: 4 */ -#define RX_PAGE_SIZE_MTU_COUNT_SHIFT 11 -#define RX_PAGE_SIZE_MTU_STRIDE_MASK 0x18000000 /* # of bytes that separate - each MTU buffer + - offset from each - other. - 0b00 = 1k, 0b01 = 2k - 0b10 = 4k, 0b11 = 8k - DEFAULT: 0x1 */ -#define RX_PAGE_SIZE_MTU_STRIDE_SHIFT 27 -#define RX_PAGE_SIZE_MTU_OFF_MASK 0xC0000000 /* offset in each page that - hw writes the MTU buffer - into. - 0b00 = 0, - 0b01 = 64 bytes - 0b10 = 96, 0b11 = 128 - DEFAULT: 0x1 */ -#define RX_PAGE_SIZE_MTU_OFF_SHIFT 30 - -/* 11-bit counter points to next location in RX FIFO to be loaded/read. - * shadow write pointers enable retries in case of early receive aborts. - * DEFAULT: 0x0. generated on 64-bit boundaries. - */ -#define REG_RX_FIFO_WRITE_PTR 0x4008 /* RX FIFO write pointer */ -#define REG_RX_FIFO_READ_PTR 0x400C /* RX FIFO read pointer */ -#define REG_RX_IPP_FIFO_SHADOW_WRITE_PTR 0x4010 /* RX IPP FIFO shadow write - pointer */ -#define REG_RX_IPP_FIFO_SHADOW_READ_PTR 0x4014 /* RX IPP FIFO shadow read - pointer */ -#define REG_RX_IPP_FIFO_READ_PTR 0x400C /* RX IPP FIFO read - pointer. (8-bit counter) */ - -/* current state of RX DMA state engines + other info - * DEFAULT: 0x0 - */ -#define REG_RX_DEBUG 0x401C /* RX debug */ -#define RX_DEBUG_LOAD_STATE_MASK 0x0000000F /* load state machine w/ MAC: - 0x0 = idle, 0x1 = load_bop - 0x2 = load 1, 0x3 = load 2 - 0x4 = load 3, 0x5 = load 4 - 0x6 = last detect - 0x7 = wait req - 0x8 = wait req statuss 1st - 0x9 = load st - 0xa = bubble mac - 0xb = error */ -#define RX_DEBUG_LM_STATE_MASK 0x00000070 /* load state machine w/ HP and - RX FIFO: - 0x0 = idle, 0x1 = hp xfr - 0x2 = wait hp ready - 0x3 = wait flow code - 0x4 = fifo xfer - 0x5 = make status - 0x6 = csum ready - 0x7 = error */ -#define RX_DEBUG_FC_STATE_MASK 0x000000180 /* flow control state machine - w/ MAC: - 0x0 = idle - 0x1 = wait xoff ack - 0x2 = wait xon - 0x3 = wait xon ack */ -#define RX_DEBUG_DATA_STATE_MASK 0x000001E00 /* unload data state machine - states: - 0x0 = idle data - 0x1 = header begin - 0x2 = xfer header - 0x3 = xfer header ld - 0x4 = mtu begin - 0x5 = xfer mtu - 0x6 = xfer mtu ld - 0x7 = jumbo begin - 0x8 = xfer jumbo - 0x9 = xfer jumbo ld - 0xa = reas begin - 0xb = xfer reas - 0xc = flush tag - 0xd = xfer reas ld - 0xe = error - 0xf = bubble idle */ -#define RX_DEBUG_DESC_STATE_MASK 0x0001E000 /* unload desc state machine - states: - 0x0 = idle desc - 0x1 = wait ack - 0x9 = wait ack 2 - 0x2 = fetch desc 1 - 0xa = fetch desc 2 - 0x3 = load ptrs - 0x4 = wait dma - 0x5 = wait ack batch - 0x6 = post batch - 0x7 = xfr done */ -#define RX_DEBUG_INTR_READ_PTR_MASK 0x30000000 /* interrupt read ptr of the - interrupt queue */ -#define RX_DEBUG_INTR_WRITE_PTR_MASK 0xC0000000 /* interrupt write pointer - of the interrupt queue */ - -/* flow control frames are emmitted using two PAUSE thresholds: - * XOFF PAUSE uses pause time value pre-programmed in the Send PAUSE MAC reg - * XON PAUSE uses a pause time of 0. granularity of threshold is 64bytes. - * PAUSE thresholds defined in terms of FIFO occupancy and may be translated - * into FIFO vacancy using RX_FIFO_SIZE. setting ON will trigger XON frames - * when FIFO reaches 0. OFF threshold should not be > size of RX FIFO. max - * value is is 0x6F. - * DEFAULT: 0x00078 - */ -#define REG_RX_PAUSE_THRESH 0x4020 /* RX pause thresholds */ -#define RX_PAUSE_THRESH_QUANTUM 64 -#define RX_PAUSE_THRESH_OFF_MASK 0x000001FF /* XOFF PAUSE emitted when - RX FIFO occupancy > - value*64B */ -#define RX_PAUSE_THRESH_OFF_SHIFT 0 -#define RX_PAUSE_THRESH_ON_MASK 0x001FF000 /* XON PAUSE emitted after - emitting XOFF PAUSE when RX - FIFO occupancy falls below - this value*64B. must be - < XOFF threshold. if = - RX_FIFO_SIZE< XON frames are - never emitted. */ -#define RX_PAUSE_THRESH_ON_SHIFT 12 - -/* 13-bit register used to control RX desc fetching and intr generation. if 4+ - * valid RX descriptors are available, Cassini will read 4 at a time. - * writing N means that all desc up to *but* excluding N are available. N must - * be a multiple of 4 (N % 4 = 0). first desc should be cache-line aligned. - * DEFAULT: 0 on reset - */ -#define REG_RX_KICK 0x4024 /* RX kick reg */ - -/* 8KB aligned 64-bit pointer to the base of the RX free/completion rings. - * lower 13 bits of the low register are hard-wired to 0. - */ -#define REG_RX_DB_LOW 0x4028 /* RX descriptor ring - base low */ -#define REG_RX_DB_HI 0x402C /* RX descriptor ring - base hi */ -#define REG_RX_CB_LOW 0x4030 /* RX completion ring - base low */ -#define REG_RX_CB_HI 0x4034 /* RX completion ring - base hi */ -/* 13-bit register indicate desc used by cassini for receive frames. used - * for diagnostic purposes. - * DEFAULT: 0 on reset - */ -#define REG_RX_COMP 0x4038 /* (ro) RX completion */ - -/* HEAD and TAIL are used to control RX desc posting and interrupt - * generation. hw moves the head register to pass ownership to sw. sw - * moves the tail register to pass ownership back to hw. to give all - * entries to hw, set TAIL = HEAD. if HEAD and TAIL indicate that no - * more entries are available, DMA will pause and an interrupt will be - * generated to indicate no more entries are available. sw can use - * this interrupt to reduce the # of times it must update the - * completion tail register. - * DEFAULT: 0 on reset - */ -#define REG_RX_COMP_HEAD 0x403C /* RX completion head */ -#define REG_RX_COMP_TAIL 0x4040 /* RX completion tail */ - -/* values used for receive interrupt blanking. loaded each time the ISR is read - * DEFAULT: 0x00000000 - */ -#define REG_RX_BLANK 0x4044 /* RX blanking register - for ISR read */ -#define RX_BLANK_INTR_PKT_MASK 0x000001FF /* RX_DONE intr asserted if - this many sets of completion - writebacks (up to 2 packets) - occur since the last time - the ISR was read. 0 = no - packet blanking */ -#define RX_BLANK_INTR_PKT_SHIFT 0 -#define RX_BLANK_INTR_TIME_MASK 0x3FFFF000 /* RX_DONE interrupt asserted - if that many clocks were - counted since last time the - ISR was read. - each count is 512 core - clocks (125MHz). 0 = no - time blanking */ -#define RX_BLANK_INTR_TIME_SHIFT 12 - -/* values used for interrupt generation based on threshold values of how - * many free desc and completion entries are available for hw use. - * DEFAULT: 0x00000000 - */ -#define REG_RX_AE_THRESH 0x4048 /* RX almost empty - thresholds */ -#define RX_AE_THRESH_FREE_MASK 0x00001FFF /* RX_BUF_AE will be - generated if # desc - avail for hw use <= - # */ -#define RX_AE_THRESH_FREE_SHIFT 0 -#define RX_AE_THRESH_COMP_MASK 0x0FFFE000 /* RX_COMP_AE will be - generated if # of - completion entries - avail for hw use <= - # */ -#define RX_AE_THRESH_COMP_SHIFT 13 - -/* probabilities for random early drop (RED) thresholds on a FIFO threshold - * basis. probability should increase when the FIFO level increases. control - * packets are never dropped and not counted in stats. probability programmed - * on a 12.5% granularity. e.g., 0x1 = 1/8 packets dropped. - * DEFAULT: 0x00000000 - */ -#define REG_RX_RED 0x404C /* RX random early detect enable */ -#define RX_RED_4K_6K_FIFO_MASK 0x000000FF /* 4KB < FIFO thresh < 6KB */ -#define RX_RED_6K_8K_FIFO_MASK 0x0000FF00 /* 6KB < FIFO thresh < 8KB */ -#define RX_RED_8K_10K_FIFO_MASK 0x00FF0000 /* 8KB < FIFO thresh < 10KB */ -#define RX_RED_10K_12K_FIFO_MASK 0xFF000000 /* 10KB < FIFO thresh < 12KB */ - -/* FIFO fullness levels for RX FIFO, RX control FIFO, and RX IPP FIFO. - * RX control FIFO = # of packets in RX FIFO. - * DEFAULT: 0x0 - */ -#define REG_RX_FIFO_FULLNESS 0x4050 /* (ro) RX FIFO fullness */ -#define RX_FIFO_FULLNESS_RX_FIFO_MASK 0x3FF80000 /* level w/ 8B granularity */ -#define RX_FIFO_FULLNESS_IPP_FIFO_MASK 0x0007FF00 /* level w/ 8B granularity */ -#define RX_FIFO_FULLNESS_RX_PKT_MASK 0x000000FF /* # packets in RX FIFO */ -#define REG_RX_IPP_PACKET_COUNT 0x4054 /* RX IPP packet counter */ -#define REG_RX_WORK_DMA_PTR_LOW 0x4058 /* RX working DMA ptr low */ -#define REG_RX_WORK_DMA_PTR_HI 0x405C /* RX working DMA ptr - high */ - -/* BIST testing ro RX FIFO, RX control FIFO, and RX IPP FIFO. only RX BIST - * START/COMPLETE is writeable. START will clear when the BIST has completed - * checking all 17 RAMS. - * DEFAULT: 0bxxxx xxxxx xxxx xxxx xxxx x000 0000 0000 00x0 - */ -#define REG_RX_BIST 0x4060 /* (ro) RX BIST */ -#define RX_BIST_32A_PASS 0x80000000 /* RX FIFO 32A passed */ -#define RX_BIST_33A_PASS 0x40000000 /* RX FIFO 33A passed */ -#define RX_BIST_32B_PASS 0x20000000 /* RX FIFO 32B passed */ -#define RX_BIST_33B_PASS 0x10000000 /* RX FIFO 33B passed */ -#define RX_BIST_32C_PASS 0x08000000 /* RX FIFO 32C passed */ -#define RX_BIST_33C_PASS 0x04000000 /* RX FIFO 33C passed */ -#define RX_BIST_IPP_32A_PASS 0x02000000 /* RX IPP FIFO 33B passed */ -#define RX_BIST_IPP_33A_PASS 0x01000000 /* RX IPP FIFO 33A passed */ -#define RX_BIST_IPP_32B_PASS 0x00800000 /* RX IPP FIFO 32B passed */ -#define RX_BIST_IPP_33B_PASS 0x00400000 /* RX IPP FIFO 33B passed */ -#define RX_BIST_IPP_32C_PASS 0x00200000 /* RX IPP FIFO 32C passed */ -#define RX_BIST_IPP_33C_PASS 0x00100000 /* RX IPP FIFO 33C passed */ -#define RX_BIST_CTRL_32_PASS 0x00800000 /* RX CTRL FIFO 32 passed */ -#define RX_BIST_CTRL_33_PASS 0x00400000 /* RX CTRL FIFO 33 passed */ -#define RX_BIST_REAS_26A_PASS 0x00200000 /* RX Reas 26A passed */ -#define RX_BIST_REAS_26B_PASS 0x00100000 /* RX Reas 26B passed */ -#define RX_BIST_REAS_27_PASS 0x00080000 /* RX Reas 27 passed */ -#define RX_BIST_STATE_MASK 0x00078000 /* BIST state machine */ -#define RX_BIST_SUMMARY 0x00000002 /* when BIST complete, - summary pass bit - contains AND of BIST - results of all 16 - RAMS */ -#define RX_BIST_START 0x00000001 /* write 1 to start - BIST. self clears - on completion. */ - -/* next location in RX CTRL FIFO that will be loaded w/ data from RX IPP/read - * from to retrieve packet control info. - * DEFAULT: 0 - */ -#define REG_RX_CTRL_FIFO_WRITE_PTR 0x4064 /* (ro) RX control FIFO - write ptr */ -#define REG_RX_CTRL_FIFO_READ_PTR 0x4068 /* (ro) RX control FIFO read - ptr */ - -/* receive interrupt blanking. loaded each time interrupt alias register is - * read. - * DEFAULT: 0x0 - */ -#define REG_RX_BLANK_ALIAS_READ 0x406C /* RX blanking register for - alias read */ -#define RX_BAR_INTR_PACKET_MASK 0x000001FF /* assert RX_DONE if # - completion writebacks - > # since last ISR - read. 0 = no - blanking. up to 2 - packets per - completion wb. */ -#define RX_BAR_INTR_TIME_MASK 0x3FFFF000 /* assert RX_DONE if # - clocks > # since last - ISR read. each count - is 512 core clocks - (125MHz). 0 = no - blanking. */ - -/* diagnostic access to RX FIFO. 32 LSB accessed via DATA_LOW. 32 MSB accessed - * via DATA_HI_T0 or DATA_HI_T1. TAG reads the tag bit. writing HI_T0 - * will unset the tag bit while writing HI_T1 will set the tag bit. to reset - * to normal operation after diagnostics, write to address location 0x0. - * RX_DMA_EN bit must be set to 0x0 for RX FIFO PIO access. DATA_HI should - * be the last write access of a write sequence. - * DEFAULT: undefined - */ -#define REG_RX_FIFO_ADDR 0x4080 /* RX FIFO address */ -#define REG_RX_FIFO_TAG 0x4084 /* RX FIFO tag */ -#define REG_RX_FIFO_DATA_LOW 0x4088 /* RX FIFO data low */ -#define REG_RX_FIFO_DATA_HI_T0 0x408C /* RX FIFO data high T0 */ -#define REG_RX_FIFO_DATA_HI_T1 0x4090 /* RX FIFO data high T1 */ - -/* diagnostic assess to RX CTRL FIFO. 8-bit FIFO_ADDR holds address of - * 81 bit control entry and 6 bit flow id. LOW and MID are both 32-bit - * accesses. HI is 7-bits with 6-bit flow id and 1 bit control - * word. RX_DMA_EN must be 0 for RX CTRL FIFO PIO access. DATA_HI - * should be last write access of the write sequence. - * DEFAULT: undefined - */ -#define REG_RX_CTRL_FIFO_ADDR 0x4094 /* RX Control FIFO and - Batching FIFO addr */ -#define REG_RX_CTRL_FIFO_DATA_LOW 0x4098 /* RX Control FIFO data - low */ -#define REG_RX_CTRL_FIFO_DATA_MID 0x409C /* RX Control FIFO data - mid */ -#define REG_RX_CTRL_FIFO_DATA_HI 0x4100 /* RX Control FIFO data - hi and flow id */ -#define RX_CTRL_FIFO_DATA_HI_CTRL 0x0001 /* upper bit of ctrl word */ -#define RX_CTRL_FIFO_DATA_HI_FLOW_MASK 0x007E /* flow id */ - -/* diagnostic access to RX IPP FIFO. same semantics as RX_FIFO. - * DEFAULT: undefined - */ -#define REG_RX_IPP_FIFO_ADDR 0x4104 /* RX IPP FIFO address */ -#define REG_RX_IPP_FIFO_TAG 0x4108 /* RX IPP FIFO tag */ -#define REG_RX_IPP_FIFO_DATA_LOW 0x410C /* RX IPP FIFO data low */ -#define REG_RX_IPP_FIFO_DATA_HI_T0 0x4110 /* RX IPP FIFO data high - T0 */ -#define REG_RX_IPP_FIFO_DATA_HI_T1 0x4114 /* RX IPP FIFO data high - T1 */ - -/* 64-bit pointer to receive data buffer in host memory used for headers and - * small packets. MSB in high register. loaded by DMA state machine and - * increments as DMA writes receive data. only 50 LSB are incremented. top - * 13 bits taken from RX descriptor. - * DEFAULT: undefined - */ -#define REG_RX_HEADER_PAGE_PTR_LOW 0x4118 /* (ro) RX header page ptr - low */ -#define REG_RX_HEADER_PAGE_PTR_HI 0x411C /* (ro) RX header page ptr - high */ -#define REG_RX_MTU_PAGE_PTR_LOW 0x4120 /* (ro) RX MTU page pointer - low */ -#define REG_RX_MTU_PAGE_PTR_HI 0x4124 /* (ro) RX MTU page pointer - high */ - -/* PIO diagnostic access to RX reassembly DMA Table RAM. 6-bit register holds - * one of 64 79-bit locations in the RX Reassembly DMA table and the addr of - * one of the 64 byte locations in the Batching table. LOW holds 32 LSB. - * MID holds the next 32 LSB. HIGH holds the 15 MSB. RX_DMA_EN must be set - * to 0 for PIO access. DATA_HIGH should be last write of write sequence. - * layout: - * reassmbl ptr [78:15] | reassmbl index [14:1] | reassmbl entry valid [0] - * DEFAULT: undefined - */ -#define REG_RX_TABLE_ADDR 0x4128 /* RX reassembly DMA table - address */ -#define RX_TABLE_ADDR_MASK 0x0000003F /* address mask */ - -#define REG_RX_TABLE_DATA_LOW 0x412C /* RX reassembly DMA table - data low */ -#define REG_RX_TABLE_DATA_MID 0x4130 /* RX reassembly DMA table - data mid */ -#define REG_RX_TABLE_DATA_HI 0x4134 /* RX reassembly DMA table - data high */ - -/* cassini+ only */ -/* 8KB aligned 64-bit pointer to base of RX rings. lower 13 bits hardwired to - * 0. same semantics as primary desc/complete rings. - */ -#define REG_PLUS_RX_DB1_LOW 0x4200 /* RX descriptor ring - 2 base low */ -#define REG_PLUS_RX_DB1_HI 0x4204 /* RX descriptor ring - 2 base high */ -#define REG_PLUS_RX_CB1_LOW 0x4208 /* RX completion ring - 2 base low. 4 total */ -#define REG_PLUS_RX_CB1_HI 0x420C /* RX completion ring - 2 base high. 4 total */ -#define REG_PLUS_RX_CBN_LOW(x) (REG_PLUS_RX_CB1_LOW + 8*((x) - 1)) -#define REG_PLUS_RX_CBN_HI(x) (REG_PLUS_RX_CB1_HI + 8*((x) - 1)) -#define REG_PLUS_RX_KICK1 0x4220 /* RX Kick 2 register */ -#define REG_PLUS_RX_COMP1 0x4224 /* (ro) RX completion 2 - reg */ -#define REG_PLUS_RX_COMP1_HEAD 0x4228 /* (ro) RX completion 2 - head reg. 4 total. */ -#define REG_PLUS_RX_COMP1_TAIL 0x422C /* RX completion 2 - tail reg. 4 total. */ -#define REG_PLUS_RX_COMPN_HEAD(x) (REG_PLUS_RX_COMP1_HEAD + 8*((x) - 1)) -#define REG_PLUS_RX_COMPN_TAIL(x) (REG_PLUS_RX_COMP1_TAIL + 8*((x) - 1)) -#define REG_PLUS_RX_AE1_THRESH 0x4240 /* RX almost empty 2 - thresholds */ -#define RX_AE1_THRESH_FREE_MASK RX_AE_THRESH_FREE_MASK -#define RX_AE1_THRESH_FREE_SHIFT RX_AE_THRESH_FREE_SHIFT - -/** header parser registers **/ - -/* RX parser configuration register. - * DEFAULT: 0x1651004 - */ -#define REG_HP_CFG 0x4140 /* header parser - configuration reg */ -#define HP_CFG_PARSE_EN 0x00000001 /* enab header parsing */ -#define HP_CFG_NUM_CPU_MASK 0x000000FC /* # processors - 0 = 64. 0x3f = 63 */ -#define HP_CFG_NUM_CPU_SHIFT 2 -#define HP_CFG_SYN_INC_MASK 0x00000100 /* SYN bit won't increment - TCP seq # by one when - stored in FDBM */ -#define HP_CFG_TCP_THRESH_MASK 0x000FFE00 /* # bytes of TCP data - needed to be considered - for reassembly */ -#define HP_CFG_TCP_THRESH_SHIFT 9 - -/* access to RX Instruction RAM. 5-bit register/counter holds addr - * of 39 bit entry to be read/written. 32 LSB in _DATA_LOW. 7 MSB in _DATA_HI. - * RX_DMA_EN must be 0 for RX instr PIO access. DATA_HI should be last access - * of sequence. - * DEFAULT: undefined - */ -#define REG_HP_INSTR_RAM_ADDR 0x4144 /* HP instruction RAM - address */ -#define HP_INSTR_RAM_ADDR_MASK 0x01F /* 5-bit mask */ -#define REG_HP_INSTR_RAM_DATA_LOW 0x4148 /* HP instruction RAM - data low */ -#define HP_INSTR_RAM_LOW_OUTMASK_MASK 0x0000FFFF -#define HP_INSTR_RAM_LOW_OUTMASK_SHIFT 0 -#define HP_INSTR_RAM_LOW_OUTSHIFT_MASK 0x000F0000 -#define HP_INSTR_RAM_LOW_OUTSHIFT_SHIFT 16 -#define HP_INSTR_RAM_LOW_OUTEN_MASK 0x00300000 -#define HP_INSTR_RAM_LOW_OUTEN_SHIFT 20 -#define HP_INSTR_RAM_LOW_OUTARG_MASK 0xFFC00000 -#define HP_INSTR_RAM_LOW_OUTARG_SHIFT 22 -#define REG_HP_INSTR_RAM_DATA_MID 0x414C /* HP instruction RAM - data mid */ -#define HP_INSTR_RAM_MID_OUTARG_MASK 0x00000003 -#define HP_INSTR_RAM_MID_OUTARG_SHIFT 0 -#define HP_INSTR_RAM_MID_OUTOP_MASK 0x0000003C -#define HP_INSTR_RAM_MID_OUTOP_SHIFT 2 -#define HP_INSTR_RAM_MID_FNEXT_MASK 0x000007C0 -#define HP_INSTR_RAM_MID_FNEXT_SHIFT 6 -#define HP_INSTR_RAM_MID_FOFF_MASK 0x0003F800 -#define HP_INSTR_RAM_MID_FOFF_SHIFT 11 -#define HP_INSTR_RAM_MID_SNEXT_MASK 0x007C0000 -#define HP_INSTR_RAM_MID_SNEXT_SHIFT 18 -#define HP_INSTR_RAM_MID_SOFF_MASK 0x3F800000 -#define HP_INSTR_RAM_MID_SOFF_SHIFT 23 -#define HP_INSTR_RAM_MID_OP_MASK 0xC0000000 -#define HP_INSTR_RAM_MID_OP_SHIFT 30 -#define REG_HP_INSTR_RAM_DATA_HI 0x4150 /* HP instruction RAM - data high */ -#define HP_INSTR_RAM_HI_VAL_MASK 0x0000FFFF -#define HP_INSTR_RAM_HI_VAL_SHIFT 0 -#define HP_INSTR_RAM_HI_MASK_MASK 0xFFFF0000 -#define HP_INSTR_RAM_HI_MASK_SHIFT 16 - -/* PIO access into RX Header parser data RAM and flow database. - * 11-bit register. Data fills the LSB portion of bus if less than 32 bits. - * DATA_RAM: write RAM_FDB_DATA with index to access DATA_RAM. - * RAM bytes = 4*(x - 1) + [3:0]. e.g., 0 -> [3:0], 31 -> [123:120] - * FLOWDB: write DATA_RAM_FDB register and then read/write FDB1-12 to access - * flow database. - * RX_DMA_EN must be 0 for RX parser RAM PIO access. RX Parser RAM data reg - * should be the last write access of the write sequence. - * DEFAULT: undefined - */ -#define REG_HP_DATA_RAM_FDB_ADDR 0x4154 /* HP data and FDB - RAM address */ -#define HP_DATA_RAM_FDB_DATA_MASK 0x001F /* select 1 of 86 byte - locations in header - parser data ram to - read/write */ -#define HP_DATA_RAM_FDB_FDB_MASK 0x3F00 /* 1 of 64 353-bit locations - in the flow database */ -#define REG_HP_DATA_RAM_DATA 0x4158 /* HP data RAM data */ - -/* HP flow database registers: 1 - 12, 0x415C - 0x4188, 4 8-bit bytes - * FLOW_DB(1) = IP_SA[127:96], FLOW_DB(2) = IP_SA[95:64] - * FLOW_DB(3) = IP_SA[63:32], FLOW_DB(4) = IP_SA[31:0] - * FLOW_DB(5) = IP_DA[127:96], FLOW_DB(6) = IP_DA[95:64] - * FLOW_DB(7) = IP_DA[63:32], FLOW_DB(8) = IP_DA[31:0] - * FLOW_DB(9) = {TCP_SP[15:0],TCP_DP[15:0]} - * FLOW_DB(10) = bit 0 has value for flow valid - * FLOW_DB(11) = TCP_SEQ[63:32], FLOW_DB(12) = TCP_SEQ[31:0] - */ -#define REG_HP_FLOW_DB0 0x415C /* HP flow database 1 reg */ -#define REG_HP_FLOW_DBN(x) (REG_HP_FLOW_DB0 + (x)*4) - -/* diagnostics for RX Header Parser block. - * ASUN: the header parser state machine register is used for diagnostics - * purposes. however, the spec doesn't have any details on it. - */ -#define REG_HP_STATE_MACHINE 0x418C /* (ro) HP state machine */ -#define REG_HP_STATUS0 0x4190 /* (ro) HP status 1 */ -#define HP_STATUS0_SAP_MASK 0xFFFF0000 /* SAP */ -#define HP_STATUS0_L3_OFF_MASK 0x0000FE00 /* L3 offset */ -#define HP_STATUS0_LB_CPUNUM_MASK 0x000001F8 /* load balancing CPU - number */ -#define HP_STATUS0_HRP_OPCODE_MASK 0x00000007 /* HRP opcode */ - -#define REG_HP_STATUS1 0x4194 /* (ro) HP status 2 */ -#define HP_STATUS1_ACCUR2_MASK 0xE0000000 /* accu R2[6:4] */ -#define HP_STATUS1_FLOWID_MASK 0x1F800000 /* flow id */ -#define HP_STATUS1_TCP_OFF_MASK 0x007F0000 /* tcp payload offset */ -#define HP_STATUS1_TCP_SIZE_MASK 0x0000FFFF /* tcp payload size */ - -#define REG_HP_STATUS2 0x4198 /* (ro) HP status 3 */ -#define HP_STATUS2_ACCUR2_MASK 0xF0000000 /* accu R2[3:0] */ -#define HP_STATUS2_CSUM_OFF_MASK 0x07F00000 /* checksum start - start offset */ -#define HP_STATUS2_ACCUR1_MASK 0x000FE000 /* accu R1 */ -#define HP_STATUS2_FORCE_DROP 0x00001000 /* force drop */ -#define HP_STATUS2_BWO_REASSM 0x00000800 /* batching w/o - reassembly */ -#define HP_STATUS2_JH_SPLIT_EN 0x00000400 /* jumbo header split - enable */ -#define HP_STATUS2_FORCE_TCP_NOCHECK 0x00000200 /* force tcp no payload - check */ -#define HP_STATUS2_DATA_MASK_ZERO 0x00000100 /* mask of data length - equal to zero */ -#define HP_STATUS2_FORCE_TCP_CHECK 0x00000080 /* force tcp payload - chk */ -#define HP_STATUS2_MASK_TCP_THRESH 0x00000040 /* mask of payload - threshold */ -#define HP_STATUS2_NO_ASSIST 0x00000020 /* no assist */ -#define HP_STATUS2_CTRL_PACKET_FLAG 0x00000010 /* control packet flag */ -#define HP_STATUS2_TCP_FLAG_CHECK 0x00000008 /* tcp flag check */ -#define HP_STATUS2_SYN_FLAG 0x00000004 /* syn flag */ -#define HP_STATUS2_TCP_CHECK 0x00000002 /* tcp payload chk */ -#define HP_STATUS2_TCP_NOCHECK 0x00000001 /* tcp no payload chk */ - -/* BIST for header parser(HP) and flow database memories (FDBM). set _START - * to start BIST. controller clears _START on completion. _START can also - * be cleared to force termination of BIST. a bit set indicates that that - * memory passed its BIST. - */ -#define REG_HP_RAM_BIST 0x419C /* HP RAM BIST reg */ -#define HP_RAM_BIST_HP_DATA_PASS 0x80000000 /* HP data ram */ -#define HP_RAM_BIST_HP_INSTR0_PASS 0x40000000 /* HP instr ram 0 */ -#define HP_RAM_BIST_HP_INSTR1_PASS 0x20000000 /* HP instr ram 1 */ -#define HP_RAM_BIST_HP_INSTR2_PASS 0x10000000 /* HP instr ram 2 */ -#define HP_RAM_BIST_FDBM_AGE0_PASS 0x08000000 /* FDBM aging RAM0 */ -#define HP_RAM_BIST_FDBM_AGE1_PASS 0x04000000 /* FDBM aging RAM1 */ -#define HP_RAM_BIST_FDBM_FLOWID00_PASS 0x02000000 /* FDBM flowid RAM0 - bank 0 */ -#define HP_RAM_BIST_FDBM_FLOWID10_PASS 0x01000000 /* FDBM flowid RAM1 - bank 0 */ -#define HP_RAM_BIST_FDBM_FLOWID20_PASS 0x00800000 /* FDBM flowid RAM2 - bank 0 */ -#define HP_RAM_BIST_FDBM_FLOWID30_PASS 0x00400000 /* FDBM flowid RAM3 - bank 0 */ -#define HP_RAM_BIST_FDBM_FLOWID01_PASS 0x00200000 /* FDBM flowid RAM0 - bank 1 */ -#define HP_RAM_BIST_FDBM_FLOWID11_PASS 0x00100000 /* FDBM flowid RAM1 - bank 2 */ -#define HP_RAM_BIST_FDBM_FLOWID21_PASS 0x00080000 /* FDBM flowid RAM2 - bank 1 */ -#define HP_RAM_BIST_FDBM_FLOWID31_PASS 0x00040000 /* FDBM flowid RAM3 - bank 1 */ -#define HP_RAM_BIST_FDBM_TCPSEQ_PASS 0x00020000 /* FDBM tcp sequence - RAM */ -#define HP_RAM_BIST_SUMMARY 0x00000002 /* all BIST tests */ -#define HP_RAM_BIST_START 0x00000001 /* start/stop BIST */ - - -/** MAC registers. **/ -/* reset bits are set using a PIO write and self-cleared after the command - * execution has completed. - */ -#define REG_MAC_TX_RESET 0x6000 /* TX MAC software reset - command (default: 0x0) */ -#define REG_MAC_RX_RESET 0x6004 /* RX MAC software reset - command (default: 0x0) */ -/* execute a pause flow control frame transmission - DEFAULT: 0x0XXXX */ -#define REG_MAC_SEND_PAUSE 0x6008 /* send pause command reg */ -#define MAC_SEND_PAUSE_TIME_MASK 0x0000FFFF /* value of pause time - to be sent on network - in units of slot - times */ -#define MAC_SEND_PAUSE_SEND 0x00010000 /* send pause flow ctrl - frame on network */ - -/* bit set indicates that event occurred. auto-cleared when status register - * is read and have corresponding mask bits in mask register. events will - * trigger an interrupt if the corresponding mask bit is 0. - * status register default: 0x00000000 - * mask register default = 0xFFFFFFFF on reset - */ -#define REG_MAC_TX_STATUS 0x6010 /* TX MAC status reg */ -#define MAC_TX_FRAME_XMIT 0x0001 /* successful frame - transmision */ -#define MAC_TX_UNDERRUN 0x0002 /* terminated frame - transmission due to - data starvation in the - xmit data path */ -#define MAC_TX_MAX_PACKET_ERR 0x0004 /* frame exceeds max allowed - length passed to TX MAC - by the DMA engine */ -#define MAC_TX_COLL_NORMAL 0x0008 /* rollover of the normal - collision counter */ -#define MAC_TX_COLL_EXCESS 0x0010 /* rollover of the excessive - collision counter */ -#define MAC_TX_COLL_LATE 0x0020 /* rollover of the late - collision counter */ -#define MAC_TX_COLL_FIRST 0x0040 /* rollover of the first - collision counter */ -#define MAC_TX_DEFER_TIMER 0x0080 /* rollover of the defer - timer */ -#define MAC_TX_PEAK_ATTEMPTS 0x0100 /* rollover of the peak - attempts counter */ - -#define REG_MAC_RX_STATUS 0x6014 /* RX MAC status reg */ -#define MAC_RX_FRAME_RECV 0x0001 /* successful receipt of - a frame */ -#define MAC_RX_OVERFLOW 0x0002 /* dropped frame due to - RX FIFO overflow */ -#define MAC_RX_FRAME_COUNT 0x0004 /* rollover of receive frame - counter */ -#define MAC_RX_ALIGN_ERR 0x0008 /* rollover of alignment - error counter */ -#define MAC_RX_CRC_ERR 0x0010 /* rollover of crc error - counter */ -#define MAC_RX_LEN_ERR 0x0020 /* rollover of length - error counter */ -#define MAC_RX_VIOL_ERR 0x0040 /* rollover of code - violation error */ - -/* DEFAULT: 0xXXXX0000 on reset */ -#define REG_MAC_CTRL_STATUS 0x6018 /* MAC control status reg */ -#define MAC_CTRL_PAUSE_RECEIVED 0x00000001 /* successful - reception of a - pause control - frame */ -#define MAC_CTRL_PAUSE_STATE 0x00000002 /* MAC has made a - transition from - "not paused" to - "paused" */ -#define MAC_CTRL_NOPAUSE_STATE 0x00000004 /* MAC has made a - transition from - "paused" to "not - paused" */ -#define MAC_CTRL_PAUSE_TIME_MASK 0xFFFF0000 /* value of pause time - operand that was - received in the last - pause flow control - frame */ - -/* layout identical to TX MAC[8:0] */ -#define REG_MAC_TX_MASK 0x6020 /* TX MAC mask reg */ -/* layout identical to RX MAC[6:0] */ -#define REG_MAC_RX_MASK 0x6024 /* RX MAC mask reg */ -/* layout identical to CTRL MAC[2:0] */ -#define REG_MAC_CTRL_MASK 0x6028 /* MAC control mask reg */ - -/* to ensure proper operation, CFG_EN must be cleared to 0 and a delay - * imposed before writes to other bits in the TX_MAC_CFG register or any of - * the MAC parameters is performed. delay dependent upon time required to - * transmit a maximum size frame (= MAC_FRAMESIZE_MAX*8/Mbps). e.g., - * the delay for a 1518-byte frame on a 100Mbps network is 125us. - * alternatively, just poll TX_CFG_EN until it reads back as 0. - * NOTE: on half-duplex 1Gbps, TX_CFG_CARRIER_EXTEND and - * RX_CFG_CARRIER_EXTEND should be set and the SLOT_TIME register should - * be 0x200 (slot time of 512 bytes) - */ -#define REG_MAC_TX_CFG 0x6030 /* TX MAC config reg */ -#define MAC_TX_CFG_EN 0x0001 /* enable TX MAC. 0 will - force TXMAC state - machine to remain in - idle state or to - transition to idle state - on completion of an - ongoing packet. */ -#define MAC_TX_CFG_IGNORE_CARRIER 0x0002 /* disable CSMA/CD deferral - process. set to 1 when - full duplex and 0 when - half duplex */ -#define MAC_TX_CFG_IGNORE_COLL 0x0004 /* disable CSMA/CD backoff - algorithm. set to 1 when - full duplex and 0 when - half duplex */ -#define MAC_TX_CFG_IPG_EN 0x0008 /* enable extension of the - Rx-to-TX IPG. after - receiving a frame, TX - MAC will reset its - deferral process to - carrier sense for the - amount of time = IPG0 + - IPG1 and commit to - transmission for time - specified in IPG2. when - 0 or when xmitting frames - back-to-pack (Tx-to-Tx - IPG), TX MAC ignores - IPG0 and will only use - IPG1 for deferral time. - IPG2 still used. */ -#define MAC_TX_CFG_NEVER_GIVE_UP_EN 0x0010 /* TX MAC will not easily - give up on frame - xmission. if backoff - algorithm reaches the - ATTEMPT_LIMIT, it will - clear attempts counter - and continue trying to - send the frame as - specified by - GIVE_UP_LIM. when 0, - TX MAC will execute - standard CSMA/CD prot. */ -#define MAC_TX_CFG_NEVER_GIVE_UP_LIM 0x0020 /* when set, TX MAC will - continue to try to xmit - until successful. when - 0, TX MAC will continue - to try xmitting until - successful or backoff - algorithm reaches - ATTEMPT_LIMIT*16 */ -#define MAC_TX_CFG_NO_BACKOFF 0x0040 /* modify CSMA/CD to disable - backoff algorithm. TX - MAC will not back off - after a xmission attempt - that resulted in a - collision. */ -#define MAC_TX_CFG_SLOW_DOWN 0x0080 /* modify CSMA/CD so that - deferral process is reset - in response to carrier - sense during the entire - duration of IPG. TX MAC - will only commit to frame - xmission after frame - xmission has actually - begun. */ -#define MAC_TX_CFG_NO_FCS 0x0100 /* TX MAC will not generate - CRC for all xmitted - packets. when clear, CRC - generation is dependent - upon NO_CRC bit in the - xmit control word from - TX DMA */ -#define MAC_TX_CFG_CARRIER_EXTEND 0x0200 /* enables xmit part of the - carrier extension - feature. this allows for - longer collision domains - by extending the carrier - and collision window - from the end of FCS until - the end of the slot time - if necessary. Required - for half-duplex at 1Gbps, - clear otherwise. */ - -/* when CRC is not stripped, reassembly packets will not contain the CRC. - * these will be stripped by HRP because it reassembles layer 4 data, and the - * CRC is layer 2. however, non-reassembly packets will still contain the CRC - * when passed to the host. to ensure proper operation, need to wait 3.2ms - * after clearing RX_CFG_EN before writing to any other RX MAC registers - * or other MAC parameters. alternatively, poll RX_CFG_EN until it clears - * to 0. similary, HASH_FILTER_EN and ADDR_FILTER_EN have the same - * restrictions as CFG_EN. - */ -#define REG_MAC_RX_CFG 0x6034 /* RX MAC config reg */ -#define MAC_RX_CFG_EN 0x0001 /* enable RX MAC */ -#define MAC_RX_CFG_STRIP_PAD 0x0002 /* always program to 0. - feature not supported */ -#define MAC_RX_CFG_STRIP_FCS 0x0004 /* RX MAC will strip the - last 4 bytes of a - received frame. */ -#define MAC_RX_CFG_PROMISC_EN 0x0008 /* promiscuous mode */ -#define MAC_RX_CFG_PROMISC_GROUP_EN 0x0010 /* accept all valid - multicast frames (group - bit in DA field set) */ -#define MAC_RX_CFG_HASH_FILTER_EN 0x0020 /* use hash table to filter - multicast addresses */ -#define MAC_RX_CFG_ADDR_FILTER_EN 0x0040 /* cause RX MAC to use - address filtering regs - to filter both unicast - and multicast - addresses */ -#define MAC_RX_CFG_DISABLE_DISCARD 0x0080 /* pass errored frames to - RX DMA by setting BAD - bit but not Abort bit - in the status. CRC, - framing, and length errs - will not increment - error counters. frames - which don't match dest - addr will be passed up - w/ BAD bit set. */ -#define MAC_RX_CFG_CARRIER_EXTEND 0x0100 /* enable reception of - packet bursts generated - by carrier extension - with packet bursting - senders. only applies - to half-duplex 1Gbps */ - -/* DEFAULT: 0x0 */ -#define REG_MAC_CTRL_CFG 0x6038 /* MAC control config reg */ -#define MAC_CTRL_CFG_SEND_PAUSE_EN 0x0001 /* respond to requests for - sending pause flow ctrl - frames */ -#define MAC_CTRL_CFG_RECV_PAUSE_EN 0x0002 /* respond to received - pause flow ctrl frames */ -#define MAC_CTRL_CFG_PASS_CTRL 0x0004 /* pass valid MAC ctrl - packets to RX DMA */ - -/* to ensure proper operation, a global initialization sequence should be - * performed when a loopback config is entered or exited. if programmed after - * a hw or global sw reset, RX/TX MAC software reset and initialization - * should be done to ensure stable clocking. - * DEFAULT: 0x0 - */ -#define REG_MAC_XIF_CFG 0x603C /* XIF config reg */ -#define MAC_XIF_TX_MII_OUTPUT_EN 0x0001 /* enable output drivers - on MII xmit bus */ -#define MAC_XIF_MII_INT_LOOPBACK 0x0002 /* loopback GMII xmit data - path to GMII recv data - path. phy mode register - clock selection must be - set to GMII mode and - GMII_MODE should be set - to 1. in loopback mode, - REFCLK will drive the - entire mac core. 0 for - normal operation. */ -#define MAC_XIF_DISABLE_ECHO 0x0004 /* disables receive data - path during packet - xmission. clear to 0 - in any full duplex mode, - in any loopback mode, - or in half-duplex SERDES - or SLINK modes. set when - in half-duplex when - using external phy. */ -#define MAC_XIF_GMII_MODE 0x0008 /* MAC operates with GMII - clocks and datapath */ -#define MAC_XIF_MII_BUFFER_OUTPUT_EN 0x0010 /* MII_BUF_EN pin. enable - external tristate buffer - on the MII receive - bus. */ -#define MAC_XIF_LINK_LED 0x0020 /* LINKLED# active (low) */ -#define MAC_XIF_FDPLX_LED 0x0040 /* FDPLXLED# active (low) */ - -#define REG_MAC_IPG0 0x6040 /* inter-packet gap0 reg. - recommended: 0x00 */ -#define REG_MAC_IPG1 0x6044 /* inter-packet gap1 reg - recommended: 0x08 */ -#define REG_MAC_IPG2 0x6048 /* inter-packet gap2 reg - recommended: 0x04 */ -#define REG_MAC_SLOT_TIME 0x604C /* slot time reg - recommended: 0x40 */ -#define REG_MAC_FRAMESIZE_MIN 0x6050 /* min frame size reg - recommended: 0x40 */ - -/* FRAMESIZE_MAX holds both the max frame size as well as the max burst size. - * recommended value: 0x2000.05EE - */ -#define REG_MAC_FRAMESIZE_MAX 0x6054 /* max frame size reg */ -#define MAC_FRAMESIZE_MAX_BURST_MASK 0x3FFF0000 /* max burst size */ -#define MAC_FRAMESIZE_MAX_BURST_SHIFT 16 -#define MAC_FRAMESIZE_MAX_FRAME_MASK 0x00007FFF /* max frame size */ -#define MAC_FRAMESIZE_MAX_FRAME_SHIFT 0 -#define REG_MAC_PA_SIZE 0x6058 /* PA size reg. number of - preamble bytes that the - TX MAC will xmit at the - beginning of each frame - value should be 2 or - greater. recommended - value: 0x07 */ -#define REG_MAC_JAM_SIZE 0x605C /* jam size reg. duration - of jam in units of media - byte time. recommended - value: 0x04 */ -#define REG_MAC_ATTEMPT_LIMIT 0x6060 /* attempt limit reg. # - of attempts TX MAC will - make to xmit a frame - before it resets its - attempts counter. after - the limit has been - reached, TX MAC may or - may not drop the frame - dependent upon value - in TX_MAC_CFG. - recommended - value: 0x10 */ -#define REG_MAC_CTRL_TYPE 0x6064 /* MAC control type reg. - type field of a MAC - ctrl frame. recommended - value: 0x8808 */ - -/* mac address registers: 0 - 44, 0x6080 - 0x6130, 4 8-bit bytes. - * register contains comparison - * 0 16 MSB of primary MAC addr [47:32] of DA field - * 1 16 middle bits "" [31:16] of DA field - * 2 16 LSB "" [15:0] of DA field - * 3*x 16MSB of alt MAC addr 1-15 [47:32] of DA field - * 4*x 16 middle bits "" [31:16] - * 5*x 16 LSB "" [15:0] - * 42 16 MSB of MAC CTRL addr [47:32] of DA. - * 43 16 middle bits "" [31:16] - * 44 16 LSB "" [15:0] - * MAC CTRL addr must be the reserved multicast addr for MAC CTRL frames. - * if there is a match, MAC will set the bit for alternative address - * filter pass [15] - - * here is the map of registers given MAC address notation: a:b:c:d:e:f - * ab cd ef - * primary addr reg 2 reg 1 reg 0 - * alt addr 1 reg 5 reg 4 reg 3 - * alt addr x reg 5*x reg 4*x reg 3*x - * ctrl addr reg 44 reg 43 reg 42 - */ -#define REG_MAC_ADDR0 0x6080 /* MAC address 0 reg */ -#define REG_MAC_ADDRN(x) (REG_MAC_ADDR0 + (x)*4) -#define REG_MAC_ADDR_FILTER0 0x614C /* address filter 0 reg - [47:32] */ -#define REG_MAC_ADDR_FILTER1 0x6150 /* address filter 1 reg - [31:16] */ -#define REG_MAC_ADDR_FILTER2 0x6154 /* address filter 2 reg - [15:0] */ -#define REG_MAC_ADDR_FILTER2_1_MASK 0x6158 /* address filter 2 and 1 - mask reg. 8-bit reg - contains nibble mask for - reg 2 and 1. */ -#define REG_MAC_ADDR_FILTER0_MASK 0x615C /* address filter 0 mask - reg */ - -/* hash table registers: 0 - 15, 0x6160 - 0x619C, 4 8-bit bytes - * 16-bit registers contain bits of the hash table. - * reg x -> [16*(15 - x) + 15 : 16*(15 - x)]. - * e.g., 15 -> [15:0], 0 -> [255:240] - */ -#define REG_MAC_HASH_TABLE0 0x6160 /* hash table 0 reg */ -#define REG_MAC_HASH_TABLEN(x) (REG_MAC_HASH_TABLE0 + (x)*4) - -/* statistics registers. these registers generate an interrupt on - * overflow. recommended initialization: 0x0000. most are 16-bits except - * for PEAK_ATTEMPTS register which is 8 bits. - */ -#define REG_MAC_COLL_NORMAL 0x61A0 /* normal collision - counter. */ -#define REG_MAC_COLL_FIRST 0x61A4 /* first attempt - successful collision - counter */ -#define REG_MAC_COLL_EXCESS 0x61A8 /* excessive collision - counter */ -#define REG_MAC_COLL_LATE 0x61AC /* late collision counter */ -#define REG_MAC_TIMER_DEFER 0x61B0 /* defer timer. time base - is the media byte - clock/256 */ -#define REG_MAC_ATTEMPTS_PEAK 0x61B4 /* peak attempts reg */ -#define REG_MAC_RECV_FRAME 0x61B8 /* receive frame counter */ -#define REG_MAC_LEN_ERR 0x61BC /* length error counter */ -#define REG_MAC_ALIGN_ERR 0x61C0 /* alignment error counter */ -#define REG_MAC_FCS_ERR 0x61C4 /* FCS error counter */ -#define REG_MAC_RX_CODE_ERR 0x61C8 /* RX code violation - error counter */ - -/* misc registers */ -#define REG_MAC_RANDOM_SEED 0x61CC /* random number seed reg. - 10-bit register used as a - seed for the random number - generator for the CSMA/CD - backoff algorithm. only - programmed after power-on - reset and should be a - random value which has a - high likelihood of being - unique for each MAC - attached to a network - segment (e.g., 10 LSB of - MAC address) */ - -/* ASUN: there's a PAUSE_TIMER (ro) described, but it's not in the address - * map - */ - -/* 27-bit register has the current state for key state machines in the MAC */ -#define REG_MAC_STATE_MACHINE 0x61D0 /* (ro) state machine reg */ -#define MAC_SM_RLM_MASK 0x07800000 -#define MAC_SM_RLM_SHIFT 23 -#define MAC_SM_RX_FC_MASK 0x00700000 -#define MAC_SM_RX_FC_SHIFT 20 -#define MAC_SM_TLM_MASK 0x000F0000 -#define MAC_SM_TLM_SHIFT 16 -#define MAC_SM_ENCAP_SM_MASK 0x0000F000 -#define MAC_SM_ENCAP_SM_SHIFT 12 -#define MAC_SM_TX_REQ_MASK 0x00000C00 -#define MAC_SM_TX_REQ_SHIFT 10 -#define MAC_SM_TX_FC_MASK 0x000003C0 -#define MAC_SM_TX_FC_SHIFT 6 -#define MAC_SM_FIFO_WRITE_SEL_MASK 0x00000038 -#define MAC_SM_FIFO_WRITE_SEL_SHIFT 3 -#define MAC_SM_TX_FIFO_EMPTY_MASK 0x00000007 -#define MAC_SM_TX_FIFO_EMPTY_SHIFT 0 - -/** MIF registers. the MIF can be programmed in either bit-bang or - * frame mode. - **/ -#define REG_MIF_BIT_BANG_CLOCK 0x6200 /* MIF bit-bang clock. - 1 -> 0 will generate a - rising edge. 0 -> 1 will - generate a falling edge. */ -#define REG_MIF_BIT_BANG_DATA 0x6204 /* MIF bit-bang data. 1-bit - register generates data */ -#define REG_MIF_BIT_BANG_OUTPUT_EN 0x6208 /* MIF bit-bang output - enable. enable when - xmitting data from MIF to - transceiver. */ - -/* 32-bit register serves as an instruction register when the MIF is - * programmed in frame mode. load this register w/ a valid instruction - * (as per IEEE 802.3u MII spec). poll this register to check for instruction - * execution completion. during a read operation, this register will also - * contain the 16-bit data returned by the tranceiver. unless specified - * otherwise, fields are considered "don't care" when polling for - * completion. - */ -#define REG_MIF_FRAME 0x620C /* MIF frame/output reg */ -#define MIF_FRAME_START_MASK 0xC0000000 /* start of frame. - load w/ 01 when - issuing an instr */ -#define MIF_FRAME_ST 0x40000000 /* STart of frame */ -#define MIF_FRAME_OPCODE_MASK 0x30000000 /* opcode. 01 for a - write. 10 for a - read */ -#define MIF_FRAME_OP_READ 0x20000000 /* read OPcode */ -#define MIF_FRAME_OP_WRITE 0x10000000 /* write OPcode */ -#define MIF_FRAME_PHY_ADDR_MASK 0x0F800000 /* phy address. when - issuing an instr, - this field should be - loaded w/ the XCVR - addr */ -#define MIF_FRAME_PHY_ADDR_SHIFT 23 -#define MIF_FRAME_REG_ADDR_MASK 0x007C0000 /* register address. - when issuing an instr, - addr of register - to be read/written */ -#define MIF_FRAME_REG_ADDR_SHIFT 18 -#define MIF_FRAME_TURN_AROUND_MSB 0x00020000 /* turn around, MSB. - when issuing an instr, - set this bit to 1 */ -#define MIF_FRAME_TURN_AROUND_LSB 0x00010000 /* turn around, LSB. - when issuing an instr, - set this bit to 0. - when polling for - completion, 1 means - that instr execution - has been completed */ -#define MIF_FRAME_DATA_MASK 0x0000FFFF /* instruction payload - load with 16-bit data - to be written in - transceiver reg for a - write. doesn't matter - in a read. when - polling for - completion, field is - "don't care" for write - and 16-bit data - returned by the - transceiver for a - read (if valid bit - is set) */ -#define REG_MIF_CFG 0x6210 /* MIF config reg */ -#define MIF_CFG_PHY_SELECT 0x0001 /* 1 -> select MDIO_1 - 0 -> select MDIO_0 */ -#define MIF_CFG_POLL_EN 0x0002 /* enable polling - mechanism. if set, - BB_MODE should be 0 */ -#define MIF_CFG_BB_MODE 0x0004 /* 1 -> bit-bang mode - 0 -> frame mode */ -#define MIF_CFG_POLL_REG_MASK 0x00F8 /* register address to be - used by polling mode. - only meaningful if POLL_EN - is set to 1 */ -#define MIF_CFG_POLL_REG_SHIFT 3 -#define MIF_CFG_MDIO_0 0x0100 /* (ro) dual purpose. - when MDIO_0 is idle, - 1 -> tranceiver is - connected to MDIO_0. - when MIF is communicating - w/ MDIO_0 in bit-bang - mode, this bit indicates - the incoming bit stream - during a read op */ -#define MIF_CFG_MDIO_1 0x0200 /* (ro) dual purpose. - when MDIO_1 is idle, - 1 -> transceiver is - connected to MDIO_1. - when MIF is communicating - w/ MDIO_1 in bit-bang - mode, this bit indicates - the incoming bit stream - during a read op */ -#define MIF_CFG_POLL_PHY_MASK 0x7C00 /* tranceiver address to - be polled */ -#define MIF_CFG_POLL_PHY_SHIFT 10 - -/* 16-bit register used to determine which bits in the POLL_STATUS portion of - * the MIF_STATUS register will cause an interrupt. if a mask bit is 0, - * corresponding bit of the POLL_STATUS will generate a MIF interrupt when - * set. DEFAULT: 0xFFFF - */ -#define REG_MIF_MASK 0x6214 /* MIF mask reg */ - -/* 32-bit register used when in poll mode. auto-cleared after being read */ -#define REG_MIF_STATUS 0x6218 /* MIF status reg */ -#define MIF_STATUS_POLL_DATA_MASK 0xFFFF0000 /* poll data contains - the "latest image" - update of the XCVR - reg being read */ -#define MIF_STATUS_POLL_DATA_SHIFT 16 -#define MIF_STATUS_POLL_STATUS_MASK 0x0000FFFF /* poll status indicates - which bits in the - POLL_DATA field have - changed since the - MIF_STATUS reg was - last read */ -#define MIF_STATUS_POLL_STATUS_SHIFT 0 - -/* 7-bit register has current state for all state machines in the MIF */ -#define REG_MIF_STATE_MACHINE 0x621C /* MIF state machine reg */ -#define MIF_SM_CONTROL_MASK 0x07 /* control state machine - state */ -#define MIF_SM_EXECUTION_MASK 0x60 /* execution state machine - state */ - -/** PCS/Serialink. the following registers are equivalent to the standard - * MII management registers except that they're directly mapped in - * Cassini's register space. - **/ - -/* the auto-negotiation enable bit should be programmed the same at - * the link partner as in the local device to enable auto-negotiation to - * complete. when that bit is reprogrammed, auto-neg/manual config is - * restarted automatically. - * DEFAULT: 0x1040 - */ -#define REG_PCS_MII_CTRL 0x9000 /* PCS MII control reg */ -#define PCS_MII_CTRL_1000_SEL 0x0040 /* reads 1. ignored on - writes */ -#define PCS_MII_CTRL_COLLISION_TEST 0x0080 /* COL signal at the PCS - to MAC interface is - activated regardless - of activity */ -#define PCS_MII_CTRL_DUPLEX 0x0100 /* forced 0x0. PCS - behaviour same for - half and full dplx */ -#define PCS_MII_RESTART_AUTONEG 0x0200 /* self clearing. - restart auto- - negotiation */ -#define PCS_MII_ISOLATE 0x0400 /* read as 0. ignored - on writes */ -#define PCS_MII_POWER_DOWN 0x0800 /* read as 0. ignored - on writes */ -#define PCS_MII_AUTONEG_EN 0x1000 /* default 1. PCS goes - through automatic - link config before it - can be used. when 0, - link can be used - w/out any link config - phase */ -#define PCS_MII_10_100_SEL 0x2000 /* read as 0. ignored on - writes */ -#define PCS_MII_RESET 0x8000 /* reset PCS. self-clears - when done */ - -/* DEFAULT: 0x0108 */ -#define REG_PCS_MII_STATUS 0x9004 /* PCS MII status reg */ -#define PCS_MII_STATUS_EXTEND_CAP 0x0001 /* reads 0 */ -#define PCS_MII_STATUS_JABBER_DETECT 0x0002 /* reads 0 */ -#define PCS_MII_STATUS_LINK_STATUS 0x0004 /* 1 -> link up. - 0 -> link down. 0 is - latched so that 0 is - kept until read. read - 2x to determine if the - link has gone up again */ -#define PCS_MII_STATUS_AUTONEG_ABLE 0x0008 /* reads 1 (able to perform - auto-neg) */ -#define PCS_MII_STATUS_REMOTE_FAULT 0x0010 /* 1 -> remote fault detected - from received link code - word. only valid after - auto-neg completed */ -#define PCS_MII_STATUS_AUTONEG_COMP 0x0020 /* 1 -> auto-negotiation - completed - 0 -> auto-negotiation not - completed */ -#define PCS_MII_STATUS_EXTEND_STATUS 0x0100 /* reads as 1. used as an - indication that this is - a 1000 Base-X PHY. writes - to it are ignored */ - -/* used during auto-negotiation. - * DEFAULT: 0x00E0 - */ -#define REG_PCS_MII_ADVERT 0x9008 /* PCS MII advertisement - reg */ -#define PCS_MII_ADVERT_FD 0x0020 /* advertise full duplex - 1000 Base-X */ -#define PCS_MII_ADVERT_HD 0x0040 /* advertise half-duplex - 1000 Base-X */ -#define PCS_MII_ADVERT_SYM_PAUSE 0x0080 /* advertise PAUSE - symmetric capability */ -#define PCS_MII_ADVERT_ASYM_PAUSE 0x0100 /* advertises PAUSE - asymmetric capability */ -#define PCS_MII_ADVERT_RF_MASK 0x3000 /* remote fault. write bit13 - to optionally indicate to - link partner that chip is - going off-line. bit12 will - get set when signal - detect == FAIL and will - remain set until - successful negotiation */ -#define PCS_MII_ADVERT_ACK 0x4000 /* (ro) */ -#define PCS_MII_ADVERT_NEXT_PAGE 0x8000 /* (ro) forced 0x0 */ - -/* contents updated as a result of autonegotiation. layout and definitions - * identical to PCS_MII_ADVERT - */ -#define REG_PCS_MII_LPA 0x900C /* PCS MII link partner - ability reg */ -#define PCS_MII_LPA_FD PCS_MII_ADVERT_FD -#define PCS_MII_LPA_HD PCS_MII_ADVERT_HD -#define PCS_MII_LPA_SYM_PAUSE PCS_MII_ADVERT_SYM_PAUSE -#define PCS_MII_LPA_ASYM_PAUSE PCS_MII_ADVERT_ASYM_PAUSE -#define PCS_MII_LPA_RF_MASK PCS_MII_ADVERT_RF_MASK -#define PCS_MII_LPA_ACK PCS_MII_ADVERT_ACK -#define PCS_MII_LPA_NEXT_PAGE PCS_MII_ADVERT_NEXT_PAGE - -/* DEFAULT: 0x0 */ -#define REG_PCS_CFG 0x9010 /* PCS config reg */ -#define PCS_CFG_EN 0x01 /* enable PCS. must be - 0 when modifying - PCS_MII_ADVERT */ -#define PCS_CFG_SD_OVERRIDE 0x02 /* sets signal detect to - OK. bit is - non-resettable */ -#define PCS_CFG_SD_ACTIVE_LOW 0x04 /* changes interpretation - of optical signal to make - signal detect okay when - signal is low */ -#define PCS_CFG_JITTER_STUDY_MASK 0x18 /* used to make jitter - measurements. a single - code group is xmitted - regularly. - 0x0 = normal operation - 0x1 = high freq test - pattern, D21.5 - 0x2 = low freq test - pattern, K28.7 - 0x3 = reserved */ -#define PCS_CFG_10MS_TIMER_OVERRIDE 0x20 /* shortens 10-20ms auto- - negotiation timer to - a few cycles for test - purposes */ - -/* used for diagnostic purposes. bits 20-22 autoclear on read */ -#define REG_PCS_STATE_MACHINE 0x9014 /* (ro) PCS state machine - and diagnostic reg */ -#define PCS_SM_TX_STATE_MASK 0x0000000F /* 0 and 1 indicate - xmission of idle. - otherwise, xmission of - a packet */ -#define PCS_SM_RX_STATE_MASK 0x000000F0 /* 0 indicates reception - of idle. otherwise, - reception of packet */ -#define PCS_SM_WORD_SYNC_STATE_MASK 0x00000700 /* 0 indicates loss of - sync */ -#define PCS_SM_SEQ_DETECT_STATE_MASK 0x00001800 /* cycling through 0-3 - indicates reception of - Config codes. cycling - through 0-1 indicates - reception of idles */ -#define PCS_SM_LINK_STATE_MASK 0x0001E000 -#define SM_LINK_STATE_UP 0x00016000 /* link state is up */ - -#define PCS_SM_LOSS_LINK_C 0x00100000 /* loss of link due to - recept of Config - codes */ -#define PCS_SM_LOSS_LINK_SYNC 0x00200000 /* loss of link due to - loss of sync */ -#define PCS_SM_LOSS_SIGNAL_DETECT 0x00400000 /* signal detect goes - from OK to FAIL. bit29 - will also be set if - this is set */ -#define PCS_SM_NO_LINK_BREAKLINK 0x01000000 /* link not up due to - receipt of breaklink - C codes from partner. - C codes w/ 0 content - received triggering - start/restart of - autonegotiation. - should be sent for - no longer than 20ms */ -#define PCS_SM_NO_LINK_SERDES 0x02000000 /* serdes being - initialized. see serdes - state reg */ -#define PCS_SM_NO_LINK_C 0x04000000 /* C codes not stable or - not received */ -#define PCS_SM_NO_LINK_SYNC 0x08000000 /* word sync not - achieved */ -#define PCS_SM_NO_LINK_WAIT_C 0x10000000 /* waiting for C codes - w/ ack bit set */ -#define PCS_SM_NO_LINK_NO_IDLE 0x20000000 /* link partner continues - to send C codes - instead of idle - symbols or pkt data */ - -/* this register indicates interrupt changes in specific PCS MII status bits. - * PCS_INT may be masked at the ISR level. only a single bit is implemented - * for link status change. - */ -#define REG_PCS_INTR_STATUS 0x9018 /* PCS interrupt status */ -#define PCS_INTR_STATUS_LINK_CHANGE 0x04 /* link status has changed - since last read */ - -/* control which network interface is used. no more than one bit should - * be set. - * DEFAULT: none - */ -#define REG_PCS_DATAPATH_MODE 0x9050 /* datapath mode reg */ -#define PCS_DATAPATH_MODE_MII 0x00 /* PCS is not used and - MII/GMII is selected. - selection between MII and - GMII is controlled by - XIF_CFG */ -#define PCS_DATAPATH_MODE_SERDES 0x02 /* PCS is used via the - 10-bit interface */ - -/* input to serdes chip or serialink block */ -#define REG_PCS_SERDES_CTRL 0x9054 /* serdes control reg */ -#define PCS_SERDES_CTRL_LOOPBACK 0x01 /* enable loopback on - serdes interface */ -#define PCS_SERDES_CTRL_SYNCD_EN 0x02 /* enable sync carrier - detection. should be - 0x0 for normal - operation */ -#define PCS_SERDES_CTRL_LOCKREF 0x04 /* frequency-lock RBC[0:1] - to REFCLK when set. - when clear, receiver - clock locks to incoming - serial data */ - -/* multiplex test outputs into the PROM address (PA_3 through PA_0) pins. - * should be 0x0 for normal operations. - * 0b000 normal operation, PROM address[3:0] selected - * 0b001 rxdma req, rxdma ack, rxdma ready, rxdma read - * 0b010 rxmac req, rx ack, rx tag, rx clk shared - * 0b011 txmac req, tx ack, tx tag, tx retry req - * 0b100 tx tp3, tx tp2, tx tp1, tx tp0 - * 0b101 R period RX, R period TX, R period HP, R period BIM - * DEFAULT: 0x0 - */ -#define REG_PCS_SHARED_OUTPUT_SEL 0x9058 /* shared output select */ -#define PCS_SOS_PROM_ADDR_MASK 0x0007 - -/* used for diagnostics. this register indicates progress of the SERDES - * boot up. - * 0b00 undergoing reset - * 0b01 waiting 500us while lockrefn is asserted - * 0b10 waiting for comma detect - * 0b11 receive data is synchronized - * DEFAULT: 0x0 - */ -#define REG_PCS_SERDES_STATE 0x905C /* (ro) serdes state */ -#define PCS_SERDES_STATE_MASK 0x03 - -/* used for diagnostics. indicates number of packets transmitted or received. - * counters rollover w/out generating an interrupt. - * DEFAULT: 0x0 - */ -#define REG_PCS_PACKET_COUNT 0x9060 /* (ro) PCS packet counter */ -#define PCS_PACKET_COUNT_TX 0x000007FF /* pkts xmitted by PCS */ -#define PCS_PACKET_COUNT_RX 0x07FF0000 /* pkts recvd by PCS - whether they - encountered an error - or not */ - -/** LocalBus Devices. the following provides run-time access to the - * Cassini's PROM - ***/ -#define REG_EXPANSION_ROM_RUN_START 0x100000 /* expansion rom run time - access */ -#define REG_EXPANSION_ROM_RUN_END 0x17FFFF - -#define REG_SECOND_LOCALBUS_START 0x180000 /* secondary local bus - device */ -#define REG_SECOND_LOCALBUS_END 0x1FFFFF - -/* entropy device */ -#define REG_ENTROPY_START REG_SECOND_LOCALBUS_START -#define REG_ENTROPY_DATA (REG_ENTROPY_START + 0x00) -#define REG_ENTROPY_STATUS (REG_ENTROPY_START + 0x04) -#define ENTROPY_STATUS_DRDY 0x01 -#define ENTROPY_STATUS_BUSY 0x02 -#define ENTROPY_STATUS_CIPHER 0x04 -#define ENTROPY_STATUS_BYPASS_MASK 0x18 -#define REG_ENTROPY_MODE (REG_ENTROPY_START + 0x05) -#define ENTROPY_MODE_KEY_MASK 0x07 -#define ENTROPY_MODE_ENCRYPT 0x40 -#define REG_ENTROPY_RAND_REG (REG_ENTROPY_START + 0x06) -#define REG_ENTROPY_RESET (REG_ENTROPY_START + 0x07) -#define ENTROPY_RESET_DES_IO 0x01 -#define ENTROPY_RESET_STC_MODE 0x02 -#define ENTROPY_RESET_KEY_CACHE 0x04 -#define ENTROPY_RESET_IV 0x08 -#define REG_ENTROPY_IV (REG_ENTROPY_START + 0x08) -#define REG_ENTROPY_KEY0 (REG_ENTROPY_START + 0x10) -#define REG_ENTROPY_KEYN(x) (REG_ENTROPY_KEY0 + 4*(x)) - -/* phys of interest w/ their special mii registers */ -#define PHY_LUCENT_B0 0x00437421 -#define LUCENT_MII_REG 0x1F - -#define PHY_NS_DP83065 0x20005c78 -#define DP83065_MII_MEM 0x16 -#define DP83065_MII_REGD 0x1D -#define DP83065_MII_REGE 0x1E - -#define PHY_BROADCOM_5411 0x00206071 -#define PHY_BROADCOM_B0 0x00206050 -#define BROADCOM_MII_REG4 0x14 -#define BROADCOM_MII_REG5 0x15 -#define BROADCOM_MII_REG7 0x17 -#define BROADCOM_MII_REG8 0x18 - -#define CAS_MII_ANNPTR 0x07 -#define CAS_MII_ANNPRR 0x08 -#define CAS_MII_1000_CTRL 0x09 -#define CAS_MII_1000_STATUS 0x0A -#define CAS_MII_1000_EXTEND 0x0F - -#define CAS_BMSR_1000_EXTEND 0x0100 /* supports 1000Base-T extended status */ -/* - * if autoneg is disabled, here's the table: - * BMCR_SPEED100 = 100Mbps - * BMCR_SPEED1000 = 1000Mbps - * ~(BMCR_SPEED100 | BMCR_SPEED1000) = 10Mbps - */ -#define CAS_BMCR_SPEED1000 0x0040 /* Select 1000Mbps */ - -#define CAS_ADVERTISE_1000HALF 0x0100 -#define CAS_ADVERTISE_1000FULL 0x0200 -#define CAS_ADVERTISE_PAUSE 0x0400 -#define CAS_ADVERTISE_ASYM_PAUSE 0x0800 - -/* regular lpa register */ -#define CAS_LPA_PAUSE CAS_ADVERTISE_PAUSE -#define CAS_LPA_ASYM_PAUSE CAS_ADVERTISE_ASYM_PAUSE - -/* 1000_STATUS register */ -#define CAS_LPA_1000HALF 0x0400 -#define CAS_LPA_1000FULL 0x0800 - -#define CAS_EXTEND_1000XFULL 0x8000 -#define CAS_EXTEND_1000XHALF 0x4000 -#define CAS_EXTEND_1000TFULL 0x2000 -#define CAS_EXTEND_1000THALF 0x1000 - -/* cassini header parser firmware */ -typedef struct cas_hp_inst { - const char *note; - - u16 mask, val; - - u8 op; - u8 soff, snext; /* if match succeeds, new offset and match */ - u8 foff, fnext; /* if match fails, new offset and match */ - /* output info */ - u8 outop; /* output opcode */ - - u16 outarg; /* output argument */ - u8 outenab; /* output enable: 0 = not, 1 = if match - 2 = if !match, 3 = always */ - u8 outshift; /* barrel shift right, 4 bits */ - u16 outmask; -} cas_hp_inst_t; - -/* comparison */ -#define OP_EQ 0 /* packet == value */ -#define OP_LT 1 /* packet < value */ -#define OP_GT 2 /* packet > value */ -#define OP_NP 3 /* new packet */ - -/* output opcodes */ -#define CL_REG 0 -#define LD_FID 1 -#define LD_SEQ 2 -#define LD_CTL 3 -#define LD_SAP 4 -#define LD_R1 5 -#define LD_L3 6 -#define LD_SUM 7 -#define LD_HDR 8 -#define IM_FID 9 -#define IM_SEQ 10 -#define IM_SAP 11 -#define IM_R1 12 -#define IM_CTL 13 -#define LD_LEN 14 -#define ST_FLG 15 - -/* match setp #s for IP4TCP4 */ -#define S1_PCKT 0 -#define S1_VLAN 1 -#define S1_CFI 2 -#define S1_8023 3 -#define S1_LLC 4 -#define S1_LLCc 5 -#define S1_IPV4 6 -#define S1_IPV4c 7 -#define S1_IPV4F 8 -#define S1_TCP44 9 -#define S1_IPV6 10 -#define S1_IPV6L 11 -#define S1_IPV6c 12 -#define S1_TCP64 13 -#define S1_TCPSQ 14 -#define S1_TCPFG 15 -#define S1_TCPHL 16 -#define S1_TCPHc 17 -#define S1_CLNP 18 -#define S1_CLNP2 19 -#define S1_DROP 20 -#define S2_HTTP 21 -#define S1_ESP4 22 -#define S1_AH4 23 -#define S1_ESP6 24 -#define S1_AH6 25 - -#define CAS_PROG_IP46TCP4_PREAMBLE \ -{ "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT, \ - CL_REG, 0x3ff, 1, 0x0, 0x0000}, \ -{ "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, \ - IM_CTL, 0x00a, 3, 0x0, 0xffff}, \ -{ "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, \ - CL_REG, 0x000, 0, 0x0, 0x0000}, \ -{ "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, \ - CL_REG, 0x000, 0, 0x0, 0x0000}, \ -{ "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, \ - CL_REG, 0x000, 0, 0x0, 0x0000}, \ -{ "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, \ - CL_REG, 0x000, 0, 0x0, 0x0000}, \ -{ "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, \ - LD_SAP, 0x100, 3, 0x0, 0xffff}, \ -{ "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, \ - LD_SUM, 0x00a, 1, 0x0, 0x0000}, \ -{ "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, \ - LD_LEN, 0x03e, 1, 0x0, 0xffff}, \ -{ "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP, \ - LD_FID, 0x182, 1, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ \ -{ "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, \ - LD_SUM, 0x015, 1, 0x0, 0x0000}, \ -{ "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, \ - IM_R1, 0x128, 1, 0x0, 0xffff}, \ -{ "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, \ - LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ \ -{ "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP, \ - LD_LEN, 0x03f, 1, 0x0, 0xffff} - -#ifdef USE_HP_IP46TCP4 -static cas_hp_inst_t cas_prog_ip46tcp4tab[] = { - CAS_PROG_IP46TCP4_PREAMBLE, - { "TCP seq", /* DADDR should point to dest port */ - 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ, - 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ - { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0, - S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */ - { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, - S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000}, - { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, - S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff}, - { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2, - IM_CTL, 0x001, 3, 0x0, 0x0001}, - { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x000, 0, 0x0, 0x0000}, - { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x080, 3, 0x0, 0xffff}, - { NULL }, -}; -#ifdef HP_IP46TCP4_DEFAULT -#define CAS_HP_FIRMWARE cas_prog_ip46tcp4tab -#endif -#endif - -/* - * Alternate table load which excludes HTTP server traffic from reassembly. - * It is substantially similar to the basic table, with one extra state - * and a few extra compares. */ -#ifdef USE_HP_IP46TCP4NOHTTP -static cas_hp_inst_t cas_prog_ip46tcp4nohttptab[] = { - CAS_PROG_IP46TCP4_PREAMBLE, - { "TCP seq", /* DADDR should point to dest port */ - 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ, - 0x081, 3, 0x0, 0xffff} , /* Load TCP seq # */ - { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0, - S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f, }, /* Load TCP flags */ - { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc, - LD_R1, 0x205, 3, 0xB, 0xf000}, - { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - LD_HDR, 0x0ff, 3, 0x0, 0xffff}, - { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2, - IM_CTL, 0x001, 3, 0x0, 0x0001}, - { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - CL_REG, 0x002, 3, 0x0, 0x0000}, - { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x080, 3, 0x0, 0xffff}, - { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x044, 3, 0x0, 0xffff}, - { NULL }, -}; -#ifdef HP_IP46TCP4NOHTTP_DEFAULT -#define CAS_HP_FIRMWARE cas_prog_ip46tcp4nohttptab -#endif -#endif - -/* match step #s for IP4FRAG */ -#define S3_IPV6c 11 -#define S3_TCP64 12 -#define S3_TCPSQ 13 -#define S3_TCPFG 14 -#define S3_TCPHL 15 -#define S3_TCPHc 16 -#define S3_FRAG 17 -#define S3_FOFF 18 -#define S3_CLNP 19 - -#ifdef USE_HP_IP4FRAG -static cas_hp_inst_t cas_prog_ip4fragtab[] = { - { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT, - CL_REG, 0x3ff, 1, 0x0, 0x0000}, - { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, - IM_CTL, 0x00a, 3, 0x0, 0xffff}, - { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S3_CLNP, 1, S1_8023, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S3_CLNP, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "LLCc?",0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S3_CLNP, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, - LD_SAP, 0x100, 3, 0x0, 0xffff}, - { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S3_CLNP, - LD_SUM, 0x00a, 1, 0x0, 0x0000}, - { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S3_FRAG, - LD_LEN, 0x03e, 3, 0x0, 0xffff}, - { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S3_TCPSQ, 0, S3_CLNP, - LD_FID, 0x182, 3, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ - { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S3_IPV6c, 0, S3_CLNP, - LD_SUM, 0x015, 1, 0x0, 0x0000}, - { "IPV6 cont?", 0xf000, 0x6000, OP_EQ, 3, S3_TCP64, 0, S3_CLNP, - LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ - { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S3_TCPSQ, 0, S3_CLNP, - LD_LEN, 0x03f, 1, 0x0, 0xffff}, - { "TCP seq", /* DADDR should point to dest port */ - 0x0000, 0x0000, OP_EQ, 0, S3_TCPFG, 4, S3_TCPFG, LD_SEQ, - 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ - { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHL, 0, - S3_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */ - { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHc, 0, S3_TCPHc, - LD_R1, 0x205, 3, 0xB, 0xf000}, - { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - LD_HDR, 0x0ff, 3, 0x0, 0xffff}, - { "IP4 Fragment", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF, - LD_FID, 0x103, 3, 0x0, 0xffff}, /* FID IP4 src+dst */ - { "IP4 frag offset", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF, - LD_SEQ, 0x040, 1, 0xD, 0xfff8}, - { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x001, 3, 0x0, 0x0001}, - { NULL }, -}; -#ifdef HP_IP4FRAG_DEFAULT -#define CAS_HP_FIRMWARE cas_prog_ip4fragtab -#endif -#endif - -/* - * Alternate table which does batching without reassembly - */ -#ifdef USE_HP_IP46TCP4BATCH -static cas_hp_inst_t cas_prog_ip46tcp4batchtab[] = { - CAS_PROG_IP46TCP4_PREAMBLE, - { "TCP seq", /* DADDR should point to dest port */ - 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 0, S1_TCPFG, LD_SEQ, - 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ - { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0, - S1_TCPHL, ST_FLG, 0x000, 3, 0x0, 0x0000}, /* Load TCP flags */ - { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, - S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000}, - { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, - S1_PCKT, IM_CTL, 0x040, 3, 0x0, 0xffff}, /* set batch bit */ - { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x001, 3, 0x0, 0x0001}, - { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, - S1_PCKT, IM_CTL, 0x080, 3, 0x0, 0xffff}, - { NULL }, -}; -#ifdef HP_IP46TCP4BATCH_DEFAULT -#define CAS_HP_FIRMWARE cas_prog_ip46tcp4batchtab -#endif -#endif - -/* Workaround for Cassini rev2 descriptor corruption problem. - * Does batching without reassembly, and sets the SAP to a known - * data pattern for all packets. - */ -#ifdef USE_HP_WORKAROUND -static cas_hp_inst_t cas_prog_workaroundtab[] = { - { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, - S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000} , - { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, - IM_CTL, 0x04a, 3, 0x0, 0xffff}, - { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, - IM_SAP, 0x6AE, 3, 0x0, 0xffff}, - { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, - LD_SUM, 0x00a, 1, 0x0, 0x0000}, - { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, - LD_LEN, 0x03e, 1, 0x0, 0xffff}, - { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP, - LD_FID, 0x182, 3, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ - { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, - LD_SUM, 0x015, 1, 0x0, 0x0000}, - { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, - IM_R1, 0x128, 1, 0x0, 0xffff}, - { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, - LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ - { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP, - LD_LEN, 0x03f, 1, 0x0, 0xffff}, - { "TCP seq", /* DADDR should point to dest port */ - 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ, - 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ - { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0, - S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */ - { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc, - LD_R1, 0x205, 3, 0xB, 0xf000}, - { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, - S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff}, - { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2, - IM_SAP, 0x6AE, 3, 0x0, 0xffff} , - { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x001, 3, 0x0, 0x0001}, - { NULL }, -}; -#ifdef HP_WORKAROUND_DEFAULT -#define CAS_HP_FIRMWARE cas_prog_workaroundtab -#endif -#endif - -#ifdef USE_HP_ENCRYPT -static cas_hp_inst_t cas_prog_encryptiontab[] = { - { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, - S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000}, - { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, - IM_CTL, 0x00a, 3, 0x0, 0xffff}, -#if 0 -//"CFI?", /* 02 FIND CFI and If FIND go to S1_DROP */ -//0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, CL_REG, 0x000, 0, 0x0, 0x00 - 00, -#endif - { "CFI?", /* FIND CFI and If FIND go to CleanUP1 (ignore and send to host) */ - 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, - CL_REG, 0x000, 0, 0x0, 0x0000}, - { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, - LD_SAP, 0x100, 3, 0x0, 0xffff}, - { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, - LD_SUM, 0x00a, 1, 0x0, 0x0000}, - { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, - LD_LEN, 0x03e, 1, 0x0, 0xffff}, - { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_ESP4, - LD_FID, 0x182, 1, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ - { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, - LD_SUM, 0x015, 1, 0x0, 0x0000}, - { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, - IM_R1, 0x128, 1, 0x0, 0xffff}, - { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, - LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ - { "TCP64?", -#if 0 -//@@@0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_ESP6, LD_LEN, 0x03f, 1, 0x0, 0xffff, -#endif - 0xff00, 0x0600, OP_EQ, 12, S1_TCPSQ, 0, S1_ESP6, LD_LEN, - 0x03f, 1, 0x0, 0xffff}, - { "TCP seq", /* 14:DADDR should point to dest port */ - 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ, - 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ - { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0, - S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f}, /* Load TCP flags */ - { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc, - LD_R1, 0x205, 3, 0xB, 0xf000} , - { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, - S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff}, - { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2, - IM_CTL, 0x001, 3, 0x0, 0x0001}, - { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - CL_REG, 0x002, 3, 0x0, 0x0000}, - { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x080, 3, 0x0, 0xffff}, - { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, - IM_CTL, 0x044, 3, 0x0, 0xffff}, - { "IPV4 ESP encrypted?", /* S1_ESP4 */ - 0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH4, IM_CTL, - 0x021, 1, 0x0, 0xffff}, - { "IPV4 AH encrypted?", /* S1_AH4 */ - 0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL, - 0x021, 1, 0x0, 0xffff}, - { "IPV6 ESP encrypted?", /* S1_ESP6 */ -#if 0 -//@@@0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL, 0x021, 1, 0x0, 0xffff, -#endif - 0xff00, 0x3200, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL, - 0x021, 1, 0x0, 0xffff}, - { "IPV6 AH encrypted?", /* S1_AH6 */ -#if 0 -//@@@0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL, 0x021, 1, 0x0, 0xffff, -#endif - 0xff00, 0x3300, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL, - 0x021, 1, 0x0, 0xffff}, - { NULL }, -}; -#ifdef HP_ENCRYPT_DEFAULT -#define CAS_HP_FIRMWARE cas_prog_encryptiontab -#endif -#endif - -static cas_hp_inst_t cas_prog_null[] = { {NULL} }; -#ifdef HP_NULL_DEFAULT -#define CAS_HP_FIRMWARE cas_prog_null -#endif - -/* firmware patch for NS_DP83065 */ -typedef struct cas_saturn_patch { - u16 addr; - u16 val; -} cas_saturn_patch_t; - -#if 1 -cas_saturn_patch_t cas_saturn_patch[] = { -{0x8200, 0x007e}, {0x8201, 0x0082}, {0x8202, 0x0009}, -{0x8203, 0x0000}, {0x8204, 0x0000}, {0x8205, 0x0000}, -{0x8206, 0x0000}, {0x8207, 0x0000}, {0x8208, 0x0000}, -{0x8209, 0x008e}, {0x820a, 0x008e}, {0x820b, 0x00ff}, -{0x820c, 0x00ce}, {0x820d, 0x0082}, {0x820e, 0x0025}, -{0x820f, 0x00ff}, {0x8210, 0x0001}, {0x8211, 0x000f}, -{0x8212, 0x00ce}, {0x8213, 0x0084}, {0x8214, 0x0026}, -{0x8215, 0x00ff}, {0x8216, 0x0001}, {0x8217, 0x0011}, -{0x8218, 0x00ce}, {0x8219, 0x0085}, {0x821a, 0x003d}, -{0x821b, 0x00df}, {0x821c, 0x00e5}, {0x821d, 0x0086}, -{0x821e, 0x0039}, {0x821f, 0x00b7}, {0x8220, 0x008f}, -{0x8221, 0x00f8}, {0x8222, 0x007e}, {0x8223, 0x00c3}, -{0x8224, 0x00c2}, {0x8225, 0x0096}, {0x8226, 0x0047}, -{0x8227, 0x0084}, {0x8228, 0x00f3}, {0x8229, 0x008a}, -{0x822a, 0x0000}, {0x822b, 0x0097}, {0x822c, 0x0047}, -{0x822d, 0x00ce}, {0x822e, 0x0082}, {0x822f, 0x0033}, -{0x8230, 0x00ff}, {0x8231, 0x0001}, {0x8232, 0x000f}, -{0x8233, 0x0096}, {0x8234, 0x0046}, {0x8235, 0x0084}, -{0x8236, 0x000c}, {0x8237, 0x0081}, {0x8238, 0x0004}, -{0x8239, 0x0027}, {0x823a, 0x000b}, {0x823b, 0x0096}, -{0x823c, 0x0046}, {0x823d, 0x0084}, {0x823e, 0x000c}, -{0x823f, 0x0081}, {0x8240, 0x0008}, {0x8241, 0x0027}, -{0x8242, 0x0057}, {0x8243, 0x007e}, {0x8244, 0x0084}, -{0x8245, 0x0025}, {0x8246, 0x0096}, {0x8247, 0x0047}, -{0x8248, 0x0084}, {0x8249, 0x00f3}, {0x824a, 0x008a}, -{0x824b, 0x0004}, {0x824c, 0x0097}, {0x824d, 0x0047}, -{0x824e, 0x00ce}, {0x824f, 0x0082}, {0x8250, 0x0054}, -{0x8251, 0x00ff}, {0x8252, 0x0001}, {0x8253, 0x000f}, -{0x8254, 0x0096}, {0x8255, 0x0046}, {0x8256, 0x0084}, -{0x8257, 0x000c}, {0x8258, 0x0081}, {0x8259, 0x0004}, -{0x825a, 0x0026}, {0x825b, 0x0038}, {0x825c, 0x00b6}, -{0x825d, 0x0012}, {0x825e, 0x0020}, {0x825f, 0x0084}, -{0x8260, 0x0020}, {0x8261, 0x0026}, {0x8262, 0x0003}, -{0x8263, 0x007e}, {0x8264, 0x0084}, {0x8265, 0x0025}, -{0x8266, 0x0096}, {0x8267, 0x007b}, {0x8268, 0x00d6}, -{0x8269, 0x007c}, {0x826a, 0x00fe}, {0x826b, 0x008f}, -{0x826c, 0x0056}, {0x826d, 0x00bd}, {0x826e, 0x00f7}, -{0x826f, 0x00b6}, {0x8270, 0x00fe}, {0x8271, 0x008f}, -{0x8272, 0x004e}, {0x8273, 0x00bd}, {0x8274, 0x00ec}, -{0x8275, 0x008e}, {0x8276, 0x00bd}, {0x8277, 0x00fa}, -{0x8278, 0x00f7}, {0x8279, 0x00bd}, {0x827a, 0x00f7}, -{0x827b, 0x0028}, {0x827c, 0x00ce}, {0x827d, 0x0082}, -{0x827e, 0x0082}, {0x827f, 0x00ff}, {0x8280, 0x0001}, -{0x8281, 0x000f}, {0x8282, 0x0096}, {0x8283, 0x0046}, -{0x8284, 0x0084}, {0x8285, 0x000c}, {0x8286, 0x0081}, -{0x8287, 0x0004}, {0x8288, 0x0026}, {0x8289, 0x000a}, -{0x828a, 0x00b6}, {0x828b, 0x0012}, {0x828c, 0x0020}, -{0x828d, 0x0084}, {0x828e, 0x0020}, {0x828f, 0x0027}, -{0x8290, 0x00b5}, {0x8291, 0x007e}, {0x8292, 0x0084}, -{0x8293, 0x0025}, {0x8294, 0x00bd}, {0x8295, 0x00f7}, -{0x8296, 0x001f}, {0x8297, 0x007e}, {0x8298, 0x0084}, -{0x8299, 0x001f}, {0x829a, 0x0096}, {0x829b, 0x0047}, -{0x829c, 0x0084}, {0x829d, 0x00f3}, {0x829e, 0x008a}, -{0x829f, 0x0008}, {0x82a0, 0x0097}, {0x82a1, 0x0047}, -{0x82a2, 0x00de}, {0x82a3, 0x00e1}, {0x82a4, 0x00ad}, -{0x82a5, 0x0000}, {0x82a6, 0x00ce}, {0x82a7, 0x0082}, -{0x82a8, 0x00af}, {0x82a9, 0x00ff}, {0x82aa, 0x0001}, -{0x82ab, 0x000f}, {0x82ac, 0x007e}, {0x82ad, 0x0084}, -{0x82ae, 0x0025}, {0x82af, 0x0096}, {0x82b0, 0x0041}, -{0x82b1, 0x0085}, {0x82b2, 0x0010}, {0x82b3, 0x0026}, -{0x82b4, 0x0006}, {0x82b5, 0x0096}, {0x82b6, 0x0023}, -{0x82b7, 0x0085}, {0x82b8, 0x0040}, {0x82b9, 0x0027}, -{0x82ba, 0x0006}, {0x82bb, 0x00bd}, {0x82bc, 0x00ed}, -{0x82bd, 0x0000}, {0x82be, 0x007e}, {0x82bf, 0x0083}, -{0x82c0, 0x00a2}, {0x82c1, 0x00de}, {0x82c2, 0x0042}, -{0x82c3, 0x00bd}, {0x82c4, 0x00eb}, {0x82c5, 0x008e}, -{0x82c6, 0x0096}, {0x82c7, 0x0024}, {0x82c8, 0x0084}, -{0x82c9, 0x0008}, {0x82ca, 0x0027}, {0x82cb, 0x0003}, -{0x82cc, 0x007e}, {0x82cd, 0x0083}, {0x82ce, 0x00df}, -{0x82cf, 0x0096}, {0x82d0, 0x007b}, {0x82d1, 0x00d6}, -{0x82d2, 0x007c}, {0x82d3, 0x00fe}, {0x82d4, 0x008f}, -{0x82d5, 0x0056}, {0x82d6, 0x00bd}, {0x82d7, 0x00f7}, -{0x82d8, 0x00b6}, {0x82d9, 0x00fe}, {0x82da, 0x008f}, -{0x82db, 0x0050}, {0x82dc, 0x00bd}, {0x82dd, 0x00ec}, -{0x82de, 0x008e}, {0x82df, 0x00bd}, {0x82e0, 0x00fa}, -{0x82e1, 0x00f7}, {0x82e2, 0x0086}, {0x82e3, 0x0011}, -{0x82e4, 0x00c6}, {0x82e5, 0x0049}, {0x82e6, 0x00bd}, -{0x82e7, 0x00e4}, {0x82e8, 0x0012}, {0x82e9, 0x00ce}, -{0x82ea, 0x0082}, {0x82eb, 0x00ef}, {0x82ec, 0x00ff}, -{0x82ed, 0x0001}, {0x82ee, 0x000f}, {0x82ef, 0x0096}, -{0x82f0, 0x0046}, {0x82f1, 0x0084}, {0x82f2, 0x000c}, -{0x82f3, 0x0081}, {0x82f4, 0x0000}, {0x82f5, 0x0027}, -{0x82f6, 0x0017}, {0x82f7, 0x00c6}, {0x82f8, 0x0049}, -{0x82f9, 0x00bd}, {0x82fa, 0x00e4}, {0x82fb, 0x0091}, -{0x82fc, 0x0024}, {0x82fd, 0x000d}, {0x82fe, 0x00b6}, -{0x82ff, 0x0012}, {0x8300, 0x0020}, {0x8301, 0x0085}, -{0x8302, 0x0020}, {0x8303, 0x0026}, {0x8304, 0x000c}, -{0x8305, 0x00ce}, {0x8306, 0x0082}, {0x8307, 0x00c1}, -{0x8308, 0x00ff}, {0x8309, 0x0001}, {0x830a, 0x000f}, -{0x830b, 0x007e}, {0x830c, 0x0084}, {0x830d, 0x0025}, -{0x830e, 0x007e}, {0x830f, 0x0084}, {0x8310, 0x0016}, -{0x8311, 0x00fe}, {0x8312, 0x008f}, {0x8313, 0x0052}, -{0x8314, 0x00bd}, {0x8315, 0x00ec}, {0x8316, 0x008e}, -{0x8317, 0x00bd}, {0x8318, 0x00fa}, {0x8319, 0x00f7}, -{0x831a, 0x0086}, {0x831b, 0x006a}, {0x831c, 0x00c6}, -{0x831d, 0x0049}, {0x831e, 0x00bd}, {0x831f, 0x00e4}, -{0x8320, 0x0012}, {0x8321, 0x00ce}, {0x8322, 0x0083}, -{0x8323, 0x0027}, {0x8324, 0x00ff}, {0x8325, 0x0001}, -{0x8326, 0x000f}, {0x8327, 0x0096}, {0x8328, 0x0046}, -{0x8329, 0x0084}, {0x832a, 0x000c}, {0x832b, 0x0081}, -{0x832c, 0x0000}, {0x832d, 0x0027}, {0x832e, 0x000a}, -{0x832f, 0x00c6}, {0x8330, 0x0049}, {0x8331, 0x00bd}, -{0x8332, 0x00e4}, {0x8333, 0x0091}, {0x8334, 0x0025}, -{0x8335, 0x0006}, {0x8336, 0x007e}, {0x8337, 0x0084}, -{0x8338, 0x0025}, {0x8339, 0x007e}, {0x833a, 0x0084}, -{0x833b, 0x0016}, {0x833c, 0x00b6}, {0x833d, 0x0018}, -{0x833e, 0x0070}, {0x833f, 0x00bb}, {0x8340, 0x0019}, -{0x8341, 0x0070}, {0x8342, 0x002a}, {0x8343, 0x0004}, -{0x8344, 0x0081}, {0x8345, 0x00af}, {0x8346, 0x002e}, -{0x8347, 0x0019}, {0x8348, 0x0096}, {0x8349, 0x007b}, -{0x834a, 0x00f6}, {0x834b, 0x0020}, {0x834c, 0x0007}, -{0x834d, 0x00fa}, {0x834e, 0x0020}, {0x834f, 0x0027}, -{0x8350, 0x00c4}, {0x8351, 0x0038}, {0x8352, 0x0081}, -{0x8353, 0x0038}, {0x8354, 0x0027}, {0x8355, 0x000b}, -{0x8356, 0x00f6}, {0x8357, 0x0020}, {0x8358, 0x0007}, -{0x8359, 0x00fa}, {0x835a, 0x0020}, {0x835b, 0x0027}, -{0x835c, 0x00cb}, {0x835d, 0x0008}, {0x835e, 0x007e}, -{0x835f, 0x0082}, {0x8360, 0x00d3}, {0x8361, 0x00bd}, -{0x8362, 0x00f7}, {0x8363, 0x0066}, {0x8364, 0x0086}, -{0x8365, 0x0074}, {0x8366, 0x00c6}, {0x8367, 0x0049}, -{0x8368, 0x00bd}, {0x8369, 0x00e4}, {0x836a, 0x0012}, -{0x836b, 0x00ce}, {0x836c, 0x0083}, {0x836d, 0x0071}, -{0x836e, 0x00ff}, {0x836f, 0x0001}, {0x8370, 0x000f}, -{0x8371, 0x0096}, {0x8372, 0x0046}, {0x8373, 0x0084}, -{0x8374, 0x000c}, {0x8375, 0x0081}, {0x8376, 0x0008}, -{0x8377, 0x0026}, {0x8378, 0x000a}, {0x8379, 0x00c6}, -{0x837a, 0x0049}, {0x837b, 0x00bd}, {0x837c, 0x00e4}, -{0x837d, 0x0091}, {0x837e, 0x0025}, {0x837f, 0x0006}, -{0x8380, 0x007e}, {0x8381, 0x0084}, {0x8382, 0x0025}, -{0x8383, 0x007e}, {0x8384, 0x0084}, {0x8385, 0x0016}, -{0x8386, 0x00bd}, {0x8387, 0x00f7}, {0x8388, 0x003e}, -{0x8389, 0x0026}, {0x838a, 0x000e}, {0x838b, 0x00bd}, -{0x838c, 0x00e5}, {0x838d, 0x0009}, {0x838e, 0x0026}, -{0x838f, 0x0006}, {0x8390, 0x00ce}, {0x8391, 0x0082}, -{0x8392, 0x00c1}, {0x8393, 0x00ff}, {0x8394, 0x0001}, -{0x8395, 0x000f}, {0x8396, 0x007e}, {0x8397, 0x0084}, -{0x8398, 0x0025}, {0x8399, 0x00fe}, {0x839a, 0x008f}, -{0x839b, 0x0054}, {0x839c, 0x00bd}, {0x839d, 0x00ec}, -{0x839e, 0x008e}, {0x839f, 0x00bd}, {0x83a0, 0x00fa}, -{0x83a1, 0x00f7}, {0x83a2, 0x00bd}, {0x83a3, 0x00f7}, -{0x83a4, 0x0033}, {0x83a5, 0x0086}, {0x83a6, 0x000f}, -{0x83a7, 0x00c6}, {0x83a8, 0x0051}, {0x83a9, 0x00bd}, -{0x83aa, 0x00e4}, {0x83ab, 0x0012}, {0x83ac, 0x00ce}, -{0x83ad, 0x0083}, {0x83ae, 0x00b2}, {0x83af, 0x00ff}, -{0x83b0, 0x0001}, {0x83b1, 0x000f}, {0x83b2, 0x0096}, -{0x83b3, 0x0046}, {0x83b4, 0x0084}, {0x83b5, 0x000c}, -{0x83b6, 0x0081}, {0x83b7, 0x0008}, {0x83b8, 0x0026}, -{0x83b9, 0x005c}, {0x83ba, 0x00b6}, {0x83bb, 0x0012}, -{0x83bc, 0x0020}, {0x83bd, 0x0084}, {0x83be, 0x003f}, -{0x83bf, 0x0081}, {0x83c0, 0x003a}, {0x83c1, 0x0027}, -{0x83c2, 0x001c}, {0x83c3, 0x0096}, {0x83c4, 0x0023}, -{0x83c5, 0x0085}, {0x83c6, 0x0040}, {0x83c7, 0x0027}, -{0x83c8, 0x0003}, {0x83c9, 0x007e}, {0x83ca, 0x0084}, -{0x83cb, 0x0025}, {0x83cc, 0x00c6}, {0x83cd, 0x0051}, -{0x83ce, 0x00bd}, {0x83cf, 0x00e4}, {0x83d0, 0x0091}, -{0x83d1, 0x0025}, {0x83d2, 0x0003}, {0x83d3, 0x007e}, -{0x83d4, 0x0084}, {0x83d5, 0x0025}, {0x83d6, 0x00ce}, -{0x83d7, 0x0082}, {0x83d8, 0x00c1}, {0x83d9, 0x00ff}, -{0x83da, 0x0001}, {0x83db, 0x000f}, {0x83dc, 0x007e}, -{0x83dd, 0x0084}, {0x83de, 0x0025}, {0x83df, 0x00bd}, -{0x83e0, 0x00f8}, {0x83e1, 0x0037}, {0x83e2, 0x007c}, -{0x83e3, 0x0000}, {0x83e4, 0x007a}, {0x83e5, 0x00ce}, -{0x83e6, 0x0083}, {0x83e7, 0x00ee}, {0x83e8, 0x00ff}, -{0x83e9, 0x0001}, {0x83ea, 0x000f}, {0x83eb, 0x007e}, -{0x83ec, 0x0084}, {0x83ed, 0x0025}, {0x83ee, 0x0096}, -{0x83ef, 0x0046}, {0x83f0, 0x0084}, {0x83f1, 0x000c}, -{0x83f2, 0x0081}, {0x83f3, 0x0008}, {0x83f4, 0x0026}, -{0x83f5, 0x0020}, {0x83f6, 0x0096}, {0x83f7, 0x0024}, -{0x83f8, 0x0084}, {0x83f9, 0x0008}, {0x83fa, 0x0026}, -{0x83fb, 0x0029}, {0x83fc, 0x00b6}, {0x83fd, 0x0018}, -{0x83fe, 0x0082}, {0x83ff, 0x00bb}, {0x8400, 0x0019}, -{0x8401, 0x0082}, {0x8402, 0x00b1}, {0x8403, 0x0001}, -{0x8404, 0x003b}, {0x8405, 0x0022}, {0x8406, 0x0009}, -{0x8407, 0x00b6}, {0x8408, 0x0012}, {0x8409, 0x0020}, -{0x840a, 0x0084}, {0x840b, 0x0037}, {0x840c, 0x0081}, -{0x840d, 0x0032}, {0x840e, 0x0027}, {0x840f, 0x0015}, -{0x8410, 0x00bd}, {0x8411, 0x00f8}, {0x8412, 0x0044}, -{0x8413, 0x007e}, {0x8414, 0x0082}, {0x8415, 0x00c1}, -{0x8416, 0x00bd}, {0x8417, 0x00f7}, {0x8418, 0x001f}, -{0x8419, 0x00bd}, {0x841a, 0x00f8}, {0x841b, 0x0044}, -{0x841c, 0x00bd}, {0x841d, 0x00fc}, {0x841e, 0x0029}, -{0x841f, 0x00ce}, {0x8420, 0x0082}, {0x8421, 0x0025}, -{0x8422, 0x00ff}, {0x8423, 0x0001}, {0x8424, 0x000f}, -{0x8425, 0x0039}, {0x8426, 0x0096}, {0x8427, 0x0047}, -{0x8428, 0x0084}, {0x8429, 0x00fc}, {0x842a, 0x008a}, -{0x842b, 0x0000}, {0x842c, 0x0097}, {0x842d, 0x0047}, -{0x842e, 0x00ce}, {0x842f, 0x0084}, {0x8430, 0x0034}, -{0x8431, 0x00ff}, {0x8432, 0x0001}, {0x8433, 0x0011}, -{0x8434, 0x0096}, {0x8435, 0x0046}, {0x8436, 0x0084}, -{0x8437, 0x0003}, {0x8438, 0x0081}, {0x8439, 0x0002}, -{0x843a, 0x0027}, {0x843b, 0x0003}, {0x843c, 0x007e}, -{0x843d, 0x0085}, {0x843e, 0x001e}, {0x843f, 0x0096}, -{0x8440, 0x0047}, {0x8441, 0x0084}, {0x8442, 0x00fc}, -{0x8443, 0x008a}, {0x8444, 0x0002}, {0x8445, 0x0097}, -{0x8446, 0x0047}, {0x8447, 0x00de}, {0x8448, 0x00e1}, -{0x8449, 0x00ad}, {0x844a, 0x0000}, {0x844b, 0x0086}, -{0x844c, 0x0001}, {0x844d, 0x00b7}, {0x844e, 0x0012}, -{0x844f, 0x0051}, {0x8450, 0x00bd}, {0x8451, 0x00f7}, -{0x8452, 0x0014}, {0x8453, 0x00b6}, {0x8454, 0x0010}, -{0x8455, 0x0031}, {0x8456, 0x0084}, {0x8457, 0x00fd}, -{0x8458, 0x00b7}, {0x8459, 0x0010}, {0x845a, 0x0031}, -{0x845b, 0x00bd}, {0x845c, 0x00f8}, {0x845d, 0x001e}, -{0x845e, 0x0096}, {0x845f, 0x0081}, {0x8460, 0x00d6}, -{0x8461, 0x0082}, {0x8462, 0x00fe}, {0x8463, 0x008f}, -{0x8464, 0x005a}, {0x8465, 0x00bd}, {0x8466, 0x00f7}, -{0x8467, 0x00b6}, {0x8468, 0x00fe}, {0x8469, 0x008f}, -{0x846a, 0x005c}, {0x846b, 0x00bd}, {0x846c, 0x00ec}, -{0x846d, 0x008e}, {0x846e, 0x00bd}, {0x846f, 0x00fa}, -{0x8470, 0x00f7}, {0x8471, 0x0086}, {0x8472, 0x0008}, -{0x8473, 0x00d6}, {0x8474, 0x0000}, {0x8475, 0x00c5}, -{0x8476, 0x0010}, {0x8477, 0x0026}, {0x8478, 0x0002}, -{0x8479, 0x008b}, {0x847a, 0x0020}, {0x847b, 0x00c6}, -{0x847c, 0x0051}, {0x847d, 0x00bd}, {0x847e, 0x00e4}, -{0x847f, 0x0012}, {0x8480, 0x00ce}, {0x8481, 0x0084}, -{0x8482, 0x0086}, {0x8483, 0x00ff}, {0x8484, 0x0001}, -{0x8485, 0x0011}, {0x8486, 0x0096}, {0x8487, 0x0046}, -{0x8488, 0x0084}, {0x8489, 0x0003}, {0x848a, 0x0081}, -{0x848b, 0x0002}, {0x848c, 0x0027}, {0x848d, 0x0003}, -{0x848e, 0x007e}, {0x848f, 0x0085}, {0x8490, 0x000f}, -{0x8491, 0x00c6}, {0x8492, 0x0051}, {0x8493, 0x00bd}, -{0x8494, 0x00e4}, {0x8495, 0x0091}, {0x8496, 0x0025}, -{0x8497, 0x0003}, {0x8498, 0x007e}, {0x8499, 0x0085}, -{0x849a, 0x001e}, {0x849b, 0x0096}, {0x849c, 0x0044}, -{0x849d, 0x0085}, {0x849e, 0x0010}, {0x849f, 0x0026}, -{0x84a0, 0x000a}, {0x84a1, 0x00b6}, {0x84a2, 0x0012}, -{0x84a3, 0x0050}, {0x84a4, 0x00ba}, {0x84a5, 0x0001}, -{0x84a6, 0x003c}, {0x84a7, 0x0085}, {0x84a8, 0x0010}, -{0x84a9, 0x0027}, {0x84aa, 0x00a8}, {0x84ab, 0x00bd}, -{0x84ac, 0x00f7}, {0x84ad, 0x0066}, {0x84ae, 0x00ce}, -{0x84af, 0x0084}, {0x84b0, 0x00b7}, {0x84b1, 0x00ff}, -{0x84b2, 0x0001}, {0x84b3, 0x0011}, {0x84b4, 0x007e}, -{0x84b5, 0x0085}, {0x84b6, 0x001e}, {0x84b7, 0x0096}, -{0x84b8, 0x0046}, {0x84b9, 0x0084}, {0x84ba, 0x0003}, -{0x84bb, 0x0081}, {0x84bc, 0x0002}, {0x84bd, 0x0026}, -{0x84be, 0x0050}, {0x84bf, 0x00b6}, {0x84c0, 0x0012}, -{0x84c1, 0x0030}, {0x84c2, 0x0084}, {0x84c3, 0x0003}, -{0x84c4, 0x0081}, {0x84c5, 0x0001}, {0x84c6, 0x0027}, -{0x84c7, 0x0003}, {0x84c8, 0x007e}, {0x84c9, 0x0085}, -{0x84ca, 0x001e}, {0x84cb, 0x0096}, {0x84cc, 0x0044}, -{0x84cd, 0x0085}, {0x84ce, 0x0010}, {0x84cf, 0x0026}, -{0x84d0, 0x0013}, {0x84d1, 0x00b6}, {0x84d2, 0x0012}, -{0x84d3, 0x0050}, {0x84d4, 0x00ba}, {0x84d5, 0x0001}, -{0x84d6, 0x003c}, {0x84d7, 0x0085}, {0x84d8, 0x0010}, -{0x84d9, 0x0026}, {0x84da, 0x0009}, {0x84db, 0x00ce}, -{0x84dc, 0x0084}, {0x84dd, 0x0053}, {0x84de, 0x00ff}, -{0x84df, 0x0001}, {0x84e0, 0x0011}, {0x84e1, 0x007e}, -{0x84e2, 0x0085}, {0x84e3, 0x001e}, {0x84e4, 0x00b6}, -{0x84e5, 0x0010}, {0x84e6, 0x0031}, {0x84e7, 0x008a}, -{0x84e8, 0x0002}, {0x84e9, 0x00b7}, {0x84ea, 0x0010}, -{0x84eb, 0x0031}, {0x84ec, 0x00bd}, {0x84ed, 0x0085}, -{0x84ee, 0x001f}, {0x84ef, 0x00bd}, {0x84f0, 0x00f8}, -{0x84f1, 0x0037}, {0x84f2, 0x007c}, {0x84f3, 0x0000}, -{0x84f4, 0x0080}, {0x84f5, 0x00ce}, {0x84f6, 0x0084}, -{0x84f7, 0x00fe}, {0x84f8, 0x00ff}, {0x84f9, 0x0001}, -{0x84fa, 0x0011}, {0x84fb, 0x007e}, {0x84fc, 0x0085}, -{0x84fd, 0x001e}, {0x84fe, 0x0096}, {0x84ff, 0x0046}, -{0x8500, 0x0084}, {0x8501, 0x0003}, {0x8502, 0x0081}, -{0x8503, 0x0002}, {0x8504, 0x0026}, {0x8505, 0x0009}, -{0x8506, 0x00b6}, {0x8507, 0x0012}, {0x8508, 0x0030}, -{0x8509, 0x0084}, {0x850a, 0x0003}, {0x850b, 0x0081}, -{0x850c, 0x0001}, {0x850d, 0x0027}, {0x850e, 0x000f}, -{0x850f, 0x00bd}, {0x8510, 0x00f8}, {0x8511, 0x0044}, -{0x8512, 0x00bd}, {0x8513, 0x00f7}, {0x8514, 0x000b}, -{0x8515, 0x00bd}, {0x8516, 0x00fc}, {0x8517, 0x0029}, -{0x8518, 0x00ce}, {0x8519, 0x0084}, {0x851a, 0x0026}, -{0x851b, 0x00ff}, {0x851c, 0x0001}, {0x851d, 0x0011}, -{0x851e, 0x0039}, {0x851f, 0x00d6}, {0x8520, 0x0022}, -{0x8521, 0x00c4}, {0x8522, 0x000f}, {0x8523, 0x00b6}, -{0x8524, 0x0012}, {0x8525, 0x0030}, {0x8526, 0x00ba}, -{0x8527, 0x0012}, {0x8528, 0x0032}, {0x8529, 0x0084}, -{0x852a, 0x0004}, {0x852b, 0x0027}, {0x852c, 0x000d}, -{0x852d, 0x0096}, {0x852e, 0x0022}, {0x852f, 0x0085}, -{0x8530, 0x0004}, {0x8531, 0x0027}, {0x8532, 0x0005}, -{0x8533, 0x00ca}, {0x8534, 0x0010}, {0x8535, 0x007e}, -{0x8536, 0x0085}, {0x8537, 0x003a}, {0x8538, 0x00ca}, -{0x8539, 0x0020}, {0x853a, 0x00d7}, {0x853b, 0x0022}, -{0x853c, 0x0039}, {0x853d, 0x0086}, {0x853e, 0x0000}, -{0x853f, 0x0097}, {0x8540, 0x0083}, {0x8541, 0x0018}, -{0x8542, 0x00ce}, {0x8543, 0x001c}, {0x8544, 0x0000}, -{0x8545, 0x00bd}, {0x8546, 0x00eb}, {0x8547, 0x0046}, -{0x8548, 0x0096}, {0x8549, 0x0057}, {0x854a, 0x0085}, -{0x854b, 0x0001}, {0x854c, 0x0027}, {0x854d, 0x0002}, -{0x854e, 0x004f}, {0x854f, 0x0039}, {0x8550, 0x0085}, -{0x8551, 0x0002}, {0x8552, 0x0027}, {0x8553, 0x0001}, -{0x8554, 0x0039}, {0x8555, 0x007f}, {0x8556, 0x008f}, -{0x8557, 0x007d}, {0x8558, 0x0086}, {0x8559, 0x0004}, -{0x855a, 0x00b7}, {0x855b, 0x0012}, {0x855c, 0x0004}, -{0x855d, 0x0086}, {0x855e, 0x0008}, {0x855f, 0x00b7}, -{0x8560, 0x0012}, {0x8561, 0x0007}, {0x8562, 0x0086}, -{0x8563, 0x0010}, {0x8564, 0x00b7}, {0x8565, 0x0012}, -{0x8566, 0x000c}, {0x8567, 0x0086}, {0x8568, 0x0007}, -{0x8569, 0x00b7}, {0x856a, 0x0012}, {0x856b, 0x0006}, -{0x856c, 0x00b6}, {0x856d, 0x008f}, {0x856e, 0x007d}, -{0x856f, 0x00b7}, {0x8570, 0x0012}, {0x8571, 0x0070}, -{0x8572, 0x0086}, {0x8573, 0x0001}, {0x8574, 0x00ba}, -{0x8575, 0x0012}, {0x8576, 0x0004}, {0x8577, 0x00b7}, -{0x8578, 0x0012}, {0x8579, 0x0004}, {0x857a, 0x0001}, -{0x857b, 0x0001}, {0x857c, 0x0001}, {0x857d, 0x0001}, -{0x857e, 0x0001}, {0x857f, 0x0001}, {0x8580, 0x00b6}, -{0x8581, 0x0012}, {0x8582, 0x0004}, {0x8583, 0x0084}, -{0x8584, 0x00fe}, {0x8585, 0x008a}, {0x8586, 0x0002}, -{0x8587, 0x00b7}, {0x8588, 0x0012}, {0x8589, 0x0004}, -{0x858a, 0x0001}, {0x858b, 0x0001}, {0x858c, 0x0001}, -{0x858d, 0x0001}, {0x858e, 0x0001}, {0x858f, 0x0001}, -{0x8590, 0x0086}, {0x8591, 0x00fd}, {0x8592, 0x00b4}, -{0x8593, 0x0012}, {0x8594, 0x0004}, {0x8595, 0x00b7}, -{0x8596, 0x0012}, {0x8597, 0x0004}, {0x8598, 0x00b6}, -{0x8599, 0x0012}, {0x859a, 0x0000}, {0x859b, 0x0084}, -{0x859c, 0x0008}, {0x859d, 0x0081}, {0x859e, 0x0008}, -{0x859f, 0x0027}, {0x85a0, 0x0016}, {0x85a1, 0x00b6}, -{0x85a2, 0x008f}, {0x85a3, 0x007d}, {0x85a4, 0x0081}, -{0x85a5, 0x000c}, {0x85a6, 0x0027}, {0x85a7, 0x0008}, -{0x85a8, 0x008b}, {0x85a9, 0x0004}, {0x85aa, 0x00b7}, -{0x85ab, 0x008f}, {0x85ac, 0x007d}, {0x85ad, 0x007e}, -{0x85ae, 0x0085}, {0x85af, 0x006c}, {0x85b0, 0x0086}, -{0x85b1, 0x0003}, {0x85b2, 0x0097}, {0x85b3, 0x0040}, -{0x85b4, 0x007e}, {0x85b5, 0x0089}, {0x85b6, 0x006e}, -{0x85b7, 0x0086}, {0x85b8, 0x0007}, {0x85b9, 0x00b7}, -{0x85ba, 0x0012}, {0x85bb, 0x0006}, {0x85bc, 0x005f}, -{0x85bd, 0x00f7}, {0x85be, 0x008f}, {0x85bf, 0x0082}, -{0x85c0, 0x005f}, {0x85c1, 0x00f7}, {0x85c2, 0x008f}, -{0x85c3, 0x007f}, {0x85c4, 0x00f7}, {0x85c5, 0x008f}, -{0x85c6, 0x0070}, {0x85c7, 0x00f7}, {0x85c8, 0x008f}, -{0x85c9, 0x0071}, {0x85ca, 0x00f7}, {0x85cb, 0x008f}, -{0x85cc, 0x0072}, {0x85cd, 0x00f7}, {0x85ce, 0x008f}, -{0x85cf, 0x0073}, {0x85d0, 0x00f7}, {0x85d1, 0x008f}, -{0x85d2, 0x0074}, {0x85d3, 0x00f7}, {0x85d4, 0x008f}, -{0x85d5, 0x0075}, {0x85d6, 0x00f7}, {0x85d7, 0x008f}, -{0x85d8, 0x0076}, {0x85d9, 0x00f7}, {0x85da, 0x008f}, -{0x85db, 0x0077}, {0x85dc, 0x00f7}, {0x85dd, 0x008f}, -{0x85de, 0x0078}, {0x85df, 0x00f7}, {0x85e0, 0x008f}, -{0x85e1, 0x0079}, {0x85e2, 0x00f7}, {0x85e3, 0x008f}, -{0x85e4, 0x007a}, {0x85e5, 0x00f7}, {0x85e6, 0x008f}, -{0x85e7, 0x007b}, {0x85e8, 0x00b6}, {0x85e9, 0x0012}, -{0x85ea, 0x0004}, {0x85eb, 0x008a}, {0x85ec, 0x0010}, -{0x85ed, 0x00b7}, {0x85ee, 0x0012}, {0x85ef, 0x0004}, -{0x85f0, 0x0086}, {0x85f1, 0x00e4}, {0x85f2, 0x00b7}, -{0x85f3, 0x0012}, {0x85f4, 0x0070}, {0x85f5, 0x00b7}, -{0x85f6, 0x0012}, {0x85f7, 0x0007}, {0x85f8, 0x00f7}, -{0x85f9, 0x0012}, {0x85fa, 0x0005}, {0x85fb, 0x00f7}, -{0x85fc, 0x0012}, {0x85fd, 0x0009}, {0x85fe, 0x0086}, -{0x85ff, 0x0008}, {0x8600, 0x00ba}, {0x8601, 0x0012}, -{0x8602, 0x0004}, {0x8603, 0x00b7}, {0x8604, 0x0012}, -{0x8605, 0x0004}, {0x8606, 0x0086}, {0x8607, 0x00f7}, -{0x8608, 0x00b4}, {0x8609, 0x0012}, {0x860a, 0x0004}, -{0x860b, 0x00b7}, {0x860c, 0x0012}, {0x860d, 0x0004}, -{0x860e, 0x0001}, {0x860f, 0x0001}, {0x8610, 0x0001}, -{0x8611, 0x0001}, {0x8612, 0x0001}, {0x8613, 0x0001}, -{0x8614, 0x00b6}, {0x8615, 0x0012}, {0x8616, 0x0008}, -{0x8617, 0x0027}, {0x8618, 0x007f}, {0x8619, 0x0081}, -{0x861a, 0x0080}, {0x861b, 0x0026}, {0x861c, 0x000b}, -{0x861d, 0x0086}, {0x861e, 0x0008}, {0x861f, 0x00ce}, -{0x8620, 0x008f}, {0x8621, 0x0079}, {0x8622, 0x00bd}, -{0x8623, 0x0089}, {0x8624, 0x007b}, {0x8625, 0x007e}, -{0x8626, 0x0086}, {0x8627, 0x008e}, {0x8628, 0x0081}, -{0x8629, 0x0040}, {0x862a, 0x0026}, {0x862b, 0x000b}, -{0x862c, 0x0086}, {0x862d, 0x0004}, {0x862e, 0x00ce}, -{0x862f, 0x008f}, {0x8630, 0x0076}, {0x8631, 0x00bd}, -{0x8632, 0x0089}, {0x8633, 0x007b}, {0x8634, 0x007e}, -{0x8635, 0x0086}, {0x8636, 0x008e}, {0x8637, 0x0081}, -{0x8638, 0x0020}, {0x8639, 0x0026}, {0x863a, 0x000b}, -{0x863b, 0x0086}, {0x863c, 0x0002}, {0x863d, 0x00ce}, -{0x863e, 0x008f}, {0x863f, 0x0073}, {0x8640, 0x00bd}, -{0x8641, 0x0089}, {0x8642, 0x007b}, {0x8643, 0x007e}, -{0x8644, 0x0086}, {0x8645, 0x008e}, {0x8646, 0x0081}, -{0x8647, 0x0010}, {0x8648, 0x0026}, {0x8649, 0x000b}, -{0x864a, 0x0086}, {0x864b, 0x0001}, {0x864c, 0x00ce}, -{0x864d, 0x008f}, {0x864e, 0x0070}, {0x864f, 0x00bd}, -{0x8650, 0x0089}, {0x8651, 0x007b}, {0x8652, 0x007e}, -{0x8653, 0x0086}, {0x8654, 0x008e}, {0x8655, 0x0081}, -{0x8656, 0x0008}, {0x8657, 0x0026}, {0x8658, 0x000b}, -{0x8659, 0x0086}, {0x865a, 0x0008}, {0x865b, 0x00ce}, -{0x865c, 0x008f}, {0x865d, 0x0079}, {0x865e, 0x00bd}, -{0x865f, 0x0089}, {0x8660, 0x007f}, {0x8661, 0x007e}, -{0x8662, 0x0086}, {0x8663, 0x008e}, {0x8664, 0x0081}, -{0x8665, 0x0004}, {0x8666, 0x0026}, {0x8667, 0x000b}, -{0x8668, 0x0086}, {0x8669, 0x0004}, {0x866a, 0x00ce}, -{0x866b, 0x008f}, {0x866c, 0x0076}, {0x866d, 0x00bd}, -{0x866e, 0x0089}, {0x866f, 0x007f}, {0x8670, 0x007e}, -{0x8671, 0x0086}, {0x8672, 0x008e}, {0x8673, 0x0081}, -{0x8674, 0x0002}, {0x8675, 0x0026}, {0x8676, 0x000b}, -{0x8677, 0x008a}, {0x8678, 0x0002}, {0x8679, 0x00ce}, -{0x867a, 0x008f}, {0x867b, 0x0073}, {0x867c, 0x00bd}, -{0x867d, 0x0089}, {0x867e, 0x007f}, {0x867f, 0x007e}, -{0x8680, 0x0086}, {0x8681, 0x008e}, {0x8682, 0x0081}, -{0x8683, 0x0001}, {0x8684, 0x0026}, {0x8685, 0x0008}, -{0x8686, 0x0086}, {0x8687, 0x0001}, {0x8688, 0x00ce}, -{0x8689, 0x008f}, {0x868a, 0x0070}, {0x868b, 0x00bd}, -{0x868c, 0x0089}, {0x868d, 0x007f}, {0x868e, 0x00b6}, -{0x868f, 0x008f}, {0x8690, 0x007f}, {0x8691, 0x0081}, -{0x8692, 0x000f}, {0x8693, 0x0026}, {0x8694, 0x0003}, -{0x8695, 0x007e}, {0x8696, 0x0087}, {0x8697, 0x0047}, -{0x8698, 0x00b6}, {0x8699, 0x0012}, {0x869a, 0x0009}, -{0x869b, 0x0084}, {0x869c, 0x0003}, {0x869d, 0x0081}, -{0x869e, 0x0003}, {0x869f, 0x0027}, {0x86a0, 0x0006}, -{0x86a1, 0x007c}, {0x86a2, 0x0012}, {0x86a3, 0x0009}, -{0x86a4, 0x007e}, {0x86a5, 0x0085}, {0x86a6, 0x00fe}, -{0x86a7, 0x00b6}, {0x86a8, 0x0012}, {0x86a9, 0x0006}, -{0x86aa, 0x0084}, {0x86ab, 0x0007}, {0x86ac, 0x0081}, -{0x86ad, 0x0007}, {0x86ae, 0x0027}, {0x86af, 0x0008}, -{0x86b0, 0x008b}, {0x86b1, 0x0001}, {0x86b2, 0x00b7}, -{0x86b3, 0x0012}, {0x86b4, 0x0006}, {0x86b5, 0x007e}, -{0x86b6, 0x0086}, {0x86b7, 0x00d5}, {0x86b8, 0x00b6}, -{0x86b9, 0x008f}, {0x86ba, 0x0082}, {0x86bb, 0x0026}, -{0x86bc, 0x000a}, {0x86bd, 0x007c}, {0x86be, 0x008f}, -{0x86bf, 0x0082}, {0x86c0, 0x004f}, {0x86c1, 0x00b7}, -{0x86c2, 0x0012}, {0x86c3, 0x0006}, {0x86c4, 0x007e}, -{0x86c5, 0x0085}, {0x86c6, 0x00c0}, {0x86c7, 0x00b6}, -{0x86c8, 0x0012}, {0x86c9, 0x0006}, {0x86ca, 0x0084}, -{0x86cb, 0x003f}, {0x86cc, 0x0081}, {0x86cd, 0x003f}, -{0x86ce, 0x0027}, {0x86cf, 0x0010}, {0x86d0, 0x008b}, -{0x86d1, 0x0008}, {0x86d2, 0x00b7}, {0x86d3, 0x0012}, -{0x86d4, 0x0006}, {0x86d5, 0x00b6}, {0x86d6, 0x0012}, -{0x86d7, 0x0009}, {0x86d8, 0x0084}, {0x86d9, 0x00fc}, -{0x86da, 0x00b7}, {0x86db, 0x0012}, {0x86dc, 0x0009}, -{0x86dd, 0x007e}, {0x86de, 0x0085}, {0x86df, 0x00fe}, -{0x86e0, 0x00ce}, {0x86e1, 0x008f}, {0x86e2, 0x0070}, -{0x86e3, 0x0018}, {0x86e4, 0x00ce}, {0x86e5, 0x008f}, -{0x86e6, 0x0084}, {0x86e7, 0x00c6}, {0x86e8, 0x000c}, -{0x86e9, 0x00bd}, {0x86ea, 0x0089}, {0x86eb, 0x006f}, -{0x86ec, 0x00ce}, {0x86ed, 0x008f}, {0x86ee, 0x0084}, -{0x86ef, 0x0018}, {0x86f0, 0x00ce}, {0x86f1, 0x008f}, -{0x86f2, 0x0070}, {0x86f3, 0x00c6}, {0x86f4, 0x000c}, -{0x86f5, 0x00bd}, {0x86f6, 0x0089}, {0x86f7, 0x006f}, -{0x86f8, 0x00d6}, {0x86f9, 0x0083}, {0x86fa, 0x00c1}, -{0x86fb, 0x004f}, {0x86fc, 0x002d}, {0x86fd, 0x0003}, -{0x86fe, 0x007e}, {0x86ff, 0x0087}, {0x8700, 0x0040}, -{0x8701, 0x00b6}, {0x8702, 0x008f}, {0x8703, 0x007f}, -{0x8704, 0x0081}, {0x8705, 0x0007}, {0x8706, 0x0027}, -{0x8707, 0x000f}, {0x8708, 0x0081}, {0x8709, 0x000b}, -{0x870a, 0x0027}, {0x870b, 0x0015}, {0x870c, 0x0081}, -{0x870d, 0x000d}, {0x870e, 0x0027}, {0x870f, 0x001b}, -{0x8710, 0x0081}, {0x8711, 0x000e}, {0x8712, 0x0027}, -{0x8713, 0x0021}, {0x8714, 0x007e}, {0x8715, 0x0087}, -{0x8716, 0x0040}, {0x8717, 0x00f7}, {0x8718, 0x008f}, -{0x8719, 0x007b}, {0x871a, 0x0086}, {0x871b, 0x0002}, -{0x871c, 0x00b7}, {0x871d, 0x008f}, {0x871e, 0x007a}, -{0x871f, 0x0020}, {0x8720, 0x001c}, {0x8721, 0x00f7}, -{0x8722, 0x008f}, {0x8723, 0x0078}, {0x8724, 0x0086}, -{0x8725, 0x0002}, {0x8726, 0x00b7}, {0x8727, 0x008f}, -{0x8728, 0x0077}, {0x8729, 0x0020}, {0x872a, 0x0012}, -{0x872b, 0x00f7}, {0x872c, 0x008f}, {0x872d, 0x0075}, -{0x872e, 0x0086}, {0x872f, 0x0002}, {0x8730, 0x00b7}, -{0x8731, 0x008f}, {0x8732, 0x0074}, {0x8733, 0x0020}, -{0x8734, 0x0008}, {0x8735, 0x00f7}, {0x8736, 0x008f}, -{0x8737, 0x0072}, {0x8738, 0x0086}, {0x8739, 0x0002}, -{0x873a, 0x00b7}, {0x873b, 0x008f}, {0x873c, 0x0071}, -{0x873d, 0x007e}, {0x873e, 0x0087}, {0x873f, 0x0047}, -{0x8740, 0x0086}, {0x8741, 0x0004}, {0x8742, 0x0097}, -{0x8743, 0x0040}, {0x8744, 0x007e}, {0x8745, 0x0089}, -{0x8746, 0x006e}, {0x8747, 0x00ce}, {0x8748, 0x008f}, -{0x8749, 0x0072}, {0x874a, 0x00bd}, {0x874b, 0x0089}, -{0x874c, 0x00f7}, {0x874d, 0x00ce}, {0x874e, 0x008f}, -{0x874f, 0x0075}, {0x8750, 0x00bd}, {0x8751, 0x0089}, -{0x8752, 0x00f7}, {0x8753, 0x00ce}, {0x8754, 0x008f}, -{0x8755, 0x0078}, {0x8756, 0x00bd}, {0x8757, 0x0089}, -{0x8758, 0x00f7}, {0x8759, 0x00ce}, {0x875a, 0x008f}, -{0x875b, 0x007b}, {0x875c, 0x00bd}, {0x875d, 0x0089}, -{0x875e, 0x00f7}, {0x875f, 0x004f}, {0x8760, 0x00b7}, -{0x8761, 0x008f}, {0x8762, 0x007d}, {0x8763, 0x00b7}, -{0x8764, 0x008f}, {0x8765, 0x0081}, {0x8766, 0x00b6}, -{0x8767, 0x008f}, {0x8768, 0x0072}, {0x8769, 0x0027}, -{0x876a, 0x0047}, {0x876b, 0x007c}, {0x876c, 0x008f}, -{0x876d, 0x007d}, {0x876e, 0x00b6}, {0x876f, 0x008f}, -{0x8770, 0x0075}, {0x8771, 0x0027}, {0x8772, 0x003f}, -{0x8773, 0x007c}, {0x8774, 0x008f}, {0x8775, 0x007d}, -{0x8776, 0x00b6}, {0x8777, 0x008f}, {0x8778, 0x0078}, -{0x8779, 0x0027}, {0x877a, 0x0037}, {0x877b, 0x007c}, -{0x877c, 0x008f}, {0x877d, 0x007d}, {0x877e, 0x00b6}, -{0x877f, 0x008f}, {0x8780, 0x007b}, {0x8781, 0x0027}, -{0x8782, 0x002f}, {0x8783, 0x007f}, {0x8784, 0x008f}, -{0x8785, 0x007d}, {0x8786, 0x007c}, {0x8787, 0x008f}, -{0x8788, 0x0081}, {0x8789, 0x007a}, {0x878a, 0x008f}, -{0x878b, 0x0072}, {0x878c, 0x0027}, {0x878d, 0x001b}, -{0x878e, 0x007c}, {0x878f, 0x008f}, {0x8790, 0x007d}, -{0x8791, 0x007a}, {0x8792, 0x008f}, {0x8793, 0x0075}, -{0x8794, 0x0027}, {0x8795, 0x0016}, {0x8796, 0x007c}, -{0x8797, 0x008f}, {0x8798, 0x007d}, {0x8799, 0x007a}, -{0x879a, 0x008f}, {0x879b, 0x0078}, {0x879c, 0x0027}, -{0x879d, 0x0011}, {0x879e, 0x007c}, {0x879f, 0x008f}, -{0x87a0, 0x007d}, {0x87a1, 0x007a}, {0x87a2, 0x008f}, -{0x87a3, 0x007b}, {0x87a4, 0x0027}, {0x87a5, 0x000c}, -{0x87a6, 0x007e}, {0x87a7, 0x0087}, {0x87a8, 0x0083}, -{0x87a9, 0x007a}, {0x87aa, 0x008f}, {0x87ab, 0x0075}, -{0x87ac, 0x007a}, {0x87ad, 0x008f}, {0x87ae, 0x0078}, -{0x87af, 0x007a}, {0x87b0, 0x008f}, {0x87b1, 0x007b}, -{0x87b2, 0x00ce}, {0x87b3, 0x00c1}, {0x87b4, 0x00fc}, -{0x87b5, 0x00f6}, {0x87b6, 0x008f}, {0x87b7, 0x007d}, -{0x87b8, 0x003a}, {0x87b9, 0x00a6}, {0x87ba, 0x0000}, -{0x87bb, 0x00b7}, {0x87bc, 0x0012}, {0x87bd, 0x0070}, -{0x87be, 0x00b6}, {0x87bf, 0x008f}, {0x87c0, 0x0072}, -{0x87c1, 0x0026}, {0x87c2, 0x0003}, {0x87c3, 0x007e}, -{0x87c4, 0x0087}, {0x87c5, 0x00fa}, {0x87c6, 0x00b6}, -{0x87c7, 0x008f}, {0x87c8, 0x0075}, {0x87c9, 0x0026}, -{0x87ca, 0x000a}, {0x87cb, 0x0018}, {0x87cc, 0x00ce}, -{0x87cd, 0x008f}, {0x87ce, 0x0073}, {0x87cf, 0x00bd}, -{0x87d0, 0x0089}, {0x87d1, 0x00d5}, {0x87d2, 0x007e}, -{0x87d3, 0x0087}, {0x87d4, 0x00fa}, {0x87d5, 0x00b6}, -{0x87d6, 0x008f}, {0x87d7, 0x0078}, {0x87d8, 0x0026}, -{0x87d9, 0x000a}, {0x87da, 0x0018}, {0x87db, 0x00ce}, -{0x87dc, 0x008f}, {0x87dd, 0x0076}, {0x87de, 0x00bd}, -{0x87df, 0x0089}, {0x87e0, 0x00d5}, {0x87e1, 0x007e}, -{0x87e2, 0x0087}, {0x87e3, 0x00fa}, {0x87e4, 0x00b6}, -{0x87e5, 0x008f}, {0x87e6, 0x007b}, {0x87e7, 0x0026}, -{0x87e8, 0x000a}, {0x87e9, 0x0018}, {0x87ea, 0x00ce}, -{0x87eb, 0x008f}, {0x87ec, 0x0079}, {0x87ed, 0x00bd}, -{0x87ee, 0x0089}, {0x87ef, 0x00d5}, {0x87f0, 0x007e}, -{0x87f1, 0x0087}, {0x87f2, 0x00fa}, {0x87f3, 0x0086}, -{0x87f4, 0x0005}, {0x87f5, 0x0097}, {0x87f6, 0x0040}, -{0x87f7, 0x007e}, {0x87f8, 0x0089}, {0x87f9, 0x0000}, -{0x87fa, 0x00b6}, {0x87fb, 0x008f}, {0x87fc, 0x0075}, -{0x87fd, 0x0081}, {0x87fe, 0x0007}, {0x87ff, 0x002e}, -{0x8800, 0x00f2}, {0x8801, 0x00f6}, {0x8802, 0x0012}, -{0x8803, 0x0006}, {0x8804, 0x00c4}, {0x8805, 0x00f8}, -{0x8806, 0x001b}, {0x8807, 0x00b7}, {0x8808, 0x0012}, -{0x8809, 0x0006}, {0x880a, 0x00b6}, {0x880b, 0x008f}, -{0x880c, 0x0078}, {0x880d, 0x0081}, {0x880e, 0x0007}, -{0x880f, 0x002e}, {0x8810, 0x00e2}, {0x8811, 0x0048}, -{0x8812, 0x0048}, {0x8813, 0x0048}, {0x8814, 0x00f6}, -{0x8815, 0x0012}, {0x8816, 0x0006}, {0x8817, 0x00c4}, -{0x8818, 0x00c7}, {0x8819, 0x001b}, {0x881a, 0x00b7}, -{0x881b, 0x0012}, {0x881c, 0x0006}, {0x881d, 0x00b6}, -{0x881e, 0x008f}, {0x881f, 0x007b}, {0x8820, 0x0081}, -{0x8821, 0x0007}, {0x8822, 0x002e}, {0x8823, 0x00cf}, -{0x8824, 0x00f6}, {0x8825, 0x0012}, {0x8826, 0x0005}, -{0x8827, 0x00c4}, {0x8828, 0x00f8}, {0x8829, 0x001b}, -{0x882a, 0x00b7}, {0x882b, 0x0012}, {0x882c, 0x0005}, -{0x882d, 0x0086}, {0x882e, 0x0000}, {0x882f, 0x00f6}, -{0x8830, 0x008f}, {0x8831, 0x0071}, {0x8832, 0x00bd}, -{0x8833, 0x0089}, {0x8834, 0x0094}, {0x8835, 0x0086}, -{0x8836, 0x0001}, {0x8837, 0x00f6}, {0x8838, 0x008f}, -{0x8839, 0x0074}, {0x883a, 0x00bd}, {0x883b, 0x0089}, -{0x883c, 0x0094}, {0x883d, 0x0086}, {0x883e, 0x0002}, -{0x883f, 0x00f6}, {0x8840, 0x008f}, {0x8841, 0x0077}, -{0x8842, 0x00bd}, {0x8843, 0x0089}, {0x8844, 0x0094}, -{0x8845, 0x0086}, {0x8846, 0x0003}, {0x8847, 0x00f6}, -{0x8848, 0x008f}, {0x8849, 0x007a}, {0x884a, 0x00bd}, -{0x884b, 0x0089}, {0x884c, 0x0094}, {0x884d, 0x00ce}, -{0x884e, 0x008f}, {0x884f, 0x0070}, {0x8850, 0x00a6}, -{0x8851, 0x0001}, {0x8852, 0x0081}, {0x8853, 0x0001}, -{0x8854, 0x0027}, {0x8855, 0x0007}, {0x8856, 0x0081}, -{0x8857, 0x0003}, {0x8858, 0x0027}, {0x8859, 0x0003}, -{0x885a, 0x007e}, {0x885b, 0x0088}, {0x885c, 0x0066}, -{0x885d, 0x00a6}, {0x885e, 0x0000}, {0x885f, 0x00b8}, -{0x8860, 0x008f}, {0x8861, 0x0081}, {0x8862, 0x0084}, -{0x8863, 0x0001}, {0x8864, 0x0026}, {0x8865, 0x000b}, -{0x8866, 0x008c}, {0x8867, 0x008f}, {0x8868, 0x0079}, -{0x8869, 0x002c}, {0x886a, 0x000e}, {0x886b, 0x0008}, -{0x886c, 0x0008}, {0x886d, 0x0008}, {0x886e, 0x007e}, -{0x886f, 0x0088}, {0x8870, 0x0050}, {0x8871, 0x00b6}, -{0x8872, 0x0012}, {0x8873, 0x0004}, {0x8874, 0x008a}, -{0x8875, 0x0040}, {0x8876, 0x00b7}, {0x8877, 0x0012}, -{0x8878, 0x0004}, {0x8879, 0x00b6}, {0x887a, 0x0012}, -{0x887b, 0x0004}, {0x887c, 0x0084}, {0x887d, 0x00fb}, -{0x887e, 0x0084}, {0x887f, 0x00ef}, {0x8880, 0x00b7}, -{0x8881, 0x0012}, {0x8882, 0x0004}, {0x8883, 0x00b6}, -{0x8884, 0x0012}, {0x8885, 0x0007}, {0x8886, 0x0036}, -{0x8887, 0x00b6}, {0x8888, 0x008f}, {0x8889, 0x007c}, -{0x888a, 0x0048}, {0x888b, 0x0048}, {0x888c, 0x00b7}, -{0x888d, 0x0012}, {0x888e, 0x0007}, {0x888f, 0x0086}, -{0x8890, 0x0001}, {0x8891, 0x00ba}, {0x8892, 0x0012}, -{0x8893, 0x0004}, {0x8894, 0x00b7}, {0x8895, 0x0012}, -{0x8896, 0x0004}, {0x8897, 0x0001}, {0x8898, 0x0001}, -{0x8899, 0x0001}, {0x889a, 0x0001}, {0x889b, 0x0001}, -{0x889c, 0x0001}, {0x889d, 0x0086}, {0x889e, 0x00fe}, -{0x889f, 0x00b4}, {0x88a0, 0x0012}, {0x88a1, 0x0004}, -{0x88a2, 0x00b7}, {0x88a3, 0x0012}, {0x88a4, 0x0004}, -{0x88a5, 0x0086}, {0x88a6, 0x0002}, {0x88a7, 0x00ba}, -{0x88a8, 0x0012}, {0x88a9, 0x0004}, {0x88aa, 0x00b7}, -{0x88ab, 0x0012}, {0x88ac, 0x0004}, {0x88ad, 0x0086}, -{0x88ae, 0x00fd}, {0x88af, 0x00b4}, {0x88b0, 0x0012}, -{0x88b1, 0x0004}, {0x88b2, 0x00b7}, {0x88b3, 0x0012}, -{0x88b4, 0x0004}, {0x88b5, 0x0032}, {0x88b6, 0x00b7}, -{0x88b7, 0x0012}, {0x88b8, 0x0007}, {0x88b9, 0x00b6}, -{0x88ba, 0x0012}, {0x88bb, 0x0000}, {0x88bc, 0x0084}, -{0x88bd, 0x0008}, {0x88be, 0x0081}, {0x88bf, 0x0008}, -{0x88c0, 0x0027}, {0x88c1, 0x000f}, {0x88c2, 0x007c}, -{0x88c3, 0x0082}, {0x88c4, 0x0008}, {0x88c5, 0x0026}, -{0x88c6, 0x0007}, {0x88c7, 0x0086}, {0x88c8, 0x0076}, -{0x88c9, 0x0097}, {0x88ca, 0x0040}, {0x88cb, 0x007e}, -{0x88cc, 0x0089}, {0x88cd, 0x006e}, {0x88ce, 0x007e}, -{0x88cf, 0x0086}, {0x88d0, 0x00ec}, {0x88d1, 0x00b6}, -{0x88d2, 0x008f}, {0x88d3, 0x007f}, {0x88d4, 0x0081}, -{0x88d5, 0x000f}, {0x88d6, 0x0027}, {0x88d7, 0x003c}, -{0x88d8, 0x00bd}, {0x88d9, 0x00e6}, {0x88da, 0x00c7}, -{0x88db, 0x00b7}, {0x88dc, 0x0012}, {0x88dd, 0x000d}, -{0x88de, 0x00bd}, {0x88df, 0x00e6}, {0x88e0, 0x00cb}, -{0x88e1, 0x00b6}, {0x88e2, 0x0012}, {0x88e3, 0x0004}, -{0x88e4, 0x008a}, {0x88e5, 0x0020}, {0x88e6, 0x00b7}, -{0x88e7, 0x0012}, {0x88e8, 0x0004}, {0x88e9, 0x00ce}, -{0x88ea, 0x00ff}, {0x88eb, 0x00ff}, {0x88ec, 0x00b6}, -{0x88ed, 0x0012}, {0x88ee, 0x0000}, {0x88ef, 0x0081}, -{0x88f0, 0x000c}, {0x88f1, 0x0026}, {0x88f2, 0x0005}, -{0x88f3, 0x0009}, {0x88f4, 0x0026}, {0x88f5, 0x00f6}, -{0x88f6, 0x0027}, {0x88f7, 0x001c}, {0x88f8, 0x00b6}, -{0x88f9, 0x0012}, {0x88fa, 0x0004}, {0x88fb, 0x0084}, -{0x88fc, 0x00df}, {0x88fd, 0x00b7}, {0x88fe, 0x0012}, -{0x88ff, 0x0004}, {0x8900, 0x0096}, {0x8901, 0x0083}, -{0x8902, 0x0081}, {0x8903, 0x0007}, {0x8904, 0x002c}, -{0x8905, 0x0005}, {0x8906, 0x007c}, {0x8907, 0x0000}, -{0x8908, 0x0083}, {0x8909, 0x0020}, {0x890a, 0x0006}, -{0x890b, 0x0096}, {0x890c, 0x0083}, {0x890d, 0x008b}, -{0x890e, 0x0008}, {0x890f, 0x0097}, {0x8910, 0x0083}, -{0x8911, 0x007e}, {0x8912, 0x0085}, {0x8913, 0x0041}, -{0x8914, 0x007f}, {0x8915, 0x008f}, {0x8916, 0x007e}, -{0x8917, 0x0086}, {0x8918, 0x0080}, {0x8919, 0x00b7}, -{0x891a, 0x0012}, {0x891b, 0x000c}, {0x891c, 0x0086}, -{0x891d, 0x0001}, {0x891e, 0x00b7}, {0x891f, 0x008f}, -{0x8920, 0x007d}, {0x8921, 0x00b6}, {0x8922, 0x0012}, -{0x8923, 0x000c}, {0x8924, 0x0084}, {0x8925, 0x007f}, -{0x8926, 0x00b7}, {0x8927, 0x0012}, {0x8928, 0x000c}, -{0x8929, 0x008a}, {0x892a, 0x0080}, {0x892b, 0x00b7}, -{0x892c, 0x0012}, {0x892d, 0x000c}, {0x892e, 0x0086}, -{0x892f, 0x000a}, {0x8930, 0x00bd}, {0x8931, 0x008a}, -{0x8932, 0x0006}, {0x8933, 0x00b6}, {0x8934, 0x0012}, -{0x8935, 0x000a}, {0x8936, 0x002a}, {0x8937, 0x0009}, -{0x8938, 0x00b6}, {0x8939, 0x0012}, {0x893a, 0x000c}, -{0x893b, 0x00ba}, {0x893c, 0x008f}, {0x893d, 0x007d}, -{0x893e, 0x00b7}, {0x893f, 0x0012}, {0x8940, 0x000c}, -{0x8941, 0x00b6}, {0x8942, 0x008f}, {0x8943, 0x007e}, -{0x8944, 0x0081}, {0x8945, 0x0060}, {0x8946, 0x0027}, -{0x8947, 0x001a}, {0x8948, 0x008b}, {0x8949, 0x0020}, -{0x894a, 0x00b7}, {0x894b, 0x008f}, {0x894c, 0x007e}, -{0x894d, 0x00b6}, {0x894e, 0x0012}, {0x894f, 0x000c}, -{0x8950, 0x0084}, {0x8951, 0x009f}, {0x8952, 0x00ba}, -{0x8953, 0x008f}, {0x8954, 0x007e}, {0x8955, 0x00b7}, -{0x8956, 0x0012}, {0x8957, 0x000c}, {0x8958, 0x00b6}, -{0x8959, 0x008f}, {0x895a, 0x007d}, {0x895b, 0x0048}, -{0x895c, 0x00b7}, {0x895d, 0x008f}, {0x895e, 0x007d}, -{0x895f, 0x007e}, {0x8960, 0x0089}, {0x8961, 0x0021}, -{0x8962, 0x00b6}, {0x8963, 0x0012}, {0x8964, 0x0004}, -{0x8965, 0x008a}, {0x8966, 0x0020}, {0x8967, 0x00b7}, -{0x8968, 0x0012}, {0x8969, 0x0004}, {0x896a, 0x00bd}, -{0x896b, 0x008a}, {0x896c, 0x000a}, {0x896d, 0x004f}, -{0x896e, 0x0039}, {0x896f, 0x00a6}, {0x8970, 0x0000}, -{0x8971, 0x0018}, {0x8972, 0x00a7}, {0x8973, 0x0000}, -{0x8974, 0x0008}, {0x8975, 0x0018}, {0x8976, 0x0008}, -{0x8977, 0x005a}, {0x8978, 0x0026}, {0x8979, 0x00f5}, -{0x897a, 0x0039}, {0x897b, 0x0036}, {0x897c, 0x006c}, -{0x897d, 0x0000}, {0x897e, 0x0032}, {0x897f, 0x00ba}, -{0x8980, 0x008f}, {0x8981, 0x007f}, {0x8982, 0x00b7}, -{0x8983, 0x008f}, {0x8984, 0x007f}, {0x8985, 0x00b6}, -{0x8986, 0x0012}, {0x8987, 0x0009}, {0x8988, 0x0084}, -{0x8989, 0x0003}, {0x898a, 0x00a7}, {0x898b, 0x0001}, -{0x898c, 0x00b6}, {0x898d, 0x0012}, {0x898e, 0x0006}, -{0x898f, 0x0084}, {0x8990, 0x003f}, {0x8991, 0x00a7}, -{0x8992, 0x0002}, {0x8993, 0x0039}, {0x8994, 0x0036}, -{0x8995, 0x0086}, {0x8996, 0x0003}, {0x8997, 0x00b7}, -{0x8998, 0x008f}, {0x8999, 0x0080}, {0x899a, 0x0032}, -{0x899b, 0x00c1}, {0x899c, 0x0000}, {0x899d, 0x0026}, -{0x899e, 0x0006}, {0x899f, 0x00b7}, {0x89a0, 0x008f}, -{0x89a1, 0x007c}, {0x89a2, 0x007e}, {0x89a3, 0x0089}, -{0x89a4, 0x00c9}, {0x89a5, 0x00c1}, {0x89a6, 0x0001}, -{0x89a7, 0x0027}, {0x89a8, 0x0018}, {0x89a9, 0x00c1}, -{0x89aa, 0x0002}, {0x89ab, 0x0027}, {0x89ac, 0x000c}, -{0x89ad, 0x00c1}, {0x89ae, 0x0003}, {0x89af, 0x0027}, -{0x89b0, 0x0000}, {0x89b1, 0x00f6}, {0x89b2, 0x008f}, -{0x89b3, 0x0080}, {0x89b4, 0x0005}, {0x89b5, 0x0005}, -{0x89b6, 0x00f7}, {0x89b7, 0x008f}, {0x89b8, 0x0080}, -{0x89b9, 0x00f6}, {0x89ba, 0x008f}, {0x89bb, 0x0080}, -{0x89bc, 0x0005}, {0x89bd, 0x0005}, {0x89be, 0x00f7}, -{0x89bf, 0x008f}, {0x89c0, 0x0080}, {0x89c1, 0x00f6}, -{0x89c2, 0x008f}, {0x89c3, 0x0080}, {0x89c4, 0x0005}, -{0x89c5, 0x0005}, {0x89c6, 0x00f7}, {0x89c7, 0x008f}, -{0x89c8, 0x0080}, {0x89c9, 0x00f6}, {0x89ca, 0x008f}, -{0x89cb, 0x0080}, {0x89cc, 0x0053}, {0x89cd, 0x00f4}, -{0x89ce, 0x0012}, {0x89cf, 0x0007}, {0x89d0, 0x001b}, -{0x89d1, 0x00b7}, {0x89d2, 0x0012}, {0x89d3, 0x0007}, -{0x89d4, 0x0039}, {0x89d5, 0x00ce}, {0x89d6, 0x008f}, -{0x89d7, 0x0070}, {0x89d8, 0x00a6}, {0x89d9, 0x0000}, -{0x89da, 0x0018}, {0x89db, 0x00e6}, {0x89dc, 0x0000}, -{0x89dd, 0x0018}, {0x89de, 0x00a7}, {0x89df, 0x0000}, -{0x89e0, 0x00e7}, {0x89e1, 0x0000}, {0x89e2, 0x00a6}, -{0x89e3, 0x0001}, {0x89e4, 0x0018}, {0x89e5, 0x00e6}, -{0x89e6, 0x0001}, {0x89e7, 0x0018}, {0x89e8, 0x00a7}, -{0x89e9, 0x0001}, {0x89ea, 0x00e7}, {0x89eb, 0x0001}, -{0x89ec, 0x00a6}, {0x89ed, 0x0002}, {0x89ee, 0x0018}, -{0x89ef, 0x00e6}, {0x89f0, 0x0002}, {0x89f1, 0x0018}, -{0x89f2, 0x00a7}, {0x89f3, 0x0002}, {0x89f4, 0x00e7}, -{0x89f5, 0x0002}, {0x89f6, 0x0039}, {0x89f7, 0x00a6}, -{0x89f8, 0x0000}, {0x89f9, 0x0084}, {0x89fa, 0x0007}, -{0x89fb, 0x00e6}, {0x89fc, 0x0000}, {0x89fd, 0x00c4}, -{0x89fe, 0x0038}, {0x89ff, 0x0054}, {0x8a00, 0x0054}, -{0x8a01, 0x0054}, {0x8a02, 0x001b}, {0x8a03, 0x00a7}, -{0x8a04, 0x0000}, {0x8a05, 0x0039}, {0x8a06, 0x004a}, -{0x8a07, 0x0026}, {0x8a08, 0x00fd}, {0x8a09, 0x0039}, -{0x8a0a, 0x0096}, {0x8a0b, 0x0022}, {0x8a0c, 0x0084}, -{0x8a0d, 0x000f}, {0x8a0e, 0x0097}, {0x8a0f, 0x0022}, -{0x8a10, 0x0086}, {0x8a11, 0x0001}, {0x8a12, 0x00b7}, -{0x8a13, 0x008f}, {0x8a14, 0x0070}, {0x8a15, 0x00b6}, -{0x8a16, 0x0012}, {0x8a17, 0x0007}, {0x8a18, 0x00b7}, -{0x8a19, 0x008f}, {0x8a1a, 0x0071}, {0x8a1b, 0x00f6}, -{0x8a1c, 0x0012}, {0x8a1d, 0x000c}, {0x8a1e, 0x00c4}, -{0x8a1f, 0x000f}, {0x8a20, 0x00c8}, {0x8a21, 0x000f}, -{0x8a22, 0x00f7}, {0x8a23, 0x008f}, {0x8a24, 0x0072}, -{0x8a25, 0x00f6}, {0x8a26, 0x008f}, {0x8a27, 0x0072}, -{0x8a28, 0x00b6}, {0x8a29, 0x008f}, {0x8a2a, 0x0071}, -{0x8a2b, 0x0084}, {0x8a2c, 0x0003}, {0x8a2d, 0x0027}, -{0x8a2e, 0x0014}, {0x8a2f, 0x0081}, {0x8a30, 0x0001}, -{0x8a31, 0x0027}, {0x8a32, 0x001c}, {0x8a33, 0x0081}, -{0x8a34, 0x0002}, {0x8a35, 0x0027}, {0x8a36, 0x0024}, -{0x8a37, 0x00f4}, {0x8a38, 0x008f}, {0x8a39, 0x0070}, -{0x8a3a, 0x0027}, {0x8a3b, 0x002a}, {0x8a3c, 0x0096}, -{0x8a3d, 0x0022}, {0x8a3e, 0x008a}, {0x8a3f, 0x0080}, -{0x8a40, 0x007e}, {0x8a41, 0x008a}, {0x8a42, 0x0064}, -{0x8a43, 0x00f4}, {0x8a44, 0x008f}, {0x8a45, 0x0070}, -{0x8a46, 0x0027}, {0x8a47, 0x001e}, {0x8a48, 0x0096}, -{0x8a49, 0x0022}, {0x8a4a, 0x008a}, {0x8a4b, 0x0010}, -{0x8a4c, 0x007e}, {0x8a4d, 0x008a}, {0x8a4e, 0x0064}, -{0x8a4f, 0x00f4}, {0x8a50, 0x008f}, {0x8a51, 0x0070}, -{0x8a52, 0x0027}, {0x8a53, 0x0012}, {0x8a54, 0x0096}, -{0x8a55, 0x0022}, {0x8a56, 0x008a}, {0x8a57, 0x0020}, -{0x8a58, 0x007e}, {0x8a59, 0x008a}, {0x8a5a, 0x0064}, -{0x8a5b, 0x00f4}, {0x8a5c, 0x008f}, {0x8a5d, 0x0070}, -{0x8a5e, 0x0027}, {0x8a5f, 0x0006}, {0x8a60, 0x0096}, -{0x8a61, 0x0022}, {0x8a62, 0x008a}, {0x8a63, 0x0040}, -{0x8a64, 0x0097}, {0x8a65, 0x0022}, {0x8a66, 0x0074}, -{0x8a67, 0x008f}, {0x8a68, 0x0071}, {0x8a69, 0x0074}, -{0x8a6a, 0x008f}, {0x8a6b, 0x0071}, {0x8a6c, 0x0078}, -{0x8a6d, 0x008f}, {0x8a6e, 0x0070}, {0x8a6f, 0x00b6}, -{0x8a70, 0x008f}, {0x8a71, 0x0070}, {0x8a72, 0x0085}, -{0x8a73, 0x0010}, {0x8a74, 0x0027}, {0x8a75, 0x00af}, -{0x8a76, 0x00d6}, {0x8a77, 0x0022}, {0x8a78, 0x00c4}, -{0x8a79, 0x0010}, {0x8a7a, 0x0058}, {0x8a7b, 0x00b6}, -{0x8a7c, 0x0012}, {0x8a7d, 0x0070}, {0x8a7e, 0x0081}, -{0x8a7f, 0x00e4}, {0x8a80, 0x0027}, {0x8a81, 0x0036}, -{0x8a82, 0x0081}, {0x8a83, 0x00e1}, {0x8a84, 0x0026}, -{0x8a85, 0x000c}, {0x8a86, 0x0096}, {0x8a87, 0x0022}, -{0x8a88, 0x0084}, {0x8a89, 0x0020}, {0x8a8a, 0x0044}, -{0x8a8b, 0x001b}, {0x8a8c, 0x00d6}, {0x8a8d, 0x0022}, -{0x8a8e, 0x00c4}, {0x8a8f, 0x00cf}, {0x8a90, 0x0020}, -{0x8a91, 0x0023}, {0x8a92, 0x0058}, {0x8a93, 0x0081}, -{0x8a94, 0x00c6}, {0x8a95, 0x0026}, {0x8a96, 0x000d}, -{0x8a97, 0x0096}, {0x8a98, 0x0022}, {0x8a99, 0x0084}, -{0x8a9a, 0x0040}, {0x8a9b, 0x0044}, {0x8a9c, 0x0044}, -{0x8a9d, 0x001b}, {0x8a9e, 0x00d6}, {0x8a9f, 0x0022}, -{0x8aa0, 0x00c4}, {0x8aa1, 0x00af}, {0x8aa2, 0x0020}, -{0x8aa3, 0x0011}, {0x8aa4, 0x0058}, {0x8aa5, 0x0081}, -{0x8aa6, 0x0027}, {0x8aa7, 0x0026}, {0x8aa8, 0x000f}, -{0x8aa9, 0x0096}, {0x8aaa, 0x0022}, {0x8aab, 0x0084}, -{0x8aac, 0x0080}, {0x8aad, 0x0044}, {0x8aae, 0x0044}, -{0x8aaf, 0x0044}, {0x8ab0, 0x001b}, {0x8ab1, 0x00d6}, -{0x8ab2, 0x0022}, {0x8ab3, 0x00c4}, {0x8ab4, 0x006f}, -{0x8ab5, 0x001b}, {0x8ab6, 0x0097}, {0x8ab7, 0x0022}, -{0x8ab8, 0x0039}, {0x8ab9, 0x0027}, {0x8aba, 0x000c}, -{0x8abb, 0x007c}, {0x8abc, 0x0082}, {0x8abd, 0x0006}, -{0x8abe, 0x00bd}, {0x8abf, 0x00d9}, {0x8ac0, 0x00ed}, -{0x8ac1, 0x00b6}, {0x8ac2, 0x0082}, {0x8ac3, 0x0007}, -{0x8ac4, 0x007e}, {0x8ac5, 0x008a}, {0x8ac6, 0x00b9}, -{0x8ac7, 0x007f}, {0x8ac8, 0x0082}, {0x8ac9, 0x0006}, -{0x8aca, 0x0039}, { 0x0, 0x0 } -}; -#else -cas_saturn_patch_t cas_saturn_patch[] = { -{0x8200, 0x007e}, {0x8201, 0x0082}, {0x8202, 0x0009}, -{0x8203, 0x0000}, {0x8204, 0x0000}, {0x8205, 0x0000}, -{0x8206, 0x0000}, {0x8207, 0x0000}, {0x8208, 0x0000}, -{0x8209, 0x008e}, {0x820a, 0x008e}, {0x820b, 0x00ff}, -{0x820c, 0x00ce}, {0x820d, 0x0082}, {0x820e, 0x0025}, -{0x820f, 0x00ff}, {0x8210, 0x0001}, {0x8211, 0x000f}, -{0x8212, 0x00ce}, {0x8213, 0x0084}, {0x8214, 0x0026}, -{0x8215, 0x00ff}, {0x8216, 0x0001}, {0x8217, 0x0011}, -{0x8218, 0x00ce}, {0x8219, 0x0085}, {0x821a, 0x003d}, -{0x821b, 0x00df}, {0x821c, 0x00e5}, {0x821d, 0x0086}, -{0x821e, 0x0039}, {0x821f, 0x00b7}, {0x8220, 0x008f}, -{0x8221, 0x00f8}, {0x8222, 0x007e}, {0x8223, 0x00c3}, -{0x8224, 0x00c2}, {0x8225, 0x0096}, {0x8226, 0x0047}, -{0x8227, 0x0084}, {0x8228, 0x00f3}, {0x8229, 0x008a}, -{0x822a, 0x0000}, {0x822b, 0x0097}, {0x822c, 0x0047}, -{0x822d, 0x00ce}, {0x822e, 0x0082}, {0x822f, 0x0033}, -{0x8230, 0x00ff}, {0x8231, 0x0001}, {0x8232, 0x000f}, -{0x8233, 0x0096}, {0x8234, 0x0046}, {0x8235, 0x0084}, -{0x8236, 0x000c}, {0x8237, 0x0081}, {0x8238, 0x0004}, -{0x8239, 0x0027}, {0x823a, 0x000b}, {0x823b, 0x0096}, -{0x823c, 0x0046}, {0x823d, 0x0084}, {0x823e, 0x000c}, -{0x823f, 0x0081}, {0x8240, 0x0008}, {0x8241, 0x0027}, -{0x8242, 0x0057}, {0x8243, 0x007e}, {0x8244, 0x0084}, -{0x8245, 0x0025}, {0x8246, 0x0096}, {0x8247, 0x0047}, -{0x8248, 0x0084}, {0x8249, 0x00f3}, {0x824a, 0x008a}, -{0x824b, 0x0004}, {0x824c, 0x0097}, {0x824d, 0x0047}, -{0x824e, 0x00ce}, {0x824f, 0x0082}, {0x8250, 0x0054}, -{0x8251, 0x00ff}, {0x8252, 0x0001}, {0x8253, 0x000f}, -{0x8254, 0x0096}, {0x8255, 0x0046}, {0x8256, 0x0084}, -{0x8257, 0x000c}, {0x8258, 0x0081}, {0x8259, 0x0004}, -{0x825a, 0x0026}, {0x825b, 0x0038}, {0x825c, 0x00b6}, -{0x825d, 0x0012}, {0x825e, 0x0020}, {0x825f, 0x0084}, -{0x8260, 0x0020}, {0x8261, 0x0026}, {0x8262, 0x0003}, -{0x8263, 0x007e}, {0x8264, 0x0084}, {0x8265, 0x0025}, -{0x8266, 0x0096}, {0x8267, 0x007b}, {0x8268, 0x00d6}, -{0x8269, 0x007c}, {0x826a, 0x00fe}, {0x826b, 0x008f}, -{0x826c, 0x0056}, {0x826d, 0x00bd}, {0x826e, 0x00f7}, -{0x826f, 0x00b6}, {0x8270, 0x00fe}, {0x8271, 0x008f}, -{0x8272, 0x004e}, {0x8273, 0x00bd}, {0x8274, 0x00ec}, -{0x8275, 0x008e}, {0x8276, 0x00bd}, {0x8277, 0x00fa}, -{0x8278, 0x00f7}, {0x8279, 0x00bd}, {0x827a, 0x00f7}, -{0x827b, 0x0028}, {0x827c, 0x00ce}, {0x827d, 0x0082}, -{0x827e, 0x0082}, {0x827f, 0x00ff}, {0x8280, 0x0001}, -{0x8281, 0x000f}, {0x8282, 0x0096}, {0x8283, 0x0046}, -{0x8284, 0x0084}, {0x8285, 0x000c}, {0x8286, 0x0081}, -{0x8287, 0x0004}, {0x8288, 0x0026}, {0x8289, 0x000a}, -{0x828a, 0x00b6}, {0x828b, 0x0012}, {0x828c, 0x0020}, -{0x828d, 0x0084}, {0x828e, 0x0020}, {0x828f, 0x0027}, -{0x8290, 0x00b5}, {0x8291, 0x007e}, {0x8292, 0x0084}, -{0x8293, 0x0025}, {0x8294, 0x00bd}, {0x8295, 0x00f7}, -{0x8296, 0x001f}, {0x8297, 0x007e}, {0x8298, 0x0084}, -{0x8299, 0x001f}, {0x829a, 0x0096}, {0x829b, 0x0047}, -{0x829c, 0x0084}, {0x829d, 0x00f3}, {0x829e, 0x008a}, -{0x829f, 0x0008}, {0x82a0, 0x0097}, {0x82a1, 0x0047}, -{0x82a2, 0x00de}, {0x82a3, 0x00e1}, {0x82a4, 0x00ad}, -{0x82a5, 0x0000}, {0x82a6, 0x00ce}, {0x82a7, 0x0082}, -{0x82a8, 0x00af}, {0x82a9, 0x00ff}, {0x82aa, 0x0001}, -{0x82ab, 0x000f}, {0x82ac, 0x007e}, {0x82ad, 0x0084}, -{0x82ae, 0x0025}, {0x82af, 0x0096}, {0x82b0, 0x0041}, -{0x82b1, 0x0085}, {0x82b2, 0x0010}, {0x82b3, 0x0026}, -{0x82b4, 0x0006}, {0x82b5, 0x0096}, {0x82b6, 0x0023}, -{0x82b7, 0x0085}, {0x82b8, 0x0040}, {0x82b9, 0x0027}, -{0x82ba, 0x0006}, {0x82bb, 0x00bd}, {0x82bc, 0x00ed}, -{0x82bd, 0x0000}, {0x82be, 0x007e}, {0x82bf, 0x0083}, -{0x82c0, 0x00a2}, {0x82c1, 0x00de}, {0x82c2, 0x0042}, -{0x82c3, 0x00bd}, {0x82c4, 0x00eb}, {0x82c5, 0x008e}, -{0x82c6, 0x0096}, {0x82c7, 0x0024}, {0x82c8, 0x0084}, -{0x82c9, 0x0008}, {0x82ca, 0x0027}, {0x82cb, 0x0003}, -{0x82cc, 0x007e}, {0x82cd, 0x0083}, {0x82ce, 0x00df}, -{0x82cf, 0x0096}, {0x82d0, 0x007b}, {0x82d1, 0x00d6}, -{0x82d2, 0x007c}, {0x82d3, 0x00fe}, {0x82d4, 0x008f}, -{0x82d5, 0x0056}, {0x82d6, 0x00bd}, {0x82d7, 0x00f7}, -{0x82d8, 0x00b6}, {0x82d9, 0x00fe}, {0x82da, 0x008f}, -{0x82db, 0x0050}, {0x82dc, 0x00bd}, {0x82dd, 0x00ec}, -{0x82de, 0x008e}, {0x82df, 0x00bd}, {0x82e0, 0x00fa}, -{0x82e1, 0x00f7}, {0x82e2, 0x0086}, {0x82e3, 0x0011}, -{0x82e4, 0x00c6}, {0x82e5, 0x0049}, {0x82e6, 0x00bd}, -{0x82e7, 0x00e4}, {0x82e8, 0x0012}, {0x82e9, 0x00ce}, -{0x82ea, 0x0082}, {0x82eb, 0x00ef}, {0x82ec, 0x00ff}, -{0x82ed, 0x0001}, {0x82ee, 0x000f}, {0x82ef, 0x0096}, -{0x82f0, 0x0046}, {0x82f1, 0x0084}, {0x82f2, 0x000c}, -{0x82f3, 0x0081}, {0x82f4, 0x0000}, {0x82f5, 0x0027}, -{0x82f6, 0x0017}, {0x82f7, 0x00c6}, {0x82f8, 0x0049}, -{0x82f9, 0x00bd}, {0x82fa, 0x00e4}, {0x82fb, 0x0091}, -{0x82fc, 0x0024}, {0x82fd, 0x000d}, {0x82fe, 0x00b6}, -{0x82ff, 0x0012}, {0x8300, 0x0020}, {0x8301, 0x0085}, -{0x8302, 0x0020}, {0x8303, 0x0026}, {0x8304, 0x000c}, -{0x8305, 0x00ce}, {0x8306, 0x0082}, {0x8307, 0x00c1}, -{0x8308, 0x00ff}, {0x8309, 0x0001}, {0x830a, 0x000f}, -{0x830b, 0x007e}, {0x830c, 0x0084}, {0x830d, 0x0025}, -{0x830e, 0x007e}, {0x830f, 0x0084}, {0x8310, 0x0016}, -{0x8311, 0x00fe}, {0x8312, 0x008f}, {0x8313, 0x0052}, -{0x8314, 0x00bd}, {0x8315, 0x00ec}, {0x8316, 0x008e}, -{0x8317, 0x00bd}, {0x8318, 0x00fa}, {0x8319, 0x00f7}, -{0x831a, 0x0086}, {0x831b, 0x006a}, {0x831c, 0x00c6}, -{0x831d, 0x0049}, {0x831e, 0x00bd}, {0x831f, 0x00e4}, -{0x8320, 0x0012}, {0x8321, 0x00ce}, {0x8322, 0x0083}, -{0x8323, 0x0027}, {0x8324, 0x00ff}, {0x8325, 0x0001}, -{0x8326, 0x000f}, {0x8327, 0x0096}, {0x8328, 0x0046}, -{0x8329, 0x0084}, {0x832a, 0x000c}, {0x832b, 0x0081}, -{0x832c, 0x0000}, {0x832d, 0x0027}, {0x832e, 0x000a}, -{0x832f, 0x00c6}, {0x8330, 0x0049}, {0x8331, 0x00bd}, -{0x8332, 0x00e4}, {0x8333, 0x0091}, {0x8334, 0x0025}, -{0x8335, 0x0006}, {0x8336, 0x007e}, {0x8337, 0x0084}, -{0x8338, 0x0025}, {0x8339, 0x007e}, {0x833a, 0x0084}, -{0x833b, 0x0016}, {0x833c, 0x00b6}, {0x833d, 0x0018}, -{0x833e, 0x0070}, {0x833f, 0x00bb}, {0x8340, 0x0019}, -{0x8341, 0x0070}, {0x8342, 0x002a}, {0x8343, 0x0004}, -{0x8344, 0x0081}, {0x8345, 0x00af}, {0x8346, 0x002e}, -{0x8347, 0x0019}, {0x8348, 0x0096}, {0x8349, 0x007b}, -{0x834a, 0x00f6}, {0x834b, 0x0020}, {0x834c, 0x0007}, -{0x834d, 0x00fa}, {0x834e, 0x0020}, {0x834f, 0x0027}, -{0x8350, 0x00c4}, {0x8351, 0x0038}, {0x8352, 0x0081}, -{0x8353, 0x0038}, {0x8354, 0x0027}, {0x8355, 0x000b}, -{0x8356, 0x00f6}, {0x8357, 0x0020}, {0x8358, 0x0007}, -{0x8359, 0x00fa}, {0x835a, 0x0020}, {0x835b, 0x0027}, -{0x835c, 0x00cb}, {0x835d, 0x0008}, {0x835e, 0x007e}, -{0x835f, 0x0082}, {0x8360, 0x00d3}, {0x8361, 0x00bd}, -{0x8362, 0x00f7}, {0x8363, 0x0066}, {0x8364, 0x0086}, -{0x8365, 0x0074}, {0x8366, 0x00c6}, {0x8367, 0x0049}, -{0x8368, 0x00bd}, {0x8369, 0x00e4}, {0x836a, 0x0012}, -{0x836b, 0x00ce}, {0x836c, 0x0083}, {0x836d, 0x0071}, -{0x836e, 0x00ff}, {0x836f, 0x0001}, {0x8370, 0x000f}, -{0x8371, 0x0096}, {0x8372, 0x0046}, {0x8373, 0x0084}, -{0x8374, 0x000c}, {0x8375, 0x0081}, {0x8376, 0x0008}, -{0x8377, 0x0026}, {0x8378, 0x000a}, {0x8379, 0x00c6}, -{0x837a, 0x0049}, {0x837b, 0x00bd}, {0x837c, 0x00e4}, -{0x837d, 0x0091}, {0x837e, 0x0025}, {0x837f, 0x0006}, -{0x8380, 0x007e}, {0x8381, 0x0084}, {0x8382, 0x0025}, -{0x8383, 0x007e}, {0x8384, 0x0084}, {0x8385, 0x0016}, -{0x8386, 0x00bd}, {0x8387, 0x00f7}, {0x8388, 0x003e}, -{0x8389, 0x0026}, {0x838a, 0x000e}, {0x838b, 0x00bd}, -{0x838c, 0x00e5}, {0x838d, 0x0009}, {0x838e, 0x0026}, -{0x838f, 0x0006}, {0x8390, 0x00ce}, {0x8391, 0x0082}, -{0x8392, 0x00c1}, {0x8393, 0x00ff}, {0x8394, 0x0001}, -{0x8395, 0x000f}, {0x8396, 0x007e}, {0x8397, 0x0084}, -{0x8398, 0x0025}, {0x8399, 0x00fe}, {0x839a, 0x008f}, -{0x839b, 0x0054}, {0x839c, 0x00bd}, {0x839d, 0x00ec}, -{0x839e, 0x008e}, {0x839f, 0x00bd}, {0x83a0, 0x00fa}, -{0x83a1, 0x00f7}, {0x83a2, 0x00bd}, {0x83a3, 0x00f7}, -{0x83a4, 0x0033}, {0x83a5, 0x0086}, {0x83a6, 0x000f}, -{0x83a7, 0x00c6}, {0x83a8, 0x0051}, {0x83a9, 0x00bd}, -{0x83aa, 0x00e4}, {0x83ab, 0x0012}, {0x83ac, 0x00ce}, -{0x83ad, 0x0083}, {0x83ae, 0x00b2}, {0x83af, 0x00ff}, -{0x83b0, 0x0001}, {0x83b1, 0x000f}, {0x83b2, 0x0096}, -{0x83b3, 0x0046}, {0x83b4, 0x0084}, {0x83b5, 0x000c}, -{0x83b6, 0x0081}, {0x83b7, 0x0008}, {0x83b8, 0x0026}, -{0x83b9, 0x005c}, {0x83ba, 0x00b6}, {0x83bb, 0x0012}, -{0x83bc, 0x0020}, {0x83bd, 0x0084}, {0x83be, 0x003f}, -{0x83bf, 0x0081}, {0x83c0, 0x003a}, {0x83c1, 0x0027}, -{0x83c2, 0x001c}, {0x83c3, 0x0096}, {0x83c4, 0x0023}, -{0x83c5, 0x0085}, {0x83c6, 0x0040}, {0x83c7, 0x0027}, -{0x83c8, 0x0003}, {0x83c9, 0x007e}, {0x83ca, 0x0084}, -{0x83cb, 0x0025}, {0x83cc, 0x00c6}, {0x83cd, 0x0051}, -{0x83ce, 0x00bd}, {0x83cf, 0x00e4}, {0x83d0, 0x0091}, -{0x83d1, 0x0025}, {0x83d2, 0x0003}, {0x83d3, 0x007e}, -{0x83d4, 0x0084}, {0x83d5, 0x0025}, {0x83d6, 0x00ce}, -{0x83d7, 0x0082}, {0x83d8, 0x00c1}, {0x83d9, 0x00ff}, -{0x83da, 0x0001}, {0x83db, 0x000f}, {0x83dc, 0x007e}, -{0x83dd, 0x0084}, {0x83de, 0x0025}, {0x83df, 0x00bd}, -{0x83e0, 0x00f8}, {0x83e1, 0x0037}, {0x83e2, 0x007c}, -{0x83e3, 0x0000}, {0x83e4, 0x007a}, {0x83e5, 0x00ce}, -{0x83e6, 0x0083}, {0x83e7, 0x00ee}, {0x83e8, 0x00ff}, -{0x83e9, 0x0001}, {0x83ea, 0x000f}, {0x83eb, 0x007e}, -{0x83ec, 0x0084}, {0x83ed, 0x0025}, {0x83ee, 0x0096}, -{0x83ef, 0x0046}, {0x83f0, 0x0084}, {0x83f1, 0x000c}, -{0x83f2, 0x0081}, {0x83f3, 0x0008}, {0x83f4, 0x0026}, -{0x83f5, 0x0020}, {0x83f6, 0x0096}, {0x83f7, 0x0024}, -{0x83f8, 0x0084}, {0x83f9, 0x0008}, {0x83fa, 0x0026}, -{0x83fb, 0x0029}, {0x83fc, 0x00b6}, {0x83fd, 0x0018}, -{0x83fe, 0x0082}, {0x83ff, 0x00bb}, {0x8400, 0x0019}, -{0x8401, 0x0082}, {0x8402, 0x00b1}, {0x8403, 0x0001}, -{0x8404, 0x003b}, {0x8405, 0x0022}, {0x8406, 0x0009}, -{0x8407, 0x00b6}, {0x8408, 0x0012}, {0x8409, 0x0020}, -{0x840a, 0x0084}, {0x840b, 0x0037}, {0x840c, 0x0081}, -{0x840d, 0x0032}, {0x840e, 0x0027}, {0x840f, 0x0015}, -{0x8410, 0x00bd}, {0x8411, 0x00f8}, {0x8412, 0x0044}, -{0x8413, 0x007e}, {0x8414, 0x0082}, {0x8415, 0x00c1}, -{0x8416, 0x00bd}, {0x8417, 0x00f7}, {0x8418, 0x001f}, -{0x8419, 0x00bd}, {0x841a, 0x00f8}, {0x841b, 0x0044}, -{0x841c, 0x00bd}, {0x841d, 0x00fc}, {0x841e, 0x0029}, -{0x841f, 0x00ce}, {0x8420, 0x0082}, {0x8421, 0x0025}, -{0x8422, 0x00ff}, {0x8423, 0x0001}, {0x8424, 0x000f}, -{0x8425, 0x0039}, {0x8426, 0x0096}, {0x8427, 0x0047}, -{0x8428, 0x0084}, {0x8429, 0x00fc}, {0x842a, 0x008a}, -{0x842b, 0x0000}, {0x842c, 0x0097}, {0x842d, 0x0047}, -{0x842e, 0x00ce}, {0x842f, 0x0084}, {0x8430, 0x0034}, -{0x8431, 0x00ff}, {0x8432, 0x0001}, {0x8433, 0x0011}, -{0x8434, 0x0096}, {0x8435, 0x0046}, {0x8436, 0x0084}, -{0x8437, 0x0003}, {0x8438, 0x0081}, {0x8439, 0x0002}, -{0x843a, 0x0027}, {0x843b, 0x0003}, {0x843c, 0x007e}, -{0x843d, 0x0085}, {0x843e, 0x001e}, {0x843f, 0x0096}, -{0x8440, 0x0047}, {0x8441, 0x0084}, {0x8442, 0x00fc}, -{0x8443, 0x008a}, {0x8444, 0x0002}, {0x8445, 0x0097}, -{0x8446, 0x0047}, {0x8447, 0x00de}, {0x8448, 0x00e1}, -{0x8449, 0x00ad}, {0x844a, 0x0000}, {0x844b, 0x0086}, -{0x844c, 0x0001}, {0x844d, 0x00b7}, {0x844e, 0x0012}, -{0x844f, 0x0051}, {0x8450, 0x00bd}, {0x8451, 0x00f7}, -{0x8452, 0x0014}, {0x8453, 0x00b6}, {0x8454, 0x0010}, -{0x8455, 0x0031}, {0x8456, 0x0084}, {0x8457, 0x00fd}, -{0x8458, 0x00b7}, {0x8459, 0x0010}, {0x845a, 0x0031}, -{0x845b, 0x00bd}, {0x845c, 0x00f8}, {0x845d, 0x001e}, -{0x845e, 0x0096}, {0x845f, 0x0081}, {0x8460, 0x00d6}, -{0x8461, 0x0082}, {0x8462, 0x00fe}, {0x8463, 0x008f}, -{0x8464, 0x005a}, {0x8465, 0x00bd}, {0x8466, 0x00f7}, -{0x8467, 0x00b6}, {0x8468, 0x00fe}, {0x8469, 0x008f}, -{0x846a, 0x005c}, {0x846b, 0x00bd}, {0x846c, 0x00ec}, -{0x846d, 0x008e}, {0x846e, 0x00bd}, {0x846f, 0x00fa}, -{0x8470, 0x00f7}, {0x8471, 0x0086}, {0x8472, 0x0008}, -{0x8473, 0x00d6}, {0x8474, 0x0000}, {0x8475, 0x00c5}, -{0x8476, 0x0010}, {0x8477, 0x0026}, {0x8478, 0x0002}, -{0x8479, 0x008b}, {0x847a, 0x0020}, {0x847b, 0x00c6}, -{0x847c, 0x0051}, {0x847d, 0x00bd}, {0x847e, 0x00e4}, -{0x847f, 0x0012}, {0x8480, 0x00ce}, {0x8481, 0x0084}, -{0x8482, 0x0086}, {0x8483, 0x00ff}, {0x8484, 0x0001}, -{0x8485, 0x0011}, {0x8486, 0x0096}, {0x8487, 0x0046}, -{0x8488, 0x0084}, {0x8489, 0x0003}, {0x848a, 0x0081}, -{0x848b, 0x0002}, {0x848c, 0x0027}, {0x848d, 0x0003}, -{0x848e, 0x007e}, {0x848f, 0x0085}, {0x8490, 0x000f}, -{0x8491, 0x00c6}, {0x8492, 0x0051}, {0x8493, 0x00bd}, -{0x8494, 0x00e4}, {0x8495, 0x0091}, {0x8496, 0x0025}, -{0x8497, 0x0003}, {0x8498, 0x007e}, {0x8499, 0x0085}, -{0x849a, 0x001e}, {0x849b, 0x0096}, {0x849c, 0x0044}, -{0x849d, 0x0085}, {0x849e, 0x0010}, {0x849f, 0x0026}, -{0x84a0, 0x000a}, {0x84a1, 0x00b6}, {0x84a2, 0x0012}, -{0x84a3, 0x0050}, {0x84a4, 0x00ba}, {0x84a5, 0x0001}, -{0x84a6, 0x003c}, {0x84a7, 0x0085}, {0x84a8, 0x0010}, -{0x84a9, 0x0027}, {0x84aa, 0x00a8}, {0x84ab, 0x00bd}, -{0x84ac, 0x00f7}, {0x84ad, 0x0066}, {0x84ae, 0x00ce}, -{0x84af, 0x0084}, {0x84b0, 0x00b7}, {0x84b1, 0x00ff}, -{0x84b2, 0x0001}, {0x84b3, 0x0011}, {0x84b4, 0x007e}, -{0x84b5, 0x0085}, {0x84b6, 0x001e}, {0x84b7, 0x0096}, -{0x84b8, 0x0046}, {0x84b9, 0x0084}, {0x84ba, 0x0003}, -{0x84bb, 0x0081}, {0x84bc, 0x0002}, {0x84bd, 0x0026}, -{0x84be, 0x0050}, {0x84bf, 0x00b6}, {0x84c0, 0x0012}, -{0x84c1, 0x0030}, {0x84c2, 0x0084}, {0x84c3, 0x0003}, -{0x84c4, 0x0081}, {0x84c5, 0x0001}, {0x84c6, 0x0027}, -{0x84c7, 0x0003}, {0x84c8, 0x007e}, {0x84c9, 0x0085}, -{0x84ca, 0x001e}, {0x84cb, 0x0096}, {0x84cc, 0x0044}, -{0x84cd, 0x0085}, {0x84ce, 0x0010}, {0x84cf, 0x0026}, -{0x84d0, 0x0013}, {0x84d1, 0x00b6}, {0x84d2, 0x0012}, -{0x84d3, 0x0050}, {0x84d4, 0x00ba}, {0x84d5, 0x0001}, -{0x84d6, 0x003c}, {0x84d7, 0x0085}, {0x84d8, 0x0010}, -{0x84d9, 0x0026}, {0x84da, 0x0009}, {0x84db, 0x00ce}, -{0x84dc, 0x0084}, {0x84dd, 0x0053}, {0x84de, 0x00ff}, -{0x84df, 0x0001}, {0x84e0, 0x0011}, {0x84e1, 0x007e}, -{0x84e2, 0x0085}, {0x84e3, 0x001e}, {0x84e4, 0x00b6}, -{0x84e5, 0x0010}, {0x84e6, 0x0031}, {0x84e7, 0x008a}, -{0x84e8, 0x0002}, {0x84e9, 0x00b7}, {0x84ea, 0x0010}, -{0x84eb, 0x0031}, {0x84ec, 0x00bd}, {0x84ed, 0x0085}, -{0x84ee, 0x001f}, {0x84ef, 0x00bd}, {0x84f0, 0x00f8}, -{0x84f1, 0x0037}, {0x84f2, 0x007c}, {0x84f3, 0x0000}, -{0x84f4, 0x0080}, {0x84f5, 0x00ce}, {0x84f6, 0x0084}, -{0x84f7, 0x00fe}, {0x84f8, 0x00ff}, {0x84f9, 0x0001}, -{0x84fa, 0x0011}, {0x84fb, 0x007e}, {0x84fc, 0x0085}, -{0x84fd, 0x001e}, {0x84fe, 0x0096}, {0x84ff, 0x0046}, -{0x8500, 0x0084}, {0x8501, 0x0003}, {0x8502, 0x0081}, -{0x8503, 0x0002}, {0x8504, 0x0026}, {0x8505, 0x0009}, -{0x8506, 0x00b6}, {0x8507, 0x0012}, {0x8508, 0x0030}, -{0x8509, 0x0084}, {0x850a, 0x0003}, {0x850b, 0x0081}, -{0x850c, 0x0001}, {0x850d, 0x0027}, {0x850e, 0x000f}, -{0x850f, 0x00bd}, {0x8510, 0x00f8}, {0x8511, 0x0044}, -{0x8512, 0x00bd}, {0x8513, 0x00f7}, {0x8514, 0x000b}, -{0x8515, 0x00bd}, {0x8516, 0x00fc}, {0x8517, 0x0029}, -{0x8518, 0x00ce}, {0x8519, 0x0084}, {0x851a, 0x0026}, -{0x851b, 0x00ff}, {0x851c, 0x0001}, {0x851d, 0x0011}, -{0x851e, 0x0039}, {0x851f, 0x00d6}, {0x8520, 0x0022}, -{0x8521, 0x00c4}, {0x8522, 0x000f}, {0x8523, 0x00b6}, -{0x8524, 0x0012}, {0x8525, 0x0030}, {0x8526, 0x00ba}, -{0x8527, 0x0012}, {0x8528, 0x0032}, {0x8529, 0x0084}, -{0x852a, 0x0004}, {0x852b, 0x0027}, {0x852c, 0x000d}, -{0x852d, 0x0096}, {0x852e, 0x0022}, {0x852f, 0x0085}, -{0x8530, 0x0004}, {0x8531, 0x0027}, {0x8532, 0x0005}, -{0x8533, 0x00ca}, {0x8534, 0x0010}, {0x8535, 0x007e}, -{0x8536, 0x0085}, {0x8537, 0x003a}, {0x8538, 0x00ca}, -{0x8539, 0x0020}, {0x853a, 0x00d7}, {0x853b, 0x0022}, -{0x853c, 0x0039}, {0x853d, 0x0086}, {0x853e, 0x0000}, -{0x853f, 0x0097}, {0x8540, 0x0083}, {0x8541, 0x0018}, -{0x8542, 0x00ce}, {0x8543, 0x001c}, {0x8544, 0x0000}, -{0x8545, 0x00bd}, {0x8546, 0x00eb}, {0x8547, 0x0046}, -{0x8548, 0x0096}, {0x8549, 0x0057}, {0x854a, 0x0085}, -{0x854b, 0x0001}, {0x854c, 0x0027}, {0x854d, 0x0002}, -{0x854e, 0x004f}, {0x854f, 0x0039}, {0x8550, 0x0085}, -{0x8551, 0x0002}, {0x8552, 0x0027}, {0x8553, 0x0001}, -{0x8554, 0x0039}, {0x8555, 0x007f}, {0x8556, 0x008f}, -{0x8557, 0x007d}, {0x8558, 0x0086}, {0x8559, 0x0004}, -{0x855a, 0x00b7}, {0x855b, 0x0012}, {0x855c, 0x0004}, -{0x855d, 0x0086}, {0x855e, 0x0008}, {0x855f, 0x00b7}, -{0x8560, 0x0012}, {0x8561, 0x0007}, {0x8562, 0x0086}, -{0x8563, 0x0010}, {0x8564, 0x00b7}, {0x8565, 0x0012}, -{0x8566, 0x000c}, {0x8567, 0x0086}, {0x8568, 0x0007}, -{0x8569, 0x00b7}, {0x856a, 0x0012}, {0x856b, 0x0006}, -{0x856c, 0x00b6}, {0x856d, 0x008f}, {0x856e, 0x007d}, -{0x856f, 0x00b7}, {0x8570, 0x0012}, {0x8571, 0x0070}, -{0x8572, 0x0086}, {0x8573, 0x0001}, {0x8574, 0x00ba}, -{0x8575, 0x0012}, {0x8576, 0x0004}, {0x8577, 0x00b7}, -{0x8578, 0x0012}, {0x8579, 0x0004}, {0x857a, 0x0001}, -{0x857b, 0x0001}, {0x857c, 0x0001}, {0x857d, 0x0001}, -{0x857e, 0x0001}, {0x857f, 0x0001}, {0x8580, 0x00b6}, -{0x8581, 0x0012}, {0x8582, 0x0004}, {0x8583, 0x0084}, -{0x8584, 0x00fe}, {0x8585, 0x008a}, {0x8586, 0x0002}, -{0x8587, 0x00b7}, {0x8588, 0x0012}, {0x8589, 0x0004}, -{0x858a, 0x0001}, {0x858b, 0x0001}, {0x858c, 0x0001}, -{0x858d, 0x0001}, {0x858e, 0x0001}, {0x858f, 0x0001}, -{0x8590, 0x0086}, {0x8591, 0x00fd}, {0x8592, 0x00b4}, -{0x8593, 0x0012}, {0x8594, 0x0004}, {0x8595, 0x00b7}, -{0x8596, 0x0012}, {0x8597, 0x0004}, {0x8598, 0x00b6}, -{0x8599, 0x0012}, {0x859a, 0x0000}, {0x859b, 0x0084}, -{0x859c, 0x0008}, {0x859d, 0x0081}, {0x859e, 0x0008}, -{0x859f, 0x0027}, {0x85a0, 0x0016}, {0x85a1, 0x00b6}, -{0x85a2, 0x008f}, {0x85a3, 0x007d}, {0x85a4, 0x0081}, -{0x85a5, 0x000c}, {0x85a6, 0x0027}, {0x85a7, 0x0008}, -{0x85a8, 0x008b}, {0x85a9, 0x0004}, {0x85aa, 0x00b7}, -{0x85ab, 0x008f}, {0x85ac, 0x007d}, {0x85ad, 0x007e}, -{0x85ae, 0x0085}, {0x85af, 0x006c}, {0x85b0, 0x0086}, -{0x85b1, 0x0003}, {0x85b2, 0x0097}, {0x85b3, 0x0040}, -{0x85b4, 0x007e}, {0x85b5, 0x0089}, {0x85b6, 0x006e}, -{0x85b7, 0x0086}, {0x85b8, 0x0007}, {0x85b9, 0x00b7}, -{0x85ba, 0x0012}, {0x85bb, 0x0006}, {0x85bc, 0x005f}, -{0x85bd, 0x00f7}, {0x85be, 0x008f}, {0x85bf, 0x0082}, -{0x85c0, 0x005f}, {0x85c1, 0x00f7}, {0x85c2, 0x008f}, -{0x85c3, 0x007f}, {0x85c4, 0x00f7}, {0x85c5, 0x008f}, -{0x85c6, 0x0070}, {0x85c7, 0x00f7}, {0x85c8, 0x008f}, -{0x85c9, 0x0071}, {0x85ca, 0x00f7}, {0x85cb, 0x008f}, -{0x85cc, 0x0072}, {0x85cd, 0x00f7}, {0x85ce, 0x008f}, -{0x85cf, 0x0073}, {0x85d0, 0x00f7}, {0x85d1, 0x008f}, -{0x85d2, 0x0074}, {0x85d3, 0x00f7}, {0x85d4, 0x008f}, -{0x85d5, 0x0075}, {0x85d6, 0x00f7}, {0x85d7, 0x008f}, -{0x85d8, 0x0076}, {0x85d9, 0x00f7}, {0x85da, 0x008f}, -{0x85db, 0x0077}, {0x85dc, 0x00f7}, {0x85dd, 0x008f}, -{0x85de, 0x0078}, {0x85df, 0x00f7}, {0x85e0, 0x008f}, -{0x85e1, 0x0079}, {0x85e2, 0x00f7}, {0x85e3, 0x008f}, -{0x85e4, 0x007a}, {0x85e5, 0x00f7}, {0x85e6, 0x008f}, -{0x85e7, 0x007b}, {0x85e8, 0x00b6}, {0x85e9, 0x0012}, -{0x85ea, 0x0004}, {0x85eb, 0x008a}, {0x85ec, 0x0010}, -{0x85ed, 0x00b7}, {0x85ee, 0x0012}, {0x85ef, 0x0004}, -{0x85f0, 0x0086}, {0x85f1, 0x00e4}, {0x85f2, 0x00b7}, -{0x85f3, 0x0012}, {0x85f4, 0x0070}, {0x85f5, 0x00b7}, -{0x85f6, 0x0012}, {0x85f7, 0x0007}, {0x85f8, 0x00f7}, -{0x85f9, 0x0012}, {0x85fa, 0x0005}, {0x85fb, 0x00f7}, -{0x85fc, 0x0012}, {0x85fd, 0x0009}, {0x85fe, 0x0086}, -{0x85ff, 0x0008}, {0x8600, 0x00ba}, {0x8601, 0x0012}, -{0x8602, 0x0004}, {0x8603, 0x00b7}, {0x8604, 0x0012}, -{0x8605, 0x0004}, {0x8606, 0x0086}, {0x8607, 0x00f7}, -{0x8608, 0x00b4}, {0x8609, 0x0012}, {0x860a, 0x0004}, -{0x860b, 0x00b7}, {0x860c, 0x0012}, {0x860d, 0x0004}, -{0x860e, 0x0001}, {0x860f, 0x0001}, {0x8610, 0x0001}, -{0x8611, 0x0001}, {0x8612, 0x0001}, {0x8613, 0x0001}, -{0x8614, 0x00b6}, {0x8615, 0x0012}, {0x8616, 0x0008}, -{0x8617, 0x0027}, {0x8618, 0x007f}, {0x8619, 0x0081}, -{0x861a, 0x0080}, {0x861b, 0x0026}, {0x861c, 0x000b}, -{0x861d, 0x0086}, {0x861e, 0x0008}, {0x861f, 0x00ce}, -{0x8620, 0x008f}, {0x8621, 0x0079}, {0x8622, 0x00bd}, -{0x8623, 0x0089}, {0x8624, 0x007b}, {0x8625, 0x007e}, -{0x8626, 0x0086}, {0x8627, 0x008e}, {0x8628, 0x0081}, -{0x8629, 0x0040}, {0x862a, 0x0026}, {0x862b, 0x000b}, -{0x862c, 0x0086}, {0x862d, 0x0004}, {0x862e, 0x00ce}, -{0x862f, 0x008f}, {0x8630, 0x0076}, {0x8631, 0x00bd}, -{0x8632, 0x0089}, {0x8633, 0x007b}, {0x8634, 0x007e}, -{0x8635, 0x0086}, {0x8636, 0x008e}, {0x8637, 0x0081}, -{0x8638, 0x0020}, {0x8639, 0x0026}, {0x863a, 0x000b}, -{0x863b, 0x0086}, {0x863c, 0x0002}, {0x863d, 0x00ce}, -{0x863e, 0x008f}, {0x863f, 0x0073}, {0x8640, 0x00bd}, -{0x8641, 0x0089}, {0x8642, 0x007b}, {0x8643, 0x007e}, -{0x8644, 0x0086}, {0x8645, 0x008e}, {0x8646, 0x0081}, -{0x8647, 0x0010}, {0x8648, 0x0026}, {0x8649, 0x000b}, -{0x864a, 0x0086}, {0x864b, 0x0001}, {0x864c, 0x00ce}, -{0x864d, 0x008f}, {0x864e, 0x0070}, {0x864f, 0x00bd}, -{0x8650, 0x0089}, {0x8651, 0x007b}, {0x8652, 0x007e}, -{0x8653, 0x0086}, {0x8654, 0x008e}, {0x8655, 0x0081}, -{0x8656, 0x0008}, {0x8657, 0x0026}, {0x8658, 0x000b}, -{0x8659, 0x0086}, {0x865a, 0x0008}, {0x865b, 0x00ce}, -{0x865c, 0x008f}, {0x865d, 0x0079}, {0x865e, 0x00bd}, -{0x865f, 0x0089}, {0x8660, 0x007f}, {0x8661, 0x007e}, -{0x8662, 0x0086}, {0x8663, 0x008e}, {0x8664, 0x0081}, -{0x8665, 0x0004}, {0x8666, 0x0026}, {0x8667, 0x000b}, -{0x8668, 0x0086}, {0x8669, 0x0004}, {0x866a, 0x00ce}, -{0x866b, 0x008f}, {0x866c, 0x0076}, {0x866d, 0x00bd}, -{0x866e, 0x0089}, {0x866f, 0x007f}, {0x8670, 0x007e}, -{0x8671, 0x0086}, {0x8672, 0x008e}, {0x8673, 0x0081}, -{0x8674, 0x0002}, {0x8675, 0x0026}, {0x8676, 0x000b}, -{0x8677, 0x008a}, {0x8678, 0x0002}, {0x8679, 0x00ce}, -{0x867a, 0x008f}, {0x867b, 0x0073}, {0x867c, 0x00bd}, -{0x867d, 0x0089}, {0x867e, 0x007f}, {0x867f, 0x007e}, -{0x8680, 0x0086}, {0x8681, 0x008e}, {0x8682, 0x0081}, -{0x8683, 0x0001}, {0x8684, 0x0026}, {0x8685, 0x0008}, -{0x8686, 0x0086}, {0x8687, 0x0001}, {0x8688, 0x00ce}, -{0x8689, 0x008f}, {0x868a, 0x0070}, {0x868b, 0x00bd}, -{0x868c, 0x0089}, {0x868d, 0x007f}, {0x868e, 0x00b6}, -{0x868f, 0x008f}, {0x8690, 0x007f}, {0x8691, 0x0081}, -{0x8692, 0x000f}, {0x8693, 0x0026}, {0x8694, 0x0003}, -{0x8695, 0x007e}, {0x8696, 0x0087}, {0x8697, 0x0047}, -{0x8698, 0x00b6}, {0x8699, 0x0012}, {0x869a, 0x0009}, -{0x869b, 0x0084}, {0x869c, 0x0003}, {0x869d, 0x0081}, -{0x869e, 0x0003}, {0x869f, 0x0027}, {0x86a0, 0x0006}, -{0x86a1, 0x007c}, {0x86a2, 0x0012}, {0x86a3, 0x0009}, -{0x86a4, 0x007e}, {0x86a5, 0x0085}, {0x86a6, 0x00fe}, -{0x86a7, 0x00b6}, {0x86a8, 0x0012}, {0x86a9, 0x0006}, -{0x86aa, 0x0084}, {0x86ab, 0x0007}, {0x86ac, 0x0081}, -{0x86ad, 0x0007}, {0x86ae, 0x0027}, {0x86af, 0x0008}, -{0x86b0, 0x008b}, {0x86b1, 0x0001}, {0x86b2, 0x00b7}, -{0x86b3, 0x0012}, {0x86b4, 0x0006}, {0x86b5, 0x007e}, -{0x86b6, 0x0086}, {0x86b7, 0x00d5}, {0x86b8, 0x00b6}, -{0x86b9, 0x008f}, {0x86ba, 0x0082}, {0x86bb, 0x0026}, -{0x86bc, 0x000a}, {0x86bd, 0x007c}, {0x86be, 0x008f}, -{0x86bf, 0x0082}, {0x86c0, 0x004f}, {0x86c1, 0x00b7}, -{0x86c2, 0x0012}, {0x86c3, 0x0006}, {0x86c4, 0x007e}, -{0x86c5, 0x0085}, {0x86c6, 0x00c0}, {0x86c7, 0x00b6}, -{0x86c8, 0x0012}, {0x86c9, 0x0006}, {0x86ca, 0x0084}, -{0x86cb, 0x003f}, {0x86cc, 0x0081}, {0x86cd, 0x003f}, -{0x86ce, 0x0027}, {0x86cf, 0x0010}, {0x86d0, 0x008b}, -{0x86d1, 0x0008}, {0x86d2, 0x00b7}, {0x86d3, 0x0012}, -{0x86d4, 0x0006}, {0x86d5, 0x00b6}, {0x86d6, 0x0012}, -{0x86d7, 0x0009}, {0x86d8, 0x0084}, {0x86d9, 0x00fc}, -{0x86da, 0x00b7}, {0x86db, 0x0012}, {0x86dc, 0x0009}, -{0x86dd, 0x007e}, {0x86de, 0x0085}, {0x86df, 0x00fe}, -{0x86e0, 0x00ce}, {0x86e1, 0x008f}, {0x86e2, 0x0070}, -{0x86e3, 0x0018}, {0x86e4, 0x00ce}, {0x86e5, 0x008f}, -{0x86e6, 0x0084}, {0x86e7, 0x00c6}, {0x86e8, 0x000c}, -{0x86e9, 0x00bd}, {0x86ea, 0x0089}, {0x86eb, 0x006f}, -{0x86ec, 0x00ce}, {0x86ed, 0x008f}, {0x86ee, 0x0084}, -{0x86ef, 0x0018}, {0x86f0, 0x00ce}, {0x86f1, 0x008f}, -{0x86f2, 0x0070}, {0x86f3, 0x00c6}, {0x86f4, 0x000c}, -{0x86f5, 0x00bd}, {0x86f6, 0x0089}, {0x86f7, 0x006f}, -{0x86f8, 0x00d6}, {0x86f9, 0x0083}, {0x86fa, 0x00c1}, -{0x86fb, 0x004f}, {0x86fc, 0x002d}, {0x86fd, 0x0003}, -{0x86fe, 0x007e}, {0x86ff, 0x0087}, {0x8700, 0x0040}, -{0x8701, 0x00b6}, {0x8702, 0x008f}, {0x8703, 0x007f}, -{0x8704, 0x0081}, {0x8705, 0x0007}, {0x8706, 0x0027}, -{0x8707, 0x000f}, {0x8708, 0x0081}, {0x8709, 0x000b}, -{0x870a, 0x0027}, {0x870b, 0x0015}, {0x870c, 0x0081}, -{0x870d, 0x000d}, {0x870e, 0x0027}, {0x870f, 0x001b}, -{0x8710, 0x0081}, {0x8711, 0x000e}, {0x8712, 0x0027}, -{0x8713, 0x0021}, {0x8714, 0x007e}, {0x8715, 0x0087}, -{0x8716, 0x0040}, {0x8717, 0x00f7}, {0x8718, 0x008f}, -{0x8719, 0x007b}, {0x871a, 0x0086}, {0x871b, 0x0002}, -{0x871c, 0x00b7}, {0x871d, 0x008f}, {0x871e, 0x007a}, -{0x871f, 0x0020}, {0x8720, 0x001c}, {0x8721, 0x00f7}, -{0x8722, 0x008f}, {0x8723, 0x0078}, {0x8724, 0x0086}, -{0x8725, 0x0002}, {0x8726, 0x00b7}, {0x8727, 0x008f}, -{0x8728, 0x0077}, {0x8729, 0x0020}, {0x872a, 0x0012}, -{0x872b, 0x00f7}, {0x872c, 0x008f}, {0x872d, 0x0075}, -{0x872e, 0x0086}, {0x872f, 0x0002}, {0x8730, 0x00b7}, -{0x8731, 0x008f}, {0x8732, 0x0074}, {0x8733, 0x0020}, -{0x8734, 0x0008}, {0x8735, 0x00f7}, {0x8736, 0x008f}, -{0x8737, 0x0072}, {0x8738, 0x0086}, {0x8739, 0x0002}, -{0x873a, 0x00b7}, {0x873b, 0x008f}, {0x873c, 0x0071}, -{0x873d, 0x007e}, {0x873e, 0x0087}, {0x873f, 0x0047}, -{0x8740, 0x0086}, {0x8741, 0x0004}, {0x8742, 0x0097}, -{0x8743, 0x0040}, {0x8744, 0x007e}, {0x8745, 0x0089}, -{0x8746, 0x006e}, {0x8747, 0x00ce}, {0x8748, 0x008f}, -{0x8749, 0x0072}, {0x874a, 0x00bd}, {0x874b, 0x0089}, -{0x874c, 0x00f7}, {0x874d, 0x00ce}, {0x874e, 0x008f}, -{0x874f, 0x0075}, {0x8750, 0x00bd}, {0x8751, 0x0089}, -{0x8752, 0x00f7}, {0x8753, 0x00ce}, {0x8754, 0x008f}, -{0x8755, 0x0078}, {0x8756, 0x00bd}, {0x8757, 0x0089}, -{0x8758, 0x00f7}, {0x8759, 0x00ce}, {0x875a, 0x008f}, -{0x875b, 0x007b}, {0x875c, 0x00bd}, {0x875d, 0x0089}, -{0x875e, 0x00f7}, {0x875f, 0x004f}, {0x8760, 0x00b7}, -{0x8761, 0x008f}, {0x8762, 0x007d}, {0x8763, 0x00b7}, -{0x8764, 0x008f}, {0x8765, 0x0081}, {0x8766, 0x00b6}, -{0x8767, 0x008f}, {0x8768, 0x0072}, {0x8769, 0x0027}, -{0x876a, 0x0047}, {0x876b, 0x007c}, {0x876c, 0x008f}, -{0x876d, 0x007d}, {0x876e, 0x00b6}, {0x876f, 0x008f}, -{0x8770, 0x0075}, {0x8771, 0x0027}, {0x8772, 0x003f}, -{0x8773, 0x007c}, {0x8774, 0x008f}, {0x8775, 0x007d}, -{0x8776, 0x00b6}, {0x8777, 0x008f}, {0x8778, 0x0078}, -{0x8779, 0x0027}, {0x877a, 0x0037}, {0x877b, 0x007c}, -{0x877c, 0x008f}, {0x877d, 0x007d}, {0x877e, 0x00b6}, -{0x877f, 0x008f}, {0x8780, 0x007b}, {0x8781, 0x0027}, -{0x8782, 0x002f}, {0x8783, 0x007f}, {0x8784, 0x008f}, -{0x8785, 0x007d}, {0x8786, 0x007c}, {0x8787, 0x008f}, -{0x8788, 0x0081}, {0x8789, 0x007a}, {0x878a, 0x008f}, -{0x878b, 0x0072}, {0x878c, 0x0027}, {0x878d, 0x001b}, -{0x878e, 0x007c}, {0x878f, 0x008f}, {0x8790, 0x007d}, -{0x8791, 0x007a}, {0x8792, 0x008f}, {0x8793, 0x0075}, -{0x8794, 0x0027}, {0x8795, 0x0016}, {0x8796, 0x007c}, -{0x8797, 0x008f}, {0x8798, 0x007d}, {0x8799, 0x007a}, -{0x879a, 0x008f}, {0x879b, 0x0078}, {0x879c, 0x0027}, -{0x879d, 0x0011}, {0x879e, 0x007c}, {0x879f, 0x008f}, -{0x87a0, 0x007d}, {0x87a1, 0x007a}, {0x87a2, 0x008f}, -{0x87a3, 0x007b}, {0x87a4, 0x0027}, {0x87a5, 0x000c}, -{0x87a6, 0x007e}, {0x87a7, 0x0087}, {0x87a8, 0x0083}, -{0x87a9, 0x007a}, {0x87aa, 0x008f}, {0x87ab, 0x0075}, -{0x87ac, 0x007a}, {0x87ad, 0x008f}, {0x87ae, 0x0078}, -{0x87af, 0x007a}, {0x87b0, 0x008f}, {0x87b1, 0x007b}, -{0x87b2, 0x00ce}, {0x87b3, 0x00c1}, {0x87b4, 0x00fc}, -{0x87b5, 0x00f6}, {0x87b6, 0x008f}, {0x87b7, 0x007d}, -{0x87b8, 0x003a}, {0x87b9, 0x00a6}, {0x87ba, 0x0000}, -{0x87bb, 0x00b7}, {0x87bc, 0x0012}, {0x87bd, 0x0070}, -{0x87be, 0x00b6}, {0x87bf, 0x008f}, {0x87c0, 0x0072}, -{0x87c1, 0x0026}, {0x87c2, 0x0003}, {0x87c3, 0x007e}, -{0x87c4, 0x0087}, {0x87c5, 0x00fa}, {0x87c6, 0x00b6}, -{0x87c7, 0x008f}, {0x87c8, 0x0075}, {0x87c9, 0x0026}, -{0x87ca, 0x000a}, {0x87cb, 0x0018}, {0x87cc, 0x00ce}, -{0x87cd, 0x008f}, {0x87ce, 0x0073}, {0x87cf, 0x00bd}, -{0x87d0, 0x0089}, {0x87d1, 0x00d5}, {0x87d2, 0x007e}, -{0x87d3, 0x0087}, {0x87d4, 0x00fa}, {0x87d5, 0x00b6}, -{0x87d6, 0x008f}, {0x87d7, 0x0078}, {0x87d8, 0x0026}, -{0x87d9, 0x000a}, {0x87da, 0x0018}, {0x87db, 0x00ce}, -{0x87dc, 0x008f}, {0x87dd, 0x0076}, {0x87de, 0x00bd}, -{0x87df, 0x0089}, {0x87e0, 0x00d5}, {0x87e1, 0x007e}, -{0x87e2, 0x0087}, {0x87e3, 0x00fa}, {0x87e4, 0x00b6}, -{0x87e5, 0x008f}, {0x87e6, 0x007b}, {0x87e7, 0x0026}, -{0x87e8, 0x000a}, {0x87e9, 0x0018}, {0x87ea, 0x00ce}, -{0x87eb, 0x008f}, {0x87ec, 0x0079}, {0x87ed, 0x00bd}, -{0x87ee, 0x0089}, {0x87ef, 0x00d5}, {0x87f0, 0x007e}, -{0x87f1, 0x0087}, {0x87f2, 0x00fa}, {0x87f3, 0x0086}, -{0x87f4, 0x0005}, {0x87f5, 0x0097}, {0x87f6, 0x0040}, -{0x87f7, 0x007e}, {0x87f8, 0x0089}, {0x87f9, 0x006e}, -{0x87fa, 0x00b6}, {0x87fb, 0x008f}, {0x87fc, 0x0075}, -{0x87fd, 0x0081}, {0x87fe, 0x0007}, {0x87ff, 0x002e}, -{0x8800, 0x00f2}, {0x8801, 0x00f6}, {0x8802, 0x0012}, -{0x8803, 0x0006}, {0x8804, 0x00c4}, {0x8805, 0x00f8}, -{0x8806, 0x001b}, {0x8807, 0x00b7}, {0x8808, 0x0012}, -{0x8809, 0x0006}, {0x880a, 0x00b6}, {0x880b, 0x008f}, -{0x880c, 0x0078}, {0x880d, 0x0081}, {0x880e, 0x0007}, -{0x880f, 0x002e}, {0x8810, 0x00e2}, {0x8811, 0x0048}, -{0x8812, 0x0048}, {0x8813, 0x0048}, {0x8814, 0x00f6}, -{0x8815, 0x0012}, {0x8816, 0x0006}, {0x8817, 0x00c4}, -{0x8818, 0x00c7}, {0x8819, 0x001b}, {0x881a, 0x00b7}, -{0x881b, 0x0012}, {0x881c, 0x0006}, {0x881d, 0x00b6}, -{0x881e, 0x008f}, {0x881f, 0x007b}, {0x8820, 0x0081}, -{0x8821, 0x0007}, {0x8822, 0x002e}, {0x8823, 0x00cf}, -{0x8824, 0x00f6}, {0x8825, 0x0012}, {0x8826, 0x0005}, -{0x8827, 0x00c4}, {0x8828, 0x00f8}, {0x8829, 0x001b}, -{0x882a, 0x00b7}, {0x882b, 0x0012}, {0x882c, 0x0005}, -{0x882d, 0x0086}, {0x882e, 0x0000}, {0x882f, 0x00f6}, -{0x8830, 0x008f}, {0x8831, 0x0071}, {0x8832, 0x00bd}, -{0x8833, 0x0089}, {0x8834, 0x0094}, {0x8835, 0x0086}, -{0x8836, 0x0001}, {0x8837, 0x00f6}, {0x8838, 0x008f}, -{0x8839, 0x0074}, {0x883a, 0x00bd}, {0x883b, 0x0089}, -{0x883c, 0x0094}, {0x883d, 0x0086}, {0x883e, 0x0002}, -{0x883f, 0x00f6}, {0x8840, 0x008f}, {0x8841, 0x0077}, -{0x8842, 0x00bd}, {0x8843, 0x0089}, {0x8844, 0x0094}, -{0x8845, 0x0086}, {0x8846, 0x0003}, {0x8847, 0x00f6}, -{0x8848, 0x008f}, {0x8849, 0x007a}, {0x884a, 0x00bd}, -{0x884b, 0x0089}, {0x884c, 0x0094}, {0x884d, 0x00ce}, -{0x884e, 0x008f}, {0x884f, 0x0070}, {0x8850, 0x00a6}, -{0x8851, 0x0001}, {0x8852, 0x0081}, {0x8853, 0x0001}, -{0x8854, 0x0027}, {0x8855, 0x0007}, {0x8856, 0x0081}, -{0x8857, 0x0003}, {0x8858, 0x0027}, {0x8859, 0x0003}, -{0x885a, 0x007e}, {0x885b, 0x0088}, {0x885c, 0x0066}, -{0x885d, 0x00a6}, {0x885e, 0x0000}, {0x885f, 0x00b8}, -{0x8860, 0x008f}, {0x8861, 0x0081}, {0x8862, 0x0084}, -{0x8863, 0x0001}, {0x8864, 0x0026}, {0x8865, 0x000b}, -{0x8866, 0x008c}, {0x8867, 0x008f}, {0x8868, 0x0079}, -{0x8869, 0x002c}, {0x886a, 0x000e}, {0x886b, 0x0008}, -{0x886c, 0x0008}, {0x886d, 0x0008}, {0x886e, 0x007e}, -{0x886f, 0x0088}, {0x8870, 0x0050}, {0x8871, 0x00b6}, -{0x8872, 0x0012}, {0x8873, 0x0004}, {0x8874, 0x008a}, -{0x8875, 0x0040}, {0x8876, 0x00b7}, {0x8877, 0x0012}, -{0x8878, 0x0004}, {0x8879, 0x00b6}, {0x887a, 0x0012}, -{0x887b, 0x0004}, {0x887c, 0x0084}, {0x887d, 0x00fb}, -{0x887e, 0x0084}, {0x887f, 0x00ef}, {0x8880, 0x00b7}, -{0x8881, 0x0012}, {0x8882, 0x0004}, {0x8883, 0x00b6}, -{0x8884, 0x0012}, {0x8885, 0x0007}, {0x8886, 0x0036}, -{0x8887, 0x00b6}, {0x8888, 0x008f}, {0x8889, 0x007c}, -{0x888a, 0x0048}, {0x888b, 0x0048}, {0x888c, 0x00b7}, -{0x888d, 0x0012}, {0x888e, 0x0007}, {0x888f, 0x0086}, -{0x8890, 0x0001}, {0x8891, 0x00ba}, {0x8892, 0x0012}, -{0x8893, 0x0004}, {0x8894, 0x00b7}, {0x8895, 0x0012}, -{0x8896, 0x0004}, {0x8897, 0x0001}, {0x8898, 0x0001}, -{0x8899, 0x0001}, {0x889a, 0x0001}, {0x889b, 0x0001}, -{0x889c, 0x0001}, {0x889d, 0x0086}, {0x889e, 0x00fe}, -{0x889f, 0x00b4}, {0x88a0, 0x0012}, {0x88a1, 0x0004}, -{0x88a2, 0x00b7}, {0x88a3, 0x0012}, {0x88a4, 0x0004}, -{0x88a5, 0x0086}, {0x88a6, 0x0002}, {0x88a7, 0x00ba}, -{0x88a8, 0x0012}, {0x88a9, 0x0004}, {0x88aa, 0x00b7}, -{0x88ab, 0x0012}, {0x88ac, 0x0004}, {0x88ad, 0x0086}, -{0x88ae, 0x00fd}, {0x88af, 0x00b4}, {0x88b0, 0x0012}, -{0x88b1, 0x0004}, {0x88b2, 0x00b7}, {0x88b3, 0x0012}, -{0x88b4, 0x0004}, {0x88b5, 0x0032}, {0x88b6, 0x00b7}, -{0x88b7, 0x0012}, {0x88b8, 0x0007}, {0x88b9, 0x00b6}, -{0x88ba, 0x0012}, {0x88bb, 0x0000}, {0x88bc, 0x0084}, -{0x88bd, 0x0008}, {0x88be, 0x0081}, {0x88bf, 0x0008}, -{0x88c0, 0x0027}, {0x88c1, 0x000f}, {0x88c2, 0x007c}, -{0x88c3, 0x0082}, {0x88c4, 0x0008}, {0x88c5, 0x0026}, -{0x88c6, 0x0007}, {0x88c7, 0x0086}, {0x88c8, 0x0076}, -{0x88c9, 0x0097}, {0x88ca, 0x0040}, {0x88cb, 0x007e}, -{0x88cc, 0x0089}, {0x88cd, 0x006e}, {0x88ce, 0x007e}, -{0x88cf, 0x0086}, {0x88d0, 0x00ec}, {0x88d1, 0x00b6}, -{0x88d2, 0x008f}, {0x88d3, 0x007f}, {0x88d4, 0x0081}, -{0x88d5, 0x000f}, {0x88d6, 0x0027}, {0x88d7, 0x003c}, -{0x88d8, 0x00bd}, {0x88d9, 0x00e6}, {0x88da, 0x00c7}, -{0x88db, 0x00b7}, {0x88dc, 0x0012}, {0x88dd, 0x000d}, -{0x88de, 0x00bd}, {0x88df, 0x00e6}, {0x88e0, 0x00cb}, -{0x88e1, 0x00b6}, {0x88e2, 0x0012}, {0x88e3, 0x0004}, -{0x88e4, 0x008a}, {0x88e5, 0x0020}, {0x88e6, 0x00b7}, -{0x88e7, 0x0012}, {0x88e8, 0x0004}, {0x88e9, 0x00ce}, -{0x88ea, 0x00ff}, {0x88eb, 0x00ff}, {0x88ec, 0x00b6}, -{0x88ed, 0x0012}, {0x88ee, 0x0000}, {0x88ef, 0x0081}, -{0x88f0, 0x000c}, {0x88f1, 0x0026}, {0x88f2, 0x0005}, -{0x88f3, 0x0009}, {0x88f4, 0x0026}, {0x88f5, 0x00f6}, -{0x88f6, 0x0027}, {0x88f7, 0x001c}, {0x88f8, 0x00b6}, -{0x88f9, 0x0012}, {0x88fa, 0x0004}, {0x88fb, 0x0084}, -{0x88fc, 0x00df}, {0x88fd, 0x00b7}, {0x88fe, 0x0012}, -{0x88ff, 0x0004}, {0x8900, 0x0096}, {0x8901, 0x0083}, -{0x8902, 0x0081}, {0x8903, 0x0007}, {0x8904, 0x002c}, -{0x8905, 0x0005}, {0x8906, 0x007c}, {0x8907, 0x0000}, -{0x8908, 0x0083}, {0x8909, 0x0020}, {0x890a, 0x0006}, -{0x890b, 0x0096}, {0x890c, 0x0083}, {0x890d, 0x008b}, -{0x890e, 0x0008}, {0x890f, 0x0097}, {0x8910, 0x0083}, -{0x8911, 0x007e}, {0x8912, 0x0085}, {0x8913, 0x0041}, -{0x8914, 0x007f}, {0x8915, 0x008f}, {0x8916, 0x007e}, -{0x8917, 0x0086}, {0x8918, 0x0080}, {0x8919, 0x00b7}, -{0x891a, 0x0012}, {0x891b, 0x000c}, {0x891c, 0x0086}, -{0x891d, 0x0001}, {0x891e, 0x00b7}, {0x891f, 0x008f}, -{0x8920, 0x007d}, {0x8921, 0x00b6}, {0x8922, 0x0012}, -{0x8923, 0x000c}, {0x8924, 0x0084}, {0x8925, 0x007f}, -{0x8926, 0x00b7}, {0x8927, 0x0012}, {0x8928, 0x000c}, -{0x8929, 0x008a}, {0x892a, 0x0080}, {0x892b, 0x00b7}, -{0x892c, 0x0012}, {0x892d, 0x000c}, {0x892e, 0x0086}, -{0x892f, 0x000a}, {0x8930, 0x00bd}, {0x8931, 0x008a}, -{0x8932, 0x0006}, {0x8933, 0x00b6}, {0x8934, 0x0012}, -{0x8935, 0x000a}, {0x8936, 0x002a}, {0x8937, 0x0009}, -{0x8938, 0x00b6}, {0x8939, 0x0012}, {0x893a, 0x000c}, -{0x893b, 0x00ba}, {0x893c, 0x008f}, {0x893d, 0x007d}, -{0x893e, 0x00b7}, {0x893f, 0x0012}, {0x8940, 0x000c}, -{0x8941, 0x00b6}, {0x8942, 0x008f}, {0x8943, 0x007e}, -{0x8944, 0x0081}, {0x8945, 0x0060}, {0x8946, 0x0027}, -{0x8947, 0x001a}, {0x8948, 0x008b}, {0x8949, 0x0020}, -{0x894a, 0x00b7}, {0x894b, 0x008f}, {0x894c, 0x007e}, -{0x894d, 0x00b6}, {0x894e, 0x0012}, {0x894f, 0x000c}, -{0x8950, 0x0084}, {0x8951, 0x009f}, {0x8952, 0x00ba}, -{0x8953, 0x008f}, {0x8954, 0x007e}, {0x8955, 0x00b7}, -{0x8956, 0x0012}, {0x8957, 0x000c}, {0x8958, 0x00b6}, -{0x8959, 0x008f}, {0x895a, 0x007d}, {0x895b, 0x0048}, -{0x895c, 0x00b7}, {0x895d, 0x008f}, {0x895e, 0x007d}, -{0x895f, 0x007e}, {0x8960, 0x0089}, {0x8961, 0x0021}, -{0x8962, 0x00b6}, {0x8963, 0x0012}, {0x8964, 0x0004}, -{0x8965, 0x008a}, {0x8966, 0x0020}, {0x8967, 0x00b7}, -{0x8968, 0x0012}, {0x8969, 0x0004}, {0x896a, 0x00bd}, -{0x896b, 0x008a}, {0x896c, 0x000a}, {0x896d, 0x004f}, -{0x896e, 0x0039}, {0x896f, 0x00a6}, {0x8970, 0x0000}, -{0x8971, 0x0018}, {0x8972, 0x00a7}, {0x8973, 0x0000}, -{0x8974, 0x0008}, {0x8975, 0x0018}, {0x8976, 0x0008}, -{0x8977, 0x005a}, {0x8978, 0x0026}, {0x8979, 0x00f5}, -{0x897a, 0x0039}, {0x897b, 0x0036}, {0x897c, 0x006c}, -{0x897d, 0x0000}, {0x897e, 0x0032}, {0x897f, 0x00ba}, -{0x8980, 0x008f}, {0x8981, 0x007f}, {0x8982, 0x00b7}, -{0x8983, 0x008f}, {0x8984, 0x007f}, {0x8985, 0x00b6}, -{0x8986, 0x0012}, {0x8987, 0x0009}, {0x8988, 0x0084}, -{0x8989, 0x0003}, {0x898a, 0x00a7}, {0x898b, 0x0001}, -{0x898c, 0x00b6}, {0x898d, 0x0012}, {0x898e, 0x0006}, -{0x898f, 0x0084}, {0x8990, 0x003f}, {0x8991, 0x00a7}, -{0x8992, 0x0002}, {0x8993, 0x0039}, {0x8994, 0x0036}, -{0x8995, 0x0086}, {0x8996, 0x0003}, {0x8997, 0x00b7}, -{0x8998, 0x008f}, {0x8999, 0x0080}, {0x899a, 0x0032}, -{0x899b, 0x00c1}, {0x899c, 0x0000}, {0x899d, 0x0026}, -{0x899e, 0x0006}, {0x899f, 0x00b7}, {0x89a0, 0x008f}, -{0x89a1, 0x007c}, {0x89a2, 0x007e}, {0x89a3, 0x0089}, -{0x89a4, 0x00c9}, {0x89a5, 0x00c1}, {0x89a6, 0x0001}, -{0x89a7, 0x0027}, {0x89a8, 0x0018}, {0x89a9, 0x00c1}, -{0x89aa, 0x0002}, {0x89ab, 0x0027}, {0x89ac, 0x000c}, -{0x89ad, 0x00c1}, {0x89ae, 0x0003}, {0x89af, 0x0027}, -{0x89b0, 0x0000}, {0x89b1, 0x00f6}, {0x89b2, 0x008f}, -{0x89b3, 0x0080}, {0x89b4, 0x0005}, {0x89b5, 0x0005}, -{0x89b6, 0x00f7}, {0x89b7, 0x008f}, {0x89b8, 0x0080}, -{0x89b9, 0x00f6}, {0x89ba, 0x008f}, {0x89bb, 0x0080}, -{0x89bc, 0x0005}, {0x89bd, 0x0005}, {0x89be, 0x00f7}, -{0x89bf, 0x008f}, {0x89c0, 0x0080}, {0x89c1, 0x00f6}, -{0x89c2, 0x008f}, {0x89c3, 0x0080}, {0x89c4, 0x0005}, -{0x89c5, 0x0005}, {0x89c6, 0x00f7}, {0x89c7, 0x008f}, -{0x89c8, 0x0080}, {0x89c9, 0x00f6}, {0x89ca, 0x008f}, -{0x89cb, 0x0080}, {0x89cc, 0x0053}, {0x89cd, 0x00f4}, -{0x89ce, 0x0012}, {0x89cf, 0x0007}, {0x89d0, 0x001b}, -{0x89d1, 0x00b7}, {0x89d2, 0x0012}, {0x89d3, 0x0007}, -{0x89d4, 0x0039}, {0x89d5, 0x00ce}, {0x89d6, 0x008f}, -{0x89d7, 0x0070}, {0x89d8, 0x00a6}, {0x89d9, 0x0000}, -{0x89da, 0x0018}, {0x89db, 0x00e6}, {0x89dc, 0x0000}, -{0x89dd, 0x0018}, {0x89de, 0x00a7}, {0x89df, 0x0000}, -{0x89e0, 0x00e7}, {0x89e1, 0x0000}, {0x89e2, 0x00a6}, -{0x89e3, 0x0001}, {0x89e4, 0x0018}, {0x89e5, 0x00e6}, -{0x89e6, 0x0001}, {0x89e7, 0x0018}, {0x89e8, 0x00a7}, -{0x89e9, 0x0001}, {0x89ea, 0x00e7}, {0x89eb, 0x0001}, -{0x89ec, 0x00a6}, {0x89ed, 0x0002}, {0x89ee, 0x0018}, -{0x89ef, 0x00e6}, {0x89f0, 0x0002}, {0x89f1, 0x0018}, -{0x89f2, 0x00a7}, {0x89f3, 0x0002}, {0x89f4, 0x00e7}, -{0x89f5, 0x0002}, {0x89f6, 0x0039}, {0x89f7, 0x00a6}, -{0x89f8, 0x0000}, {0x89f9, 0x0084}, {0x89fa, 0x0007}, -{0x89fb, 0x00e6}, {0x89fc, 0x0000}, {0x89fd, 0x00c4}, -{0x89fe, 0x0038}, {0x89ff, 0x0054}, {0x8a00, 0x0054}, -{0x8a01, 0x0054}, {0x8a02, 0x001b}, {0x8a03, 0x00a7}, -{0x8a04, 0x0000}, {0x8a05, 0x0039}, {0x8a06, 0x004a}, -{0x8a07, 0x0026}, {0x8a08, 0x00fd}, {0x8a09, 0x0039}, -{0x8a0a, 0x0096}, {0x8a0b, 0x0022}, {0x8a0c, 0x0084}, -{0x8a0d, 0x000f}, {0x8a0e, 0x0097}, {0x8a0f, 0x0022}, -{0x8a10, 0x0086}, {0x8a11, 0x0001}, {0x8a12, 0x00b7}, -{0x8a13, 0x008f}, {0x8a14, 0x0070}, {0x8a15, 0x00b6}, -{0x8a16, 0x0012}, {0x8a17, 0x0007}, {0x8a18, 0x00b7}, -{0x8a19, 0x008f}, {0x8a1a, 0x0071}, {0x8a1b, 0x00f6}, -{0x8a1c, 0x0012}, {0x8a1d, 0x000c}, {0x8a1e, 0x00c4}, -{0x8a1f, 0x000f}, {0x8a20, 0x00c8}, {0x8a21, 0x000f}, -{0x8a22, 0x00f7}, {0x8a23, 0x008f}, {0x8a24, 0x0072}, -{0x8a25, 0x00f6}, {0x8a26, 0x008f}, {0x8a27, 0x0072}, -{0x8a28, 0x00b6}, {0x8a29, 0x008f}, {0x8a2a, 0x0071}, -{0x8a2b, 0x0084}, {0x8a2c, 0x0003}, {0x8a2d, 0x0027}, -{0x8a2e, 0x0014}, {0x8a2f, 0x0081}, {0x8a30, 0x0001}, -{0x8a31, 0x0027}, {0x8a32, 0x001c}, {0x8a33, 0x0081}, -{0x8a34, 0x0002}, {0x8a35, 0x0027}, {0x8a36, 0x0024}, -{0x8a37, 0x00f4}, {0x8a38, 0x008f}, {0x8a39, 0x0070}, -{0x8a3a, 0x0027}, {0x8a3b, 0x002a}, {0x8a3c, 0x0096}, -{0x8a3d, 0x0022}, {0x8a3e, 0x008a}, {0x8a3f, 0x0080}, -{0x8a40, 0x007e}, {0x8a41, 0x008a}, {0x8a42, 0x0064}, -{0x8a43, 0x00f4}, {0x8a44, 0x008f}, {0x8a45, 0x0070}, -{0x8a46, 0x0027}, {0x8a47, 0x001e}, {0x8a48, 0x0096}, -{0x8a49, 0x0022}, {0x8a4a, 0x008a}, {0x8a4b, 0x0010}, -{0x8a4c, 0x007e}, {0x8a4d, 0x008a}, {0x8a4e, 0x0064}, -{0x8a4f, 0x00f4}, {0x8a50, 0x008f}, {0x8a51, 0x0070}, -{0x8a52, 0x0027}, {0x8a53, 0x0012}, {0x8a54, 0x0096}, -{0x8a55, 0x0022}, {0x8a56, 0x008a}, {0x8a57, 0x0020}, -{0x8a58, 0x007e}, {0x8a59, 0x008a}, {0x8a5a, 0x0064}, -{0x8a5b, 0x00f4}, {0x8a5c, 0x008f}, {0x8a5d, 0x0070}, -{0x8a5e, 0x0027}, {0x8a5f, 0x0006}, {0x8a60, 0x0096}, -{0x8a61, 0x0022}, {0x8a62, 0x008a}, {0x8a63, 0x0040}, -{0x8a64, 0x0097}, {0x8a65, 0x0022}, {0x8a66, 0x0074}, -{0x8a67, 0x008f}, {0x8a68, 0x0071}, {0x8a69, 0x0074}, -{0x8a6a, 0x008f}, {0x8a6b, 0x0071}, {0x8a6c, 0x0078}, -{0x8a6d, 0x008f}, {0x8a6e, 0x0070}, {0x8a6f, 0x00b6}, -{0x8a70, 0x008f}, {0x8a71, 0x0070}, {0x8a72, 0x0085}, -{0x8a73, 0x0010}, {0x8a74, 0x0027}, {0x8a75, 0x00af}, -{0x8a76, 0x00d6}, {0x8a77, 0x0022}, {0x8a78, 0x00c4}, -{0x8a79, 0x0010}, {0x8a7a, 0x0058}, {0x8a7b, 0x00b6}, -{0x8a7c, 0x0012}, {0x8a7d, 0x0070}, {0x8a7e, 0x0081}, -{0x8a7f, 0x00e4}, {0x8a80, 0x0027}, {0x8a81, 0x0036}, -{0x8a82, 0x0081}, {0x8a83, 0x00e1}, {0x8a84, 0x0026}, -{0x8a85, 0x000c}, {0x8a86, 0x0096}, {0x8a87, 0x0022}, -{0x8a88, 0x0084}, {0x8a89, 0x0020}, {0x8a8a, 0x0044}, -{0x8a8b, 0x001b}, {0x8a8c, 0x00d6}, {0x8a8d, 0x0022}, -{0x8a8e, 0x00c4}, {0x8a8f, 0x00cf}, {0x8a90, 0x0020}, -{0x8a91, 0x0023}, {0x8a92, 0x0058}, {0x8a93, 0x0081}, -{0x8a94, 0x00c6}, {0x8a95, 0x0026}, {0x8a96, 0x000d}, -{0x8a97, 0x0096}, {0x8a98, 0x0022}, {0x8a99, 0x0084}, -{0x8a9a, 0x0040}, {0x8a9b, 0x0044}, {0x8a9c, 0x0044}, -{0x8a9d, 0x001b}, {0x8a9e, 0x00d6}, {0x8a9f, 0x0022}, -{0x8aa0, 0x00c4}, {0x8aa1, 0x00af}, {0x8aa2, 0x0020}, -{0x8aa3, 0x0011}, {0x8aa4, 0x0058}, {0x8aa5, 0x0081}, -{0x8aa6, 0x0027}, {0x8aa7, 0x0026}, {0x8aa8, 0x000f}, -{0x8aa9, 0x0096}, {0x8aaa, 0x0022}, {0x8aab, 0x0084}, -{0x8aac, 0x0080}, {0x8aad, 0x0044}, {0x8aae, 0x0044}, -{0x8aaf, 0x0044}, {0x8ab0, 0x001b}, {0x8ab1, 0x00d6}, -{0x8ab2, 0x0022}, {0x8ab3, 0x00c4}, {0x8ab4, 0x006f}, -{0x8ab5, 0x001b}, {0x8ab6, 0x0097}, {0x8ab7, 0x0022}, -{0x8ab8, 0x0039}, {0x8ab9, 0x0027}, {0x8aba, 0x000c}, -{0x8abb, 0x007c}, {0x8abc, 0x0082}, {0x8abd, 0x0006}, -{0x8abe, 0x00bd}, {0x8abf, 0x00d9}, {0x8ac0, 0x00ed}, -{0x8ac1, 0x00b6}, {0x8ac2, 0x0082}, {0x8ac3, 0x0007}, -{0x8ac4, 0x007e}, {0x8ac5, 0x008a}, {0x8ac6, 0x00b9}, -{0x8ac7, 0x007f}, {0x8ac8, 0x0082}, {0x8ac9, 0x0006}, -{0x8aca, 0x0039}, { 0x0, 0x0 } -}; -#endif - - -/* phy types */ -#define CAS_PHY_UNKNOWN 0x00 -#define CAS_PHY_SERDES 0x01 -#define CAS_PHY_MII_MDIO0 0x02 -#define CAS_PHY_MII_MDIO1 0x04 -#define CAS_PHY_MII(x) ((x) & (CAS_PHY_MII_MDIO0 | CAS_PHY_MII_MDIO1)) - -/* _RING_INDEX is the index for the ring sizes to be used. _RING_SIZE - * is the actual size. the default index for the various rings is - * 8. NOTE: there a bunch of alignment constraints for the rings. to - * deal with that, i just allocate rings to create the desired - * alignment. here are the constraints: - * RX DESC and COMP rings must be 8KB aligned - * TX DESC must be 2KB aligned. - * if you change the numbers, be cognizant of how the alignment will change - * in INIT_BLOCK as well. - */ - -#define DESC_RING_I_TO_S(x) (32*(1 << (x))) -#define COMP_RING_I_TO_S(x) (128*(1 << (x))) -#define TX_DESC_RING_INDEX 4 /* 512 = 8k */ -#define RX_DESC_RING_INDEX 4 /* 512 = 8k */ -#define RX_COMP_RING_INDEX 4 /* 2048 = 64k: should be 4x rx ring size */ - -#if (TX_DESC_RING_INDEX > 8) || (TX_DESC_RING_INDEX < 0) -#error TX_DESC_RING_INDEX must be between 0 and 8 -#endif - -#if (RX_DESC_RING_INDEX > 8) || (RX_DESC_RING_INDEX < 0) -#error RX_DESC_RING_INDEX must be between 0 and 8 -#endif - -#if (RX_COMP_RING_INDEX > 8) || (RX_COMP_RING_INDEX < 0) -#error RX_COMP_RING_INDEX must be between 0 and 8 -#endif - -#define N_TX_RINGS MAX_TX_RINGS /* for QoS */ -#define N_TX_RINGS_MASK MAX_TX_RINGS_MASK -#define N_RX_DESC_RINGS MAX_RX_DESC_RINGS /* 1 for ipsec */ -#define N_RX_COMP_RINGS 0x1 /* for mult. PCI interrupts */ - -/* number of flows that can go through re-assembly */ -#define N_RX_FLOWS 64 - -#define TX_DESC_RING_SIZE DESC_RING_I_TO_S(TX_DESC_RING_INDEX) -#define RX_DESC_RING_SIZE DESC_RING_I_TO_S(RX_DESC_RING_INDEX) -#define RX_COMP_RING_SIZE COMP_RING_I_TO_S(RX_COMP_RING_INDEX) -#define TX_DESC_RINGN_INDEX(x) TX_DESC_RING_INDEX -#define RX_DESC_RINGN_INDEX(x) RX_DESC_RING_INDEX -#define RX_COMP_RINGN_INDEX(x) RX_COMP_RING_INDEX -#define TX_DESC_RINGN_SIZE(x) TX_DESC_RING_SIZE -#define RX_DESC_RINGN_SIZE(x) RX_DESC_RING_SIZE -#define RX_COMP_RINGN_SIZE(x) RX_COMP_RING_SIZE - -/* convert values */ -#define CAS_BASE(x, y) (((y) << (x ## _SHIFT)) & (x ## _MASK)) -#define CAS_VAL(x, y) (((y) & (x ## _MASK)) >> (x ## _SHIFT)) -#define CAS_TX_RINGN_BASE(y) ((TX_DESC_RINGN_INDEX(y) << \ - TX_CFG_DESC_RINGN_SHIFT(y)) & \ - TX_CFG_DESC_RINGN_MASK(y)) - -/* min is 2k, but we can't do jumbo frames unless it's at least 8k */ -#define CAS_MIN_PAGE_SHIFT 11 /* 2048 */ -#define CAS_JUMBO_PAGE_SHIFT 13 /* 8192 */ -#define CAS_MAX_PAGE_SHIFT 14 /* 16384 */ - -#define TX_DESC_BUFLEN_MASK 0x0000000000003FFFULL /* buffer length in - bytes. 0 - 9256 */ -#define TX_DESC_BUFLEN_SHIFT 0 -#define TX_DESC_CSUM_START_MASK 0x00000000001F8000ULL /* checksum start. # - of bytes to be - skipped before - csum calc begins. - value must be - even */ -#define TX_DESC_CSUM_START_SHIFT 15 -#define TX_DESC_CSUM_STUFF_MASK 0x000000001FE00000ULL /* checksum stuff. - byte offset w/in - the pkt for the - 1st csum byte. - must be > 8 */ -#define TX_DESC_CSUM_STUFF_SHIFT 21 -#define TX_DESC_CSUM_EN 0x0000000020000000ULL /* enable checksum */ -#define TX_DESC_EOF 0x0000000040000000ULL /* end of frame */ -#define TX_DESC_SOF 0x0000000080000000ULL /* start of frame */ -#define TX_DESC_INTME 0x0000000100000000ULL /* interrupt me */ -#define TX_DESC_NO_CRC 0x0000000200000000ULL /* debugging only. - CRC will not be - inserted into - outgoing frame. */ -struct cas_tx_desc { - u64 control; - u64 buffer; -}; - -/* descriptor ring for free buffers contains page-sized buffers. the index - * value is not used by the hw in any way. it's just stored and returned in - * the completion ring. - */ -struct cas_rx_desc { - u64 index; - u64 buffer; -}; - -/* received packets are put on the completion ring. */ -/* word 1 */ -#define RX_COMP1_DATA_SIZE_MASK 0x0000000007FFE000ULL -#define RX_COMP1_DATA_SIZE_SHIFT 13 -#define RX_COMP1_DATA_OFF_MASK 0x000001FFF8000000ULL -#define RX_COMP1_DATA_OFF_SHIFT 27 -#define RX_COMP1_DATA_INDEX_MASK 0x007FFE0000000000ULL -#define RX_COMP1_DATA_INDEX_SHIFT 41 -#define RX_COMP1_SKIP_MASK 0x0180000000000000ULL -#define RX_COMP1_SKIP_SHIFT 55 -#define RX_COMP1_RELEASE_NEXT 0x0200000000000000ULL -#define RX_COMP1_SPLIT_PKT 0x0400000000000000ULL -#define RX_COMP1_RELEASE_FLOW 0x0800000000000000ULL -#define RX_COMP1_RELEASE_DATA 0x1000000000000000ULL -#define RX_COMP1_RELEASE_HDR 0x2000000000000000ULL -#define RX_COMP1_TYPE_MASK 0xC000000000000000ULL -#define RX_COMP1_TYPE_SHIFT 62 - -/* word 2 */ -#define RX_COMP2_NEXT_INDEX_MASK 0x00000007FFE00000ULL -#define RX_COMP2_NEXT_INDEX_SHIFT 21 -#define RX_COMP2_HDR_SIZE_MASK 0x00000FF800000000ULL -#define RX_COMP2_HDR_SIZE_SHIFT 35 -#define RX_COMP2_HDR_OFF_MASK 0x0003F00000000000ULL -#define RX_COMP2_HDR_OFF_SHIFT 44 -#define RX_COMP2_HDR_INDEX_MASK 0xFFFC000000000000ULL -#define RX_COMP2_HDR_INDEX_SHIFT 50 - -/* word 3 */ -#define RX_COMP3_SMALL_PKT 0x0000000000000001ULL -#define RX_COMP3_JUMBO_PKT 0x0000000000000002ULL -#define RX_COMP3_JUMBO_HDR_SPLIT_EN 0x0000000000000004ULL -#define RX_COMP3_CSUM_START_MASK 0x000000000007F000ULL -#define RX_COMP3_CSUM_START_SHIFT 12 -#define RX_COMP3_FLOWID_MASK 0x0000000001F80000ULL -#define RX_COMP3_FLOWID_SHIFT 19 -#define RX_COMP3_OPCODE_MASK 0x000000000E000000ULL -#define RX_COMP3_OPCODE_SHIFT 25 -#define RX_COMP3_FORCE_FLAG 0x0000000010000000ULL -#define RX_COMP3_NO_ASSIST 0x0000000020000000ULL -#define RX_COMP3_LOAD_BAL_MASK 0x000001F800000000ULL -#define RX_COMP3_LOAD_BAL_SHIFT 35 -#define RX_PLUS_COMP3_ENC_PKT 0x0000020000000000ULL /* cas+ */ -#define RX_COMP3_L3_HEAD_OFF_MASK 0x0000FE0000000000ULL /* cas */ -#define RX_COMP3_L3_HEAD_OFF_SHIFT 41 -#define RX_PLUS_COMP_L3_HEAD_OFF_MASK 0x0000FC0000000000ULL /* cas+ */ -#define RX_PLUS_COMP_L3_HEAD_OFF_SHIFT 42 -#define RX_COMP3_SAP_MASK 0xFFFF000000000000ULL -#define RX_COMP3_SAP_SHIFT 48 - -/* word 4 */ -#define RX_COMP4_TCP_CSUM_MASK 0x000000000000FFFFULL -#define RX_COMP4_TCP_CSUM_SHIFT 0 -#define RX_COMP4_PKT_LEN_MASK 0x000000003FFF0000ULL -#define RX_COMP4_PKT_LEN_SHIFT 16 -#define RX_COMP4_PERFECT_MATCH_MASK 0x00000003C0000000ULL -#define RX_COMP4_PERFECT_MATCH_SHIFT 30 -#define RX_COMP4_ZERO 0x0000080000000000ULL -#define RX_COMP4_HASH_VAL_MASK 0x0FFFF00000000000ULL -#define RX_COMP4_HASH_VAL_SHIFT 44 -#define RX_COMP4_HASH_PASS 0x1000000000000000ULL -#define RX_COMP4_BAD 0x4000000000000000ULL -#define RX_COMP4_LEN_MISMATCH 0x8000000000000000ULL - -/* we encode the following: ring/index/release. only 14 bits - * are usable. - * NOTE: the encoding is dependent upon RX_DESC_RING_SIZE and - * MAX_RX_DESC_RINGS. */ -#define RX_INDEX_NUM_MASK 0x0000000000000FFFULL -#define RX_INDEX_NUM_SHIFT 0 -#define RX_INDEX_RING_MASK 0x0000000000001000ULL -#define RX_INDEX_RING_SHIFT 12 -#define RX_INDEX_RELEASE 0x0000000000002000ULL - -struct cas_rx_comp { - u64 word1; - u64 word2; - u64 word3; - u64 word4; -}; - -enum link_state { - link_down = 0, /* No link, will retry */ - link_aneg, /* Autoneg in progress */ - link_force_try, /* Try Forced link speed */ - link_force_ret, /* Forced mode worked, retrying autoneg */ - link_force_ok, /* Stay in forced mode */ - link_up /* Link is up */ -}; - -typedef struct cas_page { - struct list_head list; - struct page *buffer; - dma_addr_t dma_addr; - int used; -} cas_page_t; - - -/* some alignment constraints: - * TX DESC, RX DESC, and RX COMP must each be 8K aligned. - * TX COMPWB must be 8-byte aligned. - * to accomplish this, here's what we do: - * - * INIT_BLOCK_RX_COMP = 64k (already aligned) - * INIT_BLOCK_RX_DESC = 8k - * INIT_BLOCK_TX = 8k - * INIT_BLOCK_RX1_DESC = 8k - * TX COMPWB - */ -#define INIT_BLOCK_TX (TX_DESC_RING_SIZE) -#define INIT_BLOCK_RX_DESC (RX_DESC_RING_SIZE) -#define INIT_BLOCK_RX_COMP (RX_COMP_RING_SIZE) - -struct cas_init_block { - struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP]; - struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC]; - struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX]; - u64 tx_compwb; -}; - -/* tiny buffers to deal with target abort issue. we allocate a bit - * over so that we don't have target abort issues with these buffers - * as well. - */ -#define TX_TINY_BUF_LEN 0x100 -#define TX_TINY_BUF_BLOCK ((INIT_BLOCK_TX + 1)*TX_TINY_BUF_LEN) - -struct cas_tiny_count { - int nbufs; - int used; -}; - -struct cas { - spinlock_t lock; /* for most bits */ - spinlock_t tx_lock[N_TX_RINGS]; /* tx bits */ - spinlock_t stat_lock[N_TX_RINGS + 1]; /* for stat gathering */ - spinlock_t rx_inuse_lock; /* rx inuse list */ - spinlock_t rx_spare_lock; /* rx spare list */ - - void __iomem *regs; - int tx_new[N_TX_RINGS], tx_old[N_TX_RINGS]; - int rx_old[N_RX_DESC_RINGS]; - int rx_cur[N_RX_COMP_RINGS], rx_new[N_RX_COMP_RINGS]; - int rx_last[N_RX_DESC_RINGS]; - - /* Set when chip is actually in operational state - * (ie. not power managed) */ - int hw_running; - int opened; - struct semaphore pm_sem; /* open/close/suspend/resume */ - - struct cas_init_block *init_block; - struct cas_tx_desc *init_txds[MAX_TX_RINGS]; - struct cas_rx_desc *init_rxds[MAX_RX_DESC_RINGS]; - struct cas_rx_comp *init_rxcs[MAX_RX_COMP_RINGS]; - - /* we use sk_buffs for tx and pages for rx. the rx skbuffs - * are there for flow re-assembly. */ - struct sk_buff *tx_skbs[N_TX_RINGS][TX_DESC_RING_SIZE]; - struct sk_buff_head rx_flows[N_RX_FLOWS]; - cas_page_t *rx_pages[N_RX_DESC_RINGS][RX_DESC_RING_SIZE]; - struct list_head rx_spare_list, rx_inuse_list; - int rx_spares_needed; - - /* for small packets when copying would be quicker than - mapping */ - struct cas_tiny_count tx_tiny_use[N_TX_RINGS][TX_DESC_RING_SIZE]; - u8 *tx_tiny_bufs[N_TX_RINGS]; - - u32 msg_enable; - - /* N_TX_RINGS must be >= N_RX_DESC_RINGS */ - struct net_device_stats net_stats[N_TX_RINGS + 1]; - - u32 pci_cfg[64 >> 2]; - u8 pci_revision; - - int phy_type; - int phy_addr; - u32 phy_id; -#define CAS_FLAG_1000MB_CAP 0x00000001 -#define CAS_FLAG_REG_PLUS 0x00000002 -#define CAS_FLAG_TARGET_ABORT 0x00000004 -#define CAS_FLAG_SATURN 0x00000008 -#define CAS_FLAG_RXD_POST_MASK 0x000000F0 -#define CAS_FLAG_RXD_POST_SHIFT 4 -#define CAS_FLAG_RXD_POST(x) ((1 << (CAS_FLAG_RXD_POST_SHIFT + (x))) & \ - CAS_FLAG_RXD_POST_MASK) -#define CAS_FLAG_ENTROPY_DEV 0x00000100 -#define CAS_FLAG_NO_HW_CSUM 0x00000200 - u32 cas_flags; - int packet_min; /* minimum packet size */ - int tx_fifo_size; - int rx_fifo_size; - int rx_pause_off; - int rx_pause_on; - int crc_size; /* 4 if half-duplex */ - - int pci_irq_INTC; - int min_frame_size; /* for tx fifo workaround */ - - /* page size allocation */ - int page_size; - int page_order; - int mtu_stride; - - u32 mac_rx_cfg; - - /* Autoneg & PHY control */ - int link_cntl; - int link_fcntl; - enum link_state lstate; - struct timer_list link_timer; - int timer_ticks; - struct work_struct reset_task; -#if 0 - atomic_t reset_task_pending; -#else - atomic_t reset_task_pending; - atomic_t reset_task_pending_mtu; - atomic_t reset_task_pending_spare; - atomic_t reset_task_pending_all; -#endif - -#ifdef CONFIG_CASSINI_QGE_DEBUG - atomic_t interrupt_seen; /* 1 if any interrupts are getting through */ -#endif - - /* Link-down problem workaround */ -#define LINK_TRANSITION_UNKNOWN 0 -#define LINK_TRANSITION_ON_FAILURE 1 -#define LINK_TRANSITION_STILL_FAILED 2 -#define LINK_TRANSITION_LINK_UP 3 -#define LINK_TRANSITION_LINK_CONFIG 4 -#define LINK_TRANSITION_LINK_DOWN 5 -#define LINK_TRANSITION_REQUESTED_RESET 6 - int link_transition; - int link_transition_jiffies_valid; - unsigned long link_transition_jiffies; - - /* Tuning */ - u8 orig_cacheline_size; /* value when loaded */ -#define CAS_PREF_CACHELINE_SIZE 0x20 /* Minimum desired */ - - /* Diagnostic counters and state. */ - int casreg_len; /* reg-space size for dumping */ - u64 pause_entered; - u16 pause_last_time_recvd; - - dma_addr_t block_dvma, tx_tiny_dvma[N_TX_RINGS]; - struct pci_dev *pdev; - struct net_device *dev; -}; - -#define TX_DESC_NEXT(r, x) (((x) + 1) & (TX_DESC_RINGN_SIZE(r) - 1)) -#define RX_DESC_ENTRY(r, x) ((x) & (RX_DESC_RINGN_SIZE(r) - 1)) -#define RX_COMP_ENTRY(r, x) ((x) & (RX_COMP_RINGN_SIZE(r) - 1)) - -#define TX_BUFF_COUNT(r, x, y) ((x) <= (y) ? ((y) - (x)) : \ - (TX_DESC_RINGN_SIZE(r) - (x) + (y))) - -#define TX_BUFFS_AVAIL(cp, i) ((cp)->tx_old[(i)] <= (cp)->tx_new[(i)] ? \ - (cp)->tx_old[(i)] + (TX_DESC_RINGN_SIZE(i) - 1) - (cp)->tx_new[(i)] : \ - (cp)->tx_old[(i)] - (cp)->tx_new[(i)] - 1) - -#define CAS_ALIGN(addr, align) \ - (((unsigned long) (addr) + ((align) - 1UL)) & ~((align) - 1)) - -#define RX_FIFO_SIZE 16384 -#define EXPANSION_ROM_SIZE 65536 - -#define CAS_MC_EXACT_MATCH_SIZE 15 -#define CAS_MC_HASH_SIZE 256 -#define CAS_MC_HASH_MAX (CAS_MC_EXACT_MATCH_SIZE + \ - CAS_MC_HASH_SIZE) - -#define TX_TARGET_ABORT_LEN 0x20 -#define RX_SWIVEL_OFF_VAL 0x2 -#define RX_AE_FREEN_VAL(x) (RX_DESC_RINGN_SIZE(x) >> 1) -#define RX_AE_COMP_VAL (RX_COMP_RING_SIZE >> 1) -#define RX_BLANK_INTR_PKT_VAL 0x05 -#define RX_BLANK_INTR_TIME_VAL 0x0F -#define HP_TCP_THRESH_VAL 1530 /* reduce to enable reassembly */ - -#define RX_SPARE_COUNT (RX_DESC_RING_SIZE >> 1) -#define RX_SPARE_RECOVER_VAL (RX_SPARE_COUNT >> 2) - -#endif /* _CASSINI_H */ diff --git a/trunk/drivers/net/cs89x0.c b/trunk/drivers/net/cs89x0.c index a6078ad9b654..cdc07ccd7332 100644 --- a/trunk/drivers/net/cs89x0.c +++ b/trunk/drivers/net/cs89x0.c @@ -140,7 +140,6 @@ #include #include -#include #if ALLOW_DMA #include #endif diff --git a/trunk/drivers/net/e100.c b/trunk/drivers/net/e100.c index 40887f09b681..fbf1c06ec5c1 100644 --- a/trunk/drivers/net/e100.c +++ b/trunk/drivers/net/e100.c @@ -903,8 +903,8 @@ static void mdio_write(struct net_device *netdev, int addr, int reg, int data) static void e100_get_defaults(struct nic *nic) { - struct param_range rfds = { .min = 16, .max = 256, .count = 64 }; - struct param_range cbs = { .min = 64, .max = 256, .count = 64 }; + struct param_range rfds = { .min = 16, .max = 256, .count = 256 }; + struct param_range cbs = { .min = 64, .max = 256, .count = 128 }; pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id); /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ @@ -1007,25 +1007,213 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); } +/********************************************************/ +/* Micro code for 8086:1229 Rev 8 */ +/********************************************************/ + +/* Parameter values for the D101M B-step */ +#define D101M_CPUSAVER_TIMER_DWORD 78 +#define D101M_CPUSAVER_BUNDLE_DWORD 65 +#define D101M_CPUSAVER_MIN_SIZE_DWORD 126 + +#define D101M_B_RCVBUNDLE_UCODE \ +{\ +0x00550215, 0xFFFF0437, 0xFFFFFFFF, 0x06A70789, 0xFFFFFFFF, 0x0558FFFF, \ +0x000C0001, 0x00101312, 0x000C0008, 0x00380216, \ +0x0010009C, 0x00204056, 0x002380CC, 0x00380056, \ +0x0010009C, 0x00244C0B, 0x00000800, 0x00124818, \ +0x00380438, 0x00000000, 0x00140000, 0x00380555, \ +0x00308000, 0x00100662, 0x00100561, 0x000E0408, \ +0x00134861, 0x000C0002, 0x00103093, 0x00308000, \ +0x00100624, 0x00100561, 0x000E0408, 0x00100861, \ +0x000C007E, 0x00222C21, 0x000C0002, 0x00103093, \ +0x00380C7A, 0x00080000, 0x00103090, 0x00380C7A, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x0010009C, 0x00244C2D, 0x00010004, 0x00041000, \ +0x003A0437, 0x00044010, 0x0038078A, 0x00000000, \ +0x00100099, 0x00206C7A, 0x0010009C, 0x00244C48, \ +0x00130824, 0x000C0001, 0x00101213, 0x00260C75, \ +0x00041000, 0x00010004, 0x00130826, 0x000C0006, \ +0x002206A8, 0x0013C926, 0x00101313, 0x003806A8, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00080600, 0x00101B10, 0x00050004, 0x00100826, \ +0x00101210, 0x00380C34, 0x00000000, 0x00000000, \ +0x0021155B, 0x00100099, 0x00206559, 0x0010009C, \ +0x00244559, 0x00130836, 0x000C0000, 0x00220C62, \ +0x000C0001, 0x00101B13, 0x00229C0E, 0x00210C0E, \ +0x00226C0E, 0x00216C0E, 0x0022FC0E, 0x00215C0E, \ +0x00214C0E, 0x00380555, 0x00010004, 0x00041000, \ +0x00278C67, 0x00040800, 0x00018100, 0x003A0437, \ +0x00130826, 0x000C0001, 0x00220559, 0x00101313, \ +0x00380559, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00130831, 0x0010090B, 0x00124813, \ +0x000CFF80, 0x002606AB, 0x00041000, 0x00010004, \ +0x003806A8, 0x00000000, 0x00000000, 0x00000000, \ +} + +/********************************************************/ +/* Micro code for 8086:1229 Rev 9 */ +/********************************************************/ + +/* Parameter values for the D101S */ +#define D101S_CPUSAVER_TIMER_DWORD 78 +#define D101S_CPUSAVER_BUNDLE_DWORD 67 +#define D101S_CPUSAVER_MIN_SIZE_DWORD 128 + +#define D101S_RCVBUNDLE_UCODE \ +{\ +0x00550242, 0xFFFF047E, 0xFFFFFFFF, 0x06FF0818, 0xFFFFFFFF, 0x05A6FFFF, \ +0x000C0001, 0x00101312, 0x000C0008, 0x00380243, \ +0x0010009C, 0x00204056, 0x002380D0, 0x00380056, \ +0x0010009C, 0x00244F8B, 0x00000800, 0x00124818, \ +0x0038047F, 0x00000000, 0x00140000, 0x003805A3, \ +0x00308000, 0x00100610, 0x00100561, 0x000E0408, \ +0x00134861, 0x000C0002, 0x00103093, 0x00308000, \ +0x00100624, 0x00100561, 0x000E0408, 0x00100861, \ +0x000C007E, 0x00222FA1, 0x000C0002, 0x00103093, \ +0x00380F90, 0x00080000, 0x00103090, 0x00380F90, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x0010009C, 0x00244FAD, 0x00010004, 0x00041000, \ +0x003A047E, 0x00044010, 0x00380819, 0x00000000, \ +0x00100099, 0x00206FFD, 0x0010009A, 0x0020AFFD, \ +0x0010009C, 0x00244FC8, 0x00130824, 0x000C0001, \ +0x00101213, 0x00260FF7, 0x00041000, 0x00010004, \ +0x00130826, 0x000C0006, 0x00220700, 0x0013C926, \ +0x00101313, 0x00380700, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00080600, 0x00101B10, 0x00050004, 0x00100826, \ +0x00101210, 0x00380FB6, 0x00000000, 0x00000000, \ +0x002115A9, 0x00100099, 0x002065A7, 0x0010009A, \ +0x0020A5A7, 0x0010009C, 0x002445A7, 0x00130836, \ +0x000C0000, 0x00220FE4, 0x000C0001, 0x00101B13, \ +0x00229F8E, 0x00210F8E, 0x00226F8E, 0x00216F8E, \ +0x0022FF8E, 0x00215F8E, 0x00214F8E, 0x003805A3, \ +0x00010004, 0x00041000, 0x00278FE9, 0x00040800, \ +0x00018100, 0x003A047E, 0x00130826, 0x000C0001, \ +0x002205A7, 0x00101313, 0x003805A7, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00130831, \ +0x0010090B, 0x00124813, 0x000CFF80, 0x00260703, \ +0x00041000, 0x00010004, 0x00380700 \ +} + +/********************************************************/ +/* Micro code for the 8086:1229 Rev F/10 */ +/********************************************************/ + +/* Parameter values for the D102 E-step */ +#define D102_E_CPUSAVER_TIMER_DWORD 42 +#define D102_E_CPUSAVER_BUNDLE_DWORD 54 +#define D102_E_CPUSAVER_MIN_SIZE_DWORD 46 + +#define D102_E_RCVBUNDLE_UCODE \ +{\ +0x007D028F, 0x0E4204F9, 0x14ED0C85, 0x14FA14E9, 0x0EF70E36, 0x1FFF1FFF, \ +0x00E014B9, 0x00000000, 0x00000000, 0x00000000, \ +0x00E014BD, 0x00000000, 0x00000000, 0x00000000, \ +0x00E014D5, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00E014C1, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00E014C8, 0x00000000, 0x00000000, 0x00000000, \ +0x00200600, 0x00E014EE, 0x00000000, 0x00000000, \ +0x0030FF80, 0x00940E46, 0x00038200, 0x00102000, \ +0x00E00E43, 0x00000000, 0x00000000, 0x00000000, \ +0x00300006, 0x00E014FB, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, \ +0x00906EFD, 0x00900EFD, 0x00E00EF8, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +} + static void e100_load_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb) { - int i; - static const u32 ucode[UCODE_SIZE] = { - /* NFS packets are misinterpreted as TCO packets and - * incorrectly routed to the BMC over SMBus. This - * microcode patch checks the fragmented IP bit in the - * NFS/UDP header to distinguish between NFS and TCO. */ - 0x0EF70E36, 0x1FFF1FFF, 0x1FFF1FFF, 0x1FFF1FFF, 0x1FFF1FFF, - 0x1FFF1FFF, 0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, - 0x00906EFD, 0x00900EFD, 0x00E00EF8, - }; +/* *INDENT-OFF* */ + static struct { + u32 ucode[UCODE_SIZE + 1]; + u8 mac; + u8 timer_dword; + u8 bundle_dword; + u8 min_size_dword; + } ucode_opts[] = { + { D101M_B_RCVBUNDLE_UCODE, + mac_82559_D101M, + D101M_CPUSAVER_TIMER_DWORD, + D101M_CPUSAVER_BUNDLE_DWORD, + D101M_CPUSAVER_MIN_SIZE_DWORD }, + { D101S_RCVBUNDLE_UCODE, + mac_82559_D101S, + D101S_CPUSAVER_TIMER_DWORD, + D101S_CPUSAVER_BUNDLE_DWORD, + D101S_CPUSAVER_MIN_SIZE_DWORD }, + { D102_E_RCVBUNDLE_UCODE, + mac_82551_F, + D102_E_CPUSAVER_TIMER_DWORD, + D102_E_CPUSAVER_BUNDLE_DWORD, + D102_E_CPUSAVER_MIN_SIZE_DWORD }, + { D102_E_RCVBUNDLE_UCODE, + mac_82551_10, + D102_E_CPUSAVER_TIMER_DWORD, + D102_E_CPUSAVER_BUNDLE_DWORD, + D102_E_CPUSAVER_MIN_SIZE_DWORD }, + { {0}, 0, 0, 0, 0} + }, *opts; +/* *INDENT-ON* */ + +#define BUNDLESMALL 1 +#define BUNDLEMAX 50 +#define INTDELAY 15000 + + opts = ucode_opts; + + /* do not load u-code for ICH devices */ + if (nic->flags & ich) + return; + + /* Search for ucode match against h/w rev_id */ + while (opts->mac) { + if (nic->mac == opts->mac) { + int i; + u32 *ucode = opts->ucode; + + /* Insert user-tunable settings */ + ucode[opts->timer_dword] &= 0xFFFF0000; + ucode[opts->timer_dword] |= + (u16) INTDELAY; + ucode[opts->bundle_dword] &= 0xFFFF0000; + ucode[opts->bundle_dword] |= (u16) BUNDLEMAX; + ucode[opts->min_size_dword] &= 0xFFFF0000; + ucode[opts->min_size_dword] |= + (BUNDLESMALL) ? 0xFFFF : 0xFF80; + + for(i = 0; i < UCODE_SIZE; i++) + cb->u.ucode[i] = cpu_to_le32(ucode[i]); + cb->command = cpu_to_le16(cb_ucode); + return; + } + opts++; + } - if(nic->mac == mac_82551_F || nic->mac == mac_82551_10) { - for(i = 0; i < UCODE_SIZE; i++) - cb->u.ucode[i] = cpu_to_le32(ucode[i]); - cb->command = cpu_to_le16(cb_ucode); - } else - cb->command = cpu_to_le16(cb_nop); + cb->command = cpu_to_le16(cb_nop); } static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, diff --git a/trunk/drivers/net/ibm_emac/ibm_emac_core.c b/trunk/drivers/net/ibm_emac/ibm_emac_core.c index 14e9b6315f20..0de3bb906174 100644 --- a/trunk/drivers/net/ibm_emac/ibm_emac_core.c +++ b/trunk/drivers/net/ibm_emac/ibm_emac_core.c @@ -1875,9 +1875,6 @@ static int emac_init_device(struct ocp_device *ocpdev, struct ibm_ocp_mal *mal) rc = -ENODEV; goto bail; } - - /* Disable any PHY features not supported by the platform */ - ep->phy_mii.def->features &= ~emacdata->phy_feat_exc; /* Setup initial PHY config & startup aneg */ if (ep->phy_mii.def->ops->init) @@ -1885,34 +1882,6 @@ static int emac_init_device(struct ocp_device *ocpdev, struct ibm_ocp_mal *mal) netif_carrier_off(ndev); if (ep->phy_mii.def->features & SUPPORTED_Autoneg) ep->want_autoneg = 1; - else { - ep->want_autoneg = 0; - - /* Select highest supported speed/duplex */ - if (ep->phy_mii.def->features & SUPPORTED_1000baseT_Full) { - ep->phy_mii.speed = SPEED_1000; - ep->phy_mii.duplex = DUPLEX_FULL; - } else if (ep->phy_mii.def->features & - SUPPORTED_1000baseT_Half) { - ep->phy_mii.speed = SPEED_1000; - ep->phy_mii.duplex = DUPLEX_HALF; - } else if (ep->phy_mii.def->features & - SUPPORTED_100baseT_Full) { - ep->phy_mii.speed = SPEED_100; - ep->phy_mii.duplex = DUPLEX_FULL; - } else if (ep->phy_mii.def->features & - SUPPORTED_100baseT_Half) { - ep->phy_mii.speed = SPEED_100; - ep->phy_mii.duplex = DUPLEX_HALF; - } else if (ep->phy_mii.def->features & - SUPPORTED_10baseT_Full) { - ep->phy_mii.speed = SPEED_10; - ep->phy_mii.duplex = DUPLEX_FULL; - } else { - ep->phy_mii.speed = SPEED_10; - ep->phy_mii.duplex = DUPLEX_HALF; - } - } emac_start_link(ep, NULL); /* read the MAC Address */ diff --git a/trunk/drivers/net/ibmveth.c b/trunk/drivers/net/ibmveth.c index a2c4dd4fb221..32d5fabd4b10 100644 --- a/trunk/drivers/net/ibmveth.c +++ b/trunk/drivers/net/ibmveth.c @@ -99,7 +99,7 @@ static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance, struct pt_regs static inline void ibmveth_schedule_replenishing(struct ibmveth_adapter*); #ifdef CONFIG_PROC_FS -#define IBMVETH_PROC_DIR "net/ibmveth" +#define IBMVETH_PROC_DIR "ibmveth" static struct proc_dir_entry *ibmveth_proc_dir; #endif @@ -1010,7 +1010,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev) #ifdef CONFIG_PROC_FS static void ibmveth_proc_register_driver(void) { - ibmveth_proc_dir = proc_mkdir(IBMVETH_PROC_DIR, NULL); + ibmveth_proc_dir = create_proc_entry(IBMVETH_PROC_DIR, S_IFDIR, proc_net); if (ibmveth_proc_dir) { SET_MODULE_OWNER(ibmveth_proc_dir); } @@ -1018,7 +1018,7 @@ static void ibmveth_proc_register_driver(void) static void ibmveth_proc_unregister_driver(void) { - remove_proc_entry(IBMVETH_PROC_DIR, NULL); + remove_proc_entry(IBMVETH_PROC_DIR, proc_net); } static void *ibmveth_seq_start(struct seq_file *seq, loff_t *pos) diff --git a/trunk/drivers/net/irda/vlsi_ir.c b/trunk/drivers/net/irda/vlsi_ir.c index 651c5a6578fd..6d9de626c967 100644 --- a/trunk/drivers/net/irda/vlsi_ir.c +++ b/trunk/drivers/net/irda/vlsi_ir.c @@ -1875,11 +1875,11 @@ static int __init vlsi_mod_init(void) sirpulse = !!sirpulse; - /* proc_mkdir returns NULL if !CONFIG_PROC_FS. + /* create_proc_entry returns NULL if !CONFIG_PROC_FS. * Failure to create the procfs entry is handled like running * without procfs - it's not required for the driver to work. */ - vlsi_proc_root = proc_mkdir(PROC_DIR, NULL); + vlsi_proc_root = create_proc_entry(PROC_DIR, S_IFDIR, NULL); if (vlsi_proc_root) { /* protect registered procdir against module removal. * Because we are in the module init path there's no race diff --git a/trunk/drivers/net/ns83820.c b/trunk/drivers/net/ns83820.c index e4811b42a6b7..e64df4d0800b 100644 --- a/trunk/drivers/net/ns83820.c +++ b/trunk/drivers/net/ns83820.c @@ -584,7 +584,7 @@ static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb) return 0; } -static inline int rx_refill(struct net_device *ndev, gfp_t gfp) +static inline int rx_refill(struct net_device *ndev, int gfp) { struct ns83820 *dev = PRIV(ndev); unsigned i; diff --git a/trunk/drivers/net/pcmcia/smc91c92_cs.c b/trunk/drivers/net/pcmcia/smc91c92_cs.c index c7cca842e5ee..d652e1eddb45 100644 --- a/trunk/drivers/net/pcmcia/smc91c92_cs.c +++ b/trunk/drivers/net/pcmcia/smc91c92_cs.c @@ -1832,7 +1832,7 @@ static void fill_multicast_tbl(int count, struct dev_mc_list *addrs, { struct dev_mc_list *mc_addr; - for (mc_addr = addrs; mc_addr && count-- > 0; mc_addr = mc_addr->next) { + for (mc_addr = addrs; mc_addr && --count > 0; mc_addr = mc_addr->next) { u_int position = ether_crc(6, mc_addr->dmi_addr); #ifndef final_version /* Verify multicast address. */ if ((mc_addr->dmi_addr[0] & 1) == 0) diff --git a/trunk/drivers/net/pppoe.c b/trunk/drivers/net/pppoe.c index a842ecc60a34..82f236cc3b9b 100644 --- a/trunk/drivers/net/pppoe.c +++ b/trunk/drivers/net/pppoe.c @@ -1070,7 +1070,7 @@ static int __init pppoe_proc_init(void) { struct proc_dir_entry *p; - p = create_proc_entry("net/pppoe", S_IRUGO, NULL); + p = create_proc_entry("pppoe", S_IRUGO, proc_net); if (!p) return -ENOMEM; @@ -1142,7 +1142,7 @@ static void __exit pppoe_exit(void) dev_remove_pack(&pppoes_ptype); dev_remove_pack(&pppoed_ptype); unregister_netdevice_notifier(&pppoe_notifier); - remove_proc_entry("net/pppoe", NULL); + remove_proc_entry("pppoe", proc_net); proto_unregister(&pppoe_sk_proto); } diff --git a/trunk/drivers/net/r8169.c b/trunk/drivers/net/r8169.c index afb3f186b884..f9223c1c5aa4 100644 --- a/trunk/drivers/net/r8169.c +++ b/trunk/drivers/net/r8169.c @@ -92,7 +92,8 @@ VERSION 2.2LK <2005/01/25> #endif /* RTL8169_DEBUG */ #define R8169_MSG_DEFAULT \ - (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) + (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK | NETIF_MSG_IFUP | \ + NETIF_MSG_IFDOWN) #define TX_BUFFS_AVAIL(tp) \ (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1) diff --git a/trunk/drivers/net/sk98lin/skge.c b/trunk/drivers/net/sk98lin/skge.c index b18c92cb629e..2e72d79a143c 100644 --- a/trunk/drivers/net/sk98lin/skge.c +++ b/trunk/drivers/net/sk98lin/skge.c @@ -235,7 +235,7 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr); * Extern Function Prototypes * ******************************************************************************/ -static const char SKRootName[] = "net/sk98lin"; +static const char SKRootName[] = "sk98lin"; static struct proc_dir_entry *pSkRootDir; extern struct file_operations sk_proc_fops; @@ -5242,20 +5242,20 @@ static int __init skge_init(void) { int error; - pSkRootDir = proc_mkdir(SKRootName, NULL); + pSkRootDir = proc_mkdir(SKRootName, proc_net); if (pSkRootDir) pSkRootDir->owner = THIS_MODULE; error = pci_register_driver(&skge_driver); if (error) - remove_proc_entry(SKRootName, NULL); + proc_net_remove(SKRootName); return error; } static void __exit skge_exit(void) { pci_unregister_driver(&skge_driver); - remove_proc_entry(SKRootName, NULL); + proc_net_remove(SKRootName); } diff --git a/trunk/drivers/net/skge.c b/trunk/drivers/net/skge.c index c2e6484ef138..ae1996a3bc5c 100644 --- a/trunk/drivers/net/skge.c +++ b/trunk/drivers/net/skge.c @@ -1643,22 +1643,6 @@ static void yukon_reset(struct skge_hw *hw, int port) | GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); } -/* Apparently, early versions of Yukon-Lite had wrong chip_id? */ -static int is_yukon_lite_a0(struct skge_hw *hw) -{ - u32 reg; - int ret; - - if (hw->chip_id != CHIP_ID_YUKON) - return 0; - - reg = skge_read32(hw, B2_FAR); - skge_write8(hw, B2_FAR + 3, 0xff); - ret = (skge_read8(hw, B2_FAR + 3) != 0); - skge_write32(hw, B2_FAR, reg); - return ret; -} - static void yukon_mac_init(struct skge_hw *hw, int port) { struct skge_port *skge = netdev_priv(hw->dev[port]); @@ -1774,11 +1758,9 @@ static void yukon_mac_init(struct skge_hw *hw, int port) /* Configure Rx MAC FIFO */ skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); reg = GMF_OPER_ON | GMF_RX_F_FL_ON; - - /* disable Rx GMAC FIFO Flush for YUKON-Lite Rev. A0 only */ - if (is_yukon_lite_a0(hw)) + if (hw->chip_id == CHIP_ID_YUKON_LITE && + hw->chip_rev >= CHIP_REV_YU_LITE_A3) reg &= ~GMF_RX_F_FL_ON; - skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg); /* @@ -2837,29 +2819,21 @@ static void skge_netpoll(struct net_device *dev) static int skge_set_mac_address(struct net_device *dev, void *p) { struct skge_port *skge = netdev_priv(dev); - struct skge_hw *hw = skge->hw; - unsigned port = skge->port; - const struct sockaddr *addr = p; + struct sockaddr *addr = p; + int err = 0; if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; - spin_lock_bh(&hw->phy_lock); + skge_down(dev); memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); - memcpy_toio(hw->regs + B2_MAC_1 + port*8, + memcpy_toio(skge->hw->regs + B2_MAC_1 + skge->port*8, dev->dev_addr, ETH_ALEN); - memcpy_toio(hw->regs + B2_MAC_2 + port*8, + memcpy_toio(skge->hw->regs + B2_MAC_2 + skge->port*8, dev->dev_addr, ETH_ALEN); - - if (hw->chip_id == CHIP_ID_GENESIS) - xm_outaddr(hw, port, XM_SA, dev->dev_addr); - else { - gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr); - gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr); - } - spin_unlock_bh(&hw->phy_lock); - - return 0; + if (dev->flags & IFF_UP) + err = skge_up(dev); + return err; } static const struct { diff --git a/trunk/drivers/net/starfire.c b/trunk/drivers/net/starfire.c index efdb179ecc8c..88b89dc95c77 100644 --- a/trunk/drivers/net/starfire.c +++ b/trunk/drivers/net/starfire.c @@ -133,18 +133,14 @@ - finally added firmware (GPL'ed by Adaptec) - removed compatibility code for 2.2.x - LK1.4.2.1 (Ion Badulescu) - - fixed 32/64 bit issues on i386 + CONFIG_HIGHMEM - - added 32-bit padding to outgoing skb's, removed previous workaround - TODO: - fix forced speed/duplexing code (broken a long time ago, when somebody converted the driver to use the generic MII code) - fix VLAN support */ #define DRV_NAME "starfire" -#define DRV_VERSION "1.03+LK1.4.2.1" -#define DRV_RELDATE "October 3, 2005" +#define DRV_VERSION "1.03+LK1.4.2" +#define DRV_RELDATE "January 19, 2005" #include #include @@ -169,14 +165,6 @@ TODO: - fix forced speed/duplexing code (broken a long time ago, when * of length 1. If and when this is fixed, the #define below can be removed. */ #define HAS_BROKEN_FIRMWARE - -/* - * If using the broken firmware, data must be padded to the next 32-bit boundary. - */ -#ifdef HAS_BROKEN_FIRMWARE -#define PADDING_MASK 3 -#endif - /* * Define this if using the driver with the zero-copy patch */ @@ -269,10 +257,9 @@ static int full_duplex[MAX_UNITS] = {0, }; * This SUCKS. * We need a much better method to determine if dma_addr_t is 64-bit. */ -#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__mips64__) || (defined(__mips__) && defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) +#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)) /* 64-bit dma_addr_t */ #define ADDR_64BITS /* This chip uses 64 bit addresses. */ -#define netdrv_addr_t u64 #define cpu_to_dma(x) cpu_to_le64(x) #define dma_to_cpu(x) le64_to_cpu(x) #define RX_DESC_Q_ADDR_SIZE RxDescQAddr64bit @@ -281,7 +268,6 @@ static int full_duplex[MAX_UNITS] = {0, }; #define TX_COMPL_Q_ADDR_SIZE TxComplQAddr64bit #define RX_DESC_ADDR_SIZE RxDescAddr64bit #else /* 32-bit dma_addr_t */ -#define netdrv_addr_t u32 #define cpu_to_dma(x) cpu_to_le32(x) #define dma_to_cpu(x) le32_to_cpu(x) #define RX_DESC_Q_ADDR_SIZE RxDescQAddr32bit @@ -1347,10 +1333,21 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev) } #if defined(ZEROCOPY) && defined(HAS_BROKEN_FIRMWARE) - if (skb->ip_summed == CHECKSUM_HW) { - skb = skb_padto(skb, (skb->len + PADDING_MASK) & ~PADDING_MASK); - if (skb == NULL) - return NETDEV_TX_OK; + { + int has_bad_length = 0; + + if (skb_first_frag_len(skb) == 1) + has_bad_length = 1; + else { + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) + if (skb_shinfo(skb)->frags[i].size == 1) { + has_bad_length = 1; + break; + } + } + + if (has_bad_length) + skb_checksum_help(skb, 0); } #endif /* ZEROCOPY && HAS_BROKEN_FIRMWARE */ @@ -2130,12 +2127,13 @@ static int __init starfire_init (void) #endif #endif +#ifndef ADDR_64BITS /* we can do this test only at run-time... sigh */ - if (sizeof(dma_addr_t) != sizeof(netdrv_addr_t)) { - printk("This driver has dma_addr_t issues, please send email to maintainer\n"); + if (sizeof(dma_addr_t) == sizeof(u64)) { + printk("This driver has not been ported to this 64-bit architecture yet\n"); return -ENODEV; } - +#endif /* not ADDR_64BITS */ return pci_module_init (&starfire_driver); } diff --git a/trunk/drivers/net/sungem.h b/trunk/drivers/net/sungem.h index 13006d759ad8..ff8ae5f79970 100644 --- a/trunk/drivers/net/sungem.h +++ b/trunk/drivers/net/sungem.h @@ -1035,8 +1035,7 @@ struct gem { #define ALIGNED_RX_SKB_ADDR(addr) \ ((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr)) -static __inline__ struct sk_buff *gem_alloc_skb(int size, - gfp_t gfp_flags) +static __inline__ struct sk_buff *gem_alloc_skb(int size, int gfp_flags) { struct sk_buff *skb = alloc_skb(size + 64, gfp_flags); diff --git a/trunk/drivers/net/tg3.c b/trunk/drivers/net/tg3.c index 1802c3b48799..81f4aedf534c 100644 --- a/trunk/drivers/net/tg3.c +++ b/trunk/drivers/net/tg3.c @@ -67,8 +67,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.42" -#define DRV_MODULE_RELDATE "Oct 3, 2005" +#define DRV_MODULE_VERSION "3.40" +#define DRV_MODULE_RELDATE "September 15, 2005" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 @@ -3389,8 +3389,7 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id, struct tg3 *tp = netdev_priv(dev); struct tg3_hw_status *sblk = tp->hw_status; - if ((sblk->status & SD_STATUS_UPDATED) || - !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { + if (sblk->status & SD_STATUS_UPDATED) { tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); return IRQ_RETVAL(1); @@ -5396,9 +5395,6 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p) struct tg3 *tp = netdev_priv(dev); struct sockaddr *addr = p; - if (!is_valid_ether_addr(addr->sa_data)) - return -EINVAL; - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); spin_lock_bh(&tp->lock); @@ -5810,13 +5806,6 @@ static int tg3_reset_hw(struct tg3 *tp) } memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE); - if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { - tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; - /* reset to prevent losing 1st rx packet intermittently */ - tw32_f(MAC_RX_MODE, RX_MODE_RESET); - udelay(10); - } - tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; tw32_f(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR); @@ -5948,7 +5937,7 @@ static int tg3_reset_hw(struct tg3 *tp) tw32(MAC_LED_CTRL, tp->led_ctrl); tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB); - if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { + if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) { tw32_f(MAC_RX_MODE, RX_MODE_RESET); udelay(10); } @@ -7371,17 +7360,12 @@ static int tg3_nway_reset(struct net_device *dev) if (!netif_running(dev)) return -EAGAIN; - if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) - return -EINVAL; - spin_lock_bh(&tp->lock); r = -EINVAL; tg3_readphy(tp, MII_BMCR, &bmcr); if (!tg3_readphy(tp, MII_BMCR, &bmcr) && - ((bmcr & BMCR_ANENABLE) || - (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT))) { - tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART | - BMCR_ANENABLE); + (bmcr & BMCR_ANENABLE)) { + tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART); r = 0; } spin_unlock_bh(&tp->lock); @@ -7943,32 +7927,19 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) struct tg3_rx_buffer_desc *desc; if (loopback_mode == TG3_MAC_LOOPBACK) { - /* HW errata - mac loopback fails in some cases on 5780. - * Normal traffic and PHY loopback are not affected by - * errata. - */ - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) - return 0; - mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY | MAC_MODE_PORT_MODE_GMII; tw32(MAC_MODE, mac_mode); } else if (loopback_mode == TG3_PHY_LOOPBACK) { - tg3_writephy(tp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX | - BMCR_SPEED1000); - udelay(40); - /* reset to prevent losing 1st rx packet intermittently */ - if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { - tw32_f(MAC_RX_MODE, RX_MODE_RESET); - udelay(10); - tw32_f(MAC_RX_MODE, tp->rx_mode); - } mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | MAC_MODE_LINK_POLARITY | MAC_MODE_PORT_MODE_GMII; if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) mac_mode &= ~MAC_MODE_LINK_POLARITY; tw32(MAC_MODE, mac_mode); + + tg3_writephy(tp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX | + BMCR_SPEED1000); } else return -EINVAL; @@ -9284,8 +9255,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) static struct pci_device_id write_reorder_chipsets[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C) }, - { PCI_DEVICE(PCI_VENDOR_ID_VIA, - PCI_DEVICE_ID_VIA_8385_0) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, + PCI_DEVICE_ID_AMD_K8_NB) }, { }, }; u32 misc_ctrl_reg; @@ -9300,6 +9271,15 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) tp->tg3_flags2 |= TG3_FLG2_SUN_570X; #endif + /* If we have an AMD 762 or K8 chipset, write + * reordering to the mailbox registers done by the host + * controller can cause major troubles. We read back from + * every mailbox register write to force the writes to be + * posted to the chip in order. + */ + if (pci_dev_present(write_reorder_chipsets)) + tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER; + /* Force memory write invalidate off. If we leave it on, * then on 5700_BX chips we have to enable a workaround. * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary @@ -9430,16 +9410,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0) tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; - /* If we have an AMD 762 or VIA K8T800 chipset, write - * reordering to the mailbox registers done by the host - * controller can cause major troubles. We read back from - * every mailbox register write to force the writes to be - * posted to the chip in order. - */ - if (pci_dev_present(write_reorder_chipsets) && - !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) - tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER; - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && tp->pci_lat_timer < 64) { tp->pci_lat_timer = 64; @@ -10354,44 +10324,6 @@ static char * __devinit tg3_phy_string(struct tg3 *tp) }; } -static char * __devinit tg3_bus_string(struct tg3 *tp, char *str) -{ - if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) { - strcpy(str, "PCI Express"); - return str; - } else if (tp->tg3_flags & TG3_FLAG_PCIX_MODE) { - u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL) & 0x1f; - - strcpy(str, "PCIX:"); - - if ((clock_ctrl == 7) || - ((tr32(GRC_MISC_CFG) & GRC_MISC_CFG_BOARD_ID_MASK) == - GRC_MISC_CFG_BOARD_ID_5704CIOBE)) - strcat(str, "133MHz"); - else if (clock_ctrl == 0) - strcat(str, "33MHz"); - else if (clock_ctrl == 2) - strcat(str, "50MHz"); - else if (clock_ctrl == 4) - strcat(str, "66MHz"); - else if (clock_ctrl == 6) - strcat(str, "100MHz"); - else if (clock_ctrl == 7) - strcat(str, "133MHz"); - } else { - strcpy(str, "PCI:"); - if (tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) - strcat(str, "66MHz"); - else - strcat(str, "33MHz"); - } - if (tp->tg3_flags & TG3_FLAG_PCI_32BIT) - strcat(str, ":32-bit"); - else - strcat(str, ":64-bit"); - return str; -} - static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) { struct pci_dev *peer; @@ -10454,7 +10386,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, struct net_device *dev; struct tg3 *tp; int i, err, pci_using_dac, pm_cap; - char str[40]; if (tg3_version_printed++ == 0) printk(KERN_INFO "%s", version); @@ -10700,12 +10631,16 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, pci_set_drvdata(pdev, dev); - printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %sBaseT Ethernet ", + printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ", dev->name, tp->board_part_number, tp->pci_chip_rev_id, tg3_phy_string(tp), - tg3_bus_string(tp, str), + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "X" : ""), + ((tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) ? + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "133MHz" : "66MHz") : + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "100MHz" : "33MHz")), + ((tp->tg3_flags & TG3_FLAG_PCI_32BIT) ? "32-bit" : "64-bit"), (tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100" : "10/100/1000"); for (i = 0; i < 6; i++) diff --git a/trunk/drivers/net/tg3.h b/trunk/drivers/net/tg3.h index 2e733c60bfa4..c184b773e585 100644 --- a/trunk/drivers/net/tg3.h +++ b/trunk/drivers/net/tg3.h @@ -2246,7 +2246,6 @@ struct tg3 { (X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \ (X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \ (X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \ - (X) == PHY_ID_BCM5752 || (X) == PHY_ID_BCM5780 || \ (X) == PHY_ID_BCM8002) struct tg3_hw_stats *hw_stats; diff --git a/trunk/drivers/net/tokenring/ibmtr.c b/trunk/drivers/net/tokenring/ibmtr.c index 32057e65808b..e7b001017b9a 100644 --- a/trunk/drivers/net/tokenring/ibmtr.c +++ b/trunk/drivers/net/tokenring/ibmtr.c @@ -531,6 +531,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) if (!time_after(jiffies, timeout)) continue; DPRINTK( "Hardware timeout during initialization.\n"); iounmap(t_mmio); + kfree(ti); return -ENODEV; } ti->sram_phys = @@ -644,6 +645,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) DPRINTK("Unknown shared ram paging info %01X\n", ti->shared_ram_paging); iounmap(t_mmio); + kfree(ti); return -ENODEV; break; } /*end switch shared_ram_paging */ @@ -673,6 +675,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) "driver limit (%05x), adapter not started.\n", chk_base, ibmtr_mem_base + IBMTR_SHARED_RAM_SIZE); iounmap(t_mmio); + kfree(ti); return -ENODEV; } else { /* seems cool, record what we have figured out */ ti->sram_base = new_base >> 12; @@ -687,6 +690,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) DPRINTK("Could not grab irq %d. Halting Token Ring driver.\n", irq); iounmap(t_mmio); + kfree(ti); return -ENODEV; } /*?? Now, allocate some of the PIO PORTs for this driver.. */ @@ -695,6 +699,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) DPRINTK("Could not grab PIO range. Halting driver.\n"); free_irq(dev->irq, dev); iounmap(t_mmio); + kfree(ti); return -EBUSY; } diff --git a/trunk/drivers/net/tulip/21142.c b/trunk/drivers/net/tulip/21142.c index 683f14b01c06..5db694c4eb02 100644 --- a/trunk/drivers/net/tulip/21142.c +++ b/trunk/drivers/net/tulip/21142.c @@ -172,7 +172,7 @@ void t21142_lnk_change(struct net_device *dev, int csr5) int i; for (i = 0; i < tp->mtable->leafcount; i++) if (tp->mtable->mleaf[i].media == dev->if_port) { - int startup = ! ((tp->chip_id == DC21143 && (tp->revision == 48 || tp->revision == 65))); + int startup = ! ((tp->chip_id == DC21143 && tp->revision == 65)); tp->cur_index = i; tulip_select_media(dev, startup); setup_done = 1; diff --git a/trunk/drivers/net/wan/sdlamain.c b/trunk/drivers/net/wan/sdlamain.c index 7a8b22a7ea31..74e151acef3e 100644 --- a/trunk/drivers/net/wan/sdlamain.c +++ b/trunk/drivers/net/wan/sdlamain.c @@ -57,7 +57,6 @@ #include /* request_region(), release_region() */ #include /* WAN router definitions */ #include /* WANPIPE common user API definitions */ -#include #include #include /* phys_to_virt() */ @@ -1269,41 +1268,37 @@ unsigned long get_ip_address(struct net_device *dev, int option) struct in_ifaddr *ifaddr; struct in_device *in_dev; - unsigned long addr = 0; - rcu_read_lock(); - if ((in_dev = __in_dev_get_rcu(dev)) == NULL){ - goto out; + if ((in_dev = __in_dev_get(dev)) == NULL){ + return 0; } if ((ifaddr = in_dev->ifa_list)== NULL ){ - goto out; + return 0; } switch (option){ case WAN_LOCAL_IP: - addr = ifaddr->ifa_local; + return ifaddr->ifa_local; break; case WAN_POINTOPOINT_IP: - addr = ifaddr->ifa_address; + return ifaddr->ifa_address; break; case WAN_NETMASK_IP: - addr = ifaddr->ifa_mask; + return ifaddr->ifa_mask; break; case WAN_BROADCAST_IP: - addr = ifaddr->ifa_broadcast; + return ifaddr->ifa_broadcast; break; default: - break; + return 0; } -out: - rcu_read_unlock(); - return addr; + return 0; } void add_gateway(sdla_t *card, struct net_device *dev) diff --git a/trunk/drivers/net/wan/syncppp.c b/trunk/drivers/net/wan/syncppp.c index a6d3b55013a5..b56a7b516d24 100644 --- a/trunk/drivers/net/wan/syncppp.c +++ b/trunk/drivers/net/wan/syncppp.c @@ -769,7 +769,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) u32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ #ifdef CONFIG_INET rcu_read_lock(); - if ((in_dev = __in_dev_get_rcu(dev)) != NULL) + if ((in_dev = __in_dev_get(dev)) != NULL) { for (ifa=in_dev->ifa_list; ifa != NULL; ifa=ifa->ifa_next) { diff --git a/trunk/drivers/net/wireless/Kconfig b/trunk/drivers/net/wireless/Kconfig index 7187958e40ca..00a07f32a81e 100644 --- a/trunk/drivers/net/wireless/Kconfig +++ b/trunk/drivers/net/wireless/Kconfig @@ -243,7 +243,7 @@ config IPW_DEBUG config AIRO tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" - depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN) + depends on NET_RADIO && ISA && (PCI || BROKEN) ---help--- This is the standard Linux driver to support Cisco/Aironet ISA and PCI 802.11 wireless cards. diff --git a/trunk/drivers/net/wireless/orinoco.c b/trunk/drivers/net/wireless/orinoco.c index cf3daaa1b369..8de49fe57233 100644 --- a/trunk/drivers/net/wireless/orinoco.c +++ b/trunk/drivers/net/wireless/orinoco.c @@ -503,14 +503,9 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) return 0; } - /* Check packet length, pad short packets, round up odd length */ - len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN); - if (skb->len < len) { - skb = skb_padto(skb, len); - if (skb == NULL) - goto fail; - } - len -= ETH_HLEN; + /* Length of the packet body */ + /* FIXME: what if the skb is smaller than this? */ + len = max_t(int,skb->len - ETH_HLEN, ETH_ZLEN - ETH_HLEN); eh = (struct ethhdr *)skb->data; @@ -562,7 +557,8 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) p = skb->data; } - err = hermes_bap_pwrite(hw, USER_BAP, p, data_len, + /* Round up for odd length packets */ + err = hermes_bap_pwrite(hw, USER_BAP, p, ALIGN(data_len, 2), txfid, data_off); if (err) { printk(KERN_ERR "%s: Error %d writing packet to BAP\n", @@ -2462,6 +2458,7 @@ struct net_device *alloc_orinocodev(int sizeof_card, dev->watchdog_timeo = HZ; /* 1 second timeout */ dev->get_stats = orinoco_get_stats; dev->ethtool_ops = &orinoco_ethtool_ops; + dev->get_wireless_stats = orinoco_get_wireless_stats; dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def; dev->change_mtu = orinoco_change_mtu; dev->set_multicast_list = orinoco_set_multicast_list; @@ -4402,7 +4399,6 @@ static const struct iw_handler_def orinoco_handler_def = { .standard = orinoco_handler, .private = orinoco_private_handler, .private_args = orinoco_privtab, - .get_wireless_stats = orinoco_get_wireless_stats, }; static void orinoco_get_drvinfo(struct net_device *dev, diff --git a/trunk/drivers/net/wireless/strip.c b/trunk/drivers/net/wireless/strip.c index 7bc7fc823128..4b0acae22b0d 100644 --- a/trunk/drivers/net/wireless/strip.c +++ b/trunk/drivers/net/wireless/strip.c @@ -1352,7 +1352,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer, struct in_device *in_dev; rcu_read_lock(); - in_dev = __in_dev_get_rcu(strip_info->dev); + in_dev = __in_dev_get(strip_info->dev); if (in_dev == NULL) { rcu_read_unlock(); return NULL; @@ -1508,7 +1508,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb) brd = addr = 0; rcu_read_lock(); - in_dev = __in_dev_get_rcu(strip_info->dev); + in_dev = __in_dev_get(strip_info->dev); if (in_dev) { if (in_dev->ifa_list) { brd = in_dev->ifa_list->ifa_broadcast; diff --git a/trunk/drivers/parisc/led.c b/trunk/drivers/parisc/led.c index 286902298e33..e90fb72a6962 100644 --- a/trunk/drivers/parisc/led.c +++ b/trunk/drivers/parisc/led.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -359,10 +358,9 @@ static __inline__ int led_get_net_activity(void) /* we are running as tasklet, so locking dev_base * for reading should be OK */ read_lock(&dev_base_lock); - rcu_read_lock(); for (dev = dev_base; dev; dev = dev->next) { struct net_device_stats *stats; - struct in_device *in_dev = __in_dev_get_rcu(dev); + struct in_device *in_dev = __in_dev_get(dev); if (!in_dev || !in_dev->ifa_list) continue; if (LOOPBACK(in_dev->ifa_list->ifa_local)) @@ -373,7 +371,6 @@ static __inline__ int led_get_net_activity(void) rx_total += stats->rx_packets; tx_total += stats->tx_packets; } - rcu_read_unlock(); read_unlock(&dev_base_lock); retval = 0; diff --git a/trunk/drivers/pci/quirks.c b/trunk/drivers/pci/quirks.c index a6a630a950d0..11ca44387cb0 100644 --- a/trunk/drivers/pci/quirks.c +++ b/trunk/drivers/pci/quirks.c @@ -1233,7 +1233,7 @@ static void __init quirk_alder_ioapic(struct pci_dev *pdev) DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic ); #endif -#ifdef CONFIG_SCSI_SATA_INTEL_COMBINED +#ifdef CONFIG_SCSI_SATA static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) { u8 prog, comb, tmp; @@ -1310,7 +1310,7 @@ static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) request_region(0x170, 8, "libata"); /* port 1 */ } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_intel_ide_combined ); -#endif /* CONFIG_SCSI_SATA_INTEL_COMBINED */ +#endif /* CONFIG_SCSI_SATA */ int pcie_mch_quirk; diff --git a/trunk/drivers/pcmcia/Kconfig b/trunk/drivers/pcmcia/Kconfig index 36cc9a96a338..ddc741e6ecbf 100644 --- a/trunk/drivers/pcmcia/Kconfig +++ b/trunk/drivers/pcmcia/Kconfig @@ -146,7 +146,7 @@ config I82365 config TCIC tristate "Databook TCIC host bridge support" - depends on PCMCIA && ISA + depends on PCMCIA select PCCARD_NONSTATIC help Say Y here to include support for the Databook TCIC family of PCMCIA diff --git a/trunk/drivers/pcmcia/cardbus.c b/trunk/drivers/pcmcia/cardbus.c index 3f6d51d11374..1d755e20880c 100644 --- a/trunk/drivers/pcmcia/cardbus.c +++ b/trunk/drivers/pcmcia/cardbus.c @@ -228,11 +228,6 @@ int cb_alloc(struct pcmcia_socket * s) pci_bus_size_bridges(bus); pci_bus_assign_resources(bus); cardbus_assign_irqs(bus, s->pci_irq); - - /* socket specific tune function */ - if (s->tune_bridge) - s->tune_bridge(s, bus); - pci_enable_bridges(bus); pci_bus_add_devices(bus); diff --git a/trunk/drivers/pcmcia/cs.c b/trunk/drivers/pcmcia/cs.c index d5e76423a0ee..fabd3529cebc 100644 --- a/trunk/drivers/pcmcia/cs.c +++ b/trunk/drivers/pcmcia/cs.c @@ -689,9 +689,6 @@ static int pccardd(void *__skt) schedule(); try_to_freeze(); } - /* make sure we are running before we exit */ - set_current_state(TASK_RUNNING); - remove_wait_queue(&skt->thread_wait, &wait); /* remove from the device core */ diff --git a/trunk/drivers/pcmcia/omap_cf.c b/trunk/drivers/pcmcia/omap_cf.c index 94be9e51654e..08d1c9288264 100644 --- a/trunk/drivers/pcmcia/omap_cf.c +++ b/trunk/drivers/pcmcia/omap_cf.c @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/trunk/drivers/pcmcia/rsrc_nonstatic.c b/trunk/drivers/pcmcia/rsrc_nonstatic.c index f9a5c70284b5..c42455d20eb6 100644 --- a/trunk/drivers/pcmcia/rsrc_nonstatic.c +++ b/trunk/drivers/pcmcia/rsrc_nonstatic.c @@ -691,7 +691,7 @@ static int adjust_memory(struct pcmcia_socket *s, unsigned int action, unsigned unsigned long size = end - start + 1; int ret = 0; - if (end < start) + if (end <= start) return -EINVAL; down(&rsrc_sem); @@ -724,7 +724,7 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long unsigned long size = end - start + 1; int ret = 0; - if (end < start) + if (end <= start) return -EINVAL; if (end > IO_SPACE_LIMIT) @@ -817,7 +817,7 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s) /* if we got at least one of IO, and one of MEM, we can be glad and * activate the PCMCIA subsystem */ - if (done == (IORESOURCE_MEM | IORESOURCE_IO)) + if (done & (IORESOURCE_MEM | IORESOURCE_IO)) s->resource_setup_done = 1; return 0; @@ -925,7 +925,7 @@ static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size return -EINVAL; } } - if (end_addr < start_addr) + if (end_addr <= start_addr) return -EINVAL; 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 return -EINVAL; } } - if (end_addr < start_addr) + if (end_addr <= start_addr) return -EINVAL; ret = adjust_memory(s, add, start_addr, end_addr); diff --git a/trunk/drivers/pcmcia/soc_common.c b/trunk/drivers/pcmcia/soc_common.c index 9e7ccd8a4321..888b70e6a484 100644 --- a/trunk/drivers/pcmcia/soc_common.c +++ b/trunk/drivers/pcmcia/soc_common.c @@ -66,7 +66,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, if (pc_debug > lvl) { printk(KERN_DEBUG "skt%u: %s: ", skt->nr, func); va_start(args, fmt); - vprintk(fmt, args); + printk(fmt, args); va_end(args); } } @@ -321,6 +321,8 @@ soc_common_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state) * less punt all of this work and let the kernel handle the details * of power configuration, reset, &c. We also record the value of * `state' in order to regurgitate it to the PCMCIA core later. + * + * Returns: 0 */ static int soc_common_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state) @@ -405,7 +407,7 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m * the map speed as requested, but override the address ranges * supplied by Card Services. * - * Returns: 0 on success, -ERRNO on error + * Returns: 0 on success, -1 on error */ static int soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map) @@ -653,8 +655,8 @@ static void soc_pcmcia_cpufreq_unregister(void) } #else -static int soc_pcmcia_cpufreq_register(void) { return 0; } -static void soc_pcmcia_cpufreq_unregister(void) {} +#define soc_pcmcia_cpufreq_register() +#define soc_pcmcia_cpufreq_unregister() #endif int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) @@ -736,7 +738,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops goto out_err_5; } - if (list_empty(&soc_pcmcia_sockets)) + if ( list_empty(&soc_pcmcia_sockets) ) soc_pcmcia_cpufreq_register(); list_add(&skt->node, &soc_pcmcia_sockets); @@ -837,7 +839,7 @@ int soc_common_drv_pcmcia_remove(struct device *dev) release_resource(&skt->res_io); release_resource(&skt->res_skt); } - if (list_empty(&soc_pcmcia_sockets)) + if ( list_empty(&soc_pcmcia_sockets) ) soc_pcmcia_cpufreq_unregister(); up(&soc_pcmcia_sockets_lock); diff --git a/trunk/drivers/pcmcia/ti113x.h b/trunk/drivers/pcmcia/ti113x.h index 539b5cd1a598..fbe233e19ceb 100644 --- a/trunk/drivers/pcmcia/ti113x.h +++ b/trunk/drivers/pcmcia/ti113x.h @@ -59,7 +59,6 @@ #define TI122X_SCR_SER_STEP 0xc0000000 #define TI122X_SCR_INTRTIE 0x20000000 -#define TIXX21_SCR_TIEALL 0x10000000 #define TI122X_SCR_CBRSVD 0x00400000 #define TI122X_SCR_MRBURSTDN 0x00008000 #define TI122X_SCR_MRBURSTUP 0x00004000 @@ -154,12 +153,6 @@ /* EnE test register */ #define ENE_TEST_C9 0xc9 /* 8bit */ #define ENE_TEST_C9_TLTENABLE 0x02 -#define ENE_TEST_C9_PFENABLE_F0 0x04 -#define ENE_TEST_C9_PFENABLE_F1 0x08 -#define ENE_TEST_C9_PFENABLE (ENE_TEST_C9_PFENABLE_F0 | ENE_TEST_C9_PFENABLE_F0) -#define ENE_TEST_C9_WPDISALBLE_F0 0x40 -#define ENE_TEST_C9_WPDISALBLE_F1 0x80 -#define ENE_TEST_C9_WPDISALBLE (ENE_TEST_C9_WPDISALBLE_F0 | ENE_TEST_C9_WPDISALBLE_F1) /* * Texas Instruments CardBus controller overrides. @@ -625,7 +618,6 @@ static int ti12xx_2nd_slot_empty(struct yenta_socket *socket) int devfn; unsigned int state; int ret = 1; - u32 sysctl; /* catch the two-slot controllers */ switch (socket->dev->device) { @@ -648,24 +640,6 @@ static int ti12xx_2nd_slot_empty(struct yenta_socket *socket) */ break; - case PCI_DEVICE_ID_TI_X515: - case PCI_DEVICE_ID_TI_X420: - case PCI_DEVICE_ID_TI_X620: - case PCI_DEVICE_ID_TI_XX21_XX11: - case PCI_DEVICE_ID_TI_7410: - case PCI_DEVICE_ID_TI_7610: - /* - * those are either single or dual slot CB with additional functions - * like 1394, smartcard reader, etc. check the TIEALL flag for them - * the TIEALL flag binds the IRQ of all functions toghether. - * we catch the single slot variants later. - */ - sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL); - if (sysctl & TIXX21_SCR_TIEALL) - return 0; - - break; - /* single-slot controllers have the 2nd slot empty always :) */ default: return 1; @@ -678,15 +652,6 @@ static int ti12xx_2nd_slot_empty(struct yenta_socket *socket) if (!func) return 1; - /* - * check that the device id of both slots match. this is needed for the - * XX21 and the XX11 controller that share the same device id for single - * and dual slot controllers. return '2nd slot empty'. we already checked - * if the interrupt is tied to another function. - */ - if (socket->dev->device != func->device) - goto out; - slot2 = pci_get_drvdata(func); if (!slot2) goto out; @@ -825,6 +790,16 @@ static int ti12xx_override(struct yenta_socket *socket) if (val_orig != val) config_writel(socket, TI113X_SYSTEM_CONTROL, val); + /* + * for EnE bridges only: clear testbit TLTEnable. this makes the + * RME Hammerfall DSP sound card working. + */ + if (socket->dev->vendor == PCI_VENDOR_ID_ENE) { + u8 test_c9 = config_readb(socket, ENE_TEST_C9); + test_c9 &= ~ENE_TEST_C9_TLTENABLE; + config_writeb(socket, ENE_TEST_C9, test_c9); + } + /* * Yenta expects controllers to use CSCINT to route * CSC interrupts to PCI rather than INTVAL. @@ -866,78 +841,5 @@ static int ti1250_override(struct yenta_socket *socket) return ti12xx_override(socket); } - -/** - * EnE specific part. EnE bridges are register compatible with TI bridges but - * have their own test registers and more important their own little problems. - * Some fixup code to make everybody happy (TM). - */ - -#ifdef CONFIG_CARDBUS -/** - * set/clear various test bits: - * Defaults to clear the bit. - * - mask (u8) defines what bits to change - * - bits (u8) is the values to change them to - * -> it's - * current = (current & ~mask) | bits - */ -/* pci ids of devices that wants to have the bit set */ -#define DEVID(_vend,_dev,_subvend,_subdev,mask,bits) { \ - .vendor = _vend, \ - .device = _dev, \ - .subvendor = _subvend, \ - .subdevice = _subdev, \ - .driver_data = ((mask) << 8 | (bits)), \ - } -static struct pci_device_id ene_tune_tbl[] = { - /* Echo Audio products based on motorola DSP56301 and DSP56361 */ - DEVID(PCI_VENDOR_ID_MOTOROLA, 0x1801, 0xECC0, PCI_ANY_ID, - ENE_TEST_C9_TLTENABLE | ENE_TEST_C9_PFENABLE, ENE_TEST_C9_TLTENABLE), - DEVID(PCI_VENDOR_ID_MOTOROLA, 0x3410, 0xECC0, PCI_ANY_ID, - ENE_TEST_C9_TLTENABLE | ENE_TEST_C9_PFENABLE, ENE_TEST_C9_TLTENABLE), - - {} -}; - -static void ene_tune_bridge(struct pcmcia_socket *sock, struct pci_bus *bus) -{ - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket); - struct pci_dev *dev; - struct pci_device_id *id = NULL; - u8 test_c9, old_c9, mask, bits; - - list_for_each_entry(dev, &bus->devices, bus_list) { - id = (struct pci_device_id *) pci_match_id(ene_tune_tbl, dev); - if (id) - break; - } - - test_c9 = old_c9 = config_readb(socket, ENE_TEST_C9); - if (id) { - mask = (id->driver_data >> 8) & 0xFF; - bits = id->driver_data & 0xFF; - - test_c9 = (test_c9 & ~mask) | bits; - } - else - /* default to clear TLTEnable bit, old behaviour */ - test_c9 &= ~ENE_TEST_C9_TLTENABLE; - - printk(KERN_INFO "yenta EnE: chaning testregister 0xC9, %02x -> %02x\n", old_c9, test_c9); - config_writeb(socket, ENE_TEST_C9, test_c9); -} - -static int ene_override(struct yenta_socket *socket) -{ - /* install tune_bridge() function */ - socket->socket.tune_bridge = ene_tune_bridge; - - return ti1250_override(socket); -} -#else -# define ene_override ti1250_override -#endif - #endif /* _LINUX_TI113X_H */ diff --git a/trunk/drivers/pcmcia/yenta_socket.c b/trunk/drivers/pcmcia/yenta_socket.c index db9f952f9e3c..ba4d78e5b121 100644 --- a/trunk/drivers/pcmcia/yenta_socket.c +++ b/trunk/drivers/pcmcia/yenta_socket.c @@ -559,6 +559,12 @@ static void yenta_interrogate(struct yenta_socket *socket) static int yenta_sock_init(struct pcmcia_socket *sock) { struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket); + u16 bridge; + + bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~CB_BRIDGE_INTR; + if (!socket->cb_irq) + bridge |= CB_BRIDGE_INTR; + config_writew(socket, CB_BRIDGE_CONTROL, bridge); exca_writeb(socket, I365_GBLCTL, 0x00); exca_writeb(socket, I365_GENCTL, 0x00); @@ -813,7 +819,6 @@ enum { CARDBUS_TYPE_TOPIC95, CARDBUS_TYPE_TOPIC97, CARDBUS_TYPE_O2MICRO, - CARDBUS_TYPE_ENE, }; /* @@ -860,12 +865,6 @@ static struct cardbus_type cardbus_type[] = { .override = o2micro_override, .restore_state = o2micro_restore_state, }, - [CARDBUS_TYPE_ENE] = { - .override = ene_override, - .save_state = ti_save_state, - .restore_state = ti_restore_state, - .sock_init = ti_init, - }, }; @@ -884,8 +883,16 @@ static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mas { int i; unsigned long val; + u16 bridge_ctrl; u32 mask; + /* Set up ISA irq routing to probe the ISA irqs.. */ + bridge_ctrl = config_readw(socket, CB_BRIDGE_CONTROL); + if (!(bridge_ctrl & CB_BRIDGE_INTR)) { + bridge_ctrl |= CB_BRIDGE_INTR; + config_writew(socket, CB_BRIDGE_CONTROL, bridge_ctrl); + } + /* * Probe for usable interrupts using the force * register to generate bogus card status events. @@ -907,6 +914,9 @@ static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mas mask = probe_irq_mask(val) & 0xffff; + bridge_ctrl &= ~CB_BRIDGE_INTR; + config_writew(socket, CB_BRIDGE_CONTROL, bridge_ctrl); + return mask; } @@ -934,11 +944,18 @@ static irqreturn_t yenta_probe_handler(int irq, void *dev_id, struct pt_regs *re /* probes the PCI interrupt, use only on override functions */ static int yenta_probe_cb_irq(struct yenta_socket *socket) { + u16 bridge_ctrl; + if (!socket->cb_irq) return -1; socket->probe_status = 0; + /* disable ISA interrupts */ + bridge_ctrl = config_readw(socket, CB_BRIDGE_CONTROL); + bridge_ctrl &= ~CB_BRIDGE_INTR; + config_writew(socket, CB_BRIDGE_CONTROL, bridge_ctrl); + if (request_irq(socket->cb_irq, yenta_probe_handler, SA_SHIRQ, "yenta", socket)) { printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n"); return -1; @@ -949,7 +966,7 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket) cb_writel(socket, CB_SOCKET_EVENT, -1); cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK); cb_writel(socket, CB_SOCKET_FORCE, CB_FCARDSTS); - + msleep(100); /* disable interrupts */ @@ -987,12 +1004,11 @@ static void yenta_config_init(struct yenta_socket *socket) { u16 bridge; struct pci_dev *dev = socket->dev; - struct pci_bus_region region; - pcibios_resource_to_bus(socket->dev, ®ion, &dev->resource[0]); + pci_set_power_state(socket->dev, 0); config_writel(socket, CB_LEGACY_MODE_BASE, 0); - config_writel(socket, PCI_BASE_ADDRESS_0, region.start); + config_writel(socket, PCI_BASE_ADDRESS_0, dev->resource[0].start); config_writew(socket, PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY | @@ -1015,8 +1031,8 @@ static void yenta_config_init(struct yenta_socket *socket) * - PCI interrupts enabled if a PCI interrupt exists.. */ bridge = config_readw(socket, CB_BRIDGE_CONTROL); - bridge &= ~(CB_BRIDGE_CRST | CB_BRIDGE_PREFETCH1 | CB_BRIDGE_ISAEN | CB_BRIDGE_VGAEN); - bridge |= CB_BRIDGE_PREFETCH0 | CB_BRIDGE_POSTEN; + bridge &= ~(CB_BRIDGE_CRST | CB_BRIDGE_PREFETCH1 | CB_BRIDGE_INTR | CB_BRIDGE_ISAEN | CB_BRIDGE_VGAEN); + bridge |= CB_BRIDGE_PREFETCH0 | CB_BRIDGE_POSTEN | CB_BRIDGE_INTR; config_writew(socket, CB_BRIDGE_CONTROL, bridge); } @@ -1249,22 +1265,10 @@ static struct pci_device_id yenta_table [] = { CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1250, TI1250), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1410, TI1250), - CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XX21_XX11, TI12XX), - CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X515, TI12XX), - CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X420, TI12XX), - CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X620, TI12XX), - CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_7410, TI12XX), - CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_7510, TI12XX), - CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_7610, TI12XX), - - CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_710, TI12XX), - CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_712, TI12XX), - CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_720, TI12XX), - CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_722, TI12XX), - CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1211, ENE), - CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1225, ENE), - CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1410, ENE), - CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1420, ENE), + CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1211, TI12XX), + CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1225, TI12XX), + CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1410, TI1250), + CB_ID(PCI_VENDOR_ID_ENE, PCI_DEVICE_ID_ENE_1420, TI12XX), CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C465, RICOH), CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C466, RICOH), diff --git a/trunk/drivers/s390/cio/device.c b/trunk/drivers/s390/cio/device.c index 9adc11e8b8bc..14c76f5e4177 100644 --- a/trunk/drivers/s390/cio/device.c +++ b/trunk/drivers/s390/cio/device.c @@ -544,7 +544,7 @@ get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling) .sibling = sibling, }; - dev = bus_find_device(&ccw_bus_type, NULL, &data, match_devno); + dev = bus_find_device(&css_bus_type, NULL, &data, match_devno); return dev ? to_ccwdev(dev) : NULL; } diff --git a/trunk/drivers/s390/net/qeth.h b/trunk/drivers/s390/net/qeth.h index 9963479ba89f..2ad4797ce024 100644 --- a/trunk/drivers/s390/net/qeth.h +++ b/trunk/drivers/s390/net/qeth.h @@ -686,7 +686,6 @@ struct qeth_seqno { __u32 pdu_hdr; __u32 pdu_hdr_ack; __u16 ipa; - __u32 pkt_seqno; }; struct qeth_reply { @@ -849,7 +848,6 @@ qeth_realloc_headroom(struct qeth_card *card, struct sk_buff **skb, int size) "on interface %s", QETH_CARD_IFNAME(card)); return -ENOMEM; } - kfree_skb(*skb); *skb = new_skb; } return 0; diff --git a/trunk/drivers/s390/net/qeth_main.c b/trunk/drivers/s390/net/qeth_main.c index bd28e2438d7f..86582cf1e19e 100644 --- a/trunk/drivers/s390/net/qeth_main.c +++ b/trunk/drivers/s390/net/qeth_main.c @@ -511,7 +511,7 @@ static int __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) { struct qeth_card *card = (struct qeth_card *) cgdev->dev.driver_data; - int rc = 0, rc2 = 0, rc3 = 0; + int rc = 0; enum qeth_card_states recover_flag; QETH_DBF_TEXT(setup, 3, "setoffl"); @@ -523,13 +523,11 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) CARD_BUS_ID(card)); return -ERESTARTSYS; } - rc = ccw_device_set_offline(CARD_DDEV(card)); - rc2 = ccw_device_set_offline(CARD_WDEV(card)); - rc3 = ccw_device_set_offline(CARD_RDEV(card)); - if (!rc) - rc = (rc2) ? rc2 : rc3; - if (rc) + if ((rc = ccw_device_set_offline(CARD_DDEV(card))) || + (rc = ccw_device_set_offline(CARD_WDEV(card))) || + (rc = ccw_device_set_offline(CARD_RDEV(card)))) { QETH_DBF_TEXT_(setup, 2, "1err%d", rc); + } if (recover_flag == CARD_STATE_UP) card->state = CARD_STATE_RECOVER; qeth_notify_processes(); @@ -1048,7 +1046,6 @@ qeth_setup_card(struct qeth_card *card) spin_lock_init(&card->vlanlock); card->vlangrp = NULL; #endif - spin_lock_init(&card->lock); spin_lock_init(&card->ip_lock); spin_lock_init(&card->thread_mask_lock); card->thread_start_mask = 0; @@ -1629,6 +1626,16 @@ qeth_cmd_timeout(unsigned long data) spin_unlock_irqrestore(&reply->card->lock, flags); } +static void +qeth_reset_ip_addresses(struct qeth_card *card) +{ + QETH_DBF_TEXT(trace, 2, "rstipadd"); + + qeth_clear_ip_list(card, 0, 1); + /* this function will also schedule the SET_IP_THREAD */ + qeth_set_multicast_list(card->dev); +} + static struct qeth_ipa_cmd * qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) { @@ -1657,8 +1664,9 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) "IP address reset.\n", QETH_CARD_IFNAME(card), card->info.chpid); + card->lan_online = 1; netif_carrier_on(card->dev); - qeth_schedule_recovery(card); + qeth_reset_ip_addresses(card); return NULL; case IPA_CMD_REGISTER_LOCAL_ADDR: QETH_DBF_TEXT(trace,3, "irla"); @@ -2379,7 +2387,6 @@ qeth_layer2_rebuild_skb(struct qeth_card *card, struct sk_buff *skb, skb_pull(skb, VLAN_HLEN); } #endif - *((__u32 *)skb->cb) = ++card->seqno.pkt_seqno; return vlan_id; } @@ -3007,7 +3014,7 @@ qeth_alloc_buffer_pool(struct qeth_card *card) return -ENOMEM; } for(j = 0; j < QETH_MAX_BUFFER_ELEMENTS(card); ++j){ - ptr = (void *) __get_free_page(GFP_KERNEL|GFP_DMA); + ptr = (void *) __get_free_page(GFP_KERNEL); if (!ptr) { while (j > 0) free_page((unsigned long) @@ -3051,8 +3058,7 @@ qeth_alloc_qdio_buffers(struct qeth_card *card) if (card->qdio.state == QETH_QDIO_ALLOCATED) return 0; - card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q), - GFP_KERNEL|GFP_DMA); + card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q), GFP_KERNEL); if (!card->qdio.in_q) return - ENOMEM; QETH_DBF_TEXT(setup, 2, "inq"); @@ -3077,7 +3083,7 @@ qeth_alloc_qdio_buffers(struct qeth_card *card) } for (i = 0; i < card->qdio.no_out_queues; ++i){ card->qdio.out_qs[i] = kmalloc(sizeof(struct qeth_qdio_out_q), - GFP_KERNEL|GFP_DMA); + GFP_KERNEL); if (!card->qdio.out_qs[i]){ while (i > 0) kfree(card->qdio.out_qs[--i]); @@ -5194,7 +5200,7 @@ qeth_free_vlan_addresses4(struct qeth_card *card, unsigned short vid) if (!card->vlangrp) return; rcu_read_lock(); - in_dev = __in_dev_get_rcu(card->vlangrp->vlan_devices[vid]); + in_dev = __in_dev_get(card->vlangrp->vlan_devices[vid]); if (!in_dev) goto out; for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { @@ -6464,9 +6470,6 @@ qeth_query_ipassists_cb(struct qeth_card *card, struct qeth_reply *reply, if (cmd->hdr.prot_version == QETH_PROT_IPV4) { card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported; card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled; - /* Disable IPV6 support hard coded for Hipersockets */ - if(card->info.type == QETH_CARD_TYPE_IQD) - card->options.ipa4.supported_funcs &= ~IPA_IPV6; } else { #ifdef CONFIG_QETH_IPV6 card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported; @@ -7722,7 +7725,7 @@ qeth_arp_constructor(struct neighbour *neigh) goto out; rcu_read_lock(); - in_dev = __in_dev_get_rcu(dev); + in_dev = rcu_dereference(__in_dev_get(dev)); if (in_dev == NULL) { rcu_read_unlock(); return -EINVAL; diff --git a/trunk/drivers/s390/scsi/zfcp_aux.c b/trunk/drivers/s390/scsi/zfcp_aux.c index cab098556b44..0b5087f7cabc 100644 --- a/trunk/drivers/s390/scsi/zfcp_aux.c +++ b/trunk/drivers/s390/scsi/zfcp_aux.c @@ -833,7 +833,7 @@ zfcp_unit_dequeue(struct zfcp_unit *unit) } static void * -zfcp_mempool_alloc(gfp_t gfp_mask, void *size) +zfcp_mempool_alloc(unsigned int __nocast gfp_mask, void *size) { return kmalloc((size_t) size, gfp_mask); } diff --git a/trunk/drivers/scsi/3w-9xxx.c b/trunk/drivers/scsi/3w-9xxx.c index a748fbfb6692..a6ac61611f35 100644 --- a/trunk/drivers/scsi/3w-9xxx.c +++ b/trunk/drivers/scsi/3w-9xxx.c @@ -60,7 +60,6 @@ Remove un-needed eh_abort handler. Add support for embedded firmware error strings. 2.26.02.003 - Correctly handle single sgl's with use_sg=1. - 2.26.02.004 - Add support for 9550SX controllers. */ #include @@ -83,7 +82,7 @@ #include "3w-9xxx.h" /* Globals */ -#define TW_DRIVER_VERSION "2.26.02.004" +#define TW_DRIVER_VERSION "2.26.02.003" static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; static unsigned int twa_device_extension_count; static int twa_major = -1; @@ -893,6 +892,11 @@ static int twa_decode_bits(TW_Device_Extension *tw_dev, u32 status_reg_value) writel(TW_CONTROL_CLEAR_QUEUE_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); } + if (status_reg_value & TW_STATUS_SBUF_WRITE_ERROR) { + TW_PRINTK(tw_dev->host, TW_DRIVER, 0xf, "SBUF Write Error: clearing"); + writel(TW_CONTROL_CLEAR_SBUF_WRITE_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); + } + if (status_reg_value & TW_STATUS_MICROCONTROLLER_ERROR) { if (tw_dev->reset_print == 0) { TW_PRINTK(tw_dev->host, TW_DRIVER, 0x10, "Microcontroller Error: clearing"); @@ -926,36 +930,6 @@ static int twa_empty_response_queue(TW_Device_Extension *tw_dev) return retval; } /* End twa_empty_response_queue() */ -/* This function will clear the pchip/response queue on 9550SX */ -static int twa_empty_response_queue_large(TW_Device_Extension *tw_dev) -{ - u32 status_reg_value, response_que_value; - int count = 0, retval = 1; - - if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9550SX) { - status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); - - while (((status_reg_value & TW_STATUS_RESPONSE_QUEUE_EMPTY) == 0) && (count < TW_MAX_RESPONSE_DRAIN)) { - response_que_value = readl(TW_RESPONSE_QUEUE_REG_ADDR_LARGE(tw_dev)); - if ((response_que_value & TW_9550SX_DRAIN_COMPLETED) == TW_9550SX_DRAIN_COMPLETED) { - /* P-chip settle time */ - msleep(500); - retval = 0; - goto out; - } - status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); - count++; - } - if (count == TW_MAX_RESPONSE_DRAIN) - goto out; - - retval = 0; - } else - retval = 0; -out: - return retval; -} /* End twa_empty_response_queue_large() */ - /* This function passes sense keys from firmware to scsi layer */ static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host) { @@ -1639,16 +1613,8 @@ static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset) int tries = 0, retval = 1, flashed = 0, do_soft_reset = soft_reset; while (tries < TW_MAX_RESET_TRIES) { - if (do_soft_reset) { + if (do_soft_reset) TW_SOFT_RESET(tw_dev); - /* Clear pchip/response queue on 9550SX */ - if (twa_empty_response_queue_large(tw_dev)) { - TW_PRINTK(tw_dev->host, TW_DRIVER, 0x36, "Response queue (large) empty failed during reset sequence"); - do_soft_reset = 1; - tries++; - continue; - } - } /* Make sure controller is in a good state */ if (twa_poll_status(tw_dev, TW_STATUS_MICROCONTROLLER_READY | (do_soft_reset == 1 ? TW_STATUS_ATTENTION_INTERRUPT : 0), 60)) { @@ -2068,10 +2034,7 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id goto out_free_device_extension; } - if (pdev->device == PCI_DEVICE_ID_3WARE_9000) - mem_addr = pci_resource_start(pdev, 1); - else - mem_addr = pci_resource_start(pdev, 2); + mem_addr = pci_resource_start(pdev, 1); /* Save base address */ tw_dev->base_addr = ioremap(mem_addr, PAGE_SIZE); @@ -2185,8 +2148,6 @@ static void twa_remove(struct pci_dev *pdev) static struct pci_device_id twa_pci_tbl[] __devinitdata = { { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { } }; MODULE_DEVICE_TABLE(pci, twa_pci_tbl); diff --git a/trunk/drivers/scsi/3w-9xxx.h b/trunk/drivers/scsi/3w-9xxx.h index 46f22cdc8298..8c8ecbed3b58 100644 --- a/trunk/drivers/scsi/3w-9xxx.h +++ b/trunk/drivers/scsi/3w-9xxx.h @@ -267,6 +267,7 @@ static twa_message_type twa_error_table[] = { #define TW_CONTROL_CLEAR_PARITY_ERROR 0x00800000 #define TW_CONTROL_CLEAR_QUEUE_ERROR 0x00400000 #define TW_CONTROL_CLEAR_PCI_ABORT 0x00100000 +#define TW_CONTROL_CLEAR_SBUF_WRITE_ERROR 0x00000008 /* Status register bit definitions */ #define TW_STATUS_MAJOR_VERSION_MASK 0xF0000000 @@ -284,8 +285,9 @@ static twa_message_type twa_error_table[] = { #define TW_STATUS_MICROCONTROLLER_READY 0x00002000 #define TW_STATUS_COMMAND_QUEUE_EMPTY 0x00001000 #define TW_STATUS_EXPECTED_BITS 0x00002000 -#define TW_STATUS_UNEXPECTED_BITS 0x00F00000 -#define TW_STATUS_VALID_INTERRUPT 0x00DF0000 +#define TW_STATUS_UNEXPECTED_BITS 0x00F00008 +#define TW_STATUS_SBUF_WRITE_ERROR 0x00000008 +#define TW_STATUS_VALID_INTERRUPT 0x00DF0008 /* RESPONSE QUEUE BIT DEFINITIONS */ #define TW_RESPONSE_ID_MASK 0x00000FF0 @@ -322,9 +324,9 @@ static twa_message_type twa_error_table[] = { /* Compatibility defines */ #define TW_9000_ARCH_ID 0x5 -#define TW_CURRENT_DRIVER_SRL 30 -#define TW_CURRENT_DRIVER_BUILD 80 -#define TW_CURRENT_DRIVER_BRANCH 0 +#define TW_CURRENT_DRIVER_SRL 28 +#define TW_CURRENT_DRIVER_BUILD 9 +#define TW_CURRENT_DRIVER_BRANCH 4 /* Phase defines */ #define TW_PHASE_INITIAL 0 @@ -332,7 +334,6 @@ static twa_message_type twa_error_table[] = { #define TW_PHASE_SGLIST 2 /* Misc defines */ -#define TW_9550SX_DRAIN_COMPLETED 0xFFFF #define TW_SECTOR_SIZE 512 #define TW_ALIGNMENT_9000 4 /* 4 bytes */ #define TW_ALIGNMENT_9000_SGL 0x3 @@ -416,9 +417,6 @@ static twa_message_type twa_error_table[] = { #ifndef PCI_DEVICE_ID_3WARE_9000 #define PCI_DEVICE_ID_3WARE_9000 0x1002 #endif -#ifndef PCI_DEVICE_ID_3WARE_9550SX -#define PCI_DEVICE_ID_3WARE_9550SX 0x1003 -#endif /* Bitmask macros to eliminate bitfields */ @@ -445,7 +443,6 @@ static twa_message_type twa_error_table[] = { #define TW_STATUS_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0x4) #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)) #define TW_RESPONSE_QUEUE_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0xC) -#define TW_RESPONSE_QUEUE_REG_ADDR_LARGE(x) ((unsigned char __iomem *)x->base_addr + 0x30) #define TW_CLEAR_ALL_INTERRUPTS(x) (writel(TW_STATUS_VALID_INTERRUPT, TW_CONTROL_REG_ADDR(x))) #define TW_CLEAR_ATTENTION_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_ATTENTION_INTERRUPT, TW_CONTROL_REG_ADDR(x))) #define TW_CLEAR_HOST_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_HOST_INTERRUPT, TW_CONTROL_REG_ADDR(x))) diff --git a/trunk/drivers/scsi/Kconfig b/trunk/drivers/scsi/Kconfig index 9c9f162bd6ed..20019b82b4a8 100644 --- a/trunk/drivers/scsi/Kconfig +++ b/trunk/drivers/scsi/Kconfig @@ -489,11 +489,11 @@ config SCSI_SATA_NV If unsure, say N. -config SCSI_PDC_ADMA - tristate "Pacific Digital ADMA support" +config SCSI_SATA_PROMISE + tristate "Promise SATA TX2/TX4 support" depends on SCSI_SATA && PCI help - This option enables support for Pacific Digital ADMA controllers + This option enables support for Promise Serial ATA TX2/TX4. If unsure, say N. @@ -505,14 +505,6 @@ config SCSI_SATA_QSTOR If unsure, say N. -config SCSI_SATA_PROMISE - tristate "Promise SATA TX2/TX4 support" - depends on SCSI_SATA && PCI - help - This option enables support for Promise Serial ATA TX2/TX4. - - If unsure, say N. - config SCSI_SATA_SX4 tristate "Promise SATA SX4 support" depends on SCSI_SATA && PCI && EXPERIMENTAL @@ -529,14 +521,6 @@ config SCSI_SATA_SIL If unsure, say N. -config SCSI_SATA_SIL24 - tristate "Silicon Image 3124/3132 SATA support" - depends on SCSI_SATA && PCI && EXPERIMENTAL - help - This option enables support for Silicon Image 3124/3132 Serial ATA. - - If unsure, say N. - config SCSI_SATA_SIS tristate "SiS 964/180 SATA support" depends on SCSI_SATA && PCI && EXPERIMENTAL @@ -569,11 +553,6 @@ config SCSI_SATA_VITESSE If unsure, say N. -config SCSI_SATA_INTEL_COMBINED - bool - depends on IDE=y && !BLK_DEV_IDE_SATA && (SCSI_SATA_AHCI || SCSI_ATA_PIIX) - default y - config SCSI_BUSLOGIC tristate "BusLogic SCSI support" depends on (PCI || ISA || MCA) && SCSI && ISA_DMA_API diff --git a/trunk/drivers/scsi/Makefile b/trunk/drivers/scsi/Makefile index 2d4439826c08..1e4edbdf2730 100644 --- a/trunk/drivers/scsi/Makefile +++ b/trunk/drivers/scsi/Makefile @@ -99,7 +99,6 @@ obj-$(CONFIG_SCSI_DC395x) += dc395x.o obj-$(CONFIG_SCSI_DC390T) += tmscsim.o obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ -obj-$(CONFIG_MEGARAID_SAS) += megaraid/ obj-$(CONFIG_SCSI_ACARD) += atp870u.o obj-$(CONFIG_SCSI_SUNESP) += esp.o obj-$(CONFIG_SCSI_GDTH) += gdth.o @@ -130,7 +129,6 @@ obj-$(CONFIG_SCSI_ATA_PIIX) += libata.o ata_piix.o obj-$(CONFIG_SCSI_SATA_PROMISE) += libata.o sata_promise.o obj-$(CONFIG_SCSI_SATA_QSTOR) += libata.o sata_qstor.o obj-$(CONFIG_SCSI_SATA_SIL) += libata.o sata_sil.o -obj-$(CONFIG_SCSI_SATA_SIL24) += libata.o sata_sil24.o obj-$(CONFIG_SCSI_SATA_VIA) += libata.o sata_via.o obj-$(CONFIG_SCSI_SATA_VITESSE) += libata.o sata_vsc.o obj-$(CONFIG_SCSI_SATA_SIS) += libata.o sata_sis.o @@ -138,7 +136,6 @@ obj-$(CONFIG_SCSI_SATA_SX4) += libata.o sata_sx4.o obj-$(CONFIG_SCSI_SATA_NV) += libata.o sata_nv.o obj-$(CONFIG_SCSI_SATA_ULI) += libata.o sata_uli.o obj-$(CONFIG_SCSI_SATA_MV) += libata.o sata_mv.o -obj-$(CONFIG_SCSI_PDC_ADMA) += libata.o pdc_adma.o obj-$(CONFIG_ARM) += arm/ diff --git a/trunk/drivers/scsi/aacraid/aachba.c b/trunk/drivers/scsi/aacraid/aachba.c index 93416f760e5a..a8e3dfcd0dc7 100644 --- a/trunk/drivers/scsi/aacraid/aachba.c +++ b/trunk/drivers/scsi/aacraid/aachba.c @@ -313,37 +313,18 @@ int aac_get_containers(struct aac_dev *dev) } dresp = (struct aac_mount *)fib_data(fibptr); - if ((le32_to_cpu(dresp->status) == ST_OK) && - (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) { - dinfo->command = cpu_to_le32(VM_NameServe64); - dinfo->count = cpu_to_le32(index); - dinfo->type = cpu_to_le32(FT_FILESYS); - - if (fib_send(ContainerCommand, - fibptr, - sizeof(struct aac_query_mount), - FsaNormal, - 1, 1, - NULL, NULL) < 0) - continue; - } else - dresp->mnt[0].capacityhigh = 0; - dprintk ((KERN_DEBUG - "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%llu\n", + "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%u\n", (int)index, (int)le32_to_cpu(dresp->status), (int)le32_to_cpu(dresp->mnt[0].vol), (int)le32_to_cpu(dresp->mnt[0].state), - ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + - (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32))); + (unsigned)le32_to_cpu(dresp->mnt[0].capacity))); if ((le32_to_cpu(dresp->status) == ST_OK) && (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) { fsa_dev_ptr[index].valid = 1; fsa_dev_ptr[index].type = le32_to_cpu(dresp->mnt[0].vol); - fsa_dev_ptr[index].size - = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + - (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32); + fsa_dev_ptr[index].size = le32_to_cpu(dresp->mnt[0].capacity); if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) fsa_dev_ptr[index].ro = 1; } @@ -479,7 +460,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid) * is updated in the struct fsa_dev_info structure rather than returned. */ -int probe_container(struct aac_dev *dev, int cid) +static int probe_container(struct aac_dev *dev, int cid) { struct fsa_dev_info *fsa_dev_ptr; int status; @@ -515,30 +496,12 @@ int probe_container(struct aac_dev *dev, int cid) dresp = (struct aac_mount *) fib_data(fibptr); - if ((le32_to_cpu(dresp->status) == ST_OK) && - (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) { - dinfo->command = cpu_to_le32(VM_NameServe64); - dinfo->count = cpu_to_le32(cid); - dinfo->type = cpu_to_le32(FT_FILESYS); - - if (fib_send(ContainerCommand, - fibptr, - sizeof(struct aac_query_mount), - FsaNormal, - 1, 1, - NULL, NULL) < 0) - goto error; - } else - dresp->mnt[0].capacityhigh = 0; - if ((le32_to_cpu(dresp->status) == ST_OK) && (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) { fsa_dev_ptr[cid].valid = 1; fsa_dev_ptr[cid].type = le32_to_cpu(dresp->mnt[0].vol); - fsa_dev_ptr[cid].size - = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + - (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32); + fsa_dev_ptr[cid].size = le32_to_cpu(dresp->mnt[0].capacity); if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) fsa_dev_ptr[cid].ro = 1; } @@ -692,7 +655,7 @@ int aac_get_adapter_info(struct aac_dev* dev) fibptr, sizeof(*info), FsaNormal, - -1, 1, /* First `interrupt' command uses special wait */ + 1, 1, NULL, NULL); @@ -843,8 +806,8 @@ int aac_get_adapter_info(struct aac_dev* dev) if (!(dev->raw_io_interface)) { dev->scsi_host_ptr->sg_tablesize = (dev->max_fib_size - sizeof(struct aac_fibhdr) - - sizeof(struct aac_write) + sizeof(struct sgentry)) / - sizeof(struct sgentry); + sizeof(struct aac_write) + sizeof(struct sgmap)) / + sizeof(struct sgmap); if (dev->dac_support) { /* * 38 scatter gather elements @@ -853,8 +816,8 @@ int aac_get_adapter_info(struct aac_dev* dev) (dev->max_fib_size - sizeof(struct aac_fibhdr) - sizeof(struct aac_write64) + - sizeof(struct sgentry64)) / - sizeof(struct sgentry64); + sizeof(struct sgmap64)) / + sizeof(struct sgmap64); } dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT; if(!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) { @@ -891,40 +854,7 @@ static void io_callback(void *context, struct fib * fibptr) dev = (struct aac_dev *)scsicmd->device->host->hostdata; cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); - if (nblank(dprintk(x))) { - u64 lba; - switch (scsicmd->cmnd[0]) { - case WRITE_6: - case READ_6: - lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | - (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; - break; - case WRITE_16: - case READ_16: - lba = ((u64)scsicmd->cmnd[2] << 56) | - ((u64)scsicmd->cmnd[3] << 48) | - ((u64)scsicmd->cmnd[4] << 40) | - ((u64)scsicmd->cmnd[5] << 32) | - ((u64)scsicmd->cmnd[6] << 24) | - (scsicmd->cmnd[7] << 16) | - (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; - break; - case WRITE_12: - case READ_12: - lba = ((u64)scsicmd->cmnd[2] << 24) | - (scsicmd->cmnd[3] << 16) | - (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; - break; - default: - lba = ((u64)scsicmd->cmnd[2] << 24) | - (scsicmd->cmnd[3] << 16) | - (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; - break; - } - printk(KERN_DEBUG - "io_callback[cpu %d]: lba = %llu, t = %ld.\n", - smp_processor_id(), (unsigned long long)lba, jiffies); - } + 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)); if (fibptr == NULL) BUG(); @@ -965,7 +895,7 @@ static void io_callback(void *context, struct fib * fibptr) static int aac_read(struct scsi_cmnd * scsicmd, int cid) { - u64 lba; + u32 lba; u32 count; int status; @@ -977,69 +907,23 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) /* * Get block address and transfer length */ - switch (scsicmd->cmnd[0]) { - case READ_6: + if (scsicmd->cmnd[0] == READ_6) /* 6 byte command */ + { dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", cid)); - lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | - (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; + lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; count = scsicmd->cmnd[4]; if (count == 0) count = 256; - break; - case READ_16: - dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", cid)); - - lba = ((u64)scsicmd->cmnd[2] << 56) | - ((u64)scsicmd->cmnd[3] << 48) | - ((u64)scsicmd->cmnd[4] << 40) | - ((u64)scsicmd->cmnd[5] << 32) | - ((u64)scsicmd->cmnd[6] << 24) | - (scsicmd->cmnd[7] << 16) | - (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; - count = (scsicmd->cmnd[10] << 24) | - (scsicmd->cmnd[11] << 16) | - (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; - break; - case READ_12: - dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", cid)); - - lba = ((u64)scsicmd->cmnd[2] << 24) | - (scsicmd->cmnd[3] << 16) | - (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; - count = (scsicmd->cmnd[6] << 24) | - (scsicmd->cmnd[7] << 16) | - (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; - break; - default: + } else { dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", cid)); - lba = ((u64)scsicmd->cmnd[2] << 24) | - (scsicmd->cmnd[3] << 16) | - (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; + lba = (scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; - break; } - dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %llu, t = %ld.\n", + dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), (unsigned long long)lba, jiffies)); - if ((!(dev->raw_io_interface) || !(dev->raw_io_64)) && - (lba & 0xffffffff00000000LL)) { - dprintk((KERN_DEBUG "aac_read: Illegal lba\n")); - scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | - SAM_STAT_CHECK_CONDITION; - set_sense((u8 *) &dev->fsa_dev[cid].sense_data, - HARDWARE_ERROR, - SENCODE_INTERNAL_TARGET_FAILURE, - ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, - 0, 0); - memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, - (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer)) - ? sizeof(scsicmd->sense_buffer) - : sizeof(dev->fsa_dev[cid].sense_data)); - scsicmd->scsi_done(scsicmd); - return 0; - } /* * Alocate and initialize a Fib */ @@ -1052,8 +936,8 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) if (dev->raw_io_interface) { struct aac_raw_io *readcmd; readcmd = (struct aac_raw_io *) fib_data(cmd_fibcontext); - readcmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); - readcmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); + readcmd->block[0] = cpu_to_le32(lba); + readcmd->block[1] = 0; readcmd->count = cpu_to_le32(count<<9); readcmd->cid = cpu_to_le16(cid); readcmd->flags = cpu_to_le16(1); @@ -1080,7 +964,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) readcmd->command = cpu_to_le32(VM_CtHostRead64); readcmd->cid = cpu_to_le16(cid); readcmd->sector_count = cpu_to_le16(count); - readcmd->block = cpu_to_le32((u32)(lba&0xffffffff)); + readcmd->block = cpu_to_le32(lba); readcmd->pad = 0; readcmd->flags = 0; @@ -1105,7 +989,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) readcmd = (struct aac_read *) fib_data(cmd_fibcontext); readcmd->command = cpu_to_le32(VM_CtBlockRead); readcmd->cid = cpu_to_le32(cid); - readcmd->block = cpu_to_le32((u32)(lba&0xffffffff)); + readcmd->block = cpu_to_le32(lba); readcmd->count = cpu_to_le32(count * 512); aac_build_sg(scsicmd, &readcmd->sg); @@ -1147,7 +1031,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) static int aac_write(struct scsi_cmnd * scsicmd, int cid) { - u64 lba; + u32 lba; u32 count; int status; u16 fibsize; @@ -1164,48 +1048,13 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) count = scsicmd->cmnd[4]; if (count == 0) count = 256; - } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ - dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", cid)); - - lba = ((u64)scsicmd->cmnd[2] << 56) | - ((u64)scsicmd->cmnd[3] << 48) | - ((u64)scsicmd->cmnd[4] << 40) | - ((u64)scsicmd->cmnd[5] << 32) | - ((u64)scsicmd->cmnd[6] << 24) | - (scsicmd->cmnd[7] << 16) | - (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; - count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | - (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; - } else if (scsicmd->cmnd[0] == WRITE_12) { /* 12 byte command */ - dprintk((KERN_DEBUG "aachba: received a write(12) command on id %d.\n", cid)); - - lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) - | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; - count = (scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16) - | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; } else { dprintk((KERN_DEBUG "aachba: received a write(10) command on id %d.\n", cid)); - lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; + lba = (scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; } - dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %llu, t = %ld.\n", + dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), (unsigned long long)lba, jiffies)); - if ((!(dev->raw_io_interface) || !(dev->raw_io_64)) - && (lba & 0xffffffff00000000LL)) { - dprintk((KERN_DEBUG "aac_write: Illegal lba\n")); - scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; - set_sense((u8 *) &dev->fsa_dev[cid].sense_data, - HARDWARE_ERROR, - SENCODE_INTERNAL_TARGET_FAILURE, - ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, - 0, 0); - memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, - (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer)) - ? sizeof(scsicmd->sense_buffer) - : sizeof(dev->fsa_dev[cid].sense_data)); - scsicmd->scsi_done(scsicmd); - return 0; - } /* * Allocate and initialize a Fib then setup a BlockWrite command */ @@ -1219,8 +1068,8 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) if (dev->raw_io_interface) { struct aac_raw_io *writecmd; writecmd = (struct aac_raw_io *) fib_data(cmd_fibcontext); - writecmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); - writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); + writecmd->block[0] = cpu_to_le32(lba); + writecmd->block[1] = 0; writecmd->count = cpu_to_le32(count<<9); writecmd->cid = cpu_to_le16(cid); writecmd->flags = 0; @@ -1247,7 +1096,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) writecmd->command = cpu_to_le32(VM_CtHostWrite64); writecmd->cid = cpu_to_le16(cid); writecmd->sector_count = cpu_to_le16(count); - writecmd->block = cpu_to_le32((u32)(lba&0xffffffff)); + writecmd->block = cpu_to_le32(lba); writecmd->pad = 0; writecmd->flags = 0; @@ -1272,7 +1121,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) writecmd = (struct aac_write *) fib_data(cmd_fibcontext); writecmd->command = cpu_to_le32(VM_CtBlockWrite); writecmd->cid = cpu_to_le32(cid); - writecmd->block = cpu_to_le32((u32)(lba&0xffffffff)); + writecmd->block = cpu_to_le32(lba); writecmd->count = cpu_to_le32(count * 512); writecmd->sg.count = cpu_to_le32(1); /* ->stable is not used - it did mean which type of write */ @@ -1461,18 +1310,11 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) */ if ((fsa_dev_ptr[cid].valid & 1) == 0) { switch (scsicmd->cmnd[0]) { - case SERVICE_ACTION_IN: - if (!(dev->raw_io_interface) || - !(dev->raw_io_64) || - ((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16)) - break; case INQUIRY: case READ_CAPACITY: case TEST_UNIT_READY: spin_unlock_irq(host->host_lock); probe_container(dev, cid); - if ((fsa_dev_ptr[cid].valid & 1) == 0) - fsa_dev_ptr[cid].valid = 0; spin_lock_irq(host->host_lock); if (fsa_dev_ptr[cid].valid == 0) { scsicmd->result = DID_NO_CONNECT << 16; @@ -1533,6 +1375,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) memset(&inq_data, 0, sizeof (struct inquiry_data)); inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */ + inq_data.inqd_dtq = 0x80; /* set RMB bit to one indicating that the medium is removable */ 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 */ inq_data.inqd_len = 31; /*Format for "pad2" is RelAdr | WBus32 | WBus16 | Sync | Linked |Reserved| CmdQue | SftRe */ @@ -1554,55 +1397,13 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); return aac_get_container_name(scsicmd, cid); } - case SERVICE_ACTION_IN: - if (!(dev->raw_io_interface) || - !(dev->raw_io_64) || - ((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16)) - break; - { - u64 capacity; - char cp[12]; - unsigned int offset = 0; - - dprintk((KERN_DEBUG "READ CAPACITY_16 command.\n")); - capacity = fsa_dev_ptr[cid].size - 1; - if (scsicmd->cmnd[13] > 12) { - offset = scsicmd->cmnd[13] - 12; - if (offset > sizeof(cp)) - break; - memset(cp, 0, offset); - aac_internal_transfer(scsicmd, cp, 0, offset); - } - cp[0] = (capacity >> 56) & 0xff; - cp[1] = (capacity >> 48) & 0xff; - cp[2] = (capacity >> 40) & 0xff; - cp[3] = (capacity >> 32) & 0xff; - cp[4] = (capacity >> 24) & 0xff; - cp[5] = (capacity >> 16) & 0xff; - cp[6] = (capacity >> 8) & 0xff; - cp[7] = (capacity >> 0) & 0xff; - cp[8] = 0; - cp[9] = 0; - cp[10] = 2; - cp[11] = 0; - aac_internal_transfer(scsicmd, cp, offset, sizeof(cp)); - - /* Do not cache partition table for arrays */ - scsicmd->device->removable = 1; - - scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; - scsicmd->scsi_done(scsicmd); - - return 0; - } - case READ_CAPACITY: { u32 capacity; char cp[8]; dprintk((KERN_DEBUG "READ CAPACITY command.\n")); - if (fsa_dev_ptr[cid].size <= 0x100000000ULL) + if (fsa_dev_ptr[cid].size <= 0x100000000LL) capacity = fsa_dev_ptr[cid].size - 1; else capacity = (u32)-1; @@ -1616,8 +1417,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) cp[6] = 2; cp[7] = 0; aac_internal_transfer(scsicmd, cp, 0, sizeof(cp)); - /* Do not cache partition table for arrays */ - scsicmd->device->removable = 1; scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; scsicmd->scsi_done(scsicmd); @@ -1698,8 +1497,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) { case READ_6: case READ_10: - case READ_12: - case READ_16: /* * Hack to keep track of ordinal number of the device that * corresponds to a container. Needed to convert @@ -1707,19 +1504,17 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) */ spin_unlock_irq(host->host_lock); - if (scsicmd->request->rq_disk) - strlcpy(fsa_dev_ptr[cid].devname, - scsicmd->request->rq_disk->disk_name, - min(sizeof(fsa_dev_ptr[cid].devname), - sizeof(scsicmd->request->rq_disk->disk_name) + 1)); + if (scsicmd->request->rq_disk) + memcpy(fsa_dev_ptr[cid].devname, + scsicmd->request->rq_disk->disk_name, + 8); + ret = aac_read(scsicmd, cid); spin_lock_irq(host->host_lock); return ret; case WRITE_6: case WRITE_10: - case WRITE_12: - case WRITE_16: spin_unlock_irq(host->host_lock); ret = aac_write(scsicmd, cid); spin_lock_irq(host->host_lock); @@ -1950,8 +1745,6 @@ static void aac_srb_callback(void *context, struct fib * fibptr) case WRITE_10: case READ_12: case WRITE_12: - case READ_16: - case WRITE_16: if(le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow ) { printk(KERN_WARNING"aacraid: SCSI CMD underflow\n"); } else { @@ -2057,8 +1850,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr) sizeof(scsicmd->sense_buffer) : le32_to_cpu(srbreply->sense_data_size); #ifdef AAC_DETAILED_STATUS_INFO - printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n", - le32_to_cpu(srbreply->status), len); + dprintk((KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n", + le32_to_cpu(srbreply->status), len)); #endif memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); diff --git a/trunk/drivers/scsi/aacraid/aacraid.h b/trunk/drivers/scsi/aacraid/aacraid.h index 4a99d2f000f4..e40528185d48 100644 --- a/trunk/drivers/scsi/aacraid/aacraid.h +++ b/trunk/drivers/scsi/aacraid/aacraid.h @@ -1,10 +1,6 @@ #if (!defined(dprintk)) # define dprintk(x) #endif -/* eg: if (nblank(dprintk(x))) */ -#define _nblank(x) #x -#define nblank(x) _nblank(x)[0] - /*------------------------------------------------------------------------------ * D E F I N E S @@ -306,6 +302,7 @@ enum aac_queue_types { */ #define FsaNormal 1 +#define FsaHigh 2 /* * Define the FIB. The FIB is the where all the requested data and @@ -549,6 +546,8 @@ struct aac_queue { /* This is only valid for adapter to host command queues. */ spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */ + unsigned long SavedIrql; /* Previous IRQL when the spin lock is taken */ + u32 padding; /* Padding - FIXME - can remove I believe */ struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ /* only valid for command queues which receive entries from the adapter. */ struct list_head pendingq; /* A queue of outstanding fib's to the adapter. */ @@ -777,9 +776,7 @@ struct fsa_dev_info { u64 last; u64 size; u32 type; - u32 config_waiting_on; u16 queue_depth; - u8 config_needed; u8 valid; u8 ro; u8 locked; @@ -1015,7 +1012,6 @@ struct aac_dev /* macro side-effects BEWARE */ # define raw_io_interface \ init->InitStructRevision==cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_4) - u8 raw_io_64; u8 printf_enabled; }; @@ -1366,10 +1362,8 @@ struct aac_srb_reply #define VM_CtBlockVerify64 18 #define VM_CtHostRead64 19 #define VM_CtHostWrite64 20 -#define VM_DrvErrTblLog 21 -#define VM_NameServe64 22 -#define MAX_VMCOMMAND_NUM 23 /* used for sizing stats array - leave last */ +#define MAX_VMCOMMAND_NUM 21 /* used for sizing stats array - leave last */ /* * Descriptive information (eg, vital stats) @@ -1478,7 +1472,6 @@ struct aac_mntent { manager (eg, filesystem) */ __le32 altoid; /* != oid <==> snapshot or broken mirror exists */ - __le32 capacityhigh; }; #define FSCS_NOTCLEAN 0x0001 /* fsck is neccessary before mounting */ @@ -1714,7 +1707,6 @@ extern struct aac_common aac_config; #define AifCmdJobProgress 2 /* Progress report */ #define AifJobCtrZero 101 /* Array Zero progress */ #define AifJobStsSuccess 1 /* Job completes */ -#define AifJobStsRunning 102 /* Job running */ #define AifCmdAPIReport 3 /* Report from other user of API */ #define AifCmdDriverNotify 4 /* Notify host driver of event */ #define AifDenMorphComplete 200 /* A morph operation completed */ @@ -1785,7 +1777,6 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size); struct aac_driver_ident* aac_get_driver_ident(int devtype); int aac_get_adapter_info(struct aac_dev* dev); int aac_send_shutdown(struct aac_dev *dev); -int probe_container(struct aac_dev *dev, int cid); extern int numacb; extern int acbsize; extern char aac_driver_version[]; diff --git a/trunk/drivers/scsi/aacraid/comminit.c b/trunk/drivers/scsi/aacraid/comminit.c index 59a341b2aedc..75abd0453289 100644 --- a/trunk/drivers/scsi/aacraid/comminit.c +++ b/trunk/drivers/scsi/aacraid/comminit.c @@ -195,7 +195,7 @@ int aac_send_shutdown(struct aac_dev * dev) fibctx, sizeof(struct aac_close), FsaNormal, - -2 /* Timeout silently */, 1, + 1, 1, NULL, NULL); if (status == 0) @@ -313,15 +313,8 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) dev->max_fib_size = sizeof(struct hw_fib); dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size - sizeof(struct aac_fibhdr) - - sizeof(struct aac_write) + sizeof(struct sgentry)) - / sizeof(struct sgentry); - dev->raw_io_64 = 0; - if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES, - 0, 0, 0, 0, 0, 0, status+0, status+1, status+2, NULL, NULL)) && - (status[0] == 0x00000001)) { - if (status[1] & AAC_OPT_NEW_COMM_64) - dev->raw_io_64 = 1; - } + - sizeof(struct aac_write) + sizeof(struct sgmap)) + / sizeof(struct sgmap); if ((!aac_adapter_sync_cmd(dev, GET_COMM_PREFERRED_SETTINGS, 0, 0, 0, 0, 0, 0, status+0, status+1, status+2, status+3, status+4)) @@ -349,8 +342,8 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) dev->max_fib_size = 512; dev->sg_tablesize = host->sg_tablesize = (512 - sizeof(struct aac_fibhdr) - - sizeof(struct aac_write) + sizeof(struct sgentry)) - / sizeof(struct sgentry); + - sizeof(struct aac_write) + sizeof(struct sgmap)) + / sizeof(struct sgmap); host->can_queue = AAC_NUM_IO_FIB; } else if (acbsize == 2048) { host->max_sectors = 512; diff --git a/trunk/drivers/scsi/aacraid/commsup.c b/trunk/drivers/scsi/aacraid/commsup.c index e4d543a474ae..a1d303f03480 100644 --- a/trunk/drivers/scsi/aacraid/commsup.c +++ b/trunk/drivers/scsi/aacraid/commsup.c @@ -39,9 +39,7 @@ #include #include #include -#include #include -#include #include "aacraid.h" @@ -271,22 +269,40 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entr /* Interrupt Moderation, only interrupt for first two entries */ if (idx != le32_to_cpu(*(q->headers.consumer))) { if (--idx == 0) { - if (qid == AdapNormCmdQueue) + if (qid == AdapHighCmdQueue) + idx = ADAP_HIGH_CMD_ENTRIES; + else if (qid == AdapNormCmdQueue) idx = ADAP_NORM_CMD_ENTRIES; - else + else if (qid == AdapHighRespQueue) + idx = ADAP_HIGH_RESP_ENTRIES; + else if (qid == AdapNormRespQueue) idx = ADAP_NORM_RESP_ENTRIES; } if (idx != le32_to_cpu(*(q->headers.consumer))) *nonotify = 1; } - if (qid == AdapNormCmdQueue) { + if (qid == AdapHighCmdQueue) { + if (*index >= ADAP_HIGH_CMD_ENTRIES) + *index = 0; + } else if (qid == AdapNormCmdQueue) { if (*index >= ADAP_NORM_CMD_ENTRIES) *index = 0; /* Wrap to front of the Producer Queue. */ - } else { + } + else if (qid == AdapHighRespQueue) + { + if (*index >= ADAP_HIGH_RESP_ENTRIES) + *index = 0; + } + else if (qid == AdapNormRespQueue) + { if (*index >= ADAP_NORM_RESP_ENTRIES) *index = 0; /* Wrap to front of the Producer Queue. */ } + else { + printk("aacraid: invalid qid\n"); + BUG(); + } if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { /* Queue is full */ printk(KERN_WARNING "Queue %d full, %u outstanding.\n", @@ -318,8 +334,12 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f { struct aac_entry * entry = NULL; int map = 0; + struct aac_queue * q = &dev->queues->queue[qid]; + + spin_lock_irqsave(q->lock, q->SavedIrql); - if (qid == AdapNormCmdQueue) { + if (qid == AdapHighCmdQueue || qid == AdapNormCmdQueue) + { /* if no entries wait for some if caller wants to */ while (!aac_get_entry(dev, qid, &entry, index, nonotify)) { @@ -330,7 +350,9 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f */ entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); map = 1; - } else { + } + else if (qid == AdapHighRespQueue || qid == AdapNormRespQueue) + { while(!aac_get_entry(dev, qid, &entry, index, nonotify)) { /* if no entries wait for some if caller wants to */ @@ -353,6 +375,42 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f return 0; } + +/** + * aac_insert_entry - insert a queue entry + * @dev: Adapter + * @index: Index of entry to insert + * @qid: Queue number + * @nonotify: Suppress adapter notification + * + * Gets the next free QE off the requested priorty adapter command + * queue and associates the Fib with the QE. The QE represented by + * index is ready to insert on the queue when this routine returns + * success. + */ + +static int aac_insert_entry(struct aac_dev * dev, u32 index, u32 qid, unsigned long nonotify) +{ + struct aac_queue * q = &dev->queues->queue[qid]; + + if(q == NULL) + BUG(); + *(q->headers.producer) = cpu_to_le32(index + 1); + spin_unlock_irqrestore(q->lock, q->SavedIrql); + + if (qid == AdapHighCmdQueue || + qid == AdapNormCmdQueue || + qid == AdapHighRespQueue || + qid == AdapNormRespQueue) + { + if (!nonotify) + aac_adapter_notify(dev, qid); + } + else + printk("Suprise insert!\n"); + return 0; +} + /* * Define the highest level of host to adapter communication routines. * These routines will support host to adapter FS commuication. These @@ -381,13 +439,12 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority, int wait, int reply, fib_callback callback, void * callback_data) { u32 index; + u32 qid; struct aac_dev * dev = fibptr->dev; unsigned long nointr = 0; struct hw_fib * hw_fib = fibptr->hw_fib; struct aac_queue * q; unsigned long flags = 0; - unsigned long qflags; - if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned))) return -EBUSY; /* @@ -440,8 +497,26 @@ int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority * Get a queue entry connect the FIB to it and send an notify * the adapter a command is ready. */ - hw_fib->header.XferState |= cpu_to_le32(NormalPriority); + if (priority == FsaHigh) { + hw_fib->header.XferState |= cpu_to_le32(HighPriority); + qid = AdapHighCmdQueue; + } else { + hw_fib->header.XferState |= cpu_to_le32(NormalPriority); + qid = AdapNormCmdQueue; + } + q = &dev->queues->queue[qid]; + if(wait) + spin_lock_irqsave(&fibptr->event_lock, flags); + if(aac_queue_get( dev, &index, qid, hw_fib, 1, fibptr, &nointr)<0) + return -EWOULDBLOCK; + dprintk((KERN_DEBUG "fib_send: inserting a queue entry at index %d.\n",index)); + dprintk((KERN_DEBUG "Fib contents:.\n")); + dprintk((KERN_DEBUG " Command = %d.\n", hw_fib->header.Command)); + dprintk((KERN_DEBUG " XferState = %x.\n", hw_fib->header.XferState)); + dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib)); + dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa)); + dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr)); /* * Fill in the Callback and CallbackContext if we are not * going to wait. @@ -450,67 +525,22 @@ int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority fibptr->callback = callback; fibptr->callback_data = callback_data; } + FIB_COUNTER_INCREMENT(aac_config.FibsSent); + list_add_tail(&fibptr->queue, &q->pendingq); + q->numpending++; fibptr->done = 0; fibptr->flags = 0; - FIB_COUNTER_INCREMENT(aac_config.FibsSent); - - dprintk((KERN_DEBUG "fib_send: inserting a queue entry at index %d.\n",index)); - dprintk((KERN_DEBUG "Fib contents:.\n")); - dprintk((KERN_DEBUG " Command = %d.\n", hw_fib->header.Command)); - dprintk((KERN_DEBUG " XferState = %x.\n", hw_fib->header.XferState)); - dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib)); - dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa)); - dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr)); - - q = &dev->queues->queue[AdapNormCmdQueue]; - - if(wait) - spin_lock_irqsave(&fibptr->event_lock, flags); - spin_lock_irqsave(q->lock, qflags); - aac_queue_get( dev, &index, AdapNormCmdQueue, hw_fib, 1, fibptr, &nointr); - - list_add_tail(&fibptr->queue, &q->pendingq); - q->numpending++; - *(q->headers.producer) = cpu_to_le32(index + 1); - spin_unlock_irqrestore(q->lock, qflags); - if (!(nointr & aac_config.irq_mod)) - aac_adapter_notify(dev, AdapNormCmdQueue); + if(aac_insert_entry(dev, index, qid, (nointr & aac_config.irq_mod)) < 0) + return -EWOULDBLOCK; /* * If the caller wanted us to wait for response wait now. */ if (wait) { spin_unlock_irqrestore(&fibptr->event_lock, flags); - /* Only set for first known interruptable command */ - if (wait < 0) { - /* - * *VERY* Dangerous to time out a command, the - * assumption is made that we have no hope of - * functioning because an interrupt routing or other - * hardware failure has occurred. - */ - unsigned long count = 36000000L; /* 3 minutes */ - unsigned long qflags; - while (down_trylock(&fibptr->event_wait)) { - if (--count == 0) { - spin_lock_irqsave(q->lock, qflags); - q->numpending--; - list_del(&fibptr->queue); - spin_unlock_irqrestore(q->lock, qflags); - if (wait == -1) { - printk(KERN_ERR "aacraid: fib_send: first asynchronous command timed out.\n" - "Usually a result of a PCI interrupt routing problem;\n" - "update mother board BIOS or consider utilizing one of\n" - "the SAFE mode kernel options (acpi, apic etc)\n"); - } - return -ETIMEDOUT; - } - udelay(5); - } - } else - down(&fibptr->event_wait); + down(&fibptr->event_wait); if(fibptr->done == 0) BUG(); @@ -592,9 +622,15 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid) case HostNormCmdQueue: notify = HostNormCmdNotFull; break; + case HostHighCmdQueue: + notify = HostHighCmdNotFull; + break; case HostNormRespQueue: notify = HostNormRespNotFull; break; + case HostHighRespQueue: + notify = HostHighRespNotFull; + break; default: BUG(); return; @@ -616,13 +652,9 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size) { struct hw_fib * hw_fib = fibptr->hw_fib; struct aac_dev * dev = fibptr->dev; - struct aac_queue * q; unsigned long nointr = 0; - unsigned long qflags; - - if (hw_fib->header.XferState == 0) { + if (hw_fib->header.XferState == 0) return 0; - } /* * If we plan to do anything check the structure type first. */ @@ -637,21 +669,37 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size) * send the completed cdb to the adapter. */ if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) { - u32 index; hw_fib->header.XferState |= cpu_to_le32(HostProcessed); - if (size) { - size += sizeof(struct aac_fibhdr); - if (size > le16_to_cpu(hw_fib->header.SenderSize)) - return -EMSGSIZE; - hw_fib->header.Size = cpu_to_le16(size); + if (hw_fib->header.XferState & cpu_to_le32(HighPriority)) { + u32 index; + if (size) + { + size += sizeof(struct aac_fibhdr); + if (size > le16_to_cpu(hw_fib->header.SenderSize)) + return -EMSGSIZE; + hw_fib->header.Size = cpu_to_le16(size); + } + if(aac_queue_get(dev, &index, AdapHighRespQueue, hw_fib, 1, NULL, &nointr) < 0) { + return -EWOULDBLOCK; + } + if (aac_insert_entry(dev, index, AdapHighRespQueue, (nointr & (int)aac_config.irq_mod)) != 0) { + } + } else if (hw_fib->header.XferState & + cpu_to_le32(NormalPriority)) { + u32 index; + + if (size) { + size += sizeof(struct aac_fibhdr); + if (size > le16_to_cpu(hw_fib->header.SenderSize)) + return -EMSGSIZE; + hw_fib->header.Size = cpu_to_le16(size); + } + if (aac_queue_get(dev, &index, AdapNormRespQueue, hw_fib, 1, NULL, &nointr) < 0) + return -EWOULDBLOCK; + if (aac_insert_entry(dev, index, AdapNormRespQueue, (nointr & (int)aac_config.irq_mod)) != 0) + { + } } - q = &dev->queues->queue[AdapNormRespQueue]; - spin_lock_irqsave(q->lock, qflags); - aac_queue_get(dev, &index, AdapNormRespQueue, hw_fib, 1, NULL, &nointr); - *(q->headers.producer) = cpu_to_le32(index + 1); - spin_unlock_irqrestore(q->lock, qflags); - if (!(nointr & (int)aac_config.irq_mod)) - aac_adapter_notify(dev, AdapNormRespQueue); } else { @@ -743,268 +791,6 @@ void aac_printf(struct aac_dev *dev, u32 val) memset(cp, 0, 256); } - -/** - * aac_handle_aif - Handle a message from the firmware - * @dev: Which adapter this fib is from - * @fibptr: Pointer to fibptr from adapter - * - * This routine handles a driver notify fib from the adapter and - * dispatches it to the appropriate routine for handling. - */ - -static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) -{ - struct hw_fib * hw_fib = fibptr->hw_fib; - struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data; - int busy; - u32 container; - struct scsi_device *device; - enum { - NOTHING, - DELETE, - ADD, - CHANGE - } device_config_needed; - - /* Sniff for container changes */ - - if (!dev) - return; - container = (u32)-1; - - /* - * We have set this up to try and minimize the number of - * re-configures that take place. As a result of this when - * certain AIF's come in we will set a flag waiting for another - * type of AIF before setting the re-config flag. - */ - switch (le32_to_cpu(aifcmd->command)) { - case AifCmdDriverNotify: - switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) { - /* - * Morph or Expand complete - */ - case AifDenMorphComplete: - case AifDenVolumeExtendComplete: - container = le32_to_cpu(((u32 *)aifcmd->data)[1]); - if (container >= dev->maximum_num_containers) - break; - - /* - * Find the Scsi_Device associated with the SCSI - * address. Make sure we have the right array, and if - * so set the flag to initiate a new re-config once we - * see an AifEnConfigChange AIF come through. - */ - - if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) { - device = scsi_device_lookup(dev->scsi_host_ptr, - CONTAINER_TO_CHANNEL(container), - CONTAINER_TO_ID(container), - CONTAINER_TO_LUN(container)); - if (device) { - dev->fsa_dev[container].config_needed = CHANGE; - dev->fsa_dev[container].config_waiting_on = AifEnConfigChange; - scsi_device_put(device); - } - } - } - - /* - * If we are waiting on something and this happens to be - * that thing then set the re-configure flag. - */ - if (container != (u32)-1) { - if (container >= dev->maximum_num_containers) - break; - if (dev->fsa_dev[container].config_waiting_on == - le32_to_cpu(*(u32 *)aifcmd->data)) - dev->fsa_dev[container].config_waiting_on = 0; - } else for (container = 0; - container < dev->maximum_num_containers; ++container) { - if (dev->fsa_dev[container].config_waiting_on == - le32_to_cpu(*(u32 *)aifcmd->data)) - dev->fsa_dev[container].config_waiting_on = 0; - } - break; - - case AifCmdEventNotify: - switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) { - /* - * Add an Array. - */ - case AifEnAddContainer: - container = le32_to_cpu(((u32 *)aifcmd->data)[1]); - if (container >= dev->maximum_num_containers) - break; - dev->fsa_dev[container].config_needed = ADD; - dev->fsa_dev[container].config_waiting_on = - AifEnConfigChange; - break; - - /* - * Delete an Array. - */ - case AifEnDeleteContainer: - container = le32_to_cpu(((u32 *)aifcmd->data)[1]); - if (container >= dev->maximum_num_containers) - break; - dev->fsa_dev[container].config_needed = DELETE; - dev->fsa_dev[container].config_waiting_on = - AifEnConfigChange; - break; - - /* - * Container change detected. If we currently are not - * waiting on something else, setup to wait on a Config Change. - */ - case AifEnContainerChange: - container = le32_to_cpu(((u32 *)aifcmd->data)[1]); - if (container >= dev->maximum_num_containers) - break; - if (dev->fsa_dev[container].config_waiting_on) - break; - dev->fsa_dev[container].config_needed = CHANGE; - dev->fsa_dev[container].config_waiting_on = - AifEnConfigChange; - break; - - case AifEnConfigChange: - break; - - } - - /* - * If we are waiting on something and this happens to be - * that thing then set the re-configure flag. - */ - if (container != (u32)-1) { - if (container >= dev->maximum_num_containers) - break; - if (dev->fsa_dev[container].config_waiting_on == - le32_to_cpu(*(u32 *)aifcmd->data)) - dev->fsa_dev[container].config_waiting_on = 0; - } else for (container = 0; - container < dev->maximum_num_containers; ++container) { - if (dev->fsa_dev[container].config_waiting_on == - le32_to_cpu(*(u32 *)aifcmd->data)) - dev->fsa_dev[container].config_waiting_on = 0; - } - break; - - case AifCmdJobProgress: - /* - * These are job progress AIF's. When a Clear is being - * done on a container it is initially created then hidden from - * the OS. When the clear completes we don't get a config - * change so we monitor the job status complete on a clear then - * wait for a container change. - */ - - if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) - && ((((u32 *)aifcmd->data)[6] == ((u32 *)aifcmd->data)[5]) - || (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess)))) { - for (container = 0; - container < dev->maximum_num_containers; - ++container) { - /* - * Stomp on all config sequencing for all - * containers? - */ - dev->fsa_dev[container].config_waiting_on = - AifEnContainerChange; - dev->fsa_dev[container].config_needed = ADD; - } - } - if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) - && (((u32 *)aifcmd->data)[6] == 0) - && (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning))) { - for (container = 0; - container < dev->maximum_num_containers; - ++container) { - /* - * Stomp on all config sequencing for all - * containers? - */ - dev->fsa_dev[container].config_waiting_on = - AifEnContainerChange; - dev->fsa_dev[container].config_needed = DELETE; - } - } - break; - } - - device_config_needed = NOTHING; - for (container = 0; container < dev->maximum_num_containers; - ++container) { - if ((dev->fsa_dev[container].config_waiting_on == 0) - && (dev->fsa_dev[container].config_needed != NOTHING)) { - device_config_needed = - dev->fsa_dev[container].config_needed; - dev->fsa_dev[container].config_needed = NOTHING; - break; - } - } - if (device_config_needed == NOTHING) - return; - - /* - * If we decided that a re-configuration needs to be done, - * schedule it here on the way out the door, please close the door - * behind you. - */ - - busy = 0; - - - /* - * Find the Scsi_Device associated with the SCSI address, - * and mark it as changed, invalidating the cache. This deals - * with changes to existing device IDs. - */ - - if (!dev || !dev->scsi_host_ptr) - return; - /* - * force reload of disk info via probe_container - */ - if ((device_config_needed == CHANGE) - && (dev->fsa_dev[container].valid == 1)) - dev->fsa_dev[container].valid = 2; - if ((device_config_needed == CHANGE) || - (device_config_needed == ADD)) - probe_container(dev, container); - device = scsi_device_lookup(dev->scsi_host_ptr, - CONTAINER_TO_CHANNEL(container), - CONTAINER_TO_ID(container), - CONTAINER_TO_LUN(container)); - if (device) { - switch (device_config_needed) { - case DELETE: - scsi_remove_device(device); - break; - case CHANGE: - if (!dev->fsa_dev[container].valid) { - scsi_remove_device(device); - break; - } - scsi_rescan_device(&device->sdev_gendev); - - default: - break; - } - scsi_device_put(device); - } - if (device_config_needed == ADD) { - scsi_add_device(dev->scsi_host_ptr, - CONTAINER_TO_CHANNEL(container), - CONTAINER_TO_ID(container), - CONTAINER_TO_LUN(container)); - } - -} - /** * aac_command_thread - command processing thread * @dev: Adapter to monitor @@ -1019,6 +805,7 @@ int aac_command_thread(struct aac_dev * dev) { struct hw_fib *hw_fib, *hw_newfib; struct fib *fib, *newfib; + struct aac_queue_block *queues = dev->queues; struct aac_fib_context *fibctx; unsigned long flags; DECLARE_WAITQUEUE(wait, current); @@ -1038,22 +825,21 @@ int aac_command_thread(struct aac_dev * dev) * Let the DPC know it has a place to send the AIF's to. */ dev->aif_thread = 1; - add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); + add_wait_queue(&queues->queue[HostNormCmdQueue].cmdready, &wait); set_current_state(TASK_INTERRUPTIBLE); - dprintk ((KERN_INFO "aac_command_thread start\n")); while(1) { - spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); - while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { + spin_lock_irqsave(queues->queue[HostNormCmdQueue].lock, flags); + while(!list_empty(&(queues->queue[HostNormCmdQueue].cmdq))) { struct list_head *entry; struct aac_aifcmd * aifcmd; set_current_state(TASK_RUNNING); - - entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; - list_del(entry); - spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); + entry = queues->queue[HostNormCmdQueue].cmdq.next; + list_del(entry); + + spin_unlock_irqrestore(queues->queue[HostNormCmdQueue].lock, flags); fib = list_entry(entry, struct fib, fiblink); /* * We will process the FIB here or pass it to a @@ -1074,7 +860,6 @@ int aac_command_thread(struct aac_dev * dev) aifcmd = (struct aac_aifcmd *) hw_fib->data; if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) { /* Handle Driver Notify Events */ - aac_handle_aif(dev, fib); *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); fib_adapter_complete(fib, (u16)sizeof(u32)); } else { @@ -1084,62 +869,9 @@ int aac_command_thread(struct aac_dev * dev) u32 time_now, time_last; unsigned long flagv; - unsigned num; - struct hw_fib ** hw_fib_pool, ** hw_fib_p; - struct fib ** fib_pool, ** fib_p; - - /* Sniff events */ - if ((aifcmd->command == - cpu_to_le32(AifCmdEventNotify)) || - (aifcmd->command == - cpu_to_le32(AifCmdJobProgress))) { - aac_handle_aif(dev, fib); - } - + time_now = jiffies/HZ; - /* - * Warning: no sleep allowed while - * holding spinlock. We take the estimate - * and pre-allocate a set of fibs outside the - * lock. - */ - num = le32_to_cpu(dev->init->AdapterFibsSize) - / sizeof(struct hw_fib); /* some extra */ - spin_lock_irqsave(&dev->fib_lock, flagv); - entry = dev->fib_list.next; - while (entry != &dev->fib_list) { - entry = entry->next; - ++num; - } - spin_unlock_irqrestore(&dev->fib_lock, flagv); - hw_fib_pool = NULL; - fib_pool = NULL; - if (num - && ((hw_fib_pool = kmalloc(sizeof(struct hw_fib *) * num, GFP_KERNEL))) - && ((fib_pool = kmalloc(sizeof(struct fib *) * num, GFP_KERNEL)))) { - hw_fib_p = hw_fib_pool; - fib_p = fib_pool; - while (hw_fib_p < &hw_fib_pool[num]) { - if (!(*(hw_fib_p++) = kmalloc(sizeof(struct hw_fib), GFP_KERNEL))) { - --hw_fib_p; - break; - } - if (!(*(fib_p++) = kmalloc(sizeof(struct fib), GFP_KERNEL))) { - kfree(*(--hw_fib_p)); - break; - } - } - if ((num = hw_fib_p - hw_fib_pool) == 0) { - kfree(fib_pool); - fib_pool = NULL; - kfree(hw_fib_pool); - hw_fib_pool = NULL; - } - } else if (hw_fib_pool) { - kfree(hw_fib_pool); - hw_fib_pool = NULL; - } spin_lock_irqsave(&dev->fib_lock, flagv); entry = dev->fib_list.next; /* @@ -1148,8 +880,6 @@ int aac_command_thread(struct aac_dev * dev) * fib, and then set the event to wake up the * thread that is waiting for it. */ - hw_fib_p = hw_fib_pool; - fib_p = fib_pool; while (entry != &dev->fib_list) { /* * Extract the fibctx @@ -1182,11 +912,9 @@ int aac_command_thread(struct aac_dev * dev) * Warning: no sleep allowed while * holding spinlock */ - if (hw_fib_p < &hw_fib_pool[num]) { - hw_newfib = *hw_fib_p; - *(hw_fib_p++) = NULL; - newfib = *fib_p; - *(fib_p++) = NULL; + hw_newfib = kmalloc(sizeof(struct hw_fib), GFP_ATOMIC); + newfib = kmalloc(sizeof(struct fib), GFP_ATOMIC); + if (newfib && hw_newfib) { /* * Make the copy of the FIB */ @@ -1201,11 +929,15 @@ int aac_command_thread(struct aac_dev * dev) fibctx->count++; /* * Set the event to wake up the - * thread that is waiting. + * thread that will waiting. */ up(&fibctx->wait_sem); } else { printk(KERN_WARNING "aifd: didn't allocate NewFib.\n"); + if(newfib) + kfree(newfib); + if(hw_newfib) + kfree(hw_newfib); } entry = entry->next; } @@ -1215,38 +947,21 @@ int aac_command_thread(struct aac_dev * dev) *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); fib_adapter_complete(fib, sizeof(u32)); spin_unlock_irqrestore(&dev->fib_lock, flagv); - /* Free up the remaining resources */ - hw_fib_p = hw_fib_pool; - fib_p = fib_pool; - while (hw_fib_p < &hw_fib_pool[num]) { - if (*hw_fib_p) - kfree(*hw_fib_p); - if (*fib_p) - kfree(*fib_p); - ++fib_p; - ++hw_fib_p; - } - if (hw_fib_pool) - kfree(hw_fib_pool); - if (fib_pool) - kfree(fib_pool); } + spin_lock_irqsave(queues->queue[HostNormCmdQueue].lock, flags); kfree(fib); - spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); } /* * There are no more AIF's */ - spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); + spin_unlock_irqrestore(queues->queue[HostNormCmdQueue].lock, flags); schedule(); if(signal_pending(current)) break; set_current_state(TASK_INTERRUPTIBLE); } - if (dev->queues) - remove_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); + remove_wait_queue(&queues->queue[HostNormCmdQueue].cmdready, &wait); dev->aif_thread = 0; complete_and_exit(&dev->aif_completion, 0); - return 0; } diff --git a/trunk/drivers/scsi/aacraid/linit.c b/trunk/drivers/scsi/aacraid/linit.c index a1f9ceef0ac9..4ff29d7f5825 100644 --- a/trunk/drivers/scsi/aacraid/linit.c +++ b/trunk/drivers/scsi/aacraid/linit.c @@ -453,9 +453,9 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) /* * We can exit If all the commands are complete */ - spin_unlock_irq(host->host_lock); if (active == 0) return SUCCESS; + spin_unlock_irq(host->host_lock); ssleep(1); spin_lock_irq(host->host_lock); } @@ -748,8 +748,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, unique_id++; } - error = pci_enable_device(pdev); - if (error) + if (pci_enable_device(pdev)) goto out; if (pci_set_dma_mask(pdev, 0xFFFFFFFFULL) || @@ -773,7 +772,6 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, shost->irq = pdev->irq; shost->base = pci_resource_start(pdev, 0); shost->unique_id = unique_id; - shost->max_cmd_len = 16; aac = (struct aac_dev *)shost->hostdata; aac->scsi_host_ptr = shost; @@ -801,9 +799,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, goto out_free_fibs; aac->maximum_num_channels = aac_drivers[index].channels; - error = aac_get_adapter_info(aac); - if (error < 0) - goto out_deinit; + aac_get_adapter_info(aac); /* * Lets override negotiations and drop the maximum SG limit to 34 @@ -931,8 +927,8 @@ static int __init aac_init(void) printk(KERN_INFO "Adaptec %s driver (%s)\n", AAC_DRIVERNAME, aac_driver_version); - error = pci_register_driver(&aac_pci_driver); - if (error < 0) + error = pci_module_init(&aac_pci_driver); + if (error) return error; aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops); diff --git a/trunk/drivers/scsi/ahci.c b/trunk/drivers/scsi/ahci.c index f0d8f89b5d40..c2c8fa828e24 100644 --- a/trunk/drivers/scsi/ahci.c +++ b/trunk/drivers/scsi/ahci.c @@ -314,15 +314,8 @@ static int ahci_port_start(struct ata_port *ap) return -ENOMEM; memset(pp, 0, sizeof(*pp)); - ap->pad = dma_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ, &ap->pad_dma, GFP_KERNEL); - if (!ap->pad) { - kfree(pp); - return -ENOMEM; - } - mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL); if (!mem) { - dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); kfree(pp); return -ENOMEM; } @@ -398,7 +391,6 @@ static void ahci_port_stop(struct ata_port *ap) ap->private_data = NULL; dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, pp->cmd_slot, pp->cmd_slot_dma); - dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); kfree(pp); } @@ -484,23 +476,23 @@ static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf) static void ahci_fill_sg(struct ata_queued_cmd *qc) { struct ahci_port_priv *pp = qc->ap->private_data; - struct scatterlist *sg; - struct ahci_sg *ahci_sg; + unsigned int i; VPRINTK("ENTER\n"); /* * Next, the S/G list. */ - ahci_sg = pp->cmd_tbl_sg; - ata_for_each_sg(sg, qc) { - dma_addr_t addr = sg_dma_address(sg); - u32 sg_len = sg_dma_len(sg); - - ahci_sg->addr = cpu_to_le32(addr & 0xffffffff); - ahci_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16); - ahci_sg->flags_size = cpu_to_le32(sg_len - 1); - ahci_sg++; + for (i = 0; i < qc->n_elem; i++) { + u32 sg_len; + dma_addr_t addr; + + addr = sg_dma_address(&qc->sg[i]); + sg_len = sg_dma_len(&qc->sg[i]); + + pp->cmd_tbl_sg[i].addr = cpu_to_le32(addr & 0xffffffff); + pp->cmd_tbl_sg[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); + pp->cmd_tbl_sg[i].flags_size = cpu_to_le32(sg_len - 1); } } @@ -680,36 +672,17 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * for (i = 0; i < host_set->n_ports; i++) { struct ata_port *ap; + u32 tmp; - if (!(irq_stat & (1 << i))) - continue; - + VPRINTK("port %u\n", i); ap = host_set->ports[i]; - if (ap) { + tmp = irq_stat & (1 << i); + if (tmp && ap) { struct ata_queued_cmd *qc; qc = ata_qc_from_tag(ap, ap->active_tag); - if (!ahci_host_intr(ap, qc)) - if (ata_ratelimit()) { - struct pci_dev *pdev = - to_pci_dev(ap->host_set->dev); - printk(KERN_WARNING - "ahci(%s): unhandled interrupt on port %u\n", - pci_name(pdev), i); - } - - VPRINTK("port %u\n", i); - } else { - VPRINTK("port %u (no irq)\n", i); - if (ata_ratelimit()) { - struct pci_dev *pdev = - to_pci_dev(ap->host_set->dev); - printk(KERN_WARNING - "ahci(%s): interrupt on disabled port %u\n", - pci_name(pdev), i); - } + if (ahci_host_intr(ap, qc)) + irq_ack |= (1 << i); } - - irq_ack |= (1 << i); } if (irq_ack) { diff --git a/trunk/drivers/scsi/aic7xxx/aic7770_osm.c b/trunk/drivers/scsi/aic7xxx/aic7770_osm.c index d754b3267863..70c5fb59c9ea 100644 --- a/trunk/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/trunk/drivers/scsi/aic7xxx/aic7770_osm.c @@ -112,9 +112,6 @@ aic7770_remove(struct device *dev) struct ahc_softc *ahc = dev_get_drvdata(dev); u_long s; - if (ahc->platform_data && ahc->platform_data->host) - scsi_remove_host(ahc->platform_data->host); - ahc_lock(ahc, &s); ahc_intr_enable(ahc, FALSE); ahc_unlock(ahc, &s); diff --git a/trunk/drivers/scsi/aic7xxx/aic79xx_osm.c b/trunk/drivers/scsi/aic7xxx/aic79xx_osm.c index 95c285cc83e4..6b6d4e287793 100644 --- a/trunk/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/trunk/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -1192,6 +1192,11 @@ ahd_platform_free(struct ahd_softc *ahd) int i, j; if (ahd->platform_data != NULL) { + if (ahd->platform_data->host != NULL) { + scsi_remove_host(ahd->platform_data->host); + scsi_host_put(ahd->platform_data->host); + } + /* destroy all of the device and target objects */ for (i = 0; i < AHD_NUM_TARGETS; i++) { starget = ahd->platform_data->starget[i]; @@ -1221,9 +1226,6 @@ ahd_platform_free(struct ahd_softc *ahd) release_mem_region(ahd->platform_data->mem_busaddr, 0x1000); } - if (ahd->platform_data->host) - scsi_host_put(ahd->platform_data->host); - free(ahd->platform_data, M_DEVBUF); } } diff --git a/trunk/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/trunk/drivers/scsi/aic7xxx/aic79xx_osm_pci.c index bf360ae021ab..390b53852d4b 100644 --- a/trunk/drivers/scsi/aic7xxx/aic79xx_osm_pci.c +++ b/trunk/drivers/scsi/aic7xxx/aic79xx_osm_pci.c @@ -95,9 +95,6 @@ ahd_linux_pci_dev_remove(struct pci_dev *pdev) struct ahd_softc *ahd = pci_get_drvdata(pdev); u_long s; - if (ahd->platform_data && ahd->platform_data->host) - scsi_remove_host(ahd->platform_data->host); - ahd_lock(ahd, &s); ahd_intr_enable(ahd, FALSE); ahd_unlock(ahd, &s); diff --git a/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c b/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c index 6ee1435d37fa..876d1de8480d 100644 --- a/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -1209,6 +1209,11 @@ ahc_platform_free(struct ahc_softc *ahc) int i, j; if (ahc->platform_data != NULL) { + if (ahc->platform_data->host != NULL) { + scsi_remove_host(ahc->platform_data->host); + scsi_host_put(ahc->platform_data->host); + } + /* destroy all of the device and target objects */ for (i = 0; i < AHC_NUM_TARGETS; i++) { starget = ahc->platform_data->starget[i]; @@ -1237,9 +1242,6 @@ ahc_platform_free(struct ahc_softc *ahc) 0x1000); } - if (ahc->platform_data->host) - scsi_host_put(ahc->platform_data->host); - free(ahc->platform_data, M_DEVBUF); } } diff --git a/trunk/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/trunk/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index cb30d9c1153d..3ce77ddc889e 100644 --- a/trunk/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/trunk/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c @@ -143,9 +143,6 @@ ahc_linux_pci_dev_remove(struct pci_dev *pdev) struct ahc_softc *ahc = pci_get_drvdata(pdev); u_long s; - if (ahc->platform_data && ahc->platform_data->host) - scsi_remove_host(ahc->platform_data->host); - ahc_lock(ahc, &s); ahc_intr_enable(ahc, FALSE); ahc_unlock(ahc, &s); diff --git a/trunk/drivers/scsi/ata_piix.c b/trunk/drivers/scsi/ata_piix.c index d71cef767cec..87e0c36f1554 100644 --- a/trunk/drivers/scsi/ata_piix.c +++ b/trunk/drivers/scsi/ata_piix.c @@ -442,6 +442,7 @@ static void piix_sata_phy_reset(struct ata_port *ap) * piix_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: um + * @pio: PIO mode, 0 - 4 * * Set PIO mode for device, in host controller PCI config space. * diff --git a/trunk/drivers/scsi/hosts.c b/trunk/drivers/scsi/hosts.c index 02fe371b0ab8..f2a72d33132c 100644 --- a/trunk/drivers/scsi/hosts.c +++ b/trunk/drivers/scsi/hosts.c @@ -176,7 +176,6 @@ void scsi_remove_host(struct Scsi_Host *shost) transport_unregister_device(&shost->shost_gendev); class_device_unregister(&shost->shost_classdev); device_del(&shost->shost_gendev); - scsi_proc_hostdir_rm(shost->hostt); } EXPORT_SYMBOL(scsi_remove_host); @@ -263,6 +262,7 @@ static void scsi_host_dev_release(struct device *dev) if (shost->work_q) destroy_workqueue(shost->work_q); + scsi_proc_hostdir_rm(shost->hostt); scsi_destroy_command_freelist(shost); kfree(shost->shost_data); diff --git a/trunk/drivers/scsi/libata-core.c b/trunk/drivers/scsi/libata-core.c index c5e663fefdf7..d92273cbe0de 100644 --- a/trunk/drivers/scsi/libata-core.c +++ b/trunk/drivers/scsi/libata-core.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include "scsi.h" #include "scsi_priv.h" @@ -63,8 +62,6 @@ static unsigned int ata_busy_sleep (struct ata_port *ap, unsigned long tmout_pat, unsigned long tmout); -static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev); -static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); static void ata_set_mode(struct ata_port *ap); static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift); @@ -72,6 +69,7 @@ static int fgb(u32 bitmap); static int ata_choose_xfer_mode(struct ata_port *ap, u8 *xfer_mode_out, unsigned int *xfer_shift_out); +static int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat); static void __ata_qc_complete(struct ata_queued_cmd *qc); static unsigned int ata_unique_id = 1; @@ -617,53 +615,79 @@ void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf) tf->hob_nsect = fis[13]; } -static const u8 ata_rw_cmds[] = { - /* pio multi */ - ATA_CMD_READ_MULTI, - ATA_CMD_WRITE_MULTI, - ATA_CMD_READ_MULTI_EXT, - ATA_CMD_WRITE_MULTI_EXT, - /* pio */ - ATA_CMD_PIO_READ, - ATA_CMD_PIO_WRITE, - ATA_CMD_PIO_READ_EXT, - ATA_CMD_PIO_WRITE_EXT, - /* dma */ - ATA_CMD_READ, - ATA_CMD_WRITE, - ATA_CMD_READ_EXT, - ATA_CMD_WRITE_EXT -}; +/** + * ata_prot_to_cmd - determine which read/write opcodes to use + * @protocol: ATA_PROT_xxx taskfile protocol + * @lba48: true is lba48 is present + * + * Given necessary input, determine which read/write commands + * to use to transfer data. + * + * LOCKING: + * None. + */ +static int ata_prot_to_cmd(int protocol, int lba48) +{ + int rcmd = 0, wcmd = 0; + + switch (protocol) { + case ATA_PROT_PIO: + if (lba48) { + rcmd = ATA_CMD_PIO_READ_EXT; + wcmd = ATA_CMD_PIO_WRITE_EXT; + } else { + rcmd = ATA_CMD_PIO_READ; + wcmd = ATA_CMD_PIO_WRITE; + } + break; + + case ATA_PROT_DMA: + if (lba48) { + rcmd = ATA_CMD_READ_EXT; + wcmd = ATA_CMD_WRITE_EXT; + } else { + rcmd = ATA_CMD_READ; + wcmd = ATA_CMD_WRITE; + } + break; + + default: + return -1; + } + + return rcmd | (wcmd << 8); +} /** - * ata_rwcmd_protocol - set taskfile r/w commands and protocol - * @qc: command to examine and configure + * ata_dev_set_protocol - set taskfile protocol and r/w commands + * @dev: device to examine and configure * - * Examine the device configuration and tf->flags to calculate - * the proper read/write commands and protocol to use. + * Examine the device configuration, after we have + * read the identify-device page and configured the + * data transfer mode. Set internal state related to + * the ATA taskfile protocol (pio, pio mult, dma, etc.) + * and calculate the proper read/write commands to use. * * LOCKING: * caller. */ -void ata_rwcmd_protocol(struct ata_queued_cmd *qc) +static void ata_dev_set_protocol(struct ata_device *dev) { - struct ata_taskfile *tf = &qc->tf; - struct ata_device *dev = qc->dev; + int pio = (dev->flags & ATA_DFLAG_PIO); + int lba48 = (dev->flags & ATA_DFLAG_LBA48); + int proto, cmd; - int index, lba48, write; - - lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; - write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; + if (pio) + proto = dev->xfer_protocol = ATA_PROT_PIO; + else + proto = dev->xfer_protocol = ATA_PROT_DMA; - if (dev->flags & ATA_DFLAG_PIO) { - tf->protocol = ATA_PROT_PIO; - index = dev->multi_count ? 0 : 4; - } else { - tf->protocol = ATA_PROT_DMA; - index = 8; - } + cmd = ata_prot_to_cmd(proto, lba48); + if (cmd < 0) + BUG(); - tf->command = ata_rw_cmds[index + lba48 + write]; + dev->read_cmd = cmd & 0xff; + dev->write_cmd = (cmd >> 8) & 0xff; } static const char * xfer_mode_str[] = { @@ -1107,7 +1131,7 @@ static inline void ata_dump_id(struct ata_device *dev) static void ata_dev_identify(struct ata_port *ap, unsigned int device) { struct ata_device *dev = &ap->device[device]; - unsigned int major_version; + unsigned int i; u16 tmp; unsigned long xfer_modes; u8 status; @@ -1205,9 +1229,9 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device) * common ATA, ATAPI feature tests */ - /* we require DMA support (bits 8 of word 49) */ - if (!ata_id_has_dma(dev->id)) { - printk(KERN_DEBUG "ata%u: no dma\n", ap->id); + /* we require LBA and DMA support (bits 8 & 9 of word 49) */ + if (!ata_id_has_dma(dev->id) || !ata_id_has_lba(dev->id)) { + printk(KERN_DEBUG "ata%u: no dma/lba\n", ap->id); goto err_out_nosup; } @@ -1227,75 +1251,32 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device) if (!ata_id_is_ata(dev->id)) /* sanity check */ goto err_out_nosup; - /* get major version */ tmp = dev->id[ATA_ID_MAJOR_VER]; - for (major_version = 14; major_version >= 1; major_version--) - if (tmp & (1 << major_version)) + for (i = 14; i >= 1; i--) + if (tmp & (1 << i)) break; - /* - * The exact sequence expected by certain pre-ATA4 drives is: - * SRST RESET - * IDENTIFY - * INITIALIZE DEVICE PARAMETERS - * anything else.. - * Some drives were very specific about that exact sequence. - */ - if (major_version < 4 || (!ata_id_has_lba(dev->id))) { - ata_dev_init_params(ap, dev); - - /* current CHS translation info (id[53-58]) might be - * changed. reread the identify device info. - */ - ata_dev_reread_id(ap, dev); + /* we require at least ATA-3 */ + if (i < 3) { + printk(KERN_DEBUG "ata%u: no ATA-3\n", ap->id); + goto err_out_nosup; } - if (ata_id_has_lba(dev->id)) { - dev->flags |= ATA_DFLAG_LBA; - - if (ata_id_has_lba48(dev->id)) { - dev->flags |= ATA_DFLAG_LBA48; - dev->n_sectors = ata_id_u64(dev->id, 100); - } else { - dev->n_sectors = ata_id_u32(dev->id, 60); - } - - /* print device info to dmesg */ - printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors:%s\n", - ap->id, device, - major_version, - ata_mode_string(xfer_modes), - (unsigned long long)dev->n_sectors, - dev->flags & ATA_DFLAG_LBA48 ? " LBA48" : " LBA"); - } else { - /* CHS */ - - /* Default translation */ - dev->cylinders = dev->id[1]; - dev->heads = dev->id[3]; - dev->sectors = dev->id[6]; - dev->n_sectors = dev->cylinders * dev->heads * dev->sectors; - - if (ata_id_current_chs_valid(dev->id)) { - /* Current CHS translation is valid. */ - dev->cylinders = dev->id[54]; - dev->heads = dev->id[55]; - dev->sectors = dev->id[56]; - - dev->n_sectors = ata_id_u32(dev->id, 57); - } - - /* print device info to dmesg */ - printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors: CHS %d/%d/%d\n", - ap->id, device, - major_version, - ata_mode_string(xfer_modes), - (unsigned long long)dev->n_sectors, - (int)dev->cylinders, (int)dev->heads, (int)dev->sectors); - + if (ata_id_has_lba48(dev->id)) { + dev->flags |= ATA_DFLAG_LBA48; + dev->n_sectors = ata_id_u64(dev->id, 100); + } else { + dev->n_sectors = ata_id_u32(dev->id, 60); } ap->host->max_cmd_len = 16; + + /* print device info to dmesg */ + printk(KERN_INFO "ata%u: dev %u ATA, max %s, %Lu sectors:%s\n", + ap->id, device, + ata_mode_string(xfer_modes), + (unsigned long long)dev->n_sectors, + dev->flags & ATA_DFLAG_LBA48 ? " lba48" : ""); } /* ATAPI-specific feature tests */ @@ -1622,7 +1603,7 @@ static void ata_host_set_dma(struct ata_port *ap, u8 xfer_mode, */ static void ata_set_mode(struct ata_port *ap) { - unsigned int xfer_shift; + unsigned int i, xfer_shift; u8 xfer_mode; int rc; @@ -1651,6 +1632,11 @@ static void ata_set_mode(struct ata_port *ap) if (ap->ops->post_set_mode) ap->ops->post_set_mode(ap); + for (i = 0; i < 2; i++) { + struct ata_device *dev = &ap->device[i]; + ata_dev_set_protocol(dev); + } + return; err_out: @@ -2157,110 +2143,6 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) DPRINTK("EXIT\n"); } -/** - * ata_dev_reread_id - Reread the device identify device info - * @ap: port where the device is - * @dev: device to reread the identify device info - * - * LOCKING: - */ - -static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev) -{ - DECLARE_COMPLETION(wait); - struct ata_queued_cmd *qc; - unsigned long flags; - int rc; - - qc = ata_qc_new_init(ap, dev); - BUG_ON(qc == NULL); - - ata_sg_init_one(qc, dev->id, sizeof(dev->id)); - qc->dma_dir = DMA_FROM_DEVICE; - - if (dev->class == ATA_DEV_ATA) { - qc->tf.command = ATA_CMD_ID_ATA; - DPRINTK("do ATA identify\n"); - } else { - qc->tf.command = ATA_CMD_ID_ATAPI; - DPRINTK("do ATAPI identify\n"); - } - - qc->tf.flags |= ATA_TFLAG_DEVICE; - qc->tf.protocol = ATA_PROT_PIO; - qc->nsect = 1; - - qc->waiting = &wait; - qc->complete_fn = ata_qc_complete_noop; - - spin_lock_irqsave(&ap->host_set->lock, flags); - rc = ata_qc_issue(qc); - spin_unlock_irqrestore(&ap->host_set->lock, flags); - - if (rc) - goto err_out; - - wait_for_completion(&wait); - - swap_buf_le16(dev->id, ATA_ID_WORDS); - - ata_dump_id(dev); - - DPRINTK("EXIT\n"); - - return; -err_out: - ata_port_disable(ap); -} - -/** - * ata_dev_init_params - Issue INIT DEV PARAMS command - * @ap: Port associated with device @dev - * @dev: Device to which command will be sent - * - * LOCKING: - */ - -static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev) -{ - DECLARE_COMPLETION(wait); - struct ata_queued_cmd *qc; - int rc; - unsigned long flags; - u16 sectors = dev->id[6]; - u16 heads = dev->id[3]; - - /* Number of sectors per track 1-255. Number of heads 1-16 */ - if (sectors < 1 || sectors > 255 || heads < 1 || heads > 16) - return; - - /* set up init dev params taskfile */ - DPRINTK("init dev params \n"); - - qc = ata_qc_new_init(ap, dev); - BUG_ON(qc == NULL); - - qc->tf.command = ATA_CMD_INIT_DEV_PARAMS; - qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; - qc->tf.protocol = ATA_PROT_NODATA; - qc->tf.nsect = sectors; - qc->tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */ - - qc->waiting = &wait; - qc->complete_fn = ata_qc_complete_noop; - - spin_lock_irqsave(&ap->host_set->lock, flags); - rc = ata_qc_issue(qc); - spin_unlock_irqrestore(&ap->host_set->lock, flags); - - if (rc) - ata_port_disable(ap); - else - wait_for_completion(&wait); - - DPRINTK("EXIT\n"); -} - /** * ata_sg_clean - Unmap DMA memory associated with command * @qc: Command containing DMA memory to be released @@ -2274,9 +2156,8 @@ static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev) static void ata_sg_clean(struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; - struct scatterlist *sg = qc->__sg; + struct scatterlist *sg = qc->sg; int dir = qc->dma_dir; - void *pad_buf = NULL; assert(qc->flags & ATA_QCFLAG_DMAMAP); assert(sg != NULL); @@ -2286,35 +2167,14 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) DPRINTK("unmapping %u sg elements\n", qc->n_elem); - /* if we padded the buffer out to 32-bit bound, and data - * xfer direction is from-device, we must copy from the - * pad buffer back into the supplied buffer - */ - if (qc->pad_len && !(qc->tf.flags & ATA_TFLAG_WRITE)) - pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ); - - if (qc->flags & ATA_QCFLAG_SG) { + if (qc->flags & ATA_QCFLAG_SG) dma_unmap_sg(ap->host_set->dev, sg, qc->n_elem, dir); - /* restore last sg */ - sg[qc->orig_n_elem - 1].length += qc->pad_len; - if (pad_buf) { - struct scatterlist *psg = &qc->pad_sgent; - void *addr = kmap_atomic(psg->page, KM_IRQ0); - memcpy(addr + psg->offset, pad_buf, qc->pad_len); - kunmap_atomic(psg->page, KM_IRQ0); - } - } else { + else dma_unmap_single(ap->host_set->dev, sg_dma_address(&sg[0]), sg_dma_len(&sg[0]), dir); - /* restore sg */ - sg->length += qc->pad_len; - if (pad_buf) - memcpy(qc->buf_virt + sg->length - qc->pad_len, - pad_buf, qc->pad_len); - } qc->flags &= ~ATA_QCFLAG_DMAMAP; - qc->__sg = NULL; + qc->sg = NULL; } /** @@ -2330,15 +2190,15 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) */ static void ata_fill_sg(struct ata_queued_cmd *qc) { + struct scatterlist *sg = qc->sg; struct ata_port *ap = qc->ap; - struct scatterlist *sg; - unsigned int idx; + unsigned int idx, nelem; - assert(qc->__sg != NULL); + assert(sg != NULL); assert(qc->n_elem > 0); idx = 0; - ata_for_each_sg(sg, qc) { + for (nelem = qc->n_elem; nelem; nelem--,sg++) { u32 addr, offset; u32 sg_len, len; @@ -2429,12 +2289,11 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) qc->flags |= ATA_QCFLAG_SINGLE; memset(&qc->sgent, 0, sizeof(qc->sgent)); - qc->__sg = &qc->sgent; + qc->sg = &qc->sgent; qc->n_elem = 1; - qc->orig_n_elem = 1; qc->buf_virt = buf; - sg = qc->__sg; + sg = qc->sg; sg->page = virt_to_page(buf); sg->offset = (unsigned long) buf & ~PAGE_MASK; sg->length = buflen; @@ -2458,9 +2317,8 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, unsigned int n_elem) { qc->flags |= ATA_QCFLAG_SG; - qc->__sg = sg; + qc->sg = sg; qc->n_elem = n_elem; - qc->orig_n_elem = n_elem; } /** @@ -2480,32 +2338,9 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; int dir = qc->dma_dir; - struct scatterlist *sg = qc->__sg; + struct scatterlist *sg = qc->sg; dma_addr_t dma_address; - /* we must lengthen transfers to end on a 32-bit boundary */ - qc->pad_len = sg->length & 3; - if (qc->pad_len) { - void *pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ); - struct scatterlist *psg = &qc->pad_sgent; - - assert(qc->dev->class == ATA_DEV_ATAPI); - - memset(pad_buf, 0, ATA_DMA_PAD_SZ); - - if (qc->tf.flags & ATA_TFLAG_WRITE) - memcpy(pad_buf, qc->buf_virt + sg->length - qc->pad_len, - qc->pad_len); - - sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ); - sg_dma_len(psg) = ATA_DMA_PAD_SZ; - /* trim sg */ - sg->length -= qc->pad_len; - - DPRINTK("padding done, sg->length=%u pad_len=%u\n", - sg->length, qc->pad_len); - } - dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, sg->length, dir); if (dma_mapping_error(dma_address)) @@ -2537,47 +2372,12 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) static int ata_sg_setup(struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; - struct scatterlist *sg = qc->__sg; - struct scatterlist *lsg = &sg[qc->n_elem - 1]; + struct scatterlist *sg = qc->sg; int n_elem, dir; VPRINTK("ENTER, ata%u\n", ap->id); assert(qc->flags & ATA_QCFLAG_SG); - /* we must lengthen transfers to end on a 32-bit boundary */ - qc->pad_len = lsg->length & 3; - if (qc->pad_len) { - void *pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ); - struct scatterlist *psg = &qc->pad_sgent; - unsigned int offset; - - assert(qc->dev->class == ATA_DEV_ATAPI); - - memset(pad_buf, 0, ATA_DMA_PAD_SZ); - - /* - * psg->page/offset are used to copy to-be-written - * data in this function or read data in ata_sg_clean. - */ - offset = lsg->offset + lsg->length - qc->pad_len; - psg->page = nth_page(lsg->page, offset >> PAGE_SHIFT); - psg->offset = offset_in_page(offset); - - if (qc->tf.flags & ATA_TFLAG_WRITE) { - void *addr = kmap_atomic(psg->page, KM_IRQ0); - memcpy(pad_buf, addr + psg->offset, qc->pad_len); - kunmap_atomic(psg->page, KM_IRQ0); - } - - sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ); - sg_dma_len(psg) = ATA_DMA_PAD_SZ; - /* trim last sg */ - lsg->length -= qc->pad_len; - - DPRINTK("padding done, sg[%d].length=%u pad_len=%u\n", - qc->n_elem - 1, lsg->length, qc->pad_len); - } - dir = qc->dma_dir; n_elem = dma_map_sg(ap->host_set->dev, sg, qc->n_elem, dir); if (n_elem < 1) @@ -2625,20 +2425,20 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) static unsigned long ata_pio_poll(struct ata_port *ap) { u8 status; - unsigned int poll_state = HSM_ST_UNKNOWN; - unsigned int reg_state = HSM_ST_UNKNOWN; - const unsigned int tmout_state = HSM_ST_TMOUT; - - switch (ap->hsm_task_state) { - case HSM_ST: - case HSM_ST_POLL: - poll_state = HSM_ST_POLL; - reg_state = HSM_ST; + unsigned int poll_state = PIO_ST_UNKNOWN; + unsigned int reg_state = PIO_ST_UNKNOWN; + const unsigned int tmout_state = PIO_ST_TMOUT; + + switch (ap->pio_task_state) { + case PIO_ST: + case PIO_ST_POLL: + poll_state = PIO_ST_POLL; + reg_state = PIO_ST; break; - case HSM_ST_LAST: - case HSM_ST_LAST_POLL: - poll_state = HSM_ST_LAST_POLL; - reg_state = HSM_ST_LAST; + case PIO_ST_LAST: + case PIO_ST_LAST_POLL: + poll_state = PIO_ST_LAST_POLL; + reg_state = PIO_ST_LAST; break; default: BUG(); @@ -2648,14 +2448,14 @@ static unsigned long ata_pio_poll(struct ata_port *ap) status = ata_chk_status(ap); if (status & ATA_BUSY) { if (time_after(jiffies, ap->pio_task_timeout)) { - ap->hsm_task_state = tmout_state; + ap->pio_task_state = tmout_state; return 0; } - ap->hsm_task_state = poll_state; + ap->pio_task_state = poll_state; return ATA_SHORT_PAUSE; } - ap->hsm_task_state = reg_state; + ap->pio_task_state = reg_state; return 0; } @@ -2680,14 +2480,14 @@ static int ata_pio_complete (struct ata_port *ap) * we enter, BSY will be cleared in a chk-status or two. If not, * the drive is probably seeking or something. Snooze for a couple * msecs, then chk-status again. If still busy, fall back to - * HSM_ST_POLL state. + * PIO_ST_POLL state. */ drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); if (drv_stat & (ATA_BUSY | ATA_DRQ)) { msleep(2); drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); if (drv_stat & (ATA_BUSY | ATA_DRQ)) { - ap->hsm_task_state = HSM_ST_LAST_POLL; + ap->pio_task_state = PIO_ST_LAST_POLL; ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; return 0; } @@ -2695,14 +2495,14 @@ static int ata_pio_complete (struct ata_port *ap) drv_stat = ata_wait_idle(ap); if (!ata_ok(drv_stat)) { - ap->hsm_task_state = HSM_ST_ERR; + ap->pio_task_state = PIO_ST_ERR; return 0; } qc = ata_qc_from_tag(ap, ap->active_tag); assert(qc != NULL); - ap->hsm_task_state = HSM_ST_IDLE; + ap->pio_task_state = PIO_ST_IDLE; ata_poll_qc_complete(qc, drv_stat); @@ -2855,14 +2655,14 @@ static void ata_data_xfer(struct ata_port *ap, unsigned char *buf, static void ata_pio_sector(struct ata_queued_cmd *qc) { int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); - struct scatterlist *sg = qc->__sg; + struct scatterlist *sg = qc->sg; struct ata_port *ap = qc->ap; struct page *page; unsigned int offset; unsigned char *buf; if (qc->cursect == (qc->nsect - 1)) - ap->hsm_task_state = HSM_ST_LAST; + ap->pio_task_state = PIO_ST_LAST; page = sg[qc->cursg].page; offset = sg[qc->cursg].offset + qc->cursg_ofs * ATA_SECT_SIZE; @@ -2905,14 +2705,14 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) { int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); - struct scatterlist *sg = qc->__sg; + struct scatterlist *sg = qc->sg; struct ata_port *ap = qc->ap; struct page *page; unsigned char *buf; unsigned int offset, count; if (qc->curbytes + bytes >= qc->nbytes) - ap->hsm_task_state = HSM_ST_LAST; + ap->pio_task_state = PIO_ST_LAST; next_sg: if (unlikely(qc->cursg >= qc->n_elem)) { @@ -2934,11 +2734,11 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) for (i = 0; i < words; i++) ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write); - ap->hsm_task_state = HSM_ST_LAST; + ap->pio_task_state = PIO_ST_LAST; return; } - sg = &qc->__sg[qc->cursg]; + sg = &qc->sg[qc->cursg]; page = sg->page; offset = sg->offset + qc->cursg_ofs; @@ -3015,7 +2815,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc) err_out: printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", ap->id, dev->devno); - ap->hsm_task_state = HSM_ST_ERR; + ap->pio_task_state = PIO_ST_ERR; } /** @@ -3037,14 +2837,14 @@ static void ata_pio_block(struct ata_port *ap) * a chk-status or two. If not, the drive is probably seeking * or something. Snooze for a couple msecs, then * chk-status again. If still busy, fall back to - * HSM_ST_POLL state. + * PIO_ST_POLL state. */ status = ata_busy_wait(ap, ATA_BUSY, 5); if (status & ATA_BUSY) { msleep(2); status = ata_busy_wait(ap, ATA_BUSY, 10); if (status & ATA_BUSY) { - ap->hsm_task_state = HSM_ST_POLL; + ap->pio_task_state = PIO_ST_POLL; ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; return; } @@ -3056,7 +2856,7 @@ static void ata_pio_block(struct ata_port *ap) if (is_atapi_taskfile(&qc->tf)) { /* no more data to transfer or unsupported ATAPI command */ if ((status & ATA_DRQ) == 0) { - ap->hsm_task_state = HSM_ST_LAST; + ap->pio_task_state = PIO_ST_LAST; return; } @@ -3064,7 +2864,7 @@ static void ata_pio_block(struct ata_port *ap) } else { /* handle BSY=0, DRQ=0 as error */ if ((status & ATA_DRQ) == 0) { - ap->hsm_task_state = HSM_ST_ERR; + ap->pio_task_state = PIO_ST_ERR; return; } @@ -3084,7 +2884,7 @@ static void ata_pio_error(struct ata_port *ap) printk(KERN_WARNING "ata%u: PIO error, drv_stat 0x%x\n", ap->id, drv_stat); - ap->hsm_task_state = HSM_ST_IDLE; + ap->pio_task_state = PIO_ST_IDLE; ata_poll_qc_complete(qc, drv_stat | ATA_ERR); } @@ -3099,25 +2899,25 @@ static void ata_pio_task(void *_data) timeout = 0; qc_completed = 0; - switch (ap->hsm_task_state) { - case HSM_ST_IDLE: + switch (ap->pio_task_state) { + case PIO_ST_IDLE: return; - case HSM_ST: + case PIO_ST: ata_pio_block(ap); break; - case HSM_ST_LAST: + case PIO_ST_LAST: qc_completed = ata_pio_complete(ap); break; - case HSM_ST_POLL: - case HSM_ST_LAST_POLL: + case PIO_ST_POLL: + case PIO_ST_LAST_POLL: timeout = ata_pio_poll(ap); break; - case HSM_ST_TMOUT: - case HSM_ST_ERR: + case PIO_ST_TMOUT: + case PIO_ST_ERR: ata_pio_error(ap); return; } @@ -3128,6 +2928,52 @@ static void ata_pio_task(void *_data) goto fsm_start; } +static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, + struct scsi_cmnd *cmd) +{ + DECLARE_COMPLETION(wait); + struct ata_queued_cmd *qc; + unsigned long flags; + int rc; + + DPRINTK("ATAPI request sense\n"); + + qc = ata_qc_new_init(ap, dev); + BUG_ON(qc == NULL); + + /* FIXME: is this needed? */ + memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer)); + + ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer)); + qc->dma_dir = DMA_FROM_DEVICE; + + memset(&qc->cdb, 0, ap->cdb_len); + qc->cdb[0] = REQUEST_SENSE; + qc->cdb[4] = SCSI_SENSE_BUFFERSIZE; + + qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; + qc->tf.command = ATA_CMD_PACKET; + + qc->tf.protocol = ATA_PROT_ATAPI; + qc->tf.lbam = (8 * 1024) & 0xff; + qc->tf.lbah = (8 * 1024) >> 8; + qc->nbytes = SCSI_SENSE_BUFFERSIZE; + + qc->waiting = &wait; + qc->complete_fn = ata_qc_complete_noop; + + spin_lock_irqsave(&ap->host_set->lock, flags); + rc = ata_qc_issue(qc); + spin_unlock_irqrestore(&ap->host_set->lock, flags); + + if (rc) + ata_port_disable(ap); + else + wait_for_completion(&wait); + + DPRINTK("EXIT\n"); +} + /** * ata_qc_timeout - Handle timeout of queued command * @qc: Command that timed out @@ -3245,14 +3091,14 @@ void ata_eng_timeout(struct ata_port *ap) DPRINTK("ENTER\n"); qc = ata_qc_from_tag(ap, ap->active_tag); - if (qc) - ata_qc_timeout(qc); - else { + if (!qc) { printk(KERN_ERR "ata%u: BUG: timeout without command\n", ap->id); goto out; } + ata_qc_timeout(qc); + out: DPRINTK("EXIT\n"); } @@ -3299,7 +3145,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, qc = ata_qc_new(ap); if (qc) { - qc->__sg = NULL; + qc->sg = NULL; qc->flags = 0; qc->scsicmd = NULL; qc->ap = ap; @@ -3309,12 +3155,15 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, qc->nbytes = qc->curbytes = 0; ata_tf_init(ap, &qc->tf, dev->devno); + + if (dev->flags & ATA_DFLAG_LBA48) + qc->tf.flags |= ATA_TFLAG_LBA48; } return qc; } -int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat) +static int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat) { return 0; } @@ -3511,7 +3360,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc) case ATA_PROT_PIO: /* load tf registers, initiate polling pio */ ata_qc_set_polling(qc); ata_tf_to_host_nolock(ap, &qc->tf); - ap->hsm_task_state = HSM_ST; + ap->pio_task_state = PIO_ST; queue_work(ata_wq, &ap->pio_task); break; @@ -3737,7 +3586,7 @@ u8 ata_bmdma_status(struct ata_port *ap) void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; host_stat = readb(mmio + ATA_DMA_STATUS); } else - host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); + host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); return host_stat; } @@ -3957,7 +3806,7 @@ static void atapi_packet_task(void *_data) ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1); /* PIO commands are handled by polling */ - ap->hsm_task_state = HSM_ST; + ap->pio_task_state = PIO_ST; queue_work(ata_wq, &ap->pio_task); } @@ -3988,12 +3837,6 @@ int ata_port_start (struct ata_port *ap) if (!ap->prd) return -ENOMEM; - ap->pad = dma_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ, &ap->pad_dma, GFP_KERNEL); - if (!ap->pad) { - dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma); - return -ENOMEM; - } - DPRINTK("prd alloc, virt %p, dma %llx\n", ap->prd, (unsigned long long) ap->prd_dma); return 0; @@ -4016,7 +3859,6 @@ void ata_port_stop (struct ata_port *ap) struct device *dev = ap->host_set->dev; dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma); - dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); } void ata_host_stop (struct ata_host_set *host_set) @@ -4271,7 +4113,7 @@ int ata_device_add(struct ata_probe_ent *ent) for (i = 0; i < count; i++) { struct ata_port *ap = host_set->ports[i]; - ata_scsi_scan_host(ap); + scsi_scan_host(ap->host); } dev_set_drvdata(dev, host_set); @@ -4289,53 +4131,6 @@ int ata_device_add(struct ata_probe_ent *ent) return 0; } -/** - * ata_host_set_remove - PCI layer callback for device removal - * @host_set: ATA host set that was removed - * - * Unregister all objects associated with this host set. Free those - * objects. - * - * LOCKING: - * Inherited from calling layer (may sleep). - */ - - -void ata_host_set_remove(struct ata_host_set *host_set) -{ - struct ata_port *ap; - unsigned int i; - - for (i = 0; i < host_set->n_ports; i++) { - ap = host_set->ports[i]; - scsi_remove_host(ap->host); - } - - free_irq(host_set->irq, host_set); - - for (i = 0; i < host_set->n_ports; i++) { - ap = host_set->ports[i]; - - ata_scsi_release(ap->host); - - if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { - struct ata_ioports *ioaddr = &ap->ioaddr; - - if (ioaddr->cmd_addr == 0x1f0) - release_region(0x1f0, 8); - else if (ioaddr->cmd_addr == 0x170) - release_region(0x170, 8); - } - - scsi_host_put(ap->host); - } - - if (host_set->ops->host_stop) - host_set->ops->host_stop(host_set); - - kfree(host_set); -} - /** * ata_scsi_release - SCSI layer callback hook for host unload * @host: libata host to be unloaded @@ -4431,87 +4226,85 @@ void ata_pci_host_stop (struct ata_host_set *host_set) * ata_pci_init_native_mode - Initialize native-mode driver * @pdev: pci device to be initialized * @port: array[2] of pointers to port info structures. - * @ports: bitmap of ports present * * Utility function which allocates and initializes an * ata_probe_ent structure for a standard dual-port * PIO-based IDE controller. The returned ata_probe_ent * structure can be passed to ata_device_add(). The returned * ata_probe_ent structure should then be freed with kfree(). - * - * The caller need only pass the address of the primary port, the - * secondary will be deduced automatically. If the device has non - * standard secondary port mappings this function can be called twice, - * once for each interface. */ struct ata_probe_ent * -ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int ports) +ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port) { struct ata_probe_ent *probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); - int p = 0; - if (!probe_ent) return NULL; + probe_ent->n_ports = 2; probe_ent->irq = pdev->irq; probe_ent->irq_flags = SA_SHIRQ; - if (ports & ATA_PORT_PRIMARY) { - probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0); - probe_ent->port[p].altstatus_addr = - probe_ent->port[p].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - probe_ent->port[p].bmdma_addr = pci_resource_start(pdev, 4); - ata_std_ports(&probe_ent->port[p]); - p++; - } + probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); + probe_ent->port[0].altstatus_addr = + probe_ent->port[0].ctl_addr = + pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; + probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); - if (ports & ATA_PORT_SECONDARY) { - probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 2); - probe_ent->port[p].altstatus_addr = - probe_ent->port[p].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[p].bmdma_addr = pci_resource_start(pdev, 4) + 8; - ata_std_ports(&probe_ent->port[p]); - p++; - } + probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); + probe_ent->port[1].altstatus_addr = + probe_ent->port[1].ctl_addr = + pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; + probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; + + ata_std_ports(&probe_ent->port[0]); + ata_std_ports(&probe_ent->port[1]); - probe_ent->n_ports = p; return probe_ent; } -static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, struct ata_port_info **port, int port_num) +static struct ata_probe_ent * +ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port, + struct ata_probe_ent **ppe2) { - struct ata_probe_ent *probe_ent; + struct ata_probe_ent *probe_ent, *probe_ent2; probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); if (!probe_ent) return NULL; + probe_ent2 = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[1]); + if (!probe_ent2) { + kfree(probe_ent); + return NULL; + } - - probe_ent->legacy_mode = 1; probe_ent->n_ports = 1; - probe_ent->hard_port_no = port_num; - - switch(port_num) - { - case 0: - probe_ent->irq = 14; - probe_ent->port[0].cmd_addr = 0x1f0; - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = 0x3f6; - break; - case 1: - probe_ent->irq = 15; - probe_ent->port[0].cmd_addr = 0x170; - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = 0x376; - break; - } - probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4) + 8 * port_num; + probe_ent->irq = 14; + + probe_ent->hard_port_no = 0; + probe_ent->legacy_mode = 1; + + probe_ent2->n_ports = 1; + probe_ent2->irq = 15; + + probe_ent2->hard_port_no = 1; + probe_ent2->legacy_mode = 1; + + probe_ent->port[0].cmd_addr = 0x1f0; + probe_ent->port[0].altstatus_addr = + probe_ent->port[0].ctl_addr = 0x3f6; + probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); + + probe_ent2->port[0].cmd_addr = 0x170; + probe_ent2->port[0].altstatus_addr = + probe_ent2->port[0].ctl_addr = 0x376; + probe_ent2->port[0].bmdma_addr = pci_resource_start(pdev, 4)+8; + ata_std_ports(&probe_ent->port[0]); + ata_std_ports(&probe_ent2->port[0]); + + *ppe2 = probe_ent2; return probe_ent; } @@ -4540,7 +4333,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, unsigned int n_ports) { - struct ata_probe_ent *probe_ent = NULL, *probe_ent2 = NULL; + struct ata_probe_ent *probe_ent, *probe_ent2 = NULL; struct ata_port_info *port[2]; u8 tmp8, mask; unsigned int legacy_mode = 0; @@ -4557,7 +4350,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, if ((port[0]->host_flags & ATA_FLAG_NO_LEGACY) == 0 && (pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { - /* TODO: What if one channel is in native mode ... */ + /* TODO: support transitioning to native mode? */ pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); mask = (1 << 2) | (1 << 0); if ((tmp8 & mask) != mask) @@ -4565,20 +4358,11 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, } /* FIXME... */ - if ((!legacy_mode) && (n_ports > 2)) { - printk(KERN_ERR "ata: BUG: native mode, n_ports > 2\n"); - n_ports = 2; - /* For now */ + if ((!legacy_mode) && (n_ports > 1)) { + printk(KERN_ERR "ata: BUG: native mode, n_ports > 1\n"); + return -EINVAL; } - /* FIXME: Really for ATA it isn't safe because the device may be - multi-purpose and we want to leave it alone if it was already - enabled. Secondly for shared use as Arjan says we want refcounting - - Checking dev->is_enabled is insufficient as this is not set at - boot for the primary video which is BIOS enabled - */ - rc = pci_enable_device(pdev); if (rc) return rc; @@ -4589,7 +4373,6 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, goto err_out; } - /* FIXME: Should use platform specific mappers for legacy port ranges */ if (legacy_mode) { if (!request_region(0x1f0, 8, "libata")) { struct resource *conflict, res; @@ -4634,17 +4417,10 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, goto err_out_regions; if (legacy_mode) { - if (legacy_mode & (1 << 0)) - probe_ent = ata_pci_init_legacy_port(pdev, port, 0); - if (legacy_mode & (1 << 1)) - probe_ent2 = ata_pci_init_legacy_port(pdev, port, 1); - } else { - if (n_ports == 2) - probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); - else - probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY); - } - if (!probe_ent && !probe_ent2) { + probe_ent = ata_pci_init_legacy_mode(pdev, port, &probe_ent2); + } else + probe_ent = ata_pci_init_native_mode(pdev, port); + if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; } @@ -4695,8 +4471,39 @@ void ata_pci_remove_one (struct pci_dev *pdev) { struct device *dev = pci_dev_to_dev(pdev); struct ata_host_set *host_set = dev_get_drvdata(dev); + struct ata_port *ap; + unsigned int i; + + for (i = 0; i < host_set->n_ports; i++) { + ap = host_set->ports[i]; + + scsi_remove_host(ap->host); + } + + free_irq(host_set->irq, host_set); + + for (i = 0; i < host_set->n_ports; i++) { + ap = host_set->ports[i]; + + ata_scsi_release(ap->host); + + if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { + struct ata_ioports *ioaddr = &ap->ioaddr; + + if (ioaddr->cmd_addr == 0x1f0) + release_region(0x1f0, 8); + else if (ioaddr->cmd_addr == 0x170) + release_region(0x170, 8); + } + + scsi_host_put(ap->host); + } + + if (host_set->ops->host_stop) + host_set->ops->host_stop(host_set); + + kfree(host_set); - ata_host_set_remove(host_set); pci_release_regions(pdev); pci_disable_device(pdev); dev_set_drvdata(dev, NULL); @@ -4756,27 +4563,6 @@ static void __exit ata_exit(void) module_init(ata_init); module_exit(ata_exit); -static unsigned long ratelimit_time; -static spinlock_t ata_ratelimit_lock = SPIN_LOCK_UNLOCKED; - -int ata_ratelimit(void) -{ - int rc; - unsigned long flags; - - spin_lock_irqsave(&ata_ratelimit_lock, flags); - - if (time_after(jiffies, ratelimit_time)) { - rc = 1; - ratelimit_time = jiffies + (HZ/5); - } else - rc = 0; - - spin_unlock_irqrestore(&ata_ratelimit_lock, flags); - - return rc; -} - /* * libata is essentially a library of internal helper functions for * low-level ATA host controller drivers. As such, the API/ABI is @@ -4787,7 +4573,6 @@ int ata_ratelimit(void) EXPORT_SYMBOL_GPL(ata_std_bios_param); EXPORT_SYMBOL_GPL(ata_std_ports); EXPORT_SYMBOL_GPL(ata_device_add); -EXPORT_SYMBOL_GPL(ata_host_set_remove); EXPORT_SYMBOL_GPL(ata_sg_init); EXPORT_SYMBOL_GPL(ata_sg_init_one); EXPORT_SYMBOL_GPL(ata_qc_complete); @@ -4818,7 +4603,6 @@ EXPORT_SYMBOL_GPL(sata_phy_reset); EXPORT_SYMBOL_GPL(__sata_phy_reset); EXPORT_SYMBOL_GPL(ata_bus_reset); EXPORT_SYMBOL_GPL(ata_port_disable); -EXPORT_SYMBOL_GPL(ata_ratelimit); EXPORT_SYMBOL_GPL(ata_scsi_ioctl); EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); EXPORT_SYMBOL_GPL(ata_scsi_error); diff --git a/trunk/drivers/scsi/libata-scsi.c b/trunk/drivers/scsi/libata-scsi.c index 9944adbe5a1d..104fd9a63e73 100644 --- a/trunk/drivers/scsi/libata-scsi.c +++ b/trunk/drivers/scsi/libata-scsi.c @@ -49,14 +49,6 @@ static struct ata_device * ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev); -static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, - void (*done)(struct scsi_cmnd *)) -{ - ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, 0x24, 0x0); - /* "Invalid field in cbd" */ - done(cmd); -} - /** * ata_std_bios_param - generic bios head/sector/cylinder calculator used by sd. * @sdev: SCSI device for which BIOS geometry is to be determined @@ -158,10 +150,10 @@ struct ata_queued_cmd *ata_scsi_qc_new(struct ata_port *ap, qc->scsidone = done; if (cmd->use_sg) { - qc->__sg = (struct scatterlist *) cmd->request_buffer; + qc->sg = (struct scatterlist *) cmd->request_buffer; qc->n_elem = cmd->use_sg; } else { - qc->__sg = &qc->sgent; + qc->sg = &qc->sgent; qc->n_elem = 1; } } else { @@ -190,6 +182,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) { struct scsi_cmnd *cmd = qc->scsicmd; u8 err = 0; + unsigned char *sb = cmd->sense_buffer; /* Based on the 3ware driver translation table */ static unsigned char sense_table[][4] = { /* BBD|ECC|ID|MAR */ @@ -232,6 +225,8 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) }; int i = 0; + cmd->result = SAM_STAT_CHECK_CONDITION; + /* * Is this an error we can process/parse */ @@ -286,9 +281,11 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) /* Look for best matches first */ if((sense_table[i][0] & err) == sense_table[i][0]) { - ata_scsi_set_sense(cmd, sense_table[i][1] /* sk */, - sense_table[i][2] /* asc */, - sense_table[i][3] /* ascq */ ); + sb[0] = 0x70; + sb[2] = sense_table[i][1]; + sb[7] = 0x0a; + sb[12] = sense_table[i][2]; + sb[13] = sense_table[i][3]; return; } i++; @@ -303,9 +300,11 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) { if(stat_table[i][0] & drv_stat) { - ata_scsi_set_sense(cmd, sense_table[i][1] /* sk */, - sense_table[i][2] /* asc */, - sense_table[i][3] /* ascq */ ); + sb[0] = 0x70; + sb[2] = stat_table[i][1]; + sb[7] = 0x0a; + sb[12] = stat_table[i][2]; + sb[13] = stat_table[i][3]; return; } i++; @@ -314,12 +313,15 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) printk(KERN_ERR "ata%u: called with no error (%02X)!\n", qc->ap->id, drv_stat); /* additional-sense-code[-qualifier] */ + sb[0] = 0x70; + sb[2] = MEDIUM_ERROR; + sb[7] = 0x0A; if (cmd->sc_data_direction == DMA_FROM_DEVICE) { - ata_scsi_set_sense(cmd, MEDIUM_ERROR, 0x11, 0x4); - /* "unrecovered read error" */ + sb[12] = 0x11; /* "unrecovered read error" */ + sb[13] = 0x04; } else { - ata_scsi_set_sense(cmd, MEDIUM_ERROR, 0xc, 0x2); - /* "write error - auto-reallocation failed" */ + sb[12] = 0x0C; /* "write error - */ + sb[13] = 0x02; /* auto-reallocation failed" */ } } @@ -362,16 +364,6 @@ int ata_scsi_slave_config(struct scsi_device *sdev) */ blk_queue_max_sectors(sdev->request_queue, 2048); } - - /* - * SATA DMA transfers must be multiples of 4 byte, so - * we need to pad ATAPI transfers using an extra sg. - * Decrement max hw segments accordingly. - */ - if (dev->class == ATA_DEV_ATAPI) { - request_queue_t *q = sdev->request_queue; - blk_queue_max_hw_segments(q, q->max_hw_segments - 1); - } } return 0; /* scsi layer doesn't check return value, sigh */ @@ -438,26 +430,15 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, ; /* ignore IMMED bit, violates sat-r05 */ } if (scsicmd[4] & 0x2) - goto invalid_fld; /* LOEJ bit set not supported */ + return 1; /* LOEJ bit set not supported */ if (((scsicmd[4] >> 4) & 0xf) != 0) - goto invalid_fld; /* power conditions not supported */ + return 1; /* power conditions not supported */ if (scsicmd[4] & 0x1) { tf->nsect = 1; /* 1 sector, lba=0 */ - - if (qc->dev->flags & ATA_DFLAG_LBA) { - qc->tf.flags |= ATA_TFLAG_LBA; - - tf->lbah = 0x0; - tf->lbam = 0x0; - tf->lbal = 0x0; - tf->device |= ATA_LBA; - } else { - /* CHS */ - tf->lbal = 0x1; /* sect */ - tf->lbam = 0x0; /* cyl low */ - tf->lbah = 0x0; /* cyl high */ - } - + tf->lbah = 0x0; + tf->lbam = 0x0; + tf->lbal = 0x0; + tf->device |= ATA_LBA; tf->command = ATA_CMD_VERIFY; /* READ VERIFY */ } else { tf->nsect = 0; /* time period value (0 implies now) */ @@ -472,11 +453,6 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, */ return 0; - -invalid_fld: - ata_scsi_set_sense(qc->scsicmd, ILLEGAL_REQUEST, 0x24, 0x0); - /* "Invalid field in cbd" */ - return 1; } @@ -502,7 +478,7 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) tf->flags |= ATA_TFLAG_DEVICE; tf->protocol = ATA_PROT_NODATA; - if ((qc->dev->flags & ATA_DFLAG_LBA48) && + if ((tf->flags & ATA_TFLAG_LBA48) && (ata_id_has_flush_ext(qc->dev->id))) tf->command = ATA_CMD_FLUSH_EXT; else @@ -511,99 +487,6 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) return 0; } -/** - * scsi_6_lba_len - Get LBA and transfer length - * @scsicmd: SCSI command to translate - * - * Calculate LBA and transfer length for 6-byte commands. - * - * RETURNS: - * @plba: the LBA - * @plen: the transfer length - */ - -static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) -{ - u64 lba = 0; - u32 len = 0; - - VPRINTK("six-byte command\n"); - - lba |= ((u64)scsicmd[2]) << 8; - lba |= ((u64)scsicmd[3]); - - len |= ((u32)scsicmd[4]); - - *plba = lba; - *plen = len; -} - -/** - * scsi_10_lba_len - Get LBA and transfer length - * @scsicmd: SCSI command to translate - * - * Calculate LBA and transfer length for 10-byte commands. - * - * RETURNS: - * @plba: the LBA - * @plen: the transfer length - */ - -static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) -{ - u64 lba = 0; - u32 len = 0; - - VPRINTK("ten-byte command\n"); - - lba |= ((u64)scsicmd[2]) << 24; - lba |= ((u64)scsicmd[3]) << 16; - lba |= ((u64)scsicmd[4]) << 8; - lba |= ((u64)scsicmd[5]); - - len |= ((u32)scsicmd[7]) << 8; - len |= ((u32)scsicmd[8]); - - *plba = lba; - *plen = len; -} - -/** - * scsi_16_lba_len - Get LBA and transfer length - * @scsicmd: SCSI command to translate - * - * Calculate LBA and transfer length for 16-byte commands. - * - * RETURNS: - * @plba: the LBA - * @plen: the transfer length - */ - -static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) -{ - u64 lba = 0; - u32 len = 0; - - VPRINTK("sixteen-byte command\n"); - - lba |= ((u64)scsicmd[2]) << 56; - lba |= ((u64)scsicmd[3]) << 48; - lba |= ((u64)scsicmd[4]) << 40; - lba |= ((u64)scsicmd[5]) << 32; - lba |= ((u64)scsicmd[6]) << 24; - lba |= ((u64)scsicmd[7]) << 16; - lba |= ((u64)scsicmd[8]) << 8; - lba |= ((u64)scsicmd[9]); - - len |= ((u32)scsicmd[10]) << 24; - len |= ((u32)scsicmd[11]) << 16; - len |= ((u32)scsicmd[12]) << 8; - len |= ((u32)scsicmd[13]); - - *plba = lba; - *plen = len; -} - /** * ata_scsi_verify_xlat - Translate SCSI VERIFY command into an ATA one * @qc: Storage for translated ATA taskfile @@ -621,107 +504,79 @@ static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) { struct ata_taskfile *tf = &qc->tf; - struct ata_device *dev = qc->dev; + unsigned int lba48 = tf->flags & ATA_TFLAG_LBA48; u64 dev_sectors = qc->dev->n_sectors; - u64 block; - u32 n_block; + u64 sect = 0; + u32 n_sect = 0; tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; tf->protocol = ATA_PROT_NODATA; + tf->device |= ATA_LBA; - if (scsicmd[0] == VERIFY) - scsi_10_lba_len(scsicmd, &block, &n_block); - else if (scsicmd[0] == VERIFY_16) - scsi_16_lba_len(scsicmd, &block, &n_block); - else - goto invalid_fld; - - if (!n_block) - goto nothing_to_do; - if (block >= dev_sectors) - goto out_of_range; - if ((block + n_block) > dev_sectors) - goto out_of_range; + if (scsicmd[0] == VERIFY) { + sect |= ((u64)scsicmd[2]) << 24; + sect |= ((u64)scsicmd[3]) << 16; + sect |= ((u64)scsicmd[4]) << 8; + sect |= ((u64)scsicmd[5]); - if (dev->flags & ATA_DFLAG_LBA) { - tf->flags |= ATA_TFLAG_LBA; - - if (dev->flags & ATA_DFLAG_LBA48) { - if (n_block > (64 * 1024)) - goto invalid_fld; - - /* use LBA48 */ - tf->flags |= ATA_TFLAG_LBA48; - tf->command = ATA_CMD_VERIFY_EXT; - - tf->hob_nsect = (n_block >> 8) & 0xff; + n_sect |= ((u32)scsicmd[7]) << 8; + n_sect |= ((u32)scsicmd[8]); + } - tf->hob_lbah = (block >> 40) & 0xff; - tf->hob_lbam = (block >> 32) & 0xff; - tf->hob_lbal = (block >> 24) & 0xff; - } else { - if (n_block > 256) - goto invalid_fld; + else if (scsicmd[0] == VERIFY_16) { + sect |= ((u64)scsicmd[2]) << 56; + sect |= ((u64)scsicmd[3]) << 48; + sect |= ((u64)scsicmd[4]) << 40; + sect |= ((u64)scsicmd[5]) << 32; + sect |= ((u64)scsicmd[6]) << 24; + sect |= ((u64)scsicmd[7]) << 16; + sect |= ((u64)scsicmd[8]) << 8; + sect |= ((u64)scsicmd[9]); + + n_sect |= ((u32)scsicmd[10]) << 24; + n_sect |= ((u32)scsicmd[11]) << 16; + n_sect |= ((u32)scsicmd[12]) << 8; + n_sect |= ((u32)scsicmd[13]); + } - /* use LBA28 */ - tf->command = ATA_CMD_VERIFY; + else + return 1; - tf->device |= (block >> 24) & 0xf; - } + if (!n_sect) + return 1; + if (sect >= dev_sectors) + return 1; + if ((sect + n_sect) > dev_sectors) + return 1; + if (lba48) { + if (n_sect > (64 * 1024)) + return 1; + } else { + if (n_sect > 256) + return 1; + } - tf->nsect = n_block & 0xff; + if (lba48) { + tf->command = ATA_CMD_VERIFY_EXT; - tf->lbah = (block >> 16) & 0xff; - tf->lbam = (block >> 8) & 0xff; - tf->lbal = block & 0xff; + tf->hob_nsect = (n_sect >> 8) & 0xff; - tf->device |= ATA_LBA; + tf->hob_lbah = (sect >> 40) & 0xff; + tf->hob_lbam = (sect >> 32) & 0xff; + tf->hob_lbal = (sect >> 24) & 0xff; } else { - /* CHS */ - u32 sect, head, cyl, track; - - if (n_block > 256) - goto invalid_fld; - - /* Convert LBA to CHS */ - track = (u32)block / dev->sectors; - cyl = track / dev->heads; - head = track % dev->heads; - sect = (u32)block % dev->sectors + 1; - - DPRINTK("block %u track %u cyl %u head %u sect %u\n", - (u32)block, track, cyl, head, sect); - - /* Check whether the converted CHS can fit. - Cylinder: 0-65535 - Head: 0-15 - Sector: 1-255*/ - if ((cyl >> 16) || (head >> 4) || (sect >> 8) || (!sect)) - goto out_of_range; - tf->command = ATA_CMD_VERIFY; - tf->nsect = n_block & 0xff; /* Sector count 0 means 256 sectors */ - tf->lbal = sect; - tf->lbam = cyl; - tf->lbah = cyl >> 8; - tf->device |= head; - } - return 0; + tf->device |= (sect >> 24) & 0xf; + } -invalid_fld: - ata_scsi_set_sense(qc->scsicmd, ILLEGAL_REQUEST, 0x24, 0x0); - /* "Invalid field in cbd" */ - return 1; + tf->nsect = n_sect & 0xff; -out_of_range: - ata_scsi_set_sense(qc->scsicmd, ILLEGAL_REQUEST, 0x21, 0x0); - /* "Logical Block Address out of range" */ - return 1; + tf->lbah = (sect >> 16) & 0xff; + tf->lbam = (sect >> 8) & 0xff; + tf->lbal = sect & 0xff; -nothing_to_do: - qc->scsicmd->result = SAM_STAT_GOOD; - return 1; + return 0; } /** @@ -747,134 +602,103 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) { struct ata_taskfile *tf = &qc->tf; - struct ata_device *dev = qc->dev; - u64 block; - u32 n_block; + unsigned int lba48 = tf->flags & ATA_TFLAG_LBA48; tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; + tf->protocol = qc->dev->xfer_protocol; + tf->device |= ATA_LBA; - if (scsicmd[0] == WRITE_10 || scsicmd[0] == WRITE_6 || - scsicmd[0] == WRITE_16) + if (scsicmd[0] == READ_10 || scsicmd[0] == READ_6 || + scsicmd[0] == READ_16) { + tf->command = qc->dev->read_cmd; + } else { + tf->command = qc->dev->write_cmd; tf->flags |= ATA_TFLAG_WRITE; - - /* Calculate the SCSI LBA and transfer length. */ - switch (scsicmd[0]) { - case READ_10: - case WRITE_10: - scsi_10_lba_len(scsicmd, &block, &n_block); - break; - case READ_6: - case WRITE_6: - scsi_6_lba_len(scsicmd, &block, &n_block); - - /* for 6-byte r/w commands, transfer length 0 - * means 256 blocks of data, not 0 block. - */ - if (!n_block) - n_block = 256; - break; - case READ_16: - case WRITE_16: - scsi_16_lba_len(scsicmd, &block, &n_block); - break; - default: - DPRINTK("no-byte command\n"); - goto invalid_fld; } - /* Check and compose ATA command */ - if (!n_block) - /* For 10-byte and 16-byte SCSI R/W commands, transfer - * length 0 means transfer 0 block of data. - * However, for ATA R/W commands, sector count 0 means - * 256 or 65536 sectors, not 0 sectors as in SCSI. - */ - goto nothing_to_do; - - if (dev->flags & ATA_DFLAG_LBA) { - tf->flags |= ATA_TFLAG_LBA; + if (scsicmd[0] == READ_10 || scsicmd[0] == WRITE_10) { + if (lba48) { + tf->hob_nsect = scsicmd[7]; + tf->hob_lbal = scsicmd[2]; - if (dev->flags & ATA_DFLAG_LBA48) { - /* The request -may- be too large for LBA48. */ - if ((block >> 48) || (n_block > 65536)) - goto out_of_range; + qc->nsect = ((unsigned int)scsicmd[7] << 8) | + scsicmd[8]; + } else { + /* if we don't support LBA48 addressing, the request + * -may- be too large. */ + if ((scsicmd[2] & 0xf0) || scsicmd[7]) + return 1; - /* use LBA48 */ - tf->flags |= ATA_TFLAG_LBA48; + /* stores LBA27:24 in lower 4 bits of device reg */ + tf->device |= scsicmd[2]; - tf->hob_nsect = (n_block >> 8) & 0xff; + qc->nsect = scsicmd[8]; + } - tf->hob_lbah = (block >> 40) & 0xff; - tf->hob_lbam = (block >> 32) & 0xff; - tf->hob_lbal = (block >> 24) & 0xff; - } else { - /* use LBA28 */ + tf->nsect = scsicmd[8]; + tf->lbal = scsicmd[5]; + tf->lbam = scsicmd[4]; + tf->lbah = scsicmd[3]; - /* The request -may- be too large for LBA28. */ - if ((block >> 28) || (n_block > 256)) - goto out_of_range; + VPRINTK("ten-byte command\n"); + if (qc->nsect == 0) /* we don't support length==0 cmds */ + return 1; + return 0; + } - tf->device |= (block >> 24) & 0xf; + if (scsicmd[0] == READ_6 || scsicmd[0] == WRITE_6) { + qc->nsect = tf->nsect = scsicmd[4]; + if (!qc->nsect) { + qc->nsect = 256; + if (lba48) + tf->hob_nsect = 1; } - ata_rwcmd_protocol(qc); + tf->lbal = scsicmd[3]; + tf->lbam = scsicmd[2]; + tf->lbah = scsicmd[1] & 0x1f; /* mask out reserved bits */ - qc->nsect = n_block; - tf->nsect = n_block & 0xff; + VPRINTK("six-byte command\n"); + return 0; + } - tf->lbah = (block >> 16) & 0xff; - tf->lbam = (block >> 8) & 0xff; - tf->lbal = block & 0xff; + if (scsicmd[0] == READ_16 || scsicmd[0] == WRITE_16) { + /* rule out impossible LBAs and sector counts */ + if (scsicmd[2] || scsicmd[3] || scsicmd[10] || scsicmd[11]) + return 1; - tf->device |= ATA_LBA; - } else { - /* CHS */ - u32 sect, head, cyl, track; - - /* The request -may- be too large for CHS addressing. */ - if ((block >> 28) || (n_block > 256)) - goto out_of_range; - - ata_rwcmd_protocol(qc); - - /* Convert LBA to CHS */ - track = (u32)block / dev->sectors; - cyl = track / dev->heads; - head = track % dev->heads; - sect = (u32)block % dev->sectors + 1; - - DPRINTK("block %u track %u cyl %u head %u sect %u\n", - (u32)block, track, cyl, head, sect); - - /* Check whether the converted CHS can fit. - Cylinder: 0-65535 - Head: 0-15 - Sector: 1-255*/ - if ((cyl >> 16) || (head >> 4) || (sect >> 8) || (!sect)) - goto out_of_range; - - qc->nsect = n_block; - tf->nsect = n_block & 0xff; /* Sector count 0 means 256 sectors */ - tf->lbal = sect; - tf->lbam = cyl; - tf->lbah = cyl >> 8; - tf->device |= head; - } + if (lba48) { + tf->hob_nsect = scsicmd[12]; + tf->hob_lbal = scsicmd[6]; + tf->hob_lbam = scsicmd[5]; + tf->hob_lbah = scsicmd[4]; - return 0; + qc->nsect = ((unsigned int)scsicmd[12] << 8) | + scsicmd[13]; + } else { + /* once again, filter out impossible non-zero values */ + if (scsicmd[4] || scsicmd[5] || scsicmd[12] || + (scsicmd[6] & 0xf0)) + return 1; -invalid_fld: - ata_scsi_set_sense(qc->scsicmd, ILLEGAL_REQUEST, 0x24, 0x0); - /* "Invalid field in cbd" */ - return 1; + /* stores LBA27:24 in lower 4 bits of device reg */ + tf->device |= scsicmd[6]; -out_of_range: - ata_scsi_set_sense(qc->scsicmd, ILLEGAL_REQUEST, 0x21, 0x0); - /* "Logical Block Address out of range" */ - return 1; + qc->nsect = scsicmd[13]; + } + + tf->nsect = scsicmd[13]; + tf->lbal = scsicmd[9]; + tf->lbam = scsicmd[8]; + tf->lbah = scsicmd[7]; + + VPRINTK("sixteen-byte command\n"); + if (qc->nsect == 0) /* we don't support length==0 cmds */ + return 1; + return 0; + } -nothing_to_do: - qc->scsicmd->result = SAM_STAT_GOOD; + DPRINTK("no-byte command\n"); return 1; } @@ -907,12 +731,6 @@ static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) * This function sets up an ata_queued_cmd structure for the * SCSI command, and sends that ata_queued_cmd to the hardware. * - * The xlat_func argument (actor) returns 0 if ready to execute - * ATA command, else 1 to finish translation. If 1 is returned - * then cmd->result (and possibly cmd->sense_buffer) are assumed - * to be set reflecting an error condition or clean (early) - * termination. - * * LOCKING: * spin_lock_irqsave(host_set lock) */ @@ -929,7 +747,7 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev, qc = ata_scsi_qc_new(ap, dev, cmd, done); if (!qc) - goto err_mem; + return; /* data is present; dma-map it */ if (cmd->sc_data_direction == DMA_FROM_DEVICE || @@ -937,7 +755,7 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev, if (unlikely(cmd->request_bufflen < 1)) { printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n", ap->id, dev->devno); - goto err_did; + goto err_out; } if (cmd->use_sg) @@ -952,28 +770,19 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev, qc->complete_fn = ata_scsi_qc_complete; if (xlat_func(qc, scsicmd)) - goto early_finish; + goto err_out; /* select device, send command to hardware */ if (ata_qc_issue(qc)) - goto err_did; + goto err_out; VPRINTK("EXIT\n"); return; -early_finish: - ata_qc_free(qc); - done(cmd); - DPRINTK("EXIT - early finish (good or error)\n"); - return; - -err_did: +err_out: ata_qc_free(qc); -err_mem: - cmd->result = (DID_ERROR << 16); - done(cmd); - DPRINTK("EXIT - internal\n"); - return; + ata_bad_cdb(cmd, done); + DPRINTK("EXIT - badcmd\n"); } /** @@ -1040,8 +849,7 @@ static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, u8 *buf) * Mapping the response buffer, calling the command's handler, * and handling the handler's return value. This return value * indicates whether the handler wishes the SCSI command to be - * completed successfully (0), or not (in which case cmd->result - * and sense buffer are assumed to be set). + * completed successfully, or not. * * LOCKING: * spin_lock_irqsave(host_set lock) @@ -1060,9 +868,12 @@ void ata_scsi_rbuf_fill(struct ata_scsi_args *args, rc = actor(args, rbuf, buflen); ata_scsi_rbuf_put(cmd, rbuf); - if (rc == 0) + if (rc) + ata_bad_cdb(cmd, args->done); + else { cmd->result = SAM_STAT_GOOD; - args->done(cmd); + args->done(cmd); + } } /** @@ -1368,16 +1179,8 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, * in the same manner) */ page_control = scsicmd[2] >> 6; - switch (page_control) { - case 0: /* current */ - break; /* supported */ - case 3: /* saved */ - goto saving_not_supp; - case 1: /* changeable */ - case 2: /* defaults */ - default: - goto invalid_fld; - } + if ((page_control != 0) && (page_control != 3)) + return 1; if (six_byte) output_len = 4; @@ -1408,7 +1211,7 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, break; default: /* invalid page code */ - goto invalid_fld; + return 1; } if (six_byte) { @@ -1421,16 +1224,6 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, } return 0; - -invalid_fld: - ata_scsi_set_sense(args->cmd, ILLEGAL_REQUEST, 0x24, 0x0); - /* "Invalid field in cbd" */ - return 1; - -saving_not_supp: - ata_scsi_set_sense(args->cmd, ILLEGAL_REQUEST, 0x39, 0x0); - /* "Saving parameters not supported" */ - return 1; } /** @@ -1453,20 +1246,10 @@ unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, VPRINTK("ENTER\n"); - if (ata_id_has_lba(args->id)) { - if (ata_id_has_lba48(args->id)) - n_sectors = ata_id_u64(args->id, 100); - else - n_sectors = ata_id_u32(args->id, 60); - } else { - /* CHS default translation */ - n_sectors = args->id[1] * args->id[3] * args->id[6]; - - if (ata_id_current_chs_valid(args->id)) - /* CHS current translation */ - n_sectors = ata_id_u32(args->id, 57); - } - + if (ata_id_has_lba48(args->id)) + n_sectors = ata_id_u64(args->id, 100); + else + n_sectors = ata_id_u32(args->id, 60); n_sectors--; /* ATA TotalUserSectors - 1 */ if (args->cmd->cmnd[0] == READ_CAPACITY) { @@ -1529,34 +1312,6 @@ unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, return 0; } -/** - * ata_scsi_set_sense - Set SCSI sense data and status - * @cmd: SCSI request to be handled - * @sk: SCSI-defined sense key - * @asc: SCSI-defined additional sense code - * @ascq: SCSI-defined additional sense code qualifier - * - * Helper function that builds a valid fixed format, current - * response code and the given sense key (sk), additional sense - * code (asc) and additional sense code qualifier (ascq) with - * a SCSI command status of %SAM_STAT_CHECK_CONDITION and - * DRIVER_SENSE set in the upper bits of scsi_cmnd::result . - * - * LOCKING: - * Not required - */ - -void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) -{ - cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; - - cmd->sense_buffer[0] = 0x70; /* fixed format, current */ - cmd->sense_buffer[2] = sk; - cmd->sense_buffer[7] = 18 - 8; /* additional sense length */ - cmd->sense_buffer[12] = asc; - cmd->sense_buffer[13] = ascq; -} - /** * ata_scsi_badcmd - End a SCSI request with an error * @cmd: SCSI request to be handled @@ -1575,84 +1330,30 @@ void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 asc, u8 ascq) { DPRINTK("ENTER\n"); - ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, asc, ascq); - - done(cmd); -} - -void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, - struct scsi_cmnd *cmd) -{ - DECLARE_COMPLETION(wait); - struct ata_queued_cmd *qc; - unsigned long flags; - int rc; - - DPRINTK("ATAPI request sense\n"); - - qc = ata_qc_new_init(ap, dev); - BUG_ON(qc == NULL); - - /* FIXME: is this needed? */ - memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer)); - - ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer)); - qc->dma_dir = DMA_FROM_DEVICE; + cmd->result = SAM_STAT_CHECK_CONDITION; - memset(&qc->cdb, 0, ap->cdb_len); - qc->cdb[0] = REQUEST_SENSE; - qc->cdb[4] = SCSI_SENSE_BUFFERSIZE; - - qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; - qc->tf.command = ATA_CMD_PACKET; - - qc->tf.protocol = ATA_PROT_ATAPI; - qc->tf.lbam = (8 * 1024) & 0xff; - qc->tf.lbah = (8 * 1024) >> 8; - qc->nbytes = SCSI_SENSE_BUFFERSIZE; - - qc->waiting = &wait; - qc->complete_fn = ata_qc_complete_noop; - - spin_lock_irqsave(&ap->host_set->lock, flags); - rc = ata_qc_issue(qc); - spin_unlock_irqrestore(&ap->host_set->lock, flags); - - if (rc) - ata_port_disable(ap); - else - wait_for_completion(&wait); + cmd->sense_buffer[0] = 0x70; + cmd->sense_buffer[2] = ILLEGAL_REQUEST; + cmd->sense_buffer[7] = 14 - 8; /* addnl. sense len. FIXME: correct? */ + cmd->sense_buffer[12] = asc; + cmd->sense_buffer[13] = ascq; - DPRINTK("EXIT\n"); + done(cmd); } static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) { struct scsi_cmnd *cmd = qc->scsicmd; - VPRINTK("ENTER, drv_stat == 0x%x\n", drv_stat); - - if (unlikely(drv_stat & (ATA_BUSY | ATA_DRQ))) - ata_to_sense_error(qc, drv_stat); - - else if (unlikely(drv_stat & ATA_ERR)) { + if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ))) { DPRINTK("request check condition\n"); - /* FIXME: command completion with check condition - * but no sense causes the error handler to run, - * which then issues REQUEST SENSE, fills in the sense - * buffer, and completes the command (for the second - * time). We need to issue REQUEST SENSE some other - * way, to avoid completing the command twice. - */ cmd->result = SAM_STAT_CHECK_CONDITION; qc->scsidone(cmd); return 1; - } - - else { + } else { u8 *scsicmd = cmd->cmnd; if (scsicmd[0] == INQUIRY) { @@ -1660,30 +1361,15 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) unsigned int buflen; buflen = ata_scsi_rbuf_get(cmd, &buf); - - /* ATAPI devices typically report zero for their SCSI version, - * and sometimes deviate from the spec WRT response data - * format. If SCSI version is reported as zero like normal, - * then we make the following fixups: 1) Fake MMC-5 version, - * to indicate to the Linux scsi midlayer this is a modern - * device. 2) Ensure response data format / ATAPI information - * are always correct. - */ - /* FIXME: do we ever override EVPD pages and the like, with - * this code? - */ - if (buf[2] == 0) { - buf[2] = 0x5; - buf[3] = 0x32; - } - + buf[2] = 0x5; + buf[3] = (buf[3] & 0xf0) | 2; ata_scsi_rbuf_put(cmd, buf); } - cmd->result = SAM_STAT_GOOD; } qc->scsidone(cmd); + return 0; } /** @@ -1944,7 +1630,7 @@ void ata_scsi_simulate(u16 *id, case INQUIRY: if (scsicmd[1] & 2) /* is CmdDt set? */ - ata_scsi_invalid_field(cmd, done); + ata_bad_cdb(cmd, done); else if ((scsicmd[1] & 1) == 0) /* is EVPD clear? */ ata_scsi_rbuf_fill(&args, ata_scsiop_inq_std); else if (scsicmd[2] == 0x00) @@ -1954,7 +1640,7 @@ void ata_scsi_simulate(u16 *id, else if (scsicmd[2] == 0x83) ata_scsi_rbuf_fill(&args, ata_scsiop_inq_83); else - ata_scsi_invalid_field(cmd, done); + ata_bad_cdb(cmd, done); break; case MODE_SENSE: @@ -1964,7 +1650,7 @@ void ata_scsi_simulate(u16 *id, case MODE_SELECT: /* unconditionally return */ case MODE_SELECT_10: /* bad-field-in-cdb */ - ata_scsi_invalid_field(cmd, done); + ata_bad_cdb(cmd, done); break; case READ_CAPACITY: @@ -1975,7 +1661,7 @@ void ata_scsi_simulate(u16 *id, if ((scsicmd[1] & 0x1f) == SAI_READ_CAPACITY_16) ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap); else - ata_scsi_invalid_field(cmd, done); + ata_bad_cdb(cmd, done); break; case REPORT_LUNS: @@ -1987,26 +1673,8 @@ void ata_scsi_simulate(u16 *id, /* all other commands */ default: - ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, 0x20, 0x0); - /* "Invalid command operation code" */ - done(cmd); + ata_bad_scsiop(cmd, done); break; } } -void ata_scsi_scan_host(struct ata_port *ap) -{ - struct ata_device *dev; - unsigned int i; - - if (ap->flags & ATA_FLAG_PORT_DISABLED) - return; - - for (i = 0; i < ATA_MAX_DEVICES; i++) { - dev = &ap->device[i]; - - if (ata_dev_present(dev)) - scsi_scan_target(&ap->host->shost_gendev, 0, i, 0, 0); - } -} - diff --git a/trunk/drivers/scsi/libata.h b/trunk/drivers/scsi/libata.h index 67d752ca8ae2..d608b3a0f6fe 100644 --- a/trunk/drivers/scsi/libata.h +++ b/trunk/drivers/scsi/libata.h @@ -39,10 +39,8 @@ struct ata_scsi_args { /* libata-core.c */ extern int atapi_enabled; -extern int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat); extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, struct ata_device *dev); -extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); extern void ata_qc_free(struct ata_queued_cmd *qc); extern int ata_qc_issue(struct ata_queued_cmd *qc); extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); @@ -53,9 +51,6 @@ extern void swap_buf_le16(u16 *buf, unsigned int buf_words); /* libata-scsi.c */ -extern void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, - struct scsi_cmnd *cmd); -extern void ata_scsi_scan_host(struct ata_port *ap); extern void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat); extern int ata_scsi_error(struct Scsi_Host *host); extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, @@ -81,10 +76,18 @@ extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, extern void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 asc, u8 ascq); -extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, - u8 sk, u8 asc, u8 ascq); extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args, unsigned int (*actor) (struct ata_scsi_args *args, u8 *rbuf, unsigned int buflen)); +static inline void ata_bad_scsiop(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +{ + ata_scsi_badcmd(cmd, done, 0x20, 0x00); +} + +static inline void ata_bad_cdb(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +{ + ata_scsi_badcmd(cmd, done, 0x24, 0x00); +} + #endif /* __LIBATA_H__ */ diff --git a/trunk/drivers/scsi/lpfc/lpfc_attr.c b/trunk/drivers/scsi/lpfc/lpfc_attr.c index acae7c48ef7d..86eaf6d408d5 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_attr.c +++ b/trunk/drivers/scsi/lpfc/lpfc_attr.c @@ -973,10 +973,10 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost) if ((phba->fc_flag & FC_FABRIC) || ((phba->fc_topology == TOPOLOGY_LOOP) && (phba->fc_flag & FC_PUBLIC_LOOP))) - node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); + node_name = wwn_to_u64(phba->fc_fabparam.nodeName.wwn); else /* fabric is local port if there is no F/FL_Port */ - node_name = wwn_to_u64(phba->fc_nodename.u.wwn); + node_name = wwn_to_u64(phba->fc_nodename.wwn); spin_unlock_irq(shost->host_lock); @@ -1110,7 +1110,7 @@ lpfc_get_starget_node_name(struct scsi_target *starget) /* Search the mapped list for this target ID */ list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { if (starget->id == ndlp->nlp_sid) { - node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); + node_name = wwn_to_u64(ndlp->nlp_nodename.wwn); break; } } @@ -1131,7 +1131,7 @@ lpfc_get_starget_port_name(struct scsi_target *starget) /* Search the mapped list for this target ID */ list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { if (starget->id == ndlp->nlp_sid) { - port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); + port_name = wwn_to_u64(ndlp->nlp_portname.wwn); break; } } diff --git a/trunk/drivers/scsi/lpfc/lpfc_hbadisc.c b/trunk/drivers/scsi/lpfc/lpfc_hbadisc.c index 56052f4510c3..4fb8eb0c84cf 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/trunk/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -1019,8 +1019,8 @@ lpfc_register_remote_port(struct lpfc_hba * phba, struct fc_rport_identifiers rport_ids; /* Remote port has reappeared. Re-register w/ FC transport */ - rport_ids.node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); - rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); + rport_ids.node_name = wwn_to_u64(ndlp->nlp_nodename.wwn); + rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.wwn); rport_ids.port_id = ndlp->nlp_DID; rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; if (ndlp->nlp_type & NLP_FCP_TARGET) diff --git a/trunk/drivers/scsi/lpfc/lpfc_hw.h b/trunk/drivers/scsi/lpfc/lpfc_hw.h index 86c41981188b..047a87c26cc0 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_hw.h +++ b/trunk/drivers/scsi/lpfc/lpfc_hw.h @@ -280,9 +280,9 @@ struct lpfc_name { #define NAME_CCITT_GR_TYPE 0xE uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */ uint8_t IEEE[6]; /* FC IEEE address */ - } s; + }; uint8_t wwn[8]; - } u; + }; }; struct csp { diff --git a/trunk/drivers/scsi/lpfc/lpfc_init.c b/trunk/drivers/scsi/lpfc/lpfc_init.c index 0856ff7d3b33..454058f655db 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_init.c +++ b/trunk/drivers/scsi/lpfc/lpfc_init.c @@ -285,7 +285,7 @@ lpfc_config_port_post(struct lpfc_hba * phba) if (phba->SerialNumber[0] == 0) { uint8_t *outptr; - outptr = &phba->fc_nodename.u.s.IEEE[0]; + outptr = (uint8_t *) & phba->fc_nodename.IEEE[0]; for (i = 0; i < 12; i++) { status = *outptr++; j = ((status & 0xf0) >> 4); @@ -1523,8 +1523,8 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) * Must done after lpfc_sli_hba_setup() */ - fc_host_node_name(host) = wwn_to_u64(phba->fc_nodename.u.wwn); - fc_host_port_name(host) = wwn_to_u64(phba->fc_portname.u.wwn); + fc_host_node_name(host) = wwn_to_u64(phba->fc_nodename.wwn); + fc_host_port_name(host) = wwn_to_u64(phba->fc_portname.wwn); fc_host_supported_classes(host) = FC_COS_CLASS3; memset(fc_host_supported_fc4s(host), 0, diff --git a/trunk/drivers/scsi/megaraid.c b/trunk/drivers/scsi/megaraid.c index 61a6fd810bb4..6f308ebe3e79 100644 --- a/trunk/drivers/scsi/megaraid.c +++ b/trunk/drivers/scsi/megaraid.c @@ -621,6 +621,8 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy) if(islogical) { switch (cmd->cmnd[0]) { case TEST_UNIT_READY: + memset(cmd->request_buffer, 0, cmd->request_bufflen); + #if MEGA_HAVE_CLUSTERING /* * Do we support clustering and is the support enabled @@ -650,28 +652,11 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy) return NULL; #endif - case MODE_SENSE: { - char *buf; - - if (cmd->use_sg) { - struct scatterlist *sg; - - sg = (struct scatterlist *)cmd->request_buffer; - buf = kmap_atomic(sg->page, KM_IRQ0) + - sg->offset; - } else - buf = cmd->request_buffer; + case MODE_SENSE: memset(cmd->request_buffer, 0, cmd->cmnd[4]); - if (cmd->use_sg) { - struct scatterlist *sg; - - sg = (struct scatterlist *)cmd->request_buffer; - kunmap_atomic(buf - sg->offset, KM_IRQ0); - } cmd->result = (DID_OK << 16); cmd->scsi_done(cmd); return NULL; - } case READ_CAPACITY: case INQUIRY: @@ -1700,23 +1685,14 @@ mega_rundoneq (adapter_t *adapter) static void mega_free_scb(adapter_t *adapter, scb_t *scb) { - unsigned long length; - switch( scb->dma_type ) { case MEGA_DMA_TYPE_NONE: break; case MEGA_BULK_DATA: - if (scb->cmd->use_sg == 0) - length = scb->cmd->request_bufflen; - else { - struct scatterlist *sgl = - (struct scatterlist *)scb->cmd->request_buffer; - length = sgl->length; - } pci_unmap_page(adapter->dev, scb->dma_h_bulkdata, - length, scb->dma_direction); + scb->cmd->request_bufflen, scb->dma_direction); break; case MEGA_SGLIST: @@ -1765,7 +1741,6 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len) struct scatterlist *sgl; struct page *page; unsigned long offset; - unsigned int length; Scsi_Cmnd *cmd; int sgcnt; int idx; @@ -1773,23 +1748,14 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len) cmd = scb->cmd; /* Scatter-gather not used */ - if( cmd->use_sg == 0 || (cmd->use_sg == 1 && - !adapter->has_64bit_addr)) { - - if (cmd->use_sg == 0) { - page = virt_to_page(cmd->request_buffer); - offset = offset_in_page(cmd->request_buffer); - length = cmd->request_bufflen; - } else { - sgl = (struct scatterlist *)cmd->request_buffer; - page = sgl->page; - offset = sgl->offset; - length = sgl->length; - } + if( !cmd->use_sg ) { + + page = virt_to_page(cmd->request_buffer); + offset = offset_in_page(cmd->request_buffer); scb->dma_h_bulkdata = pci_map_page(adapter->dev, page, offset, - length, + cmd->request_bufflen, scb->dma_direction); scb->dma_type = MEGA_BULK_DATA; @@ -1799,14 +1765,14 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len) */ if( adapter->has_64bit_addr ) { scb->sgl64[0].address = scb->dma_h_bulkdata; - scb->sgl64[0].length = length; + scb->sgl64[0].length = cmd->request_bufflen; *buf = (u32)scb->sgl_dma_addr; - *len = (u32)length; + *len = (u32)cmd->request_bufflen; return 1; } else { *buf = (u32)scb->dma_h_bulkdata; - *len = (u32)length; + *len = (u32)cmd->request_bufflen; } return 0; } @@ -1825,23 +1791,27 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len) if( sgcnt > adapter->sglen ) BUG(); - *len = 0; - for( idx = 0; idx < sgcnt; idx++, sgl++ ) { if( adapter->has_64bit_addr ) { scb->sgl64[idx].address = sg_dma_address(sgl); - *len += scb->sgl64[idx].length = sg_dma_len(sgl); + scb->sgl64[idx].length = sg_dma_len(sgl); } else { scb->sgl[idx].address = sg_dma_address(sgl); - *len += scb->sgl[idx].length = sg_dma_len(sgl); + scb->sgl[idx].length = sg_dma_len(sgl); } } /* Reset pointer and length fields */ *buf = scb->sgl_dma_addr; + /* + * For passthru command, dataxferlen must be set, even for commands + * with a sg list + */ + *len = (u32)cmd->request_bufflen; + /* Return count of SG requests */ return sgcnt; } diff --git a/trunk/drivers/scsi/megaraid/Kconfig.megaraid b/trunk/drivers/scsi/megaraid/Kconfig.megaraid index 7363e12663ac..917d591d90b2 100644 --- a/trunk/drivers/scsi/megaraid/Kconfig.megaraid +++ b/trunk/drivers/scsi/megaraid/Kconfig.megaraid @@ -76,12 +76,3 @@ config MEGARAID_LEGACY To compile this driver as a module, choose M here: the module will be called megaraid endif - -config MEGARAID_SAS - tristate "LSI Logic MegaRAID SAS RAID Module" - depends on PCI && SCSI - help - Module for LSI Logic's SAS based RAID controllers. - To compile this driver as a module, choose 'm' here. - Module will be called megaraid_sas - diff --git a/trunk/drivers/scsi/megaraid/Makefile b/trunk/drivers/scsi/megaraid/Makefile index f469915b97c3..6dd99f275722 100644 --- a/trunk/drivers/scsi/megaraid/Makefile +++ b/trunk/drivers/scsi/megaraid/Makefile @@ -1,3 +1,2 @@ obj-$(CONFIG_MEGARAID_MM) += megaraid_mm.o obj-$(CONFIG_MEGARAID_MAILBOX) += megaraid_mbox.o -obj-$(CONFIG_MEGARAID_SAS) += megaraid_sas.o diff --git a/trunk/drivers/scsi/megaraid/megaraid_sas.c b/trunk/drivers/scsi/megaraid/megaraid_sas.c deleted file mode 100644 index c3f637395734..000000000000 --- a/trunk/drivers/scsi/megaraid/megaraid_sas.c +++ /dev/null @@ -1,2806 +0,0 @@ -/* - * - * Linux MegaRAID driver for SAS based RAID controllers - * - * Copyright (c) 2003-2005 LSI Logic Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - * FILE : megaraid_sas.c - * Version : v00.00.02.00-rc4 - * - * Authors: - * Sreenivas Bagalkote - * Sumant Patro - * - * List of supported controllers - * - * OEM Product Name VID DID SSVID SSID - * --- ------------ --- --- ---- ---- - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "megaraid_sas.h" - -MODULE_LICENSE("GPL"); -MODULE_VERSION(MEGASAS_VERSION); -MODULE_AUTHOR("sreenivas.bagalkote@lsil.com"); -MODULE_DESCRIPTION("LSI Logic MegaRAID SAS Driver"); - -/* - * PCI ID table for all supported controllers - */ -static struct pci_device_id megasas_pci_table[] = { - - { - PCI_VENDOR_ID_LSI_LOGIC, - PCI_DEVICE_ID_LSI_SAS1064R, - PCI_ANY_ID, - PCI_ANY_ID, - }, - { - PCI_VENDOR_ID_DELL, - PCI_DEVICE_ID_DELL_PERC5, - PCI_ANY_ID, - PCI_ANY_ID, - }, - {0} /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE(pci, megasas_pci_table); - -static int megasas_mgmt_majorno; -static struct megasas_mgmt_info megasas_mgmt_info; -static struct fasync_struct *megasas_async_queue; -static DECLARE_MUTEX(megasas_async_queue_mutex); - -/** - * megasas_get_cmd - Get a command from the free pool - * @instance: Adapter soft state - * - * Returns a free command from the pool - */ -static inline struct megasas_cmd *megasas_get_cmd(struct megasas_instance - *instance) -{ - unsigned long flags; - struct megasas_cmd *cmd = NULL; - - spin_lock_irqsave(&instance->cmd_pool_lock, flags); - - if (!list_empty(&instance->cmd_pool)) { - cmd = list_entry((&instance->cmd_pool)->next, - struct megasas_cmd, list); - list_del_init(&cmd->list); - } else { - printk(KERN_ERR "megasas: Command pool empty!\n"); - } - - spin_unlock_irqrestore(&instance->cmd_pool_lock, flags); - return cmd; -} - -/** - * megasas_return_cmd - Return a cmd to free command pool - * @instance: Adapter soft state - * @cmd: Command packet to be returned to free command pool - */ -static inline void -megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) -{ - unsigned long flags; - - spin_lock_irqsave(&instance->cmd_pool_lock, flags); - - cmd->scmd = NULL; - list_add_tail(&cmd->list, &instance->cmd_pool); - - spin_unlock_irqrestore(&instance->cmd_pool_lock, flags); -} - -/** - * megasas_enable_intr - Enables interrupts - * @regs: MFI register set - */ -static inline void -megasas_enable_intr(struct megasas_register_set __iomem * regs) -{ - writel(1, &(regs)->outbound_intr_mask); - - /* Dummy readl to force pci flush */ - readl(®s->outbound_intr_mask); -} - -/** - * megasas_disable_intr - Disables interrupts - * @regs: MFI register set - */ -static inline void -megasas_disable_intr(struct megasas_register_set __iomem * regs) -{ - u32 mask = readl(®s->outbound_intr_mask) & (~0x00000001); - writel(mask, ®s->outbound_intr_mask); - - /* Dummy readl to force pci flush */ - readl(®s->outbound_intr_mask); -} - -/** - * megasas_issue_polled - Issues a polling command - * @instance: Adapter soft state - * @cmd: Command packet to be issued - * - * For polling, MFI requires the cmd_status to be set to 0xFF before posting. - */ -static int -megasas_issue_polled(struct megasas_instance *instance, struct megasas_cmd *cmd) -{ - int i; - u32 msecs = MFI_POLL_TIMEOUT_SECS * 1000; - - struct megasas_header *frame_hdr = &cmd->frame->hdr; - - frame_hdr->cmd_status = 0xFF; - frame_hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; - - /* - * Issue the frame using inbound queue port - */ - writel(cmd->frame_phys_addr >> 3, - &instance->reg_set->inbound_queue_port); - - /* - * Wait for cmd_status to change - */ - for (i = 0; (i < msecs) && (frame_hdr->cmd_status == 0xff); i++) { - rmb(); - msleep(1); - } - - if (frame_hdr->cmd_status == 0xff) - return -ETIME; - - return 0; -} - -/** - * megasas_issue_blocked_cmd - Synchronous wrapper around regular FW cmds - * @instance: Adapter soft state - * @cmd: Command to be issued - * - * This function waits on an event for the command to be returned from ISR. - * Used to issue ioctl commands. - */ -static int -megasas_issue_blocked_cmd(struct megasas_instance *instance, - struct megasas_cmd *cmd) -{ - cmd->cmd_status = ENODATA; - - writel(cmd->frame_phys_addr >> 3, - &instance->reg_set->inbound_queue_port); - - wait_event(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA)); - - return 0; -} - -/** - * megasas_issue_blocked_abort_cmd - Aborts previously issued cmd - * @instance: Adapter soft state - * @cmd_to_abort: Previously issued cmd to be aborted - * - * MFI firmware can abort previously issued AEN comamnd (automatic event - * notification). The megasas_issue_blocked_abort_cmd() issues such abort - * cmd and blocks till it is completed. - */ -static int -megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, - struct megasas_cmd *cmd_to_abort) -{ - struct megasas_cmd *cmd; - struct megasas_abort_frame *abort_fr; - - cmd = megasas_get_cmd(instance); - - if (!cmd) - return -1; - - abort_fr = &cmd->frame->abort; - - /* - * Prepare and issue the abort frame - */ - abort_fr->cmd = MFI_CMD_ABORT; - abort_fr->cmd_status = 0xFF; - abort_fr->flags = 0; - abort_fr->abort_context = cmd_to_abort->index; - abort_fr->abort_mfi_phys_addr_lo = cmd_to_abort->frame_phys_addr; - abort_fr->abort_mfi_phys_addr_hi = 0; - - cmd->sync_cmd = 1; - cmd->cmd_status = 0xFF; - - writel(cmd->frame_phys_addr >> 3, - &instance->reg_set->inbound_queue_port); - - /* - * Wait for this cmd to complete - */ - wait_event(instance->abort_cmd_wait_q, (cmd->cmd_status != 0xFF)); - - megasas_return_cmd(instance, cmd); - return 0; -} - -/** - * megasas_make_sgl32 - Prepares 32-bit SGL - * @instance: Adapter soft state - * @scp: SCSI command from the mid-layer - * @mfi_sgl: SGL to be filled in - * - * If successful, this function returns the number of SG elements. Otherwise, - * it returnes -1. - */ -static inline int -megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp, - union megasas_sgl *mfi_sgl) -{ - int i; - int sge_count; - struct scatterlist *os_sgl; - - /* - * Return 0 if there is no data transfer - */ - if (!scp->request_buffer || !scp->request_bufflen) - return 0; - - if (!scp->use_sg) { - mfi_sgl->sge32[0].phys_addr = pci_map_single(instance->pdev, - scp-> - request_buffer, - scp-> - request_bufflen, - scp-> - sc_data_direction); - mfi_sgl->sge32[0].length = scp->request_bufflen; - - return 1; - } - - os_sgl = (struct scatterlist *)scp->request_buffer; - sge_count = pci_map_sg(instance->pdev, os_sgl, scp->use_sg, - scp->sc_data_direction); - - for (i = 0; i < sge_count; i++, os_sgl++) { - mfi_sgl->sge32[i].length = sg_dma_len(os_sgl); - mfi_sgl->sge32[i].phys_addr = sg_dma_address(os_sgl); - } - - return sge_count; -} - -/** - * megasas_make_sgl64 - Prepares 64-bit SGL - * @instance: Adapter soft state - * @scp: SCSI command from the mid-layer - * @mfi_sgl: SGL to be filled in - * - * If successful, this function returns the number of SG elements. Otherwise, - * it returnes -1. - */ -static inline int -megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp, - union megasas_sgl *mfi_sgl) -{ - int i; - int sge_count; - struct scatterlist *os_sgl; - - /* - * Return 0 if there is no data transfer - */ - if (!scp->request_buffer || !scp->request_bufflen) - return 0; - - if (!scp->use_sg) { - mfi_sgl->sge64[0].phys_addr = pci_map_single(instance->pdev, - scp-> - request_buffer, - scp-> - request_bufflen, - scp-> - sc_data_direction); - - mfi_sgl->sge64[0].length = scp->request_bufflen; - - return 1; - } - - os_sgl = (struct scatterlist *)scp->request_buffer; - sge_count = pci_map_sg(instance->pdev, os_sgl, scp->use_sg, - scp->sc_data_direction); - - for (i = 0; i < sge_count; i++, os_sgl++) { - mfi_sgl->sge64[i].length = sg_dma_len(os_sgl); - mfi_sgl->sge64[i].phys_addr = sg_dma_address(os_sgl); - } - - return sge_count; -} - -/** - * megasas_build_dcdb - Prepares a direct cdb (DCDB) command - * @instance: Adapter soft state - * @scp: SCSI command - * @cmd: Command to be prepared in - * - * This function prepares CDB commands. These are typcially pass-through - * commands to the devices. - */ -static inline int -megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, - struct megasas_cmd *cmd) -{ - u32 sge_sz; - int sge_bytes; - u32 is_logical; - u32 device_id; - u16 flags = 0; - struct megasas_pthru_frame *pthru; - - is_logical = MEGASAS_IS_LOGICAL(scp); - device_id = MEGASAS_DEV_INDEX(instance, scp); - pthru = (struct megasas_pthru_frame *)cmd->frame; - - if (scp->sc_data_direction == PCI_DMA_TODEVICE) - flags = MFI_FRAME_DIR_WRITE; - else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) - flags = MFI_FRAME_DIR_READ; - else if (scp->sc_data_direction == PCI_DMA_NONE) - flags = MFI_FRAME_DIR_NONE; - - /* - * Prepare the DCDB frame - */ - pthru->cmd = (is_logical) ? MFI_CMD_LD_SCSI_IO : MFI_CMD_PD_SCSI_IO; - pthru->cmd_status = 0x0; - pthru->scsi_status = 0x0; - pthru->target_id = device_id; - pthru->lun = scp->device->lun; - pthru->cdb_len = scp->cmd_len; - pthru->timeout = 0; - pthru->flags = flags; - pthru->data_xfer_len = scp->request_bufflen; - - memcpy(pthru->cdb, scp->cmnd, scp->cmd_len); - - /* - * Construct SGL - */ - sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) : - sizeof(struct megasas_sge32); - - if (IS_DMA64) { - pthru->flags |= MFI_FRAME_SGL64; - pthru->sge_count = megasas_make_sgl64(instance, scp, - &pthru->sgl); - } else - pthru->sge_count = megasas_make_sgl32(instance, scp, - &pthru->sgl); - - /* - * Sense info specific - */ - pthru->sense_len = SCSI_SENSE_BUFFERSIZE; - pthru->sense_buf_phys_addr_hi = 0; - pthru->sense_buf_phys_addr_lo = cmd->sense_phys_addr; - - sge_bytes = sge_sz * pthru->sge_count; - - /* - * Compute the total number of frames this command consumes. FW uses - * this number to pull sufficient number of frames from host memory. - */ - cmd->frame_count = (sge_bytes / MEGAMFI_FRAME_SIZE) + - ((sge_bytes % MEGAMFI_FRAME_SIZE) ? 1 : 0) + 1; - - if (cmd->frame_count > 7) - cmd->frame_count = 8; - - return cmd->frame_count; -} - -/** - * megasas_build_ldio - Prepares IOs to logical devices - * @instance: Adapter soft state - * @scp: SCSI command - * @cmd: Command to to be prepared - * - * Frames (and accompanying SGLs) for regular SCSI IOs use this function. - */ -static inline int -megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, - struct megasas_cmd *cmd) -{ - u32 sge_sz; - int sge_bytes; - u32 device_id; - u8 sc = scp->cmnd[0]; - u16 flags = 0; - struct megasas_io_frame *ldio; - - device_id = MEGASAS_DEV_INDEX(instance, scp); - ldio = (struct megasas_io_frame *)cmd->frame; - - if (scp->sc_data_direction == PCI_DMA_TODEVICE) - flags = MFI_FRAME_DIR_WRITE; - else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) - flags = MFI_FRAME_DIR_READ; - - /* - * Preare the Logical IO frame: 2nd bit is zero for all read cmds - */ - ldio->cmd = (sc & 0x02) ? MFI_CMD_LD_WRITE : MFI_CMD_LD_READ; - ldio->cmd_status = 0x0; - ldio->scsi_status = 0x0; - ldio->target_id = device_id; - ldio->timeout = 0; - ldio->reserved_0 = 0; - ldio->pad_0 = 0; - ldio->flags = flags; - ldio->start_lba_hi = 0; - ldio->access_byte = (scp->cmd_len != 6) ? scp->cmnd[1] : 0; - - /* - * 6-byte READ(0x08) or WRITE(0x0A) cdb - */ - if (scp->cmd_len == 6) { - ldio->lba_count = (u32) scp->cmnd[4]; - ldio->start_lba_lo = ((u32) scp->cmnd[1] << 16) | - ((u32) scp->cmnd[2] << 8) | (u32) scp->cmnd[3]; - - ldio->start_lba_lo &= 0x1FFFFF; - } - - /* - * 10-byte READ(0x28) or WRITE(0x2A) cdb - */ - else if (scp->cmd_len == 10) { - ldio->lba_count = (u32) scp->cmnd[8] | - ((u32) scp->cmnd[7] << 8); - ldio->start_lba_lo = ((u32) scp->cmnd[2] << 24) | - ((u32) scp->cmnd[3] << 16) | - ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5]; - } - - /* - * 12-byte READ(0xA8) or WRITE(0xAA) cdb - */ - else if (scp->cmd_len == 12) { - ldio->lba_count = ((u32) scp->cmnd[6] << 24) | - ((u32) scp->cmnd[7] << 16) | - ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9]; - - ldio->start_lba_lo = ((u32) scp->cmnd[2] << 24) | - ((u32) scp->cmnd[3] << 16) | - ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5]; - } - - /* - * 16-byte READ(0x88) or WRITE(0x8A) cdb - */ - else if (scp->cmd_len == 16) { - ldio->lba_count = ((u32) scp->cmnd[10] << 24) | - ((u32) scp->cmnd[11] << 16) | - ((u32) scp->cmnd[12] << 8) | (u32) scp->cmnd[13]; - - ldio->start_lba_lo = ((u32) scp->cmnd[6] << 24) | - ((u32) scp->cmnd[7] << 16) | - ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9]; - - ldio->start_lba_hi = ((u32) scp->cmnd[2] << 24) | - ((u32) scp->cmnd[3] << 16) | - ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5]; - - } - - /* - * Construct SGL - */ - sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) : - sizeof(struct megasas_sge32); - - if (IS_DMA64) { - ldio->flags |= MFI_FRAME_SGL64; - ldio->sge_count = megasas_make_sgl64(instance, scp, &ldio->sgl); - } else - ldio->sge_count = megasas_make_sgl32(instance, scp, &ldio->sgl); - - /* - * Sense info specific - */ - ldio->sense_len = SCSI_SENSE_BUFFERSIZE; - ldio->sense_buf_phys_addr_hi = 0; - ldio->sense_buf_phys_addr_lo = cmd->sense_phys_addr; - - sge_bytes = sge_sz * ldio->sge_count; - - cmd->frame_count = (sge_bytes / MEGAMFI_FRAME_SIZE) + - ((sge_bytes % MEGAMFI_FRAME_SIZE) ? 1 : 0) + 1; - - if (cmd->frame_count > 7) - cmd->frame_count = 8; - - return cmd->frame_count; -} - -/** - * megasas_build_cmd - Prepares a command packet - * @instance: Adapter soft state - * @scp: SCSI command - * @frame_count: [OUT] Number of frames used to prepare this command - */ -static inline struct megasas_cmd *megasas_build_cmd(struct megasas_instance - *instance, - struct scsi_cmnd *scp, - int *frame_count) -{ - u32 logical_cmd; - struct megasas_cmd *cmd; - - /* - * Find out if this is logical or physical drive command. - */ - logical_cmd = MEGASAS_IS_LOGICAL(scp); - - /* - * Logical drive command - */ - if (logical_cmd) { - - if (scp->device->id >= MEGASAS_MAX_LD) { - scp->result = DID_BAD_TARGET << 16; - return NULL; - } - - switch (scp->cmnd[0]) { - - case READ_10: - case WRITE_10: - case READ_12: - case WRITE_12: - case READ_6: - case WRITE_6: - case READ_16: - case WRITE_16: - /* - * Fail for LUN > 0 - */ - if (scp->device->lun) { - scp->result = DID_BAD_TARGET << 16; - return NULL; - } - - cmd = megasas_get_cmd(instance); - - if (!cmd) { - scp->result = DID_IMM_RETRY << 16; - return NULL; - } - - *frame_count = megasas_build_ldio(instance, scp, cmd); - - if (!(*frame_count)) { - megasas_return_cmd(instance, cmd); - return NULL; - } - - return cmd; - - default: - /* - * Fail for LUN > 0 - */ - if (scp->device->lun) { - scp->result = DID_BAD_TARGET << 16; - return NULL; - } - - cmd = megasas_get_cmd(instance); - - if (!cmd) { - scp->result = DID_IMM_RETRY << 16; - return NULL; - } - - *frame_count = megasas_build_dcdb(instance, scp, cmd); - - if (!(*frame_count)) { - megasas_return_cmd(instance, cmd); - return NULL; - } - - return cmd; - } - } else { - cmd = megasas_get_cmd(instance); - - if (!cmd) { - scp->result = DID_IMM_RETRY << 16; - return NULL; - } - - *frame_count = megasas_build_dcdb(instance, scp, cmd); - - if (!(*frame_count)) { - megasas_return_cmd(instance, cmd); - return NULL; - } - - return cmd; - } - - return NULL; -} - -/** - * megasas_queue_command - Queue entry point - * @scmd: SCSI command to be queued - * @done: Callback entry point - */ -static int -megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) -{ - u32 frame_count; - unsigned long flags; - struct megasas_cmd *cmd; - struct megasas_instance *instance; - - instance = (struct megasas_instance *) - scmd->device->host->hostdata; - scmd->scsi_done = done; - scmd->result = 0; - - cmd = megasas_build_cmd(instance, scmd, &frame_count); - - if (!cmd) { - done(scmd); - return 0; - } - - cmd->scmd = scmd; - scmd->SCp.ptr = (char *)cmd; - scmd->SCp.sent_command = jiffies; - - /* - * Issue the command to the FW - */ - spin_lock_irqsave(&instance->instance_lock, flags); - instance->fw_outstanding++; - spin_unlock_irqrestore(&instance->instance_lock, flags); - - writel(((cmd->frame_phys_addr >> 3) | (cmd->frame_count - 1)), - &instance->reg_set->inbound_queue_port); - - return 0; -} - -/** - * megasas_wait_for_outstanding - Wait for all outstanding cmds - * @instance: Adapter soft state - * - * This function waits for upto MEGASAS_RESET_WAIT_TIME seconds for FW to - * complete all its outstanding commands. Returns error if one or more IOs - * are pending after this time period. It also marks the controller dead. - */ -static int megasas_wait_for_outstanding(struct megasas_instance *instance) -{ - int i; - u32 wait_time = MEGASAS_RESET_WAIT_TIME; - - for (i = 0; i < wait_time; i++) { - - if (!instance->fw_outstanding) - break; - - if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) { - printk(KERN_NOTICE "megasas: [%2d]waiting for %d " - "commands to complete\n", i, - instance->fw_outstanding); - } - - msleep(1000); - } - - if (instance->fw_outstanding) { - instance->hw_crit_error = 1; - return FAILED; - } - - return SUCCESS; -} - -/** - * megasas_generic_reset - Generic reset routine - * @scmd: Mid-layer SCSI command - * - * This routine implements a generic reset handler for device, bus and host - * reset requests. Device, bus and host specific reset handlers can use this - * function after they do their specific tasks. - */ -static int megasas_generic_reset(struct scsi_cmnd *scmd) -{ - int ret_val; - struct megasas_instance *instance; - - instance = (struct megasas_instance *)scmd->device->host->hostdata; - - printk(KERN_NOTICE "megasas: RESET -%ld cmd=%x \n", - scmd->serial_number, scmd->cmnd[0], scmd->device->channel, - scmd->device->id, scmd->device->lun); - - if (instance->hw_crit_error) { - printk(KERN_ERR "megasas: cannot recover from previous reset " - "failures\n"); - return FAILED; - } - - spin_unlock(scmd->device->host->host_lock); - - ret_val = megasas_wait_for_outstanding(instance); - - if (ret_val == SUCCESS) - printk(KERN_NOTICE "megasas: reset successful \n"); - else - printk(KERN_ERR "megasas: failed to do reset\n"); - - spin_lock(scmd->device->host->host_lock); - - return ret_val; -} - -static enum scsi_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) -{ - unsigned long seconds; - - if (scmd->SCp.ptr) { - seconds = (jiffies - scmd->SCp.sent_command) / HZ; - - if (seconds < 90) { - return EH_RESET_TIMER; - } else { - return EH_NOT_HANDLED; - } - } - - return EH_HANDLED; -} - -/** - * megasas_reset_device - Device reset handler entry point - */ -static int megasas_reset_device(struct scsi_cmnd *scmd) -{ - int ret; - - /* - * First wait for all commands to complete - */ - ret = megasas_generic_reset(scmd); - - return ret; -} - -/** - * megasas_reset_bus_host - Bus & host reset handler entry point - */ -static int megasas_reset_bus_host(struct scsi_cmnd *scmd) -{ - int ret; - - /* - * Frist wait for all commands to complete - */ - ret = megasas_generic_reset(scmd); - - return ret; -} - -/** - * megasas_service_aen - Processes an event notification - * @instance: Adapter soft state - * @cmd: AEN command completed by the ISR - * - * For AEN, driver sends a command down to FW that is held by the FW till an - * event occurs. When an event of interest occurs, FW completes the command - * that it was previously holding. - * - * This routines sends SIGIO signal to processes that have registered with the - * driver for AEN. - */ -static void -megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd) -{ - /* - * Don't signal app if it is just an aborted previously registered aen - */ - if (!cmd->abort_aen) - kill_fasync(&megasas_async_queue, SIGIO, POLL_IN); - else - cmd->abort_aen = 0; - - instance->aen_cmd = NULL; - megasas_return_cmd(instance, cmd); -} - -/* - * Scsi host template for megaraid_sas driver - */ -static struct scsi_host_template megasas_template = { - - .module = THIS_MODULE, - .name = "LSI Logic SAS based MegaRAID driver", - .proc_name = "megaraid_sas", - .queuecommand = megasas_queue_command, - .eh_device_reset_handler = megasas_reset_device, - .eh_bus_reset_handler = megasas_reset_bus_host, - .eh_host_reset_handler = megasas_reset_bus_host, - .eh_timed_out = megasas_reset_timer, - .use_clustering = ENABLE_CLUSTERING, -}; - -/** - * megasas_complete_int_cmd - Completes an internal command - * @instance: Adapter soft state - * @cmd: Command to be completed - * - * The megasas_issue_blocked_cmd() function waits for a command to complete - * after it issues a command. This function wakes up that waiting routine by - * calling wake_up() on the wait queue. - */ -static void -megasas_complete_int_cmd(struct megasas_instance *instance, - struct megasas_cmd *cmd) -{ - cmd->cmd_status = cmd->frame->io.cmd_status; - - if (cmd->cmd_status == ENODATA) { - cmd->cmd_status = 0; - } - wake_up(&instance->int_cmd_wait_q); -} - -/** - * megasas_complete_abort - Completes aborting a command - * @instance: Adapter soft state - * @cmd: Cmd that was issued to abort another cmd - * - * The megasas_issue_blocked_abort_cmd() function waits on abort_cmd_wait_q - * after it issues an abort on a previously issued command. This function - * wakes up all functions waiting on the same wait queue. - */ -static void -megasas_complete_abort(struct megasas_instance *instance, - struct megasas_cmd *cmd) -{ - if (cmd->sync_cmd) { - cmd->sync_cmd = 0; - cmd->cmd_status = 0; - wake_up(&instance->abort_cmd_wait_q); - } - - return; -} - -/** - * megasas_unmap_sgbuf - Unmap SG buffers - * @instance: Adapter soft state - * @cmd: Completed command - */ -static inline void -megasas_unmap_sgbuf(struct megasas_instance *instance, struct megasas_cmd *cmd) -{ - dma_addr_t buf_h; - u8 opcode; - - if (cmd->scmd->use_sg) { - pci_unmap_sg(instance->pdev, cmd->scmd->request_buffer, - cmd->scmd->use_sg, cmd->scmd->sc_data_direction); - return; - } - - if (!cmd->scmd->request_bufflen) - return; - - opcode = cmd->frame->hdr.cmd; - - if ((opcode == MFI_CMD_LD_READ) || (opcode == MFI_CMD_LD_WRITE)) { - if (IS_DMA64) - buf_h = cmd->frame->io.sgl.sge64[0].phys_addr; - else - buf_h = cmd->frame->io.sgl.sge32[0].phys_addr; - } else { - if (IS_DMA64) - buf_h = cmd->frame->pthru.sgl.sge64[0].phys_addr; - else - buf_h = cmd->frame->pthru.sgl.sge32[0].phys_addr; - } - - pci_unmap_single(instance->pdev, buf_h, cmd->scmd->request_bufflen, - cmd->scmd->sc_data_direction); - return; -} - -/** - * megasas_complete_cmd - Completes a command - * @instance: Adapter soft state - * @cmd: Command to be completed - * @alt_status: If non-zero, use this value as status to - * SCSI mid-layer instead of the value returned - * by the FW. This should be used if caller wants - * an alternate status (as in the case of aborted - * commands) - */ -static inline void -megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, - u8 alt_status) -{ - int exception = 0; - struct megasas_header *hdr = &cmd->frame->hdr; - unsigned long flags; - - if (cmd->scmd) { - cmd->scmd->SCp.ptr = (char *)0; - } - - switch (hdr->cmd) { - - case MFI_CMD_PD_SCSI_IO: - case MFI_CMD_LD_SCSI_IO: - - /* - * MFI_CMD_PD_SCSI_IO and MFI_CMD_LD_SCSI_IO could have been - * issued either through an IO path or an IOCTL path. If it - * was via IOCTL, we will send it to internal completion. - */ - if (cmd->sync_cmd) { - cmd->sync_cmd = 0; - megasas_complete_int_cmd(instance, cmd); - break; - } - - /* - * Don't export physical disk devices to mid-layer. - */ - if (!MEGASAS_IS_LOGICAL(cmd->scmd) && - (hdr->cmd_status == MFI_STAT_OK) && - (cmd->scmd->cmnd[0] == INQUIRY)) { - - if (((*(u8 *) cmd->scmd->request_buffer) & 0x1F) == - TYPE_DISK) { - cmd->scmd->result = DID_BAD_TARGET << 16; - exception = 1; - } - } - - case MFI_CMD_LD_READ: - case MFI_CMD_LD_WRITE: - - if (alt_status) { - cmd->scmd->result = alt_status << 16; - exception = 1; - } - - if (exception) { - - spin_lock_irqsave(&instance->instance_lock, flags); - instance->fw_outstanding--; - spin_unlock_irqrestore(&instance->instance_lock, flags); - - megasas_unmap_sgbuf(instance, cmd); - cmd->scmd->scsi_done(cmd->scmd); - megasas_return_cmd(instance, cmd); - - break; - } - - switch (hdr->cmd_status) { - - case MFI_STAT_OK: - cmd->scmd->result = DID_OK << 16; - break; - - case MFI_STAT_SCSI_IO_FAILED: - case MFI_STAT_LD_INIT_IN_PROGRESS: - cmd->scmd->result = - (DID_ERROR << 16) | hdr->scsi_status; - break; - - case MFI_STAT_SCSI_DONE_WITH_ERROR: - - cmd->scmd->result = (DID_OK << 16) | hdr->scsi_status; - - if (hdr->scsi_status == SAM_STAT_CHECK_CONDITION) { - memset(cmd->scmd->sense_buffer, 0, - SCSI_SENSE_BUFFERSIZE); - memcpy(cmd->scmd->sense_buffer, cmd->sense, - hdr->sense_len); - - cmd->scmd->result |= DRIVER_SENSE << 24; - } - - break; - - case MFI_STAT_LD_OFFLINE: - case MFI_STAT_DEVICE_NOT_FOUND: - cmd->scmd->result = DID_BAD_TARGET << 16; - break; - - default: - printk(KERN_DEBUG "megasas: MFI FW status %#x\n", - hdr->cmd_status); - cmd->scmd->result = DID_ERROR << 16; - break; - } - - spin_lock_irqsave(&instance->instance_lock, flags); - instance->fw_outstanding--; - spin_unlock_irqrestore(&instance->instance_lock, flags); - - megasas_unmap_sgbuf(instance, cmd); - cmd->scmd->scsi_done(cmd->scmd); - megasas_return_cmd(instance, cmd); - - break; - - case MFI_CMD_SMP: - case MFI_CMD_STP: - case MFI_CMD_DCMD: - - /* - * See if got an event notification - */ - if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT) - megasas_service_aen(instance, cmd); - else - megasas_complete_int_cmd(instance, cmd); - - break; - - case MFI_CMD_ABORT: - /* - * Cmd issued to abort another cmd returned - */ - megasas_complete_abort(instance, cmd); - break; - - default: - printk("megasas: Unknown command completed! [0x%X]\n", - hdr->cmd); - break; - } -} - -/** - * megasas_deplete_reply_queue - Processes all completed commands - * @instance: Adapter soft state - * @alt_status: Alternate status to be returned to - * SCSI mid-layer instead of the status - * returned by the FW - */ -static inline int -megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) -{ - u32 status; - u32 producer; - u32 consumer; - u32 context; - struct megasas_cmd *cmd; - - /* - * Check if it is our interrupt - */ - status = readl(&instance->reg_set->outbound_intr_status); - - if (!(status & MFI_OB_INTR_STATUS_MASK)) { - return IRQ_NONE; - } - - /* - * Clear the interrupt by writing back the same value - */ - writel(status, &instance->reg_set->outbound_intr_status); - - producer = *instance->producer; - consumer = *instance->consumer; - - while (consumer != producer) { - context = instance->reply_queue[consumer]; - - cmd = instance->cmd_list[context]; - - megasas_complete_cmd(instance, cmd, alt_status); - - consumer++; - if (consumer == (instance->max_fw_cmds + 1)) { - consumer = 0; - } - } - - *instance->consumer = producer; - - return IRQ_HANDLED; -} - -/** - * megasas_isr - isr entry point - */ -static irqreturn_t megasas_isr(int irq, void *devp, struct pt_regs *regs) -{ - return megasas_deplete_reply_queue((struct megasas_instance *)devp, - DID_OK); -} - -/** - * megasas_transition_to_ready - Move the FW to READY state - * @reg_set: MFI register set - * - * During the initialization, FW passes can potentially be in any one of - * several possible states. If the FW in operational, waiting-for-handshake - * states, driver must take steps to bring it to ready state. Otherwise, it - * has to wait for the ready state. - */ -static int -megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set) -{ - int i; - u8 max_wait; - u32 fw_state; - u32 cur_state; - - fw_state = readl(®_set->outbound_msg_0) & MFI_STATE_MASK; - - while (fw_state != MFI_STATE_READY) { - - printk(KERN_INFO "megasas: Waiting for FW to come to ready" - " state\n"); - switch (fw_state) { - - case MFI_STATE_FAULT: - - printk(KERN_DEBUG "megasas: FW in FAULT state!!\n"); - return -ENODEV; - - case MFI_STATE_WAIT_HANDSHAKE: - /* - * Set the CLR bit in inbound doorbell - */ - writel(MFI_INIT_CLEAR_HANDSHAKE, - ®_set->inbound_doorbell); - - max_wait = 2; - cur_state = MFI_STATE_WAIT_HANDSHAKE; - break; - - case MFI_STATE_OPERATIONAL: - /* - * Bring it to READY state; assuming max wait 2 secs - */ - megasas_disable_intr(reg_set); - writel(MFI_INIT_READY, ®_set->inbound_doorbell); - - max_wait = 10; - cur_state = MFI_STATE_OPERATIONAL; - break; - - case MFI_STATE_UNDEFINED: - /* - * This state should not last for more than 2 seconds - */ - max_wait = 2; - cur_state = MFI_STATE_UNDEFINED; - break; - - case MFI_STATE_BB_INIT: - max_wait = 2; - cur_state = MFI_STATE_BB_INIT; - break; - - case MFI_STATE_FW_INIT: - max_wait = 20; - cur_state = MFI_STATE_FW_INIT; - break; - - case MFI_STATE_FW_INIT_2: - max_wait = 20; - cur_state = MFI_STATE_FW_INIT_2; - break; - - case MFI_STATE_DEVICE_SCAN: - max_wait = 20; - cur_state = MFI_STATE_DEVICE_SCAN; - break; - - case MFI_STATE_FLUSH_CACHE: - max_wait = 20; - cur_state = MFI_STATE_FLUSH_CACHE; - break; - - default: - printk(KERN_DEBUG "megasas: Unknown state 0x%x\n", - fw_state); - return -ENODEV; - } - - /* - * The cur_state should not last for more than max_wait secs - */ - for (i = 0; i < (max_wait * 1000); i++) { - fw_state = MFI_STATE_MASK & - readl(®_set->outbound_msg_0); - - if (fw_state == cur_state) { - msleep(1); - } else - break; - } - - /* - * Return error if fw_state hasn't changed after max_wait - */ - if (fw_state == cur_state) { - printk(KERN_DEBUG "FW state [%d] hasn't changed " - "in %d secs\n", fw_state, max_wait); - return -ENODEV; - } - }; - - return 0; -} - -/** - * megasas_teardown_frame_pool - Destroy the cmd frame DMA pool - * @instance: Adapter soft state - */ -static void megasas_teardown_frame_pool(struct megasas_instance *instance) -{ - int i; - u32 max_cmd = instance->max_fw_cmds; - struct megasas_cmd *cmd; - - if (!instance->frame_dma_pool) - return; - - /* - * Return all frames to pool - */ - for (i = 0; i < max_cmd; i++) { - - cmd = instance->cmd_list[i]; - - if (cmd->frame) - pci_pool_free(instance->frame_dma_pool, cmd->frame, - cmd->frame_phys_addr); - - if (cmd->sense) - pci_pool_free(instance->sense_dma_pool, cmd->frame, - cmd->sense_phys_addr); - } - - /* - * Now destroy the pool itself - */ - pci_pool_destroy(instance->frame_dma_pool); - pci_pool_destroy(instance->sense_dma_pool); - - instance->frame_dma_pool = NULL; - instance->sense_dma_pool = NULL; -} - -/** - * megasas_create_frame_pool - Creates DMA pool for cmd frames - * @instance: Adapter soft state - * - * Each command packet has an embedded DMA memory buffer that is used for - * filling MFI frame and the SG list that immediately follows the frame. This - * function creates those DMA memory buffers for each command packet by using - * PCI pool facility. - */ -static int megasas_create_frame_pool(struct megasas_instance *instance) -{ - int i; - u32 max_cmd; - u32 sge_sz; - u32 sgl_sz; - u32 total_sz; - u32 frame_count; - struct megasas_cmd *cmd; - - max_cmd = instance->max_fw_cmds; - - /* - * Size of our frame is 64 bytes for MFI frame, followed by max SG - * elements and finally SCSI_SENSE_BUFFERSIZE bytes for sense buffer - */ - sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) : - sizeof(struct megasas_sge32); - - /* - * Calculated the number of 64byte frames required for SGL - */ - sgl_sz = sge_sz * instance->max_num_sge; - frame_count = (sgl_sz + MEGAMFI_FRAME_SIZE - 1) / MEGAMFI_FRAME_SIZE; - - /* - * We need one extra frame for the MFI command - */ - frame_count++; - - total_sz = MEGAMFI_FRAME_SIZE * frame_count; - /* - * Use DMA pool facility provided by PCI layer - */ - instance->frame_dma_pool = pci_pool_create("megasas frame pool", - instance->pdev, total_sz, 64, - 0); - - if (!instance->frame_dma_pool) { - printk(KERN_DEBUG "megasas: failed to setup frame pool\n"); - return -ENOMEM; - } - - instance->sense_dma_pool = pci_pool_create("megasas sense pool", - instance->pdev, 128, 4, 0); - - if (!instance->sense_dma_pool) { - printk(KERN_DEBUG "megasas: failed to setup sense pool\n"); - - pci_pool_destroy(instance->frame_dma_pool); - instance->frame_dma_pool = NULL; - - return -ENOMEM; - } - - /* - * Allocate and attach a frame to each of the commands in cmd_list. - * By making cmd->index as the context instead of the &cmd, we can - * always use 32bit context regardless of the architecture - */ - for (i = 0; i < max_cmd; i++) { - - cmd = instance->cmd_list[i]; - - cmd->frame = pci_pool_alloc(instance->frame_dma_pool, - GFP_KERNEL, &cmd->frame_phys_addr); - - cmd->sense = pci_pool_alloc(instance->sense_dma_pool, - GFP_KERNEL, &cmd->sense_phys_addr); - - /* - * megasas_teardown_frame_pool() takes care of freeing - * whatever has been allocated - */ - if (!cmd->frame || !cmd->sense) { - printk(KERN_DEBUG "megasas: pci_pool_alloc failed \n"); - megasas_teardown_frame_pool(instance); - return -ENOMEM; - } - - cmd->frame->io.context = cmd->index; - } - - return 0; -} - -/** - * megasas_free_cmds - Free all the cmds in the free cmd pool - * @instance: Adapter soft state - */ -static void megasas_free_cmds(struct megasas_instance *instance) -{ - int i; - /* First free the MFI frame pool */ - megasas_teardown_frame_pool(instance); - - /* Free all the commands in the cmd_list */ - for (i = 0; i < instance->max_fw_cmds; i++) - kfree(instance->cmd_list[i]); - - /* Free the cmd_list buffer itself */ - kfree(instance->cmd_list); - instance->cmd_list = NULL; - - INIT_LIST_HEAD(&instance->cmd_pool); -} - -/** - * megasas_alloc_cmds - Allocates the command packets - * @instance: Adapter soft state - * - * Each command that is issued to the FW, whether IO commands from the OS or - * internal commands like IOCTLs, are wrapped in local data structure called - * megasas_cmd. The frame embedded in this megasas_cmd is actually issued to - * the FW. - * - * Each frame has a 32-bit field called context (tag). This context is used - * to get back the megasas_cmd from the frame when a frame gets completed in - * the ISR. Typically the address of the megasas_cmd itself would be used as - * the context. But we wanted to keep the differences between 32 and 64 bit - * systems to the mininum. We always use 32 bit integers for the context. In - * this driver, the 32 bit values are the indices into an array cmd_list. - * This array is used only to look up the megasas_cmd given the context. The - * free commands themselves are maintained in a linked list called cmd_pool. - */ -static int megasas_alloc_cmds(struct megasas_instance *instance) -{ - int i; - int j; - u32 max_cmd; - struct megasas_cmd *cmd; - - max_cmd = instance->max_fw_cmds; - - /* - * instance->cmd_list is an array of struct megasas_cmd pointers. - * Allocate the dynamic array first and then allocate individual - * commands. - */ - instance->cmd_list = kmalloc(sizeof(struct megasas_cmd *) * max_cmd, - GFP_KERNEL); - - if (!instance->cmd_list) { - printk(KERN_DEBUG "megasas: out of memory\n"); - return -ENOMEM; - } - - memset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) * max_cmd); - - for (i = 0; i < max_cmd; i++) { - instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd), - GFP_KERNEL); - - if (!instance->cmd_list[i]) { - - for (j = 0; j < i; j++) - kfree(instance->cmd_list[j]); - - kfree(instance->cmd_list); - instance->cmd_list = NULL; - - return -ENOMEM; - } - } - - /* - * Add all the commands to command pool (instance->cmd_pool) - */ - for (i = 0; i < max_cmd; i++) { - cmd = instance->cmd_list[i]; - memset(cmd, 0, sizeof(struct megasas_cmd)); - cmd->index = i; - cmd->instance = instance; - - list_add_tail(&cmd->list, &instance->cmd_pool); - } - - /* - * Create a frame pool and assign one frame to each cmd - */ - if (megasas_create_frame_pool(instance)) { - printk(KERN_DEBUG "megasas: Error creating frame DMA pool\n"); - megasas_free_cmds(instance); - } - - return 0; -} - -/** - * megasas_get_controller_info - Returns FW's controller structure - * @instance: Adapter soft state - * @ctrl_info: Controller information structure - * - * Issues an internal command (DCMD) to get the FW's controller structure. - * This information is mainly used to find out the maximum IO transfer per - * command supported by the FW. - */ -static int -megasas_get_ctrl_info(struct megasas_instance *instance, - struct megasas_ctrl_info *ctrl_info) -{ - int ret = 0; - struct megasas_cmd *cmd; - struct megasas_dcmd_frame *dcmd; - struct megasas_ctrl_info *ci; - dma_addr_t ci_h = 0; - - cmd = megasas_get_cmd(instance); - - if (!cmd) { - printk(KERN_DEBUG "megasas: Failed to get a free cmd\n"); - return -ENOMEM; - } - - dcmd = &cmd->frame->dcmd; - - ci = pci_alloc_consistent(instance->pdev, - sizeof(struct megasas_ctrl_info), &ci_h); - - if (!ci) { - printk(KERN_DEBUG "Failed to alloc mem for ctrl info\n"); - megasas_return_cmd(instance, cmd); - return -ENOMEM; - } - - memset(ci, 0, sizeof(*ci)); - memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); - - dcmd->cmd = MFI_CMD_DCMD; - dcmd->cmd_status = 0xFF; - dcmd->sge_count = 1; - dcmd->flags = MFI_FRAME_DIR_READ; - dcmd->timeout = 0; - dcmd->data_xfer_len = sizeof(struct megasas_ctrl_info); - dcmd->opcode = MR_DCMD_CTRL_GET_INFO; - dcmd->sgl.sge32[0].phys_addr = ci_h; - dcmd->sgl.sge32[0].length = sizeof(struct megasas_ctrl_info); - - if (!megasas_issue_polled(instance, cmd)) { - ret = 0; - memcpy(ctrl_info, ci, sizeof(struct megasas_ctrl_info)); - } else { - ret = -1; - } - - pci_free_consistent(instance->pdev, sizeof(struct megasas_ctrl_info), - ci, ci_h); - - megasas_return_cmd(instance, cmd); - return ret; -} - -/** - * megasas_init_mfi - Initializes the FW - * @instance: Adapter soft state - * - * This is the main function for initializing MFI firmware. - */ -static int megasas_init_mfi(struct megasas_instance *instance) -{ - u32 context_sz; - u32 reply_q_sz; - u32 max_sectors_1; - u32 max_sectors_2; - struct megasas_register_set __iomem *reg_set; - - struct megasas_cmd *cmd; - struct megasas_ctrl_info *ctrl_info; - - struct megasas_init_frame *init_frame; - struct megasas_init_queue_info *initq_info; - dma_addr_t init_frame_h; - dma_addr_t initq_info_h; - - /* - * Map the message registers - */ - instance->base_addr = pci_resource_start(instance->pdev, 0); - - if (pci_request_regions(instance->pdev, "megasas: LSI Logic")) { - printk(KERN_DEBUG "megasas: IO memory region busy!\n"); - return -EBUSY; - } - - instance->reg_set = ioremap_nocache(instance->base_addr, 8192); - - if (!instance->reg_set) { - printk(KERN_DEBUG "megasas: Failed to map IO mem\n"); - goto fail_ioremap; - } - - reg_set = instance->reg_set; - - /* - * We expect the FW state to be READY - */ - if (megasas_transition_to_ready(instance->reg_set)) - goto fail_ready_state; - - /* - * Get various operational parameters from status register - */ - instance->max_fw_cmds = readl(®_set->outbound_msg_0) & 0x00FFFF; - instance->max_num_sge = (readl(®_set->outbound_msg_0) & 0xFF0000) >> - 0x10; - /* - * Create a pool of commands - */ - if (megasas_alloc_cmds(instance)) - goto fail_alloc_cmds; - - /* - * Allocate memory for reply queue. Length of reply queue should - * be _one_ more than the maximum commands handled by the firmware. - * - * Note: When FW completes commands, it places corresponding contex - * values in this circular reply queue. This circular queue is a fairly - * typical producer-consumer queue. FW is the producer (of completed - * commands) and the driver is the consumer. - */ - context_sz = sizeof(u32); - reply_q_sz = context_sz * (instance->max_fw_cmds + 1); - - instance->reply_queue = pci_alloc_consistent(instance->pdev, - reply_q_sz, - &instance->reply_queue_h); - - if (!instance->reply_queue) { - printk(KERN_DEBUG "megasas: Out of DMA mem for reply queue\n"); - goto fail_reply_queue; - } - - /* - * Prepare a init frame. Note the init frame points to queue info - * structure. Each frame has SGL allocated after first 64 bytes. For - * this frame - since we don't need any SGL - we use SGL's space as - * queue info structure - * - * We will not get a NULL command below. We just created the pool. - */ - cmd = megasas_get_cmd(instance); - - init_frame = (struct megasas_init_frame *)cmd->frame; - initq_info = (struct megasas_init_queue_info *) - ((unsigned long)init_frame + 64); - - init_frame_h = cmd->frame_phys_addr; - initq_info_h = init_frame_h + 64; - - memset(init_frame, 0, MEGAMFI_FRAME_SIZE); - memset(initq_info, 0, sizeof(struct megasas_init_queue_info)); - - initq_info->reply_queue_entries = instance->max_fw_cmds + 1; - initq_info->reply_queue_start_phys_addr_lo = instance->reply_queue_h; - - initq_info->producer_index_phys_addr_lo = instance->producer_h; - initq_info->consumer_index_phys_addr_lo = instance->consumer_h; - - init_frame->cmd = MFI_CMD_INIT; - init_frame->cmd_status = 0xFF; - init_frame->queue_info_new_phys_addr_lo = initq_info_h; - - init_frame->data_xfer_len = sizeof(struct megasas_init_queue_info); - - /* - * Issue the init frame in polled mode - */ - if (megasas_issue_polled(instance, cmd)) { - printk(KERN_DEBUG "megasas: Failed to init firmware\n"); - goto fail_fw_init; - } - - megasas_return_cmd(instance, cmd); - - ctrl_info = kmalloc(sizeof(struct megasas_ctrl_info), GFP_KERNEL); - - /* - * Compute the max allowed sectors per IO: The controller info has two - * limits on max sectors. Driver should use the minimum of these two. - * - * 1 << stripe_sz_ops.min = max sectors per strip - * - * Note that older firmwares ( < FW ver 30) didn't report information - * to calculate max_sectors_1. So the number ended up as zero always. - */ - if (ctrl_info && !megasas_get_ctrl_info(instance, ctrl_info)) { - - max_sectors_1 = (1 << ctrl_info->stripe_sz_ops.min) * - ctrl_info->max_strips_per_io; - max_sectors_2 = ctrl_info->max_request_size; - - instance->max_sectors_per_req = (max_sectors_1 < max_sectors_2) - ? max_sectors_1 : max_sectors_2; - } else - instance->max_sectors_per_req = instance->max_num_sge * - PAGE_SIZE / 512; - - kfree(ctrl_info); - - return 0; - - fail_fw_init: - megasas_return_cmd(instance, cmd); - - pci_free_consistent(instance->pdev, reply_q_sz, - instance->reply_queue, instance->reply_queue_h); - fail_reply_queue: - megasas_free_cmds(instance); - - fail_alloc_cmds: - fail_ready_state: - iounmap(instance->reg_set); - - fail_ioremap: - pci_release_regions(instance->pdev); - - return -EINVAL; -} - -/** - * megasas_release_mfi - Reverses the FW initialization - * @intance: Adapter soft state - */ -static void megasas_release_mfi(struct megasas_instance *instance) -{ - u32 reply_q_sz = sizeof(u32) * (instance->max_fw_cmds + 1); - - pci_free_consistent(instance->pdev, reply_q_sz, - instance->reply_queue, instance->reply_queue_h); - - megasas_free_cmds(instance); - - iounmap(instance->reg_set); - - pci_release_regions(instance->pdev); -} - -/** - * megasas_get_seq_num - Gets latest event sequence numbers - * @instance: Adapter soft state - * @eli: FW event log sequence numbers information - * - * FW maintains a log of all events in a non-volatile area. Upper layers would - * usually find out the latest sequence number of the events, the seq number at - * the boot etc. They would "read" all the events below the latest seq number - * by issuing a direct fw cmd (DCMD). For the future events (beyond latest seq - * number), they would subsribe to AEN (asynchronous event notification) and - * wait for the events to happen. - */ -static int -megasas_get_seq_num(struct megasas_instance *instance, - struct megasas_evt_log_info *eli) -{ - struct megasas_cmd *cmd; - struct megasas_dcmd_frame *dcmd; - struct megasas_evt_log_info *el_info; - dma_addr_t el_info_h = 0; - - cmd = megasas_get_cmd(instance); - - if (!cmd) { - return -ENOMEM; - } - - dcmd = &cmd->frame->dcmd; - el_info = pci_alloc_consistent(instance->pdev, - sizeof(struct megasas_evt_log_info), - &el_info_h); - - if (!el_info) { - megasas_return_cmd(instance, cmd); - return -ENOMEM; - } - - memset(el_info, 0, sizeof(*el_info)); - memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); - - dcmd->cmd = MFI_CMD_DCMD; - dcmd->cmd_status = 0x0; - dcmd->sge_count = 1; - dcmd->flags = MFI_FRAME_DIR_READ; - dcmd->timeout = 0; - dcmd->data_xfer_len = sizeof(struct megasas_evt_log_info); - dcmd->opcode = MR_DCMD_CTRL_EVENT_GET_INFO; - dcmd->sgl.sge32[0].phys_addr = el_info_h; - dcmd->sgl.sge32[0].length = sizeof(struct megasas_evt_log_info); - - megasas_issue_blocked_cmd(instance, cmd); - - /* - * Copy the data back into callers buffer - */ - memcpy(eli, el_info, sizeof(struct megasas_evt_log_info)); - - pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info), - el_info, el_info_h); - - megasas_return_cmd(instance, cmd); - - return 0; -} - -/** - * megasas_register_aen - Registers for asynchronous event notification - * @instance: Adapter soft state - * @seq_num: The starting sequence number - * @class_locale: Class of the event - * - * This function subscribes for AEN for events beyond the @seq_num. It requests - * to be notified if and only if the event is of type @class_locale - */ -static int -megasas_register_aen(struct megasas_instance *instance, u32 seq_num, - u32 class_locale_word) -{ - int ret_val; - struct megasas_cmd *cmd; - struct megasas_dcmd_frame *dcmd; - union megasas_evt_class_locale curr_aen; - union megasas_evt_class_locale prev_aen; - - /* - * If there an AEN pending already (aen_cmd), check if the - * class_locale of that pending AEN is inclusive of the new - * AEN request we currently have. If it is, then we don't have - * to do anything. In other words, whichever events the current - * AEN request is subscribing to, have already been subscribed - * to. - * - * If the old_cmd is _not_ inclusive, then we have to abort - * that command, form a class_locale that is superset of both - * old and current and re-issue to the FW - */ - - curr_aen.word = class_locale_word; - - if (instance->aen_cmd) { - - prev_aen.word = instance->aen_cmd->frame->dcmd.mbox.w[1]; - - /* - * A class whose enum value is smaller is inclusive of all - * higher values. If a PROGRESS (= -1) was previously - * registered, then a new registration requests for higher - * classes need not be sent to FW. They are automatically - * included. - * - * Locale numbers don't have such hierarchy. They are bitmap - * values - */ - if ((prev_aen.members.class <= curr_aen.members.class) && - !((prev_aen.members.locale & curr_aen.members.locale) ^ - curr_aen.members.locale)) { - /* - * Previously issued event registration includes - * current request. Nothing to do. - */ - return 0; - } else { - curr_aen.members.locale |= prev_aen.members.locale; - - if (prev_aen.members.class < curr_aen.members.class) - curr_aen.members.class = prev_aen.members.class; - - instance->aen_cmd->abort_aen = 1; - ret_val = megasas_issue_blocked_abort_cmd(instance, - instance-> - aen_cmd); - - if (ret_val) { - printk(KERN_DEBUG "megasas: Failed to abort " - "previous AEN command\n"); - return ret_val; - } - } - } - - cmd = megasas_get_cmd(instance); - - if (!cmd) - return -ENOMEM; - - dcmd = &cmd->frame->dcmd; - - memset(instance->evt_detail, 0, sizeof(struct megasas_evt_detail)); - - /* - * Prepare DCMD for aen registration - */ - memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); - - dcmd->cmd = MFI_CMD_DCMD; - dcmd->cmd_status = 0x0; - dcmd->sge_count = 1; - dcmd->flags = MFI_FRAME_DIR_READ; - dcmd->timeout = 0; - dcmd->data_xfer_len = sizeof(struct megasas_evt_detail); - dcmd->opcode = MR_DCMD_CTRL_EVENT_WAIT; - dcmd->mbox.w[0] = seq_num; - dcmd->mbox.w[1] = curr_aen.word; - dcmd->sgl.sge32[0].phys_addr = (u32) instance->evt_detail_h; - dcmd->sgl.sge32[0].length = sizeof(struct megasas_evt_detail); - - /* - * Store reference to the cmd used to register for AEN. When an - * application wants us to register for AEN, we have to abort this - * cmd and re-register with a new EVENT LOCALE supplied by that app - */ - instance->aen_cmd = cmd; - - /* - * Issue the aen registration frame - */ - writel(cmd->frame_phys_addr >> 3, - &instance->reg_set->inbound_queue_port); - - return 0; -} - -/** - * megasas_start_aen - Subscribes to AEN during driver load time - * @instance: Adapter soft state - */ -static int megasas_start_aen(struct megasas_instance *instance) -{ - struct megasas_evt_log_info eli; - union megasas_evt_class_locale class_locale; - - /* - * Get the latest sequence number from FW - */ - memset(&eli, 0, sizeof(eli)); - - if (megasas_get_seq_num(instance, &eli)) - return -1; - - /* - * Register AEN with FW for latest sequence number plus 1 - */ - class_locale.members.reserved = 0; - class_locale.members.locale = MR_EVT_LOCALE_ALL; - class_locale.members.class = MR_EVT_CLASS_DEBUG; - - return megasas_register_aen(instance, eli.newest_seq_num + 1, - class_locale.word); -} - -/** - * megasas_io_attach - Attaches this driver to SCSI mid-layer - * @instance: Adapter soft state - */ -static int megasas_io_attach(struct megasas_instance *instance) -{ - struct Scsi_Host *host = instance->host; - - /* - * Export parameters required by SCSI mid-layer - */ - host->irq = instance->pdev->irq; - host->unique_id = instance->unique_id; - host->can_queue = instance->max_fw_cmds - MEGASAS_INT_CMDS; - host->this_id = instance->init_id; - host->sg_tablesize = instance->max_num_sge; - host->max_sectors = instance->max_sectors_per_req; - host->cmd_per_lun = 128; - host->max_channel = MEGASAS_MAX_CHANNELS - 1; - host->max_id = MEGASAS_MAX_DEV_PER_CHANNEL; - host->max_lun = MEGASAS_MAX_LUN; - - /* - * Notify the mid-layer about the new controller - */ - if (scsi_add_host(host, &instance->pdev->dev)) { - printk(KERN_DEBUG "megasas: scsi_add_host failed\n"); - return -ENODEV; - } - - /* - * Trigger SCSI to scan our drives - */ - scsi_scan_host(host); - return 0; -} - -/** - * megasas_probe_one - PCI hotplug entry point - * @pdev: PCI device structure - * @id: PCI ids of supported hotplugged adapter - */ -static int __devinit -megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) -{ - int rval; - struct Scsi_Host *host; - struct megasas_instance *instance; - - /* - * Announce PCI information - */ - printk(KERN_INFO "megasas: %#4.04x:%#4.04x:%#4.04x:%#4.04x: ", - pdev->vendor, pdev->device, pdev->subsystem_vendor, - pdev->subsystem_device); - - printk("bus %d:slot %d:func %d\n", - pdev->bus->number, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); - - /* - * PCI prepping: enable device set bus mastering and dma mask - */ - rval = pci_enable_device(pdev); - - if (rval) { - return rval; - } - - pci_set_master(pdev); - - /* - * All our contollers are capable of performing 64-bit DMA - */ - if (IS_DMA64) { - if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) != 0) { - - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) - goto fail_set_dma_mask; - } - } else { - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) - goto fail_set_dma_mask; - } - - host = scsi_host_alloc(&megasas_template, - sizeof(struct megasas_instance)); - - if (!host) { - printk(KERN_DEBUG "megasas: scsi_host_alloc failed\n"); - goto fail_alloc_instance; - } - - instance = (struct megasas_instance *)host->hostdata; - memset(instance, 0, sizeof(*instance)); - - instance->producer = pci_alloc_consistent(pdev, sizeof(u32), - &instance->producer_h); - instance->consumer = pci_alloc_consistent(pdev, sizeof(u32), - &instance->consumer_h); - - if (!instance->producer || !instance->consumer) { - printk(KERN_DEBUG "megasas: Failed to allocate memory for " - "producer, consumer\n"); - goto fail_alloc_dma_buf; - } - - *instance->producer = 0; - *instance->consumer = 0; - - instance->evt_detail = pci_alloc_consistent(pdev, - sizeof(struct - megasas_evt_detail), - &instance->evt_detail_h); - - if (!instance->evt_detail) { - printk(KERN_DEBUG "megasas: Failed to allocate memory for " - "event detail structure\n"); - goto fail_alloc_dma_buf; - } - - /* - * Initialize locks and queues - */ - INIT_LIST_HEAD(&instance->cmd_pool); - - init_waitqueue_head(&instance->int_cmd_wait_q); - init_waitqueue_head(&instance->abort_cmd_wait_q); - - spin_lock_init(&instance->cmd_pool_lock); - spin_lock_init(&instance->instance_lock); - - sema_init(&instance->aen_mutex, 1); - sema_init(&instance->ioctl_sem, MEGASAS_INT_CMDS); - - /* - * Initialize PCI related and misc parameters - */ - instance->pdev = pdev; - instance->host = host; - instance->unique_id = pdev->bus->number << 8 | pdev->devfn; - instance->init_id = MEGASAS_DEFAULT_INIT_ID; - - /* - * Initialize MFI Firmware - */ - if (megasas_init_mfi(instance)) - goto fail_init_mfi; - - /* - * Register IRQ - */ - if (request_irq(pdev->irq, megasas_isr, SA_SHIRQ, "megasas", instance)) { - printk(KERN_DEBUG "megasas: Failed to register IRQ\n"); - goto fail_irq; - } - - megasas_enable_intr(instance->reg_set); - - /* - * Store instance in PCI softstate - */ - pci_set_drvdata(pdev, instance); - - /* - * Add this controller to megasas_mgmt_info structure so that it - * can be exported to management applications - */ - megasas_mgmt_info.count++; - megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = instance; - megasas_mgmt_info.max_index++; - - /* - * Initiate AEN (Asynchronous Event Notification) - */ - if (megasas_start_aen(instance)) { - printk(KERN_DEBUG "megasas: start aen failed\n"); - goto fail_start_aen; - } - - /* - * Register with SCSI mid-layer - */ - if (megasas_io_attach(instance)) - goto fail_io_attach; - - return 0; - - fail_start_aen: - fail_io_attach: - megasas_mgmt_info.count--; - megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL; - megasas_mgmt_info.max_index--; - - pci_set_drvdata(pdev, NULL); - megasas_disable_intr(instance->reg_set); - free_irq(instance->pdev->irq, instance); - - megasas_release_mfi(instance); - - fail_irq: - fail_init_mfi: - fail_alloc_dma_buf: - if (instance->evt_detail) - pci_free_consistent(pdev, sizeof(struct megasas_evt_detail), - instance->evt_detail, - instance->evt_detail_h); - - if (instance->producer) - pci_free_consistent(pdev, sizeof(u32), instance->producer, - instance->producer_h); - if (instance->consumer) - pci_free_consistent(pdev, sizeof(u32), instance->consumer, - instance->consumer_h); - scsi_host_put(host); - - fail_alloc_instance: - fail_set_dma_mask: - pci_disable_device(pdev); - - return -ENODEV; -} - -/** - * megasas_flush_cache - Requests FW to flush all its caches - * @instance: Adapter soft state - */ -static void megasas_flush_cache(struct megasas_instance *instance) -{ - struct megasas_cmd *cmd; - struct megasas_dcmd_frame *dcmd; - - cmd = megasas_get_cmd(instance); - - if (!cmd) - return; - - dcmd = &cmd->frame->dcmd; - - memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); - - dcmd->cmd = MFI_CMD_DCMD; - dcmd->cmd_status = 0x0; - dcmd->sge_count = 0; - dcmd->flags = MFI_FRAME_DIR_NONE; - dcmd->timeout = 0; - dcmd->data_xfer_len = 0; - dcmd->opcode = MR_DCMD_CTRL_CACHE_FLUSH; - dcmd->mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE; - - megasas_issue_blocked_cmd(instance, cmd); - - megasas_return_cmd(instance, cmd); - - return; -} - -/** - * megasas_shutdown_controller - Instructs FW to shutdown the controller - * @instance: Adapter soft state - */ -static void megasas_shutdown_controller(struct megasas_instance *instance) -{ - struct megasas_cmd *cmd; - struct megasas_dcmd_frame *dcmd; - - cmd = megasas_get_cmd(instance); - - if (!cmd) - return; - - if (instance->aen_cmd) - megasas_issue_blocked_abort_cmd(instance, instance->aen_cmd); - - dcmd = &cmd->frame->dcmd; - - memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); - - dcmd->cmd = MFI_CMD_DCMD; - dcmd->cmd_status = 0x0; - dcmd->sge_count = 0; - dcmd->flags = MFI_FRAME_DIR_NONE; - dcmd->timeout = 0; - dcmd->data_xfer_len = 0; - dcmd->opcode = MR_DCMD_CTRL_SHUTDOWN; - - megasas_issue_blocked_cmd(instance, cmd); - - megasas_return_cmd(instance, cmd); - - return; -} - -/** - * megasas_detach_one - PCI hot"un"plug entry point - * @pdev: PCI device structure - */ -static void megasas_detach_one(struct pci_dev *pdev) -{ - int i; - struct Scsi_Host *host; - struct megasas_instance *instance; - - instance = pci_get_drvdata(pdev); - host = instance->host; - - scsi_remove_host(instance->host); - megasas_flush_cache(instance); - megasas_shutdown_controller(instance); - - /* - * Take the instance off the instance array. Note that we will not - * decrement the max_index. We let this array be sparse array - */ - for (i = 0; i < megasas_mgmt_info.max_index; i++) { - if (megasas_mgmt_info.instance[i] == instance) { - megasas_mgmt_info.count--; - megasas_mgmt_info.instance[i] = NULL; - - break; - } - } - - pci_set_drvdata(instance->pdev, NULL); - - megasas_disable_intr(instance->reg_set); - - free_irq(instance->pdev->irq, instance); - - megasas_release_mfi(instance); - - pci_free_consistent(pdev, sizeof(struct megasas_evt_detail), - instance->evt_detail, instance->evt_detail_h); - - pci_free_consistent(pdev, sizeof(u32), instance->producer, - instance->producer_h); - - pci_free_consistent(pdev, sizeof(u32), instance->consumer, - instance->consumer_h); - - scsi_host_put(host); - - pci_set_drvdata(pdev, NULL); - - pci_disable_device(pdev); - - return; -} - -/** - * megasas_shutdown - Shutdown entry point - * @device: Generic device structure - */ -static void megasas_shutdown(struct pci_dev *pdev) -{ - struct megasas_instance *instance = pci_get_drvdata(pdev); - megasas_flush_cache(instance); -} - -/** - * megasas_mgmt_open - char node "open" entry point - */ -static int megasas_mgmt_open(struct inode *inode, struct file *filep) -{ - /* - * Allow only those users with admin rights - */ - if (!capable(CAP_SYS_ADMIN)) - return -EACCES; - - return 0; -} - -/** - * megasas_mgmt_release - char node "release" entry point - */ -static int megasas_mgmt_release(struct inode *inode, struct file *filep) -{ - filep->private_data = NULL; - fasync_helper(-1, filep, 0, &megasas_async_queue); - - return 0; -} - -/** - * megasas_mgmt_fasync - Async notifier registration from applications - * - * This function adds the calling process to a driver global queue. When an - * event occurs, SIGIO will be sent to all processes in this queue. - */ -static int megasas_mgmt_fasync(int fd, struct file *filep, int mode) -{ - int rc; - - down(&megasas_async_queue_mutex); - - rc = fasync_helper(fd, filep, mode, &megasas_async_queue); - - up(&megasas_async_queue_mutex); - - if (rc >= 0) { - /* For sanity check when we get ioctl */ - filep->private_data = filep; - return 0; - } - - printk(KERN_DEBUG "megasas: fasync_helper failed [%d]\n", rc); - - return rc; -} - -/** - * megasas_mgmt_fw_ioctl - Issues management ioctls to FW - * @instance: Adapter soft state - * @argp: User's ioctl packet - */ -static int -megasas_mgmt_fw_ioctl(struct megasas_instance *instance, - struct megasas_iocpacket __user * user_ioc, - struct megasas_iocpacket *ioc) -{ - struct megasas_sge32 *kern_sge32; - struct megasas_cmd *cmd; - void *kbuff_arr[MAX_IOCTL_SGE]; - dma_addr_t buf_handle = 0; - int error = 0, i; - void *sense = NULL; - dma_addr_t sense_handle; - u32 *sense_ptr; - - memset(kbuff_arr, 0, sizeof(kbuff_arr)); - - if (ioc->sge_count > MAX_IOCTL_SGE) { - printk(KERN_DEBUG "megasas: SGE count [%d] > max limit [%d]\n", - ioc->sge_count, MAX_IOCTL_SGE); - return -EINVAL; - } - - cmd = megasas_get_cmd(instance); - if (!cmd) { - printk(KERN_DEBUG "megasas: Failed to get a cmd packet\n"); - return -ENOMEM; - } - - /* - * User's IOCTL packet has 2 frames (maximum). Copy those two - * frames into our cmd's frames. cmd->frame's context will get - * overwritten when we copy from user's frames. So set that value - * alone separately - */ - memcpy(cmd->frame, ioc->frame.raw, 2 * MEGAMFI_FRAME_SIZE); - cmd->frame->hdr.context = cmd->index; - - /* - * The management interface between applications and the fw uses - * MFI frames. E.g, RAID configuration changes, LD property changes - * etc are accomplishes through different kinds of MFI frames. The - * driver needs to care only about substituting user buffers with - * kernel buffers in SGLs. The location of SGL is embedded in the - * struct iocpacket itself. - */ - kern_sge32 = (struct megasas_sge32 *) - ((unsigned long)cmd->frame + ioc->sgl_off); - - /* - * For each user buffer, create a mirror buffer and copy in - */ - for (i = 0; i < ioc->sge_count; i++) { - kbuff_arr[i] = pci_alloc_consistent(instance->pdev, - ioc->sgl[i].iov_len, - &buf_handle); - if (!kbuff_arr[i]) { - printk(KERN_DEBUG "megasas: Failed to alloc " - "kernel SGL buffer for IOCTL \n"); - error = -ENOMEM; - goto out; - } - - /* - * We don't change the dma_coherent_mask, so - * pci_alloc_consistent only returns 32bit addresses - */ - kern_sge32[i].phys_addr = (u32) buf_handle; - kern_sge32[i].length = ioc->sgl[i].iov_len; - - /* - * We created a kernel buffer corresponding to the - * user buffer. Now copy in from the user buffer - */ - if (copy_from_user(kbuff_arr[i], ioc->sgl[i].iov_base, - (u32) (ioc->sgl[i].iov_len))) { - error = -EFAULT; - goto out; - } - } - - if (ioc->sense_len) { - sense = pci_alloc_consistent(instance->pdev, ioc->sense_len, - &sense_handle); - if (!sense) { - error = -ENOMEM; - goto out; - } - - sense_ptr = - (u32 *) ((unsigned long)cmd->frame + ioc->sense_off); - *sense_ptr = sense_handle; - } - - /* - * Set the sync_cmd flag so that the ISR knows not to complete this - * cmd to the SCSI mid-layer - */ - cmd->sync_cmd = 1; - megasas_issue_blocked_cmd(instance, cmd); - cmd->sync_cmd = 0; - - /* - * copy out the kernel buffers to user buffers - */ - for (i = 0; i < ioc->sge_count; i++) { - if (copy_to_user(ioc->sgl[i].iov_base, kbuff_arr[i], - ioc->sgl[i].iov_len)) { - error = -EFAULT; - goto out; - } - } - - /* - * copy out the sense - */ - if (ioc->sense_len) { - /* - * sense_ptr points to the location that has the user - * sense buffer address - */ - sense_ptr = (u32 *) ((unsigned long)ioc->frame.raw + - ioc->sense_off); - - if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)), - sense, ioc->sense_len)) { - error = -EFAULT; - goto out; - } - } - - /* - * copy the status codes returned by the fw - */ - if (copy_to_user(&user_ioc->frame.hdr.cmd_status, - &cmd->frame->hdr.cmd_status, sizeof(u8))) { - printk(KERN_DEBUG "megasas: Error copying out cmd_status\n"); - error = -EFAULT; - } - - out: - if (sense) { - pci_free_consistent(instance->pdev, ioc->sense_len, - sense, sense_handle); - } - - for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) { - pci_free_consistent(instance->pdev, - kern_sge32[i].length, - kbuff_arr[i], kern_sge32[i].phys_addr); - } - - megasas_return_cmd(instance, cmd); - return error; -} - -static struct megasas_instance *megasas_lookup_instance(u16 host_no) -{ - int i; - - for (i = 0; i < megasas_mgmt_info.max_index; i++) { - - if ((megasas_mgmt_info.instance[i]) && - (megasas_mgmt_info.instance[i]->host->host_no == host_no)) - return megasas_mgmt_info.instance[i]; - } - - return NULL; -} - -static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg) -{ - struct megasas_iocpacket __user *user_ioc = - (struct megasas_iocpacket __user *)arg; - struct megasas_iocpacket *ioc; - struct megasas_instance *instance; - int error; - - ioc = kmalloc(sizeof(*ioc), GFP_KERNEL); - if (!ioc) - return -ENOMEM; - - if (copy_from_user(ioc, user_ioc, sizeof(*ioc))) { - error = -EFAULT; - goto out_kfree_ioc; - } - - instance = megasas_lookup_instance(ioc->host_no); - if (!instance) { - error = -ENODEV; - goto out_kfree_ioc; - } - - /* - * We will allow only MEGASAS_INT_CMDS number of parallel ioctl cmds - */ - if (down_interruptible(&instance->ioctl_sem)) { - error = -ERESTARTSYS; - goto out_kfree_ioc; - } - error = megasas_mgmt_fw_ioctl(instance, user_ioc, ioc); - up(&instance->ioctl_sem); - - out_kfree_ioc: - kfree(ioc); - return error; -} - -static int megasas_mgmt_ioctl_aen(struct file *file, unsigned long arg) -{ - struct megasas_instance *instance; - struct megasas_aen aen; - int error; - - if (file->private_data != file) { - printk(KERN_DEBUG "megasas: fasync_helper was not " - "called first\n"); - return -EINVAL; - } - - if (copy_from_user(&aen, (void __user *)arg, sizeof(aen))) - return -EFAULT; - - instance = megasas_lookup_instance(aen.host_no); - - if (!instance) - return -ENODEV; - - down(&instance->aen_mutex); - error = megasas_register_aen(instance, aen.seq_num, - aen.class_locale_word); - up(&instance->aen_mutex); - return error; -} - -/** - * megasas_mgmt_ioctl - char node ioctl entry point - */ -static long -megasas_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - switch (cmd) { - case MEGASAS_IOC_FIRMWARE: - return megasas_mgmt_ioctl_fw(file, arg); - - case MEGASAS_IOC_GET_AEN: - return megasas_mgmt_ioctl_aen(file, arg); - } - - return -ENOTTY; -} - -#ifdef CONFIG_COMPAT -static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) -{ - struct compat_megasas_iocpacket __user *cioc = - (struct compat_megasas_iocpacket __user *)arg; - struct megasas_iocpacket __user *ioc = - compat_alloc_user_space(sizeof(struct megasas_iocpacket)); - int i; - int error = 0; - - clear_user(ioc, sizeof(*ioc)); - - if (copy_in_user(&ioc->host_no, &cioc->host_no, sizeof(u16)) || - copy_in_user(&ioc->sgl_off, &cioc->sgl_off, sizeof(u32)) || - copy_in_user(&ioc->sense_off, &cioc->sense_off, sizeof(u32)) || - copy_in_user(&ioc->sense_len, &cioc->sense_len, sizeof(u32)) || - copy_in_user(ioc->frame.raw, cioc->frame.raw, 128) || - copy_in_user(&ioc->sge_count, &cioc->sge_count, sizeof(u32))) - return -EFAULT; - - for (i = 0; i < MAX_IOCTL_SGE; i++) { - compat_uptr_t ptr; - - if (get_user(ptr, &cioc->sgl[i].iov_base) || - put_user(compat_ptr(ptr), &ioc->sgl[i].iov_base) || - copy_in_user(&ioc->sgl[i].iov_len, - &cioc->sgl[i].iov_len, sizeof(compat_size_t))) - return -EFAULT; - } - - error = megasas_mgmt_ioctl_fw(file, (unsigned long)ioc); - - if (copy_in_user(&cioc->frame.hdr.cmd_status, - &ioc->frame.hdr.cmd_status, sizeof(u8))) { - printk(KERN_DEBUG "megasas: error copy_in_user cmd_status\n"); - return -EFAULT; - } - return error; -} - -static long -megasas_mgmt_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - switch (cmd) { - case MEGASAS_IOC_FIRMWARE:{ - return megasas_mgmt_compat_ioctl_fw(file, arg); - } - case MEGASAS_IOC_GET_AEN: - return megasas_mgmt_ioctl_aen(file, arg); - } - - return -ENOTTY; -} -#endif - -/* - * File operations structure for management interface - */ -static struct file_operations megasas_mgmt_fops = { - .owner = THIS_MODULE, - .open = megasas_mgmt_open, - .release = megasas_mgmt_release, - .fasync = megasas_mgmt_fasync, - .unlocked_ioctl = megasas_mgmt_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = megasas_mgmt_compat_ioctl, -#endif -}; - -/* - * PCI hotplug support registration structure - */ -static struct pci_driver megasas_pci_driver = { - - .name = "megaraid_sas", - .id_table = megasas_pci_table, - .probe = megasas_probe_one, - .remove = __devexit_p(megasas_detach_one), - .shutdown = megasas_shutdown, -}; - -/* - * Sysfs driver attributes - */ -static ssize_t megasas_sysfs_show_version(struct device_driver *dd, char *buf) -{ - return snprintf(buf, strlen(MEGASAS_VERSION) + 2, "%s\n", - MEGASAS_VERSION); -} - -static DRIVER_ATTR(version, S_IRUGO, megasas_sysfs_show_version, NULL); - -static ssize_t -megasas_sysfs_show_release_date(struct device_driver *dd, char *buf) -{ - return snprintf(buf, strlen(MEGASAS_RELDATE) + 2, "%s\n", - MEGASAS_RELDATE); -} - -static DRIVER_ATTR(release_date, S_IRUGO, megasas_sysfs_show_release_date, - NULL); - -/** - * megasas_init - Driver load entry point - */ -static int __init megasas_init(void) -{ - int rval; - - /* - * Announce driver version and other information - */ - printk(KERN_INFO "megasas: %s %s\n", MEGASAS_VERSION, - MEGASAS_EXT_VERSION); - - memset(&megasas_mgmt_info, 0, sizeof(megasas_mgmt_info)); - - /* - * Register character device node - */ - rval = register_chrdev(0, "megaraid_sas_ioctl", &megasas_mgmt_fops); - - if (rval < 0) { - printk(KERN_DEBUG "megasas: failed to open device node\n"); - return rval; - } - - megasas_mgmt_majorno = rval; - - /* - * Register ourselves as PCI hotplug module - */ - rval = pci_module_init(&megasas_pci_driver); - - if (rval) { - printk(KERN_DEBUG "megasas: PCI hotplug regisration failed \n"); - unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); - } - - driver_create_file(&megasas_pci_driver.driver, &driver_attr_version); - driver_create_file(&megasas_pci_driver.driver, - &driver_attr_release_date); - - return rval; -} - -/** - * megasas_exit - Driver unload entry point - */ -static void __exit megasas_exit(void) -{ - driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); - driver_remove_file(&megasas_pci_driver.driver, - &driver_attr_release_date); - - pci_unregister_driver(&megasas_pci_driver); - unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); -} - -module_init(megasas_init); -module_exit(megasas_exit); diff --git a/trunk/drivers/scsi/megaraid/megaraid_sas.h b/trunk/drivers/scsi/megaraid/megaraid_sas.h deleted file mode 100644 index eaec9d531424..000000000000 --- a/trunk/drivers/scsi/megaraid/megaraid_sas.h +++ /dev/null @@ -1,1142 +0,0 @@ -/* - * - * Linux MegaRAID driver for SAS based RAID controllers - * - * Copyright (c) 2003-2005 LSI Logic Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - * FILE : megaraid_sas.h - */ - -#ifndef LSI_MEGARAID_SAS_H -#define LSI_MEGARAID_SAS_H - -/** - * MegaRAID SAS Driver meta data - */ -#define MEGASAS_VERSION "00.00.02.00-rc4" -#define MEGASAS_RELDATE "Sep 16, 2005" -#define MEGASAS_EXT_VERSION "Fri Sep 16 12:37:08 EDT 2005" - -/* - * ===================================== - * MegaRAID SAS MFI firmware definitions - * ===================================== - */ - -/* - * MFI stands for MegaRAID SAS FW Interface. This is just a moniker for - * protocol between the software and firmware. Commands are issued using - * "message frames" - */ - -/** - * FW posts its state in upper 4 bits of outbound_msg_0 register - */ -#define MFI_STATE_MASK 0xF0000000 -#define MFI_STATE_UNDEFINED 0x00000000 -#define MFI_STATE_BB_INIT 0x10000000 -#define MFI_STATE_FW_INIT 0x40000000 -#define MFI_STATE_WAIT_HANDSHAKE 0x60000000 -#define MFI_STATE_FW_INIT_2 0x70000000 -#define MFI_STATE_DEVICE_SCAN 0x80000000 -#define MFI_STATE_FLUSH_CACHE 0xA0000000 -#define MFI_STATE_READY 0xB0000000 -#define MFI_STATE_OPERATIONAL 0xC0000000 -#define MFI_STATE_FAULT 0xF0000000 - -#define MEGAMFI_FRAME_SIZE 64 - -/** - * During FW init, clear pending cmds & reset state using inbound_msg_0 - * - * ABORT : Abort all pending cmds - * READY : Move from OPERATIONAL to READY state; discard queue info - * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??) - * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver - */ -#define MFI_INIT_ABORT 0x00000000 -#define MFI_INIT_READY 0x00000002 -#define MFI_INIT_MFIMODE 0x00000004 -#define MFI_INIT_CLEAR_HANDSHAKE 0x00000008 -#define MFI_RESET_FLAGS MFI_INIT_READY|MFI_INIT_MFIMODE - -/** - * MFI frame flags - */ -#define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000 -#define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001 -#define MFI_FRAME_SGL32 0x0000 -#define MFI_FRAME_SGL64 0x0002 -#define MFI_FRAME_SENSE32 0x0000 -#define MFI_FRAME_SENSE64 0x0004 -#define MFI_FRAME_DIR_NONE 0x0000 -#define MFI_FRAME_DIR_WRITE 0x0008 -#define MFI_FRAME_DIR_READ 0x0010 -#define MFI_FRAME_DIR_BOTH 0x0018 - -/** - * Definition for cmd_status - */ -#define MFI_CMD_STATUS_POLL_MODE 0xFF - -/** - * MFI command opcodes - */ -#define MFI_CMD_INIT 0x00 -#define MFI_CMD_LD_READ 0x01 -#define MFI_CMD_LD_WRITE 0x02 -#define MFI_CMD_LD_SCSI_IO 0x03 -#define MFI_CMD_PD_SCSI_IO 0x04 -#define MFI_CMD_DCMD 0x05 -#define MFI_CMD_ABORT 0x06 -#define MFI_CMD_SMP 0x07 -#define MFI_CMD_STP 0x08 - -#define MR_DCMD_CTRL_GET_INFO 0x01010000 - -#define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000 -#define MR_FLUSH_CTRL_CACHE 0x01 -#define MR_FLUSH_DISK_CACHE 0x02 - -#define MR_DCMD_CTRL_SHUTDOWN 0x01050000 -#define MR_ENABLE_DRIVE_SPINDOWN 0x01 - -#define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100 -#define MR_DCMD_CTRL_EVENT_GET 0x01040300 -#define MR_DCMD_CTRL_EVENT_WAIT 0x01040500 -#define MR_DCMD_LD_GET_PROPERTIES 0x03030000 - -#define MR_DCMD_CLUSTER 0x08000000 -#define MR_DCMD_CLUSTER_RESET_ALL 0x08010100 -#define MR_DCMD_CLUSTER_RESET_LD 0x08010200 - -/** - * MFI command completion codes - */ -enum MFI_STAT { - MFI_STAT_OK = 0x00, - MFI_STAT_INVALID_CMD = 0x01, - MFI_STAT_INVALID_DCMD = 0x02, - MFI_STAT_INVALID_PARAMETER = 0x03, - MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04, - MFI_STAT_ABORT_NOT_POSSIBLE = 0x05, - MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06, - MFI_STAT_APP_IN_USE = 0x07, - MFI_STAT_APP_NOT_INITIALIZED = 0x08, - MFI_STAT_ARRAY_INDEX_INVALID = 0x09, - MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a, - MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b, - MFI_STAT_DEVICE_NOT_FOUND = 0x0c, - MFI_STAT_DRIVE_TOO_SMALL = 0x0d, - MFI_STAT_FLASH_ALLOC_FAIL = 0x0e, - MFI_STAT_FLASH_BUSY = 0x0f, - MFI_STAT_FLASH_ERROR = 0x10, - MFI_STAT_FLASH_IMAGE_BAD = 0x11, - MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12, - MFI_STAT_FLASH_NOT_OPEN = 0x13, - MFI_STAT_FLASH_NOT_STARTED = 0x14, - MFI_STAT_FLUSH_FAILED = 0x15, - MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16, - MFI_STAT_LD_CC_IN_PROGRESS = 0x17, - MFI_STAT_LD_INIT_IN_PROGRESS = 0x18, - MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19, - MFI_STAT_LD_MAX_CONFIGURED = 0x1a, - MFI_STAT_LD_NOT_OPTIMAL = 0x1b, - MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c, - MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d, - MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e, - MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f, - MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20, - MFI_STAT_MFC_HW_ERROR = 0x21, - MFI_STAT_NO_HW_PRESENT = 0x22, - MFI_STAT_NOT_FOUND = 0x23, - MFI_STAT_NOT_IN_ENCL = 0x24, - MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25, - MFI_STAT_PD_TYPE_WRONG = 0x26, - MFI_STAT_PR_DISABLED = 0x27, - MFI_STAT_ROW_INDEX_INVALID = 0x28, - MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29, - MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a, - MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b, - MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c, - MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d, - MFI_STAT_SCSI_IO_FAILED = 0x2e, - MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f, - MFI_STAT_SHUTDOWN_FAILED = 0x30, - MFI_STAT_TIME_NOT_SET = 0x31, - MFI_STAT_WRONG_STATE = 0x32, - MFI_STAT_LD_OFFLINE = 0x33, - MFI_STAT_PEER_NOTIFICATION_REJECTED = 0x34, - MFI_STAT_PEER_NOTIFICATION_FAILED = 0x35, - MFI_STAT_RESERVATION_IN_PROGRESS = 0x36, - MFI_STAT_I2C_ERRORS_DETECTED = 0x37, - MFI_STAT_PCI_ERRORS_DETECTED = 0x38, - - MFI_STAT_INVALID_STATUS = 0xFF -}; - -/* - * Number of mailbox bytes in DCMD message frame - */ -#define MFI_MBOX_SIZE 12 - -enum MR_EVT_CLASS { - - MR_EVT_CLASS_DEBUG = -2, - MR_EVT_CLASS_PROGRESS = -1, - MR_EVT_CLASS_INFO = 0, - MR_EVT_CLASS_WARNING = 1, - MR_EVT_CLASS_CRITICAL = 2, - MR_EVT_CLASS_FATAL = 3, - MR_EVT_CLASS_DEAD = 4, - -}; - -enum MR_EVT_LOCALE { - - MR_EVT_LOCALE_LD = 0x0001, - MR_EVT_LOCALE_PD = 0x0002, - MR_EVT_LOCALE_ENCL = 0x0004, - MR_EVT_LOCALE_BBU = 0x0008, - MR_EVT_LOCALE_SAS = 0x0010, - MR_EVT_LOCALE_CTRL = 0x0020, - MR_EVT_LOCALE_CONFIG = 0x0040, - MR_EVT_LOCALE_CLUSTER = 0x0080, - MR_EVT_LOCALE_ALL = 0xffff, - -}; - -enum MR_EVT_ARGS { - - MR_EVT_ARGS_NONE, - MR_EVT_ARGS_CDB_SENSE, - MR_EVT_ARGS_LD, - MR_EVT_ARGS_LD_COUNT, - MR_EVT_ARGS_LD_LBA, - MR_EVT_ARGS_LD_OWNER, - MR_EVT_ARGS_LD_LBA_PD_LBA, - MR_EVT_ARGS_LD_PROG, - MR_EVT_ARGS_LD_STATE, - MR_EVT_ARGS_LD_STRIP, - MR_EVT_ARGS_PD, - MR_EVT_ARGS_PD_ERR, - MR_EVT_ARGS_PD_LBA, - MR_EVT_ARGS_PD_LBA_LD, - MR_EVT_ARGS_PD_PROG, - MR_EVT_ARGS_PD_STATE, - MR_EVT_ARGS_PCI, - MR_EVT_ARGS_RATE, - MR_EVT_ARGS_STR, - MR_EVT_ARGS_TIME, - MR_EVT_ARGS_ECC, - -}; - -/* - * SAS controller properties - */ -struct megasas_ctrl_prop { - - u16 seq_num; - u16 pred_fail_poll_interval; - u16 intr_throttle_count; - u16 intr_throttle_timeouts; - u8 rebuild_rate; - u8 patrol_read_rate; - u8 bgi_rate; - u8 cc_rate; - u8 recon_rate; - u8 cache_flush_interval; - u8 spinup_drv_count; - u8 spinup_delay; - u8 cluster_enable; - u8 coercion_mode; - u8 alarm_enable; - u8 disable_auto_rebuild; - u8 disable_battery_warn; - u8 ecc_bucket_size; - u16 ecc_bucket_leak_rate; - u8 restore_hotspare_on_insertion; - u8 expose_encl_devices; - u8 reserved[38]; - -} __attribute__ ((packed)); - -/* - * SAS controller information - */ -struct megasas_ctrl_info { - - /* - * PCI device information - */ - struct { - - u16 vendor_id; - u16 device_id; - u16 sub_vendor_id; - u16 sub_device_id; - u8 reserved[24]; - - } __attribute__ ((packed)) pci; - - /* - * Host interface information - */ - struct { - - u8 PCIX:1; - u8 PCIE:1; - u8 iSCSI:1; - u8 SAS_3G:1; - u8 reserved_0:4; - u8 reserved_1[6]; - u8 port_count; - u64 port_addr[8]; - - } __attribute__ ((packed)) host_interface; - - /* - * Device (backend) interface information - */ - struct { - - u8 SPI:1; - u8 SAS_3G:1; - u8 SATA_1_5G:1; - u8 SATA_3G:1; - u8 reserved_0:4; - u8 reserved_1[6]; - u8 port_count; - u64 port_addr[8]; - - } __attribute__ ((packed)) device_interface; - - /* - * List of components residing in flash. All str are null terminated - */ - u32 image_check_word; - u32 image_component_count; - - struct { - - char name[8]; - char version[32]; - char build_date[16]; - char built_time[16]; - - } __attribute__ ((packed)) image_component[8]; - - /* - * List of flash components that have been flashed on the card, but - * are not in use, pending reset of the adapter. This list will be - * empty if a flash operation has not occurred. All stings are null - * terminated - */ - u32 pending_image_component_count; - - struct { - - char name[8]; - char version[32]; - char build_date[16]; - char build_time[16]; - - } __attribute__ ((packed)) pending_image_component[8]; - - u8 max_arms; - u8 max_spans; - u8 max_arrays; - u8 max_lds; - - char product_name[80]; - char serial_no[32]; - - /* - * Other physical/controller/operation information. Indicates the - * presence of the hardware - */ - struct { - - u32 bbu:1; - u32 alarm:1; - u32 nvram:1; - u32 uart:1; - u32 reserved:28; - - } __attribute__ ((packed)) hw_present; - - u32 current_fw_time; - - /* - * Maximum data transfer sizes - */ - u16 max_concurrent_cmds; - u16 max_sge_count; - u32 max_request_size; - - /* - * Logical and physical device counts - */ - u16 ld_present_count; - u16 ld_degraded_count; - u16 ld_offline_count; - - u16 pd_present_count; - u16 pd_disk_present_count; - u16 pd_disk_pred_failure_count; - u16 pd_disk_failed_count; - - /* - * Memory size information - */ - u16 nvram_size; - u16 memory_size; - u16 flash_size; - - /* - * Error counters - */ - u16 mem_correctable_error_count; - u16 mem_uncorrectable_error_count; - - /* - * Cluster information - */ - u8 cluster_permitted; - u8 cluster_active; - - /* - * Additional max data transfer sizes - */ - u16 max_strips_per_io; - - /* - * Controller capabilities structures - */ - struct { - - u32 raid_level_0:1; - u32 raid_level_1:1; - u32 raid_level_5:1; - u32 raid_level_1E:1; - u32 raid_level_6:1; - u32 reserved:27; - - } __attribute__ ((packed)) raid_levels; - - struct { - - u32 rbld_rate:1; - u32 cc_rate:1; - u32 bgi_rate:1; - u32 recon_rate:1; - u32 patrol_rate:1; - u32 alarm_control:1; - u32 cluster_supported:1; - u32 bbu:1; - u32 spanning_allowed:1; - u32 dedicated_hotspares:1; - u32 revertible_hotspares:1; - u32 foreign_config_import:1; - u32 self_diagnostic:1; - u32 mixed_redundancy_arr:1; - u32 global_hot_spares:1; - u32 reserved:17; - - } __attribute__ ((packed)) adapter_operations; - - struct { - - u32 read_policy:1; - u32 write_policy:1; - u32 io_policy:1; - u32 access_policy:1; - u32 disk_cache_policy:1; - u32 reserved:27; - - } __attribute__ ((packed)) ld_operations; - - struct { - - u8 min; - u8 max; - u8 reserved[2]; - - } __attribute__ ((packed)) stripe_sz_ops; - - struct { - - u32 force_online:1; - u32 force_offline:1; - u32 force_rebuild:1; - u32 reserved:29; - - } __attribute__ ((packed)) pd_operations; - - struct { - - u32 ctrl_supports_sas:1; - u32 ctrl_supports_sata:1; - u32 allow_mix_in_encl:1; - u32 allow_mix_in_ld:1; - u32 allow_sata_in_cluster:1; - u32 reserved:27; - - } __attribute__ ((packed)) pd_mix_support; - - /* - * Define ECC single-bit-error bucket information - */ - u8 ecc_bucket_count; - u8 reserved_2[11]; - - /* - * Include the controller properties (changeable items) - */ - struct megasas_ctrl_prop properties; - - /* - * Define FW pkg version (set in envt v'bles on OEM basis) - */ - char package_version[0x60]; - - u8 pad[0x800 - 0x6a0]; - -} __attribute__ ((packed)); - -/* - * =============================== - * MegaRAID SAS driver definitions - * =============================== - */ -#define MEGASAS_MAX_PD_CHANNELS 2 -#define MEGASAS_MAX_LD_CHANNELS 2 -#define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \ - MEGASAS_MAX_LD_CHANNELS) -#define MEGASAS_MAX_DEV_PER_CHANNEL 128 -#define MEGASAS_DEFAULT_INIT_ID -1 -#define MEGASAS_MAX_LUN 8 -#define MEGASAS_MAX_LD 64 - -/* - * When SCSI mid-layer calls driver's reset routine, driver waits for - * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note - * that the driver cannot _actually_ abort or reset pending commands. While - * it is waiting for the commands to complete, it prints a diagnostic message - * every MEGASAS_RESET_NOTICE_INTERVAL seconds - */ -#define MEGASAS_RESET_WAIT_TIME 180 -#define MEGASAS_RESET_NOTICE_INTERVAL 5 - -#define MEGASAS_IOCTL_CMD 0 - -/* - * FW reports the maximum of number of commands that it can accept (maximum - * commands that can be outstanding) at any time. The driver must report a - * lower number to the mid layer because it can issue a few internal commands - * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs - * is shown below - */ -#define MEGASAS_INT_CMDS 32 - -/* - * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit - * SGLs based on the size of dma_addr_t - */ -#define IS_DMA64 (sizeof(dma_addr_t) == 8) - -#define MFI_OB_INTR_STATUS_MASK 0x00000002 -#define MFI_POLL_TIMEOUT_SECS 10 - -struct megasas_register_set { - - u32 reserved_0[4]; /*0000h */ - - u32 inbound_msg_0; /*0010h */ - u32 inbound_msg_1; /*0014h */ - u32 outbound_msg_0; /*0018h */ - u32 outbound_msg_1; /*001Ch */ - - u32 inbound_doorbell; /*0020h */ - u32 inbound_intr_status; /*0024h */ - u32 inbound_intr_mask; /*0028h */ - - u32 outbound_doorbell; /*002Ch */ - u32 outbound_intr_status; /*0030h */ - u32 outbound_intr_mask; /*0034h */ - - u32 reserved_1[2]; /*0038h */ - - u32 inbound_queue_port; /*0040h */ - u32 outbound_queue_port; /*0044h */ - - u32 reserved_2; /*004Ch */ - - u32 index_registers[1004]; /*0050h */ - -} __attribute__ ((packed)); - -struct megasas_sge32 { - - u32 phys_addr; - u32 length; - -} __attribute__ ((packed)); - -struct megasas_sge64 { - - u64 phys_addr; - u32 length; - -} __attribute__ ((packed)); - -union megasas_sgl { - - struct megasas_sge32 sge32[1]; - struct megasas_sge64 sge64[1]; - -} __attribute__ ((packed)); - -struct megasas_header { - - u8 cmd; /*00h */ - u8 sense_len; /*01h */ - u8 cmd_status; /*02h */ - u8 scsi_status; /*03h */ - - u8 target_id; /*04h */ - u8 lun; /*05h */ - u8 cdb_len; /*06h */ - u8 sge_count; /*07h */ - - u32 context; /*08h */ - u32 pad_0; /*0Ch */ - - u16 flags; /*10h */ - u16 timeout; /*12h */ - u32 data_xferlen; /*14h */ - -} __attribute__ ((packed)); - -union megasas_sgl_frame { - - struct megasas_sge32 sge32[8]; - struct megasas_sge64 sge64[5]; - -} __attribute__ ((packed)); - -struct megasas_init_frame { - - u8 cmd; /*00h */ - u8 reserved_0; /*01h */ - u8 cmd_status; /*02h */ - - u8 reserved_1; /*03h */ - u32 reserved_2; /*04h */ - - u32 context; /*08h */ - u32 pad_0; /*0Ch */ - - u16 flags; /*10h */ - u16 reserved_3; /*12h */ - u32 data_xfer_len; /*14h */ - - u32 queue_info_new_phys_addr_lo; /*18h */ - u32 queue_info_new_phys_addr_hi; /*1Ch */ - u32 queue_info_old_phys_addr_lo; /*20h */ - u32 queue_info_old_phys_addr_hi; /*24h */ - - u32 reserved_4[6]; /*28h */ - -} __attribute__ ((packed)); - -struct megasas_init_queue_info { - - u32 init_flags; /*00h */ - u32 reply_queue_entries; /*04h */ - - u32 reply_queue_start_phys_addr_lo; /*08h */ - u32 reply_queue_start_phys_addr_hi; /*0Ch */ - u32 producer_index_phys_addr_lo; /*10h */ - u32 producer_index_phys_addr_hi; /*14h */ - u32 consumer_index_phys_addr_lo; /*18h */ - u32 consumer_index_phys_addr_hi; /*1Ch */ - -} __attribute__ ((packed)); - -struct megasas_io_frame { - - u8 cmd; /*00h */ - u8 sense_len; /*01h */ - u8 cmd_status; /*02h */ - u8 scsi_status; /*03h */ - - u8 target_id; /*04h */ - u8 access_byte; /*05h */ - u8 reserved_0; /*06h */ - u8 sge_count; /*07h */ - - u32 context; /*08h */ - u32 pad_0; /*0Ch */ - - u16 flags; /*10h */ - u16 timeout; /*12h */ - u32 lba_count; /*14h */ - - u32 sense_buf_phys_addr_lo; /*18h */ - u32 sense_buf_phys_addr_hi; /*1Ch */ - - u32 start_lba_lo; /*20h */ - u32 start_lba_hi; /*24h */ - - union megasas_sgl sgl; /*28h */ - -} __attribute__ ((packed)); - -struct megasas_pthru_frame { - - u8 cmd; /*00h */ - u8 sense_len; /*01h */ - u8 cmd_status; /*02h */ - u8 scsi_status; /*03h */ - - u8 target_id; /*04h */ - u8 lun; /*05h */ - u8 cdb_len; /*06h */ - u8 sge_count; /*07h */ - - u32 context; /*08h */ - u32 pad_0; /*0Ch */ - - u16 flags; /*10h */ - u16 timeout; /*12h */ - u32 data_xfer_len; /*14h */ - - u32 sense_buf_phys_addr_lo; /*18h */ - u32 sense_buf_phys_addr_hi; /*1Ch */ - - u8 cdb[16]; /*20h */ - union megasas_sgl sgl; /*30h */ - -} __attribute__ ((packed)); - -struct megasas_dcmd_frame { - - u8 cmd; /*00h */ - u8 reserved_0; /*01h */ - u8 cmd_status; /*02h */ - u8 reserved_1[4]; /*03h */ - u8 sge_count; /*07h */ - - u32 context; /*08h */ - u32 pad_0; /*0Ch */ - - u16 flags; /*10h */ - u16 timeout; /*12h */ - - u32 data_xfer_len; /*14h */ - u32 opcode; /*18h */ - - union { /*1Ch */ - u8 b[12]; - u16 s[6]; - u32 w[3]; - } mbox; - - union megasas_sgl sgl; /*28h */ - -} __attribute__ ((packed)); - -struct megasas_abort_frame { - - u8 cmd; /*00h */ - u8 reserved_0; /*01h */ - u8 cmd_status; /*02h */ - - u8 reserved_1; /*03h */ - u32 reserved_2; /*04h */ - - u32 context; /*08h */ - u32 pad_0; /*0Ch */ - - u16 flags; /*10h */ - u16 reserved_3; /*12h */ - u32 reserved_4; /*14h */ - - u32 abort_context; /*18h */ - u32 pad_1; /*1Ch */ - - u32 abort_mfi_phys_addr_lo; /*20h */ - u32 abort_mfi_phys_addr_hi; /*24h */ - - u32 reserved_5[6]; /*28h */ - -} __attribute__ ((packed)); - -struct megasas_smp_frame { - - u8 cmd; /*00h */ - u8 reserved_1; /*01h */ - u8 cmd_status; /*02h */ - u8 connection_status; /*03h */ - - u8 reserved_2[3]; /*04h */ - u8 sge_count; /*07h */ - - u32 context; /*08h */ - u32 pad_0; /*0Ch */ - - u16 flags; /*10h */ - u16 timeout; /*12h */ - - u32 data_xfer_len; /*14h */ - u64 sas_addr; /*18h */ - - union { - struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */ - struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */ - } sgl; - -} __attribute__ ((packed)); - -struct megasas_stp_frame { - - u8 cmd; /*00h */ - u8 reserved_1; /*01h */ - u8 cmd_status; /*02h */ - u8 reserved_2; /*03h */ - - u8 target_id; /*04h */ - u8 reserved_3[2]; /*05h */ - u8 sge_count; /*07h */ - - u32 context; /*08h */ - u32 pad_0; /*0Ch */ - - u16 flags; /*10h */ - u16 timeout; /*12h */ - - u32 data_xfer_len; /*14h */ - - u16 fis[10]; /*18h */ - u32 stp_flags; - - union { - struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */ - struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */ - } sgl; - -} __attribute__ ((packed)); - -union megasas_frame { - - struct megasas_header hdr; - struct megasas_init_frame init; - struct megasas_io_frame io; - struct megasas_pthru_frame pthru; - struct megasas_dcmd_frame dcmd; - struct megasas_abort_frame abort; - struct megasas_smp_frame smp; - struct megasas_stp_frame stp; - - u8 raw_bytes[64]; -}; - -struct megasas_cmd; - -union megasas_evt_class_locale { - - struct { - u16 locale; - u8 reserved; - s8 class; - } __attribute__ ((packed)) members; - - u32 word; - -} __attribute__ ((packed)); - -struct megasas_evt_log_info { - u32 newest_seq_num; - u32 oldest_seq_num; - u32 clear_seq_num; - u32 shutdown_seq_num; - u32 boot_seq_num; - -} __attribute__ ((packed)); - -struct megasas_progress { - - u16 progress; - u16 elapsed_seconds; - -} __attribute__ ((packed)); - -struct megasas_evtarg_ld { - - u16 target_id; - u8 ld_index; - u8 reserved; - -} __attribute__ ((packed)); - -struct megasas_evtarg_pd { - u16 device_id; - u8 encl_index; - u8 slot_number; - -} __attribute__ ((packed)); - -struct megasas_evt_detail { - - u32 seq_num; - u32 time_stamp; - u32 code; - union megasas_evt_class_locale cl; - u8 arg_type; - u8 reserved1[15]; - - union { - struct { - struct megasas_evtarg_pd pd; - u8 cdb_length; - u8 sense_length; - u8 reserved[2]; - u8 cdb[16]; - u8 sense[64]; - } __attribute__ ((packed)) cdbSense; - - struct megasas_evtarg_ld ld; - - struct { - struct megasas_evtarg_ld ld; - u64 count; - } __attribute__ ((packed)) ld_count; - - struct { - u64 lba; - struct megasas_evtarg_ld ld; - } __attribute__ ((packed)) ld_lba; - - struct { - struct megasas_evtarg_ld ld; - u32 prevOwner; - u32 newOwner; - } __attribute__ ((packed)) ld_owner; - - struct { - u64 ld_lba; - u64 pd_lba; - struct megasas_evtarg_ld ld; - struct megasas_evtarg_pd pd; - } __attribute__ ((packed)) ld_lba_pd_lba; - - struct { - struct megasas_evtarg_ld ld; - struct megasas_progress prog; - } __attribute__ ((packed)) ld_prog; - - struct { - struct megasas_evtarg_ld ld; - u32 prev_state; - u32 new_state; - } __attribute__ ((packed)) ld_state; - - struct { - u64 strip; - struct megasas_evtarg_ld ld; - } __attribute__ ((packed)) ld_strip; - - struct megasas_evtarg_pd pd; - - struct { - struct megasas_evtarg_pd pd; - u32 err; - } __attribute__ ((packed)) pd_err; - - struct { - u64 lba; - struct megasas_evtarg_pd pd; - } __attribute__ ((packed)) pd_lba; - - struct { - u64 lba; - struct megasas_evtarg_pd pd; - struct megasas_evtarg_ld ld; - } __attribute__ ((packed)) pd_lba_ld; - - struct { - struct megasas_evtarg_pd pd; - struct megasas_progress prog; - } __attribute__ ((packed)) pd_prog; - - struct { - struct megasas_evtarg_pd pd; - u32 prevState; - u32 newState; - } __attribute__ ((packed)) pd_state; - - struct { - u16 vendorId; - u16 deviceId; - u16 subVendorId; - u16 subDeviceId; - } __attribute__ ((packed)) pci; - - u32 rate; - char str[96]; - - struct { - u32 rtc; - u32 elapsedSeconds; - } __attribute__ ((packed)) time; - - struct { - u32 ecar; - u32 elog; - char str[64]; - } __attribute__ ((packed)) ecc; - - u8 b[96]; - u16 s[48]; - u32 w[24]; - u64 d[12]; - } args; - - char description[128]; - -} __attribute__ ((packed)); - -struct megasas_instance { - - u32 *producer; - dma_addr_t producer_h; - u32 *consumer; - dma_addr_t consumer_h; - - u32 *reply_queue; - dma_addr_t reply_queue_h; - - unsigned long base_addr; - struct megasas_register_set __iomem *reg_set; - - s8 init_id; - u8 reserved[3]; - - u16 max_num_sge; - u16 max_fw_cmds; - u32 max_sectors_per_req; - - struct megasas_cmd **cmd_list; - struct list_head cmd_pool; - spinlock_t cmd_pool_lock; - struct dma_pool *frame_dma_pool; - struct dma_pool *sense_dma_pool; - - struct megasas_evt_detail *evt_detail; - dma_addr_t evt_detail_h; - struct megasas_cmd *aen_cmd; - struct semaphore aen_mutex; - struct semaphore ioctl_sem; - - struct Scsi_Host *host; - - wait_queue_head_t int_cmd_wait_q; - wait_queue_head_t abort_cmd_wait_q; - - struct pci_dev *pdev; - u32 unique_id; - - u32 fw_outstanding; - u32 hw_crit_error; - spinlock_t instance_lock; -}; - -#define MEGASAS_IS_LOGICAL(scp) \ - (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 - -#define MEGASAS_DEV_INDEX(inst, scp) \ - ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ - scp->device->id - -struct megasas_cmd { - - union megasas_frame *frame; - dma_addr_t frame_phys_addr; - u8 *sense; - dma_addr_t sense_phys_addr; - - u32 index; - u8 sync_cmd; - u8 cmd_status; - u16 abort_aen; - - struct list_head list; - struct scsi_cmnd *scmd; - struct megasas_instance *instance; - u32 frame_count; -}; - -#define MAX_MGMT_ADAPTERS 1024 -#define MAX_IOCTL_SGE 16 - -struct megasas_iocpacket { - - u16 host_no; - u16 __pad1; - u32 sgl_off; - u32 sge_count; - u32 sense_off; - u32 sense_len; - union { - u8 raw[128]; - struct megasas_header hdr; - } frame; - - struct iovec sgl[MAX_IOCTL_SGE]; - -} __attribute__ ((packed)); - -struct megasas_aen { - u16 host_no; - u16 __pad1; - u32 seq_num; - u32 class_locale_word; -} __attribute__ ((packed)); - -#ifdef CONFIG_COMPAT -struct compat_megasas_iocpacket { - u16 host_no; - u16 __pad1; - u32 sgl_off; - u32 sge_count; - u32 sense_off; - u32 sense_len; - union { - u8 raw[128]; - struct megasas_header hdr; - } frame; - struct compat_iovec sgl[MAX_IOCTL_SGE]; -} __attribute__ ((packed)); - -#define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct compat_megasas_iocpacket) -#else -#define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) -#endif - -#define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) - -struct megasas_mgmt_info { - - u16 count; - struct megasas_instance *instance[MAX_MGMT_ADAPTERS]; - int max_index; -}; - -#endif /*LSI_MEGARAID_SAS_H */ diff --git a/trunk/drivers/scsi/pdc_adma.c b/trunk/drivers/scsi/pdc_adma.c deleted file mode 100644 index c6825da6ae20..000000000000 --- a/trunk/drivers/scsi/pdc_adma.c +++ /dev/null @@ -1,739 +0,0 @@ -/* - * pdc_adma.c - Pacific Digital Corporation ADMA - * - * Maintained by: Mark Lord - * - * Copyright 2005 Mark Lord - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * libata documentation is available via 'make {ps|pdf}docs', - * as Documentation/DocBook/libata.* - * - * - * Supports ATA disks in single-packet ADMA mode. - * Uses PIO for everything else. - * - * TODO: Use ADMA transfers for ATAPI devices, when possible. - * This requires careful attention to a number of quirks of the chip. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "scsi.h" -#include -#include -#include - -#define DRV_NAME "pdc_adma" -#define DRV_VERSION "0.01" - -/* macro to calculate base address for ATA regs */ -#define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40)) - -/* macro to calculate base address for ADMA regs */ -#define ADMA_REGS(base,port_no) ((base) + 0x80 + ((port_no) * 0x20)) - -enum { - ADMA_PORTS = 2, - ADMA_CPB_BYTES = 40, - ADMA_PRD_BYTES = LIBATA_MAX_PRD * 16, - ADMA_PKT_BYTES = ADMA_CPB_BYTES + ADMA_PRD_BYTES, - - ADMA_DMA_BOUNDARY = 0xffffffff, - - /* global register offsets */ - ADMA_MODE_LOCK = 0x00c7, - - /* per-channel register offsets */ - ADMA_CONTROL = 0x0000, /* ADMA control */ - ADMA_STATUS = 0x0002, /* ADMA status */ - ADMA_CPB_COUNT = 0x0004, /* CPB count */ - ADMA_CPB_CURRENT = 0x000c, /* current CPB address */ - ADMA_CPB_NEXT = 0x000c, /* next CPB address */ - ADMA_CPB_LOOKUP = 0x0010, /* CPB lookup table */ - ADMA_FIFO_IN = 0x0014, /* input FIFO threshold */ - ADMA_FIFO_OUT = 0x0016, /* output FIFO threshold */ - - /* ADMA_CONTROL register bits */ - aNIEN = (1 << 8), /* irq mask: 1==masked */ - aGO = (1 << 7), /* packet trigger ("Go!") */ - aRSTADM = (1 << 5), /* ADMA logic reset */ - aRSTA = (1 << 2), /* ATA hard reset */ - aPIOMD4 = 0x0003, /* PIO mode 4 */ - - /* ADMA_STATUS register bits */ - aPSD = (1 << 6), - aUIRQ = (1 << 4), - aPERR = (1 << 0), - - /* CPB bits */ - cDONE = (1 << 0), - cVLD = (1 << 0), - cDAT = (1 << 2), - cIEN = (1 << 3), - - /* PRD bits */ - pORD = (1 << 4), - pDIRO = (1 << 5), - pEND = (1 << 7), - - /* ATA register flags */ - rIGN = (1 << 5), - rEND = (1 << 7), - - /* ATA register addresses */ - ADMA_REGS_CONTROL = 0x0e, - ADMA_REGS_SECTOR_COUNT = 0x12, - ADMA_REGS_LBA_LOW = 0x13, - ADMA_REGS_LBA_MID = 0x14, - ADMA_REGS_LBA_HIGH = 0x15, - ADMA_REGS_DEVICE = 0x16, - ADMA_REGS_COMMAND = 0x17, - - /* PCI device IDs */ - board_1841_idx = 0, /* ADMA 2-port controller */ -}; - -typedef enum { adma_state_idle, adma_state_pkt, adma_state_mmio } adma_state_t; - -struct adma_port_priv { - u8 *pkt; - dma_addr_t pkt_dma; - adma_state_t state; -}; - -static int adma_ata_init_one (struct pci_dev *pdev, - const struct pci_device_id *ent); -static irqreturn_t adma_intr (int irq, void *dev_instance, - struct pt_regs *regs); -static int adma_port_start(struct ata_port *ap); -static void adma_host_stop(struct ata_host_set *host_set); -static void adma_port_stop(struct ata_port *ap); -static void adma_phy_reset(struct ata_port *ap); -static void adma_qc_prep(struct ata_queued_cmd *qc); -static int adma_qc_issue(struct ata_queued_cmd *qc); -static int adma_check_atapi_dma(struct ata_queued_cmd *qc); -static void adma_bmdma_stop(struct ata_queued_cmd *qc); -static u8 adma_bmdma_status(struct ata_port *ap); -static void adma_irq_clear(struct ata_port *ap); -static void adma_eng_timeout(struct ata_port *ap); - -static Scsi_Host_Template adma_ata_sht = { - .module = THIS_MODULE, - .name = DRV_NAME, - .ioctl = ata_scsi_ioctl, - .queuecommand = ata_scsi_queuecmd, - .eh_strategy_handler = ata_scsi_error, - .can_queue = ATA_DEF_QUEUE, - .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = LIBATA_MAX_PRD, - .max_sectors = ATA_MAX_SECTORS, - .cmd_per_lun = ATA_SHT_CMD_PER_LUN, - .emulated = ATA_SHT_EMULATED, - .use_clustering = ENABLE_CLUSTERING, - .proc_name = DRV_NAME, - .dma_boundary = ADMA_DMA_BOUNDARY, - .slave_configure = ata_scsi_slave_config, - .bios_param = ata_std_bios_param, -}; - -static struct ata_port_operations adma_ata_ops = { - .port_disable = ata_port_disable, - .tf_load = ata_tf_load, - .tf_read = ata_tf_read, - .check_status = ata_check_status, - .check_atapi_dma = adma_check_atapi_dma, - .exec_command = ata_exec_command, - .dev_select = ata_std_dev_select, - .phy_reset = adma_phy_reset, - .qc_prep = adma_qc_prep, - .qc_issue = adma_qc_issue, - .eng_timeout = adma_eng_timeout, - .irq_handler = adma_intr, - .irq_clear = adma_irq_clear, - .port_start = adma_port_start, - .port_stop = adma_port_stop, - .host_stop = adma_host_stop, - .bmdma_stop = adma_bmdma_stop, - .bmdma_status = adma_bmdma_status, -}; - -static struct ata_port_info adma_port_info[] = { - /* board_1841_idx */ - { - .sht = &adma_ata_sht, - .host_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | - ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO, - .pio_mask = 0x10, /* pio4 */ - .udma_mask = 0x1f, /* udma0-4 */ - .port_ops = &adma_ata_ops, - }, -}; - -static struct pci_device_id adma_ata_pci_tbl[] = { - { PCI_VENDOR_ID_PDC, 0x1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - board_1841_idx }, - - { } /* terminate list */ -}; - -static struct pci_driver adma_ata_pci_driver = { - .name = DRV_NAME, - .id_table = adma_ata_pci_tbl, - .probe = adma_ata_init_one, - .remove = ata_pci_remove_one, -}; - -static int adma_check_atapi_dma(struct ata_queued_cmd *qc) -{ - return 1; /* ATAPI DMA not yet supported */ -} - -static void adma_bmdma_stop(struct ata_queued_cmd *qc) -{ - /* nothing */ -} - -static u8 adma_bmdma_status(struct ata_port *ap) -{ - return 0; -} - -static void adma_irq_clear(struct ata_port *ap) -{ - /* nothing */ -} - -static void adma_reset_engine(void __iomem *chan) -{ - /* reset ADMA to idle state */ - writew(aPIOMD4 | aNIEN | aRSTADM, chan + ADMA_CONTROL); - udelay(2); - writew(aPIOMD4, chan + ADMA_CONTROL); - udelay(2); -} - -static void adma_reinit_engine(struct ata_port *ap) -{ - struct adma_port_priv *pp = ap->private_data; - void __iomem *mmio_base = ap->host_set->mmio_base; - void __iomem *chan = ADMA_REGS(mmio_base, ap->port_no); - - /* mask/clear ATA interrupts */ - writeb(ATA_NIEN, (void __iomem *)ap->ioaddr.ctl_addr); - ata_check_status(ap); - - /* reset the ADMA engine */ - adma_reset_engine(chan); - - /* set in-FIFO threshold to 0x100 */ - writew(0x100, chan + ADMA_FIFO_IN); - - /* set CPB pointer */ - writel((u32)pp->pkt_dma, chan + ADMA_CPB_NEXT); - - /* set out-FIFO threshold to 0x100 */ - writew(0x100, chan + ADMA_FIFO_OUT); - - /* set CPB count */ - writew(1, chan + ADMA_CPB_COUNT); - - /* read/discard ADMA status */ - readb(chan + ADMA_STATUS); -} - -static inline void adma_enter_reg_mode(struct ata_port *ap) -{ - void __iomem *chan = ADMA_REGS(ap->host_set->mmio_base, ap->port_no); - - writew(aPIOMD4, chan + ADMA_CONTROL); - readb(chan + ADMA_STATUS); /* flush */ -} - -static void adma_phy_reset(struct ata_port *ap) -{ - struct adma_port_priv *pp = ap->private_data; - - pp->state = adma_state_idle; - adma_reinit_engine(ap); - ata_port_probe(ap); - ata_bus_reset(ap); -} - -static void adma_eng_timeout(struct ata_port *ap) -{ - struct adma_port_priv *pp = ap->private_data; - - if (pp->state != adma_state_idle) /* healthy paranoia */ - pp->state = adma_state_mmio; - adma_reinit_engine(ap); - ata_eng_timeout(ap); -} - -static int adma_fill_sg(struct ata_queued_cmd *qc) -{ - struct scatterlist *sg; - struct ata_port *ap = qc->ap; - struct adma_port_priv *pp = ap->private_data; - u8 *buf = pp->pkt; - int i = (2 + buf[3]) * 8; - u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); - - ata_for_each_sg(sg, qc) { - u32 addr; - u32 len; - - addr = (u32)sg_dma_address(sg); - *(__le32 *)(buf + i) = cpu_to_le32(addr); - i += 4; - - len = sg_dma_len(sg) >> 3; - *(__le32 *)(buf + i) = cpu_to_le32(len); - i += 4; - - if (ata_sg_is_last(sg, qc)) - pFLAGS |= pEND; - buf[i++] = pFLAGS; - buf[i++] = qc->dev->dma_mode & 0xf; - buf[i++] = 0; /* pPKLW */ - buf[i++] = 0; /* reserved */ - - *(__le32 *)(buf + i) - = (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4); - i += 4; - - VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", nelem, - (unsigned long)addr, len); - } - return i; -} - -static void adma_qc_prep(struct ata_queued_cmd *qc) -{ - struct adma_port_priv *pp = qc->ap->private_data; - u8 *buf = pp->pkt; - u32 pkt_dma = (u32)pp->pkt_dma; - int i = 0; - - VPRINTK("ENTER\n"); - - adma_enter_reg_mode(qc->ap); - if (qc->tf.protocol != ATA_PROT_DMA) { - ata_qc_prep(qc); - return; - } - - buf[i++] = 0; /* Response flags */ - buf[i++] = 0; /* reserved */ - buf[i++] = cVLD | cDAT | cIEN; - i++; /* cLEN, gets filled in below */ - - *(__le32 *)(buf+i) = cpu_to_le32(pkt_dma); /* cNCPB */ - i += 4; /* cNCPB */ - i += 4; /* cPRD, gets filled in below */ - - buf[i++] = 0; /* reserved */ - buf[i++] = 0; /* reserved */ - buf[i++] = 0; /* reserved */ - buf[i++] = 0; /* reserved */ - - /* ATA registers; must be a multiple of 4 */ - buf[i++] = qc->tf.device; - buf[i++] = ADMA_REGS_DEVICE; - if ((qc->tf.flags & ATA_TFLAG_LBA48)) { - buf[i++] = qc->tf.hob_nsect; - buf[i++] = ADMA_REGS_SECTOR_COUNT; - buf[i++] = qc->tf.hob_lbal; - buf[i++] = ADMA_REGS_LBA_LOW; - buf[i++] = qc->tf.hob_lbam; - buf[i++] = ADMA_REGS_LBA_MID; - buf[i++] = qc->tf.hob_lbah; - buf[i++] = ADMA_REGS_LBA_HIGH; - } - buf[i++] = qc->tf.nsect; - buf[i++] = ADMA_REGS_SECTOR_COUNT; - buf[i++] = qc->tf.lbal; - buf[i++] = ADMA_REGS_LBA_LOW; - buf[i++] = qc->tf.lbam; - buf[i++] = ADMA_REGS_LBA_MID; - buf[i++] = qc->tf.lbah; - buf[i++] = ADMA_REGS_LBA_HIGH; - buf[i++] = 0; - buf[i++] = ADMA_REGS_CONTROL; - buf[i++] = rIGN; - buf[i++] = 0; - buf[i++] = qc->tf.command; - buf[i++] = ADMA_REGS_COMMAND | rEND; - - buf[3] = (i >> 3) - 2; /* cLEN */ - *(__le32 *)(buf+8) = cpu_to_le32(pkt_dma + i); /* cPRD */ - - i = adma_fill_sg(qc); - wmb(); /* flush PRDs and pkt to memory */ -#if 0 - /* dump out CPB + PRDs for debug */ - { - int j, len = 0; - static char obuf[2048]; - for (j = 0; j < i; ++j) { - len += sprintf(obuf+len, "%02x ", buf[j]); - if ((j & 7) == 7) { - printk("%s\n", obuf); - len = 0; - } - } - if (len) - printk("%s\n", obuf); - } -#endif -} - -static inline void adma_packet_start(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - void __iomem *chan = ADMA_REGS(ap->host_set->mmio_base, ap->port_no); - - VPRINTK("ENTER, ap %p\n", ap); - - /* fire up the ADMA engine */ - writew(aPIOMD4 | aGO, chan + ADMA_CONTROL); -} - -static int adma_qc_issue(struct ata_queued_cmd *qc) -{ - struct adma_port_priv *pp = qc->ap->private_data; - - switch (qc->tf.protocol) { - case ATA_PROT_DMA: - pp->state = adma_state_pkt; - adma_packet_start(qc); - return 0; - - case ATA_PROT_ATAPI_DMA: - BUG(); - break; - - default: - break; - } - - pp->state = adma_state_mmio; - return ata_qc_issue_prot(qc); -} - -static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set) -{ - unsigned int handled = 0, port_no; - u8 __iomem *mmio_base = host_set->mmio_base; - - for (port_no = 0; port_no < host_set->n_ports; ++port_no) { - struct ata_port *ap = host_set->ports[port_no]; - struct adma_port_priv *pp; - struct ata_queued_cmd *qc; - void __iomem *chan = ADMA_REGS(mmio_base, port_no); - u8 drv_stat, status = readb(chan + ADMA_STATUS); - - if (status == 0) - continue; - handled = 1; - adma_enter_reg_mode(ap); - if ((ap->flags & ATA_FLAG_PORT_DISABLED)) - continue; - pp = ap->private_data; - if (!pp || pp->state != adma_state_pkt) - continue; - qc = ata_qc_from_tag(ap, ap->active_tag); - drv_stat = 0; - if ((status & (aPERR | aPSD | aUIRQ))) - drv_stat = ATA_ERR; - else if (pp->pkt[0] != cDONE) - drv_stat = ATA_ERR; - ata_qc_complete(qc, drv_stat); - } - return handled; -} - -static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set) -{ - unsigned int handled = 0, port_no; - - for (port_no = 0; port_no < host_set->n_ports; ++port_no) { - struct ata_port *ap; - ap = host_set->ports[port_no]; - if (ap && (!(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR)))) { - struct ata_queued_cmd *qc; - struct adma_port_priv *pp = ap->private_data; - if (!pp || pp->state != adma_state_mmio) - continue; - qc = ata_qc_from_tag(ap, ap->active_tag); - if (qc && (!(qc->tf.ctl & ATA_NIEN))) { - - /* check main status, clearing INTRQ */ - u8 status = ata_chk_status(ap); - if ((status & ATA_BUSY)) - continue; - DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", - ap->id, qc->tf.protocol, status); - - /* complete taskfile transaction */ - pp->state = adma_state_idle; - ata_qc_complete(qc, status); - handled = 1; - } - } - } - return handled; -} - -static irqreturn_t adma_intr(int irq, void *dev_instance, struct pt_regs *regs) -{ - struct ata_host_set *host_set = dev_instance; - unsigned int handled = 0; - - VPRINTK("ENTER\n"); - - spin_lock(&host_set->lock); - handled = adma_intr_pkt(host_set) | adma_intr_mmio(host_set); - spin_unlock(&host_set->lock); - - VPRINTK("EXIT\n"); - - return IRQ_RETVAL(handled); -} - -static void adma_ata_setup_port(struct ata_ioports *port, unsigned long base) -{ - port->cmd_addr = - port->data_addr = base + 0x000; - port->error_addr = - port->feature_addr = base + 0x004; - port->nsect_addr = base + 0x008; - port->lbal_addr = base + 0x00c; - port->lbam_addr = base + 0x010; - port->lbah_addr = base + 0x014; - port->device_addr = base + 0x018; - port->status_addr = - port->command_addr = base + 0x01c; - port->altstatus_addr = - port->ctl_addr = base + 0x038; -} - -static int adma_port_start(struct ata_port *ap) -{ - struct device *dev = ap->host_set->dev; - struct adma_port_priv *pp; - int rc; - - rc = ata_port_start(ap); - if (rc) - return rc; - adma_enter_reg_mode(ap); - rc = -ENOMEM; - pp = kcalloc(1, sizeof(*pp), GFP_KERNEL); - if (!pp) - goto err_out; - pp->pkt = dma_alloc_coherent(dev, ADMA_PKT_BYTES, &pp->pkt_dma, - GFP_KERNEL); - if (!pp->pkt) - goto err_out_kfree; - /* paranoia? */ - if ((pp->pkt_dma & 7) != 0) { - printk("bad alignment for pp->pkt_dma: %08x\n", - (u32)pp->pkt_dma); - goto err_out_kfree2; - } - memset(pp->pkt, 0, ADMA_PKT_BYTES); - ap->private_data = pp; - adma_reinit_engine(ap); - return 0; - -err_out_kfree2: - kfree(pp); -err_out_kfree: - kfree(pp); -err_out: - ata_port_stop(ap); - return rc; -} - -static void adma_port_stop(struct ata_port *ap) -{ - struct device *dev = ap->host_set->dev; - struct adma_port_priv *pp = ap->private_data; - - adma_reset_engine(ADMA_REGS(ap->host_set->mmio_base, ap->port_no)); - if (pp != NULL) { - ap->private_data = NULL; - if (pp->pkt != NULL) - dma_free_coherent(dev, ADMA_PKT_BYTES, - pp->pkt, pp->pkt_dma); - kfree(pp); - } - ata_port_stop(ap); -} - -static void adma_host_stop(struct ata_host_set *host_set) -{ - unsigned int port_no; - - for (port_no = 0; port_no < ADMA_PORTS; ++port_no) - adma_reset_engine(ADMA_REGS(host_set->mmio_base, port_no)); - - ata_pci_host_stop(host_set); -} - -static void adma_host_init(unsigned int chip_id, - struct ata_probe_ent *probe_ent) -{ - unsigned int port_no; - void __iomem *mmio_base = probe_ent->mmio_base; - - /* enable/lock aGO operation */ - writeb(7, mmio_base + ADMA_MODE_LOCK); - - /* reset the ADMA logic */ - for (port_no = 0; port_no < ADMA_PORTS; ++port_no) - adma_reset_engine(ADMA_REGS(mmio_base, port_no)); -} - -static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) -{ - int rc; - - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); - if (rc) { - printk(KERN_ERR DRV_NAME - "(%s): 32-bit DMA enable failed\n", - pci_name(pdev)); - return rc; - } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); - if (rc) { - printk(KERN_ERR DRV_NAME - "(%s): 32-bit consistent DMA enable failed\n", - pci_name(pdev)); - return rc; - } - return 0; -} - -static int adma_ata_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - static int printed_version; - struct ata_probe_ent *probe_ent = NULL; - void __iomem *mmio_base; - unsigned int board_idx = (unsigned int) ent->driver_data; - int rc, port_no; - - if (!printed_version++) - printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); - - rc = pci_enable_device(pdev); - if (rc) - return rc; - - rc = pci_request_regions(pdev, DRV_NAME); - if (rc) - goto err_out; - - if ((pci_resource_flags(pdev, 4) & IORESOURCE_MEM) == 0) { - rc = -ENODEV; - goto err_out_regions; - } - - mmio_base = pci_iomap(pdev, 4, 0); - if (mmio_base == NULL) { - rc = -ENOMEM; - goto err_out_regions; - } - - rc = adma_set_dma_masks(pdev, mmio_base); - if (rc) - goto err_out_iounmap; - - probe_ent = kcalloc(1, sizeof(*probe_ent), GFP_KERNEL); - if (probe_ent == NULL) { - rc = -ENOMEM; - goto err_out_iounmap; - } - - probe_ent->dev = pci_dev_to_dev(pdev); - INIT_LIST_HEAD(&probe_ent->node); - - probe_ent->sht = adma_port_info[board_idx].sht; - probe_ent->host_flags = adma_port_info[board_idx].host_flags; - probe_ent->pio_mask = adma_port_info[board_idx].pio_mask; - probe_ent->mwdma_mask = adma_port_info[board_idx].mwdma_mask; - probe_ent->udma_mask = adma_port_info[board_idx].udma_mask; - probe_ent->port_ops = adma_port_info[board_idx].port_ops; - - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; - probe_ent->mmio_base = mmio_base; - probe_ent->n_ports = ADMA_PORTS; - - for (port_no = 0; port_no < probe_ent->n_ports; ++port_no) { - adma_ata_setup_port(&probe_ent->port[port_no], - ADMA_ATA_REGS((unsigned long)mmio_base, port_no)); - } - - pci_set_master(pdev); - - /* initialize adapter */ - adma_host_init(board_idx, probe_ent); - - rc = ata_device_add(probe_ent); - kfree(probe_ent); - if (rc != ADMA_PORTS) - goto err_out_iounmap; - return 0; - -err_out_iounmap: - pci_iounmap(pdev, mmio_base); -err_out_regions: - pci_release_regions(pdev); -err_out: - pci_disable_device(pdev); - return rc; -} - -static int __init adma_ata_init(void) -{ - return pci_module_init(&adma_ata_pci_driver); -} - -static void __exit adma_ata_exit(void) -{ - pci_unregister_driver(&adma_ata_pci_driver); -} - -MODULE_AUTHOR("Mark Lord"); -MODULE_DESCRIPTION("Pacific Digital Corporation ADMA low-level driver"); -MODULE_LICENSE("GPL"); -MODULE_DEVICE_TABLE(pci, adma_ata_pci_tbl); -MODULE_VERSION(DRV_VERSION); - -module_init(adma_ata_init); -module_exit(adma_ata_exit); diff --git a/trunk/drivers/scsi/qla2xxx/qla_rscn.c b/trunk/drivers/scsi/qla2xxx/qla_rscn.c index 1eba98828636..bdc3bc74bbe1 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_rscn.c +++ b/trunk/drivers/scsi/qla2xxx/qla_rscn.c @@ -330,8 +330,6 @@ qla2x00_update_login_fcport(scsi_qla_host_t *ha, struct mbx_entry *mbxstat, fcport->flags &= ~FCF_FAILOVER_NEEDED; fcport->iodesc_idx_sent = IODESC_INVALID_INDEX; atomic_set(&fcport->state, FCS_ONLINE); - if (fcport->rport) - fc_remote_port_unblock(fcport->rport); } diff --git a/trunk/drivers/scsi/qlogicpti.c b/trunk/drivers/scsi/qlogicpti.c index 1fd5fc6d0fe3..a917ab7475ac 100644 --- a/trunk/drivers/scsi/qlogicpti.c +++ b/trunk/drivers/scsi/qlogicpti.c @@ -1119,36 +1119,6 @@ static inline void update_can_queue(struct Scsi_Host *host, u_int in_ptr, u_int host->sg_tablesize = QLOGICPTI_MAX_SG(num_free); } -static unsigned int scsi_rbuf_get(struct scsi_cmnd *cmd, unsigned char **buf_out) -{ - unsigned char *buf; - unsigned int buflen; - - if (cmd->use_sg) { - struct scatterlist *sg; - - sg = (struct scatterlist *) cmd->request_buffer; - buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; - buflen = sg->length; - } else { - buf = cmd->request_buffer; - buflen = cmd->request_bufflen; - } - - *buf_out = buf; - return buflen; -} - -static void scsi_rbuf_put(struct scsi_cmnd *cmd, unsigned char *buf) -{ - if (cmd->use_sg) { - struct scatterlist *sg; - - sg = (struct scatterlist *) cmd->request_buffer; - kunmap_atomic(buf - sg->offset, KM_IRQ0); - } -} - /* * Until we scan the entire bus with inquiries, go throught this fella... */ @@ -1175,9 +1145,11 @@ static void ourdone(struct scsi_cmnd *Cmnd) int ok = host_byte(Cmnd->result) == DID_OK; if (Cmnd->cmnd[0] == 0x12 && ok) { unsigned char *iqd; - unsigned int iqd_len; - iqd_len = scsi_rbuf_get(Cmnd, &iqd); + if (Cmnd->use_sg != 0) + BUG(); + + iqd = ((unsigned char *)Cmnd->buffer); /* tags handled in midlayer */ /* enable sync mode? */ @@ -1191,9 +1163,6 @@ static void ourdone(struct scsi_cmnd *Cmnd) if (iqd[7] & 0x20) { qpti->dev_param[tgt].device_flags |= 0x20; } - - scsi_rbuf_put(Cmnd, iqd); - qpti->sbits |= (1 << tgt); } else if (!ok) { qpti->sbits |= (1 << tgt); diff --git a/trunk/drivers/scsi/sata_mv.c b/trunk/drivers/scsi/sata_mv.c index be7c378dcd36..ea76fe44585e 100644 --- a/trunk/drivers/scsi/sata_mv.c +++ b/trunk/drivers/scsi/sata_mv.c @@ -35,7 +35,7 @@ #include #define DRV_NAME "sata_mv" -#define DRV_VERSION "0.24" +#define DRV_VERSION "0.12" enum { /* BAR's are enumerated in terms of pci_resource_start() terms */ @@ -55,61 +55,31 @@ enum { MV_SATAHC_ARBTR_REG_SZ = MV_MINOR_REG_AREA_SZ, /* arbiter */ MV_PORT_REG_SZ = MV_MINOR_REG_AREA_SZ, - MV_USE_Q_DEPTH = ATA_DEF_QUEUE, + MV_Q_CT = 32, + MV_CRQB_SZ = 32, + MV_CRPB_SZ = 8, - MV_MAX_Q_DEPTH = 32, - MV_MAX_Q_DEPTH_MASK = MV_MAX_Q_DEPTH - 1, - - /* CRQB needs alignment on a 1KB boundary. Size == 1KB - * CRPB needs alignment on a 256B boundary. Size == 256B - * SG count of 176 leads to MV_PORT_PRIV_DMA_SZ == 4KB - * ePRD (SG) entries need alignment on a 16B boundary. Size == 16B - */ - MV_CRQB_Q_SZ = (32 * MV_MAX_Q_DEPTH), - MV_CRPB_Q_SZ = (8 * MV_MAX_Q_DEPTH), - MV_MAX_SG_CT = 176, - MV_SG_TBL_SZ = (16 * MV_MAX_SG_CT), - MV_PORT_PRIV_DMA_SZ = (MV_CRQB_Q_SZ + MV_CRPB_Q_SZ + MV_SG_TBL_SZ), - - /* Our DMA boundary is determined by an ePRD being unable to handle - * anything larger than 64KB - */ - MV_DMA_BOUNDARY = 0xffffU, + MV_DMA_BOUNDARY = 0xffffffffU, + SATAHC_MASK = (~(MV_SATAHC_REG_SZ - 1)), MV_PORTS_PER_HC = 4, /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */ MV_PORT_HC_SHIFT = 2, - /* == (port % MV_PORTS_PER_HC) to determine hard port from 0-7 port */ + /* == (port % MV_PORTS_PER_HC) to determine port from 0-7 port */ MV_PORT_MASK = 3, /* Host Flags */ MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ - MV_FLAG_GLBL_SFT_RST = (1 << 28), /* Global Soft Reset support */ - MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), - MV_6XXX_FLAGS = (MV_FLAG_IRQ_COALESCE | - MV_FLAG_GLBL_SFT_RST), + MV_FLAG_BDMA = (1 << 28), /* Basic DMA */ chip_504x = 0, chip_508x = 1, chip_604x = 2, chip_608x = 3, - CRQB_FLAG_READ = (1 << 0), - CRQB_TAG_SHIFT = 1, - CRQB_CMD_ADDR_SHIFT = 8, - CRQB_CMD_CS = (0x2 << 11), - CRQB_CMD_LAST = (1 << 15), - - CRPB_FLAG_STATUS_SHIFT = 8, - - EPRD_FLAG_END_OF_TBL = (1 << 31), - /* PCI interface registers */ - PCI_COMMAND_OFS = 0xc00, - PCI_MAIN_CMD_STS_OFS = 0xd30, STOP_PCI_MASTER = (1 << 2), PCI_MASTER_EMPTY = (1 << 3), @@ -141,13 +111,20 @@ enum { HC_CFG_OFS = 0, HC_IRQ_CAUSE_OFS = 0x14, - CRPB_DMA_DONE = (1 << 0), /* shift by port # */ + CRBP_DMA_DONE = (1 << 0), /* shift by port # */ HC_IRQ_COAL = (1 << 4), /* IRQ coalescing */ DEV_IRQ = (1 << 8), /* shift by port # */ /* Shadow block registers */ - SHD_BLK_OFS = 0x100, - SHD_CTL_AST_OFS = 0x20, /* ofs from SHD_BLK_OFS */ + SHD_PIO_DATA_OFS = 0x100, + SHD_FEA_ERR_OFS = 0x104, + SHD_SECT_CNT_OFS = 0x108, + SHD_LBA_L_OFS = 0x10C, + SHD_LBA_M_OFS = 0x110, + SHD_LBA_H_OFS = 0x114, + SHD_DEV_HD_OFS = 0x118, + SHD_CMD_STA_OFS = 0x11C, + SHD_CTL_AST_OFS = 0x120, /* SATA registers */ SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ @@ -155,11 +132,6 @@ enum { /* Port registers */ EDMA_CFG_OFS = 0, - EDMA_CFG_Q_DEPTH = 0, /* queueing disabled */ - EDMA_CFG_NCQ = (1 << 5), - EDMA_CFG_NCQ_GO_ON_ERR = (1 << 14), /* continue on error */ - EDMA_CFG_RD_BRST_EXT = (1 << 11), /* read burst 512B */ - EDMA_CFG_WR_BUFF_LEN = (1 << 13), /* write buffer 512B */ EDMA_ERR_IRQ_CAUSE_OFS = 0x8, EDMA_ERR_IRQ_MASK_OFS = 0xc, @@ -189,85 +161,33 @@ enum { EDMA_ERR_LNK_DATA_TX | EDMA_ERR_TRANS_PROTO), - EDMA_REQ_Q_BASE_HI_OFS = 0x10, - EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */ - EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U, - - EDMA_REQ_Q_OUT_PTR_OFS = 0x18, - EDMA_REQ_Q_PTR_SHIFT = 5, - - EDMA_RSP_Q_BASE_HI_OFS = 0x1c, - EDMA_RSP_Q_IN_PTR_OFS = 0x20, - EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */ - EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U, - EDMA_RSP_Q_PTR_SHIFT = 3, - EDMA_CMD_OFS = 0x28, EDMA_EN = (1 << 0), EDMA_DS = (1 << 1), ATA_RST = (1 << 2), - /* Host private flags (hp_flags) */ - MV_HP_FLAG_MSI = (1 << 0), - - /* Port private flags (pp_flags) */ - MV_PP_FLAG_EDMA_EN = (1 << 0), - MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), -}; - -/* Command ReQuest Block: 32B */ -struct mv_crqb { - u32 sg_addr; - u32 sg_addr_hi; - u16 ctrl_flags; - u16 ata_cmd[11]; -}; - -/* Command ResPonse Block: 8B */ -struct mv_crpb { - u16 id; - u16 flags; - u32 tmstmp; -}; + /* BDMA is 6xxx part only */ + BDMA_CMD_OFS = 0x224, + BDMA_START = (1 << 0), -/* EDMA Physical Region Descriptor (ePRD); A.K.A. SG */ -struct mv_sg { - u32 addr; - u32 flags_size; - u32 addr_hi; - u32 reserved; + MV_UNDEF = 0, }; struct mv_port_priv { - struct mv_crqb *crqb; - dma_addr_t crqb_dma; - struct mv_crpb *crpb; - dma_addr_t crpb_dma; - struct mv_sg *sg_tbl; - dma_addr_t sg_tbl_dma; - - unsigned req_producer; /* cp of req_in_ptr */ - unsigned rsp_consumer; /* cp of rsp_out_ptr */ - u32 pp_flags; + }; struct mv_host_priv { - u32 hp_flags; + }; static void mv_irq_clear(struct ata_port *ap); static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); -static u8 mv_check_err(struct ata_port *ap); static void mv_phy_reset(struct ata_port *ap); -static void mv_host_stop(struct ata_host_set *host_set); -static int mv_port_start(struct ata_port *ap); -static void mv_port_stop(struct ata_port *ap); -static void mv_qc_prep(struct ata_queued_cmd *qc); -static int mv_qc_issue(struct ata_queued_cmd *qc); +static int mv_master_reset(void __iomem *mmio_base); static irqreturn_t mv_interrupt(int irq, void *dev_instance, struct pt_regs *regs); -static void mv_eng_timeout(struct ata_port *ap); static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); static Scsi_Host_Template mv_sht = { @@ -276,13 +196,13 @@ static Scsi_Host_Template mv_sht = { .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, - .can_queue = MV_USE_Q_DEPTH, + .can_queue = ATA_DEF_QUEUE, .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = MV_MAX_SG_CT, + .sg_tablesize = MV_UNDEF, .max_sectors = ATA_MAX_SECTORS, .cmd_per_lun = ATA_SHT_CMD_PER_LUN, .emulated = ATA_SHT_EMULATED, - .use_clustering = ATA_SHT_USE_CLUSTERING, + .use_clustering = MV_UNDEF, .proc_name = DRV_NAME, .dma_boundary = MV_DMA_BOUNDARY, .slave_configure = ata_scsi_slave_config, @@ -296,16 +216,15 @@ static struct ata_port_operations mv_ops = { .tf_load = ata_tf_load, .tf_read = ata_tf_read, .check_status = ata_check_status, - .check_err = mv_check_err, .exec_command = ata_exec_command, .dev_select = ata_std_dev_select, .phy_reset = mv_phy_reset, - .qc_prep = mv_qc_prep, - .qc_issue = mv_qc_issue, + .qc_prep = ata_qc_prep, + .qc_issue = ata_qc_issue_prot, - .eng_timeout = mv_eng_timeout, + .eng_timeout = ata_eng_timeout, .irq_handler = mv_interrupt, .irq_clear = mv_irq_clear, @@ -313,39 +232,46 @@ static struct ata_port_operations mv_ops = { .scr_read = mv_scr_read, .scr_write = mv_scr_write, - .port_start = mv_port_start, - .port_stop = mv_port_stop, - .host_stop = mv_host_stop, + .port_start = ata_port_start, + .port_stop = ata_port_stop, + .host_stop = ata_host_stop, }; static struct ata_port_info mv_port_info[] = { { /* chip_504x */ .sht = &mv_sht, - .host_flags = MV_COMMON_FLAGS, - .pio_mask = 0x1f, /* pio0-4 */ - .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ + .host_flags = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | + ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), + .pio_mask = 0x1f, /* pio4-0 */ + .udma_mask = 0, /* 0x7f (udma6-0 disabled for now) */ .port_ops = &mv_ops, }, { /* chip_508x */ .sht = &mv_sht, - .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), - .pio_mask = 0x1f, /* pio0-4 */ - .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ + .host_flags = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | + ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | + MV_FLAG_DUAL_HC), + .pio_mask = 0x1f, /* pio4-0 */ + .udma_mask = 0, /* 0x7f (udma6-0 disabled for now) */ .port_ops = &mv_ops, }, { /* chip_604x */ .sht = &mv_sht, - .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), - .pio_mask = 0x1f, /* pio0-4 */ - .udma_mask = 0x7f, /* udma0-6 */ + .host_flags = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | + ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | + MV_FLAG_IRQ_COALESCE | MV_FLAG_BDMA), + .pio_mask = 0x1f, /* pio4-0 */ + .udma_mask = 0, /* 0x7f (udma6-0 disabled for now) */ .port_ops = &mv_ops, }, { /* chip_608x */ .sht = &mv_sht, - .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | - MV_FLAG_DUAL_HC), - .pio_mask = 0x1f, /* pio0-4 */ - .udma_mask = 0x7f, /* udma0-6 */ + .host_flags = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | + ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | + MV_FLAG_IRQ_COALESCE | MV_FLAG_DUAL_HC | + MV_FLAG_BDMA), + .pio_mask = 0x1f, /* pio4-0 */ + .udma_mask = 0, /* 0x7f (udma6-0 disabled for now) */ .port_ops = &mv_ops, }, }; @@ -380,6 +306,12 @@ static inline void writelfl(unsigned long data, void __iomem *addr) (void) readl(addr); /* flush to avoid PCI posted write */ } +static inline void __iomem *mv_port_addr_to_hc_base(void __iomem *port_mmio) +{ + return ((void __iomem *)((unsigned long)port_mmio & + (unsigned long)SATAHC_MASK)); +} + static inline void __iomem *mv_hc_base(void __iomem *base, unsigned int hc) { return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ)); @@ -397,150 +329,24 @@ static inline void __iomem *mv_ap_base(struct ata_port *ap) return mv_port_base(ap->host_set->mmio_base, ap->port_no); } -static inline int mv_get_hc_count(unsigned long hp_flags) +static inline int mv_get_hc_count(unsigned long flags) { - return ((hp_flags & MV_FLAG_DUAL_HC) ? 2 : 1); + return ((flags & MV_FLAG_DUAL_HC) ? 2 : 1); } -static void mv_irq_clear(struct ata_port *ap) -{ -} - -/** - * mv_start_dma - Enable eDMA engine - * @base: port base address - * @pp: port private data - * - * Verify the local cache of the eDMA state is accurate with an - * assert. - * - * LOCKING: - * Inherited from caller. - */ -static void mv_start_dma(void __iomem *base, struct mv_port_priv *pp) -{ - if (!(MV_PP_FLAG_EDMA_EN & pp->pp_flags)) { - writelfl(EDMA_EN, base + EDMA_CMD_OFS); - pp->pp_flags |= MV_PP_FLAG_EDMA_EN; - } - assert(EDMA_EN & readl(base + EDMA_CMD_OFS)); -} - -/** - * mv_stop_dma - Disable eDMA engine - * @ap: ATA channel to manipulate - * - * Verify the local cache of the eDMA state is accurate with an - * assert. - * - * LOCKING: - * Inherited from caller. - */ -static void mv_stop_dma(struct ata_port *ap) +static inline int mv_is_edma_active(struct ata_port *ap) { void __iomem *port_mmio = mv_ap_base(ap); - struct mv_port_priv *pp = ap->private_data; - u32 reg; - int i; - - if (MV_PP_FLAG_EDMA_EN & pp->pp_flags) { - /* Disable EDMA if active. The disable bit auto clears. - */ - writelfl(EDMA_DS, port_mmio + EDMA_CMD_OFS); - pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; - } else { - assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS))); - } - - /* now properly wait for the eDMA to stop */ - for (i = 1000; i > 0; i--) { - reg = readl(port_mmio + EDMA_CMD_OFS); - if (!(EDMA_EN & reg)) { - break; - } - udelay(100); - } - - if (EDMA_EN & reg) { - printk(KERN_ERR "ata%u: Unable to stop eDMA\n", ap->id); - /* FIXME: Consider doing a reset here to recover */ - } + return (EDMA_EN & readl(port_mmio + EDMA_CMD_OFS)); } -#ifdef ATA_DEBUG -static void mv_dump_mem(void __iomem *start, unsigned bytes) +static inline int mv_port_bdma_capable(struct ata_port *ap) { - int b, w; - for (b = 0; b < bytes; ) { - DPRINTK("%p: ", start + b); - for (w = 0; b < bytes && w < 4; w++) { - printk("%08x ",readl(start + b)); - b += sizeof(u32); - } - printk("\n"); - } + return (ap->flags & MV_FLAG_BDMA); } -#endif -static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes) -{ -#ifdef ATA_DEBUG - int b, w; - u32 dw; - for (b = 0; b < bytes; ) { - DPRINTK("%02x: ", b); - for (w = 0; b < bytes && w < 4; w++) { - (void) pci_read_config_dword(pdev,b,&dw); - printk("%08x ",dw); - b += sizeof(u32); - } - printk("\n"); - } -#endif -} -static void mv_dump_all_regs(void __iomem *mmio_base, int port, - struct pci_dev *pdev) +static void mv_irq_clear(struct ata_port *ap) { -#ifdef ATA_DEBUG - void __iomem *hc_base = mv_hc_base(mmio_base, - port >> MV_PORT_HC_SHIFT); - void __iomem *port_base; - int start_port, num_ports, p, start_hc, num_hcs, hc; - - if (0 > port) { - start_hc = start_port = 0; - num_ports = 8; /* shld be benign for 4 port devs */ - num_hcs = 2; - } else { - start_hc = port >> MV_PORT_HC_SHIFT; - start_port = port; - num_ports = num_hcs = 1; - } - DPRINTK("All registers for port(s) %u-%u:\n", start_port, - num_ports > 1 ? num_ports - 1 : start_port); - - if (NULL != pdev) { - DPRINTK("PCI config space regs:\n"); - mv_dump_pci_cfg(pdev, 0x68); - } - DPRINTK("PCI regs:\n"); - mv_dump_mem(mmio_base+0xc00, 0x3c); - mv_dump_mem(mmio_base+0xd00, 0x34); - mv_dump_mem(mmio_base+0xf00, 0x4); - mv_dump_mem(mmio_base+0x1d00, 0x6c); - for (hc = start_hc; hc < start_hc + num_hcs; hc++) { - hc_base = mv_hc_base(mmio_base, port >> MV_PORT_HC_SHIFT); - DPRINTK("HC regs (HC %i):\n", hc); - mv_dump_mem(hc_base, 0x1c); - } - for (p = start_port; p < start_port + num_ports; p++) { - port_base = mv_port_base(mmio_base, p); - DPRINTK("EDMA regs (port %i):\n",p); - mv_dump_mem(port_base, 0x54); - DPRINTK("SATA regs (port %i):\n",p); - mv_dump_mem(port_base+0x300, 0x60); - } -#endif } static unsigned int mv_scr_offset(unsigned int sc_reg_in) @@ -583,37 +389,30 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) } } -/** - * mv_global_soft_reset - Perform the 6xxx global soft reset - * @mmio_base: base address of the HBA - * - * This routine only applies to 6xxx parts. - * - * LOCKING: - * Inherited from caller. - */ -static int mv_global_soft_reset(void __iomem *mmio_base) +static int mv_master_reset(void __iomem *mmio_base) { void __iomem *reg = mmio_base + PCI_MAIN_CMD_STS_OFS; int i, rc = 0; u32 t; + VPRINTK("ENTER\n"); + /* Following procedure defined in PCI "main command and status * register" table. */ t = readl(reg); writel(t | STOP_PCI_MASTER, reg); - for (i = 0; i < 1000; i++) { - udelay(1); + for (i = 0; i < 100; i++) { + msleep(10); t = readl(reg); if (PCI_MASTER_EMPTY & t) { break; } } if (!(PCI_MASTER_EMPTY & t)) { - printk(KERN_ERR DRV_NAME ": PCI master won't flush\n"); - rc = 1; + printk(KERN_ERR DRV_NAME "PCI master won't flush\n"); + rc = 1; /* broken HW? */ goto done; } @@ -626,413 +425,48 @@ static int mv_global_soft_reset(void __iomem *mmio_base) } while (!(GLOB_SFT_RST & t) && (i-- > 0)); if (!(GLOB_SFT_RST & t)) { - printk(KERN_ERR DRV_NAME ": can't set global reset\n"); - rc = 1; + printk(KERN_ERR DRV_NAME "can't set global reset\n"); + rc = 1; /* broken HW? */ goto done; } - /* clear reset and *reenable the PCI master* (not mentioned in spec) */ + /* clear reset */ i = 5; do { - writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg); + writel(t & ~GLOB_SFT_RST, reg); t = readl(reg); udelay(1); } while ((GLOB_SFT_RST & t) && (i-- > 0)); if (GLOB_SFT_RST & t) { - printk(KERN_ERR DRV_NAME ": can't clear global reset\n"); - rc = 1; - } -done: - return rc; -} - -/** - * mv_host_stop - Host specific cleanup/stop routine. - * @host_set: host data structure - * - * Disable ints, cleanup host memory, call general purpose - * host_stop. - * - * LOCKING: - * Inherited from caller. - */ -static void mv_host_stop(struct ata_host_set *host_set) -{ - struct mv_host_priv *hpriv = host_set->private_data; - struct pci_dev *pdev = to_pci_dev(host_set->dev); - - if (hpriv->hp_flags & MV_HP_FLAG_MSI) { - pci_disable_msi(pdev); - } else { - pci_intx(pdev, 0); - } - kfree(hpriv); - ata_host_stop(host_set); -} - -/** - * mv_port_start - Port specific init/start routine. - * @ap: ATA channel to manipulate - * - * Allocate and point to DMA memory, init port private memory, - * zero indices. - * - * LOCKING: - * Inherited from caller. - */ -static int mv_port_start(struct ata_port *ap) -{ - struct device *dev = ap->host_set->dev; - struct mv_port_priv *pp; - void __iomem *port_mmio = mv_ap_base(ap); - void *mem; - dma_addr_t mem_dma; - - pp = kmalloc(sizeof(*pp), GFP_KERNEL); - if (!pp) { - return -ENOMEM; - } - memset(pp, 0, sizeof(*pp)); - - mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, - GFP_KERNEL); - if (!mem) { - kfree(pp); - return -ENOMEM; - } - memset(mem, 0, MV_PORT_PRIV_DMA_SZ); - - /* First item in chunk of DMA memory: - * 32-slot command request table (CRQB), 32 bytes each in size - */ - pp->crqb = mem; - pp->crqb_dma = mem_dma; - mem += MV_CRQB_Q_SZ; - mem_dma += MV_CRQB_Q_SZ; - - /* Second item: - * 32-slot command response table (CRPB), 8 bytes each in size - */ - pp->crpb = mem; - pp->crpb_dma = mem_dma; - mem += MV_CRPB_Q_SZ; - mem_dma += MV_CRPB_Q_SZ; - - /* Third item: - * Table of scatter-gather descriptors (ePRD), 16 bytes each - */ - pp->sg_tbl = mem; - pp->sg_tbl_dma = mem_dma; - - writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | - EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS); - - writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); - writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, - port_mmio + EDMA_REQ_Q_IN_PTR_OFS); - - writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); - writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); - - writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); - writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, - port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); - - pp->req_producer = pp->rsp_consumer = 0; - - /* Don't turn on EDMA here...do it before DMA commands only. Else - * we'll be unable to send non-data, PIO, etc due to restricted access - * to shadow regs. - */ - ap->private_data = pp; - return 0; -} - -/** - * mv_port_stop - Port specific cleanup/stop routine. - * @ap: ATA channel to manipulate - * - * Stop DMA, cleanup port memory. - * - * LOCKING: - * This routine uses the host_set lock to protect the DMA stop. - */ -static void mv_port_stop(struct ata_port *ap) -{ - struct device *dev = ap->host_set->dev; - struct mv_port_priv *pp = ap->private_data; - unsigned long flags; - - spin_lock_irqsave(&ap->host_set->lock, flags); - mv_stop_dma(ap); - spin_unlock_irqrestore(&ap->host_set->lock, flags); - - ap->private_data = NULL; - dma_free_coherent(dev, MV_PORT_PRIV_DMA_SZ, pp->crpb, pp->crpb_dma); - kfree(pp); -} - -/** - * mv_fill_sg - Fill out the Marvell ePRD (scatter gather) entries - * @qc: queued command whose SG list to source from - * - * Populate the SG list and mark the last entry. - * - * LOCKING: - * Inherited from caller. - */ -static void mv_fill_sg(struct ata_queued_cmd *qc) -{ - struct mv_port_priv *pp = qc->ap->private_data; - unsigned int i = 0; - struct scatterlist *sg; - - ata_for_each_sg(sg, qc) { - u32 sg_len; - dma_addr_t addr; - - addr = sg_dma_address(sg); - sg_len = sg_dma_len(sg); - - pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); - pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); - assert(0 == (sg_len & ~MV_DMA_BOUNDARY)); - pp->sg_tbl[i].flags_size = cpu_to_le32(sg_len); - if (ata_sg_is_last(sg, qc)) - pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); - - i++; - } -} - -static inline unsigned mv_inc_q_index(unsigned *index) -{ - *index = (*index + 1) & MV_MAX_Q_DEPTH_MASK; - return *index; -} - -static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last) -{ - *cmdw = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | - (last ? CRQB_CMD_LAST : 0); -} - -/** - * mv_qc_prep - Host specific command preparation. - * @qc: queued command to prepare - * - * This routine simply redirects to the general purpose routine - * if command is not DMA. Else, it handles prep of the CRQB - * (command request block), does some sanity checking, and calls - * the SG load routine. - * - * LOCKING: - * Inherited from caller. - */ -static void mv_qc_prep(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - struct mv_port_priv *pp = ap->private_data; - u16 *cw; - struct ata_taskfile *tf; - u16 flags = 0; - - if (ATA_PROT_DMA != qc->tf.protocol) { - return; + printk(KERN_ERR DRV_NAME "can't clear global reset\n"); + rc = 1; /* broken HW? */ } - /* the req producer index should be the same as we remember it */ - assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> - EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == - pp->req_producer); - - /* Fill in command request block - */ - if (!(qc->tf.flags & ATA_TFLAG_WRITE)) { - flags |= CRQB_FLAG_READ; - } - assert(MV_MAX_Q_DEPTH > qc->tag); - flags |= qc->tag << CRQB_TAG_SHIFT; - - pp->crqb[pp->req_producer].sg_addr = - cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); - pp->crqb[pp->req_producer].sg_addr_hi = - cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); - pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); - - cw = &pp->crqb[pp->req_producer].ata_cmd[0]; - tf = &qc->tf; - - /* Sadly, the CRQB cannot accomodate all registers--there are - * only 11 bytes...so we must pick and choose required - * registers based on the command. So, we drop feature and - * hob_feature for [RW] DMA commands, but they are needed for - * NCQ. NCQ will drop hob_nsect. - */ - switch (tf->command) { - case ATA_CMD_READ: - case ATA_CMD_READ_EXT: - case ATA_CMD_WRITE: - case ATA_CMD_WRITE_EXT: - mv_crqb_pack_cmd(cw++, tf->hob_nsect, ATA_REG_NSECT, 0); - break; -#ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ - case ATA_CMD_FPDMA_READ: - case ATA_CMD_FPDMA_WRITE: - mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0); - mv_crqb_pack_cmd(cw++, tf->feature, ATA_REG_FEATURE, 0); - break; -#endif /* FIXME: remove this line when NCQ added */ - default: - /* The only other commands EDMA supports in non-queued and - * non-NCQ mode are: [RW] STREAM DMA and W DMA FUA EXT, none - * of which are defined/used by Linux. If we get here, this - * driver needs work. - * - * FIXME: modify libata to give qc_prep a return value and - * return error here. - */ - BUG_ON(tf->command); - break; - } - mv_crqb_pack_cmd(cw++, tf->nsect, ATA_REG_NSECT, 0); - mv_crqb_pack_cmd(cw++, tf->hob_lbal, ATA_REG_LBAL, 0); - mv_crqb_pack_cmd(cw++, tf->lbal, ATA_REG_LBAL, 0); - mv_crqb_pack_cmd(cw++, tf->hob_lbam, ATA_REG_LBAM, 0); - mv_crqb_pack_cmd(cw++, tf->lbam, ATA_REG_LBAM, 0); - mv_crqb_pack_cmd(cw++, tf->hob_lbah, ATA_REG_LBAH, 0); - mv_crqb_pack_cmd(cw++, tf->lbah, ATA_REG_LBAH, 0); - mv_crqb_pack_cmd(cw++, tf->device, ATA_REG_DEVICE, 0); - mv_crqb_pack_cmd(cw++, tf->command, ATA_REG_CMD, 1); /* last */ - - if (!(qc->flags & ATA_QCFLAG_DMAMAP)) { - return; - } - mv_fill_sg(qc); -} - -/** - * mv_qc_issue - Initiate a command to the host - * @qc: queued command to start - * - * This routine simply redirects to the general purpose routine - * if command is not DMA. Else, it sanity checks our local - * caches of the request producer/consumer indices then enables - * DMA and bumps the request producer index. - * - * LOCKING: - * Inherited from caller. - */ -static int mv_qc_issue(struct ata_queued_cmd *qc) -{ - void __iomem *port_mmio = mv_ap_base(qc->ap); - struct mv_port_priv *pp = qc->ap->private_data; - u32 in_ptr; - - if (ATA_PROT_DMA != qc->tf.protocol) { - /* We're about to send a non-EDMA capable command to the - * port. Turn off EDMA so there won't be problems accessing - * shadow block, etc registers. - */ - mv_stop_dma(qc->ap); - return ata_qc_issue_prot(qc); - } - - in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS); - - /* the req producer index should be the same as we remember it */ - assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == - pp->req_producer); - /* until we do queuing, the queue should be empty at this point */ - assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == - ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> - EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); - - mv_inc_q_index(&pp->req_producer); /* now incr producer index */ - - mv_start_dma(port_mmio, pp); - - /* and write the request in pointer to kick the EDMA to life */ - in_ptr &= EDMA_REQ_Q_BASE_LO_MASK; - in_ptr |= pp->req_producer << EDMA_REQ_Q_PTR_SHIFT; - writelfl(in_ptr, port_mmio + EDMA_REQ_Q_IN_PTR_OFS); - - return 0; -} - -/** - * mv_get_crpb_status - get status from most recently completed cmd - * @ap: ATA channel to manipulate - * - * This routine is for use when the port is in DMA mode, when it - * will be using the CRPB (command response block) method of - * returning command completion information. We assert indices - * are good, grab status, and bump the response consumer index to - * prove that we're up to date. - * - * LOCKING: - * Inherited from caller. - */ -static u8 mv_get_crpb_status(struct ata_port *ap) -{ - void __iomem *port_mmio = mv_ap_base(ap); - struct mv_port_priv *pp = ap->private_data; - u32 out_ptr; - - out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); - - /* the response consumer index should be the same as we remember it */ - assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == - pp->rsp_consumer); - - /* increment our consumer index... */ - pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); - - /* and, until we do NCQ, there should only be 1 CRPB waiting */ - assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> - EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == - pp->rsp_consumer); - - /* write out our inc'd consumer index so EDMA knows we're caught up */ - out_ptr &= EDMA_RSP_Q_BASE_LO_MASK; - out_ptr |= pp->rsp_consumer << EDMA_RSP_Q_PTR_SHIFT; - writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); - - /* Return ATA status register for completed CRPB */ - return (pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT); + done: + VPRINTK("EXIT, rc = %i\n", rc); + return rc; } -/** - * mv_err_intr - Handle error interrupts on the port - * @ap: ATA channel to manipulate - * - * In most cases, just clear the interrupt and move on. However, - * some cases require an eDMA reset, which is done right before - * the COMRESET in mv_phy_reset(). The SERR case requires a - * clear of pending errors in the SATA SERROR register. Finally, - * if the port disabled DMA, update our cached copy to match. - * - * LOCKING: - * Inherited from caller. - */ static void mv_err_intr(struct ata_port *ap) { - void __iomem *port_mmio = mv_ap_base(ap); + void __iomem *port_mmio; u32 edma_err_cause, serr = 0; + /* bug here b/c we got an err int on a port we don't know about, + * so there's no way to clear it + */ + BUG_ON(NULL == ap); + port_mmio = mv_ap_base(ap); + edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); if (EDMA_ERR_SERR & edma_err_cause) { serr = scr_read(ap, SCR_ERROR); scr_write_flush(ap, SCR_ERROR, serr); } - if (EDMA_ERR_SELF_DIS & edma_err_cause) { - struct mv_port_priv *pp = ap->private_data; - pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; - } - DPRINTK(KERN_ERR "ata%u: port error; EDMA err cause: 0x%08x " - "SERR: 0x%08x\n", ap->id, edma_err_cause, serr); + DPRINTK("port %u error; EDMA err cause: 0x%08x SERR: 0x%08x\n", + ap->port_no, edma_err_cause, serr); /* Clear EDMA now that SERR cleanup done */ writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); @@ -1043,21 +477,7 @@ static void mv_err_intr(struct ata_port *ap) } } -/** - * mv_host_intr - Handle all interrupts on the given host controller - * @host_set: host specific structure - * @relevant: port error bits relevant to this host controller - * @hc: which host controller we're to look at - * - * Read then write clear the HC interrupt status then walk each - * port connected to the HC and see if it needs servicing. Port - * success ints are reported in the HC interrupt status reg, the - * port error ints are reported in the higher level main - * interrupt status register and thus are passed in via the - * 'relevant' argument. - * - * LOCKING: - * Inherited from caller. +/* Handle any outstanding interrupts in a single SATAHC */ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, unsigned int hc) @@ -1067,8 +487,8 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, struct ata_port *ap; struct ata_queued_cmd *qc; u32 hc_irq_cause; - int shift, port, port0, hard_port, handled; - u8 ata_status = 0; + int shift, port, port0, hard_port; + u8 ata_status; if (hc == 0) { port0 = 0; @@ -1079,7 +499,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, /* we'll need the HC success int register in most cases */ hc_irq_cause = readl(hc_mmio + HC_IRQ_CAUSE_OFS); if (hc_irq_cause) { - writelfl(~hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); + writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); } VPRINTK("ENTER, hc%u relevant=0x%08x HC IRQ cause=0x%08x\n", @@ -1088,38 +508,35 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, for (port = port0; port < port0 + MV_PORTS_PER_HC; port++) { ap = host_set->ports[port]; hard_port = port & MV_PORT_MASK; /* range 0-3 */ - handled = 0; /* ensure ata_status is set if handled++ */ + ata_status = 0xffU; - if ((CRPB_DMA_DONE << hard_port) & hc_irq_cause) { - /* new CRPB on the queue; just one at a time until NCQ - */ - ata_status = mv_get_crpb_status(ap); - handled++; - } else if ((DEV_IRQ << hard_port) & hc_irq_cause) { - /* received ATA IRQ; read the status reg to clear INTRQ + if (((CRBP_DMA_DONE | DEV_IRQ) << hard_port) & hc_irq_cause) { + BUG_ON(NULL == ap); + /* rcv'd new resp, basic DMA complete, or ATA IRQ */ + /* This is needed to clear the ATA INTRQ. + * FIXME: don't read the status reg in EDMA mode! */ ata_status = readb((void __iomem *) ap->ioaddr.status_addr); - handled++; } - shift = port << 1; /* (port * 2) */ + shift = port * 2; if (port >= MV_PORTS_PER_HC) { shift++; /* skip bit 8 in the HC Main IRQ reg */ } if ((PORT0_ERR << shift) & relevant) { mv_err_intr(ap); - /* OR in ATA_ERR to ensure libata knows we took one */ + /* FIXME: smart to OR in ATA_ERR? */ ata_status = readb((void __iomem *) ap->ioaddr.status_addr) | ATA_ERR; - handled++; } - if (handled && ap) { + if (ap) { qc = ata_qc_from_tag(ap, ap->active_tag); if (NULL != qc) { VPRINTK("port %u IRQ found for qc, " "ata_status 0x%x\n", port,ata_status); + BUG_ON(0xffU == ata_status); /* mark qc status appropriately */ ata_qc_complete(qc, ata_status); } @@ -1128,30 +545,17 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, VPRINTK("EXIT\n"); } -/** - * mv_interrupt - - * @irq: unused - * @dev_instance: private data; in this case the host structure - * @regs: unused - * - * Read the read only register to determine if any host - * controllers have pending interrupts. If so, call lower level - * routine to handle. Also check for PCI errors which are only - * reported here. - * - * LOCKING: - * This routine holds the host_set lock while processing pending - * interrupts. - */ static irqreturn_t mv_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct ata_host_set *host_set = dev_instance; unsigned int hc, handled = 0, n_hcs; - void __iomem *mmio = host_set->mmio_base; + void __iomem *mmio; u32 irq_stat; + mmio = host_set->mmio_base; irq_stat = readl(mmio + HC_MAIN_IRQ_CAUSE_OFS); + n_hcs = mv_get_hc_count(host_set->ports[0]->flags); /* check the cases where we either have nothing pending or have read * a bogus register value which can indicate HW removal or PCI fault @@ -1160,105 +564,64 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, return IRQ_NONE; } - n_hcs = mv_get_hc_count(host_set->ports[0]->flags); spin_lock(&host_set->lock); for (hc = 0; hc < n_hcs; hc++) { u32 relevant = irq_stat & (HC0_IRQ_PEND << (hc * HC_SHIFT)); if (relevant) { mv_host_intr(host_set, relevant, hc); - handled++; + handled = 1; } } if (PCI_ERR & irq_stat) { - printk(KERN_ERR DRV_NAME ": PCI ERROR; PCI IRQ cause=0x%08x\n", - readl(mmio + PCI_IRQ_CAUSE_OFS)); - - DPRINTK("All regs @ PCI error\n"); - mv_dump_all_regs(mmio, -1, to_pci_dev(host_set->dev)); - - writelfl(0, mmio + PCI_IRQ_CAUSE_OFS); - handled++; + /* FIXME: these are all masked by default, but still need + * to recover from them properly. + */ } + spin_unlock(&host_set->lock); return IRQ_RETVAL(handled); } -/** - * mv_check_err - Return the error shadow register to caller. - * @ap: ATA channel to manipulate - * - * Marvell requires DMA to be stopped before accessing shadow - * registers. So we do that, then return the needed register. - * - * LOCKING: - * Inherited from caller. FIXME: protect mv_stop_dma with lock? - */ -static u8 mv_check_err(struct ata_port *ap) -{ - mv_stop_dma(ap); /* can't read shadow regs if DMA on */ - return readb((void __iomem *) ap->ioaddr.error_addr); -} - -/** - * mv_phy_reset - Perform eDMA reset followed by COMRESET - * @ap: ATA channel to manipulate - * - * Part of this is taken from __sata_phy_reset and modified to - * not sleep since this routine gets called from interrupt level. - * - * LOCKING: - * Inherited from caller. This is coded to safe to call at - * interrupt level, i.e. it does not sleep. - */ static void mv_phy_reset(struct ata_port *ap) { void __iomem *port_mmio = mv_ap_base(ap); struct ata_taskfile tf; struct ata_device *dev = &ap->device[0]; - unsigned long timeout; + u32 edma = 0, bdma; VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio); - mv_stop_dma(ap); + edma = readl(port_mmio + EDMA_CMD_OFS); + if (EDMA_EN & edma) { + /* disable EDMA if active */ + edma &= ~EDMA_EN; + writelfl(edma | EDMA_DS, port_mmio + EDMA_CMD_OFS); + udelay(1); + } else if (mv_port_bdma_capable(ap) && + (bdma = readl(port_mmio + BDMA_CMD_OFS)) & BDMA_START) { + /* disable BDMA if active */ + writelfl(bdma & ~BDMA_START, port_mmio + BDMA_CMD_OFS); + } - writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); + writelfl(edma | ATA_RST, port_mmio + EDMA_CMD_OFS); udelay(25); /* allow reset propagation */ /* Spec never mentions clearing the bit. Marvell's driver does * clear the bit, however. */ - writelfl(0, port_mmio + EDMA_CMD_OFS); + writelfl(edma & ~ATA_RST, port_mmio + EDMA_CMD_OFS); - VPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " - "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), - mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); + VPRINTK("Done. Now calling __sata_phy_reset()\n"); /* proceed to init communications via the scr_control reg */ - scr_write_flush(ap, SCR_CONTROL, 0x301); - mdelay(1); - scr_write_flush(ap, SCR_CONTROL, 0x300); - timeout = jiffies + (HZ * 1); - do { - mdelay(10); - if ((scr_read(ap, SCR_STATUS) & 0xf) != 1) - break; - } while (time_before(jiffies, timeout)); + __sata_phy_reset(ap); - VPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " - "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), - mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); - - if (sata_dev_present(ap)) { - ata_port_probe(ap); - } else { - printk(KERN_INFO "ata%u: no device found (phy stat %08x)\n", - ap->id, scr_read(ap, SCR_STATUS)); - ata_port_disable(ap); + if (ap->flags & ATA_FLAG_PORT_DISABLED) { + VPRINTK("Port disabled pre-sig. Exiting.\n"); return; } - ap->cbl = ATA_CBL_SATA; tf.lbah = readb((void __iomem *) ap->ioaddr.lbah_addr); tf.lbam = readb((void __iomem *) ap->ioaddr.lbam_addr); @@ -1273,118 +636,37 @@ static void mv_phy_reset(struct ata_port *ap) VPRINTK("EXIT\n"); } -/** - * mv_eng_timeout - Routine called by libata when SCSI times out I/O - * @ap: ATA channel to manipulate - * - * Intent is to clear all pending error conditions, reset the - * chip/bus, fail the command, and move on. - * - * LOCKING: - * This routine holds the host_set lock while failing the command. - */ -static void mv_eng_timeout(struct ata_port *ap) -{ - struct ata_queued_cmd *qc; - unsigned long flags; - - printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); - DPRINTK("All regs @ start of eng_timeout\n"); - mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, - to_pci_dev(ap->host_set->dev)); - - qc = ata_qc_from_tag(ap, ap->active_tag); - printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n", - ap->host_set->mmio_base, ap, qc, qc->scsicmd, - &qc->scsicmd->cmnd); - - mv_err_intr(ap); - mv_phy_reset(ap); - - if (!qc) { - printk(KERN_ERR "ata%u: BUG: timeout without command\n", - ap->id); - } else { - /* hack alert! We cannot use the supplied completion - * function from inside the ->eh_strategy_handler() thread. - * libata is the only user of ->eh_strategy_handler() in - * any kernel, so the default scsi_done() assumes it is - * not being called from the SCSI EH. - */ - spin_lock_irqsave(&ap->host_set->lock, flags); - qc->scsidone = scsi_finish_command; - ata_qc_complete(qc, ATA_ERR); - spin_unlock_irqrestore(&ap->host_set->lock, flags); - } -} - -/** - * mv_port_init - Perform some early initialization on a single port. - * @port: libata data structure storing shadow register addresses - * @port_mmio: base address of the port - * - * Initialize shadow register mmio addresses, clear outstanding - * interrupts on the port, and unmask interrupts for the future - * start of the port. - * - * LOCKING: - * Inherited from caller. - */ -static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) +static void mv_port_init(struct ata_ioports *port, unsigned long base) { - unsigned long shd_base = (unsigned long) port_mmio + SHD_BLK_OFS; - unsigned serr_ofs; - - /* PIO related setup - */ - port->data_addr = shd_base + (sizeof(u32) * ATA_REG_DATA); - port->error_addr = - port->feature_addr = shd_base + (sizeof(u32) * ATA_REG_ERR); - port->nsect_addr = shd_base + (sizeof(u32) * ATA_REG_NSECT); - port->lbal_addr = shd_base + (sizeof(u32) * ATA_REG_LBAL); - port->lbam_addr = shd_base + (sizeof(u32) * ATA_REG_LBAM); - port->lbah_addr = shd_base + (sizeof(u32) * ATA_REG_LBAH); - port->device_addr = shd_base + (sizeof(u32) * ATA_REG_DEVICE); - port->status_addr = - port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS); - /* special case: control/altstatus doesn't have ATA_REG_ address */ - port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS; - - /* unused: */ + /* PIO related setup */ + port->data_addr = base + SHD_PIO_DATA_OFS; + port->error_addr = port->feature_addr = base + SHD_FEA_ERR_OFS; + port->nsect_addr = base + SHD_SECT_CNT_OFS; + port->lbal_addr = base + SHD_LBA_L_OFS; + port->lbam_addr = base + SHD_LBA_M_OFS; + port->lbah_addr = base + SHD_LBA_H_OFS; + port->device_addr = base + SHD_DEV_HD_OFS; + port->status_addr = port->command_addr = base + SHD_CMD_STA_OFS; + port->altstatus_addr = port->ctl_addr = base + SHD_CTL_AST_OFS; + /* unused */ port->cmd_addr = port->bmdma_addr = port->scr_addr = 0; - /* Clear any currently outstanding port interrupt conditions */ - serr_ofs = mv_scr_offset(SCR_ERROR); - writelfl(readl(port_mmio + serr_ofs), port_mmio + serr_ofs); - writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); - /* unmask all EDMA error interrupts */ - writelfl(~0, port_mmio + EDMA_ERR_IRQ_MASK_OFS); + writel(~0, (void __iomem *)base + EDMA_ERR_IRQ_MASK_OFS); VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", - readl(port_mmio + EDMA_CFG_OFS), - readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS), - readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); + readl((void __iomem *)base + EDMA_CFG_OFS), + readl((void __iomem *)base + EDMA_ERR_IRQ_CAUSE_OFS), + readl((void __iomem *)base + EDMA_ERR_IRQ_MASK_OFS)); } -/** - * mv_host_init - Perform some early initialization of the host. - * @probe_ent: early data struct representing the host - * - * If possible, do an early global reset of the host. Then do - * our port init and clear/unmask all/relevant host interrupts. - * - * LOCKING: - * Inherited from caller. - */ static int mv_host_init(struct ata_probe_ent *probe_ent) { int rc = 0, n_hc, port, hc; void __iomem *mmio = probe_ent->mmio_base; void __iomem *port_mmio; - if ((MV_FLAG_GLBL_SFT_RST & probe_ent->host_flags) && - mv_global_soft_reset(probe_ent->mmio_base)) { + if (mv_master_reset(probe_ent->mmio_base)) { rc = 1; goto done; } @@ -1394,27 +676,17 @@ static int mv_host_init(struct ata_probe_ent *probe_ent) for (port = 0; port < probe_ent->n_ports; port++) { port_mmio = mv_port_base(mmio, port); - mv_port_init(&probe_ent->port[port], port_mmio); + mv_port_init(&probe_ent->port[port], (unsigned long)port_mmio); } for (hc = 0; hc < n_hc; hc++) { - void __iomem *hc_mmio = mv_hc_base(mmio, hc); - - VPRINTK("HC%i: HC config=0x%08x HC IRQ cause " - "(before clear)=0x%08x\n", hc, - readl(hc_mmio + HC_CFG_OFS), - readl(hc_mmio + HC_IRQ_CAUSE_OFS)); - - /* Clear any currently outstanding hc interrupt conditions */ - writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); + VPRINTK("HC%i: HC config=0x%08x HC IRQ cause=0x%08x\n", hc, + readl(mv_hc_base(mmio, hc) + HC_CFG_OFS), + readl(mv_hc_base(mmio, hc) + HC_IRQ_CAUSE_OFS)); } - /* Clear any currently outstanding host interrupt conditions */ - writelfl(0, mmio + PCI_IRQ_CAUSE_OFS); - - /* and unmask interrupt generation for host regs */ - writelfl(PCI_UNMASK_ALL_IRQS, mmio + PCI_IRQ_MASK_OFS); - writelfl(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS); + writel(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS); + writel(PCI_UNMASK_ALL_IRQS, mmio + PCI_IRQ_MASK_OFS); VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " "PCI int cause/mask=0x%08x/0x%08x\n", @@ -1422,53 +694,11 @@ static int mv_host_init(struct ata_probe_ent *probe_ent) readl(mmio + HC_MAIN_IRQ_MASK_OFS), readl(mmio + PCI_IRQ_CAUSE_OFS), readl(mmio + PCI_IRQ_MASK_OFS)); -done: - return rc; -} - -/** - * mv_print_info - Dump key info to kernel log for perusal. - * @probe_ent: early data struct representing the host - * - * FIXME: complete this. - * - * LOCKING: - * Inherited from caller. - */ -static void mv_print_info(struct ata_probe_ent *probe_ent) -{ - struct pci_dev *pdev = to_pci_dev(probe_ent->dev); - struct mv_host_priv *hpriv = probe_ent->private_data; - u8 rev_id, scc; - const char *scc_s; - /* Use this to determine the HW stepping of the chip so we know - * what errata to workaround - */ - pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); - - pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &scc); - if (scc == 0) - scc_s = "SCSI"; - else if (scc == 0x01) - scc_s = "RAID"; - else - scc_s = "unknown"; - - printk(KERN_INFO DRV_NAME - "(%s) %u slots %u ports %s mode IRQ via %s\n", - pci_name(pdev), (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, - scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); + done: + return rc; } -/** - * mv_init_one - handle a positive probe of a Marvell host - * @pdev: PCI device found - * @ent: PCI device ID entry for the matched host - * - * LOCKING: - * Inherited from caller. - */ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { static int printed_version = 0; @@ -1476,12 +706,16 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) struct mv_host_priv *hpriv; unsigned int board_idx = (unsigned int)ent->driver_data; void __iomem *mmio_base; - int pci_dev_busy = 0, rc; + int pci_dev_busy = 0; + int rc; if (!printed_version++) { - printk(KERN_INFO DRV_NAME " version " DRV_VERSION "\n"); + printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); } + VPRINTK("ENTER for PCI Bus:Slot.Func=%u:%u.%u\n", pdev->bus->number, + PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); + rc = pci_enable_device(pdev); if (rc) { return rc; @@ -1493,6 +727,8 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out; } + pci_intx(pdev, 1); + probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); if (probe_ent == NULL) { rc = -ENOMEM; @@ -1503,7 +739,8 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->dev = pci_dev_to_dev(pdev); INIT_LIST_HEAD(&probe_ent->node); - mmio_base = pci_iomap(pdev, MV_PRIMARY_BAR, 0); + mmio_base = ioremap_nocache(pci_resource_start(pdev, MV_PRIMARY_BAR), + pci_resource_len(pdev, MV_PRIMARY_BAR)); if (mmio_base == NULL) { rc = -ENOMEM; goto err_out_free_ent; @@ -1532,40 +769,37 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (rc) { goto err_out_hpriv; } +/* mv_print_info(probe_ent); */ - /* Enable interrupts */ - if (pci_enable_msi(pdev) == 0) { - hpriv->hp_flags |= MV_HP_FLAG_MSI; - } else { - pci_intx(pdev, 1); - } - - mv_dump_pci_cfg(pdev, 0x68); - mv_print_info(probe_ent); - - if (ata_device_add(probe_ent) == 0) { - rc = -ENODEV; /* No devices discovered */ - goto err_out_dev_add; + { + int b, w; + u32 dw[4]; /* hold a line of 16b */ + VPRINTK("PCI config space:\n"); + for (b = 0; b < 0x40; ) { + for (w = 0; w < 4; w++) { + (void) pci_read_config_dword(pdev,b,&dw[w]); + b += sizeof(*dw); + } + VPRINTK("%08x %08x %08x %08x\n", + dw[0],dw[1],dw[2],dw[3]); + } } + /* FIXME: check ata_device_add return value */ + ata_device_add(probe_ent); kfree(probe_ent); + return 0; -err_out_dev_add: - if (MV_HP_FLAG_MSI & hpriv->hp_flags) { - pci_disable_msi(pdev); - } else { - pci_intx(pdev, 0); - } -err_out_hpriv: + err_out_hpriv: kfree(hpriv); -err_out_iounmap: - pci_iounmap(pdev, mmio_base); -err_out_free_ent: + err_out_iounmap: + iounmap(mmio_base); + err_out_free_ent: kfree(probe_ent); -err_out_regions: + err_out_regions: pci_release_regions(pdev); -err_out: + err_out: if (!pci_dev_busy) { pci_disable_device(pdev); } diff --git a/trunk/drivers/scsi/sata_nv.c b/trunk/drivers/scsi/sata_nv.c index 9fa2535dd937..a1d62dee3be6 100644 --- a/trunk/drivers/scsi/sata_nv.c +++ b/trunk/drivers/scsi/sata_nv.c @@ -29,8 +29,6 @@ * NV-specific details such as register offsets, SATA phy location, * hotplug info, etc. * - * 0.09 - * - Fixed bug introduced by 0.08's MCP51 and MCP55 support. * * 0.08 * - Added support for MCP51 and MCP55. @@ -134,7 +132,9 @@ enum nv_host_type GENERIC, NFORCE2, NFORCE3, - CK804 + CK804, + MCP51, + MCP55 }; static struct pci_device_id nv_pci_tbl[] = { @@ -153,13 +153,11 @@ static struct pci_device_id nv_pci_tbl[] = { { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CK804 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, GENERIC }, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP51 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, GENERIC }, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP51 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, GENERIC }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, GENERIC }, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP55 }, { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE<<8, 0xffff00, GENERIC }, @@ -405,7 +403,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) rc = -ENOMEM; ppi = &nv_port_info; - probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) goto err_out_regions; diff --git a/trunk/drivers/scsi/sata_promise.c b/trunk/drivers/scsi/sata_promise.c index def7e0d9dacb..538ad727bd2e 100644 --- a/trunk/drivers/scsi/sata_promise.c +++ b/trunk/drivers/scsi/sata_promise.c @@ -438,11 +438,11 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap, break; default: - ap->stats.idle_irq++; - break; + ap->stats.idle_irq++; + break; } - return handled; + return handled; } static void pdc_irq_clear(struct ata_port *ap) diff --git a/trunk/drivers/scsi/sata_qstor.c b/trunk/drivers/scsi/sata_qstor.c index 69a9b1cf6f9c..ffcdeb68641c 100644 --- a/trunk/drivers/scsi/sata_qstor.c +++ b/trunk/drivers/scsi/sata_qstor.c @@ -268,17 +268,16 @@ static void qs_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) static void qs_fill_sg(struct ata_queued_cmd *qc) { - struct scatterlist *sg; + struct scatterlist *sg = qc->sg; struct ata_port *ap = qc->ap; struct qs_port_priv *pp = ap->private_data; unsigned int nelem; u8 *prd = pp->pkt + QS_CPB_BYTES; - assert(qc->__sg != NULL); + assert(sg != NULL); assert(qc->n_elem > 0); - nelem = 0; - ata_for_each_sg(sg, qc) { + for (nelem = 0; nelem < qc->n_elem; nelem++,sg++) { u64 addr; u32 len; @@ -292,7 +291,6 @@ static void qs_fill_sg(struct ata_queued_cmd *qc) VPRINTK("PRD[%u] = (0x%llX, 0x%X)\n", nelem, (unsigned long long)addr, len); - nelem++; } } diff --git a/trunk/drivers/scsi/sata_sil24.c b/trunk/drivers/scsi/sata_sil24.c deleted file mode 100644 index e16d1815cda0..000000000000 --- a/trunk/drivers/scsi/sata_sil24.c +++ /dev/null @@ -1,880 +0,0 @@ -/* - * sata_sil24.c - Driver for Silicon Image 3124/3132 SATA-2 controllers - * - * Copyright 2005 Tejun Heo - * - * Based on preview driver from Silicon Image. - * - * NOTE: No NCQ/ATAPI support yet. The preview driver didn't support - * NCQ nor ATAPI, and, unfortunately, I couldn't find out how to make - * those work. Enabling those shouldn't be difficult. Basic - * structure is all there (in libata-dev tree). If you have any - * information about this hardware, please contact me or linux-ide. - * Info is needed on... - * - * - How to issue tagged commands and turn on sactive on issue accordingly. - * - Where to put an ATAPI command and how to tell the device to send it. - * - How to enable/use 64bit. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "scsi.h" -#include -#include - -#define DRV_NAME "sata_sil24" -#define DRV_VERSION "0.22" /* Silicon Image's preview driver was 0.10 */ - -/* - * Port request block (PRB) 32 bytes - */ -struct sil24_prb { - u16 ctrl; - u16 prot; - u32 rx_cnt; - u8 fis[6 * 4]; -}; - -/* - * Scatter gather entry (SGE) 16 bytes - */ -struct sil24_sge { - u64 addr; - u32 cnt; - u32 flags; -}; - -/* - * Port multiplier - */ -struct sil24_port_multiplier { - u32 diag; - u32 sactive; -}; - -enum { - /* - * Global controller registers (128 bytes @ BAR0) - */ - /* 32 bit regs */ - HOST_SLOT_STAT = 0x00, /* 32 bit slot stat * 4 */ - HOST_CTRL = 0x40, - HOST_IRQ_STAT = 0x44, - HOST_PHY_CFG = 0x48, - HOST_BIST_CTRL = 0x50, - HOST_BIST_PTRN = 0x54, - HOST_BIST_STAT = 0x58, - HOST_MEM_BIST_STAT = 0x5c, - HOST_FLASH_CMD = 0x70, - /* 8 bit regs */ - HOST_FLASH_DATA = 0x74, - HOST_TRANSITION_DETECT = 0x75, - HOST_GPIO_CTRL = 0x76, - HOST_I2C_ADDR = 0x78, /* 32 bit */ - HOST_I2C_DATA = 0x7c, - HOST_I2C_XFER_CNT = 0x7e, - HOST_I2C_CTRL = 0x7f, - - /* HOST_SLOT_STAT bits */ - HOST_SSTAT_ATTN = (1 << 31), - - /* - * Port registers - * (8192 bytes @ +0x0000, +0x2000, +0x4000 and +0x6000 @ BAR2) - */ - PORT_REGS_SIZE = 0x2000, - PORT_PRB = 0x0000, /* (32 bytes PRB + 16 bytes SGEs * 6) * 31 (3968 bytes) */ - - PORT_PM = 0x0f80, /* 8 bytes PM * 16 (128 bytes) */ - /* 32 bit regs */ - PORT_CTRL_STAT = 0x1000, /* write: ctrl-set, read: stat */ - PORT_CTRL_CLR = 0x1004, /* write: ctrl-clear */ - PORT_IRQ_STAT = 0x1008, /* high: status, low: interrupt */ - PORT_IRQ_ENABLE_SET = 0x1010, /* write: enable-set */ - PORT_IRQ_ENABLE_CLR = 0x1014, /* write: enable-clear */ - PORT_ACTIVATE_UPPER_ADDR= 0x101c, - PORT_EXEC_FIFO = 0x1020, /* command execution fifo */ - PORT_CMD_ERR = 0x1024, /* command error number */ - PORT_FIS_CFG = 0x1028, - PORT_FIFO_THRES = 0x102c, - /* 16 bit regs */ - PORT_DECODE_ERR_CNT = 0x1040, - PORT_DECODE_ERR_THRESH = 0x1042, - PORT_CRC_ERR_CNT = 0x1044, - PORT_CRC_ERR_THRESH = 0x1046, - PORT_HSHK_ERR_CNT = 0x1048, - PORT_HSHK_ERR_THRESH = 0x104a, - /* 32 bit regs */ - PORT_PHY_CFG = 0x1050, - PORT_SLOT_STAT = 0x1800, - PORT_CMD_ACTIVATE = 0x1c00, /* 64 bit cmd activate * 31 (248 bytes) */ - PORT_EXEC_DIAG = 0x1e00, /* 32bit exec diag * 16 (64 bytes, 0-10 used on 3124) */ - PORT_PSD_DIAG = 0x1e40, /* 32bit psd diag * 16 (64 bytes, 0-8 used on 3124) */ - PORT_SCONTROL = 0x1f00, - PORT_SSTATUS = 0x1f04, - PORT_SERROR = 0x1f08, - PORT_SACTIVE = 0x1f0c, - - /* PORT_CTRL_STAT bits */ - PORT_CS_PORT_RST = (1 << 0), /* port reset */ - PORT_CS_DEV_RST = (1 << 1), /* device reset */ - PORT_CS_INIT = (1 << 2), /* port initialize */ - PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */ - PORT_CS_RESUME = (1 << 6), /* port resume */ - PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */ - PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */ - PORT_CS_RDY = (1 << 31), /* port ready to accept commands */ - - /* PORT_IRQ_STAT/ENABLE_SET/CLR */ - /* bits[11:0] are masked */ - PORT_IRQ_COMPLETE = (1 << 0), /* command(s) completed */ - PORT_IRQ_ERROR = (1 << 1), /* command execution error */ - PORT_IRQ_PORTRDY_CHG = (1 << 2), /* port ready change */ - PORT_IRQ_PWR_CHG = (1 << 3), /* power management change */ - PORT_IRQ_PHYRDY_CHG = (1 << 4), /* PHY ready change */ - PORT_IRQ_COMWAKE = (1 << 5), /* COMWAKE received */ - PORT_IRQ_UNK_FIS = (1 << 6), /* Unknown FIS received */ - PORT_IRQ_SDB_FIS = (1 << 11), /* SDB FIS received */ - - /* bits[27:16] are unmasked (raw) */ - PORT_IRQ_RAW_SHIFT = 16, - PORT_IRQ_MASKED_MASK = 0x7ff, - PORT_IRQ_RAW_MASK = (0x7ff << PORT_IRQ_RAW_SHIFT), - - /* ENABLE_SET/CLR specific, intr steering - 2 bit field */ - PORT_IRQ_STEER_SHIFT = 30, - PORT_IRQ_STEER_MASK = (3 << PORT_IRQ_STEER_SHIFT), - - /* PORT_CMD_ERR constants */ - PORT_CERR_DEV = 1, /* Error bit in D2H Register FIS */ - PORT_CERR_SDB = 2, /* Error bit in SDB FIS */ - PORT_CERR_DATA = 3, /* Error in data FIS not detected by dev */ - PORT_CERR_SEND = 4, /* Initial cmd FIS transmission failure */ - PORT_CERR_INCONSISTENT = 5, /* Protocol mismatch */ - PORT_CERR_DIRECTION = 6, /* Data direction mismatch */ - PORT_CERR_UNDERRUN = 7, /* Ran out of SGEs while writing */ - PORT_CERR_OVERRUN = 8, /* Ran out of SGEs while reading */ - PORT_CERR_PKT_PROT = 11, /* DIR invalid in 1st PIO setup of ATAPI */ - PORT_CERR_SGT_BOUNDARY = 16, /* PLD ecode 00 - SGT not on qword boundary */ - PORT_CERR_SGT_TGTABRT = 17, /* PLD ecode 01 - target abort */ - PORT_CERR_SGT_MSTABRT = 18, /* PLD ecode 10 - master abort */ - PORT_CERR_SGT_PCIPERR = 19, /* PLD ecode 11 - PCI parity err while fetching SGT */ - PORT_CERR_CMD_BOUNDARY = 24, /* ctrl[15:13] 001 - PRB not on qword boundary */ - PORT_CERR_CMD_TGTABRT = 25, /* ctrl[15:13] 010 - target abort */ - PORT_CERR_CMD_MSTABRT = 26, /* ctrl[15:13] 100 - master abort */ - PORT_CERR_CMD_PCIPERR = 27, /* ctrl[15:13] 110 - PCI parity err while fetching PRB */ - PORT_CERR_XFR_UNDEF = 32, /* PSD ecode 00 - undefined */ - PORT_CERR_XFR_TGTABRT = 33, /* PSD ecode 01 - target abort */ - PORT_CERR_XFR_MSGABRT = 34, /* PSD ecode 10 - master abort */ - PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */ - PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ - - /* - * Other constants - */ - SGE_TRM = (1 << 31), /* Last SGE in chain */ - PRB_SOFT_RST = (1 << 7), /* Soft reset request (ign BSY?) */ - - /* board id */ - BID_SIL3124 = 0, - BID_SIL3132 = 1, - BID_SIL3131 = 2, - - IRQ_STAT_4PORTS = 0xf, -}; - -struct sil24_cmd_block { - struct sil24_prb prb; - struct sil24_sge sge[LIBATA_MAX_PRD]; -}; - -/* - * ap->private_data - * - * The preview driver always returned 0 for status. We emulate it - * here from the previous interrupt. - */ -struct sil24_port_priv { - struct sil24_cmd_block *cmd_block; /* 32 cmd blocks */ - dma_addr_t cmd_block_dma; /* DMA base addr for them */ - struct ata_taskfile tf; /* Cached taskfile registers */ -}; - -/* ap->host_set->private_data */ -struct sil24_host_priv { - void *host_base; /* global controller control (128 bytes @BAR0) */ - void *port_base; /* port registers (4 * 8192 bytes @BAR2) */ -}; - -static u8 sil24_check_status(struct ata_port *ap); -static u8 sil24_check_err(struct ata_port *ap); -static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); -static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); -static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); -static void sil24_phy_reset(struct ata_port *ap); -static void sil24_qc_prep(struct ata_queued_cmd *qc); -static int sil24_qc_issue(struct ata_queued_cmd *qc); -static void sil24_irq_clear(struct ata_port *ap); -static void sil24_eng_timeout(struct ata_port *ap); -static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs); -static int sil24_port_start(struct ata_port *ap); -static void sil24_port_stop(struct ata_port *ap); -static void sil24_host_stop(struct ata_host_set *host_set); -static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); - -static struct pci_device_id sil24_pci_tbl[] = { - { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, - { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 }, - { 0x1095, 0x3131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 }, - { 0x1095, 0x3531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 }, - { } /* terminate list */ -}; - -static struct pci_driver sil24_pci_driver = { - .name = DRV_NAME, - .id_table = sil24_pci_tbl, - .probe = sil24_init_one, - .remove = ata_pci_remove_one, /* safe? */ -}; - -static Scsi_Host_Template sil24_sht = { - .module = THIS_MODULE, - .name = DRV_NAME, - .ioctl = ata_scsi_ioctl, - .queuecommand = ata_scsi_queuecmd, - .eh_strategy_handler = ata_scsi_error, - .can_queue = ATA_DEF_QUEUE, - .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = LIBATA_MAX_PRD, - .max_sectors = ATA_MAX_SECTORS, - .cmd_per_lun = ATA_SHT_CMD_PER_LUN, - .emulated = ATA_SHT_EMULATED, - .use_clustering = ATA_SHT_USE_CLUSTERING, - .proc_name = DRV_NAME, - .dma_boundary = ATA_DMA_BOUNDARY, - .slave_configure = ata_scsi_slave_config, - .bios_param = ata_std_bios_param, - .ordered_flush = 1, /* NCQ not supported yet */ -}; - -static struct ata_port_operations sil24_ops = { - .port_disable = ata_port_disable, - - .check_status = sil24_check_status, - .check_altstatus = sil24_check_status, - .check_err = sil24_check_err, - .dev_select = ata_noop_dev_select, - - .tf_read = sil24_tf_read, - - .phy_reset = sil24_phy_reset, - - .qc_prep = sil24_qc_prep, - .qc_issue = sil24_qc_issue, - - .eng_timeout = sil24_eng_timeout, - - .irq_handler = sil24_interrupt, - .irq_clear = sil24_irq_clear, - - .scr_read = sil24_scr_read, - .scr_write = sil24_scr_write, - - .port_start = sil24_port_start, - .port_stop = sil24_port_stop, - .host_stop = sil24_host_stop, -}; - -/* - * Use bits 30-31 of host_flags to encode available port numbers. - * Current maxium is 4. - */ -#define SIL24_NPORTS2FLAG(nports) ((((unsigned)(nports) - 1) & 0x3) << 30) -#define SIL24_FLAG2NPORTS(flag) ((((flag) >> 30) & 0x3) + 1) - -static struct ata_port_info sil24_port_info[] = { - /* sil_3124 */ - { - .sht = &sil24_sht, - .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | - ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4), - .pio_mask = 0x1f, /* pio0-4 */ - .mwdma_mask = 0x07, /* mwdma0-2 */ - .udma_mask = 0x3f, /* udma0-5 */ - .port_ops = &sil24_ops, - }, - /* sil_3132 */ - { - .sht = &sil24_sht, - .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | - ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2), - .pio_mask = 0x1f, /* pio0-4 */ - .mwdma_mask = 0x07, /* mwdma0-2 */ - .udma_mask = 0x3f, /* udma0-5 */ - .port_ops = &sil24_ops, - }, - /* sil_3131/sil_3531 */ - { - .sht = &sil24_sht, - .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | - ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1), - .pio_mask = 0x1f, /* pio0-4 */ - .mwdma_mask = 0x07, /* mwdma0-2 */ - .udma_mask = 0x3f, /* udma0-5 */ - .port_ops = &sil24_ops, - }, -}; - -static inline void sil24_update_tf(struct ata_port *ap) -{ - struct sil24_port_priv *pp = ap->private_data; - void *port = (void *)ap->ioaddr.cmd_addr; - struct sil24_prb *prb = port; - - ata_tf_from_fis(prb->fis, &pp->tf); -} - -static u8 sil24_check_status(struct ata_port *ap) -{ - struct sil24_port_priv *pp = ap->private_data; - return pp->tf.command; -} - -static u8 sil24_check_err(struct ata_port *ap) -{ - struct sil24_port_priv *pp = ap->private_data; - return pp->tf.feature; -} - -static int sil24_scr_map[] = { - [SCR_CONTROL] = 0, - [SCR_STATUS] = 1, - [SCR_ERROR] = 2, - [SCR_ACTIVE] = 3, -}; - -static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg) -{ - void *scr_addr = (void *)ap->ioaddr.scr_addr; - if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { - void *addr; - addr = scr_addr + sil24_scr_map[sc_reg] * 4; - return readl(scr_addr + sil24_scr_map[sc_reg] * 4); - } - return 0xffffffffU; -} - -static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) -{ - void *scr_addr = (void *)ap->ioaddr.scr_addr; - if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { - void *addr; - addr = scr_addr + sil24_scr_map[sc_reg] * 4; - writel(val, scr_addr + sil24_scr_map[sc_reg] * 4); - } -} - -static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf) -{ - struct sil24_port_priv *pp = ap->private_data; - *tf = pp->tf; -} - -static void sil24_phy_reset(struct ata_port *ap) -{ - __sata_phy_reset(ap); - /* - * No ATAPI yet. Just unconditionally indicate ATA device. - * If ATAPI device is attached, it will fail ATA_CMD_ID_ATA - * and libata core will ignore the device. - */ - if (!(ap->flags & ATA_FLAG_PORT_DISABLED)) - ap->device[0].class = ATA_DEV_ATA; -} - -static inline void sil24_fill_sg(struct ata_queued_cmd *qc, - struct sil24_cmd_block *cb) -{ - struct sil24_sge *sge = cb->sge; - struct scatterlist *sg; - unsigned int idx = 0; - - ata_for_each_sg(sg, qc) { - sge->addr = cpu_to_le64(sg_dma_address(sg)); - sge->cnt = cpu_to_le32(sg_dma_len(sg)); - if (ata_sg_is_last(sg, qc)) - sge->flags = cpu_to_le32(SGE_TRM); - else - sge->flags = 0; - - sge++; - idx++; - } -} - -static void sil24_qc_prep(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - struct sil24_port_priv *pp = ap->private_data; - struct sil24_cmd_block *cb = pp->cmd_block + qc->tag; - struct sil24_prb *prb = &cb->prb; - - switch (qc->tf.protocol) { - case ATA_PROT_PIO: - case ATA_PROT_DMA: - case ATA_PROT_NODATA: - break; - default: - /* ATAPI isn't supported yet */ - BUG(); - } - - ata_tf_to_fis(&qc->tf, prb->fis, 0); - - if (qc->flags & ATA_QCFLAG_DMAMAP) - sil24_fill_sg(qc, cb); -} - -static int sil24_qc_issue(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - void *port = (void *)ap->ioaddr.cmd_addr; - struct sil24_port_priv *pp = ap->private_data; - dma_addr_t paddr = pp->cmd_block_dma + qc->tag * sizeof(*pp->cmd_block); - - writel((u32)paddr, port + PORT_CMD_ACTIVATE); - return 0; -} - -static void sil24_irq_clear(struct ata_port *ap) -{ - /* unused */ -} - -static int __sil24_reset_controller(void *port) -{ - int cnt; - u32 tmp; - - /* Reset controller state. Is this correct? */ - writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); - readl(port + PORT_CTRL_STAT); /* sync */ - - /* Max ~100ms */ - for (cnt = 0; cnt < 1000; cnt++) { - udelay(100); - tmp = readl(port + PORT_CTRL_STAT); - if (!(tmp & PORT_CS_DEV_RST)) - break; - } - - if (tmp & PORT_CS_DEV_RST) - return -1; - return 0; -} - -static void sil24_reset_controller(struct ata_port *ap) -{ - printk(KERN_NOTICE DRV_NAME - " ata%u: resetting controller...\n", ap->id); - if (__sil24_reset_controller((void *)ap->ioaddr.cmd_addr)) - printk(KERN_ERR DRV_NAME - " ata%u: failed to reset controller\n", ap->id); -} - -static void sil24_eng_timeout(struct ata_port *ap) -{ - struct ata_queued_cmd *qc; - - qc = ata_qc_from_tag(ap, ap->active_tag); - if (!qc) { - printk(KERN_ERR "ata%u: BUG: tiemout without command\n", - ap->id); - return; - } - - /* - * hack alert! We cannot use the supplied completion - * function from inside the ->eh_strategy_handler() thread. - * libata is the only user of ->eh_strategy_handler() in - * any kernel, so the default scsi_done() assumes it is - * not being called from the SCSI EH. - */ - printk(KERN_ERR "ata%u: command timeout\n", ap->id); - qc->scsidone = scsi_finish_command; - ata_qc_complete(qc, ATA_ERR); - - sil24_reset_controller(ap); -} - -static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) -{ - struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); - struct sil24_port_priv *pp = ap->private_data; - void *port = (void *)ap->ioaddr.cmd_addr; - u32 irq_stat, cmd_err, sstatus, serror; - - irq_stat = readl(port + PORT_IRQ_STAT); - writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */ - - if (!(irq_stat & PORT_IRQ_ERROR)) { - /* ignore non-completion, non-error irqs for now */ - printk(KERN_WARNING DRV_NAME - "ata%u: non-error exception irq (irq_stat %x)\n", - ap->id, irq_stat); - return; - } - - cmd_err = readl(port + PORT_CMD_ERR); - sstatus = readl(port + PORT_SSTATUS); - serror = readl(port + PORT_SERROR); - if (serror) - writel(serror, port + PORT_SERROR); - - printk(KERN_ERR DRV_NAME " ata%u: error interrupt on port%d\n" - " stat=0x%x irq=0x%x cmd_err=%d sstatus=0x%x serror=0x%x\n", - ap->id, ap->port_no, slot_stat, irq_stat, cmd_err, sstatus, serror); - - if (cmd_err == PORT_CERR_DEV || cmd_err == PORT_CERR_SDB) { - /* - * Device is reporting error, tf registers are valid. - */ - sil24_update_tf(ap); - } else { - /* - * Other errors. libata currently doesn't have any - * mechanism to report these errors. Just turn on - * ATA_ERR. - */ - pp->tf.command = ATA_ERR; - } - - if (qc) - ata_qc_complete(qc, pp->tf.command); - - sil24_reset_controller(ap); -} - -static inline void sil24_host_intr(struct ata_port *ap) -{ - struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); - void *port = (void *)ap->ioaddr.cmd_addr; - u32 slot_stat; - - slot_stat = readl(port + PORT_SLOT_STAT); - if (!(slot_stat & HOST_SSTAT_ATTN)) { - struct sil24_port_priv *pp = ap->private_data; - /* - * !HOST_SSAT_ATTN guarantees successful completion, - * so reading back tf registers is unnecessary for - * most commands. TODO: read tf registers for - * commands which require these values on successful - * completion (EXECUTE DEVICE DIAGNOSTIC, CHECK POWER, - * DEVICE RESET and READ PORT MULTIPLIER (any more?). - */ - sil24_update_tf(ap); - - if (qc) - ata_qc_complete(qc, pp->tf.command); - } else - sil24_error_intr(ap, slot_stat); -} - -static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs) -{ - struct ata_host_set *host_set = dev_instance; - struct sil24_host_priv *hpriv = host_set->private_data; - unsigned handled = 0; - u32 status; - int i; - - status = readl(hpriv->host_base + HOST_IRQ_STAT); - - if (status == 0xffffffff) { - printk(KERN_ERR DRV_NAME ": IRQ status == 0xffffffff, " - "PCI fault or device removal?\n"); - goto out; - } - - if (!(status & IRQ_STAT_4PORTS)) - goto out; - - spin_lock(&host_set->lock); - - for (i = 0; i < host_set->n_ports; i++) - if (status & (1 << i)) { - struct ata_port *ap = host_set->ports[i]; - if (ap && !(ap->flags & ATA_FLAG_PORT_DISABLED)) { - sil24_host_intr(host_set->ports[i]); - handled++; - } else - printk(KERN_ERR DRV_NAME - ": interrupt from disabled port %d\n", i); - } - - spin_unlock(&host_set->lock); - out: - return IRQ_RETVAL(handled); -} - -static int sil24_port_start(struct ata_port *ap) -{ - struct device *dev = ap->host_set->dev; - struct sil24_port_priv *pp; - struct sil24_cmd_block *cb; - size_t cb_size = sizeof(*cb); - dma_addr_t cb_dma; - - pp = kmalloc(sizeof(*pp), GFP_KERNEL); - if (!pp) - return -ENOMEM; - memset(pp, 0, sizeof(*pp)); - - pp->tf.command = ATA_DRDY; - - cb = dma_alloc_coherent(dev, cb_size, &cb_dma, GFP_KERNEL); - if (!cb) { - kfree(pp); - return -ENOMEM; - } - memset(cb, 0, cb_size); - - pp->cmd_block = cb; - pp->cmd_block_dma = cb_dma; - - ap->private_data = pp; - - return 0; -} - -static void sil24_port_stop(struct ata_port *ap) -{ - struct device *dev = ap->host_set->dev; - struct sil24_port_priv *pp = ap->private_data; - size_t cb_size = sizeof(*pp->cmd_block); - - dma_free_coherent(dev, cb_size, pp->cmd_block, pp->cmd_block_dma); - kfree(pp); -} - -static void sil24_host_stop(struct ata_host_set *host_set) -{ - struct sil24_host_priv *hpriv = host_set->private_data; - - iounmap(hpriv->host_base); - iounmap(hpriv->port_base); - kfree(hpriv); -} - -static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - static int printed_version = 0; - unsigned int board_id = (unsigned int)ent->driver_data; - struct ata_port_info *pinfo = &sil24_port_info[board_id]; - struct ata_probe_ent *probe_ent = NULL; - struct sil24_host_priv *hpriv = NULL; - void *host_base = NULL, *port_base = NULL; - int i, rc; - - if (!printed_version++) - printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); - - rc = pci_enable_device(pdev); - if (rc) - return rc; - - rc = pci_request_regions(pdev, DRV_NAME); - if (rc) - goto out_disable; - - rc = -ENOMEM; - /* ioremap mmio registers */ - host_base = ioremap(pci_resource_start(pdev, 0), - pci_resource_len(pdev, 0)); - if (!host_base) - goto out_free; - port_base = ioremap(pci_resource_start(pdev, 2), - pci_resource_len(pdev, 2)); - if (!port_base) - goto out_free; - - /* allocate & init probe_ent and hpriv */ - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); - if (!probe_ent) - goto out_free; - - hpriv = kmalloc(sizeof(*hpriv), GFP_KERNEL); - if (!hpriv) - goto out_free; - - memset(probe_ent, 0, sizeof(*probe_ent)); - probe_ent->dev = pci_dev_to_dev(pdev); - INIT_LIST_HEAD(&probe_ent->node); - - probe_ent->sht = pinfo->sht; - probe_ent->host_flags = pinfo->host_flags; - probe_ent->pio_mask = pinfo->pio_mask; - probe_ent->udma_mask = pinfo->udma_mask; - probe_ent->port_ops = pinfo->port_ops; - probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->host_flags); - - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; - probe_ent->mmio_base = port_base; - probe_ent->private_data = hpriv; - - memset(hpriv, 0, sizeof(*hpriv)); - hpriv->host_base = host_base; - hpriv->port_base = port_base; - - /* - * Configure the device - */ - /* - * FIXME: This device is certainly 64-bit capable. We just - * don't know how to use it. After fixing 32bit activation in - * this function, enable 64bit masks here. - */ - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); - if (rc) { - printk(KERN_ERR DRV_NAME "(%s): 32-bit DMA enable failed\n", - pci_name(pdev)); - goto out_free; - } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); - if (rc) { - printk(KERN_ERR DRV_NAME "(%s): 32-bit consistent DMA enable failed\n", - pci_name(pdev)); - goto out_free; - } - - /* GPIO off */ - writel(0, host_base + HOST_FLASH_CMD); - - /* Mask interrupts during initialization */ - writel(0, host_base + HOST_CTRL); - - for (i = 0; i < probe_ent->n_ports; i++) { - void *port = port_base + i * PORT_REGS_SIZE; - unsigned long portu = (unsigned long)port; - u32 tmp; - int cnt; - - probe_ent->port[i].cmd_addr = portu + PORT_PRB; - probe_ent->port[i].scr_addr = portu + PORT_SCONTROL; - - ata_std_ports(&probe_ent->port[i]); - - /* Initial PHY setting */ - writel(0x20c, port + PORT_PHY_CFG); - - /* Clear port RST */ - tmp = readl(port + PORT_CTRL_STAT); - if (tmp & PORT_CS_PORT_RST) { - writel(PORT_CS_PORT_RST, port + PORT_CTRL_CLR); - readl(port + PORT_CTRL_STAT); /* sync */ - for (cnt = 0; cnt < 10; cnt++) { - msleep(10); - tmp = readl(port + PORT_CTRL_STAT); - if (!(tmp & PORT_CS_PORT_RST)) - break; - } - if (tmp & PORT_CS_PORT_RST) - printk(KERN_ERR DRV_NAME - "(%s): failed to clear port RST\n", - pci_name(pdev)); - } - - /* Zero error counters. */ - writel(0x8000, port + PORT_DECODE_ERR_THRESH); - writel(0x8000, port + PORT_CRC_ERR_THRESH); - writel(0x8000, port + PORT_HSHK_ERR_THRESH); - writel(0x0000, port + PORT_DECODE_ERR_CNT); - writel(0x0000, port + PORT_CRC_ERR_CNT); - writel(0x0000, port + PORT_HSHK_ERR_CNT); - - /* FIXME: 32bit activation? */ - writel(0, port + PORT_ACTIVATE_UPPER_ADDR); - writel(PORT_CS_32BIT_ACTV, port + PORT_CTRL_STAT); - - /* Configure interrupts */ - writel(0xffff, port + PORT_IRQ_ENABLE_CLR); - writel(PORT_IRQ_COMPLETE | PORT_IRQ_ERROR | PORT_IRQ_SDB_FIS, - port + PORT_IRQ_ENABLE_SET); - - /* Clear interrupts */ - writel(0x0fff0fff, port + PORT_IRQ_STAT); - writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR); - - /* Clear port multiplier enable and resume bits */ - writel(PORT_CS_PM_EN | PORT_CS_RESUME, port + PORT_CTRL_CLR); - - /* Reset itself */ - if (__sil24_reset_controller(port)) - printk(KERN_ERR DRV_NAME - "(%s): failed to reset controller\n", - pci_name(pdev)); - } - - /* Turn on interrupts */ - writel(IRQ_STAT_4PORTS, host_base + HOST_CTRL); - - pci_set_master(pdev); - - /* FIXME: check ata_device_add return value */ - ata_device_add(probe_ent); - - kfree(probe_ent); - return 0; - - out_free: - if (host_base) - iounmap(host_base); - if (port_base) - iounmap(port_base); - kfree(probe_ent); - kfree(hpriv); - pci_release_regions(pdev); - out_disable: - pci_disable_device(pdev); - return rc; -} - -static int __init sil24_init(void) -{ - return pci_module_init(&sil24_pci_driver); -} - -static void __exit sil24_exit(void) -{ - pci_unregister_driver(&sil24_pci_driver); -} - -MODULE_AUTHOR("Tejun Heo"); -MODULE_DESCRIPTION("Silicon Image 3124/3132 SATA low-level driver"); -MODULE_LICENSE("GPL"); -MODULE_DEVICE_TABLE(pci, sil24_pci_tbl); - -module_init(sil24_init); -module_exit(sil24_exit); diff --git a/trunk/drivers/scsi/sata_sis.c b/trunk/drivers/scsi/sata_sis.c index 0761a3234fcf..b227e51d12f4 100644 --- a/trunk/drivers/scsi/sata_sis.c +++ b/trunk/drivers/scsi/sata_sis.c @@ -263,7 +263,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_regions; ppi = &sis_port_info; - probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; diff --git a/trunk/drivers/scsi/sata_sx4.c b/trunk/drivers/scsi/sata_sx4.c index 79fdbbab513e..540a85191172 100644 --- a/trunk/drivers/scsi/sata_sx4.c +++ b/trunk/drivers/scsi/sata_sx4.c @@ -449,14 +449,14 @@ static inline void pdc20621_host_pkt(struct ata_taskfile *tf, u8 *buf, static void pdc20621_dma_prep(struct ata_queued_cmd *qc) { - struct scatterlist *sg; + struct scatterlist *sg = qc->sg; struct ata_port *ap = qc->ap; struct pdc_port_priv *pp = ap->private_data; void __iomem *mmio = ap->host_set->mmio_base; struct pdc_host_priv *hpriv = ap->host_set->private_data; void __iomem *dimm_mmio = hpriv->dimm_mmio; unsigned int portno = ap->port_no; - unsigned int i, idx, total_len = 0, sgt_len; + unsigned int i, last, idx, total_len = 0, sgt_len; u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ]; assert(qc->flags & ATA_QCFLAG_DMAMAP); @@ -469,11 +469,12 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc) /* * Build S/G table */ + last = qc->n_elem; idx = 0; - ata_for_each_sg(sg, qc) { - buf[idx++] = cpu_to_le32(sg_dma_address(sg)); - buf[idx++] = cpu_to_le32(sg_dma_len(sg)); - total_len += sg_dma_len(sg); + for (i = 0; i < last; i++) { + buf[idx++] = cpu_to_le32(sg_dma_address(&sg[i])); + buf[idx++] = cpu_to_le32(sg_dma_len(&sg[i])); + total_len += sg_dma_len(&sg[i]); } buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT); sgt_len = idx * 4; diff --git a/trunk/drivers/scsi/sata_uli.c b/trunk/drivers/scsi/sata_uli.c index 9c06f2abe7f7..4c9fb8b71be1 100644 --- a/trunk/drivers/scsi/sata_uli.c +++ b/trunk/drivers/scsi/sata_uli.c @@ -202,7 +202,7 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_regions; ppi = &uli_port_info; - probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; diff --git a/trunk/drivers/scsi/sata_via.c b/trunk/drivers/scsi/sata_via.c index 565872479b9a..128b996b07b7 100644 --- a/trunk/drivers/scsi/sata_via.c +++ b/trunk/drivers/scsi/sata_via.c @@ -212,7 +212,7 @@ static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev) struct ata_probe_ent *probe_ent; struct ata_port_info *ppi = &svia_port_info; - probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) return NULL; diff --git a/trunk/drivers/scsi/scsi_scan.c b/trunk/drivers/scsi/scsi_scan.c index 327c5d7e5bd2..fcf9f6cbb142 100644 --- a/trunk/drivers/scsi/scsi_scan.c +++ b/trunk/drivers/scsi/scsi_scan.c @@ -587,7 +587,6 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, if (sdev->scsi_level >= 2 || (sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1)) sdev->scsi_level++; - sdev->sdev_target->scsi_level = sdev->scsi_level; return 0; } @@ -772,15 +771,6 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) return SCSI_SCAN_LUN_PRESENT; } -static inline void scsi_destroy_sdev(struct scsi_device *sdev) -{ - if (sdev->host->hostt->slave_destroy) - sdev->host->hostt->slave_destroy(sdev); - transport_destroy_device(&sdev->sdev_gendev); - put_device(&sdev->sdev_gendev); -} - - /** * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it * @starget: pointer to target device structure @@ -813,9 +803,9 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, * The rescan flag is used as an optimization, the first scan of a * host adapter calls into here with rescan == 0. */ - sdev = scsi_device_lookup_by_target(starget, lun); - if (sdev) { - if (rescan || sdev->sdev_state != SDEV_CREATED) { + if (rescan) { + sdev = scsi_device_lookup_by_target(starget, lun); + if (sdev) { SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: device exists on %s\n", sdev->sdev_gendev.bus_id)); @@ -830,9 +820,9 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, sdev->model); return SCSI_SCAN_LUN_PRESENT; } - scsi_device_put(sdev); - } else - sdev = scsi_alloc_sdev(starget, lun, hostdata); + } + + sdev = scsi_alloc_sdev(starget, lun, hostdata); if (!sdev) goto out; @@ -887,8 +877,12 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, res = SCSI_SCAN_NO_RESPONSE; } } - } else - scsi_destroy_sdev(sdev); + } else { + if (sdev->host->hostt->slave_destroy) + sdev->host->hostt->slave_destroy(sdev); + transport_destroy_device(&sdev->sdev_gendev); + put_device(&sdev->sdev_gendev); + } out: return res; } @@ -1060,7 +1054,7 @@ EXPORT_SYMBOL(int_to_scsilun); * 0: scan completed (or no memory, so further scanning is futile) * 1: no report lun scan, or not configured **/ -static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, +static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, int rescan) { char devname[64]; @@ -1073,8 +1067,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, struct scsi_lun *lunp, *lun_data; u8 *data; struct scsi_sense_hdr sshdr; - struct scsi_device *sdev; - struct Scsi_Host *shost = dev_to_shost(&starget->dev); + struct scsi_target *starget = scsi_target(sdev); /* * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. @@ -1082,23 +1075,15 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, * support more than 8 LUNs. */ if ((bflags & BLIST_NOREPORTLUN) || - starget->scsi_level < SCSI_2 || - (starget->scsi_level < SCSI_3 && - (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8)) ) + sdev->scsi_level < SCSI_2 || + (sdev->scsi_level < SCSI_3 && + (!(bflags & BLIST_REPORTLUN2) || sdev->host->max_lun <= 8)) ) return 1; if (bflags & BLIST_NOLUN) return 0; - if (!(sdev = scsi_device_lookup_by_target(starget, 0))) { - sdev = scsi_alloc_sdev(starget, 0, NULL); - if (!sdev) - return 0; - if (scsi_device_get(sdev)) - return 0; - } - sprintf(devname, "host %d channel %d id %d", - shost->host_no, sdev->channel, sdev->id); + sdev->host->host_no, sdev->channel, sdev->id); /* * Allocate enough to hold the header (the same size as one scsi_lun) @@ -1113,10 +1098,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, length = (max_scsi_report_luns + 1) * sizeof(struct scsi_lun); lun_data = kmalloc(length, GFP_ATOMIC | (sdev->host->unchecked_isa_dma ? __GFP_DMA : 0)); - if (!lun_data) { - printk(ALLOC_FAILURE_MSG, __FUNCTION__); + if (!lun_data) goto out; - } scsi_cmd[0] = REPORT_LUNS; @@ -1218,6 +1201,10 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, for (i = 0; i < sizeof(struct scsi_lun); i++) printk("%02x", data[i]); printk(" has a LUN larger than currently supported.\n"); + } else if (lun == 0) { + /* + * LUN 0 has already been scanned. + */ } else if (lun > sdev->host->max_lun) { printk(KERN_WARNING "scsi: %s lun%d has a LUN larger" " than allowed by the host adapter\n", @@ -1240,13 +1227,13 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, } kfree(lun_data); + return 0; + out: - scsi_device_put(sdev); - if (sdev->sdev_state == SDEV_CREATED) - /* - * the sdev we used didn't appear in the report luns scan - */ - scsi_destroy_sdev(sdev); + /* + * We are out of memory, don't try scanning any further. + */ + printk(ALLOC_FAILURE_MSG, __FUNCTION__); return 0; } @@ -1312,6 +1299,7 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel, struct Scsi_Host *shost = dev_to_shost(parent); int bflags = 0; int res; + struct scsi_device *sdev = NULL; struct scsi_target *starget; if (shost->this_id == id) @@ -1337,16 +1325,27 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel, * Scan LUN 0, if there is some response, scan further. Ideally, we * would not configure LUN 0 until all LUNs are scanned. */ - res = scsi_probe_and_add_lun(starget, 0, &bflags, NULL, rescan, NULL); - if (res == SCSI_SCAN_LUN_PRESENT || res == SCSI_SCAN_TARGET_PRESENT) { - if (scsi_report_lun_scan(starget, bflags, rescan) != 0) + res = scsi_probe_and_add_lun(starget, 0, &bflags, &sdev, rescan, NULL); + if (res == SCSI_SCAN_LUN_PRESENT) { + if (scsi_report_lun_scan(sdev, bflags, rescan) != 0) /* * The REPORT LUN did not scan the target, * do a sequential scan. */ scsi_sequential_lun_scan(starget, bflags, - res, starget->scsi_level, rescan); + res, sdev->scsi_level, rescan); + } else if (res == SCSI_SCAN_TARGET_PRESENT) { + /* + * There's a target here, but lun 0 is offline so we + * can't use the report_lun scan. Fall back to a + * sequential lun scan with a bflags of SPARSELUN and + * a default scsi level of SCSI_2 + */ + scsi_sequential_lun_scan(starget, BLIST_SPARSELUN, + SCSI_SCAN_TARGET_PRESENT, SCSI_2, rescan); } + if (sdev) + scsi_device_put(sdev); out_reap: /* now determine if the target has any children at all @@ -1543,7 +1542,10 @@ void scsi_free_host_dev(struct scsi_device *sdev) { BUG_ON(sdev->id != sdev->host->this_id); - scsi_destroy_sdev(sdev); + if (sdev->host->hostt->slave_destroy) + sdev->host->hostt->slave_destroy(sdev); + transport_destroy_device(&sdev->sdev_gendev); + put_device(&sdev->sdev_gendev); } EXPORT_SYMBOL(scsi_free_host_dev); diff --git a/trunk/drivers/scsi/scsi_transport_sas.c b/trunk/drivers/scsi/scsi_transport_sas.c index 1d145d2f9a38..ff724bbe6611 100644 --- a/trunk/drivers/scsi/scsi_transport_sas.c +++ b/trunk/drivers/scsi/scsi_transport_sas.c @@ -628,16 +628,17 @@ sas_rphy_delete(struct sas_rphy *rphy) struct Scsi_Host *shost = dev_to_shost(parent->dev.parent); struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); - scsi_remove_target(dev); + transport_destroy_device(&rphy->dev); - transport_remove_device(dev); - device_del(dev); - transport_destroy_device(dev); + scsi_remove_target(&rphy->dev); spin_lock(&sas_host->lock); list_del(&rphy->list); spin_unlock(&sas_host->lock); + transport_remove_device(dev); + device_del(dev); + transport_destroy_device(dev); put_device(&parent->dev); } EXPORT_SYMBOL(sas_rphy_delete); diff --git a/trunk/drivers/scsi/sg.c b/trunk/drivers/scsi/sg.c index ad94367df430..4d09a6e4dd2e 100644 --- a/trunk/drivers/scsi/sg.c +++ b/trunk/drivers/scsi/sg.c @@ -2849,7 +2849,8 @@ sg_proc_init(void) struct proc_dir_entry *pdep; struct sg_proc_leaf * leaf; - sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL); + sg_proc_sgp = create_proc_entry(sg_proc_sg_dirname, + S_IFDIR | S_IRUGO | S_IXUGO, NULL); if (!sg_proc_sgp) return 1; for (k = 0; k < num_leaves; ++k) { diff --git a/trunk/drivers/serial/8250_pnp.c b/trunk/drivers/serial/8250_pnp.c index c2786fc41cc5..6b321e82cafb 100644 --- a/trunk/drivers/serial/8250_pnp.c +++ b/trunk/drivers/serial/8250_pnp.c @@ -272,8 +272,6 @@ static const struct pnp_device_id pnp_dev_table[] = { { "SUP1421", 0 }, /* SupraExpress 33.6 Data/Fax PnP modem */ { "SUP1590", 0 }, - /* SupraExpress 336i Sp ASVD */ - { "SUP1620", 0 }, /* SupraExpress 33.6 Data/Fax PnP modem */ { "SUP1760", 0 }, /* Phoebe Micro */ diff --git a/trunk/drivers/serial/clps711x.c b/trunk/drivers/serial/clps711x.c index 87ef368384fb..78c1f36ad9b7 100644 --- a/trunk/drivers/serial/clps711x.c +++ b/trunk/drivers/serial/clps711x.c @@ -98,7 +98,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re { struct uart_port *port = dev_id; struct tty_struct *tty = port->info->tty; - unsigned int status, ch, flg; + unsigned int status, ch, flg, ignored = 0; status = clps_readl(SYSFLG(port)); while (!(status & SYSFLG_URXFE)) { diff --git a/trunk/drivers/serial/imx.c b/trunk/drivers/serial/imx.c index bdb4e454b8b0..4c985e6b3784 100644 --- a/trunk/drivers/serial/imx.c +++ b/trunk/drivers/serial/imx.c @@ -73,7 +73,7 @@ struct imx_port { struct uart_port port; struct timer_list timer; unsigned int old_status; - int txirq,rxirq,rtsirq; + int txirq,rxirq; }; /* @@ -181,22 +181,6 @@ static void imx_start_tx(struct uart_port *port) imx_transmit_buffer(sport); } -static irqreturn_t imx_rtsint(int irq, void *dev_id, struct pt_regs *regs) -{ - struct imx_port *sport = (struct imx_port *)dev_id; - unsigned int val = USR1((u32)sport->port.membase)&USR1_RTSS; - unsigned long flags; - - spin_lock_irqsave(&sport->port.lock, flags); - - USR1((u32)sport->port.membase) = USR1_RTSD; - uart_handle_cts_change(&sport->port, !!val); - wake_up_interruptible(&sport->port.info->delta_msr_wait); - - spin_unlock_irqrestore(&sport->port.lock, flags); - return IRQ_HANDLED; -} - static irqreturn_t imx_txint(int irq, void *dev_id, struct pt_regs *regs) { struct imx_port *sport = (struct imx_port *)dev_id; @@ -399,24 +383,18 @@ static int imx_startup(struct uart_port *port) */ retval = request_irq(sport->rxirq, imx_rxint, 0, DRIVER_NAME, sport); - if (retval) goto error_out1; - - retval = request_irq(sport->txirq, imx_txint, 0, - DRIVER_NAME, sport); if (retval) goto error_out2; - retval = request_irq(sport->rtsirq, imx_rtsint, 0, - DRIVER_NAME, sport); - if (retval) goto error_out3; - set_irq_type(sport->rtsirq, IRQT_BOTHEDGE); + retval = request_irq(sport->txirq, imx_txint, 0, + "imx-uart", sport); + if (retval) goto error_out1; /* * Finally, clear and enable interrupts */ - USR1((u32)sport->port.membase) = USR1_RTSD; UCR1((u32)sport->port.membase) |= - (UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); + (UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_UARTEN); UCR2((u32)sport->port.membase) |= (UCR2_RXEN | UCR2_TXEN); /* @@ -428,11 +406,10 @@ static int imx_startup(struct uart_port *port) return 0; -error_out3: - free_irq(sport->txirq, sport); -error_out2: - free_irq(sport->rxirq, sport); error_out1: + free_irq(sport->rxirq, sport); +error_out2: + free_irq(sport->txirq, sport); return retval; } @@ -448,7 +425,6 @@ static void imx_shutdown(struct uart_port *port) /* * Free the interrupts */ - free_irq(sport->rtsirq, sport); free_irq(sport->txirq, sport); free_irq(sport->rxirq, sport); @@ -457,7 +433,7 @@ static void imx_shutdown(struct uart_port *port) */ UCR1((u32)sport->port.membase) &= - ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); + ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_UARTEN); } static void @@ -547,7 +523,7 @@ imx_set_termios(struct uart_port *port, struct termios *termios, * disable interrupts and drain transmitter */ old_ucr1 = UCR1((u32)sport->port.membase); - UCR1((u32)sport->port.membase) &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); + UCR1((u32)sport->port.membase) &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN); while ( !(USR2((u32)sport->port.membase) & USR2_TXDC)) barrier(); @@ -668,7 +644,6 @@ static struct imx_port imx_ports[] = { { .txirq = UART1_MINT_TX, .rxirq = UART1_MINT_RX, - .rtsirq = UART1_MINT_RTS, .port = { .type = PORT_IMX, .iotype = SERIAL_IO_MEM, @@ -684,7 +659,6 @@ static struct imx_port imx_ports[] = { }, { .txirq = UART2_MINT_TX, .rxirq = UART2_MINT_RX, - .rtsirq = UART2_MINT_RTS, .port = { .type = PORT_IMX, .iotype = SERIAL_IO_MEM, @@ -764,7 +738,7 @@ imx_console_write(struct console *co, const char *s, unsigned int count) UCR1((u32)sport->port.membase) = (old_ucr1 | UCR1_UARTCLKEN | UCR1_UARTEN) - & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); + & ~(UCR1_TXMPTYEN | UCR1_RRDYEN); UCR2((u32)sport->port.membase) = old_ucr2 | UCR2_TXEN; /* @@ -886,7 +860,7 @@ imx_console_setup(struct console *co, char *options) return uart_set_options(&sport->port, co, baud, parity, bits, flow); } -static struct uart_driver imx_reg; +extern struct uart_driver imx_reg; static struct console imx_console = { .name = "ttySMX", .write = imx_console_write, diff --git a/trunk/drivers/serial/ioc4_serial.c b/trunk/drivers/serial/ioc4_serial.c index f88fdd480685..0c5c96a582b3 100644 --- a/trunk/drivers/serial/ioc4_serial.c +++ b/trunk/drivers/serial/ioc4_serial.c @@ -973,6 +973,18 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) this_ir &= ~this_mir; } } + if (this_ir) { + printk(KERN_ERR + "unknown IOC4 %s interrupt 0x%x, sio_ir = 0x%x," + " sio_ies = 0x%x, other_ir = 0x%x :" + "other_ies = 0x%x\n", + (intr_type == IOC4_SIO_INTR_TYPE) ? "sio" : + "other", this_ir, + readl(&soft->is_ioc4_misc_addr->sio_ir.raw), + readl(&soft->is_ioc4_misc_addr->sio_ies.raw), + readl(&soft->is_ioc4_misc_addr->other_ir.raw), + readl(&soft->is_ioc4_misc_addr->other_ies.raw)); + } } #ifdef DEBUG_INTERRUPTS { diff --git a/trunk/drivers/serial/pxa.c b/trunk/drivers/serial/pxa.c index 90c2a86c421b..672b359b07ce 100644 --- a/trunk/drivers/serial/pxa.c +++ b/trunk/drivers/serial/pxa.c @@ -499,7 +499,7 @@ serial_pxa_set_termios(struct uart_port *port, struct termios *termios, /* * Update the per-port timeout. */ - uart_update_timeout(port, termios->c_cflag, baud); + uart_update_timeout(port, termios->c_cflag, quot); up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; if (termios->c_iflag & INPCK) diff --git a/trunk/drivers/serial/s3c2410.c b/trunk/drivers/serial/s3c2410.c index 52692aa345ec..c361c6fb0809 100644 --- a/trunk/drivers/serial/s3c2410.c +++ b/trunk/drivers/serial/s3c2410.c @@ -82,6 +82,8 @@ #include #include +#include + /* structures */ struct s3c24xx_uart_info { @@ -751,8 +753,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, { struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port); struct s3c24xx_uart_port *ourport = to_ourport(port); - struct s3c24xx_uart_clksrc *clksrc = NULL; - struct clk *clk = NULL; + struct s3c24xx_uart_clksrc *clksrc; + struct clk *clk; unsigned long flags; unsigned int baud, quot; unsigned int ulcon; @@ -1092,8 +1094,8 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, static int probe_index = 0; -static int s3c24xx_serial_probe(struct device *_dev, - struct s3c24xx_uart_info *info) +int s3c24xx_serial_probe(struct device *_dev, + struct s3c24xx_uart_info *info) { struct s3c24xx_uart_port *ourport; struct platform_device *dev = to_platform_device(_dev); @@ -1120,7 +1122,7 @@ static int s3c24xx_serial_probe(struct device *_dev, return ret; } -static int s3c24xx_serial_remove(struct device *_dev) +int s3c24xx_serial_remove(struct device *_dev) { struct uart_port *port = s3c24xx_dev_to_port(_dev); @@ -1134,8 +1136,7 @@ static int s3c24xx_serial_remove(struct device *_dev) #ifdef CONFIG_PM -static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state, - u32 level) +int s3c24xx_serial_suspend(struct device *dev, pm_message_t state, u32 level) { struct uart_port *port = s3c24xx_dev_to_port(dev); @@ -1145,7 +1146,7 @@ static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state, return 0; } -static int s3c24xx_serial_resume(struct device *dev, u32 level) +int s3c24xx_serial_resume(struct device *dev, u32 level) { struct uart_port *port = s3c24xx_dev_to_port(dev); struct s3c24xx_uart_port *ourport = to_ourport(port); @@ -1166,8 +1167,8 @@ static int s3c24xx_serial_resume(struct device *dev, u32 level) #define s3c24xx_serial_resume NULL #endif -static int s3c24xx_serial_init(struct device_driver *drv, - struct s3c24xx_uart_info *info) +int s3c24xx_serial_init(struct device_driver *drv, + struct s3c24xx_uart_info *info) { dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); return driver_register(drv); @@ -1236,7 +1237,6 @@ static int s3c2400_serial_probe(struct device *dev) static struct device_driver s3c2400_serial_drv = { .name = "s3c2400-uart", - .owner = THIS_MODULE, .bus = &platform_bus_type, .probe = s3c2400_serial_probe, .remove = s3c24xx_serial_remove, @@ -1340,7 +1340,6 @@ static int s3c2410_serial_probe(struct device *dev) static struct device_driver s3c2410_serial_drv = { .name = "s3c2410-uart", - .owner = THIS_MODULE, .bus = &platform_bus_type, .probe = s3c2410_serial_probe, .remove = s3c24xx_serial_remove, @@ -1502,7 +1501,6 @@ static int s3c2440_serial_probe(struct device *dev) static struct device_driver s3c2440_serial_drv = { .name = "s3c2440-uart", - .owner = THIS_MODULE, .bus = &platform_bus_type, .probe = s3c2440_serial_probe, .remove = s3c24xx_serial_remove, diff --git a/trunk/drivers/serial/serial_cs.c b/trunk/drivers/serial/serial_cs.c index 2c7d3ef76e8e..1ae0b381c162 100644 --- a/trunk/drivers/serial/serial_cs.c +++ b/trunk/drivers/serial/serial_cs.c @@ -859,7 +859,6 @@ static struct pcmcia_device_id serial_ids[] = { PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0175, 0x0000, "DP83903.cis"), PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "3CXEM556.cis"), PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "3CXEM556.cis"), - PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0x0710, "SW_7xx_SER.cis"), /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */ PCMCIA_DEVICE_CIS_PROD_ID12("MultiTech", "PCMCIA 56K DataFax", 0x842047ee, 0xc2efcf03, "MT5634ZLX.cis"), PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "COMpad4.cis"), PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"), diff --git a/trunk/drivers/serial/sh-sci.c b/trunk/drivers/serial/sh-sci.c index 430754ebac8a..512266307866 100644 --- a/trunk/drivers/serial/sh-sci.c +++ b/trunk/drivers/serial/sh-sci.c @@ -967,7 +967,7 @@ static int sci_startup(struct uart_port *port) #endif sci_request_irq(s); - sci_start_tx(port); + sci_start_tx(port, 1); sci_start_rx(port, 1); return 0; diff --git a/trunk/drivers/serial/sunsab.c b/trunk/drivers/serial/sunsab.c index ba9381fd3f2d..e971156daa60 100644 --- a/trunk/drivers/serial/sunsab.c +++ b/trunk/drivers/serial/sunsab.c @@ -274,6 +274,7 @@ static void transmit_chars(struct uart_sunsab_port *up, if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { up->interrupt_mask1 |= SAB82532_IMR1_XPR; writeb(up->interrupt_mask1, &up->regs->w.imr1); + uart_write_wakeup(&up->port); return; } diff --git a/trunk/drivers/serial/sunsu.c b/trunk/drivers/serial/sunsu.c index 656c0e8d160e..5959e6755a81 100644 --- a/trunk/drivers/serial/sunsu.c +++ b/trunk/drivers/serial/sunsu.c @@ -518,7 +518,11 @@ static void sunsu_change_mouse_baud(struct uart_sunsu_port *up) quot = up->port.uartclk / (16 * new_baud); + spin_unlock(&up->port.lock); + sunsu_change_speed(&up->port, up->cflag, 0, quot); + + spin_lock(&up->port.lock); } static void receive_kbd_ms_chars(struct uart_sunsu_port *up, struct pt_regs *regs, int is_break) diff --git a/trunk/drivers/serial/sunzilog.c b/trunk/drivers/serial/sunzilog.c index 7653d6cf05af..d75445738c88 100644 --- a/trunk/drivers/serial/sunzilog.c +++ b/trunk/drivers/serial/sunzilog.c @@ -517,9 +517,10 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up, if (up->port.info == NULL) goto ack_tx_int; xmit = &up->port.info->xmit; - if (uart_circ_empty(xmit)) + if (uart_circ_empty(xmit)) { + uart_write_wakeup(&up->port); goto ack_tx_int; - + } if (uart_tx_stopped(&up->port)) goto ack_tx_int; diff --git a/trunk/drivers/usb/core/devio.c b/trunk/drivers/usb/core/devio.c index 487ff672b104..b4265aa7d45e 100644 --- a/trunk/drivers/usb/core/devio.c +++ b/trunk/drivers/usb/core/devio.c @@ -30,8 +30,6 @@ * Revision history * 22.12.1999 0.1 Initial release (split from proc_usb.c) * 04.01.2000 0.2 Turned into its own filesystem - * 30.09.2005 0.3 Fix user-triggerable oops in async URB delivery - * (CAN-2005-3055) */ /*****************************************************************************/ @@ -60,8 +58,7 @@ static struct class *usb_device_class; struct async { struct list_head asynclist; struct dev_state *ps; - pid_t pid; - uid_t uid, euid; + struct task_struct *task; unsigned int signr; unsigned int ifnum; void __user *userbuffer; @@ -293,8 +290,7 @@ static void async_completed(struct urb *urb, struct pt_regs *regs) sinfo.si_errno = as->urb->status; sinfo.si_code = SI_ASYNCIO; sinfo.si_addr = as->userurb; - kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid, - as->euid); + send_sig_info(as->signr, &sinfo, as->task); } wake_up(&ps->wait); } @@ -530,9 +526,7 @@ static int usbdev_open(struct inode *inode, struct file *file) INIT_LIST_HEAD(&ps->async_completed); init_waitqueue_head(&ps->wait); ps->discsignr = 0; - ps->disc_pid = current->pid; - ps->disc_uid = current->uid; - ps->disc_euid = current->euid; + ps->disctask = current; ps->disccontext = NULL; ps->ifclaimed = 0; wmb(); @@ -994,9 +988,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, as->userbuffer = NULL; as->signr = uurb->signr; as->ifnum = ifnum; - as->pid = current->pid; - as->uid = current->uid; - as->euid = current->euid; + as->task = current; if (!(uurb->endpoint & USB_DIR_IN)) { if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) { free_async(as); diff --git a/trunk/drivers/usb/core/hcd-pci.c b/trunk/drivers/usb/core/hcd-pci.c index 6385d1a99b60..cbb451d227d2 100644 --- a/trunk/drivers/usb/core/hcd-pci.c +++ b/trunk/drivers/usb/core/hcd-pci.c @@ -242,6 +242,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) case HC_STATE_SUSPENDED: /* no DMA or IRQs except when HC is active */ if (dev->current_state == PCI_D0) { + free_irq (hcd->irq, hcd); pci_save_state (dev); pci_disable_device (dev); } @@ -373,6 +374,14 @@ int usb_hcd_pci_resume (struct pci_dev *dev) hcd->state = HC_STATE_RESUMING; hcd->saw_irq = 0; + retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ, + hcd->irq_descr, hcd); + if (retval < 0) { + dev_err (hcd->self.controller, + "can't restore IRQ after resume!\n"); + usb_hc_died (hcd); + return retval; + } retval = hcd->driver->resume (hcd); if (!HC_IS_RUNNING (hcd->state)) { diff --git a/trunk/drivers/usb/core/inode.c b/trunk/drivers/usb/core/inode.c index d07bba01995b..640f41e47029 100644 --- a/trunk/drivers/usb/core/inode.c +++ b/trunk/drivers/usb/core/inode.c @@ -713,7 +713,7 @@ void usbfs_remove_device(struct usb_device *dev) sinfo.si_errno = EPIPE; sinfo.si_code = SI_ASYNCIO; sinfo.si_addr = ds->disccontext; - kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid); + send_sig_info(ds->discsignr, &sinfo, ds->disctask); } } usbfs_update_special(); diff --git a/trunk/drivers/usb/core/usb.h b/trunk/drivers/usb/core/usb.h index e6504f3370ad..83d48c8133af 100644 --- a/trunk/drivers/usb/core/usb.h +++ b/trunk/drivers/usb/core/usb.h @@ -52,8 +52,7 @@ struct dev_state { struct list_head async_completed; wait_queue_head_t wait; /* wake up if a request completed */ unsigned int discsignr; - pid_t disc_pid; - uid_t disc_uid, disc_euid; + struct task_struct *disctask; void __user *disccontext; unsigned long ifclaimed; }; diff --git a/trunk/drivers/usb/host/isp116x-hcd.c b/trunk/drivers/usb/host/isp116x-hcd.c index e142056b0d2c..41bbae83fc71 100644 --- a/trunk/drivers/usb/host/isp116x-hcd.c +++ b/trunk/drivers/usb/host/isp116x-hcd.c @@ -326,8 +326,7 @@ static void postproc_atl_queue(struct isp116x *isp116x) usb_settoggle(udev, ep->epnum, ep->nextpid == USB_PID_OUT, - PTD_GET_TOGGLE(ptd)); - urb->actual_length += PTD_GET_COUNT(ptd); + PTD_GET_TOGGLE(ptd) ^ 1); urb->status = cc_to_error[TD_DATAUNDERRUN]; spin_unlock(&urb->lock); continue; diff --git a/trunk/drivers/usb/host/ohci-lh7a404.c b/trunk/drivers/usb/host/ohci-lh7a404.c index 859aca7be753..817620d73841 100644 --- a/trunk/drivers/usb/host/ohci-lh7a404.c +++ b/trunk/drivers/usb/host/ohci-lh7a404.c @@ -17,6 +17,8 @@ */ #include +#include +#include extern int usb_disabled(void); diff --git a/trunk/drivers/usb/host/ohci-omap.c b/trunk/drivers/usb/host/ohci-omap.c index d8f3ba7ad52e..5cde76faab93 100644 --- a/trunk/drivers/usb/host/ohci-omap.c +++ b/trunk/drivers/usb/host/ohci-omap.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/trunk/drivers/usb/host/ohci-s3c2410.c b/trunk/drivers/usb/host/ohci-s3c2410.c index da7d5478f74d..3d9bcf78a9a4 100644 --- a/trunk/drivers/usb/host/ohci-s3c2410.c +++ b/trunk/drivers/usb/host/ohci-s3c2410.c @@ -20,6 +20,7 @@ */ #include +#include #include #include diff --git a/trunk/drivers/usb/input/hid-core.c b/trunk/drivers/usb/input/hid-core.c index 41f92b924761..a99865c689c5 100644 --- a/trunk/drivers/usb/input/hid-core.c +++ b/trunk/drivers/usb/input/hid-core.c @@ -1702,7 +1702,10 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) if ((endpoint->bmAttributes & 3) != 3) /* Not an interrupt endpoint */ continue; + /* handle potential highspeed HID correctly */ interval = endpoint->bInterval; + if (dev->speed == USB_SPEED_HIGH) + interval = 1 << (interval - 1); /* Change the polling interval of mice. */ if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) diff --git a/trunk/drivers/usb/media/vicam.c b/trunk/drivers/usb/media/vicam.c index 0bc0b1247a6b..4a5857c53f11 100644 --- a/trunk/drivers/usb/media/vicam.c +++ b/trunk/drivers/usb/media/vicam.c @@ -1148,7 +1148,7 @@ vicam_write_proc_gain(struct file *file, const char *buffer, static void vicam_create_proc_root(void) { - vicam_proc_root = proc_mkdir("video/vicam", NULL); + vicam_proc_root = create_proc_entry("video/vicam", S_IFDIR, 0); if (vicam_proc_root) vicam_proc_root->owner = THIS_MODULE; @@ -1181,7 +1181,7 @@ vicam_create_proc_entry(struct vicam_camera *cam) sprintf(name, "video%d", cam->vdev.minor); - cam->proc_dir = proc_mkdir(name, vicam_proc_root); + cam->proc_dir = create_proc_entry(name, S_IFDIR, vicam_proc_root); if ( !cam->proc_dir ) return; // FIXME: We should probably return an error here diff --git a/trunk/drivers/usb/serial/generic.c b/trunk/drivers/usb/serial/generic.c index 5f7d3193d355..ddde5fb13f6b 100644 --- a/trunk/drivers/usb/serial/generic.c +++ b/trunk/drivers/usb/serial/generic.c @@ -223,7 +223,7 @@ int usb_serial_generic_write_room (struct usb_serial_port *port) dbg("%s - port %d", __FUNCTION__, port->number); if (serial->num_bulk_out) { - if (!(port->write_urb_busy)) + if (port->write_urb_busy) room = port->bulk_out_size; } diff --git a/trunk/drivers/video/Kconfig b/trunk/drivers/video/Kconfig index 1cd942abb580..773ae11b4a19 100644 --- a/trunk/drivers/video/Kconfig +++ b/trunk/drivers/video/Kconfig @@ -768,7 +768,6 @@ config FB_INTEL select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT - select FB_SOFT_CURSOR help This driver supports the on-board graphics built in to the Intel 830M/845G/852GM/855GM/865G chipsets. diff --git a/trunk/drivers/video/aty/radeon_base.c b/trunk/drivers/video/aty/radeon_base.c index 8a24a66d9ba8..046b47860266 100644 --- a/trunk/drivers/video/aty/radeon_base.c +++ b/trunk/drivers/video/aty/radeon_base.c @@ -475,7 +475,7 @@ static int __devinit radeon_probe_pll_params(struct radeonfb_info *rinfo) */ /* Flush PCI buffers ? */ - tmp = INREG16(DEVICE_ID); + tmp = INREG(DEVICE_ID); local_irq_disable(); diff --git a/trunk/drivers/video/aty/radeon_pm.c b/trunk/drivers/video/aty/radeon_pm.c index 097d668c4fe5..59a1b6f85067 100644 --- a/trunk/drivers/video/aty/radeon_pm.c +++ b/trunk/drivers/video/aty/radeon_pm.c @@ -62,9 +62,9 @@ static void radeon_pm_disable_dynamic_mode(struct radeonfb_info *rinfo) OUTPLL(pllSCLK_CNTL, tmp); return; } - /* RV350 (M10/M11) */ + /* RV350 (M10) */ if (rinfo->family == CHIP_FAMILY_RV350) { - /* for RV350/M10/M11, no delays are required. */ + /* for RV350/M10, no delays are required. */ tmp = INPLL(pllSCLK_CNTL2); tmp |= (SCLK_CNTL2__R300_FORCE_TCL | SCLK_CNTL2__R300_FORCE_GA | @@ -248,7 +248,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo) return; } - /* M10/M11 */ + /* M10 */ if (rinfo->family == CHIP_FAMILY_RV350) { tmp = INPLL(pllSCLK_CNTL2); tmp &= ~(SCLK_CNTL2__R300_FORCE_TCL | @@ -1155,7 +1155,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) OUTREG( CRTC_GEN_CNTL, (crtcGenCntl | CRTC_GEN_CNTL__CRTC_DISP_REQ_EN_B) ); OUTREG( CRTC2_GEN_CNTL, (crtcGenCntl2 | CRTC2_GEN_CNTL__CRTC2_DISP_REQ_EN_B) ); - /* This is the code for the Aluminium PowerBooks M10 / iBooks M11 */ + /* This is the code for the Aluminium PowerBooks M10 */ if (rinfo->family == CHIP_FAMILY_RV350) { u32 sdram_mode_reg = rinfo->save_regs[35]; static u32 default_mrtable[] = @@ -2741,11 +2741,9 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) rinfo->pm_mode |= radeon_pm_d2; /* We can restart Jasper (M10 chip in albooks), BlueStone (7500 chip - * in some desktop G4s), Via (M9+ chip on iBook G4) and - * Snowy (M11 chip on iBook G4 manufactured after July 2005) + * in some desktop G4s), and Via (M9+ chip on iBook G4) */ - if (!strcmp(rinfo->of_node->name, "ATY,JasperParent") || - !strcmp(rinfo->of_node->name, "ATY,SnowyParent")) { + if (!strcmp(rinfo->of_node->name, "ATY,JasperParent")) { rinfo->reinit_func = radeon_reinitialize_M10; rinfo->pm_mode |= radeon_pm_off; } diff --git a/trunk/drivers/video/aty/radeonfb.h b/trunk/drivers/video/aty/radeonfb.h index 01b8b2f78514..659bc9f62244 100644 --- a/trunk/drivers/video/aty/radeonfb.h +++ b/trunk/drivers/video/aty/radeonfb.h @@ -395,8 +395,6 @@ static inline void _radeon_msleep(struct radeonfb_info *rinfo, unsigned long ms) #define INREG8(addr) readb((rinfo->mmio_base)+addr) #define OUTREG8(addr,val) writeb(val, (rinfo->mmio_base)+addr) -#define INREG16(addr) readw((rinfo->mmio_base)+addr) -#define OUTREG16(addr,val) writew(val, (rinfo->mmio_base)+addr) #define INREG(addr) readl((rinfo->mmio_base)+addr) #define OUTREG(addr,val) writel(val, (rinfo->mmio_base)+addr) diff --git a/trunk/drivers/video/aty/xlinit.c b/trunk/drivers/video/aty/xlinit.c index a085cbf74ecb..0bea0d8d7821 100644 --- a/trunk/drivers/video/aty/xlinit.c +++ b/trunk/drivers/video/aty/xlinit.c @@ -253,11 +253,9 @@ int atyfb_xl_init(struct fb_info *info) aty_st_le32(0xFC, 0x00000000, par); #if defined (CONFIG_FB_ATY_GENERIC_LCD) - { - int i; - - for (i = 0; i < ARRAY_SIZE(lcd_tbl); i++) - aty_st_lcd(lcd_tbl[i].lcd_reg, lcd_tbl[i].val, par); + int i; + for (i=0; i #include +#include #include #define CORGI_DEFAULT_INTENSITY 0x1f diff --git a/trunk/drivers/video/console/vgacon.c b/trunk/drivers/video/console/vgacon.c index 809fee2140ac..6ef6f7760e47 100644 --- a/trunk/drivers/video/console/vgacon.c +++ b/trunk/drivers/video/console/vgacon.c @@ -565,11 +565,7 @@ static int vgacon_switch(struct vc_data *c) scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size); - if (!(vga_video_num_columns % 2) && - vga_video_num_columns <= ORIG_VIDEO_COLS && - vga_video_num_lines <= (ORIG_VIDEO_LINES * - vga_default_font_height) / c->vc_font.height) - vgacon_doresize(c, c->vc_cols, c->vc_rows); + vgacon_doresize(c, c->vc_cols, c->vc_rows); } return 0; /* Redrawing not needed */ @@ -1027,8 +1023,7 @@ static int vgacon_resize(struct vc_data *c, unsigned int width, if (width % 2 || width > ORIG_VIDEO_COLS || height > (ORIG_VIDEO_LINES * vga_default_font_height)/ c->vc_font.height) - /* let svgatextmode tinker with video timings */ - return 0; + return -EINVAL; if (CON_IS_VISIBLE(c) && !vga_is_gfx) /* who knows */ vgacon_doresize(c, width, height); diff --git a/trunk/drivers/video/cyblafb.c b/trunk/drivers/video/cyblafb.c index 6992100a508c..ae2762cb5608 100644 --- a/trunk/drivers/video/cyblafb.c +++ b/trunk/drivers/video/cyblafb.c @@ -410,21 +410,20 @@ static void cyblafb_imageblit(struct fb_info *info, out32(GE0C,point(image->dx+image->width-1,image->dy+image->height-1)); while(index < index_end) { - const char *p = image->data + index; for(i=0;idata + index))); index+=4; } switch(width_dbs) { case 0: break; - case 8: out32(GE9C,*(u8*)p); + case 8: out32(GE9C,*((u8*)((u32)image->data+index))); index+=1; break; - case 16: out32(GE9C,*(u16*)p); + case 16: out32(GE9C,*((u16*)((u32)image->data+index))); index+=2; break; - case 24: out32(GE9C,*(u16*)p | *(u8*)(p+2)<<16); + case 24: out32(GE9C,(u32)(*((u16*)((u32)image->data+index))) | + (u32)(*((u8*)((u32)image->data+index+2)))<<16); index+=3; break; } diff --git a/trunk/drivers/video/i810/i810-i2c.c b/trunk/drivers/video/i810/i810-i2c.c index 689d2586366d..fda53aac1fc1 100644 --- a/trunk/drivers/video/i810/i810-i2c.c +++ b/trunk/drivers/video/i810/i810-i2c.c @@ -44,7 +44,7 @@ static void i810i2c_setscl(void *data, int state) { struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; struct i810fb_par *par = chan->par; - u8 __iomem *mmio = par->mmio_start_virtual; + u8 *mmio = par->mmio_start_virtual; i810_writel(mmio, GPIOB, (state ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK); @@ -55,7 +55,7 @@ static void i810i2c_setsda(void *data, int state) { struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; struct i810fb_par *par = chan->par; - u8 __iomem *mmio = par->mmio_start_virtual; + u8 *mmio = par->mmio_start_virtual; i810_writel(mmio, GPIOB, (state ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK); @@ -66,7 +66,7 @@ static int i810i2c_getscl(void *data) { struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; struct i810fb_par *par = chan->par; - u8 __iomem *mmio = par->mmio_start_virtual; + u8 *mmio = par->mmio_start_virtual; i810_writel(mmio, GPIOB, SCL_DIR_MASK); i810_writel(mmio, GPIOB, 0); @@ -77,7 +77,7 @@ static int i810i2c_getsda(void *data) { struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; struct i810fb_par *par = chan->par; - u8 __iomem *mmio = par->mmio_start_virtual; + u8 *mmio = par->mmio_start_virtual; i810_writel(mmio, GPIOB, SDA_DIR_MASK); i810_writel(mmio, GPIOB, 0); @@ -88,7 +88,7 @@ static void i810ddc_setscl(void *data, int state) { struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; struct i810fb_par *par = chan->par; - u8 __iomem *mmio = par->mmio_start_virtual; + u8 *mmio = par->mmio_start_virtual; i810_writel(mmio, GPIOA, (state ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK); @@ -99,7 +99,7 @@ static void i810ddc_setsda(void *data, int state) { struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; struct i810fb_par *par = chan->par; - u8 __iomem *mmio = par->mmio_start_virtual; + u8 *mmio = par->mmio_start_virtual; i810_writel(mmio, GPIOA, (state ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK); @@ -110,7 +110,7 @@ static int i810ddc_getscl(void *data) { struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; struct i810fb_par *par = chan->par; - u8 __iomem *mmio = par->mmio_start_virtual; + u8 *mmio = par->mmio_start_virtual; i810_writel(mmio, GPIOA, SCL_DIR_MASK); i810_writel(mmio, GPIOA, 0); @@ -121,7 +121,7 @@ static int i810ddc_getsda(void *data) { struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; struct i810fb_par *par = chan->par; - u8 __iomem *mmio = par->mmio_start_virtual; + u8 *mmio = par->mmio_start_virtual; i810_writel(mmio, GPIOA, SDA_DIR_MASK); i810_writel(mmio, GPIOA, 0); diff --git a/trunk/drivers/video/imxfb.c b/trunk/drivers/video/imxfb.c index 1d54d3d6960b..6c2244cf0e74 100644 --- a/trunk/drivers/video/imxfb.c +++ b/trunk/drivers/video/imxfb.c @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/trunk/drivers/video/intelfb/intelfbdrv.c b/trunk/drivers/video/intelfb/intelfbdrv.c index 80a09344f1aa..bf62e6ed0382 100644 --- a/trunk/drivers/video/intelfb/intelfbdrv.c +++ b/trunk/drivers/video/intelfb/intelfbdrv.c @@ -226,7 +226,7 @@ MODULE_DEVICE_TABLE(pci, intelfb_pci_table); static int accel = 1; static int vram = 4; -static int hwcursor = 0; +static int hwcursor = 1; static int mtrr = 1; static int fixed = 0; static int noinit = 0; @@ -609,9 +609,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) dinfo->accel = 0; } + if (MB(voffset) < stolen_size) + offset = (stolen_size >> 12); + else + offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE; + /* Framebuffer parameters - Use all the stolen memory if >= vram */ - if (ROUND_UP_TO_PAGE(stolen_size) >= MB(vram)) { + if (ROUND_UP_TO_PAGE(stolen_size) >= ((offset << 12) + MB(vram))) { dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size); + dinfo->fb.offset = 0; dinfo->fbmem_gart = 0; } else { dinfo->fb.size = MB(vram); @@ -642,11 +648,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) return -ENODEV; } - if (MB(voffset) < stolen_size) - offset = (stolen_size >> 12); - else - offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE; - /* set the mem offsets - set them after the already used pages */ if (dinfo->accel) { dinfo->ring.offset = offset + gtt_info.current_memory; @@ -661,11 +662,10 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) + (dinfo->cursor.size >> 12); } - /* Allocate memories (which aren't stolen) */ /* Map the fb and MMIO regions */ /* ioremap only up to the end of used aperture */ dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache - (dinfo->aperture.physical, ((offset + dinfo->fb.offset) << 12) + (dinfo->aperture.physical, (dinfo->fb.offset << 12) + dinfo->fb.size); if (!dinfo->aperture.virtual) { ERR_MSG("Cannot remap FB region.\n"); @@ -682,6 +682,7 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) return -ENODEV; } + /* Allocate memories (which aren't stolen) */ if (dinfo->accel) { if (!(dinfo->gtt_ring_mem = agp_allocate_memory(bridge, dinfo->ring.size >> 12, @@ -1483,7 +1484,7 @@ intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor) #endif if (!dinfo->hwcursor) - return soft_cursor(info, cursor); + return -ENXIO; intelfbhw_cursor_hide(dinfo); diff --git a/trunk/drivers/video/p9100.c b/trunk/drivers/video/p9100.c index b76a5a9a125b..7808a01493ad 100644 --- a/trunk/drivers/video/p9100.c +++ b/trunk/drivers/video/p9100.c @@ -288,9 +288,6 @@ static void p9100_init_one(struct sbus_dev *sdev) all->par.physbase = sdev->reg_addrs[2].phys_addr; sbusfb_fill_var(&all->info.var, sdev->prom_node, 8); - all->info.var.red.length = 8; - all->info.var.green.length = 8; - all->info.var.blue.length = 8; linebytes = prom_getintdefault(sdev->prom_node, "linebytes", all->info.var.xres); @@ -326,7 +323,6 @@ static void p9100_init_one(struct sbus_dev *sdev) kfree(all); return; } - fb_set_cmap(&all->info.cmap, &all->info); list_add(&all->list, &p9100_list); diff --git a/trunk/drivers/video/pxafb.c b/trunk/drivers/video/pxafb.c index 194eed0a238c..34d4dcc0320a 100644 --- a/trunk/drivers/video/pxafb.c +++ b/trunk/drivers/video/pxafb.c @@ -260,9 +260,9 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) } #ifdef CONFIG_CPU_FREQ - pr_debug("pxafb: dma period = %d ps, clock = %d kHz\n", - pxafb_display_dma_period(var), - get_clk_frequency_khz(0)); + DPRINTK("dma period = %d ps, clock = %d kHz\n", + pxafb_display_dma_period(var), + get_clk_frequency_khz(0)); #endif return 0; @@ -270,7 +270,7 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) static inline void pxafb_set_truecolor(u_int is_true_color) { - pr_debug("pxafb: true_color = %d\n", is_true_color); + DPRINTK("true_color = %d\n", is_true_color); // do your machine-specific setup if needed } @@ -284,7 +284,7 @@ static int pxafb_set_par(struct fb_info *info) struct fb_var_screeninfo *var = &info->var; unsigned long palette_mem_size; - pr_debug("pxafb: set_par\n"); + DPRINTK("set_par\n"); if (var->bits_per_pixel == 16) fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR; @@ -308,7 +308,7 @@ static int pxafb_set_par(struct fb_info *info) palette_mem_size = fbi->palette_size * sizeof(u16); - pr_debug("pxafb: palette_mem_size = 0x%08lx\n", palette_mem_size); + DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size); fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size); 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) struct pxafb_info *fbi = (struct pxafb_info *)info; int i; - pr_debug("pxafb: blank=%d\n", blank); + DPRINTK("pxafb_blank: blank=%d\n", blank); switch (blank) { case FB_BLANK_POWERDOWN: @@ -508,15 +508,15 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info * u_long flags; u_int lines_per_panel, pcd = get_pcd(var->pixclock); - pr_debug("pxafb: Configuring PXA LCD\n"); + DPRINTK("Configuring PXA LCD\n"); - pr_debug("var: xres=%d hslen=%d lm=%d rm=%d\n", - var->xres, var->hsync_len, - var->left_margin, var->right_margin); - pr_debug("var: yres=%d vslen=%d um=%d bm=%d\n", - var->yres, var->vsync_len, - var->upper_margin, var->lower_margin); - pr_debug("var: pixclock=%d pcd=%d\n", var->pixclock, pcd); + DPRINTK("var: xres=%d hslen=%d lm=%d rm=%d\n", + var->xres, var->hsync_len, + var->left_margin, var->right_margin); + DPRINTK("var: yres=%d vslen=%d um=%d bm=%d\n", + var->yres, var->vsync_len, + var->upper_margin, var->lower_margin); + DPRINTK("var: pixclock=%d pcd=%d\n", var->pixclock, pcd); #if DEBUG_VAR if (var->xres < 16 || var->xres > 1024) @@ -589,10 +589,10 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info * if (pcd) new_regs.lccr3 |= LCCR3_PixClkDiv(pcd); - pr_debug("nlccr0 = 0x%08x\n", new_regs.lccr0); - pr_debug("nlccr1 = 0x%08x\n", new_regs.lccr1); - pr_debug("nlccr2 = 0x%08x\n", new_regs.lccr2); - pr_debug("nlccr3 = 0x%08x\n", new_regs.lccr3); + DPRINTK("nlccr0 = 0x%08x\n", new_regs.lccr0); + DPRINTK("nlccr1 = 0x%08x\n", new_regs.lccr1); + DPRINTK("nlccr2 = 0x%08x\n", new_regs.lccr2); + DPRINTK("nlccr3 = 0x%08x\n", new_regs.lccr3); /* Update shadow copy atomically */ local_irq_save(flags); @@ -637,24 +637,24 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info * } #if 0 - pr_debug("fbi->dmadesc_fblow_cpu = 0x%p\n", fbi->dmadesc_fblow_cpu); - pr_debug("fbi->dmadesc_fbhigh_cpu = 0x%p\n", fbi->dmadesc_fbhigh_cpu); - pr_debug("fbi->dmadesc_palette_cpu = 0x%p\n", fbi->dmadesc_palette_cpu); - pr_debug("fbi->dmadesc_fblow_dma = 0x%x\n", fbi->dmadesc_fblow_dma); - pr_debug("fbi->dmadesc_fbhigh_dma = 0x%x\n", fbi->dmadesc_fbhigh_dma); - pr_debug("fbi->dmadesc_palette_dma = 0x%x\n", fbi->dmadesc_palette_dma); - - pr_debug("fbi->dmadesc_fblow_cpu->fdadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fdadr); - pr_debug("fbi->dmadesc_fbhigh_cpu->fdadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fdadr); - pr_debug("fbi->dmadesc_palette_cpu->fdadr = 0x%x\n", fbi->dmadesc_palette_cpu->fdadr); - - pr_debug("fbi->dmadesc_fblow_cpu->fsadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fsadr); - pr_debug("fbi->dmadesc_fbhigh_cpu->fsadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fsadr); - pr_debug("fbi->dmadesc_palette_cpu->fsadr = 0x%x\n", fbi->dmadesc_palette_cpu->fsadr); - - pr_debug("fbi->dmadesc_fblow_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fblow_cpu->ldcmd); - pr_debug("fbi->dmadesc_fbhigh_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fbhigh_cpu->ldcmd); - pr_debug("fbi->dmadesc_palette_cpu->ldcmd = 0x%x\n", fbi->dmadesc_palette_cpu->ldcmd); + DPRINTK("fbi->dmadesc_fblow_cpu = 0x%p\n", fbi->dmadesc_fblow_cpu); + DPRINTK("fbi->dmadesc_fbhigh_cpu = 0x%p\n", fbi->dmadesc_fbhigh_cpu); + DPRINTK("fbi->dmadesc_palette_cpu = 0x%p\n", fbi->dmadesc_palette_cpu); + DPRINTK("fbi->dmadesc_fblow_dma = 0x%x\n", fbi->dmadesc_fblow_dma); + DPRINTK("fbi->dmadesc_fbhigh_dma = 0x%x\n", fbi->dmadesc_fbhigh_dma); + DPRINTK("fbi->dmadesc_palette_dma = 0x%x\n", fbi->dmadesc_palette_dma); + + DPRINTK("fbi->dmadesc_fblow_cpu->fdadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fdadr); + DPRINTK("fbi->dmadesc_fbhigh_cpu->fdadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fdadr); + DPRINTK("fbi->dmadesc_palette_cpu->fdadr = 0x%x\n", fbi->dmadesc_palette_cpu->fdadr); + + DPRINTK("fbi->dmadesc_fblow_cpu->fsadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fsadr); + DPRINTK("fbi->dmadesc_fbhigh_cpu->fsadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fsadr); + DPRINTK("fbi->dmadesc_palette_cpu->fsadr = 0x%x\n", fbi->dmadesc_palette_cpu->fsadr); + + DPRINTK("fbi->dmadesc_fblow_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fblow_cpu->ldcmd); + DPRINTK("fbi->dmadesc_fbhigh_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fbhigh_cpu->ldcmd); + DPRINTK("fbi->dmadesc_palette_cpu->ldcmd = 0x%x\n", fbi->dmadesc_palette_cpu->ldcmd); #endif fbi->reg_lccr0 = new_regs.lccr0; @@ -684,7 +684,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info * */ static inline void __pxafb_backlight_power(struct pxafb_info *fbi, int on) { - pr_debug("pxafb: backlight o%s\n", on ? "n" : "ff"); + DPRINTK("backlight o%s\n", on ? "n" : "ff"); if (pxafb_backlight_power) pxafb_backlight_power(on); @@ -692,7 +692,7 @@ static inline void __pxafb_backlight_power(struct pxafb_info *fbi, int on) static inline void __pxafb_lcd_power(struct pxafb_info *fbi, int on) { - pr_debug("pxafb: LCD power o%s\n", on ? "n" : "ff"); + DPRINTK("LCD power o%s\n", on ? "n" : "ff"); if (pxafb_lcd_power) pxafb_lcd_power(on); @@ -740,13 +740,13 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi) static void pxafb_enable_controller(struct pxafb_info *fbi) { - pr_debug("pxafb: Enabling LCD controller\n"); - pr_debug("fdadr0 0x%08x\n", (unsigned int) fbi->fdadr0); - pr_debug("fdadr1 0x%08x\n", (unsigned int) fbi->fdadr1); - pr_debug("reg_lccr0 0x%08x\n", (unsigned int) fbi->reg_lccr0); - pr_debug("reg_lccr1 0x%08x\n", (unsigned int) fbi->reg_lccr1); - pr_debug("reg_lccr2 0x%08x\n", (unsigned int) fbi->reg_lccr2); - pr_debug("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3); + DPRINTK("Enabling LCD controller\n"); + DPRINTK("fdadr0 0x%08x\n", (unsigned int) fbi->fdadr0); + DPRINTK("fdadr1 0x%08x\n", (unsigned int) fbi->fdadr1); + DPRINTK("reg_lccr0 0x%08x\n", (unsigned int) fbi->reg_lccr0); + DPRINTK("reg_lccr1 0x%08x\n", (unsigned int) fbi->reg_lccr1); + DPRINTK("reg_lccr2 0x%08x\n", (unsigned int) fbi->reg_lccr2); + DPRINTK("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3); /* enable LCD controller clock */ pxa_set_cken(CKEN16_LCD, 1); @@ -761,19 +761,19 @@ static void pxafb_enable_controller(struct pxafb_info *fbi) FDADR1 = fbi->fdadr1; LCCR0 |= LCCR0_ENB; - pr_debug("FDADR0 0x%08x\n", (unsigned int) FDADR0); - pr_debug("FDADR1 0x%08x\n", (unsigned int) FDADR1); - pr_debug("LCCR0 0x%08x\n", (unsigned int) LCCR0); - pr_debug("LCCR1 0x%08x\n", (unsigned int) LCCR1); - pr_debug("LCCR2 0x%08x\n", (unsigned int) LCCR2); - pr_debug("LCCR3 0x%08x\n", (unsigned int) LCCR3); + DPRINTK("FDADR0 0x%08x\n", (unsigned int) FDADR0); + DPRINTK("FDADR1 0x%08x\n", (unsigned int) FDADR1); + DPRINTK("LCCR0 0x%08x\n", (unsigned int) LCCR0); + DPRINTK("LCCR1 0x%08x\n", (unsigned int) LCCR1); + DPRINTK("LCCR2 0x%08x\n", (unsigned int) LCCR2); + DPRINTK("LCCR3 0x%08x\n", (unsigned int) LCCR3); } static void pxafb_disable_controller(struct pxafb_info *fbi) { DECLARE_WAITQUEUE(wait, current); - pr_debug("pxafb: disabling LCD controller\n"); + DPRINTK("Disabling LCD controller\n"); set_current_state(TASK_UNINTERRUPTIBLE); add_wait_queue(&fbi->ctrlr_wait, &wait); @@ -1039,7 +1039,7 @@ static int __init pxafb_map_video_memory(struct pxafb_info *fbi) fbi->palette_size = fbi->fb.var.bits_per_pixel == 8 ? 256 : 16; palette_mem_size = fbi->palette_size * sizeof(u16); - pr_debug("pxafb: palette_mem_size = 0x%08lx\n", palette_mem_size); + DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size); fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size); fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size; diff --git a/trunk/drivers/video/pxafb.h b/trunk/drivers/video/pxafb.h index 47f41f70db7a..22c00be786a8 100644 --- a/trunk/drivers/video/pxafb.h +++ b/trunk/drivers/video/pxafb.h @@ -113,6 +113,15 @@ struct pxafb_info { #define PXA_NAME "PXA" +/* + * Debug macros + */ +#if DEBUG +# define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args) +#else +# define DPRINTK(fmt, args...) +#endif + /* * Minimum X and Y resolutions */ diff --git a/trunk/drivers/video/s3c2410fb.c b/trunk/drivers/video/s3c2410fb.c index 5ab79afb53b7..00c0223a352e 100644 --- a/trunk/drivers/video/s3c2410fb.c +++ b/trunk/drivers/video/s3c2410fb.c @@ -228,8 +228,8 @@ static int s3c2410fb_check_var(struct fb_var_screeninfo *var, * information */ -static void s3c2410fb_activate_var(struct s3c2410fb_info *fbi, - struct fb_var_screeninfo *var) +static int s3c2410fb_activate_var(struct s3c2410fb_info *fbi, + struct fb_var_screeninfo *var) { fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_MODEMASK; diff --git a/trunk/drivers/video/sa1100fb.c b/trunk/drivers/video/sa1100fb.c index 8000890e4271..beeec7b51425 100644 --- a/trunk/drivers/video/sa1100fb.c +++ b/trunk/drivers/video/sa1100fb.c @@ -592,7 +592,6 @@ sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, return ret; } -#ifdef CONFIG_CPU_FREQ /* * sa1100fb_display_dma_period() * Calculate the minimum period (in picoseconds) between two DMA @@ -607,7 +606,6 @@ static inline unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo */ return var->pixclock * 8 * 16 / var->bits_per_pixel; } -#endif /* * sa1100fb_check_var(): diff --git a/trunk/drivers/w1/w1.c b/trunk/drivers/w1/w1.c index 14016b1cd948..1b6b74c116a9 100644 --- a/trunk/drivers/w1/w1.c +++ b/trunk/drivers/w1/w1.c @@ -77,7 +77,8 @@ static void w1_master_release(struct device *dev) dev_dbg(dev, "%s: Releasing %s.\n", __func__, md->name); - dev_fini_netlink(md); + if (md->nls && md->nls->sk_socket) + sock_release(md->nls->sk_socket); memset(md, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master)); kfree(md); } diff --git a/trunk/fs/9p/fid.c b/trunk/fs/9p/fid.c index d95f8626d170..821c9c4d76aa 100644 --- a/trunk/fs/9p/fid.c +++ b/trunk/fs/9p/fid.c @@ -71,28 +71,21 @@ static int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry) * */ -struct v9fs_fid *v9fs_fid_create(struct dentry *dentry, - struct v9fs_session_info *v9ses, int fid, int create) +struct v9fs_fid *v9fs_fid_create(struct dentry *dentry) { struct v9fs_fid *new; - dprintk(DEBUG_9P, "fid create dentry %p, fid %d, create %d\n", - dentry, fid, create); - new = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); if (new == NULL) { dprintk(DEBUG_ERROR, "Out of Memory\n"); return ERR_PTR(-ENOMEM); } - new->fid = fid; - new->v9ses = v9ses; + new->fid = -1; new->fidopen = 0; - new->fidcreate = create; + new->fidcreate = 0; new->fidclunked = 0; new->iounit = 0; - new->rdir_pos = 0; - new->rdir_fcall = NULL; if (v9fs_fid_insert(new, dentry) == 0) return new; @@ -115,59 +108,6 @@ void v9fs_fid_destroy(struct v9fs_fid *fid) kfree(fid); } -/** - * v9fs_fid_walk_up - walks from the process current directory - * up to the specified dentry. - */ -static struct v9fs_fid *v9fs_fid_walk_up(struct dentry *dentry) -{ - int fidnum, cfidnum, err; - struct v9fs_fid *cfid; - struct dentry *cde; - struct v9fs_session_info *v9ses; - - v9ses = v9fs_inode2v9ses(current->fs->pwd->d_inode); - cfid = v9fs_fid_lookup(current->fs->pwd); - if (cfid == NULL) { - dprintk(DEBUG_ERROR, "process cwd doesn't have a fid\n"); - return ERR_PTR(-ENOENT); - } - - cfidnum = cfid->fid; - cde = current->fs->pwd; - /* TODO: take advantage of multiwalk */ - - fidnum = v9fs_get_idpool(&v9ses->fidpool); - if (fidnum < 0) { - dprintk(DEBUG_ERROR, "could not get a new fid num\n"); - err = -ENOENT; - goto clunk_fid; - } - - while (cde != dentry) { - if (cde == cde->d_parent) { - dprintk(DEBUG_ERROR, "can't find dentry\n"); - err = -ENOENT; - goto clunk_fid; - } - - err = v9fs_t_walk(v9ses, cfidnum, fidnum, "..", NULL); - if (err < 0) { - dprintk(DEBUG_ERROR, "problem walking to parent\n"); - goto clunk_fid; - } - - cfidnum = fidnum; - cde = cde->d_parent; - } - - return v9fs_fid_create(dentry, v9ses, fidnum, 0); - -clunk_fid: - v9fs_t_clunk(v9ses, fidnum, NULL); - return ERR_PTR(err); -} - /** * v9fs_fid_lookup - retrieve the right fid from a particular dentry * @dentry: dentry to look for fid in @@ -179,25 +119,49 @@ static struct v9fs_fid *v9fs_fid_walk_up(struct dentry *dentry) * */ -struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry) +struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry, int type) { struct list_head *fid_list = (struct list_head *)dentry->d_fsdata; struct v9fs_fid *current_fid = NULL; struct v9fs_fid *temp = NULL; struct v9fs_fid *return_fid = NULL; + int found_parent = 0; + int found_user = 0; - dprintk(DEBUG_9P, " dentry: %s (%p)\n", dentry->d_iname, dentry); + dprintk(DEBUG_9P, " dentry: %s (%p) type %d\n", dentry->d_iname, dentry, + type); - if (fid_list) { + if (fid_list && !list_empty(fid_list)) { list_for_each_entry_safe(current_fid, temp, fid_list, list) { - if (!current_fid->fidcreate) { - return_fid = current_fid; - break; + if (current_fid->uid == current->uid) { + if (return_fid == NULL) { + if ((type == FID_OP) + || (!current_fid->fidopen)) { + return_fid = current_fid; + found_user = 1; + } + } + } + if (current_fid->pid == current->real_parent->pid) { + if ((return_fid == NULL) || (found_parent) + || (found_user)) { + if ((type == FID_OP) + || (!current_fid->fidopen)) { + return_fid = current_fid; + found_parent = 1; + found_user = 0; + } + } + } + if (current_fid->pid == current->pid) { + if ((type == FID_OP) || + (!current_fid->fidopen)) { + return_fid = current_fid; + found_parent = 0; + found_user = 0; + } } } - - if (!return_fid) - return_fid = current_fid; } /* we are at the root but didn't match */ @@ -223,33 +187,55 @@ struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry) /* XXX - there may be some duplication we can get rid of */ if (par == dentry) { - return_fid = v9fs_fid_walk_up(dentry); - if (IS_ERR(return_fid)) - return_fid = NULL; - } - } + /* we need to fid_lookup the starting point */ + int fidnum = -1; + int oldfid = -1; + int result = -1; + struct v9fs_session_info *v9ses = + v9fs_inode2v9ses(current->fs->pwd->d_inode); + + current_fid = + v9fs_fid_lookup(current->fs->pwd, FID_WALK); + if (current_fid == NULL) { + dprintk(DEBUG_ERROR, + "process cwd doesn't have a fid\n"); + return return_fid; + } + oldfid = current_fid->fid; + par = current->fs->pwd; + /* TODO: take advantage of multiwalk */ - return return_fid; -} + fidnum = v9fs_get_idpool(&v9ses->fidpool); + if (fidnum < 0) { + dprintk(DEBUG_ERROR, + "could not get a new fid num\n"); + return return_fid; + } -struct v9fs_fid *v9fs_fid_get_created(struct dentry *dentry) -{ - struct list_head *fid_list; - struct v9fs_fid *fid, *ftmp, *ret; - - dprintk(DEBUG_9P, " dentry: %s (%p)\n", dentry->d_iname, dentry); - fid_list = (struct list_head *)dentry->d_fsdata; - ret = NULL; - if (fid_list) { - list_for_each_entry_safe(fid, ftmp, fid_list, list) { - if (fid->fidcreate && fid->pid == current->pid) { - list_del(&fid->list); - ret = fid; - break; + while (par != dentry) { + result = + v9fs_t_walk(v9ses, oldfid, fidnum, "..", + NULL); + if (result < 0) { + dprintk(DEBUG_ERROR, + "problem walking to parent\n"); + + break; + } + oldfid = fidnum; + if (par == par->d_parent) { + dprintk(DEBUG_ERROR, + "can't find dentry\n"); + break; + } + par = par->d_parent; + } + if (par == dentry) { + return_fid = v9fs_fid_create(dentry); + return_fid->fid = fidnum; } } } - dprintk(DEBUG_9P, "return %p\n", ret); - return ret; + return return_fid; } diff --git a/trunk/fs/9p/fid.h b/trunk/fs/9p/fid.h index 84c673a44c83..7db478ccca36 100644 --- a/trunk/fs/9p/fid.h +++ b/trunk/fs/9p/fid.h @@ -25,7 +25,6 @@ #define FID_OP 0 #define FID_WALK 1 -#define FID_CREATE 2 struct v9fs_fid { struct list_head list; /* list of fids associated with a dentry */ @@ -53,8 +52,6 @@ struct v9fs_fid { struct v9fs_session_info *v9ses; /* session info for this FID */ }; -struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry); -struct v9fs_fid *v9fs_fid_get_created(struct dentry *); +struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry, int type); void v9fs_fid_destroy(struct v9fs_fid *fid); -struct v9fs_fid *v9fs_fid_create(struct dentry *, - struct v9fs_session_info *v9ses, int fid, int create); +struct v9fs_fid *v9fs_fid_create(struct dentry *); diff --git a/trunk/fs/9p/vfs_dentry.c b/trunk/fs/9p/vfs_dentry.c index a6aa947de0f9..306c96741f81 100644 --- a/trunk/fs/9p/vfs_dentry.c +++ b/trunk/fs/9p/vfs_dentry.c @@ -67,7 +67,7 @@ static int v9fs_dentry_validate(struct dentry *dentry, struct nameidata *nd) struct dentry *dc = current->fs->pwd; dprintk(DEBUG_VFS, "dentry: %s (%p)\n", dentry->d_iname, dentry); - if (v9fs_fid_lookup(dentry)) { + if (v9fs_fid_lookup(dentry, FID_OP)) { dprintk(DEBUG_VFS, "VALID\n"); return 1; } diff --git a/trunk/fs/9p/vfs_dir.c b/trunk/fs/9p/vfs_dir.c index 57a43b8feef5..c478a7384186 100644 --- a/trunk/fs/9p/vfs_dir.c +++ b/trunk/fs/9p/vfs_dir.c @@ -197,18 +197,21 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) filemap_fdatawait(inode->i_mapping); if (fidnum >= 0) { + fid->fidopen--; dprintk(DEBUG_VFS, "fidopen: %d v9f->fid: %d\n", fid->fidopen, fid->fid); - if (v9fs_t_clunk(v9ses, fidnum, NULL)) - dprintk(DEBUG_ERROR, "clunk failed\n"); + if (fid->fidopen == 0) { + if (v9fs_t_clunk(v9ses, fidnum, NULL)) + dprintk(DEBUG_ERROR, "clunk failed\n"); - v9fs_put_idpool(fid->fid, &v9ses->fidpool); + v9fs_put_idpool(fid->fid, &v9ses->fidpool); + } kfree(fid->rdir_fcall); - kfree(fid); filp->private_data = NULL; + v9fs_fid_destroy(fid); } d_drop(filp->f_dentry); diff --git a/trunk/fs/9p/vfs_file.c b/trunk/fs/9p/vfs_file.c index bbc3cc63854f..1f8ae7d580ab 100644 --- a/trunk/fs/9p/vfs_file.c +++ b/trunk/fs/9p/vfs_file.c @@ -53,36 +53,30 @@ int v9fs_file_open(struct inode *inode, struct file *file) { struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); - struct v9fs_fid *v9fid, *fid; + struct v9fs_fid *v9fid = v9fs_fid_lookup(file->f_dentry, FID_WALK); + struct v9fs_fid *v9newfid = NULL; struct v9fs_fcall *fcall = NULL; int open_mode = 0; unsigned int iounit = 0; int newfid = -1; long result = -1; - dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file); - - v9fid = v9fs_fid_get_created(file->f_dentry); - if (!v9fid) - v9fid = v9fs_fid_lookup(file->f_dentry); + dprintk(DEBUG_VFS, "inode: %p file: %p v9fid= %p\n", inode, file, + v9fid); if (!v9fid) { + struct dentry *dentry = file->f_dentry; dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n"); - return -EBADF; - } - if (!v9fid->fidcreate) { - fid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); - if (fid == NULL) { - dprintk(DEBUG_ERROR, "Out of Memory\n"); - return -ENOMEM; - } + /* XXX - some duplication from lookup, generalize later */ + /* basically vfs_lookup is too heavy weight */ + v9fid = v9fs_fid_lookup(file->f_dentry, FID_OP); + if (!v9fid) + return -EBADF; - fid->fidopen = 0; - fid->fidcreate = 0; - fid->fidclunked = 0; - fid->iounit = 0; - fid->v9ses = v9ses; + v9fid = v9fs_fid_lookup(dentry->d_parent, FID_WALK); + if (!v9fid) + return -EBADF; newfid = v9fs_get_idpool(&v9ses->fidpool); if (newfid < 0) { @@ -91,16 +85,58 @@ int v9fs_file_open(struct inode *inode, struct file *file) } result = - v9fs_t_walk(v9ses, v9fid->fid, newfid, NULL, NULL); - + v9fs_t_walk(v9ses, v9fid->fid, newfid, + (char *)file->f_dentry->d_name.name, NULL); if (result < 0) { v9fs_put_idpool(newfid, &v9ses->fidpool); dprintk(DEBUG_ERROR, "rewalk didn't work\n"); return -EBADF; } - fid->fid = newfid; - v9fid = fid; + v9fid = v9fs_fid_create(dentry); + if (v9fid == NULL) { + dprintk(DEBUG_ERROR, "couldn't insert\n"); + return -ENOMEM; + } + v9fid->fid = newfid; + } + + if (v9fid->fidcreate) { + /* create case */ + newfid = v9fid->fid; + iounit = v9fid->iounit; + v9fid->fidcreate = 0; + } else { + if (!S_ISDIR(inode->i_mode)) + newfid = v9fid->fid; + else { + newfid = v9fs_get_idpool(&v9ses->fidpool); + if (newfid < 0) { + eprintk(KERN_WARNING, "allocation failed\n"); + return -ENOSPC; + } + /* This would be a somewhat critical clone */ + result = + v9fs_t_walk(v9ses, v9fid->fid, newfid, NULL, + &fcall); + if (result < 0) { + dprintk(DEBUG_ERROR, "clone error: %s\n", + FCALL_ERROR(fcall)); + kfree(fcall); + return result; + } + + v9newfid = v9fs_fid_create(file->f_dentry); + v9newfid->fid = newfid; + v9newfid->qid = v9fid->qid; + v9newfid->iounit = v9fid->iounit; + v9newfid->fidopen = 0; + v9newfid->fidclunked = 0; + v9newfid->v9ses = v9ses; + v9fid = v9newfid; + kfree(fcall); + } + /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ /* translate open mode appropriately */ open_mode = file->f_flags & 0x3; @@ -127,13 +163,9 @@ int v9fs_file_open(struct inode *inode, struct file *file) iounit = fcall->params.ropen.iounit; kfree(fcall); - } else { - /* create case */ - newfid = v9fid->fid; - iounit = v9fid->iounit; - v9fid->fidcreate = 0; } + file->private_data = v9fid; v9fid->rdir_pos = 0; @@ -175,16 +207,16 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) } /** - * v9fs_file_read - read from a file + * v9fs_read - read from a file (internal) * @filep: file pointer to read * @data: data buffer to read data into * @count: size of buffer * @offset: offset at which to read data * */ + static ssize_t -v9fs_file_read(struct file *filp, char __user * data, size_t count, - loff_t * offset) +v9fs_read(struct file *filp, char *buffer, size_t count, loff_t * offset) { struct inode *inode = filp->f_dentry->d_inode; struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); @@ -194,7 +226,6 @@ v9fs_file_read(struct file *filp, char __user * data, size_t count, int rsize = 0; int result = 0; int total = 0; - int n; dprintk(DEBUG_VFS, "\n"); @@ -217,15 +248,10 @@ v9fs_file_read(struct file *filp, char __user * data, size_t count, } else *offset += result; - n = copy_to_user(data, fcall->params.rread.data, result); - if (n) { - dprintk(DEBUG_ERROR, "Problem copying to user %d\n", n); - kfree(fcall); - return -EFAULT; - } - + /* XXX - extra copy */ + memcpy(buffer, fcall->params.rread.data, result); count -= result; - data += result; + buffer += result; total += result; kfree(fcall); @@ -238,7 +264,42 @@ v9fs_file_read(struct file *filp, char __user * data, size_t count, } /** - * v9fs_file_write - write to a file + * v9fs_file_read - read from a file + * @filep: file pointer to read + * @data: data buffer to read data into + * @count: size of buffer + * @offset: offset at which to read data + * + */ + +static ssize_t +v9fs_file_read(struct file *filp, char __user * data, size_t count, + loff_t * offset) +{ + int retval = -1; + int ret = 0; + char *buffer; + + buffer = kmalloc(count, GFP_KERNEL); + if (!buffer) + return -ENOMEM; + + retval = v9fs_read(filp, buffer, count, offset); + if (retval > 0) { + if ((ret = copy_to_user(data, buffer, retval)) != 0) { + dprintk(DEBUG_ERROR, "Problem copying to user %d\n", + ret); + retval = ret; + } + } + + kfree(buffer); + + return retval; +} + +/** + * v9fs_write - write to a file * @filep: file pointer to write * @data: data buffer to write data from * @count: size of buffer @@ -247,8 +308,7 @@ v9fs_file_read(struct file *filp, char __user * data, size_t count, */ static ssize_t -v9fs_file_write(struct file *filp, const char __user * data, - size_t count, loff_t * offset) +v9fs_write(struct file *filp, char *buffer, size_t count, loff_t * offset) { struct inode *inode = filp->f_dentry->d_inode; struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); @@ -258,42 +318,30 @@ v9fs_file_write(struct file *filp, const char __user * data, int result = -EIO; int rsize = 0; int total = 0; - char *buf; - dprintk(DEBUG_VFS, "data %p count %d offset %x\n", data, (int)count, + dprintk(DEBUG_VFS, "data %p count %d offset %x\n", buffer, (int)count, (int)*offset); rsize = v9ses->maxdata - V9FS_IOHDRSZ; if (v9fid->iounit != 0 && rsize > v9fid->iounit) rsize = v9fid->iounit; - buf = kmalloc(v9ses->maxdata - V9FS_IOHDRSZ, GFP_KERNEL); - if (!buf) - return -ENOMEM; + dump_data(buffer, count); do { if (count < rsize) rsize = count; - result = copy_from_user(buf, data, rsize); - if (result) { - dprintk(DEBUG_ERROR, "Problem copying from user\n"); - kfree(buf); - return -EFAULT; - } - - dump_data(buf, rsize); - result = v9fs_t_write(v9ses, fid, *offset, rsize, buf, &fcall); + result = + v9fs_t_write(v9ses, fid, *offset, rsize, buffer, &fcall); if (result < 0) { eprintk(KERN_ERR, "error while writing: %s(%d)\n", FCALL_ERROR(fcall), result); kfree(fcall); - kfree(buf); return result; } else *offset += result; kfree(fcall); - fcall = NULL; if (result != rsize) { eprintk(KERN_ERR, @@ -303,14 +351,46 @@ v9fs_file_write(struct file *filp, const char __user * data, } count -= result; - data += result; + buffer += result; total += result; } while (count); - kfree(buf); return total; } +/** + * v9fs_file_write - write to a file + * @filep: file pointer to write + * @data: data buffer to write data from + * @count: size of buffer + * @offset: offset at which to write data + * + */ + +static ssize_t +v9fs_file_write(struct file *filp, const char __user * data, + size_t count, loff_t * offset) +{ + int ret = -1; + char *buffer; + + buffer = kmalloc(count, GFP_KERNEL); + if (buffer == NULL) + return -ENOMEM; + + ret = copy_from_user(buffer, data, count); + if (ret) { + dprintk(DEBUG_ERROR, "Problem copying from user\n"); + ret = -EFAULT; + } else { + ret = v9fs_write(filp, buffer, count, offset); + } + + kfree(buffer); + + return ret; +} + struct file_operations v9fs_file_operations = { .llseek = generic_file_llseek, .read = v9fs_file_read, diff --git a/trunk/fs/9p/vfs_inode.c b/trunk/fs/9p/vfs_inode.c index 2b696ae6655a..b16322db5ce6 100644 --- a/trunk/fs/9p/vfs_inode.c +++ b/trunk/fs/9p/vfs_inode.c @@ -307,7 +307,7 @@ v9fs_create(struct inode *dir, struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); struct super_block *sb = dir->i_sb; struct v9fs_fid *dirfid = - v9fs_fid_lookup(file_dentry->d_parent); + v9fs_fid_lookup(file_dentry->d_parent, FID_WALK); struct v9fs_fid *fid = NULL; struct inode *file_inode = NULL; struct v9fs_fcall *fcall = NULL; @@ -317,7 +317,6 @@ v9fs_create(struct inode *dir, long newfid = -1; int result = 0; unsigned int iounit = 0; - int wfidno = -1; perm = unixmode2p9mode(v9ses, perm); @@ -351,7 +350,7 @@ v9fs_create(struct inode *dir, if (result < 0) { dprintk(DEBUG_ERROR, "clone error: %s\n", FCALL_ERROR(fcall)); v9fs_put_idpool(newfid, &v9ses->fidpool); - newfid = -1; + newfid = 0; goto CleanUpFid; } @@ -370,39 +369,20 @@ v9fs_create(struct inode *dir, qid = fcall->params.rcreate.qid; kfree(fcall); - fid = v9fs_fid_create(file_dentry, v9ses, newfid, 1); - dprintk(DEBUG_VFS, "fid %p %d\n", fid, fid->fidcreate); + fid = v9fs_fid_create(file_dentry); if (!fid) { result = -ENOMEM; goto CleanUpFid; } + fid->fid = newfid; + fid->fidopen = 0; + fid->fidcreate = 1; fid->qid = qid; fid->iounit = iounit; - - /* walk to the newly created file and put the fid in the dentry */ - wfidno = v9fs_get_idpool(&v9ses->fidpool); - if (newfid < 0) { - eprintk(KERN_WARNING, "no free fids available\n"); - return -ENOSPC; - } - - result = v9fs_t_walk(v9ses, dirfidnum, wfidno, - (char *) file_dentry->d_name.name, NULL); - if (result < 0) { - dprintk(DEBUG_ERROR, "clone error: %s\n", FCALL_ERROR(fcall)); - v9fs_put_idpool(wfidno, &v9ses->fidpool); - wfidno = -1; - goto CleanUpFid; - } - - if (!v9fs_fid_create(file_dentry, v9ses, wfidno, 0)) { - if (!v9fs_t_clunk(v9ses, newfid, &fcall)) { - v9fs_put_idpool(wfidno, &v9ses->fidpool); - } - - goto CleanUpFid; - } + fid->rdir_pos = 0; + fid->rdir_fcall = NULL; + fid->v9ses = v9ses; if ((perm & V9FS_DMSYMLINK) || (perm & V9FS_DMLINK) || (perm & V9FS_DMNAMEDPIPE) || (perm & V9FS_DMSOCKET) || @@ -430,11 +410,11 @@ v9fs_create(struct inode *dir, d_instantiate(file_dentry, file_inode); if (perm & V9FS_DMDIR) { - if (!v9fs_t_clunk(v9ses, newfid, &fcall)) - v9fs_put_idpool(newfid, &v9ses->fidpool); - else + if (v9fs_t_clunk(v9ses, newfid, &fcall)) dprintk(DEBUG_ERROR, "clunk for mkdir failed: %s\n", FCALL_ERROR(fcall)); + + v9fs_put_idpool(newfid, &v9ses->fidpool); kfree(fcall); fid->fidopen = 0; fid->fidcreate = 0; @@ -446,22 +426,12 @@ v9fs_create(struct inode *dir, CleanUpFid: kfree(fcall); - if (newfid >= 0) { - if (!v9fs_t_clunk(v9ses, newfid, &fcall)) - v9fs_put_idpool(newfid, &v9ses->fidpool); - else - dprintk(DEBUG_ERROR, "clunk failed: %s\n", - FCALL_ERROR(fcall)); - - kfree(fcall); - } - if (wfidno >= 0) { - if (!v9fs_t_clunk(v9ses, wfidno, &fcall)) - v9fs_put_idpool(wfidno, &v9ses->fidpool); - else + if (newfid) { + if (v9fs_t_clunk(v9ses, newfid, &fcall)) dprintk(DEBUG_ERROR, "clunk failed: %s\n", FCALL_ERROR(fcall)); + v9fs_put_idpool(newfid, &v9ses->fidpool); kfree(fcall); } return result; @@ -491,7 +461,7 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir) file_inode = file->d_inode; sb = file_inode->i_sb; v9ses = v9fs_inode2v9ses(file_inode); - v9fid = v9fs_fid_lookup(file); + v9fid = v9fs_fid_lookup(file, FID_OP); if (!v9fid) { dprintk(DEBUG_ERROR, @@ -575,7 +545,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, sb = dir->i_sb; v9ses = v9fs_inode2v9ses(dir); - dirfid = v9fs_fid_lookup(dentry->d_parent); + dirfid = v9fs_fid_lookup(dentry->d_parent, FID_WALK); if (!dirfid) { dprintk(DEBUG_ERROR, "no dirfid\n"); @@ -603,7 +573,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, v9fs_put_idpool(newfid, &v9ses->fidpool); if (result == -ENOENT) { d_add(dentry, NULL); - dprintk(DEBUG_VFS, + dprintk(DEBUG_ERROR, "Return negative dentry %p count %d\n", dentry, atomic_read(&dentry->d_count)); return NULL; @@ -631,13 +601,16 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, inode->i_ino = v9fs_qid2ino(&fcall->params.rstat.stat->qid); - fid = v9fs_fid_create(dentry, v9ses, newfid, 0); + fid = v9fs_fid_create(dentry); if (fid == NULL) { dprintk(DEBUG_ERROR, "couldn't insert\n"); result = -ENOMEM; goto FreeFcall; } + fid->fid = newfid; + fid->fidopen = 0; + fid->v9ses = v9ses; fid->qid = fcall->params.rstat.stat->qid; dentry->d_op = &v9fs_dentry_operations; @@ -692,11 +665,11 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, { struct inode *old_inode = old_dentry->d_inode; struct v9fs_session_info *v9ses = v9fs_inode2v9ses(old_inode); - struct v9fs_fid *oldfid = v9fs_fid_lookup(old_dentry); + struct v9fs_fid *oldfid = v9fs_fid_lookup(old_dentry, FID_WALK); struct v9fs_fid *olddirfid = - v9fs_fid_lookup(old_dentry->d_parent); + v9fs_fid_lookup(old_dentry->d_parent, FID_WALK); struct v9fs_fid *newdirfid = - v9fs_fid_lookup(new_dentry->d_parent); + v9fs_fid_lookup(new_dentry->d_parent, FID_WALK); struct v9fs_stat *mistat = kmalloc(v9ses->maxdata, GFP_KERNEL); struct v9fs_fcall *fcall = NULL; int fid = -1; @@ -771,7 +744,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, { struct v9fs_fcall *fcall = NULL; struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode); - struct v9fs_fid *fid = v9fs_fid_lookup(dentry); + struct v9fs_fid *fid = v9fs_fid_lookup(dentry, FID_OP); int err = -EPERM; dprintk(DEBUG_VFS, "dentry: %p\n", dentry); @@ -805,7 +778,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) { struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode); - struct v9fs_fid *fid = v9fs_fid_lookup(dentry); + struct v9fs_fid *fid = v9fs_fid_lookup(dentry, FID_OP); struct v9fs_fcall *fcall = NULL; struct v9fs_stat *mistat = kmalloc(v9ses->maxdata, GFP_KERNEL); int res = -EPERM; @@ -987,7 +960,7 @@ v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) if (retval != 0) goto FreeFcall; - newfid = v9fs_fid_lookup(dentry); + newfid = v9fs_fid_lookup(dentry, FID_OP); /* issue a twstat */ v9fs_blank_mistat(v9ses, mistat); @@ -1031,7 +1004,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) struct v9fs_fcall *fcall = NULL; struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode); - struct v9fs_fid *fid = v9fs_fid_lookup(dentry); + struct v9fs_fid *fid = v9fs_fid_lookup(dentry, FID_OP); if (!fid) { dprintk(DEBUG_ERROR, "could not resolve fid from dentry\n"); @@ -1175,7 +1148,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); struct v9fs_fcall *fcall = NULL; struct v9fs_stat *mistat = kmalloc(v9ses->maxdata, GFP_KERNEL); - struct v9fs_fid *oldfid = v9fs_fid_lookup(old_dentry); + struct v9fs_fid *oldfid = v9fs_fid_lookup(old_dentry, FID_OP); struct v9fs_fid *newfid = NULL; char *symname = __getname(); @@ -1195,7 +1168,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, if (retval != 0) goto FreeMem; - newfid = v9fs_fid_lookup(dentry); + newfid = v9fs_fid_lookup(dentry, FID_OP); if (!newfid) { dprintk(DEBUG_ERROR, "couldn't resolve fid from dentry\n"); goto FreeMem; @@ -1273,7 +1246,7 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) if (retval != 0) goto FreeMem; - newfid = v9fs_fid_lookup(dentry); + newfid = v9fs_fid_lookup(dentry, FID_OP); if (!newfid) { dprintk(DEBUG_ERROR, "coudn't resove fid from dentry\n"); retval = -EINVAL; diff --git a/trunk/fs/9p/vfs_super.c b/trunk/fs/9p/vfs_super.c index 82c5b0084079..1e2b2b54d300 100644 --- a/trunk/fs/9p/vfs_super.c +++ b/trunk/fs/9p/vfs_super.c @@ -129,6 +129,7 @@ static struct super_block *v9fs_get_sb(struct file_system_type if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { dprintk(DEBUG_ERROR, "problem initiating session\n"); + kfree(v9ses); return ERR_PTR(newfid); } @@ -154,19 +155,23 @@ static struct super_block *v9fs_get_sb(struct file_system_type sb->s_root = root; + /* Setup the Root Inode */ + root_fid = v9fs_fid_create(root); + if (root_fid == NULL) { + retval = -ENOMEM; + goto put_back_sb; + } + + root_fid->fidopen = 0; + root_fid->v9ses = v9ses; + stat_result = v9fs_t_stat(v9ses, newfid, &fcall); if (stat_result < 0) { dprintk(DEBUG_ERROR, "stat error\n"); v9fs_t_clunk(v9ses, newfid, NULL); v9fs_put_idpool(newfid, &v9ses->fidpool); } else { - /* Setup the Root Inode */ - root_fid = v9fs_fid_create(root, v9ses, newfid, 0); - if (root_fid == NULL) { - retval = -ENOMEM; - goto put_back_sb; - } - + root_fid->fid = newfid; root_fid->qid = fcall->params.rstat.stat->qid; root->d_inode->i_ino = v9fs_qid2ino(&fcall->params.rstat.stat->qid); diff --git a/trunk/fs/Kconfig b/trunk/fs/Kconfig index 48f5422cb19a..068ccea2f184 100644 --- a/trunk/fs/Kconfig +++ b/trunk/fs/Kconfig @@ -472,9 +472,6 @@ config FUSE_FS utilities is available from the FUSE homepage: - See for more information. - See for needed library/utility version. - If you want to develop a userspace FS, or if you want to use a filesystem based on FUSE, answer Y or M. diff --git a/trunk/fs/aio.c b/trunk/fs/aio.c index 9fe7216457d8..0e11e31dbb77 100644 --- a/trunk/fs/aio.c +++ b/trunk/fs/aio.c @@ -398,7 +398,7 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx) if (unlikely(!req)) return NULL; - req->ki_flags = 0; + req->ki_flags = 1 << KIF_LOCKED; req->ki_users = 2; req->ki_key = 0; req->ki_ctx = ctx; @@ -547,6 +547,25 @@ struct kioctx *lookup_ioctx(unsigned long ctx_id) return ioctx; } +static int lock_kiocb_action(void *param) +{ + schedule(); + return 0; +} + +static inline void lock_kiocb(struct kiocb *iocb) +{ + wait_on_bit_lock(&iocb->ki_flags, KIF_LOCKED, lock_kiocb_action, + TASK_UNINTERRUPTIBLE); +} + +static inline void unlock_kiocb(struct kiocb *iocb) +{ + kiocbClearLocked(iocb); + smp_mb__after_clear_bit(); + wake_up_bit(&iocb->ki_flags, KIF_LOCKED); +} + /* * use_mm * Makes the calling kernel thread take on the specified @@ -722,9 +741,19 @@ static ssize_t aio_run_iocb(struct kiocb *iocb) ret = retry(iocb); current->io_wait = NULL; - if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED) { - BUG_ON(!list_empty(&iocb->ki_wait.task_list)); - aio_complete(iocb, ret, 0); + if (-EIOCBRETRY != ret) { + if (-EIOCBQUEUED != ret) { + BUG_ON(!list_empty(&iocb->ki_wait.task_list)); + aio_complete(iocb, ret, 0); + /* must not access the iocb after this */ + } + } else { + /* + * Issue an additional retry to avoid waiting forever if + * no waits were queued (e.g. in case of a short read). + */ + if (list_empty(&iocb->ki_wait.task_list)) + kiocbSetKicked(iocb); } out: spin_lock_irq(&ctx->ctx_lock); @@ -777,7 +806,9 @@ static int __aio_run_iocbs(struct kioctx *ctx) * Hold an extra reference while retrying i/o. */ iocb->ki_users++; /* grab extra reference */ + lock_kiocb(iocb); aio_run_iocb(iocb); + unlock_kiocb(iocb); if (__aio_put_req(ctx, iocb)) /* drop extra ref */ put_ioctx(ctx); } @@ -868,24 +899,16 @@ static void aio_kick_handler(void *data) * and if required activate the aio work queue to process * it */ -static void try_queue_kicked_iocb(struct kiocb *iocb) +static void queue_kicked_iocb(struct kiocb *iocb) { struct kioctx *ctx = iocb->ki_ctx; unsigned long flags; int run = 0; - /* We're supposed to be the only path putting the iocb back on the run - * list. If we find that the iocb is *back* on a wait queue already - * than retry has happened before we could queue the iocb. This also - * means that the retry could have completed and freed our iocb, no - * good. */ - BUG_ON((!list_empty(&iocb->ki_wait.task_list))); + WARN_ON((!list_empty(&iocb->ki_wait.task_list))); spin_lock_irqsave(&ctx->ctx_lock, flags); - /* set this inside the lock so that we can't race with aio_run_iocb() - * testing it and putting the iocb on the run list under the lock */ - if (!kiocbTryKick(iocb)) - run = __queue_kicked_iocb(iocb); + run = __queue_kicked_iocb(iocb); spin_unlock_irqrestore(&ctx->ctx_lock, flags); if (run) aio_queue_work(ctx); @@ -908,7 +931,10 @@ void fastcall kick_iocb(struct kiocb *iocb) return; } - try_queue_kicked_iocb(iocb); + /* If its already kicked we shouldn't queue it again */ + if (!kiocbTryKick(iocb)) { + queue_kicked_iocb(iocb); + } } EXPORT_SYMBOL(kick_iocb); @@ -1296,11 +1322,8 @@ asmlinkage long sys_io_destroy(aio_context_t ctx) } /* - * aio_p{read,write} are the default ki_retry methods for - * IO_CMD_P{READ,WRITE}. They maintains kiocb retry state around potentially - * multiple calls to f_op->aio_read(). They loop around partial progress - * instead of returning -EIOCBRETRY because they don't have the means to call - * kick_iocb(). + * Default retry method for aio_read (also used for first time submit) + * Responsible for updating iocb state as retries progress */ static ssize_t aio_pread(struct kiocb *iocb) { @@ -1309,25 +1332,25 @@ static ssize_t aio_pread(struct kiocb *iocb) struct inode *inode = mapping->host; ssize_t ret = 0; - do { - ret = file->f_op->aio_read(iocb, iocb->ki_buf, - iocb->ki_left, iocb->ki_pos); - /* - * Can't just depend on iocb->ki_left to determine - * whether we are done. This may have been a short read. - */ - if (ret > 0) { - iocb->ki_buf += ret; - iocb->ki_left -= ret; - } + ret = file->f_op->aio_read(iocb, iocb->ki_buf, + iocb->ki_left, iocb->ki_pos); + /* + * Can't just depend on iocb->ki_left to determine + * whether we are done. This may have been a short read. + */ + if (ret > 0) { + iocb->ki_buf += ret; + iocb->ki_left -= ret; /* - * For pipes and sockets we return once we have some data; for - * regular files we retry till we complete the entire read or - * find that we can't read any more data (e.g short reads). + * For pipes and sockets we return once we have + * some data; for regular files we retry till we + * complete the entire read or find that we can't + * read any more data (e.g short reads). */ - } while (ret > 0 && iocb->ki_left > 0 && - !S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)); + if (!S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)) + ret = -EIOCBRETRY; + } /* This means we must have transferred all that we could */ /* No need to retry anymore */ @@ -1337,21 +1360,27 @@ static ssize_t aio_pread(struct kiocb *iocb) return ret; } -/* see aio_pread() */ +/* + * Default retry method for aio_write (also used for first time submit) + * Responsible for updating iocb state as retries progress + */ static ssize_t aio_pwrite(struct kiocb *iocb) { struct file *file = iocb->ki_filp; ssize_t ret = 0; - do { - ret = file->f_op->aio_write(iocb, iocb->ki_buf, - iocb->ki_left, iocb->ki_pos); - if (ret > 0) { - iocb->ki_buf += ret; - iocb->ki_left -= ret; - } - } while (ret > 0 && iocb->ki_left > 0); + ret = file->f_op->aio_write(iocb, iocb->ki_buf, + iocb->ki_left, iocb->ki_pos); + if (ret > 0) { + iocb->ki_buf += ret; + iocb->ki_left -= ret; + + ret = -EIOCBRETRY; + } + + /* This means we must have transferred all that we could */ + /* No need to retry anymore */ if ((ret == 0) || (iocb->ki_left == 0)) ret = iocb->ki_nbytes - iocb->ki_left; @@ -1521,6 +1550,7 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, spin_lock_irq(&ctx->ctx_lock); aio_run_iocb(req); + unlock_kiocb(req); if (!list_empty(&ctx->run_list)) { /* drain the run list */ while (__aio_run_iocbs(ctx)) @@ -1652,6 +1682,7 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, if (NULL != cancel) { struct io_event tmp; pr_debug("calling cancel\n"); + lock_kiocb(kiocb); memset(&tmp, 0, sizeof(tmp)); tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user; tmp.data = kiocb->ki_user_data; @@ -1663,6 +1694,7 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, if (copy_to_user(result, &tmp, sizeof(tmp))) ret = -EFAULT; } + unlock_kiocb(kiocb); } else ret = -EINVAL; diff --git a/trunk/fs/bfs/dir.c b/trunk/fs/bfs/dir.c index 5af928fa0449..e240c335eb23 100644 --- a/trunk/fs/bfs/dir.c +++ b/trunk/fs/bfs/dir.c @@ -108,7 +108,7 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, inode->i_mapping->a_ops = &bfs_aops; inode->i_mode = mode; inode->i_ino = ino; - BFS_I(inode)->i_dsk_ino = ino; + BFS_I(inode)->i_dsk_ino = cpu_to_le16(ino); BFS_I(inode)->i_sblock = 0; BFS_I(inode)->i_eblock = 0; insert_inode_hash(inode); diff --git a/trunk/fs/bfs/inode.c b/trunk/fs/bfs/inode.c index 3af6c73c5b5a..c7b39aa279d7 100644 --- a/trunk/fs/bfs/inode.c +++ b/trunk/fs/bfs/inode.c @@ -357,46 +357,28 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) } info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1)>>BFS_BSIZE_BITS; /* for statfs(2) */ - info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - le32_to_cpu(bfs_sb->s_start))>>BFS_BSIZE_BITS; + info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - cpu_to_le32(bfs_sb->s_start))>>BFS_BSIZE_BITS; info->si_freei = 0; info->si_lf_eblk = 0; info->si_lf_sblk = 0; info->si_lf_ioff = 0; - bh = NULL; for (i=BFS_ROOT_INO; i<=info->si_lasti; i++) { - struct bfs_inode *di; - int block = (i - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; - int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; - unsigned long sblock, eblock; - - if (!off) { - brelse(bh); - bh = sb_bread(s, block); - } - - if (!bh) - continue; - - di = (struct bfs_inode *)bh->b_data + off; - - if (!di->i_ino) { + inode = iget(s,i); + if (BFS_I(inode)->i_dsk_ino == 0) info->si_freei++; - continue; - } - set_bit(i, info->si_imap); - info->si_freeb -= BFS_FILEBLOCKS(di); - - sblock = le32_to_cpu(di->i_sblock); - eblock = le32_to_cpu(di->i_eblock); - if (eblock > info->si_lf_eblk) { - info->si_lf_eblk = eblock; - info->si_lf_sblk = sblock; - info->si_lf_ioff = BFS_INO2OFF(i); + else { + set_bit(i, info->si_imap); + info->si_freeb -= inode->i_blocks; + if (BFS_I(inode)->i_eblock > info->si_lf_eblk) { + info->si_lf_eblk = BFS_I(inode)->i_eblock; + info->si_lf_sblk = BFS_I(inode)->i_sblock; + info->si_lf_ioff = BFS_INO2OFF(i); + } } + iput(inode); } - brelse(bh); if (!(s->s_flags & MS_RDONLY)) { - mark_buffer_dirty(info->si_sbh); + mark_buffer_dirty(bh); s->s_dirt = 1; } dump_imap("read_super", s); diff --git a/trunk/fs/binfmt_elf.c b/trunk/fs/binfmt_elf.c index d4b15576e584..7976a238f0a3 100644 --- a/trunk/fs/binfmt_elf.c +++ b/trunk/fs/binfmt_elf.c @@ -905,7 +905,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) send_sig(SIGKILL, current, 0); goto out_free_dentry; } - if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) { + if (padzero(elf_bss)) { send_sig(SIGSEGV, current, 0); retval = -EFAULT; /* Nobody gets to see this, but.. */ goto out_free_dentry; diff --git a/trunk/fs/bio.c b/trunk/fs/bio.c index 7d81a93afd48..83a349574567 100644 --- a/trunk/fs/bio.c +++ b/trunk/fs/bio.c @@ -75,7 +75,7 @@ struct bio_set { */ static struct bio_set *fs_bio_set; -static inline struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct bio_set *bs) +static inline struct bio_vec *bvec_alloc_bs(unsigned int __nocast gfp_mask, int nr, unsigned long *idx, struct bio_set *bs) { struct bio_vec *bvl; struct biovec_slab *bp; @@ -155,7 +155,7 @@ inline void bio_init(struct bio *bio) * allocate bio and iovecs from the memory pools specified by the * bio_set structure. **/ -struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) +struct bio *bio_alloc_bioset(unsigned int __nocast gfp_mask, int nr_iovecs, struct bio_set *bs) { struct bio *bio = mempool_alloc(bs->bio_pool, gfp_mask); @@ -181,7 +181,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) return bio; } -struct bio *bio_alloc(gfp_t gfp_mask, int nr_iovecs) +struct bio *bio_alloc(unsigned int __nocast gfp_mask, int nr_iovecs) { struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); @@ -277,7 +277,7 @@ inline void __bio_clone(struct bio *bio, struct bio *bio_src) * * Like __bio_clone, only also allocates the returned bio */ -struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) +struct bio *bio_clone(struct bio *bio, unsigned int __nocast gfp_mask) { struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set); @@ -1078,7 +1078,7 @@ struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, int first_sectors) return bp; } -static void *bio_pair_alloc(gfp_t gfp_flags, void *data) +static void *bio_pair_alloc(unsigned int __nocast gfp_flags, void *data) { return kmalloc(sizeof(struct bio_pair), gfp_flags); } diff --git a/trunk/fs/buffer.c b/trunk/fs/buffer.c index 1216c0d3c8ce..6cbfceabd95d 100644 --- a/trunk/fs/buffer.c +++ b/trunk/fs/buffer.c @@ -3045,7 +3045,7 @@ static void recalc_bh_state(void) buffer_heads_over_limit = (tot > max_buffer_heads); } -struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) +struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags) { struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags); if (ret) { diff --git a/trunk/fs/cifs/cifsfs.c b/trunk/fs/cifs/cifsfs.c index 1ebf7dafc1d7..8cc23e7d0d5d 100644 --- a/trunk/fs/cifs/cifsfs.c +++ b/trunk/fs/cifs/cifsfs.c @@ -781,8 +781,6 @@ static int cifs_oplock_thread(void * dummyarg) oplockThread = current; do { - if (try_to_freeze()) - continue; set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1*HZ); diff --git a/trunk/fs/cifs/connect.c b/trunk/fs/cifs/connect.c index 47360156cc54..2335f14a1583 100644 --- a/trunk/fs/cifs/connect.c +++ b/trunk/fs/cifs/connect.c @@ -344,8 +344,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) } while (server->tcpStatus != CifsExiting) { - if (try_to_freeze()) - continue; if (bigbuf == NULL) { bigbuf = cifs_buf_get(); if(bigbuf == NULL) { diff --git a/trunk/fs/eventpoll.c b/trunk/fs/eventpoll.c index 4284cd31eba6..403b90a1213d 100644 --- a/trunk/fs/eventpoll.c +++ b/trunk/fs/eventpoll.c @@ -101,10 +101,6 @@ /* Maximum number of poll wake up nests we are allowing */ #define EP_MAX_POLLWAKE_NESTS 4 -/* Maximum msec timeout value storeable in a long int */ -#define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, (LONG_MAX - 999ULL) / HZ) - - struct epoll_filefd { struct file *file; int fd; @@ -1510,8 +1506,8 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, * and the overflow condition. The passed timeout is in milliseconds, * that why (t * HZ) / 1000. */ - jtimeout = (timeout < 0 || timeout >= EP_MAX_MSTIMEO) ? - MAX_SCHEDULE_TIMEOUT : (timeout * HZ + 999) / 1000; + jtimeout = timeout == -1 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ? + MAX_SCHEDULE_TIMEOUT: (timeout * HZ + 999) / 1000; retry: write_lock_irqsave(&ep->lock, flags); diff --git a/trunk/fs/ext2/ialloc.c b/trunk/fs/ext2/ialloc.c index e2d6208633a7..c8d07030c897 100644 --- a/trunk/fs/ext2/ialloc.c +++ b/trunk/fs/ext2/ialloc.c @@ -605,28 +605,27 @@ struct inode *ext2_new_inode(struct inode *dir, int mode) insert_inode_hash(inode); if (DQUOT_ALLOC_INODE(inode)) { + DQUOT_DROP(inode); err = -ENOSPC; - goto fail_drop; + goto fail2; } - err = ext2_init_acl(inode, dir); - if (err) - goto fail_free_drop; - + if (err) { + DQUOT_FREE_INODE(inode); + DQUOT_DROP(inode); + goto fail2; + } err = ext2_init_security(inode,dir); - if (err) - goto fail_free_drop; - + if (err) { + DQUOT_FREE_INODE(inode); + goto fail2; + } mark_inode_dirty(inode); ext2_debug("allocating inode %lu\n", inode->i_ino); ext2_preread_inode(inode); return inode; -fail_free_drop: - DQUOT_FREE_INODE(inode); - -fail_drop: - DQUOT_DROP(inode); +fail2: inode->i_flags |= S_NOQUOTA; inode->i_nlink = 0; iput(inode); diff --git a/trunk/fs/ext3/ialloc.c b/trunk/fs/ext3/ialloc.c index 6549945f9ac1..96552769d039 100644 --- a/trunk/fs/ext3/ialloc.c +++ b/trunk/fs/ext3/ialloc.c @@ -597,22 +597,27 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ret = inode; if(DQUOT_ALLOC_INODE(inode)) { + DQUOT_DROP(inode); err = -EDQUOT; - goto fail_drop; + goto fail2; } - err = ext3_init_acl(handle, inode, dir); - if (err) - goto fail_free_drop; - + if (err) { + DQUOT_FREE_INODE(inode); + DQUOT_DROP(inode); + goto fail2; + } err = ext3_init_security(handle,inode, dir); - if (err) - goto fail_free_drop; - + if (err) { + DQUOT_FREE_INODE(inode); + goto fail2; + } err = ext3_mark_inode_dirty(handle, inode); if (err) { ext3_std_error(sb, err); - goto fail_free_drop; + DQUOT_FREE_INODE(inode); + DQUOT_DROP(inode); + goto fail2; } ext3_debug("allocating inode %lu\n", inode->i_ino); @@ -626,11 +631,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) brelse(bitmap_bh); return ret; -fail_free_drop: - DQUOT_FREE_INODE(inode); - -fail_drop: - DQUOT_DROP(inode); +fail2: inode->i_flags |= S_NOQUOTA; inode->i_nlink = 0; iput(inode); diff --git a/trunk/fs/fuse/dir.c b/trunk/fs/fuse/dir.c index 29f1e9f6e85c..e79e49b3eec7 100644 --- a/trunk/fs/fuse/dir.c +++ b/trunk/fs/fuse/dir.c @@ -96,8 +96,6 @@ static int fuse_lookup_iget(struct inode *dir, struct dentry *entry, fuse_lookup_init(req, dir, entry, &outarg); request_send(fc, req); err = req->out.h.error; - if (!err && (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID)) - err = -EIO; if (!err) { inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, &outarg.attr); @@ -154,10 +152,6 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, fuse_put_request(fc, req); return err; } - if (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID) { - fuse_put_request(fc, req); - return -EIO; - } inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, &outarg.attr); if (!inode) { diff --git a/trunk/fs/fuse/file.c b/trunk/fs/fuse/file.c index 657ab11c173b..6454022b0536 100644 --- a/trunk/fs/fuse/file.c +++ b/trunk/fs/fuse/file.c @@ -23,10 +23,6 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir) struct fuse_file *ff; int err; - /* VFS checks this, but only _after_ ->open() */ - if (file->f_flags & O_DIRECT) - return -EINVAL; - err = generic_file_open(inode, file); if (err) return err; diff --git a/trunk/fs/hostfs/hostfs_kern.c b/trunk/fs/hostfs/hostfs_kern.c index dd7113106269..59c5062cd63f 100644 --- a/trunk/fs/hostfs/hostfs_kern.c +++ b/trunk/fs/hostfs/hostfs_kern.c @@ -793,6 +793,11 @@ int hostfs_rename(struct inode *from_ino, struct dentry *from, return(err); } +void hostfs_truncate(struct inode *ino) +{ + not_implemented(); +} + int hostfs_permission(struct inode *ino, int desired, struct nameidata *nd) { char *name; @@ -889,6 +894,7 @@ static struct inode_operations hostfs_iops = { .rmdir = hostfs_rmdir, .mknod = hostfs_mknod, .rename = hostfs_rename, + .truncate = hostfs_truncate, .permission = hostfs_permission, .setattr = hostfs_setattr, .getattr = hostfs_getattr, @@ -904,6 +910,7 @@ static struct inode_operations hostfs_dir_iops = { .rmdir = hostfs_rmdir, .mknod = hostfs_mknod, .rename = hostfs_rename, + .truncate = hostfs_truncate, .permission = hostfs_permission, .setattr = hostfs_setattr, .getattr = hostfs_getattr, diff --git a/trunk/fs/mpage.c b/trunk/fs/mpage.c index c5adcdddf3cc..bb9aebe93862 100644 --- a/trunk/fs/mpage.c +++ b/trunk/fs/mpage.c @@ -102,7 +102,7 @@ static struct bio *mpage_bio_submit(int rw, struct bio *bio) static struct bio * mpage_alloc(struct block_device *bdev, sector_t first_sector, int nr_vecs, - gfp_t gfp_flags) + unsigned int __nocast gfp_flags) { struct bio *bio; diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index aa62dbda93ac..043d587216b5 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1551,19 +1551,19 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd) if (nd->last_type != LAST_NORM) goto exit; if (nd->last.name[nd->last.len]) { - __putname(nd->last.name); + putname(nd->last.name); goto exit; } error = -ELOOP; if (count++==32) { - __putname(nd->last.name); + putname(nd->last.name); goto exit; } dir = nd->dentry; down(&dir->d_inode->i_sem); path.dentry = __lookup_hash(&nd->last, nd->dentry, nd); path.mnt = nd->mnt; - __putname(nd->last.name); + putname(nd->last.name); goto do_last; } diff --git a/trunk/fs/nfs/delegation.c b/trunk/fs/nfs/delegation.c index 4a36839f0bbd..d7f7eb669d03 100644 --- a/trunk/fs/nfs/delegation.c +++ b/trunk/fs/nfs/delegation.c @@ -85,10 +85,6 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct struct nfs_delegation *delegation; int status = 0; - /* Ensure we first revalidate the attributes and page cache! */ - if ((nfsi->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_ATTR))) - __nfs_revalidate_inode(NFS_SERVER(inode), inode); - delegation = nfs_alloc_delegation(); if (delegation == NULL) return -ENOMEM; diff --git a/trunk/fs/nfs/dir.c b/trunk/fs/nfs/dir.c index 2df639f143e8..94a7fcee0624 100644 --- a/trunk/fs/nfs/dir.c +++ b/trunk/fs/nfs/dir.c @@ -1539,7 +1539,8 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, #endif goto out; } - } + } else + new_inode->i_nlink--; go_ahead: /* diff --git a/trunk/fs/nfs/file.c b/trunk/fs/nfs/file.c index 6bdcfa95de94..f6b9eda925c5 100644 --- a/trunk/fs/nfs/file.c +++ b/trunk/fs/nfs/file.c @@ -137,8 +137,7 @@ static int nfs_revalidate_file(struct inode *inode, struct file *filp) struct nfs_inode *nfsi = NFS_I(inode); int retval = 0; - if ((nfsi->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_ATTR)) - || nfs_attribute_timeout(inode)) + if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) || nfs_attribute_timeout(inode)) retval = __nfs_revalidate_inode(NFS_SERVER(inode), inode); nfs_revalidate_mapping(inode, filp->f_mapping); return 0; diff --git a/trunk/fs/nfs/inode.c b/trunk/fs/nfs/inode.c index d4eadeea128e..6922469d6fc5 100644 --- a/trunk/fs/nfs/inode.c +++ b/trunk/fs/nfs/inode.c @@ -877,10 +877,12 @@ static int nfs_wait_on_inode(struct inode *inode) sigset_t oldmask; int error; + atomic_inc(&inode->i_count); rpc_clnt_sigmask(clnt, &oldmask); error = wait_on_bit_lock(&nfsi->flags, NFS_INO_REVALIDATING, nfs_wait_schedule, TASK_INTERRUPTIBLE); rpc_clnt_sigunmask(clnt, &oldmask); + iput(inode); return error; } @@ -1224,6 +1226,10 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) loff_t cur_size, new_isize; int data_unstable; + /* Do we hold a delegation? */ + if (nfs_have_delegation(inode, FMODE_READ)) + return 0; + spin_lock(&inode->i_lock); /* Are we in the process of updating data on the server? */ @@ -1344,8 +1350,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign nfsi->read_cache_jiffies = fattr->timestamp; /* Are we racing with known updates of the metadata on the server? */ - data_unstable = ! (nfs_verify_change_attribute(inode, verifier) || - (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)); + data_unstable = ! nfs_verify_change_attribute(inode, verifier); /* Check if our cached file size is stale */ new_isize = nfs_size_to_loff_t(fattr->size); diff --git a/trunk/fs/nfs_common/nfsacl.c b/trunk/fs/nfs_common/nfsacl.c index 0c2be8c0307d..251e5a1bb1c4 100644 --- a/trunk/fs/nfs_common/nfsacl.c +++ b/trunk/fs/nfs_common/nfsacl.c @@ -48,26 +48,43 @@ xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem) (struct nfsacl_encode_desc *) desc; u32 *p = (u32 *) elem; - struct posix_acl_entry *entry = - &nfsacl_desc->acl->a_entries[nfsacl_desc->count++]; + if (nfsacl_desc->count < nfsacl_desc->acl->a_count) { + struct posix_acl_entry *entry = + &nfsacl_desc->acl->a_entries[nfsacl_desc->count++]; - *p++ = htonl(entry->e_tag | nfsacl_desc->typeflag); - switch(entry->e_tag) { - case ACL_USER_OBJ: - *p++ = htonl(nfsacl_desc->uid); - break; - case ACL_GROUP_OBJ: - *p++ = htonl(nfsacl_desc->gid); - break; - case ACL_USER: - case ACL_GROUP: - *p++ = htonl(entry->e_id); - break; - default: /* Solaris depends on that! */ - *p++ = 0; - break; + *p++ = htonl(entry->e_tag | nfsacl_desc->typeflag); + switch(entry->e_tag) { + case ACL_USER_OBJ: + *p++ = htonl(nfsacl_desc->uid); + break; + case ACL_GROUP_OBJ: + *p++ = htonl(nfsacl_desc->gid); + break; + case ACL_USER: + case ACL_GROUP: + *p++ = htonl(entry->e_id); + break; + default: /* Solaris depends on that! */ + *p++ = 0; + break; + } + *p++ = htonl(entry->e_perm & S_IRWXO); + } else { + const struct posix_acl_entry *pa, *pe; + int group_obj_perm = ACL_READ|ACL_WRITE|ACL_EXECUTE; + + FOREACH_ACL_ENTRY(pa, nfsacl_desc->acl, pe) { + if (pa->e_tag == ACL_GROUP_OBJ) { + group_obj_perm = pa->e_perm & S_IRWXO; + break; + } + } + /* fake up ACL_MASK entry */ + *p++ = htonl(ACL_MASK | nfsacl_desc->typeflag); + *p++ = htonl(0); + *p++ = htonl(group_obj_perm); } - *p++ = htonl(entry->e_perm & S_IRWXO); + return 0; } @@ -88,28 +105,11 @@ nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, .gid = inode->i_gid, }; int err; - struct posix_acl *acl2 = NULL; if (entries > NFS_ACL_MAX_ENTRIES || xdr_encode_word(buf, base, entries)) return -EINVAL; - if (encode_entries && acl && acl->a_count == 3) { - /* Fake up an ACL_MASK entry. */ - acl2 = posix_acl_alloc(4, GFP_KERNEL); - if (!acl2) - return -ENOMEM; - /* Insert entries in canonical order: other orders seem - to confuse Solaris VxFS. */ - acl2->a_entries[0] = acl->a_entries[0]; /* ACL_USER_OBJ */ - acl2->a_entries[1] = acl->a_entries[1]; /* ACL_GROUP_OBJ */ - acl2->a_entries[2] = acl->a_entries[1]; /* ACL_MASK */ - acl2->a_entries[2].e_tag = ACL_MASK; - acl2->a_entries[3] = acl->a_entries[2]; /* ACL_OTHER */ - nfsacl_desc.acl = acl2; - } err = xdr_encode_array2(buf, base + 4, &nfsacl_desc.desc); - if (acl2) - posix_acl_release(acl2); if (!err) err = 8 + nfsacl_desc.desc.elem_size * nfsacl_desc.desc.array_len; diff --git a/trunk/fs/ntfs/ChangeLog b/trunk/fs/ntfs/ChangeLog index de58579a1d0e..c7e9237379c2 100644 --- a/trunk/fs/ntfs/ChangeLog +++ b/trunk/fs/ntfs/ChangeLog @@ -29,8 +29,7 @@ ToDo/Notes: The Windows boot will run chkdsk and then reboot. The user can then immediately boot into Linux rather than having to do a full Windows boot first before rebooting into Linux and we will recognize such a - journal and empty it as it is clean by definition. Note, this only - works if chkdsk left the journal in an obviously clean state. + journal and empty it as it is clean by definition. - Support journals ($LogFile) with only one restart page as well as journals with two different restart pages. We sanity check both and either use the only sane one or the more recent one of the two in the @@ -95,16 +94,6 @@ ToDo/Notes: my ways. - Fix various bugs in the runlist merging code. (Based on libntfs changes by Richard Russon.) - - Fix sparse warnings that have crept in over time. - - Change ntfs_cluster_free() to require a write locked runlist on entry - since we otherwise get into a lock reversal deadlock if a read locked - runlist is passed in. In the process also change it to take an ntfs - inode instead of a vfs inode as parameter. - - Fix the definition of the CHKD ntfs record magic. It had an off by - two error causing it to be CHKB instead of CHKD. - - Fix a stupid bug in __ntfs_bitmap_set_bits_in_run() which caused the - count to become negative and hence we had a wild memset() scribbling - all over the system's ram. 2.1.23 - Implement extension of resident files and make writing safe as well as many bug fixes, cleanups, and enhancements... diff --git a/trunk/fs/ntfs/bitmap.c b/trunk/fs/ntfs/bitmap.c index 7a190cdc60e2..12cf2e30c7dd 100644 --- a/trunk/fs/ntfs/bitmap.c +++ b/trunk/fs/ntfs/bitmap.c @@ -1,7 +1,7 @@ /* * bitmap.c - NTFS kernel bitmap handling. Part of the Linux-NTFS project. * - * Copyright (c) 2004-2005 Anton Altaparmakov + * Copyright (c) 2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -90,8 +90,7 @@ int __ntfs_bitmap_set_bits_in_run(struct inode *vi, const s64 start_bit, /* If the first byte is partial, modify the appropriate bits in it. */ if (bit) { u8 *byte = kaddr + pos; - while ((bit & 7) && cnt) { - cnt--; + while ((bit & 7) && cnt--) { if (value) *byte |= 1 << bit++; else diff --git a/trunk/fs/ntfs/layout.h b/trunk/fs/ntfs/layout.h index 5c248d404f05..609ad1728ce4 100644 --- a/trunk/fs/ntfs/layout.h +++ b/trunk/fs/ntfs/layout.h @@ -123,7 +123,7 @@ enum { magic_RCRD = const_cpu_to_le32(0x44524352), /* Log record page. */ /* Found in $LogFile/$DATA. (May be found in $MFT/$DATA, also?) */ - magic_CHKD = const_cpu_to_le32(0x444b4843), /* Modified by chkdsk. */ + magic_CHKD = const_cpu_to_le32(0x424b4843), /* Modified by chkdsk. */ /* Found in all ntfs record containing records. */ magic_BAAD = const_cpu_to_le32(0x44414142), /* Failed multi sector @@ -308,8 +308,10 @@ typedef le16 MFT_RECORD_FLAGS; * The _LE versions are to be applied on little endian MFT_REFs. * Note: The _LE versions will return a CPU endian formatted value! */ -#define MFT_REF_MASK_CPU 0x0000ffffffffffffULL -#define MFT_REF_MASK_LE const_cpu_to_le64(MFT_REF_MASK_CPU) +typedef enum { + MFT_REF_MASK_CPU = 0x0000ffffffffffffULL, + MFT_REF_MASK_LE = const_cpu_to_le64(0x0000ffffffffffffULL), +} MFT_REF_CONSTS; typedef u64 MFT_REF; typedef le64 leMFT_REF; diff --git a/trunk/fs/ntfs/lcnalloc.c b/trunk/fs/ntfs/lcnalloc.c index 5af3bf0b7eee..7b5934290685 100644 --- a/trunk/fs/ntfs/lcnalloc.c +++ b/trunk/fs/ntfs/lcnalloc.c @@ -779,13 +779,14 @@ switch_to_data1_zone: search_zone = 2; /** * __ntfs_cluster_free - free clusters on an ntfs volume - * @ni: ntfs inode whose runlist describes the clusters to free - * @start_vcn: vcn in the runlist of @ni at which to start freeing clusters + * @vi: vfs inode whose runlist describes the clusters to free + * @start_vcn: vcn in the runlist of @vi at which to start freeing clusters * @count: number of clusters to free or -1 for all clusters + * @write_locked: true if the runlist is locked for writing * @is_rollback: true if this is a rollback operation * * Free @count clusters starting at the cluster @start_vcn in the runlist - * described by the vfs inode @ni. + * described by the vfs inode @vi. * * If @count is -1, all clusters from @start_vcn to the end of the runlist are * deallocated. Thus, to completely free all clusters in a runlist, use @@ -800,28 +801,31 @@ switch_to_data1_zone: search_zone = 2; * Return the number of deallocated clusters (not counting sparse ones) on * success and -errno on error. * - * Locking: - The runlist described by @ni must be locked for writing on entry - * and is locked on return. Note the runlist may be modified when - * needed runlist fragments need to be mapped. + * Locking: - The runlist described by @vi must be locked on entry and is + * locked on return. Note if the runlist is locked for reading the + * lock may be dropped and reacquired. Note the runlist may be + * modified when needed runlist fragments need to be mapped. * - The volume lcn bitmap must be unlocked on entry and is unlocked * on return. * - This function takes the volume lcn bitmap lock for writing and * modifies the bitmap contents. */ -s64 __ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, s64 count, - const BOOL is_rollback) +s64 __ntfs_cluster_free(struct inode *vi, const VCN start_vcn, s64 count, + const BOOL write_locked, const BOOL is_rollback) { s64 delta, to_free, total_freed, real_freed; + ntfs_inode *ni; ntfs_volume *vol; struct inode *lcnbmp_vi; runlist_element *rl; int err; - BUG_ON(!ni); + BUG_ON(!vi); ntfs_debug("Entering for i_ino 0x%lx, start_vcn 0x%llx, count " - "0x%llx.%s", ni->mft_no, (unsigned long long)start_vcn, + "0x%llx.%s", vi->i_ino, (unsigned long long)start_vcn, (unsigned long long)count, is_rollback ? " (rollback)" : ""); + ni = NTFS_I(vi); vol = ni->vol; lcnbmp_vi = vol->lcnbmp_ino; BUG_ON(!lcnbmp_vi); @@ -839,7 +843,7 @@ s64 __ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, s64 count, total_freed = real_freed = 0; - rl = ntfs_attr_find_vcn_nolock(ni, start_vcn, TRUE); + rl = ntfs_attr_find_vcn_nolock(ni, start_vcn, write_locked); if (IS_ERR(rl)) { if (!is_rollback) ntfs_error(vol->sb, "Failed to find first runlist " @@ -893,7 +897,7 @@ s64 __ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, s64 count, /* Attempt to map runlist. */ vcn = rl->vcn; - rl = ntfs_attr_find_vcn_nolock(ni, vcn, TRUE); + rl = ntfs_attr_find_vcn_nolock(ni, vcn, write_locked); if (IS_ERR(rl)) { err = PTR_ERR(rl); if (!is_rollback) @@ -961,7 +965,8 @@ s64 __ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, s64 count, * If rollback fails, set the volume errors flag, emit an error * message, and return the error code. */ - delta = __ntfs_cluster_free(ni, start_vcn, total_freed, TRUE); + delta = __ntfs_cluster_free(vi, start_vcn, total_freed, write_locked, + TRUE); if (delta < 0) { ntfs_error(vol->sb, "Failed to rollback (error %i). Leaving " "inconsistent metadata! Unmount and run " diff --git a/trunk/fs/ntfs/lcnalloc.h b/trunk/fs/ntfs/lcnalloc.h index a6a8827882e7..e4d7fb98d685 100644 --- a/trunk/fs/ntfs/lcnalloc.h +++ b/trunk/fs/ntfs/lcnalloc.h @@ -2,7 +2,7 @@ * lcnalloc.h - Exports for NTFS kernel cluster (de)allocation. Part of the * Linux-NTFS project. * - * Copyright (c) 2004-2005 Anton Altaparmakov + * Copyright (c) 2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -28,7 +28,6 @@ #include #include "types.h" -#include "inode.h" #include "runlist.h" #include "volume.h" @@ -43,17 +42,18 @@ extern runlist_element *ntfs_cluster_alloc(ntfs_volume *vol, const VCN start_vcn, const s64 count, const LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone); -extern s64 __ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, - s64 count, const BOOL is_rollback); +extern s64 __ntfs_cluster_free(struct inode *vi, const VCN start_vcn, + s64 count, const BOOL write_locked, const BOOL is_rollback); /** * ntfs_cluster_free - free clusters on an ntfs volume - * @ni: ntfs inode whose runlist describes the clusters to free - * @start_vcn: vcn in the runlist of @ni at which to start freeing clusters + * @vi: vfs inode whose runlist describes the clusters to free + * @start_vcn: vcn in the runlist of @vi at which to start freeing clusters * @count: number of clusters to free or -1 for all clusters + * @write_locked: true if the runlist is locked for writing * * Free @count clusters starting at the cluster @start_vcn in the runlist - * described by the ntfs inode @ni. + * described by the vfs inode @vi. * * If @count is -1, all clusters from @start_vcn to the end of the runlist are * deallocated. Thus, to completely free all clusters in a runlist, use @@ -65,18 +65,19 @@ extern s64 __ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, * Return the number of deallocated clusters (not counting sparse ones) on * success and -errno on error. * - * Locking: - The runlist described by @ni must be locked for writing on entry - * and is locked on return. Note the runlist may be modified when - * needed runlist fragments need to be mapped. + * Locking: - The runlist described by @vi must be locked on entry and is + * locked on return. Note if the runlist is locked for reading the + * lock may be dropped and reacquired. Note the runlist may be + * modified when needed runlist fragments need to be mapped. * - The volume lcn bitmap must be unlocked on entry and is unlocked * on return. * - This function takes the volume lcn bitmap lock for writing and * modifies the bitmap contents. */ -static inline s64 ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, - s64 count) +static inline s64 ntfs_cluster_free(struct inode *vi, const VCN start_vcn, + s64 count, const BOOL write_locked) { - return __ntfs_cluster_free(ni, start_vcn, count, FALSE); + return __ntfs_cluster_free(vi, start_vcn, count, write_locked, FALSE); } extern int ntfs_cluster_free_from_rl_nolock(ntfs_volume *vol, diff --git a/trunk/fs/ntfs/logfile.c b/trunk/fs/ntfs/logfile.c index 0fd70295cca6..0173e95500d9 100644 --- a/trunk/fs/ntfs/logfile.c +++ b/trunk/fs/ntfs/logfile.c @@ -51,8 +51,7 @@ static BOOL ntfs_check_restart_page_header(struct inode *vi, RESTART_PAGE_HEADER *rp, s64 pos) { u32 logfile_system_page_size, logfile_log_page_size; - u16 ra_ofs, usa_count, usa_ofs, usa_end = 0; - BOOL have_usa = TRUE; + u16 usa_count, usa_ofs, usa_end, ra_ofs; ntfs_debug("Entering."); /* @@ -87,14 +86,6 @@ static BOOL ntfs_check_restart_page_header(struct inode *vi, (int)sle16_to_cpu(rp->minor_ver)); return FALSE; } - /* - * If chkdsk has been run the restart page may not be protected by an - * update sequence array. - */ - if (ntfs_is_chkd_record(rp->magic) && !le16_to_cpu(rp->usa_count)) { - have_usa = FALSE; - goto skip_usa_checks; - } /* Verify the size of the update sequence array. */ usa_count = 1 + (logfile_system_page_size >> NTFS_BLOCK_SIZE_BITS); if (usa_count != le16_to_cpu(rp->usa_count)) { @@ -111,7 +102,6 @@ static BOOL ntfs_check_restart_page_header(struct inode *vi, "inconsistent update sequence array offset."); return FALSE; } -skip_usa_checks: /* * Verify the position of the restart area. It must be: * - aligned to 8-byte boundary, @@ -119,8 +109,7 @@ static BOOL ntfs_check_restart_page_header(struct inode *vi, * - within the system page size. */ ra_ofs = le16_to_cpu(rp->restart_area_offset); - if (ra_ofs & 7 || (have_usa ? ra_ofs < usa_end : - ra_ofs < sizeof(RESTART_PAGE_HEADER)) || + if (ra_ofs & 7 || ra_ofs < usa_end || ra_ofs > logfile_system_page_size) { ntfs_error(vi->i_sb, "$LogFile restart page specifies " "inconsistent restart area offset."); @@ -413,12 +402,8 @@ static int ntfs_check_and_load_restart_page(struct inode *vi, idx++; } while (to_read > 0); } - /* - * Perform the multi sector transfer deprotection on the buffer if the - * restart page is protected. - */ - if ((!ntfs_is_chkd_record(trp->magic) || le16_to_cpu(trp->usa_count)) - && post_read_mst_fixup((NTFS_RECORD*)trp, + /* Perform the multi sector transfer deprotection on the buffer. */ + if (post_read_mst_fixup((NTFS_RECORD*)trp, le32_to_cpu(rp->system_page_size))) { /* * A multi sector tranfer error was detected. We only need to @@ -630,16 +615,11 @@ BOOL ntfs_check_logfile(struct inode *log_vi, RESTART_PAGE_HEADER **rp) * Otherwise just throw it away. */ if (rstr2_lsn > rstr1_lsn) { - ntfs_debug("Using second restart page as it is more " - "recent."); ntfs_free(rstr1_ph); rstr1_ph = rstr2_ph; /* rstr1_lsn = rstr2_lsn; */ - } else { - ntfs_debug("Using first restart page as it is more " - "recent."); + } else ntfs_free(rstr2_ph); - } rstr2_ph = NULL; } /* All consistency checks passed. */ diff --git a/trunk/fs/ntfs/logfile.h b/trunk/fs/ntfs/logfile.h index a51f3dd0e9eb..42388f95ea6d 100644 --- a/trunk/fs/ntfs/logfile.h +++ b/trunk/fs/ntfs/logfile.h @@ -113,7 +113,7 @@ typedef struct { */ enum { RESTART_VOLUME_IS_CLEAN = const_cpu_to_le16(0x0002), - RESTART_SPACE_FILLER = const_cpu_to_le16(0xffff), /* gcc: Force enum bit width to 16. */ + RESTART_SPACE_FILLER = 0xffff, /* gcc: Force enum bit width to 16. */ } __attribute__ ((__packed__)); typedef le16 RESTART_AREA_FLAGS; diff --git a/trunk/fs/ntfs/malloc.h b/trunk/fs/ntfs/malloc.h index 590887b943f5..006946efca8c 100644 --- a/trunk/fs/ntfs/malloc.h +++ b/trunk/fs/ntfs/malloc.h @@ -40,7 +40,7 @@ * Depending on @gfp_mask the allocation may be guaranteed to succeed. */ static inline void *__ntfs_malloc(unsigned long size, - gfp_t gfp_mask) + unsigned int __nocast gfp_mask) { if (likely(size <= PAGE_SIZE)) { BUG_ON(!size); diff --git a/trunk/fs/ntfs/mft.c b/trunk/fs/ntfs/mft.c index b011369b5956..2c32b84385a8 100644 --- a/trunk/fs/ntfs/mft.c +++ b/trunk/fs/ntfs/mft.c @@ -58,8 +58,7 @@ static inline MFT_RECORD *map_mft_record_page(ntfs_inode *ni) * overflowing the unsigned long, but I don't think we would ever get * here if the volume was that big... */ - index = (u64)ni->mft_no << vol->mft_record_size_bits >> - PAGE_CACHE_SHIFT; + index = ni->mft_no << vol->mft_record_size_bits >> PAGE_CACHE_SHIFT; ofs = (ni->mft_no << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK; i_size = i_size_read(mft_vi); @@ -1954,7 +1953,7 @@ static int ntfs_mft_data_extend_allocation_nolock(ntfs_volume *vol) a = ctx->attr; a->data.non_resident.highest_vcn = cpu_to_sle64(old_last_vcn - 1); undo_alloc: - if (ntfs_cluster_free(mft_ni, old_last_vcn, -1) < 0) { + if (ntfs_cluster_free(vol->mft_ino, old_last_vcn, -1, TRUE) < 0) { ntfs_error(vol->sb, "Failed to free clusters from mft data " "attribute.%s", es); NVolSetErrors(vol); diff --git a/trunk/fs/ntfs/unistr.c b/trunk/fs/ntfs/unistr.c index 0ea887fc859c..a389a5a16c84 100644 --- a/trunk/fs/ntfs/unistr.c +++ b/trunk/fs/ntfs/unistr.c @@ -1,7 +1,7 @@ /* * unistr.c - NTFS Unicode string handling. Part of the Linux-NTFS project. * - * Copyright (c) 2001-2005 Anton Altaparmakov + * Copyright (c) 2001-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published diff --git a/trunk/fs/posix_acl.c b/trunk/fs/posix_acl.c index 6c8dcf7613fd..296480e96dd5 100644 --- a/trunk/fs/posix_acl.c +++ b/trunk/fs/posix_acl.c @@ -35,7 +35,7 @@ EXPORT_SYMBOL(posix_acl_permission); * Allocate a new ACL with the specified number of entries. */ struct posix_acl * -posix_acl_alloc(int count, gfp_t flags) +posix_acl_alloc(int count, unsigned int __nocast flags) { const size_t size = sizeof(struct posix_acl) + count * sizeof(struct posix_acl_entry); @@ -51,7 +51,7 @@ posix_acl_alloc(int count, gfp_t flags) * Clone an ACL. */ struct posix_acl * -posix_acl_clone(const struct posix_acl *acl, gfp_t flags) +posix_acl_clone(const struct posix_acl *acl, unsigned int __nocast flags) { struct posix_acl *clone = NULL; @@ -185,7 +185,7 @@ posix_acl_equiv_mode(const struct posix_acl *acl, mode_t *mode_p) * Create an ACL representing the file mode permission bits of an inode. */ struct posix_acl * -posix_acl_from_mode(mode_t mode, gfp_t flags) +posix_acl_from_mode(mode_t mode, unsigned int __nocast flags) { struct posix_acl *acl = posix_acl_alloc(3, flags); if (!acl) diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index a170450aadb1..3b33f94020db 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -103,9 +103,7 @@ enum pid_directory_inos { PROC_TGID_NUMA_MAPS, PROC_TGID_MOUNTS, PROC_TGID_WCHAN, -#ifdef CONFIG_MMU PROC_TGID_SMAPS, -#endif #ifdef CONFIG_SCHEDSTATS PROC_TGID_SCHEDSTAT, #endif @@ -143,9 +141,7 @@ enum pid_directory_inos { PROC_TID_NUMA_MAPS, PROC_TID_MOUNTS, PROC_TID_WCHAN, -#ifdef CONFIG_MMU PROC_TID_SMAPS, -#endif #ifdef CONFIG_SCHEDSTATS PROC_TID_SCHEDSTAT, #endif @@ -199,9 +195,7 @@ static struct pid_entry tgid_base_stuff[] = { E(PROC_TGID_ROOT, "root", S_IFLNK|S_IRWXUGO), E(PROC_TGID_EXE, "exe", S_IFLNK|S_IRWXUGO), E(PROC_TGID_MOUNTS, "mounts", S_IFREG|S_IRUGO), -#ifdef CONFIG_MMU E(PROC_TGID_SMAPS, "smaps", S_IFREG|S_IRUGO), -#endif #ifdef CONFIG_SECURITY E(PROC_TGID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO), #endif @@ -241,9 +235,7 @@ static struct pid_entry tid_base_stuff[] = { E(PROC_TID_ROOT, "root", S_IFLNK|S_IRWXUGO), E(PROC_TID_EXE, "exe", S_IFLNK|S_IRWXUGO), E(PROC_TID_MOUNTS, "mounts", S_IFREG|S_IRUGO), -#ifdef CONFIG_MMU E(PROC_TID_SMAPS, "smaps", S_IFREG|S_IRUGO), -#endif #ifdef CONFIG_SECURITY E(PROC_TID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO), #endif @@ -638,7 +630,6 @@ static struct file_operations proc_numa_maps_operations = { }; #endif -#ifdef CONFIG_MMU extern struct seq_operations proc_pid_smaps_op; static int smaps_open(struct inode *inode, struct file *file) { @@ -657,7 +648,6 @@ static struct file_operations proc_smaps_operations = { .llseek = seq_lseek, .release = seq_release, }; -#endif extern struct seq_operations mounts_op; static int mounts_open(struct inode *inode, struct file *file) @@ -1691,12 +1681,10 @@ static struct dentry *proc_pident_lookup(struct inode *dir, case PROC_TGID_MOUNTS: inode->i_fop = &proc_mounts_operations; break; -#ifdef CONFIG_MMU case PROC_TID_SMAPS: case PROC_TGID_SMAPS: inode->i_fop = &proc_smaps_operations; break; -#endif #ifdef CONFIG_SECURITY case PROC_TID_ATTR: inode->i_nlink = 2; diff --git a/trunk/fs/proc/nommu.c b/trunk/fs/proc/nommu.c index cff10ab1af63..f3bf016d5ee3 100644 --- a/trunk/fs/proc/nommu.c +++ b/trunk/fs/proc/nommu.c @@ -91,7 +91,6 @@ static void *nommu_vma_list_start(struct seq_file *m, loff_t *_pos) next = _rb; break; } - pos--; } return next; diff --git a/trunk/fs/read_write.c b/trunk/fs/read_write.c index a091ee4f430d..b60324aaa2b6 100644 --- a/trunk/fs/read_write.c +++ b/trunk/fs/read_write.c @@ -497,9 +497,6 @@ static ssize_t do_readv_writev(int type, struct file *file, } ret = rw_verify_area(type, file, pos, tot_len); - if (ret) - goto out; - ret = security_file_permission(file, type == READ ? MAY_READ : MAY_WRITE); if (ret) goto out; diff --git a/trunk/fs/relayfs/buffers.c b/trunk/fs/relayfs/buffers.c index 84e21ffa5ca8..2aa8e2719999 100644 --- a/trunk/fs/relayfs/buffers.c +++ b/trunk/fs/relayfs/buffers.c @@ -109,7 +109,7 @@ static void *relay_alloc_buf(struct rchan_buf *buf, unsigned long size) if (unlikely(!buf->page_array[i])) goto depopulate; } - mem = vmap(buf->page_array, n_pages, VM_MAP, PAGE_KERNEL); + mem = vmap(buf->page_array, n_pages, GFP_KERNEL, PAGE_KERNEL); if (!mem) goto depopulate; diff --git a/trunk/fs/xfs/linux-2.6/kmem.c b/trunk/fs/xfs/linux-2.6/kmem.c index d2653b589b1c..4b184559f231 100644 --- a/trunk/fs/xfs/linux-2.6/kmem.c +++ b/trunk/fs/xfs/linux-2.6/kmem.c @@ -45,7 +45,7 @@ void * -kmem_alloc(size_t size, gfp_t flags) +kmem_alloc(size_t size, unsigned int __nocast flags) { int retries = 0; unsigned int lflags = kmem_flags_convert(flags); @@ -67,7 +67,7 @@ kmem_alloc(size_t size, gfp_t flags) } void * -kmem_zalloc(size_t size, gfp_t flags) +kmem_zalloc(size_t size, unsigned int __nocast flags) { void *ptr; @@ -90,7 +90,7 @@ kmem_free(void *ptr, size_t size) void * kmem_realloc(void *ptr, size_t newsize, size_t oldsize, - gfp_t flags) + unsigned int __nocast flags) { void *new; @@ -105,7 +105,7 @@ kmem_realloc(void *ptr, size_t newsize, size_t oldsize, } void * -kmem_zone_alloc(kmem_zone_t *zone, gfp_t flags) +kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags) { int retries = 0; unsigned int lflags = kmem_flags_convert(flags); @@ -124,7 +124,7 @@ kmem_zone_alloc(kmem_zone_t *zone, gfp_t flags) } void * -kmem_zone_zalloc(kmem_zone_t *zone, gfp_t flags) +kmem_zone_zalloc(kmem_zone_t *zone, unsigned int __nocast flags) { void *ptr; diff --git a/trunk/fs/xfs/linux-2.6/kmem.h b/trunk/fs/xfs/linux-2.6/kmem.h index ee7010f085bc..109fcf27e256 100644 --- a/trunk/fs/xfs/linux-2.6/kmem.h +++ b/trunk/fs/xfs/linux-2.6/kmem.h @@ -81,7 +81,7 @@ typedef unsigned long xfs_pflags_t; *(NSTATEP) = *(OSTATEP); \ } while (0) -static __inline unsigned int kmem_flags_convert(gfp_t flags) +static __inline unsigned int kmem_flags_convert(unsigned int __nocast flags) { unsigned int lflags = __GFP_NOWARN; /* we'll report problems, if need be */ @@ -125,12 +125,13 @@ kmem_zone_destroy(kmem_zone_t *zone) BUG(); } -extern void *kmem_zone_zalloc(kmem_zone_t *, gfp_t); -extern void *kmem_zone_alloc(kmem_zone_t *, gfp_t); +extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast); +extern void *kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast); -extern void *kmem_alloc(size_t, gfp_t); -extern void *kmem_realloc(void *, size_t, size_t, gfp_t); -extern void *kmem_zalloc(size_t, gfp_t); +extern void *kmem_alloc(size_t, unsigned int __nocast); +extern void *kmem_realloc(void *, size_t, size_t, + unsigned int __nocast); +extern void *kmem_zalloc(size_t, unsigned int __nocast); extern void kmem_free(void *, size_t); typedef struct shrinker *kmem_shaker_t; diff --git a/trunk/include/asm-arm/arch-h720x/system.h b/trunk/include/asm-arm/arch-h720x/system.h index 09eda84592ff..0b025e227ec2 100644 --- a/trunk/include/asm-arm/arch-h720x/system.h +++ b/trunk/include/asm-arm/arch-h720x/system.h @@ -17,11 +17,9 @@ static void arch_idle(void) { CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_IDLE; - nop(); - nop(); - CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_RUN; - nop(); - nop(); + __asm__ __volatile__( + "mov r0, r0\n\t" + "mov r0, r0"); } diff --git a/trunk/include/asm-arm/arch-imx/imx-regs.h b/trunk/include/asm-arm/arch-imx/imx-regs.h index a6912b3d8671..93b840e8fa60 100644 --- a/trunk/include/asm-arm/arch-imx/imx-regs.h +++ b/trunk/include/asm-arm/arch-imx/imx-regs.h @@ -76,7 +76,6 @@ #define GPIO_PIN_MASK 0x1f #define GPIO_PORT_MASK (0x3 << 5) -#define GPIO_PORT_SHIFT 5 #define GPIO_PORTA (0<<5) #define GPIO_PORTB (1<<5) #define GPIO_PORTC (2<<5) @@ -89,37 +88,24 @@ #define GPIO_PF (0<<9) #define GPIO_AF (1<<9) -#define GPIO_OCR_SHIFT 10 #define GPIO_OCR_MASK (3<<10) #define GPIO_AIN (0<<10) #define GPIO_BIN (1<<10) #define GPIO_CIN (2<<10) -#define GPIO_DR (3<<10) +#define GPIO_GPIO (3<<10) -#define GPIO_AOUT_SHIFT 12 -#define GPIO_AOUT_MASK (3<<12) -#define GPIO_AOUT (0<<12) -#define GPIO_AOUT_ISR (1<<12) -#define GPIO_AOUT_0 (2<<12) -#define GPIO_AOUT_1 (3<<12) - -#define GPIO_BOUT_SHIFT 14 -#define GPIO_BOUT_MASK (3<<14) -#define GPIO_BOUT (0<<14) -#define GPIO_BOUT_ISR (1<<14) -#define GPIO_BOUT_0 (2<<14) -#define GPIO_BOUT_1 (3<<14) - -#define GPIO_GIUS (1<<16) +#define GPIO_AOUT (1<<12) +#define GPIO_BOUT (1<<13) /* assignements for GPIO alternate/primary functions */ /* FIXME: This list is not completed. The correct directions are * missing on some (many) pins */ -#define PA0_AIN_SPI2_CLK ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 0 ) +#define PA0_PF_A24 ( GPIO_PORTA | GPIO_PF | 0 ) +#define PA0_AIN_SPI2_CLK ( GPIO_PORTA | GPIO_OUT | GPIO_AIN | 0 ) #define PA0_AF_ETMTRACESYNC ( GPIO_PORTA | GPIO_AF | 0 ) -#define PA1_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTA | GPIO_IN | 1 ) +#define PA1_AOUT_SPI2_RXD ( GPIO_PORTA | GPIO_IN | GPIO_AOUT | 1 ) #define PA1_PF_TIN ( GPIO_PORTA | GPIO_PF | 1 ) #define PA2_PF_PWM0 ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 2 ) #define PA3_PF_CSI_MCLK ( GPIO_PORTA | GPIO_PF | 3 ) @@ -137,7 +123,7 @@ #define PA15_PF_I2C_SDA ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 15 ) #define PA16_PF_I2C_SCL ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 16 ) #define PA17_AF_ETMTRACEPKT4 ( GPIO_PORTA | GPIO_AF | 17 ) -#define PA17_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 17 ) +#define PA17_AIN_SPI2_SS ( GPIO_PORTA | GPIO_AIN | 17 ) #define PA18_AF_ETMTRACEPKT5 ( GPIO_PORTA | GPIO_AF | 18 ) #define PA19_AF_ETMTRACEPKT6 ( GPIO_PORTA | GPIO_AF | 19 ) #define PA20_AF_ETMTRACEPKT7 ( GPIO_PORTA | GPIO_AF | 20 ) @@ -205,27 +191,19 @@ #define PC15_PF_SPI1_SS ( GPIO_PORTC | GPIO_PF | 15 ) #define PC16_PF_SPI1_MISO ( GPIO_PORTC | GPIO_PF | 16 ) #define PC17_PF_SPI1_MOSI ( GPIO_PORTC | GPIO_PF | 17 ) -#define PC24_BIN_UART3_RI ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24 ) -#define PC25_BIN_UART3_DSR ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25 ) -#define PC26_AOUT_UART3_DTR ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 26 ) -#define PC27_BIN_UART3_DCD ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27 ) -#define PC28_BIN_UART3_CTS ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28 ) -#define PC29_AOUT_UART3_RTS ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 29 ) -#define PC30_BIN_UART3_TX ( GPIO_GIUS | GPIO_PORTC | GPIO_BIN | 30 ) -#define PC31_AOUT_UART3_RX ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 31) #define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 ) #define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 ) -#define PD7_AF_UART2_DTR ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7 ) -#define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7 ) +#define PD7_AF_UART2_DTR ( GPIO_PORTD | GPIO_IN | GPIO_AF | 7 ) +#define PD7_AIN_SPI2_SCLK ( GPIO_PORTD | GPIO_AIN | 7 ) #define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 ) #define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 ) -#define PD8_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8 ) +#define PD8_AIN_SPI2_SS ( GPIO_PORTD | GPIO_AIN | 8 ) #define PD9_PF_PS ( GPIO_PORTD | GPIO_PF | 9 ) #define PD9_AF_UART2_RI ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 9 ) -#define PD9_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | 9 ) +#define PD9_AOUT_SPI2_RXD ( GPIO_PORTD | GPIO_IN | GPIO_AOUT | 9 ) #define PD10_PF_SPL_SPR ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 10 ) #define PD10_AF_UART2_DSR ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 10 ) -#define PD10_AIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_OUT | 10 ) +#define PD10_AIN_SPI2_TXD ( GPIO_PORTD | GPIO_OUT | GPIO_AIN | 10 ) #define PD11_PF_CONTRAST ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 11 ) #define PD12_PF_ACD_OE ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 12 ) #define PD13_PF_LP_HSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 13 ) @@ -247,7 +225,7 @@ #define PD29_PF_LD14 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 29 ) #define PD30_PF_LD15 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 30 ) #define PD31_PF_TMR2OUT ( GPIO_PORTD | GPIO_PF | 31 ) -#define PD31_BIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_BIN | 31 ) +#define PD31_BIN_SPI2_TXD ( GPIO_PORTD | GPIO_BIN | 31 ) /* * PWM controller diff --git a/trunk/include/asm-arm/arch-ixp4xx/platform.h b/trunk/include/asm-arm/arch-ixp4xx/platform.h index f14ed63590c3..d13ee7f78c70 100644 --- a/trunk/include/asm-arm/arch-ixp4xx/platform.h +++ b/trunk/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); static inline void gpio_line_config(u8 line, u32 direction) { - if (direction == IXP4XX_GPIO_IN) + if (direction == IXP4XX_GPIO_OUT) *IXP4XX_GPIO_GPOER |= (1 << line); else *IXP4XX_GPIO_GPOER &= ~(1 << line); diff --git a/trunk/include/asm-arm/arch-pxa/pxa-regs.h b/trunk/include/asm-arm/arch-pxa/pxa-regs.h index 13fa2deb4ddd..939d9e5020a0 100644 --- a/trunk/include/asm-arm/arch-pxa/pxa-regs.h +++ b/trunk/include/asm-arm/arch-pxa/pxa-regs.h @@ -126,8 +126,8 @@ #define DRCMR12 __REG(0x40000130) /* Request to Channel Map Register for AC97 audio transmit Request */ #define DRCMR13 __REG(0x40000134) /* Request to Channel Map Register for SSP receive Request */ #define DRCMR14 __REG(0x40000138) /* Request to Channel Map Register for SSP transmit Request */ -#define DRCMR15 __REG(0x4000013c) /* Request to Channel Map Register for SSP2 receive Request */ -#define DRCMR16 __REG(0x40000140) /* Request to Channel Map Register for SSP2 transmit Request */ +#define DRCMR15 __REG(0x4000013c) /* Reserved */ +#define DRCMR16 __REG(0x40000140) /* Reserved */ #define DRCMR17 __REG(0x40000144) /* Request to Channel Map Register for ICP receive Request */ #define DRCMR18 __REG(0x40000148) /* Request to Channel Map Register for ICP transmit Request */ #define DRCMR19 __REG(0x4000014c) /* Request to Channel Map Register for STUART receive Request */ @@ -151,8 +151,7 @@ #define DRCMR37 __REG(0x40000194) /* Request to Channel Map Register for USB endpoint 13 Request */ #define DRCMR38 __REG(0x40000198) /* Request to Channel Map Register for USB endpoint 14 Request */ #define DRCMR39 __REG(0x4000019C) /* Reserved */ -#define DRCMR66 __REG(0x40001108) /* Request to Channel Map Register for SSP3 receive Request */ -#define DRCMR67 __REG(0x4000110C) /* Request to Channel Map Register for SSP3 transmit Request */ + #define DRCMR68 __REG(0x40001110) /* Request to Channel Map Register for Camera FIFO 0 Request */ #define DRCMR69 __REG(0x40001114) /* Request to Channel Map Register for Camera FIFO 1 Request */ #define DRCMR70 __REG(0x40001118) /* Request to Channel Map Register for Camera FIFO 2 Request */ diff --git a/trunk/include/asm-arm/arch-pxa/pxafb.h b/trunk/include/asm-arm/arch-pxa/pxafb.h index aba9b30f4249..21c0e16dce5f 100644 --- a/trunk/include/asm-arm/arch-pxa/pxafb.h +++ b/trunk/include/asm-arm/arch-pxa/pxafb.h @@ -66,5 +66,4 @@ struct pxafb_mach_info { }; void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); -void set_pxa_fb_parent(struct device *parent_dev); unsigned long pxafb_get_hsync_time(struct device *dev); diff --git a/trunk/include/asm-arm/arch-rpc/hardware.h b/trunk/include/asm-arm/arch-rpc/hardware.h index 9d7f87375aa7..be9754a05c19 100644 --- a/trunk/include/asm-arm/arch-rpc/hardware.h +++ b/trunk/include/asm-arm/arch-rpc/hardware.h @@ -15,7 +15,7 @@ #include #ifndef __ASSEMBLY__ -#define IOMEM(x) ((void __iomem *)(unsigned long)(x)) +#define IOMEM(x) ((void __iomem *)(x)) #else #define IOMEM(x) x #endif /* __ASSEMBLY__ */ @@ -52,7 +52,7 @@ /* * IO Addresses */ -#define VIDC_BASE IOMEM(0xe0400000) +#define VIDC_BASE (void __iomem *)0xe0400000 #define EXPMASK_BASE 0xe0360000 #define IOMD_BASE IOMEM(0xe0200000) #define IOC_BASE IOMEM(0xe0200000) diff --git a/trunk/include/asm-arm/arch-s3c2410/anubis-map.h b/trunk/include/asm-arm/arch-s3c2410/anubis-map.h index d529ffda8599..97741d6e506a 100644 --- a/trunk/include/asm-arm/arch-s3c2410/anubis-map.h +++ b/trunk/include/asm-arm/arch-s3c2410/anubis-map.h @@ -20,22 +20,22 @@ /* start peripherals off after the S3C2410 */ -#define ANUBIS_IOADDR(x) (S3C2410_ADDR((x) + 0x01800000)) +#define ANUBIS_IOADDR(x) (S3C2410_ADDR((x) + 0x02000000)) #define ANUBIS_PA_CPLD (S3C2410_CS1 | (1<<26)) /* we put the CPLD registers next, to get them out of the way */ -#define ANUBIS_VA_CTRL1 ANUBIS_IOADDR(0x00000000) /* 0x01800000 */ +#define ANUBIS_VA_CTRL1 ANUBIS_IOADDR(0x00000000) /* 0x01300000 */ #define ANUBIS_PA_CTRL1 (ANUBIS_PA_CPLD) -#define ANUBIS_VA_CTRL2 ANUBIS_IOADDR(0x00100000) /* 0x01900000 */ +#define ANUBIS_VA_CTRL2 ANUBIS_IOADDR(0x00100000) /* 0x01400000 */ #define ANUBIS_PA_CTRL2 (ANUBIS_PA_CPLD) -#define ANUBIS_VA_CTRL3 ANUBIS_IOADDR(0x00200000) /* 0x01A00000 */ +#define ANUBIS_VA_CTRL3 ANUBIS_IOADDR(0x00200000) /* 0x01500000 */ #define ANUBIS_PA_CTRL3 (ANUBIS_PA_CPLD) -#define ANUBIS_VA_CTRL4 ANUBIS_IOADDR(0x00300000) /* 0x01B00000 */ +#define ANUBIS_VA_CTRL4 ANUBIS_IOADDR(0x00300000) /* 0x01600000 */ #define ANUBIS_PA_CTRL4 (ANUBIS_PA_CPLD) #define ANUBIS_IDEPRI ANUBIS_IOADDR(0x01000000) diff --git a/trunk/include/asm-arm/arch-s3c2410/hardware.h b/trunk/include/asm-arm/arch-s3c2410/hardware.h index 1c9de29cafef..48a39918a760 100644 --- a/trunk/include/asm-arm/arch-s3c2410/hardware.h +++ b/trunk/include/asm-arm/arch-s3c2410/hardware.h @@ -92,13 +92,6 @@ extern unsigned int s3c2410_gpio_getpin(unsigned int pin); extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg); -#ifdef CONFIG_CPU_S3C2440 - -extern int s3c2440_set_dsc(unsigned int pin, unsigned int value); - -#endif /* CONFIG_CPU_S3C2440 */ - - #endif /* __ASSEMBLY__ */ #include diff --git a/trunk/include/asm-arm/arch-s3c2410/io.h b/trunk/include/asm-arm/arch-s3c2410/io.h index 4bf272ed9add..418233a7ee6f 100644 --- a/trunk/include/asm-arm/arch-s3c2410/io.h +++ b/trunk/include/asm-arm/arch-s3c2410/io.h @@ -9,7 +9,7 @@ * 06-Dec-1997 RMK Created. * 02-Sep-2003 BJD Modified for S3C2410 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA - * 13-Oct-2005 BJD Fixed problems with LDRH/STRH offset range + * */ #ifndef __ASM_ARM_ARCH_IO_H @@ -97,7 +97,7 @@ DECLARE_IO(int,l,"") else \ __asm__ __volatile__( \ "strb %0, [%1, #0] @ outbc" \ - : : "r" (value), "r" ((port))); \ + : : "r" (value), "r" ((port))); \ }) #define __inbc(port) \ @@ -110,61 +110,35 @@ DECLARE_IO(int,l,"") else \ __asm__ __volatile__( \ "ldrb %0, [%1, #0] @ inbc" \ - : "=r" (result) : "r" ((port))); \ + : "=r" (result) : "r" ((port))); \ result; \ }) #define __outwc(value,port) \ ({ \ unsigned long v = value; \ - if (__PORT_PCIO((port))) { \ - if ((port) < 256 && (port) > -256) \ - __asm__ __volatile__( \ - "strh %0, [%1, %2] @ outwc" \ - : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ - else if ((port) > 0) \ - __asm__ __volatile__( \ - "strh %0, [%1, %2] @ outwc" \ - : : "r" (v), \ - "r" (PCIO_BASE + ((port) & ~0xff)), \ - "Jr" (((port) & 0xff))); \ - else \ - __asm__ __volatile__( \ - "strh %0, [%1, #0] @ outwc" \ - : : "r" (v), \ - "r" (PCIO_BASE + (port))); \ - } else \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "strh %0, [%1, %2] @ outwc" \ + : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ + else \ __asm__ __volatile__( \ "strh %0, [%1, #0] @ outwc" \ - : : "r" (v), "r" ((port))); \ + : : "r" (v), "r" ((port))); \ }) #define __inwc(port) \ ({ \ unsigned short result; \ - if (__PORT_PCIO((port))) { \ - if ((port) < 256 && (port) > -256 ) \ - __asm__ __volatile__( \ - "ldrh %0, [%1, %2] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), \ - "Jr" ((port))); \ - else if ((port) > 0) \ - __asm__ __volatile__( \ - "ldrh %0, [%1, %2] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE + ((port) & ~0xff)), \ - "Jr" (((port) & 0xff))); \ - else \ - __asm__ __volatile__( \ - "ldrh %0, [%1, #0] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE + ((port)))); \ - } else \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldrh %0, [%1, %2] @ inwc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \ + else \ __asm__ __volatile__( \ "ldrh %0, [%1, #0] @ inwc" \ - : "=r" (result) : "r" ((port))); \ - result; \ + : "=r" (result) : "r" ((port))); \ + result; \ }) #define __outlc(value,port) \ diff --git a/trunk/include/asm-arm/arch-versatile/io.h b/trunk/include/asm-arm/arch-versatile/io.h index 47e904cf25c7..9f895bf61494 100644 --- a/trunk/include/asm-arm/arch-versatile/io.h +++ b/trunk/include/asm-arm/arch-versatile/io.h @@ -22,11 +22,7 @@ #define IO_SPACE_LIMIT 0xffffffff -static inline void __iomem *__io(unsigned long addr) -{ - return (void __iomem *)addr; -} -#define __io(a) __io(a) +#define __io(a) ((void __iomem *)(a)) #define __mem_pci(a) (a) #define __mem_isa(a) (a) diff --git a/trunk/include/asm-arm/elf.h b/trunk/include/asm-arm/elf.h index 7da97a937548..a1696ba238d3 100644 --- a/trunk/include/asm-arm/elf.h +++ b/trunk/include/asm-arm/elf.h @@ -124,8 +124,6 @@ do { \ if (((ex).e_flags & EF_ARM_EABI_MASK) || \ ((ex).e_flags & EF_ARM_SOFT_FLOAT)) \ set_thread_flag(TIF_USING_IWMMXT); \ - else \ - clear_thread_flag(TIF_USING_IWMMXT); \ } while (0) #endif diff --git a/trunk/include/asm-arm/hardware/scoop.h b/trunk/include/asm-arm/hardware/scoop.h index a8f1013930e3..527404b5a8df 100644 --- a/trunk/include/asm-arm/hardware/scoop.h +++ b/trunk/include/asm-arm/hardware/scoop.h @@ -38,8 +38,6 @@ struct scoop_config { unsigned short io_out; unsigned short io_dir; - unsigned short suspend_clr; - unsigned short suspend_set; }; /* Structure for linking scoop devices to PCMCIA sockets */ diff --git a/trunk/include/asm-arm/io.h b/trunk/include/asm-arm/io.h index 5c4ae8f5dbb0..cfa71a0dffb6 100644 --- a/trunk/include/asm-arm/io.h +++ b/trunk/include/asm-arm/io.h @@ -136,9 +136,9 @@ extern void __readwrite_bug(const char *fn); /* * String version of IO memory access ops: */ -extern void _memcpy_fromio(void *, const volatile void __iomem *, size_t); -extern void _memcpy_toio(volatile void __iomem *, const void *, size_t); -extern void _memset_io(volatile void __iomem *, int, size_t); +extern void _memcpy_fromio(void *, void __iomem *, size_t); +extern void _memcpy_toio(void __iomem *, const void *, size_t); +extern void _memset_io(void __iomem *, int, size_t); #define mmiowb() diff --git a/trunk/include/asm-arm/signal.h b/trunk/include/asm-arm/signal.h index ced69161917b..760f6e65af05 100644 --- a/trunk/include/asm-arm/signal.h +++ b/trunk/include/asm-arm/signal.h @@ -115,6 +115,7 @@ typedef unsigned long sigset_t; #ifdef __KERNEL__ #define SA_TIMER 0x40000000 +#define SA_IRQNOMASK 0x08000000 #endif #include diff --git a/trunk/include/asm-generic/dma-mapping.h b/trunk/include/asm-generic/dma-mapping.h index 747d790295f3..8cef663c5cd9 100644 --- a/trunk/include/asm-generic/dma-mapping.h +++ b/trunk/include/asm-generic/dma-mapping.h @@ -35,7 +35,7 @@ dma_set_mask(struct device *dev, u64 dma_mask) static inline void * dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, - gfp_t flag) + unsigned int __nocast flag) { BUG_ON(dev->bus != &pci_bus_type); @@ -168,7 +168,7 @@ dma_set_mask(struct device *dev, u64 dma_mask) static inline void * dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, - gfp_t flag) + unsigned int __nocast flag) { BUG(); return NULL; diff --git a/trunk/include/asm-generic/pgtable.h b/trunk/include/asm-generic/pgtable.h index ff28c8b31f58..f86c1e549466 100644 --- a/trunk/include/asm-generic/pgtable.h +++ b/trunk/include/asm-generic/pgtable.h @@ -158,19 +158,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres #define lazy_mmu_prot_update(pte) do { } while (0) #endif -#ifndef __HAVE_ARCH_MULTIPLE_ZERO_PAGE -#define move_pte(pte, prot, old_addr, new_addr) (pte) -#else -#define move_pte(pte, prot, old_addr, new_addr) \ -({ \ - pte_t newpte = (pte); \ - if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ - pte_page(pte) == ZERO_PAGE(old_addr)) \ - newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ - newpte; \ -}) -#endif - /* * When walking page tables, get the address of the next boundary, * or the end address of the range if that comes earlier. Although no diff --git a/trunk/include/asm-i386/dma-mapping.h b/trunk/include/asm-i386/dma-mapping.h index e56c335f8ef9..563964b2995b 100644 --- a/trunk/include/asm-i386/dma-mapping.h +++ b/trunk/include/asm-i386/dma-mapping.h @@ -11,7 +11,7 @@ #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag); + dma_addr_t *dma_handle, unsigned int __nocast flag); void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle); diff --git a/trunk/include/asm-i386/hw_irq.h b/trunk/include/asm-i386/hw_irq.h index 622815bf3243..4ac84cc6f01a 100644 --- a/trunk/include/asm-i386/hw_irq.h +++ b/trunk/include/asm-i386/hw_irq.h @@ -18,8 +18,6 @@ #include #include -struct hw_interrupt_type; - /* * Various low-level irq details needed by irq.c, process.c, * time.c, io_apic.c and smp.c diff --git a/trunk/include/asm-ia64/uaccess.h b/trunk/include/asm-ia64/uaccess.h index 9adb51211c22..3a7829bb5954 100644 --- a/trunk/include/asm-ia64/uaccess.h +++ b/trunk/include/asm-ia64/uaccess.h @@ -187,8 +187,8 @@ extern void __get_user_unknown (void); ({ \ const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ __typeof__ (size) __gu_size = (size); \ - long __gu_err = -EFAULT; \ - unsigned long __gu_val = 0; \ + long __gu_err = -EFAULT, __gu_val = 0; \ + \ if (!check || __access_ok(__gu_ptr, size, segment)) \ switch (__gu_size) { \ 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 static inline unsigned long __copy_to_user (void __user *to, const void *from, unsigned long count) { - return __copy_user(to, (__force void __user *) from, count); + return __copy_user(to, (void __user *) from, count); } static inline unsigned long __copy_from_user (void *to, const void __user *from, unsigned long count) { - return __copy_user((__force void __user *) to, from, count); + return __copy_user((void __user *) to, from, count); } #define __copy_to_user_inatomic __copy_to_user @@ -258,7 +258,7 @@ __copy_from_user (void *to, const void __user *from, unsigned long count) long __cu_len = (n); \ \ if (__access_ok(__cu_to, __cu_len, get_fs())) \ - __cu_len = __copy_user(__cu_to, (__force void __user *) __cu_from, __cu_len); \ + __cu_len = __copy_user(__cu_to, (void __user *) __cu_from, __cu_len); \ __cu_len; \ }) @@ -270,7 +270,7 @@ __copy_from_user (void *to, const void __user *from, unsigned long count) \ __chk_user_ptr(__cu_from); \ if (__access_ok(__cu_from, __cu_len, get_fs())) \ - __cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len); \ + __cu_len = __copy_user((void __user *) __cu_to, __cu_from, __cu_len); \ __cu_len; \ }) diff --git a/trunk/include/asm-m32r/io.h b/trunk/include/asm-m32r/io.h index 70ad1c949c2b..8e9e481e6996 100644 --- a/trunk/include/asm-m32r/io.h +++ b/trunk/include/asm-m32r/io.h @@ -60,7 +60,7 @@ __ioremap(unsigned long offset, unsigned long size, unsigned long flags); * address. */ -static inline void __iomem *ioremap(unsigned long offset, unsigned long size) +static inline void * ioremap(unsigned long offset, unsigned long size) { return __ioremap(offset, size, 0); } diff --git a/trunk/include/asm-m32r/uaccess.h b/trunk/include/asm-m32r/uaccess.h index 0da7c47d2f01..93d863c455a1 100644 --- a/trunk/include/asm-m32r/uaccess.h +++ b/trunk/include/asm-m32r/uaccess.h @@ -208,8 +208,7 @@ extern void __get_user_4(void); * On error, the variable @x is set to zero. */ #define get_user(x,ptr) \ -({ int __ret_gu; \ - unsigned long __val_gu; \ +({ int __ret_gu,__val_gu; \ __chk_user_ptr(ptr); \ switch(sizeof (*(ptr))) { \ case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \ @@ -404,8 +403,7 @@ struct __large_struct { unsigned long buf[100]; }; #define __get_user_nocheck(x,ptr,size) \ ({ \ - long __gu_err; \ - unsigned long __gu_val; \ + long __gu_err, __gu_val; \ __get_user_size(__gu_val,(ptr),(size),__gu_err); \ (x) = (__typeof__(*(ptr)))__gu_val; \ __gu_err; \ @@ -596,8 +594,8 @@ static inline unsigned long __generic_copy_to_user_nocheck(void __user *to, return n; } -unsigned long __generic_copy_to_user(void __user *, const void *, unsigned long); -unsigned long __generic_copy_from_user(void *, const void __user *, unsigned long); +unsigned long __generic_copy_to_user(void *, const void *, unsigned long); +unsigned long __generic_copy_from_user(void *, const void *, unsigned long); /** * __copy_to_user: - Copy a block of data into user space, with less checking. diff --git a/trunk/include/asm-mips/pgtable.h b/trunk/include/asm-mips/pgtable.h index eaf5d9b3a0e1..cbd1672c94cb 100644 --- a/trunk/include/asm-mips/pgtable.h +++ b/trunk/include/asm-mips/pgtable.h @@ -68,8 +68,6 @@ extern unsigned long zero_page_mask; #define ZERO_PAGE(vaddr) \ (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) -#define __HAVE_ARCH_MULTIPLE_ZERO_PAGE - extern void paging_init(void); /* diff --git a/trunk/include/asm-powerpc/timex.h b/trunk/include/asm-powerpc/timex.h index c02d15aced91..51c5b316be55 100644 --- a/trunk/include/asm-powerpc/timex.h +++ b/trunk/include/asm-powerpc/timex.h @@ -10,7 +10,7 @@ #include #include -#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */ +#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ typedef unsigned long cycles_t; diff --git a/trunk/include/asm-ppc/cputable.h b/trunk/include/asm-ppc/cputable.h index e17c492c870b..41d8f8425c04 100644 --- a/trunk/include/asm-ppc/cputable.h +++ b/trunk/include/asm-ppc/cputable.h @@ -24,7 +24,6 @@ #define PPC_FEATURE_HAS_SPE 0x00800000 #define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 #define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 -#define PPC_FEATURE_NO_TB 0x00100000 #ifdef __KERNEL__ diff --git a/trunk/include/asm-ppc/dma-mapping.h b/trunk/include/asm-ppc/dma-mapping.h index 061bfcac1bf1..92b8ee78dcc2 100644 --- a/trunk/include/asm-ppc/dma-mapping.h +++ b/trunk/include/asm-ppc/dma-mapping.h @@ -61,7 +61,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask) static inline void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t * dma_handle, - gfp_t gfp) + unsigned int __nocast gfp) { #ifdef CONFIG_NOT_COHERENT_CACHE return __dma_alloc_coherent(size, dma_handle, gfp); diff --git a/trunk/include/asm-ppc/io.h b/trunk/include/asm-ppc/io.h index 94d83998a759..7eb7cf6360bd 100644 --- a/trunk/include/asm-ppc/io.h +++ b/trunk/include/asm-ppc/io.h @@ -56,7 +56,7 @@ extern unsigned long pci_dram_offset; * is actually performed (i.e. the data has come back) before we start * executing any following instructions. */ -extern inline int in_8(const volatile unsigned char __iomem *addr) +extern inline int in_8(volatile unsigned char __iomem *addr) { int ret; @@ -72,7 +72,7 @@ extern inline void out_8(volatile unsigned char __iomem *addr, int val) __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); } -extern inline int in_le16(const volatile unsigned short __iomem *addr) +extern inline int in_le16(volatile unsigned short __iomem *addr) { int ret; @@ -83,7 +83,7 @@ extern inline int in_le16(const volatile unsigned short __iomem *addr) return ret; } -extern inline int in_be16(const volatile unsigned short __iomem *addr) +extern inline int in_be16(volatile unsigned short __iomem *addr) { int ret; @@ -104,7 +104,7 @@ extern inline void out_be16(volatile unsigned short __iomem *addr, int val) __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); } -extern inline unsigned in_le32(const volatile unsigned __iomem *addr) +extern inline unsigned in_le32(volatile unsigned __iomem *addr) { unsigned ret; @@ -115,7 +115,7 @@ extern inline unsigned in_le32(const volatile unsigned __iomem *addr) return ret; } -extern inline unsigned in_be32(const volatile unsigned __iomem *addr) +extern inline unsigned in_be32(volatile unsigned __iomem *addr) { unsigned ret; @@ -139,7 +139,7 @@ extern inline void out_be32(volatile unsigned __iomem *addr, int val) #define readb(addr) in_8((volatile u8 *)(addr)) #define writeb(b,addr) out_8((volatile u8 *)(addr), (b)) #else -static inline __u8 readb(const volatile void __iomem *addr) +static inline __u8 readb(volatile void __iomem *addr) { return in_8(addr); } @@ -150,11 +150,11 @@ static inline void writeb(__u8 b, volatile void __iomem *addr) #endif #if defined(CONFIG_APUS) -static inline __u16 readw(const volatile void __iomem *addr) +static inline __u16 readw(volatile void __iomem *addr) { return *(__force volatile __u16 *)(addr); } -static inline __u32 readl(const volatile void __iomem *addr) +static inline __u32 readl(volatile void __iomem *addr) { return *(__force volatile __u32 *)(addr); } @@ -173,11 +173,11 @@ static inline void writel(__u32 b, volatile void __iomem *addr) #define writew(b,addr) out_le16((volatile u16 *)(addr),(b)) #define writel(b,addr) out_le32((volatile u32 *)(addr),(b)) #else -static inline __u16 readw(const volatile void __iomem *addr) +static inline __u16 readw(volatile void __iomem *addr) { return in_le16(addr); } -static inline __u32 readl(const volatile void __iomem *addr) +static inline __u32 readl(volatile void __iomem *addr) { return in_le32(addr); } diff --git a/trunk/include/asm-ppc/mv64x60.h b/trunk/include/asm-ppc/mv64x60.h index ee2f9188cc64..75c2ffa26b26 100644 --- a/trunk/include/asm-ppc/mv64x60.h +++ b/trunk/include/asm-ppc/mv64x60.h @@ -233,7 +233,7 @@ struct mv64x60_chip_info { struct mv64x60_handle { u32 type; /* type of bridge */ u32 rev; /* revision of bridge */ - void __iomem *v_base;/* virtual base addr of bridge regs */ + void *v_base; /* virtual base addr of bridge regs */ phys_addr_t p_base; /* physical base addr of bridge regs */ 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, u32 cfg_data, struct pci_controller **hose); int mv64x60_get_type(struct mv64x60_handle *bh); int mv64x60_setup_for_chip(struct mv64x60_handle *bh); -void __iomem *mv64x60_get_bridge_vbase(void); +void *mv64x60_get_bridge_vbase(void); u32 mv64x60_get_bridge_type(void); u32 mv64x60_get_bridge_rev(void); void mv64x60_get_mem_windows(struct mv64x60_handle *bh, diff --git a/trunk/include/asm-ppc64/dma-mapping.h b/trunk/include/asm-ppc64/dma-mapping.h index fb68fa23bea8..9ad8adee0067 100644 --- a/trunk/include/asm-ppc64/dma-mapping.h +++ b/trunk/include/asm-ppc64/dma-mapping.h @@ -19,7 +19,7 @@ extern int dma_supported(struct device *dev, u64 mask); extern int dma_set_mask(struct device *dev, u64 dma_mask); extern void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag); + dma_addr_t *dma_handle, unsigned int __nocast flag); extern void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle); extern dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, @@ -118,7 +118,7 @@ dma_cache_sync(void *vaddr, size_t size, */ struct dma_mapping_ops { void * (*alloc_coherent)(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag); + dma_addr_t *dma_handle, unsigned int __nocast flag); void (*free_coherent)(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle); dma_addr_t (*map_single)(struct device *dev, void *ptr, diff --git a/trunk/include/asm-ppc64/iommu.h b/trunk/include/asm-ppc64/iommu.h index c2f3b6e8a42f..72dcf8116b04 100644 --- a/trunk/include/asm-ppc64/iommu.h +++ b/trunk/include/asm-ppc64/iommu.h @@ -122,7 +122,7 @@ extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, int nelems, enum dma_data_direction direction); extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, - dma_addr_t *dma_handle, gfp_t flag); + dma_addr_t *dma_handle, unsigned int __nocast flag); extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, void *vaddr, dma_addr_t dma_handle); extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, diff --git a/trunk/include/asm-ppc64/tlbflush.h b/trunk/include/asm-ppc64/tlbflush.h index 74271d7c1d16..45411a67e082 100644 --- a/trunk/include/asm-ppc64/tlbflush.h +++ b/trunk/include/asm-ppc64/tlbflush.h @@ -25,7 +25,6 @@ struct ppc64_tlb_batch { pte_t pte[PPC64_TLB_BATCH_NR]; unsigned long addr[PPC64_TLB_BATCH_NR]; unsigned long vaddr[PPC64_TLB_BATCH_NR]; - unsigned int large; }; DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); diff --git a/trunk/include/asm-ppc64/uaccess.h b/trunk/include/asm-ppc64/uaccess.h index 132c1276547b..c181a60d868c 100644 --- a/trunk/include/asm-ppc64/uaccess.h +++ b/trunk/include/asm-ppc64/uaccess.h @@ -164,8 +164,7 @@ do { \ #define __get_user_nocheck(x,ptr,size) \ ({ \ - long __gu_err; \ - unsigned long __gu_val; \ + long __gu_err, __gu_val; \ might_sleep(); \ __get_user_size(__gu_val,(ptr),(size),__gu_err,-EFAULT);\ (x) = (__typeof__(*(ptr)))__gu_val; \ @@ -174,8 +173,7 @@ do { \ #define __get_user_check(x,ptr,size) \ ({ \ - long __gu_err = -EFAULT; \ - unsigned long __gu_val = 0; \ + long __gu_err = -EFAULT, __gu_val = 0; \ const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ might_sleep(); \ if (access_ok(VERIFY_READ,__gu_addr,size)) \ diff --git a/trunk/include/asm-s390/sigcontext.h b/trunk/include/asm-s390/sigcontext.h index 803545351dd8..d57bc0cebdce 100644 --- a/trunk/include/asm-s390/sigcontext.h +++ b/trunk/include/asm-s390/sigcontext.h @@ -61,7 +61,7 @@ typedef struct struct sigcontext { unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS]; - _sigregs __user *sregs; + _sigregs *sregs; }; diff --git a/trunk/include/asm-s390/signal.h b/trunk/include/asm-s390/signal.h index 7084626de215..3d6e11c6c1fd 100644 --- a/trunk/include/asm-s390/signal.h +++ b/trunk/include/asm-s390/signal.h @@ -165,7 +165,7 @@ struct sigaction { #endif /* __KERNEL__ */ typedef struct sigaltstack { - void __user *ss_sp; + void *ss_sp; int ss_flags; size_t ss_size; } stack_t; diff --git a/trunk/include/asm-sparc/btfixup.h b/trunk/include/asm-sparc/btfixup.h index c2868d0f60b6..b84c96c89581 100644 --- a/trunk/include/asm-sparc/btfixup.h +++ b/trunk/include/asm-sparc/btfixup.h @@ -49,17 +49,17 @@ extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void); /* Put bottom 13bits into some register variable */ #define BTFIXUPDEF_SIMM13(__name) \ - static inline unsigned int ___sf_##__name(void) __attribute_const__; \ + extern unsigned int ___sf_##__name(void) __attribute_const__; \ extern unsigned ___ss_##__name[2]; \ - static inline unsigned int ___sf_##__name(void) { \ + extern __inline__ unsigned int ___sf_##__name(void) { \ unsigned int ret; \ __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \ return ret; \ } #define BTFIXUPDEF_SIMM13_INIT(__name,__val) \ - static inline unsigned int ___sf_##__name(void) __attribute_const__; \ + extern unsigned int ___sf_##__name(void) __attribute_const__; \ extern unsigned ___ss_##__name[2]; \ - static inline unsigned int ___sf_##__name(void) { \ + extern __inline__ unsigned int ___sf_##__name(void) { \ unsigned int ret; \ __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ return ret; \ @@ -71,17 +71,17 @@ extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void); */ #define BTFIXUPDEF_HALF(__name) \ - static inline unsigned int ___af_##__name(void) __attribute_const__; \ + extern unsigned int ___af_##__name(void) __attribute_const__; \ extern unsigned ___as_##__name[2]; \ - static inline unsigned int ___af_##__name(void) { \ + extern __inline__ unsigned int ___af_##__name(void) { \ unsigned int ret; \ __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \ return ret; \ } #define BTFIXUPDEF_HALF_INIT(__name,__val) \ - static inline unsigned int ___af_##__name(void) __attribute_const__; \ + extern unsigned int ___af_##__name(void) __attribute_const__; \ extern unsigned ___as_##__name[2]; \ - static inline unsigned int ___af_##__name(void) { \ + extern __inline__ unsigned int ___af_##__name(void) { \ unsigned int ret; \ __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ return ret; \ @@ -90,17 +90,17 @@ extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void); /* Put upper 22 bits into some register variable */ #define BTFIXUPDEF_SETHI(__name) \ - static inline unsigned int ___hf_##__name(void) __attribute_const__; \ + extern unsigned int ___hf_##__name(void) __attribute_const__; \ extern unsigned ___hs_##__name[2]; \ - static inline unsigned int ___hf_##__name(void) { \ + extern __inline__ unsigned int ___hf_##__name(void) { \ unsigned int ret; \ __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \ return ret; \ } #define BTFIXUPDEF_SETHI_INIT(__name,__val) \ - static inline unsigned int ___hf_##__name(void) __attribute_const__; \ + extern unsigned int ___hf_##__name(void) __attribute_const__; \ extern unsigned ___hs_##__name[2]; \ - static inline unsigned int ___hf_##__name(void) { \ + extern __inline__ unsigned int ___hf_##__name(void) { \ unsigned int ret; \ __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \ "=r"(ret)); \ diff --git a/trunk/include/asm-sparc/cache.h b/trunk/include/asm-sparc/cache.h index a10522cb21b7..e6316fd7e1a4 100644 --- a/trunk/include/asm-sparc/cache.h +++ b/trunk/include/asm-sparc/cache.h @@ -27,7 +27,7 @@ */ /* First, cache-tag access. */ -static inline unsigned int get_icache_tag(int setnum, int tagnum) +extern __inline__ unsigned int get_icache_tag(int setnum, int tagnum) { unsigned int vaddr, retval; @@ -38,7 +38,7 @@ static inline unsigned int get_icache_tag(int setnum, int tagnum) return retval; } -static inline void put_icache_tag(int setnum, int tagnum, unsigned int entry) +extern __inline__ void put_icache_tag(int setnum, int tagnum, unsigned int entry) { unsigned int vaddr; @@ -51,7 +51,7 @@ static inline void put_icache_tag(int setnum, int tagnum, unsigned int entry) /* Second cache-data access. The data is returned two-32bit quantities * at a time. */ -static inline void get_icache_data(int setnum, int tagnum, int subblock, +extern __inline__ void get_icache_data(int setnum, int tagnum, int subblock, unsigned int *data) { unsigned int value1, value2, vaddr; @@ -67,7 +67,7 @@ static inline void get_icache_data(int setnum, int tagnum, int subblock, data[0] = value1; data[1] = value2; } -static inline void put_icache_data(int setnum, int tagnum, int subblock, +extern __inline__ void put_icache_data(int setnum, int tagnum, int subblock, unsigned int *data) { unsigned int value1, value2, vaddr; @@ -92,35 +92,35 @@ static inline void put_icache_data(int setnum, int tagnum, int subblock, */ /* Flushes which clear out both the on-chip and external caches */ -static inline void flush_ei_page(unsigned int addr) +extern __inline__ void flush_ei_page(unsigned int addr) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : "r" (addr), "i" (ASI_M_FLUSH_PAGE) : "memory"); } -static inline void flush_ei_seg(unsigned int addr) +extern __inline__ void flush_ei_seg(unsigned int addr) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : "r" (addr), "i" (ASI_M_FLUSH_SEG) : "memory"); } -static inline void flush_ei_region(unsigned int addr) +extern __inline__ void flush_ei_region(unsigned int addr) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : "r" (addr), "i" (ASI_M_FLUSH_REGION) : "memory"); } -static inline void flush_ei_ctx(unsigned int addr) +extern __inline__ void flush_ei_ctx(unsigned int addr) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : "r" (addr), "i" (ASI_M_FLUSH_CTX) : "memory"); } -static inline void flush_ei_user(unsigned int addr) +extern __inline__ void flush_ei_user(unsigned int addr) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : "r" (addr), "i" (ASI_M_FLUSH_USER) : diff --git a/trunk/include/asm-sparc/cypress.h b/trunk/include/asm-sparc/cypress.h index 99599533efbc..fc92fc839c3f 100644 --- a/trunk/include/asm-sparc/cypress.h +++ b/trunk/include/asm-sparc/cypress.h @@ -48,25 +48,25 @@ #define CYPRESS_NFAULT 0x00000002 #define CYPRESS_MENABLE 0x00000001 -static inline void cypress_flush_page(unsigned long page) +extern __inline__ void cypress_flush_page(unsigned long page) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : "r" (page), "i" (ASI_M_FLUSH_PAGE)); } -static inline void cypress_flush_segment(unsigned long addr) +extern __inline__ void cypress_flush_segment(unsigned long addr) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : "r" (addr), "i" (ASI_M_FLUSH_SEG)); } -static inline void cypress_flush_region(unsigned long addr) +extern __inline__ void cypress_flush_region(unsigned long addr) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : "r" (addr), "i" (ASI_M_FLUSH_REGION)); } -static inline void cypress_flush_context(void) +extern __inline__ void cypress_flush_context(void) { __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : : "i" (ASI_M_FLUSH_CTX)); diff --git a/trunk/include/asm-sparc/delay.h b/trunk/include/asm-sparc/delay.h index 7ec8e9f7ad4f..6edf2cbb246b 100644 --- a/trunk/include/asm-sparc/delay.h +++ b/trunk/include/asm-sparc/delay.h @@ -10,7 +10,7 @@ #include #include -static inline void __delay(unsigned long loops) +extern __inline__ void __delay(unsigned long loops) { __asm__ __volatile__("cmp %0, 0\n\t" "1: bne 1b\n\t" diff --git a/trunk/include/asm-sparc/dma.h b/trunk/include/asm-sparc/dma.h index 8ec206aa5f2e..07e6368a2521 100644 --- a/trunk/include/asm-sparc/dma.h +++ b/trunk/include/asm-sparc/dma.h @@ -198,7 +198,7 @@ extern void dvma_init(struct sbus_bus *); /* Pause until counter runs out or BIT isn't set in the DMA condition * register. */ -static inline void sparc_dma_pause(struct sparc_dma_registers *regs, +extern __inline__ void sparc_dma_pause(struct sparc_dma_registers *regs, unsigned long bit) { int ctr = 50000; /* Let's find some bugs ;) */ diff --git a/trunk/include/asm-sparc/iommu.h b/trunk/include/asm-sparc/iommu.h index 70c589c05a10..8171362d56b9 100644 --- a/trunk/include/asm-sparc/iommu.h +++ b/trunk/include/asm-sparc/iommu.h @@ -108,12 +108,12 @@ struct iommu_struct { struct bit_map usemap; }; -static inline void iommu_invalidate(struct iommu_regs *regs) +extern __inline__ void iommu_invalidate(struct iommu_regs *regs) { regs->tlbflush = 0; } -static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) +extern __inline__ void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) { regs->pageflush = (ba & PAGE_MASK); } diff --git a/trunk/include/asm-sparc/kdebug.h b/trunk/include/asm-sparc/kdebug.h index fba92485fdba..3ea4916635ee 100644 --- a/trunk/include/asm-sparc/kdebug.h +++ b/trunk/include/asm-sparc/kdebug.h @@ -46,7 +46,7 @@ struct kernel_debug { extern struct kernel_debug *linux_dbvec; /* Use this macro in C-code to enter the debugger. */ -static inline void sp_enter_debugger(void) +extern __inline__ void sp_enter_debugger(void) { __asm__ __volatile__("jmpl %0, %%o7\n\t" "nop\n\t" : : diff --git a/trunk/include/asm-sparc/mbus.h b/trunk/include/asm-sparc/mbus.h index ecacdf4075d7..5f2749015342 100644 --- a/trunk/include/asm-sparc/mbus.h +++ b/trunk/include/asm-sparc/mbus.h @@ -83,7 +83,7 @@ extern unsigned int hwbug_bitmask; */ #define TBR_ID_SHIFT 20 -static inline int get_cpuid(void) +extern __inline__ int get_cpuid(void) { register int retval; __asm__ __volatile__("rd %%tbr, %0\n\t" @@ -93,7 +93,7 @@ static inline int get_cpuid(void) return (retval & 3); } -static inline int get_modid(void) +extern __inline__ int get_modid(void) { return (get_cpuid() | 0x8); } diff --git a/trunk/include/asm-sparc/msi.h b/trunk/include/asm-sparc/msi.h index ff72cbd946a4..b69543dd3b46 100644 --- a/trunk/include/asm-sparc/msi.h +++ b/trunk/include/asm-sparc/msi.h @@ -19,7 +19,7 @@ #define MSI_ASYNC_MODE 0x80000000 /* Operate the MSI asynchronously */ -static inline void msi_set_sync(void) +extern __inline__ void msi_set_sync(void) { __asm__ __volatile__ ("lda [%0] %1, %%g3\n\t" "andn %%g3, %2, %%g3\n\t" diff --git a/trunk/include/asm-sparc/mxcc.h b/trunk/include/asm-sparc/mxcc.h index 128fe9708135..60ef9d6fe7bc 100644 --- a/trunk/include/asm-sparc/mxcc.h +++ b/trunk/include/asm-sparc/mxcc.h @@ -85,7 +85,7 @@ #ifndef __ASSEMBLY__ -static inline void mxcc_set_stream_src(unsigned long *paddr) +extern __inline__ void mxcc_set_stream_src(unsigned long *paddr) { unsigned long data0 = paddr[0]; unsigned long data1 = paddr[1]; @@ -98,7 +98,7 @@ static inline void mxcc_set_stream_src(unsigned long *paddr) "i" (ASI_M_MXCC) : "g2", "g3"); } -static inline void mxcc_set_stream_dst(unsigned long *paddr) +extern __inline__ void mxcc_set_stream_dst(unsigned long *paddr) { unsigned long data0 = paddr[0]; unsigned long data1 = paddr[1]; @@ -111,7 +111,7 @@ static inline void mxcc_set_stream_dst(unsigned long *paddr) "i" (ASI_M_MXCC) : "g2", "g3"); } -static inline unsigned long mxcc_get_creg(void) +extern __inline__ unsigned long mxcc_get_creg(void) { unsigned long mxcc_control; @@ -125,7 +125,7 @@ static inline unsigned long mxcc_get_creg(void) return mxcc_control; } -static inline void mxcc_set_creg(unsigned long mxcc_control) +extern __inline__ void mxcc_set_creg(unsigned long mxcc_control) { __asm__ __volatile__("sta %0, [%1] %2\n\t" : : "r" (mxcc_control), "r" (MXCC_CREG), diff --git a/trunk/include/asm-sparc/obio.h b/trunk/include/asm-sparc/obio.h index 47854a2a12cf..62e1d77965f3 100644 --- a/trunk/include/asm-sparc/obio.h +++ b/trunk/include/asm-sparc/obio.h @@ -98,7 +98,7 @@ #ifndef __ASSEMBLY__ -static inline int bw_get_intr_mask(int sbus_level) +extern __inline__ int bw_get_intr_mask(int sbus_level) { int mask; @@ -109,7 +109,7 @@ static inline int bw_get_intr_mask(int sbus_level) return mask; } -static inline void bw_clear_intr_mask(int sbus_level, int mask) +extern __inline__ void bw_clear_intr_mask(int sbus_level, int mask) { __asm__ __volatile__ ("stha %0, [%1] %2" : : "r" (mask), @@ -117,7 +117,7 @@ static inline void bw_clear_intr_mask(int sbus_level, int mask) "i" (ASI_M_CTL)); } -static inline unsigned bw_get_prof_limit(int cpu) +extern __inline__ unsigned bw_get_prof_limit(int cpu) { unsigned limit; @@ -128,7 +128,7 @@ static inline unsigned bw_get_prof_limit(int cpu) return limit; } -static inline void bw_set_prof_limit(int cpu, unsigned limit) +extern __inline__ void bw_set_prof_limit(int cpu, unsigned limit) { __asm__ __volatile__ ("sta %0, [%1] %2" : : "r" (limit), @@ -136,7 +136,7 @@ static inline void bw_set_prof_limit(int cpu, unsigned limit) "i" (ASI_M_CTL)); } -static inline unsigned bw_get_ctrl(int cpu) +extern __inline__ unsigned bw_get_ctrl(int cpu) { unsigned ctrl; @@ -147,7 +147,7 @@ static inline unsigned bw_get_ctrl(int cpu) return ctrl; } -static inline void bw_set_ctrl(int cpu, unsigned ctrl) +extern __inline__ void bw_set_ctrl(int cpu, unsigned ctrl) { __asm__ __volatile__ ("sta %0, [%1] %2" : : "r" (ctrl), @@ -157,7 +157,7 @@ static inline void bw_set_ctrl(int cpu, unsigned ctrl) extern unsigned char cpu_leds[32]; -static inline void show_leds(int cpuid) +extern __inline__ void show_leds(int cpuid) { cpuid &= 0x1e; __asm__ __volatile__ ("stba %0, [%1] %2" : : @@ -166,7 +166,7 @@ static inline void show_leds(int cpuid) "i" (ASI_M_CTL)); } -static inline unsigned cc_get_ipen(void) +extern __inline__ unsigned cc_get_ipen(void) { unsigned pending; @@ -177,7 +177,7 @@ static inline unsigned cc_get_ipen(void) return pending; } -static inline void cc_set_iclr(unsigned clear) +extern __inline__ void cc_set_iclr(unsigned clear) { __asm__ __volatile__ ("stha %0, [%1] %2" : : "r" (clear), @@ -185,7 +185,7 @@ static inline void cc_set_iclr(unsigned clear) "i" (ASI_M_MXCC)); } -static inline unsigned cc_get_imsk(void) +extern __inline__ unsigned cc_get_imsk(void) { unsigned mask; @@ -196,7 +196,7 @@ static inline unsigned cc_get_imsk(void) return mask; } -static inline void cc_set_imsk(unsigned mask) +extern __inline__ void cc_set_imsk(unsigned mask) { __asm__ __volatile__ ("stha %0, [%1] %2" : : "r" (mask), @@ -204,7 +204,7 @@ static inline void cc_set_imsk(unsigned mask) "i" (ASI_M_MXCC)); } -static inline unsigned cc_get_imsk_other(int cpuid) +extern __inline__ unsigned cc_get_imsk_other(int cpuid) { unsigned mask; @@ -215,7 +215,7 @@ static inline unsigned cc_get_imsk_other(int cpuid) return mask; } -static inline void cc_set_imsk_other(int cpuid, unsigned mask) +extern __inline__ void cc_set_imsk_other(int cpuid, unsigned mask) { __asm__ __volatile__ ("stha %0, [%1] %2" : : "r" (mask), @@ -223,7 +223,7 @@ static inline void cc_set_imsk_other(int cpuid, unsigned mask) "i" (ASI_M_CTL)); } -static inline void cc_set_igen(unsigned gen) +extern __inline__ void cc_set_igen(unsigned gen) { __asm__ __volatile__ ("sta %0, [%1] %2" : : "r" (gen), @@ -239,7 +239,7 @@ static inline void cc_set_igen(unsigned gen) #define IGEN_MESSAGE(bcast, devid, sid, levels) \ (((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels)) -static inline void sun4d_send_ipi(int cpu, int level) +extern __inline__ void sun4d_send_ipi(int cpu, int level) { cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1))); } diff --git a/trunk/include/asm-sparc/pci.h b/trunk/include/asm-sparc/pci.h index 38644742f011..97052baf90c1 100644 --- a/trunk/include/asm-sparc/pci.h +++ b/trunk/include/asm-sparc/pci.h @@ -15,12 +15,12 @@ #define PCI_IRQ_NONE 0xffffffff -static inline void pcibios_set_master(struct pci_dev *dev) +extern inline void pcibios_set_master(struct pci_dev *dev) { /* No special bus mastering setup handling */ } -static inline void pcibios_penalize_isa_irq(int irq, int active) +extern inline void pcibios_penalize_isa_irq(int irq, int active) { /* We don't do dynamic PCI IRQ allocation */ } @@ -137,7 +137,7 @@ extern void pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist * only drive the low 24-bits during PCI bus mastering, then * you would pass 0x00ffffff as the mask to this function. */ -static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) +extern inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) { return 1; } diff --git a/trunk/include/asm-sparc/pgtable.h b/trunk/include/asm-sparc/pgtable.h index a14e98677500..8f4f6a959651 100644 --- a/trunk/include/asm-sparc/pgtable.h +++ b/trunk/include/asm-sparc/pgtable.h @@ -82,8 +82,6 @@ extern unsigned long page_kernel; /* Top-level page directory */ extern pgd_t swapper_pg_dir[1024]; -extern void paging_init(void); - /* Page table for 0-4MB for everybody, on the Sparc this * holds the same as on the i386. */ @@ -154,7 +152,7 @@ BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) BTFIXUPDEF_CALL(void, pte_clear, pte_t *) BTFIXUPDEF_CALL(int, pte_read, pte_t) -static inline int pte_none(pte_t pte) +extern __inline__ int pte_none(pte_t pte) { return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask)); } @@ -167,7 +165,7 @@ BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *) -static inline int pmd_none(pmd_t pmd) +extern __inline__ int pmd_none(pmd_t pmd) { return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask)); } @@ -194,20 +192,20 @@ BTFIXUPDEF_HALF(pte_writei) BTFIXUPDEF_HALF(pte_dirtyi) BTFIXUPDEF_HALF(pte_youngi) -static int pte_write(pte_t pte) __attribute_const__; -static inline int pte_write(pte_t pte) +extern int pte_write(pte_t pte) __attribute_const__; +extern __inline__ int pte_write(pte_t pte) { return pte_val(pte) & BTFIXUP_HALF(pte_writei); } -static int pte_dirty(pte_t pte) __attribute_const__; -static inline int pte_dirty(pte_t pte) +extern int pte_dirty(pte_t pte) __attribute_const__; +extern __inline__ int pte_dirty(pte_t pte) { return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi); } -static int pte_young(pte_t pte) __attribute_const__; -static inline int pte_young(pte_t pte) +extern int pte_young(pte_t pte) __attribute_const__; +extern __inline__ int pte_young(pte_t pte) { return pte_val(pte) & BTFIXUP_HALF(pte_youngi); } @@ -217,8 +215,8 @@ static inline int pte_young(pte_t pte) */ BTFIXUPDEF_HALF(pte_filei) -static int pte_file(pte_t pte) __attribute_const__; -static inline int pte_file(pte_t pte) +extern int pte_file(pte_t pte) __attribute_const__; +extern __inline__ int pte_file(pte_t pte) { return pte_val(pte) & BTFIXUP_HALF(pte_filei); } @@ -229,20 +227,20 @@ BTFIXUPDEF_HALF(pte_wrprotecti) BTFIXUPDEF_HALF(pte_mkcleani) BTFIXUPDEF_HALF(pte_mkoldi) -static pte_t pte_wrprotect(pte_t pte) __attribute_const__; -static inline pte_t pte_wrprotect(pte_t pte) +extern pte_t pte_wrprotect(pte_t pte) __attribute_const__; +extern __inline__ pte_t pte_wrprotect(pte_t pte) { return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti)); } -static pte_t pte_mkclean(pte_t pte) __attribute_const__; -static inline pte_t pte_mkclean(pte_t pte) +extern pte_t pte_mkclean(pte_t pte) __attribute_const__; +extern __inline__ pte_t pte_mkclean(pte_t pte) { return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani)); } -static pte_t pte_mkold(pte_t pte) __attribute_const__; -static inline pte_t pte_mkold(pte_t pte) +extern pte_t pte_mkold(pte_t pte) __attribute_const__; +extern __inline__ pte_t pte_mkold(pte_t pte) { return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi)); } @@ -278,8 +276,8 @@ BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int) BTFIXUPDEF_INT(pte_modify_mask) -static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__; -static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) +extern pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__; +extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) { return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) | pgprot_val(newprot)); @@ -386,13 +384,13 @@ extern struct ctx_list ctx_used; /* Head of used contexts list */ #define NO_CONTEXT -1 -static inline void remove_from_ctx_list(struct ctx_list *entry) +extern __inline__ void remove_from_ctx_list(struct ctx_list *entry) { entry->next->prev = entry->prev; entry->prev->next = entry->next; } -static inline void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry) +extern __inline__ void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry) { entry->next = head; (entry->prev = head->prev)->next = entry; @@ -401,7 +399,7 @@ static inline void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry #define add_to_free_ctxlist(entry) add_to_ctx_list(&ctx_free, entry) #define add_to_used_ctxlist(entry) add_to_ctx_list(&ctx_used, entry) -static inline unsigned long +extern __inline__ unsigned long __get_phys (unsigned long addr) { switch (sparc_cpu_model){ @@ -416,7 +414,7 @@ __get_phys (unsigned long addr) } } -static inline int +extern __inline__ int __get_iospace (unsigned long addr) { switch (sparc_cpu_model){ diff --git a/trunk/include/asm-sparc/pgtsrmmu.h b/trunk/include/asm-sparc/pgtsrmmu.h index edeb9811e728..ee3b9d93187c 100644 --- a/trunk/include/asm-sparc/pgtsrmmu.h +++ b/trunk/include/asm-sparc/pgtsrmmu.h @@ -148,7 +148,7 @@ extern void *srmmu_nocache_pool; #define __nocache_fix(VADDR) __va(__nocache_pa(VADDR)) /* Accessing the MMU control register. */ -static inline unsigned int srmmu_get_mmureg(void) +extern __inline__ unsigned int srmmu_get_mmureg(void) { unsigned int retval; __asm__ __volatile__("lda [%%g0] %1, %0\n\t" : @@ -157,14 +157,14 @@ static inline unsigned int srmmu_get_mmureg(void) return retval; } -static inline void srmmu_set_mmureg(unsigned long regval) +extern __inline__ void srmmu_set_mmureg(unsigned long regval) { __asm__ __volatile__("sta %0, [%%g0] %1\n\t" : : "r" (regval), "i" (ASI_M_MMUREGS) : "memory"); } -static inline void srmmu_set_ctable_ptr(unsigned long paddr) +extern __inline__ void srmmu_set_ctable_ptr(unsigned long paddr) { paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); __asm__ __volatile__("sta %0, [%1] %2\n\t" : : @@ -173,7 +173,7 @@ static inline void srmmu_set_ctable_ptr(unsigned long paddr) "memory"); } -static inline unsigned long srmmu_get_ctable_ptr(void) +extern __inline__ unsigned long srmmu_get_ctable_ptr(void) { unsigned int retval; @@ -184,14 +184,14 @@ static inline unsigned long srmmu_get_ctable_ptr(void) return (retval & SRMMU_CTX_PMASK) << 4; } -static inline void srmmu_set_context(int context) +extern __inline__ void srmmu_set_context(int context) { __asm__ __volatile__("sta %0, [%1] %2\n\t" : : "r" (context), "r" (SRMMU_CTX_REG), "i" (ASI_M_MMUREGS) : "memory"); } -static inline int srmmu_get_context(void) +extern __inline__ int srmmu_get_context(void) { register int retval; __asm__ __volatile__("lda [%1] %2, %0\n\t" : @@ -201,7 +201,7 @@ static inline int srmmu_get_context(void) return retval; } -static inline unsigned int srmmu_get_fstatus(void) +extern __inline__ unsigned int srmmu_get_fstatus(void) { unsigned int retval; @@ -211,7 +211,7 @@ static inline unsigned int srmmu_get_fstatus(void) return retval; } -static inline unsigned int srmmu_get_faddr(void) +extern __inline__ unsigned int srmmu_get_faddr(void) { unsigned int retval; @@ -222,7 +222,7 @@ static inline unsigned int srmmu_get_faddr(void) } /* This is guaranteed on all SRMMU's. */ -static inline void srmmu_flush_whole_tlb(void) +extern __inline__ void srmmu_flush_whole_tlb(void) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : "r" (0x400), /* Flush entire TLB!! */ @@ -231,7 +231,7 @@ static inline void srmmu_flush_whole_tlb(void) } /* These flush types are not available on all chips... */ -static inline void srmmu_flush_tlb_ctx(void) +extern __inline__ void srmmu_flush_tlb_ctx(void) { __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : "r" (0x300), /* Flush TLB ctx.. */ @@ -239,7 +239,7 @@ static inline void srmmu_flush_tlb_ctx(void) } -static inline void srmmu_flush_tlb_region(unsigned long addr) +extern __inline__ void srmmu_flush_tlb_region(unsigned long addr) { addr &= SRMMU_PGDIR_MASK; __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : @@ -249,7 +249,7 @@ static inline void srmmu_flush_tlb_region(unsigned long addr) } -static inline void srmmu_flush_tlb_segment(unsigned long addr) +extern __inline__ void srmmu_flush_tlb_segment(unsigned long addr) { addr &= SRMMU_REAL_PMD_MASK; __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : @@ -258,7 +258,7 @@ static inline void srmmu_flush_tlb_segment(unsigned long addr) } -static inline void srmmu_flush_tlb_page(unsigned long page) +extern __inline__ void srmmu_flush_tlb_page(unsigned long page) { page &= PAGE_MASK; __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : @@ -267,7 +267,7 @@ static inline void srmmu_flush_tlb_page(unsigned long page) } -static inline unsigned long srmmu_hwprobe(unsigned long vaddr) +extern __inline__ unsigned long srmmu_hwprobe(unsigned long vaddr) { unsigned long retval; @@ -279,7 +279,7 @@ static inline unsigned long srmmu_hwprobe(unsigned long vaddr) return retval; } -static inline int +extern __inline__ int srmmu_get_pte (unsigned long addr) { register unsigned long entry; diff --git a/trunk/include/asm-sparc/processor.h b/trunk/include/asm-sparc/processor.h index 6fbb3f0af8d8..5a7a1a8d29ac 100644 --- a/trunk/include/asm-sparc/processor.h +++ b/trunk/include/asm-sparc/processor.h @@ -79,7 +79,7 @@ struct thread_struct { extern unsigned long thread_saved_pc(struct task_struct *t); /* Do necessary setup to start up a newly executed thread. */ -static inline void start_thread(struct pt_regs * regs, unsigned long pc, +extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp) { register unsigned long zero asm("g1"); diff --git a/trunk/include/asm-sparc/psr.h b/trunk/include/asm-sparc/psr.h index 19c978051118..9778b8c8b15b 100644 --- a/trunk/include/asm-sparc/psr.h +++ b/trunk/include/asm-sparc/psr.h @@ -38,7 +38,7 @@ #ifndef __ASSEMBLY__ /* Get the %psr register. */ -static inline unsigned int get_psr(void) +extern __inline__ unsigned int get_psr(void) { unsigned int psr; __asm__ __volatile__( @@ -53,7 +53,7 @@ static inline unsigned int get_psr(void) return psr; } -static inline void put_psr(unsigned int new_psr) +extern __inline__ void put_psr(unsigned int new_psr) { __asm__ __volatile__( "wr %0, 0x0, %%psr\n\t" @@ -72,7 +72,7 @@ static inline void put_psr(unsigned int new_psr) extern unsigned int fsr_storage; -static inline unsigned int get_fsr(void) +extern __inline__ unsigned int get_fsr(void) { unsigned int fsr = 0; diff --git a/trunk/include/asm-sparc/sbi.h b/trunk/include/asm-sparc/sbi.h index 86a603ac7b20..739ccac5dcf2 100644 --- a/trunk/include/asm-sparc/sbi.h +++ b/trunk/include/asm-sparc/sbi.h @@ -65,7 +65,7 @@ struct sbi_regs { #ifndef __ASSEMBLY__ -static inline int acquire_sbi(int devid, int mask) +extern __inline__ int acquire_sbi(int devid, int mask) { __asm__ __volatile__ ("swapa [%2] %3, %0" : "=r" (mask) : @@ -75,7 +75,7 @@ static inline int acquire_sbi(int devid, int mask) return mask; } -static inline void release_sbi(int devid, int mask) +extern __inline__ void release_sbi(int devid, int mask) { __asm__ __volatile__ ("sta %0, [%1] %2" : : "r" (mask), @@ -83,7 +83,7 @@ static inline void release_sbi(int devid, int mask) "i" (ASI_M_CTL)); } -static inline void set_sbi_tid(int devid, int targetid) +extern __inline__ void set_sbi_tid(int devid, int targetid) { __asm__ __volatile__ ("sta %0, [%1] %2" : : "r" (targetid), @@ -91,7 +91,7 @@ static inline void set_sbi_tid(int devid, int targetid) "i" (ASI_M_CTL)); } -static inline int get_sbi_ctl(int devid, int cfgno) +extern __inline__ int get_sbi_ctl(int devid, int cfgno) { int cfg; @@ -102,7 +102,7 @@ static inline int get_sbi_ctl(int devid, int cfgno) return cfg; } -static inline void set_sbi_ctl(int devid, int cfgno, int cfg) +extern __inline__ void set_sbi_ctl(int devid, int cfgno, int cfg) { __asm__ __volatile__ ("sta %0, [%1] %2" : : "r" (cfg), diff --git a/trunk/include/asm-sparc/sbus.h b/trunk/include/asm-sparc/sbus.h index a13cddcecec5..3a8b3908728a 100644 --- a/trunk/include/asm-sparc/sbus.h +++ b/trunk/include/asm-sparc/sbus.h @@ -28,12 +28,12 @@ * numbers + offsets, and vice versa. */ -static inline unsigned long sbus_devaddr(int slotnum, unsigned long offset) +extern __inline__ unsigned long sbus_devaddr(int slotnum, unsigned long offset) { return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<25)+(offset)); } -static inline int sbus_dev_slot(unsigned long dev_addr) +extern __inline__ int sbus_dev_slot(unsigned long dev_addr) { return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>25); } @@ -80,7 +80,7 @@ struct sbus_bus { extern struct sbus_bus *sbus_root; -static inline int +extern __inline__ int sbus_is_slave(struct sbus_dev *dev) { /* XXX Have to write this for sun4c's */ diff --git a/trunk/include/asm-sparc/smp.h b/trunk/include/asm-sparc/smp.h index 580c51d011df..4f96d8333a12 100644 --- a/trunk/include/asm-sparc/smp.h +++ b/trunk/include/asm-sparc/smp.h @@ -60,22 +60,22 @@ BTFIXUPDEF_BLACKBOX(load_current) #define smp_cross_call(func,arg1,arg2,arg3,arg4,arg5) BTFIXUP_CALL(smp_cross_call)(func,arg1,arg2,arg3,arg4,arg5) #define smp_message_pass(target,msg,data,wait) BTFIXUP_CALL(smp_message_pass)(target,msg,data,wait) -static inline void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); } -static inline void xc1(smpfunc_t func, unsigned long arg1) +extern __inline__ void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); } +extern __inline__ void xc1(smpfunc_t func, unsigned long arg1) { smp_cross_call(func, arg1, 0, 0, 0, 0); } -static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2) +extern __inline__ void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2) { smp_cross_call(func, arg1, arg2, 0, 0, 0); } -static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2, +extern __inline__ void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2, unsigned long arg3) { smp_cross_call(func, arg1, arg2, arg3, 0, 0); } -static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, +extern __inline__ void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { smp_cross_call(func, arg1, arg2, arg3, arg4, 0); } -static inline void xc5(smpfunc_t func, unsigned long arg1, unsigned long arg2, +extern __inline__ void xc5(smpfunc_t func, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5) { smp_cross_call(func, arg1, arg2, arg3, arg4, arg5); } -static inline int smp_call_function(void (*func)(void *info), void *info, int nonatomic, int wait) +extern __inline__ int smp_call_function(void (*func)(void *info), void *info, int nonatomic, int wait) { xc1((smpfunc_t)func, (unsigned long)info); return 0; @@ -84,16 +84,16 @@ static inline int smp_call_function(void (*func)(void *info), void *info, int no extern __volatile__ int __cpu_number_map[NR_CPUS]; extern __volatile__ int __cpu_logical_map[NR_CPUS]; -static inline int cpu_logical_map(int cpu) +extern __inline__ int cpu_logical_map(int cpu) { return __cpu_logical_map[cpu]; } -static inline int cpu_number_map(int cpu) +extern __inline__ int cpu_number_map(int cpu) { return __cpu_number_map[cpu]; } -static inline int hard_smp4m_processor_id(void) +extern __inline__ int hard_smp4m_processor_id(void) { int cpuid; @@ -104,7 +104,7 @@ static inline int hard_smp4m_processor_id(void) return cpuid; } -static inline int hard_smp4d_processor_id(void) +extern __inline__ int hard_smp4d_processor_id(void) { int cpuid; @@ -114,7 +114,7 @@ static inline int hard_smp4d_processor_id(void) } #ifndef MODULE -static inline int hard_smp_processor_id(void) +extern __inline__ int hard_smp_processor_id(void) { int cpuid; @@ -136,7 +136,7 @@ static inline int hard_smp_processor_id(void) return cpuid; } #else -static inline int hard_smp_processor_id(void) +extern __inline__ int hard_smp_processor_id(void) { int cpuid; diff --git a/trunk/include/asm-sparc/smpprim.h b/trunk/include/asm-sparc/smpprim.h index e7b6d346ae10..9b9c28ed748e 100644 --- a/trunk/include/asm-sparc/smpprim.h +++ b/trunk/include/asm-sparc/smpprim.h @@ -15,7 +15,7 @@ * atomic. */ -static inline __volatile__ char test_and_set(void *addr) +extern __inline__ __volatile__ char test_and_set(void *addr) { char state = 0; @@ -27,7 +27,7 @@ static inline __volatile__ char test_and_set(void *addr) } /* Initialize a spin-lock. */ -static inline __volatile__ smp_initlock(void *spinlock) +extern __inline__ __volatile__ smp_initlock(void *spinlock) { /* Unset the lock. */ *((unsigned char *) spinlock) = 0; @@ -36,7 +36,7 @@ static inline __volatile__ smp_initlock(void *spinlock) } /* This routine spins until it acquires the lock at ADDR. */ -static inline __volatile__ smp_lock(void *addr) +extern __inline__ __volatile__ smp_lock(void *addr) { while(test_and_set(addr) == 0xff) ; @@ -46,7 +46,7 @@ static inline __volatile__ smp_lock(void *addr) } /* This routine releases the lock at ADDR. */ -static inline __volatile__ smp_unlock(void *addr) +extern __inline__ __volatile__ smp_unlock(void *addr) { *((unsigned char *) addr) = 0; } diff --git a/trunk/include/asm-sparc/spinlock.h b/trunk/include/asm-sparc/spinlock.h index e344c98a6f5f..111727a2bb4e 100644 --- a/trunk/include/asm-sparc/spinlock.h +++ b/trunk/include/asm-sparc/spinlock.h @@ -17,7 +17,7 @@ #define __raw_spin_unlock_wait(lock) \ do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) -static inline void __raw_spin_lock(raw_spinlock_t *lock) +extern __inline__ void __raw_spin_lock(raw_spinlock_t *lock) { __asm__ __volatile__( "\n1:\n\t" @@ -37,7 +37,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock) : "g2", "memory", "cc"); } -static inline int __raw_spin_trylock(raw_spinlock_t *lock) +extern __inline__ int __raw_spin_trylock(raw_spinlock_t *lock) { unsigned int result; __asm__ __volatile__("ldstub [%1], %0" @@ -47,7 +47,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) return (result == 0); } -static inline void __raw_spin_unlock(raw_spinlock_t *lock) +extern __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) { __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); } @@ -78,7 +78,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) * * Unfortunately this scheme limits us to ~16,000,000 cpus. */ -static inline void __read_lock(raw_rwlock_t *rw) +extern __inline__ void __read_lock(raw_rwlock_t *rw) { register raw_rwlock_t *lp asm("g1"); lp = rw; @@ -98,7 +98,7 @@ do { unsigned long flags; \ local_irq_restore(flags); \ } while(0) -static inline void __read_unlock(raw_rwlock_t *rw) +extern __inline__ void __read_unlock(raw_rwlock_t *rw) { register raw_rwlock_t *lp asm("g1"); lp = rw; diff --git a/trunk/include/asm-sparc/system.h b/trunk/include/asm-sparc/system.h index 1f6b71f9e1b6..3557781a4bfd 100644 --- a/trunk/include/asm-sparc/system.h +++ b/trunk/include/asm-sparc/system.h @@ -204,7 +204,7 @@ static inline unsigned long getipl(void) BTFIXUPDEF_CALL(void, ___xchg32, void) #endif -static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) +extern __inline__ unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) { #ifdef CONFIG_SMP __asm__ __volatile__("swap [%2], %0" diff --git a/trunk/include/asm-sparc/traps.h b/trunk/include/asm-sparc/traps.h index f62c7f878ee1..6690ab956ea6 100644 --- a/trunk/include/asm-sparc/traps.h +++ b/trunk/include/asm-sparc/traps.h @@ -22,7 +22,7 @@ struct tt_entry { /* We set this to _start in system setup. */ extern struct tt_entry *sparc_ttable; -static inline unsigned long get_tbr(void) +extern __inline__ unsigned long get_tbr(void) { unsigned long tbr; diff --git a/trunk/include/asm-sparc64/cacheflush.h b/trunk/include/asm-sparc64/cacheflush.h index b3f61659ba81..ededd2659eab 100644 --- a/trunk/include/asm-sparc64/cacheflush.h +++ b/trunk/include/asm-sparc64/cacheflush.h @@ -66,11 +66,6 @@ extern void flush_ptrace_access(struct vm_area_struct *, struct page *, #define flush_cache_vmap(start, end) do { } while (0) #define flush_cache_vunmap(start, end) do { } while (0) -#ifdef CONFIG_DEBUG_PAGEALLOC -/* internal debugging function */ -void kernel_map_pages(struct page *page, int numpages, int enable); -#endif - #endif /* !__ASSEMBLY__ */ #endif /* _SPARC64_CACHEFLUSH_H */ diff --git a/trunk/include/asm-sparc64/cpudata.h b/trunk/include/asm-sparc64/cpudata.h index 74de79dca915..9a3a81f1cc58 100644 --- a/trunk/include/asm-sparc64/cpudata.h +++ b/trunk/include/asm-sparc64/cpudata.h @@ -22,16 +22,6 @@ typedef struct { unsigned int __pad1; unsigned long *pte_cache[2]; unsigned long *pgd_cache; - - /* Dcache line 3, rarely used */ - unsigned int dcache_size; - unsigned int dcache_line_size; - unsigned int icache_size; - unsigned int icache_line_size; - unsigned int ecache_size; - unsigned int ecache_line_size; - unsigned int __pad2; - unsigned int __pad3; } cpuinfo_sparc; DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); diff --git a/trunk/include/asm-sparc64/head.h b/trunk/include/asm-sparc64/head.h index 0abd3a674e8f..b63a33cf4971 100644 --- a/trunk/include/asm-sparc64/head.h +++ b/trunk/include/asm-sparc64/head.h @@ -12,12 +12,9 @@ #define __JALAPENO_ID 0x003e0016 #define CHEETAH_MANUF 0x003e -#define CHEETAH_IMPL 0x0014 /* Ultra-III */ -#define CHEETAH_PLUS_IMPL 0x0015 /* Ultra-III+ */ -#define JALAPENO_IMPL 0x0016 /* Ultra-IIIi */ -#define JAGUAR_IMPL 0x0018 /* Ultra-IV */ -#define PANTHER_IMPL 0x0019 /* Ultra-IV+ */ -#define SERRANO_IMPL 0x0022 /* Ultra-IIIi+ */ +#define CHEETAH_IMPL 0x0014 +#define CHEETAH_PLUS_IMPL 0x0015 +#define JALAPENO_IMPL 0x0016 #define BRANCH_IF_CHEETAH_BASE(tmp1,tmp2,label) \ rdpr %ver, %tmp1; \ diff --git a/trunk/include/asm-sparc64/openprom.h b/trunk/include/asm-sparc64/openprom.h index b4959d2b0d99..0a336901d585 100644 --- a/trunk/include/asm-sparc64/openprom.h +++ b/trunk/include/asm-sparc64/openprom.h @@ -186,8 +186,8 @@ struct linux_prom_registers { }; struct linux_prom64_registers { - unsigned long phys_addr; - unsigned long reg_size; + long phys_addr; + long reg_size; }; struct linux_prom_irqs { diff --git a/trunk/include/asm-sparc64/oplib.h b/trunk/include/asm-sparc64/oplib.h index d02f1e8ae1a6..a432d9e7daaa 100644 --- a/trunk/include/asm-sparc64/oplib.h +++ b/trunk/include/asm-sparc64/oplib.h @@ -38,20 +38,6 @@ extern int prom_stdin, prom_stdout; */ extern int prom_chosen_node; -/* Helper values and strings in arch/sparc64/kernel/head.S */ -extern const char prom_finddev_name[]; -extern const char prom_chosen_path[]; -extern const char prom_getprop_name[]; -extern const char prom_mmu_name[]; -extern const char prom_callmethod_name[]; -extern const char prom_translate_name[]; -extern const char prom_map_name[]; -extern const char prom_unmap_name[]; -extern int prom_mmu_ihandle_cache; -extern unsigned int prom_boot_mapped_pc; -extern unsigned int prom_boot_mapping_mode; -extern unsigned long prom_boot_mapping_phys_high, prom_boot_mapping_phys_low; - struct linux_mlist_p1275 { struct linux_mlist_p1275 *theres_more; unsigned long start_adr; @@ -82,7 +68,7 @@ extern char *prom_getbootargs(void); * of the string is different on V0 vs. V2->higher proms. The caller must * know what he/she is doing! Returns the device descriptor, an int. */ -extern int prom_devopen(const char *device_string); +extern int prom_devopen(char *device_string); /* Close a previously opened device described by the passed integer * descriptor. @@ -95,13 +81,27 @@ extern int prom_devclose(int device_handle); extern void prom_seek(int device_handle, unsigned int seek_hival, unsigned int seek_lowval); +/* Machine memory configuration routine. */ + +/* This function returns a V0 format memory descriptor table, it has three + * entries. One for the total amount of physical ram on the machine, one + * for the amount of physical ram available, and one describing the virtual + * areas which are allocated by the prom. So, in a sense the physical + * available is a calculation of the total physical minus the physical mapped + * by the prom with virtual mappings. + * + * These lists are returned pre-sorted, this should make your life easier + * since the prom itself is way too lazy to do such nice things. + */ +extern struct linux_mem_p1275 *prom_meminfo(void); + /* Miscellaneous routines, don't really fit in any category per se. */ /* Reboot the machine with the command line passed. */ -extern void prom_reboot(const char *boot_command); +extern void prom_reboot(char *boot_command); /* Evaluate the forth string passed. */ -extern void prom_feval(const char *forth_string); +extern void prom_feval(char *forth_string); /* Enter the prom, with possibility of continuation with the 'go' * command in newer proms. @@ -154,7 +154,7 @@ extern char prom_getchar(void); extern void prom_putchar(char character); /* Prom's internal routines, don't use in kernel/boot code. */ -extern void prom_printf(const char *fmt, ...); +extern void prom_printf(char *fmt, ...); extern void prom_write(const char *buf, unsigned int len); /* Query for input device type */ @@ -215,7 +215,7 @@ extern int prom_getunumber(int syndrome_code, char *buf, int buflen); /* Retain physical memory to the caller across soft resets. */ -extern unsigned long prom_retain(const char *name, +extern unsigned long prom_retain(char *name, unsigned long pa_low, unsigned long pa_high, long size, long align); @@ -269,28 +269,28 @@ extern int prom_getsibling(int node); /* Get the length, at the passed node, of the given property type. * Returns -1 on error (ie. no such property at this node). */ -extern int prom_getproplen(int thisnode, const char *property); +extern int prom_getproplen(int thisnode, char *property); /* Fetch the requested property using the given buffer. Returns * the number of bytes the prom put into your buffer or -1 on error. */ -extern int prom_getproperty(int thisnode, const char *property, +extern int prom_getproperty(int thisnode, char *property, char *prop_buffer, int propbuf_size); /* Acquire an integer property. */ -extern int prom_getint(int node, const char *property); +extern int prom_getint(int node, char *property); /* Acquire an integer property, with a default value. */ -extern int prom_getintdefault(int node, const char *property, int defval); +extern int prom_getintdefault(int node, char *property, int defval); /* Acquire a boolean property, 0=FALSE 1=TRUE. */ -extern int prom_getbool(int node, const char *prop); +extern int prom_getbool(int node, char *prop); /* Acquire a string property, null string on error. */ -extern void prom_getstring(int node, const char *prop, char *buf, int bufsize); +extern void prom_getstring(int node, char *prop, char *buf, int bufsize); /* Does the passed node have the given "name"? YES=1 NO=0 */ -extern int prom_nodematch(int thisnode, const char *name); +extern int prom_nodematch(int thisnode, char *name); /* Puts in buffer a prom name in the form name@x,y or name (x for which_io * and y for first regs phys address @@ -300,7 +300,7 @@ extern int prom_getname(int node, char *buf, int buflen); /* Search all siblings starting at the passed node for "name" matching * the given string. Returns the node on success, zero on failure. */ -extern int prom_searchsiblings(int node_start, const char *name); +extern int prom_searchsiblings(int node_start, char *name); /* Return the first property type, as a string, for the given node. * Returns a null string on error. Buffer should be at least 32B long. @@ -310,21 +310,21 @@ extern char *prom_firstprop(int node, char *buffer); /* Returns the next property after the passed property for the given * node. Returns null string on failure. Buffer should be at least 32B long. */ -extern char *prom_nextprop(int node, const char *prev_property, char *buffer); +extern char *prom_nextprop(int node, char *prev_property, char *buffer); /* Returns 1 if the specified node has given property. */ -extern int prom_node_has_property(int node, const char *property); +extern int prom_node_has_property(int node, char *property); /* Returns phandle of the path specified */ -extern int prom_finddevice(const char *name); +extern int prom_finddevice(char *name); /* Set the indicated property at the given node with the passed value. * Returns the number of bytes of your value that the prom took. */ -extern int prom_setprop(int node, const char *prop_name, char *prop_value, +extern int prom_setprop(int node, char *prop_name, char *prop_value, int value_size); -extern int prom_pathtoinode(const char *path); +extern int prom_pathtoinode(char *path); extern int prom_inst2pkg(int); /* CPU probing helpers. */ @@ -334,7 +334,7 @@ int cpu_find_by_mid(int mid, int *prom_node); /* Client interface level routines. */ extern void prom_set_trap_table(unsigned long tba); -extern long p1275_cmd(const char *, long, ...); +extern long p1275_cmd (char *, long, ...); #if 0 diff --git a/trunk/include/asm-sparc64/page.h b/trunk/include/asm-sparc64/page.h index 5426bb28a993..7f8d764abc47 100644 --- a/trunk/include/asm-sparc64/page.h +++ b/trunk/include/asm-sparc64/page.h @@ -140,6 +140,23 @@ extern unsigned long page_to_pfn(struct page *); #define virt_to_phys __pa #define phys_to_virt __va +/* The following structure is used to hold the physical + * memory configuration of the machine. This is filled in + * probe_memory() and is later used by mem_init() to set up + * mem_map[]. We statically allocate SPARC_PHYS_BANKS of + * these structs, this is arbitrary. The entry after the + * last valid one has num_bytes==0. + */ + +struct sparc_phys_banks { + unsigned long base_addr; + unsigned long num_bytes; +}; + +#define SPARC_PHYS_BANKS 32 + +extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; + #endif /* !(__ASSEMBLY__) */ #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ diff --git a/trunk/include/asm-sparc64/pbm.h b/trunk/include/asm-sparc64/pbm.h index dd35a2c7798a..38bbbccb4068 100644 --- a/trunk/include/asm-sparc64/pbm.h +++ b/trunk/include/asm-sparc64/pbm.h @@ -27,27 +27,23 @@ * PCI bus. */ +#define PBM_LOGCLUSTERS 3 +#define PBM_NCLUSTERS (1 << PBM_LOGCLUSTERS) + struct pci_controller_info; /* This contains the software state necessary to drive a PCI * controller's IOMMU. */ -struct pci_iommu_arena { - unsigned long *map; - unsigned int hint; - unsigned int limit; -}; - struct pci_iommu { /* This protects the controller's IOMMU and all * streaming buffers underneath. */ spinlock_t lock; - struct pci_iommu_arena arena; - /* IOMMU page table, a linear array of ioptes. */ iopte_t *page_table; /* The page table itself. */ + int page_table_sz_bits; /* log2 of ow many pages does it map? */ /* Base PCI memory space address where IOMMU mappings * begin. @@ -66,6 +62,12 @@ struct pci_iommu { */ unsigned long write_complete_reg; + /* The lowest used consistent mapping entry. Since + * we allocate consistent maps out of cluster 0 this + * is relative to the beginning of closter 0. + */ + u32 lowest_consistent_map; + /* In order to deal with some buggy third-party PCI bridges that * do wrong prefetching, we never mark valid mappings as invalid. * Instead we point them at this dummy page. @@ -73,6 +75,16 @@ struct pci_iommu { unsigned long dummy_page; unsigned long dummy_page_pa; + /* If PBM_NCLUSTERS is ever decreased to 4 or lower, + * or if largest supported page_table_sz * 8K goes above + * 2GB, you must increase the size of the type of + * these counters. You have been duly warned. -DaveM + */ + struct { + u16 next; + u16 flush; + } alloc_info[PBM_NCLUSTERS]; + /* CTX allocation. */ unsigned long ctx_lowest_free; unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)]; @@ -90,7 +102,7 @@ struct pci_iommu { u32 dma_addr_mask; }; -extern void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask); +extern void pci_iommu_table_init(struct pci_iommu *, int); /* This describes a PCI bus module's streaming buffer. */ struct pci_strbuf { diff --git a/trunk/include/asm-sparc64/pgtable.h b/trunk/include/asm-sparc64/pgtable.h index 8c6dfc6c7af6..a297f6144f0f 100644 --- a/trunk/include/asm-sparc64/pgtable.h +++ b/trunk/include/asm-sparc64/pgtable.h @@ -60,13 +60,13 @@ * table can map */ #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3)) -#define PMD_SIZE (_AC(1,UL) << PMD_SHIFT) +#define PMD_SIZE (1UL << PMD_SHIFT) #define PMD_MASK (~(PMD_SIZE-1)) #define PMD_BITS (PAGE_SHIFT - 2) /* PGDIR_SHIFT determines what a third-level page table entry can map */ #define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS) -#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT) +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) #define PGDIR_BITS (PAGE_SHIFT - 2) @@ -98,9 +98,7 @@ #define _PAGE_NFO _AC(0x1000000000000000,UL) /* No Fault Only */ #define _PAGE_IE _AC(0x0800000000000000,UL) /* Invert Endianness */ #define _PAGE_SOFT2 _AC(0x07FC000000000000,UL) /* Software bits, set 2 */ -#define _PAGE_RES1 _AC(0x0002000000000000,UL) /* Reserved */ -#define _PAGE_SZ32MB _AC(0x0001000000000000,UL) /* (Panther) 32MB page */ -#define _PAGE_SZ256MB _AC(0x2001000000000000,UL) /* (Panther) 256MB page */ +#define _PAGE_RES1 _AC(0x0003000000000000,UL) /* Reserved */ #define _PAGE_SN _AC(0x0000800000000000,UL) /* (Cheetah) Snoop */ #define _PAGE_RES2 _AC(0x0000780000000000,UL) /* Reserved */ #define _PAGE_PADDR_SF _AC(0x000001FFFFFFE000,UL) /* (Spitfire) paddr[40:13]*/ @@ -338,11 +336,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p #define pte_clear(mm,addr,ptep) \ set_pte_at((mm), (addr), (ptep), __pte(0UL)) -extern pgd_t swapper_pg_dir[2048]; -extern pmd_t swapper_low_pmd_dir[2048]; - -extern void paging_init(void); -extern unsigned long find_ecache_flush_span(unsigned long size); +extern pgd_t swapper_pg_dir[1]; /* These do nothing with the way I have things setup. */ #define mmu_lockarea(vaddr, len) (vaddr) diff --git a/trunk/include/asm-sparc64/uaccess.h b/trunk/include/asm-sparc64/uaccess.h index 203e8eee6351..80a65d7e3dbf 100644 --- a/trunk/include/asm-sparc64/uaccess.h +++ b/trunk/include/asm-sparc64/uaccess.h @@ -70,14 +70,26 @@ static inline int access_ok(int type, const void __user * addr, unsigned long si * with the main instruction path. This means when everything is well, * we don't even have to jump over them. Further, they do not intrude * on our cache or tlb entries. + * + * There is a special way how to put a range of potentially faulting + * insns (like twenty ldd/std's with now intervening other instructions) + * You specify address of first in insn and 0 in fixup and in the next + * exception_table_entry you specify last potentially faulting insn + 1 + * and in fixup the routine which should handle the fault. + * That fixup code will get + * (faulting_insn_address - first_insn_in_the_range_address)/4 + * in %g2 (ie. index of the faulting instruction in the range). */ -struct exception_table_entry { - unsigned int insn, fixup; +struct exception_table_entry +{ + unsigned insn, fixup; }; +/* Special exable search, which handles ranges. Returns fixup */ +unsigned long search_extables_range(unsigned long addr, unsigned long *g2); + extern void __ret_efault(void); -extern void __retl_efault(void); /* Uh, these should become the main single-value transfer routines.. * They automatically use the right size if we just have the right @@ -251,7 +263,7 @@ copy_from_user(void *to, const void __user *from, unsigned long size) { unsigned long ret = ___copy_from_user(to, from, size); - if (unlikely(ret)) + if (ret) ret = copy_from_user_fixup(to, from, size); return ret; } @@ -267,7 +279,7 @@ copy_to_user(void __user *to, const void *from, unsigned long size) { unsigned long ret = ___copy_to_user(to, from, size); - if (unlikely(ret)) + if (ret) ret = copy_to_user_fixup(to, from, size); return ret; } @@ -283,7 +295,7 @@ copy_in_user(void __user *to, void __user *from, unsigned long size) { unsigned long ret = ___copy_in_user(to, from, size); - if (unlikely(ret)) + if (ret) ret = copy_in_user_fixup(to, from, size); return ret; } diff --git a/trunk/include/asm-um/processor-generic.h b/trunk/include/asm-um/processor-generic.h index 075771c371f6..2d242360c3d6 100644 --- a/trunk/include/asm-um/processor-generic.h +++ b/trunk/include/asm-um/processor-generic.h @@ -13,7 +13,6 @@ struct task_struct; #include "linux/config.h" #include "asm/ptrace.h" #include "choose-mode.h" -#include "registers.h" struct mm_struct; @@ -137,15 +136,19 @@ extern struct cpuinfo_um cpu_data[]; #define current_cpu_data boot_cpu_data #endif - -#ifdef CONFIG_MODE_SKAS -#define KSTK_REG(tsk, reg) \ - ({ union uml_pt_regs regs; \ - get_thread_regs(®s, tsk->thread.mode.skas.switch_buf); \ - UPT_REG(®s, reg); }) -#else -#define KSTK_REG(tsk, reg) (0xbadbabe) -#endif +#define KSTK_EIP(tsk) (PT_REGS_IP(&tsk->thread.regs)) +#define KSTK_ESP(tsk) (PT_REGS_SP(&tsk->thread.regs)) #define get_wchan(p) (0) #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/include/asm-um/processor-i386.h b/trunk/include/asm-um/processor-i386.h index 4108a579eb92..431bad3ae9d7 100644 --- a/trunk/include/asm-um/processor-i386.h +++ b/trunk/include/asm-um/processor-i386.h @@ -43,10 +43,17 @@ static inline void rep_nop(void) #define ARCH_IS_STACKGROW(address) \ (address + 32 >= UPT_SP(¤t->thread.regs.regs)) -#define KSTK_EIP(tsk) KSTK_REG(tsk, EIP) -#define KSTK_ESP(tsk) KSTK_REG(tsk, UESP) -#define KSTK_EBP(tsk) KSTK_REG(tsk, EBP) - #include "asm/processor-generic.h" #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/include/asm-um/processor-x86_64.h b/trunk/include/asm-um/processor-x86_64.h index e1e1255a1d36..0beb9a42ae05 100644 --- a/trunk/include/asm-um/processor-x86_64.h +++ b/trunk/include/asm-um/processor-x86_64.h @@ -36,9 +36,17 @@ extern inline void rep_nop(void) #define ARCH_IS_STACKGROW(address) \ (address + 128 >= UPT_SP(¤t->thread.regs.regs)) -#define KSTK_EIP(tsk) KSTK_REG(tsk, RIP) -#define KSTK_ESP(tsk) KSTK_REG(tsk, RSP) - #include "asm/processor-generic.h" #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/include/asm-um/uaccess.h b/trunk/include/asm-um/uaccess.h index 2ee028b8de9d..801710d00a40 100644 --- a/trunk/include/asm-um/uaccess.h +++ b/trunk/include/asm-um/uaccess.h @@ -44,7 +44,7 @@ const __typeof__(ptr) __private_ptr = ptr; \ __typeof__(*(__private_ptr)) __private_val; \ int __private_ret = -EFAULT; \ - (x) = (__typeof__(*(__private_ptr)))0; \ + (x) = 0; \ if (__copy_from_user(&__private_val, (__private_ptr), \ sizeof(*(__private_ptr))) == 0) {\ (x) = (__typeof__(*(__private_ptr))) __private_val; \ diff --git a/trunk/include/asm-x86_64/msr.h b/trunk/include/asm-x86_64/msr.h index 5a7fe3c6c3d8..4d727f3f5550 100644 --- a/trunk/include/asm-x86_64/msr.h +++ b/trunk/include/asm-x86_64/msr.h @@ -234,7 +234,6 @@ static inline unsigned int cpuid_edx(unsigned int op) #define MSR_K8_TOP_MEM1 0xC001001A #define MSR_K8_TOP_MEM2 0xC001001D #define MSR_K8_SYSCFG 0xC0010010 -#define MSR_K8_HWCR 0xC0010015 /* K6 MSRs */ #define MSR_K6_EFER 0xC0000080 diff --git a/trunk/include/asm-x86_64/pgtable.h b/trunk/include/asm-x86_64/pgtable.h index dd8711ecaf2f..2cb483516459 100644 --- a/trunk/include/asm-x86_64/pgtable.h +++ b/trunk/include/asm-x86_64/pgtable.h @@ -384,7 +384,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) } #define pte_index(address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ pte_index(address)) diff --git a/trunk/include/asm-x86_64/smp.h b/trunk/include/asm-x86_64/smp.h index c57ce4071342..24e32611f0bf 100644 --- a/trunk/include/asm-x86_64/smp.h +++ b/trunk/include/asm-x86_64/smp.h @@ -81,7 +81,6 @@ static inline int hard_smp_processor_id(void) extern int safe_smp_processor_id(void); extern int __cpu_disable(void); extern void __cpu_die(unsigned int cpu); -extern void prefill_possible_map(void); #endif /* !ASSEMBLY */ diff --git a/trunk/include/linux/acct.h b/trunk/include/linux/acct.h index 19f70462b3be..1993a3691768 100644 --- a/trunk/include/linux/acct.h +++ b/trunk/include/linux/acct.h @@ -162,13 +162,13 @@ typedef struct acct acct_t; #ifdef __KERNEL__ /* * Yet another set of HZ to *HZ helper functions. - * See for the original. + * See for the original. */ static inline u32 jiffies_to_AHZ(unsigned long x) { #if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0 - return x / (HZ / AHZ); + return x / (HZ / USER_HZ); #else u64 tmp = (u64)x * TICK_NSEC; do_div(tmp, (NSEC_PER_SEC / AHZ)); diff --git a/trunk/include/linux/aio.h b/trunk/include/linux/aio.h index 0decf66117c1..a4d5af907f90 100644 --- a/trunk/include/linux/aio.h +++ b/trunk/include/linux/aio.h @@ -24,12 +24,7 @@ struct kioctx; #define KIOCB_SYNC_KEY (~0U) /* ki_flags bits */ -/* - * This may be used for cancel/retry serialization in the future, but - * for now it's unused and we probably don't want modules to even - * think they can use it. - */ -/* #define KIF_LOCKED 0 */ +#define KIF_LOCKED 0 #define KIF_KICKED 1 #define KIF_CANCELLED 2 @@ -48,40 +43,6 @@ struct kioctx; #define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags) #define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags) -/* is there a better place to document function pointer methods? */ -/** - * ki_retry - iocb forward progress callback - * @kiocb: The kiocb struct to advance by performing an operation. - * - * This callback is called when the AIO core wants a given AIO operation - * to make forward progress. The kiocb argument describes the operation - * that is to be performed. As the operation proceeds, perhaps partially, - * ki_retry is expected to update the kiocb with progress made. Typically - * ki_retry is set in the AIO core and it itself calls file_operations - * helpers. - * - * ki_retry's return value determines when the AIO operation is completed - * and an event is generated in the AIO event ring. Except the special - * return values described below, the value that is returned from ki_retry - * is transferred directly into the completion ring as the operation's - * resulting status. Once this has happened ki_retry *MUST NOT* reference - * the kiocb pointer again. - * - * If ki_retry returns -EIOCBQUEUED it has made a promise that aio_complete() - * will be called on the kiocb pointer in the future. The AIO core will - * not ask the method again -- ki_retry must ensure forward progress. - * aio_complete() must be called once and only once in the future, multiple - * calls may result in undefined behaviour. - * - * If ki_retry returns -EIOCBRETRY it has made a promise that kick_iocb() - * will be called on the kiocb pointer in the future. This may happen - * through generic helpers that associate kiocb->ki_wait with a wait - * queue head that ki_retry uses via current->io_wait. It can also happen - * with custom tracking and manual calls to kick_iocb(), though that is - * discouraged. In either case, kick_iocb() must be called once and only - * once. ki_retry must ensure forward progress, the AIO core will wait - * indefinitely for kick_iocb() to be called. - */ struct kiocb { struct list_head ki_run_list; long ki_flags; diff --git a/trunk/include/linux/ata.h b/trunk/include/linux/ata.h index 630908c9378b..a5b74efab067 100644 --- a/trunk/include/linux/ata.h +++ b/trunk/include/linux/ata.h @@ -128,15 +128,10 @@ enum { ATA_CMD_PIO_READ_EXT = 0x24, ATA_CMD_PIO_WRITE = 0x30, ATA_CMD_PIO_WRITE_EXT = 0x34, - ATA_CMD_READ_MULTI = 0xC4, - ATA_CMD_READ_MULTI_EXT = 0x29, - ATA_CMD_WRITE_MULTI = 0xC5, - ATA_CMD_WRITE_MULTI_EXT = 0x39, ATA_CMD_SET_FEATURES = 0xEF, ATA_CMD_PACKET = 0xA0, ATA_CMD_VERIFY = 0x40, ATA_CMD_VERIFY_EXT = 0x42, - ATA_CMD_INIT_DEV_PARAMS = 0x91, /* SETFEATURES stuff */ SETFEATURES_XFER = 0x03, @@ -151,14 +146,14 @@ enum { XFER_MW_DMA_2 = 0x22, XFER_MW_DMA_1 = 0x21, XFER_MW_DMA_0 = 0x20, - XFER_SW_DMA_2 = 0x12, - XFER_SW_DMA_1 = 0x11, - XFER_SW_DMA_0 = 0x10, XFER_PIO_4 = 0x0C, XFER_PIO_3 = 0x0B, XFER_PIO_2 = 0x0A, XFER_PIO_1 = 0x09, XFER_PIO_0 = 0x08, + XFER_SW_DMA_2 = 0x12, + XFER_SW_DMA_1 = 0x11, + XFER_SW_DMA_0 = 0x10, XFER_PIO_SLOW = 0x00, /* ATAPI stuff */ @@ -186,7 +181,6 @@ enum { ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ - ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ }; enum ata_tf_protocols { @@ -256,18 +250,6 @@ struct ata_taskfile { ((u64) (id)[(n) + 1] << 16) | \ ((u64) (id)[(n) + 0]) ) -static inline int ata_id_current_chs_valid(u16 *id) -{ - /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command - has not been issued to the device then the values of - id[54] to id[56] are vendor specific. */ - return (id[53] & 0x01) && /* Current translation valid */ - id[54] && /* cylinders in current translation */ - id[55] && /* heads in current translation */ - id[55] <= 16 && - id[56]; /* sectors in current translation */ -} - static inline int atapi_cdb_len(u16 *dev_id) { u16 tmp = dev_id[0] & 0x3; diff --git a/trunk/include/linux/atmdev.h b/trunk/include/linux/atmdev.h index e7d0593bb576..9f374cfa1b05 100644 --- a/trunk/include/linux/atmdev.h +++ b/trunk/include/linux/atmdev.h @@ -76,13 +76,6 @@ struct atm_dev_stats { /* set interface ESI */ #define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) /* force interface ESI */ -#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) - /* register a LECS address */ -#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) - /* unregister a LECS address */ -#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) - /* retrieve LECS address(es) */ - #define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) /* get AAL layer statistics */ #define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) @@ -335,8 +328,6 @@ struct atm_dev_addr { struct list_head entry; /* next address */ }; -enum atm_addr_type_t { ATM_ADDR_LOCAL, ATM_ADDR_LECS }; - struct atm_dev { const struct atmdev_ops *ops; /* device operations; NULL if unused */ const struct atmphy_ops *phy; /* PHY operations, may be undefined */ @@ -347,7 +338,6 @@ struct atm_dev { void *phy_data; /* private PHY date */ unsigned long flags; /* device flags (ATM_DF_*) */ struct list_head local; /* local ATM addresses */ - struct list_head lecs; /* LECS ATM addresses learned via ILMI */ unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */ struct atm_cirange ci_range; /* VPI/VCI range */ struct k_atm_dev_stats stats; /* statistics */ @@ -467,7 +457,7 @@ static inline void atm_dev_put(struct atm_dev *dev) int atm_charge(struct atm_vcc *vcc,int truesize); struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, - gfp_t gfp_flags); + int gfp_flags); int atm_pcr_goal(struct atm_trafprm *tp); void vcc_release_async(struct atm_vcc *vcc, int reply); diff --git a/trunk/include/linux/bfs_fs.h b/trunk/include/linux/bfs_fs.h index 8ed6dfdcd783..c1237aa92e38 100644 --- a/trunk/include/linux/bfs_fs.h +++ b/trunk/include/linux/bfs_fs.h @@ -20,19 +20,19 @@ /* BFS inode layout on disk */ struct bfs_inode { - __le16 i_ino; + __u16 i_ino; __u16 i_unused; - __le32 i_sblock; - __le32 i_eblock; - __le32 i_eoffset; - __le32 i_vtype; - __le32 i_mode; - __le32 i_uid; - __le32 i_gid; - __le32 i_nlink; - __le32 i_atime; - __le32 i_mtime; - __le32 i_ctime; + __u32 i_sblock; + __u32 i_eblock; + __u32 i_eoffset; + __u32 i_vtype; + __u32 i_mode; + __s32 i_uid; + __s32 i_gid; + __u32 i_nlink; + __u32 i_atime; + __u32 i_mtime; + __u32 i_ctime; __u32 i_padding[4]; }; @@ -41,17 +41,17 @@ struct bfs_inode { #define BFS_DIRS_PER_BLOCK 32 struct bfs_dirent { - __le16 ino; + __u16 ino; char name[BFS_NAMELEN]; }; /* BFS superblock layout on disk */ struct bfs_super_block { - __le32 s_magic; - __le32 s_start; - __le32 s_end; - __le32 s_from; - __le32 s_to; + __u32 s_magic; + __u32 s_start; + __u32 s_end; + __s32 s_from; + __s32 s_to; __s32 s_bfrom; __s32 s_bto; char s_fsname[6]; @@ -66,15 +66,15 @@ struct bfs_super_block { #define BFS_INO2OFF(ino) \ ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) #define BFS_NZFILESIZE(ip) \ - ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) + ((cpu_to_le32((ip)->i_eoffset) + 1) - cpu_to_le32((ip)->i_sblock) * BFS_BSIZE) #define BFS_FILESIZE(ip) \ ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) #define BFS_FILEBLOCKS(ip) \ - ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) + ((ip)->i_sblock == 0 ? 0 : (cpu_to_le32((ip)->i_eblock) + 1) - cpu_to_le32((ip)->i_sblock)) #define BFS_UNCLEAN(bfs_sb, sb) \ - ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) + ((cpu_to_le32(bfs_sb->s_from) != -1) && (cpu_to_le32(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) #endif /* _LINUX_BFS_FS_H */ diff --git a/trunk/include/linux/bio.h b/trunk/include/linux/bio.h index 3344b4e8e43a..6e1c79c8b6bf 100644 --- a/trunk/include/linux/bio.h +++ b/trunk/include/linux/bio.h @@ -276,8 +276,8 @@ extern void bio_pair_release(struct bio_pair *dbio); extern struct bio_set *bioset_create(int, int, int); extern void bioset_free(struct bio_set *); -extern struct bio *bio_alloc(gfp_t, int); -extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); +extern struct bio *bio_alloc(unsigned int __nocast, int); +extern struct bio *bio_alloc_bioset(unsigned int __nocast, int, struct bio_set *); extern void bio_put(struct bio *); extern void bio_free(struct bio *, struct bio_set *); @@ -287,7 +287,7 @@ extern int bio_phys_segments(struct request_queue *, struct bio *); extern int bio_hw_segments(struct request_queue *, struct bio *); extern void __bio_clone(struct bio *, struct bio *); -extern struct bio *bio_clone(struct bio *, gfp_t); +extern struct bio *bio_clone(struct bio *, unsigned int __nocast); extern void bio_init(struct bio *); diff --git a/trunk/include/linux/buffer_head.h b/trunk/include/linux/buffer_head.h index 6a1d154c0825..90828493791f 100644 --- a/trunk/include/linux/buffer_head.h +++ b/trunk/include/linux/buffer_head.h @@ -172,7 +172,7 @@ void __brelse(struct buffer_head *); void __bforget(struct buffer_head *); void __breadahead(struct block_device *, sector_t block, int size); struct buffer_head *__bread(struct block_device *, sector_t block, int size); -struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); +struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags); void free_buffer_head(struct buffer_head * bh); void FASTCALL(unlock_buffer(struct buffer_head *bh)); void FASTCALL(__lock_buffer(struct buffer_head *bh)); diff --git a/trunk/include/linux/connector.h b/trunk/include/linux/connector.h index 95952cc1f525..96de26301f84 100644 --- a/trunk/include/linux/connector.h +++ b/trunk/include/linux/connector.h @@ -104,19 +104,12 @@ struct cn_queue_dev { struct sock *nls; }; -struct cn_callback_id { +struct cn_callback { unsigned char name[CN_CBQ_NAMELEN]; - struct cb_id id; -}; -struct cn_callback_data { - void (*destruct_data) (void *); - void *ddata; - - void *callback_priv; + struct cb_id id; void (*callback) (void *); - - void *free; + void *priv; }; struct cn_callback_entry { @@ -125,8 +118,8 @@ struct cn_callback_entry { struct work_struct work; struct cn_queue_dev *pdev; - struct cn_callback_id id; - struct cn_callback_data data; + void (*destruct_data) (void *); + void *ddata; int seq, group; struct sock *nls; @@ -149,9 +142,9 @@ struct cn_dev { int cn_add_callback(struct cb_id *, char *, void (*callback) (void *)); void cn_del_callback(struct cb_id *); -int cn_netlink_send(struct cn_msg *, u32, gfp_t); +int cn_netlink_send(struct cn_msg *, u32, int); -int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)); +int cn_queue_add_callback(struct cn_queue_dev *dev, struct cn_callback *cb); void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); @@ -159,8 +152,6 @@ void cn_queue_free_dev(struct cn_queue_dev *dev); int cn_cb_equal(struct cb_id *, struct cb_id *); -void cn_queue_wrapper(void *data); - extern int cn_already_initialized; #endif /* __KERNEL__ */ diff --git a/trunk/include/linux/cpumask.h b/trunk/include/linux/cpumask.h index 9bdba8169b41..b15826f6e3a2 100644 --- a/trunk/include/linux/cpumask.h +++ b/trunk/include/linux/cpumask.h @@ -392,14 +392,4 @@ extern cpumask_t cpu_present_map; #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) -/* Find the highest possible smp_processor_id() */ -#define highest_possible_processor_id() \ -({ \ - unsigned int cpu, highest = 0; \ - for_each_cpu_mask(cpu, cpu_possible_map) \ - highest = cpu; \ - highest; \ -}) - - #endif /* __LINUX_CPUMASK_H */ diff --git a/trunk/include/linux/cpuset.h b/trunk/include/linux/cpuset.h index 6e2deef96b34..24062a1dbf61 100644 --- a/trunk/include/linux/cpuset.h +++ b/trunk/include/linux/cpuset.h @@ -23,7 +23,7 @@ void cpuset_init_current_mems_allowed(void); void cpuset_update_current_mems_allowed(void); void cpuset_restrict_to_mems_allowed(unsigned long *nodes); int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); -extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask); +extern int cpuset_zone_allowed(struct zone *z, unsigned int __nocast gfp_mask); extern int cpuset_excl_nodes_overlap(const struct task_struct *p); extern struct file_operations proc_cpuset_operations; extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); @@ -49,7 +49,8 @@ static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) return 1; } -static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) +static inline int cpuset_zone_allowed(struct zone *z, + unsigned int __nocast gfp_mask) { return 1; } diff --git a/trunk/include/linux/dmapool.h b/trunk/include/linux/dmapool.h index 76f12f46db7f..4932ee5c77f0 100644 --- a/trunk/include/linux/dmapool.h +++ b/trunk/include/linux/dmapool.h @@ -19,7 +19,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev, void dma_pool_destroy(struct dma_pool *pool); -void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, +void *dma_pool_alloc(struct dma_pool *pool, unsigned int __nocast mem_flags, dma_addr_t *handle); void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); diff --git a/trunk/include/linux/gfp.h b/trunk/include/linux/gfp.h index 3010e172394d..4dc990f3b5cc 100644 --- a/trunk/include/linux/gfp.h +++ b/trunk/include/linux/gfp.h @@ -85,9 +85,9 @@ static inline void arch_free_page(struct page *page, int order) { } #endif extern struct page * -FASTCALL(__alloc_pages(gfp_t, unsigned int, struct zonelist *)); +FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *)); -static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, +static inline struct page *alloc_pages_node(int nid, unsigned int __nocast gfp_mask, unsigned int order) { if (unlikely(order >= MAX_ORDER)) @@ -98,17 +98,17 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, } #ifdef CONFIG_NUMA -extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); +extern struct page *alloc_pages_current(unsigned int __nocast gfp_mask, unsigned order); static inline struct page * -alloc_pages(gfp_t gfp_mask, unsigned int order) +alloc_pages(unsigned int __nocast gfp_mask, unsigned int order) { if (unlikely(order >= MAX_ORDER)) return NULL; return alloc_pages_current(gfp_mask, order); } -extern struct page *alloc_page_vma(gfp_t gfp_mask, +extern struct page *alloc_page_vma(unsigned __nocast gfp_mask, struct vm_area_struct *vma, unsigned long addr); #else #define alloc_pages(gfp_mask, order) \ @@ -117,8 +117,8 @@ extern struct page *alloc_page_vma(gfp_t gfp_mask, #endif #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) -extern unsigned long FASTCALL(__get_free_pages(gfp_t gfp_mask, unsigned int order)); -extern unsigned long FASTCALL(get_zeroed_page(gfp_t gfp_mask)); +extern unsigned long FASTCALL(__get_free_pages(unsigned int __nocast gfp_mask, unsigned int order)); +extern unsigned long FASTCALL(get_zeroed_page(unsigned int __nocast gfp_mask)); #define __get_free_page(gfp_mask) \ __get_free_pages((gfp_mask),0) diff --git a/trunk/include/linux/if_ether.h b/trunk/include/linux/if_ether.h index d21c305c6c64..fc2d4c8225aa 100644 --- a/trunk/include/linux/if_ether.h +++ b/trunk/include/linux/if_ether.h @@ -111,9 +111,7 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) return (struct ethhdr *)skb->mac.raw; } -#ifdef CONFIG_SYSCTL extern struct ctl_table ether_table[]; #endif -#endif #endif /* _LINUX_IF_ETHER_H */ diff --git a/trunk/include/linux/inetdevice.h b/trunk/include/linux/inetdevice.h index fd7af86151b1..7e1e15f934f3 100644 --- a/trunk/include/linux/inetdevice.h +++ b/trunk/include/linux/inetdevice.h @@ -142,21 +142,13 @@ static __inline__ int bad_mask(u32 mask, u32 addr) #define endfor_ifa(in_dev) } -static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) -{ - struct in_device *in_dev = dev->ip_ptr; - if (in_dev) - in_dev = rcu_dereference(in_dev); - return in_dev; -} - static __inline__ struct in_device * in_dev_get(const struct net_device *dev) { struct in_device *in_dev; rcu_read_lock(); - in_dev = __in_dev_get_rcu(dev); + in_dev = dev->ip_ptr; if (in_dev) atomic_inc(&in_dev->refcnt); rcu_read_unlock(); @@ -164,7 +156,7 @@ in_dev_get(const struct net_device *dev) } static __inline__ struct in_device * -__in_dev_get_rtnl(const struct net_device *dev) +__in_dev_get(const struct net_device *dev) { return (struct in_device*)dev->ip_ptr; } diff --git a/trunk/include/linux/ipv6.h b/trunk/include/linux/ipv6.h index e0b922785d98..bb6f88e14061 100644 --- a/trunk/include/linux/ipv6.h +++ b/trunk/include/linux/ipv6.h @@ -372,9 +372,8 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) #define inet_v6_ipv6only(__sk) 0 #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ -#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ - (((__sk)->sk_hash == (__hash)) && \ - ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ +#define INET6_MATCH(__sk, __saddr, __daddr, __ports, __dif) \ + (((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ ((__sk)->sk_family == AF_INET6) && \ ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ diff --git a/trunk/include/linux/jbd.h b/trunk/include/linux/jbd.h index ff853b3173c6..de097269bd7f 100644 --- a/trunk/include/linux/jbd.h +++ b/trunk/include/linux/jbd.h @@ -935,7 +935,7 @@ void journal_put_journal_head(struct journal_head *jh); */ extern kmem_cache_t *jbd_handle_cache; -static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags) +static inline handle_t *jbd_alloc_handle(unsigned int __nocast gfp_flags) { return kmem_cache_alloc(jbd_handle_cache, gfp_flags); } diff --git a/trunk/include/linux/key-ui.h b/trunk/include/linux/key-ui.h index 7a2e332067c3..cc326174a808 100644 --- a/trunk/include/linux/key-ui.h +++ b/trunk/include/linux/key-ui.h @@ -38,21 +38,92 @@ struct keyring_list { struct key *keys[0]; }; + /* * check to see whether permission is granted to use a key in the desired way */ -extern int key_task_permission(const key_ref_t key_ref, - struct task_struct *context, - key_perm_t perm); +static inline int key_permission(const struct key *key, key_perm_t perm) +{ + key_perm_t kperm; + + if (key->uid == current->fsuid) + kperm = key->perm >> 16; + else if (key->gid != -1 && + key->perm & KEY_GRP_ALL && + in_group_p(key->gid) + ) + kperm = key->perm >> 8; + else + kperm = key->perm; + + kperm = kperm & perm & KEY_ALL; + + return kperm == perm; +} + +/* + * check to see whether permission is granted to use a key in at least one of + * the desired ways + */ +static inline int key_any_permission(const struct key *key, key_perm_t perm) +{ + key_perm_t kperm; + + if (key->uid == current->fsuid) + kperm = key->perm >> 16; + else if (key->gid != -1 && + key->perm & KEY_GRP_ALL && + in_group_p(key->gid) + ) + kperm = key->perm >> 8; + else + kperm = key->perm; -static inline int key_permission(const key_ref_t key_ref, key_perm_t perm) + kperm = kperm & perm & KEY_ALL; + + return kperm != 0; +} + +static inline int key_task_groups_search(struct task_struct *tsk, gid_t gid) { - return key_task_permission(key_ref, current, perm); + int ret; + + task_lock(tsk); + ret = groups_search(tsk->group_info, gid); + task_unlock(tsk); + return ret; +} + +static inline int key_task_permission(const struct key *key, + struct task_struct *context, + key_perm_t perm) +{ + key_perm_t kperm; + + if (key->uid == context->fsuid) { + kperm = key->perm >> 16; + } + else if (key->gid != -1 && + key->perm & KEY_GRP_ALL && ( + key->gid == context->fsgid || + key_task_groups_search(context, key->gid) + ) + ) { + kperm = key->perm >> 8; + } + else { + kperm = key->perm; + } + + kperm = kperm & perm & KEY_ALL; + + return kperm == perm; + } -extern key_ref_t lookup_user_key(struct task_struct *context, - key_serial_t id, int create, int partial, - key_perm_t perm); +extern struct key *lookup_user_key(struct task_struct *context, + key_serial_t id, int create, int partial, + key_perm_t perm); extern long join_session_keyring(const char *name); diff --git a/trunk/include/linux/key.h b/trunk/include/linux/key.h index f1efa016dbf3..970bbd916cf4 100644 --- a/trunk/include/linux/key.h +++ b/trunk/include/linux/key.h @@ -35,18 +35,11 @@ struct key; #undef KEY_DEBUGGING -#define KEY_POS_VIEW 0x01000000 /* possessor can view a key's attributes */ -#define KEY_POS_READ 0x02000000 /* possessor can read key payload / view keyring */ -#define KEY_POS_WRITE 0x04000000 /* possessor can update key payload / add link to keyring */ -#define KEY_POS_SEARCH 0x08000000 /* possessor can find a key in search / search a keyring */ -#define KEY_POS_LINK 0x10000000 /* possessor can create a link to a key/keyring */ -#define KEY_POS_ALL 0x1f000000 - -#define KEY_USR_VIEW 0x00010000 /* user permissions... */ -#define KEY_USR_READ 0x00020000 -#define KEY_USR_WRITE 0x00040000 -#define KEY_USR_SEARCH 0x00080000 -#define KEY_USR_LINK 0x00100000 +#define KEY_USR_VIEW 0x00010000 /* user can view a key's attributes */ +#define KEY_USR_READ 0x00020000 /* user can read key payload / view keyring */ +#define KEY_USR_WRITE 0x00040000 /* user can update key payload / add link to keyring */ +#define KEY_USR_SEARCH 0x00080000 /* user can find a key in search / search a keyring */ +#define KEY_USR_LINK 0x00100000 /* user can create a link to a key/keyring */ #define KEY_USR_ALL 0x001f0000 #define KEY_GRP_VIEW 0x00000100 /* group permissions... */ @@ -72,38 +65,6 @@ struct key_owner; struct keyring_list; struct keyring_name; -/*****************************************************************************/ -/* - * key reference with possession attribute handling - * - * NOTE! key_ref_t is a typedef'd pointer to a type that is not actually - * defined. This is because we abuse the bottom bit of the reference to carry a - * flag to indicate whether the calling process possesses that key in one of - * its keyrings. - * - * the key_ref_t has been made a separate type so that the compiler can reject - * attempts to dereference it without proper conversion. - * - * the three functions are used to assemble and disassemble references - */ -typedef struct __key_reference_with_attributes *key_ref_t; - -static inline key_ref_t make_key_ref(const struct key *key, - unsigned long possession) -{ - return (key_ref_t) ((unsigned long) key | possession); -} - -static inline struct key *key_ref_to_ptr(const key_ref_t key_ref) -{ - return (struct key *) ((unsigned long) key_ref & ~1UL); -} - -static inline unsigned long is_key_possessed(const key_ref_t key_ref) -{ - return (unsigned long) key_ref & 1UL; -} - /*****************************************************************************/ /* * authentication token / access credential / keyring @@ -254,25 +215,20 @@ static inline struct key *key_get(struct key *key) return key; } -static inline void key_ref_put(key_ref_t key_ref) -{ - key_put(key_ref_to_ptr(key_ref)); -} - extern struct key *request_key(struct key_type *type, const char *description, const char *callout_info); extern int key_validate(struct key *key); -extern key_ref_t key_create_or_update(key_ref_t keyring, - const char *type, - const char *description, - const void *payload, - size_t plen, - int not_in_quota); +extern struct key *key_create_or_update(struct key *keyring, + const char *type, + const char *description, + const void *payload, + size_t plen, + int not_in_quota); -extern int key_update(key_ref_t key, +extern int key_update(struct key *key, const void *payload, size_t plen); @@ -287,9 +243,9 @@ extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, extern int keyring_clear(struct key *keyring); -extern key_ref_t keyring_search(key_ref_t keyring, - struct key_type *type, - const char *description); +extern struct key *keyring_search(struct key *keyring, + struct key_type *type, + const char *description); extern int keyring_add_key(struct key *keyring, struct key *key); @@ -329,10 +285,6 @@ extern void key_init(void); #define key_serial(k) 0 #define key_get(k) ({ NULL; }) #define key_put(k) do { } while(0) -#define key_ref_put(k) do { } while(0) -#define make_key_ref(k) ({ NULL; }) -#define key_ref_to_ptr(k) ({ NULL; }) -#define is_key_possessed(k) 0 #define alloc_uid_keyring(u) 0 #define switch_uid_keyring(u) do { } while(0) #define __install_session_keyring(t, k) ({ NULL; }) diff --git a/trunk/include/linux/kfifo.h b/trunk/include/linux/kfifo.h index 48eccd865bd8..c27cd428d269 100644 --- a/trunk/include/linux/kfifo.h +++ b/trunk/include/linux/kfifo.h @@ -35,8 +35,8 @@ struct kfifo { }; extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, - gfp_t gfp_mask, spinlock_t *lock); -extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, + unsigned int __nocast gfp_mask, spinlock_t *lock); +extern struct kfifo *kfifo_alloc(unsigned int size, unsigned int __nocast gfp_mask, spinlock_t *lock); extern void kfifo_free(struct kfifo *fifo); extern unsigned int __kfifo_put(struct kfifo *fifo, diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index d3dfefefabec..022105c745fc 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/include/linux/libata.h @@ -97,7 +97,6 @@ enum { ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */ - ATA_DFLAG_LBA = (1 << 3), /* device supports LBA */ ATA_DEV_UNKNOWN = 0, /* unknown device */ ATA_DEV_ATA = 1, /* ATA device */ @@ -155,25 +154,17 @@ enum { ATA_SHIFT_UDMA = 0, ATA_SHIFT_MWDMA = 8, ATA_SHIFT_PIO = 11, - - /* size of buffer to pad xfers ending on unaligned boundaries */ - ATA_DMA_PAD_SZ = 4, - ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE, - - /* Masks for port functions */ - ATA_PORT_PRIMARY = (1 << 0), - ATA_PORT_SECONDARY = (1 << 1), }; -enum hsm_task_states { - HSM_ST_UNKNOWN, - HSM_ST_IDLE, - HSM_ST_POLL, - HSM_ST_TMOUT, - HSM_ST, - HSM_ST_LAST, - HSM_ST_LAST_POLL, - HSM_ST_ERR, +enum pio_task_states { + PIO_ST_UNKNOWN, + PIO_ST_IDLE, + PIO_ST_POLL, + PIO_ST_TMOUT, + PIO_ST, + PIO_ST_LAST, + PIO_ST_LAST_POLL, + PIO_ST_ERR, }; /* forward declarations */ @@ -246,12 +237,9 @@ struct ata_queued_cmd { unsigned long flags; /* ATA_QCFLAG_xxx */ unsigned int tag; unsigned int n_elem; - unsigned int orig_n_elem; int dma_dir; - unsigned int pad_len; - unsigned int nsect; unsigned int cursect; @@ -262,11 +250,9 @@ struct ata_queued_cmd { unsigned int cursg_ofs; struct scatterlist sgent; - struct scatterlist pad_sgent; void *buf_virt; - /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ - struct scatterlist *__sg; + struct scatterlist *sg; ata_qc_cb_t complete_fn; @@ -292,13 +278,10 @@ struct ata_device { u8 xfer_mode; unsigned int xfer_shift; /* ATA_SHIFT_xxx */ - unsigned int multi_count; /* sectors count for - READ/WRITE MULTIPLE */ - - /* for CHS addressing */ - u16 cylinders; /* Number of cylinders */ - u16 heads; /* Number of heads */ - u16 sectors; /* Number of sectors per track */ + /* cache info about current transfer mode */ + u8 xfer_protocol; /* taskfile xfer protocol */ + u8 read_cmd; /* opcode to use on read */ + u8 write_cmd; /* opcode to use on write */ }; struct ata_port { @@ -312,9 +295,6 @@ struct ata_port { struct ata_prd *prd; /* our SG list */ dma_addr_t prd_dma; /* and its DMA mapping */ - void *pad; /* array of DMA pad buffers */ - dma_addr_t pad_dma; - struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ u8 ctl; /* cache of ATA control register */ @@ -339,7 +319,7 @@ struct ata_port { struct work_struct packet_task; struct work_struct pio_task; - unsigned int hsm_task_state; + unsigned int pio_task_state; unsigned long pio_task_timeout; void *private_data; @@ -413,15 +393,12 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i extern void ata_pci_remove_one (struct pci_dev *pdev); #endif /* CONFIG_PCI */ extern int ata_device_add(struct ata_probe_ent *ent); -extern void ata_host_set_remove(struct ata_host_set *host_set); extern int ata_scsi_detect(Scsi_Host_Template *sht); extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); extern int ata_scsi_error(struct Scsi_Host *host); extern int ata_scsi_release(struct Scsi_Host *host); extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); -extern int ata_ratelimit(void); - /* * Default driver ops implementations */ @@ -474,37 +451,12 @@ struct pci_bits { extern void ata_pci_host_stop (struct ata_host_set *host_set); extern struct ata_probe_ent * -ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); +ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); #endif /* CONFIG_PCI */ -static inline int -ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc) -{ - if (sg == &qc->pad_sgent) - return 1; - if (qc->pad_len) - return 0; - if (((sg - qc->__sg) + 1) == qc->n_elem) - return 1; - return 0; -} - -static inline struct scatterlist * -ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc) -{ - if (sg == &qc->pad_sgent) - return NULL; - if (++sg - qc->__sg < qc->n_elem) - return sg; - return qc->pad_len ? &qc->pad_sgent : NULL; -} - -#define ata_for_each_sg(sg, qc) \ - for (sg = qc->__sg; sg; sg = ata_qc_next_sg(sg, qc)) - static inline unsigned int ata_tag_valid(unsigned int tag) { return (tag < ATA_MAX_QUEUE) ? 1 : 0; diff --git a/trunk/include/linux/list.h b/trunk/include/linux/list.h index 084971f333fe..e6ec59682274 100644 --- a/trunk/include/linux/list.h +++ b/trunk/include/linux/list.h @@ -442,14 +442,12 @@ static inline void list_splice_init(struct list_head *list, * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_rcu(pos, head) \ - for (pos = (head)->next; \ - prefetch(rcu_dereference(pos)->next), pos != (head); \ - pos = pos->next) + for (pos = (head)->next; prefetch(pos->next), pos != (head); \ + pos = rcu_dereference(pos->next)) #define __list_for_each_rcu(pos, head) \ - for (pos = (head)->next; \ - rcu_dereference(pos) != (head); \ - pos = pos->next) + for (pos = (head)->next; pos != (head); \ + pos = rcu_dereference(pos->next)) /** * list_for_each_safe_rcu - iterate over an rcu-protected list safe @@ -463,9 +461,8 @@ static inline void list_splice_init(struct list_head *list, * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_safe_rcu(pos, n, head) \ - for (pos = (head)->next; \ - n = rcu_dereference(pos)->next, pos != (head); \ - pos = n) + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = rcu_dereference(n), n = pos->next) /** * list_for_each_entry_rcu - iterate over rcu list of given type @@ -477,11 +474,11 @@ static inline void list_splice_init(struct list_head *list, * the _rcu list-mutation primitives such as list_add_rcu() * as long as the traversal is guarded by rcu_read_lock(). */ -#define list_for_each_entry_rcu(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - prefetch(rcu_dereference(pos)->member.next), \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) +#define list_for_each_entry_rcu(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + prefetch(pos->member.next), &pos->member != (head); \ + pos = rcu_dereference(list_entry(pos->member.next, \ + typeof(*pos), member))) /** @@ -495,9 +492,8 @@ static inline void list_splice_init(struct list_head *list, * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_continue_rcu(pos, head) \ - for ((pos) = (pos)->next; \ - prefetch(rcu_dereference((pos))->next), (pos) != (head); \ - (pos) = (pos)->next) + for ((pos) = (pos)->next; prefetch((pos)->next), (pos) != (head); \ + (pos) = rcu_dereference((pos)->next)) /* * Double linked lists with a single pointer list head. @@ -700,9 +696,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, pos = n) #define hlist_for_each_rcu(pos, head) \ - for ((pos) = (head)->first; \ - rcu_dereference((pos)) && ({ prefetch((pos)->next); 1; }); \ - (pos) = (pos)->next) + for ((pos) = (head)->first; pos && ({ prefetch((pos)->next); 1; }); \ + (pos) = rcu_dereference((pos)->next)) /** * hlist_for_each_entry - iterate over list of given type @@ -767,9 +762,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, */ #define hlist_for_each_entry_rcu(tpos, pos, head, member) \ for (pos = (head)->first; \ - rcu_dereference(pos) && ({ prefetch(pos->next); 1;}) && \ + pos && ({ prefetch(pos->next); 1;}) && \ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) + pos = rcu_dereference(pos->next)) #else #warning "don't include kernel headers in userspace" diff --git a/trunk/include/linux/mempool.h b/trunk/include/linux/mempool.h index f2427d7394b0..796220ce47cc 100644 --- a/trunk/include/linux/mempool.h +++ b/trunk/include/linux/mempool.h @@ -6,7 +6,7 @@ #include -typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data); +typedef void * (mempool_alloc_t)(unsigned int __nocast gfp_mask, void *pool_data); typedef void (mempool_free_t)(void *element, void *pool_data); typedef struct mempool_s { @@ -26,16 +26,17 @@ extern mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn, extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn, mempool_free_t *free_fn, void *pool_data, int nid); -extern int mempool_resize(mempool_t *pool, int new_min_nr, gfp_t gfp_mask); +extern int mempool_resize(mempool_t *pool, int new_min_nr, + unsigned int __nocast gfp_mask); extern void mempool_destroy(mempool_t *pool); -extern void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask); +extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask); extern void mempool_free(void *element, mempool_t *pool); /* * A mempool_alloc_t and mempool_free_t that get the memory from * a slab that is passed in through pool_data. */ -void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data); +void *mempool_alloc_slab(unsigned int __nocast gfp_mask, void *pool_data); void mempool_free_slab(void *element, void *pool_data); #endif /* _LINUX_MEMPOOL_H */ diff --git a/trunk/include/linux/mod_devicetable.h b/trunk/include/linux/mod_devicetable.h index 2f0299a448f6..47da39ba3f03 100644 --- a/trunk/include/linux/mod_devicetable.h +++ b/trunk/include/linux/mod_devicetable.h @@ -183,7 +183,7 @@ struct of_device_id char name[32]; char type[32]; char compatible[128]; -#ifdef __KERNEL__ +#if __KERNEL__ void *data; #else kernel_ulong_t data; @@ -209,11 +209,10 @@ struct pcmcia_device_id { /* for real multi-function devices */ __u8 function; - /* for pseudo multi-function devices */ + /* for pseude multi-function devices */ __u8 device_no; - __u32 prod_id_hash[4] - __attribute__((aligned(sizeof(__u32)))); + __u32 prod_id_hash[4]; /* not matched against in kernelspace*/ #ifdef __KERNEL__ diff --git a/trunk/include/linux/netdevice.h b/trunk/include/linux/netdevice.h index 368e4c825ff1..7c717907896d 100644 --- a/trunk/include/linux/netdevice.h +++ b/trunk/include/linux/netdevice.h @@ -265,8 +265,6 @@ struct net_device * the interface. */ char name[IFNAMSIZ]; - /* device name hash chain */ - struct hlist_node name_hlist; /* * I/O specific fields @@ -294,21 +292,6 @@ struct net_device /* ------- Fields preinitialized in Space.c finish here ------- */ - /* Net device features */ - unsigned long features; -#define NETIF_F_SG 1 /* Scatter/gather IO. */ -#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */ -#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ -#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */ -#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */ -#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */ -#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */ -#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ -#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ -#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ -#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */ -#define NETIF_F_LLTX 4096 /* LockLess TX */ - struct net_device *next_sched; /* Interface index. Unique device identifier */ @@ -333,6 +316,9 @@ struct net_device * will (read: may be cleaned up at will). */ + /* These may be needed for future network-power-down code. */ + unsigned long trans_start; /* Time (in jiffies) of last Tx */ + unsigned long last_rx; /* Time of last Rx */ unsigned short flags; /* interface flags (a la BSD) */ unsigned short gflags; @@ -342,12 +328,15 @@ struct net_device unsigned mtu; /* interface MTU value */ unsigned short type; /* interface hardware type */ unsigned short hard_header_len; /* hardware hdr length */ + void *priv; /* pointer to private data */ struct net_device *master; /* Pointer to master device of a group, * which this device is member of. */ /* Interface address info. */ + unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ + unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ unsigned char addr_len; /* hardware address length */ unsigned short dev_id; /* for shared network cards */ @@ -357,6 +346,8 @@ struct net_device int promiscuity; int allmulti; + int watchdog_timeo; + struct timer_list watchdog_timer; /* Protocol specific pointers */ @@ -367,62 +358,32 @@ struct net_device void *ec_ptr; /* Econet specific data */ void *ax25_ptr; /* AX.25 specific data */ -/* - * Cache line mostly used on receive path (including eth_type_trans()) - */ - struct list_head poll_list ____cacheline_aligned_in_smp; - /* Link to poll list */ - - int (*poll) (struct net_device *dev, int *quota); + struct list_head poll_list; /* Link to poll list */ int quota; int weight; - unsigned long last_rx; /* Time of last Rx */ - /* Interface address info used in eth_type_trans() */ - unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast - because most packets are unicast) */ - - unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ -/* - * Cache line mostly used on queue transmit path (qdisc) - */ - /* device queue lock */ - spinlock_t queue_lock ____cacheline_aligned_in_smp; struct Qdisc *qdisc; struct Qdisc *qdisc_sleeping; + struct Qdisc *qdisc_ingress; struct list_head qdisc_list; unsigned long tx_queue_len; /* Max frames per queue allowed */ /* ingress path synchronizer */ spinlock_t ingress_lock; - struct Qdisc *qdisc_ingress; - -/* - * One part is mostly used on xmit path (device) - */ /* hard_start_xmit synchronizer */ - spinlock_t xmit_lock ____cacheline_aligned_in_smp; + spinlock_t xmit_lock; /* cpu id of processor entered to hard_start_xmit or -1, if nobody entered there. */ int xmit_lock_owner; - void *priv; /* pointer to private data */ - int (*hard_start_xmit) (struct sk_buff *skb, - struct net_device *dev); - /* These may be needed for future network-power-down code. */ - unsigned long trans_start; /* Time (in jiffies) of last Tx */ - - int watchdog_timeo; /* used by dev_watchdog() */ - struct timer_list watchdog_timer; - -/* - * refcnt is a very hot point, so align it on SMP - */ + /* device queue lock */ + spinlock_t queue_lock; /* Number of references to this device */ - atomic_t refcnt ____cacheline_aligned_in_smp; - + atomic_t refcnt; /* delayed register/unregister */ struct list_head todo_list; + /* device name hash chain */ + struct hlist_node name_hlist; /* device index hash chain */ struct hlist_node index_hlist; @@ -435,6 +396,21 @@ struct net_device NETREG_RELEASED, /* called free_netdev */ } reg_state; + /* Net device features */ + unsigned long features; +#define NETIF_F_SG 1 /* Scatter/gather IO. */ +#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */ +#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ +#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */ +#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */ +#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */ +#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */ +#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ +#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ +#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ +#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */ +#define NETIF_F_LLTX 4096 /* LockLess TX */ + /* Called after device is detached from network. */ void (*uninit)(struct net_device *dev); /* Called after last user reference disappears. */ @@ -443,7 +419,10 @@ struct net_device /* Pointers to interface service routines. */ int (*open)(struct net_device *dev); int (*stop)(struct net_device *dev); + int (*hard_start_xmit) (struct sk_buff *skb, + struct net_device *dev); #define HAVE_NETDEV_POLL + int (*poll) (struct net_device *dev, int *quota); int (*hard_header) (struct sk_buff *skb, struct net_device *dev, unsigned short type, diff --git a/trunk/include/linux/netfilter/nfnetlink.h b/trunk/include/linux/netfilter/nfnetlink.h index f08e870100f4..1d5b10ae2399 100644 --- a/trunk/include/linux/netfilter/nfnetlink.h +++ b/trunk/include/linux/netfilter/nfnetlink.h @@ -41,15 +41,11 @@ enum nfnetlink_groups { struct nfattr { u_int16_t nfa_len; - u_int16_t nfa_type; /* we use 15 bits for the type, and the highest - * bit to indicate whether the payload is nested */ + u_int16_t nfa_type; } __attribute__ ((packed)); -/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from - * rtnetlink.h, it's time to put this in a generic file */ - -#define NFNL_NFA_NEST 0x8000 -#define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) +/* FIXME: Shamelessly copy and pasted from rtnetlink.h, it's time + * to put this in a generic file */ #define NFA_ALIGNTO 4 #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) @@ -63,7 +59,7 @@ struct nfattr #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) #define NFA_NEST(skb, type) \ ({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \ - NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ + NFA_PUT(skb, type, 0, NULL); \ __start; }) #define NFA_NEST_END(skb, start) \ ({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ diff --git a/trunk/include/linux/netfilter/nfnetlink_conntrack.h b/trunk/include/linux/netfilter/nfnetlink_conntrack.h index 116fcaced909..5c55751c78e4 100644 --- a/trunk/include/linux/netfilter/nfnetlink_conntrack.h +++ b/trunk/include/linux/netfilter/nfnetlink_conntrack.h @@ -70,24 +70,15 @@ enum ctattr_l4proto { enum ctattr_protoinfo { CTA_PROTOINFO_UNSPEC, - CTA_PROTOINFO_TCP, + CTA_PROTOINFO_TCP_STATE, __CTA_PROTOINFO_MAX }; #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) -enum ctattr_protoinfo_tcp { - CTA_PROTOINFO_TCP_UNSPEC, - CTA_PROTOINFO_TCP_STATE, - __CTA_PROTOINFO_TCP_MAX -}; -#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) - enum ctattr_counters { CTA_COUNTERS_UNSPEC, - CTA_COUNTERS_PACKETS, /* old 64bit counters */ - CTA_COUNTERS_BYTES, /* old 64bit counters */ - CTA_COUNTERS32_PACKETS, - CTA_COUNTERS32_BYTES, + CTA_COUNTERS_PACKETS, + CTA_COUNTERS_BYTES, __CTA_COUNTERS_MAX }; #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) diff --git a/trunk/include/linux/netfilter_ipv4/ip_conntrack.h b/trunk/include/linux/netfilter_ipv4/ip_conntrack.h index d078bb91d9e5..4ced38736813 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/trunk/include/linux/netfilter_ipv4/ip_conntrack.h @@ -117,10 +117,6 @@ enum ip_conntrack_events /* NAT info */ IPCT_NATINFO_BIT = 10, IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), - - /* Counter highest bit has been set */ - IPCT_COUNTER_FILLING_BIT = 11, - IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), }; enum ip_conntrack_expect_events { @@ -196,8 +192,8 @@ do { \ struct ip_conntrack_counter { - u_int32_t packets; - u_int32_t bytes; + u_int64_t packets; + u_int64_t bytes; }; struct ip_conntrack_helper; diff --git a/trunk/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/trunk/include/linux/netfilter_ipv4/ip_conntrack_protocol.h index 2c76b879e3dc..b6b99be8632a 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_conntrack_protocol.h +++ b/trunk/include/linux/netfilter_ipv4/ip_conntrack_protocol.h @@ -52,9 +52,6 @@ struct ip_conntrack_protocol int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa, const struct ip_conntrack *ct); - /* convert nfnetlink attributes to protoinfo */ - int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct); - int (*tuple_to_nfattr)(struct sk_buff *skb, const struct ip_conntrack_tuple *t); int (*nfattr_to_tuple)(struct nfattr *tb[], diff --git a/trunk/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/trunk/include/linux/netfilter_ipv4/ip_conntrack_tuple.h index 3232db11a4e5..20e43f018b7c 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +++ b/trunk/include/linux/netfilter_ipv4/ip_conntrack_tuple.h @@ -1,8 +1,6 @@ #ifndef _IP_CONNTRACK_TUPLE_H #define _IP_CONNTRACK_TUPLE_H -#include - /* A `tuple' is a structure containing the information to uniquely identify a connection. ie. if two packets have the same tuple, they are in the same connection; if not, they are not. diff --git a/trunk/include/linux/netfilter_ipv4/ip_nat.h b/trunk/include/linux/netfilter_ipv4/ip_nat.h index 41a107de17cf..e201ec6e9905 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_nat.h +++ b/trunk/include/linux/netfilter_ipv4/ip_nat.h @@ -58,6 +58,10 @@ extern rwlock_t ip_nat_lock; struct ip_nat_info { struct list_head bysource; + + /* Helper (NULL if none). */ + struct ip_nat_helper *helper; + struct ip_nat_seq seq[IP_CT_DIR_MAX]; }; diff --git a/trunk/include/linux/netfilter_ipv4/ip_nat_core.h b/trunk/include/linux/netfilter_ipv4/ip_nat_core.h index 30db23f06b03..3b50eb91f007 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_nat_core.h +++ b/trunk/include/linux/netfilter_ipv4/ip_nat_core.h @@ -5,14 +5,16 @@ /* This header used to share core functionality between the standalone NAT module, and the compatibility layer's use of NAT for masquerading. */ +extern int ip_nat_init(void); +extern void ip_nat_cleanup(void); -extern unsigned int ip_nat_packet(struct ip_conntrack *ct, +extern unsigned int nat_packet(struct ip_conntrack *ct, enum ip_conntrack_info conntrackinfo, unsigned int hooknum, struct sk_buff **pskb); -extern int ip_nat_icmp_reply_translation(struct sk_buff **pskb, - struct ip_conntrack *ct, - enum ip_nat_manip_type manip, - enum ip_conntrack_dir dir); +extern int icmp_reply_translation(struct sk_buff **pskb, + struct ip_conntrack *ct, + enum ip_nat_manip_type manip, + enum ip_conntrack_dir dir); #endif /* _IP_NAT_CORE_H */ diff --git a/trunk/include/linux/netlink.h b/trunk/include/linux/netlink.h index ba25ca874c20..bdebdc564506 100644 --- a/trunk/include/linux/netlink.h +++ b/trunk/include/linux/netlink.h @@ -131,7 +131,7 @@ extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (* extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, - __u32 group, gfp_t allocation); + __u32 group, unsigned int __nocast allocation); extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); extern int netlink_register_notifier(struct notifier_block *nb); extern int netlink_unregister_notifier(struct notifier_block *nb); diff --git a/trunk/include/linux/netpoll.h b/trunk/include/linux/netpoll.h index ca5a8733000f..5ade54a78dbb 100644 --- a/trunk/include/linux/netpoll.h +++ b/trunk/include/linux/netpoll.h @@ -86,7 +86,7 @@ static inline void netpoll_poll_unlock(void *have) #else #define netpoll_rx(a) 0 -#define netpoll_poll_lock(a) NULL +#define netpoll_poll_lock(a) 0 #define netpoll_poll_unlock(a) #endif diff --git a/trunk/include/linux/pagemap.h b/trunk/include/linux/pagemap.h index acbf31c154f8..d9a25647a295 100644 --- a/trunk/include/linux/pagemap.h +++ b/trunk/include/linux/pagemap.h @@ -19,7 +19,7 @@ #define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ #define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ -static inline gfp_t mapping_gfp_mask(struct address_space * mapping) +static inline unsigned int __nocast mapping_gfp_mask(struct address_space * mapping) { return mapping->flags & __GFP_BITS_MASK; } diff --git a/trunk/include/linux/pci_ids.h b/trunk/include/linux/pci_ids.h index f74ed9462475..c49d28eca561 100644 --- a/trunk/include/linux/pci_ids.h +++ b/trunk/include/linux/pci_ids.h @@ -185,7 +185,6 @@ #define PCI_DEVICE_ID_LSI_61C102 0x0901 #define PCI_DEVICE_ID_LSI_63C815 0x1000 #define PCI_DEVICE_ID_LSI_SAS1064 0x0050 -#define PCI_DEVICE_ID_LSI_SAS1064R 0x0411 #define PCI_DEVICE_ID_LSI_SAS1066 0x005E #define PCI_DEVICE_ID_LSI_SAS1068 0x0054 #define PCI_DEVICE_ID_LSI_SAS1064A 0x005C @@ -393,7 +392,6 @@ #define PCI_DEVICE_ID_NS_87560_USB 0x0012 #define PCI_DEVICE_ID_NS_83815 0x0020 #define PCI_DEVICE_ID_NS_83820 0x0022 -#define PCI_DEVICE_ID_NS_SATURN 0x0035 #define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 #define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 #define PCI_DEVICE_ID_NS_SCx200_IDE 0x0502 @@ -561,7 +559,6 @@ #define PCI_VENDOR_ID_DELL 0x1028 #define PCI_DEVICE_ID_DELL_RACIII 0x0008 #define PCI_DEVICE_ID_DELL_RAC4 0x0012 -#define PCI_DEVICE_ID_DELL_PERC5 0x0015 #define PCI_VENDOR_ID_MATROX 0x102B #define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 @@ -772,8 +769,6 @@ #define PCI_DEVICE_ID_TI_TVP4010 0x3d04 #define PCI_DEVICE_ID_TI_TVP4020 0x3d07 #define PCI_DEVICE_ID_TI_4450 0x8011 -#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 -#define PCI_DEVICE_ID_TI_X515 0x8036 #define PCI_DEVICE_ID_TI_1130 0xac12 #define PCI_DEVICE_ID_TI_1031 0xac13 #define PCI_DEVICE_ID_TI_1131 0xac15 @@ -790,17 +785,12 @@ #define PCI_DEVICE_ID_TI_4451 0xac42 #define PCI_DEVICE_ID_TI_4510 0xac44 #define PCI_DEVICE_ID_TI_4520 0xac46 -#define PCI_DEVICE_ID_TI_7510 0xac47 -#define PCI_DEVICE_ID_TI_7610 0xac48 -#define PCI_DEVICE_ID_TI_7410 0xac49 #define PCI_DEVICE_ID_TI_1410 0xac50 #define PCI_DEVICE_ID_TI_1420 0xac51 #define PCI_DEVICE_ID_TI_1451A 0xac52 #define PCI_DEVICE_ID_TI_1620 0xac54 #define PCI_DEVICE_ID_TI_1520 0xac55 #define PCI_DEVICE_ID_TI_1510 0xac56 -#define PCI_DEVICE_ID_TI_X620 0xac8d -#define PCI_DEVICE_ID_TI_X420 0xac8e #define PCI_VENDOR_ID_SONY 0x104d #define PCI_DEVICE_ID_SONY_CXD3222 0x8039 @@ -986,7 +976,6 @@ #define PCI_DEVICE_ID_SUN_SABRE 0xa000 #define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001 #define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 -#define PCI_DEVICE_ID_SUN_CASSINI 0xabba #define PCI_VENDOR_ID_CMD 0x1095 #define PCI_DEVICE_ID_CMD_640 0x0640 @@ -1279,8 +1268,7 @@ #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x036F #define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 #define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 #define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B @@ -2198,12 +2186,7 @@ #define PCI_DEVICE_ID_ENE_1211 0x1211 #define PCI_DEVICE_ID_ENE_1225 0x1225 #define PCI_DEVICE_ID_ENE_1410 0x1410 -#define PCI_DEVICE_ID_ENE_710 0x1411 -#define PCI_DEVICE_ID_ENE_712 0x1412 #define PCI_DEVICE_ID_ENE_1420 0x1420 -#define PCI_DEVICE_ID_ENE_720 0x1421 -#define PCI_DEVICE_ID_ENE_722 0x1422 - #define PCI_VENDOR_ID_CHELSIO 0x1425 #define PCI_VENDOR_ID_MIPS 0x153f diff --git a/trunk/include/linux/posix_acl.h b/trunk/include/linux/posix_acl.h index 4bc241290c24..4caedddaa033 100644 --- a/trunk/include/linux/posix_acl.h +++ b/trunk/include/linux/posix_acl.h @@ -71,11 +71,11 @@ posix_acl_release(struct posix_acl *acl) /* posix_acl.c */ -extern struct posix_acl *posix_acl_alloc(int, gfp_t); -extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t); +extern struct posix_acl *posix_acl_alloc(int, unsigned int __nocast); +extern struct posix_acl *posix_acl_clone(const struct posix_acl *, unsigned int __nocast); extern int posix_acl_valid(const struct posix_acl *); extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); -extern struct posix_acl *posix_acl_from_mode(mode_t, gfp_t); +extern struct posix_acl *posix_acl_from_mode(mode_t, unsigned int __nocast); extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *); extern int posix_acl_create_masq(struct posix_acl *, mode_t *); extern int posix_acl_chmod_masq(struct posix_acl *, mode_t); diff --git a/trunk/include/linux/radix-tree.h b/trunk/include/linux/radix-tree.h index 045d4761febc..9c51917b1cce 100644 --- a/trunk/include/linux/radix-tree.h +++ b/trunk/include/linux/radix-tree.h @@ -50,7 +50,7 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long); unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, void **results, unsigned long first_index, unsigned int max_items); -int radix_tree_preload(gfp_t gfp_mask); +int radix_tree_preload(unsigned int __nocast gfp_mask); void radix_tree_init(void); void *radix_tree_tag_set(struct radix_tree_root *root, unsigned long index, int tag); diff --git a/trunk/include/linux/rcupdate.h b/trunk/include/linux/rcupdate.h index 70191a5a148f..4e65eb44adfd 100644 --- a/trunk/include/linux/rcupdate.h +++ b/trunk/include/linux/rcupdate.h @@ -94,7 +94,6 @@ struct rcu_data { long batch; /* Batch # for current RCU batch */ struct rcu_head *nxtlist; struct rcu_head **nxttail; - long count; /* # of queued items */ struct rcu_head *curlist; struct rcu_head **curtail; struct rcu_head *donelist; diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index 27519df0f987..49e617fa0f66 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -107,25 +107,13 @@ extern unsigned long nr_iowait(void); #include -/* - * Task state bitmask. NOTE! These bits are also - * encoded in fs/proc/array.c: get_task_state(). - * - * We have two separate sets of flags: task->state - * is about runnability, while task->exit_state are - * about the task exiting. Confusing, but this way - * modifying one set can't modify the other one by - * mistake. - */ #define TASK_RUNNING 0 #define TASK_INTERRUPTIBLE 1 #define TASK_UNINTERRUPTIBLE 2 #define TASK_STOPPED 4 #define TASK_TRACED 8 -/* in tsk->exit_state */ #define EXIT_ZOMBIE 16 #define EXIT_DEAD 32 -/* in tsk->state again */ #define TASK_NONINTERACTIVE 64 #define __set_task_state(tsk, state_value) \ @@ -1018,7 +1006,6 @@ extern int force_sig_info(int, struct siginfo *, struct task_struct *); extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); extern int kill_pg_info(int, struct siginfo *, pid_t); extern int kill_proc_info(int, struct siginfo *, pid_t); -extern int kill_proc_info_as_uid(int, struct siginfo *, pid_t, uid_t, uid_t); extern void do_notify_parent(struct task_struct *, int); extern void force_sig(int, struct task_struct *); extern void force_sig_specific(int, struct task_struct *); diff --git a/trunk/include/linux/security.h b/trunk/include/linux/security.h index 627382e74057..0e43460d374e 100644 --- a/trunk/include/linux/security.h +++ b/trunk/include/linux/security.h @@ -2634,7 +2634,8 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o return security_ops->socket_getpeersec(sock, optval, optlen, len); } -static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) +static inline int security_sk_alloc(struct sock *sk, int family, + unsigned int __nocast priority) { return security_ops->sk_alloc_security(sk, family, priority); } @@ -2751,7 +2752,8 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o return -ENOPROTOOPT; } -static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) +static inline int security_sk_alloc(struct sock *sk, int family, + unsigned int __nocast priority) { return 0; } diff --git a/trunk/include/linux/skbuff.h b/trunk/include/linux/skbuff.h index 8f5d9e7f8734..2741c0c55e83 100644 --- a/trunk/include/linux/skbuff.h +++ b/trunk/include/linux/skbuff.h @@ -155,6 +155,8 @@ struct skb_shared_info { #define SKB_DATAREF_SHIFT 16 #define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) +extern struct timeval skb_tv_base; + struct skb_timeval { u32 off_sec; u32 off_usec; @@ -173,7 +175,7 @@ enum { * @prev: Previous buffer in list * @list: List we are on * @sk: Socket we are owned by - * @tstamp: Time we arrived + * @tstamp: Time we arrived stored as offset to skb_tv_base * @dev: Device we arrived on/are leaving by * @input_dev: Device we arrived on * @h: Transport layer header @@ -302,37 +304,37 @@ struct sk_buff { extern void __kfree_skb(struct sk_buff *skb); extern struct sk_buff *__alloc_skb(unsigned int size, - gfp_t priority, int fclone); + unsigned int __nocast priority, int fclone); static inline struct sk_buff *alloc_skb(unsigned int size, - gfp_t priority) + unsigned int __nocast priority) { return __alloc_skb(size, priority, 0); } static inline struct sk_buff *alloc_skb_fclone(unsigned int size, - gfp_t priority) + unsigned int __nocast priority) { return __alloc_skb(size, priority, 1); } extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, unsigned int size, - gfp_t priority); + unsigned int __nocast priority); extern void kfree_skbmem(struct sk_buff *skb); extern struct sk_buff *skb_clone(struct sk_buff *skb, - gfp_t priority); + unsigned int __nocast priority); extern struct sk_buff *skb_copy(const struct sk_buff *skb, - gfp_t priority); + unsigned int __nocast priority); extern struct sk_buff *pskb_copy(struct sk_buff *skb, - gfp_t gfp_mask); + unsigned int __nocast gfp_mask); extern int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, - gfp_t gfp_mask); + unsigned int __nocast gfp_mask); extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom); extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom, int newtailroom, - gfp_t priority); + unsigned int __nocast priority); extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); #define dev_kfree_skb(a) kfree_skb(a) extern void skb_over_panic(struct sk_buff *skb, int len, @@ -484,7 +486,7 @@ static inline int skb_shared(const struct sk_buff *skb) * NULL is returned on a memory allocation failure. */ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, - gfp_t pri) + unsigned int __nocast pri) { might_sleep_if(pri & __GFP_WAIT); if (skb_shared(skb)) { @@ -516,7 +518,7 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, * %NULL is returned on a memory allocation failure. */ static inline struct sk_buff *skb_unshare(struct sk_buff *skb, - gfp_t pri) + unsigned int __nocast pri) { might_sleep_if(pri & __GFP_WAIT); if (skb_cloned(skb)) { @@ -1017,7 +1019,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list) * %NULL is returned in there is no free memory. */ static inline struct sk_buff *__dev_alloc_skb(unsigned int length, - gfp_t gfp_mask) + unsigned int __nocast gfp_mask) { struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); if (likely(skb)) @@ -1130,8 +1132,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i, * If there is no free memory -ENOMEM is returned, otherwise zero * is returned and the old skb data released. */ -extern int __skb_linearize(struct sk_buff *skb, gfp_t gfp); -static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp) +extern int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp); +static inline int skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp) { return __skb_linearize(skb, gfp); } @@ -1253,6 +1255,10 @@ static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval * { stamp->tv_sec = skb->tstamp.off_sec; stamp->tv_usec = skb->tstamp.off_usec; + if (skb->tstamp.off_sec) { + stamp->tv_sec += skb_tv_base.tv_sec; + stamp->tv_usec += skb_tv_base.tv_usec; + } } /** @@ -1266,8 +1272,8 @@ static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval * */ static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp) { - skb->tstamp.off_sec = stamp->tv_sec; - skb->tstamp.off_usec = stamp->tv_usec; + skb->tstamp.off_sec = stamp->tv_sec - skb_tv_base.tv_sec; + skb->tstamp.off_usec = stamp->tv_usec - skb_tv_base.tv_usec; } extern void __net_timestamp(struct sk_buff *skb); diff --git a/trunk/include/linux/slab.h b/trunk/include/linux/slab.h index 5fc04a16ecb0..1f356f3bbc64 100644 --- a/trunk/include/linux/slab.h +++ b/trunk/include/linux/slab.h @@ -61,11 +61,11 @@ extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned lo void (*)(void *, kmem_cache_t *, unsigned long)); extern int kmem_cache_destroy(kmem_cache_t *); extern int kmem_cache_shrink(kmem_cache_t *); -extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); +extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast); extern void kmem_cache_free(kmem_cache_t *, void *); extern unsigned int kmem_cache_size(kmem_cache_t *); extern const char *kmem_cache_name(kmem_cache_t *); -extern kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags); +extern kmem_cache_t *kmem_find_general_cachep(size_t size, unsigned int __nocast gfpflags); /* Size description struct for general caches. */ struct cache_sizes { @@ -74,9 +74,9 @@ struct cache_sizes { kmem_cache_t *cs_dmacachep; }; extern struct cache_sizes malloc_sizes[]; -extern void *__kmalloc(size_t, gfp_t); +extern void *__kmalloc(size_t, unsigned int __nocast); -static inline void *kmalloc(size_t size, gfp_t flags) +static inline void *kmalloc(size_t size, unsigned int __nocast flags) { if (__builtin_constant_p(size)) { int i = 0; @@ -99,7 +99,7 @@ static inline void *kmalloc(size_t size, gfp_t flags) return __kmalloc(size, flags); } -extern void *kzalloc(size_t, gfp_t); +extern void *kzalloc(size_t, unsigned int __nocast); /** * kcalloc - allocate memory for an array. The memory is set to zero. @@ -107,7 +107,7 @@ extern void *kzalloc(size_t, gfp_t); * @size: element size. * @flags: the type of memory to allocate. */ -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) +static inline void *kcalloc(size_t n, size_t size, unsigned int __nocast flags) { if (n != 0 && size > INT_MAX / n) return NULL; @@ -118,14 +118,15 @@ extern void kfree(const void *); extern unsigned int ksize(const void *); #ifdef CONFIG_NUMA -extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); -extern void *kmalloc_node(size_t size, gfp_t flags, int node); +extern void *kmem_cache_alloc_node(kmem_cache_t *, + unsigned int __nocast flags, int node); +extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node); #else static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) { return kmem_cache_alloc(cachep, flags); } -static inline void *kmalloc_node(size_t size, gfp_t flags, int node) +static inline void *kmalloc_node(size_t size, unsigned int __nocast flags, int node) { return kmalloc(size, flags); } diff --git a/trunk/include/linux/string.h b/trunk/include/linux/string.h index 369be3264a55..dab2652acbd8 100644 --- a/trunk/include/linux/string.h +++ b/trunk/include/linux/string.h @@ -88,7 +88,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t); extern void * memchr(const void *,int,__kernel_size_t); #endif -extern char *kstrdup(const char *s, gfp_t gfp); +extern char *kstrdup(const char *s, unsigned int __nocast gfp); #ifdef __cplusplus } diff --git a/trunk/include/linux/suspend.h b/trunk/include/linux/suspend.h index ad15a54806d8..f2e96fdfaae0 100644 --- a/trunk/include/linux/suspend.h +++ b/trunk/include/linux/suspend.h @@ -71,7 +71,5 @@ void restore_processor_state(void); struct saved_context; void __save_processor_state(struct saved_context *ctxt); void __restore_processor_state(struct saved_context *ctxt); -extern unsigned long get_usable_page(unsigned gfp_mask); -extern void free_eaten_memory(void); #endif /* _LINUX_SWSUSP_H */ diff --git a/trunk/include/linux/swap.h b/trunk/include/linux/swap.h index a7bf1a3b1496..3c9ff0048153 100644 --- a/trunk/include/linux/swap.h +++ b/trunk/include/linux/swap.h @@ -147,7 +147,7 @@ struct swap_list_t { #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) /* linux/mm/oom_kill.c */ -extern void out_of_memory(gfp_t gfp_mask, int order); +extern void out_of_memory(unsigned int __nocast gfp_mask, int order); /* linux/mm/memory.c */ extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); diff --git a/trunk/include/linux/sysctl.h b/trunk/include/linux/sysctl.h index fc8e367f671e..3a29a9f9b451 100644 --- a/trunk/include/linux/sysctl.h +++ b/trunk/include/linux/sysctl.h @@ -202,8 +202,7 @@ enum NET_TR=14, NET_DECNET=15, NET_ECONET=16, - NET_SCTP=17, - NET_LLC=18, + NET_SCTP=17, }; /* /proc/sys/kernel/random */ @@ -523,29 +522,6 @@ enum { NET_IPX_FORWARDING=2 }; -/* /proc/sys/net/llc */ -enum { - NET_LLC2=1, - NET_LLC_STATION=2, -}; - -/* /proc/sys/net/llc/llc2 */ -enum { - NET_LLC2_TIMEOUT=1, -}; - -/* /proc/sys/net/llc/station */ -enum { - NET_LLC_STATION_ACK_TIMEOUT=1, -}; - -/* /proc/sys/net/llc/llc2/timeout */ -enum { - NET_LLC2_ACK_TIMEOUT=1, - NET_LLC2_P_TIMEOUT=2, - NET_LLC2_REJ_TIMEOUT=3, - NET_LLC2_BUSY_TIMEOUT=4, -}; /* /proc/sys/net/appletalk */ enum { diff --git a/trunk/include/linux/tc_ematch/tc_em_meta.h b/trunk/include/linux/tc_ematch/tc_em_meta.h index e21937cf91d0..081b1ee8516e 100644 --- a/trunk/include/linux/tc_ematch/tc_em_meta.h +++ b/trunk/include/linux/tc_ematch/tc_em_meta.h @@ -71,7 +71,7 @@ enum TCF_META_ID_SK_SNDBUF, TCF_META_ID_SK_ALLOCS, TCF_META_ID_SK_ROUTE_CAPS, - TCF_META_ID_SK_HASH, + TCF_META_ID_SK_HASHENT, TCF_META_ID_SK_LINGERTIME, TCF_META_ID_SK_ACK_BACKLOG, TCF_META_ID_SK_MAX_ACK_BACKLOG, diff --git a/trunk/include/linux/textsearch.h b/trunk/include/linux/textsearch.h index 515046d1b2f4..941f45ac117a 100644 --- a/trunk/include/linux/textsearch.h +++ b/trunk/include/linux/textsearch.h @@ -158,8 +158,7 @@ extern unsigned int textsearch_find_continuous(struct ts_config *, #define TS_PRIV_ALIGNTO 8 #define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) -static inline struct ts_config *alloc_ts_config(size_t payload, - gfp_t gfp_mask) +static inline struct ts_config *alloc_ts_config(size_t payload, int gfp_mask) { struct ts_config *conf; diff --git a/trunk/include/linux/types.h b/trunk/include/linux/types.h index 0aee34f9da9f..2b678c22ca4a 100644 --- a/trunk/include/linux/types.h +++ b/trunk/include/linux/types.h @@ -165,10 +165,6 @@ typedef __u64 __bitwise __le64; typedef __u64 __bitwise __be64; #endif -#ifdef __KERNEL__ -typedef unsigned __nocast gfp_t; -#endif - struct ustat { __kernel_daddr_t f_tfree; __kernel_ino_t f_tinode; diff --git a/trunk/include/linux/vmalloc.h b/trunk/include/linux/vmalloc.h index 3701a0673d2c..b244f69ef682 100644 --- a/trunk/include/linux/vmalloc.h +++ b/trunk/include/linux/vmalloc.h @@ -34,8 +34,8 @@ struct vm_struct { extern void *vmalloc(unsigned long size); extern void *vmalloc_exec(unsigned long size); extern void *vmalloc_32(unsigned long size); -extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); -extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot); +extern void *__vmalloc(unsigned long size, unsigned int __nocast gfp_mask, pgprot_t prot); +extern void *__vmalloc_area(struct vm_struct *area, unsigned int __nocast gfp_mask, pgprot_t prot); extern void vfree(void *addr); extern void *vmap(struct page **pages, unsigned int count, diff --git a/trunk/include/net/bluetooth/bluetooth.h b/trunk/include/net/bluetooth/bluetooth.h index 210458624840..6dfa4a61ffd0 100644 --- a/trunk/include/net/bluetooth/bluetooth.h +++ b/trunk/include/net/bluetooth/bluetooth.h @@ -136,7 +136,7 @@ struct bt_skb_cb { }; #define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) -static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how) +static inline struct sk_buff *bt_skb_alloc(unsigned int len, unsigned int __nocast how) { struct sk_buff *skb; diff --git a/trunk/include/net/bluetooth/rfcomm.h b/trunk/include/net/bluetooth/rfcomm.h index fbe557f7ea1d..ffea9d54071f 100644 --- a/trunk/include/net/bluetooth/rfcomm.h +++ b/trunk/include/net/bluetooth/rfcomm.h @@ -230,7 +230,7 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, u8 xon_char, u8 xoff_char, u16 param_mask); /* ---- RFCOMM DLCs (channels) ---- */ -struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio); +struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio); void rfcomm_dlc_free(struct rfcomm_dlc *d); int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel); int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); diff --git a/trunk/include/net/dn_nsp.h b/trunk/include/net/dn_nsp.h index 1ba03be0af3a..6bbeafa73e8b 100644 --- a/trunk/include/net/dn_nsp.h +++ b/trunk/include/net/dn_nsp.h @@ -19,9 +19,9 @@ extern void dn_nsp_send_data_ack(struct sock *sk); extern void dn_nsp_send_oth_ack(struct sock *sk); extern void dn_nsp_delayed_ack(struct sock *sk); extern void dn_send_conn_ack(struct sock *sk); -extern void dn_send_conn_conf(struct sock *sk, gfp_t gfp); +extern void dn_send_conn_conf(struct sock *sk, int gfp); extern void dn_nsp_send_disc(struct sock *sk, unsigned char type, - unsigned short reason, gfp_t gfp); + unsigned short reason, int gfp); extern void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type, unsigned short reason); extern 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); extern void dn_nsp_output(struct sock *sk); extern int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum); -extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp, int oob); +extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, int gfp, int oob); extern unsigned long dn_nsp_persist(struct sock *sk); extern int dn_nsp_xmit_timeout(struct sock *sk); extern int dn_nsp_rx(struct sk_buff *); extern int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb); -extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); +extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri); extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock, long timeo, int *err); #define NSP_REASON_OK 0 /* No error */ diff --git a/trunk/include/net/dn_route.h b/trunk/include/net/dn_route.h index 5122da3f2eb3..d084721db198 100644 --- a/trunk/include/net/dn_route.h +++ b/trunk/include/net/dn_route.h @@ -15,7 +15,7 @@ GNU General Public License for more details. *******************************************************************************/ -extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); +extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri); extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); diff --git a/trunk/include/net/inet6_hashtables.h b/trunk/include/net/inet6_hashtables.h index 5a2beed5a770..03df3b157960 100644 --- a/trunk/include/net/inet6_hashtables.h +++ b/trunk/include/net/inet6_hashtables.h @@ -26,18 +26,19 @@ struct inet_hashinfo; /* I have no idea if this is a good hash for v6 or not. -DaveM */ -static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, - const struct in6_addr *faddr, const u16 fport) +static inline int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, + const struct in6_addr *faddr, const u16 fport, + const int ehash_size) { - unsigned int hashent = (lport ^ fport); + int hashent = (lport ^ fport); hashent ^= (laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); hashent ^= hashent >> 16; hashent ^= hashent >> 8; - return hashent; + return (hashent & (ehash_size - 1)); } -static inline int inet6_sk_ehashfn(const struct sock *sk) +static inline int inet6_sk_ehashfn(const struct sock *sk, const int ehash_size) { const struct inet_sock *inet = inet_sk(sk); const struct ipv6_pinfo *np = inet6_sk(sk); @@ -45,7 +46,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk) const struct in6_addr *faddr = &np->daddr; const __u16 lport = inet->num; const __u16 fport = inet->dport; - return inet6_ehashfn(laddr, lport, faddr, fport); + return inet6_ehashfn(laddr, lport, faddr, fport, ehash_size); } /* @@ -68,14 +69,14 @@ static inline struct sock * /* Optimize here for direct hit, only listening connections can * have wildcards anyways. */ - unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport); - struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); + const int hash = inet6_ehashfn(daddr, hnum, saddr, sport, + hashinfo->ehash_size); + struct inet_ehash_bucket *head = &hashinfo->ehash[hash]; - prefetch(head->chain.first); read_lock(&head->lock); sk_for_each(sk, node, &head->chain) { /* For IPV6 do the cheaper port and family tests first. */ - if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif)) + if (INET6_MATCH(sk, saddr, daddr, ports, dif)) goto hit; /* You sunk my battleship! */ } /* Must check for a TIME_WAIT'er before going to listener hash. */ diff --git a/trunk/include/net/inet_connection_sock.h b/trunk/include/net/inet_connection_sock.h index b0c99060b78d..651f824c1008 100644 --- a/trunk/include/net/inet_connection_sock.h +++ b/trunk/include/net/inet_connection_sock.h @@ -94,7 +94,7 @@ static inline void *inet_csk_ca(const struct sock *sk) extern struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req, - const gfp_t priority); + const unsigned int __nocast priority); enum inet_csk_ack_state_t { ICSK_ACK_SCHED = 1, diff --git a/trunk/include/net/inet_hashtables.h b/trunk/include/net/inet_hashtables.h index f50f95968340..646b6ea7fe26 100644 --- a/trunk/include/net/inet_hashtables.h +++ b/trunk/include/net/inet_hashtables.h @@ -40,7 +40,7 @@ struct inet_ehash_bucket { rwlock_t lock; struct hlist_head chain; -}; +} __attribute__((__aligned__(8))); /* There are a few simple rules, which allow for local port reuse by * an application. In essence: @@ -108,7 +108,7 @@ struct inet_hashinfo { struct inet_bind_hashbucket *bhash; int bhash_size; - unsigned int ehash_size; + int ehash_size; /* All sockets in TCP_LISTEN state will be in here. This is the only * table where wildcard'd TCP sockets can exist. Hash function here @@ -130,16 +130,17 @@ struct inet_hashinfo { int port_rover; }; -static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, - const __u32 faddr, const __u16 fport) +static inline int inet_ehashfn(const __u32 laddr, const __u16 lport, + const __u32 faddr, const __u16 fport, + const int ehash_size) { - unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); + int h = (laddr ^ lport) ^ (faddr ^ fport); h ^= h >> 16; h ^= h >> 8; - return h; + return h & (ehash_size - 1); } -static inline int inet_sk_ehashfn(const struct sock *sk) +static inline int inet_sk_ehashfn(const struct sock *sk, const int ehash_size) { const struct inet_sock *inet = inet_sk(sk); const __u32 laddr = inet->rcv_saddr; @@ -147,14 +148,7 @@ static inline int inet_sk_ehashfn(const struct sock *sk) const __u32 faddr = inet->daddr; const __u16 fport = inet->dport; - return inet_ehashfn(laddr, lport, faddr, fport); -} - -static inline struct inet_ehash_bucket *inet_ehash_bucket( - struct inet_hashinfo *hashinfo, - unsigned int hash) -{ - return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; + return inet_ehashfn(laddr, lport, faddr, fport, ehash_size); } extern struct inet_bind_bucket * @@ -241,11 +235,9 @@ static inline void __inet_hash(struct inet_hashinfo *hashinfo, lock = &hashinfo->lhash_lock; inet_listen_wlock(hashinfo); } else { - struct inet_ehash_bucket *head; - sk->sk_hash = inet_sk_ehashfn(sk); - head = inet_ehash_bucket(hashinfo, sk->sk_hash); - list = &head->chain; - lock = &head->lock; + sk->sk_hashent = inet_sk_ehashfn(sk, hashinfo->ehash_size); + list = &hashinfo->ehash[sk->sk_hashent].chain; + lock = &hashinfo->ehash[sk->sk_hashent].lock; write_lock(lock); } __sk_add_node(sk, list); @@ -276,8 +268,9 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk) inet_listen_wlock(hashinfo); lock = &hashinfo->lhash_lock; } else { - lock = &inet_ehash_bucket(hashinfo, sk->sk_hash)->lock; - write_lock_bh(lock); + struct inet_ehash_bucket *head = &hashinfo->ehash[sk->sk_hashent]; + lock = &head->lock; + write_lock_bh(&head->lock); } if (__sk_del_node_init(sk)) @@ -344,27 +337,23 @@ static inline struct sock * #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr)); #endif /* __BIG_ENDIAN */ -#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ - (((__sk)->sk_hash == (__hash)) && \ - ((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ +#define INET_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\ + (((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) -#define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ - (((__sk)->sk_hash == (__hash)) && \ - ((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ +#define INET_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\ + (((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) #else /* 32-bit arch */ #define INET_ADDR_COOKIE(__name, __saddr, __daddr) -#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ - (((__sk)->sk_hash == (__hash)) && \ - (inet_sk(__sk)->daddr == (__saddr)) && \ +#define INET_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif) \ + ((inet_sk(__sk)->daddr == (__saddr)) && \ (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) -#define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ - (((__sk)->sk_hash == (__hash)) && \ - (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ +#define INET_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif) \ + ((inet_twsk(__sk)->tw_daddr == (__saddr)) && \ (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) @@ -389,19 +378,18 @@ static inline struct sock * /* Optimize here for direct hit, only listening connections can * have wildcards anyways. */ - unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); - struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); + const int hash = inet_ehashfn(daddr, hnum, saddr, sport, hashinfo->ehash_size); + struct inet_ehash_bucket *head = &hashinfo->ehash[hash]; - prefetch(head->chain.first); read_lock(&head->lock); sk_for_each(sk, node, &head->chain) { - if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) + if (INET_MATCH(sk, acookie, saddr, daddr, ports, dif)) goto hit; /* You sunk my battleship! */ } /* Must check for a TIME_WAIT'er before going to listener hash. */ sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) { - if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) + if (INET_TW_MATCH(sk, acookie, saddr, daddr, ports, dif)) goto hit; } sk = NULL; diff --git a/trunk/include/net/inet_timewait_sock.h b/trunk/include/net/inet_timewait_sock.h index 28f7b2103505..3b070352e869 100644 --- a/trunk/include/net/inet_timewait_sock.h +++ b/trunk/include/net/inet_timewait_sock.h @@ -19,7 +19,6 @@ #include #include -#include #include #include #include @@ -113,7 +112,6 @@ struct inet_timewait_sock { #define tw_node __tw_common.skc_node #define tw_bind_node __tw_common.skc_bind_node #define tw_refcnt __tw_common.skc_refcnt -#define tw_hash __tw_common.skc_hash #define tw_prot __tw_common.skc_prot volatile unsigned char tw_substate; /* 3 bits hole, try to pack */ @@ -128,6 +126,7 @@ struct inet_timewait_sock { /* And these are ours. */ __u8 tw_ipv6only:1; /* 31 bits hole, try to pack */ + int tw_hashent; int tw_timeout; unsigned long tw_ttd; struct inet_bind_bucket *tw_tb; @@ -194,13 +193,11 @@ static inline u32 inet_rcv_saddr(const struct sock *sk) static inline void inet_twsk_put(struct inet_timewait_sock *tw) { if (atomic_dec_and_test(&tw->tw_refcnt)) { - struct module *owner = tw->tw_prot->owner; #ifdef SOCK_REFCNT_DEBUG printk(KERN_DEBUG "%s timewait_sock %p released\n", tw->tw_prot->name, tw); #endif kmem_cache_free(tw->tw_prot->twsk_slab, tw); - module_put(owner); } } diff --git a/trunk/include/net/ip_vs.h b/trunk/include/net/ip_vs.h index 3b5559a023a4..06b4235aa016 100644 --- a/trunk/include/net/ip_vs.h +++ b/trunk/include/net/ip_vs.h @@ -832,7 +832,7 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc); extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff **pskb); extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff **pskb); -extern int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, +extern int ip_vs_skb_replace(struct sk_buff *skb, int pri, char *o_buf, int o_len, char *n_buf, int n_len); extern int ip_vs_app_init(void); extern void ip_vs_app_cleanup(void); diff --git a/trunk/include/net/llc.h b/trunk/include/net/llc.h index 1adb2ef3f6f7..71769a5aeef3 100644 --- a/trunk/include/net/llc.h +++ b/trunk/include/net/llc.h @@ -17,8 +17,6 @@ #include #include -#include - struct net_device; struct packet_type; struct sk_buff; @@ -46,7 +44,6 @@ struct llc_sap { unsigned char state; unsigned char p_bit; unsigned char f_bit; - atomic_t refcnt; int (*rcv_func)(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, @@ -84,27 +81,13 @@ extern struct llc_sap *llc_sap_open(unsigned char lsap, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)); -static inline void llc_sap_hold(struct llc_sap *sap) -{ - atomic_inc(&sap->refcnt); -} - extern void llc_sap_close(struct llc_sap *sap); -static inline void llc_sap_put(struct llc_sap *sap) -{ - if (atomic_dec_and_test(&sap->refcnt)) - llc_sap_close(sap); -} - extern struct llc_sap *llc_sap_find(unsigned char sap_value); extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, unsigned char *dmac, unsigned char dsap); -extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb); -extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb); - extern int llc_station_init(void); extern void llc_station_exit(void); @@ -115,17 +98,4 @@ extern void llc_proc_exit(void); #define llc_proc_init() (0) #define llc_proc_exit() do { } while(0) #endif /* CONFIG_PROC_FS */ -#ifdef CONFIG_SYSCTL -extern int llc_sysctl_init(void); -extern void llc_sysctl_exit(void); - -extern int sysctl_llc2_ack_timeout; -extern int sysctl_llc2_busy_timeout; -extern int sysctl_llc2_p_timeout; -extern int sysctl_llc2_rej_timeout; -extern int sysctl_llc_station_ack_timeout; -#else -#define llc_sysctl_init() (0) -#define llc_sysctl_exit() do { } while(0) -#endif /* CONFIG_SYSCTL */ #endif /* LLC_H */ diff --git a/trunk/include/net/llc_conn.h b/trunk/include/net/llc_conn.h index 00730d21b522..8ad3bc2c23d7 100644 --- a/trunk/include/net/llc_conn.h +++ b/trunk/include/net/llc_conn.h @@ -19,14 +19,14 @@ #define LLC_EVENT 1 #define LLC_PACKET 2 -#define LLC2_P_TIME 2 -#define LLC2_ACK_TIME 1 -#define LLC2_REJ_TIME 3 -#define LLC2_BUSY_TIME 3 +#define LLC_P_TIME 2 +#define LLC_ACK_TIME 1 +#define LLC_REJ_TIME 3 +#define LLC_BUSY_TIME 3 struct llc_timer { struct timer_list timer; - unsigned long expire; /* timer expire time */ + u16 expire; /* timer expire time */ }; struct llc_sock { @@ -38,7 +38,6 @@ struct llc_sock { struct llc_addr laddr; /* lsap/mac pair */ struct llc_addr daddr; /* dsap/mac pair */ struct net_device *dev; /* device to send to remote */ - u32 copied_seq; /* head of yet unread data */ u8 retry_count; /* number of retries */ u8 ack_must_be_send; u8 first_pdu_Ns; @@ -93,8 +92,7 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb) return skb->cb[sizeof(skb->cb) - 1]; } -extern struct sock *llc_sk_alloc(int family, gfp_t priority, - struct proto *prot); +extern struct sock *llc_sk_alloc(int family, int priority, struct proto *prot); extern void llc_sk_free(struct sock *sk); extern void llc_sk_reset(struct sock *sk); @@ -117,4 +115,5 @@ extern void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk); extern u8 llc_data_accept_state(u8 state); extern void llc_build_offset_table(void); +extern int llc_release_sockets(struct llc_sap *sap); #endif /* LLC_CONN_H */ diff --git a/trunk/include/net/llc_sap.h b/trunk/include/net/llc_sap.h index 2c56dbece729..353baaa627f3 100644 --- a/trunk/include/net/llc_sap.h +++ b/trunk/include/net/llc_sap.h @@ -12,15 +12,11 @@ * See the GNU General Public License for more details. */ struct llc_sap; -struct net_device; struct sk_buff; -struct sock; extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb); -extern void llc_save_primitive(struct sock *sk, struct sk_buff* skb, - unsigned char prim); -extern struct sk_buff *llc_alloc_frame(struct sock *sk, - struct net_device *dev); +extern void llc_save_primitive(struct sk_buff* skb, unsigned char prim); +extern struct sk_buff *llc_alloc_frame(void); extern void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb, diff --git a/trunk/include/net/sctp/sctp.h b/trunk/include/net/sctp/sctp.h index 8f241216f46b..e1d5ec1c23c0 100644 --- a/trunk/include/net/sctp/sctp.h +++ b/trunk/include/net/sctp/sctp.h @@ -125,7 +125,7 @@ */ extern struct sock *sctp_get_ctl_sock(void); extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, - sctp_scope_t, gfp_t gfp, + sctp_scope_t, unsigned int __nocast gfp, int flags); extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); extern int sctp_register_pf(struct sctp_pf *, sa_family_t); diff --git a/trunk/include/net/sctp/sm.h b/trunk/include/net/sctp/sm.h index 1eac3d0eb7a9..58462164d960 100644 --- a/trunk/include/net/sctp/sm.h +++ b/trunk/include/net/sctp/sm.h @@ -181,17 +181,17 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t, int sctp_chunk_iif(const struct sctp_chunk *); struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *, struct sctp_chunk *, - gfp_t gfp); + unsigned int __nocast gfp); __u32 sctp_generate_verification_tag(void); void sctp_populate_tie_tags(__u8 *cookie, __u32 curTag, __u32 hisTag); /* Prototypes for chunk-building functions. */ struct sctp_chunk *sctp_make_init(const struct sctp_association *, const struct sctp_bind_addr *, - gfp_t gfp, int vparam_len); + unsigned int __nocast gfp, int vparam_len); struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *, const struct sctp_chunk *, - const gfp_t gfp, + const unsigned int __nocast gfp, const int unkparam_len); struct sctp_chunk *sctp_make_cookie_echo(const struct sctp_association *, const struct sctp_chunk *); @@ -265,7 +265,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, struct sctp_endpoint *, struct sctp_association *asoc, void *event_arg, - gfp_t gfp); + unsigned int __nocast gfp); /* 2nd level prototypes */ void sctp_generate_t3_rtx_event(unsigned long peer); @@ -276,7 +276,7 @@ void sctp_ootb_pkt_free(struct sctp_packet *); struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *, const struct sctp_association *, struct sctp_chunk *, - gfp_t gfp, int *err, + unsigned int __nocast gfp, int *err, struct sctp_chunk **err_chk_p); int sctp_addip_addr_config(struct sctp_association *, sctp_param_t, struct sockaddr_storage*, int); diff --git a/trunk/include/net/sctp/structs.h b/trunk/include/net/sctp/structs.h index 9c385b6417c7..994009bbe3b4 100644 --- a/trunk/include/net/sctp/structs.h +++ b/trunk/include/net/sctp/structs.h @@ -446,7 +446,7 @@ struct sctp_ssnmap { }; struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, - gfp_t gfp); + unsigned int __nocast gfp); void sctp_ssnmap_free(struct sctp_ssnmap *map); void sctp_ssnmap_clear(struct sctp_ssnmap *map); @@ -947,7 +947,7 @@ struct sctp_transport { }; struct sctp_transport *sctp_transport_new(const union sctp_addr *, - gfp_t); + unsigned int __nocast); void sctp_transport_set_owner(struct sctp_transport *, struct sctp_association *); void sctp_transport_route(struct sctp_transport *, union sctp_addr *, @@ -1095,10 +1095,10 @@ void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); void sctp_bind_addr_free(struct sctp_bind_addr *); int sctp_bind_addr_copy(struct sctp_bind_addr *dest, const struct sctp_bind_addr *src, - sctp_scope_t scope, gfp_t gfp, + sctp_scope_t scope, unsigned int __nocast gfp, int flags); int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, - gfp_t gfp); + unsigned int __nocast gfp); int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, struct sctp_sock *); @@ -1108,9 +1108,9 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, struct sctp_sock *opt); union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, int *addrs_len, - gfp_t gfp); + unsigned int __nocast gfp); int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len, - __u16 port, gfp_t gfp); + __u16 port, unsigned int __nocast gfp); sctp_scope_t sctp_scope(const union sctp_addr *); int 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) } /* These are function signatures for manipulating endpoints. */ -struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t); +struct sctp_endpoint *sctp_endpoint_new(struct sock *, unsigned int __nocast); void sctp_endpoint_free(struct sctp_endpoint *); void sctp_endpoint_put(struct sctp_endpoint *); void sctp_endpoint_hold(struct sctp_endpoint *); @@ -1260,7 +1260,7 @@ int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, struct sctp_chunk **err_chunk); int sctp_process_init(struct sctp_association *, sctp_cid_t cid, const union sctp_addr *peer, - sctp_init_chunk_t *init, gfp_t gfp); + sctp_init_chunk_t *init, unsigned int __nocast gfp); __u32 sctp_generate_tag(const struct sctp_endpoint *); __u32 sctp_generate_tsn(const struct sctp_endpoint *); @@ -1723,7 +1723,7 @@ static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base) struct sctp_association * sctp_association_new(const struct sctp_endpoint *, const struct sock *, - sctp_scope_t scope, gfp_t gfp); + sctp_scope_t scope, unsigned int __nocast gfp); void sctp_association_free(struct sctp_association *); void sctp_association_put(struct sctp_association *); void sctp_association_hold(struct sctp_association *); @@ -1739,7 +1739,7 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc, const union sctp_addr *laddr); struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, const union sctp_addr *address, - const gfp_t gfp, + const unsigned int __nocast gfp, const int peer_state); void sctp_assoc_del_peer(struct sctp_association *asoc, const union sctp_addr *addr); @@ -1764,10 +1764,10 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); void sctp_assoc_set_primary(struct sctp_association *, struct sctp_transport *); int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, - gfp_t); + unsigned int __nocast); int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, struct sctp_cookie*, - gfp_t gfp); + unsigned int __nocast gfp); int sctp_cmp_addr_exact(const union sctp_addr *ss1, const union sctp_addr *ss2); diff --git a/trunk/include/net/sctp/ulpevent.h b/trunk/include/net/sctp/ulpevent.h index 6c40cfc4832d..90fe4bf6754f 100644 --- a/trunk/include/net/sctp/ulpevent.h +++ b/trunk/include/net/sctp/ulpevent.h @@ -88,7 +88,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( __u16 error, __u16 outbound, __u16 inbound, - gfp_t gfp); + unsigned int __nocast gfp); struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( const struct sctp_association *asoc, @@ -96,35 +96,35 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( int flags, int state, int error, - gfp_t gfp); + unsigned int __nocast gfp); struct sctp_ulpevent *sctp_ulpevent_make_remote_error( const struct sctp_association *asoc, struct sctp_chunk *chunk, __u16 flags, - gfp_t gfp); + unsigned int __nocast gfp); struct sctp_ulpevent *sctp_ulpevent_make_send_failed( const struct sctp_association *asoc, struct sctp_chunk *chunk, __u16 flags, __u32 error, - gfp_t gfp); + unsigned int __nocast gfp); struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( const struct sctp_association *asoc, __u16 flags, - gfp_t gfp); + unsigned int __nocast gfp); struct sctp_ulpevent *sctp_ulpevent_make_pdapi( const struct sctp_association *asoc, - __u32 indication, gfp_t gfp); + __u32 indication, unsigned int __nocast gfp); struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication( - const struct sctp_association *asoc, gfp_t gfp); + const struct sctp_association *asoc, unsigned int __nocast gfp); struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, struct sctp_chunk *chunk, - gfp_t gfp); + unsigned int __nocast gfp); void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, struct msghdr *); diff --git a/trunk/include/net/sctp/ulpqueue.h b/trunk/include/net/sctp/ulpqueue.h index a43c8788b650..1a60c6d943c1 100644 --- a/trunk/include/net/sctp/ulpqueue.h +++ b/trunk/include/net/sctp/ulpqueue.h @@ -62,19 +62,22 @@ struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *, void sctp_ulpq_free(struct sctp_ulpq *); /* Add a new DATA chunk for processing. */ -int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); +int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, + unsigned int __nocast); /* Add a new event for propagation to the ULP. */ int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev); /* Renege previously received chunks. */ -void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); +void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, + unsigned int __nocast); /* Perform partial delivery. */ -void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); +void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, + unsigned int __nocast); /* Abort the partial delivery. */ -void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); +void sctp_ulpq_abort_pd(struct sctp_ulpq *, unsigned int __nocast); /* Clear the partial data delivery condition on this socket. */ int sctp_clear_pd(struct sock *sk); diff --git a/trunk/include/net/sctp/user.h b/trunk/include/net/sctp/user.h index 1c5f19f995ad..f6328aeddcce 100644 --- a/trunk/include/net/sctp/user.h +++ b/trunk/include/net/sctp/user.h @@ -103,20 +103,16 @@ enum sctp_optname { #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_PEELOFF, /* peel off association. */ #define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF - SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */ -#define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD - SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */ -#define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD - SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */ -#define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD - SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */ -#define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD - SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ -#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX + SCTP_GET_PEER_ADDRS_NUM, /* Get number of peer addresss. */ +#define SCTP_GET_PEER_ADDRS_NUM SCTP_GET_PEER_ADDRS_NUM SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */ #define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS + SCTP_GET_LOCAL_ADDRS_NUM, /* Get number of local addresss. */ +#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS + SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ +#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX }; /* @@ -243,7 +239,7 @@ struct sctp_paddr_change { int spc_state; int spc_error; sctp_assoc_t spc_assoc_id; -} __attribute__((packed, aligned(4))); +}; /* * spc_state: 32 bits (signed integer) @@ -468,7 +464,7 @@ struct sctp_assocparams { struct sctp_setpeerprim { sctp_assoc_t sspp_assoc_id; struct sockaddr_storage sspp_addr; -} __attribute__((packed, aligned(4))); +}; /* * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) @@ -481,7 +477,7 @@ struct sctp_setpeerprim { struct sctp_prim { sctp_assoc_t ssp_assoc_id; struct sockaddr_storage ssp_addr; -} __attribute__((packed, aligned(4))); +}; /* * 7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER) @@ -508,7 +504,7 @@ struct sctp_paddrparams { struct sockaddr_storage spp_address; __u32 spp_hbinterval; __u16 spp_pathmaxrxt; -} __attribute__((packed, aligned(4))); +}; /* * 7.2.2 Peer Address Information @@ -527,7 +523,7 @@ struct sctp_paddrinfo { __u32 spinfo_srtt; __u32 spinfo_rto; __u32 spinfo_mtu; -} __attribute__((packed, aligned(4))); +}; /* Peer addresses's state. */ enum sctp_spinfo_state { @@ -563,16 +559,11 @@ struct sctp_status { * SCTP_GET_LOCAL_ADDRS socket options used internally to implement * sctp_getpaddrs() and sctp_getladdrs() API. */ -struct sctp_getaddrs_old { +struct sctp_getaddrs { sctp_assoc_t assoc_id; int addr_num; struct sockaddr __user *addrs; }; -struct sctp_getaddrs { - sctp_assoc_t assoc_id; /*input*/ - __u32 addr_num; /*output*/ - __u8 addrs[0]; /*output, variable size*/ -}; /* These are bit fields for msghdr->msg_flags. See section 5.1. */ /* On user space Linux, these live in as an enum. */ diff --git a/trunk/include/net/sock.h b/trunk/include/net/sock.h index ecb75526cba0..8c48fbecb7cf 100644 --- a/trunk/include/net/sock.h +++ b/trunk/include/net/sock.h @@ -99,7 +99,6 @@ struct proto; * @skc_node: main hash linkage for various protocol lookup tables * @skc_bind_node: bind hash linkage for various protocol lookup tables * @skc_refcnt: reference count - * @skc_hash: hash value used with various protocol lookup tables * @skc_prot: protocol handlers inside a network family * * This is the minimal network layer representation of sockets, the header @@ -113,7 +112,6 @@ struct sock_common { struct hlist_node skc_node; struct hlist_node skc_bind_node; atomic_t skc_refcnt; - unsigned int skc_hash; struct proto *skc_prot; }; @@ -141,6 +139,7 @@ struct sock_common { * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) * @sk_lingertime: %SO_LINGER l_linger setting + * @sk_hashent: hash entry in several tables (e.g. inet_hashinfo.ehash) * @sk_backlog: always used with the per-socket spinlock held * @sk_callback_lock: used with the callbacks in the end of this struct * @sk_error_queue: rarely used @@ -187,7 +186,6 @@ struct sock { #define sk_node __sk_common.skc_node #define sk_bind_node __sk_common.skc_bind_node #define sk_refcnt __sk_common.skc_refcnt -#define sk_hash __sk_common.skc_hash #define sk_prot __sk_common.skc_prot unsigned char sk_shutdown : 2, sk_no_check : 2, @@ -210,6 +208,7 @@ struct sock { unsigned int sk_allocation; int sk_sndbuf; int sk_route_caps; + int sk_hashent; unsigned long sk_flags; unsigned long sk_lingertime; /* @@ -739,18 +738,18 @@ extern void FASTCALL(release_sock(struct sock *sk)); #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) extern struct sock *sk_alloc(int family, - gfp_t priority, + unsigned int __nocast priority, struct proto *prot, int zero_it); extern void sk_free(struct sock *sk); extern struct sock *sk_clone(const struct sock *sk, - const gfp_t priority); + const unsigned int __nocast priority); extern struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, - gfp_t priority); + unsigned int __nocast priority); extern struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, - gfp_t priority); + unsigned int __nocast priority); extern void sock_wfree(struct sk_buff *skb); extern void sock_rfree(struct sk_buff *skb); @@ -766,7 +765,7 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, int noblock, int *errcode); extern void *sock_kmalloc(struct sock *sk, int size, - gfp_t priority); + unsigned int __nocast priority); extern void sock_kfree_s(struct sock *sk, void *mem, int size); extern void sk_send_sigurg(struct sock *sk); @@ -1201,7 +1200,7 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk) static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, int size, int mem, - gfp_t gfp) + unsigned int __nocast gfp) { struct sk_buff *skb; int hdr_len; @@ -1224,7 +1223,7 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, - gfp_t gfp) + unsigned int __nocast gfp) { return sk_stream_alloc_pskb(sk, size, 0, gfp); } @@ -1255,7 +1254,7 @@ static inline int sock_writeable(const struct sock *sk) return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2); } -static inline gfp_t gfp_any(void) +static inline unsigned int __nocast gfp_any(void) { return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; } diff --git a/trunk/include/net/tcp.h b/trunk/include/net/tcp.h index c24339c4e310..97af77c4d096 100644 --- a/trunk/include/net/tcp.h +++ b/trunk/include/net/tcp.h @@ -460,7 +460,8 @@ extern void tcp_send_probe0(struct sock *); extern void tcp_send_partial(struct sock *); extern int tcp_write_wakeup(struct sock *); extern void tcp_send_fin(struct sock *sk); -extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); +extern void tcp_send_active_reset(struct sock *sk, + unsigned int __nocast priority); extern int tcp_send_synack(struct sock *); extern void tcp_push_one(struct sock *, unsigned int mss_now); extern void tcp_send_ack(struct sock *sk); diff --git a/trunk/include/net/xfrm.h b/trunk/include/net/xfrm.h index 5beae1ccd574..a9d0d8c5dfbf 100644 --- a/trunk/include/net/xfrm.h +++ b/trunk/include/net/xfrm.h @@ -875,7 +875,7 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig } #endif -struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); +struct xfrm_policy *xfrm_policy_alloc(int gfp); extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel, @@ -931,9 +931,4 @@ static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, } } -static inline int xfrm_policy_id2dir(u32 index) -{ - return index & 7; -} - #endif /* _NET_XFRM_H */ diff --git a/trunk/include/pcmcia/ss.h b/trunk/include/pcmcia/ss.h index c8592c7e8eaa..0f7aacc33fe9 100644 --- a/trunk/include/pcmcia/ss.h +++ b/trunk/include/pcmcia/ss.h @@ -21,9 +21,6 @@ #include #include #include -#ifdef CONFIG_CARDBUS -#include -#endif /* Definitions for card status flags for GetStatus */ #define SS_WRPROT 0x0001 @@ -236,11 +233,7 @@ struct pcmcia_socket { /* so is power hook */ int (*power_hook)(struct pcmcia_socket *sock, int operation); -#ifdef CONFIG_CARDBUS - /* allows tuning the CB bridge before loading driver for the CB card */ - void (*tune_bridge)(struct pcmcia_socket *sock, struct pci_bus *bus); -#endif - + /* state thread */ struct semaphore skt_sem; /* protects socket h/w state */ diff --git a/trunk/include/rdma/ib_mad.h b/trunk/include/rdma/ib_mad.h index 4172e6841e3d..0e293fe733b0 100644 --- a/trunk/include/rdma/ib_mad.h +++ b/trunk/include/rdma/ib_mad.h @@ -596,7 +596,7 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent, u32 remote_qpn, u16 pkey_index, struct ib_ah *ah, int rmpp_active, int hdr_len, int data_len, - gfp_t gfp_mask); + unsigned int __nocast gfp_mask); /** * ib_free_send_mad - Returns data buffers used to send a MAD. diff --git a/trunk/include/rdma/ib_sa.h b/trunk/include/rdma/ib_sa.h index f404fe21cc21..a7555c800ecf 100644 --- a/trunk/include/rdma/ib_sa.h +++ b/trunk/include/rdma/ib_sa.h @@ -285,7 +285,7 @@ void ib_sa_cancel_query(int id, struct ib_sa_query *query); int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, struct ib_sa_path_rec *rec, ib_sa_comp_mask comp_mask, - int timeout_ms, gfp_t gfp_mask, + int timeout_ms, unsigned int __nocast gfp_mask, void (*callback)(int status, struct ib_sa_path_rec *resp, void *context), @@ -296,7 +296,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, u8 method, struct ib_sa_mcmember_rec *rec, ib_sa_comp_mask comp_mask, - int timeout_ms, gfp_t gfp_mask, + int timeout_ms, unsigned int __nocast gfp_mask, void (*callback)(int status, struct ib_sa_mcmember_rec *resp, void *context), @@ -307,7 +307,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method, struct ib_sa_service_rec *rec, ib_sa_comp_mask comp_mask, - int timeout_ms, gfp_t gfp_mask, + int timeout_ms, unsigned int __nocast gfp_mask, void (*callback)(int status, struct ib_sa_service_rec *resp, void *context), @@ -342,7 +342,7 @@ static inline int ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, struct ib_sa_mcmember_rec *rec, ib_sa_comp_mask comp_mask, - int timeout_ms, gfp_t gfp_mask, + int timeout_ms, unsigned int __nocast gfp_mask, void (*callback)(int status, struct ib_sa_mcmember_rec *resp, void *context), @@ -384,7 +384,7 @@ static inline int ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, struct ib_sa_mcmember_rec *rec, ib_sa_comp_mask comp_mask, - int timeout_ms, gfp_t gfp_mask, + int timeout_ms, unsigned int __nocast gfp_mask, void (*callback)(int status, struct ib_sa_mcmember_rec *resp, void *context), diff --git a/trunk/include/rdma/ib_verbs.h b/trunk/include/rdma/ib_verbs.h index e6f4c9e55df7..e16cf94870f2 100644 --- a/trunk/include/rdma/ib_verbs.h +++ b/trunk/include/rdma/ib_verbs.h @@ -665,6 +665,7 @@ struct ib_ucontext { struct list_head qp_list; struct list_head srq_list; struct list_head ah_list; + spinlock_t lock; }; struct ib_uobject { diff --git a/trunk/include/rxrpc/call.h b/trunk/include/rxrpc/call.h index b86f83743510..f48f27e9e0ab 100644 --- a/trunk/include/rxrpc/call.h +++ b/trunk/include/rxrpc/call.h @@ -203,7 +203,7 @@ extern int rxrpc_call_write_data(struct rxrpc_call *call, size_t sioc, struct kvec *siov, uint8_t rxhdr_flags, - gfp_t alloc_flags, + int alloc_flags, int dup_data, size_t *size_sent); diff --git a/trunk/include/rxrpc/message.h b/trunk/include/rxrpc/message.h index b318f273d4f2..3a59df6870b2 100644 --- a/trunk/include/rxrpc/message.h +++ b/trunk/include/rxrpc/message.h @@ -63,7 +63,7 @@ extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn, uint8_t type, int count, struct kvec *diov, - gfp_t alloc_flags, + int alloc_flags, struct rxrpc_message **_msg); extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg); diff --git a/trunk/include/scsi/scsi_device.h b/trunk/include/scsi/scsi_device.h index 7ece05666feb..c0e4c67d836f 100644 --- a/trunk/include/scsi/scsi_device.h +++ b/trunk/include/scsi/scsi_device.h @@ -163,7 +163,6 @@ struct scsi_target { unsigned int id; /* target id ... replace * scsi_device.id eventually */ unsigned long create:1; /* signal that it needs to be added */ - char scsi_level; void *hostdata; /* available to low-level driver */ unsigned long starget_data[0]; /* for the transport */ /* starget_data must be the last element!!!! */ diff --git a/trunk/include/sound/ac97_codec.h b/trunk/include/sound/ac97_codec.h index d11f34832a97..2857cf0472df 100644 --- a/trunk/include/sound/ac97_codec.h +++ b/trunk/include/sound/ac97_codec.h @@ -527,8 +527,6 @@ struct _snd_ac97 { struct device dev; }; -#define to_ac97_t(d) container_of(d, struct _snd_ac97, dev) - /* conditions */ static inline int ac97_is_audio(ac97_t * ac97) { diff --git a/trunk/include/sound/core.h b/trunk/include/sound/core.h index 6d971a4c4ca0..26160adcdffc 100644 --- a/trunk/include/sound/core.h +++ b/trunk/include/sound/core.h @@ -290,13 +290,13 @@ void snd_memory_init(void); void snd_memory_done(void); int snd_memory_info_init(void); int snd_memory_info_done(void); -void *snd_hidden_kmalloc(size_t size, gfp_t flags); -void *snd_hidden_kzalloc(size_t size, gfp_t flags); -void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags); +void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags); +void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags); +void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags); void snd_hidden_kfree(const void *obj); void *snd_hidden_vmalloc(unsigned long size); void snd_hidden_vfree(void *obj); -char *snd_hidden_kstrdup(const char *s, gfp_t flags); +char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags); #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) #define kzalloc(size, flags) snd_hidden_kzalloc(size, flags) #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) diff --git a/trunk/include/sound/driver.h b/trunk/include/sound/driver.h index 1ec2fae050a6..0d12456ec3ae 100644 --- a/trunk/include/sound/driver.h +++ b/trunk/include/sound/driver.h @@ -51,7 +51,7 @@ #ifdef CONFIG_SND_DEBUG_MEMORY #include #include -void *snd_wrapper_kmalloc(size_t, gfp_t); +void *snd_wrapper_kmalloc(size_t, unsigned int __nocast); #undef kmalloc void snd_wrapper_kfree(const void *); #undef kfree diff --git a/trunk/include/sound/emu10k1.h b/trunk/include/sound/emu10k1.h index 14cb2718cb77..67bf3f18e96a 100644 --- a/trunk/include/sound/emu10k1.h +++ b/trunk/include/sound/emu10k1.h @@ -1059,7 +1059,7 @@ typedef struct { unsigned char spk71; /* Has 7.1 speakers */ unsigned char sblive51; /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */ unsigned char spdif_bug; /* Has Spdif phasing bug */ - unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */ + unsigned char ac97_chip; /* Has an AC97 chip */ unsigned char ecard; /* APS EEPROM */ const char *driver; const char *name; diff --git a/trunk/ipc/mqueue.c b/trunk/ipc/mqueue.c index a0f18c9cc89d..3a926011507b 100644 --- a/trunk/ipc/mqueue.c +++ b/trunk/ipc/mqueue.c @@ -611,7 +611,6 @@ static struct file *do_create(struct dentry *dir, struct dentry *dentry, dentry->d_fsdata = &attr; } - mode &= ~current->fs->umask; ret = vfs_create(dir->d_inode, dentry, mode, NULL); dentry->d_fsdata = NULL; if (ret) diff --git a/trunk/kernel/audit.c b/trunk/kernel/audit.c index aefa73a8a586..83096b67510a 100644 --- a/trunk/kernel/audit.c +++ b/trunk/kernel/audit.c @@ -560,7 +560,7 @@ static void audit_buffer_free(struct audit_buffer *ab) } static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx, - gfp_t gfp_mask, int type) + unsigned int __nocast gfp_mask, int type) { unsigned long flags; struct audit_buffer *ab = NULL; diff --git a/trunk/kernel/cpuset.c b/trunk/kernel/cpuset.c index 28176d083f7b..79866bc6b3a1 100644 --- a/trunk/kernel/cpuset.c +++ b/trunk/kernel/cpuset.c @@ -968,6 +968,8 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf, char *page; ssize_t retval = 0; char *s; + char *start; + size_t n; if (!(page = (char *)__get_free_page(GFP_KERNEL))) return -ENOMEM; @@ -997,7 +999,14 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf, *s++ = '\n'; *s = '\0'; - retval = simple_read_from_buffer(buf, nbytes, ppos, page, s - page); + /* Do nothing if *ppos is at the eof or beyond the eof. */ + if (s - page <= *ppos) + return 0; + + start = page + *ppos; + n = s - start; + retval = n - copy_to_user(buf, start, min(n, nbytes)); + *ppos += retval; out: free_page((unsigned long)page); return retval; @@ -1670,7 +1679,7 @@ static const struct cpuset *nearest_exclusive_ancestor(const struct cpuset *cs) * GFP_USER - only nodes in current tasks mems allowed ok. **/ -int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) +int cpuset_zone_allowed(struct zone *z, unsigned int __nocast gfp_mask) { int node; /* node that zone z is on */ const struct cpuset *cs; /* current cpuset ancestors */ diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index 43077732619b..ee6d8b8abef5 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -1203,7 +1203,7 @@ static int wait_task_stopped(task_t *p, int delayed_group_leader, int noreap, exit_code = p->exit_code; if (unlikely(!exit_code) || - unlikely(p->state & TASK_TRACED)) + unlikely(p->state > TASK_STOPPED)) goto bail_ref; return wait_noreap_copyout(p, pid, uid, why, (exit_code << 8) | 0x7f, diff --git a/trunk/kernel/kfifo.c b/trunk/kernel/kfifo.c index 64ab045c3d9d..179baafcdd96 100644 --- a/trunk/kernel/kfifo.c +++ b/trunk/kernel/kfifo.c @@ -36,7 +36,7 @@ * struct kfifo with kfree(). */ struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, - gfp_t gfp_mask, spinlock_t *lock) + unsigned int __nocast gfp_mask, spinlock_t *lock) { struct kfifo *fifo; @@ -64,7 +64,7 @@ EXPORT_SYMBOL(kfifo_init); * * The size will be rounded-up to a power of 2. */ -struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock) +struct kfifo *kfifo_alloc(unsigned int size, unsigned int __nocast gfp_mask, spinlock_t *lock) { unsigned char *buffer; struct kfifo *ret; diff --git a/trunk/kernel/params.c b/trunk/kernel/params.c index 1a8614bac5d5..fbf173215fd2 100644 --- a/trunk/kernel/params.c +++ b/trunk/kernel/params.c @@ -80,6 +80,8 @@ static char *next_arg(char *args, char **param, char **val) int in_quote = 0, quoted = 0; char *next; + /* Chew any extra spaces */ + while (*args == ' ') args++; if (*args == '"') { args++; in_quote = 1; @@ -119,10 +121,6 @@ static char *next_arg(char *args, char **param, char **val) next = args + i + 1; } else next = args + i; - - /* Chew up trailing spaces. */ - while (*next == ' ') - next++; return next; } @@ -137,10 +135,6 @@ int parse_args(const char *name, DEBUGP("Parsing ARGS: %s\n", args); - /* Chew leading spaces */ - while (*args == ' ') - args++; - while (*args) { int ret; diff --git a/trunk/kernel/posix-cpu-timers.c b/trunk/kernel/posix-cpu-timers.c index 7a51a5597c33..ad85d3f0dcc4 100644 --- a/trunk/kernel/posix-cpu-timers.c +++ b/trunk/kernel/posix-cpu-timers.c @@ -424,7 +424,6 @@ static void cleanup_timers(struct list_head *head, cputime_t ptime = cputime_add(utime, stime); list_for_each_entry_safe(timer, next, head, entry) { - put_task_struct(timer->task); timer->task = NULL; list_del_init(&timer->entry); if (cputime_lt(timer->expires.cpu, ptime)) { @@ -437,7 +436,6 @@ static void cleanup_timers(struct list_head *head, ++head; list_for_each_entry_safe(timer, next, head, entry) { - put_task_struct(timer->task); timer->task = NULL; list_del_init(&timer->entry); if (cputime_lt(timer->expires.cpu, utime)) { @@ -450,7 +448,6 @@ static void cleanup_timers(struct list_head *head, ++head; list_for_each_entry_safe(timer, next, head, entry) { - put_task_struct(timer->task); timer->task = NULL; list_del_init(&timer->entry); if (timer->expires.sched < sched_time) { diff --git a/trunk/kernel/power/power.h b/trunk/kernel/power/power.h index 6748de23e83c..9c9167d910dd 100644 --- a/trunk/kernel/power/power.h +++ b/trunk/kernel/power/power.h @@ -9,9 +9,6 @@ #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) #endif -#define MAX_PBES ((PAGE_SIZE - sizeof(struct new_utsname) \ - - 4 - 3*sizeof(unsigned long) - sizeof(int) \ - - sizeof(void *)) / sizeof(swp_entry_t)) struct swsusp_info { struct new_utsname uts; @@ -21,7 +18,7 @@ struct swsusp_info { unsigned long image_pages; unsigned long pagedir_pages; suspend_pagedir_t * suspend_pagedir; - swp_entry_t pagedir[MAX_PBES]; + swp_entry_t pagedir[768]; } __attribute__((aligned(PAGE_SIZE))); diff --git a/trunk/kernel/power/swsusp.c b/trunk/kernel/power/swsusp.c index 2d5c45676442..1cc9ff25e479 100644 --- a/trunk/kernel/power/swsusp.c +++ b/trunk/kernel/power/swsusp.c @@ -402,14 +402,15 @@ static int write_page(unsigned long addr, swp_entry_t * loc) static void data_free(void) { swp_entry_t entry; - struct pbe * p; + int i; - for_each_pbe(p, pagedir_nosave) { - entry = p->swap_address; + for (i = 0; i < nr_copy_pages; i++) { + entry = (pagedir_nosave + i)->swap_address; if (entry.val) swap_free(entry); else break; + (pagedir_nosave + i)->swap_address = (swp_entry_t){0}; } } @@ -931,10 +932,6 @@ static int swsusp_alloc(void) if (!enough_swap()) return -ENOSPC; - if (MAX_PBES < nr_copy_pages / PBES_PER_PAGE + - !!(nr_copy_pages % PBES_PER_PAGE)) - return -ENOSPC; - if (!(pagedir_save = alloc_pagedir(nr_copy_pages))) { printk(KERN_ERR "suspend: Allocating pagedir failed.\n"); return -ENOMEM; @@ -1095,7 +1092,7 @@ static inline void eat_page(void *page) *eaten_memory = c; } -unsigned long get_usable_page(unsigned gfp_mask) +static unsigned long get_usable_page(unsigned gfp_mask) { unsigned long m; @@ -1109,7 +1106,7 @@ unsigned long get_usable_page(unsigned gfp_mask) return m; } -void free_eaten_memory(void) +static void free_eaten_memory(void) { unsigned long m; void **c; @@ -1441,9 +1438,9 @@ static int read_pagedir(struct pbe *pblist) } if (error) - free_pagedir(pblist); - else - BUG_ON(i != swsusp_info.pagedir_pages); + free_page((unsigned long)pblist); + + BUG_ON(i != swsusp_info.pagedir_pages); return error; } @@ -1481,12 +1478,11 @@ static int read_suspend_image(void) /* Allocate memory for the image and read the data from swap */ error = check_pagedir(pagedir_nosave); - + free_eaten_memory(); if (!error) error = data_read(pagedir_nosave); if (error) { /* We fail cleanly */ - free_eaten_memory(); for_each_pbe (p, pagedir_nosave) if (p->address) { free_page(p->address); diff --git a/trunk/kernel/rcupdate.c b/trunk/kernel/rcupdate.c index 2559d4b8f23f..bef3b6901b76 100644 --- a/trunk/kernel/rcupdate.c +++ b/trunk/kernel/rcupdate.c @@ -71,7 +71,7 @@ DEFINE_PER_CPU(struct rcu_data, rcu_bh_data) = { 0L }; /* Fake initialization required by compiler */ static DEFINE_PER_CPU(struct tasklet_struct, rcu_tasklet) = {NULL}; -static int maxbatch = 10000; +static int maxbatch = 10; #ifndef __HAVE_ARCH_CMPXCHG /* @@ -109,10 +109,6 @@ void fastcall call_rcu(struct rcu_head *head, rdp = &__get_cpu_var(rcu_data); *rdp->nxttail = head; rdp->nxttail = &head->next; - - if (unlikely(++rdp->count > 10000)) - set_need_resched(); - local_irq_restore(flags); } @@ -144,12 +140,6 @@ void fastcall call_rcu_bh(struct rcu_head *head, rdp = &__get_cpu_var(rcu_bh_data); *rdp->nxttail = head; rdp->nxttail = &head->next; - rdp->count++; -/* - * Should we directly call rcu_do_batch() here ? - * if (unlikely(rdp->count > 10000)) - * rcu_do_batch(rdp); - */ local_irq_restore(flags); } @@ -167,7 +157,6 @@ static void rcu_do_batch(struct rcu_data *rdp) next = rdp->donelist = list->next; list->func(list); list = next; - rdp->count--; if (++count >= maxbatch) break; } diff --git a/trunk/kernel/signal.c b/trunk/kernel/signal.c index 50c992643771..b92c3c9f8b9a 100644 --- a/trunk/kernel/signal.c +++ b/trunk/kernel/signal.c @@ -262,7 +262,7 @@ next_signal(struct sigpending *pending, sigset_t *mask) return sig; } -static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags, +static struct sigqueue *__sigqueue_alloc(struct task_struct *t, unsigned int __nocast flags, int override_rlimit) { struct sigqueue *q = NULL; @@ -578,8 +578,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) * is to alert stop-signal processing code when another * processor has come along and cleared the flag. */ - if (!(tsk->signal->flags & SIGNAL_GROUP_EXIT)) - tsk->signal->flags |= SIGNAL_STOP_DEQUEUED; + tsk->signal->flags |= SIGNAL_STOP_DEQUEUED; } if ( signr && ((info->si_code & __SI_MASK) == __SI_TIMER) && @@ -937,31 +936,34 @@ force_sig_specific(int sig, struct task_struct *t) * as soon as they're available, so putting the signal on the shared queue * will be equivalent to sending it to one such thread. */ -static inline int wants_signal(int sig, struct task_struct *p) -{ - if (sigismember(&p->blocked, sig)) - return 0; - if (p->flags & PF_EXITING) - return 0; - if (sig == SIGKILL) - return 1; - if (p->state & (TASK_STOPPED | TASK_TRACED)) - return 0; - return task_curr(p) || !signal_pending(p); -} +#define wants_signal(sig, p, mask) \ + (!sigismember(&(p)->blocked, sig) \ + && !((p)->state & mask) \ + && !((p)->flags & PF_EXITING) \ + && (task_curr(p) || !signal_pending(p))) + static void __group_complete_signal(int sig, struct task_struct *p) { + unsigned int mask; struct task_struct *t; + /* + * Don't bother traced and stopped tasks (but + * SIGKILL will punch through that). + */ + mask = TASK_STOPPED | TASK_TRACED; + if (sig == SIGKILL) + mask = 0; + /* * Now find a thread we can wake up to take the signal off the queue. * * If the main thread wants the signal, it gets first crack. * Probably the least surprising to the average bear. */ - if (wants_signal(sig, p)) + if (wants_signal(sig, p, mask)) t = p; else if (thread_group_empty(p)) /* @@ -979,7 +981,7 @@ __group_complete_signal(int sig, struct task_struct *p) t = p->signal->curr_target = p; BUG_ON(t->tgid != p->tgid); - while (!wants_signal(sig, t)) { + while (!wants_signal(sig, t, mask)) { t = next_thread(t); if (t == p->signal->curr_target) /* @@ -1193,40 +1195,6 @@ kill_proc_info(int sig, struct siginfo *info, pid_t pid) return error; } -/* like kill_proc_info(), but doesn't use uid/euid of "current" */ -int kill_proc_info_as_uid(int sig, struct siginfo *info, pid_t pid, - uid_t uid, uid_t euid) -{ - int ret = -EINVAL; - struct task_struct *p; - - if (!valid_signal(sig)) - return ret; - - read_lock(&tasklist_lock); - p = find_task_by_pid(pid); - if (!p) { - ret = -ESRCH; - goto out_unlock; - } - if ((!info || ((unsigned long)info != 1 && - (unsigned long)info != 2 && SI_FROMUSER(info))) - && (euid != p->suid) && (euid != p->uid) - && (uid != p->suid) && (uid != p->uid)) { - ret = -EPERM; - goto out_unlock; - } - if (sig && p->sighand) { - unsigned long flags; - spin_lock_irqsave(&p->sighand->siglock, flags); - ret = __group_send_sig_info(sig, info, p); - spin_unlock_irqrestore(&p->sighand->siglock, flags); - } -out_unlock: - read_unlock(&tasklist_lock); - return ret; -} -EXPORT_SYMBOL_GPL(kill_proc_info_as_uid); /* * kill_something_info() interprets pid in interesting ways just like kill(2). @@ -1798,8 +1766,7 @@ do_signal_stop(int signr) * stop is always done with the siglock held, * so this check has no races. */ - if (!t->exit_state && - !(t->state & (TASK_STOPPED|TASK_TRACED))) { + if (t->state < TASK_STOPPED) { stop_count++; signal_wake_up(t, 0); } diff --git a/trunk/kernel/time.c b/trunk/kernel/time.c index 40c2410ac99a..dd5ae1162a8f 100644 --- a/trunk/kernel/time.c +++ b/trunk/kernel/time.c @@ -570,7 +570,6 @@ void getnstimeofday(struct timespec *tv) tv->tv_sec = x.tv_sec; tv->tv_nsec = x.tv_usec * NSEC_PER_USEC; } -EXPORT_SYMBOL_GPL(getnstimeofday); #endif #if (BITS_PER_LONG < 64) diff --git a/trunk/lib/radix-tree.c b/trunk/lib/radix-tree.c index d1c057e71b68..6a8bc6e06431 100644 --- a/trunk/lib/radix-tree.c +++ b/trunk/lib/radix-tree.c @@ -110,7 +110,7 @@ radix_tree_node_free(struct radix_tree_node *node) * success, return zero, with preemption disabled. On error, return -ENOMEM * with preemption not disabled. */ -int radix_tree_preload(gfp_t gfp_mask) +int radix_tree_preload(unsigned int __nocast gfp_mask) { struct radix_tree_preload *rtp; struct radix_tree_node *node; diff --git a/trunk/lib/ts_bm.c b/trunk/lib/ts_bm.c index 8a8b3a16133e..2cc79112ecc3 100644 --- a/trunk/lib/ts_bm.c +++ b/trunk/lib/ts_bm.c @@ -127,7 +127,7 @@ static void compute_prefix_tbl(struct ts_bm *bm, const u8 *pattern, } static struct ts_config *bm_init(const void *pattern, unsigned int len, - gfp_t gfp_mask) + int gfp_mask) { struct ts_config *conf; struct ts_bm *bm; diff --git a/trunk/lib/ts_fsm.c b/trunk/lib/ts_fsm.c index ca3211206eef..d27c0a072940 100644 --- a/trunk/lib/ts_fsm.c +++ b/trunk/lib/ts_fsm.c @@ -258,7 +258,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state) } static struct ts_config *fsm_init(const void *pattern, unsigned int len, - gfp_t gfp_mask) + int gfp_mask) { int i, err = -EINVAL; struct ts_config *conf; diff --git a/trunk/lib/ts_kmp.c b/trunk/lib/ts_kmp.c index 7fd45451b44a..73266b975585 100644 --- a/trunk/lib/ts_kmp.c +++ b/trunk/lib/ts_kmp.c @@ -87,7 +87,7 @@ static inline void compute_prefix_tbl(const u8 *pattern, unsigned int len, } static struct ts_config *kmp_init(const void *pattern, unsigned int len, - gfp_t gfp_mask) + int gfp_mask) { struct ts_config *conf; struct ts_kmp *kmp; diff --git a/trunk/mm/bootmem.c b/trunk/mm/bootmem.c index c1330cc19783..8ec4e4c2a179 100644 --- a/trunk/mm/bootmem.c +++ b/trunk/mm/bootmem.c @@ -61,9 +61,17 @@ static unsigned long __init init_bootmem_core (pg_data_t *pgdat, { bootmem_data_t *bdata = pgdat->bdata; unsigned long mapsize = ((end - start)+7)/8; - - pgdat->pgdat_next = pgdat_list; - pgdat_list = pgdat; + static struct pglist_data *pgdat_last; + + pgdat->pgdat_next = NULL; + /* Add new nodes last so that bootmem always starts + searching in the first nodes, not the last ones */ + if (pgdat_last) + pgdat_last->pgdat_next = pgdat; + else { + pgdat_list = pgdat; + pgdat_last = pgdat; + } mapsize = ALIGN(mapsize, sizeof(long)); bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); diff --git a/trunk/mm/fremap.c b/trunk/mm/fremap.c index ab23a0673c35..3235fb77c133 100644 --- a/trunk/mm/fremap.c +++ b/trunk/mm/fremap.c @@ -89,9 +89,6 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma, size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; if (!page->mapping || page->index >= size) goto err_unlock; - err = -ENOMEM; - if (page_mapcount(page) > INT_MAX/2) - goto err_unlock; zap_pte(mm, vma, addr, pte); diff --git a/trunk/mm/highmem.c b/trunk/mm/highmem.c index 90e1861e2da0..400911599468 100644 --- a/trunk/mm/highmem.c +++ b/trunk/mm/highmem.c @@ -30,7 +30,7 @@ static mempool_t *page_pool, *isa_page_pool; -static void *page_pool_alloc(gfp_t gfp_mask, void *data) +static void *page_pool_alloc(unsigned int __nocast gfp_mask, void *data) { unsigned int gfp = gfp_mask | (unsigned int) (long) data; diff --git a/trunk/mm/madvise.c b/trunk/mm/madvise.c index 20e075d1c64c..4454936f87d1 100644 --- a/trunk/mm/madvise.c +++ b/trunk/mm/madvise.c @@ -83,9 +83,6 @@ static long madvise_willneed(struct vm_area_struct * vma, { struct file *file = vma->vm_file; - if (!file) - return -EBADF; - if (file->f_mapping->a_ops->get_xip_page) { /* no bad return value, but ignore advice */ return 0; @@ -144,7 +141,11 @@ static long madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, unsigned long start, unsigned long end, int behavior) { - long error; + struct file *filp = vma->vm_file; + long error = -EBADF; + + if (!filp) + goto out; switch (behavior) { case MADV_NORMAL: @@ -165,6 +166,8 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, error = -EINVAL; break; } + +out: return error; } diff --git a/trunk/mm/mempolicy.c b/trunk/mm/mempolicy.c index 37af443eb094..9033f0859aa8 100644 --- a/trunk/mm/mempolicy.c +++ b/trunk/mm/mempolicy.c @@ -687,7 +687,7 @@ get_vma_policy(struct task_struct *task, struct vm_area_struct *vma, unsigned lo } /* Return a zonelist representing a mempolicy */ -static struct zonelist *zonelist_policy(gfp_t gfp, struct mempolicy *policy) +static struct zonelist *zonelist_policy(unsigned int __nocast gfp, struct mempolicy *policy) { int nd; @@ -751,7 +751,7 @@ static unsigned offset_il_node(struct mempolicy *pol, /* Allocate a page in interleaved policy. Own path because it needs to do special accounting. */ -static struct page *alloc_page_interleave(gfp_t gfp, unsigned order, unsigned nid) +static struct page *alloc_page_interleave(unsigned int __nocast gfp, unsigned order, unsigned nid) { struct zonelist *zl; struct page *page; @@ -789,7 +789,7 @@ static struct page *alloc_page_interleave(gfp_t gfp, unsigned order, unsigned ni * Should be called with the mm_sem of the vma hold. */ struct page * -alloc_page_vma(gfp_t gfp, struct vm_area_struct *vma, unsigned long addr) +alloc_page_vma(unsigned int __nocast gfp, struct vm_area_struct *vma, unsigned long addr) { struct mempolicy *pol = get_vma_policy(current, vma, addr); @@ -832,7 +832,7 @@ alloc_page_vma(gfp_t gfp, struct vm_area_struct *vma, unsigned long addr) * 1) it's ok to take cpuset_sem (can WAIT), and * 2) allocating for current task (not interrupt). */ -struct page *alloc_pages_current(gfp_t gfp, unsigned order) +struct page *alloc_pages_current(unsigned int __nocast gfp, unsigned order) { struct mempolicy *pol = current->mempolicy; diff --git a/trunk/mm/mempool.c b/trunk/mm/mempool.c index 9e377ea700b2..65f2957b8d51 100644 --- a/trunk/mm/mempool.c +++ b/trunk/mm/mempool.c @@ -112,7 +112,7 @@ EXPORT_SYMBOL(mempool_create_node); * while this function is running. mempool_alloc() & mempool_free() * might be called (eg. from IRQ contexts) while this function executes. */ -int mempool_resize(mempool_t *pool, int new_min_nr, gfp_t gfp_mask) +int mempool_resize(mempool_t *pool, int new_min_nr, unsigned int __nocast gfp_mask) { void *element; void **new_elements; @@ -200,7 +200,7 @@ EXPORT_SYMBOL(mempool_destroy); * *never* fails when called from process contexts. (it might * fail if called from an IRQ context.) */ -void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask) +void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask) { void *element; unsigned long flags; @@ -276,7 +276,7 @@ EXPORT_SYMBOL(mempool_free); /* * A commonly used alloc and free fn. */ -void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data) +void *mempool_alloc_slab(unsigned int __nocast gfp_mask, void *pool_data) { kmem_cache_t *mem = (kmem_cache_t *) pool_data; return kmem_cache_alloc(mem, gfp_mask); diff --git a/trunk/mm/mremap.c b/trunk/mm/mremap.c index f343fc73a8bd..a32fed454bd7 100644 --- a/trunk/mm/mremap.c +++ b/trunk/mm/mremap.c @@ -141,10 +141,10 @@ move_one_page(struct vm_area_struct *vma, unsigned long old_addr, if (dst) { pte_t pte; pte = ptep_clear_flush(vma, old_addr, src); - /* ZERO_PAGE can be dependant on virtual addr */ - pte = move_pte(pte, new_vma->vm_page_prot, - old_addr, new_addr); + if (pfn_valid(pte_pfn(pte)) && + pte_page(pte) == ZERO_PAGE(old_addr)) + pte = pte_wrprotect(mk_pte(ZERO_PAGE(new_addr), new_vma->vm_page_prot)); set_pte_at(mm, new_addr, dst, pte); } else error = -ENOMEM; diff --git a/trunk/mm/nommu.c b/trunk/mm/nommu.c index 0ef241ae3763..064d70442895 100644 --- a/trunk/mm/nommu.c +++ b/trunk/mm/nommu.c @@ -157,7 +157,8 @@ void vfree(void *addr) kfree(addr); } -void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot) +void *__vmalloc(unsigned long size, unsigned int __nocast gfp_mask, + pgprot_t prot) { /* * kmalloc doesn't like __GFP_HIGHMEM for some reason diff --git a/trunk/mm/oom_kill.c b/trunk/mm/oom_kill.c index d348b9035955..ac3bf33e5370 100644 --- a/trunk/mm/oom_kill.c +++ b/trunk/mm/oom_kill.c @@ -263,7 +263,7 @@ static struct mm_struct *oom_kill_process(struct task_struct *p) * OR try to be smart about which process to kill. Note that we * don't have to be perfect here, we just have to be good. */ -void out_of_memory(gfp_t gfp_mask, int order) +void out_of_memory(unsigned int __nocast gfp_mask, int order) { struct mm_struct *mm = NULL; task_t * p; diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index cc1fe2672a31..ae2903339e71 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -671,7 +671,7 @@ void fastcall free_cold_page(struct page *page) free_hot_cold_page(page, 1); } -static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags) +static inline void prep_zero_page(struct page *page, int order, unsigned int __nocast gfp_flags) { int i; @@ -686,7 +686,7 @@ static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags) * or two. */ static struct page * -buffered_rmqueue(struct zone *zone, int order, gfp_t gfp_flags) +buffered_rmqueue(struct zone *zone, int order, unsigned int __nocast gfp_flags) { unsigned long flags; struct page *page = NULL; @@ -761,7 +761,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, } static inline int -should_reclaim_zone(struct zone *z, gfp_t gfp_mask) +should_reclaim_zone(struct zone *z, unsigned int gfp_mask) { if (!z->reclaim_pages) return 0; @@ -774,7 +774,7 @@ should_reclaim_zone(struct zone *z, gfp_t gfp_mask) * This is the 'heart' of the zoned buddy allocator. */ struct page * fastcall -__alloc_pages(gfp_t gfp_mask, unsigned int order, +__alloc_pages(unsigned int __nocast gfp_mask, unsigned int order, struct zonelist *zonelist) { const int wait = gfp_mask & __GFP_WAIT; @@ -977,7 +977,7 @@ EXPORT_SYMBOL(__alloc_pages); /* * Common helper functions. */ -fastcall unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) +fastcall unsigned long __get_free_pages(unsigned int __nocast gfp_mask, unsigned int order) { struct page * page; page = alloc_pages(gfp_mask, order); @@ -988,7 +988,7 @@ fastcall unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) EXPORT_SYMBOL(__get_free_pages); -fastcall unsigned long get_zeroed_page(gfp_t gfp_mask) +fastcall unsigned long get_zeroed_page(unsigned int __nocast gfp_mask) { struct page * page; diff --git a/trunk/mm/page_io.c b/trunk/mm/page_io.c index 330e00d6db00..2e605a19ce57 100644 --- a/trunk/mm/page_io.c +++ b/trunk/mm/page_io.c @@ -19,7 +19,7 @@ #include #include -static struct bio *get_swap_bio(gfp_t gfp_flags, pgoff_t index, +static struct bio *get_swap_bio(unsigned int __nocast gfp_flags, pgoff_t index, struct page *page, bio_end_io_t end_io) { struct bio *bio; diff --git a/trunk/mm/shmem.c b/trunk/mm/shmem.c index ea064d89cda9..1f7aeb210c7b 100644 --- a/trunk/mm/shmem.c +++ b/trunk/mm/shmem.c @@ -921,7 +921,8 @@ shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx) } static inline struct page * -shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx) +shmem_alloc_page(unsigned int __nocast gfp,struct shmem_inode_info *info, + unsigned long idx) { return alloc_page(gfp | __GFP_ZERO); } diff --git a/trunk/mm/slab.c b/trunk/mm/slab.c index d05c678bceb3..ad113c431e39 100644 --- a/trunk/mm/slab.c +++ b/trunk/mm/slab.c @@ -650,7 +650,8 @@ static inline struct array_cache *ac_data(kmem_cache_t *cachep) return cachep->array[smp_processor_id()]; } -static inline kmem_cache_t *__find_general_cachep(size_t size, gfp_t gfpflags) +static inline kmem_cache_t *__find_general_cachep(size_t size, + unsigned int __nocast gfpflags) { struct cache_sizes *csizep = malloc_sizes; @@ -674,7 +675,8 @@ static inline kmem_cache_t *__find_general_cachep(size_t size, gfp_t gfpflags) return csizep->cs_cachep; } -kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags) +kmem_cache_t *kmem_find_general_cachep(size_t size, + unsigned int __nocast gfpflags) { return __find_general_cachep(size, gfpflags); } @@ -1183,7 +1185,7 @@ __initcall(cpucache_init); * did not request dmaable memory, we might get it, but that * would be relatively rare and ignorable. */ -static void *kmem_getpages(kmem_cache_t *cachep, gfp_t flags, int nodeid) +static void *kmem_getpages(kmem_cache_t *cachep, unsigned int __nocast flags, int nodeid) { struct page *page; void *addr; @@ -2046,7 +2048,7 @@ EXPORT_SYMBOL(kmem_cache_destroy); /* Get the memory for a slab management obj. */ static struct slab* alloc_slabmgmt(kmem_cache_t *cachep, void *objp, - int colour_off, gfp_t local_flags) + int colour_off, unsigned int __nocast local_flags) { struct slab *slabp; @@ -2147,7 +2149,7 @@ static void set_slab_attr(kmem_cache_t *cachep, struct slab *slabp, void *objp) * Grow (by 1) the number of slabs within a cache. This is called by * kmem_cache_alloc() when there are no active objs left in a cache. */ -static int cache_grow(kmem_cache_t *cachep, gfp_t flags, int nodeid) +static int cache_grow(kmem_cache_t *cachep, unsigned int __nocast flags, int nodeid) { struct slab *slabp; void *objp; @@ -2354,7 +2356,7 @@ static void check_slabp(kmem_cache_t *cachep, struct slab *slabp) #define check_slabp(x,y) do { } while(0) #endif -static void *cache_alloc_refill(kmem_cache_t *cachep, gfp_t flags) +static void *cache_alloc_refill(kmem_cache_t *cachep, unsigned int __nocast flags) { int batchcount; struct kmem_list3 *l3; @@ -2454,7 +2456,7 @@ static void *cache_alloc_refill(kmem_cache_t *cachep, gfp_t flags) } static inline void -cache_alloc_debugcheck_before(kmem_cache_t *cachep, gfp_t flags) +cache_alloc_debugcheck_before(kmem_cache_t *cachep, unsigned int __nocast flags) { might_sleep_if(flags & __GFP_WAIT); #if DEBUG @@ -2465,7 +2467,7 @@ cache_alloc_debugcheck_before(kmem_cache_t *cachep, gfp_t flags) #if DEBUG static void * cache_alloc_debugcheck_after(kmem_cache_t *cachep, - gfp_t flags, void *objp, void *caller) + unsigned int __nocast flags, void *objp, void *caller) { if (!objp) return objp; @@ -2508,12 +2510,16 @@ cache_alloc_debugcheck_after(kmem_cache_t *cachep, #define cache_alloc_debugcheck_after(a,b,objp,d) (objp) #endif -static inline void *____cache_alloc(kmem_cache_t *cachep, gfp_t flags) + +static inline void *__cache_alloc(kmem_cache_t *cachep, unsigned int __nocast flags) { + unsigned long save_flags; void* objp; struct array_cache *ac; - check_irq_off(); + cache_alloc_debugcheck_before(cachep, flags); + + local_irq_save(save_flags); ac = ac_data(cachep); if (likely(ac->avail)) { STATS_INC_ALLOCHIT(cachep); @@ -2523,18 +2529,6 @@ static inline void *____cache_alloc(kmem_cache_t *cachep, gfp_t flags) STATS_INC_ALLOCMISS(cachep); objp = cache_alloc_refill(cachep, flags); } - return objp; -} - -static inline void *__cache_alloc(kmem_cache_t *cachep, gfp_t flags) -{ - unsigned long save_flags; - void* objp; - - cache_alloc_debugcheck_before(cachep, flags); - - local_irq_save(save_flags); - objp = ____cache_alloc(cachep, flags); local_irq_restore(save_flags); objp = cache_alloc_debugcheck_after(cachep, flags, objp, __builtin_return_address(0)); @@ -2785,7 +2779,7 @@ static inline void __cache_free(kmem_cache_t *cachep, void *objp) * Allocate an object from this cache. The flags are only relevant * if the cache has no available objects. */ -void *kmem_cache_alloc(kmem_cache_t *cachep, gfp_t flags) +void *kmem_cache_alloc(kmem_cache_t *cachep, unsigned int __nocast flags) { return __cache_alloc(cachep, flags); } @@ -2846,7 +2840,7 @@ int fastcall kmem_ptr_validate(kmem_cache_t *cachep, void *ptr) * New and improved: it will now make sure that the object gets * put on the correct node list so that there is no false sharing. */ -void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int nodeid) +void *kmem_cache_alloc_node(kmem_cache_t *cachep, unsigned int __nocast flags, int nodeid) { unsigned long save_flags; void *ptr; @@ -2862,10 +2856,7 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int nodeid) cache_alloc_debugcheck_before(cachep, flags); local_irq_save(save_flags); - if (nodeid == numa_node_id()) - ptr = ____cache_alloc(cachep, flags); - else - ptr = __cache_alloc_node(cachep, flags, nodeid); + ptr = __cache_alloc_node(cachep, flags, nodeid); local_irq_restore(save_flags); ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, __builtin_return_address(0)); @@ -2873,7 +2864,7 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int nodeid) } EXPORT_SYMBOL(kmem_cache_alloc_node); -void *kmalloc_node(size_t size, gfp_t flags, int node) +void *kmalloc_node(size_t size, unsigned int __nocast flags, int node) { kmem_cache_t *cachep; @@ -2906,7 +2897,7 @@ EXPORT_SYMBOL(kmalloc_node); * platforms. For example, on i386, it means that the memory must come * from the first 16MB. */ -void *__kmalloc(size_t size, gfp_t flags) +void *__kmalloc(size_t size, unsigned int __nocast flags) { kmem_cache_t *cachep; @@ -2916,8 +2907,7 @@ void *__kmalloc(size_t size, gfp_t flags) * functions. */ cachep = __find_general_cachep(size, flags); - if (unlikely(cachep == NULL)) - return NULL; + BUG_ON(!cachep); /* Allocation size too large for kmalloc */ return __cache_alloc(cachep, flags); } EXPORT_SYMBOL(__kmalloc); @@ -2995,7 +2985,7 @@ EXPORT_SYMBOL(kmem_cache_free); * @size: how many bytes of memory are required. * @flags: the type of memory to allocate. */ -void *kzalloc(size_t size, gfp_t flags) +void *kzalloc(size_t size, unsigned int __nocast flags) { void *ret = kmalloc(size, flags); if (ret) @@ -3601,7 +3591,7 @@ unsigned int ksize(const void *objp) * @s: the string to duplicate * @gfp: the GFP mask used in the kmalloc() call when allocating memory */ -char *kstrdup(const char *s, gfp_t gfp) +char *kstrdup(const char *s, unsigned int __nocast gfp) { size_t len; char *buf; diff --git a/trunk/mm/swap_state.c b/trunk/mm/swap_state.c index 132164f7d0a7..adbc2b426c2f 100644 --- a/trunk/mm/swap_state.c +++ b/trunk/mm/swap_state.c @@ -68,7 +68,7 @@ void show_swap_cache_info(void) * but sets SwapCache flag and private instead of mapping and index. */ static int __add_to_swap_cache(struct page *page, swp_entry_t entry, - gfp_t gfp_mask) + unsigned int __nocast gfp_mask) { int error; diff --git a/trunk/mm/vmalloc.c b/trunk/mm/vmalloc.c index 1150229b6366..13c3d82968ae 100644 --- a/trunk/mm/vmalloc.c +++ b/trunk/mm/vmalloc.c @@ -395,7 +395,7 @@ void *vmap(struct page **pages, unsigned int count, EXPORT_SYMBOL(vmap); -void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot) +void *__vmalloc_area(struct vm_struct *area, unsigned int __nocast gfp_mask, pgprot_t prot) { struct page **pages; unsigned int nr_pages, array_size, i; @@ -446,7 +446,7 @@ void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot) * allocator with @gfp_mask flags. Map them into contiguous * kernel virtual space, using a pagetable protection of @prot. */ -void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot) +void *__vmalloc(unsigned long size, unsigned int __nocast gfp_mask, pgprot_t prot) { struct vm_struct *area; diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index 64f9570cff56..0ea71e887bb6 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -511,11 +511,10 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) * PageDirty _after_ making sure that the page is freeable and * not in use by anybody. (pagecache + us == 2) */ - if (unlikely(page_count(page) != 2)) - goto cannot_free; - smp_rmb(); - if (unlikely(PageDirty(page))) - goto cannot_free; + if (page_count(page) != 2 || PageDirty(page)) { + write_unlock_irq(&mapping->tree_lock); + goto keep_locked; + } #ifdef CONFIG_SWAP if (PageSwapCache(page)) { @@ -539,10 +538,6 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) __pagevec_release_nonlru(&freed_pvec); continue; -cannot_free: - write_unlock_irq(&mapping->tree_lock); - goto keep_locked; - activate_locked: SetPageActive(page); pgactivate++; diff --git a/trunk/net/802/p8022.c b/trunk/net/802/p8022.c index 2530f35241cd..b24817c63ca8 100644 --- a/trunk/net/802/p8022.c +++ b/trunk/net/802/p8022.c @@ -56,7 +56,7 @@ struct datalink_proto *register_8022_client(unsigned char type, void unregister_8022_client(struct datalink_proto *proto) { - llc_sap_put(proto->sap); + llc_sap_close(proto->sap); kfree(proto); } diff --git a/trunk/net/802/psnap.c b/trunk/net/802/psnap.c index 4d638944d933..ab80b1fab53c 100644 --- a/trunk/net/802/psnap.c +++ b/trunk/net/802/psnap.c @@ -106,7 +106,7 @@ module_init(snap_init); static void __exit snap_exit(void) { - llc_sap_put(snap_sap); + llc_sap_close(snap_sap); } module_exit(snap_exit); diff --git a/trunk/net/802/tr.c b/trunk/net/802/tr.c index 1eaa3d19d8bf..1bb7dc1b85cd 100644 --- a/trunk/net/802/tr.c +++ b/trunk/net/802/tr.c @@ -238,7 +238,7 @@ unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev) return trllc->ethertype; } - return ntohs(ETH_P_TR_802_2); + return ntohs(ETH_P_802_2); } /* diff --git a/trunk/net/appletalk/ddp.c b/trunk/net/appletalk/ddp.c index 7982656b9c83..1d31b3a3f1e5 100644 --- a/trunk/net/appletalk/ddp.c +++ b/trunk/net/appletalk/ddp.c @@ -100,7 +100,8 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, continue; if (to->sat_addr.s_net == ATADDR_ANYNET && - to->sat_addr.s_node == ATADDR_BCAST) + to->sat_addr.s_node == ATADDR_BCAST && + at->src_net == atif->address.s_net) goto found; if (to->sat_addr.s_net == at->src_net && @@ -1442,10 +1443,8 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, else atif = atalk_find_interface(ddp->deh_dnet, ddp->deh_dnode); + /* Not ours, so we route the packet via the correct AppleTalk iface */ if (!atif) { - /* Not ours, so we route the packet via the correct - * AppleTalk iface - */ atalk_route_packet(skb, dev, ddp, &ddphv, origlen); goto out; } @@ -1593,6 +1592,9 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr if (usat->sat_addr.s_net || usat->sat_addr.s_node == ATADDR_ANYNODE) { rt = atrtr_find(&usat->sat_addr); + if (!rt) + return -ENETUNREACH; + dev = rt->dev; } else { struct atalk_addr at_hint; @@ -1601,12 +1603,11 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr at_hint.s_net = at->src_net; rt = atrtr_find(&at_hint); + if (!rt) + return -ENETUNREACH; + dev = rt->dev; } - if (!rt) - return -ENETUNREACH; - - dev = rt->dev; SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n", sk, size, dev->name); @@ -1676,20 +1677,6 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr SOCK_DEBUG(sk, "SK %p: Loop back.\n", sk); /* loop back */ skb_orphan(skb); - if (ddp->deh_dnode == ATADDR_BCAST) { - struct atalk_addr at_lo; - - at_lo.s_node = 0; - at_lo.s_net = 0; - - rt = atrtr_find(&at_lo); - if (!rt) { - kfree_skb(skb); - return -ENETUNREACH; - } - dev = rt->dev; - skb->dev = dev; - } ddp_dl->request(ddp_dl, skb, dev->dev_addr); } else { SOCK_DEBUG(sk, "SK %p: send out.\n", sk); diff --git a/trunk/net/atm/addr.c b/trunk/net/atm/addr.c index 3060fd0ba4b9..1c8867f7f54a 100644 --- a/trunk/net/atm/addr.c +++ b/trunk/net/atm/addr.c @@ -44,43 +44,29 @@ static void notify_sigd(struct atm_dev *dev) sigd_enq(NULL, as_itf_notify, NULL, &pvc, NULL); } -void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t atype) +void atm_reset_addr(struct atm_dev *dev) { unsigned long flags; struct atm_dev_addr *this, *p; - struct list_head *head; spin_lock_irqsave(&dev->lock, flags); - if (atype == ATM_ADDR_LECS) - head = &dev->lecs; - else - head = &dev->local; - list_for_each_entry_safe(this, p, head, entry) { - list_del(&this->entry); - kfree(this); - } + list_for_each_entry_safe(this, p, &dev->local, entry) + kfree(this); spin_unlock_irqrestore(&dev->lock, flags); - if (head == &dev->local) - notify_sigd(dev); + notify_sigd(dev); } -int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, - enum atm_addr_type_t atype) +int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr) { unsigned long flags; struct atm_dev_addr *this; - struct list_head *head; int error; error = check_addr(addr); if (error) return error; spin_lock_irqsave(&dev->lock, flags); - if (atype == ATM_ADDR_LECS) - head = &dev->lecs; - else - head = &dev->local; - list_for_each_entry(this, head, entry) { + list_for_each_entry(this, &dev->local, entry) { if (identical(&this->addr, addr)) { spin_unlock_irqrestore(&dev->lock, flags); return -EEXIST; @@ -92,36 +78,28 @@ int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, return -ENOMEM; } this->addr = *addr; - list_add(&this->entry, head); + list_add(&this->entry, &dev->local); spin_unlock_irqrestore(&dev->lock, flags); - if (head == &dev->local) - notify_sigd(dev); + notify_sigd(dev); return 0; } -int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, - enum atm_addr_type_t atype) +int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr) { unsigned long flags; struct atm_dev_addr *this; - struct list_head *head; int error; error = check_addr(addr); if (error) return error; spin_lock_irqsave(&dev->lock, flags); - if (atype == ATM_ADDR_LECS) - head = &dev->lecs; - else - head = &dev->local; - list_for_each_entry(this, head, entry) { + list_for_each_entry(this, &dev->local, entry) { if (identical(&this->addr, addr)) { list_del(&this->entry); spin_unlock_irqrestore(&dev->lock, flags); kfree(this); - if (head == &dev->local) - notify_sigd(dev); + notify_sigd(dev); return 0; } } @@ -130,27 +108,22 @@ int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, } int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user * buf, - size_t size, enum atm_addr_type_t atype) + size_t size) { unsigned long flags; struct atm_dev_addr *this; - struct list_head *head; int total = 0, error; struct sockaddr_atmsvc *tmp_buf, *tmp_bufp; spin_lock_irqsave(&dev->lock, flags); - if (atype == ATM_ADDR_LECS) - head = &dev->lecs; - else - head = &dev->local; - list_for_each_entry(this, head, entry) + list_for_each_entry(this, &dev->local, entry) total += sizeof(struct sockaddr_atmsvc); tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC); if (!tmp_buf) { spin_unlock_irqrestore(&dev->lock, flags); return -ENOMEM; } - list_for_each_entry(this, head, entry) + list_for_each_entry(this, &dev->local, entry) memcpy(tmp_bufp++, &this->addr, sizeof(struct sockaddr_atmsvc)); spin_unlock_irqrestore(&dev->lock, flags); error = total > size ? -E2BIG : total; diff --git a/trunk/net/atm/addr.h b/trunk/net/atm/addr.h index f39433ad45da..3099d21feeaa 100644 --- a/trunk/net/atm/addr.h +++ b/trunk/net/atm/addr.h @@ -9,12 +9,10 @@ #include #include -void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t type); -int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, - enum atm_addr_type_t type); -int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, - enum atm_addr_type_t type); -int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user *buf, - size_t size, enum atm_addr_type_t type); + +void atm_reset_addr(struct atm_dev *dev); +int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); +int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); +int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,size_t size); #endif diff --git a/trunk/net/atm/atm_misc.c b/trunk/net/atm/atm_misc.c index 223c7ad5bd0f..b2113c3454ae 100644 --- a/trunk/net/atm/atm_misc.c +++ b/trunk/net/atm/atm_misc.c @@ -25,7 +25,7 @@ int atm_charge(struct atm_vcc *vcc,int truesize) struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, - gfp_t gfp_flags) + int gfp_flags) { struct sock *sk = sk_atm(vcc); int guess = atm_guess_pdu2truesize(pdu_size); diff --git a/trunk/net/atm/br2684.c b/trunk/net/atm/br2684.c index 72f3f7b8de80..289956c4dd3e 100644 --- a/trunk/net/atm/br2684.c +++ b/trunk/net/atm/br2684.c @@ -220,7 +220,7 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev) /* netif_stop_queue(dev); */ dev_kfree_skb(skb); read_unlock(&devs_lock); - return 0; + return -EUNATCH; } if (!br2684_xmit_vcc(skb, brdev, brvcc)) { /* diff --git a/trunk/net/atm/clip.c b/trunk/net/atm/clip.c index 4f54c9a5e84a..28dab55a4387 100644 --- a/trunk/net/atm/clip.c +++ b/trunk/net/atm/clip.c @@ -310,7 +310,7 @@ static int clip_constructor(struct neighbour *neigh) if (neigh->type != RTN_UNICAST) return -EINVAL; rcu_read_lock(); - in_dev = __in_dev_get_rcu(dev); + in_dev = rcu_dereference(__in_dev_get(dev)); if (!in_dev) { rcu_read_unlock(); return -EINVAL; diff --git a/trunk/net/atm/common.c b/trunk/net/atm/common.c index 63feea49fb13..e93e838069e8 100644 --- a/trunk/net/atm/common.c +++ b/trunk/net/atm/common.c @@ -46,7 +46,7 @@ static void __vcc_insert_socket(struct sock *sk) struct atm_vcc *vcc = atm_sk(sk); struct hlist_head *head = &vcc_hash[vcc->vci & (VCC_HTABLE_SIZE - 1)]; - sk->sk_hash = vcc->vci & (VCC_HTABLE_SIZE - 1); + sk->sk_hashent = vcc->vci & (VCC_HTABLE_SIZE - 1); sk_add_node(sk, head); } @@ -178,6 +178,8 @@ static void vcc_destroy_socket(struct sock *sk) if (vcc->push) vcc->push(vcc, NULL); /* atmarpd has no push */ + vcc_remove_socket(sk); /* no more receive */ + while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { atm_return(vcc,skb->truesize); kfree_skb(skb); @@ -186,8 +188,6 @@ static void vcc_destroy_socket(struct sock *sk) module_put(vcc->dev->ops->owner); atm_dev_put(vcc->dev); } - - vcc_remove_socket(sk); } diff --git a/trunk/net/atm/ioctl.c b/trunk/net/atm/ioctl.c index a150198b05a3..d89056ec44d4 100644 --- a/trunk/net/atm/ioctl.c +++ b/trunk/net/atm/ioctl.c @@ -105,35 +105,17 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) if (!error) sock->state = SS_CONNECTED; goto done; - case ATM_SETBACKEND: - case ATM_NEWBACKENDIF: - { - atm_backend_t backend; - error = get_user(backend, (atm_backend_t __user *) argp); - if (error) - goto done; - switch (backend) { - case ATM_BACKEND_PPP: - request_module("pppoatm"); - break; - case ATM_BACKEND_BR2684: - request_module("br2684"); - break; - } - } - break; - case ATMMPC_CTRL: - case ATMMPC_DATA: - request_module("mpoa"); - break; - case ATMARPD_CTRL: - request_module("clip"); - break; - case ATMLEC_CTRL: - request_module("lec"); + default: break; } + if (cmd == ATMMPC_CTRL || cmd == ATMMPC_DATA) + request_module("mpoa"); + if (cmd == ATMARPD_CTRL) + request_module("clip"); + if (cmd == ATMLEC_CTRL) + request_module("lec"); + error = -ENOIOCTLCMD; down(&ioctl_mutex); diff --git a/trunk/net/atm/lec.c b/trunk/net/atm/lec.c index ad840b9afba8..a0752487026d 100644 --- a/trunk/net/atm/lec.c +++ b/trunk/net/atm/lec.c @@ -686,19 +686,9 @@ static unsigned char lec_ctrl_magic[] = { 0x01, 0x01 }; -#define LEC_DATA_DIRECT_8023 2 -#define LEC_DATA_DIRECT_8025 3 - -static int lec_is_data_direct(struct atm_vcc *vcc) -{ - return ((vcc->sap.blli[0].l3.tr9577.snap[4] == LEC_DATA_DIRECT_8023) || - (vcc->sap.blli[0].l3.tr9577.snap[4] == LEC_DATA_DIRECT_8025)); -} - static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb) { - unsigned long flags; struct net_device *dev = (struct net_device *)vcc->proto_data; struct lec_priv *priv = (struct lec_priv *)dev->priv; @@ -738,8 +728,7 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb) skb_queue_tail(&sk->sk_receive_queue, skb); sk->sk_data_ready(sk, skb->len); } else { /* Data frame, queue to protocol handlers */ - struct lec_arp_table *entry; - unsigned char *src, *dst; + unsigned char *dst; atm_return(vcc,skb->truesize); if (*(uint16_t *)skb->data == htons(priv->lecid) || @@ -752,30 +741,10 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb) return; } #ifdef CONFIG_TR - if (priv->is_trdev) - dst = ((struct lecdatahdr_8025 *) skb->data)->h_dest; + if (priv->is_trdev) dst = ((struct lecdatahdr_8025 *)skb->data)->h_dest; else #endif - dst = ((struct lecdatahdr_8023 *) skb->data)->h_dest; - - /* If this is a Data Direct VCC, and the VCC does not match - * the LE_ARP cache entry, delete the LE_ARP cache entry. - */ - spin_lock_irqsave(&priv->lec_arp_lock, flags); - if (lec_is_data_direct(vcc)) { -#ifdef CONFIG_TR - if (priv->is_trdev) - src = ((struct lecdatahdr_8025 *) skb->data)->h_source; - else -#endif - src = ((struct lecdatahdr_8023 *) skb->data)->h_source; - entry = lec_arp_find(priv, src); - if (entry && entry->vcc != vcc) { - lec_arp_remove(priv, entry); - kfree(entry); - } - } - spin_unlock_irqrestore(&priv->lec_arp_lock, flags); + dst = ((struct lecdatahdr_8023 *)skb->data)->h_dest; if (!(dst[0]&0x01) && /* Never filter Multi/Broadcast */ !priv->is_proxy && /* Proxy wants all the packets */ @@ -2021,12 +1990,6 @@ lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find, found = entry->vcc; goto out; } - /* If the LE_ARP cache entry is still pending, reset count to 0 - * so another LE_ARP request can be made for this frame. - */ - if (entry->status == ESI_ARP_PENDING) { - entry->no_tries = 0; - } /* Data direct VC not yet set up, check to see if the unknown frame count is greater than the limit. If the limit has not been reached, allow the caller to send packet to diff --git a/trunk/net/atm/resources.c b/trunk/net/atm/resources.c index 415d2615d475..a57a9268bd24 100644 --- a/trunk/net/atm/resources.c +++ b/trunk/net/atm/resources.c @@ -40,7 +40,6 @@ static struct atm_dev *__alloc_atm_dev(const char *type) dev->link_rate = ATM_OC3_PCR; spin_lock_init(&dev->lock); INIT_LIST_HEAD(&dev->local); - INIT_LIST_HEAD(&dev->lecs); return dev; } @@ -321,12 +320,10 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) error = -EPERM; goto done; } - atm_reset_addr(dev, ATM_ADDR_LOCAL); + atm_reset_addr(dev); break; case ATM_ADDADDR: case ATM_DELADDR: - case ATM_ADDLECSADDR: - case ATM_DELLECSADDR: if (!capable(CAP_NET_ADMIN)) { error = -EPERM; goto done; @@ -338,21 +335,14 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) error = -EFAULT; goto done; } - if (cmd == ATM_ADDADDR || cmd == ATM_ADDLECSADDR) - error = atm_add_addr(dev, &addr, - (cmd == ATM_ADDADDR ? - ATM_ADDR_LOCAL : ATM_ADDR_LECS)); + if (cmd == ATM_ADDADDR) + error = atm_add_addr(dev, &addr); else - error = atm_del_addr(dev, &addr, - (cmd == ATM_DELADDR ? - ATM_ADDR_LOCAL : ATM_ADDR_LECS)); + error = atm_del_addr(dev, &addr); goto done; } case ATM_GETADDR: - case ATM_GETLECSADDR: - error = atm_get_addr(dev, buf, len, - (cmd == ATM_GETADDR ? - ATM_ADDR_LOCAL : ATM_ADDR_LECS)); + error = atm_get_addr(dev, buf, len); if (error < 0) goto done; size = error; diff --git a/trunk/net/atm/signaling.c b/trunk/net/atm/signaling.c index e7211a7f382c..f7c449ac1800 100644 --- a/trunk/net/atm/signaling.c +++ b/trunk/net/atm/signaling.c @@ -217,9 +217,8 @@ void sigd_enq(struct atm_vcc *vcc,enum atmsvc_msg_type type, static void purge_vcc(struct atm_vcc *vcc) { if (sk_atm(vcc)->sk_family == PF_ATMSVC && - !test_bit(ATM_VF_META, &vcc->flags)) { - set_bit(ATM_VF_RELEASED, &vcc->flags); - clear_bit(ATM_VF_REGIS, &vcc->flags); + !test_bit(ATM_VF_META,&vcc->flags)) { + set_bit(ATM_VF_RELEASED,&vcc->flags); vcc_release_async(vcc, -EUNATCH); } } @@ -244,7 +243,8 @@ static void sigd_close(struct atm_vcc *vcc) sk_for_each(s, node, head) { struct atm_vcc *vcc = atm_sk(s); - purge_vcc(vcc); + if (vcc->dev) + purge_vcc(vcc); } } read_unlock(&vcc_sklist_lock); diff --git a/trunk/net/atm/svc.c b/trunk/net/atm/svc.c index d7b266136bf6..08e46052a3e4 100644 --- a/trunk/net/atm/svc.c +++ b/trunk/net/atm/svc.c @@ -302,7 +302,6 @@ static int svc_listen(struct socket *sock,int backlog) error = -EINVAL; goto out; } - vcc_insert_socket(sk); set_bit(ATM_VF_WAITING, &vcc->flags); prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); sigd_enq(vcc,as_listen,NULL,NULL,&vcc->local); diff --git a/trunk/net/ax25/ax25_in.c b/trunk/net/ax25/ax25_in.c index 73cfc3411c46..810c9c76c2e0 100644 --- a/trunk/net/ax25/ax25_in.c +++ b/trunk/net/ax25/ax25_in.c @@ -123,7 +123,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb) } skb_pull(skb, 1); /* Remove PID */ - skb->mac.raw = skb->nh.raw; + skb->h.raw = skb->data; skb->nh.raw = skb->data; skb->dev = ax25->ax25_dev->dev; skb->pkt_type = PACKET_HOST; diff --git a/trunk/net/bluetooth/l2cap.c b/trunk/net/bluetooth/l2cap.c index 59b2dd36baa7..d3d6bc547212 100644 --- a/trunk/net/bluetooth/l2cap.c +++ b/trunk/net/bluetooth/l2cap.c @@ -372,7 +372,7 @@ static struct proto l2cap_proto = { .obj_size = sizeof(struct l2cap_pinfo) }; -static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, gfp_t prio) +static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) { struct sock *sk; diff --git a/trunk/net/bluetooth/rfcomm/core.c b/trunk/net/bluetooth/rfcomm/core.c index 35adce6482b6..173f46e8cdae 100644 --- a/trunk/net/bluetooth/rfcomm/core.c +++ b/trunk/net/bluetooth/rfcomm/core.c @@ -229,7 +229,7 @@ static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d) d->rx_credits = RFCOMM_DEFAULT_CREDITS; } -struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio) +struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio) { struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio); if (!d) diff --git a/trunk/net/bluetooth/rfcomm/sock.c b/trunk/net/bluetooth/rfcomm/sock.c index a2b30f0aedb7..f49e7e938bfb 100644 --- a/trunk/net/bluetooth/rfcomm/sock.c +++ b/trunk/net/bluetooth/rfcomm/sock.c @@ -284,7 +284,7 @@ static struct proto rfcomm_proto = { .obj_size = sizeof(struct rfcomm_pinfo) }; -static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, gfp_t prio) +static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) { struct rfcomm_dlc *d; struct sock *sk; diff --git a/trunk/net/bluetooth/rfcomm/tty.c b/trunk/net/bluetooth/rfcomm/tty.c index 158a9c46d863..1bca860a6109 100644 --- a/trunk/net/bluetooth/rfcomm/tty.c +++ b/trunk/net/bluetooth/rfcomm/tty.c @@ -286,7 +286,7 @@ static inline void rfcomm_set_owner_w(struct sk_buff *skb, struct rfcomm_dev *de skb->destructor = rfcomm_wfree; } -static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, gfp_t priority) +static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, unsigned int __nocast priority) { if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) { struct sk_buff *skb = alloc_skb(size, priority); diff --git a/trunk/net/bluetooth/sco.c b/trunk/net/bluetooth/sco.c index 997e42df115c..ce7ab7dfa0b2 100644 --- a/trunk/net/bluetooth/sco.c +++ b/trunk/net/bluetooth/sco.c @@ -418,7 +418,7 @@ static struct proto sco_proto = { .obj_size = sizeof(struct sco_pinfo) }; -static struct sock *sco_sock_alloc(struct socket *sock, int proto, gfp_t prio) +static struct sock *sco_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) { struct sock *sk; diff --git a/trunk/net/bridge/br_if.c b/trunk/net/bridge/br_if.c index defcf6a8607c..91bb895375f4 100644 --- a/trunk/net/bridge/br_if.c +++ b/trunk/net/bridge/br_if.c @@ -79,6 +79,7 @@ static void destroy_nbp(struct net_bridge_port *p) { struct net_device *dev = p->dev; + dev->br_port = NULL; p->br = NULL; p->dev = NULL; dev_put(dev); @@ -99,7 +100,6 @@ static void del_nbp(struct net_bridge_port *p) struct net_bridge *br = p->br; struct net_device *dev = p->dev; - dev->br_port = NULL; dev_set_promiscuity(dev, -1); spin_lock_bh(&br->lock); diff --git a/trunk/net/bridge/netfilter/ebtables.c b/trunk/net/bridge/netfilter/ebtables.c index f8ffbf6e2333..c4540144f0f4 100644 --- a/trunk/net/bridge/netfilter/ebtables.c +++ b/trunk/net/bridge/netfilter/ebtables.c @@ -26,7 +26,6 @@ #include #include #include -#include #include /* needed for logical [in,out]-dev filtering */ #include "../br_private.h" @@ -824,11 +823,10 @@ static int translate_table(struct ebt_replace *repl, /* this will get free'd in do_replace()/ebt_register_table() if an error occurs */ newinfo->chainstack = (struct ebt_chainstack **) - vmalloc((highest_possible_processor_id()+1) - * sizeof(struct ebt_chainstack)); + vmalloc(num_possible_cpus() * sizeof(struct ebt_chainstack)); if (!newinfo->chainstack) return -ENOMEM; - for_each_cpu(i) { + for (i = 0; i < num_possible_cpus(); i++) { newinfo->chainstack[i] = vmalloc(udc_cnt * sizeof(struct ebt_chainstack)); if (!newinfo->chainstack[i]) { @@ -897,12 +895,9 @@ static void get_counters(struct ebt_counter *oldcounters, /* counters of cpu 0 */ memcpy(counters, oldcounters, - sizeof(struct ebt_counter) * nentries); - + sizeof(struct ebt_counter) * nentries); /* add other counters to those of cpu 0 */ - for_each_cpu(cpu) { - if (cpu == 0) - continue; + for (cpu = 1; cpu < num_possible_cpus(); cpu++) { counter_base = COUNTER_BASE(oldcounters, nentries, cpu); for (i = 0; i < nentries; i++) { counters[i].pcnt += counter_base[i].pcnt; @@ -934,8 +929,7 @@ static int do_replace(void __user *user, unsigned int len) BUGPRINT("Entries_size never zero\n"); return -EINVAL; } - countersize = COUNTER_OFFSET(tmp.nentries) * - (highest_possible_processor_id()+1); + countersize = COUNTER_OFFSET(tmp.nentries) * num_possible_cpus(); newinfo = (struct ebt_table_info *) vmalloc(sizeof(struct ebt_table_info) + countersize); if (!newinfo) @@ -1028,7 +1022,7 @@ static int do_replace(void __user *user, unsigned int len) vfree(table->entries); if (table->chainstack) { - for_each_cpu(i) + for (i = 0; i < num_possible_cpus(); i++) vfree(table->chainstack[i]); vfree(table->chainstack); } @@ -1046,7 +1040,7 @@ static int do_replace(void __user *user, unsigned int len) vfree(counterstmp); /* can be initialized in translate_table() */ if (newinfo->chainstack) { - for_each_cpu(i) + for (i = 0; i < num_possible_cpus(); i++) vfree(newinfo->chainstack[i]); vfree(newinfo->chainstack); } @@ -1138,8 +1132,7 @@ int ebt_register_table(struct ebt_table *table) return -EINVAL; } - countersize = COUNTER_OFFSET(table->table->nentries) * - (highest_possible_processor_id()+1); + countersize = COUNTER_OFFSET(table->table->nentries) * num_possible_cpus(); newinfo = (struct ebt_table_info *) vmalloc(sizeof(struct ebt_table_info) + countersize); ret = -ENOMEM; @@ -1193,7 +1186,7 @@ int ebt_register_table(struct ebt_table *table) up(&ebt_mutex); free_chainstack: if (newinfo->chainstack) { - for_each_cpu(i) + for (i = 0; i < num_possible_cpus(); i++) vfree(newinfo->chainstack[i]); vfree(newinfo->chainstack); } @@ -1216,7 +1209,7 @@ void ebt_unregister_table(struct ebt_table *table) up(&ebt_mutex); vfree(table->private->entries); if (table->private->chainstack) { - for_each_cpu(i) + for (i = 0; i < num_possible_cpus(); i++) vfree(table->private->chainstack[i]); vfree(table->private->chainstack); } diff --git a/trunk/net/core/datagram.c b/trunk/net/core/datagram.c index 81987df536eb..da9bf71421a7 100644 --- a/trunk/net/core/datagram.c +++ b/trunk/net/core/datagram.c @@ -211,45 +211,74 @@ void skb_free_datagram(struct sock *sk, struct sk_buff *skb) int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset, struct iovec *to, int len) { - int i, err, fraglen, end = 0; - struct sk_buff *next = skb_shinfo(skb)->frag_list; -next_skb: - fraglen = skb_headlen(skb); - i = -1; + int start = skb_headlen(skb); + int i, copy = start - offset; + + /* Copy header. */ + if (copy > 0) { + if (copy > len) + copy = len; + if (memcpy_toiovec(to, skb->data + offset, copy)) + goto fault; + if ((len -= copy) == 0) + return 0; + offset += copy; + } - while (1) { - int start = end; + /* Copy paged appendix. Hmm... why does this look so complicated? */ + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + int end; + + BUG_TRAP(start <= offset + len); - if ((end += fraglen) > offset) { - int copy = end - offset, o = offset - start; + end = start + skb_shinfo(skb)->frags[i].size; + if ((copy = end - offset) > 0) { + int err; + u8 *vaddr; + skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; + struct page *page = frag->page; if (copy > len) copy = len; - if (i == -1) - err = memcpy_toiovec(to, skb->data + o, copy); - else { - skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; - struct page *page = frag->page; - void *p = kmap(page) + frag->page_offset + o; - err = memcpy_toiovec(to, p, copy); - kunmap(page); - } + vaddr = kmap(page); + err = memcpy_toiovec(to, vaddr + frag->page_offset + + offset - start, copy); + kunmap(page); if (err) goto fault; if (!(len -= copy)) return 0; offset += copy; } - if (++i >= skb_shinfo(skb)->nr_frags) - break; - fraglen = skb_shinfo(skb)->frags[i].size; + start = end; } - if (next) { - skb = next; - BUG_ON(skb_shinfo(skb)->frag_list); - next = skb->next; - goto next_skb; + + if (skb_shinfo(skb)->frag_list) { + struct sk_buff *list = skb_shinfo(skb)->frag_list; + + for (; list; list = list->next) { + int end; + + BUG_TRAP(start <= offset + len); + + end = start + list->len; + if ((copy = end - offset) > 0) { + if (copy > len) + copy = len; + if (skb_copy_datagram_iovec(list, + offset - start, + to, copy)) + goto fault; + if ((len -= copy) == 0) + return 0; + offset += copy; + } + start = end; + } } + if (!len) + return 0; + fault: return -EFAULT; } diff --git a/trunk/net/core/dev.c b/trunk/net/core/dev.c index a44eeef24edf..c01511e3d0c1 100644 --- a/trunk/net/core/dev.c +++ b/trunk/net/core/dev.c @@ -574,8 +574,6 @@ struct net_device *dev_getbyhwaddr(unsigned short type, char *ha) return dev; } -EXPORT_SYMBOL(dev_getbyhwaddr); - struct net_device *dev_getfirstbyhwtype(unsigned short type) { struct net_device *dev; @@ -1132,7 +1130,7 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb) #endif /* Keep head the same: replace data */ -int __skb_linearize(struct sk_buff *skb, gfp_t gfp_mask) +int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp_mask) { unsigned int size; u8 *data; @@ -1259,8 +1257,6 @@ int dev_queue_xmit(struct sk_buff *skb) if (skb_checksum_help(skb, 0)) goto out_kfree_skb; - spin_lock_prefetch(&dev->queue_lock); - /* Disable soft irqs for various locks below. Also * stops preemption for RCU. */ diff --git a/trunk/net/core/neighbour.c b/trunk/net/core/neighbour.c index 4128fc76ac3a..39fc55edf691 100644 --- a/trunk/net/core/neighbour.c +++ b/trunk/net/core/neighbour.c @@ -61,9 +61,7 @@ static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev); void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); static struct neigh_table *neigh_tables; -#ifdef CONFIG_PROC_FS static struct file_operations neigh_stat_seq_fops; -#endif /* Neighbour hash table buckets are protected with rwlock tbl->lock. @@ -727,13 +725,6 @@ static __inline__ int neigh_max_probes(struct neighbour *n) p->ucast_probes + p->app_probes + p->mcast_probes); } -static inline void neigh_add_timer(struct neighbour *n, unsigned long when) -{ - if (unlikely(mod_timer(&n->timer, when))) { - printk("NEIGH: BUG, double timer add, state is %x\n", - n->nud_state); - } -} /* Called when a timer expires for a neighbour entry. */ @@ -818,7 +809,8 @@ static void neigh_timer_handler(unsigned long arg) neigh_hold(neigh); if (time_before(next, jiffies + HZ/2)) next = jiffies + HZ/2; - neigh_add_timer(neigh, next); + neigh->timer.expires = next; + add_timer(&neigh->timer); } if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) { struct sk_buff *skb = skb_peek(&neigh->arp_queue); @@ -860,7 +852,8 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) atomic_set(&neigh->probes, neigh->parms->ucast_probes); neigh->nud_state = NUD_INCOMPLETE; neigh_hold(neigh); - neigh_add_timer(neigh, now + 1); + neigh->timer.expires = now + 1; + add_timer(&neigh->timer); } else { neigh->nud_state = NUD_FAILED; write_unlock_bh(&neigh->lock); @@ -873,8 +866,8 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); neigh_hold(neigh); neigh->nud_state = NUD_DELAY; - neigh_add_timer(neigh, - jiffies + neigh->parms->delay_probe_time); + neigh->timer.expires = jiffies + neigh->parms->delay_probe_time; + add_timer(&neigh->timer); } if (neigh->nud_state == NUD_INCOMPLETE) { @@ -1020,10 +1013,10 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, neigh_del_timer(neigh); if (new & NUD_IN_TIMER) { neigh_hold(neigh); - neigh_add_timer(neigh, (jiffies + + neigh->timer.expires = jiffies + ((new & NUD_REACHABLE) ? - neigh->parms->reachable_time : - 0))); + neigh->parms->reachable_time : 0); + add_timer(&neigh->timer); } neigh->nud_state = new; } diff --git a/trunk/net/core/netpoll.c b/trunk/net/core/netpoll.c index 802fe11efad0..5265dfd69928 100644 --- a/trunk/net/core/netpoll.c +++ b/trunk/net/core/netpoll.c @@ -703,7 +703,7 @@ int netpoll_setup(struct netpoll *np) if (!np->local_ip) { rcu_read_lock(); - in_dev = __in_dev_get_rcu(ndev); + in_dev = __in_dev_get(ndev); if (!in_dev || !in_dev->ifa_list) { rcu_read_unlock(); diff --git a/trunk/net/core/pktgen.c b/trunk/net/core/pktgen.c index 5f043d346694..ef430b1e8e42 100644 --- a/trunk/net/core/pktgen.c +++ b/trunk/net/core/pktgen.c @@ -186,7 +186,7 @@ /* Used to help with determining the pkts on receive */ #define PKTGEN_MAGIC 0xbe9be955 -#define PG_PROC_DIR "net/pktgen" +#define PG_PROC_DIR "pktgen" #define MAX_CFLOWS 65536 @@ -1476,7 +1476,18 @@ static int proc_thread_write(struct file *file, const char __user *user_buffer, static int create_proc_dir(void) { - pg_proc_dir = proc_mkdir(PG_PROC_DIR, NULL); + int len; + /* does proc_dir already exists */ + len = strlen(PG_PROC_DIR); + + for (pg_proc_dir = proc_net->subdir; pg_proc_dir; pg_proc_dir=pg_proc_dir->next) { + if ((pg_proc_dir->namelen == len) && + (! memcmp(pg_proc_dir->name, PG_PROC_DIR, len))) + break; + } + + if (!pg_proc_dir) + pg_proc_dir = create_proc_entry(PG_PROC_DIR, S_IFDIR, proc_net); if (!pg_proc_dir) return -ENODEV; @@ -1486,7 +1497,7 @@ static int create_proc_dir(void) static int remove_proc_dir(void) { - remove_proc_entry(PG_PROC_DIR, NULL); + remove_proc_entry(PG_PROC_DIR, proc_net); return 0; } @@ -1667,12 +1678,13 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) struct in_device *in_dev; rcu_read_lock(); - in_dev = __in_dev_get_rcu(pkt_dev->odev); + in_dev = __in_dev_get(pkt_dev->odev); if (in_dev) { if (in_dev->ifa_list) { pkt_dev->saddr_min = in_dev->ifa_list->ifa_address; pkt_dev->saddr_max = pkt_dev->saddr_min; } + __in_dev_put(in_dev); } rcu_read_unlock(); } @@ -2896,7 +2908,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char* ifname) pkt_dev->udp_dst_max = 9; strncpy(pkt_dev->ifname, ifname, 31); - sprintf(pkt_dev->fname, "%s/%s", PG_PROC_DIR, ifname); + sprintf(pkt_dev->fname, "net/%s/%s", PG_PROC_DIR, ifname); if (! pktgen_setup_dev(pkt_dev)) { printk("pktgen: ERROR: pktgen_setup_dev failed.\n"); @@ -2969,7 +2981,7 @@ static int pktgen_create_thread(const char* name, int cpu) spin_lock_init(&t->if_lock); t->cpu = cpu; - sprintf(t->fname, "%s/%s", PG_PROC_DIR, t->name); + sprintf(t->fname, "net/%s/%s", PG_PROC_DIR, t->name); t->proc_ent = create_proc_entry(t->fname, 0600, NULL); if (!t->proc_ent) { printk("pktgen: cannot create %s procfs entry.\n", t->fname); @@ -3052,7 +3064,7 @@ static int __init pg_init(void) create_proc_dir(); - sprintf(module_fname, "%s/pgctrl", PG_PROC_DIR); + sprintf(module_fname, "net/%s/pgctrl", PG_PROC_DIR); module_proc_ent = create_proc_entry(module_fname, 0600, NULL); if (!module_proc_ent) { printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname); diff --git a/trunk/net/core/skbuff.c b/trunk/net/core/skbuff.c index af9b1516e21f..f80a28785610 100644 --- a/trunk/net/core/skbuff.c +++ b/trunk/net/core/skbuff.c @@ -71,6 +71,8 @@ static kmem_cache_t *skbuff_head_cache __read_mostly; static kmem_cache_t *skbuff_fclone_cache __read_mostly; +struct timeval __read_mostly skb_tv_base; + /* * Keep out-of-line to prevent kernel bloat. * __builtin_return_address is not used because it is not always @@ -130,7 +132,7 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here) * Buffers may only be allocated from interrupts using a @gfp_mask of * %GFP_ATOMIC. */ -struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, +struct sk_buff *__alloc_skb(unsigned int size, unsigned int __nocast gfp_mask, int fclone) { struct sk_buff *skb; @@ -198,7 +200,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, */ struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, unsigned int size, - gfp_t gfp_mask) + unsigned int __nocast gfp_mask) { struct sk_buff *skb; u8 *data; @@ -361,7 +363,7 @@ void __kfree_skb(struct sk_buff *skb) * %GFP_ATOMIC. */ -struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) +struct sk_buff *skb_clone(struct sk_buff *skb, unsigned int __nocast gfp_mask) { struct sk_buff *n; @@ -500,7 +502,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) * header is going to be modified. Use pskb_copy() instead. */ -struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask) +struct sk_buff *skb_copy(const struct sk_buff *skb, unsigned int __nocast gfp_mask) { int headerlen = skb->data - skb->head; /* @@ -539,7 +541,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask) * The returned buffer has a reference count of 1. */ -struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask) +struct sk_buff *pskb_copy(struct sk_buff *skb, unsigned int __nocast gfp_mask) { /* * Allocate the copy buffer @@ -598,7 +600,7 @@ struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask) */ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, - gfp_t gfp_mask) + unsigned int __nocast gfp_mask) { int i; u8 *data; @@ -689,7 +691,7 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom) */ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom, int newtailroom, - gfp_t gfp_mask) + unsigned int __nocast gfp_mask) { /* * Allocate the copy buffer @@ -1706,6 +1708,8 @@ void __init skb_init(void) NULL, NULL); if (!skbuff_fclone_cache) panic("cannot create skbuff cache"); + + do_gettimeofday(&skb_tv_base); } EXPORT_SYMBOL(___pskb_trim); @@ -1739,3 +1743,4 @@ EXPORT_SYMBOL(skb_prepare_seq_read); EXPORT_SYMBOL(skb_seq_read); EXPORT_SYMBOL(skb_abort_seq_read); EXPORT_SYMBOL(skb_find_text); +EXPORT_SYMBOL(skb_tv_base); diff --git a/trunk/net/core/sock.c b/trunk/net/core/sock.c index 1c52fe809eda..ac63b56e23b2 100644 --- a/trunk/net/core/sock.c +++ b/trunk/net/core/sock.c @@ -637,7 +637,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, * @prot: struct proto associated with this new sock instance * @zero_it: if we should zero the newly allocated sock */ -struct sock *sk_alloc(int family, gfp_t priority, +struct sock *sk_alloc(int family, unsigned int __nocast priority, struct proto *prot, int zero_it) { struct sock *sk = NULL; @@ -660,20 +660,16 @@ struct sock *sk_alloc(int family, gfp_t priority, sock_lock_init(sk); } - if (security_sk_alloc(sk, family, priority)) - goto out_free; - - if (!try_module_get(prot->owner)) - goto out_free; + if (security_sk_alloc(sk, family, priority)) { + if (slab != NULL) + kmem_cache_free(slab, sk); + else + kfree(sk); + sk = NULL; + } else + __module_get(prot->owner); } return sk; - -out_free: - if (slab != NULL) - kmem_cache_free(slab, sk); - else - kfree(sk); - return NULL; } void sk_free(struct sock *sk) @@ -704,7 +700,7 @@ void sk_free(struct sock *sk) module_put(owner); } -struct sock *sk_clone(const struct sock *sk, const gfp_t priority) +struct sock *sk_clone(const struct sock *sk, const unsigned int __nocast priority) { struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0); @@ -845,7 +841,7 @@ unsigned long sock_i_ino(struct sock *sk) * Allocate a skb from the socket's send buffer. */ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, - gfp_t priority) + unsigned int __nocast priority) { if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { struct sk_buff * skb = alloc_skb(size, priority); @@ -861,7 +857,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, * Allocate a skb from the socket's receive buffer. */ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, - gfp_t priority) + unsigned int __nocast priority) { if (force || atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf) { struct sk_buff *skb = alloc_skb(size, priority); @@ -876,7 +872,7 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, /* * Allocate a memory block from the socket's option memory buffer. */ -void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) +void *sock_kmalloc(struct sock *sk, int size, unsigned int __nocast priority) { if ((unsigned)size <= sysctl_optmem_max && atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { diff --git a/trunk/net/dccp/ackvec.c b/trunk/net/dccp/ackvec.c index c9a62cca22fc..6530283eafca 100644 --- a/trunk/net/dccp/ackvec.c +++ b/trunk/net/dccp/ackvec.c @@ -91,7 +91,7 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) } struct dccp_ackvec *dccp_ackvec_alloc(const unsigned int len, - const gfp_t priority) + const unsigned int __nocast priority) { struct dccp_ackvec *av = kmalloc(sizeof(*av) + len, priority); diff --git a/trunk/net/dccp/ackvec.h b/trunk/net/dccp/ackvec.h index d0fd6c60c574..8ca51c9191f7 100644 --- a/trunk/net/dccp/ackvec.h +++ b/trunk/net/dccp/ackvec.h @@ -74,7 +74,7 @@ struct sk_buff; #ifdef CONFIG_IP_DCCP_ACKVEC extern struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len, - const gfp_t priority); + const unsigned int __nocast priority); extern void dccp_ackvec_free(struct dccp_ackvec *av); extern 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) } #else /* CONFIG_IP_DCCP_ACKVEC */ static inline struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len, - const gfp_t priority) + const unsigned int __nocast priority) { return NULL; } diff --git a/trunk/net/dccp/ccid.h b/trunk/net/dccp/ccid.h index c37eeeaf5c6e..21e55142dcd3 100644 --- a/trunk/net/dccp/ccid.h +++ b/trunk/net/dccp/ccid.h @@ -110,14 +110,14 @@ static inline int ccid_hc_tx_init(struct ccid *ccid, struct sock *sk) static inline void ccid_hc_rx_exit(struct ccid *ccid, struct sock *sk) { - if (ccid != NULL && ccid->ccid_hc_rx_exit != NULL && + if (ccid->ccid_hc_rx_exit != NULL && dccp_sk(sk)->dccps_hc_rx_ccid_private != NULL) ccid->ccid_hc_rx_exit(sk); } static inline void ccid_hc_tx_exit(struct ccid *ccid, struct sock *sk) { - if (ccid != NULL && ccid->ccid_hc_tx_exit != NULL && + if (ccid->ccid_hc_tx_exit != NULL && dccp_sk(sk)->dccps_hc_tx_ccid_private != NULL) ccid->ccid_hc_tx_exit(sk); } diff --git a/trunk/net/dccp/ccids/lib/loss_interval.h b/trunk/net/dccp/ccids/lib/loss_interval.h index 417d9d82df3e..13ad47ba1420 100644 --- a/trunk/net/dccp/ccids/lib/loss_interval.h +++ b/trunk/net/dccp/ccids/lib/loss_interval.h @@ -36,7 +36,7 @@ struct dccp_li_hist_entry { static inline struct dccp_li_hist_entry * dccp_li_hist_entry_new(struct dccp_li_hist *hist, - const gfp_t prio) + const unsigned int __nocast prio) { return kmem_cache_alloc(hist->dccplih_slab, prio); } diff --git a/trunk/net/dccp/ccids/lib/packet_history.h b/trunk/net/dccp/ccids/lib/packet_history.h index 122e96737ff6..b375ebdb7dcf 100644 --- a/trunk/net/dccp/ccids/lib/packet_history.h +++ b/trunk/net/dccp/ccids/lib/packet_history.h @@ -86,7 +86,7 @@ extern struct dccp_rx_hist_entry * static inline struct dccp_tx_hist_entry * dccp_tx_hist_entry_new(struct dccp_tx_hist *hist, - const gfp_t prio) + const unsigned int __nocast prio) { struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab, prio); @@ -137,7 +137,7 @@ static inline struct dccp_rx_hist_entry * const struct sock *sk, const u32 ndp, const struct sk_buff *skb, - const gfp_t prio) + const unsigned int __nocast prio) { struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab, prio); diff --git a/trunk/net/dccp/input.c b/trunk/net/dccp/input.c index 3454d5941900..1b6b2cb12376 100644 --- a/trunk/net/dccp/input.c +++ b/trunk/net/dccp/input.c @@ -375,9 +375,6 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk, case DCCP_PKT_RESET: inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); break; - case DCCP_PKT_DATA: - if (sk->sk_state == DCCP_RESPOND) - break; case DCCP_PKT_DATAACK: case DCCP_PKT_ACK: /* @@ -396,8 +393,7 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk, dccp_sk(sk)->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; dccp_set_state(sk, DCCP_OPEN); - if (dh->dccph_type == DCCP_PKT_DATAACK || - dh->dccph_type == DCCP_PKT_DATA) { + if (dh->dccph_type == DCCP_PKT_DATAACK) { dccp_rcv_established(sk, skb, dh, len); queued = 1; /* packet was queued (by dccp_rcv_established) */ diff --git a/trunk/net/dccp/ipv4.c b/trunk/net/dccp/ipv4.c index ae088d1347af..40fe6afacde6 100644 --- a/trunk/net/dccp/ipv4.c +++ b/trunk/net/dccp/ipv4.c @@ -62,27 +62,27 @@ static int __dccp_v4_check_established(struct sock *sk, const __u16 lport, const int dif = sk->sk_bound_dev_if; INET_ADDR_COOKIE(acookie, saddr, daddr) const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport); - unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); - struct inet_ehash_bucket *head = inet_ehash_bucket(&dccp_hashinfo, hash); + const int hash = inet_ehashfn(daddr, lport, saddr, inet->dport, + dccp_hashinfo.ehash_size); + struct inet_ehash_bucket *head = &dccp_hashinfo.ehash[hash]; const struct sock *sk2; const struct hlist_node *node; struct inet_timewait_sock *tw; - prefetch(head->chain.first); write_lock(&head->lock); /* Check TIME-WAIT sockets first. */ sk_for_each(sk2, node, &(head + dccp_hashinfo.ehash_size)->chain) { tw = inet_twsk(sk2); - if (INET_TW_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif)) + if (INET_TW_MATCH(sk2, acookie, saddr, daddr, ports, dif)) goto not_unique; } tw = NULL; /* And established part... */ sk_for_each(sk2, node, &head->chain) { - if (INET_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif)) + if (INET_MATCH(sk2, acookie, saddr, daddr, ports, dif)) goto not_unique; } @@ -90,7 +90,7 @@ static int __dccp_v4_check_established(struct sock *sk, const __u16 lport, * in hash table socket with a funny identity. */ inet->num = lport; inet->sport = htons(lport); - sk->sk_hash = hash; + sk->sk_hashent = hash; BUG_TRAP(sk_unhashed(sk)); __sk_add_node(sk, &head->chain); sock_prot_inc_use(sk->sk_prot); diff --git a/trunk/net/decnet/af_decnet.c b/trunk/net/decnet/af_decnet.c index 1186dc44cdff..348f36b529f7 100644 --- a/trunk/net/decnet/af_decnet.c +++ b/trunk/net/decnet/af_decnet.c @@ -452,7 +452,7 @@ static struct proto dn_proto = { .obj_size = sizeof(struct dn_sock), }; -static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp) +static struct sock *dn_alloc_sock(struct socket *sock, int gfp) { struct dn_scp *scp; struct sock *sk = sk_alloc(PF_DECnet, gfp, &dn_proto, 1); @@ -804,7 +804,7 @@ static int dn_auto_bind(struct socket *sock) return rv; } -static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) +static int dn_confirm_accept(struct sock *sk, long *timeo, int allocation) { struct dn_scp *scp = DN_SK(sk); DEFINE_WAIT(wait); diff --git a/trunk/net/decnet/dn_nsp_out.c b/trunk/net/decnet/dn_nsp_out.c index c96c767b1f74..53633d352868 100644 --- a/trunk/net/decnet/dn_nsp_out.c +++ b/trunk/net/decnet/dn_nsp_out.c @@ -117,7 +117,7 @@ static void dn_nsp_send(struct sk_buff *skb) * The eventual aim is for each socket to have a cached header size * for its outgoing packets, and to set hdr from this when sk != NULL. */ -struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri) +struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri) { struct sk_buff *skb; int hdr = 64; @@ -210,8 +210,7 @@ static void dn_nsp_rtt(struct sock *sk, long rtt) * * Returns: The number of times the packet has been sent previously */ -static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb, - gfp_t gfp) +static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb, int gfp) { struct dn_skb_cb *cb = DN_SKB_CB(skb); struct sk_buff *skb2; @@ -351,8 +350,7 @@ static unsigned short *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *sk return ptr; } -void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, - gfp_t gfp, int oth) +void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, int gfp, int oth) { struct dn_scp *scp = DN_SK(sk); struct dn_skb_cb *cb = DN_SKB_CB(skb); @@ -519,7 +517,7 @@ static int dn_nsp_retrans_conn_conf(struct sock *sk) return 0; } -void dn_send_conn_conf(struct sock *sk, gfp_t gfp) +void dn_send_conn_conf(struct sock *sk, int gfp) { struct dn_scp *scp = DN_SK(sk); struct sk_buff *skb = NULL; @@ -551,8 +549,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, - unsigned short reason, gfp_t gfp, - struct dst_entry *dst, + unsigned short reason, int gfp, struct dst_entry *dst, int ddl, unsigned char *dd, __u16 rem, __u16 loc) { struct sk_buff *skb = NULL; @@ -594,7 +591,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, - unsigned short reason, gfp_t gfp) + unsigned short reason, int gfp) { struct dn_scp *scp = DN_SK(sk); int ddl = 0; @@ -615,7 +612,7 @@ void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg, { struct dn_skb_cb *cb = DN_SKB_CB(skb); int ddl = 0; - gfp_t gfp = GFP_ATOMIC; + int gfp = GFP_ATOMIC; dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, NULL, cb->src_port, cb->dst_port); @@ -627,7 +624,7 @@ void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval) struct dn_scp *scp = DN_SK(sk); struct sk_buff *skb; unsigned char *ptr; - gfp_t gfp = GFP_ATOMIC; + int gfp = GFP_ATOMIC; if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL) return; @@ -662,7 +659,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) unsigned char menuver; struct dn_skb_cb *cb; unsigned char type = 1; - gfp_t allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC; + int allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC; struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation); if (!skb) diff --git a/trunk/net/econet/af_econet.c b/trunk/net/econet/af_econet.c index 34fdac51df96..4a62093eb343 100644 --- a/trunk/net/econet/af_econet.c +++ b/trunk/net/econet/af_econet.c @@ -406,7 +406,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, unsigned long network = 0; rcu_read_lock(); - idev = __in_dev_get_rcu(dev); + idev = __in_dev_get(dev); if (idev) { if (idev->ifa_list) network = ntohl(idev->ifa_list->ifa_address) & diff --git a/trunk/net/ethernet/eth.c b/trunk/net/ethernet/eth.c index 68a5ca866442..87a052a9a84f 100644 --- a/trunk/net/ethernet/eth.c +++ b/trunk/net/ethernet/eth.c @@ -146,19 +146,6 @@ int eth_rebuild_header(struct sk_buff *skb) return 0; } -static inline unsigned int compare_eth_addr(const unsigned char *__a, const unsigned char *__b) -{ - const unsigned short *dest = (unsigned short *) __a; - const unsigned short *devaddr = (unsigned short *) __b; - unsigned int res; - - BUILD_BUG_ON(ETH_ALEN != 6); - res = ((dest[0] ^ devaddr[0]) | - (dest[1] ^ devaddr[1]) | - (dest[2] ^ devaddr[2])) != 0; - - return res; -} /* * Determine the packet's protocol ID. The rule here is that we @@ -171,15 +158,16 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) struct ethhdr *eth; unsigned char *rawp; - skb->mac.raw = skb->data; + skb->mac.raw=skb->data; skb_pull(skb,ETH_HLEN); eth = eth_hdr(skb); - if (*eth->h_dest&1) { - if (!compare_eth_addr(eth->h_dest, dev->broadcast)) - skb->pkt_type = PACKET_BROADCAST; + if(*eth->h_dest&1) + { + if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0) + skb->pkt_type=PACKET_BROADCAST; else - skb->pkt_type = PACKET_MULTICAST; + skb->pkt_type=PACKET_MULTICAST; } /* @@ -190,9 +178,10 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) * seems to set IFF_PROMISC. */ - else if(1 /*dev->flags&IFF_PROMISC*/) { - if (unlikely(compare_eth_addr(eth->h_dest, dev->dev_addr))) - skb->pkt_type = PACKET_OTHERHOST; + else if(1 /*dev->flags&IFF_PROMISC*/) + { + if(memcmp(eth->h_dest,dev->dev_addr, ETH_ALEN)) + skb->pkt_type=PACKET_OTHERHOST; } if (ntohs(eth->h_proto) >= 1536) diff --git a/trunk/net/ieee80211/ieee80211_module.c b/trunk/net/ieee80211/ieee80211_module.c index 6059e9e37123..03a47343ddc7 100644 --- a/trunk/net/ieee80211/ieee80211_module.c +++ b/trunk/net/ieee80211/ieee80211_module.c @@ -230,7 +230,7 @@ static int __init ieee80211_init(void) struct proc_dir_entry *e; ieee80211_debug_level = debug; - ieee80211_proc = proc_mkdir(DRV_NAME, proc_net); + ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net); if (ieee80211_proc == NULL) { IEEE80211_ERROR("Unable to create " DRV_NAME " proc directory\n"); diff --git a/trunk/net/ieee80211/ieee80211_tx.c b/trunk/net/ieee80211/ieee80211_tx.c index eed07bbbe6b6..c9aaff3fea1e 100644 --- a/trunk/net/ieee80211/ieee80211_tx.c +++ b/trunk/net/ieee80211/ieee80211_tx.c @@ -207,7 +207,7 @@ void ieee80211_txb_free(struct ieee80211_txb *txb) } static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, - gfp_t gfp_mask) + int gfp_mask) { struct ieee80211_txb *txb; int i; diff --git a/trunk/net/ipv4/arp.c b/trunk/net/ipv4/arp.c index b425748f02d7..8bf312bdea13 100644 --- a/trunk/net/ipv4/arp.c +++ b/trunk/net/ipv4/arp.c @@ -241,7 +241,7 @@ static int arp_constructor(struct neighbour *neigh) neigh->type = inet_addr_type(addr); rcu_read_lock(); - in_dev = __in_dev_get_rcu(dev); + in_dev = rcu_dereference(__in_dev_get(dev)); if (in_dev == NULL) { rcu_read_unlock(); return -EINVAL; @@ -697,6 +697,12 @@ void arp_send(int type, int ptype, u32 dest_ip, arp_xmit(skb); } +static void parp_redo(struct sk_buff *skb) +{ + nf_reset(skb); + arp_rcv(skb, skb->dev, NULL, skb->dev); +} + /* * Process an arp request. */ @@ -916,11 +922,6 @@ static int arp_process(struct sk_buff *skb) return 0; } -static void parp_redo(struct sk_buff *skb) -{ - arp_process(skb); -} - /* * Receive an arp request from the device layer. @@ -989,8 +990,8 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev) ipv4_devconf.proxy_arp = 1; return 0; } - if (__in_dev_get_rtnl(dev)) { - __in_dev_get_rtnl(dev)->cnf.proxy_arp = 1; + if (__in_dev_get(dev)) { + __in_dev_get(dev)->cnf.proxy_arp = 1; return 0; } return -ENXIO; @@ -1095,8 +1096,8 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev) ipv4_devconf.proxy_arp = 0; return 0; } - if (__in_dev_get_rtnl(dev)) { - __in_dev_get_rtnl(dev)->cnf.proxy_arp = 0; + if (__in_dev_get(dev)) { + __in_dev_get(dev)->cnf.proxy_arp = 0; return 0; } return -ENXIO; diff --git a/trunk/net/ipv4/devinet.c b/trunk/net/ipv4/devinet.c index 74f2207e131a..ba2895ae8151 100644 --- a/trunk/net/ipv4/devinet.c +++ b/trunk/net/ipv4/devinet.c @@ -351,7 +351,7 @@ static int inet_insert_ifa(struct in_ifaddr *ifa) static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) { - struct in_device *in_dev = __in_dev_get_rtnl(dev); + struct in_device *in_dev = __in_dev_get(dev); ASSERT_RTNL(); @@ -449,7 +449,7 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg goto out; rc = -ENOBUFS; - if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) { + if ((in_dev = __in_dev_get(dev)) == NULL) { in_dev = inetdev_init(dev); if (!in_dev) goto out; @@ -584,7 +584,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg) if (colon) *colon = ':'; - if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) { + if ((in_dev = __in_dev_get(dev)) != NULL) { if (tryaddrmatch) { /* Matthias Andree */ /* compare label and address (4.4BSD style) */ @@ -748,7 +748,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg) static int inet_gifconf(struct net_device *dev, char __user *buf, int len) { - struct in_device *in_dev = __in_dev_get_rtnl(dev); + struct in_device *in_dev = __in_dev_get(dev); struct in_ifaddr *ifa; struct ifreq ifr; int done = 0; @@ -791,7 +791,7 @@ u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope) struct in_device *in_dev; rcu_read_lock(); - in_dev = __in_dev_get_rcu(dev); + in_dev = __in_dev_get(dev); if (!in_dev) goto no_in_dev; @@ -818,7 +818,7 @@ u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope) read_lock(&dev_base_lock); rcu_read_lock(); for (dev = dev_base; dev; dev = dev->next) { - if ((in_dev = __in_dev_get_rcu(dev)) == NULL) + if ((in_dev = __in_dev_get(dev)) == NULL) continue; for_primary_ifa(in_dev) { @@ -887,7 +887,7 @@ u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scop if (dev) { rcu_read_lock(); - if ((in_dev = __in_dev_get_rcu(dev))) + if ((in_dev = __in_dev_get(dev))) addr = confirm_addr_indev(in_dev, dst, local, scope); rcu_read_unlock(); @@ -897,7 +897,7 @@ u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scop read_lock(&dev_base_lock); rcu_read_lock(); for (dev = dev_base; dev; dev = dev->next) { - if ((in_dev = __in_dev_get_rcu(dev))) { + if ((in_dev = __in_dev_get(dev))) { addr = confirm_addr_indev(in_dev, dst, local, scope); if (addr) break; @@ -957,7 +957,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *dev = ptr; - struct in_device *in_dev = __in_dev_get_rtnl(dev); + struct in_device *in_dev = __in_dev_get(dev); ASSERT_RTNL(); @@ -1078,7 +1078,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) if (idx > s_idx) s_ip_idx = 0; rcu_read_lock(); - if ((in_dev = __in_dev_get_rcu(dev)) == NULL) { + if ((in_dev = __in_dev_get(dev)) == NULL) { rcu_read_unlock(); continue; } @@ -1149,7 +1149,7 @@ void inet_forward_change(void) for (dev = dev_base; dev; dev = dev->next) { struct in_device *in_dev; rcu_read_lock(); - in_dev = __in_dev_get_rcu(dev); + in_dev = __in_dev_get(dev); if (in_dev) in_dev->cnf.forwarding = on; rcu_read_unlock(); diff --git a/trunk/net/ipv4/esp4.c b/trunk/net/ipv4/esp4.c index 1b18ce66e7b7..1b5a09d1b90b 100644 --- a/trunk/net/ipv4/esp4.c +++ b/trunk/net/ipv4/esp4.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -43,10 +42,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) esp = x->data; alen = esp->auth.icv_trunc_len; tfm = esp->conf.tfm; - blksize = ALIGN(crypto_tfm_alg_blocksize(tfm), 4); - clen = ALIGN(clen + 2, blksize); + blksize = (crypto_tfm_alg_blocksize(tfm) + 3) & ~3; + clen = (clen + 2 + blksize-1)&~(blksize-1); if (esp->conf.padlen) - clen = ALIGN(clen, esp->conf.padlen); + clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1); if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) goto error; @@ -144,7 +143,7 @@ static int esp_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struc struct ip_esp_hdr *esph; struct esp_data *esp = x->data; struct sk_buff *trailer; - int blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4); + int blksize = crypto_tfm_alg_blocksize(esp->conf.tfm); int alen = esp->auth.icv_trunc_len; int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen; int nfrags; @@ -305,16 +304,16 @@ static int esp_post_input(struct xfrm_state *x, struct xfrm_decap_state *decap, static u32 esp4_get_max_size(struct xfrm_state *x, int mtu) { struct esp_data *esp = x->data; - u32 blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4); + u32 blksize = crypto_tfm_alg_blocksize(esp->conf.tfm); if (x->props.mode) { - mtu = ALIGN(mtu + 2, blksize); + mtu = (mtu + 2 + blksize-1)&~(blksize-1); } else { /* The worst case. */ - mtu = ALIGN(mtu + 2, 4) + blksize - 4; + mtu += 2 + blksize; } if (esp->conf.padlen) - mtu = ALIGN(mtu, esp->conf.padlen); + mtu = (mtu + esp->conf.padlen-1)&~(esp->conf.padlen-1); return mtu + x->props.header_len + esp->auth.icv_trunc_len; } diff --git a/trunk/net/ipv4/fib_frontend.c b/trunk/net/ipv4/fib_frontend.c index e61bc7177eb1..4e1379f71269 100644 --- a/trunk/net/ipv4/fib_frontend.c +++ b/trunk/net/ipv4/fib_frontend.c @@ -173,7 +173,7 @@ int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, no_addr = rpf = 0; rcu_read_lock(); - in_dev = __in_dev_get_rcu(dev); + in_dev = __in_dev_get(dev); if (in_dev) { no_addr = in_dev->ifa_list == NULL; rpf = IN_DEV_RPFILTER(in_dev); @@ -607,7 +607,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *dev = ptr; - struct in_device *in_dev = __in_dev_get_rtnl(dev); + struct in_device *in_dev = __in_dev_get(dev); if (event == NETDEV_UNREGISTER) { fib_disable_ip(dev, 2); diff --git a/trunk/net/ipv4/fib_semantics.c b/trunk/net/ipv4/fib_semantics.c index 186f20c4a45e..d41219e8037c 100644 --- a/trunk/net/ipv4/fib_semantics.c +++ b/trunk/net/ipv4/fib_semantics.c @@ -1087,7 +1087,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, rta->rta_oif = &dev->ifindex; if (colon) { struct in_ifaddr *ifa; - struct in_device *in_dev = __in_dev_get_rtnl(dev); + struct in_device *in_dev = __in_dev_get(dev); if (!in_dev) return -ENODEV; *colon = ':'; @@ -1268,7 +1268,7 @@ int fib_sync_up(struct net_device *dev) } if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) continue; - if (nh->nh_dev != dev || !__in_dev_get_rtnl(dev)) + if (nh->nh_dev != dev || __in_dev_get(dev) == NULL) continue; alive++; spin_lock_bh(&fib_multipath_lock); diff --git a/trunk/net/ipv4/fib_trie.c b/trunk/net/ipv4/fib_trie.c index 0093ea08c7f5..50c0519cd70d 100644 --- a/trunk/net/ipv4/fib_trie.c +++ b/trunk/net/ipv4/fib_trie.c @@ -286,8 +286,6 @@ static inline void check_tnode(const struct tnode *tn) static int halve_threshold = 25; static int inflate_threshold = 50; -static int halve_threshold_root = 15; -static int inflate_threshold_root = 25; static void __alias_free_mem(struct rcu_head *head) @@ -451,8 +449,6 @@ static struct node *resize(struct trie *t, struct tnode *tn) int i; int err = 0; struct tnode *old_tn; - int inflate_threshold_use; - int halve_threshold_use; if (!tn) return NULL; @@ -545,17 +541,10 @@ static struct node *resize(struct trie *t, struct tnode *tn) check_tnode(tn); - /* Keep root node larger */ - - if(!tn->parent) - inflate_threshold_use = inflate_threshold_root; - else - inflate_threshold_use = inflate_threshold; - err = 0; while ((tn->full_children > 0 && 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >= - inflate_threshold_use * tnode_child_length(tn))) { + inflate_threshold * tnode_child_length(tn))) { old_tn = tn; tn = inflate(t, tn); @@ -575,18 +564,10 @@ static struct node *resize(struct trie *t, struct tnode *tn) * node is above threshold. */ - - /* Keep root node larger */ - - if(!tn->parent) - halve_threshold_use = halve_threshold_root; - else - halve_threshold_use = halve_threshold; - err = 0; while (tn->bits > 1 && 100 * (tnode_child_length(tn) - tn->empty_children) < - halve_threshold_use * tnode_child_length(tn)) { + halve_threshold * tnode_child_length(tn)) { old_tn = tn; tn = halve(t, tn); diff --git a/trunk/net/ipv4/icmp.c b/trunk/net/ipv4/icmp.c index 90dca711ac9f..24eb56ae1b5a 100644 --- a/trunk/net/ipv4/icmp.c +++ b/trunk/net/ipv4/icmp.c @@ -188,7 +188,7 @@ struct icmp_err icmp_err_convert[] = { /* Control parameters for ECHO replies. */ int sysctl_icmp_echo_ignore_all; -int sysctl_icmp_echo_ignore_broadcasts = 1; +int sysctl_icmp_echo_ignore_broadcasts; /* Control parameter - ignore bogus broadcast responses? */ int sysctl_icmp_ignore_bogus_error_responses; diff --git a/trunk/net/ipv4/igmp.c b/trunk/net/ipv4/igmp.c index 8b6d3939e1e6..70c44e4c3ceb 100644 --- a/trunk/net/ipv4/igmp.c +++ b/trunk/net/ipv4/igmp.c @@ -1323,7 +1323,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr) } if (dev) { imr->imr_ifindex = dev->ifindex; - idev = __in_dev_get_rtnl(dev); + idev = __in_dev_get(dev); } return idev; } diff --git a/trunk/net/ipv4/inet_connection_sock.c b/trunk/net/ipv4/inet_connection_sock.c index 94468a76c5b4..fe3c6d3d0c91 100644 --- a/trunk/net/ipv4/inet_connection_sock.c +++ b/trunk/net/ipv4/inet_connection_sock.c @@ -494,7 +494,7 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_prune); struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req, - const gfp_t priority) + const unsigned int __nocast priority) { struct sock *newsk = sk_clone(sk, priority); diff --git a/trunk/net/ipv4/inet_timewait_sock.c b/trunk/net/ipv4/inet_timewait_sock.c index a010e9a68811..4d1502a49852 100644 --- a/trunk/net/ipv4/inet_timewait_sock.c +++ b/trunk/net/ipv4/inet_timewait_sock.c @@ -20,7 +20,7 @@ void __inet_twsk_kill(struct inet_timewait_sock *tw, struct inet_hashinfo *hashi struct inet_bind_hashbucket *bhead; struct inet_bind_bucket *tb; /* Unlink from established hashes. */ - struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, tw->tw_hash); + struct inet_ehash_bucket *ehead = &hashinfo->ehash[tw->tw_hashent]; write_lock(&ehead->lock); if (hlist_unhashed(&tw->tw_node)) { @@ -60,7 +60,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, { const struct inet_sock *inet = inet_sk(sk); const struct inet_connection_sock *icsk = inet_csk(sk); - struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, sk->sk_hash); + struct inet_ehash_bucket *ehead = &hashinfo->ehash[sk->sk_hashent]; struct inet_bind_hashbucket *bhead; /* Step 1: Put TW into bind hash. Original socket stays there too. Note, that any socket with inet->num != 0 MUST be bound in @@ -106,12 +106,11 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat tw->tw_dport = inet->dport; tw->tw_family = sk->sk_family; tw->tw_reuse = sk->sk_reuse; - tw->tw_hash = sk->sk_hash; + tw->tw_hashent = sk->sk_hashent; tw->tw_ipv6only = 0; tw->tw_prot = sk->sk_prot_creator; atomic_set(&tw->tw_refcnt, 1); inet_twsk_dead_node_init(tw); - __module_get(tw->tw_prot->owner); } return tw; diff --git a/trunk/net/ipv4/ip_gre.c b/trunk/net/ipv4/ip_gre.c index 896ce3f8f53a..f0d5740d7e22 100644 --- a/trunk/net/ipv4/ip_gre.c +++ b/trunk/net/ipv4/ip_gre.c @@ -1104,10 +1104,10 @@ static int ipgre_open(struct net_device *dev) return -EADDRNOTAVAIL; dev = rt->u.dst.dev; ip_rt_put(rt); - if (__in_dev_get_rtnl(dev) == NULL) + if (__in_dev_get(dev) == NULL) return -EADDRNOTAVAIL; t->mlink = dev->ifindex; - ip_mc_inc_group(__in_dev_get_rtnl(dev), t->parms.iph.daddr); + ip_mc_inc_group(__in_dev_get(dev), t->parms.iph.daddr); } return 0; } diff --git a/trunk/net/ipv4/ipmr.c b/trunk/net/ipv4/ipmr.c index 302b7eb507c9..9dbf5909f3a6 100644 --- a/trunk/net/ipv4/ipmr.c +++ b/trunk/net/ipv4/ipmr.c @@ -149,7 +149,7 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v) if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) { dev->flags |= IFF_MULTICAST; - in_dev = __in_dev_get_rtnl(dev); + in_dev = __in_dev_get(dev); if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL) goto failure; in_dev->cnf.rp_filter = 0; @@ -278,7 +278,7 @@ static int vif_delete(int vifi) dev_set_allmulti(dev, -1); - if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) { + if ((in_dev = __in_dev_get(dev)) != NULL) { in_dev->cnf.mc_forwarding--; ip_rt_multicast_event(in_dev); } @@ -421,7 +421,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) return -EINVAL; } - if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) + if ((in_dev = __in_dev_get(dev)) == NULL) return -EADDRNOTAVAIL; in_dev->cnf.mc_forwarding++; dev_set_allmulti(dev, +1); diff --git a/trunk/net/ipv4/ipvs/ip_vs_app.c b/trunk/net/ipv4/ipvs/ip_vs_app.c index fc6f95aaa969..6e092dadb388 100644 --- a/trunk/net/ipv4/ipvs/ip_vs_app.c +++ b/trunk/net/ipv4/ipvs/ip_vs_app.c @@ -604,7 +604,7 @@ static struct file_operations ip_vs_app_fops = { /* * Replace a segment of data with a new segment */ -int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, +int ip_vs_skb_replace(struct sk_buff *skb, int pri, char *o_buf, int o_len, char *n_buf, int n_len) { struct iphdr *iph; diff --git a/trunk/net/ipv4/netfilter/Kconfig b/trunk/net/ipv4/netfilter/Kconfig index 7d917e4ce1d9..3cf9b451675c 100644 --- a/trunk/net/ipv4/netfilter/Kconfig +++ b/trunk/net/ipv4/netfilter/Kconfig @@ -139,10 +139,9 @@ config IP_NF_AMANDA config IP_NF_PPTP tristate 'PPTP protocol support' - depends on IP_NF_CONNTRACK help This module adds support for PPTP (Point to Point Tunnelling - Protocol, RFC2637) connection tracking and NAT. + Protocol, RFC2637) conncection tracking and NAT. If you are running PPTP sessions over a stateful firewall or NAT box, you may want to enable this feature. @@ -499,14 +498,9 @@ config IP_NF_TARGET_LOG To compile it as a module, choose M here. If unsure, say N. config IP_NF_TARGET_ULOG - tristate "ULOG target support (OBSOLETE)" + tristate "ULOG target support" depends on IP_NF_IPTABLES ---help--- - - This option enables the old IPv4-only "ipt_ULOG" implementation - which has been obsoleted by the new "nfnetlink_log" code (see - CONFIG_NETFILTER_NETLINK_LOG). - This option adds a `ULOG' target, which allows you to create rules in any iptables table. The packet is passed to a userspace logging daemon using netlink multicast sockets; unlike the LOG target @@ -543,17 +537,6 @@ config IP_NF_TARGET_TCPMSS To compile it as a module, choose M here. If unsure, say N. -config IP_NF_TARGET_NFQUEUE - tristate "NFQUEUE Target Support" - depends on IP_NF_IPTABLES - help - This Target replaced the old obsolete QUEUE target. - - As opposed to QUEUE, it supports 65535 different queues, - not just one. - - To compile it as a module, choose M here. If unsure, say N. - # NAT + specific targets config IP_NF_NAT tristate "Full NAT" diff --git a/trunk/net/ipv4/netfilter/Makefile b/trunk/net/ipv4/netfilter/Makefile index dab4b58dd31e..3d45d3c0283c 100644 --- a/trunk/net/ipv4/netfilter/Makefile +++ b/trunk/net/ipv4/netfilter/Makefile @@ -4,8 +4,7 @@ # objects for the standalone - connection tracking / NAT ip_conntrack-objs := ip_conntrack_standalone.o ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o -ip_nat-objs := ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o -iptable_nat-objs := ip_nat_rule.o ip_nat_standalone.o +iptable_nat-objs := ip_nat_standalone.o ip_nat_rule.o ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o ip_conntrack_pptp-objs := ip_conntrack_helper_pptp.o ip_conntrack_proto_gre.o ip_nat_pptp-objs := ip_nat_helper_pptp.o ip_nat_proto_gre.o @@ -41,7 +40,7 @@ obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o # the three instances of ip_tables obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o -obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o ip_nat.o +obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o # matches @@ -93,7 +92,6 @@ obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o obj-$(CONFIG_IP_NF_TARGET_NOTRACK) += ipt_NOTRACK.o obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o -obj-$(CONFIG_IP_NF_TARGET_NFQUEUE) += ipt_NFQUEUE.o # generic ARP tables obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o @@ -103,3 +101,4 @@ obj-$(CONFIG_IP_NF_ARP_MANGLE) += arpt_mangle.o obj-$(CONFIG_IP_NF_ARPFILTER) += arptable_filter.o obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o +obj-$(CONFIG_NETFILTER_NETLINK_QUEUE) += ipt_NFQUEUE.o diff --git a/trunk/net/ipv4/netfilter/arp_tables.c b/trunk/net/ipv4/netfilter/arp_tables.c index a7969286e6e7..fa1634256680 100644 --- a/trunk/net/ipv4/netfilter/arp_tables.c +++ b/trunk/net/ipv4/netfilter/arp_tables.c @@ -716,10 +716,8 @@ static int translate_table(const char *name, } /* And one copy for every other CPU */ - for_each_cpu(i) { - if (i == 0) - continue; - memcpy(newinfo->entries + SMP_ALIGN(newinfo->size) * i, + for (i = 1; i < num_possible_cpus(); i++) { + memcpy(newinfo->entries + SMP_ALIGN(newinfo->size)*i, newinfo->entries, SMP_ALIGN(newinfo->size)); } @@ -769,7 +767,7 @@ static void get_counters(const struct arpt_table_info *t, unsigned int cpu; unsigned int i; - for_each_cpu(cpu) { + for (cpu = 0; cpu < num_possible_cpus(); cpu++) { i = 0; ARPT_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu), t->size, @@ -887,8 +885,7 @@ static int do_replace(void __user *user, unsigned int len) return -ENOMEM; newinfo = vmalloc(sizeof(struct arpt_table_info) - + SMP_ALIGN(tmp.size) * - (highest_possible_processor_id()+1)); + + SMP_ALIGN(tmp.size) * num_possible_cpus()); if (!newinfo) return -ENOMEM; @@ -1161,8 +1158,7 @@ int arpt_register_table(struct arpt_table *table, = { 0, 0, 0, { 0 }, { 0 }, { } }; newinfo = vmalloc(sizeof(struct arpt_table_info) - + SMP_ALIGN(repl->size) * - (highest_possible_processor_id()+1)); + + SMP_ALIGN(repl->size) * num_possible_cpus()); if (!newinfo) { ret = -ENOMEM; return ret; diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_core.c b/trunk/net/ipv4/netfilter/ip_conntrack_core.c index 07a80b56e8dc..ea65dd3e517a 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_core.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_core.c @@ -1119,7 +1119,7 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct, unsigned long extra_jiffies, int do_acct) { - int event = 0; + int do_event = 0; IP_NF_ASSERT(ct->timeout.data == (unsigned long)ct); IP_NF_ASSERT(skb); @@ -1129,13 +1129,13 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct, /* If not in hash table, timer will not be active yet */ if (!is_confirmed(ct)) { ct->timeout.expires = extra_jiffies; - event = IPCT_REFRESH; + do_event = 1; } else { /* Need del_timer for race avoidance (may already be dying). */ if (del_timer(&ct->timeout)) { ct->timeout.expires = jiffies + extra_jiffies; add_timer(&ct->timeout); - event = IPCT_REFRESH; + do_event = 1; } } @@ -1144,17 +1144,14 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct, ct->counters[CTINFO2DIR(ctinfo)].packets++; ct->counters[CTINFO2DIR(ctinfo)].bytes += ntohs(skb->nh.iph->tot_len); - if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000) - || (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000)) - event |= IPCT_COUNTER_FILLING; } #endif write_unlock_bh(&ip_conntrack_lock); /* must be unlocked when calling event cache */ - if (event) - ip_conntrack_event_cache(event, skb); + if (do_event) + ip_conntrack_event_cache(IPCT_REFRESH, skb); } #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c index 186646eb249f..577bac22dcc6 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c @@ -58,7 +58,7 @@ static int help(struct sk_buff **pskb, goto out; rcu_read_lock(); - in_dev = __in_dev_get_rcu(rt->u.dst.dev); + in_dev = __in_dev_get(rt->u.dst.dev); if (in_dev != NULL) { for_primary_ifa(in_dev) { if (ifa->ifa_broadcast == iph->daddr) { diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_netlink.c b/trunk/net/ipv4/netfilter/ip_conntrack_netlink.c index 166e6069f121..b08a432efcf8 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_netlink.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_netlink.c @@ -177,11 +177,11 @@ ctnetlink_dump_counters(struct sk_buff *skb, const struct ip_conntrack *ct, struct nfattr *nest_count = NFA_NEST(skb, type); u_int64_t tmp; - tmp = htonl(ct->counters[dir].packets); - NFA_PUT(skb, CTA_COUNTERS32_PACKETS, sizeof(u_int32_t), &tmp); + tmp = cpu_to_be64(ct->counters[dir].packets); + NFA_PUT(skb, CTA_COUNTERS_PACKETS, sizeof(u_int64_t), &tmp); - tmp = htonl(ct->counters[dir].bytes); - NFA_PUT(skb, CTA_COUNTERS32_BYTES, sizeof(u_int32_t), &tmp); + tmp = cpu_to_be64(ct->counters[dir].bytes); + NFA_PUT(skb, CTA_COUNTERS_BYTES, sizeof(u_int64_t), &tmp); NFA_NEST_END(skb, nest_count); @@ -833,8 +833,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, static inline int ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[]) { - unsigned long d; - unsigned status = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1])); + unsigned long d, status = *(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1]); d = ct->status ^ status; if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING)) @@ -949,31 +948,6 @@ ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[]) return 0; } -static inline int -ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[]) -{ - struct nfattr *tb[CTA_PROTOINFO_MAX], *attr = cda[CTA_PROTOINFO-1]; - struct ip_conntrack_protocol *proto; - u_int16_t npt = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum; - int err = 0; - - if (nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr) < 0) - goto nfattr_failure; - - proto = ip_conntrack_proto_find_get(npt); - if (!proto) - return -EINVAL; - - if (proto->from_nfattr) - err = proto->from_nfattr(tb, ct); - ip_conntrack_proto_put(proto); - - return err; - -nfattr_failure: - return -ENOMEM; -} - static int ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[]) { @@ -999,12 +973,6 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[]) return err; } - if (cda[CTA_PROTOINFO-1]) { - err = ctnetlink_change_protoinfo(ct, cda); - if (err < 0) - return err; - } - DEBUGP("all done\n"); return 0; } @@ -1034,12 +1002,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[], if (err < 0) goto err; - if (cda[CTA_PROTOINFO-1]) { - err = ctnetlink_change_protoinfo(ct, cda); - if (err < 0) - return err; - } - ct->helper = ip_conntrack_helper_find_get(rtuple); add_timer(&ct->timeout); diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_proto_gre.c b/trunk/net/ipv4/netfilter/ip_conntrack_proto_gre.c index 744abb9d377a..de3cb9db6f85 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_proto_gre.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_proto_gre.c @@ -247,7 +247,6 @@ static int gre_packet(struct ip_conntrack *ct, ct->proto.gre.stream_timeout); /* Also, more likely to be important, and not a probe. */ set_bit(IPS_ASSURED_BIT, &ct->status); - ip_conntrack_event_cache(IPCT_STATUS, skb); } else ip_ct_refresh_acct(ct, conntrackinfo, skb, ct->proto.gre.timeout); diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/trunk/net/ipv4/netfilter/ip_conntrack_proto_icmp.c index 98f0015dd255..838d1d69b36e 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_proto_icmp.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_proto_icmp.c @@ -296,7 +296,8 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[], struct ip_conntrack_tuple *tuple) { if (!tb[CTA_PROTO_ICMP_TYPE-1] - || !tb[CTA_PROTO_ICMP_CODE-1]) + || !tb[CTA_PROTO_ICMP_CODE-1] + || !tb[CTA_PROTO_ICMP_ID-1]) return -1; tuple->dst.u.icmp.type = diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/trunk/net/ipv4/netfilter/ip_conntrack_proto_sctp.c index 59a4a0111dd3..a875f35e576d 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_proto_sctp.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_proto_sctp.c @@ -416,7 +416,6 @@ static int sctp_packet(struct ip_conntrack *conntrack, && newconntrack == SCTP_CONNTRACK_ESTABLISHED) { DEBUGP("Setting assured bit\n"); set_bit(IPS_ASSURED_BIT, &conntrack->status); - ip_conntrack_event_cache(IPCT_STATUS, skb); } return NF_ACCEPT; diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index d6701cafbcc2..1985abc59d24 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c @@ -341,43 +341,17 @@ static int tcp_print_conntrack(struct seq_file *s, static int tcp_to_nfattr(struct sk_buff *skb, struct nfattr *nfa, const struct ip_conntrack *ct) { - struct nfattr *nest_parms = NFA_NEST(skb, CTA_PROTOINFO_TCP); - read_lock_bh(&tcp_lock); NFA_PUT(skb, CTA_PROTOINFO_TCP_STATE, sizeof(u_int8_t), &ct->proto.tcp.state); read_unlock_bh(&tcp_lock); - NFA_NEST_END(skb, nest_parms); - return 0; nfattr_failure: read_unlock_bh(&tcp_lock); return -1; } - -static int nfattr_to_tcp(struct nfattr *cda[], struct ip_conntrack *ct) -{ - struct nfattr *attr = cda[CTA_PROTOINFO_TCP-1]; - struct nfattr *tb[CTA_PROTOINFO_TCP_MAX]; - - if (nfattr_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr) < 0) - goto nfattr_failure; - - if (!tb[CTA_PROTOINFO_TCP_STATE-1]) - return -EINVAL; - - write_lock_bh(&tcp_lock); - ct->proto.tcp.state = - *(u_int8_t *)NFA_DATA(tb[CTA_PROTOINFO_TCP_STATE-1]); - write_unlock_bh(&tcp_lock); - - return 0; - -nfattr_failure: - return -1; -} #endif static unsigned int get_conntrack_index(const struct tcphdr *tcph) @@ -1040,8 +1014,7 @@ static int tcp_packet(struct ip_conntrack *conntrack, /* Set ASSURED if we see see valid ack in ESTABLISHED after SYN_RECV or a valid answer for a picked up connection. */ - set_bit(IPS_ASSURED_BIT, &conntrack->status); - ip_conntrack_event_cache(IPCT_STATUS, skb); + set_bit(IPS_ASSURED_BIT, &conntrack->status); } ip_ct_refresh_acct(conntrack, ctinfo, skb, timeout); @@ -1149,7 +1122,6 @@ struct ip_conntrack_protocol ip_conntrack_protocol_tcp = #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) .to_nfattr = tcp_to_nfattr, - .from_nfattr = nfattr_to_tcp, .tuple_to_nfattr = ip_ct_port_tuple_to_nfattr, .nfattr_to_tuple = ip_ct_port_nfattr_to_tuple, #endif diff --git a/trunk/net/ipv4/netfilter/ip_nat_core.c b/trunk/net/ipv4/netfilter/ip_nat_core.c index c5e3abd24672..c3ea891d38e7 100644 --- a/trunk/net/ipv4/netfilter/ip_nat_core.c +++ b/trunk/net/ipv4/netfilter/ip_nat_core.c @@ -74,14 +74,12 @@ ip_nat_proto_find_get(u_int8_t protonum) return p; } -EXPORT_SYMBOL_GPL(ip_nat_proto_find_get); void ip_nat_proto_put(struct ip_nat_protocol *p) { module_put(p->me); } -EXPORT_SYMBOL_GPL(ip_nat_proto_put); /* We keep an extra hash for each conntrack, for fast searching. */ static inline unsigned int @@ -113,7 +111,6 @@ ip_nat_cheat_check(u_int32_t oldvalinv, u_int32_t newval, u_int16_t oldcheck) return csum_fold(csum_partial((char *)diffs, sizeof(diffs), oldcheck^0xFFFF)); } -EXPORT_SYMBOL(ip_nat_cheat_check); /* Is this tuple already taken? (not by us) */ int @@ -130,7 +127,6 @@ ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple, invert_tuplepr(&reply, tuple); return ip_conntrack_tuple_taken(&reply, ignored_conntrack); } -EXPORT_SYMBOL(ip_nat_used_tuple); /* If we source map this tuple so reply looks like reply_tuple, will * that meet the constraints of range. */ @@ -351,7 +347,6 @@ ip_nat_setup_info(struct ip_conntrack *conntrack, return NF_ACCEPT; } -EXPORT_SYMBOL(ip_nat_setup_info); /* Returns true if succeeded. */ static int @@ -392,10 +387,10 @@ manip_pkt(u_int16_t proto, } /* Do packet manipulations according to ip_nat_setup_info. */ -unsigned int ip_nat_packet(struct ip_conntrack *ct, - enum ip_conntrack_info ctinfo, - unsigned int hooknum, - struct sk_buff **pskb) +unsigned int nat_packet(struct ip_conntrack *ct, + enum ip_conntrack_info ctinfo, + unsigned int hooknum, + struct sk_buff **pskb) { enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); unsigned long statusbit; @@ -422,13 +417,12 @@ unsigned int ip_nat_packet(struct ip_conntrack *ct, } return NF_ACCEPT; } -EXPORT_SYMBOL_GPL(ip_nat_packet); /* Dir is direction ICMP is coming from (opposite to packet it contains) */ -int ip_nat_icmp_reply_translation(struct sk_buff **pskb, - struct ip_conntrack *ct, - enum ip_nat_manip_type manip, - enum ip_conntrack_dir dir) +int icmp_reply_translation(struct sk_buff **pskb, + struct ip_conntrack *ct, + enum ip_nat_manip_type manip, + enum ip_conntrack_dir dir) { struct { struct icmphdr icmp; @@ -515,7 +509,6 @@ int ip_nat_icmp_reply_translation(struct sk_buff **pskb, return 1; } -EXPORT_SYMBOL_GPL(ip_nat_icmp_reply_translation); /* Protocol registration. */ int ip_nat_protocol_register(struct ip_nat_protocol *proto) @@ -532,7 +525,6 @@ int ip_nat_protocol_register(struct ip_nat_protocol *proto) write_unlock_bh(&ip_nat_lock); return ret; } -EXPORT_SYMBOL(ip_nat_protocol_register); /* Noone stores the protocol anywhere; simply delete it. */ void ip_nat_protocol_unregister(struct ip_nat_protocol *proto) @@ -544,7 +536,6 @@ void ip_nat_protocol_unregister(struct ip_nat_protocol *proto) /* Someone could be still looking at the proto in a bh. */ synchronize_net(); } -EXPORT_SYMBOL(ip_nat_protocol_unregister); #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) @@ -591,7 +582,7 @@ EXPORT_SYMBOL_GPL(ip_nat_port_nfattr_to_range); EXPORT_SYMBOL_GPL(ip_nat_port_range_to_nfattr); #endif -static int __init ip_nat_init(void) +int __init ip_nat_init(void) { size_t i; @@ -633,14 +624,10 @@ static int clean_nat(struct ip_conntrack *i, void *data) return 0; } -static void __exit ip_nat_cleanup(void) +/* Not __exit: called from ip_nat_standalone.c:init_or_cleanup() --RR */ +void ip_nat_cleanup(void) { ip_ct_iterate_cleanup(&clean_nat, NULL); ip_conntrack_destroyed = NULL; vfree(bysource); } - -MODULE_LICENSE("GPL"); - -module_init(ip_nat_init); -module_exit(ip_nat_cleanup); diff --git a/trunk/net/ipv4/netfilter/ip_nat_helper.c b/trunk/net/ipv4/netfilter/ip_nat_helper.c index 5d506e0564d5..d2dd5d313556 100644 --- a/trunk/net/ipv4/netfilter/ip_nat_helper.c +++ b/trunk/net/ipv4/netfilter/ip_nat_helper.c @@ -199,7 +199,6 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb, } return 1; } -EXPORT_SYMBOL(ip_nat_mangle_tcp_packet); /* Generic function for mangling variable-length address changes inside * NATed UDP connections (like the CONNECT DATA XXXXX MESG XXXXX INDEX XXXXX @@ -257,7 +256,6 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb, return 1; } -EXPORT_SYMBOL(ip_nat_mangle_udp_packet); /* Adjust one found SACK option including checksum correction */ static void @@ -401,7 +399,6 @@ ip_nat_seq_adjust(struct sk_buff **pskb, return 1; } -EXPORT_SYMBOL(ip_nat_seq_adjust); /* Setup NAT on this expected conntrack so it follows master. */ /* If we fail to get a free NAT slot, we'll get dropped on confirm */ @@ -428,4 +425,3 @@ void ip_nat_follow_master(struct ip_conntrack *ct, /* hook doesn't matter, but it has to do destination manip */ ip_nat_setup_info(ct, &range, NF_IP_PRE_ROUTING); } -EXPORT_SYMBOL(ip_nat_follow_master); diff --git a/trunk/net/ipv4/netfilter/ip_nat_standalone.c b/trunk/net/ipv4/netfilter/ip_nat_standalone.c index 30cd4e18c129..0ff368b131f6 100644 --- a/trunk/net/ipv4/netfilter/ip_nat_standalone.c +++ b/trunk/net/ipv4/netfilter/ip_nat_standalone.c @@ -108,8 +108,8 @@ ip_nat_fn(unsigned int hooknum, case IP_CT_RELATED: case IP_CT_RELATED+IP_CT_IS_REPLY: if ((*pskb)->nh.iph->protocol == IPPROTO_ICMP) { - if (!ip_nat_icmp_reply_translation(pskb, ct, maniptype, - CTINFO2DIR(ctinfo))) + if (!icmp_reply_translation(pskb, ct, maniptype, + CTINFO2DIR(ctinfo))) return NF_DROP; else return NF_ACCEPT; @@ -152,7 +152,7 @@ ip_nat_fn(unsigned int hooknum, } IP_NF_ASSERT(info); - return ip_nat_packet(ct, ctinfo, hooknum, pskb); + return nat_packet(ct, ctinfo, hooknum, pskb); } static unsigned int @@ -325,10 +325,15 @@ static int init_or_cleanup(int init) printk("ip_nat_init: can't setup rules.\n"); goto cleanup_nothing; } + ret = ip_nat_init(); + if (ret < 0) { + printk("ip_nat_init: can't setup rules.\n"); + goto cleanup_rule_init; + } ret = nf_register_hook(&ip_nat_in_ops); if (ret < 0) { printk("ip_nat_init: can't register in hook.\n"); - goto cleanup_rule_init; + goto cleanup_nat; } ret = nf_register_hook(&ip_nat_out_ops); if (ret < 0) { @@ -369,6 +374,8 @@ static int init_or_cleanup(int init) nf_unregister_hook(&ip_nat_out_ops); cleanup_inops: nf_unregister_hook(&ip_nat_in_ops); + cleanup_nat: + ip_nat_cleanup(); cleanup_rule_init: ip_nat_rule_cleanup(); cleanup_nothing: @@ -388,4 +395,14 @@ static void __exit fini(void) module_init(init); module_exit(fini); +EXPORT_SYMBOL(ip_nat_setup_info); +EXPORT_SYMBOL(ip_nat_protocol_register); +EXPORT_SYMBOL(ip_nat_protocol_unregister); +EXPORT_SYMBOL_GPL(ip_nat_proto_find_get); +EXPORT_SYMBOL_GPL(ip_nat_proto_put); +EXPORT_SYMBOL(ip_nat_cheat_check); +EXPORT_SYMBOL(ip_nat_mangle_tcp_packet); +EXPORT_SYMBOL(ip_nat_mangle_udp_packet); +EXPORT_SYMBOL(ip_nat_used_tuple); +EXPORT_SYMBOL(ip_nat_follow_master); MODULE_LICENSE("GPL"); diff --git a/trunk/net/ipv4/netfilter/ip_queue.c b/trunk/net/ipv4/netfilter/ip_queue.c index 36339eb39e17..d54f14d926f6 100644 --- a/trunk/net/ipv4/netfilter/ip_queue.c +++ b/trunk/net/ipv4/netfilter/ip_queue.c @@ -240,8 +240,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) pmsg->packet_id = (unsigned long )entry; pmsg->data_len = data_len; - pmsg->timestamp_sec = entry->skb->tstamp.off_sec; - pmsg->timestamp_usec = entry->skb->tstamp.off_usec; + pmsg->timestamp_sec = skb_tv_base.tv_sec + entry->skb->tstamp.off_sec; + pmsg->timestamp_usec = skb_tv_base.tv_usec + entry->skb->tstamp.off_usec; pmsg->mark = entry->skb->nfmark; pmsg->hook = entry->info->hook; pmsg->hw_protocol = entry->skb->protocol; diff --git a/trunk/net/ipv4/netfilter/ip_tables.c b/trunk/net/ipv4/netfilter/ip_tables.c index 75c27e92f6ab..eef99a1b5de6 100644 --- a/trunk/net/ipv4/netfilter/ip_tables.c +++ b/trunk/net/ipv4/netfilter/ip_tables.c @@ -27,7 +27,6 @@ #include #include #include -#include #include @@ -922,10 +921,8 @@ translate_table(const char *name, } /* And one copy for every other CPU */ - for_each_cpu(i) { - if (i == 0) - continue; - memcpy(newinfo->entries + SMP_ALIGN(newinfo->size) * i, + for (i = 1; i < num_possible_cpus(); i++) { + memcpy(newinfo->entries + SMP_ALIGN(newinfo->size)*i, newinfo->entries, SMP_ALIGN(newinfo->size)); } @@ -946,7 +943,7 @@ replace_table(struct ipt_table *table, struct ipt_entry *table_base; unsigned int i; - for_each_cpu(i) { + for (i = 0; i < num_possible_cpus(); i++) { table_base = (void *)newinfo->entries + TABLE_OFFSET(newinfo, i); @@ -993,7 +990,7 @@ get_counters(const struct ipt_table_info *t, unsigned int cpu; unsigned int i; - for_each_cpu(cpu) { + for (cpu = 0; cpu < num_possible_cpus(); cpu++) { i = 0; IPT_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu), t->size, @@ -1131,8 +1128,7 @@ do_replace(void __user *user, unsigned int len) return -ENOMEM; newinfo = vmalloc(sizeof(struct ipt_table_info) - + SMP_ALIGN(tmp.size) * - (highest_possible_processor_id()+1)); + + SMP_ALIGN(tmp.size) * num_possible_cpus()); if (!newinfo) return -ENOMEM; @@ -1462,8 +1458,7 @@ int ipt_register_table(struct ipt_table *table, const struct ipt_replace *repl) = { 0, 0, 0, { 0 }, { 0 }, { } }; newinfo = vmalloc(sizeof(struct ipt_table_info) - + SMP_ALIGN(repl->size) * - (highest_possible_processor_id()+1)); + + SMP_ALIGN(repl->size) * num_possible_cpus()); if (!newinfo) return -ENOMEM; diff --git a/trunk/net/ipv4/netfilter/ipt_REDIRECT.c b/trunk/net/ipv4/netfilter/ipt_REDIRECT.c index 5245bfd33d52..715cb613405c 100644 --- a/trunk/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/trunk/net/ipv4/netfilter/ipt_REDIRECT.c @@ -93,7 +93,7 @@ redirect_target(struct sk_buff **pskb, newdst = 0; rcu_read_lock(); - indev = __in_dev_get_rcu((*pskb)->dev); + indev = __in_dev_get((*pskb)->dev); if (indev && (ifa = indev->ifa_list)) newdst = ifa->ifa_local; rcu_read_unlock(); diff --git a/trunk/net/ipv4/netfilter/ipt_ULOG.c b/trunk/net/ipv4/netfilter/ipt_ULOG.c index 2883ccd8a91d..e2c14f3cb2fc 100644 --- a/trunk/net/ipv4/netfilter/ipt_ULOG.c +++ b/trunk/net/ipv4/netfilter/ipt_ULOG.c @@ -225,8 +225,8 @@ static void ipt_ulog_packet(unsigned int hooknum, /* copy hook, prefix, timestamp, payload, etc. */ pm->data_len = copy_len; - pm->timestamp_sec = skb->tstamp.off_sec; - pm->timestamp_usec = skb->tstamp.off_usec; + pm->timestamp_sec = skb_tv_base.tv_sec + skb->tstamp.off_sec; + pm->timestamp_usec = skb_tv_base.tv_usec + skb->tstamp.off_usec; pm->mark = skb->nfmark; pm->hook = hooknum; if (prefix != NULL) diff --git a/trunk/net/ipv4/route.c b/trunk/net/ipv4/route.c index 381dd6a6aebb..8549f26e2495 100644 --- a/trunk/net/ipv4/route.c +++ b/trunk/net/ipv4/route.c @@ -2128,7 +2128,7 @@ int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr, struct in_device *in_dev; rcu_read_lock(); - if ((in_dev = __in_dev_get_rcu(dev)) != NULL) { + if ((in_dev = __in_dev_get(dev)) != NULL) { int our = ip_check_mc(in_dev, daddr, saddr, skb->nh.iph->protocol); if (our @@ -2443,9 +2443,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) err = -ENODEV; if (dev_out == NULL) goto out; - - /* RACE: Check return value of inet_select_addr instead. */ - if (__in_dev_get_rtnl(dev_out) == NULL) { + if (__in_dev_get(dev_out) == NULL) { dev_put(dev_out); goto out; /* Wrong error code */ } diff --git a/trunk/net/ipv4/tcp_bic.c b/trunk/net/ipv4/tcp_bic.c index 6d80e063c187..b940346de4e7 100644 --- a/trunk/net/ipv4/tcp_bic.c +++ b/trunk/net/ipv4/tcp_bic.c @@ -136,7 +136,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) else if (cwnd < ca->last_max_cwnd + max_increment*(BICTCP_B-1)) /* slow start */ ca->cnt = (cwnd * (BICTCP_B-1)) - / (cwnd - ca->last_max_cwnd); + / cwnd-ca->last_max_cwnd; else /* linear increase */ ca->cnt = cwnd / max_increment; diff --git a/trunk/net/ipv4/tcp_input.c b/trunk/net/ipv4/tcp_input.c index 677419d0c9ad..a7537c7bbd06 100644 --- a/trunk/net/ipv4/tcp_input.c +++ b/trunk/net/ipv4/tcp_input.c @@ -355,6 +355,8 @@ static void tcp_clamp_window(struct sock *sk, struct tcp_sock *tp) app_win -= icsk->icsk_ack.rcv_mss; app_win = max(app_win, 2U*tp->advmss); + if (!ofo_win) + tp->window_clamp = min(tp->window_clamp, app_win); tp->rcv_ssthresh = min(tp->window_clamp, 2U*tp->advmss); } } diff --git a/trunk/net/ipv4/tcp_ipv4.c b/trunk/net/ipv4/tcp_ipv4.c index c85819d8474b..13dfb391cdf1 100644 --- a/trunk/net/ipv4/tcp_ipv4.c +++ b/trunk/net/ipv4/tcp_ipv4.c @@ -130,20 +130,19 @@ static int __tcp_v4_check_established(struct sock *sk, __u16 lport, int dif = sk->sk_bound_dev_if; INET_ADDR_COOKIE(acookie, saddr, daddr) const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport); - unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); - struct inet_ehash_bucket *head = inet_ehash_bucket(&tcp_hashinfo, hash); + const int hash = inet_ehashfn(daddr, lport, saddr, inet->dport, tcp_hashinfo.ehash_size); + struct inet_ehash_bucket *head = &tcp_hashinfo.ehash[hash]; struct sock *sk2; const struct hlist_node *node; struct inet_timewait_sock *tw; - prefetch(head->chain.first); write_lock(&head->lock); /* Check TIME-WAIT sockets first. */ sk_for_each(sk2, node, &(head + tcp_hashinfo.ehash_size)->chain) { tw = inet_twsk(sk2); - if (INET_TW_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif)) { + if (INET_TW_MATCH(sk2, acookie, saddr, daddr, ports, dif)) { const struct tcp_timewait_sock *tcptw = tcp_twsk(sk2); struct tcp_sock *tp = tcp_sk(sk); @@ -180,7 +179,7 @@ static int __tcp_v4_check_established(struct sock *sk, __u16 lport, /* And established part... */ sk_for_each(sk2, node, &head->chain) { - if (INET_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif)) + if (INET_MATCH(sk2, acookie, saddr, daddr, ports, dif)) goto not_unique; } @@ -189,7 +188,7 @@ static int __tcp_v4_check_established(struct sock *sk, __u16 lport, * in hash table socket with a funny identity. */ inet->num = lport; inet->sport = htons(lport); - sk->sk_hash = hash; + sk->sk_hashent = hash; BUG_TRAP(sk_unhashed(sk)); __sk_add_node(sk, &head->chain); sock_prot_inc_use(sk->sk_prot); diff --git a/trunk/net/ipv4/tcp_output.c b/trunk/net/ipv4/tcp_output.c index 7114031fdc70..d6e3d269e906 100644 --- a/trunk/net/ipv4/tcp_output.c +++ b/trunk/net/ipv4/tcp_output.c @@ -190,7 +190,7 @@ void tcp_select_initial_window(int __space, __u32 mss, } /* Set initial window to value enough for senders, - * following RFC2414. Senders, not following this RFC, + * following RFC1414. Senders, not following this RFC, * will be satisfied with 2. */ if (mss > (1<<*rcv_wscale)) { @@ -435,16 +435,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss int nsize, old_factor; u16 flags; - if (unlikely(len >= skb->len)) { - if (net_ratelimit()) { - printk(KERN_DEBUG "TCP: seg_size=%u, mss=%u, seq=%u, " - "end_seq=%u, skb->len=%u.\n", len, mss_now, - TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq, - skb->len); - WARN_ON(1); - } - return 0; - } + BUG_ON(len >= skb->len); nsize = skb_headlen(skb) - len; if (nsize < 0) @@ -1619,7 +1610,7 @@ void tcp_send_fin(struct sock *sk) * was unread data in the receive queue. This behavior is recommended * by draft-ietf-tcpimpl-prob-03.txt section 3.10. -DaveM */ -void tcp_send_active_reset(struct sock *sk, gfp_t priority) +void tcp_send_active_reset(struct sock *sk, unsigned int __nocast priority) { struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *skb; diff --git a/trunk/net/ipv6/addrconf.c b/trunk/net/ipv6/addrconf.c index a970b4727ce8..2fea3f4402a0 100644 --- a/trunk/net/ipv6/addrconf.c +++ b/trunk/net/ipv6/addrconf.c @@ -1806,7 +1806,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) } for (dev = dev_base; dev != NULL; dev = dev->next) { - struct in_device * in_dev = __in_dev_get_rtnl(dev); + struct in_device * in_dev = __in_dev_get(dev); if (in_dev && (dev->flags & IFF_UP)) { struct in_ifaddr * ifa; @@ -3520,8 +3520,6 @@ int __init addrconf_init(void) if (err) return err; - ip6_null_entry.rt6i_idev = in6_dev_get(&loopback_dev); - register_netdevice_notifier(&ipv6_dev_notf); #ifdef CONFIG_IPV6_PRIVACY diff --git a/trunk/net/ipv6/esp6.c b/trunk/net/ipv6/esp6.c index 40d9a1935ab5..9b27460f0cc7 100644 --- a/trunk/net/ipv6/esp6.c +++ b/trunk/net/ipv6/esp6.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -67,10 +66,10 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) alen = esp->auth.icv_trunc_len; tfm = esp->conf.tfm; - blksize = ALIGN(crypto_tfm_alg_blocksize(tfm), 4); - clen = ALIGN(clen + 2, blksize); + blksize = (crypto_tfm_alg_blocksize(tfm) + 3) & ~3; + clen = (clen + 2 + blksize-1)&~(blksize-1); if (esp->conf.padlen) - clen = ALIGN(clen, esp->conf.padlen); + clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1); if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) { goto error; @@ -134,7 +133,7 @@ static int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, stru struct ipv6_esp_hdr *esph; struct esp_data *esp = x->data; struct sk_buff *trailer; - int blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4); + int blksize = crypto_tfm_alg_blocksize(esp->conf.tfm); int alen = esp->auth.icv_trunc_len; int elen = skb->len - sizeof(struct ipv6_esp_hdr) - esp->conf.ivlen - alen; @@ -236,17 +235,16 @@ static int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, stru static u32 esp6_get_max_size(struct xfrm_state *x, int mtu) { struct esp_data *esp = x->data; - u32 blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4); + u32 blksize = crypto_tfm_alg_blocksize(esp->conf.tfm); if (x->props.mode) { - mtu = ALIGN(mtu + 2, blksize); + mtu = (mtu + 2 + blksize-1)&~(blksize-1); } else { /* The worst case. */ - u32 padsize = ((blksize - 1) & 7) + 1; - mtu = ALIGN(mtu + 2, padsize) + blksize - padsize; + mtu += 2 + blksize; } if (esp->conf.padlen) - mtu = ALIGN(mtu, esp->conf.padlen); + mtu = (mtu + esp->conf.padlen-1)&~(esp->conf.padlen-1); return mtu + x->props.header_len + esp->auth.icv_full_len; } diff --git a/trunk/net/ipv6/ip6_output.c b/trunk/net/ipv6/ip6_output.c index 563b442ffab8..2f589f24c093 100644 --- a/trunk/net/ipv6/ip6_output.c +++ b/trunk/net/ipv6/ip6_output.c @@ -666,7 +666,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) */ fh->nexthdr = nexthdr; fh->reserved = 0; - if (!frag_id) { + if (frag_id) { ipv6_select_ident(skb, fh); frag_id = fh->identification; } else diff --git a/trunk/net/ipv6/mcast.c b/trunk/net/ipv6/mcast.c index 39a96c768102..519899fb11d5 100644 --- a/trunk/net/ipv6/mcast.c +++ b/trunk/net/ipv6/mcast.c @@ -1393,7 +1393,7 @@ static void mld_sendpack(struct sk_buff *skb) static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel) { - return sizeof(struct mld2_grec) + 16 * mld_scount(pmc,type,gdel,sdel); + return sizeof(struct mld2_grec) + 4*mld_scount(pmc,type,gdel,sdel); } static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, diff --git a/trunk/net/ipv6/ndisc.c b/trunk/net/ipv6/ndisc.c index 305d9ee6d7db..555a31347eda 100644 --- a/trunk/net/ipv6/ndisc.c +++ b/trunk/net/ipv6/ndisc.c @@ -1450,7 +1450,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, static void pndisc_redo(struct sk_buff *skb) { - ndisc_recv_ns(skb); + ndisc_rcv(skb); kfree_skb(skb); } diff --git a/trunk/net/ipv6/netfilter/Kconfig b/trunk/net/ipv6/netfilter/Kconfig index bb7ccfe33f23..216fbe1ac65c 100644 --- a/trunk/net/ipv6/netfilter/Kconfig +++ b/trunk/net/ipv6/netfilter/Kconfig @@ -209,17 +209,6 @@ config IP6_NF_TARGET_REJECT To compile it as a module, choose M here. If unsure, say N. -config IP6_NF_TARGET_NFQUEUE - tristate "NFQUEUE Target Support" - depends on IP_NF_IPTABLES - help - This Target replaced the old obsolete QUEUE target. - - As opposed to QUEUE, it supports 65535 different queues, - not just one. - - To compile it as a module, choose M here. If unsure, say N. - # if [ "$CONFIG_IP6_NF_FILTER" != "n" ]; then # dep_tristate ' REJECT target support' CONFIG_IP6_NF_TARGET_REJECT $CONFIG_IP6_NF_FILTER # if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then diff --git a/trunk/net/ipv6/netfilter/Makefile b/trunk/net/ipv6/netfilter/Makefile index 2b2c370e8b1c..bd9a16a5cbba 100644 --- a/trunk/net/ipv6/netfilter/Makefile +++ b/trunk/net/ipv6/netfilter/Makefile @@ -21,9 +21,9 @@ obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o -obj-$(CONFIG_IP6_NF_TARGET_NFQUEUE) += ip6t_NFQUEUE.o obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o +obj-$(CONFIG_NETFILTER_NETLINK_QUEUE) += ip6t_NFQUEUE.o diff --git a/trunk/net/ipv6/netfilter/ip6_queue.c b/trunk/net/ipv6/netfilter/ip6_queue.c index 5027bbe6415e..aa11cf366efa 100644 --- a/trunk/net/ipv6/netfilter/ip6_queue.c +++ b/trunk/net/ipv6/netfilter/ip6_queue.c @@ -238,8 +238,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) pmsg->packet_id = (unsigned long )entry; pmsg->data_len = data_len; - pmsg->timestamp_sec = entry->skb->tstamp.off_sec; - pmsg->timestamp_usec = entry->skb->tstamp.off_usec; + pmsg->timestamp_sec = skb_tv_base.tv_sec + entry->skb->tstamp.off_sec; + pmsg->timestamp_usec = skb_tv_base.tv_usec + entry->skb->tstamp.off_usec; pmsg->mark = entry->skb->nfmark; pmsg->hook = entry->info->hook; pmsg->hw_protocol = entry->skb->protocol; diff --git a/trunk/net/ipv6/netfilter/ip6_tables.c b/trunk/net/ipv6/netfilter/ip6_tables.c index 21deec25a12b..2da514b16d95 100644 --- a/trunk/net/ipv6/netfilter/ip6_tables.c +++ b/trunk/net/ipv6/netfilter/ip6_tables.c @@ -28,7 +28,6 @@ #include #include #include -#include #include @@ -951,10 +950,8 @@ translate_table(const char *name, } /* And one copy for every other CPU */ - for_each_cpu(i) { - if (i == 0) - continue; - memcpy(newinfo->entries + SMP_ALIGN(newinfo->size) * i, + for (i = 1; i < num_possible_cpus(); i++) { + memcpy(newinfo->entries + SMP_ALIGN(newinfo->size)*i, newinfo->entries, SMP_ALIGN(newinfo->size)); } @@ -975,7 +972,7 @@ replace_table(struct ip6t_table *table, struct ip6t_entry *table_base; unsigned int i; - for_each_cpu(i) { + for (i = 0; i < num_possible_cpus(); i++) { table_base = (void *)newinfo->entries + TABLE_OFFSET(newinfo, i); @@ -1022,7 +1019,7 @@ get_counters(const struct ip6t_table_info *t, unsigned int cpu; unsigned int i; - for_each_cpu(cpu) { + for (cpu = 0; cpu < num_possible_cpus(); cpu++) { i = 0; IP6T_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu), t->size, @@ -1156,8 +1153,7 @@ do_replace(void __user *user, unsigned int len) return -ENOMEM; newinfo = vmalloc(sizeof(struct ip6t_table_info) - + SMP_ALIGN(tmp.size) * - (highest_possible_processor_id()+1)); + + SMP_ALIGN(tmp.size) * num_possible_cpus()); if (!newinfo) return -ENOMEM; @@ -1471,8 +1467,7 @@ int ip6t_register_table(struct ip6t_table *table, = { 0, 0, 0, { 0 }, { 0 }, { } }; newinfo = vmalloc(sizeof(struct ip6t_table_info) - + SMP_ALIGN(repl->size) * - (highest_possible_processor_id()+1)); + + SMP_ALIGN(repl->size) * num_possible_cpus()); if (!newinfo) return -ENOMEM; diff --git a/trunk/net/ipv6/tcp_ipv6.c b/trunk/net/ipv6/tcp_ipv6.c index d693cb988b78..80643e6b346b 100644 --- a/trunk/net/ipv6/tcp_ipv6.c +++ b/trunk/net/ipv6/tcp_ipv6.c @@ -209,11 +209,9 @@ static __inline__ void __tcp_v6_hash(struct sock *sk) lock = &tcp_hashinfo.lhash_lock; inet_listen_wlock(&tcp_hashinfo); } else { - unsigned int hash; - sk->sk_hash = hash = inet6_sk_ehashfn(sk); - hash &= (tcp_hashinfo.ehash_size - 1); - list = &tcp_hashinfo.ehash[hash].chain; - lock = &tcp_hashinfo.ehash[hash].lock; + sk->sk_hashent = inet6_sk_ehashfn(sk, tcp_hashinfo.ehash_size); + list = &tcp_hashinfo.ehash[sk->sk_hashent].chain; + lock = &tcp_hashinfo.ehash[sk->sk_hashent].lock; write_lock(lock); } @@ -324,13 +322,13 @@ static int __tcp_v6_check_established(struct sock *sk, const __u16 lport, const struct in6_addr *saddr = &np->daddr; const int dif = sk->sk_bound_dev_if; const u32 ports = INET_COMBINED_PORTS(inet->dport, lport); - unsigned int hash = inet6_ehashfn(daddr, inet->num, saddr, inet->dport); - struct inet_ehash_bucket *head = inet_ehash_bucket(&tcp_hashinfo, hash); + const int hash = inet6_ehashfn(daddr, inet->num, saddr, inet->dport, + tcp_hashinfo.ehash_size); + struct inet_ehash_bucket *head = &tcp_hashinfo.ehash[hash]; struct sock *sk2; const struct hlist_node *node; struct inet_timewait_sock *tw; - prefetch(head->chain.first); write_lock(&head->lock); /* Check TIME-WAIT sockets first. */ @@ -367,14 +365,14 @@ static int __tcp_v6_check_established(struct sock *sk, const __u16 lport, /* And established part... */ sk_for_each(sk2, node, &head->chain) { - if (INET6_MATCH(sk2, hash, saddr, daddr, ports, dif)) + if (INET6_MATCH(sk2, saddr, daddr, ports, dif)) goto not_unique; } unique: BUG_TRAP(sk_unhashed(sk)); __sk_add_node(sk, &head->chain); - sk->sk_hash = hash; + sk->sk_hashent = hash; sock_prot_inc_use(sk->sk_prot); write_unlock(&head->lock); diff --git a/trunk/net/ipv6/udp.c b/trunk/net/ipv6/udp.c index bf9519341fd3..6001948600f3 100644 --- a/trunk/net/ipv6/udp.c +++ b/trunk/net/ipv6/udp.c @@ -99,7 +99,7 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum) next:; } result = best; - for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { + for(;; result += UDP_HTABLE_SIZE) { if (result > sysctl_local_port_range[1]) result = sysctl_local_port_range[0] + ((result - sysctl_local_port_range[0]) & @@ -107,8 +107,6 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum) if (!udp_lport_inuse(result)) break; } - if (i >= (1 << 16) / UDP_HTABLE_SIZE) - goto fail; gotit: udp_port_rover = snum = result; } else { @@ -854,16 +852,10 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, else if (!corkreq) err = udp_v6_push_pending_frames(sk, up); - if (dst) { - if (connected) { - ip6_dst_store(sk, dst, - ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ? - &np->daddr : NULL); - } else { - dst_release(dst); - } - } - + if (dst && connected) + ip6_dst_store(sk, dst, + ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ? + &np->daddr : NULL); if (err > 0) err = np->recverr ? net_xmit_errno(err) : 0; release_sock(sk); diff --git a/trunk/net/irda/irlan/irlan_eth.c b/trunk/net/irda/irlan/irlan_eth.c index 953e255d2bc8..071cd2cefd8a 100644 --- a/trunk/net/irda/irlan/irlan_eth.c +++ b/trunk/net/irda/irlan/irlan_eth.c @@ -310,7 +310,7 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) #ifdef CONFIG_INET IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); rcu_read_lock(); - in_dev = __in_dev_get_rcu(dev); + in_dev = __in_dev_get(dev); if (in_dev == NULL) goto out; if (in_dev->ifa_list) diff --git a/trunk/net/irda/irttp.c b/trunk/net/irda/irttp.c index 8aff254cb418..6602d901f8b1 100644 --- a/trunk/net/irda/irttp.c +++ b/trunk/net/irda/irttp.c @@ -38,7 +38,7 @@ #include #include -static struct irttp_cb *irttp; +static struct irttp_cb *irttp = NULL; static void __irttp_close_tsap(struct tsap_cb *self); @@ -86,9 +86,12 @@ static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 }; */ int __init irttp_init(void) { - irttp = kmalloc(sizeof(struct irttp_cb), GFP_KERNEL); - if (irttp == NULL) - return -ENOMEM; + /* Initialize the irttp structure. */ + if (irttp == NULL) { + irttp = kmalloc(sizeof(struct irttp_cb), GFP_KERNEL); + if (irttp == NULL) + return -ENOMEM; + } memset(irttp, 0, sizeof(struct irttp_cb)); irttp->magic = TTP_MAGIC; @@ -97,7 +100,6 @@ int __init irttp_init(void) if (!irttp->tsaps) { IRDA_ERROR("%s: can't allocate IrTTP hashbin!\n", __FUNCTION__); - kfree(irttp); return -ENOMEM; } @@ -113,6 +115,7 @@ int __init irttp_init(void) void __exit irttp_cleanup(void) { /* Check for main structure */ + IRDA_ASSERT(irttp != NULL, return;); IRDA_ASSERT(irttp->magic == TTP_MAGIC, return;); /* @@ -379,6 +382,7 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) struct lsap_cb *lsap; notify_t ttp_notify; + IRDA_ASSERT(irttp != NULL, return NULL;); IRDA_ASSERT(irttp->magic == TTP_MAGIC, return NULL;); /* The IrLMP spec (IrLMP 1.1 p10) says that we have the right to @@ -1876,6 +1880,8 @@ static int irttp_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct irttp_iter_state *s; + + IRDA_ASSERT(irttp != NULL, return -EINVAL;); s = kmalloc(sizeof(*s), GFP_KERNEL); if (!s) diff --git a/trunk/net/key/af_key.c b/trunk/net/key/af_key.c index 39031684b65c..4879743b945a 100644 --- a/trunk/net/key/af_key.c +++ b/trunk/net/key/af_key.c @@ -185,7 +185,7 @@ static int pfkey_release(struct socket *sock) } static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, - gfp_t allocation, struct sock *sk) + int allocation, struct sock *sk) { int err = -ENOBUFS; @@ -217,7 +217,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, #define BROADCAST_ONE 1 #define BROADCAST_REGISTERED 2 #define BROADCAST_PROMISC_ONLY 4 -static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation, +static int pfkey_broadcast(struct sk_buff *skb, int allocation, int broadcast_flags, struct sock *one_sk) { struct sock *sk; @@ -1416,8 +1416,7 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, return 0; } -static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, - gfp_t allocation) +static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, int allocation) { struct sk_buff *skb; struct sadb_msg *hdr; @@ -2154,7 +2153,6 @@ static int key_pol_get_resp(struct sock *sk, struct xfrm_policy *xp, struct sadb static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs) { - unsigned int dir; int err; struct sadb_x_policy *pol; struct xfrm_policy *xp; @@ -2163,11 +2161,7 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL) return -EINVAL; - dir = xfrm_policy_id2dir(pol->sadb_x_policy_id); - if (dir >= XFRM_POLICY_MAX) - return -EINVAL; - - xp = xfrm_policy_byid(dir, pol->sadb_x_policy_id, + xp = xfrm_policy_byid(0, pol->sadb_x_policy_id, hdr->sadb_msg_type == SADB_X_SPDDELETE2); if (xp == NULL) return -ENOENT; @@ -2179,9 +2173,9 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) { c.data.byid = 1; c.event = XFRM_MSG_DELPOLICY; - km_policy_notify(xp, dir, &c); + km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); } else { - err = key_pol_get_resp(sk, xp, hdr, dir); + err = key_pol_get_resp(sk, xp, hdr, pol->sadb_x_policy_dir-1); } xfrm_pol_put(xp); diff --git a/trunk/net/llc/Makefile b/trunk/net/llc/Makefile index 4e260cff3c5d..5ebd4ed2bd42 100644 --- a/trunk/net/llc/Makefile +++ b/trunk/net/llc/Makefile @@ -22,4 +22,3 @@ llc2-y := llc_if.o llc_c_ev.o llc_c_ac.o llc_conn.o llc_c_st.o llc_pdu.o \ llc_sap.o llc_s_ac.o llc_s_ev.o llc_s_st.o af_llc.o llc_station.o llc2-$(CONFIG_PROC_FS) += llc_proc.o -llc2-$(CONFIG_SYSCTL) += sysctl_net_llc.o diff --git a/trunk/net/llc/af_llc.c b/trunk/net/llc/af_llc.c index 59d02cbbeb9e..66f55e514b56 100644 --- a/trunk/net/llc/af_llc.c +++ b/trunk/net/llc/af_llc.c @@ -21,7 +21,6 @@ * See the GNU General Public License for more details. */ #include -#include #include #include #include @@ -38,9 +37,10 @@ static u16 llc_ui_sap_link_no_max[256]; static struct sockaddr_llc llc_ui_addrnull; static struct proto_ops llc_ui_ops; -static int llc_ui_wait_for_conn(struct sock *sk, long timeout); -static int llc_ui_wait_for_disc(struct sock *sk, long timeout); -static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout); +static int llc_ui_wait_for_conn(struct sock *sk, int timeout); +static int llc_ui_wait_for_disc(struct sock *sk, int timeout); +static int llc_ui_wait_for_data(struct sock *sk, int timeout); +static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout); #if 0 #define dprintk(args...) printk(KERN_DEBUG args) @@ -116,12 +116,12 @@ static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) struct llc_sock* llc = llc_sk(sk); int rc = 0; - if (unlikely(llc_data_accept_state(llc->state) || llc->p_flag)) { - long timeout = sock_sndtimeo(sk, noblock); + if (llc_data_accept_state(llc->state) || llc->p_flag) { + int timeout = sock_sndtimeo(sk, noblock); rc = llc_ui_wait_for_busy_core(sk, timeout); } - if (unlikely(!rc)) + if (!rc) rc = llc_build_and_send_pkt(sk, skb); return rc; } @@ -155,7 +155,7 @@ static int llc_ui_create(struct socket *sock, int protocol) struct sock *sk; int rc = -ESOCKTNOSUPPORT; - if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) { + if (sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM) { rc = -ENOMEM; sk = llc_sk_alloc(PF_LLC, GFP_KERNEL, &llc_proto); if (sk) { @@ -177,7 +177,7 @@ static int llc_ui_release(struct socket *sock) struct sock *sk = sock->sk; struct llc_sock *llc; - if (unlikely(sk == NULL)) + if (!sk) goto out; sock_hold(sk); lock_sock(sk); @@ -189,6 +189,10 @@ static int llc_ui_release(struct socket *sock) if (!sock_flag(sk, SOCK_ZAPPED)) llc_sap_remove_socket(llc->sap, sk); release_sock(sk); + if (llc->sap && hlist_empty(&llc->sap->sk_list.list)) { + llc_release_sockets(llc->sap); + llc_sap_close(llc->sap); + } if (llc->dev) dev_put(llc->dev); sock_put(sk); @@ -217,7 +221,6 @@ static int llc_ui_autoport(void) llc_ui_sap_last_autoport = i + 2; goto out; } - llc_sap_put(sap); } llc_ui_sap_last_autoport = LLC_SAP_DYN_START; tries++; @@ -228,13 +231,20 @@ static int llc_ui_autoport(void) } /** - * llc_ui_autobind - automatically bind a socket to a sap - * @sock: socket to bind - * @addr: address to connect to - * - * Used by llc_ui_connect and llc_ui_sendmsg when the user hasn't - * specifically used llc_ui_bind to bind to an specific address/sap + * llc_ui_autobind - Bind a socket to a specific address. + * @sk: Socket to bind an address to. + * @addr: Address the user wants the socket bound to. * + * Bind a socket to a specific address. For llc a user is able to bind to + * a specific sap only or mac + sap. If the user only specifies a sap and + * a null dmac (all zeros) the user is attempting to bind to an entire + * sap. This will stop anyone else on the local system from using that + * sap. If someone else has a mac + sap open the bind to null + sap will + * fail. + * If the user desires to bind to a specific mac + sap, it is possible to + * have multiple sap connections via multiple macs. + * Bind and autobind for that matter must enforce the correct sap usage + * otherwise all hell will break loose. * Returns: 0 upon success, negative otherwise. */ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr) @@ -275,7 +285,11 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr) * @addrlen: Length of the uaddr structure. * * Bind a socket to a specific address. For llc a user is able to bind to - * a specific sap only or mac + sap. + * a specific sap only or mac + sap. If the user only specifies a sap and + * a null dmac (all zeros) the user is attempting to bind to an entire + * sap. This will stop anyone else on the local system from using that + * sap. If someone else has a mac + sap open the bind to null + sap will + * fail. * If the user desires to bind to a specific mac + sap, it is possible to * have multiple sap connections via multiple macs. * Bind and autobind for that matter must enforce the correct sap usage @@ -291,16 +305,10 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) int rc = -EINVAL; dprintk("%s: binding %02X\n", __FUNCTION__, addr->sllc_sap); - if (unlikely(!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr))) + if (!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr)) goto out; rc = -EAFNOSUPPORT; - if (unlikely(addr->sllc_family != AF_LLC)) - goto out; - rc = -ENODEV; - rtnl_lock(); - llc->dev = dev_getbyhwaddr(addr->sllc_arphrd, addr->sllc_mac); - rtnl_unlock(); - if (!llc->dev) + if (addr->sllc_family != AF_LLC) goto out; if (!addr->sllc_sap) { rc = -EUSERS; @@ -314,7 +322,6 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) rc = -EBUSY; /* some other network layer is using the sap */ if (!sap) goto out; - llc_sap_hold(sap); } else { struct llc_addr laddr, daddr; struct sock *ask; @@ -331,7 +338,7 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) ask = llc_lookup_established(sap, &daddr, &laddr); if (ask) { sock_put(ask); - goto out_put; + goto out; } } llc->laddr.lsap = addr->sllc_sap; @@ -341,8 +348,6 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) llc_sap_add_socket(sap, sk); sock_reset_flag(sk, SOCK_ZAPPED); rc = 0; -out_put: - llc_sap_put(sap); out: return rc; } @@ -364,7 +369,7 @@ static int llc_ui_shutdown(struct socket *sock, int how) int rc = -ENOTCONN; lock_sock(sk); - if (unlikely(sk->sk_state != TCP_ESTABLISHED)) + if (sk->sk_state != TCP_ESTABLISHED) goto out; rc = -EINVAL; if (how != 2) @@ -399,18 +404,14 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr, struct sock *sk = sock->sk; struct llc_sock *llc = llc_sk(sk); struct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr; + struct net_device *dev; int rc = -EINVAL; lock_sock(sk); - if (unlikely(addrlen != sizeof(*addr))) + if (addrlen != sizeof(*addr)) goto out; rc = -EAFNOSUPPORT; - if (unlikely(addr->sllc_family != AF_LLC)) - goto out; - if (unlikely(sk->sk_type != SOCK_STREAM)) - goto out; - rc = -EALREADY; - if (unlikely(sock->state == SS_CONNECTING)) + if (addr->sllc_family != AF_LLC) goto out; /* bind connection to sap if user hasn't done it. */ if (sock_flag(sk, SOCK_ZAPPED)) { @@ -418,13 +419,19 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr, rc = llc_ui_autobind(sock, addr); if (rc) goto out; + llc->daddr.lsap = addr->sllc_sap; + memcpy(llc->daddr.mac, addr->sllc_mac, IFHWADDRLEN); } - llc->daddr.lsap = addr->sllc_sap; - memcpy(llc->daddr.mac, addr->sllc_mac, IFHWADDRLEN); + dev = llc->dev; + if (sk->sk_type != SOCK_STREAM) + goto out; + rc = -EALREADY; + if (sock->state == SS_CONNECTING) + goto out; sock->state = SS_CONNECTING; sk->sk_state = TCP_SYN_SENT; llc->link = llc_ui_next_link_no(llc->sap->laddr.lsap); - rc = llc_establish_connection(sk, llc->dev->dev_addr, + rc = llc_establish_connection(sk, dev->dev_addr, addr->sllc_mac, addr->sllc_sap); if (rc) { dprintk("%s: llc_ui_send_conn failed :-(\n", __FUNCTION__); @@ -432,30 +439,12 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr, sk->sk_state = TCP_CLOSE; goto out; } - - if (sk->sk_state == TCP_SYN_SENT) { - const long timeo = sock_sndtimeo(sk, flags & O_NONBLOCK); - - if (!timeo || !llc_ui_wait_for_conn(sk, timeo)) - goto out; - - rc = sock_intr_errno(timeo); - if (signal_pending(current)) - goto out; - } - - if (sk->sk_state == TCP_CLOSE) - goto sock_error; - - sock->state = SS_CONNECTED; - rc = 0; + rc = llc_ui_wait_for_conn(sk, sk->sk_rcvtimeo); + if (rc) + dprintk("%s: llc_ui_wait_for_conn failed=%d\n", __FUNCTION__, rc); out: release_sock(sk); return rc; -sock_error: - rc = sock_error(sk) ? : -ECONNABORTED; - sock->state = SS_UNCONNECTED; - goto out; } /** @@ -472,10 +461,10 @@ static int llc_ui_listen(struct socket *sock, int backlog) int rc = -EINVAL; lock_sock(sk); - if (unlikely(sock->state != SS_UNCONNECTED)) + if (sock->state != SS_UNCONNECTED) goto out; rc = -EOPNOTSUPP; - if (unlikely(sk->sk_type != SOCK_STREAM)) + if (sk->sk_type != SOCK_STREAM) goto out; rc = -EAGAIN; if (sock_flag(sk, SOCK_ZAPPED)) @@ -494,14 +483,20 @@ static int llc_ui_listen(struct socket *sock, int backlog) return rc; } -static int llc_ui_wait_for_disc(struct sock *sk, long timeout) +static int llc_ui_wait_for_disc(struct sock *sk, int timeout) { - DEFINE_WAIT(wait); - int rc = 0; + DECLARE_WAITQUEUE(wait, current); + int rc; - while (1) { - prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); - if (sk_wait_event(sk, &timeout, sk->sk_state == TCP_CLOSE)) + add_wait_queue_exclusive(sk->sk_sleep, &wait); + for (;;) { + __set_current_state(TASK_INTERRUPTIBLE); + rc = 0; + if (sk->sk_state != TCP_CLOSE) { + release_sock(sk); + timeout = schedule_timeout(timeout); + lock_sock(sk); + } else break; rc = -ERESTARTSYS; if (signal_pending(current)) @@ -509,40 +504,65 @@ static int llc_ui_wait_for_disc(struct sock *sk, long timeout) rc = -EAGAIN; if (!timeout) break; - rc = 0; } - finish_wait(sk->sk_sleep, &wait); + __set_current_state(TASK_RUNNING); + remove_wait_queue(sk->sk_sleep, &wait); return rc; } -static int llc_ui_wait_for_conn(struct sock *sk, long timeout) +static int llc_ui_wait_for_conn(struct sock *sk, int timeout) { - DEFINE_WAIT(wait); + DECLARE_WAITQUEUE(wait, current); + int rc; - while (1) { - prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); - if (sk_wait_event(sk, &timeout, sk->sk_state != TCP_SYN_SENT)) + add_wait_queue_exclusive(sk->sk_sleep, &wait); + for (;;) { + __set_current_state(TASK_INTERRUPTIBLE); + rc = -EAGAIN; + if (sk->sk_state == TCP_CLOSE) + break; + rc = 0; + if (sk->sk_state != TCP_ESTABLISHED) { + release_sock(sk); + timeout = schedule_timeout(timeout); + lock_sock(sk); + } else break; - if (signal_pending(current) || !timeout) + rc = -ERESTARTSYS; + if (signal_pending(current)) + break; + rc = -EAGAIN; + if (!timeout) break; } - finish_wait(sk->sk_sleep, &wait); - return timeout; + __set_current_state(TASK_RUNNING); + remove_wait_queue(sk->sk_sleep, &wait); + return rc; } -static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout) +static int llc_ui_wait_for_data(struct sock *sk, int timeout) { - DEFINE_WAIT(wait); - struct llc_sock *llc = llc_sk(sk); - int rc; + DECLARE_WAITQUEUE(wait, current); + int rc = 0; - while (1) { - prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); + add_wait_queue_exclusive(sk->sk_sleep, &wait); + for (;;) { + __set_current_state(TASK_INTERRUPTIBLE); + if (sk->sk_shutdown & RCV_SHUTDOWN) + break; + /* + * Well, if we have backlog, try to process it now. + */ + if (sk->sk_backlog.tail) { + release_sock(sk); + lock_sock(sk); + } rc = 0; - if (sk_wait_event(sk, &timeout, - (sk->sk_shutdown & RCV_SHUTDOWN) || - (!llc_data_accept_state(llc->state) && - !llc->p_flag))) + if (skb_queue_empty(&sk->sk_receive_queue)) { + release_sock(sk); + timeout = schedule_timeout(timeout); + lock_sock(sk); + } else break; rc = -ERESTARTSYS; if (signal_pending(current)) @@ -551,35 +571,40 @@ static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout) if (!timeout) break; } - finish_wait(sk->sk_sleep, &wait); + __set_current_state(TASK_RUNNING); + remove_wait_queue(sk->sk_sleep, &wait); return rc; } -static int llc_wait_data(struct sock *sk, long timeo) +static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout) { + DECLARE_WAITQUEUE(wait, current); + struct llc_sock *llc = llc_sk(sk); int rc; - while (1) { - /* - * POSIX 1003.1g mandates this order. - */ - if (sk->sk_err) { - rc = sock_error(sk); - break; - } - rc = 0; + add_wait_queue_exclusive(sk->sk_sleep, &wait); + for (;;) { + dprintk("%s: looping...\n", __FUNCTION__); + __set_current_state(TASK_INTERRUPTIBLE); + rc = -ENOTCONN; if (sk->sk_shutdown & RCV_SHUTDOWN) break; - rc = -EAGAIN; - if (!timeo) + rc = 0; + if (llc_data_accept_state(llc->state) || llc->p_flag) { + release_sock(sk); + timeout = schedule_timeout(timeout); + lock_sock(sk); + } else break; - rc = sock_intr_errno(timeo); + rc = -ERESTARTSYS; if (signal_pending(current)) break; - rc = 0; - if (sk_wait_data(sk, &timeo)) + rc = -EAGAIN; + if (!timeout) break; } + __set_current_state(TASK_RUNNING); + remove_wait_queue(sk->sk_sleep, &wait); return rc; } @@ -602,18 +627,15 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags) dprintk("%s: accepting on %02X\n", __FUNCTION__, llc_sk(sk)->laddr.lsap); lock_sock(sk); - if (unlikely(sk->sk_type != SOCK_STREAM)) + if (sk->sk_type != SOCK_STREAM) goto out; rc = -EINVAL; - if (unlikely(sock->state != SS_UNCONNECTED || - sk->sk_state != TCP_LISTEN)) + if (sock->state != SS_UNCONNECTED || sk->sk_state != TCP_LISTEN) goto out; /* wait for a connection to arrive. */ - if (skb_queue_empty(&sk->sk_receive_queue)) { - rc = llc_wait_data(sk, sk->sk_rcvtimeo); - if (rc) - goto out; - } + rc = llc_ui_wait_for_data(sk, sk->sk_rcvtimeo); + if (rc) + goto out; dprintk("%s: got a new connection on %02X\n", __FUNCTION__, llc_sk(sk)->laddr.lsap); skb = skb_dequeue(&sk->sk_receive_queue); @@ -635,6 +657,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags) /* put original socket back into a clean listen state. */ sk->sk_state = TCP_LISTEN; sk->sk_ack_backlog--; + skb->sk = NULL; dprintk("%s: ok success on %02X, client on %02X\n", __FUNCTION__, llc_sk(sk)->addr.sllc_sap, newllc->daddr.lsap); frees: @@ -648,167 +671,56 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags) * llc_ui_recvmsg - copy received data to the socket user. * @sock: Socket to copy data from. * @msg: Various user space related information. - * @len: Size of user buffer. + * @size: Size of user buffer. * @flags: User specified flags. * * Copy received data to the socket user. * Returns non-negative upon success, negative otherwise. */ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, - struct msghdr *msg, size_t len, int flags) + struct msghdr *msg, size_t size, int flags) { - struct sockaddr_llc *uaddr = (struct sockaddr_llc *)msg->msg_name; - const int nonblock = flags & MSG_DONTWAIT; - struct sk_buff *skb = NULL; struct sock *sk = sock->sk; - struct llc_sock *llc = llc_sk(sk); + struct sockaddr_llc *uaddr = (struct sockaddr_llc *)msg->msg_name; + struct sk_buff *skb; size_t copied = 0; - u32 peek_seq = 0; - u32 *seq; - unsigned long used; - int target; /* Read at least this many bytes */ - long timeo; + int rc = -ENOMEM, timeout; + int noblock = flags & MSG_DONTWAIT; + dprintk("%s: receiving in %02X from %02X\n", __FUNCTION__, + llc_sk(sk)->laddr.lsap, llc_sk(sk)->daddr.lsap); lock_sock(sk); - copied = -ENOTCONN; - if (sk->sk_state == TCP_LISTEN) + timeout = sock_rcvtimeo(sk, noblock); + rc = llc_ui_wait_for_data(sk, timeout); + if (rc) { + dprintk("%s: llc_ui_wait_for_data failed recv " + "in %02X from %02X\n", __FUNCTION__, + llc_sk(sk)->laddr.lsap, llc_sk(sk)->daddr.lsap); goto out; - - timeo = sock_rcvtimeo(sk, nonblock); - - seq = &llc->copied_seq; - if (flags & MSG_PEEK) { - peek_seq = llc->copied_seq; - seq = &peek_seq; - } - - target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); - copied = 0; - - do { - u32 offset; - - /* - * We need to check signals first, to get correct SIGURG - * handling. FIXME: Need to check this doesn't impact 1003.1g - * and move it down to the bottom of the loop - */ - if (signal_pending(current)) { - if (copied) - break; - copied = timeo ? sock_intr_errno(timeo) : -EAGAIN; - break; - } - - /* Next get a buffer. */ - - skb = skb_peek(&sk->sk_receive_queue); - if (skb) { - offset = *seq; - goto found_ok_skb; - } - /* Well, if we have backlog, try to process it now yet. */ - - if (copied >= target && !sk->sk_backlog.tail) - break; - - if (copied) { - if (sk->sk_err || - sk->sk_state == TCP_CLOSE || - (sk->sk_shutdown & RCV_SHUTDOWN) || - !timeo || - (flags & MSG_PEEK)) - break; - } else { - if (sock_flag(sk, SOCK_DONE)) - break; - - if (sk->sk_err) { - copied = sock_error(sk); - break; - } - if (sk->sk_shutdown & RCV_SHUTDOWN) - break; - - if (sk->sk_state == TCP_CLOSE) { - if (!sock_flag(sk, SOCK_DONE)) { - /* - * This occurs when user tries to read - * from never connected socket. - */ - copied = -ENOTCONN; - break; - } - break; - } - if (!timeo) { - copied = -EAGAIN; - break; - } - } - - if (copied >= target) { /* Do not sleep, just process backlog. */ - release_sock(sk); - lock_sock(sk); - } else - sk_wait_data(sk, &timeo); - - if ((flags & MSG_PEEK) && peek_seq != llc->copied_seq) { - if (net_ratelimit()) - printk(KERN_DEBUG "LLC(%s:%d): Application " - "bug, race in MSG_PEEK.\n", - current->comm, current->pid); - peek_seq = llc->copied_seq; - } - continue; - found_ok_skb: - /* Ok so how much can we use? */ - used = skb->len - offset; - if (len < used) - used = len; - - if (!(flags & MSG_TRUNC)) { - int rc = skb_copy_datagram_iovec(skb, offset, - msg->msg_iov, used); - if (rc) { - /* Exception. Bailout! */ - if (!copied) - copied = -EFAULT; - break; - } - } - - *seq += used; - copied += used; - len -= used; - - if (used + offset < skb->len) - continue; - - if (!(flags & MSG_PEEK)) { - sk_eat_skb(sk, skb); - *seq = 0; - } - } while (len > 0); - - /* - * According to UNIX98, msg_name/msg_namelen are ignored - * on connected socket. -ANK - * But... af_llc still doesn't have separate sets of methods for - * SOCK_DGRAM and SOCK_STREAM :-( So we have to do this test, will - * eventually fix this tho :-) -acme - */ - if (sk->sk_type == SOCK_DGRAM) - goto copy_uaddr; -out: - release_sock(sk); - return copied; -copy_uaddr: - if (uaddr != NULL && skb != NULL) { + } + skb = skb_dequeue(&sk->sk_receive_queue); + if (!skb) /* shutdown */ + goto out; + copied = skb->len; + if (copied > size) + copied = size; + rc = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); + if (rc) + goto dgram_free; + if (skb->len > copied) { + skb_pull(skb, copied); + skb_queue_head(&sk->sk_receive_queue, skb); + } + if (uaddr) memcpy(uaddr, llc_ui_skb_cb(skb), sizeof(*uaddr)); - msg->msg_namelen = sizeof(*uaddr); + msg->msg_namelen = sizeof(*uaddr); + if (!skb->next) { +dgram_free: + kfree_skb(skb); } - goto out; +out: + release_sock(sk); + return rc ? : copied; } /** @@ -828,6 +740,7 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock, struct sockaddr_llc *addr = (struct sockaddr_llc *)msg->msg_name; int flags = msg->msg_flags; int noblock = flags & MSG_DONTWAIT; + struct net_device *dev; struct sk_buff *skb; size_t size = 0; int rc = -EINVAL, copied = 0, hdrlen; @@ -850,17 +763,19 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock, if (rc) goto release; } - hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr); + dev = llc->dev; + hdrlen = dev->hard_header_len + llc_ui_header_len(sk, addr); size = hdrlen + len; - if (size > llc->dev->mtu) - size = llc->dev->mtu; + if (size > dev->mtu) + size = dev->mtu; copied = size - hdrlen; release_sock(sk); skb = sock_alloc_send_skb(sk, size, noblock, &rc); lock_sock(sk); if (!skb) goto release; - skb->dev = llc->dev; + skb->sk = sk; + skb->dev = dev; skb->protocol = llc_proto_type(addr->sllc_arphrd); skb_reserve(skb, hdrlen); rc = memcpy_fromiovec(skb_put(skb, copied), msg->msg_iov, copied); @@ -885,13 +800,15 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock, if (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua)) goto out; rc = llc_ui_send_data(sk, skb, noblock); + if (rc) + dprintk("%s: llc_ui_send_data failed: %d\n", __FUNCTION__, rc); out: - if (rc) { + if (rc) kfree_skb(skb); release: + if (rc) dprintk("%s: failed sending from %02X to %02X: %d\n", __FUNCTION__, llc->laddr.lsap, llc->daddr.lsap, rc); - } release_sock(sk); return rc ? : copied; } @@ -978,7 +895,7 @@ static int llc_ui_setsockopt(struct socket *sock, int level, int optname, int rc = -EINVAL, opt; lock_sock(sk); - if (unlikely(level != SOL_LLC || optlen != sizeof(int))) + if (level != SOL_LLC || optlen != sizeof(int)) goto out; rc = get_user(opt, (int __user *)optval); if (rc) @@ -998,22 +915,22 @@ static int llc_ui_setsockopt(struct socket *sock, int level, int optname, case LLC_OPT_ACK_TMR_EXP: if (opt > LLC_OPT_MAX_ACK_TMR_EXP) goto out; - llc->ack_timer.expire = opt * HZ; + llc->ack_timer.expire = opt; break; case LLC_OPT_P_TMR_EXP: if (opt > LLC_OPT_MAX_P_TMR_EXP) goto out; - llc->pf_cycle_timer.expire = opt * HZ; + llc->pf_cycle_timer.expire = opt; break; case LLC_OPT_REJ_TMR_EXP: if (opt > LLC_OPT_MAX_REJ_TMR_EXP) goto out; - llc->rej_sent_timer.expire = opt * HZ; + llc->rej_sent_timer.expire = opt; break; case LLC_OPT_BUSY_TMR_EXP: if (opt > LLC_OPT_MAX_BUSY_TMR_EXP) goto out; - llc->busy_state_timer.expire = opt * HZ; + llc->busy_state_timer.expire = opt; break; case LLC_OPT_TX_WIN: if (opt > LLC_OPT_MAX_WIN) @@ -1053,7 +970,7 @@ static int llc_ui_getsockopt(struct socket *sock, int level, int optname, int val = 0, len = 0, rc = -EINVAL; lock_sock(sk); - if (unlikely(level != SOL_LLC)) + if (level != SOL_LLC) goto out; rc = get_user(len, optlen); if (rc) @@ -1063,17 +980,17 @@ static int llc_ui_getsockopt(struct socket *sock, int level, int optname, goto out; switch (optname) { case LLC_OPT_RETRY: - val = llc->n2; break; + val = llc->n2; break; case LLC_OPT_SIZE: - val = llc->n1; break; + val = llc->n1; break; case LLC_OPT_ACK_TMR_EXP: - val = llc->ack_timer.expire / HZ; break; + val = llc->ack_timer.expire; break; case LLC_OPT_P_TMR_EXP: - val = llc->pf_cycle_timer.expire / HZ; break; + val = llc->pf_cycle_timer.expire; break; case LLC_OPT_REJ_TMR_EXP: - val = llc->rej_sent_timer.expire / HZ; break; + val = llc->rej_sent_timer.expire; break; case LLC_OPT_BUSY_TMR_EXP: - val = llc->busy_state_timer.expire / HZ; break; + val = llc->busy_state_timer.expire; break; case LLC_OPT_TX_WIN: val = llc->k; break; case LLC_OPT_RX_WIN: @@ -1117,12 +1034,8 @@ static struct proto_ops llc_ui_ops = { .sendpage = sock_no_sendpage, }; -static char llc_proc_err_msg[] __initdata = - KERN_CRIT "LLC: Unable to register the proc_fs entries\n"; -static char llc_sysctl_err_msg[] __initdata = - KERN_CRIT "LLC: Unable to register the sysctl entries\n"; -static char llc_sock_err_msg[] __initdata = - KERN_CRIT "LLC: Unable to register the network family\n"; +extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb); +extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb); static int __init llc2_init(void) { @@ -1135,28 +1048,13 @@ static int __init llc2_init(void) llc_station_init(); llc_ui_sap_last_autoport = LLC_SAP_DYN_START; rc = llc_proc_init(); - if (rc != 0) { - printk(llc_proc_err_msg); + if (rc != 0) goto out_unregister_llc_proto; - } - rc = llc_sysctl_init(); - if (rc) { - printk(llc_sysctl_err_msg); - goto out_proc; - } - rc = sock_register(&llc_ui_family_ops); - if (rc) { - printk(llc_sock_err_msg); - goto out_sysctl; - } + sock_register(&llc_ui_family_ops); llc_add_pack(LLC_DEST_SAP, llc_sap_handler); llc_add_pack(LLC_DEST_CONN, llc_conn_handler); out: return rc; -out_sysctl: - llc_sysctl_exit(); -out_proc: - llc_proc_exit(); out_unregister_llc_proto: proto_unregister(&llc_proto); goto out; @@ -1169,7 +1067,6 @@ static void __exit llc2_exit(void) llc_remove_pack(LLC_DEST_CONN); sock_unregister(PF_LLC); llc_proc_exit(); - llc_sysctl_exit(); proto_unregister(&llc_proto); } diff --git a/trunk/net/llc/llc_c_ac.c b/trunk/net/llc/llc_c_ac.c index b0bcfb1f12dd..b218be4c10ec 100644 --- a/trunk/net/llc/llc_c_ac.c +++ b/trunk/net/llc/llc_c_ac.c @@ -60,10 +60,23 @@ int llc_conn_ac_clear_remote_busy(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_conn_ind(struct sock *sk, struct sk_buff *skb) { - struct llc_conn_state_ev *ev = llc_conn_ev(skb); + int rc = -ENOTCONN; + u8 dsap; + struct llc_sap *sap; - ev->ind_prim = LLC_CONN_PRIM; - return 0; + llc_pdu_decode_dsap(skb, &dsap); + sap = llc_sap_find(dsap); + if (sap) { + struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_sock *llc = llc_sk(sk); + + llc_pdu_decode_sa(skb, llc->daddr.mac); + llc_pdu_decode_da(skb, llc->laddr.mac); + llc->dev = skb->dev; + ev->ind_prim = LLC_CONN_PRIM; + rc = 0; + } + return rc; } int llc_conn_ac_conn_confirm(struct sock *sk, struct sk_buff *skb) @@ -107,8 +120,10 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct sk_buff *skb) reason = LLC_DISC_REASON_RX_DISC_CMD_PDU; } else if (ev->type == LLC_CONN_EV_TYPE_ACK_TMR) reason = LLC_DISC_REASON_ACK_TMR_EXP; - else + else { + reason = 0; rc = -EINVAL; + } if (!rc) { ev->reason = reason; ev->ind_prim = LLC_DISC_PRIM; @@ -145,6 +160,9 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct sk_buff *skb) LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME) { reason = LLC_RESET_REASON_REMOTE; rc = 0; + } else { + reason = 0; + rc = 1; } break; case LLC_CONN_EV_TYPE_ACK_TMR: @@ -154,7 +172,8 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct sk_buff *skb) if (llc->retry_count > llc->n2) { reason = LLC_RESET_REASON_LOCAL; rc = 0; - } + } else + rc = 1; break; } if (!rc) { @@ -198,17 +217,18 @@ int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock *sk, int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_disc_cmd(nskb, 1); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); llc_conn_ac_set_p_flag_1(sk, skb); @@ -223,19 +243,20 @@ int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; u8 f_bit; + nskb->dev = llc->dev; llc_pdu_decode_pf_bit(skb, &f_bit); llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_dm_rsp(nskb, f_bit); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -249,17 +270,19 @@ int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_dm_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + u8 f_bit = 1; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); - llc_pdu_init_as_dm_rsp(nskb, 1); + llc_pdu_init_as_dm_rsp(nskb, f_bit); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -283,16 +306,17 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb) llc_pdu_decode_pf_bit(skb, &f_bit); else f_bit = 0; - nskb = llc_alloc_frame(sk, llc->dev); + nskb = llc_alloc_frame(); if (nskb) { struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, llc->vR, INCORRECT); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -306,19 +330,21 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + u8 f_bit = 0; + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)&llc->rx_pdu_hdr; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); - llc_pdu_init_as_frmr_rsp(nskb, pdu, 0, llc->vS, + llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, llc->vR, INCORRECT); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -334,20 +360,21 @@ int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) u8 f_bit; int rc = -ENOBUFS; struct sk_buff *nskb; - struct llc_sock *llc = llc_sk(sk); llc_pdu_decode_pf_bit(skb, &f_bit); - nskb = llc_alloc_frame(sk, llc->dev); + nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, llc->vR, INCORRECT); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -368,7 +395,7 @@ int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_i_cmd(skb, 1, llc->vS, llc->vR); rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); - if (likely(!rc)) { + if (!rc) { llc_conn_send_pdu(sk, skb); llc_conn_ac_inc_vs_by_1(sk, skb); } @@ -385,7 +412,7 @@ static int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk, struct sk_buff *skb) llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); - if (likely(!rc)) { + if (!rc) { llc_conn_send_pdu(sk, skb); llc_conn_ac_inc_vs_by_1(sk, skb); } @@ -402,7 +429,7 @@ int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); - if (likely(!rc)) { + if (!rc) { llc_conn_send_pdu(sk, skb); llc_conn_ac_inc_vs_by_1(sk, skb); } @@ -424,17 +451,18 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk, u8 nr; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (likely(!rc)) + if (!rc) llc_conn_send_pdu(sk, nskb); else kfree_skb(skb); @@ -459,17 +487,18 @@ int llc_conn_ac_resend_i_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_rej_cmd(nskb, 1, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -483,17 +512,19 @@ int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + u8 f_bit = 1; + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); - llc_pdu_init_as_rej_rsp(nskb, 1, llc->vR); + llc_pdu_init_as_rej_rsp(nskb, f_bit, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -507,17 +538,19 @@ int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + u8 f_bit = 0; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); - llc_pdu_init_as_rej_rsp(nskb, 0, llc->vR); + llc_pdu_init_as_rej_rsp(nskb, f_bit, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -531,17 +564,18 @@ int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_rnr_cmd(nskb, 1, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -555,17 +589,19 @@ int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + u8 f_bit = 1; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); - llc_pdu_init_as_rnr_rsp(nskb, 1, llc->vR); + llc_pdu_init_as_rnr_rsp(nskb, f_bit, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -579,17 +615,19 @@ int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + u8 f_bit = 0; + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); - llc_pdu_init_as_rnr_rsp(nskb, 0, llc->vR); + llc_pdu_init_as_rnr_rsp(nskb, f_bit, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -607,7 +645,7 @@ int llc_conn_ac_set_remote_busy(struct sock *sk, struct sk_buff *skb) if (!llc->remote_busy_flag) { llc->remote_busy_flag = 1; mod_timer(&llc->busy_state_timer.timer, - jiffies + llc->busy_state_timer.expire); + jiffies + llc->busy_state_timer.expire * HZ); } return 0; } @@ -615,17 +653,18 @@ int llc_conn_ac_set_remote_busy(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rnr_rsp(nskb, 0, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -639,17 +678,18 @@ int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_rr_cmd(nskb, 1, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -663,18 +703,19 @@ int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; u8 f_bit = 1; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, f_bit, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -688,17 +729,19 @@ int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + u8 f_bit = 1; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); - llc_pdu_init_as_rr_rsp(nskb, 1, llc->vR); + llc_pdu_init_as_rr_rsp(nskb, f_bit, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -712,17 +755,18 @@ int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -736,17 +780,18 @@ int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_ack_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -770,8 +815,8 @@ void llc_conn_set_p_flag(struct sock *sk, u8 value) int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; + struct sk_buff *nskb = llc_alloc_frame(); struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); if (nskb) { struct llc_sap *sap = llc->sap; @@ -779,11 +824,12 @@ int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) if (llc->dev->flags & IFF_LOOPBACK) dmac = llc->dev->dev_addr; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_sabme_cmd(nskb, 1); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, dmac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); llc_conn_set_p_flag(sk, 1); @@ -799,11 +845,11 @@ int llc_conn_ac_send_ua_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) { u8 f_bit; int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); llc_pdu_decode_pf_bit(skb, &f_bit); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; nskb->dev = llc->dev; @@ -811,7 +857,7 @@ int llc_conn_ac_send_ua_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_ua_rsp(nskb, f_bit); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -840,7 +886,7 @@ int llc_conn_ac_start_p_timer(struct sock *sk, struct sk_buff *skb) llc_conn_set_p_flag(sk, 1); mod_timer(&llc->pf_cycle_timer.timer, - jiffies + llc->pf_cycle_timer.expire); + jiffies + llc->pf_cycle_timer.expire * HZ); return 0; } @@ -911,7 +957,7 @@ static int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock *sk, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_i_cmd(skb, llc->ack_pf, llc->vS, llc->vR); rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); - if (likely(!rc)) { + if (!rc) { llc_conn_send_pdu(sk, skb); llc_conn_ac_inc_vs_by_1(sk, skb); } @@ -955,17 +1001,18 @@ static int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct llc_sock *llc = llc_sk(sk); - struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (nskb) { + struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; + nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, llc->ack_pf, llc->vR); rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, llc->daddr.mac); - if (unlikely(rc)) + if (rc) goto free; llc_conn_send_pdu(sk, nskb); } @@ -1118,7 +1165,7 @@ int llc_conn_ac_start_ack_timer(struct sock *sk, struct sk_buff *skb) { struct llc_sock *llc = llc_sk(sk); - mod_timer(&llc->ack_timer.timer, jiffies + llc->ack_timer.expire); + mod_timer(&llc->ack_timer.timer, jiffies + llc->ack_timer.expire * HZ); return 0; } @@ -1127,7 +1174,7 @@ int llc_conn_ac_start_rej_timer(struct sock *sk, struct sk_buff *skb) struct llc_sock *llc = llc_sk(sk); mod_timer(&llc->rej_sent_timer.timer, - jiffies + llc->rej_sent_timer.expire); + jiffies + llc->rej_sent_timer.expire * HZ); return 0; } @@ -1138,7 +1185,7 @@ int llc_conn_ac_start_ack_tmr_if_not_running(struct sock *sk, if (!timer_pending(&llc->ack_timer.timer)) mod_timer(&llc->ack_timer.timer, - jiffies + llc->ack_timer.expire); + jiffies + llc->ack_timer.expire * HZ); return 0; } @@ -1186,7 +1233,7 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct sk_buff *skb) } if (unacked) mod_timer(&llc->ack_timer.timer, - jiffies + llc->ack_timer.expire); + jiffies + llc->ack_timer.expire * HZ); } else if (llc->failed_data_req) { u8 f_bit; @@ -1307,13 +1354,13 @@ int llc_conn_ac_set_vs_nr(struct sock *sk, struct sk_buff *skb) return 0; } -static int llc_conn_ac_inc_vs_by_1(struct sock *sk, struct sk_buff *skb) +int llc_conn_ac_inc_vs_by_1(struct sock *sk, struct sk_buff *skb) { llc_sk(sk)->vS = (llc_sk(sk)->vS + 1) % 128; return 0; } -static void llc_conn_tmr_common_cb(unsigned long timeout_data, u8 type) +void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data) { struct sock *sk = (struct sock *)timeout_data; struct sk_buff *skb = alloc_skb(0, GFP_ATOMIC); @@ -1322,31 +1369,59 @@ static void llc_conn_tmr_common_cb(unsigned long timeout_data, u8 type) if (skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - skb_set_owner_r(skb, sk); - ev->type = type; + skb->sk = sk; + ev->type = LLC_CONN_EV_TYPE_P_TMR; llc_process_tmr_ev(sk, skb); } bh_unlock_sock(sk); } -void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data) -{ - llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_P_TMR); -} - void llc_conn_busy_tmr_cb(unsigned long timeout_data) { - llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_BUSY_TMR); + struct sock *sk = (struct sock *)timeout_data; + struct sk_buff *skb = alloc_skb(0, GFP_ATOMIC); + + bh_lock_sock(sk); + if (skb) { + struct llc_conn_state_ev *ev = llc_conn_ev(skb); + + skb->sk = sk; + ev->type = LLC_CONN_EV_TYPE_BUSY_TMR; + llc_process_tmr_ev(sk, skb); + } + bh_unlock_sock(sk); } void llc_conn_ack_tmr_cb(unsigned long timeout_data) { - llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_ACK_TMR); + struct sock* sk = (struct sock *)timeout_data; + struct sk_buff *skb = alloc_skb(0, GFP_ATOMIC); + + bh_lock_sock(sk); + if (skb) { + struct llc_conn_state_ev *ev = llc_conn_ev(skb); + + skb->sk = sk; + ev->type = LLC_CONN_EV_TYPE_ACK_TMR; + llc_process_tmr_ev(sk, skb); + } + bh_unlock_sock(sk); } void llc_conn_rej_tmr_cb(unsigned long timeout_data) { - llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_REJ_TMR); + struct sock *sk = (struct sock *)timeout_data; + struct sk_buff *skb = alloc_skb(0, GFP_ATOMIC); + + bh_lock_sock(sk); + if (skb) { + struct llc_conn_state_ev *ev = llc_conn_ev(skb); + + skb->sk = sk; + ev->type = LLC_CONN_EV_TYPE_REJ_TMR; + llc_process_tmr_ev(sk, skb); + } + bh_unlock_sock(sk); } int llc_conn_ac_rst_vs(struct sock *sk, struct sk_buff *skb) diff --git a/trunk/net/llc/llc_c_ev.c b/trunk/net/llc/llc_c_ev.c index c5deda246614..d5bdb53a348f 100644 --- a/trunk/net/llc/llc_c_ev.c +++ b/trunk/net/llc/llc_c_ev.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -47,6 +46,8 @@ #define dprintk(args...) #endif +extern u16 llc_circular_between(u8 a, u8 b, u8 c); + /** * llc_util_ns_inside_rx_window - check if sequence number is in rx window * @ns: sequence number of received pdu. @@ -98,7 +99,7 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr) int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->prim == LLC_CONN_PRIM && ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; @@ -106,7 +107,7 @@ int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->prim == LLC_DATA_PRIM && ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; @@ -114,7 +115,7 @@ int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->prim == LLC_DISC_PRIM && ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; @@ -122,7 +123,7 @@ int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->prim == LLC_RESET_PRIM && ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; @@ -130,7 +131,7 @@ int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type == LLC_CONN_EV_TYPE_SIMPLE && ev->prim_type == LLC_CONN_EV_LOCAL_BUSY_DETECTED ? 0 : 1; @@ -138,7 +139,7 @@ int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type == LLC_CONN_EV_TYPE_SIMPLE && ev->prim_type == LLC_CONN_EV_LOCAL_BUSY_CLEARED ? 0 : 1; @@ -151,7 +152,7 @@ int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); + struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_U(pdu) && LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_DISC ? 0 : 1; @@ -159,7 +160,7 @@ int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); + struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_U(pdu) && LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_DM ? 0 : 1; @@ -167,7 +168,7 @@ int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); + struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_U(pdu) && LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR ? 0 : 1; @@ -175,7 +176,7 @@ int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return llc_conn_space(sk, skb) && LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && @@ -185,7 +186,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return llc_conn_space(sk, skb) && LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && @@ -196,9 +197,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - const u8 vr = llc_sk(sk)->vR; - const u8 ns = LLC_I_GET_NS(pdu); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + u8 vr = llc_sk(sk)->vR; + u8 ns = LLC_I_GET_NS(pdu); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && LLC_I_PF_IS_0(pdu) && ns != vr && @@ -208,9 +209,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - const u8 vr = llc_sk(sk)->vR; - const u8 ns = LLC_I_GET_NS(pdu); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + u8 vr = llc_sk(sk)->vR; + u8 ns = LLC_I_GET_NS(pdu); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && LLC_I_PF_IS_1(pdu) && ns != vr && @@ -220,11 +221,10 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn * pdu = llc_pdu_sn_hdr(skb); - const u8 vr = llc_sk(sk)->vR; - const u8 ns = LLC_I_GET_NS(pdu); - const u16 rc = LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && - ns != vr && + struct llc_pdu_sn * pdu = llc_pdu_sn_hdr(skb); + u8 vr = llc_sk(sk)->vR; + u8 ns = LLC_I_GET_NS(pdu); + u16 rc = LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && ns != vr && llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1; if (!rc) dprintk("%s: matched, state=%d, ns=%d, vr=%d\n", @@ -234,7 +234,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return llc_conn_space(sk, skb) && LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && @@ -244,7 +244,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && LLC_I_PF_IS_1(pdu) && @@ -253,7 +253,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return llc_conn_space(sk, skb) && LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && @@ -263,9 +263,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - const u8 vr = llc_sk(sk)->vR; - const u8 ns = LLC_I_GET_NS(pdu); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + u8 vr = llc_sk(sk)->vR; + u8 ns = LLC_I_GET_NS(pdu); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && LLC_I_PF_IS_0(pdu) && ns != vr && @@ -275,9 +275,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - const u8 vr = llc_sk(sk)->vR; - const u8 ns = LLC_I_GET_NS(pdu); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + u8 vr = llc_sk(sk)->vR; + u8 ns = LLC_I_GET_NS(pdu); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && LLC_I_PF_IS_1(pdu) && ns != vr && @@ -287,9 +287,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - const u8 vr = llc_sk(sk)->vR; - const u8 ns = LLC_I_GET_NS(pdu); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + u8 vr = llc_sk(sk)->vR; + u8 ns = LLC_I_GET_NS(pdu); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && ns != vr && !llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1; @@ -298,11 +298,10 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - const u8 vr = llc_sk(sk)->vR; - const u8 ns = LLC_I_GET_NS(pdu); - const u16 rc = LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && - ns != vr && + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + u8 vr = llc_sk(sk)->vR; + u8 ns = LLC_I_GET_NS(pdu); + u16 rc = LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && ns != vr && llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1; if (!rc) dprintk("%s: matched, state=%d, ns=%d, vr=%d\n", @@ -312,7 +311,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk, int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_0(pdu) && @@ -321,7 +320,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_1(pdu) && @@ -330,7 +329,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_0(pdu) && @@ -339,7 +338,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_1(pdu) && @@ -348,7 +347,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); + struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PDU_RSP(pdu) == LLC_2_PDU_RSP_REJ ? 0 : 1; @@ -356,7 +355,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_0(pdu) && @@ -365,7 +364,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_1(pdu) && @@ -374,7 +373,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_0(pdu) && @@ -383,7 +382,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_1(pdu) && @@ -392,7 +391,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_0(pdu) && @@ -401,7 +400,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && LLC_S_PF_IS_1(pdu) && @@ -410,7 +409,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return llc_conn_space(sk, skb) && LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && @@ -420,7 +419,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); return llc_conn_space(sk, skb) && LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && @@ -430,7 +429,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) { - const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); + struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_U(pdu) && LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME ? 0 : 1; @@ -447,7 +446,7 @@ int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) { u16 rc = 1; - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); if (LLC_PDU_IS_CMD(pdu)) { if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) { @@ -462,7 +461,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) { u16 rc = 1; - const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); + struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); if (LLC_PDU_IS_CMD(pdu)) { if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) @@ -478,10 +477,32 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) return rc; } +int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) +{ + u16 rc = 1; + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + + if (LLC_PDU_IS_RSP(pdu)) { + if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) { + if (LLC_I_PF_IS_1(pdu)) + rc = 0; + } else if (LLC_PDU_TYPE_IS_U(pdu)) + switch (LLC_U_PDU_RSP(pdu)) { + case LLC_2_PDU_RSP_UA: + case LLC_2_PDU_RSP_DM: + case LLC_2_PDU_RSP_FRMR: + if (LLC_U_PF_IS_1(pdu)) + rc = 0; + break; + } + } + return rc; +} + int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) { u16 rc = 1; - const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); + struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); if (LLC_PDU_IS_RSP(pdu)) { if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) @@ -503,9 +524,9 @@ int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk, struct sk_buff *skb) { u16 rc = 1; - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - const u8 vs = llc_sk(sk)->vS; - const u8 nr = LLC_I_GET_NR(pdu); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + u8 vs = llc_sk(sk)->vS; + u8 nr = LLC_I_GET_NR(pdu); if (LLC_PDU_IS_CMD(pdu) && (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) && @@ -521,9 +542,9 @@ int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk, struct sk_buff *skb) { u16 rc = 1; - const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - const u8 vs = llc_sk(sk)->vS; - const u8 nr = LLC_I_GET_NR(pdu); + struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); + u8 vs = llc_sk(sk)->vS; + u8 nr = LLC_I_GET_NR(pdu); if (LLC_PDU_IS_RSP(pdu) && (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) && @@ -542,28 +563,28 @@ int llc_conn_ev_rx_any_frame(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_p_tmr_exp(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type != LLC_CONN_EV_TYPE_P_TMR; } int llc_conn_ev_ack_tmr_exp(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type != LLC_CONN_EV_TYPE_ACK_TMR; } int llc_conn_ev_rej_tmr_exp(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type != LLC_CONN_EV_TYPE_REJ_TMR; } int llc_conn_ev_busy_tmr_exp(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type != LLC_CONN_EV_TYPE_BUSY_TMR; } @@ -575,7 +596,7 @@ int llc_conn_ev_init_p_f_cycle(struct sock *sk, struct sk_buff *skb) int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb) { - const struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type == LLC_CONN_EV_TYPE_SIMPLE && ev->prim_type == LLC_CONN_EV_TX_BUFF_FULL ? 0 : 1; diff --git a/trunk/net/llc/llc_conn.c b/trunk/net/llc/llc_conn.c index c761c15da421..4c644bc70eae 100644 --- a/trunk/net/llc/llc_conn.c +++ b/trunk/net/llc/llc_conn.c @@ -40,11 +40,6 @@ static struct llc_conn_state_trans *llc_qualify_conn_ev(struct sock *sk, /* Offset table on connection states transition diagram */ static int llc_offset_table[NBR_CONN_STATES][NBR_CONN_EV]; -int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ; -int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ; -int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ; -int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ; - /** * llc_conn_state_process - sends event to connection state machine * @sk: connection @@ -58,7 +53,7 @@ int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ; int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) { int rc; - struct llc_sock *llc = llc_sk(skb->sk); + struct llc_sock *llc = llc_sk(sk); struct llc_conn_state_ev *ev = llc_conn_ev(skb); /* @@ -68,16 +63,13 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) */ skb_get(skb); ev->ind_prim = ev->cfm_prim = 0; - /* - * Send event to state machine - */ - rc = llc_conn_service(skb->sk, skb); - if (unlikely(rc != 0)) { + rc = llc_conn_service(sk, skb); /* sending event to state machine */ + if (rc) { printk(KERN_ERR "%s: llc_conn_service failed\n", __FUNCTION__); goto out_kfree_skb; } - if (unlikely(!ev->ind_prim && !ev->cfm_prim)) { + if (!ev->ind_prim && !ev->cfm_prim) { /* indicate or confirm not required */ /* XXX this is not very pretty, perhaps we should store * XXX indicate/confirm-needed state in the llc_conn_state_ev @@ -88,13 +80,13 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) goto out_skb_put; } - if (unlikely(ev->ind_prim && ev->cfm_prim)) /* Paranoia */ + if (ev->ind_prim && ev->cfm_prim) /* Paranoia */ skb_get(skb); switch (ev->ind_prim) { case LLC_DATA_PRIM: - llc_save_primitive(sk, skb, LLC_DATA_PRIM); - if (unlikely(sock_queue_rcv_skb(sk, skb))) { + llc_save_primitive(skb, LLC_DATA_PRIM); + if (sock_queue_rcv_skb(sk, skb)) { /* * shouldn't happen */ @@ -103,14 +95,13 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) kfree_skb(skb); } break; - case LLC_CONN_PRIM: - /* - * Can't be sock_queue_rcv_skb, because we have to leave the - * skb->sk pointing to the newly created struct sock in - * llc_conn_handler. -acme - */ - skb_queue_tail(&sk->sk_receive_queue, skb); - sk->sk_state_change(sk); + case LLC_CONN_PRIM: { + struct sock *parent = skb->sk; + + skb->sk = sk; + skb_queue_tail(&parent->sk_receive_queue, skb); + sk->sk_state_change(parent); + } break; case LLC_DISC_PRIM: sock_hold(sk); @@ -120,8 +111,8 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) sk->sk_socket->state = SS_UNCONNECTED; sk->sk_state = TCP_CLOSE; if (!sock_flag(sk, SOCK_DEAD)) { - sock_set_flag(sk, SOCK_DEAD); sk->sk_state_change(sk); + sock_set_flag(sk, SOCK_DEAD); } } kfree_skb(skb); @@ -474,7 +465,7 @@ static int llc_exec_conn_trans_actions(struct sock *sk, } /** - * __llc_lookup_established - Finds connection for the remote/local sap/mac + * llc_lookup_established - Finds connection for the remote/local sap/mac * @sap: SAP * @daddr: address of remote LLC (MAC + SAP) * @laddr: address of local LLC (MAC + SAP) @@ -482,16 +473,14 @@ static int llc_exec_conn_trans_actions(struct sock *sk, * Search connection list of the SAP and finds connection using the remote * mac, remote sap, local mac, and local sap. Returns pointer for * connection found, %NULL otherwise. - * Caller has to make sure local_bh is disabled. */ -static struct sock *__llc_lookup_established(struct llc_sap *sap, - struct llc_addr *daddr, - struct llc_addr *laddr) +struct sock *llc_lookup_established(struct llc_sap *sap, struct llc_addr *daddr, + struct llc_addr *laddr) { struct sock *rc; struct hlist_node *node; - read_lock(&sap->sk_list.lock); + read_lock_bh(&sap->sk_list.lock); sk_for_each(rc, node, &sap->sk_list.list) { struct llc_sock *llc = llc_sk(rc); @@ -505,22 +494,10 @@ static struct sock *__llc_lookup_established(struct llc_sap *sap, } rc = NULL; found: - read_unlock(&sap->sk_list.lock); + read_unlock_bh(&sap->sk_list.lock); return rc; } -struct sock *llc_lookup_established(struct llc_sap *sap, - struct llc_addr *daddr, - struct llc_addr *laddr) -{ - struct sock *sk; - - local_bh_disable(); - sk = __llc_lookup_established(sap, daddr, laddr); - local_bh_enable(); - return sk; -} - /** * llc_lookup_listener - Finds listener for local MAC + SAP * @sap: SAP @@ -529,7 +506,6 @@ struct sock *llc_lookup_established(struct llc_sap *sap, * Search connection list of the SAP and finds connection listening on * local mac, and local sap. Returns pointer for parent socket found, * %NULL otherwise. - * Caller has to make sure local_bh is disabled. */ static struct sock *llc_lookup_listener(struct llc_sap *sap, struct llc_addr *laddr) @@ -537,7 +513,7 @@ static struct sock *llc_lookup_listener(struct llc_sap *sap, struct sock *rc; struct hlist_node *node; - read_lock(&sap->sk_list.lock); + read_lock_bh(&sap->sk_list.lock); sk_for_each(rc, node, &sap->sk_list.list) { struct llc_sock *llc = llc_sk(rc); @@ -551,19 +527,10 @@ static struct sock *llc_lookup_listener(struct llc_sap *sap, } rc = NULL; found: - read_unlock(&sap->sk_list.lock); + read_unlock_bh(&sap->sk_list.lock); return rc; } -static struct sock *__llc_lookup(struct llc_sap *sap, - struct llc_addr *daddr, - struct llc_addr *laddr) -{ - struct sock *sk = __llc_lookup_established(sap, daddr, laddr); - - return sk ? : llc_lookup_listener(sap, laddr); -} - /** * llc_data_accept_state - designates if in this state data can be sent. * @state: state of connection. @@ -577,14 +544,14 @@ u8 llc_data_accept_state(u8 state) } /** - * llc_find_next_offset - finds offset for next category of transitions + * find_next_offset - finds offset for next category of transitions * @state: state table. * @offset: start offset. * * Finds offset of next category of transitions in transition table. * Returns the start index of next category. */ -static u16 __init llc_find_next_offset(struct llc_conn_state *state, u16 offset) +static u16 find_next_offset(struct llc_conn_state *state, u16 offset) { u16 cnt = 0; struct llc_conn_state_trans **next_trans; @@ -611,8 +578,8 @@ void __init llc_build_offset_table(void) next_offset = 0; for (ev_type = 0; ev_type < NBR_CONN_EV; ev_type++) { llc_offset_table[state][ev_type] = next_offset; - next_offset += llc_find_next_offset(curr_state, - next_offset) + 1; + next_offset += find_next_offset(curr_state, + next_offset) + 1; } } } @@ -656,7 +623,6 @@ static int llc_find_offset(int state, int ev_type) */ void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk) { - llc_sap_hold(sap); write_lock_bh(&sap->sk_list.lock); llc_sk(sk)->sap = sap; sk_add_node(sk, &sap->sk_list.list); @@ -676,7 +642,6 @@ void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk) write_lock_bh(&sap->sk_list.lock); sk_del_node_init(sk); write_unlock_bh(&sap->sk_list.lock); - llc_sap_put(sap); } /** @@ -689,34 +654,15 @@ void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk) static int llc_conn_rcv(struct sock* sk, struct sk_buff *skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); + struct llc_sock *llc = llc_sk(sk); + if (!llc->dev) + llc->dev = skb->dev; ev->type = LLC_CONN_EV_TYPE_PDU; ev->reason = 0; return llc_conn_state_process(sk, skb); } -static struct sock *llc_create_incoming_sock(struct sock *sk, - struct net_device *dev, - struct llc_addr *saddr, - struct llc_addr *daddr) -{ - struct sock *newsk = llc_sk_alloc(sk->sk_family, GFP_ATOMIC, - sk->sk_prot); - struct llc_sock *newllc, *llc = llc_sk(sk); - - if (!newsk) - goto out; - newllc = llc_sk(newsk); - memcpy(&newllc->laddr, daddr, sizeof(newllc->laddr)); - memcpy(&newllc->daddr, saddr, sizeof(newllc->daddr)); - newllc->dev = dev; - dev_hold(dev); - llc_sap_add_socket(llc->sap, newsk); - llc_sap_hold(llc->sap); -out: - return newsk; -} - void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb) { struct llc_addr saddr, daddr; @@ -727,35 +673,35 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb) llc_pdu_decode_da(skb, daddr.mac); llc_pdu_decode_dsap(skb, &daddr.lsap); - sk = __llc_lookup(sap, &saddr, &daddr); - if (!sk) - goto drop; - - bh_lock_sock(sk); - /* - * This has to be done here and not at the upper layer ->accept - * method because of the way the PROCOM state machine works: - * it needs to set several state variables (see, for instance, - * llc_adm_actions_2 in net/llc/llc_c_st.c) and send a packet to - * the originator of the new connection, and this state has to be - * in the newly created struct sock private area. -acme - */ - if (unlikely(sk->sk_state == TCP_LISTEN)) { - struct sock *newsk = llc_create_incoming_sock(sk, skb->dev, - &saddr, &daddr); - if (!newsk) - goto drop_unlock; - skb_set_owner_r(skb, newsk); - } else { + sk = llc_lookup_established(sap, &saddr, &daddr); + if (!sk) { /* - * Can't be skb_set_owner_r, this will be done at the - * llc_conn_state_process function, later on, when we will use - * skb_queue_rcv_skb to send it to upper layers, this is - * another trick required to cope with how the PROCOM state - * machine works. -acme + * Didn't find an active connection; verify if there + * is a listening socket for this llc addr */ + struct llc_sock *llc; + struct sock *parent = llc_lookup_listener(sap, &daddr); + + if (!parent) { + dprintk("llc_lookup_listener failed!\n"); + goto drop; + } + + sk = llc_sk_alloc(parent->sk_family, GFP_ATOMIC, parent->sk_prot); + if (!sk) { + sock_put(parent); + goto drop; + } + llc = llc_sk(sk); + memcpy(&llc->laddr, &daddr, sizeof(llc->laddr)); + memcpy(&llc->daddr, &saddr, sizeof(llc->daddr)); + llc_sap_add_socket(sap, sk); + sock_hold(sk); + sock_put(parent); + skb->sk = parent; + } else skb->sk = sk; - } + bh_lock_sock(sk); if (!sock_owned_by_user(sk)) llc_conn_rcv(sk, skb); else { @@ -763,16 +709,11 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb) llc_set_backlog_type(skb, LLC_PACKET); sk_add_backlog(sk, skb); } -out: bh_unlock_sock(sk); sock_put(sk); return; drop: kfree_skb(skb); - return; -drop_unlock: - kfree_skb(skb); - goto out; } #undef LLC_REFCNT_DEBUG @@ -780,6 +721,32 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb) static atomic_t llc_sock_nr; #endif +/** + * llc_release_sockets - releases all sockets in a sap + * @sap: sap to release its sockets + * + * Releases all connections of a sap. Returns 0 if all actions complete + * successfully, nonzero otherwise + */ +int llc_release_sockets(struct llc_sap *sap) +{ + int rc = 0; + struct sock *sk; + struct hlist_node *node; + + write_lock_bh(&sap->sk_list.lock); + + sk_for_each(sk, node, &sap->sk_list.list) { + llc_sk(sk)->state = LLC_CONN_STATE_TEMP; + + if (llc_send_disc(sk)) + rc = 1; + } + + write_unlock_bh(&sap->sk_list.lock); + return rc; +} + /** * llc_backlog_rcv - Processes rx frames and expired timers. * @sk: LLC sock (p8022 connection) @@ -795,14 +762,14 @@ static int llc_backlog_rcv(struct sock *sk, struct sk_buff *skb) int rc = 0; struct llc_sock *llc = llc_sk(sk); - if (likely(llc_backlog_type(skb) == LLC_PACKET)) { - if (likely(llc->state > 1)) /* not closed */ + if (llc_backlog_type(skb) == LLC_PACKET) { + if (llc->state > 1) /* not closed */ rc = llc_conn_rcv(sk, skb); else goto out_kfree_skb; } else if (llc_backlog_type(skb) == LLC_EVENT) { /* timer expiration event */ - if (likely(llc->state > 1)) /* not closed */ + if (llc->state > 1) /* not closed */ rc = llc_conn_state_process(sk, skb); else goto out_kfree_skb; @@ -832,22 +799,22 @@ static void llc_sk_init(struct sock* sk) llc->dec_step = llc->connect_step = 1; init_timer(&llc->ack_timer.timer); - llc->ack_timer.expire = sysctl_llc2_ack_timeout; + llc->ack_timer.expire = LLC_ACK_TIME; llc->ack_timer.timer.data = (unsigned long)sk; llc->ack_timer.timer.function = llc_conn_ack_tmr_cb; init_timer(&llc->pf_cycle_timer.timer); - llc->pf_cycle_timer.expire = sysctl_llc2_p_timeout; + llc->pf_cycle_timer.expire = LLC_P_TIME; llc->pf_cycle_timer.timer.data = (unsigned long)sk; llc->pf_cycle_timer.timer.function = llc_conn_pf_cycle_tmr_cb; init_timer(&llc->rej_sent_timer.timer); - llc->rej_sent_timer.expire = sysctl_llc2_rej_timeout; + llc->rej_sent_timer.expire = LLC_REJ_TIME; llc->rej_sent_timer.timer.data = (unsigned long)sk; llc->rej_sent_timer.timer.function = llc_conn_rej_tmr_cb; init_timer(&llc->busy_state_timer.timer); - llc->busy_state_timer.expire = sysctl_llc2_busy_timeout; + llc->busy_state_timer.expire = LLC_BUSY_TIME; llc->busy_state_timer.timer.data = (unsigned long)sk; llc->busy_state_timer.timer.function = llc_conn_busy_tmr_cb; @@ -867,7 +834,7 @@ static void llc_sk_init(struct sock* sk) * Allocates a LLC sock and initializes it. Returns the new LLC sock * or %NULL if there's no memory available for one */ -struct sock *llc_sk_alloc(int family, gfp_t priority, struct proto *prot) +struct sock *llc_sk_alloc(int family, int priority, struct proto *prot) { struct sock *sk = sk_alloc(family, priority, prot, 1); diff --git a/trunk/net/llc/llc_core.c b/trunk/net/llc/llc_core.c index ab0fcd32fd84..9727455bf0e7 100644 --- a/trunk/net/llc/llc_core.c +++ b/trunk/net/llc/llc_core.c @@ -40,7 +40,6 @@ static struct llc_sap *llc_sap_alloc(void) sap->state = LLC_SAP_STATE_ACTIVE; memcpy(sap->laddr.mac, llc_station_mac_sa, ETH_ALEN); rwlock_init(&sap->sk_list.lock); - atomic_set(&sap->refcnt, 1); } return sap; } @@ -53,7 +52,9 @@ static struct llc_sap *llc_sap_alloc(void) */ static void llc_add_sap(struct llc_sap *sap) { + write_lock_bh(&llc_sap_list_lock); list_add_tail(&sap->node, &llc_sap_list); + write_unlock_bh(&llc_sap_list_lock); } /** @@ -69,25 +70,11 @@ static void llc_del_sap(struct llc_sap *sap) write_unlock_bh(&llc_sap_list_lock); } -static struct llc_sap *__llc_sap_find(unsigned char sap_value) -{ - struct llc_sap* sap; - - list_for_each_entry(sap, &llc_sap_list, node) - if (sap->laddr.lsap == sap_value) - goto out; - sap = NULL; -out: - return sap; -} - /** * llc_sap_find - searchs a SAP in station * @sap_value: sap to be found * * Searchs for a sap in the sap list of the LLC's station upon the sap ID. - * If the sap is found it will be refcounted and the user will have to do - * a llc_sap_put after use. * Returns the sap or %NULL if not found. */ struct llc_sap *llc_sap_find(unsigned char sap_value) @@ -95,9 +82,11 @@ struct llc_sap *llc_sap_find(unsigned char sap_value) struct llc_sap* sap; read_lock_bh(&llc_sap_list_lock); - sap = __llc_sap_find(sap_value); - if (sap) - llc_sap_hold(sap); + list_for_each_entry(sap, &llc_sap_list, node) + if (sap->laddr.lsap == sap_value) + goto out; + sap = NULL; +out: read_unlock_bh(&llc_sap_list_lock); return sap; } @@ -117,20 +106,19 @@ struct llc_sap *llc_sap_open(unsigned char lsap, struct packet_type *pt, struct net_device *orig_dev)) { - struct llc_sap *sap = NULL; + struct llc_sap *sap = llc_sap_find(lsap); - write_lock_bh(&llc_sap_list_lock); - if (__llc_sap_find(lsap)) /* SAP already exists */ + if (sap) { /* SAP already exists */ + sap = NULL; goto out; + } sap = llc_sap_alloc(); if (!sap) goto out; sap->laddr.lsap = lsap; sap->rcv_func = func; - llc_sap_hold(sap); llc_add_sap(sap); out: - write_unlock_bh(&llc_sap_list_lock); return sap; } diff --git a/trunk/net/llc/llc_if.c b/trunk/net/llc/llc_if.c index ba90f7f0801a..0f84f66018e4 100644 --- a/trunk/net/llc/llc_if.c +++ b/trunk/net/llc/llc_if.c @@ -47,11 +47,14 @@ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) int rc = -ECONNABORTED; struct llc_sock *llc = llc_sk(sk); - if (unlikely(llc->state == LLC_CONN_STATE_ADM)) + if (llc->state == LLC_CONN_STATE_ADM) goto out; rc = -EBUSY; - if (unlikely(llc_data_accept_state(llc->state) || /* data_conn_refuse */ - llc->p_flag)) { + if (llc_data_accept_state(llc->state)) { /* data_conn_refuse */ + llc->failed_data_req = 1; + goto out; + } + if (llc->p_flag) { llc->failed_data_req = 1; goto out; } @@ -107,7 +110,6 @@ int llc_establish_connection(struct sock *sk, u8 *lmac, u8 *dmac, u8 dsap) ev->type = LLC_CONN_EV_TYPE_PRIM; ev->prim = LLC_CONN_PRIM; ev->prim_type = LLC_PRIM_TYPE_REQ; - skb_set_owner_w(skb, sk); rc = llc_conn_state_process(sk, skb); } out_put: @@ -142,7 +144,6 @@ int llc_send_disc(struct sock *sk) skb = alloc_skb(0, GFP_ATOMIC); if (!skb) goto out; - skb_set_owner_w(skb, sk); sk->sk_state = TCP_CLOSING; ev = llc_conn_ev(skb); ev->type = LLC_CONN_EV_TYPE_PRIM; diff --git a/trunk/net/llc/llc_input.c b/trunk/net/llc/llc_input.c index 8f3addf0724c..13b46240b7a1 100644 --- a/trunk/net/llc/llc_input.c +++ b/trunk/net/llc/llc_input.c @@ -99,19 +99,15 @@ static __inline__ int llc_pdu_type(struct sk_buff *skb) static inline int llc_fixup_skb(struct sk_buff *skb) { u8 llc_len = 2; - struct llc_pdu_un *pdu; + struct llc_pdu_sn *pdu; - if (unlikely(!pskb_may_pull(skb, sizeof(*pdu)))) + if (!pskb_may_pull(skb, sizeof(*pdu))) return 0; - pdu = (struct llc_pdu_un *)skb->data; + pdu = (struct llc_pdu_sn *)skb->data; if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) == LLC_PDU_TYPE_U) llc_len = 1; llc_len += 2; - - if (unlikely(!pskb_may_pull(skb, llc_len))) - return 0; - skb->h.raw += llc_len; skb_pull(skb, llc_len); if (skb->protocol == htons(ETH_P_802_2)) { @@ -170,22 +166,17 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, */ if (sap->rcv_func) { sap->rcv_func(skb, dev, pt, orig_dev); - goto out_put; + goto out; } dest = llc_pdu_type(skb); if (unlikely(!dest || !llc_type_handlers[dest - 1])) - goto drop_put; + goto drop; llc_type_handlers[dest - 1](sap, skb); -out_put: - llc_sap_put(sap); out: return 0; drop: kfree_skb(skb); goto out; -drop_put: - kfree_skb(skb); - goto out_put; handle_station: if (!llc_station_handler) goto drop; diff --git a/trunk/net/llc/llc_output.c b/trunk/net/llc/llc_output.c index b4d55b6abb67..ab5784cf163e 100644 --- a/trunk/net/llc/llc_output.c +++ b/trunk/net/llc/llc_output.c @@ -98,7 +98,7 @@ int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, dsap, LLC_PDU_CMD); llc_pdu_init_as_ui_cmd(skb); rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac); - if (likely(!rc)) + if (!rc) rc = dev_queue_xmit(skb); return rc; } diff --git a/trunk/net/llc/llc_proc.c b/trunk/net/llc/llc_proc.c index bd531cb235a7..36e8db3fa1a2 100644 --- a/trunk/net/llc/llc_proc.c +++ b/trunk/net/llc/llc_proc.c @@ -134,7 +134,7 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v) llc_ui_format_mac(seq, llc->daddr.mac); seq_printf(seq, "@%02X %8d %8d %2d %3d %4d\n", llc->daddr.lsap, atomic_read(&sk->sk_wmem_alloc), - atomic_read(&sk->sk_rmem_alloc) - llc->copied_seq, + atomic_read(&sk->sk_rmem_alloc), sk->sk_state, sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : -1, llc->link); diff --git a/trunk/net/llc/llc_s_ac.c b/trunk/net/llc/llc_s_ac.c index bb3580fb8cfe..ed8ba7de6122 100644 --- a/trunk/net/llc/llc_s_ac.c +++ b/trunk/net/llc/llc_s_ac.c @@ -58,7 +58,7 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb) ev->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_ui_cmd(skb); rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); - if (likely(!rc)) + if (!rc) rc = dev_queue_xmit(skb); return rc; } @@ -81,7 +81,7 @@ int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) ev->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0); rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); - if (likely(!rc)) + if (!rc) rc = dev_queue_xmit(skb); return rc; } @@ -103,14 +103,15 @@ int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb) llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_da(skb, mac_sa); llc_pdu_decode_ssap(skb, &dsap); - nskb = llc_alloc_frame(NULL, skb->dev); + nskb = llc_alloc_frame(); if (!nskb) goto out; + nskb->dev = skb->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap, LLC_PDU_RSP); llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 0); rc = llc_mac_hdr_init(nskb, mac_sa, mac_da); - if (likely(!rc)) + if (!rc) rc = dev_queue_xmit(nskb); out: return rc; @@ -134,7 +135,7 @@ int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb) ev->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_test_cmd(skb); rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); - if (likely(!rc)) + if (!rc) rc = dev_queue_xmit(skb); return rc; } @@ -148,14 +149,15 @@ int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb) llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_da(skb, mac_sa); llc_pdu_decode_ssap(skb, &dsap); - nskb = llc_alloc_frame(NULL, skb->dev); + nskb = llc_alloc_frame(); if (!nskb) goto out; + nskb->dev = skb->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap, LLC_PDU_RSP); llc_pdu_init_as_test_rsp(nskb, skb); rc = llc_mac_hdr_init(nskb, mac_sa, mac_da); - if (likely(!rc)) + if (!rc) rc = dev_queue_xmit(nskb); out: return rc; diff --git a/trunk/net/llc/llc_sap.c b/trunk/net/llc/llc_sap.c index 4029ceee9b91..34228ef14985 100644 --- a/trunk/net/llc/llc_sap.c +++ b/trunk/net/llc/llc_sap.c @@ -26,12 +26,11 @@ /** * llc_alloc_frame - allocates sk_buff for frame - * @dev: network device this skb will be sent over * * Allocates an sk_buff for frame and initializes sk_buff fields. * Returns allocated skb or %NULL when out of memory. */ -struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev) +struct sk_buff *llc_alloc_frame(void) { struct sk_buff *skb = alloc_skb(128, GFP_ATOMIC); @@ -39,23 +38,18 @@ struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev) skb_reserve(skb, 50); skb->nh.raw = skb->h.raw = skb->data; skb->protocol = htons(ETH_P_802_2); - skb->dev = dev; + skb->dev = dev_base->next; skb->mac.raw = skb->head; - if (sk != NULL) - skb_set_owner_w(skb, sk); } return skb; } -void llc_save_primitive(struct sock *sk, struct sk_buff* skb, u8 prim) +void llc_save_primitive(struct sk_buff* skb, u8 prim) { - struct sockaddr_llc *addr; + struct sockaddr_llc *addr = llc_ui_skb_cb(skb); - if (skb->sk->sk_type == SOCK_STREAM) /* See UNIX98 */ - return; /* save primitive for use by the user. */ - addr = llc_ui_skb_cb(skb); - addr->sllc_family = sk->sk_family; + addr->sllc_family = skb->sk->sk_family; addr->sllc_arphrd = skb->dev->type; addr->sllc_test = prim == LLC_TEST_PRIM; addr->sllc_xid = prim == LLC_XID_PRIM; @@ -195,7 +189,7 @@ static void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb) if (skb->sk->sk_state == TCP_LISTEN) kfree_skb(skb); else { - llc_save_primitive(skb->sk, skb, ev->prim); + llc_save_primitive(skb, ev->prim); /* queue skb to the user. */ if (sock_queue_rcv_skb(skb->sk, skb)) @@ -314,7 +308,7 @@ void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb) sk = llc_lookup_dgram(sap, &laddr); if (sk) { - skb_set_owner_r(skb, sk); + skb->sk = sk; llc_sap_rcv(sap, skb); sock_put(sk); } else diff --git a/trunk/net/llc/llc_station.c b/trunk/net/llc/llc_station.c index f37dbf8ef126..8fe48a24bad5 100644 --- a/trunk/net/llc/llc_station.c +++ b/trunk/net/llc/llc_station.c @@ -50,10 +50,6 @@ struct llc_station { struct sk_buff_head mac_pdu_q; }; -#define LLC_STATION_ACK_TIME (3 * HZ) - -int sysctl_llc_station_ack_timeout = LLC_STATION_ACK_TIME; - /* Types of events (possible values in 'ev->type') */ #define LLC_STATION_EV_TYPE_SIMPLE 1 #define LLC_STATION_EV_TYPE_CONDITION 2 @@ -222,8 +218,7 @@ static void llc_station_send_pdu(struct sk_buff *skb) static int llc_station_ac_start_ack_timer(struct sk_buff *skb) { - mod_timer(&llc_main_station.ack_timer, - jiffies + sysctl_llc_station_ack_timeout); + mod_timer(&llc_main_station.ack_timer, jiffies + LLC_ACK_TIME * HZ); return 0; } @@ -254,14 +249,14 @@ static int llc_station_ac_inc_xid_r_cnt_by_1(struct sk_buff *skb) static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb) { int rc = 1; - struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (!nskb) goto out; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, 0, LLC_PDU_CMD); llc_pdu_init_as_xid_cmd(nskb, LLC_XID_NULL_CLASS_2, 127); rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, llc_station_mac_sa); - if (unlikely(rc)) + if (rc) goto free; llc_station_send_pdu(nskb); out: @@ -275,17 +270,18 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb) { u8 mac_da[ETH_ALEN], dsap; int rc = 1; - struct sk_buff* nskb = llc_alloc_frame(NULL, skb->dev); + struct sk_buff* nskb = llc_alloc_frame(); if (!nskb) goto out; rc = 0; + nskb->dev = skb->dev; llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_ssap(skb, &dsap); llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 127); rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); - if (unlikely(rc)) + if (rc) goto free; llc_station_send_pdu(nskb); out: @@ -299,17 +295,18 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb) { u8 mac_da[ETH_ALEN], dsap; int rc = 1; - struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev); + struct sk_buff *nskb = llc_alloc_frame(); if (!nskb) goto out; rc = 0; + nskb->dev = skb->dev; llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_ssap(skb, &dsap); llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); llc_pdu_init_as_test_rsp(nskb, skb); rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); - if (unlikely(rc)) + if (rc) goto free; llc_station_send_pdu(nskb); out: @@ -692,8 +689,7 @@ int __init llc_station_init(void) init_timer(&llc_main_station.ack_timer); llc_main_station.ack_timer.data = (unsigned long)&llc_main_station; llc_main_station.ack_timer.function = llc_station_ack_tmr_cb; - llc_main_station.ack_timer.expires = jiffies + - sysctl_llc_station_ack_timeout; + skb = alloc_skb(0, GFP_ATOMIC); if (!skb) goto out; @@ -701,6 +697,7 @@ int __init llc_station_init(void) llc_set_station_handler(llc_station_rcv); ev = llc_station_ev(skb); memset(ev, 0, sizeof(*ev)); + llc_main_station.ack_timer.expires = jiffies + 3 * HZ; llc_main_station.maximum_retry = 1; llc_main_station.state = LLC_STATION_STATE_DOWN; ev->type = LLC_STATION_EV_TYPE_SIMPLE; diff --git a/trunk/net/llc/sysctl_net_llc.c b/trunk/net/llc/sysctl_net_llc.c deleted file mode 100644 index d1eaddb13633..000000000000 --- a/trunk/net/llc/sysctl_net_llc.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * sysctl_net_llc.c: sysctl interface to LLC net subsystem. - * - * Arnaldo Carvalho de Melo - */ - -#include -#include -#include -#include -#include - -#ifndef CONFIG_SYSCTL -#error This file should not be compiled without CONFIG_SYSCTL defined -#endif - -static struct ctl_table llc2_timeout_table[] = { - { - .ctl_name = NET_LLC2_ACK_TIMEOUT, - .procname = "ack", - .data = &sysctl_llc2_ack_timeout, - .maxlen = sizeof(long), - .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, - .strategy = &sysctl_jiffies, - }, - { - .ctl_name = NET_LLC2_BUSY_TIMEOUT, - .procname = "busy", - .data = &sysctl_llc2_busy_timeout, - .maxlen = sizeof(long), - .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, - .strategy = &sysctl_jiffies, - }, - { - .ctl_name = NET_LLC2_P_TIMEOUT, - .procname = "p", - .data = &sysctl_llc2_p_timeout, - .maxlen = sizeof(long), - .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, - .strategy = &sysctl_jiffies, - }, - { - .ctl_name = NET_LLC2_REJ_TIMEOUT, - .procname = "rej", - .data = &sysctl_llc2_rej_timeout, - .maxlen = sizeof(long), - .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, - .strategy = &sysctl_jiffies, - }, - { 0 }, -}; - -static struct ctl_table llc_station_table[] = { - { - .ctl_name = NET_LLC_STATION_ACK_TIMEOUT, - .procname = "ack_timeout", - .data = &sysctl_llc_station_ack_timeout, - .maxlen = sizeof(long), - .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, - .strategy = &sysctl_jiffies, - }, - { 0 }, -}; - -static struct ctl_table llc2_dir_timeout_table[] = { - { - .ctl_name = NET_LLC2, - .procname = "timeout", - .mode = 0555, - .child = llc2_timeout_table, - }, - { 0 }, -}; - -static struct ctl_table llc_table[] = { - { - .ctl_name = NET_LLC2, - .procname = "llc2", - .mode = 0555, - .child = llc2_dir_timeout_table, - }, - { - .ctl_name = NET_LLC_STATION, - .procname = "station", - .mode = 0555, - .child = llc_station_table, - }, - { 0 }, -}; - -static struct ctl_table llc_dir_table[] = { - { - .ctl_name = NET_LLC, - .procname = "llc", - .mode = 0555, - .child = llc_table, - }, - { 0 }, -}; - -static struct ctl_table llc_root_table[] = { - { - .ctl_name = CTL_NET, - .procname = "net", - .mode = 0555, - .child = llc_dir_table, - }, - { 0 }, -}; - -static struct ctl_table_header *llc_table_header; - -int __init llc_sysctl_init(void) -{ - llc_table_header = register_sysctl_table(llc_root_table, 1); - - return llc_table_header ? 0 : -ENOMEM; -} - -void llc_sysctl_exit(void) -{ - if (llc_table_header) { - unregister_sysctl_table(llc_table_header); - llc_table_header = NULL; - } -} diff --git a/trunk/net/netfilter/nfnetlink.c b/trunk/net/netfilter/nfnetlink.c index 4bc27a6334c1..49a3900e3d32 100644 --- a/trunk/net/netfilter/nfnetlink.c +++ b/trunk/net/netfilter/nfnetlink.c @@ -133,7 +133,7 @@ int nfattr_parse(struct nfattr *tb[], int maxattr, struct nfattr *nfa, int len) memset(tb, 0, sizeof(struct nfattr *) * maxattr); while (NFA_OK(nfa, len)) { - unsigned flavor = NFA_TYPE(nfa); + unsigned flavor = nfa->nfa_type; if (flavor && flavor <= maxattr) tb[flavor-1] = nfa; nfa = NFA_NEXT(nfa, len); @@ -177,7 +177,7 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys, int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len); while (NFA_OK(attr, attrlen)) { - unsigned flavor = NFA_TYPE(attr); + unsigned flavor = attr->nfa_type; if (flavor) { if (flavor > attr_count) return -EINVAL; @@ -195,7 +195,7 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys, int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo) { - gfp_t allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; + int allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; int err = 0; NETLINK_CB(skb).dst_group = group; diff --git a/trunk/net/netfilter/nfnetlink_log.c b/trunk/net/netfilter/nfnetlink_log.c index efcd10f996ba..ff5601ceedcb 100644 --- a/trunk/net/netfilter/nfnetlink_log.c +++ b/trunk/net/netfilter/nfnetlink_log.c @@ -494,8 +494,8 @@ __build_packet_message(struct nfulnl_instance *inst, if (skb->tstamp.off_sec) { struct nfulnl_msg_packet_timestamp ts; - ts.sec = cpu_to_be64(skb->tstamp.off_sec); - ts.usec = cpu_to_be64(skb->tstamp.off_usec); + ts.sec = cpu_to_be64(skb_tv_base.tv_sec + skb->tstamp.off_sec); + ts.usec = cpu_to_be64(skb_tv_base.tv_usec + skb->tstamp.off_usec); NFA_PUT(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts); } diff --git a/trunk/net/netfilter/nfnetlink_queue.c b/trunk/net/netfilter/nfnetlink_queue.c index eaa44c49567b..f81fe8c52e99 100644 --- a/trunk/net/netfilter/nfnetlink_queue.c +++ b/trunk/net/netfilter/nfnetlink_queue.c @@ -492,8 +492,8 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, if (entry->skb->tstamp.off_sec) { struct nfqnl_msg_packet_timestamp ts; - ts.sec = cpu_to_be64(entry->skb->tstamp.off_sec); - ts.usec = cpu_to_be64(entry->skb->tstamp.off_usec); + ts.sec = cpu_to_be64(skb_tv_base.tv_sec + entry->skb->tstamp.off_sec); + ts.usec = cpu_to_be64(skb_tv_base.tv_usec + entry->skb->tstamp.off_usec); NFA_PUT(skb, NFQA_TIMESTAMP, sizeof(ts), &ts); } diff --git a/trunk/net/netlink/af_netlink.c b/trunk/net/netlink/af_netlink.c index 678c3f2c0d0b..a64e1d5ce3ca 100644 --- a/trunk/net/netlink/af_netlink.c +++ b/trunk/net/netlink/af_netlink.c @@ -758,7 +758,7 @@ void netlink_detachskb(struct sock *sk, struct sk_buff *skb) } static inline struct sk_buff *netlink_trim(struct sk_buff *skb, - gfp_t allocation) + unsigned int __nocast allocation) { int delta; @@ -880,7 +880,7 @@ static inline int do_one_broadcast(struct sock *sk, } int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid, - u32 group, gfp_t allocation) + u32 group, unsigned int __nocast allocation) { struct netlink_broadcast_data info; struct hlist_node *node; diff --git a/trunk/net/netrom/nr_dev.c b/trunk/net/netrom/nr_dev.c index 509afddae569..4e66eef9a034 100644 --- a/trunk/net/netrom/nr_dev.c +++ b/trunk/net/netrom/nr_dev.c @@ -58,7 +58,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) /* Spoof incoming device */ skb->dev = dev; - skb->mac.raw = skb->nh.raw; + skb->h.raw = skb->data; skb->nh.raw = skb->data; skb->pkt_type = PACKET_HOST; diff --git a/trunk/net/packet/af_packet.c b/trunk/net/packet/af_packet.c index 499ae3df4a44..ee865d88183b 100644 --- a/trunk/net/packet/af_packet.c +++ b/trunk/net/packet/af_packet.c @@ -654,8 +654,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe __net_timestamp(skb); sock_enable_timestamp(sk); } - h->tp_sec = skb->tstamp.off_sec; - h->tp_usec = skb->tstamp.off_usec; + h->tp_sec = skb_tv_base.tv_sec + skb->tstamp.off_sec; + h->tp_usec = skb_tv_base.tv_usec + skb->tstamp.off_usec; sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h))); sll->sll_halen = 0; @@ -761,6 +761,12 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, if (dev->hard_header) { int res; err = -EINVAL; + if (saddr) { + if (saddr->sll_halen != dev->addr_len) + goto out_free; + if (saddr->sll_hatype != dev->type) + goto out_free; + } res = dev->hard_header(skb, dev, ntohs(proto), addr, NULL, len); if (sock->type != SOCK_DGRAM) { skb->tail = skb->data; diff --git a/trunk/net/rose/af_rose.c b/trunk/net/rose/af_rose.c index 829fdbc4400b..5acb1680524a 100644 --- a/trunk/net/rose/af_rose.c +++ b/trunk/net/rose/af_rose.c @@ -1472,25 +1472,22 @@ static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 static int __init rose_proto_init(void) { int i; - int rc; + int rc = proto_register(&rose_proto, 0); - if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) { - printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n"); - rc = -EINVAL; - goto out; - } - - rc = proto_register(&rose_proto, 0); if (rc != 0) goto out; rose_callsign = null_ax25_address; + if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) { + printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n"); + return -1; + } + dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); if (dev_rose == NULL) { printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); - rc = -ENOMEM; - goto out_proto_unregister; + return -1; } memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*)); @@ -1503,12 +1500,10 @@ static int __init rose_proto_init(void) name, rose_setup); if (!dev) { printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n"); - rc = -ENOMEM; goto fail; } - rc = register_netdev(dev); - if (rc) { - printk(KERN_ERR "ROSE: netdevice registration failed\n"); + if (register_netdev(dev)) { + printk(KERN_ERR "ROSE: netdevice regeistration failed\n"); free_netdev(dev); goto fail; } @@ -1541,9 +1536,8 @@ static int __init rose_proto_init(void) free_netdev(dev_rose[i]); } kfree(dev_rose); -out_proto_unregister: proto_unregister(&rose_proto); - goto out; + return -ENOMEM; } module_init(rose_proto_init); diff --git a/trunk/net/rxrpc/call.c b/trunk/net/rxrpc/call.c index c4aeb7d40266..5cfd4cadee42 100644 --- a/trunk/net/rxrpc/call.c +++ b/trunk/net/rxrpc/call.c @@ -1923,7 +1923,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call, size_t sioc, struct kvec *siov, u8 rxhdr_flags, - gfp_t alloc_flags, + int alloc_flags, int dup_data, size_t *size_sent) { diff --git a/trunk/net/rxrpc/connection.c b/trunk/net/rxrpc/connection.c index 2ba14a75dbbe..61463c74f8cc 100644 --- a/trunk/net/rxrpc/connection.c +++ b/trunk/net/rxrpc/connection.c @@ -522,7 +522,7 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn, uint8_t type, int dcount, struct kvec diov[], - gfp_t alloc_flags, + int alloc_flags, struct rxrpc_message **_msg) { struct rxrpc_message *msg; diff --git a/trunk/net/sched/Kconfig b/trunk/net/sched/Kconfig index 81510da31792..45d3bc0812c8 100644 --- a/trunk/net/sched/Kconfig +++ b/trunk/net/sched/Kconfig @@ -72,11 +72,9 @@ config NET_SCH_CLK_GETTIMEOFDAY Choose this if you need a high resolution clock source but can't use the CPU's cycle counter. -# don't allow on SMP x86 because they can have unsynchronized TSCs. -# gettimeofday is a good alternative config NET_SCH_CLK_CPU bool "CPU cycle counter" - depends on ((X86_TSC || X86_64) && !SMP) || ALPHA || SPARC64 || PPC64 || IA64 + depends on X86_TSC || X86_64 || ALPHA || SPARC64 || PPC64 || IA64 help Say Y here if you want to use the CPU's cycle counter as clock source. This is a cheap and high resolution clock source, but on some diff --git a/trunk/net/sched/em_meta.c b/trunk/net/sched/em_meta.c index cf68a59fdc5a..00eae5f9a01a 100644 --- a/trunk/net/sched/em_meta.c +++ b/trunk/net/sched/em_meta.c @@ -393,10 +393,10 @@ META_COLLECTOR(int_sk_route_caps) dst->value = skb->sk->sk_route_caps; } -META_COLLECTOR(int_sk_hash) +META_COLLECTOR(int_sk_hashent) { SKIP_NONLOCAL(skb); - dst->value = skb->sk->sk_hash; + dst->value = skb->sk->sk_hashent; } META_COLLECTOR(int_sk_lingertime) @@ -515,7 +515,7 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { [META_ID(SK_FORWARD_ALLOCS)] = META_FUNC(int_sk_fwd_alloc), [META_ID(SK_ALLOCS)] = META_FUNC(int_sk_alloc), [META_ID(SK_ROUTE_CAPS)] = META_FUNC(int_sk_route_caps), - [META_ID(SK_HASH)] = META_FUNC(int_sk_hash), + [META_ID(SK_HASHENT)] = META_FUNC(int_sk_hashent), [META_ID(SK_LINGERTIME)] = META_FUNC(int_sk_lingertime), [META_ID(SK_ACK_BACKLOG)] = META_FUNC(int_sk_ack_bl), [META_ID(SK_MAX_ACK_BACKLOG)] = META_FUNC(int_sk_max_ack_bl), diff --git a/trunk/net/sctp/associola.c b/trunk/net/sctp/associola.c index 12b0f582a66b..5b24ae0650d3 100644 --- a/trunk/net/sctp/associola.c +++ b/trunk/net/sctp/associola.c @@ -71,7 +71,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a const struct sctp_endpoint *ep, const struct sock *sk, sctp_scope_t scope, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_sock *sp; int i; @@ -273,7 +273,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a struct sctp_association *sctp_association_new(const struct sctp_endpoint *ep, const struct sock *sk, sctp_scope_t scope, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_association *asoc; @@ -479,7 +479,7 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc, /* Add a transport address to an association. */ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, const union sctp_addr *addr, - const gfp_t gfp, + const unsigned int __nocast gfp, const int peer_state) { struct sctp_transport *peer; @@ -1231,7 +1231,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned len) * local endpoint and the remote peer. */ int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc, - gfp_t gfp) + unsigned int __nocast gfp) { sctp_scope_t scope; int flags; @@ -1254,7 +1254,7 @@ int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc, /* Build the association's bind address list from the cookie. */ int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc, struct sctp_cookie *cookie, - gfp_t gfp) + unsigned int __nocast gfp) { int var_size2 = ntohs(cookie->peer_init->chunk_hdr.length); int var_size3 = cookie->raw_addr_list_len; diff --git a/trunk/net/sctp/bind_addr.c b/trunk/net/sctp/bind_addr.c index 2b962627f631..f71549710f2e 100644 --- a/trunk/net/sctp/bind_addr.c +++ b/trunk/net/sctp/bind_addr.c @@ -53,7 +53,7 @@ /* Forward declarations for internal helpers. */ static int sctp_copy_one_addr(struct sctp_bind_addr *, union sctp_addr *, - sctp_scope_t scope, gfp_t gfp, + sctp_scope_t scope, unsigned int __nocast gfp, int flags); static void sctp_bind_addr_clean(struct sctp_bind_addr *); @@ -64,7 +64,7 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *); */ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, const struct sctp_bind_addr *src, - sctp_scope_t scope, gfp_t gfp, + sctp_scope_t scope, unsigned int __nocast gfp, int flags) { struct sctp_sockaddr_entry *addr; @@ -146,7 +146,7 @@ void sctp_bind_addr_free(struct sctp_bind_addr *bp) /* Add an address to the bind address list in the SCTP_bind_addr structure. */ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_sockaddr_entry *addr; @@ -200,7 +200,7 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr) */ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, int *addrs_len, - gfp_t gfp) + unsigned int __nocast gfp) { union sctp_params addrparms; union sctp_params retval; @@ -252,7 +252,7 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, * address parameters). */ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, - int addrs_len, __u16 port, gfp_t gfp) + int addrs_len, __u16 port, unsigned int __nocast gfp) { union sctp_addr_param *rawaddr; struct sctp_paramhdr *param; @@ -350,7 +350,7 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, /* Copy out addresses from the global local address list. */ static int sctp_copy_one_addr(struct sctp_bind_addr *dest, union sctp_addr *addr, - sctp_scope_t scope, gfp_t gfp, + sctp_scope_t scope, unsigned int __nocast gfp, int flags) { int error = 0; diff --git a/trunk/net/sctp/chunk.c b/trunk/net/sctp/chunk.c index 83ef411772f4..61da2937e641 100644 --- a/trunk/net/sctp/chunk.c +++ b/trunk/net/sctp/chunk.c @@ -62,7 +62,7 @@ static void sctp_datamsg_init(struct sctp_datamsg *msg) } /* Allocate and initialize datamsg. */ -SCTP_STATIC struct sctp_datamsg *sctp_datamsg_new(gfp_t gfp) +SCTP_STATIC struct sctp_datamsg *sctp_datamsg_new(unsigned int __nocast gfp) { struct sctp_datamsg *msg; msg = kmalloc(sizeof(struct sctp_datamsg), gfp); diff --git a/trunk/net/sctp/endpointola.c b/trunk/net/sctp/endpointola.c index 96984f7a2d69..e22ccd655965 100644 --- a/trunk/net/sctp/endpointola.c +++ b/trunk/net/sctp/endpointola.c @@ -68,7 +68,7 @@ static void sctp_endpoint_bh_rcv(struct sctp_endpoint *ep); */ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, struct sock *sk, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_sock *sp = sctp_sk(sk); memset(ep, 0, sizeof(struct sctp_endpoint)); @@ -138,7 +138,8 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, /* Create a sctp_endpoint with all that boring stuff initialized. * Returns NULL if there isn't enough memory. */ -struct sctp_endpoint *sctp_endpoint_new(struct sock *sk, gfp_t gfp) +struct sctp_endpoint *sctp_endpoint_new(struct sock *sk, + unsigned int __nocast gfp) { struct sctp_endpoint *ep; diff --git a/trunk/net/sctp/protocol.c b/trunk/net/sctp/protocol.c index 26de4d3e1bd9..e7025be77691 100644 --- a/trunk/net/sctp/protocol.c +++ b/trunk/net/sctp/protocol.c @@ -147,7 +147,7 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist, struct sctp_sockaddr_entry *addr; rcu_read_lock(); - if ((in_dev = __in_dev_get_rcu(dev)) == NULL) { + if ((in_dev = __in_dev_get(dev)) == NULL) { rcu_read_unlock(); return; } @@ -219,7 +219,7 @@ static void sctp_free_local_addr_list(void) /* Copy the local addresses which are valid for 'scope' into 'bp'. */ int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope, - gfp_t gfp, int copy_flags) + unsigned int __nocast gfp, int copy_flags) { struct sctp_sockaddr_entry *addr; int error = 0; diff --git a/trunk/net/sctp/sm_make_chunk.c b/trunk/net/sctp/sm_make_chunk.c index 10e82ec2ebd3..3868a8d70cc0 100644 --- a/trunk/net/sctp/sm_make_chunk.c +++ b/trunk/net/sctp/sm_make_chunk.c @@ -78,7 +78,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, static int sctp_process_param(struct sctp_association *asoc, union sctp_params param, const union sctp_addr *peer_addr, - gfp_t gfp); + unsigned int __nocast gfp); /* What was the inbound interface for this chunk? */ int sctp_chunk_iif(const struct sctp_chunk *chunk) @@ -174,7 +174,7 @@ void sctp_init_cause(struct sctp_chunk *chunk, __u16 cause_code, */ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, const struct sctp_bind_addr *bp, - gfp_t gfp, int vparam_len) + unsigned int __nocast gfp, int vparam_len) { sctp_inithdr_t init; union sctp_params addrs; @@ -261,7 +261,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, const struct sctp_chunk *chunk, - gfp_t gfp, int unkparam_len) + unsigned int __nocast gfp, int unkparam_len) { sctp_inithdr_t initack; struct sctp_chunk *retval; @@ -1234,7 +1234,7 @@ void sctp_chunk_assign_tsn(struct sctp_chunk *chunk) /* Create a CLOSED association to use with an incoming packet. */ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep, struct sctp_chunk *chunk, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_association *asoc; struct sk_buff *skb; @@ -1349,7 +1349,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, struct sctp_association *sctp_unpack_cookie( const struct sctp_endpoint *ep, const struct sctp_association *asoc, - struct sctp_chunk *chunk, gfp_t gfp, + struct sctp_chunk *chunk, unsigned int __nocast gfp, int *error, struct sctp_chunk **errp) { struct sctp_association *retval = NULL; @@ -1814,7 +1814,7 @@ int sctp_verify_init(const struct sctp_association *asoc, */ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, const union sctp_addr *peer_addr, - sctp_init_chunk_t *peer_init, gfp_t gfp) + sctp_init_chunk_t *peer_init, unsigned int __nocast gfp) { union sctp_params param; struct sctp_transport *transport; @@ -1985,7 +1985,7 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, static int sctp_process_param(struct sctp_association *asoc, union sctp_params param, const union sctp_addr *peer_addr, - gfp_t gfp) + unsigned int __nocast gfp) { union sctp_addr addr; int i; diff --git a/trunk/net/sctp/sm_sideeffect.c b/trunk/net/sctp/sm_sideeffect.c index f84173ea8ec1..39c970b5b198 100644 --- a/trunk/net/sctp/sm_sideeffect.c +++ b/trunk/net/sctp/sm_sideeffect.c @@ -63,7 +63,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, void *event_arg, sctp_disposition_t status, sctp_cmd_seq_t *commands, - gfp_t gfp); + unsigned int __nocast gfp); static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, sctp_state_t state, struct sctp_endpoint *ep, @@ -71,7 +71,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, void *event_arg, sctp_disposition_t status, sctp_cmd_seq_t *commands, - gfp_t gfp); + unsigned int __nocast gfp); /******************************************************************** * Helper functions @@ -498,7 +498,7 @@ static int sctp_cmd_process_init(sctp_cmd_seq_t *commands, struct sctp_association *asoc, struct sctp_chunk *chunk, sctp_init_chunk_t *peer_init, - gfp_t gfp) + unsigned int __nocast gfp) { int error; @@ -853,7 +853,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, struct sctp_endpoint *ep, struct sctp_association *asoc, void *event_arg, - gfp_t gfp) + unsigned int __nocast gfp) { sctp_cmd_seq_t commands; 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, void *event_arg, sctp_disposition_t status, sctp_cmd_seq_t *commands, - gfp_t gfp) + unsigned int __nocast gfp) { int error; @@ -986,7 +986,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, void *event_arg, sctp_disposition_t status, sctp_cmd_seq_t *commands, - gfp_t gfp) + unsigned int __nocast gfp) { int error = 0; int force; diff --git a/trunk/net/sctp/socket.c b/trunk/net/sctp/socket.c index 02e068d3450d..91ec8c936913 100644 --- a/trunk/net/sctp/socket.c +++ b/trunk/net/sctp/socket.c @@ -3159,9 +3159,8 @@ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval return 0; } -static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len, - char __user *optval, - int __user *optlen) +static int sctp_getsockopt_peer_addrs_num(struct sock *sk, int len, + char __user *optval, int __user *optlen) { sctp_assoc_t id; struct sctp_association *asoc; @@ -3186,28 +3185,23 @@ static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len, return cnt; } -/* - * Old API for getting list of peer addresses. Does not work for 32-bit - * programs running on a 64-bit kernel - */ -static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len, - char __user *optval, - int __user *optlen) +static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, + char __user *optval, int __user *optlen) { struct sctp_association *asoc; struct list_head *pos; int cnt = 0; - struct sctp_getaddrs_old getaddrs; + struct sctp_getaddrs getaddrs; struct sctp_transport *from; void __user *to; union sctp_addr temp; struct sctp_sock *sp = sctp_sk(sk); int addrlen; - if (len != sizeof(struct sctp_getaddrs_old)) + if (len != sizeof(struct sctp_getaddrs)) return -EINVAL; - if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs_old))) + if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) return -EFAULT; if (getaddrs.addr_num <= 0) return -EINVAL; @@ -3231,69 +3225,15 @@ static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len, if (cnt >= getaddrs.addr_num) break; } getaddrs.addr_num = cnt; - if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs_old))) - return -EFAULT; - - return 0; -} - -static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, - char __user *optval, int __user *optlen) -{ - struct sctp_association *asoc; - struct list_head *pos; - int cnt = 0; - struct sctp_getaddrs getaddrs; - struct sctp_transport *from; - void __user *to; - union sctp_addr temp; - struct sctp_sock *sp = sctp_sk(sk); - int addrlen; - size_t space_left; - int bytes_copied; - - if (len < sizeof(struct sctp_getaddrs)) - return -EINVAL; - - if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) - return -EFAULT; - - /* For UDP-style sockets, id specifies the association to query. */ - asoc = sctp_id2assoc(sk, getaddrs.assoc_id); - if (!asoc) - return -EINVAL; - - to = optval + offsetof(struct sctp_getaddrs,addrs); - space_left = len - sizeof(struct sctp_getaddrs) - - offsetof(struct sctp_getaddrs,addrs); - - list_for_each(pos, &asoc->peer.transport_addr_list) { - from = list_entry(pos, struct sctp_transport, transports); - memcpy(&temp, &from->ipaddr, sizeof(temp)); - sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); - addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; - if(space_left < addrlen) - return -ENOMEM; - temp.v4.sin_port = htons(temp.v4.sin_port); - if (copy_to_user(to, &temp, addrlen)) - return -EFAULT; - to += addrlen; - cnt++; - space_left -= addrlen; - } - - if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) - return -EFAULT; - bytes_copied = ((char __user *)to) - optval; - if (put_user(bytes_copied, optlen)) + if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs))) return -EFAULT; return 0; } -static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len, - char __user *optval, - int __user *optlen) +static int sctp_getsockopt_local_addrs_num(struct sock *sk, int len, + char __user *optval, + int __user *optlen) { sctp_assoc_t id; struct sctp_bind_addr *bp; @@ -3366,8 +3306,8 @@ static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len, /* Helper function that copies local addresses to user and returns the number * of addresses copied. */ -static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_addrs, - void __user *to) +static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, int max_addrs, + void __user *to) { struct list_head *pos; struct sctp_sockaddr_entry *addr; @@ -3401,133 +3341,6 @@ static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_add return cnt; } -static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, - void * __user *to, size_t space_left) -{ - struct list_head *pos; - struct sctp_sockaddr_entry *addr; - unsigned long flags; - union sctp_addr temp; - int cnt = 0; - int addrlen; - - sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags); - list_for_each(pos, &sctp_local_addr_list) { - addr = list_entry(pos, struct sctp_sockaddr_entry, list); - if ((PF_INET == sk->sk_family) && - (AF_INET6 == addr->a.sa.sa_family)) - continue; - memcpy(&temp, &addr->a, sizeof(temp)); - sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), - &temp); - addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; - if(space_leftep->base.bind_addr; - addr_lock = &sctp_sk(sk)->ep->base.addr_lock; - } else { - asoc = sctp_id2assoc(sk, getaddrs.assoc_id); - if (!asoc) - return -EINVAL; - bp = &asoc->base.bind_addr; - addr_lock = &asoc->base.addr_lock; - } - - to = getaddrs.addrs; - - sctp_read_lock(addr_lock); - - /* If the endpoint is bound to 0.0.0.0 or ::0, get the valid - * addresses from the global local address list. - */ - if (sctp_list_single_entry(&bp->address_list)) { - addr = list_entry(bp->address_list.next, - struct sctp_sockaddr_entry, list); - if (sctp_is_any(&addr->a)) { - cnt = sctp_copy_laddrs_to_user_old(sk, bp->port, - getaddrs.addr_num, - to); - if (cnt < 0) { - err = cnt; - goto unlock; - } - goto copy_getaddrs; - } - } - - list_for_each(pos, &bp->address_list) { - addr = list_entry(pos, struct sctp_sockaddr_entry, list); - memcpy(&temp, &addr->a, sizeof(temp)); - sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); - addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; - temp.v4.sin_port = htons(temp.v4.sin_port); - if (copy_to_user(to, &temp, addrlen)) { - err = -EFAULT; - goto unlock; - } - to += addrlen; - cnt ++; - if (cnt >= getaddrs.addr_num) break; - } - -copy_getaddrs: - getaddrs.addr_num = cnt; - if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs_old))) - err = -EFAULT; - -unlock: - sctp_read_unlock(addr_lock); - return err; -} - static int sctp_getsockopt_local_addrs(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -3543,15 +3356,14 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, int addrlen; rwlock_t *addr_lock; int err = 0; - size_t space_left; - int bytes_copied; - if (len <= sizeof(struct sctp_getaddrs)) + if (len != sizeof(struct sctp_getaddrs)) return -EINVAL; if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) return -EFAULT; + if (getaddrs.addr_num <= 0) return -EINVAL; /* * For UDP-style sockets, id specifies the association to query. * If the id field is set to the value '0' then the locally bound @@ -3569,9 +3381,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, addr_lock = &asoc->base.addr_lock; } - to = optval + offsetof(struct sctp_getaddrs,addrs); - space_left = len - sizeof(struct sctp_getaddrs) - - offsetof(struct sctp_getaddrs,addrs); + to = getaddrs.addrs; sctp_read_lock(addr_lock); @@ -3583,7 +3393,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, struct sctp_sockaddr_entry, list); if (sctp_is_any(&addr->a)) { cnt = sctp_copy_laddrs_to_user(sk, bp->port, - &to, space_left); + getaddrs.addr_num, to); if (cnt < 0) { err = cnt; goto unlock; @@ -3597,8 +3407,6 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, memcpy(&temp, &addr->a, sizeof(temp)); sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; - if(space_left < addrlen) - return -ENOMEM; /*fixme: right error?*/ temp.v4.sin_port = htons(temp.v4.sin_port); if (copy_to_user(to, &temp, addrlen)) { err = -EFAULT; @@ -3606,15 +3414,13 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, } to += addrlen; cnt ++; - space_left -= addrlen; + if (cnt >= getaddrs.addr_num) break; } copy_getaddrs: - if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) - return -EFAULT; - bytes_copied = ((char __user *)to) - optval; - if (put_user(bytes_copied, optlen)) - return -EFAULT; + getaddrs.addr_num = cnt; + if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs))) + err = -EFAULT; unlock: sctp_read_unlock(addr_lock); @@ -4001,20 +3807,12 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname, case SCTP_INITMSG: retval = sctp_getsockopt_initmsg(sk, len, optval, optlen); break; - case SCTP_GET_PEER_ADDRS_NUM_OLD: - retval = sctp_getsockopt_peer_addrs_num_old(sk, len, optval, - optlen); - break; - case SCTP_GET_LOCAL_ADDRS_NUM_OLD: - retval = sctp_getsockopt_local_addrs_num_old(sk, len, optval, - optlen); - break; - case SCTP_GET_PEER_ADDRS_OLD: - retval = sctp_getsockopt_peer_addrs_old(sk, len, optval, + case SCTP_GET_PEER_ADDRS_NUM: + retval = sctp_getsockopt_peer_addrs_num(sk, len, optval, optlen); break; - case SCTP_GET_LOCAL_ADDRS_OLD: - retval = sctp_getsockopt_local_addrs_old(sk, len, optval, + case SCTP_GET_LOCAL_ADDRS_NUM: + retval = sctp_getsockopt_local_addrs_num(sk, len, optval, optlen); break; case SCTP_GET_PEER_ADDRS: diff --git a/trunk/net/sctp/ssnmap.c b/trunk/net/sctp/ssnmap.c index cbe2513d2822..25037daf3fa0 100644 --- a/trunk/net/sctp/ssnmap.c +++ b/trunk/net/sctp/ssnmap.c @@ -58,7 +58,7 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out) * Allocate room to store at least 'len' contiguous TSNs. */ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_ssnmap *retval; int size; diff --git a/trunk/net/sctp/transport.c b/trunk/net/sctp/transport.c index 6bc27200e6ca..d2f04ebe5081 100644 --- a/trunk/net/sctp/transport.c +++ b/trunk/net/sctp/transport.c @@ -57,7 +57,7 @@ /* Initialize a new transport from provided memory. */ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, const union sctp_addr *addr, - gfp_t gfp) + unsigned int __nocast gfp) { /* Copy in the address. */ peer->ipaddr = *addr; @@ -122,7 +122,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, /* Allocate and initialize a new transport. */ struct sctp_transport *sctp_transport_new(const union sctp_addr *addr, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_transport *transport; diff --git a/trunk/net/sctp/ulpevent.c b/trunk/net/sctp/ulpevent.c index 057e7fac3af0..0abd5101107c 100644 --- a/trunk/net/sctp/ulpevent.c +++ b/trunk/net/sctp/ulpevent.c @@ -74,7 +74,7 @@ SCTP_STATIC void sctp_ulpevent_init(struct sctp_ulpevent *event, int msg_flags) /* Create a new sctp_ulpevent. */ SCTP_STATIC struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sk_buff *skb; @@ -136,7 +136,7 @@ static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event) struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( const struct sctp_association *asoc, __u16 flags, __u16 state, __u16 error, __u16 outbound, - __u16 inbound, gfp_t gfp) + __u16 inbound, unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sctp_assoc_change *sac; @@ -237,7 +237,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( const struct sctp_association *asoc, const struct sockaddr_storage *aaddr, - int flags, int state, int error, gfp_t gfp) + int flags, int state, int error, unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sctp_paddr_change *spc; @@ -350,7 +350,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( */ struct sctp_ulpevent *sctp_ulpevent_make_remote_error( const struct sctp_association *asoc, struct sctp_chunk *chunk, - __u16 flags, gfp_t gfp) + __u16 flags, unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sctp_remote_error *sre; @@ -448,7 +448,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error( */ struct sctp_ulpevent *sctp_ulpevent_make_send_failed( const struct sctp_association *asoc, struct sctp_chunk *chunk, - __u16 flags, __u32 error, gfp_t gfp) + __u16 flags, __u32 error, unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sctp_send_failed *ssf; @@ -557,7 +557,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_send_failed( */ struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( const struct sctp_association *asoc, - __u16 flags, gfp_t gfp) + __u16 flags, unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sctp_shutdown_event *sse; @@ -620,7 +620,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( * 5.3.1.6 SCTP_ADAPTION_INDICATION */ struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication( - const struct sctp_association *asoc, gfp_t gfp) + const struct sctp_association *asoc, unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sctp_adaption_event *sai; @@ -657,7 +657,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication( */ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, struct sctp_chunk *chunk, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_ulpevent *event = NULL; struct sk_buff *skb; @@ -719,7 +719,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, */ struct sctp_ulpevent *sctp_ulpevent_make_pdapi( const struct sctp_association *asoc, __u32 indication, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sctp_pdapi_event *pd; diff --git a/trunk/net/sctp/ulpqueue.c b/trunk/net/sctp/ulpqueue.c index 2080b2d28c98..ec2c857eae7f 100644 --- a/trunk/net/sctp/ulpqueue.c +++ b/trunk/net/sctp/ulpqueue.c @@ -100,7 +100,7 @@ void sctp_ulpq_free(struct sctp_ulpq *ulpq) /* Process an incoming DATA chunk. */ int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, - gfp_t gfp) + unsigned int __nocast gfp) { struct sk_buff_head temp; sctp_data_chunk_t *hdr; @@ -792,7 +792,7 @@ static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed) /* Partial deliver the first message as there is pressure on rwnd. */ void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_ulpevent *event; struct sctp_association *asoc; @@ -816,7 +816,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq, /* Renege some packets to make room for an incoming chunk. */ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, - gfp_t gfp) + unsigned int __nocast gfp) { struct sctp_association *asoc; __u16 needed, freed; @@ -855,7 +855,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, /* Notify the application if an association is aborted and in * partial delivery mode. Send up any pending received messages. */ -void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp) +void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, unsigned int __nocast gfp) { struct sctp_ulpevent *ev = NULL; struct sock *sk; diff --git a/trunk/net/socket.c b/trunk/net/socket.c index 3145103cdf54..f9264472377f 100644 --- a/trunk/net/socket.c +++ b/trunk/net/socket.c @@ -1145,11 +1145,8 @@ static int __sock_create(int family, int type, int protocol, struct socket **res if (!try_module_get(net_families[family]->owner)) goto out_release; - if ((err = net_families[family]->create(sock, protocol)) < 0) { - sock->ops = NULL; + if ((err = net_families[family]->create(sock, protocol)) < 0) goto out_module_put; - } - /* * Now to bump the refcnt of the [loadable] module that owns this * socket at sock_release time we decrement its refcnt. @@ -1363,16 +1360,16 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int _ newsock->type = sock->type; newsock->ops = sock->ops; + err = security_socket_accept(sock, newsock); + if (err) + goto out_release; + /* * We don't need try_module_get here, as the listening socket (sock) * has the protocol module (sock->ops->owner) held. */ __module_get(newsock->ops->owner); - err = security_socket_accept(sock, newsock); - if (err) - goto out_release; - err = sock->ops->accept(sock, newsock, sock->file->f_flags); if (err < 0) goto out_release; @@ -1703,9 +1700,7 @@ asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags) struct socket *sock; char address[MAX_SOCK_ADDR]; struct iovec iovstack[UIO_FASTIOV], *iov = iovstack; - unsigned char ctl[sizeof(struct cmsghdr) + 20] - __attribute__ ((aligned (sizeof(__kernel_size_t)))); - /* 20 is size of ipv6_pktinfo */ + unsigned char ctl[sizeof(struct cmsghdr) + 20]; /* 20 is size of ipv6_pktinfo */ unsigned char *ctl_buf = ctl; struct msghdr msg_sys; int err, ctl_len, iov_size, total_len; diff --git a/trunk/net/sunrpc/sched.c b/trunk/net/sunrpc/sched.c index 54e60a657500..f3104035e35d 100644 --- a/trunk/net/sunrpc/sched.c +++ b/trunk/net/sunrpc/sched.c @@ -719,7 +719,7 @@ static void rpc_async_schedule(void *arg) void * rpc_malloc(struct rpc_task *task, size_t size) { - gfp_t gfp; + int gfp; if (task->tk_flags & RPC_TASK_SWAPPER) gfp = GFP_ATOMIC; diff --git a/trunk/net/sysctl_net.c b/trunk/net/sysctl_net.c index 55538f6b60ff..c5241fcbb966 100644 --- a/trunk/net/sysctl_net.c +++ b/trunk/net/sysctl_net.c @@ -16,8 +16,6 @@ #include #include -#include - #ifdef CONFIG_INET #include #endif diff --git a/trunk/net/xfrm/xfrm_policy.c b/trunk/net/xfrm/xfrm_policy.c index cbb0ba34a600..fda737d77edc 100644 --- a/trunk/net/xfrm/xfrm_policy.c +++ b/trunk/net/xfrm/xfrm_policy.c @@ -163,7 +163,7 @@ static void xfrm_policy_timer(unsigned long data) if (xp->dead) goto out; - dir = xfrm_policy_id2dir(xp->index); + dir = xp->index & 7; if (xp->lft.hard_add_expires_seconds) { long tmo = xp->lft.hard_add_expires_seconds + @@ -225,7 +225,7 @@ static void xfrm_policy_timer(unsigned long data) * SPD calls. */ -struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp) +struct xfrm_policy *xfrm_policy_alloc(int gfp) { struct xfrm_policy *policy; @@ -417,7 +417,7 @@ struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete) struct xfrm_policy *pol, **p; write_lock_bh(&xfrm_policy_lock); - for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL; p = &pol->next) { + for (p = &xfrm_policy_list[id & 7]; (pol=*p)!=NULL; p = &pol->next) { if (pol->index == id) { xfrm_pol_hold(pol); if (delete) diff --git a/trunk/scripts/mod/file2alias.c b/trunk/scripts/mod/file2alias.c index f2ee673329a7..d8ee38aede26 100644 --- a/trunk/scripts/mod/file2alias.c +++ b/trunk/scripts/mod/file2alias.c @@ -295,13 +295,11 @@ static int do_pcmcia_entry(const char *filename, { unsigned int i; - id->match_flags = TO_NATIVE(id->match_flags); id->manf_id = TO_NATIVE(id->manf_id); id->card_id = TO_NATIVE(id->card_id); id->func_id = TO_NATIVE(id->func_id); id->function = TO_NATIVE(id->function); id->device_no = TO_NATIVE(id->device_no); - for (i=0; i<4; i++) { id->prod_id_hash[i] = TO_NATIVE(id->prod_id_hash[i]); } diff --git a/trunk/security/keys/Makefile b/trunk/security/keys/Makefile index 5145adfb6a05..c392d750b208 100644 --- a/trunk/security/keys/Makefile +++ b/trunk/security/keys/Makefile @@ -6,7 +6,6 @@ obj-y := \ key.o \ keyring.o \ keyctl.o \ - permission.o \ process_keys.o \ request_key.o \ request_key_auth.o \ diff --git a/trunk/security/keys/internal.h b/trunk/security/keys/internal.h index db99ed434f3a..46c8602661c9 100644 --- a/trunk/security/keys/internal.h +++ b/trunk/security/keys/internal.h @@ -71,26 +71,26 @@ extern void keyring_publish_name(struct key *keyring); extern int __key_link(struct key *keyring, struct key *key); -extern key_ref_t __keyring_search_one(key_ref_t keyring_ref, - const struct key_type *type, - const char *description, - key_perm_t perm); +extern struct key *__keyring_search_one(struct key *keyring, + const struct key_type *type, + const char *description, + key_perm_t perm); extern struct key *keyring_search_instkey(struct key *keyring, key_serial_t target_id); typedef int (*key_match_func_t)(const struct key *, const void *); -extern key_ref_t keyring_search_aux(key_ref_t keyring_ref, - struct task_struct *tsk, - struct key_type *type, - const void *description, - key_match_func_t match); +extern struct key *keyring_search_aux(struct key *keyring, + struct task_struct *tsk, + struct key_type *type, + const void *description, + key_match_func_t match); -extern key_ref_t search_process_keyrings(struct key_type *type, - const void *description, - key_match_func_t match, - struct task_struct *tsk); +extern struct key *search_process_keyrings(struct key_type *type, + const void *description, + key_match_func_t match, + struct task_struct *tsk); extern struct key *find_keyring_by_name(const char *name, key_serial_t bound); diff --git a/trunk/security/keys/key.c b/trunk/security/keys/key.c index 2182be9e9309..fb89f9844465 100644 --- a/trunk/security/keys/key.c +++ b/trunk/security/keys/key.c @@ -693,15 +693,14 @@ void key_type_put(struct key_type *ktype) * - the key has an incremented refcount * - we need to put the key if we get an error */ -static inline key_ref_t __key_update(key_ref_t key_ref, - const void *payload, size_t plen) +static inline struct key *__key_update(struct key *key, const void *payload, + size_t plen) { - struct key *key = key_ref_to_ptr(key_ref); int ret; /* need write permission on the key to update it */ ret = -EACCES; - if (!key_permission(key_ref, KEY_WRITE)) + if (!key_permission(key, KEY_WRITE)) goto error; ret = -EEXIST; @@ -720,12 +719,12 @@ static inline key_ref_t __key_update(key_ref_t key_ref, if (ret < 0) goto error; -out: - return key_ref; + out: + return key; -error: + error: key_put(key); - key_ref = ERR_PTR(ret); + key = ERR_PTR(ret); goto out; } /* end __key_update() */ @@ -735,56 +734,52 @@ static inline key_ref_t __key_update(key_ref_t key_ref, * search the specified keyring for a key of the same description; if one is * found, update it, otherwise add a new one */ -key_ref_t key_create_or_update(key_ref_t keyring_ref, - const char *type, - const char *description, - const void *payload, - size_t plen, - int not_in_quota) +struct key *key_create_or_update(struct key *keyring, + const char *type, + const char *description, + const void *payload, + size_t plen, + int not_in_quota) { struct key_type *ktype; - struct key *keyring, *key = NULL; + struct key *key = NULL; key_perm_t perm; - key_ref_t key_ref; int ret; + key_check(keyring); + /* look up the key type to see if it's one of the registered kernel * types */ ktype = key_type_lookup(type); if (IS_ERR(ktype)) { - key_ref = ERR_PTR(-ENODEV); + key = ERR_PTR(-ENODEV); goto error; } - key_ref = ERR_PTR(-EINVAL); + ret = -EINVAL; if (!ktype->match || !ktype->instantiate) goto error_2; - keyring = key_ref_to_ptr(keyring_ref); - - key_check(keyring); - - down_write(&keyring->sem); - - /* if we're going to allocate a new key, we're going to have - * to modify the keyring */ - key_ref = ERR_PTR(-EACCES); - if (!key_permission(keyring_ref, KEY_WRITE)) - goto error_3; - /* search for an existing key of the same type and description in the * destination keyring */ - key_ref = __keyring_search_one(keyring_ref, ktype, description, 0); - if (!IS_ERR(key_ref)) + down_write(&keyring->sem); + + key = __keyring_search_one(keyring, ktype, description, 0); + if (!IS_ERR(key)) goto found_matching_key; + /* if we're going to allocate a new key, we're going to have to modify + * the keyring */ + ret = -EACCES; + if (!key_permission(keyring, KEY_WRITE)) + goto error_3; + /* decide on the permissions we want */ - perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK; - perm |= KEY_USR_VIEW | KEY_USR_SEARCH | KEY_USR_LINK; + perm = KEY_USR_VIEW | KEY_USR_SEARCH | KEY_USR_LINK; if (ktype->read) - perm |= KEY_POS_READ | KEY_USR_READ; + perm |= KEY_USR_READ; if (ktype == &key_type_keyring || ktype->update) perm |= KEY_USR_WRITE; @@ -793,7 +788,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, key = key_alloc(ktype, description, current->fsuid, current->fsgid, perm, not_in_quota); if (IS_ERR(key)) { - key_ref = ERR_PTR(PTR_ERR(key)); + ret = PTR_ERR(key); goto error_3; } @@ -801,18 +796,15 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, ret = __key_instantiate_and_link(key, payload, plen, keyring, NULL); if (ret < 0) { key_put(key); - key_ref = ERR_PTR(ret); - goto error_3; + key = ERR_PTR(ret); } - key_ref = make_key_ref(key, is_key_possessed(keyring_ref)); - error_3: up_write(&keyring->sem); error_2: key_type_put(ktype); error: - return key_ref; + return key; found_matching_key: /* we found a matching key, so we're going to try to update it @@ -821,7 +813,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, up_write(&keyring->sem); key_type_put(ktype); - key_ref = __key_update(key_ref, payload, plen); + key = __key_update(key, payload, plen); goto error; } /* end key_create_or_update() */ @@ -832,16 +824,15 @@ EXPORT_SYMBOL(key_create_or_update); /* * update a key */ -int key_update(key_ref_t key_ref, const void *payload, size_t plen) +int key_update(struct key *key, const void *payload, size_t plen) { - struct key *key = key_ref_to_ptr(key_ref); int ret; key_check(key); /* the key must be writable */ ret = -EACCES; - if (!key_permission(key_ref, KEY_WRITE)) + if (!key_permission(key, KEY_WRITE)) goto error; /* attempt to update it if supported */ diff --git a/trunk/security/keys/keyctl.c b/trunk/security/keys/keyctl.c index 4c670ee6acf9..a6516a64b297 100644 --- a/trunk/security/keys/keyctl.c +++ b/trunk/security/keys/keyctl.c @@ -34,7 +34,7 @@ asmlinkage long sys_add_key(const char __user *_type, size_t plen, key_serial_t ringid) { - key_ref_t keyring_ref, key_ref; + struct key *keyring, *key; char type[32], *description; void *payload; long dlen, ret; @@ -86,25 +86,25 @@ asmlinkage long sys_add_key(const char __user *_type, } /* find the target keyring (which must be writable) */ - keyring_ref = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE); - if (IS_ERR(keyring_ref)) { - ret = PTR_ERR(keyring_ref); + keyring = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE); + if (IS_ERR(keyring)) { + ret = PTR_ERR(keyring); goto error3; } /* create or update the requested key and add it to the target * keyring */ - key_ref = key_create_or_update(keyring_ref, type, description, - payload, plen, 0); - if (!IS_ERR(key_ref)) { - ret = key_ref_to_ptr(key_ref)->serial; - key_ref_put(key_ref); + key = key_create_or_update(keyring, type, description, + payload, plen, 0); + if (!IS_ERR(key)) { + ret = key->serial; + key_put(key); } else { - ret = PTR_ERR(key_ref); + ret = PTR_ERR(key); } - key_ref_put(keyring_ref); + key_put(keyring); error3: kfree(payload); error2: @@ -131,8 +131,7 @@ asmlinkage long sys_request_key(const char __user *_type, key_serial_t destringid) { struct key_type *ktype; - struct key *key; - key_ref_t dest_ref; + struct key *key, *dest; char type[32], *description, *callout_info; long dlen, ret; @@ -188,11 +187,11 @@ asmlinkage long sys_request_key(const char __user *_type, } /* get the destination keyring if specified */ - dest_ref = NULL; + dest = NULL; if (destringid) { - dest_ref = lookup_user_key(NULL, destringid, 1, 0, KEY_WRITE); - if (IS_ERR(dest_ref)) { - ret = PTR_ERR(dest_ref); + dest = lookup_user_key(NULL, destringid, 1, 0, KEY_WRITE); + if (IS_ERR(dest)) { + ret = PTR_ERR(dest); goto error3; } } @@ -205,8 +204,7 @@ asmlinkage long sys_request_key(const char __user *_type, } /* do the search */ - key = request_key_and_link(ktype, description, callout_info, - key_ref_to_ptr(dest_ref)); + key = request_key_and_link(ktype, description, callout_info, dest); if (IS_ERR(key)) { ret = PTR_ERR(key); goto error5; @@ -218,7 +216,7 @@ asmlinkage long sys_request_key(const char __user *_type, error5: key_type_put(ktype); error4: - key_ref_put(dest_ref); + key_put(dest); error3: kfree(callout_info); error2: @@ -236,17 +234,17 @@ asmlinkage long sys_request_key(const char __user *_type, */ long keyctl_get_keyring_ID(key_serial_t id, int create) { - key_ref_t key_ref; + struct key *key; long ret; - key_ref = lookup_user_key(NULL, id, create, 0, KEY_SEARCH); - if (IS_ERR(key_ref)) { - ret = PTR_ERR(key_ref); + key = lookup_user_key(NULL, id, create, 0, KEY_SEARCH); + if (IS_ERR(key)) { + ret = PTR_ERR(key); goto error; } - ret = key_ref_to_ptr(key_ref)->serial; - key_ref_put(key_ref); + ret = key->serial; + key_put(key); error: return ret; @@ -304,7 +302,7 @@ long keyctl_update_key(key_serial_t id, const void __user *_payload, size_t plen) { - key_ref_t key_ref; + struct key *key; void *payload; long ret; @@ -326,16 +324,16 @@ long keyctl_update_key(key_serial_t id, } /* find the target key (which must be writable) */ - key_ref = lookup_user_key(NULL, id, 0, 0, KEY_WRITE); - if (IS_ERR(key_ref)) { - ret = PTR_ERR(key_ref); + key = lookup_user_key(NULL, id, 0, 0, KEY_WRITE); + if (IS_ERR(key)) { + ret = PTR_ERR(key); goto error2; } /* update the key */ - ret = key_update(key_ref, payload, plen); + ret = key_update(key, payload, plen); - key_ref_put(key_ref); + key_put(key); error2: kfree(payload); error: @@ -351,19 +349,19 @@ long keyctl_update_key(key_serial_t id, */ long keyctl_revoke_key(key_serial_t id) { - key_ref_t key_ref; + struct key *key; long ret; - key_ref = lookup_user_key(NULL, id, 0, 0, KEY_WRITE); - if (IS_ERR(key_ref)) { - ret = PTR_ERR(key_ref); + key = lookup_user_key(NULL, id, 0, 0, KEY_WRITE); + if (IS_ERR(key)) { + ret = PTR_ERR(key); goto error; } - key_revoke(key_ref_to_ptr(key_ref)); + key_revoke(key); ret = 0; - key_ref_put(key_ref); + key_put(key); error: return ret; @@ -377,18 +375,18 @@ long keyctl_revoke_key(key_serial_t id) */ long keyctl_keyring_clear(key_serial_t ringid) { - key_ref_t keyring_ref; + struct key *keyring; long ret; - keyring_ref = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE); - if (IS_ERR(keyring_ref)) { - ret = PTR_ERR(keyring_ref); + keyring = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE); + if (IS_ERR(keyring)) { + ret = PTR_ERR(keyring); goto error; } - ret = keyring_clear(key_ref_to_ptr(keyring_ref)); + ret = keyring_clear(keyring); - key_ref_put(keyring_ref); + key_put(keyring); error: return ret; @@ -403,26 +401,26 @@ long keyctl_keyring_clear(key_serial_t ringid) */ long keyctl_keyring_link(key_serial_t id, key_serial_t ringid) { - key_ref_t keyring_ref, key_ref; + struct key *keyring, *key; long ret; - keyring_ref = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE); - if (IS_ERR(keyring_ref)) { - ret = PTR_ERR(keyring_ref); + keyring = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE); + if (IS_ERR(keyring)) { + ret = PTR_ERR(keyring); goto error; } - key_ref = lookup_user_key(NULL, id, 1, 0, KEY_LINK); - if (IS_ERR(key_ref)) { - ret = PTR_ERR(key_ref); + key = lookup_user_key(NULL, id, 1, 0, KEY_LINK); + if (IS_ERR(key)) { + ret = PTR_ERR(key); goto error2; } - ret = key_link(key_ref_to_ptr(keyring_ref), key_ref_to_ptr(key_ref)); + ret = key_link(keyring, key); - key_ref_put(key_ref); + key_put(key); error2: - key_ref_put(keyring_ref); + key_put(keyring); error: return ret; @@ -437,26 +435,26 @@ long keyctl_keyring_link(key_serial_t id, key_serial_t ringid) */ long keyctl_keyring_unlink(key_serial_t id, key_serial_t ringid) { - key_ref_t keyring_ref, key_ref; + struct key *keyring, *key; long ret; - keyring_ref = lookup_user_key(NULL, ringid, 0, 0, KEY_WRITE); - if (IS_ERR(keyring_ref)) { - ret = PTR_ERR(keyring_ref); + keyring = lookup_user_key(NULL, ringid, 0, 0, KEY_WRITE); + if (IS_ERR(keyring)) { + ret = PTR_ERR(keyring); goto error; } - key_ref = lookup_user_key(NULL, id, 0, 0, 0); - if (IS_ERR(key_ref)) { - ret = PTR_ERR(key_ref); + key = lookup_user_key(NULL, id, 0, 0, 0); + if (IS_ERR(key)) { + ret = PTR_ERR(key); goto error2; } - ret = key_unlink(key_ref_to_ptr(keyring_ref), key_ref_to_ptr(key_ref)); + ret = key_unlink(keyring, key); - key_ref_put(key_ref); + key_put(key); error2: - key_ref_put(keyring_ref); + key_put(keyring); error: return ret; @@ -478,26 +476,24 @@ long keyctl_describe_key(key_serial_t keyid, size_t buflen) { struct key *key, *instkey; - key_ref_t key_ref; char *tmpbuf; long ret; - key_ref = lookup_user_key(NULL, keyid, 0, 1, KEY_VIEW); - if (IS_ERR(key_ref)) { + key = lookup_user_key(NULL, keyid, 0, 1, KEY_VIEW); + if (IS_ERR(key)) { /* viewing a key under construction is permitted if we have the * authorisation token handy */ - if (PTR_ERR(key_ref) == -EACCES) { + if (PTR_ERR(key) == -EACCES) { instkey = key_get_instantiation_authkey(keyid); if (!IS_ERR(instkey)) { key_put(instkey); - key_ref = lookup_user_key(NULL, keyid, - 0, 1, 0); - if (!IS_ERR(key_ref)) + key = lookup_user_key(NULL, keyid, 0, 1, 0); + if (!IS_ERR(key)) goto okay; } } - ret = PTR_ERR(key_ref); + ret = PTR_ERR(key); goto error; } @@ -508,16 +504,13 @@ long keyctl_describe_key(key_serial_t keyid, if (!tmpbuf) goto error2; - key = key_ref_to_ptr(key_ref); - ret = snprintf(tmpbuf, PAGE_SIZE - 1, - "%s;%d;%d;%08x;%s", - key_ref_to_ptr(key_ref)->type->name, - key_ref_to_ptr(key_ref)->uid, - key_ref_to_ptr(key_ref)->gid, - key_ref_to_ptr(key_ref)->perm, - key_ref_to_ptr(key_ref)->description ? - key_ref_to_ptr(key_ref)->description : "" + "%s;%d;%d;%06x;%s", + key->type->name, + key->uid, + key->gid, + key->perm, + key->description ? key->description :"" ); /* include a NUL char at the end of the data */ @@ -537,7 +530,7 @@ long keyctl_describe_key(key_serial_t keyid, kfree(tmpbuf); error2: - key_ref_put(key_ref); + key_put(key); error: return ret; @@ -559,7 +552,7 @@ long keyctl_keyring_search(key_serial_t ringid, key_serial_t destringid) { struct key_type *ktype; - key_ref_t keyring_ref, key_ref, dest_ref; + struct key *keyring, *key, *dest; char type[32], *description; long dlen, ret; @@ -588,18 +581,18 @@ long keyctl_keyring_search(key_serial_t ringid, goto error2; /* get the keyring at which to begin the search */ - keyring_ref = lookup_user_key(NULL, ringid, 0, 0, KEY_SEARCH); - if (IS_ERR(keyring_ref)) { - ret = PTR_ERR(keyring_ref); + keyring = lookup_user_key(NULL, ringid, 0, 0, KEY_SEARCH); + if (IS_ERR(keyring)) { + ret = PTR_ERR(keyring); goto error2; } /* get the destination keyring if specified */ - dest_ref = NULL; + dest = NULL; if (destringid) { - dest_ref = lookup_user_key(NULL, destringid, 1, 0, KEY_WRITE); - if (IS_ERR(dest_ref)) { - ret = PTR_ERR(dest_ref); + dest = lookup_user_key(NULL, destringid, 1, 0, KEY_WRITE); + if (IS_ERR(dest)) { + ret = PTR_ERR(dest); goto error3; } } @@ -612,9 +605,9 @@ long keyctl_keyring_search(key_serial_t ringid, } /* do the search */ - key_ref = keyring_search(keyring_ref, ktype, description); - if (IS_ERR(key_ref)) { - ret = PTR_ERR(key_ref); + key = keyring_search(keyring, ktype, description); + if (IS_ERR(key)) { + ret = PTR_ERR(key); /* treat lack or presence of a negative key the same */ if (ret == -EAGAIN) @@ -623,26 +616,26 @@ long keyctl_keyring_search(key_serial_t ringid, } /* link the resulting key to the destination keyring if we can */ - if (dest_ref) { + if (dest) { ret = -EACCES; - if (!key_permission(key_ref, KEY_LINK)) + if (!key_permission(key, KEY_LINK)) goto error6; - ret = key_link(key_ref_to_ptr(dest_ref), key_ref_to_ptr(key_ref)); + ret = key_link(dest, key); if (ret < 0) goto error6; } - ret = key_ref_to_ptr(key_ref)->serial; + ret = key->serial; error6: - key_ref_put(key_ref); + key_put(key); error5: key_type_put(ktype); error4: - key_ref_put(dest_ref); + key_put(dest); error3: - key_ref_put(keyring_ref); + key_put(keyring); error2: kfree(description); error: @@ -650,6 +643,16 @@ long keyctl_keyring_search(key_serial_t ringid, } /* end keyctl_keyring_search() */ +/*****************************************************************************/ +/* + * see if the key we're looking at is the target key + */ +static int keyctl_read_key_same(const struct key *key, const void *target) +{ + return key == target; + +} /* end keyctl_read_key_same() */ + /*****************************************************************************/ /* * read a user key's payload @@ -662,33 +665,38 @@ long keyctl_keyring_search(key_serial_t ringid, */ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) { - struct key *key; - key_ref_t key_ref; + struct key *key, *skey; long ret; /* find the key first */ - key_ref = lookup_user_key(NULL, keyid, 0, 0, 0); - if (IS_ERR(key_ref)) { - ret = -ENOKEY; - goto error; - } - - key = key_ref_to_ptr(key_ref); - - /* see if we can read it directly */ - if (key_permission(key_ref, KEY_READ)) - goto can_read_key; - - /* we can't; see if it's searchable from this process's keyrings - * - we automatically take account of the fact that it may be - * dangling off an instantiation key - */ - if (!is_key_possessed(key_ref)) { - ret = -EACCES; + key = lookup_user_key(NULL, keyid, 0, 0, 0); + if (!IS_ERR(key)) { + /* see if we can read it directly */ + if (key_permission(key, KEY_READ)) + goto can_read_key; + + /* we can't; see if it's searchable from this process's + * keyrings + * - we automatically take account of the fact that it may be + * dangling off an instantiation key + */ + skey = search_process_keyrings(key->type, key, + keyctl_read_key_same, current); + if (!IS_ERR(skey)) + goto can_read_key2; + + ret = PTR_ERR(skey); + if (ret == -EAGAIN) + ret = -EACCES; goto error2; } + ret = -ENOKEY; + goto error; + /* the key is probably readable - now try to read it */ + can_read_key2: + key_put(skey); can_read_key: ret = key_validate(key); if (ret == 0) { @@ -719,21 +727,18 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) long keyctl_chown_key(key_serial_t id, uid_t uid, gid_t gid) { struct key *key; - key_ref_t key_ref; long ret; ret = 0; if (uid == (uid_t) -1 && gid == (gid_t) -1) goto error; - key_ref = lookup_user_key(NULL, id, 1, 1, 0); - if (IS_ERR(key_ref)) { - ret = PTR_ERR(key_ref); + key = lookup_user_key(NULL, id, 1, 1, 0); + if (IS_ERR(key)) { + ret = PTR_ERR(key); goto error; } - key = key_ref_to_ptr(key_ref); - /* make the changes with the locks held to prevent chown/chown races */ ret = -EACCES; down_write(&key->sem); @@ -779,21 +784,18 @@ long keyctl_chown_key(key_serial_t id, uid_t uid, gid_t gid) long keyctl_setperm_key(key_serial_t id, key_perm_t perm) { struct key *key; - key_ref_t key_ref; long ret; ret = -EINVAL; - if (perm & ~(KEY_POS_ALL | KEY_USR_ALL | KEY_GRP_ALL | KEY_OTH_ALL)) + if (perm & ~(KEY_USR_ALL | KEY_GRP_ALL | KEY_OTH_ALL)) goto error; - key_ref = lookup_user_key(NULL, id, 1, 1, 0); - if (IS_ERR(key_ref)) { - ret = PTR_ERR(key_ref); + key = lookup_user_key(NULL, id, 1, 1, 0); + if (IS_ERR(key)) { + ret = PTR_ERR(key); goto error; } - key = key_ref_to_ptr(key_ref); - /* make the changes with the locks held to prevent chown/chmod races */ ret = -EACCES; down_write(&key->sem); @@ -822,8 +824,7 @@ long keyctl_instantiate_key(key_serial_t id, key_serial_t ringid) { struct request_key_auth *rka; - struct key *instkey; - key_ref_t keyring_ref; + struct key *instkey, *keyring; void *payload; long ret; @@ -856,21 +857,21 @@ long keyctl_instantiate_key(key_serial_t id, /* find the destination keyring amongst those belonging to the * requesting task */ - keyring_ref = NULL; + keyring = NULL; if (ringid) { - keyring_ref = lookup_user_key(rka->context, ringid, 1, 0, - KEY_WRITE); - if (IS_ERR(keyring_ref)) { - ret = PTR_ERR(keyring_ref); + keyring = lookup_user_key(rka->context, ringid, 1, 0, + KEY_WRITE); + if (IS_ERR(keyring)) { + ret = PTR_ERR(keyring); goto error3; } } /* instantiate the key and link it into a keyring */ ret = key_instantiate_and_link(rka->target_key, payload, plen, - key_ref_to_ptr(keyring_ref), instkey); + keyring, instkey); - key_ref_put(keyring_ref); + key_put(keyring); error3: key_put(instkey); error2: @@ -888,8 +889,7 @@ long keyctl_instantiate_key(key_serial_t id, long keyctl_negate_key(key_serial_t id, unsigned timeout, key_serial_t ringid) { struct request_key_auth *rka; - struct key *instkey; - key_ref_t keyring_ref; + struct key *instkey, *keyring; long ret; /* find the instantiation authorisation key */ @@ -903,20 +903,19 @@ long keyctl_negate_key(key_serial_t id, unsigned timeout, key_serial_t ringid) /* find the destination keyring if present (which must also be * writable) */ - keyring_ref = NULL; + keyring = NULL; if (ringid) { - keyring_ref = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE); - if (IS_ERR(keyring_ref)) { - ret = PTR_ERR(keyring_ref); + keyring = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE); + if (IS_ERR(keyring)) { + ret = PTR_ERR(keyring); goto error2; } } /* instantiate the key and link it into a keyring */ - ret = key_negate_and_link(rka->target_key, timeout, - key_ref_to_ptr(keyring_ref), instkey); + ret = key_negate_and_link(rka->target_key, timeout, keyring, instkey); - key_ref_put(keyring_ref); + key_put(keyring); error2: key_put(instkey); error: diff --git a/trunk/security/keys/keyring.c b/trunk/security/keys/keyring.c index 0639396dd441..9c208c756df8 100644 --- a/trunk/security/keys/keyring.c +++ b/trunk/security/keys/keyring.c @@ -309,7 +309,7 @@ struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, int ret; keyring = key_alloc(&key_type_keyring, description, - uid, gid, KEY_POS_ALL | KEY_USR_ALL, not_in_quota); + uid, gid, KEY_USR_ALL, not_in_quota); if (!IS_ERR(keyring)) { ret = key_instantiate_and_link(keyring, NULL, 0, dest, NULL); @@ -333,13 +333,12 @@ struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, * - we rely on RCU to prevent the keyring lists from disappearing on us * - we return -EAGAIN if we didn't find any matching key * - we return -ENOKEY if we only found negative matching keys - * - we propagate the possession attribute from the keyring ref to the key ref */ -key_ref_t keyring_search_aux(key_ref_t keyring_ref, - struct task_struct *context, - struct key_type *type, - const void *description, - key_match_func_t match) +struct key *keyring_search_aux(struct key *keyring, + struct task_struct *context, + struct key_type *type, + const void *description, + key_match_func_t match) { struct { struct keyring_list *keylist; @@ -348,33 +347,29 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref, struct keyring_list *keylist; struct timespec now; - unsigned long possessed; - struct key *keyring, *key; - key_ref_t key_ref; + struct key *key; long err; int sp, kix; - keyring = key_ref_to_ptr(keyring_ref); - possessed = is_key_possessed(keyring_ref); key_check(keyring); + rcu_read_lock(); + /* top keyring must have search permission to begin the search */ - key_ref = ERR_PTR(-EACCES); - if (!key_task_permission(keyring_ref, context, KEY_SEARCH)) + key = ERR_PTR(-EACCES); + if (!key_task_permission(keyring, context, KEY_SEARCH)) goto error; - key_ref = ERR_PTR(-ENOTDIR); + key = ERR_PTR(-ENOTDIR); if (keyring->type != &key_type_keyring) goto error; - rcu_read_lock(); - now = current_kernel_time(); err = -EAGAIN; sp = 0; /* start processing a new keyring */ -descend: + descend: if (test_bit(KEY_FLAG_REVOKED, &keyring->flags)) goto not_this_keyring; @@ -402,8 +397,7 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref, continue; /* key must have search permissions */ - if (!key_task_permission(make_key_ref(key, possessed), - context, KEY_SEARCH)) + if (!key_task_permission(key, context, KEY_SEARCH)) continue; /* we set a different error code if we find a negative key */ @@ -417,7 +411,7 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref, /* search through the keyrings nested in this one */ kix = 0; -ascend: + ascend: for (; kix < keylist->nkeys; kix++) { key = keylist->keys[kix]; if (key->type != &key_type_keyring) @@ -429,8 +423,7 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref, if (sp >= KEYRING_SEARCH_MAX_DEPTH) continue; - if (!key_task_permission(make_key_ref(key, possessed), - context, KEY_SEARCH)) + if (!key_task_permission(key, context, KEY_SEARCH)) continue; /* stack the current position */ @@ -445,7 +438,7 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref, /* the keyring we're looking at was disqualified or didn't contain a * matching key */ -not_this_keyring: + not_this_keyring: if (sp > 0) { /* resume the processing of a keyring higher up in the tree */ sp--; @@ -454,18 +447,16 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref, goto ascend; } - key_ref = ERR_PTR(err); - goto error_2; + key = ERR_PTR(err); + goto error; /* we found a viable match */ -found: + found: atomic_inc(&key->usage); key_check(key); - key_ref = make_key_ref(key, possessed); -error_2: + error: rcu_read_unlock(); -error: - return key_ref; + return key; } /* end keyring_search_aux() */ @@ -478,9 +469,9 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref, * - we return -EAGAIN if we didn't find any matching key * - we return -ENOKEY if we only found negative matching keys */ -key_ref_t keyring_search(key_ref_t keyring, - struct key_type *type, - const char *description) +struct key *keyring_search(struct key *keyring, + struct key_type *type, + const char *description) { if (!type->match) return ERR_PTR(-ENOKEY); @@ -497,19 +488,15 @@ EXPORT_SYMBOL(keyring_search); * search the given keyring only (no recursion) * - keyring must be locked by caller */ -key_ref_t __keyring_search_one(key_ref_t keyring_ref, - const struct key_type *ktype, - const char *description, - key_perm_t perm) +struct key *__keyring_search_one(struct key *keyring, + const struct key_type *ktype, + const char *description, + key_perm_t perm) { struct keyring_list *klist; - unsigned long possessed; - struct key *keyring, *key; + struct key *key; int loop; - keyring = key_ref_to_ptr(keyring_ref); - possessed = is_key_possessed(keyring_ref); - rcu_read_lock(); klist = rcu_dereference(keyring->payload.subscriptions); @@ -520,21 +507,21 @@ key_ref_t __keyring_search_one(key_ref_t keyring_ref, if (key->type == ktype && (!key->type->match || key->type->match(key, description)) && - key_permission(make_key_ref(key, possessed), - perm) && + key_permission(key, perm) && !test_bit(KEY_FLAG_REVOKED, &key->flags) ) goto found; } } - rcu_read_unlock(); - return ERR_PTR(-ENOKEY); + key = ERR_PTR(-ENOKEY); + goto error; found: atomic_inc(&key->usage); + error: rcu_read_unlock(); - return make_key_ref(key, possessed); + return key; } /* end __keyring_search_one() */ @@ -616,8 +603,7 @@ struct key *find_keyring_by_name(const char *name, key_serial_t bound) if (strcmp(keyring->description, name) != 0) continue; - if (!key_permission(make_key_ref(keyring, 0), - KEY_SEARCH)) + if (!key_permission(keyring, KEY_SEARCH)) continue; /* found a potential candidate, but we still need to diff --git a/trunk/security/keys/permission.c b/trunk/security/keys/permission.c deleted file mode 100644 index 03db073ba45c..000000000000 --- a/trunk/security/keys/permission.c +++ /dev/null @@ -1,70 +0,0 @@ -/* permission.c: key permission determination - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include "internal.h" - -/*****************************************************************************/ -/* - * check to see whether permission is granted to use a key in the desired way, - * but permit the security modules to override - */ -int key_task_permission(const key_ref_t key_ref, - struct task_struct *context, - key_perm_t perm) -{ - struct key *key; - key_perm_t kperm; - int ret; - - key = key_ref_to_ptr(key_ref); - - /* use the second 8-bits of permissions for keys the caller owns */ - if (key->uid == context->fsuid) { - kperm = key->perm >> 16; - goto use_these_perms; - } - - /* use the third 8-bits of permissions for keys the caller has a group - * membership in common with */ - if (key->gid != -1 && key->perm & KEY_GRP_ALL) { - if (key->gid == context->fsgid) { - kperm = key->perm >> 8; - goto use_these_perms; - } - - task_lock(context); - ret = groups_search(context->group_info, key->gid); - task_unlock(context); - - if (ret) { - kperm = key->perm >> 8; - goto use_these_perms; - } - } - - /* otherwise use the least-significant 8-bits */ - kperm = key->perm; - -use_these_perms: - /* use the top 8-bits of permissions for keys the caller possesses - * - possessor permissions are additive with other permissions - */ - if (is_key_possessed(key_ref)) - kperm |= key->perm >> 24; - - kperm = kperm & perm & KEY_ALL; - - return kperm == perm; - -} /* end key_task_permission() */ - -EXPORT_SYMBOL(key_task_permission); diff --git a/trunk/security/keys/proc.c b/trunk/security/keys/proc.c index 12b750e51fbf..c55cf1fd0826 100644 --- a/trunk/security/keys/proc.c +++ b/trunk/security/keys/proc.c @@ -167,7 +167,7 @@ static int proc_keys_show(struct seq_file *m, void *v) #define showflag(KEY, LETTER, FLAG) \ (test_bit(FLAG, &(KEY)->flags) ? LETTER : '-') - seq_printf(m, "%08x %c%c%c%c%c%c %5d %4s %08x %5d %5d %-9.9s ", + seq_printf(m, "%08x %c%c%c%c%c%c %5d %4s %06x %5d %5d %-9.9s ", key->serial, showflag(key, 'I', KEY_FLAG_INSTANTIATED), showflag(key, 'R', KEY_FLAG_REVOKED), diff --git a/trunk/security/keys/process_keys.c b/trunk/security/keys/process_keys.c index d42d2158ce13..c089f78fb94e 100644 --- a/trunk/security/keys/process_keys.c +++ b/trunk/security/keys/process_keys.c @@ -39,7 +39,7 @@ struct key root_user_keyring = { .type = &key_type_keyring, .user = &root_key_user, .sem = __RWSEM_INITIALIZER(root_user_keyring.sem), - .perm = KEY_POS_ALL | KEY_USR_ALL, + .perm = KEY_USR_ALL, .flags = 1 << KEY_FLAG_INSTANTIATED, .description = "_uid.0", #ifdef KEY_DEBUGGING @@ -54,7 +54,7 @@ struct key root_session_keyring = { .type = &key_type_keyring, .user = &root_key_user, .sem = __RWSEM_INITIALIZER(root_session_keyring.sem), - .perm = KEY_POS_ALL | KEY_USR_ALL, + .perm = KEY_USR_ALL, .flags = 1 << KEY_FLAG_INSTANTIATED, .description = "_uid_ses.0", #ifdef KEY_DEBUGGING @@ -98,7 +98,7 @@ int alloc_uid_keyring(struct user_struct *user) user->session_keyring = session_keyring; ret = 0; -error: + error: return ret; } /* end alloc_uid_keyring() */ @@ -156,7 +156,7 @@ int install_thread_keyring(struct task_struct *tsk) ret = 0; key_put(old); -error: + error: return ret; } /* end install_thread_keyring() */ @@ -193,7 +193,7 @@ int install_process_keyring(struct task_struct *tsk) } ret = 0; -error: + error: return ret; } /* end install_process_keyring() */ @@ -236,7 +236,7 @@ static int install_session_keyring(struct task_struct *tsk, /* we're using RCU on the pointer */ synchronize_rcu(); key_put(old); -error: + error: return ret; } /* end install_session_keyring() */ @@ -376,13 +376,13 @@ void key_fsgid_changed(struct task_struct *tsk) * - we return -EAGAIN if we didn't find any matching key * - we return -ENOKEY if we found only negative matching keys */ -key_ref_t search_process_keyrings(struct key_type *type, - const void *description, - key_match_func_t match, - struct task_struct *context) +struct key *search_process_keyrings(struct key_type *type, + const void *description, + key_match_func_t match, + struct task_struct *context) { struct request_key_auth *rka; - key_ref_t key_ref, ret, err, instkey_ref; + struct key *key, *ret, *err, *instkey; /* we want to return -EAGAIN or -ENOKEY if any of the keyrings were * searchable, but we failed to find a key or we found a negative key; @@ -391,48 +391,46 @@ key_ref_t search_process_keyrings(struct key_type *type, * * in terms of priority: success > -ENOKEY > -EAGAIN > other error */ - key_ref = NULL; + key = NULL; ret = NULL; err = ERR_PTR(-EAGAIN); /* search the thread keyring first */ if (context->thread_keyring) { - key_ref = keyring_search_aux( - make_key_ref(context->thread_keyring, 1), - context, type, description, match); - if (!IS_ERR(key_ref)) + key = keyring_search_aux(context->thread_keyring, + context, type, description, match); + if (!IS_ERR(key)) goto found; - switch (PTR_ERR(key_ref)) { + switch (PTR_ERR(key)) { case -EAGAIN: /* no key */ if (ret) break; case -ENOKEY: /* negative key */ - ret = key_ref; + ret = key; break; default: - err = key_ref; + err = key; break; } } /* search the process keyring second */ if (context->signal->process_keyring) { - key_ref = keyring_search_aux( - make_key_ref(context->signal->process_keyring, 1), - context, type, description, match); - if (!IS_ERR(key_ref)) + key = keyring_search_aux(context->signal->process_keyring, + context, type, description, match); + if (!IS_ERR(key)) goto found; - switch (PTR_ERR(key_ref)) { + switch (PTR_ERR(key)) { case -EAGAIN: /* no key */ if (ret) break; case -ENOKEY: /* negative key */ - ret = key_ref; + ret = key; break; default: - err = key_ref; + err = key; break; } } @@ -440,25 +438,23 @@ key_ref_t search_process_keyrings(struct key_type *type, /* search the session keyring */ if (context->signal->session_keyring) { rcu_read_lock(); - key_ref = keyring_search_aux( - make_key_ref(rcu_dereference( - context->signal->session_keyring), - 1), + key = keyring_search_aux( + rcu_dereference(context->signal->session_keyring), context, type, description, match); rcu_read_unlock(); - if (!IS_ERR(key_ref)) + if (!IS_ERR(key)) goto found; - switch (PTR_ERR(key_ref)) { + switch (PTR_ERR(key)) { case -EAGAIN: /* no key */ if (ret) break; case -ENOKEY: /* negative key */ - ret = key_ref; + ret = key; break; default: - err = key_ref; + err = key; break; } @@ -469,54 +465,51 @@ key_ref_t search_process_keyrings(struct key_type *type, goto no_key; rcu_read_lock(); - instkey_ref = __keyring_search_one( - make_key_ref(rcu_dereference( - context->signal->session_keyring), - 1), + instkey = __keyring_search_one( + rcu_dereference(context->signal->session_keyring), &key_type_request_key_auth, NULL, 0); rcu_read_unlock(); - if (IS_ERR(instkey_ref)) + if (IS_ERR(instkey)) goto no_key; - rka = key_ref_to_ptr(instkey_ref)->payload.data; + rka = instkey->payload.data; - key_ref = search_process_keyrings(type, description, match, - rka->context); - key_ref_put(instkey_ref); + key = search_process_keyrings(type, description, match, + rka->context); + key_put(instkey); - if (!IS_ERR(key_ref)) + if (!IS_ERR(key)) goto found; - switch (PTR_ERR(key_ref)) { + switch (PTR_ERR(key)) { case -EAGAIN: /* no key */ if (ret) break; case -ENOKEY: /* negative key */ - ret = key_ref; + ret = key; break; default: - err = key_ref; + err = key; break; } } /* or search the user-session keyring */ else { - key_ref = keyring_search_aux( - make_key_ref(context->user->session_keyring, 1), - context, type, description, match); - if (!IS_ERR(key_ref)) + key = keyring_search_aux(context->user->session_keyring, + context, type, description, match); + if (!IS_ERR(key)) goto found; - switch (PTR_ERR(key_ref)) { + switch (PTR_ERR(key)) { case -EAGAIN: /* no key */ if (ret) break; case -ENOKEY: /* negative key */ - ret = key_ref; + ret = key; break; default: - err = key_ref; + err = key; break; } } @@ -524,40 +517,29 @@ key_ref_t search_process_keyrings(struct key_type *type, no_key: /* no key - decide on the error we're going to go for */ - key_ref = ret ? ret : err; + key = ret ? ret : err; found: - return key_ref; + return key; } /* end search_process_keyrings() */ -/*****************************************************************************/ -/* - * see if the key we're looking at is the target key - */ -static int lookup_user_key_possessed(const struct key *key, const void *target) -{ - return key == target; - -} /* end lookup_user_key_possessed() */ - /*****************************************************************************/ /* * lookup a key given a key ID from userspace with a given permissions mask * - don't create special keyrings unless so requested * - partially constructed keys aren't found unless requested */ -key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id, - int create, int partial, key_perm_t perm) +struct key *lookup_user_key(struct task_struct *context, key_serial_t id, + int create, int partial, key_perm_t perm) { - key_ref_t key_ref, skey_ref; struct key *key; int ret; if (!context) context = current; - key_ref = ERR_PTR(-ENOKEY); + key = ERR_PTR(-ENOKEY); switch (id) { case KEY_SPEC_THREAD_KEYRING: @@ -574,7 +556,6 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id, key = context->thread_keyring; atomic_inc(&key->usage); - key_ref = make_key_ref(key, 1); break; case KEY_SPEC_PROCESS_KEYRING: @@ -591,7 +572,6 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id, key = context->signal->process_keyring; atomic_inc(&key->usage); - key_ref = make_key_ref(key, 1); break; case KEY_SPEC_SESSION_KEYRING: @@ -599,7 +579,7 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id, /* always install a session keyring upon access if one * doesn't exist yet */ ret = install_session_keyring( - context, context->user->session_keyring); + context, context->user->session_keyring); if (ret < 0) goto error; } @@ -608,19 +588,16 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id, key = rcu_dereference(context->signal->session_keyring); atomic_inc(&key->usage); rcu_read_unlock(); - key_ref = make_key_ref(key, 1); break; case KEY_SPEC_USER_KEYRING: key = context->user->uid_keyring; atomic_inc(&key->usage); - key_ref = make_key_ref(key, 1); break; case KEY_SPEC_USER_SESSION_KEYRING: key = context->user->session_keyring; atomic_inc(&key->usage); - key_ref = make_key_ref(key, 1); break; case KEY_SPEC_GROUP_KEYRING: @@ -629,28 +606,13 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id, goto error; default: - key_ref = ERR_PTR(-EINVAL); + key = ERR_PTR(-EINVAL); if (id < 1) goto error; key = key_lookup(id); - if (IS_ERR(key)) { - key_ref = ERR_PTR(PTR_ERR(key)); + if (IS_ERR(key)) goto error; - } - - key_ref = make_key_ref(key, 0); - - /* check to see if we possess the key */ - skey_ref = search_process_keyrings(key->type, key, - lookup_user_key_possessed, - current); - - if (!IS_ERR(skey_ref)) { - key_put(key); - key_ref = skey_ref; - } - break; } @@ -668,15 +630,15 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id, /* check the permissions */ ret = -EACCES; - if (!key_task_permission(key_ref, context, perm)) + if (!key_task_permission(key, context, perm)) goto invalid_key; -error: - return key_ref; + error: + return key; -invalid_key: - key_ref_put(key_ref); - key_ref = ERR_PTR(ret); + invalid_key: + key_put(key); + key = ERR_PTR(ret); goto error; } /* end lookup_user_key() */ @@ -732,9 +694,9 @@ long join_session_keyring(const char *name) ret = keyring->serial; key_put(keyring); -error2: + error2: up(&key_session_sem); -error: + error: return ret; } /* end join_session_keyring() */ diff --git a/trunk/security/keys/request_key.c b/trunk/security/keys/request_key.c index 5cc4bba70db6..90c1506d007c 100644 --- a/trunk/security/keys/request_key.c +++ b/trunk/security/keys/request_key.c @@ -7,8 +7,6 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. - * - * See Documentation/keys-request-key.txt */ #include @@ -131,7 +129,7 @@ static struct key *__request_key_construction(struct key_type *type, /* create a key and add it to the queue */ key = key_alloc(type, description, - current->fsuid, current->fsgid, KEY_POS_ALL, 0); + current->fsuid, current->fsgid, KEY_USR_ALL, 0); if (IS_ERR(key)) goto alloc_failed; @@ -367,24 +365,14 @@ struct key *request_key_and_link(struct key_type *type, { struct key_user *user; struct key *key; - key_ref_t key_ref; kenter("%s,%s,%s,%p", type->name, description, callout_info, dest_keyring); /* search all the process keyrings for a key */ - key_ref = search_process_keyrings(type, description, type->match, - current); - - kdebug("search 1: %p", key_ref); + key = search_process_keyrings(type, description, type->match, current); - if (!IS_ERR(key_ref)) { - key = key_ref_to_ptr(key_ref); - } - else if (PTR_ERR(key_ref) != -EAGAIN) { - key = ERR_PTR(PTR_ERR(key_ref)); - } - else { + if (PTR_ERR(key) == -EAGAIN) { /* the search failed, but the keyrings were searchable, so we * should consult userspace if we can */ key = ERR_PTR(-ENOKEY); @@ -396,7 +384,7 @@ struct key *request_key_and_link(struct key_type *type, if (!user) goto nomem; - for (;;) { + do { if (signal_pending(current)) goto interrupted; @@ -409,22 +397,10 @@ struct key *request_key_and_link(struct key_type *type, /* someone else made the key we want, so we need to * search again as it might now be available to us */ - key_ref = search_process_keyrings(type, description, - type->match, - current); - - kdebug("search 2: %p", key_ref); + key = search_process_keyrings(type, description, + type->match, current); - if (!IS_ERR(key_ref)) { - key = key_ref_to_ptr(key_ref); - break; - } - - if (PTR_ERR(key_ref) != -EAGAIN) { - key = ERR_PTR(PTR_ERR(key_ref)); - break; - } - } + } while (PTR_ERR(key) == -EAGAIN); key_user_put(user); diff --git a/trunk/security/keys/request_key_auth.c b/trunk/security/keys/request_key_auth.c index a8e4069d48cb..f22264632229 100644 --- a/trunk/security/keys/request_key_auth.c +++ b/trunk/security/keys/request_key_auth.c @@ -7,8 +7,6 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. - * - * See Documentation/keys-request-key.txt */ #include @@ -98,7 +96,6 @@ static void request_key_auth_destroy(struct key *key) kenter("{%d}", key->serial); key_put(rka->target_key); - kfree(rka); } /* end request_key_auth_destroy() */ @@ -129,7 +126,7 @@ struct key *request_key_auth_new(struct key *target, struct key **_rkakey) rkakey = key_alloc(&key_type_request_key_auth, desc, current->fsuid, current->fsgid, - KEY_POS_VIEW | KEY_USR_VIEW, 1); + KEY_USR_VIEW, 1); if (IS_ERR(rkakey)) { key_put(keyring); kleave("= %ld", PTR_ERR(rkakey)); diff --git a/trunk/security/selinux/hooks.c b/trunk/security/selinux/hooks.c index b13be15165f5..6e4937fe062b 100644 --- a/trunk/security/selinux/hooks.c +++ b/trunk/security/selinux/hooks.c @@ -630,16 +630,6 @@ static inline u16 inode_mode_to_security_class(umode_t mode) return SECCLASS_FILE; } -static inline int default_protocol_stream(int protocol) -{ - return (protocol == IPPROTO_IP || protocol == IPPROTO_TCP); -} - -static inline int default_protocol_dgram(int protocol) -{ - return (protocol == IPPROTO_IP || protocol == IPPROTO_UDP); -} - static inline u16 socket_type_to_security_class(int family, int type, int protocol) { switch (family) { @@ -656,16 +646,10 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc case PF_INET6: switch (type) { case SOCK_STREAM: - if (default_protocol_stream(protocol)) - return SECCLASS_TCP_SOCKET; - else - return SECCLASS_RAWIP_SOCKET; + return SECCLASS_TCP_SOCKET; case SOCK_DGRAM: - if (default_protocol_dgram(protocol)) - return SECCLASS_UDP_SOCKET; - else - return SECCLASS_RAWIP_SOCKET; - default: + return SECCLASS_UDP_SOCKET; + case SOCK_RAW: return SECCLASS_RAWIP_SOCKET; } break; @@ -2986,8 +2970,6 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in /* * If PF_INET or PF_INET6, check name_bind permission for the port. - * Multiple address binding for SCTP is not supported yet: we just - * check the first address now. */ family = sock->sk->sk_family; if (family == PF_INET || family == PF_INET6) { @@ -3032,12 +3014,12 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in goto out; } - switch(isec->sclass) { - case SECCLASS_TCP_SOCKET: + switch(sk->sk_protocol) { + case IPPROTO_TCP: node_perm = TCP_SOCKET__NODE_BIND; break; - case SECCLASS_UDP_SOCKET: + case IPPROTO_UDP: node_perm = UDP_SOCKET__NODE_BIND; break; diff --git a/trunk/sound/arm/pxa2xx-ac97.c b/trunk/sound/arm/pxa2xx-ac97.c index 38b20efc9c0b..29450befb5da 100644 --- a/trunk/sound/arm/pxa2xx-ac97.c +++ b/trunk/sound/arm/pxa2xx-ac97.c @@ -245,7 +245,7 @@ static pxa2xx_pcm_client_t pxa2xx_ac97_pcm_client = { #ifdef CONFIG_PM -static int pxa2xx_ac97_do_suspend(snd_card_t *card, pm_message_t state) +static int pxa2xx_ac97_do_suspend(snd_card_t *card, unsigned int state) { if (card->power_state != SNDRV_CTL_POWER_D3cold) { pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; diff --git a/trunk/sound/core/memalloc.c b/trunk/sound/core/memalloc.c index e72cec77f0db..91124ddbdda9 100644 --- a/trunk/sound/core/memalloc.c +++ b/trunk/sound/core/memalloc.c @@ -106,7 +106,7 @@ struct snd_mem_list { static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, - gfp_t flags) + unsigned int __nocast flags) { void *ret; u64 dma_mask, coherent_dma_mask; diff --git a/trunk/sound/core/memory.c b/trunk/sound/core/memory.c index 7d8e2eebba51..8fa888fc53a0 100644 --- a/trunk/sound/core/memory.c +++ b/trunk/sound/core/memory.c @@ -89,7 +89,7 @@ void snd_memory_done(void) } } -static void *__snd_kmalloc(size_t size, gfp_t flags, void *caller) +static void *__snd_kmalloc(size_t size, unsigned int __nocast flags, void *caller) { unsigned long cpu_flags; struct snd_alloc_track *t; @@ -111,12 +111,12 @@ static void *__snd_kmalloc(size_t size, gfp_t flags, void *caller) } #define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0)); -void *snd_hidden_kmalloc(size_t size, gfp_t flags) +void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags) { return _snd_kmalloc(size, flags); } -void *snd_hidden_kzalloc(size_t size, gfp_t flags) +void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags) { void *ret = _snd_kmalloc(size, flags); if (ret) @@ -125,7 +125,7 @@ void *snd_hidden_kzalloc(size_t size, gfp_t flags) } EXPORT_SYMBOL(snd_hidden_kzalloc); -void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags) +void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags) { void *ret = NULL; if (n != 0 && size > INT_MAX / n) @@ -190,7 +190,7 @@ void snd_hidden_vfree(void *obj) snd_wrapper_vfree(obj); } -char *snd_hidden_kstrdup(const char *s, gfp_t flags) +char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags) { int len; char *buf; diff --git a/trunk/sound/core/seq/instr/ainstr_iw.c b/trunk/sound/core/seq/instr/ainstr_iw.c index 67c24c8e8e7b..b3cee092b1a4 100644 --- a/trunk/sound/core/seq/instr/ainstr_iw.c +++ b/trunk/sound/core/seq/instr/ainstr_iw.c @@ -58,7 +58,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, iwffff_xenv_t *ex, char __user **data, long *len, - gfp_t gfp_mask) + unsigned int __nocast gfp_mask) { __u32 stype; iwffff_env_record_t *rp, *rp_last; diff --git a/trunk/sound/core/wrappers.c b/trunk/sound/core/wrappers.c index 296b716f1376..508e6d67ee19 100644 --- a/trunk/sound/core/wrappers.c +++ b/trunk/sound/core/wrappers.c @@ -27,7 +27,7 @@ #include #ifdef CONFIG_SND_DEBUG_MEMORY -void *snd_wrapper_kmalloc(size_t size, gfp_t flags) +void *snd_wrapper_kmalloc(size_t size, unsigned int __nocast flags) { return kmalloc(size, flags); } diff --git a/trunk/sound/isa/opl3sa2.c b/trunk/sound/isa/opl3sa2.c index 4ba268f251e3..e2d2babcd20b 100644 --- a/trunk/sound/isa/opl3sa2.c +++ b/trunk/sound/isa/opl3sa2.c @@ -914,7 +914,6 @@ static int __init alsa_card_opl3sa2_init(void) #endif #ifdef CONFIG_PNP pnp_unregister_card_driver(&opl3sa2_pnpc_driver); - pnp_unregister_driver(&opl3sa2_pnp_driver); #endif return -ENODEV; } @@ -928,7 +927,6 @@ static void __exit alsa_card_opl3sa2_exit(void) #ifdef CONFIG_PNP /* PnP cards first */ pnp_unregister_card_driver(&opl3sa2_pnpc_driver); - pnp_unregister_driver(&opl3sa2_pnp_driver); #endif for (idx = 0; idx < SNDRV_CARDS; idx++) snd_card_free(snd_opl3sa2_legacy[idx]); diff --git a/trunk/sound/pci/ac97/ac97_bus.c b/trunk/sound/pci/ac97/ac97_bus.c index becbc420ba41..227f8b9f67ce 100644 --- a/trunk/sound/pci/ac97/ac97_bus.c +++ b/trunk/sound/pci/ac97/ac97_bus.c @@ -17,21 +17,25 @@ #include /* - * Let drivers decide whether they want to support given codec from their - * probe method. Drivers have direct access to the ac97_t structure and may - * decide based on the id field amongst other things. + * Codec families have names seperated by commas, so we search for an + * individual codec name within the family string. */ static int ac97_bus_match(struct device *dev, struct device_driver *drv) { - return 1; + return (strstr(dev->bus_id, drv->name) != NULL); } static int ac97_bus_suspend(struct device *dev, pm_message_t state) { int ret = 0; - if (dev->driver && dev->driver->suspend) - ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN); + if (dev->driver && dev->driver->suspend) { + ret = dev->driver->suspend(dev, state, SUSPEND_DISABLE); + if (ret == 0) + ret = dev->driver->suspend(dev, state, SUSPEND_SAVE_STATE); + if (ret == 0) + ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN); + } return ret; } @@ -39,8 +43,13 @@ static int ac97_bus_resume(struct device *dev) { int ret = 0; - if (dev->driver && dev->driver->resume) + if (dev->driver && dev->driver->resume) { ret = dev->driver->resume(dev, RESUME_POWER_ON); + if (ret == 0) + ret = dev->driver->resume(dev, RESUME_RESTORE_STATE); + if (ret == 0) + ret = dev->driver->resume(dev, RESUME_ENABLE); + } return ret; } diff --git a/trunk/sound/pci/ac97/ac97_codec.c b/trunk/sound/pci/ac97/ac97_codec.c index 41fc290149ed..e64cb07a39c2 100644 --- a/trunk/sound/pci/ac97/ac97_codec.c +++ b/trunk/sound/pci/ac97/ac97_codec.c @@ -1557,7 +1557,7 @@ static int snd_ac97_modem_build(snd_card_t * card, ac97_t * ac97) /* build modem switches */ for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++) - if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ac97_controls_modem_switches[idx], ac97))) < 0) + if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_modem_switches[idx], ac97))) < 0) return err; /* build chip specific controls */ @@ -1828,6 +1828,7 @@ static int snd_ac97_dev_register(snd_device_t *device) ac97->dev.bus = &ac97_bus_type; ac97->dev.parent = ac97->bus->card->dev; + ac97->dev.platform_data = ac97; ac97->dev.release = ac97_device_release; snprintf(ac97->dev.bus_id, BUS_ID_SIZE, "card%d-%d", ac97->bus->card->number, ac97->num); if ((err = device_register(&ac97->dev)) < 0) { diff --git a/trunk/sound/pci/ac97/ac97_patch.c b/trunk/sound/pci/ac97/ac97_patch.c index 0238cc65d32a..045ddc743edc 100644 --- a/trunk/sound/pci/ac97/ac97_patch.c +++ b/trunk/sound/pci/ac97/ac97_patch.c @@ -2752,11 +2752,7 @@ AC97_DOUBLE("Modem Speaker Volume", 0x5c, 14, 12, 3, 1) static int patch_si3036_specific(ac97_t * ac97) { - int idx, err; - for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_si3036); idx++) - if ((err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97))) < 0) - return err; - return 0; + return patch_build_controls(ac97, snd_ac97_controls_si3036, ARRAY_SIZE(snd_ac97_controls_si3036)); } static struct snd_ac97_build_ops patch_si3036_ops = { diff --git a/trunk/sound/pci/ali5451/ali5451.c b/trunk/sound/pci/ali5451/ali5451.c index f35b558c29b2..d683f7736a63 100644 --- a/trunk/sound/pci/ali5451/ali5451.c +++ b/trunk/sound/pci/ali5451/ali5451.c @@ -1993,10 +1993,8 @@ static int __devinit snd_ali_mixer(ali_t * codec) if ((err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i])) < 0) { snd_printk("ali mixer %d creating error.\n", i); if(i == 0) - return err; - codec->num_of_codecs = 1; - break; - } + return err; + } } if (codec->spdif_support) { diff --git a/trunk/sound/pci/emu10k1/emu10k1_main.c b/trunk/sound/pci/emu10k1/emu10k1_main.c index e9cd8e054f25..e87e8427f25f 100644 --- a/trunk/sound/pci/emu10k1/emu10k1_main.c +++ b/trunk/sound/pci/emu10k1/emu10k1_main.c @@ -756,12 +756,9 @@ static emu_chip_details_t emu_chip_details[] = { .sblive51 = 1} , /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */ {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, - .driver = "EMU10K1", .name = "SBLive 5.1 [SB0060]", + .driver = "EMU10K1", .name = "SBLive! Platinum 5.1 [SB0060]", .id = "Live", .emu10k1_chip = 1, - .ac97_chip = 2, /* ac97 is optional; both SBLive 5.1 and platinum - * share the same IDs! - */ .sblive51 = 1} , {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", diff --git a/trunk/sound/pci/emu10k1/emumixer.c b/trunk/sound/pci/emu10k1/emumixer.c index 7cc831ccd0cb..d71a72e84bcc 100644 --- a/trunk/sound/pci/emu10k1/emumixer.c +++ b/trunk/sound/pci/emu10k1/emumixer.c @@ -810,14 +810,8 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu, ac97.private_data = emu; ac97.private_free = snd_emu10k1_mixer_free_ac97; ac97.scaps = AC97_SCAP_NO_SPDIF; - if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) { - if (emu->card_capabilities->ac97_chip == 1) - return err; - snd_printd(KERN_INFO "emu10k1: AC97 is optional on this board\n"); - snd_printd(KERN_INFO" Proceeding without ac97 mixers...\n"); - snd_device_free(emu->card, pbus); - goto no_ac97; /* FIXME: get rid of ugly gotos.. */ - } + if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) + return err; if (emu->audigy) { /* set master volume to 0 dB */ snd_ac97_write(emu->ac97, AC97_MASTER, 0x0000); @@ -842,7 +836,6 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu, for (; *c; c++) remove_ctl(card, *c); } else { - no_ac97: if (emu->card_capabilities->ecard) strcpy(emu->card->mixername, "EMU APS"); else if (emu->audigy) diff --git a/trunk/sound/pci/hda/hda_generic.c b/trunk/sound/pci/hda/hda_generic.c index d0eb9f2250aa..5b829a1a4c60 100644 --- a/trunk/sound/pci/hda/hda_generic.c +++ b/trunk/sound/pci/hda/hda_generic.c @@ -881,8 +881,10 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec) struct hda_gspec *spec; int err; - if(!codec->afg) - return 0; + if(!codec->afg) { + snd_printdd("hda_generic: no generic modem yet\n"); + return -ENODEV; + } spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) { diff --git a/trunk/sound/pci/hda/hda_intel.c b/trunk/sound/pci/hda/hda_intel.c index 6fe696e53ea6..9590ece2099d 100644 --- a/trunk/sound/pci/hda/hda_intel.c +++ b/trunk/sound/pci/hda/hda_intel.c @@ -1137,7 +1137,6 @@ static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream) pos = azx_sd_readl(azx_dev, SD_LPIB); if (chip->position_fix == POS_FIX_FIFO) pos += azx_dev->fifo_size; -#if 0 /* disabled temprarily, auto-correction doesn't work well... */ else if (chip->position_fix == POS_FIX_AUTO && azx_dev->period_updating) { /* check the validity of DMA position */ unsigned int diff = 0; @@ -1158,10 +1157,6 @@ static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream) } azx_dev->period_updating = 0; } -#else - else if (chip->position_fix == POS_FIX_AUTO) - pos += azx_dev->fifo_size; -#endif } if (pos >= azx_dev->bufsize) pos = 0; diff --git a/trunk/sound/pci/hda/patch_realtek.c b/trunk/sound/pci/hda/patch_realtek.c index 7327deb6df9f..849b5b50c921 100644 --- a/trunk/sound/pci/hda/patch_realtek.c +++ b/trunk/sound/pci/hda/patch_realtek.c @@ -1385,8 +1385,8 @@ static snd_kcontrol_new_t alc880_test_mixer[] = { HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - ALC_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), - ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), + ALC_BIND_MUTE("CLFE Playback Volume", 0x0e, 2, HDA_INPUT), + ALC_BIND_MUTE("Side Playback Volume", 0x0f, 2, HDA_INPUT), PIN_CTL_TEST("Front Pin Mode", 0x14), PIN_CTL_TEST("Surround Pin Mode", 0x15), PIN_CTL_TEST("CLFE Pin Mode", 0x16), @@ -1409,6 +1409,18 @@ static snd_kcontrol_new_t alc880_test_mixer[] = { HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), + HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), + HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Input Source", + .count = 2, + .info = alc_mux_enum_info, + .get = alc_mux_enum_get, + .put = alc_mux_enum_put, + }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Channel Mode", @@ -2231,7 +2243,7 @@ static snd_kcontrol_new_t alc260_base_mixer[] = { HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), - ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), + ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_OUTPUT), HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), { @@ -2258,7 +2270,7 @@ static snd_kcontrol_new_t alc260_hp_mixer[] = { HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), - ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), + ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_OUTPUT), HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), { @@ -2489,7 +2501,7 @@ static snd_kcontrol_new_t alc882_base_mixer[] = { HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), + ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_OUTPUT), HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), diff --git a/trunk/sound/pci/korg1212/korg1212.c b/trunk/sound/pci/korg1212/korg1212.c index 5561fd4091e8..09f9cbe116a3 100644 --- a/trunk/sound/pci/korg1212/korg1212.c +++ b/trunk/sound/pci/korg1212/korg1212.c @@ -442,7 +442,7 @@ static char* stateName[] = { "Setup for play", "Playing", "Monitor mode on", - "Calibrating", + "Calibrating" "Invalid" }; diff --git a/trunk/sound/pci/via82xx.c b/trunk/sound/pci/via82xx.c index 3c0205b91e10..6db7de6b9719 100644 --- a/trunk/sound/pci/via82xx.c +++ b/trunk/sound/pci/via82xx.c @@ -2147,13 +2147,11 @@ static int __devinit check_dxs_list(struct pci_dev *pci) { .subvendor = 0x1019, .subdevice = 0x0996, .action = VIA_DXS_48K }, { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */ { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */ - { .subvendor = 0x1019, .subdevice = 0xa101, .action = VIA_DXS_SRC }, { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */ { .subvendor = 0x1025, .subdevice = 0x0046, .action = VIA_DXS_SRC }, /* Acer Aspire 1524 WLMi */ { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/ { .subvendor = 0x1043, .subdevice = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */ { .subvendor = 0x1043, .subdevice = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/ - { .subvendor = 0x1043, .subdevice = 0x810d, .action = VIA_DXS_SRC }, /* ASUS */ { .subvendor = 0x1043, .subdevice = 0x812a, .action = VIA_DXS_SRC }, /* ASUS A8V Deluxe */ { .subvendor = 0x1071, .subdevice = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */ { .subvendor = 0x1071, .subdevice = 0x8399, .action = VIA_DXS_NO_VRA }, /* Umax AB 595T (VIA K8N800A - VT8237) */ diff --git a/trunk/sound/ppc/pmac.c b/trunk/sound/ppc/pmac.c index 392b2abd9f13..e35b48d29c45 100644 --- a/trunk/sound/ppc/pmac.c +++ b/trunk/sound/ppc/pmac.c @@ -988,7 +988,6 @@ static int __init snd_pmac_detect(pmac_t *chip) case 0x33: case 0x29: case 0x24: - case 0x50: case 0x5c: chip->num_freqs = ARRAY_SIZE(tumbler_freqs); chip->model = PMAC_SNAPPER; diff --git a/trunk/sound/usb/usbaudio.c b/trunk/sound/usb/usbaudio.c index 2ead878bcb8f..d5ae2055b896 100644 --- a/trunk/sound/usb/usbaudio.c +++ b/trunk/sound/usb/usbaudio.c @@ -1444,9 +1444,9 @@ static snd_pcm_hardware_t snd_usb_playback = SNDRV_PCM_INFO_BATCH | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER, - .buffer_bytes_max = 1024 * 1024, + .buffer_bytes_max = (256*1024), .period_bytes_min = 64, - .period_bytes_max = 512 * 1024, + .period_bytes_max = (128*1024), .periods_min = 2, .periods_max = 1024, }; @@ -1458,9 +1458,9 @@ static snd_pcm_hardware_t snd_usb_capture = SNDRV_PCM_INFO_BATCH | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER, - .buffer_bytes_max = 1024 * 1024, + .buffer_bytes_max = (256*1024), .period_bytes_min = 64, - .period_bytes_max = 512 * 1024, + .period_bytes_max = (128*1024), .periods_min = 2, .periods_max = 1024, }; diff --git a/trunk/sound/usb/usbmixer_maps.c b/trunk/sound/usb/usbmixer_maps.c index c1264434e50a..f05500b05ec0 100644 --- a/trunk/sound/usb/usbmixer_maps.c +++ b/trunk/sound/usb/usbmixer_maps.c @@ -237,16 +237,6 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { .map = audigy2nx_map, .selector_map = audigy2nx_selectors, }, - { - /* Hercules DJ Console (Windows Edition) */ - .id = USB_ID(0x06f8, 0xb000), - .ignore_ctl_error = 1, - }, - { - /* Hercules DJ Console (Macintosh Edition) */ - .id = USB_ID(0x06f8, 0xd002), - .ignore_ctl_error = 1, - }, { .id = USB_ID(0x08bb, 0x2702), .map = linex_map, diff --git a/trunk/sound/usb/usbquirks.h b/trunk/sound/usb/usbquirks.h index 948759da6563..f74e652a1e51 100644 --- a/trunk/sound/usb/usbquirks.h +++ b/trunk/sound/usb/usbquirks.h @@ -117,10 +117,6 @@ YAMAHA_DEVICE(0x103a, NULL), YAMAHA_DEVICE(0x103b, NULL), YAMAHA_DEVICE(0x103c, NULL), YAMAHA_DEVICE(0x103d, NULL), -YAMAHA_DEVICE(0x103e, NULL), -YAMAHA_DEVICE(0x103f, NULL), -YAMAHA_DEVICE(0x1040, NULL), -YAMAHA_DEVICE(0x1041, NULL), YAMAHA_DEVICE(0x2000, "DGP-7"), YAMAHA_DEVICE(0x2001, "DGP-5"), YAMAHA_DEVICE(0x2002, NULL), @@ -1014,40 +1010,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, -{ - USB_DEVICE_VENDOR_SPEC(0x0582, 0x007a), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { - .vendor_name = "Roland", - /* RD-700SX, RD-300SX */ - .ifnum = 0, - .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { - .out_cables = 0x0003, - .in_cables = 0x0003 - } - } -}, - -/* Guillemot devices */ -{ - /* - * This is for the "Windows Edition" where the external MIDI ports are - * the only MIDI ports; the control data is reported through HID - * interfaces. The "Macintosh Edition" has ID 0xd002 and uses standard - * compliant USB MIDI ports for external MIDI and controls. - */ - USB_DEVICE_VENDOR_SPEC(0x06f8, 0xb000), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { - .vendor_name = "Hercules", - .product_name = "DJ Console (WE)", - .ifnum = 4, - .type = QUIRK_MIDI_FIXED_ENDPOINT, - .data = & (const snd_usb_midi_endpoint_info_t) { - .out_cables = 0x0001, - .in_cables = 0x0001 - } - } -}, /* Midiman/M-Audio devices */ { @@ -1377,20 +1339,10 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, -/* TerraTec devices */ -{ - USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), - .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { - .vendor_name = "TerraTec", - .product_name = "PHASE 26", - .ifnum = 3, - .type = QUIRK_MIDI_STANDARD_INTERFACE - } -}, { USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0013), .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { - .vendor_name = "TerraTec", + .vendor_name = "Terratec", .product_name = "PHASE 26", .ifnum = 3, .type = QUIRK_MIDI_STANDARD_INTERFACE